Code

Fixed new in information line
[gosa.git] / plugins / gofon / conference / class_phoneConferenceManagment.inc
index 720efc191632d0f3f09a665545ee2647b5482e27..8e61a5e130685218d7fc91e03e7c1e85ccbe7a35 100644 (file)
@@ -22,7 +22,7 @@ require "tabs_conference.inc";
 class phoneConferenceManagment extends plugin
 {
   /* Definitions */
-  var $plHeadline                                = "Phone conference";
+  var $plHeadline                                = "Phone conferences";
   var $plDescription                   = "Management";
 
   /* CLI vars */
@@ -60,6 +60,9 @@ class phoneConferenceManagment extends plugin
   /* Execute class and display something */
   function execute()
   {
+       /* Call parent execute */
+       plugin::execute();
+
     /* Reload departments */
     $this->config->departments = get_departments();
     $smarty                                                      = get_smarty();
@@ -212,15 +215,21 @@ class phoneConferenceManagment extends plugin
 
       /* 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"));
+      $this->conftab->set_acl($this->acl);
       $_SESSION['objectinfo']= $this->dn;
     }
 
     /* Insert new entry*/    
     if($s_action == "new"){
+      $this->dn= "new";
+      /* Set up the users ACL's for this 'dn' */
+      $this->acl= get_permissions ($this->dn, $this->ui->subtreeACL);
       $this->dn= "new";
       $this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn);
+      $this->acl= get_permissions ($this->conftab->dn, $this->ui->subtreeACL);
+      $this->conftab->set_acl($this->acl);
       $this->conftab->set_acl(array(':all'));
+      unset($_SESSION['objectinfo']);//
     }
 
     /* Edit finished, check and save changes */
@@ -242,12 +251,14 @@ class phoneConferenceManagment extends plugin
         }
 
         $this->conftab->save ();
+        del_lock ($this->conftab->dn);;
         unset ($this->conftab);
         $this->conftab= NULL;
         unset ($_SESSION['objectinfo']);
       } else {
         show_errors($message);
       }
+      
       $this->reload();
     }
 
@@ -281,7 +292,7 @@ class phoneConferenceManagment extends plugin
       " <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;".
+      " <input type='image' align='middle' src='images/list_new_conference.png' title='"._("Create new conference")."' alt='"._("New conference")."' 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;".
@@ -290,20 +301,21 @@ class phoneConferenceManagment extends plugin
     /* Images for delete / edit */
     $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")."'>";
-
+    
+    $actions2= "<input type='image' src='images/edittrash.png' alt='"._("delete")."'   name='conf_del_%KEY%'  title='"._("Delete this entry")."'>";
     /* open an entry */
     $linkopen= "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
 
     /* Set Header */
     $divlist  = new divlist("conferenceTabs");
     $divlist->SetSummary(_("This table displays all available conference rooms."));
-    $divlist->SetEntriesPerPage(20);
+    $divlist->SetEntriesPerPage(0);
     $divlist->SetHeader(array(
           array("string" => "&nbsp;"),            
-          array("string" =>_("Name / nummer")),
+          array("string" =>_("Name - Number")),
           array("string" => _("Owner")),
           array("string" => _("PIN")),
-          array("string" =>_("Actions"), "attach" => "style='text-align:  right;border:none'")));
+          array("string" =>_("Actions"), "attach" => "style='text-align:left;border:none'")));
 
     /* Insert departments in divlist*/
     foreach($this->departments as $key=> $val){
@@ -320,18 +332,18 @@ class phoneConferenceManagment extends plugin
       }
 
       /* Prepare and insert fields*/
-      $a_field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='department'>","attach"=>"style='width:22px;'");
+      $a_field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='department'>","attach"=>"style='text-align:center;width:20px;'");
       $a_field2 = array("string" => sprintf($linkopen,base64_encode($key),$val));
       $a_field3 = array("string" => "&nbsp;");
       $a_field4 = array("string" => "&nbsp;");
-      $a_field5 = array("string" => "&nbsp;", "attach" => "style='border:none;width:60px;'");
+      $a_field5 = array("string" => "&nbsp;",  "attach" => "style='text-align:right;border:none;width:48px;'");
 
       /* Add entries */
       $divlist->AddEntry(array($a_field1,$a_field2,$a_field3,$a_field4,$a_field5));
     }
 
     /* Image shown in divlist */
-    $userimg  = "<img src='images/select_user.png' alt='User' title='%s'>";
+    $userimg  = "<img src='images/select_conference.png' alt='User' title='%s'>";
 
     /* Edit entry link*/
     $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
@@ -339,8 +351,8 @@ class phoneConferenceManagment extends plugin
     /* Insert conferneces*/
     foreach($this->conferences as $conferencekey => $conference ){
   
-      if(isset($conference['goFonPIN'][0])){
-        $pin = $conference['goFonPIN'][0];
+      if((isset($conference['goFonPIN'][0]))&&($this->ui->dn==$conference['goFonConferenceOwner'][0])){
+        $pin = "<img src='images/list_password.png' title='PIN : ".$conference['goFonPIN'][0]."' alt='PIN'>";
       }else{
         $pin = "&nbsp;";
       }
@@ -356,11 +368,27 @@ class phoneConferenceManagment extends plugin
       $data = $ldap->fetch($ldap->cat($conference['goFonConferenceOwner'][0]));
       $cn = $data['cn'][0];
  
-      $a_field1 = array("string"=>sprintf($userimg,_("Conference")));
-      $a_field2 = array("string"=>sprintf($editlink,$conferencekey,$conference['cn'][0].$number));
+      $a_field1 = array("string"=>sprintf($userimg,_("Conference")),"attach"=>"style='text-align:center;width:20px;'");
+
+      $acl= get_permissions ($conference['dn'], $this->ui->subtreeACL);
+      $this->acl =  get_module_permission($acl, "goFonConference", $conference['dn']);
+
+      if(($this->ui->dn==$conference['goFonConferenceOwner'][0])&&(chkacl($this->acl,"goFonConferenceOwner")=="")){
+        $a_field2 = array("string"=>sprintf($editlink,$conferencekey,$conference['cn'][0].$number));
+      }else{  
+        $a_field2 = array("string"=>$conference['cn'][0].$number);
+      }
       $a_field3 = array("string"=> $cn);
       $a_field4 = array("string"=> $pin);
-      $a_field5 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$actions));
+
+      if(($this->ui->dn==$conference['goFonConferenceOwner'][0])&&(chkacl($this->acl,"goFonConferenceOwner")=="")){
+        $a_field5 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$actions), "attach" => "style='text-align:  right;border:none'");
+      }elseif(chkacl($this->acl,"goFonConferenceOwner")==""){
+        $a_field5 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$actions2), "attach" => "style='text-align:  right;border:none'");
+      }else{
+        $a_field5 = array("string"=>"&nbsp;", "attach" => "style='text-align:right;border:none;width:48px;'");
+      }
+
       $divlist->AddEntry(array($a_field1,$a_field2,$a_field3,$a_field4,$a_field5));
     }
 
@@ -412,6 +440,8 @@ class phoneConferenceManagment extends plugin
 
   function remove_from_parent()
   {
+    $cfg = new conference($this->config, $this->dn);
+    $cfg->remove_from_parent();
     $ldap= $this->config->get_ldap_link();
     $ldap->cd ($this->dn);
     $ldap->recursive_remove();