]> git.nbdom.net Git - nb.git/commitdiff
www/dbq/html/default.css
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 8 Sep 2024 07:38:13 +0000 (09:38 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 8 Sep 2024 07:38:13 +0000 (09:38 +0200)
lib/php/db/field.php
lib/php/db/table.php
www/dbq/dbq.php
www/dbq/html/default.css
www/dbq/html/default.min.css

index 1922757764106c23d29f8b33db086179fc5485fd..ea28b199252a502c8914112a8ad6e6bb534d6249 100644 (file)
@@ -31,6 +31,8 @@ class field extends nb {
   public function __construct($attr=[]) {
     if (is_scalar($attr)) $attr = ['name'=>$attr];
     foreach ($attr as $k => $v) { $this->$k = $v; }
+    #if (isset($attr['type'])) debug($attr['type']);
+    #debug($this->name.'='.$this->type.nb::debug_backtrace_msg());
   }
 
   public function default2str($default=null) {
index eed585bc51a84ac563b0272c2cec338585eef94c..a6432b904df17a66056af303247743fc25503d61 100644 (file)
@@ -926,11 +926,6 @@ Class Table extends nb {
 
        }
 
-# NB 06.02.18  public function replace_fields($fields) {
-# NB 06.02.18          $this->fields = [];
-# NB 06.02.18          $this->add_fields($fields);
-# NB 06.02.18  }
-
        public function replace_fields($fields) {
                $this->fields = [];
                return $this->add_fields($fields);
@@ -952,7 +947,11 @@ Class Table extends nb {
                                ]);
 
                        } else {
-                               $this->fields[$k] = $v;
+                               # NB 07.09.24 $this->fields[$k] = $v;
+                               #debug(['table'=>'T']+$v);
+                               if (!isset($v['table'])) $v['table'] = $this;
+                               $field = new Field($v);
+                               $this->fields[$field->name] = $field;
 
                        }
                }
@@ -1133,11 +1132,14 @@ Class Table extends nb {
        }
 
 
-       private function fields_add_missing(&$fields,$row) {
+# NB 08.09.24: TODEL  
+       private function _fields_add_missing(&$fields,$row) {
                $new = [];
                foreach (array_keys($row) as $name) {
 
-                       #debug($name);
+                       #if (isset($fields[$name])) debug($fields[$name]->name);
+                       #if (!isset($fields[$name])) debug($name);
+                       #if (!isset($fields[$name])) debug($fields[$name]->type);
                        $new[$name] = isset($fields[$name])
                                ? $fields[$name]
                                : new Field([
@@ -1154,6 +1156,25 @@ Class Table extends nb {
                return $fields;
        }
 
+       private function fields_add_missing(&$fields,$row) {
+               foreach (array_keys($row) as $name) {
+
+                       if (isset($fields[$name])) continue;
+                       #if (isset($fields[$name])) debug($fields[$name]->name);
+                       #if (!isset($fields[$name])) debug($name);
+                       #if (!isset($fields[$name])) debug($fields[$name]->type);
+                       $field[$name] = new Field([
+                               'name' => $name,
+                               'dyn' => true,
+                               'table' => $this,
+                               'preffix' => $this->ppreff(),
+                       ]);
+
+               }
+
+               return $fields;
+       }
+
        public function rows(&$opt=[]) { # ,$opt_by_val=null) {
                #
                # Options
index 43cc94dcad3290cb9b030a5965cd2d96a4efefbb..c8b07a3d4aa8d1beb5b7744abe235e080a5a1cc4 100644 (file)
@@ -168,6 +168,9 @@ class DbQ extends nb {
                        'css' => $this->css,
                        'js' => $this->js,
                        'sep' => $this->sep_title,
+                       'head' => [
+                               '<link rel="icon" href="data:;base64,iVBORw0KGgo=" />',
+                       ],
 # NB 05.01.18                  'expires' => $this->expires,
                ]);
 
@@ -660,10 +663,13 @@ class DbQ extends nb {
 
                        # NB 07.09.24: Now html content field  
                        $field = $this->table->field($k);
-                       if ($field and $field->type == 'html') continue;
+                       if (!$field) continue;
+                       if (!empty($field->dyn) or $field->type == 'html') continue;
+                       #if ($field) $h .= "$k=".$field->type;
 
                        $suff = count($values)>1 ? '[]' : '';
                        foreach ($values as $v) {
+                               #$h .= "$k=".$field->type;
                                $h .= '<input type="hidden" name="'.htmlentities($k).$suff.'" value="'.htmlentities($v).'"/>';
                        }
                }
index 2170eda06a7224b84db45b98590c2004ce451d0e..359a6b892cdec33619709abe2fc2face6f27fba1 100644 (file)
@@ -109,3 +109,24 @@ a.active, .active a {
 .db-rows img {
        max-height: 4rem;
 }
+
+.db-rows div.list {
+       white-space: nowrap;
+       margin: 0;
+       padding: 0 0.3em;
+       max-width: 10em;
+       height: 3.5em;
+       overflow: scroll;
+       border: solid 1px #ddd;
+       border-radius: 4px;
+}
+
+.db-rows div.list .list.item {
+       list-style: disc inside none;
+       display: list-item;
+}
+
+.db-rows div.list .list.item.capitalize {
+       text-transform: capitalize;
+       list-style: circle inside none;
+}
index 30716a3c6862232a87ece209160e2b30fa720fc2..8f7de4975cdc33ea7fe671cb7cd4a9a3b72f13a1 100644 (file)
@@ -1 +1 @@
-@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg); }}.loader{border:16px solid #FFFFFF;border-radius:50%;border-top:16px solid #000000;padding:0;margin:0 auto 0 auto;width:8em;height:8em;animation:spin 2s linear infinite;display:block}body.loader{margin-top:8em}.loader*{display:none !important}h1{margin:0 0 0.2em 0;font-size:140%;padding-bottom:0.3em;margin-bottom:0.5em;padding:0.3em;background-color:var(--dark)}h1,h1 a,h1 a:hover{color:var(--light);font-weight:normal !important;}#db-menu-form_*{font-size:95%}#db-menu-form.form-control{max-width:5rem;height:1.5rem;padding:0 0.3rem;margin-top:0.4rem;margin-left:0.2rem}#db-menu-form.btn-group{margin-left:0.4rem;max-height:2.5rem}.db-edit.form-control+.media{margin-top:0.25rem}#db-menu-form,.pagination,.db-results,.db-rows,#page-bottom,.CENTER{margin-left:auto;margin-right:auto;width:auto;display:table}.pagination*{display:inline-block}.db-field-view label,.db-field-delete label,.D-NONE{display:none}.db-rows th.view,.HIDE{color:transparent;text-shadow:none;background-color:transparent}a.active,.active a{color:var(--danger)}.db-edit img{max-height:5rem}.db-rows img{max-height:4rem}
+@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.loader{border:16px solid #fff;border-radius:50%;border-top:16px solid #000;padding:0;margin:0 auto;width:8em;height:8em;animation:spin 2s linear infinite;display:block}body.loader{margin-top:8em}.loader *{display:none!important}h1{margin:0 0 .2em;font-size:140%;padding-bottom:.3em;margin-bottom:.5em;padding:.3em;background-color:var(--dark)}h1,h1 a,h1 a:hover{color:var(--light);font-weight:400!important}#db-menu-form_ *{font-size:95%}#db-menu-form .form-control{max-width:5rem;height:1.5rem;padding:0 .3rem;margin-top:.4rem;margin-left:.2rem}#db-menu-form .btn-group{margin-left:.4rem;max-height:2.5rem}.db-edit .form-control+.media{margin-top:.25rem}#db-menu-form,.pagination,.db-results,.db-rows,#page-bottom,.CENTER{margin-left:auto;margin-right:auto;width:auto;display:table}.pagination *{display:inline-block}.db-field-view label,.db-field-delete label,.D-NONE{display:none}.db-rows th.view,.HIDE{color:transparent;text-shadow:none;background-color:transparent}a.active,.active a{color:var(--danger)}.db-edit img{max-height:5rem}.db-rows img{max-height:4rem}.db-rows div.list .list.item{list-style:disc inside none;display:list-item}.db-rows div.list .list.item.capitalize{text-transform:capitalize;list-style:circle inside none}.db-rows div.list{white-space:nowrap;margin:0;padding:0 .3em;max-width:10em;height:3.5em;overflow:scroll;border:solid 1px #ddd;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px}
\ No newline at end of file