]> git.nbdom.net Git - nb.git/commitdiff
table rows button only when rw
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 20 Jan 2017 12:23:50 +0000 (12:23 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 20 Jan 2017 12:23:50 +0000 (12:23 +0000)
www/dbq/dbq.php
www/dbq/html/default.css
www/dbq/html/default.js

index 6924dae72ea3069b90279f0c53bacd9334f40e87..8c4825a46588795b02e41a3881d981def7fa8d11 100644 (file)
@@ -134,6 +134,7 @@ class DbQ extends nb {
       $this->json = [
         'db.base' => ( empty($this->db) ? '' : $this->db->base ),
         'table.base' => ( empty($this->table) ? '' : $this->table->base ),
+        'table.rw' => $this->table_rw(),
         'default.format' => $this->format_html,
         'default.limit' => $this->default_limit,
         'param.format' => $this->params['format'],
@@ -249,18 +250,25 @@ class DbQ extends nb {
     $this->table->html_edit(array_combine($keys,$values),$this->table->base.($add ? 'insert' : 'update').'/'.$this->params['args'],$add);
   }
 
+  public function table_rw() {
+    return 1
+      and ($this->perm >= self::VIEW)
+      and !empty($this->table)
+      and ( strpos('table view',$this->table->type()) !== false )
+    ;
+  }
   public function table_rows($fct=null) {
     $this->db->limit = $this->limit();
 
     $opt = ($this->page->is('html')
-      and ($this->perm >= self::VIEW)
-      and $this->table->type() != 'sql'
-      and strpos(' table view',$this->table->type())
+      and $this->table_rw()
+      #and ($this->perm >= self::VIEW)
+      #and strpos('table view',$this->table->type()) !== false
     ) ? [
       'row_parse_pre' => function(&$r){
         $GLOBALS['dbq_args'] = urlencode( join($this->param_args_sep,$this->table->fields_keys_values($r)) );
       },
-      'row_parse_post' => $this->table->type() ? 0 : function(&$r){
+      'row_parse_post' => function(&$r){
 
         $args = $GLOBALS['dbq_args'];
 
@@ -625,7 +633,7 @@ class DbQ extends nb {
     if (empty($this->db->conn)) $this->db(true);
 
     if (empty($this->table)) $this->table();
-    $this->table->base = '';
+    #$this->table->base = '';
 
     $this->page($this,'table_rows');
 
index a412266e6928214e8bdae246aa4209c8bb72979f..243f33724b7afd70b5f41f9822889c8a6b3078c1 100644 (file)
@@ -176,7 +176,7 @@ ul.row li label, div.row div label {
   border-radius: 4px;
        white-space: nowrap;
        box-sizing: border-box;
-       margin: 0;
+       margin: 0 0.1em 0 0;
   padding: 0 0.1em;
        cursor: pointer;
   padding: 0.1em 0.3em;
@@ -195,7 +195,6 @@ ul.row li label, div.row div label {
   background-color: #EEEEEE;
   background: linear-gradient(to bottom right, #EEEEEE, #DDDDDD);
 
-  margin-right: 0.1em;
   box-shadow: 0px 1px 1px #BBBBBB;
 
   font-weight: bold;
index 667c130559562a7a0cc8b4a4e181e6018e401206..02e54a0102b88dc2a109e757bdcf6cb7f52c08ee 100644 (file)
@@ -129,7 +129,7 @@ document.addEventListener("DOMContentLoaded", function() {
       +'&nbsp;<input type="button" class="clear '+e.className+'" onclick="form_clean(this.form)"'
         +' value="'+window._dbq['text.clear']+'"'
       +' />'
-      +( window._dbq['table.base']
+      +( window._dbq['table.rw']
         ? '&nbsp;<input type="button" class="add '+e.className+'"'
           +' onclick="window.location=\''+window._dbq['table.base']+'add/\'"'
           +' value="'+window._dbq['text.add']+'"/>'