init
This commit is contained in:
100
include/VarDefHandler/SugarTabs/SugarTab.php
Executable file
100
include/VarDefHandler/SugarTabs/SugarTab.php
Executable file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
if(empty($GLOBALS['sugar_smarty']))$GLOBALS['sugar_smarty'] = new Sugar_Smarty();
|
||||
class SugarTab{
|
||||
|
||||
function SugarTab($type='singletabmenu'){
|
||||
$this->type = $type;
|
||||
|
||||
}
|
||||
|
||||
function setup($mainTabs, $otherTabs=array(), $subTabs=array(), $selected_group='All'){
|
||||
// TODO - prefs here
|
||||
//_pp($subTabs);_pp($otherTabs);
|
||||
$max_subtabs = $GLOBALS['current_user']->getPreference('max_subtabs');
|
||||
if($max_subtabs <= 0) $max_subtabs = 12;
|
||||
$max_tabs = $GLOBALS['current_user']->getPreference('max_tabs');
|
||||
if($max_tabs <= 0) $max_tabs = 12;
|
||||
$GLOBALS['sugar_smarty']->assign('sugartabs', array_slice($mainTabs, 0, $max_tabs));
|
||||
$GLOBALS['sugar_smarty']->assign('subtabs', array_slice($subTabs, 0, $max_subtabs));
|
||||
$GLOBALS['sugar_smarty']->assign('moreMenu', array_slice($mainTabs, $max_tabs));
|
||||
$GLOBALS['sugar_smarty']->assign('moreSubMenuName', $selected_group);
|
||||
$GLOBALS['sugar_smarty']->assign('moreSubMenu', array_slice($subTabs, $max_subtabs));
|
||||
$otherMoreTabs = array();
|
||||
if(!empty($otherTabs))
|
||||
{
|
||||
foreach($otherTabs as $key => $ot)
|
||||
{
|
||||
$otherMoreTabs[$key] = array('key' => $key,
|
||||
'tabs' => array_slice($ot['tabs'], $max_subtabs));
|
||||
$otherTabs[$key]['tabs'] = array_slice($ot['tabs'], 0, $max_subtabs);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$otherMoreTabs[$selected_group] = array('key' => $selected_group,
|
||||
'tabs' => array_slice($subTabs, $max_subtabs));
|
||||
$otherTabs[$selected_group]['tabs'] = array_slice($subTabs, 0, $max_subtabs);
|
||||
}
|
||||
//_pp($otherMoreTabs);
|
||||
$GLOBALS['sugar_smarty']->assign('othertabs', $otherTabs);
|
||||
$GLOBALS['sugar_smarty']->assign('otherMoreSubMenu', $otherMoreTabs);
|
||||
$GLOBALS['sugar_smarty']->assign('startSubPanel', $selected_group);
|
||||
if(!empty($mainTabs))
|
||||
{
|
||||
$mtak = array_keys($mainTabs);
|
||||
$GLOBALS['sugar_smarty']->assign('moreTab', $mainTabs[$mtak[min(count($mtak)-1, $max_tabs-1)]]['label']);
|
||||
}
|
||||
}
|
||||
|
||||
function fetch(){
|
||||
return $GLOBALS['sugar_smarty']->fetch('include/SugarTabs/tpls/' . $this->type . '.tpl');
|
||||
}
|
||||
function display(){
|
||||
$GLOBALS['sugar_smarty']->display('include/SugarTabs/tpls/' . $this->type . '.tpl');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
219
include/VarDefHandler/SugarTabs/tpls/singletabmenu.tpl
Executable file
219
include/VarDefHandler/SugarTabs/tpls/singletabmenu.tpl
Executable file
@@ -0,0 +1,219 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* 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>
|
||||
SUGAR.themes.currentSubpanelGroupLayoutChanged = false;
|
||||
|
||||
SUGAR.themes.currentSubpanelGroup = '{$startSubPanel}';
|
||||
|
||||
SUGAR.themes.subpanelMoreTab = '{$moreTab}';
|
||||
|
||||
SUGAR.themes.subpanelHtml = new Array();
|
||||
|
||||
SUGAR.themes.subpanelSubTabs = new Array();
|
||||
SUGAR.themes.subpanelGroups = new Array();
|
||||
{foreach from=$othertabs item=tab}
|
||||
{assign var='notFirst' value='0'}
|
||||
SUGAR.themes.subpanelGroups['{$tab.key}'] = [{foreach from=$tab.tabs item=subtab}{if $notFirst != 0}, {else}{assign var='notFirst' value='1'}{/if}'{$subtab.key}'{/foreach}{foreach from=$otherMoreSubMenu[$tab.key].tabs item=subtab}, '{$subtab.key}'{/foreach}];
|
||||
{assign var='notFirst' value='0'}
|
||||
SUGAR.themes.subpanelSubTabs['{$tab.key}'] = '<table border="0" cellpadding="0" cellspacing="0" height="20" width="100%" class="subTabs"><tr>{foreach from=$tab.tabs item=subtab}{if $notFirst != 0}<td width="1"> | </td>{else}{assign var='notFirst' value='1'}{/if}<td nowrap="nowrap"><a href="#{$subtab.key}" class="subTabLink">{$subtab.label}</a></td>{/foreach}{if !empty($otherMoreSubMenu[$tab.key].tabs) }<td nowrap="nowrap"> | <span class="subTabMore" id="MoreSub{$tab.key}PanelHandle" style="margin-left:2px; cursor: pointer; cursor: hand;" align="absmiddle" onmouseover="tbButtonMouseOver(this.id,\'\',\'\',0);">>></span></td>{/if}<td width="100%"> </td></tr></table>';
|
||||
{/foreach}
|
||||
|
||||
SUGAR.themes.loadSubpanelFromMore = function(subpanel){ldelim}
|
||||
//console.log('lsfm:'+subpanel);
|
||||
SUGAR.themes.updateSubpanelMoreTab(subpanel);
|
||||
SUGAR.themes.loadSubpanel(subpanel);
|
||||
{rdelim};
|
||||
|
||||
SUGAR.themes.updateSubpanelMoreTab = function(subpanel){ldelim}
|
||||
//console.log('usmt:'+subpanel+' | '+SUGAR.themes.subpanelMoreTab);
|
||||
|
||||
// Update Tab
|
||||
var moreTab = document.getElementById(SUGAR.themes.subpanelMoreTab + '_sp_tab');
|
||||
moreTab.id = subpanel + '_sp_tab';
|
||||
moreTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[0].getElementsByTagName('img')[0].alt = subpanel;
|
||||
moreTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[1].getElementsByTagName('a')[0].innerHTML = subpanel;
|
||||
moreTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[1].getElementsByTagName('a')[0].href = "javascript:SUGAR.themes.loadSubpanel('"+subpanel+"');";
|
||||
moreTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[2].getElementsByTagName('img')[0].alt = subpanel;
|
||||
|
||||
// Update Menu
|
||||
var menuLink = document.getElementById(subpanel+'_sp_mm');
|
||||
menuLink.id = SUGAR.themes.subpanelMoreTab+'_sp_mm';
|
||||
menuLink.href = "javascript:SUGAR.themes.loadSubpanelFromMore('"+SUGAR.themes.subpanelMoreTab+"');";
|
||||
menuLink.innerHTML = SUGAR.themes.subpanelMoreTab;
|
||||
|
||||
|
||||
SUGAR.themes.subpanelMoreTab = subpanel;
|
||||
{rdelim};
|
||||
|
||||
SUGAR.themes.loadSubpanel = function(subpanel){ldelim}
|
||||
//console.log('lsp:'+subpanel+' | '+SUGAR.themes.currentSubpanelGroup);
|
||||
if(SUGAR.themes.currentSubpanelGroupLayoutChanged && SUGAR.themes.subpanelHtml[SUGAR.themes.currentSubpanelGroup]){ldelim}
|
||||
SUGAR.themes.subpanelHtml[SUGAR.themes.currentSubpanelGroup] = document.getElementById('subpanel_list').innerHTML;
|
||||
SUGAR.themes.currentSubpanelGroupLayoutChanged = false;
|
||||
{rdelim}
|
||||
if(SUGAR.themes.subpanelHtml[subpanel]){ldelim}
|
||||
document.getElementById('subpanel_list').innerHTML = SUGAR.themes.subpanelHtml[subpanel];
|
||||
SUGAR.themes.updateSubpanelTabs(subpanel);
|
||||
{rdelim}else{ldelim}
|
||||
if(!SUGAR.themes.subpanelHtml[SUGAR.themes.currentSubpanelGroup]){ldelim}
|
||||
SUGAR.themes.subpanelHtml[SUGAR.themes.currentSubpanelGroup] = document.getElementById('subpanel_list').innerHTML;
|
||||
{rdelim}
|
||||
ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_LOADING'));
|
||||
SUGAR.util.retrieveAndFill('index.php?to_pdf=1&module=MySettings&action=LoadTabSubpanels&loadModule={$smarty.request.module}&record={$smarty.request.record}&subpanel='+subpanel,'subpanel_list', null, SUGAR.themes.updateSubpanelTabs, subpanel);
|
||||
{rdelim}
|
||||
SUGAR.themes.setGroupCookie(subpanel);
|
||||
{rdelim};
|
||||
|
||||
SUGAR.themes.updateSubpanelTabs = function(subpanel){ldelim}
|
||||
//console.log('ust:'+subpanel);
|
||||
|
||||
if(!SUGAR.themes.subpanelHtml[subpanel]){ldelim}
|
||||
SUGAR.themes.subpanelHtml[subpanel] = document.getElementById('subpanel_list').innerHTML;
|
||||
{rdelim}
|
||||
|
||||
document.getElementById('subpanelSubTabs').innerHTML = SUGAR.themes.subpanelSubTabs[subpanel];
|
||||
|
||||
oldTab = document.getElementById(SUGAR.themes.currentSubpanelGroup+'_sp_tab');
|
||||
if(oldTab){ldelim}
|
||||
oldTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[0].getElementsByTagName('img')[0].src = "{sugar_getimagepath file='otherTab_left.gif'}";
|
||||
oldTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[1].className = "otherTab";
|
||||
oldTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[1].getElementsByTagName('a')[0].className = "otherTabLink";
|
||||
oldTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[2].className = "otherTabRight";
|
||||
{rdelim}
|
||||
|
||||
mainTab = document.getElementById(subpanel+'_sp_tab');
|
||||
mainTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[0].getElementsByTagName('img')[0].src = "{sugar_getimagepath file='currentTab_left.gif'}";
|
||||
mainTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[1].className = "currentTab";
|
||||
mainTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[1].getElementsByTagName('a')[0].className = "currentTabLink";
|
||||
mainTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[2].className = "currentTabRight";
|
||||
|
||||
SUGAR.themes.updateSubpanelEventHandlers(subpanel);
|
||||
|
||||
SUGAR.themes.currentSubpanelGroup = subpanel;
|
||||
ajaxStatus.hideStatus();
|
||||
{rdelim};
|
||||
|
||||
SUGAR.themes.updateSubpanelEventHandlers = function(subpanel){ldelim}
|
||||
if(SubpanelInitTabNames){ldelim}
|
||||
SubpanelInitTabNames(SUGAR.themes.subpanelGroups[subpanel]);
|
||||
{rdelim}
|
||||
{rdelim};
|
||||
|
||||
SUGAR.themes.tabCookieName = get_module_name() + '_sp_tab';
|
||||
SUGAR.themes.setGroupCookie = function(subpanel){ldelim}
|
||||
Set_Cookie(SUGAR.themes.tabCookieName, subpanel, 3000, false, false,false);
|
||||
{rdelim};
|
||||
</script>
|
||||
|
||||
|
||||
<table cellpadding="0" cellspacing="0" width='100%' style="margin-top:7px;">
|
||||
{if !empty($sugartabs)}
|
||||
<tr>
|
||||
{foreach from=$sugartabs item=tab}
|
||||
<td width='1%'>
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="1" id="{$tab.label}_sp_tab">
|
||||
<tbody>
|
||||
<tr height="25">
|
||||
{capture assign="tabImage"}{$tab.type}Tab_left.gif{/capture}
|
||||
<td width='1'><img src="{sugar_getimagepath file=$tabImage}" alt="{$tab.label}" border="0" height="25" width="5"></td>
|
||||
<td width='1' class="{$tab.type}Tab" nowrap="nowrap"><a class="{$tab.type}TabLink" href="javascript:SUGAR.themes.loadSubpanel('{$tab.label}');">{$tab.label}</a></td>
|
||||
<td width='1' class="{$tab.type}TabRight"><img src="{sugar_getimagepath file='blank.gif'}" alt="{$tab.label}" border="0" height="1" width="2"></td>
|
||||
<td width='1' style="background-image: url({sugar_getimagepath file='emptyTabSpace.gif'});" valign="bottom"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
{/foreach}
|
||||
<td width='1%'>
|
||||
{if !empty($moreMenu)}
|
||||
<img src='{sugar_getimagepath file='more.gif'}' alt='' align='absmiddle' id='MorePanelHandle' style=' margin-left:2px; cursor: pointer; cursor: hand;' align='absmiddle' onmouseover='tbButtonMouseOver(this.id,"","",0);'>
|
||||
{/if}
|
||||
</td>
|
||||
<td width='100%'> </td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr height="20">
|
||||
<td class="subTabBar" colspan="100" id="subpanelSubTabs">
|
||||
<table border="0" cellpadding="0" cellspacing="0" height="20" width="100%" class="subTabs">
|
||||
<tbody>
|
||||
<tr>
|
||||
{foreach from=$subtabs item=tab}
|
||||
{if !empty($notFirst) && ($notFirst != 0) && ($notFirst != 1)}
|
||||
<td width='1'> | </td>
|
||||
{else}
|
||||
{assign var='notFirst' value='2'}
|
||||
{/if}
|
||||
<td nowrap="nowrap">
|
||||
<a href='#{$tab.key}' class='subTabLink'>{$tab.label}</a>
|
||||
</td>
|
||||
{/foreach}
|
||||
{if !empty($otherMoreSubMenu[$moreSubMenuName].tabs)}
|
||||
<td nowrap="nowrap"> | <span class="subTabMore" id="MoreSub{$moreSubMenuName}PanelHandle" style="margin-left:2px; cursor: pointer; cursor: hand;" align="absmiddle" onmouseover="tbButtonMouseOver(this.id,'','',0);">>></span></td>
|
||||
{/if}
|
||||
<td width='100%'> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
{if !empty($moreMenu)}
|
||||
<div id="MorePanelMenu" class="menu">
|
||||
{foreach from=$moreMenu item=tab}
|
||||
<a href="javascript:SUGAR.themes.loadSubpanelFromMore('{$tab.label}');" class="menuItem" id="{$tab.label}_sp_mm" parentid="MorePanelMenu" onmouseover="hiliteItem(this,'yes'); closeSubMenus(this);" onmouseout="unhiliteItem(this);">{$tab.label}</a>
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{foreach from=$otherMoreSubMenu item=group}
|
||||
{if !empty($group.tabs)}
|
||||
<div id="MoreSub{$group.key}PanelMenu" class="menu">
|
||||
{foreach from=$group.tabs item=subtab}
|
||||
<a href="#{$subtab.key}" class="menuItem" parentid="MoreSub{$group.key}PanelMenu" onmouseover="hiliteItem(this,'yes'); closeSubMenus(this);" onmouseout="unhiliteItem(this);">{$subtab.label}</a>
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
|
||||
|
||||
227
include/VarDefHandler/VarDefHandler.php
Executable file
227
include/VarDefHandler/VarDefHandler.php
Executable file
@@ -0,0 +1,227 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
//Vardef Handler Object
|
||||
class VarDefHandler {
|
||||
|
||||
var $meta_array_name;
|
||||
var $target_meta_array = false;
|
||||
var $start_none = false;
|
||||
var $extra_array = array(); //used to add custom items
|
||||
var $options_array = array();
|
||||
var $module_object;
|
||||
var $start_none_lbl = null;
|
||||
|
||||
function VarDefHandler(& $module, $meta_array_name=null){
|
||||
$this->module_object = $module;
|
||||
if($meta_array_name!=null){
|
||||
global $vardef_meta_array;
|
||||
include("include/VarDefHandler/vardef_meta_arrays.php");
|
||||
$this->target_meta_array = $vardef_meta_array[$meta_array_name];
|
||||
}
|
||||
|
||||
//end function setup
|
||||
}
|
||||
|
||||
function get_vardef_array($use_singular=false, $remove_dups = false, $use_field_name = false, $use_field_label = false){
|
||||
global $dictionary;
|
||||
global $current_language;
|
||||
global $app_strings;
|
||||
global $app_list_strings;
|
||||
|
||||
$temp_module_strings = return_module_language($current_language, $this->module_object->module_dir);
|
||||
|
||||
$base_array = $this->module_object->field_defs;
|
||||
//$base_array = $dictionary[$this->module_object->object_name]['fields'];
|
||||
|
||||
///Inclue empty none set or not
|
||||
if($this->start_none==true){
|
||||
if(!empty($this->start_none_lbl)){
|
||||
$this->options_array[''] = $this->start_none_lbl;
|
||||
} else {
|
||||
$this->options_array[''] = $app_strings['LBL_NONE'];
|
||||
}
|
||||
}
|
||||
|
||||
///used for special one off items added to filter array ex. would be href link for alert templates
|
||||
if(!empty($this->extra_array)){
|
||||
|
||||
foreach($this->extra_array as $key => $value){
|
||||
$this->options_array[$key] = $value;
|
||||
}
|
||||
}
|
||||
/////////end special one off//////////////////////////////////
|
||||
|
||||
|
||||
foreach($base_array as $key => $value_array){
|
||||
$compare_results = $this->compare_type($value_array);
|
||||
|
||||
if($compare_results == true){
|
||||
$label_name = '';
|
||||
if($value_array['type'] == 'link' && !$use_field_label){
|
||||
$this->module_object->load_relationship($value_array['name']);
|
||||
if(!empty($app_list_strings['moduleList'][$this->module_object->$value_array['name']->getRelatedModuleName()])){
|
||||
$label_name = $app_list_strings['moduleList'][$this->module_object->$value_array['name']->getRelatedModuleName()];
|
||||
}else{
|
||||
$label_name = $this->module_object->$value_array['name']->getRelatedModuleName();
|
||||
}
|
||||
}
|
||||
else if(!empty($value_array['vname'])){
|
||||
$label_name = $value_array['vname'];
|
||||
} else {
|
||||
$label_name = $value_array['name'];
|
||||
}
|
||||
|
||||
|
||||
$label_name = get_label($label_name, $temp_module_strings);
|
||||
|
||||
if(!empty($value_array['table'])){
|
||||
//Custom Field
|
||||
$column_table = $value_array['table'];
|
||||
} else {
|
||||
//Non-Custom Field
|
||||
$column_table = $this->module_object->table_name;
|
||||
}
|
||||
|
||||
if($value_array['type'] == 'link'){
|
||||
if($use_field_name){
|
||||
$index = $value_array['name'];
|
||||
|
||||
}else{
|
||||
$index = $this->module_object->$key->getRelatedModuleName();
|
||||
}
|
||||
}else{
|
||||
$index = $key;
|
||||
}
|
||||
|
||||
$value = trim($label_name, ':');
|
||||
if($remove_dups){
|
||||
if(!in_array($value, $this->options_array))
|
||||
$this->options_array[$index] = $value;
|
||||
}
|
||||
else
|
||||
$this->options_array[$index] = $value;
|
||||
|
||||
//end if field is included
|
||||
}
|
||||
|
||||
//end foreach
|
||||
}
|
||||
if($use_singular == true){
|
||||
return convert_module_to_singular($this->options_array);
|
||||
} else {
|
||||
return $this->options_array;
|
||||
}
|
||||
|
||||
//end get_vardef_array
|
||||
}
|
||||
|
||||
|
||||
function compare_type($value_array){
|
||||
|
||||
//Filter nothing?
|
||||
if(!is_array($this->target_meta_array)){
|
||||
return true;
|
||||
}
|
||||
|
||||
////////Use the $target_meta_array;
|
||||
if(isset($this->target_meta_array['inc_override'])){
|
||||
foreach($this->target_meta_array['inc_override'] as $attribute => $value){
|
||||
|
||||
foreach($value as $actual_value){
|
||||
if(isset($value_array[$attribute]) && $value_array[$attribute] == $actual_value) return true;
|
||||
}
|
||||
if(isset($value_array[$attribute]) && $value_array[$attribute] == $value) return true;
|
||||
|
||||
}
|
||||
}
|
||||
if(isset($this->target_meta_array['ex_override'])){
|
||||
foreach($this->target_meta_array['ex_override'] as $attribute => $value){
|
||||
|
||||
|
||||
foreach($value as $actual_value){
|
||||
if(isset($value_array[$attribute]) && $value_array[$attribute] == $actual_value) return false;
|
||||
|
||||
if(isset($value_array[$attribute]) && $value_array[$attribute] == $value) return false;
|
||||
}
|
||||
|
||||
//end foreach inclusion array
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($this->target_meta_array['inclusion'])){
|
||||
foreach($this->target_meta_array['inclusion'] as $attribute => $value){
|
||||
|
||||
if($attribute=="type"){
|
||||
foreach($value as $actual_value){
|
||||
if(isset($value_array[$attribute]) && $value_array[$attribute] != $actual_value) return false;
|
||||
}
|
||||
} else {
|
||||
if(isset($value_array[$attribute]) && $value_array[$attribute] != $value) return false;
|
||||
}
|
||||
//end foreach inclusion array
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($this->target_meta_array['exclusion'])){
|
||||
foreach($this->target_meta_array['exclusion'] as $attribute => $value){
|
||||
|
||||
foreach($value as $actual_value){
|
||||
if ( $attribute == 'reportable' ) {
|
||||
if ( $actual_value == 'true' ) $actual_value = 1;
|
||||
if ( $actual_value == 'false' ) $actual_value = 0;
|
||||
}
|
||||
if(isset($value_array[$attribute]) && $value_array[$attribute] == $actual_value) return false;
|
||||
}
|
||||
|
||||
//end foreach inclusion array
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
//end function compare_type
|
||||
}
|
||||
|
||||
//end class VarDefHandler
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
86
include/VarDefHandler/listvardefoverride.php
Executable file
86
include/VarDefHandler/listvardefoverride.php
Executable file
@@ -0,0 +1,86 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
//THIS IS TO FIX ANY VARDEFS IN CREATING LIST QUERIES (specifically relationships)
|
||||
if(isset($this->field_defs['assigned_user_name'])){
|
||||
$this->field_defs['assigned_user_name'] = array (
|
||||
'name' => 'assigned_user_name',
|
||||
'rname'=>'user_name',
|
||||
'vname' => 'LBL_ASSIGNED_TO',
|
||||
'type' => 'relate',
|
||||
'reportable'=>false,
|
||||
'source'=>'non-db',
|
||||
'link'=>'assigned_user_link'
|
||||
);
|
||||
}
|
||||
if(isset($this->field_defs['created_by'])){
|
||||
$this->field_defs['created_by_name'] = array (
|
||||
'name' => 'created_by_name',
|
||||
'rname'=>'user_name',
|
||||
'vname' => 'LBL_CREATED',
|
||||
'type' => 'relate',
|
||||
'reportable'=>false,
|
||||
'source'=>'non-db',
|
||||
'link'=>'created_by_link'
|
||||
);
|
||||
}
|
||||
if(isset($this->field_defs['modified_user_id'])){
|
||||
$this->field_defs['modified_user_name'] = array (
|
||||
'name' => 'modified_user_name',
|
||||
'rname'=>'user_name',
|
||||
'vname' => 'LBL_MODIFIED',
|
||||
'type' => 'relate',
|
||||
'reportable'=>false,
|
||||
'source'=>'non-db',
|
||||
'link'=>'modified_user_link'
|
||||
);
|
||||
$this->field_defs['modified_by_name'] = array (
|
||||
'name' => 'modified_user_name',
|
||||
'rname'=>'user_name',
|
||||
'vname' => 'LBL_MODIFIED',
|
||||
'type' => 'relate',
|
||||
'reportable'=>false,
|
||||
'source'=>'non-db',
|
||||
'link'=>'modified_user_link'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
316
include/VarDefHandler/vardef_meta_arrays.php
Executable file
316
include/VarDefHandler/vardef_meta_arrays.php
Executable file
@@ -0,0 +1,316 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
//holds various filter arrays for displaying vardef dropdowns
|
||||
//You can add your own if you would like
|
||||
|
||||
$vardef_meta_array = array (
|
||||
|
||||
'standard_display' => array(
|
||||
'inclusion' => array(
|
||||
//end inclusion
|
||||
),
|
||||
'exclusion' => array(
|
||||
'type' => array('id'),
|
||||
'name' => array('parent_type', 'deleted'),
|
||||
'reportable' => array('false'),
|
||||
//end exclusion
|
||||
),
|
||||
'inc_override' => array(
|
||||
'type' => array('team_list'),
|
||||
//end inc_override
|
||||
),
|
||||
'ex_override' => array(
|
||||
//end ex_override
|
||||
)
|
||||
//end standard_display
|
||||
),
|
||||
//////////////////////////////////////////////////////////////////
|
||||
'normal_trigger' => array(
|
||||
'inclusion' => array(
|
||||
//end inclusion
|
||||
),
|
||||
'exclusion' => array(
|
||||
'type' => array('id', 'link', 'datetime', 'date','datetimecombo'),
|
||||
'custom_type' => array('id', 'link', 'datetime', 'date','datetimecombo'),
|
||||
'name' => array('assigned_user_name', 'parent_type', 'amount_usdollar', 'deleted','filename', 'file_mime_type', 'file_url'),
|
||||
'reportable' => array('false'),
|
||||
'source' => array('non-db'),
|
||||
//end exclusion
|
||||
),
|
||||
|
||||
'inc_override' => array(
|
||||
'type' => array('team_list', 'assigned_user_name'),
|
||||
'name' => array('email1', 'email2', 'assigned_user_id'),
|
||||
//end inc_override
|
||||
),
|
||||
'ex_override' => array(
|
||||
'name' => array('team_name', 'account_name'),
|
||||
//end ex_override
|
||||
)
|
||||
|
||||
//end normal_trigger
|
||||
),
|
||||
//////////////////////////////////////////////////////////////////
|
||||
'normal_date_trigger' => array(
|
||||
'inclusion' => array(
|
||||
//end inclusion
|
||||
),
|
||||
'exclusion' => array(
|
||||
'type' => array('id', 'link'),
|
||||
'custom_type' => array('id', 'link'),
|
||||
'name' => array('assigned_user_name', 'parent_type', 'amount_usdollar', 'deleted','filename', 'file_mime_type', 'file_url'),
|
||||
'reportable' => array('false'),
|
||||
'source' => array('non-db'),
|
||||
//end exclusion
|
||||
),
|
||||
|
||||
'inc_override' => array(
|
||||
'type' => array('team_list', 'assigned_user_name'),
|
||||
'name' => array('email1', 'email2', 'assigned_user_id'),
|
||||
//end inc_override
|
||||
),
|
||||
'ex_override' => array(
|
||||
'name' => array('team_name', 'account_name'),
|
||||
//end ex_override
|
||||
)
|
||||
|
||||
//end normal_trigger
|
||||
),
|
||||
//////////////////////////////////////////////////////////////////
|
||||
'time_trigger' => array(
|
||||
'inclusion' => array(
|
||||
//end inclusion
|
||||
),
|
||||
'exclusion' => array(
|
||||
'type' => array('id', 'link', 'team_list', 'time'),
|
||||
'custom_type' => array('id', 'link', 'team_list', 'time'),
|
||||
'name' => array('parent_type', 'team_name', 'assigned_user_name', 'parent_type', 'amount_usdollar', 'deleted' ,'filename', 'file_mime_type', 'file_url'),
|
||||
'source' => array('non-db'),
|
||||
//end exclusion
|
||||
),
|
||||
|
||||
'inc_override' => array(
|
||||
//end inc_override
|
||||
),
|
||||
'ex_override' => array(
|
||||
'name' => array('date_entered'),
|
||||
//end ex_override
|
||||
)
|
||||
|
||||
//end time_trigger
|
||||
),
|
||||
//////////////////////////////////////////////////////////////////
|
||||
'action_filter' => array(
|
||||
'inclusion' => array(
|
||||
//end inclusion
|
||||
),
|
||||
'exclusion' => array(
|
||||
'type' => array('id', 'link', 'datetime', 'time'),
|
||||
'custom_type' => array('id', 'link', 'datetime', 'time'),
|
||||
'reportable' => array('false'),
|
||||
'source' => array('non-db'),
|
||||
'name' => array('created_by', 'parent_type', 'deleted', 'assigned_user_name', 'amount_usdollar', 'deleted' ,'filename', 'file_mime_type', 'file_url', 'resource_id'),
|
||||
//end exclusion
|
||||
),
|
||||
|
||||
'inc_override' => array(
|
||||
'type' => array('team_list'),
|
||||
'name' => array('assigned_user_id', 'time_start', 'date_start', 'email1', 'email2', 'date_due'),
|
||||
//end inc_override
|
||||
),
|
||||
'ex_override' => array(
|
||||
'name' => array('team_name', 'account_name'),
|
||||
//end ex_override
|
||||
)
|
||||
|
||||
//end action_filter
|
||||
),
|
||||
//////////////////////////////////////////////////////////////////
|
||||
'rel_filter' => array(
|
||||
'inclusion' => array(
|
||||
'type' => array('link'),
|
||||
//end inclusion
|
||||
),
|
||||
'exclusion' => array(
|
||||
'name' => array('direct_reports', 'accept_status'),
|
||||
//end exclusion
|
||||
),
|
||||
|
||||
'inc_override' => array(
|
||||
'name' => array('accounts', 'account', 'member_of'),
|
||||
//end inc_override
|
||||
),
|
||||
'ex_override' => array(
|
||||
'link_type' => array('one'),
|
||||
'name' => array('users'),
|
||||
//end ex_override
|
||||
)
|
||||
|
||||
//end rel_filter
|
||||
),
|
||||
///////////////////////////////////////////////////////////
|
||||
'trigger_rel_filter' => array(
|
||||
'inclusion' => array(
|
||||
'type' => array('link'),
|
||||
//end inclusion
|
||||
),
|
||||
'exclusion' => array(
|
||||
'name' => array('direct_reports', 'accept_status'),
|
||||
//end exclusion
|
||||
),
|
||||
|
||||
'inc_override' => array(
|
||||
'name' => array(),
|
||||
//end inc_override
|
||||
),
|
||||
'ex_override' => array(
|
||||
'name' => array('users', 'emails', 'product_bundles', 'email_addresses', 'email_addresses_primary', 'emailmarketing', 'tracked_urls', 'queueitems', 'log_entries', 'contract_types'),
|
||||
'module' => array('Users', 'Teams',
|
||||
'CampaignLog'
|
||||
),
|
||||
//end ex_override
|
||||
)
|
||||
|
||||
//end trigger_rel_filter
|
||||
),
|
||||
///////////////////////////////////////////////////////////
|
||||
'alert_rel_filter' => array(
|
||||
'inclusion' => array(
|
||||
'type' => array('link'),
|
||||
//end inclusion
|
||||
),
|
||||
'exclusion' => array(
|
||||
'name' => array('direct_reports', 'accept_status'),
|
||||
//end exclusion
|
||||
),
|
||||
|
||||
'inc_override' => array(
|
||||
'name' => array(),
|
||||
//end inc_override
|
||||
),
|
||||
'ex_override' => array(
|
||||
'name' => array('users', 'emails', 'product_bundles', 'email_addresses', 'email_addresses_primary', 'emailmarketing', 'tracked_urls', 'queueitems', 'log_entries', 'contract_types', 'reports_to_link'),
|
||||
'module' => array('Users', 'Teams',
|
||||
'CampaignLog',
|
||||
'Releases'),
|
||||
//end ex_override
|
||||
)
|
||||
|
||||
//end alert_rel_filter
|
||||
),
|
||||
///////////////////////////////////////////////////////////
|
||||
'template_filter' => array(
|
||||
'inclusion' => array(
|
||||
//end inclusion
|
||||
),
|
||||
'exclusion' => array(
|
||||
'type' => array('id', 'link'),
|
||||
'custom_type' => array('id', 'link'),
|
||||
'reportable' => array('false'),
|
||||
'source' => array('non-db'),
|
||||
'name' => array('created_by', 'parent_type', 'deleted', 'assigned_user_name','amount_usdollar', 'filename', 'file_mime_type', 'file_url'),
|
||||
//end exclusion
|
||||
),
|
||||
|
||||
'inc_override' => array(
|
||||
'name' => array('assigned_user_id', 'assigned_user_name', 'modified_user_id', 'modified_by_name', 'created_by', 'created_by_name', 'full_name', 'email1', 'email2', 'team_name'),
|
||||
//end inc_override
|
||||
),
|
||||
'ex_override' => array(
|
||||
'name' => array('team_id'),
|
||||
//end ex_override
|
||||
)
|
||||
|
||||
//end template_filter
|
||||
),
|
||||
//////////////////////////////////////////////////////////////
|
||||
'alert_trigger' => array(
|
||||
'inclusion' => array(
|
||||
//end inclusion
|
||||
),
|
||||
'exclusion' => array(
|
||||
'type' => array('id', 'link', 'datetime', 'date'),
|
||||
'custom_type' => array('id', 'link', 'datetime', 'date'),
|
||||
'name' => array('assigned_user_name', 'parent_type', 'amount_usdollar', 'deleted', 'filename', 'file_mime_type', 'file_url'),
|
||||
'reportable' => array('false'),
|
||||
'source' => array('non-db'),
|
||||
//end exclusion
|
||||
),
|
||||
|
||||
'inc_override' => array(
|
||||
'type' => array('team_list', 'assigned_user_name'),
|
||||
'name' => array('full_name'),
|
||||
//end inc_override
|
||||
),
|
||||
'ex_override' => array(
|
||||
'name' => array('team_name', 'account_name'),
|
||||
//end ex_override
|
||||
)
|
||||
|
||||
//end alert_trigger
|
||||
),
|
||||
//////////////////////////////////////////////////////////////////
|
||||
'template_rel_filter' => array(
|
||||
'inclusion' => array(
|
||||
'type' => array('link'),
|
||||
//end inclusion
|
||||
),
|
||||
'exclusion' => array(
|
||||
'name' => array('direct_reports', 'accept_status'),
|
||||
//end exclusion
|
||||
),
|
||||
|
||||
'inc_override' => array(
|
||||
'name' => array(),
|
||||
//end inc_override
|
||||
),
|
||||
'ex_override' => array(
|
||||
'name' => array('users', 'email_addresses', 'email_addresses_primary', 'emailmarketing', 'tracked_urls', 'queueitems', 'log_entries', 'reports_to_link'),
|
||||
'module' => array('Users', 'Teams',
|
||||
'CampaignLog'
|
||||
),
|
||||
//end ex_override
|
||||
)
|
||||
|
||||
//end template_rel_filter
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user