]> git.nbdom.net Git - nb.git/commitdiff
dbq
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 8 Dec 2016 17:31:47 +0000 (17:31 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 8 Dec 2016 17:31:47 +0000 (17:31 +0000)
www/dbq/dbq.php
www/dbq/html/default.css

index e1b70898415078e7326b8b816cb0d9f5c7460694..c6e418ba5bfafcf1779c762f0868a6e1e991d30c 100644 (file)
@@ -13,13 +13,14 @@ class DbQ extends nb {
   ];
 
   public $colors = [
-    'text' => '#ddd',
-    'background' => '#009B9C',
+    'body' => '#ddd',
+    'body-background' => '#009B9C',
 
     #'button' => '#ddd',
-    #'button-backgound' => '#3C3C3B',
+    #'button-background' => '#3C3C3B',
     'button' => '#444',
-    'button-backgound' => '#aaa',
+    'button-background' => '#aaa',
+    'button-border' => '#888',
   ];
 
   public $css = '/default.css';
@@ -35,6 +36,7 @@ class DbQ extends nb {
   public function __construct($opt=[]) {
     #bye($this->params);
 
+    if (self::p('action')) $this->params['action'] = self::p('action');
     $this->uri_params();
     $this->params['format'] =
       preg_match('/^\S+\s+.Windows|iPhone|Android|Macintosh|Linux/',$_SERVER['HTTP_USER_AGENT'])
@@ -63,15 +65,15 @@ class DbQ extends nb {
 
   public function page($obj,$meth=null,$head=[],$fct=null) {
 
-    if (!empty($this->colors)) $this->page->css_code = trim('
+    if (!empty($this->colors)) {
+      if (empty($this->colors['body-border'])) $this->colors['body-border'] = $this->colors['body'];
+      if (empty($this->colors['button'])) $this->colors['button'] = $this->colors['body'];
+      if (empty($this->colors['button-background'])) $this->colors['button-background'] = $this->colors['body-background'];
+      if (empty($this->colors['button-border'])) $this->colors['button-border'] = $this->colors['body-border'];
+      $this->page->css_code = trim('
 body, .button {
-  color: '.$this->colors['text'].';
-  background-color: '.$this->colors['background'].';
-}
-.button {
-  color: '.$this->colors['button'].';
-  border-color: '.$this->colors['button-backgound'].';
-  background-color: '.$this->colors['button-backgound'].';
+  color: '.$this->colors['body'].';
+  background-color: '.$this->colors['body-background'].';
 }
 table.rows,
 div.rows,
@@ -80,10 +82,16 @@ div.rows,
 form.edit,
 object, iframe, pre
 {
-  border-color: '.$this->colors['text'].';
+  border-color: '.$this->colors['body'].';
+}
+table.rows th, table.rows td { border-color: '.$this->colors['body-border'].'; }
+.button {
+  color: '.$this->colors['button'].';
+  border-color: '.$this->colors['button-border'].';
+  background-color: '.$this->colors['button-background'].';
 }
-table.rows th, table.rows td { border-color: '.$this->colors['text'].'; }
 ');
+  }
 
 if (empty($this->_nopage)) {
     $this->page->content_type($this->page->ext2mime($this->params['format']) ? $this->page->ext2mime($this->params['format']) : 'text/plain');
@@ -298,6 +306,19 @@ if (empty($this->_nopage)) {
     } elseif ($this->params['action'] == 'ls') {
       $this->page($this->table,'rows');
 
+# NB 08.12.16     } elseif ($action == 'insert') {
+# NB 08.12.16       if (!$this->insert($this->p(),$e)) bye();
+# NB 08.12.16       $this->db()->print_header('Location',$this->url_referer());
+# NB 08.12.16       $this->out($e);
+# NB 08.12.16       return true;
+# NB 08.12.16 
+# NB 08.12.16     } elseif ($action == 'update') {
+# NB 08.12.16       #$this->bye($this->p());
+# NB 08.12.16       if (!$this->update($this->p(),$e)) bye($e);
+# NB 08.12.16       $this->db()->print_header('Location',$this->url_referer());
+# NB 08.12.16       $this->out($e);
+# NB 08.12.16       return true;
+
     }
 
     return false;
index 01caf084397984c003bb4bbb9da088fd315feca3..731f6e4199566f3a1b98d53ede60a3af6a0d5f39 100644 (file)
@@ -34,6 +34,7 @@ li {
 
 table { border-collapse: collapse; }
 td, th { padding: 0.2em 0.7em; }
+th a.sort { padding: 0 0.3em; }
 
 textarea,
 select,