init
This commit is contained in:
786
modules/DynamicFields/DynamicField.php
Executable file
786
modules/DynamicFields/DynamicField.php
Executable file
@@ -0,0 +1,786 @@
|
||||
<?php
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
die ( 'Not A Valid Entry Point' ) ;
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
class DynamicField {
|
||||
|
||||
var $use_existing_labels = false; // this value is set to true by install_custom_fields() in ModuleInstaller.php; everything else expects it to be false
|
||||
|
||||
function DynamicField($module = '') {
|
||||
$this->module = (! empty ( $module )) ? $module :( (isset($_REQUEST['module']) && ! empty($_REQUEST['module'])) ? $_REQUEST ['module'] : '');
|
||||
}
|
||||
|
||||
function getModuleName()
|
||||
{
|
||||
return $this->module ;
|
||||
}
|
||||
|
||||
/*
|
||||
* As DynamicField has a counterpart in MBModule, provide the MBModule function getPackagename() here also
|
||||
*/
|
||||
function getPackageName()
|
||||
{
|
||||
return null ;
|
||||
}
|
||||
|
||||
function deleteCache(){
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This will add the bean as a reference in this object as well as building the custom field cache if it has not been built
|
||||
* LOADS THE BEAN IF THE BEAN IS NOT BEING PASSED ALONG IN SETUP IT SHOULD BE SET PRIOR TO SETUP
|
||||
*
|
||||
* @param SUGARBEAN $bean
|
||||
*/
|
||||
function setup($bean = null) {
|
||||
if ($bean) {
|
||||
$this->bean = & $bean;
|
||||
}
|
||||
if (isset ( $this->bean->module_dir )) {
|
||||
$this->module = $this->bean->module_dir;
|
||||
}
|
||||
if(!isset($GLOBALS['dictionary'][$this->bean->object_name]['custom_fields'])){
|
||||
$this->buildCache ( $this->module );
|
||||
}
|
||||
}
|
||||
|
||||
function setLabel( $language='en_us' , $key , $value )
|
||||
{
|
||||
$params [ "label_" . $key ] = $value;
|
||||
require_once 'modules/ModuleBuilder/parsers/parser.label.php' ;
|
||||
$parser = new ParserLabel ( $this->module ) ;
|
||||
$parser->handleSave( $params , $language);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the cache for custom fields based on the vardefs
|
||||
*
|
||||
* @param STRING $module
|
||||
* @return unknown
|
||||
*/
|
||||
function buildCache($module = false) {
|
||||
//We can't build the cache while installing as the required database tables may not exist.
|
||||
if (!empty($GLOBALS['installing']) && $GLOBALS['installing'] == true)
|
||||
return false;
|
||||
if($module == '../data')return false;
|
||||
|
||||
static $results = array ( ) ;
|
||||
|
||||
$where = '';
|
||||
if (! empty ( $module )) {
|
||||
$where .= " custom_module='$module' AND ";
|
||||
unset( $results[ $module ] ) ; // clear out any old results for the module as $results is declared static
|
||||
}
|
||||
else
|
||||
{
|
||||
$results = array ( ) ; // clear out results - if we remove a module we don't want to have its old vardefs hanging around
|
||||
}
|
||||
|
||||
$GLOBALS['log']->debug('rebuilding cache for ' . $module);
|
||||
$query = "SELECT * FROM fields_meta_data WHERE $where deleted = 0";
|
||||
|
||||
$result = $GLOBALS['db']->query ( $query );
|
||||
require_once ('modules/DynamicFields/FieldCases.php');
|
||||
|
||||
// retrieve the field definition from the fields_meta_data table
|
||||
// using 'encode'=false to fetchByAssoc to prevent any pre-formatting of the base metadata
|
||||
// for immediate use in HTML. This metadata will be further massaged by get_field_def() and so should not be pre-formatted
|
||||
while ( $row = $GLOBALS['db']->fetchByAssoc ( $result , -1 ,false ) ) {
|
||||
$field = get_widget ( $row ['type'] );
|
||||
|
||||
foreach ( $row as $key => $value ) {
|
||||
$field->$key = $value;
|
||||
}
|
||||
$field->default = $field->default_value;
|
||||
$vardef = $field->get_field_def ();
|
||||
$vardef ['id'] = $row ['id'];
|
||||
$vardef ['custom_module'] = $row ['custom_module'];
|
||||
if (empty ( $vardef ['source'] ))
|
||||
$vardef ['source'] = 'custom_fields';
|
||||
if (empty ( $results [$row ['custom_module']] ))
|
||||
$results [$row ['custom_module']] = array ( );
|
||||
$results [$row ['custom_module']] [$row ['name']] = $vardef;
|
||||
}
|
||||
if (empty ( $module )) {
|
||||
foreach ( $results as $module => $result ) {
|
||||
$this->saveToVardef ( $module, $result );
|
||||
}
|
||||
} else {
|
||||
if (! empty ( $results [$module] )) {
|
||||
$this->saveToVardef ( $module, $results [$module] );
|
||||
}else{
|
||||
$this->saveToVardef ( $module, false );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the widget for a custom field from the fields_meta_data table.
|
||||
*/
|
||||
function getFieldWidget($module, $fieldName) {
|
||||
if (empty($module) || empty($fieldName)){
|
||||
sugar_die("Unable to load widget for '$module' : '$fieldName'");
|
||||
}
|
||||
$query = "SELECT * FROM fields_meta_data WHERE custom_module='$module' AND name='$fieldName' AND deleted = 0";
|
||||
$result = $GLOBALS['db']->query ( $query );
|
||||
require_once ('modules/DynamicFields/FieldCases.php');
|
||||
if ( $row = $GLOBALS['db']->fetchByAssoc ( $result ) ) {
|
||||
$field = get_widget ( $row ['type'] );
|
||||
$field->populateFromRow($row);
|
||||
return $field;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the cached vardefs with the custom field information stored in result
|
||||
*
|
||||
* @param string $module
|
||||
* @param array $result
|
||||
*/
|
||||
function saveToVardef($module,$result) {
|
||||
|
||||
global $beanList;
|
||||
if (! empty ( $beanList [$module] )) {
|
||||
$object = $beanList [$module];
|
||||
|
||||
if ($object == 'aCase') {
|
||||
$object = 'Case';
|
||||
}
|
||||
|
||||
if(empty($GLOBALS['dictionary'][$object]['fields'])){
|
||||
//if the vardef isn't loaded let's try loading it.
|
||||
VardefManager::refreshVardefs($module,$object, null, false);
|
||||
//if it's still not loaded we really don't have anything useful to cache
|
||||
if(empty($GLOBALS['dictionary'][$object]['fields']))return;
|
||||
}
|
||||
$GLOBALS ['dictionary'] [$object] ['custom_fields'] = false;
|
||||
if (! empty ( $GLOBALS ['dictionary'] [$object] )) {
|
||||
if (! empty ( $result )) {
|
||||
// First loop to add
|
||||
|
||||
foreach ( $result as $field ) {
|
||||
foreach($field as $k=>$v){
|
||||
//allows values for custom fields to be defined outside of the scope of studio
|
||||
if(!isset($GLOBALS ['dictionary'] [$object] ['fields'] [$field ['name']][$k])){
|
||||
$GLOBALS ['dictionary'] [$object] ['fields'] [$field ['name']][$k] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Second loop to remove
|
||||
foreach ( $GLOBALS ['dictionary'] [$object] ['fields'] as $name => $fieldDef ) {
|
||||
|
||||
if (isset ( $fieldDef ['custom_module'] )) {
|
||||
if (! isset ( $result [$name] )) {
|
||||
unset ( $GLOBALS ['dictionary'] [$object] ['fields'] [$name] );
|
||||
} else {
|
||||
$GLOBALS ['dictionary'] [$object] ['custom_fields'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
} //if
|
||||
}
|
||||
}
|
||||
$manager = new VardefManager ( );
|
||||
$manager->saveCache ( $this->module, $object );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns either false or an array containing the select and join parameter for a query using custom fields
|
||||
* @param $expandedList boolean If true, return a list of all fields with source=custom_fields in the select instead of the standard _cstm.*
|
||||
* This is required for any downstream construction of a SQL statement where we need to manipulate the select list,
|
||||
* for example, listviews with custom relate fields where the value comes from join rather than from the custom table
|
||||
*
|
||||
* @return array select=>select columns, join=>prebuilt join statement
|
||||
*/
|
||||
function getJOIN( $expandedList = false , $includeRelates = false){
|
||||
|
||||
if(!$this->bean->hasCustomFields()){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! $expandedList )
|
||||
{
|
||||
$select = ",{$this->bean->table_name}_cstm.*" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$select = '';
|
||||
foreach($this->bean->field_defs as $name=>$field)
|
||||
{
|
||||
if (!empty($field['source']) && $field['source'] == 'custom_fields')
|
||||
// assumption: that the column name in _cstm is the same as the field name. Currently true.
|
||||
// however, two types of dynamic fields do not have columns in the custom table - html fields (they're readonly) and flex relates (parent_name doesn't exist)
|
||||
if ( $field['type'] != 'html' && $name != 'parent_name' && $field['type'] != 'text')
|
||||
$select .= ",{$this->bean->table_name}_cstm.{$name}" ;
|
||||
}
|
||||
}
|
||||
$join = " LEFT JOIN " .$this->bean->table_name. "_cstm ON " .$this->bean->table_name. ".id = ". $this->bean->table_name. "_cstm.id_c ";
|
||||
|
||||
if ($includeRelates) {
|
||||
$jtAlias = "relJoin";
|
||||
$jtCount = 1;
|
||||
foreach($this->bean->field_defs as $name=>$field)
|
||||
{
|
||||
if ($field['type'] == 'relate' && isset($field['custom_module'])) {
|
||||
$relateJoinInfo = $this->getRelateJoin($field, $jtAlias.$jtCount);
|
||||
$select .= $relateJoinInfo['select'];
|
||||
$join .= $relateJoinInfo['from'];
|
||||
//bug 27654 martin
|
||||
if ($where)
|
||||
{
|
||||
$pattern = '/'.$field['name'].'\slike/i';
|
||||
$replacement = $relateJoinInfo['name_field'].' like';
|
||||
$where = preg_replace($pattern,$replacement,$where);
|
||||
}
|
||||
$jtCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array('select'=>$select, 'join'=>$join);
|
||||
|
||||
}
|
||||
|
||||
function getRelateJoin($field_def, $joinTableAlias) {
|
||||
if (empty($field_def['type']) || $field_def['type'] != "relate") {
|
||||
return false;
|
||||
}
|
||||
global $beanFiles, $beanList, $module;
|
||||
$rel_module = $field_def['module'];
|
||||
if(empty($beanFiles[$beanList[$rel_module]])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
require_once($beanFiles[$beanList[$rel_module]]);
|
||||
$rel_mod = new $beanList[$rel_module]();
|
||||
$rel_table = $rel_mod->table_name;
|
||||
if (isset($rel_mod->field_defs['name']))
|
||||
{
|
||||
$name_field_def = $rel_mod->field_defs['name'];
|
||||
if(isset($name_field_def['db_concat_fields']))
|
||||
{
|
||||
$name_field = db_concat($joinTableAlias, $name_field_def['db_concat_fields']);
|
||||
}
|
||||
//If the name field is non-db, we need to find another field to display
|
||||
else if(!empty($rel_mod->field_defs['name']['source']) && $rel_mod->field_defs['name']['source'] == "non-db" && !empty($field_def['rname']))
|
||||
{
|
||||
$name_field = "$joinTableAlias." . $field_def['rname'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$name_field = "$joinTableAlias.name";
|
||||
}
|
||||
}
|
||||
$tableName = isset($field_def['custom_module']) ? "{$this->bean->table_name}_cstm" : $this->bean->table_name ;
|
||||
$relID = $field_def['id_name'];
|
||||
$ret_array['rel_table'] = $rel_table;
|
||||
$ret_array['name_field'] = $name_field;
|
||||
$ret_array['select'] = ", $name_field {$field_def['name']} ";
|
||||
$ret_array['from'] = " LEFT JOIN $rel_table $joinTableAlias ON $tableName.$relID = $joinTableAlias.id"
|
||||
. " AND $joinTableAlias.deleted=0 ";
|
||||
return $ret_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills in all the custom fields of type relate relationships for an object
|
||||
*
|
||||
*/
|
||||
function fill_relationships(){
|
||||
global $beanList, $beanFiles;
|
||||
if(!empty($this->bean->relDepth)) {
|
||||
if($this->bean->relDepth > 1)return;
|
||||
}else{
|
||||
$this->bean->relDepth = 0;
|
||||
}
|
||||
foreach($this->bean->field_defs as $field){
|
||||
if(empty($field['source']) || $field['source'] != 'custom_fields')continue;
|
||||
if($field['type'] == 'relate'){
|
||||
$related_module =$field['ext2'];
|
||||
$name = $field['name'];
|
||||
if (empty($this->bean->$name)) { //Don't load the relationship twice
|
||||
$id_name = $field['id_name'];
|
||||
if(isset($beanList[ $related_module])){
|
||||
$class = $beanList[$related_module];
|
||||
|
||||
if(file_exists($beanFiles[$class]) && isset($this->bean->$name)){
|
||||
require_once($beanFiles[$class]);
|
||||
$mod = new $class();
|
||||
$mod->relDepth = $this->bean->relDepth + 1;
|
||||
$mod->retrieve($this->bean->$id_name);
|
||||
$this->bean->$name = $mod->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the save action for sugar bean custom fields
|
||||
*
|
||||
* @param boolean $isUpdate
|
||||
*/
|
||||
function save($isUpdate){
|
||||
|
||||
if($this->bean->hasCustomFields() && isset($this->bean->id)){
|
||||
|
||||
if($isUpdate){
|
||||
$query = "UPDATE ". $this->bean->table_name. "_cstm SET ";
|
||||
}
|
||||
$queryInsert = "INSERT INTO ". $this->bean->table_name. "_cstm (id_c";
|
||||
$values = "('".$this->bean->id."'";
|
||||
$first = true;
|
||||
foreach($this->bean->field_defs as $name=>$field){
|
||||
|
||||
if(empty($field['source']) || $field['source'] != 'custom_fields')continue;
|
||||
if($field['type'] == 'html' || $field['type'] == 'parent')continue;
|
||||
if(isset($this->bean->$name)){
|
||||
$quote = "'";
|
||||
|
||||
if(in_array($field['type'], array('int', 'float', 'double', 'uint', 'ulong', 'long', 'short', 'tinyint', 'currency', 'decimal'))) {
|
||||
$quote = '';
|
||||
if(!isset($this->bean->$name) || !is_numeric($this->bean->$name) ){
|
||||
if($field['required']){
|
||||
$this->bean->$name = 0;
|
||||
}else{
|
||||
$this->bean->$name = 'NULL';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( $field['type'] == 'bool' ) {
|
||||
if ( $this->bean->$name === FALSE )
|
||||
$this->bean->$name = '0';
|
||||
elseif ( $this->bean->$name === TRUE )
|
||||
$this->bean->$name = '1';
|
||||
}
|
||||
if(($field['type'] == 'date' || $field['type'] == 'datetimecombo') && (empty($this->bean->$name )|| $this->bean->$name == '1900-01-01')){
|
||||
$quote = '';
|
||||
$this->bean->$name = 'NULL';
|
||||
}
|
||||
if($isUpdate){
|
||||
if($first){
|
||||
$query .= " $name=$quote".$GLOBALS['db']->quote($this->bean->$name)."$quote";
|
||||
|
||||
}else{
|
||||
$query .= " ,$name=$quote".$GLOBALS['db']->quote($this->bean->$name)."$quote";
|
||||
}
|
||||
}
|
||||
$first = false;
|
||||
$queryInsert .= " ,$name";
|
||||
$values .= " ,$quote". $GLOBALS['db']->quote($this->bean->$name). "$quote";
|
||||
}
|
||||
}
|
||||
if($isUpdate){
|
||||
$query.= " WHERE id_c='" . $this->bean->id ."'";
|
||||
|
||||
}
|
||||
|
||||
$queryInsert .= " ) VALUES $values )";
|
||||
if(!$first){
|
||||
if(!$isUpdate){
|
||||
$GLOBALS['db']->query($queryInsert);
|
||||
}else{
|
||||
$checkquery = "SELECT id_c FROM {$this->bean->table_name}_cstm WHERE id_c = '{$this->bean->id}'";
|
||||
if ( $GLOBALS['db']->getOne($checkquery) )
|
||||
$result = $GLOBALS['db']->query($query);
|
||||
else
|
||||
$GLOBALS['db']->query($queryInsert);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Deletes the field from fields_meta_data and drops the database column then it rebuilds the cache
|
||||
* Use the widgets get_db_modify_alter_table() method to get the table sql - some widgets do not need any custom table modifications
|
||||
* @param STRING $name - field name
|
||||
*/
|
||||
function deleteField($widget){
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateField.php');
|
||||
global $beanList;
|
||||
if (!($widget instanceof TemplateField)) {
|
||||
$field_name = $widget;
|
||||
$widget = new TemplateField();
|
||||
$widget->name = $field_name;
|
||||
}
|
||||
$object_name = $beanList[$this->module];
|
||||
|
||||
if ($object_name == 'aCase') {
|
||||
$object_name = 'Case';
|
||||
}
|
||||
|
||||
$GLOBALS['db']->query("DELETE FROM fields_meta_data WHERE id='" . $this->module . $widget->name . "'");
|
||||
$sql = $widget->get_db_delete_alter_table( $this->bean->table_name . "_cstm" ) ;
|
||||
if (! empty( $sql ) )
|
||||
$GLOBALS['db']->query( $sql );
|
||||
VardefManager::clearVardef();
|
||||
VardefManager::refreshVardefs($this->module, $object_name);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Method required by the TemplateRelatedTextField->save() method
|
||||
* Taken from MBModule's implementation
|
||||
*/
|
||||
function fieldExists($name = '', $type = ''){
|
||||
// must get the vardefs from the GLOBAL array as $bean->field_defs does not contain the values from the cache at this point
|
||||
// TODO: fix this - saveToVardefs() updates GLOBAL['dictionary'] correctly, obtaining its information directly from the fields_meta_data table via buildCache()...
|
||||
$vardefs = $GLOBALS['dictionary'][$this->bean->object_name]['fields'];
|
||||
if(!empty($vardefs)){
|
||||
if(empty($type) && empty($name))
|
||||
return false;
|
||||
else if(empty($type))
|
||||
return !empty($vardefs[$name]);
|
||||
else if(empty($name)){
|
||||
foreach($vardefs as $def){
|
||||
if($def['type'] == $type)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}else
|
||||
return (!empty($vardefs[$name]) && ($vardefs[$name]['type'] == $type));
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a custom field using a field object
|
||||
*
|
||||
* @param Field Object $field
|
||||
* @return boolean
|
||||
*/
|
||||
function addFieldObject(&$field){
|
||||
$GLOBALS['log']->debug('adding field');
|
||||
$object_name = $this->module;
|
||||
$db_name = $field->name;
|
||||
|
||||
$fmd = new FieldsMetaData();
|
||||
$id = $fmd->retrieve($object_name.$db_name,true, false);
|
||||
$is_update = false;
|
||||
$label = $field->label;
|
||||
if(!empty($id)){
|
||||
$is_update = true;
|
||||
}else{
|
||||
$db_name = $this->getDBName($field->name);
|
||||
$field->name = $db_name;
|
||||
}
|
||||
$this->createCustomTable();
|
||||
$fmd->id = $object_name.$db_name;
|
||||
$fmd->custom_module= $object_name;
|
||||
$fmd->name = $db_name;
|
||||
$fmd->vname = $label;
|
||||
$fmd->type = $field->type;
|
||||
$fmd->help = $field->help;
|
||||
if (!empty($field->len))
|
||||
$fmd->len = $field->len; // tyoung bug 15407 - was being set to $field->size so changes weren't being saved
|
||||
$fmd->required = ($field->required ? 1 : 0);
|
||||
$fmd->default_value = $field->default;
|
||||
$fmd->ext1 = $field->ext1;
|
||||
$fmd->ext2 = $field->ext2;
|
||||
$fmd->ext3 = $field->ext3;
|
||||
$fmd->ext4 = (isset($field->ext4) ? $field->ext4 : '');
|
||||
$fmd->comments = $field->comment;
|
||||
$fmd->massupdate = $field->massupdate;
|
||||
$fmd->importable = ( isset ( $field->importable ) ) ? $field->importable : null ;
|
||||
$fmd->duplicate_merge = $field->duplicate_merge;
|
||||
$fmd->audited =$field->audited;
|
||||
$fmd->reportable = ($field->reportable ? 1 : 0);
|
||||
if(!$is_update){
|
||||
$fmd->new_with_id=true;
|
||||
}
|
||||
$fmd->save();
|
||||
$this->buildCache($this->module);
|
||||
if($field){
|
||||
if(!$is_update){
|
||||
$query = $field->get_db_add_alter_table($this->bean->table_name . '_cstm');
|
||||
}else{
|
||||
$query = $field->get_db_modify_alter_table($this->bean->table_name . '_cstm');
|
||||
}
|
||||
if(!empty($query)){
|
||||
$GLOBALS['db']->query($query);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* DEPRECIATED: Use addFieldObject instead.
|
||||
* Adds a Custom Field using parameters
|
||||
*
|
||||
* @param unknown_type $name
|
||||
* @param unknown_type $label
|
||||
* @param unknown_type $type
|
||||
* @param unknown_type $max_size
|
||||
* @param unknown_type $required_option
|
||||
* @param unknown_type $default_value
|
||||
* @param unknown_type $ext1
|
||||
* @param unknown_type $ext2
|
||||
* @param unknown_type $ext3
|
||||
* @param unknown_type $audited
|
||||
* @param unknown_type $mass_update
|
||||
* @param unknown_type $ext4
|
||||
* @param unknown_type $help
|
||||
* @param unknown_type $duplicate_merge
|
||||
* @param unknown_type $comment
|
||||
* @return boolean
|
||||
*/
|
||||
function addField($name,$label='', $type='Text',$max_size='255',$required_option='optional', $default_value='', $ext1='', $ext2='', $ext3='',$audited=0, $mass_update = 0 , $ext4='', $help='',$duplicate_merge=0, $comment=''){
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateField.php');
|
||||
$field = new TemplateField();
|
||||
$field->label = $label;
|
||||
if(empty($field->label)){
|
||||
$field->label = $name;
|
||||
}
|
||||
$field->name = $name;
|
||||
$field->type = $type;
|
||||
$field->len = $max_size;
|
||||
$field->required = (!empty($required_option) && $required_option != 'optional');
|
||||
$field->default = $default_value;
|
||||
$field->ext1 = $ext1;
|
||||
$field->ext2 = $ext2;
|
||||
$field->ext3 = $ext3;
|
||||
$field->ext4 = $ext4;
|
||||
$field->help = $help;
|
||||
$field->comments = $comment;
|
||||
$field->massupdate = $mass_update;
|
||||
$field->duplicate_merge = $duplicate_merge;
|
||||
$field->audited = $audited;
|
||||
$field->reportable = 1;
|
||||
return $this->addFieldObject($field);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the custom table with an id of id_c
|
||||
*
|
||||
*/
|
||||
function createCustomTable(){
|
||||
|
||||
if (!$GLOBALS['db']->tableExists($this->bean->table_name."_cstm")) {
|
||||
$GLOBALS['log']->debug('creating custom table for '. $this->bean->table_name);
|
||||
$query = 'CREATE TABLE '.$this->bean->table_name.'_cstm ( ';
|
||||
$query .='id_c ' . $this->bean->dbManager->helper->getColumnType('id') .' NOT NULL';
|
||||
$query .=', PRIMARY KEY ( id_c ) )';
|
||||
if($GLOBALS['db']->dbType == 'mysql'){
|
||||
$query .= ' CHARACTER SET utf8 COLLATE utf8_general_ci';
|
||||
}
|
||||
|
||||
$GLOBALS['db']->query($query);
|
||||
$this->add_existing_custom_fields();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the db schema and adds any custom fields we have used if the custom table was dropped
|
||||
*
|
||||
*/
|
||||
function add_existing_custom_fields(){
|
||||
if($this->bean->hasCustomFields()){
|
||||
foreach($this->bean->field_defs as $name=>$data){
|
||||
if(empty($data['source']) || $data['source'] != 'custom_fields')continue;
|
||||
$field = get_widget ( $data ['type'] );
|
||||
$field->populateFromRow($data);
|
||||
$query = $field->get_db_add_alter_table($this->bean->table_name . '_cstm');
|
||||
$GLOBALS['db']->query($query);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a label to the module's mod_strings for the current language
|
||||
* Note that the system label name
|
||||
*
|
||||
* @param string $displayLabel The label value to be displayed
|
||||
* @return string The core of the system label name - returns currency_id5 for example, when the full label would then be LBL_CURRENCY_ID5
|
||||
* TODO: Only the core is returned for historical reasons - switch to return the real system label
|
||||
*/
|
||||
function addLabel ( $displayLabel )
|
||||
{
|
||||
$mod_strings = return_module_language($GLOBALS[ 'current_language' ], $this->module);
|
||||
$limit = 10;
|
||||
$count = 0;
|
||||
$field_key = $this->getDBName($displayLabel, false);
|
||||
$systemLabel = $field_key;
|
||||
if(!$this->use_existing_labels){ // use_existing_labels defaults to false in this module; as of today, only set to true by ModuleInstaller.php
|
||||
while( isset( $mod_strings [ $systemLabel ] ) && $count <= $limit )
|
||||
{
|
||||
$systemLabel = $field_key. "_$count";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
$selMod = (!empty($_REQUEST['view_module'])) ? $_REQUEST['view_module'] : $this->module;
|
||||
require_once 'modules/ModuleBuilder/parsers/parser.label.php' ;
|
||||
$parser = new ParserLabel ( $selMod , isset ( $_REQUEST [ 'view_package' ] ) ? $_REQUEST [ 'view_package' ] : null ) ;
|
||||
$parser->handleSave ( array('label_'. $systemLabel => $displayLabel ) , $GLOBALS [ 'current_language' ] ) ;
|
||||
|
||||
return $systemLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Database Safe Name
|
||||
*
|
||||
* @param STRING $name
|
||||
* @param BOOLEAN $_C do we append _c to the name
|
||||
* @return STRING
|
||||
*/
|
||||
function getDBName($name, $_C= true){
|
||||
static $cached_results = array();
|
||||
if(!empty($cached_results[$name]))
|
||||
{
|
||||
return $cached_results[$name];
|
||||
}
|
||||
$exclusions = array('parent_type', 'parent_id', 'currency_id', 'parent_name');
|
||||
// Remove any non-db friendly characters
|
||||
$return_value = preg_replace("/[^\w]+/","_",$name);
|
||||
if($_C == true && !in_array($return_value, $exclusions) && substr($return_value, -2) != '_c'){
|
||||
$return_value .= '_c';
|
||||
}
|
||||
$cached_results[$name] = $return_value;
|
||||
return $return_value;
|
||||
}
|
||||
|
||||
function setWhereClauses(&$where_clauses){
|
||||
if (isset($this->avail_fields)) {
|
||||
foreach($this->avail_fields as $name=>$value){
|
||||
if(!empty($_REQUEST[$name])){
|
||||
$where_clauses[] = $this->bean->table_name . "_cstm.$name LIKE '". $GLOBALS['db']->quote($_REQUEST[$name]). "%'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////BACKWARDS COMPATABILITY MODE FOR PRE 5.0 MODULES\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
||||
////////////////////////////END BACKWARDS COMPATABILITY MODE FOR PRE 5.0 MODULES\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
||||
|
||||
/**
|
||||
*
|
||||
* DEPRECATED
|
||||
loads fields into the bean
|
||||
This used to be called during the retrieve process now it is done through a join
|
||||
Restored from pre-r30895 to maintain support for custom code that may have called retrieve() directly
|
||||
*/
|
||||
|
||||
function retrieve()
|
||||
{
|
||||
if(!isset($this->bean)){
|
||||
$GLOBALS['log']->fatal("DynamicField retrieve, bean not instantiated: ".var_export(debug_print_backtrace(), true));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!$this->bean->hasCustomFields()){
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM ".$this->bean->table_name."_cstm WHERE id_c='".$this->bean->id."'";
|
||||
$result = $GLOBALS['db']->query($query);
|
||||
$row = $GLOBALS['db']->fetchByAssoc($result);
|
||||
|
||||
if($row)
|
||||
{
|
||||
foreach($row as $name=>$value)
|
||||
{
|
||||
// originally in pre-r30895 we checked if this field was in avail_fields i.e., in fields_meta_data and not deleted
|
||||
// with the removal of avail_fields post-r30895 we have simplified this - we now retrieve every custom field even if previously deleted
|
||||
// this is considered harmless as the value although set in the bean will not otherwise be used (nothing else works off the list of fields in the bean)
|
||||
$this->bean->$name = $value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function populateXTPL(&$xtpl, $view){
|
||||
if($this->bean->hasCustomFields()){
|
||||
$results = $this->getAllFieldsView($view, 'xtpl');
|
||||
foreach($results as $name=>$value){
|
||||
if(is_array($value['xtpl'])){
|
||||
foreach($value['xtpl'] as $xName=>$xValue){
|
||||
$xtpl->assign(strtoupper($xName), $xValue);
|
||||
|
||||
}
|
||||
}else{
|
||||
$xtpl->assign(strtoupper($name), $value['xtpl']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function populateAllXTPL(&$xtpl, $view){
|
||||
$this->populateXTPL($xtpl, $view);
|
||||
|
||||
}
|
||||
|
||||
function getAllFieldsView($view, $type){
|
||||
$results = array();
|
||||
foreach($this->bean->field_defs as $name=>$data){
|
||||
if(empty($data['source']) || $data['source'] != 'custom_fields')continue;
|
||||
require_once ('modules/DynamicFields/FieldCases.php');
|
||||
$field = get_widget ( $data ['type'] );
|
||||
$field->populateFromRow($data);
|
||||
$field->view = $view;
|
||||
$field->bean =& $this->bean;
|
||||
switch(strtolower($type)){
|
||||
case 'xtpl':
|
||||
$results[$name] = array('xtpl'=>$field->get_xtpl());
|
||||
break;
|
||||
case 'html':
|
||||
$results[$name] = array('html'=> $field->get_html(), 'label'=> $field->get_html_label(), 'fieldType'=>$field->data_type, 'isCustom' =>true);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
////////////////////////////END BACKWARDS COMPATABILITY MODE FOR PRE 5.0 MODULES\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
||||
}
|
||||
|
||||
?>
|
||||
149
modules/DynamicFields/FieldCases.php
Executable file
149
modules/DynamicFields/FieldCases.php
Executable file
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateTextArea.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateFloat.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateInt.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateDate.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateDatetimecombo.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateBoolean.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateEnum.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateMultiEnum.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateRadioEnum.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateEmail.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateRelatedTextField.php');
|
||||
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateURL.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateIFrame.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateHTML.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplatePhone.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateCurrency.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateParent.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateCurrencyId.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateAddress.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateParentType.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateEncrypt.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateId.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateImage.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateDecimal.php');
|
||||
function get_widget($type)
|
||||
{
|
||||
|
||||
$local_temp = null;
|
||||
switch(strtolower($type)){
|
||||
case 'char':
|
||||
case 'varchar':
|
||||
case 'varchar2':
|
||||
$local_temp = new TemplateText(); break;
|
||||
case 'text':
|
||||
case 'textarea':
|
||||
$local_temp = new TemplateTextArea(); break;
|
||||
case 'double':
|
||||
|
||||
case 'float':
|
||||
$local_temp = new TemplateFloat(); break;
|
||||
case 'decimal':
|
||||
$local_temp = new TemplateDecimal(); break;
|
||||
case 'int':
|
||||
$local_temp = new TemplateInt(); break;
|
||||
case 'date':
|
||||
$local_temp = new TemplateDate(); break;
|
||||
case 'bool':
|
||||
$local_temp = new TemplateBoolean(); break;
|
||||
case 'relate':
|
||||
$local_temp = new TemplateRelatedTextField(); break;
|
||||
case 'enum':
|
||||
$local_temp = new TemplateEnum(); break;
|
||||
case 'multienum':
|
||||
$local_temp = new TemplateMultiEnum(); break;
|
||||
case 'radioenum':
|
||||
$local_temp = new TemplateRadioEnum(); break;
|
||||
case 'email':
|
||||
$local_temp = new TemplateEmail(); break;
|
||||
case 'url':
|
||||
$local_temp = new TemplateURL(); break;
|
||||
case 'iframe':
|
||||
$local_temp = new TemplateIFrame(); break;
|
||||
case 'html':
|
||||
$local_temp = new TemplateHTML(); break;
|
||||
case 'phone':
|
||||
$local_temp = new TemplatePhone(); break;
|
||||
case 'currency':
|
||||
$local_temp = new TemplateCurrency(); break;
|
||||
case 'parent':
|
||||
$local_temp = new TemplateParent(); break;
|
||||
case 'parent_type':
|
||||
$local_temp = new TemplateParentType(); break;
|
||||
case 'currency_id':
|
||||
$local_temp = new TemplateCurrencyId(); break;
|
||||
case 'address':
|
||||
$local_temp = new TemplateAddress(); break;
|
||||
case 'encrypt':
|
||||
$local_temp = new TemplateEncrypt(); break;
|
||||
case 'id':
|
||||
$local_temp = new TemplateId(); break;
|
||||
case 'datetimecombo':
|
||||
$local_temp = new TemplateDatetimecombo(); break;
|
||||
case 'image':
|
||||
$local_temp = new TemplateImage(); break;
|
||||
default:
|
||||
$file = false;
|
||||
if(file_exists('custom/modules/DynamicFields/templates/Fields/Template'. $type . '.php')){
|
||||
$file = 'custom/modules/DynamicFields/templates/Fields/Template'. $type . '.php';
|
||||
}else if(file_exists('modules/DynamicFields/templates/Fields/Template'. $type . '.php')){
|
||||
$file = 'modules/DynamicFields/templates/Fields/Template'. $type . '.php';
|
||||
}
|
||||
if(!empty($file)){
|
||||
require_once($file);
|
||||
$class = 'Template' . $type ;
|
||||
$customClass = 'Custom' . $class;
|
||||
if(class_exists($customClass)){
|
||||
$local_temp = new $customClass();
|
||||
}else{
|
||||
$local_temp = new $class();
|
||||
}
|
||||
break;
|
||||
}else{
|
||||
|
||||
$local_temp = new TemplateText(); break;
|
||||
}
|
||||
}
|
||||
|
||||
return $local_temp;
|
||||
}
|
||||
?>
|
||||
112
modules/DynamicFields/FieldViewer.php
Executable file
112
modules/DynamicFields/FieldViewer.php
Executable file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
class FieldViewer{
|
||||
function FieldViewer(){
|
||||
$this->ss = new Sugar_Smarty();
|
||||
}
|
||||
function getLayout($vardef){
|
||||
|
||||
if(empty($vardef['type']))$vardef['type'] = 'varchar';
|
||||
$mod = return_module_language($GLOBALS['current_language'], 'EditCustomFields');
|
||||
$this->ss->assign('vardef', $vardef);
|
||||
$this->ss->assign('MOD', $mod);
|
||||
$this->ss->assign('APP', $GLOBALS['app_strings']);
|
||||
$GLOBALS['log']->debug('FieldViewer.php->getLayout() = '.$vardef['type']);
|
||||
switch($vardef['type']){
|
||||
case 'address':
|
||||
return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/address.tpl');
|
||||
case 'bool':
|
||||
return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/bool.tpl');
|
||||
case 'int':
|
||||
return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/int.tpl');
|
||||
case 'float':
|
||||
return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/float.tpl');
|
||||
case 'decimal':
|
||||
return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/float.tpl');
|
||||
case 'date':
|
||||
require_once('modules/DynamicFields/templates/Fields/Forms/date.php');
|
||||
return get_body($this->ss, $vardef);
|
||||
case 'datetimecombo':
|
||||
require_once('modules/DynamicFields/templates/Fields/Forms/datetimecombo.php');
|
||||
return get_body($this->ss, $vardef);
|
||||
case 'enum':
|
||||
require_once('modules/DynamicFields/templates/Fields/Forms/enum2.php');
|
||||
return get_body($this->ss, $vardef);
|
||||
case 'multienum':
|
||||
require_once('modules/DynamicFields/templates/Fields/Forms/multienum.php');
|
||||
return get_body($this->ss, $vardef);
|
||||
case 'radioenum':
|
||||
require_once('modules/DynamicFields/templates/Fields/Forms/radioenum.php');
|
||||
return get_body($this->ss, $vardef);
|
||||
case 'html':
|
||||
require_once('modules/DynamicFields/templates/Fields/Forms/html.php');
|
||||
return get_body($this->ss, $vardef);
|
||||
case 'currency':
|
||||
return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/currency.tpl');
|
||||
case 'relate':
|
||||
require_once('modules/DynamicFields/templates/Fields/Forms/relate.php');
|
||||
return get_body($this->ss, $vardef);
|
||||
case 'parent':
|
||||
require_once('modules/DynamicFields/templates/Fields/Forms/parent.php');
|
||||
return get_body($this->ss, $vardef);
|
||||
case 'text':
|
||||
return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/text.tpl');
|
||||
case 'encrypt':
|
||||
require_once('modules/DynamicFields/templates/Fields/Forms/encrypt.php');
|
||||
return get_body($this->ss, $vardef);
|
||||
case 'iframe':
|
||||
require_once('modules/DynamicFields/templates/Fields/Forms/iframe.php');
|
||||
return get_body($this->ss, $vardef);
|
||||
case 'url':
|
||||
require_once('modules/DynamicFields/templates/Fields/Forms/url.php');
|
||||
return get_body($this->ss, $vardef);
|
||||
default:
|
||||
$file = false;
|
||||
if(file_exists('custom/modules/DynamicFields/templates/Fields/Forms/' . $vardef['type'] . '.php')){
|
||||
$file = 'custom/modules/DynamicFields/templates/Fields/Forms/' . $vardef['type'] . '.php';
|
||||
} elseif(file_exists('modules/DynamicFields/templates/Fields/Forms/' . $vardef['type'] . '.php')){
|
||||
$file = 'modules/DynamicFields/templates/Fields/Forms/' . $vardef['type'] . '.php';
|
||||
}
|
||||
if(!empty($file)){
|
||||
require_once($file);
|
||||
return get_body($this->ss, $vardef);
|
||||
}else{
|
||||
return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/varchar.tpl');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
72
modules/DynamicFields/Save.php
Executable file
72
modules/DynamicFields/Save.php
Executable file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('modules/DynamicFields/DynamicField.php');
|
||||
|
||||
$module = $_REQUEST['module_name'];
|
||||
$custom_fields = new DynamicField($module);
|
||||
if(!empty($module)){
|
||||
$class_name = $beanList[$module];
|
||||
$class_file = $class_name;
|
||||
if($class_file == 'aCase'){
|
||||
$class_file = 'Case';
|
||||
}
|
||||
require_once("modules/$module/$class_file.php");
|
||||
$mod = new $class_name();
|
||||
$custom_fields->setup($mod);
|
||||
}else{
|
||||
echo "\nNo Module Included Could Not Save";
|
||||
}
|
||||
$name = $_REQUEST['field_label'];
|
||||
$options = '';
|
||||
if($_REQUEST['field_type'] == 'enum'){
|
||||
$options = $_REQUEST['options'];
|
||||
}
|
||||
$default_value = '';
|
||||
|
||||
$custom_fields->addField($name,$name, $_REQUEST['field_type'],'255','optional', $default_value, $options, '', '' );
|
||||
$html = $custom_fields->getFieldHTML($name, $_REQUEST['file_type']);
|
||||
|
||||
set_register_value('dyn_layout', 'field_counter', $_REQUEST['field_count']);
|
||||
$label = $custom_fields->getFieldLabelHTML($name, $_REQUEST['field_type']);
|
||||
require_once('modules/DynamicLayout/AddField.php');
|
||||
$af = new AddField();
|
||||
$af->add_field($name, $html,$label, 'window.opener.');
|
||||
echo $af->get_script('window.opener.');
|
||||
echo "\n<script>window.close();</script>";
|
||||
|
||||
?>
|
||||
133
modules/DynamicFields/UpgradeFields.php
Executable file
133
modules/DynamicFields/UpgradeFields.php
Executable file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/DynamicFields/FieldCases.php');
|
||||
require_once('modules/DynamicFields/DynamicField.php');
|
||||
global $db;
|
||||
if(!isset($db)){
|
||||
$db = DBManagerFactory::getInstance();
|
||||
}
|
||||
$result = $db->query( 'SELECT * FROM fields_meta_data WHERE deleted = 0 ORDER BY custom_module');
|
||||
$modules = array();
|
||||
/*
|
||||
* get the real field_meta_data
|
||||
*/
|
||||
while($row = $db->fetchByAssoc($result)){
|
||||
$the_modules = $row['custom_module'];
|
||||
if(!isset($modules[$the_modules])){
|
||||
$modules[$the_modules] = array();
|
||||
}
|
||||
$modules[$the_modules][$row['name']] = $row['name'];
|
||||
}
|
||||
|
||||
$simulate = false;
|
||||
if(!isset($_REQUEST['run'])){
|
||||
$simulate = true;
|
||||
echo "SIMULATION MODE - NO CHANGES WILL BE MADE EXCEPT CLEARING CACHE";
|
||||
}
|
||||
|
||||
foreach($modules as $the_module=>$fields){
|
||||
$class_name = $beanList[$the_module];
|
||||
echo "<br><br>Scanning $the_module <br>";
|
||||
|
||||
require_once($beanFiles[$class_name]);
|
||||
$mod = new $class_name();
|
||||
if(!$db->tableExists($mod->table_name . "_cstm")){
|
||||
$mod->custom_fields = new DynamicField();
|
||||
$mod->custom_fields->setup($mod);
|
||||
$mod->custom_fields->createCustomTable();
|
||||
}
|
||||
|
||||
$result = $db->query("DESCRIBE $mod->table_name" . "_cstm");
|
||||
|
||||
while($row = $db->fetchByAssoc($result)){
|
||||
|
||||
|
||||
$col = $row['Field'];
|
||||
$type = $row['Type'];
|
||||
$fieldDef = $mod->getFieldDefinition($col);
|
||||
$the_field = get_widget($fieldDef['type']);
|
||||
$the_field->set($fieldDef);
|
||||
|
||||
if(!isset($fields[$col]) && $col != 'id_c'){
|
||||
if(!$simulate)$db->query("ALTER TABLE $mod->table_name" . "_cstm DROP COLUMN $col");
|
||||
unset($fields[$col]);
|
||||
echo "Dropping Column $col from $mod->table_name" . "_cstm for module $the_module<br>";
|
||||
} else{
|
||||
if($col != 'id_c'){
|
||||
if(trim($the_field->get_db_type()) != trim($type)){
|
||||
|
||||
echo "Fixing Column Type for $col changing $type to ". $the_field->get_db_type() . "<br>";
|
||||
if(!$simulate)$db->query($the_field->get_db_modify_alter_table($mod->table_name . '_cstm'));
|
||||
}
|
||||
}
|
||||
|
||||
unset($fields[$col]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo sizeof($fields) . " field(s) missing from $mod->table_name" . "_cstm<br>";
|
||||
foreach($fields as $field){
|
||||
echo "Adding Column $field to $mod->table_name" . "_cstm<br>";
|
||||
if(!$simulate){
|
||||
$the_field = $mod->getFieldDefinition($field);
|
||||
$field = get_widget($the_field['type']);
|
||||
$field->set($the_field);
|
||||
$query = $field->get_db_add_alter_table($mod->table_name . '_cstm');
|
||||
echo $query;
|
||||
if(!empty($query)){
|
||||
$mod->db->query($query);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DynamicField::deleteCache();
|
||||
echo '<br>Done<br>';
|
||||
if($simulate){
|
||||
echo '<a href="index.php?module=Administration&action=UpgradeFields&run=true">Execute non-simulation mode</a>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
61
modules/DynamicFields/language/en_us.lang.php
Executable file
61
modules/DynamicFields/language/en_us.lang.php
Executable file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: Defines the English language pack for the base application.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
$mod_strings = array (
|
||||
'LNK_NEW_CALL' => 'Log Call',
|
||||
'LNK_NEW_MEETING' => 'Schedule Meeting',
|
||||
'LNK_NEW_TASK' => 'Create Task',
|
||||
'LNK_NEW_NOTE' => 'Create Note or Attachment',
|
||||
'LNK_NEW_EMAIL' => 'Archive Email',
|
||||
'LNK_CALL_LIST' => 'Calls',
|
||||
'LNK_MEETING_LIST' => 'Meetings',
|
||||
'LNK_TASK_LIST' => 'Tasks',
|
||||
'LNK_NOTE_LIST' => 'Notes',
|
||||
'LNK_EMAIL_LIST' => 'Emails',
|
||||
|
||||
);
|
||||
|
||||
|
||||
?>
|
||||
48
modules/DynamicFields/language/pl_pl.lang.php
Executable file
48
modules/DynamicFields/language/pl_pl.lang.php
Executable file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* The contents of this file are subject to the SugarCRM Public License Version
|
||||
* 1.1.3 ("License"); You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* The Original Code is: SugarCRM Open Source
|
||||
* The Initial Developer of the Original Code is SugarCRM, Inc.
|
||||
* Portions created by SugarCRM are Copyright (C) 2004-2005 SugarCRM, Inc.;
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
********************************************************************************/
|
||||
|
||||
/*********************************************************************************
|
||||
* pl_pl.lang.ext.php,v for SugarCRM 4.5.1-->>
|
||||
* Translator: Krzysztof Morawski
|
||||
* All Rights Reserved.
|
||||
* Any bugs report welcome: krzysiek<at>kmmgroup<dot>pl
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
$mod_strings = array (
|
||||
'LNK_NEW_CALL' => 'Zapalnuj rozmowę telefoniczną',
|
||||
'LNK_NEW_MEETING' => 'Zaplanuj spotkanie',
|
||||
'LNK_NEW_TASK' => 'Utwórz zadanie',
|
||||
'LNK_NEW_NOTE' => 'Utwórz notatkę lub załącznik',
|
||||
'LNK_NEW_EMAIL' => 'Zarchiwizuj email',
|
||||
'LNK_CALL_LIST' => 'Rozmowy telefoniczne',
|
||||
'LNK_MEETING_LIST' => 'Spotkania',
|
||||
'LNK_TASK_LIST' => 'Zadania',
|
||||
'LNK_NOTE_LIST' => 'Notatki',
|
||||
'LNK_EMAIL_LIST' => 'Poczta email',
|
||||
|
||||
);
|
||||
|
||||
|
||||
?>
|
||||
85
modules/DynamicFields/templates/Fields/Forms/address.tpl
Executable file
85
modules/DynamicFields/templates/Fields/Forms/address.tpl
Executable file
@@ -0,0 +1,85 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreTop.tpl"}
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_DEFAULT_VALUE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' name='default' id='default' value='{$vardef.default}' maxlength='{$vardef.len|default:50}'>
|
||||
{else}
|
||||
<input type='hidden' id='default' name='default' value='{$vardef.default}'>{$vardef.default}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_MAX_SIZE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' name='len' id='field_len' value='{$vardef.len|default:25}' onchange="forceRange(this,1,255);changeMaxLength(document.getElementById('default'),this.value);">
|
||||
<input type='hidden' id="orig_len" name='orig_len' value='{$vardef.len}'>
|
||||
{if $action=="saveSugarField"}
|
||||
<input type='hidden' name='customTypeValidate' id='customTypeValidate' value='{$vardef.len|default:25}'
|
||||
onchange="if (document.getElementById('field_len').value < document.getElementById('orig_len').value) return confirm(SUGAR.language.get('ModuleBuilder', 'LBL_CONFIRM_LOWER_LENGTH')); return true;" >
|
||||
{/if}
|
||||
{literal}
|
||||
<script>
|
||||
function forceRange(field, min, max){
|
||||
field.value = parseInt(field.value);
|
||||
if(field.value == 'NaN')field.value = max;
|
||||
if(field.value > max) field.value = max;
|
||||
if(field.value < min) field.value = min;
|
||||
}
|
||||
function changeMaxLength(field, length){
|
||||
field.maxLength = parseInt(length);
|
||||
field.value = field.value.substr(0, field.maxLength);
|
||||
}
|
||||
{/literal}
|
||||
changeMaxLength(document.getElementById("field_name_id"), {if isset($package->name) && $package->name != "studio"}19{else}17{/if})
|
||||
</script>
|
||||
|
||||
{else}
|
||||
<input type='hidden' name='len' value='{$vardef.len}'>{$vardef.len}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl"}
|
||||
45
modules/DynamicFields/templates/Fields/Forms/bool.tpl
Executable file
45
modules/DynamicFields/templates/Fields/Forms/bool.tpl
Executable file
@@ -0,0 +1,45 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreTop.tpl"}
|
||||
<tr><td class='mbLBL'>{$MOD.COLUMN_TITLE_DEFAULT_VALUE}:</td><td><input type='checkbox' name='default' value=1 {if !empty($vardef.default) }checked{/if} {if $hideLevel > 5}disabled{/if} />{if $hideLevel > 5}<input type='hidden' name='default' value='{$vardef.default}'>{/if}</td></tr>
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl"}
|
||||
67
modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl
Executable file
67
modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl
Executable file
@@ -0,0 +1,67 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
{if $vardef.type != 'bool'}
|
||||
<tr ><td class='mbLBL'>{$MOD.COLUMN_TITLE_REQUIRED_OPTION}:</td><td><input type="checkbox" name="required" value="1" {if !empty($vardef.required)}CHECKED{/if} {if $hideLevel > 5}disabled{/if}/>{if $hideLevel > 5}<input type="hidden" name="required" value="{$vardef.required}">{/if}</td></tr>
|
||||
{/if}
|
||||
<tr><td class='mbLBL'>{$MOD.COLUMN_TITLE_AUDIT}:</td><td><input type="checkbox" name="audited" value="1" {if !empty($vardef.audited) }CHECKED{/if} {if $hideLevel > 5}disabled{/if}/>{if $hideLevel > 5}<input type="hidden" name="audited" value="{$vardef.audited}">{/if}</td></tr>
|
||||
{if !$hideImportable}
|
||||
<tr><td class='mbLBL'>{$MOD.COLUMN_TITLE_IMPORTABLE}:</td><td>
|
||||
{if $hideLevel < 5}
|
||||
{html_options name="importable" id="importable" selected=$vardef.importable options=$importable_options}
|
||||
{sugar_help text=$mod_strings.LBL_POPHELP_IMPORTABLE FIXX=260 FIXY=300}
|
||||
{else}
|
||||
{if isset($vardef.importable)}{$importable_options[$vardef.importable]}
|
||||
{else}{$importable_options.true}{/if}
|
||||
{/if}
|
||||
</td></tr>
|
||||
{/if}
|
||||
{if !$hideDuplicatable}
|
||||
<tr><td class='mbLBL'>{$MOD.COLUMN_TITLE_DUPLICATE_MERGE}:</td><td>
|
||||
{if $hideLevel < 5}
|
||||
{html_options name="duplicate_merge" id="duplicate_merge" selected=$vardef.duplicate_merge_dom_value options=$duplicate_merge_options}
|
||||
{sugar_help text=$mod_strings.LBL_POPHELP_DUPLICATE_MERGE FIXX=260 FIXY=0}
|
||||
{else}
|
||||
{if isset($vardef.duplicate_merge_dom_value)}{$vardef.duplicate_merge_dom_value}
|
||||
{else}{$duplicate_merge_options[0]}{/if}
|
||||
{/if}
|
||||
</td></tr>
|
||||
{/if}
|
||||
</table>
|
||||
90
modules/DynamicFields/templates/Fields/Forms/coreTop.tpl
Executable file
90
modules/DynamicFields/templates/Fields/Forms/coreTop.tpl
Executable file
@@ -0,0 +1,90 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td class='mbLBL' width='30%' >{$MOD.COLUMN_TITLE_NAME}:</td>
|
||||
<td>
|
||||
{if $hideLevel == 0}
|
||||
<input id="field_name_id" maxlength={if isset($package->name) && $package->name != "studio"}30{else}28{/if} type="text" name="name" value="{$vardef.name}"
|
||||
onchange="
|
||||
document.getElementById('label_key_id').value = 'LBL_'+document.getElementById('field_name_id').value.toUpperCase();
|
||||
document.getElementById('label_value_id').value = document.getElementById('field_name_id').value.replace(/_/,' ');
|
||||
document.getElementById('field_name_id').value = document.getElementById('field_name_id').value.toLowerCase();" />
|
||||
{else}
|
||||
<input id= "field_name_id" type="hidden" name="name" value="{$vardef.name}"
|
||||
onchange="
|
||||
document.getElementById('label_key_id').value = 'LBL_'+document.getElementById('field_name_id').value.toUpperCase();
|
||||
document.getElementById('label_value_id').value = document.getElementById('field_name_id').value.replace(/_/,' ');
|
||||
document.getElementById('field_name_id').value = document.getElementById('field_name_id').value.toLowerCase();"/>
|
||||
{$vardef.name}
|
||||
{/if}
|
||||
<script>
|
||||
addToValidate('popup_form', 'name', 'DBName', true,'{$MOD.COLUMN_TITLE_NAME} [a-zA-Z_]' );
|
||||
addToValidateIsInArray('popup_form', 'name', 'in_array', true,'{$MOD.ERR_RESERVED_FIELD_NAME}', '{$field_name_exceptions}', 'u==');
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_DISPLAY_LABEL}:</td>
|
||||
<td>
|
||||
<input id="label_value_id" type="text" name="labelValue" value="{$lbl_value}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_LABEL}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 1}
|
||||
<input id ="label_key_id" type="text" name="label" value="{$vardef.vname}">
|
||||
{else}
|
||||
<input type="text" readonly value="{$vardef.vname}" disabled=1>
|
||||
<input id ="label_key_id" type="hidden" name="label" value="{$vardef.vname}">
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_HELP_TEXT}:</td><td>{if $hideLevel < 5 }<input type="text" name="help" value="{$vardef.help}">{else}<input type="hidden" name="help" value="{$vardef.help}">{$vardef.help}{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_COMMENT_TEXT}:</td><td>{if $hideLevel < 5 }<input type="text" name="comments" value="{$vardef.comments}">{else}<input type="hidden" name="comment" value="{$vardef.comment}">{$vardef.comment}{/if}
|
||||
</td>
|
||||
</tr>
|
||||
52
modules/DynamicFields/templates/Fields/Forms/currency.tpl
Executable file
52
modules/DynamicFields/templates/Fields/Forms/currency.tpl
Executable file
@@ -0,0 +1,52 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreTop.tpl"}
|
||||
<tr><td class='mbLBL'>{$MOD.COLUMN_TITLE_DEFAULT_VALUE}:</td><td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' name='default' value='{sugar_currency_format var=$vardef.default}'>
|
||||
<script>
|
||||
addToValidate('popup_form', 'default', 'float', false,'{$MOD.COLUMN_TITLE_DEFAULT_VALUE}' );
|
||||
</script>
|
||||
{else}
|
||||
<input type='hidden' name='default' value='{sugar_currency_format var=$vardef.default}'>{sugar_currency_format var=$vardef.default}
|
||||
{/if}
|
||||
</td></tr>{include file="modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl"}
|
||||
46
modules/DynamicFields/templates/Fields/Forms/date.php
Executable file
46
modules/DynamicFields/templates/Fields/Forms/date.php
Executable file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateDate.php');
|
||||
|
||||
function get_body(&$ss, $vardef){
|
||||
$td = new TemplateDate();
|
||||
$ss->assign('default_values', array_flip($td->dateStrings));
|
||||
return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/date.tpl');
|
||||
}
|
||||
|
||||
?>
|
||||
62
modules/DynamicFields/templates/Fields/Forms/date.tpl
Executable file
62
modules/DynamicFields/templates/Fields/Forms/date.tpl
Executable file
@@ -0,0 +1,62 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreTop.tpl"}
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_DEFAULT_VALUE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
{html_options name='default' options=$default_values selected=$vardef.display_default}
|
||||
{else}
|
||||
<input type='hidden' name='default' value='$vardef.display_default'>{$vardef.display_default}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_MASS_UPDATE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type="checkbox" name="massupdate" value="1" {if !empty($vardef.massupdate)}checked{/if}/>
|
||||
{else}
|
||||
<input type="checkbox" name="massupdate" value="1" disabled {if !empty($vardef.massupdate)}checked{/if}/>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl"}
|
||||
83
modules/DynamicFields/templates/Fields/Forms/datetimecombo.php
Executable file
83
modules/DynamicFields/templates/Fields/Forms/datetimecombo.php
Executable file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateDatetimecombo.php');
|
||||
|
||||
function get_body(&$ss, $vardef){
|
||||
$defaultTime = '';
|
||||
$hours = "";
|
||||
$minitues = "";
|
||||
$meridiem = "";
|
||||
$td = new TemplateDatetimecombo();
|
||||
$ss->assign('default_values', array_flip($td->dateStrings));
|
||||
|
||||
global $timedate;
|
||||
$user_time_format = $timedate->get_user_time_format();
|
||||
$show_meridiem = preg_match('/pm$/i', $user_time_format) ? true : false;
|
||||
if($show_meridiem) {
|
||||
$ss->assign('default_hours_values', array_flip($td->hoursStrings));
|
||||
} else {
|
||||
$ss->assign('default_hours_values', array_flip($td->hoursStrings24));
|
||||
}
|
||||
|
||||
$ss->assign('show_meridiem', $show_meridiem);
|
||||
$ss->assign('default_minutes_values', array_flip($td->minutesStrings));
|
||||
$ss->assign('default_meridiem_values', array_flip($td->meridiemStrings));
|
||||
if(isset($vardef['display_default']) && strstr($vardef['display_default'] , '&')){
|
||||
$dt = explode("&", $vardef['display_default']); //+1 day&06:00pm
|
||||
$date = $dt[0];
|
||||
$defaultTime = $dt[1];
|
||||
$hours = substr($defaultTime, 0, 2);
|
||||
$minitues = substr($defaultTime, 3, 2);
|
||||
$meridiem = substr($defaultTime, 5, 2);
|
||||
if(!$show_meridiem) {
|
||||
preg_match('/(am|pm)$/i', $meridiem, $matches);
|
||||
if(strtolower($matches[0]) == 'am' && $hours == 12) {
|
||||
$hours = '00';
|
||||
} else if (strtolower($matches[0]) == 'pm' && $hours != 12) {
|
||||
$hours += 12;
|
||||
}
|
||||
}
|
||||
$ss->assign('default_date', $date);
|
||||
}
|
||||
$ss->assign('default_hours', $hours);
|
||||
$ss->assign('default_minutes', $minitues);
|
||||
$ss->assign('default_meridiem', $meridiem);
|
||||
$ss->assign('defaultTime', $defaultTime);
|
||||
return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/datetimecombo.tpl');
|
||||
}
|
||||
|
||||
?>
|
||||
107
modules/DynamicFields/templates/Fields/Forms/datetimecombo.tpl
Executable file
107
modules/DynamicFields/templates/Fields/Forms/datetimecombo.tpl
Executable file
@@ -0,0 +1,107 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
*}
|
||||
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreTop.tpl"}
|
||||
{literal}
|
||||
<script language="Javascript">
|
||||
function timeValueUpdate(){
|
||||
var fieldname = 'defaultTime';
|
||||
var timeseparator = ':';
|
||||
var newtime = '';
|
||||
|
||||
id = fieldname + '_hours';
|
||||
h = window.document.getElementById(id).value;
|
||||
id = fieldname + '_minutes';
|
||||
m = window.document.getElementById(id).value;
|
||||
|
||||
id = fieldname + '_meridiem';
|
||||
ampm = '';
|
||||
if(document.getElementById(id)) {
|
||||
ampm = document.getElementById(id).value;
|
||||
}
|
||||
newtime = h + timeseparator + m + ampm;
|
||||
document.getElementById(fieldname).value = newtime;
|
||||
|
||||
}
|
||||
</script>
|
||||
{/literal}
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_DEFAULT_VALUE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
{html_options name='defaultDate' id='defaultDate_date' options=$default_values selected=$default_date}
|
||||
{else}
|
||||
<input type='hidden' name='defaultDate' value='{$default_date}'>{$default_date}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'></td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<div>
|
||||
{html_options name='defaultHours' size='1' id='defaultTime_hours' options=$default_hours_values onchange="timeValueUpdate();" selected=$default_hours}
|
||||
:
|
||||
{html_options name='defaultMinutes' size='1' id='defaultTime_minutes' options=$default_minutes_values onchange="timeValueUpdate();" selected=$default_minutes}
|
||||
{if $show_meridiem === true}
|
||||
{html_options name='defaultMeridiem' size='1' id='defaultTime_meridiem' options=$default_meridiem_values onchange="timeValueUpdate();" selected=$default_meridiem}
|
||||
{/if}
|
||||
</div>
|
||||
<input type='hidden' name='defaultTime' id='defaultTime' value="{$defaultTime}">
|
||||
{else}
|
||||
<input type='hidden' name='defaultTime' value='{$defaultTime}'>{$defaultTime}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_MASS_UPDATE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type="checkbox" name="massupdate" value="1" {if !empty($vardef.massupdate)}checked{/if}/>
|
||||
{else}
|
||||
<input type="checkbox" name="massupdate" value="1" disabled {if !empty($vardef.massupdate)}checked{/if}/>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<script>
|
||||
addToValidateBinaryDependency('popup_form',"defaultDate_date", 'alpha', false, "{$APP.ERR_MISSING_REQUIRED_FIELDS} {$APP.LBL_DATE} {$APP.LBL_OR} {$APP.LBL_HOURS}" ,"defaultTime_hours");
|
||||
addToValidateBinaryDependency('popup_form',"defaultTime_hours", 'alpha', false, "{$APP.ERR_MISSING_REQUIRED_FIELDS} {$APP.LBL_HOURS} {$APP.LBL_OR} {$APP.LBL_MINUTES}" ,"defaultTime_minutes");
|
||||
addToValidateBinaryDependency('popup_form', "defaultTime_minutes", 'alpha', false, "{$APP.ERR_MISSING_REQUIRED_FIELDS} {$APP.LBL_MINUTES} {$APP.LBL_OR} {$APP.LBL_MERIDIEM}","defaultTime_meridiem");
|
||||
</script>
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl"}
|
||||
47
modules/DynamicFields/templates/Fields/Forms/encrypt.php
Executable file
47
modules/DynamicFields/templates/Fields/Forms/encrypt.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
function get_body(&$ss, $vardef){
|
||||
return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/encrypt.tpl');
|
||||
}
|
||||
?>
|
||||
50
modules/DynamicFields/templates/Fields/Forms/encrypt.tpl
Executable file
50
modules/DynamicFields/templates/Fields/Forms/encrypt.tpl
Executable file
@@ -0,0 +1,50 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
*}
|
||||
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreTop.tpl"}
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_DEFAULT_VALUE}:</td><td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' name='default' value='{$vardef.default}'>
|
||||
{else}
|
||||
<input type='hidden' name='default' value='{$vardef.default}'>{$vardef.default}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl"}
|
||||
77
modules/DynamicFields/templates/Fields/Forms/enum.tpl
Executable file
77
modules/DynamicFields/templates/Fields/Forms/enum.tpl
Executable file
@@ -0,0 +1,77 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreTop.tpl"}
|
||||
<script language="Javascript">
|
||||
app_list_strings = {$app_list_strings};
|
||||
</script>
|
||||
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.LBL_DROP_DOWN_LIST}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
{html_options name="options" id="options" selected=$selected_dropdown values=$dropdowns output=$dropdowns onChange="ModuleBuilder.dropdownChanged(this.value);"}<br><input type='button' value='{$MOD.LBL_BTN_EDIT}' class='button' onclick="ModuleBuilder.moduleDropDown(this.form.options.value, this.form.options.value);"> <input type='button' value='{$MOD.LBL_BTN_ADD}' class='button' onclick="ModuleBuilder.moduleDropDown('', this.form.name.value);">
|
||||
{else}
|
||||
<input type='hidden' name='options' value='{$selected_dropdown}'>{$selected_dropdown}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_DEFAULT_VALUE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
{html_options name="default[]" id="default[]" selected=$selected_options options=$default_dropdowns multiple=$multi}
|
||||
{else}
|
||||
<input type='hidden' name='default[]' value='$vardef.default'>{$vardef.default}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_MASS_UPDATE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type="checkbox" name="massupdate" value="1" {if !empty($vardef.massupdate)}checked{/if}/>
|
||||
{else}
|
||||
<input type="checkbox" name="massupdate" value="1" disabled {if !empty($vardef.massupdate)}checked{/if}/>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl"}
|
||||
116
modules/DynamicFields/templates/Fields/Forms/enum2.php
Executable file
116
modules/DynamicFields/templates/Fields/Forms/enum2.php
Executable file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*
|
||||
* Created on Jul 18, 2007
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
||||
*/
|
||||
function get_body(&$ss, $vardef){
|
||||
$multi = false;
|
||||
if (isset ($vardef['type']) && $vardef['type'] == 'multienum')
|
||||
$multi = true;
|
||||
|
||||
$selected_options = "";
|
||||
if ($multi && !empty($vardef['default'])) {
|
||||
$selected_options = unencodeMultienum( $vardef['default']);
|
||||
} else if (isset($vardef['default'])){
|
||||
$selected_options = $vardef['default'];
|
||||
}
|
||||
|
||||
if(!isset($edit_mod_strings)){
|
||||
$edit_mod_strings = return_module_language($GLOBALS['current_language'], 'EditCustomFields');
|
||||
}
|
||||
|
||||
if(!empty($_REQUEST['type']) && $_REQUEST['type'] == 'radioenum'){
|
||||
$edit_mod_strings['LBL_DROP_DOWN_LIST'] = $edit_mod_strings['LBL_RADIO_FIELDS'];
|
||||
}
|
||||
$package_strings = array();
|
||||
if(!empty($_REQUEST['view_package'])){
|
||||
$view_package = $_REQUEST['view_package'];
|
||||
if($view_package != 'studio') {
|
||||
require_once('modules/ModuleBuilder/MB/ModuleBuilder.php');
|
||||
$mb = new ModuleBuilder();
|
||||
$module =& $mb->getPackageModule($view_package, $_REQUEST['view_module']);
|
||||
$lang = $GLOBALS['current_language'];
|
||||
//require_once($package->getPackageDir()."/include/language/$lang.lang.php");
|
||||
$module->mblanguage->generateAppStrings(false);
|
||||
$package_strings = $module->mblanguage->appListStrings[$lang.'.lang.php'];
|
||||
}
|
||||
}
|
||||
|
||||
global $app_list_strings;
|
||||
$my_list_strings = $app_list_strings;
|
||||
$my_list_strings = array_merge($my_list_strings, $package_strings);
|
||||
foreach($my_list_strings as $key=>$value){
|
||||
if(!is_array($value)){
|
||||
unset($my_list_strings[$key]);
|
||||
}
|
||||
}
|
||||
$dropdowns = array_keys($my_list_strings);
|
||||
sort($dropdowns);
|
||||
$default_dropdowns = array();
|
||||
if(!empty($vardef['options']) && !empty($my_list_strings[$vardef['options']])){
|
||||
$default_dropdowns = $my_list_strings[$vardef['options']];
|
||||
}else{
|
||||
//since we do not have a default value then we should assign the first one.
|
||||
$key = $dropdowns[0];
|
||||
$default_dropdowns = $my_list_strings[$key];
|
||||
}
|
||||
|
||||
$selected_dropdown = '';
|
||||
if(!empty($vardef['options'])){
|
||||
$selected_dropdown = $vardef['options'];
|
||||
|
||||
}
|
||||
$show = true;
|
||||
if(!empty($_REQUEST['refresh_dropdown']))
|
||||
$show = false;
|
||||
|
||||
$ss->assign('dropdowns', $dropdowns);
|
||||
$ss->assign('default_dropdowns', $default_dropdowns);
|
||||
$ss->assign('selected_dropdown', $selected_dropdown);
|
||||
$ss->assign('show', $show);
|
||||
$ss->assign('selected_options', $selected_options);
|
||||
$ss->assign('multi', isset($multi) ? $multi: false);
|
||||
$ss->assign('dropdown_name',(!empty($vardef['options']) ? $vardef['options'] : ''));
|
||||
|
||||
require_once('include/JSON.php');
|
||||
$json = new JSON(JSON_LOOSE_TYPE);
|
||||
$ss->assign('app_list_strings', "''");
|
||||
return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/enum.tpl');
|
||||
}
|
||||
?>
|
||||
81
modules/DynamicFields/templates/Fields/Forms/float.tpl
Executable file
81
modules/DynamicFields/templates/Fields/Forms/float.tpl
Executable file
@@ -0,0 +1,81 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreTop.tpl"}
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_DEFAULT_VALUE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' id='default' name='default' value='{$vardef.default}'>
|
||||
<script>
|
||||
addToValidate('popup_form', 'default', 'float', false,'{$MOD.COLUMN_TITLE_DEFAULT_VALUE}' );
|
||||
formWithPrecision = new addToValidatePrecision('popup_form_id', 'default', 'precision');
|
||||
</script>
|
||||
{else}
|
||||
<input type='hidden' name='default' value='{$vardef.default}'>{$vardef.default}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_MAX_SIZE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' name='len' value='{$vardef.len|default:18}'></td>
|
||||
<script>addToValidate('popup_form', 'len', 'int', false,'{$MOD.COLUMN_TITLE_MAX_SIZE}' );</script>
|
||||
{else}
|
||||
<input type='hidden' name='len' value='{$vardef.len}'>{$vardef.len}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_PRECISION}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' id='precision' name='precision' value='{$vardef.precision|default:0}'>
|
||||
<script>addToValidate('popup_form', 'ext1', 'int', false,'{$MOD.COLUMN_TITLE_PRECISION}' );</script>
|
||||
{else}
|
||||
<input type='hidden' name='precision' value='{$vardef.precision}'>{$vardef.precision}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl"}
|
||||
54
modules/DynamicFields/templates/Fields/Forms/html.php
Executable file
54
modules/DynamicFields/templates/Fields/Forms/html.php
Executable file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
function get_body(&$ss, $vardef){
|
||||
$edit_mod_strings = return_module_language($GLOBALS['current_language'], 'EditCustomFields');
|
||||
$ss->assign('MOD', $edit_mod_strings);
|
||||
if(!empty($cf))$ss->assign('cf', $cf);
|
||||
|
||||
$edValue = '';
|
||||
if(!empty($vardef['default_value'])) {
|
||||
$edValue = $vardef['default_value'];
|
||||
$edValue = str_replace(array("\r\n", "\n"), " ",$edValue);
|
||||
}
|
||||
$ss->assign('HTML_EDITOR', $edValue);
|
||||
$ss->assign('preSave', 'document.popup_form.presave();');
|
||||
///////////////////////////////////
|
||||
return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/html.tpl');
|
||||
}
|
||||
?>
|
||||
74
modules/DynamicFields/templates/Fields/Forms/html.tpl
Executable file
74
modules/DynamicFields/templates/Fields/Forms/html.tpl
Executable file
@@ -0,0 +1,74 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreTop.tpl"}
|
||||
|
||||
<tr>
|
||||
<td class="mbLBL">{$MOD.COLUMN_TITLE_HTML_CONTENT}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<textarea name='htmlarea' id='htmlarea' cols=50 rows=10>{$HTML_EDITOR}</textarea>
|
||||
<input type='hidden' name='ext4' id='ext4' value='{$cf.ext4}'/>
|
||||
{else}
|
||||
<textarea name='htmlarea' id='htmlarea' cols=50 rows=10 disabled>{$HTML_EDITOR}</textarea>
|
||||
<input type='hidden' name='htmlarea' value='{$HTML_EDITOR}'/>
|
||||
{/if}
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl"}
|
||||
|
||||
<script type="text/javascript" language="Javascript">
|
||||
SUGAR.ajaxLoad = true;
|
||||
{if $hideLevel < 5}
|
||||
setTimeout("tinyMCE.execCommand('mceAddControl', false, 'htmlarea');", 500);
|
||||
ModuleBuilder.tabPanel.get("activeTab").closeEvent.subscribe(function(){ldelim}tinyMCE.execCommand('mceRemoveControl', false, 'htmlarea');{rdelim});
|
||||
setTimeout("document.forms.popup_form.required.value = false;YAHOO.util.Dom.getAncestorByTagName(document.forms.popup_form.required, 'tr').style.display='none';", 500);
|
||||
{/if}
|
||||
{literal}
|
||||
document.popup_form.presave = function(){
|
||||
var inst = tinyMCE.get("htmlarea").getContent();
|
||||
document.getElementById('ext4').value =inst;
|
||||
document.getElementById('ext4').style.display = '';
|
||||
};
|
||||
</script>
|
||||
{/literal}
|
||||
47
modules/DynamicFields/templates/Fields/Forms/iframe.php
Executable file
47
modules/DynamicFields/templates/Fields/Forms/iframe.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
function get_body(&$ss, $vardef){
|
||||
$vars = $ss->get_template_vars();
|
||||
$fields = $vars['module']->mbvardefs->vardefs['fields'];
|
||||
$fieldOptions = array();
|
||||
foreach($fields as $id=>$def) {
|
||||
$fieldOptions[$id] = $def['name'];
|
||||
}
|
||||
$ss->assign('fieldOpts', $fieldOptions);
|
||||
return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/iframe.tpl');
|
||||
}
|
||||
115
modules/DynamicFields/templates/Fields/Forms/iframe.tpl
Executable file
115
modules/DynamicFields/templates/Fields/Forms/iframe.tpl
Executable file
@@ -0,0 +1,115 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreTop.tpl"}
|
||||
<input type=hidden id='ext3' name='ext3' value='{$vardef.gen}'>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.LBL_GENERATE_URL}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='checkbox' id='gencheck' {if $vardef.gen}checked=true{/if} name='genCheck' value="0" onclick="
|
||||
if(this.checked) {ldelim}
|
||||
YAHOO.util.Dom.setStyle('fieldListHelper', 'display', '');
|
||||
YAHOO.util.Dom.get('ext3').value = 1;
|
||||
addToValidate('popup_form', 'default', 'alphanumeric', true,'{$MOD.COLUMN_TITLE_DEFAULT_VALUE}' );
|
||||
{rdelim} else {ldelim}
|
||||
YAHOO.util.Dom.setStyle('fieldListHelper', 'display', 'none');
|
||||
YAHOO.util.Dom.get('ext3').value = 0;
|
||||
removeFromValidate('popup_form', 'default');
|
||||
{rdelim}">
|
||||
{else}
|
||||
<input type='checkbox' name='ext3' {if $vardef.gen}checked=true{/if} disabled>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr id='fieldListHelper' {if !$vardef.gen}style="display:none"{/if}>
|
||||
<td></td>
|
||||
<td>{html_options name="flo" id="fieldListOptions" options=$fieldOpts}
|
||||
<input type='button' class='button' value="Insert Field" onclick="
|
||||
YAHOO.util.Dom.get('default').value += '{ldelim}' + YAHOO.util.Dom.get('fieldListOptions').value + '{rdelim}'
|
||||
"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_DEFAULT_VALUE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' name='default' id='default' value='{$vardef.default}' maxlength='{$vardef.len|default:50}'>
|
||||
{else}
|
||||
<input type='hidden' id='default' name='default' value='{$vardef.default}'>{$vardef.default}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_MAX_SIZE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' name='len' value='{$vardef.len|default:25}' onchange="forceRange(this,1,255);changeMaxLength(document.getElementById('default'),this.value);">
|
||||
{literal}
|
||||
<script>
|
||||
function forceRange(field, min, max){
|
||||
field.value = parseInt(field.value);
|
||||
if(field.value == 'NaN')field.value = max;
|
||||
if(field.value > max) field.value = max;
|
||||
if(field.value < min) field.value = min;
|
||||
}
|
||||
function changeMaxLength(field, length){
|
||||
field.maxLength = parseInt(length);
|
||||
field.value = field.value.substr(0, field.maxLength);
|
||||
}
|
||||
</script>
|
||||
{/literal}
|
||||
{else}
|
||||
<input type='hidden' name='len' value='{$vardef.len}'>{$vardef.len}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_FRAME_HEIGHT}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' name='ext4' value='{$vardef.height|default:200}' onchange="forceRange(this,100,1024);">
|
||||
{else}
|
||||
<input type='hidden' name='ext4' value='{$vardef.height}'>{$vardef.height}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl"}
|
||||
62
modules/DynamicFields/templates/Fields/Forms/image.php
Executable file
62
modules/DynamicFields/templates/Fields/Forms/image.php
Executable file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
function get_body(&$ss, $vardef){
|
||||
global $app_list_strings;
|
||||
//$edit_mod_strings = return_module_language($current_language, 'EditCustomFields');
|
||||
//$edit_mod_strings['COLUMN_TITLE_DEFAULT_VALUE'] = $edit_mod_strings['COLUMN_TITLE_URL'];
|
||||
$vars = $ss->get_template_vars();
|
||||
$fields = $vars['module']->mbvardefs->vardefs['fields'];
|
||||
$fieldOptions = array();
|
||||
foreach($fields as $id=>$def) {
|
||||
$fieldOptions[$id] = $def['name'];
|
||||
}
|
||||
$ss->assign('fieldOpts', $fieldOptions);
|
||||
$link_target = !empty($vardef['link_target']) ? $vardef['link_target'] : '_blank';
|
||||
$ss->assign('TARGET_OPTIONS', get_select_options_with_id($app_list_strings['link_target_dom'], $link_target));
|
||||
$ss->assign('LINK_TARGET', $link_target);
|
||||
$ss->assign('LINK_TARGET_LABEL', $app_list_strings['link_target_dom'][$link_target]);
|
||||
|
||||
$ss->assign('hideImportable', 'false');
|
||||
$ss->assign('hideDuplicatable', 'false');
|
||||
return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/image.tpl');
|
||||
}
|
||||
|
||||
?>
|
||||
77
modules/DynamicFields/templates/Fields/Forms/image.tpl
Executable file
77
modules/DynamicFields/templates/Fields/Forms/image.tpl
Executable file
@@ -0,0 +1,77 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreTop.tpl"}
|
||||
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.LBL_IMAGE_WIDTH}:</td>
|
||||
<td>
|
||||
<input id ="width" type="text" name="width"
|
||||
{if !$vardef.width && !$vardef.height}
|
||||
value="120"
|
||||
{else}
|
||||
value="{$vardef.width}"
|
||||
{/if}
|
||||
>
|
||||
{sugar_help text=$mod_strings.LBL_POPHELP_IMAGE_WIDTH FIXX=300 FIXY=200}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.LBL_IMAGE_HEIGHT}:</td>
|
||||
<td>
|
||||
<input id ="height" type="text" name="height"
|
||||
{if !$vardef.width && !$vardef.height}
|
||||
value=""
|
||||
{else}
|
||||
value="{$vardef.height}"
|
||||
{/if}
|
||||
>
|
||||
{sugar_help text=$mod_strings.LBL_POPHELP_IMAGE_HEIGHT FIXX=300 FIXY=220}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.LBL_IMAGE_BORDER}:</td>
|
||||
<td>
|
||||
<input type="checkbox" id ="border" name="border" value="1" {if !empty($vardef.border)}checked{/if}/>
|
||||
</td>
|
||||
</tr>
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl"}
|
||||
123
modules/DynamicFields/templates/Fields/Forms/int.tpl
Executable file
123
modules/DynamicFields/templates/Fields/Forms/int.tpl
Executable file
@@ -0,0 +1,123 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
<script>
|
||||
formsWithFieldLogic=null;
|
||||
</script>
|
||||
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreTop.tpl"}
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_DEFAULT_VALUE}:</td><td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' name='default' id='int_default' value='{$vardef.default}'>
|
||||
<script>addToValidate('popup_form', 'default', 'int', false,'{$MOD.COLUMN_TITLE_DEFAULT_VALUE}' );</script>
|
||||
{else}
|
||||
<input type='hidden' name='default' id='int_default' value='{$vardef.default}'>{$vardef.default}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_MIN_VALUE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' name='min' id='int_min' value='{$vardef.validation.min}'>
|
||||
<script>addToValidate('popup_form', 'min', 'int', false,'{$MOD.COLUMN_TITLE_MIN_VALUE}' );</script>
|
||||
{else}
|
||||
<input type='hidden' name='min' id='int_min' value='{$vardef.validation.min}'>{$vardef.range.min}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_MAX_VALUE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' name='max' id='int_max' value='{$vardef.validation.max}'>
|
||||
<script>addToValidate('popup_form', 'max', 'int', false,'{$MOD.COLUMN_TITLE_MAX_VALUE}' );</script>
|
||||
{else}
|
||||
<input type='hidden' name='max' id='int_max' value='{$vardef.validation.max}'>{$vardef.range.max}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_MAX_SIZE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' name='len' id='int_len' value='{$vardef.len|default:11}'></td>
|
||||
<script>addToValidate('popup_form', 'len', 'int', false,'{$MOD.COLUMN_TITLE_MAX_SIZE}' );</script>
|
||||
{else}
|
||||
<input type='hidden' name='len' id='int_len' value='{$vardef.len}'>{$vardef.len}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{*
|
||||
<!-- REMOVING THIS FOR 6.0, but need to allow for people create auto_increment fields and have to add appropriate indexes if in strict mode.
|
||||
<tr>
|
||||
<td class='mbLBL'>Auto Increment:</td>
|
||||
<td>
|
||||
<input type='checkbox' name='autoinc' id='autoinc' value=1 {if !empty($vardef.auto_increment) }checked{/if}
|
||||
{if $hideLevel > 2 || !$allowAutoInc} disabled{/if}
|
||||
onclick="document.getElementById('auto_increment').value = this.checked;document.getElementById('autoinc_start_wrap').style.display = this.checked ? '' : 'none';">
|
||||
<input type='hidden' name='auto_increment' id='auto_increment' value='{if !empty($vardef.auto_increment) }true{else}false{/if}'>
|
||||
</td>
|
||||
</tr>
|
||||
-->
|
||||
*}
|
||||
{if !empty($vardef.auto_increment) }
|
||||
<tr id="autoinc_start_wrap" {if empty($vardef.auto_increment) }style="display:none" {/if}>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_AUTOINC_NEXT}:</td>
|
||||
<td>
|
||||
<input type='hidden' name='auto_increment' id='auto_increment' value='true'>
|
||||
<input type='text' name='autoinc_next' id='autoinc_next' value='{$vardef.autoinc_next|default:1}' {if $MB}disabled=1{/if}>
|
||||
<script>addToValidateMoreThan('popup_form', 'autoinc_next', 'int', false,'{$MOD.COLUMN_TITLE_AUTOINC_NEXT}', {$vardef.autoinc_next|default:1});</script>
|
||||
<input type='hidden' name='autoinc_val_changed' id='autoinc_val_changed' value='false'>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_DISABLE_NUMBER_FORMAT}:</td>
|
||||
<td>
|
||||
<input type='checkbox' name='ext3' value=1 {if !empty($vardef.disable_num_format) }checked{/if} {if $hideLevel > 5}disabled{/if} />
|
||||
{if $hideLevel > 5}<input type='hidden' name='ext3' value='{$vardef.disable_num_format}'>{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<script>
|
||||
formsWithFieldLogic=new addToValidateFieldLogic('popup_form_id', 'int_min', 'int_max', 'int_default', 'int_len', 'int', 'Invalid Logic.');
|
||||
</script>
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl"}
|
||||
45
modules/DynamicFields/templates/Fields/Forms/multienum.php
Executable file
45
modules/DynamicFields/templates/Fields/Forms/multienum.php
Executable file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
$edit_mod_strings = return_module_language($GLOBALS['current_language'], 'EditCustomFields');
|
||||
$edit_mod_strings['LBL_DROP_DOWN_LIST'] = $edit_mod_strings['LBL_MULTI_SELECT_LIST'];
|
||||
$multi = 'true';
|
||||
require_once('modules/DynamicFields/templates/Fields/Forms/enum2.php');
|
||||
?>
|
||||
88
modules/DynamicFields/templates/Fields/Forms/multienum.tpl
Executable file
88
modules/DynamicFields/templates/Fields/Forms/multienum.tpl
Executable file
@@ -0,0 +1,88 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreTop.tpl"}
|
||||
<tr>
|
||||
<td nowrap="nowrap">{$MOD.LBL_DROP_DOWN_LIST}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
{html_options name="ext1" id="ext1" selected=$cf.ext1 values=$dropdowns output=$dropdowns onChange="dropdownChanged(this.value);"}
|
||||
{else}
|
||||
<input type='hidden' name='ext1' value='$cf.ext1'>{$cf.ext1}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap">{$MOD.COLUMN_TITLE_DEFAULT_VALUE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
{html_options name="default_value" id="default_value" selected=$cf.default_value options=$selected_dropdown }
|
||||
{else}
|
||||
<input type='hidden' name='default_value' value='$cf.default_value'>{$cf.default_value}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap">{$MOD.COLUMN_TITLE_DISPLAYED_ITEM_COUNT}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' name='ext2' id='ext2' value='{$cf.ext2|default:5}'>
|
||||
<script>addToValidate('popup_form', 'ext2', 'int', false,'{$MOD.COLUMN_TITLE_DISPLAYED_ITEM_COUNT}' );</script>
|
||||
{else}
|
||||
<input type='hidden' name='ext2' value='{$cf.ext2}'>{$cf.ext2}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap">{$MOD.COLUMN_TITLE_MASS_UPDATE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type="checkbox" name="mass_update" value="1" {if !empty($cf.mass_update)}checked{/if}/>
|
||||
{else}
|
||||
<input type="checkbox" name="mass_update" value="1" disabled {if !empty($cf.mass_update)}checked{/if}/>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl"}
|
||||
<script>dropdownChanged(document.getElementById('ext1').options[document.getElementById('ext1').options.selectedIndex]);</script>
|
||||
|
||||
47
modules/DynamicFields/templates/Fields/Forms/parent.php
Executable file
47
modules/DynamicFields/templates/Fields/Forms/parent.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
function get_body(&$ss, $vardef){
|
||||
return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/parent.tpl');
|
||||
}
|
||||
?>
|
||||
87
modules/DynamicFields/templates/Fields/Forms/parent.tpl
Executable file
87
modules/DynamicFields/templates/Fields/Forms/parent.tpl
Executable file
@@ -0,0 +1,87 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<table width="100%"><tr><td class='mbLBL' width='30%' >{$MOD.COLUMN_TITLE_NAME}:</td><td >
|
||||
{if $hideLevel == 0}
|
||||
<input id="field_name_id" type="hidden" name="name" value="parent_name"/>parent_name
|
||||
{else}
|
||||
<input id= "field_name_id" type="hidden" name="name" value="{$vardef.name}"/>{$vardef.name}{/if}
|
||||
<script>
|
||||
|
||||
addToValidate('popup_form', 'name', 'DBName', true,'{$MOD.COLUMN_TITLE_NAME} [a-zA-Z_]' );
|
||||
addToValidateIsInArray('popup_form', 'name', 'in_array', true,'{$MOD.ERR_RESERVED_FIELD_NAME}', '{$field_name_exceptions}', '==');
|
||||
|
||||
</script>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td class='mbLBL' >{$MOD.COLUMN_TITLE_LABEL}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input id ="label_key_id" type="text" name="label" value="{$vardef.vname}">
|
||||
{else}
|
||||
<input id ="label_key_id" type="hidden" name="label" value="{$vardef.vname}">{$vardef.vname}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL' >{$MOD.COLUMN_TITLE_LABEL_VALUE}:</td>
|
||||
<td>
|
||||
<input id="label_value_id" type="text" name="labelValue" value="{$lbl_value}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL' >{$MOD.COLUMN_TITLE_HELP_TEXT}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5 }
|
||||
<input type="text" name="help" value="{$vardef.help}">
|
||||
{else}
|
||||
<input type="hidden" name="help" value="{$vardef.help}">{$vardef.help}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<script>
|
||||
if(document.getElementById('label_key_id').value == '')
|
||||
document.getElementById('label_key_id').value = 'LBL_FLEX_RELATE';
|
||||
if(document.getElementById('label_value_id').value == '')
|
||||
document.getElementById('label_value_id').value = 'Flex Relate';
|
||||
</script>
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl"}
|
||||
44
modules/DynamicFields/templates/Fields/Forms/radioenum.php
Executable file
44
modules/DynamicFields/templates/Fields/Forms/radioenum.php
Executable file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
$edit_mod_strings = return_module_language($GLOBALS['current_language'], 'EditCustomFields');
|
||||
$edit_mod_strings['LBL_DROP_DOWN_LIST'] = $edit_mod_strings['LBL_RADIO_FIELDS'];
|
||||
require_once('modules/DynamicFields/templates/Fields/Forms/enum2.php');
|
||||
?>
|
||||
68
modules/DynamicFields/templates/Fields/Forms/relate.php
Executable file
68
modules/DynamicFields/templates/Fields/Forms/relate.php
Executable file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
die ( 'Not A Valid Entry Point' ) ;
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
function get_body (&$ss , $vardef)
|
||||
{
|
||||
|
||||
$modules = array ( ) ;
|
||||
|
||||
require_once 'modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php' ;
|
||||
$relatableModules = array_keys ( DeployedRelationships::findRelatableModules () ) ;
|
||||
|
||||
foreach ( $relatableModules as $module )
|
||||
{
|
||||
$modules [ $module ] = translate ( 'LBL_MODULE_NAME', $module ) ;
|
||||
}
|
||||
|
||||
foreach ( ACLController::disabledModuleList ( $modules, false, 'list' ) as $disabled_parent_type )
|
||||
{
|
||||
unset ( $modules [ $disabled_parent_type ] ) ;
|
||||
}
|
||||
unset ( $modules [ "" ] ) ;
|
||||
unset ( $modules [ 'Activities' ] ) ; // cannot relate to Activities as only Activities' submodules have records; use a Flex Relate instead!
|
||||
|
||||
// tyoung bug 18631 - reduce potential confusion when creating a relate custom field for Products - actually points to the Product Catalog, so label it that way in the drop down list
|
||||
if (isset ( $modules [ 'ProductTemplates' ] ) && $modules [ 'ProductTemplates' ] == 'Product')
|
||||
$modules [ 'ProductTemplates' ] = translate ( 'LBL_MODULE_NAME', 'ProductTemplates' ) ;
|
||||
|
||||
$ss->assign ( 'modules', $modules ) ;
|
||||
|
||||
return $ss->fetch ( 'modules/DynamicFields/templates/Fields/Forms/relate.tpl' ) ;
|
||||
}
|
||||
?>
|
||||
53
modules/DynamicFields/templates/Fields/Forms/relate.tpl
Executable file
53
modules/DynamicFields/templates/Fields/Forms/relate.tpl
Executable file
@@ -0,0 +1,53 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreTop.tpl"}
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.LBL_MODULE}:</td>
|
||||
<td>
|
||||
{if $hideLevel == 0}
|
||||
{html_options name="ext2" id="ext2" selected=$vardef.module options=$modules}
|
||||
{else}
|
||||
<input type='hidden' name='ext2' value='{$vardef.module}'>{$vardef.module}
|
||||
{/if}
|
||||
<input type='hidden' name='ext3' value='{$vardef.id_name}'>
|
||||
</td>
|
||||
</tr>
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl"}
|
||||
75
modules/DynamicFields/templates/Fields/Forms/text.tpl
Executable file
75
modules/DynamicFields/templates/Fields/Forms/text.tpl
Executable file
@@ -0,0 +1,75 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreTop.tpl"}
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_LABEL_ROWS}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 4}
|
||||
<input id ="rows" type="text" name="rows" value="{$vardef.rows|default:4}">
|
||||
{else}
|
||||
<input id ="rows" type="hidden" name="rows" value="{$vardef.rows}">{$vardef.rows}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_LABEL_COLS}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 4}
|
||||
<input id ="cols" type="text" name="cols" value="{$vardef.cols|default:20}">
|
||||
{else}
|
||||
<input id ="cols" type="hidden" name="cols" value="{$vardef.displayParams.cols}">{$vardef.cols}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_DEFAULT_VALUE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<textarea name='default' id='default' >{$vardef.default}</textarea>
|
||||
{else}
|
||||
<textarea name='default' id='default' disabled >{$vardef.default}</textarea>
|
||||
<input type='hidden' name='default' value='{$vardef.default}'/>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl"}
|
||||
60
modules/DynamicFields/templates/Fields/Forms/url.php
Executable file
60
modules/DynamicFields/templates/Fields/Forms/url.php
Executable file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
function get_body(&$ss, $vardef){
|
||||
global $app_list_strings;
|
||||
//$edit_mod_strings = return_module_language($current_language, 'EditCustomFields');
|
||||
//$edit_mod_strings['COLUMN_TITLE_DEFAULT_VALUE'] = $edit_mod_strings['COLUMN_TITLE_URL'];
|
||||
$vars = $ss->get_template_vars();
|
||||
$fields = $vars['module']->mbvardefs->vardefs['fields'];
|
||||
$fieldOptions = array();
|
||||
foreach($fields as $id=>$def) {
|
||||
$fieldOptions[$id] = $def['name'];
|
||||
}
|
||||
$ss->assign('fieldOpts', $fieldOptions);
|
||||
$link_target = !empty($vardef['link_target']) ? $vardef['link_target'] : '_blank';
|
||||
$ss->assign('TARGET_OPTIONS', get_select_options_with_id($app_list_strings['link_target_dom'], $link_target));
|
||||
$ss->assign('LINK_TARGET', $link_target);
|
||||
$ss->assign('LINK_TARGET_LABEL', $app_list_strings['link_target_dom'][$link_target]);
|
||||
//_ppd($ss->fetch('modules/DynamicFields/templates/Fields/Forms/url.tpl'));
|
||||
return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/url.tpl');
|
||||
}
|
||||
|
||||
?>
|
||||
117
modules/DynamicFields/templates/Fields/Forms/url.tpl
Executable file
117
modules/DynamicFields/templates/Fields/Forms/url.tpl
Executable file
@@ -0,0 +1,117 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreTop.tpl"}
|
||||
<input type=hidden id='ext3' name='ext3' value='{$vardef.gen}'>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.LBL_GENERATE_URL}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='checkbox' id='gencheck' {if $vardef.gen}checked=true{/if} name='genCheck' value="0" onclick="
|
||||
if(this.checked) {ldelim}
|
||||
YAHOO.util.Dom.setStyle('fieldListHelper', 'display', '');
|
||||
YAHOO.util.Dom.get('ext3').value = 1;
|
||||
{rdelim} else {ldelim}
|
||||
YAHOO.util.Dom.setStyle('fieldListHelper', 'display', 'none');
|
||||
YAHOO.util.Dom.get('ext3').value = 0;
|
||||
{rdelim}">
|
||||
{else}
|
||||
<input type='checkbox' name='ext3' {if $vardef.gen}checked=true{/if} disabled>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr id='fieldListHelper' {if !$vardef.gen}style="display:none"{/if}>
|
||||
<td></td>
|
||||
<td>{html_options name="flo" id="fieldListOptions" options=$fieldOpts}
|
||||
<input type='button' class='button' value="Insert Field" onclick="
|
||||
YAHOO.util.Dom.get('default').value += '{ldelim}' + YAHOO.util.Dom.get('fieldListOptions').value + '{rdelim}'
|
||||
"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_DEFAULT_VALUE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' name='default' id='default' value='{$vardef.default}' maxlength='{$vardef.len|default:50}'>
|
||||
{else}
|
||||
<input type='hidden' id='default' name='default' value='{$vardef.default}'>{$vardef.default}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_MAX_SIZE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' name='len' value='{$vardef.len|default:255}' onchange="forceRange(this,1,255);changeMaxLength(document.getElementById('default'),this.value);">
|
||||
{literal}
|
||||
<script>
|
||||
function forceRange(field, min, max){
|
||||
field.value = parseInt(field.value);
|
||||
if(field.value == 'NaN')field.value = max;
|
||||
if(field.value > max) field.value = max;
|
||||
if(field.value < min) field.value = min;
|
||||
}
|
||||
function changeMaxLength(field, length){
|
||||
field.maxLength = parseInt(length);
|
||||
field.value = field.value.substr(0, field.maxLength);
|
||||
}
|
||||
</script>
|
||||
{/literal}
|
||||
{else}
|
||||
<input type='hidden' name='len' value='{$vardef.len}'>{$vardef.len}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.LBL_LINK_TARGET}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<select name='ext4' id='ext4'>
|
||||
{$TARGET_OPTIONS}
|
||||
</select>
|
||||
{else}
|
||||
<select name='extdis' id='extdis' disabled>
|
||||
<option value='{$LINK_TARGET}'>{$LINK_TARGET_LABEL}</option>
|
||||
</select>
|
||||
<input type='hidden' name='ext4' value='{$LINK_TARGET}'>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl"}
|
||||
83
modules/DynamicFields/templates/Fields/Forms/varchar.tpl
Executable file
83
modules/DynamicFields/templates/Fields/Forms/varchar.tpl
Executable file
@@ -0,0 +1,83 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreTop.tpl"}
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_DEFAULT_VALUE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' name='default' id='default' value='{$vardef.default}' maxlength='{$vardef.len|default:50}'>
|
||||
{else}
|
||||
<input type='hidden' id='default' name='default' value='{$vardef.default}'>{$vardef.default}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='mbLBL'>{$MOD.COLUMN_TITLE_MAX_SIZE}:</td>
|
||||
<td>
|
||||
{if $hideLevel < 5}
|
||||
<input type='text' name='len' id='field_len' value='{$vardef.len|default:25}' onchange="forceRange(this,1,255);changeMaxLength(document.getElementById('default'),this.value);">
|
||||
<input type='hidden' id="orig_len" name='orig_len' value='{$vardef.len}'>
|
||||
{if $action=="saveSugarField"}
|
||||
<input type='hidden' name='customTypeValidate' id='customTypeValidate' value='{$vardef.len|default:25}'
|
||||
onchange="if (parseInt(document.getElementById('field_len').value) < parseInt(document.getElementById('orig_len').value)) return confirm(SUGAR.language.get('ModuleBuilder', 'LBL_CONFIRM_LOWER_LENGTH')); return true;" >
|
||||
{/if}
|
||||
{literal}
|
||||
<script>
|
||||
function forceRange(field, min, max){
|
||||
field.value = parseInt(field.value);
|
||||
if(field.value == 'NaN')field.value = max;
|
||||
if(field.value > max) field.value = max;
|
||||
if(field.value < min) field.value = min;
|
||||
}
|
||||
function changeMaxLength(field, length){
|
||||
field.maxLength = parseInt(length);
|
||||
field.value = field.value.substr(0, field.maxLength);
|
||||
}
|
||||
</script>
|
||||
{/literal}
|
||||
{else}
|
||||
<input type='hidden' name='len' value='{$vardef.len}'>{$vardef.len}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{include file="modules/DynamicFields/templates/Fields/Forms/coreBottom.tpl"}
|
||||
66
modules/DynamicFields/templates/Fields/TemplateAddress.php
Executable file
66
modules/DynamicFields/templates/Fields/TemplateAddress.php
Executable file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry) die ( 'Not A Valid Entry Point' ) ;
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once ('modules/DynamicFields/templates/Fields/TemplateField.php') ;
|
||||
require_once ('modules/DynamicFields/templates/Fields/TemplateAddressCountry.php') ;
|
||||
|
||||
class TemplateAddress extends TemplateField
|
||||
{
|
||||
var $type = 'varchar' ;
|
||||
|
||||
function save ($df)
|
||||
{
|
||||
$this->type = 'varchar' ;
|
||||
|
||||
require_once 'modules/ModuleBuilder/parsers/parser.label.php' ;
|
||||
$parser = new ParserLabel ( $df->getModuleName() , $df->getPackageName() ) ;
|
||||
foreach ( array ( 'City' , 'State' , 'PostalCode' , 'Country' ) as $addressFieldName )
|
||||
{
|
||||
$systemLabel = strtoupper( "LBL_" . $this->name . '_' . $addressFieldName );
|
||||
$parser->handleSave ( array( "label_" . $systemLabel => $this->label_value . ' ' . $addressFieldName ) , $GLOBALS [ 'current_language' ] ) ;
|
||||
$addressField = new TemplateField ( ) ;
|
||||
$addressField->len = ($addressFieldName == 'PostalCode') ? 20 : 100 ;
|
||||
$addressField->name = $this->name . '_' . strtolower ( $addressFieldName ) ;
|
||||
$addressField->label = $addressField->vname = $systemLabel ;
|
||||
$addressField->save ( $df ) ;
|
||||
}
|
||||
// finally save the base street address field
|
||||
parent::save($df);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
52
modules/DynamicFields/templates/Fields/TemplateAddressCountry.php
Executable file
52
modules/DynamicFields/templates/Fields/TemplateAddressCountry.php
Executable file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateEnum.php');
|
||||
require_once('include/utils/array_utils.php');
|
||||
class TemplateAddressCountry extends TemplateEnum {
|
||||
|
||||
var $group = '';
|
||||
|
||||
function get_field_def(){
|
||||
$def = parent::get_field_def();
|
||||
$def['group'] = $this->group;
|
||||
$def['options'] = 'countries_dom';
|
||||
return $def;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
134
modules/DynamicFields/templates/Fields/TemplateBoolean.php
Executable file
134
modules/DynamicFields/templates/Fields/TemplateBoolean.php
Executable file
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateField.php');
|
||||
class TemplateBoolean extends TemplateField{
|
||||
var $default_value = '0';
|
||||
var $default = '0';
|
||||
var $type = 'bool';
|
||||
function get_db_type(){
|
||||
if ($GLOBALS['db']->dbType=='oci8') {
|
||||
return " NUMBER(1) ";
|
||||
}elseif($GLOBALS['db']->dbType=='mssql'){
|
||||
return " bit ";
|
||||
}else{
|
||||
return " BOOL ";
|
||||
}
|
||||
}
|
||||
//BEGIN BACKWARDS COMPATABILITY
|
||||
function get_xtpl_edit(){
|
||||
$name = $this->name;
|
||||
$returnXTPL = array();
|
||||
if(!empty($this->help)){
|
||||
$returnXTPL[$this->name . '_help'] = translate($this->help, $this->bean->module_dir);
|
||||
}
|
||||
if(isset($this->bean->$name)){
|
||||
|
||||
|
||||
if(strcmp($this->bean->$name ,'1') ==0 || strcmp($this->bean->$name,'on')==0 || strcmp($this->bean->$name,'yes')==0 || strcmp($this->bean->$name, 'true')==0){
|
||||
$returnXTPL[$this->name . '_checked'] = 'checked';
|
||||
$returnXTPL[$this->name] = 'checked';
|
||||
}
|
||||
}else{
|
||||
|
||||
if(empty($this->bean->id)){
|
||||
|
||||
if(!empty($this->default_value)){
|
||||
|
||||
if(!(strcmp($this->default_value,'false')==0 || strcmp($this->default_value,'no')==0 || strcmp($this->default_value,'off')==0 )){
|
||||
$returnXTPL[$this->name . '_checked'] = 'checked';
|
||||
$returnXTPL[$this->name] = 'checked';
|
||||
}
|
||||
|
||||
}
|
||||
$returnXTPL[strtoupper($this->name)] = $this->default_value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $returnXTPL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function get_xtpl_search(){
|
||||
|
||||
if(!empty($_REQUEST[$this->name])){
|
||||
$returnXTPL = array();
|
||||
|
||||
if($_REQUEST[$this->name] == '1' || $_REQUEST[$this->name] == 'on' || $_REQUEST[$this->name] == 'yes'){
|
||||
$returnXTPL[$this->name . '_checked'] = 'checked';
|
||||
$returnXTPL[$this->name] = 'checked';
|
||||
}
|
||||
return $returnXTPL;
|
||||
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function get_xtpl_detail(){
|
||||
$name = $this->name;
|
||||
$returnXTPL = array();
|
||||
if(!empty($this->help)){
|
||||
$returnXTPL[$this->name . '_help'] = translate($this->help, $this->bean->module_dir);
|
||||
}
|
||||
$returnXTPL[$this->name . '_checked'] = '';
|
||||
$returnXTPL[$this->name] = '';
|
||||
|
||||
if(isset($this->bean->$name)){
|
||||
if(strcmp($this->bean->$name ,'1') ==0 || strcmp($this->bean->$name,'on')==0 || strcmp($this->bean->$name,'yes')==0 || strcmp($this->bean->$name, 'true')==0){
|
||||
$returnXTPL[$this->name . '_checked'] = 'checked';
|
||||
$returnXTPL[$this->name] = 'checked';
|
||||
}
|
||||
}
|
||||
return $returnXTPL;
|
||||
}
|
||||
function get_xtpl_list(){
|
||||
return $this->get_xtpl_edit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
96
modules/DynamicFields/templates/Fields/TemplateCurrency.php
Executable file
96
modules/DynamicFields/templates/Fields/TemplateCurrency.php
Executable file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateCurrencyId.php');
|
||||
class TemplateCurrency extends TemplateText{
|
||||
var $max_size = 25;
|
||||
var $len = 26 ;
|
||||
var $type='currency';
|
||||
|
||||
function delete($df){
|
||||
parent::delete($df);
|
||||
//currency id
|
||||
$currency_id = new TemplateCurrencyId();
|
||||
$currency_id->name = 'currency_id';
|
||||
$currency_id->delete($df);
|
||||
}
|
||||
|
||||
function save($df){
|
||||
//the currency field
|
||||
$this->default = unformat_number($this->default);
|
||||
$this->default_value = $this->default;
|
||||
parent::save($df);
|
||||
|
||||
//currency id
|
||||
$currency_id = new TemplateCurrencyId();
|
||||
$currency_id->name = 'currency_id';
|
||||
$currency_id->vname = 'LBL_CURRENCY';
|
||||
$currency_id->label = $currency_id->vname;
|
||||
$currency_id->save($df);
|
||||
//$df->addLabel($currency_id->vname);
|
||||
}
|
||||
|
||||
function get_db_type(){
|
||||
$precision = (!empty($this->precision)) ? $this->precision : 6;
|
||||
switch($GLOBALS['db']->dbType){
|
||||
case 'oci8':
|
||||
if(!empty($this->len))
|
||||
{
|
||||
return " number( {$this->len} , $precision )";
|
||||
}else{
|
||||
return " number(26,$precision)";
|
||||
}
|
||||
case 'mssql':
|
||||
if(!empty($this->len))
|
||||
{
|
||||
return " decimal( {$this->len} , $precision )";
|
||||
}else{
|
||||
return " decimal(26,$precision)";
|
||||
}
|
||||
default:
|
||||
if(!empty($this->len))
|
||||
{
|
||||
return " decimal( {$this->len} , $precision )";
|
||||
}else{
|
||||
return " decimal(26,$precision)";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
62
modules/DynamicFields/templates/Fields/TemplateCurrencyId.php
Executable file
62
modules/DynamicFields/templates/Fields/TemplateCurrencyId.php
Executable file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateId.php');
|
||||
class TemplateCurrencyId extends TemplateId{
|
||||
var $max_size = 25;
|
||||
var $type='currency_id';
|
||||
|
||||
function get_field_def(){
|
||||
$def = parent::get_field_def();
|
||||
$def['type'] = 'id';
|
||||
$def['studio'] = 'visible';
|
||||
$def['function'] = array('name'=>'getCurrencyDropDown', 'returns'=>'html');
|
||||
return $def;
|
||||
}
|
||||
|
||||
function save($df){
|
||||
if(!$df->fieldExists($this->name))
|
||||
parent::save($df);
|
||||
}
|
||||
|
||||
function delete($df){
|
||||
if(!$df->fieldExists($this->name))
|
||||
parent::delete($df);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
104
modules/DynamicFields/templates/Fields/TemplateDate.php
Executable file
104
modules/DynamicFields/templates/Fields/TemplateDate.php
Executable file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
class TemplateDate extends TemplateText{
|
||||
var $type = 'date';
|
||||
var $len = '';
|
||||
var $dateStrings;
|
||||
|
||||
function __construct() {
|
||||
global $app_strings;
|
||||
$this->dateStrings = array(
|
||||
$app_strings['LBL_NONE']=>'',
|
||||
$app_strings['LBL_YESTERDAY']=> '-1 day',
|
||||
$app_strings['LBL_TODAY']=>'now',
|
||||
$app_strings['LBL_TOMORROW']=>'+1 day',
|
||||
$app_strings['LBL_NEXT_WEEK']=> '+1 week',
|
||||
$app_strings['LBL_NEXT_MONDAY']=>'next monday + 1 day',
|
||||
$app_strings['LBL_NEXT_FRIDAY']=>'next friday + 1 day',
|
||||
$app_strings['LBL_TWO_WEEKS']=> '+2 weeks',
|
||||
$app_strings['LBL_NEXT_MONTH']=> '+1 month',
|
||||
$app_strings['LBL_FIRST_DAY_OF_NEXT_MONTH']=> 'first of next month', // must handle this non-GNU date string in SugarBean->populateDefaultValues; if we don't this will evaluate to 1969...
|
||||
$app_strings['LBL_THREE_MONTHS']=> '+3 months', //kbrill Bug #17023
|
||||
$app_strings['LBL_SIXMONTHS']=> '+6 months',
|
||||
$app_strings['LBL_NEXT_YEAR']=> '+1 year',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function get_db_type(){
|
||||
|
||||
if($GLOBALS['db']->dbType == 'mssql'){
|
||||
return " DATETIME ";
|
||||
} else {
|
||||
return " DATE ";
|
||||
}
|
||||
}
|
||||
function get_db_default($modify=false){
|
||||
return '';
|
||||
}
|
||||
|
||||
//BEGIN BACKWARDS COMPATABILITY
|
||||
function get_xtpl_edit(){
|
||||
global $timedate;
|
||||
$name = $this->name;
|
||||
$returnXTPL = array();
|
||||
if(!empty($this->help)){
|
||||
$returnXTPL[strtoupper($this->name . '_help')] = translate($this->help, $this->bean->module_dir);
|
||||
}
|
||||
$returnXTPL['USER_DATEFORMAT'] = $timedate->get_user_date_format();
|
||||
$returnXTPL['CALENDAR_DATEFORMAT'] = $timedate->get_cal_date_format();
|
||||
if(isset($this->bean->$name)){
|
||||
$returnXTPL[strtoupper($this->name)] = $this->bean->$name;
|
||||
}else{
|
||||
if(empty($this->bean->id) && !empty($this->default_value) && !empty($this->dateStrings[$this->default_value])){
|
||||
$returnXTPL[strtoupper($this->name)] = $GLOBALS['timedate']->to_display_date(date($GLOBALS['timedate']->dbDayFormat,strtotime($this->dateStrings[$this->default_value])), false);
|
||||
}
|
||||
}
|
||||
return $returnXTPL;
|
||||
}
|
||||
|
||||
function get_field_def(){
|
||||
$def = parent::get_field_def();
|
||||
if(!empty($def['default'])){
|
||||
$def['display_default'] = $def['default'];
|
||||
$def['default'] = '';
|
||||
}
|
||||
return $def;
|
||||
}
|
||||
}
|
||||
?>
|
||||
182
modules/DynamicFields/templates/Fields/TemplateDatetimecombo.php
Executable file
182
modules/DynamicFields/templates/Fields/TemplateDatetimecombo.php
Executable file
@@ -0,0 +1,182 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
class TemplateDatetimecombo extends TemplateText{
|
||||
var $type = 'datetimecombo';
|
||||
var $len = '';
|
||||
var $dateStrings = array(
|
||||
'-none-' => '',
|
||||
'today'=>'now',
|
||||
'yesterday'=> '-1 day',
|
||||
'tomorrow'=>'+1 day',
|
||||
'next week'=> '+1 week',
|
||||
'next monday'=>'next monday + 1 day',
|
||||
'next friday'=>'next friday + 1 day',
|
||||
'two weeks'=> '+2 weeks',
|
||||
'next month'=> '+1 month',
|
||||
'first day of next month'=> 'first of next month', // must handle this non-GNU date string in SugarBean->populateDefaultValues; if we don't this will evaluate to 1969...
|
||||
'three months'=> '+3 months', //kbrill Bug #17023
|
||||
'six months'=> '+6 months',
|
||||
'next year'=> '+1 year',
|
||||
);
|
||||
|
||||
var $hoursStrings = array(
|
||||
'' => '',
|
||||
'01' => '01',
|
||||
'02' => '02',
|
||||
'03' => '03',
|
||||
'04' => '04',
|
||||
'05' => '05',
|
||||
'06' => '06',
|
||||
'07' => '07',
|
||||
'08' => '08',
|
||||
'09' => '09',
|
||||
'10' => '10',
|
||||
'11' => '11',
|
||||
'12' => '12',
|
||||
);
|
||||
|
||||
var $hoursStrings24 = array(
|
||||
'' => '',
|
||||
'00' => '00',
|
||||
'01' => '01',
|
||||
'02' => '02',
|
||||
'03' => '03',
|
||||
'04' => '04',
|
||||
'05' => '05',
|
||||
'06' => '06',
|
||||
'07' => '07',
|
||||
'08' => '08',
|
||||
'09' => '09',
|
||||
'10' => '10',
|
||||
'11' => '11',
|
||||
'12' => '12',
|
||||
'13' => '13',
|
||||
'14' => '14',
|
||||
'15' => '15',
|
||||
'16' => '16',
|
||||
'17' => '17',
|
||||
'18' => '18',
|
||||
'19' => '19',
|
||||
'20' => '20',
|
||||
'21' => '21',
|
||||
'22' => '22',
|
||||
'23' => '23',
|
||||
);
|
||||
|
||||
var $minutesStrings = array(
|
||||
'' => '',
|
||||
'00' => '00',
|
||||
'15' => '15',
|
||||
'30' => '30',
|
||||
'45' => '45',
|
||||
);
|
||||
|
||||
var $meridiemStrings = array(
|
||||
'' => '',
|
||||
'am' => 'am',
|
||||
'pm' => 'pm',
|
||||
);
|
||||
|
||||
function get_db_type(){
|
||||
if($GLOBALS['db']->dbType == 'oracle'){
|
||||
return " DATE ";
|
||||
} else {
|
||||
return " DATETIME ";
|
||||
}
|
||||
}
|
||||
|
||||
function get_db_default($modify=false){
|
||||
return '';
|
||||
}
|
||||
|
||||
function get_field_def(){
|
||||
$def = parent::get_field_def();
|
||||
if($GLOBALS['db']->dbType == 'oracle'){
|
||||
$def['dbType'] = 'date';
|
||||
} else {
|
||||
$def['dbType'] = 'datetime';
|
||||
}
|
||||
if(!empty($def['default'])){
|
||||
$def['display_default'] = $def['default'];
|
||||
$def['default'] = '';
|
||||
}
|
||||
return $def;
|
||||
}
|
||||
|
||||
function save($df){
|
||||
parent::save($df);
|
||||
}
|
||||
|
||||
function populateFromPost(){
|
||||
if(!empty($_REQUEST['defaultDate']) && !empty($_REQUEST['defaultTime'])){
|
||||
$_REQUEST['default'] = $_REQUEST['defaultDate'].'&'.$_REQUEST['defaultTime'];
|
||||
|
||||
$defaultTime = $_REQUEST['defaultTime'];
|
||||
$hours = substr($defaultTime, 0, 2);
|
||||
$minutes = substr($defaultTime, 3, 2);
|
||||
$meridiem = substr($defaultTime, 5, 2);
|
||||
if(empty($meridiem)) {
|
||||
if($hours == '00') {
|
||||
$hours = 12;
|
||||
$meridiem = 'am';
|
||||
} else if($hours > 12) {
|
||||
$hours -= 12;
|
||||
$meridiem = 'pm';
|
||||
} else {
|
||||
$meridiem = 'am';
|
||||
}
|
||||
$_REQUEST['default'] = $_REQUEST['defaultDate'].'&'.$hours.':'.$minutes.''.$meridiem;
|
||||
}
|
||||
}else{
|
||||
$_REQUEST['default'] = '';
|
||||
}
|
||||
unset($_REQUEST['defaultDate']);
|
||||
unset($_REQUEST['defaultTime']);
|
||||
foreach($this->vardef_map as $vardef=>$field){
|
||||
if(isset($_REQUEST[$vardef])){
|
||||
$this->$vardef = $_REQUEST[$vardef];
|
||||
if($vardef != $field){
|
||||
$this->$field = $this->$vardef;
|
||||
}
|
||||
}
|
||||
}
|
||||
$GLOBALS['log']->debug('populate: '.print_r($this,true));
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
90
modules/DynamicFields/templates/Fields/TemplateDecimal.php
Executable file
90
modules/DynamicFields/templates/Fields/TemplateDecimal.php
Executable file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
class TemplateDecimal extends TemplateFloat{
|
||||
var $type = 'decimal';
|
||||
var $default = null;
|
||||
var $default_value = null;
|
||||
function TemplateDecimal(){
|
||||
$this->vardef_map['precision']='ext1';
|
||||
}
|
||||
|
||||
function get_field_def(){
|
||||
$def = parent::get_field_def();
|
||||
return $def;
|
||||
}
|
||||
|
||||
function get_db_type(){
|
||||
// $GLOBALS['log']->debug('TemplateFloat:get_db_type()'.print_r($this,true));
|
||||
|
||||
if ($GLOBALS['db']->dbType=='mysql')
|
||||
{
|
||||
$type = " DECIMAL";
|
||||
if(!empty($this->len))
|
||||
{
|
||||
$precision = (!empty($this->precision)) ? $this->precision : 4; // bug 17041 tyoung - mysql requires a precision value if length is specified
|
||||
$type .= "({$this->len},$precision)";
|
||||
}
|
||||
}
|
||||
elseif ($GLOBALS['db']->dbType=='mssql')
|
||||
{
|
||||
$type = " decimal";
|
||||
if(!empty($this->len))
|
||||
{
|
||||
$precision = (!empty($this->precision)) ? $this->precision : 4;
|
||||
$type .= "({$this->len},$precision)";
|
||||
}
|
||||
else
|
||||
{
|
||||
$type .= "(11,4)";
|
||||
}
|
||||
}
|
||||
elseif ($GLOBALS['db']->dbType=='oci8')
|
||||
{
|
||||
$precision = (!empty($this->precision))? $this->precision: 6;
|
||||
$type= " NUMBER(30,$precision) ";
|
||||
}
|
||||
|
||||
/**
|
||||
* FOR ORACLE
|
||||
* return " NUMBER($this->max_size, $this->precision)";
|
||||
*/
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
47
modules/DynamicFields/templates/Fields/TemplateEmail.php
Executable file
47
modules/DynamicFields/templates/Fields/TemplateEmail.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
class TemplateEmail extends TemplateText{
|
||||
|
||||
function get_html_detail(){
|
||||
return '<a href="mailto:{'. strtoupper($this->name).'}">{'. strtoupper($this->name).'}</a>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
60
modules/DynamicFields/templates/Fields/TemplateEncrypt.php
Executable file
60
modules/DynamicFields/templates/Fields/TemplateEncrypt.php
Executable file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateField.php');
|
||||
class TemplateEncrypt extends TemplateField{
|
||||
|
||||
var $type='encrypt';
|
||||
function save($df){
|
||||
$this->type = 'encrypt';
|
||||
$this->ext3 = 'varchar';
|
||||
parent::save($df);
|
||||
|
||||
}
|
||||
function get_field_def(){
|
||||
$vardef = parent::get_field_def();
|
||||
$vardef['dbType'] = $this->ext3;
|
||||
return $vardef;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
202
modules/DynamicFields/templates/Fields/TemplateEnum.php
Executable file
202
modules/DynamicFields/templates/Fields/TemplateEnum.php
Executable file
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/utils/array_utils.php');
|
||||
class TemplateEnum extends TemplateText{
|
||||
var $max_size = 100;
|
||||
var $type='enum';
|
||||
var $ext1 = '';
|
||||
var $default_value = '';
|
||||
var $dependency ; // any dependency information
|
||||
|
||||
function __construct ()
|
||||
{
|
||||
// ensure that the field dependency information is read in from any _REQUEST
|
||||
$this->localVardefMap = array (
|
||||
'trigger' => 'trigger',
|
||||
'action' => 'action' , ) ;
|
||||
$this->vardef_map = array_merge ( $this->vardef_map , $this->localVardefMap ) ;
|
||||
}
|
||||
|
||||
function populateFromPost ()
|
||||
{
|
||||
parent::populateFromPost();
|
||||
// now convert trigger,action pairs into a dependency array representation
|
||||
// we expect the dependencies in the following format:
|
||||
// trigger = [ trigger for action 1 , trigger for action 2 , ... , trigger for action n ]
|
||||
// action = [ action 1 , action 2 , ... , action n ]
|
||||
|
||||
// check first if we have the component parts of a dependency
|
||||
$dependencyPresent = true ;
|
||||
foreach ( $this->localVardefMap as $def )
|
||||
{
|
||||
$dependencyPresent &= isset ( $this->$def ) ;
|
||||
}
|
||||
|
||||
if ( $dependencyPresent )
|
||||
{
|
||||
$dependencies = array () ;
|
||||
|
||||
if ( is_array ( $this->trigger ) && is_array ( $this->action ) )
|
||||
{
|
||||
for ( $i = 0 ; $i < count ( $this->action ) ; $i++ )
|
||||
{
|
||||
$dependencies [ $this->trigger [ $i ] ] = $this->action [ $i ] ;
|
||||
}
|
||||
$this->dependency = $dependencies ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! is_array ( $this->trigger ) && ! is_array ( $this->action ) )
|
||||
$this->dependency = array ( $this->trigger => $this->action ) ;
|
||||
}
|
||||
// tidy up
|
||||
unset ( $this->trigger ) ;
|
||||
unset ( $this->action ) ;
|
||||
}
|
||||
}
|
||||
function get_xtpl_edit(){
|
||||
$name = $this->name;
|
||||
$value = '';
|
||||
if(isset($this->bean->$name)){
|
||||
$value = $this->bean->$name;
|
||||
}else{
|
||||
if(empty($this->bean->id)){
|
||||
$value= $this->default_value;
|
||||
}
|
||||
}
|
||||
if(!empty($this->help)){
|
||||
$returnXTPL[strtoupper($this->name . '_help')] = translate($this->help, $this->bean->module_dir);
|
||||
}
|
||||
|
||||
global $app_list_strings;
|
||||
$returnXTPL = array();
|
||||
$returnXTPL[strtoupper($this->name)] = $value;
|
||||
if(empty($this->ext1)){
|
||||
$this->ext1 = $this->options;
|
||||
}
|
||||
$returnXTPL[strtoupper('options_'.$this->name)] = get_select_options_with_id($app_list_strings[$this->ext1], $value);
|
||||
|
||||
return $returnXTPL;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function get_xtpl_search(){
|
||||
$searchFor = '';
|
||||
if(!empty($_REQUEST[$this->name])){
|
||||
$searchFor = $_REQUEST[$this->name];
|
||||
}
|
||||
global $app_list_strings;
|
||||
$returnXTPL = array();
|
||||
$returnXTPL[strtoupper($this->name)] = $searchFor;
|
||||
if(empty($this->ext1)){
|
||||
$this->ext1 = $this->options;
|
||||
}
|
||||
$returnXTPL[strtoupper('options_'.$this->name)] = get_select_options_with_id(add_blank_option($app_list_strings[$this->ext1]), $searchFor);
|
||||
return $returnXTPL;
|
||||
|
||||
}
|
||||
|
||||
function get_db_type(){
|
||||
if(empty($this->max_size))$this->max_size = 150;
|
||||
switch($GLOBALS['db']->dbType){
|
||||
case 'oci8': return " varchar2($this->max_size)";
|
||||
case 'mssql': return !empty($GLOBALS['db']->isFreeTDS) ? " nvarchar($this->max_size)" : " varchar($this->max_size)";
|
||||
default: return " varchar($this->max_size)";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function get_field_def(){
|
||||
$def = parent::get_field_def();
|
||||
$def['options'] = !empty($this->options) ? $this->options : $this->ext1;
|
||||
$def['default'] = !empty($this->default) ? $this->default : $this->default_value;
|
||||
$def['len'] = $this->max_size;
|
||||
$def['studio'] = 'visible';
|
||||
// this class may be extended, so only do the unserialize for genuine TemplateEnums
|
||||
if (get_class( $this ) == 'TemplateEnum' )
|
||||
$def['dependency'] = isset($this->ext4)? unserialize(html_entity_decode($this->ext4)) : null ;
|
||||
return $def;
|
||||
}
|
||||
|
||||
function get_xtpl_detail(){
|
||||
$name = $this->name;
|
||||
|
||||
// awu: custom fields are not being displayed on the detail view because $this->ext1 is always empty, adding this to get the options
|
||||
if(empty($this->ext1)){
|
||||
if(!empty($this->options))
|
||||
$this->ext1 = $this->options;
|
||||
}
|
||||
|
||||
if(isset($this->bean->$name)){
|
||||
$key = $this->bean->$name;
|
||||
global $app_list_strings;
|
||||
if(preg_match('/&/s', $key)) {
|
||||
$key = str_replace('&', '&', $key);
|
||||
}
|
||||
if(isset($app_list_strings[$this->ext1])){
|
||||
if(isset($app_list_strings[$this->ext1][$key])) {
|
||||
return $app_list_strings[$this->ext1][$key];
|
||||
}
|
||||
|
||||
if(isset($app_list_strings[$this->ext1][$this->bean->$name])){
|
||||
return $app_list_strings[$this->ext1][$this->bean->$name];
|
||||
}
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function save($df){
|
||||
if (!empty($this->default_value) && is_array($this->default_value)) {
|
||||
$this->default_value = $this->default_value[0];
|
||||
}
|
||||
if (!empty($this->default) && is_array($this->default)) {
|
||||
$this->default = $this->default[0];
|
||||
}
|
||||
|
||||
if ( get_class( $this ) == 'TemplateEnum' && isset ( $this->dependency ) )
|
||||
$this->ext4 = serialize ( $this->dependency ) ;
|
||||
parent::save($df);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
471
modules/DynamicFields/templates/Fields/TemplateField.php
Executable file
471
modules/DynamicFields/templates/Fields/TemplateField.php
Executable file
@@ -0,0 +1,471 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
$GLOBALS['studioReadOnlyFields'] = array('date_entered'=>1, 'date_modified'=>1, 'created_by'=>1, 'id'=>1, 'modified_user_id'=>1);
|
||||
class TemplateField{
|
||||
/*
|
||||
The view is the context this field will be used in
|
||||
-edit
|
||||
-list
|
||||
-detail
|
||||
-search
|
||||
*/
|
||||
var $view = 'edit';
|
||||
var $name = '';
|
||||
var $vname = '';
|
||||
var $id = '';
|
||||
var $size = '20';
|
||||
var $len = '255';
|
||||
var $required = false;
|
||||
var $default = null;
|
||||
var $default_value = null;
|
||||
var $type = 'varchar';
|
||||
var $comment = '';
|
||||
var $bean;
|
||||
var $ext1 = '';
|
||||
var $ext2 = '';
|
||||
var $ext3 = '';
|
||||
var $ext4 = '';
|
||||
var $audited= 0;
|
||||
var $massupdate = 0;
|
||||
var $importable = 'true' ;
|
||||
var $duplicate_merge=0;
|
||||
var $new_field_definition;
|
||||
var $reportable = true;
|
||||
var $label_value = '';
|
||||
var $help = '';
|
||||
|
||||
var $vardef_map = array(
|
||||
'name'=>'name',
|
||||
'label'=>'vname',
|
||||
// bug 15801 - need to ALWAYS keep default and default_value consistent as some methods/classes use one, some use another...
|
||||
'default_value'=>'default',
|
||||
'default'=>'default_value',
|
||||
'display_default'=>'default_value',
|
||||
// 'default_value'=>'default_value',
|
||||
// 'default'=>'default_value',
|
||||
'len'=>'len',
|
||||
'required'=>'required',
|
||||
'type'=>'type',
|
||||
'audited'=>'audited',
|
||||
'massupdate'=>'massupdate',
|
||||
'options'=>'ext1',
|
||||
'help'=>'help',
|
||||
'comments'=>'comment',
|
||||
'importable'=>'importable',
|
||||
'duplicate_merge'=>'duplicate_merge',
|
||||
'duplicate_merge_dom_value'=>'duplicate_merge_dom_value', //bug #14897
|
||||
'merge_filter'=>'merge_filter',
|
||||
'reportable' => 'reportable',
|
||||
'min'=>'ext1',
|
||||
'max'=>'ext2',
|
||||
'ext2'=>'ext2',
|
||||
'ext4'=>'ext4',
|
||||
//'disable_num_format'=>'ext3',
|
||||
'ext3'=>'ext3',
|
||||
'label_value'=>'label_value',
|
||||
);
|
||||
/*
|
||||
HTML FUNCTIONS
|
||||
*/
|
||||
function get_html(){
|
||||
$view = $this->view;
|
||||
if(!empty($GLOBALS['studioReadOnlyFields'][$this->name]))$view = 'detail';
|
||||
switch($view){
|
||||
case 'search':return $this->get_html_search();
|
||||
case 'edit': return $this->get_html_edit();
|
||||
case 'list': return $this->get_html_list();
|
||||
case 'detail': return $this->get_html_detail();
|
||||
|
||||
}
|
||||
}
|
||||
function set($values){
|
||||
foreach($values as $name=>$value){
|
||||
$this->$name = $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function get_html_edit(){
|
||||
return 'not implemented';
|
||||
}
|
||||
|
||||
function get_html_list(){
|
||||
return $this->get_html_detail();
|
||||
}
|
||||
|
||||
function get_html_detail(){
|
||||
return 'not implemented';
|
||||
}
|
||||
|
||||
function get_html_search(){
|
||||
return $this->get_html_edit();
|
||||
}
|
||||
function get_html_label(){
|
||||
|
||||
$label = "{MOD." .$this->vname . "}";
|
||||
if(!empty($GLOBALS['app_strings'][$this->vname])){
|
||||
$label = "{APP." .$this->label . "}";
|
||||
}
|
||||
if($this->view == 'edit' && $this->is_required()){
|
||||
$label .= '<span class="required">*</span>';
|
||||
}
|
||||
if($this->view == 'list'){
|
||||
if(isset($this->bean)){
|
||||
if(!empty($this->id)){
|
||||
$name = $this->bean->table_name . '_cstm.'. $this->name;
|
||||
$arrow = $this->bean->table_name . '_cstm_'. $this->name;
|
||||
}else{
|
||||
$name = $this->bean->table_name . '.'. $this->name;
|
||||
$arrow = $this->bean->table_name . '_'. $this->name;
|
||||
}
|
||||
}else{
|
||||
$name = $this->name;
|
||||
$arrow = $name;
|
||||
}
|
||||
$label = "<a href='{ORDER_BY}$name' class='listViewThLinkS1'>{MOD.$this->label}{arrow_start}{".$arrow."_arrow}{arrow_end}</a>";
|
||||
}
|
||||
return $label;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
XTPL FUNCTIONS
|
||||
*/
|
||||
|
||||
function get_xtpl($bean = false){
|
||||
if($bean)
|
||||
$this->bean = $bean;
|
||||
$view = $this->view;
|
||||
if(!empty($GLOBALS['studioReadOnlyFields'][$this->name]))$view = 'detail';
|
||||
switch($view){
|
||||
case 'search':return $this->get_xtpl_search();
|
||||
case 'edit': return $this->get_xtpl_edit();
|
||||
case 'list': return $this->get_xtpl_list();
|
||||
case 'detail': return $this->get_xtpl_detail();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function get_xtpl_edit(){
|
||||
return '/*not implemented*/';
|
||||
}
|
||||
|
||||
function get_xtpl_list(){
|
||||
return get_xtpl_detail();
|
||||
}
|
||||
|
||||
function get_xtpl_detail(){
|
||||
return '/*not implemented*/';
|
||||
}
|
||||
|
||||
function get_xtpl_search(){
|
||||
//return get_xtpl_edit();
|
||||
}
|
||||
|
||||
function is_required(){
|
||||
if($this->required){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
DB FUNCTIONS
|
||||
*/
|
||||
|
||||
function get_db_type(){
|
||||
switch($GLOBALS['db']->dbType){
|
||||
case 'oci8': return " varchar2($this->len)";
|
||||
case 'mssql': return !empty($GLOBALS['db']->isFreeTDS) ? " nvarchar($this->len)" : " varchar($this->len)";
|
||||
default: return " varchar($this->len)";
|
||||
}
|
||||
}
|
||||
|
||||
function get_db_default($modify=false){
|
||||
$GLOBALS['log']->debug('get_db_default(): default_value='.$this->default_value);
|
||||
if (!$modify or empty($this->new_field_definition['default_value']) or $this->new_field_definition['default_value'] != $this->default_value ) {
|
||||
if(!is_null($this->default_value)){ // add a default value if it is not null - we want to set a default even if default_value is '0', which is not null, but which is empty()
|
||||
if(NULL == trim($this->default_value)){
|
||||
return " DEFAULT NULL";
|
||||
}
|
||||
else {
|
||||
return " DEFAULT '$this->default_value'";
|
||||
}
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the required clause for this field
|
||||
* Confusingly, when modifying an existing field ($modify=true) there are two exactly opposite cases:
|
||||
* 1. if called by Studio, only $this->required is set. If set, we return "NOT NULL" otherwise we return "NULL"
|
||||
* 2. if not called by Studio, $this->required holds the OLD value of required, and new_field_definition['required'] is the NEW
|
||||
* So if not called by Studio we want to return NULL if required=true (because we are changing FROM this setting)
|
||||
*/
|
||||
|
||||
function get_db_required($modify=false){
|
||||
// $GLOBALS['log']->debug('get_db_required required='.$this->required." and ".(($modify)?"true":"false")." and ".print_r($this->new_field_definition,true));
|
||||
$req = "";
|
||||
|
||||
if ($modify) {
|
||||
if (!empty($this->new_field_definition['required'])) {
|
||||
if ($this->required and $this->new_field_definition['required'] != $this->required) {
|
||||
$req = " NULL ";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$req = ($this->required) ? " NOT NULL " : ''; // bug 17184 tyoung - set required correctly when modifying custom field in Studio
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($this->new_field_definition['required']) or $this->new_field_definition['required'] != $this->required ) {
|
||||
if(!empty($this->required) && $this->required){
|
||||
$req = " NOT NULL";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $req;
|
||||
}
|
||||
|
||||
/* function get_db_required($modify=false){
|
||||
$GLOBALS['log']->debug('get_db_required required='.$this->required." and ".(($modify)?"true":"false")." and ".print_r($this->new_field_definition,true));
|
||||
if ($modify) {
|
||||
if (!empty($this->new_field_definition['required'])) {
|
||||
if ($this->required and $this->new_field_definition['required'] != $this->required) {
|
||||
return " null ";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
if (empty($this->new_field_definition['required']) or $this->new_field_definition['required'] != $this->required ) {
|
||||
if(!empty($this->required) && $this->required){
|
||||
return " NOT NULL";
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
*/
|
||||
/**
|
||||
* Oracle Support: do not set required constraint if no default value is supplied.
|
||||
* In this case the default value will be handled by the application/sugarbean.
|
||||
*/
|
||||
function get_db_add_alter_table($table)
|
||||
{
|
||||
return $GLOBALS['db']->getHelper()->addColumnSQL($table, $this->get_field_def(), true);
|
||||
}
|
||||
|
||||
function get_db_delete_alter_table($table)
|
||||
{
|
||||
return $GLOBALS['db']->getHelper()->dropColumnSQL(
|
||||
$table,
|
||||
$this->get_field_def()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* mysql requires the datatype caluse in the alter statment.it will be no-op anyway.
|
||||
*/
|
||||
function get_db_modify_alter_table($table){
|
||||
global $db;
|
||||
$db_default=$this->get_db_default(true);
|
||||
$db_required=$this->get_db_required(true);
|
||||
switch ($GLOBALS['db']->dbType) {
|
||||
|
||||
case "mssql":
|
||||
//Bug 21772: MSSQL handles alters in strange ways. Defer to DBHelpers guidance.
|
||||
$query = $db->helper->alterColumnSQL($table, $this->get_field_def());
|
||||
return $query;
|
||||
break;
|
||||
|
||||
case "mysql":
|
||||
$query="ALTER TABLE $table MODIFY $this->name " .$this->get_db_type();
|
||||
break;
|
||||
default:
|
||||
$query="ALTER TABLE $table MODIFY $this->name " .$this->get_db_type();;
|
||||
break;
|
||||
|
||||
}
|
||||
if (!empty($db_default) && !empty($db_required)) {
|
||||
$query .= $db_default . $db_required ;
|
||||
} else if (!empty($db_default)) {
|
||||
$query .= $db_default;
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* BEAN FUNCTIONS
|
||||
*
|
||||
*/
|
||||
function get_field_def(){
|
||||
$array = array(
|
||||
'required'=>$this->convertBooleanValue($this->required),
|
||||
'source'=>'custom_fields',
|
||||
'name'=>$this->name,
|
||||
'vname'=>$this->vname,
|
||||
'type'=>$this->type,
|
||||
'massupdate'=>$this->massupdate,
|
||||
'default'=>$this->default,
|
||||
'comments'=> (isset($this->comments)) ? $this->comments : '',
|
||||
'help'=> (isset($this->help)) ? $this->help : '',
|
||||
'importable'=>$this->importable,
|
||||
'duplicate_merge'=>$this->duplicate_merge,
|
||||
'duplicate_merge_dom_value'=> isset($this->duplicate_merge_dom_value) ? $this->duplicate_merge_dom_value : $this->duplicate_merge,
|
||||
'audited'=>$this->convertBooleanValue($this->audited),
|
||||
'reportable'=>$this->convertBooleanValue($this->reportable),
|
||||
);
|
||||
if(!empty($this->len)){
|
||||
$array['len'] = $this->len;
|
||||
}
|
||||
if(!empty($this->size)){
|
||||
$array['size'] = $this->size;
|
||||
}
|
||||
$this->get_dup_merge_def($array);
|
||||
return $array;
|
||||
}
|
||||
|
||||
protected function convertBooleanValue($value)
|
||||
{
|
||||
if ($value === 'true' || $value === '1' || $value === 1)
|
||||
return true;
|
||||
else if ($value === 'false' || $value === '0' || $value === 0)
|
||||
return false;
|
||||
else
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
/* if the field is duplicate merge enabled this function will return the vardef entry for the same.
|
||||
*/
|
||||
function get_dup_merge_def(&$def) {
|
||||
|
||||
switch ($def['duplicate_merge_dom_value']) {
|
||||
case 0:
|
||||
$def['duplicate_merge']='disabled';
|
||||
break;
|
||||
case 1:
|
||||
$def['duplicate_merge']='enabled';
|
||||
break;
|
||||
case 2:
|
||||
$def['merge_filter']='enabled';
|
||||
$def['duplicate_merge']='enabled';
|
||||
break;
|
||||
case 3:
|
||||
$def['merge_filter']='selected';
|
||||
$def['duplicate_merge']='enabled';
|
||||
break;
|
||||
case 4:
|
||||
$def['merge_filter']='enabled';
|
||||
$def['duplicate_merge']='disabled';
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
HELPER FUNCTIONS
|
||||
*/
|
||||
|
||||
|
||||
function prepare(){
|
||||
if(empty($this->id)){
|
||||
$this->id = $this->name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* populateFromRow
|
||||
* This function supports setting the values of all TemplateField instances.
|
||||
* @param $row The Array key/value pairs from fields_meta_data table
|
||||
*/
|
||||
function populateFromRow($row=array()) {
|
||||
$fmd_to_dyn_map = array('comments' => 'comment', 'require_option' => 'required', 'label' => 'vname',
|
||||
'mass_update' => 'massupdate', 'max_size' => 'len', 'default_value' => 'default', 'id_name' => 'ext3');
|
||||
if(!is_array($row)) {
|
||||
$GLOBALS['log']->error("Error: TemplateField->populateFromRow expecting Array");
|
||||
}
|
||||
//Bug 24189: Copy fields from FMD format to Field objects
|
||||
foreach ($fmd_to_dyn_map as $fmd_key => $dyn_key) {
|
||||
if (isset($row[$fmd_key])) {
|
||||
$this->$dyn_key = $row[$fmd_key];
|
||||
}
|
||||
}
|
||||
foreach($row as $key=>$value) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
|
||||
function populateFromPost(){
|
||||
foreach($this->vardef_map as $vardef=>$field){
|
||||
if(isset($_REQUEST[$vardef])){
|
||||
$this->$vardef = $_REQUEST[$vardef];
|
||||
if($vardef != $field){
|
||||
$this->$field = $this->$vardef;
|
||||
}
|
||||
}
|
||||
}
|
||||
$GLOBALS['log']->debug('populate: '.print_r($this,true));
|
||||
|
||||
}
|
||||
|
||||
function get_additional_defs(){
|
||||
return array();
|
||||
}
|
||||
|
||||
function delete($df){
|
||||
$df->deleteField($this);
|
||||
}
|
||||
|
||||
function save($df){
|
||||
// $GLOBALS['log']->debug('saving field: '.print_r($this,true));
|
||||
$df->addFieldObject($this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
100
modules/DynamicFields/templates/Fields/TemplateFloat.php
Executable file
100
modules/DynamicFields/templates/Fields/TemplateFloat.php
Executable file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
class TemplateFloat extends TemplateText{
|
||||
var $type = 'float';
|
||||
var $default = null;
|
||||
var $default_value = null;
|
||||
var $len = '18';
|
||||
var $precision = '8';
|
||||
|
||||
function TemplateFloat(){
|
||||
$this->vardef_map['precision']='ext1';
|
||||
//$this->vardef_map['precision']='precision';
|
||||
}
|
||||
|
||||
function get_field_def(){
|
||||
$def = parent::get_field_def();
|
||||
$def['precision'] = !empty($this->ext1) ? $this->ext1 : $this->precision;
|
||||
return $def;
|
||||
}
|
||||
|
||||
function get_db_type(){
|
||||
// $GLOBALS['log']->debug('TemplateFloat:get_db_type()'.print_r($this,true));
|
||||
|
||||
if ($GLOBALS['db']->dbType=='mysql')
|
||||
{
|
||||
$type = " FLOAT";
|
||||
if(!empty($this->len))
|
||||
{
|
||||
$precision = (!empty($this->precision)) ? $this->precision : 4; // bug 17041 tyoung - mysql requires a precision value if length is specified
|
||||
$type .= "({$this->len},$precision)";
|
||||
}
|
||||
}
|
||||
elseif ($GLOBALS['db']->dbType=='mssql')
|
||||
{
|
||||
$type = " decimal";
|
||||
if(!empty($this->len))
|
||||
{
|
||||
$precision = (!empty($this->precision)) ? $this->precision : 4;
|
||||
$type .= "({$this->len},$precision)";
|
||||
}
|
||||
else
|
||||
{
|
||||
$type .= "(11,4)";
|
||||
}
|
||||
}
|
||||
elseif ($GLOBALS['db']->dbType=='oci8')
|
||||
{
|
||||
$precision = (!empty($this->precision))? $this->precision: 6;
|
||||
$type= " NUMBER(30,$precision) ";
|
||||
}
|
||||
|
||||
/**
|
||||
* FOR ORACLE
|
||||
* return " NUMBER($this->max_size, $this->precision)";
|
||||
*/
|
||||
return $type;
|
||||
}
|
||||
|
||||
function populateFromRow($row=array()) {
|
||||
parent::populateFromRow($row);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
118
modules/DynamicFields/templates/Fields/TemplateHTML.php
Executable file
118
modules/DynamicFields/templates/Fields/TemplateHTML.php
Executable file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
class TemplateHTML extends TemplateField{
|
||||
var $data_type = 'html';
|
||||
var $type = 'html';
|
||||
|
||||
function save($df){
|
||||
$this->ext3 = 'text';
|
||||
parent::save($df);
|
||||
}
|
||||
|
||||
function set($values){
|
||||
parent::set($values);
|
||||
if(!empty($this->ext4)){
|
||||
$this->default_value = $this->ext4;
|
||||
$this->default = $this->ext4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function get_html_detail(){
|
||||
|
||||
return '<div title="' . strtoupper($this->name . '_HELP'). '" >{'.strtoupper($this->name) . '}</div>';
|
||||
}
|
||||
|
||||
function get_html_edit(){
|
||||
return $this->get_html_detail();
|
||||
}
|
||||
|
||||
function get_html_list(){
|
||||
return $this->get_html_detail();
|
||||
}
|
||||
|
||||
function get_html_search(){
|
||||
return $this->get_html_detail();
|
||||
}
|
||||
|
||||
function get_xtpl_detail(){
|
||||
|
||||
return from_html(nl2br($this->ext4));
|
||||
}
|
||||
|
||||
function get_xtpl_edit(){
|
||||
return $this->get_xtpl_detail();
|
||||
}
|
||||
|
||||
function get_xtpl_list(){
|
||||
return $this->get_xtpl_detail();
|
||||
}
|
||||
function get_xtpl_search(){
|
||||
return $this->get_xtpl_detail();
|
||||
}
|
||||
|
||||
function get_db_add_alter_table($table){
|
||||
return '';
|
||||
}
|
||||
|
||||
function get_db_modify_alter_table($table){
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
function get_db_delete_alter_table($table)
|
||||
{
|
||||
return '' ;
|
||||
}
|
||||
|
||||
function get_field_def() {
|
||||
$def = parent::get_field_def();
|
||||
if(!empty($this->ext4)){
|
||||
$def['default_value'] = $this->ext4;
|
||||
$def['default'] = $this->ext4;
|
||||
}
|
||||
$def['studio'] = 'visible';
|
||||
$def['dbType'] = isset($this->ext3) ? $this->ext3 : 'text' ;
|
||||
return array_merge($def, $this->get_additional_defs());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
63
modules/DynamicFields/templates/Fields/TemplateIFrame.php
Executable file
63
modules/DynamicFields/templates/Fields/TemplateIFrame.php
Executable file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateURL.php');
|
||||
class TemplateIFrame extends TemplateURL{
|
||||
var $type='iframe';
|
||||
|
||||
function get_html_edit(){
|
||||
$this->prepare();
|
||||
return "<input type='text' name='". $this->name. "' id='".$this->name."' size='".$this->size."' title='{" . strtoupper($this->name) ."_HELP}' value='{". strtoupper($this->name). "}'>";
|
||||
}
|
||||
|
||||
function get_html_label() {
|
||||
return "LALALALA";
|
||||
}
|
||||
|
||||
function get_xtpl_detail(){
|
||||
$value = parent::get_xtpl_detail();
|
||||
$value .= "BLAH BLAH";
|
||||
return $value;
|
||||
}
|
||||
|
||||
function get_field_def(){
|
||||
$def = parent::get_field_def();
|
||||
$def['height'] = !empty($this->height) ? $this->height : $this->ext4;
|
||||
return $def;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
46
modules/DynamicFields/templates/Fields/TemplateId.php
Executable file
46
modules/DynamicFields/templates/Fields/TemplateId.php
Executable file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateField.php');
|
||||
class TemplateId extends TemplateField{
|
||||
var $type='id';
|
||||
var $len = 36 ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
83
modules/DynamicFields/templates/Fields/TemplateImage.php
Executable file
83
modules/DynamicFields/templates/Fields/TemplateImage.php
Executable file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateText.php');
|
||||
class TemplateImage extends TemplateText{
|
||||
var $type = 'image';
|
||||
|
||||
function get_field_def(){
|
||||
$def = parent::get_field_def();
|
||||
$def['studio'] = 'visible';
|
||||
$def['type'] = 'image';
|
||||
$def['dbType'] = 'varchar';
|
||||
$def['len']= 255;
|
||||
|
||||
if( isset($this->ext1) ) $def[ 'border' ] = $this->ext1 ;
|
||||
if( isset($this->ext2) ) $def[ 'width' ] = $this->ext2 ;
|
||||
if( isset($this->ext3) ) $def[ 'height' ] = $this->ext3 ;
|
||||
if( isset($this->border)) $def[ 'border' ] = $this->border ;
|
||||
if( isset($this->width) ) $def[ 'width' ] = $this->width ;
|
||||
if( isset($this->height)) $def[ 'height' ] = $this->height ;
|
||||
|
||||
return $def;
|
||||
}
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->vardef_map['border'] = 'ext1';
|
||||
$this->vardef_map['width'] = 'ext2';
|
||||
$this->vardef_map['height'] = 'ext3';
|
||||
}
|
||||
|
||||
function set($values){
|
||||
parent::set($values);
|
||||
if(!empty($this->ext1)){
|
||||
$this->border = $this->ext1;
|
||||
}
|
||||
if(!empty($this->ext2)){
|
||||
$this->width = $this->ext2;
|
||||
}
|
||||
if(!empty($this->ext3)){
|
||||
$this->height = $this->ext3;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
119
modules/DynamicFields/templates/Fields/TemplateInt.php
Executable file
119
modules/DynamicFields/templates/Fields/TemplateInt.php
Executable file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
class TemplateInt extends TemplateText{
|
||||
|
||||
function __construct(){
|
||||
//parent::__construct();
|
||||
$this->vardef_map['autoinc_next'] = 'autoinc_next';
|
||||
$this->vardef_map['autoinc_start'] = 'autoinc_start';
|
||||
$this->vardef_map['auto_increment'] = 'auto_increment';
|
||||
}
|
||||
|
||||
var $type = 'int';
|
||||
function get_html_edit(){
|
||||
$this->prepare();
|
||||
return "<input type='text' name='". $this->name. "' id='".$this->name."' title='{" . strtoupper($this->name) ."_HELP}' size='".$this->size."' maxlength='".$this->len."' value='{". strtoupper($this->name). "}'>";
|
||||
}
|
||||
|
||||
function populateFromPost(){
|
||||
parent::populateFromPost();
|
||||
if (isset($this->auto_increment))
|
||||
{
|
||||
$this->auto_increment = $this->auto_increment == "true" || $this->auto_increment === true;
|
||||
}
|
||||
}
|
||||
|
||||
function get_field_def(){
|
||||
$vardef = parent::get_field_def();
|
||||
$vardef['disable_num_format'] = $this->ext3;
|
||||
if(!empty($this->ext2)){
|
||||
$min = (!empty($this->ext1))?$this->ext1:0;
|
||||
$max = $this->ext2;
|
||||
$vardef['validation'] = array('type' => 'range', 'min' => $min, 'max' => $max);
|
||||
}
|
||||
if(!empty($this->auto_increment))
|
||||
{
|
||||
$vardef['auto_increment'] = $this->auto_increment;
|
||||
if ((empty($this->autoinc_next)) && isset($this->module) && isset($this->module->table_name))
|
||||
{
|
||||
global $db;
|
||||
$helper = $db->gethelper();
|
||||
$auto = $helper->getAutoIncrement($this->module->table_name, $this->name);
|
||||
$this->autoinc_next = $vardef['autoinc_next'] = $auto;
|
||||
}
|
||||
}
|
||||
return $vardef;
|
||||
}
|
||||
|
||||
function get_db_type(){
|
||||
switch($GLOBALS['db']->dbType){
|
||||
case 'oci8': return ' NUMBER ';
|
||||
case 'mysql': return (!empty($this->len) && $this->len <= 11 && $this->len > 0)? ' INT(' .$this->len . ')' : ' INT(11) ';
|
||||
default: return ' INT ';
|
||||
}
|
||||
}
|
||||
|
||||
function save($df){
|
||||
$next = false;
|
||||
if (!empty($this->auto_increment) && (!empty($this->autoinc_next) || !empty($this->autoinc_start)) && isset($this->module))
|
||||
{
|
||||
if (!empty($this->autoinc_start) && $this->autoinc_start > $this->autoinc_next)
|
||||
{
|
||||
$this->autoinc_next = $this->autoinc_start;
|
||||
}
|
||||
if(isset($this->module->table_name)){
|
||||
global $db;
|
||||
$helper = $db->gethelper();
|
||||
//Check that the new value is greater than the old value
|
||||
$oldNext = $helper->getAutoIncrement($this->module->table_name, $this->name);
|
||||
if ($this->autoinc_next > $oldNext)
|
||||
{
|
||||
$helper->setAutoIncrementStart($this->module->table_name, $this->name, $this->autoinc_next);
|
||||
}
|
||||
}
|
||||
$next = $this->autoinc_next;
|
||||
$this->autoinc_next = false;
|
||||
}
|
||||
parent::save($df);
|
||||
if ($next)
|
||||
$this->autoinc_next = $next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
171
modules/DynamicFields/templates/Fields/TemplateMultiEnum.php
Executable file
171
modules/DynamicFields/templates/Fields/TemplateMultiEnum.php
Executable file
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateEnum.php');
|
||||
require_once('include/utils/array_utils.php');
|
||||
class TemplateMultiEnum extends TemplateEnum{
|
||||
var $type = 'text';
|
||||
|
||||
function get_html_edit(){
|
||||
$this->prepare();
|
||||
$xtpl_var = strtoupper( $this->name);
|
||||
// MFH BUG#13645
|
||||
return "<input type='hidden' name='". $this->name. "' value='0'><select name='". $this->name . "[]' size='5' title='{" . $xtpl_var ."_HELP}' MULTIPLE=true>{OPTIONS_".$xtpl_var. "}</select>";
|
||||
}
|
||||
|
||||
function get_db_type(){
|
||||
if ($GLOBALS['db']->dbType=='oci8') {
|
||||
return " CLOB ";
|
||||
} else {
|
||||
return " TEXT ";
|
||||
}
|
||||
}
|
||||
|
||||
function get_xtpl_edit(){
|
||||
$name = $this->name;
|
||||
$value = '';
|
||||
if(isset($this->bean->$name)){
|
||||
$value = $this->bean->$name;
|
||||
}else{
|
||||
if(empty($this->bean->id)){
|
||||
$value= $this->default_value;
|
||||
}
|
||||
}
|
||||
if(!empty($this->help)){
|
||||
$returnXTPL[strtoupper($this->name . '_help')] = translate($this->help, $this->bean->module_dir);
|
||||
}
|
||||
|
||||
global $app_list_strings;
|
||||
$returnXTPL = array();
|
||||
|
||||
$returnXTPL[strtoupper($this->name)] = str_replace('^,^', ',', $value);
|
||||
if(empty($this->ext1)){
|
||||
$this->ext1 = $this->options;
|
||||
}
|
||||
$returnXTPL[strtoupper('options_'.$this->name)] = get_select_options_with_id($app_list_strings[$this->ext1], unencodeMultienum( $value));
|
||||
|
||||
return $returnXTPL;
|
||||
|
||||
|
||||
}
|
||||
function prepSave(){
|
||||
|
||||
}
|
||||
function get_xtpl_list(){
|
||||
return $this->get_xtpl_detail();
|
||||
|
||||
}
|
||||
function get_xtpl_detail(){
|
||||
|
||||
$name = $this->name;
|
||||
$value = '';
|
||||
if(isset($this->bean->$name)){
|
||||
$value = $this->bean->$name;
|
||||
}else{
|
||||
if(empty($this->bean->id)){
|
||||
$value= $this->default_value;
|
||||
}
|
||||
}
|
||||
$returnXTPL = array();
|
||||
if(empty($value)) return $returnXTPL;
|
||||
global $app_list_strings;
|
||||
|
||||
$values = unencodeMultienum( $value);
|
||||
$translatedValues = array();
|
||||
|
||||
foreach($values as $val){
|
||||
$translated = translate($this->options, '', $val);
|
||||
if(is_string($translated))$translatedValues[] = $translated;
|
||||
}
|
||||
|
||||
$returnXTPL[strtoupper($this->name)] = implode(', ', $translatedValues);
|
||||
return $returnXTPL;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function get_field_def(){
|
||||
$def = parent::get_field_def();
|
||||
if ( isset ( $this->ext4 ) )
|
||||
{
|
||||
// turn off error reporting in case we are unpacking a value that hasn't been packed...
|
||||
// this is kludgy, but unserialize doesn't throw exceptions correctly
|
||||
$oldErrorReporting = error_reporting ( 0 );
|
||||
$unpacked = unserialize ( $this->ext4 ) ;
|
||||
error_reporting ( $oldErrorReporting ) ;
|
||||
|
||||
// if we have a new error, then unserialize must have failed => we don't have a packed ext4
|
||||
// safe to assume that false means the unpack failed, as ext4 will either contain an imploded string of default values, or an array, not a boolean false value
|
||||
if ( $unpacked === false )
|
||||
$def [ 'default' ] = $this->ext4 ;
|
||||
else
|
||||
{
|
||||
// we have a packed representation containing one or both of default and dependency
|
||||
if ( isset ( $unpacked [ 'default' ] ) )
|
||||
$def [ 'default' ] = $unpacked [ 'default' ] ;
|
||||
if ( isset ( $unpacked [ 'dependency' ] ) )
|
||||
$def [ 'dependency' ] = $unpacked [ 'dependency' ] ;
|
||||
}
|
||||
}
|
||||
//$def['default'] = isset($this->ext4)? $this->ext4 : $def['default'];
|
||||
$def['isMultiSelect'] = true;
|
||||
unset($def['len']);
|
||||
return $def;
|
||||
}
|
||||
|
||||
function get_db_default(){
|
||||
return '';
|
||||
}
|
||||
|
||||
function save($df) {
|
||||
if ( isset ( $this->default ) )
|
||||
{
|
||||
if ( is_array ( $this->default ) )
|
||||
$this->default = encodeMultienumValue($this->default);
|
||||
$this->ext4 = ( isset ( $this->dependency ) ) ? serialize ( array ( 'default' => $this->default , 'dependency' => $this->dependency ) ) : $this->default ;
|
||||
} else
|
||||
{
|
||||
if ( isset ( $this->dependency ) )
|
||||
$this->ext4 = serialize ( array ( 'dependency' => $this->dependency ) ) ;
|
||||
}
|
||||
parent::save($df);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
106
modules/DynamicFields/templates/Fields/TemplateParent.php
Executable file
106
modules/DynamicFields/templates/Fields/TemplateParent.php
Executable file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateEnum.php');
|
||||
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateId.php');
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateParentType.php');
|
||||
class TemplateParent extends TemplateEnum{
|
||||
var $max_size = 25;
|
||||
var $type='parent';
|
||||
|
||||
function get_field_def(){
|
||||
$def = parent::get_field_def();
|
||||
$def['type_name'] = 'parent_type';
|
||||
$def['id_name'] = 'parent_id';
|
||||
$def['parent_type'] = 'record_type_display';
|
||||
$def['source'] = 'non-db';
|
||||
$def['studio'] = 'visible';
|
||||
return $def;
|
||||
}
|
||||
|
||||
function delete($df){
|
||||
parent::delete($df);
|
||||
//currency id
|
||||
$parent_type = new TemplateText();
|
||||
$parent_type->name = 'parent_type';
|
||||
$parent_type->delete($df);
|
||||
|
||||
$parent_id = new TemplateId();
|
||||
$parent_id->name = 'parent_id';
|
||||
$parent_id->delete($df);
|
||||
}
|
||||
|
||||
function save($df){
|
||||
$this->ext1 = 'parent_type_display';
|
||||
$this->name = 'parent_name';
|
||||
$this->default_value = '';
|
||||
parent::save($df); // always save because we may have updates
|
||||
|
||||
//save parent_type
|
||||
$parent_type = new TemplateParentType();
|
||||
$parent_type->name = 'parent_type';
|
||||
$parent_type->vname = 'LBL_PARENT_TYPE';
|
||||
$parent_type->label = $parent_type->vname;
|
||||
$parent_type->len = 255;
|
||||
$parent_type->importable = $this->importable;
|
||||
$parent_type->save($df);
|
||||
|
||||
//save parent_name
|
||||
$parent_id = new TemplateId();
|
||||
$parent_id->name = 'parent_id';
|
||||
$parent_id->vname = 'LBL_PARENT_ID';
|
||||
$parent_id->label = $parent_id->vname;
|
||||
$parent_id->len = 36;
|
||||
$parent_id->importable = $this->importable;
|
||||
$parent_id->save($df);
|
||||
}
|
||||
|
||||
function get_db_add_alter_table($table){
|
||||
return '';
|
||||
}
|
||||
/**
|
||||
* mysql requires the datatype caluse in the alter statment.it will be no-op anyway.
|
||||
*/
|
||||
function get_db_modify_alter_table($table){
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
52
modules/DynamicFields/templates/Fields/TemplateParentType.php
Executable file
52
modules/DynamicFields/templates/Fields/TemplateParentType.php
Executable file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
class TemplateParentType extends TemplateText{
|
||||
var $max_size = 25;
|
||||
var $type='parent_type';
|
||||
|
||||
function get_field_def(){
|
||||
$def = parent::get_field_def();
|
||||
$def['dbType'] = 'varchar';
|
||||
$def['studio'] = 'hidden';
|
||||
return $def;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
50
modules/DynamicFields/templates/Fields/TemplatePhone.php
Executable file
50
modules/DynamicFields/templates/Fields/TemplatePhone.php
Executable file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
class TemplatePhone extends TemplateText{
|
||||
var $max_size = 25;
|
||||
var $type='phone';
|
||||
|
||||
function get_field_def(){
|
||||
$def = parent::get_field_def();
|
||||
$def['dbType'] = 'varchar';
|
||||
return $def;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
135
modules/DynamicFields/templates/Fields/TemplateRadioEnum.php
Executable file
135
modules/DynamicFields/templates/Fields/TemplateRadioEnum.php
Executable file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateEnum.php');
|
||||
require_once('include/utils/array_utils.php');
|
||||
class TemplateRadioEnum extends TemplateEnum{
|
||||
var $type = 'radioenum';
|
||||
|
||||
function get_html_edit(){
|
||||
$this->prepare();
|
||||
$xtpl_var = strtoupper( $this->name);
|
||||
return "{RADIOOPTIONS_".$xtpl_var. "}";
|
||||
}
|
||||
|
||||
function get_field_def(){
|
||||
$def = parent::get_field_def();
|
||||
$def['dbType'] = 'enum';
|
||||
$def['separator'] = '<br>';
|
||||
return $def;
|
||||
}
|
||||
|
||||
|
||||
function get_xtpl_edit($add_blank = false){
|
||||
$name = $this->name;
|
||||
$value = '';
|
||||
if(isset($this->bean->$name)){
|
||||
$value = $this->bean->$name;
|
||||
}else{
|
||||
if(empty($this->bean->id)){
|
||||
$value= $this->default_value;
|
||||
}
|
||||
}
|
||||
if(!empty($this->help)){
|
||||
$returnXTPL[$this->name . '_help'] = translate($this->help, $this->bean->module_dir);
|
||||
}
|
||||
|
||||
global $app_list_strings;
|
||||
$returnXTPL = array();
|
||||
$returnXTPL[strtoupper($this->name)] = $value;
|
||||
|
||||
|
||||
$returnXTPL[strtoupper('RADIOOPTIONS_'.$this->name)] = $this->generateRadioButtons($value, false);
|
||||
return $returnXTPL;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function generateRadioButtons($value = '', $add_blank =false){
|
||||
global $app_list_strings;
|
||||
$radiooptions = '';
|
||||
$keyvalues = $app_list_strings[$this->ext1];
|
||||
if($add_blank){
|
||||
$keyvalues = add_blank_option($keyvalues);
|
||||
}
|
||||
$help = (!empty($this->help))?"title='". translate($this->help, $this->bean->module_dir) . "'": '';
|
||||
foreach($keyvalues as $key=>$displayText){
|
||||
$selected = ($value == $key)?'checked': '';
|
||||
$radiooptions .= "<input type='radio' id='{$this->name}{$key}' name='$this->name' $help value='$key' $selected><span onclick='document.getElementById(\"{$this->name}{$key}\").checked = true' style='cursor:default' onmousedown='return false;'>$displayText</span><br>\n";
|
||||
}
|
||||
return $radiooptions;
|
||||
|
||||
}
|
||||
|
||||
function get_xtpl_search(){
|
||||
$searchFor = '';
|
||||
if(!empty($_REQUEST[$this->name])){
|
||||
$searchFor = $_REQUEST[$this->name];
|
||||
}
|
||||
global $app_list_strings;
|
||||
$returnXTPL = array();
|
||||
$returnXTPL[strtoupper($this->name)] = $searchFor;
|
||||
$returnXTPL[strtoupper('RADIOOPTIONS_'.$this->name)] = $this->generateRadioButtons($searchFor, true);
|
||||
return $returnXTPL;
|
||||
|
||||
}
|
||||
|
||||
function get_xtpl_detail(){
|
||||
$name = $this->name;
|
||||
if(isset($this->bean->$name)){
|
||||
global $app_list_strings;
|
||||
if(isset($app_list_strings[$this->ext1])){
|
||||
if(isset($app_list_strings[$this->ext1][$this->bean->$name])){
|
||||
return $app_list_strings[$this->ext1][$this->bean->$name];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(empty($this->bean->id)){
|
||||
return $this->default_value;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function get_db_default(){
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
254
modules/DynamicFields/templates/Fields/TemplateRelatedTextField.php
Executable file
254
modules/DynamicFields/templates/Fields/TemplateRelatedTextField.php
Executable file
@@ -0,0 +1,254 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateField.php');
|
||||
class TemplateRelatedTextField extends TemplateText{
|
||||
var $type = 'relate';
|
||||
//ext1 is the name field
|
||||
//ext2 is the related module
|
||||
|
||||
function get_html_edit(){
|
||||
$this->prepare();
|
||||
$name = $this->name .'_name';
|
||||
$value_name = strtoupper('{'.$name.'}');
|
||||
$id = $this->name ;
|
||||
$value_id = strtoupper('{'.$id .'}');
|
||||
return "<input type='text' name='$name' id='$name' size='".$this->size."' readonly value='$value_name'><input type='button' onclick='open_popup(\"{". strtoupper($this->name). "_MODULE}\", 600, 400,\" \", true, false, {ENCODED_". strtoupper($this->name). "_POPUP_REQUEST_DATA})' type='button' class='button' value='{APP.LBL_SELECT_BUTTON_LABEL}' ><input type='hidden' name='$id' value='$value_id'>";
|
||||
}
|
||||
|
||||
function get_html_detail(){
|
||||
$name = $this->name .'_name';
|
||||
$value_name = strtoupper('{'.$name.'}');
|
||||
$id = $this->name ;
|
||||
$value_id = strtoupper('{'.$id .'}');
|
||||
|
||||
return "<a href='index.php?module=$this->ext2&action=DetailView&record={$value_id}'>{$value_name}</a>" ;
|
||||
}
|
||||
|
||||
function get_html_list(){
|
||||
if(isset($this->bean)){
|
||||
$name = $this->bean->object_name . '.'. $this->ext1;
|
||||
}else{
|
||||
$name = $this->ext1;
|
||||
}
|
||||
return '{'. strtoupper($name) . '}';
|
||||
}
|
||||
|
||||
function get_html_search(){
|
||||
$searchable=array();
|
||||
$def = $this->bean->field_name_map[$this->name];
|
||||
if(!empty($def['id_name']) && in_array($def['id_name'], $searchable)){
|
||||
$name = $def['id_name'];
|
||||
return "<select size='3' name='{$name}[]' tabindex='1' multiple='multiple'>{".strtoupper($name). "_FILTER}</select>";
|
||||
}
|
||||
//return 'NOT AVAILABLE';
|
||||
return $this->get_html_edit();
|
||||
}
|
||||
|
||||
function get_xtpl_search(){
|
||||
$searchable=array();
|
||||
$def = $this->bean->field_name_map[$this->name];
|
||||
$returnXTPL = array();
|
||||
if(!empty($def['id_name']) && in_array($def['id_name'], $searchable)){
|
||||
$name = $def['id_name'];
|
||||
$team_list = '';
|
||||
foreach(get_team_array() as $id=>$team){
|
||||
$selected = '';
|
||||
|
||||
if(!empty($_REQUEST[$name]) && is_array($_REQUEST[$name]) && in_array($id, $_REQUEST[$name])){
|
||||
$selected = 'selected';
|
||||
}
|
||||
$team_list .= "<option $selected value='$id'>$team</option>";
|
||||
}
|
||||
$returnXTPL[strtoupper($name). '_FILTER'] = $team_list;
|
||||
} else {
|
||||
$id = $this->name;
|
||||
$name = $this->name .'_name';
|
||||
$module = $this->ext2;
|
||||
$popup_request_data = array(
|
||||
'call_back_function' => 'set_return',
|
||||
'form_name' => 'search_form',
|
||||
'field_to_name_array' => array(
|
||||
'id' => $this->name,
|
||||
$this->ext1 => $name,
|
||||
),
|
||||
);
|
||||
|
||||
$json = getJSONobj();
|
||||
$encoded_popup_request_data = $json->encode($popup_request_data);
|
||||
$returnXTPL['ENCODED_'.strtoupper($id).'_POPUP_REQUEST_DATA'] = $encoded_popup_request_data;
|
||||
$returnXTPL[strtoupper($id).'_MODULE'] = $module;
|
||||
|
||||
if(isset( $_REQUEST[$name])){
|
||||
$returnXTPL[strtoupper($name)] = $_REQUEST[$name];
|
||||
}
|
||||
if(isset( $_REQUEST[$id])){
|
||||
$returnXTPL[strtoupper($id)] = $_REQUEST[$id];
|
||||
}
|
||||
}
|
||||
return $returnXTPL;
|
||||
}
|
||||
|
||||
|
||||
function get_xtpl_edit(){
|
||||
global $beanList;
|
||||
|
||||
$name = $this->name .'_name';
|
||||
$id = $this->name;
|
||||
$module = $this->ext2;
|
||||
$returnXTPL = array();
|
||||
$popup_request_data = array(
|
||||
'call_back_function' => 'set_return',
|
||||
'form_name' => 'EditView',
|
||||
'field_to_name_array' => array(
|
||||
'id' => $this->name,
|
||||
$this->ext1 => $name,
|
||||
),
|
||||
);
|
||||
|
||||
//$GLOBALS['log']->fatal($this->bean);
|
||||
|
||||
$json = getJSONobj();
|
||||
$encoded_contact_popup_request_data = $json->encode($popup_request_data);
|
||||
$returnXTPL['ENCODED_'.strtoupper($id).'_POPUP_REQUEST_DATA'] = $encoded_contact_popup_request_data;
|
||||
$returnXTPL[strtoupper($id).'_MODULE'] = $module;
|
||||
|
||||
if(isset($beanList[$module]) && isset($this->bean->$id)){
|
||||
if(!isset($this->bean->$name)){
|
||||
$mod_field = $this->ext1;
|
||||
global $beanFiles;
|
||||
|
||||
$class = $beanList[$module];
|
||||
|
||||
require_once($beanFiles[$class]);
|
||||
$mod = new $class();
|
||||
$mod->retrieve($this->bean->$id);
|
||||
if(isset($mod->$mod_field)){
|
||||
$this->bean->$name = $mod->$mod_field;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$returnXTPL[strtoupper($id)] = $this->bean->$id;
|
||||
}
|
||||
if(isset($this->bean->$name)){
|
||||
$returnXTPL[strtoupper($name)] = $this->bean->$name;
|
||||
}
|
||||
if(isset($this->bean->$id)) {
|
||||
$returnXTPL[strtoupper($id)] = $this->bean->$id;
|
||||
}
|
||||
|
||||
|
||||
return $returnXTPL;
|
||||
}
|
||||
|
||||
function get_xtpl_detail(){
|
||||
return $this->get_xtpl_edit();
|
||||
}
|
||||
|
||||
function get_related_info(){
|
||||
|
||||
}
|
||||
|
||||
function get_field_def(){
|
||||
$def = parent::get_field_def();
|
||||
$def['id_name'] = $this->ext3;
|
||||
$def['ext2'] = $this->ext2;
|
||||
$def['module'] = $def['ext2'];
|
||||
//Special case for documents, which use a document_name rather than name
|
||||
if ($def['module'] == "Documents") {
|
||||
$def['rname'] = 'document_name';
|
||||
} else {
|
||||
$def['rname'] = 'name';
|
||||
}
|
||||
$def['quicksearch'] = 'enabled';
|
||||
$def['studio'] = 'visible';
|
||||
$def['source'] = 'non-db';
|
||||
return $def;
|
||||
}
|
||||
|
||||
function delete($df){
|
||||
parent::delete($df);
|
||||
|
||||
$id = new TemplateId();
|
||||
$id->name = $this->ext3;
|
||||
$id->delete($df);
|
||||
}
|
||||
|
||||
function save($df){
|
||||
// create the new ID field associated with this relate field - this will hold the id of the related record
|
||||
// this field must have a unique name as the name is used when constructing quicksearches and when saving the field
|
||||
//Check if we have not saved this field so we don't create two ID fields.
|
||||
//Users should not be able to switch the module after having saved it once.
|
||||
if (!$df->fieldExists($this->name)) {
|
||||
$id = new TemplateId();
|
||||
$id->len = 36;
|
||||
$id->label = 'LBL_LIST_RELATED_TO';
|
||||
$count = 0;
|
||||
$basename = strtolower(get_singular_bean_name($this->ext2)).'_id' ;
|
||||
$idName = $basename.'_c' ;
|
||||
|
||||
while ( $df->fieldExists($idName, 'id') )
|
||||
{
|
||||
$idName = $basename.++$count.'_c' ;
|
||||
}
|
||||
$id->name = $idName ;
|
||||
$id->save($df);
|
||||
|
||||
// record the id field's name, and save
|
||||
$this->ext3 = $id->name;
|
||||
}
|
||||
|
||||
parent::save($df);
|
||||
}
|
||||
|
||||
function get_db_add_alter_table($table){
|
||||
return "";
|
||||
}
|
||||
|
||||
function get_db_delete_alter_table($table) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function get_db_modify_alter_table($table){
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
79
modules/DynamicFields/templates/Fields/TemplateText.php
Executable file
79
modules/DynamicFields/templates/Fields/TemplateText.php
Executable file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateField.php');
|
||||
class TemplateText extends TemplateField{
|
||||
var $type='varchar';
|
||||
|
||||
function get_xtpl_edit(){
|
||||
$name = $this->name;
|
||||
$returnXTPL = array();
|
||||
|
||||
if(!empty($this->help)){
|
||||
$returnXTPL[strtoupper($this->name . '_help')] = translate($this->help, $this->bean->module_dir);
|
||||
}
|
||||
|
||||
if(isset($this->bean->$name)){
|
||||
$returnXTPL[$this->name] = $this->bean->$name;
|
||||
}else{
|
||||
if(empty($this->bean->id)){
|
||||
$returnXTPL[$this->name] = $this->default_value;
|
||||
}
|
||||
}
|
||||
return $returnXTPL;
|
||||
}
|
||||
function get_xtpl_search(){
|
||||
if(!empty($_REQUEST[$this->name])){
|
||||
return $_REQUEST[$this->name];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function get_xtpl_detail(){
|
||||
$name = $this->name;
|
||||
if(isset($this->bean->$name)){
|
||||
return $this->bean->$name;
|
||||
}
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
104
modules/DynamicFields/templates/Fields/TemplateTextArea.php
Executable file
104
modules/DynamicFields/templates/Fields/TemplateTextArea.php
Executable file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('modules/DynamicFields/templates/Fields/TemplateText.php');
|
||||
class TemplateTextArea extends TemplateText{
|
||||
var $type = 'text';
|
||||
var $len = '';
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->vardef_map['rows'] = 'ext2';
|
||||
$this->vardef_map['cols'] = 'ext3';
|
||||
}
|
||||
|
||||
function get_db_type(){
|
||||
if ($GLOBALS['db']->dbType=='oci8') {
|
||||
return " CLOB ";
|
||||
} else if(!empty($GLOBALS['db']->isFreeTDS)) {
|
||||
return " NTEXT ";
|
||||
} else {
|
||||
return " TEXT ";
|
||||
}
|
||||
}
|
||||
|
||||
function set($values){
|
||||
parent::set($values);
|
||||
if(!empty($this->ext2)){
|
||||
$this->rows = $this->ext2;
|
||||
}
|
||||
if(!empty($this->ext3)){
|
||||
$this->cols = $this->ext3;
|
||||
}
|
||||
if(!empty($this->ext4)){
|
||||
$this->default_value = $this->ext4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function get_xtpl_detail(){
|
||||
$name = $this->name;
|
||||
return nl2br($this->bean->$name);
|
||||
}
|
||||
|
||||
function get_field_def(){
|
||||
$def = parent::get_field_def();
|
||||
$def['studio'] = 'visible';
|
||||
|
||||
if ( isset ( $this->ext2 ) && isset ($this->ext3))
|
||||
{
|
||||
$def[ 'rows' ] = $this->ext2 ;
|
||||
$def[ 'cols' ] = $this->ext3 ;
|
||||
}
|
||||
if (isset( $this->rows ) && isset ($this->cols))
|
||||
{
|
||||
$def[ 'rows' ] = $this->rows ;
|
||||
$def[ 'cols' ] = $this->cols ;
|
||||
}
|
||||
return $def;
|
||||
}
|
||||
|
||||
function get_db_default(){
|
||||
// TEXT columns in MySQL cannot have a DEFAULT value - let the Bean handle it on save
|
||||
return null; // Bug 16612 - null so that the get_db_default() routine in TemplateField doesn't try to set DEFAULT
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
71
modules/DynamicFields/templates/Fields/TemplateURL.php
Executable file
71
modules/DynamicFields/templates/Fields/TemplateURL.php
Executable file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
class TemplateURL extends TemplateText{
|
||||
|
||||
var $type='url';
|
||||
function get_html_edit(){
|
||||
$this->prepare();
|
||||
return "<input type='text' name='". $this->name. "' id='".$this->name."' size='".$this->size."' title='{" . strtoupper($this->name) ."_HELP}' value='{". strtoupper($this->name). "}'>";
|
||||
}
|
||||
|
||||
function get_html_detail(){
|
||||
$xtpl_var = strtoupper($this->name);
|
||||
return "<a href='{" . $xtpl_var . "}' target='_blank'>{" . $xtpl_var . "}</a>";
|
||||
}
|
||||
|
||||
function get_xtpl_detail(){
|
||||
$value = parent::get_xtpl_detail();
|
||||
if(!empty($value) && substr_count($value, '://') == 0 && substr($value ,0,8) != 'index.php'){
|
||||
$value = 'http://' . $value;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
function get_field_def(){
|
||||
$def = parent::get_field_def();
|
||||
//$def['options'] = !empty($this->options) ? $this->options : $this->ext1;
|
||||
$def['default'] = !empty($this->default) ? $this->default : $this->default_value;
|
||||
$def['len'] = $this->len;
|
||||
$def['dbType'] = 'varchar';
|
||||
$def['gen'] = !empty($this->gen) ? $this->gen : $this->ext3;
|
||||
$def['link_target'] = !empty($this->link_target) ? $this->link_target : $this->ext4;
|
||||
return $def;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
48
modules/DynamicFields/templates/Files/DetailView.php
Executable file
48
modules/DynamicFields/templates/Files/DetailView.php
Executable file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
// adding custom fields:
|
||||
|
||||
if(isset($focus->custom_fields)){
|
||||
/*
|
||||
$test is set to focus to increment the reference count
|
||||
since it appears that the reference count was off by 1
|
||||
*/
|
||||
$test =& $focus;
|
||||
$focus->custom_fields->bean =& $focus;
|
||||
$focus->custom_fields->populateXTPL($xtpl, 'detail');
|
||||
}
|
||||
?>
|
||||
48
modules/DynamicFields/templates/Files/EditView.php
Executable file
48
modules/DynamicFields/templates/Files/EditView.php
Executable file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
// adding custom fields:
|
||||
if(isset($focus->custom_fields)){
|
||||
/*
|
||||
$test is set to focus to increment the reference count
|
||||
since it appears that the reference count was off by 1
|
||||
*/
|
||||
$test =& $focus;
|
||||
$focus->custom_fields->bean =& $focus;
|
||||
$focus->custom_fields->populateXTPL($xtpl, 'edit');
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user