Changeset 9509 for trunk/MagicSoft


Ignore:
Timestamp:
09/11/09 16:51:28 (15 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/db/include.php

    r9505 r9509  
    288288        $checked = "";
    289289
    290     printf("    <td><input type='checkbox' name='%s' value='On' %s>%s</td>\n", $value, $checked, $text);
    291 }
    292 
    293 function Checkbox2($value, $text)
    294 {
    295     if ($_SESSION[$value]=="On")
    296         $checked = "checked";
    297     else
    298         $checked = "";
    299 
    300     printf("    <td><input type='checkbox' name='%s' value='On' %s>%s</td>\n", $value, $checked, $text);
     290    printf("<td><input type='checkbox' name='%s' value='On' %s>%s</td>\n", $value, $checked, $text);
    301291}
    302292
     
    308298        $checked = "";
    309299
    310     printf("    <td><input type='radio' name='%s' value='%s' %s>%s</td>\n", $name, $value, $checked, $text);
     300    printf("<td><input type='radio' name='%s' value='%s' %s>%s</td>\n", $name, $value, $checked, $text);
    311301}
    312302
     
    397387function GetClearedURL($all)
    398388{
    399 //    $url=htmlspecialchars($_SERVER["REQUEST_URI"]);
    400389    $url=$_SERVER["REQUEST_URI"];
    401 //    echo "before:".$url."<br>";
    402390    if ($all=="yes")
    403391    {
    404 //        echo "replace <br>";
    405 //        $url=str_replace("&DisplaySelected", "halo", $url);
    406         $url=str_replace("&DisplaySelected=yes", "", $url);
    407         $url=str_replace("&DisplaySelected=no", "", $url);
     392        $url=str_replace("&DisplaySelected=yes",     "", $url);
     393        $url=str_replace("&DisplaySelected=no",      "", $url);
     394        $url=str_replace("&DisplaySelected=inverse", "", $url);
     395        //reset fNumStart
     396        $url=preg_replace("/&fNumStart[=][0-9]*/", "", $url);
    408397    }
    409398    $url=str_replace("&insert=yes", "", $url);
    410399    $url=str_replace("&fSendTxt=2", "", $url);
    411400    $url=str_replace("&fSendTxt=1", "", $url);
    412 //    echo "after:".$url."<br>";
    413401    $url=htmlspecialchars($url);
    414402    return $url;
     
    418406{
    419407    if (empty($_SESSION["insert"]))
    420         printf("<input type='submit' value='Update Data Set'>&nbsp;&nbsp;&nbsp;\n");
     408        printf("<input type='submit' value='Update Selection'>&nbsp;&nbsp;&nbsp;\n");
    421409    else
    422410        printf("<input type='button' value='Continue' onClick='self.location.href=\"%s\"'>&nbsp;&nbsp;&nbsp;\n", GetClearedURL());
     
    427415function PrintDisplaySequencesButtons()
    428416{
     417    if (!empty($_SESSION["DataSetSelection"]) && empty($_SESSION["DataSetAcknowledged"]))
     418        return;
     419
    429420    if ((empty($_SESSION["DisplaySelected"]) || $_SESSION["DisplaySelected"]=="no")
    430421        && !(empty($_SESSION["sequon"]) && empty($_SESSION["sequoff"])))
     
    436427    }
    437428
    438     if ($_SESSION["DisplaySelected"]=="yes")
     429    if ($_SESSION["DisplaySelected"]=="yes"
     430       && !(empty($_SESSION["sequon"]) && empty($_SESSION["sequoff"])))
    439431    {
    440432        PrintUpdateDataSetButton();
     
    444436    }
    445437
    446     if ($_SESSION["DisplaySelected"]=="inverse")
     438    if ($_SESSION["DisplaySelected"]=="inverse"
     439       && !(empty($_SESSION["sequon"]) && empty($_SESSION["sequoff"])))
    447440    {
    448441        PrintUpdateDataSetButton();
     
    463456
    464457    $uri = htmlspecialchars($_SERVER["REQUEST_URI"]);
    465     $pos = strpos($uri, "fNumStart");
    466     $amp3=FALSE;
    467     if ($pos!=FALSE)
    468     {
    469         $amp1 = substr($uri, 0, $pos-1);
    470         $amp2 = substr($uri, $pos);
    471         $amp3 = strchr($amp2, "&");
    472 
    473         $uri = $amp1;
    474     }
     458    //append string in case it is not in url
     459    if (!preg_match("/&fNumStart[=][0-9]*/", $uri))
     460        $uri.="&amp;fNumStart=";
    475461
    476462    switch($direction)
     
    480466        if ($pos<0)
    481467            $pos=0;
     468        $link .= " <A HREF='" . preg_replace("/&amp;fNumStart[=][0-9]*/", "&amp;fNumStart=".$pos, $uri) . "'>< Prev</A> \n";
    482469        break;
    483470    case 1:
     471        //display link only if more results available
     472        if ($_GET["fNumStart"]+$rows==$totalnumrows)
     473            break;
    484474        $pos = $_GET["fNumStart"]+$rows;
     475        $link .= " <A HREF='" . preg_replace("/&amp;fNumStart[=][0-9]*/", "&amp;fNumStart=".$pos, $uri) . "'>Next ></A> \n";
    485476        break;
    486477    case 2:
    487478        $pos = 0;
     479        $link .= " <A HREF='" . preg_replace("/&amp;fNumStart[=][0-9]*/", "&amp;fNumStart=".$pos, $uri) . "'><< First</A> \n";
    488480        break;
    489481    case 3:
     482        //display link only if more results available
     483        if ($_GET["fNumStart"]+$rows==$totalnumrows)
     484            break;
    490485        $pos = $totalnumrows-$rows+1;
     486        $link .= " <A HREF='" . preg_replace("/&amp;fNumStart[=][0-9]*/", "&amp;fNumStart=".$pos, $uri) . "'>Last >></A> \n";
    491487        break;
    492488    }
    493489
    494     $uri .= "&fNumStart=" . $pos;
    495     if ($amp3!=FALSE)
    496         $uri .= $amp3;
    497 
    498     switch($direction)
    499     {
    500     case 0:
    501         $link .= " <A HREF='" . $uri . "'>< Prev</A> \n";
    502         break;
    503     case 1:
    504         $link .= " <A HREF='" . $uri . "'>Next ></A> \n";
    505         break;
    506     case 2:
    507         $link .= " <A HREF='" . $uri . "'><< First</A> \n";
    508         break;
    509     case 3:
    510         $link .= " <A HREF='" . $uri . "'>Last >></A> \n";
    511         break;
    512     }
    513490    return $link;
    514491}
     
    523500    if ($_GET["fNumStart"]!=0)
    524501    {
    525         $menu .= ReplaceInUri("fNumStart", $rows, 2);
    526         $menu .= ReplaceInUri("fNumStart", $rows, 0);
     502        $menu .= ReplaceInUri("fNumStart", $rows, 2, $totalnumrows);
     503        $menu .= ReplaceInUri("fNumStart", $rows, 0, $totalnumrows);
    527504    }
    528505
     
    536513    if ($rows==$_GET["fNumResults"])
    537514    {
    538         $menu .= ReplaceInUri("fNumStart", $rows, 1);
     515        $menu .= ReplaceInUri("fNumStart", $rows, 1, $totalnumrows);
    539516        $menu .= ReplaceInUri("fNumStart", $rows, 3, $totalnumrows);
    540517    }
     
    546523    $row1 = mysql_fetch_assoc($result1);
    547524    $totalnumrows=$row1["FOUND_ROWS()"];
    548 //    echo "res0: " . $row . " res1: " . $row1["FOUND_ROWS()"] . "<br>";
    549525
    550526    $col   = FALSE;
     
    581557            $first = FALSE;
    582558            if ($form)
    583                 printf("<td>ON</td><td>Off</td><td>Not</td>");
     559            {
     560                printf("<td>ON<br><input type='radio' name='SelectAllSequForDS' value='ON' onclick='selectallsequences(\"ON\");' %s></td>\n",
     561                       $_SESSION["SelectAllSequForDS"]=="ON"?"checked":"");
     562                printf("<td>Off<br><input type='radio' name='SelectAllSequForDS' value='Off' onclick='selectallsequences(\"Off\");' %s></td>\n",
     563                       $_SESSION["SelectAllSequForDS"]=="Off"?"checked":"");
     564                printf("<td>Not<br><input type='radio' name='SelectAllSequForDS' value='Not' onclick='selectallsequences(\"Not\");' %s></td>\n",
     565                       $_SESSION["SelectAllSequForDS"]=="Not"?"checked":"");
     566            }
    584567            foreach ($row0 as $key => $element)
    585568            {
     
    613596        if ($form)
    614597        {
    615 //            CheckBox2($row0["Sequ"]."ON","");
    616 //            CheckBox2($row0["Sequ"]."Off","");
    617598            RadioButton("DSSeq".$row0["Sequ"],  "ON", "");
    618599            RadioButton("DSSeq".$row0["Sequ"], "Off", "");
Note: See TracChangeset for help on using the changeset viewer.