From 4f237e248b2c1c2c67224cdd095d59e84875fcf3 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Thu, 28 May 2009 23:20:53 +0000 Subject: [PATCH] MDL-9176 xmldb editor - enable the possibility to avoid unload after save (default) --- .../save_xml_file/save_xml_file.class.php | 69 +++++++++++-------- 1 file changed, 41 insertions(+), 28 deletions(-) diff --git a/admin/xmldb/actions/save_xml_file/save_xml_file.class.php b/admin/xmldb/actions/save_xml_file/save_xml_file.class.php index c42ad85b1f..e8208eba3f 100644 --- a/admin/xmldb/actions/save_xml_file/save_xml_file.class.php +++ b/admin/xmldb/actions/save_xml_file/save_xml_file.class.php @@ -1,31 +1,38 @@ -. + +/** + * @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 will save one edited xml file + * + * This class will save the in-session xml structure to its + * corresponding xml file, optionally reloading it if editing + * is going to continue (unload=false). Else (default) the + * file is unloaded once saved. + * + * @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 save_xml_file extends XMLDBAction { /** @@ -63,6 +70,7 @@ class save_xml_file extends XMLDBAction { /// Get the dir containing the file $dirpath = required_param('dir', PARAM_PATH); $dirpath = $CFG->dirroot . $dirpath; + $unload = optional_param('unload', true, PARAM_BOOL); /// Get the edited dir if (!empty($XMLDB->editeddirs)) { @@ -101,6 +109,11 @@ class save_xml_file extends XMLDBAction { return false; } + /// If unload has been disabled, simulate it by reloading the file now + if (!$unload) { + $this->launch('load_xml_file'); + } + /// Launch postaction if exists (leave this here!) if ($this->getPostAction() && $result) { return $this->launch($this->getPostAction()); -- 2.39.5