Code

Closes #290 Added server path
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 Dec 2007 07:18:09 +0000 (07:18 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 Dec 2007 07:18:09 +0000 (07:18 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7969 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_goKioskService.inc
plugins/admin/systems/goKioskService.tpl

index 83f2624fafdbd53b61ebd8c679a805bfddcd58e5..583a489ae36245b48ac663394f4f19aa9bde6c55 100644 (file)
@@ -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()
   {
index 18d076d4eec1fdaaa07d13e43af7074c05430bbd..63ad5e645723d4588713ab5ac178f7edee2ccd5c 100644 (file)
@@ -2,6 +2,7 @@
 
     <input type="hidden" name="dialogissubmitted" value="1">
 
+{t}Server path{/t}&nbsp;<input name="server_path" value="{$server_path}"><br>
 {$divlist}
 <input type="file" size=50 name="newProfile" value="{t}Browse{/t}">
 <input type="submit" name="profileAdd" value="{t}Add{/t}">
@@ -12,7 +13,7 @@
     &nbsp;
     <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
 </div>
-<input type="hidden" name="goCupsServerPosted" value="1">
+<input type="hidden" name="goKioskPosted" value="1">
 
 <script language="JavaScript" type="text/javascript">
   <!-- // First input field on page