1 | <?php
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Compute completion percentage for a dll.
|
---|
5 | * @returns Completion percentage. Range 0-100.
|
---|
6 | * On error -1 or -2 is returned.
|
---|
7 | * @param $iDll Dll reference code.
|
---|
8 | * @param $db Database connection variable.
|
---|
9 | * @sketch Get total number of function in the dll.
|
---|
10 | * Get number of completed functions in the dll.
|
---|
11 | * return complete*100 / total
|
---|
12 | * @status Completely implemented
|
---|
13 | * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
|
---|
14 | * @remark
|
---|
15 | */
|
---|
16 | function Odin32DBComputeCompletion($iDll, $db)
|
---|
17 | {
|
---|
18 | /*
|
---|
19 | * Count the total number of functions in the DLL.
|
---|
20 | */
|
---|
21 | $sql = sprintf("SELECT SUM(s.weight)/COUNT(f.state)
|
---|
22 | FROM
|
---|
23 | function f,
|
---|
24 | state s
|
---|
25 | WHERE
|
---|
26 | f.state = s.refcode
|
---|
27 | AND dll = %d",
|
---|
28 | $iDll);
|
---|
29 | $result = mysql_query($sql, $db);
|
---|
30 | if (mysql_num_rows($result) < 1)
|
---|
31 | {
|
---|
32 | echo "<br>Odin32DBComputeCompletion: IPE no. 1 <br>";
|
---|
33 | return -1;
|
---|
34 | }
|
---|
35 | $row = mysql_fetch_row($result);
|
---|
36 | $iComplete = $row[0];
|
---|
37 | mysql_free_result($result);
|
---|
38 | }
|
---|
39 |
|
---|
40 |
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * Draws a completion bar.
|
---|
44 | * @param $iDll Dll reference code.
|
---|
45 | * If < 0 then for the entire project.
|
---|
46 | * @param $db Database connection variable.
|
---|
47 | * @sketch Get total number of function in the dll.
|
---|
48 | * Get the number of function per status. (+state color)
|
---|
49 | * Draw bar.
|
---|
50 | * @status Completely implemented
|
---|
51 | * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
|
---|
52 | */
|
---|
53 | function Odin32DBCompletionBar($iDll, $sDllName, $db)
|
---|
54 | {
|
---|
55 | /*
|
---|
56 | * Count the total number of functions in the DLL.
|
---|
57 | */
|
---|
58 | if ($iDll < 0)
|
---|
59 | $sql = "SELECT COUNT(*) FROM function f";
|
---|
60 | else
|
---|
61 | $sql = sprintf("SELECT COUNT(*) FROM function f WHERE dll = %d", $iDll);
|
---|
62 | $result = mysql_query($sql, $db);
|
---|
63 | if (mysql_num_rows($result) < 1)
|
---|
64 | {
|
---|
65 | printf("\n\n<br>Odin32DBCompletionBar: IPE(1).<br>\n\n");
|
---|
66 | return -1;
|
---|
67 | }
|
---|
68 | $row = mysql_fetch_row($result);
|
---|
69 | $cFunctions = $row[0];
|
---|
70 | mysql_free_result($result);
|
---|
71 |
|
---|
72 |
|
---|
73 | /*
|
---|
74 | * Make
|
---|
75 | */
|
---|
76 | echo "
|
---|
77 | <table width=100% border=0 cellspacing=0 cellpadding=0>
|
---|
78 | ";
|
---|
79 | if ($sDllName != '')
|
---|
80 | echo "
|
---|
81 | <tr>
|
---|
82 | <td width=90%>
|
---|
83 | <font size=-1 color=000099>
|
---|
84 | <tt>".$sDllName."</tt>
|
---|
85 | </font>
|
---|
86 | </td>
|
---|
87 | <td width=10%></td>
|
---|
88 | </tr>";
|
---|
89 | echo "
|
---|
90 | <tr>
|
---|
91 | <td width=90%>
|
---|
92 | <table width=100% border=0 cellspacing=0 cellpadding=0>
|
---|
93 | <tr>
|
---|
94 | ";
|
---|
95 |
|
---|
96 |
|
---|
97 | /*
|
---|
98 | * Get states and make bar.
|
---|
99 | */
|
---|
100 | if ($iDll < 0)
|
---|
101 | $sDllCond = "";
|
---|
102 | else
|
---|
103 | $sDllCond = "dll = %d AND ";
|
---|
104 | $sql = sprintf("SELECT COUNT(f.refcode) AS count,
|
---|
105 | f.state AS state,
|
---|
106 | s.color AS color,
|
---|
107 | s.weight AS weight
|
---|
108 | FROM
|
---|
109 | function f,
|
---|
110 | state s
|
---|
111 | WHERE
|
---|
112 | ".$sDllCond."
|
---|
113 | s.refcode = f.state
|
---|
114 | GROUP BY f.state
|
---|
115 | ORDER BY state",
|
---|
116 | $iDll);
|
---|
117 | $result = mysql_query($sql, $db);
|
---|
118 | $rdCompletePercent = 0.0;
|
---|
119 | if (@mysql_num_rows($result) < 1)
|
---|
120 | {
|
---|
121 | echo "
|
---|
122 | <td colspan=2 bgcolor=dddddd>
|
---|
123 | <font size=-1>
|
---|
124 |
|
---|
125 | </font>
|
---|
126 | </td>
|
---|
127 | ";
|
---|
128 |
|
---|
129 | }
|
---|
130 | else
|
---|
131 | {
|
---|
132 | while ($row = mysql_fetch_row($result))
|
---|
133 | {
|
---|
134 | $iPercent = (int)($row[0] * 90 /* 10% is reserved to % */ / $cFunctions);
|
---|
135 | if ($iPercent == 0)
|
---|
136 | $iPercent = 1;
|
---|
137 | echo "
|
---|
138 | <td width=".$iPercent." bgcolor=".$row[2].">
|
---|
139 | <font size=-1>
|
---|
140 |
|
---|
141 | </font>
|
---|
142 | </td>
|
---|
143 | ";
|
---|
144 |
|
---|
145 | $rdCompletePercent += ((double)$row[3] * (double)$row[0]) / $cFunctions;
|
---|
146 | }
|
---|
147 |
|
---|
148 | }
|
---|
149 | mysql_free_result($result);
|
---|
150 |
|
---|
151 | /*
|
---|
152 | * Complete bar with a total completion percent.
|
---|
153 | */
|
---|
154 | echo "
|
---|
155 | <td width=10% align=right>
|
---|
156 | <font size=-1 color=000099>
|
---|
157 | ".(int)$rdCompletePercent."%
|
---|
158 | </font>
|
---|
159 | </td>
|
---|
160 | </tr>
|
---|
161 | </table>
|
---|
162 | </td>
|
---|
163 | </tr>
|
---|
164 | </table>
|
---|
165 | ";
|
---|
166 | }
|
---|
167 |
|
---|
168 |
|
---|
169 | /**
|
---|
170 | * Draws a legend for status colors.
|
---|
171 | * @param $db Database connection variable.
|
---|
172 | * @sketch Get status codes; fetch name and color.
|
---|
173 | *
|
---|
174 | *
|
---|
175 | * @status Completely implemented
|
---|
176 | * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
|
---|
177 | */
|
---|
178 | function Odin32DBStateLegend($db)
|
---|
179 | {
|
---|
180 | /*
|
---|
181 | * Count the total number of functions in the DLL.
|
---|
182 | */
|
---|
183 | $sql = "SELECT
|
---|
184 | name,
|
---|
185 | color
|
---|
186 | FROM
|
---|
187 | state
|
---|
188 | ORDER BY refcode";
|
---|
189 |
|
---|
190 | $result = mysql_query($sql, $db);
|
---|
191 | if (mysql_num_rows($result) < 1)
|
---|
192 | {
|
---|
193 | printf("\n\n<br>Odin32DBStateLegned: IPE(1).<br>\n\n");
|
---|
194 | return -1;
|
---|
195 | }
|
---|
196 | else
|
---|
197 | {
|
---|
198 | echo "
|
---|
199 | <tr><td></td></tr>
|
---|
200 | <tr>
|
---|
201 | <td>
|
---|
202 | <center><B><font face=\"WarpSans, Arial\" color=\"#990000\">
|
---|
203 | Status Legend:
|
---|
204 | </font></b></center>
|
---|
205 | </td>
|
---|
206 | </tr>
|
---|
207 | <tr>
|
---|
208 | <td>
|
---|
209 | <table width=100% border=0 cellspacing=2 cellpadding=0 align=right>
|
---|
210 | ";
|
---|
211 | while ($row = mysql_fetch_row($result))
|
---|
212 | {
|
---|
213 | if (1)
|
---|
214 | {
|
---|
215 | echo "
|
---|
216 | <tr>
|
---|
217 | <td width=85% align=right>
|
---|
218 | <font size=1 color=000099>
|
---|
219 | ".$row[0]."
|
---|
220 | </font>
|
---|
221 | </td>
|
---|
222 | <td width=15% bgcolor=".$row[1].">
|
---|
223 | <font size=-1>
|
---|
224 | <br>
|
---|
225 |
|
---|
226 | </font>
|
---|
227 | </td>
|
---|
228 | </tr>
|
---|
229 | ";
|
---|
230 | }
|
---|
231 | else
|
---|
232 | {
|
---|
233 | echo "
|
---|
234 | <tr>
|
---|
235 | <td align=left bgcolor=".$row[1].">
|
---|
236 | <font size=1 color=000000>
|
---|
237 | ".$row[0]."
|
---|
238 | </font>
|
---|
239 | </td>
|
---|
240 | </tr>
|
---|
241 | ";
|
---|
242 | }
|
---|
243 | }
|
---|
244 |
|
---|
245 | echo "
|
---|
246 | </table>
|
---|
247 | </p>
|
---|
248 | </td>
|
---|
249 | </tr>
|
---|
250 | ";
|
---|
251 | }
|
---|
252 |
|
---|
253 |
|
---|
254 | mysql_free_result($result);
|
---|
255 | }
|
---|
256 |
|
---|
257 |
|
---|
258 | /**
|
---|
259 | * Dump an SQL statement in HTML.
|
---|
260 | *
|
---|
261 | * @returns nothing.
|
---|
262 | * @param $sql Sql to display.
|
---|
263 | * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
|
---|
264 | */
|
---|
265 | function Odin32DBSqlError($sql)
|
---|
266 | {
|
---|
267 | echo "<p><font size=1 face=\"courier\">
|
---|
268 | SQL-Error:<br>
|
---|
269 | ".mysql_error()."
|
---|
270 | <br>
|
---|
271 | </font>
|
---|
272 | </p>
|
---|
273 | ";
|
---|
274 |
|
---|
275 | echo "<p><font size=1 face=\"courier\">
|
---|
276 | SQL:<br>
|
---|
277 | ".str_replace(" ", " ", str_replace("\n", "<br>\n", $sql))."
|
---|
278 | <br>
|
---|
279 | </font>
|
---|
280 | </p>
|
---|
281 | ";
|
---|
282 | }
|
---|
283 |
|
---|
284 |
|
---|
285 | /**
|
---|
286 | *
|
---|
287 | * @returns
|
---|
288 | * @param $sName
|
---|
289 | * @param $array Result array.
|
---|
290 | * @param $sValueName Name in the $array for the value.
|
---|
291 | * @param $sRefName Name in the $array for the reference.
|
---|
292 | * @param $sOdin32DBArg Odin32DB.phtml argument.
|
---|
293 | * @param $sNullText Null text (if the array element is NULL display this).
|
---|
294 | * @param $sPostText Text to insert after the value.
|
---|
295 | *
|
---|
296 | */
|
---|
297 | function Odin32DBInfoRow1($sName, $array, $sValueName, $sRefName, $sOdin32DBArg, $sNullText, $sPostText)
|
---|
298 | {
|
---|
299 | echo "
|
---|
300 | <tr>
|
---|
301 | <td width=35%><tt>".$sName."</tt></td>
|
---|
302 | <td valign=top>";
|
---|
303 | if (isset($array[$sValueName]))
|
---|
304 | {
|
---|
305 | if ($sRefName != "" && isset($array[$sRefName]) && $sOdin32DBArg != "")
|
---|
306 | {
|
---|
307 | echo "<a href=\"Odin32DB.phtml?".$sOdin32DBArg."=".$array[$sRefName]."\">";
|
---|
308 | $sPostText = "</a>".$sPostText;
|
---|
309 | }
|
---|
310 | echo $array[$sValueName];
|
---|
311 | echo $sPostText;
|
---|
312 | }
|
---|
313 | else if ($sNullText != "")
|
---|
314 | echo "<i>".$sNullText."</i>";
|
---|
315 |
|
---|
316 | echo "
|
---|
317 | </td>
|
---|
318 | <tr>\n";
|
---|
319 | }
|
---|
320 |
|
---|
321 |
|
---|
322 | /**
|
---|
323 | *
|
---|
324 | * @returns
|
---|
325 | * @param $sName
|
---|
326 | * @param $array Result array.
|
---|
327 | * @param $sValueName1 Name in the $array for the value.
|
---|
328 | * @param $sRefName1 Name in the $array for the reference.
|
---|
329 | * @param $sOdin32DBArg1 Odin32DB.phtml argument.
|
---|
330 | * @param $sNullText Null text (if the array element is NULL display this).
|
---|
331 | * @param $sPostText Text to insert after the value.
|
---|
332 | * @param $sValueName2 Name in the $array for the value.
|
---|
333 | * @param $sRefName2 Name in the $array for the reference.
|
---|
334 | * @param $sOdin32DBArg2 Odin32DB.phtml argument.
|
---|
335 | *
|
---|
336 | */
|
---|
337 | function Odin32DBInfoRow2($sName, $array, $sValueName1, $sRefName1, $sOdin32DBArg1, $sNullText, $sPostText,
|
---|
338 | $sValueName2, $sRefName2, $sOdin32DBArg2)
|
---|
339 | {
|
---|
340 | echo "
|
---|
341 | <tr>
|
---|
342 | <td width=35%><tt>".$sName."</tt></td>
|
---|
343 | <td valign=top>";
|
---|
344 | if (isset($array[$sValueName1]))
|
---|
345 | {
|
---|
346 | if ($sRefName1 != "" && isset($array[$sRefName1]) && $sOdin32DBArg1 != "")
|
---|
347 | {
|
---|
348 | echo "<a href=\"Odin32DB.phtml?".$sOdin32DBArg1."=".$array[$sRefName1]."\">";
|
---|
349 | $sPostText = "</a>".$sPostText;
|
---|
350 | }
|
---|
351 | echo $array[$sValueName1];
|
---|
352 | echo $sPostText;
|
---|
353 |
|
---|
354 | if (isset($array[$sValueName2]))
|
---|
355 | {
|
---|
356 | if ($sRefName2 != "" && isset($array[$sRefName2]) && $sOdin32DBArg2 != "")
|
---|
357 | {
|
---|
358 | echo "<a href=\"Odin32DB.phtml?".$sOdin32DBArg2."=".$array[$sRefName2]."\">";
|
---|
359 | echo $array[$sValueName2]."</a>";
|
---|
360 | }
|
---|
361 | else
|
---|
362 | echo $array[$sValueName2];
|
---|
363 | }
|
---|
364 | }
|
---|
365 | else if ($sNullText != "")
|
---|
366 | echo "<i>".$sNullText."</i>";
|
---|
367 |
|
---|
368 | echo "</td>
|
---|
369 | <tr>\n";
|
---|
370 | }
|
---|
371 |
|
---|
372 |
|
---|
373 |
|
---|
374 | /**
|
---|
375 | * Inserts a documentation row from database..
|
---|
376 | * @param $sName Name of the information.
|
---|
377 | * @param $array DB result array.
|
---|
378 | * @param $sValueName Name in the DB result array.
|
---|
379 | * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
|
---|
380 | * @remark Displays <i>not available</i> if empty field.
|
---|
381 | */
|
---|
382 | function Odin32DBDocRow1($sName, $array, $sValueName)
|
---|
383 | {
|
---|
384 | PodNaslov($sName);
|
---|
385 | if (isset($array[$sValueName]))
|
---|
386 | {
|
---|
387 | echo $array[$sValueName];
|
---|
388 | }
|
---|
389 | else
|
---|
390 | echo "<i>not available</i>";
|
---|
391 | }
|
---|
392 |
|
---|
393 |
|
---|
394 | /**
|
---|
395 | * Using (Odin32DB)Naslov.
|
---|
396 | * Inserts a documentation row from database..
|
---|
397 | * @param $sName Name of the information.
|
---|
398 | * @param $sLabel Section label.
|
---|
399 | * @param $array DB result array.
|
---|
400 | * @param $sValueName Name in the DB result array.
|
---|
401 | * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
|
---|
402 | * @remark Displays <i>not available</i> if empty field.
|
---|
403 | */
|
---|
404 | function Odin32DBDocRow(&$aContent, $sName, $sLabel, $array, $sValueName)
|
---|
405 | {
|
---|
406 | Odin32DBNaslov($aContent, $sName, $sLabel);
|
---|
407 | if (isset($array[$sValueName]))
|
---|
408 | {
|
---|
409 | echo $array[$sValueName];
|
---|
410 | }
|
---|
411 | else
|
---|
412 | echo "<i>not available</i>";
|
---|
413 | }
|
---|
414 |
|
---|
415 |
|
---|
416 |
|
---|
417 |
|
---|
418 | /* INFO OUTPUT */
|
---|
419 | /* INFO OUTPUT */
|
---|
420 | /* INFO OUTPUT */
|
---|
421 |
|
---|
422 |
|
---|
423 | /**
|
---|
424 | * Writes standard function info.
|
---|
425 | *
|
---|
426 | * @returns void
|
---|
427 | * @param $aContent Contents array. (input/output)
|
---|
428 | * @param $db Database handle.
|
---|
429 | * @param $iRefcode Function reference code.
|
---|
430 | * @sketch
|
---|
431 | * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
|
---|
432 | * @remark
|
---|
433 | */
|
---|
434 | function Odin32DBFunctionInfoAll(&$aContent, $db, $iRefcode)
|
---|
435 | {
|
---|
436 | $sql = sprintf("SELECT\n".
|
---|
437 | " f.name AS name,\n".
|
---|
438 | " f.intname AS intname,\n".
|
---|
439 | " f.ordinal AS ordinal,\n".
|
---|
440 | " f.return AS return,\n".
|
---|
441 | " f.description AS description,\n".
|
---|
442 | " f.remark AS remark,\n".
|
---|
443 | " f.returndesc AS returndesc,\n".
|
---|
444 | " f.sketch AS sketch,\n".
|
---|
445 | " f.equiv AS equiv,\n".
|
---|
446 | " f.time AS time,\n".
|
---|
447 | " g.name AS apigroupname,\n".
|
---|
448 | " g.refcode AS apigrouprefcode,\n".
|
---|
449 | " a.name AS aliasname,\n".
|
---|
450 | " a.refcode AS aliasrefcode,\n".
|
---|
451 | " ad.name AS aliasdllname,\n".
|
---|
452 | " ad.refcode AS aliasdllrefcode,\n".
|
---|
453 | " d.name AS dllname,\n".
|
---|
454 | " d.refcode AS dllrefcode,\n".
|
---|
455 | " i.name AS filename,\n".
|
---|
456 | " i.refcode AS filerefcode,\n".
|
---|
457 | " s.name AS state,\n".
|
---|
458 | " c.description AS type\n".
|
---|
459 | "FROM\n".
|
---|
460 | " function f\n".
|
---|
461 | " LEFT OUTER JOIN function a ON f.aliasfn = a.refcode\n".
|
---|
462 | " LEFT OUTER JOIN dll ad ON a.dll = ad.refcode\n".
|
---|
463 | " LEFT OUTER JOIN apigroup g ON f.apigroup = g.refcode\n".
|
---|
464 | " LEFT JOIN dll d ON f.dll = d.refcode\n".
|
---|
465 | " LEFT JOIN state s ON f.state = s.refcode\n".
|
---|
466 | " LEFT OUTER JOIN file i ON f.file = i.refcode\n".
|
---|
467 | " LEFT JOIN code c ON f.type = c.code\n".
|
---|
468 | "WHERE\n".
|
---|
469 | " c.codegroup = 'FTYP' AND\n".
|
---|
470 | " f.refcode = %d",
|
---|
471 | $iRefcode);
|
---|
472 | $result = mysql_query($sql, $db);
|
---|
473 | if (@mysql_num_rows($result) > 0 &&
|
---|
474 | ($array = mysql_fetch_array($result))
|
---|
475 | )
|
---|
476 | {
|
---|
477 | /*
|
---|
478 | * General
|
---|
479 | */
|
---|
480 | Odin32DBNaslov($aContent, "General", "general");
|
---|
481 | echo "\n<table width=100% border=3 cellpadding=0>\n";
|
---|
482 | Odin32DBInfoRow1("Name", $array, "name","","","","");
|
---|
483 | if (isset($array["intname"]))
|
---|
484 | Odin32DBInfoRow1("Internal Name", $array, "intname","","","","");
|
---|
485 | else
|
---|
486 | Odin32DBInfoRow1("Internal Name", $array, "name","","","","");
|
---|
487 | Odin32DBInfoRow1("Type", $array, "type", "", "","invalid","");
|
---|
488 | Odin32DBInfoRow1("State", $array, "state", "", "","invalid","");
|
---|
489 | Odin32DBInfoRow1("Dll", $array, "dllname", "dllrefcode", "dllrefcode","","");
|
---|
490 | Odin32DBInfoRow1("Ordinal", $array, "ordinal","","","not available","");
|
---|
491 | if (isset($array["aliasrefcode"]))
|
---|
492 | Odin32DBInfoRow2("Forwards", $array, "aliasdllname", "aliasdllrefcode", "dllrefcode","",".",
|
---|
493 | "aliasname", "aliasrefcode", "functionrefcode");
|
---|
494 | if (isset($array["apigroup"]))
|
---|
495 | Odin32DBInfoRow1("API Group", $array, "apigroupname", "apigrouprefcode", "apigrouprefcode","","");
|
---|
496 | Odin32DBInfoRow1("File", $array, "filename", "filerefcode", "filerefcode","not available","");
|
---|
497 | echo "\n</table>\n";
|
---|
498 |
|
---|
499 |
|
---|
500 | Odin32DBNaslov($aContent, "Declaration", "declaration");
|
---|
501 | echo "<pre>\n";
|
---|
502 | if (isset($array["return"]))
|
---|
503 | echo $array["return"]." ";
|
---|
504 | echo $array["name"]."(";
|
---|
505 | $sql = sprintf("SELECT\n".
|
---|
506 | " name AS name,\n".
|
---|
507 | " type AS type,\n".
|
---|
508 | " description AS description\n".
|
---|
509 | "FROM\n".
|
---|
510 | " parameter\n".
|
---|
511 | "WHERE\n".
|
---|
512 | " function = %d\n".
|
---|
513 | "ORDER BY sequencenbr",
|
---|
514 | $iRefcode);
|
---|
515 | $result2 = mysql_query($sql, $db);
|
---|
516 | if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
|
---|
517 | {
|
---|
518 | while ($param = mysql_fetch_array($result2))
|
---|
519 | {
|
---|
520 | if (--$cParams == 0)
|
---|
521 | printf("\n %-20s %s", $param["type"], $param["name"]);
|
---|
522 | else
|
---|
523 | printf("\n %-20s %s,", $param["type"], $param["name"]);
|
---|
524 | }
|
---|
525 | }
|
---|
526 | else
|
---|
527 | echo "void";
|
---|
528 |
|
---|
529 | echo ");\n";
|
---|
530 | echo "</pre>\n";
|
---|
531 |
|
---|
532 | /*
|
---|
533 | * Description
|
---|
534 | */
|
---|
535 | Odin32DBDocRow($aContent, "Description", "desc", $array, "description");
|
---|
536 |
|
---|
537 |
|
---|
538 | /*
|
---|
539 | * Parameters
|
---|
540 | */
|
---|
541 | Odin32DBNaslov($aContent, "Parameters", "params");
|
---|
542 | if ($result2 &&
|
---|
543 | mysql_num_rows($result2) > 0 &&
|
---|
544 | mysql_data_seek($result2, 0)
|
---|
545 | )
|
---|
546 | {
|
---|
547 | while ($param = mysql_fetch_array($result2))
|
---|
548 | {
|
---|
549 | echo "\n<dt><b>".$param["name"].":</b></dt>\n";
|
---|
550 | if (isset($param["description"]))
|
---|
551 | {
|
---|
552 | if (1)
|
---|
553 | {
|
---|
554 | echo "\n <table width=100% border=0 cellpadding=0>\n";
|
---|
555 | echo " <tr><td width=10%> </td>\n";
|
---|
556 | $sDescription = str_replace("<BR>", "", str_replace("<BR><BR>\n","<br>",$param["description"]));
|
---|
557 | echo " <td width=90%><font size=-1>".$sDescription."</font></td></tr>\n";
|
---|
558 | echo "\n</table>\n";
|
---|
559 | }
|
---|
560 | else
|
---|
561 | {
|
---|
562 | $sDescription = str_replace("<BR>", "", str_replace("<BR><BR>\n","<br>",$param["description"]));
|
---|
563 | echo "<dd><font size=-1>".$sDescription."</font></dd>\n\n";
|
---|
564 | }
|
---|
565 | }
|
---|
566 | echo "<p>\n";
|
---|
567 | }
|
---|
568 | }
|
---|
569 | else
|
---|
570 | echo "void";
|
---|
571 |
|
---|
572 |
|
---|
573 | /*
|
---|
574 | * Returns
|
---|
575 | */
|
---|
576 | Odin32DBDocRow($aContent, "Returns", "return", $array, "returndesc");
|
---|
577 |
|
---|
578 | /*
|
---|
579 | * Sketch/Algorithm
|
---|
580 | */
|
---|
581 | Odin32DBDocRow($aContent, "Sketch/Algorithm", "sketch", $array, "sketch");
|
---|
582 |
|
---|
583 | /*
|
---|
584 | * Remark
|
---|
585 | */
|
---|
586 | Odin32DBDocRow($aContent, "Remark", "remark", $array, "remark");
|
---|
587 |
|
---|
588 | /*
|
---|
589 | * Authors
|
---|
590 | */
|
---|
591 | Odin32DBNaslov($aContent, "Authors", "Authors");
|
---|
592 | $sql = sprintf("SELECT\n".
|
---|
593 | " a.name AS name,\n".
|
---|
594 | " a.refcode AS refcode\n".
|
---|
595 | "FROM\n".
|
---|
596 | " fnauthor fa\n".
|
---|
597 | " JOIN function f\n".
|
---|
598 | " JOIN author a\n".
|
---|
599 | "WHERE\n".
|
---|
600 | " f.refcode = %d AND\n".
|
---|
601 | " fa.function = f.refcode AND\n".
|
---|
602 | " fa.author = a.refcode\n".
|
---|
603 | "ORDER BY a.name",
|
---|
604 | $iRefcode);
|
---|
605 | $result2 = mysql_query($sql, $db);
|
---|
606 | if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
|
---|
607 | {
|
---|
608 | while ($author = mysql_fetch_array($result2))
|
---|
609 | echo "<a href=\"Odin32DB.phtml?authorrefcode=".$author["refcode"]."\">".$author["name"]."</a><br>\n";
|
---|
610 | }
|
---|
611 | else
|
---|
612 | echo "Hmm. Seems noone wrote this function...<br>\n";
|
---|
613 | }
|
---|
614 | else
|
---|
615 | {
|
---|
616 | echo "<p> No data! Invalid refcode? </p>";
|
---|
617 | Odin32DBSqlError($sql);
|
---|
618 | }
|
---|
619 | }
|
---|
620 |
|
---|
621 |
|
---|
622 |
|
---|
623 | /**
|
---|
624 | * Writes standard dll info.
|
---|
625 | *
|
---|
626 | * @returns void
|
---|
627 | * @param $aContent Contents array. (input/output)
|
---|
628 | * @param $db Database handle.
|
---|
629 | * @param $iRefcode Dll reference code.
|
---|
630 | * @param $fFunctions Flags which tells wether to list all functions or not.
|
---|
631 | * @param $fFiles Flags which tells wether to list all files or not.
|
---|
632 | * @param $fAPIGroups Flags which tells wether to list all apigroups or not.
|
---|
633 | * @param $fAuthors Flags which tells wether to list all authors or not.
|
---|
634 | * @param $fSortByState Flags which tells wether to sort functions by
|
---|
635 | * state and function name or just by function name.
|
---|
636 | * @sketch
|
---|
637 | * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
|
---|
638 | * @remark
|
---|
639 | */
|
---|
640 | function Odin32DBDllInfoAll(&$aContent, $db, $iRefcode, $fFunctions, $fFiles, $fAPIGroups, $fAuthors, $fSortByState)
|
---|
641 | {
|
---|
642 |
|
---|
643 |
|
---|
644 | $sql = sprintf("SELECT\n".
|
---|
645 | " d.name AS name,\n".
|
---|
646 | " d.description AS description,\n".
|
---|
647 | " c.description AS type\n".
|
---|
648 | "FROM\n".
|
---|
649 | " dll d,\n".
|
---|
650 | " code c\n".
|
---|
651 | "WHERE\n".
|
---|
652 | " c.codegroup = 'DTYP' AND\n".
|
---|
653 | " d.type = c.code AND\n".
|
---|
654 | " d.refcode = %d",
|
---|
655 | $iRefcode);
|
---|
656 | $result = mysql_query($sql, $db);
|
---|
657 | if (@mysql_num_rows($result) > 0 &&
|
---|
658 | ($array = mysql_fetch_array($result))
|
---|
659 | )
|
---|
660 | {
|
---|
661 | Odin32DBNaslov($aContent, "General", "general");
|
---|
662 | echo "\n<table width=100% border=3 cellpadding=0>\n";
|
---|
663 | Odin32DBInfoRow1("Name", $array, "name","","","","");
|
---|
664 | Odin32DBInfoRow1("Description", $array, "description","","","","");
|
---|
665 | Odin32DBInfoRow1("Type", $array, "type","","","","");
|
---|
666 | $sql = sprintf("SELECT\n".
|
---|
667 | " COUNT(*) as functions\n".
|
---|
668 | "FROM\n".
|
---|
669 | " function\n".
|
---|
670 | "WHERE\n".
|
---|
671 | " dll = %d",
|
---|
672 | $iRefcode);
|
---|
673 | $result = mysql_query($sql, $db);
|
---|
674 | if (@mysql_num_rows($result) > 0 &&
|
---|
675 | ($array = mysql_fetch_array($result))
|
---|
676 | )
|
---|
677 | {
|
---|
678 | Odin32DBInfoRow1("# Functions", $array, "functions","","","","");
|
---|
679 | $cFunctions = $array["functions"];
|
---|
680 | }
|
---|
681 | else
|
---|
682 | $cFunctions = 0;
|
---|
683 |
|
---|
684 | $sql = sprintf("SELECT\n".
|
---|
685 | " COUNT(*) as files\n".
|
---|
686 | "FROM\n".
|
---|
687 | " file\n".
|
---|
688 | "WHERE\n".
|
---|
689 | " dll = %d",
|
---|
690 | $iRefcode);
|
---|
691 | $result = mysql_query($sql, $db);
|
---|
692 | if (@mysql_num_rows($result) > 0 &&
|
---|
693 | ($array = mysql_fetch_array($result))
|
---|
694 | )
|
---|
695 | {
|
---|
696 | Odin32DBInfoRow1("# Source files", $array, "files","","","","");
|
---|
697 | $cFiles = $array["files"];
|
---|
698 | }
|
---|
699 | else
|
---|
700 | $cFiles = 0;
|
---|
701 |
|
---|
702 | $sql = sprintf("SELECT\n".
|
---|
703 | " COUNT(*) as apigroups\n".
|
---|
704 | "FROM\n".
|
---|
705 | " function c\n".
|
---|
706 | "WHERE\n".
|
---|
707 | " f.dll = %d",
|
---|
708 | $iRefcode);
|
---|
709 | $result = mysql_query($sql, $db);
|
---|
710 | if (@mysql_num_rows($result) > 0 &&
|
---|
711 | ($array = mysql_fetch_array($result))
|
---|
712 | )
|
---|
713 | {
|
---|
714 | Odin32DBInfoRow1("# API Groups", $array, "apigroups","","","","");
|
---|
715 | $cAPIGroups = $array["apigroups"];
|
---|
716 | }
|
---|
717 | else
|
---|
718 | $cAPIGroups = 0;
|
---|
719 |
|
---|
720 | echo "\n</table>\n";
|
---|
721 |
|
---|
722 |
|
---|
723 | /*
|
---|
724 | * Completion
|
---|
725 | */
|
---|
726 | Odin32DBNaslov($aContent, "Completion", "completion");
|
---|
727 | Odin32DBCompletionBar($iRefcode, "", $db);
|
---|
728 |
|
---|
729 | /*
|
---|
730 | * States
|
---|
731 | */
|
---|
732 | Odin32DBNaslov($aContent, "Status", "status");
|
---|
733 | $sql = sprintf("SELECT\n".
|
---|
734 | " s.name AS state,\n".
|
---|
735 | " s.color AS color,\n".
|
---|
736 | " COUNT(f.state) AS functions\n".
|
---|
737 | "FROM\n".
|
---|
738 | " state s\n".
|
---|
739 | " LEFT OUTER JOIN function f ON s.refcode = f.state AND f.dll = %d\n".
|
---|
740 | "GROUP BY s.refcode\n".
|
---|
741 | "ORDER BY s.refcode",
|
---|
742 | $iRefcode);
|
---|
743 | $result2 = mysql_query($sql, $db);
|
---|
744 | if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
|
---|
745 | {
|
---|
746 | echo "\n<table width=100% border=0 cellpadding=0>\n";
|
---|
747 | while ($aState = mysql_fetch_array($result2))
|
---|
748 | {
|
---|
749 | echo "<tr>\n".
|
---|
750 | " <td width=75%><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["state"]."</b></font></td>\n".
|
---|
751 | " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["functions"]."</b></font></td>\n".
|
---|
752 | " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".@(int)((int)$aState["functions"] * 100 / $cFunctions)."%</b></font></td>\n".
|
---|
753 | "</tr>\n";
|
---|
754 | }
|
---|
755 |
|
---|
756 | echo "\n</table>\n";
|
---|
757 | }
|
---|
758 | else
|
---|
759 | Odin32DBSqlError($sql);
|
---|
760 |
|
---|
761 |
|
---|
762 | /*
|
---|
763 | * Functions
|
---|
764 | */
|
---|
765 | Odin32DBNaslov($aContent, "Functions", "functions");
|
---|
766 | if ($fFunctions)
|
---|
767 | {
|
---|
768 | echo "Click <a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fFunctions=1";
|
---|
769 | if ($fFiles) echo "&fFiles=".$fFiles;
|
---|
770 | if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups;
|
---|
771 | if ($fAuthors) echo "&fAuthors=".$fAuthors;
|
---|
772 | if ($fSortByState)
|
---|
773 | echo "&fSortByState=".!$fSortByState."\">here</a> to view files sorted alphabetical.<br>\n";
|
---|
774 | else
|
---|
775 | echo "&fSortByState=".!$fSortByState."\">here</a> to view files sorted by state.<br>\n";
|
---|
776 |
|
---|
777 | $sql = sprintf("SELECT\n".
|
---|
778 | " f.name AS name,\n".
|
---|
779 | " f.refcode AS refcode,\n".
|
---|
780 | " s.name AS state,\n".
|
---|
781 | " s.color AS color\n".
|
---|
782 | "FROM\n".
|
---|
783 | " function f\n".
|
---|
784 | " LEFT JOIN state s ON f.state = s.refcode\n".
|
---|
785 | "WHERE\n".
|
---|
786 | " f.dll = %d\n",
|
---|
787 | $iRefcode);
|
---|
788 | if ($fSortByState)
|
---|
789 | $sql = $sql."ORDER BY s.refcode, f.name";
|
---|
790 | else
|
---|
791 | $sql = $sql."ORDER BY f.name";
|
---|
792 | $result2 = mysql_query($sql, $db);
|
---|
793 | if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
|
---|
794 | {
|
---|
795 | echo "\n<table width=100% border=0 cellpadding=0>\n".
|
---|
796 | "<tr>\n".
|
---|
797 | " <td width=75%><font size=-1><b>Function Name</b></font></td>\n".
|
---|
798 | " <td><font size=-1><b>State</b></font></td>\n".
|
---|
799 | "</tr>\n";
|
---|
800 | while ($aFunction = mysql_fetch_array($result2))
|
---|
801 | {
|
---|
802 | echo "<tr>\n".
|
---|
803 | " <td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
|
---|
804 | " <td><font size=-1 color=\"#".$aFunction["color"]."\">".$aFunction["state"]."</font></td>\n".
|
---|
805 | "</tr>\n";
|
---|
806 | }
|
---|
807 | echo "\n</table>\n";
|
---|
808 | }
|
---|
809 | else
|
---|
810 | Odin32DBSqlError($sql);
|
---|
811 | }
|
---|
812 | else
|
---|
813 | {
|
---|
814 | echo "Click <a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fFunctions=1";
|
---|
815 | if ($fFiles) echo "&fFiles=".$fFiles;
|
---|
816 | if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups;
|
---|
817 | if ($fAuthors) echo "&fAuthors=".$fAuthors;
|
---|
818 | if ($fSortByState) echo "&fSortByState=".$fSortByState;
|
---|
819 | echo "\">here</a> to see all functions.\n";
|
---|
820 | }
|
---|
821 |
|
---|
822 |
|
---|
823 | /*
|
---|
824 | * Files
|
---|
825 | */
|
---|
826 | Odin32DBNaslov($aContent, "Files", "files");
|
---|
827 | if ($fFiles)
|
---|
828 | {
|
---|
829 | $sql = sprintf("SELECT\n".
|
---|
830 | " f.name AS name,\n".
|
---|
831 | " f.refcode AS refcode,\n".
|
---|
832 | " COUNT(f.refcode) AS functions\n".
|
---|
833 | "FROM\n".
|
---|
834 | " file f\n".
|
---|
835 | " LEFT OUTER JOIN function fn ON fn.file = f.refcode\n".
|
---|
836 | "WHERE\n".
|
---|
837 | " f.dll = %d\n".
|
---|
838 | "GROUP BY f.refcode\n".
|
---|
839 | "ORDER BY f.name\n",
|
---|
840 | $iRefcode);
|
---|
841 | $result2 = mysql_query($sql, $db);
|
---|
842 | if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
|
---|
843 | {
|
---|
844 | echo "\n<table width=100% border=0 cellpadding=0>\n".
|
---|
845 | "<tr>\n".
|
---|
846 | " <td><font size=-1><b>Filename</b></font></td>\n".
|
---|
847 | " <td align=right><font size=-1><b>Functions</b></font></td>\n".
|
---|
848 | "</tr>\n";
|
---|
849 | while ($aFunction = mysql_fetch_array($result2))
|
---|
850 | {
|
---|
851 | echo "<tr>\n".
|
---|
852 | " <td width=75%><font size=-1><a href=\"Odin32DB.phtml?filerefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
|
---|
853 | " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
|
---|
854 | "</tr>\n";
|
---|
855 | }
|
---|
856 | echo "\n</table>\n";
|
---|
857 | }
|
---|
858 | else
|
---|
859 | Odin32DBSqlError($sql);
|
---|
860 | }
|
---|
861 | else
|
---|
862 | {
|
---|
863 | echo "Click <a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fFiles=1";
|
---|
864 | if ($fFunctions) echo "&fFunctions=".$fFunctions;
|
---|
865 | if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups;
|
---|
866 | if ($fAuthors) echo "&fAuthors=".$fAuthors;
|
---|
867 | if ($fSortByState) echo "&fSortByState=".$fSortByState;
|
---|
868 | echo "\">here</a> to see all functions.\n";
|
---|
869 | }
|
---|
870 |
|
---|
871 |
|
---|
872 | /*
|
---|
873 | * API Groups
|
---|
874 | */
|
---|
875 | if ($cAPIGroups > 0)
|
---|
876 | {
|
---|
877 | Odin32DBNaslov($aContent, "API Groups", "apigroups");
|
---|
878 | if ($fAPIGroups)
|
---|
879 | {
|
---|
880 | $sql = sprintf("SELECT\n".
|
---|
881 | " g.name AS name,\n".
|
---|
882 | " g.refcode AS refcode,\n".
|
---|
883 | " COUNT(f.refcode) AS functions\n".
|
---|
884 | "FROM\n".
|
---|
885 | " apigroup g\n".
|
---|
886 | " LEFT OUTER JOIN function fn ON fn.apigroup = g.refcode\n".
|
---|
887 | "WHERE\n".
|
---|
888 | " g.dll = %d\n".
|
---|
889 | "GROUP BY g.refcode\n".
|
---|
890 | "ORDER BY g.name\n",
|
---|
891 | $iRefcode);
|
---|
892 | $result2 = mysql_query($sql, $db);
|
---|
893 | if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
|
---|
894 | {
|
---|
895 | echo "\n<table width=100% border=0 cellpadding=0>\n".
|
---|
896 | "<tr>\n".
|
---|
897 | " <td width=75%><font size=-1><b>Group Name</b></font></td>\n".
|
---|
898 | " <td align=right><font size=-1><b>Functions</b></font></td>\n".
|
---|
899 | "</tr>\n";
|
---|
900 | while ($aFunction = mysql_fetch_array($result2))
|
---|
901 | {
|
---|
902 | echo "<tr>\n".
|
---|
903 | " <td><font size=-1><a href=\"Odin32DB.phtml?filerefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
|
---|
904 | " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
|
---|
905 | "</tr>\n";
|
---|
906 | }
|
---|
907 | echo "\n</table>\n";
|
---|
908 | }
|
---|
909 | else
|
---|
910 | Odin32DBSqlError($sql);
|
---|
911 | }
|
---|
912 | else
|
---|
913 | {
|
---|
914 | echo "Click <a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fAPIGroups=1";
|
---|
915 | if ($fFunctions) echo "&fFunctions=".$fFunctions;
|
---|
916 | if ($fFiles) echo "&fFiles=".$fFiles;
|
---|
917 | if ($fAuthors) echo "&fAuthors=".$fAuthors;
|
---|
918 | if ($fSortByState) echo "&fSortByState=".$fSortByState;
|
---|
919 | echo "\">here</a> to see all the API Groups.\n";
|
---|
920 | }
|
---|
921 | }
|
---|
922 |
|
---|
923 |
|
---|
924 | /*
|
---|
925 | * Authors
|
---|
926 | */
|
---|
927 | Odin32DBNaslov($aContent, "Authors", "authors");
|
---|
928 | if ($fAuthors)
|
---|
929 | {
|
---|
930 | $sql = sprintf("SELECT\n".
|
---|
931 | " a.name AS name,\n".
|
---|
932 | " a.refcode AS refcode,\n".
|
---|
933 | " COUNT(f.refcode) AS functions\n".
|
---|
934 | "FROM\n".
|
---|
935 | " fnauthor fa\n".
|
---|
936 | " JOIN function f\n".
|
---|
937 | " JOIN author a\n".
|
---|
938 | "WHERE\n".
|
---|
939 | " f.dll = %d AND\n".
|
---|
940 | " fa.function = f.refcode AND\n".
|
---|
941 | " fa.author = a.refcode\n".
|
---|
942 | "GROUP BY a.refcode\n".
|
---|
943 | "ORDER BY a.name\n",
|
---|
944 | $iRefcode
|
---|
945 | );
|
---|
946 | $result2 = mysql_query($sql, $db);
|
---|
947 | if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
|
---|
948 | {
|
---|
949 | echo "\n<table width=100% border=0 cellpadding=0>\n".
|
---|
950 | "<tr>\n".
|
---|
951 | " <td width=75%><font size=-1><b>Author</b></font></td>\n".
|
---|
952 | " <td align=right><font size=-1><b>Functions</b></font></td>\n".
|
---|
953 | "</tr>\n";
|
---|
954 | while ($aFunction = mysql_fetch_array($result2))
|
---|
955 | {
|
---|
956 | echo "<tr>\n".
|
---|
957 | " <td><font size=-1><a href=\"Odin32DB.phtml?authorrefcode=".$aFunction["refcode"]."&dll=".$iRefcode."\">".$aFunction["name"]."</a></font></td>\n".
|
---|
958 | " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
|
---|
959 | "</tr>\n";
|
---|
960 | }
|
---|
961 | echo "\n</table>\n";
|
---|
962 | }
|
---|
963 | else
|
---|
964 | Odin32DBSqlError($sql);
|
---|
965 | }
|
---|
966 | else
|
---|
967 | {
|
---|
968 | echo "Click <a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fAuthors=1";
|
---|
969 | if ($fFunctions) echo "&fFunctions=".$fFunctions;
|
---|
970 | if ($fFiles) echo "&fFiles=".$fFiles;
|
---|
971 | if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups;
|
---|
972 | if ($fSortByState) echo "&fSortByState=".$fSortByState;
|
---|
973 | echo "\">here</a> to see all authors.\n";
|
---|
974 | }
|
---|
975 | }
|
---|
976 | else
|
---|
977 | {
|
---|
978 | echo "<p> No data! Invalid refcode? </p>";
|
---|
979 | Odin32DBSqlError($sql);
|
---|
980 | }
|
---|
981 | }
|
---|
982 |
|
---|
983 |
|
---|
984 |
|
---|
985 | /**
|
---|
986 | * Writes standard file info.
|
---|
987 | *
|
---|
988 | * @returns void
|
---|
989 | * @param $aContent Contents array. (input/output)
|
---|
990 | * @param $db Database handle.
|
---|
991 | * @param $iRefcode File reference code.
|
---|
992 | * @param $fFunctions Flags which tells wether to list all functions or not.
|
---|
993 | * @param $fAPIGroups Flags which tells wether to list all apigroups or not.
|
---|
994 | * @param $fAuthors Flags which tells wether to list all authors or not.
|
---|
995 | * @param $fSortByState Flags which tells wether to sort functions by
|
---|
996 | * state and function name or just by function name.
|
---|
997 | * @sketch
|
---|
998 | * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
|
---|
999 | * @remark
|
---|
1000 | */
|
---|
1001 | function Odin32DBFileInfoAll(&$aContent, $db, $iRefcode, $fFunctions, $fAPIGroups, $fAuthors, $fSortByState)
|
---|
1002 | {
|
---|
1003 |
|
---|
1004 | $sql = sprintf("SELECT\n".
|
---|
1005 | " f.name AS name,\n".
|
---|
1006 | " f.refcode AS refcode,\n".
|
---|
1007 | " f.lastdatetime AS lastdatetime,\n".
|
---|
1008 | " a.name AS lastauthorname,\n".
|
---|
1009 | " f.lastauthor AS lastauthorrefcode,\n".
|
---|
1010 | " f.revision AS revision,\n".
|
---|
1011 | " f.description AS description,\n".
|
---|
1012 | " f.dll AS dllrefcode,\n".
|
---|
1013 | " d.name AS dllname\n".
|
---|
1014 | "FROM\n".
|
---|
1015 | " file f,\n".
|
---|
1016 | " dll d,\n".
|
---|
1017 | " author a\n".
|
---|
1018 | "WHERE\n".
|
---|
1019 | " f.refcode = %d AND\n".
|
---|
1020 | " f.dll = d.refcode AND\n".
|
---|
1021 | " f.lastauthor= a.refcode",
|
---|
1022 | $iRefcode);
|
---|
1023 | $result = mysql_query($sql, $db);
|
---|
1024 | if (@mysql_num_rows($result) > 0 &&
|
---|
1025 | ($array = mysql_fetch_array($result))
|
---|
1026 | )
|
---|
1027 | {
|
---|
1028 | Odin32DBNaslov($aContent, "General", "general");
|
---|
1029 | echo "\n<table width=100% border=3 cellpadding=0>\n";
|
---|
1030 | Odin32DBInfoRow1("Name", $array, "name","","","","");
|
---|
1031 | Odin32DBInfoRow1("Revision", $array, "revision","","","","");
|
---|
1032 | Odin32DBInfoRow1("Changed", $array, "lastdatetime","","","","");
|
---|
1033 | Odin32DBInfoRow1("Last Author", $array, "lastauthorname","lastauthorrefcode","authorrefcode","","");
|
---|
1034 | Odin32DBInfoRow1("Dll", $array, "dllname","dllrefcode","dllrefcode","","");
|
---|
1035 | Odin32DBInfoRow1("Description", $array, "description","","","","");
|
---|
1036 | $sql = sprintf("SELECT\n".
|
---|
1037 | " COUNT(*) as functions\n".
|
---|
1038 | "FROM\n".
|
---|
1039 | " function\n".
|
---|
1040 | "WHERE\n".
|
---|
1041 | " file = %d",
|
---|
1042 | $iRefcode);
|
---|
1043 | $result = mysql_query($sql, $db);
|
---|
1044 | if (@mysql_num_rows($result) > 0 &&
|
---|
1045 | ($array = mysql_fetch_array($result))
|
---|
1046 | )
|
---|
1047 | {
|
---|
1048 | Odin32DBInfoRow1("# Functions", $array, "functions","","","","");
|
---|
1049 | $cFunctions = $array["functions"];
|
---|
1050 | }
|
---|
1051 | else
|
---|
1052 | $cFunctions = 0;
|
---|
1053 |
|
---|
1054 | $sql = sprintf("SELECT\n".
|
---|
1055 | " COUNT(*) as apigroups\n".
|
---|
1056 | "FROM\n".
|
---|
1057 | " function c\n".
|
---|
1058 | "WHERE\n".
|
---|
1059 | " f.file = %d\n",
|
---|
1060 | $iRefcode);
|
---|
1061 | $result = mysql_query($sql, $db);
|
---|
1062 | if (@mysql_num_rows($result) > 0 &&
|
---|
1063 | ($array = mysql_fetch_array($result))
|
---|
1064 | )
|
---|
1065 | {
|
---|
1066 | Odin32DBInfoRow1("# API Groups", $array, "apigroups","","","","");
|
---|
1067 | $cAPIGroups = $array["apigroups"];
|
---|
1068 | }
|
---|
1069 | else
|
---|
1070 | $cAPIGroups = 0;
|
---|
1071 |
|
---|
1072 | echo "\n</table>\n";
|
---|
1073 |
|
---|
1074 |
|
---|
1075 | /*
|
---|
1076 | * States
|
---|
1077 | */
|
---|
1078 | Odin32DBNaslov($aContent, "Status", "status");
|
---|
1079 | $sql = sprintf("SELECT\n".
|
---|
1080 | " s.name AS state,\n".
|
---|
1081 | " s.color AS color,\n".
|
---|
1082 | " COUNT(f.state) AS functions\n".
|
---|
1083 | "FROM\n".
|
---|
1084 | " state s\n".
|
---|
1085 | " LEFT OUTER JOIN function f ON s.refcode = f.state AND f.file = %d\n".
|
---|
1086 | "GROUP BY s.refcode\n".
|
---|
1087 | "ORDER BY s.refcode",
|
---|
1088 | $iRefcode);
|
---|
1089 | $result2 = mysql_query($sql, $db);
|
---|
1090 | if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
|
---|
1091 | {
|
---|
1092 | echo "\n<table width=100% border=0 cellpadding=0>\n";
|
---|
1093 | while ($aState = mysql_fetch_array($result2))
|
---|
1094 | {
|
---|
1095 | echo "<tr>\n".
|
---|
1096 | " <td width=75%><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["state"]."</b></font></td>\n".
|
---|
1097 | " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["functions"]."</b></font></td>\n".
|
---|
1098 | " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".@(int)((int)$aState["functions"] * 100 / $cFunctions)."%</b></font></td>\n".
|
---|
1099 | "</tr>\n";
|
---|
1100 | }
|
---|
1101 |
|
---|
1102 | echo "\n</table>\n";
|
---|
1103 | }
|
---|
1104 | else
|
---|
1105 | Odin32DBSqlError($sql);
|
---|
1106 |
|
---|
1107 |
|
---|
1108 | /*
|
---|
1109 | * Functions
|
---|
1110 | */
|
---|
1111 | Odin32DBNaslov($aContent, "Functions", "functions");
|
---|
1112 | if ($fFunctions)
|
---|
1113 | {
|
---|
1114 | echo "Click <a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fFunctions=1";
|
---|
1115 | if ($fFiles) echo "&fFiles=".$fFiles;
|
---|
1116 | if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups;
|
---|
1117 | if ($fAuthors) echo "&fAuthors=".$fAuthors;
|
---|
1118 | if ($fSortByState)
|
---|
1119 | echo "&fSortByState=".!$fSortByState."\">here</a> to view files sorted alphabetical.<br>\n";
|
---|
1120 | else
|
---|
1121 | echo "&fSortByState=".!$fSortByState."\">here</a> to view files sorted by state.<br>\n";
|
---|
1122 |
|
---|
1123 | $sql = sprintf("SELECT\n".
|
---|
1124 | " f.name AS name,\n".
|
---|
1125 | " f.refcode AS refcode,\n".
|
---|
1126 | " s.name AS state,\n".
|
---|
1127 | " s.color AS color\n".
|
---|
1128 | "FROM\n".
|
---|
1129 | " function f\n".
|
---|
1130 | " LEFT JOIN state s ON f.state = s.refcode\n".
|
---|
1131 | "WHERE\n".
|
---|
1132 | " f.file = %d\n",
|
---|
1133 | $iRefcode);
|
---|
1134 | if ($fSortByState)
|
---|
1135 | $sql = $sql."ORDER BY s.refcode, f.name";
|
---|
1136 | else
|
---|
1137 | $sql = $sql."ORDER BY f.name";
|
---|
1138 | $result2 = mysql_query($sql, $db);
|
---|
1139 | if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
|
---|
1140 | {
|
---|
1141 | echo "\n<table width=100% border=0 cellpadding=0>\n".
|
---|
1142 | "<tr>\n".
|
---|
1143 | " <td width=75%><font size=-1><b>Function Name</b></font></td>\n".
|
---|
1144 | " <td><font size=-1><b>State</b></font></td>\n".
|
---|
1145 | "</tr>\n";
|
---|
1146 | while ($aFunction = mysql_fetch_array($result2))
|
---|
1147 | {
|
---|
1148 | echo "<tr>\n".
|
---|
1149 | " <td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
|
---|
1150 | " <td><font size=-1 color=\"#".$aFunction["color"]."\">".$aFunction["state"]."</font></td>\n".
|
---|
1151 | "</tr>\n";
|
---|
1152 | }
|
---|
1153 | echo "\n</table>\n";
|
---|
1154 | }
|
---|
1155 | else
|
---|
1156 | Odin32DBSqlError($sql);
|
---|
1157 | }
|
---|
1158 | else
|
---|
1159 | {
|
---|
1160 | echo "Click <a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fFunctions=1";
|
---|
1161 | if ($fFiles) echo "&fFiles=".$fFiles;
|
---|
1162 | if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups;
|
---|
1163 | if ($fAuthors) echo "&fAuthors=".$fAuthors;
|
---|
1164 | if ($fSortByState) echo "&fSortByState=".$fSortByState;
|
---|
1165 | echo "\">here</a> to see all functions.\n";
|
---|
1166 | }
|
---|
1167 |
|
---|
1168 |
|
---|
1169 | /*
|
---|
1170 | * API Groups
|
---|
1171 | */
|
---|
1172 | if ($cAPIGroups > 0)
|
---|
1173 | {
|
---|
1174 | Odin32DBNaslov($aContent, "API Groups", "apigroups");
|
---|
1175 | if ($fAPIGroups)
|
---|
1176 | {
|
---|
1177 | $sql = sprintf("SELECT\n".
|
---|
1178 | " g.name AS name,\n".
|
---|
1179 | " g.refcode AS refcode,\n".
|
---|
1180 | " COUNT(f.refcode) AS functions\n".
|
---|
1181 | "FROM\n".
|
---|
1182 | " apigroup g\n".
|
---|
1183 | " LEFT OUTER JOIN function fn ON fn.apigroup = g.refcode AND fn.file = %d\n".
|
---|
1184 | "GROUP BY g.refcode\n".
|
---|
1185 | "ORDER BY g.name\n",
|
---|
1186 | $iRefcode);
|
---|
1187 | $result2 = mysql_query($sql, $db);
|
---|
1188 | if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
|
---|
1189 | {
|
---|
1190 | echo "\n<table width=100% border=0 cellpadding=0>\n".
|
---|
1191 | "<tr>\n".
|
---|
1192 | " <td width=75%><font size=-1><b>Group Name</b></font></td>\n".
|
---|
1193 | " <td align=right><font size=-1><b>Functions</b></font></td>\n".
|
---|
1194 | "</tr>\n";
|
---|
1195 | while ($aFunction = mysql_fetch_array($result2))
|
---|
1196 | {
|
---|
1197 | echo "<tr>\n".
|
---|
1198 | " <td><font size=-1><a href=\"Odin32DB.phtml?filerefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
|
---|
1199 | " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
|
---|
1200 | "</tr>\n";
|
---|
1201 | }
|
---|
1202 | echo "\n</table>\n";
|
---|
1203 | }
|
---|
1204 | else
|
---|
1205 | Odin32DBSqlError($sql);
|
---|
1206 | }
|
---|
1207 | else
|
---|
1208 | {
|
---|
1209 | echo "Click <a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fAPIGroups=1";
|
---|
1210 | if ($fFunctions) echo "&fFunctions=".$fFunctions;
|
---|
1211 | if ($fFiles) echo "&fFiles=".$fFiles;
|
---|
1212 | if ($fAuthors) echo "&fAuthors=".$fAuthors;
|
---|
1213 | if ($fSortByState) echo "&fSortByState=".$fSortByState;
|
---|
1214 | echo "\">here</a> to see all the API Groups.\n";
|
---|
1215 | }
|
---|
1216 | }
|
---|
1217 |
|
---|
1218 |
|
---|
1219 | /*
|
---|
1220 | * Authors
|
---|
1221 | */
|
---|
1222 | Odin32DBNaslov($aContent, "Authors", "authors");
|
---|
1223 | if ($fAuthors)
|
---|
1224 | {
|
---|
1225 | $sql = sprintf("SELECT\n".
|
---|
1226 | " a.name AS name,\n".
|
---|
1227 | " a.refcode AS refcode,\n".
|
---|
1228 | " COUNT(f.refcode) AS functions\n".
|
---|
1229 | "FROM\n".
|
---|
1230 | " fnauthor fa\n".
|
---|
1231 | " JOIN function f\n".
|
---|
1232 | " JOIN author a\n".
|
---|
1233 | "WHERE\n".
|
---|
1234 | " f.file = %d AND\n".
|
---|
1235 | " fa.function = f.refcode AND\n".
|
---|
1236 | " fa.author = a.refcode\n".
|
---|
1237 | "GROUP BY a.refcode\n".
|
---|
1238 | "ORDER BY a.name\n",
|
---|
1239 | $iRefcode
|
---|
1240 | );
|
---|
1241 | $result2 = mysql_query($sql, $db);
|
---|
1242 | if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
|
---|
1243 | {
|
---|
1244 | echo "\n<table width=100% border=0 cellpadding=0>\n".
|
---|
1245 | "<tr>\n".
|
---|
1246 | " <td width=75%><font size=-1><b>Author</b></font></td>\n".
|
---|
1247 | " <td align=right><font size=-1><b>Functions</b></font></td>\n".
|
---|
1248 | "</tr>\n";
|
---|
1249 | while ($aFunction = mysql_fetch_array($result2))
|
---|
1250 | {
|
---|
1251 | echo "<tr>\n".
|
---|
1252 | " <td><font size=-1><a href=\"Odin32DB.phtml?authorrefcode=".$aFunction["refcode"]."&dll=".$iRefcode."\">".$aFunction["name"]."</a></font></td>\n".
|
---|
1253 | " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
|
---|
1254 | "</tr>\n";
|
---|
1255 | }
|
---|
1256 | echo "\n</table>\n";
|
---|
1257 | }
|
---|
1258 | else
|
---|
1259 | Odin32DBSqlError($sql);
|
---|
1260 | }
|
---|
1261 | else
|
---|
1262 | {
|
---|
1263 | echo "Click <a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fAuthors=1";
|
---|
1264 | if ($fFunctions) echo "&fFunctions=".$fFunctions;
|
---|
1265 | if ($fFiles) echo "&fFiles=".$fFiles;
|
---|
1266 | if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups;
|
---|
1267 | if ($fSortByState) echo "&fSortByState=".$fSortByState;
|
---|
1268 | echo "\">here</a> to see all authors.\n";
|
---|
1269 | }
|
---|
1270 | }
|
---|
1271 | else
|
---|
1272 | {
|
---|
1273 | echo "<p> No data! Invalid refcode? </p>";
|
---|
1274 | Odin32DBSqlError($sql);
|
---|
1275 | }
|
---|
1276 | }
|
---|
1277 |
|
---|
1278 |
|
---|
1279 |
|
---|
1280 |
|
---|
1281 |
|
---|
1282 |
|
---|
1283 |
|
---|
1284 | /* TEXT FORMATTING OVERLOADS */
|
---|
1285 | /* TEXT FORMATTING OVERLOADS */
|
---|
1286 | /* TEXT FORMATTING OVERLOADS */
|
---|
1287 |
|
---|
1288 | /**
|
---|
1289 | * Makes the contents for this page.
|
---|
1290 | * @sketch Writes the headers present in the contents array.
|
---|
1291 | */
|
---|
1292 | function DBWriteContents(&$aContent)
|
---|
1293 | {
|
---|
1294 | TocBeg();
|
---|
1295 | for ($i = 0; $i < sizeof($aContent); $i += 2)
|
---|
1296 | AnchNaslov($aContent[$i], $aContent[$i + 1], "");
|
---|
1297 | TocEnd();
|
---|
1298 | }
|
---|
1299 |
|
---|
1300 | /**
|
---|
1301 | * Forwarder which also maintains the contents array.
|
---|
1302 | */
|
---|
1303 | function Odin32DBNaslov(&$aContent, $sFull, $sShort)
|
---|
1304 | {
|
---|
1305 | $aContent[] = $sFull;
|
---|
1306 | $aContent[] = $sShort;
|
---|
1307 | return Naslov($sFull, $sShort);
|
---|
1308 | }
|
---|
1309 |
|
---|
1310 |
|
---|
1311 |
|
---|
1312 | ?>
|
---|
1313 |
|
---|