Statistiques
| Branche: | Révision :

root / src / headers.php @ 49db860c

Historique | Voir | Annoter | Télécharger (8,01 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->Name_ 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
         ")" .
76
         "</p>"; 
77
  return($geno);
78
} 
79

    
80

    
81
$to_be_post_list_content = "";
82
$to_be_pre_list_content = "";
83
// print($_SERVER["SCRIPT_FILENAME"]);
84

    
85

    
86
$tb = array_shift(split("\.php", array_pop(split("/", $_SERVER["SCRIPT_FILENAME"]))));
87
/*************************/
88
//
89
// Connect to DB and 
90
// handle session/authentification
91
//
92
/*************************/
93

    
94
require_once ("lib/session.lib.php");
95
// connect to DB
96
$connexion = mysql_pconnect (SERVEUR, NOM, PASSE);
97
if (!$connexion)
98
{
99
 echo "Sorry, connexion to " . SERVEUR . " failed\n";
100
 exit;
101
}
102
if (!mysql_select_db (BASE, $connexion))
103
{
104
 echo "Sorry, connexion to database " . BASE . " failed\n";
105
 exit;
106
}
107

    
108
if (!(in_array($tb, array("home", "")))) {
109
  // authentification
110
  CleanOldSessions($connexion);
111
  $session = control_access ($tb.".php", $_POST, session_id(), $connexion);
112
  if (!is_object($session)) {
113
          exit;
114
  }
115

    
116
  // According to login:
117
  // Define priviledge options
118
  // to pass to phpMyEdit
119
  //
120
  //check that visitor is allowed to use this table
121
  if (($tb == "admin" || $tb == "add_box" || $tb == "publish_it") && $session->mode != "super") {
122
    echo "<p>Sorry, your session is not granted access to admin panel. Please logout and try again with appropriate login...</p>";
123
    exit;
124
  } else if ($session->target_table != $tb && $session->target_table != "all") {
125
    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>";
126
    exit;
127
  }
128
  //define priv options and display warning accordingly
129
  if ($session->login == "superuser"){
130
          $privopt = 'ACPVDF';
131
          $colorband = "red";
132
          $messageband = '<blink>WARNING</bink>: You are in <I><B> SUPERUSER </I></B> mode, at your own risk.';
133
  } else if ($session->mode == "view"){
134
          $privopt = 'VF';
135
          $colorband = "#00ff00";
136
          $messageband = "You are safely in VIEW mode";
137
  } else if ($session->mode == "add"){
138
          $privopt = 'APVF';
139
          $colorband = "orange";
140
          $messageband = 'You are in <I><B> ADD </I></B> mode, please logout after you additions';
141
  } else if ($session->mode == "edit"){
142
          $privopt = 'ACPVDF';
143
          $colorband = "rgb(250,0,255)";
144
          $messageband = 'IMPORTANT: You are in <I><B> EDIT </I></B> mode, please logout after editing.';
145
  } else{
146
          $privopt = '';
147
          $colorband = "grey";
148
  }
149
  echo "<h4 style='background-color: $colorband'> $messageband </h4>";
150
}
151
// Fix a problem displaying
152
// symbols (such as delta)
153
mysql_query("SET NAMES 'UTF8'", $connexion);
154

    
155
// // Include My own MVC (FCh.)
156
// $mvc_filename = $tb . ".MVC.php";
157
// if (file_exists($mvc_filename)) {
158
//   require($mvc_filename);
159
// } 
160

    
161
// Number of records to display on the screen
162
// Value of -1 lists all records in a table
163
$opts['inc'] = 15;
164

    
165
// Number of lines to display on multiple selection filters
166
$opts['multiple'] = '4';
167

    
168
// Navigation style: B - buttons (default), T - text links, G - graphic links
169
// Buttons position: U - up, D - down (default)
170
$opts['navigation'] = 'UDBG';
171

    
172
// Display special page elements
173
$opts['display'] = array(
174
        'form'  => true,
175
        'query' => true,
176
        'sort'  => true,
177
        'time'  => true,
178
        'tabs'  => true
179
);
180

    
181
// Set default prefixes for variables
182
$opts['js']['prefix']               = 'PME_js_';
183
$opts['dhtml']['prefix']            = 'PME_dhtml_';
184
$opts['cgi']['prefix']['operation'] = 'PME_op_';
185
$opts['cgi']['prefix']['sys']       = 'PME_sys_';
186
$opts['cgi']['prefix']['data']      = 'PME_data_';
187

    
188
/* Get the user's default language and use it if possible or you can
189
   specify particular one you want to use. Refer to official documentation
190
   for list of available languages. */
191
$opts['language'] = $_SERVER['HTTP_ACCEPT_LANGUAGE'] . '-UTF8';
192

    
193
?>
194

    
195

    
196
<div id="pre_list"></div>
197

    
198
<?php
199

    
200
// echo "<pre>";
201
// print_r($_SESSION);
202
// echo "</pre>";
203
if (@$_SESSION["tb"] != $tb && $tb != "admin") {
204
  unset($_SESSION["action"]);
205
  $_SESSION["tb"] = $tb;   
206
}
207
// MVC for ADV_SEARCH
208
if (array_key_exists("action", $_REQUEST)) {
209
  if ($_REQUEST["action"] == "ADV_SEARCH") {
210
    $_SESSION["action"] = $_REQUEST["action"];
211
    $fltr = "";
212
    $cols = preg_filter("/col_/","", array_keys($_REQUEST));
213
    foreach ($cols as $index) {
214
      if ($index != 0) {
215
        $fltr .= " " . $_REQUEST["op_$index"];
216
      }
217
      if ($_REQUEST["col_$index"] == "Genotype") {
218
        $k = $_REQUEST["input_$index"];
219
        $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%')";
220
      } else {
221
        $fltr .= " " . $_REQUEST["col_$index"];
222
        $fltr .= " " . $_REQUEST["cond_$index"];
223
        if ($_REQUEST["cond_$index"] == "LIKE") {
224
          $fltr .= " '%" . $_REQUEST["input_$index"] . "%'";                    
225
        } else {
226
          $fltr .= " '" . $_REQUEST["input_$index"] . "'";          
227
        }
228
      }
229
    }
230
    $_SESSION["filters"] = $fltr;    
231
  }
232
}
233
if (array_key_exists("action", $_SESSION)) {
234
  if ($_SESSION["action"] == "ADV_SEARCH") {
235
    $opts["filters"] = $_SESSION["filters"];
236
  }
237
}
238

    
239

    
240

    
241

    
242

    
243

    
244
?>