source: trunk/tools/database/www/Odin32DBHelpers.php3@ 3903

Last change on this file since 3903 was 3903, checked in by bird, 25 years ago

First preview? Most pages are completed.

File size: 91.3 KB
Line 
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 */
16function 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 if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) < 1)
30 {
31 echo "<br>Odin32DBComputeCompletion: IPE no. 1 <br>";
32 return -1;
33 }
34 $row = mysql_fetch_row($result);
35 $iComplete = $row[0];
36 mysql_free_result($result);
37}
38
39
40/**
41 * Draws a completion bar for a Function.
42 * @param $iFunction Function reference code.
43 * @param $iFunctionName Function name.
44 * @param $db Database connection variable.
45 * @sketch Call Odin32DBCompletionBar2 with an appropriate condition.
46 * @status Completely implemented
47 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
48 */
49function Odin32DBCompletionBarFunction($iFunction, $sFunctionName, $db)
50{
51 return Odin32DBcompletionBar2("refcode = ".$iFunction, $sFunctionName, $db);
52}
53
54
55/**
56 * Draws a completion bar for a dll (or all dlls).
57 * @param $iDll Dll reference code.
58 * If < 0 then for the entire project.
59 * @param $iDllName Dll name.
60 * @param $db Database connection variable.
61 * @sketch Call Odin32DBCompletionBar2 with an appropriate condition.
62 * @status Completely implemented
63 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
64 */
65function Odin32DBCompletionBarDll($iDll, $sDllName, $db)
66{
67 if ($iDll < 0)
68 return Odin32DBcompletionBar2("", $sDllName, $db);
69 return Odin32DBcompletionBar2("dll = ".$iDll, $sDllName, $db);
70}
71
72/**
73 * Draws a completion bar for a File.
74 * @param $iFile File reference code.
75 * @param $iFileName File name.
76 * @param $db Database connection variable.
77 * @sketch Call Odin32DBCompletionBar2 with an appropriate condition.
78 * @status Completely implemented
79 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
80 */
81function Odin32DBCompletionBarFile($iFile, $sFileName, $db)
82{
83 return Odin32DBcompletionBar2("file = ".$iFile, $sFileName, $db);
84}
85
86/**
87 * Draws a completion bar for an API Group.
88 * @param $iAPIGroup API Group reference code.
89 * @param $iAPIGroupName API Group name.
90 * @param $db Database connection variable.
91 * @sketch Call Odin32DBCompletionBar2 with an appropriate condition.
92 * @status Completely implemented
93 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
94 */
95function Odin32DBCompletionBarAPIGroup($iAPIGroup, $sAPIGroupName, $db)
96{
97 return Odin32DBcompletionBar2("apigroup = ".$iAPIGroup, $sAPIGroupName, $db);
98}
99
100/**
101 * Draws a completion bar for an Author.
102 * @param $iAuthor Author reference code.
103 * @param $iAuthorName Author name.
104 * @param $db Database connection variable.
105 * @sketch Call Odin32DBCompletionBar2 with an appropriate condition.
106 * @status Completely implemented
107 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
108 */
109function Odin32DBCompletionBarAuthor($iAuthor, $sAuthorName, $db)
110{
111 /*
112 * Count the total number of functions in the DLL.
113 */
114 $sql = "SELECT COUNT(*) FROM fnauthor fa JOIN function f\n".
115 "WHERE fa.function = f.refcode AND fa.author = ".$iAuthor;
116 if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) < 1)
117 {
118 printf("\n\n<br>Odin32DBCompletionBar2: IPE(1).<br>\n\n");
119 return -1;
120 }
121 $row = mysql_fetch_row($result);
122 $cFunctions = $row[0];
123 mysql_free_result($result);
124
125
126 /*
127 * Make
128 */
129 echo "
130 <table width=100% border=0 cellspacing=0 cellpadding=0>
131 ";
132 if ($sAuthorName != '')
133 echo "
134 <tr>
135 <td width=90%>
136 <font size=-1 color=000099>
137 <tt>".$sAuthorName."</tt>
138 </font>
139 </td>
140 <td width=10%></td>
141 </tr>";
142 echo "
143 <tr>
144 <td width=90%>
145 <table width=100% border=0 cellspacing=0 cellpadding=0>
146 <tr>
147 ";
148
149
150 /*
151 * Get states and make bar.
152 */
153 $sql = "SELECT\n".
154 " COUNT(f.refcode) AS count,\n".
155 " f.state AS state,\n".
156 " s.color AS color,\n".
157 " s.weight AS weight\n".
158 "FROM\n".
159 " fnauthor fa,\n".
160 " function f,\n".
161 " state s\n".
162 "WHERE\n".
163 " fa.author = ".$iAuthor." AND\n".
164 " fa.function = f.refcode AND\n".
165 " f.state = s.refcode\n".
166 "GROUP BY f.state\n".
167 "ORDER BY state\n";
168 $rdCompletePercent = 0.0;
169 if (!($result = mysql_query($sql, $db)))
170 Odin32DBSqlError($sql);
171 else if (mysql_num_rows($result) < 1)
172 {
173 echo "
174 <td colspan=2 bgcolor=dddddd>
175 <font size=-1>
176 &nbsp;
177 </font>
178 </td>
179 ";
180 }
181 else
182 {
183 while ($row = mysql_fetch_row($result))
184 {
185 $iPercent = (int)($row[0] * 90 /* 10% is reserved to % */ / $cFunctions);
186 if ($iPercent == 0)
187 $iPercent = 1;
188 echo "
189 <td width=".$iPercent." bgcolor=".$row[2].">
190 <font size=-1>
191 &nbsp;
192 </font>
193 </td>
194 ";
195
196 $rdCompletePercent += ((double)$row[3] * (double)$row[0]) / $cFunctions;
197 }
198
199 }
200 mysql_free_result($result);
201
202 /*
203 * Complete bar with a total completion percent.
204 */
205 echo "
206 <td width=10% align=right>
207 <font size=-1 color=000099>
208 ".(int)$rdCompletePercent."%
209 </font>
210 </td>
211 </tr>
212 </table>
213 </td>
214 </tr>
215 </table>
216 ";
217
218}
219
220/**
221 * Draws a completion bar.
222 * @param $iDll Dll reference code.
223 * If < 0 then for the entire project.
224 * @param $db Database connection variable.
225 * @sketch Get total number of function in the dll.
226 * Get the number of function per status. (+state color)
227 * Draw bar.
228 * @status Completely implemented
229 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
230 */
231function Odin32DBCompletionBar2($sCondition, $sName, $db)
232{
233 /*
234 * Count the total number of functions in the DLL.
235 */
236 $sql = "SELECT COUNT(*) FROM function f";
237 if ($sCondition != "") $sql = $sql." WHERE f.".$sCondition;
238 if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) < 1)
239 {
240 printf("\n\n<br>Odin32DBCompletionBar2: IPE(1).<br>\n\n");
241 Odin32DBSqlError($sql);
242 return -1;
243 }
244 $row = mysql_fetch_row($result);
245 $cFunctions = $row[0];
246 mysql_free_result($result);
247
248
249 /*
250 * Make
251 */
252 echo "
253 <table width=100% border=0 cellspacing=0 cellpadding=0>
254 ";
255 if ($sName != '')
256 echo "
257 <tr>
258 <td width=90%>
259 <font size=-1 color=000099>
260 <tt>".$sName."</tt>
261 </font>
262 </td>
263 <td width=10%></td>
264 </tr>";
265 echo "
266 <tr>
267 <td width=90%>
268 <table width=100% border=0 cellspacing=0 cellpadding=0>
269 <tr>
270 ";
271
272
273 /*
274 * Get states and make bar.
275 */
276 if ($sCondition != "") $sCondition = "f.".$sCondition." AND";
277 $sql = "SELECT\n".
278 " COUNT(f.refcode) AS count,\n".
279 " f.state AS state,\n".
280 " s.color AS color,\n".
281 " s.weight AS weight\n".
282 "FROM\n".
283 " function f,\n".
284 " state s\n".
285 "WHERE\n".
286 " ".$sCondition."\n".
287 " s.refcode = f.state\n".
288 "GROUP BY f.state\n".
289 "ORDER BY state\n";
290 $rdCompletePercent = 0.0;
291 if (!($result = mysql_query($sql, $db)))
292 Odin32DBSqlError($sql);
293 else if (mysql_num_rows($result) < 1)
294 {
295 echo "
296 <td colspan=2 bgcolor=dddddd>
297 <font size=-1>
298 &nbsp;
299 </font>
300 </td>
301 ";
302
303 }
304 else
305 {
306 while ($row = mysql_fetch_row($result))
307 {
308 $iPercent = (int)($row[0] * 90 /* 10% is reserved to % */ / $cFunctions);
309 if ($iPercent == 0)
310 $iPercent = 1;
311 echo "
312 <td width=".$iPercent." bgcolor=".$row[2].">
313 <font size=-1>
314 &nbsp;
315 </font>
316 </td>
317 ";
318
319 $rdCompletePercent += ((double)$row[3] * (double)$row[0]) / $cFunctions;
320 }
321
322 }
323 mysql_free_result($result);
324
325 /*
326 * Complete bar with a total completion percent.
327 */
328 echo "
329 <td width=10% align=right>
330 <font size=-1 color=000099>
331 ".(int)$rdCompletePercent."%
332 </font>
333 </td>
334 </tr>
335 </table>
336 </td>
337 </tr>
338 </table>
339 ";
340}
341
342
343/**
344 * Draws a legend for status colors.
345 * @param $db Database connection variable.
346 * @sketch Get status codes; fetch name and color.
347 *
348 *
349 * @status Completely implemented
350 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
351 */
352function Odin32DBStateLegend($db)
353{
354 /*
355 * Count the total number of functions in the DLL.
356 */
357 $sql = "SELECT
358 name,
359 color
360 FROM
361 state
362 ORDER BY refcode";
363 if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) < 1)
364 {
365 printf("\n\n<br>Odin32DBStateLegned: IPE(1).<br>\n\n");
366 return -1;
367 }
368 else
369 {
370 echo "
371 <tr><td></td></tr>
372 <tr>
373 <td>
374 <center><B><font face=\"WarpSans, Arial\" color=\"#990000\">
375 Status Legend:
376 </font></b></center>
377 </td>
378 </tr>
379 <tr>
380 <td>
381 <table width=100% border=0 cellspacing=2 cellpadding=0 align=right>
382 ";
383 while ($row = mysql_fetch_row($result))
384 {
385 if (1)
386 {
387 echo "
388 <tr>
389 <td width=85% align=right>
390 <font size=1 color=000099>
391 ".$row[0]."
392 </font>
393 </td>
394 <td width=15% bgcolor=".$row[1].">
395 <font size=-1>
396 &nbsp;<br>
397 &nbsp;
398 </font>
399 </td>
400 </tr>
401 ";
402 }
403 else
404 {
405 echo "
406 <tr>
407 <td align=left bgcolor=".$row[1].">
408 <font size=1 color=000000>
409 ".$row[0]."
410 </font>
411 </td>
412 </tr>
413 ";
414 }
415 }
416
417 echo "
418 </table>
419 </p>
420 </td>
421 </tr>
422 ";
423 }
424
425
426 mysql_free_result($result);
427}
428
429
430/**
431 * Dump an SQL statement in HTML.
432 *
433 * @returns nothing.
434 * @param $sql Sql to display.
435 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
436 */
437function Odin32DBSqlError($sql)
438{
439 echo "<p><font size=1 face=\"courier\">
440 SQL-Error:<br>
441 ".mysql_error()."
442 <br>
443 </font>
444 </p>
445 ";
446
447 echo "<p><font size=1 face=\"courier\">
448 SQL:<br>
449 ".str_replace(" ", "&nbsp;", str_replace("\n", "<br>\n", $sql))."
450 <br>
451 </font>
452 </p>
453 ";
454}
455
456
457/**
458 *
459 * @returns
460 * @param $sName
461 * @param $array Result array.
462 * @param $sValueName Name in the $array for the value.
463 * @param $sRefName Name in the $array for the reference.
464 * @param $sOdin32DBArg Odin32DB.phtml argument.
465 * @param $sNullText Null text (if the array element is NULL display this).
466 * @param $sPostText Text to insert after the value.
467 *
468 */
469function Odin32DBInfoRow1($sName, $array, $sValueName, $sRefName, $sOdin32DBArg, $sNullText, $sPostText)
470{
471 echo "
472 <tr>
473 <td width=35%><tt>".$sName."</tt></td>
474 <td valign=top>";
475 if (isset($array[$sValueName]))
476 {
477 if ($sRefName != "" && isset($array[$sRefName]) && $sOdin32DBArg != "")
478 {
479 echo "<a href=\"Odin32DB.phtml?".$sOdin32DBArg."=".$array[$sRefName]."\">";
480 $sPostText = "</a>".$sPostText;
481 }
482 echo $array[$sValueName];
483 echo $sPostText;
484 }
485 else if ($sNullText != "")
486 echo "<i>".$sNullText."</i>";
487
488 echo "
489 </td>
490 <tr>\n";
491}
492
493
494/**
495 *
496 * @returns
497 * @param $sName
498 * @param $sValue Value.
499 * @param $sRef Reference.
500 * @param $sOdin32DBArg Odin32DB.phtml argument.
501 * @param $sNullText Null text (if the array element is NULL display this).
502 * @param $sPostText Text to insert after the value.
503 *
504 */
505function Odin32DBInfoRow1NoArray($sName, $sValue, $sRef, $sOdin32DBArg, $sNullText, $sPostText)
506{
507 echo "
508 <tr>
509 <td width=35%><tt>".$sName."</tt></td>
510 <td valign=top>";
511 if (isset($sValue) && $sValue != "")
512 {
513 if (isset($sRef) && $sRef != "" && $sOdin32DBArg != "")
514 {
515 echo "<a href=\"Odin32DB.phtml?".$sOdin32DBArg."=".$sRef."\">";
516 $sPostText = "</a>".$sPostText;
517 }
518 echo $sValue.$sPostText;
519 }
520 else if ($sNullText != "")
521 echo "<i>".$sNullText."</i>";
522
523 echo "
524 </td>
525 <tr>\n";
526}
527
528
529
530/**
531 *
532 * @returns
533 * @param $sName
534 * @param $array Result array.
535 * @param $sValueName1 Name in the $array for the value.
536 * @param $sRefName1 Name in the $array for the reference.
537 * @param $sOdin32DBArg1 Odin32DB.phtml argument.
538 * @param $sNullText Null text (if the array element is NULL display this).
539 * @param $sPostText Text to insert after the value.
540 * @param $sValueName2 Name in the $array for the value.
541 * @param $sRefName2 Name in the $array for the reference.
542 * @param $sOdin32DBArg2 Odin32DB.phtml argument.
543 *
544 */
545function Odin32DBInfoRow2($sName, $array, $sValueName1, $sRefName1, $sOdin32DBArg1, $sNullText, $sPostText,
546 $sValueName2, $sRefName2, $sOdin32DBArg2)
547{
548 echo "
549 <tr>
550 <td width=35%><tt>".$sName."</tt></td>
551 <td valign=top>";
552 if (isset($array[$sValueName1]))
553 {
554 if ($sRefName1 != "" && isset($array[$sRefName1]) && $sOdin32DBArg1 != "")
555 {
556 echo "<a href=\"Odin32DB.phtml?".$sOdin32DBArg1."=".$array[$sRefName1]."\">";
557 $sPostText = "</a>".$sPostText;
558 }
559 echo $array[$sValueName1];
560 echo $sPostText;
561
562 if (isset($array[$sValueName2]))
563 {
564 if ($sRefName2 != "" && isset($array[$sRefName2]) && $sOdin32DBArg2 != "")
565 {
566 echo "<a href=\"Odin32DB.phtml?".$sOdin32DBArg2."=".$array[$sRefName2]."\">";
567 echo $array[$sValueName2]."</a>";
568 }
569 else
570 echo $array[$sValueName2];
571 }
572 }
573 else if ($sNullText != "")
574 echo "<i>".$sNullText."</i>";
575
576 echo "</td>
577 <tr>\n";
578}
579
580
581
582/**
583 * Inserts a documentation row from database..
584 * @param $sName Name of the information.
585 * @param $array DB result array.
586 * @param $sValueName Name in the DB result array.
587 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
588 * @remark Displays <i>not available</i> if empty field.
589 */
590function Odin32DBDocRow1($sName, $array, $sValueName)
591{
592 PodNaslov($sName);
593 if (isset($array[$sValueName]))
594 {
595 echo $array[$sValueName];
596 }
597 else
598 echo "<i>not available</i>";
599}
600
601
602/**
603 * Using (Odin32DB)Naslov.
604 * Inserts a documentation row from database..
605 * @param $sName Name of the information.
606 * @param $sLabel Section label.
607 * @param $array DB result array.
608 * @param $sValueName Name in the DB result array.
609 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
610 * @remark Displays <i>not available</i> if empty field.
611 */
612function Odin32DBDocRow(&$aContent, $sName, $sLabel, $array, $sValueName)
613{
614 Odin32DBNaslov($aContent, $sName, $sLabel);
615 if (isset($array[$sValueName]))
616 {
617 echo $array[$sValueName];
618 }
619 else
620 echo "<i>not available</i>";
621}
622
623
624/* NAVIGATION */
625/* NAVIGATION */
626/* NAVIGATION */
627
628/**
629 * Make top of page navigation stuff for the Odin32 database pages.
630 * @param $sExpand Expand arguments.
631 * @param $sCollapse Collapse arguments.
632 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
633 */
634function Odin32DBNavigationTop($sExpand, $sCollapse)
635{
636 echo "\n<center><font size=1>\n";
637
638 echo "<a href=\"Odin32DB.phtml\">Root</a>\n".
639 " - <a href=\"Odin32DB.phtml?dlls=1\">Dlls</a>\n".
640 " - <a href=\"Odin32DB.phtml?authors=1\">Authors</a>\n".
641 " - <a href=\"Odin32DB.phtml?apigroups=1\">API Groups</a>\n";
642
643 if ($sExpand != "" && $sCollapse != "")
644 {
645 echo "<br><a href=\"Odin32DB.phtml?".$sExpand."\">Expand</a> - \n".
646 "<a href=\"Odin32DB.phtml?".$sCollapse."\">Collapse</a>\n";
647 }
648
649 echo "</font></center>\n";
650}
651
652
653/**
654 * Make bottom of page navigation stuff for the Odin32 database pages.
655 * @param $sExpand Expand arguments.
656 * @param $sCollapse Collapse arguments.
657 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
658 */
659function Odin32DBNavigationBottom($sExpand, $sCollapse)
660{
661 echo "\n<p><br><center>\n".
662 "<font size=1>\n";
663
664 if ($sExpand != "" && $sCollapse != "")
665 {
666 echo "<a href=\"Odin32DB.phtml?".$sExpand."\">Expand</a> - \n".
667 "<a href=\"Odin32DB.phtml?".$sCollapse."\">Collapse</a><br>\n";
668 }
669
670 echo
671 "<a href=\"Odin32DB.phtml\">Root</a>\n".
672 " - <a href=\"Odin32DB.phtml?dlls=1\">Dlls</a>\n".
673 " - <a href=\"Odin32DB.phtml?authors=1\">Authors</a>\n".
674 " - <a href=\"Odin32DB.phtml?apigroups=1\">API Groups</a>\n";
675 echo "</font></<center>\n";
676}
677
678
679
680/* INFO OUTPUT */
681/* INFO OUTPUT */
682/* INFO OUTPUT */
683
684
685/**
686 * Writes standard function info.
687 *
688 * @returns void
689 * @param $aContent Contents array. (input/output)
690 * @param $db Database handle.
691 * @param $iRefcode Function reference code.
692 * @sketch
693 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
694 * @remark
695 */
696function Odin32DBFunctionInfo(&$aContent, $db, $iRefcode)
697{
698 Odin32DBNavigationTop("","");
699
700 $sql = sprintf("SELECT\n".
701 " f.name AS name,\n".
702 " f.intname AS intname,\n".
703 " f.ordinal AS ordinal,\n".
704 " f.return AS return,\n".
705 " f.description AS description,\n".
706 " f.remark AS remark,\n".
707 " f.returndesc AS returndesc,\n".
708 " f.sketch AS sketch,\n".
709 " f.equiv AS equiv,\n".
710 " f.time AS time,\n".
711 " g.name AS apigroupname,\n".
712 " g.refcode AS apigrouprefcode,\n".
713 " a.name AS aliasname,\n".
714 " a.refcode AS aliasrefcode,\n".
715 " ad.name AS aliasdllname,\n".
716 " ad.refcode AS aliasdllrefcode,\n".
717 " d.name AS dllname,\n".
718 " d.refcode AS dllrefcode,\n".
719 " i.name AS filename,\n".
720 " i.refcode AS filerefcode,\n".
721 " s.name AS state,\n".
722 " c.description AS type\n".
723 "FROM\n".
724 " function f\n".
725 " LEFT OUTER JOIN function a ON f.aliasfn = a.refcode\n".
726 " LEFT OUTER JOIN dll ad ON a.dll = ad.refcode\n".
727 " LEFT OUTER JOIN apigroup g ON f.apigroup = g.refcode\n".
728 " LEFT JOIN dll d ON f.dll = d.refcode\n".
729 " LEFT JOIN state s ON f.state = s.refcode\n".
730 " LEFT OUTER JOIN file i ON f.file = i.refcode\n".
731 " LEFT JOIN code c ON f.type = c.code\n".
732 "WHERE\n".
733 " c.codegroup = 'FTYP' AND\n".
734 " f.refcode = %d",
735 $iRefcode);
736 if (($result = mysql_query($sql, $db)) && @mysql_num_rows($result) > 0 && ($array = mysql_fetch_array($result)))
737 {
738 /*
739 * General
740 */
741 Odin32DBNaslov($aContent, "General", "general");
742 echo "\n<table width=100% border=3 cellpadding=0>\n";
743 Odin32DBInfoRow1("Name", $array, "name","","","","");
744 if (isset($array["intname"]))
745 Odin32DBInfoRow1("Internal Name", $array, "intname","","","","");
746 else
747 Odin32DBInfoRow1("Internal Name", $array, "name","","","","");
748 Odin32DBInfoRow1("Type", $array, "type", "", "","invalid","");
749 Odin32DBInfoRow1("State", $array, "state", "", "","invalid","");
750 Odin32DBInfoRow1("Dll", $array, "dllname", "dllrefcode", "dllrefcode","","");
751 Odin32DBInfoRow1("Ordinal", $array, "ordinal","","","not available","");
752 if (isset($array["apigroupname"]))
753 Odin32DBInfoRow1("API Group", $array, "apigroupname", "apigrouprefcode", "apigrouprefcode","","");
754 Odin32DBInfoRow1("File", $array, "filename", "filerefcode", "filerefcode","not available","");
755 if (isset($array["aliasrefcode"]))
756 Odin32DBInfoRow2("Forwards", $array, "aliasdllname", "aliasdllrefcode", "dllrefcode","",".",
757 "aliasname", "aliasrefcode", "functionrefcode");
758 else
759 {
760 $sql = sprintf("SELECT\n".
761 " d.name AS dllname,\n".
762 " d.refcode AS dllrefcode,\n".
763 " f.name AS fnname,\n".
764 " f.refcode AS fnrefcode\n".
765 "FROM\n".
766 " function f,\n".
767 " dll d\n".
768 "WHERE\n".
769 " f.aliasfn = %d AND\n".
770 " f.dll = d.refcode\n".
771 "ORDER BY d.name, f.name\n",
772 $iRefcode);
773 if (($result2 = mysql_query($sql, $db)))
774 {
775 if (mysql_num_rows($result2) > 0)
776 {
777 $sValue = "";
778 $f = 0;
779 while ($aAlias = mysql_fetch_array($result2))
780 {
781 if ($f) $sValue = $sValue."<br>";
782 else $f = 1;
783 $sValue = $sValue."<a href=\"Odin32DB.phtml?dllrefcode=".
784 $aAlias["dllrefcode"]."\">".$aAlias["dllname"]."</a>.".
785 "<a href=\"Odin32DB.phtml?functionrefcode=".
786 $aAlias["fnrefcode"]."\">".$aAlias["fnname"]."</a>";
787 }
788 Odin32DBInfoRow1NoArray("Forwarded as", $sValue, "","","","");
789 }
790 }
791 else
792 Odin32DBSqlError($sql);
793 }
794 echo "\n</table>\n";
795
796 /*
797 * Completion
798 */
799 Odin32DBNaslov($aContent, "Completion", "completion");
800 Odin32DBCompletionBarFunction($iRefcode, "", $db);
801
802
803 /*
804 * Declaration
805 */
806 Odin32DBNaslov($aContent, "Declaration", "declaration");
807 echo "\n<pre>";
808 if (isset($array["return"]))
809 echo $array["return"]." ";
810 echo $array["name"]."(";
811 $sql = sprintf("SELECT\n".
812 " name AS name,\n".
813 " type AS type,\n".
814 " description AS description\n".
815 "FROM\n".
816 " parameter\n".
817 "WHERE\n".
818 " function = %d\n".
819 "ORDER BY sequencenbr",
820 $iRefcode);
821 if (($result2 = mysql_query($sql, $db)) && ($cParams = mysql_num_rows($result2)) > 0)
822 {
823 while ($param = mysql_fetch_array($result2))
824 {
825 if (--$cParams == 0)
826 printf("\n %-20s %s", $param["type"], $param["name"]);
827 else
828 printf("\n %-20s %s,", $param["type"], $param["name"]);
829 }
830 }
831 else
832 echo "void";
833
834 echo ");\n";
835 echo "</pre>\n";
836
837 /*
838 * Description
839 */
840 Odin32DBDocRow($aContent, "Description", "desc", $array, "description");
841
842
843 /*
844 * Parameters
845 */
846 Odin32DBNaslov($aContent, "Parameters", "params");
847 if ($result2 && mysql_num_rows($result2) > 0 && mysql_data_seek($result2, 0))
848 {
849 while ($param = mysql_fetch_array($result2))
850 {
851 echo "\n<dt><b>".$param["name"].":</b></dt>\n";
852 if (isset($param["description"]))
853 {
854 if (1)
855 {
856 echo "\n <table width=100% border=0 cellpadding=0>\n";
857 echo " <tr><td width=10%>&nbsp;</td>\n";
858 $sDescription = str_replace("<BR>", "", str_replace("<BR><BR>\n","<br>",$param["description"]));
859 echo " <td width=90%><font size=-1>".$sDescription."</font></td></tr>\n";
860 echo "\n</table>\n";
861 }
862 else
863 {
864 $sDescription = str_replace("<BR>", "", str_replace("<BR><BR>\n","<br>",$param["description"]));
865 echo "<dd><font size=-1>".$sDescription."</font></dd>\n\n";
866 }
867 }
868 echo "<p>\n";
869 }
870 }
871 else
872 echo "void";
873
874
875 /*
876 * Returns
877 */
878 Odin32DBDocRow($aContent, "Returns", "return", $array, "returndesc");
879
880 /*
881 * Sketch/Algorithm
882 */
883 Odin32DBDocRow($aContent, "Sketch/Algorithm", "sketch", $array, "sketch");
884
885 /*
886 * Remark
887 */
888 Odin32DBDocRow($aContent, "Remarks", "remark", $array, "remark");
889
890 /*
891 * Authors
892 */
893 Odin32DBNaslov($aContent, "Authors", "Authors");
894 $sql = sprintf("SELECT\n".
895 " a.name AS name,\n".
896 " a.refcode AS refcode\n".
897 "FROM\n".
898 " fnauthor fa\n".
899 " JOIN function f\n".
900 " JOIN author a\n".
901 "WHERE\n".
902 " f.refcode = %d AND\n".
903 " fa.function = f.refcode AND\n".
904 " fa.author = a.refcode\n".
905 "ORDER BY a.name",
906 $iRefcode);
907 if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0)
908 {
909 while ($author = mysql_fetch_array($result2))
910 echo "<a href=\"Odin32DB.phtml?authorrefcode=".$author["refcode"]."\">".$author["name"]."</a><br>\n";
911 }
912 else
913 echo "<i>Hmm. Seems noone wrote this function...</i><br>\n";
914 }
915 else
916 {
917 echo "<p> No data! Invalid refcode? </p>";
918 Odin32DBSqlError($sql);
919 }
920 Odin32DBNavigationBottom("","");
921}
922
923
924
925/**
926 * Writes standard dll info.
927 *
928 * @returns void
929 * @param $aContent Contents array. (input/output)
930 * @param $db Database handle.
931 * @param $iRefcode Dll reference code.
932 * @param $fFunctions Flags which tells wether to list all functions or not.
933 * @param $fFiles Flags which tells wether to list all files or not.
934 * @param $fAPIGroups Flags which tells wether to list all apigroups or not.
935 * @param $fAuthors Flags which tells wether to list all authors or not.
936 * @param $fSortByState Flags which tells wether to sort functions by
937 * state and function name or just by function name.
938 * @sketch
939 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
940 * @remark
941 */
942function Odin32DBDllInfo(&$aContent, $db, $iRefcode, $fFunctions, $fFiles, $fAPIGroups, $fAuthors, $fSortByState)
943{
944 /*
945 * Navigation - TOP
946 */
947 $sExpand = "dllrefcode=".$iRefcode."&fFiles=1&fFunctions=1&fAPIGroups=1&fAuthors=1";
948 if ($fSortByState) $sExpand = $sExpand."&fSortByState=".$fSortByState;
949 $sCollapse = "dllrefcode=".$iRefcode;
950 Odin32DBNavigationTop($sExpand, $sCollapse);
951
952 /*
953 * Fetch (vital) data.
954 */
955 $sql = sprintf("SELECT\n".
956 " d.name AS name,\n".
957 " d.description AS description,\n".
958 " c.description AS type\n".
959 "FROM\n".
960 " dll d,\n".
961 " code c\n".
962 "WHERE\n".
963 " c.codegroup = 'DTYP' AND\n".
964 " d.type = c.code AND\n".
965 " d.refcode = %d",
966 $iRefcode);
967 if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) > 0 && ($array = mysql_fetch_array($result)))
968 {
969 /*
970 * General
971 */
972 Odin32DBNaslov($aContent, "General", "general");
973 echo "\n<table width=100% border=3 cellpadding=0>\n";
974 Odin32DBInfoRow1("Name", $array, "name","","","","");
975 Odin32DBInfoRow1("Description", $array, "description","","","","");
976 Odin32DBInfoRow1("Type", $array, "type","","","","");
977 $sql = sprintf("SELECT\n".
978 " COUNT(*) as functions\n".
979 "FROM\n".
980 " function\n".
981 "WHERE\n".
982 " dll = %d",
983 $iRefcode);
984 $cFunctions = 0;
985 if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0 && ($array2 = mysql_fetch_array($result2)))
986 {
987 Odin32DBInfoRow1("# Functions", $array2, "functions","","","","");
988 $cFunctions = $array2["functions"];
989 }
990
991 $sql = sprintf("SELECT\n".
992 " COUNT(*) as files\n".
993 "FROM\n".
994 " file\n".
995 "WHERE\n".
996 " dll = %d",
997 $iRefcode);
998 $cFiles = 0;
999 if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0 && ($array2 = mysql_fetch_array($result2)))
1000 {
1001 Odin32DBInfoRow1("# Source files", $array2, "files","","","","");
1002 $cFiles = $array2["files"];
1003 }
1004
1005 $sql = sprintf("SELECT\n".
1006 " COUNT(*) as apigroups\n".
1007 "FROM\n".
1008 " apigroup\n".
1009 "WHERE\n".
1010 " dll = %d",
1011 $iRefcode);
1012 $cAPIGroups = 0;
1013 if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0 && ($array2 = mysql_fetch_array($result2)))
1014 {
1015 Odin32DBInfoRow1("# API Groups", $array2, "apigroups","","","","");
1016 $cAPIGroups = $array2["apigroups"];
1017 }
1018
1019 echo "\n</table>\n";
1020
1021
1022 /*
1023 * Completion
1024 */
1025 Odin32DBNaslov($aContent, "Completion", "completion");
1026 Odin32DBCompletionBarDll($iRefcode, "", $db);
1027
1028 /*
1029 * States
1030 */
1031 Odin32DBNaslov($aContent, "Status", "status");
1032 $sql = sprintf("SELECT\n".
1033 " s.name AS state,\n".
1034 " s.color AS color,\n".
1035 " COUNT(f.state) AS functions\n".
1036 "FROM\n".
1037 " state s\n".
1038 " LEFT OUTER JOIN function f ON s.refcode = f.state AND f.dll = %d\n".
1039 "GROUP BY s.refcode\n".
1040 "ORDER BY s.refcode",
1041 $iRefcode);
1042 if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0)
1043 {
1044 echo "\n<table width=100% border=0 cellpadding=0>\n";
1045 while ($aState = mysql_fetch_array($result2))
1046 {
1047 echo "<tr>\n".
1048 " <td width=75%><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["state"]."</b></font></td>\n".
1049 " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["functions"]."</b></font></td>\n".
1050 " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".@(int)((int)$aState["functions"] * 100 / $cFunctions)."%</b></font></td>\n".
1051 "</tr>\n";
1052 }
1053
1054 echo "\n</table>\n";
1055 }
1056 else
1057 Odin32DBSqlError($sql);
1058
1059
1060 /*
1061 * Functions
1062 */
1063 Odin32DBNaslov($aContent, "Functions", "functions");
1064 if ($fFunctions)
1065 {
1066 $sql = sprintf("SELECT\n".
1067 " f.name AS name,\n".
1068 " f.refcode AS refcode,\n".
1069 " s.name AS state,\n".
1070 " s.color AS color\n".
1071 "FROM\n".
1072 " function f\n".
1073 " LEFT JOIN state s ON f.state = s.refcode\n".
1074 "WHERE\n".
1075 " f.dll = %d\n",
1076 $iRefcode);
1077 if ($fSortByState)
1078 $sql = $sql."ORDER BY s.refcode, f.name";
1079 else
1080 $sql = $sql."ORDER BY f.name";
1081 if ($result2 = mysql_query($sql, $db))
1082 {
1083 if (mysql_num_rows($result2) > 0)
1084 {
1085 echo "\n<table width=100% border=0 cellpadding=0>\n".
1086 "<tr>\n".
1087 " <td width=75%><font size=-1><b>Function Name</b></font></td>\n".
1088 " <td><font size=-1><b>State</b></font></td>\n".
1089 "</tr>\n";
1090 while ($aFunction = mysql_fetch_array($result2))
1091 {
1092 echo "<tr>\n".
1093 " <td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
1094 " <td><font size=-1 color=\"#".$aFunction["color"]."\">".$aFunction["state"]."</font></td>\n".
1095 "</tr>\n";
1096 }
1097 echo "\n</table>\n".
1098 "<p>Click <a href=\"Odin32DB.phtml#functions?dllrefcode=".$iRefcode."&fFunctions=1";
1099 if ($fFiles) echo "&fFiles=".$fFiles;
1100 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups;
1101 if ($fAuthors) echo "&fAuthors=".$fAuthors;
1102 if ($fSortByState) echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted alphabetical.<br>\n";
1103 else echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted by state.<br>\n";
1104 }
1105 else
1106 echo "<i>No Functions.</i><br>\n";
1107 }
1108 else
1109 Odin32DBSqlError($sql);
1110 }
1111 else
1112 {
1113 echo "Click <a href=\"Odin32DB.phtml#functions?dllrefcode=".$iRefcode."&fFunctions=1";
1114 if ($fFiles) echo "&fFiles=".$fFiles;
1115 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups;
1116 if ($fAuthors) echo "&fAuthors=".$fAuthors;
1117 if ($fSortByState) echo "&fSortByState=".$fSortByState;
1118 echo "\">here</a> to see all functions.\n";
1119 }
1120
1121
1122 /*
1123 * Files
1124 */
1125 Odin32DBNaslov($aContent, "Files", "files");
1126 if ($fFiles)
1127 {
1128 $sql = sprintf("SELECT\n".
1129 " f.name AS name,\n".
1130 " f.refcode AS refcode,\n".
1131 " COUNT(fn.refcode) AS functions\n".
1132 "FROM\n".
1133 " file f\n".
1134 " LEFT OUTER JOIN function fn ON fn.file = f.refcode\n".
1135 "WHERE\n".
1136 " f.dll = %d\n".
1137 "GROUP BY f.refcode\n".
1138 "ORDER BY f.name\n",
1139 $iRefcode);
1140
1141 if ($result2 = mysql_query($sql, $db))
1142 {
1143 if (mysql_num_rows($result2) > 0)
1144 {
1145 echo "\n<table width=100% border=0 cellpadding=0>\n".
1146 "<tr>\n".
1147 " <td><font size=-1><b>Filename</b></font></td>\n".
1148 " <td align=right><font size=-1><b>Functions</b></font></td>\n".
1149 "</tr>\n";
1150 while ($aFunction = mysql_fetch_array($result2))
1151 {
1152 echo "<tr>\n".
1153 " <td width=75%><font size=-1><a href=\"Odin32DB.phtml?filerefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
1154 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
1155 "</tr>\n";
1156 }
1157 echo "\n</table>\n";
1158 }
1159 else
1160 echo "<i>No Files.</i><br>\n";
1161 }
1162 else
1163 Odin32DBSqlError($sql);
1164 }
1165 else
1166 {
1167 echo "Click <a href=\"Odin32DB.phtml#files?dllrefcode=".$iRefcode."&fFiles=1";
1168 if ($fFunctions) echo "&fFunctions=".$fFunctions;
1169 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups;
1170 if ($fAuthors) echo "&fAuthors=".$fAuthors;
1171 if ($fSortByState) echo "&fSortByState=".$fSortByState;
1172 echo "\">here</a> to see all files.\n";
1173 }
1174
1175
1176 /*
1177 * API Groups
1178 */
1179 if ($cAPIGroups > 0)
1180 {
1181 Odin32DBNaslov($aContent, "API Groups", "apigroups");
1182 if ($fAPIGroups)
1183 {
1184 $sql = sprintf("SELECT\n".
1185 " g.name AS name,\n".
1186 " g.refcode AS refcode,\n".
1187 " COUNT(f.refcode) AS functions\n".
1188 "FROM\n".
1189 " apigroup g\n".
1190 " JOIN function f\n".
1191 "WHERE\n".
1192 " g.dll = %d AND\n".
1193 " f.dll = %d AND\n".
1194 " f.apigroup = g.refcode\n".
1195 "GROUP BY f.apigroup\n".
1196 "ORDER BY g.name\n",
1197 $iRefcode,
1198 $iRefcode);
1199 if ($result2 = mysql_query($sql, $db))
1200 {
1201 if (mysql_num_rows($result2) > 0)
1202 {
1203 echo "\n<table width=100% border=0 cellpadding=0>\n".
1204 "<tr>\n".
1205 " <td width=75%><font size=-1><b>Group Name</b></font></td>\n".
1206 " <td align=right><font size=-1><b>Functions</b></font></td>\n".
1207 "</tr>\n";
1208 while ($aFunction = mysql_fetch_array($result2))
1209 {
1210 echo "<tr>\n".
1211 " <td><font size=-1><a href=\"Odin32DB.phtml?apigrouprefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
1212 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
1213 "</tr>\n";
1214 }
1215 echo "\n</table>\n";
1216 }
1217 else
1218 echo "<i>No API Groups.</i><br>\n";
1219 }
1220 else
1221 Odin32DBSqlError($sql);
1222 }
1223 else
1224 {
1225 echo "Click <a href=\"Odin32DB.phtml#apigroups?dllrefcode=".$iRefcode."&fAPIGroups=1";
1226 if ($fFunctions) echo "&fFunctions=".$fFunctions;
1227 if ($fFiles) echo "&fFiles=".$fFiles;
1228 if ($fAuthors) echo "&fAuthors=".$fAuthors;
1229 if ($fSortByState) echo "&fSortByState=".$fSortByState;
1230 echo "\">here</a> to see all the API Groups.\n";
1231 }
1232 }
1233
1234
1235 /*
1236 * Authors
1237 */
1238 Odin32DBNaslov($aContent, "Authors", "authors");
1239 if ($fAuthors)
1240 {
1241 $sql = sprintf("SELECT\n".
1242 " a.name AS name,\n".
1243 " a.refcode AS refcode,\n".
1244 " COUNT(f.refcode) AS functions\n".
1245 "FROM\n".
1246 " fnauthor fa\n".
1247 " JOIN function f\n".
1248 " JOIN author a\n".
1249 "WHERE\n".
1250 " f.dll = %d AND\n".
1251 " fa.function = f.refcode AND\n".
1252 " fa.author = a.refcode\n".
1253 "GROUP BY a.refcode\n".
1254 "ORDER BY a.name\n",
1255 $iRefcode
1256 );
1257 if ($result2 = mysql_query($sql, $db))
1258 {
1259 if (mysql_num_rows($result2) > 0)
1260 {
1261 echo "\n<table width=100% border=0 cellpadding=0>\n".
1262 "<tr>\n".
1263 " <td width=75%><font size=-1><b>Author</b></font></td>\n".
1264 " <td align=right><font size=-1><b>Functions</b></font></td>\n".
1265 "</tr>\n";
1266 while ($aFunction = mysql_fetch_array($result2))
1267 {
1268 echo "<tr>\n".
1269 " <td><font size=-1><a href=\"Odin32DB.phtml?authorrefcode=".$aFunction["refcode"]."&dll=".$iRefcode."\">".$aFunction["name"]."</a></font></td>\n".
1270 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
1271 "</tr>\n";
1272 }
1273 echo "\n</table>\n";
1274 }
1275 else
1276 echo "<i>No Authors</i>.<br>\n";
1277 }
1278 else
1279 Odin32DBSqlError($sql);
1280 }
1281 else
1282 {
1283 echo "Click <a href=\"Odin32DB.phtml#authors?dllrefcode=".$iRefcode."&fAuthors=1";
1284 if ($fFunctions) echo "&fFunctions=".$fFunctions;
1285 if ($fFiles) echo "&fFiles=".$fFiles;
1286 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups;
1287 if ($fSortByState) echo "&fSortByState=".$fSortByState;
1288 echo "\">here</a> to see all authors.\n";
1289 }
1290 }
1291 else
1292 {
1293 echo "<p> No data! Invalid refcode? </p>";
1294 Odin32DBSqlError($sql);
1295 }
1296
1297 /*
1298 * Navigation - Bottom
1299 */
1300 Odin32DBNavigationBottom($sExpand, $sCollapse);
1301}
1302
1303
1304
1305/**
1306 * Writes standard file info.
1307 *
1308 * @returns void
1309 * @param $aContent Contents array. (input/output)
1310 * @param $db Database handle.
1311 * @param $iRefcode File reference code.
1312 * @param $fFunctions Flags which tells wether to list all functions or not.
1313 * @param $fAPIGroups Flags which tells wether to list all apigroups or not.
1314 * @param $fAuthors Flags which tells wether to list all authors or not.
1315 * @param $fSortByState Flags which tells wether to sort functions by
1316 * state and function name or just by function name.
1317 * @sketch
1318 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
1319 * @remark
1320 */
1321function Odin32DBFileInfo(&$aContent, $db, $iRefcode, $fFunctions, $fAPIGroups, $fAuthors, $fSortByState)
1322{
1323 /*
1324 * Navigation - TOP
1325 */
1326 $sExpand = "filerefcode=".$iRefcode."&fFiles=1&fFunctions=1&fAPIGroups=1&fAuthors=1";
1327 if ($fSortByState) $sExpand = $sExpand."&fSortByState=".$fSortByState;
1328 $sCollapse = "filerefcode=".$iRefcode;
1329 Odin32DBNavigationTop($sExpand, $sCollapse);
1330
1331 /*
1332 * Fetch (vital) data.
1333 */
1334 $sql = sprintf("SELECT\n".
1335 " f.name AS name,\n".
1336 " f.refcode AS refcode,\n".
1337 " f.lastdatetime AS lastdatetime,\n".
1338 " a.name AS lastauthorname,\n".
1339 " f.lastauthor AS lastauthorrefcode,\n".
1340 " f.revision AS revision,\n".
1341 " f.description AS description,\n".
1342 " f.dll AS dllrefcode,\n".
1343 " d.name AS dllname\n".
1344 "FROM\n".
1345 " file f,\n".
1346 " dll d,\n".
1347 " author a\n".
1348 "WHERE\n".
1349 " f.refcode = %d AND\n".
1350 " f.dll = d.refcode AND\n".
1351 " f.lastauthor= a.refcode",
1352 $iRefcode);
1353 if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) > 0 && ($array = mysql_fetch_array($result)))
1354 {
1355 /*
1356 * General
1357 */
1358 Odin32DBNaslov($aContent, "General", "general");
1359 echo "\n<table width=100% border=3 cellpadding=0>\n";
1360 Odin32DBInfoRow1("Name", $array, "name","","","","");
1361 Odin32DBInfoRow1("Revision", $array, "revision","","","","");
1362 Odin32DBInfoRow1("Changed", $array, "lastdatetime","","","","");
1363 Odin32DBInfoRow1("Last Author", $array, "lastauthorname","lastauthorrefcode","authorrefcode","","");
1364 Odin32DBInfoRow1("Dll", $array, "dllname","dllrefcode","dllrefcode","","");
1365 $sql = sprintf("SELECT\n".
1366 " COUNT(*) as functions\n".
1367 "FROM\n".
1368 " function\n".
1369 "WHERE\n".
1370 " file = %d",
1371 $iRefcode);
1372 $cFunctions = 0;
1373 if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0 && ($aFunctions = mysql_fetch_array($result2)))
1374 {
1375 Odin32DBInfoRow1("# Functions", $aFunctions, "functions","","","","");
1376 $cFunctions = $aFunctions["functions"];
1377 }
1378
1379 $sql = sprintf("SELECT\n".
1380 " COUNT(*) as functions\n".
1381 "FROM\n".
1382 " function\n".
1383 "WHERE\n".
1384 " file = %d AND\n".
1385 " apigroup IS NOT NULL\n".
1386 "GROUP BY apigroup\n",
1387 $iRefcode);
1388 $cAPIGroups = 0;
1389 if (($result2 = mysql_query($sql, $db)) && ($cAPIGroups = mysql_num_rows($result2)) > 0)
1390 Odin32DBInfoRow1NoArray("# API Groups", $cAPIGroups, "","","","");
1391 if (!$result2)
1392 Odin32DBSqlError($sql);
1393
1394 echo "\n</table>\n";
1395
1396 /*
1397 * Description
1398 */
1399 Odin32DBDocRow($aContent, "Description", "description", $array, "description");
1400
1401 /*
1402 * Completion
1403 */
1404 Odin32DBNaslov($aContent, "Completion", "completion");
1405 Odin32DBCompletionBarFile($iRefcode, "", $db);
1406
1407 /*
1408 * States
1409 */
1410 Odin32DBNaslov($aContent, "Status", "status");
1411 $sql = sprintf("SELECT\n".
1412 " s.name AS state,\n".
1413 " s.color AS color,\n".
1414 " COUNT(f.state) AS functions\n".
1415 "FROM\n".
1416 " state s\n".
1417 " LEFT OUTER JOIN function f ON s.refcode = f.state AND f.file = %d\n".
1418 "GROUP BY s.refcode\n".
1419 "ORDER BY s.refcode",
1420 $iRefcode);
1421 if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0)
1422 {
1423 echo "\n<table width=100% border=0 cellpadding=0>\n";
1424 while ($aState = mysql_fetch_array($result2))
1425 {
1426 echo "<tr>\n".
1427 " <td width=75%><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["state"]."</b></font></td>\n".
1428 " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["functions"]."</b></font></td>\n".
1429 " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".@(int)((int)$aState["functions"] * 100 / $cFunctions)."%</b></font></td>\n".
1430 "</tr>\n";
1431 }
1432
1433 echo "\n</table>\n";
1434 }
1435 else
1436 Odin32DBSqlError($sql);
1437
1438
1439 /*
1440 * Functions
1441 */
1442 Odin32DBNaslov($aContent, "Functions", "functions");
1443 if ($fFunctions)
1444 {
1445 $sql = sprintf("SELECT\n".
1446 " f.name AS name,\n".
1447 " f.refcode AS refcode,\n".
1448 " s.name AS state,\n".
1449 " s.color AS color\n".
1450 "FROM\n".
1451 " function f\n".
1452 " LEFT JOIN state s ON f.state = s.refcode\n".
1453 "WHERE\n".
1454 " f.file = %d\n",
1455 $iRefcode);
1456 if ($fSortByState)
1457 $sql = $sql."ORDER BY s.refcode, f.name";
1458 else
1459 $sql = $sql."ORDER BY f.name";
1460 if ($result2 = mysql_query($sql, $db))
1461 {
1462 if (mysql_num_rows($result2) > 0)
1463 {
1464 echo "\n<table width=100% border=0 cellpadding=0>\n".
1465 "<tr>\n".
1466 " <td width=75%><font size=-1><b>Function Name</b></font></td>\n".
1467 " <td><font size=-1><b>State</b></font></td>\n".
1468 "</tr>\n";
1469 while ($aFunction = mysql_fetch_array($result2))
1470 {
1471 echo "<tr>\n".
1472 " <td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
1473 " <td><font size=-1 color=\"#".$aFunction["color"]."\">".$aFunction["state"]."</font></td>\n".
1474 "</tr>\n";
1475 }
1476 echo "\n</table>\n".
1477 "<p>Click <a href=\"Odin32DB.phtml#functions?filerefcode=".$iRefcode."&fFunctions=1";
1478 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups;
1479 if ($fAuthors) echo "&fAuthors=".$fAuthors;
1480 if ($fSortByState) echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted alphabetical.<br>\n";
1481 else echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted by state.<br>\n";
1482 }
1483 else
1484 echo "<i>No functions found</i><br>\n";
1485 }
1486 else
1487 Odin32DBSqlError($sql);
1488 }
1489 else
1490 {
1491 echo "Click <a href=\"Odin32DB.phtml#functions?filerefcode=".$iRefcode."&fFunctions=1";
1492 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups;
1493 if ($fAuthors) echo "&fAuthors=".$fAuthors;
1494 if ($fSortByState) echo "&fSortByState=".$fSortByState;
1495 echo "\">here</a> to see all functions.\n";
1496 }
1497
1498
1499 /*
1500 * API Groups
1501 */
1502 if ($cAPIGroups > 0)
1503 {
1504 Odin32DBNaslov($aContent, "API Groups", "apigroups");
1505 if ($fAPIGroups)
1506 {
1507 $sql = sprintf("SELECT\n".
1508 " g.name AS name,\n".
1509 " g.refcode AS refcode,\n".
1510 " COUNT(f.refcode) AS functions\n".
1511 "FROM\n".
1512 " apigroup g\n".
1513 " JOIN function f\n".
1514 "WHERE\n".
1515 " f.file = %d AND\n".
1516 " f.apigroup = g.refcode\n".
1517 "GROUP BY f.apigroup\n".
1518 "ORDER BY g.name\n",
1519 $iRefcode);
1520 if ($result2 = mysql_query($sql, $db))
1521 {
1522 if (mysql_num_rows($result2) > 0)
1523 {
1524 echo "\n<table width=100% border=0 cellpadding=0>\n".
1525 "<tr>\n".
1526 " <td width=75%><font size=-1><b>Group Name</b></font></td>\n".
1527 " <td align=right><font size=-1><b>Functions</b></font></td>\n".
1528 "</tr>\n";
1529 while ($aFunction = mysql_fetch_array($result2))
1530 {
1531 echo "<tr>\n".
1532 " <td><font size=-1><a href=\"Odin32DB.phtml?apigrouprefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
1533 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
1534 "</tr>\n";
1535 }
1536 echo "\n</table>\n";
1537 }
1538 else
1539 echo "<i>Not API Groups found.</i><br>\n";
1540 }
1541 else
1542 Odin32DBSqlError($sql);
1543 }
1544 else
1545 {
1546 echo "Click <a href=\"Odin32DB.phtml#apigroups?filerefcode=".$iRefcode."&fAPIGroups=1";
1547 if ($fFunctions) echo "&fFunctions=".$fFunctions;
1548 if ($fAuthors) echo "&fAuthors=".$fAuthors;
1549 if ($fSortByState) echo "&fSortByState=".$fSortByState;
1550 echo "\">here</a> to see all the API Groups.\n";
1551 }
1552 }
1553
1554
1555 /*
1556 * Authors
1557 */
1558 Odin32DBNaslov($aContent, "Authors", "authors");
1559 if ($fAuthors)
1560 {
1561 $sql = sprintf("SELECT\n".
1562 " a.name AS name,\n".
1563 " a.refcode AS refcode,\n".
1564 " COUNT(f.refcode) AS functions\n".
1565 "FROM\n".
1566 " fnauthor fa\n".
1567 " JOIN function f\n".
1568 " JOIN author a\n".
1569 "WHERE\n".
1570 " f.file = %d AND\n".
1571 " fa.function = f.refcode AND\n".
1572 " fa.author = a.refcode\n".
1573 "GROUP BY a.refcode\n".
1574 "ORDER BY a.name\n",
1575 $iRefcode
1576 );
1577 if ($result2 = mysql_query($sql, $db))
1578 {
1579 if (mysql_num_rows($result2) > 0)
1580 {
1581 echo "\n<table width=100% border=0 cellpadding=0>\n".
1582 "<tr>\n".
1583 " <td width=75%><font size=-1><b>Author</b></font></td>\n".
1584 " <td align=right><font size=-1><b>Functions</b></font></td>\n".
1585 "</tr>\n";
1586 while ($aFunction = mysql_fetch_array($result2))
1587 {
1588 echo "<tr>\n".
1589 " <td><font size=-1><a href=\"Odin32DB.phtml?authorrefcode=".$aFunction["refcode"]."&file=".$iRefcode."\">".$aFunction["name"]."</a></font></td>\n".
1590 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
1591 "</tr>\n";
1592 }
1593 echo "\n</table>\n";
1594 }
1595 else
1596 echo "<i>Not authors found.</i><br>\n";
1597 }
1598 else
1599 Odin32DBSqlError($sql);
1600 }
1601 else
1602 {
1603 echo "Click <a href=\"Odin32DB.phtml#authors?filerefcode=".$iRefcode."&fAuthors=1";
1604 if ($fFunctions) echo "&fFunctions=".$fFunctions;
1605 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups;
1606 if ($fSortByState) echo "&fSortByState=".$fSortByState;
1607 echo "\">here</a> to see all authors.\n";
1608 }
1609 }
1610 else
1611 {
1612 echo "<p> No data! Invalid refcode? </p>";
1613 Odin32DBSqlError($sql);
1614 }
1615
1616 /*
1617 * Navigation - Bottom
1618 */
1619 Odin32DBNavigationBottom($sExpand, $sCollapse);
1620}
1621
1622
1623
1624/**
1625 * Writes standard file info.
1626 *
1627 * @returns void
1628 * @param $aContent Contents array. (input/output)
1629 * @param $db Database handle.
1630 * @param $iRefcode Author reference code.
1631 * @param $fDlls Flags which tells wether to list all dlls or not.
1632 * @param $fFunctions Flags which tells wether to list all functions or not.
1633 * @param $fFiles Flags which tells wether to list all files or not.
1634 * @param $fAPIGroups Flags which tells wether to list all apigroups or not.
1635 * @param $fSortByState Flags which tells wether to sort functions by
1636 * state and function name or just by function name.
1637 * @param $iDllRefcode Dll refcode. All Dll if < 0.
1638 * (not implemented yet)
1639 * @sketch
1640 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
1641 * @remark
1642 */
1643function Odin32DBAuthorInfo(&$aContent, $db, $iRefcode, $fDlls, $fFunctions, $fFiles, $fAPIGroups, $fSortByState, $iDllRefcode)
1644{
1645 /*
1646 * Navigation - TOP
1647 */
1648 $sExpand = "authorrefcode=".$iRefcode."&fDlls=1&fFiles=1&fFunctions=1&fAPIGroups=1&fAuthors=1&dll=".$iDllRefcode;
1649 if ($fSortByState) $sExpand = $sExpand."&fSortByState=".$fSortByState;
1650 $sCollapse = "authorrefcode=".$iRefcode;
1651 Odin32DBNavigationTop($sExpand, $sCollapse);
1652
1653 /*
1654 * Fetch (vital) data.
1655 */
1656 $sql = sprintf("SELECT\n".
1657 " a.name AS name,\n".
1658 " a.refcode AS refcode,\n".
1659 " a.initials AS initials,\n".
1660 " a.alias AS alias,\n".
1661 " a.email AS email,\n".
1662 " a.country AS country,\n".
1663 " a.location AS location,\n".
1664 " a.description AS description\n".
1665 "FROM\n".
1666 " author a\n".
1667 "WHERE\n".
1668 " a.refcode = %d",
1669 $iRefcode);
1670 if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) > 0 && ($array = mysql_fetch_array($result)))
1671 {
1672 /*
1673 * General
1674 */
1675 Odin32DBNaslov($aContent, "General", "general");
1676 echo "\n<table width=100% border=3 cellpadding=0>\n";
1677 Odin32DBInfoRow1("Name", $array, "name","","","","");
1678 Odin32DBInfoRow1("e-mail", $array, "email","","","",""); //???? should all authors have email address displayed?
1679 Odin32DBInfoRow1("CVS User", $array, "alias","","","","");
1680 Odin32DBInfoRow1("Country", $array, "country","","","","");
1681 Odin32DBInfoRow1("Location", $array, "location","","","","");
1682 if (isset($array["description"]))
1683 Odin32DBInfoRow1("Description", $array, "description","","","","");
1684 $sql = sprintf("SELECT\n".
1685 " COUNT(*) as functions\n".
1686 "FROM\n".
1687 " fnauthor\n".
1688 "WHERE\n".
1689 " author = %d",
1690 $iRefcode);
1691 $cFunctions = 0;
1692 if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0 && ($aFunctions = mysql_fetch_array($result2)))
1693 {
1694 Odin32DBInfoRow1("# Functions", $aFunctions, "functions","","","","");
1695 $cFunctions = $aFunctions["functions"];
1696 }
1697 $sql = sprintf("SELECT\n".
1698 " COUNT(f.dll) as functions
1699 \n".
1700 "FROM\n".
1701 " fnauthor fa,\n".
1702 " function f\n".
1703 "WHERE\n".
1704 " fa.author = %d AND".
1705 " f.refcode = fa.function\n".
1706 "GROUP BY f.dll",
1707 $iRefcode);
1708 $cDlls = 0;
1709 if (($result2 = mysql_query($sql, $db)) && ($cDlls = mysql_num_rows($result2)) > 0)
1710 Odin32DBInfoRow1NoArray("# Dlls", $cDlls, "","","","");
1711 $sql = sprintf("SELECT\n".
1712 " COUNT(f.dll) as functions
1713 \n".
1714 "FROM\n".
1715 " fnauthor fa,\n".
1716 " function f\n".
1717 "WHERE\n".
1718 " fa.author = %d AND".
1719 " f.file >= 0 AND".
1720 " f.refcode = fa.function \n".
1721 "GROUP BY f.file",
1722 $iRefcode);
1723 $cFiles = 0;
1724 if (($result2 = mysql_query($sql, $db)) && ($cFiles = mysql_num_rows($result2)) > 0)
1725 Odin32DBInfoRow1NoArray("# Files", $cFiles, "","","","");
1726 $sql = sprintf("SELECT\n".
1727 " COUNT(f.dll) as functions
1728 \n".
1729 "FROM\n".
1730 " fnauthor fa,\n".
1731 " function f\n".
1732 "WHERE\n".
1733 " fa.author = %d AND".
1734 " f.apigroup IS NOT NULL AND".
1735 " f.refcode = fa.function\n".
1736 "GROUP BY f.apigroup",
1737 $iRefcode);
1738 $cAPIGroups = 0;
1739 if (($result2 = mysql_query($sql, $db)) && ($cAPIGroups = mysql_num_rows($result2)) > 0)
1740 Odin32DBInfoRow1NoArray("# API Groups", $cAPIGroups, "","","","");
1741
1742 echo "\n</table>\n";
1743
1744 /*
1745 * Completion
1746 */
1747 Odin32DBNaslov($aContent, "Completion", "completion");
1748 Odin32DBCompletionBarAuthor($iRefcode, "", $db);
1749
1750 /*
1751 * States
1752 */
1753 Odin32DBNaslov($aContent, "Status", "status");
1754 $sql = sprintf("SELECT\n".
1755 " s.name AS state,\n".
1756 " s.color AS color,\n".
1757 " COUNT(f.refcode) AS functions\n".
1758 "FROM\n".
1759 " state s\n".
1760 " LEFT OUTER JOIN fnauthor fa ON fa.author = %d\n".
1761 " LEFT OUTER JOIN function f ON s.refcode = f.state AND fa.function = f.refcode\n".
1762 "GROUP BY s.refcode\n".
1763 "ORDER BY s.refcode",
1764 $iRefcode);
1765 if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0)
1766 {
1767 echo "\n<table width=100% border=0 cellpadding=0>\n";
1768 while ($aState = mysql_fetch_array($result2))
1769 {
1770 echo "<tr>\n".
1771 " <td width=75%><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["state"]."</b></font></td>\n".
1772 " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["functions"]."</b></font></td>\n".
1773 " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".@(int)((int)$aState["functions"] * 100 / $cFunctions)."%</b></font></td>\n".
1774 "</tr>\n";
1775 }
1776
1777 echo "\n</table>\n";
1778 }
1779 else
1780 Odin32DBSqlError($sql);
1781
1782 /*
1783 * Dlls
1784 */
1785 Odin32DBNaslov($aContent, "Dlls", "dlls");
1786 if ($fDlls)
1787 {
1788 $sql = sprintf("SELECT\n".
1789 " d.name AS name,\n".
1790 " d.refcode AS refcode,\n".
1791 " COUNT(f.refcode) AS functions\n".
1792 "FROM\n".
1793 " fnauthor fa,\n".
1794 " dll d,\n".
1795 " function f\n".
1796 "WHERE\n".
1797 " fa.author = %d AND\n".
1798 " fa.function = f.refcode AND\n".
1799 " f.dll = d.refcode\n".
1800 "GROUP BY d.refcode\n".
1801 "ORDER BY d.name\n",
1802 $iRefcode);
1803 if ($result2 = mysql_query($sql, $db))
1804 {
1805 if (mysql_num_rows($result2) > 0)
1806 {
1807 echo "\n<table width=100% border=0 cellpadding=0>\n".
1808 "<tr>\n".
1809 " <td><font size=-1><b>Dlls</b></font></td>\n".
1810 " <td align=right><font size=-1><b>Functions</b></font></td>\n".
1811 "</tr>\n";
1812 while ($aFunction = mysql_fetch_array($result2))
1813 {
1814 echo "<tr>\n".
1815 " <td width=75%><font size=-1><a href=\"Odin32DB.phtml?dllrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
1816 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
1817 "</tr>\n";
1818 }
1819 echo "\n</table>\n";
1820 }
1821 else
1822 echo "<i>No Files.</i><br>\n";
1823 }
1824 else
1825 Odin32DBSqlError($sql);
1826 }
1827 else
1828 {
1829 echo "Click <a href=\"Odin32DB.phtml#dlls?authorrefcode=".$iRefcode."&fDlls=1";
1830 if ($fFunctions) echo "&fFunctions=".$fFunctions;
1831 if ($fFiles) echo "&fFiles=".$fFiles;
1832 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups;
1833 if ($fSortByState) echo "&fSortByState=".$fSortByState;
1834 echo "\">here</a> to see all files.\n";
1835 }
1836
1837
1838 /*
1839 * Functions
1840 */
1841 Odin32DBNaslov($aContent, "Functions", "functions");
1842 if ($fFunctions)
1843 {
1844 $sql = sprintf("SELECT\n".
1845 " f.name AS name,\n".
1846 " f.refcode AS refcode,\n".
1847 " d.name AS dllname,\n".
1848 " d.refcode AS dllrefcode,\n".
1849 " s.name AS state,\n".
1850 " s.color AS color\n".
1851 "FROM\n".
1852 " fnauthor fa\n".
1853 " JOIN function f\n".
1854 " JOIN dll d\n".
1855 " LEFT JOIN state s ON f.state = s.refcode\n".
1856 "WHERE\n".
1857 " fa.author = %d AND\n".
1858 " fa.function = f.refcode AND \n".
1859 " f.dll = d.refcode\n",
1860 $iRefcode);
1861 if ($fSortByState)
1862 $sql = $sql."ORDER BY s.refcode, f.name, d.name";
1863 else
1864 $sql = $sql."ORDER BY d.name, f.name";
1865 if ($result2 = mysql_query($sql, $db))
1866 {
1867 if (mysql_num_rows($result2) > 0)
1868 {
1869 echo "\n<table width=100% border=0 cellpadding=0>\n".
1870 "<tr>\n".
1871 " <td width=30%><font size=-1><b>Dll Name</b></font></td>\n".
1872 " <td width=45%><font size=-1><b>Function Name</b></font></td>\n".
1873 " <td><font size=-1><b>State</b></font></td>\n".
1874 "</tr>\n";
1875 while ($aFunction = mysql_fetch_array($result2))
1876 {
1877 echo "<tr>\n".
1878 " <td><font size=-1><a href=\"Odin32DB.phtml?dllrefcode=".$aFunction["dllrefcode"]."\">".$aFunction["dllname"]."</a></font></td>\n".
1879 " <td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
1880 " <td><font size=-1 color=\"#".$aFunction["color"]."\">".$aFunction["state"]."</font></td>\n".
1881 "</tr>\n";
1882 }
1883 echo "\n</table>\n".
1884 "<p>Click <a href=\"Odin32DB.phtml#function?authorrefcode=".$iRefcode."&fFunctions=1";
1885 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups;
1886 if ($fFiles) echo "&fAuthors=".$fFiles;
1887 if ($fSortByState) echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted alphabetical by dll.<br>\n";
1888 else echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted by state.<br>\n";
1889 }
1890 else
1891 echo "<i>No functions found</i><br>\n";
1892 }
1893 else
1894 Odin32DBSqlError($sql);
1895 }
1896 else
1897 {
1898 echo "Click <a href=\"Odin32DB.phtml#functions?authorrefcode=".$iRefcode."&fFunctions=1";
1899 if ($fDlls) echo "&fDlls=".$fDlls;
1900 if ($fFiles) echo "&fAuthors=".$fFiles;
1901 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups;
1902 if ($fSortByState) echo "&fSortByState=".$fSortByState;
1903 echo "\">here</a> to see all functions.\n";
1904 }
1905
1906
1907 /*
1908 * Files
1909 */
1910 Odin32DBNaslov($aContent, "Files", "files");
1911 if ($fFiles)
1912 {
1913 //TODO: OPTMIZE THIS SQL!!!
1914 $sql = sprintf("SELECT\n".
1915 " f.name AS name,\n".
1916 " f.refcode AS refcode,\n".
1917 " COUNT(fn.refcode) AS functions\n".
1918 "FROM\n".
1919 " fnauthor fa,\n".
1920 " file f\n".
1921 " LEFT OUTER JOIN function fn\n".
1922 " ON fn.file = f.refcode\n".
1923 "WHERE\n".
1924 " fa.author = %d AND fa.function = fn.refcode\n".
1925 "GROUP BY f.refcode\n".
1926 "ORDER BY f.name\n",
1927 $iRefcode);
1928 if ($result2 = mysql_query($sql, $db))
1929 {
1930 if (mysql_num_rows($result2) > 0)
1931 {
1932 echo "\n<table width=100% border=0 cellpadding=0>\n".
1933 "<tr>\n".
1934 " <td><font size=-1><b>Filename</b></font></td>\n".
1935 " <td align=right><font size=-1><b>Functions</b></font></td>\n".
1936 "</tr>\n";
1937 while ($aFunction = mysql_fetch_array($result2))
1938 {
1939 echo "<tr>\n".
1940 " <td width=75%><font size=-1><a href=\"Odin32DB.phtml?filerefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
1941 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
1942 "</tr>\n";
1943 }
1944 echo "\n</table>\n";
1945 }
1946 else
1947 echo "<i>No Files.</i><br>\n";
1948 }
1949 else
1950 Odin32DBSqlError($sql);
1951 }
1952 else
1953 {
1954 echo "Click <a href=\"Odin32DB.phtml#files?authorrefcode=".$iRefcode."&fFiles=1";
1955 if ($fDlls) echo "&fDlls=".$fDlls;
1956 if ($fFunctions) echo "&fFunctions=".$fFunctions;
1957 if ($fAPIGroups) echo "&fAPIGroups=".$fAPIGroups;
1958 if ($fSortByState) echo "&fSortByState=".$fSortByState;
1959 echo "\">here</a> to see all files.\n";
1960 }
1961
1962
1963 /*
1964 * API Groups
1965 */
1966 if ($cAPIGroups > 0)
1967 {
1968 Odin32DBNaslov($aContent, "API Groups", "apigroups");
1969 if ($fAPIGroups)
1970 {
1971 $sql = sprintf("SELECT\n".
1972 " g.name AS name,\n".
1973 " g.refcode AS refcode,\n".
1974 " COUNT(f.refcode) AS functions\n".
1975 "FROM\n".
1976 " fnauthor fa\n".
1977 " JOIN apigroup g\n".
1978 " JOIN function f\n".
1979 "WHERE\n".
1980 " fa.author = %d AND\n".
1981 " fa.function = f.refcode AND\n".
1982 " f.apigroup = g.refcode\n".
1983 "GROUP BY f.apigroup\n".
1984 "ORDER BY g.name\n",
1985 $iRefcode);
1986 if ($result2 = mysql_query($sql, $db))
1987 {
1988 if (mysql_num_rows($result2) > 0)
1989 {
1990 echo "\n<table width=100% border=0 cellpadding=0>\n".
1991 "<tr>\n".
1992 " <td width=75%><font size=-1><b>Group Name</b></font></td>\n".
1993 " <td align=right><font size=-1><b>Functions</b></font></td>\n".
1994 "</tr>\n";
1995 while ($aFunction = mysql_fetch_array($result2))
1996 {
1997 echo "<tr>\n".
1998 " <td><font size=-1><a href=\"Odin32DB.phtml?apigrouprefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
1999 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
2000 "</tr>\n";
2001 }
2002 echo "\n</table>\n";
2003 }
2004 else
2005 echo "<i>Not API Groups found.</i><br>\n";
2006 }
2007 else
2008 Odin32DBSqlError($sql);
2009 }
2010 else
2011 {
2012 echo "Click <a href=\"Odin32DB.phtml#apigroups?authorrefcode=".$iRefcode."&fAPIGroups=1";
2013 if ($fDlls) echo "&fDlls=".$fDlls;
2014 if ($fFunctions) echo "&fFunctions=".$fFunctions;
2015 if ($fFiles) echo "&fFiles=".$fFiles;
2016 if ($fSortByState) echo "&fSortByState=".$fSortByState;
2017 echo "\">here</a> to see all the API Groups.\n";
2018 }
2019 }
2020 }
2021 else
2022 {
2023 echo "<p> No data! Invalid refcode? </p>";
2024 Odin32DBSqlError($sql);
2025 }
2026
2027 /*
2028 * Navigation - Bottom
2029 */
2030 Odin32DBNavigationBottom($sExpand, $sCollapse);
2031}
2032
2033
2034
2035/**
2036 * Writes standard file info.
2037 *
2038 * @returns void
2039 * @param $aContent Contents array. (input/output)
2040 * @param $db Database handle.
2041 * @param $iRefcode Author reference code.
2042 * @param $fFunctions Flags which tells wether to list all functions or not.
2043 * @param $fFiles Flags which tells wether to list all files or not.
2044 * @param $fAuthors Flags which tells wether to list all authors or not.
2045 * @param $fSortByState Flags which tells wether to sort functions by
2046 * state and function name or just by function name.
2047 * @sketch
2048 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
2049 * @remark
2050 */
2051function Odin32DBAPIGroupInfo(&$aContent, $db, $iRefcode, $fFunctions, $fFiles, $fAuthors, $fSortByState)
2052{
2053 /*
2054 * Navigation - TOP
2055 */
2056 $sExpand = "apigrouprefcode=".$iRefcode."&fFiles=1&fFunctions=1&fAuthors=1";
2057 if ($fSortByState) $sExpand = $sExpand."&fSortByState=".$fSortByState;
2058 $sCollapse = "apigrouprefcode=".$iRefcode;
2059 Odin32DBNavigationTop($sExpand, $sCollapse);
2060
2061 /*
2062 * Fetch (vital) data.
2063 */
2064 $sql = sprintf("SELECT\n".
2065 " g.name AS name,\n".
2066 " g.refcode AS refcode,\n".
2067 " g.description AS description,\n".
2068 " d.name AS dllname,\n".
2069 " d.refcode AS dllrefcode\n".
2070 "FROM\n".
2071 " apigroup g\n".
2072 " JOIN dll d\n".
2073 "WHERE\n".
2074 " g.refcode = %d AND".
2075 " g.dll = d.refcode\n",
2076 $iRefcode);
2077 if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) > 0 && ($array = mysql_fetch_array($result)))
2078 {
2079 /*
2080 * General
2081 */
2082 Odin32DBNaslov($aContent, "General", "general");
2083 echo "\n<table width=100% border=3 cellpadding=0>\n";
2084 Odin32DBInfoRow1("Name", $array, "name","","","","");
2085 Odin32DBInfoRow1("Dll", $array, "dllname","dllrefcode","dllrefcode","bad configuration","");
2086 if (isset($array["description"]))
2087 Odin32DBInfoRow1("Description", $array, "description","","","","");
2088 $sql = sprintf("SELECT\n".
2089 " COUNT(*) as functions\n".
2090 "FROM\n".
2091 " function\n".
2092 "WHERE\n".
2093 " apigroup = %d",
2094 $iRefcode);
2095 $cFunctions = 0;
2096 if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0 && ($aFunctions = mysql_fetch_array($result2)))
2097 {
2098 Odin32DBInfoRow1("# Functions", $aFunctions, "functions","","","","");
2099 $cFunctions = $aFunctions["functions"];
2100 }
2101 $sql = sprintf("SELECT\n".
2102 " COUNT(*) as functions\n".
2103 "FROM\n".
2104 " function\n".
2105 "WHERE\n".
2106 " apigroup = %d AND".
2107 " file >= 0\n".
2108 "GROUP BY file",
2109 $iRefcode);
2110 $cFiles = 0;
2111 if (($result2 = mysql_query($sql, $db)) && ($cFiles = mysql_num_rows($result2)) > 0)
2112 Odin32DBInfoRow1NoArray("# Files", $cFiles, "","","","");
2113
2114 $sql = sprintf("SELECT\n".
2115 " COUNT(f.dll) as functions\n".
2116 "FROM\n".
2117 " fnauthor fa,\n".
2118 " function f\n".
2119 "WHERE\n".
2120 " f.apigroup = %d AND".
2121 " f.refcode = fa.function\n".
2122 "GROUP BY fa.author",
2123 $iRefcode);
2124 $cAuthors = 0;
2125 if (($result2 = mysql_query($sql, $db)) && ($cAuthors = mysql_num_rows($result2)) > 0)
2126 Odin32DBInfoRow1NoArray("# Authors", $cAuthors, "","","","");
2127
2128 echo "\n</table>\n";
2129
2130 /*
2131 * Completion
2132 */
2133 Odin32DBNaslov($aContent, "Completion", "completion");
2134 Odin32DBCompletionBarAPIGroup($iRefcode, "", $db);
2135
2136 /*
2137 * States
2138 */
2139 Odin32DBNaslov($aContent, "Status", "status");
2140 $sql = sprintf("SELECT\n".
2141 " s.name AS state,\n".
2142 " s.color AS color,\n".
2143 " COUNT(f.state) AS functions\n".
2144 "FROM\n".
2145 " state s\n".
2146 " LEFT OUTER JOIN function f ON s.refcode = f.state AND f.apigroup = %d\n".
2147 "GROUP BY s.refcode\n".
2148 "ORDER BY s.refcode",
2149 $iRefcode);
2150 if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0)
2151 {
2152 echo "\n<table width=100% border=0 cellpadding=0>\n";
2153 while ($aState = mysql_fetch_array($result2))
2154 {
2155 echo "<tr>\n".
2156 " <td width=75%><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["state"]."</b></font></td>\n".
2157 " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["functions"]."</b></font></td>\n".
2158 " <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".@(int)((int)$aState["functions"] * 100 / $cFunctions)."%</b></font></td>\n".
2159 "</tr>\n";
2160 }
2161
2162 echo "\n</table>\n";
2163 }
2164 else
2165 Odin32DBSqlError($sql);
2166
2167 /*
2168 * Functions
2169 */
2170 Odin32DBNaslov($aContent, "Functions", "functions");
2171 if ($fFunctions)
2172 {
2173 $sql = sprintf("SELECT\n".
2174 " f.name AS name,\n".
2175 " f.refcode AS refcode,\n".
2176 " s.name AS state,\n".
2177 " s.color AS color\n".
2178 "FROM\n".
2179 " function f\n".
2180 " LEFT JOIN state s ON f.state = s.refcode\n".
2181 "WHERE\n".
2182 " f.apigroup = %d\n",
2183 $iRefcode);
2184 if ($fSortByState)
2185 $sql = $sql."ORDER BY s.refcode, f.name";
2186 else
2187 $sql = $sql."ORDER BY f.name";
2188 if ($result2 = mysql_query($sql, $db))
2189 {
2190 if (mysql_num_rows($result2) > 0)
2191 {
2192 echo "\n<table width=100% border=0 cellpadding=0>\n".
2193 "<tr>\n".
2194 " <td width=75%><font size=-1><b>Function Name</b></font></td>\n".
2195 " <td><font size=-1><b>State</b></font></td>\n".
2196 "</tr>\n";
2197 while ($aFunction = mysql_fetch_array($result2))
2198 {
2199 echo "<tr>\n".
2200 " <td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
2201 " <td><font size=-1 color=\"#".$aFunction["color"]."\">".$aFunction["state"]."</font></td>\n".
2202 "</tr>\n";
2203 }
2204 echo "\n</table>\n".
2205 "<p>Click <a href=\"Odin32DB.phtml#function?apigrouprefcode=".$iRefcode."&fFunctions=1";
2206 if ($fAuthors) echo "&fAuthors=".$fAuthors;
2207 if ($fFiles) echo "&fAuthors=".$fFiles;
2208 if ($fSortByState) echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted alphabetical.<br>\n";
2209 else echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted by state.<br>\n";
2210 }
2211 else
2212 echo "<i>No functions found</i><br>\n";
2213 }
2214 else
2215 Odin32DBSqlError($sql);
2216 }
2217 else
2218 {
2219 echo "Click <a href=\"Odin32DB.phtml#functions?apigrouprefcode=".$iRefcode."&fFunctions=1";
2220 if ($fFiles) echo "&fAuthors=".$fFiles;
2221 if ($fAuthors) echo "&fAuthors=".$fAuthors;
2222 if ($fSortByState) echo "&fSortByState=".$fSortByState;
2223 echo "\">here</a> to see all functions.\n";
2224 }
2225
2226
2227 /*
2228 * Files
2229 */
2230 Odin32DBNaslov($aContent, "Files", "files");
2231 if ($fFiles)
2232 {
2233 $sql = sprintf("SELECT\n".
2234 " f.name AS name,\n".
2235 " f.refcode AS refcode,\n".
2236 " COUNT(fn.refcode) AS functions\n".
2237 "FROM\n".
2238 " file f\n".
2239 " LEFT OUTER JOIN function fn ON fn.file = f.refcode\n".
2240 "WHERE\n".
2241 " fn.apigroup = %d\n".
2242 "GROUP BY f.refcode\n".
2243 "ORDER BY f.name\n",
2244 $iRefcode);
2245
2246 if ($result2 = mysql_query($sql, $db))
2247 {
2248 if (mysql_num_rows($result2) > 0)
2249 {
2250 echo "\n<table width=100% border=0 cellpadding=0>\n".
2251 "<tr>\n".
2252 " <td><font size=-1><b>Filename</b></font></td>\n".
2253 " <td align=right><font size=-1><b>Functions</b></font></td>\n".
2254 "</tr>\n";
2255 while ($aFunction = mysql_fetch_array($result2))
2256 {
2257 echo "<tr>\n".
2258 " <td width=75%><font size=-1><a href=\"Odin32DB.phtml?filerefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
2259 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
2260 "</tr>\n";
2261 }
2262 echo "\n</table>\n";
2263 }
2264 else
2265 echo "<i>No Files.</i><br>\n";
2266 }
2267 else
2268 Odin32DBSqlError($sql);
2269 }
2270 else
2271 {
2272 echo "Click <a href=\"Odin32DB.phtml#files?apigrouprefcode=".$iRefcode."&fFiles=1";
2273 if ($fFunctions) echo "&fFunctions=".$fFunctions;
2274 if ($fAuthors) echo "&fAuthors=".$fAuthors;
2275 if ($fSortByState) echo "&fSortByState=".$fSortByState;
2276 echo "\">here</a> to see all files.\n";
2277 }
2278
2279
2280 /*
2281 * Authors
2282 */
2283 Odin32DBNaslov($aContent, "Authors", "authors");
2284 if ($fAuthors)
2285 {
2286 $sql = sprintf("SELECT\n".
2287 " a.name AS name,\n".
2288 " a.refcode AS refcode,\n".
2289 " COUNT(f.refcode) AS functions\n".
2290 "FROM\n".
2291 " fnauthor fa\n".
2292 " JOIN function f\n".
2293 " JOIN author a\n".
2294 "WHERE\n".
2295 " f.apigroup = %d AND\n".
2296 " fa.function = f.refcode AND\n".
2297 " fa.author = a.refcode\n".
2298 "GROUP BY a.refcode\n".
2299 "ORDER BY a.name\n",
2300 $iRefcode
2301 );
2302 if ($result2 = mysql_query($sql, $db))
2303 {
2304 if (mysql_num_rows($result2) > 0)
2305 {
2306 echo "\n<table width=100% border=0 cellpadding=0>\n".
2307 "<tr>\n".
2308 " <td width=75%><font size=-1><b>Author</b></font></td>\n".
2309 " <td align=right><font size=-1><b>Functions</b></font></td>\n".
2310 "</tr>\n";
2311 while ($aFunction = mysql_fetch_array($result2))
2312 {
2313 echo "<tr>\n".
2314 " <td><font size=-1><a href=\"Odin32DB.phtml?authorrefcode=".$aFunction["refcode"]."&apigroup=".$iRefcode."\">".$aFunction["name"]."</a></font></td>\n".
2315 " <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
2316 "</tr>\n";
2317 }
2318 echo "\n</table>\n";
2319 }
2320 else
2321 echo "<i>Not authors found.</i><br>\n";
2322 }
2323 else
2324 Odin32DBSqlError($sql);
2325 }
2326 else
2327 {
2328 echo "Click <a href=\"Odin32DB.phtml#authors?apigrouprefcode=".$iRefcode."&fAuthors=1";
2329 if ($fFunctions) echo "&fFunctions=".$fFunctions;
2330 if ($fFiles) echo "&fFiles=".$fFiles;
2331 if ($fSortByState) echo "&fSortByState=".$fSortByState;
2332 echo "\">here</a> to see all authors.\n";
2333 }
2334 }
2335 else
2336 {
2337 echo "<p> No data! Invalid refcode? </p>";
2338 Odin32DBSqlError($sql);
2339 }
2340
2341 /*
2342 * Navigation - Bottom
2343 */
2344 Odin32DBNavigationBottom($sExpand, $sCollapse);
2345}
2346
2347
2348
2349
2350
2351/* TEXT FORMATTING OVERLOADS */
2352/* TEXT FORMATTING OVERLOADS */
2353/* TEXT FORMATTING OVERLOADS */
2354
2355/**
2356 * Makes the contents for this page.
2357 * @sketch Writes the headers present in the contents array.
2358 */
2359function Odin32DBWriteContents(&$aContent)
2360{
2361 TocBeg();
2362 for ($i = 0; $i < sizeof($aContent); $i += 2)
2363 AnchNaslov($aContent[$i], $aContent[$i + 1], "");
2364 TocEnd();
2365}
2366
2367/**
2368 * Forwarder which also maintains the contents array.
2369 */
2370function Odin32DBNaslov(&$aContent, $sFull, $sShort)
2371{
2372 $aContent[] = $sFull;
2373 $aContent[] = $sShort;
2374 return Naslov($sFull, $sShort);
2375}
2376
2377
2378
2379?>
2380
Note: See TracBrowser for help on using the repository browser.