]> git.nbdom.net Git - nb.git/commitdiff
dbq
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 16 Dec 2016 16:24:36 +0000 (16:24 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 16 Dec 2016 16:24:36 +0000 (16:24 +0000)
lib/php/db/table.php
www/dbq/dbq.php

index a0b09033ee9550090437356a970ff9a9085455fe..863728c68d9eaea8c4bbf49604f0270dc9ea586b 100644 (file)
@@ -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)) {
index 1147cf1637551ebf08c1e71c3bdd162b80ba13b5..7405ce610268aea8a1b10948c3eb8ce991c4b563 100644 (file)
@@ -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 {