From 6e73cab78aea33cc9f0cf55eb937cefdc305a0fe Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Tue, 27 Dec 2016 04:11:35 +0000 Subject: [PATCH] Bed --- etc/profile | 2 + etc/profile.d/docker.sh | 3 +- etc/profile.d/functions | 13 ++++ lib/php/db/table.php | 51 ++++++++++--- lib/php/nb.php | 14 ++-- src/Docker/nginx/Dockerfile | 16 ++-- www/dbq/dbq.php | 129 ++++++++++++++++++++------------- www/dbq/docker-compose.yaml | 2 + www/dbq/etc/nginx/default.conf | 3 +- www/dbq/html/default.css | 46 +++++++++--- www/dbq/html/default.js | 76 ++++++++++++------- www/dbq/html/default.min.css | 1 + www/dbq/html/default.min.js | 5 ++ www/dbq/minify.sh | 16 ++++ 14 files changed, 260 insertions(+), 117 deletions(-) create mode 100644 www/dbq/html/default.min.css create mode 100644 www/dbq/html/default.min.js create mode 100755 www/dbq/minify.sh diff --git a/etc/profile b/etc/profile index 41f7c00e..ced7675e 100755 --- a/etc/profile +++ b/etc/profile @@ -84,6 +84,7 @@ else if [ -n "$NB_ROOT" ]; then #[ -e "$NB_ROOT/etc/profile.d/envs" ] && . "$NB_ROOT/etc/profile.d/envs" + #alias which=in_path for i in \ ${NB_ROOT}/etc/profile.d/envs \ ${NB_ROOT}/etc/profile.d/aliases \ @@ -93,6 +94,7 @@ else [ -n "$NB_DEBUG" ] && $NB_DEBUG ". $i" [ -r "$i" -a -f "$i" ] && . "$i" done + #unalias which fi diff --git a/etc/profile.d/docker.sh b/etc/profile.d/docker.sh index 232c1a51..1ae7c544 100644 --- a/etc/profile.d/docker.sh +++ b/etc/profile.d/docker.sh @@ -8,7 +8,8 @@ which docker > /dev/null || return 0 [ -z "$DOCKER_HUB" ] && DOCKER_HUB="" # Docker env only if `is_prompt` !!! -if is_prompt && which docker-machine > /dev/null && [ -z "$MYVIMRC" ]; then +# NB 26.12.16 if is_prompt && which docker-machine > /dev/null && [ -z "$MYVIMRC" ]; then +if which docker-machine >/dev/null; then if [ -z "$DOCKER_CERT_PATH" -o ! -e "$DOCKER_CERT_PATH" ] \ && [ _$(docker-machine status "$DOCKER_MACHINE_NAME" 2>/dev/null) = _Running ] \ diff --git a/etc/profile.d/functions b/etc/profile.d/functions index 6928bd69..447fe288 100644 --- a/etc/profile.d/functions +++ b/etc/profile.d/functions @@ -809,3 +809,16 @@ password_create() { [ "$encrypt" == "1" ] && password="$password "`echo "$password" | makepasswd --clearfrom=- --crypt-md5 | sed 's/^.*\(\$.*\)$/\1/'` echo "$password" } + +# NB 27.12.16 in_path() { +# NB 27.12.16 local IFS=':' +# NB 27.12.16 local p +# NB 27.12.16 for p in $PATH; do +# NB 27.12.16 test -x "$p/$1" || continue +# NB 27.12.16 #echo "$p/$1" +# NB 27.12.16 #echo "$p/$1" 1>&2 +# NB 27.12.16 return +# NB 27.12.16 done +# NB 27.12.16 #/usr/bin/which +# NB 27.12.16 return 1 +# NB 27.12.16 } diff --git a/lib/php/db/table.php b/lib/php/db/table.php index 4f203022..0939f196 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -1343,20 +1343,46 @@ Class Table extends nb { $html = ''; - #$html .= ''.NB_EOL; $html .= '
'.NB_EOL; #if (!empty($opt)) $html .= '' .NB_EOL; + $this->__rows_table_attr = []; + $this->__rows_table_keys = []; + foreach ($fields as $name => $f) { + $this->__rows_table_attr[$name] = '' + . ' class="' . $name . ($f->key?' key':'') . (isset($this->extras[$name])?' extra':'') . '"' + ; + if ($f->key) $this->__rows_table_keys[] = $name; + } + if ($this->show_header) { - $html .= ''.NB_EOL.''.NB_EOL; + $html .= ''.NB_EOL; + // Columns names + $html .= ''.NB_EOL; if ($this->buttons() and DB_HTML_EDIT) $html .= ''.NB_EOL; + foreach ($fields as $name => $f) { + $html .= '__rows_table_attr[$name].'>'.$this->url_sort($name).''.NB_EOL; + } + if ($this->buttons() and DB_HTML_DELETE) $html .= ''.NB_EOL; + $html .= ''.NB_EOL; + // Filters - beta + /* + if (0) { + $html .= ''.NB_EOL; + if ($this->buttons() and DB_HTML_EDIT) $html .= ''.NB_EOL; foreach ($fields as $name => $f) { - $html .= ''.NB_EOL; + $html .= ''.NB_EOL; } if ($this->buttons() and DB_HTML_DELETE) $html .= ''.NB_EOL; - $html .= ''.NB_EOL.''.NB_EOL; + $html .= ''.NB_EOL; + } + */ + + $html .= ''.NB_EOL; } $html .= ''.NB_EOL; @@ -1367,13 +1393,18 @@ Class Table extends nb { $buttons = $this->html_row_buttons($row); - $html = ''.NB_EOL; + $id = []; + foreach ($this->__rows_table_keys as $k) { + $id[] = $row[$k]; + } + $id = empty($id) ? '' : ' '.'__'.join('__',$id).'__'; + + $html = ''.NB_EOL; if ($this->buttons() and !empty($buttons[0])) $html .= ''.NB_EOL; foreach ($row as $k => $v) { - if (isset($this->extras[$k])) $k .= " extra"; - $html .= ''.NB_EOL; + $html .= '__rows_table_attr[$k].'>'.$v.''.NB_EOL; } if ($this->buttons() and !empty($buttons[1])) $html .= ''.NB_EOL; @@ -1384,6 +1415,7 @@ Class Table extends nb { } public function rows_end_table() { + unset($this->__rows_table_attr,$this->__rows_table_keys); $html = ''; $html .= ''.NB_EOL; $html .= '
' . $this->nav($opt['count'],$opt['tot'],$opt['limit']) . '
'.$this->url_sort($name).'' + . (preg_match('/^\w/',$name) ? '' : '') + .'
'.$buttons[0].''.$v.''.$buttons[1].'
'.NB_EOL; @@ -1769,7 +1801,7 @@ Class Table extends nb { public function html_menu($opt=[]) { - $buttons = ''; + $buttons = ''; if (!empty($opt['buttons'])) $buttons = $opt['buttons']; $r = '