2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
38 /*********************************************************************************
40 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
41 * All Rights Reserved.
42 * Contributor(s): ______________________________________..
43 ********************************************************************************/
45 require_once('modules/Users/Forms.php');
46 require_once('modules/Configurator/Configurator.php');
49 * ViewWireless_Login extends SugarWirelessView and is the login view.
51 class ViewWizard extends SugarView
54 * Constructor for the view, it runs the constructor of SugarWirelessView and
55 * sets the footer option to true (it is off in the SugarWirelessView constructor)
57 public function __construct()
61 $this->options['show_header'] = false;
62 $this->options['show_footer'] = false;
63 $this->options['show_javascript'] = false;
67 * @see SugarView::display()
69 public function display()
71 global $mod_strings, $current_user, $locale, $sugar_config, $app_list_strings, $sugar_version;
73 $themeObject = SugarThemeRegistry::current();
74 $css = $themeObject->getCSS();
75 $this->ss->assign('SUGAR_CSS', $css);
76 $favicon = $themeObject->getImageURL('sugar_icon.ico',false);
77 $this->ss->assign('FAVICON_URL',getJSPath($favicon));
78 $this->ss->assign('CSS', '<link rel="stylesheet" type="text/css" href="'.SugarThemeRegistry::current()->getCSSURL('wizard.css').'" />');
79 $this->ss->assign('JAVASCRIPT',user_get_validate_record_js().user_get_chooser_js().user_get_confsettings_js());
80 $this->ss->assign('PRINT_URL', 'index.php?'.$GLOBALS['request_string']);
81 $this->ss->assign('SKIP_WELCOME',isset($_REQUEST['skipwelcome']) && $_REQUEST['skipwelcome'] == 1);
82 $this->ss->assign('ID', $current_user->id);
83 $this->ss->assign('USER_NAME', $current_user->user_name);
84 $this->ss->assign('FIRST_NAME', $current_user->first_name);
85 $this->ss->assign('SUGAR_VERSION', $sugar_version);
86 $this->ss->assign('LAST_NAME', $current_user->last_name);
87 $this->ss->assign('TITLE', $current_user->title);
88 $this->ss->assign('DEPARTMENT', $current_user->department);
89 $this->ss->assign('REPORTS_TO_ID', $current_user->reports_to_id);
90 $this->ss->assign('REPORTS_TO_NAME', $current_user->reports_to_name);
91 $this->ss->assign('PHONE_HOME', $current_user->phone_home);
92 $this->ss->assign('PHONE_MOBILE', $current_user->phone_mobile);
93 $this->ss->assign('PHONE_WORK', $current_user->phone_work);
94 $this->ss->assign('PHONE_OTHER', $current_user->phone_other);
95 $this->ss->assign('PHONE_FAX', $current_user->phone_fax);
96 $this->ss->assign('EMAIL1', $current_user->email1);
97 $this->ss->assign('EMAIL2', $current_user->email2);
98 $this->ss->assign('ADDRESS_STREET', $current_user->address_street);
99 $this->ss->assign('ADDRESS_CITY', $current_user->address_city);
100 $this->ss->assign('ADDRESS_STATE', $current_user->address_state);
101 $this->ss->assign('ADDRESS_POSTALCODE', $current_user->address_postalcode);
102 $this->ss->assign('ADDRESS_COUNTRY', $current_user->address_country);
103 $configurator = new Configurator();
104 if ( $configurator->config['passwordsetting']['SystemGeneratedPasswordON']
105 || $configurator->config['passwordsetting']['forgotpasswordON'] )
106 $this->ss->assign('REQUIRED_EMAIL_ADDRESS','1');
108 $this->ss->assign('REQUIRED_EMAIL_ADDRESS','0');
112 $this->options['show_javascript'] = true;
113 $this->renderJavascript();
114 $this->options['show_javascript'] = false;
115 $this->ss->assign("SUGAR_JS",ob_get_contents().$themeObject->getJS());
118 $messenger_type = '<select tabindex="5" name="messenger_type">';
119 $messenger_type .= get_select_options_with_id($app_list_strings['messenger_type_dom'], $current_user->messenger_type);
120 $messenger_type .= '</select>';
121 $this->ss->assign('MESSENGER_TYPE_OPTIONS', $messenger_type);
122 $this->ss->assign('MESSENGER_ID', $current_user->messenger_id);
124 // set default settings
125 $use_real_names = $current_user->getPreference('use_real_names');
126 if ( empty($use_real_names) )
127 $current_user->setPreference('use_real_names', 'on');
128 $current_user->setPreference('reminder_time', 1800);
129 $current_user->setPreference('mailmerge_on', 'on');
132 if(empty($current_user->id)) { // remove default timezone for new users(set later)
133 $current_user->user_preferences['timezone'] = '';
136 $userTZ = $current_user->getPreference('timezone');
137 if(empty($userTZ) && !$current_user->is_group && !$current_user->portal_only) {
138 $userTZ = TimeDate::guessTimezone();
139 $current_user->setPreference('timezone', $userTZ);
142 if(!$current_user->getPreference('ut')) {
143 $this->ss->assign('PROMPTTZ', ' checked');
146 $this->ss->assign('TIMEZONE_CURRENT', $userTZ);
147 $this->ss->assign('TIMEZONEOPTIONS', TimeDate::getTimezoneList());
149 //// Numbers and Currency display
150 require_once('modules/Currencies/ListCurrency.php');
151 $currency = new ListCurrency();
153 // 10/13/2006 Collin - Changed to use Localization.getConfigPreference
154 // This was the problem- Previously, the "-99" currency id always assumed
155 // to be defaulted to US Dollars. However, if someone set their install to use
156 // Euro or other type of currency then this setting would not apply as the
157 // default because it was being overridden by US Dollars.
158 $cur_id = $locale->getPrecedentPreference('currency', $current_user);
160 $selectCurrency = $currency->getSelectOptions($cur_id);
161 $this->ss->assign("CURRENCY", $selectCurrency);
163 $selectCurrency = $currency->getSelectOptions();
164 $this->ss->assign("CURRENCY", $selectCurrency);
167 $currenciesVars = "";
169 foreach($locale->currencies as $id => $arrVal) {
170 $currenciesVars .= "currencies[{$i}] = '{$arrVal['symbol']}';\n";
173 $currencySymbolsJs = <<<eoq
174 var currencies = new Object;
176 function setSymbolValue(id) {
177 document.getElementById('symbol').value = currencies[id];
180 $this->ss->assign('currencySymbolJs', $currencySymbolsJs);
183 // fill significant digits dropdown
184 $significantDigits = $locale->getPrecedentPreference('default_currency_significant_digits', $current_user);
186 for($i=0; $i<=6; $i++) {
187 if($significantDigits == $i) {
188 $sigDigits .= "<option value=\"$i\" selected=\"true\">$i</option>";
190 $sigDigits .= "<option value=\"$i\">{$i}</option>";
194 $this->ss->assign('sigDigits', $sigDigits);
196 $num_grp_sep = $current_user->getPreference('num_grp_sep');
197 $dec_sep = $current_user->getPreference('dec_sep');
198 $this->ss->assign("NUM_GRP_SEP",(empty($num_grp_sep) ? $sugar_config['default_number_grouping_seperator'] : $num_grp_sep));
199 $this->ss->assign("DEC_SEP",(empty($dec_sep) ? $sugar_config['default_decimal_seperator'] : $dec_sep));
200 $this->ss->assign('getNumberJs', $locale->getNumberJs());
202 //// Name display format
203 $this->ss->assign('default_locale_name_format', $locale->getLocaleFormatMacro($current_user));
204 $this->ss->assign('getNameJs', $locale->getNameJs());
206 $this->ss->assign('TIMEOPTIONS', get_select_options_with_id($sugar_config['time_formats'], $current_user->_userPreferenceFocus->getDefaultPreference('default_time_format')));
207 $this->ss->assign('DATEOPTIONS', get_select_options_with_id($sugar_config['date_formats'], $current_user->_userPreferenceFocus->getDefaultPreference('default_date_format')));
208 $this->ss->assign("MAIL_SENDTYPE", get_select_options_with_id($app_list_strings['notifymail_sendtype'], $current_user->getPreference('mail_sendtype')));
209 $this->ss->assign("NEW_EMAIL", $current_user->emailAddress->getEmailAddressWidgetEditView($current_user->id, $current_user->module_dir));
210 $this->ss->assign('EMAIL_LINK_TYPE', get_select_options_with_id($app_list_strings['dom_email_link_type'], $current_user->getPreference('email_link_type')));
212 $this->ss->assign('NAMEOPTIONS', get_select_options_with_id($locale->getPrettyLocaleNameOptions($sugar_config['name_formats']), $current_user->_userPreferenceFocus->getDefaultPreference('default_locale_name_format')));
215 $systemOutboundEmail = new OutboundEmail();
216 $systemOutboundEmail = $systemOutboundEmail->getSystemMailerSettings();
217 $mail_smtpserver = $systemOutboundEmail->mail_smtpserver;
218 $mail_smtptype = $systemOutboundEmail->mail_smtptype;
219 $mail_smtpport = $systemOutboundEmail->mail_smtpport;
220 $mail_smtpssl = $systemOutboundEmail->mail_smtpssl;
221 $mail_smtpdisplay = $systemOutboundEmail->mail_smtpdisplay;
224 $hide_if_can_use_default = true;
225 $mail_smtpauth_req=true;
226 if(!empty($mail_smtpserver) && !empty($mail_smtptype)) {
227 if( !$systemOutboundEmail->isAllowUserAccessToSystemDefaultOutbound() )
230 $mail_smtpauth_req = $systemOutboundEmail->mail_smtpauth_req;
231 $userOverrideOE = $systemOutboundEmail->getUsersMailerForSystemOverride($current_user->id);
232 if($userOverrideOE != null) {
233 $mail_smtpuser = $userOverrideOE->mail_smtpuser;
234 $mail_smtppass = $userOverrideOE->mail_smtppass;
236 if(!$mail_smtpauth_req &&
237 (empty($systemOutboundEmail->mail_smtpserver) || empty($systemOutboundEmail->mail_smtpuser)
238 || empty($systemOutboundEmail->mail_smtppass)))
240 $hide_if_can_use_default = true;
243 $hide_if_can_use_default = false;
248 $isAdmin = is_admin($current_user);
249 $this->ss->assign('IS_ADMIN', $isAdmin);
251 $this->ss->assign("mail_smtpdisplay", $mail_smtpdisplay);
252 $this->ss->assign("mail_smtpuser", $mail_smtpuser);
253 $this->ss->assign("mail_smtppass", $mail_smtppass);
254 $this->ss->assign('mail_smtpserver',$mail_smtpserver);
255 $this->ss->assign("mail_smtpauth_req", $mail_smtpauth_req);
256 $this->ss->assign('MAIL_SMTPPORT',$mail_smtpport);
257 $this->ss->assign('MAIL_SMTPSSL',$mail_smtpssl);
259 $this->ss->assign('HIDE_IF_CAN_USE_DEFAULT_OUTBOUND',$hide_if_can_use_default);
260 $this->ss->assign('langHeader', get_language_header());
261 $this->ss->display('modules/Users/tpls/wizard.tpl');