openrat-cms

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

commit 5b67d1e8a034de335bd2b2217a358eccf6f54556
parent f496a3a946c327bd2831e244dbd1f4ad3c152f05
Author: dankert <devnull@localhost>
Date:   Wed,  4 Jul 2007 00:24:36 +0200

Start von Fremdanwendungen aus OpenRat heraus.

Diffstat:
actionClasses/IndexAction.class.php | 83+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
actionClasses/IndexAction.ini.php | 9+++++++--
config/applications.ini.php | 19+++++++++++++++++++
themes/default/pages/html/index/applications.tpl.php | 378+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
themes/default/templates/index/applications.tpl.src.php | 16++++++++++++++++
5 files changed, 503 insertions(+), 2 deletions(-)

diff --git a/actionClasses/IndexAction.class.php b/actionClasses/IndexAction.class.php @@ -332,6 +332,39 @@ class IndexAction extends Action } + + /** + * Erzeugt eine Anwendungsliste. + */ + function applications() + { + global $conf; + + // Diese Seite gilt pro Sitzung. + $user = Session::getUser(); + $this->lastModified( $user->loginDate ); + + // Projekte ermitteln + $list = array(); + foreach( $conf['applications'] as $id=>$app ) + { + if ( !is_array($app) ) + continue; + + + $p = array(); + $p['url'] = $app['url']; + $p['url'] .= strpos($p['url'],'?')!==false?'&':'?'; + $p['url'] .= $app['param'].'='.session_id(); + $p['name'] = $app['name']; + + $list[] = $p; + } + + $this->setTemplateVar('applications',$list); + } + + function login() { global $conf; @@ -404,6 +437,51 @@ class IndexAction extends Action + /** + * Ausgeben von maschinenlesbaren Benutzerinformationen. + * + * Diese Funktion dient dem Single-Signon für fremde Anwendungen, welche + * die Benutzerinformationen des angemeldeten Benutzers aus dieser + * Anwendung auslesen können. + */ + function userinfo() + { + $user = Session::getUser(); + $info = array('username' => $user->name, + 'fullname' => $user->fullname, + 'mail' => $user->mail, + 'telephone' => $user->tel, + 'style' => $user->style, + 'admin' => $user->isAdmin?'true':'false', + 'ldap' => $user->ldap_dn, + 'groups' => implode(',',$user->getGroups()), + 'description'=> $user->desc + ); + + // Wenn der HTTP-Parameter "xml" vorhanden ist, dann geben wir die + // Informationen per XML aus. + if ( $this->hasRequestVar('xml') ) + { + header('Content-Type: text/xml'); + echo '<userinfo>'; + foreach( $info as $n=>$i ) + echo '<'.$n.'>'.$i.'</'.$n.'>'."\n"; + echo '</userinfo>'; + + } + + // Sonst normale Textausgabe im INI-Datei-Format. + else + { + header('Content-Type: text/plain'); + foreach( $info as $n=>$i ) + echo $n.'="'.$i."\"\n"; + } + + exit; // Fertig. + } + + function project() { $user = Session::getUser(); @@ -649,6 +727,11 @@ class IndexAction extends Action switch( $name ) { + // Menüpunkt "Anwendungen" wird nur angezeigt, wenn weitere Anwendungen + // konfiguriert sind. + case 'applications': + return count($conf['applications']) > 0; + case 'register': return $conf['login']['register']; diff --git a/actionClasses/IndexAction.ini.php b/actionClasses/IndexAction.ini.php @@ -8,6 +8,11 @@ goto=showlogin [object] goto=show +[applications] +menu=menu + +[userinfo] + [project] goto=show @@ -59,4 +64,4 @@ goto=projectmenu [menu] login=showlogin,register,password -menu=projectmenu,administration,logout- \ No newline at end of file +menu=applications,projectmenu,administration,logout+ \ No newline at end of file diff --git a/config/applications.ini.php b/config/applications.ini.php @@ -0,0 +1,19 @@ +; <?php exit('direct access denied') ?> + + +; Start other applications out of OpenRat. +; +; Other applications are able to authenticate the user with an ticket id (Single Signon) + +; Insert a new section for every application here +;[phpmyadmin] + +; The Name of the application +;name=PHPYourAdmin + +; URL +;url="https://example.com/anotherapplication/index.cgi" + +; Name of the HTTP-Parameter for the Ticket-Id. +; OpenRat puts the session-id into this parameter. +;param="ticketidforopenrat" diff --git a/themes/default/pages/html/index/applications.tpl.php b/themes/default/pages/html/index/applications.tpl.php @@ -0,0 +1,377 @@ +<?php $attr1 = array('class'=>'main','title'=>$cms_title) ?><?php $attr1_class='main' ?><?php $attr1_title=$cms_title ?><?php header('Content-Type: text/html; charset='.lang('CHARSET')) +?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> + <title><?php echo $attr1_title ?></title> + <meta http-equiv="content-type" content="text/html; charset=<?php echo lang('CHARSET') ?>" /> + <meta name="MSSmartTagsPreventParsing" content="true" /> + <meta name="robots" content="noindex,nofollow" /> +<?php if (isset($windowMenu) && is_array($windowMenu)) foreach( $windowMenu as $menu ) + { + ?> + <link rel="section" href="<?php echo Html::url($actionName,@$menu['subaction'],$this->getRequestId() ) ?>" title="<?php echo lang($menu['text']) ?>" /> +<?php + } +?> +<?php if(!empty($root_stylesheet)) { ?> + <link rel="stylesheet" type="text/css" href="<?php echo $root_stylesheet ?>" /> +<?php } ?> +<?php if($root_stylesheet!=$user_stylesheet) { ?> + <link rel="stylesheet" type="text/css" href="<?php echo $user_stylesheet ?>" /> +<?php } ?> +</head> + +<body class="<?php echo $attr1_class ?>"> + +<?php unset($attr1) ?><?php unset($attr1_class) ?><?php unset($attr1_title) ?><?php $attr2 = array('icon'=>'project','width'=>'600','rowclasses'=>'odd,even','columnclasses'=>'1,2,3') ?><?php $attr2_icon='project' ?><?php $attr2_width='600' ?><?php $attr2_rowclasses='odd,even' ?><?php $attr2_columnclasses='1,2,3' ?><?php + $coloumn_widths=array(); + if (!empty($attr2_widths)) + { + $column_widths = explode(',',$attr2_widths); + unset($attr2['widths']); + } + if (!empty($attr2_rowclasses)) + { + $row_classes = explode(',',$attr2_rowclasses); + $row_class_idx = 999; + unset($attr2['rowclasses']); + } + if (!empty($attr2_columnclasses)) + { + $column_classes = explode(',',$attr2_columnclasses); + unset($attr2['columnclasses']); + } + global $image_dir; + echo '<br/><br/><br/><center>'; + echo '<table class="main" cellspacing="0" cellpadding="4" width="'.$attr2_width.'">'; + echo '<tr><td class="menu">'; + if ( !empty($attr2_icon) ) + echo '<img src="'.$image_dir.'icon_'.$attr2_icon.IMG_ICON_EXT.'" align="left" border="0">'; + if ( !isset($path) || is_array($path) ) + $path = array(); + foreach( $path as $pathElement) + { + extract($pathElement); + echo '<a href="'.$url.'" class="path">'.lang($name).'</a>'; + echo '&nbsp;&raquo;&nbsp;'; + } + echo '<span class="title">'.lang($windowTitle).'</span>'; + ?> + </td><!--<td class="menu" style="align:right;"> + <?php if (isset($windowIcons)) foreach( $windowIcons as $icon ) + { + ?><a href="<?php echo $icon['url'] ?>" title="<?php echo 'ICON_'.lang($menu['type'].'_DESC') ?>"><image border="0" src="<?php echo $image_dir.$icon['type'].IMG_ICON_EXT ?>"></a>&nbsp;<?php + } + ?> + </td>--> + </tr> + <tr><td class="subaction"> + + <?php if ( !isset($windowMenu) || !is_array($windowMenu) ) + $windowMenu = array(); + foreach( $windowMenu as $menu ) + { + $tmp_text = lang($menu['text']); + $tmp_key = strtoupper(lang($menu['key' ])); + $tmp_pos = strpos(strtolower($tmp_text),strtolower($tmp_key)); + if ( $tmp_pos !== false ) + $tmp_text = substr($tmp_text,0,max($tmp_pos,0)).'<span class="accesskey">'. substr($tmp_text,$tmp_pos,1).'</span>'.substr($tmp_text,$tmp_pos+1); + + if ( isset($menu['url']) ) + { + ?><a href="<?php echo Html::url($actionName,$menu['subaction'],$this->getRequestId() ) ?>" accesskey="<?php echo $tmp_key ?>" title="<?php echo lang($menu['text'].'_DESC') ?>" class="menu<?php echo $this->subActionName==$menu['subaction']?'_highlight':'' ?>"><?php echo $tmp_text ?></a>&nbsp;&nbsp;&nbsp;<?php + } + else + { + ?><span class="menu_disabled" title="<?php echo lang($menu['text'].'_DESC') ?>" class="menu_disabled"><?php echo $tmp_text ?></span>&nbsp;&nbsp;&nbsp;<?php + } + } + if ($conf['help']['enabled'] ) + { + ?><a href="<?php echo $conf['help']['url'].$actionName.'/'.$subActionName.$conf['help']['suffix'] ?> " target="_new" title="<?php echo lang('GLOBAL_HELP') ?>" class="menu">?</a><?php + } + ?></td> + </tr> + +<?php if (isset($notices) && count($notices)>0 ) + { ?> + + <tr> + <td><table> + + <?php foreach( $notices as $notice ) { ?> + + <tr> + <td><img src="<?php echo $image_dir.'notice_'.$notice['status'].IMG_ICON_EXT ?>" style="padding:10px" /></td> + <td class="f1"><?php if ($notice['name']!='') { ?><img src="<?php echo $image_dir.'icon_'.$notice['type'].IMG_ICON_EXT ?>" align="left" /><?php echo $notice['name'] ?>: <?php } ?><?php if ($notice['status']=='error') { ?><strong><?php } ?><?php echo $notice['text'] ?><?php if ($notice['status']=='error') { ?></strong><?php } ?></td> + </tr> + <?php } ?> + + </table></td> + </tr> + +<?php } ?> + + + + <tr> + <td> + <table class="n" cellspacing="0" width="100%" cellpadding="4"><?php unset($attr2) ?><?php unset($attr2_icon) ?><?php unset($attr2_width) ?><?php unset($attr2_rowclasses) ?><?php unset($attr2_columnclasses) ?><?php $attr3 = array('list'=>'applications','extract'=>true,'key'=>'list_key','value'=>'list_value') ?><?php $attr3_list='applications' ?><?php $attr3_extract=true ?><?php $attr3_key='list_key' ?><?php $attr3_value='list_value' ?><?php + $attr3_list_tmp_key = $attr3_key; + $attr3_list_tmp_value = $attr3_value; + $attr3_list_extract = $attr3_extract; + + if ( !isset($$attr3_list) || !is_array($$attr3_list) ) + $$attr3_list = array(); + + foreach( $$attr3_list as $$attr3_list_tmp_key => $$attr3_list_tmp_value ) + { + if ( $attr3_list_extract ) + { + if ( !is_array($$attr3_list_tmp_value) ) + { + print_r($$attr3_list_tmp_value); + die( 'not an array at key: '.$$attr3_list_tmp_key ); + } + extract($$attr3_list_tmp_value); + } +?><?php unset($attr3) ?><?php unset($attr3_list) ?><?php unset($attr3_extract) ?><?php unset($attr3_key) ?><?php unset($attr3_value) ?><?php $attr4 = array() ?><?php + $row_class_idx++; + if ($row_class_idx > count($row_classes)) + $row_class_idx=1; + $row_class=$row_classes[$row_class_idx-1]; + + if (empty($attr4_class)) + $attr4_class=$row_class; + + global $cell_column_nr; + $cell_column_nr=0; + + $column_class_idx = 999; + +?><tr class="<?php echo $attr4_class ?>"><?php unset($attr4) ?><?php $attr5 = array() ?><?php +// if (empty($attr5_class)) +// $attr5['class']=$row_class; + $column_class_idx++; + if ($column_class_idx > count($column_classes)) + $column_class_idx=1; + $column_class=$column_classes[$column_class_idx-1]; + if (empty($attr5_class)) + $attr5['class']=$column_class; + + global $cell_column_nr; + $cell_column_nr++; + if ( isset($column_widths[$cell_column_nr-1]) && !isset($attr5_rowspan) ) + $attr5['width']=$column_widths[$cell_column_nr-1]; + +?><td <?php foreach( $attr5 as $a_name=>$a_value ) echo " $a_name=\"$a_value\"" ?>><?php unset($attr5) ?><?php $attr6 = array('title'=>'','target'=>'_self','class'=>'','action'=>'index','subaction'=>'projectmenu') ?><?php $attr6_title='' ?><?php $attr6_target='_self' ?><?php $attr6_class='' ?><?php $attr6_action='index' ?><?php $attr6_subaction='projectmenu' ?><?php + $params = array(); + if (!empty($attr6_var1) && isset($attr6_value1)) + $params[$attr6_var1]=$attr6_value1; + if (!empty($attr6_var2) && isset($attr6_value2)) + $params[$attr6_var2]=$attr6_value2; + if (!empty($attr6_var3) && isset($attr6_value3)) + $params[$attr6_var3]=$attr6_value3; + if (!empty($attr6_var4) && isset($attr6_value4)) + $params[$attr6_var4]=$attr6_value4; + if (!empty($attr6_var5) && isset($attr6_value5)) + $params[$attr6_var5]=$attr6_value5; + + if(empty($attr6_class)) + $attr6_class=''; + if(empty($attr6_title)) + $attr6_title = ''; + if(!empty($attr6_url)) + $tmp_url = $attr6_url; + else + $tmp_url = Html::url($attr6_action,$attr6_subaction,!empty($attr6_id)?$attr6_id:$this->getRequestId(),$params); +?><a href="<?php echo $tmp_url ?>" class="<?php echo $attr6_class ?>" target="<?php echo $attr6_target ?>"<?php if (isset($attr6_accesskey)) echo ' accesskey="'.$attr6_accesskey.'"' ?> title="<?php echo $attr6_title ?>"><?php unset($attr6) ?><?php unset($attr6_title) ?><?php unset($attr6_target) ?><?php unset($attr6_class) ?><?php unset($attr6_action) ?><?php unset($attr6_subaction) ?><?php $attr7 = array('class'=>'text','text'=>'OpenRat','escape'=>true) ?><?php $attr7_class='text' ?><?php $attr7_text='OpenRat' ?><?php $attr7_escape=true ?><?php + if ( isset($attr7_prefix)&& isset($attr7_key)) + $attr7_key = $attr7_prefix.$attr7_key; + if ( isset($attr7_suffix)&& isset($attr7_key)) + $attr7_key = $attr7_key.$attr7_suffix; + + if(empty($attr7_title)) + if (!empty($attr7_key)) + $attr7_title = lang($attr7_key.'_HELP'); + else + $attr7_title = ''; + +?><span class="<?php echo $attr7_class ?>" title="<?php echo $attr7_title ?>"><?php + $attr7_title = ''; + + if (!empty($attr7_array)) + { + //geht nicht: + //echo $$attr7_array[$attr7_var].'%'; + $tmpArray = $$attr7_array; + if (!empty($attr7_var)) + $tmp_text = $tmpArray[$attr7_var]; + else + $tmp_text = lang($tmpArray[$attr7_text]); + } + elseif (!empty($attr7_text)) + if ( isset($$attr7_text)) + $tmp_text = lang($$attr7_text); + else + $tmp_text = lang($attr7_text); + elseif (!empty($attr7_textvar)) + $tmp_text = lang($$attr7_textvar); + elseif (!empty($attr7_key)) + $tmp_text = lang($attr7_key); + elseif (!empty($attr7_var)) + $tmp_text = isset($$attr7_var)?($attr7_escape?htmlentities($$attr7_var):$$attr7_var):'?'.$attr7_var.'?'; + elseif (!empty($attr7_raw)) + $tmp_text = str_replace('_','&nbsp;',$attr7_raw); + elseif (!empty($attr7_value)) + $tmp_text = $attr7_value; + else + { + $tmp_text = '&nbsp;'; + //Html::debug($attr7);echo 'text error'; + } + + if ( !empty($attr7_maxlength) && intval($attr7_maxlength)!=0 ) + $tmp_text = Text::maxLength( $tmp_text,intval($attr7_maxlength) ); + + if (isset($attr7_accesskey)) + { + $pos = strpos(strtolower($tmp_text),strtolower($attr7_accesskey)); + if ( $pos !== false ) + $tmp_text = substr($tmp_text,0,max($pos,0)).'<span class="accesskey">'.substr($tmp_text,$pos,1).'</span>'.substr($tmp_text,$pos+1); + } + + echo $tmp_text; +?></span><?php unset($attr7) ?><?php unset($attr7_class) ?><?php unset($attr7_text) ?><?php unset($attr7_escape) ?><?php $attr5 = array() ?></a><?php unset($attr5) ?><?php $attr4 = array() ?></td><?php unset($attr4) ?><?php $attr3 = array() ?></tr><?php unset($attr3) ?><?php $attr4 = array() ?><?php + $row_class_idx++; + if ($row_class_idx > count($row_classes)) + $row_class_idx=1; + $row_class=$row_classes[$row_class_idx-1]; + + if (empty($attr4_class)) + $attr4_class=$row_class; + + global $cell_column_nr; + $cell_column_nr=0; + + $column_class_idx = 999; + +?><tr class="<?php echo $attr4_class ?>"><?php unset($attr4) ?><?php $attr5 = array() ?><?php +// if (empty($attr5_class)) +// $attr5['class']=$row_class; + $column_class_idx++; + if ($column_class_idx > count($column_classes)) + $column_class_idx=1; + $column_class=$column_classes[$column_class_idx-1]; + if (empty($attr5_class)) + $attr5['class']=$column_class; + + global $cell_column_nr; + $cell_column_nr++; + if ( isset($column_widths[$cell_column_nr-1]) && !isset($attr5_rowspan) ) + $attr5['width']=$column_widths[$cell_column_nr-1]; + +?><td <?php foreach( $attr5 as $a_name=>$a_value ) echo " $a_name=\"$a_value\"" ?>><?php unset($attr5) ?><?php $attr6 = array('title'=>'','target'=>'_self','url'=>$url,'class'=>'') ?><?php $attr6_title='' ?><?php $attr6_target='_self' ?><?php $attr6_url=$url ?><?php $attr6_class='' ?><?php + $params = array(); + if (!empty($attr6_var1) && isset($attr6_value1)) + $params[$attr6_var1]=$attr6_value1; + if (!empty($attr6_var2) && isset($attr6_value2)) + $params[$attr6_var2]=$attr6_value2; + if (!empty($attr6_var3) && isset($attr6_value3)) + $params[$attr6_var3]=$attr6_value3; + if (!empty($attr6_var4) && isset($attr6_value4)) + $params[$attr6_var4]=$attr6_value4; + if (!empty($attr6_var5) && isset($attr6_value5)) + $params[$attr6_var5]=$attr6_value5; + + if(empty($attr6_class)) + $attr6_class=''; + if(empty($attr6_title)) + $attr6_title = ''; + if(!empty($attr6_url)) + $tmp_url = $attr6_url; + else + $tmp_url = Html::url($attr6_action,$attr6_subaction,!empty($attr6_id)?$attr6_id:$this->getRequestId(),$params); +?><a href="<?php echo $tmp_url ?>" class="<?php echo $attr6_class ?>" target="<?php echo $attr6_target ?>"<?php if (isset($attr6_accesskey)) echo ' accesskey="'.$attr6_accesskey.'"' ?> title="<?php echo $attr6_title ?>"><?php unset($attr6) ?><?php unset($attr6_title) ?><?php unset($attr6_target) ?><?php unset($attr6_url) ?><?php unset($attr6_class) ?><?php $attr7 = array('class'=>'text','text'=>$name,'escape'=>true) ?><?php $attr7_class='text' ?><?php $attr7_text=$name ?><?php $attr7_escape=true ?><?php + if ( isset($attr7_prefix)&& isset($attr7_key)) + $attr7_key = $attr7_prefix.$attr7_key; + if ( isset($attr7_suffix)&& isset($attr7_key)) + $attr7_key = $attr7_key.$attr7_suffix; + + if(empty($attr7_title)) + if (!empty($attr7_key)) + $attr7_title = lang($attr7_key.'_HELP'); + else + $attr7_title = ''; + +?><span class="<?php echo $attr7_class ?>" title="<?php echo $attr7_title ?>"><?php + $attr7_title = ''; + + if (!empty($attr7_array)) + { + //geht nicht: + //echo $$attr7_array[$attr7_var].'%'; + $tmpArray = $$attr7_array; + if (!empty($attr7_var)) + $tmp_text = $tmpArray[$attr7_var]; + else + $tmp_text = lang($tmpArray[$attr7_text]); + } + elseif (!empty($attr7_text)) + if ( isset($$attr7_text)) + $tmp_text = lang($$attr7_text); + else + $tmp_text = lang($attr7_text); + elseif (!empty($attr7_textvar)) + $tmp_text = lang($$attr7_textvar); + elseif (!empty($attr7_key)) + $tmp_text = lang($attr7_key); + elseif (!empty($attr7_var)) + $tmp_text = isset($$attr7_var)?($attr7_escape?htmlentities($$attr7_var):$$attr7_var):'?'.$attr7_var.'?'; + elseif (!empty($attr7_raw)) + $tmp_text = str_replace('_','&nbsp;',$attr7_raw); + elseif (!empty($attr7_value)) + $tmp_text = $attr7_value; + else + { + $tmp_text = '&nbsp;'; + //Html::debug($attr7);echo 'text error'; + } + + if ( !empty($attr7_maxlength) && intval($attr7_maxlength)!=0 ) + $tmp_text = Text::maxLength( $tmp_text,intval($attr7_maxlength) ); + + if (isset($attr7_accesskey)) + { + $pos = strpos(strtolower($tmp_text),strtolower($attr7_accesskey)); + if ( $pos !== false ) + $tmp_text = substr($tmp_text,0,max($pos,0)).'<span class="accesskey">'.substr($tmp_text,$pos,1).'</span>'.substr($tmp_text,$pos+1); + } + + echo $tmp_text; +?></span><?php unset($attr7) ?><?php unset($attr7_class) ?><?php unset($attr7_text) ?><?php unset($attr7_escape) ?><?php $attr5 = array() ?></a><?php unset($attr5) ?><?php $attr4 = array() ?></td><?php unset($attr4) ?><?php $attr3 = array() ?></tr><?php unset($attr3) ?><?php $attr2 = array() ?><?php } ?><?php unset($attr2) ?><?php $attr1 = array() ?> </table> + </td> + </tr> +</table> + +</center> + +<?php if ($showDuration) + { ?> +<br/> +<small>&nbsp; +<?php $dur = time()-START_TIME; + echo floor($dur/60).':'.str_pad($dur%60,2,'0',STR_PAD_LEFT); ?></small> +<?php } ?> +<?php unset($attr1) ?><?php $attr0 = array() ?> +<!-- $Id$ --> + +<?php if ($showDuration) { ?> +<br/> +<small>&nbsp; +<?php $dur = time()-START_TIME; +// echo floor($dur/60).':'.str_pad($dur%60,2,'0',STR_PAD_LEFT); ?></small> +<?php } ?> + +</body> +</html><?php unset($attr0) ?>+ \ No newline at end of file diff --git a/themes/default/templates/index/applications.tpl.src.php b/themes/default/templates/index/applications.tpl.src.php @@ -0,0 +1,15 @@ +page + window width:600 icon:project + + list list:applications extract:true + + row + cell + link action:index subaction:projectmenu + text text:OpenRat + row + cell + link url:var:url + text text:var:name + + + \ No newline at end of file