From cae10d80c23617948577dc441612cf5f083c4c18 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 3 Dec 2007 07:18:09 +0000 Subject: [PATCH] Closes #290 Added server path git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7969 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_goKioskService.inc | 35 ++++++++++++------- plugins/admin/systems/goKioskService.tpl | 3 +- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/plugins/admin/systems/class_goKioskService.inc b/plugins/admin/systems/class_goKioskService.inc index 83f2624fa..583a489ae 100644 --- a/plugins/admin/systems/class_goKioskService.inc +++ b/plugins/admin/systems/class_goKioskService.inc @@ -4,7 +4,7 @@ class goKioskService extends goService{ /* This plugin only writes its objectClass */ var $objectclasses = array("goEnvironmentServer"); - var $attributes = array("gotoKioskProfile"); + var $attributes = array("gotoKioskProfile","cn"); var $StatusFlag = ""; /* This class can't be assigned twice so it conflicts with itsself */ @@ -13,8 +13,10 @@ class goKioskService extends goService{ var $baseDir = "../kiosk"; var $filesToAttach = array(); var $cn = "unknown"; - var $gotoKioskProfiles = array(); - var $gotoKioskProfile = array(); + var $gotoKioskProfiles= array(); + var $gotoKioskProfile = array(); + + var $server_path = "http://%cn/kiosk"; function goKioskService(&$config,$dn) { @@ -31,8 +33,9 @@ class goKioskService extends goService{ if(isset($this->attrs['gotoKioskProfile']) && is_array($this->attrs['gotoKioskProfile'])){ for($i = 0 ; $i < $this->attrs['gotoKioskProfile']['count']; $i ++){ $url = $this->attrs['gotoKioskProfile'][$i]; - $name= preg_replace("/^.*\/kiosk\//","",$url); - + $this->server_path = preg_replace("/\/[^\/]*$/","",$url); + $this->server_path = preg_replace("/".normalizePreg($this->cn)."/","%cn",$this->server_path); + $name= preg_replace("/^.*\//","",$url); $this->gotoKioskProfiles[] = array('url' => $url , 'name' => $name , 'initial' =>TRUE, @@ -158,6 +161,7 @@ class goKioskService extends goService{ foreach($this->attributes as $attr){ $smarty->assign($attr,$this->$attr); } + $smarty->assign("server_path",$this->server_path); return($smarty->fetch(get_template_path("goKioskService.tpl",TRUE,dirname(__FILE__)))); } @@ -182,13 +186,8 @@ class goKioskService extends goService{ { goService::save(); - /* Create server url */ - if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){ - $method="https://".$this->cn."/kiosk/"; - }else{ - $method="http://".$this->cn."/kiosk/"; - } - + $method = preg_replace("/%cn/",$this->cn,$this->server_path."/"); + $method = preg_replace("/\/\/*$/","/",$method); $this->attrs['gotoKioskProfile'] = array(); foreach($this->gotoKioskProfiles as $profile){ if(!$profile['initial']){ @@ -214,6 +213,18 @@ class goKioskService extends goService{ show_ldap_error($ldap->get_error(),_("Wohl kaum")); } + + function save_object() + { + if(isset($_POST['goKioskPosted'])){ + goService::save_object(); + if(isset($_POST['server_path'])){ + $this->server_path = get_post("server_path"); + } + } + } + + /* Return plugin informations for acl handling */ static function plInfo() { diff --git a/plugins/admin/systems/goKioskService.tpl b/plugins/admin/systems/goKioskService.tpl index 18d076d4e..63ad5e645 100644 --- a/plugins/admin/systems/goKioskService.tpl +++ b/plugins/admin/systems/goKioskService.tpl @@ -2,6 +2,7 @@ +{t}Server path{/t} 
{$divlist} @@ -12,7 +13,7 @@   - +