openrat-cms

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

commit 0081e10452597e446acf80d1fff50836390410db
parent 6678206d861a66a912134f8bb92e2aed18d69c62
Author: dankert <devnull@localhost>
Date:   Thu, 16 Dec 2004 00:14:11 +0100

Html::url()-Parameter angepasst

Diffstat:
serviceClasses/AdministrationTree.class.php | 33+++++++--------------------------
serviceClasses/Html.class.php | 38+++++++++++++++++++++++++-------------
serviceClasses/ProjectTree.class.php | 113+++++++++++++++++++++++++++++++++++++++++++------------------------------------
3 files changed, 94 insertions(+), 90 deletions(-)

diff --git a/serviceClasses/AdministrationTree.class.php b/serviceClasses/AdministrationTree.class.php @@ -49,10 +49,7 @@ class AdministrationTree extends AbstractTree $treeElement = new TreeElement(); $treeElement->text = lang('GLOBAL_PROJECTS'); $treeElement->description = lang('GLOBAL_PROJECTS'); - $treeElement->url = Html::url(array('action' =>'main', - 'callSubaction'=>'listing', - 'callAction' =>'project', - 'projectid' =>'0')); + $treeElement->url = Html::url('main','project'); $treeElement->icon = 'project_list'; $treeElement->type = 'projects'; $treeElement->target = 'cms_main'; @@ -95,10 +92,7 @@ class AdministrationTree extends AbstractTree $treeElement = new TreeElement(); $treeElement->text = lang('GLOBAL_USER'); $treeElement->description = lang('GLOBAL_USER'); - $treeElement->url = Html::url(array('action' =>'main', - 'callSubaction'=>'listing', - 'callAction' =>'user', - 'userid' =>'0')); + $treeElement->url = Html::url('main','user'); $treeElement->icon = 'user'; $treeElement->target = 'cms_main'; $treeElement->type = 'users'; @@ -108,10 +102,7 @@ class AdministrationTree extends AbstractTree $treeElement = new TreeElement(); $treeElement->text = lang('GLOBAL_GROUPS'); $treeElement->description = lang('GLOBAL_GROUPS'); - $treeElement->url = Html::url(array('action' =>'main', - 'callSubaction'=>'listing', - 'callAction' =>'group', - 'groupid' =>'0')); + $treeElement->url = Html::url('main','group'); $treeElement->icon = 'group'; $treeElement->target = 'cms_main'; $treeElement->type = 'groups'; @@ -129,10 +120,7 @@ class AdministrationTree extends AbstractTree $treeElement->internalId = $id; $treeElement->text = $name; - $treeElement->url = Html::url(array('action'=>'main', - 'callAction' =>'project', - 'callSubaction'=>'edit', - 'projectid' =>$id )); + $treeElement->url = Html::url('main','project',$id); $treeElement->icon = 'project'; $treeElement->description = ''; $treeElement->target = 'cms_main'; @@ -152,10 +140,7 @@ class AdministrationTree extends AbstractTree $u->load(); $treeElement->internalId = $id; $treeElement->text = $u->name; - $treeElement->url = Html::url(array('action' =>'main', - 'callAction' =>'user', - 'callSubaction'=>'edit', - 'userid' =>$id )); + $treeElement->url = Html::url('main','user',$id); $treeElement->icon = 'user'; $desc = $u->fullname; @@ -187,9 +172,7 @@ class AdministrationTree extends AbstractTree $treeElement->internalId = $id; $treeElement->text = $g->name; - $treeElement->url = Html::url(array('action' =>'main', - 'callAction' =>'group', - 'groupid' =>$id )); + $treeElement->url = Html::url('main','group',$id); $treeElement->icon = 'group'; $treeElement->description = lang('GLOBAL_GROUP').' '.$g->name.': '.implode(', ',$g->getUsers()); $treeElement->target = 'cms_main'; @@ -211,9 +194,7 @@ class AdministrationTree extends AbstractTree $u = new User( $id ); $u->load(); $treeElement->text = $u->name; - $treeElement->url = Html::url(array('action' =>'main', - 'callAction' =>'user', - 'userid' =>$id )); + $treeElement->url = Html::url('main','user',$id); $treeElement->icon = 'user'; $treeElement->description = $u->fullname; $treeElement->target = 'cms_main'; diff --git a/serviceClasses/Html.class.php b/serviceClasses/Html.class.php @@ -48,25 +48,22 @@ class Html } - function url( $params ) + function url( $action,$subaction='',$id='-',$params=array() ) { global $conf; - - $fake_urls = $conf['interface']['fake_urls']; - if ( isset($params['callAction']) ) + if ( is_array($action) ) { - $params['subaction'] = $params['callAction']; - unset( $params['callAction'] ); - unset( $params['callSubaction'] ); - } - - if ( isset($params['objectid']) && !isset($params['id']) ) - $params['id'] = $params['objectid']; + $params = $action; + if ( isset($params['callAction']) ) + { + $params['subaction'] = $params['callAction']; + unset( $params['callAction'] ); + unset( $params['callSubaction'] ); + } + - if ( $fake_urls ) - { if ( !isset($params['action' ])) $params['action' ] = ''; if ( !isset($params['subaction'])) $params['subaction'] = ''; if ( !isset($params['id' ])) $params['id' ] = ''; @@ -76,10 +73,25 @@ class Html unset( $params['action' ] ); unset( $params['subaction'] ); unset( $params['id' ] ); + $params['old']='true'; + } + $fake_urls = $conf['interface']['nice_urls']; + + if ( isset($params['objectid']) && !isset($params['id']) ) + $params['id'] = $params['objectid']; + + if ( $fake_urls ) + { if ( $id != '' ) $id = '.'.$id; } + else + { + $params[REQ_PARAM_ACTION ] = $action; + $params[REQ_PARAM_SUBACTION] = $subaction; + $params[REQ_PARAM_ID ] = $id; + } if ( count($params) > 0 ) { diff --git a/serviceClasses/ProjectTree.class.php b/serviceClasses/ProjectTree.class.php @@ -59,19 +59,15 @@ class ProjectTree extends AbstractTree if ( $element->isWritable() ) { $treeElement = new TreeElement(); - $treeElement->text = $element->name; - $treeElement->url = Html::url(array('action' =>'main', - 'callAction' =>'pageelement', - 'callSubaction' =>'edit', - 'objectid' =>$id, - 'elementid' =>$elementid )); - $treeElement->icon = 'el_'.$element->type; + $treeElement->text = $element->name; + $treeElement->url = Html::url('main','pageelement',$id,array('elementid'=>$elementid)); + $treeElement->icon = 'el_'.$element->type; $treeElement->description = lang('EL_'.$element->type); if ( $element->desc != '' ) $treeElement->description .= ' - '.Text::maxLaenge( 25,$element->desc ); else - $treeElement->description .= ' - '.lang('NO_DESCRIPTION_AVAILABLE'); + $treeElement->description .= ' - '.lang('GLOBAL_NO_DESCRIPTION_AVAILABLE'); $treeElement->target = 'cms_main'; $this->addTreeElement( $treeElement ); } @@ -79,6 +75,44 @@ class ProjectTree extends AbstractTree } + function link( $id ) + { + $link = new Link( $id ); + $link->load(); + + if ( $link->isLinkToObject ) + { + $o = new Object( $link->linkedObjectId ); + $o->load(); + + $treeElement = new TreeElement(); + $treeElement->internalId = $o->objectid; + $treeElement->target = 'cms_main'; + $treeElement->text = Text::maxLaenge( 25,$o->name ); + $treeElement->description= lang( 'GLOBAL_'.$o->getType() ).' '.$id; + + if ( $o->desc != '' ) + $treeElement->description .= ': '.$o->desc; + else + $treeElement->description .= ' - '.lang('GLOBAL_NO_DESCRIPTION_AVAILABLE'); + + $treeElement->url = Html::url('main',$o->getType(),$o->objectid ); + $treeElement->icon = $o->getType(); + + // Besonderheiten fuer bestimmte Objekttypen + + if ( $o->isPage ) + { + // Nur wenn die Seite beschreibbar ist, werden die + // Elemente im Baum angezeigt + if ( $o->hasRight( ACL_WRITE ) ) + $treeElement->type='pageelements'; + } + $this->addTreeElement( $treeElement ); + } + } + + /** * Laedt Elemente zu einem Ordner * @return Array @@ -92,17 +126,14 @@ class ProjectTree extends AbstractTree $f = new Folder( $id ); $t = time(); - foreach( $f->getObjectIds() as $id ) + foreach( $f->getObjects() as $o ) { - $o = new Object( $id ); - $o->load(); - // Wenn keine Leseberechtigung if ( !$o->hasRight( ACL_READ ) ) continue; $treeElement = new TreeElement(); - $treeElement->internalId = $id; + $treeElement->internalId = $o->objectid; $treeElement->target = 'cms_main'; $treeElement->text = Text::maxLaenge( 25,$o->name ); $treeElement->description= lang( 'GLOBAL_'.$o->getType() ).' '.$id; @@ -112,13 +143,16 @@ class ProjectTree extends AbstractTree else $treeElement->description .= ' - '.lang('GLOBAL_NO_DESCRIPTION_AVAILABLE'); - $treeElement->url = Html::url(array('action' =>'main', - 'callAction' =>$o->getType(), - 'objectid' =>$id )); + $treeElement->url = Html::url( 'main',$o->getType(),$o->objectid ); $treeElement->icon = $o->getType(); // Besonderheiten fuer bestimmte Objekttypen + if ( $o->isLink ) + { + $treeElement->type='link'; + } + if ( $o->isPage ) { // Nur wenn die Seite beschreibbar ist, werden die @@ -129,7 +163,7 @@ class ProjectTree extends AbstractTree if ( $o->isFile ) { - $file = new File( $id ); + $file = new File( $o->objectid ); $file->load(); if ( substr($file->mimeType(),0,6) == 'image/' ) @@ -160,7 +194,7 @@ class ProjectTree extends AbstractTree // Hoechster Ordner der Projektstruktur $f = new Folder(); $f->projectid = $this->projectid; - $folder = new Folder( $f->getRootObjectId() ); + $folder = new Folder( $project->getRootObjectId() ); unset( $f ); $folder->load(); @@ -176,9 +210,7 @@ class ProjectTree extends AbstractTree $treeElement->text = $folder->name; $treeElement->description = lang('FOLDER_ROOT_DESC'); $treeElement->icon = 'folder'; - $treeElement->url = Html::url(array('action' =>'main', - 'callAction' =>'folder', - 'objectid' =>$folder->objectid )); + $treeElement->url = Html::url( 'main','folder',$folder->objectid ); $treeElement->target = 'cms_main'; $treeElement->type = 'folder'; $treeElement->internalId = $folder->objectid; @@ -191,10 +223,7 @@ class ProjectTree extends AbstractTree // Templates $treeElement = new TreeElement(); $treeElement->text = lang('GLOBAL_TEMPLATES'); - $treeElement->url = Html::url(array('action' =>'main', - 'callAction' =>'template', - 'callSubaction'=>'listing', - 'templateid' =>'0' )); + $treeElement->url = Html::url('main','template'); $treeElement->description= lang('GLOBAL_TEMPLATES_DESC'); $treeElement->icon = 'tpl_list'; $treeElement->target = 'cms_main'; @@ -207,9 +236,7 @@ class ProjectTree extends AbstractTree $treeElement = new TreeElement(); $treeElement->description= ''; $treeElement->text = lang('GLOBAL_LANGUAGES'); - $treeElement->url = Html::url(array('action' =>'main', - 'callAction' =>'language', - 'callSubaction'=>'listing' )); + $treeElement->url = Html::url('main','language'); $treeElement->icon = 'lang_list'; $treeElement->description= lang('GLOBAL_LANGUAGES_DESC'); $treeElement->target = 'cms_main'; @@ -224,9 +251,7 @@ class ProjectTree extends AbstractTree $treeElement->description= lang('GLOBAL_MODELS_DESC'); $treeElement->text = lang('GLOBAL_MODELS'); - $treeElement->url = Html::url(array('action' =>'main', - 'callAction' =>'model', - 'callSubaction'=>'listing')); + $treeElement->url = Html::url('main','model'); $treeElement->icon = 'model_list'; $treeElement->target = 'cms_main'; $this->addTreeElement( $treeElement ); @@ -303,9 +328,7 @@ class ProjectTree extends AbstractTree $t = new Template( $id ); $t->load(); $treeElement->text = $t->name; - $treeElement->url = Html::url(array('action' =>'main', - 'callAction' =>'template', - 'templateid' =>$id )); + $treeElement->url = Html::url('main','template',$id); $treeElement->icon = 'tpl'; $treeElement->target = 'cms_main'; $treeElement->internalId = $id; @@ -335,11 +358,7 @@ class ProjectTree extends AbstractTree $treeElement = new TreeElement(); $treeElement->text = $e->name; - $treeElement->url = Html::url(array('action' =>'main', - 'callAction' =>'element', - 'callSubaction'=>'edit', - 'templateid' =>$id, - 'elementid' =>$elementid )); + $treeElement->url = Html::url('main','element',$elementid); $treeElement->icon = 'el_'.$e->type; if ( $e->desc == '' ) @@ -369,10 +388,7 @@ class ProjectTree extends AbstractTree $treeElement = new TreeElement(); $treeElement->text = $name; - $treeElement->url = Html::url(array('action' =>'main', - 'callAction' =>'language', - 'callSubaction' =>$subAction, - 'languageid' =>$languageid )); + $treeElement->url = Html::url('main','language',$languageid); $treeElement->icon = 'lang'; $treeElement->description = ''; $treeElement->target = 'cms_main'; @@ -397,10 +413,7 @@ class ProjectTree extends AbstractTree { $treeElement = new TreeElement(); $treeElement->text = $name; - $treeElement->url = Html::url(array('action' =>'main', - 'callAction' =>'model', - 'callSubaction'=>$subAction, - 'modelid' =>$id )); + $treeElement->url = Html::url('main','model',$id); $treeElement->icon = 'model'; $treeElement->description = ''; $treeElement->target = 'cms_main'; @@ -416,8 +429,7 @@ class ProjectTree extends AbstractTree $treeElement = new TreeElement(); $treeElement->text = lang('GLOBAL_FILE_TRANSFER'); $treeElement->description = lang('GLOBAL_FILE_TRANSFER_DESC'); - $treeElement->url = Html::url(array('action' =>'main', - 'callAction' =>'transfer')); + $treeElement->url = Html::url('main','transfer'); $treeElement->icon = 'transfer'; $treeElement->target = 'cms_main'; $this->addTreeElement( $treeElement ); @@ -425,8 +437,7 @@ class ProjectTree extends AbstractTree $treeElement = new TreeElement(); $treeElement->text = lang('GLOBAL_SEARCH'); - $treeElement->url = Html::url(array('action' =>'main', - 'callAction' =>'search' )); + $treeElement->url = Html::url('main','search'); $treeElement->icon = 'search'; $treeElement->description = lang('GLOBAL_SEARCH_DESC'); $treeElement->target = 'cms_main';