From: Nicolas Boisselier Date: Fri, 16 Dec 2016 16:24:36 +0000 (+0000) Subject: dbq X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=ae781e4cdb9e5831a49e3cf5ba2a6d75ec2c899e;p=nb.git dbq --- diff --git a/lib/php/db/table.php b/lib/php/db/table.php index a0b09033..863728c6 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -415,8 +415,6 @@ Class Table extends nb { if ($values === null) $values = $this->p(); if (!is_array($values)) $values = [$values]; $fields = array_filter($this->fields(),function($v){return empty($v->extra);}); - #$fields = $this->fields(); - #debug($fields); $where = $this->where($fields,$values); if (empty($where)) { @@ -1563,7 +1561,7 @@ Class Table extends nb { public function out($v,$head=[],$conf=[]) { return $this->db()->out($v,$head,$conf); } - private function url_referer($default='') { + public function url_referer($default='') { if (self::p('referer')) { return urldecode($this->p('referer')); } elseif(!empty($default)) { diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index 1147cf16..7405ce61 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -228,7 +228,7 @@ table.rows th, table.rows td { border-color: '.$this->colors['body-border'].'; } #if (!$keys) return; #$this->not_implemented('Table has no fields'); #bye(array_combine($keys,$values)); - $this->table->html_edit(array_combine($keys,$values),'?',$add); + $this->table->html_edit(array_combine($keys,$values),$this->table->base.($add ? 'insert/' : 'update/'),$add); } public function table_rows($fct=null) { @@ -519,15 +519,15 @@ table.rows th, table.rows td { border-color: '.$this->colors['body-border'].'; } } elseif ($action == 'insert' and $this->perm >= self::WRITE) { if (!$this->table->insert($_POST)) $this->error('insert'); - header('Location: '.$this->page->url_referer()); + header('Location: '.$this->table->base); } elseif ($action == 'update' and $this->perm >= self::WRITE) { if (!$this->table->update($_POST)) $this->error('update'); - header('Location: '.$this->page->url_referer()); + header('Location: '.$this->table->base); } elseif ($action == 'rm' and $this->perm >= self::DELETE) { - if (!$this->table->delete($_POST)) $this->error('rm'); - header('Location: '.$this->page->url_referer()); + if (!$this->table->delete($_POST)) 1;#$this->error('rm'); + header('Location: '.$this->table->base); } else {