3 /**************************************************************************
4 ** This is free software; you can redistribute it and/or modify it under the
5 ** terms of the GNU General Public License, see the file COPYING.
6 ***************************************************************************/
10 * Objects Administration page.
11 * Input parameters: action (POST) : empty, 'Create'
12 * objname (POST) : name of the object to create or remove
16 require_once('classes/gnucomo_config.php');
19 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
22 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
23 <link rel='stylesheet' href='gnucomo.css' type='text/css'>
24 <title>GNUCoMo login</title>
26 <script language='JavaScript'>
27 function CheckCreate(f)
29 if (f.objectname.value == "")
31 alert("You must supply a name");
37 function CheckRemove(f)
39 var message = "Are you sure you want to remove object ";
40 message += f.objectname.value;
43 return confirm(message);
51 if (empty($_SESSION['username']))
53 echo "Please log in first.";
58 $config = new gnucomo_config;
60 $config->read("gnucomo");
62 // Connect to the database
63 $conn = pg_connect($config->Database($_SESSION['username'], $_SESSION['password']));
65 if (!empty($_GET['oid']))
67 $res = pg_exec("SELECT objectname FROM object WHERE objectid=" . $_GET['oid']);
68 $obj = pg_fetch_object($res, 0);
69 echo "<h1>Parameters for " . $obj->objectname . "</h1><hr>";
71 $res = pg_exec("SELECT paramid, class, name, description FROM parameter "
72 ."WHERE objectid=" . $_GET['oid']);
75 <form action='parameter_compare.php' method='post'>
80 while ($row < pg_numrows($res))
82 $par = pg_fetch_object($res, $row);
84 <tr><td align='center'>
85 <?php echo $par->class?>
87 <?php echo $par->name?>
89 <?php echo $par->description?>
92 $r = pg_exec($conn, "SELECT name, value FROM property WHERE paramid='" . $par->paramid . "'");
93 for ($p = 0; $p < pg_numrows($r); $p++)
95 $prop = pg_fetch_object($r, $p);
96 echo $prop->name . "=" . $prop->value . " ";