Commit 986f79eed0ceb07ef82a91c7bc9d78cf7444eb2d

Authored by Megan
1 parent 31a5b682

Added electronic signature to additional actions.

Committed by: Megan Watson
Reviewed by: Kevin Cyster
lib/templating/kt3template.inc.php
... ... @@ -154,13 +154,20 @@ class KTPage {
154 154 // FIXME: we lost the getDefaultAction stuff - do we care?
155 155 // note that key == action. this is _important_, since we crossmatch the breadcrumbs against this for "active"
156 156 $sBaseUrl = KTUtil::kt_url();
157   - $heading = _kt('You are attempting to access DMS Administration');
158 157  
159 158 $this->menu = array();
160 159 $this->menu['dashboard'] = array('label' => _kt("Dashboard"), 'url' => $sBaseUrl.'/dashboard.php');
161 160 $this->menu['browse'] = array('label' => _kt("Browse Documents"), 'url' => $sBaseUrl.'/browse.php');
162   - $this->menu['administration'] = array('label' => _kt("DMS Administration"), 'url' => '#',
163   - 'onclick' => "javascript: showSignatureForm('{$heading}', 'dms.administration.access', 'system', '{$sBaseUrl}/admin.php', 'redirect');"); //$sBaseUrl.'/admin.php',
  161 + $this->menu['administration'] = array('label' => _kt("DMS Administration"));
  162 +
  163 + global $default;
  164 + if($default->enableESignatures){
  165 + $heading = _kt('You are attempting to access DMS Administration');
  166 + $this->menu['administration']['url'] = '#';
  167 + $this->menu['administration']['onclick'] = "javascript: showSignatureForm('{$heading}', 'dms.administration.access', 'system', '{$sBaseUrl}/admin.php', 'redirect');";
  168 + }else{
  169 + $this->menu['administration']['url'] = $sBaseUrl.'/admin.php';
  170 + }
164 171 }
165 172  
166 173  
... ...
plugins/ktcore/KTPermissions.php
... ... @@ -6,31 +6,31 @@
6 6 * Document Management Made Simple
7 7 * Copyright (C) 2008, 2009 KnowledgeTree Inc.
8 8 * Portions copyright The Jam Warehouse Software (Pty) Limited
9   - *
  9 + *
10 10 * This program is free software; you can redistribute it and/or modify it under
11 11 * the terms of the GNU General Public License version 3 as published by the
12 12 * Free Software Foundation.
13   - *
  13 + *
14 14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 17 * details.
18   - *
  18 + *
19 19 * You should have received a copy of the GNU General Public License
20 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 23 * California 94120-7775, or email info@knowledgetree.com.
24   - *
  24 + *
25 25 * The interactive user interfaces in modified source and object code versions
26 26 * of this program must display Appropriate Legal Notices, as required under
27 27 * Section 5 of the GNU General Public License version 3.
28   - *
  28 + *
29 29 * In accordance with Section 7(b) of the GNU General Public License version 3,
30 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 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 34 * copyright notice.
35 35 * Contributor( s): ______________________________________
36 36 *
... ... @@ -541,14 +541,16 @@ class KTRoleAllocationPlugin extends KTFolderAction {
541 541  
542 542 function do_editRoleUsers() {
543 543  
  544 + $iFolderId = $this->oFolder->getId();
  545 +
544 546 $role_allocation_id = KTUtil::arrayGet($_REQUEST, 'alloc_id');
545   - if (($this->oFolder->getId() == 1) && is_null($role_allocation_id)) {
  547 + if (($iFolderId == 1) && is_null($role_allocation_id)) {
546 548 $oRoleAllocation = $this->rootoverride($_REQUEST['role_id']);
547 549 } else {
548 550 $oRoleAllocation = RoleAllocation::get($role_allocation_id);
549 551 }
550 552 if ((PEAR::isError($oRoleAllocation)) || ($oRoleAllocation=== false)) {
551   - $this->errorRedirectToMain(_kt('No such role allocation.'), sprintf('fFolderId=%d',$this->oFolder->getId()));
  553 + $this->errorRedirectToMain(_kt('No such role allocation.'), sprintf('fFolderId=%d',$iFolderId));
552 554 }
553 555  
554 556  
... ... @@ -577,6 +579,17 @@ class KTRoleAllocationPlugin extends KTFolderAction {
577 579 }
578 580 }
579 581  
  582 + // Include the electronic signature on the permissions action
  583 + global $default;
  584 + if($default->enableESignatures){
  585 + $heading = _kt('You are attempting to modify roles');
  586 + $input['type'] = 'button';
  587 + $input['onclick'] = "javascript: showSignatureForm('{$heading}', 'ktcore.transactions.roles_modify_users', 'folder', 'userroleform', 'submit', {$iFolderId});";
  588 + }else{
  589 + $input['type'] = 'submit';
  590 + $input['onclick'] = '';
  591 + }
  592 +
580 593 $oTemplating =& KTTemplating::getSingleton();
581 594 $oTemplate = $oTemplating->loadTemplate("ktcore/folder/roles_manageusers");
582 595 $aTemplateData = array(
... ... @@ -584,20 +597,23 @@ class KTRoleAllocationPlugin extends KTFolderAction {
584 597 "edit_rolealloc" => $oRoleAllocation,
585 598 'unused_users' => $aFreeUsers,
586 599 'role_users' => $aRoleUsers,
  600 + 'input' => $input
587 601 );
588 602 return $oTemplate->render($aTemplateData);
589 603 }
590 604  
591 605 function do_editRoleGroups() {
592 606  
  607 + $iFolderId = $this->oFolder->getId();
  608 +
593 609 $role_allocation_id = KTUtil::arrayGet($_REQUEST, 'alloc_id');
594   - if (($this->oFolder->getId() == 1) && is_null($role_allocation_id)) {
  610 + if (($iFolderId == 1) && is_null($role_allocation_id)) {
595 611 $oRoleAllocation = $this->rootoverride($_REQUEST['role_id']);
596 612 } else {
597 613 $oRoleAllocation = RoleAllocation::get($role_allocation_id);
598 614 }
599 615 if ((PEAR::isError($oRoleAllocation)) || ($oRoleAllocation=== false)) {
600   - $this->errorRedirectToMain(_kt('No such role allocation.'), sprintf('fFolderId=%d',$this->oFolder->getId()));
  616 + $this->errorRedirectToMain(_kt('No such role allocation.'), sprintf('fFolderId=%d',$iFolderId));
601 617 }
602 618  
603 619 $oRole = Role::get($oRoleAllocation->getRoleId());
... ... @@ -627,7 +643,16 @@ class KTRoleAllocationPlugin extends KTFolderAction {
627 643 }
628 644 }
629 645  
630   -
  646 + // Include the electronic signature on the permissions action
  647 + global $default;
  648 + if($default->enableESignatures){
  649 + $heading = _kt('You are attempting to modify roles');
  650 + $input['type'] = 'button';
  651 + $input['onclick'] = "javascript: showSignatureForm('{$heading}', 'ktcore.transactions.roles_modify_groups', 'folder', 'grouproleform', 'submit', {$iFolderId});";
  652 + }else{
  653 + $input['type'] = 'submit';
  654 + $input['onclick'] = '';
  655 + }
631 656  
632 657 $oTemplating =& KTTemplating::getSingleton();
633 658 $oTemplate = $oTemplating->loadTemplate("ktcore/folder/roles_managegroups");
... ... @@ -637,6 +662,7 @@ class KTRoleAllocationPlugin extends KTFolderAction {
637 662 'unused_groups' => $aFreeUsers,
638 663 'role_groups' => $aRoleUsers,
639 664 'rolename' => $oRole->getName(),
  665 + 'input' => $input
640 666 );
641 667 return $oTemplate->render($aTemplateData);
642 668 }
... ...
plugins/ktcore/folder/Permissions.php
... ... @@ -274,10 +274,11 @@ class KTFolderPermissionsAction extends KTFolderAction {
274 274  
275 275 function do_edit() {
276 276 $this->oPage->setBreadcrumbDetails(_kt('Viewing Permissions'));
  277 + $iFolderId = $this->oFolder->getId();
277 278  
278 279  
279 280 $oPO = KTPermissionObject::get($this->oFolder->getPermissionObjectId());
280   - $aOptions = array('redirect_to' => array('main', 'fFolderId=' . $this->oFolder->getId()));
  281 + $aOptions = array('redirect_to' => array('main', 'fFolderId=' . $iFolderId));
281 282  
282 283 if (!KTBrowseUtil::inAdminMode($this->oUser, $this->oFolder)) {
283 284 $this->oValidator->userHasPermissionOnItem($this->oUser, $this->_sEditShowPermission, $this->oFolder, $aOptions);
... ... @@ -285,10 +286,10 @@ class KTFolderPermissionsAction extends KTFolderAction {
285 286  
286 287 // copy permissions if they were inherited
287 288 $oInherited = KTPermissionUtil::findRootObjectForPermissionObject($oPO);
288   - if ($oInherited->getId() !== $this->oFolder->getId()) {
  289 + if ($oInherited->getId() !== $iFolderId) {
289 290 $override = KTUtil::arrayGet($_REQUEST, 'override', false);
290 291 if (empty($override)) {
291   - $this->errorRedirectToMain(_kt('This folder does not override its permissions'), sprintf('fFolderId=%d', $this->oFolder->getId()));
  292 + $this->errorRedirectToMain(_kt('This folder does not override its permissions'), sprintf('fFolderId=%d', $iFolderId));
292 293 }
293 294 $this->startTransaction();
294 295 $this->_copyPermissions();
... ... @@ -314,13 +315,23 @@ class KTFolderPermissionsAction extends KTFolderAction {
314 315 $oTemplating =& KTTemplating::getSingleton();
315 316 $oTemplate = $oTemplating->loadTemplate('ktcore/folder/permissions');
316 317  
317   - $bCanInherit = ($this->oFolder->getId() != 1);
  318 + $bCanInherit = ($iFolderId != 1);
  319 +
  320 + global $default;
  321 + if($default->enableESignatures){
  322 + $heading = _kt('You are attempting to modify permissions');
  323 + $input['type'] = 'button';
  324 + $input['onclick'] = "javascript: showSignatureForm('{$heading}', 'ktcore.transactions.permissions_change', 'folder', 'update_permissions_form', 'submit', {$iFolderId});";
  325 + }else{
  326 + $input['type'] = 'submit';
  327 + $input['onclick'] = '';
  328 + }
318 329  
319 330 $perms = $aPermList;
320 331 $docperms = KTPermission::getDocumentRelevantList();
321 332  
322 333 $aTemplateData = array(
323   - 'iFolderId' => $this->oFolder->getId(),
  334 + 'iFolderId' => $iFolderId,
324 335 'roles' => Role::getList(),
325 336 'groups' => Group::getList(),
326 337 'conditions' => KTSavedSearch::getConditions(),
... ... @@ -331,7 +342,8 @@ class KTFolderPermissionsAction extends KTFolderAction {
331 342 'edit' => true,
332 343 'permissions' => $perms,
333 344 'document_permissions' => $docperms,
334   - 'can_inherit' => $bCanInherit
  345 + 'can_inherit' => $bCanInherit,
  346 + 'input' => $input
335 347 );
336 348 return $oTemplate->render($aTemplateData);
337 349 }
... ...
plugins/ktcore/folder/Rename.php
... ... @@ -6,31 +6,31 @@
6 6 * Document Management Made Simple
7 7 * Copyright (C) 2008, 2009 KnowledgeTree Inc.
8 8 * Portions copyright The Jam Warehouse Software (Pty) Limited
9   - *
  9 + *
10 10 * This program is free software; you can redistribute it and/or modify it under
11 11 * the terms of the GNU General Public License version 3 as published by the
12 12 * Free Software Foundation.
13   - *
  13 + *
14 14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 17 * details.
18   - *
  18 + *
19 19 * You should have received a copy of the GNU General Public License
20 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 23 * California 94120-7775, or email info@knowledgetree.com.
24   - *
  24 + *
25 25 * The interactive user interfaces in modified source and object code versions
26 26 * of this program must display Appropriate Legal Notices, as required under
27 27 * Section 5 of the GNU General Public License version 3.
28   - *
  28 + *
29 29 * In accordance with Section 7(b) of the GNU General Public License version 3,
30 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 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 34 * copyright notice.
35 35 * Contributor( s): ______________________________________
36 36 *
... ... @@ -51,7 +51,7 @@ class KTFolderRenameAction extends KTFolderAction {
51 51 function getDisplayName() {
52 52 return _kt('Rename');
53 53 }
54   -
  54 +
55 55 function getInfo() {
56 56 return parent::getInfo();
57 57 }
... ... @@ -63,10 +63,21 @@ class KTFolderRenameAction extends KTFolderAction {
63 63  
64 64 $fields = array();
65 65 $fields[] = new KTStringWidget(_kt('New folder name'), _kt('The name to which the current folder should be renamed.'), 'foldername', $this->oFolder->getName(), $this->oPage, true);
66   -
  66 +
  67 + global $default;
  68 + if($default->enableESignatures){
  69 + $heading = _kt('You are attempting to rename a folder');
  70 + $input['onclick'] = "javascript: showSignatureForm('{$heading}', 'ktcore.transactions.rename', 'folder', 'rename_folder_form', 'submit', {$this->oFolder->getId()});";
  71 + $input['type'] = 'button';
  72 + }else{
  73 + $input['onclick'] = '';
  74 + $input['type'] = 'submit';
  75 + }
  76 +
67 77 $oTemplate->setData(array(
68 78 'context' => &$this,
69 79 'fields' => $fields,
  80 + 'input' => $input,
70 81 'folderName' => $this->oFolder->getName(),
71 82 ));
72 83 return $oTemplate->render();
... ...
plugins/ktstandard/KTElectronicSignatures.php
... ... @@ -113,7 +113,8 @@ class KTElectronicSignatures
113 113 }
114 114  
115 115 if($this->lock){
116   - return $this->eSignature->getLockMsg();
  116 + $this->error = $this->eSignature->getLockMsg();
  117 + return $this->getError();
117 118 }
118 119 return $oTemplate->render($aTemplateData);
119 120 }
... ... @@ -147,7 +148,7 @@ class KTElectronicSignatures
147 148 */
148 149 public function getError()
149 150 {
150   - return $this->error;
  151 + return '<div class="error">'.$this->error.'</div>';
151 152 }
152 153  
153 154 /**
... ...
resources/css/kt-framing.css
... ... @@ -2348,7 +2348,7 @@ body #content #add_dashlet
2348 2348 color: #666;
2349 2349 }
2350 2350  
2351   -#sign_here #form_actions a {
  2351 +#sign_here .form_actions a {
2352 2352 border: 1px solid #ccc;
2353 2353 background: #fdfdfd;
2354 2354 color: #333;
... ... @@ -2358,6 +2358,17 @@ body #content #add_dashlet
2358 2358 text-decoration: none;
2359 2359 }
2360 2360  
  2361 +#sign_here .error {
  2362 + padding: 0.5em 1em;
  2363 + border: 1px solid #ffc21e;
  2364 + margin-bottom: 10px;
  2365 + padding-left: 25px;
  2366 +}
  2367 +
  2368 +#sign_here .error {
  2369 + background: #ffdd80 url(../../thirdparty/icon-theme/16x16/status/dialog-warning.gif) 2px center no-repeat;
  2370 +}
  2371 +
2361 2372 .x-window-tl .x-window-header {
2362 2373 color: #FFF;
2363 2374 }
... ...
resources/js/signature.js
... ... @@ -29,7 +29,7 @@ var showSignatureForm = function(head, action, type, request, request_type, deta
29 29 applyTo : 'signature',
30 30 layout : 'fit',
31 31 width : 360,
32   - height : 265,
  32 + height : 310,
33 33 closeAction :'destroy',
34 34 y : 150,
35 35 shadow: false,
... ... @@ -50,6 +50,7 @@ var showSignatureForm = function(head, action, type, request, request_type, deta
50 50 }else{
51 51 window.document.forms[this.request].submit();
52 52 }
  53 + return;
53 54 }
54 55 info.innerHTML = response.responseText;
55 56 },
... ... @@ -107,6 +108,7 @@ var submitForm = function() {
107 108 }else{
108 109 window.document.forms[this.request].submit();
109 110 }
  111 + return;
110 112 }
111 113  
112 114 info.innerHTML = response.responseText;
... ...
templates/ktcore/folder/permissions.smarty
... ... @@ -84,8 +84,7 @@
84 84 <input type="hidden" name="action" value="update">
85 85 <input type="hidden" name="fFolderId" value="{$iFolderId}">
86 86 <div id="submitButtons" class="form_actions">
87   - <input type="button" value="{i18n}Update Permission Assignments{/i18n}"
88   - onclick="javascript: showSignatureForm('{i18n}You are attempting to modify permissions{/i18n}', 'ktcore.transactions.permissions_change', 'folder', 'update_permissions_form', 'submit', {$iFolderId});" />
  87 + <input type="{$input.type}" value="{i18n}Update Permission Assignments{/i18n}" onclick="{$input.onclick}" />
89 88 <input type="submit" name="kt_cancel[{addQS}fFolderId={$iFolderId}{/addQS}]" value="{i18n}Cancel{/i18n}" />
90 89 {/if}
91 90 </div>
... ...
templates/ktcore/folder/rename.smarty
... ... @@ -14,14 +14,9 @@ folder.{/i18n}&lt;/p&gt;
14 14 {$oWidget->render()}
15 15 {/foreach}
16 16 <div class="form_actions">
17   -<input type="button" name="btn_submit" value="{i18n}Rename{/i18n}"
18   - onclick="javascript: showSignatureForm('{i18n}You are attempting to rename a folder{/i18n}', 'ktcore.transactions.rename', 'folder', 'rename_folder_form', 'submit', {$iFolderId});" />
  17 +<input type="{$input.type}" name="btn_submit" value="{i18n}Rename{/i18n}" onclick="{$input.onclick}" />
19 18  
20 19 <input type="submit" name="kt_cancel[{$link}]" value="{i18n}Cancel{/i18n}" />
21 20 </div>
22 21 </fieldset>
23 22 </form>
24   -
25   -
26   -<!-- onclick="javascript: showSignatureForm('rename_folder_form');"
27   --->
... ...
templates/ktcore/folder/roles_managegroups.smarty
... ... @@ -4,15 +4,15 @@
4 4  
5 5 <p class="descriptiveText">{i18n}Groups must be allocated to roles to ensure that the workflow transition this role is supposed to support can be acted upon by a user.{/i18n}</p>
6 6  
7   -<form action="{$smarty.server.PHP_SELF}" method="POST" id="grouproleform">
  7 +<form action="{$smarty.server.PHP_SELF}" method="POST" id="grouproleform" name="grouproleform">
8 8 <input type="hidden" name="action" value="setRoleGroups" />
9 9 <input type="hidden" name="allocation_id" value="{$edit_rolealloc->getId()}" />
10 10 <input type="hidden" name="fFolderId" value="{$context->oFolder->getId()}" />
11 11 <!-- erk. FIXME clean up and remove OptionTransfer.js. -->
12   -
  12 +
13 13 <input type="hidden" name="groupFinal" />
14   -
15   -
  14 +
  15 +
16 16 <fieldset>
17 17 <legend>{i18n}Allocate Groups{/i18n}</legend>
18 18 <p class="descriptiveText">{i18n}Select the groups which should be part of this role.{/i18n}</p>
... ... @@ -58,7 +58,7 @@
58 58 </tbody></table>
59 59  
60 60 <div class="form_actions">
61   - <input type="submit" value="{i18n}save changes{/i18n}" />
  61 + <input type="{$input.type}" value="{i18n}save changes{/i18n}" onclick="{$input.onclick}" />
62 62 {capture assign=link}{addQS}fFolderId={$context->oFolder->getId()}{/addQS}{/capture}
63 63 <input type="submit" name="kt_cancel[{$link}]" value="{i18n}Cancel{/i18n}" />
64 64 </div>
... ...
templates/ktcore/folder/roles_manageusers.smarty
... ... @@ -4,7 +4,7 @@
4 4  
5 5 <p class="descriptiveText">{i18n}Add or remove users for this role. {/i18n}</p>
6 6  
7   -<form action="{$smarty.server.PHP_SELF}" method="POST" id="userroleform">
  7 +<form action="{$smarty.server.PHP_SELF}" method="POST" id="userroleform" name="userroleform">
8 8 <input type="hidden" name="action" value="setRoleUsers" />
9 9 <input type="hidden" name="allocation_id" value="{$edit_rolealloc->getId()}" />
10 10 <input type="hidden" name="fFolderId" value="{$context->oFolder->getId()}" />
... ... @@ -63,7 +63,7 @@ Use the Ctrl key to multi-select user names.{/i18n}&lt;/p&gt;
63 63 </tbody></table>
64 64  
65 65 <div class="form_actions">
66   - <input type="submit" value="{i18n}save changes{/i18n}" />
  66 + <input type="{$input.type}" value="{i18n}save changes{/i18n}" onclick="{$input.onclick}" />
67 67 {capture assign=link}{addQS}fFolderId={$context->oFolder->getId()}{/addQS}{/capture}
68 68 <input type="submit" name="kt_cancel[{$link}]" value="{i18n}Cancel{/i18n}" />
69 69 </div>
... ...
templates/ktstandard/signatures/signature_form.smarty
... ... @@ -22,7 +22,7 @@
22 22 <input id="sign_comment" type="text" />
23 23 </p>
24 24  
25   -<div id="form_actions">
  25 +<div class="form_actions">
26 26  
27 27 <a href="#" onclick="javascript: submitForm();">{i18n}OK{/i18n}</a>&nbsp;
28 28 <a href="#" onclick="javascript: panel_close();">{i18n}Cancel{/i18n}</a>
... ...