openrat-cms

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

commit 8760f23b94739452d3088fd0e45eede210d58686
parent 60f3960ff9c6aa4f14ee36eb0cd1e1d2726adbe4
Author: dankert <devnull@localhost>
Date:   Wed, 10 Nov 2004 23:40:49 +0100

Benutzen der Session-Klasse

Diffstat:
actionClasses/TitleAction.class.php | 149+++++++++++++++++++++++++++++++++++++++----------------------------------------
actionClasses/TreeAction.class.php | 75++++++++++++++++++++++++++++-----------------------------------------------
2 files changed, 101 insertions(+), 123 deletions(-)

diff --git a/actionClasses/TitleAction.class.php b/actionClasses/TitleAction.class.php @@ -1,78 +1,75 @@ -<?php -// --------------------------------------------------------------------------- -// $Id$ -// --------------------------------------------------------------------------- -// OpenRat 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. -// --------------------------------------------------------------------------- +<?php +// --------------------------------------------------------------------------- +// $Id$ +// --------------------------------------------------------------------------- +// OpenRat 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.2 2004-05-02 14:49:37 dankert -// Einfügen package-name (@package) -// -// Revision 1.1 2004/04/24 15:14:52 dankert -// Initiale Version -// -// --------------------------------------------------------------------------- - - -/** - * Actionklasse zum Anzeigen der Titelleiste - * @author $Author$ - * @version $Revision$ - * @package openrat.actions - */ -class TitleAction extends Action -{ - /** - * Standard-Subaction - * @type String - */ - var $defaultSubAction = 'show'; - - - /** - * Fuellen der Variablen und Anzeigen der Titelleiste - */ - function show() - { - global $SESS,$conf; - - $this->setTemplateVar('css_body_class','title'); - - if ( $this->getSessionVar('dbid') != '' ) - { - $this->setTemplateVar('dbid' ,$this->getSessionVar('dbid') ); - $this->setTemplateVar('dbname',$conf['database_'.$this->getSessionVar('dbid')]['comment'] ); - } - - if ( isset($SESS['user']) ) - { - $this->setTemplateVar('username' ,$SESS['user']['name'] ); - $this->setTemplateVar('userfullname',$SESS['user']['fullname']); - } - - // Urls zum Benutzerprofil und zum Abmelden - $this->setTemplateVar('profile_url',Html::url( array('action' =>'user', - 'subaction'=>'profile' ) )); - $this->setTemplateVar('logout_url' ,Html::url( array('action' =>'index', - 'subaction'=>'logout' ) )); - - $this->forward( 'title' ); - } -} - +// Revision 1.3 2004-11-10 22:40:32 dankert +// Benutzen der Session-Klasse +// +// Revision 1.2 2004/05/02 14:49:37 dankert +// Einf?gen package-name (@package) +// +// Revision 1.1 2004/04/24 15:14:52 dankert +// Initiale Version +// +// --------------------------------------------------------------------------- + + +/** + * Actionklasse zum Anzeigen der Titelleiste + * @author $Author$ + * @version $Revision$ + * @package openrat.actions + */ +class TitleAction extends Action +{ + /** + * Standard-Subaction + * @type String + */ + var $defaultSubAction = 'show'; + + + /** + * Fuellen der Variablen und Anzeigen der Titelleiste + */ + function show() + { + $this->setTemplateVar('css_body_class','title'); + + $db = Session::getDatabase(); + $this->setTemplateVar('dbid' ,$db->id ); + $this->setTemplateVar('dbname',$db->conf['comment'] ); + + $user = Session::getUser(); + $this->setTemplateVar('username' ,$user->name ); + $this->setTemplateVar('userfullname',$user->fullname); + + // Urls zum Benutzerprofil und zum Abmelden + $this->setTemplateVar('profile_url',Html::url( array('action' =>'user', + 'subaction'=>'profile' ) )); + $this->setTemplateVar('logout_url' ,Html::url( array('action' =>'index', + 'subaction'=>'logout' ) )); + + $this->forward( 'title' ); + } +} + ?> \ No newline at end of file diff --git a/actionClasses/TreeAction.class.php b/actionClasses/TreeAction.class.php @@ -20,14 +20,17 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // $Log$ -// Revision 1.6 2004-09-30 20:28:30 dankert +// Revision 1.7 2004-11-10 22:40:49 dankert +// Benutzen der Session-Klasse +// +// Revision 1.6 2004/09/30 20:28:30 dankert // Titel bei ?ffnen/Schlie?en von Baumzweigen // // Revision 1.5 2004/09/07 21:12:30 dankert // F?llen des Navigationsbaumes mit neuen Klassen // // Revision 1.4 2004/05/02 14:49:37 dankert -// Einfügen package-name (@package) +// Einf?gen package-name (@package) // // Revision 1.3 2004/04/25 17:53:37 dankert // Neue Methode openall() @@ -52,11 +55,12 @@ class TreeAction extends Action { - var $defaultSubAction = 'reload'; + var $defaultSubAction = 'load'; + var $tree; /** - * Öffnen aller Baumelemente + * ?ffnen aller Baumelemente */ function openall() { @@ -64,29 +68,26 @@ class TreeAction extends Action /** - * Öffnen eines Baumelementes + * ?ffnen eines Baumelementes */ function open() { - $tree = $this->getSessionVar('tree'); - - $tree->open( $this->getRequestVar('open') ); - $this->setSessionVar( 'tree',$tree ); + $this->tree = Session::getTree(); + $this->tree->open( $this->getRequestVar('open') ); + Session::setTree( $this->tree ); $this->callSubAction('show'); } /** - * Schließen eines Baumelementes + * Schlie?en eines Baumelementes */ function close() { - language_read(); // TODO Beim 1. stable-Release entfernen! - - $tree = $this->getSessionVar('tree'); - $tree->close( $this->getRequestVar('close') ); - $this->setSessionVar( 'tree',$tree ); + $this->tree = Session::getTree(); + $this->tree->close( $this->getRequestVar('close') ); + Session::setTree( $this->tree ); $this->callSubAction('show'); } @@ -95,42 +96,31 @@ class TreeAction extends Action /** * Neues Laden des Baumes */ - function reload() + function load() { global $SESS; - $projectid = $this->getSessionVar('projectid'); + $project = Session::getProject(); + $projectid = $project->projectid; - if ( $this->getRequestVar('projectid') != '' ) - { - // Beim Laden eines neuen Projektes die bisherigen - // Sprach- und Projektmodelleinstellungen entfernen - unset( $SESS['modelid'] ); - unset( $SESS['languageid' ] ); - } - // Erzeugen des Menue-Baums // language_read(); // TODO Beim 1. stable-Release entfernen! - if ( $projectid == 0 ) - { - $this->forward('blank'); - } - elseif ( $projectid == -1 ) + if ( $projectid == -1 ) { - $tree = new AdministrationTree(); + $this->tree = new AdministrationTree(); } else { - $tree = new ProjectTree(); - $tree->projectId = $projectid; + $this->tree = new ProjectTree(); + $this->tree->projectId = $projectid; + $SESS['languageid'] = Language::getDefaultId(); $SESS['modelid' ] = Model::getDefaultId(); } - $this->setSessionVar( 'tree',$tree ); - + Session::setTree( $this->tree ); // Weiter mit show() // @@ -140,13 +130,7 @@ class TreeAction extends Action function outputElement( $elId,$tiefe,$isLast ) { -// echo "elid $elId in tiefe $tiefe"; - global - $tree, - $SESS, - $PHP_SELF; - - $treeElement = $tree->elements[$elId]; + $treeElement = $this->tree->elements[$elId]; $zeilen = array(); $zeile = array(); @@ -214,10 +198,10 @@ class TreeAction extends Action $zeilen[] = $zeile; // Rekursiv alle Unter-Elemente lesen $nr = 0; - foreach( $tree->elements[$elId]->subElementIds as $subElementId ) + foreach( $this->tree->elements[$elId]->subElementIds as $subElementId ) { $nr++; - if ( $nr == count($tree->elements[$elId]->subElementIds) ) + if ( $nr == count($this->tree->elements[$elId]->subElementIds) ) $isLast[$tiefe+1] = true; else $isLast[$tiefe+1] = false; @@ -241,9 +225,6 @@ class TreeAction extends Action $var['zeilen']=array(); - global $tree; - $tree = $this->getSessionVar('tree'); - // echo '<pre>'; // print_r($tree); // echo '</pre>';