Fixing js during migration + fixing access_url_rel_course table if multiple_url is not set for courses created in dok€os 185

skala
Julio Montoya 14 years ago
parent f600418212
commit 844a617358
  1. 31
      main/install/install.lib.php
  2. 10
      main/install/update-db-1.8.7-1.8.8.inc.php

@ -1561,9 +1561,16 @@ function display_database_parameter($install_type, $parameter_name, $form_field_
//Slightly limit the length of the database prefix to avoid having to cut down the databases names later on
$maxlength = $form_field_name == 'dbPrefixForm' ? '15' : MAX_FORM_FIELD_LENGTH;
if ($install_type == INSTALL_TYPE_UPDATE) {
echo '<input type="hidden" name="'.$form_field_name.'" id="'.$form_field_name.'" value="'.api_htmlentities($parameter_value).'" />';
echo '<td>'.api_htmlentities($parameter_value)."</td>";
//echo "<td>$extra_notice</td>\n";
} else {
echo '<td><input type="'.$inputtype.'" size="'.DATABASE_FORM_FIELD_DISPLAY_LENGTH.'" maxlength="'.$maxlength.'" name="'.$form_field_name.'" id="'.$form_field_name.'" value="'.api_htmlentities($parameter_value).'" />'."</td>\n";
echo "<td>$extra_notice</td>\n";
}
}
echo "</tr>\n";
}
@ -1659,13 +1666,18 @@ function display_database_settings_form($installType, $dbHostForm, $dbUsernameFo
display_database_parameter($installType, get_lang('DbPrefixForm'), 'dbPrefixForm', $dbPrefixForm, get_lang('DbPrefixCom'));
//fields for the four standard Chamilo databases
echo '<tr><td colspan="3"><a href="" onclick="javascript: show_hide_option();return false;" id="optionalparameters"><img style="vertical-align:middle;" src="../img/div_show.gif" alt="show-hide" /> '.get_lang('OptionalParameters', '').'</a></td></tr>';
if ($installType != INSTALL_TYPE_UPDATE) {
echo '<tr><td colspan="3">';
echo '<a href="" onclick="javascript: show_hide_option();return false;" id="optionalparameters"><img style="vertical-align:middle;" src="../img/div_show.gif" alt="show-hide" /> '.get_lang('OptionalParameters', '').'</a>';
echo '</td></tr>';
}
?>
<input type="hidden" name="enableTrackingForm" value="1" />
<tr id="optional_param6" style="display:none;">
<td><?php echo get_lang('SingleDb'); ?> </td>
<?php if ($installType == 'update'): ?>
<?php if ($installType == INSTALL_TYPE_UPDATE): ?>
<td><input type="hidden" name="singleDbForm" value="<?php echo $singleDbForm; ?>" /><?php echo $singleDbForm ? get_lang('One') : get_lang('Several'); ?></td>
<?php else: ?>
<td>
@ -1678,12 +1690,17 @@ function display_database_settings_form($installType, $dbHostForm, $dbUsernameFo
</tr>
</div>
<?php
display_database_parameter($installType, get_lang('MainDB'), 'dbNameForm', $dbNameForm, '&nbsp;', null, 'id="optional_param1" style="display:none;"');
display_database_parameter($installType, get_lang('StatDB'), 'dbStatsForm', $dbStatsForm, '&nbsp;', null, 'id="optional_param2" style="display:none;"');
if ($installType == 'update' && in_array($_POST['old_version'], $update_from_version_6)) {
display_database_parameter($installType, get_lang('ScormDB'), 'dbScormForm', $dbScormForm, '&nbsp;', null, 'id="optional_param3" style="display:none;"');
$style = 'style="display:none;"';
if ($installType == INSTALL_TYPE_UPDATE) {
$style = '';
}
display_database_parameter($installType, get_lang('MainDB'), 'dbNameForm', $dbNameForm, '&nbsp;', null, 'id="optional_param1" '.$style);
display_database_parameter($installType, get_lang('StatDB'), 'dbStatsForm', $dbStatsForm, '&nbsp;', null, 'id="optional_param2" '.$style);
if ($installType == INSTALL_TYPE_UPDATE && in_array($_POST['old_version'], $update_from_version_6)) {
display_database_parameter($installType, get_lang('ScormDB'), 'dbScormForm', $dbScormForm, '&nbsp;', null, 'id="optional_param3" '.$style);
}
display_database_parameter($installType, get_lang('UserDB'), 'dbUserForm', $dbUserForm, '&nbsp;', null, 'id="optional_param4" style="display:none;"');
display_database_parameter($installType, get_lang('UserDB'), 'dbUserForm', $dbUserForm, '&nbsp;', null, 'id="optional_param4" '.$style);
/* Tracking is always available see #2066
*

@ -335,7 +335,17 @@ if (defined('SYSTEM_INSTALLATION')) {
$sql = "INSERT INTO $dbNameForm.user_field_options (field_id, option_value, option_display_text, option_order) values ($id, '0', 'No',3) ";
$result = Database::query($sql);
//Fixing table access_url_rel_course if the platform have courses that were created in Dok€os 1.8.5
if (!isset($_configuration['multiple_access_urls']) || $_configuration['multiple_access_urls'] == false) {
$sql = "SELECT code FROM $dbNameForm.course";
$result = Database::query($sql);
while ($row = Database::fetch_array($result)) {
//Adding course to default URL just in case
$sql = "INSERT INTO $dbNameForm.access_url_rel_course SET course_code = '".Database::escape_string($row['code'])."', access_url_id = '1' ";
Database::query($sql);
}
}
}
}

Loading…
Cancel
Save