2 // This program is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU General Public License
4 // as published by the Free Software Foundation; either version 2
5 // of the License, or (at your option) any later version.
7 //INCLUDES, DO ANY ACTIONS, THEN GET OUR DATA
8 include_once("../globals.php");
9 include_once("$srcdir/registry.inc");
10 if ($_GET['method'] == "enable"){
11 updateRegistered ( $_GET['id'], "state=1" );
13 elseif ($_GET['method'] == "disable"){
14 updateRegistered ( $_GET['id'], "state=0" );
16 elseif ($_GET['method'] == "install_db"){
17 $dir = getRegistryEntry ( $_GET['id'], "directory" );
18 if (installSQL ("$srcdir/../interface/forms/{$dir['directory']}"))
19 updateRegistered ( $_GET['id'], "sql_run=1" );
21 $err = xl('ERROR: could not open table.sql, broken form?');
23 elseif ($_GET['method'] == "register"){
24 registerForm ( $_GET['name'] ) or $err=xl('error while registering form!');
26 $bigdata = getRegistered("%") or $bigdata = false;
29 //START OUT OUR PAGE....
33 <?php
html_header_show();?
>
34 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
36 <body
class="body_top">
37 <span
class="title"><?php
xl('Forms Administration','e');?
></span
>
40 foreach($_POST as $key=>$val) {
41 if (preg_match('/nickname_(\d+)/', $key, $matches)) {
42 $nickname_id = $matches[1];
43 sqlQuery("update registry set nickname='".$val."' where id=".$nickname_id);
45 if (preg_match('/category_(\d+)/', $key, $matches)) {
46 $category_id = $matches[1];
47 sqlQuery("update registry set category='".$val."' where id=".$category_id);
49 if (preg_match('/priority_(\d+)/', $key, $matches)) {
50 $priority_id = $matches[1];
51 sqlQuery("update registry set priority='".$val."' where id=".$priority_id);
57 <?php
//ERROR REPORTING
59 echo "<span class=bold>$err</span><br><br>\n";
63 <?php
//REGISTERED SECTION ?>
64 <span
class=bold
><?php
xl('Registered','e');?
></span
><br
>
65 <form method
=POST action
='./forms_admin.php'>
66 <i
><?php
xl('click here to update priority, category and nickname settings','e'); ?
></i
>
67 <input type
=submit name
=update value
='<?php xl('update
','e
'); ?>'><br
>
68 <table border
=0 cellpadding
=1 cellspacing
=2 width
="500">
75 <td
><?php
xl('Priority ','e'); ?
></td
>
76 <td
><?php
xl('Category ','e'); ?
></td
>
77 <td
><?php
xl('Nickname','e'); ?
></td
>
81 if ($bigdata != false)
82 foreach($bigdata as $registry)
84 $priority_category = sqlQuery("select priority, category, nickname from registry where id=".$registry['id']);
87 <td bgcolor
="<?php echo $color?>" width
="2%">
88 <span
class=text
><?php
echo $registry['id'];?
></span
>
90 <td bgcolor
="<?php echo $color?>" width
="30%">
91 <span
class=bold
><?php
echo xl_form_title($registry['name']); ?
></span
>
94 if ($registry['sql_run'] == 0)
95 echo "<td bgcolor='$color' width='10%'><span class='text'>".xl('registered')."</span>";
96 elseif ($registry['state'] == "0")
97 echo "<td bgcolor='#FFCCCC' width='10%'><a class=link_submit href='./forms_admin.php?id={$registry['id']}&method=enable'>".xl('disabled')."</a>";
99 echo "<td bgcolor='#CCFFCC' width='10%'><a class=link_submit href='./forms_admin.php?id={$registry['id']}&method=disable'>".xl('enabled')."</a>";
101 <td bgcolor
="<?php $color?>" width
="10%">
102 <span
class=text
><?php
104 if ($registry['unpackaged'])
105 echo xl('PHP extracted','e');
107 echo xl('PHP compressed','e');
111 <td bgcolor
="<?php echo $color?>" width
="10%">
113 if ($registry['sql_run'])
114 echo "<span class=text>".xl('DB installed')."</span>";
116 echo "<a class=link_submit href='./forms_admin.php?id={$registry['id']}&method=install_db'>".xl('install DB')."</a>";
120 echo "<td><input type=text size=4 name=priority_".$registry['id']." value='".$priority_category['priority']."'></td>";
121 echo "<td><input type=text size=8 name=category_".$registry['id']." value='".$priority_category['category']."'></td>";
122 echo "<td><input type=text size=8 name=nickname_".$registry['id']." value='".$priority_category['nickname']."'></td>";
126 if ($color=="#CCCCCC")
135 <?php
//UNREGISTERED SECTION ?>
136 <span
class=bold
><?php
xl('Unregistered','e');?
></span
><br
>
137 <table border
=0 cellpadding
=1 cellspacing
=2 width
="500">
139 $dpath = "$srcdir/../interface/forms/";
140 $dp = opendir($dpath);
142 for ($i=0; false != ($fname = readdir($dp)); $i++
)
143 if ($fname != "." && $fname != ".." && $fname != "CVS" && $fname != "LBF" &&
144 (is_dir($dpath.$fname) ||
stristr($fname, ".tar.gz") ||
145 stristr($fname, ".tar") ||
stristr($fname, ".zip") ||
146 stristr($fname, ".gz")))
149 // ballards 11/05/2005 fixed bug in removing registered form from the list
150 if ($bigdata != false)
152 foreach ( $bigdata as $registry )
154 $key = array_search($registry['directory'], $inDir) ; /* returns integer or FALSE */
159 foreach ( $inDir as $fname )
161 // added 8-2009 by BM - do not show the metric vitals form as option since deprecated
162 // also added a toggle in globals.php in case user wants the option to add this deprecated form
163 if (($fname == "vitalsM") && ($GLOBALS['disable_deprecated_metrics_form'])) continue;
165 if (stristr($fname, ".tar.gz") ||
stristr($fname, ".tar") ||
stristr($fname, ".zip") ||
stristr($fname, ".gz"))
166 $phpState = "PHP compressed";
168 $phpState = "PHP extracted";
171 <td bgcolor
="<?php echo $color?>" width
="1%">
172 <span
class=text
> </span
>
174 <td bgcolor
="<?php echo $color?>" width
="20%">
176 $form_title_file = @file
($GLOBALS['srcdir']."/../interface/forms/$fname/info.txt");
177 if ($form_title_file)
178 $form_title = $form_title_file[0];
180 $form_title = $fname;
182 <span
class=bold
><?php
echo xl_form_title($form_title); ?
></span
>
184 <td bgcolor
="<?php echo $color?>" width
="10%"><?php
185 if ($phpState == "PHP extracted")
186 echo '<a class=link_submit href="./forms_admin.php?name=' . urlencode($fname) . '&method=register">' . xl('register') . '</a>';
188 echo '<span class=text>' . xl('n/a') . '</span>';
190 <td bgcolor
="<?php echo $color?>" width
="20%">
191 <span
class=text
><?php
echo xl($phpState); ?
></span
>
193 <td bgcolor
="<?php echo $color?>" width
="10%">
194 <span
class=text
><?php
xl('n/a','e'); ?
></span
>
198 if ($color=="#CCCCCC")