From 4a67395129b07117d815558fa3152d0a45175a94 Mon Sep 17 00:00:00 2001
From: Brad Shuttleworth
Date: Mon, 27 Feb 2006 14:08:13 +0000
Subject: [PATCH] - improve intro comment. - correct the admin-mode-never-enabled-bug.
---
kthelp/ktcore/EN/welcome.html | 12 ++++++++++++
plugins/ktcore/KTCorePlugin.php | 2 +-
plugins/ktcore/KTDashlets.php | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
plugins/ktcore/admin/manageHelp.php | 7 +++++--
templates/kt3/portlets/admin_mode_portlet.smarty | 2 +-
templates/ktcore/dashlets/beta1info.smarty | 9 ---------
templates/ktcore/dashlets/kt3release.smarty | 11 +++++++++++
7 files changed, 89 insertions(+), 15 deletions(-)
create mode 100644 kthelp/ktcore/EN/welcome.html
delete mode 100644 templates/ktcore/dashlets/beta1info.smarty
create mode 100644 templates/ktcore/dashlets/kt3release.smarty
diff --git a/kthelp/ktcore/EN/welcome.html b/kthelp/ktcore/EN/welcome.html
new file mode 100644
index 0000000..061f2d9
--- /dev/null
+++ b/kthelp/ktcore/EN/welcome.html
@@ -0,0 +1,12 @@
+
+
+Welcome to the KnowledgeTree 3.0
+
+
+We believe that KnowledgeTree 3.0 Release Candidate
+is now stable enough for production evaluation. If you are intending on installing
+KnowledgeTree over the next few months we strongly urge you to evaluate the
+3.0 Release Candidate and consider it for production use.
+There will be an upgrade path for 3.0 Release Candidate to 3.0 Final.
+
+
\ No newline at end of file
diff --git a/plugins/ktcore/KTCorePlugin.php b/plugins/ktcore/KTCorePlugin.php
index f313c50..f0d7785 100644
--- a/plugins/ktcore/KTCorePlugin.php
+++ b/plugins/ktcore/KTCorePlugin.php
@@ -33,7 +33,7 @@ class KTCorePlugin extends KTPlugin {
$this->registerAction('documentaction', 'KTDocumentPermissionsAction', 'ktcore.actions.document.permissions', 'KTPermissions.php');
$this->registerAction('folderaction', 'KTRoleAllocationPlugin', 'ktcore.actions.folder.roles', 'KTPermissions.php');
- $this->registerDashlet('KTBeta1InfoDashlet', 'ktcore.dashlet.beta1info', 'KTDashlets.php');
+ $this->registerDashlet('KTInfoDashlet', 'ktcore.dashlet.info', 'KTDashlets.php');
$this->registerDashlet('KTNotificationDashlet', 'ktcore.dashlet.notifications', 'KTDashlets.php');
$this->registerDashlet('KTCheckoutDashlet', 'ktcore.dashlet.checkout', 'KTDashlets.php');
$this->registerDashlet('KTIndexerStatusDashlet', 'ktcore.dashlet.indexer_status', 'KTDashlets.php');
diff --git a/plugins/ktcore/KTDashlets.php b/plugins/ktcore/KTDashlets.php
index f34b81c..0a5a7af 100644
--- a/plugins/ktcore/KTDashlets.php
+++ b/plugins/ktcore/KTDashlets.php
@@ -5,16 +5,73 @@ require_once(KT_LIB_DIR . "/templating/templating.inc.php");
require_once(KT_LIB_DIR . "/dashboard/Notification.inc.php");
require_once(KT_LIB_DIR . "/security/Permission.inc");
+require_once(KT_LIB_DIR . '/help/help.inc.php');
+require_once(KT_LIB_DIR . '/help/helpreplacement.inc.php');
+
// ultra simple skeleton for the admin tutorial
-class KTBeta1InfoDashlet extends KTBaseDashlet {
+class KTInfoDashlet extends KTBaseDashlet {
+ var $aHelpInfo;
+ var $canEdit = false;
+ var $helpLocation = 'ktcore/welcome.html';
+ var $help_id;
+
function is_active($oUser) {
+ // FIXME help is a little too mixed.
+ $aHelpInfo = array();
+ $can_edit = Permission::userIsSystemAdministrator($_SESSION['userID']);
+
+ $help_path = KTHelp::getHelpSubPath($this->helpLocation);
+ if ($help_path == false) {
+ return false;
+ }
+
+ // We now check for substitute help files. try to generate an error.
+ $oReplacementHelp = KTHelpReplacement::getByName($help_path);
+
+ $aHelpInfo = KTHelp::getHelpFromFile($this->helpLocation);
+
+ // NORMAL users never see edit-option.
+ if (!$can_edit) {
+ if (!PEAR::isError($oReplacementHelp)) {
+ ;
+ } elseif ($aHelpInfo != false) {
+ ;
+ } else {
+ return false;
+ }
+ }
+
+
+
+ if (!PEAR::isError($oReplacementHelp)) {
+ $aHelpInfo['title'] = $oReplacementHelp->getTitle();
+ $aHelpInfo['body'] = $oReplacementHelp->getDescription();
+ $this->help_id = $oReplacementHelp->getId();
+
+ } else {
+ $this->help_id = null;
+ }
+
+ if (empty($aHelpInfo)) { return false; }
+
+ $this->aHelpInfo = $aHelpInfo;
+ $this->canEdit = $can_edit;
+
return true;
}
function render() {
$oTemplating =& KTTemplating::getSingleton();
- $oTemplate = $oTemplating->loadTemplate("ktcore/dashlets/beta1info");
+ $oTemplate = $oTemplating->loadTemplate("ktcore/dashlets/kt3release");
+
+
+
$aTemplateData = array(
+ 'title' => $this->aHelpInfo['title'],
+ 'body' => $this->aHelpInfo['body'],
+ 'can_edit' => $this->canEdit,
+ 'target_name' => $this->helpLocation,
+ 'help_id' => $this->help_id,
);
return $oTemplate->render($aTemplateData);
}
diff --git a/plugins/ktcore/admin/manageHelp.php b/plugins/ktcore/admin/manageHelp.php
index fb42918..f205f0c 100755
--- a/plugins/ktcore/admin/manageHelp.php
+++ b/plugins/ktcore/admin/manageHelp.php
@@ -97,9 +97,12 @@ class ManageHelpDispatcher extends KTAdminDispatcher {
function do_customise() {
$name = KTUtil::arrayGet($_REQUEST, 'name');
- $name = KTHelp::getHelpSubPath($name);
- $oHelpReplacement = KTHelpReplacement::getByName($name);
+ $subname = KTHelp::getHelpSubPath($name);
+ $oHelpReplacement = KTHelpReplacement::getByName($subname);
// XXX: Check against "already exists"
+
+ //var_dump($name);
+
if (!PEAR::isError($oHelpReplacement)) {
// Already exists...
return $this->errorRedirectTo('editReplacement', _('Replacement already exists.'),'id=' . $oHelpReplacement->getId());
diff --git a/templates/kt3/portlets/admin_mode_portlet.smarty b/templates/kt3/portlets/admin_mode_portlet.smarty
index 5d1bc2e..b9d6dbb 100644
--- a/templates/kt3/portlets/admin_mode_portlet.smarty
+++ b/templates/kt3/portlets/admin_mode_portlet.smarty
@@ -1,7 +1,7 @@
{i18n}Disable Admin Mode{/i18n}
{i18n}Disable Admin Mode{/i18n}
{else}
diff --git a/templates/ktcore/dashlets/beta1info.smarty b/templates/ktcore/dashlets/beta1info.smarty
deleted file mode 100644
index 6ed496c..0000000
--- a/templates/ktcore/dashlets/beta1info.smarty
+++ /dev/null
@@ -1,9 +0,0 @@
-{i18n}Welcome to the KnowledgeTree 3 Release Candidate{/i18n}
-{i18n}We believe that KnowledgeTree 3.0 Release Candidate
-is now stable enough for production evaluation. If you are intending on installing
-KnowledgeTree over the next few months we strongly urge you to evaluate the
-3.0 Release Candidate and consider it for production use.
-There will be an upgrade path for 3.0 Release Candidate to 3.0 Final.{/i18n}
-
-{i18n}Help! Something went wrong!{/i18n}
diff --git a/templates/ktcore/dashlets/kt3release.smarty b/templates/ktcore/dashlets/kt3release.smarty
new file mode 100644
index 0000000..515582b
--- /dev/null
+++ b/templates/ktcore/dashlets/kt3release.smarty
@@ -0,0 +1,11 @@
+{$title}
+
+{$body}
+
+{if $can_edit}
+{i18n}Edit this introduction.{/i18n}
+{i18n}Edit this introduction.{/i18n}
+{if $help_id}| {i18n}Use the standard introduction.{/i18n}
+{/if}
+{/if}
\ No newline at end of file
--
libgit2 0.21.4