]> git.nbdom.net Git - nb.git/commitdiff
dbq
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 6 Dec 2016 13:54:16 +0000 (13:54 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 6 Dec 2016 13:54:16 +0000 (13:54 +0000)
www/dbq/dbq.php
www/dbq/html/default.css

index 9f6ac4d8b9c07746cd5468b5fa313e0161657a43..33974b86923532474af6952fa5a71f0a45c44e1e 100644 (file)
@@ -7,6 +7,9 @@ function dbq_run() {
     'background' => '#009B9C',
     'button' => '#444',
   ];
+  if (empty($_SERVER['DOCUMENT_ROOT'])) $_SERVER['DOCUMENT_ROOT'] = dirname(__FILE__).'/html';
+  require_once($_SERVER['DOCUMENT_ROOT'].'/../../../lib/php/page.php');
+
   #
   # Url
   if (empty($_SERVER['HTTP_USER_AGENT'])) $_SERVER['HTTP_USER_AGENT'] = '';
@@ -14,7 +17,7 @@ function dbq_run() {
     'format' => ( preg_match('/^\S+\s+.Windows|iPhone|Android|Macintosh/',$_SERVER['HTTP_USER_AGENT']) ? 'html' : 'human' ),
     'db' => 'ls',
     'table' => 'ls',
-    'action' => 'ls',
+    'action' => Page::p('action','ls'),
     'params' => '',
   ]);
   #var_export($params);
@@ -25,10 +28,8 @@ function dbq_run() {
 
   #
   # Page
-  if (empty($_SERVER['DOCUMENT_ROOT'])) $_SERVER['DOCUMENT_ROOT'] = dirname(__FILE__).'/html';
-  require_once($_SERVER['DOCUMENT_ROOT'].'/../../../lib/php/page.php');
+  list($title,$nav) = title_nav($params,$ext);
   $params['ext'] = $ext;
-  list($title,$nav) = title_nav($params);
   #debug($nav);
   $Page = new Page([
     'css' => '/default.css',
@@ -48,6 +49,7 @@ body, .button {
 table.rows,
 div.rows,
 .menu,
+.edit,
 object, iframe, pre
 {
   border-color: '.$colors['text'].';
@@ -164,7 +166,12 @@ table.rows th, table.rows td { border-color: '.$colors['text'].'; }
     }]);
     return $Page->end();
 
+  } elseif ($params['action'] == 'edit') {
+    $Table->html_edit();
+    return $Page->end();
+
   }
+
   return false;
 }
 
@@ -212,7 +219,7 @@ function not_implemented() {
   exit;
 }
 
-function title_nav($params) {
+function title_nav($params,$ext) {
   $title = array_filter(array_unique(array_slice(array_values($params),1)),function($v){ return($v=='ls' ? '' : $v); });
   array_unshift($title,'Home');
   $path = '/';
@@ -222,7 +229,7 @@ function title_nav($params) {
     if ($i == 0) {
       $nav[] = [$v,'/'];
     } else {
-      $nav[] = [$v,"$path$v.".$params['ext']];
+      $nav[] = [$v,"$path$v.".$ext];
       $path .= "$v/";
     }
     $i++;
index ca373a163cd8e78b0df38a8db0b8815e2a48f2b2..09a433d7cea4befc51382323872cbd0705217c51 100644 (file)
@@ -48,6 +48,9 @@ input[type=''], {
   border-radius: 4px;
   border: solid 1px #eee;
 }
+input[size] {
+  max-width: 70%;
+}
 
 form label:after { content: ':'; }
 
@@ -60,6 +63,7 @@ form select {
 
 table.rows,
 div.rows,
+.edit,
 .menu,
 object, iframe, pre
 {
@@ -78,7 +82,7 @@ table.rows th, table.rows td { border-bottom: solid 1px; }
 table.rows tr:last-child td { border-bottom: none; }
 
 .menu, .nav, .rows,
-.center {
+.buttons, .center {
   margin-left: auto;
   margin-right: auto;
   display: table;
@@ -112,3 +116,19 @@ form a.button:visited, form a.button {
   top: -1px;
 }
 */
+.edit .fields label {
+  width: 25%;
+  text-align: right;
+  display: inline-block;
+  margin-right: 1em;
+  vertical-align: top;
+}
+.edit .fields .label span {
+  width: 54%;
+  display: inline-block;
+  text-align: left;
+}
+
+form.edit .fields input, form.edit .fields textarea, form.edit .fields select {
+  width: 65%;
+}