From: Nicolas Boisselier Date: Thu, 16 Jun 2016 16:13:19 +0000 (+0200) Subject: rent.php X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=78ee9137eb9f11b594fb64b347a6fc2895d95663;p=nb.git rent.php --- diff --git a/etc/dbs/rent.php b/etc/dbs/rent.php index 09ff677d..67c2c8d5 100644 --- a/etc/dbs/rent.php +++ b/etc/dbs/rent.php @@ -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('%s ',"$url/$p",preg_replace('@^.*?([^/\.]+).*?$@','\1',$p)); + $r['doc'] .= sprintf('%s ',"$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 (