[dev] Delete confirmations all over the place.

Tyler Colbert tyler-hordeml at colberts.us
Thu Sep 4 00:57:01 PDT 2003


There are lots of spots that needed delete confirmations.  With Chuck's commit
as a guide, I've managed a bunch of them.  I did this based on the comments in
an earlier thread about irrevokable steps needing confirmation and that people
dont believe that a pref is needed to control them.

In the places where I check for a whole list being deleted, I state that
deleting the list will delete all the items in the list.  I did not, however,
verify that this is the case.

Quite a few templates use double quotes around things (in php) that I felt
should be single quotes, but I didnt feel comfortable enough to make that
change.

There are a couple of places where the java code gets duplicated lots of times
in the html page.  These could probably be put into a function and thereby
reduce the entire size of the page, but the little javascript I know I haven't
used in 5+ years, so I decided to pass on that.

--
Tyler Colbert
-------------- next part --------------
Index: edit_image.inc
===================================================================
RCS file: /repository/ansel/templates/image/edit_image.inc,v
retrieving revision 1.8
diff -u -r1.8 edit_image.inc
--- edit_image.inc	26 Aug 2003 03:44:12 -0000	1.8
+++ edit_image.inc	4 Sep 2003 05:48:57 -0000
@@ -34,7 +34,7 @@
     }
 }
 if ($gallery->hasPermission(Auth::getAuth(), _PERMS_DELETE)) {
-    Menu::printItem(Horde::applicationUrl(Horde::addParameter($imageurl, 'actionID', 'delete')), _("Delete"), 'delete.gif', null, null, null, 'control');
+    Menu::printItem(Horde::applicationUrl(Horde::addParameter($imageurl, 'actionID', 'delete')), _("Delete"), 'delete.gif', null, null, 'return window.confirm(\'' . addslashes(_("Are you sure you want to delete this image?")) . '\');', 'control');
 }
 ?>
   <td align="right" class="control" width="100%">
-------------- next part --------------
Index: navbar-image.inc
===================================================================
RCS file: /repository/ansel/templates/view/navbar-image.inc,v
retrieving revision 1.7
diff -u -r1.7 navbar-image.inc
--- navbar-image.inc	26 Aug 2003 03:44:16 -0000	1.7
+++ navbar-image.inc	4 Sep 2003 05:48:38 -0000
@@ -12,7 +12,7 @@
       | <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($imageurl, 'actionID', 'editimage')), _("Edit Image"), 'widget') ?><?php echo _("Edit Image") ?></a>
     <?php endif; ?>
     <?php if ($gallery->hasPermission(Auth::getAuth(), _PERMS_DELETE)): ?>
-      | <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($imageurl, 'actionID', 'delete')), _("Delete Image"), 'widget') ?><?php echo _("Delete Image") ?></a>
+      | <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($imageurl, 'actionID', 'delete')), _("Delete Image"), 'widget', '', 'return window.confirm(\'' . addslashes(_("Are you sure you want to delete this image?")) . '\');') . _("Delete Image") ?></a>
     <?php endif; ?>
   </td>
   <td align="right">
-------------- next part --------------
Index: item_summaries.inc
===================================================================
RCS file: /repository/genie/templates/list/item_summaries.inc,v
retrieving revision 1.5
diff -u -r1.5 item_summaries.inc
--- item_summaries.inc	5 Aug 2003 18:25:33 -0000	1.5
+++ item_summaries.inc	4 Sep 2003 06:16:08 -0000
@@ -1,7 +1,7 @@
 <tr class="<?php echo $style ?>" onmouseover="javascript:style.backgroundColor='<?php echo $css['.' . $style . '-hi']['background-color'] ?>'" onmouseout="javascript:style.backgroundColor='<?php echo $css['.' . $style]['background-color'] ?>'">
   <td nowrap="nowrap">
     <?php if (!is_a($share, 'PEAR_Error') && $share->hasPermission(Auth::getAuth(), _PERMS_DELETE)): ?>
-      <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($itemurl, 'actionID', GENIE_DELETE_ITEMS)), _("Delete Item"), 'widget') ?>
+      <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($itemurl, 'actionID', GENIE_DELETE_ITEMS)), _("Delete Item"), 'widget', '', 'return window.confirm(\'' . addslashes(_("Are you sure you want to delete this item?")) . '\');') ?>
       <?php echo Horde::img('delete.gif', _("Delete Item")) ?>
       </a>
     <?php endif; ?>
-------------- next part --------------
Index: navbar.inc
===================================================================
RCS file: /repository/genie/templates/view/navbar.inc,v
retrieving revision 1.3
diff -u -r1.3 navbar.inc
--- navbar.inc	5 Aug 2003 18:25:34 -0000	1.3
+++ navbar.inc	4 Sep 2003 06:21:13 -0000
@@ -13,7 +13,7 @@
       <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($itemurl, 'actionID', GENIE_MODIFY_ITEM)), _("Modify Item"), 'widget') ?><?php echo _("Modify Item") ?></a>
     <?php endif; ?>
     <?php if ($share->hasPermission(Auth::getAuth(), _PERMS_DELETE)): ?>
-      | <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($itemurl, 'actionID', GENIE_DELETE_ITEMS)), _("Delete Item"), 'widget') ?><?php echo _("Delete Item") ?></a>
+      | <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($itemurl, 'actionID', GENIE_DELETE_ITEMS)), _("Delete Item"), 'widget', '', 'return window.confirm(\'' . addslashes(_("Are you sure you want to delete this item?")) . '\');') . _("Delete Item") ?></a>
     <?php endif; ?>
   </td>
   <td align="right">
-------------- next part --------------
Index: manage.inc
===================================================================
RCS file: /repository/genie/templates/wishlists/manage.inc,v
retrieving revision 1.2
diff -u -r1.2 manage.inc
--- manage.inc	17 Jan 2003 20:58:38 -0000	1.2
+++ manage.inc	4 Sep 2003 06:42:17 -0000
@@ -45,7 +45,7 @@
     <tr>
       <td>
         <input type="submit" name="save" class="button" onclick="document.shares.actionID.value = <?php echo SHARE_SAVE ?>;return true" value="<?php echo $actionID == SHARE_EDIT ? _("Change") : _("Create") ?>" />
-        <input type="submit" name="delete" class="button" onclick="document.shares.actionID.value = <?php echo SHARE_DELETE ?>" value="<?php echo _("Delete") ?>" />
+        <input type="submit" name="delete" class="button" onclick="if(!window.confirm('<?php echo _('Are you sure you want to delete this wishlist?  All items will be deleted also') ?>')) return false; document.shares.actionID.value = <?php echo SHARE_DELETE ?>" value="<?php echo _("Delete") ?>" />
         <input type="submit" name="new" class="button" onclick="clearForm(); document.shares.save.value = '<?php echo _("Create") ?>';" value="<?php echo _("Reset") ?>" />
         <input type="submit" name="back" class="button" onclick="cancelSubmit = true; document.location.href = '<?php echo Horde::applicationUrl('prefs.php?group=share', true) ?>'" value="<?php echo _("Back to Wishlist Options") ?>" />
       </td>
-------------- next part --------------
Index: memo_summaries.inc
===================================================================
RCS file: /repository/mnemo/templates/list/memo_summaries.inc,v
retrieving revision 1.11
diff -u -r1.11 memo_summaries.inc
--- memo_summaries.inc	7 May 2003 15:14:19 -0000	1.11
+++ memo_summaries.inc	4 Sep 2003 07:00:23 -0000
@@ -1,7 +1,7 @@
 <tr class="text" style="background-color:<?php echo $color ?>" onmouseover="javascript:style.backgroundColor='<?php echo Horde_Image::modifyColor($color) ?>'" onmouseout="javascript:style.backgroundColor='<?php echo $color ?>'" >
     <td nowrap="nowrap" align="center">
         <?php if (!is_a($share, 'PEAR_Error') && $share->hasPermission(Auth::getAuth(), _PERMS_DELETE)): ?>
-            <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($memourl, 'actionID=' . MNEMO_DELETE_MEMOS)), _("Delete Note"), 'widget') ?>
+            <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($memourl, 'actionID=' . MNEMO_DELETE_MEMOS)), _("Delete Note"), 'widget', '', 'return window.confirm(\'' . addslashes(_("Are you sure you want to delete this note?")) . '\');') ?>
             <?php echo Horde::img('delete.gif', _("Delete Note")) ?>
             </a>
         <?php endif; ?>    
-------------- next part --------------
Index: headers.inc
===================================================================
RCS file: /repository/mnemo/templates/view/headers.inc,v
retrieving revision 1.6
diff -u -r1.6 headers.inc
--- headers.inc	21 Sep 2002 16:37:23 -0000	1.6
+++ headers.inc	4 Sep 2003 07:22:09 -0000
@@ -22,7 +22,7 @@
             | 
         <?php endif; ?>
         <?php if ($share->hasPermission(Auth::getAuth(), _PERMS_DELETE)): ?>
-            <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($memourl, 'actionID=' . MNEMO_DELETE_MEMOS)), _("Delete Note"), 'widget') ?><?php echo _("Delete Note") ?></a>
+            <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($memourl, 'actionID=' . MNEMO_DELETE_MEMOS)), _("Delete Note"), 'widget', '', 'return window.confirm(\'' . addslashes(_("Are you sure you want to delete this note?")) . '\');') . _("Delete Note") ?></a>
             | 
         <?php endif; ?>
         <?php echo Horde::link(Horde::applicationUrl('list.php'), _("Back to Notepad"), 'widget') ?><?php echo _("Back to Notepad") ?></a>&nbsp;&nbsp;
-------------- next part --------------
Index: navbar.inc
===================================================================
RCS file: /repository/mnemo/templates/view/navbar.inc,v
retrieving revision 1.4
diff -u -r1.4 navbar.inc
--- navbar.inc	21 Sep 2002 16:37:23 -0000	1.4
+++ navbar.inc	4 Sep 2003 07:00:02 -0000
@@ -14,7 +14,7 @@
             <?php endif; ?>
         <?php endif; ?>
         <?php if ($share->hasPermission(Auth::getAuth(), _PERMS_DELETE)): ?>
-            <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($memourl, 'actionID=' . MNEMO_DELETE_MEMOS)), _("Delete Note"), 'widget') ?><?php echo _("Delete Note") ?></a>
+            <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($memourl, 'actionID=' . MNEMO_DELETE_MEMOS)), _("Delete Note"), 'widget', '', 'return window.confirm(\'' . addslashes(_("Are you sure you want to delete this note?")) . '\');') . _("Delete Note") ?></a>
         <?php endif; ?>
     </td>
     <td align="right">
-------------- next part --------------
Index: manage.inc
===================================================================
RCS file: /repository/nag/templates/tasklists/manage.inc,v
retrieving revision 1.6
diff -u -r1.6 manage.inc
--- manage.inc	4 Jun 2003 18:19:31 -0000	1.6
+++ manage.inc	4 Sep 2003 06:55:20 -0000
@@ -45,7 +45,7 @@
     <tr>
       <td>
         <input type="submit" name="save" class="button" onclick="document.shares.actionID.value = <?php echo SHARE_SAVE ?>;return true" value="<?php echo $actionID == SHARE_EDIT ? _("Change") : _("Create") ?>" />
-        <input type="submit" name="delete" class="button" onclick="document.shares.actionID.value = <?php echo SHARE_DELETE ?>" value="<?php echo _("Delete") ?>" />
+        <input type="submit" name="delete" class="button" onclick="if(!window.confirm('<?php echo _('Are you sure you want to delete this task list?  All tasks in it will be deleted also.') ?>')) return false; document.shares.actionID.value = <?php echo SHARE_DELETE ?>" value="<?php echo _("Delete") ?>" />
         <input type="submit" name="new" class="button" onclick="clearForm(); document.shares.save.value = '<?php echo _("Create") ?>';" value="<?php echo _("Reset") ?>" />
         <input type="submit" name="back" class="button" onclick="cancelSubmit = true; document.location.href = '<?php echo Horde::applicationUrl('prefs.php?group=share', true) ?>'" value="<?php echo _("Back to Task List Options") ?>" />
       </td>
-------------- next part --------------
Index: navbar.inc
===================================================================
RCS file: /repository/nag/templates/view/navbar.inc,v
retrieving revision 1.11
diff -u -r1.11 navbar.inc
--- navbar.inc	1 Jan 2003 18:31:49 -0000	1.11
+++ navbar.inc	4 Sep 2003 06:50:48 -0000
@@ -13,7 +13,7 @@
       <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($taskurl, 'actionID=' . NAG_MODIFY_TASK)), _("Modify Task"), 'widget') ?><?php echo _("Modify Task") ?></a>
     <?php endif; ?>
     <?php if ($share->hasPermission(Auth::getAuth(), _PERMS_DELETE)): ?>
-      | <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($taskurl, 'actionID=' . NAG_DELETE_TASKS)), _("Delete Task"), 'widget') ?><?php echo _("Delete Task") ?></a>
+      | <?php echo Horde::link(Horde::applicationUrl(Horde::addParameter($taskurl, 'actionID=' . NAG_DELETE_TASKS)), _("Delete Task"), 'widget', '', 'return window.confirm(\'' . addslashes(_("Are you sure you want to delete this task?")) . '\');') . _("Delete Task") ?></a>
     <?php endif; ?>
   </td>
   <td align="right">
-------------- next part --------------
Index: manage.inc
===================================================================
RCS file: /repository/kronolith/templates/calendars/manage.inc,v
retrieving revision 1.12
diff -u -r1.12 manage.inc
--- manage.inc	25 May 2003 17:51:22 -0000	1.12
+++ manage.inc	4 Sep 2003 07:31:08 -0000
@@ -45,7 +45,7 @@
     <tr>
       <td>
         <input type="submit" name="save" class="button" onclick="document.shares.actionID.value = <?php echo SHARE_SAVE ?>; return true" value="<?php echo $actionID == SHARE_EDIT ? _("Change") : _("Create") ?>" />
-        <input type="submit" name="delete" class="button" onclick="document.shares.actionID.value = <?php echo SHARE_DELETE ?>" value="<?php echo _("Delete") ?>" />
+        <input type="submit" name="delete" class="button" onclick="if(!window.confirm('<?php echo _('Are you sure you want to delete this calendar?  All events will be deleted also') ?>')) return false; document.shares.actionID.value = <?php echo SHARE_DELETE ?>" value="<?php echo _("Delete") ?>" />
         <input type="submit" name="new" class="button" onclick="clearForm(); document.shares.save.value = '<?php echo _("Create") ?>';" value="<?php echo _("Reset") ?>" />
         <input type="submit" name="back" class="button" onclick="cancelSubmit = true; document.location.href = '<?php echo Horde::applicationUrl('prefs.php?group=share', true) ?>'" value="<?php echo _("Back to Calendar Options") ?>" />
       </td>


More information about the dev mailing list