]> git.nbdom.net Git - nb.git/commitdiff
www/dbq/html/default.css
authorDevops <sys@15gifts.com>
Thu, 25 May 2017 21:02:31 +0000 (22:02 +0100)
committerDevops <sys@15gifts.com>
Thu, 25 May 2017 21:02:31 +0000 (22:02 +0100)
bin/nb-install
www/dbq/dbq.php
www/dbq/html/default.js
www/dbq/update.sh

index 225b33d7dbb229358925405924d00f4f81e06b7e..8750d9f501e6c0286656ac9973d00c23e8f99069 100755 (executable)
 #
 ##############################################################################
 main() {
-# NB 13.12.16 . "${BASH_SOURCE%/*}/../etc/profile" || exit
-. $(dirname "$0")/../etc/profile || exit 1; [ -z "$NB_ROOT" ] && exit
-NAME="$(basename "${0}")"
-TMP=/tmp/$NAME.$$
-INSTALL="rsync --archive --checksum --force"
-BY="Generated by $0"
-
-if [ "$UID" != "0" ] ; then
-  echo "$NAME: please login as root." 1>&2
-  exit 1
-fi
+  # NB 13.12.16 . "${BASH_SOURCE%/*}/../etc/profile" || exit
+  . $(dirname "$0")/../etc/profile || exit 1; [ -z "$NB_ROOT" ] && exit
+  NAME="$(basename "${0}")"
+  TMP=/tmp/$NAME.$$
+  INSTALL="rsync --archive --checksum --force"
+  BY="Generated by $0"
+
+  if [ "$UID" != "0" ] ; then
+    echo "$NAME: please login as root." 1>&2
+    exit 1
+  fi
 
-##############################################################################
-#
-# Args
-#
-##############################################################################
-case "$@" in *-h*|*-help*) exec echo "Usage: $NAME [-v] [-n]";; esac
-case "$@" in *-v*) INSTALL="$INSTALL -v";; esac
-case "$@" in *-n*) INSTALL="$INSTALL -n";; esac
-if ! which rsync >/dev/null; then
-  INSTALL="cp -a"
+  ##############################################################################
+  #
+  # Args
+  #
+  ##############################################################################
+  case "$@" in *-h*|*-help*) exec echo "Usage: $NAME [-v] [-n]";; esac
   case "$@" in *-v*) INSTALL="$INSTALL -v";; esac
-  case "$@" in *-n*) INSTALL="echo DRY:";; esac
-fi
+  case "$@" in *-n*) INSTALL="$INSTALL -n";; esac
+  if ! which rsync >/dev/null; then
+    INSTALL="cp -a"
+    case "$@" in *-v*) INSTALL="$INSTALL -v";; esac
+    case "$@" in *-n*) INSTALL="echo DRY:";; esac
+  fi
 
-##############################################################################
-#
-# Functions
-#
-##############################################################################
-verbose() {
-  [ -z "$@" ] && return
-  printf '> %s\n' "$@"
-}
+  ##############################################################################
+  #
+  # Functions
+  #
+  ##############################################################################
+  verbose() {
+    [ -z "$@" ] && return
+    printf '> %s\n' "$@"
+  }
+
+  fdiff() {
+    [ -e "$1" ] || return 0
+    [ -e "$2" ] || return 0
+    [ -n "$(diff -q $1 $2 2>/dev/null)" ] && return 0
+    return 1
+  }
+
+  ##############################################################################
+  #
+  # Cron
+  #
+  if [ -e /etc/nb/cron.no ]; then
+    rm -f /etc/cron.d/nb /var/log/nb.log
+  else
+    #shell_help_noarg "zaza" "$@" && exit 0
+    cron_d_install "$NB_ROOT/etc/cron/nb" "nb-update|$NB_ROOT|NB_LOG" && verbose "Cron: $NB_ROOT/etc/cron/nb"
+    #cron_d_install "test" "" "nico.*true" && verbose "Cron: nico"
+  fi
 
-fdiff() {
-  [ -e "$1" ] || return 0
-  [ -e "$2" ] || return 0
-  [ -n "$(diff -q $1 $2 2>/dev/null)" ] && return 0
-  return 1
-}
+  #
+  # Profile
+  #
+  echo "[ -r $NB_ROOT/etc/profile ] && . $NB_ROOT/etc/profile" > $TMP.profile
+  if [ -d /etc/profile.d ]; then
 
-##############################################################################
-#
-# Cron
-#
-if [ -e /etc/nb/cron.no ]; then
-  rm -f /etc/cron.d/nb /var/log/nb.log
-else
-  #shell_help_noarg "zaza" "$@" && exit 0
-  cron_d_install "$NB_ROOT/etc/cron/nb" "nb-update|$NB_ROOT|NB_LOG" && verbose "Cron: $NB_ROOT/etc/cron/nb"
-  #cron_d_install "test" "" "nico.*true" && verbose "Cron: nico"
-fi
+    if fdiff $TMP.profile /etc/profile.d/nb.sh 1>/dev/null 2>&1; then
+      verbose "Install /etc/profile.d/nb.sh"
+      $INSTALL $TMP.profile /etc/profile.d/nb.sh
+      chmod 755 /etc/profile.d/nb.sh
+    fi
 
-#
-# Profile
-#
-echo "[ -r $NB_ROOT/etc/profile ] && . $NB_ROOT/etc/profile" > $TMP.profile
-if [ -d /etc/profile.d ]; then
+  elif [ -w /etc/profile ]; then
 
-  if fdiff $TMP.profile /etc/profile.d/nb.sh 1>/dev/null 2>&1; then
-    verbose "Install /etc/profile.d/nb.sh"
-    $INSTALL $TMP.profile /etc/profile.d/nb.sh
-    chmod 755 /etc/profile.d/nb.sh
-  fi
+    grep -vF "$NB_ROOT/etc/profile.sh" /etc/profile > $TMP.clean
+    if fdiff /etc/profile $TMP.clean; then
+      verbose "Clean /etc/profile"
+      cat $TMP.clean > /etc/profile
+    fi
 
-elif [ -w /etc/profile ]; then
+    if ! grep -qm1 -F "$(cat $TMP.profile)" /etc/profile; then
+      verbose "Install /etc/profile"
+      cat $TMP.profile >> /etc/profile
+    fi
 
-  grep -vF "$NB_ROOT/etc/profile.sh" /etc/profile > $TMP.clean
-  if fdiff /etc/profile $TMP.clean; then
-    verbose "Clean /etc/profile"
-    cat $TMP.clean > /etc/profile
-  fi
+  else
+    echo "Can't install /etc/profile. Directory not exists or wrong permission" 1>&2
 
-  if ! grep -qm1 -F "$(cat $TMP.profile)" /etc/profile; then
-    verbose "Install /etc/profile"
-    cat $TMP.profile >> /etc/profile
   fi
 
-else
-  echo "Can't install /etc/profile. Directory not exists or wrong permission" 1>&2
+  #
+  # Specifics
+  #
+  chmod 755 $NB_ROOT/etc/vim/vim* $NB_ROOT/etc/vim/*.sh $NB_ROOT/etc/vim/*.pl $NB_ROOT/etc/vim/vimplate-dump
 
-fi
+  #
+  # Log
+  #
+  NB_USER=`(ls -dl $NB_ROOT 2>/dev/null || printf '- 0 root') | awk '{print $3}'`
+  verbose $(chown "$NB_USER" /var/log/nb.log 2> /dev/null)
 
-#
-# Specifics
-#
-chmod 755 $NB_ROOT/etc/vim/vim* $NB_ROOT/etc/vim/*.sh $NB_ROOT/etc/vim/*.pl $NB_ROOT/etc/vim/vimplate-dump
+  #
+  # nb-commit
+  #
+  cd "$NB_ROOT" || exit
 
-#
-# Log
-#
-NB_USER=`(ls -dl $NB_ROOT 2>/dev/null || printf '- 0 root') | awk '{print $3}'`
-verbose $(chown "$NB_USER" /var/log/nb.log 2> /dev/null)
+  rm -f .git/hooks/pre-push
 
-#
-# nb-commit
-#
-cd "$NB_ROOT" || exit
-rm -v .git/hooks/pre-push
-if [ ! -e .git/hooks/pre-push -a -w .git/hooks ]; then
-  echo "Create .git/hooks/pre-push"
-  cat <<EOF > .git/hooks/pre-push
+  if [ -w .git/hooks ]; then
+
+    #echo "Create .git/hooks/pre-push"
+    cat <<EOF > .git/hooks/pre-commit
 #!/bin/sh
-echo Git hooks pre-push $* 1>&2
+echo Git hooks pre-commit $* 1>&2
 $([ -e www/dbq/update.sh ] && echo www/dbq/update.sh)
 EOF
-  chmod 755 .git/hooks/pre-push
-  chown "$NB_USER" .git/hooks/pre-push
-fi
 
-#
-# Bye
-#
-rm -f $TMP*
-exit 0
+    chmod 755 .git/hooks/pre-commit
+    chown "$NB_USER" .git/hooks/pre-commit
+
+  fi
+
+  #
+  # Bye
+  #
+  rm -f $TMP*
+  exit 0
 
 }
 main
index 4d95e70d25d72c52655762d07194af4ef83cc708..74b9f581e34b02cc9f87969f9e2d168a6bf7ce3b 100644 (file)
@@ -488,7 +488,7 @@ class DbQ extends nb {
       if ($password=='') $password = $this->params['table'];
       if ($password=='' and !empty($_POST['password'])) $password = $_POST['password'];
       if ($this->is_html) echo <<<EOF
-<form action="$this->uri" method="post">
+<form action="$this->uri" method="post" class="block" style="padding:1.5em">
 <label>Password</label><input type="text" name="password" value="$password" />
 <input type="submit" />
 </form>
@@ -792,7 +792,8 @@ EOF;
         $r['command'] = $this->page->tag('a',$r['command'],'href="'
           .$this->db->base.'/'.($r['command'] == self::PARAM_DB_DEFAULT
             ? ''
-            : $r['command'].'.'.$this->ext
+# NB 25.05.17             : $r['command'].'.'.$this->ext
+            : $r['command']
           )
         .'"');
       });
@@ -800,8 +801,10 @@ EOF;
     } elseif ($action == 'ls') {
       #$this->params += [ 'db' => '', 'table' => '', 'action' => '' ];
       #$this->params = array_merge($this->params,[ 'db' => '', 'table' => '', 'action' => '' ]);
+
       $this->page($this->db,'ls',[],function(&$r){
-        $r['id'] = $this->page->tag('a',$r['id'],'href="'.$this->db->base.'/'.$r['id'].'.'.$this->ext.'"');
+# NB 25.05.17         $r['id'] = $this->page->tag('a',$r['id'],'href="'.$this->db->base.'/'.$r['id'].'.'.$this->ext.'"');
+        $r['id'] = $this->page->tag('a',$r['id'],'href="'.$this->db->base.'/'.$r['id'].'"');
       });
 
     } elseif ($action == 'logout') {
index c1ac9c7206db3073bc04669ca7f6fe3b7804f9cf..2164f4bd0ddac6e6209c10f415c7758febb0a9aa 100644 (file)
@@ -108,14 +108,6 @@ document.addEventListener("DOMContentLoaded", function() {
     document.querySelector("table.rows").insertAdjacentHTML("beforebegin","<div class=\"nav top\">"+document.querySelector(".nav.bottom").innerHTML+"</div>");
   }
 
-  /*
-  document.querySelectorAll("form.menu input[type=text]").forEach(function(e) {
-    e.onfocus = function() {
-      this.setAttribute('style','border:solid 1px red');
-    };
-  });
-  */
-
   // No more than 100% width
   document.querySelectorAll("table").forEach(function(e) {
     if (parseInt(e.offsetWidth) > parseInt(window.innerWidth)) {
index 9bb5d14d2b286a82ba3f122507315cba38d9e9e8..dfb4779ebb05564bbff56eef2d1de7a20707c5ad 100755 (executable)
@@ -1,27 +1,21 @@
 #!/usr/bin/env sh
-! which minify && echo "Please install minify !" 1>&2 && exit 0
+! which minify > /dev/null 2>&1 && echo "Please install minify (npm -g install minify) !" 1>&2 && exit 0
+minify -h | grep -qm1 no-comments && echo "Version not supported" && exit 0
+
 set -e
 cd "$(dirname $0)" 
 
-if minify -h|grep -qm1 no-comments; then
-
-  minify='minify --no-comments'
-
-  echo Update html/default.min.css
-  $minify -o html/default.min.css html/default.css > /dev/null 2>&1
-
-  echo Update html/default.min.js
-  $minify -o html/default.min.js html/default.js > /dev/null 2>&1
-
-  exit
-fi
-
+ex=0
 for f in $(find html -type f \( -name '*.css' -o -name '*.js' \) -a -not -name '*.min.*'); do
+
   min=$(echo "$f" | sed 's/\./.min./')
   ext="${f##*.}"
-  #echo minify --$ext " < $f > $min"
-  echo "$f"
+
+  echo "Minify "$( ( realpath "$f" 2> /dev/null || echo "$f" ) | sed  "s,^$NB_ROOT/,," )
+
   eval minify --$ext < "$f" > "$min.bak" && mv "$min.bak" "$min"
+  [ "$?" = "0" ] || ex=1
+
 done
 
-[ "$?" = "0" ] || echo Failed
+[ "$ex" = "0" ] || echo Failed