00001 <?php
00002 # This file is part of the Savane project
00003 # <http://gna.org/projects/savane/>
00004 #
00005 # $Id: field_values_reset.php 5397 2006-02-15 22:55:15Z yeupou $
00006 #
00007 # Copyright 2005-2006 (c) Mathieu Roy <yeupou--gnu.org>
00008 #
00009 # The Savane project is free software; you can redistribute it and/or
00010 # modify it under the terms of the GNU General Public License
00011 # as published by the Free Software Foundation; either version 2
00012 # of the License, or (at your option) any later version.
00013 #
00014 # The Savane project is distributed in the hope that it will be useful,
00015 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00017 # GNU General Public License for more details.
00018 #
00019 # You should have received a copy of the GNU General Public License
00020 # along with the Savane project; if not, write to the Free Software
00021 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00022
00023
00024 if ($group_id && user_ismember($group_id,'A'))
00025 {
00026 # Initialize global bug structures
00027 trackers_init($group_id);
00028
00029 if (!$field)
00030 { exit_missing_param(); }
00031
00032 if ($cancel)
00033 {
00034 session_redirect($GLOBALS['sys_home'].ARTIFACT."/admin/field_values.php?group_id=$group_id&field=$field&list_value=1");
00035 }
00036
00037 if (!$confirm)
00038 {
00039 $hdr = sprintf(_("Reset Values of '%s'"),trackers_data_get_label($field));
00040 trackers_header_admin(array ('title'=>$hdr));
00041
00042 print '<form action="'.$GLOBALS[PHP_SELF].'" method="post">';
00043 print '<input type="hidden" name="group_id" value="'.$group_id.'" />';
00044 print '<input type="hidden" name="field" value="'.$field.'" />';
00045 print '<span class="preinput">'.sprintf(_("You are about to reset values of the field %s. This action will not be undoable, please confirm:"),trackers_data_get_label($field)).'</span>';
00046 print '<div class="center"><input type="submit" name="confirm" value="'._("Confirm").'" /> <input type="submit" name="cancel" value="'._("Cancel").'" /></div>';
00047 print '</form>';
00048 }
00049 else
00050 {
00051 db_query("DELETE FROM ".ARTIFACT."_field_value WHERE group_id='".addslashes($group_id)."' AND bug_field_id = '".trackers_data_get_field_id($field)."'");
00052 session_redirect($GLOBALS['sys_home'].ARTIFACT."/admin/field_values.php?group_id=$group_id&field=$field&list_value=1");
00053 }
00054
00055 }
00056 else
00057 {
00058 #browse for group first message
00059 if (!$group_id)
00060 {
00061 exit_no_group();
00062 }
00063 else
00064 {
00065 exit_permission_denied();
00066 }
00067
00068 }
00069
00070
00071 ?>