@@ 840-901 (lines=62) @@ | ||
837 | $attrs = $data->getTableAttributes($_REQUEST['table']); |
|
838 | ||
839 | echo '<form action="'.\SUBFOLDER.'/src/views/tables" method="post" id="selectform">'.PHP_EOL; |
|
840 | if ($attrs->recordCount() > 0) { |
|
841 | // JavaScript for select all feature |
|
842 | echo '<script type="text/javascript">'.PHP_EOL; |
|
843 | echo "//<![CDATA[\n"; |
|
844 | echo " function selectAll() {\n"; |
|
845 | echo " for (var i=0; i<document.getElementById('selectform').elements.length; i++) {\n"; |
|
846 | echo " var e = document.getElementById('selectform').elements[i];\n"; |
|
847 | echo " if (e.name.indexOf('show') == 0) e.checked = document.getElementById('selectform').selectall.checked;\n"; |
|
848 | echo " }\n"; |
|
849 | echo " }\n"; |
|
850 | echo '//]]>'.PHP_EOL; |
|
851 | echo '</script>'.PHP_EOL; |
|
852 | ||
853 | echo '<table>'.PHP_EOL; |
|
854 | ||
855 | // Output table header |
|
856 | echo "<tr><th class=\"data\">{$this->lang['strshow']}</th><th class=\"data\">{$this->lang['strcolumn']}</th>"; |
|
857 | echo "<th class=\"data\">{$this->lang['strtype']}</th><th class=\"data\">{$this->lang['stroperator']}</th>"; |
|
858 | echo "<th class=\"data\">{$this->lang['strvalue']}</th></tr>"; |
|
859 | ||
860 | $i = 0; |
|
861 | while (!$attrs->EOF) { |
|
862 | $attrs->fields['attnotnull'] = $data->phpBool($attrs->fields['attnotnull']); |
|
863 | // Set up default value if there isn't one already |
|
864 | if (!isset($_REQUEST['values'][$attrs->fields['attname']])) { |
|
865 | $_REQUEST['values'][$attrs->fields['attname']] = null; |
|
866 | } |
|
867 | ||
868 | if (!isset($_REQUEST['ops'][$attrs->fields['attname']])) { |
|
869 | $_REQUEST['ops'][$attrs->fields['attname']] = null; |
|
870 | } |
|
871 | ||
872 | // Continue drawing row |
|
873 | $id = (0 == ($i % 2) ? '1' : '2'); |
|
874 | echo "<tr class=\"data{$id}\">".PHP_EOL; |
|
875 | echo '<td style="white-space:nowrap;">'; |
|
876 | echo '<input type="checkbox" name="show[', htmlspecialchars($attrs->fields['attname']), ']"', |
|
877 | isset($_REQUEST['show'][$attrs->fields['attname']]) ? ' checked="checked"' : '', ' /></td>'; |
|
878 | echo '<td style="white-space:nowrap;">', $this->misc->printVal($attrs->fields['attname']), '</td>'; |
|
879 | echo '<td style="white-space:nowrap;">', $this->misc->printVal($data->formatType($attrs->fields['type'], $attrs->fields['atttypmod'])), '</td>'; |
|
880 | echo '<td style="white-space:nowrap;">'; |
|
881 | echo "<select name=\"ops[{$attrs->fields['attname']}]\">".PHP_EOL; |
|
882 | foreach (array_keys($data->selectOps) as $v) { |
|
883 | echo '<option value="', htmlspecialchars($v), '"', ($_REQUEST['ops'][$attrs->fields['attname']] == $v) ? ' selected="selected"' : '', |
|
884 | '>', htmlspecialchars($v), '</option>'.PHP_EOL; |
|
885 | } |
|
886 | echo "</select>\n</td>".PHP_EOL; |
|
887 | echo '<td style="white-space:nowrap;">', $data->printField( |
|
888 | "values[{$attrs->fields['attname']}]", |
|
889 | $_REQUEST['values'][$attrs->fields['attname']], |
|
890 | $attrs->fields['type'] |
|
891 | ), '</td>'; |
|
892 | echo '</tr>'.PHP_EOL; |
|
893 | ++$i; |
|
894 | $attrs->moveNext(); |
|
895 | } |
|
896 | // Select all checkbox |
|
897 | echo "<tr><td colspan=\"5\"><input type=\"checkbox\" id=\"selectall\" name=\"selectall\" accesskey=\"a\" onclick=\"javascript:selectAll()\" /><label for=\"selectall\">{$this->lang['strselectallfields']}</label></td>"; |
|
898 | echo '</tr></table>'.PHP_EOL; |
|
899 | } else { |
|
900 | echo "<p>{$this->lang['strinvalidparam']}</p>".PHP_EOL; |
|
901 | } |
|
902 | ||
903 | echo '<p><input type="hidden" name="action" value="selectrows" />'.PHP_EOL; |
|
904 | echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), '" />'.PHP_EOL; |
@@ 68-131 (lines=64) @@ | ||
65 | echo '<form action="'.\SUBFOLDER.'/src/views/'.$this->script.'" method="post" id="selectform">'; |
|
66 | echo PHP_EOL; |
|
67 | ||
68 | if ($attrs->recordCount() > 0) { |
|
69 | // JavaScript for select all feature |
|
70 | echo '<script type="text/javascript">'.PHP_EOL; |
|
71 | echo "//<![CDATA[\n"; |
|
72 | echo " function selectAll() {\n"; |
|
73 | echo " for (var i=0; i<document.getElementById('selectform').elements.length; i++) {\n"; |
|
74 | echo " var e = document.getElementById('selectform').elements[i];\n"; |
|
75 | echo " if (e.name.indexOf('show') == 0) { \n "; |
|
76 | echo " e.checked = document.getElementById('selectform').selectall.checked;\n"; |
|
77 | echo " }\n"; |
|
78 | echo " }\n"; |
|
79 | echo " }\n"; |
|
80 | echo '//]]>'.PHP_EOL; |
|
81 | echo '</script>'.PHP_EOL; |
|
82 | ||
83 | echo '<table>'.PHP_EOL; |
|
84 | ||
85 | // Output table header |
|
86 | echo "<tr><th class=\"data\">{$this->lang['strshow']}</th><th class=\"data\">{$this->lang['strcolumn']}</th>"; |
|
87 | echo "<th class=\"data\">{$this->lang['strtype']}</th><th class=\"data\">{$this->lang['stroperator']}</th>"; |
|
88 | echo "<th class=\"data\">{$this->lang['strvalue']}</th></tr>"; |
|
89 | ||
90 | $i = 0; |
|
91 | while (!$attrs->EOF) { |
|
92 | $attrs->fields['attnotnull'] = $data->phpBool($attrs->fields['attnotnull']); |
|
93 | // Set up default value if there isn't one already |
|
94 | if (!isset($_REQUEST['values'][$attrs->fields['attname']])) { |
|
95 | $_REQUEST['values'][$attrs->fields['attname']] = null; |
|
96 | } |
|
97 | ||
98 | if (!isset($_REQUEST['ops'][$attrs->fields['attname']])) { |
|
99 | $_REQUEST['ops'][$attrs->fields['attname']] = null; |
|
100 | } |
|
101 | ||
102 | // Continue drawing row |
|
103 | $id = (0 == ($i % 2) ? '1' : '2'); |
|
104 | echo "<tr class=\"data{$id}\">".PHP_EOL; |
|
105 | echo '<td style="white-space:nowrap;">'; |
|
106 | echo '<input type="checkbox" name="show[', htmlspecialchars($attrs->fields['attname']), ']"', |
|
107 | isset($_REQUEST['show'][$attrs->fields['attname']]) ? ' checked="checked"' : '', ' /></td>'; |
|
108 | echo '<td style="white-space:nowrap;">', $this->misc->printVal($attrs->fields['attname']), '</td>'; |
|
109 | echo '<td style="white-space:nowrap;">', $this->misc->printVal($data->formatType($attrs->fields['type'], $attrs->fields['atttypmod'])), '</td>'; |
|
110 | echo '<td style="white-space:nowrap;">'; |
|
111 | echo "<select name=\"ops[{$attrs->fields['attname']}]\">".PHP_EOL; |
|
112 | foreach (array_keys($data->selectOps) as $v) { |
|
113 | echo '<option value="', htmlspecialchars($v), '"', ($_REQUEST['ops'][$attrs->fields['attname']] == $v) ? ' selected="selected"' : '', |
|
114 | '>', htmlspecialchars($v), '</option>'.PHP_EOL; |
|
115 | } |
|
116 | echo '</select></td>'.PHP_EOL; |
|
117 | echo '<td style="white-space:nowrap;">', $data->printField( |
|
118 | "values[{$attrs->fields['attname']}]", |
|
119 | $_REQUEST['values'][$attrs->fields['attname']], |
|
120 | $attrs->fields['type'] |
|
121 | ), '</td>'; |
|
122 | echo '</tr>'.PHP_EOL; |
|
123 | ++$i; |
|
124 | $attrs->moveNext(); |
|
125 | } |
|
126 | // Select all checkbox |
|
127 | echo "<tr><td colspan=\"5\"><input type=\"checkbox\" id=\"selectall\" name=\"selectall\" accesskey=\"a\" onclick=\"javascript:selectAll()\" /><label for=\"selectall\">{$this->lang['strselectallfields']}</label></td></tr>"; |
|
128 | echo '</table>'.PHP_EOL; |
|
129 | } else { |
|
130 | echo "<p>{$this->lang['strinvalidparam']}</p>".PHP_EOL; |
|
131 | } |
|
132 | ||
133 | echo '<p><input type="hidden" name="action" value="selectrows" />'.PHP_EOL; |
|
134 | echo '<input type="hidden" name="view" value="', htmlspecialchars($_REQUEST[$this->keystring]), '" />'.PHP_EOL; |