From: Nicolas Boisselier Date: Tue, 22 May 2018 04:08:08 +0000 (+0100) Subject: www/dbq/dbq.php X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=1a27b4e9b9b551681db61fe2049adb40c32603f8;p=nb.git www/dbq/dbq.php --- diff --git a/lib/lua/nb.lua b/lib/lua/nb.lua index 66799304..c9e0295a 100644 --- a/lib/lua/nb.lua +++ b/lib/lua/nb.lua @@ -130,7 +130,7 @@ function nb:ngx_location_tmpl(fheader,ffooter) .. (content:sub(p2+1)) end - content = nb:html_fix(content) + content = self:html_fix(content) template.render(content,vars) ngx.exit(0) @@ -199,6 +199,9 @@ end function nb:md2html(content) if self.discount == nil then self.discount = require("discount") end content = self.discount(content) + if content then + content = '
' .. content .. '
' + end return content end diff --git a/lib/php/db/table.php b/lib/php/db/table.php index f7d7811a..0f50b8f7 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -1331,6 +1331,7 @@ Class Table extends nb { $this->tot = $opt['tot'] = $tot; } # < is_html + if (!isset($opt['tot'])) $opt['tot'] = $opt['count']; if ($count === 0 and !$format) { echo $this->{"rows_begin_$format"}($fields,$opt); diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index 260fa825..6fb70fc3 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -262,6 +262,14 @@ class DbQ extends nb { $this->page->headers_no_cache(); $this->page->js = $this->js; + + if ($this->base) { + if (!empty($this->db)) $this->db->base = $this->base . $this->db->base; + if (!empty($this->table)) $this->table->base = $this->base . $this->table->base; + foreach( (array)$this->page->css as $k=>$v ) { $this->page->css[$k] = $this->base . $v; } + foreach( (array)$this->page->js as $k=>$v ) { $this->page->js[$k] = $this->base . $v; } + } + $this->conf = [ 'db.base' => ( empty($this->db) ? '' : $this->db->base ), 'table.base' => ( empty($this->table) ? '' : $this->table->base ), @@ -294,7 +302,8 @@ class DbQ extends nb { ; - if ($this->base) $this->page->head[] = ''; + if ($this->base) $this->page->head[] = ''; +#debug($this->base); $this->page->begin(); } # if (empty($this->_nopage)) { @@ -333,8 +342,8 @@ class DbQ extends nb { $bottom = []; if ($this->http->user()) { - $bottom[] = 'http->user() ? ' style="background:url(\'/ldap/jpegPhoto.jpg?w=20\') right no-repeat;padding-right:22px"' : '') + $bottom[] = 'http->user() ? ' style="background:url(\'' . $this->base . '/ldap/me.jpg?w=20\') right no-repeat;padding-right:22px"' : '') .'>Logout: ' .$this->http->user() .' (can: '.$this->perm2h().')' @@ -748,7 +757,6 @@ class DbQ extends nb { } - if ($base = $this->client_header('Dbq-Base')) $this->base = $base; return $this->params; } @@ -1372,5 +1380,8 @@ EOF; } } # < Class Dbq -$DBQ = new DbQ(['run'=>true]); +$DBQ = new DbQ([ + 'run' => true, + 'base' => (($base = Dbq::client_header('Dbq-Base')) ? preg_replace(',/+$,','',$base) : ''), +]); ?>