Changeset 9510 for trunk/MagicSoft/Mars/datacenter
- Timestamp:
- 09/11/09 16:56:43 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/db/builddatasets.php
r9507 r9510 3 3 function PrintDataSetFile() 4 4 { 5 if (empty($_SESSION["AnalysisNumber"])) 5 6 printf("AnalysisNumber: 1\n\n"); 6 printf("SeqencesOn: %s \n", $_SESSION["sequon"]); 7 if ($_SESSION["sequoff"]!="") 8 printf("SeqencesOff: %s \n\n", $_SESSION["sequoff"]); 9 else 10 printf("\n"); 11 12 printf("SourceName: %s \n", $_SESSION["realsourcename"]); 13 printf("Catalog: /magic/datacenter/setup/magic_favorites_dc.edb \n"); 14 if ($_SESSION["sequoff"]==" ") 15 printf("WobbleMode: On \n\n"); 16 printf("RunTime: %s \n", $_SESSION["runtime"]); 17 printf("Name: %s \n", $_SESSION["name"]); 18 printf("Comment: %s \n", $_SESSION["comment"]); 19 } 20 21 function CreateQuery($alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs) 7 else 8 printf("AnalysisNumber: %s\n\n", $_SESSION["AnalysisNumber"]); 9 printf("SeqencesOn: %s \n", $_SESSION["sequon"]); 10 if ($_SESSION["sequoff"]!="") 11 printf("SeqencesOff: %s \n\n", $_SESSION["sequoff"]); 12 else 13 printf("\n"); 14 15 printf("SourceName: %s \n", $_SESSION["realsourcename"]); 16 printf("Catalog: /magic/datacenter/setup/magic_favorites_dc.edb \n"); 17 if ($_SESSION["sequoff"]==" ") 18 printf("WobbleMode: On \n\n"); 19 printf("RunTime: %s \n", $_SESSION["runtime"]); 20 printf("Name: %s \n", $_SESSION["name"]); 21 printf("Comment: %s \n", $_SESSION["comment"]); 22 } 23 24 function CreateQuery($alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs, $db_id) 22 25 { 23 26 $fromtable="Sequences"; … … 62 65 { 63 66 $query0 .= " " . $fromtable . ".fSequenceFirst as '" . $alias["fSequenceFirst"] . "' "; 64 if (!empty($_ SESSION["fLinks"]))67 if (!empty($_GET["fLinks"])) 65 68 { 66 $query0 .= ", CONCAT('<A&ws;HREF=\"runinfo-aio.php?', 'fRunStart=On', '&fZenithDistance=On', '&fRunMin=', Sequences.fSequenceFirst, '&fMeanTriggerRate=On', '&fTest=On', '&fRunTypeName=On', '&fRunMax=', fSequenceLast, '&fNumEvents=On', '&fSourceName=On&', 'fExcludedFDAKEY=1', '&fSequenceFirst=On', '&fRawFileAvail=On', '&fCCFileAvail=On', '&fCaCoFileAvail=On', '&fNumResults=500\">r</A>' "; 67 //$query0 .= " as " . $alias["fSequenceFirst"]; 68 $query0 .= ", ' <A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/callisto/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(Sequences.fSequenceFirst, '/'), 9,'0'), 'callisto', LPAD(CONCAT(Sequences.fSequenceFirst , '.html'), 13,'0') , '\">cl</A>'"; 69 $query0 .= ", ' <A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/callisto/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(Sequences.fSequenceFirst, '/'), 9,'0'), '\">c</A>'"; 70 $query0 .= ", ' <A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/star/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(Sequences.fSequenceFirst, '/'), 9,'0'), 'star', LPAD(CONCAT(Sequences.fSequenceFirst , '.html'), 13,'0') , '\">sl</A>'"; 71 $query0 .= ", ' <A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/star/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(Sequences.fSequenceFirst, '/'), 9,'0'), '\">s</A>'"; 69 $query0 .= ", CONCAT('<A&ws;HREF=\"tabs.php?t=calib&n=', fSequenceFirst, '\">cal</A>'"; 70 $query0 .= ", ' <A&ws;HREF=\"tabs.php?t=signal&n=', fSequenceFirst, '\">sig</A>'"; 71 $query0 .= ", ' <A&ws;HREF=\"tabs.php?t=star&n=', fSequenceFirst, '\">star</A>'"; 72 72 $query0 .= ", ' <A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/sequences/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/sequence', LPAD(CONCAT(Sequences.fSequenceFirst , '.txt'), 12,'0') , '\">', 'f </A>' "; 73 $query0 .= ", ' <A&ws;HREF=\" sequence.php?fSequenceNo=', Sequences.fSequenceFirst , '&fAll=On\">i</A>') ";73 $query0 .= ", ' <A&ws;HREF=\"queryrbk.php?fNight=', date_format(adddate(fRunStart, interval +13 HOUR), '%Y-%m-%d') , '&fDate=2\">rbk</A>') "; 74 74 $query0 .= " as 'Links'"; 75 75 } 76 76 77 foreach ($_ SESSIONas $key => $element)78 if ($_ SESSION[$key]=="On")79 if ($key!="fLinks" && $key!="fOff" && $key!="fOnlyOff" )77 foreach ($_GET as $key => $element) 78 if ($_GET[$key]=="On") 79 if ($key!="fLinks" && $key!="fOff" && $key!="fOnlyOff" && $key!="fNumStart") 80 80 if (!(ereg("^DSSeq[0-9]*$", $key))) 81 81 if (empty($checkwhere[$key]) || $checkwhere[$key]==0) … … 90 90 $query0 .= " LEFT JOIN Star USING(fSequenceFirst,fTelescopeNumber) "; 91 91 92 foreach ($_ SESSIONas $key => $element)93 if (($_ SESSION[$key]=="On" || $groups>0))// && !empty(GetJoin($fromtable,$key)))92 foreach ($_GET as $key => $element) 93 if (($_GET[$key]=="On" || $groups>0))// && !empty(GetJoin($fromtable,$key))) 94 94 $query0 .= GetJoin($fromtable,$key); 95 95 96 if ($_SESSION["DisplaySelected"]!="yes" 97 || ($_SESSION["sequon"]==" " && $_SESSION["sequoff"]==" ")) 98 { 99 if ($_SESSION["fTest"]!="On") 100 { 101 if ($_SESSION["fSourceName"]!="On") 96 if (($_SESSION["DisplaySelected"]!="yes" 97 || ($_SESSION["sequon"]=="" && $_SESSION["sequoff"]=="")) 98 && (empty($_SESSION["DataSetSelection"]) || $_SESSION["DataSetAcknowledged"]=="yes")) 99 { 100 if ($_GET["fTest"]!="On") 101 { 102 if ($_GET["fSourceName"]!="On") 102 103 $query0 .= " LEFT JOIN Source USING(fSourceKEY) "; 103 104 $query0 .= " WHERE fTest='no'"; 104 105 } 105 106 106 if ($_ SESSION["fOff"]=="Off")107 if ($_GET["fOff"]=="Off") 107 108 { 108 109 if (strpos($query0, " WHERE ")==FALSE) … … 114 115 } 115 116 116 if ($_ SESSION["fOnlyOff"]=="On")117 if ($_GET["fOnlyOff"]=="On") 117 118 { 118 119 if (strpos($query0, " WHERE ")==FALSE) … … 152 153 $query0 .= StatusQuery("fFillStar", $needs, $timelimits); 153 154 154 if (!empty($_ SESSION["fRunMin"]) && !empty($_SESSION["fRunMax"]))155 $query0 .= "Sequences.fSequenceFirst BETWEEN " . $_ SESSION["fRunMin"] . " AND " . $_SESSION["fRunMax"] . " ";155 if (!empty($_GET["fRunMin"]) && !empty($_GET["fRunMax"])) 156 $query0 .= "Sequences.fSequenceFirst BETWEEN " . $_GET["fRunMin"] . " AND " . $_GET["fRunMax"] . " "; 156 157 else 157 158 $query0 = substr($query0, 0, -4); 158 159 159 if ((!empty($_ SESSION["fZDMin"]) || $_SESSION["fZDMin"]==0) && !empty($_SESSION["fZDMax"]))160 $query0 .= "AND (fZenithDistanceMin >= " . $_ SESSION["fZDMin"] . " AND fZenithDistanceMax <= " . $_SESSION["fZDMax"] . ") ";161 162 if (!empty($_ SESSION["fSourceN"]))163 $query0 .= " AND fSourceName REGEXP \"^" . $_ SESSION["fSourceN"] . "\" ";164 165 if (!empty($_ SESSION["fStartDate"]))160 if ((!empty($_GET["fZDMin"]) || $_GET["fZDMin"]==0) && !empty($_GET["fZDMax"])) 161 $query0 .= "AND (fZenithDistanceMin >= " . $_GET["fZDMin"] . " AND fZenithDistanceMax <= " . $_GET["fZDMax"] . ") "; 162 163 if (!empty($_GET["fSourceN"])) 164 $query0 .= " AND fSourceName REGEXP \"^" . $_GET["fSourceN"] . "\" "; 165 166 if (!empty($_GET["fStartDate"])) 166 167 { 167 168 if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA ")) 168 169 $query0 .= " AND "; 169 170 170 $startdate=substr($_ SESSION["fStartDate"], 0, 10);171 $startdate=substr($_GET["fStartDate"], 0, 10); 171 172 if ($startdate=="0000-00-00") 172 173 $query0 .=" fRunStart >= '" . $startdate . " 00:00:00' "; … … 175 176 } 176 177 177 if (!empty($_ SESSION["fStopDate"]))178 if (!empty($_GET["fStopDate"])) 178 179 { 179 180 if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA ")) 180 181 $query0 .= " AND "; 181 182 182 $stopdate=substr($_ SESSION["fStopDate"], 0, 10);183 $stopdate=substr($_GET["fStopDate"], 0, 10); 183 184 $query0 .= " fRunStart < '" . $stopdate . " 13:00:00' "; 184 185 } 185 186 186 if (!empty($_ SESSION["fStarStart"]))187 if (!empty($_GET["fStarStart"])) 187 188 { 188 189 if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA ")) 189 190 $query0 .= " AND "; 190 191 191 $starstart=substr($_ SESSION["fStarStart"], 0, 10);192 $starstart=substr($_GET["fStarStart"], 0, 10); 192 193 $query0 .=" fStar >= '" . $starstart . " 00:00:00' "; 193 194 } 194 195 195 if (!empty($_ SESSION["fStarStop"]))196 if (!empty($_GET["fStarStop"])) 196 197 { 197 198 if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA ")) 198 199 $query0 .= " AND "; 199 200 200 $starstop=substr($_ SESSION["fStarStop"], 0, 10);201 $starstop=substr($_GET["fStarStop"], 0, 10); 201 202 $query0 .= " fStar < '" . $starstop . " 23:59:59' "; 202 203 } … … 244 245 else 245 246 { 246 $displsequ=str_replace(" ", " ", $_SESSION["sequon"].$_SESSION["sequoff"]); 247 $displsequ=ereg_replace("^ ", "(", $displsequ); 248 $displsequ=ereg_replace("$", ")", $displsequ); 249 $displsequ=str_replace(" ", ",", $displsequ); 247 if (empty($_SESSION["DataSetSelection"]) || $_SESSION["DataSetAcknowledged"]=="yes") 248 { 249 $displsequ=str_replace(" ", " ", $_SESSION["sequon"].$_SESSION["sequoff"]); 250 $displsequ=ereg_replace("^ ", "(", $displsequ); 251 $displsequ=ereg_replace("$", ")", $displsequ); 252 $displsequ=str_replace(" ", ",", $displsequ); 253 } 254 else 255 { 256 //get on sequences 257 $query1 = "SELECT fSequenceFirst FROM DataSetSequenceMapping WHERE fOnOff=1 AND fDataSetNumber=".$_SESSION["SelectedDataSet"]; 258 $result1 = mysql_query($query1, $db_id); 259 while ($row = mysql_fetch_assoc($result1)) 260 { 261 $_SESSION["DSSeq".$row["fSequenceFirst"]]="ON"; 262 $onseq.=" " . $row["fSequenceFirst"]; 263 } 264 mysql_free_result($result1); 265 //get off sequences 266 $query1 = "SELECT fSequenceFirst FROM DataSetSequenceMapping WHERE fOnOff=2 AND fDataSetNumber=".$_SESSION["SelectedDataSet"]; 267 $result1 = mysql_query($query1, $db_id); 268 while ($row = mysql_fetch_assoc($result1)) 269 { 270 $_SESSION["DSSeq".$row["fSequenceFirst"]]="Off"; 271 $offseq.=" " . $row["fSequenceFirst"]; 272 } 273 mysql_free_result($result1); 274 275 $displsequ=str_replace(" ", " ", $onseq.$offseq); 276 $displsequ=ereg_replace("^ ", "(", $displsequ); 277 $displsequ=ereg_replace("$", ")", $displsequ); 278 $displsequ=str_replace(" ", ",", $displsequ); 279 280 if ($_SESSION["DataSetSelection"]=="UpdateDataSet") 281 { 282 //get values of old data set from db 283 $queryold = "SELECT fUserKEY, fComment, fDataSetName FROM DataSets WHERE fDataSetNumber=".$_SESSION["SelectedDataSet"]; 284 $resultold = mysql_query($queryold); 285 $rowold = mysql_fetch_assoc($resultold); 286 $_SESSION["olduser"] = $rowold["fUserKEY"]; 287 $_SESSION["comment"] = $rowold["fComment"]; 288 $_SESSION["name"] = $rowold["fDataSetName"]; 289 mysql_free_result($resultold); 290 } 291 $_SESSION["DisplaySelected"]="yes"; 292 } 250 293 251 294 $query0 .= "WHERE fSequenceFirst IN " . $displsequ; 252 295 } 253 296 254 if (!empty($_ SESSION["fSortBy"]))255 { 256 $val=substr($_ SESSION["fSortBy"], 0, -1);297 if (!empty($_GET["fSortBy"])) 298 { 299 $val=substr($_GET["fSortBy"], 0, -1); 257 300 $query0 .= " ORDER BY " . GetTable($fromtable,$val) . " "; 258 if (substr($_ SESSION["fSortBy"], -1)=="-")301 if (substr($_GET["fSortBy"], -1)=="-") 259 302 $query0 .= "DESC"; 260 303 } 261 304 262 if (empty($_ SESSION["fSortBy"]) && $groups==0 && $statusgroups==0)305 if (empty($_GET["fSortBy"]) && $groups==0 && $statusgroups==0) 263 306 $query0 .= " ORDER BY Sequences.fSequenceFirst DESC "; 264 307 265 if (empty($_ SESSION["fNumStart"]))308 if (empty($_GET["fNumStart"])) 266 309 $start=0; 267 310 else 268 $start=$_ SESSION["fNumStart"];269 270 if (empty($_ SESSION["fSendTxt"]))271 $query0 .= " LIMIT " . $start . ", " . $_ SESSION["fNumResults"];311 $start=$_GET["fNumStart"]; 312 313 if (empty($_GET["fSendTxt"])) 314 $query0 .= " LIMIT " . $start . ", " . $_GET["fNumResults"]; 272 315 273 316 return $query0; … … 279 322 printf("<form action='builddatasets.php' METHOD='GET'>\n"); 280 323 printf("<input id='sh' type='hidden' name='fShowHide' value='"); 281 if (!empty($_ SESSION["fShowHide"]))282 printf("%s", $_ SESSION["fShowHide"]);324 if (!empty($_GET["fShowHide"])) 325 printf("%s", $_GET["fShowHide"]); 283 326 else 284 327 printf("1000000010");//display Ranges … … 322 365 PrintButtons("builddatasets.php"); 323 366 324 printf("</form>\n");367 // printf("</form>\n"); 325 368 printf("</center>\n"); 326 369 printf("</td>\n"); … … 330 373 } 331 374 332 function InsertDataSet($values, $dataset) 333 { 334 $insquery[0]="INSERT DataSets SET fDataSetNumber=" . $dataset . ", fUserKEY=" . $_SESSION["user"]; 335 $insquery[0].=", fComment='" . $_SESSION["comment"] . "', fObservationModeKEY=" . $_SESSION["obsmode"]; 375 function InsertUpdateDataSet($values, $dataset) 376 { 377 if ($_SESSION["DataSetSelection"]=="UpdateDataSet") 378 $insquery[0]="UPDATE DataSets SET "; 379 else 380 $insquery[0]="INSERT DataSets SET fDataSetNumber=" . $dataset . ", fUserKEY=" . $_SESSION["user"] . ", "; 381 $insquery[0].=" fComment='" . $_SESSION["comment"] . "', fObservationModeKEY=" . $_SESSION["obsmode"]; 336 382 $insquery[0].=", fDataSetName='" . $_SESSION["name"] . "', fSourceKEY= " . $_SESSION["realsourcekey"]; 337 383 $insquery[0].=", fRunStart='" . $values["Min(fRunStart)"]["on"]; … … 340 386 $insquery[0].=", fZenithDistanceMax=" . $values["Max(fZenithDistanceMax)"]["on"]; 341 387 $insquery[0].=", fRunTime=" . $_SESSION["runtime"]; 342 $insquery[1]="INSERT DataSetProcessStatus SET fDataSetNumber=" . $dataset . ", fDataSetInserted=Now()"; 343 $i=2; 388 if ($_SESSION["DataSetSelection"]=="UpdateDataSet") 389 { 390 $insquery[0].=" WHERE fDataSetNumber=" . $_SESSION["SelectedDataSet"]; 391 392 $insquery[1]="UPDATE DataSetProcessStatus SET fDataSetInserted=Now(), fDataSetFileWritten=NULL, "; 393 $insquery[1].=" fStarFilesAvail=NULL, fGanymed=NULL, fFillGanymed=NULL, fWebGanymed=NULL, "; 394 $insquery[1].=" fWebPlotDBGanymed=NULL, fStartTime=NULL, fFailedTime=NULL, fProgramId=NULL, "; 395 $insquery[1].=" fReturnCode=NULL WHERE fDataSetNumber=" . $_SESSION["SelectedDataSet"]; 396 397 $insquery[2]=" DELETE FROM DataSetSequenceMapping WHERE fDataSetNumber=" . $_SESSION["SelectedDataSet"]; 398 $i=3; 399 } 400 else 401 { 402 $insquery[1]="INSERT DataSetProcessStatus SET fDataSetNumber=" . $dataset . ", fDataSetInserted=Now()"; 403 $i=2; 404 } 344 405 foreach(explode(" ", trim($_SESSION["sequon"])) as $key => $sequ) 345 406 { 346 $insquery[$i]="INSERT DataSetSequenceMapping SET fDataSetNumber=" . $dataset; 407 $insquery[$i]="INSERT DataSetSequenceMapping SET fDataSetNumber="; 408 if ($_SESSION["DataSetSelection"]=="UpdateDataSet") 409 $insquery[$i].=$_SESSION["SelectedDataSet"]; 410 else 411 $insquery[$i].=$dataset; 347 412 $insquery[$i].=", fSequenceFirst=" . $sequ . ", fOnOff=1"; 348 413 $i=$i+1; … … 352 417 foreach(explode(" ", trim($_SESSION["sequoff"])) as $key => $sequ) 353 418 { 354 $insquery[$i]="INSERT DataSetSequenceMapping SET fDataSetNumber=" . $dataset; 419 $insquery[$i]="INSERT DataSetSequenceMapping SET fDataSetNumber="; 420 if ($_SESSION["DataSetSelection"]=="UpdateDataSet") 421 $insquery[$i].=$_SESSION["SelectedDataSet"]; 422 else 423 $insquery[$i].=$dataset; 355 424 $insquery[$i].=", fSequenceFirst=" . $sequ . ", fOnOff=2"; 356 425 $i=$i+1; … … 363 432 foreach($insquery as $num => $q) 364 433 { 365 printf(" Inserted Query #%s: %s<br>\n", $num, $q);434 printf("Executed Query #%s: %s<br>\n", $num, $q); 366 435 $insresult=mysql_query($q); 367 436 if (mysql_errno()>0) … … 381 450 // reset after insert 382 451 unset($_SESSION["insert"]); 383 unset($_SESSION["name"]);384 unset($_SESSION["comment"]);452 // unset($_SESSION["name"]); 453 // unset($_SESSION["comment"]); 385 454 } 386 455 else 387 printf("<input type='button' value='Insert Data Set' onClick='self.location.href=\"%s&insert=yes\"'> \n", GetClearedURL()); 456 if ($_SESSION["DataSetSelection"]=="UpdateDataSet") 457 printf("<input type='button' value='Update Data Set in DB' onClick='self.location.href=\"%s&insert=yes\"'> \n", GetClearedURL()); 458 else 459 printf("<input type='button' value='Insert Data Set in DB' onClick='self.location.href=\"%s&insert=yes\"'> \n", GetClearedURL()); 388 460 } 389 461 … … 398 470 mysql_select_db($db); 399 471 400 $query0 = CreateQuery($alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs );472 $query0 = CreateQuery($alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs, $db_id); 401 473 402 474 $result0 = mysql_query($query0, $db_id); … … 409 481 PrintMagicTable($result0, $alias, $rightalign, $limitsmean, $limitsmin, $limitsmax, $result1, "yes"); 410 482 411 if (!(empty($_SESSION["sequon"]) && empty($_SESSION["sequoff"]))) 483 if (!(empty($_SESSION["sequon"]) && empty($_SESSION["sequoff"])) 484 && (empty($_SESSION["olduser"]) || $_SESSION["olduser"]==$_SESSION["user"])) 412 485 { 413 486 printf("<div align='left'>\n"); 414 printf("Remark: To store your selection you have to press 'Update Data Set'<br> \n");487 printf("Remark: To store your selection, you have to press 'Update Selection'<br> \n"); 415 488 printf("<br>\n"); 416 489 … … 618 691 if ($obskey!=$_SESSION["obsmode"]) 619 692 { 620 printf("<li style='color:%s'>%s: You have a mistake in your observation mode. %s - %s</li>\n",621 $color["ERROR"], "ERROR" , $obskey, $_SESSION["obsmode"]);693 printf("<li style='color:%s'>%s: You have a mistake in your observation mode. </li>\n", 694 $color["ERROR"], "ERROR"); 622 695 $numerr=$numerr+1; 623 696 } … … 689 762 690 763 // data set name and comment: to be inserted by the user 764 printf("Data set number: <input name='AnalysisNumber' type='text' size='8' maxlength='8' value='%s'> (only used for data set file) <br>\n", $_SESSION["AnalysisNumber"]); 691 765 printf("Data set name: <input name='name' type='text' size='20' maxlength='20' value='%s'><br>\n", $_SESSION["name"]); 692 766 printf("Comment: <input name='comment' type='text' size='50' maxlength='255' value='%s'><br><br>\n", $_SESSION["comment"]); 693 767 694 768 695 //PrintUpdateDataSetButton() has to be called before Insert DataSet()769 //PrintUpdateDataSetButton() has to be called before InsertUpdateDataSet() 696 770 // to ensure that there are no problem with insert and $_SESSION["insert"] 697 771 … … 710 784 printf("<br><br>\n Remark: As user MAGIC you are not allowed to insert data sets into the database. For an own account, please contact datacenter@astro.uni-wuerzburg.de <br><br>\n"); 711 785 else 712 Insert DataSet($values, $dataset);786 InsertUpdateDataSet($values, $dataset); 713 787 714 788 printf("<input type='button' value='Get Data Set File' onClick='self.location.href=\"%s&fSendTxt=2\"'> \n", GetClearedURL()); … … 720 794 printf("<table><tr><td colspan='2'><b>More Information on Your Data Set:<b></td></tr>"); 721 795 printf("<tr><td>Next DataSet# in DB: </td><td>%s</td></tr>", $dataset); 796 printf("<tr><td>DataSet# for data set file: </td><td>%s</td></tr>", empty($_SESSION["AnalysisNumber"])?"1":$_SESSION["AnalysisNumber"]); 722 797 printf("<tr><td valign='top'>SequencesOn:</td><td> %s</td></tr>", $_SESSION["sequon"]); 723 798 if ($_SESSION["sequoff"]!="") … … 748 823 else 749 824 { 750 printf("<input type='submit' value='Get Data Set'><br><br>\n"); 751 printf("Remark: To store your selection you have to press 'Get Data Set'<br> \n"); 825 if ($_SESSION["user"]!=$_SESSION["olduser"] && !empty($_SESSION["olduser"])) 826 printf("Remark: You (userkey %s) are not allowed to change data set # %d (created by userkey %s).<br> \n", 827 $_SESSION["user"], $_SESSION["SelectedDataSet"], $_SESSION["olduser"]); 828 else 829 { 830 printf("<input type='submit' value='Store Selection'><br><br>\n"); 831 printf("Remark: To store your selection for the data set, you have to press 'Store Selection'<br> \n"); 832 } 833 752 834 } 753 835 … … 800 882 foreach ($_POST as $element => $value) 801 883 $_SESSION[$element]=$value; 884 else 885 unset($_SESSION["SelectAllSequForDS"]); 802 886 803 887 if ($debug) 804 888 print_r($_SESSION); 805 889 /* 806 890 if ($_SESSION["DisplaySelected"]=="yes") 807 891 { … … 809 893 $_GET["fNumStart"]=0; 810 894 } 811 895 */ 812 896 $_SESSION["sequon"]=""; 813 897 $_SESSION["sequoff"]=""; … … 822 906 if ($val=="Not" && ereg("^DSSeq[0-9]*$", $key)) 823 907 unset($_SESSION[$key]); 824 825 } 908 } 909 if (empty($_SESSION["sequon"]) && empty($_SESSION["sequoff"])) 910 unset($_SESSION["DisplaySelected"]); 826 911 827 912 ini_set("display_errors", "On"); … … 868 953 } 869 954 870 if (!empty($_ SESSION["fSendTxt"]))955 if (!empty($_GET["fSendTxt"])) 871 956 { 872 957 header("Content-Type: application/octet"); 873 switch($_ SESSION["fSendTxt"])958 switch($_GET["fSendTxt"]) 874 959 { 875 960 case 1: … … 892 977 $first = empty($_GET["fRunMin"]) && empty($_GET["fRunMax"]); 893 978 InitBuildDataSets($first); 894 if (empty($_ SESSION["fPrintTable"]))979 if (empty($_GET["fPrintTable"])) 895 980 PrintForm($host, $user, $pw, $db, $limitsmean, $limitsmin, $limitsmax, $alias); 896 981 897 982 if ($environment==0) 898 printf("No query submitted yet.<BR>"); 983 { 984 printf("No query submitted yet.<br><br>\n"); 985 printf("Either query above, or you have also the option to start with an already existing data set: <br>\n"); 986 printf("Dataset: <input name='SelectedDataSet' type='text' size='8' maxlength='8' value='%s'><br><br>\n", $_SESSION["SelectedDataSet"]); 987 printf("How do you want to process this data set? <br>\n"); 988 printf("<input type='radio' name='DataSetSelection' value='SelectSequences' %s>Use data set as starting point.<br>\n", 989 $_SESSION["DataSetSelection"]=="SelectSequences"?"checked":""); 990 printf("<input type='radio' name='DataSetSelection' value='UpdateDataSet' %s>Update data set in database.<br><br>\n", 991 $_SESSION["DataSetSelection"]=="UpdateDataSet"?"checked":""); 992 printf("<input type='submit' value='Query'><br>\n"); 993 printf("</form>\n"); 994 } 899 995 else 900 996 { 901 if (empty($_SESSION["fPrintTable"])) 902 PrintPage("1", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limitsmean, $limitsmin, $limitsmax, $needs); 997 printf("</form>\n"); 998 if (empty($_SESSION["DataSetSelection"]) && !empty($_SESSION["SelectedDataSet"])) 999 { 1000 printf("Remark: You have inserted a data set number (%s), but not selected what you want to do with it. <br>\n", 1001 $_SESSION["SelectedDataSet"]); 1002 printf("Please press 'Reset'. Then to choose a data set and what you want to do with it or simply 'Query Table' to start a new data set.<br>\n"); 1003 } 903 1004 else 904 PrintPage("2", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limitsmean, $limitsmin, $limitsmax, $needs); 1005 { 1006 1007 if (empty($_GET["fPrintTable"])) 1008 PrintPage("1", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limitsmean, $limitsmin, $limitsmax, $needs); 1009 else 1010 PrintPage("2", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limitsmean, $limitsmin, $limitsmax, $needs); 1011 } 905 1012 } 906 1013 907 1014 echo (file_get_contents("index-footer.html")); 908 1015 } 1016 1017 if (!empty($_SESSION["DataSetSelection"])) 1018 $_SESSION["DataSetAcknowledged"]="yes"; 909 1019 910 1020 ini_set("display_errors", "Off");
Note:
See TracChangeset
for help on using the changeset viewer.