From 0fb088c22d9daca06b5809b02d6f016ad642101b Mon Sep 17 00:00:00 2001 From: Len Kranendonk Date: Mon, 8 Nov 2004 15:10:46 +0000 Subject: [PATCH] Added a javascript confirmation popup for delete icon --- lib/WebGUI/Icon.pm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/WebGUI/Icon.pm b/lib/WebGUI/Icon.pm index 94e120cef..25568d432 100644 --- a/lib/WebGUI/Icon.pm +++ b/lib/WebGUI/Icon.pm @@ -133,7 +133,7 @@ sub cutIcon { #------------------------------------------------------------------- -=head2 deleteIcon ( urlParameters [, pageURL ] ) +=head2 deleteIcon ( urlParameters [, pageURL, confirmText ] ) Generates a button that represents a delete operation. @@ -145,12 +145,22 @@ Any URL parameters that need to be tacked on to the current URL to accomplish wh The URL to any page. Defaults to the current page. +=head3 confirmText + +If defined, a confirm box will popup to ask the user if they want to delete. + =cut sub deleteIcon { - my ($output, $pageURL); + my ($output, $pageURL, $confirmText); + $confirmText = $_[2]; + if($confirmText) { + $confirmText = qq| onclick="return confirm('$confirmText')" |; + } + $pageURL = $_[1] || $session{page}{urlizedTitle}; - $output = ''; + + $output = ''; $output .= 'Delete'; return $output; }