From 97d4d7f3cdcffc79bdd6c0c3afa87e3959e7db47 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 18 Jan 2006 06:23:57 +0000 Subject: [PATCH] Added dialog to confirm the deletion of pool attributes git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2507 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_glpiAttachmentPool.inc | 13 +++++++++++-- plugins/admin/systems/remove_glpi.tpl | 17 +++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 plugins/admin/systems/remove_glpi.tpl diff --git a/plugins/admin/systems/class_glpiAttachmentPool.inc b/plugins/admin/systems/class_glpiAttachmentPool.inc index 4cfd7f46e..fcfa664a1 100644 --- a/plugins/admin/systems/class_glpiAttachmentPool.inc +++ b/plugins/admin/systems/class_glpiAttachmentPool.inc @@ -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 index 000000000..4106caf06 --- /dev/null +++ b/plugins/admin/systems/remove_glpi.tpl @@ -0,0 +1,17 @@ +
+ {t}Warning{/t} +
+

+ {$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} +

+ +

+ {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} +

+ +

+ +   + +

-- 2.30.2