From 3143465aa563257b3f4537f1c46385b913490106 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Thu, 6 Aug 2015 02:30:02 +0100 Subject: [PATCH] css, args by ref --- lib/css/button.css | 4 ++-- lib/css/db.css | 22 ++++++++++++++-------- lib/php/db/table.php | 40 +++++++++++++++++++--------------------- lib/php/functions.php | 5 +++++ lib/php/test.php | 35 +++++++++-------------------------- 5 files changed, 49 insertions(+), 57 deletions(-) mode change 100644 => 100755 lib/php/test.php diff --git a/lib/css/button.css b/lib/css/button.css index c19ab182..66aa43c6 100644 --- a/lib/css/button.css +++ b/lib/css/button.css @@ -18,15 +18,15 @@ box-sizing: border-box; background-color: #f4f4f4; - border: solid 1px #ddd; /* + border: solid 1px #ddd; box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.1); */ color: #666; } .button:hover { - background-color: #f0f0f0; + opacity: 0.6; } form a.button:visited, diff --git a/lib/css/db.css b/lib/css/db.css index 9eafc649..6f64434f 100644 --- a/lib/css/db.css +++ b/lib/css/db.css @@ -59,6 +59,10 @@ div.rows .nav { padding: 0; } +div.rows .row *:not([class~=buttons]):hover { + opacity: 0.7; +} + div.rows .row .buttons { padding-bottom: 0.5em; } @@ -73,6 +77,8 @@ div.rows .row label { div.rows .row span { width: 70%; display: inline-block; + white-space: pre; + text-align: right; } /* .rows ul .button { float: right; } @@ -83,13 +89,13 @@ div.rows div.buttons { float: right; } /* Menu */ -.db.menu { +.db .menu { margin: 0 auto; padding: 0.5em 0.8em; display: table; } -ul.db.menu { +.db ul.menu { max-width: 7em; } @@ -109,25 +115,25 @@ li.tables li { Edit */ -form.db.edit { +.db form.edit { max-width: 50em; margin: 0 auto; } -form.db.edit label { +.db form.edit label { width: 20%; margin-bottom: 0.3em; display: inline-block; text-align: right; } -form.db.edit span, -form.db.edit input { +.db form.edit span, +.db form.edit input { width: 70%; } /* -form.db.edit +.db form.edit */ .buttons { margin: 0.5em auto 0 auto; @@ -138,7 +144,7 @@ form.db.edit /* */ -form.db.edit +.db form.edit .buttons input { width: auto; float: none; diff --git a/lib/php/db/table.php b/lib/php/db/table.php index 16a152ce..708aa5f1 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -656,7 +656,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. return '['.PHP_EOL; } - function rows_rec_json($row) { + function rows_rec_json(&$row) { $json = ''; if ($this->_row_json === null) { $this->_row_json = true; @@ -678,7 +678,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. return "---\n"; } - function rows_rec_yaml($row) { + function rows_rec_yaml(&$row) { $yaml = yaml_emit($row); $yaml = preg_replace('/^---\n/','',$yaml); $yaml = preg_replace('/\n\.\.\.$/','',$yaml); @@ -700,14 +700,14 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. ; } - function rows_rec_xml($row) { + function rows_rec_xml(&$row) { $xml = ''; $xml .= "\t".PHP_EOL; - foreach (array_keys($this->fields()) as $f) { - if ($row[$f] !== '') $xml .= '' - . "\t\t<".$f.'>' - .'' - . '' + foreach ($row as $k=>$v) { + if ($v !== '') $xml .= '' + . "\t\t<".$k.">" + .'' + . '' .PHP_EOL; } $xml .= "\t".PHP_EOL; @@ -725,7 +725,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. return join("\t",array_keys($fields))."\n"; } - function rows_rec_csv($row) { + function rows_rec_csv(&$row) { return join("\t",array_values($row))."\n"; } @@ -740,7 +740,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. function rows_begin_table() { $html = ''; - $html .= ''.PHP_EOL; + $html .= '
'.PHP_EOL; $colspan = 0; if (DB_HTML_EDIT) $colspan++; @@ -753,28 +753,28 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. $html .= ''; - if (DB_HTML_EDIT) $html .= ''; + if (DB_HTML_EDIT) $html .= ''; foreach (array_keys($this->fields()) as $f) { $html .= ''; } - if (DB_HTML_DELETE) $html .= ''; + if (DB_HTML_DELETE) $html .= ''; $html .= ''.PHP_EOL;#.''.PHP_EOL; return $html; } - function rows_rec_table($row) { - - array_unshift($row,''.DB_HTML_EDIT.''); - array_push($row,''.DB_HTML_DELETE.''); + function rows_rec_table(&$row) { $html = ''; + $html .= ''; + foreach ($row as $k => $v) { $html .= ''; } + $html .= ''; $html .= ''.PHP_EOL; return $html; @@ -787,9 +787,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. if (!empty($opt['count'])) $html .= ''#''.PHP_EOL .'' . '' @@ -804,10 +802,10 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. Html Div -----------------------------------------------------------------*/ function rows_begin_div() { - return '
'.DB_HTML_NAV_TOP.PHP_EOL; + return '
'.DB_HTML_NAV_TOP.PHP_EOL; } - function rows_rec_div($row) { + function rows_rec_div(&$row) { $html = ''; diff --git a/lib/php/functions.php b/lib/php/functions.php index 38f1aa8a..f4e2291f 100644 --- a/lib/php/functions.php +++ b/lib/php/functions.php @@ -294,4 +294,9 @@ function html_select_array($data,$opt=array()) { return $html; } + /* + if (preg_match('/^(1)?$/',$this->db->p('header'))) echo $this->{"rows_begin_$format"}($this->fields()); + echo $this->{"rows_rec_$format"}($row); + echo $this->{"rows_end_$format"}($opt); +*/ ?> diff --git a/lib/php/test.php b/lib/php/test.php old mode 100644 new mode 100755 index f4397726..37574f3f --- a/lib/php/test.php +++ b/lib/php/test.php @@ -1,3 +1,4 @@ +#!/usr/bin/env php -q
'.$this->url_sort($f).'
'.DB_HTML_EDIT.''.$v.''.DB_HTML_DELETE.'