mirror of
https://github.com/cosmocode/dokuwiki-plugin-struct.git
synced 2025-08-06 10:01:14 +00:00
fixed bugs introduced by making admin components
also show a TOC on both admin pages to easily switch
This commit is contained in:
@ -68,8 +68,6 @@ class admin_plugin_struct_assignments extends DokuWiki_Admin_Plugin {
|
|||||||
* Render HTML output, e.g. helpful text and a form
|
* Render HTML output, e.g. helpful text and a form
|
||||||
*/
|
*/
|
||||||
public function html() {
|
public function html() {
|
||||||
global $INPUT;
|
|
||||||
|
|
||||||
echo $this->locale_xhtml('assignments_intro');
|
echo $this->locale_xhtml('assignments_intro');
|
||||||
|
|
||||||
$res = $this->sqlite->query('SELECT tbl FROM schemas GROUP BY tbl');
|
$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 .= "</div></li>";
|
$html .= "</div></li>";
|
||||||
echo $html;
|
echo $html;
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
|
|
||||||
|
|
||||||
$table = Schema::cleanTableName($INPUT->str('table'));
|
|
||||||
if($table) {
|
|
||||||
echo '<h2>'.sprintf($this->getLang('edithl'), hsc($table)).'</h2>';
|
|
||||||
|
|
||||||
$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();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ class admin_plugin_struct_schemas extends DokuWiki_Admin_Plugin {
|
|||||||
$form = new Form();
|
$form = new Form();
|
||||||
$form->addFieldsetOpen($this->getLang('create'));
|
$form->addFieldsetOpen($this->getLang('create'));
|
||||||
$form->setHiddenField('do', 'admin');
|
$form->setHiddenField('do', 'admin');
|
||||||
$form->setHiddenField('page', 'struct');
|
$form->setHiddenField('page', 'struct_schemas');
|
||||||
$form->addTextInput('table', $this->getLang('schemaname'));
|
$form->addTextInput('table', $this->getLang('schemaname'));
|
||||||
$form->addButton('', $this->getLang('save'));
|
$form->addButton('', $this->getLang('save'));
|
||||||
$form->addHTML('<p>'.$this->getLang('createhint').'</p>'); // FIXME is that true? we probably could
|
$form->addHTML('<p>'.$this->getLang('createhint').'</p>'); // 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 */
|
/** @var helper_plugin_struct_db $helper */
|
||||||
$helper = plugin_load('helper', 'struct_db');
|
$helper = plugin_load('helper', 'struct_db');
|
||||||
$db = $helper->getDB();
|
$db = $helper->getDB();
|
||||||
|
|
||||||
parent::getTOC();
|
|
||||||
if(!$db) return parent::getTOC();
|
if(!$db) return parent::getTOC();
|
||||||
|
|
||||||
|
|
||||||
$res = $db->query("SELECT DISTINCT tbl FROM schemas ORDER BY tbl");
|
$res = $db->query("SELECT DISTINCT tbl FROM schemas ORDER BY tbl");
|
||||||
$tables = $db->res2arr($res);
|
$tables = $db->res2arr($res);
|
||||||
$db->res_close($res);
|
$db->res_close($res);
|
||||||
@ -101,14 +100,19 @@ class admin_plugin_struct_schemas extends DokuWiki_Admin_Plugin {
|
|||||||
$toc = array();
|
$toc = array();
|
||||||
$link = wl($ID, array(
|
$link = wl($ID, array(
|
||||||
'do' => 'admin',
|
'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, '');
|
$toc[] = html_mktocitem($link, $this->getLang('menu'), 0, '');
|
||||||
|
|
||||||
foreach($tables as $row) {
|
foreach($tables as $row) {
|
||||||
$link = wl($ID, array(
|
$link = wl($ID, array(
|
||||||
'do' => 'admin',
|
'do' => 'admin',
|
||||||
'page' => 'struct',
|
'page' => 'struct_schemas',
|
||||||
'table' => $row['tbl']
|
'table' => $row['tbl']
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class SchemaEditor {
|
|||||||
public function getEditor() {
|
public function getEditor() {
|
||||||
$form = new Form(array('method' => 'POST', 'id'=>'plugin__struct'));
|
$form = new Form(array('method' => 'POST', 'id'=>'plugin__struct'));
|
||||||
$form->setHiddenField('do', 'admin');
|
$form->setHiddenField('do', 'admin');
|
||||||
$form->setHiddenField('page', 'struct');
|
$form->setHiddenField('page', 'struct_schemas');
|
||||||
$form->setHiddenField('table', $this->schema->getTable());
|
$form->setHiddenField('table', $this->schema->getTable());
|
||||||
$form->setHiddenField('schema[id]', $this->schema->getId());
|
$form->setHiddenField('schema[id]', $this->schema->getId());
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user