Changeset 3904 for trunk/tools/database


Ignore:
Timestamp:
Aug 1, 2000, 3:49:16 AM (25 years ago)
Author:
bird
Message:

Preview II.

Location:
trunk/tools/database/www
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/database/www/Odin32DB.phtml

    r3903 r3904  
    11<?php
    2 $Title ="The Odin32 API Database";
    32
    43require "stilovi.php3";
    54require "Odin32DBHelpers.php3";
     5
     6/* Profiling */
     7$sPageTimer = Odin32DBTimerStart("page timer");
     8/* Profiling */
     9
     10$Title ="The Odin32 API Database";
     11
    612
    713/*
    814 * Connect to database
    915 */
    10 $db = mysql_connect("127.0.0.1", "root", "");
    11 $rc = mysql_select_db("odin32", $db);
     16require "Odin32DBConnect.php3";
    1217
    1318
     
    134139
    135140
    136 /*
    137  * Init the contents array.
    138  */
    139 $aContent = array();
    140 
    141 
    142141TekstBeg();
    143142
     
    148147        case "dll":
    149148        {
    150             Odin32DBDllInfo($aContent, $db, $iRefcode, $fFunctions, $fFiles, $fAPIGroups, $fAuthors, $fSortByState);
     149            Odin32DBDllInfo($db, $iRefcode, $fFunctions, $fFiles, $fAPIGroups, $fAuthors, $fSortByState);
    151150            break;
    152151        }
     
    154153        case "file":
    155154        {
    156             Odin32DBFileInfo($aContent, $db, $iRefcode, $fFunctions, $fAPIGroups, $fAuthors, $fSortByState);
     155            Odin32DBFileInfo($db, $iRefcode, $fFunctions, $fAPIGroups, $fAuthors, $fSortByState);
    157156            break;
    158157        }
     
    160159        case "function":
    161160        {
    162             Odin32DBFunctionInfo($aContent, $db, $iRefcode);
     161            Odin32DBFunctionInfo($db, $iRefcode);
    163162            break;
    164163        }
     
    166165        case "apigroup":
    167166        {
    168             Odin32DBAPIGroupInfo(&$aContent, $db, $iRefcode, $fFunctions, $fFiles, $fAuthors, $fSortByState);
     167            Odin32DBAPIGroupInfo($db, $iRefcode, $fFunctions, $fFiles, $fAuthors, $fSortByState);
    169168            break;
    170169        }
     
    172171        case "author":
    173172        {
    174             Odin32DBAuthorInfo($aContent, $db, $iRefcode, $fDlls, $fFunctions, $fFiles, $fAPIGroups, $fSortByState, $authordll);
     173            Odin32DBAuthorInfo($db, $iRefcode, $fDlls, $fFunctions, $fFiles, $fAPIGroups, $fSortByState, $authordll);
    175174            break;
    176175        }
     
    182181             */
    183182            Odin32DBNavigationTop("","");
    184             Odin32DBNaslov($aContent, "Welcome to the Odin32 API Database", "welcome", "");
     183            Odin32DBNaslov("Welcome to the Odin32 API Database", "welcome", "");
    185184            echo "This is the first Beta edition of the Odin32 API Database.<br>\n".
    186185                 "There might be dead or non-functioning links. Currently feedback is <i>NOT</i> needed.\n".
     
    190189                 "-Enjoy!<br>\n";
    191190
    192             Odin32DBNaslov($aContent, "Root Menu", "menu", "");
     191            Odin32DBNaslov("Root Menu", "menu", "");
    193192            echo "<font size=3>".
    194193                 "<ul>\n".
     
    209208             */
    210209            Odin32DBNavigationTop("","");
    211             Odin32DBNaslov($aContent, "Welcome to the Odin32 API Database", "welcome", "");
     210            Odin32DBNaslov("Welcome to the Odin32 API Database", "welcome", "");
    212211            echo "This is the first Beta edition of the Odin32 API Database.<br>\n".
    213212                 "There might be dead or non-functioning links. Currently feedback is <i>NOT</i> needed.\n".
     
    217216                 "-Enjoy!<br>\n";
    218217
    219             Odin32DBNaslov($aContent, "All Dlls", "dlls", "");
     218            Odin32DBNaslov("All Dlls", "dlls", "");
    220219            $sql = "SELECT\n".
    221220                   "    d.name              AS name,\n".
     
    256255             */
    257256            Odin32DBNavigationTop("","");
    258             Odin32DBNaslov($aContent, "Welcome to the Odin32 API Database", "welcome", "");
     257            Odin32DBNaslov("Welcome to the Odin32 API Database", "welcome", "");
    259258            echo "This is the first Beta edition of the Odin32 API Database.<br>\n".
    260259                 "There might be dead or non-functioning links. Currently feedback is <i>NOT</i> needed.\n".
     
    264263                 "-Enjoy!<br>\n";
    265264
    266             Odin32DBNaslov($aContent, "All Authors", "authors", "");
     265            Odin32DBNaslov("All Authors", "authors", "");
    267266            $sql = "SELECT\n".
    268267                   "    name,\n".
     
    301300             */
    302301            Odin32DBNavigationTop("","");
    303             Odin32DBNaslov($aContent, "Welcome to the Odin32 API Database", "welcome", "");
     302            Odin32DBNaslov("Welcome to the Odin32 API Database", "welcome", "");
    304303            echo "This is the first Beta edition of the Odin32 API Database.<br>\n".
    305304                 "There might be dead or non-functioning links. Currently feedback is <i>NOT</i> needed.\n".
     
    309308                 "-Enjoy!<br>\n";
    310309
    311             Odin32DBNaslov($aContent, "All API Groups", "apigroups", "");
     310            Odin32DBNaslov("All API Groups", "apigroups", "");
    312311            $sql = "SELECT\n".
    313312                   "    a.name              AS name,\n".
     
    357356require "09-ContentsTitle.php3";
    358357
    359 Odin32DBWriteContents($aContent);
     358Odin32DBWriteContents();
    360359
    361360require "10-EndOfContent.php3";
     
    366365
    367366require "13-Closing.php3";
     367
     368
     369/* Profiling */
     370Odin32DBTimerStop($sPageTimer);
     371/* Profiling */
    368372?>
    369373
  • trunk/tools/database/www/Odin32DBHelpers.php3

    r3903 r3904  
    11<?php
     2
     3/**
     4 * Profiling function for mysql queries.
     5 * @returns     same as mysql_query
     6 * @param       $sSql   SQL statement.
     7 * @param       $db     Database connection.
     8 * @sketch
     9 *              Get time.
     10 *              Execute query.
     11 *              Get time.
     12 *              Calc time ellapsed.
     13 *              Start a HTML comment.
     14 *              Log time and sql statement in the HTML comment.
     15 *              EXPLAIN sql statement and log it in the HTML comment.
     16 *              End the HTML comment.
     17 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     18 */
     19function _mysql_query($sSql, $db)
     20{
     21    $sMsStart = microtime();
     22
     23    $Result = mysql_query($sSql, $db);
     24
     25    $sMsEnd = microtime();
     26
     27    /*
     28     * Format: 0.mmmmmmmm sssssssss
     29     *         0.00322252 965056018
     30     *
     31     *         01234567890123456789
     32     *         0         1
     33     */
     34    $sMsStart = substr($sMsStart,11) . substr($sMsStart,1,9);
     35    $sMsEnd   = substr($sMsEnd,11)   . substr($sMsEnd,1,9);
     36    $sMsTime  = (double)$sMsEnd - (double)$sMsStart;
     37
     38    echo
     39        "\n<!-- start: $sMsStart  end: $sMsEnd  time: $sMsTime".
     40        "\nSQL:\n".
     41        $sSql.
     42        "\n".
     43        "rows: ". mysql_num_rows($Result) ."\n";
     44
     45    $ResultExplain = mysql_query("EXPLAIN ".$sSql, $db);
     46    if ($ResultExplain)
     47    {
     48        echo "Explain:\n";
     49        printf("%-15s  %-17  %-20s  %-12s  %-10s  %-20s  %-8s  %s\n",
     50            "Table",
     51            "Type",
     52            "Possible keys",
     53            "Key",
     54            "Key length",
     55            "Ref",
     56            "Rows",
     57            "Extra");
     58
     59        while ($aExplain = mysql_fetch_array($ResultExplain))
     60        {
     61            printf("%-15s  %-17  %-20s  %-12s  %-10s  %-20s  %-8s  %s\n",
     62                isset($aExplain["0"]) ? $aExplain["0"] : "NULL",
     63                isset($aExplain["1"]) ? $aExplain["1"] : "NULL",
     64                isset($aExplain["2"]) ? $aExplain["2"] : "NULL",
     65                isset($aExplain["3"]) ? $aExplain["3"] : "NULL",
     66                isset($aExplain["4"]) ? $aExplain["4"] : "NULL",
     67                isset($aExplain["5"]) ? $aExplain["5"] : "NULL",
     68                isset($aExplain["6"]) ? $aExplain["6"] : "NULL",
     69                isset($aExplain["7"]) ? $aExplain["7"] : "NULL");
     70        }
     71        mysql_free_result($ResultExplain);
     72    }
     73    else
     74        echo "\nexplain failed\n";
     75
     76    echo "-->\n";
     77
     78    return $Result;
     79}
     80
     81
     82/**
     83 * Starts a timer. Writes a nag in the file.
     84 * @returns
     85 * @param       $sText  Log text.
     86 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     87 */
     88function Odin32DBTimerStart($sText)
     89{
     90    $sMsStart = microtime();
     91    $sMsStart = substr($sMsStart,11) . substr($sMsStart,1,9);
     92    echo "\n<!-- Timer started: $sMsStart  $sText -->\n";
     93    return $sMsStart.$sText;
     94}
     95
     96
     97/**
     98 * Stops the timer $sMsStart. And writes the elapsed time.
     99 * @returns     Nothing.
     100 * @param       $sTimer   The timer handle returned by Odin32DBTimerStart.
     101 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     102 */
     103function Odin32DBTimerStop($sTimer)
     104{
     105    $sMsEnd  = microtime();
     106    $sMsEnd  = substr($sMsEnd,11) . substr($sMsEnd,1,9);
     107    $sMsStart= substr($sTimer,0,18);
     108    $sMsTime = (double)$sMsEnd - (double)$sMsStart;
     109    $sText   = substr($sTimer,18);
     110    echo "\n<!-- Timer stopped: $sMsEnd ($sMsStart)  Elapsed: $sMsTime  $sText -->\n";
     111}
     112
    2113
    3114/**
     
    127238     * Make
    128239     */
    129     echo "
    130         <table width=100% border=0 cellspacing=0 cellpadding=0>
    131         ";
     240    echo "\n<table width=100% border=0 cellspacing=0 cellpadding=0>";
    132241    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 
     242        echo "  <tr><td width=90%><font size=-1 color=#000099><tt>".$sAuthorName."</tt></font></td><td width=10%></td></tr>\n";
     243    echo "  <tr><td width=90%>\n".
     244         "  <table width=100% border=0 cellspacing=0 cellpadding=0>\n".
     245         "  <tr>\n";
    149246
    150247    /*
     
    153250    $sql = "SELECT\n".
    154251           "    COUNT(f.refcode)    AS count,\n".
    155            "    f.state             AS state,\n".
     252           "    s.refcode           AS state,\n".
    156253           "    s.color             AS color,\n".
    157254           "    s.weight            AS weight\n".
     
    164261           "    fa.function = f.refcode AND\n".
    165262           "    f.state = s.refcode\n".
    166            "GROUP BY f.state\n".
     263           "GROUP BY s.refcode\n".
    167264           "ORDER BY state\n";
    168265    $rdCompletePercent = 0.0;
     
    170267        Odin32DBSqlError($sql);
    171268    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     }
     269        echo "  <td colspan=2 bgcolor=#dddddd><font size=-1>&nbsp;</font></td>\n";
    181270    else
    182271    {
     
    186275            if ($iPercent == 0)
    187276                $iPercent = 1;
    188             echo "
    189                     <td width=".$iPercent." bgcolor=".$row[2].">
    190                         <font size=-1>
    191                         &nbsp;
    192                         </font>
    193                     </td>
    194                 ";
     277            echo "  <td width=".$iPercent." bgcolor=".$row[2]."><font size=-1>&nbsp;</font></td>\n";
    195278
    196279            $rdCompletePercent += ((double)$row[3] * (double)$row[0]) / $cFunctions;
     
    203286     * Complete bar with a total completion percent.
    204287     */
    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 
     288    echo "  <td width=10% align=right><font size=-1 color=#000099>".(int)$rdCompletePercent."%</font></td>\n".
     289         "  </tr>\n".
     290         "  </table>\n".
     291         "</td></tr>\n".
     292         "</table>\n";
    218293}
    219294
     
    248323
    249324    /*
    250      * Make
     325     * Double table. Eventually write the name.
    251326     */
    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 
     327    echo "\n<table width=100% border=0 cellspacing=0 cellpadding=0>\n";
     328    if ($sName != "")
     329        echo "<tr><td width=90%><font size=-1 color=#000099><tt>".$sName."</tt></font></td><td width=10%></td></tr>\n";
     330    echo "<tr><td width=90%>\n".
     331         "  <table width=100% border=0 cellspacing=0 cellpadding=0>\n".
     332         "  <tr>\n";
    272333
    273334    /*
     
    277338    $sql = "SELECT\n".
    278339           "    COUNT(f.refcode)    AS count,\n".
    279            "    f.state             AS state,\n".
     340           "    s.refcode           AS state,\n".
    280341           "    s.color             AS color,\n".
    281342           "    s.weight            AS weight\n".
     
    286347           "    ".$sCondition."\n".
    287348           "    s.refcode = f.state\n".
    288            "GROUP BY f.state\n".
     349           "GROUP BY s.refcode\n".
    289350           "ORDER BY state\n";
    290351    $rdCompletePercent = 0.0;
     
    292353        Odin32DBSqlError($sql);
    293354    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     }
     355        echo "  <td colspan=2 bgcolor=#dddddd><font size=-1>&nbsp;</font></td>\n";
    304356    else
    305357    {
     
    309361            if ($iPercent == 0)
    310362                $iPercent = 1;
    311             echo "
    312                     <td width=".$iPercent." bgcolor=".$row[2].">
    313                         <font size=-1>
    314                         &nbsp;
    315                         </font>
    316                     </td>
    317                 ";
    318 
     363            echo "  <td width=".$iPercent." bgcolor=".$row[2]."><font size=-1>&nbsp;</font></td>\n";
    319364            $rdCompletePercent += ((double)$row[3] * (double)$row[0]) / $cFunctions;
    320365        }
     
    326371     * Complete bar with a total completion percent.
    327372     */
    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         ";
     373    echo "  <td width=10% align=right><font size=-1 color=#000099>".(int)$rdCompletePercent."%</font></td>\n".
     374         "  </tr>\n".
     375         "  </table>\n".
     376         "</td></tr>\n".
     377         "</table>\n";
    340378}
    341379
     
    368406    else
    369407    {
    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             ";
     408        echo "\n".
     409             "<tr><td></td></tr>\n".
     410             "<tr><td><center><B><font face=\"WarpSans, Arial\" color=\"#990000\">Status Legend:</font></b></center></td></tr>\n".
     411             "<tr><td>\n".
     412             "  <table width=100% border=0 cellspacing=2 cellpadding=0 align=right>\n";
     413
    383414        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             ";
     415            echo "  <tr><td width=85% align=right><font size=1 color=#000099>".$row[0]."</font></td>\n".
     416                 "      <td width=15% bgcolor=".$row[1]."><font size=-1>&nbsp;<br>&nbsp;</font></td>\n".
     417                 "  </tr>\n";
     418
     419        echo "  </table>\n".
     420             "</td></tr>\n";
    423421    }
    424422
     
    469467function Odin32DBInfoRow1($sName, $array, $sValueName, $sRefName, $sOdin32DBArg, $sNullText, $sPostText)
    470468{
    471     echo "
    472         <tr>
    473             <td width=35%><tt>".$sName."</tt></td>
    474             <td valign=top>";
     469    echo "  <tr>\n".
     470         "    <td width=35%><tt>".$sName."</tt></td>\n".
     471         "    <td valign=top>";
    475472    if (isset($array[$sValueName]))
    476473    {
     
    486483        echo "<i>".$sNullText."</i>";
    487484
    488     echo "
    489             </td>
    490         <tr>\n";
     485    echo "</td>\n".
     486         "  </tr>\n";
    491487}
    492488
     
    505501function Odin32DBInfoRow1NoArray($sName, $sValue, $sRef, $sOdin32DBArg, $sNullText, $sPostText)
    506502{
    507     echo "
    508         <tr>
    509             <td width=35%><tt>".$sName."</tt></td>
    510             <td valign=top>";
     503    echo "  <tr>\n".
     504         "    <td width=35%><tt>".$sName."</tt></td>\n".
     505         "    <td valign=top>";
    511506    if (isset($sValue) && $sValue != "")
    512507    {
     
    521516        echo "<i>".$sNullText."</i>";
    522517
    523     echo "
    524             </td>
    525         <tr>\n";
     518    echo "</td>\n".
     519         "  </tr>\n";
    526520}
    527521
     
    546540                                          $sValueName2, $sRefName2, $sOdin32DBArg2)
    547541{
    548     echo "
    549         <tr>
    550             <td width=35%><tt>".$sName."</tt></td>
    551             <td valign=top>";
     542    echo "  <tr>\n".
     543         "    <td width=35%><tt>".$sName."</tt></td>\n".
     544         "    <td valign=top>";
    552545    if (isset($array[$sValueName1]))
    553546    {
     
    574567        echo "<i>".$sNullText."</i>";
    575568
    576     echo "</td>
    577         <tr>\n";
     569    echo "</td>\n".
     570         "  </tr>\n";
    578571}
    579572
     
    610603 * @remark      Displays <i>not available</i> if empty field.
    611604 */
    612 function Odin32DBDocRow(&$aContent, $sName, $sLabel, $array, $sValueName)
    613 {
    614     Odin32DBNaslov($aContent, $sName, $sLabel);
     605function Odin32DBDocRow($sName, $sLabel, $array, $sValueName)
     606{
     607    Odin32DBNaslov($sName, $sLabel);
    615608    if (isset($array[$sValueName]))
    616609    {
     
    619612    else
    620613        echo "<i>not available</i>";
     614}
     615
     616
     617/**
     618 * Writes a state section based on a sqlstatment returning the following values (ordered):
     619 *      0. state
     620 *      1. functions
     621 *
     622 * @returns     nothing.
     623 * @param       $cFunctions     Number of functions.
     624 * @param       $sql            Sql statement.
     625 * @param       $db             Database connection.
     626 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     627 */
     628function Odin32DBWriteStates($cFunctions, $sql, $db)
     629{
     630    Odin32DBNaslov("Status", "status");
     631    if ($result2 = mysql_query($sql, $db))
     632    {
     633        $result = mysql_query("SELECT refcode, name, color FROM state ORDER BY refcode", $db);
     634        if ($result)
     635        {
     636            echo "\n<table width=100% border=0 cellpadding=0>\n";
     637
     638            $aState2 = mysql_fetch_array($result2);
     639            while ($aState = mysql_fetch_row($result))
     640            {
     641                if ($aState2 && $aState[0] == $aState2[0])
     642                {
     643                    $cStateFunctions = (int)$aState2[1];
     644                    $aState2 = mysql_fetch_array($result2);
     645                }
     646                else
     647                    $cStateFunctions = 0;
     648                printf("<tr>\n".
     649                       "    <td width=75%%><font size=-1 color=%s>%s</font></td>\n".
     650                       "    <td align=right><font size=-1 color=%s>%s</font></td>\n".
     651                       "    <td align=right><font size=-1 color=%s>%d%%</font></td>\n".
     652                       "</tr>\n",
     653                       $aState[2], $aState[1],
     654                       $aState[2], $cStateFunctions,
     655                       $aState[2], @(int)($cStateFunctions * 100 / $cFunctions));
     656            }
     657
     658            echo "</table>\n";
     659        }
     660        else
     661            Odin32DBSqlError($sql);
     662    }
     663    else
     664        Odin32DBSqlError($sql);
     665}
     666
     667
     668/**
     669 * Writes the a function listing base sqlstatement with these columns (ordered):
     670 *      0. dll refcode
     671 *      1. dll name
     672 *      2. number of functions
     673 *
     674 * @returns     nothing
     675 * @param       $sql        SQL statement.
     676 * @param       $db         Database connection.
     677 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     678 */
     679function Odin32DBWriteDlls($sql, $db)
     680{
     681    if ($result2 = mysql_query($sql, $db))
     682    {
     683        if (mysql_num_rows($result2) > 0)
     684        {
     685            echo "\n<table width=100% border=0 cellpadding=0>\n".
     686                 "<tr>\n".
     687                 "  <td width=75%><font size=-1><b>Dlls</b></font></td>\n".
     688                 "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
     689                 "</tr>\n";
     690            while ($aFunction = mysql_fetch_array($result2))
     691                printf("<tr>".
     692                       "<td><font size=-1><a href=\"Odin32DB.phtml?dllrefcode=%s\">%s</a></font></td>".
     693                       "<td align=right><font size=-1>%s</font></td>".
     694                       "</tr>\n",
     695                       $aFunction[0], $aFunction[1], $aFunction[2]);
     696
     697            echo "</table>\n";
     698        }
     699        else
     700            echo "<i>No Files.</i><br>\n";
     701    }
     702    else
     703        Odin32DBSqlError($sql);
     704}
     705
     706
     707/**
     708 * Writes the a function listing base sqlstatement with these columns (ordered):
     709 *      0. function refcode
     710 *      1. function name
     711 *      2. state color
     712 *      3. state name
     713 *
     714 * @returns     nothing
     715 * @param       $sql        SQL statement.
     716 * @param       $db         Database connection.
     717 * @param       $sURLArgs   URL arguments.
     718 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     719 */
     720function Odin32DBWriteFunctions($sql, $db, $sURLArgs)
     721{
     722    if ($result2 = mysql_query($sql, $db))
     723    {
     724        if (mysql_num_rows($result2) > 0)
     725        {
     726            echo
     727                "<table width=100% border=0 cellpadding=0>\n",
     728                "<tr>\n",
     729                "  <td width=75%><font size=-1><b>Function Name</b></font></td>\n",
     730                "  <td><font size=-1><b>State</b></font></td>\n",
     731                "</tr>\n";
     732
     733            while ($aFunction = mysql_fetch_row($result2))
     734                printf("<tr>".
     735                       "<td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=%s\">%s</a></font></td>".
     736                       "<td><font size=-1 color=%s>%s</font></td></tr>\n",
     737                       $aFunction[0], $aFunction[1], $aFunction[2], $aFunction[3]);
     738
     739            echo "</table></font>\n";
     740
     741            /*
     742             * Sort text.
     743             */
     744            $fSortByState = strstr($sURLArgs, "&fSortByState=1");
     745            if ($fSortByState)
     746                $sURLArgs = str_replace("&fSortByState=1", "", $sURLArgs);
     747            else
     748                $sURLArgs = $sURLArgs."&fSortByState=1";
     749
     750            echo "<p>Click <a href=\"Odin32DB.phtml#functions?".$sURLArgs."\">here</a> to view functions sorted ".
     751                 ($fSortByState  ? "alphabetical" : "by state"). ".<br>";
     752        }
     753        else
     754            echo "<i>No Functions.</i><br>\n";
     755        mysql_free_result($result2);
     756    }
     757    else
     758        Odin32DBSqlError($sql);
     759}
     760
     761
     762/**
     763 * Writes the a function listing base sqlstatement with these columns (ordered):
     764 *      0. dll refcode
     765 *      1. dll name
     766 *      2. function refcode
     767 *      3. function name
     768 *      4. state color
     769 *      5. state name
     770 *
     771 * @returns     nothing
     772 * @param       $sql        SQL statement.
     773 * @param       $db         Database connection.
     774 * @param       $sURLArgs   URL arguments.
     775 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     776 */
     777function Odin32DBWriteFunctionsWithDlls($sql, $db, $sURLArgs)
     778{
     779    if ($result2 = mysql_query($sql, $db))
     780    {
     781        if (mysql_num_rows($result2) > 0)
     782        {
     783            echo "\n<table width=100% border=0 cellpadding=0>\n".
     784                 "<tr>\n".
     785                 "  <td width=30%><font size=-1><b>Dll Name</b></font></td>\n".
     786                 "  <td width=45%><font size=-1><b>Function Name</b></font></td>\n".
     787                 "  <td><font size=-1><b>State</b></font></td>\n".
     788                 "</tr>\n";
     789            while ($aFunction = mysql_fetch_row($result2))
     790                printf("<tr>".
     791                       "<td><font size=-1><a href=\"Odin32DB.phtml?dllrefcode=%s\">%s</a></font></td>".
     792                       "<td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=%s\">%s</a></font></td>".
     793                       "<td><font size=-1 color=%s>%s</font></td>".
     794                       "</tr>\n",
     795                       $aFunction[2], $aFunction[3],
     796                       $aFunction[0], $aFunction[1],
     797                       $aFunction[4], $aFunction[5]);
     798
     799            echo "</table>\n";
     800
     801            /*
     802             * Sort text.
     803             */
     804            $fSortByState = strstr($sURLArgs, "&fSortByState=1");
     805            if ($fSortByState)
     806                $sURLArgs = str_replace("&fSortByState=1", "", $sURLArgs);
     807            else
     808                $sURLArgs = $sURLArgs."&fSortByState=1";
     809
     810            echo "<p>Click <a href=\"Odin32DB.phtml#functions?".$sURLArgs."\">here</a> to view functions sorted ".
     811                 ($fSortByState  ? "alphabetical by dll" : "by state"). ".<br>";
     812        }
     813        else
     814            echo "<i>No functions found</i><br>\n";
     815    }
     816    else
     817        Odin32DBSqlError($sql);
     818}
     819
     820
     821/**
     822 * Writes the a file listing base sqlstatement with these columns (ordered):
     823 *      0. file refcode
     824 *      1. file name
     825 *      2. number of functions
     826 *
     827 * @returns     nothing
     828 * @param       $sql        SQL statement.
     829 * @param       $db         Database connection.
     830 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     831 */
     832function Odin32DBWriteFiles($sql, $db)
     833{
     834    if ($result2 = mysql_query($sql, $db))
     835    {
     836        if (mysql_num_rows($result2) > 0)
     837        {
     838            echo "\n<table width=100% border=0 cellpadding=0>\n".
     839                 "<tr>\n".
     840                 "  <td><font size=-1><b>Filename</b></font></td>\n".
     841                 "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
     842                 "</tr>\n";
     843            while ($aFile = mysql_fetch_row($result2))
     844                printf("<tr>".
     845                       "<td width=75%%><font size=-1><a href=\"Odin32DB.phtml?filerefcode=%s\">%s</a></font></td>".
     846                       "<td align=right><font size=-1>%s</font></td>".
     847                       "</tr>\n",
     848                       $aFile[0], $aFile[1], $aFile[2]);
     849
     850            echo "</table>\n";
     851        }
     852        else
     853            echo "<i>No Files.</i><br>\n";
     854    }
     855    else
     856        Odin32DBSqlError($sql);
     857}
     858
     859
     860/**
     861 * Writes the an API Group listing base sqlstatement with these columns (ordered):
     862 *      0. apigroup refcode
     863 *      1. apigroup name
     864 *      2. number of functions
     865 *
     866 * @returns     nothing
     867 * @param       $sql        SQL statement.
     868 * @param       $db         Database connection.
     869 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     870 */
     871function Odin32DBWriteAPIGroups($sql, $db)
     872{
     873    if ($result2 = mysql_query($sql, $db))
     874    {
     875        if (mysql_num_rows($result2) > 0)
     876        {
     877            echo "\n<table width=100% border=0 cellpadding=0>\n".
     878                 "<tr>\n".
     879                 "  <td width=75%><font size=-1><b>Group Name</b></font></td>\n".
     880                 "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
     881                 "</tr>\n";
     882            while ($aAPIGroup = mysql_fetch_row($result2))
     883                printf("<tr>".
     884                       "<td><font size=-1><a href=\"Odin32DB.phtml?apigrouprefcode=%s\">%s</a></font></td>".
     885                       "<td align=right><font size=-1>%s</font></td>".
     886                       "</tr>\n",
     887                       $aAPIGroup[0], $aAPIGroup[1], $aAPIGroup[2]);
     888            echo "</table>\n";
     889        }
     890        else
     891            echo "<i>No API Groups.</i><br>\n";
     892        mysql_free_result($result2);
     893    }
     894    else
     895        Odin32DBSqlError($sql);
     896}
     897
     898
     899
     900/**
     901 * Writes the a author listing base sqlstatement with these columns (ordered):
     902 *      0. author refcode
     903 *      1. author name
     904 *      2. number of functions
     905 *
     906 * @returns     nothing
     907 * @param       $sql        SQL statement.
     908 * @param       $db         Database connection.
     909 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     910 */
     911function Odin32DBWriteAuthors($sql, $db)
     912{
     913    if ($result2 = mysql_query($sql, $db))
     914    {
     915        if (mysql_num_rows($result2) > 0)
     916        {
     917            echo "\n<table width=100% border=0 cellpadding=0>\n".
     918                 "<tr>\n".
     919                 "  <td width=75%><font size=-1><b>Author</b></font></td>\n".
     920                 "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
     921                 "</tr>\n";
     922            while ($aAuthor = mysql_fetch_row($result2))
     923                printf("<tr>".
     924                       "<td><font size=-1><a href=\"Odin32DB.phtml?authorrefcode=%s\">%s</a></font></td>".
     925                       "<td align=right><font size=-1>%s</font></td>".
     926                       "</tr>\n",
     927                       $aAuthor[0], $aAuthor[1], $aAuthor[2]);
     928
     929            echo "</table>\n";
     930        }
     931        else
     932            echo "<i>No Authors</i>.<br>\n";
     933        mysql_free_result($result2);
     934    }
     935    else
     936        Odin32DBSqlError($sql);
    621937}
    622938
     
    643959    if ($sExpand != "" && $sCollapse != "")
    644960    {
    645         echo "<br><a href=\"Odin32DB.phtml?".$sExpand."\">Expand</a> - \n".
    646              "<a href=\"Odin32DB.phtml?".$sCollapse."\">Collapse</a>\n";
     961        echo "<br><a href=\"Odin32DB.phtml?".$sExpand."\">Expand All</a> - \n".
     962             "<a href=\"Odin32DB.phtml?".$sCollapse."\">Collapse All</a>\n";
    647963    }
    648964
     
    664980    if ($sExpand != "" && $sCollapse != "")
    665981    {
    666         echo "<a href=\"Odin32DB.phtml?".$sExpand."\">Expand</a> - \n".
    667              "<a href=\"Odin32DB.phtml?".$sCollapse."\">Collapse</a><br>\n";
     982        echo "<a href=\"Odin32DB.phtml?".$sExpand."\">Expand All</a> - \n".
     983             "<a href=\"Odin32DB.phtml?".$sCollapse."\">Collapse All</a><br>\n";
    668984    }
    669985
     
    673989         " - <a href=\"Odin32DB.phtml?authors=1\">Authors</a>\n".
    674990         " - <a href=\"Odin32DB.phtml?apigroups=1\">API Groups</a>\n";
    675     echo "</font></<center>\n";
     991    echo "</font></center>\n";
    676992}
    677993
     
    6871003 *
    6881004 * @returns     void
    689  * @param       $aContent       Contents array. (input/output)
    6901005 * @param       $db             Database handle.
    6911006 * @param       $iRefcode       Function reference code.
     
    6941009 * @remark
    6951010 */
    696 function Odin32DBFunctionInfo(&$aContent, $db, $iRefcode)
     1011function Odin32DBFunctionInfo($db, $iRefcode)
    6971012{
    6981013    Odin32DBNavigationTop("","");
     
    7391054         * General
    7401055         */
    741         Odin32DBNaslov($aContent, "General", "general");
     1056        Odin32DBNaslov("General", "general");
    7421057        echo "\n<table width=100% border=3 cellpadding=0>\n";
    7431058        Odin32DBInfoRow1("Name", $array, "name","","","","");
     
    7921107                Odin32DBSqlError($sql);
    7931108        }
    794         echo "\n</table>\n";
     1109        echo "</table>\n";
    7951110
    7961111        /*
    7971112         * Completion
    7981113         */
    799         Odin32DBNaslov($aContent, "Completion", "completion");
     1114        Odin32DBNaslov("Completion", "completion");
    8001115        Odin32DBCompletionBarFunction($iRefcode, "", $db);
    8011116
     
    8041119         * Declaration
    8051120         */
    806         Odin32DBNaslov($aContent, "Declaration", "declaration");
     1121        Odin32DBNaslov("Declaration", "declaration");
    8071122        echo "\n<pre>";
    8081123        if (isset($array["return"]))
     
    8381153         * Description
    8391154         */
    840         Odin32DBDocRow($aContent, "Description", "desc", $array, "description");
     1155        Odin32DBDocRow("Description", "desc", $array, "description");
    8411156
    8421157
     
    8441159         * Parameters
    8451160         */
    846         Odin32DBNaslov($aContent, "Parameters", "params");
     1161        Odin32DBNaslov("Parameters", "params");
    8471162        if ($result2 && mysql_num_rows($result2) > 0 && mysql_data_seek($result2, 0))
    8481163        {
     
    8581173                        $sDescription = str_replace("<BR>", "", str_replace("<BR><BR>\n","<br>",$param["description"]));
    8591174                        echo "  <td width=90%><font size=-1>".$sDescription."</font></td></tr>\n";
    860                         echo "\n</table>\n";
     1175                        echo "</table>\n";
    8611176                    }
    8621177                    else
     
    8761191         * Returns
    8771192         */
    878         Odin32DBDocRow($aContent, "Returns", "return", $array, "returndesc");
     1193        Odin32DBDocRow("Returns", "return", $array, "returndesc");
    8791194
    8801195        /*
    8811196         * Sketch/Algorithm
    8821197         */
    883         Odin32DBDocRow($aContent, "Sketch/Algorithm", "sketch",  $array, "sketch");
     1198        Odin32DBDocRow("Sketch/Algorithm", "sketch",  $array, "sketch");
    8841199
    8851200        /*
    8861201         * Remark
    8871202         */
    888         Odin32DBDocRow($aContent, "Remarks", "remark", $array, "remark");
     1203        Odin32DBDocRow("Remarks", "remark", $array, "remark");
    8891204
    8901205        /*
    8911206         * Authors
    8921207         */
    893         Odin32DBNaslov($aContent, "Authors", "Authors");
     1208        Odin32DBNaslov("Authors", "Authors");
    8941209        $sql = sprintf("SELECT\n".
    8951210                       "    a.name                AS name,\n".
     
    9271242 *
    9281243 * @returns     void
    929  * @param       $aContent       Contents array. (input/output)
    9301244 * @param       $db             Database handle.
    9311245 * @param       $iRefcode       Dll reference code.
     
    9401254 * @remark
    9411255 */
    942 function Odin32DBDllInfo(&$aContent, $db, $iRefcode, $fFunctions, $fFiles, $fAPIGroups, $fAuthors, $fSortByState)
    943 {
     1256function Odin32DBDllInfo($db, $iRefcode, $fFunctions, $fFiles, $fAPIGroups, $fAuthors, $fSortByState)
     1257{
     1258    $sURLArgs = "dllrefcode=".$iRefcode.
     1259                ($fFunctions   ? "&fFunctions=1"   : "").
     1260                ($fFiles       ? "&fFiles=1"       : "").
     1261                ($fAPIGroups   ? "&fAPIGroups=1"   : "").
     1262                ($fAuthors     ? "&fAuthors=1"     : "").
     1263                ($fSortByState ? "&fSortByState=1" : "");
     1264
    9441265    /*
    9451266     * Navigation - TOP
     
    9701291         * General
    9711292         */
    972         Odin32DBNaslov($aContent, "General", "general");
     1293        Odin32DBNaslov("General", "general");
    9731294        echo "\n<table width=100% border=3 cellpadding=0>\n";
    9741295        Odin32DBInfoRow1("Name", $array, "name","","","","");
     
    10171338        }
    10181339
    1019         echo "\n</table>\n";
     1340        echo "</table>\n";
    10201341
    10211342
     
    10231344         * Completion
    10241345         */
    1025         Odin32DBNaslov($aContent, "Completion", "completion");
     1346        Odin32DBNaslov("Completion", "completion");
    10261347        Odin32DBCompletionBarDll($iRefcode, "", $db);
    10271348
     
    10291350         * States
    10301351         */
    1031         Odin32DBNaslov($aContent, "Status", "status");
    10321352        $sql = sprintf("SELECT\n".
    1033                        "    s.name              AS state,\n".
    1034                        "    s.color             AS color,\n".
    1035                        "    COUNT(f.state)      AS functions\n".
     1353                       "    state,\n".
     1354                       "    COUNT(state)\n".
    10361355                       "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",
     1356                       "    function\n".
     1357                       "WHERE\n".
     1358                       "    dll = %d\n".
     1359                       "GROUP BY state\n".
     1360                       "ORDER BY state",
    10411361                        $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 
     1362        Odin32DBWriteStates($cFunctions, $sql, $db);
    10591363
    10601364        /*
    10611365         * Functions
    10621366         */
    1063         Odin32DBNaslov($aContent, "Functions", "functions");
     1367        Odin32DBNaslov("Functions", "functions");
    10641368        if ($fFunctions)
    10651369        {
    10661370            $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".
     1371                           "    f.refcode,\n".
     1372                           "    f.name,\n".
     1373                           "    s.color,\n".
     1374                           "    s.name\n".
    10711375                           "FROM\n".
    10721376                           "    function f\n".
     
    10741378                           "WHERE\n".
    10751379                           "    f.dll = %d\n",
    1076                             $iRefcode);
     1380                           $iRefcode);
    10771381            if ($fSortByState)
    10781382                $sql = $sql."ORDER BY s.refcode, f.name";
    10791383            else
    10801384                $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);
     1385            Odin32DBWriteFunctions($sql, $db, $sURLArgs);
    11101386        }
    11111387        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         }
     1388            echo "Click <a href=\"Odin32DB.phtml#functions?".$sURLArgs."&fFunctions=1".
     1389                 "\">here</a> to see all functions.\n";
    11201390
    11211391
     
    11231393         * Files
    11241394         */
    1125         Odin32DBNaslov($aContent, "Files", "files");
     1395        Odin32DBNaslov("Files", "files");
    11261396        if ($fFiles)
    11271397        {
    11281398            $sql = sprintf("SELECT\n".
    1129                            "    f.name              AS name,\n".
    1130                            "    f.refcode           AS refcode,\n".
    1131                            "    COUNT(fn.refcode)   AS functions\n".
     1399                           "    f.refcode,\n".
     1400                           "    f.name,\n".
     1401                           "    COUNT(fn.refcode)\n".
    11321402                           "FROM\n".
    11331403                           "    file f\n".
     
    11371407                           "GROUP BY f.refcode\n".
    11381408                           "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);
     1409                           $iRefcode);
     1410            Odin32DBWriteFiles($sql, $db);
    11641411        }
    11651412        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         }
     1413            echo "Click <a href=\"Odin32DB.phtml#files?".$sURLArgs."&fFiles=1".
     1414                 "\">here</a> to see all files.\n";
    11741415
    11751416
     
    11791420        if ($cAPIGroups > 0)
    11801421        {
    1181             Odin32DBNaslov($aContent, "API Groups", "apigroups");
     1422            Odin32DBNaslov("API Groups", "apigroups");
    11821423            if ($fAPIGroups)
    11831424            {
    11841425                $sql = sprintf("SELECT\n".
    1185                                "    g.name              AS name,\n".
    1186                                "    g.refcode           AS refcode,\n".
    1187                                "    COUNT(f.refcode)    AS functions\n".
     1426                               "    g.refcode,\n".
     1427                               "    g.name,\n".
     1428                               "    COUNT(f.refcode)\n".
    11881429                               "FROM\n".
    11891430                               "    apigroup g\n".
     
    11971438                               $iRefcode,
    11981439                               $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);
     1440                Odin32DBWriteAPIGroups($sql, $db);
    12221441            }
    12231442            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             }
     1443                echo "Click <a href=\"Odin32DB.phtml#apigroups?".$sURLArgs."&fAPIGroups=1".
     1444                     "\">here</a> to see all the API Groups.\n";
    12321445        }
    12331446
     
    12361449         * Authors
    12371450         */
    1238         Odin32DBNaslov($aContent, "Authors", "authors");
     1451        Odin32DBNaslov("Authors", "authors");
    12391452        if ($fAuthors)
    12401453        {
    12411454            $sql = sprintf("SELECT\n".
    1242                            "    a.name              AS name,\n".
    1243                            "    a.refcode           AS refcode,\n".
    1244                            "    COUNT(f.refcode)    AS functions\n".
     1455                           "    a.refcode,\n".
     1456                           "    a.name,\n".
     1457                           "    COUNT(f.refcode)\n".
    12451458                           "FROM\n".
    12461459                           "    fnauthor fa\n".
     
    12531466                           "GROUP BY a.refcode\n".
    12541467                           "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);
     1468                            $iRefcode);
     1469            Odin32DBWriteAuthors($sql, $db);
    12801470        }
    12811471        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         }
     1472            echo "Click <a href=\"Odin32DB.phtml#authors?".$sURLArgs."&fAuthors=1".
     1473                 "\">here</a> to see all authors.\n";
    12901474    }
    12911475    else
     
    13071491 *
    13081492 * @returns     void
    1309  * @param       $aContent       Contents array. (input/output)
    13101493 * @param       $db             Database handle.
    13111494 * @param       $iRefcode       File reference code.
     
    13191502 * @remark
    13201503 */
    1321 function Odin32DBFileInfo(&$aContent, $db, $iRefcode, $fFunctions, $fAPIGroups, $fAuthors, $fSortByState)
    1322 {
     1504function Odin32DBFileInfo($db, $iRefcode, $fFunctions, $fAPIGroups, $fAuthors, $fSortByState)
     1505{
     1506    $sURLArgs = "filerefcode=".$iRefcode.
     1507                ($fFunctions   ? "&fFunctions=1"   : "").
     1508                ($fAuthors     ? "&fAuthors=1"     : "").
     1509                ($fAPIGroups   ? "&fAPIGroups=1"   : "").
     1510                ($fSortByState ? "&fSortByState=1" : "");
     1511
    13231512    /*
    13241513     * Navigation - TOP
     
    13561545         * General
    13571546         */
    1358         Odin32DBNaslov($aContent, "General", "general");
     1547        Odin32DBNaslov("General", "general");
    13591548        echo "\n<table width=100% border=3 cellpadding=0>\n";
    13601549        Odin32DBInfoRow1("Name", $array, "name","","","","");
     
    13921581            Odin32DBSqlError($sql);
    13931582
    1394         echo "\n</table>\n";
     1583        echo "</table>\n";
    13951584
    13961585        /*
    13971586         * Description
    13981587         */
    1399         Odin32DBDocRow($aContent, "Description", "description", $array, "description");
     1588        Odin32DBDocRow("Description", "description", $array, "description");
    14001589
    14011590        /*
    14021591         * Completion
    14031592         */
    1404         Odin32DBNaslov($aContent, "Completion", "completion");
     1593        Odin32DBNaslov("Completion", "completion");
    14051594        Odin32DBCompletionBarFile($iRefcode, "", $db);
    14061595
     
    14081597         * States
    14091598         */
    1410         Odin32DBNaslov($aContent, "Status", "status");
    14111599        $sql = sprintf("SELECT\n".
    1412                        "    s.name              AS state,\n".
    1413                        "    s.color             AS color,\n".
    1414                        "    COUNT(f.state)      AS functions\n".
     1600                       "    state,\n".
     1601                       "    COUNT(state)\n".
    14151602                       "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",
     1603                       "    function\n".
     1604                       "WHERE\n".
     1605                       "    file = %d\n".
     1606                       "GROUP BY state\n".
     1607                       "ORDER BY state",
    14201608                        $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);
     1609        Odin32DBWriteStates($cFunctions, $sql, $db);
    14371610
    14381611
     
    14401613         * Functions
    14411614         */
    1442         Odin32DBNaslov($aContent, "Functions", "functions");
     1615        Odin32DBNaslov("Functions", "functions");
    14431616        if ($fFunctions)
    14441617        {
    14451618            $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".
     1619                           "    f.refcode,\n".
     1620                           "    f.name,\n".
     1621                           "    s.color,\n".
     1622                           "    s.name\n".
    14501623                           "FROM\n".
    14511624                           "    function f\n".
     
    14581631            else
    14591632                $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);
     1633            Odin32DBWriteFunctions($sql, $db, $sURLArgs);
    14881634        }
    14891635        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         }
     1636            echo "Click <a href=\"Odin32DB.phtml#functions?".$sURLArgs."&fFunctions=1".
     1637                 "\">here</a> to see all functions.\n";
    14971638
    14981639
     
    15021643        if ($cAPIGroups > 0)
    15031644        {
    1504             Odin32DBNaslov($aContent, "API Groups", "apigroups");
     1645            Odin32DBNaslov("API Groups", "apigroups");
    15051646            if ($fAPIGroups)
    15061647            {
    15071648                $sql = sprintf("SELECT\n".
    1508                                "    g.name              AS name,\n".
    1509                                "    g.refcode           AS refcode,\n".
    1510                                "    COUNT(f.refcode)    AS functions\n".
     1649                               "    g.refcode,\n".
     1650                               "    g.name,\n".
     1651                               "    COUNT(f.refcode)\n".
    15111652                               "FROM\n".
    15121653                               "    apigroup g\n".
     
    15181659                               "ORDER BY g.name\n",
    15191660                               $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);
     1661                Odin32DBWriteAPIGroups($sql, $db);
    15431662            }
    15441663            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             }
     1664                echo "Click <a href=\"Odin32DB.phtml#apigroups?".$sURLArgs."&fAPIGroups=1".
     1665                     "\">here</a> to see all the API Groups.\n";
    15521666        }
    15531667
     
    15561670         * Authors
    15571671         */
    1558         Odin32DBNaslov($aContent, "Authors", "authors");
     1672        Odin32DBNaslov("Authors", "authors");
    15591673        if ($fAuthors)
    15601674        {
    15611675            $sql = sprintf("SELECT\n".
    1562                            "    a.name              AS name,\n".
    1563                            "    a.refcode           AS refcode,\n".
    1564                            "    COUNT(f.refcode)    AS functions\n".
     1676                           "    a.refcode,\n".
     1677                           "    a.name,\n".
     1678                           "    COUNT(f.refcode)\n".
    15651679                           "FROM\n".
    15661680                           "    fnauthor fa\n".
     
    15751689                            $iRefcode
    15761690                            );
    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);
     1691            Odin32DBWriteAuthors($sql, $db);
    16001692        }
    16011693        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         }
     1694            echo "Click <a href=\"Odin32DB.phtml#authors?".$sURLArgs."&fAuthors=1".
     1695                 "\">here</a> to see all authors.\n";
    16091696    }
    16101697    else
     
    16261713 *
    16271714 * @returns     void
    1628  * @param       $aContent       Contents array. (input/output)
    16291715 * @param       $db             Database handle.
    16301716 * @param       $iRefcode       Author reference code.
     
    16411727 * @remark
    16421728 */
    1643 function Odin32DBAuthorInfo(&$aContent, $db, $iRefcode, $fDlls, $fFunctions, $fFiles, $fAPIGroups, $fSortByState, $iDllRefcode)
    1644 {
     1729function Odin32DBAuthorInfo($db, $iRefcode, $fDlls, $fFunctions, $fFiles, $fAPIGroups, $fSortByState, $iDllRefcode)
     1730{
     1731    $sURLArgs = "authorrefcode=".$iRefcode.
     1732                ($fDlls        ? "&fDlls=1"        : "").
     1733                ($fFunctions   ? "&fFunctions=1"   : "").
     1734                ($fFiles       ? "&fFiles=1"       : "").
     1735                ($fAPIGroups   ? "&fAPIGroups=1"   : "").
     1736                ($fSortByState ? "&fSortByState=1" : "");
     1737
    16451738    /*
    16461739     * Navigation - TOP
     
    16731766         * General
    16741767         */
    1675         Odin32DBNaslov($aContent, "General", "general");
     1768        Odin32DBNaslov("General", "general");
    16761769        echo "\n<table width=100% border=3 cellpadding=0>\n";
    16771770        Odin32DBInfoRow1("Name", $array, "name","","","","");
     
    17401833            Odin32DBInfoRow1NoArray("# API Groups", $cAPIGroups, "","","","");
    17411834
    1742         echo "\n</table>\n";
     1835        echo "</table>\n";
    17431836
    17441837        /*
    17451838         * Completion
    17461839         */
    1747         Odin32DBNaslov($aContent, "Completion", "completion");
     1840        Odin32DBNaslov("Completion", "completion");
    17481841        Odin32DBCompletionBarAuthor($iRefcode, "", $db);
    17491842
     
    17511844         * States
    17521845         */
    1753         Odin32DBNaslov($aContent, "Status", "status");
     1846        //TODO: optimize this further.
    17541847        $sql = sprintf("SELECT\n".
    1755                        "    s.name              AS state,\n".
    1756                        "    s.color             AS color,\n".
    1757                        "    COUNT(f.refcode)    AS functions\n".
     1848                       "    f.state,\n".
     1849                       "    COUNT(f.refcode)\n".
    17581850                       "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",
     1851                       "    function f,\n".
     1852                       "    fnauthor fa\n".
     1853                       "WHERE\n".
     1854                       "    fa.author = %d AND\n".
     1855                       "    fa.function = f.refcode\n".
     1856                       "GROUP BY f.state\n".
     1857                       "ORDER BY f.state",
    17641858                        $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);
     1859        Odin32DBWriteStates($cFunctions, $sql, $db);
    17811860
    17821861        /*
    17831862         * Dlls
    17841863         */
    1785         Odin32DBNaslov($aContent, "Dlls", "dlls");
     1864        Odin32DBNaslov("Dlls", "dlls");
    17861865        if ($fDlls)
    17871866        {
    17881867            $sql = sprintf("SELECT\n".
    1789                            "    d.name              AS name,\n".
    1790                            "    d.refcode           AS refcode,\n".
    1791                            "    COUNT(f.refcode)    AS functions\n".
     1868                           "    d.refcode,\n".
     1869                           "    d.name,\n".
     1870                           "    COUNT(f.refcode)\n".
    17921871                           "FROM\n".
    17931872                           "    fnauthor fa,\n".
     
    18011880                           "ORDER BY d.name\n",
    18021881                            $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);
     1882            Odin32DBWriteDlls($sql, $db, $sURLArgs);
    18261883        }
    18271884        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         }
     1885            echo "Click <a href=\"Odin32DB.phtml#dlls?".$sURLArgs."&fDlls=1".
     1886                 "\">here</a> to see all files.\n";
    18361887
    18371888
     
    18391890         * Functions
    18401891         */
    1841         Odin32DBNaslov($aContent, "Functions", "functions");
     1892        Odin32DBNaslov("Functions", "functions");
    18421893        if ($fFunctions)
    18431894        {
    18441895            $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".
     1896                           "    f.refcode,\n".
     1897                           "    f.name,\n".
     1898                           "    d.refcode,\n".
     1899                           "    d.name,\n".
     1900                           "    s.color,\n".
     1901                           "    s.name\n".
    18511902                           "FROM\n".
    18521903                           "    fnauthor fa\n".
     
    18631914            else
    18641915                $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);
     1916            Odin32DBWriteFunctionsWithDlls($sql, $db, $sURLArgs);
    18951917        }
    18961918        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         }
     1919            echo "Click <a href=\"Odin32DB.phtml#functions?".$sURLArgs."&fFunctions=1".
     1920                 "\">here</a> to see all functions.\n";
    19051921
    19061922
     
    19081924         * Files
    19091925         */
    1910         Odin32DBNaslov($aContent, "Files", "files");
     1926        Odin32DBNaslov("Files", "files");
    19111927        if ($fFiles)
    19121928        {
    1913             //TODO: OPTMIZE THIS SQL!!!
    19141929            $sql = sprintf("SELECT\n".
    1915                            "    f.name              AS name,\n".
    1916                            "    f.refcode           AS refcode,\n".
    1917                            "    COUNT(fn.refcode)   AS functions\n".
     1930                           "    f.refcode,\n".
     1931                           "    f.name,\n".
     1932                           "    COUNT(fn.refcode)\n".
    19181933                           "FROM\n".
    19191934                           "    fnauthor fa,\n".
    1920                            "    file f\n".
    1921                            "    LEFT OUTER JOIN function fn\n".
    1922                            "        ON fn.file = f.refcode\n".
     1935                           "    file f,\n".
     1936                           "    function fn\n".
    19231937                           "WHERE\n".
    1924                            "    fa.author = %d AND fa.function = fn.refcode\n".
     1938                           "    fa.author = %d AND\n".
     1939                           "    fa.function = fn.refcode AND\n".
     1940                           "    fn.file = f.refcode\n".
    19251941                           "GROUP BY f.refcode\n".
    19261942                           "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);
     1943                           $iRefcode);
     1944            Odin32DBWriteFiles($sql, $db);
    19511945        }
    19521946        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         }
     1947            echo "Click <a href=\"Odin32DB.phtml#files?".$sURLArgs."&fFiles=1".
     1948                 "\">here</a> to see all files.\n";
    19611949
    19621950
     
    19661954        if ($cAPIGroups > 0)
    19671955        {
    1968             Odin32DBNaslov($aContent, "API Groups", "apigroups");
     1956            Odin32DBNaslov("API Groups", "apigroups");
    19691957            if ($fAPIGroups)
    19701958            {
    19711959                $sql = sprintf("SELECT\n".
    1972                                "    g.name              AS name,\n".
    1973                                "    g.refcode           AS refcode,\n".
    1974                                "    COUNT(f.refcode)    AS functions\n".
     1960                               "    g.refcode,\n".
     1961                               "    g.name,\n".
     1962                               "    COUNT(f.refcode)\n".
    19751963                               "FROM\n".
    19761964                               "    fnauthor fa\n".
     
    19841972                               "ORDER BY g.name\n",
    19851973                               $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);
     1974                Odin32DBWriteAPIGroups($sql, $db);
    20091975            }
    20101976            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             }
     1977                echo "Click <a href=\"Odin32DB.phtml#apigroups?".$sURLArgs."&fAPIGroups=1".
     1978                     "\">here</a> to see all the API Groups.\n";
    20191979        }
    20201980    }
     
    20371997 *
    20381998 * @returns     void
    2039  * @param       $aContent       Contents array. (input/output)
    20401999 * @param       $db             Database handle.
    20412000 * @param       $iRefcode       Author reference code.
     
    20492008 * @remark
    20502009 */
    2051 function Odin32DBAPIGroupInfo(&$aContent, $db, $iRefcode, $fFunctions, $fFiles, $fAuthors, $fSortByState)
    2052 {
     2010function Odin32DBAPIGroupInfo($db, $iRefcode, $fFunctions, $fFiles, $fAuthors, $fSortByState)
     2011{
     2012    $sURLArgs = "apigrouprefcode=".$iRefcode.
     2013                ($fFunctions   ? "&fFunctions=1"   : "").
     2014                ($fFiles       ? "&fFiles=1"       : "").
     2015                ($fAuthors     ? "&fAuthors=1"     : "").
     2016                ($fSortByState ? "&fSortByState=1" : "");
     2017
    20532018    /*
    20542019     * Navigation - TOP
     
    20802045         * General
    20812046         */
    2082         Odin32DBNaslov($aContent, "General", "general");
     2047        Odin32DBNaslov("General", "general");
    20832048        echo "\n<table width=100% border=3 cellpadding=0>\n";
    20842049        Odin32DBInfoRow1("Name", $array, "name","","","","");
     
    21262091            Odin32DBInfoRow1NoArray("# Authors", $cAuthors, "","","","");
    21272092
    2128         echo "\n</table>\n";
     2093        echo "</table>\n";
    21292094
    21302095        /*
    21312096         * Completion
    21322097         */
    2133         Odin32DBNaslov($aContent, "Completion", "completion");
     2098        Odin32DBNaslov("Completion", "completion");
    21342099        Odin32DBCompletionBarAPIGroup($iRefcode, "", $db);
    21352100
     
    21372102         * States
    21382103         */
    2139         Odin32DBNaslov($aContent, "Status", "status");
    21402104        $sql = sprintf("SELECT\n".
    2141                        "    s.name              AS state,\n".
    2142                        "    s.color             AS color,\n".
    2143                        "    COUNT(f.state)      AS functions\n".
     2105                       "    f.state,\n".
     2106                       "    COUNT(f.state)\n".
    21442107                       "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",
     2108                       "    function\n".
     2109                       "WHERE\n".
     2110                       "    f.apigroup = %d\n".
     2111                       "GROUP BY f.state\n".
     2112                       "ORDER BY f.state",
    21492113                        $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);
     2114        Odin32DBWriteStates($cFunctions, $sql, $db);
    21662115
    21672116        /*
    21682117         * Functions
    21692118         */
    2170         Odin32DBNaslov($aContent, "Functions", "functions");
     2119        Odin32DBNaslov("Functions", "functions");
    21712120        if ($fFunctions)
    21722121        {
     2122            //TODO: optimize this...
    21732123            $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".
     2124                           "    f.refcode,\n".
     2125                           "    f.name,\n".
     2126                           "    s.color,\n".
     2127                           "    s.name\n".
    21782128                           "FROM\n".
    21792129                           "    function f\n".
     
    21862136            else
    21872137                $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);
     2138            Odin32DBWriteFunctions($sql, $db, $sURLArgs);
    22162139        }
    22172140        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         }
     2141            echo "Click <a href=\"Odin32DB.phtml#functions?".$sURLArgs."&fFunctions=1".
     2142                 "\">here</a> to see all functions.\n";
    22252143
    22262144
     
    22282146         * Files
    22292147         */
    2230         Odin32DBNaslov($aContent, "Files", "files");
     2148        Odin32DBNaslov("Files", "files");
    22312149        if ($fFiles)
    22322150        {
     2151            //TODO: optimize this...
    22332152            $sql = sprintf("SELECT\n".
    2234                            "    f.name              AS name,\n".
    2235                            "    f.refcode           AS refcode,\n".
    2236                            "    COUNT(fn.refcode)   AS functions\n".
     2153                           "    f.refcode,\n".
     2154                           "    f.name,\n".
     2155                           "    COUNT(fn.refcode)\n".
    22372156                           "FROM\n".
    22382157                           "    file f\n".
     
    22422161                           "GROUP BY f.refcode\n".
    22432162                           "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);
     2163                           $iRefcode);
     2164            Odin32DBWriteFiles($sql, $db);
    22692165        }
    22702166        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         }
     2167            echo "Click <a href=\"Odin32DB.phtml#files?".$sURLArgs."&fFiles=1".
     2168                 "\">here</a> to see all files.\n";
    22782169
    22792170
     
    22812172         * Authors
    22822173         */
    2283         Odin32DBNaslov($aContent, "Authors", "authors");
     2174        Odin32DBNaslov("Authors", "authors");
    22842175        if ($fAuthors)
    22852176        {
     2177            //TODO: optimize this...
    22862178            $sql = sprintf("SELECT\n".
    2287                            "    a.name              AS name,\n".
    2288                            "    a.refcode           AS refcode,\n".
    2289                            "    COUNT(f.refcode)    AS functions\n".
     2179                           "    a.refcode,\n".
     2180                           "    a.name,\n".
     2181                           "    COUNT(f.refcode)\n".
    22902182                           "FROM\n".
    22912183                           "    fnauthor fa\n".
     
    22982190                           "GROUP BY a.refcode\n".
    22992191                           "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);
     2192                           $iRefcode
     2193                           );
     2194            Odin32DBWriteAuthors($sql, $db);
    23252195        }
    23262196        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         }
     2197            echo "Click <a href=\"Odin32DB.phtml#authors?".$sURLArgs."&fAuthors=1".
     2198                 "\">here</a> to see all authors.\n";
    23342199    }
    23352200    else
     
    23522217/* TEXT FORMATTING OVERLOADS */
    23532218/* TEXT FORMATTING OVERLOADS */
     2219$aContent = array();
    23542220
    23552221/**
     
    23572223 * @sketch      Writes the headers present in the contents array.
    23582224 */
    2359 function Odin32DBWriteContents(&$aContent)
    2360 {
     2225function Odin32DBWriteContents()
     2226{
     2227    global $aContent;
     2228
    23612229    TocBeg();
    23622230    for ($i = 0; $i < sizeof($aContent); $i += 2)
     
    23682236 * Forwarder which also maintains the contents array.
    23692237 */
    2370 function Odin32DBNaslov(&$aContent, $sFull, $sShort)
    2371 {
     2238function Odin32DBNaslov($sFull, $sShort)
     2239{
     2240    global $aContent;
     2241
    23722242    $aContent[] = $sFull;
    23732243    $aContent[] = $sShort;
  • trunk/tools/database/www/Odin32WAI.phtml

    r3902 r3904  
    33
    44require "stilovi.php3";
     5require "Odin32DBHelpers.php3";
     6
     7/* Profiling */
     8$sPageTimer = Odin32DBTimerStart("page timer");
     9/* Profiling */
     10
    511
    612require "01-PreTitle.php3";
     
    8389 *
    8490 */
    85 Require "Odin32DBHelpers.php3";
    86 
    87 $db = mysql_connect("127.0.0.1", "root", "");
    88 $rc = mysql_select_db("odin32", $db);
     91require "Odin32DBConnect.php3";
     92
    8993$sql="SELECT    g.refcode       AS refcode,
    9094                g.name          AS name,
     
    424428
    425429require "13-Closing.php3";
     430
     431/* Profiling */
     432Odin32DBTimerStop($sPageTimer);
     433/* Profiling */
     434
    426435?>
Note: See TracChangeset for help on using the changeset viewer.