Menu

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

Download this file

216 lines (206 with data), 7.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
#function generate_record dbase_id table_id
#query select DatabaseName, ApplicationName from `database` where DatabaseID=?dbase_id?
#query select Subject, TableName, Title, Header, Link, Checks, Session, IDfield, ScreenWidth, ScreenHeight, ListOrderByField, ListOrderByAscDec from `tables` where TableID=?table_id?
#print '<?php\n'
#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 SessionVar='' and FieldName<>'' order by `order`
#if not first
#print ', '
#end
#if LookupDisplayField=''
#print TableName ^ '.' ^ FieldName ^ ' as F' ^ fieldID
#else
#if LookupTable=''
#print queryvars TableName LookupDisplayField fieldID 1
#else
#print queryvars ('T' ^ fieldID) LookupDisplayField fieldID 1
#end
#end
#set first=false
#end
#print ' FROM `' ^ TableName ^ '`\n'
#record select fieldID, `Add`, FieldName, `Type`, DisplayName, DisplayLength, Help, areaheight, areawidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and LookupTable<>'' and LookupDisplayField<>'' and Record<>'none' order by `order`
#print 'LEFT JOIN `' ^ LookupTable ^ '` AS T' ^ fieldID ^ ' ON ' ^ TableName ^ '.' ^ FieldName ^ '=T' ^ fieldID ^ '.' ^ LookupIDField ^ '\n'
#end
#query select FieldName as IDfieldName, SessionVar from `fields` where SessionVar<>'' and TableID=?table_id? and FieldName=?IDfield? rows nrrec
#if nrrec>0
#print 'WHERE ' ^ IDfieldName ^ ' = \'$' ^ SessionVar ^ '\'\n'
#end
#print 'ORDER BY `' ^ ListOrderByField ^ '` ' ^ ListOrderByAscDec
#print ' LIMIT 1\");\n'
#set expr=''
#set sesvars=''
#set IDintern=''
#record select fieldID, `Record`, Name, FieldName, `Type`, DisplayName, DisplayLength, SessionVar, Help, areaheight, areawidth, ListWidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? order by `order`
#if FieldName=IDfield
#set IDintern=Name
#end
#if SessionVar<>''
#set sesvars=sesvars ^ '&' ^ SessionVar ^ '=$' ^ SessionVar
#else
#if LookupDisplayField=''
#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
#else
#set getvars=''
#set expr=fieldreplace LookupDisplayField fieldID
#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 FieldID, `Record` from `fields` where TableID=?table_id? and `Record`<>'none' order by `order`
#if Record='front'
#set elm=new_thing 'temp' ('00F'^string_of_int fnr) list FieldID
#set fnr=fnr+1
#end
#if Record='left' or Record=''
#set elm=new_thing 'temp' (string_of_dec 2 lnr^'L') list FieldID
#set lnr=lnr+1
#end
#if Record='right'
#set elm=new_thing 'temp' (string_of_dec 2 rnr^'R') list FieldID
#set rnr=rnr+1
#end
#end
#set last=''
<relas thing="list" type="'temp'" rela="elm" sort="name">
#query select `Record`, `Name`, FieldName, `Type`, DisplayName, DisplayLength, Help, areaheight, areawidth, ListWidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and FieldID=?elm.descr?
#if Record='front'
#if last=''
#print 'echo (\'<table class=record>\');\n'
#end
#print 'echo (\"<tr>'
#print '<td colspan=4>$' ^ Name ^ '</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>' ^ DisplayName ^ '</th>\n'
#print '<td>$' ^ Name ^ '</td>\");\n'
#set last='left'
#end
#if Record='right'
#if last<>'left'
#print 'echo (\"<tr><td></td><td></td>\");\n'
#end
#print 'echo (\"<th>' ^ DisplayName ^ '</th>\n'
#print '<td>$' ^ Name ^ '</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 ' ^ Title ^ '\" onClick=\"javascript: window.open(\'edit' ^ Subject ^ '.php\',\'\',\'width=' ^ ScreenWidth ^ ',height=' ^ ScreenHeight ^ ',location=no,menubar=no,scrollbars=yes,status=no,resizable=yes\'); return false;\">\n'
#else
#print '<p><input type=button value=\"Edit ' ^ Title ^ '\" onClick=\"javascript: window.open(\'edit' ^ Subject ^ '.php?' ^ IDintern ^'=<?php echo $' ^ IDintern ^ '; ?>\',\'\',\'width=' ^ ScreenWidth ^ ',height=' ^ ScreenHeight ^ ',location=no,menubar=no,scrollbars=yes,status=no,resizable=yes\'); return false;\">\n'
#end
#end
#end
#function rights_record dbase_id table_id
#query select DatabaseName, ApplicationName from `database` where DatabaseID=?dbase_id?
#query select Subject, TableName, Title, Header, Link, Checks, Session, IDfield, ScreenWidth, ScreenHeight, ListOrderByField, ListOrderByAscDec from `tables` where TableID=?table_id?
#set first=true
#set list=new_thing 'temp' 'root' ('system'['root']) ''
#set fnr=1
#set lnr=1
#set rnr=1
#record select FieldID, `Record` from `fields` where TableID=?table_id? and `Record`<>'none' order by `order`
#if Record='front'
#set elm=new_thing 'temp' ('00F'^string_of_int fnr) list FieldID
#set fnr=fnr+1
#end
#if Record='left' or Record=''
#set elm=new_thing 'temp' (string_of_dec 2 lnr^'L') list FieldID
#set lnr=lnr+1
#end
#if Record='right'
#set elm=new_thing 'temp' (string_of_dec 2 rnr^'R') list FieldID
#set rnr=rnr+1
#end
#end
#set last=''
<relas thing="list" type="'temp'" rela="elm" sort="name">
#query select `fieldID`, `Record`, `Name`, FieldName, `Type`, DisplayName, DisplayLength, Help, areaheight, areawidth, ListWidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and FieldID=?elm.descr?
#if Record='front'
#if last=''
#print '<table class=record>\n'
#end
#print '<tr>'
#print '<td>' ^ Name ^ ' '
#print field_rights_link fieldID '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>' ^ DisplayName ^ '</th>\n'
#print '<td>'
#print field_rights_link fieldID 'hide'
#print '</td>\n'
#set last='left'
#end
#if Record='right'
#if last<>'left'
#print '<tr><td></td><td></td>\n'
#end
#print '<th>' ^ DisplayName ^ '</th>\n'
#print '<td>'
#print field_rights_link fieldID '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 ' ^ Title ^ '\" onClick=\"javascript: window.open(\'edit' ^ Subject ^ '.php\',\'\',\'width=' ^ ScreenWidth ^ ',height=' ^ ScreenHeight ^ ',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.