Code

Updated ldif viewer
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 23 Nov 2010 09:56:46 +0000 (09:56 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 23 Nov 2010 09:56:46 +0000 (09:56 +0000)
-Added error reporting

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20339 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/ihtml/themes/default/ldifViewer.tpl
gosa-core/plugins/generic/references/class_ldifViewer.inc

index 6b46ce19ede73297f146a7a3aa7188fa9619e3e3..a0b9917e7a6b06a8ce62d209a77732998b5e3fd1 100644 (file)
@@ -1,8 +1,13 @@
 <h3>{t}Raw LDAP entry{/t}</h3>
 <hr>
+
+{if $success}
 <pre>
 {$ldif}
 </pre>
+{else}
+  <p>{msgPool type=ldapError err=$error}</p>
+{/if}
 <hr>
 <div class="plugin-actions">
     <button name='cancelLdifViewer'>{msgPool type='cancelButton'}</button>
index cbe34f9cd02732859405e2b8c9def6b4d487af21..846f33e91364f5f5f60261b00416efdf022fddff 100644 (file)
@@ -2,7 +2,9 @@
 
 class ldifViewer extends plugin
 {
-    private $ldif;    
+    private $ldif;
+        private $success= FALSE;
+        private $error= "";
 
     function __construct($config, $dn)
     {
@@ -14,11 +16,21 @@ class ldifViewer extends plugin
         $this->dn = $dn;
         $ldap = $this->config->get_ldap_link();
         $this->ldif=$ldap->generateLdif(LDAP::fix($this->dn),'(objectClass=*)','base');
+        if(!$ldap->success()){
+                msg_dialog::display(_("Error"),
+                                msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_READ),
+                        ERROR_DIALOG);
+
+        }
+        $this->success = $ldap->success();
+        $this->error = $ldap->get_error();
     }
 
     function execute()
     {
         $smarty = get_smarty();
+        $smarty->assign('success', $this->success);
+        $smarty->assign('error', $this->error);
         $smarty->assign('ldif', set_post($this->ldif));
         return($smarty->fetch(get_template_path('ldifViewer.tpl')));
     }