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 ********************************************************************************/
40 global $sugar_version, $js_custom_version;
43 if(empty($_SESSION['setup_db_host_name'])){
44 $_SESSION['setup_db_host_name'] = (isset($sugar_config['db_host_name'])) ? $sugar_config['db_host_name'] : $_SERVER['SERVER_NAME'];
47 if( !isset( $install_script ) || !$install_script ){
48 die($mod_strings['ERR_NO_DIRECT_SCRIPT']);
53 $createDbCheckbox = '';
54 $createDb = (!empty($_SESSION['setup_db_create_database'])) ? 'checked="checked"' : '';
55 $dropCreate = (!empty($_SESSION['setup_db_drop_tables'])) ? 'checked="checked"' : '';
57 if (isset($_SESSION['setup_db_host_instance']) && !empty($_SESSION['setup_db_host_instance'])){
58 $instanceName = $_SESSION['setup_db_host_instance'];
62 if (isset($_SESSION['setup_db_port_num']) && !empty($_SESSION['setup_db_port_num'])){
63 $setupDbPortNum = $_SESSION['setup_db_port_num'];
66 $db = getInstallDbInstance();
68 ///////////////////////////////////////////////////////////////////////////////
69 //// BEGIN PAGE OUTPUT
71 $langHeader = get_language_header();
74 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
77 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
78 <meta http-equiv="Content-Script-Type" content="text/javascript">
79 <meta http-equiv="Content-Style-Type" content="text/css">
80 <title>{$mod_strings['LBL_WIZARD_TITLE']} {$mod_strings['LBL_DBCONF_TITLE']}</title>
81 <link rel="stylesheet" href="install/install.css" type="text/css" />
82 <script type="text/javascript" src="install/installCommon.js"></script>
83 <script type="text/javascript" src="install/dbConfig.js"></script>
84 <link REL="SHORTCUT ICON" HREF="include/images/sugar_icon.ico">
85 <script src="cache/include/javascript/sugar_grp1_yui.js?s={$sugar_version}&c={$js_custom_version}"></script>
86 <script type="text/javascript">
92 <link rel='stylesheet' type='text/css' href='include/javascript/yui/build/container/assets/container.css' />
96 $out .= '<body onload="document.getElementById(\'button_next2\').focus();">';
99 <form action="install.php" method="post" name="setConfig" id="form">
100 <input type='hidden' name='setup_db_drop_tables' id='setup_db_drop_tables' value=''>
101 <input type="hidden" id="hidden_goto" name="goto" value="{$mod_strings['LBL_BACK']}" />
102 <table cellspacing="0" cellpadding="0" border="0" align="center" class="shell">
104 <tr><td colspan="2" id="help"><a href="{$help_url}" target='_blank'>{$mod_strings['LBL_HELP']} </a></td></tr>
108 <img src="{$sugar_md}" alt="SugarCRM" border="0">
110 {$mod_strings['LBL_DBCONF_TITLE']}
112 <th width="200" height="30" style="text-align: right;"><a href="http://www.sugarcrm.com" target="_blank">
113 <IMG src="include/images/sugarcrm_login.png" width="145" height="30" alt="SugarCRM" border="0"></a>
118 <div id="errorMsgs" style="display:none"></div>
119 <div class="required">{$mod_strings['LBL_REQUIRED']}</div>
120 <table width="100%" cellpadding="0" cellpadding="0" border="0" class="StyleDottedHr">
121 <tr><th colspan="3" align="left" >{$mod_strings['LBL_DBCONF_TITLE_NAME']} </td></tr>
125 $config_params = $db->installConfig();
127 foreach($config_params as $group => $gdata) {
128 $form .= "<tr><td colspan=\"3\" align=\"left\">{$mod_strings[$group]}</td></tr>\n";
129 foreach($gdata as $name => $value) {
132 if(!empty($value['required'])) {
133 $form .= "<td><span class=\"required\">*</span></td>\n";
135 $form .= "<td> </td>\n";
137 if(!empty($_SESSION[$name])) {
138 $sessval = $_SESSION[$name];
142 if(!empty($value["type"])) {
143 $type = $value["type"];
148 <td nowrap><b>{$mod_strings[$value["label"]]}</b></td>
150 <input type="$type" name="$name" id="$name" value="$sessval">
154 $form .= "<input name=\"$name\" id=\"$name\" value=\"\" type=\"hidden\">\n";
161 //if we are installing in custom mode, include the following html
162 if($db->supports("create_user")){
163 // create / set db user dropdown
164 $auto_select = '';$provide_select ='';$create_select = '';$same_select = '';
165 if(isset($_SESSION['dbUSRData'])){
166 // if($_SESSION['dbUSRData']=='auto') {$auto_select ='selected';}
167 if($_SESSION['dbUSRData']=='provide') {$provide_select ='selected';}
168 if(isset($_SESSION['install_type']) && !empty($_SESSION['install_type']) && strtolower($_SESSION['install_type'])=='custom'){
169 if($_SESSION['dbUSRData']=='create') {$create_select ='selected';}
171 if($_SESSION['dbUSRData']=='same') {$same_select ='selected';}
173 $same_select ='selected';
175 $dbUSRDD = "<select name='dbUSRData' id='dbUSRData' onchange='toggleDBUser();'>";
176 $dbUSRDD .= "<option value='provide' $provide_select>".$mod_strings['LBL_DBCONFIG_PROVIDE_DD']."</option>";
177 $dbUSRDD .= "<option value='create' $create_select>".$mod_strings['LBL_DBCONFIG_CREATE_DD']."</option>";
178 $dbUSRDD .= "<option value='same' $same_select>".$mod_strings['LBL_DBCONFIG_SAME_DD']."</option>";
179 $dbUSRDD .= "</select><br> ";
186 <table width="100%" cellpadding="0" cellpadding="0" border="0" class="StyleDottedHr">
187 <tr><td colspan="3" align="left"><br>{$mod_strings['LBL_DBCONFIG_SECURITY']}</td></tr>
188 <tr><td width='1%'> </td><td width='60%'><div id='sugarDBUser'><b>{$mod_strings['LBL_DBCONF_SUGAR_DB_USER']}</b></div> </td><td width='35%'>$dbUSRDD</td></tr>
191 <span id='connection_user_div' style="display:none">
192 <table width="100%" cellpadding="0" cellpadding="0" border="0" class="StyleDottedHr">
194 <td width='1%'><span class="required">*</span></td>
195 <td nowrap width='60%'><b>{$mod_strings['LBL_DBCONF_SUGAR_DB_USER']}</b></td>
196 <td width='35%'nowrap align="left">
197 <input type="text" name="setup_db_sugarsales_user" maxlength="16" value="{$_SESSION['setup_db_sugarsales_user']}" />
202 <td nowrap><b>{$mod_strings['LBL_DBCONF_DB_PASSWORD']}</b></td>
203 <td nowrap align="left"><input type="password" name="setup_db_sugarsales_password" value="{$_SESSION['setup_db_sugarsales_password']}" /></td>
207 <td nowrap><b>{$mod_strings['LBL_DBCONF_DB_PASSWORD2']}</b></td>
208 <td nowrap align="left"><input type="password" name="setup_db_sugarsales_password_retype" value="{$_SESSION['setup_db_sugarsales_password_retype']}" /></td>
216 //$supported_demodata = array(
217 // 'en_us' => 'English (US)',
218 // 'zh_cn' => '简体中文',
219 // 'ja_jp' => 'Japanese - 日本語',
221 $demoDD = "<select name='demoData' id='demoData'><option value='no' >".$mod_strings['LBL_NO']."</option><option value='yes'>".$mod_strings['LBL_YES']."</option>";
222 $demoDD .= "</select><br> ";
226 <table width="100%" cellpadding="0" cellpadding="0" border="0" class="StyleDottedHr">
227 <tr><th colspan="3" align="left">{$mod_strings['LBL_DBCONF_DEMO_DATA_TITLE']}</th></tr>
229 <td width='1%'> </td>
230 <td width='60%'nowrap><b>{$mod_strings['LBL_DBCONF_DEMO_DATA']}</b></td>
231 <td width='35%'nowrap align="left">
243 <td align="right" colspan="2">
245 <input type="hidden" name="current_step" value="{$next_step}">
246 <table cellspacing="0" cellpadding="0" border="0" class="stdTable">
249 <input class="button" type="button" name="goto" value="{$mod_strings['LBL_BACK']}" id="button_back_dbConfig" onclick="document.getElementById('form').submit();" />
252 <input class="button" type="button" name="goto" id="button_next2" value="{$mod_strings['LBL_NEXT']}" onClick="callDBCheck();"/>
263 function toggleDBUser(){
264 if(typeof(document.getElementById('dbUSRData')) !='undefined'
265 && document.getElementById('dbUSRData') != null){
267 ouv = document.getElementById('dbUSRData').value;
268 if(ouv == 'provide' || ouv == 'create'){
269 document.getElementById('connection_user_div').style.display = '';
270 document.getElementById('sugarDBUser').style.display = 'none';
272 document.getElementById('connection_user_div').style.display = 'none';
273 document.getElementById('sugarDBUser').style.display = '';
280 function callDBCheck(){
282 //begin main function that will be called
283 ajaxCall = function(msg_panel){
284 //create success function for callback
286 getPanel = function() {
287 var args = { width:"300px",
290 constraintoviewport: false,
295 effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration:.5}
297 msg_panel = new YAHOO.widget.Panel('p_msg', args);
299 msg_panel.setHeader("{$mod_strings['LBL_LICENSE_CHKDB_HEADER']}");
300 msg_panel.setBody(document.getElementById("checkingDiv").innerHTML);
301 msg_panel.render(document.body);
302 msgPanel = msg_panel;
306 passed = function(url){
307 document.setConfig.goto.value="{$mod_strings['LBL_NEXT']}";
308 document.getElementById('hidden_goto').value="{$mod_strings['LBL_NEXT']}";
309 document.setConfig.current_step.value="{$next_step}";
310 document.setConfig.submit();
312 success = function(o) {
314 //condition for just the preexisting database
315 if (o.responseText.indexOf('preexeest')>=0){
317 // throw confirmation message
318 msg_panel.setBody(document.getElementById("sysCheckMsg").innerHTML);
319 msg_panel.render(document.body);
320 msgPanel = msg_panel;
321 document.getElementById('accept_btn').focus();
322 //condition for no errors
323 }else if (o.responseText.indexOf('dbCheckPassed')>=0){
325 passed("install.php?goto={$mod_strings['LBL_NEXT']}");
327 //condition for other errors
329 //turn off loading message
331 document.getElementById("errorMsgs").innerHTML = o.responseText;
332 document.getElementById("errorMsgs").style.display = '';
339 //set loading message and create url
341 postData = "checkDBSettings=true&to_pdf=1&sugar_body_only=1";
342 postData += "&setup_db_database_name="+document.setConfig.setup_db_database_name.value;
343 if(typeof(document.setConfig.setup_db_host_instance) != 'undefined'){
344 postData += "&setup_db_host_instance="+document.setConfig.setup_db_host_instance.value;
346 if(typeof(document.setConfig.setup_db_port_num) != 'undefined'){
347 postData += "&setup_db_port_num="+document.setConfig.setup_db_port_num.value;
349 postData += "&setup_db_host_name="+document.setConfig.setup_db_host_name.value;
350 postData += "&setup_db_admin_user_name="+document.setConfig.setup_db_admin_user_name.value;
351 postData += "&setup_db_admin_password="+document.setConfig.setup_db_admin_password.value;
352 if(typeof(document.setConfig.setup_db_sugarsales_user) != 'undefined'){
353 postData += "&setup_db_sugarsales_user="+document.setConfig.setup_db_sugarsales_user.value;
355 if(typeof(document.setConfig.setup_db_sugarsales_password) != 'undefined'){
356 postData += "&setup_db_sugarsales_password="+document.setConfig.setup_db_sugarsales_password.value;
358 if(typeof(document.setConfig.setup_db_sugarsales_password_retype) != 'undefined'){
359 postData += "&setup_db_sugarsales_password_retype="+document.setConfig.setup_db_sugarsales_password_retype.value;
361 if(typeof(document.setConfig.dbUSRData) != 'undefined'){
362 postData += "&dbUSRData="+document.getElementById('dbUSRData').value;
367 $out_dd = 'postData += "&demoData="+document.setConfig.demoData.value;';
369 postData += "&to_pdf=1&sugar_body_only=1";
371 //if this is a call already in progress, then just return
372 if(typeof ajxProgress != 'undefined'){
378 var ajxProgress = YAHOO.util.Connect.asyncRequest('POST','install.php', {success: success, failure: success}, postData);
381 };//end ajaxCall method
386 function confirm_drop_tables(yes_no){
389 document.getElementById('setup_db_drop_tables').value = true;
391 document.setConfig.goto.value="{$mod_strings['LBL_NEXT']}";
392 document.getElementById('hidden_goto').value="{$mod_strings['LBL_NEXT']}";
393 document.setConfig.current_step.value="{$next_step}";
394 document.setConfig.submit();
396 //set drop tables to false
397 document.getElementById('setup_db_drop_tables').value = false;
406 <div id="checkingDiv" style="display:none">
407 <table cellspacing="0" cellpadding="0" border="0">
409 <p><img alt="{$mod_strings['LBL_LICENSE_CHKDB_HEADER']}" src='install/processing.gif'> <br>{$mod_strings['LBL_LICENSE_CHKDB_HEADER']}</p>
414 <div id='sysCheckMsg' style="display:none">
415 <table cellspacing="0" cellpadding="0" border="0" >
417 <p>{$mod_strings['LBL_DROP_DB_CONFIRM']}</p>
419 <tr><td align='center'>
420 <input id='accept_btn' type='button' class='button' onclick='confirm_drop_tables(true)' value="{$mod_strings['LBL_ACCEPT']}">
421 <input type='button' class='button' onclick='confirm_drop_tables(false)' id="button_cancel_dbConfig" value="{$mod_strings['LBL_CANCEL']}">
439 ///////////////////////////////////////////////////////////////////////////////