From: hickert Date: Fri, 10 Jun 2005 07:31:09 +0000 (+0000) Subject: Check for helpfiles X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c834b95bf0631ffbefb7904ddfc4b52f89e4abcd;p=gosa.git Check for helpfiles git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@644 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/html/helpviewer.php b/html/helpviewer.php index ceaa5161e..a9a26825a 100644 --- a/html/helpviewer.php +++ b/html/helpviewer.php @@ -87,6 +87,7 @@ function myone($par1,$par2,$par3,$par3) print "
Seite : ".$par1."
Name : ".$par2."
Seite : ".$par3."
Zeile : ".$par3; } + /* Define which tags musst be delete, header, navigation, banner */ $replacements=array(); $replacements['from']=array("@@si", @@ -115,116 +116,133 @@ $forward ="node1.html"; /* Here it begins, the real function, above only definitions */ -/* We prepare to search, all Document for the given keyword */ -if(isset($_POST['search'])){ - - /* Get Keyword */ - $keyword = $_POST['search_string']; - /* Save Keyword to be able to show last searched word in template */ - $_SESSION['search_string']= $keyword; +if(!file_exists(HELP_BASEDIR."/en/manual_gosa_en/")){ + /* prevent php warning missing value ... or so*/ + $smarty->assign("backward",""); + $smarty->assign("index" ,""); + $smarty->assign("forward" ,""); + $smarty->assign("search_string",""); + $smarty->assign("help_contents","
".sprintf(_("Can't read any helpfiles from ' %s ', possibly there is no help available."),HELP_BASEDIR."/en/manual_gosa_en/")); + + /* Output html ...*/ + $header= "".$smarty->fetch(get_template_path('headers.tpl')); + $display= $header.$smarty->fetch(get_template_path('help.tpl')); + echo $display; - /* Read all files with contents*/ - /* |Folder="/var/ww...", - | |Fileprefix="node" - | | |Filesuffix=".html" - | | | |WithoutContent=false(This means : read content) - | | | | |Singlepage=false(Means read all, if w want to read single, specify its filename)"*/ - $arr = readfiles($helpdir,$prefix,$suffix,false,$singlepage=false); - /* Create Searchresult for our Keyword(s) */ - $res = search($arr,$keyword); +}else{ + + /* We prepare to search, all Document for the given keyword */ + if(isset($_POST['search'])){ - /* Tell smarty which pages to use for backward forwa.. */ - $smarty->assign("backward",$backward); - $smarty->assign("index" ,$index); - $smarty->assign("forward" ,$forward); + /* Get Keyword */ + $keyword = $_POST['search_string']; - /* Tell smarty the Keyword, to show it in the input field again */ - $smarty->assign("search_string",$keyword); + /* Save Keyword to be able to show last searched word in template */ + $_SESSION['search_string']= $keyword; - /* Create result list */ - $smarty->assign("help_contents",searchlist($arr,$res,$maxresults)); + /* Read all files with contents*/ + /* |Folder="/var/ww...", + | |Fileprefix="node" + | | |Filesuffix=".html" + | | | |WithoutContent=false(This means : read content) + | | | | |Singlepage=false(Means read all, if w want to read single, specify its filename)"*/ + $arr = readfiles($helpdir,$prefix,$suffix,false,$singlepage=false); - /* Output html ...*/ - $header= "".$smarty->fetch(get_template_path('headers.tpl')); - $display= $header.$smarty->fetch(get_template_path('help.tpl')); - echo $display; + /* Create Searchresult for our Keyword(s) */ + $res = search($arr,$keyword); - /* - Don't search, only show selected page - */ -}else{ + /* Tell smarty which pages to use for backward forwa.. */ + $smarty->assign("backward",$backward); + $smarty->assign("index" ,$index); + $smarty->assign("forward" ,$forward); - /* present last searched word(s)*/ - if(!isset($_SESSION['search_string'])){ - $_SESSION['search_string']=""; - } - + /* Tell smarty the Keyword, to show it in the input field again */ + $smarty->assign("search_string",$keyword); - $smarty->assign("search_string",$_SESSION['search_string']); + /* Create result list */ + $smarty->assign("help_contents",searchlist($arr,$res,$maxresults)); - /* Read all files, prepare to serach */ - $helppages = readfiles($helpdir,$prefix,$suffix,true); + /* Output html ...*/ + $header= "".$smarty->fetch(get_template_path('headers.tpl')); + $display= $header.$smarty->fetch(get_template_path('help.tpl')); + echo $display; - /* Get transmitted page */ - if(isset($_GET['pg'])){ - $page = $_GET['pg']; + /* + Don't search, only show selected page + */ }else{ - $page = $defaultpage; - } - /* test if this page exists, in our array of files */ - if((!isset($helppages[$page]))&&($page!=$defaultpage)) - { - //print "Requested helppage is unknown, redirekted to index"; // For debugging only - $page = $defaultpage; - } + /* present last searched word(s)*/ + if(!isset($_SESSION['search_string'])){ + $_SESSION['search_string']=""; + } + - /* Check forward backward, funtionality*/ - if($page != $defaultpage) - { - /* Extract Number of node page */ - $number = str_replace($prefix,"",str_replace($suffix,"",$page)); + $smarty->assign("search_string",$_SESSION['search_string']); - /* Check if we can switch forward and/or backward*/ - $bck = $prefix.($number-1).$suffix; - $fck = $prefix.($number+1).$suffix; + /* Read all files, prepare to serach */ + $helppages = readfiles($helpdir,$prefix,$suffix,true); - /* backward page exists ?, so allow it*/ - if((isset($helppages[$bck]))) { - $backward = $bck; + /* Get transmitted page */ + if(isset($_GET['pg'])){ + $page = $_GET['pg']; + }else{ + $page = $defaultpage; } - /* forward exists ?*/ - if((isset($helppages[$fck]))) { - $forward = $fck; + /* test if this page exists, in our array of files */ + if((!isset($helppages[$page]))&&($page!=$defaultpage)) + { + //print "Requested helppage is unknown, redirekted to index"; // For debugging only + $page = $defaultpage; } - } - $help_contents=readfiles($helpdir,$prefix,$suffix,false,$page); + /* Check forward backward, funtionality*/ + if($page != $defaultpage) + { + /* Extract Number of node page */ + $number = str_replace($prefix,"",str_replace($suffix,"",$page)); + + /* Check if we can switch forward and/or backward*/ + $bck = $prefix.($number-1).$suffix; + $fck = $prefix.($number+1).$suffix; + + /* backward page exists ?, so allow it*/ + if((isset($helppages[$bck]))) { + $backward = $bck; + } + + /* forward exists ?*/ + if((isset($helppages[$fck]))) { + $forward = $fck; + } + } - /* Mark last searched words */ - if(isset($_GET['mark'])){ - $marks = ($_SESSION['lastresults']) ; - $help_contents = markup_page($help_contents[$page]['content'],$marks[$page]); - $help_contents=remove_unwanted_tags($help_contents,$replacements); - }else{ - $help_contents=remove_unwanted_tags($help_contents[$page]['content'],$replacements); - } + $help_contents=readfiles($helpdir,$prefix,$suffix,false,$page); - $smarty->assign("help_contents",$help_contents); + /* Mark last searched words */ + if(isset($_GET['mark'])){ + $marks = ($_SESSION['lastresults']) ; + $help_contents = markup_page($help_contents[$page]['content'],$marks[$page]); + $help_contents=remove_unwanted_tags($help_contents,$replacements); + }else{ + $help_contents=remove_unwanted_tags($help_contents[$page]['content'],$replacements); + } - /* Define our own navigation pages */ - $smarty->assign("backward",$backward); - $smarty->assign("index" ,$index); - $smarty->assign("forward" ,$forward); + $smarty->assign("help_contents",$help_contents); - /* Fill page */ - $header= "".$smarty->fetch(get_template_path('headers.tpl')); - $display= $header.$smarty->fetch(get_template_path('help.tpl')); - echo $display; -} + /* Define our own navigation pages */ + $smarty->assign("backward",$backward); + $smarty->assign("index" ,$index); + $smarty->assign("forward" ,$forward); + /* Fill page */ + $header= "".$smarty->fetch(get_template_path('headers.tpl')); + $display= $header.$smarty->fetch(get_template_path('help.tpl')); + echo $display; + } +} // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>