From d3859b134035612ebe59d88cba90fbc7b6652b20 Mon Sep 17 00:00:00 2001 From: Eloy Lafuente Date: Thu, 5 Nov 2009 13:58:22 +0000 Subject: [PATCH] MDL-20749 correct error output - key/index checkers fixed. --- .../edit_index_save/edit_index_save.class.php | 75 +++++++++---------- .../edit_key_save/edit_key_save.class.php | 72 +++++++++--------- 2 files changed, 72 insertions(+), 75 deletions(-) diff --git a/admin/xmldb/actions/edit_index_save/edit_index_save.class.php b/admin/xmldb/actions/edit_index_save/edit_index_save.class.php index 8373f837a0..6bd89dff85 100644 --- a/admin/xmldb/actions/edit_index_save/edit_index_save.class.php +++ b/admin/xmldb/actions/edit_index_save/edit_index_save.class.php @@ -1,31 +1,34 @@ . + +/** + * @package xmldb-editor + * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * This class verifies all the data introduced when editing an index for correctness, + * peforming changes / displaying errors depending of the results. + * + * @package xmldb-editor + * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class edit_index_save extends XMLDBAction { /** @@ -46,6 +49,7 @@ class edit_index_save extends XMLDBAction { 'fieldsnotintable' => 'xmldb', 'fieldsusedinkey' => 'xmldb', 'fieldsusedinindex' => 'xmldb', + 'back' => 'xmldb', 'administration' => '' )); } @@ -61,8 +65,8 @@ class edit_index_save extends XMLDBAction { $result = true; /// Set own core attributes - $this->does_generate = ACTION_NONE; - //$this->does_generate = ACTION_GENERATE_HTML; + //$this->does_generate = ACTION_NONE; + $this->does_generate = ACTION_GENERATE_HTML; /// These are always here global $CFG, $XMLDB; @@ -163,16 +167,11 @@ class edit_index_save extends XMLDBAction { $tempindex->setUnique($unique); $tempindex->setFields($fieldsarr); /// Prepare the output - $site = get_site(); - $PAGE->navbar->add($this->str['administration'], '../index.php'); - $PAGE->navbar->add('XMLDB', 'index.php'); - $PAGE->set_title("$site->shortname: XMLDB"); - $PAGE->set_heading($site->fullname); - echo $OUTPUT->header(); - notice ('

' .implode(', ', $errors) . '

-

' . $tempindex->readableInfo() . '

', - 'index.php?action=edit_index&index=' .$index->getName() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath))); - die; /// re-die :-P + $o = '

' .implode(', ', $errors) . '

+

' . $tempindex->readableInfo() . '

'; + $o.= '[' . $this->str['back'] . ']'; + $this->output = $o; } /// Continue if we aren't under errors diff --git a/admin/xmldb/actions/edit_key_save/edit_key_save.class.php b/admin/xmldb/actions/edit_key_save/edit_key_save.class.php index 45664005e4..3c8ee50e1b 100644 --- a/admin/xmldb/actions/edit_key_save/edit_key_save.class.php +++ b/admin/xmldb/actions/edit_key_save/edit_key_save.class.php @@ -1,31 +1,34 @@ . -/// This class will save the changes performed to one key +/** + * @package xmldb-editor + * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +/** + * This class verifies all the data introduced when editing a key for correctness, + * peforming changes / displaying errors depending of the results. + * + * @package xmldb-editor + * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class edit_key_save extends XMLDBAction { /** @@ -52,6 +55,7 @@ class edit_key_save extends XMLDBAction { 'nomasterprimaryuniquefound' => 'xmldb', 'masterprimaryuniqueordernomatch' => 'xmldb', 'primarykeyonlyallownotnullfields' => 'xmldb', + 'back' => 'xmldb', 'administration' => '' )); } @@ -67,8 +71,8 @@ class edit_key_save extends XMLDBAction { $result = true; /// Set own core attributes - $this->does_generate = ACTION_NONE; - //$this->does_generate = ACTION_GENERATE_HTML; + //$this->does_generate = ACTION_NONE; + $this->does_generate = ACTION_GENERATE_HTML; /// These are always here global $CFG, $XMLDB; @@ -239,17 +243,11 @@ class edit_key_save extends XMLDBAction { $tempkey->setRefFields($reffieldsarr); } /// Prepare the output - $site = get_site(); - $PAGE->navbar->add($this->str['administration'], '../index.php'); - $PAGE->navbar->add('XMLDB', 'index.php'); - $PAGE->set_title("$site->shortname: XMLDB"); - $PAGE->set_heading($site->fullname); - echo $OUTPUT->header(); - - notice ('

' .implode(', ', $errors) . '

-

' . $tempkey->readableInfo() . '

', - 'index.php?action=edit_key&key=' .$key->getName() . '&table=' . $table->getName() . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath))); - die; /// re-die :-P + $o = '

' .implode(', ', $errors) . '

+

' . $name . ': ' . $tempkey->readableInfo() . '

'; + $o.= '[' . $this->str['back'] . ']'; + $this->output = $o; } /// Continue if we aren't under errors -- 2.39.5