root / src / headers.php @ master
Historique | Voir | Annoter | Télécharger (8,05 ko)
1 |
<?php
|
---|---|
2 |
require_once ("connect_entry.php"); |
3 |
?>
|
4 |
<html>
|
5 |
<head>
|
6 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
7 |
<link rel="stylesheet" type="text/css" href="stylesheet.css"> |
8 |
</head>
|
9 |
|
10 |
<body>
|
11 |
<div id="divDebug" style="display: none; font-weight:normal; position:absolute; background-color:#EEEEEE; font-size:xx-small; top:0ex; width:38ex; right:0ex;">toto</div> |
12 |
|
13 |
<div id="sheets"> |
14 |
|
15 |
<h3><?php echo LABNAME; ?> Lab Stocks</h3> |
16 |
|
17 |
<div id="wrapper"> |
18 |
<div id="menu"> |
19 |
<ul>
|
20 |
<li id="home"><span><a href="home.php"> Home </a></span></li> |
21 |
<li id="plasmids"><span><a href="plasmids.php"> Plasmids </a></span></li> |
22 |
<li id="pl_features"><span><a href="pl_features.php"> Plasmids Features </a></span></li> |
23 |
<li id="strains"><span><a href="strains.php"> Strains </a></span></li> |
24 |
<li id="oligos"><span><a href="oligos.php"> Oligos </a></span></li> |
25 |
<li id="antibodies"><span><a href="antibodies.php"> Antibodies </a></span></li> |
26 |
<li id="cl_name"><span><a href="cl_name.php"> Cell Line Names </a></span></li> |
27 |
<li id="cl_passages"><span><a href="cl_passages.php"> Cell Line Passages </a></span></li> |
28 |
<!--li id="cl_storage"><span><a href="cl_storage.php"> Cell Line Storage </a></span></li-->
|
29 |
<li id="rack"><span><a href="rack.php"> Box Manager </a></span></li> |
30 |
<li id="wwwblast"><span><a href="wwwblast.php"> wwwBLAST </a></span></li> |
31 |
<li id="collections"><span><a href="collections.php"> Collections </a></span></li> |
32 |
<li id="pip_stock"><span><a href="pip_stock.php"> Pipets </a></span></li> |
33 |
<li id="pip_history"><span><a href="pip_history.php"> Pipet History </a></span></li> |
34 |
<li id="notebooks"><span><a href="notebooks.php"> Lab's Notebooks </a></span></li> |
35 |
<li id="logout"><span><a href="logout.php"> Logout </a></span></li> |
36 |
<li id="admin"><span><a href="admin.php"> Admin </a></span></li> |
37 |
</ul>
|
38 |
</div>
|
39 |
|
40 |
<div class="sheet"> |
41 |
|
42 |
<script type="text/javascript"> |
43 |
id=window.location.href.split("/").pop().split(".")[0];
|
44 |
document.getElementById("divDebug").innerHTML=id;
|
45 |
document.getElementById(id).setAttribute("class","active");
|
46 |
</script>
|
47 |
|
48 |
|
49 |
<?php
|
50 |
|
51 |
function dump_genotype($strain) { |
52 |
$geno = "<p>$strain->id - General_Background: $strain->General_Background, Genotype: ". |
53 |
"<I>".
|
54 |
"<B>".
|
55 |
$strain->Mating_Type ." ". |
56 |
"</B>" .
|
57 |
$strain->ADE2 ." ". |
58 |
$strain->HIS3 ." ". |
59 |
$strain->LEU2 ." ". |
60 |
$strain->LYS2 ." ". |
61 |
$strain->MET15 ." ". |
62 |
$strain->TRP1 ." ". |
63 |
$strain->URA3 ." ". |
64 |
$strain->HO_ ." ". |
65 |
$strain->locus1 ." ". |
66 |
$strain->locus2 ." ". |
67 |
$strain->locus3 ." ". |
68 |
$strain->locus4 ." ". |
69 |
$strain->locus5 ." ". |
70 |
"</I>".
|
71 |
" [" .
|
72 |
$strain->Cytoplasmic_Character ." ". |
73 |
"] (" .
|
74 |
$strain->extrachromosomal_plasmid ." ". |
75 |
").</p>";
|
76 |
return($geno); |
77 |
} |
78 |
|
79 |
|
80 |
$to_be_post_list_content = ""; |
81 |
$to_be_pre_list_content = ""; |
82 |
// print($_SERVER["SCRIPT_FILENAME"]);
|
83 |
|
84 |
|
85 |
$tb = array_shift(split("\.php", array_pop(split("/", $_SERVER["SCRIPT_FILENAME"])))); |
86 |
/*************************/
|
87 |
//
|
88 |
// Connect to DB and
|
89 |
// handle session/authentification
|
90 |
//
|
91 |
/*************************/
|
92 |
|
93 |
require_once ("lib/session.lib.php"); |
94 |
// connect to DB
|
95 |
$connexion = mysql_pconnect (SERVEUR, NOM, PASSE); |
96 |
if (!$connexion) |
97 |
{ |
98 |
echo "Sorry, connexion to " . SERVEUR . " failed\n"; |
99 |
exit;
|
100 |
} |
101 |
if (!mysql_select_db (BASE, $connexion)) |
102 |
{ |
103 |
echo "Sorry, connexion to database " . BASE . " failed\n"; |
104 |
exit;
|
105 |
} |
106 |
|
107 |
if (!(in_array($tb, array("home", "")))) { |
108 |
// authentification
|
109 |
CleanOldSessions($connexion); |
110 |
$session = control_access ($tb.".php", $_POST, session_id(), $connexion); |
111 |
if (!is_object($session)) { |
112 |
exit;
|
113 |
} |
114 |
|
115 |
// According to login:
|
116 |
// Define priviledge options
|
117 |
// to pass to phpMyEdit
|
118 |
//
|
119 |
//check that visitor is allowed to use this table
|
120 |
if (($tb == "admin" || $tb == "add_box" || $tb == "publish_it") && $session->mode != "super") { |
121 |
echo "<p>Sorry, your session is not granted access to admin panel. Please logout and try again with appropriate login...</p>"; |
122 |
exit;
|
123 |
} else if ($session->target_table != $tb && $session->target_table != "all") { |
124 |
echo "<p>Sorry, your session is not granted access to table <B> $tb </B> in <B>$session->mode</B> mode (login must be <b>$session->mode$tb</b>). Please logout and try again with appropriate login...</p>"; |
125 |
exit;
|
126 |
} |
127 |
//define priv options and display warning accordingly
|
128 |
if ($session->login == "superuser"){ |
129 |
$privopt = 'ACPVDF'; |
130 |
$colorband = "red"; |
131 |
$messageband = '<blink>WARNING</bink>: You are in <I><B> SUPERUSER </I></B> mode, at your own risk.'; |
132 |
} else if ($session->mode == "view"){ |
133 |
$privopt = 'VF'; |
134 |
$colorband = "#00ff00"; |
135 |
$messageband = "You are safely in VIEW mode"; |
136 |
} else if ($session->mode == "add"){ |
137 |
$privopt = 'APVF'; |
138 |
$colorband = "orange"; |
139 |
$messageband = 'You are in <I><B> ADD </I></B> mode, please logout after you additions'; |
140 |
} else if ($session->mode == "edit"){ |
141 |
$privopt = 'ACPVDF'; |
142 |
$colorband = "rgb(250,0,255)"; |
143 |
$messageband = 'IMPORTANT: You are in <I><B> EDIT </I></B> mode, please logout after editing.'; |
144 |
} else{
|
145 |
$privopt = ''; |
146 |
$colorband = "grey"; |
147 |
} |
148 |
echo "<h4 style='background-color: $colorband'> $messageband </h4>"; |
149 |
} |
150 |
// Fix a problem displaying
|
151 |
// symbols (such as delta)
|
152 |
mysql_query("SET NAMES 'UTF8'", $connexion); |
153 |
|
154 |
// // Include My own MVC (FCh.)
|
155 |
// $mvc_filename = $tb . ".MVC.php";
|
156 |
// if (file_exists($mvc_filename)) {
|
157 |
// require($mvc_filename);
|
158 |
// }
|
159 |
|
160 |
// Number of records to display on the screen
|
161 |
// Value of -1 lists all records in a table
|
162 |
$opts['inc'] = 15; |
163 |
|
164 |
// Number of lines to display on multiple selection filters
|
165 |
$opts['multiple'] = '4'; |
166 |
|
167 |
// Navigation style: B - buttons (default), T - text links, G - graphic links
|
168 |
// Buttons position: U - up, D - down (default)
|
169 |
$opts['navigation'] = 'UDBG'; |
170 |
|
171 |
// Display special page elements
|
172 |
$opts['display'] = array( |
173 |
'form' => true, |
174 |
'query' => true, |
175 |
'sort' => true, |
176 |
'time' => true, |
177 |
'tabs' => true |
178 |
); |
179 |
|
180 |
// Set default prefixes for variables
|
181 |
$opts['js']['prefix'] = 'PME_js_'; |
182 |
$opts['dhtml']['prefix'] = 'PME_dhtml_'; |
183 |
$opts['cgi']['prefix']['operation'] = 'PME_op_'; |
184 |
$opts['cgi']['prefix']['sys'] = 'PME_sys_'; |
185 |
$opts['cgi']['prefix']['data'] = 'PME_data_'; |
186 |
|
187 |
/* Get the user's default language and use it if possible or you can
|
188 |
specify particular one you want to use. Refer to official documentation
|
189 |
for list of available languages. */
|
190 |
$opts['language'] = $_SERVER['HTTP_ACCEPT_LANGUAGE'] . '-UTF8'; |
191 |
|
192 |
?>
|
193 |
|
194 |
|
195 |
<div id="pre_list"></div> |
196 |
|
197 |
<?php
|
198 |
|
199 |
// echo "<pre>";
|
200 |
// print_r($_SESSION);
|
201 |
// echo "</pre>";
|
202 |
if (@$_SESSION["tb"] != $tb && $tb != "admin") { |
203 |
unset($_SESSION["action"]); |
204 |
$_SESSION["tb"] = $tb; |
205 |
} |
206 |
// MVC for ADV_SEARCH
|
207 |
if (array_key_exists("action", $_REQUEST)) { |
208 |
if ($_REQUEST["action"] == "ADV_SEARCH") { |
209 |
$_SESSION["action"] = $_REQUEST["action"]; |
210 |
$fltr = ""; |
211 |
$cols = preg_filter("/col_/","", array_keys($_REQUEST)); |
212 |
foreach ($cols as $index) { |
213 |
if ($index != 0) { |
214 |
$fltr .= " " . $_REQUEST["op_$index"]; |
215 |
} |
216 |
if ($_REQUEST["col_$index"] == "Genotype") { |
217 |
$k = $_REQUEST["input_$index"]; |
218 |
$fltr .= " (`locus1` LIKE '%$k%' OR `locus2` LIKE '%$k%' OR `locus3` LIKE '%$k%' OR `locus4` LIKE '%$k%' OR `locus5` LIKE '%$k%' OR `ADE2` LIKE '%$k%' OR `HIS3` LIKE '%$k%' OR `LEU2` LIKE '%$k%' OR `LYS2` LIKE '%$k%' OR `MET15` LIKE '%$k%' OR `TRP1` LIKE '%$k%' OR `URA3` LIKE '%$k%' OR `HO_` LIKE '%$k%' OR `Cytoplasmic_Character` LIKE '%$k%' OR `extrachromosomal_plasmid` LIKE '%$k%')"; |
219 |
} else {
|
220 |
$fltr .= " " . $_REQUEST["col_$index"]; |
221 |
$fltr .= " " . $_REQUEST["cond_$index"]; |
222 |
if ($_REQUEST["cond_$index"] == "LIKE") { |
223 |
$fltr .= " '%" . $_REQUEST["input_$index"] . "%'"; |
224 |
} else {
|
225 |
$fltr .= " '" . $_REQUEST["input_$index"] . "'"; |
226 |
} |
227 |
} |
228 |
} |
229 |
$_SESSION["filters"] = $fltr; |
230 |
} |
231 |
} |
232 |
if (array_key_exists("action", $_SESSION)) { |
233 |
if ($_SESSION["action"] == "ADV_SEARCH") { |
234 |
$opts["filters"] = $_SESSION["filters"]; |
235 |
} |
236 |
} |
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
?>
|