Code

Added dialog to confirm the deletion of pool attributes
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 18 Jan 2006 06:23:57 +0000 (06:23 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 18 Jan 2006 06:23:57 +0000 (06:23 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2507 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_glpiAttachmentPool.inc
plugins/admin/systems/remove_glpi.tpl [new file with mode: 0644]

index 4cfd7f46e470d4887c2d0ef3f93316e0dcc177bf..fcfa664a12fd3b9e09d21b4ad582be16f32d269a 100644 (file)
@@ -23,6 +23,8 @@ class glpiAttachmentPool extends plugin
 
   var $Selected = array();
 
+  var $delAttach= "";
+
   function glpiAttachmentPool ($config, $dn= NULL,$used=NULL)
   {
     plugin::plugin ($config, $dn);
@@ -67,9 +69,11 @@ class glpiAttachmentPool extends plugin
         $str = base64_decode(preg_replace("/_.*$/","",$str));
 
         /* remove attach from db */
-        $this->parent->handle->deleteAttachment($str);
+        $this->delAttach = $str;
+        $smarty->assign("warning", sprintf(_("You're about to delete the glpi attachment component '%s'."), $attach[$str]['name']));
+        return($smarty->fetch(get_template_path('remove_glpi.tpl', TRUE)));
       }
-     
       /* Start editing entry */ 
       if((preg_match("/^editAttach_/",$name))&&($only_once)){
         $only_once = false;
@@ -92,6 +96,11 @@ class glpiAttachmentPool extends plugin
       }
     }
 
+    if((isset($_POST['delete_glpi_confirm']))&&(isset($attach[$this->delAttach]))){
+      $this->parent->handle->deleteAttachment($this->delAttach);
+      $attach     = $this->parent->handle->getAttachments();
+    }
+
     /* Someone tries to upload a file */
     if(($this->edit == true)&&(isset($_POST['upload']))){
       if(!isset($_FILES['filename'])){
diff --git a/plugins/admin/systems/remove_glpi.tpl b/plugins/admin/systems/remove_glpi.tpl
new file mode 100644 (file)
index 0000000..4106caf
--- /dev/null
@@ -0,0 +1,17 @@
+<div style="font-size:18px;">
+<img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+ {$warning}
+ {t}Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
+</p>
+
+<p>
+ {t}Best thing to do before performing this action would be to save the current contents of your MySql database in a file. So - if you've done so - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+  <input type=submit name="delete_glpi_confirm" value="{t}Delete{/t}">
+  &nbsp;
+  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+</p>