]> git.nbdom.net Git - nb.git/commitdiff
www/dbq/dbq.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 22 May 2018 04:08:08 +0000 (05:08 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 22 May 2018 04:08:08 +0000 (05:08 +0100)
lib/lua/nb.lua
lib/php/db/table.php
www/dbq/dbq.php

index 667993048b3b1733e26d8e625f623d38ff4e5b5a..c9e0295a0a3d88482d21fae4cdbb1b356fda9457 100644 (file)
@@ -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 = '<div class="md">' .. content .. '</div>'
+       end
        return content
 end
 
index f7d7811abca4a1081ade4399942b101ca41ad5e0..0f50b8f7db473704a170c0eec4dbae4c02fff105 100644 (file)
@@ -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);
index 260fa8258d9ba1a9786f56121f2983bee04c6f71..6fb70fc3588d7ef9853fe2d2f30d1b861452f7d9 100644 (file)
@@ -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[] = '<base href="' . $this->base . '" />';
+                       if ($this->base) $this->page->head[] = '<base href="' . $this->base . '/" />';
+#debug($this->base);
 
                        $this->page->begin();
                } # if (empty($this->_nopage)) {
@@ -333,8 +342,8 @@ class DbQ extends nb {
                        $bottom = [];
 
                        if ($this->http->user()) {
-                               $bottom[] = '<a href="/logout"'
-                                       .($this->http->user() ? ' style="background:url(\'/ldap/jpegPhoto.jpg?w=20\') right no-repeat;padding-right:22px"' : '')
+                               $bottom[] = '<a href="' . $this->base . '/logout"'
+                                       .($this->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) : ''),
+]);
 ?>