';
- $o .= $b;
-
- $this->output = $o;
- }
-
- /// Launch postaction if exists (leave this here!)
- if ($this->getPostAction() && $result) {
- return $this->launch($this->getPostAction());
- }
-
- /// Return ok if arrived here
- return $result;
- }
-}
-
Index: admin/xmldb/actions/edit_sentence_save/edit_sentence_save.class.php
===================================================================
RCS file: admin/xmldb/actions/edit_sentence_save/edit_sentence_save.class.php
diff -N admin/xmldb/actions/edit_sentence_save/edit_sentence_save.class.php
--- admin/xmldb/actions/edit_sentence_save/edit_sentence_save.class.php 5 Nov 2009 15:40:26 -0000 1.11
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,157 +0,0 @@
-.
-
-/**
- * @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 sentence 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_sentence_save extends XMLDBAction {
-
- /**
- * Init method, every subclass will have its own
- */
- function init() {
- parent::init();
-
- /// Set own custom attributes
-
- /// Get needed strings
- $this->loadStrings(array(
- 'cannotuseidfield' => 'xmldb',
- 'missingfieldsinsentence' => 'xmldb',
- 'missingvaluesinsentence' => 'xmldb',
- 'wrongnumberoffieldsorvalues' => 'xmldb',
- 'back' => 'xmldb',
- 'administration' => ''
- ));
- }
-
- /**
- * Invoke method, every class will have its own
- * returns true/false on completion, setting both
- * errormsg and output as necessary
- */
- function invoke() {
- parent::invoke();
-
- $result = true;
-
- /// Set own core attributes
- //$this->does_generate = ACTION_NONE;
- $this->does_generate = ACTION_GENERATE_HTML;
-
- /// These are always here
- global $CFG, $XMLDB;
-
- /// Do the job, setting result as needed
-
- /// Get parameters
- $dirpath = required_param('dir', PARAM_PATH);
- $dirpath = $CFG->dirroot . $dirpath;
-
- $statementparam = strtolower(required_param('statement', PARAM_CLEAN));
- $sentenceparam = strtolower(required_param('sentence', PARAM_ALPHANUM));
-
- $fields = required_param('fields', PARAM_CLEAN);
- $fields = trim($fields);
- $values = required_param('values', PARAM_CLEAN);
- $values = trim($values);
-
- $editeddir =& $XMLDB->editeddirs[$dirpath];
- $structure =& $editeddir->xml_file->getStructure();
- $statement =& $structure->getStatement($statementparam);
- $sentences =& $statement->getSentences();
-
- $oldsentence = $sentences[$sentenceparam];
-
- if (!$statement) {
- $this->errormsg = 'Wrong statement specified: ' . $statementparam;
- return false;
- }
-
- /// For now, only insert sentences are allowed
- if ($statement->getType() != XMLDB_STATEMENT_INSERT) {
- $this->errormsg = 'Wrong Statement Type. Only INSERT allowed';
- return false;
- }
-
- $errors = array(); /// To store all the errors found
-
- /// Build the whole sentence
- $sentence = '(' . $fields . ') VALUES (' . $values . ')';
-
- /// Perform some checks
- $fields = $statement->getFieldsFromInsertSentence($sentence);
- $values = $statement->getValuesFromInsertSentence($sentence);
-
- if (in_array('id', $fields)) {
- $errors[] = $this->str['cannotuseidfield'];
- }
- if ($result && count($fields) == 0) {
- $errors[] = $this->str['missingfieldsinsentence'];
- }
- if ($result && count($values) == 0) {
- $errors[] = $this->str['missingvaluesinsentence'];
- }
- if ($result && count($fields) != count($values)) {
- $errors[] = $this->str['wrongnumberoffieldsorvalues'];
- }
-
- if (!empty($errors)) {
- /// Prepare the output
- $o = '
' .implode(', ', $errors) . '
-
' . s($sentence) . '
';
- $o.= '[' . $this->str['back'] . ']';
- $this->output = $o;
- }
-
- /// Continue if we aren't under errors
- if (empty($errors)) {
- $sentences[$sentenceparam] = $sentence;
-
- /// If the sentence has changed from the old one, change the version
- /// and mark the statement and structure as changed
- if ($oldsentence != $sentence) {
- $statement->setChanged(true);
- $structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
- /// Mark as changed
- $structure->setChanged(true);
- }
-
- /// Launch postaction if exists (leave this here!)
- if ($this->getPostAction() && $result) {
- return $this->launch($this->getPostAction());
- }
- }
-
- /// Return ok if arrived here
- return $result;
- }
-}
-
Index: admin/xmldb/actions/delete_statement/delete_statement.class.php
===================================================================
RCS file: admin/xmldb/actions/delete_statement/delete_statement.class.php
diff -N admin/xmldb/actions/delete_statement/delete_statement.class.php
--- admin/xmldb/actions/delete_statement/delete_statement.class.php 20 Nov 2009 19:48:02 -0000 1.8
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,117 +0,0 @@
-.
-
-/**
- * @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 delete completely one statement
- *
- * @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 delete_statement extends XMLDBAction {
-
- /**
- * Init method, every subclass will have its own
- */
- function init() {
- parent::init();
-
- /// Set own custom attributes
-
- /// Get needed strings
- $this->loadStrings(array(
- 'confirmdeletestatement' => 'xmldb',
- 'yes' => '',
- 'no' => ''
- ));
- }
-
- /**
- * Invoke method, every class will have its own
- * returns true/false on completion, setting both
- * errormsg and output as necessary
- */
- function invoke() {
- parent::invoke();
-
- $result = true;
-
- /// Set own core attributes
- $this->does_generate = ACTION_GENERATE_HTML;
-
- /// These are always here
- global $CFG, $XMLDB;
-
- /// Do the job, setting result as needed
-
- /// Get the dir containing the file
- $dirpath = required_param('dir', PARAM_PATH);
- $dirpath = $CFG->dirroot . $dirpath;
- $statementparam = required_param('statement', PARAM_CLEAN);
-
- $confirmed = optional_param('confirmed', false, PARAM_BOOL);
-
- /// If not confirmed, show confirmation box
- if (!$confirmed) {
- $o = '
';
- $o.= '
';
- $o.= '
' . $this->str['confirmdeletestatement'] . '
' . $statementparam . '
';
- $o.= '
';
- $o.= '
';
- $o.= '
';
- $o.= '
';
- $o.= '
';
- $o.= '
';
- $o.= '
';
- $o.= '
';
- $o.= '
';
- $o.= '
';
-
- $this->output = $o;
- } else {
- /// Get the edited dir
- if (!empty($XMLDB->editeddirs)) {
- if (isset($XMLDB->editeddirs[$dirpath])) {
- $dbdir =& $XMLDB->dbdirs[$dirpath];
- $editeddir =& $XMLDB->editeddirs[$dirpath];
- if ($editeddir) {
- $structure =& $editeddir->xml_file->getStructure();
- /// Remove the table
- $structure->deleteStatement($statementparam);
- }
- }
- }
- }
-
- /// Launch postaction if exists (leave this here!)
- if ($this->getPostAction() && $result) {
- return $this->launch($this->getPostAction());
- }
-
- /// Return ok if arrived here
- return $result;
- }
-}
-
Index: admin/xmldb/actions/view_statement_xml/view_statement_xml.class.php
===================================================================
RCS file: admin/xmldb/actions/view_statement_xml/view_statement_xml.class.php
diff -N admin/xmldb/actions/view_statement_xml/view_statement_xml.class.php
--- admin/xmldb/actions/view_statement_xml/view_statement_xml.class.php 20 Nov 2009 19:48:04 -0000 1.7
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,129 +0,0 @@
-.
-
-/**
- * @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 display the XML for one statement being edited
- *
- * @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 view_statement_xml extends XMLDBAction {
-
- /**
- * Init method, every subclass will have its own
- */
- function init() {
- parent::init();
-
- /// Set own custom attributes
- $this->sesskey_protected = false; // This action doesn't need sesskey protection
-
- /// Get needed strings
- $this->loadStrings(array(
- /// 'key' => 'module',
- ));
- }
-
- /**
- * Invoke method, every class will have its own
- * returns true/false on completion, setting both
- * errormsg and output as necessary
- */
- function invoke() {
- parent::invoke();
-
- $result = true;
-
- /// Set own core attributes
- $this->does_generate = ACTION_GENERATE_XML;
-
- /// These are always here
- global $CFG, $XMLDB;
-
- /// Do the job, setting result as needed
-
- /// Get the file parameter
- $statement = required_param('statement', PARAM_CLEAN);
- $select = required_param('select', PARAM_ALPHA); //original/edited
- /// Get the dir containing the file
- $dirpath = required_param('dir', PARAM_PATH);
- $dirpath = $CFG->dirroot . $dirpath;
-
- /// Get the correct dir
- if ($select == 'original') {
- if (!empty($XMLDB->dbdirs)) {
- $base =& $XMLDB->dbdirs[$dirpath];
- }
- } else if ($select == 'edited') {
- if (!empty($XMLDB->editeddirs)) {
- $base =& $XMLDB->editeddirs[$dirpath];
- }
- } else {
- $this->errormsg = 'Cannot access to ' . $select . ' info';
- $result = false;
- }
- if ($base) {
- /// Only if the directory exists and it has been loaded
- if (!$base->path_exists || !$base->xml_loaded) {
- $this->errormsg = 'Directory ' . $dirpath . ' not loaded';
- return false;
- }
- } else {
- $this->errormsg = 'Problem handling ' . $select . ' files';
- return false;
- }
-
- /// Get the structure
- if ($result) {
- if (!$structure =& $base->xml_file->getStructure()) {
- $this->errormsg = 'Error retrieving ' . $select . ' structure';
- $result = false;
- }
- }
- /// Get the statements
- if ($result) {
- if (!$statements =& $structure->getStatements()) {
- $this->errormsg = 'Error retrieving ' . $select . ' statements';
- $result = false;
- }
- }
- /// Get the statement
- if ($result && !$t =& $structure->getStatement($statement)) {
- $this->errormsg = 'Error retrieving ' . $statement . ' statement';
- $result = false;
- }
-
- if ($result) {
- /// Everything is ok. Generate the XML output
- $this->output = $t->xmlOutput();
- } else {
- /// Switch to HTML and error
- $this->does_generate = ACTION_GENERATE_HTML;
- }
-
- /// Return ok if arrived here
- return $result;
- }
-}
-
Index: lib/ddl/sql_generator.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/ddl/sql_generator.php,v
retrieving revision 1.32
diff -u -r1.32 sql_generator.php
--- lib/ddl/sql_generator.php 25 Jul 2010 12:57:03 -0000 1.32
+++ lib/ddl/sql_generator.php 6 Sep 2010 08:15:29 -0000
@@ -196,37 +196,6 @@
}
}
- if ($statements = $xmldb_structure->getStatements()) {
- foreach ($statements as $statement) {
- $results = array_merge($results, $this->getExecuteStatementSQL($statement));
- }
- }
- return $results;
- }
-
- /**
- * This function will return the code needed to execute a collection
- * of sentences present inside one statement for the specified BD
- * and prefix.
- * For now it only supports INSERT statements
- */
- public function getExecuteStatementSQL($xmldb_statement) {
-
- $results = array();
-
- /// Based on statement type
- switch ($xmldb_statement->type) {
- case XMLDB_STATEMENT_INSERT:
- $results = $this->getExecuteInsertSQL($xmldb_statement);
- break;
- case XMLDB_STATEMENT_UPDATE:
- break;
- case XMLDB_STATEMENT_DELETE:
- break;
- case XMLDB_STATEMENT_CUSTOM:
- break;
- }
-
return $results;
}
Index: lib/ddllib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/ddllib.php,v
retrieving revision 1.79
diff -u -r1.79 ddllib.php
--- lib/ddllib.php 25 Jul 2010 13:35:07 -0000 1.79
+++ lib/ddllib.php 6 Sep 2010 08:15:29 -0000
@@ -63,8 +63,6 @@
require_once($CFG->libdir.'/xmldb/xmldb_key.php');
// Add required XMLDB DB classes
require_once($CFG->libdir.'/xmldb/xmldb_index.php');
-// Add required XMLDB DB classes
-require_once($CFG->libdir.'/xmldb/xmldb_statement.php');
require_once($CFG->libdir.'/ddl/sql_generator.php');
require_once($CFG->libdir.'/ddl/database_manager.php');
Index: admin/xmldb/actions/new_sentence/new_sentence.class.php
===================================================================
RCS file: admin/xmldb/actions/new_sentence/new_sentence.class.php
diff -N admin/xmldb/actions/new_sentence/new_sentence.class.php
--- admin/xmldb/actions/new_sentence/new_sentence.class.php 20 Nov 2009 19:48:03 -0000 1.7
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,122 +0,0 @@
-.
-
-/**
- * @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 create a new default sentence to be edited.
- * If one previous sentence key is specified, it's used as
- * base to build the new setence, else a blank one is used
- *
- * @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 new_sentence extends XMLDBAction {
-
- /**
- * Init method, every subclass will have its own
- */
- function init() {
- parent::init();
-
- /// Set own custom attributes
-
- /// Get needed strings
- $this->loadStrings(array(
- /// 'key' => 'module',
- ));
- }
-
- /**
- * Invoke method, every class will have its own
- * returns true/false on completion, setting both
- * errormsg and output as necessary
- */
- function invoke() {
- parent::invoke();
-
- $result = true;
-
- /// Set own core attributes
- $this->does_generate = ACTION_NONE;
- //$this->does_generate = ACTION_GENERATE_HTML;
-
- /// These are always here
- global $CFG, $XMLDB;
-
- /// Do the job, setting result as needed
- /// Get the dir containing the file
- $dirpath = required_param('dir', PARAM_PATH);
- $dirpath = $CFG->dirroot . $dirpath;
-
- /// Get the correct dirs
- if (!empty($XMLDB->dbdirs)) {
- $dbdir =& $XMLDB->dbdirs[$dirpath];
- } else {
- return false;
- }
- if (!empty($XMLDB->editeddirs)) {
- $editeddir =& $XMLDB->editeddirs[$dirpath];
- $structure =& $editeddir->xml_file->getStructure();
- }
- /// ADD YOUR CODE HERE
-
- $statementparam = required_param('statement', PARAM_CLEAN);
- $basesentenceparam = optional_param('basesentence', NULL, PARAM_CLEAN);
-
- $statement =& $structure->getStatement($statementparam);
- $sentences =& $statement->getSentences();
-
- $sentence = NULL;
-
- /// If some sentence has been specified, create the new one
- /// based on it
- if (!empty($basesentenceparam)) {
- $sentence = $sentences[$basesentenceparam];
- }
- /// Else, try to create the new one based in the last
- if (empty($sentence) && !empty($sentences)) {
- $sentence = end($sentences);
- }
- /// Else, create one sentence by hand
- if (empty($sentence)) {
- $sentence = "(list, of, fields) VALUES ('list', 'of', 'values')";
- }
-
- /// Add the sentence to the statement
- $statement->addSentence($sentence);
-
- /// We have one new sentence, so the statement and the structure has changed
- $statement->setChanged(true);
- $structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
- $structure->setChanged(true);
-
- /// Launch postaction if exists (leave this here!)
- if ($this->getPostAction() && $result) {
- return $this->launch($this->getPostAction());
- }
-
- /// Return ok if arrived here
- return $result;
- }
-}
-
Index: lang/en/xmldb.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lang/en/xmldb.php,v
retrieving revision 1.3
diff -u -r1.3 xmldb.php
--- lang/en/xmldb.php 21 May 2010 17:46:11 -0000 1.3
+++ lang/en/xmldb.php 6 Sep 2010 08:15:28 -0000
@@ -33,8 +33,6 @@
$string['confirmdeletefield'] = 'Are you absolutely sure that you want to delete the field:';
$string['confirmdeleteindex'] = 'Are you absolutely sure that you want to delete the index:';
$string['confirmdeletekey'] = 'Are you absolutely sure that you want to delete the key:';
-$string['confirmdeletesentence'] = 'Are you absolutely sure that you want to delete the sentence';
-$string['confirmdeletestatement'] = 'Are you absolutely sure that you want to delete the statement and all its sentences:';
$string['confirmdeletetable'] = 'Are you absolutely sure that you want to delete the table:';
$string['confirmdeletexmlfile'] = 'Are you absolutely sure that you want to delete the file:';
$string['confirmcheckbigints'] = 'This functionality will search for potential wrong integer fields in your Moodle server, generating (but not executing!) automatically the needed SQL statements to have all the integers in your DB properly defined.
@@ -60,8 +58,6 @@
$string['delete_field'] = 'Delete Field';
$string['delete_index'] = 'Delete Index';
$string['delete_key'] = 'Delete Key';
-$string['delete_sentence'] = 'Delete Sentence';
-$string['delete_statement'] = 'Delete Statement';
$string['delete_table'] = 'Delete Table';
$string['delete_xml_file'] = 'Delete XML File';
$string['doc'] = 'Doc';
@@ -78,9 +74,6 @@
$string['edit_index_save'] = 'Save Index';
$string['edit_key'] = 'Edit Key';
$string['edit_key_save'] = 'Save Key';
-$string['edit_sentence'] = 'Edit Sentence';
-$string['edit_sentence_save'] = 'Save Sentence';
-$string['edit_statement'] = 'Edit Statement';
$string['edit_table'] = 'Edit Table';
$string['edit_table_save'] = 'Save Table';
$string['edit_xml_file'] = 'Edit XML File';
@@ -121,9 +114,7 @@
$string['main_view'] = 'Main View';
$string['masterprimaryuniqueordernomatch'] = 'The fields in your foreign key must be listed in the same order as they are listed in the UNIQUE KEY on the referenced table.';
$string['missing'] = 'Missing';
-$string['missingfieldsinsentence'] = 'Missing fields in sentence';
$string['missingindexes'] = 'Missing Indexes Found';
-$string['missingvaluesinsentence'] = 'Missing values in sentence';
$string['mustselectonefield'] = 'You must select one field to see field related actions!';
$string['mustselectoneindex'] = 'You must select one index to see index related actions!';
$string['mustselectonekey'] = 'You must select one key to see key related actions!';
@@ -131,9 +122,6 @@
$string['newfield'] = 'New Field';
$string['newindex'] = 'New Index';
$string['newkey'] = 'New Key';
-$string['newsentence'] = 'New Sentence';
-$string['newstatement'] = 'New Statement';
-$string['new_statement'] = 'New Statement';
$string['newtable'] = 'New Table';
$string['newtablefrommysql'] = 'New Table From MySQL';
$string['new_table_from_mysql'] = 'New Table From MySQL';
@@ -159,10 +147,6 @@
$string['selectonecommand'] = 'Please, select one Action from the list to view PHP code';
$string['selectonefieldkeyindex'] = 'Please, select one Field/Key/Index from the list to view the PHP code';
$string['selecttable'] = 'Select Table:';
-$string['sentences'] = 'Sentences';
-$string['statements'] = 'Statements';
-$string['statementtable'] = 'Statement Table:';
-$string['statementtype'] = 'Statement Type:';
$string['table'] = 'Table';
$string['tables'] = 'Tables';
$string['test'] = 'Test';
@@ -187,7 +171,6 @@
$string['wrongdefaults'] = 'Wrong Defaults Found';
$string['wrongints'] = 'Wrong Integers Found';
$string['wronglengthforenum'] = 'Incorrect length for enum field';
-$string['wrongnumberoffieldsorvalues'] = 'Incorrect number of fields or values in sentence';
$string['wrongreservedwords'] = 'Currently Used Reserved Words (note that table names aren\'t important if using $CFG->prefix)';
$string['yesmissingindexesfound'] = 'Some missing indexes have been found in your DB. Here are their details and the needed SQL statements to be executed with your favourite SQL interface to create all them (don\'t forget to backup your data before doing that).
After doing that, it\'s highly recommended to execute this utility again to check that no more missing indexes are found.';
$string['yeswrongdefaultsfound'] = 'Some inconsistent defaults have been found in your DB. Here are their details and the needed SQL statements to be executed with your favourite SQL interface to fix them all (don\'t forget to backup your data before doing that).
After doing that, it\'s highly recommended to execute this utility again to check that no more iconsistent defaults are found.';
Index: admin/xmldb/actions/edit_statement_save/edit_statement_save.class.php
===================================================================
RCS file: admin/xmldb/actions/edit_statement_save/edit_statement_save.class.php
diff -N admin/xmldb/actions/edit_statement_save/edit_statement_save.class.php
--- admin/xmldb/actions/edit_statement_save/edit_statement_save.class.php 1 Nov 2009 10:56:00 -0000 1.6
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,108 +0,0 @@
-loadStrings(array(
- 'administration' => ''
- ));
- }
-
- /**
- * Invoke method, every class will have its own
- * returns true/false on completion, setting both
- * errormsg and output as necessary
- */
- function invoke() {
- parent::invoke();
-
- $result = true;
-
- /// Set own core attributes
- $this->does_generate = ACTION_NONE;
- //$this->does_generate = ACTION_GENERATE_HTML;
-
- /// These are always here
- global $CFG, $XMLDB;
-
- /// Do the job, setting result as needed
-
- /// Get parameters
- $dirpath = required_param('dir', PARAM_PATH);
- $dirpath = $CFG->dirroot . $dirpath;
-
- $statementparam = strtolower(required_param('statement', PARAM_CLEAN));
- $name = trim(strtolower(required_param('name', PARAM_CLEAN)));
- $comment = required_param('comment', PARAM_CLEAN);
- $comment = $comment;
-
- $editeddir =& $XMLDB->editeddirs[$dirpath];
- $structure =& $editeddir->xml_file->getStructure();
- $statement =& $structure->getStatement($statementparam);
-
- $errors = array(); /// To store all the errors found
-
- /// If there is one name change, do it, changing the prev and next
- /// atributes of the adjacent tables
- if ($statementparam != $name) {
- $statement->setName($name);
- if ($statement->getPrevious()) {
- $prev =& $structure->getStatement($statement->getPrevious());
- $prev->setNext($name);
- $prev->setChanged(true);
- }
- if ($statement->getNext()) {
- $next =& $structure->getStatement($statement->getNext());
- $next->setPrevious($name);
- $next->setChanged(true);
- }
- }
-
- /// Set comment
- $statement->setComment($comment);
-
- /// Launch postaction if exists (leave this here!)
- if ($this->getPostAction() && $result) {
- return $this->launch($this->getPostAction());
- }
-
- /// Return ok if arrived here
- return $result;
- }
-}
-
Index: admin/xmldb/actions/edit_statement/edit_statement.class.php
===================================================================
RCS file: admin/xmldb/actions/edit_statement/edit_statement.class.php
diff -N admin/xmldb/actions/edit_statement/edit_statement.class.php
--- admin/xmldb/actions/edit_statement/edit_statement.class.php 20 Nov 2009 19:48:02 -0000 1.11
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,187 +0,0 @@
-.
-
-/**
- * @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 provide the interface for all the edit statement actions
- *
- * @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_statement extends XMLDBAction {
-
- /**
- * Init method, every subclass will have its own
- */
- function init() {
- parent::init();
-
- /// Set own custom attributes
- $this->sesskey_protected = false; // This action doesn't need sesskey protection
-
- /// Get needed strings
- $this->loadStrings(array(
- 'change' => 'xmldb',
- 'vieworiginal' => 'xmldb',
- 'viewedited' => 'xmldb',
- 'newsentence' => 'xmldb',
- 'sentences' => 'xmldb',
- 'edit' => 'xmldb',
- 'delete' => 'xmldb',
- 'duplicate' => 'xmldb',
- 'back' => 'xmldb'
- ));
- }
-
- /**
- * Invoke method, every class will have its own
- * returns true/false on completion, setting both
- * errormsg and output as necessary
- */
- function invoke() {
- parent::invoke();
-
- $result = true;
-
- /// Set own core attributes
- $this->does_generate = ACTION_GENERATE_HTML;
-
- /// These are always here
- global $CFG, $XMLDB;
-
- /// Do the job, setting result as needed
- /// Get the dir containing the file
- $dirpath = required_param('dir', PARAM_PATH);
- $dirpath = $CFG->dirroot . $dirpath;
-
- /// Get the correct dirs
- if (!empty($XMLDB->dbdirs)) {
- $dbdir =& $XMLDB->dbdirs[$dirpath];
- } else {
- return false;
- }
- if (!empty($XMLDB->editeddirs)) {
- $editeddir =& $XMLDB->editeddirs[$dirpath];
- $structure =& $editeddir->xml_file->getStructure();
- }
-
- /// ADD YOUR CODE HERE
- $statementparam = optional_param('statement', NULL, PARAM_CLEAN);
- /// If no statement, then we are coming for a new one. Look for
- /// type and table and build the correct statementparam
- if (!$statementparam) {
- $typeparam = optional_param('type', NULL, PARAM_CLEAN);
- $tableparam = optional_param('table', NULL, PARAM_CLEAN);
- $typename = xmldb_statement::getXMLDBStatementName($typeparam);
- $statementparam = trim(strtolower($typename . ' ' . $tableparam));
- }
- if (!$statement =& $structure->getStatement($statementparam)) {
- /// Arriving here from a name change, looking for the new statement name
- $statementname = required_param('name', PARAM_CLEAN);
- $statement =& $structure->getStatement($statementparam);
- }
-
- $dbdir =& $XMLDB->dbdirs[$dirpath];
- $origstructure =& $dbdir->xml_file->getStructure();
-
- /// Add the main form
- $o = '';
- /// Calculate the buttons
- $b = '
';
- /// The view original XML button
- if ($origstructure->getStatement($statementparam)) {
- $b .= ' [' . $this->str['vieworiginal'] . ']';
- } else {
- $b .= ' [' . $this->str['vieworiginal'] . ']';
- }
- /// The view edited XML button
- if ($statement->hasChanged()) {
- $b .= ' [' . $this->str['viewedited'] . ']';
- } else {
- $b .= ' [' . $this->str['viewedited'] . ']';
- }
- /// The new sentence button
- $b .= ' [' . $this->str['newsentence'] . ']';
- /// The back to edit xml file button
- $b .= ' [' . $this->str['back'] . ']';
- $b .= '
';
- $o .= $b;
-
- /// Delete any 'changeme' sentence
- ///$statement->deleteSentence('changeme');
-
- /// Add the fields list
- $sentences =& $statement->getSentences();
- if (!empty($sentences)) {
- $o .= '