From: Nicolas Boisselier Date: Sat, 26 May 2018 00:00:53 +0000 (+0100) Subject: www/dbq/dbq.php X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=fc86ff79ef6b2aeb7caa4b22501d6738142930f5;p=nb.git www/dbq/dbq.php --- diff --git a/etc/profile.d/nb.sh b/etc/profile.d/nb.sh index 519c7e92..ccc1b49a 100644 --- a/etc/profile.d/nb.sh +++ b/etc/profile.d/nb.sh @@ -92,6 +92,7 @@ nb_api() { nb_api_post() { local usage="Usage: nb_api_post TABLE field1=val1 field2=val2 ..." + local debug=0; [ "$1" = "-debug" ] && debug=1 && shift local table="${1:?$usage}"; shift local curl="nb_api /data/$table/replace.sh" @@ -101,7 +102,9 @@ nb_api_post() { curl="$curl -d \"$1\"" shift done - #echo "$curl"; return + if [ "$debug" = "1" ]; then + echo "$curl"; return + fi ( eval "$(eval "$curl")" #&& echo "$table: $rowCount: $args" ) diff --git a/lib/php/db/table.php b/lib/php/db/table.php index 69dd8ef3..4c803488 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -675,7 +675,12 @@ Class Table extends nb { private function url_sort($name) { - if (!$this->show_url_sort or !($f=$this->field($name)) or !empty($f->dyn) or $f->is_encrypt()) return self::prettyText($name); + if (0 + or !$this->show_url_sort + or !($f=$this->field($name)) + or !empty($f->dyn) + or $f->is_encrypt() + ) return self::prettyText($name); #debug($f); # See: http://dev.w3.org/html5/html-author/charref diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index f0814e96..e93d2b6e 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -303,15 +303,11 @@ class DbQ extends nb { ; if ($this->base) $this->page->head[] = ''; -#debug($this->base); $this->page->begin(); - } else { - #$this->db->is_html = false; + } # if (empty($this->_nopage)) { - #die($obj); - #if (is_scalar($obj)) { $conf = ['row_parse_post'=>$fct]; $rows = ''; @@ -511,8 +507,10 @@ class DbQ extends nb { $ropt = [ 'html_menu' => empty($this->_nopage), ]; + if (!empty($this->_nopage)) { + $this->table->show_url_sort = false; + } - #if (!empty($this->_nopage)) $this->db-> $this->row_parse_pre(); $this->row_parse_post(); @@ -650,14 +648,14 @@ class DbQ extends nb { } - $path = '/'; + $path = $this->base . '/'; $nav = []; $i = 0; foreach ($title as $k=>$v) { if ($i == 0) { - $nav[] = [$v,'/']; + $nav[] = [$v,$this->base . '/']; } else { diff --git a/www/dbq/html/default.css b/www/dbq/html/default.css index fc3f2fea..3f86da04 100644 --- a/www/dbq/html/default.css +++ b/www/dbq/html/default.css @@ -107,7 +107,8 @@ input[size] { } div.row div label:after, -form label:after { content: ':'; } +form label:after +{ content: ':'; } form label, form input, diff --git a/www/dbq/html/default.js b/www/dbq/html/default.js index 5dcad7d4..d2a996d6 100644 --- a/www/dbq/html/default.js +++ b/www/dbq/html/default.js @@ -133,6 +133,9 @@ document.addEventListener("DOMContentLoaded", function() { document.querySelector("th.delete").appendChild(a); } + // + // h1 to select links + // if (document.querySelector("body.no-db")) document.querySelectorAll("body > h1 a.db, body > h1 a.table").forEach(function(e) { var base = window._dbq[e.className+'.base'].replace(/\/[^\/]+$/,'');