From 25a15968cd4c3148fa1405fa46102a7a933117d2 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Mon, 18 Dec 2017 02:32:46 +0000 Subject: [PATCH] www/dbq/dbq.php --- lib/php/out.php | 13 ++++++------- lib/php/out/jpg.php | 4 +++- lib/php/out/png.php | 4 +++- www/dbq/dbq.php | 9 ++++++--- www/dbq/html/default.min.css | 2 +- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/lib/php/out.php b/lib/php/out.php index 8db8702a..3bcaf308 100644 --- a/lib/php/out.php +++ b/lib/php/out.php @@ -201,12 +201,6 @@ Class Out extends Nb { return $ret; } -# NB 14.12.17 public static function row_end($o) { -# NB 14.12.17 bye('OBSOLETE'); -# NB 14.12.17 if (isset($o['rec'])) echo $o['rec']; -# NB 14.12.17 if (isset($o['eol'])) echo $o['eol']; -# NB 14.12.17 } - public static function end(&$o) { #if (isset($o['end'])) echo $o['end']($o); if (!empty($o['align'])) { @@ -239,7 +233,6 @@ Class Out extends Nb { public static function rows($type,&$data,$head=[],$conf=[]) { - if (empty($data)) return; if (is_scalar($data)) $data = [[$data]]; if (!isset(self::$types[$type])) self::bye("Unknown type: `$type`"); if ($type) self::type($type); @@ -250,6 +243,11 @@ Class Out extends Nb { if (empty($conf['enclose'])) $conf['enclose'] = ['','']; if (empty($conf['eol'])) $conf['eol'] = ''; + if (empty($data)) { + self::type_call('finish',$conf); + return; + } + if (self::is_hash($data)) $data = [$data]; if (is_scalar($data)) $data = [$data]; @@ -285,6 +283,7 @@ Class Out extends Nb { } if ($count) self::end($conf); + self::type_call('finish',$conf); } diff --git a/lib/php/out/jpg.php b/lib/php/out/jpg.php index acd2e846..5f4d6a21 100644 --- a/lib/php/out/jpg.php +++ b/lib/php/out/jpg.php @@ -7,7 +7,9 @@ return [ 'w' => self::p('w',''), 'h' => self::p('h',''), 'q' => self::p('q','75'), - 'if_no_rows' => base64_decode('R0lGODlhAQABAJAAAP8AAAAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw=='), + 'finish' => function($o) { + if (empty($o['_jpg'])) echo base64_decode('R0lGODlhAQABAJAAAP8AAAAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw=='); + }, 'row' => function (&$o,&$row) { if (!empty($o['_jpg'])) return; $o['_jpg'] = true; diff --git a/lib/php/out/png.php b/lib/php/out/png.php index 619a9151..bf9bd7b0 100644 --- a/lib/php/out/png.php +++ b/lib/php/out/png.php @@ -7,7 +7,9 @@ return [ 'w' => self::p('w',''), 'h' => self::p('h',''), 'q' => self::p('q','6'), - 'if_no_rows' => base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII='), + 'finish' => function($o) { + if (empty($o['_jpg'])) echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII='); + }, 'row' => function (&$o,&$row) { if (!empty($o['_png'])) return; $o['_png'] = true; diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index 5188002d..5c7a2d6f 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -261,7 +261,8 @@ class DbQ extends nb { } - if (!empty($rows)) $this->db->out($rows,$head,$conf); +# NB 18.12.17 if (!empty($rows)) + $this->db->out($rows,$head,$conf); if (empty($this->_nopage)) { @@ -276,9 +277,11 @@ class DbQ extends nb { } #debug($_SERVER); - if ($this->http_user()) $bottom[] = 'Logout: '.$this->http_user().' (can: '.$this->perm2h().')'.''; + if ($this->http_user()) $bottom[] = 'Logout: ' + .$this->http_user() + .' (can: '.$this->perm2h().')'.''; - #$bottom[] = ''; + #echo ''; #$bottom[] = ''; if ($bottom and $this->page->is('html')) echo $this->page->tag('div class="block" style="display:inline-block"',join('
'.NB_EOL,$bottom)); diff --git a/www/dbq/html/default.min.css b/www/dbq/html/default.min.css index 0fde1ded..9521d021 100644 --- a/www/dbq/html/default.min.css +++ b/www/dbq/html/default.min.css @@ -1 +1 @@ -html{font:90% 'Trebuchet MS',sans-serif;background-color:#eee}body{display:table;margin-left:auto;margin-right:auto;padding-left:1em;padding-right:1em;color:#444}h1{margin:0 0 .2em 0;font-size:180%;padding-bottom:.3em;margin-bottom:.5em;border-bottom:dashed 1px #444}a{color:inherit}div>a,li a,p a,td a{color:#3572b0}a,a:visited{text-decoration:none}.button:hover,a:hover{opacity:.8}ul{padding:0;margin:0}li{list-style:none;padding:0 0 0 .3em}table{border-collapse:collapse}td,th{padding:.2em .7em}th a.sort{padding:0 .3em}input:not([type]),input[type=''],input[type=date],input[type=email],input[type=password],input[type=text],input[type=url],select,textarea{border-radius:3px;border:solid 1px #ddd;padding:.3em .4em;box-shadow:0 1px 1px #eee}input[size]{max-width:70%}div.row div label:after,form label:after{content:':'}form input,form label,form select{vertical-align:middle;margin:.2em .4em .2em 0}.block,.menu,div.row,form.edit,iframe,object,pre,table.rows,ul.row{border-radius:4px;border-spacing:0;padding:.5em .2em;margin-bottom:.5em;border:solid 1px #ddd;background-color:#fafafa;box-shadow:0 1px 2px #eee}.rows{padding:0}table.rows{border-style:hidden;border-collapse:collapse;box-shadow:0 0 0 1px #ddd;table-layout:fixed}table.rows.fixed{width:100%}table.rows tr:nth-child(even) td{background-color:#fefefe}div.row div,table.rows td,table.rows th,ul.row li{border-bottom:solid 1px #ddd}div.row div,table.rows tr:last-child td,ul.row li{border-bottom:none}table.rows td,table.rows th{border-right:dashed 1px #ddd}table.rows th{text-align:left}table.rows td{padding:.3em .3em}table.rows.fixed td{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}table.rows td.delete,table.rows td.view{width:1%;white-space:nowrap}table.rows.fixed th.view{width:2em}table.rows.fixed th.delete{width:2.7em}div.row div{margin:0}div.row div label,ul.row li label{padding:.1em .5em .1em 0;min-width:20%;display:inline-block}.button{font:inherit;display:inline-block;text-decoration:none;line-height:1.6em;cursor:pointer;white-space:nowrap;box-sizing:border-box;margin:0 .1em 0 0;padding:0 .3em;border-radius:4px;border:none;color:#3572b0;background-color:#eee;background:linear-gradient(to bottom right,#eee,#ddd);box-shadow:0 1px 1px #bbb}.center,.menu,.nav,.rows,td.button{display:table}.buttons,.center,.menu,.nav,.rows,td.button{margin-left:auto;margin-right:auto}div.buttons{text-align:center;margin-top:.5em}form.menu{padding:.5em;background-color:#fafafa}form.menu .button.add{float:right;margin-top:.2em}form.menu .criterias{border-top:dashed 1px #ddd;margin-top:.3em;padding-top:.3em}form.menu .criterias span.label{border-right:solid 1px #fff;padding:.2em .1em;margin:.2em .2em 0 0;border-radius:3px}form.menu .criterias span.label:last-child{border-right:none}form.menu select:focus{max-width:auto}form.menu select{max-width:20%}form.menu .criterias input[type=text]:focus{width:auto}form.menu .criterias input[type=text]{width:4em}form.edit .fields label{width:25%;text-align:right;display:inline-block;margin-right:1em;vertical-align:top}form.edit .fields .label span{width:54%;display:inline-block;text-align:left;vertical-align:middle;margin-top:.2em}form.Wedit .fields .label span input{vertical-align:bottom!important}form.edit .fields input[size],form.edit .fields select,form.edit .fields textarea{width:65%} +html{font:90% 'Trebuchet MS',sans-serif;background-color:#eee}body{display:table;margin-left:auto;margin-right:auto;padding-left:1em;padding-right:1em;color:#444}h1{margin:0 0 .2em 0;font-size:180%;padding-bottom:.3em;margin-bottom:.5em;border-bottom:dashed 1px #444}a{color:inherit}div>a,li a,p a,td a{color:#3572b0}a,a:visited{text-decoration:none}.button:hover,a:hover{opacity:.8}ul{padding:0;margin:0}li{list-style:none;padding:0 0 0 .3em}table{border-collapse:collapse}td,th{padding:.2em .7em}th a.sort{padding:0 .3em}input:not([type]),input[type=''],input[type=date],input[type=email],input[type=password],input[type=text],input[type=url],select,textarea{border-radius:3px;border:solid 1px #ddd;padding:.3em .4em;box-shadow:0 1px 1px #eee}input[size]{max-width:70%}div.row div label:after,form label:after{content:':'}form input,form label,form select{vertical-align:middle;margin:.2em .4em .2em 0}.block,.menu,div.row,form.edit,iframe,pre,table.rows,ul.row{border-radius:4px;border-spacing:0;padding:.5em .2em;margin-bottom:.5em;border:solid 1px #ddd;background-color:#fafafa;box-shadow:0 1px 2px #eee}.rows{padding:0}table.rows{border-style:hidden;border-collapse:collapse;box-shadow:0 0 0 1px #ddd;table-layout:fixed}table.rows.fixed{width:100%}table.rows tr:nth-child(even) td{background-color:#fefefe}div.row div,table.rows td,table.rows th,ul.row li{border-bottom:solid 1px #ddd}div.row div,table.rows tr:last-child td,ul.row li{border-bottom:none}table.rows td,table.rows th{border-right:dashed 1px #ddd}table.rows th{text-align:left}table.rows td{padding:.3em .3em}table.rows.fixed td{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}table.rows td.delete,table.rows td.view{width:1%;white-space:nowrap}table.rows.fixed th.view{width:2em}table.rows.fixed th.delete{width:2.7em}div.row div{margin:0}div.row div label,ul.row li label{padding:.1em .5em .1em 0;min-width:20%;display:inline-block}.button{font:inherit;display:inline-block;text-decoration:none;line-height:1.6em;cursor:pointer;white-space:nowrap;box-sizing:border-box;margin:0 .1em 0 0;padding:0 .3em;border-radius:4px;border:none;color:#3572b0;background-color:#eee;background:linear-gradient(to bottom right,#eee,#ddd);box-shadow:0 1px 1px #bbb}.center,.menu,.nav,.rows,td.button{display:table}.buttons,.center,.menu,.nav,.rows,td.button{margin-left:auto;margin-right:auto}div.buttons{text-align:center;margin-top:.5em}form.menu{padding:.5em;background-color:#fafafa}form.menu .button.add{float:right;margin-top:.2em}form.menu .criterias{border-top:dashed 1px #ddd;margin-top:.3em;padding-top:.3em}form.menu .criterias span.label{border-right:solid 1px #fff;padding:.2em .1em;margin:.2em .2em 0 0;border-radius:3px}form.menu .criterias span.label:last-child{border-right:none}form.menu select:focus{max-width:auto}form.menu select{max-width:20%}form.menu .criterias input[type=text]:focus{width:auto}form.menu .criterias input[type=text]{width:4em}form.edit .fields label{width:25%;text-align:right;display:inline-block;margin-right:1em;vertical-align:top}form.edit .fields .label span{width:54%;display:inline-block;text-align:left;vertical-align:middle;margin-top:.2em}form.Wedit .fields .label span input{vertical-align:bottom!important}form.edit .fields input[size],form.edit .fields select,form.edit .fields textarea{width:65%} -- 2.47.3