Statistiques
| Branche: | Révision :

root / src / headers.php @ a9b72d88

Historique | Voir | Annoter | Télécharger (8,05 ko)

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