diff --git a/admin/assignments.php b/admin/assignments.php index e36d208..4f37120 100644 --- a/admin/assignments.php +++ b/admin/assignments.php @@ -68,8 +68,6 @@ class admin_plugin_struct_assignments extends DokuWiki_Admin_Plugin { * Render HTML output, e.g. helpful text and a form */ public function html() { - global $INPUT; - echo $this->locale_xhtml('assignments_intro'); $res = $this->sqlite->query('SELECT tbl FROM schemas GROUP BY tbl'); @@ -106,17 +104,17 @@ class admin_plugin_struct_assignments extends DokuWiki_Admin_Plugin { $html .= ""; echo $html; echo ''; + } - - $table = Schema::cleanTableName($INPUT->str('table')); - if($table) { - echo '

'.sprintf($this->getLang('edithl'), hsc($table)).'

'; - - $editor = new SchemaEditor(new Schema($table)); - echo $editor->getEditor(); - } else { - $this->html_newschema(); - } + /** + * Copies the TOC from the Schema Editor + * + * @return array + */ + public function getTOC() { + /** @var admin_plugin_struct_schemas $plugin */ + $plugin = plugin_load('admin', 'struct_schemas'); + return $plugin->getTOC(); } } diff --git a/admin/schemas.php b/admin/schemas.php index 4b05044..572c702 100644 --- a/admin/schemas.php +++ b/admin/schemas.php @@ -71,7 +71,7 @@ class admin_plugin_struct_schemas extends DokuWiki_Admin_Plugin { $form = new Form(); $form->addFieldsetOpen($this->getLang('create')); $form->setHiddenField('do', 'admin'); - $form->setHiddenField('page', 'struct'); + $form->setHiddenField('page', 'struct_schemas'); $form->addTextInput('table', $this->getLang('schemaname')); $form->addButton('', $this->getLang('save')); $form->addHTML('

'.$this->getLang('createhint').'

'); // FIXME is that true? we probably could @@ -90,10 +90,9 @@ class admin_plugin_struct_schemas extends DokuWiki_Admin_Plugin { /** @var helper_plugin_struct_db $helper */ $helper = plugin_load('helper', 'struct_db'); $db = $helper->getDB(); - - parent::getTOC(); if(!$db) return parent::getTOC(); + $res = $db->query("SELECT DISTINCT tbl FROM schemas ORDER BY tbl"); $tables = $db->res2arr($res); $db->res_close($res); @@ -101,14 +100,19 @@ class admin_plugin_struct_schemas extends DokuWiki_Admin_Plugin { $toc = array(); $link = wl($ID, array( 'do' => 'admin', - 'page' => 'struct' + 'page' => 'struct_assignments' + )); + $toc[] = html_mktocitem($link, $this->getLang('menu_assignments'), 0, ''); + $link = wl($ID, array( + 'do' => 'admin', + 'page' => 'struct_schemas' )); $toc[] = html_mktocitem($link, $this->getLang('menu'), 0, ''); foreach($tables as $row) { $link = wl($ID, array( 'do' => 'admin', - 'page' => 'struct', + 'page' => 'struct_schemas', 'table' => $row['tbl'] )); diff --git a/meta/SchemaEditor.php b/meta/SchemaEditor.php index e24c0d8..6efccb6 100644 --- a/meta/SchemaEditor.php +++ b/meta/SchemaEditor.php @@ -36,7 +36,7 @@ class SchemaEditor { public function getEditor() { $form = new Form(array('method' => 'POST', 'id'=>'plugin__struct')); $form->setHiddenField('do', 'admin'); - $form->setHiddenField('page', 'struct'); + $form->setHiddenField('page', 'struct_schemas'); $form->setHiddenField('table', $this->schema->getTable()); $form->setHiddenField('schema[id]', $this->schema->getId());