/** * Retrieves the requested js language file, building it if it doesn't exist. */ function getJSLanguage() { require_once 'include/language/jsLanguage.php'; global $app_list_strings; if (empty($_REQUEST['lang'])) { echo "No language specified"; return; } $lang = clean_path($_REQUEST['lang']); $languages = get_languages(); if (!preg_match("/^\\w\\w_\\w\\w\$/", $lang) || !isset($languages[$lang])) { if (!preg_match("/^\\w\\w_\\w\\w\$/", $lang)) { echo "did not match regex<br/>"; } else { echo "{$lang} was not in list . <pre>" . print_r($languages, true) . "</pre>"; } echo "Invalid language specified"; return; } if (empty($_REQUEST['module']) || $_REQUEST['module'] === 'app_strings') { $file = sugar_cached('jsLanguage/') . $lang . '.js'; if (!sugar_is_file($file)) { $jsLanguage = new jsLanguage(); $jsLanguage->createAppStringsCache($lang); } } else { $module = clean_path($_REQUEST['module']); $fullModuleList = array_merge($GLOBALS['moduleList'], $GLOBALS['modInvisList']); if (!isset($app_list_strings['moduleList'][$module]) && !in_array($module, $fullModuleList)) { echo "Invalid module specified"; return; } $file = sugar_cached('jsLanguage/') . $module . "/" . $lang . '.js'; if (!sugar_is_file($file)) { jsLanguage::createModuleStringsCache($module, $lang); } } //Setup cache headers header("Content-Type: application/javascript"); header("Cache-Control: max-age=31556940, private"); header("Pragma: "); header("Expires: " . gmdate('D, d M Y H:i:s \\G\\M\\T', time() + 31556940)); readfile($file); }
/** * Called from process(). This method will display the correct javascript. */ protected function _displayJavascript() { global $locale, $sugar_config, $timedate; if ($this->_getOption('show_javascript')) { if (!$this->_getOption('show_header')) { $langHeader = get_language_header(); echo <<<EOHTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html {$langHeader}> <head> EOHTML; } $js_vars = array("sugar_cache_dir" => "cache/"); if (isset($this->bean->module_dir)) { $js_vars['module_sugar_grp1'] = $this->bean->module_dir; } if (isset($_REQUEST['action'])) { $js_vars['action_sugar_grp1'] = $_REQUEST['action']; } echo '<script>jscal_today = 1000*' . $timedate->asUserTs($timedate->getNow()) . '; if(typeof app_strings == "undefined") app_strings = new Array();</script>'; if (!is_file(sugar_cached("include/javascript/sugar_grp1.js")) || !is_file(sugar_cached("include/javascript/sugar_grp1_yui.js")) || !is_file(sugar_cached("include/javascript/sugar_grp1_jquery.js"))) { $_REQUEST['root_directory'] = "."; require_once "jssource/minify_utils.php"; ConcatenateFiles("."); } echo getVersionedScript('cache/include/javascript/sugar_grp1_jquery.js'); echo getVersionedScript('cache/include/javascript/sugar_grp1_yui.js'); echo getVersionedScript('cache/include/javascript/sugar_grp1.js'); echo getVersionedScript('include/javascript/calendar.js'); // output necessary config js in the top of the page $config_js = $this->getSugarConfigJS(); if (!empty($config_js)) { echo "<script>\n" . implode("\n", $config_js) . "</script>\n"; } if (isset($sugar_config['email_sugarclient_listviewmaxselect'])) { echo "<script>SUGAR.config.email_sugarclient_listviewmaxselect = {$GLOBALS['sugar_config']['email_sugarclient_listviewmaxselect']};</script>"; } $image_server = defined('TEMPLATE_URL') ? TEMPLATE_URL . '/' : ''; echo '<script type="text/javascript">SUGAR.themes.image_server="' . $image_server . '";</script>'; // cn: bug 12274 - create session-stored key to defend against CSRF echo '<script type="text/javascript">var name_format = "' . $locale->getLocaleFormatMacro() . '";</script>'; echo self::getJavascriptValidation(); if (!is_file(sugar_cached('jsLanguage/') . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createAppStringsCache($GLOBALS['current_language']); } echo getVersionedScript('cache/jsLanguage/' . $GLOBALS['current_language'] . '.js', $GLOBALS['sugar_config']['js_lang_version']); echo $this->_getModLanguageJS(); if (isset($sugar_config['disc_client']) && $sugar_config['disc_client']) { echo getVersionedScript('modules/Sync/headersync.js'); } //echo out the $js_vars variables as javascript variables echo "<script type='text/javascript'>\n"; foreach ($js_vars as $var => $value) { echo "var {$var} = '{$value}';\n"; } echo "</script>\n"; } }
if (!empty($focus->assigned_user_name)) { $xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name); } $xtpl->assign("assign_user_select", SugarThemeRegistry::current()->getImage('id-ff-select')); $xtpl->assign("assign_user_clear", SugarThemeRegistry::current()->getImage('id-ff-clear')); //Assign qsd script require_once 'include/QuickSearchDefaults.php'; $qsd = new QuickSearchDefaults(); $sqs_objects = array('EditView_assigned_user_name' => $qsd->getQSUser()); $quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '; enableQS();</script>'; $xtpl->assign("CANCEL_SCRIPT", $cancel_script); $xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']); $xtpl->assign("JAVASCRIPT", get_set_focus_js() . $quicksearch_js); if (!is_file($GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createAppStringsCache($GLOBALS['current_language']); } $jsLang = '<script type="text/javascript" src="' . $GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $GLOBALS['current_language'] . '.js?s=' . $GLOBALS['sugar_version'] . '&c=' . $GLOBALS['sugar_config']['js_custom_version'] . '&j=' . $GLOBALS['sugar_config']['js_lang_version'] . '"></script>'; $xtpl->assign("JSLANG", $jsLang); $xtpl->assign("ID", $focus->id); if (isset($focus->name)) { $xtpl->assign("NAME", $focus->name); } else { $xtpl->assign("NAME", ""); } if (isset($focus->description)) { $xtpl->assign("DESCRIPTION", $focus->description); } else { $xtpl->assign("DESCRIPTION", ""); } if (isset($focus->subject)) {
/** * Called from process(). This method will display the correct javascript. */ protected function _displayJavascript() { global $locale, $sugar_config, $timedate; if ($this->_getOption('show_javascript')) { if (!$this->_getOption('show_header')) { echo <<<EOHTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> EOHTML; } echo "<script>var sugar_cache_dir = '{$GLOBALS['sugar_config']['cache_dir']}';</script>"; echo "<script>var sugar_upload_dir = '{$GLOBALS['sugar_config']['upload_dir']}';</script>"; if (isset($this->bean->module_dir)) { echo "<script>var module_sugar_grp1 = '{$this->bean->module_dir}';</script>"; } if (isset($_REQUEST['action'])) { echo "<script>var action_sugar_grp1 = '{$_REQUEST['action']}';</script>"; } echo '<script>jscal_today = ' . 1000 * $timedate->asUserTs($timedate->getNow()) . '; if(typeof app_strings == "undefined") app_strings = new Array();</script>'; if (!is_file("include/javascript/sugar_grp1.js") || !is_file("include/javascript/sugar_grp1_yui.js")) { $_REQUEST['root_directory'] = "."; require_once "jssource/minify_utils.php"; ConcatenateFiles("."); } echo '<script type="text/javascript" src="' . getJSPath('include/javascript/sugar_grp1_yui.js') . '"></script>'; echo '<script type="text/javascript" src="' . getJSPath('include/javascript/sugar_grp1.js') . '"></script>'; echo '<script type="text/javascript" src="' . getJSPath('include/javascript/calendar.js') . '"></script>'; if (isset($sugar_config['quicksearch_querydelay'])) { echo "<script>SUGAR.config.quicksearch_querydelay = {$GLOBALS['sugar_config']['quicksearch_querydelay']};</script>"; } // cn: bug 12274 - prepare secret guid for asynchronous calls if (!isset($_SESSION['asynchronous_key']) || empty($_SESSION['asynchronous_key'])) { $_SESSION['asynchronous_key'] = create_guid(); } $image_server = defined('TEMPLATE_URL') ? TEMPLATE_URL . '/' : ''; echo '<script type="text/javascript">var asynchronous_key = "' . $_SESSION['asynchronous_key'] . '";SUGAR.themes.image_server="' . $image_server . '";</script>'; // cn: bug 12274 - create session-stored key to defend against CSRF echo '<script type="text/javascript"> var name_format = "' . $locale->getLocaleFormatMacro() . '";</script>'; echo self::getJavascriptValidation(); if (!is_file($GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createAppStringsCache($GLOBALS['current_language']); } echo '<script type="text/javascript" src="' . $GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $GLOBALS['current_language'] . '.js?s=' . $GLOBALS['js_version_key'] . '&c=' . $GLOBALS['sugar_config']['js_custom_version'] . '&j=' . $GLOBALS['sugar_config']['js_lang_version'] . '"></script>'; if (!is_file($GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $this->module . '/' . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache($this->module, $GLOBALS['current_language']); } echo '<script type="text/javascript" src="' . $GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $this->module . '/' . $GLOBALS['current_language'] . '.js?s=' . $GLOBALS['js_version_key'] . '&c=' . $GLOBALS['sugar_config']['js_custom_version'] . '&j=' . $GLOBALS['sugar_config']['js_lang_version'] . '"></script>'; if (isset($sugar_config['disc_client']) && $sugar_config['disc_client']) { echo '<script type="text/javascript" src="' . getJSPath('modules/Sync/headersync.js') . '"></script>'; } echo '<script src="' . getJSPath('include/javascript/yui3/build/yui/yui-min.js') . '" type="text/javascript"></script>'; } if (isset($_REQUEST['popup']) && !empty($_REQUEST['popup'])) { // cn: bug 12274 - add security metadata envelope for async calls in popups echo '<script type="text/javascript">var asynchronous_key = "' . $_SESSION['asynchronous_key'] . '";</script>'; // cn: bug 12274 - create session-stored key to defend against CSRF } }
function display($end = true) { global $app_strings; if (!is_file(sugar_cached("jsLanguage/{$GLOBALS['current_language']}.js"))) { require_once 'include/language/jsLanguage.php'; jsLanguage::createAppStringsCache($GLOBALS['current_language']); } $jsLang = getVersionedScript("cache/jsLanguage/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']); $this->th->ss->assign('data', $this->data['data']); $this->data['pageData']['offsets']['lastOffsetOnPage'] = $this->data['pageData']['offsets']['current'] + count($this->data['data']); $this->th->ss->assign('pageData', $this->data['pageData']); $navStrings = array('next' => $GLOBALS['app_strings']['LNK_LIST_NEXT'], 'previous' => $GLOBALS['app_strings']['LNK_LIST_PREVIOUS'], 'end' => $GLOBALS['app_strings']['LNK_LIST_END'], 'start' => $GLOBALS['app_strings']['LNK_LIST_START'], 'of' => $GLOBALS['app_strings']['LBL_LIST_OF']); $this->th->ss->assign('navStrings', $navStrings); $associated_row_data = array(); //C.L. - Bug 44324 - Override the NAME entry to not display salutation so that the data returned from the popup can be searched on correctly $searchNameOverride = !empty($this->seed) && $this->seed instanceof Person && (isset($this->data['data'][0]['FIRST_NAME']) && isset($this->data['data'][0]['LAST_NAME'])) ? true : false; global $locale; foreach ($this->data['data'] as $val) { $associated_row_data[$val['ID']] = $val; if ($searchNameOverride) { $associated_row_data[$val['ID']]['NAME'] = $locale->getLocaleFormattedName($val['FIRST_NAME'], $val['LAST_NAME']); } } $is_show_fullname = showFullName() ? 1 : 0; $json = getJSONobj(); $this->th->ss->assign('jsLang', $jsLang); $this->th->ss->assign('lang', substr($GLOBALS['current_language'], 0, 2)); $this->th->ss->assign('headerTpl', $this->headerTpl); $this->th->ss->assign('footerTpl', $this->footerTpl); $this->th->ss->assign('ASSOCIATED_JAVASCRIPT_DATA', 'var associated_javascript_data = ' . $json->encode($associated_row_data) . '; var is_show_fullname = ' . $is_show_fullname . ';'); $this->th->ss->assign('module', $this->seed->module_dir); $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; $this->th->ss->assign('request_data', $request_data); $this->th->ss->assign('fields', $this->fieldDefs); $this->th->ss->assign('formData', $this->formData); $this->th->ss->assign('APP', $GLOBALS['app_strings']); $this->th->ss->assign('MOD', $GLOBALS['mod_strings']); if (isset($this->_popupMeta['create']['createButton'])) { $this->_popupMeta['create']['createButton'] = translate($this->_popupMeta['create']['createButton']); } $this->th->ss->assign('popupMeta', $this->_popupMeta); $this->th->ss->assign('current_query', base64_encode(serialize($_REQUEST))); $this->th->ss->assign('customFields', $this->customFieldDefs); $this->th->ss->assign('numCols', NUM_COLS); $this->th->ss->assign('massUpdateData', $this->massUpdateData); $this->th->ss->assign('sugarVersion', $GLOBALS['sugar_version']); $this->th->ss->assign('should_process', $this->should_process); if ($this->_create) { $this->th->ss->assign('ADDFORM', $this->getQuickCreate()); //$this->_getAddForm()); $this->th->ss->assign('ADDFORMHEADER', $this->_getAddFormHeader()); $this->th->ss->assign('object_name', $this->seed->object_name); } $this->th->ss->assign('LIST_HEADER', get_form_header($GLOBALS['mod_strings']['LBL_LIST_FORM_TITLE'], '', false)); $this->th->ss->assign('SEARCH_FORM_HEADER', get_form_header($GLOBALS['mod_strings']['LBL_SEARCH_FORM_TITLE'], '', false)); $str = $this->th->displayTemplate($this->seed->module_dir, $this->view, $this->tpl); return $str; }
function display($end = true) { global $app_strings; if (!is_file($GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createAppStringsCache($GLOBALS['current_language']); } $jsLang = '<script type="text/javascript" src="' . $GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $GLOBALS['current_language'] . '.js?s=' . $GLOBALS['sugar_version'] . '&c=' . $GLOBALS['sugar_config']['js_custom_version'] . '&j=' . $GLOBALS['sugar_config']['js_lang_version'] . '"></script>'; $this->th->ss->assign('data', $this->data['data']); $this->data['pageData']['offsets']['lastOffsetOnPage'] = $this->data['pageData']['offsets']['current'] + count($this->data['data']); $this->th->ss->assign('pageData', $this->data['pageData']); $navStrings = array('next' => $GLOBALS['app_strings']['LNK_LIST_NEXT'], 'previous' => $GLOBALS['app_strings']['LNK_LIST_PREVIOUS'], 'end' => $GLOBALS['app_strings']['LNK_LIST_END'], 'start' => $GLOBALS['app_strings']['LNK_LIST_START'], 'of' => $GLOBALS['app_strings']['LBL_LIST_OF']); $this->th->ss->assign('navStrings', $navStrings); $associated_row_data = array(); foreach ($this->data['data'] as $val) { $associated_row_data[$val['ID']] = $val; } $is_show_fullname = showFullName() ? 1 : 0; $json = getJSONobj(); $this->th->ss->assign('jsLang', $jsLang); $this->th->ss->assign('lang', substr($GLOBALS['current_language'], 0, 2)); $this->th->ss->assign('headerTpl', 'include/Popups/tpls/header.tpl'); $this->th->ss->assign('footerTpl', 'include/Popups/tpls/footer.tpl'); $this->th->ss->assign('ASSOCIATED_JAVASCRIPT_DATA', 'var associated_javascript_data = ' . $json->encode($associated_row_data) . '; var is_show_fullname = ' . $is_show_fullname . ';'); $this->th->ss->assign('module', $this->seed->module_dir); $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; $this->th->ss->assign('request_data', $request_data); $this->th->ss->assign('fields', $this->fieldDefs); $this->th->ss->assign('formData', $this->formData); $this->th->ss->assign('APP', $GLOBALS['app_strings']); $this->th->ss->assign('MOD', $GLOBALS['mod_strings']); $this->th->ss->assign('popupMeta', $this->_popupMeta); $this->th->ss->assign('current_query', base64_encode(serialize($_REQUEST))); $this->th->ss->assign('customFields', $this->customFieldDefs); $this->th->ss->assign('numCols', NUM_COLS); $this->th->ss->assign('massUpdateData', $this->massUpdateData); $this->th->ss->assign('jsCustomVersion', $GLOBALS['sugar_config']['js_custom_version']); $this->th->ss->assign('sugarVersion', $GLOBALS['sugar_version']); $this->th->ss->assign('should_process', $this->should_process); if ($this->_create) { $this->th->ss->assign('ADDFORM', $this->getQuickCreate()); //$this->_getAddForm()); $this->th->ss->assign('ADDFORMHEADER', $this->_getAddFormHeader()); $this->th->ss->assign('object_name', $this->seed->object_name); } $this->th->ss->assign('LIST_HEADER', get_form_header($GLOBALS['mod_strings']['LBL_LIST_FORM_TITLE'], '', false)); $this->th->ss->assign('SEARCH_FORM_HEADER', get_form_header($GLOBALS['mod_strings']['LBL_SEARCH_FORM_TITLE'], '', false)); $str = $this->th->displayTemplate($this->seed->module_dir, $this->view, $this->tpl); return $str; }
echo '<script type="text/javascript" src="jscalendar/lang/calendar-en.js?s=' . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . '"></script>'; echo '<script type="text/javascript" src="jscalendar/calendar-setup_3.js?s=' . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . '"></script>'; echo '<script src="include/javascript/yui/YAHOO.js?s=' . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . '"></script>'; echo '<script src="include/javascript/yui/log.js?s=' . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . '"></script>'; echo '<script src="include/javascript/yui/dom.js?s=' . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . '"></script>'; echo '<script src="include/javascript/yui/event.js?s=' . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . '"></script>'; echo '<script src="include/javascript/yui/animation.js?s=' . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . '"></script>'; echo '<script src="include/javascript/yui/connection.js?s=' . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . '"></script>'; echo '<script src="include/javascript/yui/dragdrop.js?s=' . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . '"></script>'; echo '<script src="include/javascript/yui/ygDDList.js?s=' . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . '"></script>'; echo '<script type="text/javascript" src="include/javascript/sugar_3.js?s=' . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . '"></script>'; echo $timedate->get_javascript_validation(); $jsalerts = new jsAlerts(); if (!is_file($sugar_config['cache_dir'] . 'jsLanguage/' . $current_language . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createAppStringsCache($current_language); } echo '<script type="text/javascript" src="' . $sugar_config['cache_dir'] . 'jsLanguage/' . $current_language . '.js?s=' . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . '&j=' . $sugar_config['js_lang_version'] . '"></script>'; if (!is_file($sugar_config['cache_dir'] . 'jsLanguage/' . $currentModule . '/' . $current_language . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache($currentModule, $current_language); } echo '<script type="text/javascript" src="' . $sugar_config['cache_dir'] . 'jsLanguage/' . $currentModule . '/' . $current_language . '.js?s=' . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . '&j=' . $sugar_config['js_lang_version'] . '"></script>'; } // Set module shortcuts menu to an empty array, in case // we don't have access to the module if (!isset($module_menu)) { $module_menu = array(); } //skip headers for popups, deleting, saving, importing and other actions if (!$skipHeaders) {
/** * Main display function. * * @return void */ protected function display() { global $app_list_strings, $mod_strings, $locale; require_once 'modules/Studio/parsers/StudioParser.php'; $dh = new DropDownHelper(); $smarty = new Sugar_Smarty(); $smarty->assign('MOD', $GLOBALS['mod_strings']); $title = getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array("<a href='index.php?module=Administration&action=index'>" . $mod_strings['LBL_MODULE_NAME'] . "</a>", $mod_strings['LBL_RENAME_TABS']), false); $smarty->assign('title', $title); if (!empty($_REQUEST['dropdown_lang'])) { $selected_lang = $_REQUEST['dropdown_lang']; } else { $selected_lang = $locale->getAuthenticatedUserLanguage(); } if ($selected_lang == $GLOBALS['current_language']) { $my_list_strings = $GLOBALS['app_list_strings']; } else { $my_list_strings = return_app_list_strings_language($selected_lang); } $selected_dropdown = $my_list_strings['moduleList']; $selected_dropdown_singular = $my_list_strings['moduleListSingular']; foreach ($selected_dropdown as $key => $value) { $singularValue = isset($selected_dropdown_singular[$key]) ? $selected_dropdown_singular[$key] : $value; if ($selected_lang != $_SESSION['authenticated_user_language'] && !empty($app_list_strings['moduleList']) && isset($app_list_strings['moduleList'][$key])) { $selected_dropdown[$key] = array('lang' => $value, 'user_lang' => '[' . $app_list_strings['moduleList'][$key] . ']', 'singular' => $singularValue, 'module' => 'module-' . mb_strtolower($key)); } else { $selected_dropdown[$key] = array('lang' => $value, 'singular' => $singularValue, 'module' => 'module-' . mb_strtolower($key)); } } $selected_dropdown = $dh->filterDropDown('moduleList', $selected_dropdown); $smarty->assign('dropdown', $selected_dropdown); $smarty->assign('dropdown_languages', get_languages()); $buttons = array(); $buttons[] = array('text' => $mod_strings['LBL_BTN_UNDO'], 'actionScript' => "onclick='jstransaction.undo()'"); $buttons[] = array('text' => $mod_strings['LBL_BTN_REDO'], 'actionScript' => "onclick='jstransaction.redo()'"); $buttons[] = array('text' => $mod_strings['LBL_BTN_SAVE'], 'actionScript' => "onclick='if(check_form(\"editdropdown\")){document.editdropdown.submit();}'"); $buttonTxt = StudioParser::buildImageButtons($buttons); $smarty->assign('buttons', $buttonTxt); $smarty->assign('dropdown_lang', $selected_lang); $editImage = SugarThemeRegistry::current()->getImage('edit_inline', ''); $smarty->assign('editImage', $editImage); $deleteImage = SugarThemeRegistry::current()->getImage('delete_inline', ''); $smarty->assign('deleteImage', $deleteImage); $smarty->display("modules/Studio/wizards/RenameModules.tpl"); if (!is_file(sugar_cached('jsLanguage/') . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createAppStringsCache($GLOBALS['current_language']); } if (!is_file(sugar_cached('jsLanguage/') . 'Studio' . '/' . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache('Studio', $GLOBALS['current_language']); } }
/** * Called from process(). This method will display the correct javascript. */ protected function _displayJavascript() { global $locale, $sugar_config, $timedate; if ($this->_getOption('show_javascript')) { if (!$this->_getOption('show_header')) { $langHeader = get_language_header(); echo <<<EOHTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html {$langHeader}> <head> EOHTML; } $js_vars = array("sugar_cache_dir" => "cache/"); if (isset($this->bean->module_dir)) { $js_vars['module_sugar_grp1'] = $this->bean->module_dir; } if (isset($_REQUEST['action'])) { $js_vars['action_sugar_grp1'] = $_REQUEST['action']; } echo '<script>jscal_today = 1000*' . $timedate->asUserTs($timedate->getNow()) . '; if(typeof app_strings == "undefined") app_strings = new Array();</script>'; // Make sure the necessary cache files are in place $jsFiles = array("sugar_grp1.js", "sugar_grp1_yui.js", "sugar_grp1_jquery.js"); ensureJSCacheFilesExist($jsFiles); echo getVersionedScript('cache/include/javascript/sugar_grp1_jquery.js'); echo getVersionedScript('cache/include/javascript/sugar_grp1_yui.js'); echo getVersionedScript('cache/include/javascript/sugar_grp1.js'); $version_mark = getVersionedPath(null); echo '<script>SUGAR = SUGAR || {}; SUGAR.VERSION_MARK = ' . json_encode($version_mark) . ';</script>'; // output necessary config js in the top of the page $config_js = $this->getSugarConfigJS(); if (!empty($config_js)) { echo "<script>\n" . implode("\n", $config_js) . "</script>\n"; } // CSRF form token echo $this->getCsrfFormTokenJscript(); if (isset($sugar_config['email_sugarclient_listviewmaxselect'])) { echo "<script>SUGAR.config.email_sugarclient_listviewmaxselect = {$GLOBALS['sugar_config']['email_sugarclient_listviewmaxselect']};</script>"; } $image_server = defined('TEMPLATE_URL') ? TEMPLATE_URL . '/' : ''; echo '<script type="text/javascript">SUGAR.themes.image_server="' . $image_server . '";</script>'; // cn: bug 12274 - create session-stored key to defend against CSRF echo '<script type="text/javascript">var name_format = "' . $locale->getLocaleFormatMacro() . '";</script>'; echo self::getJavascriptValidation(); if (!is_file(sugar_cached('jsLanguage/') . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createAppStringsCache($GLOBALS['current_language']); } echo getVersionedScript('cache/jsLanguage/' . $GLOBALS['current_language'] . '.js', $GLOBALS['sugar_config']['js_lang_version']); echo $this->_getModLanguageJS(); echo getVersionedScript('include/javascript/productTour.js'); if (isset($sugar_config['disc_client']) && $sugar_config['disc_client']) { echo getVersionedScript('modules/Sync/headersync.js'); } if (!is_file(sugar_cached("Expressions/functions_cache.js"))) { $GLOBALS['updateSilent'] = true; include "include/Expressions/updatecache.php"; } if (inDeveloperMode()) { echo getVersionedScript('cache/Expressions/functions_cache_debug.js'); } else { echo getVersionedScript('cache/Expressions/functions_cache.js'); } require_once "include/Expressions/DependencyManager.php"; echo "\n" . '<script type="text/javascript">' . DependencyManager::getJSUserVariables($GLOBALS['current_user']) . "</script>\n"; //echo out the $js_vars variables as javascript variables echo "<script type='text/javascript'>\n"; foreach ($js_vars as $var => $value) { echo "var {$var} = '{$value}';\n"; } echo "</script>\n"; } }
/** * Called from process(). This method will display the correct javascript. */ function displayJavascript() { global $locale; //echo out the headers to enable caching if ($this->_getOption('show_header')) { echo "<html><head>"; } if ($this->_getOption('show_javascript')) { echo "<script>var sugar_cache_dir = '{$GLOBALS['sugar_config']['cache_dir']}';</script>"; echo "<script>var sugar_upload_dir = '{$GLOBALS['sugar_config']['upload_dir']}';</script>"; if (isset($this->bean->module_dir)) { echo "<script>var module_sugar_grp1 = '{$this->bean->module_dir}';</script>"; } if (isset($_REQUEST['action'])) { echo "<script>var action_sugar_grp1 = '{$_REQUEST['action']}';</script>"; } echo '<script>jscal_today = ' . 1000 * strtotime($GLOBALS['timedate']->handle_offset(gmdate($GLOBALS['timedate']->get_db_date_time_format()), $GLOBALS['timedate']->get_db_date_time_format())) . '; if(typeof app_strings == "undefined") app_strings = new Array();</script>'; echo '<script type="text/javascript" src="' . getJSPath('include/javascript/sugar_grp1_yui.js') . '"></script>'; echo '<script type="text/javascript" src="' . getJSPath('include/javascript/sugar_grp1.js') . '"></script>'; echo '<script type="text/javascript" src="' . getJSPath('jscalendar/lang/calendar-' . substr($GLOBALS['current_language'], 0, 2) . '.js') . '"></script>'; // cn: bug 12274 - prepare secret guid for asynchronous calls if (!isset($_SESSION['asynchronous_key']) || empty($_SESSION['asynchronous_key'])) { $_SESSION['asynchronous_key'] = create_guid(); } $image_server = defined('TEMPLATE_URL') ? TEMPLATE_URL . '/' : ''; echo '<script type="text/javascript">var asynchronous_key = "' . $_SESSION['asynchronous_key'] . '";SUGAR.themes.image_server="' . $image_server . '";</script>'; // cn: bug 12274 - create session-stored key to defend against CSRF echo '<script type="text/javascript"> var name_format = "' . $locale->getLocaleFormatMacro() . '";</script>'; echo $GLOBALS['timedate']->get_javascript_validation(); if (!is_file($GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createAppStringsCache($GLOBALS['current_language']); } echo '<script type="text/javascript" src="' . $GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $GLOBALS['current_language'] . '.js?s=' . $GLOBALS['js_version_key'] . '&c=' . $GLOBALS['sugar_config']['js_custom_version'] . '&j=' . $GLOBALS['sugar_config']['js_lang_version'] . '"></script>'; if (!is_file($GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $this->module . '/' . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache($this->module, $GLOBALS['current_language']); } echo '<script type="text/javascript" src="' . $GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $this->module . '/' . $GLOBALS['current_language'] . '.js?s=' . $GLOBALS['js_version_key'] . '&c=' . $GLOBALS['sugar_config']['js_custom_version'] . '&j=' . $GLOBALS['sugar_config']['js_lang_version'] . '"></script>'; } if (isset($_REQUEST['popup']) && !empty($_REQUEST['popup'])) { // cn: bug 12274 - add security metadata envelope for async calls in popups echo '<script type="text/javascript">var asynchronous_key = "' . $_SESSION['asynchronous_key'] . '";</script>'; // cn: bug 12274 - create session-stored key to defend against CSRF } }