Code

Fixed labeledURI / Uri problem
[gosa.git] / plugins / gofon / conference / class_phoneConferenceManagment.inc
index a9024f818aeda8e8aac853f669b3e897930b2883..57de90f6136a82f870359fd55c19744718a36c69 100644 (file)
@@ -47,6 +47,9 @@ class phoneConferenceManagment extends plugin
     $this->dn                  = "";
     $this->config              = $config;
 
+    $acl= get_permissions ($ui->dn, $ui->subtreeACL);
+    $this->acl= get_module_permission($acl, "conference", $ui->dn);
+
     /* Get global filter config */
     if (!isset($_SESSION["conferencefilter"])){
       $base= get_base_from_people($ui->dn);
@@ -60,6 +63,7 @@ class phoneConferenceManagment extends plugin
   /* Execute class and display something */
   function execute()
   {
+
        /* Call parent execute */
        plugin::execute();
 
@@ -185,9 +189,7 @@ class phoneConferenceManagment extends plugin
      * 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") == ""){
+      if (chkacl($this->acl, "delete") == ""){
         $this->remove_from_parent();
         gosa_log ("Department object'".$this->dn."' has been removed");
         $this->reload ();
@@ -210,12 +212,8 @@ class phoneConferenceManagment extends plugin
       /* 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($this->acl);
       $_SESSION['objectinfo']= $this->dn;
     }
 
@@ -223,13 +221,9 @@ class phoneConferenceManagment extends plugin
     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'));
-      $_SESSION['objectinfo']= $this->dn;
+      unset($_SESSION['objectinfo']);//
     }
 
     /* Edit finished, check and save changes */
@@ -269,9 +263,9 @@ class phoneConferenceManagment extends plugin
       /* Don't show buttons if tab dialog requests this */
       if (!$this->conftab->by_object[$this->conftab->current]->dialog){
         $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+        $display.= "<input type=\"submit\" name=\"edit_finish\" value=\""._("Finish")."\">\n";
         $display.= "&nbsp;\n";
-        $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
         $display.= "</p>";
       }
       return ($display);
@@ -281,28 +275,28 @@ class phoneConferenceManagment extends plugin
     $options= "";
     foreach ($this->config->idepartments as $key => $value){
       if ($conferencefilter['depselect'] == $key){
-        $options.= "<option selected value='$key'>$value</option>";
+        $options.= "<option selected='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 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;".
+      " <input class='center' type='image' align='middle' src='images/list_back.png' title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'>&nbsp;".
+      " <input class='center' type='image' src='images/list_root.png' align='middle' title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;".
+      " <input class='center' type='image' align='middle' src='images/list_home.png' title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'>&nbsp;".
+      " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
+      " <input class='center' type='image' align='middle' src='images/list_new_conference.png' title='"._("Create new conference")."' alt='"._("New conference")."' name='user_new'>&nbsp;".
+      " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
+      _("Base")."&nbsp;<select name='depselect' onChange='mainform.submit()' class='center'>$options</select>".
+      " <input class='center' type='image' src='images/list_submit.png' align='middle' title='"._("Submit department")."' name='submit_department' alt='"._("Submit").     "'>&nbsp;".
       "</div>";
 
     /* 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")."'>";
+    $actions = "<input class='center' type='image' src='images/edit.png'                alt='"._("edit")."'      name='conf_edit_%KEY%' title='"._("Edit this entry")."'>";
+    $actions.= "<input class='center' 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")."'>";
+    $actions2= "<input class='center' 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>";
 
@@ -311,11 +305,11 @@ class phoneConferenceManagment extends plugin
     $divlist->SetSummary(_("This table displays all available conference rooms."));
     $divlist->SetEntriesPerPage(0);
     $divlist->SetHeader(array(
-          array("string" => "&nbsp;"),            
-          array("string" =>_("Name - Number")),
-          array("string" => _("Owner")),
-          array("string" => _("PIN")),
-          array("string" =>_("Actions"), "attach" => "style='text-align:  right;border:none'")));
+          array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"),
+          array("string" =>_("Name - Number"), "attach" => "style=''"),
+          array("string" => _("Owner"), "attach" => "style='width:200px;'"),
+          array("string" => _("PIN"), "attach" => "style='width:50px;'"),
+          array("string" =>_("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'")));
 
     /* Insert departments in divlist*/
     foreach($this->departments as $key=> $val){
@@ -332,27 +326,27 @@ 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_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='text-align:  right;border:none'");
+      $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), "attach" => "style=''");
+      $a_field3 = array("string" => "&nbsp;", "attach" => "style='width:200px;'");
+      $a_field4 = array("string" => "&nbsp;", "attach" => "style='width:50px;'");
+      $a_field5 = array("string" => "&nbsp;",  "attach" => "style='width:60px;border-right:0px;text-align:right;'");
 
       /* 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 class='center' 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>";
 
     /* Insert conferneces*/
     foreach($this->conferences as $conferencekey => $conference ){
-  
-      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'>";
+
+      if((isset($conference['goFonPIN'][0]))&&(($this->ui->dn==$conference['goFonConferenceOwner'][0])||($this->acl=="#all#"))){
+        $pin = "<img class='center' src='images/list_password.png' title='PIN : ".$conference['goFonPIN'][0]."' alt='PIN'>";
       }else{
         $pin = "&nbsp;";
       }
@@ -368,25 +362,22 @@ class phoneConferenceManagment extends plugin
       $data = $ldap->fetch($ldap->cat($conference['goFonConferenceOwner'][0]));
       $cn = $data['cn'][0];
  
-      $a_field1 = array("string"=>sprintf($userimg,_("Conference")));
-
-      $acl= get_permissions ($conference['dn'], $this->ui->subtreeACL);
-      $this->acl =  get_module_permission($acl, "goFonConference", $conference['dn']);
+      $a_field1 = array("string"=>sprintf($userimg,_("Conference")), "attach" => "style='text-align:center;width:20px;'");
 
-      if(($this->ui->dn==$conference['goFonConferenceOwner'][0])&&(chkacl($this->acl,"goFonConferenceOwner")=="")){
-        $a_field2 = array("string"=>sprintf($editlink,$conferencekey,$conference['cn'][0].$number));
+      if(($this->acl=="#all#")||(($this->ui->dn==$conference['goFonConferenceOwner'][0])&&(chkacl($this->acl,"goFonConferenceOwner")==""))){
+        $a_field2 = array("string"=>sprintf($editlink,$conferencekey,$conference['cn'][0].$number), "attach" => "style=''");
       }else{  
-        $a_field2 = array("string"=>$conference['cn'][0].$number);
+        $a_field2 = array("string"=>$conference['cn'][0].$number, "attach" => "style=''");
       }
-      $a_field3 = array("string"=> $cn);
-      $a_field4 = array("string"=> $pin);
+      $a_field3 = array("string"=> $cn, "attach" => "style='width:200px;'");
+      $a_field4 = array("string"=> $pin, "attach" => "style='width:50px;'");
 
       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'");
+        $a_field5 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$actions), "attach" => "style='width:60px;border-right:0px;text-align:right;'");
       }elseif(chkacl($this->acl,"goFonConferenceOwner")==""){
-        $a_field5 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$actions2), "attach" => "style='text-align:  right;border:none'");
+        $a_field5 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$actions2), "attach" => "style='width:52px;border-right:0px;text-align:right;'");
       }else{
-        $a_field5 = array("string"=>"&nbsp;", "attach" => "style='text-align:  right;border:none'");
+        $a_field5 = array("string"=>"&nbsp;", "attach" => "style='width:52px;border-right:0px;text-align:right;'");
       }
 
       $divlist->AddEntry(array($a_field1,$a_field2,$a_field3,$a_field4,$a_field5));
@@ -430,10 +421,10 @@ class phoneConferenceManagment extends plugin
     }
     ksort($tmp);
     foreach($tmp as $value){
-      if($value["description"][0]!=".."){
+      if(isset($value["description"][0])){
         $this->departments[$value['dn']]=convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
       }else{
-        $this->departments[$value['dn']]=$value["description"][0];
+        $this->departments[$value['dn']]=convert_department_dn2($value['dn']);//$value["description"][0];
       }
     }
   }
@@ -441,6 +432,7 @@ 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);