Esempio n. 1
0
 public function testHistorySubpanel()
 {
     $subpanelDefs = new SubPanelDefinitions($this->contact);
     $subpanel = $subpanelDefs->load_subpanel('history');
     $prop = $subpanel->get_inst_prop_value('collection_list');
     $this->assertArrayHasKey('notes_parent', $prop, 'Should have notes_parent key defined for history');
 }
Esempio n. 2
0
 function init($module_name, $subPanelName)
 {
     $GLOBALS['log']->debug("in ParserModifySubPanel: module_name={$module_name} child_module={$subPanelName}");
     $this->moduleName = $module_name;
     $this->subPanelName = $subPanelName;
     global $beanList, $beanFiles;
     // Sometimes we receive a module name which is not in the correct CamelCase, so shift to lower case for all beanList lookups
     $beanListLower = array_change_key_case($beanList);
     // Retrieve the definitions for all the available subpanels for this module
     $class = $beanListLower[strtolower($this->moduleName)];
     require_once $beanFiles[$class];
     $module = new $class();
     require_once 'include/SubPanel/SubPanelDefinitions.php';
     $spd = new SubPanelDefinitions($module);
     // Get the lists of fields already in the subpanel and those that can be added in
     // Get the fields lists from an aSubPanel object describing this subpanel from the SubPanelDefinitions object
     $this->originalListViewDefs = array();
     if (array_key_exists(strtolower($this->subPanelName), $spd->layout_defs['subpanel_setup'])) {
         $originalPanel = $spd->load_subpanel($this->subPanelName, true);
         $this->originalListViewDefs = $originalPanel->get_list_fields();
         $this->panel = $spd->load_subpanel($subPanelName, false);
         $this->listViewDefs = $this->panel->get_list_fields();
         // Retrieve a copy of the bean for the parent module of this subpanel - so we can find additional fields for the layout
         $subPanelParentModuleName = $this->panel->get_module_name();
         $this->subPanelParentModule = null;
         if (!empty($subPanelParentModuleName) && isset($beanListLower[strtolower($subPanelParentModuleName)])) {
             $class = $beanListLower[strtolower($subPanelParentModuleName)];
             if (isset($beanFiles[$class])) {
                 require_once $beanFiles[$class];
                 $this->subPanelParentModule = new $class();
             }
         }
     }
     $this->language_module = $this->panel->template_instance->module_dir;
 }
    function loadSubpanel($module_name, $child_module)
    {
        $this->parent_module = $module_name;
        $this->child_module = $child_module;
        global $beanList, $beanFiles;
        $class = $beanList[$module_name];
        require_once $beanFiles[$class];
        require_once 'include/SubPanel/SubPanelDefinitions.php';
        $mod = new $class();
        $spd = new SubPanelDefinitions($mod);
        $spd->open_layout_defs(true);
        $panel = $spd->load_subpanel($child_module, true);
        $this->panel = $panel;
        $subpanel = new SubPanel($module_name, 'fab4', $child_module, $panel);
        $subpanel->setTemplateFile('include/SubPanel/SubPanelDynamic.html');
        $oldcontents = ob_get_contents();
        ob_clean();
        $subpanel->display();
        $this->curText = ob_get_contents();
        ob_clean();
        echo $oldcontents;
        $this->subpanel = $subpanel;
        $this->form = <<<EOQ
\t\t</form>
\t\t<form name='studio' method='POST'>
\t\t\t<input type='hidden' name='action' value='saveSubpanel'>
\t\t\t<input type='hidden' name='module' value='Studio'>
\t\t\t<input type='hidden' name='subpanel' value='{$child_module}'>
EOQ;
    }
Esempio n. 4
0
 public function testSugarWidgetSubpanelTopButtonQuickCreate()
 {
     $defines = array();
     $defines['focus'] = $this->account;
     $defines['module'] = 'Accounts';
     $defines['action'] = 'DetailView';
     $subpanel_definitions = new SubPanelDefinitions(new Contact());
     $contactSubpanelDef = $subpanel_definitions->load_subpanel('contacts');
     $subpanel = new SubPanel('Accounts', $this->account->id, 'contacts', $contactSubpanelDef, 'Accounts');
     $defines['subpanel_definition'] = $subpanel->subpanel_defs;
     $button = new SugarWidgetSubPanelTopButtonQuickCreate();
     $code = $button->_get_form($defines);
     $this->assertRegExp('/\\<input[^\\>]*?name=\\"return_name\\"/', $code, "Assert that the hidden input field return_name was created");
 }
 function set_subpanel($module_name, $child_module)
 {
     $this->parent_module = $module_name;
     $this->child_module = $child_module;
     global $beanList, $beanFiles;
     $class = $beanList[$module_name];
     require_once $beanFiles[$class];
     require_once 'include/SubPanel/SubPanelDefinitions.php';
     $mod = new $class();
     $spd = new SubPanelDefinitions($mod);
     $spd->open_layout_defs(true);
     $panel = $spd->load_subpanel($child_module, true);
     $this->panel = $panel;
     $subpanel = new SubPanel($module_name, 'fab4', $child_module, $panel);
     $subpanel->setTemplateFile('include/SubPanel/SubPanelDynamic.html');
     ob_flush();
     ob_clean();
     $subpanel->display();
     $this->contents = ob_get_contents();
     ob_clean();
     $this->subpanel = $subpanel;
 }
Esempio n. 6
0
 public function action_savetabs()
 {
     require_once 'include/SubPanel/SubPanelDefinitions.php';
     require_once 'modules/MySettings/TabController.php';
     global $current_user, $app_strings;
     if (!is_admin($current_user)) {
         sugar_die($app_strings['ERR_NOT_ADMIN']);
     }
     // handle the tabs listing
     $toDecode = html_entity_decode($_REQUEST['enabled_tabs'], ENT_QUOTES);
     $enabled_tabs = json_decode($toDecode);
     $tabs = new TabController();
     $tabs->set_system_tabs($enabled_tabs);
     $tabs->set_users_can_edit(isset($_REQUEST['user_edit_tabs']) && $_REQUEST['user_edit_tabs'] == 1);
     // handle the subpanels
     if (isset($_REQUEST['disabled_tabs'])) {
         $disabledTabs = json_decode(html_entity_decode($_REQUEST['disabled_tabs'], ENT_QUOTES));
         $disabledTabsKeyArray = TabController::get_key_array($disabledTabs);
         SubPanelDefinitions::set_hidden_subpanels($disabledTabsKeyArray);
     }
     header("Location: index.php?module=Administration&action=ConfigureTabs");
 }
Esempio n. 7
0
 public function action_savetabs()
 {
     require_once 'include/SubPanel/SubPanelDefinitions.php';
     require_once 'modules/MySettings/TabController.php';
     global $current_user, $app_strings, $modInvisList;
     if (!is_admin($current_user)) {
         sugar_die($app_strings['ERR_NOT_ADMIN']);
     }
     // handle the tabs listing
     $toDecode = html_entity_decode($_REQUEST['enabled_tabs'], ENT_QUOTES);
     $enabled_tabs = json_decode($toDecode);
     // Add Home back in so that it always appears first in Sugar 7
     array_unshift($enabled_tabs, 'Home');
     $tabs = new TabController();
     $tabs->set_system_tabs($enabled_tabs);
     $tabs->setPortalTabs(array_values(array_intersect($enabled_tabs, $tabs->getAllPortalTabs())));
     $tabs->set_users_can_edit(isset($_REQUEST['user_edit_tabs']) && $_REQUEST['user_edit_tabs'] == 1);
     // handle the subpanels
     if (isset($_REQUEST['disabled_tabs'])) {
         $disabledTabs = json_decode(html_entity_decode($_REQUEST['disabled_tabs'], ENT_QUOTES));
         $disabledTabsKeyArray = TabController::get_key_array($disabledTabs);
         //Never show Project subpanels if Project module is hidden
         if (!in_array('project', $disabledTabsKeyArray) && in_array('Project', $modInvisList)) {
             $disabledTabsKeyArray[] = 'project';
         }
         // if RLI is hidden, always hide the RLI subpanel.
         if (!in_array('revenuelineitems', $disabledTabsKeyArray) && in_array('RevenueLineItems', $modInvisList)) {
             $disabledTabsKeyArray[] = 'revenuelineitems';
         }
         SubPanelDefinitions::set_hidden_subpanels($disabledTabsKeyArray);
     }
     // Only rebuild the relevent metadata sections.
     MetaDataManager::refreshSectionCache(MetaDataManager::MM_MODULESINFO, array('base'));
     MetaDataManager::refreshSectionCache(MetaDataManager::MM_HIDDENSUBPANELS, array('base'));
     if (!headers_sent()) {
         header("Location: index.php?module=Administration&action=ConfigureTabs");
     }
 }
Esempio n. 8
0
 /**
  * @group 53223
  */
 public function testOneToManyRelationshipModule2Modult()
 {
     $_REQUEST['relate_id'] = $this->parentAccount->id;
     $_REQUEST['relate_to'] = $this->relationship->getName();
     // create new account
     $objAccount = new Account();
     $objAccount->name = "AccountBug53223" . $_REQUEST['relate_to'] . time();
     $objAccount->save();
     SugarTestAccountUtilities::setCreatedAccount(array($objAccount->id));
     // Retrieve new data
     $this->parentAccount->retrieve($this->parentAccount->id);
     $objAccount->retrieve($objAccount->id);
     $this->parentAccount->load_relationship($this->relationship->getName());
     $objAccount->load_relationship($this->relationship->getName());
     // Getting data of subpanel of parent bean
     $_REQUEST['module'] = 'Accounts';
     $_REQUEST['action'] = 'DetailView';
     $_REQUEST['record'] = $this->parentAccount->id;
     $_SERVER['REQUEST_METHOD'] = 'GET';
     unset($GLOBALS['focus']);
     $subpanels = new SubPanelDefinitions($this->parentAccount, 'Accounts');
     $subpanelDef = $subpanels->load_subpanel($this->relationship->getName() . 'accounts_ida');
     $subpanel = new SubPanel('Accounts', $this->parentAccount->id, 'default', $subpanelDef);
     $subpanel->setTemplateFile('include/SubPanel/SubPanelDynamic.html');
     $subpanel->display();
     $actual = $this->getActualOutput();
     $this->assertContains($objAccount->name, $actual, 'Account name is not displayed in subpanel of parent account');
     ob_clean();
     // Getting data of subpanel of child bean
     $_REQUEST['module'] = 'Accounts';
     $_REQUEST['action'] = 'DetailView';
     $_REQUEST['record'] = $objAccount->id;
     $_SERVER['REQUEST_METHOD'] = 'GET';
     unset($GLOBALS['focus']);
     $subpanels = new SubPanelDefinitions($objAccount, 'Accounts');
     $subpanelDef = $subpanels->load_subpanel($this->relationship->getName() . 'accounts_ida');
     $subpanel = new SubPanel('Accounts', $objAccount->id, 'default', $subpanelDef);
     $subpanel->setTemplateFile('include/SubPanel/SubPanelDynamic.html');
     $subpanel->display();
     $actual = $this->getActualOutput();
     $this->assertNotContains($this->parentAccount->name, $actual, 'Parent account name is displayed in subpanel of child aaccount');
 }
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings;
     global $app_list_strings;
     global $app_strings;
     require_once "modules/MySettings/TabController.php";
     $controller = new TabController();
     $tabs = $controller->get_tabs_system();
     // Remove Home module from UI.  We add it back to front of display tab list on save.
     if (isset($tabs[0]['Home'])) {
         unset($tabs[0]['Home']);
     }
     if (isset($tabs[1]['Home'])) {
         unset($tabs[1]['Home']);
     }
     $enabled = array();
     foreach ($tabs[0] as $key => $value) {
         $enabled[] = array("module" => $key, 'label' => translate($key));
     }
     $disabled = array();
     foreach ($tabs[1] as $key => $value) {
         $disabled[] = array("module" => $key, 'label' => translate($key));
     }
     $user_can_edit = $controller->get_users_can_edit();
     $this->ss->assign('APP', $GLOBALS['app_strings']);
     $this->ss->assign('MOD', $GLOBALS['mod_strings']);
     $this->ss->assign('user_can_edit', $user_can_edit);
     $this->ss->assign('enabled_tabs', json_encode($enabled));
     $this->ss->assign('disabled_tabs', json_encode($disabled));
     $this->ss->assign('title', $this->getModuleTitle(false));
     //get list of all subpanels and panels to hide
     $mod_list_strings_key_to_lower = array_change_key_case($app_list_strings['moduleList']);
     $panels_arr = SubPanelDefinitions::get_all_subpanels();
     $hidpanels_arr = SubPanelDefinitions::get_hidden_subpanels();
     if (!$hidpanels_arr || !is_array($hidpanels_arr)) {
         $hidpanels_arr = array();
     }
     //create array of subpanels to show, used to create Drag and Drop widget
     $enabled = array();
     foreach ($panels_arr as $key) {
         if (empty($key)) {
             continue;
         }
         $key = strtolower($key);
         $enabled[] = array("module" => $key, "label" => $mod_list_strings_key_to_lower[$key]);
     }
     //now create array of subpanels to hide for use in Drag and Drop widget
     $disabled = array();
     foreach ($hidpanels_arr as $key) {
         if (empty($key)) {
             continue;
         }
         $key = strtolower($key);
         // we need this here for with RLI's are disabled as they shouldn't be seen in the list
         if ($key == 'revenuelineitems' && in_array('RevenueLineItems', $GLOBALS['modInvisList'])) {
             continue;
         }
         $disabled[] = array("module" => $key, "label" => $mod_list_strings_key_to_lower[$key]);
     }
     $this->ss->assign('enabled_panels', json_encode($enabled));
     $this->ss->assign('disabled_panels', json_encode($disabled));
     echo $this->ss->fetch('modules/Administration/templates/ConfigureTabs.tpl');
 }
Esempio n. 10
0
}
$subpanel = $_REQUEST['subpanel'];
$record = $_REQUEST['record'];
$module = $_REQUEST['module'];
$layout_def_key = $_REQUEST['layout_def_key'];
if (empty($_REQUEST['inline'])) {
    insert_popup_header($theme);
}
// need to load the subpanel definition here and manipulate the 'where clause'
if (($result = BeanFactory::getBean($module, $record)) === FALSE) {
    die("'{$module}' is not a valid module");
}
if (!class_exists('MyClass')) {
    require_once 'include/SubPanel/SubPanelDefinitions.php';
}
$panelsdef = new SubPanelDefinitions($result, $layout_def_key);
$subpanelDef = $panelsdef->load_subpanel($subpanel);
// create or append subpanel definition where clause for the filter
if (!isset($subpanelDef->panel_definition['where']) || $subpanelDef->panel_definition['where'] == '') {
    $subpanelDef->panel_definition['where'] = '';
} else {
    $subpanelDef->panel_definition['where'] .= ' AND ';
}
if ($_REQUEST['search_params'] && $_REQUEST['search_params'] != '') {
    foreach ($subpanelDef->sub_subpanels as $key => $value) {
        $module_name = $subpanelDef->sub_subpanels[$key]->_instance_properties['module'];
        global $beanList, $beanFiles;
        $class_name = $beanList[$module_name];
        //require_once($beanFiles[$class_name]);
        $class_name = new $class_name();
        $table = $class_name->table_name;
 function __construct($subpanelName, $moduleName)
 {
     $GLOBALS['log']->debug(get_class($this) . "->__construct({$subpanelName} , {$moduleName})");
     $this->_subpanelName = $subpanelName;
     $this->_moduleName = $moduleName;
     $module = BeanFactory::getBean($moduleName);
     // BEGIN ASSERTIONS
     if (empty($module)) {
         sugar_die(get_class($this) . ": Modulename {$moduleName} is not a Deployed Module");
     }
     // END ASSERTIONS
     $this->historyPathname = 'custom/history/modules/' . $moduleName . '/subpanels/' . $subpanelName . '/' . self::HISTORYFILENAME;
     $this->_history = new History($this->historyPathname);
     require_once 'include/SubPanel/SubPanelDefinitions.php';
     // retrieve the definitions for all the available subpanels for this module from the subpanel
     $spd = new SubPanelDefinitions($module);
     // Get the lists of fields already in the subpanel and those that can be added in
     // Get the fields lists from an aSubPanel object describing this subpanel from the SubPanelDefinitions object
     $this->_viewdefs = array();
     $this->_fielddefs = array();
     $this->_language = '';
     if (!empty($spd->layout_defs)) {
         if (array_key_exists(strtolower($subpanelName), $spd->layout_defs['subpanel_setup'])) {
             //First load the original defs from the module folder
             $originalSubpanel = $spd->load_subpanel($subpanelName, false, true);
             $this->_fullFielddefs = $originalSubpanel ? $originalSubpanel->get_list_fields() : array();
             $this->_mergeFielddefs($this->_fielddefs, $this->_fullFielddefs);
             $this->_aSubPanelObject = $spd->load_subpanel($subpanelName);
             // now check if there is a restored subpanel in the history area - if there is, then go ahead and use it
             if (file_exists($this->historyPathname)) {
                 // load in the subpanelDefOverride from the history file
                 $GLOBALS['log']->debug(get_class($this) . ": loading from history");
                 require $this->historyPathname;
                 $this->_viewdefs = $layout_defs;
             } else {
                 $this->_viewdefs = $this->_aSubPanelObject->get_list_fields();
             }
             // don't attempt to access the template_instance property if our subpanel represents a collection, as it won't be there - the sub-sub-panels get this value instead
             if (!$this->_aSubPanelObject->isCollection()) {
                 $this->_language = $this->_aSubPanelObject->template_instance->module_dir;
             }
             // Retrieve a copy of the bean for the parent module of this subpanel - so we can find additional fields for the layout
             $subPanelParentModuleName = $this->_aSubPanelObject->get_module_name();
             $beanListLower = array_change_key_case($GLOBALS['beanList']);
             if (!empty($subPanelParentModuleName) && isset($beanListLower[strtolower($subPanelParentModuleName)])) {
                 $subPanelParentModule = get_module_info($subPanelParentModuleName);
                 // Run through the preliminary list, keeping only those fields that are valid to include in a layout
                 foreach ($subPanelParentModule->field_defs as $key => $def) {
                     $key = strtolower($key);
                     if (AbstractMetaDataParser::validField($def)) {
                         if (!isset($def['label'])) {
                             $def['label'] = $def['name'];
                         }
                         $this->_fielddefs[$key] = $def;
                     }
                 }
             }
             $this->_mergeFielddefs($this->_fielddefs, $this->_viewdefs);
         }
     }
 }
Esempio n. 12
0
 private static function identifySubpanel($thisModuleName, $sourceModuleName)
 {
     $module = get_module_info($thisModuleName);
     require_once 'include/SubPanel/SubPanelDefinitions.php';
     $spd = new SubPanelDefinitions($module);
     $subpanelNames = $spd->get_available_tabs();
     // actually these are the displayed subpanels
     $subPanels = array();
     foreach ($subpanelNames as $key => $name) {
         $GLOBALS['log']->debug($thisModuleName . " " . $name);
         $subPanel = $spd->load_subpanel($name);
         if (!isset($subPanel->_instance_properties['collection_list'])) {
             if ($sourceModuleName == $subPanel->_instance_properties['module']) {
                 return $subPanel->_instance_properties['subpanel_name'];
             }
         }
     }
     return null;
 }
Esempio n. 13
0
 function getTabs($tabs, $showTabs = true, $selectedGroup = 'All')
 {
     //WDong Bug: 12258 "All" tab in the middle of a record's detail view is not localized.
     if ($selectedGroup == 'All') {
         $selectedGroup = translate('LBL_TABGROUP_ALL');
     }
     require_once 'include/SubPanel/SubPanelDefinitions.php';
     $spd = new SubPanelDefinitions($this->focus);
     // Set up a mapping from subpanelID, found in the $tabs list, to the source module name
     // As the $GLOBALS['tabStructure'] array holds the Group Tabs by module name we need to efficiently convert between the two
     // when constructing the subpanel tabs
     // Note that we can't use the very similar GroupedTabStructure class as it lacks this mapping, and logically, it is designed
     // for use when constructing the module by module tabs, not the subpanel tabs, as we move away from using module names to represent
     // subpanels, and use unique subpanel IDs instead.
     $moduleNames = array();
     foreach ($tabs as $subpanelID) {
         $subpanel = $spd->load_subpanel($subpanelID);
         if ($subpanel !== false) {
             $moduleNames[$subpanelID] = $subpanel->get_module_name();
         }
     }
     $groups = array();
     $found = array();
     foreach ($GLOBALS['tabStructure'] as $mainTab => $subModules) {
         foreach ($subModules['modules'] as $key => $subModule) {
             foreach ($tabs as $subpanelID) {
                 if (isset($moduleNames[$subpanelID]) && strcasecmp($subModule, $moduleNames[$subpanelID]) === 0) {
                     $groups[translate($mainTab)]['modules'][$key] = $subpanelID;
                     $found[$subpanelID] = true;
                     break;
                 }
             }
         }
     }
     // Put all the remaining subpanels into the 'Other' tab.
     foreach ($tabs as $subpanelID) {
         if (!isset($found[$subpanelID])) {
             $groups[translate('LBL_TABGROUP_OTHER')]['modules'][] = $subpanelID;
         }
     }
     /* Move history to same tab as activities */
     if (in_array('history', $tabs) && in_array('activities', $tabs)) {
         foreach ($groups as $mainTab => $group) {
             if (in_array('activities', array_map('strtolower', $group['modules']))) {
                 if (!in_array('history', array_map('strtolower', $group['modules']))) {
                     /* Move hist from there to here */
                     $groups[$mainTab]['modules'][] = 'history';
                 }
             } else {
                 if (false !== ($i = array_search('history', array_map('strtolower', $group['modules'])))) {
                     unset($groups[$mainTab]['modules'][$i]);
                     if (empty($groups[$mainTab]['modules'])) {
                         unset($groups[$mainTab]);
                     }
                 }
             }
         }
     }
     /* Add the 'All' group.
      * Note that if a tab group already exists with the name 'All',
      * it will be overwritten in this union operation.
      */
     if (count($groups) <= 1) {
         $groups = array(translate('LBL_TABGROUP_ALL') => array('label' => translate('LBL_TABGROUP_ALL'), 'modules' => $tabs));
     } else {
         $groups = array(translate('LBL_TABGROUP_ALL') => array('label' => translate('LBL_TABGROUP_ALL'), 'modules' => $tabs)) + $groups;
     }
     /* Note - all $display checking and array_intersects with $tabs
      * are now redundant (thanks to GroupedTabStructure), and could
      * be removed for performance, but for now can stay to help ensure
      * that the tabs get renedered correctly.
      */
     $retTabs = array();
     if ($showTabs) {
         require_once 'include/SubPanel/SugarTab.php';
         $sugarTab = new SugarTab();
         $displayTabs = array();
         $otherTabs = array();
         foreach ($groups as $key => $tab) {
             $display = false;
             foreach ($tab['modules'] as $subkey => $subtab) {
                 if (in_array(strtolower($subtab), $tabs)) {
                     $display = true;
                     break;
                 }
             }
             $selected = '';
             if ($selectedGroup == $key) {
                 $selected = 'current';
             }
             if ($display) {
                 $relevantTabs = SubPanelTilesTabs::applyUserCustomLayoutToTabs($tabs, $key);
                 $sugarTabs[$key] = array('label' => !empty($tab['label']) ? $tab['label'] : $key, 'type' => $selected);
                 $otherTabs[$key] = array('key' => $key, 'tabs' => array());
                 $orderedTabs = array_intersect($relevantTabs, array_map('strtolower', $groups[$key]['modules']));
                 foreach ($orderedTabs as $subkey => $subtab) {
                     $otherTabs[$key]['tabs'][$subkey] = array('key' => $subtab, 'label' => translate($this->subpanel_definitions->layout_defs['subpanel_setup'][$subtab]['title_key']));
                 }
                 if ($selectedGroup == $key) {
                     $displayTabs = $otherTabs[$key]['tabs'];
                     $retTabs = $orderedTabs;
                 }
             }
         }
         if (empty($displayTabs) && !empty($otherTabs)) {
             //WDong Bug: 12258 "All" tab in the middle of a record's detail view is not localized.
             $selectedGroup = translate('LBL_TABGROUP_ALL');
             $displayTabs = $otherTabs[$selectedGroup]['tabs'];
             $sugarTabs[$selectedGroup]['type'] = 'current';
             $retTabs = array_intersect($tabs, array_map('strtolower', $groups[$selectedGroup]['modules']));
         }
         if (!empty($sugarTabs) || !empty($otherTabs)) {
             $sugarTab->setup($sugarTabs, $otherTabs, $displayTabs, $selectedGroup);
             $sugarTab->display();
         }
     } else {
         $tabs = SubPanelTilesTabs::applyUserCustomLayoutToTabs($tabs, $selectedGroup);
         $retTabs = array_intersect($tabs, array_map('strtolower', $groups[$selectedGroup]['modules']));
     }
     return $retTabs;
 }
Esempio n. 14
0
 /**
  * check was module hidden in the top navigation bar or as subpanels
  * @param string moduleName - name of module to chaeck e.g. Notes, Tasks
  * @return bool
  * @see Bug #55632 : Hiding Notes Module does not prevent creation of notes.
  */
 public static function isModuleHidden($moduleName)
 {
     global $modules_exempt_from_availability_check;
     if (isset($modules_exempt_from_availability_check[$moduleName])) {
         return false;
     }
     require_once 'modules/MySettings/TabController.php';
     require_once 'include/SubPanel/SubPanelDefinitions.php';
     $tabs = new TabController();
     if (in_array(strtolower($moduleName), SubPanelDefinitions::get_hidden_subpanels())) {
         return true;
     }
     return false;
 }
 protected static function loadSubpanelDefs($bean)
 {
     $module = $bean->module_dir;
     if (!isset(static::$subpanelDefs[$module])) {
         static::$subpanelDefs[$module] = array();
         $spd = new SubPanelDefinitions($bean);
         $subpanelNames = $spd->get_available_tabs();
         // actually these are the displayed subpanels
         foreach ($subpanelNames as $key => $name) {
             static::$subpanelDefs[$module][$name] = $spd->load_subpanel($name);
         }
     }
     return static::$subpanelDefs[$module];
 }
Esempio n. 16
0
 function getModuleSubpanels($module)
 {
     require_once 'include/SubPanel/SubPanelDefinitions.php';
     $mod = BeanFactory::getBean($module);
     if (empty($mod)) {
         return array();
     }
     $spd = new SubPanelDefinitions($mod);
     $tabs = $spd->get_available_tabs(true);
     $ret_tabs = array();
     $reject_tabs = array('history' => 1, 'activities' => 1);
     foreach ($tabs as $key => $tab) {
         foreach ($tab as $k => $v) {
             if (!isset($reject_tabs[$k])) {
                 $ret_tabs[$k] = $v;
             }
         }
     }
     return $ret_tabs;
 }
Esempio n. 17
0
 function get_list_view_data()
 {
     global $app_strings;
     global $mod_strings;
     $field_list = $this->get_list_view_array();
     $bean = BeanFactory::getBean('xeBayOrders');
     $bean->retrieve($field_list['ID']);
     require_once 'include/SubPanel/SubPanelDefinitions.php';
     $subpanel_definitions = new SubPanelDefinitions($bean);
     $subpanel_definitions->layout_defs['subpanel_setup']['xebaytransactions']['subpanel_name'] = "ForOrderSimple";
     $thisPanel = $subpanel_definitions->load_subpanel("xebaytransactions");
     ob_start();
     include_once 'include/SubPanel/SubPanel.php';
     $subpanel_object = new SubPanel('xeBayOrders', $field_list['ID'], 'all', $thisPanel);
     $subpanel_object->setTemplateFile('modules/xeBayTransactions/SubPanelDynamic.html');
     $subpanel_object->display();
     $subpanel_data = ob_get_contents();
     @ob_end_clean();
     $order_details .= '<p style="margin: 8px 0px 8px 0px;">';
     $order_details .= $field_list['BUYER_USER_ID'];
     $order_details .= '</p>';
     $order_details .= $subpanel_data;
     $field_list['ORDER_DETAILS'] = $order_details;
     if (!empty($field_list['BUYER_CHECKOUT_MESSAGE'])) {
         $message = "<img alt='{$mod_strings['LBL_MESSAGE']}' style='padding: 0px 5px 0px 2px' border='0' onclick=\"SUGAR.util.getStaticAdditionalDetails(this,'";
         $message .= str_replace(array("&#039;"), array("\\'"), $field_list['BUYER_CHECKOUT_MESSAGE']);
         // $message .= $field_list['BUYER_CHECKOUT_MESSAGE'];
         $message .= "','<div style=\\'float:left\\'>{$mod_strings['LBL_MESSAGE']}</div><div style=\\'float: right\\'>";
         $closeVal = "false";
         $message .= "'," . $closeVal . ")\" src='" . SugarThemeRegistry::current()->getImageURL('AlertEmailTemplates.gif') . "' class='info'>";
         $field_list['BUYER_CHECKOUT_MESSAGE'] = $message;
     }
     if ($field_list['PRINT_STATUS']) {
         $field_list['PRINT_STATUS_ICON'] = "<img alt='Print status' border='0' src='" . SugarThemeRegistry::current()->getImageURL('Print_Email.gif') . "'>";
     }
     return $field_list;
 }
Esempio n. 18
0
 /**
  * Allows refresh of the hidden subpanels list from outside of this class
  *
  * @param $bool
  */
 public static function setRefreshHiddenSubpanels($bool)
 {
     self::$refreshHiddenSubpanels = (bool) $bool;
 }
Esempio n. 19
0
    $_REQUEST['collection_basic'] = explode(',', $_REQUEST['collection_basic'][0]);
    $collection = $_REQUEST['collection_basic'];
}
if (empty($_REQUEST['inline'])) {
    insert_popup_header($theme);
}
//require_once('include/SubPanel/SubPanelDefinitions.php');
//require_once($beanFiles[$beanList[$_REQUEST['module']]]);
//$focus=new $beanList[$_REQUEST['module']];
//$focus->retrieve($record);
include 'include/SubPanel/SubPanel.php';
$layout_def_key = '';
if (!empty($_REQUEST['layout_def_key'])) {
    $layout_def_key = $_REQUEST['layout_def_key'];
}
require_once 'include/SubPanel/SubPanelDefinitions.php';
// retrieve the definitions for all the available subpanels for this module from the subpanel
$bean = BeanFactory::getBean($module);
$spd = new SubPanelDefinitions($bean);
$aSubPanelObject = $spd->load_subpanel($subpanel);
$subpanel_object = new SubPanel($module, $record, $subpanel, $aSubPanelObject, $layout_def_key, $collection);
$subpanel_object->setTemplateFile('include/SubPanel/SubPanelDynamic.html');
echo empty($_REQUEST['inline']) ? $subpanel_object->get_buttons() : '';
$subpanel_object->display();
$jsAlerts = new jsAlerts();
if (!isset($_SESSION['isMobile'])) {
    echo $jsAlerts->getScript();
}
if (empty($_REQUEST['inline'])) {
    insert_popup_footer($theme);
}
Esempio n. 20
0
 /**
  * return all available subpanels that belong to the list of tab modules.  You can optionally return all
  * available subpanels, and also optionally group by module (prepends the key with the bean class name).
  */
 function get_all_subpanels($return_tab_modules_only = true, $group_by_module = false)
 {
     global $moduleList, $beanFiles, $beanList, $module;
     //use tab controller function to get module list with named keys
     require_once "modules/MySettings/TabController.php";
     $modules_to_check = TabController::get_key_array($moduleList);
     //change case to match subpanel processing later on
     $modules_to_check = array_change_key_case($modules_to_check);
     // Append on the CampaignLog module, because that is where the subpanels point, not directly to Campaigns
     $modules_to_check['campaignlog'] = "CampaignLog";
     $spd = '';
     $spd_arr = array();
     //iterate through modules and build subpanel array
     foreach ($modules_to_check as $mod_name) {
         //skip if module name is not in bean list, otherwise get the bean class name
         if (!isset($beanList[$mod_name])) {
             continue;
         }
         $class = $beanList[$mod_name];
         //skip if class name is not in file list, otherwise require the bean file and create new class
         if (!isset($beanFiles[$class]) || !file_exists($beanFiles[$class])) {
             continue;
         }
         //retrieve subpanels for this bean
         require_once $beanFiles[$class];
         $bean_class = new $class();
         //create new subpanel definition instance and get list of tabs
         $spd = new SubPanelDefinitions($bean_class);
         $sub_tabs = $spd->get_available_tabs();
         //add each subpanel to array of total subpanles
         foreach ($sub_tabs as $panel_key) {
             $panel_key = strtolower($panel_key);
             $panel_module = $panel_key;
             if (isset($spd->layout_defs['subpanel_setup'][$panel_key]['module'])) {
                 $panel_module = strtolower($spd->layout_defs['subpanel_setup'][$panel_key]['module']);
             }
             //if module_only flag is set, only if it is also in module array
             if ($return_tab_modules_only && !array_key_exists($panel_module, $modules_to_check)) {
                 continue;
             }
             $panel_key_name = $panel_module;
             //group_by_key_name is set to true, then array will hold an entry for each
             //subpanel, with the module name prepended in the key
             if ($group_by_module) {
                 $panel_key_name = $class . '_' . $panel_key_name;
             }
             //add panel name to subpanel array
             $spd_arr[$panel_key_name] = $panel_module;
         }
     }
     return $spd_arr;
 }
Esempio n. 21
0
$defaultTrackerRoles = array('Tracker' => array('Trackers' => array('admin' => 1, 'access' => 89, 'view' => 90, 'list' => 90, 'edit' => 90, 'delete' => 90, 'import' => 90, 'export' => 90), 'TrackerQueries' => array('admin' => 1, 'access' => 89, 'view' => 90, 'list' => 90, 'edit' => 90, 'delete' => 90, 'import' => 90, 'export' => 90), 'TrackerPerfs' => array('admin' => 1, 'access' => 89, 'view' => 90, 'list' => 90, 'edit' => 90, 'delete' => 90, 'import' => 90, 'export' => 90), 'TrackerSessions' => array('admin' => 1, 'access' => 89, 'view' => 90, 'list' => 90, 'edit' => 90, 'delete' => 90, 'import' => 90, 'export' => 90)));
installerHook('pre_addDefaultRolesTracker');
addDefaultRoles($defaultTrackerRoles);
installerHook('post_addDefaultRolesTracker');
// Adding MLA Roles
installerHook('pre_addDefaultRoles');
require_once 'modules/ACLRoles/SeedRoles.php';
create_default_roles();
installerHook('post_addDefaultRoles');
// Hide certain subpanels by default
require_once 'include/SubPanel/SubPanelDefinitions.php';
require_once 'modules/MySettings/TabController.php';
$disabledTabs = array("project", "bugs", "products", "contracts", "revenuelineitems");
installerHook('pre_setHiddenSubpanels');
$disabledTabsKeyArray = TabController::get_key_array($disabledTabs);
SubPanelDefinitions::set_hidden_subpanels($disabledTabsKeyArray);
installerHook('post_setHiddenSubpanels');
// Create the user that will be used by Snip
require_once 'install/createSnipUser.php';
/**
 * SP-1071 disable unsupported legacy connectors for 7.0
// Enable the InsideView connector and add all modules
installLog("Enable InsideView Connector");
enableInsideViewConnector();
**/
///////////////////////////////////////////////////////////////////////////////
////    START DEMO DATA
/*
 * Enable asynchronous index mode before adding demo data. At this point
 * the ES idex has not been initialized yet. The demo data loader uses
 * SugarBean->save() which automatically triggers an inline index of each
Esempio n. 22
0
 /**
  * Gets the list of modules displayable as subpanels
  *
  * @return array An array of module names
  */
 public function getSubpanelList()
 {
     return SubPanelDefinitions::get_all_subpanels();
 }
Esempio n. 23
0
 /**
  * Enter description here...
  *
  * @param BEAN $focus - this is the bean you want to get the data from
  * @param STRING $layout_def_key - if you wish to use a layout_def defined in the default metadata/subpaneldefs.php that is not keyed off of $bean->module_dir pass in the key here
  * @param ARRAY $layout_def_override - if you wish to override the default loaded layout defs you pass them in here.
  * @return SubPanelDefinitions
  */
 function CustomSubPanelDefinitions($focus, $layout_def_key = '', $layout_def_override = '')
 {
     parent::SubPanelDefinitions($focus, $layout_def_key, $layout_def_override);
 }
Esempio n. 24
0
 static function getModuleSubpanels($module)
 {
     require_once 'include/SubPanel/SubPanelDefinitions.php';
     global $beanList, $beanFiles;
     if (!isset($beanList[$module])) {
         return array();
     }
     $class = $beanList[$module];
     require_once $beanFiles[$class];
     $mod = new $class();
     $spd = new SubPanelDefinitions($mod);
     $tabs = $spd->get_available_tabs(true);
     $ret_tabs = array();
     $reject_tabs = array('history' => 1, 'activities' => 1);
     foreach ($tabs as $key => $tab) {
         foreach ($tab as $k => $v) {
             if (!isset($reject_tabs[$k])) {
                 $ret_tabs[$k] = $v;
             }
         }
     }
     return $ret_tabs;
 }
 /**
  * If a subpanel cannot be found in sidecar, try to find it in legacy
  * and convert it
  * @return bool
  */
 protected function fixUpSubpanel()
 {
     // getting here usually means that the link passed in is from an oldschool layoutdef
     // get the name, get the key, get the link, then we work the magic
     $spd = new SubPanelDefinitions(BeanFactory::getBean($this->loadedModule));
     if (!empty($spd->layout_defs)) {
         if (array_key_exists(strtolower($this->linkName), $spd->layout_defs['subpanel_setup'])) {
             $aSubPanelObject = $spd->load_subpanel($this->linkName);
             $this->_moduleName = $aSubPanelObject->get_module_name();
             $this->bean = BeanFactory::getBean($this->_moduleName);
             // convert the old viewdef on the fly
             $this->convertLegacyViewDef($aSubPanelObject->get_list_fields());
             return true;
         }
     }
     return false;
 }
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings;
     global $app_list_strings;
     global $app_strings;
     require_once "modules/MySettings/TabController.php";
     $controller = new TabController();
     $tabs = $controller->get_tabs_system();
     $enabled = [];
     foreach ($tabs[0] as $key => $value) {
         $enabled[] = ["module" => $key, 'label' => translate($key)];
     }
     $disabled = [];
     foreach ($tabs[1] as $key => $value) {
         $disabled[] = ["module" => $key, 'label' => translate($key)];
     }
     $user_can_edit = $controller->get_users_can_edit();
     $this->ss->assign('APP', $GLOBALS['app_strings']);
     $this->ss->assign('MOD', $GLOBALS['mod_strings']);
     $this->ss->assign('user_can_edit', $user_can_edit);
     $this->ss->assign('enabled_tabs', json_encode($enabled));
     $this->ss->assign('disabled_tabs', json_encode($disabled));
     $this->ss->assign('title', $this->getModuleTitle(false));
     //get list of all subpanels and panels to hide
     $mod_list_strings_key_to_lower = array_change_key_case($app_list_strings['moduleList']);
     $panels_arr = SubPanelDefinitions::get_all_subpanels();
     $hidpanels_arr = SubPanelDefinitions::get_hidden_subpanels();
     if (!$hidpanels_arr || !is_array($hidpanels_arr)) {
         $hidpanels_arr = [];
     }
     //create array of subpanels to show, used to create Drag and Drop widget
     $enabled = [];
     foreach ($panels_arr as $key) {
         if (empty($key)) {
             continue;
         }
         $key = strtolower($key);
         $enabled[] = ["module" => $key, "label" => $mod_list_strings_key_to_lower[$key]];
     }
     //now create array of subpanels to hide for use in Drag and Drop widget
     $disabled = [];
     foreach ($hidpanels_arr as $key) {
         if (empty($key)) {
             continue;
         }
         $key = strtolower($key);
         $disabled[] = ["module" => $key, "label" => $mod_list_strings_key_to_lower[$key]];
     }
     $this->ss->assign('enabled_panels', json_encode($enabled));
     $this->ss->assign('disabled_panels', json_encode($disabled));
     echo $this->ss->fetch('modules/Administration/templates/ConfigureTabs.tpl');
 }
Esempio n. 27
0
        $panels_to_hide = $_REQUEST['disabled_panels'];
    }
    //turn list  into array
    $hidpanels_arr = split(',', $panels_to_hide);
    $hidpanels_arr = TabController::get_key_array($hidpanels_arr);
    //save list of subpanels to hide
    SubPanelDefinitions::set_hidden_subpanels($hidpanels_arr);
    //redirect to same page to refresh panel list
    header("Location: index.php?module=Administration&action=ConfigureSubPanels");
}
//////////////////  Processing UI
//create title for form
$title = get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_CONFIGURE_SUBPANELS'] . ":", true);
//get list of all subpanels and panels to hide
$panels_arr = SubPanelDefinitions::get_all_subpanels();
$hidpanels_arr = SubPanelDefinitions::get_hidden_subpanels();
if (!$hidpanels_arr || !is_array($hidpanels_arr)) {
    $hidpanels_arr = array();
}
//create array of subpanels to show, used to create Drag and Drop widget
$groups = array();
$groups[$mod_strings['LBL_VISIBLE_PANELS']] = array();
foreach ($panels_arr as $key) {
    if (empty($key)) {
        continue;
    }
    $panels_arr[$key] = $mod_list_strings_key_to_lower[$key];
}
$groups[$mod_strings['LBL_HIDDEN_PANELS']] = array();
//now create array of panels to hide for use in Drag and Drop widget
foreach ($hidpanels_arr as $key) {