diff --git a/browse.php b/browse.php index 2b28258..c99a10b 100755 --- a/browse.php +++ b/browse.php @@ -51,6 +51,7 @@ class BrowseDispatcher extends KTStandardDispatcher { var $browse_mode = null; var $query = null; var $resultURL; + var $sHelpPage = 'ktcore/browse/browse.html'; function BrowseDispatcher() { $this->aBreadcrumbs = array( diff --git a/help.php b/help.php new file mode 100644 index 0000000..3a18b08 --- /dev/null +++ b/help.php @@ -0,0 +1,107 @@ +bIsReplacement; } + + function do_main() { + $pathinfo = KTUtil::arrayGet($_SERVER, 'PATH_INFO'); + if (empty($pathinfo)) { + $this->oPage->setTitle(_('No help page specified.')); + $this->oPage->addError(_('No help page specified.')); + return ' '; + } + + $can_edit = Permission::userIsSystemAdministrator($_SESSION['userID']); + + $help_path = KTHelp::getHelpSubPath($pathinfo); + if ($help_path == false) { + $this->oPage->setTitle(_('Invalid help location specified.')); + $this->oPage->addError(_('Invalid help location specified.')); + return ' '; + } + + // We now check for substitute help files. try to generate an error. + $oReplacementHelp = KTHelpReplacement::getByName($help_path); + + // OK. we know its an image, or html. + if (KTHelp::isImageFile($help_path)) { + KTHelp::outputHelpImage($help_path); + } else { + // not an image, so: + $aHelpInfo = KTHelp::getHelpFromFile($pathinfo); + } + + + // NORMAL users never see edit-option. + if (!$can_edit) { + if (!PEAR::isError($oReplacementHelp)) { + $this->oPage->setTitle($oReplacementHelp->getTitle()); + return $oReplacementHelp->getDescription(); + } elseif ($aHelpInfo != false) { + $this->oPage->setTitle($aHelpInfo['title']); + return $aHelpInfo['body']; + } else { + $this->oPage->setTitle(_('Invalid help location specified.')); + $this->oPage->addError(_('Invalid help location specified.')); + return ' '; + } + } + + if (!PEAR::isError($oReplacementHelp)) { + $aHelpInfo['title'] = $oReplacementHelp->getTitle(); + $aHelpInfo['body'] = $oReplacementHelp->getDescription(); + } + // we now _can_ edit. + + $this->oPage->setTitle($aHelpInfo['title']); + + $oTemplating = new KTTemplating; + $oTemplate = $oTemplating->loadTemplate("ktcore/help_with_edit"); + $aTemplateData = array( + "context" => $this, + "help_body" => $aHelpInfo['body'], + "target_name" => $_SERVER['PATH_INFO'], + ); + return $oTemplate->render($aTemplateData); + } + +} + +$oDispatcher = new HelpDispatcher(); +$oDispatcher->dispatch(); + +?> + diff --git a/index.html b/index.html index 0e77600..095ff53 100644 --- a/index.html +++ b/index.html @@ -2,4 +2,7 @@
+ +You should automatically be redirected to the login / dashboard page. +