Menu

[r28]: / src / elements / list.cs  Maximize  Restore  History

Download this file

296 lines (289 with data), 13.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
#function generate_list project table_id link part
#query select name as application from `project` where project=?project?
#query select name as tablename, `sql` as tablesql, title as tabletitle, `where`, id_field, width as tablewidth, height as tableheight from `table` where `table`=?table_id?
#set orderfield='0'
#query select `field` as orderfield, `name` as ordername from `field` where `table`=?table_id? and `Type`='ordering'
#print '<?php\n'
#print 'if ($_GET[order'^table_id^']<>\'\') {\n'
#print ' $sql->QueryItem(\"DELETE FROM user_selection WHERE user=$user_ID and field=\'sort_' ^table_id^ '\'\");\n'
#print ' $sql->QueryItem(\"INSERT INTO user_selection VALUES (\'$user_ID\', \'sort_' ^table_id^ '\',\'$_GET[order'^table_id^']\'\");\n'
#print '}\n'
#print '$lastorder=$_SESSION[last_'^table_id^'];\n'
#print '$lastfilter'^table_id^'=$_SESSION[filter'^table_id^'];\n'
#print '$_SESSION[last_'^table_id^']=\'\';\n'
#print 'if ($_GET[filter' ^table_id^']) { $filter' ^table_id^' =$_GET[filter'^table_id^']; } else { $filter'^table_id^'=$_POST[filter'^table_id^'];}\n'
#print 'if ($_GET[page'^table_id^']) { $page=$_GET[page'^table_id^']; } else { $page=$_POST[page'^table_id^']; }\n'
#print 'if ($filter'^table_id^'!=$lastfilter'^table_id^') {\n'
#print ' $_SESSION[filter'^table_id^']=$filter'^table_id^';\n'
#print ' $page=0;\n'
#print '}\n'
#print 'if ($_GET[full_'^table_id^']==\'Fullpage\') {\n'
#print ' $_SESSION[fullpage_' ^ table_id ^ ']=\'f\';\n'
#print '}\n'
#print 'if ($_GET[full_'^table_id^']==\'Pages\') {\n'
#print ' $_SESSION[fullpage_' ^ table_id ^ ']=\'\';\n'
#print '}\n'
#print 'if ($filter'^table_id^'!=\'\')\n'
#print '{\n'
#print '$qfilter'^table_id^' = quote(\'%\'.$filter'^table_id^'.\'%\');\n'
#set tests=''
#record select field.sql as fieldsql, SessionVar from `field` where `table`=?table_id? and SessionVar<>'' and field.name<>?id_field? and field.name<>'' AND link_table='' order by `order`
#set tests=tests ^ ' AND `' ^ tablesql ^ '`.`' ^ fieldsql ^ '`=\'$' ^ SessionVar ^ '\''
#end
#if where <> ''
#set tests=tests ^ ' AND ' ^ where
#end
#print '$query = (\"\n'
#print 'FROM `' ^ tablesql ^ '`\n'
#record select field, `Add`, field.sql as fieldsql, `Type`, title, width, height, link_table, link_field, link_display from `field` where `table`=?table_id? and List='true' and link_table<>'' and link_display<>'' order by `order`
#print 'LEFT JOIN `' ^ link_table ^ '` AS T' ^ field ^ ' ON ' ^ tablesql ^ '.' ^ fieldsql ^ '=T' ^ field ^ '.' ^ link_field ^ '\n'
#end
#set first=true
#record select field, `Add`, field.sql as fieldsql, `Type`, title, width, height, link_table, link_field, link_display from `field` where `table`=?table_id? and (`Type`='varchar' or `Type`='int') and List='true' order by `order`
#if link_table='' or link_display=''
#if first
#set first=false
#print 'WHERE (' ^ (if link_table='' then tablesql else 'T' ^ field) ^ '.`' ^ fieldsql ^ '` LIKE $qfilter'^table_id^'\n'
#else
#print 'OR ' ^ (if link_table='' then tablesql else 'T' ^ field) ^ '.`' ^ fieldsql ^ '` LIKE $qfilter'^table_id^'\n'
#end
#else
#if first
#set first=false
#print 'WHERE (' ^ multiply ('T' ^ field) link_display (' LIKE $qfilter'^table_id^'\n')
#else
#print 'OR ' ^ multiply ('T' ^ field) link_display (' LIKE $qfilter'^table_id^'\n')
#end
#end
#end
#print ')' ^ tests ^ ' \n'
#print ' \");\n'
#print '}\n'
#print 'else\n'
#print '{\n'
#print '$query = (\" \n'
#print 'FROM `' ^ tablesql ^ '`\n'
#record select field, `Add`, field.sql as fieldsql, `Type`, title, width, height, link_table, link_field, link_display from `field` where `table`=?table_id? and List='true' and link_table<>'' and link_display<>'' order by `order`
#print 'LEFT JOIN `' ^ link_table ^ '` AS T' ^ field ^ ' ON ' ^ tablesql ^ '.' ^ fieldsql ^ '=T' ^ field ^ '.' ^ link_field ^ '\n'
#end
#print 'WHERE 1' ^ tests ^ '\n'
#print '\");\n'
#print '}\n'
#print '$lastrec=-1;\n'
#print '$sql->QueryItem(\"SELECT COUNT(*) AS records$query\");\n'
#print '$records=$sql->data[records];\n'
#print '$sortorder=$sql->QueryItem(\"SELECT value FROM user_selection WHERE user=$user_ID and field=\'sort_' ^table_id^ '\'\");\n'
#print 'if ($lastorder==\'\') {$fromrec=20*$page;} else {\n'
#set first=true
#record select table_order, name from table_order where `table`=?table_id? order by `order`
#if first
#print 'if ($sortorder==\'\' || $sortorder==\'' ^ table_order ^ '\') {\n'
#set first=false
#else
#print 'if ($sortorder==\'' ^ table_order ^ '\') {\n'
#end
#print ' $sql->QueryItem(\"SELECT COUNT(*) AS fromrec$query AND CONCAT('
#set first2=true
#record select table.sql as tsql, field.sql as fsql from table_ofield inner join `field` on field.field=table_ofield.field inner join `table` on field.table=table.table where table_order=?table_order? order by table_ofield.order
#if first2
#set first2=false
#else
#print ',\'/\','
#end
#print tsql ^ '.' ^ fsql
#end
#print ') < $lastorder\");\n'
#print '}\n'
#end
#print '$fromrec=$sql->data[fromrec]-10;\n'
#print 'if($fromrec<0) {$fromrec=0; }\n'
#print '$lastrec=$sql->data[fromrec]-$fromrec;\n'
#print '}\n'
#print '$sql->Query(\"SELECT '
#set first=true
#record select field, `Record`, field.sql as fieldsql, `Type`, title, width, SessionVar, height, link_table, link_field, link_display from `field` where `table`=?table_id? and (List='true' or (SessionVar<>'' and link_table='')) and field.sql<>'' order by `order`
#if not first
#print ', '
#end
#if link_display=''
#print tablesql ^ '.' ^ fieldsql ^ ' as F' ^ field
#else
#if SessionVar<>''
#print tablesql ^ '.' ^ fieldsql ^ ' as F' ^ field ^ ', '
#end
#print queryvars ('T' ^ field) link_display field 1
#end
#set first=false
#end
#print '$query\".\n'
#set first=true
#record select table_order, name from table_order where `table`=?table_id? order by `order`
#if first
#print ' (($sortorder==\'\' || $sortorder==\'' ^ table_order ^ '\')?\"'
#set first=false
#else
#print '\":\'\').\n'
#print ' (($sortorder==\'' ^ table_order ^ '\')?\"'
#end
#set first2=true
#record select field as ofield from table_ofield where table_order=?table_order? order by table_ofield.order
#if first2
#set first2=false
#print ' ORDER BY '
#else
#print ','
#end
#print ofield
#end
#end
#if not first
#print ' \":\'\').'
#end
#print '($_SESSION[fullpage_'^table_id^']==\'\'?\"LIMIT $fromrec, 20\":\'\'));\n'
#print 'if (' ^ check_off part 'nofilter' ^ ') {\n'
#print 'echo \"<form action=\\\"\\\" method=get name=Filter'^table_id^'>\";\n'
#print 'echo \"<p class=filter>\";\n'
#print 'echo \"Records: $records \";\n'
#print '$maxpage=(int) (($records+19)/20);\n'
#print 'if ($maxpage>1) {\n'
#print ' if ($_SESSION[fullpage_'^table_id^']==\'\') {\n'
#print ' echo \"Page: \";\n'
#print ' echo \"<select name=\\\"page'^table_id^'\\\" OnChange=\\\"Filter'^table_id^'.submit();\\\">\\n\";\n'
#print ' for ($i = 0; $i < $maxpage; $i++)\n'
#print ' {\n'
#print ' $nr=$i+1;\n'
#print ' if ($i==$page) {$sel=\" selected\";} else {$sel=\"\";}\n'
#print ' echo \"<option value=$i$sel>$nr van $maxpage</option>\\n\";\n'
#print ' }\n'
#print ' echo \"</select>\\n\";\n'
#print ' echo \"<input type=submit name=full_'^table_id^' value=\\\"Fullpage\\\">\";\n'
#print ' } else {\n'
#print ' echo \"<input type=submit name=full_'^table_id^' value=\\\"Pages\\\">\";\n'
#print ' }\n'
#print '}\n'
#print 'echo \"<input type=text name=\\\"filter'^table_id^'\\\" size=25 value=\\\"$filter'^table_id^'\\\">\";\n'
#print 'echo \"<input type=submit value=\\\"Search\\\">\";\n'
#query select count(*) as orderings from table_order where `table`=?table_id?
#if orderings>'1'
#print 'echo \"<select name=\\\"order' ^ table_id ^ '\\\" OnChange=\\\"Filer'^table_id^'.submit();\\\">\\n\";\n'
#record select table_order, name from table_order order by `order`
#print 'echo \"<option value=' ^ table_order ^'\".($sortorder==\'' ^ table_order ^'\'?\" selected\":\'\').\">' ^ name ^ '</option>\\n\";\n'
#end
#print 'echo \"</select>\\n\";\n'
#end
#set sesvars=''
#record select field, `List`, field.sql as fieldsql, `Type`, title, SessionVar, height, width, link_table, link_field, link_display from `field` where `table`=?table_id? and field.sql<>'' order by `order`
#if SessionVar<>''
#if sesvars<>''
#set sesvars=sesvars ^ '&'
#end
#set sesvars=sesvars ^ SessionVar ^ '=$' ^ fieldsql
#end
#end
#query select count(*) as fields from `field` where `table`=?table_id? and Record <>'none' and `Add`='true' and title<>''
#if fields>'0'
#print 'echo \"<input type=button value=\\\"Add ' ^ tabletitle ^ '\\\" onClick=\\\"javascript: window.open(\'add' ^ tablename ^ '.php?' ^ sesvars ^ '\',\'\',\'width=' ^ tablewidth ^ ',height=' ^ tableheight ^ ',location=no,menubar=no,scrollbars=yes,status=no,resizable=yes\'); return false;\\\">\";\n'
#end
#print 'echo \"</p>\";\n'
#print 'echo \"</form>\";\n'
#print '}\n'
#print '?>\n'
#print '<table class=list>\n'
#print '<tr>\n'
#if orderfield<>'0'
#print '<th></th>\n'
#end
#record select `List`, field.sql as fieldsql, `Type`, title, width * 7 as width, height, link_table, link_field, link_display from `field` where `table`=?table_id? and List='true' order by `order`
#print '<th width=' ^ width ^ 'px>' ^ title ^ '</th>\n'
#end
#print '</tr>\n'
#print '<?php\n'
#print 'for ($i = 0; $i < $sql->rows; $i++)\n'
#print '{\n'
#print ' $sql->Fetch($i);\n'
#set expr=''
#record select field, `List`, name as internname, field.sql as fieldsql, `Type`, title, width, SessionVar, height, link_table, link_field, link_display from `field` where `table`=?table_id? and field.sql<>'' order by `order`
#if SessionVar<>''
#if fieldsql=id_field
#print ' $' ^ id_field ^ ' = $sql->data[\'F' ^ field ^ '\'];\n'
#end
#end
#if List='true'
#if link_display='' or Type='enum'
#if Type='date'
#print ' preg_match (\'/^(\d+)-0?(\d+)-0?(\d+)$/\', $sql->data[\'F' ^ field ^ '\'], $matches);\n'
#print ' $' ^ internname ^ ' = htmlspecialchars(\"$matches[3]/$matches[2]/$matches[1]\");\n'
#else
#print ' $' ^ internname ^ ' = htmlspecialchars($sql->data[\'F' ^ field ^ '\']);\n'
#end
#else
#if SessionVar<>''
#print ' $' ^ internname ^ ' = htmlspecialchars($sql->data[\'F' ^ field ^ '\']);\n'
#end
#set getvars=''
#set expr=fieldreplace link_display field
#print getvars
#print ' $' ^ internname ^ '_lup = \"' ^ expr ^ '\";\n'
#end
#end
#end
#print ' if ($lastrec==$i) {$color=\"style=\\\"background-color: #aaaaff;\\\"\";} else {$color=\"\";}\n'
#print ' echo (\"\n'
#if link=''
#print '<tr $color onMouseOver=\\"ChangeColor(this)\\" onMouseOut=\\"ChangeColorBack(this)\\" onClick=\\"window.open(\'edit' ^ tablename ^ '.php?' ^ sesvars ^ '\',\'wijzigen\',\'width=' ^ tablewidth ^ ',height=' ^ tableheight ^ ',location=no,menubar=no,scrollbars=yes,status=no,resizable=yes\')\\">\n'
#else
#print '<tr $color onMouseOver=\\"ChangeColor(this)\\" onMouseOut=\\"ChangeColorBack(this)\\" onClick=\\"location=\'' ^ link ^ '?' ^ sesvars ^ '\'\\">\n'
#end
#if orderfield<>'0'
#print '<td onClick=\\"window.open(\'add' ^ tablename ^ '.php?' ^ ordername ^ '=$' ^ ordername ^ '\',\'add\',\'width=' ^ tablewidth ^ ',height=' ^ tableheight ^ ',location=no,menubar=no,scrollbars=yes,status=no,resizable=yes\'); no_bubble(event);\\"><b>Add</b></td>\n'
#end
#record select `List`, field.sql as fieldsql, name as internname, `Type`, title, width, height, link_table, link_field, link_display from `field` where field.`table`=?table_id? and List='true' order by `order`
#print '<td>$' ^ internname^ (if link_display<>'' then '_lup' else '') ^ '</td>\n'
#end
#print '</tr>\");\n'
#print '}\n'
#print '?>\n'
#print '</table>\n'
#end
#function rights_list project table_id link part
#query select name as application from `project` where project=?project?
#query select name as tablename, `sql` as tablesql, title as tabletitle, id_field, width as tablewidth, height as tableheight from `table` where `table`=?table_id?
#print '<p class=filter>\n'
#print 'Records: #\n'
#print 'Pagina: #\n'
#print part_rights_link part 'listall'
#print part_rights_link part 'nofilter'
#print '</p>\n'
#print '<table class=list>\n'
#print '<tr>\n'
#record select `List`, field.sql as fieldsql, `Type`, title, width * 7 as width, height, link_table, link_field, link_display from `field` where field.`table`=?table_id? and List='true' order by `order`
#print '<th width=' ^ width ^ 'px>' ^ title ^ '</th>\n'
#end
#print '</tr>\n'
#print '<tr>\n'
#record select field, `List`, field.sql as fieldsql, `Type`, title, width, height, link_table, link_field, link_display from `field` where field.`table`=?table_id? and List='true' order by `order`
#print '<td>'
#print field_rights_link field 'hide'
#print '</td>\n'
#end
#print '</tr>\n'
#if link=''
#print '<tr onMouseOver=\"ChangeColor(this)\" onMouseOut=\"ChangeColorBack(this)\" onClick=\"window.open(\'rightsedit' ^ tablename ^ '.php\',\'wijzigen\',\'width=' ^ tablewidth ^ ',height=' ^ tableheight ^ ',location=no,menubar=no,scrollbars=yes,status=no,resizable=yes\')\">\n'
#else
#print '<tr onMouseOver=\"ChangeColor(this)\" onMouseOut=\"ChangeColorBack(this)\" onClick=\"location=\'rights_' ^ link ^'\'\">\n'
#end
#record select field, `List`, field.sql as fieldsql, `Type`, title, width, height, link_table, link_field, link_display from `field` where field.`table`=?table_id? and List='true' order by `order`
#print '<td>data</td>\n'
#end
#print '<tr><td>'
#print part_rights_link part 'hide'
#print '</td>'
#print '<td>'
#print part_rights_link part 'noedit'
#print '</td>'
#print '<td>'
#print part_rights_link part 'noadd'
#print '</td>'
#print '</tr>'
#print '</table>\n'
#end
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.