Révision 7c18e02a

b/README
296 296

  
297 297
On the targeted server, you can restore database from the last backup
298 298
(file ''labstocks_db.sql'') by typing the following command in a
299
terminal. It drops existing tables, creates new one and restore data.
300
You have to adapt user password and database name according to your
299
terminal. It drops existing tables, creates new one and restores data.
300
You have to adapt user, password and database name according to your
301 301
setting.
302 302

  
303 303
   sudo mysql --user=root --password=root labstocks_db < labstocks_db.sql
......
313 313
Extend Database
314 314
---------------
315 315

  
316
MyLabstock is delivrer under a free licence. Feel free to modify and
316
MyLabstock is delivered under a free licence. Feel free to modify and
317 317
extend it as to adapt it to your your own lab. To do that you could
318 318
easily create new table using phpMyAdmin
319
(http://your_server/phpmyadmin)
320
http://http://your_server/yourserver)ou mysql command line tool
321
(documentation here
319
(http://your_server/phpmyadmin) http://http://your_server/yourserver)
320
or mysql command line tool (documentation here
322 321
http://dev.mysql.com/doc/refman/5.6/en/mysql.html). MyLabStocks uses
323
the  framework phpMyEdit to manaeg the user interface. Use the
322
the  framework phpMyEdit to manage the user interface. Use the
324 323
provided tool http://your_server/phpMyEditSetup.php to generate code.
325
For any question please refer to the embeded documention
324
For any question please refer to the phpMyEdit embedded documentation
326 325
(http://your_server/labstocks/doc/html/).
b/doc/conf.py
50 50
# built documents.
51 51
#
52 52
# The short X.Y version.
53
version = '0.1.4'
53
version = '0.1.6'
54 54
# The full version, including alpha/beta/rc tags.
55
release = '0.1.4'
55
release = '0.1.6'
56 56

  
57 57
# The language for content autogenerated by Sphinx. Refer to documentation
58 58
# for a list of supported languages.
b/doc/index.rst
240 240

  
241 241
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*). 
242 242

  
243

  
244

  
243 245
How To Restore System From Backup
244 246
---------------------------------
245 247

  
246
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.
248
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.
247 249

  
248 250
.. code:: bash
249 251

  
......
262 264
Extend Database
263 265
---------------
264 266

  
265
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/).
267
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/).
266 268

  
b/src/cl_name.php
1
<?php
2
session_start ();
3
require("headers.php");
4

  
5
/*
6
 * IMPORTANT NOTE: This generated file contains only a subset of huge amount
7
 * of options that can be used with phpMyEdit. To get information about all
8
 * features offered by phpMyEdit, check official documentation. It is available
9
 * online and also for download on phpMyEdit project management page:
10
 *
11
 * http://platon.sk/projects/main_page.php?project_id=5
12
 *
13
 * This file was generated by:
14
 *
15
 *                    phpMyEdit version: unknown
16
 *       phpMyEdit.class.php core class: 1.204
17
 *            phpMyEditSetup.php script: 1.50
18
 *              generating setup script: 1.50
19
 */
20

  
21

  
22
/*************************/
23
//
24
// Pass phpMyEdit options
25
//
26
/*************************/
27

  
28

  
29
$opts['dbh'] = $connexion;
30
$opts['tb'] = $tb;
31

  
32
// Name of field which is the unique key
33
$opts['key'] = 'ID';
34

  
35
// Type of key field (int/real/string/date etc.)
36
$opts['key_type'] = 'int';
37

  
38
// Sorting field(s)
39
$opts['sort_field'] = array('ID');
40

  
41
// Number of records to display on the screen
42
// Value of -1 lists all records in a table
43
$opts['inc'] = 15;
44

  
45
// Options you wish to give the users
46
// A - add,  C - change, P - copy, V - view, D - delete,
47
// F - filter, I - initial sort suppressed
48
$opts['options'] = $privopt;
49

  
50
// Number of lines to display on multiple selection filters
51
$opts['multiple'] = '4';
52

  
53
// Navigation style: B - buttons (default), T - text links, G - graphic links
54
// Buttons position: U - up, D - down (default)
55
$opts['navigation'] = 'UDBG';
56

  
57
// Display special page elements
58
$opts['display'] = array(
59
	'form'  => true,
60
	'query' => true,
61
	'sort'  => true,
62
	'time'  => true,
63
	'tabs'  => true
64
);
65

  
66
// Set default prefixes for variables
67
$opts['js']['prefix']               = 'PME_js_';
68
$opts['dhtml']['prefix']            = 'PME_dhtml_';
69
$opts['cgi']['prefix']['operation'] = 'PME_op_';
70
$opts['cgi']['prefix']['sys']       = 'PME_sys_';
71
$opts['cgi']['prefix']['data']      = 'PME_data_';
72

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

  
78
/* Table-level filter capability. If set, it is included in the WHERE clause
79
   of any generated SELECT statement in SQL query. This gives you ability to
80
   work only with subset of data from table.
81

  
82
$opts['filters'] = "column1 like '%11%' AND column2<17";
83
$opts['filters'] = "section_id = 9";
84
$opts['filters'] = "PMEtable0.sessions_count > 200";
85
*/
86

  
87
/* Field definitions
88
   
89
Fields will be displayed left to right on the screen in the order in which they
90
appear in generated list. Here are some most used field options documented.
91

  
92
['name'] is the title used for column headings, etc.;
93
['maxlen'] maximum length to display add/edit/search input boxes
94
['trimlen'] maximum length of string content to display in row listing
95
['width'] is an optional display width specification for the column
96
          e.g.  ['width'] = '100px';
97
['mask'] a string that is used by sprintf() to format field output
98
['sort'] true or false; means the users may sort the display on this column
99
['strip_tags'] true or false; whether to strip tags from content
100
['nowrap'] true or false; whether this field should get a NOWRAP
101
['select'] T - text, N - numeric, D - drop-down, M - multiple selection
102
['options'] optional parameter to control whether a field is displayed
103
  L - list, F - filter, A - add, C - change, P - copy, D - delete, V - view
104
            Another flags are:
105
            R - indicates that a field is read only
106
            W - indicates that a field is a password field
107
            H - indicates that a field is to be hidden and marked as hidden
108
['URL'] is used to make a field 'clickable' in the display
109
        e.g.: 'mailto:$value', 'http://$value' or '$page?stuff';
110
['URLtarget']  HTML target link specification (for example: _blank)
111
['textarea']['rows'] and/or ['textarea']['cols']
112
  specifies a textarea is to be used to give multi-line input
113
  e.g. ['textarea']['rows'] = 5; ['textarea']['cols'] = 10
114
['values'] restricts user input to the specified constants,
115
           e.g. ['values'] = array('A','B','C') or ['values'] = range(1,99)
116
['values']['table'] and ['values']['column'] restricts user input
117
  to the values found in the specified column of another table
118
['values']['description'] = 'desc_column'
119
  The optional ['values']['description'] field allows the value(s) displayed
120
  to the user to be different to those in the ['values']['column'] field.
121
  This is useful for giving more meaning to column values. Multiple
122
  descriptions fields are also possible. Check documentation for this.
123
*/
124

  
125

  
126
$opts['fdd']['name'] = array(
127
  'name'     => 'Name',
128
  'select'   => 'T',
129
  'maxlen'   => 100,
130
  'sort'     => true
131
);
132
$opts['fdd']['description'] = array(
133
  'name'     => 'Description',
134
  'select'   => 'T',
135
  'maxlen'   => 4294967295,
136
  'textarea' => array(
137
    'rows' => 5,
138
    'cols' => 50),
139
  'sort'     => true
140
);
141
$opts['fdd']['origin'] = array(
142
  'name'     => 'Origin',
143
  'select'   => 'T',
144
  'maxlen'   => 4294967295,
145
  'textarea' => array(
146
    'rows' => 5,
147
    'cols' => 50),
148
  'sort'     => true
149
);
150
$opts['fdd']['type'] = array(
151
  'name'     => 'Type',
152
  'select'   => 'D',
153
  'values'   => array(
154
  	'table'  => 'cl_type',
155
	'column' => 'type'),
156
  'maxlen'   => 100,
157
  'sort'     => true
158
);
159

  
160
require("footers.php");
161
?>
b/src/cl_passages.php
1
<?php
2
session_start ();
3
require("headers.php");
4

  
5
/*
6
 * IMPORTANT NOTE: This generated file contains only a subset of huge amount
7
 * of options that can be used with phpMyEdit. To get information about all
8
 * features offered by phpMyEdit, check official documentation. It is available
9
 * online and also for download on phpMyEdit project management page:
10
 *
11
 * http://platon.sk/projects/main_page.php?project_id=5
12
 *
13
 * This file was generated by:
14
 *
15
 *                    phpMyEdit version: unknown
16
 *       phpMyEdit.class.php core class: 1.204
17
 *            phpMyEditSetup.php script: 1.50
18
 *              generating setup script: 1.50
19
 */
20

  
21

  
22
/*************************/
23
//
24
// Pass phpMyEdit options
25
//
26
/*************************/
27

  
28

  
29
$opts['dbh'] = $connexion;
30
$opts['tb'] = $tb;
31

  
32
// Name of field which is the unique key
33
$opts['key'] = 'ID';
34

  
35
// Type of key field (int/real/string/date etc.)
36
$opts['key_type'] = 'int';
37

  
38
// Sorting field(s)
39
$opts['sort_field'] = array('ID');
40

  
41
// Number of records to display on the screen
42
// Value of -1 lists all records in a table
43
$opts['inc'] = 15;
44

  
45
// Options you wish to give the users
46
// A - add,  C - change, P - copy, V - view, D - delete,
47
// F - filter, I - initial sort suppressed
48
$opts['options'] = $privopt;
49

  
50
// Number of lines to display on multiple selection filters
51
$opts['multiple'] = '4';
52

  
53
// Navigation style: B - buttons (default), T - text links, G - graphic links
54
// Buttons position: U - up, D - down (default)
55
$opts['navigation'] = 'UDBG';
56

  
57
// Display special page elements
58
$opts['display'] = array(
59
	'form'  => true,
60
	'query' => true,
61
	'sort'  => true,
62
	'time'  => true,
63
	'tabs'  => true
64
);
65

  
66
// Set default prefixes for variables
67
$opts['js']['prefix']               = 'PME_js_';
68
$opts['dhtml']['prefix']            = 'PME_dhtml_';
69
$opts['cgi']['prefix']['operation'] = 'PME_op_';
70
$opts['cgi']['prefix']['sys']       = 'PME_sys_';
71
$opts['cgi']['prefix']['data']      = 'PME_data_';
72

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

  
78
/* Table-level filter capability. If set, it is included in the WHERE clause
79
   of any generated SELECT statement in SQL query. This gives you ability to
80
   work only with subset of data from table.
81

  
82
$opts['filters'] = "column1 like '%11%' AND column2<17";
83
$opts['filters'] = "section_id = 9";
84
$opts['filters'] = "PMEtable0.sessions_count > 200";
85
*/
86

  
87
/* Field definitions
88
   
89
Fields will be displayed left to right on the screen in the order in which they
90
appear in generated list. Here are some most used field options documented.
91

  
92
['name'] is the title used for column headings, etc.;
93
['maxlen'] maximum length to display add/edit/search input boxes
94
['trimlen'] maximum length of string content to display in row listing
95
['width'] is an optional display width specification for the column
96
          e.g.  ['width'] = '100px';
97
['mask'] a string that is used by sprintf() to format field output
98
['sort'] true or false; means the users may sort the display on this column
99
['strip_tags'] true or false; whether to strip tags from content
100
['nowrap'] true or false; whether this field should get a NOWRAP
101
['select'] T - text, N - numeric, D - drop-down, M - multiple selection
102
['options'] optional parameter to control whether a field is displayed
103
  L - list, F - filter, A - add, C - change, P - copy, D - delete, V - view
104
            Another flags are:
105
            R - indicates that a field is read only
106
            W - indicates that a field is a password field
107
            H - indicates that a field is to be hidden and marked as hidden
108
['URL'] is used to make a field 'clickable' in the display
109
        e.g.: 'mailto:$value', 'http://$value' or '$page?stuff';
110
['URLtarget']  HTML target link specification (for example: _blank)
111
['textarea']['rows'] and/or ['textarea']['cols']
112
  specifies a textarea is to be used to give multi-line input
113
  e.g. ['textarea']['rows'] = 5; ['textarea']['cols'] = 10
114
['values'] restricts user input to the specified constants,
115
           e.g. ['values'] = array('A','B','C') or ['values'] = range(1,99)
116
['values']['table'] and ['values']['column'] restricts user input
117
  to the values found in the specified column of another table
118
['values']['description'] = 'desc_column'
119
  The optional ['values']['description'] field allows the value(s) displayed
120
  to the user to be different to those in the ['values']['column'] field.
121
  This is useful for giving more meaning to column values. Multiple
122
  descriptions fields are also possible. Check documentation for this.
123
*/
124

  
125

  
126
$opts['fdd']['ID'] = array(
127
  'name'     => 'ID',
128
  'select'   => 'T',
129
  'options'  => 'AVCPDRL', // auto increment
130
  'maxlen'   => 15,
131
  'default'  => '0',
132
  'sort'     => true
133
);
134
$opts['fdd']['name'] = array(
135
  'name'     => 'Name',
136
  'select'   => 'D',
137
  'maxlen'   => 30,
138
  //'default'  => '0',
139
  'values'   => array(
140
  	'table'  => 'cl_name',
141
	'column' => 'name'),
142
  'sort'     => true
143
);
144

  
145
// $opts['multiple'] = '4';
146
// $opts['fdd']['cl_storage'] = array(
147
//   'name'     => 'Liquid N2 storage',
148
//   'select'   => 'C',
149
//   'maxlen'   => 30,
150
//   //'default'  => '0',
151
//   'values'   => array(
152
//     'table'  => 'cl_storage',
153
//     'column' => 'id',
154
//     'description' => array(
155
//       'columns' => array("container", "rack", "box", "field") 
156
//       // 'divs' = > array('.') 
157
//     )      
158
//   ),
159
//   'sort'     => true
160
// );
161
// 
162
// $opts['fdd']['cl_storage']['values']['description']['divs'][0] = ".";
163
// $opts['fdd']['cl_storage']['values']['description']['divs'][1] = ".";
164
// $opts['fdd']['cl_storage']['values']['description']['divs'][2] = ".";
165
  
166
$opts['fdd']['passage'] = array(
167
  'name'     => 'Passage',
168
  'select'   => 'T',
169
  'maxlen'   => 4294967295,
170
  'textarea' => array(
171
    'rows' => 5,
172
    'cols' => 50),
173
  'sort'     => true
174
);
175
$opts['fdd']['date_of_freezing'] = array(
176
  'name'     => 'Date of freezing',
177
  'select'   => 'T',
178
  'maxlen'   => 10,
179
  'sort'     => true
180
);
181

  
182
require("footers.php");
183
?>
b/src/cl_storage.php
1
<?php
2
session_start ();
3
require("headers.php");
4

  
5
/*
6
 * IMPORTANT NOTE: This generated file contains only a subset of huge amount
7
 * of options that can be used with phpMyEdit. To get information about all
8
 * features offered by phpMyEdit, check official documentation. It is available
9
 * online and also for download on phpMyEdit project management page:
10
 *
11
 * http://platon.sk/projects/main_page.php?project_id=5
12
 *
13
 * This file was generated by:
14
 *
15
 *                    phpMyEdit version: unknown
16
 *       phpMyEdit.class.php core class: 1.204
17
 *            phpMyEditSetup.php script: 1.50
18
 *              generating setup script: 1.50
19
 */
20

  
21

  
22
/*************************/
23
//
24
// Pass phpMyEdit options
25
//
26
/*************************/
27

  
28

  
29
$opts['dbh'] = $connexion;
30
$opts['tb'] = $tb;
31

  
32
// Name of field which is the unique key
33
$opts['key'] = 'ID';
34

  
35
// Type of key field (int/real/string/date etc.)
36
$opts['key_type'] = 'int';
37

  
38
// Sorting field(s)
39
$opts['sort_field'] = array('ID');
40

  
41
// Number of records to display on the screen
42
// Value of -1 lists all records in a table
43
$opts['inc'] = 15;
44

  
45
// Options you wish to give the users
46
// A - add,  C - change, P - copy, V - view, D - delete,
47
// F - filter, I - initial sort suppressed
48
$opts['options'] = $privopt;
49

  
50
// Number of lines to display on multiple selection filters
51
$opts['multiple'] = '4';
52

  
53
// Navigation style: B - buttons (default), T - text links, G - graphic links
54
// Buttons position: U - up, D - down (default)
55
$opts['navigation'] = 'UDBG';
56

  
57
// Display special page elements
58
$opts['display'] = array(
59
	'form'  => true,
60
	'query' => true,
61
	'sort'  => true,
62
	'time'  => true,
63
	'tabs'  => true
64
);
65

  
66
// Set default prefixes for variables
67
$opts['js']['prefix']               = 'PME_js_';
68
$opts['dhtml']['prefix']            = 'PME_dhtml_';
69
$opts['cgi']['prefix']['operation'] = 'PME_op_';
70
$opts['cgi']['prefix']['sys']       = 'PME_sys_';
71
$opts['cgi']['prefix']['data']      = 'PME_data_';
72

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

  
78
/* Table-level filter capability. If set, it is included in the WHERE clause
79
   of any generated SELECT statement in SQL query. This gives you ability to
80
   work only with subset of data from table.
81

  
82
$opts['filters'] = "column1 like '%11%' AND column2<17";
83
$opts['filters'] = "section_id = 9";
84
$opts['filters'] = "PMEtable0.sessions_count > 200";
85
*/
86

  
87
/* Field definitions
88
   
89
Fields will be displayed left to right on the screen in the order in which they
90
appear in generated list. Here are some most used field options documented.
91

  
92
['name'] is the title used for column headings, etc.;
93
['maxlen'] maximum length to display add/edit/search input boxes
94
['trimlen'] maximum length of string content to display in row listing
95
['width'] is an optional display width specification for the column
96
          e.g.  ['width'] = '100px';
97
['mask'] a string that is used by sprintf() to format field output
98
['sort'] true or false; means the users may sort the display on this column
99
['strip_tags'] true or false; whether to strip tags from content
100
['nowrap'] true or false; whether this field should get a NOWRAP
101
['select'] T - text, N - numeric, D - drop-down, M - multiple selection
102
['options'] optional parameter to control whether a field is displayed
103
  L - list, F - filter, A - add, C - change, P - copy, D - delete, V - view
104
            Another flags are:
105
            R - indicates that a field is read only
106
            W - indicates that a field is a password field
107
            H - indicates that a field is to be hidden and marked as hidden
108
['URL'] is used to make a field 'clickable' in the display
109
        e.g.: 'mailto:$value', 'http://$value' or '$page?stuff';
110
['URLtarget']  HTML target link specification (for example: _blank)
111
['textarea']['rows'] and/or ['textarea']['cols']
112
  specifies a textarea is to be used to give multi-line input
113
  e.g. ['textarea']['rows'] = 5; ['textarea']['cols'] = 10
114
['values'] restricts user input to the specified constants,
115
           e.g. ['values'] = array('A','B','C') or ['values'] = range(1,99)
116
['values']['table'] and ['values']['column'] restricts user input
117
  to the values found in the specified column of another table
118
['values']['description'] = 'desc_column'
119
  The optional ['values']['description'] field allows the value(s) displayed
120
  to the user to be different to those in the ['values']['column'] field.
121
  This is useful for giving more meaning to column values. Multiple
122
  descriptions fields are also possible. Check documentation for this.
123
*/
124

  
125

  
126

  
127
$opts['fdd']['ID'] = array(
128
  'name'     => 'ID',
129
  'select'   => 'T',
130
  'options'  => 'AVCPDR', // auto increment
131
  'maxlen'   => 15,
132
  'default'  => '0',
133
  'sort'     => true
134
);
135
$opts['fdd']['container'] = array(
136
  'name'     => 'Container',
137
  'options'  => 'LFACPDVR',
138
  'select'   => 'T',
139
  'maxlen'   => 50,
140
  'sort'     => true
141
);
142
$opts['fdd']['rack'] = array(
143
  'name'     => 'Rack',
144
  'options'  => 'LFACPDVR',
145
  'select'   => 'T',
146
  'maxlen'   => 50,
147
  'sort'     => true
148
);
149
$opts['fdd']['box'] = array(
150
  'name'     => 'Box',
151
  'options'  => 'LFACPDVR',
152
  'select'   => 'T',
153
  'maxlen'   => 50,
154
  'sort'     => true
155
);
156
$opts['fdd']['field'] = array(
157
  'name'     => 'Field',
158
  'options'  => 'LFACPDVR',
159
  'select'   => 'T',
160
  'maxlen'   => 50,
161
  'sort'     => true
162
);
163
$opts['fdd']['cl_passages'] = array(
164
  'name'     => 'Passage',
165
  'select'   => 'D',
166
  'maxlen'   => 50,
167
  'sort'     => true, 
168
  'values'   => array(
169
    'table'  => 'cl_passages',
170
    'column' => 'ID',
171
    'description' => array(
172
      'columns' => array("name", "passage", "date_of_freezing"),
173
      'divs' => array(".", ".") 
174
    )      
175
  )
176
);
177

  
178

  
179
require("footers.php");
180
?>
b/src/rack.php
1
<?php
2
session_start();
3
require("headers.php");
4

  
5

  
6

  
7
if (isset($_REQUEST["action"])) {
8
  // print_r($_REQUEST);
9
  $passage = $_REQUEST["passage"];
10
  $container = $_REQUEST["container"];
11
  $rack = $_REQUEST["rack"];
12
  if ($_REQUEST["action"] == "update_storage") {
13
    $where_clause = "";
14
    $try_to_update = FALSE;
15
    foreach ($_REQUEST as $key => $value) {
16
      if ($value == "box_field") {
17
        $try_to_update = TRUE;
18
        $tmp_exp = explode("_", $key);
19
        $tmp_box = $tmp_exp[2];
20
        $tmp_field = $tmp_exp[3];
21
        $where_clause .= "(container='$container' AND rack='$rack' AND box='$tmp_box' AND field='$tmp_field') OR ";
22
        // $output .= "<p>$tmp_box $tmp_field***********</p>";
23
      }
24
    }    
25
    $where_clause .= "0";    
26
    $qry = "SELECT * FROM cl_storage WHERE $where_clause";    
27
    // echo "<br>" . $qry . "<br>";
28
    $result = mysql_query($qry, $connexion);
29
    $error = FALSE;
30
    while($tmp_passage = mysql_fetch_object($result)) {
31
      if (isset($tmp_passage->cl_passages)) {
32
        $error = TRUE;
33
        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>";
34
      }
35
    }
36
    if ($try_to_update & $session->mode == "view") {
37
      echo "<H4 style='background-color: red;'><b>ERROR!</b> You can't update Liquid N2 storage in view mode.</H4>";
38
    }
39
    if (!$error & $session->mode != "view") {
40
      $qry = "UPDATE cl_storage SET cl_passages='$passage' WHERE $where_clause";
41
      $result = mysql_query($qry, $connexion);
42
    }
43
  }
44
}
45

  
46

  
47
// $qry = "SELECT * FROM cl_passages";
48
// $result = mysql_query($qry, $connexion);
49
// while($tmp_passage = mysql_fetch_object($result)) {
50
//   if (!isset($passage)) {
51
//     $passage = $tmp_passage->ID;
52
//     echo "Passage: $tmp_passage->name $tmp_passage->passage $tmp_passage->date_of_freezing";
53
//   }
54
// }
55

  
56

  
57
  $output = "";
58
  $output .= "<form>";
59

  
60
  $output .= "Which passage do you want to precise storage?<br>";
61
  $output .= "Passage: <select name='passage' >";
62
  $qry = "SELECT * FROM cl_passages";
63
  $result = mysql_query($qry, $connexion);
64
  while($tmp_passage = mysql_fetch_object($result)) {
65
    if (!isset($passage)) {
66
      $passage = $tmp_passage->ID;
67
    }
68
    $passage == $tmp_passage->ID ? $selected = "selected" : $selected = "";
69
    $output .= "<option value='$tmp_passage->ID' $selected>$tmp_passage->name $tmp_passage->passage $tmp_passage->date_of_freezing</option>";
70
  }
71
  $output .= "</select><br>";
72

  
73
  $output .= "In which container/rack?<br>";
74
  $output .= "Container: <select name='container' >";
75
  $qry = "SELECT DISTINCT container FROM cl_storage";
76
  $result = mysql_query($qry, $connexion);
77
  while($storage = mysql_fetch_object($result)) {
78
    if (!isset($container)) {
79
      $container = $storage->container;
80
    }
81
    $container == $storage->container ? $selected = "selected" : $selected = "";
82
    $output .= "<option value='$storage->container' $selected>$storage->container</option>";
83
  }
84
  $output .= "</select><br>";
85

  
86
  $output .= "Rack: <select name='rack' >";
87
  $qry = "SELECT DISTINCT rack FROM cl_storage WHERE container='$container'";
88
  $result = mysql_query($qry, $connexion);
89
  while($storage = mysql_fetch_object($result)) {
90
    if (!isset($rack)) {
91
      $rack = $storage->rack;
92
    }
93
    $rack == $storage->rack ? $selected = "selected" : $selected = "";
94
    $output .= "<option value='$storage->rack' $selected>$storage->rack</option>";
95
  }
96
  $output .= "</select><br>";
97

  
98

  
99
  $qry = "SELECT * FROM cl_storage, cl_passages WHERE container='$container' AND rack='$rack' AND cl_storage.cl_passages=cl_passages.ID";
100
  $result = mysql_query($qry, $connexion);
101
  $content = array();
102
  $content_index = array();
103
  while($joint_passage = mysql_fetch_object($result)) {
104
    $key = $joint_passage->container . $joint_passage->rack . $joint_passage->box . $joint_passage->field;
105
    $value = $joint_passage->name . "<br>" . $joint_passage->passage . "<br>" . $joint_passage->date_of_freezing;
106
    $content[$key] = $value;
107
    $content_index[$key] = $joint_passage->cl_passages ;
108
  }
109

  
110

  
111
  $rack_map = array(
112
    "A" => range(1,2),
113
    "B" => range(1,3),
114
    "C" => range(1,4),
115
    "D" => range(1,5),
116
    "E" => range(1,6),
117
    "F" => range(1,7),
118
    "G" => range(1,8),
119
    "H" => range(1,9),
120
    "I" => range(1,10),
121
    "J" => range(1,9),
122
    "K" => range(1,4),
123
  );
124

  
125
  $output .= "In which boxes/fields?<br>";
126
  $output .= "<table>";
127
  foreach ($rack_map as $box => $fields) {
128
    $output .= "<tr><td >";
129
    $output .= $box;
130
    $output .= "</td>";
131
    $output .= "<td>";
132
    $output .= "<center><table ><tr>";
133
    foreach($fields as $field) {
134
      $key = $container . $rack . $box . $field;
135
      isset($content[$key]) ? $color="LightGray" : $color="LightGreen";
136
      $content_index[$key] == $passage ? $color="PowderBlue": $color=$color;
137
      $output .= "<td style='background-color: $color; width:80; border: 1px solid black;''>";
138
      if ($session->mode != "view") {
139
        $output .= "<input type='checkbox' name='box_field_$box" . "_$field' value='box_field'>$field</input><br>";
140
      } else {
141
        $output .= "<b>$field</b><br>";        
142
      }
143
      $output .= isset($content[$key]) ? $content[$key] : "empty<br><br><br>";
144
      $output .= "</td>";
145
    }
146
    $output .= "</tr></table></center>";
147
    $output .= "</td></tr>";
148
  }
149
  $output .= "</table>";
150

  
151
  $output .= "<input type='hidden' name='action' value='update_storage'>\n";
152
  $output .= "<input type='submit' value='update storage or view'>\n";
153

  
154
  $output .= "</table>";
155

  
156
  $output .= "</form>";
157

  
158
  echo $output;
159

  
160
  // session_start ();
161
  require("footers.php");
162

  
163
  
164
?>
165

  
166

  

Formats disponibles : Unified diff