From: Eloy Lafuente Date: Thu, 5 Nov 2009 13:38:02 +0000 (+0000) Subject: MDL-20749 fixed the class edit_field_save to output errors properly. Will X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=60a3e22b623aabc6185d03272dbd8f8298ee8d1b;p=moodle.git MDL-20749 fixed the class edit_field_save to output errors properly. Will be beutifying the output a bit later --- diff --git a/admin/xmldb/actions/edit_field_save/edit_field_save.class.php b/admin/xmldb/actions/edit_field_save/edit_field_save.class.php index 21db40d1d6..88bda80db8 100644 --- a/admin/xmldb/actions/edit_field_save/edit_field_save.class.php +++ b/admin/xmldb/actions/edit_field_save/edit_field_save.class.php @@ -1,31 +1,34 @@ . -/// This class will save the changes performed to one field +/** + * @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 field 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_field_save extends XMLDBAction { /** @@ -50,6 +53,7 @@ class edit_field_save extends XMLDBAction { 'numberincorrectdecimals' => 'xmldb', 'floatincorrectdecimals' => 'xmldb', 'defaultincorrect' => 'xmldb', + 'back' => 'xmldb', 'administration' => '' )); } @@ -65,8 +69,8 @@ class edit_field_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; @@ -231,17 +235,11 @@ class edit_field_save extends XMLDBAction { $tempfield->setSequence($sequence); $tempfield->setDefault($default); /// 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) . '

-

' . $tempfield->readableInfo() . '

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

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

+

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

'; + $o.= '[' . $this->str['back'] . ']'; + $this->output = $o; } /// Continue if we aren't under errors diff --git a/lang/en_utf8/xmldb.php b/lang/en_utf8/xmldb.php index 57b4672170..cda13ec468 100644 --- a/lang/en_utf8/xmldb.php +++ b/lang/en_utf8/xmldb.php @@ -61,6 +61,7 @@ $string['duplicatefieldname'] = 'Another field with that name exists'; $string['duplicatekeyname'] = 'Another key with that name exists'; $string['edit'] = 'Edit'; $string['edit_field'] = 'Edit Field'; +$string['edit_field_save'] = 'Save Field'; $string['edit_index'] = 'Edit Index'; $string['edit_key'] = 'Edit Key'; $string['edit_sentence'] = 'Edit Sentence';