Code

Removed kiosk management from user
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 9 Oct 2007 11:01:58 +0000 (11:01 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 9 Oct 2007 11:01:58 +0000 (11:01 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7468 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/environment/class_environment.inc
plugins/personal/environment/class_kioskManagementDialog.inc [deleted file]
plugins/personal/environment/kioskManagement.tpl [deleted file]

index 13e4b32580ee50f39fe53165015ae11e145ea6c2..aafbd288d3993965c2ac0700094a420919fefbd4 100644 (file)
@@ -112,31 +112,44 @@ class environment extends plugin
       $this->gotoPrinter[$printer['cn'][0]]['mode']="admin";
     }
 
-    /* prepare hotplugs */
-    if((isset($this->attrs['gotoHotplugDevice']))&&(is_array($this->attrs['gotoHotplugDevice']))){
-      unset($this->attrs['gotoHotplugDevice']['count']);
-      foreach($this->attrs['gotoHotplugDevice'] as $device){
-        $tmp = $tmp2 = array();
-        $tmp = split("\|",$device);
-        $tmp2['name']        = $tmp[0]; 
-        $tmp2['description'] = $tmp[1]; 
-        $tmp2['id']          = $tmp[2]; 
-
-        /* Produkt ID */
-        if(!isset($tmp[3])){
-          $tmp[3] = "";
-        }
-        /* Vendor ID */
-        if(!isset($tmp[4])){
-          $tmp[4] = "";
-        }
 
-        $tmp2['produkt']     = $tmp[3]; 
-        $tmp2['vendor']      = $tmp[4];
-
-        $this->gotoHotplugDevices[$tmp[0]]=$tmp2;
+    /* Prepare hotplugs */
+    if(isset($this->attrs['gotoHotplugDeviceDN']) && is_array($this->attrs['gotoHotplugDeviceDN'])){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      for($i = 0 ; $i < $this->attrs['gotoHotplugDeviceDN']['count'] ; $i ++){
+        $ldap->cat(base64_decode($this->attrs['gotoHotplugDeviceDN'][$i]));
+        $attrs = $ldap->fetch(); 
+        $this->gotoHotplugDevices[$attrs['cn'][0]] = array('name' => $attrs['cn'][0], 'id' => rand(1,10));
       }
     }
+  
+
+#   /* prepare hotplugs */
+#   if((isset($this->attrs['gotoHotplugDevice']))&&(is_array($this->attrs['gotoHotplugDevice']))){
+#     unset($this->attrs['gotoHotplugDevice']['count']);
+#     foreach($this->attrs['gotoHotplugDevice'] as $device){
+#       $tmp = $tmp2 = array();
+#       $tmp = split("\|",$device);
+#       $tmp2['name']        = $tmp[0]; 
+#       $tmp2['description'] = $tmp[1]; 
+#       $tmp2['id']          = $tmp[2]; 
+#
+#       /* Produkt ID */
+#       if(!isset($tmp[3])){
+#         $tmp[3] = "";
+#       }
+#       /* Vendor ID */
+#       if(!isset($tmp[4])){
+#         $tmp[4] = "";
+#       }
+#
+#       $tmp2['produkt']     = $tmp[3]; 
+#       $tmp2['vendor']      = $tmp[4];
+#
+#       $this->gotoHotplugDevices[$tmp[0]]=$tmp2;
+#     }
+#   }
 
     /* prepare LogonScripts */
     if((isset($this->attrs['gotoLogonScript']))&&(is_array($this->attrs['gotoLogonScript']))){
diff --git a/plugins/personal/environment/class_kioskManagementDialog.inc b/plugins/personal/environment/class_kioskManagementDialog.inc
deleted file mode 100644 (file)
index b448300..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-<?php
-
-class kioskManagementDialog extends plugin
-{
-  /* CLI vars */
-  var $cli_summary          = "Manage server basic objects";
-  var $cli_description      = "Some longer text\nfor help";
-  var $cli_parameters       = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account       = TRUE;
-  var $attributes           = array("filesToAttach");
-  var $objectclasses        = array("whatever");
-  var $use_existing         = false;  
-  var $filesToAttach        = array();
-
-  var $baseDir              = "../kiosk/";
-
-  function kioskManagementDialog (&$config, $dn= NULL,$attach=false )
-  {
-    $this->config= $config;
-    $this->dn= $dn;
-
-    if($attach){
-      $this->filesToAttach = $attach;
-    }
-    $this->baseDir = $this->config->search('environment', 'kioskpath',array('menu','tabs'));
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    /* Add new kiosk profile 
-     * in profile directory ($this->baseDir); 
-     */
-    if((isset($_POST['profileAdd']))&&(isset($_FILES['newProfile']))){
-      $file = $_FILES['newProfile'];
-      if(!file_exists($this->baseDir.$file['name'])){
-        $this->filesToAttach[$file['name']]=$file;
-        $this->filesToAttach[$file['name']]['contents'] = file_get_contents($file['tmp_name']);
-      }
-    }
-
-    $only_once = true;
-    foreach($_POST as $name => $value){
-
-      if((preg_match("/^delkiosk_/",$name))&&($only_once)){
-        $only_once = false;
-        $id  = preg_replace("/^delkiosk_/","",$name);
-        $id = preg_replace("/_.*$/","",$id);
-
-        $name = preg_replace("/^.*\//i","",base64_decode($id));
-
-        $filename = $this->baseDir."/".$name;
-   
-        /* check if profile is still in use */ 
-        $ldap = $this->config->get_ldap_link();
-        $ldap->cd($this->config->current['BASE']);
-        $ldap->search("(gotoKioskProfile=*lhs.schema*)",array("cn","uid","gotoKioskProfile"));
-        $used_by = "";
-        $cnt = 3;
-        while(($attrs = $ldap->fetch()) && ($cnt)){
-          $cnt --;
-          $check = preg_replace("/^.*\//i","",$attrs['gotoKioskProfile'][0]);
-          if($check == $name){
-            $used_by .= $attrs['cn'][0].", ";
-          }
-        }
-        $used_by = preg_replace("/, $/","",$used_by);
-
-        if(!empty($used_by)){
-          print_red(sprintf(_("Can't remove kioks profile, it is still in use by the following objects '%s'."),$used_by));
-        }elseif(isset($this->filesToAttach[$name])){
-          unset($this->filesToAttach[$name]);
-        }else{
-
-          $res = @unlink($filename);
-          if(!$res){
-            if(!is_writeable($filename)){
-              print_red(sprintf(_("Can't delete '%s'. Error was: permission denied."), $filename));
-            }
-            if(!file_exists($filename)){
-              print_red(sprintf(_("Can't delete '%s'. Error was: file doesn't exist."), $filename));
-            }
-          }
-        }
-      }
-    }
-     
-    /* Delete profile
-     * Delete selected file form $this->baseDir
-     */
-    if((isset($_POST['profileDel']))&&(isset($_POST['gotoKioskProfile']))){
-      $filename = $this->baseDir."/".preg_replace("/^.*\//i","",$_POST['gotoKioskProfile']);
-  
-      $res = @unlink($filename);
-      if(!$res){
-        if(!is_writeable($filename)){
-          print_red(sprintf(_("Can't delete '%s'. Error was: permission denied."), $filename));
-        }
-        if(!file_exists($filename)){
-          print_red(sprintf(_("Can't delete '%s'. Error was: file doesn't exist."), $filename));
-        }
-      
-      }
-    }
-
-    $divlist = new divSelectBox("KioskProfiles");
-    $divlist -> SetHeight (300);
-
-    $tmp = $this->getKioskProfiles();
-
-    foreach($tmp as $val ){
-      $divlist->AddEntry(array(
-                          array("string"=>"<a target='_blank' href='getkiosk.php?id=".$val."'>".$val."</a>"),
-                          array("string"=>"<input type='image' src='images/edittrash.png' class='center' alt='delete' name='delkiosk_".base64_encode($val)."'>" , 
-                                "attach"=>" style='border-right: 0px;width:24px; text-align:center;' ")
-                              )); 
-    }
-      
-
-    /*Assign all existing profiles to smarty*/
-
-
-    $smarty->assign("divlist",$divlist->DrawList());
-
-    $smarty->assign("gotoKioskProfiles",$this->getKioskProfiles());
-    $smarty->assign("gotoKioskProfileKeys",array_flip($this->getKioskProfiles()));
-
-    $display.= $smarty->fetch(get_template_path('kioskManagement.tpl', TRUE,dirname(__FILE__)));
-    return($display);
-  }
-
-  function save(){
-    return($this->filesToAttach);
-  }
-
-  function getKioskProfiles($attach = false)
-  {
-    $a_return = array();
-    
-    /* Empty? */
-    if ($this->baseDir == ""){
-      print_red(_("There is no KIOSKPATH defined in your gosa.conf. Can't manage kiosk profiles!"));
-      return ($a_return);
-    }
-    
-    $dir = @opendir($this->baseDir);
-    if(!$dir){
-      print_red(sprintf(_("Kiosk path '%s' is not accessible. Please check the permissions."),$this->baseDir));
-    }else{
-      $a_return = array();
-      while($file = readdir($dir)){
-        if(!preg_match("/^\./", $file)){
-          $name = $file;
-          $a_return[$name] = $name;
-        }
-      }
-    }
-
-    foreach($this->filesToAttach as $file){
-      $a_return[$file['name']] = $file['name'];
-    }
-
-    if($attach){
-      foreach($attach as $file){
-        $a_return[$file['name']] = $file['name'];
-      }
-    }
-
-    return($a_return);
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/environment/kioskManagement.tpl b/plugins/personal/environment/kioskManagement.tpl
deleted file mode 100644 (file)
index 88391b8..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<h2><img alt="" class="center" src="images/house.png" align="middle">&nbsp;<LABEL for="gotoKioskProfile">{t}Kiosk profile management{/t}</LABEL></h2>
-
-    <input type="hidden" name="dialogissubmitted" value="1">
-
-       <table summary="{t}Kiosk profile management{/t}" width="100%">
-               <tr>
-                       <td>
-                               {$divlist}
-<!--                   <select style="width:100%;" size=18 name="gotoKioskProfile" {$gotoKioskProfileACL} id="gotoKioskProfile">
-                {html_options values=$gotoKioskProfileKeys output=$gotoKioskProfiles}
-                <option disabled>&nbsp;</option>
-                </select>-->
-               <input type="file" size=50 name="newProfile" value="{t}Browse{/t}">                     
-               <input type="submit" name="profileAdd" value="{t}Add{/t}">
-               <!--      <input type="submit" name="profileDel" value="{t}Remove{/t}">-->
-                       </td>
-                       <td>
-                       </td>
-               </tr>
-       </table>
-
-    <p class="seperator">&nbsp;</p>
-
-    <p align="right">
-    <input type="submit" name="KioskClose"     value="{t}Close{/t}">
-    </p>
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('gotoKioskProfile');
-  -->
-</script>