X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=index.php;h=d6eb6606dcfea5dbeb0da7a966a0aa109eac4783;hb=32e14fd3604d676e7281c123cc44582a02e929cf;hp=6b5df8b9d7f95f640af0e9cd059afae5ad33a1aa;hpb=d1686e10050e730500500eb474f0b2582917b950;p=mirrors%2FSokoMan.git diff --git a/index.php b/index.php index 6b5df8b..d6eb660 100755 --- a/index.php +++ b/index.php @@ -24,6 +24,7 @@ require_once('Sklad_Auth.class/common.php'); require_once('HTTP_Auth.class.php'); require_once('Locale.class.php'); require_once('Barcode.class.php'); +require_once('Fortune.php'); /** * Trida poskytuje vseobecne funkce pro generovani HTML kodu @@ -34,32 +35,35 @@ require_once('Barcode.class.php'); * @author Tomas Mudrunka */ class HTML { - function row($row,$type=false,$class=false) { + function row($row,$type=false,$class=false,$parameters='') { $html = ''; $class = $class ? $class=" class='$class' " : ''; if($type) $html.="<$type>"; - $html.=""; + $html.=""; $td = $type == 'thead' ? 'th' : 'td'; - foreach($row as $var) { + foreach($row as $id => $var) { + $tdclass = " class='cell_$id'"; if(trim($var) == '') $var = ' '; - $html.="<$td>$var"; + $html.="<$td$tdclass>$var"; } $html.=''; if($type) $html.=""; return $html; } - function table(&$table, $parity_class=array('tr_odd','tr_even'), $params='border=1') { + function table(&$table, $parity_class=array('tr_odd','tr_even'), $params='border=1', $row_params_field='_row_parameters') { $html=""; $header=true; $even=false; foreach($table as $row) { + $params = isset($row[$row_params_field]) ? $row[$row_params_field] : ''; + unset($row[$row_params_field]); if($header) { - $html.=$this->row(array_keys($row),'thead'); + $html.=$this->row(T(array_keys($row)),'thead'); $header=false; } $class = $parity_class ? $parity_class[$even] : false; - $html.=$this->row($row,false,$class); + $html.=$this->row($row,false,$class.$params); $even = !$even; } $html.='
'; @@ -72,12 +76,12 @@ class HTML { return "".$title.""; } - function img($src='#void', $title='img', $options='width=64') { + function img($src='#void', $title='img', $options='height=64') { $options = $options ? " $options" : ''; return "$title"; } - function img_link($src, $link='#void', $title='img_link', $internal=true, $translate=true, $options='width=64') { + function img_link($src, $link='#void', $title='img_link', $internal=true, $translate=true, $options='height=64') { return $this->link($this->img($src,$title,$options),$link,$internal,$translate); } @@ -180,7 +184,7 @@ class Sklad_HTML extends HTML { //TODO: Split into few more methods $script = $_SERVER['SCRIPT_NAME']; $search = htmlspecialchars(@trim($_GET['q'])); $message = strip_tags(@trim($_GET['message']),'
'); - $fortune = 'test'; + $fortune = fortune(); $instance = INSTANCE_ID != '' ? '/'.INSTANCE_ID : ''; $user_id = htmlspecialchars($user['id']); $user_gid = htmlspecialchars($user['gid']); @@ -203,6 +207,13 @@ table { background-color: orange; border: orange; } a, a img { text-decoration:none; color: darkblue; border:none; } li a, a:hover { text-decoration:underline; } .tr_even td { background-color: lemonchiffon; } +.item_status_stored td { font-weight:bold; } +.item_status_deleted td { text-decoration:line-through; } +.item_status_destroyed td { font-style:italic; } +/* table, table * { table-layout:fixed; width:100%; overflow:hidden; word-wrap:break-word; } */ +/* td { position:absolute; } */ +.cell_model_name { } + .menu li { float: left; @@ -288,7 +299,7 @@ EOF;
$message
-
+
$fortune
EOF; @@ -324,6 +335,15 @@ EOF; } } + function table_add_row_parameters(&$table, $param_col='_row_parameters') { //TODO: rename to table_add_row_classes() + $image = array('status_name' => ' item_status_'); + foreach($table as $id => $row) { + foreach($image as $column => $param) if(isset($table[$id][$column])) { + @$table[$id][$param_col] .= $param.$table[$id][$column]; + } + } + } + function table_add_relations(&$table, $class, $suffix_relations='_relations') { $where_url = '%d/?where[%c]==%v'; $relations = array( //TODO: Autodetect??? @@ -404,11 +424,11 @@ EOF; foreach($table as $id => $row) { $table_sorted[$id] = array(); foreach($precedence as $column) if(isset($table[$id][$column])) { - $table_sorted[$id][T($column)]=$table[$id][$column]; + $table_sorted[$id][$column]=$table[$id][$column]; unset($table[$id][$column]); } - //$table_sorted[$id]=array_merge($table_sorted[$id],$table[$id]); - foreach($table[$id] as $key => $val) $table_sorted[$id][T($key)] = $val; //array_merge with T() translating + $table_sorted[$id]=array_merge($table_sorted[$id],$table[$id]); + //foreach($table[$id] as $key => $val) $table_sorted[$id][T($key)] = $val; //array_merge with T() translating } $table = $table_sorted; } @@ -425,6 +445,7 @@ EOF; function render_item_table($table,$class=false) { if(empty($table)) return '

'.T('holy primordial emptiness is all you can find here...').'


'; + $this->table_add_row_parameters($table); $this->table_add_images($table); if($class) $this->table_add_relations($table,$class); $this->table_add_barcodes($table);