From: stronk7
Date: Thu, 28 May 2009 18:41:02 +0000 (+0000)
Subject: MDL-19304 xmldb editor - fixed default action for tables & statements
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f802a79b7095c5bfb3255f94a355a6411c790ef2;p=moodle.git
MDL-19304 xmldb editor - fixed default action for tables & statements
---
diff --git a/admin/xmldb/actions/edit_xml_file/edit_xml_file.class.php b/admin/xmldb/actions/edit_xml_file/edit_xml_file.class.php
index 74b6608bf9..99d4578c1d 100644
--- a/admin/xmldb/actions/edit_xml_file/edit_xml_file.class.php
+++ b/admin/xmldb/actions/edit_xml_file/edit_xml_file.class.php
@@ -1,31 +1,36 @@
-.
+
+/**
+ * @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 edit one loaded XML file
+ *
+ * Main page to start editing one XML file. From here it's possible to access
+ * to tables/statements edition plus PHP code generation and other utilities
+ *
+ * @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_xml_file extends XMLDBAction {
/**
@@ -53,7 +58,8 @@ class edit_xml_file extends XMLDBAction {
'viewsqlcode' => 'xmldb',
'viewphpcode' => 'xmldb',
'reserved' => 'xmldb',
- 'backtomainview' => 'xmldb'
+ 'backtomainview' => 'xmldb',
+ 'viewxml' => 'xmldb'
));
}
@@ -144,9 +150,9 @@ class edit_xml_file extends XMLDBAction {
$b .= ' [' . $this->str['viewphpcode'] . ']';
$b .= '
';
$o .= $b;
+
/// Join all the reserved words into one big array
/// Calculate list of available SQL generators
-
require_once("$CFG->libdir/ddl/sql_generator.php");
$reserved_words = sql_generator::getAllReservedWords();
@@ -157,6 +163,8 @@ class edit_xml_file extends XMLDBAction {
$o .= '';
$row = 0;
foreach ($tables as $table) {
+ /// The table name (link to edit table)
+ $t = '' . $table->getName() . '';
/// Calculate buttons
$b = '';
/// The edit button
@@ -184,13 +192,16 @@ class edit_xml_file extends XMLDBAction {
} else {
$b .= '[' . $this->str['delete'] . ']';
}
+ $b .= ' | ';
+ /// The view xml button
+ $b .= '[' . $this->str['viewxml'] . ']';
/// Detect if the table name is a reserved word
if (array_key_exists($table->getName(), $reserved_words)) {
$b .= ' ' . $this->str['reserved'] . '';
}
$b .= ' | ';
/// Print table row
- $o .= '' . $table->getName() . '' . $b . ' |
';
+ $o .= '' . $t . $b . ' |
';
$row = ($row + 1) % 2;
}
$o .= '
';
@@ -202,6 +213,8 @@ class edit_xml_file extends XMLDBAction {
$o .= '';