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.2 $
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.2 2007-11-21 14:38:06 arjen
33 The buttonbar at the top of each page is now a fixed 'div' element
34 instead of a framed page.
35 Contributed by Edwin Nadorp.
37 Revision 1.1 2007/02/01 12:31:23 arjen
38 Added web interface for editing issues
41 ******************************/
43 // RCSID = "$Id: issues.php,v 1.2 2007-11-21 14:38:06 arjen Exp $";
45 ini_set('include_path', '.:./classes:../phpclasses');
47 require_once('page.class.php');
49 function clientscripts()
54 <script type='text/ecmascript'>
56 function CheckCreate(f)
58 if (f.issuename.value == "")
60 alert("You must supply an issue name");
64 if (f.issuedescr.value == "")
66 alert("You must supply a description");
72 function CheckRemove(f)
74 var message = "Are you sure you want to remove issue type '";
75 message += f.issuename.value;
78 return confirm(message);
86 class issue_page extends page
94 if (isset($_POST['action']) && $_POST['action'] == 'Create'
95 && !empty($_POST['issuename']) && !empty($_POST['issuedescr']))
97 pg_exec($this->database, "INSERT INTO type_of_issue
98 (name, suggested_priority, description) VALUES ('"
99 . $_POST['issuename'] . "','" . $_POST['prior'] . "','" . $_POST['issuedescr'] . "')");
102 if (isset($_POST['action']) && $_POST['action'] == 'Remove'
103 && !empty($_POST['issueid']) )
105 pg_exec($this->database, "DELETE FROM type_of_issue WHERE type_of_issueid='"
106 . $_POST['issueid'] . "'");
109 echo "<script type='text/ecmascript'>document.getElementById('menu_title').innerHTML = '<h1>Issue Types Administration<\/h1>'</script><br>";
111 $res = pg_exec($this->database, "SELECT type_of_issueid, name, suggested_priority, description
112 FROM type_of_issue ORDER BY name");
115 echo "<tr><th>Issue</th><th>Priority</th><th>Description</th></tr>";
117 while ($cls < pg_numrows($res))
119 $u = pg_fetch_object($res, $cls);
121 <tr><td align='center'><img src='bell.png' alt='bell'><br>
122 <b><?php echo $u->name ?></b>
124 <?php echo $u->suggested_priority ?>
126 <?php echo $u->description ?>
128 <form action='issues.php' method='post' onSubmit='return CheckRemove(this)'>
129 <input type='hidden' name='issueid' value='<?php echo $u->type_of_issueid ?>'>
130 <input type='hidden' name='issuename' value='<?php echo $u->name ?>'>
131 <input type='submit' name='action' value='Remove'>
141 <h2>Create new issue type:</h2>
143 <form action='issues.php' method='post' onSubmit='return CheckCreate(this)'>
144 Issue name: <input name='issuename' type='text'>
145 Priority: <select name='prior'>
146 <option value='1'>1</option>
147 <option value='2'>2</option>
148 <option value='3'>3</option>
149 <option value='4'>4</option>
150 <option value='5'>5</option>
152 Description: <input name='issuedescr' type='text'>
154 <input type='submit' name='action' value='Create'>
161 $page = new issue_page("Gnucomo Parameter Classes Administration");