public function preDisplay() { global $app_list_strings; echo "<style type='text/css'>"; //readfile('modules/AOR_Reports/css/edit.css'); readfile('modules/AOR_Reports/js/jqtree/jqtree.css'); echo "</style>"; if (!is_file('cache/jsLanguage/AOR_Fields/' . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache('AOR_Fields', $GLOBALS['current_language']); } echo '<script src="cache/jsLanguage/AOR_Fields/' . $GLOBALS['current_language'] . '.js"></script>'; if (!is_file('cache/jsLanguage/AOR_Conditions/' . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache('AOR_Conditions', $GLOBALS['current_language']); } echo '<script src="cache/jsLanguage/AOR_Conditions/' . $GLOBALS['current_language'] . '.js"></script>'; echo '<script src="include/javascript/yui3/build/yui/yui-min.js"></script>'; echo "<script>"; echo "sort_by_values = \"" . trim(preg_replace('/\\s+/', ' ', get_select_options_with_id($app_list_strings['aor_sort_operator'], ''))) . "\";"; echo "total_values = \"" . trim(preg_replace('/\\s+/', ' ', get_select_options_with_id($app_list_strings['aor_total_options'], ''))) . "\";"; echo "format_values = \"" . trim(preg_replace('/\\s+/', ' ', get_select_options_with_id($app_list_strings['aor_format_options'], ''))) . "\";"; echo "</script>"; $fields = $this->getFieldLines(); echo "<script>var fieldLines = " . json_encode($fields) . "</script>"; $conditions = $this->getConditionLines(); echo "<script>var conditionLines = " . json_encode($conditions) . "</script>"; $charts = $this->getChartLines(); echo "<script>var chartLines = " . json_encode($charts) . ";</script>"; parent::preDisplay(); }
/** * 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); }
/** * Advanced OpenReports, SugarCRM Reporting. * @package Advanced OpenReports for SugarCRM * @copyright SalesAgility Ltd http://www.salesagility.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with this program; if not, see http://www.gnu.org/licenses * or write to the Free Software Foundation,Inc., 51 Franklin Street, * Fifth Floor, Boston, MA 02110-1301 USA * * @author SalesAgility <*****@*****.**> */ function display_field_lines($focus, $field, $value, $view) { global $mod_strings, $app_list_strings; $html = ''; if (!is_file('cache/jsLanguage/AOR_Fields/' . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache('AOR_Fields', $GLOBALS['current_language']); } $html .= '<script src="include/javascript/yui3/build/yui/yui-min.js"></script>'; $html .= '<script src="cache/jsLanguage/AOR_Fields/' . $GLOBALS['current_language'] . '.js"></script>'; if ($view == 'EditView') { $html .= '<script src="modules/AOR_Fields/fieldLines.js"></script>'; $html .= '<script></script>'; $html .= "<table border='0' cellspacing='4' width='100%' id='fieldLines'></table>"; $html .= "<div style='padding-top: 10px; padding-bottom:10px;'>"; $html .= "<input type=\"button\" tabindex=\"116\" class=\"button\" value=\"" . $mod_strings['LBL_ADD_FIELD'] . "\" id=\"btn_FieldLine\" onclick=\"insertFieldLine()\" disabled/>"; $html .= "</div>"; $html .= "<script>"; $html .= "sort_by_values = \"" . trim(preg_replace('/\\s+/', ' ', get_select_options_with_id($app_list_strings['aor_sort_operator'], ''))) . "\";"; $html .= "</script>"; if (isset($focus->report_module) && $focus->report_module != '') { require_once "modules/AOW_WorkFlow/aow_utils.php"; $html .= "<script>"; $html .= "report_rel_modules = \"" . trim(preg_replace('/\\s+/', ' ', getModuleRelationships($focus->report_module))) . "\";"; $html .= "report_module = \"" . $focus->report_module . "\";"; $html .= "document.getElementById('btn_FieldLine').disabled = '';"; if ($focus->id != '') { $sql = "SELECT id FROM aor_fields WHERE aor_report_id = '" . $focus->id . "' AND deleted = 0 ORDER BY field_order ASC"; $result = $focus->db->query($sql); while ($row = $focus->db->fetchByAssoc($result)) { $field_name = new AOR_Field(); $field_name->retrieve($row['id']); $field_name->module_path = unserialize(base64_decode($field_name->module_path)); $html .= "report_fields = \"" . trim(preg_replace('/\\s+/', ' ', getModuleFields(getRelatedModule($focus->report_module, $field_name->module_path[0])))) . "\";"; $field_item = json_encode($field_name->toArray()); $html .= "loadFieldLine(" . $field_item . ");"; } } $html .= "report_fields = \"" . trim(preg_replace('/\\s+/', ' ', getModuleFields($focus->report_module))) . "\";"; $html .= "</script>"; } } else { if ($view == 'DetailView') { /*$html .= '<script src="include/SugarCharts/Jit/js/sugarCharts.js"></script>'; $html .= '<script language="javascript" type="text/javascript" src="include/MySugar/javascript/MySugar.js"></script>'; $html .= '<script language="javascript" type="text/javascript" src="include/SugarCharts/Jit/js/Jit/jit.js"></script>'; $html .= '<script language="javascript" type="text/javascript" src="include/SugarCharts/Jit/js/sugarCharts.js"></script>'; $html .= '<script language="javascript" type="text/javascript" src="include/SugarCharts/Jit/js/mySugarCharts.js"></script>';*/ $html .= $focus->build_group_report(0) . '<br />'; } } return $html; }
public function preDisplay() { global $app_list_strings; parent::preDisplay(); $this->ss->assign('report_module', $this->bean->report_module); $this->bean->user_parameters = requestToUserParameters(); $reportHTML = $this->bean->build_group_report(0, true) . '<br />'; $reportHTML .= $this->bean->build_report_chart(null, AOR_Report::CHART_TYPE_CHARTJS); $this->ss->assign('report_content', $reportHTML); echo "<input type='hidden' name='report_module' id='report_module' value='{$this->bean->report_module}'>"; if (!is_file('cache/jsLanguage/AOR_Conditions/' . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache('AOR_Conditions', $GLOBALS['current_language']); } echo '<script src="cache/jsLanguage/AOR_Conditions/' . $GLOBALS['current_language'] . '.js"></script>'; $params = $this->getReportParameters(); echo "<script>var reportParameters = " . json_encode($params) . ";</script>"; }
function process_page() { global $theme; global $mod_strings; global $app_strings; global $currentModule; global $current_language; global $current_module_strings; if (!is_file(sugar_cached('jsLanguage/WorkFlow/') . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache('WorkFlow', $GLOBALS['current_language']); } $javascript_language_files = getVersionedScript("cache/jsLanguage/WorkFlow/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']); $current_module_strings = return_module_language($current_language, 'WorkFlowAlertShells'); $ListView = new ListView(); $header_text = ''; if (isset($_REQUEST['workflow_id'])) { $workflow = BeanFactory::getBean('WorkFlow', $_REQUEST['workflow_id']); //TODO GET ALL ALERTS HERE //$focus_alerts_list = $workflow->get_linked_beans('wf_alerts','WorkFlowAlertShell'); $alerts = BeanFactory::getBean('WorkFlowAlertShells'); $current_module_strings = return_module_language($current_language, $alerts->module_dir); insert_popup_header($theme); $ListView->initNewXTemplate('modules/WorkFlowAlertShells/Popup_picker.html', $current_module_strings); $ListView->xTemplateAssign("WORKFLOW_ID", $workflow->id); $ListView->xTemplateAssign("JAVASCRIPT_LANGUAGE_FILES", $javascript_language_files); $ListView->xTemplateAssign("RETURN_URL", "&return_module=" . $currentModule . "&return_action=DetailView&return_id={$workflow->id}"); $ListView->xTemplateAssign("EDIT_INLINE_PNG", SugarThemeRegistry::current()->getImage('edit_inline', 'align="absmiddle" border="0"', null, null, '.gif', $app_strings['LNK_EDIT'])); $ListView->xTemplateAssign("DELETE_INLINE_PNG", SugarThemeRegistry::current()->getImage('delete_inline', 'align="absmiddle" border="0"', null, null, '.gif', $app_strings['LNK_REMOVE'])); $ListView->setHeaderTitle($current_module_strings['LBL_MODULE_NAME_COMBO'] . $header_text); //$ListView->setHeaderText($button); //$ListView->setQuery("workflow_alertshells.alert_type = 'Email'","","", "ALERT"); $list = $alerts->get_list("", "workflow_alertshells.alert_type = 'Email'"); $display_list = $this->cullFromList($list['list'], $workflow->base_module, $workflow->type); $ListView->processListViewTwo($display_list, "main", "ALERT"); insert_popup_footer(); } }
protected function _getModLanguageJS() { if (!is_file(sugar_cached('jsLanguage/') . $this->module . '/' . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache($this->module, $GLOBALS['current_language']); } return getVersionedScript("cache/jsLanguage/{$this->module}/" . $GLOBALS['current_language'] . '.js', $GLOBALS['sugar_config']['js_lang_version']); }
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; }
/** * Renders the QuickCreate form from Smarty and returns HTML * @param array $vars request variable global * @param object $email Fetched email object * @param bool $addToAddressBook * @return array */ function getQuickCreateForm($vars, $email, $addToAddressBookButton = false) { require_once "include/EditView/EditView2.php"; global $app_strings; global $mod_strings; global $current_user; global $beanList; global $beanFiles; global $current_language; //Setup the current module languge $mod_strings = return_module_language($current_language, $_REQUEST['qc_module']); $bean = $beanList[$_REQUEST['qc_module']]; $class = $beanFiles[$bean]; require_once $class; $focus = new $bean(); $people = array('Contact', 'Lead'); $emailAddress = array(); // people if (in_array($bean, $people)) { // lead specific $focus->lead_source = 'Email'; $focus->lead_source_description = trim($email->name); $from = isset($email->from_name) && !empty($email->from_name) ? $email->from_name : $email->from_addr; if (isset($_REQUEST['sugarEmail']) && !empty($_REQUEST['sugarEmail'])) { if ($email->status == "sent") { $from = isset($email->to_addrs_names) && !empty($email->to_addrs_names) ? $email->to_addrs_names : $email->to_addrs; } else { $from = isset($email->from_name) && !empty($email->from_name) ? $email->from_name : $email->from_addr_name; } } $name = explode(" ", trim($from)); $address = trim(array_pop($name)); $address = str_replace(array("<", ">", "<", ">"), "", $address); $emailAddress[] = array('email_address' => $address, 'primary_address' => 1, 'invalid_email' => 0, 'opt_out' => 0, 'reply_to_address' => 1); $focus->email1 = $address; if (!empty($name)) { $focus->last_name = trim(array_pop($name)); foreach ($name as $first) { if (!empty($focus->first_name)) { $focus->first_name .= " "; } $focus->first_name .= trim($first); } } } else { // bugs, cases, tasks $focus->name = trim($email->name); } $focus->description = trim(strip_tags($email->description)); $focus->assigned_user_id = $current_user->id; $EditView = new EditView(); $EditView->ss = new Sugar_Smarty(); //MFH BUG#20283 - checks for custom quickcreate fields $EditView->setup($_REQUEST['qc_module'], $focus, 'custom/modules/' . $focus->module_dir . '/metadata/editviewdefs.php', 'include/EditView/EditView.tpl'); $EditView->process(); $EditView->render(); $EditView->defs['templateMeta']['form']['buttons'] = array('email2save' => array('id' => 'e2AjaxSave', 'customCode' => '<input type="button" class="button" value=" ' . $app_strings['LBL_SAVE_BUTTON_LABEL'] . ' " onclick="SUGAR.email2.detailView.saveQuickCreate(false);" />'), 'email2saveandreply' => array('id' => 'e2SaveAndReply', 'customCode' => '<input type="button" class="button" value=" ' . $app_strings['LBL_EMAIL_SAVE_AND_REPLY'] . ' " onclick="SUGAR.email2.detailView.saveQuickCreate(\'reply\');" />'), 'email2cancel' => array('id' => 'e2cancel', 'customCode' => '<input type="button" class="button" value=" ' . $app_strings['LBL_EMAIL_CANCEL'] . ' " onclick="SUGAR.email2.detailView.quickCreateDialog.hide();" />')); if ($addToAddressBookButton) { $EditView->defs['templateMeta']['form']['buttons']['email2saveAddToAddressBook'] = array('id' => 'e2addToAddressBook', 'customCode' => '<input type="button" class="button" value=" ' . $app_strings['LBL_EMAIL_ADDRESS_BOOK_SAVE_AND_ADD'] . ' " onclick="SUGAR.email2.detailView.saveQuickCreate(true);" />'); } //Get the module language for javascript if (!is_file(sugar_cached('jsLanguage/') . $_REQUEST['qc_module'] . '/' . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache($_REQUEST['qc_module'], $GLOBALS['current_language']); } $jsLanguage = getVersionedScript("cache/jsLanguage/{$_REQUEST['qc_module']}/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']); $EditView->view = 'EmailQCView'; $EditView->defs['templateMeta']['form']['headerTpl'] = 'include/EditView/header.tpl'; $EditView->defs['templateMeta']['form']['footerTpl'] = 'include/EditView/footer.tpl'; $meta = array(); $meta['html'] = $jsLanguage . $EditView->display(false, true); $meta['html'] = str_replace("src='" . getVersionedPath('include/SugarEmailAddress/SugarEmailAddress.js') . "'", '', $meta['html']); $meta['emailAddress'] = $emailAddress; $mod_strings = return_module_language($current_language, 'Emails'); return $meta; }
$exp_meta_type = $_REQUEST['exp_meta_type']; //end expression object } else { sugar_die("You need a meta filter name to access this popup"); } $xtpl = new XTemplate('modules/Expressions/Filter_Selector.html'); $xtpl->assign("MOD", $mod_strings); $xtpl->assign("APP", $app_strings); $xtpl->assign("RETURN_PREFIX", $exp_object->return_prefix); $xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']); require_once 'include/language/jsLanguage.php'; if (!is_file(sugar_cached('jsLanguage/') . $GLOBALS['current_language'] . '.js')) { jsLanguage::createAppStringsCache($GLOBALS['current_language']); } if (!is_file(sugar_cached('jsLanguage/') . $exp_object->module_dir . '/' . $GLOBALS['current_language'] . '.js')) { jsLanguage::createModuleStringsCache($exp_object->module_dir, $GLOBALS['current_language']); } $javascript_language_files = getVersionedScript("cache/jsLanguage/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']); $javascript_language_files .= "\n"; $javascript_language_files .= getVersionedScript("cache/jsLanguage/{$exp_object->module_dir}/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']); $xtpl->assign("JAVASCRIPT_LANGUAGE_FILES", $javascript_language_files); insert_popup_header($theme); $xtpl->parse("embeded"); $xtpl->out("embeded"); if (isset($exp_meta_array['select_field']) && $exp_meta_array['select_field'] === true) { $xtpl->assign('SELECT_FIELD', "Yes"); } $xtpl->assign('EXP_META_TYPE', $exp_meta_type); ///Show field selector if required//// $xtpl->assign('PARENT_TYPE', $exp_object->parent_type); $form_name = "FieldView";
/** * 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 } }
public function preDisplay() { global $app_list_strings; parent::preDisplay(); $this->ss->assign('report_module', $this->bean->report_module); $this->bean->user_parameters = requestToUserParameters(); //$reportHTML = $this->bean->build_group_report(0,true); $reportHTML = $this->bean->buildMultiGroupReport(0, true); $chartsHTML = $this->bean->build_report_chart(null, AOR_Report::CHART_TYPE_RGRAPH); $chartsPerRow = $this->bean->graphs_per_row; $this->ss->assign('charts_content', $chartsHTML); $this->ss->assign('report_content', $reportHTML); echo "<input type='hidden' name='report_module' id='report_module' value='{$this->bean->report_module}'>"; if (!is_file('cache/jsLanguage/AOR_Conditions/' . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache('AOR_Conditions', $GLOBALS['current_language']); } echo '<script src="cache/jsLanguage/AOR_Conditions/' . $GLOBALS['current_language'] . '.js"></script>'; $params = $this->getReportParameters(); echo "<script>var reportParameters = " . json_encode($params) . ";</script>"; $resizeGraphsPerRow = <<<EOD <script> function resizeGraphsPerRow() { var maxWidth = 900; var maxHeight = 500; var maxTextSize = 10; var divWidth = \$("#detailpanel_report").width(); var graphWidth = Math.floor(divWidth / {$chartsPerRow}); var graphs = document.getElementsByClassName('resizableCanvas'); for(var i = 0; i < graphs.length; i++) { if(graphWidth * 0.9 > maxWidth) graphs[i].width = maxWidth; else graphs[i].width = graphWidth * 0.9; if(graphWidth * 0.9 > maxHeight) graphs[i].height = maxHeight; else graphs[i].height = graphWidth * 0.9; /* var text_size = Math.min(12, (graphWidth / 1000) * 12 ); if(text_size < 6)text_size=6; if(text_size > maxTextSize) text_size = maxTextSize; if( graphs[i] !== undefined && graphs[i].__object__ !== undefined && graphs[i].__object__["properties"] !== undefined && graphs[i].__object__["properties"]["chart.text.size"] !== undefined && graphs[i].__object__["properties"]["chart.key.text.size"] !== undefined) { graphs[i].__object__["properties"]["chart.text.size"] = text_size; graphs[i].__object__["properties"]["chart.key.text.size"] = text_size; } //http://www.rgraph.net/docs/issues.html //As per Google Chrome not initially drawing charts RGraph.redrawCanvas(graphs[i]); */ } if (typeof RGraph !== 'undefined') { RGraph.redraw(); } } </script> EOD; echo $resizeGraphsPerRow; echo "<script> \$(document).ready(function(){resizeGraphsPerRow();}); </script>"; echo "<script> \$(window).resize(function(){resizeGraphsPerRow();}); </script>"; }
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)) {
/** * Advanced OpenWorkflow, Automating SugarCRM. * @package Advanced OpenWorkflow for SugarCRM * @copyright SalesAgility Ltd http://www.salesagility.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with this program; if not, see http://www.gnu.org/licenses * or write to the Free Software Foundation,Inc., 51 Franklin Street, * Fifth Floor, Boston, MA 02110-1301 USA * * @author SalesAgility <*****@*****.**> */ function display_action_lines(SugarBean $focus, $field, $value, $view) { global $locale, $app_list_strings, $mod_strings; $html = ''; if (!is_file('cache/jsLanguage/AOW_Actions/' . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache('AOW_Actions', $GLOBALS['current_language']); } $html .= '<script src="cache/jsLanguage/AOW_Actions/' . $GLOBALS['current_language'] . '.js"></script>'; if ($view == 'EditView') { $html .= '<script src="modules/AOW_Actions/actionLines.js"></script>'; $aow_actions_list = array(); include_once 'modules/AOW_Actions/actions.php'; $app_list_actions[''] = ''; foreach ($aow_actions_list as $action_value) { $action_name = 'action' . $action_value; if (file_exists('custom/modules/AOW_Actions/actions/' . $action_name . '.php')) { require_once 'custom/modules/AOW_Actions/actions/' . $action_name . '.php'; } else { if (file_exists('modules/AOW_Actions/actions/' . $action_name . '.php')) { require_once 'modules/AOW_Actions/actions/' . $action_name . '.php'; } else { continue; } } $action = new $action_name(); foreach ($action->loadJS() as $js_file) { $html .= '<script src="' . $js_file . '"></script>'; } $app_list_actions[$action_value] = translate('LBL_' . strtoupper($action_value), 'AOW_Actions'); } $html .= '<input type="hidden" name="app_list_actions" id="app_list_actions" value="' . get_select_options_with_id($app_list_actions, '') . '">'; $html .= "<table style='padding-top: 10px; padding-bottom:10px;' id='actionLines'></table>"; $html .= "<div style='padding-top: 10px; padding-bottom:10px;'>"; $html .= "<input type=\"button\" tabindex=\"116\" class=\"button\" value=\"" . $mod_strings['LBL_ADD_ACTION'] . "\" id=\"btn_ActionLine\" onclick=\"insertActionLine()\" disabled/>"; $html .= "</div>"; if (isset($focus->flow_module) && $focus->flow_module != '') { $html .= "<script>document.getElementById('btn_ActionLine').disabled = '';</script>"; if ($focus->id != '') { $sql = "SELECT id FROM aow_actions WHERE aow_workflow_id = '" . $focus->id . "' AND deleted = 0 ORDER BY action_order ASC"; $result = $focus->db->query($sql); while ($row = $focus->db->fetchByAssoc($result)) { $action_name = new AOW_Action(); $action_name->retrieve($row['id']); $action_item = json_encode($action_name->toArray()); $html .= "<script>\n loadActionLine(" . $action_item . ");\n </script>"; } } } } else { if ($view == 'DetailView') { $html .= "<table border='0' width='100%' cellpadding='0' cellspacing='0'>"; $sql = "SELECT id FROM aow_actions WHERE aow_workflow_id = '" . $focus->id . "' AND deleted = 0 ORDER BY action_order ASC"; $result = $focus->db->query($sql); while ($row = $focus->db->fetchByAssoc($result)) { $action_name = new AOW_Action(); $action_name->retrieve($row['id']); $html .= "<tr><td>" . $action_name->action_order . "</td><td>" . $action_name->name . "</td><td>" . translate('LBL_' . strtoupper($action_name->action), 'AOW_Actions') . "</td></tr>"; } $html .= "</table>"; } } return $html; }
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) { $GLOBALS['log']->debug("including headers"); if (!is_file('themes/' . $theme . '/header.php')) { if (is_file('themes/' . $sugar_config['default_theme'] . '/header.php')) { $theme = $sugar_config['default_theme']; } else {
/** * Renders the QuickCreate form from Smarty and returns HTML * @param array $vars request variable global * @param object $email Fetched email object * @param bool $addToAddressBook * @return array */ function getQuickCreateForm($vars, $email, $addToAddressBookButton = false) { require_once "include/EditView/EditView2.php"; global $app_strings; global $mod_strings; global $current_user; global $current_language; $module = $_REQUEST['qc_module']; $beanName = BeanFactory::getBeanName($module); //Setup the current module languge $mod_strings = return_module_language($current_language, $module); $focus = BeanFactory::getBean($module); $people = array('Contact', 'Lead'); $emailAddress = array(); // people if (in_array($beanName, $people)) { // lead specific $focus->lead_source = 'Email'; $focus->lead_source_description = trim($email->name); $from = isset($email->from_name) && !empty($email->from_name) ? $email->from_name : $email->from_addr; if (isset($_REQUEST['sugarEmail']) && !empty($_REQUEST['sugarEmail'])) { if ($email->status == "sent") { $from = isset($email->to_addrs_names) && !empty($email->to_addrs_names) ? $email->to_addrs_names : $email->to_addrs; } else { $from = isset($email->from_name) && !empty($email->from_name) ? $email->from_name : $email->from_addr_name; } } $name = explode(" ", trim($from)); $address = trim(array_pop($name)); $address = str_replace(array("<", ">", "<", ">"), "", $address); $emailAddress[] = array('email_address' => $address, 'primary_address' => 1, 'invalid_email' => 0, 'opt_out' => 0, 'reply_to_address' => 1); $focus->email1 = $address; if (!empty($name)) { $focus->last_name = trim(array_pop($name)); foreach ($name as $first) { if (!empty($focus->first_name)) { $focus->first_name .= " "; } $focus->first_name .= trim($first); } } } else { // case & bug specific $focus->source = 'InboundEmail'; // bugs, cases, tasks $focus->name = trim($email->name); } $focus->description = trim(strip_tags($email->description)); $focus->assigned_user_id = $current_user->id; $focus->team_id = $current_user->default_team; $EditView = new EditView(); $EditView->ss = new Sugar_Smarty(); //MFH BUG#20283 - checks for custom quickcreate fields $EditView->setup($module, $focus, SugarAutoLoader::loadWithMetafiles($module, 'editviewdefs')); $EditView->process(); $EditView->render(); $EditView->defs['templateMeta']['form']['buttons'] = array('email2save' => array('id' => 'e2AjaxSave', 'customCode' => '<input type="button" class="button" value=" ' . $app_strings['LBL_SAVE_BUTTON_LABEL'] . ' " onclick="SUGAR.email2.detailView.saveQuickCreate(false);" />'), 'email2saveandreply' => array('id' => 'e2SaveAndReply', 'customCode' => '<input type="button" class="button" value=" ' . $app_strings['LBL_EMAIL_SAVE_AND_REPLY'] . ' " onclick="SUGAR.email2.detailView.saveQuickCreate(\'reply\');" />'), 'email2cancel' => array('id' => 'e2cancel', 'customCode' => '<input type="button" class="button" value=" ' . $app_strings['LBL_EMAIL_CANCEL'] . ' " onclick="SUGAR.email2.detailView.quickCreateDialog.hide();" />')); if ($addToAddressBookButton) { $EditView->defs['templateMeta']['form']['buttons']['email2saveAddToAddressBook'] = array('id' => 'e2addToAddressBook', 'customCode' => '<input type="button" class="button" value=" ' . $app_strings['LBL_EMAIL_ADDRESS_BOOK_SAVE_AND_ADD'] . ' " onclick="SUGAR.email2.detailView.saveQuickCreate(true);" />'); } //Get the module language for javascript if (!is_file(sugar_cached('jsLanguage/') . "{$module}/{$GLOBALS['current_language']}.js")) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache($module, $GLOBALS['current_language']); } $jsLanguage = getVersionedScript("cache/jsLanguage/{$module}/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']); if ($focus->object_name == 'Contact') { $admin = Administration::getSettings(); if (empty($admin->settings['portal_on']) || !$admin->settings['portal_on']) { unset($EditView->sectionPanels[strtoupper('lbl_portal_information')]); } else { $jsLanguage .= getVersionedScript("modules/Contacts/Contact.js"); $jsLanguage .= getVersionedScript("modules/Contacts/QuickCreateEmailContact.js"); $jsLanguage .= <<<EOQ \t\t\t <script language="javascript"> \t\t\t\t addToValidateComparison('form_EmailQCView_Contacts', 'portal_password', 'varchar', false, SUGAR.language.get('app_strings', 'ERR_SQS_NO_MATCH_FIELD') + SUGAR.language.get('Contacts', 'LBL_PORTAL_PASSWORD'), 'portal_password1'); \t\t addToValidateVerified('form_EmailQCView_Contacts', 'portal_name_verified', 'bool', false, SUGAR.language.get('app_strings', 'ERR_EXISTING_PORTAL_USERNAME')); \t\t YAHOO.util.Event.on('portal_name', 'blur', validatePortalName); \t\t\t\t YAHOO.util.Event.on('portal_name', 'keydown', handleKeyDown); \t\t\t </script> EOQ; } } $EditView->view = 'EmailQCView'; $EditView->defs['templateMeta']['form']['headerTpl'] = 'include/EditView/header.tpl'; $EditView->defs['templateMeta']['form']['footerTpl'] = 'include/EditView/footer.tpl'; $meta = array(); $meta['html'] = $jsLanguage . $EditView->display(false, true); $meta['html'] = str_replace("src='" . getVersionedPath('include/SugarEmailAddress/SugarEmailAddress.js') . "'", '', $meta['html']); $meta['emailAddress'] = $emailAddress; $mod_strings = return_module_language($current_language, 'Emails'); return $meta; }
/** * 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']); } }
} //////////////////////////////////////////////////////// // Start the output //////////////////////////////////////////////////////// $form = new XTemplate('modules/WorkFlowTriggerShells/CreateStep1.html'); $js_include = getVersionedScript('cache/include/javascript/sugar_grp1.js') . getVersionedScript('include/workflow/jutils.js'); $GLOBALS['log']->debug("using file modules/WorkFlowTriggerShells/CreateStep1.html"); //Bug 12335: We need to include the javascript language file first. if (!is_file(sugar_cached('jsLanguage/') . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createAppStringsCache($GLOBALS['current_language']); } $javascript_language_files = getVersionedScript("cache/jsLanguage/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']); if (!is_file(sugar_cached('jsLanguage/') . $this->module . '/' . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache($this->module, $GLOBALS['current_language']); } $javascript_language_files .= getVersionedScript("cache/jsLanguage/{$this->module}/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']); $the_javascript = "<script type='text/javascript' language='JavaScript'>\n"; $the_javascript .= "function set_return() {\n"; $the_javascript .= " window.opener.document.EditView.submit();"; $the_javascript .= "}\n"; $the_javascript .= "</script>\n"; //BEGIN - WFLOW PLUGINS INFORMATION////// global $process_dictionary; $plugin_array = get_plugin("workflow", "trigger_createstep1", $focus); if (!empty($plugin_array)) { $form->assign("PLUGIN_JAVASCRIPT1", $plugin_array['jscript_part1']); $form->assign("PLUGIN_JAVASCRIPT2", $plugin_array['jscript_part2']); } //END - WFLOW PLUGINS INFORMATION//////
/** * 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 } }
$js_include = getVersionedScript('cache/include/javascript/sugar_grp1.js') . getVersionedScript('include/workflow/jutils.js'); $log->debug("using file modules/WorkFlowTriggerShells/CreateStepFilter.html"); //Bug 12335: We need to include the javascript language file first. And also the language file in WorkFlow is needed. if (!is_file(sugar_cached('jsLanguage/') . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createAppStringsCache($GLOBALS['current_language']); } $javascript_language_files = getVersionedScript("cache/jsLanguage/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']); if (!is_file(sugar_cached('jsLanguage/') . $this->module . '/' . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache($this->module, $GLOBALS['current_language']); } $javascript_language_files .= getVersionedScript("cache/jsLanguage/{$this->module}/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']); if (!is_file(sugar_cached('jsLanguage/WorkFlow/') . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache('WorkFlow', $GLOBALS['current_language']); } $javascript_language_files .= getVersionedScript("cache/jsLanguage/WorkFlow/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']); $the_javascript = "<script type='text/javascript' language='JavaScript'>\n"; $the_javascript .= "function set_return() {\n"; $the_javascript .= " window.opener.document.EditView.submit();"; $the_javascript .= "}\n"; $the_javascript .= "</script>\n"; $form->assign("MOD", $mod_strings); $form->assign("APP", $app_strings); $form->assign('JS_INCLUDE', $js_include); $form->assign("JAVASCRIPT_LANGUAGE_FILES", $javascript_language_files); $form->assign("MODULE_NAME", $currentModule); $form->assign("GRIDLINE", $gridline); $form->assign("SET_RETURN_JS", $the_javascript); $form->assign("BASE_MODULE", $workflow_object->base_module);
/** * Advanced OpenWorkflow, Automating SugarCRM. * @package Advanced OpenWorkflow for SugarCRM * @copyright SalesAgility Ltd http://www.salesagility.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with this program; if not, see http://www.gnu.org/licenses * or write to the Free Software Foundation,Inc., 51 Franklin Street, * Fifth Floor, Boston, MA 02110-1301 USA * * @author SalesAgility <*****@*****.**> */ function display_condition_lines($focus, $field, $value, $view) { global $locale, $app_list_strings, $mod_strings; $html = ''; if (!is_file('cache/jsLanguage/AOW_Conditions/' . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache('AOW_Conditions', $GLOBALS['current_language']); } $html .= '<script src="cache/jsLanguage/AOW_Conditions/' . $GLOBALS['current_language'] . '.js"></script>'; if ($view == 'EditView') { $html .= '<script src="modules/AOW_Conditions/conditionLines.js"></script>'; $html .= "<table border='0' cellspacing='4' width='100%' id='conditionLines'></table>"; $html .= "<div style='padding-top: 10px; padding-bottom:10px;'>"; $html .= "<input type=\"button\" tabindex=\"116\" class=\"button\" value=\"" . $mod_strings['LBL_ADD_CONDITION'] . "\" id=\"btn_ConditionLine\" onclick=\"insertConditionLine()\" disabled/>"; $html .= "</div>"; if (isset($focus->flow_module) && $focus->flow_module != '') { require_once "modules/AOW_WorkFlow/aow_utils.php"; $html .= "<script>"; $html .= "flow_rel_modules = \"" . trim(preg_replace('/\\s+/', ' ', getModuleRelationships($focus->flow_module))) . "\";"; $html .= "flow_module = \"" . $focus->flow_module . "\";"; $html .= "document.getElementById('btn_ConditionLine').disabled = '';"; if ($focus->id != '') { $sql = "SELECT id FROM aow_conditions WHERE aow_workflow_id = '" . $focus->id . "' AND deleted = 0 ORDER BY condition_order ASC"; $result = $focus->db->query($sql); while ($row = $focus->db->fetchByAssoc($result)) { $condition_name = new AOW_Condition(); $condition_name->retrieve($row['id']); $condition_name->module_path = unserialize(base64_decode($condition_name->module_path)); if ($condition_name->module_path == '') { $condition_name->module_path = $focus->flow_module; } $html .= "flow_fields = \"" . trim(preg_replace('/\\s+/', ' ', getModuleFields(getRelatedModule($focus->flow_module, $condition_name->module_path[0])))) . "\";"; if ($condition_name->value_type == 'Date') { $condition_name->value = unserialize(base64_decode($condition_name->value)); } $condition_item = json_encode($condition_name->toArray()); $html .= "loadConditionLine(" . $condition_item . ");"; } } $html .= "flow_fields = \"" . trim(preg_replace('/\\s+/', ' ', getModuleFields($focus->flow_module))) . "\";"; $html .= "</script>"; } } else { if ($view == 'DetailView') { $html .= '<script src="modules/AOW_Conditions/conditionLines.js"></script>'; $html .= "<table border='0' cellspacing='0' width='100%' id='conditionLines'></table>"; if (isset($focus->flow_module) && $focus->flow_module != '') { require_once "modules/AOW_WorkFlow/aow_utils.php"; $html .= "<script>"; $html .= "flow_rel_modules = \"" . trim(preg_replace('/\\s+/', ' ', getModuleRelationships($focus->flow_module))) . "\";"; $html .= "flow_module = \"" . $focus->flow_module . "\";"; $sql = "SELECT id FROM aow_conditions WHERE aow_workflow_id = '" . $focus->id . "' AND deleted = 0 ORDER BY condition_order ASC"; $result = $focus->db->query($sql); while ($row = $focus->db->fetchByAssoc($result)) { $condition_name = new AOW_Condition(); $condition_name->retrieve($row['id']); $condition_name->module_path = unserialize(base64_decode($condition_name->module_path)); if (empty($condition_name->module_path)) { $condition_name->module_path[0] = $focus->flow_module; } $html .= "flow_fields = \"" . trim(preg_replace('/\\s+/', ' ', getModuleFields(getRelatedModule($focus->flow_module, $condition_name->module_path[0])))) . "\";"; if ($condition_name->value_type == 'Date') { $condition_name->value = unserialize(base64_decode($condition_name->value)); } $condition_item = json_encode($condition_name->toArray()); $html .= "loadConditionLine(" . $condition_item . ");"; } $html .= "</script>"; } } } return $html; }
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; }
protected function _getModLanguageJS() { 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']); } return '<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>'; }