Friday, October 15, 2010

SugarCrm 5.5.2 - Grouped menu : Allow hiding in subpanels or main menu

Tabgroup - Should be main menu, subpanel, or both

This feature will allow the user to hide a tab in main menu or subpanel tabs or in both. So user can customize it based on their requirement.
To use this feature go to Admin -> Configure Tabs Group as seen in the screen shot below



1. If Hide in top menu checkbox checked group will not be shown in top menu.
2. If Hide in subpanel checkbox checked group will not be shown in subpanel.
3. After setting the hide properties & label value click on the save button (floppy icon) and then press Save & Deploy button. Now the top menu tab & subpanel tab will reflect the changes just made.


This customization is non upgrade safe.
The following files have been modified in the 5.5.2 released code.

1. include/GroupedTabs/GroupedTabStructure.php
a. New argument $is_subpanel = false is added in function get_tab_structure. This function also modified to filter hidden entry.

// HACK: Tabgroup - Should be main menu, subpanel, or both
function get_tab_structure($modList = '', $patch = '', $ignoreSugarConfig=false, $labelAsKey=false, $is_subpanel = false)
// HACK: Tabgroup - Should be main menu, subpanel, or both
{
 global $modListHeader, $app_strings, $modInvisListActivities;
 
 /* Use default if not provided */
 if(!$modList)
 {
  $modList =& $modListHeader;
 }
 
 /* Apply patch, use a reference if we can */
 if($patch)
 {
  $tabStructure = $GLOBALS['tabStructure'];
  
  foreach($patch as $mainTab => $subModules)
  {
   $tabStructure[$mainTab]['modules'] = array_merge($tabStructure[$mainTab]['modules'], $subModules);
  }
 }
 else
 {
  $tabStructure =& $GLOBALS['tabStructure'];
 }
 
 $retStruct = array();
 $mlhUsed = array();
 //the invisible list should be merged if activities is set to be hidden
 if(in_array('Activities', $modList)){
  $modList = array_merge($modList,$modInvisListActivities);
 }
 
 //Add any iFrame tabs to the 'other' group.
 $moduleExtraMenu = array();
 if(!should_hide_iframes()) {
  $iFrame = new iFrame();
  $frames = $iFrame->lookup_frames('tab'); 
  foreach($frames as $key => $values){
   $moduleExtraMenu[$key] = $values;
  }
 } else if(isset($modList['iFrames'])) {
  unset($modList['iFrames']);
 }
   
 $modList = array_merge($modList,$moduleExtraMenu);
   
 /* Only return modules which exists in the modList */
 foreach($tabStructure as $mainTab => $subModules)
 {
  // HACK: Tabgroup - Should be main menu, subpanel, or both
  if($subModules['hideinsubpanel'] == true && $is_subpanel == true){
   continue;
  }
  // HACK: Tabgroup - Should be main menu, subpanel, or both

  //Ensure even empty groups are returned
  if($labelAsKey){
   $retStruct[$subModules['label']]['modules'] = array();
  }else{
   $retStruct[$app_strings[$subModules['label']]]['modules']= array();
  }
  
  foreach($subModules['modules'] as $key => $subModule)
  {
     /* Perform a case-insensitive in_array check
   * and mark whichever module matched as used.
   */ 
   foreach($modList as $module)
   {
    if(is_string($module) && strcasecmp($subModule, $module) === 0)
    {
     // HACK: Do not show tab groups marked as hideintopmenu=true in top menu
     if (!$subModules['hideintopmenu'] ){
      if($labelAsKey){
       $retStruct[$subModules['label']]['modules'][] = $subModule;
      } 
      else{
       $retStruct[$app_strings[$subModules['label']]]['modules'][] = $subModule;
      }
     }
     // HACK: Do not show tab groups marked as hideintopmenu=true in top menu

     // HACK : If subpanels then done hide grouped tabs
     if($is_subpanel === true){
     if($labelAsKey){
      $retStruct[$subModules['label']]['modules'][] = $subModule;
     }else{
      $retStruct[$app_strings[$subModules['label']]]['modules'][] = $subModule;
     }                        
     }                        
     // HACK : If subpanels then done hide grouped tabs
     
     $mlhUsed[$module] = true;
     break;
    }
    // HACK: subpanels are not grouped in tabs anymore, this fixes it
    elseif ((strpos($module, (strtolower($subModule) . '_')) !== false) || (strpos($module, ('_' . strtolower($subModule))) !== false)){
     // Make sure we do not make a subpanel tab for the focus module (main module) since this main module most likely is places in a tabgroup as well
     if(strcasecmp($subModule, $GLOBALS[focus]->object_name) !== 0) {
      // HACK: Upgrade sugarbase to SugarCRM 5.5
      if($labelAsKey){
       $retStruct[$subModules['label']]['modules'][$key] = $module;
      }
      else {
       $retStruct[$app_strings[$subModules['label']]]['modules'][$key] = $module;                        
      }
      // HACK: Upgrade sugarbase to SugarCRM 5.5
     }                        
     $mlhUsed[$module] = true;
     break;
    }
    // HACK: Subpanels are not grouped in tabs anymore, this fixes it
   }
  }
  //remove the group tabs if it has no sub modules under it         
  if($labelAsKey){
    if (empty($retStruct[$subModules['label']]['modules'])){
    unset($retStruct[$subModules['label']]);
    }
    }else{
    if (empty($retStruct[$app_strings[$subModules['label']]]['modules'])){
    unset($retStruct[$app_strings[$subModules['label']]]);
    }
  }
 }
 
   //The other tab is shown by default . If the other_group_tab_displayed was set false in sugar config, we will not show the 'Other' tab in Group Tab List.
 global $sugar_config;
 //If return result ignore sugar config or $sugar_config['other_group_tab_displayed'] is not set ever or $sugar_config['other_group_tab_displayed'] is true 
 if($ignoreSugarConfig || ( !isset($sugar_config['other_group_tab_displayed']) || $sugar_config['other_group_tab_displayed'])){
 /* Put all the unused modules in modList
  * into the 'Other' tab.
  */
  foreach($modList as $module)
  {
   if(is_array($module) || !isset($mlhUsed[$module]))
   {
     if($labelAsKey){
      $retStruct['LBL_TABGROUP_OTHER']['modules'] []= $module;
     }else{
      $retStruct[$app_strings['LBL_TABGROUP_OTHER']]['modules'] []= $module;
     }
   }
  }
 }else{
  //If  the 'Other' group tab was not allowed returned, we should check the $retStruct array to make sure there is no 'Other' group tab in it.
  if(isset($retStruct[$app_strings['LBL_TABGROUP_OTHER']])){
   if($labelAsKey){
    unset($retStruct['LBL_TABGROUP_OTHER']);
   }else{
    unset($retStruct[$app_strings['LBL_TABGROUP_OTHER']]);
   }
 
  }          
 }
//        _pp($retStruct);
 return $retStruct;
}


2. include/SubPanel/SubPanelTilesTabs.php
a. function getTabs modified to get filtered tab structure from GroupedTabStructure->get_tab_structure().

// HACK: Tabgroup - Should be main menu, subpanel, or both
$groupedTabsClass = new GroupedTabStructure();
$gtc = $groupedTabsClass->get_tab_structure($tabs, '', true, true, true);
 
foreach( $gtc as $mainTab => $subModules)
// HACK: Tabgroup - Should be main menu, subpanel, or both


3. modules/Studio/studiotabgroups.js
a. Function StudioTabGroup.prototype.editTabGroupLabel modified to show/hide checkboxes.

StudioTabGroup.prototype.editTabGroupLabel = function (id, done) {
 if (!done) {
  if (this.lastEditTabGroupLabel != -1) StudioTabGroup.prototype.editTabGroupLabel(this.lastEditTabGroupLabel, true);
  document.getElementById('tabname_' + id).style.display = 'none';
  document.getElementById('tablabel_' + id).style.display = '';
  // HACK: To allow us to decide if the tab group goes in top menu
        document.getElementById('tabTopMenuConfig_'+id).style.display = ''; // Show
        // HACK: To allow us to decide if the tab group goes in top menu
  document.getElementById('tabother_' + id).style.display = 'none';
  try {
   document.getElementById('tablabel_' + id).focus();
  }
  catch (er) {}
  this.lastEditTabGroupLabel = id;
  YAHOO.util.DragDropMgr.lock();
 } else {
  this.lastEditTabGroupLabel = -1;
  document.getElementById('tabname_' + id).innerHTML = document.getElementById('tablabel_' + id).value;
  document.getElementById('tabname_' + id).style.display = '';
  document.getElementById('tablabel_' + id).style.display = 'none';
        // HACK: To allow us to decide if the tab group goes in top menu
  if (document.getElementById('tabhideintopmenu_'+id).checked) {
            document.getElementById('slot'+id).style.fontStyle = 'italic;';
            document.getElementById('tabname_'+id).style.color = '#808080';
            document.getElementById('slot'+id).style.color = '#808080';
        }
        else {
            document.getElementById('slot'+id).style.fontStyle = 'normal';
            document.getElementById('tabname_'+id).style.fontStyle = 'normal;';
            document.getElementById('tabname_'+id).style.color = '#000000;';
            document.getElementById('slot'+id).style.color = '#000000;';
        }
        document.getElementById('tabTopMenuConfig_'+id).style.display = 'none'; // Hide
        // HACK: To allow us to decide if the tab group goes in top menu
  document.getElementById('tabother_' + id).style.display = '';
  YAHOO.util.DragDropMgr.unlock();
 }
}


4. modules/Studio/TabGroups/EditViewTabs.php
a. Group tab structure now used from $GLOBALS['tabStructure'].
//$groupedTabStructure = $groupedTabsClass->get_tab_structure('', '', true,true);
$groupedTabStructure = $GLOBALS['tabStructure'];


5. modules/Studio/TabGroups/EditViewTabs.tpl
a. Template modified to support 2 new hide property checkboxes. If for any tag group hide in top menu check box is checked then it will be shown grey & italic.
(the syntax highlighting in the code below is somewhat off due to the Smarty template)
<div id='slot{$tabCounter}' class='noBullet' {if $tab.hideintopmenu}style='color:#808080; font-style: italic;'{/if}>
<h2 id='handle{$tabCounter}' >
<span id='tabname_{$tabCounter}' class='slotB' {if $tab.hideintopmenu}style='color:#808080; font-style: italic;'{/if}>{$tab.labelValue}</span><br>
<span id='tabother_{$tabCounter}'>
<span onclick='studiotabs.editTabGroupLabel({$tabCounter}, false)'>{$editImage}</span>&nbsp;
{if $tab.label != $otherLabel }
 <span onclick='studiotabs.deleteTabGroup({$tabCounter})'>{$deleteImage}</span>
{/if}
</span></h2>
<input type='hidden' name='tablabelid_{$tabCounter}' id='tablabelid_{$tabCounter}'  value='{$tab.label}'><input type='text' name='tablabel_{$tabCounter}' id='tablabel_{$tabCounter}' style='display:none' value='{$tab.labelValue}' >
{* // HACK: Tabgroup - Should be main menu, subpanel, or both *}
<span id="tabTopMenuConfig_{$tabCounter}" name="tabTopMenuConfig_{$tabCounter}" style='display:none'>
<br/>
Hide in top menu:
<input type='checkbox' name='tabhideintopmenu_{$tabCounter}' id='tabhideintopmenu_{$tabCounter}' value='hide' {if $tab.hideintopmenu}checked{/if}>
<br/>
{* // HACK: Tabgroup - Should be main menu, subpanel, or both *}
Hide in subpanel:
<input type='checkbox' name='tabhideinsubpanel_{$tabCounter}' id='tabhideinsubpanel_{$tabCounter}' value='hide' {if $tab.hideinsubpanel}checked{/if}>
<br/>
{* // HACK: Tabgroup - Should be main menu, subpanel, or both *}

<img src="themes/default/images/icon_email_save.gif" border="0" onclick='studiotabs.editTabGroupLabel({$tabCounter}, true)'>
<br/><br/>
</span>
{* // HACK: Tabgroup - Should be main menu, subpanel, or both *}


6. modules/Studio/TabGroups/TabGroupHelper.php
a. function saveTabGroups modified to set both hide property in $tabGroups from $params, before saving $tabGroups to tabconfig file.

// HACK: Tabgroup - Should be main menu, subpanel, or both
if (!empty($params['tabhideintopmenu_' . $index])) {
 $tabGroups[$labelID]['hideintopmenu'] = true;
}
else {
 $tabGroups[$labelID]['hideintopmenu'] = false; 
}
// HACK: Tabgroup - Should be main menu, subpanel, or both

// HACK: Tabgroup - Should be main menu, subpanel, or both
if (!empty($params['tabhideinsubpanel_' . $index])) {
 $tabGroups[$labelID]['hideinsubpanel'] = true;
}
else {
 $tabGroups[$labelID]['hideinsubpanel'] = false; 
}
// HACK: Tabgroup - Should be main menu, subpanel, or both

And here it the SVN diff file

Index: include/GroupedTabs/GroupedTabStructure.php
===================================================================
--- include/GroupedTabs/GroupedTabStructure.php    (revision 1)
+++ include/GroupedTabs/GroupedTabStructure.php    (working copy)
@@ -53,7 +53,9 @@
      * 
      * @return  array   the complete tab-group structure
      */
-    function get_tab_structure($modList = '', $patch = '', $ignoreSugarConfig=false, $labelAsKey=false)
+    //Ketty: Tabgroup - Should be main menu, subpanel, or both
+    function get_tab_structure($modList = '', $patch = '', $ignoreSugarConfig=false, $labelAsKey=false, $is_subpanel = false)
+    //Ketty: Tabgroup - Should be main menu, subpanel, or both
     {
         global $modListHeader, $app_strings, $modInvisListActivities;
         
@@ -102,6 +104,12 @@
         /* Only return modules which exists in the modList */
         foreach($tabStructure as $mainTab => $subModules)
         {
+            //Hack  - Tabgroup - Should be main menu, subpanel, or both
+            if($subModules['hideinsubpanel'] == true && $is_subpanel == true){
+                continue;
+            }
+            //Hack  - Tabgroup - Should be main menu, subpanel, or both
+
             //Ensure even empty groups are returned
             if($labelAsKey){
                 $retStruct[$subModules['label']]['modules'] = array();
@@ -118,14 +126,47 @@
                 {
                     if(is_string($module) && strcasecmp($subModule, $module) === 0)
                     {
+                        // HACK  : Do not show tab groups marked as hideintopmenu=true in top menu
+                        if (!$subModules['hideintopmenu'] ){
+                            if($labelAsKey){
+                                $retStruct[$subModules['label']]['modules'][] = $subModule;
+                            } 
+                            else{
+                                $retStruct[$app_strings[$subModules['label']]]['modules'][] = $subModule;
+                            }
+                        }
+                        // HACK  : Do not show tab groups marked as hideintopmenu=true in top menu
+
+                        //HACK : if subpanels then done hide grouped tabs
+                        if($is_subpanel === true){
                         if($labelAsKey){
                             $retStruct[$subModules['label']]['modules'][] = $subModule;
                         }else{
                             $retStruct[$app_strings[$subModules['label']]]['modules'][] = $subModule;
                         }                        
+                        }                        
+                        //HACK : if subpanels then done hide grouped tabs
+                        
                         $mlhUsed[$module] = true;
                         break;
                     }
+                    // HACK  : subpanels are not grouped in tabs anymore, this fixes it
+                    elseif ((strpos($module, (strtolower($subModule) . '_')) !== false) || (strpos($module, ('_' . strtolower($subModule))) !== false)){
+                        // Make sure we do not make a subpanel tab for the focus module (main module) since this main module most likely is places in a tabgroup as well
+                        if(strcasecmp($subModule, $GLOBALS[focus]->object_name) !== 0) {
+                            //Ketty: Upgrade sugarbase to SugarCRM 5.5
+                            if($labelAsKey){
+                                $retStruct[$subModules['label']]['modules'][$key] = $module;
+                            }
+                            else {
+                                $retStruct[$app_strings[$subModules['label']]]['modules'][$key] = $module;                        
+                            }
+                            //Ketty: Upgrade sugarbase to SugarCRM 5.5
+                        }                        
+                        $mlhUsed[$module] = true;
+                        break;
+                    }
+                    // HACK  : subpanels are not grouped in tabs anymore, this fixes it
                 }
             }
             //remove the group tabs if it has no sub modules under it            
Index: include/SubPanel/SubPanelTilesTabs.php
===================================================================
--- include/SubPanel/SubPanelTilesTabs.php    (revision 1)
+++ include/SubPanel/SubPanelTilesTabs.php    (working copy)
@@ -125,7 +125,12 @@
         $groups =  array () ;
         $found = array () ;
 
-        foreach( $GLOBALS['tabStructure'] as $mainTab => $subModules)
+        //Ketty: Tabgroup - Should be main menu, subpanel, or both
+        $groupedTabsClass = new GroupedTabStructure();
+        $gtc = $groupedTabsClass->get_tab_structure($tabs, '', true, true, true);
+         
+        foreach( $gtc as $mainTab => $subModules)
+        //Ketty: Tabgroup - Should be main menu, subpanel, or both
         {
             foreach( $subModules['modules'] as $key => $subModule )
             {
Index: modules/Studio/studiotabgroups.js
===================================================================
--- modules/Studio/studiotabgroups.js    (revision 1)
+++ modules/Studio/studiotabgroups.js    (working copy)
@@ -32,15 +32,114 @@
  * technical reasons, the Appropriate Legal Notices must display the words
  * "Powered by SugarCRM".
  ********************************************************************************/
-var subtabCount=[];var subtabModules=[];var tabLabelToValue=[];StudioTabGroup=function(){this.lastEditTabGroupLabel=-1;};StudioTabGroup.prototype.editTabGroupLabel=function(id,done){if(!done){if(this.lastEditTabGroupLabel!=-1)StudioTabGroup.prototype.editTabGroupLabel(this.lastEditTabGroupLabel,true);document.getElementById('tabname_'+id).style.display='none';document.getElementById('tablabel_'+id).style.display='';document.getElementById('tabother_'+id).style.display='none';try{document.getElementById('tablabel_'+id).focus();}
-catch(er){}
-this.lastEditTabGroupLabel=id;YAHOO.util.DragDropMgr.lock();}else{this.lastEditTabGroupLabel=-1;document.getElementById('tabname_'+id).innerHTML=document.getElementById('tablabel_'+id).value;document.getElementById('tabname_'+id).style.display='';document.getElementById('tablabel_'+id).style.display='none';document.getElementById('tabother_'+id).style.display='';YAHOO.util.DragDropMgr.unlock();}}
-StudioTabGroup.prototype.generateForm=function(formname){var form=document.getElementById(formname);for(var j=0;j<slotCount;j++){var ul=document.getElementById('ul'+j);var items=ul.getElementsByTagName('li');for(var i=0;i<items.length;i++){if(typeof(subtabModules[items[i].id])!='undefined'){var input=document.createElement('input');input.type='hidden';input.name=j+'_'+i;input.value=tabLabelToValue[subtabModules[items[i].id]];form.appendChild(input);}}}
-form.slot_count.value=slotCount;};StudioTabGroup.prototype.generateGroupForm=function(formname){var form=document.getElementById(formname);for(j=0;j<slotCount;j++){var ul=document.getElementById('ul'+j);items=ul.getElementsByTagName('li');for(i=0;i<items.length;i++){if(typeof(subtabModules[items[i].id])!='undefined'){var input=document.createElement('input');input.type='hidden'
-input.name='group_'+j+'[]';input.value=tabLabelToValue[subtabModules[items[i].id]];form.appendChild(input);}}}};StudioTabGroup.prototype.deleteTabGroup=function(id){if(document.getElementById('delete_'+id).value==0){document.getElementById('ul'+id).style.display='none';document.getElementById('tabname_'+id).style.textDecoration='line-through'
-document.getElementById('delete_'+id).value=1;}else{document.getElementById('ul'+id).style.display='';document.getElementById('tabname_'+id).style.textDecoration='none'
-document.getElementById('delete_'+id).value=0;}}
-var lastField='';var lastRowCount=-1;var undoDeleteDropDown=function(transaction){deleteDropDownValue(transaction['row'],document.getElementById(transaction['id']),false);}
-jstransaction.register('deleteDropDown',undoDeleteDropDown,undoDeleteDropDown);function deleteDropDownValue(rowCount,field,record){if(record){jstransaction.record('deleteDropDown',{'row':rowCount,'id':field.id});}
-if(field.value=='0'){field.value='1';document.getElementById('slot'+rowCount+'_value').style.textDecoration='line-through';}else{field.value='0';document.getElementById('slot'+rowCount+'_value').style.textDecoration='none';}}
-var studiotabs=new StudioTabGroup();
\ No newline at end of file
+var subtabCount = [];
+var subtabModules = [];
+var tabLabelToValue = [];
+StudioTabGroup = function () {
+    this.lastEditTabGroupLabel = -1;
+};
+StudioTabGroup.prototype.editTabGroupLabel = function (id, done) {
+    if (!done) {
+        if (this.lastEditTabGroupLabel != -1) StudioTabGroup.prototype.editTabGroupLabel(this.lastEditTabGroupLabel, true);
+        document.getElementById('tabname_' + id).style.display = 'none';
+        document.getElementById('tablabel_' + id).style.display = '';
+        // HACK Kenenth , to allow us to decide if the tab group goes in top menu
+        document.getElementById('tabTopMenuConfig_'+id).style.display = ''; // Show
+        // HACK Kenenth , to allow us to decide if the tab group goes in top menu
+        document.getElementById('tabother_' + id).style.display = 'none';
+        try {
+            document.getElementById('tablabel_' + id).focus();
+        }
+        catch (er) {}
+        this.lastEditTabGroupLabel = id;
+        YAHOO.util.DragDropMgr.lock();
+    } else {
+        this.lastEditTabGroupLabel = -1;
+        document.getElementById('tabname_' + id).innerHTML = document.getElementById('tablabel_' + id).value;
+        document.getElementById('tabname_' + id).style.display = '';
+        document.getElementById('tablabel_' + id).style.display = 'none';
+        // HACK Kenenth , to allow us to decide if the tab group goes in top menu
+        if (document.getElementById('tabhideintopmenu_'+id).checked) {
+            document.getElementById('slot'+id).style.fontStyle = 'italic;';
+            document.getElementById('tabname_'+id).style.color = '#808080';
+            document.getElementById('slot'+id).style.color = '#808080';
+        }
+        else {
+            document.getElementById('slot'+id).style.fontStyle = 'normal';
+            document.getElementById('tabname_'+id).style.fontStyle = 'normal;';
+            document.getElementById('tabname_'+id).style.color = '#000000;';
+            document.getElementById('slot'+id).style.color = '#000000;';
+        }
+        document.getElementById('tabTopMenuConfig_'+id).style.display = 'none'; // Hide
+        // HACK Kenenth , to allow us to decide if the tab group goes in top menu
+        document.getElementById('tabother_' + id).style.display = '';
+        YAHOO.util.DragDropMgr.unlock();
+    }
+}
+StudioTabGroup.prototype.generateForm = function (formname) {
+    var form = document.getElementById(formname);
+    for (var j = 0; j < slotCount; j++) {
+        var ul = document.getElementById('ul' + j);
+        var items = ul.getElementsByTagName('li');
+        for (var i = 0; i < items.length; i++) {
+            if (typeof(subtabModules[items[i].id]) != 'undefined') {
+                var input = document.createElement('input');
+                input.type = 'hidden';
+                input.name = j + '_' + i;
+                input.value = tabLabelToValue[subtabModules[items[i].id]];
+                form.appendChild(input);
+            }
+        }
+    }
+    form.slot_count.value = slotCount;
+};
+StudioTabGroup.prototype.generateGroupForm = function (formname) {
+    var form = document.getElementById(formname);
+    for (j = 0; j < slotCount; j++) {
+        var ul = document.getElementById('ul' + j);
+        items = ul.getElementsByTagName('li');
+        for (i = 0; i < items.length; i++) {
+            if (typeof(subtabModules[items[i].id]) != 'undefined') {
+                var input = document.createElement('input');
+                input.type = 'hidden'
+                input.name = 'group_' + j + '[]';
+                input.value = tabLabelToValue[subtabModules[items[i].id]];
+                form.appendChild(input);
+            }
+        }
+    }
+};
+StudioTabGroup.prototype.deleteTabGroup = function (id) {
+    if (document.getElementById('delete_' + id).value == 0) {
+        document.getElementById('ul' + id).style.display = 'none';
+        document.getElementById('tabname_' + id).style.textDecoration = 'line-through'
+        document.getElementById('delete_' + id).value = 1;
+    } else {
+        document.getElementById('ul' + id).style.display = '';
+        document.getElementById('tabname_' + id).style.textDecoration = 'none'
+        document.getElementById('delete_' + id).value = 0;
+    }
+}
+var lastField = '';
+var lastRowCount = -1;
+var undoDeleteDropDown = function (transaction) {
+    deleteDropDownValue(transaction['row'], document.getElementById(transaction['id']), false);
+}
+jstransaction.register('deleteDropDown', undoDeleteDropDown, undoDeleteDropDown);
+
+function deleteDropDownValue(rowCount, field, record) {
+    if (record) {
+        jstransaction.record('deleteDropDown', {
+            'row': rowCount,
+            'id': field.id
+        });
+    }
+    if (field.value == '0') {
+        field.value = '1';
+        document.getElementById('slot' + rowCount + '_value').style.textDecoration = 'line-through';
+    } else {
+        field.value = '0';
+        document.getElementById('slot' + rowCount + '_value').style.textDecoration = 'none';
+    }
+}
+var studiotabs = new StudioTabGroup();
\ No newline at end of file
Index: modules/Studio/TabGroups/EditViewTabs.php
===================================================================
--- modules/Studio/TabGroups/EditViewTabs.php    (revision 1)
+++ modules/Studio/TabGroups/EditViewTabs.php    (working copy)
@@ -54,7 +54,8 @@
 $selectedAppLanguages = return_application_language($tabGroupSelected_lang);
 require_once('include/GroupedTabs/GroupedTabStructure.php');
 $groupedTabsClass = new GroupedTabStructure();
-$groupedTabStructure = $groupedTabsClass->get_tab_structure('', '', true,true);
+//$groupedTabStructure = $groupedTabsClass->get_tab_structure('', '', true,true);
+$groupedTabStructure = $GLOBALS['tabStructure'];
 foreach($groupedTabStructure as $mainTab => $subModules){
      $groupedTabStructure[$mainTab]['label'] = $mainTab;
      $groupedTabStructure[$mainTab]['labelValue'] = $selectedAppLanguages[$mainTab];
Index: modules/Studio/TabGroups/EditViewTabs.tpl
===================================================================
--- modules/Studio/TabGroups/EditViewTabs.tpl    (revision 1)
+++ modules/Studio/TabGroups/EditViewTabs.tpl    (working copy)
@@ -157,11 +157,32 @@
 </tr><tr>
 {/if}
 <td valign='top' class='tdContainer'>
-<div id='slot{$tabCounter}' class='noBullet'><h2 id='handle{$tabCounter}' ><span id='tabname_{$tabCounter}' class='slotB'>{$tab.labelValue}</span><br><span id='tabother_{$tabCounter}'><span onclick='studiotabs.editTabGroupLabel({$tabCounter}, false)'>{$editImage}</span>&nbsp;
+<div id='slot{$tabCounter}' class='noBullet' {if $tab.hideintopmenu}style='color:#808080; font-style: italic;'{/if}>
+<h2 id='handle{$tabCounter}' >
+<span id='tabname_{$tabCounter}' class='slotB' {if $tab.hideintopmenu}style='color:#808080; font-style: italic;'{/if}>{$tab.labelValue}</span><br>
+<span id='tabother_{$tabCounter}'>
+<span onclick='studiotabs.editTabGroupLabel({$tabCounter}, false)'>{$editImage}</span>&nbsp;
 {if $tab.label != $otherLabel }
     <span onclick='studiotabs.deleteTabGroup({$tabCounter})'>{$deleteImage}</span>
 {/if}
-</span></h2><input type='hidden' name='tablabelid_{$tabCounter}' id='tablabelid_{$tabCounter}'  value='{$tab.label}'><input type='text' name='tablabel_{$tabCounter}' id='tablabel_{$tabCounter}' style='display:none' value='{$tab.labelValue}' onblur='studiotabs.editTabGroupLabel({$tabCounter}, true)'>
+</span></h2>
+<input type='hidden' name='tablabelid_{$tabCounter}' id='tablabelid_{$tabCounter}'  value='{$tab.label}'><input type='text' name='tablabel_{$tabCounter}' id='tablabel_{$tabCounter}' style='display:none' value='{$tab.labelValue}' >
+{* HACK   to allow us to indicate if a TAB GROUP is only to group subpanels and thus not is to be shown in the topmenu *}
+<span id="tabTopMenuConfig_{$tabCounter}" name="tabTopMenuConfig_{$tabCounter}" style='display:none'>
+<br/>
+Hide in top menu:
+<input type='checkbox' name='tabhideintopmenu_{$tabCounter}' id='tabhideintopmenu_{$tabCounter}' value='hide' {if $tab.hideintopmenu}checked{/if}>
+<br/>
+{* //Hack  - Tabgroup - Should be main menu, subpanel, or both *}
+Hide in subpanel:
+<input type='checkbox' name='tabhideinsubpanel_{$tabCounter}' id='tabhideinsubpanel_{$tabCounter}' value='hide' {if $tab.hideinsubpanel}checked{/if}>
+<br/>
+{* //Hack  - Tabgroup - Should be main menu, subpanel, or both *}
+
+<img src="themes/default/images/icon_email_save.gif" border="0" onclick='studiotabs.editTabGroupLabel({$tabCounter}, true)'>
+<br/><br/>
+</span>
+{* HACK   to allow us to indicate if a TAB GROUP is only to group subpanels and thus not is to be shown in the topmenu *}
 <ul id='ul{$tabCounter}' class='listContainer'>
 {counter start=0 name="subtabCounter" print=false assign="subtabCounter"}
 {foreach from=$tab.modules item='list'}
Index: modules/Studio/TabGroups/TabGroupHelper.php
===================================================================
--- modules/Studio/TabGroups/TabGroupHelper.php    (revision 1)
+++ modules/Studio/TabGroups/TabGroupHelper.php    (working copy)
@@ -123,6 +123,24 @@
                 
             }
             $tabGroups[$labelID] = array('label'=>$labelID);
+
+            // HACK   to allow supanel groupings to not be shown in top menu
+            if (!empty($params['tabhideintopmenu_' . $index])) {
+                $tabGroups[$labelID]['hideintopmenu'] = true;
+            }
+            else {
+                $tabGroups[$labelID]['hideintopmenu'] = false; 
+            }
+            // HACK   to allow supanel groupings to not be shown in top menu
+            
+            //Hack  - Tabgroup - Should be main menu, subpanel, or both
+            if (!empty($params['tabhideinsubpanel_' . $index])) {
+                $tabGroups[$labelID]['hideinsubpanel'] = true;
+            }
+            else {
+                $tabGroups[$labelID]['hideinsubpanel'] = false; 
+            }
+            //Hack  - Tabgroup - Should be main menu, subpanel, or both
             $tabGroups[$labelID]['modules']= array();
             for($subcount = 0; isset($params[$index.'_' . $subcount]); $subcount++){
                 $tabGroups[$labelID]['modules'][] = $params[$index.'_' . $subcount];

No comments: