Menu

[r16]: / src / screens / edit.cs  Maximize  Restore  History

Download this file

486 lines (466 with data), 21.0 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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
#function edit_php dbase_id table_id
#query select DatabaseName from `database` where DatabaseID=?dbase_id?
#query select TableID, Subject, TableName, Title, Checks, Session, IDfield from `tables` where TableID=?table_id?
#print page_header 'edit' dbase_id table_id
#print '<?php\n'
#record select Code from actions where TableID=?table_id? and Action='edit' and Part='session'
#print Code ^ '\n'
#end
#set tests=''
#record select FieldName, SessionVar from `fields` where TableID=?table_id? and SessionVar<>'' and FieldName<>'' order by `order`
#if tests=''
#set tests=' WHERE '
#else
#set tests=tests ^ ' AND '
#end
#set tests=tests ^ TableName ^ '.' ^ FieldName ^ '=\'$' ^ SessionVar ^ '\''
#end
#record select fieldID, `Add`, Name, FieldName, `Type`, DisplayName, DisplayLength, Help, areaheight, areawidth, LookupTable, OrderByField, LookupIDField, SessionVar, LookupDisplayField from `fields` where TableID=?table_id? and LookupTable<>'' and (Record='show' or Edit='show' or DisplayName='') order by `order`
#print '$sql->QueryItem(\"SELECT ' ^ queryvars ('T' ^ fieldID) LookupDisplayField fieldID 1 ^ ' FROM `' ^ LookupTable ^ '` as T' ^ fieldID ^ ' WHERE `' ^ LookupIDField ^ '` = $' ^ SessionVar ^ '\");\n'
#set getvars=''
#set expr=fieldreplace LookupDisplayField fieldID
#print getvars
#print ' $' ^ Name ^ '_lup = \"' ^ expr ^ '\";\n'
#end
#print '$sql->QueryItem(\"SELECT '
#set first=true
#record select fieldID, `Record`, FieldName, `Type`, DisplayName, DisplayLength, SessionVar, Help, areaheight, areawidth, ListWidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and FieldName<>'' and SessionVar='' order by `order`
#if not first
#print ', '
#end
# if LookupDisplayField=''
#print TableName ^ '.' ^ FieldName ^ ' as F' ^ fieldID
# else
# print queryvars ('T' ^ fieldID) LookupDisplayField fieldID 1
# end
#set first=false
#end
#print ' FROM `' ^ TableName ^ '` ' ^ tests ^ '\");\n'
#set first=true
#record select fieldID, Name, FieldName, `Type`, DisplayName, DisplayLength, areaheight, areawidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and FieldName<>'' and SessionVar='' order by `order`
#if Type='varchar' or Type='text'
#print '$' ^ Name ^ ' = $sql->data[\'F' ^ fieldID ^ '\'];\n'
#else
#if Type='password'
#print '$' ^ Name ^ ' = \'\';\n'
#else
#if Type='date'
#print 'preg_match (\'/^(\d+)-0?(\d+)-0?(\d+)$/\', $sql->data[\'F' ^ fieldID ^ '\'], $matches);\n'
#print '$' ^ Name ^ '=\"$matches[3]/$matches[2]/$matches[1]\";\n'
#else
#print '$' ^ Name ^ ' = $sql->data[\'F' ^ fieldID ^ '\'];\n'
#end
#end
#end
#end
#print 'if ($_POST[\'' ^ IDfield ^ '\']!=\'\') {\n'
#record select Name, FieldName, `Type`, DisplayName, DisplayLength, areaheight, areawidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and Record<>'none' and FieldName<>'' order by `order`
#if Type='varchar' or Type='text'
#print ' $' ^ Name ^ ' = ($_POST[\'' ^ FieldName ^ '\']);\n'
#else
#if Type='password'
#print '$' ^ Name ^ ' = \'\';\n'
#else
#if Type='date'
#print '$' ^ Name ^ ' = date(\'j/n/Y\', strtotime($_POST[\'' ^ FieldName ^ '\']));\n'
#else
#print '$' ^ Name ^ ' = $_POST[\'' ^ FieldName ^ '\'];\n'
#end
#end
#end
#end
#print '}\n'
#print '?>\n'
#print '<HTML>\n'
#print '<HEAD>\n'
#print ' <META HTTP-EQUIV=\"CONTENT-TYPE\" CONTENT=\"text/html; charset=windows-1252\">\n'
#print ' <TITLE>' ^ Title ^ ' wijzigen</TITLE>\n'
#print '<script>\n'
#print 'function confirmDelete(delUrl) {\n'
#print ' if (confirm(\"' ^ Title ^ ' verwijderen?\")) {\n'
#print ' document.location = delUrl;\n'
#print ' }\n'
#print '}\n'
#print '</script>\n'
#print '</HEAD>\n'
#print '<BODY LANG=\"en-US\" DIR=\"LTR\">\n'
#print '<FORM NAME=\"Edit\" ACTION=\"postedit' ^ Subject ^ '.php\" METHOD=POST>\n'
#print '<?php echo(\"<INPUT TYPE=HIDDEN NAME=\\"' ^ IDfield ^ '\\" SIZE=5 VALUE=\\"$' ^ IDfield ^ '\\">\");?>\n'
#print '<TABLE WIDTH=100% BORDER=0 CELLPADDING=4 CELLSPACING=1>\n'
#print ' <THEAD>\n'
#print ' <TR>\n'
#print ' <TD COLSPAN=2 WIDTH=100% VALIGN=TOP BGCOLOR=\"#000080\">\n'
#print ' <P><FONT COLOR=\"#ffffff\"><FONT FACE=\"Verdana, sans-serif\"><FONT SIZE=1 STYLE=\"font-size: 8pt\">'
#print '<B>' ^ Title ^ ' wijzigen\n'
#print ' </B></FONT></FONT></FONT></P>\n'
#print ' </TD>\n'
#print ' </TR>\n'
#print ' </THEAD>\n'
#print ' <TBODY>\n'
#record select FieldID, `Record`, `Edit`, FieldName, Name, `Type`, DisplayName, SessionVar, Help, AreaHeight, ListWidth*7 as pxwidth, ListWidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField, `default` from `fields` where TableID=?table_id? and FieldName<>'' and Record<>'none' and `Edit`<>'false' order by `order`
#if SessionVar<>''
#print ' <INPUT TYPE=HIDDEN NAME=\"' ^ SessionVar ^ '\" VALUE=\"<?php echo $' ^ SessionVar ^ '; ?>\">\n'
#end
#if Record='show' or Edit='show'
#print ' <TR VALIGN=TOP>\n'
#print ' <TD WIDTH=20% BGCOLOR=\"#e6e6ff\">\n'
#print ' <FONT COLOR=\"#000080\" FACE=\"Verdana, sans-serif\" STYLE=\"font-size: 8pt\">\n'
#print ' ' ^ DisplayName ^'\n'
#print ' </FONT>\n'
#print ' </TD>\n'
#print ' <TD WIDTH=80%>\n'
#print ' <FONT COLOR=\"#000080\" FACE=\"Verdana, sans-serif\" STYLE=\"font-size: 10pt\">\n'
#print ' <?php echo ($' ^ Name ^ (if LookupTable<>'' then '_lup' else '') ^ '); ?>\n'
#print ' </FONT>\n'
#print ' </TD>\n'
#end
#if Record<>'show' and Edit<>'show'
#print ' <TR VALIGN=TOP>\n'
#print ' <TD WIDTH=20% BGCOLOR=\"#e6e6ff\">\n'
#print ' <FONT COLOR=\"#000080\" FACE=\"Verdana, sans-serif\" STYLE=\"font-size: 8pt\">\n'
#print ' ' ^ DisplayName ^'\n'
#print ' </FONT>\n'
#print ' </TD>\n'
#print ' <TD WIDTH=80%>\n'
#print ' <P><FONT COLOR=\"#000080\"><FONT FACE=\"Verdana, sans-serif\"><FONT SIZE=1 STYLE=\"font-size: 8pt\">\n'
#if LookupTable<>''
#print ' <?php\n'
#if pxwidth<>'0'
#print ' echo (\"<SELECT NAME=\\\"' ^ FieldName ^ '\\\" STYLE=\\\"width: ' ^ pxwidth ^ 'px\\\" OnChange=\\\"Edit.action=\'\'; Edit.submit();\\\">\");\n'
#else
#print ' echo (\"<SELECT NAME=\\\"' ^ FieldName ^ '\\\" OnChange=\\\"Edit.action=\'\'; Edit.submit();\\\">\");\n'
#end
#if default='<empty>'
#print ' echo \"<OPTION VALUE=\\\"\\\"></OPTION>\";\n'
#end
#if LookupDisplayField=''
#print ' $sql->Query(\"' ^ LookupTable ^ '\");\n'
#else
#print ' $sql->Query(\"SELECT '
#print queryvars '' LookupDisplayField '0' 1 ^ ', `' ^ LookupTable ^ '`.' ^ LookupIDField
#print ' FROM `' ^ LookupTable ^'` '
#set wcheck=''
#query select Checks as wcheck from `tables` where databaseID=?dbase_id? and TableName=?LookupTable?
#if wcheck<>''
#print ' \n WHERE ' ^ fieldreplace wcheck '0' ^ '\n'
#end
#print ' ORDER BY `' ^ LookupTable ^ '`.' ^ OrderByField ^ ' ASC\");\n'
#end
#print ' for ($i = 0; $i < $sql->rows; $i++)\n'
#print ' {\n'
#print ' $sql->Fetch($i);\n'
#print ' $opzoekID = $sql->data[' ^ LookupIDField ^ '];\n'
#if LookupDisplayField=''
#print ' $opzoekweergave = $opzoekID;\n'
#else
#set expr=fieldreplace LookupDisplayField '0'
#print getvars
#print ' $opzoekweergave = \"' ^ expr ^ '\";\n'
#end
#print ' echo (\"<OPTION \");\n'
#print ' if ($opzoekID == $' ^ Name ^') {echo \"SELECTED \";};\n'
#print ' echo \"VALUE=\\\"$opzoekID\\\">$opzoekweergave\";\n'
#print ' }\n'
#print ' echo (\"</SELECT>\");\n'
#print ' ?>\n'
#else
#if Type='enum'
#print ' <?php\n'
#if pxwidth<>'0'
#print ' echo (\"<SELECT NAME=\\\"' ^ FieldName ^ '\\\" STYLE=\\\"width: ' ^ pxwidth ^ 'px\\\" OnChange=\\\"Edit.action=\'\'; Edit.submit();\\\">\");\n'
#else
#print ' echo (\"<SELECT NAME=\\\"' ^ FieldName ^ '\\\" OnChange=\\\"Edit.action=\'\'; Edit.submit();\\\">\");\n'
#end
#set val=enum data_connection TableName FieldName
#split res=val on ,
#match res with '\(.*\)' into res
#print ' if ($'^ Name ^'==\''^res^'\') {\n'
#print ' echo \"<OPTION VALUE=\\\"' ^ res ^ '\\\" SELECTED>' ^ res ^ '</OPTION>\\n\";\n'
#print ' } else {\n'
#print ' echo \"<OPTION VALUE=\\\"' ^ res ^ '\\\">' ^ res ^ '</OPTION>\\n\";\n'
#print ' }\n'
#end
#end
#print ' echo (\"</SELECT></FONT></FONT>\");\n'
#print ' ?>\n'
#end
#if Type='int' or Type='date' or Type='varchar' or Type='ordering' or Type='password'
#print ' <?php echo(\"<INPUT TYPE=TEXT NAME=\\"' ^ FieldName ^ '\\" SIZE=' ^ ListWidth ^ ' VALUE=\\"$' ^ Name ^ '\\">\");?>\n'
#end
#if Type='text' or Type='mediumtext' or Type='longtext'
#print ' <?php echo(\"<TEXTAREA NAME=\\"' ^ FieldName ^ '\\" ROWS=' ^ AreaHeight ^ ' COLS=' ^ ListWidth ^ '>$' ^ Name ^ '</TEXTAREA>\");?>\n'
#end
#end
#if Help<>''
#print ' <INPUT TYPE=BUTTON VALUE=\"Help\" onClick=\"javascript: window.open(\'vraagbaak.php?zoekitem=' ^ Help ^ '\',\'Help\',\'width=300,height=500,location=no,menubar=no,scrollbars=yes,status=no,resizable=yes\'); return false;\">\n'
#end
#print ' </FONT></FONT></FONT></P>\n'
#print ' </TD>\n'
#print ' </TR>\n'
#end
#end
#print ' </TBODY>\n'
#print '</TABLE>\n'
#print '<P ALIGN=RIGHT>\n'
#set Code=''
#query select Code from actions where TableID=?table_id? and Action='edit' and Part='complete'
#if Code<>''
#print '<?php\n'
#print 'if ('^ Code ^') { echo \"<INPUT TYPE=submit VALUE=Change>\\n\"; }\n'
#print '?>\n'
#else
#print '<INPUT TYPE=\"submit\" VALUE=\"Change\">\n'
#end
#set sesvars=''
#record select SessionVar from `fields` where TableID=?table_id? and SessionVar<>'' order by `order`
#set sesvars=sesvars ^ '&' ^ SessionVar ^ '=$' ^ SessionVar
#end
#print '<?php\n'
#print '$test=true;\n'
#print 'if ($test) {\n'
#print ' echo (\"\n'
#print ' <INPUT TYPE=BUTTON VALUE=\\"Delete\\" onClick=\\"confirmDelete(\'postdelete' ^ Subject ^ '.php?' ^ IDfield ^ '=$' ^ IDfield ^ sesvars ^ '\')\\">\n'
#print ' \");\n'
#print '}\n'
#print '?>\n'
#print '<INPUT TYPE=BUTTON VALUE=\"Cancel\" onClick=\"window.close()\">\n'
#print '</P>\n'
#print '</FORM>\n'
#record select Code from actions where TableID=?table_id? and Action='edit' and Part='footer'
#print '<?php\n' ^ Code ^ '\n?>\n'
#end
#print '</BODY>\n'
#print '</HTML>\n'
#end
#function postedit_php dbase_id table_id
#query select DatabaseName from `database` where DatabaseID=?dbase_id?
#query select TableName, Subject, Checks, Session, IDfield, Include, ListOrderByField from `tables` where TableID=?table_id?
#print page_header 'postedit' dbase_id table_id
#print '<?php\n'
#print '$sql = new MySQL_class;\n'
#print '$sql->Create(\"' ^ DatabaseName ^ '\");\n'
#print '$' ^ IDfield ^ '=($_POST[\'' ^ IDfield ^ '\']);\n'
#record select FieldName, `Type`, DisplayName, DisplayLength, areaheight, areawidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and `Record`<>'none' and FieldName<>'' order by `order`
#if Type='date'
#print 'preg_match (\'/^(\d+)\/(\d+)\/(\d+)$/\', $_POST[\'' ^ FieldName ^ '\'], $matches);\n'
#print '$' ^ FieldName ^ '=\"\'$matches[3]-$matches[2]-$matches[1]\'\";\n'
#else
#print '$' ^ FieldName ^ '=quote($_POST[\'' ^ FieldName ^ '\']);\n'
#end
#if LookupTable<>''
#set str=fieldreplace LookupTable '0'
#print ' $field = $sql->data[' ^ FieldName ^ '];\n'
#print ' if ($field <> 0) {\n'
#split qry=str on ; +
#print ' $esql->QueryItem(\"' ^ qry ^ ' and `' ^ LookupIDField ^ '`=$field\");\n'
#if string_sub qry 0 4<>'use '
#print 'if ($esql->data[LNR]==0) {die (\'No valid data in \\\'' ^ DisplayName ^ '\\\'\'); }\n'
#end
#end
#print ' }\n'
#end
#end
#set tests=''
#record select FieldName, SessionVar from `fields` where TableID=?table_id? and SessionVar<>'' and FieldName<>'' order by `order`
#if tests=''
#set tests=' WHERE '
#else
#set tests=tests ^ ' AND '
#end
#set tests=tests ^ '`' ^ FieldName ^ '`=\'$' ^ SessionVar ^ '\''
#end
#print '$sql->Update(\"UPDATE `' ^ TableName ^ '` SET\n'
#set first=true
#record select FieldName, `Type`, DisplayName, DisplayLength, areaheight, areawidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and `Record`<>'none' and FieldName<>'' order by `order`
#if Type='password'
#print '\".(($_POST[' ^ FieldName ^']==\'\')?\'\':\"'
#end
#if first
#set first=false
#else
#print ',\n'
#end
#print '`' ^ FieldName ^ '`=$' ^ FieldName
#if Type='password'
#print '\").\"'
#end
#end
#print tests ^ '\");\n'
#print '$affected_rows = $sql->a_rows;\n'
#record select Code from actions where TableID=?table_id? and Action='edit' and Part='onchange'
#print 'if ($affected_rows>0) {\n' ^ Code ^ '\n}\n'
#end
#print 'echo \"<P><FONT FACE=\\\"Verdana, sans-serif\\\"><FONT SIZE=1 STYLE=\\\"font-size: 8pt\\\">\";\n'
#print 'echo \"Er is/zijn $affected_rows records gewijzigd<BR>\";\n'
#record select `Add`, FieldName, `Type`, DisplayName, DisplayLength, areaheight, areawidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? order by `order`
#if Add='true'
#print 'echo \"$' ^ FieldName ^ '<BR>\";\n'
#end
#end
#print 'echo \"</P>\";\n'
#print 'if ($affected_rows=1) {\n'
#print ' echo \"<script>window.opener.location.reload(true)</script>\";\n'
#print ' echo \"<script>window.close(self)</script>\";\n'
#print '}\n'
#record select `Add`, FieldName, `Type`, DisplayName, DisplayLength, areaheight, areawidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField, SessionVar from `fields` where TableID=?table_id? and FieldName<>'' and FieldName<>?IDfield? and FieldName=?ListOrderByField?
#if SessionVar<>''
#print '$_SESSION[last_'^table_id^']=\'$' ^ SessionVar ^'\';\n'
#else
#print '$_SESSION[last_'^table_id^']=$' ^ FieldName ^ ';\n'
#end
#end
#print '?>\n'
#print '<INPUT TYPE=BUTTON VALUE=\"Close\" onClick=\"window.opener.location.reload(true);self.close()\">\n'
#end
#function rights_edit_php dbase_id table_id
#query select DatabaseName from `database` where DatabaseID=?dbase_id?
#query select TableID, Subject, TableName, Title, Checks, Session, IDfield from `tables` where TableID=?table_id?
#print page_header 'edit' dbase_id table_id
#print '<?php\n'
#record select Code from actions where TableID=?table_id? and Action='edit' and Part='session'
#print Code ^ '\n'
#end
#print '?>\n'
#print '<HTML>\n'
#print '<HEAD>\n'
#print ' <META HTTP-EQUIV=\"CONTENT-TYPE\" CONTENT=\"text/html; charset=windows-1252\">\n'
#print ' <TITLE>' ^ Title ^ ' rechten</TITLE>\n'
#print '</HEAD>\n'
#print '<BODY LANG=\"en-US\" DIR=\"LTR\">\n'
#print '<TABLE WIDTH=100% BORDER=0 CELLPADDING=4 CELLSPACING=1>\n'
#print ' <THEAD>\n'
#print ' <TR>\n'
#print ' <TD COLSPAN=2 WIDTH=100% VALIGN=TOP BGCOLOR=\"#000080\">\n'
#print ' <P><FONT COLOR=\"#ffffff\"><FONT FACE=\"Verdana, sans-serif\"><FONT SIZE=1 STYLE=\"font-size: 8pt\">'
#print '<B>' ^ Title ^ ' rechten\n'
#print ' </B></FONT></FONT></FONT></P>\n'
#print ' </TD>\n'
#print ' </TR>\n'
#print ' </THEAD>\n'
#print ' <TBODY>\n'
#set Help=''
#record select `FieldID`, `Record`, FieldName, `Type`, DisplayName, SessionVar, Help, AreaHeight, ListWidth*7 as pxwidth, ListWidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and FieldName<>'' and Record<>'none' order by `order`
#print ' <TR VALIGN=TOP>\n'
#print ' <TD WIDTH=20% BGCOLOR=\"#e6e6ff\">\n'
#print ' <FONT COLOR=\"#000080\" FACE=\"Verdana, sans-serif\" STYLE=\"font-size: 8pt\">\n'
#print ' ' ^ DisplayName ^'\n'
#print ' </FONT>\n'
#print ' </TD>\n'
#print ' <TD WIDTH=80%>\n'
#print field_rights_link FieldID 'readonly'
#print field_rights_link FieldID 'hide'
#print ' </TD>\n'
#end
#if Help<>''
#print ' <INPUT TYPE=BUTTON VALUE=\"Help\" onClick=\"javascript: window.open(\'vraagbaak.php?zoekitem=' ^ Help ^ '\',\'Help\',\'width=300,height=500,location=no,menubar=no,scrollbars=yes,status=no,resizable=yes\'); return false;\">\n'
#end
#print ' </FONT></FONT></FONT></P>\n'
#print ' </TD>\n'
#print ' </TR>\n'
#print ' </TBODY>\n'
#print '</TABLE>\n'
#print '<P ALIGN=RIGHT>\n'
#print '<INPUT TYPE=\"submit\" VALUE=\"Change\" onClick=\"window.close()\">\n'
#print '<INPUT TYPE=BUTTON VALUE=\"Delete\" onClick=\"window.close()\">\n'
#set part=''
#query select `part` from `part` where `table`=?table_id? and `link`=`screen`
#if part<>''
#print part_rights_link part 'nodelete'
#end
#print '<INPUT TYPE=BUTTON VALUE=\"Cancel\" onClick=\"window.close()\">\n'
#print '</P>\n'
#print '</FORM>\n'
#record select Code from actions where TableID=?table_id? and Action='edit' and Part='footer'
#print '<?php\n' ^ Code ^ '\n?>\n'
#end
#print '</BODY>\n'
#print '</HTML>\n'
#end
#function generate_edit dbase_id table_id
#query select DatabaseName from `database` where DatabaseID=?dbase_id?
#query select TableID, Subject, TableName, Title, Checks, Session, IDfield from `tables` where TableID=?table_id?
#print '<div><FORM NAME=Edit METHOD=POST>\n<?php\n'
#record select FieldName, `Type`, DisplayName, DisplayLength, areaheight, areawidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and Record<>'none' and FieldName<>'' order by `order`
#print 'if ($_POST[\'' ^ FieldName ^ '\']!=\'\') {\n'
#if Type='varchar' or Type='text'
#print ' $' ^ FieldName ^ ' = ($_POST[\'' ^ FieldName ^ '\']);\n'
#else
#if Type='password'
#print ' $' ^ FieldName ^ ' = \'\';\n'
#else
#if Type='date'
#print ' $' ^ FieldName ^ ' = date(\'j/n/Y\', strtotime($_POST[\'' ^ FieldName ^ '\']));\n'
#else
#print ' $' ^ FieldName ^ ' = $_POST[\'' ^ FieldName ^ '\'];\n'
#end
#end
#end
#print ' $_SESSION[var_' ^ FieldName ^ ']=$' ^ FieldName ^ ';\n'
#print '}\n'
#end
#record select FieldID, `Record`, FieldName, `Type`, DisplayName, SessionVar, Help, AreaHeight, ListWidth*7 as pxwidth, ListWidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and FieldName<>'' and Record<>'none' order by `order`
#if Record<>'show'
#if LookupTable<>''
#if pxwidth<>'0'
#print 'echo (\"<SELECT NAME=\\\"' ^ FieldName ^ '\\\" STYLE=\\\"width: ' ^ pxwidth ^ 'px\\\" OnChange=\\\"Edit.action=\'\'; Edit.submit();\\\">\");\n'
#else
#print 'echo (\"<SELECT NAME=\\\"' ^ FieldName ^ '\\\" OnChange=\\\"Edit.action=\'\'; Edit.submit();\\\">\");\n'
#end
#print '$sql->Query(\"SELECT '
#print queryvars 'T' LookupDisplayField '0' 1 ^ ', T.' ^ LookupIDField
#print ' FROM `' ^ LookupTable ^'` as T'
#set wcheck=''
#query select Checks as wcheck from `tables` where databaseID=?dbase_id? and TableName=?LookupTable?
#if wcheck<>''
#print ' \n WHERE ' ^ fieldreplace wcheck '0'
#end
#print '\n ORDER BY ' ^ OrderByField ^ ' ASC\");\n'
#print 'for ($i = 0; $i < $sql->rows; $i++)\n'
#print '{\n'
#print ' $sql->Fetch($i);\n'
#print ' $opzoekID = $sql->data[' ^ LookupIDField ^ '];\n'
#set expr=fieldreplace LookupDisplayField '0'
#print getvars
#print ' $opzoekweergave = \"' ^ expr ^ '\";\n'
#print ' echo (\"<OPTION \");\n'
#print ' if ($opzoekID == $' ^ FieldName ^') {echo \"SELECTED \";};\n'
#print ' echo \"VALUE=\\\"$opzoekID\\\">$opzoekweergave\";\n'
#print '}\n'
#print 'echo (\"</SELECT>\");\n'
#else
#if Type='enum'
#if pxwidth<>'0'
#print 'echo (\"<SELECT NAME=\\\"' ^ FieldName ^ '\\\" STYLE=\\\"width: ' ^ pxwidth ^ 'px\\\" OnChange=\\\"Edit.action=\'\'; Edit.submit();\\\">\");\n'
#else
#print 'echo (\"<SELECT NAME=\\\"' ^ FieldName ^ '\\\" OnChange=\\\"Edit.action=\'\'; Edit.submit();\\\">\");\n'
#end
#set val=enum data_connection TableName FieldName
#split res=val on ,
#match res with '\(.*\)' into res
#print 'if ($'^ FieldName ^'==\''^res^'\') {\n'
#print ' echo \"<OPTION VALUE=\\\"' ^ res ^ '\\\" SELECTED>' ^ res ^ '</OPTION>\\n\";\n'
#print '} else {\n'
#print ' echo \"<OPTION VALUE=\\\"' ^ res ^ '\\\">' ^ res ^ '</OPTION>\\n\";\n'
#print '}\n'
#end
#end
#print 'echo (\"</SELECT>\");\n'
#end
#if Type='int' or Type='date' or Type='varchar' or Type='password'
#print 'echo(\"<INPUT TYPE=TEXT NAME=\\"' ^ FieldName ^ '\\" SIZE=' ^ ListWidth ^ ' VALUE=\\"$' ^ FieldName ^ '\\">\");\n'
#end
#if Type='text' or Type='mediumtext' or Type='longtext'
#print 'echo(\"<TEXTAREA NAME=\\"' ^ FieldName ^ '\\" ROWS=' ^ AreaHeight ^ ' COLS=' ^ ListWidth ^ '>$' ^ FieldName ^ '</TEXTAREA>\");\n'
#end
#end
#end
#end
#set Code=''
#query select Code from actions where TableID=?table_id? and Action='edit' and Part='complete'
#if Code<>''
#print 'if ('^ Code ^') { echo \"<INPUT TYPE=submit VALUE=Alter>\\n\"; }\n'
#else
#print 'echo \"<INPUT TYPE=submit VALUE=Alter>\\n\";\n'
#end
#print '?></FORM></div>\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.