diff --git a/lib/actions/documentviewlet.inc.php b/lib/actions/documentviewlet.inc.php
new file mode 100644
index 0000000..613ff12
--- /dev/null
+++ b/lib/actions/documentviewlet.inc.php
@@ -0,0 +1,43 @@
+
diff --git a/templates/ktcore/document/view.smarty b/templates/ktcore/document/view.smarty
index eebe3a7..4097ab5 100644
--- a/templates/ktcore/document/view.smarty
+++ b/templates/ktcore/document/view.smarty
@@ -40,20 +40,14 @@ these tasks, use the Request Assistance action.{/i18n}
{$oFieldset->render($document_data)}
{/foreach}
+{if !empty($viewlets)}
+
-
Someone please suggest some "viewlets" we can ship by default ...
-this is a tad bare.
-
-{*
-
-
- {foreach from=$viewlet_info item=aInfo}
- - {$aInfo.name}
- {/foreach}
-
-
-*}
+{foreach from=$viewlets item=oViewlet}
+ {$oViewlet->display_viewlet()}
+{/foreach}
+{/if}
diff --git a/view.php b/view.php
index 91a52d7..4cfbb57 100755
--- a/view.php
+++ b/view.php
@@ -200,36 +200,26 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
}
}
- $this->oPage->setContentClass('view');
- /*
- // we want to enable the viewlets.
-
- $aMajorInfo = KTDocumentActionUtil::getDocumentActionsByNames(array('ktcore.actions.document.view',), 'documentinfo', $this->oDocument, $this->oUser);
- $aMajorActions = KTDocumentActionUtil::getDocumentActionsByNames(array(
- 'ktcore.actions.document.checkout',
- 'ktcore.actions.document.cancelcheckout',
- 'ktcore.actions.document.checkin',
- 'ktcore.actions.document.edit'
- ), 'documentaction', $this->oDocument, $this->oUser);
-
- $aMajorViewletActions = kt_array_merge($aMajorInfo, $aMajorActions);
- $aViewletInfo = array();
-
- //var_dump($aMajorActions[0]);
-
- foreach ($aMajorViewletActions as $action) {
-
- $aInfo = $action->getInfo();
-
+ // viewlets.
+ $aViewlets = array();
+ $aViewletActions = KTDocumentActionUtil::getDocumentActionsForDocument($this->oDocument, $this->oUser, 'documentviewlet');
+ foreach ($aViewletActions as $oAction) {
+ $aInfo = $oAction->getInfo();
+
if ($aInfo !== null) {
- if ($aInfo["ns"] == $this->sName) {
- unset($aInfo["url"]);
- $aInfo['active'] = true;
- }
- $aViewletInfo[] = $aInfo;
+ $aViewlets[] = $oAction; // use the action, since we display_viewlet() later.
}
- }
- */
+ }
+
+
+ $content_class = 'view';
+ if (!empty($aViewlets)) {
+ $content_class = 'view withviewlets';
+ }
+ $this->oPage->setContentClass($content_class);
+
+
+
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate("ktcore/document/view");
$aTemplateData = array(
@@ -241,7 +231,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
"document" => $oDocument,
"document_data" => $document_data,
"fieldsets" => $fieldsets,
- 'viewlet_info' => $aViewletInfo,
+ 'viewlets' => $aViewlets,
);
//return '' . print_r($aTemplateData, true) . '
';
return $oTemplate->render($aTemplateData);