From 5c4661cf1fb080988a7899bbc9a74e9e27360cfb Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 22 Dec 2005 05:30:10 +0000 Subject: [PATCH] r650: Added delete/kill actions --- admin/userhelp.php | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/admin/userhelp.php b/admin/userhelp.php index 9d240c6..5d9524b 100755 --- a/admin/userhelp.php +++ b/admin/userhelp.php @@ -18,11 +18,26 @@ if (!can_perform('canadmintools')) admin_login(); } +// don't allow deleting of these +$nokills = array( + 'assignedto', + 'bugid', + 'dateline', + 'dependency', + 'duplicateof', + 'priority', + 'product', + 'reporter', + 'resolution', + 'severity', + 'status', + 'summary' +); + // ################################################################### if (empty($_REQUEST['do'])) { - // set default branch for this script $_REQUEST['do'] = 'modify'; } @@ -30,14 +45,28 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'kill') { - // run code to remove item in database + if (in_array($bugsys->in['keystring'], $nokills)) + { + $admin->error($lang->string('You cannot delete this help text because it is part of the default set.')); + } + + $db->query("DELETE FROM " . TABLE_PREFIX . "fieldhelp WHERE keystring = '" . $bugsys->in['keystring'] . "'"); + + build_user_help(); + + $admin->redirect('userhelp.php?do=modify'); } // ################################################################### if ($_REQUEST['do'] == 'delete') { - // display delete confirmation message + if (in_array($bugsys->in['keystring'], $nokills)) + { + $admin->error($lang->string('You cannot delete this help text because it is part of the default set.')); + } + + $admin->page_confirm($lang->string('Are you sure you want to delete help text?'), 'userhelp.php?do=kill&keystring=' . $bugsys->in['keystring']); } // ################################################################### @@ -131,7 +160,9 @@ if ($_REQUEST['do'] == 'modify') while ($topic = $db->fetch_array($topics)) { $inputfield = ''; - $admin->row_textarea($inputfield . '
' . $topic['keystring'] . '', 'help[' . $topic['keystring'] . '][body]', $topic['body']); + $delete = (!in_array($topic['keystring'], $nokills) ? '

[' . $lang->string('Delete') . ']' : ''); + + $admin->row_textarea($inputfield . '
' . $topic['keystring'] . '' . $delete, 'help[' . $topic['keystring'] . '][body]', $topic['body']); } $admin->row_submit('[' . $lang->string('Add New Help Text') . ']'); -- 2.43.5