Changeset 3901 for trunk/tools/database/www/Odin32DBHelpers.php3
- Timestamp:
- Jul 29, 2000, 11:20:11 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/database/www/Odin32DBHelpers.php3
r3883 r3901 76 76 echo " 77 77 <table width=100% border=0 cellspacing=0 cellpadding=0> 78 "; 79 if ($sDllName != '') 80 echo " 78 81 <tr> 79 82 <td width=90%> … … 83 86 </td> 84 87 <td width=10%></td> 85 </tr> 88 </tr>"; 89 echo " 86 90 <tr> 87 91 <td width=90%> … … 259 263 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 260 264 */ 261 function Odin32DB DumpSql($sql)265 function Odin32DBSqlError($sql) 262 266 { 267 echo "<p><font size=1 face=\"courier\"> 268 SQL-Error:<br> 269 ".mysql_error()." 270 <br> 271 </font> 272 </p> 273 "; 274 263 275 echo "<p><font size=1 face=\"courier\"> 264 276 SQL:<br> … … 379 391 } 380 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 381 1312 ?> 382 1313
Note:
See TracChangeset
for help on using the changeset viewer.