Update of /cvsroot/basedb/basedb/www In directory usw-pr-cvs1:/tmp/cvs-serv31072 Modified Files: bio.inc.php extract_edit.phtml extract_list.phtml htmlinit.phtml hyb.inc.php item.inc.php labeled_edit.phtml labeled_list.phtml misc.inc.php raw_common.inc.php sample_edit.phtml sample_list.phtml search.inc.php Added Files: item_common.inc.php Log Message: First steps towards data hiding. --- NEW FILE: item_common.inc.php --- <? // $Id: item_common.inc.php,v 1.1 2002/09/12 22:37:56 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 // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // Input: Item object or scalar. Output: string denoting deleted item. function remMark(&$obj) { if(is_object($obj)) { if(!$obj->getRemoved()) return ""; } else if(!$obj) return ""; return " <span class=del>(D)</span>"; } // Set $showdel from $i_showdel function showDelPrep() { global $showdel, $i_showdel; $showdel = isset($i_showdel) ? max(-1, min(1, (int)$i_showdel)) : 0; } // Get value to use for $removed in function call function showDelValue() { global $showdel; return $showdel < 0 ? NULL : $showdel; } // Get value for $removed when you want to hide removed items unless // the user is including removed items in the search. function showDelSublist() { global $showdel; return $showdel === 0 ? 0 : NULL; } // Outputs a table row with links to change what to view. Must be in // a form called "ff". $columns is the number of cols in the table. function showDelLinks($columns) { global $showdel; ?> <input type=hidden name=i_showdel value="<?= $showdel ?>"> <script> function showDel(sd) { document.ff.i_showdel.value=sd; document.ff.submit(); } </script> <tr><td colspan=<?= $columns ?> align=right> <a <?= !$showdel ? "class=special" : "" ?> href="javascript:showDel(0)">Undeleted</a> / <a <?= $showdel > 0 ? "class=special" : "" ?> href="javascript:showDel(1)">Deleted</a> / <a <?= $showdel < 0 ? "class=special" : "" ?> href="javascript:showDel(-1)">All</a> </td></tr> <? } ?> Index: bio.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/bio.inc.php,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** bio.inc.php 10 Sep 2002 23:04:50 -0000 1.24 --- bio.inc.php 12 Sep 2002 22:37:56 -0000 1.25 *************** *** 34,45 **** class Sample extends Item { ! var $tissue/*, $project*/; function Sample($name = "", $descr = "", $owner = 0, $addedDate = "", ! $tissue = 0, /*$project = 0,*/ $id = 0, $visible = 0) { ! $this->Item("Sample", $name, $descr, $owner, $addedDate, $id, $visible); $this->tissue = (int)$tissue; ! /* $this->project = (int)$project;*/ [...821 lines suppressed...] + return parent::getBasicFromId("LabeledExtract", $id); + } function countForExtract($extract) *************** *** 769,781 **** { parent::changeQuantityLeft("LabeledExtract", $amount, $id); - } - - function lockId($id, $exclusive) - { - return parent::lockItem("LabeledExtract", $id, $exclusive); - } - function unlockId($id, $exclusive) - { - return parent::unlockItem("LabeledExtract", $id, $exclusive); } --- 795,798 ---- Index: extract_edit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/extract_edit.phtml,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** extract_edit.phtml 10 Sep 2002 23:05:02 -0000 1.14 --- extract_edit.phtml 12 Sep 2002 22:37:56 -0000 1.15 *************** *** 27,30 **** --- 27,31 ---- require_once("protocol.inc.php"); require_once("bio.inc.php"); + require_once("item_common.inc.php"); verifyAccess(BUA_BIO_READ); *************** *** 38,43 **** if($i_ext > 0) { [...271 lines suppressed...] - <tr><th>Usecount</th><td><?= $usecount ?></td></tr> - <tr><td colspan=2><a <?= href("labeled_edit.phtml?i_ext=$extid", 1) - ?>>Label extract</a></td></tr> - </table> <? } ?> --- 315,326 ---- <tr><th>Owner</th><td><?= html($uname) ?></td></tr> <tr><th>Public</th><td><?= $ext->isSharedWith(0) ? "Yes" : "No" ?></td></tr> <? + if(!$ext->getRemoved()) + { + echo "<tr><td colspan=2><a ". + href("labeled_edit.phtml?i_ext=$extid", 1).">". + "Label extract</a></td></tr>\n"; + } + echo "</table>"; } ?> Index: extract_list.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/extract_list.phtml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** extract_list.phtml 5 Aug 2002 11:29:34 -0000 1.11 --- extract_list.phtml 12 Sep 2002 22:37:56 -0000 1.12 *************** *** 30,37 **** require_once("search.inc.php"); require_once("searchhtml.inc.php"); verifyAccess(BUA_BIO_READ); ! $searchfields = array("Name", "Description", "Sample", "User", "Date added", "Extraction date", "Protocol", "Quantity left"); $fieldtype = array(0, 0, 0, 0, 1, 1, 0, 2); --- 30,39 ---- require_once("search.inc.php"); [...86 lines suppressed...] "<td>".$qty."</td>". ! "<td>".LabeledExtract::countForExtract($s["id"]). ! "<a href='labeled_edit.phtml?i_ext=$s[id]'> [new]</a></td>". "<td>".$hybs."</td></tr>\n"; } ! if($addlink != "") echo "<tr><td colspan=9>$addlink</td></tr>\n"; ?> </form> --- 102,112 ---- "<td>".($s["public"] ? "Yes" : "No")."</td>". "<td>".$qty."</td>". ! "<td>".$labs."</td>". "<td>".$hybs."</td></tr>\n"; } ! $cols = 9; ! if($addlink != "") ! echo "<tr><td colspan=$cols>$addlink</td></tr>\n"; ! showDelLinks($cols); ?> </form> Index: htmlinit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/htmlinit.phtml,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** htmlinit.phtml 5 Aug 2002 11:29:34 -0000 1.24 --- htmlinit.phtml 12 Sep 2002 22:37:56 -0000 1.25 *************** *** 42,59 **** if(isset($pageTitle) && $pageTitle != "") echo "<title>".html($pageTitle, 0)."</title>\n"; ?> <meta name=creator content="Typoed by Círdan"> <style type="text/css"> ! a:active { text-decoration: underline; color: #ff5050; } a:link { text-decoration: none; color: #1000d0; } a:visited { text-decoration: none; color: #1000d0; } ! a.ext:active { text-decoration: underline; color: #ff5050; } a.ext:link { text-decoration: none; color: #f00000; } a.ext:visited { text-decoration: none; color: #800000; } ! body { font-family: Helvetica, sans-serif; background-color: #f0f4f4; font-size: <?= $curDisplay->getTextSize("normal") ?>pt; font-weight: normal } ! div { font-family: Helvetica, sans-serif; background-color: #f0f4f4; font-size: <?= $curDisplay->getTextSize("normal") ?>pt; font-weight: normal } td { font-family: Helvetica, sans-serif; font-size: <?= --- 42,61 ---- if(isset($pageTitle) && $pageTitle != "") echo "<title>".html($pageTitle, 0)."</title>\n"; + + $bgColor = "#f0f4f4"; ?> <meta name=creator content="Typoed by Círdan"> <style type="text/css"> ! a:active { text-decoration: none; color: #ff5050; } a:link { text-decoration: none; color: #1000d0; } a:visited { text-decoration: none; color: #1000d0; } ! a.ext:active { text-decoration: none; color: #ff5050; } a.ext:link { text-decoration: none; color: #f00000; } a.ext:visited { text-decoration: none; color: #800000; } ! body { font-family: Helvetica, sans-serif; background-color: <?= $bgColor ?>; font-size: <?= $curDisplay->getTextSize("normal") ?>pt; font-weight: normal } ! div { font-family: Helvetica, sans-serif; background-color: <?= $bgColor ?>; font-size: <?= $curDisplay->getTextSize("normal") ?>pt; font-weight: normal } td { font-family: Helvetica, sans-serif; font-size: <?= *************** *** 74,78 **** .help { font-style: italic } .special { font-weight: bold } ! .pagehead { text-align: left; background-color: #f0f4f4; font-size: <?= $curDisplay->getTextSize("pagehead") ?>pt } .subhead { text-align: left; font-size: <?= --- 76,80 ---- .help { font-style: italic } .special { font-weight: bold } ! .pagehead { text-align: left; background-color: <?= $bgColor ?>; font-size: <?= $curDisplay->getTextSize("pagehead") ?>pt } .subhead { text-align: left; font-size: <?= *************** *** 82,85 **** --- 84,88 ---- font-weight: bold; background-color: #ffe0c0; } .red { color: Red; font-size: <?= $curDisplay->getTextSize("large") ?>pt } + .del { color: #e00050; font-weight: bold } .popup { color: #007010 } .tiny { font-size: <?= $curDisplay->getTextSize("tiny") ?>pt } *************** *** 101,105 **** ?> </head> ! <body bgcolor=#f0f4f4 text=black> <? } --- 104,108 ---- ?> </head> ! <body bgcolor="<?= $bgColor ?>" text=black> <? } Index: hyb.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/hyb.inc.php,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** hyb.inc.php 10 Sep 2002 23:05:10 -0000 1.21 --- hyb.inc.php 12 Sep 2002 22:37:56 -0000 1.22 *************** *** 33,40 **** var $hybridizationDate, $protocol; ! function Hybridization($name = "", $descr = "", $owner = 0, $addedDate = "", ! $hybridizationDate = "", $protocol = 0, $id = 0) { ! $this->Item("Hybridization", $name, $descr, $owner, $addedDate, $id); $this->hybridizationDate = $hybridizationDate; $this->protocol = (int)$protocol; --- 33,42 ---- var $hybridizationDate, $protocol; [...265 lines suppressed...] + return parent::getBasicFromId("Hybridization", $id); + } function isOwner($id, $owner) *************** *** 298,310 **** query($query); return db_affected_rows() > 0; - } - - function lockId($id, $exclusive) - { - return parent::lockItem("Hybridization", $id, $exclusive); - } - function unlockId($id, $exclusive) - { - return parent::unlockItem("Hybridization", $id, $exclusive); } } --- 321,324 ---- Index: item.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/item.inc.php,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** item.inc.php 12 Sep 2002 11:45:26 -0000 1.29 --- item.inc.php 12 Sep 2002 22:37:56 -0000 1.30 *************** *** 67,76 **** } ! function sqlRemoved($table, $removed) { if(isset($removed)) ! return "AND $table.removed == ".(int)(bool)$removed; return ""; } function read($id, $owner = -1, $removed = NULL) [...179 lines suppressed...] $res = query($query); while($row =& db_fetch_row($res)) *************** *** 222,225 **** --- 244,258 ---- else $n = ""; return $n; + } + + // Returns an array with (name,removed,owner) + function getBasicFromId($type, $id) + { + $query = "SELECT name, removed, owner ". + "FROM $type WHERE id = ".(int)$id; + $res = query($query); + if($row =& db_fetch_assoc($res)) + return $row; + return false; } Index: labeled_edit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/labeled_edit.phtml,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** labeled_edit.phtml 10 Sep 2002 23:05:53 -0000 1.14 --- labeled_edit.phtml 12 Sep 2002 22:37:56 -0000 1.15 *************** *** 27,30 **** --- 27,31 ---- require_once("protocol.inc.php"); require_once("bio.inc.php"); + require_once("item_common.inc.php"); verifyAccess(BUA_BIO_READ); *************** *** 47,62 **** { $newlabeled = true; [...261 lines suppressed...] - <tr><th>Usecount</th><td><?= $usecount ?></td></tr> - <tr><td colspan=2><a <?= href("hyb_edit.phtml?i_lext=$lextid", 1) - ?>>Hybridize labeled extract</a></td></tr> - </table> <? } ?> --- 337,348 ---- <tr><th>Owner</th><td><?= html($uname) ?></td></tr> <tr><th>Public</th><td><?= $lext->isSharedWith(0) ? "Yes" : "No" ?></td></tr> <? + if(!$lext->getRemoved()) + { + echo "<tr><td colspan=2><a ". + href("hyb_edit.phtml?i_lext=$lextid", 1).">". + "Hybridize labeled extract</a></td></tr>\n"; + } + echo "</table>"; } ?> Index: labeled_list.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/labeled_list.phtml,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** labeled_list.phtml 29 Aug 2002 16:51:34 -0000 1.12 --- labeled_list.phtml 12 Sep 2002 22:37:56 -0000 1.13 *************** *** 30,35 **** --- 30,37 ---- require_once("search.inc.php"); require_once("searchhtml.inc.php"); + require_once("item_common.inc.php"); verifyAccess(BUA_BIO_READ); + showDelPrep(); $searchfields = array("Name", "Description", "Extract", "Sample", *************** [...83 lines suppressed...] "<td><a href='labeled_edit.phtml?i_lext=$s[id]'>". ! html($s["name"]).remMark($s["removed"])."</a></td>". "<td>".html($s["label"])."</td>". "<td>$elink</td>". *************** *** 103,107 **** "<td>".$hybs."</td></tr>\n"; } ! if($addlink != "") echo "<tr><td colspan=8>$addlink</td></tr>\n"; ?> </form> --- 110,117 ---- "<td>".$hybs."</td></tr>\n"; } ! $cols = 8; ! if($addlink != "") ! echo "<tr><td colspan=$cols>$addlink</td></tr>\n"; ! showDelLinks($cols); ?> </form> Index: misc.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/misc.inc.php,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** misc.inc.php 12 Sep 2002 11:45:26 -0000 1.37 --- misc.inc.php 12 Sep 2002 22:37:56 -0000 1.38 *************** *** 376,378 **** --- 376,379 ---- "href=\"javascript:window.close()\">Close</a>]</span>"; } + ?> Index: raw_common.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/raw_common.inc.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** raw_common.inc.php 10 Sep 2002 23:06:28 -0000 1.18 --- raw_common.inc.php 12 Sep 2002 22:37:56 -0000 1.19 *************** *** 67,71 **** if(isset($i_expgo)) { ! $iua = ignore_user_abort(); $expid = 0; if(isset($i_expname) && $i_expname != "") --- 67,71 ---- if(isset($i_expgo)) { ! $iua = ignore_user_abort(1); $expid = 0; if(isset($i_expname) && $i_expname != "") Index: sample_edit.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/sample_edit.phtml,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** sample_edit.phtml 10 Sep 2002 23:06:29 -0000 1.18 --- sample_edit.phtml 12 Sep 2002 22:37:56 -0000 1.19 *************** *** 29,32 **** --- 29,33 ---- require_once("sampletissue.inc.php"); require_once("sampleannotation.inc.php"); + require_once("item_common.inc.php"); verifyAccess(BUA_BIO_READ); *************** *** 35,53 **** $edit = true; $err = ""; [...305 lines suppressed...] ! <tr><th>Sample date</th><td><?= htmldate($samp->getSampleDate()) ?></td></tr> ! <tr><th>Date added</th><td><?= htmldate($samp->getAddedDate()) ?></td></tr> <tr><th>Owner</th><td><?= html($uname) ?></td></tr> <tr><th>Public</th><td><?= $samp->isSharedWith(0) ? "Yes" : "No" ?></td></tr> <tr><td colspan=2 class=tiny> </td></tr> <tr><th colspan=2 class=subhead>Annotations</th></tr> *************** *** 277,284 **** --- 298,308 ---- "<td>".html($arr["annotation"])."</td></tr>\n"; } + if(!$samp->getRemoved()) + { ?> <tr><td colspan=2><a <?= href("extract_edit.phtml?i_samp=$sampid", 1) ?>>Extract from sample</a></td></tr> <? + } } ?> Index: sample_list.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/sample_list.phtml,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** sample_list.phtml 23 Aug 2002 13:16:11 -0000 1.14 --- sample_list.phtml 12 Sep 2002 22:37:56 -0000 1.15 *************** *** 32,45 **** require_once("search.inc.php"); require_once("searchhtml.inc.php"); verifyAccess(BUA_BIO_READ); $view = isset($i_view) && $i_view ? 1 : 0; ! $searchfields = array("Name", "Description", "User", "Date added"); ! $searchtypes = array(0, 0, 0, 1); if(!$view) [...143 lines suppressed...] ! $anns = SampleAnnotation::getBrieferForSample($s["id"]); ! echo "<tr bgcolor=$tdbg[$odd]>". ! "<td><a href='sample_edit.phtml?i_samp=$s[id]'>". ! html($s["name"])."</a></td>"; ! for(reset($annottypes); list($aid) = each($annottypes); ) ! { ! if(isset($anns[$aid])) ! echo "<td>".html($anns[$aid])."</td>"; ! else echo "<td bgcolor=$tdbg2[$odd]> </td>"; ! } ! echo "</tr>\n"; } } ! if($addlink != "") ! echo "<tr><td colspan=$cols>$addlink</td></tr>\n"; ! showDelLinks($cols); ?> </form> Index: search.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/search.inc.php,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** search.inc.php 11 Sep 2002 10:35:51 -0000 1.41 --- search.inc.php 12 Sep 2002 22:37:56 -0000 1.42 *************** *** 603,607 **** $this->extraWhere[$where[$t]] = 1; } ! else $this->extraWhere[$where] = 1; } function addLeftJoin($lj) --- 603,608 ---- $this->extraWhere[$where[$t]] = 1; } ! else if($where != "") ! $this->extraWhere[$where] = 1; } function addLeftJoin($lj) |