From: <tr...@us...> - 2002-10-01 21:53:23
|
Update of /cvsroot/basedb/basedb/www In directory usw-pr-cvs1:/tmp/cvs-serv28083 Modified Files: array.inc.php array_batchlist.phtml array_common.inc.php array_edit.phtml extract_edit.phtml hyb_edit.phtml labeled_edit.phtml plate_edit.phtml platetype_edit.phtml protocol_common.inc.php protocol_edit.phtml protocol_list.phtml Log Message: Protocol fixes, mostly Index: array.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/array.inc.php,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** array.inc.php 1 Oct 2002 17:35:10 -0000 1.39 --- array.inc.php 1 Oct 2002 21:53:19 -0000 1.40 *************** *** 764,784 **** // Counts the number of hits and sets up the search object ! function prepareSearch(&$search, $hpp, $arrayType = 0) { - // Add more fields and operators here $fields = array(); $search->makeWhere($fields); $arrayType = (int)$arrayType; if($arrayType) $search->addExtraWhere("ab.`arrayType` = $arrayType"); [...74 lines suppressed...] --- 799,817 ---- { $ss1 = "t.* FROM ArrayBatch ab, (SELECT ab.id,"; ! $ss2 = ",`designName`, `userName`, `arrayTypeRead`, ". ! "`arrayTypeRemoved`) AS t"; } else $ss1 = $ss2 = ""; ! $query = "SELECT ab.*, $ss1 at.name AS `designName`, ". ! "ug.name AS `userName`, ". "COUNT(a.id) AS arrays, COUNT(a.hybridization) AS hybs, ". ! "SUM(a.destroyed) AS destroyed, ". ! Item::whereShared("at", $user)." AS `arrayTypeRead`, ". ! "at.removed AS `arrayTypeRemoved` ". ! "FROM ArrayType at, UserGroup ug, ArrayBatch ab ". "LEFT JOIN Array a ON a.batch = ab.id ". ! "WHERE at.id = ab.`arrayType` AND ug.id = ab.owner ". $search->getWhere()." ".$search->getExtraWhere()." ". "GROUP BY ab.id $ss2 $ob ".$search->makeLimit(); Index: array_batchlist.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/array_batchlist.phtml,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** array_batchlist.phtml 5 Aug 2002 11:29:31 -0000 1.13 --- array_batchlist.phtml 1 Oct 2002 21:53:19 -0000 1.14 *************** *** 31,50 **** verifyAccess(BUA_ARRAY_READ); - $users = Submitter::getBrief(); - $userid = $curUser->getId(); - - batchSharing($users); - $pageTitle="$config[codename] - Array prints"; require_once("htmlinit.phtml"); ?> <table <?= $cellpad ?>> <tr><th class=pagehead>Array prints <?= webHelp(29, 1) ?></th></tr> <tr><td class=help>To create new prints, start from the array design ! pages.</td></tr> ! <form method=post name=ff action='array_batchlist.phtml'> </table> <? ! batchList($users, 0); ?> </form> --- 31,45 ---- verifyAccess(BUA_ARRAY_READ); $pageTitle="$config[codename] - Array prints"; require_once("htmlinit.phtml"); ?> <table <?= $cellpad ?>> + <form method=post name=ff action='array_batchlist.phtml'> <tr><th class=pagehead>Array prints <?= webHelp(29, 1) ?></th></tr> <tr><td class=help>To create new prints, start from the array design ! page.</td></tr> </table> <? ! batchList($curUser, 0); ?> </form> Index: array_common.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/array_common.inc.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** array_common.inc.php 1 Oct 2002 17:35:10 -0000 1.12 --- array_common.inc.php 1 Oct 2002 21:53:19 -0000 1.13 *************** *** 24,114 **** // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ! require_once("array.inc.php"); ! require_once("hyb.inc.php"); ! require_once("search.inc.php"); ! require_once("searchhtml.inc.php"); ! ! function batchSharing(&$users) ! { ! global $i_sh, $i_unsh, $i_shuser, $i_user, $curUser; [...171 lines suppressed...] ! ! echo "<tr bgcolor=$tdbg[$odd]>". ! "<td><a ".href("array_batch.phtml?i_ab=$id", 2).">". ! html($b["name"])."</a>".remMark($b["removed"])."</td>". ! "<td>".$atlink."</td>\n". ! "<td>".htmldatetime($b["printStartDate"])."</td>". "<td>".html($b["userName"])."</td>\n". + "<td>".groupAccessCheckbox($b["id"])."</td>". + "<td>".groupInfo($b, $users)."</td>". + "<td>".worldInfo($b)."</td>". "<td>$b[arrays] ($b[hybs] used, $b[destroyed] destr, ". ! ($b["arrays"]-$b["hybs"]-$b["destroyed"])." free)</td>". ! "</tr>\n"; } unset($b); + $cols = count($headerfields); + groupAccessFooter($cols, $user); + showDelLinks($cols); echo "</table>\n"; } Index: array_edit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/array_edit.phtml,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** array_edit.phtml 1 Oct 2002 17:35:10 -0000 1.23 --- array_edit.phtml 1 Oct 2002 21:53:19 -0000 1.24 *************** *** 74,80 **** if(isset($i_plat)) $at->setPlatform($i_plat); ! if(isset($i_proto) && $i_proto) ! $at->setProtocol($i_proto); ! dateAndOwnerInputHandle($samp, $curUser); } $atid = $at->getId(); --- 74,83 ---- if(isset($i_plat)) $at->setPlatform($i_plat); ! $p = $at->getProtocol(); ! $e = protocolValidate($p, "Configuration", $curUser); ! if($err == "") ! $err = $e; ! $at->setProtocol($p); ! dateAndOwnerInputHandle($at, $curUser); } $atid = $at->getId(); *************** *** 92,100 **** else if($at->getName() == "") $err = "The array design must have a name"; ! else if(!Protocol::isSharedAndType($at->getProtocol(), ! $curUser, "Configuration")) ! { ! $err = "Invalid protocol"; ! } else if(!$at->write()) { --- 95,100 ---- else if($at->getName() == "") $err = "The array design must have a name"; ! else if(!$at->getProtocol()) ! $err = "No protocol selected"; else if(!$at->write()) { *************** *** 531,543 **** arrayPlateList($at, $curUser); ! /* // Only show batches for printed array designs if($printed) { ?> <form method=post name=ff action="array_edit.phtml?i_at=<?= $atid ?>"> <? ! batchList($users, $atid); echo "</form>\n"; ! }*/ } ?> --- 531,544 ---- arrayPlateList($at, $curUser); ! // Only show batches for printed array designs if($printed) { ?> <form method=post name=ff action="array_edit.phtml?i_at=<?= $atid ?>"> + <input type=hidden name=location value="<?= html($location, 0) ?>"> <? ! batchList($curUser, $atid); echo "</form>\n"; ! } } ?> Index: extract_edit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/extract_edit.phtml,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** extract_edit.phtml 30 Sep 2002 16:57:05 -0000 1.20 --- extract_edit.phtml 1 Oct 2002 21:53:20 -0000 1.21 *************** *** 65,70 **** if(isset($i_name)) $ext->setName($i_name); - if(isset($i_proto) && $i_proto) - $ext->setProtocol($i_proto); if(isset($i_descr)) $ext->setDescr($i_descr); --- 65,68 ---- *************** *** 74,77 **** --- 72,81 ---- $ext->setExtractionDate("$i_ey-$i_em-$i_ed"); dateAndOwnerInputHandle($ext, $curUser); + + $p = $ext->getProtocol(); + $e = protocolValidate($p, "Extraction", $curUser); + if($err == "") + $err = $e; + $ext->setProtocol($p); } *************** *** 98,107 **** else if($ext->getName() == "") $err = "The extract must have a name"; ! else if(!Protocol::isSharedAndType($ext->getProtocol(), ! $curUser, "Extraction")) ! { ! // Removed protocols will pass the test above. ! $err = "Invalid protocol"; ! } else if(!$ext->write()) { --- 102,107 ---- else if($ext->getName() == "") $err = "The extract must have a name"; ! else if(!$ext->getProtocol()) ! $err = "No protocol selected"; else if(!$ext->write()) { Index: hyb_edit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/hyb_edit.phtml,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** hyb_edit.phtml 30 Sep 2002 16:57:05 -0000 1.35 --- hyb_edit.phtml 1 Oct 2002 21:53:20 -0000 1.36 *************** *** 77,83 **** if(isset($i_ey) && isset($i_em) && isset($i_ed)) $hyb->setHybridizationDate("$i_ey-$i_em-$i_ed"); - if(isset($i_proto) && $i_proto) - $hyb->setProtocol($i_proto); dateAndOwnerInputHandle($hyb, $curUser); } --- 77,87 ---- if(isset($i_ey) && isset($i_em) && isset($i_ed)) $hyb->setHybridizationDate("$i_ey-$i_em-$i_ed"); dateAndOwnerInputHandle($hyb, $curUser); + + $p = $hyb->getProtocol(); + $e = protocolValidate($p, "Hybridization", $curUser); + if($err == "") + $err = $e; + $hyb->setProtocol($p); } *************** *** 107,115 **** else if($hyb->getName() == "") $err = "The hybridization must have a name"; ! else if(!Protocol::isSharedAndType($hyb->getProtocol(), ! $curUser, "Hybridization")) ! { ! $err = "Invalid protocol"; ! } else if(!$hyb->write()) { --- 111,116 ---- else if($hyb->getName() == "") $err = "The hybridization must have a name"; ! else if(!$hyb->getProtocol()) ! $err = "No protocol selected"; else if(!$hyb->write()) { Index: labeled_edit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/labeled_edit.phtml,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** labeled_edit.phtml 30 Sep 2002 16:57:05 -0000 1.19 --- labeled_edit.phtml 1 Oct 2002 21:53:20 -0000 1.20 *************** *** 69,74 **** if(isset($i_ey) && isset($i_em) && isset($i_ed)) $lext->setLabelingDate("$i_ey-$i_em-$i_ed"); - if(isset($i_proto) && $i_proto) - $lext->setProtocol($i_proto); if(isset($i_label)) $lext->setLabel($i_label); --- 69,72 ---- *************** *** 76,79 **** --- 74,83 ---- $lext->setQuantity($i_origqty); dateAndOwnerInputHandle($lext, $curUser); + + $p = $lext->getProtocol(); + $e = protocolValidate($p, "Labeling", $curUser); + if($err == "") + $err = $e; + $lext->setProtocol($p); } *************** *** 99,108 **** else if($lext->getName() == "") $err = "The labeled extract must have a name"; ! else if(!Protocol::isSharedAndType($lext->getProtocol(), ! $curUser, "Labeling")) ! { ! // Removed protocols will pass the test above. ! $err = "Invalid protocol"; ! } else if(!$lext->write()) { --- 103,108 ---- else if($lext->getName() == "") $err = "The labeled extract must have a name"; ! else if(!$lext->getProtocol()) ! $err = "No protocol selected"; else if(!$lext->write()) { Index: plate_edit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/plate_edit.phtml,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** plate_edit.phtml 1 Oct 2002 17:35:10 -0000 1.32 --- plate_edit.phtml 1 Oct 2002 21:53:20 -0000 1.33 *************** *** 38,41 **** --- 38,43 ---- setLocation("plate_list.phtml"); + $protocolTypes = ProtocolType::getBrief(); + $edit = false; // Default to false $clone = 0; *************** *** 121,127 **** $ev =& $events[$eid]; [...68 lines suppressed...] "value='$ed'></td>". "<td>".html($prototypename)."</td>\n". ! "<td>".protocolSelect($events[$eid]["protocol"], ! $prototypename, $curUser, "i_proto$eid")."</td>". ! "</tr>\n"; } unset($e); *************** *** 484,488 **** { echo "<tr><td colspan=2><a ". ! href("plate_edit.phtml?i_p=$plateid&i_edit=1", 1). ">Edit plate</a></td></tr>\n"; } --- 486,490 ---- { echo "<tr><td colspan=2><a ". ! href("plate_edit.phtml?i_p=$plateid&i_edit=1", 2). ">Edit plate</a></td></tr>\n"; } Index: platetype_edit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/platetype_edit.phtml,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** platetype_edit.phtml 22 Sep 2002 23:37:35 -0000 1.15 --- platetype_edit.phtml 1 Oct 2002 21:53:20 -0000 1.16 *************** *** 34,38 **** setLocation("platetype_list.phtml"); ! $protoTypes = Protocol::getTypes(); $edit = true; --- 34,38 ---- setLocation("platetype_list.phtml"); ! $protoTypes = ProtocolType::getBrief(); $edit = true; Index: protocol_common.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/protocol_common.inc.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** protocol_common.inc.php 1 Oct 2002 17:35:10 -0000 1.2 --- protocol_common.inc.php 1 Oct 2002 21:53:20 -0000 1.3 *************** *** 29,48 **** function protocolSelect($oldid, $typename, &$user, $varname = "i_proto") { - echo "<select name=$varname>"; $protos = Protocol::getBriefByType( ProtocolType::getIdFromName($typename), $user, 0); for(reset($protos); list($id, $arr) = each($protos); ) { $sel = $id == $oldid ? "selected" : ""; ! echo "<option $sel value=$id>".html($arr["name"], 0). remMark($arr["removed"], 0)."\n"; } ! if(!isset($protos[$oldid])) { $arr = Protocol::getBasicFromId($oldid); ! echo "<option selected value=0>".html($arr["name"], 0). remMark($arr["removed"], 0)."\n"; } ! echo "</select>"; } --- 29,64 ---- function protocolSelect($oldid, $typename, &$user, $varname = "i_proto") { $protos = Protocol::getBriefByType( ProtocolType::getIdFromName($typename), $user, 0); + if(!$protos && !$oldid) + { + return "<span class=red>None defined</span>"; + } + $str = "<select name=$varname>"; for(reset($protos); list($id, $arr) = each($protos); ) { $sel = $id == $oldid ? "selected" : ""; ! $str .= "<option $sel value=$id>".html($arr["name"], 0). remMark($arr["removed"], 0)."\n"; } ! if($oldid && !isset($protos[$oldid])) { $arr = Protocol::getBasicFromId($oldid); ! $str .= "<option selected value=0>".html($arr["name"], 0). remMark($arr["removed"], 0)."\n"; } ! return $str."</select>"; ! } ! ! // Returns "" if the protocol id is valid, and an error message otherwise. ! function protocolValidate(&$id, $typename, &$user, $varname = "i_proto") ! { ! if(!isset($GLOBALS[$varname]) || !$GLOBALS[$varname]) ! return ""; ! $newid = (int)$GLOBALS[$varname]; ! if(!Protocol::isSharedAndType($newid, $user, $typename)) ! return "Invalid $typename protocol (id = $newid)"; ! $id = $newid; ! return ""; } Index: protocol_edit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/protocol_edit.phtml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** protocol_edit.phtml 26 Sep 2002 19:35:05 -0000 1.10 --- protocol_edit.phtml 1 Oct 2002 21:53:20 -0000 1.11 *************** *** 129,133 **** <form method=post enctype="multipart/form-data" action="protocol_edit.phtml?i_p=<?= $protoid ?>"> - <input type=hidden name=i_type value=<?= $proto->getProtocolType() ?>> <input type=hidden name=i_edit value=1> <input type=hidden name=location value="<?= html($location, 0) ?>"> --- 129,132 ---- *************** *** 137,145 **** value="<?= html($proto->getName(), 0) ?>"></td></tr> ! <tr><th>Protocol type</th><td><select name=i_type> <? for(reset($types); list($tid, $tn) = each($types); ) { ! $sel = $tid == $proto->getType() ? "selected" : ""; echo "<option $sel value=$tid>".html($tn, 0)."\n"; } --- 136,144 ---- value="<?= html($proto->getName(), 0) ?>"></td></tr> ! <tr><th>Protocol type</th><td><select name=i_ptype> <? for(reset($types); list($tid, $tn) = each($types); ) { ! $sel = $tid == $proto->getProtocolType() ? "selected" : ""; echo "<option $sel value=$tid>".html($tn, 0)."\n"; } Index: protocol_list.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/protocol_list.phtml,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** protocol_list.phtml 30 Sep 2002 16:57:05 -0000 1.12 --- protocol_list.phtml 1 Oct 2002 21:53:20 -0000 1.13 *************** *** 54,59 **** $typeid = $rev[$i_typename]; } ! else if(isset($i_type)) ! $typeid = isset($types[$i_type]) ? $i_type : 0; else $typeid = 0; --- 54,59 ---- $typeid = $rev[$i_typename]; } ! else if(isset($i_ptype)) ! $typeid = isset($types[$i_ptype]) ? $i_ptype : 0; else $typeid = 0; *************** *** 67,78 **** if(s.selectedIndex < 0) return; f=s.form; ! f.action="protocol_list.phtml?i_type="+s.options[s.selectedIndex].value; f.submit(); } </script> <table <?= $cellpad ?>> ! <form name=ff method=post action="protocol_list.phtml?i_type=<?= $typeid ?>"> <tr><th class=pagehead>Protocols for ! <select name=i_type onChange="changePType(this)"> <option value=0>Everything <? --- 67,78 ---- if(s.selectedIndex < 0) return; f=s.form; ! f.action="protocol_list.phtml?i_ptype="+s.options[s.selectedIndex].value; f.submit(); } </script> <table <?= $cellpad ?>> ! <form name=ff method=post action="protocol_list.phtml?i_ptype=<?= $typeid ?>"> <tr><th class=pagehead>Protocols for ! <select name=i_ptype onChange="changePType(this)"> <option value=0>Everything <? *************** *** 100,104 **** { $addlink = "<a class=large href='protocol_edit.phtml". ! "?i_type=$typeid'>Add protocol</a>"; } makeSearchHeader($search, $headerfields, $sortorder, $defsort, "", --- 100,104 ---- { $addlink = "<a class=large href='protocol_edit.phtml". ! "?i_ptype=$typeid'>Add protocol</a>"; } makeSearchHeader($search, $headerfields, $sortorder, $defsort, "", |