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 include_once("$srcdir/sql.inc");
11 if ($_GET['method'] == "enable"){
12 updateRegistered ( $_GET['id'], "state=1" );
14 elseif ($_GET['method'] == "disable"){
15 updateRegistered ( $_GET['id'], "state=0" );
17 elseif ($_GET['method'] == "install_db"){
18 $dir = getRegistryEntry ( $_GET['id'], "directory" );
19 if (installSQL ("$srcdir/../interface/forms/{$dir['directory']}"))
20 updateRegistered ( $_GET['id'], "sql_run=1" );
22 $err = xl('ERROR: could not open table.sql, broken form?');
24 elseif ($_GET['method'] == "register"){
25 registerForm ( $_GET['name'] ) or $err=xl('error while registering form!');
27 $bigdata = getRegistered("%") or $bigdata = false;
29 $formtarget = $GLOBALS['concurrent_layout'] ?
"" : " target='Main'";
31 //START OUT OUR PAGE....
35 <?php
html_header_show();?
>
36 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
38 <body
class="body_top">
39 <span
class="title"><?php
xl('Forms Administration','e');?
></span
>
42 foreach($_POST as $key=>$val) {
43 if (preg_match('/nickname_(\d+)/', $key, $matches)) {
44 $nickname_id = $matches[1];
45 sqlQuery("update registry set nickname='".$val."' where id=".$nickname_id);
47 if (preg_match('/category_(\d+)/', $key, $matches)) {
48 $category_id = $matches[1];
49 sqlQuery("update registry set category='".$val."' where id=".$category_id);
51 if (preg_match('/priority_(\d+)/', $key, $matches)) {
52 $priority_id = $matches[1];
53 sqlQuery("update registry set priority='".$val."' where id=".$priority_id);
59 <?php
//ERROR REPORTING
61 echo "<span class=bold>$err</span><br><br>\n";
65 <?php
//REGISTERED SECTION ?>
66 <span
class=bold
><?php
xl('Registered','e');?
></span
><br
>
67 <form method
=POST action
='./forms_admin.php'<?php
echo $formtarget; ?
>>
68 <i
><?php
xl('click here to update priority, category and nickname settings','e'); ?
></i
>
69 <input type
=submit name
=update value
='<?php xl('update
','e
'); ?>'><br
>
70 <table border
=0 cellpadding
=1 cellspacing
=2 width
="500">
77 <td
><?php
xl('Priority ','e'); ?
></td
>
78 <td
><?php
xl('Category ','e'); ?
></td
>
79 <td
><?php
xl('Nickname','e'); ?
></td
>
83 if ($bigdata != false)
84 foreach($bigdata as $registry)
86 $priority_category = sqlQuery("select priority, category, nickname from registry where id=".$registry['id']);
89 <td bgcolor
="<?php echo $color?>" width
="2%">
90 <span
class=text
><?php
echo $registry['id'];?
></span
>
92 <td bgcolor
="<?php echo $color?>" width
="30%">
93 <span
class=bold
><?php
echo xl_form_title($registry['name']); ?
></span
>
96 if ($registry['sql_run'] == 0)
97 echo "<td bgcolor='$color' width='10%'><span class='text'>".xl('registered')."</span>";
98 elseif ($registry['state'] == "0")
99 echo "<td bgcolor='#FFCCCC' width='10%'><a class=link_submit href='./forms_admin.php?id={$registry['id']}&method=enable'$formtarget>".xl('disabled')."</a>";
101 echo "<td bgcolor='#CCFFCC' width='10%'><a class=link_submit href='./forms_admin.php?id={$registry['id']}&method=disable'$formtarget>".xl('enabled')."</a>";
103 <td bgcolor
="<?php $color?>" width
="10%">
104 <span
class=text
><?php
106 if ($registry['unpackaged'])
107 echo xl('PHP extracted','e');
109 echo xl('PHP compressed','e');
113 <td bgcolor
="<?php echo $color?>" width
="10%">
115 if ($registry['sql_run'])
116 echo "<span class=text>".xl('DB installed')."</span>";
118 echo "<a class=link_submit href='./forms_admin.php?id={$registry['id']}&method=install_db'$formtarget>".xl('install DB')."</a>";
122 echo "<td><input type=text size=4 name=priority_".$registry['id']." value='".$priority_category['priority']."'></td>";
123 echo "<td><input type=text size=8 name=category_".$registry['id']." value='".$priority_category['category']."'></td>";
124 echo "<td><input type=text size=8 name=nickname_".$registry['id']." value='".$priority_category['nickname']."'></td>";
128 if ($color=="#CCCCCC")
137 <?php
//UNREGISTERED SECTION ?>
138 <span
class=bold
><?php
xl('Unregistered','e');?
></span
><br
>
139 <table border
=0 cellpadding
=1 cellspacing
=2 width
="500">
141 $dpath = "$srcdir/../interface/forms/";
142 $dp = opendir($dpath);
144 for ($i=0; false != ($fname = readdir($dp)); $i++
)
145 if ($fname != "." && $fname != ".." && $fname != "CVS" && $fname != "LBF" &&
146 (is_dir($dpath.$fname) ||
stristr($fname, ".tar.gz") ||
147 stristr($fname, ".tar") ||
stristr($fname, ".zip") ||
148 stristr($fname, ".gz")))
151 // ballards 11/05/2005 fixed bug in removing registered form from the list
152 if ($bigdata != false)
154 foreach ( $bigdata as $registry )
156 $key = array_search($registry['directory'], $inDir) ; /* returns integer or FALSE */
161 foreach ( $inDir as $fname )
163 // added 8-2009 by BM - do not show the metric vitals form as option since deprecated
164 // also added a toggle in globals.php in case user wants the option to add this deprecated form
165 if (($fname == "vitalsM") && ($GLOBALS['disable_deprecated_metrics_form'])) continue;
167 if (stristr($fname, ".tar.gz") ||
stristr($fname, ".tar") ||
stristr($fname, ".zip") ||
stristr($fname, ".gz"))
168 $phpState = "PHP compressed";
170 $phpState = "PHP extracted";
173 <td bgcolor
="<?php echo $color?>" width
="1%">
174 <span
class=text
> </span
>
176 <td bgcolor
="<?php echo $color?>" width
="20%">
178 $form_title_file = @file
($GLOBALS['srcdir']."/../interface/forms/$fname/info.txt");
179 if ($form_title_file)
180 $form_title = $form_title_file[0];
182 $form_title = $fname;
184 <span
class=bold
><?php
echo xl_form_title($form_title); ?
></span
>
186 <td bgcolor
="<?php echo $color?>" width
="10%"><?php
187 if ($phpState == "PHP extracted")
188 echo '<a class=link_submit href="./forms_admin.php?name=' . urlencode($fname) . '&method=register"' . $formtarget . '>' . xl('register') . '</a>';
190 echo '<span class=text>' . xl('n/a') . '</span>';
192 <td bgcolor
="<?php echo $color?>" width
="20%">
193 <span
class=text
><?php
echo xl($phpState); ?
></span
>
195 <td bgcolor
="<?php echo $color?>" width
="10%">
196 <span
class=text
><?php
xl('n/a','e'); ?
></span
>
200 if ($color=="#CCCCCC")