]> git.nbdom.net Git - nb.git/commitdiff
lib/php/out.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 7 Jan 2018 23:01:13 +0000 (23:01 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 7 Jan 2018 23:01:13 +0000 (23:01 +0000)
lib/php/db/table.php
lib/php/maps.php
lib/php/out.php
lib/postgres/country.sql
www/dbq/dbq.php
www/dbq/html/default.css

index 96aae863e107d892426a9b32996918c5be0a9eeb..467d45f92f3db30bb8f85972898647b9d96afe51 100644 (file)
@@ -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 .= "<label>$k</label>";
         $h .= '<input type="'.(self::p('debug')?'text':'hidden').'" name="'.$k.'" value="'.$v.'"/>'.NB_EOL;
@@ -1124,7 +1127,7 @@ Class Table extends nb {
 
     if ($opt['is_html']) {
        echo '<div class="results">'.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');
index 764a6f4ac011f3dbeda62a51cc2e9b8f43218dec..ae3f7d0bb810c4af7ca1d7eeee0acc4d43918573 100644 (file)
@@ -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) {
index 7d44d3e41931e9af216b05c1a8c27d1dc0628447..f5309b13089c6656549477b70e771ea49c184fa9 100644 (file)
@@ -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 = '<pre>'.NB_EOL.$v.NB_EOL.'</pre>';
     return $v;
index b1c1fb3e72011ff99dd2f825212536387b1b81da..5d7a5f6110203bc9ec0ae0815bb9d6b7377f35e6 100644 (file)
@@ -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 ''); 
index 4bb693e3754f2bf43c488394e452201ae1fc7c5d..05f0210f5d008c946adc9dee3f177d9a630f1e9c 100644 (file)
@@ -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('<br />'.NB_EOL,$bottom));
+                       if ($bottom and $this->page->is('html')) echo $this->page->tag('div class="block bottom"',join('<br />'.NB_EOL,$bottom));
 
                        $this->page->end();
                }
index d27ac1b01b4586c2e8161a66e7052e1ee0218f46..5d35fe941c576abea93aa348b04f8dec9be2c0f0 100644 (file)
@@ -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;