3 /**************************************************************************
4 ** (c) Copyright 2003, Andromeda Technology & Automation
5 ** This is free software; you can redistribute it and/or modify it under the
6 ** terms of the GNU General Public License, see the file COPYING.
7 ***************************************************************************
8 ** MODULE INFORMATION *
9 ***********************
10 ** FILE NAME : issues.php
11 ** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring
12 ** VERSION NUMBER : $Revision: 1.1 $
14 ** DESCRIPTION : Issue types Administration page.
15 ** Input parameters: action (POST) : empty, 'Create'
16 ** issuename (POST) : short name of the issue
21 ***************************************************************************
22 ** ADMINISTRATIVE INFORMATION *
23 ********************************
24 ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
25 ** CREATION DATE : Aug 04, 2003
26 ** LAST UPDATE : Aug 28, 2003
28 **************************************************************************/
30 /*****************************
32 Revision 1.1 2007-02-01 12:31:23 arjen
33 Added web interface for editing issues
36 ******************************/
38 // RCSID = "$Id: issues.php,v 1.1 2007-02-01 12:31:23 arjen Exp $";
40 ini_set('include_path', '.:./classes:../phpclasses');
42 require_once('page.class.php');
44 function clientscripts()
49 <script language='JavaScript'>
51 function CheckCreate(f)
53 if (f.issuename.value == "")
55 alert("You must supply an issue name");
59 if (f.issuedescr.value == "")
61 alert("You must supply a description");
67 function CheckRemove(f)
69 var message = "Are you sure you want to remove issue type '";
70 message += f.issuename.value;
73 return confirm(message);
81 class issue_page extends page
89 if (isset($_POST['action']) && $_POST['action'] == 'Create'
90 && !empty($_POST['issuename']) && !empty($_POST['issuedescr']))
92 pg_exec($this->database, "INSERT INTO type_of_issue
93 (name, suggested_priority, description) VALUES ('"
94 . $_POST['issuename'] . "','" . $_POST['prior'] . "','" . $_POST['issuedescr'] . "')");
97 if (isset($_POST['action']) && $_POST['action'] == 'Remove'
98 && !empty($_POST['issueid']) )
100 pg_exec($this->database, "DELETE FROM type_of_issue WHERE type_of_issueid='"
101 . $_POST['issueid'] . "'");
104 echo "<h1>Issue Types Administration</h1><hr>";
106 $res = pg_exec($this->database, "SELECT type_of_issueid, name, suggested_priority, description
107 FROM type_of_issue ORDER BY name");
110 echo "<tr><th>Issue</th><th>Priority</th><th>Description</th><tr>";
112 while ($cls < pg_numrows($res))
114 $u = pg_fetch_object($res, $cls);
116 <tr><td align='center'><img src='bell.png'><br>
117 <b><?php echo $u->name ?></b>
119 <?php echo $u->suggested_priority ?>
121 <?php echo $u->description ?>
123 <form action='issues.php' method='post' onSubmit='return CheckRemove(this)'>
124 <input type='hidden' name='issueid' value='<?php echo $u->type_of_issueid ?>'>
125 <input type='hidden' name='issuename' value='<?php echo $u->name ?>'>
126 <input type='submit' name='action' value='Remove'>
136 <h2>Create new issue type:</h2>
139 <form action='issues.php' method='post' onSubmit='return CheckCreate(this)'>
140 Issue name: <input name='issuename' type='text'>
141 Priority: <select name='prior'>
142 <option value='1'>1</option>
143 <option value='2'>2</option>
144 <option value='3'>3</option>
145 <option value='4'>4</option>
146 <option value='5'>5</option>
148 Description: <input name='issuedescr' type='text'>
150 <input type='submit' name='action' value='Create'>
158 $page = new issue_page("Gnucomo Parameter Classes Administration");