MDL-19305 xmldb editor - throw message when there are changes pending to save and perms don't allow it.

This commit is contained in:
stronk7 2009-05-28 21:48:13 +00:00
parent 17fe4b1f32
commit 9dd35834ee
2 changed files with 22 additions and 5 deletions

View File

@ -58,7 +58,8 @@ class main_view extends XMLDBAction {
'checkforeignkeys' => 'xmldb',
'checkbigints' => 'xmldb',
'doc' => 'xmldb',
'viewxml' => 'xmldb'
'viewxml' => 'xmldb',
'pendingchangescannotbesaved' => 'xmldb'
));
}
@ -265,9 +266,9 @@ class main_view extends XMLDBAction {
if ($structure =& $dbdir->xml_file->getStructure()) {
if ($errors = $structure->getAllErrors()) {
if ($hithis) {
$o .= '<tr class="highlight"><td class="error cell" colspan="9">' . implode (', ', $errors) . '</td></tr>';
$o .= '<tr class="highlight"><td class="error cell" colspan="10">' . implode (', ', $errors) . '</td></tr>';
} else {
$o .= '<tr class="r' . $row . '"><td class="error cell" colspan="9">' . implode (', ', $errors) . '</td></tr>';
$o .= '<tr class="r' . $row . '"><td class="error cell" colspan="10">' . implode (', ', $errors) . '</td></tr>';
}
}
}
@ -282,9 +283,9 @@ class main_view extends XMLDBAction {
foreach ($fields as $field) {
if (!empty($field->hasenums)) {
if ($hithis) {
$o .= '<tr class="highlight"><td class="error cell" colspan="9">';
$o .= '<tr class="highlight"><td class="error cell" colspan="10">';
} else {
$o .= '<tr class="r' . $row . '"><td class="error cell" colspan="9">';
$o .= '<tr class="r' . $row . '"><td class="error cell" colspan="10">';
}
$o .= 'Table ' . $table->getName() . ', field ' . $field->getName() . ' has ENUM info';
if (!empty($field->hasenumsenabled)) {
@ -306,6 +307,21 @@ class main_view extends XMLDBAction {
}
}
}
/// If there are changes pending to be saved, but the file cannot be written... inform here
if ($dbdir->path_exists &&
file_exists($key . '/install.xml') &&
!empty($dbdir->xml_loaded) &&
!empty($dbdir->xml_changed) &&
(!is_writeable($key . '/install.xml') || !is_writeable($key))) {
if ($hithis) {
$o .= '<tr class="highlight"><td class="error cell" colspan="10">';
} else {
$o .= '<tr class="r' . $row . '"><td class="error cell" colspan="10">';
}
$o .= $this->str['pendingchangescannotbesaved'];
$o .= '</td></tr>';
}
}
$o .= '</table>';

View File

@ -116,6 +116,7 @@ $string['nowrongdefaultsfound'] = 'No inconsistent default values have been foun
$string['nowrongintsfound'] = 'No wrong integers have been found, your DB doesn\'t need further actions.';
$string['numberincorrectdecimals'] = 'Incorrect number of decimals for number field';
$string['numberincorrectlength'] = 'Incorrect length for number field';
$string['pendingchangescannotbesaved'] = 'There are changes in this file but they cannot be saved! Please verify that both the directory and the \"install.xml\" within it have write permissions for the web server. Then reload this page and you should be able to save those changes.';
$string['reserved'] = 'Reserved';
$string['reservedwords'] = 'Reserved words';
$string['revert'] = 'Revert';