commit 7c18e02a92fa092d61a4b98fe6db6a5037bdb6f8
Author: Florent Chuffart <florent.chuffart@ens-lyon.fr>
Date:   Fri Feb 21 11:14:26 2014 +0100

    Updating documentation and add files

diff --git a/README b/README
index 39c3ce6..8ad6497 100644
--- a/README
+++ b/README
@@ -296,8 +296,8 @@ How To Restore System From Backup
 
 On the targeted server, you can restore database from the last backup
 (file ''labstocks_db.sql'') by typing the following command in a
-terminal. It drops existing tables, creates new one and restore data.
-You have to adapt user password and database name according to your
+terminal. It drops existing tables, creates new one and restores data.
+You have to adapt user, password and database name according to your
 setting.
 
    sudo mysql --user=root --password=root labstocks_db < labstocks_db.sql
@@ -313,14 +313,13 @@ terminal.
 Extend Database
 ---------------
 
-MyLabstock is delivrer under a free licence. Feel free to modify and
+MyLabstock is delivered under a free licence. Feel free to modify and
 extend it as to adapt it to your your own lab. To do that you could
 easily create new table using phpMyAdmin
-(http://your_server/phpmyadmin)
-http://http://your_server/yourserver)ou mysql command line tool
-(documentation here
+(http://your_server/phpmyadmin) http://http://your_server/yourserver)
+or mysql command line tool (documentation here
 http://dev.mysql.com/doc/refman/5.6/en/mysql.html). MyLabStocks uses
-the  framework phpMyEdit to manaeg the user interface. Use the
+the  framework phpMyEdit to manage the user interface. Use the
 provided tool http://your_server/phpMyEditSetup.php to generate code.
-For any question please refer to the embeded documention
+For any question please refer to the phpMyEdit embedded documentation
 (http://your_server/labstocks/doc/html/).
diff --git a/doc/conf.py b/doc/conf.py
index c48e179..85034a4 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -50,9 +50,9 @@ copyright = u' since 2007, Florent CHUFFART, Gael YVERT'
 # built documents.
 #
 # The short X.Y version.
-version = '0.1.4'
+version = '0.1.6'
 # The full version, including alpha/beta/rc tags.
-release = '0.1.4'
+release = '0.1.6'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/doc/index.rst b/doc/index.rst
index f46fed9..6fabb45 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -240,10 +240,12 @@ Backing up the Mysql Database and Stored Files
 
 We HIGHLY RECOMMEND THAT YOU REGULARLY BACKUP you MyLabStocks database. We provide two levels of backup. The first only dump the mySQL database and the second also add the uploaded files (plasmid_files raw_dirs directories in your /var/www/labstocks directory). These two features are available on the *home* page. The two links in the sentence *Backup the entire system or only the database NOW!* allow any user to download the requested backups. It could be useful for an administrator to integrate it in a robust file backup system using for example a cron that regularly pull the archives (*wget http://.../labstocks/backup.php?FULL_BACK=1*). 
 
+
+
 How To Restore System From Backup
 ---------------------------------
 
-On the targeted server, you can restore database from the last backup (file ''labstocks_db.sql'') by typing the following command in a terminal. It drops existing tables, creates new one and restore data. You have to adapt user password and database name according to your setting.
+On the targeted server, you can restore database from the last backup (file ''labstocks_db.sql'') by typing the following command in a terminal. It drops existing tables, creates new one and restores data. You have to adapt user, password and database name according to your setting.
 
 .. code:: bash
 
@@ -262,5 +264,5 @@ To restore uploaded file, you have to copy backuped directories (''plasmid_files
 Extend Database
 ---------------
 
-MyLabstock is delivrer under a free licence. Feel free to modify and extend it as to adapt it to your your own lab. To do that you could easily create new table using phpMyAdmin (http://your_server/phpmyadmin) http://http://your_server/yourserver)ou mysql command line tool (documentation here http://dev.mysql.com/doc/refman/5.6/en/mysql.html). MyLabStocks uses the  framework phpMyEdit to manaeg the user interface. Use the provided tool http://your_server/phpMyEditSetup.php to generate code. For any question please refer to the embeded documention (http://your_server/labstocks/doc/html/).
+MyLabstock is delivered under a free licence. Feel free to modify and extend it as to adapt it to your your own lab. To do that you could easily create new table using phpMyAdmin (http://your_server/phpmyadmin) http://http://your_server/yourserver) or mysql command line tool (documentation here http://dev.mysql.com/doc/refman/5.6/en/mysql.html). MyLabStocks uses the  framework phpMyEdit to manage the user interface. Use the provided tool http://your_server/phpMyEditSetup.php to generate code. For any question please refer to the phpMyEdit embedded documentation (http://your_server/labstocks/doc/html/).
 
diff --git a/src/cl_name.php b/src/cl_name.php
new file mode 100644
index 0000000..0f80978
--- /dev/null
+++ b/src/cl_name.php
@@ -0,0 +1,161 @@
+<?php
+session_start ();
+require("headers.php");
+
+/*
+ * IMPORTANT NOTE: This generated file contains only a subset of huge amount
+ * of options that can be used with phpMyEdit. To get information about all
+ * features offered by phpMyEdit, check official documentation. It is available
+ * online and also for download on phpMyEdit project management page:
+ *
+ * http://platon.sk/projects/main_page.php?project_id=5
+ *
+ * This file was generated by:
+ *
+ *                    phpMyEdit version: unknown
+ *       phpMyEdit.class.php core class: 1.204
+ *            phpMyEditSetup.php script: 1.50
+ *              generating setup script: 1.50
+ */
+
+
+/*************************/
+//
+// Pass phpMyEdit options
+//
+/*************************/
+
+
+$opts['dbh'] = $connexion;
+$opts['tb'] = $tb;
+
+// Name of field which is the unique key
+$opts['key'] = 'ID';
+
+// Type of key field (int/real/string/date etc.)
+$opts['key_type'] = 'int';
+
+// Sorting field(s)
+$opts['sort_field'] = array('ID');
+
+// Number of records to display on the screen
+// Value of -1 lists all records in a table
+$opts['inc'] = 15;
+
+// Options you wish to give the users
+// A - add,  C - change, P - copy, V - view, D - delete,
+// F - filter, I - initial sort suppressed
+$opts['options'] = $privopt;
+
+// Number of lines to display on multiple selection filters
+$opts['multiple'] = '4';
+
+// Navigation style: B - buttons (default), T - text links, G - graphic links
+// Buttons position: U - up, D - down (default)
+$opts['navigation'] = 'UDBG';
+
+// Display special page elements
+$opts['display'] = array(
+	'form'  => true,
+	'query' => true,
+	'sort'  => true,
+	'time'  => true,
+	'tabs'  => true
+);
+
+// Set default prefixes for variables
+$opts['js']['prefix']               = 'PME_js_';
+$opts['dhtml']['prefix']            = 'PME_dhtml_';
+$opts['cgi']['prefix']['operation'] = 'PME_op_';
+$opts['cgi']['prefix']['sys']       = 'PME_sys_';
+$opts['cgi']['prefix']['data']      = 'PME_data_';
+
+/* Get the user's default language and use it if possible or you can
+   specify particular one you want to use. Refer to official documentation
+   for list of available languages. */
+$opts['language'] = $_SERVER['HTTP_ACCEPT_LANGUAGE'] . '-UTF8';
+
+/* Table-level filter capability. If set, it is included in the WHERE clause
+   of any generated SELECT statement in SQL query. This gives you ability to
+   work only with subset of data from table.
+
+$opts['filters'] = "column1 like '%11%' AND column2<17";
+$opts['filters'] = "section_id = 9";
+$opts['filters'] = "PMEtable0.sessions_count > 200";
+*/
+
+/* Field definitions
+   
+Fields will be displayed left to right on the screen in the order in which they
+appear in generated list. Here are some most used field options documented.
+
+['name'] is the title used for column headings, etc.;
+['maxlen'] maximum length to display add/edit/search input boxes
+['trimlen'] maximum length of string content to display in row listing
+['width'] is an optional display width specification for the column
+          e.g.  ['width'] = '100px';
+['mask'] a string that is used by sprintf() to format field output
+['sort'] true or false; means the users may sort the display on this column
+['strip_tags'] true or false; whether to strip tags from content
+['nowrap'] true or false; whether this field should get a NOWRAP
+['select'] T - text, N - numeric, D - drop-down, M - multiple selection
+['options'] optional parameter to control whether a field is displayed
+  L - list, F - filter, A - add, C - change, P - copy, D - delete, V - view
+            Another flags are:
+            R - indicates that a field is read only
+            W - indicates that a field is a password field
+            H - indicates that a field is to be hidden and marked as hidden
+['URL'] is used to make a field 'clickable' in the display
+        e.g.: 'mailto:$value', 'http://$value' or '$page?stuff';
+['URLtarget']  HTML target link specification (for example: _blank)
+['textarea']['rows'] and/or ['textarea']['cols']
+  specifies a textarea is to be used to give multi-line input
+  e.g. ['textarea']['rows'] = 5; ['textarea']['cols'] = 10
+['values'] restricts user input to the specified constants,
+           e.g. ['values'] = array('A','B','C') or ['values'] = range(1,99)
+['values']['table'] and ['values']['column'] restricts user input
+  to the values found in the specified column of another table
+['values']['description'] = 'desc_column'
+  The optional ['values']['description'] field allows the value(s) displayed
+  to the user to be different to those in the ['values']['column'] field.
+  This is useful for giving more meaning to column values. Multiple
+  descriptions fields are also possible. Check documentation for this.
+*/
+
+
+$opts['fdd']['name'] = array(
+  'name'     => 'Name',
+  'select'   => 'T',
+  'maxlen'   => 100,
+  'sort'     => true
+);
+$opts['fdd']['description'] = array(
+  'name'     => 'Description',
+  'select'   => 'T',
+  'maxlen'   => 4294967295,
+  'textarea' => array(
+    'rows' => 5,
+    'cols' => 50),
+  'sort'     => true
+);
+$opts['fdd']['origin'] = array(
+  'name'     => 'Origin',
+  'select'   => 'T',
+  'maxlen'   => 4294967295,
+  'textarea' => array(
+    'rows' => 5,
+    'cols' => 50),
+  'sort'     => true
+);
+$opts['fdd']['type'] = array(
+  'name'     => 'Type',
+  'select'   => 'D',
+  'values'   => array(
+  	'table'  => 'cl_type',
+	'column' => 'type'),
+  'maxlen'   => 100,
+  'sort'     => true
+);
+
+require("footers.php");
+?>
diff --git a/src/cl_passages.php b/src/cl_passages.php
new file mode 100644
index 0000000..64347a9
--- /dev/null
+++ b/src/cl_passages.php
@@ -0,0 +1,183 @@
+<?php
+session_start ();
+require("headers.php");
+
+/*
+ * IMPORTANT NOTE: This generated file contains only a subset of huge amount
+ * of options that can be used with phpMyEdit. To get information about all
+ * features offered by phpMyEdit, check official documentation. It is available
+ * online and also for download on phpMyEdit project management page:
+ *
+ * http://platon.sk/projects/main_page.php?project_id=5
+ *
+ * This file was generated by:
+ *
+ *                    phpMyEdit version: unknown
+ *       phpMyEdit.class.php core class: 1.204
+ *            phpMyEditSetup.php script: 1.50
+ *              generating setup script: 1.50
+ */
+
+
+/*************************/
+//
+// Pass phpMyEdit options
+//
+/*************************/
+
+
+$opts['dbh'] = $connexion;
+$opts['tb'] = $tb;
+
+// Name of field which is the unique key
+$opts['key'] = 'ID';
+
+// Type of key field (int/real/string/date etc.)
+$opts['key_type'] = 'int';
+
+// Sorting field(s)
+$opts['sort_field'] = array('ID');
+
+// Number of records to display on the screen
+// Value of -1 lists all records in a table
+$opts['inc'] = 15;
+
+// Options you wish to give the users
+// A - add,  C - change, P - copy, V - view, D - delete,
+// F - filter, I - initial sort suppressed
+$opts['options'] = $privopt;
+
+// Number of lines to display on multiple selection filters
+$opts['multiple'] = '4';
+
+// Navigation style: B - buttons (default), T - text links, G - graphic links
+// Buttons position: U - up, D - down (default)
+$opts['navigation'] = 'UDBG';
+
+// Display special page elements
+$opts['display'] = array(
+	'form'  => true,
+	'query' => true,
+	'sort'  => true,
+	'time'  => true,
+	'tabs'  => true
+);
+
+// Set default prefixes for variables
+$opts['js']['prefix']               = 'PME_js_';
+$opts['dhtml']['prefix']            = 'PME_dhtml_';
+$opts['cgi']['prefix']['operation'] = 'PME_op_';
+$opts['cgi']['prefix']['sys']       = 'PME_sys_';
+$opts['cgi']['prefix']['data']      = 'PME_data_';
+
+/* Get the user's default language and use it if possible or you can
+   specify particular one you want to use. Refer to official documentation
+   for list of available languages. */
+$opts['language'] = $_SERVER['HTTP_ACCEPT_LANGUAGE'] . '-UTF8';
+
+/* Table-level filter capability. If set, it is included in the WHERE clause
+   of any generated SELECT statement in SQL query. This gives you ability to
+   work only with subset of data from table.
+
+$opts['filters'] = "column1 like '%11%' AND column2<17";
+$opts['filters'] = "section_id = 9";
+$opts['filters'] = "PMEtable0.sessions_count > 200";
+*/
+
+/* Field definitions
+   
+Fields will be displayed left to right on the screen in the order in which they
+appear in generated list. Here are some most used field options documented.
+
+['name'] is the title used for column headings, etc.;
+['maxlen'] maximum length to display add/edit/search input boxes
+['trimlen'] maximum length of string content to display in row listing
+['width'] is an optional display width specification for the column
+          e.g.  ['width'] = '100px';
+['mask'] a string that is used by sprintf() to format field output
+['sort'] true or false; means the users may sort the display on this column
+['strip_tags'] true or false; whether to strip tags from content
+['nowrap'] true or false; whether this field should get a NOWRAP
+['select'] T - text, N - numeric, D - drop-down, M - multiple selection
+['options'] optional parameter to control whether a field is displayed
+  L - list, F - filter, A - add, C - change, P - copy, D - delete, V - view
+            Another flags are:
+            R - indicates that a field is read only
+            W - indicates that a field is a password field
+            H - indicates that a field is to be hidden and marked as hidden
+['URL'] is used to make a field 'clickable' in the display
+        e.g.: 'mailto:$value', 'http://$value' or '$page?stuff';
+['URLtarget']  HTML target link specification (for example: _blank)
+['textarea']['rows'] and/or ['textarea']['cols']
+  specifies a textarea is to be used to give multi-line input
+  e.g. ['textarea']['rows'] = 5; ['textarea']['cols'] = 10
+['values'] restricts user input to the specified constants,
+           e.g. ['values'] = array('A','B','C') or ['values'] = range(1,99)
+['values']['table'] and ['values']['column'] restricts user input
+  to the values found in the specified column of another table
+['values']['description'] = 'desc_column'
+  The optional ['values']['description'] field allows the value(s) displayed
+  to the user to be different to those in the ['values']['column'] field.
+  This is useful for giving more meaning to column values. Multiple
+  descriptions fields are also possible. Check documentation for this.
+*/
+
+
+$opts['fdd']['ID'] = array(
+  'name'     => 'ID',
+  'select'   => 'T',
+  'options'  => 'AVCPDRL', // auto increment
+  'maxlen'   => 15,
+  'default'  => '0',
+  'sort'     => true
+);
+$opts['fdd']['name'] = array(
+  'name'     => 'Name',
+  'select'   => 'D',
+  'maxlen'   => 30,
+  //'default'  => '0',
+  'values'   => array(
+  	'table'  => 'cl_name',
+	'column' => 'name'),
+  'sort'     => true
+);
+
+// $opts['multiple'] = '4';
+// $opts['fdd']['cl_storage'] = array(
+//   'name'     => 'Liquid N2 storage',
+//   'select'   => 'C',
+//   'maxlen'   => 30,
+//   //'default'  => '0',
+//   'values'   => array(
+//     'table'  => 'cl_storage',
+//     'column' => 'id',
+//     'description' => array(
+//       'columns' => array("container", "rack", "box", "field") 
+//       // 'divs' = > array('.') 
+//     )      
+//   ),
+//   'sort'     => true
+// );
+// 
+// $opts['fdd']['cl_storage']['values']['description']['divs'][0] = ".";
+// $opts['fdd']['cl_storage']['values']['description']['divs'][1] = ".";
+// $opts['fdd']['cl_storage']['values']['description']['divs'][2] = ".";
+  
+$opts['fdd']['passage'] = array(
+  'name'     => 'Passage',
+  'select'   => 'T',
+  'maxlen'   => 4294967295,
+  'textarea' => array(
+    'rows' => 5,
+    'cols' => 50),
+  'sort'     => true
+);
+$opts['fdd']['date_of_freezing'] = array(
+  'name'     => 'Date of freezing',
+  'select'   => 'T',
+  'maxlen'   => 10,
+  'sort'     => true
+);
+
+require("footers.php");
+?>
diff --git a/src/cl_storage.php b/src/cl_storage.php
new file mode 100644
index 0000000..1d24f77
--- /dev/null
+++ b/src/cl_storage.php
@@ -0,0 +1,180 @@
+<?php
+session_start ();
+require("headers.php");
+
+/*
+ * IMPORTANT NOTE: This generated file contains only a subset of huge amount
+ * of options that can be used with phpMyEdit. To get information about all
+ * features offered by phpMyEdit, check official documentation. It is available
+ * online and also for download on phpMyEdit project management page:
+ *
+ * http://platon.sk/projects/main_page.php?project_id=5
+ *
+ * This file was generated by:
+ *
+ *                    phpMyEdit version: unknown
+ *       phpMyEdit.class.php core class: 1.204
+ *            phpMyEditSetup.php script: 1.50
+ *              generating setup script: 1.50
+ */
+
+
+/*************************/
+//
+// Pass phpMyEdit options
+//
+/*************************/
+
+
+$opts['dbh'] = $connexion;
+$opts['tb'] = $tb;
+
+// Name of field which is the unique key
+$opts['key'] = 'ID';
+
+// Type of key field (int/real/string/date etc.)
+$opts['key_type'] = 'int';
+
+// Sorting field(s)
+$opts['sort_field'] = array('ID');
+
+// Number of records to display on the screen
+// Value of -1 lists all records in a table
+$opts['inc'] = 15;
+
+// Options you wish to give the users
+// A - add,  C - change, P - copy, V - view, D - delete,
+// F - filter, I - initial sort suppressed
+$opts['options'] = $privopt;
+
+// Number of lines to display on multiple selection filters
+$opts['multiple'] = '4';
+
+// Navigation style: B - buttons (default), T - text links, G - graphic links
+// Buttons position: U - up, D - down (default)
+$opts['navigation'] = 'UDBG';
+
+// Display special page elements
+$opts['display'] = array(
+	'form'  => true,
+	'query' => true,
+	'sort'  => true,
+	'time'  => true,
+	'tabs'  => true
+);
+
+// Set default prefixes for variables
+$opts['js']['prefix']               = 'PME_js_';
+$opts['dhtml']['prefix']            = 'PME_dhtml_';
+$opts['cgi']['prefix']['operation'] = 'PME_op_';
+$opts['cgi']['prefix']['sys']       = 'PME_sys_';
+$opts['cgi']['prefix']['data']      = 'PME_data_';
+
+/* Get the user's default language and use it if possible or you can
+   specify particular one you want to use. Refer to official documentation
+   for list of available languages. */
+$opts['language'] = $_SERVER['HTTP_ACCEPT_LANGUAGE'] . '-UTF8';
+
+/* Table-level filter capability. If set, it is included in the WHERE clause
+   of any generated SELECT statement in SQL query. This gives you ability to
+   work only with subset of data from table.
+
+$opts['filters'] = "column1 like '%11%' AND column2<17";
+$opts['filters'] = "section_id = 9";
+$opts['filters'] = "PMEtable0.sessions_count > 200";
+*/
+
+/* Field definitions
+   
+Fields will be displayed left to right on the screen in the order in which they
+appear in generated list. Here are some most used field options documented.
+
+['name'] is the title used for column headings, etc.;
+['maxlen'] maximum length to display add/edit/search input boxes
+['trimlen'] maximum length of string content to display in row listing
+['width'] is an optional display width specification for the column
+          e.g.  ['width'] = '100px';
+['mask'] a string that is used by sprintf() to format field output
+['sort'] true or false; means the users may sort the display on this column
+['strip_tags'] true or false; whether to strip tags from content
+['nowrap'] true or false; whether this field should get a NOWRAP
+['select'] T - text, N - numeric, D - drop-down, M - multiple selection
+['options'] optional parameter to control whether a field is displayed
+  L - list, F - filter, A - add, C - change, P - copy, D - delete, V - view
+            Another flags are:
+            R - indicates that a field is read only
+            W - indicates that a field is a password field
+            H - indicates that a field is to be hidden and marked as hidden
+['URL'] is used to make a field 'clickable' in the display
+        e.g.: 'mailto:$value', 'http://$value' or '$page?stuff';
+['URLtarget']  HTML target link specification (for example: _blank)
+['textarea']['rows'] and/or ['textarea']['cols']
+  specifies a textarea is to be used to give multi-line input
+  e.g. ['textarea']['rows'] = 5; ['textarea']['cols'] = 10
+['values'] restricts user input to the specified constants,
+           e.g. ['values'] = array('A','B','C') or ['values'] = range(1,99)
+['values']['table'] and ['values']['column'] restricts user input
+  to the values found in the specified column of another table
+['values']['description'] = 'desc_column'
+  The optional ['values']['description'] field allows the value(s) displayed
+  to the user to be different to those in the ['values']['column'] field.
+  This is useful for giving more meaning to column values. Multiple
+  descriptions fields are also possible. Check documentation for this.
+*/
+
+
+
+$opts['fdd']['ID'] = array(
+  'name'     => 'ID',
+  'select'   => 'T',
+  'options'  => 'AVCPDR', // auto increment
+  'maxlen'   => 15,
+  'default'  => '0',
+  'sort'     => true
+);
+$opts['fdd']['container'] = array(
+  'name'     => 'Container',
+  'options'  => 'LFACPDVR',
+  'select'   => 'T',
+  'maxlen'   => 50,
+  'sort'     => true
+);
+$opts['fdd']['rack'] = array(
+  'name'     => 'Rack',
+  'options'  => 'LFACPDVR',
+  'select'   => 'T',
+  'maxlen'   => 50,
+  'sort'     => true
+);
+$opts['fdd']['box'] = array(
+  'name'     => 'Box',
+  'options'  => 'LFACPDVR',
+  'select'   => 'T',
+  'maxlen'   => 50,
+  'sort'     => true
+);
+$opts['fdd']['field'] = array(
+  'name'     => 'Field',
+  'options'  => 'LFACPDVR',
+  'select'   => 'T',
+  'maxlen'   => 50,
+  'sort'     => true
+);
+$opts['fdd']['cl_passages'] = array(
+  'name'     => 'Passage',
+  'select'   => 'D',
+  'maxlen'   => 50,
+  'sort'     => true, 
+  'values'   => array(
+    'table'  => 'cl_passages',
+    'column' => 'ID',
+    'description' => array(
+      'columns' => array("name", "passage", "date_of_freezing"),
+      'divs' => array(".", ".") 
+    )      
+  )
+);
+
+
+require("footers.php");
+?>
diff --git a/src/rack.php b/src/rack.php
new file mode 100644
index 0000000..8d4945a
--- /dev/null
+++ b/src/rack.php
@@ -0,0 +1,166 @@
+<?php
+session_start();
+require("headers.php");
+
+
+
+if (isset($_REQUEST["action"])) {
+  // print_r($_REQUEST);
+  $passage = $_REQUEST["passage"];
+  $container = $_REQUEST["container"];
+  $rack = $_REQUEST["rack"];
+  if ($_REQUEST["action"] == "update_storage") {
+    $where_clause = "";
+    $try_to_update = FALSE;
+    foreach ($_REQUEST as $key => $value) {
+      if ($value == "box_field") {
+        $try_to_update = TRUE;
+        $tmp_exp = explode("_", $key);
+        $tmp_box = $tmp_exp[2];
+        $tmp_field = $tmp_exp[3];
+        $where_clause .= "(container='$container' AND rack='$rack' AND box='$tmp_box' AND field='$tmp_field') OR ";
+        // $output .= "<p>$tmp_box $tmp_field***********</p>";
+      }
+    }    
+    $where_clause .= "0";    
+    $qry = "SELECT * FROM cl_storage WHERE $where_clause";    
+    // echo "<br>" . $qry . "<br>";
+    $result = mysql_query($qry, $connexion);
+    $error = FALSE;
+    while($tmp_passage = mysql_fetch_object($result)) {
+      if (isset($tmp_passage->cl_passages)) {
+        $error = TRUE;
+        echo "<H4 style='background-color: red;'><b>ERROR!</b>  $tmp_passage->container $tmp_passage->rack $tmp_passage->box $tmp_passage->field is not empty.</H4>";
+      }
+    }
+    if ($try_to_update & $session->mode == "view") {
+      echo "<H4 style='background-color: red;'><b>ERROR!</b> You can't update Liquid N2 storage in view mode.</H4>";
+    }
+    if (!$error & $session->mode != "view") {
+      $qry = "UPDATE cl_storage SET cl_passages='$passage' WHERE $where_clause";
+      $result = mysql_query($qry, $connexion);
+    }
+  }
+}
+
+
+// $qry = "SELECT * FROM cl_passages";
+// $result = mysql_query($qry, $connexion);
+// while($tmp_passage = mysql_fetch_object($result)) {
+//   if (!isset($passage)) {
+//     $passage = $tmp_passage->ID;
+//     echo "Passage: $tmp_passage->name $tmp_passage->passage $tmp_passage->date_of_freezing";
+//   }
+// }
+
+
+  $output = "";
+  $output .= "<form>";
+
+  $output .= "Which passage do you want to precise storage?<br>";
+  $output .= "Passage: <select name='passage' >";
+  $qry = "SELECT * FROM cl_passages";
+  $result = mysql_query($qry, $connexion);
+  while($tmp_passage = mysql_fetch_object($result)) {
+    if (!isset($passage)) {
+      $passage = $tmp_passage->ID;
+    }
+    $passage == $tmp_passage->ID ? $selected = "selected" : $selected = "";
+    $output .= "<option value='$tmp_passage->ID' $selected>$tmp_passage->name $tmp_passage->passage $tmp_passage->date_of_freezing</option>";
+  }
+  $output .= "</select><br>";
+
+  $output .= "In which container/rack?<br>";
+  $output .= "Container: <select name='container' >";
+  $qry = "SELECT DISTINCT container FROM cl_storage";
+  $result = mysql_query($qry, $connexion);
+  while($storage = mysql_fetch_object($result)) {
+    if (!isset($container)) {
+      $container = $storage->container;
+    }
+    $container == $storage->container ? $selected = "selected" : $selected = "";
+    $output .= "<option value='$storage->container' $selected>$storage->container</option>";
+  }
+  $output .= "</select><br>";
+
+  $output .= "Rack: <select name='rack' >";
+  $qry = "SELECT DISTINCT rack FROM cl_storage WHERE container='$container'";
+  $result = mysql_query($qry, $connexion);
+  while($storage = mysql_fetch_object($result)) {
+    if (!isset($rack)) {
+      $rack = $storage->rack;
+    }
+    $rack == $storage->rack ? $selected = "selected" : $selected = "";
+    $output .= "<option value='$storage->rack' $selected>$storage->rack</option>";
+  }
+  $output .= "</select><br>";
+
+
+  $qry = "SELECT * FROM cl_storage, cl_passages WHERE container='$container' AND rack='$rack' AND cl_storage.cl_passages=cl_passages.ID";
+  $result = mysql_query($qry, $connexion);
+  $content = array();
+  $content_index = array();
+  while($joint_passage = mysql_fetch_object($result)) {
+    $key = $joint_passage->container . $joint_passage->rack . $joint_passage->box . $joint_passage->field;
+    $value = $joint_passage->name . "<br>" . $joint_passage->passage . "<br>" . $joint_passage->date_of_freezing;
+    $content[$key] = $value;
+    $content_index[$key] = $joint_passage->cl_passages ;
+  }
+
+
+  $rack_map = array(
+    "A" => range(1,2),
+    "B" => range(1,3),
+    "C" => range(1,4),
+    "D" => range(1,5),
+    "E" => range(1,6),
+    "F" => range(1,7),
+    "G" => range(1,8),
+    "H" => range(1,9),
+    "I" => range(1,10),
+    "J" => range(1,9),
+    "K" => range(1,4),
+  );
+
+  $output .= "In which boxes/fields?<br>";
+  $output .= "<table>";
+  foreach ($rack_map as $box => $fields) {
+    $output .= "<tr><td >";
+    $output .= $box;
+    $output .= "</td>";
+    $output .= "<td>";
+    $output .= "<center><table ><tr>";
+    foreach($fields as $field) {
+      $key = $container . $rack . $box . $field;
+      isset($content[$key]) ? $color="LightGray" : $color="LightGreen";
+      $content_index[$key] == $passage ? $color="PowderBlue": $color=$color;
+      $output .= "<td style='background-color: $color; width:80; border: 1px solid black;''>";
+      if ($session->mode != "view") {
+        $output .= "<input type='checkbox' name='box_field_$box" . "_$field' value='box_field'>$field</input><br>";
+      } else {
+        $output .= "<b>$field</b><br>";        
+      }
+      $output .= isset($content[$key]) ? $content[$key] : "empty<br><br><br>";
+      $output .= "</td>";
+    }
+    $output .= "</tr></table></center>";
+    $output .= "</td></tr>";
+  }
+  $output .= "</table>";
+
+  $output .= "<input type='hidden' name='action' value='update_storage'>\n";
+  $output .= "<input type='submit' value='update storage or view'>\n";
+
+  $output .= "</table>";
+
+  $output .= "</form>";
+
+  echo $output;
+
+  // session_start ();
+  require("footers.php");
+
+  
+?>
+
+
