init
This commit is contained in:
53
include/SugarFields/Fields/Address/DetailView.tpl
Executable file
53
include/SugarFields/Fields/Address/DetailView.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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<table border='0' cellpadding='0' cellspacing='0' width='100%'>
|
||||
<tr>
|
||||
<td width='99%' >
|
||||
{$fields.{{$displayParams.key}}_address_street.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}<br>
|
||||
{$fields.{{$displayParams.key}}_address_city.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br} {$fields.{{$displayParams.key}}_address_state.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br} {$fields.{{$displayParams.key}}_address_postalcode.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}<br>
|
||||
{$fields.{{$displayParams.key}}_address_country.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}
|
||||
</td>
|
||||
<td class='dataField' width='1%'>
|
||||
{{*
|
||||
This is custom code that you may set to show on the second column of the address
|
||||
table. An example would be the "Copy" button present from the Accounts detailview.
|
||||
See modules/Accounts/views/view.detail.php to see the value being set
|
||||
*}}
|
||||
{$custom_code_{{$displayParams.key}}}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
137
include/SugarFields/Fields/Address/EditView.tpl
Executable file
137
include/SugarFields/Fields/Address/EditView.tpl
Executable file
@@ -0,0 +1,137 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 type="text/javascript" src='{sugar_getjspath file="include/SugarFields/Fields/Address/SugarFieldAddress.js"}'></script>
|
||||
{{assign var="key" value=$displayParams.key|upper}}
|
||||
{{assign var="street" value=$displayParams.key|cat:'_address_street'}}
|
||||
{{assign var="city" value=$displayParams.key|cat:'_address_city'}}
|
||||
{{assign var="state" value=$displayParams.key|cat:'_address_state'}}
|
||||
{{assign var="country" value=$displayParams.key|cat:'_address_country'}}
|
||||
{{assign var="postalcode" value=$displayParams.key|cat:'_address_postalcode'}}
|
||||
<fieldset id='{{$key}}_address_fieldset'>
|
||||
<legend>{sugar_translate label='LBL_{{$key}}_ADDRESS' module='{{$module}}'}</legend>
|
||||
<table border="0" cellspacing="1" cellpadding="0" class="edit" width="100%">
|
||||
<tr>
|
||||
<td valign="top" id="{{$street}}_label" width='25%' scope='row' >
|
||||
{sugar_translate label='LBL_STREET' module='{{$module}}'}:
|
||||
{if $fields.{{$street}}.required || {{if $street|lower|in_array:$displayParams.required}}true{{else}}false{{/if}}}
|
||||
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td width="*">
|
||||
{{if $displayParams.maxlength}}
|
||||
<textarea id="{{$street}}" name="{{$street}}" maxlength="{{$displayParams.maxlength}}" rows="{{$displayParams.rows|default:4}}" cols="{{$displayParams.cols|default:60}}" tabindex="{{$tabindex}}">{$fields.{{$street}}.value}</textarea>
|
||||
{{else}}
|
||||
<textarea id="{{$street}}" name="{{$street}}" rows="{{$displayParams.rows|default:4}}" cols="{{$displayParams.cols|default:60}}" tabindex="{{$tabindex}}">{$fields.{{$street}}.value}</textarea>
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td id="{{$city}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope='row' >
|
||||
{sugar_translate label='LBL_CITY' module='{{$module}}'}:
|
||||
{if $fields.{{$city}}.required || {{if $city|lower|in_array:$displayParams.required}}true{{else}}false{{/if}}}
|
||||
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="{{$city}}" id="{{$city}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$city}}.value}' tabindex="{{$tabindex}}">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td id="{{$state}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope='row' >
|
||||
{sugar_translate label='LBL_STATE' module='{{$module}}'}:
|
||||
{if $fields.{{$state}}.required || {{if $state|lower|in_array:$displayParams.required}}true{{else}}false{{/if}}}
|
||||
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="{{$state}}" id="{{$state}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$state}}.value}' tabindex="{{$tabindex}}">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td id="{{$postalcode}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope='row' >
|
||||
|
||||
{sugar_translate label='LBL_POSTAL_CODE' module='{{$module}}'}:
|
||||
{if $fields.{{$postalcode}}.required || {{if $postalcode|lower|in_array:$displayParams.required}}true{{else}}false{{/if}}}
|
||||
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="{{$postalcode}}" id="{{$postalcode}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$postalcode}}.value}' tabindex="{{$tabindex}}">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td id="{{$country}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope='row' >
|
||||
|
||||
{sugar_translate label='LBL_COUNTRY' module='{{$module}}'}:
|
||||
{if $fields.{{$country}}.required || {{if $country|lower|in_array:$displayParams.required}}true{{else}}false{{/if}}}
|
||||
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="{{$country}}" id="{{$country}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$country}}.value}' tabindex="{{$tabindex}}">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{{if $displayParams.copy}}
|
||||
<tr>
|
||||
<td scope='row' NOWRAP>
|
||||
{sugar_translate label='LBL_COPY_ADDRESS_FROM_LEFT' module=''}:
|
||||
</td>
|
||||
<td>
|
||||
<input id="{{$displayParams.key}}_checkbox" name="{{$displayParams.key}}_checkbox" type="checkbox" onclick="syncFields('{{$displayParams.copy}}', '{{$displayParams.key}}');"; CHECKED>
|
||||
</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
<tr>
|
||||
<td colspan='2' NOWRAP> </td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
</table>
|
||||
</fieldset>
|
||||
<script type="text/javascript">
|
||||
var fromKey = '{{$displayParams.copy}}';
|
||||
var toKey = '{{$displayParams.key}}';
|
||||
var checkbox = toKey + "_checkbox";
|
||||
var obj = new TestCheckboxReady(checkbox);
|
||||
</script>
|
||||
41
include/SugarFields/Fields/Address/SugarFieldAddress.js
Normal file
41
include/SugarFields/Fields/Address/SugarFieldAddress.js
Normal file
@@ -0,0 +1,41 @@
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
var elems=new Array("address_street","address_city","address_state","address_postalcode","address_country");var tHasText=false;var originalBgColor='#FFFFFF';var Dom=YAHOO.util.Dom;function TestCheckboxReady(id){YAHOO.util.Event.onAvailable(id,this.handleOnAvailable,this);}
|
||||
TestCheckboxReady.prototype.handleOnAvailable=function(me){for(x in elems){f=fromKey+"_"+elems[x];t=toKey+"_"+elems[x];e1=document.getElementById(t);e2=document.getElementById(f);if(e1!=null&&typeof e1!="undefined"&&e2!=null&&typeof e2!="undefined"){if(!tHasText&&trim(e1.value)!=""){tHasText=true;}
|
||||
if(e1.value!=e2.value){document.getElementById(this.id).checked=false;break;}
|
||||
originalBgColor=e1.style.backgroundColor;}}
|
||||
if(!tHasText){document.getElementById(this.id).checked=false;}else{syncFields(fromKey,toKey);}}
|
||||
function writeToSyncField(e){fromEl=YAHOO.util.Event.getTarget(e,true);if(typeof fromEl!="undefined"){toEl=document.getElementById(fromEl.id.replace(fromKey,toKey));toEl.value=fromEl.value;}}
|
||||
function syncFields(fromKey,toKey){for(x in elems){f=fromKey+"_"+elems[x];e2=document.getElementById(f);t=toKey+"_"+elems[x];e1=document.getElementById(t);if(e1!=null&&typeof e1!="undefined"&&e2!=null&&typeof e2!="undefined"){if(!document.getElementById(toKey+'_checkbox').checked){Dom.setStyle(e1,'backgroundColor',originalBgColor);e1.removeAttribute('readOnly');YAHOO.util.Event.removeListener(e2,'keyup');}else{e1.value=e2.value;Dom.setStyle(e1,'backgroundColor','#DCDCDC');e1.setAttribute('readOnly',true);YAHOO.util.Event.addListener(e2,'keyup',writeToSyncField);}}}}
|
||||
115
include/SugarFields/Fields/Address/SugarFieldAddress.php
Executable file
115
include/SugarFields/Fields/Address/SugarFieldAddress.php
Executable file
@@ -0,0 +1,115 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* SugarFieldAddress.php
|
||||
* SugarFieldAddress translates and displays fields from a vardef definition into different formats
|
||||
* for EditViews and DetailViews. A sample invocation from a Meta-Data file is as follows:
|
||||
*
|
||||
* array (
|
||||
* 'name' => 'primary_address_street',
|
||||
* 'type' => 'address',
|
||||
* 'displayParams'=>array('key'=>'primary'),
|
||||
* ),
|
||||
*
|
||||
* Where name is set to the field for ACL verification, type is set to 'address'
|
||||
* to override the default field type and the displayParams array includes the key
|
||||
* for the address field. Assumptions are made that the vardefs.php contains address
|
||||
* elements with the corresponding names. There is the optional displayParam index
|
||||
* 'copy' that accepts as value the key of the other address fields. In our
|
||||
* example we may enable copying from the primary address fields with:
|
||||
*
|
||||
* array (
|
||||
* 'name' => 'altaddress_street',
|
||||
* 'type' => 'address',
|
||||
* 'displayParams'=>array('key'=>'alt', 'copy'=>'primary'),
|
||||
* ),
|
||||
*
|
||||
*/
|
||||
require_once('include/SugarFields/Fields/Base/SugarFieldBase.php');
|
||||
class SugarFieldAddress extends SugarFieldBase {
|
||||
|
||||
function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
global $app_strings;
|
||||
if(!isset($displayParams['key'])) {
|
||||
$GLOBALS['log']->debug($app_strings['ERR_ADDRESS_KEY_NOT_SPECIFIED']);
|
||||
$this->ss->trigger_error($app_strings['ERR_ADDRESS_KEY_NOT_SPECIFIED']);
|
||||
return;
|
||||
}
|
||||
|
||||
//Allow for overrides. You can specify a Smarty template file location in the language file.
|
||||
if(isset($app_strings['SMARTY_ADDRESS_DETAILVIEW'])) {
|
||||
$tplCode = $app_strings['SMARTY_ADDRESS_DETAILVIEW'];
|
||||
return $this->fetch($tplCode);
|
||||
}
|
||||
|
||||
global $current_language;
|
||||
if(isset($current_language) && file_exists('include/SugarFields/Fields/Address/' . $current_language . '.DetailView.tpl')) {
|
||||
return $this->fetch('include/SugarFields/Fields/Address/' . $current_language . '.DetailView.tpl');
|
||||
} else {
|
||||
return $this->fetch('include/SugarFields/Fields/Address/DetailView.tpl');
|
||||
} //if-else
|
||||
}
|
||||
|
||||
function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
global $app_strings;
|
||||
if(!isset($displayParams['key'])) {
|
||||
$GLOBALS['log']->debug($app_strings['ERR_ADDRESS_KEY_NOT_SPECIFIED']);
|
||||
$this->ss->trigger_error($app_strings['ERR_ADDRESS_KEY_NOT_SPECIFIED']);
|
||||
return;
|
||||
}
|
||||
|
||||
//Allow for overrides. You can specify a Smarty template file location in the language file.
|
||||
if(isset($app_strings['SMARTY_ADDRESS_EDITVIEW'])) {
|
||||
$tplCode = $app_strings['SMARTY_ADDRESS_EDITVIEW'];
|
||||
return $this->fetch($tplCode);
|
||||
}
|
||||
|
||||
global $current_language;
|
||||
if(isset($current_language) && file_exists('include/SugarFields/Fields/Address/' . $current_language . '.EditView.tpl')) {
|
||||
return $this->fetch('include/SugarFields/Fields/Address/' . $current_language . '.EditView.tpl');
|
||||
} else {
|
||||
return $this->fetch('include/SugarFields/Fields/Address/EditView.tpl');
|
||||
} //if-else
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
58
include/SugarFields/Fields/Address/en_us.DetailView.tpl
Executable file
58
include/SugarFields/Fields/Address/en_us.DetailView.tpl
Executable file
@@ -0,0 +1,58 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 border='0' cellpadding='0' cellspacing='0' width='100%'>
|
||||
<tr>
|
||||
<td width='99%' >
|
||||
{$fields.{{$displayParams.key}}_address_street.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}<br>
|
||||
{$fields.{{$displayParams.key}}_address_city.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br} {$fields.{{$displayParams.key}}_address_state.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br} {$fields.{{$displayParams.key}}_address_postalcode.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}<br>
|
||||
{$fields.{{$displayParams.key}}_address_country.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}
|
||||
</td>
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
<td class="dataField">
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
</td>
|
||||
{{/if}}
|
||||
<td class='dataField' width='1%'>
|
||||
{{*
|
||||
This is custom code that you may set to show on the second column of the address
|
||||
table. An example would be the "Copy" button present from the Accounts detailview.
|
||||
See modules/Accounts/views/view.detail.php to see the value being set
|
||||
*}}
|
||||
{$custom_code_{{$displayParams.key}}}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
137
include/SugarFields/Fields/Address/en_us.EditView.tpl
Executable file
137
include/SugarFields/Fields/Address/en_us.EditView.tpl
Executable file
@@ -0,0 +1,137 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 type="text/javascript" src='{sugar_getjspath file="include/SugarFields/Fields/Address/SugarFieldAddress.js"}'></script>
|
||||
{{assign var="key" value=$displayParams.key|upper}}
|
||||
{{assign var="street" value=$displayParams.key|cat:'_address_street'}}
|
||||
{{assign var="city" value=$displayParams.key|cat:'_address_city'}}
|
||||
{{assign var="state" value=$displayParams.key|cat:'_address_state'}}
|
||||
{{assign var="country" value=$displayParams.key|cat:'_address_country'}}
|
||||
{{assign var="postalcode" value=$displayParams.key|cat:'_address_postalcode'}}
|
||||
<fieldset id='{{$key}}_address_fieldset'>
|
||||
<legend>{sugar_translate label='LBL_{{$key}}_ADDRESS' module='{{$module}}'}</legend>
|
||||
<table border="0" cellspacing="1" cellpadding="0" class="edit" width="100%">
|
||||
<tr>
|
||||
<td valign="top" id="{{$street}}_label" width='25%' scope='row' >
|
||||
{sugar_translate label='LBL_STREET' module='{{$module}}'}:
|
||||
{if $fields.{{$street}}.required || {{if $street|lower|in_array:$displayParams.required}}true{{else}}false{{/if}}}
|
||||
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td width="*">
|
||||
{{if $displayParams.maxlength}}
|
||||
<textarea id="{{$street}}" name="{{$street}}" maxlength="{{$displayParams.maxlength}}" rows="{{$displayParams.rows|default:4}}" cols="{{$displayParams.cols|default:60}}" tabindex="{{$tabindex}}">{$fields.{{$street}}.value}</textarea>
|
||||
{{else}}
|
||||
<textarea id="{{$street}}" name="{{$street}}" rows="{{$displayParams.rows|default:4}}" cols="{{$displayParams.cols|default:60}}" tabindex="{{$tabindex}}">{$fields.{{$street}}.value}</textarea>
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td id="{{$city}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope='row' >
|
||||
{sugar_translate label='LBL_CITY' module='{{$module}}'}:
|
||||
{if $fields.{{$city}}.required || {{if $city|lower|in_array:$displayParams.required}}true{{else}}false{{/if}}}
|
||||
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="{{$city}}" id="{{$city}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$city}}.value}' tabindex="{{$tabindex}}">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td id="{{$state}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope='row' >
|
||||
{sugar_translate label='LBL_STATE' module='{{$module}}'}:
|
||||
{if $fields.{{$state}}.required || {{if $state|lower|in_array:$displayParams.required}}true{{else}}false{{/if}}}
|
||||
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="{{$state}}" id="{{$state}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$state}}.value}' tabindex="{{$tabindex}}">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td id="{{$postalcode}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope='row' >
|
||||
|
||||
{sugar_translate label='LBL_POSTAL_CODE' module='{{$module}}'}:
|
||||
{if $fields.{{$postalcode}}.required || {{if $postalcode|lower|in_array:$displayParams.required}}true{{else}}false{{/if}}}
|
||||
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="{{$postalcode}}" id="{{$postalcode}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$postalcode}}.value}' tabindex="{{$tabindex}}">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td id="{{$country}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope='row' >
|
||||
|
||||
{sugar_translate label='LBL_COUNTRY' module='{{$module}}'}:
|
||||
{if $fields.{{$country}}.required || {{if $country|lower|in_array:$displayParams.required}}true{{else}}false{{/if}}}
|
||||
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="{{$country}}" id="{{$country}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$country}}.value}' tabindex="{{$tabindex}}">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{{if $displayParams.copy}}
|
||||
<tr>
|
||||
<td scope='row' NOWRAP>
|
||||
{sugar_translate label='LBL_COPY_ADDRESS_FROM_LEFT' module=''}:
|
||||
</td>
|
||||
<td>
|
||||
<input id="{{$displayParams.key}}_checkbox" name="{{$displayParams.key}}_checkbox" type="checkbox" onclick="syncFields('{{$displayParams.copy}}', '{{$displayParams.key}}');"; CHECKED>
|
||||
</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
<tr>
|
||||
<td colspan='2' NOWRAP> </td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
</table>
|
||||
</fieldset>
|
||||
<script type="text/javascript">
|
||||
var fromKey = '{{$displayParams.copy}}';
|
||||
var toKey = '{{$displayParams.key}}';
|
||||
var checkbox = toKey + "_checkbox";
|
||||
var obj = new TestCheckboxReady(checkbox);
|
||||
</script>
|
||||
40
include/SugarFields/Fields/Base/DetailView.tpl
Executable file
40
include/SugarFields/Fields/Base/DetailView.tpl
Executable file
@@ -0,0 +1,40 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<span id='{{sugarvar key='name'}}'>{{sugarvar key='value'}}</span>
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
40
include/SugarFields/Fields/Base/DetailViewFunction.tpl
Executable file
40
include/SugarFields/Fields/Base/DetailViewFunction.tpl
Executable file
@@ -0,0 +1,40 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{{sugarvar key='value'}}
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
45
include/SugarFields/Fields/Base/EditView.tpl
Executable file
45
include/SugarFields/Fields/Base/EditView.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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{if strlen({{sugarvar key='value' string=true}}) <= 0}
|
||||
{assign var="value" value={{sugarvar key='default_value' string=true}} }
|
||||
{else}
|
||||
{assign var="value" value={{sugarvar key='value' string=true}} }
|
||||
{/if}
|
||||
<input type='text' name='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}'
|
||||
id='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}' size='{{$displayParams.size|default:30}}'
|
||||
{{if isset($displayParams.maxlength)}}maxlength='{{$displayParams.maxlength}}'{{elseif isset($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}}
|
||||
value='{$value}' title='{{$vardef.help}}' tabindex='{{$tabindex}}' {{$displayParams.field}}>
|
||||
37
include/SugarFields/Fields/Base/EditViewFunction.tpl
Executable file
37
include/SugarFields/Fields/Base/EditViewFunction.tpl
Executable file
@@ -0,0 +1,37 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{{sugarvar key='value'}}
|
||||
38
include/SugarFields/Fields/Base/InlineEdit.tpl
Executable file
38
include/SugarFields/Fields/Base/InlineEdit.tpl
Executable file
@@ -0,0 +1,38 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{{assign var=fieldName value=$vardef.name}}
|
||||
<input type='text' name='{{$fieldName}}' value='{{$parentFieldArray->$fieldName}}' onblur='InlineEditor.save()' size='40'>
|
||||
38
include/SugarFields/Fields/Base/InlineEditView.tpl
Executable file
38
include/SugarFields/Fields/Base/InlineEditView.tpl
Executable file
@@ -0,0 +1,38 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{{assign var=fieldName value=$vardef.name}}
|
||||
{{$parentFieldArray->$fieldName}}
|
||||
38
include/SugarFields/Fields/Base/ListView.tpl
Executable file
38
include/SugarFields/Fields/Base/ListView.tpl
Executable file
@@ -0,0 +1,38 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
|
||||
{sugar_fetch object=$parentFieldArray key=$col}
|
||||
37
include/SugarFields/Fields/Base/SearchForm.tpl
Executable file
37
include/SugarFields/Fields/Base/SearchForm.tpl
Executable file
@@ -0,0 +1,37 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<input type='text' name='{sugarvar objectName=$parentFieldArray memberName=$vardef.name key='name'}' size='50' value='{sugarvar objectName=$parentFieldArray memberName=$vardef.name key='value'}'>
|
||||
342
include/SugarFields/Fields/Base/SugarFieldBase.php
Executable file
342
include/SugarFields/Fields/Base/SugarFieldBase.php
Executable file
@@ -0,0 +1,342 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
/**
|
||||
* SugarFieldBase translates and displays fields from a vardef definition into different formats
|
||||
* including DetailView, ListView, EditView. It also provides Search Inputs and database queries
|
||||
* to handle searching
|
||||
*
|
||||
*/
|
||||
class SugarFieldBase {
|
||||
var $ss; // Sugar Smarty Object
|
||||
var $hasButton = false;
|
||||
function SugarFieldBase($type) {
|
||||
$this->type = $type;
|
||||
$this->ss = new Sugar_Smarty();
|
||||
}
|
||||
function fetch($path){
|
||||
$additional = '';
|
||||
if(!$this->hasButton && !empty($this->button)){
|
||||
$additional .= '<input type="button" class="button" ' . $this->button . '>';
|
||||
}
|
||||
if(!empty($this->buttons)){
|
||||
foreach($this->buttons as $v){
|
||||
$additional .= ' <input type="button" class="button" ' . $v . '>';
|
||||
}
|
||||
|
||||
}
|
||||
if(!empty($this->image)){
|
||||
$additional .= ' <img ' . $this->image . '>';
|
||||
}
|
||||
return $this->ss->fetch($path) . $additional;
|
||||
}
|
||||
|
||||
function findTemplate($view){
|
||||
static $tplCache = array();
|
||||
|
||||
if ( isset($tplCache[$this->type][$view]) ) {
|
||||
return $tplCache[$this->type][$view];
|
||||
}
|
||||
|
||||
$lastClass = get_class($this);
|
||||
$classList = array($this->type,str_replace('SugarField','',$lastClass));
|
||||
while ( $lastClass = get_parent_class($lastClass) ) {
|
||||
$classList[] = str_replace('SugarField','',$lastClass);
|
||||
}
|
||||
|
||||
$tplName = '';
|
||||
foreach ( $classList as $className ) {
|
||||
$tplName = 'include/SugarFields/Fields/'. $className .'/'. $view .'.tpl';
|
||||
if ( file_exists('custom/'.$tplName) ) {
|
||||
$tplName = 'custom/'.$tplName;
|
||||
break;
|
||||
}
|
||||
if ( file_exists($tplName) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$tplCache[$this->type][$view] = $tplName;
|
||||
|
||||
return $tplName;
|
||||
}
|
||||
|
||||
public function formatField($rawField, $vardef){
|
||||
// The base field doesn't do any formatting, so override it in subclasses for more specific actions
|
||||
return $rawField;
|
||||
}
|
||||
|
||||
|
||||
public function unformatField($formattedField, $vardef){
|
||||
// The base field doesn't do any formatting, so override it in subclasses for more specific actions
|
||||
return $formattedField;
|
||||
}
|
||||
|
||||
function getSmartyView($parentFieldArray, $vardef, $displayParams, $tabindex = -1, $view){
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
|
||||
|
||||
return $this->fetch($this->findTemplate($view));
|
||||
}
|
||||
|
||||
function getListViewSmarty($parentFieldArray, $vardef, $displayParams, $col) {
|
||||
// FIXME: Rework the listview to use two-pass rendering like the DetailView
|
||||
|
||||
$tabindex = 1;
|
||||
$isArray = is_array($parentFieldArray);
|
||||
$fieldName = $vardef['name'];
|
||||
|
||||
if ( $isArray ) {
|
||||
$fieldNameUpper = strtoupper($fieldName);
|
||||
if ( isset($parentFieldArray[$fieldNameUpper])) {
|
||||
$parentFieldArray[$fieldName] = $this->formatField($parentFieldArray[$fieldNameUpper],$vardef);
|
||||
} else {
|
||||
$parentFieldArray[$fieldName] = '';
|
||||
}
|
||||
} else {
|
||||
if ( isset($parentFieldArray->$fieldName) ) {
|
||||
$parentFieldArray->$fieldName = $this->formatField($parentFieldArray->$fieldName,$vardef);
|
||||
} else {
|
||||
$parentFieldArray->$fieldName = '';
|
||||
}
|
||||
}
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex, false);
|
||||
|
||||
$this->ss->left_delimiter = '{';
|
||||
$this->ss->right_delimiter = '}';
|
||||
$this->ss->assign('col',$vardef['name']);
|
||||
|
||||
return $this->fetch($this->findTemplate('ListView'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a smarty template for the DetailViews
|
||||
*
|
||||
* @param parentFieldArray string name of the variable in the parent template for the bean's data
|
||||
* @param vardef vardef field defintion
|
||||
* @param displayParam parameters for display
|
||||
* available paramters are:
|
||||
* * labelSpan - column span for the label
|
||||
* * fieldSpan - column span for the field
|
||||
*/
|
||||
function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
return"<span id='{$vardef['name']}'>" . $this->getSmartyView($parentFieldArray, $vardef, $displayParams, $tabindex, 'DetailView') . '</span>';
|
||||
}
|
||||
|
||||
// 99% of all fields will just format like a listview, but just in case, it's here to override
|
||||
function getChangeLogSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
return $this->formatField($parentFieldArray[$vardef['name']],$vardef);
|
||||
}
|
||||
|
||||
|
||||
function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
if(!empty($vardef['function']['returns']) && $vardef['function']['returns'] == 'html'){
|
||||
$type = $this->type;
|
||||
$this->type = 'Base';
|
||||
$result= $this->getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
$this->type = $type;
|
||||
return $result;
|
||||
}
|
||||
return $this->getSmartyView($parentFieldArray, $vardef, $displayParams, $tabindex, 'EditView');
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
if(!empty($vardef['auto_increment']))$vardef['len']=255;
|
||||
return $this->getSmartyView($parentFieldArray, $vardef, $displayParams, $tabindex, 'EditView');
|
||||
}
|
||||
|
||||
function getPopupViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex){
|
||||
if (is_array($displayParams) && !isset($displayParams['formName']))
|
||||
$displayParams['formName'] = 'popup_query_form';
|
||||
else if (empty($displayParams))
|
||||
$displayParams = array('formName' => 'popup_query_form');
|
||||
return $this->getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
}
|
||||
|
||||
public function getEmailTemplateValue($inputField, $vardef, $displayParams = array(), $tabindex = 0){
|
||||
// This does not return a smarty section, instead it returns a direct value
|
||||
return $this->formatField($inputField,$vardef);
|
||||
}
|
||||
|
||||
function displayFromFunc( $displayType, $parentFieldArray, $vardef, $displayParams, $tabindex ) {
|
||||
|
||||
if ( ! is_array($vardef['function']) ) {
|
||||
$funcName = $vardef['function'];
|
||||
$includeFile = '';
|
||||
$onListView = false;
|
||||
$returnsHtml = false;
|
||||
} else {
|
||||
$funcName = $vardef['function']['name'];
|
||||
$includeFile = '';
|
||||
if ( isset($vardef['function']['include']) ) {
|
||||
$includeFile = $vardef['function']['include'];
|
||||
}
|
||||
if ( isset($vardef['function']['onListView']) && $vardef['function']['onListView'] == true ) {
|
||||
$onListView = true;
|
||||
} else {
|
||||
$onListView = false;
|
||||
}
|
||||
if ( isset($vardef['function']['returns']) && $vardef['function']['returns'] == 'html' ) {
|
||||
$returnsHtml = true;
|
||||
} else {
|
||||
$returnsHtml = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $displayType == 'ListView'
|
||||
|| $displayType == 'popupView'
|
||||
|| $displayType == 'searchView'
|
||||
|| $displayType == 'wirelessEditView'
|
||||
|| $displayType == 'wirelessDetailView'
|
||||
|| $displayType == 'wirelessListView'
|
||||
) {
|
||||
// Traditionally, before 6.0, additional functions were never called, so this code doesn't get called unless the vardef forces it
|
||||
if ( $onListView ) {
|
||||
if ( !empty($includeFile) ) {
|
||||
require_once($includeFile);
|
||||
}
|
||||
|
||||
return $funcName($parentFieldArray, $vardef['name'], $parentFieldArray[$vardef['name']], $displayType);
|
||||
} else {
|
||||
$displayTypeFunc = 'get'.$displayType.'Smarty';
|
||||
return $this->$displayTypeFunc($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
}
|
||||
} else {
|
||||
if ( !empty($displayParams['idName']) ) {
|
||||
$fieldName = $displayParams['idName'];
|
||||
} else {
|
||||
$fieldName = $vardef['name'];
|
||||
}
|
||||
if ( $returnsHtml ) {
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
$tpl = $this->findTemplate($displayType.'Function');
|
||||
if ( $tpl == '' ) {
|
||||
// Can't find a function template, just use the base
|
||||
$tpl = $this->findTemplate('DetailViewFunction');
|
||||
}
|
||||
return "<span id='{$vardef['name']}'>" . $this->fetch($tpl) . '</span>';
|
||||
} else {
|
||||
return '{sugar_run_helper include="'.$includeFile.'" func="'.$funcName.'" bean=$bean field="'.$fieldName.'" value=$fields.'.$fieldName.'.value displayType="'.$displayType.'"}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getEditView() {
|
||||
}
|
||||
|
||||
function getSearchInput() {
|
||||
}
|
||||
|
||||
function getQueryLike() {
|
||||
}
|
||||
|
||||
function getQueryIn() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup function to assign values to the smarty template, should be called before every display function
|
||||
*/
|
||||
function setup($parentFieldArray, $vardef, $displayParams, $tabindex, $twopass=true) {
|
||||
$this->button = '';
|
||||
$this->buttons = '';
|
||||
$this->image = '';
|
||||
if ($twopass){
|
||||
$this->ss->left_delimiter = '{{';
|
||||
$this->ss->right_delimiter = '}}';
|
||||
}
|
||||
$this->ss->assign('parentFieldArray', $parentFieldArray);
|
||||
$this->ss->assign('vardef', $vardef);
|
||||
$this->ss->assign('tabindex', $tabindex);
|
||||
|
||||
//for adding attributes to the field
|
||||
|
||||
if(!empty($displayParams['field'])){
|
||||
$plusField = '';
|
||||
foreach($displayParams['field'] as $key=>$value){
|
||||
$plusField .= ' ' . $key . '="' . $value . '"';//bug 27381
|
||||
}
|
||||
$displayParams['field'] = $plusField;
|
||||
}
|
||||
//for adding attributes to the button
|
||||
if(!empty($displayParams['button'])){
|
||||
$plusField = '';
|
||||
foreach($displayParams['button'] as $key=>$value){
|
||||
$plusField .= ' ' . $key . '="' . $value . '"';
|
||||
}
|
||||
$displayParams['button'] = $plusField;
|
||||
$this->button = $displayParams['button'];
|
||||
}
|
||||
if(!empty($displayParams['buttons'])){
|
||||
$plusField = '';
|
||||
foreach($displayParams['buttons'] as $keys=>$values){
|
||||
foreach($values as $key=>$value){
|
||||
$plusField[$keys] .= ' ' . $key . '="' . $value . '"';
|
||||
}
|
||||
}
|
||||
$displayParams['buttons'] = $plusField;
|
||||
$this->buttons = $displayParams['buttons'];
|
||||
}
|
||||
if(!empty($displayParams['image'])){
|
||||
$plusField = '';
|
||||
foreach($displayParams['image'] as $key=>$value){
|
||||
$plusField .= ' ' . $key . '="' . $value . '"';
|
||||
}
|
||||
$displayParams['image'] = $plusField;
|
||||
$this->image = $displayParams['image'];
|
||||
}
|
||||
$this->ss->assign('displayParams', $displayParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This should be called when the bean is saved. The bean itself will be passed by reference
|
||||
* @param SugarBean bean - the bean performing the save
|
||||
* @param array params - an array of paramester relevant to the save, most likely will be $_REQUEST
|
||||
*/
|
||||
public function save(&$bean, $params, $field, $properties, $prefix = ''){
|
||||
if ( isset($params[$prefix.$field]) ) {
|
||||
if(isset($properties['len']) && isset($properties['type']) && 'varchar' == $properties['type']){
|
||||
$bean->$field = trim($this->unformatField($params[$prefix.$field],$properties));
|
||||
}
|
||||
else {
|
||||
$bean->$field = $this->unformatField($params[$prefix.$field],$properties);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
45
include/SugarFields/Fields/Bool/DetailView.tpl
Executable file
45
include/SugarFields/Fields/Bool/DetailView.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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{if strval({{sugarvar key='value' stringFormat='false'}}) == "1" || strval({{sugarvar key='value' stringFormat='false'}}) == "yes" || strval({{sugarvar key='value' stringFormat='false'}}) == "on"}
|
||||
{assign var="checked" value="CHECKED"}
|
||||
{else}
|
||||
{assign var="checked" value=""}
|
||||
{/if}
|
||||
<input type="checkbox" class="checkbox" name="{{sugarvar key='name'}}" disabled="true" {$checked}>
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
45
include/SugarFields/Fields/Bool/EditView.tpl
Executable file
45
include/SugarFields/Fields/Bool/EditView.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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{if strval({{sugarvar key='value' stringFormat='false'}}) == "1" || strval({{sugarvar key='value' stringFormat='false'}}) == "yes" || strval({{sugarvar key='value' stringFormat='false'}}) == "on"}
|
||||
{assign var="checked" value="CHECKED"}
|
||||
{else}
|
||||
{assign var="checked" value=""}
|
||||
{/if}
|
||||
<input type="hidden" name="{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}" value="0">
|
||||
<input type="checkbox" id="{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}"
|
||||
name="{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}"
|
||||
value="1" title='{{$vardef.help}}' tabindex="{{$tabindex}}" {$checked} {{$displayParams.field}}>
|
||||
44
include/SugarFields/Fields/Bool/InlineEdit.tpl
Executable file
44
include/SugarFields/Fields/Bool/InlineEdit.tpl
Executable file
@@ -0,0 +1,44 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{{assign var=fieldName value=$vardef.name}}
|
||||
{{if strval($parentFieldArray->$fieldName) == "1"}}
|
||||
{{assign var="checked" value="CHECKED"}}
|
||||
{{else}}
|
||||
{{assign var="checked" value=""}}
|
||||
{{/if}}
|
||||
<input type="hidden" name="{{$fieldName}}" value="0">
|
||||
<input type="checkbox" class="checkbox" name="{{$fieldName}}" {{$checked}} onblur='InlineEditor.save()'>
|
||||
43
include/SugarFields/Fields/Bool/InlineEditView.tpl
Executable file
43
include/SugarFields/Fields/Bool/InlineEditView.tpl
Executable file
@@ -0,0 +1,43 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{{assign var=fieldName value=$vardef.name}}
|
||||
{{if strval($parentFieldArray->$fieldName) == "1"}}
|
||||
{{assign var="checked" value="CHECKED"}}
|
||||
{{else}}
|
||||
{{assign var="checked" value=""}}
|
||||
{{/if}}
|
||||
<input type="checkbox" class="checkbox" disabled="true" {{$checked}}>
|
||||
42
include/SugarFields/Fields/Bool/ListView.tpl
Executable file
42
include/SugarFields/Fields/Bool/ListView.tpl
Executable file
@@ -0,0 +1,42 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 strval($parentFieldArray.$col) == "1" || strval($parentFieldArray.$col) == "yes" || strval($parentFieldArray.$col) == "on"}
|
||||
{assign var="checked" value="CHECKED"}
|
||||
{else}
|
||||
{assign var="checked" value=""}
|
||||
{/if}
|
||||
<input type="checkbox" class="checkbox" disabled="true" {$checked}>
|
||||
54
include/SugarFields/Fields/Bool/SearchView.tpl
Executable file
54
include/SugarFields/Fields/Bool/SearchView.tpl
Executable file
@@ -0,0 +1,54 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{assign var="yes" value=""}
|
||||
{assign var="no" value=""}
|
||||
{assign var="default" value=""}
|
||||
|
||||
{if strval({{sugarvar key='value' stringFormat='false'}}) == "1"}
|
||||
{assign var="yes" value="SELECTED"}
|
||||
{elseif strval({{sugarvar key='value' stringFormat='false'}}) == "0"}
|
||||
{assign var="no" value="SELECTED"}
|
||||
{else}
|
||||
{assign var="default" value="SELECTED"}
|
||||
{/if}
|
||||
|
||||
<select id="{{sugarvar key='name'}}" name="{{sugarvar key='name'}}" tabindex="{{$tabindex}}" {{$displayParams.field}}>
|
||||
<option value="" {$default}></option>
|
||||
<option value = "0" {$no}> {$APP.LBL_SEARCH_DROPDOWN_NO}</option>
|
||||
<option value = "1" {$yes}> {$APP.LBL_SEARCH_DROPDOWN_YES}</option>
|
||||
</select>
|
||||
|
||||
83
include/SugarFields/Fields/Bool/SugarFieldBool.php
Executable file
83
include/SugarFields/Fields/Bool/SugarFieldBool.php
Executable file
@@ -0,0 +1,83 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/SugarFields/Fields/Base/SugarFieldBase.php');
|
||||
|
||||
class SugarFieldBool extends SugarFieldBase {
|
||||
/**
|
||||
*
|
||||
* @return The html for a drop down if the search field is not 'my_items_only' or a dropdown for all other fields.
|
||||
* This strange behavior arises from the special needs of PM. They want the my items to be checkboxes and all other boolean fields to be dropdowns.
|
||||
* @author Navjeet Singh
|
||||
* @param $parentFieldArray -
|
||||
**/
|
||||
function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
if( preg_match("/current_user_only.*/", $vardef['name']) )
|
||||
return $this->fetch('include/SugarFields/Fields/Bool/EditView.tpl');
|
||||
else
|
||||
return $this->fetch('include/SugarFields/Fields/Bool/SearchView.tpl');
|
||||
|
||||
}
|
||||
|
||||
public function getEmailTemplateValue($inputField, $vardef, $displayParams = array(), $tabindex = 0){
|
||||
global $app_list_strings;
|
||||
// This does not return a smarty section, instead it returns a direct value
|
||||
if ( $inputField == 'bool_true' || $inputField == true ) {
|
||||
return $app_list_strings['checkbox_dom']['1'];
|
||||
} else {
|
||||
return $app_list_strings['checkbox_dom']['2'];
|
||||
}
|
||||
}
|
||||
|
||||
public function unformatField($formattedField, $vardef){
|
||||
if ( empty($formattedField) ) {
|
||||
$unformattedField = false;
|
||||
return $unformattedField;
|
||||
}
|
||||
if ( $formattedField == '0' || $formattedField == 'off' || $formattedField == 'false' || $formattedField == 'no' ) {
|
||||
$unformattedField = false;
|
||||
} else {
|
||||
$unformattedField = true;
|
||||
}
|
||||
|
||||
return $unformattedField;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
60
include/SugarFields/Fields/Collection/CollectionDetailView.tpl
Executable file
60
include/SugarFields/Fields/Collection/CollectionDetailView.tpl
Executable file
@@ -0,0 +1,60 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 !$displayParams.nolink}
|
||||
<a href="index.php?module={$module}&action=DetailView&record={$values.primary.id}">
|
||||
{/if}
|
||||
{$values.primary.name}
|
||||
{if !$displayParams.nolink}
|
||||
</a>
|
||||
|
||||
{if !empty($values.secondaries)}
|
||||
<a href="javascript:collection['{$vardef.name}'].js_more_detail('{$values.primary.id}')" id='more_{$values.primary.id}' class="utilsLink"><img id='more_img_{$values.primary.id}' height="8" border="0" width="8" absmiddle="" alt="Hide/Show" src="{sugar_getimagepath file='advanced_search.gif'}"/></a>
|
||||
<div id='more_div_{$values.primary.id}' style="display:none">
|
||||
{foreach item=secondary_field from=$values.secondaries}
|
||||
<br><a href="index.php?module={$module}&action=DetailView&record={$secondary_field.id}">
|
||||
{$secondary_field.name}
|
||||
</a>
|
||||
{foreachelse}
|
||||
{/foreach}
|
||||
</div>
|
||||
<script type="text/javascript" src='{sugar_getjspath file="include/SugarFields/Fields/Collection/SugarFieldCollection.js"}'></script>
|
||||
<script type="text/javascript">
|
||||
var collection = (typeof collection == 'undefined') ? new Array() : collection;
|
||||
collection['{$vardef.name}'] = new SUGAR.collection('{$displayParams.formName}', '{$vardef.name}', '{$module}', '{$displayParams.popupData}');
|
||||
</script>
|
||||
{/if}
|
||||
{/if}
|
||||
97
include/SugarFields/Fields/Collection/CollectionEditView.tpl
Executable file
97
include/SugarFields/Fields/Collection/CollectionEditView.tpl
Executable file
@@ -0,0 +1,97 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<link rel="stylesheet" type="text/css" href="include/javascript/yui-old/assets/container.css" />
|
||||
<script type="text/javascript" src='{sugar_getjspath file="include/SugarFields/Fields/Collection/SugarFieldCollection.js"}'></script>
|
||||
<script type="text/javascript" src='{sugar_getjspath file="include/JSON.js"}'></script>
|
||||
<script type="text/javascript">
|
||||
var collection = (typeof collection == 'undefined') ? new Array() : collection;
|
||||
collection['{$displayParams.formName}_{$vardef.name}'] = new SUGAR.collection('{$displayParams.formName}', '{$vardef.name}', '{$module}', '{$displayParams.popupData}');
|
||||
</script>
|
||||
<input type="hidden" id="update_fields_{$displayParams.formName}_{$vardef.name}_collection" name="update_fields_{$displayParams.formName}_{$vardef.name}_collection" value="">
|
||||
<input type="hidden" id="{$displayParams.formName}_{$vardef.name}_new_on_update" name="{$displayParams.formName}_{$vardef.name}_new_on_update" value="{$displayParams.new_on_update}">
|
||||
<input type="hidden" id="{$displayParams.formName}_{$vardef.name}_allow_update" name="{$displayParams.formName}_{$vardef.name}_allow_update" value="{$displayParams.allow_update}">
|
||||
<input type="hidden" id="{$displayParams.formName}_{$vardef.name}_allow_new" name="{$displayParams.formName}_{$vardef.name}_allow_new" value="{$displayParams.allow_new}">
|
||||
|
||||
{if !empty($vardef.required)}
|
||||
<input type="hidden" id="{$vardef.name}_field" name="{$vardef.name}_field" value="{$vardef.name}_table">
|
||||
{/if}
|
||||
<table name='{$displayParams.formName}_{$vardef.name}_table' id='{$displayParams.formName}_{$vardef.name}_table' style="border-spacing: 0pt;">
|
||||
{include file=$cacheRowFile}
|
||||
<td valign='top'>
|
||||
</td>
|
||||
<!-- BEGIN Remove and Radio -->
|
||||
<td valign='top'>
|
||||
<img id="remove_{$vardef.name}_collection_0" name="remove_{$vardef.name}_collection_0" src="{sugar_getimagepath file='delete_inline.gif'}" onclick="collection['{$displayParams.formName}_{$vardef.name}'].remove('lineFields_{$displayParams.formName}_{$vardef.name}_0');"/>
|
||||
{if !empty($displayParams.allowNewValue) }
|
||||
<input type="hidden" name="allow_new_value_{$vardef.name}_collection_0" id="allow_new_value_{$vardef.name}_collection_0" value="true">
|
||||
{/if}
|
||||
</td>
|
||||
<td valign='top' align="center">
|
||||
<input id="primary_{$vardef.name}_collection_0" type="radio" class="radio" checked="checked" value="0" name="primary_{$vardef.name}_collection" style="{if empty($values.role_field)};display:none;{/if}" onclick="collection['{$displayParams.formName}_{$vardef.name}'].changePrimary(true);" />
|
||||
</td>
|
||||
<!-- END Remove and Radio -->
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
<table name='{$displayParams.formName}_{$vardef.name}_add_table' id='{$displayParams.formName}_{$vardef.name}_add_table'>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="javascript:collection['{$displayParams.formName}_{$vardef.name}'].add();"><img class="img" id="add_{$displayParams.formName}_{$vardef.name}_image" border="0" width="10" height="10" src="{sugar_getimagepath file='plus_inline.gif'}" style="margin-top: 3px;"/></a><a href="javascript:collection['{$displayParams.formName}_{$vardef.name}'].add();"> Add </a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{if !empty($values.secondaries)}
|
||||
{foreach item=secondary_field from=$values.secondaries key=key}
|
||||
<script type="text/javascript">
|
||||
var temp_array = new Array();
|
||||
temp_array['name'] = '{$secondary_field.name}';
|
||||
temp_array['id'] = '{$secondary_field.id}';
|
||||
collection['{$displayParams.formName}_{$vardef.name}'].secondaries_values.push(temp_array);
|
||||
</script>
|
||||
{/foreach}
|
||||
{/if}
|
||||
<script type="text/javascript">
|
||||
collection['{$displayParams.formName}_{$vardef.name}'].add_secondaries(collection['{$displayParams.formName}_{$vardef.name}'].secondaries_values);
|
||||
</script>
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
document.getElementById("id_{/literal}{$displayParams.formName}_{$vardef.name}{literal}_collection_0").value = "{/literal}{$values.primary.id}{literal}";
|
||||
document.getElementById("{/literal}{$displayParams.formName}_{$vardef.name}{literal}_collection_0").value = "{/literal}{$values.primary.name}{literal}";
|
||||
</script>
|
||||
{/literal}
|
||||
{$quickSearchCode}
|
||||
80
include/SugarFields/Fields/Collection/CollectionEditViewRow.tpl
Executable file
80
include/SugarFields/Fields/Collection/CollectionEditViewRow.tpl
Executable file
@@ -0,0 +1,80 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<!-- BEGIN Labels Line -->
|
||||
<tr id="lineLabel_{$vardef.name}" name="lineLabel_{$vardef.name}">
|
||||
<td>
|
||||
{if empty($displayParams.hideNameLabel)}
|
||||
{ldelim}sugar_translate label='LBL_COLLECTION_NAME'{rdelim}:
|
||||
{/if}
|
||||
</td>
|
||||
{foreach item=extra_field from=$displayParams.collection_field_list key=key_extra}
|
||||
<td>
|
||||
{$extra_field.label}
|
||||
<script type="text/javascript">
|
||||
collection['{$vardef.name}'].extra_fields_count++;
|
||||
</script>
|
||||
</td>
|
||||
{/foreach}
|
||||
<td>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
</td>
|
||||
<td id="lineLabel_{$vardef.name}_primary" {if empty($values.role_field)}style="display:none"{/if}>
|
||||
{ldelim}sugar_translate label='LBL_COLLECTION_PRIMARY'{rdelim}
|
||||
</td>
|
||||
<!-- BEGIN Add and collapse -->
|
||||
<td rowspan='1' valign='top'>
|
||||
<a class="utilsLink" href="javascript:collection['{$vardef.name}'].js_more();" id='more_{$vardef.name}' {if empty($values.secondaries)}style="display:none"{/if}><img id='more_img_{$vardef.name}' height="8" border="0" width="8" absmiddle="" alt="Hide/Show" src="{sugar_getimagepath file='advanced_search.gif'}"/></a>
|
||||
</td>
|
||||
<!-- END Add and collapse -->
|
||||
</tr>
|
||||
<!-- END Labels Line -->
|
||||
<tr id="lineFields_{$vardef.name}_0" name="lineFields_{$vardef.name}_0" class="lineFields_{$vardef.name}">
|
||||
<td valign='top'>
|
||||
<input type="text" name="{$vardef.name}_collection_0" class="sqsEnabled {$displayParams.class}" tabindex="{$tabindex}" id="{$vardef.name}_collection_0" size="{$displayParams.size}" value="" title='{$vardef.help}' autocomplete="off" {$displayParams.readOnly} {$displayParams.field}>
|
||||
<input type="hidden" name="id_{$vardef.name}_collection_0" id="id_{$vardef.name}_collection_0" value="">
|
||||
{if $showSelectButton}
|
||||
<input type="button" name="btn_{$vardef.name}_collection_0" tabindex="{$tabindex}" title="{$APP.LBL_SELECT_BUTTON_TITLE}" accessKey="{$APP.LBL_SELECT_BUTTON_KEY}" class="button" value="{ldelim}sugar_translate label='LBL_SELECT_BUTTON_LABEL'{rdelim}" onclick='open_popup("{$module}", 600, 400, "", true, false, {$displayParams.popupData}, "single", true);'>
|
||||
{/if}
|
||||
</td>
|
||||
{foreach item=extra_field from=$displayParams.collection_field_list key=key_extra}
|
||||
<td class="td_extra_field" valign='top'>
|
||||
{$extra_field.field}
|
||||
</td>
|
||||
{/foreach}
|
||||
60
include/SugarFields/Fields/Collection/DetailView.tpl
Executable file
60
include/SugarFields/Fields/Collection/DetailView.tpl
Executable file
@@ -0,0 +1,60 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 type="text/javascript" src='{sugar_getjspath file="include/SugarFields/Fields/Collection/SugarFieldCollection.js"}'></script>
|
||||
<script type="text/javascript" src='{sugar_getjspath file="include/JSON.js"}'></script>
|
||||
<div id='{{sugarvar key='name'}}_div' name='{{sugarvar key='name'}}_div'><img src="{sugar_getimagepath file='sqsWait.gif'}" alt="loading..." id="{{sugarvar key="name"}}_loading_img" style="display:none"></div>
|
||||
<script type="text/javascript">
|
||||
//{literal}
|
||||
var callback = {
|
||||
success:function(o){
|
||||
//{/literal}
|
||||
document.getElementById('{{sugarvar key="name"}}_loading_img').style.display="none";
|
||||
document.getElementById('{{sugarvar key="name"}}_div').innerHTML = o.responseText;
|
||||
SUGAR.util.evalScript(o.responseText);
|
||||
//{literal}
|
||||
},
|
||||
failure:function(o){
|
||||
alert(SUGAR.language.get('app_strings','LBL_AJAX_FAILURE'));
|
||||
}
|
||||
}
|
||||
//{/literal}
|
||||
document.getElementById('{{sugarvar key="name"}}_loading_img').style.display="inline";
|
||||
postData = '&displayParams=' + '{{$displayParamsJSON}}' + '&vardef=' + '{{$vardefJSON}}' + '&module_dir=' + document.forms.DetailView.module.value + '&bean_id=' + document.forms.DetailView.record.value + '&action_type=detailview';
|
||||
//{literal}
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'index.php?action=viewsugarfieldcollection', callback, postData);
|
||||
//{/literal}
|
||||
</script>
|
||||
66
include/SugarFields/Fields/Collection/EditView.tpl
Executable file
66
include/SugarFields/Fields/Collection/EditView.tpl
Executable file
@@ -0,0 +1,66 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<link rel="stylesheet" type="text/css" href="include/javascript/yui-old/assets/container.css" />
|
||||
<script type="text/javascript" src='{sugar_getjspath file="include/SugarFields/Fields/Collection/SugarFieldCollection.js"}'></script>
|
||||
<script type="text/javascript" src='{sugar_getjspath file="include/JSON.js"}'></script>
|
||||
<div id='{{sugarvar key='name'}}_div' name='{{sugarvar key='name'}}_div'><img src="{sugar_getimagepath file='sqsWait.gif'}" alt="loading..." id="{{sugarvar key="name"}}_loading_img" style="display:none"></div>
|
||||
<script type="text/javascript">
|
||||
//{literal}
|
||||
var callback = {
|
||||
success:function(o){
|
||||
//{/literal}
|
||||
//collection['{{sugarvar key="name"}}'] = new SUGAR.collection('{{sugarvar key="name"}}', "{{sugarvar key='module'}}", '{{$displayParams.popupData}}');
|
||||
document.getElementById('{{sugarvar key="name"}}_loading_img').style.display="none";
|
||||
document.getElementById('{{sugarvar key="name"}}_div').innerHTML = o.responseText;
|
||||
SUGAR.util.evalScript(o.responseText);
|
||||
{* //TODO: Expression Engine removed from Tokyo so SUGAR.forms no longer exists.
|
||||
{{if !empty($required)}}
|
||||
SUGAR.forms.FormValidator.add('EditView', '{{sugarvar key="name"}}_field', 'isRequiredCollection(\${{sugarvar key="name"}}_field)', SUGAR.language.get('app_strings', 'ERROR_MISSING_COLLECTION_SELECTION'));
|
||||
{{/if}} *}
|
||||
//{literal}
|
||||
},
|
||||
failure:function(o){
|
||||
alert(SUGAR.language.get('app_strings','LBL_AJAX_FAILURE'));
|
||||
}
|
||||
}
|
||||
//{/literal}
|
||||
document.getElementById('{{sugarvar key="name"}}_loading_img').style.display="inline";
|
||||
postData = '&displayParams=' + '{{$displayParamsJSON}}' + '&vardef=' + '{{$vardefJSON}}' + '&module_dir=' + document.forms.EditView.module.value + '&bean_id=' + document.forms.EditView.record.value + '&action_type=editview';
|
||||
//{literal}
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'index.php?action=viewsugarfieldcollection', callback, postData);
|
||||
//{/literal}
|
||||
</script>
|
||||
@@ -0,0 +1,65 @@
|
||||
/*********************************************************************************
|
||||
* 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(typeof(SUGAR.collection)=="undefined"){SUGAR.collection=function(form_name,field_name,module,popupData){this.more_status=false;this.form=form_name;this.field=field_name;this.field_element_name=this.form+'_'+this.field;this.module=module;this.fields_count=0;this.extra_fields_count=0;this.first=true;this.primary_field="";this.cloneField=new Array();this.sqs_clone="";this.secondaries_values=new Array();this.update_fields=new Object();this.show_more_image=true;};SUGAR.collection.prototype={remove:function(num){radio_els=this.get_radios();if(radio_els.length==1){div_el=document.getElementById(this.field_element_name+'_input_div_'+num);input_els=div_el.getElementsByTagName('input');input_els[0].value='';input_els[1].value='';if(this.primary_field){div_el=document.getElementById(this.field_element_name+'_radio_div_'+num);radio_els=div_el.getElementsByTagName('input');radio_els[0].checked=false;}}else{div_el=document.getElementById(this.field_element_name+'_input_div_'+num);tr_to_remove=document.getElementById('lineFields_'+this.field_element_name+'_'+num);div_el.parentNode.parentNode.parentNode.removeChild(tr_to_remove);var radios=this.get_radios();div_id='lineFields_'+this.field_element_name+'_'+num;if(typeof sqs_objects[div_id.replace("_field_","_")]!='undefined'){delete(sqs_objects[div_id.replace("_field_","_")]);}
|
||||
var checked=false;for(var k=0;k<radios.length;k++){if(radios[k].checked){checked=true;}}
|
||||
var primary_checked=document.forms[this.form].elements[this.field+"_allowed_to_check"];var allowed_to_check=true;if(primary_checked&&primary_checked.value=='false'){allowed_to_check=false;}
|
||||
if(/EditView/.test(this.form)&&!checked&&typeof radios[0]!='undefined'&&allowed_to_check){radios[0].checked=true;this.changePrimary(true);this.js_more();this.js_more();}
|
||||
if(radios.length==1){this.more_status=false;document.getElementById('more_'+this.field_element_name).style.display='none';this.show_arrow_label(false);this.js_more();}else{this.js_more();this.js_more();}}},get_radios:function(){return YAHOO.util.Selector.query('input[name^=primary]',document.getElementById(this.field_element_name+'_table'));},add:function(values){this.fields_count++;var Field0=this.init_clone(values);this.cloneField[1].appendChild(Field0);enableQS(true);this.changePrimary(false);if(document.getElementById('more_'+this.field_element_name)&&document.getElementById('more_'+this.field_element_name).style.display=='none'){document.getElementById('more_'+this.field_element_name).style.display='';}
|
||||
if(!this.is_expanded()){this.js_more();this.show_arrow_label(true);}},add_secondaries:function(){clone_id=this.form+'_'+this.field+'_collection_0';if(typeof sqs_objects=='undefined'||typeof sqs_objects[clone_id]=='undefined'){setTimeout('collection["'+this.field_element_name+'"].add_secondaries();',1000);}else if(typeof document.getElementById(this.form+'_'+this.field+'_collection_0')=='undefined'){setTimeout('collection["'+this.field_element_name+'"].add_secondaries();',1000);}else{if(!this.create_clone())return;enableQS();this.changePrimary(true);for(key in this.secondaries_values){if(isInteger(key)){this.add(this.secondaries_values[key]);}}
|
||||
this.js_more();this.js_more();}},init_clone:function(values){if(typeof this.cloneField[0]=='undefined'){return;}
|
||||
if(typeof values=="undefined"){values=new Array();values['name']="";values['id']="";}
|
||||
var count=this.fields_count;Field0=this.cloneField[0].cloneNode(true);Field0.id="lineFields_"+this.field_element_name+"_"+count;for(var ii=0;ii<Field0.childNodes.length;ii++){if(typeof(Field0.childNodes[ii].tagName)!='undefined'&&Field0.childNodes[ii].tagName=="TD"){for(var jj=0;jj<Field0.childNodes[ii].childNodes.length;jj++){currentNode=Field0.childNodes[ii].childNodes[jj];this.process_node(Field0.childNodes[ii],currentNode,values);}}}
|
||||
return Field0;},process_node:function(parentNode,currentNode,values){if(parentNode.className=='td_extra_field'){if(parentNode.id){parentNode.id='';}
|
||||
var toreplace=this.field+"_collection_extra_0";var re=new RegExp(toreplace,'g');parentNode.innerHTML=parentNode.innerHTML.replace(re,this.field+"_collection_extra_"+this.fields_count);}else if(currentNode.tagName&¤tNode.tagName=='SPAN'){currentNode.id=/_input/.test(currentNode.id)?this.field_element_name+'_input_div_'+this.fields_count:this.field_element_name+'_radio_div_'+this.fields_count;input_els=currentNode.getElementsByTagName('input');for(x in input_els){if(input_els[x].tagName&&input_els[x].tagName=='INPUT'){this.process_node(parentNode,input_els[x],values);}}}else if(currentNode.name){var toreplace=this.field+"_collection_0";var re=new RegExp(toreplace,'g');var name=currentNode.name;var new_name=name.replace(re,this.field+"_collection_"+this.fields_count);switch(name){case toreplace:sqs_id=this.form+'_'+new_name;if(typeof this.sqs_clone!='undefined'){var sqs_clone=YAHOO.lang.JSON.stringify(this.sqs_clone);eval('sqs_objects[sqs_id]='+sqs_clone);for(var pop_field in sqs_objects[sqs_id]['populate_list']){if(typeof sqs_objects[sqs_id]['populate_list'][pop_field]=='string'){sqs_objects[sqs_id]['populate_list'][pop_field]=sqs_objects[sqs_id]['populate_list'][pop_field].replace(RegExp('_0','g'),"_"+this.fields_count);}}
|
||||
for(var req_field in sqs_objects[sqs_id]['required_list']){if(typeof sqs_objects[sqs_id]['required_list'][req_field]=='string'){sqs_objects[sqs_id]['required_list'][req_field]=sqs_objects[sqs_id]['required_list'][req_field].replace(RegExp('_0','g'),"_"+this.fields_count);}}}
|
||||
currentNode.name=new_name;currentNode.id=new_name;currentNode.value=values['name'];break;case"id_"+toreplace:currentNode.name=new_name.replace(RegExp('_0','g'),"_"+this.fields_count);currentNode.id=new_name.replace(RegExp('_0','g'),"_"+this.fields_count);currentNode.value=values['id'];break;case"btn_"+toreplace:currentNode.name=new_name;currentNode.attributes['onclick'].value=currentNode.attributes['onclick'].value.replace(re,this.field+"_collection_"+this.fields_count);currentNode.attributes['onclick'].value=currentNode.attributes['onclick'].value.replace(RegExp(this.field+"_collection_extra_0",'g'),this.field+"_collection_extra_"+this.fields_count);break;case"allow_new_value_"+toreplace:currentNode.name=new_name;currentNode.id=new_name;break;case"remove_"+toreplace:currentNode.name=new_name;currentNode.id=new_name;currentNode.setAttribute('collection_id',this.field_element_name);currentNode.setAttribute('remove_id',this.fields_count);currentNode.onclick=function(){collection[this.getAttribute('collection_id')].remove(this.getAttribute('remove_id'));};break;case"primary_"+this.field+"_collection":currentNode.id=new_name;currentNode.value=this.fields_count;currentNode.checked=false;currentNode.setAttribute('defaultChecked','');break;default:break;}}},js_more:function(val){if(this.show_more_image){var more_=document.getElementById('more_img_'+this.field_element_name);var arrow=document.getElementById('arrow_'+this.field);var radios=this.get_radios();if(this.more_status==false){more_.src="index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=advanced_search.gif";this.more_status=true;var hidden_count=0;for(var k=0;k<radios.length;k++){if(radios[k].type&&radios[k].type=='radio'){if(radios[k].checked){radios[k].parentNode.parentNode.parentNode.style.display='';}else{radios[k].parentNode.parentNode.parentNode.style.display='none';hidden_count++;}}}
|
||||
if(hidden_count==radios.length){radios[0].parentNode.parentNode.parentNode.style.display='';}
|
||||
arrow.value='hide';}else{more_.src="index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=basic_search.gif";this.more_status=false;for(var k=0;k<radios.length;k++){if(isInteger(k)){radios[k].parentNode.parentNode.parentNode.style.display='';}}
|
||||
arrow.value='show';}
|
||||
var more_div=document.getElementById('more_div_'+this.field_element_name);if(more_div){more_div.innerHTML=arrow.value=='show'?SUGAR.language.get('app_strings','LBL_HIDE'):SUGAR.language.get('app_strings','LBL_SHOW');}}},create_clone:function(){var oneField=document.getElementById('lineFields_'+this.field_element_name+'_0');if(oneField==null||typeof(oneField)=='undefined')return false;this.cloneField[0]=oneField.cloneNode(true);this.cloneField[1]=oneField.parentNode;this.more_status=true;clone_id=this.form+'_'+this.field+'_collection_0';if(typeof sqs_objects[clone_id]!='undefined'){var clone=YAHOO.lang.JSON.stringify(sqs_objects[clone_id]);eval('this.sqs_clone='+clone);return true;}
|
||||
return false;},validateTemSet:function(formname,fieldname){table_element_id=formname+'_'+fieldname+'_table';if(document.getElementById(table_element_id)){input_elements=YAHOO.util.Selector.query('input[type=radio]',document.getElementById(table_element_id));has_primary=false;primary_field_id=fieldname+'_collection_0';for(t in input_elements){primary_field_id=fieldname+'_collection_'+input_elements[t].value;if(input_elements[t].type&&input_elements[t].type=='radio'&&input_elements[t].checked==true){if(document.forms[formname].elements[primary_field_id].value!=''){has_primary=true;}
|
||||
break;}}
|
||||
if(!has_primary){return false;}
|
||||
return true;}
|
||||
return true;},getTeamIdsfromUI:function(formname,fieldname){$team_ids=new Array();table_element_id=formname+'_'+fieldname+'_table';if(document.getElementById(table_element_id)){input_elements=YAHOO.util.Selector.query('input[type=hidden]',document.getElementById(table_element_id));for(t in input_elements){if(input_elements[t].id.match("id_"+fieldname+"_collection_")!=null){$team_ids.push(input_elements[t].value);}}}
|
||||
return $team_ids;},getPrimaryTeamidsFromUI:function(formname,fieldname){table_element_id=formname+'_'+fieldname+'_table';if(document.getElementById(table_element_id)){input_elements=YAHOO.util.Selector.query('input[type=radio]',document.getElementById(table_element_id));for(t in input_elements){primary_field_id='id_'+document.forms[formname][fieldname].name+'_collection_'+input_elements[t].value;if(input_elements[t].type&&input_elements[t].type=='radio'&&input_elements[t].checked==true){if(document.forms[formname].elements[primary_field_id].value!=''){return document.forms[formname].elements[primary_field_id].value;}}}}
|
||||
return'';},changePrimary:function(noAdd){var old_primary=this.primary_field;var radios=this.get_radios();for(var k=0;k<radios.length;k++){var qs_id=radios[k].id.replace('primary_','');if(radios[k].checked){this.primary_field=qs_id;}else{qs_id=qs_id+'_'+k;}
|
||||
qs_id=this.form+'_'+qs_id;if(typeof sqs_objects[qs_id]!='undefined'&&sqs_objects[qs_id]['primary_field_list']){for(var ii=0;ii<sqs_objects[qs_id]['primary_field_list'].length;ii++){if(radios[k].checked&&qs_id!=old_primary){sqs_objects[qs_id]['field_list'].push(sqs_objects[qs_id]['primary_field_list'][ii]);sqs_objects[qs_id]['populate_list'].push(sqs_objects[qs_id]['primary_populate_list'][ii]);}else if(old_primary==qs_id&&!radios[k].checked){sqs_objects[qs_id]['field_list'].pop();sqs_objects[qs_id]['populate_list'].pop();}}}}
|
||||
if(noAdd){enableQS(false);}
|
||||
this.first=false;},js_more_detail:function(id){var more_img=document.getElementById('more_img_'+id);if(more_img.style.display=='inline'){more_img.src="index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=advanced_search.gif";}else{more_img.src="index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=basic_search.gif";}},replace_first:function(values){for(var i=0;i<=this.fields_count;i++){div_el=document.getElementById(this.field_element_name+'_input_div_'+i);if(div_el){var name_field=document.forms[this.form].elements[this.field+"_collection_"+i];var id_field=document.forms[this.form].elements["id_"+this.field+"_collection_"+i];name_field.value=values['name'];id_field.value=values['id'];break;}}},clean_up:function(){var divsToClean=new Array();var isFirstFieldEmpty=false;var divCount=0;for(var i=0;i<=this.fields_count;i++){div_el=document.getElementById(this.field_element_name+'_input_div_'+i);if(div_el){input_els=div_el.getElementsByTagName('input');for(x in input_els){if(input_els[x].id&&input_els[x].id==(this.field+'_collection_'+i)&&trim(input_els[x].value)==''){if(divCount==0){isFirstFieldEmpty=true;}else{divsToClean.push(i);}}}
|
||||
divCount++;}}
|
||||
for(var j=0;j<divsToClean.length;j++){this.remove(divsToClean[j]);}
|
||||
return isFirstFieldEmpty;},show_arrow_label:function(show){var more_div=document.getElementById('more_div_'+this.field_element_name);if(more_div){more_div.style.display=show?'':'none';}},is_expanded:function(){var more_div=document.getElementById('more_div_'+this.field_element_name);if(more_div){return more_div.style.display=='';}
|
||||
return false;}}}
|
||||
221
include/SugarFields/Fields/Collection/SugarFieldCollection.php
Executable file
221
include/SugarFields/Fields/Collection/SugarFieldCollection.php
Executable file
@@ -0,0 +1,221 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
require_once('include/SugarFields/Fields/Base/SugarFieldBase.php');
|
||||
class SugarFieldCollection extends SugarFieldBase {
|
||||
var $tpl_path;
|
||||
|
||||
function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
$nolink = array('Users');
|
||||
if(in_array($vardef['module'], $nolink)){
|
||||
$displayParams['nolink']=true;
|
||||
}else{
|
||||
$displayParams['nolink']=false;
|
||||
}
|
||||
$json = getJSONobj();
|
||||
$displayParamsJSON = $json->encode($displayParams);
|
||||
$vardefJSON = $json->encode($vardef);
|
||||
$this->ss->assign('displayParamsJSON', '{literal}'.$displayParamsJSON.'{/literal}');
|
||||
$this->ss->assign('vardefJSON', '{literal}'.$vardefJSON.'{/literal}');
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
if(empty($this->tpl_path)){
|
||||
$this->tpl_path = 'include/SugarFields/Fields/Collection/DetailView.tpl';
|
||||
}
|
||||
return $this->fetch($this->tpl_path);
|
||||
}
|
||||
|
||||
function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex, $searchView = false) {
|
||||
if($searchView){
|
||||
$form_name = 'search_form';
|
||||
}else{
|
||||
$form_name = 'EditView';
|
||||
}
|
||||
$json = getJSONobj();
|
||||
$displayParamsJSON = $json->encode($displayParams);
|
||||
$vardefJSON = $json->encode($vardef);
|
||||
$this->ss->assign('required', !empty($vardef['required']));
|
||||
$this->ss->assign('displayParamsJSON', '{literal}'.$displayParamsJSON.'{/literal}');
|
||||
$this->ss->assign('vardefJSON', '{literal}'.$vardefJSON.'{/literal}');
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
if(!$searchView) {
|
||||
if(empty($this->tpl_path)){
|
||||
$this->tpl_path = 'include/SugarFields/Fields/Collection/EditView.tpl';
|
||||
}
|
||||
return $this->fetch($this->tpl_path);
|
||||
}
|
||||
}
|
||||
|
||||
function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
$this->getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex, true);
|
||||
}
|
||||
/**
|
||||
* This should be called when the bean is saved. The bean itself will be passed by reference
|
||||
* @param SugarBean bean - the bean performing the save
|
||||
* @param array params - an array of paramester relevant to the save, most likely will be $_REQUEST
|
||||
*/
|
||||
public function save(&$bean, $params, $field, $properties, $prefix = ''){
|
||||
if(isset($_POST["primary_" . $field . "_collection"])){
|
||||
$save = false;
|
||||
$value_name = $field . "_values";
|
||||
$link_field = array();
|
||||
// populate $link_field from POST
|
||||
foreach($_POST as $name=>$value){
|
||||
if(strpos($name, $field . "_collection_") !== false){
|
||||
$num = substr($name, -1);
|
||||
if(is_numeric($num)){
|
||||
settype($num, 'int');
|
||||
if(strpos($name, $field . "_collection_extra_") !== false){
|
||||
$extra_field = substr($name, $field . "_collection_extra_" . $num);
|
||||
$link_field[$num]['extra_field'][$extra_field]=$value;
|
||||
}else if ($name == $field . "_collection_" . $num){
|
||||
$link_field[$num]['name']=$value;
|
||||
}else if ($name == "id_" . $field . "_collection_" . $num){
|
||||
$link_field[$num]['id']=$value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Set Primary
|
||||
if(isset($_POST["primary_" . $field . "_collection"])){
|
||||
$primary = $_POST["primary_" . $field . "_collection"];
|
||||
settype($primary, 'int');
|
||||
$link_field[$primary]['primary']=true;
|
||||
}
|
||||
// Create or update record and take care of the extra_field
|
||||
require('include/modules.php');
|
||||
require_once('data/Link.php');
|
||||
$class = load_link_class($bean->field_defs[$field]);
|
||||
|
||||
$link_obj = new $class($bean->field_defs[$field]['relationship'], $bean, $bean->field_defs[$field]);
|
||||
$module = $link_obj->getRelatedModuleName();
|
||||
$beanName = $beanList[$module];
|
||||
require_once($beanFiles[$beanName]);
|
||||
foreach($link_field as $k=>$v){
|
||||
$save = false;
|
||||
$update_fields = array();
|
||||
$obj = new $beanName();
|
||||
if(!isset($link_field[$k]['name']) || empty($link_field[$k]['name'])){
|
||||
// There is no name so it is an empty record -> ignore it!
|
||||
unset($link_field[$k]);
|
||||
break;
|
||||
}
|
||||
if(!isset($link_field[$k]['id']) || empty($link_field[$k]['id']) || (isset($_POST[$field . "_new_on_update"]) && $_POST[$field . "_new_on_update"] === 'true')){
|
||||
// Create a new record
|
||||
if(isset($_POST[$field . "_allow_new"]) && ($_POST[$field . "_allow_new"] === 'false' || $_POST[$field . "_allow_new"] === false)){
|
||||
// Not allow to create a new record so remove from $link_field
|
||||
unset($link_field[$k]);
|
||||
break;
|
||||
}
|
||||
if(!isset($link_field[$k]['id']) || empty($link_field[$k]['id'])){
|
||||
// There is no ID so it is a new record
|
||||
$save = true;
|
||||
$obj->name=$link_field[$k]['name'];
|
||||
}else{
|
||||
// We duplicate an existing record because new_on_update is set
|
||||
$obj->retrieve($link_field[$k]['id']);
|
||||
$obj->id='';
|
||||
$obj->name = $obj->name . '_DUP';
|
||||
}
|
||||
}else{
|
||||
// id exist so retrieve the data
|
||||
$obj->retrieve($link_field[$k]['id']);
|
||||
}
|
||||
// Update the extra field for the new or the existing record
|
||||
if(isset($v['extra_field']) && is_array($v['extra_field'])){
|
||||
// Retrieve the changed fields
|
||||
if(isset($_POST["update_fields_{$field}_collection"]) && !empty($_POST["update_fields_{$field}_collection"])){
|
||||
$JSON = getJSONobj();
|
||||
$update_fields = $JSON->decode(html_entity_decode($_POST["update_fields_{$field}_collection"]));
|
||||
}
|
||||
// Update the changed fields
|
||||
foreach($update_fields as $kk=>$vv){
|
||||
if(!isset($_POST[$field . "_allow_update"]) || ($_POST[$field . "_allow_update"] !== 'false' && $_POST[$field . "_allow_update"] !== false)){
|
||||
//allow to update the extra_field in the record
|
||||
if(isset($v['extra_field'][$kk]) && $vv == true){
|
||||
$extra_field_name = str_replace("_".$field."_collection_extra_".$k,"",$kk);
|
||||
if($obj->$extra_field_name != $v['extra_field'][$kk]){
|
||||
$save = true;
|
||||
$obj->$extra_field_name=$v['extra_field'][$kk];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Save the new or updated record
|
||||
if($save){
|
||||
if(!$obj->ACLAccess('save')){
|
||||
ACLController::displayNoAccess(true);
|
||||
sugar_cleanup(true);
|
||||
}
|
||||
$obj->save();
|
||||
$link_field[$k]['id']=$obj->id;
|
||||
}
|
||||
}
|
||||
// Save new relationship or delete deleted relationship
|
||||
if(!empty($link_field)){
|
||||
if($bean->load_relationship($field)){
|
||||
$oldvalues = $bean->$field->get(true);
|
||||
$role_field = $bean->$field->_get_link_table_role_field($bean->$field->_relationship_name);
|
||||
foreach($link_field as $new_v){
|
||||
if(!empty($new_v['id'])){
|
||||
if(!empty($role_field)){
|
||||
if(isset($new_v['primary']) && $new_v['primary']){
|
||||
$bean->$field->add($new_v['id'], array($role_field=>'primary'));
|
||||
}else{
|
||||
$bean->$field->add($new_v['id'], array($role_field=>'NULL'));
|
||||
}
|
||||
}else{
|
||||
$bean->$field->add($new_v['id'], array());
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach($oldvalues as $old_v){
|
||||
$match = false;
|
||||
foreach($link_field as $new_v){
|
||||
if($new_v['id'] == $old_v['id']){
|
||||
$match = true;
|
||||
}
|
||||
}
|
||||
if(!$match){
|
||||
$bean->$field->delete($bean->id, $old_v['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
499
include/SugarFields/Fields/Collection/ViewSugarFieldCollection.php
Executable file
499
include/SugarFields/Fields/Collection/ViewSugarFieldCollection.php
Executable file
@@ -0,0 +1,499 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
require_once('include/SugarFields/Fields/Collection/SugarFieldCollection.php');
|
||||
|
||||
|
||||
class ViewSugarFieldCollection{
|
||||
var $ss; // Sugar Smarty Object
|
||||
var $bean;
|
||||
var $bean_id;
|
||||
var $name;
|
||||
var $value_name;
|
||||
var $displayParams; // DisplayParams for the collection field (defined in the metadata)
|
||||
var $vardef; // vardef of the collection field.
|
||||
var $related_module; // module name of the related module
|
||||
var $module_dir; // name of the module where the collection field is.
|
||||
var $numFields;
|
||||
var $json;
|
||||
var $tpl_path;
|
||||
var $extra_var;
|
||||
var $skipModuleQuickSearch = false;
|
||||
var $field_to_name_array; //mapping of fields for the return of the select popup
|
||||
var $showSelectButton = true;
|
||||
var $hideShowHideButton = false;
|
||||
var $action_type;
|
||||
var $form_name;
|
||||
|
||||
function ViewSugarFieldCollection($fill_data = true){
|
||||
$this->json = getJSONobj();
|
||||
if($fill_data){
|
||||
$this->displayParams = $this->json->decode(html_entity_decode($_REQUEST['displayParams']));
|
||||
$this->vardef = $this->json->decode(html_entity_decode($_REQUEST['vardef']));
|
||||
$this->module_dir = $_REQUEST['module_dir'];
|
||||
$this->action_type = $_REQUEST['action_type'];
|
||||
$this->name = $this->vardef['name'];
|
||||
$this->value_name = $this->name . '_values';
|
||||
$this->numFields = 1;
|
||||
$this->ss = new Sugar_Smarty();
|
||||
$this->edit_tpl_path = 'include/SugarFields/Fields/Collection/CollectionEditView.tpl';
|
||||
$this->detail_tpl_path = 'include/SugarFields/Fields/Collection/CollectionDetailView.tpl';
|
||||
$this->extra_var = array();
|
||||
$this->field_to_name_array = array();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Retrieve the related module and load the bean and the relationship
|
||||
* call retrieve values()
|
||||
*/
|
||||
function setup(){
|
||||
if(!class_exists('Relationship')){
|
||||
|
||||
}
|
||||
$rel = new Relationship();
|
||||
if(!empty($this->vardef['relationship'])){
|
||||
$rel->retrieve_by_name($this->vardef['relationship']);
|
||||
}
|
||||
if($rel->relationship_type == 'many-to-many'){
|
||||
if($rel->lhs_module == $this->module_dir){
|
||||
$this->related_module = $rel->rhs_module;
|
||||
$module_dir = $rel->lhs_module;
|
||||
}else if($rel->rhs_module == $this->module_dir){
|
||||
$this->related_module = $rel->lhs_module;
|
||||
$module_dir = $rel->rhs_module;
|
||||
}else{
|
||||
die("this field has no relationships mapped with this module");
|
||||
}
|
||||
if($module_dir != $this->module_dir){
|
||||
die('These modules do not match : '. $this->module_dir . ' and ' . $module_dir);
|
||||
}
|
||||
if(isset($GLOBALS['beanList'][$this->module_dir])){
|
||||
$class = $GLOBALS['beanList'][$this->module_dir];
|
||||
if(file_exists($GLOBALS['beanFiles'][$class])){
|
||||
$this->bean = loadBean($this->module_dir);
|
||||
$this->bean->retrieve($_REQUEST['bean_id']);
|
||||
if($this->bean->load_relationship($this->vardef['name'])){
|
||||
$this->retrieve_values();
|
||||
}else{
|
||||
die('failed to load the relationship');
|
||||
}
|
||||
}else{
|
||||
die('class file do not exist');
|
||||
}
|
||||
}else{
|
||||
die($this->module_dir . ' is not in the beanList.');
|
||||
}
|
||||
}
|
||||
else{
|
||||
die("the relationship is not a many-to-many");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Retrieve the values from the DB using the get method of the link class
|
||||
* Organize and save the value into the bean
|
||||
*/
|
||||
function retrieve_values(){
|
||||
if(empty($this->bean->{$this->value_name}) && isset($this->bean->{$this->name})){
|
||||
$values = array();
|
||||
$values = $this->bean->{$this->name}->get(true);
|
||||
$role_field = $this->bean->{$this->name}->_get_link_table_role_field($this->bean->{$this->name}->_relationship_name);
|
||||
foreach($values as $v){
|
||||
$role = '';
|
||||
foreach($v as $kk=>$vv){
|
||||
if($kk == $role_field){
|
||||
$role=$vv;
|
||||
}
|
||||
}
|
||||
if($role == 'primary'){
|
||||
$primary_id = $v['id'];
|
||||
}else{
|
||||
$secondary_ids[] = array('id'=>$v['id'], 'role'=>$role);
|
||||
}
|
||||
}
|
||||
$this->bean->{$this->value_name} = array('role_field'=>$role_field);
|
||||
if(isset($primary_id) || isset($secondary_ids)){
|
||||
if(!isset($primary_id)){
|
||||
$primary_id = $secondary_ids[0]['id'];
|
||||
unset($secondary_ids[0]);
|
||||
}
|
||||
if(isset($GLOBALS['beanList'][ $this->related_module])){
|
||||
$class = $GLOBALS['beanList'][$this->related_module];
|
||||
if(file_exists($GLOBALS['beanFiles'][$class])){
|
||||
$mod = loadBean($this->module_dir);
|
||||
$mod->relDepth = $this->bean->relDepth + 1;
|
||||
$mod->retrieve($primary_id);
|
||||
if (isset($mod->name)) {
|
||||
$this->bean->{$this->value_name}=array_merge($this->bean->{$this->value_name}, array('primary'=>array('id'=>$primary_id, 'name'=>$mod->name)));
|
||||
}
|
||||
$secondaries = array();
|
||||
if(isset($secondary_ids)){
|
||||
foreach($secondary_ids as $v){
|
||||
if($mod->retrieve($v['id'])){
|
||||
if (isset($mod->name)){
|
||||
$secondaries['secondaries'][]=array('id'=>$v['id'], 'name'=>$mod->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->bean->{$this->value_name}=array_merge($this->bean->{$this->value_name}, $secondaries);
|
||||
if(isset($field['additionalFields'])){
|
||||
foreach($field['additionalFields'] as $field=>$to){
|
||||
if(isset($mod->$field)){
|
||||
$this->bean->$to = $mod->$field;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* redirect to the good process method.
|
||||
*/
|
||||
function process(){
|
||||
if($this->action_type == 'editview'){
|
||||
$this->process_editview();
|
||||
}else if($this->action_type == 'detailview'){
|
||||
$this->process_detailview();
|
||||
}
|
||||
}
|
||||
function process_detailview(){
|
||||
|
||||
}
|
||||
/*
|
||||
* Build the DisplayParams array
|
||||
*/
|
||||
function process_editview(){
|
||||
if(isset($this->bean->{$this->value_name}['secondaries'])){
|
||||
$this->numFields=count($this->bean->{$this->value_name}['secondaries'])+1;
|
||||
}
|
||||
if(!isset($this->displayParams['readOnly'])) {
|
||||
$this->displayParams['readOnly'] = '';
|
||||
} else {
|
||||
$this->displayParams['readOnly'] = $this->displayParams['readOnly'] == false ? '' : 'READONLY';
|
||||
}
|
||||
// If there is extra field to show.
|
||||
if(isset($this->displayParams['collection_field_list'])){
|
||||
|
||||
require_once('include/SugarFields/SugarFieldHandler.php');
|
||||
$sfh = new SugarFieldHandler();
|
||||
vardefmanager::loadVardef($this->related_module, $GLOBALS['beanList'][$this->related_module]);
|
||||
foreach($this->displayParams['collection_field_list'] as $k=>$v){
|
||||
$javascript='';
|
||||
$collection_field_vardef = $GLOBALS['dictionary'][$GLOBALS['beanList'][$this->related_module]]['fields'][$v['name']];
|
||||
|
||||
// For each extra field the params which are not displayParams will be consider as params to override the vardefs values.
|
||||
foreach($v as $k_override=>$v_override){
|
||||
if($k_override != 'displayParams'){
|
||||
$collection_field_vardef[$k_override] = $v_override;
|
||||
}
|
||||
}
|
||||
|
||||
// If relate field : enable quick search by creating the sqs_object array.
|
||||
if($collection_field_vardef['type'] == 'relate'){
|
||||
require_once('include/TemplateHandler/TemplateHandler.php');
|
||||
$tph = new TemplateHandler();
|
||||
$javascript = $tph->createQuickSearchCode(array($collection_field_vardef['name']=>$collection_field_vardef), array($v), $this->form_name);
|
||||
$javascript = str_replace('<script language="javascript">'."if(typeof sqs_objects == 'undefined'){var sqs_objects = new Array;}sqs_objects['{$collection_field_vardef['name']}']=","",$javascript);
|
||||
$javascript = substr($javascript, 0, -10);//remove ";</script>"
|
||||
$javascriptPHP = $this->json->decode($javascript);
|
||||
foreach($javascriptPHP['populate_list'] as $kk=>$vv){
|
||||
$javascriptPHP['populate_list'][$kk] .= "_" . $this->vardef['name'] . "_collection_extra_0";
|
||||
}
|
||||
foreach($javascriptPHP['required_list'] as $kk=>$vv){
|
||||
$javascriptPHP['required_list'][$kk] .= "_" . $this->vardef['name'] . "_collection_extra_0";
|
||||
}
|
||||
foreach($javascriptPHP['field_list'] as $kk=>$vv){
|
||||
if($vv == 'id'){
|
||||
$javascriptPHP['populate_list'][$kk];
|
||||
}
|
||||
}
|
||||
$javascript = $this->json->encode($javascriptPHP);
|
||||
$javascript = "<script language='javascript'>if(typeof sqs_objects == 'undefined'){var sqs_objects = new Array;}sqs_objects['{$collection_field_vardef['name']}_" . $this->vardef['name'] . "_collection_extra_0']=".$javascript.';</script>';
|
||||
}
|
||||
|
||||
$collection_field_vardef['name'] .= "_" . $this->vardef['name'] . "_collection_extra_0";
|
||||
if(isset($collection_field_vardef['id_name'])){
|
||||
$collection_field_vardef['id_name'] .= "_" . $this->vardef['name'] . "_collection_extra_0";
|
||||
}
|
||||
if(isset($this->displayParams['allow_update']) && ($this->displayParams['allow_update'] === false || $this->displayParams['allow_update'] === 'false')){
|
||||
$this->displayParams['allow_update']='false';
|
||||
$v['displayParams']['field']['disabled']='';
|
||||
}else{
|
||||
$this->displayParams['allow_update']='true';
|
||||
if(!isset($v['displayParams'])){
|
||||
$v['displayParams']=array();
|
||||
}
|
||||
}
|
||||
$viewtype='EditView';
|
||||
$name = $collection_field_vardef['name'];
|
||||
// Rearranging the array with name as key instaead of number. This is required for displaySmarty() to assign the good variable.
|
||||
$this->displayParams['collection_field_list'][$name]['vardefName'] = $this->displayParams['collection_field_list'][$k]['name'];
|
||||
$this->displayParams['collection_field_list'][$name]['name'] = $name;
|
||||
if($collection_field_vardef['type'] == 'relate'){
|
||||
$this->displayParams['collection_field_list'][$name]['id_name'] = $collection_field_vardef['id_name'];
|
||||
$this->displayParams['collection_field_list'][$name]['module'] = $collection_field_vardef['module'];
|
||||
}
|
||||
$this->displayParams['collection_field_list'][$name]['label'] = "{sugar_translate label='{$collection_field_vardef['vname']}' module='{$this->related_module}'}";//translate($collection_field_vardef['vname'], $this->related_module);
|
||||
$this->displayParams['collection_field_list'][$name]['field'] = $sfh->displaySmarty('displayParams.collection_field_list', $collection_field_vardef, $viewtype, $v['displayParams'], 1);
|
||||
$this->displayParams['collection_field_list'][$name]['field'] .= '{literal}'.$javascript;
|
||||
// Handle update_field array ONCHANGE
|
||||
$this->displayParams['collection_field_list'][$name]['field'] .= <<<FRA
|
||||
<script language='javascript'>
|
||||
var oldonchange = '';
|
||||
if(typeof(document.getElementById('{$collection_field_vardef['name']}').attributes.onchange) != 'undefined')
|
||||
{
|
||||
oldonchange=document.getElementById('{$collection_field_vardef['name']}').attributes.onchange.value;
|
||||
}
|
||||
FRA;
|
||||
$this->displayParams['collection_field_list'][$name]['field'] .= "eval(\"document.getElementById('{$collection_field_vardef['name']}').onchange = function onchange(event){collection['{$this->vardef['name']}'].update_fields.{$collection_field_vardef['name']}=true;";
|
||||
if($collection_field_vardef['type'] == 'relate'){
|
||||
// If relate add the ID field to the array
|
||||
$this->displayParams['collection_field_list'][$name]['field'] .= "collection['{$this->vardef['name']}'].update_fields.{$collection_field_vardef['id_name']}=true;";
|
||||
}
|
||||
$this->displayParams['collection_field_list'][$name]['field'] .= "document.getElementById('update_fields_{$this->vardef['name']}_collection').value = JSON.stringifyNoSecurity(collection['{$this->vardef['name']}'].update_fields);\" + oldonchange + \"};\");</script>{/literal}";
|
||||
//we need to get rid of the old value;
|
||||
unset($this->displayParams['collection_field_list'][$k]);
|
||||
}
|
||||
}
|
||||
if(!isset($this->displayParams['class'])) $this->displayParams['class']='';
|
||||
if(isset($this->displayParams['allow_new']) && ($this->displayParams['allow_new'] === false || $this->displayParams['allow_new'] === 'false')){
|
||||
$this->displayParams['allow_new']='false';
|
||||
$this->displayParams['class']=str_replace('sqsNoAutofill','',$this->displayParams['class']);
|
||||
}else{
|
||||
$this->displayParams['allow_new']='true';
|
||||
$this->displayParams['class'].=' sqsNoAutofill';
|
||||
}
|
||||
if(isset($this->displayParams['new_on_update']) && ($this->displayParams['new_on_update'] !== false || $this->displayParams['new_on_update'] !== 'false' || $this->displayParams['new_on_update'] !== 'FALSE' || $this->displayParams['new_on_update'] !== '0')){
|
||||
$this->displayParams['new_on_update']='true';
|
||||
}else{
|
||||
$this->displayParams['new_on_update']='false';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Init the template with the variables
|
||||
*/
|
||||
function init_tpl(){
|
||||
foreach($this->extra_var as $k=>$v){
|
||||
$this->ss->assign($k,$v);
|
||||
}
|
||||
if($this->action_type == 'editview'){
|
||||
$this->ss->assign('quickSearchCode',$this->createQuickSearchCode());
|
||||
$this->createPopupCode();// this code populate $this->displayParams with popupdata.
|
||||
$this->tpl_path = $this->edit_tpl_path;
|
||||
}else if($this->action_type == 'detailview'){
|
||||
$this->tpl_path = $this->detail_tpl_path;
|
||||
}
|
||||
|
||||
$this->ss->assign('displayParams',$this->displayParams);
|
||||
$this->ss->assign('vardef',$this->vardef);
|
||||
$this->ss->assign('module',$this->related_module);
|
||||
$this->ss->assign('values',$this->bean->{$this->value_name});
|
||||
$this->ss->assign('showSelectButton',$this->showSelectButton);
|
||||
$this->ss->assign('hideShowHideButton',$this->hideShowHideButton);
|
||||
$this->ss->assign('APP',$GLOBALS['app_strings']);
|
||||
}
|
||||
/*
|
||||
* Display the collection field after retrieving the cached row.
|
||||
*/
|
||||
function display(){
|
||||
$cacheRowFile = $GLOBALS['sugar_config']['cache_dir'] . 'modules/'. $this->module_dir . '/collections/'. $this->name . '.tpl';
|
||||
if(!$this->checkTemplate($cacheRowFile)){
|
||||
$dir = dirname($cacheRowFile);
|
||||
if(!file_exists($dir)) {
|
||||
|
||||
mkdir_recursive($dir, null, true);
|
||||
}
|
||||
$cacheRow = $this->ss->fetch('include/SugarFields/Fields/Collection/CollectionEditViewRow.tpl');
|
||||
file_put_contents($cacheRowFile, $cacheRow);
|
||||
}
|
||||
$this->ss->assign('cacheRowFile', $cacheRowFile);
|
||||
return $this->ss->fetch($this->tpl_path);
|
||||
}
|
||||
/*
|
||||
* Check if the template is cached
|
||||
* return a bool
|
||||
*/
|
||||
function checkTemplate($cacheRowFile){
|
||||
if(!empty($GLOBALS['sugar_config']['developerMode']) || !empty($_SESSION['developerMode'])){
|
||||
return false;
|
||||
}
|
||||
return file_exists($cacheRowFile);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create the quickSearch code for the collection field.
|
||||
* return the javascript code which define sqs_objects.
|
||||
*/
|
||||
function createQuickSearchCode($returnAsJavascript = true){
|
||||
$sqs_objects = array();
|
||||
require_once('include/QuickSearchDefaults.php');
|
||||
$qsd = new QuickSearchDefaults();
|
||||
$qsd->setFormName($this->form_name);
|
||||
for($i=0; $i<$this->numFields; $i++){
|
||||
$name1 = "{$this->form_name}_{$this->name}_collection_{$i}";
|
||||
if(!$this->skipModuleQuickSearch && preg_match('/(Campaigns|Teams|Users|Contacts|Accounts)/si', $this->related_module, $matches)) {
|
||||
if($matches[0] == 'Users'){
|
||||
$sqs_objects[$name1] = $qsd->getQSUser();
|
||||
} else if($matches[0] == 'Campaigns') {
|
||||
$sqs_objects[$name1] = $qsd->getQSCampaigns();
|
||||
|
||||
} else if($matches[0] == 'Users'){
|
||||
$sqs_objects[$name1] = $qsd->getQSUser();
|
||||
|
||||
} else if($matches[0] == 'Accounts') {
|
||||
$nameKey = "{$this->name}_collection_{$i}";
|
||||
$idKey = "id_{$this->name}_collection_{$i}";
|
||||
|
||||
//There are billingKey, shippingKey and additionalFields entries you can define in editviewdefs.php
|
||||
//entry to allow quick search to autocomplete fields with a suffix value of the
|
||||
//billing/shippingKey value (i.e. 'billingKey' => 'primary' in Contacts will populate
|
||||
//primary_XXX fields with the Account's billing address values).
|
||||
//addtionalFields are key/value pair of fields to fill from Accounts(key) to Contacts(value)
|
||||
$billingKey = isset($this->displayParams['billingKey']) ? $this->displayParams['billingKey'] : null;
|
||||
$shippingKey = isset($this->displayParams['shippingKey']) ? $this->displayParams['shippingKey'] : null;
|
||||
$additionalFields = isset($this->displayParams['additionalFields']) ? $this->displayParams['additionalFields'] : null;
|
||||
$sqs_objects[$name1] = $qsd->getQSAccount($nameKey, $idKey, $billingKey, $shippingKey, $additionalFields);
|
||||
} else if($matches[0] == 'Contacts'){
|
||||
$sqs_objects[$name1] = $qsd->getQSContact($name1, "id_".$name1);
|
||||
}
|
||||
$temp_array = array('field_list'=>array(),'populate_list'=>array());
|
||||
foreach($sqs_objects[$name1]['field_list'] as $k=>$v){
|
||||
if(!in_array($v, array('name','id'))){
|
||||
$sqs_objects[$name1]['primary_field_list'][]=$v;
|
||||
$sqs_objects[$name1]['primary_populate_list'][]=$sqs_objects[$name1]['populate_list'][$k];
|
||||
}else{
|
||||
$temp_array['field_list'][]=$v;
|
||||
$temp_array['populate_list'][]=$sqs_objects[$name1]['populate_list'][$k];
|
||||
}
|
||||
}
|
||||
$sqs_objects[$name1]['field_list'] = $temp_array['field_list'];
|
||||
$sqs_objects[$name1]['populate_list'] = $temp_array['populate_list'];
|
||||
if(isset($this->displayParams['collection_field_list'])){
|
||||
foreach($this->displayParams['collection_field_list'] as $v){
|
||||
$sqs_objects[$name1]['populate_list'][]= $v['vardefName']."_".$this->name."_collection_extra_".$i;
|
||||
$sqs_objects[$name1]['field_list'][] = $v['vardefName'];
|
||||
}
|
||||
}
|
||||
}else {
|
||||
$sqs_objects[$name1] = $qsd->getQSParent($this->related_module);
|
||||
$sqs_objects[$name1]['populate_list'] = array("{$this->vardef['name']}_collection_{$i}", "id_{$this->vardef['name']}_collection_{$i}");
|
||||
$sqs_objects[$name1]['field_list'] = array('name', 'id');
|
||||
if(isset($this->displayParams['collection_field_list'])){
|
||||
foreach($this->displayParams['collection_field_list'] as $v){
|
||||
$sqs_objects[$name1]['populate_list'][] = $v['vardefName']."_".$this->name."_collection_extra_".$i;
|
||||
$sqs_objects[$name1]['field_list'][] = $v['vardefName'];
|
||||
}
|
||||
}
|
||||
if(isset($this->displayParams['field_to_name_array'])){
|
||||
foreach($this->displayParams['field_to_name_array'] as $k=>$v){
|
||||
/*
|
||||
* "primary_populate_list" and "primary_field_list" are used when the field is selected as a primary.
|
||||
* At this time the JS function changePrimary() will copy "primary_populate_list" and "primary_field_list"
|
||||
* into "populate_list" and "field_list" and remove the values from all the others which are secondaries.
|
||||
* "primary_populate_list" and "primary_field_list" contain the fields which has to be populated outside of
|
||||
* the collection field. For example the "Address Information" are populated with the "billing address" of the
|
||||
* selected account in a contact editview.
|
||||
*/
|
||||
$sqs_objects[$name1]['primary_populate_list'][] = $v;
|
||||
$sqs_objects[$name1]['primary_field_list'][] = $k;
|
||||
}
|
||||
}else if(isset($field['field_list']) && isset($field['populate_list'])){
|
||||
$sqs_objects[$name1]['primary_populate_list'] = array_merge($sqs_objects[$name1]['populate_list'], $field['field_list']);
|
||||
$sqs_objects[$name1]['primary_field_list'] = array_merge($sqs_objects[$name1]['field_list'], $field['populate_list']);
|
||||
}else{
|
||||
$sqs_objects[$name1]['primary_populate_list'] = array();
|
||||
$sqs_objects[$name1]['primary_field_list'] = array();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$id = "{$this->form_name}_{$this->name}_collection_0";
|
||||
|
||||
if(!empty($sqs_objects) && count($sqs_objects) > 0) {
|
||||
foreach($sqs_objects[$id]['field_list'] as $k=>$v){
|
||||
$this->field_to_name_array[$v] = $sqs_objects[$id]['populate_list'][$k];
|
||||
}
|
||||
if($returnAsJavascript){
|
||||
$quicksearch_js = '<script language="javascript">';
|
||||
$quicksearch_js.= "if(typeof sqs_objects == 'undefined'){var sqs_objects = new Array;}";
|
||||
|
||||
foreach($sqs_objects as $sqsfield=>$sqsfieldArray){
|
||||
$quicksearch_js .= "sqs_objects['$sqsfield']={$this->json->encode($sqsfieldArray)};";
|
||||
}
|
||||
|
||||
return $quicksearch_js .= '</script>';
|
||||
}else{
|
||||
return $sqs_objects;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
/*
|
||||
* Always call createQuickSearchCode() before createPopupCode() to define field_to_name_array
|
||||
*/
|
||||
function createPopupCode(){
|
||||
// TODO the 'select' button is not fully working. We should use the sqs_objects in open_popup instead of the parameter.
|
||||
if(isset($this->field_to_name_array) && !empty($this->field_to_name_array)){
|
||||
$call_back_function = 'set_return';
|
||||
|
||||
if(isset($this->displayParams['formName'])) {
|
||||
$form = $this->displayParams['formName'];
|
||||
} else if($this->action_type == 'editview'){
|
||||
$form = 'EditView';
|
||||
} else if($this->action_type == 'quickcreate'){
|
||||
$form = "QuickCreate_{$this->module_dir}";
|
||||
}
|
||||
|
||||
if(isset($this->displayParams['call_back_function'])) {
|
||||
$call_back_function = $this->displayParams['call_back_function'];
|
||||
}
|
||||
|
||||
$popup_request_data= array(
|
||||
'call_back_function' => $call_back_function,
|
||||
'form_name' => $form,
|
||||
'field_to_name_array' => $this->field_to_name_array,
|
||||
);
|
||||
|
||||
//Make sure to replace {{ and }} with spacing in between because Smarty template parsing will treat {{ or }} specially
|
||||
$this->displayParams['popupData'] = '{literal}'. str_replace(array('{{', '}}'), array('{ {', '} }'), $this->json->encode($popup_request_data)) . '{/literal}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
42
include/SugarFields/Fields/Collection/view.sugarfieldcollection.php
Executable file
42
include/SugarFields/Fields/Collection/view.sugarfieldcollection.php
Executable file
@@ -0,0 +1,42 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
require_once('include/SugarFields/Fields/Collection/ViewSugarFieldCollection.php');
|
||||
$view = new ViewSugarFieldCollection();
|
||||
$view->setup();
|
||||
$view->process();
|
||||
$view->init_tpl();
|
||||
echo $view->display();
|
||||
?>
|
||||
42
include/SugarFields/Fields/Currency/DetailView.tpl
Executable file
42
include/SugarFields/Fields/Currency/DetailView.tpl
Executable file
@@ -0,0 +1,42 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<span id='{{sugarvar key='name'}}'>
|
||||
{sugar_number_format var={{sugarvar key='value' stringFormat='false'}} }
|
||||
</span>
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
43
include/SugarFields/Fields/Currency/EditView.tpl
Executable file
43
include/SugarFields/Fields/Currency/EditView.tpl
Executable file
@@ -0,0 +1,43 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 strlen({{sugarvar key='value' string=true}}) <= 0}
|
||||
{assign var="value" value={{sugarvar key='default_value' string=true}} }
|
||||
{else}
|
||||
{assign var="value" value={{sugarvar key='value' string=true}} }
|
||||
{/if}
|
||||
<input type='text' name='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}'
|
||||
id='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}' size='{{$displayParams.size|default:30}}' {{if isset($displayParams.maxlength)}}maxlength='{{$displayParams.maxlength}}'{{elseif isset($vardef.len)}}maxlength='{{$varderlen}}'{{/if}} value='{sugar_number_format var=$value}' title='{{$vardef.help}}' tabindex='{{$tabindex}}' {{$displayParams.field}}>
|
||||
42
include/SugarFields/Fields/Currency/ListView.tpl
Executable file
42
include/SugarFields/Fields/Currency/ListView.tpl
Executable file
@@ -0,0 +1,42 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{sugar_fetch object=$parentFieldArray key=$col assign='amount'}
|
||||
{if stripos(strtoupper($col), '_USD') || empty($currency_id)}
|
||||
{sugar_currency_format var=$amount}
|
||||
{else}
|
||||
{sugar_currency_format var=$amount currency_id=$currency_id}
|
||||
{/if}
|
||||
59
include/SugarFields/Fields/Currency/SugarFieldCurrency.php
Executable file
59
include/SugarFields/Fields/Currency/SugarFieldCurrency.php
Executable file
@@ -0,0 +1,59 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/SugarFields/Fields/Float/SugarFieldFloat.php');
|
||||
|
||||
class SugarFieldCurrency extends SugarFieldFloat {
|
||||
function getListViewSmarty($parentFieldArray, $vardef, $displayParams, $col) {
|
||||
$tabindex = 1;
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex, false);
|
||||
|
||||
$this->ss->left_delimiter = '{';
|
||||
$this->ss->right_delimiter = '}';
|
||||
$this->ss->assign('col',strtoupper($vardef['name']));
|
||||
if(is_object($parentFieldArray) ){
|
||||
if(!empty($parentFieldArray->currency_id)) {
|
||||
$this->ss->assign('currency_id',$parentFieldArray->currency_id);
|
||||
}
|
||||
} else if (!empty($parentFieldArray['CURRENCY_ID'])) {
|
||||
$this->ss->assign('currency_id',$parentFieldArray['CURRENCY_ID']);
|
||||
} else if (!empty($parentFieldArray['currency_id'])) {
|
||||
$this->ss->assign('currency_id',$parentFieldArray['currency_id']);
|
||||
}
|
||||
return $this->fetch($this->findTemplate('ListView'));
|
||||
}
|
||||
}
|
||||
63
include/SugarFields/Fields/Datetime/EditView.tpl
Executable file
63
include/SugarFields/Fields/Datetime/EditView.tpl
Executable file
@@ -0,0 +1,63 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{{capture name=idname assign=idname}}{{sugarvar key='name'}}{{/capture}}
|
||||
{{if !empty($displayParams.idName)}}
|
||||
{{assign var=idname value=$displayParams.idName}}
|
||||
{{/if}}
|
||||
|
||||
{assign var=date_value value={{sugarvar key='value' string=true}} }
|
||||
<input autocomplete="off" type="text" name="{{$idname}}" id="{{$idname}}" value="{$date_value}" title='{{$vardef.help}}' {{$displayParams.field}} tabindex='{{$tabindex}}' size="11" maxlength="10">
|
||||
{{if !$displayParams.hiddeCalendar}}
|
||||
<img border="0" src="{sugar_getimagepath file='jscalendar.gif'}" alt="{$APP.LBL_ENTER_DATE}" id="{{$idname}}_trigger" align="absmiddle" />
|
||||
{{/if}}
|
||||
{{if $displayParams.showFormats}}
|
||||
(<span class="dateFormat">{$USER_DATEFORMAT}</span>)
|
||||
{{/if}}
|
||||
{{if !$displayParams.hiddeCalendar}}
|
||||
<script type="text/javascript">
|
||||
Calendar.setup ({ldelim}
|
||||
inputField : "{{$idname}}",
|
||||
daFormat : "{$CALENDAR_FORMAT}",
|
||||
button : "{{$idname}}_trigger",
|
||||
singleClick : true,
|
||||
dateStr : "{$date_value}",
|
||||
step : 1,
|
||||
weekNumbers:false
|
||||
{rdelim}
|
||||
);
|
||||
</script>
|
||||
{{/if}}
|
||||
138
include/SugarFields/Fields/Datetime/SearchView.tpl
Normal file
138
include/SugarFields/Fields/Datetime/SearchView.tpl
Normal file
@@ -0,0 +1,138 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
|
||||
{{capture name=idname assign=idname}}{{sugarvar key='name'}}{{/capture}}
|
||||
{{if !empty($displayParams.idName)}}
|
||||
{{assign var=idname value=$displayParams.idName}}
|
||||
|
||||
{{/if}}
|
||||
|
||||
{assign var=date_value_from value={{sugarvar key='value_from' string=true}} }
|
||||
{assign var=date_value_to value={{sugarvar key='value_to' string=true}} }
|
||||
<input placeholder="Od" autocomplete="off" type="text" name="{{$idname}}_from" id="{{$idname}}_from" value="{$date_value_from}" title='{{$vardef.help}}' {{$displayParams.field}} tabindex='{{$tabindex}}' size="10" maxlength="10">
|
||||
{{if !$displayParams.hiddeCalendar}}
|
||||
<img border="0" src="{sugar_getimagepath file='jscalendar.gif'}" alt="{$APP.LBL_ENTER_DATE}" id="{{$idname}}_trigger_from" align="absmiddle" />
|
||||
{{/if}}
|
||||
{{if $displayParams.showFormats}}
|
||||
(<span class="dateFormat">{$USER_DATEFORMAT}</span>)
|
||||
{{/if}}
|
||||
<br>
|
||||
<input placeholder="Do" autocomplete="off" type="text" name="{{$idname}}_to" id="{{$idname}}_to" value="{$date_value_to}" title='{{$vardef.help}}' {{$displayParams.field}} tabindex='{{$tabindex}}' size="10" maxlength="10">
|
||||
{{if !$displayParams.hiddeCalendar}}
|
||||
<img border="0" src="{sugar_getimagepath file='jscalendar.gif'}" alt="{$APP.LBL_ENTER_DATE}" id="{{$idname}}_trigger_to" align="absmiddle" />
|
||||
{{/if}}
|
||||
{{if $displayParams.showFormats}}
|
||||
(<span class="dateFormat">{$USER_DATEFORMAT}</span>)
|
||||
{{/if}}
|
||||
{{if !$displayParams.hiddeCalendar}}
|
||||
<script type="text/javascript">
|
||||
Calendar.setup ({ldelim}
|
||||
inputField : "{{$idname}}_from",
|
||||
daFormat : "{$CALENDAR_FORMAT}",
|
||||
button : "{{$idname}}_trigger_from",
|
||||
singleClick : true,
|
||||
dateStr : "{$date_value}",
|
||||
step : 1,
|
||||
weekNumbers:false
|
||||
{rdelim}
|
||||
);
|
||||
Calendar.setup ({ldelim}
|
||||
inputField : "{{$idname}}_to",
|
||||
daFormat : "{$CALENDAR_FORMAT}",
|
||||
button : "{{$idname}}_trigger_to",
|
||||
singleClick : true,
|
||||
dateStr : "{$date_value}",
|
||||
step : 1,
|
||||
weekNumbers:false
|
||||
{rdelim}
|
||||
);
|
||||
{literal}
|
||||
function isDate(txtDate)
|
||||
{
|
||||
var currVal = txtDate;
|
||||
if(currVal == '')
|
||||
return true;
|
||||
|
||||
var rxDatePattern = /^(\d{1,2})(\.)(\d{1,2})(\.)(\d{4})$/; //Declare Regex
|
||||
var dtArray = currVal.match(rxDatePattern); // is format OK?
|
||||
|
||||
if (dtArray == null)
|
||||
return false;
|
||||
|
||||
//Checks for dd/mm/yyyy
|
||||
dtMonth = dtArray[3];
|
||||
dtDay= dtArray[1];
|
||||
dtYear = dtArray[5];
|
||||
|
||||
if (dtMonth < 1 || dtMonth > 12)
|
||||
return false;
|
||||
else if (dtDay < 1 || dtDay> 31)
|
||||
return false;
|
||||
else if ((dtMonth==4 || dtMonth==6 || dtMonth==9 || dtMonth==11) && dtDay ==31)
|
||||
return false;
|
||||
else if (dtMonth == 2)
|
||||
{
|
||||
var isleap = (dtYear % 4 == 0 && (dtYear % 100 != 0 || dtYear % 400 == 0));
|
||||
if (dtDay> 29 || (dtDay ==29 && !isleap))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
$(document).ready(function() {
|
||||
var options = {
|
||||
onComplete: function(cep) {
|
||||
if(isDate(cep))
|
||||
$('{/literal}#{{$idname}}{literal}').css("color", "");
|
||||
else
|
||||
$('{/literal}#{{$idname}}{literal}').css("color", "red");
|
||||
return;
|
||||
},
|
||||
'translation': {
|
||||
A: {pattern: /[0-3]/},
|
||||
B: {pattern: /[0-9]/},
|
||||
C: {pattern: /[0-1]/},
|
||||
D: {pattern: /[0-9]/},
|
||||
Y: {pattern: /[0-9]/}
|
||||
},
|
||||
selectOnFocus: true
|
||||
};
|
||||
$('{/literal}#{{$idname}}_from{literal}').mask('AB.CD.YYYY', options);
|
||||
$('{/literal}#{{$idname}}_to{literal}').mask('AB.CD.YYYY', options);
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
{{/if}}
|
||||
115
include/SugarFields/Fields/Datetime/SugarFieldDatetime.php
Executable file
115
include/SugarFields/Fields/Datetime/SugarFieldDatetime.php
Executable file
@@ -0,0 +1,115 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
require_once('include/SugarFields/Fields/Base/SugarFieldBase.php');
|
||||
|
||||
class SugarFieldDatetime extends SugarFieldBase {
|
||||
|
||||
function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
|
||||
// Create Smarty variables for the Calendar picker widget
|
||||
if(!isset($displayParams['showMinutesDropdown'])) {
|
||||
$displayParams['showMinutesDropdown'] = false;
|
||||
}
|
||||
|
||||
if(!isset($displayParams['showHoursDropdown'])) {
|
||||
$displayParams['showHoursDropdown'] = false;
|
||||
}
|
||||
|
||||
if(!isset($displayParams['showNoneCheckbox'])) {
|
||||
$displayParams['showNoneCheckbox'] = false;
|
||||
}
|
||||
|
||||
if(!isset($displayParams['showFormats'])) {
|
||||
$displayParams['showFormats'] = false;
|
||||
}
|
||||
|
||||
if(!isset($displayParams['hiddeCalendar'])) {
|
||||
$displayParams['hiddeCalendar'] = false;
|
||||
}
|
||||
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
//jchi , bug #24557 , 10/31/2008
|
||||
if(isset($vardef['name']) && ($vardef['name'] == 'date_entered' || $vardef['name'] == 'date_modified')){
|
||||
return $this->fetch('include/SugarFields/Fields/Base/DetailView.tpl');
|
||||
}
|
||||
//end
|
||||
return $this->fetch('include/SugarFields/Fields/Datetime/SearchView.tpl');
|
||||
}
|
||||
|
||||
function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
|
||||
// Create Smarty variables for the Calendar picker widget
|
||||
if(!isset($displayParams['showMinutesDropdown'])) {
|
||||
$displayParams['showMinutesDropdown'] = false;
|
||||
}
|
||||
|
||||
if(!isset($displayParams['showHoursDropdown'])) {
|
||||
$displayParams['showHoursDropdown'] = false;
|
||||
}
|
||||
|
||||
if(!isset($displayParams['showNoneCheckbox'])) {
|
||||
$displayParams['showNoneCheckbox'] = false;
|
||||
}
|
||||
|
||||
if(!isset($displayParams['showFormats'])) {
|
||||
$displayParams['showFormats'] = false;
|
||||
}
|
||||
|
||||
if(!isset($displayParams['hiddeCalendar'])) {
|
||||
$displayParams['hiddeCalendar'] = false;
|
||||
}
|
||||
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
//jchi , bug #24557 , 10/31/2008
|
||||
if(isset($vardef['name']) && ($vardef['name'] == 'date_entered' || $vardef['name'] == 'date_modified')){
|
||||
return $this->fetch('include/SugarFields/Fields/Base/DetailView.tpl');
|
||||
}
|
||||
//end
|
||||
return $this->fetch('include/SugarFields/Fields/Datetime/EditView.tpl');
|
||||
}
|
||||
|
||||
|
||||
public function save(&$bean, &$inputData, &$field, &$def, $prefix = '') {
|
||||
global $timedate;
|
||||
if ( !isset($inputData[$prefix.$field]) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$offset = strlen(trim($inputData[$prefix.$field])) < 11 ? false : true;
|
||||
$bean->$field = $timedate->to_db_date($inputData[$prefix.$field], $offset);
|
||||
}
|
||||
}
|
||||
?>
|
||||
50
include/SugarFields/Fields/Datetimecombo/Datetimecombo.js
Normal file
50
include/SugarFields/Fields/Datetimecombo/Datetimecombo.js
Normal 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".
|
||||
********************************************************************************/
|
||||
function Datetimecombo(datetime,field,timeformat,tabindex,showCheckbox,checked,allowEmptyHM){this.datetime=datetime;this.allowEmptyHM=allowEmptyHM;if(typeof this.datetime=="undefined"||datetime==''||trim(datetime).length<10){this.datetime="";var d=new Date();var month=d.getMonth();var date=d.getDate();var year=d.getYear();var hours=d.getHours();var minutes=d.getMinutes();}
|
||||
this.fieldname=field;this.hrs=parseInt(datetime.substring(11,13),10);this.mins=parseInt(datetime.substring(14,16),10);if(this.mins>0&&this.mins<15){this.mins=15;}else if(this.mins>15&&this.mins<30){this.mins=30;}else if(this.mins>30&&this.mins<45){this.mins=45;}else if(this.mins>45){this.hrs+=1;this.mins=0;}
|
||||
this.timeformat=timeformat;this.tabindex=tabindex==null||isNaN(tabindex)?1:tabindex;this.timeseparator=this.timeformat.substring(2,3);this.has12Hours=/^11/.test(this.timeformat);this.hasMeridiem=/am|pm/i.test(this.timeformat);if(this.hasMeridiem){this.pm=/pm/.test(this.timeformat);}
|
||||
this.meridiem=this.hasMeridiem?trim(this.datetime.substring(16)):'';this.datetime=this.datetime.substr(0,10);this.showCheckbox=showCheckbox;this.checked=checked;document.getElementById(this.fieldname+'_date').value=this.datetime;}
|
||||
Datetimecombo.prototype.jsscript=function(callback){text='\nfunction update_'+this.fieldname+'(calendar) {';text+='\nif(calendar != null) {';text+='\ncalendar.onUpdateTime();';text+='\ncalendar.onSetTime();';text+='\ncalendar.hide();';text+='\n}'
|
||||
text+='\nd = document.getElementById("'+this.fieldname+'_date").value;';text+='\nh = document.getElementById("'+this.fieldname+'_hours").value;';text+='\nm = document.getElementById("'+this.fieldname+'_minutes").value;';text+='\nnewdate = d + " " + h + "'+this.timeseparator+'" + m;';if(this.hasMeridiem){text+='\nif(typeof document.getElementById("'+this.fieldname+'_meridiem") != "undefined") {';text+='\n newdate += document.getElementById("'+this.fieldname+'_meridiem").value;';text+='\n}';}
|
||||
text+='\nif(trim(newdate) =="'+this.timeseparator+'") newdate="";';text+='\ndocument.getElementById("'+this.fieldname+'").value = newdate;';text+='\n'+callback;text+='\n}';return text;}
|
||||
Datetimecombo.prototype.html=function(callback){var text='<select class="datetimecombo_time" size="1" id="'+this.fieldname+'_hours" tabindex="'+this.tabindex+'" onchange="combo_'+this.fieldname+'.update(); '+callback+'">';var h1=this.has12Hours?1:0;var h2=this.has12Hours?12:23;if(this.allowEmptyHM){text+='<option></option>';}
|
||||
for(i=h1;i<=h2;i++){val=i<10?"0"+i:i;text+='<option value="'+val+'" '+(i==this.hrs?"SELECTED":"")+'>'+val+'</option>';}
|
||||
text+='\n</select> ';text+=this.timeseparator;text+='\n <select class="datetimecombo_time" size="1" id="'+this.fieldname+'_minutes" tabindex="'+this.tabindex+'" onchange="combo_'+this.fieldname+'.update(); '+callback+'">';if(this.allowEmptyHM){text+='\n<option></option>';}
|
||||
text+='\n<option value="00" '+(this.mins==0?"SELECTED":"")+'>00</option>';text+='\n<option value="15" '+(this.mins==15?"SELECTED":"")+'>15</option>';text+='\n<option value="30" '+(this.mins==30?"SELECTED":"")+'>30</option>';text+='\n<option value="45" '+(this.mins==45?"SELECTED":"")+'>45</option>';text+='\n</select>';if(this.hasMeridiem){text+='\n ';text+='\n<select class="datetimecombo_time" size="1" id="'+this.fieldname+'_meridiem" tabindex="'+this.tabindex+'" onchange="combo_'+this.fieldname+'.update(); '+callback+'">';if(this.allowEmptyHM){text+='\n<option></option>';}
|
||||
text+='\n<option value="'+(this.pm?"am":"AM")+'" '+(/am/i.test(this.meridiem)?"SELECTED":"")+'>'+(this.pm?"am":"AM")+'</option>';text+='\n<option value="'+(this.pm?"pm":"PM")+'" '+(/pm/i.test(this.meridiem)?"SELECTED":"")+'>'+(this.pm?"pm":"PM")+'</option>';text+='\n</select>';}
|
||||
if(this.showCheckbox){text+='\n<input style="visibility:hidden;" type="checkbox" name="'+this.fieldname+'_flag" id="'+this.fieldname+'_flag" tabindex="'+this.tabindex+'" onchange="combo_'+this.fieldname+'.update(); '+callback+'" '+(this.checked?'CHECKED':'')+'>';}
|
||||
return text;};Datetimecombo.prototype.update=function(){id=this.fieldname+'_date';d=window.document.getElementById(id).value;id=this.fieldname+'_hours';h=window.document.getElementById(id).value;id=this.fieldname+'_minutes';m=window.document.getElementById(id).value;newdate=d+' '+h+this.timeseparator+m;if(this.hasMeridiem){ampm=document.getElementById(this.fieldname+"_meridiem").value;newdate+=ampm;}
|
||||
if(trim(newdate)==""+this.timeseparator+""){newdate='';}
|
||||
document.getElementById(this.fieldname).value=newdate;if(this.showCheckbox){flag=this.fieldname+'_flag';date=this.fieldname+'_date';hours=this.fieldname+'_hours';mins=this.fieldname+'_minutes';if(document.getElementById(flag).checked){document.getElementById(flag).value=1;document.getElementById(this.fieldname).value='';document.getElementById(date).disabled=true;document.getElementById(hours).disabled=true;document.getElementById(mins).disabled=true;}else{document.getElementById(flag).value=0;document.getElementById(date).disabled=false;document.getElementById(hours).disabled=false;document.getElementById(mins).disabled=false;}}};
|
||||
120
include/SugarFields/Fields/Datetimecombo/EditView.tpl
Executable file
120
include/SugarFields/Fields/Datetimecombo/EditView.tpl
Executable file
@@ -0,0 +1,120 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{{capture name=idname assign=idname}}{{sugarvar key='name'}}{{/capture}}
|
||||
{{if !empty($displayParams.idName)}}
|
||||
{{assign var=idname value=$displayParams.idName}}
|
||||
{{/if}}
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr valign="middle">
|
||||
<td nowrap>
|
||||
<input autocomplete="off" type="text" id="{{$idname}}_date" value="{$fields[{{sugarvar key='name' stringFormat=true}}].value}" size="11" maxlength="10" title='{{$vardef.help}}' tabindex="{{$tabindex}}" onblur="combo_{{$idname}}.update(); {{if isset($displayParams.updateCallback)}}{{$displayParams.updateCallback}}{{/if}}">
|
||||
<img border="0" src="{sugar_getimagepath file='jscalendar.gif'}" alt="{$APP.LBL_ENTER_DATE}" id="{{$idname}}_trigger" align="absmiddle">
|
||||
{{if empty($displayParams.splitDateTime)}}
|
||||
</td>
|
||||
<td nowrap>
|
||||
{{else}}
|
||||
<br>
|
||||
{{/if}}
|
||||
<div id="{{$idname}}_time_section"></div>
|
||||
{{if $displayParams.showNoneCheckbox}}
|
||||
<script type="text/javascript">
|
||||
function set_{{$idname}}_values(form) {ldelim}
|
||||
if(form.{{$idname}}_flag.checked) {ldelim}
|
||||
form.{{$idname}}_flag.value=1;
|
||||
form.{{$idname}}.value="";
|
||||
form.{{$idname}}.readOnly=true;
|
||||
{rdelim} else {ldelim}
|
||||
form.{{$idname}}_flag.value=0;
|
||||
form.{{$idname}}.readOnly=false;
|
||||
{rdelim}
|
||||
{rdelim}
|
||||
</script>
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{if $displayParams.showFormats}}
|
||||
<tr valign="middle">
|
||||
<td nowrap>
|
||||
<span class="dateFormat">{$USER_DATEFORMAT}</span>
|
||||
</td>
|
||||
<td nowrap>
|
||||
<span class="dateFormat">{$TIME_FORMAT}</span>
|
||||
</td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
</table>
|
||||
<input type="hidden" id="{{$idname}}" name="{{$idname}}" value="{$fields[{{sugarvar key='name' stringFormat=true}}].value}">
|
||||
<script type="text/javascript" src="include/SugarFields/Fields/Datetimecombo/Datetimecombo.js"></script>
|
||||
<script type="text/javascript">
|
||||
var combo_{{$idname}} = new Datetimecombo("{$fields[{{sugarvar key='name' stringFormat=true}}].value}", "{{$idname}}", "{$TIME_FORMAT}", "{{$tabindex}}", '{{$displayParams.showNoneCheckbox}}', '{$fields[{{sugarvar key='name' stringFormat=true}}_flag].value}', true);
|
||||
//Render the remaining widget fields
|
||||
text = combo_{{$idname}}.html('{{$displayParams.updateCallback}}');
|
||||
document.getElementById('{{$idname}}_time_section').innerHTML = text;
|
||||
|
||||
//Call eval on the update function to handle updates to calendar picker object
|
||||
eval(combo_{{$idname}}.jsscript('{{$displayParams.updateCallback}}'));
|
||||
|
||||
addToValidate('{$form_name}',"{{$idname}}_date",'date',false,"{{$idname}}");
|
||||
addToValidateBinaryDependency('{$form_name}',"{{$idname}}_hours", 'alpha', false, "{$APP.ERR_MISSING_REQUIRED_FIELDS} {$APP.LBL_HOURS}" ,"{{$idname}}_date");
|
||||
addToValidateBinaryDependency('{$form_name}', "{{$idname}}_minutes", 'alpha', false, "{$APP.ERR_MISSING_REQUIRED_FIELDS} {$APP.LBL_MINUTES}" ,"{{$idname}}_date");
|
||||
addToValidateBinaryDependency('{$form_name}', "{{$idname}}_meridiem", 'alpha', false, "{$APP.ERR_MISSING_REQUIRED_FIELDS} {$APP.LBL_MERIDIEM}","{{$idname}}_date");
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function update_{{$idname}}_available() {ldelim}
|
||||
YAHOO.util.Event.onAvailable("{{$idname}}_date", this.handleOnAvailable, this);
|
||||
{rdelim}
|
||||
|
||||
update_{{$idname}}_available.prototype.handleOnAvailable = function(me) {ldelim}
|
||||
|
||||
Calendar.setup ({ldelim}
|
||||
onClose : update_{{$idname}},
|
||||
inputField : "{{$idname}}_date",
|
||||
ifFormat : "{$CALENDAR_FORMAT}",
|
||||
daFormat : "{$CALENDAR_FORMAT}",
|
||||
button : "{{$idname}}_trigger",
|
||||
singleClick : true,
|
||||
step : 1,
|
||||
weekNumbers:false
|
||||
{rdelim});
|
||||
|
||||
//Call update for first time to round hours and minute values
|
||||
combo_{{$idname}}.update();
|
||||
{rdelim}
|
||||
|
||||
var obj_{{$idname}} = new update_{{$idname}}_available();
|
||||
</script>
|
||||
110
include/SugarFields/Fields/Datetimecombo/SearchView.tpl
Executable file
110
include/SugarFields/Fields/Datetimecombo/SearchView.tpl
Executable file
@@ -0,0 +1,110 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 border="0" cellpadding="0" cellspacing="0">
|
||||
<tr valign="middle">
|
||||
<td nowrap>
|
||||
<input autocomplete="off" type="text" id="{{sugarvar key='name'}}_date" value="{$fields[{{sugarvar key='name' stringFormat=true}}].value}" size="11" maxlength="10" title='{{$vardef.help}}' tabindex="{{$tabindex}}" onblur="combo_{{sugarvar key='name'}}.update(); {{if isset($displayParams.updateCallback)}}{{$displayParams.updateCallback}}{{/if}}">
|
||||
<img border="0" src="{sugar_getimagepath file='jscalendar.gif'}" alt="{$APP.LBL_ENTER_DATE}" id="{{sugarvar key='name'}}_trigger" align="absmiddle">
|
||||
{{if empty($displayParams.splitDateTime)}}
|
||||
</td>
|
||||
<td nowrap>
|
||||
{{else}}
|
||||
<br>
|
||||
{{/if}}
|
||||
<div id="{{sugarvar key='name'}}_time_section"></div>
|
||||
{{if $displayParams.showNoneCheckbox}}
|
||||
<script type="text/javascript">
|
||||
function set_{{sugarvar key='name'}}_values(form) {ldelim}
|
||||
if(form.{{sugarvar key='name'}}_flag.checked) {ldelim}
|
||||
form.{{sugarvar key='name'}}_flag.value=1;
|
||||
form.{{sugarvar key='name'}}.value="";
|
||||
form.{{sugarvar key='name'}}.readOnly=true;
|
||||
{rdelim} else {ldelim}
|
||||
form.{{sugarvar key='name'}}_flag.value=0;
|
||||
form.{{sugarvar key='name'}}.readOnly=false;
|
||||
{rdelim}
|
||||
{rdelim}
|
||||
</script>
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{if $displayParams.showFormats}}
|
||||
<tr valign="middle">
|
||||
<td nowrap>
|
||||
<span class="dateFormat">{$USER_DATEFORMAT}</span>
|
||||
</td>
|
||||
<td nowrap>
|
||||
<span class="dateFormat">{$TIME_FORMAT}</span>
|
||||
</td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
</table>
|
||||
<input type="hidden" id="{{sugarvar key='name'}}" name="{{sugarvar key='name'}}" value="{$fields[{{sugarvar key='name' stringFormat=true}}].value}">
|
||||
<script type="text/javascript" src="include/SugarFields/Fields/Datetimecombo/Datetimecombo.js"></script>
|
||||
<script type="text/javascript">
|
||||
var combo_{{sugarvar key='name'}} = new Datetimecombo("{$fields[{{sugarvar key='name' stringFormat=true}}].value}", "{{sugarvar key='name'}}", "{$TIME_FORMAT}", "{{$tabindex}}", '{{$displayParams.showNoneCheckbox}}', '{$fields[{{sugarvar key='name' stringFormat=true}}_flag].value}', true);
|
||||
//Render the remaining widget fields
|
||||
text = combo_{{sugarvar key='name'}}.html('{{$displayParams.updateCallback}}');
|
||||
document.getElementById('{{sugarvar key='name'}}_time_section').innerHTML = text;
|
||||
|
||||
//Call eval on the update function to handle updates to calendar picker object
|
||||
eval(combo_{{sugarvar key='name'}}.jsscript('{{$displayParams.updateCallback}}'));
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function update_{{sugarvar key='name'}}_available() {ldelim}
|
||||
YAHOO.util.Event.onAvailable("{{sugarvar key='name'}}_date", this.handleOnAvailable, this);
|
||||
{rdelim}
|
||||
|
||||
update_{{sugarvar key='name'}}_available.prototype.handleOnAvailable = function(me) {ldelim}
|
||||
Calendar.setup ({ldelim}
|
||||
onClose : update_{{sugarvar key='name'}},
|
||||
inputField : "{{sugarvar key='name'}}_date",
|
||||
ifFormat : "{$CALENDAR_FORMAT}",
|
||||
daFormat : "{$CALENDAR_FORMAT}",
|
||||
button : "{{sugarvar key='name'}}_trigger",
|
||||
singleClick : true,
|
||||
step : 1,
|
||||
weekNumbers:false
|
||||
{rdelim});
|
||||
|
||||
//Call update for first time to round hours and minute values
|
||||
combo_{{sugarvar key='name'}}.update();
|
||||
{rdelim}
|
||||
|
||||
var obj_{{sugarvar key='name'}} = new update_{{sugarvar key='name'}}_available();
|
||||
</script>
|
||||
109
include/SugarFields/Fields/Datetimecombo/SugarFieldDatetimecombo.php
Executable file
109
include/SugarFields/Fields/Datetimecombo/SugarFieldDatetimecombo.php
Executable file
@@ -0,0 +1,109 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
require_once('include/SugarFields/Fields/Base/SugarFieldBase.php');
|
||||
|
||||
class SugarFieldDatetimecombo extends SugarFieldBase {
|
||||
|
||||
function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
// Create Smarty variables for the Calendar picker widget
|
||||
if(!isset($displayParams['showMinutesDropdown'])) {
|
||||
$displayParams['showMinutesDropdown'] = false;
|
||||
}
|
||||
|
||||
if(!isset($displayParams['showHoursDropdown'])) {
|
||||
$displayParams['showHoursDropdown'] = false;
|
||||
}
|
||||
|
||||
if(!isset($displayParams['showNoneCheckbox'])) {
|
||||
$displayParams['showNoneCheckbox'] = false;
|
||||
}
|
||||
|
||||
if(!isset($displayParams['showFormats'])) {
|
||||
$displayParams['showFormats'] = false;
|
||||
}
|
||||
|
||||
global $timedate;
|
||||
$displayParams['dateFormat'] = $timedate->get_cal_date_format();
|
||||
|
||||
$displayParams['timeFormat'] = $timedate->get_user_time_format();
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/Datetimecombo/EditView.tpl');
|
||||
}
|
||||
|
||||
function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
// Create Smarty variables for the Calendar picker widget
|
||||
if(!isset($displayParams['showMinutesDropdown'])) {
|
||||
$displayParams['showMinutesDropdown'] = false;
|
||||
}
|
||||
|
||||
if(!isset($displayParams['showHoursDropdown'])) {
|
||||
$displayParams['showHoursDropdown'] = false;
|
||||
}
|
||||
|
||||
if(!isset($displayParams['showNoneCheckbox'])) {
|
||||
$displayParams['showNoneCheckbox'] = false;
|
||||
}
|
||||
|
||||
if(!isset($displayParams['showFormats'])) {
|
||||
$displayParams['showFormats'] = false;
|
||||
}
|
||||
|
||||
global $timedate;
|
||||
$displayParams['dateFormat'] = $timedate->get_cal_date_format();
|
||||
|
||||
$displayParams['timeFormat'] = $timedate->get_user_time_format();
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/Datetimecombo/SearchView.tpl');
|
||||
}
|
||||
|
||||
|
||||
public function save(&$bean, &$inputData, &$field, &$def, $prefix = '') {
|
||||
global $timedate;
|
||||
if ( !isset($inputData[$prefix.$field]) ) {
|
||||
//$bean->$field = '';
|
||||
return;
|
||||
}
|
||||
|
||||
if(strpos($inputData[$prefix.$field], ' ') > 0) {
|
||||
$bean->$field = $timedate->to_db($inputData[$prefix.$field]);
|
||||
} else {
|
||||
$GLOBALS['log']->error('Field ' . $prefix.$field . ' expecting datetime format, but got value: ' . $inputData[$prefix.$field]);
|
||||
//Default to assume date format value
|
||||
$bean->$field = $timedate->to_db_date($inputData[$prefix.$field]);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
41
include/SugarFields/Fields/Download/DetailView.tpl
Executable file
41
include/SugarFields/Fields/Download/DetailView.tpl
Executable file
@@ -0,0 +1,41 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<a href="index.php?entryPoint=download&id={{$vardef.value}}&type={$module}">{$fields.filename.value}</a>
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
|
||||
47
include/SugarFields/Fields/Download/SugarFieldDownload.php
Executable file
47
include/SugarFields/Fields/Download/SugarFieldDownload.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
require_once('include/SugarFields/Fields/Base/SugarFieldBase.php');
|
||||
|
||||
class SugarFieldDownload extends SugarFieldBase {
|
||||
|
||||
function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
|
||||
$vardef['value'] = urlencode(basename($vardef['value']));
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/Download/DetailView.tpl');
|
||||
}
|
||||
}
|
||||
?>
|
||||
46
include/SugarFields/Fields/Enum/DetailView.tpl
Executable file
46
include/SugarFields/Fields/Enum/DetailView.tpl
Executable file
@@ -0,0 +1,46 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{* This is here so currency fields, who don't really have dropdown
|
||||
lists can work. *}
|
||||
{if is_string({{sugarvar key='options' string=true}})}
|
||||
{ {{sugarvar key='options' string=true}}}
|
||||
{else if}
|
||||
{ {{sugarvar key='options' string=true}}[{{sugarvar key='value' string=true}}]}
|
||||
{/if}
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
40
include/SugarFields/Fields/Enum/DetailViewFunction.tpl
Executable file
40
include/SugarFields/Fields/Enum/DetailViewFunction.tpl
Executable file
@@ -0,0 +1,40 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{{sugarvar key='value'}}
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
62
include/SugarFields/Fields/Enum/EditView.tpl
Executable file
62
include/SugarFields/Fields/Enum/EditView.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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
|
||||
{*List of doms which are not editable*}
|
||||
{assign var='ne' value=','|explode:"ecmlanguage,currency_id"}
|
||||
{if empty($displayParams.idName) && !({{sugarvar key='name' string=true}}|in_array:$ne)}
|
||||
<img
|
||||
src="themes/Sugar5/images/edit_inline.gif"
|
||||
name="{{sugarvar key='name'}}_launcher"
|
||||
onclick="EcmDropdownEditor_show(
|
||||
'{{sugarvar key='name'}}___ecmdropdowneditor_container'
|
||||
);" style="cursor: pointer"></img>
|
||||
<div style="width: 100%; height: 100%; display:none"
|
||||
name="{{sugarvar key='name'}}___ecmdropdowneditor_container"
|
||||
></div>
|
||||
{/if}
|
||||
|
||||
<select name="{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}"
|
||||
id="{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}"
|
||||
title='{{$vardef.help}}' tabindex="{{$tabindex}}" {{$displayParams.field}}
|
||||
{{if isset($displayParams.javascript)}}{{$displayParams.javascript}}{{/if}}>
|
||||
|
||||
{if isset({{sugarvar key='value' string=true}}) && {{sugarvar key='value' string=true}} != ''}
|
||||
{html_options options={{sugarvar key='options' string=true}} selected={{sugarvar key='value' string=true}}}
|
||||
{else}
|
||||
{html_options options={{sugarvar key='options' string=true}} selected={{sugarvar key='default' string=true}}}
|
||||
{/if}
|
||||
</select>
|
||||
39
include/SugarFields/Fields/Enum/EditViewFunction.tpl
Executable file
39
include/SugarFields/Fields/Enum/EditViewFunction.tpl
Executable file
@@ -0,0 +1,39 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<select name="{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}">
|
||||
{{sugarvar key='value'}}
|
||||
</select>
|
||||
38
include/SugarFields/Fields/Enum/SearchView.tpl
Executable file
38
include/SugarFields/Fields/Enum/SearchView.tpl
Executable file
@@ -0,0 +1,38 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{{capture name=display_size assign=size}}{{$displayParams.size|default:6}}{{/capture}}
|
||||
{html_options name='{{$vardef.name}}[]' options={{sugarvar key='options' string=true}} size="{{$size}}" style="width: 150px" {{if $size > 1}}multiple="1"{{/if}} selected={{sugarvar key='value' string=true}}}
|
||||
107
include/SugarFields/Fields/Enum/SugarFieldEnum.php
Executable file
107
include/SugarFields/Fields/Enum/SugarFieldEnum.php
Executable file
@@ -0,0 +1,107 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
require_once('include/SugarFields/Fields/Base/SugarFieldBase.php');
|
||||
|
||||
class SugarFieldEnum extends SugarFieldBase {
|
||||
|
||||
function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
if(!empty($vardef['function']['returns']) && $vardef['function']['returns']== 'html'){
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return "<span id='{$vardef['name']}'>" . $this->fetch('include/SugarFields/Fields/Enum/DetailViewFunction.tpl') . '</span>';
|
||||
}else{
|
||||
return parent::getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
}
|
||||
}
|
||||
|
||||
function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
|
||||
if(empty($displayParams['size'])) {
|
||||
$displayParams['size'] = 6;
|
||||
}
|
||||
|
||||
if(isset($vardef['function']) && !empty($vardef['function']['returns']) && $vardef['function']['returns']== 'html'){
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/Enum/EditViewFunction.tpl');
|
||||
}else{
|
||||
return parent::getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
|
||||
if(empty($displayParams['size'])) {
|
||||
$displayParams['size'] = 6;
|
||||
}
|
||||
|
||||
if(!empty($vardef['function']['returns']) && $vardef['function']['returns']== 'html'){
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/Enum/EditViewFunction.tpl');
|
||||
}else{
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/Enum/SearchView.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function displayFromFunc( $displayType, $parentFieldArray, $vardef, $displayParams, $tabindex ) {
|
||||
if ( isset($vardef['function']['returns']) && $vardef['function']['returns'] == 'html' ) {
|
||||
return parent::displayFromFunc($displayType, $parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
}
|
||||
|
||||
$displayTypeFunc = 'get'.$displayType.'Smarty';
|
||||
return $this->$displayTypeFunc($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
}
|
||||
|
||||
public function formatField($rawField, $vardef){
|
||||
global $app_list_strings;
|
||||
|
||||
if(!empty($vardef['options'])){
|
||||
$option_array_name = $vardef['options'];
|
||||
|
||||
if(!empty($app_list_strings[$option_array_name][$rawField])){
|
||||
return $app_list_strings[$option_array_name][$rawField];
|
||||
}else {
|
||||
return $rawField;
|
||||
}
|
||||
} else {
|
||||
return $rawField;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
40
include/SugarFields/Fields/File/DetailView.tpl
Executable file
40
include/SugarFields/Fields/File/DetailView.tpl
Executable file
@@ -0,0 +1,40 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<a href="index.php?entryPoint=download&id={$fields.{{$displayParams.id}}.value}&type={$module}" class="tabDetailViewDFLink">{$fields.{{$displayParams.link}}.value}</a>
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
47
include/SugarFields/Fields/File/EditView.tpl
Executable file
47
include/SugarFields/Fields/File/EditView.tpl
Executable file
@@ -0,0 +1,47 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<input id="{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}"
|
||||
name="{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}"
|
||||
type="file" title='{{$vardef.help}}' size="{{$displayParams.size|default:30}}"
|
||||
{{if !empty($vardef.len)}}
|
||||
maxlength='{{$vardef.len}}'
|
||||
{{elseif !empty($displayParams.maxlength)}}
|
||||
maxlength="{{$displayParams.maxlength}}"
|
||||
{{else}}
|
||||
maxlength="255"
|
||||
{{/if}}
|
||||
value="{$fields[{{sugarvar key='name' stringFormat=true}}].value}" {{$displayParams.field}}>
|
||||
91
include/SugarFields/Fields/File/SugarFieldFile.php
Executable file
91
include/SugarFields/Fields/File/SugarFieldFile.php
Executable file
@@ -0,0 +1,91 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
require_once('include/SugarFields/Fields/Base/SugarFieldBase.php');
|
||||
|
||||
class SugarFieldFile extends SugarFieldBase {
|
||||
|
||||
function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
|
||||
global $app_strings;
|
||||
if(!isset($displayParams['link'])) {
|
||||
$error = $app_strings['ERR_SMARTY_MISSING_DISPLAY_PARAMS'] . 'link';
|
||||
$GLOBALS['log']->error($error);
|
||||
$this->ss->trigger_error($error);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isset($displayParams['id'])) {
|
||||
$error = $app_strings['ERR_SMARTY_MISSING_DISPLAY_PARAMS'] . 'id';
|
||||
$GLOBALS['log']->error($error);
|
||||
$this->ss->trigger_error($error);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/File/DetailView.tpl');
|
||||
}
|
||||
|
||||
public function save(&$bean, $params, $field, $properties, $prefix = ''){
|
||||
require_once('include/upload_file.php');
|
||||
$upload_file = new UploadFile($prefix . $field);
|
||||
|
||||
//remove file
|
||||
if (isset($_REQUEST['remove_file_' . $field]) && $_REQUEST['remove_file_' . $field] == 1)
|
||||
{
|
||||
$upload_file->unlink_file($bean->$field);
|
||||
$bean->$field="";
|
||||
}
|
||||
|
||||
$move=false;
|
||||
if (isset($_FILES[$prefix . $field]) && $upload_file->confirm_upload())
|
||||
{
|
||||
$bean->$field = $upload_file->get_stored_file_name();
|
||||
$bean->file_mime_type = $upload_file->mime_type;
|
||||
$bean->file_ext = $upload_file->file_ext;
|
||||
$move=true;
|
||||
}
|
||||
|
||||
if ($move) {
|
||||
if (empty($bean->id)) {
|
||||
$bean->id = create_guid();
|
||||
$bean->new_with_id = true;
|
||||
}
|
||||
|
||||
$upload_file->final_move($bean->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
42
include/SugarFields/Fields/Float/DetailView.tpl
Executable file
42
include/SugarFields/Fields/Float/DetailView.tpl
Executable file
@@ -0,0 +1,42 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<span id='{{sugarvar key='name'}}'>
|
||||
{sugar_number_format var={{sugarvar key='value' stringFormat='false'}} {{if !empty($vardef.precision)}}precision={{$vardef.precision}}{{/if}} field={{sugarvar key='name'}}
|
||||
</span>
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
48
include/SugarFields/Fields/Float/EditView.tpl
Executable file
48
include/SugarFields/Fields/Float/EditView.tpl
Executable file
@@ -0,0 +1,48 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 strlen({{sugarvar key='value' string=true}}) <= 0}
|
||||
{assign var="value" value={{sugarvar key='default_value' string=true}} }
|
||||
{else}
|
||||
{assign var="value" value={{sugarvar key='value' string=true}} }
|
||||
{/if}
|
||||
<input type='text' name='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}'
|
||||
id='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}'
|
||||
size='{{$displayParams.size|default:30}}'
|
||||
{{if isset($displayParams.maxlength)}}maxlength='{{$displayParams.maxlength}}'{{elseif isset($vardef.len)}}maxlength='{{$varderlen}}'{{/if}}
|
||||
value='{sugar_number_format var=$value {{if !empty($vardef.precision)}}precision={{$vardef.precision}}{{/if}} field={{sugarvar key='name'}}'
|
||||
title='{{$vardef.help}}'
|
||||
tabindex='{{$tabindex}}' {{$displayParams.field}}>
|
||||
62
include/SugarFields/Fields/Float/SugarFieldFloat.php
Executable file
62
include/SugarFields/Fields/Float/SugarFieldFloat.php
Executable file
@@ -0,0 +1,62 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/SugarFields/Fields/Int/SugarFieldInt.php');
|
||||
|
||||
class SugarFieldFloat extends SugarFieldInt {
|
||||
public function formatField($rawField, $vardef){
|
||||
// A null precision uses the user prefs / system prefs by default
|
||||
$precision = null;
|
||||
if ( isset($vardef['precision']) ) {
|
||||
$precision = $vardef['precision'];
|
||||
}
|
||||
|
||||
if ( $rawField === '' || $rawField === NULL ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return format_number($rawField,$precision,$precision);
|
||||
}
|
||||
|
||||
public function unformatField($formattedField, $vardef){
|
||||
if ( $formattedField === '' || $formattedField === NULL ) {
|
||||
return '';
|
||||
}
|
||||
return (float)unformat_number($formattedField);
|
||||
}
|
||||
|
||||
}
|
||||
50
include/SugarFields/Fields/Fullname/DetailView.tpl
Executable file
50
include/SugarFields/Fields/Fullname/DetailView.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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<form name="vcard" action="index.php" style="display: inline;">
|
||||
<span id='{{sugarvar key='name'}}'>{{sugarvar key='value'}}</span>
|
||||
|
||||
<input type="hidden" name="action" value="vCard" />
|
||||
<input type="hidden" name="record" value="{$fields.id.value}" />
|
||||
<input type="hidden" name="module" value="{$module}" />
|
||||
<input type="hidden" name="to_pdf" value="true" />
|
||||
<span class="id-ff">
|
||||
<button type="submit" name="vCardButton" id="btn_vCardButton" value="{$APP.LBL_VCARD}" title="{$APP.LBL_VCARD}" class="button"><img src="{sugar_getimagepath file="id-ff-vcard.png"}"></button>
|
||||
</span>
|
||||
</form>
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
45
include/SugarFields/Fields/Fullname/SugarFieldFullname.php
Executable file
45
include/SugarFields/Fields/Fullname/SugarFieldFullname.php
Executable file
@@ -0,0 +1,45 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
require_once('include/SugarFields/Fields/Base/SugarFieldBase.php');
|
||||
|
||||
class SugarFieldFullname extends SugarFieldBase {
|
||||
|
||||
function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/Fullname/DetailView.tpl');
|
||||
}
|
||||
}
|
||||
?>
|
||||
40
include/SugarFields/Fields/Html/DetailView.tpl
Executable file
40
include/SugarFields/Fields/Html/DetailView.tpl
Executable file
@@ -0,0 +1,40 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{{$vardef.value}}
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
72
include/SugarFields/Fields/Html/SugarFieldHtml.php
Executable file
72
include/SugarFields/Fields/Html/SugarFieldHtml.php
Executable file
@@ -0,0 +1,72 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
require_once('include/SugarFields/Fields/Base/SugarFieldBase.php');
|
||||
|
||||
class SugarFieldHtml extends SugarFieldBase {
|
||||
|
||||
function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex){
|
||||
$vardef['value'] = $this->getVardefValue($vardef);
|
||||
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/Html/DetailView.tpl');
|
||||
}
|
||||
|
||||
function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex){
|
||||
$vardef['value'] = $this->getVardefValue($vardef);
|
||||
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/Html/DetailView.tpl');
|
||||
}
|
||||
|
||||
function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
$vardef['value'] = $this->getVardefValue($vardef);
|
||||
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/Html/DetailView.tpl');
|
||||
}
|
||||
|
||||
function getVardefValue($vardef){
|
||||
if(empty($vardef['value'])){
|
||||
if(!empty($vardef['default']))
|
||||
return from_html($vardef['default']);
|
||||
elseif(!empty($vardef['default_value']))
|
||||
return from_html($vardef['default_value']);
|
||||
} else {
|
||||
return from_html($vardef['value']);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
47
include/SugarFields/Fields/Iframe/DetailView.tpl
Executable file
47
include/SugarFields/Fields/Iframe/DetailView.tpl
Executable file
@@ -0,0 +1,47 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{capture name=getLink assign=link}{{sugarvar key='value'}}{/capture}
|
||||
{{if $vardef.gen}}
|
||||
{sugar_replace_vars subject='{{$vardef.default|replace:'{':'['|replace:'}':']'}}' assign='link'}
|
||||
{{/if}}
|
||||
{if !empty($link) && $link != "http://"}
|
||||
{capture name=getStart assign=linkStart}{$link|substr:0:7}{/capture}
|
||||
<iframe src="{if $linkStart != 'http://' && $link}http://{/if}{$link}" height="{{sugarvar key='height'}}" width="100%"/></iframe>
|
||||
{/if}
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
48
include/SugarFields/Fields/Iframe/EditView.tpl
Executable file
48
include/SugarFields/Fields/Iframe/EditView.tpl
Executable file
@@ -0,0 +1,48 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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.gen}}
|
||||
{if !empty({{sugarvar key='value' string=true}})}
|
||||
<input type='text' name='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}'
|
||||
id='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}' size='{{$displayParams.size|default:30}}'
|
||||
{{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{{sugarvar key='value'}}' title='{{$vardef.help}}' tabindex='{{$tabindex}}'>
|
||||
{else}
|
||||
<input type='text' name='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}'
|
||||
id='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}' size='{{$displayParams.size|default:30}}'
|
||||
{{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}}
|
||||
{if $displayView=='advanced_search'||$displayView=='basic_search'}value=''{else}value='http://'{/if} title='{{$vardef.help}}' tabindex='{{$tabindex}}'>
|
||||
{/if}
|
||||
{{/if}}
|
||||
47
include/SugarFields/Fields/Int/DetailView.tpl
Executable file
47
include/SugarFields/Fields/Int/DetailView.tpl
Executable file
@@ -0,0 +1,47 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<span id="{{sugarvar key='name'}}">
|
||||
{{if $vardef.disable_num_format}}
|
||||
{assign var="value" value={{sugarvar key='value' string=true}} }
|
||||
{$value}
|
||||
{{else}}
|
||||
{sugar_number_format precision=0 var={{sugarvar key='value' stringFormat='false'}}}
|
||||
{{/if}}
|
||||
</span>
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
43
include/SugarFields/Fields/Int/EditView.tpl
Executable file
43
include/SugarFields/Fields/Int/EditView.tpl
Executable file
@@ -0,0 +1,43 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 strlen({{sugarvar key='value' string=true}}) <= 0}
|
||||
{assign var="value" value={{sugarvar key='default_value' string=true}} }
|
||||
{else}
|
||||
{assign var="value" value={{sugarvar key='value' string=true}} }
|
||||
{/if}
|
||||
<input type='text' name='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}'
|
||||
id='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}' size='{{$displayParams.size|default:30}}' {{if isset($displayParams.maxlength)}}maxlength='{{$displayParams.maxlength}}'{{elseif isset($vardef.len)}}maxlength='{{$varderlen}}'{{/if}} value='{{if $vardef.disable_num_format}}{$value}{{else}}{sugar_number_format precision=0 var=$value}{{/if}}' title='{{$vardef.help}}' tabindex='{{$tabindex}}' {{$displayParams.field}}>
|
||||
45
include/SugarFields/Fields/Int/SearchForm.tpl
Executable file
45
include/SugarFields/Fields/Int/SearchForm.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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{if strlen({{sugarvar key='value' string=true}}) <= 0}
|
||||
{assign var="value" value={{sugarvar key='default_value' string=true}} }
|
||||
{else}
|
||||
{assign var="value" value={{sugarvar key='value' string=true}} }
|
||||
{/if}
|
||||
<input type='text' name='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}'
|
||||
id='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}' size='{{$displayParams.size|default:30}}'
|
||||
{{if isset($displayParams.maxlength)}}maxlength='{{$displayParams.maxlength}}'{{/if}}
|
||||
value='{$value}' title='{{$vardef.help}}' tabindex='{{$tabindex}}' {{$displayParams.field}}>
|
||||
71
include/SugarFields/Fields/Int/SugarFieldInt.php
Executable file
71
include/SugarFields/Fields/Int/SugarFieldInt.php
Executable file
@@ -0,0 +1,71 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/SugarFields/Fields/Base/SugarFieldBase.php');
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
|
||||
class SugarFieldInt extends SugarFieldBase {
|
||||
public function formatField($rawField, $vardef){
|
||||
if ( !empty($vardef['disable_num_format']) ) {
|
||||
return $rawField;
|
||||
}
|
||||
if ( $rawField === '' || $rawField === NULL ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return format_number($rawField,0,0);
|
||||
}
|
||||
|
||||
public function unformatField($formattedField, $vardef){
|
||||
if ( $formattedField === '' || $formattedField === NULL ) {
|
||||
return '';
|
||||
}
|
||||
return (int)unformat_number($formattedField);
|
||||
}
|
||||
|
||||
public function unformatSearchRequest(&$inputData, &$field) {
|
||||
$field['value'] = $this->unformatField($field['value'],$field);
|
||||
}
|
||||
|
||||
function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
// Use the basic field type for searches, no need to format/unformat everything... for now
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
|
||||
|
||||
return $this->fetch('include/SugarFields/Fields/Int/SearchForm.tpl');
|
||||
}
|
||||
}
|
||||
47
include/SugarFields/Fields/Link/DetailView.tpl
Executable file
47
include/SugarFields/Fields/Link/DetailView.tpl
Executable file
@@ -0,0 +1,47 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{capture name=getLink assign=link}{{sugarvar key='value'}}{/capture}
|
||||
{{if $vardef.gen}}
|
||||
{sugar_replace_vars subject='{{$vardef.default|replace:'{':'['|replace:'}':']'}}' assign='link'}
|
||||
{{/if}}
|
||||
{if !empty($link)}
|
||||
{capture name=getStart assign=linkStart}{$link|substr:0:7}{/capture}
|
||||
<a href='{$link|to_url}' {{if $displayParams.link_target}}target='{{$displayParams.link_target}}'{{elseif $vardef.link_target}}target='{{$vardef.link_target}}'{{/if}} >{{if !empty($displayParams.title)}}{sugar_translate label='{{$displayParams.title}}' module=$module}{{else}}{$link}{{/if}}</a>
|
||||
{/if}
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
46
include/SugarFields/Fields/Link/EditView.tpl
Executable file
46
include/SugarFields/Fields/Link/EditView.tpl
Executable file
@@ -0,0 +1,46 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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.gen}}
|
||||
{if !empty({{sugarvar key='value' string=true}})}
|
||||
<input type='text' name='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}' id='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}' size='{{$displayParams.size|default:30}}'
|
||||
{{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{{sugarvar key='value'}}' title='{{$vardef.help}}' tabindex='{{$tabindex}}'>
|
||||
{else}
|
||||
<input type='text' name='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}' id='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}' size='{{$displayParams.size|default:30}}'
|
||||
{{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}}
|
||||
{if $displayView=='advanced_search'||$displayView=='basic_search'}value=''{else}value='http://'{/if} title='{{$vardef.help}}' tabindex='{{$tabindex}}'>
|
||||
{/if}
|
||||
{{/if}}
|
||||
38
include/SugarFields/Fields/Link/ListView.tpl
Executable file
38
include/SugarFields/Fields/Link/ListView.tpl
Executable file
@@ -0,0 +1,38 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{capture name=getLink assign=link}{sugar_fetch object=$parentFieldArray key=$col}{/capture}
|
||||
<a href="{$link|to_url}" {if $displayParams.link_target}target='{$displayParams.link_target}'{elseif $vardef.link_target}target='{$vardef.link_target}'{/if}>{$link}</a>
|
||||
46
include/SugarFields/Fields/Multienum/DetailView.tpl
Executable file
46
include/SugarFields/Fields/Multienum/DetailView.tpl
Executable file
@@ -0,0 +1,46 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 !empty({{sugarvar key='value' string=true}}) && ({{sugarvar key='value' string=true}} != '^^')}
|
||||
{multienum_to_array string={{sugarvar key='value' string=true}} assign="vals"}
|
||||
{foreach from=$vals item=item}
|
||||
<li style="margin-left:10px;">{ {{sugarvar key='options' string=true}}.$item }</li>
|
||||
{/foreach}
|
||||
{/if}
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
|
||||
44
include/SugarFields/Fields/Multienum/EditView.tpl
Executable file
44
include/SugarFields/Fields/Multienum/EditView.tpl
Executable file
@@ -0,0 +1,44 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<input type="hidden" id="{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}_multiselect"
|
||||
name="{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}_multiselect" value="true">
|
||||
{multienum_to_array string={{sugarvar key='value' string=true}} default={{sugarvar key='default' string=true}} assign="values"}
|
||||
<select id="{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}[]"
|
||||
name="{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}[]"
|
||||
multiple="true" size='{{$displayParams.size|default:6}}' style="width:150" title='{{$vardef.help}}' tabindex="{{$tabindex}}">
|
||||
{html_options options={{sugarvar key='options' string=true}} selected=$values}
|
||||
</select>
|
||||
40
include/SugarFields/Fields/Multienum/EditViewFunction.tpl
Executable file
40
include/SugarFields/Fields/Multienum/EditViewFunction.tpl
Executable file
@@ -0,0 +1,40 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<input type="hidden" id="{{sugarvar key='name'}}_multiselect" name="{{sugarvar key='name'}}_multiselect" value="true">
|
||||
<select id="{{sugarvar key='name'}}[]" name="{{sugarvar key='name'}}[]" multiple="true" size="6" style="width:150" tabindex="{{$tabindex}}">
|
||||
{{sugarvar key='value'}}
|
||||
</select>
|
||||
44
include/SugarFields/Fields/Multienum/ListView.tpl
Executable file
44
include/SugarFields/Fields/Multienum/ListView.tpl
Executable file
@@ -0,0 +1,44 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 !empty($parentFieldArray.$col)}
|
||||
{multienum_to_array string=$parentFieldArray.$col assign="vals"}
|
||||
{foreach from=$vals item=item name=multiEnum}
|
||||
{$vardef.options_list.$item}{if !$smarty.foreach.multiEnum.last},
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
||||
37
include/SugarFields/Fields/Multienum/SearchView.tpl
Executable file
37
include/SugarFields/Fields/Multienum/SearchView.tpl
Executable file
@@ -0,0 +1,37 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{html_options name='{{$vardef.name}}[]' options={{sugarvar key='options' string=true}} size="{{$displayParams.size|default:6}}" style="width: 150px" multiple=1 selected={{sugarvar key='value' string=true}}}
|
||||
66
include/SugarFields/Fields/Multienum/SugarFieldMultienum.php
Executable file
66
include/SugarFields/Fields/Multienum/SugarFieldMultienum.php
Executable file
@@ -0,0 +1,66 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
require_once('include/SugarFields/Fields/Base/SugarFieldBase.php');
|
||||
|
||||
class SugarFieldMultienum extends SugarFieldBase {
|
||||
|
||||
function setup($parentFieldArray, $vardef, $displayParams, $tabindex, $twopass=true) {
|
||||
if ( !isset($vardef['options_list']) && isset($vardef['options']) && !is_array($vardef['options'])) {
|
||||
$vardef['options_list'] = $GLOBALS['app_list_strings'][$vardef['options']];
|
||||
}
|
||||
return parent::setup($parentFieldArray, $vardef, $displayParams, $tabindex, $twopass);
|
||||
}
|
||||
|
||||
function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
if(!empty($vardef['function']['returns']) && $vardef['function']['returns']== 'html'){
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/Multienum/EditViewFunction.tpl');
|
||||
}else{
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/Multienum/SearchView.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
public function save(&$bean, $params, $field, $properties, $prefix = ''){
|
||||
if ( isset($params[$prefix.$field]) ) {
|
||||
if($params[$prefix.$field][0] === '' && !empty($params[$prefix.$field][1]) ) {
|
||||
unset($params[$prefix.$field][0]);
|
||||
}
|
||||
|
||||
$bean->$field = encodeMultienumValue($params[$prefix.$field]);
|
||||
}
|
||||
}
|
||||
}
|
||||
40
include/SugarFields/Fields/Parent/DetailView.tpl
Executable file
40
include/SugarFields/Fields/Parent/DetailView.tpl
Executable file
@@ -0,0 +1,40 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 !$nolink}}<a href="index.php?module={{sugarvar objectName='fields' memberName='vardef.type_name' key='value'}}&action=DetailView&record={{sugarvar key='value' memberName='vardef.id_name'}}" class="tabDetailViewDFLink">{{/if}}{{sugarvar key='value'}}{{if !$nolink}}</a>{{/if}}
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
93
include/SugarFields/Fields/Parent/EditView.tpl
Executable file
93
include/SugarFields/Fields/Parent/EditView.tpl
Executable file
@@ -0,0 +1,93 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<select name='parent_type' tabindex="{{$tabindex}}" id='parent_type' title='{{$vardef.help}}'
|
||||
onchange='document.{$form_name}.{{sugarvar key='name'}}.value="";document.{$form_name}.parent_id.value=""; {{sugarvar key='name'}}changeQS(); checkParentType(document.{$form_name}.parent_type.value, document.{$form_name}.btn_{{sugarvar key='name'}});'>
|
||||
{html_options options={{sugarvar key='options' string=true}} selected=$fields.parent_type.value sortoptions=true}
|
||||
</select>
|
||||
|
||||
{{if $displayParams.split}}
|
||||
<br>
|
||||
{{/if}}
|
||||
{if empty({{sugarvar key='options' string=true}}[$fields.parent_type.value])}
|
||||
{assign var="keepParent" value = 0}
|
||||
{else}
|
||||
{assign var="keepParent" value = 1}
|
||||
{/if}
|
||||
<input type="text" name="{{sugarvar key='name'}}" id="{{sugarvar key='name'}}" class="sqsEnabled" tabindex="{{$tabindex}}"
|
||||
size="{{$displayParams.size}}" {if $keepParent}value="{{sugarvar key='value'}}"{/if} autocomplete="off"><input type="hidden" name="{{sugarvar memberName='vardef.id_name' key='name'}}" id="{{sugarvar memberName='vardef.id_name' key='name'}}"
|
||||
{if $keepParent}value="{{sugarvar memberName='vardef.id_name' key='value'}}"{/if}>
|
||||
<span class="id-ff multiple">
|
||||
<button type="button" name="btn_{{sugarvar key='name'}}" id="btn_{{sugarvar key='name'}}" tabindex="{{$tabindex}}"
|
||||
title="{$APP.LBL_SELECT_BUTTON_TITLE}" accessKey="{$APP.LBL_SELECT_BUTTON_KEY}" class="button firstChild" value="{$APP.LBL_SELECT_BUTTON_LABEL}"
|
||||
onclick='open_popup(document.{$form_name}.parent_type.value, 600, 400, "", true, false, {{$displayParams.popupData}}, "single", true);' {{if isset($displayParams.javascript.btn)}}{{$displayParams.javascript.btn}}{{/if}}><img src="{sugar_getimagepath file="id-ff-select.png"}"></button>{{if empty($displayParams.selectOnly)}}<button type="button" name="btn_clr_{{sugarvar key='name'}}" id="btn_clr_{{sugarvar key='name'}}" tabindex="{{$tabindex}}" title="{$APP.LBL_CLEAR_BUTTON_TITLE}" accessKey="{$APP.LBL_CLEAR_BUTTON_KEY}" class="button lastChild" onclick="this.form.{{sugarvar key='name'}}.value = ''; this.form.{{sugarvar memberName='vardef.id_name' key='name'}}.value = '';" value="{$APP.LBL_CLEAR_BUTTON_LABEL}" {{if isset($displayParams.javascript.btn_clear)}}{{$displayParams.javascript.btn_clear}}{{/if}}><img src="{sugar_getimagepath file="id-ff-clear.png"}"></button>
|
||||
</span>
|
||||
{{/if}}
|
||||
|
||||
<script type="text/javascript">
|
||||
function {{sugarvar key='name'}}changeQS() {literal}{
|
||||
{/literal}
|
||||
new_module = document.forms["{$form_name}"].elements["parent_type"].value;
|
||||
{literal}
|
||||
if(typeof(disabledModules[new_module]) != 'undefined') {
|
||||
{/literal}
|
||||
sqs_objects["{$form_name}_parent_name"]["disable"] = true;
|
||||
document.forms["{$form_name}"].elements["parent_name"].readOnly = true;
|
||||
{literal}
|
||||
} else {
|
||||
{/literal}
|
||||
sqs_objects["{$form_name}_parent_name"]["disable"] = false;
|
||||
document.forms["{$form_name}"].elements["parent_name"].readOnly = false;
|
||||
{literal}
|
||||
}
|
||||
{/literal}
|
||||
sqs_objects["{$form_name}_parent_name"]["modules"] = new Array(new_module);
|
||||
if(typeof QSProcessedFieldsArray != 'undefined')
|
||||
{literal}
|
||||
{
|
||||
{/literal}
|
||||
QSProcessedFieldsArray["{$form_name}_parent_name"] = false;
|
||||
{literal}
|
||||
}
|
||||
{/literal}
|
||||
enableQS(false);
|
||||
{literal}
|
||||
}
|
||||
{/literal}
|
||||
</script>
|
||||
{literal}
|
||||
{{$displayParams.disabled_parent_types}}
|
||||
{/literal}
|
||||
76
include/SugarFields/Fields/Parent/SearchView.tpl
Executable file
76
include/SugarFields/Fields/Parent/SearchView.tpl
Executable file
@@ -0,0 +1,76 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<select name='{{$vardef.type_name}}' tabindex="{{$tabindex}}" id='{{$vardef.type_name}}' title='{{$vardef.help}}'
|
||||
onchange='document.{{$form_name}}.{{sugarvar key='name'}}.value="";document.{{$form_name}}.parent_id.value="";
|
||||
{{$vardef.type_name}}changeQS(); checkParentType(document.{{$form_name}}.parent_type.value, document.{{$form_name}}.btn_{{sugarvar key='name'}});'>
|
||||
{html_options options={{sugarvar key='options' string=true}} selected=$fields.parent_type.value}
|
||||
</select>
|
||||
{{if $displayParams.split}}
|
||||
<br>
|
||||
{{/if}}
|
||||
{if empty({{sugarvar key='options' string=true}}[$fields.parent_type.value])}
|
||||
{assign var="keepParent" value = 0}
|
||||
{else}
|
||||
{assign var="keepParent value = 1}
|
||||
{/if}
|
||||
<input type="text" name="{{sugarvar key='name'}}" id="{{sugarvar key='name'}}" class="sqsEnabled" tabindex="{{$tabindex}}" size="{{$displayParams.size}}" value="{{sugarvar key='value'}}" autocomplete="off">
|
||||
<input type="hidden" name="{{$vardef.id_name}}" id="{{$vardef.id_name}}" value="{$smarty.post.parent_id}">
|
||||
<span class="id-ff multiple">
|
||||
<button type="button" name="btn_{{sugarvar key='name'}}" tabindex="{{$tabindex}}" title="{$APP.LBL_SELECT_BUTTON_TITLE}"
|
||||
accessKey="{$APP.LBL_SELECT_BUTTON_KEY}" class="button{{if empty($displayParams.selectOnly)}} firstChild{{/if}}" value="{$APP.LBL_SELECT_BUTTON_LABEL}"
|
||||
onclick='open_popup(document.{{$form_name}}.parent_type.value, 600, 400, "", true, false, {{$displayParams.popupData}}, "single", true);'><img src="{sugar_getimagepath file="id-ff-select.png"}"></button>
|
||||
{{if empty($displayParams.selectOnly)}}
|
||||
<button type="button" name="btn_clr_{{sugarvar key='name'}}" tabindex="{{$tabindex}}" title="{$APP.LBL_CLEAR_BUTTON_TITLE}" accessKey="{$APP.LBL_CLEAR_BUTTON_KEY}" class="button lastChild" onclick="this.form.{{sugarvar key='name'}}.value = ''; this.form.{{sugarvar key='id_name'}}.value = '';" value="{$APP.LBL_CLEAR_BUTTON_LABEL}"><img src="{sugar_getimagepath file="id-ff-clear.png"}"></button>
|
||||
{{/if}}
|
||||
</span>
|
||||
<script type="text/javascript">
|
||||
function {{$vardef.type_name}}changeQS() {ldelim}
|
||||
new_module = document.forms["{{$form_name}}"].elements["parent_type"].value;
|
||||
if(typeof(disabledModules[new_module]) != 'undefined') {ldelim}
|
||||
sqs_objects["{{$form_name}}_{{sugarvar key='name'}}"]["disable"] = true;
|
||||
document.forms["{{$form_name}}"].elements["{{sugarvar key='name'}}"].readOnly = true;
|
||||
{rdelim} else {ldelim}
|
||||
sqs_objects["{{$form_name}}_{{sugarvar key='name'}}"]["disable"] = false;
|
||||
document.forms["{{$form_name}}"].elements["{{sugarvar key='name'}}"].readOnly = false;
|
||||
{rdelim}
|
||||
sqs_objects["{{$form_name}}_{{sugarvar key='name'}}"]["modules"] = new Array(new_module);
|
||||
enableQS(false);
|
||||
{rdelim}
|
||||
</script>
|
||||
{literal}
|
||||
{{$displayParams.disabled_parent_types}}
|
||||
{/literal}
|
||||
119
include/SugarFields/Fields/Parent/SugarFieldParent.php
Executable file
119
include/SugarFields/Fields/Parent/SugarFieldParent.php
Executable file
@@ -0,0 +1,119 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
require_once('include/SugarFields/Fields/Base/SugarFieldBase.php');
|
||||
|
||||
class SugarFieldParent extends SugarFieldBase {
|
||||
|
||||
function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
$nolink = array('Users', 'Teams');
|
||||
if(in_array($vardef['module'], $nolink)){
|
||||
$this->ss->assign('nolink', true);
|
||||
}else{
|
||||
$this->ss->assign('nolink', false);
|
||||
}
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/Parent/DetailView.tpl');
|
||||
}
|
||||
|
||||
function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
$form_name = 'EditView';
|
||||
if(isset($displayParams['formName'])) {
|
||||
$form_name = $displayParams['formName'];
|
||||
}
|
||||
|
||||
$popup_request_data = array(
|
||||
'call_back_function' => 'set_return',
|
||||
'form_name' => $form_name,
|
||||
'field_to_name_array' => array(
|
||||
'id' => $vardef['id_name'],
|
||||
'name' => $vardef['name'],
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
global $app_list_strings;
|
||||
$parent_types = $app_list_strings['record_type_display'];
|
||||
|
||||
$disabled_parent_types = ACLController::disabledModuleList($parent_types,false, 'list');
|
||||
foreach($disabled_parent_types as $disabled_parent_type){
|
||||
if($disabled_parent_type != $focus->parent_type){
|
||||
unset($parent_types[$disabled_parent_type]);
|
||||
}
|
||||
}
|
||||
asort($parent_types);
|
||||
$json = getJSONobj();
|
||||
$displayParams['popupData'] = '{literal}'.$json->encode($popup_request_data).'{/literal}';
|
||||
$displayParams['disabled_parent_types'] = '<script>var disabledModules='. $json->encode($disabled_parent_types).';</script>';
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/Parent/EditView.tpl');
|
||||
}
|
||||
|
||||
function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
$form_name = 'search_form';
|
||||
|
||||
if(isset($displayParams['formName'])) {
|
||||
$form_name = $displayParams['formName'];
|
||||
}
|
||||
|
||||
$this->ss->assign('form_name', $form_name);
|
||||
|
||||
$popup_request_data = array(
|
||||
'call_back_function' => 'set_return',
|
||||
'form_name' => $form_name,
|
||||
'field_to_name_array' => array(
|
||||
'id' => $vardef['id_name'],
|
||||
'name' => $vardef['name'],
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
global $app_list_strings;
|
||||
$parent_types = $app_list_strings['record_type_display'];
|
||||
$disabled_parent_types = ACLController::disabledModuleList($parent_types,false, 'list');
|
||||
foreach($disabled_parent_types as $disabled_parent_type){
|
||||
if($disabled_parent_type != $focus->parent_type){
|
||||
unset($parent_types[$disabled_parent_type]);
|
||||
}
|
||||
}
|
||||
|
||||
$json = getJSONobj();
|
||||
$displayParams['popupData'] = '{literal}'.$json->encode($popup_request_data).'{/literal}';
|
||||
$displayParams['disabled_parent_types'] = '<script>var disabledModules='. $json->encode($disabled_parent_types).';</script>';
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/Parent/SearchView.tpl');
|
||||
}
|
||||
}
|
||||
?>
|
||||
39
include/SugarFields/Fields/Password/EditView.tpl
Executable file
39
include/SugarFields/Fields/Password/EditView.tpl
Executable file
@@ -0,0 +1,39 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<input type='password' id='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}'
|
||||
name='{{if empty($displayParams.idName)}}{{sugarvar key='name'}}{{else}}{{$displayParams.idName}}{{/if}}'
|
||||
size='{{$displayParams.size|default:30}}' value='{{sugarvar key='value'}}' title='{{$vardef.help}}' tabindex='{{$tabindex}}'>
|
||||
43
include/SugarFields/Fields/Phone/DetailView.tpl
Executable file
43
include/SugarFields/Fields/Phone/DetailView.tpl
Executable file
@@ -0,0 +1,43 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 !empty({{sugarvar key='value' string=true}})}
|
||||
{assign var="phone_value" value={{sugarvar key='value' string=true}} }
|
||||
{sugar_phone value=$phone_value }
|
||||
{/if}
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
38
include/SugarFields/Fields/Phone/ListView.tpl
Executable file
38
include/SugarFields/Fields/Phone/ListView.tpl
Executable file
@@ -0,0 +1,38 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{capture name=getPhone assign=phone}{sugar_fetch object=$parentFieldArray key=$col}{/capture}
|
||||
{sugar_phone value=$phone }
|
||||
40
include/SugarFields/Fields/Radioenum/DetailView.tpl
Executable file
40
include/SugarFields/Fields/Radioenum/DetailView.tpl
Executable file
@@ -0,0 +1,40 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{ {{sugarvar key='options' string=true}}[{{sugarvar key='value' string=true}}]}
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
51
include/SugarFields/Fields/Radioenum/EditView.tpl
Executable file
51
include/SugarFields/Fields/Radioenum/EditView.tpl
Executable file
@@ -0,0 +1,51 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 empty({{sugarvar key='value' string=true}})}
|
||||
{assign var="value" value={{sugarvar key='default_value' string=true}} }
|
||||
{else}
|
||||
{assign var="value" value={{sugarvar key='value' string=true}} }
|
||||
{/if}
|
||||
{capture name=idname assign=idname}{{sugarvar key='name'}}{/capture}
|
||||
{{if !empty($displayParams.idName)}}
|
||||
{assign var=idname value=$displayParams.idName}
|
||||
{{/if}}
|
||||
|
||||
{if isset({{sugarvar key='value' string=true}}) && {{sugarvar key='value' string=true}} != ''}
|
||||
{html_radios id="$idname" name="$idname" title="{{$vardef.help}}" options={{sugarvar key='options' string=true}} selected={{sugarvar key='value' string=true}} separator="{{$vardef.separator}}"}
|
||||
{else}
|
||||
{html_radios id="$idname" name="$idname" title="{{$vardef.help}}" options={{sugarvar key='options' string=true}} selected={{sugarvar key='default' string=true}} separator="{{$vardef.separator}}"}
|
||||
{/if}
|
||||
44
include/SugarFields/Fields/Readonly/SugarFieldReadonly.php
Executable file
44
include/SugarFields/Fields/Readonly/SugarFieldReadonly.php
Executable file
@@ -0,0 +1,44 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
require_once('include/SugarFields/Fields/Base/SugarFieldBase.php');
|
||||
|
||||
class SugarFieldReadonly extends SugarFieldBase {
|
||||
function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
return $this->getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
48
include/SugarFields/Fields/Relate/DetailView.tpl
Executable file
48
include/SugarFields/Fields/Relate/DetailView.tpl
Executable file
@@ -0,0 +1,48 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 !$nolink}}
|
||||
{if !empty({{sugarvar memberName='vardef.id_name' key='value' string='true'}})}<a href="index.php?module={{$vardef.module}}&action=DetailView&record={{sugarvar memberName='vardef.id_name' key='value'}}">{/if}
|
||||
{{/if}}
|
||||
{{sugarvar key='value'}}
|
||||
{{if !$nolink}}
|
||||
{if !empty({{sugarvar memberName='vardef.id_name' key='value' string='true'}})}</a>{/if}
|
||||
{{/if}}
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{if !empty({{sugarvar memberName='vardef.id_name' key='value' string='true'}})}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{/if}
|
||||
{{/if}}
|
||||
73
include/SugarFields/Fields/Relate/EditView.tpl
Executable file
73
include/SugarFields/Fields/Relate/EditView.tpl
Executable file
@@ -0,0 +1,73 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{{capture name=idname assign=idname}}{{sugarvar key='name'}}{{/capture}}
|
||||
{{if !empty($displayParams.idName)}}
|
||||
{{assign var=idname value=$displayParams.idName}}
|
||||
{{/if}}
|
||||
<input type="text" name="{{$idname}}" class={{if empty($displayParams.class) }}"sqsEnabled"{{else}} "{{$displayParams.class}}" {{/if}} tabindex="{{$tabindex}}" id="{{$idname}}" size="{{$displayParams.size}}" value="{{sugarvar key='value'}}" title='{{$vardef.help}}' autocomplete="off" {{$displayParams.readOnly}} {{$displayParams.field}}>
|
||||
<input type="hidden" name="{{if !empty($displayParams.idName)}}{{$idname}}_{{/if}}{{sugarvar key='id_name'}}" id="{{if !empty($displayParams.idName)}}{{$idname}}_{{/if}}{{sugarvar key='id_name'}}" value="{{sugarvar memberName='vardef.id_name' key='value'}}">
|
||||
{{if empty($displayParams.hideButtons) }}
|
||||
<span class="id-ff multiple">
|
||||
<button type="button" name="btn_{{$idname}}" id="btn_{{$idname}}" tabindex="{{$tabindex}}" title="{$APP.LBL_SELECT_BUTTON_TITLE}" accessKey="{$APP.LBL_SELECT_BUTTON_KEY}" class="button firstChild" value="{$APP.LBL_SELECT_BUTTON_LABEL}"
|
||||
onclick='open_popup(
|
||||
"{{sugarvar key='module'}}",
|
||||
600,
|
||||
400,
|
||||
"{{$displayParams.initial_filter}}",
|
||||
true,
|
||||
false,
|
||||
{{$displayParams.popupData}},
|
||||
"single",
|
||||
true
|
||||
);' {{if isset($displayParams.javascript.btn)}}{{$displayParams.javascript.btn}}{{/if}}><img src="{sugar_getimagepath file="id-ff-select.png"}"></button>{{if empty($displayParams.selectOnly) }}<button type="button" name="btn_clr_{{$idname}}" id="btn_clr_{{$idname}}" tabindex="{{$tabindex}}" title="{$APP.LBL_CLEAR_BUTTON_TITLE}" accessKey="{$APP.LBL_CLEAR_BUTTON_KEY}" class="button lastChild"
|
||||
onclick="this.form.{{$idname}}.value = ''; this.form.{{if !empty($displayParams.idName)}}{{$displayParams.idName}}_{{/if}}{{sugarvar key='id_name'}}.value = '';"
|
||||
value="{$APP.LBL_CLEAR_BUTTON_LABEL}" {{if isset($displayParams.javascript.btn_clear)}}{{$displayParams.javascript.btn_clear}}{{/if}}><img src="{sugar_getimagepath file="id-ff-clear.png"}"></button>
|
||||
{{/if}}
|
||||
</span>
|
||||
{{/if}}
|
||||
{{if !empty($displayParams.allowNewValue) }}
|
||||
<input type="hidden" name="{{$idname}}_allow_new_value" id="{{$idname}}_allow_new_value" value="true">
|
||||
{{/if}}
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
if(typeof QSProcessedFieldsArray != 'undefined')
|
||||
QSProcessedFieldsArray["{$form_name}_{{$idname}}"] = false;
|
||||
|
||||
|
||||
enableQS(false);
|
||||
-->
|
||||
</script>
|
||||
49
include/SugarFields/Fields/Relate/SearchView.tpl
Executable file
49
include/SugarFields/Fields/Relate/SearchView.tpl
Executable file
@@ -0,0 +1,49 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
<input type="text" name="{{sugarvar key='name'}}" class={{if empty($displayParams.class) }}"sqsEnabled"{{else}} "{{$displayParams.class}}" {{/if}} tabindex="{{$tabindex}}" id="{{sugarvar key='name'}}" size="{{$displayParams.size}}" value="{{sugarvar key='value'}}" title='{{$vardef.help}}' autocomplete="off" {{$displayParams.readOnly}} {{$displayParams.field}}>
|
||||
<input type="hidden" name="{{sugarvar memberName='vardef.id_name' key='name'}}" id="{{sugarvar memberName='vardef.id_name' key='name'}}" value="{{sugarvar memberName='vardef.id_name' key='value'}}">
|
||||
{{if empty($displayParams.hideButtons) }}
|
||||
<span class="id-ff multiple">
|
||||
{{if empty($displayParams.clearOnly) }}
|
||||
<button type="button" name="btn_{{sugarvar key='name'}}" tabindex="{{$tabindex}}" title="{$APP.LBL_SELECT_BUTTON_TITLE}" accessKey="{$APP.LBL_SELECT_BUTTON_KEY}" class="button{{if empty($displayParams.selectOnly) }} firstChild{{/if}}" value="{$APP.LBL_SELECT_BUTTON_LABEL}" onclick='open_popup("{{sugarvar key='module'}}", 600, 400, "", true, false, {{$displayParams.popupData}}, "single", true);'><img src="{sugar_getimagepath file="id-ff-select.png"}"></button>{{/if}}
|
||||
{{if empty($displayParams.selectOnly) }}<button type="button" name="btn_clr_{{sugarvar key='name'}}" tabindex="{{$tabindex}}" title="{$APP.LBL_CLEAR_BUTTON_TITLE}" accessKey="{$APP.LBL_CLEAR_BUTTON_KEY}" class="button{{if empty($displayParams.clearOnly) }} lastChild{{/if}}" onclick="this.form.{{sugarvar key='name'}}.value = ''; this.form.{{sugarvar memberName='vardef.id_name' key='name'}}.value = '';" value="{$APP.LBL_CLEAR_BUTTON_LABEL}"><img src="{sugar_getimagepath file="id-ff-clear.png"}"></button>
|
||||
{{/if}}
|
||||
</span>
|
||||
{{/if}}
|
||||
{{if !empty($displayParams.allowNewValue) }}
|
||||
<input type="hidden" name="{{sugarvar key='name'}}_allow_new_value" id="{{sugarvar key='name'}}_allow_new_value" value="true">
|
||||
{{/if}}
|
||||
254
include/SugarFields/Fields/Relate/SugarFieldRelate.php
Executable file
254
include/SugarFields/Fields/Relate/SugarFieldRelate.php
Executable file
@@ -0,0 +1,254 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
require_once('include/SugarFields/Fields/Base/SugarFieldBase.php');
|
||||
|
||||
class SugarFieldRelate extends SugarFieldBase {
|
||||
|
||||
function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
$nolink = array('Users', 'Teams');
|
||||
if(in_array($vardef['module'], $nolink)){
|
||||
$this->ss->assign('nolink', true);
|
||||
}else{
|
||||
$this->ss->assign('nolink', false);
|
||||
}
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/Relate/DetailView.tpl');
|
||||
}
|
||||
|
||||
function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
if(!empty($vardef['function']['returns']) && $vardef['function']['returns'] == 'html'){
|
||||
return parent::getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
}
|
||||
|
||||
$call_back_function = 'set_return';
|
||||
if(isset($displayParams['call_back_function'])) {
|
||||
$call_back_function = $displayParams['call_back_function'];
|
||||
}
|
||||
$form_name = 'EditView';
|
||||
if(isset($displayParams['formName'])) {
|
||||
$form_name = $displayParams['formName'];
|
||||
}
|
||||
|
||||
//Special Case for accounts; use the displayParams array and retrieve
|
||||
//the key and copy indexes. 'key' is the suffix of the field we are searching
|
||||
//the Account's address with. 'copy' is the suffix we are copying the addresses
|
||||
//form fields into.
|
||||
if(isset($vardef['module']) && preg_match('/Accounts/si',$vardef['module'])
|
||||
&& isset($displayParams['key']) && isset($displayParams['copy'])) {
|
||||
|
||||
if(isset($displayParams['key']) && is_array($displayParams['key'])) {
|
||||
$database_key = $displayParams['key'];
|
||||
} else {
|
||||
$database_key[] = $displayParams['key'];
|
||||
}
|
||||
|
||||
if(isset($displayParams['copy']) && is_array($displayParams['copy'])) {
|
||||
$form = $displayParams['copy'];
|
||||
} else {
|
||||
$form[] = $displayParams['copy'];
|
||||
}
|
||||
|
||||
if(count($database_key) != count($form)) {
|
||||
global $app_list_strings;
|
||||
$this->ss->trigger_error($app_list_strings['ERR_SMARTY_UNEQUAL_RELATED_FIELD_PARAMETERS']);
|
||||
} //if
|
||||
|
||||
$copy_phone = isset($displayParams['copyPhone']) ? $displayParams['copyPhone'] : true;
|
||||
|
||||
$field_to_name = array();
|
||||
$field_to_name['id'] = $vardef['id_name'];
|
||||
$field_to_name['name'] = $vardef['name'];
|
||||
$address_fields = array('_address_street', '_address_city', '_address_state', '_address_postalcode', '_address_country');
|
||||
$count = 0;
|
||||
foreach($form as $f) {
|
||||
foreach($address_fields as $afield) {
|
||||
$field_to_name[$database_key[$count] . $afield] = $f . $afield;
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
|
||||
$popup_request_data = array(
|
||||
'call_back_function' => $call_back_function,
|
||||
'form_name' => $form_name,
|
||||
'field_to_name_array' => $field_to_name,
|
||||
);
|
||||
|
||||
if($copy_phone) {
|
||||
$popup_request_data['field_to_name_array']['phone_office'] = 'phone_work';
|
||||
}
|
||||
} elseif(isset($displayParams['field_to_name_array'])) {
|
||||
$popup_request_data = array(
|
||||
'call_back_function' => $call_back_function,
|
||||
'form_name' => $form_name,
|
||||
'field_to_name_array' => $displayParams['field_to_name_array'],
|
||||
);
|
||||
} else {
|
||||
$popup_request_data = array(
|
||||
'call_back_function' => $call_back_function,
|
||||
'form_name' => $form_name,
|
||||
'field_to_name_array' => array(
|
||||
'id' => (empty($displayParams['idName']) ? $vardef['id_name'] : ($displayParams['idName'] . '_' . $vardef['id_name'])) ,
|
||||
((empty($vardef['rname'])) ? 'name' : $vardef['rname']) => (empty($displayParams['idName']) ? $vardef['name'] : $displayParams['idName']),
|
||||
),
|
||||
);
|
||||
}
|
||||
$json = getJSONobj();
|
||||
$displayParams['popupData'] = '{literal}'.$json->encode($popup_request_data). '{/literal}';
|
||||
if(!isset($displayParams['readOnly'])) {
|
||||
$displayParams['readOnly'] = '';
|
||||
} else {
|
||||
$displayParams['readOnly'] = $displayParams['readOnly'] == false ? '' : 'READONLY';
|
||||
}
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/Relate/EditView.tpl');
|
||||
}
|
||||
|
||||
function getPopupViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex){
|
||||
$displayParams['clearOnly'] = true;
|
||||
return $this->getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
}
|
||||
|
||||
function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
$call_back_function = 'set_return';
|
||||
if(isset($displayParams['call_back_function'])) {
|
||||
$call_back_function = $displayParams['call_back_function'];
|
||||
}
|
||||
$form_name = 'search_form';
|
||||
if(isset($displayParams['formName'])) {
|
||||
$form_name = $displayParams['formName'];
|
||||
}
|
||||
if(!empty($vardef['rname']) && $vardef['rname'] == 'user_name'){
|
||||
$displayParams['useIdSearch'] = true;
|
||||
}
|
||||
//Special Case for accounts; use the displayParams array and retrieve
|
||||
//the key and copy indexes. 'key' is the suffix of the field we are searching
|
||||
//the Account's address with. 'copy' is the suffix we are copying the addresses
|
||||
//form fields into.
|
||||
if(isset($vardef['module']) && preg_match('/Accounts/si',$vardef['module'])
|
||||
&& isset($displayParams['key']) && isset($displayParams['copy'])) {
|
||||
|
||||
if(isset($displayParams['key']) && is_array($displayParams['key'])) {
|
||||
$database_key = $displayParams['key'];
|
||||
} else {
|
||||
$database_key[] = $displayParams['key'];
|
||||
}
|
||||
|
||||
if(isset($displayParams['copy']) && is_array($displayParams['copy'])) {
|
||||
$form = $displayParams['copy'];
|
||||
} else {
|
||||
$form[] = $displayParams['copy'];
|
||||
}
|
||||
|
||||
if(count($database_key) != count($form)) {
|
||||
global $app_list_strings;
|
||||
$this->ss->trigger_error($app_list_strings['ERR_SMARTY_UNEQUAL_RELATED_FIELD_PARAMETERS']);
|
||||
} //if
|
||||
|
||||
$copy_phone = isset($displayParams['copyPhone']) ? $displayParams['copyPhone'] : true;
|
||||
|
||||
$field_to_name = array();
|
||||
$field_to_name['id'] = $vardef['id_name'];
|
||||
$field_to_name['name'] = $vardef['name'];
|
||||
$address_fields = array('_address_street', '_address_city', '_address_state', '_address_postalcode', '_address_country');
|
||||
$count = 0;
|
||||
foreach($form as $f) {
|
||||
foreach($address_fields as $afield) {
|
||||
$field_to_name[$database_key[$count] . $afield] = $f . $afield;
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
|
||||
$popup_request_data = array(
|
||||
'call_back_function' => $call_back_function,
|
||||
'form_name' => $form_name,
|
||||
'field_to_name_array' => $field_to_name,
|
||||
);
|
||||
|
||||
if($copy_phone) {
|
||||
$popup_request_data['field_to_name_array']['phone_office'] = 'phone_work';
|
||||
}
|
||||
} elseif(isset($displayParams['field_to_name_array'])) {
|
||||
$popup_request_data = array(
|
||||
'call_back_function' => $call_back_function,
|
||||
'form_name' => $form_name,
|
||||
'field_to_name_array' => $displayParams['field_to_name_array'],
|
||||
);
|
||||
} else {
|
||||
$popup_request_data = array(
|
||||
'call_back_function' => $call_back_function,
|
||||
'form_name' => $form_name,
|
||||
'field_to_name_array' => array(
|
||||
'id' => $vardef['id_name'],
|
||||
((empty($vardef['rname'])) ? 'name' : $vardef['rname']) => $vardef['name'],
|
||||
),
|
||||
);
|
||||
}
|
||||
$json = getJSONobj();
|
||||
$displayParams['popupData'] = '{literal}'.$json->encode($popup_request_data). '{/literal}';
|
||||
if(!isset($displayParams['readOnly'])) {
|
||||
$displayParams['readOnly'] = '';
|
||||
} else {
|
||||
$displayParams['readOnly'] = $displayParams['readOnly'] == false ? '' : 'READONLY';
|
||||
}
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
return $this->fetch('include/SugarFields/Fields/Relate/SearchView.tpl');
|
||||
}
|
||||
|
||||
function formatField($rawField, $vardef) {
|
||||
if ('contact_name' == $vardef['name']){
|
||||
$default_locale_name_format = $GLOBALS['current_user']->getPreference('default_locale_name_format');
|
||||
$default_locale_name_format = trim(preg_replace('/s/i', '', $default_locale_name_format));
|
||||
$new_field = '';
|
||||
$names = array();
|
||||
$temp = explode(' ', $rawField);
|
||||
if ( !isset($temp[1]) ) {
|
||||
$names['f'] = '';
|
||||
$names['l'] = $temp[0];
|
||||
}
|
||||
elseif ( !empty($temp) ) {
|
||||
$names['f'] = $temp[0];
|
||||
$names['l'] = $temp[1];
|
||||
}
|
||||
for($i=0;$i<strlen($default_locale_name_format);$i++){
|
||||
$new_field .= array_key_exists($default_locale_name_format{$i}, $names) ? $names[$default_locale_name_format{$i}] : $default_locale_name_format{$i};
|
||||
}
|
||||
}
|
||||
else $new_field = $rawField;
|
||||
|
||||
return $new_field;
|
||||
}
|
||||
}
|
||||
?>
|
||||
44
include/SugarFields/Fields/Text/ClassicEditView.tpl
Executable file
44
include/SugarFields/Fields/Text/ClassicEditView.tpl
Executable file
@@ -0,0 +1,44 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 !empty($displayParams.maxlength)}
|
||||
<textarea id="{$prefix}{$name}" name="{$prefix}{$name}" maxlength="{$displayParams.maxlength}" cols="{$displayParams.cols|default:60}" rows="{$displayParams.rows|default:4}" tabindex="{$tabindex}">{$value}</textarea>
|
||||
{else}
|
||||
<textarea id="{$prefix}{$name}" name="{$prefix}{$name}" cols="{$displayParams.cols|default:60}" rows="{$displayParams.rows|default:4}" tabindex="{$tabindex}">{$value}</textarea>
|
||||
{/if}
|
||||
|
||||
|
||||
47
include/SugarFields/Fields/Text/DetailView.tpl
Executable file
47
include/SugarFields/Fields/Text/DetailView.tpl
Executable file
@@ -0,0 +1,47 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 empty($displayParams.textonly)}}
|
||||
{{sugarvar key='value' htmlentitydecode='true'}}
|
||||
{{else}}
|
||||
{{sugarvar key='value'}}
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
56
include/SugarFields/Fields/Text/EditView.tpl
Executable file
56
include/SugarFields/Fields/Text/EditView.tpl
Executable file
@@ -0,0 +1,56 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 empty({{sugarvar key='value' string=true}})}
|
||||
{assign var="value" value={{sugarvar key='default_value' string=true}} }
|
||||
{else}
|
||||
{assign var="value" value={{sugarvar key='value' string=true}} }
|
||||
{/if}
|
||||
|
||||
|
||||
{{capture name=idname assign=idname}}{{sugarvar key='name'}}{{/capture}}
|
||||
{{if !empty($displayParams.idName)}}
|
||||
{{assign var=idname value=$displayParams.idName}}
|
||||
{{/if}}
|
||||
|
||||
|
||||
<textarea id='{{$idname}}' name='{{$idname}}'
|
||||
rows="{{if !empty($displayParams.rows)}}{{$displayParams.rows}}{{elseif !empty($vardef.rows)}}{{$vardef.rows}}{{else}}{{4}}{{/if}}"
|
||||
cols="{{if !empty($displayParams.cols)}}{{$displayParams.cols}}{{elseif !empty($vardef.cols)}}{{$vardef.cols}}{{else}}{{60}}{{/if}}"
|
||||
title='{{$vardef.help}}' tabindex="{{$tabindex}}" {{$displayParams.field}}>{$value}</textarea>
|
||||
|
||||
|
||||
|
||||
80
include/SugarFields/Fields/Text/SugarFieldText.php
Executable file
80
include/SugarFields/Fields/Text/SugarFieldText.php
Executable file
@@ -0,0 +1,80 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
require_once('include/SugarFields/Fields/Base/SugarFieldBase.php');
|
||||
|
||||
class SugarFieldText extends SugarFieldBase {
|
||||
|
||||
function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
$displayParams['nl2br'] = true;
|
||||
$displayParams['htmlescape'] = true;
|
||||
$displayParams['url2html'] = true;
|
||||
return parent::getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
}
|
||||
function getClassicEditView($field_id='description', $value='', $prefix='', $rich_text=false, $maxlength='', $tabindex=1, $cols=80, $rows=4) {
|
||||
|
||||
$this->ss->assign('prefix', $prefix);
|
||||
$this->ss->assign('field_id', $field_id);
|
||||
$this->ss->assign('value', $value);
|
||||
$this->ss->assign('tabindex', $tabindex);
|
||||
|
||||
$displayParams = array();
|
||||
$displayParams['textonly'] = $rich_text ? false : true;
|
||||
$displayParams['maxlength'] = $maxlength;
|
||||
$displayParams['rows'] = $rows;
|
||||
$displayParams['cols'] = $cols;
|
||||
|
||||
|
||||
$this->ss->assign('displayParams', $displayParams);
|
||||
if(isset($GLOBALS['current_user'])) {
|
||||
$height = $GLOBALS['current_user']->getPreference('text_editor_height');
|
||||
$width = $GLOBALS['current_user']->getPreference('text_editor_width');
|
||||
$height = isset($height) ? $height : '300px';
|
||||
$width = isset($width) ? $width : '95%';
|
||||
$this->ss->assign('RICH_TEXT_EDITOR_HEIGHT', $height);
|
||||
$this->ss->assign('RICH_TEXT_EDITOR_WIDTH', $width);
|
||||
} else {
|
||||
$this->ss->assign('RICH_TEXT_EDITOR_HEIGHT', '100px');
|
||||
$this->ss->assign('RICH_TEXT_EDITOR_WIDTH', '95%');
|
||||
}
|
||||
|
||||
if(file_exists('custom/include/SugarFields/Fields/Text/ClassicEditView.tpl')) {
|
||||
return $this->ss->fetch('custom/include/SugarFields/Fields/Text/ClassicEditView.tpl');
|
||||
} else {
|
||||
return $this->ss->fetch('include/SugarFields/Fields/Text/ClassicEditView.tpl');
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
47
include/SugarFields/Fields/URL/DetailView.tpl
Executable file
47
include/SugarFields/Fields/URL/DetailView.tpl
Executable file
@@ -0,0 +1,47 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{capture name=getLink assign=link}{{sugarvar key='value'}}{/capture}
|
||||
{{if $vardef.gen}}
|
||||
{sugar_replace_vars subject='{{$vardef.default|replace:'{':'['|replace:'}':']'}}' assign='link'}
|
||||
{{/if}}
|
||||
{if !empty($link)}
|
||||
{capture name=getStart assign=linkStart}{$link|substr:0:7}{/capture}
|
||||
<a href='{$link|to_url}' {{if $displayParams.link_target}}target='{{$displayParams.link_target}}'{{elseif $vardef.link_target}}target='{{$vardef.link_target}}'{{/if}} >{{if !empty($displayParams.title)}}{sugar_translate label='{{$displayParams.title}}' module=$module}{{else}}{$link}{{/if}}</a>
|
||||
{/if}
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
55
include/SugarFields/Fields/URL/EditView.tpl
Executable file
55
include/SugarFields/Fields/URL/EditView.tpl
Executable file
@@ -0,0 +1,55 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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 empty({{sugarvar key='value' string=true}})}
|
||||
{assign var="value" value={{sugarvar key='default_value' string=true}} }
|
||||
{else}
|
||||
{assign var="value" value={{sugarvar key='value' string=true}} }
|
||||
{/if}
|
||||
{{capture name=idname assign=idname}}{{sugarvar key='name'}}{{/capture}}
|
||||
{{if !empty($displayParams.idName)}}
|
||||
{{assign var=idname value=$displayParams.idName}}
|
||||
{{/if}}
|
||||
{{if !$vardef.gen}}
|
||||
{if !empty({{sugarvar key='value' string=true}})}
|
||||
<input type='text' name='{{$idname}}' id='{{$idname}}' size='{{$displayParams.size|default:30}}'
|
||||
{{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{{sugarvar key='value'}}' title='{{$vardef.help}}' tabindex='{{$tabindex}}'>
|
||||
{else}
|
||||
<input type='text' name='{{$idname}}' id='{{$idname}}' size='{{$displayParams.size|default:30}}'
|
||||
{{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}}
|
||||
{if $displayView=='advanced_search'||$displayView=='basic_search'}value=''{else}value='http://'{/if} title='{{$vardef.help}}' tabindex='{{$tabindex}}'>
|
||||
{/if}
|
||||
{{/if}}
|
||||
44
include/SugarFields/Fields/URL/ListView.tpl
Executable file
44
include/SugarFields/Fields/URL/ListView.tpl
Executable file
@@ -0,0 +1,44 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{capture name=getLink assign=link}{{sugarvar key='value'}}{/capture}
|
||||
{{if $vardef.gen}}
|
||||
{sugar_replace_vars subject='{{$vardef.default|replace:'{':'['|replace:'}':']'}}' assign='link'}
|
||||
{{/if}}
|
||||
{if !empty($link)}
|
||||
{capture name=getStart assign=linkStart}{$link|substr:0:7}{/capture}
|
||||
<a href='{$link|to_url}' {{if $displayParams.link_target}}target='{{$displayParams.link_target}}'{{elseif $vardef.link_target}}target='{{$vardef.link_target}}'{{/if}} >{{if !empty($displayParams.title)}}{sugar_translate label='{{$displayParams.title}}' module=$module}{{else}}{$link}{{/if}}</a>
|
||||
{/if}
|
||||
40
include/SugarFields/Fields/Username/DetailView.tpl
Executable file
40
include/SugarFields/Fields/Username/DetailView.tpl
Executable file
@@ -0,0 +1,40 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
*}
|
||||
{$fields[{{sugarvar key='salutation' stringFormat=true}}].value} {$fields[{{sugarvar key='first_name' stringFormat=true}}].value} {$fields[{{sugarvar key='last_name' stringFormat=true}}].value}
|
||||
{{if !empty($displayParams.enableConnectors)}}
|
||||
{{sugarvar_connector view='DetailView'}}
|
||||
{{/if}}
|
||||
50
include/SugarFields/Fields/Username/SugarFieldUsername.php
Executable file
50
include/SugarFields/Fields/Username/SugarFieldUsername.php
Executable file
@@ -0,0 +1,50 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
require_once('include/SugarFields/Fields/Base/SugarFieldBase.php');
|
||||
|
||||
class SugarFieldUsername extends SugarFieldBase {
|
||||
function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
|
||||
$this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
|
||||
|
||||
global $current_language;
|
||||
if(isset($current_language) && file_exists('include/SugarFields/Fields/Username/' . $current_language . '.DetailView.tpl')) {
|
||||
return $this->fetch('include/SugarFields/Fields/Username/' . $current_language . '.DetailView.tpl');
|
||||
} else {
|
||||
return $this->fetch('include/SugarFields/Fields/Username/DetailView.tpl');
|
||||
} //if-else
|
||||
}
|
||||
}
|
||||
?>
|
||||
335
include/SugarFields/Parsers/CreateViewMetaParser.php
Normal file
335
include/SugarFields/Parsers/CreateViewMetaParser.php
Normal file
@@ -0,0 +1,335 @@
|
||||
<?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".
|
||||
* ****************************************************************************** */
|
||||
|
||||
/**
|
||||
* CreateViewMetaParser.php
|
||||
* This is a utility file that attempts to provide support for parsing pre 5.0 SugarCRM
|
||||
* CreateView.html files and produce a best guess editviewdefs.php file equivalent.
|
||||
*
|
||||
* @author Collin Lee
|
||||
*/
|
||||
require_once('include/SugarFields/Parsers/MetaParser.php');
|
||||
|
||||
class CreateViewMetaParser extends MetaParser {
|
||||
|
||||
function CreateViewMetaParser() {
|
||||
$this->mView = 'CreateView';
|
||||
}
|
||||
|
||||
/**
|
||||
* parse
|
||||
*
|
||||
* @param $filePath The file path of the HTML file to parse
|
||||
* @param $vardefs The module's vardefs
|
||||
* @param $moduleDir The module's directory
|
||||
* @param $merge boolean value indicating whether or not to merge the parsed contents
|
||||
* @param $masterCopy The file path of the mater copy of the metadata file to merge against
|
||||
* @return String format of metadata contents
|
||||
* */
|
||||
function parse($filePath, $vardefs = array(), $moduleDir = '', $merge = false, $masterCopy = null) {
|
||||
|
||||
global $app_strings;
|
||||
$contents = file_get_contents($filePath);
|
||||
$contents = $this->trimHTML($contents);
|
||||
$contents = $this->stripFlavorTags($contents);
|
||||
$moduleName = '';
|
||||
|
||||
$contents = $this->fixDuplicateTrTags($contents);
|
||||
$contents = $this->fixRowsWithMissingTr($contents);
|
||||
|
||||
$tables = $this->getElementsByType("table", $contents);
|
||||
$formElements = $this->getFormElements($tables[0]);
|
||||
$hiddenInputs = array();
|
||||
foreach ($formElements as $elem) {
|
||||
$type = $this->getTagAttribute("type", $elem);
|
||||
if (preg_match('/hidden/si', $type)) {
|
||||
$name = $this->getTagAttribute("name", $elem);
|
||||
$value = $this->getTagAttribute("value", $elem);
|
||||
$hiddenInputs[$name] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the second table in the page and onward
|
||||
$tables = array_slice($tables, 1);
|
||||
$panels = array();
|
||||
$tableCount = 0;
|
||||
$addedElements = array();
|
||||
$maxTableCountNum = 0;
|
||||
$tableCount = 0;
|
||||
foreach ($tables as $table) {
|
||||
$table = $this->fixTablesWithMissingTr($table);
|
||||
$toptr = $this->getElementsByType("tr", $table);
|
||||
foreach ($toptr as $tr) {
|
||||
$tabledata = $this->getElementsByType("table", $tr);
|
||||
$data = array();
|
||||
$panelKey = $tableCount == 0 ? "default" : '';
|
||||
foreach ($tabledata as $t) {
|
||||
$vals = array_values($this->getElementsByType("tr", $t));
|
||||
if (preg_match_all('/<h4[^>]*?>.*?(\{MOD\.|\{APP\.)(LBL_[^\}]*?)[\}].*?<\/h4>/s', $vals[0], $matches, PREG_SET_ORDER)) {
|
||||
array_shift($vals);
|
||||
$panelKey = count($matches[0]) == 3 ? strtolower($matches[0][2]) : $panelKey;
|
||||
}
|
||||
|
||||
//If $panelKey is empty use the maxTableCountNum value
|
||||
if (empty($panelKey)) {
|
||||
$panels[$maxTableCountNum++] = $vals;
|
||||
} else {
|
||||
$panels[$panelKey] = $vals;
|
||||
}
|
||||
} //foreach
|
||||
$tableCount++;
|
||||
} //foreach;
|
||||
} //foreach
|
||||
|
||||
foreach ($panels as $id => $tablerows) {
|
||||
|
||||
$metarow = array();
|
||||
|
||||
foreach ($tablerows as $trow) {
|
||||
|
||||
$emptyCount = 0;
|
||||
$tablecolumns = $this->getElementsByType("td", $trow);
|
||||
$col = array();
|
||||
$slot = 0;
|
||||
|
||||
foreach ($tablecolumns as $tcols) {
|
||||
$hasRequiredLabel = false;
|
||||
|
||||
//Get the sugar attribute value in the span elements of each table row
|
||||
$sugarAttrLabel = $this->getTagAttribute("sugar", $tcols, "'^slot[^b]+$'");
|
||||
|
||||
//If there was no sugar attribute, try id (some versions of CreateView.html used this instead)
|
||||
if (empty($sugarAttrLabel)) {
|
||||
$sugarAttrLabel = $this->getTagAttribute("id", $tcols, "'^slot[^b]+$'");
|
||||
}
|
||||
|
||||
//Check if this field is required
|
||||
if (!empty($sugarAttrLabel)) {
|
||||
$hasRequiredLabel = $this->hasRequiredSpanLabel($tcols);
|
||||
}
|
||||
|
||||
$sugarAttrValue = $this->getTagAttribute("sugar", $tcols, "'slot[0-9]+b$'");
|
||||
|
||||
//If there was no sugar attribute, try id (some versions of CreateView.html used this instead)
|
||||
if (empty($sugarAttrValue)) {
|
||||
$sugarAttrValue = $this->getTagAttribute("id", $tcols, "'slot[0-9]+b$'");
|
||||
}
|
||||
|
||||
// If there wasn't any slot numbering/lettering then just default to expect label->vallue pairs
|
||||
$sugarAttrLabel = count($sugarAttrLabel) != 0 ? $sugarAttrLabel : ($slot % 2 == 0) ? true : false;
|
||||
$sugarAttrValue = count($sugarAttrValue) != 0 ? $sugarAttrValue : ($slot % 2 == 1) ? true : false;
|
||||
$slot++;
|
||||
|
||||
if ($sugarAttrValue) {
|
||||
|
||||
$spanValue = $this->getElementValue("span", $tcols);
|
||||
|
||||
if (empty($spanValue)) {
|
||||
$spanValue = $this->getElementValue("slot", $tcols);
|
||||
}
|
||||
|
||||
if (empty($spanValue)) {
|
||||
$spanValue = $this->getElementValue("td", $tcols);
|
||||
}
|
||||
|
||||
//Get all the editable form elements' names
|
||||
$formElementNames = $this->getFormElementsNames($spanValue);
|
||||
$customField = $this->getCustomField($formElementNames);
|
||||
|
||||
$name = '';
|
||||
$fields = null;
|
||||
$customCode = null;
|
||||
|
||||
if (!empty($customField)) {
|
||||
// If it's a custom field we just set the name
|
||||
$name = $customField;
|
||||
} else if (empty($formElementNames) && preg_match_all('/[\{]([^\}]*?)[\}]/s', $spanValue, $matches, PREG_SET_ORDER)) {
|
||||
// We are here if the $spanValue did not contain a form element for editing.
|
||||
// We will assume that it is read only (since there were no edit form elements)
|
||||
// If there is more than one matching {} value then try to find the right one to key off
|
||||
// based on vardefs.php file. Also, use the entire spanValue as customCode
|
||||
if (count($matches) > 1) {
|
||||
$name = $matches[0][1];
|
||||
$customCode = $spanValue;
|
||||
foreach ($matches as $pair) {
|
||||
if (preg_match("/^(mod[\.]|app[\.]).*?/i", $pair[1])) {
|
||||
$customCode = str_replace($pair[1], '$' . strtoupper($pair[1]), $customCode);
|
||||
} else {
|
||||
if (!empty($vardefs[$pair[1]])) {
|
||||
$name = $pair[1];
|
||||
$customCode = str_replace($pair[1], '$fields.' . strtolower($pair[1]) . '.value', $customCode);
|
||||
} else {
|
||||
$phpName = $this->findAssignedVariableName($pair[1], $filePath);
|
||||
$customCode = str_replace($pair[1], '$fields.' . strtolower($phpName) . '.value', $customCode);
|
||||
} //if-else
|
||||
}
|
||||
} //foreach
|
||||
} else {
|
||||
//If it is only a label, skip
|
||||
if (preg_match("/^(mod[\.]|app[\.]).*?/i", $matches[0][1])) {
|
||||
continue;
|
||||
}
|
||||
$name = strtolower($matches[0][1]);
|
||||
}
|
||||
} else if (is_array($formElementNames)) {
|
||||
|
||||
if (count($formElementNames) == 1) {
|
||||
|
||||
if (!empty($vardefs[$formElementNames[0]])) {
|
||||
$name = $formElementNames[0];
|
||||
} else {
|
||||
// Try to use the CreateView.php file to find author's intent
|
||||
$name = $this->findAssignedVariableName($formElementNames[0], $filePath);
|
||||
|
||||
//If it's still empty, just use the entire block as customCode
|
||||
if (empty($vardefs[$name])) {
|
||||
//Replace any { characters just in case
|
||||
$customCode = str_replace('{', '{$', $spanValue);
|
||||
}
|
||||
} //if-else
|
||||
} else {
|
||||
//If it is an Array of form elements, it is likely the _id and _name relate field combo
|
||||
$relateName = $this->getRelateFieldName($formElementNames);
|
||||
if (!empty($relateName)) {
|
||||
$name = $relateName;
|
||||
} else {
|
||||
//One last attempt to scan $formElementNames for one vardef field only
|
||||
$name = $this->findSingleVardefElement($formElementNames, $vardefs);
|
||||
if (empty($name)) {
|
||||
$fields = array();
|
||||
$name = $formElementNames[0];
|
||||
foreach ($formElementNames as $elementName) {
|
||||
if (isset($vardefs[$elementName])) {
|
||||
$fields[] = $elementName;
|
||||
} else {
|
||||
$fields[] = $this->findAssignedVariableName($elementName, $filePath);
|
||||
} //if-else
|
||||
} //foreach
|
||||
} //if
|
||||
} //if-else
|
||||
} //if-else
|
||||
}
|
||||
|
||||
// Build the entry
|
||||
if (preg_match("/<textarea/si", $spanValue)) {
|
||||
//special case for textarea form elements (add the displayParams)
|
||||
$displayParams = array();
|
||||
$displayParams['rows'] = $this->getTagAttribute("rows", $spanValue);
|
||||
$displayParams['cols'] = $this->getTagAttribute("cols", $spanValue);
|
||||
|
||||
if (!empty($displayParams['rows']) && !empty($displayParams['cols'])) {
|
||||
$field = array();
|
||||
$field['name'] = $name;
|
||||
$field['displayParams'] = $displayParams;
|
||||
} else {
|
||||
$field = $name;
|
||||
}
|
||||
} else {
|
||||
|
||||
if (isset($fields) || isset($customCode)) {
|
||||
$field = array();
|
||||
$field['name'] = $name;
|
||||
if (isset($fields)) {
|
||||
$field['fields'] = $fields;
|
||||
}
|
||||
if (isset($customCode)) {
|
||||
$field['customCode'] = $customCode;
|
||||
$field['description'] = 'This field was auto generated';
|
||||
}
|
||||
} else {
|
||||
$emptyCount = $name == '' ? $emptyCount + 1 : $emptyCount;
|
||||
$field = $name;
|
||||
}
|
||||
} //if-else if-else block
|
||||
|
||||
$addedField = is_array($field) ? $field['name'] : $field;
|
||||
if (empty($addedField) || empty($addedElements[$addedField])) {
|
||||
//Add the meta-data definition for required fields
|
||||
if ($hasRequiredLabel) {
|
||||
if (is_array($field)) {
|
||||
if (isset($field['displayParams']) && is_array($field['displayParams'])) {
|
||||
$field['displayParams']['required'] = true;
|
||||
} else {
|
||||
$field['displayParams'] = array('required' => true);
|
||||
}
|
||||
} else {
|
||||
$field = array('name' => strtolower($field), 'displayParams' => array('required' => true));
|
||||
}
|
||||
}
|
||||
$col[] = is_array($field) ? $field : strtolower($field);
|
||||
$addedElements[$addedField] = $addedField;
|
||||
}
|
||||
} //if($sugarAttValue)
|
||||
} //foreach
|
||||
// One last final check. If $emptyCount does not equal Array $col count, don't add
|
||||
if ($emptyCount != count($col)) {
|
||||
|
||||
if ($hasRequiredLabel) {
|
||||
if (is_array($col)) {
|
||||
if (isset($col['displayParams'])) {
|
||||
$col['displayParams']['required'] = true;
|
||||
} else {
|
||||
$col['displayParams'] = array('required' => true);
|
||||
}
|
||||
} else {
|
||||
$col = array('name' => strtolower($col), 'displayParams' => array('required' => true));
|
||||
}
|
||||
}
|
||||
|
||||
$metarow[] = $col;
|
||||
} //if
|
||||
} //foreach
|
||||
|
||||
$panels[$id] = $metarow;
|
||||
} //foreach
|
||||
|
||||
$this->mCustomPanels = $panels;
|
||||
$panels = $this->applyPreRules($moduleDir, $panels);
|
||||
|
||||
$templateMeta = array();
|
||||
if ($merge && !empty($masterCopy) && file_exists($masterCopy)) {
|
||||
$panels = $this->mergePanels($panels, $vardefs, $moduleDir, $masterCopy);
|
||||
$templateMeta = $this->mergeTemplateMeta($templateMeta, $moduleDir, $masterCopy);
|
||||
}
|
||||
$panels = $this->applyRules($moduleDir, $panels);
|
||||
return $this->createFileContents($moduleDir, $panels, $templateMeta, $filePath);
|
||||
}
|
||||
|
||||
}
|
||||
191
include/SugarFields/Parsers/DetailViewMetaParser.php
Executable file
191
include/SugarFields/Parsers/DetailViewMetaParser.php
Executable file
@@ -0,0 +1,191 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* DetailViewMetaParser.php
|
||||
* This is a utility file that attempts to provide support for parsing pre 5.0 SugarCRM
|
||||
* DetailView.html files and produce a best guess detailviewdefs.php file equivalent.
|
||||
*
|
||||
* @author Collin Lee
|
||||
*/
|
||||
require_once('include/SugarFields/Parsers/MetaParser.php');
|
||||
|
||||
/**
|
||||
* DetailViewMetaParser.php
|
||||
* This class is responsible for handling the parsing of DetailView.html files from
|
||||
* SugarCRM versions prior to 5.x. It will make a best guess of translating the
|
||||
* HTML file to a metadata format.
|
||||
*
|
||||
* @author Collin Lee
|
||||
*/
|
||||
class DetailViewMetaParser extends MetaParser {
|
||||
|
||||
function DetailViewMetaParser() {
|
||||
$this->mView = 'DetailView';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* parse
|
||||
*
|
||||
* @param $filePath The file path of the HTML file to parse
|
||||
* @param $vardefs The module's vardefs
|
||||
* @param $moduleDir The module's directory
|
||||
* @param $merge boolean value indicating whether or not to merge the parsed contents
|
||||
* @param $masterCopy The file path of the mater copy of the metadata file to merge against
|
||||
* @return String format of metadata contents
|
||||
**/
|
||||
function parse($filePath, $vardefs = array(), $moduleDir = '', $merge=false, $masterCopy=null) {
|
||||
|
||||
// Grab file contents
|
||||
$contents = file_get_contents($filePath);
|
||||
|
||||
// Remove \n,\r characters to allow for better text parsing
|
||||
$contents = $this->trimHTML($contents);
|
||||
$contents = $this->stripFlavorTags($contents);
|
||||
|
||||
|
||||
// Notes DetailView.html file is messed up
|
||||
if($moduleDir == 'Notes') {
|
||||
$contents = str_replace('{PAGINATION}<tr><td>', '{PAGINATION}', $contents);
|
||||
$contents = str_replace('</td></tr></table><script>', '</table><script>', $contents);
|
||||
$contents = str_replace("<tr><div id='portal_flag_row' name='portal_flag_row' style='display:none'>", "<div id='portal_flag_row' name='portal_flag_row' style='display:none'>", $contents);
|
||||
}
|
||||
|
||||
$contents = $this->fixDuplicateTrTags($contents);
|
||||
$contents = $this->fixRowsWithMissingTr($contents);
|
||||
|
||||
// Get all the tables
|
||||
$tables = $this->getElementsByType("table", $contents);
|
||||
|
||||
// Skip the first one
|
||||
$tables = array_slice($tables, 1);
|
||||
|
||||
$panels = array();
|
||||
$tableCount = 0;
|
||||
$metarow = array();
|
||||
foreach($tables as $table) {
|
||||
|
||||
$table = $this->fixTablesWithMissingTr($table);
|
||||
$tablerows = $this->getElementsByType("tr", $table);
|
||||
|
||||
foreach($tablerows as $trow) {
|
||||
|
||||
$metacolumns = array();
|
||||
$columns = $this->getElementsByType("td", $trow);
|
||||
$columns = array_reverse($columns, true);
|
||||
foreach($columns as $tcols) {
|
||||
|
||||
$sugarAttrValue = $this->getTagAttribute("sugar", $tcols, "'slot[0-9]+b$'");
|
||||
if(empty($sugarAttrValue)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$def = '';
|
||||
$field = $this->getElementValue("span", $tcols);
|
||||
//If it's a space, simply add a blank string
|
||||
if($field == ' ') {
|
||||
$metacolumns[] = "";
|
||||
} else if(!empty($field)) {
|
||||
|
||||
preg_match_all('/[\{]([^\}].*?)[\}]/s', $field, $matches, PREG_SET_ORDER);
|
||||
if(!empty($matches)) {
|
||||
if(count($matches) > 1) {
|
||||
|
||||
$def = array();
|
||||
|
||||
$def['name'] = preg_match('/_c$/i', $matches[0][1]) ? $matches[0][1] : strtolower($matches[0][1]);
|
||||
foreach($matches as $m) {
|
||||
if(isset($vardefs[strtolower($m[1])])) {
|
||||
$def['name'] = strtolower($m[1]);
|
||||
}
|
||||
}
|
||||
|
||||
$field = preg_replace('/<\{tag\.[a-z_]*?\}/i', '<a', $field);
|
||||
$field = preg_replace('/<\/\{tag\.[a-z_]*?\}>/i', '</a>', $field);
|
||||
|
||||
foreach($matches as $tag[1]) {
|
||||
if(preg_match("/^(mod[\.]|app[\.]).*?/i", $tag[1][1])) {
|
||||
$field = str_replace($tag[1][1], '$'.$tag[1][1], $field);
|
||||
} else {
|
||||
$theField = preg_match('/_c$/i', $tag[1][1]) ? $tag[1][1] : strtolower($tag[1][1]);
|
||||
if(!empty($vardefs[$theField])) {
|
||||
$field = str_replace($tag[1][1], '$fields.'. $theField.'.value', $field);
|
||||
} else {
|
||||
$phpName = $this->findAssignedVariableName($tag[1][1], $filePath);
|
||||
$field = str_replace($tag[1][1], '$fields.'. $theField.'.value', $field);
|
||||
} //if-else
|
||||
}
|
||||
}
|
||||
|
||||
$def['customCode'] = $field;
|
||||
$def['description'] = 'This field was auto generated';
|
||||
} else {
|
||||
$def = strtolower($matches[0][1]);
|
||||
}
|
||||
} //if
|
||||
$metacolumns[] = $def;
|
||||
} //if
|
||||
} //foreach($tablecolumns as $tcols)
|
||||
|
||||
$metarow[] = array_reverse($metacolumns);
|
||||
} //foreach($tablerows as $trow)
|
||||
|
||||
|
||||
$id = $tableCount == 0 ? 'default' : $tableCount;
|
||||
$tableCount++;
|
||||
$panels[$id] = $metarow;
|
||||
|
||||
} //foreach($tables as $table)
|
||||
|
||||
$this->mCustomPanels = $panels;
|
||||
$panels = $this->applyPreRules($moduleDir, $panels);
|
||||
|
||||
$templateMeta = array();
|
||||
if($merge && !empty($masterCopy) && file_exists($masterCopy)) {
|
||||
$panels = $this->mergePanels($panels, $vardefs, $moduleDir, $masterCopy);
|
||||
$templateMeta = $this->mergeTemplateMeta($templateMeta, $moduleDir, $masterCopy);
|
||||
}
|
||||
|
||||
$panels = $this->applyRules($moduleDir, $panels);
|
||||
return $this->createFileContents($moduleDir, $panels, $templateMeta, $filePath);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user