Code

Added Conferences
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 16 Aug 2005 11:25:10 +0000 (11:25 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 16 Aug 2005 11:25:10 +0000 (11:25 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1151 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/gofon/conference/class_phoneConferenceGeneric.inc
plugins/gofon/conference/class_phoneConferenceManagment.inc
plugins/gofon/conference/generic.tpl
plugins/gofon/conference/tabs_conference.inc

index 2d44350b4db414d95c2dac34cb4a46f30242fafa..b2880643e558d2c7e4269efa301bd7e8912578d5 100644 (file)
 class conference extends plugin
 {
   /* department attributes */
-  var $cn= "";
-  var $description= "";
-  var $base ="";
-
-
-  var $goFonPIN                                   = "";
-
-  var $goFonConferenceOption_D = "";
-  var $goFonConferenceOption_r = "";
-  var $goFonConferenceOption_M = "";
-  var $goFonConferenceOption_s = "";
-  var $goFonConferenceOption_i = "";
-  var $goFonConferenceOption_c = "";
-  var $goFonConferenceOption_P = "";
+  var $cn                                                = "";
+  var $description             = "";
+  var $base                              = "";
+  var $ou                                              = "";
+  var $goFonPIN                                = "";
+
+  var $goFonConferenceOption           = "";
+  var $goFonConferenceOption_D         = "";   // Set PIN 
+  var $goFonConferenceOption_r         = "";   // record Conference
+  var $goFonConferenceOption_M         = "";   // Play Music opn hold
+  var $goFonConferenceOption_s         = "";   // activate menu
+  var $goFonConferenceOption_i         = "";   // announce new and leaving user
+  var $goFonConferenceOption_c         = "";   // Count User
+  var $goFonConferenceOption_P         = "";   // Conference Type, no PIN/PIN
 
   var $goFonConferenceOptionFormat             = "";
   var $goFonConferenceOptionLifetime   = "";
   var $goFonConferenceOptionNumber             = "";
-       
+
+  var $old_tele_number         = false;
+  var $generate_error           = "";
+
   /* Headpage attributes */
   var $last_dep_sorting= "invalid";
   var $departments= array();
@@ -49,67 +52,69 @@ class conference extends plugin
                                                 "goFonConferenceOption_M","goFonConferenceOption_s","goFonConferenceOption_i","goFonConferenceOption_c",
                                                 "goFonConferenceOption_P","goFonConferenceOptionFormat","goFonConferenceOptionLifetime","goFonConferenceOptionNumber");
 
-  var $objectclasses= array("top", "gosaDepartment", "organizationalUnit");
+  var $objectclasses= array("top", "goFonConference");
 
   function conference ($config, $dn)
   {
-       plugin::plugin($config, $dn);
-       $this->is_account= TRUE;
-       $this->ui= get_userinfo();
-       $this->dn= $dn;
-       $this->orig_dn= $dn;
-       $this->config= $config;
-
-       /* Set base */
+    plugin::plugin($config, $dn);
+    $this->is_account  = TRUE;
+    $this->ui                  = get_userinfo();
+    $this->dn                  = $dn;
+    $this->orig_dn             = $dn;
+    $this->config              = $config;
+
+    /* Set base */
     if ($this->dn == "new"){
-               $ui= get_userinfo();
-               if(isset($_SESSION['depfilter']['depselect'])){
-                       $this->base = $_SESSION['depfilter']['depselect'];
-               }else{
-                       $this->base= dn2base($ui->dn);
-               }
-       } else {
-                $this->base= preg_replace ("/^[^,]+,/", "", $this->dn);
-        }
+      $ui= get_userinfo();
+      if(isset($_SESSION['conferencefilter']['depselect'])){
+        $this->base = $_SESSION['conferencefilter']['depselect'];
+      }else{
+        $this->base= dn2base($ui->dn);
+      }
+    } else {
+      $this->base= preg_replace ("/^[^,]+,/", "", $this->dn);
+    }
+
+
+    /* Parse Options ... 
+     * Parameter|Lifetime|number
+     */
+    if($this->dn!="new"){
+      $tmp1= split("\|",$this->attrs['goFonConferenceOption'][0]);
+
+      for($i = 0 ; $i < strlen($tmp1[0]);$i++){
+        $varname = "goFonConferenceOption_".$tmp1[0][$i];
+        $this->$varname = $tmp1[0][$i];    
+      }
+
+      $this->goFonConferenceOptionLifetime  = $tmp1[1];
+      $this->goFonConferenceOptionNumber    = $tmp1[2];
+      $this->old_tele_number                = $tmp1[2];
+    }
   }
 
   function execute()
   {
-       /* Reload departments */
-       $this->config->departments= get_departments($this->dn);
+       $this->config->departments    = get_departments($this->dn);
        $this->config->make_idepartments();
        $smarty= get_smarty();
 
-       $smarty->assign("goFonConferenceOptions",               array("P"=>"Conference ",""=>"Conference without PIN"));
-       $smarty->assign("goFonConferenceOptionFormats", array("P"=>"Conference ",""=>"Conference without PIN"));
-       $smarty->assign("goFonConferenceOption" ,$this->goFonConferenceOption_P);
+       $smarty->assign("goFonConferenceOptions",                   array("P"=>"Conference ",""=>"Conference without PIN"));
+       $smarty->assign("goFonConferenceOptionFormats", array("wav"=>"Wave","gsm"=>"GSM","wav49"=>"Wave49"));
+       $smarty->assign("goFonConferenceOption",        $this->goFonConferenceOption_P);
        
        foreach ($this->attributes as $val){
                $smarty->assign("$val", $this->$val);
                $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
-               if($this->$val){
+               if(!$this->$val){
                        $smarty->assign($val."CHK", "");
                }else{
                        $smarty->assign($val."CHK", " checked ");
                }
        }
-       $smarty->assign("bases", $this->config->idepartments);
-       $smarty->assign("base_select", $this->base);
        return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
   }
 
-  function clear_fields()
-  {
-       $this->dn= "";
-       $this->base= "";
-       $this->acl= "#none#";
-
-       foreach ($this->attributes as $val){
-               $this->$val= "";
-       }
-  }
-
-
   function remove_from_parent()
   {
        $ldap= $this->config->get_ldap_link();
@@ -124,14 +129,17 @@ class conference extends plugin
   /* Save data to object */
   function save_object()
   {
-       if (isset($_POST['base'])){
-               plugin::save_object();
-
-               /* Save base, since this is no LDAP attribute */
-               if (chkacl($this->acl, "create") == ""){
-                       $this->base= $_POST['base'];
-               }
-       }
+    plugin::save_object();
+    if(isset($_POST['cn'])){
+      foreach(array("goFonConferenceOption_D","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
+            "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_P") as $attrs){
+      if(isset($_POST[$attrs])){
+        $this->$attrs = $_POST[$attrs];
+      }else{
+        $this->$attrs = false;
+        }
+      }
+    }
   }
 
 
@@ -139,48 +147,161 @@ class conference extends plugin
   function check()
   {
        $message= array();
+  
+  if(empty($this->cn)){
+    $message[] =_("Please enter a name for the conference.");
+  }
+  
+  if(!is_numeric($this->goFonConferenceOptionNumber)){
+    $message[] =_("Only numeric chars are allowed in Number field.");
+  }
 
-       /* Permissions for that base? */
-       $this->dn= "ou=$this->ou,".$this->base;
-       $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
-       $acl= get_module_permission($acl, "department", $this->dn);
-       if (chkacl($acl, "create") != ""){
-               $message[]= _("You have no permissions to create a department on this 'Base'.");
-       }
+  if(!is_numeric($this->goFonConferenceOptionLifetime)){
+    $message[] =_("Only numbers are allowed in Lifetime.");
+  }
+  $this->SQL_remove_me(false);
+  $this->SQL_add_me(false);
+  if(!empty($this->generate_error)){
+    $message[]=$this->generate_error;
+    $this->generate_error="";
+  }
 
-       /* Check for presence of this department */
-       $ldap= $this->config->get_ldap_link();
-       $attrs= $ldap->cat ($this->dn);
-       if ($this->orig_dn == "new" && !($attrs === FALSE)){
-               $message[]= _("Department with that 'Name' already exists.");
-       } elseif ($this->orig_dn != $this->dn && !($attrs === FALSE)){
-               $message[]= _("Department with that 'Name' already exists.");
-       }
+       return $message;
+  }
 
-       /* All required fields are set? */
-       if ($this->ou == ""){
-               $message[]= _("Required field 'Name' is not set.");
-       }
-       if ($this->description == ""){
-               $message[]= _("Required field 'Description' is not set.");
-       }
 
-       /* Validate and modify - or: spaghetti rules! */
-       if ($this->ou == "incoming"){
-               $message[]= _("The field 'Name' contains the reserved word 'incoming'.".
-                               " Please choose another name.");
-       }
-       if (preg_match ('/[,#+:=>\\\\]/', $this->ou)){
-               $message[]= _("The field 'Name' contains invalid characters.");
-       }
-       if (!is_phone_nr($this->telephoneNumber)){
-               $message[]= _("The field 'Phone' contains an invalid phone number.");
-       }
-       if (!is_phone_nr($this->facsimileTelephoneNumber)){
-               $message[]= _("The field 'Fax' contains an invalid phone number.");
-       }
+  function SQL_add_me($save){
+    // Get Configuration for Mysql database Server
+    $a_SETUP = $_SESSION['config']->data['SERVERS']['FON'];
+
+    // Connect to DB server
+    $r_con =  @mysql_connect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']);
+
+    // Check if we are  connected correctly
+    if(!$r_con){
+      $this->generate_error = sprintf(_("The MySQL Server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
+          $a_SETUP['SERVER'],$a_SETUP['LOGIN']);
+      gosa_log(mysql_error());
+      return false;
+    }
+
+    // Select database for Extensions
+    $db  =  @mysql_select_db($a_SETUP['DB'],$r_con);
+
+    // Test if we have the database selected correctly
+    if(!$db){
+      $this->generate_error = sprintf(_("Can't select database %s on %s."),$a_SETUP['DB'],$a_SETUP['SERVER']);
+      gosa_log(mysql_error());
+      return false;
+    }
+   
+    if((!empty($this->goFonConferenceOptionNumber))&&($save==true)){
+      
+      $EXT=array();
+
+      $parameter  ="";
+      foreach(array("goFonConferenceOption_D","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
+            "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_P") as $attrs){
+        $parameter .= $this->$attrs;
+      }
+
+      $i=1;
+      $context="GOsa";
+      // Set Language to German
+      $EXT[$i]['exten']   =$this->goFonConferenceOptionNumber;
+      $EXT[$i]['context'] = $context;
+      $EXT[$i]['priority']= $i;
+      $EXT[$i]['app']     ="SetLanguage";
+      $EXT[$i]['appdata'] ="de";
+      $i++;      
+
+      if($this->goFonConferenceOption_r == "r"){
+
+      // Recordingformat for conference
+      $EXT[$i]['exten']   =$this->goFonConferenceOptionNumber;
+      $EXT[$i]['context'] =$context;
+      $EXT[$i]['priority']= $i;
+      $EXT[$i]['app']     ="Setvar";
+      $EXT[$i]['appdata'] ="MEETME_RECORDINGFORMAT=".$this->goFonConferenceOptionFormat;
+      $i++;      
+
+      }
+
+      // Answer Call
+      $EXT[$i]['exten']   =$this->goFonConferenceOptionNumber;
+      $EXT[$i]['context'] =$context;
+      $EXT[$i]['priority']=$i;
+      $EXT[$i]['app']     ="answer";
+      $EXT[$i]['appdata'] ="";
+      $i++;      
+
+      // Start Conference 
+      $EXT[$i]['exten']   =$this->goFonConferenceOptionNumber;
+      $EXT[$i]['context'] =$context;
+      $EXT[$i]['priority']=$i;
+      $EXT[$i]['app']     ="MeetMe";
+      $EXT[$i]['appdata'] =$this->goFonConferenceOptionNumber."|".$parameter."|".$this->goFonPIN;
+      
+      $SQL=array();
+    
+      foreach($EXT as $keytop => $valtop){
+      $s_keys = "";
+      $s_values = ""; 
+        foreach($valtop as $key=>$val){
+          $s_keys   .="`".$key."`,";
+          $s_values .="'".$val."',";
+        }
+        $s_keys   =preg_replace("/\,$/","",$s_keys); 
+        $s_values =preg_replace("/\,$/","",$s_values); 
+        $SQL[]="INSERT INTO ".$a_SETUP['EXT_TABLE']." (".$s_keys.") VALUES (".$s_values.");"; 
+      }
+      foreach($SQL as $sqlsyn){
+        mysql_query($sqlsyn);
+      }
+    } 
+    
+
+
+    return(true);
+  }
 
-       return $message;
+  function SQL_remove_me($save){
+
+    if($this->old_tele_number){
+      // Get Configuration for Mysql database Server
+      $a_SETUP = $_SESSION['config']->data['SERVERS']['FON'];
+
+      // Connect to DB server
+      $r_con =  @mysql_connect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']);
+
+      // Check if we are  connected correctly
+      if(!$r_con){
+        $this->generate_error = sprintf(_("The MySQL Server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
+            $a_SETUP['SERVER'],$a_SETUP['LOGIN']);
+        gosa_log(mysql_error());
+        return false;
+      }
+
+      // Select database for Extensions
+      $db  =  @mysql_select_db($a_SETUP['DB'],$r_con);
+
+      // Test if we have the database selected correctly
+      if(!$db){
+        $this->generate_error = sprintf(_("Can't select database %s on %s."),$a_SETUP['DB'],$a_SETUP['SERVER']);
+        gosa_log(mysql_error());
+        return false;
+      }
+
+      $SQL = "DELETE FROM ".$a_SETUP['EXT_TABLE']." WHERE (exten= '".$this->old_tele_number."') OR (exten='".$this->goFonConferenceOptionNumber."')";
+      
+      if($save){
+        @mysql_query($SQL);
+      } 
+
+    }//ENDE  old num availiable ...
+    return(true);
   }
 
 
@@ -189,7 +310,24 @@ class conference extends plugin
   {
        plugin::save();
 
-       /* Write back to ldap */
+  $this->SQL_remove_me(true);
+  $this->SQL_add_me(true);
+
+  $this->attrs['goFonConferenceOption']="";
+  foreach(array("goFonConferenceOption_D","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
+            "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_P","goFonConferenceOptionFormat") as $attrs){
+    $this->attrs['goFonConferenceOption'] .= $this->$attrs;
+    unset($this->attrs[$attrs]);         
+  }
+
+  $this->attrs['goFonConferenceOption'].="|".$this->goFonConferenceOptionLifetime;
+  unset($this->attrs['goFonConferenceOptionLifetime']);
+
+  $this->attrs['goFonConferenceOption'].="|".$this->goFonConferenceOptionNumber;
+  unset($this->attrs['goFonConferenceOptionNumber']);
+       
+
+  /* Write back to ldap */
        $ldap= $this->config->get_ldap_link();
        $ldap->cat($this->dn);
        $a= $ldap->fetch();
@@ -209,4 +347,5 @@ class conference extends plugin
 
 }
 
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index f2e0bb69ee3a1ed2f5a7eea2733d4e6a1d6cf9a3..239e76605c6376556af0cc56b989ac742c8b7ada 100644 (file)
@@ -22,7 +22,7 @@ require "tabs_conference.inc";
 class phoneConferenceManagment extends plugin
 {
        /* Definitions */
-       var $plHeadline                           = "Phone Conference Rooms";
+       var $plHeadline                           = "Phone conference";
        var $plDescription                      = "Managment ";
 
        /* CLI vars */
@@ -38,12 +38,25 @@ class phoneConferenceManagment extends plugin
        var $objectclasses                      = array();
   var $conftab            = false;
 
+  var $departments  =array();
+
        /* Initialise Class */
        function phoneConferenceManagment ($config, $ui)
        {
                $this->ui                       = $ui;
                $this->dn                       = "";
                $this->config           = $config;
+  
+    /* Get global filter config */
+    if (!isset($_SESSION["conferencefilter"])){
+      $base= get_base_from_people($ui->dn);
+      $conferencefilter= array(
+          "depselect"       => $base,
+          "regex"           => "*");
+      $_SESSION["conferencefilter"] = $conferencefilter;
+    }
+
+  
        }
 
        /* Execute class and display something */
@@ -55,19 +68,173 @@ class phoneConferenceManagment extends plugin
                $display                                        = "";
                $s_action                                       = "";  // Will contain an action, like del or edit
                $s_entry                                        = "";  // The entry name for edit delete -...
+    $conferencefilter   = $_SESSION["conferencefilter"]; 
+    
+    /* Start for New List Managment */
+    if(isset($_GET['act'])&&($_GET['act']=="dep_open")){
+      $s_action="open";
+      $s_entry = base64_decode($_GET['dep_id']);
+      $conferencefilter['depselect']= "".$this->config->departments[trim($s_entry)];
+    }
 
-    foreach($_POST as $post => $key){
-      if(preg_match("/.*new.*/i",$post)){
+    foreach($_POST as $key => $post){
+      if(preg_match("/.*new.*/i",$key)){
         $s_action = "new";
+      // Post for delete
+      }elseif(preg_match("/conf_del.*/",$key)){
+        $s_action = "del";
+        $s_entry  = preg_replace("/conf_".$s_action."_/i","",$key);
+        $s_entry  = preg_replace("/_.*$/","",$s_entry);
+        // Post for edit
+      }elseif(preg_match("/conf_edit_.*/",$key)){
+        $s_action="edit";
+        $s_entry  = preg_replace("/conf_".$s_action."_/i","",$key);
+        $s_entry  = preg_replace("/_.*$/","",$s_entry);
+      }elseif(preg_match("/dep_back.*/i",$key)){
+        $s_action="back";
+      }elseif(preg_match("/dep_home.*/i",$key)){
+        $s_action="home";
+      }elseif(preg_match("/dep_root.*/i",$key)){
+        $s_action="root";
+      } 
+    }
+
+    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+      $s_action = "edit";
+      $s_entry  = $_GET['id'];
+    }
+
+    /* Department changed? */
+    if(isset($_POST['depselect']) && $_POST['depselect']){
+      $conferencefilter['depselect']= $_POST['depselect'];
+    }
+    /* Homebutton is posted */
+    if($s_action=="home"){
+      $conferencefilter['depselect']=(preg_replace("/^[^,]+,/","",$this->ui->dn));
+      $conferencefilter['depselect']=(preg_replace("/^[^,]+,/","",$conferencefilter['depselect']));
+    }
+
+    if($s_action=="root"){
+      $conferencefilter['depselect']=($this->config->current['BASE']);
+    }
+
+    /* If Backbutton is Posted */
+    if($s_action=="back"){
+      $base_back          = preg_replace("/^[^,]+,/","",$conferencefilter['depselect']);
+      $base_back          = convert_department_dn($base_back);
+
+      if(isset($this->config->departments[trim($base_back)])){
+        $conferencefilter['depselect']= $this->config->departments[trim($base_back)];
+      }else{
+        $conferencefilter['depselect']= $this->config->departments["/"];
       }
     }
-      
+
+    register_global("conferencefilter",$conferencefilter);
+    $this->reload();
+
+    /* Reset requested? */
+    if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
+      if (isset($this->conftab)){
+        del_lock ($this->conftab->dn);
+        unset ($this->conftab);
+      }
+      $this->conftab= NULL;
+      $this->lognames= array();;
+      $this->cn= "";
+      unset ($_SESSION['objectinfo']);
+    }
+
+    /* Delete Entry if Posted action (s_action) == del
+     * The entry which will be deleted is defined in $s_entry
+     */
+    if ($s_action =="del"){
+      $this->dn= $this->conferences[$s_entry]['dn'];
+
+      /* Check locking */
+      if (($conf= get_lock($this->dn)) != ""){
+        $_SESSION['dn']= $this->dn;
+        return(gen_locked_message($conf, $this->dn));
+      } else {
+        add_lock ($this->dn, $this->ui->dn);
+        $smarty->assign("info", sprintf(_("You're about to delete the whole LDAP subtree placed under '%s'."), $this->dn));
+        $display.= $smarty->fetch (get_template_path('remove.tpl', TRUE));
+        return ($display);
+      }
+    }
+
+    /* If department deletion is accepted ...
+     * Finally delete department
+     */
+    if (isset($_POST['delete_department_confirm'])){
+      $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
+      $acl= get_module_permission($acl, "goFonConference", $this->dn);
+      if (chkacl($acl, "all") == ""){
+        $this->remove_from_parent();
+        gosa_log ("Department object'".$this->dn."' has been removed");
+        $this->reload ();
+      } else {
+        print_red (_("You have no permission to remove this department."));
+      }
+    }
+
+    /* Edit Entry if Posted action (s_action) == edit
+     * The entry which will be edited is defined in $s_entry
+     */
+    if ($s_action=="edit"){
+
+      $this->dn= $this->conferences[$s_entry]['dn'];
+
+      if (($conf= get_lock($this->dn)) != ""){
+        return(gen_locked_message ($conf, $this->dn));
+      }
+
+      /* Lock the current entry, so everyone will get the  above dialog */
+      add_lock ($this->dn, $this->ui->dn);
+
+      /* Set up the users ACL's for this 'dn' */
+      $this->acl= get_permissions ($this->dn, $this->ui->subtreeACL);
+
+      /* Register conftab to trigger edit dialog */
+      $this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn);
+      $this->conftab->set_acl(array(":all"));
+      $_SESSION['objectinfo']= $this->dn;
+    }
+
     if($s_action == "new"){
       $this->dn= "new";
       $this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn);
       $this->conftab->set_acl(array(':all'));
     }
-    
+
+    if (isset($_POST['edit_finish'])){
+
+      /* Check tabs, will feed message array */
+      $this->conftab->last= $this->conftab->current;
+      $this->conftab->save_object();
+      $message= $this->conftab->check();
+
+      if (count($message) == 0){
+        if($this->conftab->save() == 1){
+          gosa_log ("goFonConference object '".$this->dn."' saving failed.");
+          return;
+        }
+        gosa_log ("goFonConference object '".$this->dn."' has been saved");
+
+        if ($this->dn != "new"){
+          del_lock ($this->dn);
+        }
+
+        $this->conftab->save ();
+        unset ($this->conftab);
+        $this->conftab= NULL;
+        unset ($_SESSION['objectinfo']);
+      } else {
+        show_errors($message);
+      }
+    }
     /* if edit or new, show dialog */
                if($this->conftab){
       $display= $this->conftab->execute();
@@ -88,8 +255,32 @@ class phoneConferenceManagment extends plugin
                   <input type='image' align='middle' src='images/list_new_department.png' 
                       align='middle' alt='"._("Create new department")."' name='dep_new'>&nbsp;
                                  </div>";
-    $actions = "<input type='image' src='images/edit.png'               alt='"._("edit")."'      name='dep_edit_%KEY%' title='"._("Edit this entry")."'>";
-               $actions.= "<input type='image' src='images/edittrash.png' alt='"._("delete")."'        name='dep_del_%KEY%'  title='"._("Delete this entry")."'>";
+
+
+
+       $options= "";
+    foreach ($this->config->idepartments as $key => $value){
+      if ($conferencefilter['depselect'] == $key){
+        $options.= "<option selected value='$key'>$value</option>";
+      } else {
+        $options.= "<option value='$key'>$value</option>";
+      }
+    }
+
+        $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
+      " <input type='image' align='middle' src='images/list_back.png' title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'>&nbsp;".
+      " <input type='image' src='images/list_root.png' align='middle' title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;".
+      " <input type='image' align='middle' src='images/list_home.png' title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'>&nbsp;".
+      " <img src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
+      " <input type='image' align='middle' src='images/list_new_user.png' title='"._("Create new user")."' alt='"._("New user")."' name='user_new'>&nbsp;".
+      " <img src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
+      _("Current base")."&nbsp;<select name='depselect' onChange='mainform.submit()'>$options</select>".
+      " <input type='image' src='images/list_submit.png' align='middle' title='"._("Submit department")."' name='submit_department' alt='"._("Submit").     "'>&nbsp;".
+      "</div>";
+
+
+    $actions = "<input type='image' src='images/edit.png'               alt='"._("edit")."'      name='conf_edit_%KEY%' title='"._("Edit this entry")."'>";
+               $actions.= "<input type='image' src='images/edittrash.png' alt='"._("delete")."'        name='conf_del_%KEY%'  title='"._("Delete this entry")."'>";
                $linkopen= "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
 
     /* Set Header */
@@ -101,10 +292,36 @@ class phoneConferenceManagment extends plugin
                                        array("string" =>_("Name / nummer")),
                                        array("string" =>_("Actions"), "attach" => "style='text-align:  right;border:none'")));
 
-    foreach($this->conferences as $conference ){
-      $field1 = array("string"=>"");
-      $field2 = array("string"=>$conference['cn'][0]);
-      $field3 = array("string"=>"");
+       /* Insert departments in divlist*/
+    foreach($this->departments as $key=> $val){
+
+      if(!isset($this->config->departments[trim($key)])){
+        $this->config->departments[trim($key)]="";
+      }
+
+      $non_empty="";
+      $keys= str_replace("/","\/",$key);
+      foreach($this->config->departments as $keyd=>$vald ){
+        if(preg_match("/".$keys."\/.*/",$keyd)){
+          $non_empty="full";
+        }
+      }
+
+      $field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='department'>","attach"=>"style='width:22px;'");
+      $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val));
+      $field3 = array("string" => "&nbsp;", "attach" => "style='border:none;width:60px;'");
+
+
+      $divlist->AddEntry(array($field1,$field2,$field3));
+    }
+    
+    $userimg  = "<img src='images/select_user.png' alt='User' title='%s'>";
+    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
+
+    foreach($this->conferences as $conferencekey => $conference ){
+      $field1 = array("string"=>sprintf($userimg,_("Conference")));
+      $field2 = array("string"=>sprintf($editlink,$conferencekey,$conference['cn'][0]));
+      $field3 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$actions));
       $divlist->AddEntry(array($field1,$field2,$field3));
     }
 
@@ -127,7 +344,40 @@ class phoneConferenceManagment extends plugin
        function reload()
        {
     $base = "dc=gonicus,dc=de";
-               $this->conferences= get_list($this->ui->subtreeACL, "(objectClass=goFonAccount)",TRUE, $base, array("*"), TRUE);
+   
+    $conferencefilter = $_SESSION["conferencefilter"];
+    $base             = $conferencefilter['depselect'];
+    $regex            = $conferencefilter['regex'];
+     
+               $this->conferences= get_list($this->ui->subtreeACL, "(objectClass=goFonConference)",TRUE, $base, array("*"), TRUE);
+    
+    /* NEW LIST MANAGMENT
+     * We also need to search for the departments
+     * So we are able to navigate like in konquerer
+     */
+    $base2 = preg_replace("/ou=people,/i","",$base);
+
+    $res3 =  get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
+        TRUE, $base2, array("ou", "description"), TRUE);
+
+    $this->departments= array();
+
+    $tmp = array();
+    foreach ($res3 as $value){
+      $tmp[strtolower($value['dn']).$value['dn']]=$value;
+    }
+    ksort($tmp);
+    foreach($tmp as $value){
+      if($value["description"][0]!=".."){
+        $this->departments[$value['dn']]=convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+      }else{
+        $this->departments[$value['dn']]=$value["description"][0];
+      }
+    }
+    /* END NEW LIST MANAGMENT
+     */
+
+
          
   }
 
index 3c7e55a2dd4e608eaef5bf6932072d27a8b2fb30..9f8cc03b77103faa33da389a9c4d7c564c763765 100644 (file)
        <td colspan="2"><br></td>
        </tr>
        <tr>
-       <td><LABEL for="goFonConferenceOption">{t}Base{/t}</LABEL>{$must}</td>
+       <td><LABEL for="goFonConferenceOption_P">{t}Base{/t}</LABEL>{$must}</td>
        <td>
-       <select id="goFonConferenceOption" size="1" name="goFonConferenceOption" title="{t}Choose subtree to place department in{/t}"> 
-       {html_options options=$goFonConferenceOptions selected=$goFonConferenceOption}
+       <select id="goFonConferenceOption_P" size="1" name="goFonConferenceOption_P" title="{t}Choose subtree to place department in{/t}"> 
+       {html_options options=$goFonConferenceOptions selected=$goFonConferenceOption_P}
        </select>
        </td>
        </tr>
@@ -79,7 +79,7 @@
        <table summary="">
     <tr>
        <td colspan=2>
-               <input type="checkbox" name="goFonConferenceOption_D" value="PD" {$goFonConferenceOption_DCHK} {$goFonConferenceOption_DACL}> 
+               <input type="checkbox" name="goFonConferenceOption_D" value="D" {$goFonConferenceOption_DCHK} {$goFonConferenceOption_DACL}> 
                {t}PIN vorgeben{/t}
        </td>
        </tr>
index a3497db2917aafd4f17b22408deb70bb7e04bf49..ce623065dccbb806944afcf13803551da58d6d7f 100644 (file)
@@ -6,8 +6,8 @@ class conferencetabs extends tabs
 
   function conferencetabs($config, $data, $dn)
   {
-       tabs::tabs($config, $data, $dn);
-       $this->base= $this->by_object['conference']->base;
+         tabs::tabs($config, $data, $dn);
+         $this->base= $this->by_object['conference']->base; 
   }
 
   function check()
@@ -19,7 +19,7 @@ class conferencetabs extends tabs
   function save()
   {
        $baseobject= $this->by_object['conference'];
-       $new_dn= 'ou='.$baseobject->ou.','.$baseobject->base;
+       $new_dn= 'cn='.$baseobject->cn.','.$baseobject->base;
 
        if ($this->dn != $new_dn && $this->dn != "new"){
                $baseobject->recursive_move($this->dn, $new_dn);