Ignore:
Timestamp:
Jul 31, 2000, 1:48:41 AM (25 years ago)
Author:
bird
Message:

More coding done...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/database/www/Odin32DBHelpers.php3

    r3901 r3902  
    2727                            AND dll = %d",
    2828                        $iDll);
    29     $result = mysql_query($sql, $db);
    30     if (mysql_num_rows($result) < 1)
     29    if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) < 1)
    3130    {
    3231        echo "<br>Odin32DBComputeCompletion: IPE no. 1 <br>";
     
    3938
    4039
     40/**
     41 * Draws a completion bar for a Function.
     42 * @param       $iFunction      Function reference code.
     43 * @param       $iFunctionName  Function name.
     44 * @param       $db             Database connection variable.
     45 * @sketch      Call Odin32DBCompletionBar2 with an appropriate condition.
     46 * @status      Completely implemented
     47 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     48 */
     49function Odin32DBCompletionBarFunction($iFunction, $sFunctionName, $db)
     50{
     51    return Odin32DBcompletionBar2("refcode = ".$iFunction, $sFunctionName, $db);
     52}
     53
     54
     55/**
     56 * Draws a completion bar for a dll (or all dlls).
     57 * @param       $iDll       Dll reference code.
     58 *                          If < 0 then for the entire project.
     59 * @param       $iDllName   Dll name.
     60 * @param       $db         Database connection variable.
     61 * @sketch      Call Odin32DBCompletionBar2 with an appropriate condition.
     62 * @status      Completely implemented
     63 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     64 */
     65function Odin32DBCompletionBarDll($iDll, $sDllName, $db)
     66{
     67    if ($iDll < 0)
     68        return Odin32DBcompletionBar2("", $sDllName, $db);
     69    return Odin32DBcompletionBar2("dll = ".$iDll, $sDllName, $db);
     70}
     71
     72/**
     73 * Draws a completion bar for a File.
     74 * @param       $iFile          File reference code.
     75 * @param       $iFileName      File name.
     76 * @param       $db             Database connection variable.
     77 * @sketch      Call Odin32DBCompletionBar2 with an appropriate condition.
     78 * @status      Completely implemented
     79 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     80 */
     81function Odin32DBCompletionBarFile($iFile, $sFileName, $db)
     82{
     83    return Odin32DBcompletionBar2("file = ".$iFile, $sFileName, $db);
     84}
     85
     86/**
     87 * Draws a completion bar for an API Group.
     88 * @param       $iAPIGroup      API Group reference code.
     89 * @param       $iAPIGroupName  API Group name.
     90 * @param       $db             Database connection variable.
     91 * @sketch      Call Odin32DBCompletionBar2 with an appropriate condition.
     92 * @status      Completely implemented
     93 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     94 */
     95function Odin32DBCompletionBarAPIGroup($iAPIGroup, $sAPIGroupName, $db)
     96{
     97    return Odin32DBcompletionBar2("apigroup = ".$iAPIGroup, $sAPIGroupName, $db);
     98}
     99
     100/**
     101 * Draws a completion bar for an Author.
     102 * @param       $iAuthor        Author reference code.
     103 * @param       $iAuthorName    Author name.
     104 * @param       $db             Database connection variable.
     105 * @sketch      Call Odin32DBCompletionBar2 with an appropriate condition.
     106 * @status      Completely implemented
     107 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     108 */
     109function Odin32DBCompletionBarAuthor($iAuthor, $sAuthorName, $db)
     110{
     111    /*
     112     * Count the total number of functions in the DLL.
     113     */
     114    $sql = "SELECT COUNT(*) FROM fnauthor fa JOIN function f\n".
     115           "WHERE fa.function = f.refcode AND fa.author = ".$iAuthor;
     116    if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) < 1)
     117    {
     118        printf("\n\n<br>Odin32DBCompletionBar2: IPE(1).<br>\n\n");
     119        return -1;
     120    }
     121    $row = mysql_fetch_row($result);
     122    $cFunctions = $row[0];
     123    mysql_free_result($result);
     124
     125
     126    /*
     127     * Make
     128     */
     129    echo "
     130        <table width=100% border=0 cellspacing=0 cellpadding=0>
     131        ";
     132    if ($sAuthorName != '')
     133        echo "
     134        <tr>
     135            <td width=90%>
     136                <font size=-1 color=000099>
     137                <tt>".$sAuthorName."</tt>
     138                </font>
     139            </td>
     140            <td width=10%></td>
     141        </tr>";
     142    echo "
     143        <tr>
     144            <td width=90%>
     145                <table width=100% border=0 cellspacing=0 cellpadding=0>
     146                <tr>
     147        ";
     148
     149
     150    /*
     151     * Get states and make bar.
     152     */
     153    $sql = "SELECT\n".
     154           "    COUNT(f.refcode)    AS count,\n".
     155           "    f.state             AS state,\n".
     156           "    s.color             AS color,\n".
     157           "    s.weight            AS weight\n".
     158           "FROM\n".
     159           "    fnauthor fa,\n".
     160           "    function f,\n".
     161           "    state s\n".
     162           "WHERE\n".
     163           "    fa.author = ".$iAuthor." AND\n".
     164           "    fa.function = f.refcode AND\n".
     165           "    f.state = s.refcode\n".
     166           "GROUP BY f.state\n".
     167           "ORDER BY state\n";
     168    $rdCompletePercent = 0.0;
     169    if (!($result = mysql_query($sql, $db)))
     170        Odin32DBSqlError($sql);
     171    else if (mysql_num_rows($result) < 1)
     172    {
     173        echo "
     174                    <td colspan=2 bgcolor=dddddd>
     175                        <font size=-1>
     176                        &nbsp;
     177                        </font>
     178                    </td>
     179            ";
     180    }
     181    else
     182    {
     183        while ($row = mysql_fetch_row($result))
     184        {
     185            $iPercent = (int)($row[0] * 90 /* 10% is reserved to % */ / $cFunctions);
     186            if ($iPercent == 0)
     187                $iPercent = 1;
     188            echo "
     189                    <td width=".$iPercent." bgcolor=".$row[2].">
     190                        <font size=-1>
     191                        &nbsp;
     192                        </font>
     193                    </td>
     194                ";
     195
     196            $rdCompletePercent += ((double)$row[3] * (double)$row[0]) / $cFunctions;
     197        }
     198
     199    }
     200    mysql_free_result($result);
     201
     202    /*
     203     * Complete bar with a total completion percent.
     204     */
     205    echo "
     206                    <td width=10% align=right>
     207                        <font size=-1 color=000099>
     208                        ".(int)$rdCompletePercent."%
     209                        </font>
     210                    </td>
     211                </tr>
     212                </table>
     213            </td>
     214        </tr>
     215        </table>
     216        ";
     217
     218}
    41219
    42220/**
     
    51229 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    52230 */
    53 function Odin32DBCompletionBar($iDll, $sDllName, $db)
     231function Odin32DBCompletionBar2($sCondition, $sName, $db)
    54232{
    55233    /*
    56234     * Count the total number of functions in the DLL.
    57235     */
    58     if ($iDll < 0)
    59         $sql = "SELECT COUNT(*) FROM function f";
    60     else
    61         $sql = sprintf("SELECT COUNT(*) FROM function f WHERE dll = %d", $iDll);
    62     $result = mysql_query($sql, $db);
    63     if (mysql_num_rows($result) < 1)
    64     {
    65         printf("\n\n<br>Odin32DBCompletionBar: IPE(1).<br>\n\n");
     236    $sql = "SELECT COUNT(*) FROM function f";
     237    if ($sCondition != "")  $sql = $sql." WHERE f.".$sCondition;
     238    if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) < 1)
     239    {
     240        printf("\n\n<br>Odin32DBCompletionBar2: IPE(1).<br>\n\n");
     241        Odin32DBSqlError($sql);
    66242        return -1;
    67243    }
     
    77253        <table width=100% border=0 cellspacing=0 cellpadding=0>
    78254        ";
    79     if ($sDllName != '')
     255    if ($sName != '')
    80256        echo "
    81257        <tr>
    82258            <td width=90%>
    83259                <font size=-1 color=000099>
    84                 <tt>".$sDllName."</tt>
     260                <tt>".$sName."</tt>
    85261                </font>
    86262            </td>
     
    98274     * Get states and make bar.
    99275     */
    100     if ($iDll < 0)
    101         $sDllCond = "";
    102     else
    103         $sDllCond = "dll = %d AND ";
    104     $sql = sprintf("SELECT  COUNT(f.refcode)    AS count,
    105                             f.state             AS state,
    106                             s.color             AS color,
    107                             s.weight            AS weight
    108                         FROM
    109                             function f,
    110                             state s
    111                         WHERE
    112                             ".$sDllCond."
    113                             s.refcode = f.state
    114                         GROUP BY f.state
    115                         ORDER BY state",
    116                    $iDll);
    117     $result = mysql_query($sql, $db);
     276    if ($sCondition != "")  $sCondition = "f.".$sCondition." AND";
     277    $sql = "SELECT\n".
     278           "    COUNT(f.refcode)    AS count,\n".
     279           "    f.state             AS state,\n".
     280           "    s.color             AS color,\n".
     281           "    s.weight            AS weight\n".
     282           "FROM\n".
     283           "    function f,\n".
     284           "    state s\n".
     285           "WHERE\n".
     286           "    ".$sCondition."\n".
     287           "    s.refcode = f.state\n".
     288           "GROUP BY f.state\n".
     289           "ORDER BY state\n";
    118290    $rdCompletePercent = 0.0;
    119     if (@mysql_num_rows($result) < 1)
     291    if (!($result = mysql_query($sql, $db)))
     292        Odin32DBSqlError($sql);
     293    else if (mysql_num_rows($result) < 1)
    120294    {
    121295        echo "
     
    187361                    state
    188362                ORDER BY refcode";
    189 
    190     $result = mysql_query($sql, $db);
    191     if (mysql_num_rows($result) < 1)
     363    if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) < 1)
    192364    {
    193365        printf("\n\n<br>Odin32DBStateLegned: IPE(1).<br>\n\n");
     
    318490        <tr>\n";
    319491}
     492
     493
     494/**
     495 *
     496 * @returns
     497 * @param       $sName
     498 * @param       $sValue         Value.
     499 * @param       $sRef           Reference.
     500 * @param       $sOdin32DBArg   Odin32DB.phtml argument.
     501 * @param       $sNullText      Null text (if the array element is NULL display this).
     502 * @param       $sPostText      Text to insert after the value.
     503 *
     504 */
     505function Odin32DBInfoRow1NoArray($sName, $sValue, $sRef, $sOdin32DBArg, $sNullText, $sPostText)
     506{
     507    echo "
     508        <tr>
     509            <td width=35%><tt>".$sName."</tt></td>
     510            <td valign=top>";
     511    if (isset($sValue) && $sValue != "")
     512    {
     513        if (isset($sRef) && $sRef != "" && $sOdin32DBArg != "")
     514        {
     515            echo "<a href=\"Odin32DB.phtml?".$sOdin32DBArg."=".$sRef."\">";
     516            $sPostText = "</a>".$sPostText;
     517        }
     518        echo $sValue.$sPostText;
     519    }
     520    else if ($sNullText != "")
     521        echo "<i>".$sNullText."</i>";
     522
     523    echo "
     524            </td>
     525        <tr>\n";
     526}
     527
    320528
    321529
     
    432640 * @remark
    433641 */
    434 function Odin32DBFunctionInfoAll(&$aContent, $db, $iRefcode)
     642function Odin32DBFunctionInfo(&$aContent, $db, $iRefcode)
    435643{
    436644    $sql = sprintf("SELECT\n".
     
    470678                   "    f.refcode = %d",
    471679                    $iRefcode);
    472     $result = mysql_query($sql, $db);
    473     if (@mysql_num_rows($result) > 0 &&
    474         ($array = mysql_fetch_array($result))
    475         )
     680    if (($result = mysql_query($sql, $db)) && @mysql_num_rows($result) > 0 && ($array = mysql_fetch_array($result)))
    476681    {
    477682        /*
     
    489694        Odin32DBInfoRow1("Dll", $array, "dllname", "dllrefcode", "dllrefcode","","");
    490695        Odin32DBInfoRow1("Ordinal", $array, "ordinal","","","not available","");
     696        if (isset($array["apigroupname"]))
     697            Odin32DBInfoRow1("API Group", $array, "apigroupname", "apigrouprefcode", "apigrouprefcode","","");
     698        Odin32DBInfoRow1("File", $array, "filename", "filerefcode", "filerefcode","not available","");
    491699        if (isset($array["aliasrefcode"]))
    492700            Odin32DBInfoRow2("Forwards", $array, "aliasdllname", "aliasdllrefcode", "dllrefcode","",".",
    493701                                                 "aliasname", "aliasrefcode", "functionrefcode");
    494         if (isset($array["apigroup"]))
    495             Odin32DBInfoRow1("API Group", $array, "apigroupname", "apigrouprefcode", "apigrouprefcode","","");
    496         Odin32DBInfoRow1("File", $array, "filename", "filerefcode", "filerefcode","not available","");
     702        else
     703        {
     704            $sql = sprintf("SELECT\n".
     705                           "    d.name      AS dllname,\n".
     706                           "    d.refcode   AS dllrefcode,\n".
     707                           "    f.name      AS fnname,\n".
     708                           "    f.refcode   AS fnrefcode\n".
     709                           "FROM\n".
     710                           "    function f,\n".
     711                           "    dll d\n".
     712                           "WHERE\n".
     713                           "    f.aliasfn = %d AND\n".
     714                           "    f.dll = d.refcode\n".
     715                           "ORDER BY d.name, f.name\n",
     716                           $iRefcode);
     717            if (($result2 = mysql_query($sql, $db)))
     718            {
     719                if (mysql_num_rows($result2) > 0)
     720                {
     721                    $sValue = "";
     722                    $f = 0;
     723                    while ($aAlias = mysql_fetch_array($result2))
     724                    {
     725                        if ($f) $sValue = $sValue."<br>";
     726                        else    $f = 1;
     727                        $sValue = $sValue."<a href=\"Odin32DB.phtml?dllrefcode=".
     728                                          $aAlias["dllrefcode"]."\">".$aAlias["dllname"]."</a>.".
     729                                          "<a href=\"Odin32DB.phtml?functionrefcode=".
     730                                          $aAlias["fnrefcode"]."\">".$aAlias["fnname"]."</a>";
     731                    }
     732                    Odin32DBInfoRow1NoArray("Forwarded as", $sValue, "","","","");
     733                }
     734            }
     735            else
     736                Odin32DBSqlError($sql);
     737        }
    497738        echo "\n</table>\n";
    498739
    499 
     740        /*
     741         * Completion
     742         */
     743        Odin32DBNaslov($aContent, "Completion", "completion");
     744        Odin32DBCompletionBarFunction($iRefcode, "", $db);
     745
     746
     747        /*
     748         * Declaration
     749         */
    500750        Odin32DBNaslov($aContent, "Declaration", "declaration");
    501         echo "<pre>\n";
     751        echo "\n<pre>";
    502752        if (isset($array["return"]))
    503753            echo $array["return"]." ";
     
    513763                       "ORDER BY sequencenbr",
    514764                        $iRefcode);
    515         $result2 = mysql_query($sql, $db);
    516         if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
     765        if (($result2 = mysql_query($sql, $db)) && ($cParams = mysql_num_rows($result2)) > 0)
    517766        {
    518767            while ($param = mysql_fetch_array($result2))
     
    540789         */
    541790        Odin32DBNaslov($aContent, "Parameters", "params");
    542         if ($result2 &&
    543             mysql_num_rows($result2) > 0 &&
    544             mysql_data_seek($result2, 0)
    545             )
     791        if ($result2 && mysql_num_rows($result2) > 0 && mysql_data_seek($result2, 0))
    546792        {
    547793            while ($param = mysql_fetch_array($result2))
     
    584830         * Remark
    585831         */
    586         Odin32DBDocRow($aContent, "Remark", "remark", $array, "remark");
     832        Odin32DBDocRow($aContent, "Remarks", "remark", $array, "remark");
    587833
    588834        /*
     
    603849                       "ORDER BY a.name",
    604850                        $iRefcode);
    605         $result2 = mysql_query($sql, $db);
    606         if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
     851        if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0)
    607852        {
    608853            while ($author = mysql_fetch_array($result2))
     
    610855        }
    611856        else
    612             echo "Hmm. Seems noone wrote this function...<br>\n";
     857            echo "<i>Hmm. Seems noone wrote this function...</i><br>\n";
    613858    }
    614859    else
     
    638883 * @remark
    639884 */
    640 function Odin32DBDllInfoAll(&$aContent, $db, $iRefcode, $fFunctions, $fFiles, $fAPIGroups, $fAuthors, $fSortByState)
     885function Odin32DBDllInfo(&$aContent, $db, $iRefcode, $fFunctions, $fFiles, $fAPIGroups, $fAuthors, $fSortByState)
    641886{
    642887
     
    654899                   "    d.refcode = %d",
    655900                    $iRefcode);
    656     $result = mysql_query($sql, $db);
    657     if (@mysql_num_rows($result) > 0 &&
    658         ($array = mysql_fetch_array($result))
    659         )
    660     {
     901    if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) > 0 && ($array = mysql_fetch_array($result)))
     902    {
     903        echo "<a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fFiles=1&fFunctions=1&fAPIGroups=1&fAuthors=1";
     904        if ($fSortByState)  echo "&fSortByState=".$fSortByState;
     905        echo "\">Expand all.</a>\n";
     906        echo "<a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."\">Collapse all.</a>\n";
     907
     908        /*
     909         * General
     910         */
    661911        Odin32DBNaslov($aContent, "General", "general");
    662912        echo "\n<table width=100% border=3 cellpadding=0>\n";
     
    671921                       "    dll = %d",
    672922                       $iRefcode);
    673         $result = mysql_query($sql, $db);
    674         if (@mysql_num_rows($result) > 0 &&
    675             ($array = mysql_fetch_array($result))
    676             )
    677             {
    678             Odin32DBInfoRow1("# Functions", $array, "functions","","","","");
    679             $cFunctions = $array["functions"];
    680             }
    681         else
    682             $cFunctions = 0;
     923        $cFunctions = 0;
     924        if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0 && ($array2 = mysql_fetch_array($result2)))
     925            {
     926            Odin32DBInfoRow1("# Functions", $array2, "functions","","","","");
     927            $cFunctions = $array2["functions"];
     928            }
    683929
    684930        $sql = sprintf("SELECT\n".
     
    689935                       "    dll = %d",
    690936                       $iRefcode);
    691         $result = mysql_query($sql, $db);
    692         if (@mysql_num_rows($result) > 0 &&
    693             ($array = mysql_fetch_array($result))
    694             )
    695         {
    696             Odin32DBInfoRow1("# Source files", $array, "files","","","","");
    697             $cFiles = $array["files"];
    698         }
    699         else
    700             $cFiles = 0;
     937        $cFiles = 0;
     938        if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0 && ($array2 = mysql_fetch_array($result2)))
     939        {
     940            Odin32DBInfoRow1("# Source files", $array2, "files","","","","");
     941            $cFiles = $array2["files"];
     942        }
    701943
    702944        $sql = sprintf("SELECT\n".
    703945                       "    COUNT(*) as apigroups\n".
    704946                       "FROM\n".
    705                        "    function c\n".
     947                       "    apigroup\n".
    706948                       "WHERE\n".
    707                        "    f.dll = %d",
    708                         $iRefcode);
    709         $result = mysql_query($sql, $db);
    710         if (@mysql_num_rows($result) > 0 &&
    711             ($array = mysql_fetch_array($result))
    712             )
    713         {
    714             Odin32DBInfoRow1("# API Groups", $array, "apigroups","","","","");
    715             $cAPIGroups = $array["apigroups"];
    716         }
    717         else
    718             $cAPIGroups = 0;
     949                       "    dll = %d",
     950                       $iRefcode);
     951        $cAPIGroups = 0;
     952        if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0 && ($array2 = mysql_fetch_array($result2)))
     953        {
     954            Odin32DBInfoRow1("# API Groups", $array2, "apigroups","","","","");
     955            $cAPIGroups = $array2["apigroups"];
     956        }
    719957
    720958        echo "\n</table>\n";
     
    725963         */
    726964        Odin32DBNaslov($aContent, "Completion", "completion");
    727         Odin32DBCompletionBar($iRefcode, "", $db);
     965        Odin32DBCompletionBarDll($iRefcode, "", $db);
    728966
    729967        /*
     
    741979                       "ORDER BY s.refcode",
    742980                        $iRefcode);
    743         $result2 = mysql_query($sql, $db);
    744         if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
     981        if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0)
    745982        {
    746983            echo "\n<table width=100% border=0 cellpadding=0>\n";
     
    7661003        if ($fFunctions)
    7671004        {
    768             echo "Click <a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fFunctions=1";
    769             if ($fFiles)        echo "&fFiles=".$fFiles;
    770             if ($fAPIGroups)    echo "&fAPIGroups=".$fAPIGroups;
    771             if ($fAuthors)      echo "&fAuthors=".$fAuthors;
    772             if ($fSortByState)
    773                 echo "&fSortByState=".!$fSortByState."\">here</a> to view files sorted alphabetical.<br>\n";
    774             else
    775                 echo "&fSortByState=".!$fSortByState."\">here</a> to view files sorted by state.<br>\n";
    776 
    7771005            $sql = sprintf("SELECT\n".
    7781006                           "    f.name              AS name,\n".
     
    7901018            else
    7911019                $sql = $sql."ORDER BY f.name";
    792             $result2 = mysql_query($sql, $db);
    793             if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
    794             {
    795                 echo "\n<table width=100% border=0 cellpadding=0>\n".
    796                      "<tr>\n".
    797                      "  <td width=75%><font size=-1><b>Function Name</b></font></td>\n".
    798                      "  <td><font size=-1><b>State</b></font></td>\n".
    799                      "</tr>\n";
    800                 while ($aFunction = mysql_fetch_array($result2))
     1020            if ($result2 = mysql_query($sql, $db))
     1021            {
     1022                if (mysql_num_rows($result2) > 0)
    8011023                {
    802                     echo "<tr>\n".
    803                          "  <td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
    804                          "  <td><font size=-1 color=\"#".$aFunction["color"]."\">".$aFunction["state"]."</font></td>\n".
     1024                    echo "\n<table width=100% border=0 cellpadding=0>\n".
     1025                         "<tr>\n".
     1026                         "  <td width=75%><font size=-1><b>Function Name</b></font></td>\n".
     1027                         "  <td><font size=-1><b>State</b></font></td>\n".
    8051028                         "</tr>\n";
     1029                    while ($aFunction = mysql_fetch_array($result2))
     1030                    {
     1031                        echo "<tr>\n".
     1032                             "  <td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
     1033                             "  <td><font size=-1 color=\"#".$aFunction["color"]."\">".$aFunction["state"]."</font></td>\n".
     1034                             "</tr>\n";
     1035                    }
     1036                    echo "\n</table>\n".
     1037                         "<p>Click <a href=\"Odin32DB.phtml#functions?dllrefcode=".$iRefcode."&fFunctions=1";
     1038                    if ($fFiles)        echo "&fFiles=".$fFiles;
     1039                    if ($fAPIGroups)    echo "&fAPIGroups=".$fAPIGroups;
     1040                    if ($fAuthors)      echo "&fAuthors=".$fAuthors;
     1041                    if ($fSortByState)  echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted alphabetical.<br>\n";
     1042                    else                echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted by state.<br>\n";
    8061043                }
    807                 echo "\n</table>\n";
     1044                else
     1045                    echo "<i>No Functions.</i><br>\n";
    8081046            }
    8091047            else
     
    8121050        else
    8131051        {
    814             echo "Click <a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fFunctions=1";
     1052            echo "Click <a href=\"Odin32DB.phtml#functions?dllrefcode=".$iRefcode."&fFunctions=1";
    8151053            if ($fFiles)        echo "&fFiles=".$fFiles;
    8161054            if ($fAPIGroups)    echo "&fAPIGroups=".$fAPIGroups;
     
    8301068                           "    f.name              AS name,\n".
    8311069                           "    f.refcode           AS refcode,\n".
    832                            "    COUNT(f.refcode)    AS functions\n".
     1070                           "    COUNT(fn.refcode)   AS functions\n".
    8331071                           "FROM\n".
    8341072                           "    file f\n".
     
    8391077                           "ORDER BY f.name\n",
    8401078                            $iRefcode);
    841             $result2 = mysql_query($sql, $db);
    842             if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
    843             {
    844                 echo "\n<table width=100% border=0 cellpadding=0>\n".
    845                      "<tr>\n".
    846                      "  <td><font size=-1><b>Filename</b></font></td>\n".
    847                      "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
    848                      "</tr>\n";
    849                 while ($aFunction = mysql_fetch_array($result2))
     1079
     1080            if ($result2 = mysql_query($sql, $db))
     1081            {
     1082                if (mysql_num_rows($result2) > 0)
    8501083                {
    851                     echo "<tr>\n".
    852                          "  <td width=75%><font size=-1><a href=\"Odin32DB.phtml?filerefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
    853                          "  <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
     1084                    echo "\n<table width=100% border=0 cellpadding=0>\n".
     1085                         "<tr>\n".
     1086                         "  <td><font size=-1><b>Filename</b></font></td>\n".
     1087                         "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
    8541088                         "</tr>\n";
     1089                    while ($aFunction = mysql_fetch_array($result2))
     1090                    {
     1091                        echo "<tr>\n".
     1092                             "  <td width=75%><font size=-1><a href=\"Odin32DB.phtml?filerefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
     1093                             "  <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
     1094                             "</tr>\n";
     1095                    }
     1096                    echo "\n</table>\n";
    8551097                }
    856                 echo "\n</table>\n";
     1098                else
     1099                    echo "<i>No Files.</i><br>\n";
    8571100            }
    8581101            else
     
    8611104        else
    8621105        {
    863             echo "Click <a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fFiles=1";
     1106            echo "Click <a href=\"Odin32DB.phtml#files?dllrefcode=".$iRefcode."&fFiles=1";
    8641107            if ($fFunctions)    echo "&fFunctions=".$fFunctions;
    8651108            if ($fAPIGroups)    echo "&fAPIGroups=".$fAPIGroups;
    8661109            if ($fAuthors)      echo "&fAuthors=".$fAuthors;
    8671110            if ($fSortByState)  echo "&fSortByState=".$fSortByState;
    868             echo "\">here</a> to see all functions.\n";
     1111            echo "\">here</a> to see all files.\n";
    8691112        }
    8701113
     
    8841127                               "FROM\n".
    8851128                               "    apigroup g\n".
    886                                "    LEFT OUTER JOIN function fn ON fn.apigroup = g.refcode\n".
     1129                               "    JOIN function f\n".
    8871130                               "WHERE\n".
    888                                "    g.dll = %d\n".
    889                                "GROUP BY g.refcode\n".
     1131                               "    g.dll = %d AND\n".
     1132                               "    f.dll = %d AND\n".
     1133                               "    f.apigroup = g.refcode\n".
     1134                               "GROUP BY f.apigroup\n".
    8901135                               "ORDER BY g.name\n",
    891                                 $iRefcode);
    892                 $result2 = mysql_query($sql, $db);
    893                 if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
     1136                               $iRefcode,
     1137                               $iRefcode);
     1138                if ($result2 = mysql_query($sql, $db))
    8941139                {
    895                     echo "\n<table width=100% border=0 cellpadding=0>\n".
    896                          "<tr>\n".
    897                          "  <td width=75%><font size=-1><b>Group Name</b></font></td>\n".
    898                          "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
    899                          "</tr>\n";
    900                     while ($aFunction = mysql_fetch_array($result2))
     1140                    if (mysql_num_rows($result2) > 0)
    9011141                    {
    902                         echo "<tr>\n".
    903                              "  <td><font size=-1><a href=\"Odin32DB.phtml?filerefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
    904                              "  <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
     1142                        echo "\n<table width=100% border=0 cellpadding=0>\n".
     1143                             "<tr>\n".
     1144                             "  <td width=75%><font size=-1><b>Group Name</b></font></td>\n".
     1145                             "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
    9051146                             "</tr>\n";
     1147                        while ($aFunction = mysql_fetch_array($result2))
     1148                        {
     1149                            echo "<tr>\n".
     1150                                 "  <td><font size=-1><a href=\"Odin32DB.phtml?apigrouprefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
     1151                                 "  <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
     1152                                 "</tr>\n";
     1153                        }
     1154                        echo "\n</table>\n";
    9061155                    }
    907                     echo "\n</table>\n";
     1156                    else
     1157                        echo "<i>No API Groups.</i><br>\n";
    9081158                }
    9091159                else
     
    9121162            else
    9131163            {
    914                 echo "Click <a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fAPIGroups=1";
     1164                echo "Click <a href=\"Odin32DB.phtml#apigroups?dllrefcode=".$iRefcode."&fAPIGroups=1";
    9151165                if ($fFunctions)    echo "&fFunctions=".$fFunctions;
    9161166                if ($fFiles)        echo "&fFiles=".$fFiles;
     
    9441194                            $iRefcode
    9451195                            );
    946             $result2 = mysql_query($sql, $db);
    947             if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
    948             {
    949                 echo "\n<table width=100% border=0 cellpadding=0>\n".
    950                      "<tr>\n".
    951                      "  <td width=75%><font size=-1><b>Author</b></font></td>\n".
    952                      "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
    953                      "</tr>\n";
    954                 while ($aFunction = mysql_fetch_array($result2))
     1196            if ($result2 = mysql_query($sql, $db))
     1197            {
     1198                if (mysql_num_rows($result2) > 0)
    9551199                {
    956                     echo "<tr>\n".
    957                          "  <td><font size=-1><a href=\"Odin32DB.phtml?authorrefcode=".$aFunction["refcode"]."&dll=".$iRefcode."\">".$aFunction["name"]."</a></font></td>\n".
    958                          "  <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
     1200                    echo "\n<table width=100% border=0 cellpadding=0>\n".
     1201                         "<tr>\n".
     1202                         "  <td width=75%><font size=-1><b>Author</b></font></td>\n".
     1203                         "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
    9591204                         "</tr>\n";
     1205                    while ($aFunction = mysql_fetch_array($result2))
     1206                    {
     1207                        echo "<tr>\n".
     1208                             "  <td><font size=-1><a href=\"Odin32DB.phtml?authorrefcode=".$aFunction["refcode"]."&dll=".$iRefcode."\">".$aFunction["name"]."</a></font></td>\n".
     1209                             "  <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
     1210                             "</tr>\n";
     1211                    }
     1212                    echo "\n</table>\n";
    9601213                }
    961                 echo "\n</table>\n";
     1214                else
     1215                    echo "<i>No Authors</i>.<br>\n";
    9621216            }
    9631217            else
     
    9661220        else
    9671221        {
    968             echo "Click <a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fAuthors=1";
     1222            echo "Click <a href=\"Odin32DB.phtml#authors?dllrefcode=".$iRefcode."&fAuthors=1";
    9691223            if ($fFunctions)    echo "&fFunctions=".$fFunctions;
    9701224            if ($fFiles)        echo "&fFiles=".$fFiles;
     
    9991253 * @remark
    10001254 */
    1001 function Odin32DBFileInfoAll(&$aContent, $db, $iRefcode, $fFunctions, $fAPIGroups, $fAuthors, $fSortByState)
     1255function Odin32DBFileInfo(&$aContent, $db, $iRefcode, $fFunctions, $fAPIGroups, $fAuthors, $fSortByState)
    10021256{
    10031257
     
    10211275                   "    f.lastauthor= a.refcode",
    10221276                    $iRefcode);
    1023     $result = mysql_query($sql, $db);
    1024     if (@mysql_num_rows($result) > 0 &&
    1025         ($array = mysql_fetch_array($result))
    1026         )
    1027     {
     1277    if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) > 0 && ($array = mysql_fetch_array($result)))
     1278    {
     1279        echo "<a href=\"Odin32DB.phtml?filerefcode=".$iRefcode."&fFiles=1&fFunctions=1&fAPIGroups=1&fAuthors=1";
     1280        if ($fSortByState)  echo "&fSortByState=".$fSortByState;
     1281        echo "\">Expand all.</a>\n";
     1282        echo "<a href=\"Odin32DB.phtml?filerefcode=".$iRefcode."\">Collapse all.</a>\n";
     1283
     1284        /*
     1285         * General
     1286         */
    10281287        Odin32DBNaslov($aContent, "General", "general");
    10291288        echo "\n<table width=100% border=3 cellpadding=0>\n";
     
    10331292        Odin32DBInfoRow1("Last Author", $array, "lastauthorname","lastauthorrefcode","authorrefcode","","");
    10341293        Odin32DBInfoRow1("Dll", $array, "dllname","dllrefcode","dllrefcode","","");
    1035         Odin32DBInfoRow1("Description", $array, "description","","","","");
    10361294        $sql = sprintf("SELECT\n".
    10371295                       "    COUNT(*) as functions\n".
     
    10411299                       "    file = %d",
    10421300                       $iRefcode);
    1043         $result = mysql_query($sql, $db);
    1044         if (@mysql_num_rows($result) > 0 &&
    1045             ($array = mysql_fetch_array($result))
    1046             )
    1047             {
    1048             Odin32DBInfoRow1("# Functions", $array, "functions","","","","");
    1049             $cFunctions = $array["functions"];
    1050             }
    1051         else
    1052             $cFunctions = 0;
     1301        $cFunctions = 0;
     1302        if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0 && ($aFunctions = mysql_fetch_array($result2)))
     1303            {
     1304            Odin32DBInfoRow1("# Functions", $aFunctions, "functions","","","","");
     1305            $cFunctions = $aFunctions["functions"];
     1306            }
    10531307
    10541308        $sql = sprintf("SELECT\n".
    1055                        "    COUNT(*) as apigroups\n".
     1309                       "    COUNT(*) as functions\n".
    10561310                       "FROM\n".
    1057                        "    function c\n".
     1311                       "    function\n".
    10581312                       "WHERE\n".
    1059                        "    f.file = %d\n",
     1313                       "    file = %d AND\n".
     1314                       "    apigroup IS NOT NULL\n".
     1315                       "GROUP BY apigroup\n",
    10601316                        $iRefcode);
    1061         $result = mysql_query($sql, $db);
    1062         if (@mysql_num_rows($result) > 0 &&
    1063             ($array = mysql_fetch_array($result))
    1064             )
    1065         {
    1066             Odin32DBInfoRow1("# API Groups", $array, "apigroups","","","","");
    1067             $cAPIGroups = $array["apigroups"];
    1068         }
    1069         else
    1070             $cAPIGroups = 0;
     1317        $cAPIGroups = 0;
     1318        if (($result2 = mysql_query($sql, $db)) && ($cAPIGroups = mysql_num_rows($result2)) > 0)
     1319            Odin32DBInfoRow1NoArray("# API Groups", $cAPIGroups, "","","","");
     1320        if (!$result2)
     1321            Odin32DBSqlError($sql);
    10711322
    10721323        echo "\n</table>\n";
    10731324
     1325        /*
     1326         * Description
     1327         */
     1328        Odin32DBDocRow($aContent, "Description", "description", $array, "description");
     1329
     1330        /*
     1331         * Completion
     1332         */
     1333        Odin32DBNaslov($aContent, "Completion", "completion");
     1334        Odin32DBCompletionBarFile($iRefcode, "", $db);
    10741335
    10751336        /*
     
    10871348                       "ORDER BY s.refcode",
    10881349                        $iRefcode);
    1089         $result2 = mysql_query($sql, $db);
    1090         if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
     1350        if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0)
    10911351        {
    10921352            echo "\n<table width=100% border=0 cellpadding=0>\n";
     
    11121372        if ($fFunctions)
    11131373        {
    1114             echo "Click <a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fFunctions=1";
    1115             if ($fFiles)        echo "&fFiles=".$fFiles;
    1116             if ($fAPIGroups)    echo "&fAPIGroups=".$fAPIGroups;
    1117             if ($fAuthors)      echo "&fAuthors=".$fAuthors;
    1118             if ($fSortByState)
    1119                 echo "&fSortByState=".!$fSortByState."\">here</a> to view files sorted alphabetical.<br>\n";
    1120             else
    1121                 echo "&fSortByState=".!$fSortByState."\">here</a> to view files sorted by state.<br>\n";
    1122 
    11231374            $sql = sprintf("SELECT\n".
    11241375                           "    f.name              AS name,\n".
     
    11311382                           "WHERE\n".
    11321383                           "    f.file = %d\n",
    1133                             $iRefcode);
     1384                           $iRefcode);
    11341385            if ($fSortByState)
    11351386                $sql = $sql."ORDER BY s.refcode, f.name";
    11361387            else
    11371388                $sql = $sql."ORDER BY f.name";
    1138             $result2 = mysql_query($sql, $db);
    1139             if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
    1140             {
    1141                 echo "\n<table width=100% border=0 cellpadding=0>\n".
    1142                      "<tr>\n".
    1143                      "  <td width=75%><font size=-1><b>Function Name</b></font></td>\n".
    1144                      "  <td><font size=-1><b>State</b></font></td>\n".
    1145                      "</tr>\n";
    1146                 while ($aFunction = mysql_fetch_array($result2))
     1389            if ($result2 = mysql_query($sql, $db))
     1390            {
     1391                if (mysql_num_rows($result2) > 0)
    11471392                {
    1148                     echo "<tr>\n".
    1149                          "  <td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
    1150                          "  <td><font size=-1 color=\"#".$aFunction["color"]."\">".$aFunction["state"]."</font></td>\n".
     1393                    echo "\n<table width=100% border=0 cellpadding=0>\n".
     1394                         "<tr>\n".
     1395                         "  <td width=75%><font size=-1><b>Function Name</b></font></td>\n".
     1396                         "  <td><font size=-1><b>State</b></font></td>\n".
    11511397                         "</tr>\n";
     1398                    while ($aFunction = mysql_fetch_array($result2))
     1399                    {
     1400                        echo "<tr>\n".
     1401                             "  <td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
     1402                             "  <td><font size=-1 color=\"#".$aFunction["color"]."\">".$aFunction["state"]."</font></td>\n".
     1403                             "</tr>\n";
     1404                    }
     1405                    echo "\n</table>\n".
     1406                         "<p>Click <a href=\"Odin32DB.phtml#functions?filerefcode=".$iRefcode."&fFunctions=1";
     1407                    if ($fAPIGroups)    echo "&fAPIGroups=".$fAPIGroups;
     1408                    if ($fAuthors)      echo "&fAuthors=".$fAuthors;
     1409                    if ($fSortByState)  echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted alphabetical.<br>\n";
     1410                    else                echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted by state.<br>\n";
    11521411                }
    1153                 echo "\n</table>\n";
     1412                else
     1413                    echo "<i>No functions found</i><br>\n";
    11541414            }
    11551415            else
     
    11581418        else
    11591419        {
    1160             echo "Click <a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fFunctions=1";
    1161             if ($fFiles)        echo "&fFiles=".$fFiles;
     1420            echo "Click <a href=\"Odin32DB.phtml#functions?filerefcode=".$iRefcode."&fFunctions=1";
    11621421            if ($fAPIGroups)    echo "&fAPIGroups=".$fAPIGroups;
    11631422            if ($fAuthors)      echo "&fAuthors=".$fAuthors;
     
    11811440                               "FROM\n".
    11821441                               "    apigroup g\n".
    1183                                "    LEFT OUTER JOIN function fn ON fn.apigroup = g.refcode AND fn.file = %d\n".
    1184                                "GROUP BY g.refcode\n".
     1442                               "    JOIN function f\n".
     1443                               "WHERE\n".
     1444                               "    f.file = %d AND\n".
     1445                               "    f.apigroup = g.refcode\n".
     1446                               "GROUP BY f.apigroup\n".
    11851447                               "ORDER BY g.name\n",
    1186                                 $iRefcode);
    1187                 $result2 = mysql_query($sql, $db);
    1188                 if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
     1448                               $iRefcode);
     1449                if ($result2 = mysql_query($sql, $db))
    11891450                {
    1190                     echo "\n<table width=100% border=0 cellpadding=0>\n".
    1191                          "<tr>\n".
    1192                          "  <td width=75%><font size=-1><b>Group Name</b></font></td>\n".
    1193                          "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
    1194                          "</tr>\n";
    1195                     while ($aFunction = mysql_fetch_array($result2))
     1451                    if (mysql_num_rows($result2) > 0)
    11961452                    {
    1197                         echo "<tr>\n".
    1198                              "  <td><font size=-1><a href=\"Odin32DB.phtml?filerefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
    1199                              "  <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
     1453                        echo "\n<table width=100% border=0 cellpadding=0>\n".
     1454                             "<tr>\n".
     1455                             "  <td width=75%><font size=-1><b>Group Name</b></font></td>\n".
     1456                             "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
    12001457                             "</tr>\n";
     1458                        while ($aFunction = mysql_fetch_array($result2))
     1459                        {
     1460                            echo "<tr>\n".
     1461                                 "  <td><font size=-1><a href=\"Odin32DB.phtml?apigrouprefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
     1462                                 "  <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
     1463                                 "</tr>\n";
     1464                        }
     1465                        echo "\n</table>\n";
    12011466                    }
    1202                     echo "\n</table>\n";
     1467                    else
     1468                        echo "<i>Not API Groups found.</i><br>\n";
    12031469                }
    12041470                else
     
    12071473            else
    12081474            {
    1209                 echo "Click <a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fAPIGroups=1";
     1475                echo "Click <a href=\"Odin32DB.phtml#apigroups?filerefcode=".$iRefcode."&fAPIGroups=1";
    12101476                if ($fFunctions)    echo "&fFunctions=".$fFunctions;
    1211                 if ($fFiles)        echo "&fFiles=".$fFiles;
    12121477                if ($fAuthors)      echo "&fAuthors=".$fAuthors;
    12131478                if ($fSortByState)  echo "&fSortByState=".$fSortByState;
     
    12391504                            $iRefcode
    12401505                            );
    1241             $result2 = mysql_query($sql, $db);
    1242             if ($result2 && ($cParams = mysql_num_rows($result2)) > 0)
    1243             {
    1244                 echo "\n<table width=100% border=0 cellpadding=0>\n".
    1245                      "<tr>\n".
    1246                      "  <td width=75%><font size=-1><b>Author</b></font></td>\n".
    1247                      "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
    1248                      "</tr>\n";
    1249                 while ($aFunction = mysql_fetch_array($result2))
     1506            if ($result2 = mysql_query($sql, $db))
     1507            {
     1508                if (mysql_num_rows($result2) > 0)
    12501509                {
    1251                     echo "<tr>\n".
    1252                          "  <td><font size=-1><a href=\"Odin32DB.phtml?authorrefcode=".$aFunction["refcode"]."&dll=".$iRefcode."\">".$aFunction["name"]."</a></font></td>\n".
    1253                          "  <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
     1510                    echo "\n<table width=100% border=0 cellpadding=0>\n".
     1511                         "<tr>\n".
     1512                         "  <td width=75%><font size=-1><b>Author</b></font></td>\n".
     1513                         "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
    12541514                         "</tr>\n";
     1515                    while ($aFunction = mysql_fetch_array($result2))
     1516                    {
     1517                        echo "<tr>\n".
     1518                             "  <td><font size=-1><a href=\"Odin32DB.phtml?authorrefcode=".$aFunction["refcode"]."&file=".$iRefcode."\">".$aFunction["name"]."</a></font></td>\n".
     1519                             "  <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
     1520                             "</tr>\n";
     1521                    }
     1522                    echo "\n</table>\n";
    12551523                }
    1256                 echo "\n</table>\n";
     1524                else
     1525                    echo "<i>Not authors found.</i><br>\n";
    12571526            }
    12581527            else
     
    12611530        else
    12621531        {
    1263             echo "Click <a href=\"Odin32DB.phtml?dllrefcode=".$iRefcode."&fAuthors=1";
     1532            echo "Click <a href=\"Odin32DB.phtml#authors?filerefcode=".$iRefcode."&fAuthors=1";
     1533            if ($fFunctions)    echo "&fFunctions=".$fFunctions;
     1534            if ($fAPIGroups)    echo "&fAPIGroups=".$fAPIGroups;
     1535            if ($fSortByState)  echo "&fSortByState=".$fSortByState;
     1536            echo "\">here</a> to see all authors.\n";
     1537        }
     1538    }
     1539    else
     1540    {
     1541        echo "<p> No data! Invalid refcode? </p>";
     1542        Odin32DBSqlError($sql);
     1543    }
     1544}
     1545
     1546
     1547
     1548/**
     1549 * Writes standard file info.
     1550 *
     1551 * @returns     void
     1552 * @param       $aContent       Contents array. (input/output)
     1553 * @param       $db             Database handle.
     1554 * @param       $iRefcode       Author reference code.
     1555 * @param       $fDlls          Flags which tells wether to list all dlls or not.
     1556 * @param       $fFunctions     Flags which tells wether to list all functions or not.
     1557 * @param       $fFiles         Flags which tells wether to list all files or not.
     1558 * @param       $fAPIGroups     Flags which tells wether to list all apigroups or not.
     1559 * @param       $fSortByState   Flags which tells wether to sort functions by
     1560 *                              state and function name or just by function name.
     1561 * @param       $iDllRefcode    Dll refcode. All Dll if < 0.
     1562 *                              (not implemented yet)
     1563 * @sketch
     1564 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     1565 * @remark
     1566 */
     1567function Odin32DBAuthorInfo(&$aContent, $db, $iRefcode, $fDlls, $fFunctions, $fFiles, $fAPIGroups, $fSortByState, $iDllRefcode)
     1568{
     1569    $sql = sprintf("SELECT\n".
     1570                   "    a.name          AS name,\n".
     1571                   "    a.refcode       AS refcode,\n".
     1572                   "    a.initials      AS initials,\n".
     1573                   "    a.alias         AS alias,\n".
     1574                   "    a.email         AS email,\n".
     1575                   "    a.country       AS country,\n".
     1576                   "    a.location      AS location,\n".
     1577                   "    a.description   AS description\n".
     1578                   "FROM\n".
     1579                   "    author a\n".
     1580                   "WHERE\n".
     1581                   "    a.refcode = %d",
     1582                   $iRefcode);
     1583    if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) > 0 && ($array = mysql_fetch_array($result)))
     1584    {
     1585        echo "<a href=\"Odin32DB.phtml?authorrefcode=".$iRefcode."&fDlls=1&fFiles=1&fFunctions=1&fAPIGroups=1&fAuthors=1&dll=".$iDllRefcode;
     1586        if ($fSortByState)  echo "&fSortByState=".$fSortByState;
     1587        echo "\">Expand all.</a>\n";
     1588        echo "<a href=\"Odin32DB.phtml?authorrefcode=".$iRefcode."\">Collapse all.</a>\n";
     1589
     1590
     1591        /*
     1592         * General
     1593         */
     1594        Odin32DBNaslov($aContent, "General", "general");
     1595        echo "\n<table width=100% border=3 cellpadding=0>\n";
     1596        Odin32DBInfoRow1("Name", $array, "name","","","","");
     1597        Odin32DBInfoRow1("e-mail", $array, "email","","","",""); //???? should all authors have email address displayed?
     1598        Odin32DBInfoRow1("CVS User", $array, "alias","","","","");
     1599        Odin32DBInfoRow1("Country", $array, "country","","","","");
     1600        Odin32DBInfoRow1("Location", $array, "location","","","","");
     1601        if (isset($array["description"]))
     1602            Odin32DBInfoRow1("Description", $array, "description","","","","");
     1603        $sql = sprintf("SELECT\n".
     1604                       "    COUNT(*) as functions\n".
     1605                       "FROM\n".
     1606                       "    fnauthor\n".
     1607                       "WHERE\n".
     1608                       "    author = %d",
     1609                       $iRefcode);
     1610        $cFunctions = 0;
     1611        if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0 && ($aFunctions = mysql_fetch_array($result2)))
     1612            {
     1613            Odin32DBInfoRow1("# Functions", $aFunctions, "functions","","","","");
     1614            $cFunctions = $aFunctions["functions"];
     1615            }
     1616        $sql = sprintf("SELECT\n".
     1617                       "    COUNT(f.dll) as functions
     1618                       \n".
     1619                       "FROM\n".
     1620                       "    fnauthor fa,\n".
     1621                       "    function f\n".
     1622                       "WHERE\n".
     1623                       "    fa.author = %d AND".
     1624                       "    f.refcode = fa.function\n".
     1625                       "GROUP BY f.dll",
     1626                       $iRefcode);
     1627        $cDlls = 0;
     1628        if (($result2 = mysql_query($sql, $db)) && ($cDlls = mysql_num_rows($result2)) > 0)
     1629            Odin32DBInfoRow1NoArray("# Dlls", $cDlls, "","","","");
     1630        $sql = sprintf("SELECT\n".
     1631                       "    COUNT(f.dll) as functions
     1632                       \n".
     1633                       "FROM\n".
     1634                       "    fnauthor fa,\n".
     1635                       "    function f\n".
     1636                       "WHERE\n".
     1637                       "    fa.author = %d AND".
     1638                       "    f.file >= 0 AND".
     1639                       "    f.refcode = fa.function \n".
     1640                       "GROUP BY f.file",
     1641                       $iRefcode);
     1642        $cFiles = 0;
     1643        if (($result2 = mysql_query($sql, $db)) && ($cFiles = mysql_num_rows($result2)) > 0)
     1644            Odin32DBInfoRow1NoArray("# Files", $cFiles, "","","","");
     1645        $sql = sprintf("SELECT\n".
     1646                       "    COUNT(f.dll) as functions
     1647                       \n".
     1648                       "FROM\n".
     1649                       "    fnauthor fa,\n".
     1650                       "    function f\n".
     1651                       "WHERE\n".
     1652                       "    fa.author = %d AND".
     1653                       "    f.apigroup IS NOT NULL AND".
     1654                       "    f.refcode = fa.function\n".
     1655                       "GROUP BY f.apigroup",
     1656                       $iRefcode);
     1657        $cAPIGroups = 0;
     1658        if (($result2 = mysql_query($sql, $db)) && ($cAPIGroups = mysql_num_rows($result2)) > 0)
     1659            Odin32DBInfoRow1NoArray("# API Groups", $cAPIGroups, "","","","");
     1660
     1661        echo "\n</table>\n";
     1662
     1663        /*
     1664         * Completion
     1665         */
     1666        Odin32DBNaslov($aContent, "Completion", "completion");
     1667        Odin32DBCompletionBarAuthor($iRefcode, "", $db);
     1668
     1669        /*
     1670         * States
     1671         */
     1672        Odin32DBNaslov($aContent, "Status", "status");
     1673        $sql = sprintf("SELECT\n".
     1674                       "    s.name              AS state,\n".
     1675                       "    s.color             AS color,\n".
     1676                       "    COUNT(f.refcode)    AS functions\n".
     1677                       "FROM\n".
     1678                       "    state s\n".
     1679                       "    LEFT OUTER JOIN fnauthor fa ON fa.author = %d\n".
     1680                       "    LEFT OUTER JOIN function f  ON s.refcode = f.state AND fa.function = f.refcode\n".
     1681                       "GROUP BY s.refcode\n".
     1682                       "ORDER BY s.refcode",
     1683                        $iRefcode);
     1684        if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0)
     1685        {
     1686            echo "\n<table width=100% border=0 cellpadding=0>\n";
     1687            while ($aState = mysql_fetch_array($result2))
     1688            {
     1689                echo "<tr>\n".
     1690                     "    <td width=75%><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["state"]."</b></font></td>\n".
     1691                     "    <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["functions"]."</b></font></td>\n".
     1692                     "    <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".@(int)((int)$aState["functions"] * 100 / $cFunctions)."%</b></font></td>\n".
     1693                     "</tr>\n";
     1694            }
     1695
     1696            echo "\n</table>\n";
     1697        }
     1698        else
     1699            Odin32DBSqlError($sql);
     1700
     1701        /*
     1702         * Dlls
     1703         */
     1704        Odin32DBNaslov($aContent, "Dlls", "dlls");
     1705        if ($fDlls)
     1706        {
     1707            $sql = sprintf("SELECT\n".
     1708                           "    d.name              AS name,\n".
     1709                           "    d.refcode           AS refcode,\n".
     1710                           "    COUNT(f.refcode)    AS functions\n".
     1711                           "FROM\n".
     1712                           "    fnauthor fa,\n".
     1713                           "    dll d,\n".
     1714                           "    function f\n".
     1715                           "WHERE\n".
     1716                           "    fa.author = %d AND\n".
     1717                           "    fa.function = f.refcode AND\n".
     1718                           "    f.dll = d.refcode\n".
     1719                           "GROUP BY d.refcode\n".
     1720                           "ORDER BY d.name\n",
     1721                            $iRefcode);
     1722            if ($result2 = mysql_query($sql, $db))
     1723            {
     1724                if (mysql_num_rows($result2) > 0)
     1725                {
     1726                    echo "\n<table width=100% border=0 cellpadding=0>\n".
     1727                         "<tr>\n".
     1728                         "  <td><font size=-1><b>Dlls</b></font></td>\n".
     1729                         "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
     1730                         "</tr>\n";
     1731                    while ($aFunction = mysql_fetch_array($result2))
     1732                    {
     1733                        echo "<tr>\n".
     1734                             "  <td width=75%><font size=-1><a href=\"Odin32DB.phtml?dllrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
     1735                             "  <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
     1736                             "</tr>\n";
     1737                    }
     1738                    echo "\n</table>\n";
     1739                }
     1740                else
     1741                    echo "<i>No Files.</i><br>\n";
     1742            }
     1743            else
     1744                Odin32DBSqlError($sql);
     1745        }
     1746        else
     1747        {
     1748            echo "Click <a href=\"Odin32DB.phtml#dlls?authorrefcode=".$iRefcode."&fDlls=1";
    12641749            if ($fFunctions)    echo "&fFunctions=".$fFunctions;
    12651750            if ($fFiles)        echo "&fFiles=".$fFiles;
    12661751            if ($fAPIGroups)    echo "&fAPIGroups=".$fAPIGroups;
    12671752            if ($fSortByState)  echo "&fSortByState=".$fSortByState;
    1268             echo "\">here</a> to see all authors.\n";
     1753            echo "\">here</a> to see all files.\n";
     1754        }
     1755
     1756
     1757        /*
     1758         * Functions
     1759         */
     1760        Odin32DBNaslov($aContent, "Functions", "functions");
     1761        if ($fFunctions)
     1762        {
     1763            $sql = sprintf("SELECT\n".
     1764                           "    f.name              AS name,\n".
     1765                           "    f.refcode           AS refcode,\n".
     1766                           "    d.name              AS dllname,\n".
     1767                           "    d.refcode           AS dllrefcode,\n".
     1768                           "    s.name              AS state,\n".
     1769                           "    s.color             AS color\n".
     1770                           "FROM\n".
     1771                           "    fnauthor fa\n".
     1772                           "    JOIN function f\n".
     1773                           "    JOIN dll d\n".
     1774                           "    LEFT JOIN state s ON f.state = s.refcode\n".
     1775                           "WHERE\n".
     1776                           "    fa.author = %d AND\n".
     1777                           "    fa.function = f.refcode AND \n".
     1778                           "    f.dll = d.refcode\n",
     1779                           $iRefcode);
     1780            if ($fSortByState)
     1781                $sql = $sql."ORDER BY s.refcode, f.name, d.name";
     1782            else
     1783                $sql = $sql."ORDER BY d.name, f.name";
     1784            if ($result2 = mysql_query($sql, $db))
     1785            {
     1786                if (mysql_num_rows($result2) > 0)
     1787                {
     1788                    echo "\n<table width=100% border=0 cellpadding=0>\n".
     1789                         "<tr>\n".
     1790                         "  <td width=30%><font size=-1><b>Dll Name</b></font></td>\n".
     1791                         "  <td width=45%><font size=-1><b>Function Name</b></font></td>\n".
     1792                         "  <td><font size=-1><b>State</b></font></td>\n".
     1793                         "</tr>\n";
     1794                    while ($aFunction = mysql_fetch_array($result2))
     1795                    {
     1796                        echo "<tr>\n".
     1797                             "  <td><font size=-1><a href=\"Odin32DB.phtml?dllrefcode=".$aFunction["dllrefcode"]."\">".$aFunction["dllname"]."</a></font></td>\n".
     1798                             "  <td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
     1799                             "  <td><font size=-1 color=\"#".$aFunction["color"]."\">".$aFunction["state"]."</font></td>\n".
     1800                             "</tr>\n";
     1801                    }
     1802                    echo "\n</table>\n".
     1803                         "<p>Click <a href=\"Odin32DB.phtml#function?authorrefcode=".$iRefcode."&fFunctions=1";
     1804                    if ($fAPIGroups)    echo "&fAPIGroups=".$fAPIGroups;
     1805                    if ($fFiles)        echo "&fAuthors=".$fFiles;
     1806                    if ($fSortByState)  echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted alphabetical by dll.<br>\n";
     1807                    else                echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted by state.<br>\n";
     1808                }
     1809                else
     1810                    echo "<i>No functions found</i><br>\n";
     1811            }
     1812            else
     1813                Odin32DBSqlError($sql);
     1814        }
     1815        else
     1816        {
     1817            echo "Click <a href=\"Odin32DB.phtml#functions?authorrefcode=".$iRefcode."&fFunctions=1";
     1818            if ($fDlls)         echo "&fDlls=".$fDlls;
     1819            if ($fFiles)        echo "&fAuthors=".$fFiles;
     1820            if ($fAPIGroups)    echo "&fAPIGroups=".$fAPIGroups;
     1821            if ($fSortByState)  echo "&fSortByState=".$fSortByState;
     1822            echo "\">here</a> to see all functions.\n";
     1823        }
     1824
     1825
     1826        /*
     1827         * Files
     1828         */
     1829        Odin32DBNaslov($aContent, "Files", "files");
     1830        if ($fFiles)
     1831        {
     1832            //TODO: OPTMIZE THIS SQL!!!
     1833            $sql = sprintf("SELECT\n".
     1834                           "    f.name              AS name,\n".
     1835                           "    f.refcode           AS refcode,\n".
     1836                           "    COUNT(fn.refcode)   AS functions\n".
     1837                           "FROM\n".
     1838                           "    fnauthor fa,\n".
     1839                           "    file f\n".
     1840                           "    LEFT OUTER JOIN function fn\n".
     1841                           "        ON fn.file = f.refcode\n".
     1842                           "WHERE\n".
     1843                           "    fa.author = %d AND fa.function = fn.refcode\n".
     1844                           "GROUP BY f.refcode\n".
     1845                           "ORDER BY f.name\n",
     1846                            $iRefcode);
     1847            if ($result2 = mysql_query($sql, $db))
     1848            {
     1849                if (mysql_num_rows($result2) > 0)
     1850                {
     1851                    echo "\n<table width=100% border=0 cellpadding=0>\n".
     1852                         "<tr>\n".
     1853                         "  <td><font size=-1><b>Filename</b></font></td>\n".
     1854                         "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
     1855                         "</tr>\n";
     1856                    while ($aFunction = mysql_fetch_array($result2))
     1857                    {
     1858                        echo "<tr>\n".
     1859                             "  <td width=75%><font size=-1><a href=\"Odin32DB.phtml?filerefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
     1860                             "  <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
     1861                             "</tr>\n";
     1862                    }
     1863                    echo "\n</table>\n";
     1864                }
     1865                else
     1866                    echo "<i>No Files.</i><br>\n";
     1867            }
     1868            else
     1869                Odin32DBSqlError($sql);
     1870        }
     1871        else
     1872        {
     1873            echo "Click <a href=\"Odin32DB.phtml#files?authorrefcode=".$iRefcode."&fFiles=1";
     1874            if ($fDlls)         echo "&fDlls=".$fDlls;
     1875            if ($fFunctions)    echo "&fFunctions=".$fFunctions;
     1876            if ($fAPIGroups)    echo "&fAPIGroups=".$fAPIGroups;
     1877            if ($fSortByState)  echo "&fSortByState=".$fSortByState;
     1878            echo "\">here</a> to see all files.\n";
     1879        }
     1880
     1881
     1882        /*
     1883         * API Groups
     1884         */
     1885        if ($cAPIGroups > 0)
     1886        {
     1887            Odin32DBNaslov($aContent, "API Groups", "apigroups");
     1888            if ($fAPIGroups)
     1889            {
     1890                $sql = sprintf("SELECT\n".
     1891                               "    g.name              AS name,\n".
     1892                               "    g.refcode           AS refcode,\n".
     1893                               "    COUNT(f.refcode)    AS functions\n".
     1894                               "FROM\n".
     1895                               "    fnauthor fa\n".
     1896                               "    JOIN apigroup g\n".
     1897                               "    JOIN function f\n".
     1898                               "WHERE\n".
     1899                               "    fa.author = %d AND\n".
     1900                               "    fa.function = f.refcode AND\n".
     1901                               "    f.apigroup = g.refcode\n".
     1902                               "GROUP BY f.apigroup\n".
     1903                               "ORDER BY g.name\n",
     1904                               $iRefcode);
     1905                if ($result2 = mysql_query($sql, $db))
     1906                {
     1907                    if (mysql_num_rows($result2) > 0)
     1908                    {
     1909                        echo "\n<table width=100% border=0 cellpadding=0>\n".
     1910                             "<tr>\n".
     1911                             "  <td width=75%><font size=-1><b>Group Name</b></font></td>\n".
     1912                             "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
     1913                             "</tr>\n";
     1914                        while ($aFunction = mysql_fetch_array($result2))
     1915                        {
     1916                            echo "<tr>\n".
     1917                                 "  <td><font size=-1><a href=\"Odin32DB.phtml?apigrouprefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
     1918                                 "  <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
     1919                                 "</tr>\n";
     1920                        }
     1921                        echo "\n</table>\n";
     1922                    }
     1923                    else
     1924                        echo "<i>Not API Groups found.</i><br>\n";
     1925                }
     1926                else
     1927                    Odin32DBSqlError($sql);
     1928            }
     1929            else
     1930            {
     1931                echo "Click <a href=\"Odin32DB.phtml#apigroups?authorrefcode=".$iRefcode."&fAPIGroups=1";
     1932                if ($fDlls)         echo "&fDlls=".$fDlls;
     1933                if ($fFunctions)    echo "&fFunctions=".$fFunctions;
     1934                if ($fFiles)        echo "&fFiles=".$fFiles;
     1935                if ($fSortByState)  echo "&fSortByState=".$fSortByState;
     1936                echo "\">here</a> to see all the API Groups.\n";
     1937            }
    12691938        }
    12701939    }
     
    12771946
    12781947
     1948
     1949/**
     1950 * Writes standard file info.
     1951 *
     1952 * @returns     void
     1953 * @param       $aContent       Contents array. (input/output)
     1954 * @param       $db             Database handle.
     1955 * @param       $iRefcode       Author reference code.
     1956 * @param       $fFunctions     Flags which tells wether to list all functions or not.
     1957 * @param       $fFiles         Flags which tells wether to list all files or not.
     1958 * @param       $fAuthors       Flags which tells wether to list all authors or not.
     1959 * @param       $fSortByState   Flags which tells wether to sort functions by
     1960 *                              state and function name or just by function name.
     1961 * @sketch
     1962 * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     1963 * @remark
     1964 */
     1965function Odin32DBAPIGroupInfo(&$aContent, $db, $iRefcode, $fFunctions, $fFiles, $fAuthors, $fSortByState)
     1966{
     1967    $sql = sprintf("SELECT\n".
     1968                   "    g.name          AS name,\n".
     1969                   "    g.refcode       AS refcode,\n".
     1970                   "    g.description   AS description,\n".
     1971                   "    d.name          AS dllname,\n".
     1972                   "    d.refcode       AS dllrefcode\n".
     1973                   "FROM\n".
     1974                   "    apigroup g\n".
     1975                   "    JOIN dll d\n".
     1976                   "WHERE\n".
     1977                   "    g.refcode = %d AND".
     1978                   "    g.dll = d.refcode\n",
     1979                   $iRefcode);
     1980    if (($result = mysql_query($sql, $db)) && mysql_num_rows($result) > 0 && ($array = mysql_fetch_array($result)))
     1981    {
     1982        echo "<a href=\"Odin32DB.phtml?apigrouprefcode=".$iRefcode."&fFiles=1&fFunctions=1&fAuthors=1";
     1983        if ($fSortByState)  echo "&fSortByState=".$fSortByState;
     1984        echo "\">Expand all.</a>\n";
     1985        echo "<a href=\"Odin32DB.phtml?apigrouprefcode=".$iRefcode."\">Collapse all.</a>\n";
     1986
     1987        /*
     1988         * General
     1989         */
     1990        Odin32DBNaslov($aContent, "General", "general");
     1991        echo "\n<table width=100% border=3 cellpadding=0>\n";
     1992        Odin32DBInfoRow1("Name", $array, "name","","","","");
     1993        Odin32DBInfoRow1("Dll", $array, "dllname","dllrefcode","dllrefcode","bad configuration","");
     1994        if (isset($array["description"]))
     1995            Odin32DBInfoRow1("Description", $array, "description","","","","");
     1996        $sql = sprintf("SELECT\n".
     1997                       "    COUNT(*) as functions\n".
     1998                       "FROM\n".
     1999                       "    function\n".
     2000                       "WHERE\n".
     2001                       "    apigroup = %d",
     2002                       $iRefcode);
     2003        $cFunctions = 0;
     2004        if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0 && ($aFunctions = mysql_fetch_array($result2)))
     2005            {
     2006            Odin32DBInfoRow1("# Functions", $aFunctions, "functions","","","","");
     2007            $cFunctions = $aFunctions["functions"];
     2008            }
     2009        $sql = sprintf("SELECT\n".
     2010                       "    COUNT(*) as functions\n".
     2011                       "FROM\n".
     2012                       "    function\n".
     2013                       "WHERE\n".
     2014                       "    apigroup = %d AND".
     2015                       "    file >= 0\n".
     2016                       "GROUP BY file",
     2017                       $iRefcode);
     2018        $cFiles = 0;
     2019        if (($result2 = mysql_query($sql, $db)) && ($cFiles = mysql_num_rows($result2)) > 0)
     2020            Odin32DBInfoRow1NoArray("# Files", $cFiles, "","","","");
     2021
     2022        $sql = sprintf("SELECT\n".
     2023                       "    COUNT(f.dll) as functions\n".
     2024                       "FROM\n".
     2025                       "    fnauthor fa,\n".
     2026                       "    function f\n".
     2027                       "WHERE\n".
     2028                       "    f.apigroup = %d AND".
     2029                       "    f.refcode = fa.function\n".
     2030                       "GROUP BY fa.author",
     2031                       $iRefcode);
     2032        $cAuthors = 0;
     2033        if (($result2 = mysql_query($sql, $db)) && ($cAuthors = mysql_num_rows($result2)) > 0)
     2034            Odin32DBInfoRow1NoArray("# Authors", $cAuthors, "","","","");
     2035
     2036        echo "\n</table>\n";
     2037
     2038        /*
     2039         * Completion
     2040         */
     2041        Odin32DBNaslov($aContent, "Completion", "completion");
     2042        Odin32DBCompletionBarAPIGroup($iRefcode, "", $db);
     2043
     2044        /*
     2045         * States
     2046         */
     2047        Odin32DBNaslov($aContent, "Status", "status");
     2048        $sql = sprintf("SELECT\n".
     2049                       "    s.name              AS state,\n".
     2050                       "    s.color             AS color,\n".
     2051                       "    COUNT(f.state)      AS functions\n".
     2052                       "FROM\n".
     2053                       "    state s\n".
     2054                       "    LEFT OUTER JOIN function f ON s.refcode = f.state AND f.apigroup = %d\n".
     2055                       "GROUP BY s.refcode\n".
     2056                       "ORDER BY s.refcode",
     2057                        $iRefcode);
     2058        if (($result2 = mysql_query($sql, $db)) && mysql_num_rows($result2) > 0)
     2059        {
     2060            echo "\n<table width=100% border=0 cellpadding=0>\n";
     2061            while ($aState = mysql_fetch_array($result2))
     2062            {
     2063                echo "<tr>\n".
     2064                     "    <td width=75%><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["state"]."</b></font></td>\n".
     2065                     "    <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".$aState["functions"]."</b></font></td>\n".
     2066                     "    <td align=right><font size=-1 color=\"#".$aState["color"]."\"><b>".@(int)((int)$aState["functions"] * 100 / $cFunctions)."%</b></font></td>\n".
     2067                     "</tr>\n";
     2068            }
     2069
     2070            echo "\n</table>\n";
     2071        }
     2072        else
     2073            Odin32DBSqlError($sql);
     2074
     2075        /*
     2076         * Functions
     2077         */
     2078        Odin32DBNaslov($aContent, "Functions", "functions");
     2079        if ($fFunctions)
     2080        {
     2081            $sql = sprintf("SELECT\n".
     2082                           "    f.name              AS name,\n".
     2083                           "    f.refcode           AS refcode,\n".
     2084                           "    s.name              AS state,\n".
     2085                           "    s.color             AS color\n".
     2086                           "FROM\n".
     2087                           "    function f\n".
     2088                           "    LEFT JOIN state s ON f.state = s.refcode\n".
     2089                           "WHERE\n".
     2090                           "    f.apigroup = %d\n",
     2091                           $iRefcode);
     2092            if ($fSortByState)
     2093                $sql = $sql."ORDER BY s.refcode, f.name";
     2094            else
     2095                $sql = $sql."ORDER BY f.name";
     2096            if ($result2 = mysql_query($sql, $db))
     2097            {
     2098                if (mysql_num_rows($result2) > 0)
     2099                {
     2100                    echo "\n<table width=100% border=0 cellpadding=0>\n".
     2101                         "<tr>\n".
     2102                         "  <td width=75%><font size=-1><b>Function Name</b></font></td>\n".
     2103                         "  <td><font size=-1><b>State</b></font></td>\n".
     2104                         "</tr>\n";
     2105                    while ($aFunction = mysql_fetch_array($result2))
     2106                    {
     2107                        echo "<tr>\n".
     2108                             "  <td><font size=-1><a href=\"Odin32DB.phtml?functionrefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
     2109                             "  <td><font size=-1 color=\"#".$aFunction["color"]."\">".$aFunction["state"]."</font></td>\n".
     2110                             "</tr>\n";
     2111                    }
     2112                    echo "\n</table>\n".
     2113                         "<p>Click <a href=\"Odin32DB.phtml#function?apigrouprefcode=".$iRefcode."&fFunctions=1";
     2114                    if ($fAuthors)      echo "&fAuthors=".$fAuthors;
     2115                    if ($fFiles)        echo "&fAuthors=".$fFiles;
     2116                    if ($fSortByState)  echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted alphabetical.<br>\n";
     2117                    else                echo "&fSortByState=".!$fSortByState."\">here</a> to view functions sorted by state.<br>\n";
     2118                }
     2119                else
     2120                    echo "<i>No functions found</i><br>\n";
     2121            }
     2122            else
     2123                Odin32DBSqlError($sql);
     2124        }
     2125        else
     2126        {
     2127            echo "Click <a href=\"Odin32DB.phtml#functions?apigrouprefcode=".$iRefcode."&fFunctions=1";
     2128            if ($fFiles)        echo "&fAuthors=".$fFiles;
     2129            if ($fAuthors)      echo "&fAuthors=".$fAuthors;
     2130            if ($fSortByState)  echo "&fSortByState=".$fSortByState;
     2131            echo "\">here</a> to see all functions.\n";
     2132        }
     2133
     2134
     2135        /*
     2136         * Files
     2137         */
     2138        Odin32DBNaslov($aContent, "Files", "files");
     2139        if ($fFiles)
     2140        {
     2141            $sql = sprintf("SELECT\n".
     2142                           "    f.name              AS name,\n".
     2143                           "    f.refcode           AS refcode,\n".
     2144                           "    COUNT(fn.refcode)   AS functions\n".
     2145                           "FROM\n".
     2146                           "    file f\n".
     2147                           "    LEFT OUTER JOIN function fn ON fn.file = f.refcode\n".
     2148                           "WHERE\n".
     2149                           "    fn.apigroup = %d\n".
     2150                           "GROUP BY f.refcode\n".
     2151                           "ORDER BY f.name\n",
     2152                            $iRefcode);
     2153
     2154            if ($result2 = mysql_query($sql, $db))
     2155            {
     2156                if (mysql_num_rows($result2) > 0)
     2157                {
     2158                    echo "\n<table width=100% border=0 cellpadding=0>\n".
     2159                         "<tr>\n".
     2160                         "  <td><font size=-1><b>Filename</b></font></td>\n".
     2161                         "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
     2162                         "</tr>\n";
     2163                    while ($aFunction = mysql_fetch_array($result2))
     2164                    {
     2165                        echo "<tr>\n".
     2166                             "  <td width=75%><font size=-1><a href=\"Odin32DB.phtml?filerefcode=".$aFunction["refcode"]."\">".$aFunction["name"]."</a></font></td>\n".
     2167                             "  <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
     2168                             "</tr>\n";
     2169                    }
     2170                    echo "\n</table>\n";
     2171                }
     2172                else
     2173                    echo "<i>No Files.</i><br>\n";
     2174            }
     2175            else
     2176                Odin32DBSqlError($sql);
     2177        }
     2178        else
     2179        {
     2180            echo "Click <a href=\"Odin32DB.phtml#files?apigrouprefcode=".$iRefcode."&fFiles=1";
     2181            if ($fFunctions)    echo "&fFunctions=".$fFunctions;
     2182            if ($fAuthors)      echo "&fAuthors=".$fAuthors;
     2183            if ($fSortByState)  echo "&fSortByState=".$fSortByState;
     2184            echo "\">here</a> to see all files.\n";
     2185        }
     2186
     2187
     2188        /*
     2189         * Authors
     2190         */
     2191        Odin32DBNaslov($aContent, "Authors", "authors");
     2192        if ($fAuthors)
     2193        {
     2194            $sql = sprintf("SELECT\n".
     2195                           "    a.name              AS name,\n".
     2196                           "    a.refcode           AS refcode,\n".
     2197                           "    COUNT(f.refcode)    AS functions\n".
     2198                           "FROM\n".
     2199                           "    fnauthor fa\n".
     2200                           "    JOIN function f\n".
     2201                           "    JOIN author a\n".
     2202                           "WHERE\n".
     2203                           "    f.apigroup = %d AND\n".
     2204                           "    fa.function = f.refcode AND\n".
     2205                           "    fa.author = a.refcode\n".
     2206                           "GROUP BY a.refcode\n".
     2207                           "ORDER BY a.name\n",
     2208                            $iRefcode
     2209                            );
     2210            if ($result2 = mysql_query($sql, $db))
     2211            {
     2212                if (mysql_num_rows($result2) > 0)
     2213                {
     2214                    echo "\n<table width=100% border=0 cellpadding=0>\n".
     2215                         "<tr>\n".
     2216                         "  <td width=75%><font size=-1><b>Author</b></font></td>\n".
     2217                         "  <td align=right><font size=-1><b>Functions</b></font></td>\n".
     2218                         "</tr>\n";
     2219                    while ($aFunction = mysql_fetch_array($result2))
     2220                    {
     2221                        echo "<tr>\n".
     2222                             "  <td><font size=-1><a href=\"Odin32DB.phtml?authorrefcode=".$aFunction["refcode"]."&apigroup=".$iRefcode."\">".$aFunction["name"]."</a></font></td>\n".
     2223                             "  <td align=right><font size=-1>".$aFunction["functions"]."</font></td>\n".
     2224                             "</tr>\n";
     2225                    }
     2226                    echo "\n</table>\n";
     2227                }
     2228                else
     2229                    echo "<i>Not authors found.</i><br>\n";
     2230            }
     2231            else
     2232                Odin32DBSqlError($sql);
     2233        }
     2234        else
     2235        {
     2236            echo "Click <a href=\"Odin32DB.phtml#authors?apigrouprefcode=".$iRefcode."&fAuthors=1";
     2237            if ($fFunctions)    echo "&fFunctions=".$fFunctions;
     2238            if ($fFiles)        echo "&fFiles=".$fFiles;
     2239            if ($fSortByState)  echo "&fSortByState=".$fSortByState;
     2240            echo "\">here</a> to see all authors.\n";
     2241        }
     2242    }
     2243    else
     2244    {
     2245        echo "<p> No data! Invalid refcode? </p>";
     2246        Odin32DBSqlError($sql);
     2247    }
     2248}
    12792249
    12802250
Note: See TracChangeset for help on using the changeset viewer.