]> git.nbdom.net Git - nb.git/commitdiff
www/dbq/dbq.php
authorDevops <sys@15gifts.com>
Fri, 12 May 2017 15:35:56 +0000 (16:35 +0100)
committerDevops <sys@15gifts.com>
Fri, 12 May 2017 15:35:56 +0000 (16:35 +0100)
lib/php/db/field.php
www/dbq/dbq.php

index 29a3fb9a73dcc9737f8a1e9b0b529ecce7cc0760..889e3d0f423a68c0de5c4fff595e474fef19e75d 100644 (file)
@@ -78,18 +78,25 @@ class field extends nb {
     $size = ($this->size() and is_scalar($this->size())) ? $this->size() : 0;
     $tag = ( ($size>$this->textarea_size) or preg_match('/^(text|binary|blob)/i',$this->type) ) ? 'textarea' : 'input';
 
+    $html = '';
+    if ($this->extras) {
+      $html = '<span class="extra" id="'.$this->name.'">'.$this->out($value).'</span>';
+    } elseif (strpos($this->type,'Zbool') !== false) {
+      $html = '<input type="checkbox" name="'.$this->name.'" value="1">Yes <input type="checkbox" name="'.$this->name.'" value="0">No';
+    } else {
+      $html = '<'.$tag
+        .' name="'.$this->name.'"'
+        .' id="'.$this->name.'"'
+        .( ($size and $tag != 'textarea') ? ' size="'.$size.'"' : '')
+        #.' value="'.$value.'"'
+        .($tag == 'textarea' ? '>'.$value.'</textarea>' : ' type="'
+          .($type ? $type : $this->html_type())
+        .'" value="'.$value.'" />')
+      ;
+    }
+
     return '<div class="label '.$this->name.'"><label for="'.$this->name.'">'.htmlspecialchars(prettyText($this->name)).'</label>'
-      .($this->extras
-        ? '<span class="extra" id="'.$this->name.'">'.$this->out($value).'</span>'
-        : '<'.$tag
-          .' name="'.$this->name.'"'
-          .' id="'.$this->name.'"'
-          .( ($size and $tag != 'textarea') ? ' size="'.$size.'"' : '')
-          #.' value="'.$value.'"'
-          .($tag == 'textarea' ? '>'.$value.'</textarea>' : ' type="'
-            .($type ? $type : $this->html_type())
-          .'" value="'.$value.'" />')
-      )
+      .$html
     .'</div>'.NB_EOL;
 
   }
index 9d52a416eef097e652565a3f0812a423d0ac6f7e..0effa376b041170e672dffb63680f60c9a278cf7 100644 (file)
@@ -333,7 +333,7 @@ class DbQ extends nb {
     $params = $this->params;
     $ext = $this->ext;
 
-    $title = array_filter(array_unique(array_slice(array_values($params),1)),
+    $title = array_filter(array_unique(array_slice(array_values($params),1,3)),
       function($v){
         return(in_array($v,self::ACTIONS_NO_TITLE) ? '' : trim($v));
       }
@@ -351,8 +351,8 @@ class DbQ extends nb {
         $nav[] = [$v,'/'];
 
       } else {
-        $nav[] = [$this->prettyText($v),"$path$v.".$ext];
-        $path .= "$v/";
+        $nav[] = [$this->prettyText($v),"$path".urlencode($v).".".$ext];
+        $path .= $v."/";
 
       }
 
@@ -858,7 +858,6 @@ EOF;
       $this->page($info);
 
     } elseif ($action == 'update' and $this->perm >= self::WRITE) {
-    # NB 19.12.16: TODO NOT WORKING with update using replace 
       if (!$this->table->update($_POST,$info)) $this->error('update: '.print_r($info,true));
       header('Location: '.$this->table->base.'/');
       $this->page($info);