From 70ac4232a69a91a7a7e4a8d587b4ee436dbcb4fb Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Thu, 8 Dec 2016 17:31:47 +0000 Subject: [PATCH] dbq --- www/dbq/dbq.php | 49 ++++++++++++++++++++++++++++------------ www/dbq/html/default.css | 1 + 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index e1b70898..c6e418ba 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -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; diff --git a/www/dbq/html/default.css b/www/dbq/html/default.css index 01caf084..731f6e41 100644 --- a/www/dbq/html/default.css +++ b/www/dbq/html/default.css @@ -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, -- 2.47.3