/** * Implement get_body function to correctly populate the template for the ModuleBuilder/Studio * Add field page. * * @param Sugar_Smarty $ss * @param array $vardef * */ function get_body(&$ss, $vardef) { global $app_list_strings, $mod_strings; $vars = $ss->get_template_vars(); $fields = $vars['module']->mbvardefs->vardefs['fields']; $fieldOptions = array(); foreach ($fields as $id => $def) { $fieldOptions[$id] = $def['name']; } $ss->assign('fieldOpts', $fieldOptions); return $ss->fetch('custom/modules/DynamicFields/templates/Fields/Forms/worklog.tpl'); }
/** * Called from process(). This method will display the footer on the page. */ public function displayFooter() { if (empty($this->responseTime)) { $this->_calculateFooterMetrics(); } global $sugar_config; global $app_strings; global $mod_strings; $themeObject = SugarThemeRegistry::current(); //decide whether or not to show themepicker, default is to show $showThemePicker = true; if (isset($sugar_config['showThemePicker'])) { $showThemePicker = $sugar_config['showThemePicker']; } echo "<!-- crmprint -->"; $jsalerts = new jsAlerts(); if (!isset($_SESSION['isMobile'])) { echo $jsalerts->getScript(); } $ss = new Sugar_Smarty(); $ss->assign("AUTHENTICATED", isset($_SESSION["authenticated_user_id"])); $ss->assign('MOD', return_module_language($GLOBALS['current_language'], 'Users')); $bottomLinkList = array(); if (isset($this->action) && $this->action != "EditView") { $bottomLinkList['print'] = array($app_strings['LNK_PRINT'] => getPrintLink()); } $bottomLinkList['backtotop'] = array($app_strings['LNK_BACKTOTOP'] => 'javascript:SUGAR.util.top();'); $bottomLinksStr = ""; foreach ($bottomLinkList as $key => $value) { foreach ($value as $text => $link) { $href = $link; if (substr($link, 0, 11) == "javascript:") { $onclick = " onclick=\"" . substr($link, 11) . "\""; $href = "javascript:void(0)"; } else { $onclick = ""; } $imageURL = SugarThemeRegistry::current()->getImageURL($key . '.gif'); $bottomLinksStr .= "<a href=\"{$href}\""; $bottomLinksStr .= isset($onclick) ? $onclick : ""; $bottomLinksStr .= "><img src='{$imageURL}' alt=''>"; //keeping alt blank on purpose for 508 (text will be read instead) $bottomLinksStr .= " " . $text . "</a>"; } } $ss->assign("BOTTOMLINKS", $bottomLinksStr); if (SugarConfig::getInstance()->get('calculate_response_time', false)) { $ss->assign('STATISTICS', $this->_getStatistics()); } // Under the License referenced above, you are required to leave in all copyright statements in both // the code and end-user application. $copyright = '© 2004-2012 SugarCRM Inc. The Program is provided AS IS, without warranty. Licensed under <a href="LICENSE.txt" target="_blank" class="copyRightLink">AGPLv3</a>.<br>This program is free software; you can redistribute it and/or modify it under the terms of the <br><a href="LICENSE.txt" target="_blank" class="copyRightLink"> GNU Affero General Public License version 3</a> as published by the Free Software Foundation, including the additional permission set forth in the source code header.<br>'; // 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 General Public License version // 3. In accordance with Section 7(b) of the GNU 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". $attribLinkImg = "<img style='margin-top: 2px' border='0' width='120' height='34' src='include/images/poweredby_sugarcrm_65.png' alt='Powered By SugarCRM'>\n"; // handle resizing of the company logo correctly on the fly $companyLogoURL = $themeObject->getImageURL('company_logo.png'); $companyLogoURL_arr = explode('?', $companyLogoURL); $companyLogoURL = $companyLogoURL_arr[0]; $company_logo_attributes = sugar_cache_retrieve('company_logo_attributes'); if (!empty($company_logo_attributes)) { $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]); $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]); $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]); } else { // Always need to md5 the file $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL)); list($width, $height) = getimagesize($companyLogoURL); if ($width > 212 || $height > 40) { $resizePctWidth = ($width - 212) / 212; $resizePctHeight = ($height - 40) / 40; if ($resizePctWidth > $resizePctHeight) { $resizeAmount = $width / 212; } else { $resizeAmount = $height / 40; } $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount))); $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount))); } else { $ss->assign("COMPANY_LOGO_WIDTH", $width); $ss->assign("COMPANY_LOGO_HEIGHT", $height); } // Let's cache the results sugar_cache_put('company_logo_attributes', array($ss->get_template_vars("COMPANY_LOGO_MD5"), $ss->get_template_vars("COMPANY_LOGO_WIDTH"), $ss->get_template_vars("COMPANY_LOGO_HEIGHT"))); } $ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL) . "&logo_md5=" . $ss->get_template_vars("COMPANY_LOGO_MD5")); // Bug 38594 - Add in Trademark wording $copyright .= 'SugarCRM is a trademark of SugarCRM, Inc. All other company and product names may be trademarks of the respective companies with which they are associated.<br />'; //rrs bug: 20923 - if this image does not exist as per the license, then the proper image will be displayed regardless, so no need //to display an empty image here. if (file_exists('include/images/poweredby_sugarcrm_65.png')) { $copyright .= $attribLinkImg; } // End Required Image $ss->assign('COPYRIGHT', $copyright); // here we allocate the help link data $help_actions_blacklist = array('Login'); // we don't want to show a context help link here if (!in_array($this->action, $help_actions_blacklist)) { $url = 'javascript:void(window.open(\'index.php?module=Administration&action=SupportPortal&view=documentation&version=' . $GLOBALS['sugar_version'] . '&edition=' . $GLOBALS['sugar_flavor'] . '&lang=' . $GLOBALS['current_language'] . '&help_module=' . $this->module . '&help_action=' . $this->action . '&key=' . $GLOBALS['server_unique_key'] . '\'))'; $label = (isset($GLOBALS['app_list_strings']['moduleList'][$this->module]) ? $GLOBALS['app_list_strings']['moduleList'][$this->module] : $this->module) . ' ' . $app_strings['LNK_HELP']; $ss->assign('HELP_LINK', SugarThemeRegistry::current()->getLink($url, $label, "id='help_link_two'", 'help-dashlet.png', 'class="icon"', null, null, '', 'left')); } // end $ss->display(SugarThemeRegistry::current()->getTemplate('footer.tpl')); }
/** * Displays the header on section of the page; basically everything before the content */ public function displayHeader() { global $theme; global $max_tabs; global $app_strings; global $current_user; global $sugar_config; global $app_list_strings; global $mod_strings; global $current_language; $GLOBALS['app']->headerDisplayed = true; $themeObject = SugarThemeRegistry::current(); $theme = $themeObject->__toString(); $ss = new Sugar_Smarty(); $ss->assign("APP", $app_strings); $ss->assign("THEME", $theme); $ss->assign("THEME_IE6COMPAT", $themeObject->ie6compat ? 'true' : 'false'); $ss->assign("MODULE_NAME", $this->module); // get browser title $ss->assign("SYSTEM_NAME", $this->getBrowserTitle()); // get css $css = $themeObject->getCSS(); if ($this->_getOption('view_print')) { $css .= '<link rel="stylesheet" type="text/css" href="' . $themeObject->getCSSURL('print.css') . '" media="all" />'; } $ss->assign("SUGAR_CSS", $css); // get javascript ob_start(); $this->renderJavascript(); $ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS()); ob_end_clean(); // get favicon if (isset($GLOBALS['sugar_config']['default_module_favicon'])) { $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; } else { $module_favicon = false; } $favicon = ''; if ($module_favicon) { $favicon = $themeObject->getImageURL($this->module . '.gif', false); } if (!sugar_is_file($favicon) || !$module_favicon) { $favicon = $themeObject->getImageURL('sugar_icon.ico', false); } $ss->assign('FAVICON_URL', getJSPath($favicon)); // build the shortcut menu $shortcut_menu = array(); foreach ($this->getMenu() as $key => $menu_item) { $shortcut_menu[$key] = array("URL" => $menu_item[0], "LABEL" => $menu_item[1], "MODULE_NAME" => $menu_item[2], "IMAGE" => $themeObject->getImage($menu_item[2], "alt='" . $menu_item[1] . "' border='0' align='absmiddle'")); } $ss->assign("SHORTCUT_MENU", $shortcut_menu); // handle rtl text direction if (isset($_REQUEST['RTL']) && $_REQUEST['RTL'] == 'RTL') { $_SESSION['RTL'] = true; } if (isset($_REQUEST['LTR']) && $_REQUEST['LTR'] == 'LTR') { unset($_SESSION['RTL']); } if (isset($_SESSION['RTL']) && $_SESSION['RTL']) { $ss->assign("DIR", 'dir="RTL"'); } // handle resizing of the company logo correctly on the fly $companyLogoURL = $themeObject->getImageURL('company_logo.png'); $companyLogoURL_arr = explode('?', $companyLogoURL); $companyLogoURL = $companyLogoURL_arr[0]; $company_logo_attributes = sugar_cache_retrieve('company_logo_attributes'); if (!empty($company_logo_attributes)) { $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]); $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]); $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]); } else { // Always need to md5 the file $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL)); list($width, $height) = getimagesize($companyLogoURL); if ($width > 212 || $height > 40) { $resizePctWidth = ($width - 212) / 212; $resizePctHeight = ($height - 40) / 40; if ($resizePctWidth > $resizePctHeight) { $resizeAmount = $width / 212; } else { $resizeAmount = $height / 40; } $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount))); $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount))); } else { $ss->assign("COMPANY_LOGO_WIDTH", $width); $ss->assign("COMPANY_LOGO_HEIGHT", $height); } // Let's cache the results sugar_cache_put('company_logo_attributes', array($ss->get_template_vars("COMPANY_LOGO_MD5"), $ss->get_template_vars("COMPANY_LOGO_WIDTH"), $ss->get_template_vars("COMPANY_LOGO_HEIGHT"))); } $ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL) . "&logo_md5=" . $ss->get_template_vars("COMPANY_LOGO_MD5")); // get the global links $gcls = array(); $global_control_links = array(); require "include/globalControlLinks.php"; foreach ($global_control_links as $key => $value) { if ($key == 'users') { //represents logout link. $ss->assign("LOGOUT_LINK", $value['linkinfo'][key($value['linkinfo'])]); $ss->assign("LOGOUT_LABEL", key($value['linkinfo'])); //key value for first element. continue; } foreach ($value as $linkattribute => $attributevalue) { // get the main link info if ($linkattribute == 'linkinfo') { $gcls[$key] = array("LABEL" => key($attributevalue), "URL" => current($attributevalue), "SUBMENU" => array()); if (substr($gcls[$key]["URL"], 0, 11) == "javascript:") { $gcls[$key]["ONCLICK"] = substr($gcls[$key]["URL"], 11); $gcls[$key]["URL"] = "#"; } } // and now the sublinks if ($linkattribute == 'submenu' && is_array($attributevalue)) { foreach ($attributevalue as $submenulinkkey => $submenulinkinfo) { $gcls[$key]['SUBMENU'][$submenulinkkey] = array("LABEL" => key($submenulinkinfo), "URL" => current($submenulinkinfo)); } if (substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") { $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 11); $gcls[$key]['SUBMENU'][$submenulinkkey]["URL"] = "#"; } } } } $ss->assign("GCLS", $gcls); $ss->assign("SEARCH", isset($_REQUEST['query_string']) ? $_REQUEST['query_string'] : ''); if ($this->action == "EditView" || $this->action == "Login") { $ss->assign("ONLOAD", 'onload="set_focus()"'); } $ss->assign("AUTHENTICATED", isset($_SESSION["authenticated_user_id"])); // get other things needed for page style popup if (isset($_SESSION["authenticated_user_id"])) { // get the current user name and id $ss->assign("CURRENT_USER", $current_user->full_name == '' || !showFullName() ? $current_user->user_name : $current_user->full_name); $ss->assign("CURRENT_USER_ID", $current_user->id); // get the last viewed records $tracker = new Tracker(); $history = $tracker->get_recently_viewed($current_user->id); foreach ($history as $key => $row) { $history[$key]['item_summary_short'] = getTrackerSubstring($row['item_summary']); $history[$key]['image'] = SugarThemeRegistry::current()->getImage($row['module_name'], 'border="0" align="absmiddle" alt="' . $row['item_summary'] . '"'); } $ss->assign("recentRecords", $history); } $bakModStrings = $mod_strings; if (isset($_SESSION["authenticated_user_id"])) { // get the module list $moduleTopMenu = array(); $max_tabs = $current_user->getPreference('max_tabs'); // Attempt to correct if max tabs count is waaay too high. if (!isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10) { $max_tabs = $GLOBALS['sugar_config']['default_max_tabs']; $current_user->setPreference('max_tabs', $max_tabs, 0, 'global'); } $moduleTab = $this->_getModuleTab(); $ss->assign('MODULE_TAB', $moduleTab); // See if they are using grouped tabs or not (removed in 6.0, returned in 6.1) $user_navigation_paradigm = $current_user->getPreference('navigation_paradigm'); if (!isset($user_navigation_paradigm)) { $user_navigation_paradigm = $GLOBALS['sugar_config']['default_navigation_paradigm']; } // Get the full module list for later use foreach (query_module_access_list($current_user) as $module) { // Bug 25948 - Check for the module being in the moduleList if (isset($app_list_strings['moduleList'][$module])) { $fullModuleList[$module] = $app_list_strings['moduleList'][$module]; } } if (!should_hide_iframes()) { $iFrame = new iFrame(); $frames = $iFrame->lookup_frames('tab'); foreach ($frames as $key => $values) { $fullModuleList[$key] = $values; } } elseif (isset($fullModuleList['iFrames'])) { unset($fullModuleList['iFrames']); } if ($user_navigation_paradigm == 'gm' && isset($themeObject->group_tabs) && $themeObject->group_tabs) { // We are using grouped tabs require_once 'include/GroupedTabs/GroupedTabStructure.php'; $groupedTabsClass = new GroupedTabStructure(); $modules = query_module_access_list($current_user); //handle with submoremodules $max_tabs = $current_user->getPreference('max_tabs'); // If the max_tabs isn't set incorrectly, set it within the range, to the default max sub tabs size if (!isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10) { // We have a default value. Use it if (isset($GLOBALS['sugar_config']['default_max_tabs'])) { $max_tabs = $GLOBALS['sugar_config']['default_max_tabs']; } else { $max_tabs = 8; } } $subMoreModules = false; $groupTabs = $groupedTabsClass->get_tab_structure(get_val_array($modules)); // We need to put this here, so the "All" group is valid for the user's preference. $groupTabs[$app_strings['LBL_TABGROUP_ALL']]['modules'] = $fullModuleList; // Setup the default group tab. $allGroup = $app_strings['LBL_TABGROUP_ALL']; $ss->assign('currentGroupTab', $allGroup); $currentGroupTab = $allGroup; $usersGroup = $current_user->getPreference('theme_current_group'); // Figure out which tab they currently have selected (stored as a user preference) if (!empty($usersGroup) && isset($groupTabs[$usersGroup])) { $currentGroupTab = $usersGroup; } else { $current_user->setPreference('theme_current_group', $currentGroupTab); } $ss->assign('currentGroupTab', $currentGroupTab); $usingGroupTabs = true; } else { // Setup the default group tab. $ss->assign('currentGroupTab', $app_strings['LBL_TABGROUP_ALL']); $usingGroupTabs = false; $groupTabs[$app_strings['LBL_TABGROUP_ALL']]['modules'] = $fullModuleList; } $topTabList = array(); // Now time to go through each of the tab sets and fix them up. foreach ($groupTabs as $tabIdx => $tabData) { $topTabs = $tabData['modules']; if (!is_array($topTabs)) { $topTabs = array(); } $extraTabs = array(); // Split it in to the tabs that go across the top, and the ones that are on the extra menu. if (count($topTabs) > $max_tabs) { $extraTabs = array_splice($topTabs, $max_tabs); } // Make sure the current module is accessable through one of the top tabs if (!isset($topTabs[$moduleTab])) { // Nope, we need to add it. // First, take it out of the extra menu, if it's there if (isset($extraTabs[$moduleTab])) { unset($extraTabs[$moduleTab]); } if (count($topTabs) >= $max_tabs - 1) { // We already have the maximum number of tabs, so we need to shuffle the last one // from the top to the first one of the extras $lastElem = array_splice($topTabs, $max_tabs - 1); $extraTabs = $lastElem + $extraTabs; } if (!empty($moduleTab)) { $topTabs[$moduleTab] = $app_list_strings['moduleList'][$moduleTab]; } } /* // This was removed, but I like the idea, so I left the code in here in case we decide to turn it back on // If we are using group tabs, add all the "hidden" tabs to the end of the extra menu if ( $usingGroupTabs ) { foreach($fullModuleList as $moduleKey => $module ) { if ( !isset($topTabs[$moduleKey]) && !isset($extraTabs[$moduleKey]) ) { $extraTabs[$moduleKey] = $module; } } } */ // Get a unique list of the top tabs so we can build the popup menus for them foreach ($topTabs as $moduleKey => $module) { $topTabList[$moduleKey] = $module; } $groupTabs[$tabIdx]['modules'] = $topTabs; $groupTabs[$tabIdx]['extra'] = $extraTabs; } } if (isset($topTabList) && is_array($topTabList)) { // Adding shortcuts array to menu array for displaying shortcuts associated with each module $shortcutTopMenu = array(); foreach ($topTabList as $module_key => $label) { global $mod_strings; $mod_strings = return_module_language($current_language, $module_key); foreach ($this->getMenu($module_key) as $key => $menu_item) { $shortcutTopMenu[$module_key][$key] = array("URL" => $menu_item[0], "LABEL" => $menu_item[1], "MODULE_NAME" => $menu_item[2], "IMAGE" => $themeObject->getImage($menu_item[2], "alt='" . $menu_item[1] . "' border='0' align='absmiddle'")); } } $ss->assign("groupTabs", $groupTabs); $ss->assign("shortcutTopMenu", $shortcutTopMenu); $ss->assign('USE_GROUP_TABS', $usingGroupTabs); // This is here for backwards compatibility, someday, somewhere, it will be able to be removed $ss->assign("moduleTopMenu", $groupTabs[$app_strings['LBL_TABGROUP_ALL']]['modules']); $ss->assign("moduleExtraMenu", $groupTabs[$app_strings['LBL_TABGROUP_ALL']]['extra']); } global $mod_strings; $mod_strings = $bakModStrings; $headerTpl = $themeObject->getTemplate('header.tpl'); if (isset($GLOBALS['sugar_config']['developerMode']) && $GLOBALS['sugar_config']['developerMode']) { $ss->clear_compiled_tpl($headerTpl); } $ss->display($headerTpl); $this->includeClassicFile('modules/Administration/DisplayWarnings.php'); $errorMessages = SugarApplication::getErrorMessages(); if (!empty($errorMessages)) { foreach ($errorMessages as $error_message) { echo '<p class="error">' . $error_message . '</p>'; } } }
$chooser->args['right_name'] = 'hide_tabs'; $chooser->args['left_label'] = $mod_strings['LBL_DISPLAY_TABS']; $chooser->args['right_label'] = $mod_strings['LBL_HIDE_TABS']; $chooser->args['title'] = $mod_strings['LBL_EDIT_TABS'] . ' <img border="0" src="themes/default/images/helpInline.gif" onmouseover="return overlib(\'Choose which tabs are displayed.\', FGCLASS, \'olFgClass\', CGCLASS, \'olCgClass\', BGCLASS, \'olBgClass\', TEXTFONTCLASS, \'olFontClass\', CAPTIONFONTCLASS, \'olCapFontClass\', CLOSEFONTCLASS, \'olCloseFontClass\', WIDTH, -1, NOFOLLOW, \'ol_nofollow\' );" onmouseout="return nd();"/>'; $sugar_smarty->assign('TAB_CHOOSER', $chooser->display()); $sugar_smarty->assign('CHOOSER_SCRIPT', 'set_chooser();'); $sugar_smarty->assign('CHOOSE_WHICH', $mod_strings['LBL_CHOOSE_WHICH']); /////////////////////////////////////////////////////////////////////////////// //// EMAIL OPTIONS // We need to turn off the requiredness of emails if it is a group or portal user if ($usertype == 'GROUP' || $usertype == 'PORTAL_ONLY') { global $dictionary; $dictionary['User']['fields']['email1']['required'] = false; } // hack to disable email field being required if it shouldn't be required if ($sugar_smarty->get_template_vars("REQUIRED_EMAIL_ADDRESS") == '0') { $GLOBALS['dictionary']['User']['fields']['email1']['required'] = false; } $sugar_smarty->assign("NEW_EMAIL", getEmailAddressWidget($focus, "email1", $focus->email1, "EditView")); // hack to undo that previous hack if ($sugar_smarty->get_template_vars("REQUIRED_EMAIL_ADDRESS") == '0') { $GLOBALS['dictionary']['User']['fields']['email1']['required'] = true; } $sugar_smarty->assign('EMAIL_LINK_TYPE', get_select_options_with_id($app_list_strings['dom_email_link_type'], $focus->getPreference('email_link_type'))); ///// END EMAIL OPTIONS /////////////////////////////////////////////////////////////////////////////// if ($is_current_admin) { $employee_status = '<select tabindex="5" name="employee_status">'; $employee_status .= get_select_options_with_id($app_list_strings['employee_status_dom'], $focus->employee_status); $employee_status .= '</select>'; } else {
/** * Displays the header on section of the page; basically everything before the content * @deprecated since 7.0, will be removed from 7.2. */ public function displayHeader($retModTabs = false) { global $theme; global $max_tabs; global $app_strings; global $current_user; global $app_list_strings; global $mod_strings; global $current_language; $GLOBALS['app']->headerDisplayed = true; $themeObject = SugarThemeRegistry::current(); $theme = $themeObject->__toString(); $ss = new Sugar_Smarty(); $ss->assign("APP", $app_strings); $ss->assign("THEME", $theme); $ss->assign("THEME_IE6COMPAT", $themeObject->ie6compat ? 'true' : 'false'); $ss->assign("MODULE_NAME", $this->module); $ss->assign("langHeader", get_language_header()); $ss->assign('use_table_container', isset($this->options['use_table_container']) ? $this->options['use_table_container'] : false); // set ab testing if exists $testing = isset($_REQUEST["testing"]) ? $_REQUEST['testing'] : "a"; $ss->assign("ABTESTING", $testing); // get browser title $ss->assign("SYSTEM_NAME", $this->getBrowserTitle()); // get css $ss->assign("SUGAR_CSS", $this->getThemeCss()); // get javascript ob_start(); $this->renderJavascript(); $ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS()); ob_end_clean(); $favicon = $this->getFavicon(); $ss->assign('FAVICON_URL', $favicon['url']); // build the shortcut menu $shortcut_menu = array(); foreach ($this->getMenu() as $key => $menu_item) { $shortcut_menu[$key] = array("URL" => $menu_item[0], "LABEL" => $menu_item[1], "MODULE_NAME" => $menu_item[2], "IMAGE" => $themeObject->getImage($menu_item[2], "border='0' align='absmiddle'", null, null, '.gif', $menu_item[1])); } $ss->assign("SHORTCUT_MENU", $shortcut_menu); // handle rtl text direction if (isset($_REQUEST['RTL']) && $_REQUEST['RTL'] == 'RTL') { $_SESSION['RTL'] = true; } if (isset($_REQUEST['LTR']) && $_REQUEST['LTR'] == 'LTR') { unset($_SESSION['RTL']); } if (isset($_SESSION['RTL']) && $_SESSION['RTL']) { $ss->assign("DIR", 'dir="RTL"'); } // handle resizing of the company logo correctly on the fly $companyLogoURL = $themeObject->getImageURL('company_logo.png', true, true); $companyLogoURL_arr = explode('?', $companyLogoURL); $companyLogoURL = $companyLogoURL_arr[0]; $company_logo_attributes = sugar_cache_retrieve('company_logo_attributes'); if (!empty($company_logo_attributes)) { $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]); $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]); $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]); } else { // Always need to md5 the file $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL)); list($width, $height) = getimagesize($companyLogoURL); if ($width > 212 || $height > 40) { $resizePctWidth = ($width - 212) / 212; $resizePctHeight = ($height - 40) / 40; if ($resizePctWidth > $resizePctHeight) { $resizeAmount = $width / 212; } else { $resizeAmount = $height / 40; } $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount))); $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount))); } else { $ss->assign("COMPANY_LOGO_WIDTH", $width); $ss->assign("COMPANY_LOGO_HEIGHT", $height); } // Let's cache the results sugar_cache_put('company_logo_attributes', array($ss->get_template_vars("COMPANY_LOGO_MD5"), $ss->get_template_vars("COMPANY_LOGO_WIDTH"), $ss->get_template_vars("COMPANY_LOGO_HEIGHT"))); } $ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL) . "&logo_md5=" . $ss->get_template_vars("COMPANY_LOGO_MD5")); // get the global links (Currently not used, since we hardcoded the metadata for profileactions // and upon upgrade, we convert global link in metadataconverter to create custom metadata // for profileactions, Thus, code below can be removed in the future) $gcls = array(); $global_control_links = array(); require "include/globalControlLinks.php"; foreach ($global_control_links as $key => $value) { if ($key == 'users') { //represents logout link. $ss->assign("LOGOUT_LINK", $value['linkinfo'][key($value['linkinfo'])]); $ss->assign("LOGOUT_LABEL", key($value['linkinfo'])); //key value for first element. continue; } foreach ($value as $linkattribute => $attributevalue) { // get the main link info if ($linkattribute == 'linkinfo') { $gcls[$key] = array("LABEL" => key($attributevalue), "URL" => current($attributevalue), "SUBMENU" => array()); if (substr($gcls[$key]["URL"], 0, 11) == "javascript:") { $gcls[$key]["ONCLICK"] = substr($gcls[$key]["URL"], 11); $gcls[$key]["URL"] = "javascript:void(0)"; } } // and now the sublinks if ($linkattribute == 'submenu' && is_array($attributevalue)) { foreach ($attributevalue as $submenulinkkey => $submenulinkinfo) { $gcls[$key]['SUBMENU'][$submenulinkkey] = array("LABEL" => key($submenulinkinfo), "URL" => current($submenulinkinfo)); } if (substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") { $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 11); $gcls[$key]['SUBMENU'][$submenulinkkey]["URL"] = "javascript:void(0)"; } } } } $ss->assign("GCLS", $gcls); $ss->assign("SEARCH", isset($_REQUEST['query_string']) ? $_REQUEST['query_string'] : ''); if ($this->action == "EditView" || $this->action == "Login") { $ss->assign("ONLOAD", 'onload="set_focus()"'); } $ss->assign("AUTHENTICATED", isset($_SESSION["authenticated_user_id"])); $ss->assign("ISPRINT", isset($_REQUEST['print'])); //this will be used by header.tpl to hide the megamenu bar when its 'print' view // get other things needed for page style popup if (isset($_SESSION["authenticated_user_id"])) { // get the current user name and id $ss->assign("CURRENT_USER", $current_user->full_name == '' || !showFullName() ? $current_user->user_name : $current_user->full_name); $ss->assign("CURRENT_USER_ID", $current_user->id); // get the last viewed records $tracker = BeanFactory::getBean('Trackers'); $history = $tracker->get_recently_viewed($current_user->id); $ss->assign("recentRecords", $this->processRecentRecords($history)); } $bakModStrings = $mod_strings; $imageURL = SugarThemeRegistry::current()->getImageURL("dashboard.png"); $homeImage = "<img src='{$imageURL}'>"; $ss->assign("homeImage", $homeImage); global $mod_strings; $mod_strings = $bakModStrings; /******************DC MENU*********************/ // DEPRECATED since 7.0, will be removed from 7.2 // if(!empty($current_user->id) && !$this->_getOption('view_print')){ // require_once('include/DashletContainer/DCFactory.php'); // require_once('include/SugarSearchEngine/SugarSearchEngineFactory.php'); // $dcm = DCFactory::getContainer(null, 'DCMenu'); // $notifData = $dcm->getNotifications(); // $dcjs = getVersionedScript('include/DashletContainer/Containers/DCMenu.js'); // $ss->assign('NOTIFCLASS', $notifData['class']); // $ss->assign('NOTIFCODE', $notifData['code']); // $ss->assign('NOTIFICON', $notifData['icon']); // $ss->assign('DCSCRIPT', $dcm->getScript()); // $ss->assign('ICONSEARCH', $dcm->getSearchIcon()); // $ss->assign('DCACTIONS',$dcm->getMenus()); // $ss->assign('PICTURE', $current_user->picture); // $ftsAutocompleteEnable = TRUE; // $searchEngine = SugarSearchEngineFactory::getInstance(); // if( ($searchEngine instanceOf SugarSearchEngine) || (isset($GLOBALS['sugar_config']['full_text_engine']) // && isset($GLOBALS['sugar_config']['full_text_engine']['disable_autocomplete']) && $GLOBALS['sugar_config']['full_text_engine']['disable_autocomplete'] ) // ) // $ftsAutocompleteEnable = FALSE; // // if (SugarSearchEngineAbstractBase::isSearchEngineDown()) { // $ftsAutocompleteEnable = false; // } // $ss->assign('FTS_AUTOCOMPLETE_ENABLE', $ftsAutocompleteEnable); // $ss->assign('AJAX', isset($_REQUEST['ajax_load'])?$_REQUEST['ajax_load']:"0"); // $ss->assign('ACTION', isset($_REQUEST['action'])?$_REQUEST['action']:""); // $ss->assign('FULL', isset($_REQUEST['full'])?$_REQUEST['full']:"false"); // if(is_admin($GLOBALS['current_user'])){ // $ss->assign('ISADMIN', true); // } else { // $ss->assign('ISADMIN', false); // } // $ss->assign('SUGAR_DCJS', $dcjs); // //$ss->assign('SUGAR_DCMENU', $data['html']); // } /******************END DC MENU*********************/ $headerTpl = $themeObject->getTemplate('header.tpl'); if (inDeveloperMode()) { $ss->clear_compiled_tpl($headerTpl); } $ss->display($headerTpl); $this->includeClassicFile('modules/Administration/DisplayWarnings.php'); $errorMessages = SugarApplication::getErrorMessages(); if (!empty($errorMessages)) { foreach ($errorMessages as $error_message) { echo '<p class="error">' . $error_message . '</p>'; } } }
/** * Determine whether or not to dispay the header on the page. */ function displayHeader() { global $theme; global $max_tabs; global $app_strings; global $current_user; global $sugar_config; global $app_list_strings; $GLOBALS['app']->headerDisplayed = true; if (!function_exists('get_new_record_form') && (file_exists('modules/' . $this->module . '/metadata/sidecreateviewdefs.php') || file_exists('custom/modules/' . $this->module . '/metadata/sidecreateviewdefs.php'))) { require_once 'include/EditView/SideQuickCreate.php'; } if (!$this->_menuExists($this->module) && !empty($GLOBALS['mod_strings']['LNK_NEW_RECORD'])) { $GLOBALS['module_menu'][] = array("index.php?module={$this->module}&action=EditView&return_module={$this->module}&return_action=DetailView", $GLOBALS['mod_strings']['LNK_NEW_RECORD'], "{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}{$this->module}", $this->module); $GLOBALS['module_menu'][] = array("index.php?module={$this->module}&action=index", $GLOBALS['mod_strings']['LNK_LIST'], $this->module, $this->module); } $themeObject = SugarThemeRegistry::current(); $theme = $themeObject->__toString(); $ss = new Sugar_Smarty(); $ss->assign("APP", $app_strings); $ss->assign("THEME", $theme); $ss->assign("MODULE_NAME", $this->module); // get css $css = $themeObject->getCSS(); if ($this->_getOption('view_print')) { $css .= '\\n<link rel="stylesheet" type="text/css" href="' . $themeObject->getCSSURL('print.css') . '" media="all" />'; } $ss->assign("SUGAR_CSS", $css); // get javascript ob_start(); $this->renderJavascript(); $ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS()); ob_end_clean(); // get favicon $user_module_favicon = $current_user->getPreference('module_favicon'); if (!isset($user_module_favicon) && isset($GLOBALS['sugar_config']['default_module_favicon'])) { $user_module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; } elseif (!isset($user_module_favicon)) { $user_module_favicon = false; } $favicon = $themeObject->getImageURL($this->module . '.gif', false); if (!sugar_is_file($favicon) || !$user_module_favicon) { $favicon = $themeObject->getImageURL('sugar_icon.ico', false); } $ss->assign('FAVICON_URL', getJSPath($favicon)); // get the module menu $shortcut_menu = array(); $module_menu = load_menu("modules/" . $this->module . "/"); foreach ($module_menu as $key => $menu_item) { $shortcut_menu[$key] = array("URL" => $menu_item[0], "LABEL" => $menu_item[1], "MODULE_NAME" => $menu_item[2], "IMAGE" => $themeObject->getImage($menu_item[2], "alt='" . $menu_item[1] . "' border='0' align='absmiddle'")); } $ss->assign("SHORTCUT_MENU", $shortcut_menu); // handle rtl text direction if (isset($_REQUEST['RTL']) && $_REQUEST['RTL'] == 'RTL') { $_SESSION['RTL'] = true; } if (isset($_REQUEST['LTR']) && $_REQUEST['LTR'] == 'LTR') { unset($_SESSION['RTL']); } if (isset($_SESSION['RTL']) && $_SESSION['RTL']) { $ss->assign("DIR", 'dir="RTL"'); } // handle resizing of the company logo correctly on the fly $companyLogoURL = $themeObject->getImageURL('company_logo.png', false); $ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL)); $company_logo_attributes = sugar_cache_retrieve('company_logo_attributes'); if (!empty($company_logo_attributes) && md5_file($companyLogoURL) == $company_logo_attributes[0]) { $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]); $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]); } else { list($width, $height) = getimagesize($companyLogoURL); if ($width > 212 || $height > 40) { $resizePctWidth = ($width - 212) / 212; $resizePctHeight = ($height - 40) / 40; if ($resizePctWidth > $resizePctHeight) { $resizeAmount = $width / 212; } else { $resizeAmount = $height / 40; } $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount))); $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount))); sugar_cache_put('company_logo_attributes', array(md5_file($companyLogoURL), $ss->get_template_vars("COMPANY_LOGO_WIDTH"), $ss->get_template_vars("COMPANY_LOGO_HEIGHT"))); } else { $ss->assign("COMPANY_LOGO_WIDTH", $width); $ss->assign("COMPANY_LOGO_HEIGHT", $height); } } // get the global links $gcls = array(); $global_control_links = array(); require "include/globalControlLinks.php"; foreach ($global_control_links as $key => $value) { if ($key == 'users') { //represents logout link. $ss->assign("LOGOUT_LINK", $value['linkinfo'][key($value['linkinfo'])]); $ss->assign("LOGOUT_LABEL", key($value['linkinfo'])); //key value for first element. continue; } foreach ($value as $linkattribute => $attributevalue) { // get the main link info if ($linkattribute == 'linkinfo') { $gcls[$key] = array("LABEL" => key($attributevalue), "URL" => current($attributevalue)); } // and now the sublinks if ($linkattribute == 'submenu' && is_array($attributevalue)) { foreach ($attributevalue as $submenulinkkey => $submenulinkinfo) { $gcls[$key]['SUBMENU'][$submenulinkkey] = array("LABEL" => key($submenulinkinfo), "URL" => current($submenulinkinfo)); } } } } $ss->assign("GCLS", $gcls); if (isset($_REQUEST['query_string'])) { $ss->assign("SEARCH", $_REQUEST['query_string']); } if ($this->action == "EditView" || $this->action == "Login") { $ss->assign("ONLOAD", 'onload="set_focus()"'); } $ss->assign("AUTHENTICATED", isset($_SESSION["authenticated_user_id"])); if (isset($_SESSION["authenticated_user_id"])) { $ss->assign('selectThemeOptions', get_select_options_with_id(SugarThemeRegistry::availableThemes(), SugarThemeRegistry::current()->__toString())); // build json string of theme properties $allThemes = array(); foreach (SugarThemeRegistry::availableThemes() as $dirName => $themeName) { $selectedTheme = SugarThemeRegistry::get($dirName); $allThemes[$dirName] = array('name' => $themeName, 'description' => $selectedTheme->description, 'previewImage' => $selectedTheme->getImageURL('themePreview.png'), 'colorSelect' => '', 'fontSelect' => ''); // foreach color if (count($selectedTheme->colors) > 1) { $startingColorName = $selectedTheme->colors[0]; if (!empty($_SESSION['authenticated_user_theme_color']) && in_array($_SESSION['authenticated_user_theme_color'], $themeObject->colors)) { $startingColorName = $_SESSION['authenticated_user_theme_color']; } $startingColorIcon = $selectedTheme->getImageURL("colors.{$startingColorName}.icon.gif"); $allThemes[$dirName]['colorSelect'] = <<<EOHTML <script type="text/javascript"> function change_color(color) { \t\tvar callback = { success: function(o){ \t\t\t\tSUGAR.themes.changeColor(color); }, failure: function(o){ alert("Ajax failure"); } } \t\tvar postData = '&usercolor='+color; YAHOO.util.Connect.asyncRequest('POST','index.php?module=Home&action=index', callback, postData); } function change_font(font) { \tvar callback = { success: function(o){ \t\t\t\tSUGAR.themes.changeFont(font); }, failure: function(o){ alert("Ajax failure"); } } \t\tvar postData = '&userfont='+font; YAHOO.util.Connect.asyncRequest('POST','index.php?module=Home&action=index', callback, postData); } </script> <input type="hidden" name="usercolor" id="usercolor" value=""> <ul id="color_menu"> EOHTML; foreach ($selectedTheme->colors as $color) { $colorIcon = $selectedTheme->getImageURL("colors.{$color}.icon.gif"); $allThemes[$dirName]['colorSelect'] .= <<<EOHTML <li style="background: url({$colorIcon}) no-repeat center;" onclick="change_color('{$color}');"></li> EOHTML; } $allThemes[$dirName]['colorSelect'] .= '</ul></span>'; } // foreach font if (count($selectedTheme->fonts) > 1) { $startingFontName = $selectedTheme->fonts[0]; if (!empty($_SESSION['authenticated_user_theme_font']) && in_array($_SESSION['authenticated_user_theme_font'], $themeObject->fonts)) { $startingFontName = $_SESSION['authenticated_user_theme_font']; } $startingFontIcon = $selectedTheme->getImageURL("fonts.{$startingFontName}.icon.gif"); $allThemes[$dirName]['fontSelect'] = <<<EOHTML <input type="hidden" name="userfont" id="userfont" value=""> <ul id="font_menu"> EOHTML; foreach ($selectedTheme->fonts as $font) { $fontIcon = $selectedTheme->getImageURL("fonts.{$font}.icon.gif"); $allThemes[$dirName]['fontSelect'] .= <<<EOHTML <li style="background: url({$fontIcon}) no-repeat;" onclick="change_font('{$font}');"></li> EOHTML; } $allThemes[$dirName]['fontSelect'] .= '</ul></span>'; } } $json = getJSONobj(); $ss->assign('allThemes', $json->encode($allThemes)); $ss->assign("CURRENTTHEME_NAME", $themeObject->name); $ss->assign("CURRENTTHEME_DESCRIPTION", $themeObject->description); $ss->assign("CURRENTTHEME_FONTSELECT", $allThemes[$themeObject->dirName]['fontSelect']); $ss->assign("CURRENTTHEME_COLORSELECT", $allThemes[$themeObject->dirName]['colorSelect']); // get the current user name and id $ss->assign("CURRENT_USER", $current_user->first_name != '' ? $current_user->first_name : $current_user->user_name); $ss->assign("CURRENT_USER_ID", $current_user->id); // get the last viewed records $tracker = new Tracker(); $history = $tracker->get_recently_viewed($current_user->id); foreach ($history as $key => $row) { $history[$key]['item_summary_short'] = getTrackerSubstring($row['item_summary']); $history[$key]['image'] = SugarThemeRegistry::current()->getImage($row['module_name'], 'border="0" align="absmiddle" alt="' . $row['item_summary'] . '"'); } $ss->assign("recentRecords", $history); // new record require_once "modules/" . $this->module . "/Forms.php"; if ($this->action == "index" && function_exists('get_new_record_form')) { $ss->assign("NEW_RECORD", get_new_record_form()); } // Get preference for shortcuts and last_viewed list placement $last_view_swap = $current_user->getPreference('swap_last_viewed'); if (!isset($last_view_swap)) { $last_view_swap = $GLOBALS['sugar_config']['default_swap_last_viewed']; } $ss->assign("LEFT_FORM_LAST_VIEWED", $last_view_swap); $shortcuts_swap = $current_user->getPreference('swap_shortcuts'); if (!isset($shortcuts_swap)) { $shortcuts_swap = $GLOBALS['sugar_config']['default_swap_shortcuts']; } $ss->assign("LEFT_FORM_SHORTCUTS", !$shortcuts_swap); } if (isset($_SESSION["authenticated_user_id"]) || $sugar_config['login_nav']) { // get the module list $moduleTopMenu = array(); $max_tabs = $current_user->getPreference('max_tabs'); if (!isset($max_tabs) || $max_tabs <= 0) { $max_tabs = $GLOBALS['sugar_config']['default_max_tabs']; } $user_navigation_paradigm = $current_user->getPreference('navigation_paradigm'); if (!isset($user_navigation_paradigm)) { $user_navigation_paradigm = $GLOBALS['sugar_config']['default_navigation_paradigm']; } if ($user_navigation_paradigm == 'gm') { require_once 'include/GroupedTabs/GroupedTabStructure.php'; $groupedTabsClass = new GroupedTabStructure(); $modules = query_module_access_list($current_user); $ss->assign('groupTabs', $groupedTabsClass->get_tab_structure(get_val_array($modules))); $ss->assign('moduleNames', $app_list_strings['moduleList']); $ss->assign('defaultFirst', !in_array($this->module, $modules)); $ss->assign('USE_GROUP_TABS', true); } else { $moduleExtraMenu = array(); $i = 1; foreach (query_module_access_list($current_user) as $module) { // Bug 25948 - Check for the module being in the moduleList if (isset($app_list_strings['moduleList'][$module])) { if ($i < $max_tabs) { $moduleTopMenu[$module] = $app_list_strings['moduleList'][$module]; } else { $moduleExtraMenu[$module] = $app_list_strings['moduleList'][$module]; } ++$i; } } // Now, we'll push the current module into the end of top menu list if it's not // already there. In addition, we'll preserve this last entry for this session // until a new value is added there. if (isset($moduleTopMenu[$this->module])) { if (isset($_SESSION['moreTab']) && isset($app_list_strings['moduleList'][$_SESSION['moreTab']])) { $moduleTopMenu[$_SESSION['moreTab']] = $app_list_strings['moduleList'][$_SESSION['moreTab']]; unset($moduleExtraMenu[$_SESSION['moreTab']]); } else { $moduleTopMenu += array_slice($moduleExtraMenu, 0, 1); array_shift($moduleExtraMenu); } } elseif (isset($moduleExtraMenu[$this->module])) { $_SESSION['moreTab'] = $this->module; $moduleTopMenu[$_SESSION['moreTab']] = $app_list_strings['moduleList'][$_SESSION['moreTab']]; unset($moduleExtraMenu[$_SESSION['moreTab']]); } elseif (isset($_SESSION['moreTab']) && isset($app_list_strings['moduleList'][$_SESSION['moreTab']])) { $moduleTopMenu[$_SESSION['moreTab']] = $app_list_strings['moduleList'][$_SESSION['moreTab']]; unset($moduleExtraMenu[$_SESSION['moreTab']]); } $ss->assign("moduleTopMenu", $moduleTopMenu); $ss->assign("moduleExtraMenu", $moduleExtraMenu); } } $headerTpl = $themeObject->getTemplate('header.tpl'); if (isset($GLOBALS['sugar_config']['developerMode']) && $GLOBALS['sugar_config']['developerMode']) { $ss->clear_compiled_tpl($headerTpl); } $ss->display($headerTpl); $this->includeClassicFile('modules/Administration/DisplayWarnings.php'); }
/** * Determine whether or not to dispay the header on the page. */ function displayHeader() { global $theme; global $max_tabs; global $app_strings; global $current_user; global $sugar_config; global $app_list_strings; $GLOBALS['app']->headerDisplayed = true; if (!function_exists('get_new_record_form') && (file_exists('modules/' . $this->module . '/metadata/sidecreateviewdefs.php') || file_exists('custom/modules/' . $this->module . '/metadata/sidecreateviewdefs.php'))) { require_once 'include/EditView/SideQuickCreate.php'; } if (!$this->_menuExists($this->module) && !empty($GLOBALS['mod_strings']['LNK_NEW_RECORD'])) { $GLOBALS['module_menu'][] = array("index.php?module={$this->module}&action=EditView&return_module={$this->module}&return_action=DetailView", $GLOBALS['mod_strings']['LNK_NEW_RECORD'], "{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}{$this->module}", $this->module); $GLOBALS['module_menu'][] = array("index.php?module={$this->module}&action=index", $GLOBALS['mod_strings']['LNK_LIST'], $this->module, $this->module); } $themeObject = SugarThemeRegistry::current(); $theme = $themeObject->__toString(); $ss = new Sugar_Smarty(); $ss->assign("APP", $app_strings); $ss->assign("THEME", $theme); $ss->assign("THEME_IE6COMPAT", $themeObject->ie6compat ? 'true' : 'false'); $ss->assign("MODULE_NAME", $this->module); // get css $css = $themeObject->getCSS(); if ($this->_getOption('view_print')) { $css .= '<link rel="stylesheet" type="text/css" href="' . $themeObject->getCSSURL('print.css') . '" media="all" />'; } $ss->assign("SUGAR_CSS", $css); // get javascript ob_start(); $this->renderJavascript(); $ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS()); ob_end_clean(); // get favicon if (isset($GLOBALS['sugar_config']['default_module_favicon'])) { $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; } else { $module_favicon = false; } $favicon = ''; if ($module_favicon) { $favicon = $themeObject->getImageURL($this->module . '.gif', false); } if (!sugar_is_file($favicon) || !$module_favicon) { $favicon = $themeObject->getImageURL('sugar_icon.ico', false); } $ss->assign('FAVICON_URL', getJSPath($favicon)); // get the module menu $shortcut_menu = array(); $module_menu = load_menu("modules/" . $this->module . "/"); foreach ($module_menu as $key => $menu_item) { $shortcut_menu[$key] = array("URL" => $menu_item[0], "LABEL" => $menu_item[1], "MODULE_NAME" => $menu_item[2], "IMAGE" => $themeObject->getImage($menu_item[2], "alt='" . $menu_item[1] . "' border='0' align='absmiddle'")); } $ss->assign("SHORTCUT_MENU", $shortcut_menu); // handle rtl text direction if (isset($_REQUEST['RTL']) && $_REQUEST['RTL'] == 'RTL') { $_SESSION['RTL'] = true; } if (isset($_REQUEST['LTR']) && $_REQUEST['LTR'] == 'LTR') { unset($_SESSION['RTL']); } if (isset($_SESSION['RTL']) && $_SESSION['RTL']) { $ss->assign("DIR", 'dir="RTL"'); } // handle resizing of the company logo correctly on the fly $companyLogoURL = $themeObject->getImageURL('company_logo.png'); $companyLogoURL_arr = explode('?', $companyLogoURL); $companyLogoURL = $companyLogoURL_arr[0]; $company_logo_attributes = sugar_cache_retrieve('company_logo_attributes'); if (!empty($company_logo_attributes)) { $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]); $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]); $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]); } else { // Always need to md5 the file $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL)); list($width, $height) = getimagesize($companyLogoURL); if ($width > 212 || $height > 40) { $resizePctWidth = ($width - 212) / 212; $resizePctHeight = ($height - 40) / 40; if ($resizePctWidth > $resizePctHeight) { $resizeAmount = $width / 212; } else { $resizeAmount = $height / 40; } $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount))); $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount))); } else { $ss->assign("COMPANY_LOGO_WIDTH", $width); $ss->assign("COMPANY_LOGO_HEIGHT", $height); } // Let's cache the results sugar_cache_put('company_logo_attributes', array($ss->get_template_vars("COMPANY_LOGO_MD5"), $ss->get_template_vars("COMPANY_LOGO_WIDTH"), $ss->get_template_vars("COMPANY_LOGO_HEIGHT"))); } $ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL) . "&logo_md5=" . $ss->get_template_vars("COMPANY_LOGO_MD5")); // get the global links $gcls = array(); $global_control_links = array(); require "include/globalControlLinks.php"; foreach ($global_control_links as $key => $value) { if ($key == 'users') { //represents logout link. $ss->assign("LOGOUT_LINK", $value['linkinfo'][key($value['linkinfo'])]); $ss->assign("LOGOUT_LABEL", key($value['linkinfo'])); //key value for first element. continue; } foreach ($value as $linkattribute => $attributevalue) { // get the main link info if ($linkattribute == 'linkinfo') { $gcls[$key] = array("LABEL" => key($attributevalue), "URL" => current($attributevalue)); } // and now the sublinks if ($linkattribute == 'submenu' && is_array($attributevalue)) { foreach ($attributevalue as $submenulinkkey => $submenulinkinfo) { $gcls[$key]['SUBMENU'][$submenulinkkey] = array("LABEL" => key($submenulinkinfo), "URL" => current($submenulinkinfo)); } } } } $ss->assign("GCLS", $gcls); if (isset($_REQUEST['query_string'])) { $ss->assign("SEARCH", $_REQUEST['query_string']); } if ($this->action == "EditView" || $this->action == "Login") { $ss->assign("ONLOAD", 'onload="set_focus()"'); } $ss->assign("AUTHENTICATED", isset($_SESSION["authenticated_user_id"])); // awu: moving allThemes json array out of authenticated if block for IE6 check on Login screen // build json string of theme properties $allThemes = array(); foreach (SugarThemeRegistry::availableThemes() as $dirName => $themeName) { $selectedTheme = SugarThemeRegistry::get($dirName); $allThemes[$dirName] = array('name' => $themeName, 'description' => $selectedTheme->description, 'ie6compat' => $selectedTheme->ie6compat); } // get other things needed for page style popup $json = getJSONobj(); $ss->assign('allThemes', $json->encode($allThemes)); if (isset($_SESSION["authenticated_user_id"])) { $ss->assign('currentTheme_fonts', $themeObject->fonts); $ss->assign('currentTheme_colors', $themeObject->colors); $ss->assign('currentTheme_groupedTabscompat', $themeObject->group_tabs); $ss->assign('selectThemeOptions', get_select_options_with_id(SugarThemeRegistry::availableThemes(), SugarThemeRegistry::current()->__toString())); $ss->assign('USERS_MOD', return_module_language($GLOBALS['current_language'], 'Users')); $user_navigation_paradigm = $current_user->getPreference('navigation_paradigm'); if (isset($user_navigation_paradigm)) { $ss->assign("NAVADIGMS", get_select_options_with_id($app_list_strings['navigation_paradigms'], $user_navigation_paradigm)); } else { $ss->assign("NAVADIGMS", get_select_options_with_id($app_list_strings['navigation_paradigms'], $GLOBALS['sugar_config']['default_navigation_paradigm'])); } // get the current user name and id $ss->assign("CURRENT_USER", $current_user->first_name != '' ? $current_user->first_name : $current_user->user_name); $ss->assign("CURRENT_USER_ID", $current_user->id); // get the last viewed records $tracker = new Tracker(); $history = $tracker->get_recently_viewed($current_user->id); foreach ($history as $key => $row) { $history[$key]['item_summary_short'] = getTrackerSubstring($row['item_summary']); $history[$key]['image'] = SugarThemeRegistry::current()->getImage($row['module_name'], 'border="0" align="absmiddle" alt="' . $row['item_summary'] . '"'); } $ss->assign("recentRecords", $history); // new record require_once "modules/" . $this->module . "/Forms.php"; if ($this->action == "index" && function_exists('get_new_record_form')) { $ss->assign("NEW_RECORD", get_new_record_form()); } // Get preference for shortcuts and last_viewed list placement $last_view_swap = $current_user->getPreference('swap_last_viewed'); if (!isset($last_view_swap)) { $last_view_swap = $GLOBALS['sugar_config']['default_swap_last_viewed']; } $ss->assign("LEFT_FORM_LAST_VIEWED", $last_view_swap); $shortcuts_swap = $current_user->getPreference('swap_shortcuts'); if (!isset($shortcuts_swap)) { $shortcuts_swap = $GLOBALS['sugar_config']['default_swap_shortcuts']; } $ss->assign("LEFT_FORM_SHORTCUTS", !$shortcuts_swap); } if (isset($_SESSION["authenticated_user_id"]) || $sugar_config['login_nav']) { // get the module list $moduleTopMenu = array(); $max_tabs = $current_user->getPreference('max_tabs'); if (!isset($max_tabs) || $max_tabs <= 0) { $max_tabs = $GLOBALS['sugar_config']['default_max_tabs']; } $user_navigation_paradigm = $current_user->getPreference('navigation_paradigm'); if (!isset($user_navigation_paradigm)) { $user_navigation_paradigm = $GLOBALS['sugar_config']['default_navigation_paradigm']; } // Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions. if (!empty($_REQUEST['module_tab'])) { $moduleTab = $_REQUEST['module_tab']; } elseif (isset($GLOBALS['moduleTabMap'][$this->module])) { $moduleTab = $GLOBALS['moduleTabMap'][$this->module]; } else { $moduleTab = $this->module; } $ss->assign('MODULE_TAB', $moduleTab); if ($user_navigation_paradigm == 'gm' && isset($themeObject->group_tabs) && $themeObject->group_tabs) { require_once 'include/GroupedTabs/GroupedTabStructure.php'; $groupedTabsClass = new GroupedTabStructure(); $modules = query_module_access_list($current_user); //handle with submoremodules $max_subtabs = $current_user->getPreference('max_subtabs'); if (!isset($max_subtabs) || $max_subtabs <= 0) { $max_subtabs = $GLOBALS['sugar_config']['default_max_subtabs']; } $subMoreModules = false; $groupTabs = $groupedTabsClass->get_tab_structure(get_val_array($modules)); foreach ($groupTabs as $key => $groupTab) { $count = count($groupTab['modules']); if ($count > $max_subtabs) { for ($i = $max_subtabs - 1; $i < $count; $i++) { if (!isset($groupTabs[$key]['modules'][$i])) { continue; } $subMoreModules[$key]['modules'][$i] = $groupTabs[$key]['modules'][$i]; unset($groupTabs[$key]['modules'][$i]); } } } $ss->assign('groupTabs', $groupTabs); $ss->assign('subMoreModules', $subMoreModules); $ss->assign('moduleNames', $app_list_strings['moduleList']); $ss->assign('defaultFirst', !in_array($moduleTab, $modules)); $ss->assign('parentTab', !empty($_REQUEST['parentTab']) ? $_REQUEST['parentTab'] : false); $ss->assign('USE_GROUP_TABS', true); } else { $moduleExtraMenu = array(); $i = 1; foreach (query_module_access_list($current_user) as $module) { // Bug 25948 - Check for the module being in the moduleList if (isset($app_list_strings['moduleList'][$module])) { if ($i < $max_tabs) { $moduleTopMenu[$module] = $app_list_strings['moduleList'][$module]; } else { $moduleExtraMenu[$module] = $app_list_strings['moduleList'][$module]; } ++$i; } } $iFrame = new iFrame(); $frames = $iFrame->lookup_frames('tab'); foreach ($frames as $key => $values) { if ($i < $max_tabs) { $moduleTopMenu[$key] = $values; } else { $moduleExtraMenu[$key] = $values; } ++$i; } // Now, we'll push the current module into the end of top menu list if it's not // already there. In addition, we'll preserve this last entry for this session // until a new value is added there. if (isset($moduleTopMenu[$moduleTab])) { if (isset($_SESSION['moreTab']) && isset($app_list_strings['moduleList'][$_SESSION['moreTab']])) { $moduleTopMenu[$_SESSION['moreTab']] = $app_list_strings['moduleList'][$_SESSION['moreTab']]; unset($moduleExtraMenu[$_SESSION['moreTab']]); } else { $moduleTopMenu += array_slice($moduleExtraMenu, 0, 1); array_shift($moduleExtraMenu); } } elseif (isset($moduleExtraMenu[$moduleTab])) { $_SESSION['moreTab'] = $moduleTab; $moduleTopMenu[$_SESSION['moreTab']] = $app_list_strings['moduleList'][$_SESSION['moreTab']]; unset($moduleExtraMenu[$_SESSION['moreTab']]); } elseif (isset($_SESSION['moreTab']) && isset($app_list_strings['moduleList'][$_SESSION['moreTab']])) { $moduleTopMenu[$_SESSION['moreTab']] = $app_list_strings['moduleList'][$_SESSION['moreTab']]; unset($moduleExtraMenu[$_SESSION['moreTab']]); } $ss->assign("moduleTopMenu", $moduleTopMenu); $ss->assign("moduleExtraMenu", $moduleExtraMenu); } } $headerTpl = $themeObject->getTemplate('header.tpl'); if (isset($GLOBALS['sugar_config']['developerMode']) && $GLOBALS['sugar_config']['developerMode']) { $ss->clear_compiled_tpl($headerTpl); } $ss->display($headerTpl); $this->includeClassicFile('modules/Administration/DisplayWarnings.php'); }