]> git.nbdom.net Git - nb.git/commitdiff
textarea
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 16 Jun 2016 15:08:15 +0000 (17:08 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 16 Jun 2016 15:08:15 +0000 (17:08 +0200)
lib/css/db.css
lib/php/db/field.php
lib/php/db/table.php

index b8f80f9b5626ec05faa947f0e8474b58dc23302c..8ae54f38fa9bf6eb58e1fb39cc5a9d9d8c702074 100644 (file)
@@ -114,13 +114,12 @@ table.rows tr { vertical-align: top; }
   Edit
 */
 
-@media screen and (min-width: 400px) {
+@media screen and (max-width: 400px) {
   .db form.edit {
-    min-width: 40em;
+    max-width: 40em;
     margin: 0 auto;
   }
 }
-
 .db .edit .fields label {
   width: 25%;
   text-align: right;
@@ -134,6 +133,10 @@ table.rows tr { vertical-align: top; }
   text-align: left;
 }
 
+.db form.edit .fields input, .db form.edit .fields textarea, .db form.edit .fields select {
+  width: 70%;
+}
+
 .buttons {
   margin: 0.5em auto 0 auto;
   text-align: center;
index bac07be0b8867e25545059a6c2d505444df07eb2..7e77621e342022cc3871e80bb2665a1719249829 100644 (file)
@@ -13,6 +13,7 @@ class field extends nb {
   public $name;
   public $type;
   public $null = true;
+  private $textarea_size = 300;
   public $key = 0;
   public $uniq = 0;
   public $default;
@@ -64,7 +65,7 @@ class field extends nb {
   public function html_edit($value) {
 
     $size = ($this->size() and is_scalar($this->size())) ? $this->size() : 0;
-    $tag = ( ($size>100) or preg_match('/^(text|binary)/i',$this->type) ) ? 'textarea' : 'input';
+    $tag = ( ($size>$this->textarea_size) or preg_match('/^(text|binary)/i',$this->type) ) ? 'textarea' : 'input';
     return '<div class="label '.$this->name.'"><label for="'.$this->name.'">'.htmlspecialchars(prettyText($this->name)).'</label>'
       .($this->extra
         ? '<span class="extra" id="'.$this->name.'">'.$this->out($value).'</span>'
index 2af00b9a8f16163faf0d3d71035237b04976539e..862de71e6ea6189214d2bde6ba1a7baaf4594c63 100644 (file)
@@ -1183,6 +1183,7 @@ Class Table extends nb {
       }
 
     }
+    $info['keys'] = array_combine($keys,$keys_values);
 
     if (empty($fields)) $this->bye("Missing keys!");
     if (empty($keys)) {
@@ -1225,6 +1226,7 @@ Class Table extends nb {
       return false;
     }
 
+    return true;
     #debug($execute);
     $info['rowCount'] = $query->rowCount();
     return $query->rowCount();