From b8b3c42fce7f916fdb2157fd8a0e7a34a3dd6854 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Fri, 20 Jan 2017 12:23:50 +0000 Subject: [PATCH] table rows button only when rw --- www/dbq/dbq.php | 18 +++++++++++++----- www/dbq/html/default.css | 3 +-- www/dbq/html/default.js | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index 6924dae7..8c4825a4 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -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'); diff --git a/www/dbq/html/default.css b/www/dbq/html/default.css index a412266e..243f3372 100644 --- a/www/dbq/html/default.css +++ b/www/dbq/html/default.css @@ -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; diff --git a/www/dbq/html/default.js b/www/dbq/html/default.js index 667c1305..02e54a01 100644 --- a/www/dbq/html/default.js +++ b/www/dbq/html/default.js @@ -129,7 +129,7 @@ document.addEventListener("DOMContentLoaded", function() { +' ' - +( window._dbq['table.base'] + +( window._dbq['table.rw'] ? ' ' -- 2.47.3