Menu

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

Download this file

230 lines (223 with data), 12.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
#function generate_list dbase_id table_id link part
#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 orderfield='0'
#query select `FieldID` as orderfield, `FieldName` as ordername from `fields` where `TableID`=?table_id? and `Type`='ordering'
#print '<?php\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 ($filter'^table_id^'!=\'\')\n'
#print '{\n'
#print '$qfilter'^table_id^' = quote(\'%\'.$filter'^table_id^'.\'%\');\n'
#set tests=''
#record select FieldName, SessionVar from `fields` where TableID=?table_id? and SessionVar<>'' and FieldName<>?IDfield? and FieldName<>'' AND LookupTable='' order by `order`
#set tests=tests ^ ' AND `' ^ TableName ^ '`.`' ^ FieldName ^ '`=\'$' ^ SessionVar ^ '\''
#end
#if Checks <> ''
#set tests=tests ^ ' AND ' ^ Checks
#end
#print '$query = (\"\n'
#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 List='true' and LookupTable<>'' and LookupDisplayField<>'' order by `order`
#print 'LEFT JOIN `' ^ LookupTable ^ '` AS T' ^ fieldID ^ ' ON ' ^ TableName ^ '.' ^ FieldName ^ '=T' ^ fieldID ^ '.' ^ LookupIDField ^ '\n'
#end
#set first=true
#record select fieldID, `Add`, FieldName, `Type`, DisplayName, DisplayLength, Help, areaheight, areawidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and (`Type`='varchar' or `Type`='int') and List='true' order by `order`
#if LookupTable='' or LookupDisplayField=''
#if first
#set first=false
#print 'WHERE (' ^ (if LookupTable='' then TableName else 'T' ^ fieldID) ^ '.`' ^ FieldName ^ '` LIKE $qfilter'^table_id^'\n'
#else
#print 'OR ' ^ (if LookupTable='' then TableName else 'T' ^ fieldID) ^ '.`' ^ FieldName ^ '` LIKE $qfilter'^table_id^'\n'
#end
#else
#if first
#set first=false
#print 'WHERE (' ^ multiply ('T' ^ fieldID) LookupDisplayField (' LIKE $qfilter'^table_id^'\n')
#else
#print 'OR ' ^ multiply ('T' ^ fieldID) LookupDisplayField (' 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 `' ^ TableName ^ '`\n'
#record select fieldID, `Add`, FieldName, `Type`, DisplayName, DisplayLength, Help, areaheight, areawidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and List='true' and LookupTable<>'' and LookupDisplayField<>'' order by `order`
#print 'LEFT JOIN `' ^ LookupTable ^ '` AS T' ^ fieldID ^ ' ON ' ^ TableName ^ '.' ^ FieldName ^ '=T' ^ fieldID ^ '.' ^ LookupIDField ^ '\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 'if ($lastorder==\'\') {$fromrec=20*$page;} else {\n'
#print '$sql->QueryItem(\"SELECT COUNT(*) AS fromrec$query AND `' ^ TableName ^ '`.`' ^ ListOrderByField ^ '` < $lastorder\");\n'
#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 fieldID, `Record`, FieldName, `Type`, DisplayName, DisplayLength, SessionVar, Help, areaheight, areawidth, ListWidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and (List='true' or (SessionVar<>'' and LookupTable='')) and FieldName<>'' order by `order`
#if not first
#print ', '
#end
#if LookupDisplayField=''
#print TableName ^ '.' ^ FieldName ^ ' as F' ^ fieldID
#else
#if SessionVar<>''
#print TableName ^ '.' ^ FieldName ^ ' as F' ^ fieldID ^ ', '
#end
#print queryvars ('T' ^ fieldID) LookupDisplayField fieldID 1
#end
#set first=false
#end
#print '$query\n'
#print 'ORDER BY `' ^ TableName ^ '`.`' ^ ListOrderByField ^ '` ' ^ ListOrderByAscDec ^ '\n'
#print 'LIMIT $fromrec, 20\");\n'
#print 'if (' ^ check_off part 'nofilter' ^ ') {\n'
#print 'echo \"<form action=\\\"\\\" method=get name=Filter>\";\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 ' echo \"Page: \";\n'
#print ' echo \"<select name=\\\"page'^table_id^'\\\" OnChange=\\\"Filter.target=\'\'; Filter.action = \'\'; Filter.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 '}\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'
#set sesvars=''
#record select fieldID, `List`, FieldName, `Type`, DisplayName, DisplayLength, SessionVar, Help, areaheight, areawidth, ListWidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and FieldName<>'' order by `order`
#if SessionVar<>''
#if sesvars<>''
#set sesvars=sesvars ^ '&'
#end
#set sesvars=sesvars ^ SessionVar ^ '=$' ^ SessionVar
#end
#end
#query select count(*) as fields from `fields` where TableID=?table_id? and Record <>'none' and `Add`='true' and DisplayName<>''
#if fields>'0'
#print 'echo \"<input type=button value=\\\"Add ' ^ Title ^ '\\\" onClick=\\\"javascript: window.open(\'add' ^ Subject ^ '.php?' ^ sesvars ^ '\',\'\',\'width=' ^ ScreenWidth ^ ',height=' ^ ScreenHeight ^ ',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`, FieldName, `Type`, DisplayName, DisplayLength, Help, areaheight, areawidth, ListWidth*7 as ListWidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and List='true' order by `order`
#print '<th width=' ^ ListWidth ^ 'px>' ^ DisplayName ^ '</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 fieldID, `List`, Name as InternName, FieldName, `Type`, DisplayName, DisplayLength, SessionVar, Help, areaheight, areawidth, ListWidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and FieldName<>'' order by `order`
#if SessionVar<>''
#if FieldName=IDfield
#print ' $' ^ IDfield ^ ' = $sql->data[\'F' ^ fieldID ^ '\'];\n'
#end
#end
#if List='true'
#if LookupDisplayField='' or Type='enum'
#if Type='date'
#print ' preg_match (\'/^(\d+)-0?(\d+)-0?(\d+)$/\', $sql->data[\'F' ^ fieldID ^ '\'], $matches);\n'
#print ' $' ^ InternName ^ ' = htmlspecialchars(\"$matches[3]/$matches[2]/$matches[1]\");\n'
#else
#print ' $' ^ InternName ^ ' = htmlspecialchars($sql->data[\'F' ^ fieldID ^ '\']);\n'
#end
#else
#if SessionVar<>''
#print ' $' ^ InternName ^ ' = htmlspecialchars($sql->data[\'F' ^ fieldID ^ '\']);\n'
#end
#set getvars=''
#set expr=fieldreplace LookupDisplayField fieldID
#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' ^ Subject ^ '.php?' ^ sesvars ^ '\',\'wijzigen\',\'width=' ^ ScreenWidth ^ ',height=' ^ ScreenHeight ^ ',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' ^ Subject ^ '.php?' ^ ordername ^ '=$' ^ ordername ^ '\',\'add\',\'width=' ^ ScreenWidth ^ ',height=' ^ ScreenHeight ^ ',location=no,menubar=no,scrollbars=yes,status=no,resizable=yes\'); no_bubble(event);\\"><b>Add</b></td>\n'
#end
#record select `List`, FieldName, Name as InternName, `Type`, DisplayName, DisplayLength, Help, areaheight, areawidth, ListWidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and List='true' order by `order`
#print '<td>$' ^ InternName ^ (if LookupDisplayField<>'' then '_lup' else '') ^ '</td>\n'
#end
#print '</tr>\");\n'
#print '}\n'
#print '?>\n'
#print '</table>\n'
#end
#function rights_list dbase_id table_id link part
#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 '<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`, FieldName, `Type`, DisplayName, DisplayLength, Help, areaheight, areawidth, ListWidth*7 as ListWidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and List='true' order by `order`
#print '<th width=' ^ ListWidth ^ 'px>' ^ DisplayName ^ '</th>\n'
#end
#print '</tr>\n'
#print '<tr>\n'
#record select fieldID, `List`, FieldName, `Type`, DisplayName, DisplayLength, Help, areaheight, areawidth, ListWidth*7 as ListWidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?table_id? and List='true' order by `order`
#print '<td>'
#print field_rights_link fieldID 'hide'
#print '</td>\n'
#end
#print '</tr>\n'
#if link=''
#print '<tr onMouseOver=\"ChangeColor(this)\" onMouseOut=\"ChangeColorBack(this)\" onClick=\"window.open(\'rightsedit' ^ Subject ^ '.php\',\'wijzigen\',\'width=' ^ ScreenWidth ^ ',height=' ^ ScreenHeight ^ ',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 fieldID, `List`, FieldName, `Type`, DisplayName, DisplayLength, Help, areaheight, areawidth, ListWidth*7 as ListWidth, LookupTable, OrderByField, LookupIDField, LookupDisplayField from `fields` where TableID=?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.