Code

Added error handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Oct 2010 06:13:14 +0000 (06:13 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Oct 2010 06:13:14 +0000 (06:13 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19928 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc
gosa-plugins/goto/admin/systems/goto/Config/failed.tpl [new file with mode: 0644]

index 8985cb935a44148f92a6ba7097f4fceae6af7c05..0455eac7cb028c571cc7ebf3ff07353fab50519b 100644 (file)
@@ -36,6 +36,7 @@ class DeviceConfig extends management
 
     private $rpcError = FALSE;
     private $initFailed = FALSE;
+    private $errorMessage = "";
 
     // Some plugin related memebers which are not member of 
     //  the management class. See class plugin.
@@ -86,13 +87,15 @@ class DeviceConfig extends management
 
         // Populate install methods on success.
         $res = $rpc->getSupportedInstallMethods();
-        if(!$rpc->success() ||  TRUE){
+        if(!$rpc->success()){
             $this->rpcError = TRUE;
+            $this->errorMessage = $rpc->get_error();;
             return;
         }       
         $this->allItemConfigurations = $res;
         if(!count($this->allItemConfigurations)){
-            msg_dialog::display(_("Setup"), _("No selectable install methods returned!", ERROR_DIALOG));
+            $this->errorMessage = _("No selectable install methods returned!");
+            msg_dialog::display(_("Setup"), $this->errorMessage , ERROR_DIALOG);
             $this->initFailed = TRUE;
             return;
         }
@@ -112,9 +115,9 @@ class DeviceConfig extends management
             }
         }
         if(!$root){
-            echo 'No root found!';
-            $this->rebuildListing();
-            $this->is_account = FALSE;
+            $this->errorMessage = _("No valid install methods returned, missing root object!");
+            msg_dialog::display(_("Setup"), $this->errorMessage , ERROR_DIALOG);
+            $this->initFailed = TRUE;
             return;
         }
 
@@ -320,14 +323,12 @@ class DeviceConfig extends management
      */
     function renderList()
     {
-
-        echo "<h3>Hier weiter machen, was passiert wenn init oder rpc fehlschlägt.</h3>";
-
         // In case of an error abort here.
         if($this->rpcError){
             $smarty = get_smarty();
             $smarty->assign('initFailed', $this->initFailed);
             $smarty->assign('rpcError', $this->rpcError);
+            $smarty->assign('error', $this->errorMessage);
             return($smarty->fetch(get_template_path('goto/Config/failed.tpl', TRUE)));
         }
 
@@ -521,6 +522,11 @@ class DeviceConfig extends management
      */
     function save_object()
     {
+        if(isset($_POST['retryInit'])){
+            $this->init();
+            return;
+        }
+            
         // Do nothing else in case of an error
         if($this->rpcError || $this->initFailed) return;
 
diff --git a/gosa-plugins/goto/admin/systems/goto/Config/failed.tpl b/gosa-plugins/goto/admin/systems/goto/Config/failed.tpl
new file mode 100644 (file)
index 0000000..fa91207
--- /dev/null
@@ -0,0 +1,9 @@
+{if $rpcError}
+    <h3>{t}Error{/t}</h3>
+    {msgPool type=rpcError p1=$error}
+    <button name='retryInit'>{t}Retry{/t}</button>
+{elseif $initFailed}
+    <h3>{t}Communication failed{/t}</h3>
+    {msgPool type=rpcError p1=$error}
+    <button name='retryInit'>{t}Retry{/t}</button>
+{/if}