Update of /cvsroot/basedb/basedb/www In directory usw-pr-cvs1:/tmp/cvs-serv26839 Modified Files: extract_edit.phtml extract_list.phtml hyb_common.inc.php hyb_edit.phtml hyb_image.phtml hyb_list.phtml hyb_result.phtml item.inc.php item_common.inc.php labeled_edit.phtml labeled_list.phtml plate.inc.php plate_edit.phtml plate_list.phtml platetype_edit.phtml platetype_list.phtml sample_edit.phtml sample_list.phtml sampleannot_edit.phtml sampleannot_list.phtml sampleannotation.inc.php upload.inc.php upload_list.phtml user.inc.php ware_edit.phtml ware_list.phtml Added Files: platetype.inc.php Log Message: Changed/rewrote to match new Item/item_common functionality --- NEW FILE: platetype.inc.php --- <? // $Id: platetype.inc.php,v 1.1 2002/09/22 23:37:35 troein Exp $ // // BioArray Software Environment (BASE) - homepage http://base.thep.lu.se/ // Copyright (C) 2002 Lao Saal, Carl Troein, Johan Vallon-Christersson (LSCTJVC) // // Write to LSCTJVC, Dept. of Oncology, Lund University Hospital, // Klinikgatan 7, SE-22185, Lund, Sweden. // // This file is part of BASE. // // BASE is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // BASE is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the [...319 lines suppressed...] $arr = array(); $res = query($query); while($row =& db_fetch_assoc($res)) $arr[] = $row; return $arr; } function getPlateCount() { $query = "SELECT COUNT(*) FROM Plate ". "WHERE `plateType` = $this->id"; $res = query($query); if($row =& db_fetch_row($res)) return $row[0]; return -1; } } ?> Index: extract_edit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/extract_edit.phtml,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** extract_edit.phtml 20 Sep 2002 18:25:00 -0000 1.17 --- extract_edit.phtml 22 Sep 2002 23:37:34 -0000 1.18 *************** *** 44,48 **** } else $edit = isset($i_edit) && $i_edit && ! $ext->isShared($curUser, true); } else if(isset($i_samp)) --- 44,48 ---- } else $edit = isset($i_edit) && $i_edit && ! $ext->mayEdit($curUser); } else if(isset($i_samp)) *************** *** 260,264 **** else { ! if($ext->getOwner() == $curUser->getId() && acc(BUA_BIO_EDIT)) { if($ext->getRemoved()) --- 260,264 ---- else { ! if($ext->mayDelete($curUser, BUA_BIO_EDIT)) { if($ext->getRemoved()) *************** *** 277,281 **** } } ! if($ext->isShared($curUser, true) && acc(BUA_BIO_EDIT)) { echo "<tr><td colspan=2><a ". --- 277,281 ---- } } ! if($ext->mayEdit($curUser, BUA_BIO_EDIT)) { echo "<tr><td colspan=2><a ". Index: extract_list.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/extract_list.phtml,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** extract_list.phtml 20 Sep 2002 18:25:00 -0000 1.13 --- extract_list.phtml 22 Sep 2002 23:37:34 -0000 1.14 *************** *** 37,41 **** // Sharing $users = UserGroup::getBrief(); ! groupAccessHandle("Extract", $users, $curUser); $searchfields = array("Name", "Description", "Sample", "Owner", --- 37,41 ---- // Sharing $users = UserGroup::getBrief(); ! groupAccessHandle("Extract", $curUser); $searchfields = array("Name", "Description", "Sample", "Owner", *************** *** 80,84 **** $s =& $extracts[$i]; ! if(isset($s["samplePublic"])) { $slink = "<a href='sample_edit.phtml?i_samp=$s[sample]'>". --- 80,84 ---- $s =& $extracts[$i]; ! if($s["samplePublic"]) { $slink = "<a href='sample_edit.phtml?i_samp=$s[sample]'>". *************** *** 118,126 **** "<td>".$hybs."</td></tr>\n"; } ! $cols = 11; if($addlink != "") echo "<tr><td colspan=$cols>$addlink</td></tr>\n"; ! groupAccessFooter($cols, $users, $curUser); showDelLinks($cols); ?> --- 118,126 ---- "<td>".$hybs."</td></tr>\n"; } ! $cols = count($headerfields); if($addlink != "") echo "<tr><td colspan=$cols>$addlink</td></tr>\n"; ! groupAccessFooter($cols, $curUser); showDelLinks($cols); ?> Index: hyb_common.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/hyb_common.inc.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** hyb_common.inc.php 20 Sep 2002 18:25:00 -0000 1.7 --- hyb_common.inc.php 22 Sep 2002 23:37:34 -0000 1.8 *************** *** 74,78 **** $link = html($l["name"]); echo "<tr><th>Labeled extract</th>". ! "<td>$link (".html($l["label"]).", $l[quantity] µg)</td></tr>"; } --- 74,79 ---- $link = html($l["name"]); echo "<tr><th>Labeled extract</th>". ! "<td>$link (".html($l["label"]).", $l[quantity] µg)". ! remMark($l["removed"])."</td></tr>"; } Index: hyb_edit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/hyb_edit.phtml,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** hyb_edit.phtml 20 Sep 2002 18:25:00 -0000 1.33 --- hyb_edit.phtml 22 Sep 2002 23:37:34 -0000 1.34 *************** *** 44,48 **** // Sharing $users = UserGroup::getBrief(); ! groupAccessHandle("ImageAcquisition", $users, $curUser); $err = ""; --- 44,48 ---- // Sharing $users = UserGroup::getBrief(); ! groupAccessHandle("ImageAcquisition", $curUser); $err = ""; *************** *** 396,413 **** else { ! if($hyb->getOwner() == $curUser->getId() && acc(BUA_BIO_EDIT)) { ! ?> ! <tr><td colspan=2><a <?= href("hyb_edit.phtml?i_hyb=$hybid&i_delete=1", 1) ! ?> onClick="return confirm('Really delete this hybridization?')" ! >Delete hybridization</a></td></tr> ! <? } ! if($hyb->isShared($curUser, true) && acc(BUA_BIO_EDIT)) { ! ?> ! <tr><td colspan=2><a <?= href("hyb_edit.phtml?i_hyb=$hybid&i_edit=1", 1) ! ?>>Edit hybridization</a></td></tr> ! <? } hybInfo($hyb); --- 396,421 ---- else { ! if($hyb->mayDelete($curUser, BUA_BIO_EDIT)) { ! if($hyb->getRemoved()) ! { ! echo "<tr><td colspan=2><a onClick=\"return ". ! "confirm('Really undelete this hybridization?')\" ". ! href("hyb_edit.phtml?i_hyb=$hybid&i_delete=2", 1). ! ">Undelete hybridization</a></td></tr>\n"; ! } ! else ! { ! echo "<tr><td colspan=2><a onClick=\"return ". ! "confirm('Really delete this hybridization?')\" ". ! href("hyb_edit.phtml?i_hyb=$hybid&i_delete=1", 1). ! ">Delete hybridization</a></td></tr>\n"; ! } } ! if($hyb->mayEdit($curUser, BUA_BIO_EDIT)) { ! echo "<tr><td colspan=2><a ". ! href("hyb_edit.phtml?i_hyb=$hybid&i_edit=1", 1). ! ">Edit hybridization</a></td></tr>\n"; } hybInfo($hyb); *************** *** 489,493 **** echo "<tr><td colspan=$cols>$addscan</td></tr>\n"; ! groupAccessFooter($cols, $users, $curUser); showDelLinks($cols); echo "</table>\n"; --- 497,501 ---- echo "<tr><td colspan=$cols>$addscan</td></tr>\n"; ! groupAccessFooter($cols, $curUser); showDelLinks($cols); echo "</table>\n"; Index: hyb_image.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/hyb_image.phtml,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** hyb_image.phtml 20 Sep 2002 18:25:01 -0000 1.24 --- hyb_image.phtml 22 Sep 2002 23:37:34 -0000 1.25 *************** *** 330,339 **** else { ! if($acq->getOwner() == $userid && acc(BUA_BIO_EDIT)) { ! echo "<tr><td colspan=2><a ". ! href("hyb_image.phtml?i_acq=$acqid&i_delete=1", 1). ! " onClick=\"return confirm('Really delete this image set?')\"". ! ">Delete image set</a></td></tr>\n"; } if($acq->isShared($curUser, true) && acc(BUA_BIO_EDIT)) --- 330,349 ---- else { ! if($acq->mayDelete($curUser, BUA_BIO_EDIT)) { ! if($acq->getRemoved()) ! { ! echo "<tr><td colspan=2><a onClick=\"return ". ! "confirm('Really undelete this image set?')\" ". ! href("hyb_image.phtml?i_acq=$acqid&i_delete=2", 1). ! ">Undelete image set</a></td></tr>\n"; ! } ! else ! { ! echo "<tr><td colspan=2><a onClick=\"return ". ! "confirm('Really delete this image set?')\" ". ! href("hyb_image.phtml?i_acq=$acqid&i_delete=1", 1). ! ">Delete image set</a></td></tr>\n"; ! } } if($acq->isShared($curUser, true) && acc(BUA_BIO_EDIT)) *************** *** 449,453 **** unset($a); $cols = 7; ! if(!$edit && $acq->isShared($curUser, true) && acc(BUA_BIO_EDIT)) { echo "<tr><td colspan=$cols class=large><a ". --- 459,463 ---- unset($a); $cols = 7; ! if(!$edit && $acq->mayEdit($curUser, BUA_BIO_EDIT)) { echo "<tr><td colspan=$cols class=large><a ". Index: hyb_list.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/hyb_list.phtml,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** hyb_list.phtml 20 Sep 2002 18:25:01 -0000 1.13 --- hyb_list.phtml 22 Sep 2002 23:37:34 -0000 1.14 *************** *** 37,46 **** // Sharing $users = UserGroup::getBrief(); ! groupAccessHandle("Hybridization", $users, $curUser); $searchfields = array("Name", "Description", "Owner", "Date added", "Hybridization date", "Protocol"); $fieldtype = array(0, 0, 0, 1, 1, 0); ! $headerfields = array("Hybridization", "Labeled extracts", "Array", "Hyb date", "Owner", "[<a href=javascript:selAll(1)>A</a> ". --- 37,46 ---- // Sharing $users = UserGroup::getBrief(); ! groupAccessHandle("Hybridization", $curUser); $searchfields = array("Name", "Description", "Owner", "Date added", "Hybridization date", "Protocol"); $fieldtype = array(0, 0, 0, 1, 1, 0); ! $headerfields = array("Name", "Labeled extracts", "Array", "Hyb date", "Owner", "[<a href=javascript:selAll(1)>A</a> ". *************** *** 117,121 **** echo "<tr bgcolor=$tdbg[$odd]>". ! "<td><a href='hyb_edit.phtml?i_hyb=$s[id]'>".html($s["name"])."</a></td>". "<td>".implode(",\n", $llink)."</td>". "<td>".html($s["barcode"])."</td>". --- 117,122 ---- echo "<tr bgcolor=$tdbg[$odd]>". ! "<td><a href='hyb_edit.phtml?i_hyb=$s[id]'>".html($s["name"]). ! "</a>".remMark($s["removed"])."</td>". "<td>".implode(",\n", $llink)."</td>". "<td>".html($s["barcode"])."</td>". *************** *** 135,139 **** echo "<tr><td colspan=$cols>$addlink</td></tr>\n"; ! groupAccessFooter($cols, $users, $curUser); showDelLinks($cols); ?> --- 136,140 ---- echo "<tr><td colspan=$cols>$addlink</td></tr>\n"; ! groupAccessFooter($cols, $curUser); showDelLinks($cols); ?> Index: hyb_result.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/hyb_result.phtml,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** hyb_result.phtml 10 Sep 2002 23:05:26 -0000 1.54 --- hyb_result.phtml 22 Sep 2002 23:37:34 -0000 1.55 *************** *** 35,38 **** --- 35,39 ---- require_once("upload.inc.php"); require_once("wizzzard.inc.php"); + require_once("item_common.inc.php"); verifyAccess(BUA_BIO_EDIT); *************** *** 49,54 **** if(!isset($i_acq)) $err = "No image acquisition id specified (i_acq)"; [...297 lines suppressed...] ! <tr><td colspan=2 class=large><?= returnLink($ispopup) ?></th></tr> <? ! if($err != "") ! echo "<tr><td class=red colspan=2>$err</td></tr>\n"; ?> <form method=post action="hyb_result.phtml?i_acq=<?= $acq->getId() ?>" *************** *** 583,587 **** $ch2 = 0; } ! else return "Bad number of labeled extracts - 1 or 2 needed"; $wiz = new Wizzzard(); --- 604,609 ---- $ch2 = 0; } ! else ! return "Bad number of labeled extracts - 1 or 2 needed"; $wiz = new Wizzzard(); Index: item.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/item.inc.php,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** item.inc.php 20 Sep 2002 18:25:01 -0000 1.32 --- item.inc.php 22 Sep 2002 23:37:34 -0000 1.33 *************** *** 65,68 **** --- 65,85 ---- } + function readItem(&$row) + { + $this->id = (int)$row["id"]; + $this->owner = (int)$row["owner"]; + $this->name = $row["name"]; + $this->addedDate = $row["addedDate"]; + $this->descr = $row["descr"]; [...87 lines suppressed...] function updateGid($gid) --- 377,380 ---- *************** *** 419,422 **** --- 410,424 ---- return Item::updateColumn($type, $id, "worldAccess", max(0, min(1, (int)$acc))); + } + + function mayDelete(&$user, $access = false) + { + return ($access !== false || $user->access($access)) + && $this->owner == $user->getId(); + } + function mayEdit(&$user, $access = false) + { + return ($access !== false || $user->access($access)) + && $this->isShared($user, true) && !$this->removed; } Index: item_common.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/item_common.inc.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** item_common.inc.php 20 Sep 2002 18:25:01 -0000 1.2 --- item_common.inc.php 22 Sep 2002 23:37:35 -0000 1.3 *************** *** 110,114 **** // group associated with an item. $arr is an array with // "gid" and "groupAccess", or an Item. ! // If the user isn't found in $users, it'll be taken from the // database. function groupInfo(&$arr, &$users) --- 110,115 ---- // group associated with an item. $arr is an array with // "gid" and "groupAccess", or an Item. ! // $users is an array as returned by UserGroup::getBrief(). ! // If the group isn't found in $users, it'll be read from the [...151 lines suppressed...] + if(c == 1) + return confirm("Really "+act+" this <?= $itemname ?>?"); + return confirm("Really "+act+" these "+c+" <?= $itemname ?>s?"); + } + </script> + <tr><td colspan=<?= $cols ?>><input type=submit name=i_delmarked + value="Delete marked <?= $itemname ?>s" + onClick="return confirmDel('delete')"> + <? + if($showundelete) + { + ?> + <input type=submit name=i_undelmarked + value="Undelete marked <?= $itemname ?>s" + onClick="return confirmDel('undelete')"> + <? + } + echo "</td></tr>\n"; } Index: labeled_edit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/labeled_edit.phtml,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** labeled_edit.phtml 20 Sep 2002 18:25:01 -0000 1.16 --- labeled_edit.phtml 22 Sep 2002 23:37:35 -0000 1.17 *************** *** 283,287 **** else { ! if($lext->getOwner() == $curUser->getId() && acc(BUA_BIO_EDIT)) { if($lext->getRemoved()) --- 283,287 ---- else { ! if($lext->mayDelete($curUser, BUA_BIO_EDIT)) { if($lext->getRemoved()) *************** *** 300,304 **** } } ! if($lext->isShared($curUser, true) && acc(BUA_BIO_EDIT)) { echo "<tr><td colspan=2><a ". --- 300,304 ---- } } ! if($lext->mayEdit($curUser, BUA_BIO_EDIT)) { echo "<tr><td colspan=2><a ". Index: labeled_list.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/labeled_list.phtml,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** labeled_list.phtml 20 Sep 2002 18:25:01 -0000 1.14 --- labeled_list.phtml 22 Sep 2002 23:37:35 -0000 1.15 *************** *** 37,41 **** // Sharing $users = UserGroup::getBrief(); ! groupAccessHandle("LabeledExtract", $users, $curUser); $searchfields = array("Name", "Description", "Extract", "Sample", --- 37,41 ---- // Sharing $users = UserGroup::getBrief(); ! groupAccessHandle("LabeledExtract", $curUser); $searchfields = array("Name", "Description", "Extract", "Sample", *************** *** 84,88 **** $s =& $lexts[$i]; ! if(isset($s["samplePublic"])) { $slink = "<a href='sample_edit.phtml?i_samp=$s[sample]'>". --- 84,88 ---- $s =& $lexts[$i]; ! if($s["samplePublic"]) { $slink = "<a href='sample_edit.phtml?i_samp=$s[sample]'>". *************** *** 91,95 **** else $slink = html($s["sampleName"]); ! if(isset($s["extractPublic"])) { $elink = "<a href='extract_edit.phtml?i_ext=$s[extract]'>". --- 91,95 ---- else $slink = html($s["sampleName"]); ! if($s["extractPublic"]) { $elink = "<a href='extract_edit.phtml?i_ext=$s[extract]'>". *************** *** 130,134 **** echo "<tr><td colspan=$cols>$addlink</td></tr>\n"; ! groupAccessFooter($cols, $users, $curUser); showDelLinks($cols); ?> --- 130,134 ---- echo "<tr><td colspan=$cols>$addlink</td></tr>\n"; ! groupAccessFooter($cols, $curUser); showDelLinks($cols); ?> Index: plate.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/plate.inc.php,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** plate.inc.php 12 Sep 2002 13:23:22 -0000 1.34 --- plate.inc.php 22 Sep 2002 23:37:35 -0000 1.35 *************** *** 25,300 **** // require_once("item.inc.php"); - define("CLEN_PLATETYPE_NAME", CLEN_ITEM_NAME); - define("CLEN_PLATETYPE_NAMEPREFIX", 40); define("CLEN_PLATE_NAME", 30); define("CLEN_PLATE_BARCODE", 30); - define("CLEN_PLATEEVENTTYPE_NAME", 40); - - class PlateType extends Item [...665 lines suppressed...] ! $arr[] = $row; return $arr; } *************** *** 753,766 **** { return parent::getNameFromId("Plate", $id); - } - - // Returns an array with 0=>name,1=>typename - function getNameAndType($id) - { - $query = "SELECT p.name, pt.name FROM Plate p, PlateType pt ". - "WHERE pt.id = p.`plateType` AND p.id = ".(int)$id; - $res = query($query); - if($row =& db_fetch_row($res)) return $row; - return false; } --- 390,393 ---- Index: plate_edit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/plate_edit.phtml,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** plate_edit.phtml 20 Sep 2002 18:25:02 -0000 1.29 --- plate_edit.phtml 22 Sep 2002 23:37:35 -0000 1.30 *************** *** 31,34 **** --- 31,35 ---- require_once("search.inc.php"); require_once("searchhtml.inc.php"); + require_once("item_common.inc.php"); verifyAccess(BUA_ARRAY_READ); Index: plate_list.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/plate_list.phtml,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** plate_list.phtml 5 Aug 2002 11:29:34 -0000 1.27 --- plate_list.phtml 22 Sep 2002 23:37:35 -0000 1.28 *************** *** 27,75 **** require_once("protocol.inc.php"); require_once("plate.inc.php"); require_once("search.inc.php"); require_once("searchhtml.inc.php"); verifyAccess(BUA_ARRAY_READ); ! $err = ""; ! if(isset($i_delete) && acc(BUA_ARRAY_EDIT)) ! { [...306 lines suppressed...] ! "<td>".worldInfo($p)."</td>\n"; ! for($j = 0; $j < count($eventTypes); $j++) ! echo "<td>".htmldate($p["evDate$j"])."</td>\n"; ! echo "<td>$par</td>". ! "<td>$uo</td>". ! "<td>$dau</td>". ! "</tr>\n"; } ! $cols = count($headerfields); if($links != "") ! echo "<tr><td colspan=$cols>$links</td></tr>\n"; ! groupAccessFooter($cols, $curUser); ! massDeleteInput($cols, "plate", showDelValue() !== 0); ! showDelLinks($cols); ! ?> + </form> </table> </body> Index: platetype_edit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/platetype_edit.phtml,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** platetype_edit.phtml 10 Sep 2002 23:06:22 -0000 1.14 --- platetype_edit.phtml 22 Sep 2002 23:37:35 -0000 1.15 *************** *** 26,32 **** require_once("init.inc.php"); require_once("protocol.inc.php"); ! require_once("plate.inc.php"); require_once("search.inc.php"); require_once("searchhtml.inc.php"); verifyAccess(BUA_ARRAY_READ); --- 26,33 ---- require_once("init.inc.php"); require_once("protocol.inc.php"); [...563 lines suppressed...] + "<th>Description</th><th>Added</th><th>Added by</th></tr>\n"; + } + $void = array(); + for($i = 0, $odd = 0; $i < count($eventTypes); $i++, $odd ^= 1) + { + $pet =& $eventTypes[$i]; + if(isset($protoTypes[$pet->getProtocolType()])) + $pt = html($protoTypes[$pet->getProtocolType()]); + else + $pt = "<span class=red>Unknown</span>"; + echo "<tr bgcolor=$tdbg[$odd]>". + "<td>".html($pet->getName()).remMark($pet)."</td>". + "<td>".$pt."</td>". + "<td>".html($pet->getDescr())."</td>". + "<td>".htmldate($pet->getAddedDate())."</td>". + "<td>".userInfo($pet, $void)."</td>". + "</tr>\n"; + } } ?> Index: platetype_list.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/platetype_list.phtml,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** platetype_list.phtml 5 Aug 2002 11:19:01 -0000 1.9 --- platetype_list.phtml 22 Sep 2002 23:37:35 -0000 1.10 *************** *** 29,38 **** require_once("search.inc.php"); require_once("searchhtml.inc.php"); verifyAccess(BUA_ARRAY_READ); ! $headerfields = array("Name", "Wells", "Events", "Well annotation", ! "Description"); ! $sortorder = array(1, 1, 0, 0, 1); $defsort = 0; [...111 lines suppressed...] "<td valign=top>".implode("<br>\n", $earr)."</td>\n". "<td valign=top>".implode("<br>\n", $annarr)."</td>\n". *************** *** 87,91 **** "</tr>\n"; } ! if($addlink != "") echo "<tr><td colspan=5>$addlink</td></tr>\n"; ?> </table> --- 109,118 ---- "</tr>\n"; } ! $cols = count($headerfields); ! if($addlink != "") ! echo "<tr><td colspan=$cols>$addlink</td></tr>\n"; ! ! groupAccessFooter($cols, $curUser); ! showDelLinks($cols); ?> </table> Index: sample_edit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/sample_edit.phtml,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** sample_edit.phtml 20 Sep 2002 18:25:02 -0000 1.21 --- sample_edit.phtml 22 Sep 2002 23:37:35 -0000 1.22 *************** *** 194,201 **** dateAndOwnerTable($samp, $curUser, true); ! if(!$sampid) $annots = array(); ! else $annots = SampleAnnotation::getBriefForSample($sampid); ! if($annots) echo "<tr><th>Annotation</th><th>Value</th></tr>\n"; ! else echo "<tr><th>Annotations</th><td>None</td></tr>\n"; for(reset($annots), $odd=1; list($id, $arr) = each($annots); $odd ^= 1) { --- 194,205 ---- dateAndOwnerTable($samp, $curUser, true); ! if(!$sampid) ! $annots = array(); ! else ! $annots = SampleAnnotation::getBriefForSample($sampid, $curUser); ! if($annots) ! echo "<tr><th>Annotation</th><th>Value</th></tr>\n"; ! else ! echo "<tr><th>Annotations</th><td>None</td></tr>\n"; for(reset($annots), $odd=1; list($id, $arr) = each($annots); $odd ^= 1) { *************** *** 213,217 **** else { ! if($samp->getOwner() == $curUser->getId() && acc(BUA_BIO_EDIT)) { if($samp->getRemoved()) --- 217,221 ---- else { ! if($samp->mayDelete($curUser, BUA_BIO_EDIT)) { if($samp->getRemoved()) *************** *** 230,234 **** } } ! if($samp->isShared($curUser, true) && acc(BUA_BIO_EDIT)) { echo "<tr><td colspan=2><a ".href("sample_edit.phtml". --- 234,238 ---- } } ! if($samp->mayEdit($curUser, BUA_BIO_EDIT)) { echo "<tr><td colspan=2><a ".href("sample_edit.phtml". *************** *** 254,260 **** <tr><th colspan=2 class=subhead>Annotations</th></tr> <? ! $annots = SampleAnnotation::getBriefForSample($sampid); ! if($annots) echo "<tr><th>Annotation</th><th>Value</th></tr>\n"; ! else echo "<tr><td colspan=2>None</td></tr>\n"; for(reset($annots), $odd=1; list($id, $arr) = each($annots); $odd ^= 1) { --- 258,266 ---- <tr><th colspan=2 class=subhead>Annotations</th></tr> <? ! $annots = SampleAnnotation::getBriefForSample($sampid, $curUser); ! if($annots) ! echo "<tr><th>Annotation</th><th>Value</th></tr>\n"; ! else ! echo "<tr><td colspan=2>None</td></tr>\n"; for(reset($annots), $odd=1; list($id, $arr) = each($annots); $odd ^= 1) { Index: sample_list.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/sample_list.phtml,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** sample_list.phtml 20 Sep 2002 18:25:02 -0000 1.17 --- sample_list.phtml 22 Sep 2002 23:37:35 -0000 1.18 *************** *** 41,45 **** // Sharing $users = UserGroup::getBrief(); ! groupAccessHandle("Sample", $users, $curUser); $searchfields = array("Name", "Description", "Owner", "Sample date", --- 41,45 ---- // Sharing $users = UserGroup::getBrief(); ! groupAccessHandle("Sample", $curUser); $searchfields = array("Name", "Description", "Owner", "Sample date", *************** *** 56,60 **** else { ! $annottypes = SampleAnnotationType::getBasic(showDelSublist()); $headerfields = array("Name"); for(reset($annottypes); list(, $arr) = each($annottypes); ) --- 56,61 ---- else { ! $annottypes = SampleAnnotationType::getBasic($curUser, ! showDelSublist()); $headerfields = array("Name"); for(reset($annottypes); list(, $arr) = each($annottypes); ) *************** *** 163,167 **** $anns = SampleAnnotation::getBrieferForSample($s["id"], ! showDelSublist()); echo "<tr bgcolor=$tdbg[$odd]>". --- 164,168 ---- $anns = SampleAnnotation::getBrieferForSample($s["id"], ! $curUser, showDelSublist()); echo "<tr bgcolor=$tdbg[$odd]>". *************** *** 182,188 **** if($samples && !$view) ! { ! groupAccessFooter($cols, $users, $curUser); ! } showDelLinks($cols); --- 183,187 ---- if($samples && !$view) ! groupAccessFooter($cols, $curUser); showDelLinks($cols); Index: sampleannot_edit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/sampleannot_edit.phtml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** sampleannot_edit.phtml 16 Sep 2002 14:20:57 -0000 1.11 --- sampleannot_edit.phtml 22 Sep 2002 23:37:35 -0000 1.12 *************** *** 50,88 **** { if(!$sat->read($i_sat)) $err = "No such annotation type"; } ! else { $sat->setOptions(10); $sat->setOwner($curUser->getId()); } ! $satid = $sat->getId(); [...169 lines suppressed...] - html(Submitter::getNameFromId($sat->getOwner())) ?></td></tr> <tr><th>Type</th><td><select name=i_type onChange='this.form.submit()'> <? --- 162,165 ---- *************** *** 171,176 **** ?> </select></td></tr> - <? if($sat->getValueType() != "e") { --- 172,178 ---- ?> </select></td></tr> <? + dateAndOwnerTable($sat, $curUser, true); + if($sat->getValueType() != "e") { Index: sampleannot_list.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/sampleannot_list.phtml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** sampleannot_list.phtml 16 Sep 2002 14:20:57 -0000 1.10 --- sampleannot_list.phtml 22 Sep 2002 23:37:35 -0000 1.11 *************** *** 33,41 **** showDelPrep(); $searchfields = array("Name", "Description", "Owner", "Added"); $fieldtype = array(0, 0, 0, 1); $headerfields = array("Name", "Type", "Options", "Default", ! "Description", "Added", "Owner"); ! $sortorder = array(1, 1, 1, 1, 1, -1, 1); $defsort = 0; --- 33,48 ---- [...62 lines suppressed...] ?> --- 90,107 ---- "<td>".html($s["options"])."</td>". "<td>".html($s["defaultValue"])."</td>". "<td>".htmldate($s["addedDate"])."</td>". "<td>".html($s["userName"])."</td>". + "<td>".groupAccessCheckbox($s["id"])."</td>". + "<td>".groupInfo($s, $users)."</td>". + "<td>".worldInfo($s)."</td>". + "<td>".html($s["descr"])."</td>". "</tr>\n"; } ! $cols = count($headerfields); if($addlink != "") echo "<tr><td colspan=$cols>$addlink</td></tr>\n"; + + groupAccessFooter($cols, $curUser); showDelLinks($cols); ?> Index: sampleannotation.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/sampleannotation.inc.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** sampleannotation.inc.php 16 Sep 2002 14:20:57 -0000 1.18 --- sampleannotation.inc.php 22 Sep 2002 23:37:35 -0000 1.19 *************** *** 39,43 **** { $this->Item("SampleAnnotationType", $name, $descr, $owner, $addedDate, ! $id, $removed); $this->id = (int)$id; $this->name = $name; --- 39,43 ---- { $this->Item("SampleAnnotationType", $name, $descr, $owner, $addedDate, ! $id, $removed, 0, 0, 0); $this->id = (int)$id; [...238 lines suppressed...] --- 304,308 ---- // Returns array id => annotation ! function getBrieferForSample($sample, &$user, $removed = 0) { $query = "SELECT sa.`annotationType`, sa.annotation ". *************** *** 326,330 **** "WHERE sa.sample = ".(int)$sample." ". "AND sat.id = sa.`annotationType` ". ! Item::whereRemovedAnd("sat", $removed); "ORDER BY sa.`annotationType`"; $arr = array(); --- 310,315 ---- "WHERE sa.sample = ".(int)$sample." ". "AND sat.id = sa.`annotationType` ". ! Item::whereRemovedAnd("sat", $removed)." ". ! "AND ".Item::whereShared("sat", $user)." ". "ORDER BY sa.`annotationType`"; $arr = array(); Index: upload.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/upload.inc.php,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** upload.inc.php 10 Sep 2002 23:06:35 -0000 1.21 --- upload.inc.php 22 Sep 2002 23:37:35 -0000 1.22 *************** *** 31,61 **** class Upload extends Item { ! var $fileSize, $mimeType, $hidden; function Upload($name = "", $descr = "", $owner = 0, $addedDate = "", ! $fileSize = 0, $mimeType = "", $hidden = 0, $id = 0) { $this->Item("Upload", $name, $descr, $owner, ! $addedDate == "" ? now() : $addedDate, $id); $this->fileSize = (int)$fileSize; [...464 lines suppressed...] ! $query = "SELECT up.*, ug.name AS `userName` ". ! "FROM Upload up, UserGroup ug ". ! "WHERE ug.id = up.owner ".$search->getExtraWhere()." ". ! $search->getWhere()." $ob ".$search->makeLimit(); $arr = array(); $res = query($query); ! while($row =& db_fetch_assoc($res)) ! $arr[] = $row; return $arr; } ! function isOwner($id, $userid) { ! return parent::isOwner("Upload", $id, $userid); } ! function isSharedId($id, &$user) { ! return parent::isSharedId("Upload", $id, $user); } } Index: upload_list.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/upload_list.phtml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** upload_list.phtml 29 Aug 2002 16:51:34 -0000 1.3 --- upload_list.phtml 22 Sep 2002 23:37:35 -0000 1.4 *************** *** 28,86 **** require_once("search.inc.php"); require_once("searchhtml.inc.php"); verifyAccess(BUA_NONE); $up = new Upload(); ! $err = $up->handleUpload("i_file", false, isset($i_descr) ? $i_descr : ""); $others = isset($i_others) && $i_others ? 1 : 0; - [...242 lines suppressed...] ! "<a href=\"download.phtml/$id.0/$fname\">View</a>]</td>". "<td align=right>".$s["fileSize"]."</td>". "<td>".htmldatetime($s["addedDate"])."</td>". ! "<td>".html($s["userName"])."</td>". ! "<td>".groupAccessCheckbox($s["id"])."</td>". ! "<td>".groupInfo($s, $users)."</td>". ! "<td>".worldInfo($s)."</td>". ! "<td>".html($s["descr"])."</td>". ! "</tr>\n"; } + $cols = count($headerfields) + 1; ! groupAccessFooter($cols, $curUser); ! if(!$others) { ! massDeleteInput($cols, "file", showDelValue() !== 0); } + showDelLinks($cols); ?> </form> Index: user.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/user.inc.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** user.inc.php 20 Sep 2002 18:25:02 -0000 1.13 --- user.inc.php 22 Sep 2002 23:37:35 -0000 1.14 *************** *** 94,107 **** } ! // Returns array with id->name ! function getBrief($removed = 0) { ! $query = "SELECT i.id, i.name FROM UserGroup i ". "WHERE ".db_true()." ". Item::whereRemovedAnd("i", $removed); $res = query($query); $arr = array(); ! while($row =& db_fetch_row($res)) ! $arr[$row[0]] = $row[1]; return $arr; } --- 94,107 ---- } ! // Returns array with id->array(name, removed) ! function getBrief($removed = NULL) { ! $query = "SELECT i.id, i.name, i.removed FROM UserGroup i ". "WHERE ".db_true()." ". Item::whereRemovedAnd("i", $removed); $res = query($query); $arr = array(); ! while($row =& db_fetch_assoc($res)) ! $arr[$row["id"]] = $row; return $arr; } *************** *** 115,118 **** --- 115,122 ---- { return parent::getNameFromId("UserGroup", $id); + } + function getBasicFromId($id) + { + return parent::getBasicFromId("UserGroup", $id); } Index: ware_edit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/ware_edit.phtml,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ware_edit.phtml 20 Sep 2002 18:25:04 -0000 1.9 --- ware_edit.phtml 22 Sep 2002 23:37:35 -0000 1.10 *************** *** 111,115 **** if($err == "") ! $err = handleDelete($ware, $curUser); if($edit) $what = $wareid ? "Edit" : "New"; --- 111,115 ---- if($err == "") ! $err = handleDelete($ware, $curUser, BUA_WARE_EDIT); if($edit) $what = $wareid ? "Edit" : "New"; Index: ware_list.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/ware_list.phtml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ware_list.phtml 20 Sep 2002 18:25:04 -0000 1.8 --- ware_list.phtml 22 Sep 2002 23:37:35 -0000 1.9 *************** *** 48,52 **** // Sharing $users = UserGroup::getBrief(); ! groupAccessHandle($waretype, $users, $curUser); $searchfields = array("Name", "Owner", "Date added"); --- 48,52 ---- // Sharing $users = UserGroup::getBrief(); ! groupAccessHandle($waretype, $curUser); $searchfields = array("Name", "Owner", "Date added"); *************** *** 110,114 **** echo "<tr><td colspan=$cols>$addlink</td></tr>\n"; ! groupAccessFooter($cols, $users, $curUser); showDelLinks($cols); ?> --- 110,114 ---- echo "<tr><td colspan=$cols>$addlink</td></tr>\n"; ! groupAccessFooter($cols, $curUser); showDelLinks($cols); ?> |