Statistiques
| Branche: | Révision :

root / src / headers.php @ b5a5745e

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