Commit bc1700320ac576d494849538b37c55d6be83932f
1 parent
6b506383
Implement the view action using the dispatcher method.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4047 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
9 additions
and
24 deletions
plugins/ktcore/KTDocumentActions.php
| ... | ... | @@ -5,7 +5,7 @@ require_once(KT_LIB_DIR . '/subscriptions/Subscription.inc'); |
| 5 | 5 | |
| 6 | 6 | $oKTActionRegistry =& KTActionRegistry::getSingleton(); |
| 7 | 7 | |
| 8 | -class KTDocumentViewAction extends KTBuiltInDocumentAction { | |
| 8 | +class KTDocumentViewAction extends KTDocumentAction { | |
| 9 | 9 | var $sBuiltInAction = 'downloadDocument'; |
| 10 | 10 | var $sDisplayName = 'View'; |
| 11 | 11 | var $sName = 'ktcore.actions.document.view'; |
| ... | ... | @@ -14,15 +14,16 @@ class KTDocumentViewAction extends KTBuiltInDocumentAction { |
| 14 | 14 | $aInfo['alert'] = _("This will download a copy of the document and is not the same as Checking Out a document. Changes to this downloaded file will not be managed in the DMS."); |
| 15 | 15 | return $aInfo; |
| 16 | 16 | } |
| 17 | -} | |
| 18 | -$oKTActionRegistry->registerAction('documentaction', 'KTDocumentViewAction', 'ktcore.actions.document.view'); | |
| 19 | 17 | |
| 20 | -class KTDocumentEmailAction extends KTBuiltInDocumentAction { | |
| 21 | - var $sBuiltInAction = 'emailDocument'; | |
| 22 | - var $sDisplayName = 'Email'; | |
| 23 | - var $sName = 'ktcore.actions.document.email'; | |
| 18 | + function do_main() { | |
| 19 | + $oStorage =& KTStorageManagerUtil::getSingleton(); | |
| 20 | + $oDocumentTransaction = & new DocumentTransaction($this->oDocument->getId(), "Document downloaded", DOWNLOAD); | |
| 21 | + $oDocumentTransaction->create(); | |
| 22 | + $oStorage->download($this->oDocument); | |
| 23 | + exit(0); | |
| 24 | + } | |
| 24 | 25 | } |
| 25 | -$oKTActionRegistry->registerAction('documentaction', 'KTDocumentEmailAction', 'ktcore.actions.document.email'); | |
| 26 | +$oKTActionRegistry->registerAction('documentaction', 'KTDocumentViewAction', 'ktcore.actions.document.view'); | |
| 26 | 27 | |
| 27 | 28 | class KTDocumentCheckInOutAction extends KTBuiltInDocumentAction { |
| 28 | 29 | var $sBuiltInAction = 'emailDocument'; |
| ... | ... | @@ -93,22 +94,6 @@ class KTDocumentHistoryAction extends KTBuiltInDocumentAction { |
| 93 | 94 | } |
| 94 | 95 | $oKTActionRegistry->registerAction('documentaction', 'KTDocumentHistoryAction', 'ktcore.actions.document.history'); |
| 95 | 96 | |
| 96 | -class KTDocumentSubscriptionAction extends KTBuiltInDocumentAction { | |
| 97 | - var $sName = 'ktcore.actions.document.subscription'; | |
| 98 | - var $sDisplayName = 'Subscribe'; | |
| 99 | - function getInfo() { | |
| 100 | - if (Subscription::exists($this->oUser->getID(), $this->oDocument->getID(), SubscriptionConstants::subscriptionType("DocumentSubscription"))) { | |
| 101 | - $this->sBuiltInAction = 'removeSubscription'; | |
| 102 | - $this->sDisplayName = 'Unsubscribe'; | |
| 103 | - } else { | |
| 104 | - $this->sBuiltInAction = 'addSubscription'; | |
| 105 | - $this->sDisplayName = 'Subscribe'; | |
| 106 | - } | |
| 107 | - return parent::getInfo(); | |
| 108 | - } | |
| 109 | -} | |
| 110 | -$oKTActionRegistry->registerAction('documentaction', 'KTDocumentSubscriptionAction', 'ktcore.actions.document.subscription'); | |
| 111 | - | |
| 112 | 97 | class KTDocumentDiscussionAction extends KTBuiltInDocumentAction { |
| 113 | 98 | var $sBuiltInAction = 'viewDiscussion'; |
| 114 | 99 | var $sDisplayName = 'Discussion'; | ... | ... |