Menu

[r40]: / src / elements / record.cs  Maximize  Restore  History

Download this file

215 lines (205 with data), 7.4 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
#function generate_record project table_id
#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?
#print '<?php\n'
#print '$sql->QueryItem(\"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 field.`table`=?table_id? and SessionVar='' and field.sql<>'' order by `order`
#if not first
#print ', '
#end
#if link_display=''
#print tablesql ^ '.' ^ fieldsql ^ ' as F' ^ field
#else
#if link_table=''
#print queryvars tablesql link_display field 1
#else
#print queryvars ('T' ^ field) link_display field 1
#end
#end
#set first=false
#end
#print ' FROM `' ^ tablesql ^ '`\n'
#record select field, `Add`, field.sql as fieldsql, `Type`, title, width, link_table, link_field, link_display from `field` where field.`table`=?table_id? and link_display<>'' and link_table<>'' and Record<>'none' order by `order`
#print 'LEFT JOIN `' ^ link_table ^ '` AS T' ^ field ^ ' ON ' ^ tablesql ^ '.' ^ fieldsql ^ '=T' ^ field ^ '.' ^ link_field ^ '\n'
#end
#query select field.sql as id_fieldsql, SessionVar from `field` where SessionVar<>'' and field.`table`=?table_id? and field.sql=?id_field? rows nrrec
#if nrrec>0
#print 'WHERE `' ^ tablesql ^ '`.`' ^ id_fieldsql ^ '` = \'$' ^ SessionVar ^ '\'\n'
#end
#print ' LIMIT 1\");\n'
#set expr=''
#set sesvars=''
#set IDintern=''
#record select field, `Record`, name, field.sql as fieldsql, `Type`, title, width, SessionVar, height, link_table, link_field, link_display from `field` where field.`table`=?table_id? order by `order`
#if fieldsql=id_field
#set IDintern=name
#end
#if SessionVar<>''
#set sesvars=sesvars ^ '&' ^ SessionVar ^ '=$' ^ SessionVar
#else
#if link_display=''
#if Type='date'
#print 'preg_match (\'/^(\d+)-0?(\d+)-0?(\d+)$/\', $sql->data[\'F' ^ field ^ '\'], $matches);\n'
#print '$' ^ name ^ ' = \"$matches[3]/$matches[2]/$matches[1]\";\n'
#else
#print '$' ^ name ^ ' = htmlspecialchars($sql->data[\'F' ^ field ^ '\']);\n'
#end
#else
#set getvars=''
#set expr=fieldreplace link_display field
#print getvars
#print '$' ^ name ^ ' = \"' ^ expr ^'\";\n'
#end
#end
#end
#set first=true
#set list=new_thing 'temp' 'root' ('system'['root']) ''
#set fnr=1
#set lnr=1
#set rnr=1
#record select field, `Record` from `field` where field.`table`=?table_id? and `Record`<>'none' order by `order`
#if Record='front'
#set elm=new_thing 'temp' ('00F'^string_of_int fnr) list field
#set fnr=fnr+1
#end
#if Record='left' or Record=''
#set elm=new_thing 'temp' (string_of_dec 2 lnr^'L') list field
#set lnr=lnr+1
#end
#if Record='right'
#set elm=new_thing 'temp' (string_of_dec 2 rnr^'R') list field
#set rnr=rnr+1
#end
#end
#set last=''
<relas thing="list" type="'temp'" rela="elm" sort="name">
#query select `Record`, name, field.sql as fieldsql, `Type`, title, suffix, width, height, link_table, link_field, link_display from `field` where field.`table`=?table_id? and field=?elm.descr?
#if Record='front'
#if last=''
#print 'echo (\'<table class=record>\');\n'
#end
#print 'echo (\"<tr>'
#print '<td colspan=4>$' ^ name ^ (if suffix<>'' then ' ' ^ suffix else '') ^ '</td>\n'
#print '</tr>\");\n'
#set last='front'
#end
#if Record='left' or Record=''
#if last=''
#print 'echo (\'<table class=record>\');\n'
#end
#if last='front'
#print 'echo (\'</table><table class=record>\');\n'
#end
#if last='left'
#print 'echo (\"</tr>\");\n'
#end
#print 'echo (\"<tr>'
#print '<th>' ^ title ^ '</th>\n'
#print '<td>$' ^ name ^ (if suffix<>'' then ' ' ^ suffix else '') ^ '</td>\");\n'
#set last='left'
#end
#if Record='right'
#if last<>'left'
#print 'echo (\"<tr><td></td><td></td>\");\n'
#end
#print 'echo (\"<th>' ^ title ^ '</th>\n'
#print '<td>$' ^ name ^ (if suffix<>'' then ' ' ^ suffix else '') ^ '</td>\n'
#print '</tr>\");\n'
#set last='rigth'
#end
#set first=false
</relas>
#do remove 'temp'['root']
#do execute
#if last='left'
#print 'echo (\"</tr>\");\n'
#end
#print 'echo (\'</table>\');\n'
#print '?>\n'
#if not first
#if IDintern=''
#print '<p><input type=button value=\"Edit ' ^ tabletitle ^ '\" onClick=\"javascript: window.open(\'edit' ^ tablename ^ '.php\',\'\',\'width=' ^ tablewidth ^ ',height=' ^ tableheight ^ ',location=no,menubar=no,scrollbars=yes,status=no,resizable=yes\'); return false;\">\n'
#else
#print '<p><input type=button value=\"Edit ' ^ tabletitle ^ '\" onClick=\"javascript: window.open(\'edit' ^ tablename ^ '.php?' ^ IDintern ^'=<?php echo $' ^ IDintern ^ '; ?>\',\'\',\'width=' ^ tablewidth ^ ',height=' ^ tableheight ^ ',location=no,menubar=no,scrollbars=yes,status=no,resizable=yes\'); return false;\">\n'
#end
#end
#end
#function rights_record project table_id
#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 first=true
#set list=new_thing 'temp' 'root' ('system'['root']) ''
#set fnr=1
#set lnr=1
#set rnr=1
#record select field, `Record` from `field` where field.`table`=?table_id? and `Record`<>'none' order by `order`
#if Record='front'
#set elm=new_thing 'temp' ('00F'^string_of_int fnr) list field
#set fnr=fnr+1
#end
#if Record='left' or Record=''
#set elm=new_thing 'temp' (string_of_dec 2 lnr^'L') list field
#set lnr=lnr+1
#end
#if Record='right'
#set elm=new_thing 'temp' (string_of_dec 2 rnr^'R') list field
#set rnr=rnr+1
#end
#end
#set last=''
<relas thing="list" type="'temp'" rela="elm" sort="name">
#query select `field`, `Record`, name, field.sql as fieldsql, `Type`, title, width, height, link_table, link_field, link_display from `field` where field.`table`=?table_id? and field=?elm.descr?
#if Record='front'
#if last=''
#print '<table class=record>\n'
#end
#print '<tr>'
#print '<td>' ^ name ^ ' '
#print field_rights_link field 'hide'
#print '</td>\n'
#print '</tr>\n'
#set last='front'
#end
#if Record='left' or Record=''
#if last=''
#print '<table class=record>'
#end
#if last='front'
#print '</table><table class=record>'
#end
#if last='left'
#print '</tr>\n'
#end
#print '<tr>'
#print '<th>' ^ title ^ '</th>\n'
#print '<td>'
#print field_rights_link field 'hide'
#print '</td>\n'
#set last='left'
#end
#if Record='right'
#if last<>'left'
#print '<tr><td></td><td></td>\n'
#end
#print '<th>' ^ title ^ '</th>\n'
#print '<td>'
#print field_rights_link field 'hide'
#print '</td>\n'
#print '</tr>\n'
#set last='rigth'
#end
#set first=false
</relas>
#do remove 'temp'['root']
#do execute
#if last='left'
#print '</tr>\n'
#end
#if last<>''
#print '</table>\n'
#end
#if not first
#print '<p><input type=button value=\"Edit ' ^ tabletitle ^ '\" onClick=\"javascript: window.open(\'edit' ^ tablename ^ '.php\',\'\',\'width=' ^ tablewidth ^ ',height=' ^ tableheight ^ ',location=no,menubar=no,scrollbars=yes,status=no,resizable=yes\'); return false;\">\n'
#end
#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.