From e786626b0a3fee514c8fa2d899dbe55707e2b208 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Sun, 7 Jan 2018 23:01:13 +0000 Subject: [PATCH] lib/php/out.php --- lib/php/db/table.php | 7 +++++-- lib/php/maps.php | 2 +- lib/php/out.php | 3 ++- lib/postgres/country.sql | 1 + www/dbq/dbq.php | 4 ++-- www/dbq/html/default.css | 43 +++++++++++++++++++++++++++++++--------- 6 files changed, 45 insertions(+), 15 deletions(-) diff --git a/lib/php/db/table.php b/lib/php/db/table.php index 96aae863..467d45f9 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -498,7 +498,10 @@ Class Table extends nb { $params = self::params2hash(self::$params); } - foreach (array_diff($params,$ignore) as $k=>$v) { + #debug([$params,array_diff($params,$ignore)]); +# NB 07.01.18 foreach (array_diff($params,$ignore) as $k=>$v) { + foreach ($params as $k=>$v) { + if (!empty($ignore) and in_array($k,$ignore)) continue; if (isset($v) or $k=='action') { if (self::p('debug')) $h .= ""; $h .= ''.NB_EOL; @@ -1124,7 +1127,7 @@ Class Table extends nb { if ($opt['is_html']) { echo '
'.NB_EOL; - if ($this->show_hidden_params and !$this->p('inc')) echo $this->form_hidden(); +# NB 07.01.18 if ($this->show_hidden_params and !$this->p('inc')) echo $this->form_hidden(); } if ($opt['is_html']) $this->db()->out->type('html'); diff --git a/lib/php/maps.php b/lib/php/maps.php index 764a6f4a..ae3f7d0b 100644 --- a/lib/php/maps.php +++ b/lib/php/maps.php @@ -15,7 +15,7 @@ class Maps { } public static function link($longitude,$latitude) { - return 'http://maps.google.com/?q='.$longitude.','.$latitude; + return $_SERVER['REQUEST_SCHEME'].'://maps.google.com/?q='.$longitude.','.$latitude; } public static function html(&$r) { diff --git a/lib/php/out.php b/lib/php/out.php index 7d44d3e4..f5309b13 100644 --- a/lib/php/out.php +++ b/lib/php/out.php @@ -327,7 +327,8 @@ Class Out extends Nb { $v = self::scalar($v); if ($v==='') $is_scalar = true; - if (empty($o['no_escape'])) $v = self::escape($v); +# NB 07.01.18 if (empty($o['no_escape'])) $v = self::escape($v); + if (!empty($o['escape'])) $v = self::escape($v); if (!$is_scalar and strpos($type,'html') !== false) $v = '
'.NB_EOL.$v.NB_EOL.'
'; return $v; diff --git a/lib/postgres/country.sql b/lib/postgres/country.sql index b1c1fb3e..5d7a5f61 100644 --- a/lib/postgres/country.sql +++ b/lib/postgres/country.sql @@ -41,6 +41,7 @@ CREATE TABLE IF NOT EXISTS country ( eqfips varchar(2) ); CREATE INDEX IF NOT EXISTS country_geoid_idx ON country (geoid); +CREATE INDEX IF NOT EXISTS country_capital_idx ON country (capital); BEGIN TRANSACTION; DELETE FROM country; COPY country FROM PROGRAM 'curl -s http://download.geonames.org/export/dump/countryInfo.txt | grep -v "^#" | sed "s/\\\\/\\\\\\\\/g"' WITH (format 'text', NULL ''); diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index 4bb693e3..05f0210f 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -64,7 +64,7 @@ class DbQ extends nb { #public $limits = []; public $default_limit = '30'; public $limits = ['30','100','500','1000']; - public $formats = [ 'html','csv','xml','json','yaml','sh','sql','php' ]; + public $formats = [ 'html','div','csv','xml','json','yaml','sh','sql','php' ]; public $is_html; # Page @@ -300,7 +300,7 @@ class DbQ extends nb { $bottom[] = 'Database: '.preg_replace(array_keys($r),$r,$this->db->pdo); } - if ($bottom and $this->page->is('html')) echo $this->page->tag('div class="block" style="display:inline-block"',join('
'.NB_EOL,$bottom)); + if ($bottom and $this->page->is('html')) echo $this->page->tag('div class="block bottom"',join('
'.NB_EOL,$bottom)); $this->page->end(); } diff --git a/www/dbq/html/default.css b/www/dbq/html/default.css index d27ac1b0..5d35fe94 100644 --- a/www/dbq/html/default.css +++ b/www/dbq/html/default.css @@ -105,6 +105,9 @@ form select { margin: 0.2em 0.4em 0.2em 0; } +.rows { padding: 0; } +.rows form { display: inline-block; } + table.rows, div.row, ul.row, @@ -124,9 +127,6 @@ iframe, pre } -.rows { padding: 0; } -.rows form { display: inline-block; } - table.rows { border-style: hidden; border-collapse: collapse; @@ -165,7 +165,8 @@ table.rows td { } table.rows.fixed th, -table.rows.fixed td +table.rows.fixed td, +div.row div label { white-space: nowrap; text-overflow: ellipsis; @@ -201,6 +202,7 @@ table.rows tr:last-child td { padding-bottom: 0; } /* div.row { float: left; margin-right: 12px; min-width: 31%; } */ +div.rows { clear: both; } div.row { float: left; margin-right: 4px; min-width: 24%; } div.row div { @@ -215,7 +217,9 @@ div.row div:last-child { border-bottom: none; padding-bottom: 0; } div.row div.view label, div.row div.delete label { display: none; } div.row div.view, div.row div.delete { text-align: center; } -ul.row li label, div.row div label { +div.row div label, +ul.row li label +{ padding: 0.1em 0.5em 0.1em 0; min-width: 20%; display: inline-block; @@ -242,11 +246,22 @@ ul.row li label, div.row div label { } -.menu, .nav, .rows, td.button, .center { +.menu, +.nav, +.rows, +.bottom, +.center { + clear: both; display: table; } -.menu, .nav, .rows, .buttons, td.button, .center { +.menu, +.nav, +.rows, +.bottom, +.buttons, +td.button, +.center { margin-left: auto; margin-right: auto; } @@ -281,13 +296,19 @@ form.menu .criterias { border-top: dashed 1px #DDDDDD; margin-top: 0.3em; padding-top: 0.3em; + clear: both; } form.menu .criterias span.label { border-right: solid 1px #fff; + border-radius: 3px; + /* padding: 0.2em 0.1em; margin: 0.2em 0.2em 0 0; - border-radius: 3px; + */ + margin: 0 0.2em; + white-space: nowrap; + float: left; } form.menu .criterias span.label:last-child { @@ -298,12 +319,15 @@ form.menu select:focus { max-width: auto; } form.menu select { max-width: 20%; } -form.menu .criterias input[type=text]:focus { width: auto; } form.menu .criterias input[type=text] { width: 4em; } +/* +form.menu .criterias input[type=text]:focus { width: auto; } +*/ /* EDIT PAGE */ +div.row label, form.edit .fields label { width: 25%; text-align: right; @@ -312,6 +336,7 @@ form.edit .fields label { vertical-align: top; } +div.row .label span, form.edit .fields .label span { width: 54%; display: inline-block; -- 2.47.3