3 * Site Admin page to edit canned responses for project rejection
5 * This page is linked from approve-pending.php
7 * Copyright 1999-2001 (c) VA Linux Systems
9 * This file is part of FusionForge. FusionForge is free software;
10 * you can redistribute it and/or modify it under the terms of the
11 * GNU General Public License as published by the Free Software
12 * Foundation; either version 2 of the Licence, or (at your option)
15 * FusionForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 require_once '../env.inc.php';
26 require_once $gfcommon.'include/pre.php';
27 require_once $gfcommon.'include/account.php';
28 require_once $gfwww.'include/canned_responses.php';
29 require_once $gfwww.'admin/admin_utils.php';
30 require_once $gfwww.'project/admin/project_admin_utils.php';
32 site_admin_header(array('title'=>_('Site Admin: Edit Rejection Responses')));
34 function check_select_value($value) {
35 if( $value == "100" ) {
36 print('<span class="important">'.sprintf(_('You cannot %1$s “None”!'), $GLOBALS['type'])."</span><br />\n");
41 <form method="post" action="<?php echo getStringFromServer('PHP_SELF'); ?>">
42 <?php echo _('Existing Responses')._(': '); ?><?php echo get_canned_responses(); ?>
43 <!-- Reinhard Spisser: commenting localization, since otherwise it will not work -->
45 <input name="action" type="submit" value="<?php echo _('Edit'); ?>" />
46 <input name="action" type="submit" value="<?php echo _('Delete'); ?>" />
48 <input name="action" type="submit" value="Edit" />
49 <input name="action" type="submit" value="Delete" />
50 <input type="checkbox" name="sure" value="<?php echo _('Yes'); ?>" />
51 <?php echo _('I am Sure'); ?>
58 $action = getStringFromRequest('action');
60 if( $action == "Edit" ) {
61 $response_id = getIntFromRequest('response_id');
62 $action2 = getStringFromRequest('action2');
63 $response_title = getStringFromRequest('response_title');
64 $response_text = getStringFromRequest('response_text');
67 check_select_value($response_id);
69 db_query_params ('UPDATE canned_responses SET response_title=$1, response_text=$2 WHERE response_id=$3',
70 array($response_title,
74 print(" <strong>" ._('Edited Response')."</strong> ");
76 $res = db_query_params ('SELECT * FROM canned_responses WHERE response_id=$1',
77 array($response_id)) ;
79 $row = db_fetch_array($res);
80 $response_title=$row[1];
81 $response_text=$row[2];
84 <?php echo _('Edit Response:'); ?><br />
85 <form method="post" action="<?php echo getStringFromServer('PHP_SELF'); ?>">
86 <?php echo _('Response Title:'); ?><input type="text" name="response_title" size="30" maxlength="25" value="<?php echo $response_title; ?>" /><br />
87 <?php echo _('Response Text:'); ?><br />
88 <textarea name="response_text" cols="50" rows="10"><?php echo $response_text; ?></textarea>
89 <input type="hidden" name="response_id" value="<?php echo $response_id; ?>" />
90 <input type="hidden" name="action2" value="<?php echo _('Go'); ?>" />
91 <input type="hidden" name="action" value="Edit">
92 <input type="submit" name="actionsubmit" value="<?php echo _('Edit'); ?>" />
98 } elseif ( $action == "Delete" ) {
99 $response_id = getIntFromRequest('response_id');
100 $sure = getStringFromRequest('sure');
103 check_select_value($response_id);
104 if( $sure == "yes" ) {
105 db_query_params ('DELETE FROM canned_responses WHERE response_id=$1',
106 array($response_id)) ;
108 print(" <strong>" ._('Deleted Response')."</strong> ");
110 print( _('If you are not sure then why did you click “Delete”?')."<br />");
111 print("<em>" ._('By the way, I didn\'t delete... just in case...')."</em><br />\n");
114 } elseif ( $action == "Create" ) {
115 $response_title = getStringFromRequest('response_title');
116 $response_text = getStringFromRequest('response_text');
119 add_canned_response($response_title, $response_text);
120 print(" <strong>" ._('Added Response')."</strong> ");
125 <?php echo _('Create New Response:'); ?><br />
126 <form method="post" action="<?php echo getStringFromServer('PHP_SELF'); ?>">
127 <?php echo _('Response Title:'); ?><input type="text" name="response_title" size="30" maxlength="25" /><br />
128 <?php echo _('Response Text:'); ?><br />
129 <textarea name="response_text" cols="50" rows="10"></textarea>
131 <input type="hidden" name="action" value="Create" />
132 <input type="submit" name="actions" value="<?php echo _('Create'); ?>" />
138 site_admin_footer(array());
142 // c-file-style: "bsd"