diff --git a/config/siteMap.inc b/config/siteMap.inc index 3e253f1..bbb1ea2 100644 --- a/config/siteMap.inc +++ b/config/siteMap.inc @@ -134,6 +134,8 @@ $default->siteMap->addPage("browseAdministration", "/presentation/lookAndFeel/kn $default->siteMap->addPage("docLinkManagement", "/presentation/lookAndFeel/knowledgeTree/administration/doclinkmanagement/listLinkTypesBL.php", "Administration", SysAdmin, _("Link Type Management"), true, 16); +$default->siteMap->addPage("helpAdmin", "/presentation/lookAndFeel/knowledgeTree/administration/help/manageHelp.php", "Administration", SysAdmin, _("Help Administration"), true, 17); + $default->siteMap->addSectionColour("Administration", "th", "056DCE"); $default->siteMap->addSectionColour("Administration", "td", "6699FF"); diff --git a/config/tableMappings.inc b/config/tableMappings.inc index 79828f2..7dc9582 100644 --- a/config/tableMappings.inc +++ b/config/tableMappings.inc @@ -113,4 +113,5 @@ $default->status_table = "status_lookup"; $default->search_permissions_table = "search_document_user_link"; $default->document_link_types_table = "document_link_types"; $default->upgrades_table = "upgrades"; +$default->help_replacement_table = "help_replacement"; ?> diff --git a/lib/help/help.inc.php b/lib/help/help.inc.php new file mode 100644 index 0000000..e0c21ea --- /dev/null +++ b/lib/help/help.inc.php @@ -0,0 +1,29 @@ +help_table AS hlp WHERE hlp.fSection = ?"; + $aParams = array($sSection); + $sHelpFile = DBUtil::getOneResultKey(array($sQuery, $aParams), 'helpinfo'); + if (PEAR::isError($sHelpFile)) { + return $sHelpFile; + } + $sQuery = "SELECT hlprp.description AS contents FROM + $default->help_replacement_table AS hlprp WHERE + hlprp.name = ?"; + $aParams = array($sHelpFile); + $sHelpContents = DBUtil::getOneResultKey(array($sQuery, + $aParams), 'contents'); + if (PEAR::isError($sHelpContents)) { + return $sHelpContents; + } + if (!(is_null($sHelpContents) || trim($sHelpContents) === "")) { + return $sHelpContents; + } + return file_get_contents("$default->uiDirectory/help/" . $sHelpFile); + } +} + +?> diff --git a/lib/help/helpreplacement.inc.php b/lib/help/helpreplacement.inc.php new file mode 100644 index 0000000..8bd3a83 --- /dev/null +++ b/lib/help/helpreplacement.inc.php @@ -0,0 +1,49 @@ + "id", + "sName" => "name", + "sDescription" => "description", + ); + + var $_bUsePearError = true; + + function getID() { return $this->iId; } + function getName() { return $this->sName; } + function getDescription() { return $this->sDescription; } + function setID($iId) { $this->iId = $iId; } + function setName($sName) { $this->sName = $sName; } + function setDescription($sDescription) { $this->sDescription = $sDescription; } + + function _table () { + global $default; + return $default->help_replacement_table; + } + + // STATIC + function &get($iId) { + return KTEntityUtil::get('KTHelpReplacement', $iId); + } + + // STATIC + function &createFromArray($aOptions) { + return KTEntityUtil::createFromArray('KTHelpReplacement', $aOptions); + } + + function &getList($sWhereClause = null) { + global $default; + return KTEntityUtil::getList($default->help_replacement_table, 'KTHelpReplacement', $sWhereClause); + } +} + +?> diff --git a/presentation/lookAndFeel/knowledgeTree/administration/help/manageHelp.php b/presentation/lookAndFeel/knowledgeTree/administration/help/manageHelp.php new file mode 100644 index 0000000..34f3247 --- /dev/null +++ b/presentation/lookAndFeel/knowledgeTree/administration/help/manageHelp.php @@ -0,0 +1,84 @@ +Value = $oHelp->getDescription(); + // $oEditor->Height = 400; + + $oTemplate = $oTemplating->loadTemplate("ktcore/manage_help_item"); + $aTemplateData = array( + "help" => $oHelp, + // "fck" => $oEditor, + ); + return $oTemplate->render($aTemplateData); +} + +function getData() { + $oTemplating = new KTTemplating; + $aHelps = KTHelpReplacement::getList(); + $oTemplate = $oTemplating->loadTemplate("ktcore/manage_help"); + $aTemplateData = array( + "helps" => $aHelps, + ); + + return $oTemplate->render($aTemplateData); +} + +$id = KTUtil::arrayGet($_REQUEST, 'id'); +if ($id) { + $action = KTUtil::arrayGet($_REQUEST, 'action'); + if ($action === "update") { + $oHelp =& KTHelpReplacement::get($id); + if (PEAR::isError($oHelp)) { + $_SESSION['KTErrorMessage'][] = "Help for that item not found"; + exit(controllerRedirect('helpAdmin')); + } + $description = KTUtil::arrayGet($_REQUEST, 'description'); + if ($description) { + $oHelp->setDescription($description); + $res = $oHelp->update(); + if (PEAR::isError($res)) { + $_SESSION['KTErrorMessage'][] = "Error updating + object"; + $data = getItemData($id); + } else { + $_SESSION['KTErrorMessage'][] = "Updated"; + exit(controllerRedirect('helpAdmin')); + } + } else { + $_SESSION['KTErrorMessage'][] = "No description given"; + var_dump($_REQUEST); + exit(0); + $data = getItemData($id); + } + } else { + $data = getItemData($id); + } +} else { + $data = getData(); +} + +$sectionName = "Administration"; + +require_once(KT_DIR . "/presentation/webpageTemplate.inc"); +$main->bFormDisabled = true; +$main->setCentralPayload($data); +$main->render(); + +?> diff --git a/presentation/lookAndFeel/knowledgeTree/help.php b/presentation/lookAndFeel/knowledgeTree/help.php index 2665c42..bd9190f 100644 --- a/presentation/lookAndFeel/knowledgeTree/help.php +++ b/presentation/lookAndFeel/knowledgeTree/help.php @@ -40,16 +40,6 @@ $headingBar .= "\t\n"; $headingBar .= "\n"; echo $headingBar; -//Query the database for the helpURL based on the current action -/*ok*/ $sQuery = array("SELECT HLP.help_info as helpinfo ". - "FROM $default->help_table AS HLP WHERE HLP.fSection = ?", $_REQUEST['fAction']); - -$sql = $default->db; -$sql->query($sQuery); - -if ($sql->next_record()) { - require_once("$default->uiDirectory/help/" . $sql->f("helpinfo")); -} else { - echo "No help available for " . $_REQUEST['fAction']; -} +require_once(KT_LIB_DIR . '/help/help.inc.php'); +print KTHelp::getHelpStringForSection($_REQUEST['fAction']); ?> diff --git a/templates/ktcore/manage_help.smarty b/templates/ktcore/manage_help.smarty new file mode 100644 index 0000000..33f3ae6 --- /dev/null +++ b/templates/ktcore/manage_help.smarty @@ -0,0 +1,74 @@ +

Existing permissions

+ +{literal} + +{/literal} + + + + + + + +{ foreach item=oHelpReplacement from=$helps } + + + +{ /foreach } +
Name
+{ $oHelpReplacement->sName } +
+ diff --git a/templates/ktcore/manage_help_item.smarty b/templates/ktcore/manage_help_item.smarty new file mode 100644 index 0000000..07b5e3f --- /dev/null +++ b/templates/ktcore/manage_help_item.smarty @@ -0,0 +1,16 @@ + + + +
+ + + + +