From: Nicolas Boisselier Date: Mon, 5 Dec 2016 16:34:56 +0000 (+0000) Subject: dbq X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=430b56dd0ebd135c332af6939b8f6b0693d9638e;p=nb.git dbq --- diff --git a/lib/php/db/table.php b/lib/php/db/table.php index 5294cded..f1ff7979 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -833,7 +833,7 @@ Class Table extends nb { $opt['use_out'] = false; if ($this->p('out') or !preg_match('/^('.join('|', - [ '','template','table','sql','div','wp','_csv','_xml','_json','_yaml' ] # local + [ '','template','table','sql','div','wp' ] # local ).')$/',$format)) { diff --git a/lib/php/out.php b/lib/php/out.php index f7e3d831..e8aa4a63 100644 --- a/lib/php/out.php +++ b/lib/php/out.php @@ -201,7 +201,7 @@ Class Out extends Nb { 'json' => array( #'enclose' => array('['.NB_EOL,NB_EOL.']'), - 'enclose' => array('[',']'), + 'enclose' => array('['.self::p('eol',NB_EOL),']'), 'row' => function(&$o,&$row) { return json_encode($row); }, 'eol' => self::p('eol',NB_EOL), 'rec' => ',', diff --git a/www/dbq/html/default.css b/www/dbq/html/default.css index 6dd4b189..b40665e5 100644 --- a/www/dbq/html/default.css +++ b/www/dbq/html/default.css @@ -9,6 +9,7 @@ body { padding-left: 1em; padding-right: 1em; background-color: #E6E6E6; + background-color: #009B9C; } h1 { @@ -17,7 +18,7 @@ h1 { a, body { - color: #333333; + color: #cccccc; } ul { @@ -94,8 +95,8 @@ table.rows tr:last-child td { border-bottom: none; } text-decoration: none; line-height: 1.5em; cursor: pointer; - background-color: #3C3C3B; - border: solid 1px #3C3C3B; + background-color: #cccccc; + border: solid 1px #cccccc; border-radius: 4px; -webkit-border-radius: 4px; white-space: nowrap; @@ -105,6 +106,7 @@ table.rows tr:last-child td { border-bottom: none; } color: #ddd; margin: 0; padding: 0 0.2em; + color: #009B9C; } a:hover, diff --git a/www/dbq/html/index.php b/www/dbq/html/index.php index b16fecf8..1fee63bb 100644 --- a/www/dbq/html/index.php +++ b/www/dbq/html/index.php @@ -1,6 +1,7 @@ 'ls', 'table' => 'ls', 'action' => 'ls', - 'format' => 'human', + 'format' => ( preg_match('/^\S+\s+.Windows|iPhone|Android|Macintosh/',$_SERVER['HTTP_USER_AGENT']) ? 'table' : 'human' ), ]); if (!$params['db']) not_implemented(); @@ -16,6 +17,13 @@ function run() { # # Page require_once($_SERVER['DOCUMENT_ROOT'].'/../../../lib/php/page.php'); + Page::pdef('out',1); + $formats = array_keys(out::types()); + foreach ($params as $k=>$v) { + if (!in_array($v,$formats)) continue; + $params['format'] = $v; + break; + } $Page = new Page([ 'css' => '/default.css', ]); @@ -103,7 +111,7 @@ function run() { return $Page->end(); } elseif ($params['action'] == 'status') { - $Db->out($Table->status()+$Table->status(['fields','sql'])); + $Db->out($Table->status()+$Table->status(['fields'])); return $Page->end(); } elseif ($params['action'] == 'fields') {