From: Nicolas Boisselier Date: Tue, 6 Dec 2016 13:54:16 +0000 (+0000) Subject: dbq X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=d6cf728183aa0616fbb87a410f27b74303e5696c;p=nb.git dbq --- diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index 9f6ac4d8..33974b86 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -7,6 +7,9 @@ function dbq_run() { 'background' => '#009B9C', 'button' => '#444', ]; + if (empty($_SERVER['DOCUMENT_ROOT'])) $_SERVER['DOCUMENT_ROOT'] = dirname(__FILE__).'/html'; + require_once($_SERVER['DOCUMENT_ROOT'].'/../../../lib/php/page.php'); + # # Url if (empty($_SERVER['HTTP_USER_AGENT'])) $_SERVER['HTTP_USER_AGENT'] = ''; @@ -14,7 +17,7 @@ function dbq_run() { 'format' => ( preg_match('/^\S+\s+.Windows|iPhone|Android|Macintosh/',$_SERVER['HTTP_USER_AGENT']) ? 'html' : 'human' ), 'db' => 'ls', 'table' => 'ls', - 'action' => 'ls', + 'action' => Page::p('action','ls'), 'params' => '', ]); #var_export($params); @@ -25,10 +28,8 @@ function dbq_run() { # # Page - if (empty($_SERVER['DOCUMENT_ROOT'])) $_SERVER['DOCUMENT_ROOT'] = dirname(__FILE__).'/html'; - require_once($_SERVER['DOCUMENT_ROOT'].'/../../../lib/php/page.php'); + list($title,$nav) = title_nav($params,$ext); $params['ext'] = $ext; - list($title,$nav) = title_nav($params); #debug($nav); $Page = new Page([ 'css' => '/default.css', @@ -48,6 +49,7 @@ body, .button { table.rows, div.rows, .menu, +.edit, object, iframe, pre { border-color: '.$colors['text'].'; @@ -164,7 +166,12 @@ table.rows th, table.rows td { border-color: '.$colors['text'].'; } }]); return $Page->end(); + } elseif ($params['action'] == 'edit') { + $Table->html_edit(); + return $Page->end(); + } + return false; } @@ -212,7 +219,7 @@ function not_implemented() { exit; } -function title_nav($params) { +function title_nav($params,$ext) { $title = array_filter(array_unique(array_slice(array_values($params),1)),function($v){ return($v=='ls' ? '' : $v); }); array_unshift($title,'Home'); $path = '/'; @@ -222,7 +229,7 @@ function title_nav($params) { if ($i == 0) { $nav[] = [$v,'/']; } else { - $nav[] = [$v,"$path$v.".$params['ext']]; + $nav[] = [$v,"$path$v.".$ext]; $path .= "$v/"; } $i++; diff --git a/www/dbq/html/default.css b/www/dbq/html/default.css index ca373a16..09a433d7 100644 --- a/www/dbq/html/default.css +++ b/www/dbq/html/default.css @@ -48,6 +48,9 @@ input[type=''], { border-radius: 4px; border: solid 1px #eee; } +input[size] { + max-width: 70%; +} form label:after { content: ':'; } @@ -60,6 +63,7 @@ form select { table.rows, div.rows, +.edit, .menu, object, iframe, pre { @@ -78,7 +82,7 @@ table.rows th, table.rows td { border-bottom: solid 1px; } table.rows tr:last-child td { border-bottom: none; } .menu, .nav, .rows, -.center { +.buttons, .center { margin-left: auto; margin-right: auto; display: table; @@ -112,3 +116,19 @@ form a.button:visited, form a.button { top: -1px; } */ +.edit .fields label { + width: 25%; + text-align: right; + display: inline-block; + margin-right: 1em; + vertical-align: top; +} +.edit .fields .label span { + width: 54%; + display: inline-block; + text-align: left; +} + +form.edit .fields input, form.edit .fields textarea, form.edit .fields select { + width: 65%; +}