public function run() { if (!($this->from_flavor == 'ce' && $this->toFlavor('pro'))) { return; } //check to see if there are any new files that need to be added to systems tab //retrieve old modules list $this->log('check to see if new modules exist'); if (empty($this->state['old_modules'])) { $this->log('No old modules info, skipping it'); return; } else { $oldModuleList = $this->state['old_modules']; } $newModuleList = array(); include 'include/modules.php'; $newModuleList = $moduleList; //include tab controller require_once 'modules/MySettings/TabController.php'; $newTB = new TabController(); //make sure new modules list has a key we can reference directly $newModuleList = $newTB->get_key_array($newModuleList); $oldModuleList = $newTB->get_key_array($oldModuleList); //iterate through list and remove commonalities to get new modules foreach ($newModuleList as $remove_mod) { if (in_array($remove_mod, $oldModuleList)) { unset($newModuleList[$remove_mod]); } } $must_have_modules = array('Activities' => 'Activities', 'Calendar' => 'Calendar', 'Reports' => 'Reports', 'Quotes' => 'Quotes', 'Products' => 'Products', 'Forecasts' => 'Forecasts', 'Contracts' => 'Contracts', 'KBDocuments' => 'KBDocuments'); $newModuleList = array_merge($newModuleList, $must_have_modules); //new modules list now has left over modules which are new to this install, so lets add them to the system tabs $this->log('new modules to add are ' . var_export($newModuleList, true)); //grab the existing system tabs $tabs = $newTB->get_system_tabs(); //add the new tabs to the array foreach ($newModuleList as $nm) { $tabs[$nm] = $nm; } //now assign the modules to system tabs $newTB->set_system_tabs($tabs); $this->log('module tabs updated'); }
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"); }
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"); } }
$admin->saveSetting('system', 'adminwizard', 1); if ($ce_to_pro_ent) { //check to see if there are any new files that need to be added to systems tab //retrieve old modules list logThis('check to see if new modules exist', $path); $oldModuleList = array(); $newModuleList = array(); include $argv[3] . '/include/modules.php'; $oldModuleList = $moduleList; include 'include/modules.php'; $newModuleList = $moduleList; //include tab controller require_once 'modules/MySettings/TabController.php'; $newTB = new TabController(); //make sure new modules list has a key we can reference directly $newModuleList = $newTB->get_key_array($newModuleList); $oldModuleList = $newTB->get_key_array($oldModuleList); //iterate through list and remove commonalities to get new modules foreach ($newModuleList as $remove_mod) { if (in_array($remove_mod, $oldModuleList)) { unset($newModuleList[$remove_mod]); } } $must_have_modules = array('Activities' => 'Activities', 'Calendar' => 'Calendar', 'Reports' => 'Reports', 'Quotes' => 'Quotes', 'Products' => 'Products', 'Forecasts' => 'Forecasts', 'Contracts' => 'Contracts', 'KBDocuments' => 'KBDocuments'); $newModuleList = array_merge($newModuleList, $must_have_modules); //new modules list now has left over modules which are new to this install, so lets add them to the system tabs logThis('new modules to add are ' . var_export($newModuleList, true), $path); //grab the existing system tabs $tabs = $newTB->get_system_tabs(); //add the new tabs to the array foreach ($newModuleList as $nm) {
function addNewSystemTabsFromUpgrade($from_dir) { global $path; if (isset($_SESSION['upgrade_from_flavor'])) { //check to see if there are any new files that need to be added to systems tab //retrieve old modules list logThis('check to see if new modules exist', $path); $oldModuleList = array(); $newModuleList = array(); include $from_dir . '/include/modules.php'; $oldModuleList = $moduleList; include 'include/modules.php'; $newModuleList = $moduleList; //include tab controller require_once 'modules/MySettings/TabController.php'; $newTB = new TabController(); //make sure new modules list has a key we can reference directly $newModuleList = $newTB->get_key_array($newModuleList); $oldModuleList = $newTB->get_key_array($oldModuleList); //iterate through list and remove commonalities to get new modules foreach ($newModuleList as $remove_mod) { if (in_array($remove_mod, $oldModuleList)) { unset($newModuleList[$remove_mod]); } } //new modules list now has left over modules which are new to this install, so lets add them to the system tabs logThis('new modules to add are ' . var_export($newModuleList, true), $path); if (!empty($newModuleList)) { //grab the existing system tabs $tabs = $newTB->get_system_tabs(); //add the new tabs to the array foreach ($newModuleList as $nm) { $tabs[$nm] = $nm; } $newTB->set_system_tabs($tabs); } logThis('module tabs updated', $path); } }
function getParentModulesOfSubpanel($subpanel) { global $moduleList, $beanFiles, $beanList, $module; //use tab controller function to get module list with named keys require_once "modules/MySettings/TabController.php"; require_once "include/SubPanel/SubPanelDefinitions.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); $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); if (isset($spd->layout_defs['subpanel_setup'][strtolower($subpanel)]['module'])) { $spd_arr[] = $mod_name; } } return $spd_arr; }
/** * 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; }
echo $mod_strings['LBL_PERFORM_DONE']; $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
/** * Gets parent modules of a subpanel * * @param string $subpanel The name of the subpanel * @return array */ public function getParentModulesOfSubpanel($subpanel) { global $moduleList, $beanFiles, $beanList, $module; //use tab controller function to get module list with named keys require_once 'modules/MySettings/TabController.php'; require_once 'include/SubPanel/SubPanelDefinitions.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); $spd = ''; $spd_arr = array(); //iterate through modules and build subpanel array foreach ($modules_to_check as $mod_name) { $bean = BeanFactory::getBean($mod_name); if (empty($bean)) { continue; } //create new subpanel definition instance and get list of tabs $spd = new SubPanelDefinitions($bean); if (isset($spd->layout_defs['subpanel_setup'][strtolower($subpanel)]['module'])) { $spd_arr[] = $mod_name; } } return $spd_arr; }
global $current_user; $mod_list_strings_key_to_lower = array_change_key_case($app_list_strings['moduleList']); if (!is_admin($current_user)) { sugar_die("Unauthorized access to administration."); } ////////////////// Processing Save //if coming from save, iterate through array and save into user preferences $panels_to_show = ''; $panels_to_hide = ''; if (isset($_REQUEST['Save_or_Cancel']) && $_REQUEST['Save_or_Cancel'] == 'save') { if (isset($_REQUEST['disabled_panels'])) { $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