Added web interface for editing issues
authorarjen <arjen>
Thu, 1 Feb 2007 12:31:23 +0000 (12:31 +0000)
committerarjen <arjen>
Thu, 1 Feb 2007 12:31:23 +0000 (12:31 +0000)
src/web/bell.png [new file with mode: 0644]
src/web/issues.php [new file with mode: 0644]

diff --git a/src/web/bell.png b/src/web/bell.png
new file mode 100644 (file)
index 0000000..2a1d48c
Binary files /dev/null and b/src/web/bell.png differ
diff --git a/src/web/issues.php b/src/web/issues.php
new file mode 100644 (file)
index 0000000..0f4bb43
--- /dev/null
@@ -0,0 +1,162 @@
+<?php 
+
+/**************************************************************************
+**  (c) Copyright 2003, Andromeda Technology & Automation
+** This is free software; you can redistribute it and/or modify it under the
+** terms of the GNU General Public License, see the file COPYING.
+***************************************************************************
+** MODULE INFORMATION *
+***********************
+**      FILE NAME      : issues.php
+**      SYSTEM NAME    : Gnucomo - Gnu Computer Monitoring
+**      VERSION NUMBER : $Revision: 1.1 $
+**
+**  DESCRIPTION      :  Issue types Administration page.
+**                      Input parameters: action (POST) : empty, 'Create'
+**                            issuename (POST) : short name of the issue
+**
+**  EXPORTED OBJECTS : 
+**  LOCAL    OBJECTS : 
+**  MODULES  USED    :
+***************************************************************************
+**  ADMINISTRATIVE INFORMATION *
+********************************
+**      ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
+**      CREATION DATE   : Aug 04, 2003
+**      LAST UPDATE     : Aug 28, 2003
+**      MODIFICATIONS   : 
+**************************************************************************/
+
+/*****************************
+   $Log: issues.php,v $
+   Revision 1.1  2007-02-01 12:31:23  arjen
+   Added web interface for editing issues
+
+
+******************************/
+
+// RCSID = "$Id: issues.php,v 1.1 2007-02-01 12:31:23 arjen Exp $";
+
+ini_set('include_path', '.:./classes:../phpclasses');
+
+require_once('page.class.php');
+
+function clientscripts()
+{
+
+?>
+
+<script language='JavaScript'>
+
+function CheckCreate(f)
+{
+   if (f.issuename.value == "")
+   {
+      alert("You must supply an issue name");
+      return false;
+   }
+
+   if (f.issuedescr.value == "")
+   {
+      alert("You must supply a description");
+      return false;
+   }
+   return true;
+}
+
+function CheckRemove(f)
+{
+   var message = "Are you sure you want to remove issue type '";
+   message += f.issuename.value;
+   message += "' ?";
+
+   return confirm(message);
+}
+
+</script>
+
+<?php
+}
+
+class issue_page extends page
+{
+
+   function Body()
+   {
+
+   clientscripts();
+
+   if (isset($_POST['action']) && $_POST['action'] == 'Create'
+       && !empty($_POST['issuename']) && !empty($_POST['issuedescr']))
+   {
+      pg_exec($this->database, "INSERT INTO type_of_issue
+                       (name, suggested_priority, description) VALUES ('"
+                     . $_POST['issuename'] . "','" . $_POST['prior'] . "','" . $_POST['issuedescr'] . "')");
+   }
+
+   if (isset($_POST['action']) && $_POST['action'] == 'Remove'
+       && !empty($_POST['issueid']) )
+   {
+      pg_exec($this->database, "DELETE FROM type_of_issue WHERE type_of_issueid='"
+                                . $_POST['issueid'] . "'");
+   }
+
+   echo "<h1>Issue Types Administration</h1><hr>";
+
+   $res = pg_exec($this->database, "SELECT type_of_issueid, name, suggested_priority, description
+                                    FROM type_of_issue ORDER BY name");
+
+   echo "<table>";
+   echo "<tr><th>Issue</th><th>Priority</th><th>Description</th><tr>";
+   $cls = 0;
+   while ($cls < pg_numrows($res))
+   {
+      $u = pg_fetch_object($res, $cls);
+      ?>
+      <tr><td align='center'><img src='bell.png'><br>
+             <b><?php echo $u->name ?></b>
+      </td><td>
+         <?php echo $u->suggested_priority ?>
+      </td><td>
+         <?php echo $u->description ?>
+      </td><td>
+          <form action='issues.php' method='post' onSubmit='return CheckRemove(this)'>
+              <input type='hidden' name='issueid' value='<?php echo $u->type_of_issueid ?>'>
+              <input type='hidden' name='issuename' value='<?php echo $u->name ?>'>
+              <input type='submit' name='action' value='Remove'>
+          </form>
+      </td></tr>
+      <?php
+      $cls++;
+   }
+   echo "</table>";
+
+?>
+
+<h2>Create new issue type:</h2>
+<p>
+
+<form action='issues.php' method='post' onSubmit='return CheckCreate(this)'>
+Issue name: <input name='issuename' type='text'>
+Priority: <select name='prior'>
+<option value='1'>1</option>
+<option value='2'>2</option>
+<option value='3'>3</option>
+<option value='4'>4</option>
+<option value='5'>5</option>
+</select>
+Description: <input name='issuedescr' type='text'>
+<br>
+<input type='submit' name='action' value='Create'>
+</form>
+</p>
+
+<?php
+   }
+}
+
+$page = new issue_page("Gnucomo Parameter Classes Administration");
+
+$page->Showpage();
+
+?>