From 0dd435add1a5f42d3b7d7e1b6147a28b9f7ec471 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Thu, 28 May 2009 18:59:08 +0000 Subject: [PATCH] MDL-19304 xmldb editor - files default action changet to edit --- .../actions/main_view/main_view.class.php | 89 +++++++++++-------- 1 file changed, 53 insertions(+), 36 deletions(-) diff --git a/admin/xmldb/actions/main_view/main_view.class.php b/admin/xmldb/actions/main_view/main_view.class.php index c79f6160a2..e7790ae7ee 100644 --- a/admin/xmldb/actions/main_view/main_view.class.php +++ b/admin/xmldb/actions/main_view/main_view.class.php @@ -1,31 +1,36 @@ -. -/// This class will show all the actions available under the XMLDB interface +/** + * @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 show all the actions available under the XMLDB editor interface + * + * From here, files can be created, edited, saved and deleted, plus some + * extra utilities like displaying docs, xml info and performing various tests + * + * @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 main_view extends XMLDBAction { /** @@ -52,7 +57,8 @@ class main_view extends XMLDBAction { 'checkdefaults' => 'xmldb', 'checkforeignkeys' => 'xmldb', 'checkbigints' => 'xmldb', - 'doc' => 'xmldb' + 'doc' => 'xmldb', + 'viewxml' => 'xmldb' )); } @@ -133,6 +139,16 @@ class main_view extends XMLDBAction { } } } + /// The file name (link to edit if the file is loaded) + if ($dbdir->path_exists && + file_exists($key . '/install.xml') && + is_readable($key . '/install.xml') && + is_readable($key) && + !empty($dbdir->xml_loaded)) { + $f = '' . $elementtext . ''; + } else { + $f = $elementtext; + } /// Calculate the buttons $b = ' '; /// The create button @@ -194,6 +210,15 @@ class main_view extends XMLDBAction { $b .= '[' . $this->str['doc'] . ']'; } $b .= ''; + /// The view xml button + if ($dbdir->path_exists && + file_exists($key . '/install.xml') && + is_readable($key . '/install.xml')) { + $b .= '[' . $this->str['viewxml'] . ']'; + } else { + $b .= '[' . $this->str['viewxml'] . ']'; + } + $b .= ''; /// The revert button if ($dbdir->path_exists && file_exists($key . '/install.xml') && @@ -228,19 +253,11 @@ class main_view extends XMLDBAction { $b .= '[' . $this->str['delete'] . ']'; } $b .= ''; - /// if the file, exist, XML is viewable - if ($dbdir->path_exists && - file_exists($key . '/install.xml') && - is_readable($key . '/install.xml')) { - $elementtext = '' . $elementtext . ''; - } else { - $elementtext = $elementtext . ''; - } /// include the higlight if ($hithis) { - $o .= '' . $elementtext . $b . ''; + $o .= '' . $f . $b . ''; } else { - $o .= '' . $elementtext . $b . ''; + $o .= '' . $f . $b . ''; } $row = ($row + 1) % 2; /// show errors if they exist -- 2.39.5