]> git.nbdom.net Git - nb.git/commitdiff
rent.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 16 Jun 2016 16:13:19 +0000 (18:13 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 16 Jun 2016 16:13:19 +0000 (18:13 +0200)
etc/dbs/rent.php

index 09ff677da2f66c5fe7ea0da85d3f8c692b8abe96..67c2c8d50047910f343d76590283e1c761ff50ac 100644 (file)
@@ -49,7 +49,7 @@ $CONF['_rent'] = array(
           $r['revision'] .= preg_replace_callback('/:(\w+)/',function($m) use(&$r) {return $r[$m[1]];},$t).' ';
         }
         $r['revision'] = trim($r['revision']);
-        tennant_doc($r);
+        tenant_doc($r);
 
       }),
     ),
@@ -65,10 +65,16 @@ function untilde($path) {
   },$path);
 }
 
-function tennant_doc(&$r) {
+function tenant_doc(&$r) { return rent_doc('tenant',$r); }
+function place_doc(&$r) { return rent_doc('place',$r); }
+
+function rent_doc($table,&$r) {
   $url = '';
-  foreach (['idtenant','id'] as $k) {
-    if (isset($r[$k])) $url = '/data/tenant/'.$r[$k];
+  foreach (['id'.$table,'id'] as $k) {
+    if (isset($r[$k])) {
+      $url = '/data/'.$table.'/'.$r[$k];
+      break;
+    }
   }
   if (!$url) return;
 
@@ -91,8 +97,9 @@ function tennant_doc(&$r) {
   ) {
 
     foreach (ls_dir($dir,true) as $p) {
-      #$r['doc'] .= '/data/tenant/'.$p;
-      $r['doc'] .= sprintf('<a href="%s" class="small">%s</a> ',"$url/$p",preg_replace('@^.*?([^/\.]+).*?$@','\1',$p));
+      $r['doc'] .= sprintf('<a href="%s" class="small">%s</a> ',"$url/$p",
+        nb::prettyText(preg_replace('@^.*?([^/\.]+).*?$@','\1',$p))
+      );
     }
 
   }
@@ -101,9 +108,8 @@ function tennant_doc(&$r) {
 
 #die(untilde('~/.gitconfig'));
 if (!empty($_SERVER['DOCUMENT_ROOT'])) {
-  $CONF['_rent']['tables']['tenant'] = array(
-    'row_parse_post' => 'tennant_doc',
-  );
+  $CONF['_rent']['tables']['tenant'] = [ 'row_parse_post' => 'tenant_doc' ];
+  $CONF['_rent']['tables']['place']['row_parse_post'] = 'place_doc';
 }
 
 $CONF['rent'] = array (