openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit bb976808aa0547b22c6dfd74b450dcf4ef794975
parent e29d9032ebf5c23d00b8616e82d9fc210aa1d61d
Author: dankert <devnull@localhost>
Date:   Sat, 17 Apr 2004 00:58:31 +0200

Controller

Diffstat:
do.php | 128+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
mainmenu.php | 250-------------------------------------------------------------------------------
title.php | 51---------------------------------------------------
tree.php | 439-------------------------------------------------------------------------------
treemenu.php | 92-------------------------------------------------------------------------------
5 files changed, 128 insertions(+), 832 deletions(-)

diff --git a/do.php b/do.php @@ -0,0 +1,127 @@ +<?php +// --------------------------------------------------------------------------- +// $Id$ +// --------------------------------------------------------------------------- +// DaCMS Content Management System +// Copyright (C) 2002 Jan Dankert, jandankert@jandankert.de +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// --------------------------------------------------------------------------- +// $Log$ +// Revision 1.1 2004-04-16 22:58:06 dankert +// Controller +// +// Revision 1.1 2004/04/03 22:55:00 dankert +// Neuer Controller +// +// --------------------------------------------------------------------------- + +$conf = parse_ini_file( 'config.ini.php',true ); + +require_once( $conf['directories']['incldir']. + '/config.inc.'. + $conf['global']['ext'] ); + +session_start(); + +require_once( "./DB.php" ); + +require_once( "serviceClasses/GlobalFunctions.class.$conf_php" ); +require_once( "serviceClasses/Html.class.$conf_php" ); +require_once( "serviceClasses/Upload.class.$conf_php" ); +require_once( "serviceClasses/Ftp.class.$conf_php" ); +require_once( "serviceClasses/Text.class.$conf_php" ); +require_once( "serviceClasses/Publish.class.$conf_php" ); +require_once( "serviceClasses/Api.class.$conf_php" ); +require_once( "serviceClasses/Logger.class.$conf_php" ); +require_once( "objectClasses/Value.class.$conf_php" ); +require_once( "objectClasses/Acl.class.$conf_php" ); +require_once( "objectClasses/Template.class.$conf_php" ); +require_once( "objectClasses/Object.class.$conf_php" ); +require_once( "objectClasses/Folder.class.$conf_php" ); +require_once( "objectClasses/Link.class.$conf_php" ); +require_once( "objectClasses/File.class.$conf_php" ); +require_once( "objectClasses/User.class.$conf_php" ); +require_once( "objectClasses/Group.class.$conf_php" ); +require_once( "objectClasses/Project.class.$conf_php" ); +require_once( "objectClasses/Page.class.$conf_php" ); +require_once( "objectClasses/Language.class.$conf_php" ); +require_once( "objectClasses/Model.class.$conf_php" ); +require_once( "objectClasses/Element.class.$conf_php" ); +require_once( "$conf_incldir/language.inc.$conf_php" ); +require_once( "$conf_incldir/theme.inc.$conf_php" ); +require_once( "$conf_incldir/db.inc.$conf_php" ); +require_once( "$conf_incldir/request.inc.$conf_php" ); + +request_into_session('action'); +request_into_session('subaction'); +request_into_session('folderaction'); +request_into_session('objectid'); +request_into_session('action'); +request_into_session('tplaction'); +request_into_session('templateid'); +request_into_session('elementaction'); +request_into_session('elementid'); +request_into_session('folderaction'); +request_into_session('fileaction'); +request_into_session('pageaction'); +request_into_session('projectaction'); +request_into_session('projectid'); +request_into_session('modelaction'); +request_into_session('modelid'); +request_into_session('useraction'); +request_into_session('userid'); +request_into_session('groupaction'); +request_into_session('groupid'); +request_into_session('languageaction'); +request_into_session('languageid'); +request_into_session('searchaction'); + +// Verbindung zur Datenbank +// +if ( isset($SESS['dbid'])) + $db = db_connection(); + +if ( isset( $SESS['action'] ) ) + $action = $SESS['action']; +else $action = 'index'; + +if ( isset( $REQ['subaction'] ) ) + $SESS[ $action.'action' ] = $REQ['subaction']; + +if ( isset($SESS[ $action.'action']) ) + $subaction = $SESS[ $action.'action']; +else $subaction = ''; + +$actionClassName = strtoupper(substr($action,0,1)).substr($action,1).'Action'; + +require( 'actionClasses/Action.class.php' ); +require( 'actionClasses/'.$actionClassName.'.class.php' ); + +$do = new $actionClassName; +$do->actionName = $action; + +if ( $subaction == '' ) + $subaction = $do->defaultSubAction; + +if ( !method_exists($do,$subaction) ) +{ + $action = new Action(); + $action->message('ERROR',"subaction $subaction not defined in class $actionClassName"); +} + +$do->$subaction(); + +?>+ \ No newline at end of file diff --git a/mainmenu.php b/mainmenu.php @@ -1,249 +0,0 @@ -<?php -// --------------------------------------------------------------------------- -// $Id$ -// --------------------------------------------------------------------------- -// DaCMS Content Management System -// Copyright (C) 2002 Jan Dankert, jandankert@jandankert.de -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// --------------------------------------------------------------------------- -// $Log$ -// Revision 1.1 2003-10-02 21:43:35 dankert -// erste Version -// -// --------------------------------------------------------------------------- - -$conf = parse_ini_file( 'config.ini.php',true ); - -require_once( $conf['directories']['incldir']. - '/config.inc.'. - $conf['global']['ext'] ); - -session_start(); - -include( "$conf_incldir/language.inc.$conf_php" ); -include( "$conf_incldir/theme.inc.$conf_php" ); -include( "$conf_incldir/request.inc.$conf_php" ); -include( "$conf_incldir/page.inc.$conf_php" ); -include( "$conf_incldir/db.inc.$conf_php" ); -include( "DB.$conf_php" ); - -$action = $SESS['action']; - -$var = array(); - -$var['subaction'] = array(); -$var['css_body_class'] = 'menu'; - -$var['type'] = lang( $SESS['action'] ); - - - -switch( $action ) -{ - case 'login': - $var['action'] = 'login.'.$conf_php; - $var['name'] = 'loginaction'; - - $var['subaction']['login'] = lang('LOGIN'); - - break; - - - - case 'template': - case 'element': - - $var['action'] = 'template.'.$conf_php; - - // Ermitteln Projectmodell - $db = db_connection(); - $sql = "SELECT name FROM $t_projectmodel WHERE id=".$SESS['projectmodelid']; - $var['projectmodel_name'] = $db->getOne($sql); - - $var['name'] = 'tplaction'; - $var['id'] = 'tpl'.$SESS['templateid']; - - $var['subaction']['list'] = lang('LIST'); - - if ( isset($SESS['templateid']) ) - { - $var['subaction']['show'] = lang('SHOW'); - $var['subaction']['el' ] = lang('ELEMENTS'); - $var['subaction']['src' ] = lang('SOURCE'); - $var['subaction']['prop'] = lang('PROP'); - $var['subaction']['del' ] = lang('DELETE'); - } - break; - - - - case 'page': - case 'pageelement': - $var['type'] = lang( 'PAGE' ).' (ID '.$var['id'] = $SESS['pageid'].')'; - - // Ermitteln Sprache - $db = db_connection(); - $sql = "SELECT name FROM $t_language WHERE id=".$SESS['languageid']; - $var['language_name'] = $db->getOne($sql); - - // Ermitteln Projectmodell - $sql = "SELECT name FROM $t_projectmodel WHERE id=".$SESS['projectmodelid']; - $var['projectmodel_name'] = $db->getOne($sql); - - $var['folder'] = page_get_folder( $SESS['pageid'],false ); - - $var['action'] = 'page.'.$conf_php; - - // Ermitteln Namen der Seite - $sql = "SELECT name FROM $t_page WHERE id=".$SESS['pageid']; - $var['text'] = $db->getOne($sql); - - $var['name'] = 'pageaction'; - $var['id'] = 'page'.$SESS['pageid']; - - $var['subaction']['show'] = lang('SHOW'); - $var['subaction']['edit'] = lang('EDIT'); - $var['subaction']['el' ] = lang('ELEMENTS'); - $var['subaction']['pub' ] = lang('PUBLISH'); - $var['subaction']['prop'] = lang('PROP'); - $var['subaction']['src' ] = lang('SOURCE'); - //$var['subaction']['info'] = lang('INFO'); - $var['subaction']['del' ] = lang('DELETE'); - //$var['subaction']['lang'] = lang('LANGUAGES'); - - break; - - - - case 'user': - $var['action'] = 'user.'.$conf_php; - - $var['name'] = 'useraction'; - - $var['subaction']['show'] = lang('SHOW'); - $var['subaction']['edit'] = lang('EDIT'); - $var['subaction']['groups'] = lang('MEMBERSHIPS'); - $var['subaction']['acls'] = lang('RIGHTS'); - $var['subaction']['pw'] = lang('PASSWORD'); - - break; - - - - case 'group': - $var['action'] = 'group.'.$conf_php; - - $var['name'] = 'groupaction'; - - $var['subaction']['show' ] = lang('SHOW'); - $var['subaction']['edit' ] = lang('EDIT'); - $var['subaction']['users'] = lang('MEMBERSHIPS'); - $var['subaction']['acls' ] = lang('RIGHTS'); - - break; - - - - case 'file': - $var['action'] = 'file.'.$conf_php; - - $var['name'] = 'fileaction'; - $var['id'] = 'file'.$SESS['fileid']; - - $var['subaction']['show'] = lang('SHOW'); - $var['subaction']['edit'] = lang('EDIT'); - $var['subaction']['pub' ] = lang('PUBLISH'); - $var['subaction']['del' ] = lang('DELETE'); - - break; - - - - case 'folder': - $var['action'] = 'folder.'.$conf_php; - - $var['name'] = 'folderaction'; - $var['id'] = 'f'.$SESS['folderid']; - - $var['subaction']['show'] = lang('SHOW'); - - if ( $SESS['folderid'] != '' && $SESS['folderid'] != 'null' ) - $var['subaction']['edit'] = lang('EDIT'); - - if ( $SESS['user']['is_admin'] == '1' ) - $var['subaction']['rights'] = lang('RIGHTS'); - - break; - - - - case 'project': - $var['action'] = 'project.'.$conf_php; - - $var['name'] = 'projectaction'; - $var['subaction']['list'] = lang('LIST'); - - if (isset($SESS['projectid'])) - $var['subaction']['edit'] = lang('EDIT'); - - break; - - - - case 'language': - $var['action'] = 'language.'.$conf_php; - - $var['name'] = 'languageaction'; - $var['id'] = 'lang'; - - $var['subaction']['list' ] = lang('LIST'); - //$var['subaction']['edit' ] = lang('EDIT'); - //$var['subaction']['remove' ] = lang('REMOVE'); - - break; - - - - case 'projectmodel': - $var['action'] = 'projectmodel.'.$conf_php; - - $var['name'] = 'projectmodelaction'; - $var['id'] = 'pvar'; - - $var['subaction']['list' ] = lang('LIST'); - //$var['subaction']['show' ] = lang('SHOW'); - //$var['subaction']['edit' ] = lang('EDIT'); - //$var['subaction']['remove' ] = lang('REMOVE'); - - break; - - - - case 'search': - $var['action'] = 'search.'.$conf_php; - - $var['name'] = 'searchaction'; - - $var['subaction']['file' ] = lang('SEARCH_FILE' ); - $var['subaction']['page' ] = lang('SEARCH_PAGE' ); - $var['subaction']['template'] = lang('SEARCH_TEMPLATE'); - - break; -} - -output( 'main_menu',$var ); - -?>- \ No newline at end of file diff --git a/title.php b/title.php @@ -1,50 +0,0 @@ -<?php -// --------------------------------------------------------------------------- -// $Id$ -// --------------------------------------------------------------------------- -// DaCMS Content Management System -// Copyright (C) 2002 Jan Dankert, jandankert@jandankert.de -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// --------------------------------------------------------------------------- -// $Log$ -// Revision 1.1 2003-09-29 18:20:09 dankert -// erste Version -// -// --------------------------------------------------------------------------- - -$conf = parse_ini_file( 'config.ini.php',true ); - -require_once( $conf['directories']['incldir']. - '/config.inc.'. - $conf['global']['ext'] ); - -session_start(); - - -include( "./$conf_incldir/theme.inc.$conf_php" ); -include( "./$conf_incldir/language.inc.$conf_php" ); -include( "./$conf_incldir/request.inc.$conf_php" ); - -$var = array(); -$var['css_body_class'] = 'title'; -if ( isset($SESS['dbid']) ) $var['db'] = $conf['database_'.$SESS['dbid']]['name']; -if ( isset($SESS['user']) ) $var['user' ] = $SESS['user']['name']; - -$var['project' ] = $SESS['db']; -$var['logout_url' ] = 'index.'.$conf_php.'?action=logout'; -output( 'title',$var ); - -?>- \ No newline at end of file diff --git a/tree.php b/tree.php @@ -1,438 +0,0 @@ -<?php -// --------------------------------------------------------------------------- -// $Id$ -// --------------------------------------------------------------------------- -// DaCMS Content Management System -// Copyright (C) 2002 Jan Dankert, jandankert@jandankert.de -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// --------------------------------------------------------------------------- -// $Log$ -// Revision 1.1 2003-09-29 18:19:48 dankert -// erste Version -// -// --------------------------------------------------------------------------- - - -$conf = parse_ini_file( 'config.ini.php',true ); - -require_once( $conf['directories']['incldir']. - '/config.inc.'. - $conf['global']['ext'] ); - -session_start(); - -require_once "./DB.$conf_php"; -require_once( "$conf_incldir/language.inc.$conf_php" ); -require_once( "$conf_incldir/theme.inc.$conf_php" ); -require_once( "$conf_incldir/tree.inc.$conf_php" ); -require_once( "$conf_incldir/request.inc.$conf_php" ); -require_once( "$conf_incldir/db.inc.$conf_php" ); - - -request_into_session('treeaction'); - -if ( !isset($SESS['treeaction']) ) -{ - $SESS['treeaction'] = $SESS['projectid']; -} - -$treeaction = $SESS['treeaction']; - -if (!isset($SESS['tree_open'])) - $SESS['tree_open'] = array(); - -if ( !is_array($SESS['tree_open'][$treeaction]) ) - $SESS['tree_open'][$treeaction] = array(); - - -if (isset($REQ['open'])) -{ - array_push($SESS['tree_open'][$treeaction],$REQ['open']); -} - - -if (isset($REQ['close'])) -{ - $key = array_search( $REQ['close'],$SESS['tree_open'][$treeaction] ); - if ( !is_null($key) && $key!==false ) - unset( $SESS['tree_open'][$treeaction][$key] ); -} - - -// Erzeugen des Menue-Baums -// -if ( (isset($SESS['user']) && isset($REQ['treeaction'])) || !isset($SESS['tree']) || $REQ['refresh']=='1' ) -{ - $db = db_connection(); - - $SESS['tree'] = array(); - if ( $SESS['treeaction'] == 'admin' ) - { - - // Einstellungen - // - # "root"-element - $SESS['tree']['projects'] = array('text' => lang('PROJECTS'), - 'url' => "main.$conf_php?action=project&projectaction=list", - 'icon' => 'project', - 'target'=> 'cms_main' ); - - $sql = "SELECT * FROM $t_project ORDER BY name"; - $res = $db->query($sql); - if (DB::isError($res)) die ($res->getMessage().'<br>'.$sql); - while ($row = $res->fetchrow(DB_FETCHMODE_ASSOC) ) - { - $SESS['tree']['prj'.$row['id']] = array('text' => $row['name'], - 'parent'=> 'projects', - 'url' => "main.$conf_php?action=project&projectaction=edit&projectid=".$row['id'], - 'icon' => 'project', - 'target'=> 'cms_main' ); - } - $res->free(); - - $SESS['tree']['global'] = array('text' => lang('common'), - 'icon' => 'user' ); - - $SESS['tree']['user'] = array('text' => lang('USER'), - 'parent'=> 'global', - 'url' => "main.$conf_php?action=user&useraction=list", - 'icon' => 'user', - 'target'=> 'cms_main' ); - - $sql = "SELECT * FROM $t_user ORDER BY name"; - $res = $db->query($sql); - while ($row = $res->fetchrow(DB_FETCHMODE_ASSOC) ) - { - $SESS['tree']['user'.$row['id']] = array('text' => $row['name'], - 'url' => "main.$conf_php?action=user&userid=".$row['id'], - 'icon' => 'user', - 'parent' => "user", - 'target' => 'cms_main' ); - } - $res->free(); - - $SESS['tree']['group'] = array('text' => lang('GROUPS'), - 'parent'=> 'global', - 'url' => "main.$conf_php?action=group&groupaction=list", - 'icon' => 'group', - 'target'=> 'cms_main' ); - - $sql = 'SELECT * FROM '.$t_group.' ORDER BY name'; - $res = $db->query($sql); - if (DB::isError($res)) die ($res->getMessage().'<br>'.$sql); - while ($row = $res->fetchrow(DB_FETCHMODE_ASSOC) ) - { - $SESS['tree']['group'.$row['id']] = array('text' => $row['name'], - 'url' => "main.$conf_php?action=group&groupid=".$row['id'], - 'icon' => 'user', - 'parent' => "group", - 'target' => 'cms_main' ); - } - $res->free(); - - $SESS['tree']['logout'] = array('text' => lang('LOGOUT'), - 'url' => "index.$conf_php?action=logout", - 'icon' => 'logout', - 'target'=> '_top' ); - } - else - { - // Projektstruktur - // --------------- - - // Projekt-ID in Session speichern - $SESS['projectid'] = $SESS['treeaction']; - $projectid = $SESS['projectid']; - - // Ermitteln Sprache - $sql = "SELECT id FROM $t_language WHERE projectid=$projectid AND is_default=1"; - $SESS['languageid'] = $db->getOne($sql); - - // Ermitteln Projectmodell - $sql = "SELECT id FROM $t_projectmodel WHERE projectid=$projectid AND is_default=1"; - $SESS['projectmodelid'] = $db->getOne($sql); - - - // Projekt-Baum - // - $SESS['tree']['folder'] = array('text' => lang('FOLDER'), - 'url' => "main.$conf_php?action=folder&folderid=", - 'icon' => 'folder', - 'target' => 'cms_main' ); - - $sql = "SELECT * FROM $t_folder WHERE projectid=$projectid AND parentid IS NULL"; - $res = $db->query($sql); - while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC) ) - { - $SESS['tree']['f'.$row['id']] = array('text' => $row['name'], - 'desc' => $row['desc'], - 'parent' => 'folder', - 'icon' => 'folder', - 'url' => "main.$conf_php?action=folder&folderid=".$row['id'], - 'target' => 'cms_main' ); - add_folder( $row['id'] ); - } - $res->free(); - - $sql = "SELECT * FROM $t_page ". - "WHERE projectid=$projectid AND folderid IS NULL"; - $res = $db->query($sql); - while ($row = $res->fetchrow() ) - { - $SESS['tree']['page'.$row['id']] = array('text' => $row['name'], - 'desc' => $row['desc'], - 'url' => "main.$conf_php?action=page&pageid=".$row['id'], - 'icon' => 'page', - 'parent' => 'folder', - 'target' => 'cms_main' ); - add_page_elements( $row['id'],$row['templateid'] ); - } - $res->free(); - - - $sql = "SELECT * FROM $t_file ". - " WHERE projectid=$projectid AND folderid IS NULL ORDER BY filename"; - $res = $db->query($sql); - if (DB::isError($res)) die ($res->getMessage().'<br>'.$sql); - while ($row = $res->fetchrow(DB_FETCHMODE_ASSOC) ) - { - $SESS['tree']['file'.$row['id']] = array('text' => $row['name'], - 'url' => "main.$conf_php?action=file&fileid=".$row['id'], - 'icon' => 'file', - 'desc' => $row['desc'], - 'name' => 'file'.$row['id'], - 'parent' => 'folder', - 'target' => 'cms_main' ); - } - $res->free(); - - - - // Templates anzeigen - // - if ( $SESS['user']['is_admin'] == '1' ) - { - $SESS['tree']['tpl'] = array('text' => lang('TEMPLATES'), - 'url' => "main.$conf_php?action=template&tplaction=list", - 'icon' => 'tpl_list', - 'target' => 'cms_main' ); - $sql = "SELECT * FROM $t_template WHERE projectid=".$SESS['treeaction']; - $res = $db->query($sql); - while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC) ) - { - $SESS['tree']['tpl'.$row['id']] = array('text' => $row['name'], - 'url' => "main.$conf_php?action=template&templateid=".$row['id'], - 'parent' => "tpl", - 'icon' => 'tpl', - 'target' => 'cms_main' ); - // Anzeigen der Template-Elemente - // - $sql = "SELECT * FROM $t_element WHERE templateid=".$row['id']." ORDER BY name ASC"; - $resel = $db->query($sql); - - while ($rowel = $resel->fetchRow(DB_FETCHMODE_ASSOC) ) - { - $SESS['tree']['tpl'.$row['id'].'el'.$rowel['id']] = array('text' => $rowel['name'], - 'url' => "main.$conf_php?action=element&templateid=".$row['id'].'&elementaction=edit&elementid='.$rowel['id'], - 'icon' => 'el_'.$rowel['type'], - 'parent' => 'tpl'.$row['id'], - 'target' => 'cms_main' ); - } - } - $res->free(); - } - - - // Sprachvarianten - // - if ( $SESS['user']['is_admin'] == '1' ) - { - $SESS['tree']['lang'] = array('text' => lang('LANGUAGES'), - 'url' => "main.$conf_php?action=language", - 'icon' => 'lang_list', - 'target' => 'cms_main' ); - $sql = "SELECT * FROM $t_language". - " WHERE projectid=".$SESS['treeaction']. - " ORDER BY name"; - $res = $db->query($sql); - if (DB::isError($res)) die ($res->getMessage().'<br>'.$sql); - while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC) ) - { - $SESS['tree']['lang'.$row['id']] = array('text' => $row['name'], - 'url' => "main.$conf_php?action=language&languageid=".$row['id'], - 'parent' => 'lang', - 'icon' => 'lang', - 'target' => 'cms_main' ); - } - $res->free(); - } - - - // Projektvarianten - // - if ( $SESS['user']['is_admin'] == '1' ) - { - $SESS['tree']['pvar'] = array('text' => lang('VARIATIONS'), - 'url' => "main.$conf_php?action=projectmodel", - 'icon' => 'model_list', - 'target' => 'cms_main' ); - $sql = "SELECT * FROM $t_projectmodel WHERE projectid=".$SESS['treeaction']; - $res = $db->query($sql); - if (DB::isError($res)) die ($res->getMessage().'<br>'.$sql); - while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC) ) - { - $SESS['tree']['pvar'.$row['id']] = array('text' => $row['name'], - 'url' => "main.$conf_php?action=projectmodel&projectmodelid=".$row['id'], - 'parent' => "pvar", - 'icon' => 'model', - 'target' => 'cms_main' ); - } - $res->free(); - } - - $SESS['tree']['search'] = array('text' => lang('SEARCH'), - 'url' => "main.$conf_php?action=search", - 'icon' => 'search', - 'target' => 'cms_main' ); - - } - - - // Zu jedem Baumelement werden die Kinder ermittelt - // Ziel: Performancesteigerung, schnellere Baumanzeige. - - // Wir benötigen eine Kopie von $SESS['tree'], weil innerhalb einer foreach()-Schleife - // nicht das gleiche Array nochmal mit foreach() durchlaufen werden kann. - $SESS['tree_kopie'] = $SESS['tree']; - - foreach( $SESS['tree'] as $idx=>$inh ) - { - $SESS['tree'][$idx]['children'] = array(); - - foreach( $SESS['tree_kopie'] as $name=>$val ) - { - if ( $val['parent'] == $idx ) - { - $SESS['tree'][$idx]['children'][] = $name; - } - } - } - unset( $SESS['tree_kopie'] ); - -} - - - - -function add_folder( $parentid ) -{ - global $db, - - $SESS, - - $conf_php, - $t_templatemodel, - $t_template, - $t_folder, - $t_file, - $t_page; - $sql = "SELECT * FROM $t_folder ". - "WHERE projectid=".$SESS['treeaction']. - " AND parentid=$parentid"; - $res = $db->query($sql); - if (DB::isError($res)) die ($res->getMessage().'<br>'.$sql); - while ($row = $res->fetchrow(DB_FETCHMODE_ASSOC) ) - { - $SESS['tree']['f'.$row['id']] = array('text' => $row['name'], - 'desc' => $row['desc'], - 'url' => "main.$conf_php?action=folder&folderid=".$row['id'], - 'icon' => 'folder', - 'parent' => "f$parentid", - 'target' => 'cms_main' ); - add_folder( $row['id'] ); - } - $res->free(); - - $sql = "SELECT * FROM $t_page ". - //"LEFT JOIN $t_templatemodel ON $t_page.templateid=$t_templatemodel.id ". - "WHERE folderid=$parentid"; - $res = $db->query($sql); - while ($row = $res->fetchrow() ) - { - $SESS['tree']['page'.$row['id']] = array('text' => $row['name'], - 'url' => "main.$conf_php?action=page&pageid=".$row['id'], - 'icon' => 'page', - 'desc' => $row['desc'], - 'parent' => "f$parentid", - 'target' => 'cms_main' ); - - add_page_elements( $row['id'],$row['templateid'] ); - } - $res->free(); - - $sql = "SELECT * FROM $t_file WHERE folderid=$parentid ORDER BY filename"; - $res = $db->query($sql); - if (DB::isError($res)) die ($res->getMessage().'<br>'.$sql); - while ($row = $res->fetchrow(DB_FETCHMODE_ASSOC) ) - { - $SESS['tree']['file'.$row['id']] = array('text' => $row['name'], - 'url' => "main.$conf_php?action=file&fileid=".$row['id'], - 'icon' => 'file', - 'desc' => $row['desc'], - 'name' => 'file'.$row['id'], - 'parent' => "f$parentid", - 'target' => 'cms_main' ); - } - $res->free(); -} - -function add_page_elements( $pageid,$templateid ) -{ - global $db,$SESS,$conf_php,$t_element; - - $sql = "SELECT * FROM $t_element ". - " WHERE templateid=$templateid ". - " AND $t_element.type!='infodate' AND $t_element.type!='info'". - " ORDER BY name ASC"; - $res = $db->query($sql); - if (DB::isError($res)) die ($res->getMessage().'<br>'.$sql); - while ($row = $res->fetchrow(DB_FETCHMODE_ASSOC) ) - { - $SESS['tree']['page'.$pageid.'el'.$row['id'] ] = array('text' => $row['name'], - 'url' => "main.$conf_php?action=pageelement&pageid=".$pageid.'&elementid='.$row['id'], - 'icon' => 'el_'.$row['type'], - 'parent' => "page$pageid", - 'target' => 'cms_main' ); - } - $res->free(); -} - - -// Füllen der Ausgabevariablen -// -$var = array(); - -// Erzeugen des Baumes. Die Ausgabe erfolgt in die Variable $var -tree_show( &$var ); - -// Link zum Aktualisieren -$var['refresh_url'] = $PHP_SELF.'?treeaction='.$SESS['treeaction']; - -// Ausgabe des Templates -// -output('tree',$var); - -?>- \ No newline at end of file diff --git a/treemenu.php b/treemenu.php @@ -1,91 +0,0 @@ -<?php -// --------------------------------------------------------------------------- -// $Id$ -// --------------------------------------------------------------------------- -// DaCMS Content Management System -// Copyright (C) 2002 Jan Dankert, jandankert@jandankert.de -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// --------------------------------------------------------------------------- -// $Log$ -// Revision 1.1 2003-09-29 18:18:48 dankert -// erste Version -// -// --------------------------------------------------------------------------- - -$conf = parse_ini_file( 'config.ini.php',true ); - -require_once( $conf['directories']['incldir']. - '/config.inc.'. - $conf['global']['ext'] ); - -session_start(); - -include( "DB.php" ); -include( "$conf_incldir/language.inc.$conf_php" ); -include( "$conf_incldir/theme.inc.$conf_php" ); -include( "$conf_incldir/db.inc.$conf_php" ); -include( "$conf_incldir/request.inc.$conf_php" ); - -$var = array(); - -$var['css_body_class'] = 'menu'; - -if (isset($SESS['user'])) -{ - $var['form_method'] = 'get'; - $var['form_target'] = 'cms_tree'; - $var['form_action'] = 'tree.'.$conf_php; - - $var['form_select_name'] = 'treeaction'; - $var['form_select_onchange'] = 'submit();'; - $var['form_select_value'] = array(); - - - // Lesen der verfügbaren Projekte - $db = db_connection(); - $sql = new Sql( 'SELECT id,name from {t_project} ORDER BY name ASC' ); - $projekte = $db->getAssoc( $sql->query ); - - // Unterscheidung Administrator/Benutzer - if ( $SESS['user']['is_admin'] == '1' ) - { - // Administrator sieht Administrationsbereich - $var['form_select_value']['admin'] = lang('ADMINISTRATION'); - - // Administrator sieht alle Projekte - foreach( $projekte as $projectid=>$name ) - { - $var['form_select_value'][$projectid] = $name; - } - } - else - { - // Bereitstellen der Projekte, für die der Benutzer berechtigt ist - //print_r($SESS['rights']); - foreach( $projekte as $projectid=>$name ) - { - if ( isset( $SESS['rights'][$projectid]) ) - $var['form_select_value'][$projectid] = $name; - } - } - - $var['form_select_default'] = $SESS['projectid']; -} - -// Ausgabe des Templates -output('tree_menu',$var); - -?>- \ No newline at end of file