root / src / headers.php @ b5a5745e
Historique | Voir | Annoter | Télécharger (7,38 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 |
$to_be_post_list_content = ""; |
52 |
$to_be_pre_list_content = ""; |
53 |
// print($_SERVER["SCRIPT_FILENAME"]);
|
54 |
|
55 |
|
56 |
$tb = array_shift(split("\.php", array_pop(split("/", $_SERVER["SCRIPT_FILENAME"])))); |
57 |
/*************************/
|
58 |
//
|
59 |
// Connect to DB and
|
60 |
// handle session/authentification
|
61 |
//
|
62 |
/*************************/
|
63 |
|
64 |
require_once ("lib/session.lib.php"); |
65 |
// connect to DB
|
66 |
$connexion = mysql_pconnect (SERVEUR, NOM, PASSE); |
67 |
if (!$connexion) |
68 |
{ |
69 |
echo "Sorry, connexion to " . SERVEUR . " failed\n"; |
70 |
exit;
|
71 |
} |
72 |
if (!mysql_select_db (BASE, $connexion)) |
73 |
{ |
74 |
echo "Sorry, connexion to database " . BASE . " failed\n"; |
75 |
exit;
|
76 |
} |
77 |
|
78 |
if (!(in_array($tb, array("home", "")))) { |
79 |
// authentification
|
80 |
CleanOldSessions($connexion); |
81 |
$session = control_access ($tb.".php", $_POST, session_id(), $connexion); |
82 |
if (!is_object($session)) { |
83 |
exit;
|
84 |
} |
85 |
|
86 |
// According to login:
|
87 |
// Define priviledge options
|
88 |
// to pass to phpMyEdit
|
89 |
//
|
90 |
//check that visitor is allowed to use this table
|
91 |
if ($tb == "admin" && $session->mode != "super") { |
92 |
echo "<p>Sorry, your session is not granted access to admin panel. Please logout and try again with appropriate login...</p>"; |
93 |
exit;
|
94 |
} else if ($session->target_table != $tb && $session->target_table != "all") { |
95 |
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>"; |
96 |
exit;
|
97 |
} |
98 |
//define priv options and display warning accordingly
|
99 |
if ($session->login == "superuser"){ |
100 |
$privopt = 'ACPVDF'; |
101 |
$colorband = "red"; |
102 |
$messageband = '<blink>WARNING</bink>: You are in <I><B> SUPERUSER </I></B> mode, at your own risk.'; |
103 |
} else if ($session->mode == "view"){ |
104 |
$privopt = 'VF'; |
105 |
$colorband = "#00ff00"; |
106 |
$messageband = "You are safely in VIEW mode"; |
107 |
} else if ($session->mode == "add"){ |
108 |
$privopt = 'APVF'; |
109 |
$colorband = "orange"; |
110 |
$messageband = 'You are in <I><B> ADD </I></B> mode, please logout after you additions'; |
111 |
} else if ($session->mode == "edit"){ |
112 |
$privopt = 'ACPVDF'; |
113 |
$colorband = "rgb(250,0,255)"; |
114 |
$messageband = 'IMPORTANT: You are in <I><B> EDIT </I></B> mode, please logout after editing.'; |
115 |
} else{
|
116 |
$privopt = ''; |
117 |
$colorband = "grey"; |
118 |
} |
119 |
echo "<h4 style='background-color: $colorband'> $messageband </h4>"; |
120 |
} |
121 |
// Fix a problem displaying
|
122 |
// symbols (such as delta)
|
123 |
mysql_query("SET NAMES 'UTF8'", $connexion); |
124 |
|
125 |
// // Include My own MVC (FCh.)
|
126 |
// $mvc_filename = $tb . ".MVC.php";
|
127 |
// if (file_exists($mvc_filename)) {
|
128 |
// require($mvc_filename);
|
129 |
// }
|
130 |
|
131 |
// Number of records to display on the screen
|
132 |
// Value of -1 lists all records in a table
|
133 |
$opts['inc'] = 15; |
134 |
|
135 |
// Number of lines to display on multiple selection filters
|
136 |
$opts['multiple'] = '4'; |
137 |
|
138 |
// Navigation style: B - buttons (default), T - text links, G - graphic links
|
139 |
// Buttons position: U - up, D - down (default)
|
140 |
$opts['navigation'] = 'UDBG'; |
141 |
|
142 |
// Display special page elements
|
143 |
$opts['display'] = array( |
144 |
'form' => true, |
145 |
'query' => true, |
146 |
'sort' => true, |
147 |
'time' => true, |
148 |
'tabs' => true |
149 |
); |
150 |
|
151 |
// Set default prefixes for variables
|
152 |
$opts['js']['prefix'] = 'PME_js_'; |
153 |
$opts['dhtml']['prefix'] = 'PME_dhtml_'; |
154 |
$opts['cgi']['prefix']['operation'] = 'PME_op_'; |
155 |
$opts['cgi']['prefix']['sys'] = 'PME_sys_'; |
156 |
$opts['cgi']['prefix']['data'] = 'PME_data_'; |
157 |
|
158 |
/* Get the user's default language and use it if possible or you can
|
159 |
specify particular one you want to use. Refer to official documentation
|
160 |
for list of available languages. */
|
161 |
$opts['language'] = $_SERVER['HTTP_ACCEPT_LANGUAGE'] . '-UTF8'; |
162 |
|
163 |
?>
|
164 |
|
165 |
|
166 |
<div id="pre_list"></div> |
167 |
|
168 |
<?php
|
169 |
|
170 |
// echo "<pre>";
|
171 |
// print_r($_SESSION);
|
172 |
// echo "</pre>";
|
173 |
if (@$_SESSION["tb"] != $tb) { |
174 |
unset($_SESSION["action"]); |
175 |
$_SESSION["tb"] = $tb; |
176 |
} |
177 |
// MVC for ADV_SEARCH
|
178 |
if (array_key_exists("action", $_REQUEST)) { |
179 |
if ($_REQUEST["action"] == "ADV_SEARCH") { |
180 |
$_SESSION["action"] = $_REQUEST["action"]; |
181 |
$fltr = ""; |
182 |
$cols = preg_filter("/col_/","", array_keys($_REQUEST)); |
183 |
foreach ($cols as $index) { |
184 |
if ($index != 0) { |
185 |
$fltr .= " " . $_REQUEST["op_$index"]; |
186 |
} |
187 |
if ($_REQUEST["col_$index"] == "Genotype") { |
188 |
$k = $_REQUEST["input_$index"]; |
189 |
$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%')"; |
190 |
} else {
|
191 |
$fltr .= " " . $_REQUEST["col_$index"]; |
192 |
$fltr .= " " . $_REQUEST["cond_$index"]; |
193 |
if ($_REQUEST["cond_$index"] == "LIKE") { |
194 |
$fltr .= " '%" . $_REQUEST["input_$index"] . "%'"; |
195 |
} else {
|
196 |
$fltr .= " '" . $_REQUEST["input_$index"] . "'"; |
197 |
} |
198 |
} |
199 |
} |
200 |
$_SESSION["filters"] = $fltr; |
201 |
} |
202 |
} |
203 |
if (array_key_exists("action", $_SESSION)) { |
204 |
if ($_SESSION["action"] == "ADV_SEARCH") { |
205 |
$opts["filters"] = $_SESSION["filters"]; |
206 |
} |
207 |
} |
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 |
?>
|