From b00f604eb79f9792940ae8a138650f350a1cda4a Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 22 Jan 2006 05:51:37 +0000 Subject: [PATCH] Added new functions to mimic out() --- includes/node.php | 51 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/includes/node.php b/includes/node.php index 38ade4b..f588c58 100644 --- a/includes/node.php +++ b/includes/node.php @@ -126,6 +126,55 @@ class Node_Controller $this->cachev = new cacheV($this); } + // ################################################################### + /** + * Produces a link href that allows for a completely different path + * than the one in the controller. This is used for navigating upstream. + * + * @access public + * + * @param string Base path (e.g. browse.php) + * @param string New relative path + * + * @return string Constructed path + */ + function href_struct($base, $path) + { + $url = Paths::fetch_arguments($base); + $path = Paths::sanitize($addpath); + + return $this->registry->path . '/' . $url[0] . '/' . $this->repos . ($path{0} != '/' ? '/' : '') . $path . ($url[1] ? '?' . $url[1] : ''); + } + + // ################################################################### + /** + * Compounds a path by adding another level. This is used for navigating + * downstream. + * + * @access public + * + * @param string Base path (e.g. browse.php) + * @param string Attach path (or none for current) + * + * @return string Constructed path + */ + function href_compound($base, $attach = null) + { + $url = Paths::fetch_arguments($base); + $attach = Paths::sanitize($attach); + + if ($attach === null) + { + $path = $this->path; + } + else + { + $path = $this->path . ($attach{0} != '/' ? '/' : '') . $attach; + } + + return $this->href_struct($base, $path); + } + // ################################################################### /** * Constructs a repository browser link @@ -181,7 +230,7 @@ class Node_Controller { $itembit .= $item; $itembit .= (($count != $val OR $this->cachev->isdir($itembit)) ? '/' : ''); - $html .= '' . $item . ''. ($count != $val ? ' / ' : ''); + $html .= '' . $item . ''. ($count != $val ? ' / ' : ''); } return $html; -- 2.43.5