diff --git a/browse.php b/browse.php index 50fcc75..66a0537 100755 --- a/browse.php +++ b/browse.php @@ -89,6 +89,8 @@ $sectionName = "browse"; class BrowseDispatcher extends KTStandardDispatcher { + var $sName = 'ktcore.actions.folder.view'; + var $oFolder = null; var $sSection = "browse"; var $browse_mode = null; @@ -174,7 +176,12 @@ class BrowseDispatcher extends KTStandardDispatcher { $this->aBreadcrumbs = array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForFolder($oFolder)); - $portlet = new KTActionPortlet(_kt("Folder Actions")); + $portlet = new KTActionPortlet(sprintf(_kt('Info about "%s"'), $this->oFolder->getName())); + $aActions = KTFolderActionUtil::getFolderInfoActionsForFolder($this->oFolder, $this->oUser); + $portlet->setActions($aActions,$this->sName); + $this->oPage->addPortlet($portlet); + + $portlet = new KTActionPortlet(sprintf(_kt('Actions on "%s"'), $this->oFolder->getName())); $aActions = KTFolderActionUtil::getFolderActionsForFolder($oFolder, $this->oUser); $portlet->setActions($aActions,null); $this->oPage->addPortlet($portlet); diff --git a/lib/actions/folderaction.inc.php b/lib/actions/folderaction.inc.php index 511f099..c0b8eec 100644 --- a/lib/actions/folderaction.inc.php +++ b/lib/actions/folderaction.inc.php @@ -98,6 +98,7 @@ class KTFolderAction extends KTStandardDispatcher { $aInfo = array( 'description' => $this->sDescription, 'name' => $this->getDisplayName(), + 'ns' => $this->sName, 'url' => $this->getURL(), ); return $this->customiseInfo($aInfo); @@ -134,9 +135,14 @@ class KTFolderAction extends KTStandardDispatcher { $this->aBreadcrumbs = kt_array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForFolder($this->oFolder, $aOptions)); - $portlet = new KTActionPortlet(_kt("Folder Actions")); + $portlet = new KTActionPortlet(sprintf(_kt('Info about "%s"'), $this->oFolder->getName())); + $aActions = KTFolderActionUtil::getFolderInfoActionsForFolder($this->oFolder, $this->oUser); + $portlet->setActions($aActions,$this->sName); + $this->oPage->addPortlet($portlet); + + $portlet = new KTActionPortlet(sprintf(_kt('Actions on "%s"'), $this->oFolder->getName())); $aActions = KTFolderActionUtil::getFolderActionsForFolder($this->oFolder, $this->oUser); - $portlet->setActions($aActions,null); + $portlet->setActions($aActions,$this->sName); $this->oPage->addPortlet($portlet); if (KTPermissionUtil::userHasPermissionOnItem($this->oUser, 'ktcore.permissions.folder_details', $this->oFolder)) { @@ -163,6 +169,10 @@ class KTFolderActionUtil { $oRegistry =& KTActionRegistry::getSingleton(); return $oRegistry->getActions('folderaction'); } + function getFolderInfoActions() { + $oRegistry =& KTActionRegistry::getSingleton(); + return $oRegistry->getActions('folderinfo'); + } function &getFolderActionsForFolder($oFolder, $oUser) { $aObjects = array(); foreach (KTFolderActionUtil::getFolderActions() as $aAction) { @@ -176,6 +186,19 @@ class KTFolderActionUtil { } return $aObjects; } + function &getFolderInfoActionsForFolder($oFolder, $oUser) { + $aObjects = array(); + foreach (KTFolderActionUtil::getFolderInfoActions() as $aAction) { + list($sClassName, $sPath, $sPlugin) = $aAction; + $oRegistry =& KTPluginRegistry::getSingleton(); + $oPlugin =& $oRegistry->getPlugin($sPlugin); + if (!empty($sPath)) { + require_once($sPath); + } + $aObjects[] =& new $sClassName($oFolder, $oUser, $oPlugin); + } + return $aObjects; + } } ?> diff --git a/lib/templating/kt3template.inc.php b/lib/templating/kt3template.inc.php index ea8ff6d..46011f3 100644 --- a/lib/templating/kt3template.inc.php +++ b/lib/templating/kt3template.inc.php @@ -39,7 +39,6 @@ require_once(KT_LIB_DIR . "/templating/templating.inc.php"); require_once(KT_LIB_DIR . "/session/control.inc"); class KTPage { - var $hide_section = false; var $secondary_title = null; @@ -79,6 +78,8 @@ class KTPage { var $contentType = 'text/html'; var $charset = 'UTF-8'; + var $content_class; + /* further initialisation */ function KTPage() { /* default css files initialisation */ @@ -212,6 +213,8 @@ class KTPage { function setBreadcrumbDetails($sBreadcrumbDetails) { $this->breadcrumbDetails = $sBreadcrumbDetails; } function setUser($oUser) { $this->user = $oUser; } + function setContentClass($sClass) { $this->content_class = $sClass; } + // FIXME refactor setSection to be generic, not an if-else. // assume this is admin for now. function setSection($sSection) { diff --git a/lib/widgets/portlet.inc.php b/lib/widgets/portlet.inc.php index 77fee2b..148197e 100644 --- a/lib/widgets/portlet.inc.php +++ b/lib/widgets/portlet.inc.php @@ -38,6 +38,7 @@ require_once(KT_LIB_DIR . "/templating/templating.inc.php"); class KTPortlet { var $sTitle; var $oPlugin; + var $bActive = false; function KTPortlet($title='') { $this->sTitle = $title; @@ -59,6 +60,10 @@ class KTPortlet { function setDispatcher(&$oDispatcher) { $this->oDispatcher =& $oDispatcher; } + + function getActive() { + return $this->bActive; + } } @@ -98,15 +103,18 @@ class KTNavPortlet extends KTPortlet { class KTActionPortlet extends KTPortlet { var $actions = array(); + + var $bActive = true; // current action is the one we are currently on. function setActions($actions, $currentaction) { foreach ($actions as $action) { $aInfo = $action->getInfo(); - + if ($aInfo !== null) { - if ($aInfo["name"] == $currentaction) { + if ($aInfo["ns"] == $currentaction) { unset($aInfo["url"]); + $aInfo['active'] = true; } $this->actions[] = $aInfo; } diff --git a/plugins/ktcore/KTFolderActions.php b/plugins/ktcore/KTFolderActions.php index e256f4c..d942393 100644 --- a/plugins/ktcore/KTFolderActions.php +++ b/plugins/ktcore/KTFolderActions.php @@ -38,6 +38,21 @@ require_once(KT_LIB_DIR . '/plugins/pluginregistry.inc.php'); require_once(KT_LIB_DIR . '/roles/Role.inc'); +// {{{ KTDocumentDetailsAction +class KTFolderViewAction extends KTFolderAction { + var $sName = 'ktcore.actions.folder.view'; + + function do_main() { + redirect(KTBrowseUtil::getUrlForFolder($this->oFolder)); + exit(0); + } + + function getDisplayName() { + return _kt('Display Details'); + } +} +// }}} + class KTFolderAddFolderAction extends KTFolderAction { var $sName = 'ktcore.actions.folder.addFolder'; diff --git a/templates/kt3/portlets/actions_portlet.smarty b/templates/kt3/portlets/actions_portlet.smarty index 28e7eb7..58d1f47 100644 --- a/templates/kt3/portlets/actions_portlet.smarty +++ b/templates/kt3/portlets/actions_portlet.smarty @@ -1,7 +1,7 @@