public function localeOptions($api, $args) { global $locale, $sugar_config, $current_user; $data = array(); $dformat = $locale->getPrecedentPreference($current_user->id ? 'datef' : 'default_date_format', $current_user); $tformat = $locale->getPrecedentPreference($current_user->id ? 'timef' : 'default_time_format', $current_user); $nformat = $locale->getPrecedentPreference('default_locale_name_format', $current_user); if (!array_key_exists($nformat, $sugar_config['name_formats'])) { $nformat = $sugar_config['default_locale_name_format']; } $data['timepref'] = $sugar_config['time_formats']; $data['datepref'] = $sugar_config['date_formats']; $data['default_locale_name_format'] = $locale->getUsableLocaleNameOptions($sugar_config['name_formats']); $data['timezone'] = $timezoneList = TimeDate::getTimezoneList(); $data['_hash'] = $current_user->getUserMDHash(); return $data; }
private function setDateTimeProperties($field_map = array()) { global $current_user, $sugar_config; $timeFormat = $current_user->getUserDateTimePreferences(); $defaultTimeOption = isset($field_map['importlocale_timeformat']) ? $field_map['importlocale_timeformat'] : $timeFormat['time']; $defaultDateOption = isset($field_map['importlocale_dateformat']) ? $field_map['importlocale_dateformat'] : $timeFormat['date']; $timeOptions = get_select_options_with_id($sugar_config['time_formats'], $defaultTimeOption); $dateOptions = get_select_options_with_id($sugar_config['date_formats'], $defaultDateOption); // get list of valid timezones $userTZ = isset($field_map['importlocale_timezone']) ? $field_map['importlocale_timezone'] : $current_user->getPreference('timezone'); if (empty($userTZ)) { $userTZ = TimeDate::userTimezone(); } $this->ss->assign('TIMEZONE_CURRENT', $userTZ); $this->ss->assign('TIMEOPTIONS', $timeOptions); $this->ss->assign('DATEOPTIONS', $dateOptions); $this->ss->assign('TIMEZONEOPTIONS', TimeDate::getTimezoneList()); }
if (isset($_SESSION['isMobile'])) { session_destroy(); session_start(); $_SESSION['login_error'] = $mod_strings['ERR_NO_LOGIN_MOBILE']; header("Location: index.php?module=Users&action=Login&mobile=1"); sugar_cleanup(true); } /////////////////////////////////////////////////////////////////////////////// //// HELPER FUNCTIONS //// END HELPER FUNCTIONS /////////////////////////////////////////////////////////////////////////////// if (isset($_REQUEST['userOffset'])) { // ajax call to lookup timezone echo 'userTimezone = "' . TimeDate::guessTimezone($_REQUEST['userOffset']) . '";'; exit; } $admin = Administration::getSettings(); $sugar_smarty = new Sugar_Smarty(); $sugar_smarty->assign('MOD', $mod_strings); $sugar_smarty->assign('APP', $app_strings); global $current_user; $selectedZone = $current_user->getPreference('timezone'); if (empty($selectedZone) && !empty($_REQUEST['gmto'])) { $selectedZone = TimeDate::guessTimezone(-1 * $_REQUEST['gmto']); } if (empty($selectedZone)) { $selectedZone = TimeDate::guessTimezone(); } $sugar_smarty->assign('TIMEZONE_CURRENT', $selectedZone); $sugar_smarty->assign('TIMEZONEOPTIONS', TimeDate::getTimezoneList()); $sugar_smarty->display('modules/Users/SetTimezone.tpl');
/** * @see SugarView::display() */ public function display() { global $mod_strings, $app_strings, $current_user, $sugar_config, $app_list_strings, $locale; $this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']); $has_header = isset($_REQUEST['has_header']) ? 1 : 0; $sugar_config['import_max_records_per_file'] = empty($sugar_config['import_max_records_per_file']) ? 1000 : $sugar_config['import_max_records_per_file']; // Clear out this user's last import $seedUsersLastImport = new UsersLastImport(); $seedUsersLastImport->mark_deleted_by_user_id($current_user->id); ImportCacheFiles::clearCacheFiles(); // attempt to lookup a preexisting field map // use the custom one if specfied to do so in step 1 $field_map = array(); $default_values = array(); $ignored_fields = array(); if (!empty($_REQUEST['source_id'])) { $mapping_file = new ImportMap(); $mapping_file->retrieve($_REQUEST['source_id'], false); $_REQUEST['source'] = $mapping_file->source; $has_header = $mapping_file->has_header; if (isset($mapping_file->delimiter)) { $_REQUEST['custom_delimiter'] = $mapping_file->delimiter; } if (isset($mapping_file->enclosure)) { $_REQUEST['custom_enclosure'] = htmlentities($mapping_file->enclosure); } $field_map = $mapping_file->getMapping(); $default_values = $mapping_file->getDefaultValues(); $this->ss->assign("MAPNAME", $mapping_file->name); $this->ss->assign("CHECKMAP", 'checked="checked" value="on"'); } else { // Try to see if we have a custom mapping we can use // based upon the where the records are coming from // and what module we are importing into $classname = 'ImportMap' . ucfirst($_REQUEST['source']); if (file_exists("modules/Import/{$classname}.php")) { require_once "modules/Import/{$classname}.php"; } elseif (file_exists("custom/modules/Import/{$classname}.php")) { require_once "custom/modules/Import/{$classname}.php"; } else { require_once "custom/modules/Import/ImportMapOther.php"; $classname = 'ImportMapOther'; $_REQUEST['source'] = 'other'; } if (class_exists($classname)) { $mapping_file = new $classname(); if (isset($mapping_file->delimiter)) { $_REQUEST['custom_delimiter'] = $mapping_file->delimiter; } if (isset($mapping_file->enclosure)) { $_REQUEST['custom_enclosure'] = htmlentities($mapping_file->enclosure); } $ignored_fields = $mapping_file->getIgnoredFields($_REQUEST['import_module']); $field_map = $mapping_file->getMapping($_REQUEST['import_module']); } } $this->ss->assign("CUSTOM_DELIMITER", !empty($_REQUEST['custom_delimiter']) ? $_REQUEST['custom_delimiter'] : ","); $this->ss->assign("CUSTOM_ENCLOSURE", !empty($_REQUEST['custom_enclosure']) ? $_REQUEST['custom_enclosure'] : ""); // handle uploaded file $uploadFile = new UploadFile('userfile'); if (isset($_FILES['userfile']) && $uploadFile->confirm_upload()) { $uploadFile->final_move('IMPORT_' . $this->bean->object_name . '_' . $current_user->id); $uploadFileName = $uploadFile->get_upload_path('IMPORT_' . $this->bean->object_name . '_' . $current_user->id); } else { $this->_showImportError($mod_strings['LBL_IMPORT_MODULE_ERROR_NO_UPLOAD'], $_REQUEST['import_module'], 'Step2'); return; } // split file into parts $splitter = new ImportFileSplitter($uploadFileName, $sugar_config['import_max_records_per_file']); $splitter->splitSourceFile($_REQUEST['custom_delimiter'], html_entity_decode($_REQUEST['custom_enclosure'], ENT_QUOTES), $has_header); // Now parse the file and look for errors $importFile = new ImportFile($uploadFileName, $_REQUEST['custom_delimiter'], html_entity_decode($_REQUEST['custom_enclosure'], ENT_QUOTES)); if (!$importFile->fileExists()) { $this->_showImportError($mod_strings['LBL_CANNOT_OPEN'], $_REQUEST['import_module'], 'Step2'); return; } // retrieve first 3 rows $rows = array(); $system_charset = $locale->default_export_charset; $user_charset = $locale->getExportCharset(); $other_charsets = 'UTF-8, UTF-7, ASCII, CP1252, EUC-JP, SJIS, eucJP-win, SJIS-win, JIS, ISO-2022-JP'; $detectable_charsets = "UTF-8, {$user_charset}, {$system_charset}, {$other_charsets}"; // Bug 26824 - mb_detect_encoding() thinks CP1252 is IS0-8859-1, so use that instead in the encoding list passed to the function $detectable_charsets = str_replace('CP1252', 'ISO-8859-1', $detectable_charsets); $charset_for_import = $user_charset; //We will set the default import charset option by user's preference. $able_to_detect = function_exists('mb_detect_encoding'); for ($i = 0; $i < 3; $i++) { $rows[$i] = $importFile->getNextRow(); if (!empty($rows[$i]) && $able_to_detect) { foreach ($rows[$i] as &$temp_value) { $current_charset = mb_detect_encoding($temp_value, $detectable_charsets); if (!empty($current_charset) && $current_charset != "UTF-8") { $temp_value = $locale->translateCharset($temp_value, $current_charset); // we will use utf-8 for displaying the data on the page. $charset_for_import = $current_charset; //set the default import charset option according to the current_charset. //If it is not utf-8, tt may be overwritten by the later one. So the uploaded file should not contain two types of charset($user_charset, $system_charset), and I think this situation will not occur. } } } } $ret_field_count = $importFile->getFieldCount(); // Bug 14689 - Parse the first data row to make sure it has non-empty data in it $isempty = true; if ($rows[(int) $has_header] != false) { foreach ($rows[(int) $has_header] as $value) { if (strlen(trim($value)) > 0) { $isempty = false; break; } } } if ($isempty || $rows[(int) $has_header] == false) { $this->_showImportError($mod_strings['LBL_NO_LINES'], $_REQUEST['import_module'], 'Step2'); return; } // save first row to send to step 4 $this->ss->assign("FIRSTROW", base64_encode(serialize($rows[0]))); // Now build template $this->ss->assign("TMP_FILE", $uploadFileName); $this->ss->assign("FILECOUNT", $splitter->getFileCount()); $this->ss->assign("RECORDCOUNT", $splitter->getRecordCount()); $this->ss->assign("RECORDTHRESHOLD", $sugar_config['import_max_records_per_file']); $this->ss->assign("SOURCE", $_REQUEST['source']); $this->ss->assign("TYPE", $_REQUEST['type']); $this->ss->assign("DELETE_INLINE_PNG", SugarThemeRegistry::current()->getImage('basic_search', 'align="absmiddle" alt="' . $app_strings['LNK_DELETE'] . '" border="0"')); $this->ss->assign("PUBLISH_INLINE_PNG", SugarThemeRegistry::current()->getImage('advanced_search', 'align="absmiddle" alt="' . $mod_strings['LBL_PUBLISH'] . '" border="0"')); $this->ss->assign("MODULE_TITLE", $this->getModuleTitle()); $this->ss->assign("STEP4_TITLE", strip_tags(str_replace("\n", "", getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_STEP_4_TITLE']), false)))); $this->ss->assign("HEADER", $app_strings['LBL_IMPORT'] . " " . $mod_strings['LBL_MODULE_NAME']); // we export it as email_address, but import as email1 $field_map['email_address'] = 'email1'; // build each row; row count is determined by the the number of fields in the import file $columns = array(); $mappedFields = array(); for ($field_count = 0; $field_count < $ret_field_count; $field_count++) { // See if we have any field map matches $defaultValue = ""; // Bug 31260 - If the data rows have more columns than the header row, then just add a new header column if (!isset($rows[0][$field_count])) { $rows[0][$field_count] = ''; } // See if we can match the import row to a field in the list of fields to import $firstrow_name = trim(str_replace(":", "", $rows[0][$field_count])); if ($has_header && isset($field_map[$firstrow_name])) { $defaultValue = $field_map[$firstrow_name]; } elseif (isset($field_map[$field_count])) { $defaultValue = $field_map[$field_count]; } elseif (empty($_REQUEST['source_id'])) { $defaultValue = trim($rows[0][$field_count]); } // build string of options $fields = $this->bean->get_importable_fields(); $options = array(); $defaultField = ''; foreach ($fields as $fieldname => $properties) { // get field name if (!empty($properties['vname'])) { $displayname = str_replace(":", "", translate($properties['vname'], $this->bean->module_dir)); } else { $displayname = str_replace(":", "", translate($properties['name'], $this->bean->module_dir)); } // see if this is required $req_mark = ""; $req_class = ""; if (array_key_exists($fieldname, $this->bean->get_import_required_fields())) { $req_mark = ' ' . $app_strings['LBL_REQUIRED_SYMBOL']; $req_class = ' class="required" '; } // see if we have a match $selected = ''; if (!empty($defaultValue) && !in_array($fieldname, $mappedFields) && !in_array($fieldname, $ignored_fields)) { if (strtolower($fieldname) == strtolower($defaultValue) || strtolower($fieldname) == str_replace(" ", "_", strtolower($defaultValue)) || strtolower($displayname) == strtolower($defaultValue) || strtolower($displayname) == str_replace(" ", "_", strtolower($defaultValue))) { $selected = ' selected="selected" '; $defaultField = $fieldname; $mappedFields[] = $fieldname; } } // get field type information $fieldtype = ''; if (isset($properties['type']) && isset($mod_strings['LBL_IMPORT_FIELDDEF_' . strtoupper($properties['type'])])) { $fieldtype = ' [' . $mod_strings['LBL_IMPORT_FIELDDEF_' . strtoupper($properties['type'])] . '] '; } if (isset($properties['comment'])) { $fieldtype .= ' - ' . $properties['comment']; } $options[$displayname . $fieldname] = '<option value="' . $fieldname . '" title="' . $displayname . htmlentities($fieldtype) . '"' . $selected . $req_class . '>' . $displayname . $req_mark . '</option>\\n'; } // get default field value $defaultFieldHTML = ''; if (!empty($defaultField)) { $defaultFieldHTML = getControl($_REQUEST['import_module'], $defaultField, $fields[$defaultField], isset($default_values[$defaultField]) ? $default_values[$defaultField] : ''); } if (isset($default_values[$defaultField])) { unset($default_values[$defaultField]); } // Bug 27046 - Sort the column name picker alphabetically ksort($options); $columns[] = array('field_choices' => implode('', $options), 'default_field' => $defaultFieldHTML, 'cell1' => str_replace(""", '', htmlspecialchars($rows[0][$field_count])), 'cell2' => str_replace(""", '', htmlspecialchars($rows[1][$field_count])), 'cell3' => str_replace(""", '', htmlspecialchars($rows[2][$field_count])), 'show_remove' => false); } // add in extra defaulted fields if they are in the mapping record if (count($default_values) > 0) { foreach ($default_values as $field_name => $default_value) { // build string of options $fields = $this->bean->get_importable_fields(); $options = array(); $defaultField = ''; foreach ($fields as $fieldname => $properties) { // get field name if (!empty($properties['vname'])) { $displayname = str_replace(":", "", translate($properties['vname'], $this->bean->module_dir)); } else { $displayname = str_replace(":", "", translate($properties['name'], $this->bean->module_dir)); } // see if this is required $req_mark = ""; $req_class = ""; if (array_key_exists($fieldname, $this->bean->get_import_required_fields())) { $req_mark = ' ' . $app_strings['LBL_REQUIRED_SYMBOL']; $req_class = ' class="required" '; } // see if we have a match $selected = ''; if (strtolower($fieldname) == strtolower($field_name) && !in_array($fieldname, $mappedFields) && !in_array($fieldname, $ignored_fields)) { $selected = ' selected="selected" '; $defaultField = $fieldname; $mappedFields[] = $fieldname; } // get field type information $fieldtype = ''; if (isset($properties['type']) && isset($mod_strings['LBL_IMPORT_FIELDDEF_' . strtoupper($properties['type'])])) { $fieldtype = ' [' . $mod_strings['LBL_IMPORT_FIELDDEF_' . strtoupper($properties['type'])] . '] '; } if (isset($properties['comment'])) { $fieldtype .= ' - ' . $properties['comment']; } $options[$displayname . $fieldname] = '<option value="' . $fieldname . '" title="' . $displayname . $fieldtype . '"' . $selected . $req_class . '>' . $displayname . $req_mark . '</option>\\n'; } // get default field value $defaultFieldHTML = ''; if (!empty($defaultField)) { $defaultFieldHTML = getControl($_REQUEST['import_module'], $defaultField, $fields[$defaultField], $default_value); } // Bug 27046 - Sort the column name picker alphabetically ksort($options); $columns[] = array('field_choices' => implode('', $options), 'default_field' => $defaultFieldHTML, 'show_remove' => true); $ret_field_count++; } } $this->ss->assign("COLUMNCOUNT", $ret_field_count); $this->ss->assign("rows", $columns); // get list of valid date/time formats $timeFormat = $current_user->getUserDateTimePreferences(); $timeOptions = get_select_options_with_id($sugar_config['time_formats'], $timeFormat['time']); $dateOptions = get_select_options_with_id($sugar_config['date_formats'], $timeFormat['date']); $this->ss->assign('TIMEOPTIONS', $timeOptions); $this->ss->assign('DATEOPTIONS', $dateOptions); $this->ss->assign('datetimeformat', $GLOBALS['timedate']->get_cal_date_time_format()); // get list of valid timezones $userTZ = $current_user->getPreference('timezone'); if (empty($userTZ)) { $userTZ = TimeDate::userTimezone(); } $this->ss->assign('TIMEZONE_CURRENT', $userTZ); $this->ss->assign('TIMEZONEOPTIONS', TimeDate::getTimezoneList()); // get currency preference require_once 'modules/Currencies/ListCurrency.php'; $currency = new ListCurrency(); $cur_id = $locale->getPrecedentPreference('currency', $current_user); if ($cur_id) { $selectCurrency = $currency->getSelectOptions($cur_id); $this->ss->assign("CURRENCY", $selectCurrency); } else { $selectCurrency = $currency->getSelectOptions(); $this->ss->assign("CURRENCY", $selectCurrency); } $currenciesVars = ""; $i = 0; foreach ($locale->currencies as $id => $arrVal) { $currenciesVars .= "currencies[{$i}] = '{$arrVal['symbol']}';\n"; $i++; } $currencySymbolsJs = <<<eoq var currencies = new Object; {$currenciesVars} function setSymbolValue(id) { document.getElementById('symbol').value = currencies[id]; } eoq; $this->ss->assign('currencySymbolJs', $currencySymbolsJs); // fill significant digits dropdown $significantDigits = $locale->getPrecedentPreference('default_currency_significant_digits', $current_user); $sigDigits = ''; for ($i = 0; $i <= 6; $i++) { if ($significantDigits == $i) { $sigDigits .= '<option value="' . $i . '" selected="true">' . $i . '</option>'; } else { $sigDigits .= '<option value="' . $i . '">' . $i . '</option>'; } } $this->ss->assign('sigDigits', $sigDigits); $num_grp_sep = $current_user->getPreference('num_grp_sep'); $dec_sep = $current_user->getPreference('dec_sep'); $this->ss->assign("NUM_GRP_SEP", empty($num_grp_sep) ? $sugar_config['default_number_grouping_seperator'] : $num_grp_sep); $this->ss->assign("DEC_SEP", empty($dec_sep) ? $sugar_config['default_decimal_seperator'] : $dec_sep); $this->ss->assign('getNumberJs', $locale->getNumberJs()); // Name display format $this->ss->assign('default_locale_name_format', $locale->getLocaleFormatMacro($current_user)); $this->ss->assign('getNameJs', $locale->getNameJs()); // Charset $charsetOptions = get_select_options_with_id($locale->getCharsetSelect(), $charset_for_import); //wdong, bug 25927, here we should use the charset testing results from above. $this->ss->assign('CHARSETOPTIONS', $charsetOptions); // handle building index selector global $dictionary, $current_language; require_once "include/templates/TemplateGroupChooser.php"; $chooser_array = array(); $chooser_array[0] = array(); $idc = new ImportDuplicateCheck($this->bean); $chooser_array[1] = $idc->getDuplicateCheckIndexes(); $chooser = new TemplateGroupChooser(); $chooser->args['id'] = 'selected_indices'; $chooser->args['values_array'] = $chooser_array; $chooser->args['left_name'] = 'choose_index'; $chooser->args['right_name'] = 'ignore_index'; $chooser->args['left_label'] = $mod_strings['LBL_INDEX_USED']; $chooser->args['right_label'] = $mod_strings['LBL_INDEX_NOT_USED']; $this->ss->assign("TAB_CHOOSER", $chooser->display()); // show notes if ($this->bean instanceof Person) { $module_key = "LBL_CONTACTS_NOTE_"; } elseif ($this->bean instanceof Company) { $module_key = "LBL_ACCOUNTS_NOTE_"; } else { $module_key = "LBL_" . strtoupper($_REQUEST['import_module']) . "_NOTE_"; } $notetext = ''; for ($i = 1; isset($mod_strings[$module_key . $i]); $i++) { $notetext .= '<li>' . $mod_strings[$module_key . $i] . '</li>'; } $this->ss->assign("NOTETEXT", $notetext); $this->ss->assign("HAS_HEADER", $has_header ? 'on' : 'off'); // get list of required fields $required = array(); foreach (array_keys($this->bean->get_import_required_fields()) as $name) { $properties = $this->bean->getFieldDefinition($name); if (!empty($properties['vname'])) { $required[$name] = str_replace(":", "", translate($properties['vname'], $this->bean->module_dir)); } else { $required[$name] = str_replace(":", "", translate($properties['name'], $this->bean->module_dir)); } } // include anything needed for quicksearch to work require_once "include/TemplateHandler/TemplateHandler.php"; $quicksearch_js = TemplateHandler::createQuickSearchCode($fields, $fields, 'importstep3'); $this->ss->assign("JAVASCRIPT", $quicksearch_js . "\n" . $this->_getJS($required)); $this->ss->assign('required_fields', implode(', ', $required)); $this->ss->display('modules/Import/tpls/step3.tpl'); }
/** * @see SugarView::display() */ public function display() { global $mod_strings, $current_user, $locale, $sugar_config, $app_list_strings, $sugar_version; $themeObject = SugarThemeRegistry::current(); $css = $themeObject->getCSS(); $this->ss->assign('SUGAR_CSS', $css); $favicon = $themeObject->getImageURL('sugar_icon.ico', false); $this->ss->assign('FAVICON_URL', getJSPath($favicon)); $this->ss->assign('CSS', '<link rel="stylesheet" type="text/css" href="' . SugarThemeRegistry::current()->getCSSURL('wizard.css') . '" />'); $this->ss->assign('JAVASCRIPT', user_get_validate_record_js() . user_get_chooser_js() . user_get_confsettings_js()); $this->ss->assign('PRINT_URL', 'index.php?' . $GLOBALS['request_string']); $this->ss->assign('SKIP_WELCOME', isset($_REQUEST['skipwelcome']) && $_REQUEST['skipwelcome'] == 1); $this->ss->assign('ID', $current_user->id); $this->ss->assign('USER_NAME', $current_user->user_name); $this->ss->assign('FIRST_NAME', $current_user->first_name); $this->ss->assign('SUGAR_VERSION', $sugar_version); $this->ss->assign('LAST_NAME', $current_user->last_name); $this->ss->assign('TITLE', $current_user->title); $this->ss->assign('DEPARTMENT', $current_user->department); $this->ss->assign('REPORTS_TO_ID', $current_user->reports_to_id); $this->ss->assign('REPORTS_TO_NAME', $current_user->reports_to_name); $this->ss->assign('PHONE_HOME', $current_user->phone_home); $this->ss->assign('PHONE_MOBILE', $current_user->phone_mobile); $this->ss->assign('PHONE_WORK', $current_user->phone_work); $this->ss->assign('PHONE_OTHER', $current_user->phone_other); $this->ss->assign('PHONE_FAX', $current_user->phone_fax); $this->ss->assign('EMAIL1', $current_user->email1); $this->ss->assign('EMAIL2', $current_user->email2); $this->ss->assign('ADDRESS_STREET', $current_user->address_street); $this->ss->assign('ADDRESS_CITY', $current_user->address_city); $this->ss->assign('ADDRESS_STATE', $current_user->address_state); $this->ss->assign('ADDRESS_POSTALCODE', $current_user->address_postalcode); $this->ss->assign('ADDRESS_COUNTRY', $current_user->address_country); $configurator = new Configurator(); if ($configurator->config['passwordsetting']['SystemGeneratedPasswordON'] || $configurator->config['passwordsetting']['forgotpasswordON']) { $this->ss->assign('REQUIRED_EMAIL_ADDRESS', '1'); } else { $this->ss->assign('REQUIRED_EMAIL_ADDRESS', '0'); } // get javascript ob_start(); $this->options['show_javascript'] = true; $this->renderJavascript(); $this->options['show_javascript'] = false; $this->ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS()); ob_end_clean(); $messenger_type = '<select tabindex="5" name="messenger_type">'; $messenger_type .= get_select_options_with_id($app_list_strings['messenger_type_dom'], $current_user->messenger_type); $messenger_type .= '</select>'; $this->ss->assign('MESSENGER_TYPE_OPTIONS', $messenger_type); $this->ss->assign('MESSENGER_ID', $current_user->messenger_id); // set default settings $use_real_names = $current_user->getPreference('use_real_names'); if (empty($use_real_names)) { $current_user->setPreference('use_real_names', 'on'); } $current_user->setPreference('reminder_time', 1800); $current_user->setPreference('email_reminder_time', 3600); $current_user->setPreference('mailmerge_on', 'on'); //// Timezone if (empty($current_user->id)) { // remove default timezone for new users(set later) $current_user->user_preferences['timezone'] = ''; } $userTZ = $current_user->getPreference('timezone'); if (empty($userTZ) && !$current_user->is_group && !$current_user->portal_only) { $userTZ = TimeDate::guessTimezone(); $current_user->setPreference('timezone', $userTZ); } if (!$current_user->getPreference('ut')) { $this->ss->assign('PROMPTTZ', ' checked'); } $this->ss->assign('TIMEZONE_CURRENT', $userTZ); $this->ss->assign('TIMEZONEOPTIONS', TimeDate::getTimezoneList()); //// Numbers and Currency display require_once 'modules/Currencies/ListCurrency.php'; $currency = new ListCurrency(); // 10/13/2006 Collin - Changed to use Localization.getConfigPreference // This was the problem- Previously, the "-99" currency id always assumed // to be defaulted to US Dollars. However, if someone set their install to use // Euro or other type of currency then this setting would not apply as the // default because it was being overridden by US Dollars. $cur_id = $locale->getPrecedentPreference('currency', $current_user); if ($cur_id) { $selectCurrency = $currency->getSelectOptions($cur_id); $this->ss->assign("CURRENCY", $selectCurrency); } else { $selectCurrency = $currency->getSelectOptions(); $this->ss->assign("CURRENCY", $selectCurrency); } $currenciesArray = $locale->currencies; $currenciesVars = $this->correctCurrenciesSymbolsSort($currenciesArray); $currencySymbolsJs = <<<eoq var currencies = new Object; {$currenciesVars} function setSymbolValue(id) { \tdocument.getElementById('symbol').value = currencies[id]; } eoq; $this->ss->assign('currencySymbolJs', $currencySymbolsJs); // fill significant digits dropdown $significantDigits = $locale->getPrecedentPreference('default_currency_significant_digits', $current_user); $sigDigits = ''; for ($i = 0; $i <= 6; $i++) { if ($significantDigits == $i) { $sigDigits .= "<option value=\"{$i}\" selected=\"true\">{$i}</option>"; } else { $sigDigits .= "<option value=\"{$i}\">{$i}</option>"; } } $this->ss->assign('sigDigits', $sigDigits); $num_grp_sep = $current_user->getPreference('num_grp_sep'); $dec_sep = $current_user->getPreference('dec_sep'); $this->ss->assign("NUM_GRP_SEP", empty($num_grp_sep) ? $sugar_config['default_number_grouping_seperator'] : $num_grp_sep); $this->ss->assign("DEC_SEP", empty($dec_sep) ? $sugar_config['default_decimal_seperator'] : $dec_sep); $this->ss->assign('getNumberJs', $locale->getNumberJs()); //// Name display format $this->ss->assign('default_locale_name_format', $locale->getLocaleFormatMacro($current_user)); $this->ss->assign('getNameJs', $locale->getNameJs()); $this->ss->assign('TIMEOPTIONS', get_select_options_with_id($sugar_config['time_formats'], $current_user->_userPreferenceFocus->getDefaultPreference('default_time_format'))); $this->ss->assign('DATEOPTIONS', get_select_options_with_id($sugar_config['date_formats'], $current_user->_userPreferenceFocus->getDefaultPreference('default_date_format'))); $this->ss->assign("MAIL_SENDTYPE", get_select_options_with_id($app_list_strings['notifymail_sendtype'], $current_user->getPreference('mail_sendtype'))); $this->ss->assign("NEW_EMAIL", $current_user->emailAddress->getEmailAddressWidgetEditView($current_user->id, $current_user->module_dir)); $this->ss->assign('EMAIL_LINK_TYPE', get_select_options_with_id($app_list_strings['dom_email_link_type'], $current_user->getPreference('email_link_type'))); $selectedLocaleNameFormat = $current_user->_userPreferenceFocus->getDefaultPreference('default_locale_name_format'); if (array_key_exists($selectedLocaleNameFormat, $sugar_config['name_formats'])) { $selectedLocaleNameFormat = $sugar_config['default_locale_name_format']; } $this->ss->assign('NAMEOPTIONS', get_select_options_with_id($locale->getUsableLocaleNameOptions($sugar_config['name_formats']), $selectedLocaleNameFormat)); // email smtp $systemOutboundEmail = new OutboundEmail(); $systemOutboundEmail = $systemOutboundEmail->getSystemMailerSettings(); $mail_smtpserver = $systemOutboundEmail->mail_smtpserver; $mail_smtptype = $systemOutboundEmail->mail_smtptype; $mail_smtpport = $systemOutboundEmail->mail_smtpport; $mail_smtpssl = $systemOutboundEmail->mail_smtpssl; $mail_smtpdisplay = $systemOutboundEmail->mail_smtpdisplay; $mail_smtpuser = ""; $mail_smtppass = ""; $hide_if_can_use_default = true; $mail_smtpauth_req = true; if (!empty($mail_smtpserver) && !empty($mail_smtptype)) { if (!$systemOutboundEmail->isAllowUserAccessToSystemDefaultOutbound()) { $mail_smtpauth_req = $systemOutboundEmail->mail_smtpauth_req; $userOverrideOE = $systemOutboundEmail->getUsersMailerForSystemOverride($current_user->id); if ($userOverrideOE != null) { $mail_smtpuser = $userOverrideOE->mail_smtpuser; $mail_smtppass = $userOverrideOE->mail_smtppass; } if (!$mail_smtpauth_req && (empty($systemOutboundEmail->mail_smtpserver) || empty($systemOutboundEmail->mail_smtpuser) || empty($systemOutboundEmail->mail_smtppass))) { $hide_if_can_use_default = true; } else { $hide_if_can_use_default = false; } } } $isAdmin = is_admin($current_user); $this->ss->assign('IS_ADMIN', $isAdmin); $this->ss->assign("mail_smtpdisplay", $mail_smtpdisplay); $this->ss->assign("mail_smtpuser", $mail_smtpuser); $this->ss->assign("mail_smtppass", $mail_smtppass); $this->ss->assign('mail_smtpserver', $mail_smtpserver); $this->ss->assign("mail_smtpauth_req", $mail_smtpauth_req); $this->ss->assign('MAIL_SMTPPORT', $mail_smtpport); $this->ss->assign('MAIL_SMTPSSL', $mail_smtpssl); $this->ss->assign('HIDE_IF_CAN_USE_DEFAULT_OUTBOUND', $hide_if_can_use_default); $this->ss->assign('langHeader', get_language_header()); $this->ss->display($this->getCustomFilePathIfExists('modules/Users/tpls/wizard.tpl')); }
protected function setupAdvancedTabLocaleSettings() { global $locale, $sugar_config, $app_list_strings; /////////////////////////////////////////////////////////////////////////////// //// LOCALE SETTINGS //// Date/time format $dformat = $locale->getPrecedentPreference($this->bean->id ? 'datef' : 'default_date_format', $this->bean); $tformat = $locale->getPrecedentPreference($this->bean->id ? 'timef' : 'default_time_format', $this->bean); $nformat = $locale->getPrecedentPreference('default_locale_name_format', $this->bean); if (!array_key_exists($nformat, $sugar_config['name_formats'])) { $nformat = $sugar_config['default_locale_name_format']; } $timeOptions = get_select_options_with_id($sugar_config['time_formats'], $tformat); $dateOptions = get_select_options_with_id($sugar_config['date_formats'], $dformat); $nameOptions = get_select_options_with_id($locale->getUsableLocaleNameOptions($sugar_config['name_formats']), $nformat); $this->ss->assign('TIMEOPTIONS', $timeOptions); $this->ss->assign('DATEOPTIONS', $dateOptions); $this->ss->assign('NAMEOPTIONS', $nameOptions); $this->ss->assign('DATEFORMAT', $sugar_config['date_formats'][$dformat]); $this->ss->assign('TIMEFORMAT', $sugar_config['time_formats'][$tformat]); $this->ss->assign('NAMEFORMAT', $sugar_config['name_formats'][$nformat]); //// Timezone if (empty($this->bean->id)) { // remove default timezone for new users(set later) $this->bean->user_preferences['timezone'] = ''; } $userTZ = $this->bean->getPreference('timezone'); if (empty($userTZ) && !$this->bean->is_group && !$this->bean->portal_only) { $userTZ = TimeDate::guessTimezone(); $this->bean->setPreference('timezone', $userTZ); } if (!$this->bean->getPreference('ut')) { $this->ss->assign('PROMPTTZ', ' checked'); } $this->ss->assign('TIMEZONE_CURRENT', $userTZ); $this->ss->assign('TIMEZONEOPTIONS', TimeDate::getTimezoneList()); $this->ss->assign("TIMEZONE", TimeDate::tzName($userTZ)); // FG - Bug 4236 - Managed First Day of Week $fdowDays = array(); foreach ($app_list_strings['dom_cal_day_long'] as $d) { if ($d != "") { $fdowDays[] = $d; } } $this->ss->assign("FDOWOPTIONS", $fdowDays); $currentFDOW = $this->bean->get_first_day_of_week(); if (!isset($currentFDOW)) { $currentFDOW = 0; } $this->ss->assign("FDOWCURRENT", $currentFDOW); $this->ss->assign("FDOWDISPLAY", $fdowDays[$currentFDOW]); //// Numbers and Currency display require_once 'modules/Currencies/ListCurrency.php'; $currency = new ListCurrency(); // 10/13/2006 Collin - Changed to use Localization.getConfigPreference // This was the problem- Previously, the "-99" currency id always assumed // to be defaulted to US Dollars. However, if someone set their install to use // Euro or other type of currency then this setting would not apply as the // default because it was being overridden by US Dollars. $cur_id = $locale->getPrecedentPreference('currency', $this->bean); if ($cur_id) { $selectCurrency = $currency->getSelectOptions($cur_id); $this->ss->assign("CURRENCY", $selectCurrency); } else { $selectCurrency = $currency->getSelectOptions(); $this->ss->assign("CURRENCY", $selectCurrency); } // convert base currency values to user preferred $this->ss->assign("currency_show_preferred", $locale->getPrecedentPreference('currency_show_preferred', $this->bean)); $currencyList = array(); foreach ($locale->currencies as $id => $val) { $currencyList[$id] = $val['symbol']; } $currencySymbolJSON = json_encode($currencyList); $this->ss->assign('currencySymbolJSON', $currencySymbolJSON); $currencyDisplay = BeanFactory::getBean('Currencies'); if (isset($cur_id)) { $currencyDisplay->retrieve($cur_id); $this->ss->assign('CURRENCY_DISPLAY', $currencyDisplay->iso4217 . ' ' . $currencyDisplay->symbol); } else { $this->ss->assign("CURRENCY_DISPLAY", $currencyDisplay->getDefaultISO4217() . ' ' . $currencyDisplay->getDefaultCurrencySymbol()); } // fill significant digits dropdown $significantDigits = $locale->getPrecedentPreference('default_currency_significant_digits', $this->bean); $sigDigits = ''; for ($i = 0; $i <= 6; $i++) { if ($significantDigits == $i) { $sigDigits .= "<option value=\"{$i}\" selected=\"true\">{$i}</option>"; } else { $sigDigits .= "<option value=\"{$i}\">{$i}</option>"; } } $this->ss->assign('sigDigits', $sigDigits); $this->ss->assign('CURRENCY_SIG_DIGITS', $significantDigits); $num_grp_sep = $this->bean->getPreference('num_grp_sep'); $dec_sep = $this->bean->getPreference('dec_sep'); $this->ss->assign("NUM_GRP_SEP", empty($num_grp_sep) ? $GLOBALS['sugar_config']['default_number_grouping_seperator'] : $num_grp_sep); $this->ss->assign("DEC_SEP", empty($dec_sep) ? $GLOBALS['sugar_config']['default_decimal_seperator'] : $dec_sep); $this->ss->assign('getNumberJs', $locale->getNumberJs()); //// Name display format $this->ss->assign('default_locale_name_format', $locale->getLocaleFormatMacro($this->bean)); $this->ss->assign('getNameJs', $locale->getNameJs()); $this->ss->assign('NAME_FORMAT', $this->bean->getLocaleFormatDesc()); //// END LOCALE SETTINGS }
private function getFormItems($mod_strings, $app_list_strings, $sugarConfigDefaults, $drivers, $checked, $db, $errors, $supportedLanguages, $current_language, $customSession, $customLog, $customId, $customSessionHidden, $customLogHidden, $customIdHidden) { // ------------------------------ // DB Type and DB configuration // ----------------------------------> // database selection $out_dbtypesel = "\n <div class=\"floatbox\" id=\"fb5\">\n <h2>{$mod_strings['LBL_DBCONF_TITLE']}</h2>\n\n <div class=\"form_section\">\n <h3>{$mod_strings['LBL_SYSOPTS_DB']}</h3>"; foreach ($drivers as $type => $driver) { $oci = $type == "oci8" ? "" : 'none'; // hack for special oracle message $out_dbtypesel .= <<<EOQ <input type="radio" class="checkbox" name="setup_db_type" id="setup_db_type" value="{$type}" {$checked[$type]} onclick="onDBTypeClick(this);//document.getElementById('ociMsg').style.display='{$oci}'"/>{$mod_strings[$driver->label]}<br> EOQ; } $out_dbtypesel .= <<<EOQ </div> <div name="ociMsg" id="ociMsg" style="display:none"></div> <!-- </div> --> EOQ; $out2 = $out_dbtypesel; $out2 .= <<<EOQ2 <!-- <div class="floatbox"> --> <div class="form_section starhook"> <!-- <div class="required">{$mod_strings['LBL_REQUIRED']}</div> --> <h3>{$mod_strings['LBL_DBCONF_TITLE_NAME']}</h3> EOQ2; $config_params = $db->installConfig(); $form = ''; foreach ($config_params as $group => $gdata) { $form .= "<div class='install_block'>"; if ($mod_strings[$group . '_LABEL']) { $form .= "<label>{$mod_strings[$group . '_LABEL']}" . "<i> i <div class=\"tooltip\">{$mod_strings[$group]}</div></i></label>\n"; } foreach ($gdata as $name => $value) { if (!empty($value)) { if (!empty($value['required'])) { $form .= "<span class=\"required\">*</span>"; } else { } if (!empty($_SESSION[$name])) { $sessval = $_SESSION[$name]; } else { $sessval = ''; } if (!empty($value["type"])) { $type = $value["type"]; } else { $type = ''; } $form .= <<<FORM FORM; //if the type is password, set a hidden field to capture the value. This is so that we can properly encode special characters, which is a limitation with password fields if ($type == 'password') { $form .= "</div><div class=\"install_block\"><label>{$mod_strings['LBL_DBCONF_TITLE_PSWD_INFO_LABEL']}</label><span> </span><input type='{$type}' name='{$name}_entry' id='{$name}_entry' value='" . urldecode($sessval) . "'><input type='hidden' name='{$name}' id='{$name}' value='" . urldecode($sessval) . "'></div><div class=\"install_block\">"; } else { $form .= "<input type='{$type}' name='{$name}' id='{$name}' value='{$sessval}'>"; } $form .= <<<FORM FORM; } else { $form .= "<input name=\"{$name}\" id=\"{$name}\" value=\"\" type=\"hidden\">\n"; } } $form .= "</div>"; } $out2 .= $form; // ---------- user data set (dbConfig_a.php) //if we are installing in custom mode, include the following html if ($db->supports("create_user")) { // create / set db user dropdown $auto_select = ''; $provide_select = ''; $create_select = ''; $same_select = ''; if (isset($_SESSION['dbUSRData'])) { // if($_SESSION['dbUSRData']=='auto') {$auto_select ='selected';} if ($_SESSION['dbUSRData'] == 'provide') { $provide_select = 'selected'; } if (isset($_SESSION['install_type']) && !empty($_SESSION['install_type']) && strtolower($_SESSION['install_type']) == 'custom') { if ($_SESSION['dbUSRData'] == 'create') { $create_select = 'selected'; } } if ($_SESSION['dbUSRData'] == 'same') { $same_select = 'selected'; } } else { $same_select = 'selected'; } $dbUSRDD = "<select name='dbUSRData' id='dbUSRData' onchange='toggleDBUser();'>"; $dbUSRDD .= "<option value='provide' {$provide_select}>" . $mod_strings['LBL_DBCONFIG_PROVIDE_DD'] . "</option>"; $dbUSRDD .= "<option value='create' {$create_select}>" . $mod_strings['LBL_DBCONFIG_CREATE_DD'] . "</option>"; $dbUSRDD .= "<option value='same' {$same_select}>" . $mod_strings['LBL_DBCONFIG_SAME_DD'] . "</option>"; $dbUSRDD .= "</select><br> "; $setup_db_sugarsales_password = urldecode($_SESSION['setup_db_sugarsales_password']); $setup_db_sugarsales_user = urldecode($_SESSION['setup_db_sugarsales_user']); $setup_db_sugarsales_password_retype = urldecode($_SESSION['setup_db_sugarsales_password_retype']); $out2 .= <<<EOQ2 <br> <div class='install_block'> <!-- <div class="ibmsg">{$mod_strings['LBL_DBCONFIG_SECURITY']}</div> --> </div> <div class='install_block'> <div class="formrow"> <label>{$mod_strings['LBL_DBCONF_SUGAR_DB_USER']}<i> i <div class="tooltip">{$mod_strings['LBL_DBCONFIG_SECURITY']}</div></i></label> {$dbUSRDD} </div> <div class="clear"></div> <span id='connection_user_div' style="display:none"> <div class="formrow"> <label>{$mod_strings['LBL_DBCONF_SUGAR_DB_USER']} <span class="required">*</span></label> <input type="text" name="setup_db_sugarsales_user" maxlength="16" value="{$_SESSION['setup_db_sugarsales_user']}" /> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_DBCONF_DB_PASSWORD']}</label> <input type="password" name="setup_db_sugarsales_password_entry" value="{$setup_db_sugarsales_password}" /> <input type="hidden" name="setup_db_sugarsales_password" value="{$setup_db_sugarsales_password}" /> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_DBCONF_DB_PASSWORD2']}</label> <input type="password" name="setup_db_sugarsales_password_retype_entry" value="{$setup_db_sugarsales_password_retype}" /> <input type="hidden" name="setup_db_sugarsales_password_retype" value="{$setup_db_sugarsales_password_retype}" /> </div> </span> </div> EOQ2; } $out = $out2; // ------ siteConfig_a.php $out .= <<<EOQ </div> </div> <div class="floatbox" id="fb6"> <h2>{$mod_strings['LBL_SITECFG_TITLE']}</h2> <div class="form_section"> <p>{$errors}</p> <div class="required">{$mod_strings['LBL_REQUIRED']}</div> <h3>{$mod_strings['LBL_SITECFG_TITLE2']}<div class="tooltip-toggle"><em> i </em><div class="tooltip">{$mod_strings['LBL_SITECFG_PASSWORD_MSG']}</div></div></h3> EOQ; //hide this in typical mode if (!empty($_SESSION['install_type']) && strtolower($_SESSION['install_type']) == 'custom') { $out .= <<<EOQ <div class='install_block'> {$mod_strings['LBL_SITECFG_URL_MSG']} <span class="required">*</span> <label><b>{$mod_strings['LBL_SITECFG_URL']}</b></label> <input type="text" name="setup_site_url" value="{$_SESSION['setup_site_url']}" size="40" /> <br>{$mod_strings['LBL_SITECFG_SYS_NAME_MSG']} <span class="required">*</span> <label><b>{$mod_strings['LBL_SYSTEM_NAME']}</b></label> <input type="text" name="setup_system_name" value="{$_SESSION['setup_system_name']}" size="40" /><br> </div> EOQ; $db = getDbConnection(); if ($db->supports("collation")) { $collationOptions = $db->getCollationList(); } if (!empty($collationOptions)) { if (isset($_SESSION['setup_db_options']['collation'])) { $default = $_SESSION['setup_db_options']['collation']; } else { $default = $db->getDefaultCollation(); } $options = get_select_options_with_id(array_combine($collationOptions, $collationOptions), $default); $out .= <<<EOQ <div class='install_block'> <br>{$mod_strings['LBL_SITECFG_COLLATION_MSG']} <span class="required">*</span> <label><b>{$mod_strings['LBL_COLLATION']}</b></label> <select name="setup_db_collation" id="setup_db_collation">{$options}</select><br> </div> EOQ; } } $help_url = get_help_button_url(); if (!isset($_SESSION['email1'])) { $_SESSION['email1'] = null; } if (!isset($_SESSION['setup_site_admin_user_name'])) { $_SESSION['setup_site_admin_user_name'] = null; } $out .= <<<EOQ <div class='install_block'> <!-- <p class="ibmsg">{$mod_strings['LBL_SITECFG_PASSWORD_MSG']}</p> --> <div class="formrow big"> <label>{$mod_strings['LBL_SITECFG_ADMIN_Name']} <span class="required">*</span></label> <input type="text" name="setup_site_admin_user_name" value="{$_SESSION['setup_site_admin_user_name']}" size="20" maxlength="60" /> </div> <div class="clear"></div> <div class="formrow big"> <label>{$mod_strings['LBL_SITECFG_ADMIN_PASS']} <span class="required">*</span></label> <input type="password" name="setup_site_admin_password" value="{$_SESSION['setup_site_admin_password']}" size="20" /> </div> <div class="clear"></div> <div class="formrow big"> <label>{$mod_strings['LBL_SITECFG_ADMIN_PASS_2']} <span class="required">*</span></label> <input type="password" name="setup_site_admin_password_retype" value="{$_SESSION['setup_site_admin_password_retype']}" size="20" /> </div> <div class="clear"></div> <div class="formrow big"> <label>{$mod_strings['LBL_SITECFG_URL']} <span class="required">*</span></label> <input type="text" name="setup_site_url" value="{$_SESSION['setup_site_url']}" size="40" /> </div> <div class="clear"></div> <div class="formrow big"> <label>{$mod_strings['LBL_EMAIL_ADDRESS']} <span class="required">*</span></label> <input type="email" name="email1" value="{$_SESSION['email1']}" size="40" /> </div> <div class="clear"></div> <div class="clear"></div> <!-- <a href="javascript:;" onclick="\$('.security-block').toggle();">More..</a><br/><br/> --> EOQ; $out .= <<<EOQ </div> EOQ; $out .= <<<EOQ EOQ; // ------------------ // Choose Demo Data // -------------------------> //demo data select $demoDD = "<select name='demoData' id='demoData' class='select'><option value='no' >" . $mod_strings['LBL_NO'] . "</option><option value='yes'>" . $mod_strings['LBL_YES'] . "</option>"; $demoDD .= "</select>"; $out .= <<<EOQ3 </div> </div> <div class="floatbox full" id="fb0"> <h2>{$mod_strings['LBL_MORE_OPTIONS_TITLE']}</h2> </div> <div class="floatbox full" id="fb1"> <div class="install_block"> <h3 onclick="\$(this).next().toggle();" class="toggler">» {$mod_strings['LBL_DBCONF_DEMO_DATA_TITLE']}</h3> <div class="form_section" style="display: none;"> <div class="clear"></div> <div class="formrow big"> <label>{$mod_strings['LBL_DBCONF_DEMO_DATA']}</label> {$demoDD} </div> </div> </div> </div> EOQ3; // ------------------ // Choose Scenarios // -------------------------> $scenarioSelection = "<p class='ibmsg'>{$mod_strings['LBL_WIZARD_SCENARIO_EMPTY']}</p>"; if (isset($_SESSION['installation_scenarios']) && !empty($_SESSION['installation_scenarios'])) { $scenarioSelection = ""; foreach ($_SESSION['installation_scenarios'] as $scenario) { $key = $scenario['key']; $description = $scenario['description']; $scenarioModuleList = implode($scenario['modulesScenarioDisplayName'], ','); $title = $scenario['title']; $scenarioSelection .= "<input type='checkbox' name='scenarios[]' value='{$key}' checked><b>{$title}</b>. {$description} ({$scenarioModuleList}).<br>"; } } $out .= <<<EOQ <!-- Scenario Selection --> <div class="floatbox full" id="fb3"> <h3 onclick="\$(this).next().toggle();" class="toggler">» {$mod_strings['LBL_WIZARD_SCENARIO_TITLE']}</h3> <div class="form_section" style="display: none;"> <p class="ibmsg">{$mod_strings['LBL_WIZARD_SCENARIO_DESC']}</p> <div class="formrow">{$scenarioSelection}</div> <div class="clear"></div> </div> </div> EOQ; //--End of scenarios //--------------- // SMTP Settings //--------------------> // smtp // TODO-t: test it for all types $MAIL_SSL_OPTIONS_GMAIL = get_select_options_with_id($app_list_strings['email_settings_for_ssl'], '2'); //$MAIL_SSL_OPTIONS_YAHOO = get_select_options_with_id($app_list_strings['email_settings_for_ssl'], '1'); $MAIL_SSL_OPTIONS_EXCHG = get_select_options_with_id($app_list_strings['email_settings_for_ssl'], 'none'); $MAIL_SSL_OPTIONS_OTHER = get_select_options_with_id($app_list_strings['email_settings_for_ssl'], 'none'); // set default notify_allow_default_outbound checkbox value $notify_allow_default_outbound_checked = empty($_SESSION['notify_allow_default_outbound']) ? '' : ' checked="checked" '; // set default smtp toggle buttons selected value if (empty($_SESSION['smtp_tab_selected'])) { $_SESSION['smtp_tab_selected'] = 'smtp_tab_other'; } $out .= <<<EOQ <div class="floatbox full" id="fb2"> <!-- smtp settings --> <h3 onclick="\$(this).next().toggle();" class="toggler">» {$mod_strings['LBL_MAIL_SMTP_SETTINGS']}</h3> <div style="display: none;"> <br> <!-- <p>{$mod_strings['LBL_WIZARD_SMTP_DESC']}</p> --> <!-- smtp types toggler buttons --> <p style="display: inline;">{$mod_strings['LBL_CHOOSE_EMAIL_PROVIDER']} </p><div class="tooltip-toggle"> <em>i</em> <div class="tooltip">{$mod_strings['LBL_WIZARD_SMTP_DESC']}</div></div> <div class="clear"></div> <div> <input type="button" class="smtp_tab_toggler" id="smtp_tab_gmail_toggler" for="smtp_tab_gmail" value="{$mod_strings['LBL_SMTPTYPE_GMAIL']}" /> <input type="button" class="smtp_tab_toggler" id="smtp_tab_yahoo_toggler" for="smtp_tab_yahoo" value="{$mod_strings['LBL_SMTPTYPE_YAHOO']}" /> <input type="button" class="smtp_tab_toggler" id="smtp_tab_exchange_toggler" for="smtp_tab_exchange" value="{$mod_strings['LBL_SMTPTYPE_EXCHANGE']}" /> <input type="button" class="smtp_tab_toggler selected" id="smtp_tab_other_toggler" for="smtp_tab_other" value="{$mod_strings['LBL_SMTPTYPE_OTHER']}" /> <input type="hidden" name="smtp_tab_selected" value="{$_SESSION['smtp_tab_selected']}"> </div> <!-- smtp / gmail tab --> <div class="form_section smtp_tab" id="smtp_tab_gmail"> <div class="formrow"> <label>{$mod_strings['LBL_MAIL_SMTPSERVER']}</label> <input type="text" name="smtp_tab_gmail[mail_smtpserver]" size="25" maxlength="64" value="smtp.gmail.com"> </div> <div class="formrow"> <label>{$mod_strings['LBL_MAIL_SMTPPORT']}</label> <input type="text" name="smtp_tab_gmail[mail_smtpport]" size="5" maxlength="5" value="587"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_MAIL_SMTPAUTH_REQ']}</label> <input type="checkbox" name="smtp_tab_gmail[mail_smtpauth_req]" id="smtp_tab_gmail__mail_smtpauth_req" value="1" checked="checked" onclick="toggleSMTPAuthSettings(this, 'toggleArea_1');"> </div> <div class="formrow"> <label>{$mod_strings['LBL_EMAIL_SMTP_SSL_OR_TLS']}</label> <select name="smtp_tab_gmail[mail_smtpssl]"> {$MAIL_SSL_OPTIONS_GMAIL} </select> </div> <div class="clear"></div> <div class="toggleArea" id="toggleArea_1"> <div class="formrow"> <label>{$mod_strings['LBL_GMAIL_SMTPUSER']}</label> <input type="text" name="smtp_tab_gmail[mail_smtpuser]" id="smtp_tab_gmail__mail_smtpuser" size="25" maxlength="64"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_GMAIL_SMTPPASS']}</label> <input type="password" name="smtp_tab_gmail[mail_smtppass]" id="smtp_tab_gmail__mail_smtppass" size="25" maxlength="64" value="" tabindex="1"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION']} <i>i<div class="tooltip">{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION_HELP']}</div></i></label> <input name="smtp_tab_gmail[notify_allow_default_outbound]" id="smtp_tab_gmail__notify_allow_default_outbound" value="2" tabindex="1" class="checkbox" type="checkbox" {$notify_allow_default_outbound_checked}> </div> </div> <div class="clear"></div> </div> <!-- smtp / yahoo! mail tab --> <div class="form_section smtp_tab" id="smtp_tab_yahoo"> <input type="hidden" name="smtp_tab_yahoo[mail_smtpserver]" size="25" maxlength="64" value="smtp.mail.yahoo.com"> <input type="text" name="smtp_tab_yahoo[mail_smtpport]" size="5" maxlength="5" value="465"> <input type="hidden" name="smtp_tab_yahoo[mail_smtpssl]" value="1"> <div class="formrow"> <label>{$mod_strings['LBL_YAHOOMAIL_SMTPUSER']}</label> <input type="text" name="smtp_tab_yahoo[mail_smtpuser]" size="25" maxlength="64"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_YAHOOMAIL_SMTPPASS']}</label> <input type="password" name="smtp_tab_yahoo[mail_smtppass]" size="25" maxlength="64" value="" tabindex="1"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION']} <i>i<div class="tooltip">{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION_HELP']}</div></i></label> <input name="smtp_tab_yahoo[notify_allow_default_outbound]" value="2" tabindex="1" class="checkbox" type="checkbox" {$notify_allow_default_outbound_checked}> </div> <div class="clear"></div> </div> <!-- smtp / ms-exchange tab --> <div class="form_section smtp_tab" id="smtp_tab_exchange"> <div class="formrow"> <label>{$mod_strings['LBL_EXCHANGE_SMTPSERVER']}</label> <input type="text" name="smtp_tab_exchange[mail_smtpserver]" size="25" maxlength="64" value=""> </div> <div class="formrow"> <label>{$mod_strings['LBL_EXCHANGE_SMTPPORT']}</label> <input type="text" name="smtp_tab_exchange[mail_smtpport]" size="5" maxlength="5" value="25"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_MAIL_SMTPAUTH_REQ']}</label> <input type="checkbox" name="smtp_tab_exchange[mail_smtpauth_req]" id="smtp_tab_exchange__mail_smtpauth_req" value="1" checked="checked" onclick="toggleSMTPAuthSettings(this, 'toggleArea_2');"> </div> <div class="formrow"> <label>{$mod_strings['LBL_EMAIL_SMTP_SSL_OR_TLS']}</label> <select name="smtp_tab_exchange[mail_smtpssl]" tabindex="501"> {$MAIL_SSL_OPTIONS_EXCHG} </select> </div> <div class="clear"></div> <div class="toggleArea" id="toggleArea_2"> <div class="formrow"> <label>{$mod_strings['LBL_EXCHANGE_SMTPUSER']}</label> <input type="text" name="smtp_tab_exchange[mail_smtpuser]" id="smtp_tab_exchange__mail_smtpuser" size="25" maxlength="64"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_EXCHANGE_SMTPPASS']}</label> <input type="password" name="smtp_tab_exchange[mail_smtppass]" id="smtp_tab_exchange__mail_smtppass" size="25" maxlength="64" value="" tabindex="1"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION']} <i>i<div class="tooltip">{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION_HELP']}</div></i></label> <input name="smtp_tab_exchange[notify_allow_default_outbound]" id="smtp_tab_exchange__notify_allow_default_outbound" value="2" tabindex="1" class="checkbox" type="checkbox" {$notify_allow_default_outbound_checked}> </div> </div> <div class="clear"></div> </div> <!-- smtp / other tab--> <div class="form_section smtp_tab" id="smtp_tab_other"> <div class="formrow"> <label>{$mod_strings['LBL_MAIL_SMTPSERVER']}</label> <input type="text" name="smtp_tab_other[mail_smtpserver]" size="25" maxlength="64" value=""> </div> <div class="formrow"> <label>{$mod_strings['LBL_MAIL_SMTPPORT']}</label> <input type="text" name="smtp_tab_other[mail_smtpport]" size="5" maxlength="5" value="25"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_MAIL_SMTPAUTH_REQ']}</label> <input type="hidden" name="smtp_tab_other[mail_smtpauth_req]" value="0"> <input type="checkbox" id="mail_smtpauth_req_chk" name="smtp_tab_other[mail_smtpauth_req]" value="1" checked="checked" onclick="toggleSMTPAuthSettings(this, 'toggleArea_3');"> </div> <div class="formrow"> <label>{$mod_strings['LBL_EMAIL_SMTP_SSL_OR_TLS']}</label> <select name="smtp_tab_other[mail_smtpssl]" tabindex="501"> {$MAIL_SSL_OPTIONS_OTHER} </select> </div> <div class="clear"></div> <div class="toggleArea" id="toggleArea_3"> <div class="formrow"> <label>{$mod_strings['LBL_MAIL_SMTPUSER']}</label> <input type="text" name="smtp_tab_other[mail_smtpuser]" id="smtp_tab_other__mail_smtpuser" size="25" maxlength="64"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_MAIL_SMTPPASS']}</label> <input type="password" name="smtp_tab_other[mail_smtppass]" id="smtp_tab_other__mail_smtppass" size="25" maxlength="64" value="" tabindex="1"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION']} <i>i<div class="tooltip">{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION_HELP']}</div></i></label> <input type="hidden" name="smtp_tab_other[notify_allow_default_outbound]" value="0"> <input id="notify_allow_default_outbound_chk" name="smtp_tab_other[notify_allow_default_outbound]" value="2" tabindex="1" class="checkbox" type="checkbox" {$notify_allow_default_outbound_checked}> </div> </div> <div class="clear"></div> <!-- </div> --> <!-- smtp default values & tabs toggler js & tooltip help --> <script> var toggleSMTPAuthFields = { toggleArea_1 : { user: '******', pass: '******', allow: 'smtp_tab_gmail__notify_allow_default_outbound' }, toggleArea_2 : { user: '******', pass: '******', allow: 'smtp_tab_exchange__notify_allow_default_outbound' }, toggleArea_3 : { user: '******', pass: '******', allow: 'notify_allow_default_outbound_chk' } }; var toggleSMTPAuthSettings = function(chkbox, elemID) { if(\$(chkbox).prop('checked')) { \$('#' + elemID).show(); } else { \$('#' + toggleSMTPAuthFields[elemID].user).val(''); \$('#' + toggleSMTPAuthFields[elemID].pass).val(''); \$('#' + toggleSMTPAuthFields[elemID].allow).prop('checked', false); \$('#' + elemID).hide(); } }; \$(function(){ \$('.smtp_tab_toggler').click(function(){ \$('.smtp_tab_toggler.selected').removeClass('selected'); \$(this).addClass('selected'); \$('.smtp_tab').hide(); \$('#'+\$(this).attr('for')).show(); \$('input[name="smtp_tab_selected"]').val(\$(this).attr('for')); }); // save last selected tab and set as default when form (re)load \$('#{$_SESSION['smtp_tab_selected']}_toggler').click(); \$('select[name="smtp_tab_gmail[mail_smtpssl]"] option').each(function(){ if(!\$(this).html()) { \$(this).html('-none-'); } }); \$('select[name="smtp_tab_yahoo[mail_smtpssl]"] option').each(function(){ if(!\$(this).html()) { \$(this).html('-none-'); } }); \$('select[name="smtp_tab_exchange[mail_smtpssl]"] option').each(function(){ if(!\$(this).html()) { \$(this).html('-none-'); } }); \$('select[name="smtp_tab_other[mail_smtpssl]"] option').each(function(){ if(!\$(this).html()) { \$(this).html('-none-'); } }); toggleSMTPAuthSettings(document.getElementById('smtp_tab_gmail__mail_smtpauth_req'), 'toggleArea_1'); toggleSMTPAuthSettings(document.getElementById('smtp_tab_exchange__mail_smtpauth_req'), 'toggleArea_2'); toggleSMTPAuthSettings(document.getElementById('mail_smtpauth_req_chk'), 'toggleArea_3'); }); </script> </div> <!-- toggle hidden box end --> EOQ; // db setup (dbConfig_a.php) $out2 = <<<EOQ2 <input type='hidden' name='setup_db_drop_tables' id='setup_db_drop_tables' value=''> </div> EOQ2; // ---------- // Branding // -------------> // company logo $currentLogoLink = SugarThemeRegistry::current()->getImageURL('company_logo.png'); // show logo if we have $hiddenLogo = ''; if (!file_exists($currentLogoLink)) { $hiddenLogo = 'display:none;'; } // TODO--low: check the tooltip text at the logo image! $out .= <<<EOQ <!-- Branding --> </div> </div> <div class="floatbox full" id="fb3"> <h3 onclick="\$(this).next().toggle();" class="toggler">» {$mod_strings['LBL_WIZARD_SYSTEM_TITLE']}</h3> <div class="form_section" style="display: none;"> <p class="ibmsg">{$mod_strings['LBL_WIZARD_SYSTEM_DESC']}</p> <p class="ibmsg">{$mod_strings['LBL_SITECFG_SYS_NAME_MSG']}</p> <div class="formrow"> <label>{$mod_strings['SYSTEM_NAME_WIZARD']} <i>i<div class="tooltip">{$mod_strings['SYSTEM_NAME_HELP']}</div></i></label> <input type="text" name="setup_system_name" size="25" maxlength="64" value="{$_SESSION['setup_system_name']}"> </div> <div class="clear"></div> <div class="formrow"> <!-- file upload --> <label>{$mod_strings['NEW_LOGO']} <i>i<div class="tooltip">{$mod_strings['NEW_LOGO_HELP']}</div></i></label> <input type="file" name="company_logo" id="company_logo"> </div> <div class="clear"></div> <div class="formrow"> <label> </label> <input type="button" name="company_logo_upload_btn" value="{$mod_strings['COMPANY_LOGO_UPLOAD_BTN']}" onclick="onUploadImageClick(this);"> </div> <div class="clear"></div> <div class="formrow" id="current_logo_row"> <label>{$mod_strings['CURRENT_LOGO']} <i>i<div class="tooltip">{$mod_strings['CURRENT_LOGO_HELP']}</div></i> </label> <img height="100" src="{$currentLogoLink}" alt="Company Logo" style="max-height: 100px; max-width: 230px; float:left; {$hiddenLogo}" /> </div> <div class="clear"></div> </div> EOQ; // System location defaults // TODO--low: 1000s sep, Decimal Symb, Name Format $defaultDateFormatSelect = self::getSelect('default_date_format', $sugarConfigDefaults['date_formats'], empty($_SESSION['default_date_format']) ? $sugarConfigDefaults['default_date_format'] : $_SESSION['default_date_format']); $defaultTimeFormatSelect = self::getSelect('default_time_format', $sugarConfigDefaults['time_formats'], empty($_SESSION['default_time_format']) ? 'h:ia' : $_SESSION['default_time_format']); $timezoneSelect = self::getSelect('timezone', array_merge(array(TimeDate::guessTimezone() => TimeDate::guessTimezone()), TimeDate::getTimezoneList()), TimeDate::guessTimezone()); //$defaultLanguageSelect = get_select_options_with_id($supportedLanguages, $current_language); $defaultLanguageSelect = self::getSelect('default_language', $supportedLanguages, $current_language); // example name formats (its are in the original language file so may this functionality was there in the original sugarcrm installer also) $nonDBLocalization = new NonDBLocalization(); $sugarConfigDefaults['name_formats'] = $nonDBLocalization->getUsableLocaleNameOptions($sugarConfigDefaults['name_formats']); $defaultLocalNameFormatSelect = self::getSelect('default_locale_name_format', $sugarConfigDefaults['name_formats'], empty($_SESSION['default_locale_name_format']) ? $sugarConfigDefaults['default_locale_name_format'] : $_SESSION['default_locale_name_format']); $out .= <<<EOQ </div> <!-- System Local Settings --> <!-- TODO--low: add the time-zone settings here!! --> <div class="floatbox full" id="fb4"> <h3 onclick="\$(this).next().toggle();" class="toggler">» {$mod_strings['LBL_LOCALE_TITLE']}</h3> <div class="form_section" style="display: none;"> <p class="ibmsg">{$mod_strings['LBL_WIZARD_LOCALE_DESC']}</p> <div class="formrow"> <label>{$mod_strings['LBL_DATE_FORMAT']}</label> {$defaultDateFormatSelect} </div> <div class="formrow"> <label>{$mod_strings['LBL_TIME_FORMAT']}</label> {$defaultTimeFormatSelect} </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_TIMEZONE']}</label> {$timezoneSelect} </div> <div class="clear"></div> <div class="formrow" style="display: none;"> <label>{$mod_strings['LBL_LANGUAGE']}</label> {$defaultLanguageSelect} </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_CURRENCY']}</label> <input type="text" name="default_currency_name" value="{$sugarConfigDefaults['default_currency_name']}"> </div> <div class="formrow"> <label>{$mod_strings['LBL_CURRENCY_SYMBOL']}</label> <input type="text" name="default_currency_symbol" size="4" value="{$sugarConfigDefaults['default_currency_symbol']}"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_CURRENCY_ISO4217']}</label> <input type="text" name="default_currency_iso4217" size="4" value="{$sugarConfigDefaults['default_currency_iso4217']}"> </div> <!-- <div class="formrow"> <label>{$mod_strings['LBL_NUMBER_GROUPING_SEP']}</label> <input type="text" name="default_number_grouping_seperator" size="3" maxlength="1" value="{$sugarConfigDefaults['default_number_grouping_seperator']}"> </div> <div class="formrow"> <label>{$mod_strings['LBL_DECIMAL_SEP']}</label> <input type="text" name="default_decimal_seperator" size="3" maxlength="1" value="{$sugarConfigDefaults['default_decimal_seperator']}"> </div> <div class="clear"></div> <div class="formrow"> <label>{$mod_strings['LBL_NAME_FORMAT']}</label> {$defaultLocalNameFormatSelect} </div> --> <div class="clear"></div> </div> </div> EOQ; $out .= "<div class=\"floatbox full\">"; $out .= " <h3 onclick=\"\$(this).next().toggle();\" class=\"toggler\">» {$mod_strings['LBL_SITECFG_SECURITY_TITLE']}</h3>"; $out .= <<<EOQ <div class="security-block" style="display:none;"> <table cellspacing="0" cellpadding="0" border="0" align="center" class="shell"> <tr><td colspan="2" id="help"><!-- <a href="{$help_url}" target='_blank'>{$mod_strings['LBL_HELP']} </a> --></td></tr> <tr> <th width="500"> </th> <th width="200" style="text-align: right;"> </th> </tr> <tr> <td colspan="2"> {$errors} <div class="required">{$mod_strings['LBL_REQUIRED']}</div> <table width="100%" cellpadding="0" cellpadding="0" border="0" class="StyleDottedHr"> <tr><th colspan="3" align="left">{$mod_strings['LBL_SITECFG_SITE_SECURITY']}</td></tr> EOQ; $checked = ''; //if(!empty($_SESSION['setup_site_sugarbeet_anonymous_stats'])) $checked = 'checked=""'; $out .= "\n <tr style='display:none'><td></td>\n <td><input type='checkbox' class='checkbox' name='setup_site_sugarbeet_anonymous_stats' value='yes' {$checked} /></td>\n <td><b>{$mod_strings['LBL_SITECFG_ANONSTATS']}</b><br><i>{$mod_strings['LBL_SITECFG_ANONSTATS_DIRECTIONS']}</i></td></tr>\n\n"; $checked = ''; //if(!empty($_SESSION['setup_site_sugarbeet_automatic_checks'])) $checked = 'checked=""'; $out .= <<<EOQ <tr style='display:none'><td></td> <td><input type="checkbox" class="checkbox" name="setup_site_sugarbeet_automatic_checks" value="yes" /></td> <td><b>{$mod_strings['LBL_SITECFG_SUGAR_UP']}</b><br><i>{$mod_strings['LBL_SITECFG_SUGAR_UP_DIRECTIONS']}</i><br> </td></tr> <tbody id="setup_site_session_section_pre"> <tr><td></td> <td><input type="checkbox" class="checkbox" name="setup_site_custom_session_path" value="yes" onclick="javascript:\$('#setup_site_session_section').toggle();" {$customSession} /></td> <td><b>{$mod_strings['LBL_SITECFG_CUSTOM_SESSION']}</b><br> <em>{$mod_strings['LBL_SITECFG_CUSTOM_SESSION_DIRECTIONS']}</em><br> </td> </tr> </tbody> <tbody id="setup_site_session_section" {$customSessionHidden}> <tr><td></td> <td style="text-align : right;"></td> <td align="left"> \t <div><div style="width:200px;float:left">{$mod_strings['LBL_SITECFG_SESSION_PATH']} <span class="required">*</span></div> \t <input type="text" name="setup_site_session_path" size='40' value="{$_SESSION['setup_site_session_path']}" /></td> \t </div> </td> </tr> </tbody> <tbody id="setup_site_log_dir_pre"> <tr><td></td> <td><input type="checkbox" class="checkbox" name="setup_site_custom_log_dir" value="yes" onclick="javascript:\$('#setup_site_log_dir').toggle();" {$customLog} /></td> <td><b>{$mod_strings['LBL_SITECFG_CUSTOM_LOG']}</b><br> <em>{$mod_strings['LBL_SITECFG_CUSTOM_LOG_DIRECTIONS']}</em><br> </td> </tr> </tbody> <tbody id="setup_site_log_dir" {$customLogHidden}> <tr><td></td> <td style="text-align : right;" ></td> <td align="left"> <div><div style="width:200px;float:left">{$mod_strings['LBL_SITECFG_LOG_DIR']} <span class="required">*</span></div> <input type="text" name="setup_site_log_dir" size='30' value="{$_SESSION['setup_site_log_dir']}" /> </div> </tr> </tbody> <tbody id="setup_site_guid_section_pre"> <tr><td></td> <td><input type="checkbox" class="checkbox" name="setup_site_specify_guid" value="yes" onclick="javascript:\$('#setup_site_guid_section').toggle();" {$customId} /></td> <td><b>{$mod_strings['LBL_SITECFG_CUSTOM_ID']}</b><br> <em>{$mod_strings['LBL_SITECFG_CUSTOM_ID_DIRECTIONS']}</em><br> </td> </tr> </tbody> <tbody id="setup_site_guid_section" {$customIdHidden}> <tr><td></td> <td style="text-align : right;"></td> <td align="left"> \t <div><div style="width:200px;float:left">{$mod_strings['LBL_SITECFG_APP_ID']} <span class="required">*</span></div> \t <input type="text" name="setup_site_guid" size='30' value="{$_SESSION['setup_site_guid']}" /> \t </div> </td> </tr> </tbody> </table> </td> </tr> </table> </div> EOQ; $out .= "</div>"; return $out; }