Commit 1671ade914efa724fab79635f15265acd775bc6d
1 parent
9d2c0a11
KTS-3670
"Upload button should replace Add Document action" Fixed. Improved the logic behind creating the action buttons (made it less of a hack). Committed by: Megan Watson Reviewed by: Conrad Vermeulen git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@9235 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
8 changed files
with
101 additions
and
113 deletions
browse.php
| @@ -176,16 +176,6 @@ class BrowseDispatcher extends KTStandardDispatcher { | @@ -176,16 +176,6 @@ class BrowseDispatcher extends KTStandardDispatcher { | ||
| 176 | $portlet = new KTActionPortlet(sprintf(_kt('Actions on this folder'))); | 176 | $portlet = new KTActionPortlet(sprintf(_kt('Actions on this folder'))); |
| 177 | $aActions = KTFolderActionUtil::getFolderActionsForFolder($oFolder, $this->oUser); | 177 | $aActions = KTFolderActionUtil::getFolderActionsForFolder($oFolder, $this->oUser); |
| 178 | $portlet->setActions($aActions,null); | 178 | $portlet->setActions($aActions,null); |
| 179 | - // Set upload button | ||
| 180 | - $btnName = _kt('Add Document'); | ||
| 181 | - $btnAction = ''; | ||
| 182 | - foreach ($aActions as $item){ | ||
| 183 | - if($item->getDisplayName() == $btnName){ | ||
| 184 | - $btnAction = array($item); | ||
| 185 | - break; | ||
| 186 | - } | ||
| 187 | - } | ||
| 188 | - $portlet->setButton($btnAction, 'folder_upload'); | ||
| 189 | $this->oPage->addPortlet($portlet); | 179 | $this->oPage->addPortlet($portlet); |
| 190 | 180 | ||
| 191 | 181 |
lib/actions/documentaction.inc.php
| @@ -6,31 +6,31 @@ | @@ -6,31 +6,31 @@ | ||
| 6 | * Document Management Made Simple | 6 | * Document Management Made Simple |
| 7 | * Copyright (C) 2008 KnowledgeTree Inc. | 7 | * Copyright (C) 2008 KnowledgeTree Inc. |
| 8 | * Portions copyright The Jam Warehouse Software (Pty) Limited | 8 | * Portions copyright The Jam Warehouse Software (Pty) Limited |
| 9 | - * | 9 | + * |
| 10 | * This program is free software; you can redistribute it and/or modify it under | 10 | * This program is free software; you can redistribute it and/or modify it under |
| 11 | * the terms of the GNU General Public License version 3 as published by the | 11 | * the terms of the GNU General Public License version 3 as published by the |
| 12 | * Free Software Foundation. | 12 | * Free Software Foundation. |
| 13 | - * | 13 | + * |
| 14 | * This program is distributed in the hope that it will be useful, but WITHOUT | 14 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 16 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 16 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 17 | * details. | 17 | * details. |
| 18 | - * | 18 | + * |
| 19 | * You should have received a copy of the GNU General Public License | 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 20 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 21 | - * | ||
| 22 | - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | 21 | + * |
| 22 | + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | * California 94120-7775, or email info@knowledgetree.com. | 23 | * California 94120-7775, or email info@knowledgetree.com. |
| 24 | - * | 24 | + * |
| 25 | * The interactive user interfaces in modified source and object code versions | 25 | * The interactive user interfaces in modified source and object code versions |
| 26 | * of this program must display Appropriate Legal Notices, as required under | 26 | * of this program must display Appropriate Legal Notices, as required under |
| 27 | * Section 5 of the GNU General Public License version 3. | 27 | * Section 5 of the GNU General Public License version 3. |
| 28 | - * | 28 | + * |
| 29 | * In accordance with Section 7(b) of the GNU General Public License version 3, | 29 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 30 | * these Appropriate Legal Notices must retain the display of the "Powered by | 30 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 31 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | 31 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the |
| 32 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | 32 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 33 | - * must display the words "Powered by KnowledgeTree" and retain the original | 33 | + * must display the words "Powered by KnowledgeTree" and retain the original |
| 34 | * copyright notice. | 34 | * copyright notice. |
| 35 | * Contributor( s): ______________________________________ | 35 | * Contributor( s): ______________________________________ |
| 36 | * | 36 | * |
| @@ -155,17 +155,21 @@ class KTDocumentAction extends KTStandardDispatcher { | @@ -155,17 +155,21 @@ class KTDocumentAction extends KTStandardDispatcher { | ||
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | function getName() { | 157 | function getName() { |
| 158 | - return sanitizeForSQLtoHTML($this->sName); | 158 | + return $this->sName; |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | function getDisplayName() { | 161 | function getDisplayName() { |
| 162 | // Should be overridden by the i18nised display name | 162 | // Should be overridden by the i18nised display name |
| 163 | // This is here solely for backwards compatibility | 163 | // This is here solely for backwards compatibility |
| 164 | - return sanitizeForSQLtoHTML($this->sDisplayName); | 164 | + return $this->sDisplayName; |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | function getDescription() { | 167 | function getDescription() { |
| 168 | - return sanitizeForSQLtoHTML($this->sDescription); | 168 | + return $this->sDescription; |
| 169 | + } | ||
| 170 | + | ||
| 171 | + function getButton(){ | ||
| 172 | + return false; | ||
| 169 | } | 173 | } |
| 170 | 174 | ||
| 171 | function customiseInfo($aInfo) { | 175 | function customiseInfo($aInfo) { |
| @@ -192,8 +196,8 @@ class KTDocumentAction extends KTStandardDispatcher { | @@ -192,8 +196,8 @@ class KTDocumentAction extends KTStandardDispatcher { | ||
| 192 | $actions = KTDocumentActionUtil::getDocumentActionsForDocument($this->oDocument, $this->oUser); | 196 | $actions = KTDocumentActionUtil::getDocumentActionsForDocument($this->oDocument, $this->oUser); |
| 193 | $oPortlet = new KTActionPortlet(sprintf(_kt('Document actions'))); | 197 | $oPortlet = new KTActionPortlet(sprintf(_kt('Document actions'))); |
| 194 | $oPortlet->setActions($actions, $this->sName); | 198 | $oPortlet->setActions($actions, $this->sName); |
| 195 | - $this->oPage->addPortlet($oPortlet); | ||
| 196 | 199 | ||
| 200 | + $this->oPage->addPortlet($oPortlet); | ||
| 197 | $this->oPage->setSecondaryTitle($this->oDocument->getName()); | 201 | $this->oPage->setSecondaryTitle($this->oDocument->getName()); |
| 198 | 202 | ||
| 199 | return true; | 203 | return true; |
lib/actions/folderaction.inc.php
| @@ -132,6 +132,10 @@ class KTFolderAction extends KTStandardDispatcher { | @@ -132,6 +132,10 @@ class KTFolderAction extends KTStandardDispatcher { | ||
| 132 | return sanitizeForSQLtoHTML($this->sDescription); | 132 | return sanitizeForSQLtoHTML($this->sDescription); |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | + function getButton(){ | ||
| 136 | + return false; | ||
| 137 | + } | ||
| 138 | + | ||
| 135 | function customiseInfo($aInfo) { | 139 | function customiseInfo($aInfo) { |
| 136 | return $aInfo; | 140 | return $aInfo; |
| 137 | } | 141 | } |
| @@ -157,16 +161,6 @@ class KTFolderAction extends KTStandardDispatcher { | @@ -157,16 +161,6 @@ class KTFolderAction extends KTStandardDispatcher { | ||
| 157 | $portlet = new KTActionPortlet(sprintf(_kt('Actions on this folder'))); | 161 | $portlet = new KTActionPortlet(sprintf(_kt('Actions on this folder'))); |
| 158 | $aActions = KTFolderActionUtil::getFolderActionsForFolder($this->oFolder, $this->oUser); | 162 | $aActions = KTFolderActionUtil::getFolderActionsForFolder($this->oFolder, $this->oUser); |
| 159 | $portlet->setActions($aActions,$this->sName); | 163 | $portlet->setActions($aActions,$this->sName); |
| 160 | - // Set upload button | ||
| 161 | - $btnName = _kt('Add Document'); | ||
| 162 | - $btnAction = ''; | ||
| 163 | - foreach ($aActions as $item){ | ||
| 164 | - if($item->getDisplayName() == $btnName){ | ||
| 165 | - $btnAction = array($item); | ||
| 166 | - break; | ||
| 167 | - } | ||
| 168 | - } | ||
| 169 | - $portlet->setButton($btnAction, 'folder_upload'); | ||
| 170 | $this->oPage->addPortlet($portlet); | 164 | $this->oPage->addPortlet($portlet); |
| 171 | 165 | ||
| 172 | if (KTPermissionUtil::userHasPermissionOnItem($this->oUser, 'ktcore.permissions.folder_details', $this->oFolder)) { | 166 | if (KTPermissionUtil::userHasPermissionOnItem($this->oUser, 'ktcore.permissions.folder_details', $this->oFolder)) { |
lib/widgets/portlet.inc.php
| @@ -116,7 +116,7 @@ class KTActionPortlet extends KTPortlet { | @@ -116,7 +116,7 @@ class KTActionPortlet extends KTPortlet { | ||
| 116 | var $actions = array(); | 116 | var $actions = array(); |
| 117 | 117 | ||
| 118 | var $bActive = true; | 118 | var $bActive = true; |
| 119 | - var $btn = ''; | 119 | + var $btns = ''; |
| 120 | 120 | ||
| 121 | // current action is the one we are currently on. | 121 | // current action is the one we are currently on. |
| 122 | function setActions($actions, $currentaction) { | 122 | function setActions($actions, $currentaction) { |
| @@ -128,86 +128,77 @@ class KTActionPortlet extends KTPortlet { | @@ -128,86 +128,77 @@ class KTActionPortlet extends KTPortlet { | ||
| 128 | unset($aInfo["url"]); | 128 | unset($aInfo["url"]); |
| 129 | $aInfo['active'] = true; | 129 | $aInfo['active'] = true; |
| 130 | } | 130 | } |
| 131 | - $this->actions[$aInfo['name']] = $aInfo; | 131 | + $aBtn = $action->getButton(); |
| 132 | + | ||
| 133 | + if($aBtn){ | ||
| 134 | + $this->btns[$aInfo['name']] = array_merge($aInfo, $aBtn); | ||
| 135 | + }else{ | ||
| 136 | + $this->actions[$aInfo['name']] = $aInfo; | ||
| 137 | + } | ||
| 132 | } | 138 | } |
| 133 | } | 139 | } |
| 134 | ksort($this->actions); | 140 | ksort($this->actions); |
| 141 | + ksort($this->btns); | ||
| 135 | } | 142 | } |
| 136 | 143 | ||
| 137 | /** | 144 | /** |
| 138 | - * Display a button for a given action | 145 | + * Render a button for a given action |
| 139 | * | 146 | * |
| 140 | - * @param array $action | ||
| 141 | - * @param string $btn | ||
| 142 | - * @return boolean | 147 | + * @param string $text |
| 148 | + * @param string $link | ||
| 149 | + * @param string $class | ||
| 150 | + * @return unknown | ||
| 143 | */ | 151 | */ |
| 144 | - function setButton($action, $btn) { | ||
| 145 | - // Ensure action is set | ||
| 146 | - if(!isset($action[0])){ | ||
| 147 | - return false; | ||
| 148 | - } | ||
| 149 | - | ||
| 150 | - $info = $action[0]->getInfo(); | ||
| 151 | - | ||
| 152 | - // Ensure user has permission on / access to the action | ||
| 153 | - if(empty($info)){ | ||
| 154 | - return false; | ||
| 155 | - } | ||
| 156 | - | ||
| 157 | - $link = $info['url']; | ||
| 158 | - $text = $info['name']; | ||
| 159 | - | ||
| 160 | - switch($btn){ | ||
| 161 | - case 'document_checkin': | ||
| 162 | - $text = _kt('Checkin Document'); | ||
| 163 | - $class = 'arrow_upload'; | ||
| 164 | - break; | ||
| 165 | - case 'folder_upload': | ||
| 166 | - $text = _kt('Upload Document'); | ||
| 167 | - $class = 'arrow_upload'; | ||
| 168 | - break; | ||
| 169 | - case 'document_download': | ||
| 170 | - $text = _kt('Download Document'); | ||
| 171 | - $class = 'arrow_download'; | ||
| 172 | - break; | ||
| 173 | - default: | ||
| 174 | - return false; | ||
| 175 | - } | 152 | + function renderBtn($text, $link, $class) { |
| 176 | 153 | ||
| 177 | // Create button html | 154 | // Create button html |
| 178 | $button = "<div class='portlet_button'> | 155 | $button = "<div class='portlet_button'> |
| 179 | <a href='$link'> | 156 | <a href='$link'> |
| 180 | <div class='big_btn_left'></div> | 157 | <div class='big_btn_left'></div> |
| 181 | <div class='big_btn_middle'> | 158 | <div class='big_btn_middle'> |
| 182 | - <div class='btn_text'>{$text} | ||
| 183 | - </div> | ||
| 184 | - <div class='{$class}'> | ||
| 185 | - </div> | 159 | + <div class='btn_text'>{$text}</div> |
| 160 | + <div class='{$class}'></div> | ||
| 186 | </div> | 161 | </div> |
| 187 | <div class='big_btn_right'></div> | 162 | <div class='big_btn_right'></div> |
| 188 | </a> | 163 | </a> |
| 189 | </div>"; | 164 | </div>"; |
| 190 | 165 | ||
| 191 | - $this->btn = $button; | ||
| 192 | - return true; | 166 | + return $button; |
| 167 | + } | ||
| 168 | + | ||
| 169 | + /** | ||
| 170 | + * Render the specified actions as buttons | ||
| 171 | + */ | ||
| 172 | + function showButtons() { | ||
| 173 | + if(empty($this->btns)){ | ||
| 174 | + return ''; | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + $rendered = ''; | ||
| 178 | + foreach ($this->btns as $btn){ | ||
| 179 | + $text = !empty($btn['display_text']) ? $btn['display_text'] : $btn['name']; | ||
| 180 | + $link = $btn['url']; | ||
| 181 | + $class = $btn['arrow_class']; | ||
| 182 | + $rendered .= $this->renderBtn($text, $link, $class); | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + return $rendered; | ||
| 193 | } | 186 | } |
| 194 | 187 | ||
| 195 | function render() { | 188 | function render() { |
| 196 | if (empty($this->actions)) { | 189 | if (empty($this->actions)) { |
| 197 | return null; | 190 | return null; |
| 198 | } | 191 | } |
| 192 | + | ||
| 193 | + $btn = $this->showButtons(); | ||
| 194 | + | ||
| 199 | $oTemplating =& KTTemplating::getSingleton(); | 195 | $oTemplating =& KTTemplating::getSingleton(); |
| 200 | $oTemplate = $oTemplating->loadTemplate('kt3/portlets/actions_portlet'); | 196 | $oTemplate = $oTemplating->loadTemplate('kt3/portlets/actions_portlet'); |
| 201 | $aTemplateData = array( | 197 | $aTemplateData = array( |
| 202 | 'context' => $this, | 198 | 'context' => $this, |
| 199 | + 'btn' => $btn | ||
| 203 | ); | 200 | ); |
| 204 | 201 | ||
| 205 | - // Display a button above the action list | ||
| 206 | - if(isset($this->btn) && !empty($this->btn)){ | ||
| 207 | - $aTemplateData['showBtn'] = true; | ||
| 208 | - $aTemplateData['btn'] = $this->btn; | ||
| 209 | - } | ||
| 210 | - | ||
| 211 | return $oTemplate->render($aTemplateData); | 202 | return $oTemplate->render($aTemplateData); |
| 212 | } | 203 | } |
| 213 | } | 204 | } |
plugins/ktcore/KTDocumentActions.php
| @@ -6,31 +6,31 @@ | @@ -6,31 +6,31 @@ | ||
| 6 | * Document Management Made Simple | 6 | * Document Management Made Simple |
| 7 | * Copyright (C) 2008 KnowledgeTree Inc. | 7 | * Copyright (C) 2008 KnowledgeTree Inc. |
| 8 | * Portions copyright The Jam Warehouse Software (Pty) Limited | 8 | * Portions copyright The Jam Warehouse Software (Pty) Limited |
| 9 | - * | 9 | + * |
| 10 | * This program is free software; you can redistribute it and/or modify it under | 10 | * This program is free software; you can redistribute it and/or modify it under |
| 11 | * the terms of the GNU General Public License version 3 as published by the | 11 | * the terms of the GNU General Public License version 3 as published by the |
| 12 | * Free Software Foundation. | 12 | * Free Software Foundation. |
| 13 | - * | 13 | + * |
| 14 | * This program is distributed in the hope that it will be useful, but WITHOUT | 14 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 16 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 16 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 17 | * details. | 17 | * details. |
| 18 | - * | 18 | + * |
| 19 | * You should have received a copy of the GNU General Public License | 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 20 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 21 | - * | ||
| 22 | - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | 21 | + * |
| 22 | + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | * California 94120-7775, or email info@knowledgetree.com. | 23 | * California 94120-7775, or email info@knowledgetree.com. |
| 24 | - * | 24 | + * |
| 25 | * The interactive user interfaces in modified source and object code versions | 25 | * The interactive user interfaces in modified source and object code versions |
| 26 | * of this program must display Appropriate Legal Notices, as required under | 26 | * of this program must display Appropriate Legal Notices, as required under |
| 27 | * Section 5 of the GNU General Public License version 3. | 27 | * Section 5 of the GNU General Public License version 3. |
| 28 | - * | 28 | + * |
| 29 | * In accordance with Section 7(b) of the GNU General Public License version 3, | 29 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 30 | * these Appropriate Legal Notices must retain the display of the "Powered by | 30 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 31 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | 31 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the |
| 32 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | 32 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 33 | - * must display the words "Powered by KnowledgeTree" and retain the original | 33 | + * must display the words "Powered by KnowledgeTree" and retain the original |
| 34 | * copyright notice. | 34 | * copyright notice. |
| 35 | * Contributor( s): ______________________________________ | 35 | * Contributor( s): ______________________________________ |
| 36 | * | 36 | * |
| @@ -326,6 +326,13 @@ class KTDocumentViewAction extends KTDocumentAction { | @@ -326,6 +326,13 @@ class KTDocumentViewAction extends KTDocumentAction { | ||
| 326 | return _kt('Download'); | 326 | return _kt('Download'); |
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | + function getButton() { | ||
| 330 | + $btn = array(); | ||
| 331 | + $btn['display_text'] = _kt('Download Document'); | ||
| 332 | + $btn['arrow_class'] = 'arrow_download'; | ||
| 333 | + return $btn; | ||
| 334 | + } | ||
| 335 | + | ||
| 329 | function customiseInfo($aInfo) { | 336 | function customiseInfo($aInfo) { |
| 330 | $aInfo['alert'] = _kt('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.'); | 337 | $aInfo['alert'] = _kt('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.'); |
| 331 | return $aInfo; | 338 | return $aInfo; |
| @@ -531,6 +538,13 @@ class KTDocumentCheckInAction extends KTDocumentAction { | @@ -531,6 +538,13 @@ class KTDocumentCheckInAction extends KTDocumentAction { | ||
| 531 | return _kt('Checkin'); | 538 | return _kt('Checkin'); |
| 532 | } | 539 | } |
| 533 | 540 | ||
| 541 | + function getButton() { | ||
| 542 | + $btn = array(); | ||
| 543 | + $btn['display_text'] = _kt('Check Document In'); | ||
| 544 | + $btn['arrow_class'] = 'arrow_upload'; | ||
| 545 | + return $btn; | ||
| 546 | + } | ||
| 547 | + | ||
| 534 | function getInfo() { | 548 | function getInfo() { |
| 535 | if (!$this->oDocument->getIsCheckedOut()) { | 549 | if (!$this->oDocument->getIsCheckedOut()) { |
| 536 | return null; | 550 | return null; |
| @@ -853,8 +867,8 @@ class KTDocumentDeleteAction extends KTDocumentAction { | @@ -853,8 +867,8 @@ class KTDocumentDeleteAction extends KTDocumentAction { | ||
| 853 | $_SESSION['KTErrorMessage'][]= _kt('This document can\'t be deleted because it is checked out'); | 867 | $_SESSION['KTErrorMessage'][]= _kt('This document can\'t be deleted because it is checked out'); |
| 854 | controllerRedirect('viewDocument', 'fDocumentId=' . $this->oDocument->getId()); | 868 | controllerRedirect('viewDocument', 'fDocumentId=' . $this->oDocument->getId()); |
| 855 | exit(0); | 869 | exit(0); |
| 856 | - } | ||
| 857 | - | 870 | + } |
| 871 | + | ||
| 858 | return true; | 872 | return true; |
| 859 | } | 873 | } |
| 860 | 874 | ||
| @@ -869,11 +883,11 @@ class KTDocumentDeleteAction extends KTDocumentAction { | @@ -869,11 +883,11 @@ class KTDocumentDeleteAction extends KTDocumentAction { | ||
| 869 | 'submit_label' => _kt('Delete Document'), | 883 | 'submit_label' => _kt('Delete Document'), |
| 870 | 'context' => &$this, | 884 | 'context' => &$this, |
| 871 | )); | 885 | )); |
| 872 | - | 886 | + |
| 873 | 887 | ||
| 874 | return $oForm; | 888 | return $oForm; |
| 875 | } | 889 | } |
| 876 | - | 890 | + |
| 877 | function form_main() { | 891 | function form_main() { |
| 878 | $oForm = new KTForm; | 892 | $oForm = new KTForm; |
| 879 | $oForm->setOptions(array( | 893 | $oForm->setOptions(array( |
| @@ -916,7 +930,7 @@ class KTDocumentDeleteAction extends KTDocumentAction { | @@ -916,7 +930,7 @@ class KTDocumentDeleteAction extends KTDocumentAction { | ||
| 916 | )); | 930 | )); |
| 917 | return $oTemplate->render(); | 931 | return $oTemplate->render(); |
| 918 | } | 932 | } |
| 919 | - | 933 | + |
| 920 | function do_confirm(){ | 934 | function do_confirm(){ |
| 921 | $this->oPage->setBreadcrumbDetails(_kt('Confirm delete')); | 935 | $this->oPage->setBreadcrumbDetails(_kt('Confirm delete')); |
| 922 | $oTemplate =& $this->oValidator->validateTemplate('ktcore/action/delete_confirm'); | 936 | $oTemplate =& $this->oValidator->validateTemplate('ktcore/action/delete_confirm'); |
| @@ -1386,11 +1400,11 @@ class KTDocumentArchiveAction extends KTDocumentAction { | @@ -1386,11 +1400,11 @@ class KTDocumentArchiveAction extends KTDocumentAction { | ||
| 1386 | 'submit_label' => _kt('Archive Document'), | 1400 | 'submit_label' => _kt('Archive Document'), |
| 1387 | 'context' => &$this, | 1401 | 'context' => &$this, |
| 1388 | )); | 1402 | )); |
| 1389 | - | 1403 | + |
| 1390 | 1404 | ||
| 1391 | return $oForm; | 1405 | return $oForm; |
| 1392 | } | 1406 | } |
| 1393 | - | 1407 | + |
| 1394 | function form_main() { | 1408 | function form_main() { |
| 1395 | $oForm = new KTForm; | 1409 | $oForm = new KTForm; |
| 1396 | $oForm->setOptions(array( | 1410 | $oForm->setOptions(array( |
| @@ -1435,7 +1449,7 @@ class KTDocumentArchiveAction extends KTDocumentAction { | @@ -1435,7 +1449,7 @@ class KTDocumentArchiveAction extends KTDocumentAction { | ||
| 1435 | )); | 1449 | )); |
| 1436 | return $oTemplate->render(); | 1450 | return $oTemplate->render(); |
| 1437 | } | 1451 | } |
| 1438 | - | 1452 | + |
| 1439 | function do_confirm(){ | 1453 | function do_confirm(){ |
| 1440 | $this->oPage->setBreadcrumbDetails(_kt('Confirm archive')); | 1454 | $this->oPage->setBreadcrumbDetails(_kt('Confirm archive')); |
| 1441 | $oTemplate =& $this->oValidator->validateTemplate('ktcore/action/archive_confirm'); | 1455 | $oTemplate =& $this->oValidator->validateTemplate('ktcore/action/archive_confirm'); |
plugins/ktcore/folder/addDocument.php
| @@ -54,6 +54,13 @@ class KTFolderAddDocumentAction extends KTFolderAction { | @@ -54,6 +54,13 @@ class KTFolderAddDocumentAction extends KTFolderAction { | ||
| 54 | return _kt('Add Document'); | 54 | return _kt('Add Document'); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | + function getButton(){ | ||
| 58 | + $btn = array(); | ||
| 59 | + $btn['display_text'] = _kt('Upload Document'); | ||
| 60 | + $btn['arrow_class'] = 'arrow_upload'; | ||
| 61 | + return $btn; | ||
| 62 | + } | ||
| 63 | + | ||
| 57 | function check() { | 64 | function check() { |
| 58 | $res = parent::check(); | 65 | $res = parent::check(); |
| 59 | if (empty($res)) { | 66 | if (empty($res)) { |
templates/kt3/portlets/actions_portlet.smarty
view.php
| @@ -96,18 +96,6 @@ class ViewDocumentDispatcher extends KTStandardDispatcher { | @@ -96,18 +96,6 @@ class ViewDocumentDispatcher extends KTStandardDispatcher { | ||
| 96 | $this->actions = KTDocumentActionUtil::getDocumentActionsForDocument($this->oDocument, $this->oUser); | 96 | $this->actions = KTDocumentActionUtil::getDocumentActionsForDocument($this->oDocument, $this->oUser); |
| 97 | $oPortlet = new KTActionPortlet(sprintf(_kt('Document actions'), $this->oDocument->getName())); | 97 | $oPortlet = new KTActionPortlet(sprintf(_kt('Document actions'), $this->oDocument->getName())); |
| 98 | $oPortlet->setActions($this->actions, $currentaction); | 98 | $oPortlet->setActions($this->actions, $currentaction); |
| 99 | - | ||
| 100 | - // Set download / checkin button | ||
| 101 | - if($this->oDocument->getIsCheckedOut() && $this->oDocument->getCheckedOutUserID() == $this->oUser->getId()){ | ||
| 102 | - $btn = 'document_checkin'; | ||
| 103 | - $aNames = array('ktcore.actions.document.checkin'); | ||
| 104 | - $btnAction = KTDocumentActionUtil::getDocumentActionsByNames($aNames, 'documentaction', $this->oDocument, $this->oUser); | ||
| 105 | - }else { | ||
| 106 | - $btn = 'document_download'; | ||
| 107 | - $aNames = array('ktcore.actions.document.view'); | ||
| 108 | - $btnAction = KTDocumentActionUtil::getDocumentActionsByNames($aNames, 'documentinfo', $this->oDocument, $this->oUser); | ||
| 109 | - } | ||
| 110 | - $oPortlet->setButton($btnAction, $btn); | ||
| 111 | $this->oPage->addPortlet($oPortlet); | 99 | $this->oPage->addPortlet($oPortlet); |
| 112 | } | 100 | } |
| 113 | 101 |