]> git.nbdom.net Git - nb.git/commitdiff
Bed
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 10 Jan 2017 00:51:22 +0000 (00:51 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 10 Jan 2017 00:51:22 +0000 (00:51 +0000)
bin/nb-commit
www/dbq/dbq.php
www/dbq/etc/nginx/default.conf
www/dbq/html/default.js
www/dbq/html/default.min.css
www/dbq/html/default.min.js
www/dbq/minify.sh [deleted file]
www/dbq/update.sh [new file with mode: 0755]

index 15f54cad35a7e804833b2b1162caa624d444faa6..688bdcad72fa18524890770908ee3c064d21e2ae 100755 (executable)
@@ -10,6 +10,9 @@ set -e
 
 cd $NB_ROOT || exit
 
+for f in www/*/update.sh; do
+  [ -x "$f" ] || continue
+  $f
+done
 share/db/update.sh
-
 which docker 1> /dev/null && docker run --rm -v $NB_ROOT:$NB_ROOT alpine sh -c "(. $NB_ROOT/etc/profile && nb_repos) >/dev/null && echo Docker: OK"
index ba318e59bef2e05bd8bb3c8ca1b7879f3bcf5d72..0d48d957472dbc62fd56d12677d79b047cdc8556 100644 (file)
@@ -33,7 +33,7 @@ class DbQ extends nb {
     'action' => '',
     'args' => '',
   ];
-# NB 23.12.16   public $params_deep = [];
+  public $params_deep = []; # contain index in case if we decide to use a regexp
 
   # Db
   public $limits = [];
@@ -44,6 +44,9 @@ class DbQ extends nb {
   public $js = '/default'.(PRODUCTION ? '.min' : '').'.js';
   public $ext;
 
+  # Others
+  public $expode_args = '&';
+
   # Object
   public $page;
   public $table;
@@ -53,6 +56,10 @@ class DbQ extends nb {
     //
     // Pre defaults values
 
+    //
+    // Init
+    $this->parse_uri();
+
     // Envs -> var
     foreach ([
       'perm',
@@ -75,9 +82,6 @@ class DbQ extends nb {
       if (!empty($_SERVER[$env])) $this->params[$k] = $_SERVER[$env];
     }
 
-    //
-    // Init
-    $this->uri_params();
     $run = isset($opt['run']) ? $opt['run'] : false;
     unset($opt['run']);
 
@@ -95,6 +99,12 @@ class DbQ extends nb {
     if ($run) $this->run();
   }
 
+  public function json() {
+    $rows = [];
+    foreach ($this->json as $k=>$v) $rows[] = ['name'=>$k,'value'=>$v];
+    return $rows;
+  }
+
   public function limit($set=false) {
     static $limit=false;
     if ($set !== false) return ($limit=$set);
@@ -116,8 +126,7 @@ class DbQ extends nb {
 
       $this->page->headers_no_cache();
       $this->page->js = $this->js;
-      $this->page->js_code = 'window._dbq = '
-        . json_encode([
+      $this->json = [
         'db.base' => ( empty($this->db) ? '' : $this->db->base ),
         'table.base' => ( empty($this->table) ? '' : $this->table->base ),
         'default.format' => $this->format_html,
@@ -127,8 +136,9 @@ class DbQ extends nb {
         'param.table' => $this->params['table'],
         'param.action' => $this->params['action'],
         'param.args' => $this->params['args'],
-        ])
-      .'';
+        'param.deep' => $this->params_deep,
+      ];
+      $this->page->js_code = 'window._dbq = '.json_encode($this->json);
 
       list($title,$nav) = $this->title_nav();
       $this->page->title = join($this->sep_title,$title);
@@ -180,7 +190,7 @@ class DbQ extends nb {
       $this->db->__construct($connect);
       $this->id = $this->params['db'];
       $this->db->connect();
-      $this->db->base = '/'.$this->db->id.'/';
+      $this->db->base = '/'.$this->db->id;
       return $this->db;
     }
 
@@ -205,7 +215,7 @@ class DbQ extends nb {
       require_once(NB_ROOT.'/lib/php/db/config.php');
     }
     $this->db = new Db(['conf'=>$DB_CONFS]);
-    $this->db->base = '/';
+    $this->db->base = '';
 
     return $this->db;
   }
@@ -222,7 +232,7 @@ class DbQ extends nb {
 
     $values = $add ? array_fill(0,count($keys),'') : explode($this->param_args_sep,$this->params['args']);
 
-    $this->table->html_edit(array_combine($keys,$values),$this->table->base.($add ? 'insert/' : 'update/').$this->params['args'],$add);
+    $this->table->html_edit(array_combine($keys,$values),$this->table->base.($add ? 'insert' : 'update').'/'.$this->params['args'],$add);
   }
 
   public function table_rows($fct=null) {
@@ -240,11 +250,11 @@ class DbQ extends nb {
         $args = $GLOBALS['dbq_args'];
 
         $r = ['Vew' => join(' ',[
-          '<a class="button select" href="'.$this->table->base.'vi/'.$args.'">View</a>'
+          '<a class="button select" href="'.$this->table->base.'/vi/'.$args.'">View</a>'
         ]) ] + $r;
 
         if ($this->perm < self::DELETE) return;
-        $rm = $this->table->base.'rm/'.$args;
+        $rm = $this->table->base.'/rm/'.$args;
         $r['Delete'] = ''
           .'<form action="'.$rm.'" method="post">'
           .'<a class="button" href="'.$rm.'" onclick="parentNode.submit();return false;">Delete</a>'
@@ -289,7 +299,7 @@ class DbQ extends nb {
       #'params' => [ 'limit' ],
     ]);
 
-    $this->table->base = $this->db->base.$this->table->name.'/';
+    $this->table->base = $this->db->base.'/'.$this->table->name;
 
   }
 
@@ -300,7 +310,6 @@ class DbQ extends nb {
     $title = array_filter(array_unique(array_slice(array_values($params),1)),
       function($v){
         return(in_array($v,self::ACTIONS_NO_TITLE) ? '' : $v);
-# NB 07.01.17         return($v==self::PARAM_DB_DEFAULT ? '' : $v);
       }
     );
 
@@ -328,7 +337,7 @@ class DbQ extends nb {
     return [$title,$nav];
   }
 
-  public function uri_params() {
+  public function parse_uri() {
     #
     # Parse path, respect params order
     #
@@ -340,7 +349,7 @@ class DbQ extends nb {
 
     list ($path,$args) = strpos($_SERVER['REQUEST_URI'],'?') ? explode('?',$_SERVER['REQUEST_URI']) : [$_SERVER['REQUEST_URI'],''];
     $this->uri = $path;
-    $this->uri_params = $args;
+    $this->uri_params = explode($this->expode_args,$args);
 
     if (preg_match('/\.(\w+)$/',$path,$m)) {
       $values[] = $m[1];
@@ -355,8 +364,10 @@ class DbQ extends nb {
     $i=0;
     $count = count($values);
     #var_export($values);
+
     foreach ($this->params as $p => $default) {
       #if ($i>=$count) break;
+
       if ($i<$count) {
 
         # Can be overwrite by get request
@@ -377,9 +388,11 @@ class DbQ extends nb {
 
         }
 
+        $this->params_deep[$p] = $i;
       }
+
       $i++;
-# NB 23.12.16       $this->params_deep[$p] = $i;
+
     }
 
     return $this->params;
@@ -421,9 +434,44 @@ class DbQ extends nb {
     exit;
   }
 
-  public function status() {
+  public function status() { #$this->perm--;
     $rows = [];
 
+    // Client headers
+    foreach ($this->client_header() as $k=>$v) $rows[] = [
+      'name' => 'client.header.'.$k,
+      'value' => ( is_scalar($v) ? $v : json_encode($v) ),
+    ];
+
+    // Server
+    foreach ([
+      'addr',
+      'port',
+      'software',
+    ] as $k) {
+      if ($this->perm < self::ADMIN and $k == 'software') continue;
+
+      $v = 'SERVER_'.strtoupper($k);
+      $v = isset($_SERVER[$v]) ? $_SERVER[$v] : '';
+      if ($v==='') continue;
+
+      $rows[] = [ 'name' => 'server.'.$k, 'value' => $v ];
+    }
+
+    // Admin or bye !
+    if ($this->perm < self::ADMIN) return $rows;
+
+    /*
+    // Headers sent
+    foreach (headers_list() as $v) {
+      list($k,$v) = explode(': ',$v);
+      $rows[] = [
+        'name' => 'server.header.'.$k,
+        'value' => ( is_scalar($v) ? $v : json_encode($v) ),
+      ];
+    }
+    */
+
     // Dbq
     if ($this->client_content_type()) $rows[] = [
       'name' => 'dbq.client_content_type',
@@ -450,45 +498,11 @@ class DbQ extends nb {
       }
     }
 
-    // Client headers
-    foreach ([
-      'addr',
-    ] as $k) {
-      $v = 'REMORE_'.strtoupper($k);
-      $v = isset($_SERVER[$v]) ? $_SERVER[$v] : '';
-      if ($v==='') continue;
-      $rows[] = [ 'name' => 'server.'.$k, 'value' => $v ];
-    }
-    foreach ($this->client_header() as $k=>$v) $rows[] = [
-      'name' => 'client.header.'.$k,
-      'value' => ( is_scalar($v) ? $v : json_encode($v) ),
-    ];
-
-    // Envs
-    foreach ([
-      'addr',
-      'port',
-      'software',
-    ] as $k) {
-      $v = 'SERVER_'.strtoupper($k);
-      $v = isset($_SERVER[$v]) ? $_SERVER[$v] : '';
-      if ($v==='') continue;
-      $rows[] = [ 'name' => 'server.'.$k, 'value' => $v ];
-    }
-
-    // Server headers
-    foreach (headers_list() as $v) {
-      list($k,$v) = explode(': ',$v);
-      $rows[] = [
-        'name' => 'server.header.'.$k,
-        'value' => ( is_scalar($v) ? $v : json_encode($v) ),
-      ];
-    }
-
     return $rows;
   }
 
-  public function init() {
+  public function run_init() {
+    $this->db();
 
     // Format first !
     if ($this->params['format']) {
@@ -592,7 +606,7 @@ class DbQ extends nb {
         [ 'status', 'Status infos page' ],
       ],['command','description'],function(&$r) {
         $r['command'] = $this->page->tag('a',$r['command'],'href="'
-          .$this->db->base.($r['command'] == self::PARAM_DB_DEFAULT
+          .$this->db->base.'/'.($r['command'] == self::PARAM_DB_DEFAULT
             ? ''
             : $r['command'].'.'.$this->ext
           )
@@ -603,7 +617,7 @@ class DbQ extends nb {
       #$this->params += [ 'db' => '', 'table' => '', 'action' => '' ];
       #$this->params = array_merge($this->params,[ 'db' => '', 'table' => '', 'action' => '' ]);
       $this->page($this->db,'ls',[],function(&$r){
-        $r['id'] = $this->page->tag('a',$r['id'],'href="'.$this->db->base.$r['id'].'.'.$this->ext.'"');
+        $r['id'] = $this->page->tag('a',$r['id'],'href="'.$this->db->base.'/'.$r['id'].'.'.$this->ext.'"');
       });
 
     } elseif ($action == 'cryptkey') {
@@ -615,6 +629,9 @@ class DbQ extends nb {
     } elseif ($this->perm < self::ADMIN) {
       // NOW ONLY FOR ADMIN !
 
+    } elseif ($action == 'json') {
+      $this->page($this,'json');
+
     } elseif ($action == 'phpinfo') {
       #$this->page(['phpinfo'=>$this->page->phpinfo(true)]);
       #$this->page($this->page->phpinfo());
@@ -647,7 +664,7 @@ class DbQ extends nb {
         [ 'ls', 'List tables' ],
       ],['command','description'],function(&$r){
         $r['command'] = $this->page->tag('a',$r['command'],'href="'
-          .$this->db->base.($r['command'] == self::PARAM_DB_DEFAULT
+          .$this->db->base.'/'.($r['command'] == self::PARAM_DB_DEFAULT
             ? ''
             : $r['command'].'.'.$this->ext
           )
@@ -656,7 +673,7 @@ class DbQ extends nb {
 
     } elseif ($action == 'ls') {
       $this->page('',$this->db->tables_rows(),[],function(&$r){
-        $r['name'] = $this->page->tag('a',$r['name'],'href="'.$this->db->base.$r['name'].'.'.$this->ext.'"');
+        $r['name'] = $this->page->tag('a',$r['name'],'href="'.$this->db->base.'/'.$r['name'].'.'.$this->ext.'"');
       });
 
     } elseif ($action == 'status') {
@@ -688,7 +705,7 @@ class DbQ extends nb {
         [ 'status', 'Status page' ],
       ],['command','description'],function(&$r){
         $r['command'] = $this->page->tag('a',$r['command'],'href="'
-          .$this->table->base.($r['command'] == self::PARAM_DB_DEFAULT
+          .$this->table->base.'/'.($r['command'] == self::PARAM_DB_DEFAULT
             ? ''
             : $r['command'].'.'.$this->ext
           )
@@ -712,16 +729,16 @@ class DbQ extends nb {
 
     } elseif ($action == 'insert' and $this->perm >= self::WRITE) {
       if (!$this->table->insert($_POST,$info)) $this->error('insert: '.print_r($info,true));
-      header('Location: '.$this->table->base);
+      header('Location: '.$this->table->base.'/');
 
     } elseif ($action == 'update' and $this->perm >= self::WRITE) {
     # NB 19.12.16: TODO NOT WORKING with update using replace 
       if (!$this->table->replace($_POST,$info)) $this->error('update: '.print_r($info,true));
-      header('Location: '.$this->table->base);
+      header('Location: '.$this->table->base.'/');
 
     } elseif ($action == 'rm' and $this->perm >= self::DELETE) {
       if (!$this->table->delete($_POST,$info)) $this->error('rm: '.print_r($info,true));
-      header('Location: '.$this->table->base);
+      header('Location: '.$this->table->base.'/');
 
 
     } else {
@@ -733,10 +750,9 @@ class DbQ extends nb {
   public function run() {
 
     #
-    # Db Init
+    # Init
     #
-    $this->db();
-    $this->init();
+    $this->run_init();
 
     #
     # Root Actions
index dbafb366f1e78145e9119176425c3c95db1a358c..aa5577b3d11656de01b56517891902e7ce1444ea 100644 (file)
@@ -28,9 +28,7 @@ server {
 
                #--------------------------------------------------------------#
                # Deny
-    location ~ /\.ht {
-        deny all;
-    }
+    location ~ /\.ht { deny all; }
 
                #--------------------------------------------------------------#
                # serve static files directly
@@ -59,7 +57,7 @@ server {
 
         fastcgi_param DBQ_CONF_FILE $document_root/../../../etc/dbq/000-local.php;
         fastcgi_param DBQ_PERM 0;
-        fastcgi_param DBQ_PARAM_DB ls;
+# NB 09.01.17         fastcgi_param DBQ_PARAM_DB ls;
         fastcgi_param PRODUCTION 1;
     }
 
index 0f70bcb0275d982e381b23137ef070b320d170de..15f9c5d436723cedbb17f1660921c9b19ec3d2a3 100644 (file)
@@ -55,6 +55,8 @@ document.addEventListener("DOMContentLoaded", function() {
   /* Clean when submit */
   document.querySelectorAll("form").forEach(function(e) {
     e.onsubmit = function() {
+      var limit = this.elements['limit'];
+      if (limit.value == window._dbq['default_limit']) limit.removeAttribute("value");
       return form_submit_clean(this);
     };
   });
@@ -69,8 +71,8 @@ document.addEventListener("DOMContentLoaded", function() {
     form.querySelectorAll("form.menu select.format").forEach(function(e) {
       e.removeAttribute('name');
       e.onchange = function() {
-        this.form.setAttribute('action',this.form.getAttribute('action').replace(/^(.*\/[^\.?\/]+)(\.\w+)?/,'$1.'+this.value));
-        this.form.onsubmit();
+        this.form.setAttribute('action',window._dbq['table.base']+'.'+this.value);
+        return this.form.onsubmit();
         return false;
       }
     });
@@ -79,15 +81,18 @@ document.addEventListener("DOMContentLoaded", function() {
     form.querySelectorAll("form.menu select.tables").forEach(function(e) {
       e.removeAttribute('name');
       e.onchange = function() {
-        this.form.setAttribute('action',this.form.getAttribute('action').replace(/^(.*\/)[^\/\.\?]+/,'$1'+this.value));
+        this.form.setAttribute('action',window._dbq['db.base']+'/'+this.value+'.html');
         return this.form.onsubmit();
       }
     });
 
     /* Limit */
+    /*
+    // NB 10.01.17: TODEL DONE ON SUBMIT 
     form.querySelectorAll("form.menu select.limit option").forEach(function(e) {
       if (e.value == window._dbq["default.limit"]) e.setAttribute('value','');
     });
+    */
 
     /* Auto submit */
     form.querySelectorAll("form.menu select.limit").forEach(function(e) {
index 6a3cbe59bbddfced36fc7957ed4fa332add30428..31acc87da2ea38aa89f8a33a42f2ed62e3fbd84f 100644 (file)
@@ -1 +1 @@
-html{font:90% 'Trebuchet MS',sans-serif;background-color:#eee}body{display:table;margin-left:auto;margin-right:auto;padding-left:1em;padding-right:1em;color:#444}h1{margin:0 0 0.2em 0}a{color:inherit}a,a:visited{text-decoration:none}ul{padding:0;margin:0}li{list-style:none;padding:0 0 0 0.3em}table{border-collapse:collapse}td,th{padding:0.2em 0.7em}th a.sort{padding:0 0.3em}textarea,select,input:not([type]),input[type='text'],input[type='password'],input[type='date'],input[type='email'],input[type='url'],input[type='']{border-radius:3px;border:solid 1px #ddd;padding:0.3em 0.4em}input[size]{max-width:70%}div.row div label:after,form label:after{content:':'}form label,form input,form select{vertical-align:middle;margin:0.2em 0.4em 0.2em 0}table.rows,div.row,form.edit,.menu,.block,object,iframe,pre{border-radius:4px;border-collapse:separate;border-spacing:0;padding:0.5em 0.2em;margin-bottom:0.5em;border:solid 1px #ccc}.rows{padding:0}div.row div,table.rows th,table.rows td{border-bottom:solid 1px #ccc}div.row div,table.rows tr:last-child td{border-bottom:none}div.row div{margin:0}div.row div label{padding:0.1em 0.5em 0.1em 0;min-width:20%;display:inline-block}.menu,.nav,.rows,.buttons,.center{margin-left:auto;margin-right:auto;display:table}.button{font:inherit;display:inline-block;text-decoration:none;line-height:1.5em;cursor:pointer;border-radius:4px;white-space:nowrap;box-sizing:border-box;margin:0;padding:0 0.2em;color:#eee;border:solid 1px #000;background-color:#444}a:hover,.button:hover{opacity:0.8}form.menu{padding:0.5em;background-color:#F9F9F9}form.menu .button.add{float:right}form.menu .criterias{border-top:dashed 1px #ccc;margin-top:0.3em;padding-top:0.3em}form.menu .criterias span.label{border-right:solid 1px #fff;padding:0.2em 0.1em;margin:0.2em 0.2em 0 0;border-radius:3px}form.menu .criterias span.label:last-child{border-right:none}form.menu select:focus{max-width:auto}form.menu select{max-width:15%}form.menu .criterias input[type=text]:focus{width:auto}form.menu .criterias input[type=text]{width:4em}form.edit .fields label{width:25%;text-align:right;display:inline-block;margin-right:1em;vertical-align:top}form.edit .fields .label span{width:54%;display:inline-block;text-align:left}form.edit .fields input,form.edit .fields textarea,form.edit .fields select{width:65%}form.edit .fields label{width:25%;text-align:right;display:inline-block;margin-right:1em;vertical-align:top}form.edit .fields .label span{width:54%;display:inline-block;text-align:left}form.edit .fields input,form.edit .fields textarea,form.edit .fields select{width:65%}
\ No newline at end of file
+html{font:90% 'Trebuchet MS',sans-serif;background-color:#eee}body{display:table;margin-left:auto;margin-right:auto;padding-left:1em;padding-right:1em;color:#444}h1{margin:0 0 0.2em 0}a{color:inherit}a,a:visited{text-decoration:none}ul{padding:0;margin:0}li{list-style:none;padding:0 0 0 0.3em}table{border-collapse:collapse}td,th{padding:0.2em 0.7em}th a.sort{padding:0 0.3em}textarea,select,input:not([type]),input[type='text'],input[type='password'],input[type='date'],input[type='email'],input[type='url'],input[type='']{border-radius:3px;border:solid 1px #ddd;padding:0.3em 0.4em}input[size]{max-width:70%}div.row div label:after,form label:after{content:':'}form label,form input,form select{vertical-align:middle;margin:0.2em 0.4em 0.2em 0}table.rows,div.row,ul.row,form.edit,.menu,.block,object,iframe,pre{border-radius:4px;border-collapse:separate;border-spacing:0;padding:0.5em 0.2em;margin-bottom:0.5em;border:solid 1px #ccc}.rows{padding:0}ul.row li,div.row div,table.rows th,table.rows td{border-bottom:solid 1px #ccc}ul.row li,div.row div,table.rows tr:last-child td{border-bottom:none}div.row div{margin:0}ul.row li label,div.row div label{padding:0.1em 0.5em 0.1em 0;min-width:20%;display:inline-block}.menu,.nav,.rows,.buttons,.center{margin-left:auto;margin-right:auto;display:table}.button{font:inherit;display:inline-block;text-decoration:none;line-height:1.5em;cursor:pointer;border-radius:4px;white-space:nowrap;box-sizing:border-box;margin:0;padding:0 0.2em;color:#eee;border:solid 1px #000;background-color:#444}a:hover,.button:hover{opacity:0.8}form.menu{padding:0.5em;background-color:#F9F9F9}form.menu .button.add{float:right;margin-top:0.1em}form.menu .criterias{border-top:dashed 1px #ccc;margin-top:0.3em;padding-top:0.3em}form.menu .criterias span.label{border-right:solid 1px #fff;padding:0.2em 0.1em;margin:0.2em 0.2em 0 0;border-radius:3px}form.menu .criterias span.label:last-child{border-right:none}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.edit .fields label{width:25%;text-align:right;display:inline-block;margin-right:1em;vertical-align:top}form.edit .fields .label span{width:54%;display:inline-block;text-align:left}form.edit .fields input,form.edit .fields textarea,form.edit .fields select{width:65%}form.edit .fields label{width:25%;text-align:right;display:inline-block;margin-right:1em;vertical-align:top}form.edit .fields .label span{width:54%;display:inline-block;text-align:left}
\ No newline at end of file
index c947a76cf5ad59596b3baea32db8893ca1f066cb..02fa8efcb25f5a805e53760aab46d233a772cdec 100644 (file)
@@ -2,4 +2,5 @@ function form_clean(e){var t
 for(i=0;i<e.length;i++)t=e.elements[i],"none"!=t.style.display&&("text"==t.type?t.value="":!t.type.match(/^select/)||"limit"!=t.name&&"format"!=t.name||(t.selectedIndex=0))}function form_submit_clean(e){var t=0,n="",o=e.getAttribute("action"),r=e.getAttribute("method")
 if("get"!=r)return!0
 for(t=0;t<e.length;t++){var i=e[t]
-i.name&&""!=i.value&&"undefined"!=i.value&&(n+=(n?"&":"?")+encodeURI(i.name)+"="+encodeURI(i.value))}return n=("?"==o?"":o)+n,window.location=n,!1}document.addEventListener("DOMContentLoaded",function(){NodeList.prototype.forEach=Array.prototype.forEach,document.querySelectorAll("form").forEach(function(e){e.onsubmit=function(){return form_submit_clean(this)}}),document.querySelectorAll("form.menu").forEach(function(e){e.setAttribute("action",window.location.toString().replace(/\?.*$/,"")),e.querySelectorAll("form.menu select.format").forEach(function(e){e.removeAttribute("name"),e.onchange=function(){return this.form.setAttribute("action",this.form.getAttribute("action").replace(/^(.*\/[^\.?\/]+)(\.\w+)?/,"$1."+this.value)),this.form.onsubmit(),!1}}),e.querySelectorAll("form.menu select.tables").forEach(function(e){e.removeAttribute("name"),e.onchange=function(){return this.form.setAttribute("action",this.form.getAttribute("action").replace(/^(.*\/)[^\/\.\?]+/,"$1"+this.value)),this.form.onsubmit()}}),e.querySelectorAll("form.menu select.limit option").forEach(function(e){e.value==window._dbq["default.limit"]&&e.setAttribute("value","")}),e.querySelectorAll("form.menu select.limit").forEach(function(e){e.onchange=function(){return this.form.onsubmit()}})}),document.querySelector(".nav.bottom")&&document.querySelector("table.rows")&&document.querySelector("table.rows").insertAdjacentHTML("beforebegin",'<div class="nav top">'+document.querySelector(".nav.bottom").innerHTML+"</div>"),document.querySelectorAll("form.menu input[type=submit]").forEach(function(e){e.insertAdjacentHTML("afterend",'&nbsp;<input type="button" class="clear '+e.className+'" onclick="form_clean(this.form)" value="Clear"/>'+(window._dbq["table.base"]?'&nbsp;<input type="button" class="add '+e.className+'" onclick="window.location=\''+window._dbq["table.base"]+'add/\'" value="Add"/>':""))})})
+i.name&&""!=i.value&&"undefined"!=i.value&&(n+=(n?"&":"?")+encodeURI(i.name)+"="+encodeURI(i.value))}return n=("?"==o?"":o)+n,e.reset(),window.location=n,!1}document.addEventListener("DOMContentLoaded",function(){NodeList.prototype.forEach=Array.prototype.forEach,document.querySelectorAll("form").forEach(function(e){e.onsubmit=function(){this.elements.limit
+return form_submit_clean(this)}}),document.querySelectorAll("form.menu").forEach(function(e){e.setAttribute("action",window.location.toString().replace(/\?.*$/,"")),e.querySelectorAll("form.menu select.format").forEach(function(e){e.removeAttribute("name"),e.onchange=function(){return this.form.setAttribute("action",window._dbq["table.base"]+"."+this.value),this.form.onsubmit()}}),e.querySelectorAll("form.menu select.tables").forEach(function(e){e.removeAttribute("name"),e.onchange=function(){return this.form.setAttribute("action",window._dbq["db.base"]+"/"+this.value+".html"),this.form.onsubmit()}}),e.querySelectorAll("form.menu select.limit option").forEach(function(e){e.value==window._dbq["default.limit"]&&e.setAttribute("value","")}),e.querySelectorAll("form.menu select.limit").forEach(function(e){e.onchange=function(){return this.form.onsubmit()}})}),document.querySelector(".nav.bottom")&&document.querySelector("table.rows")&&document.querySelector("table.rows").insertAdjacentHTML("beforebegin",'<div class="nav top">'+document.querySelector(".nav.bottom").innerHTML+"</div>"),document.querySelectorAll("form.menu input[type=submit]").forEach(function(e){e.insertAdjacentHTML("afterend",'&nbsp;<input type="button" class="clear '+e.className+'" onclick="form_clean(this.form)" value="Clear"/>'+(window._dbq["table.base"]?'&nbsp;<input type="button" class="add '+e.className+'" onclick="window.location=\''+window._dbq["table.base"]+'add/\'" value="Add"/>':""))})})
diff --git a/www/dbq/minify.sh b/www/dbq/minify.sh
deleted file mode 100755 (executable)
index 5e4b551..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env sh
-set -e
-cd "$(dirname $0)" 
-
-minify -s '.min.' --no-comments html/
-exit
-
-# NB 27.12.16 alias minify='minify --no-comments'
-# NB 27.12.16 
-# NB 27.12.16 echo Create html/default.min.css
-# NB 27.12.16 minify -o html/default.min.css html/default.css
-# NB 27.12.16 echo
-# NB 27.12.16 
-# NB 27.12.16 echo Create html/default.min.js
-# NB 27.12.16 minify -o html/default.min.js html/default.js
-# NB 27.12.16 echo
diff --git a/www/dbq/update.sh b/www/dbq/update.sh
new file mode 100755 (executable)
index 0000000..5e4b551
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/env sh
+set -e
+cd "$(dirname $0)" 
+
+minify -s '.min.' --no-comments html/
+exit
+
+# NB 27.12.16 alias minify='minify --no-comments'
+# NB 27.12.16 
+# NB 27.12.16 echo Create html/default.min.css
+# NB 27.12.16 minify -o html/default.min.css html/default.css
+# NB 27.12.16 echo
+# NB 27.12.16 
+# NB 27.12.16 echo Create html/default.min.js
+# NB 27.12.16 minify -o html/default.min.js html/default.js
+# NB 27.12.16 echo