From: Nicolas Boisselier Date: Tue, 6 Dec 2016 12:33:06 +0000 (+0000) Subject: Nav X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=4ba4dce002d3408e18253c163a5680b8274354c7;p=nb.git Nav --- diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index 35edcc6e..a6a7fb0d 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -2,6 +2,10 @@ function dbq_run() { + $colors = [ + 'text' => '#ddd', + 'background' => '#009B9C', + ]; # # Url if (empty($_SERVER['HTTP_USER_AGENT'])) $_SERVER['HTTP_USER_AGENT'] = ''; @@ -22,32 +26,32 @@ function dbq_run() { # Page if (empty($_SERVER['DOCUMENT_ROOT'])) $_SERVER['DOCUMENT_ROOT'] = dirname(__FILE__).'/html'; require_once($_SERVER['DOCUMENT_ROOT'].'/../../../lib/php/page.php'); - #debug(nb::p()); - #debug($params); - $title = array_filter(array_unique(array_slice(array_values($params),1)),function($v){ return($v=='ls' ? '' : $v); }); - array_unshift($title,'Home'); $params['ext'] = $ext; - $path = '/'; - $nav = []; - #debug($title); - $i = 0; - foreach ($title as $k=>$v) { - if ($i == 0) { - $nav[] = [$v,'/']; - } else { - $nav[] = [$v,"$path$v.".$params['ext']]; - $path .= "$v/"; - } - $i++; - } + list($title,$nav) = title_nav($params); #debug($nav); $Page = new Page([ 'css' => '/default.css', 'title' => join(' ',$title), - #'h1' => join(' ',array_map(function($v) use($Page,$params){},$nav)), 'nav' => $nav, ]); + if (!empty($colors)) $Page->css_code = trim(' +body, .button { + color: '.$colors['text'].'; + background-color: '.$colors['background'].'; +} +.button { + border-color: '.$colors['text'].'; +} +table.rows, +div.rows, +.menu, +object, iframe, pre +{ + border-color: '.$colors['text'].'; +} +table.rows th, table.rows td { border-color: '.$colors['text'].'; } +'); $Page->content_type($Page->ext2mime($params['format']) ? $Page->ext2mime($params['format']) : 'text/plain'); if ($Page->is('text') and !$Page->is('html')) $Page->content_type('text/plain'); $Page->headers_no_cache(); @@ -205,6 +209,24 @@ function not_implemented() { echo "$msg\n"; exit; } + +function title_nav($params) { + $title = array_filter(array_unique(array_slice(array_values($params),1)),function($v){ return($v=='ls' ? '' : $v); }); + array_unshift($title,'Home'); + $path = '/'; + $nav = []; + $i = 0; + foreach ($title as $k=>$v) { + if ($i == 0) { + $nav[] = [$v,'/']; + } else { + $nav[] = [$v,"$path$v.".$params['ext']]; + $path .= "$v/"; + } + $i++; + } + return [$title,$nav]; +} # NB 05.12.16 function row_a(&$v) { # NB 05.12.16 $v = Page::tag('a',$r['command'],'href="'.$r['command'].'.'.$params['ext'].'"'); # NB 05.12.16 } diff --git a/www/dbq/html/default.css b/www/dbq/html/default.css index 4d4b6805..50833b70 100644 --- a/www/dbq/html/default.css +++ b/www/dbq/html/default.css @@ -8,16 +8,18 @@ body { margin-right: auto; padding-left: 1em; padding-right: 1em; - background-color: #009B9C; } h1 { margin: 0 0 0.2em 0; } -a, -body { - color: #ddd; +a { + color :inherit; +} + +a, a:visited { + text-decoration: none; } ul { @@ -30,10 +32,6 @@ li { padding: 0 0 0 0.3em; } -a, a:visited { - text-decoration: none; -} - table { border-collapse: collapse; } td, th { padding: 0.2em 0.7em; } @@ -65,18 +63,18 @@ div.rows, .menu, object, iframe, pre { + border-radius: 2px; border-collapse: separate; border-spacing: 0; - border-radius: 2px; - border: solid 1px #ddd; padding: 0.5em 0.2em; margin-bottom: 0.5em; + border: solid 1px; } table.rows { padding: 0; } -table.rows th, table.rows td { border-bottom: solid 1px #ddd; } +table.rows th, table.rows td { border-bottom: solid 1px; } table.rows tr:last-child td { border-bottom: none; } .menu, .nav, .rows, @@ -94,15 +92,11 @@ table.rows tr:last-child td { border-bottom: none; } text-decoration: none; line-height: 1.5em; cursor: pointer; - background-color: #ddd; - border: solid 1px #ddd; border-radius: 4px; white-space: nowrap; box-sizing: border-box; - color: #ddd; margin: 0; padding: 0 0.2em; - color: #009B9C; } a:hover,