Code

Moved folder image
[gosa.git] / gosa-plugins / addressbook / addons / addressbook / class_addressbook.inc
index 24bc317e124abc388830a30f009aca016b2dd112..27328958849315ab454522f11b4d9225881ff1dd 100644 (file)
@@ -175,7 +175,7 @@ class addressbook extends plugin
           return($smarty->fetch(get_template_path('dial.tpl', TRUE)));
           return;
         } else {
-         msg_dialog::display(_("Error"), _("You need to set your personal phone number in order to perform direct dials."), ERROR_DIALOG);
+         msg_dialog::display(_("Error"), _("You need to set your personal phone number in order to perform direct dials."), ERROR_DIALOG);
         }
       }
 
@@ -202,14 +202,16 @@ class addressbook extends plugin
         $ldap= $this->config->get_ldap_link();
         $ldap->rmdir ($this->dn);
         new log("remove","addressbook/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-        show_ldap_error($ldap->get_error(), sprintf(_("Removing of addressbook entry '%s' failed."),$this->dn));
-        new log("remove","addressbook/".get_class($this),$this->dn,array(),"Address book object'".$this->dn."' has been removed");
+        if (!$ldap->success()){
+          msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
+        }
+        new log("remove","addressbook/".get_class($this),$this->dn,array(),"Addressbook object'".$this->dn."' has been removed");
   
       } else {
 
         /* Normally this shouldn't be reached, send some extra
            logs to notify the administrator */
-       msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
+             msg_dialog::permDelete($this->dn);
         new log("remove","addressbook/".get_class($this),$this->dn,array(),"Warning: '".$this->ui->uid."' tried to trick address book deletion.");
       }
 
@@ -251,7 +253,7 @@ class addressbook extends plugin
         session::un_set('saved_start');
       } else {
         /* Errors found, show message */
-        show_errors ($message);
+        msg_dialog::displayChecks($message);
       }
     }
 
@@ -311,13 +313,13 @@ class addressbook extends plugin
           /* Lock the current entry, so nobody will edit it during deletion */
           $ui= get_userinfo();
           add_lock ($this->dn, $ui->dn);
-          $smarty->assign("info", sprintf(_("You're about to delete the entry %s."), $this->dn));
+          $smarty->assign("info", msgPool::deleteInfo($this->dn));
           return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
         } else {
 
           /* Obviously the user isn't allowed to delete. Show message and
              clean session. */
-         msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
+               msg_dialog::permDelete($this->dn);
         }
       }
       session::set('show_info',"ADD");
@@ -455,7 +457,7 @@ class addressbook extends plugin
             </a>
             &nbsp;</td>
             <td>
-            <a href=\"getvcard.php?dn=".base64_encode($attrs['dn'])."\">
+            <a href=\"plugins/addressbook/getvcard.php?dn=".base64_encode($attrs['dn'])."\">
             <img align=\"top\" border=0 src=\"images/save.png\" alt=\"vcf\" title=\"".sprintf(_("Save contact for %s as vcard"), $attrs['givenName'][0]." ".$attrs['sn'][0])."\">
             </a>";
 
@@ -633,9 +635,9 @@ class addressbook extends plugin
     $smarty->assign ('personal_image', get_template_path('images/addr_personal.png'));
     $smarty->assign ('home_image', get_template_path('images/addr_home.png'));
     $smarty->assign ('company_image', get_template_path('images/addr_company.png'));
-    $smarty->assign ('add_image', get_template_path('images/editpaste.png'));
-    $smarty->assign ('edit_image', get_template_path('images/edit.png'));
-    $smarty->assign ('delete_image', get_template_path('images/editdelete.png'));
+    $smarty->assign ('add_image', get_template_path('images/lists/paste.png'));
+    $smarty->assign ('edit_image', get_template_path('images/lists/edit.png'));
+    $smarty->assign ('delete_image', get_template_path('images/lists/delete.png'));
     return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
   }
 
@@ -705,7 +707,7 @@ class addressbook extends plugin
 
   /* Check mail */
   if (!tests::is_email($this->mail)){
-    $message[] = msgPool::invalid(_("Email"),"","","example@your-domain.com");
+    $message[] = msgPool::invalid(_("Email"),"","","your-domain@your-domain.com");
   }
 
   /* Assemble cn/dn */
@@ -763,7 +765,8 @@ class addressbook extends plugin
     $ldap->cd ($this->dn);
     $this->cleanup();
     $ldap->$mode ($this->attrs);
-    if (show_ldap_error($ldap->get_error(), sprintf(_("Removing of addressbook entry '%s' failed."),$this->dn))){
+    if (!$ldap->success()){
+      msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
       return (1);
     }