From e70bc4f9de45488978032f1f2a6c16ce7e498bdf Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 30 May 2006 04:17:41 +0000 Subject: [PATCH] Added help navigation git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3549 594d385d-05f5-0310-b6e9-bd551577e9d8 --- html/helpviewer.php | 42 +++++++++++++++++++++++++++++++- include/functions_helpviewer.inc | 7 +++--- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/html/helpviewer.php b/html/helpviewer.php index dbd868b47..dddf0cd8b 100644 --- a/html/helpviewer.php +++ b/html/helpviewer.php @@ -23,7 +23,8 @@ @require_once ("functions.inc"); @require_once ("functions_helpviewer.inc"); -error_reporting(0); +error_reporting(E_ALL); +restore_error_handler(); header("Content-type: text/html; charset=UTF-8"); session_start(); @@ -93,6 +94,7 @@ $backward =$defaultpage; $index =$defaultpage; $forward ="node1.html"; + /* Every class which is called within a tab, stores its name in the Session. * If $_SESSION['current_class_for_help'] isset, * get the helpfile specified in the xml file and display it. @@ -179,6 +181,42 @@ $_SESSION['helpobject'] = $helpobject; * Display management */ +$files = array(); +$f = opendir($helpdir); +while($file = readdir($f)){ + $files[$file]=$file; +} + +/* Some replacements */ +$backwardlink = " + \""._("previous")."\" + "; + +$forwardlink = " + \""._("next")."\" + "; + + +$back = $for =""; +if($helpobject['file'] == "index.html"){ + $back = " "; + $for = sprintf($forwardlink, $prefix."1".$suffix); +}else{ + $current = preg_replace("/^".$prefix."/","",$helpobject['file']); + $current = preg_replace("/\.html$/","",$current); + + if(isset($files[$prefix.($current+1).$suffix])) { + $for = sprintf($forwardlink, $prefix.($current+1).$suffix); + } + if(isset($files[$prefix.($current-1).$suffix])) { + $back = sprintf($backwardlink, $prefix.($current-1).$suffix); + } + if(($current-1) == 0){ + $back = sprintf($backwardlink, "index.html"); + } +} + + /* If there is no helpdir or file defined, display the index */ if(isset($_POST['search'])){ $helpdir = "../doc/guide/user/".$helpobject['lang']."/html/"; @@ -216,6 +254,8 @@ if(isset($_POST['search'])){ $header= "".$smarty->fetch(get_template_path('headers.tpl')); /* I don't know why, but we must use utf8_encode to avoid dispplay errors */ + $smarty->assign("backward",$back); + $smarty->assign("forward" ,$for); $display= utf8_encode( $header.$smarty->fetch(get_template_path('help.tpl'))); echo $display; diff --git a/include/functions_helpviewer.inc b/include/functions_helpviewer.inc index 64d256a18..44938a19b 100644 --- a/include/functions_helpviewer.inc +++ b/include/functions_helpviewer.inc @@ -57,11 +57,12 @@ class parseXml /* This function genereates the Index */ -function genIndex($arr) +function genIndex() { global $helpobject; $str = ""; $test = new pluglist($_SESSION['config'],NULL); + $current_hl = ""; foreach($_SESSION['helpobject']['helpconf'] as $id => $attrs){ $path = $test -> get_path($id); $exists = true; @@ -76,7 +77,7 @@ function genIndex($arr) } $name = $attrs['NAME']; $file = "index.html"; - $path = $plug; + //$path = $plug; if($exists){ $str .= "

"._($name)."

"; }else{ @@ -254,7 +255,7 @@ function linkwrapper($str,$link) { $str = preg_replace("/HREF=\"http/i","target=\"_blank\" href=\"http",$str); $str = preg_replace("/HREF=\"/","href=\"".$link."?pg=",$str); -// $str=str_replace("HREF=\"","href=\"".$link."?pg=",$str); + $str=str_replace("HREF=\"","href=\"".$link."?pg=",$str); return($str); } -- 2.30.2