openrat-cms

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

commit 2d38c49a35e4df7414d2f151717a848a1326ff76
parent 349b8c4ab445d03a944e16cfcc3b7b69cfbcd6ef
Author: dankert <devnull@localhost>
Date:   Tue, 24 Jan 2006 00:10:16 +0100

Steuerung der Aktionsklassen ?ber .ini-Dateien

Diffstat:
actionClasses/GroupAction.class.php | 48+++++++++++++++++++++++++++++++-----------------
actionClasses/IndexAction.class.php | 83++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------
actionClasses/UserAction.class.php | 101++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------
3 files changed, 146 insertions(+), 86 deletions(-)

diff --git a/actionClasses/GroupAction.class.php b/actionClasses/GroupAction.class.php @@ -20,7 +20,10 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // $Log$ -// Revision 1.4 2004-12-19 19:23:05 dankert +// Revision 1.5 2006-01-23 23:10:16 dankert +// Steuerung der Aktionsklassen ?ber .ini-Dateien +// +// Revision 1.4 2004/12/19 19:23:05 dankert // Ausgeben von "Notices" // // Revision 1.3 2004/12/15 23:23:11 dankert @@ -62,27 +65,47 @@ class GroupAction extends Action } - function save() + + function delete() { if ( $this->hasRequestVar('delete') ) { $this->group->delete(); - + $this->addNotice('group',$this->group->name,'DELETED','ok'); } else { - $this->group->name = $this->getRequestVar('name'); - $this->group->save(); - - $this->addNotice('group',$this->group->name,'SAVED','ok'); + $this->addNotice('group',$this->group->name,'NOT_DELETED','ok'); } - $this->callSubAction('listing'); + } + + + + function remove() + { + $this->setTemplateVars( $this->group->getProperties() ); + } + + + + function save() + { + $this->group->name = $this->getRequestVar('name'); + + $this->group->save(); + + $this->addNotice('group',$this->group->name,'SAVED','ok'); } function add() { + } + + + function addgroup() + { $this->group = new Group(); $this->group->name = $this->getRequestVar('name'); $this->group->add(); @@ -145,16 +168,12 @@ class GroupAction extends Action } $this->setTemplateVar('el', $list); - - $this->forward('group_list'); } function edit() { $this->setTemplateVars( $this->group->getProperties() ); - - $this->forward('group_edit'); } @@ -168,9 +187,6 @@ class GroupAction extends Action // Alle hinzuf?gbaren Benutzer ermitteln // $this->setTemplateVar('users',$this->group->getOtherUsers()); - - $this->forward('group_users'); - } @@ -178,7 +194,5 @@ class GroupAction extends Action { $this->setTemplateVar('projects',$this->group->getRights()); - $this->forward('group_rights'); - } } \ No newline at end of file diff --git a/actionClasses/IndexAction.class.php b/actionClasses/IndexAction.class.php @@ -20,7 +20,10 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // $Log$ -// Revision 1.21 2005-04-16 21:35:23 dankert +// Revision 1.22 2006-01-23 23:10:16 dankert +// Steuerung der Aktionsklassen ?ber .ini-Dateien +// +// Revision 1.21 2005/04/16 21:35:23 dankert // Uebergabe von Loginfehlern als normale Hinweismeldung // // Revision 1.20 2005/03/13 16:39:00 dankert @@ -97,17 +100,14 @@ define('PROJECTID_ADMIN',-1); class IndexAction extends Action { - var $defaultSubAction = 'show'; - - function setDb( $dbid ) { global $conf; - if ( !isset($conf['databases'][$dbid] )) + if ( !isset($conf['database'][$dbid] )) die( 'unknown DB-Id: '.$dbid ); - $db = new DB( $conf['databases'][$dbid] ); + $db = new DB( $conf['database'][$dbid] ); $db->id = $dbid; Session::setDatabase( $db ); } @@ -192,9 +192,10 @@ class IndexAction extends Action { global $conf; - foreach( $conf['databases'] as $dbname=>$dbconf ) + foreach( $conf['database'] as $dbname=>$dbconf ) { - $dbids[$dbname] = $dbconf['comment']; + if ( is_array($dbconf) && $dbconf['enabled'] ) + $dbids[$dbname] = $dbconf['comment']; } $this->setTemplateVar( 'dbids',$dbids ); @@ -215,21 +216,18 @@ class IndexAction extends Action $this->setTemplateVar('send_password',$conf['login' ]['send_password']); $this->setTemplateVar('loginmessage',$this->getSessionVar('loginmessage')); $this->setSessionVar('loginmessage',''); - - $this->forward('login'); } - function showmenu() + function projectmenu() { - global $conf; $user = Session::getUser(); $projects = $user->projects; $this->lastModified( $user->loginDate ); // Administrator sieht Administrationsbereich - if ( $user->isAdmin ) - $projects = array("-1"=>lang('GLOBAL_ADMINISTRATION')) + $projects; +// if ( $user->isAdmin ) +// $projects = array("-1"=>lang('GLOBAL_ADMINISTRATION')) + $projects; // Projekte ermitteln @@ -241,8 +239,6 @@ class IndexAction extends Action $list[$id]['name'] = $name; } $this->setTemplateVar('el',$list); - - $this->forward('project_select'); } @@ -271,8 +267,6 @@ class IndexAction extends Action if ( !$loginOk ) $this->addNotice('','','LOGIN_FAILED','error',array('name'=>$this->getRequestVar('login_name')) ); - - $this->callSubAction('show'); } @@ -283,11 +277,19 @@ class IndexAction extends Action // Aus Sicherheitsgruenden die komplette Session deaktvieren session_unset(); - - $this->callSubAction('show'); } + function administration() + { + if ( !$this->userIsAdmin() ) + die(':P'); + + Session::setProject( new Project(-1) ); + } + + + function project() { $user = Session::getUser(); @@ -326,8 +328,6 @@ class IndexAction extends Action { Session::setProject( $project ); } - - $this->callSubAction('show'); } @@ -357,8 +357,6 @@ class IndexAction extends Action $user->loadRights( $project->projectid,$language->languageid ); Session::setUser( $user ); - - $this->callSubAction('show'); } @@ -387,7 +385,6 @@ class IndexAction extends Action $user = Session::getUser(); $user->loadRights( $project->projectid,$language->languageid ); Session::setUser( $user ); - $this->callSubAction('show'); } @@ -416,21 +413,18 @@ class IndexAction extends Action $user = Session::getUser(); $user->loadRights( $project->projectid,$language->languageid ); Session::setUser( $user ); - $this->callSubAction('show'); } function showtree() { Session::set('showtree',true ); - $this->callSubAction('show'); } function hidetree() { Session::set('showtree',false ); - $this->callSubAction('show'); } @@ -508,20 +502,45 @@ class IndexAction extends Action } else { - $this->callSubAction( 'showmenu' ); + $this->callSubAction( 'projectmenu' ); } $this->setTemplateVar( 'frame_src_title' ,Html::url( 'title' ) ); $this->setTemplateVar( 'show_tree',(Session::get('showtree')==true) ); - $this->setTemplateVar( 'frame_src_treemenu',Html::url( 'treemenu' ) ); - $this->setTemplateVar( 'frame_src_tree' ,Html::url( 'tree' ,'load') ); + $this->setTemplateVar( 'frame_src_tree_menu' ,Html::url( 'treemenu' ) ); + $this->setTemplateVar( 'frame_src_tree_title',Html::url( 'treetitle' ) ); + $this->setTemplateVar( 'frame_src_tree' ,Html::url( 'tree' ,'load') ); + $this->setTemplateVar( 'frame_src_clipboard' ,Html::url( 'clipboard' ) ); + $this->setTemplateVar( 'frame_src_border' ,Html::url( 'border' ) ); + $this->setTemplateVar( 'frame_src_background',Html::url( 'background' ) ); $this->setTemplateVar( 'tree_width',$conf['interface']['tree_width'] ); + } + + + + function checkMenu( $name ) + { + global $conf; - $this->forward( 'frameset' ); + switch( $name ) + { + case 'register': + return $conf['login']['register']; + + case 'send_password': + $conf['login']['send_password']; + + case 'administration': + return $this->userIsAdmin(); + + default: + return true; + } } } + ?> \ No newline at end of file diff --git a/actionClasses/UserAction.class.php b/actionClasses/UserAction.class.php @@ -49,47 +49,65 @@ class UserAction extends Action function save() { + // Benutzer speichern + $this->user->name = $this->getRequestVar('name' ); + $this->user->fullname = $this->getRequestVar('fullname'); + $this->user->isAdmin = $this->hasRequestVar('is_admin'); + $this->user->ldap_dn = $this->getRequestVar('ldap_dn' ); + $this->user->tel = $this->getRequestVar('tel' ); + $this->user->desc = $this->getRequestVar('desc' ); + $this->user->mail = $this->getRequestVar('mail' ); + $this->user->style = $this->getRequestVar('style' ); + + $this->user->save(); + $this->addNotice('user',$this->user->name,'SAVED','ok'); + } + + + + function remove() + { + $this->setTemplateVars( $this->user->getProperties() ); + } + + + + function delete() + { if ( $this->hasRequestVar('delete') ) { $this->user->delete(); $this->addNotice('user',$this->user->name,'DELETED','ok'); } - else - { - // Benutzer speichern - $this->user->name = $this->getRequestVar('name' ); - $this->user->fullname = $this->getRequestVar('fullname'); - $this->user->isAdmin = $this->hasRequestVar('is_admin'); - $this->user->ldap_dn = $this->getRequestVar('ldap_dn' ); - $this->user->tel = $this->getRequestVar('tel' ); - $this->user->desc = $this->getRequestVar('desc' ); - $this->user->mail = $this->getRequestVar('mail' ); - $this->user->style = $this->getRequestVar('style' ); - - $this->user->save(); - $this->addNotice('user',$this->user->name,'SAVED','ok'); - } - - $this->callSubAction('listing'); } function add() { + } + + + + function adduser() + { $this->user = new User(); $this->user->add( $this->getRequestVar('name') ); $this->addNotice('user',$this->user->name,'ADDED','ok'); - - $this->callSubAction('listing'); } - function addgroup() + function addgrouptouser() { $this->user->addGroup( $this->getRequestVar('groupid') ); $this->addNotice('user',$this->user->name,'ADDED','ok'); - $this->callSubAction('groups'); + } + + + function addgroup() + { + // Alle hinzufuegbaren Gruppen ermitteln + $this->setTemplateVar('groups',$this->user->getOtherGroups()); } @@ -98,7 +116,6 @@ class UserAction extends Action $this->user->delGroup( $this->getRequestVar('groupid') ); $this->addNotice('user',$this->user->name,'DELETED','ok'); - $this->callSubAction('groups'); } @@ -153,14 +170,14 @@ class UserAction extends Action // Zufaelliges Kennwort erzeugen if ( $this->hasRequestVar('random') && $this->hasRequestVar('mail') ) { - $pw1 = substr( md5(microtime().session_id()),0,intval($conf['security']['random_password_length']) ); + $pw1 = substr( md5(microtime().session_id()),0,intval($conf['security']['password']['random_length']) ); $pw2 = $pw1; } // Wenn Kennwoerter identisch und lang genug if ( $pw1 == $pw2 && - strlen($pw1)>=intval($conf['security']['min_password_length']) ) + strlen($pw1)>=intval($conf['security']['password']['min_length']) ) { $this->user->setPassword($pw1); // Kennwort setzen @@ -173,7 +190,6 @@ class UserAction extends Action $this->addNotice('user',$this->user->name,'SAVED','ok'); } - $this->callSubAction('edit'); } @@ -188,8 +204,6 @@ class UserAction extends Action $list[$user->userid]['url' ] = Html::url('main','user',$user->userid); } $this->setTemplateVar('el',$list); - - $this->forward('user_list'); } @@ -201,20 +215,22 @@ class UserAction extends Action $this->setTemplateVars( $this->user->getProperties() ); $this->setTemplateVar( 'allstyles',$this->user->getAvailableStyles() ); - - $this->forward( 'user_edit' ); } function groups() { - // Alle hinzufuegbaren Gruppen ermitteln - $this->setTemplateVar('groups',$this->user->getOtherGroups()); - // Mitgliedschaften $this->setTemplateVar('memberships',$this->user->getGroups()); - $this->forward('user_groups'); + $gruppenListe = array(); + + foreach( $this->user->getGroups() as $id=>$name ) + { + $gruppenListe[$id] = array('name' =>$name, + 'delgroupurl'=>Html::url($this->actionName,'delgroup',$this->getRequestId(),array('groupid'=>$id)) ); + } + $this->setTemplateVar('memberships',$gruppenListe); } @@ -223,9 +239,7 @@ class UserAction extends Action */ function pw() { - $this->setTemplateVar('mail',$this->user->mail); - - $this->forward('user_pw'); + $this->setTemplateVars( $this->user->getProperties() ); } @@ -257,7 +271,20 @@ class UserAction extends Action $this->setTemplateVar('rights' ,$rightList ); $this->setTemplateVar('objects' ,$objectList ); $this->setTemplateVar('show' ,$show ); + } + + + function checkMenu( $menu ) + { + switch( $menu ) + { + case 'addgroup': + return count($this->user->getOtherGroups()) > 0; - $this->forward('user_rights'); + case 'groups': + return count($this->user->getGroups()) > 0; + } + + return true; } } \ No newline at end of file