Code

Fixed o
[gosa.git] / plugins / personal / environment / class_environment.inc
index b995f15f64eaf3b05cc7c655a9553bea67c7cbee..c42b2ad25eafb075c7c754b6b20ab8f66cd4d0ef 100644 (file)
@@ -83,6 +83,8 @@ class environment extends plugin
       $suffix="User";
     }
 
+    $this->gotoKioskProfile= preg_replace("/^.*\//i","",$this->gotoKioskProfile);
+
     /* Get all Printer assignments */
     $ldap = $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);
@@ -143,6 +145,11 @@ class environment extends plugin
         $tmp2['server']      =$tmp[0];
         $tmp2['name']        =$tmp[1];
         $tmp2['mountPoint']  =$tmp[2];
+        if(isset($tmp[3])){
+          $tmp2['OtherStuff']  =$tmp[3];
+        }else{
+          $tmp2['OtherStuff']  ="";
+        }
         $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
       }
     }
@@ -172,14 +179,39 @@ class environment extends plugin
 
   function execute()
   {
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-    /* Is accout enabled | are we editing from usermenu or admin menu 
-       All these tab management is done here
-    */
+       /* Call parent execute */
+       plugin::execute();
+
+  /* Fill templating stuff */
+  $smarty= get_smarty();
+  $display= "";
+
+  /* Prepare all variables for smarty */
+  foreach($this->attributes as $s_attr){
+    /* Set value*/
+    $smarty->assign($s_attr,$this->$s_attr);
+
+    /* Set checkbox state*/
+    if(empty($this->$s_attr)){
+      $smarty->assign($s_attr."CHK","");
+    }else{
+      $smarty->assign($s_attr."CHK"," checked ");
+    }
 
-    /* Working from Usermenu an the Account is currently disbled
+    /* Prepare ACL settings*/
+    if(chkacl($this->acl,$s_attr)=="") {
+      $smarty->assign($s_attr."ACL","");
+    }else{
+      $smarty->assign($s_attr."ACL"," disabled ");
+    }
+
+  }
+
+  /* Is accout enabled | are we editing from usermenu or admin menu 
+     All these tab management is done here
+   */
+
+  /* Working from Usermenu an the Account is currently disbled
      * this->parent :  is only set if we are working in a list of tabs
      * is_account   :  is only true if the needed objectClass is given
     */
@@ -299,10 +331,12 @@ class environment extends plugin
       }
     }
  
+    $smarty->assign("useProfileACL","");
     if($this->acl != "#none#"){
       $smarty->assign("useProfileACL","");
     }else{
       $smarty->assign("gotoProfileFlag_CACL"," disabled ");
+      $smarty->assign("useProfileACL","disabled");
       $smarty->assign("gotoProfileServer"," disabled ");
     }
 
@@ -347,13 +381,6 @@ class environment extends plugin
      * Open management if post is transmitted
      */
 
-    /* Open Management Dialog */
-    if(isset($_POST['KioskManagementDialog'])){
-      $this->dialog = new kioskManagementDialog($this->config,$this->dn,$this->newKioskProfiles); 
-      $this->dialog->parent= $this;
-      $this->is_dialog = true;
-    }
-
     /* Save */
     if(isset($_POST['KioskClose'])){
       $this->newKioskProfiles = array_merge($this->newKioskProfiles,$this->dialog->save());
@@ -365,6 +392,16 @@ class environment extends plugin
     $tmp = new kioskManagementDialog($this->config,$this->dn);
     $list = $tmp->getKioskProfiles($this->newKioskProfiles);
 
+    /* Reassign help class */
+    $_SESSION['current_class_for_help'] = get_class($this);
+    /* Open Management Dialog */
+    if(isset($_POST['KioskManagementDialog'])){
+      $this->dialog = new kioskManagementDialog($this->config,$this->dn,$this->newKioskProfiles); 
+      $this->dialog->parent= $this;
+      $this->is_dialog = true;
+    }
+
     $smarty->assign("gotoKioskProfiles",$list);
     $smarty->assign("gotoKioskProfileKeys",array_flip($list));
 
@@ -447,11 +484,14 @@ class environment extends plugin
       /* We assign a share to this user, if we don't know where to mount the share */
       if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
         print_red(_("You must specify a valid mount point."));
+      }elseif($_POST['gotoShareMountPoint'][0] !="/" ){
+        print_red(_("You must specify a valid mount point.")); 
       }else{
         $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
         $s_mount = $_POST['gotoShareMountPoint'];
         /* Preparing the new assignment */ 
         $this->gotoShares[$a_share['name']]=$a_share;
+        $this->gotoShares[$a_share['name']]['OtherStuff']="";
         $this->gotoShares[$a_share['name']]['mountPoint']=$s_mount;
       }
     }  
@@ -889,16 +929,23 @@ class environment extends plugin
     /* Prepare Shares */
     $this->attrs['gotoShare']=array();
     foreach($this->gotoShares as $name => $share){
-      $this->attrs['gotoShare'][] =$share['server']."|".$share['name']."|".$share['mountPoint'];
+      $this->attrs['gotoShare'][] =$share['server']."|".$share['name']."|".$share['mountPoint']."|".$share['OtherStuff'];
     }
 
     if(!empty($this->gotoKioskProfile)){
-      $this->attrs['gotoKioskProfile']= $this->gotoKioskProfile;
+      if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){
+        $method="https://";
+      }else{
+        $method="http://";
+      }
+
+      $str = $method.str_replace("//","/",$_SERVER['SERVER_NAME']."/kiosk/");
+      $this->attrs['gotoKioskProfile']= $str.$this->gotoKioskProfile;
     }else{
       $this->attrs['gotoKioskProfile']= array();
     }
 
-    $saveThis = array("gotoKioskProfile","gotoProfileQuota","gotoXResolution","gotoProfileServer");
+    $saveThis = array("gotoProfileQuota","gotoXResolution","gotoProfileServer");
   
     foreach($saveThis as $tosave){
       if(!empty($this->$tosave)){
@@ -952,7 +999,7 @@ class environment extends plugin
     $a_return = array();
     if(is_array($this->gotoShares)){
       foreach($this->gotoShares as $share){
-        $a_return[$share['name']."|".$share['server']]= $share['name']." '".$share['mountPoint']."' [".$share['server']."] ";
+        $a_return[$share['name']."|".$share['server']]= $share['server']."://".$share['name']." on ".$share['mountPoint'];
       }
     }
     return($a_return);