openrat-cms

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

commit 79431aea80059f2d6839e8d9e42e02f6c88d97b9
parent 654c9d518c6328384402160ae6b37e1aabfec2f0
Author: dankert <devnull@localhost>
Date:   Mon,  5 Nov 2007 23:25:29 +0100

Sinnvolle Meta-Angaben in HTML-Kopf schreiben.

Diffstat:
actionClasses/IndexAction.class.php | 123+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------
themes/default/include/html/frameset-page.inc.php | 8++++++--
themes/default/include/html/page.inc.php | 8+++++++-
3 files changed, 121 insertions(+), 18 deletions(-)

diff --git a/actionClasses/IndexAction.class.php b/actionClasses/IndexAction.class.php @@ -311,24 +311,27 @@ class IndexAction extends Action // Projekte ermitteln $projects = $user->projects; - $list = array(); + $list = array(); + foreach( $projects as $id=>$name ) { $p = array(); $p['url' ] = Html::url('index','project',$id); - $p['name'] = $name; - $p['id' ] = $id; + $p['name'] = $name; + $p['id' ] = $id; $tmpProject = new Project( $id ); $p['defaultmodelid' ] = $tmpProject->getDefaultModelId(); $p['defaultlanguageid'] = $tmpProject->getDefaultLanguageId(); - $p['models' ] = $tmpProject->getModels(); - $p['languages'] = $tmpProject->getLanguages(); + $p['models' ] = $tmpProject->getModels(); + $p['languages' ] = $tmpProject->getLanguages(); $list[] = $p; } - $this->setTemplateVar('projects',$list); + $this->setTemplateVar('projects',$list ); + + $this->metaValues(); } @@ -344,7 +347,7 @@ class IndexAction extends Action $user = Session::getUser(); $this->lastModified( $user->loginDate ); - // Projekte ermitteln + // Applikationen ermitteln $list = array(); foreach( $conf['applications'] as $id=>$app ) { @@ -363,11 +366,102 @@ class IndexAction extends Action $list[] = $p; } - + + + $this->metaValues(); $this->setTemplateVar('applications',$list); } - + + + /** + * Ermittelt Meta-Angaben für den HTML-Kopf. + */ + function metaValues() + { + global $conf; + $metaList = array(); + + $user = Session::getUser(); + if ( is_object($user) ) + { + // Projekte ermitteln + $projects = $user->projects; + foreach( $projects as $id=>$name ) + { + $metaList[] = array('name' => 'chapter', + 'url' => Html::url('index','project',$id), + 'title'=> $name ); + } + + if ( $this->userIsAdmin() ) + { + $metaList[] = array('name' => 'appendix', + 'url' => Html::url('index','projectmenu',0 ), + 'title'=> lang('MENU_TREETITLE_ADMINISTRATION' ) ); + + $metaList[] = array('name' => 'chapter', + 'url' => Html::url('index','administration',0), + 'title'=> lang('administration') ); + } + + // Applikationen ermitteln + foreach( $conf['applications'] as $id=>$app ) + { + if ( !is_array($app) ) + continue; + $appUrl = $app['url']; + if ( isset($app['param']) ) + { + $appUrl .= strpos($appUrl,'?')!==false?'&':'?'; + $appUrl .= $app['param'].'='.session_id(); + } + + $metaList[] = array('name' => 'bookmark', + 'url' => $appUrl , + 'title'=> $app['name'] ); + } + } + + $project = Session::getProject(); + if ( is_object($project) && $project->projectid > 0 ) + { + $languages =$project->getLanguages(); + + foreach( $project->getModels() as $modelid=>$modelname ) + { + foreach( $languages as $languageid=>$languagename ) + { + + $metaList[] = array('name' => 'subsection', + 'url' => Html::url('index', + 'project', + $project->projectid, + array('languageid'=>$languageid, + 'modelid' =>$modelid) ), + 'title'=> $modelname.' - '.$languagename + ); + } + } + } + + $metaList[] = array('name' => 'author', + 'url' => $conf['login']['logo']['url'], + 'title'=> $conf['login']['logo']['url'] ); + + $metaList[] = array('name' => 'top', + 'url' => Html::url('index','logout',0 ), + 'title'=> 'Start' ); + + $metaList[] = array('name' => 'contents', + 'url' => Html::url('index','projectmenu',0 ), + 'title'=> lang('MENU_TREETITLE_PROJECTMENU' ) ); + + + $this->setTemplateVar('metaList',$metaList); + } + + /** * Open-Id Login, Überprüfen der Anmeldung.<br> @@ -540,10 +634,7 @@ class IndexAction extends Action */ function administration() { - if ( !$this->userIsAdmin() ) - die(':P'); - - Session::setProject( new Project(-1) ); + Session::setProject( new Project(-1) ); } @@ -793,7 +884,7 @@ class IndexAction extends Action $user->setCurrent(); else { - trigger_error("Guest login failed; User '$username' not found.",E_USER_NOTICE); + $this->addNotice('user',$username,'LOGIN_FAILED',OR_NOTICE_WARN,array('name'=>$username) ); $user = null; } } @@ -917,7 +1008,9 @@ class IndexAction extends Action $this->setTemplateVar( 'frame_src_border' ,Html::url( 'border' ) ); $this->setTemplateVar( 'frame_src_background',Html::url( 'background' ) ); - $this->setTemplateVar( 'tree_width',$conf['interface']['tree_width'] ); + $this->setTemplateVar( 'tree_width',$conf['interface']['tree_width'] ); + + $this->metaValues(); } diff --git a/themes/default/include/html/frameset-page.inc.php b/themes/default/include/html/frameset-page.inc.php @@ -4,8 +4,6 @@ <head> <title><?php echo @$title ?> - <?php echo $cms_title ?></title> <link rel="shortcut icon" href="<?php echo $image_dir.'favicon.ico' ?>" /> - <link rel="top" title="Start" href="./" /> - <link rel="author" title="Homepage" href="http://www.openrat.de" /> <?php if (isset($windowMenu) && is_array($windowMenu)) foreach( $windowMenu as $menu ) { @@ -13,5 +11,11 @@ <link rel="section" href="<?php echo Html::url($actionName,$menu['subaction'],$this->getRequestId() ) ?>" title="<?php echo lang($menu['text']) ?>" /><?php } ?> + <?php if (isset($metaList) && is_array($metaList)) foreach( $metaList as $meta ) + { + ?> + <link rel="<?php echo $meta['name'] ?>" href="<?php echo $meta['url'] ?>" title="<?php echo lang($meta['title']) ?>" /><?php + } +?> <meta name="robots" content="noindex,nofollow" /> </head> diff --git a/themes/default/include/html/page.inc.php b/themes/default/include/html/page.inc.php @@ -12,7 +12,13 @@ <link rel="section" href="<?php echo Html::url($actionName,@$menu['subaction'],$this->getRequestId() ) ?>" title="<?php echo lang($menu['text']) ?>" /> <?php } -?> +?><?php if (isset($metaList) && is_array($metaList)) foreach( $metaList as $meta ) + { + ?> + <link rel="<?php echo $meta['name'] ?>" href="<?php echo $meta['url'] ?>" title="<?php echo lang($meta['title']) ?>" /><?php + } +?> + <?php if(!empty($root_stylesheet)) { ?> <link rel="stylesheet" type="text/css" href="<?php echo $root_stylesheet ?>" /> <?php } ?>