From 986f79eed0ceb07ef82a91c7bc9d78cf7444eb2d Mon Sep 17 00:00:00 2001
From: Megan
Date: Tue, 10 Mar 2009 12:33:11 +0200
Subject: [PATCH] Added electronic signature to additional actions.
---
lib/templating/kt3template.inc.php | 13 ++++++++++---
plugins/ktcore/KTPermissions.php | 54 ++++++++++++++++++++++++++++++++++++++++--------------
plugins/ktcore/folder/Permissions.php | 24 ++++++++++++++++++------
plugins/ktcore/folder/Rename.php | 33 ++++++++++++++++++++++-----------
plugins/ktstandard/KTElectronicSignatures.php | 5 +++--
resources/css/kt-framing.css | 13 ++++++++++++-
resources/js/signature.js | 4 +++-
templates/ktcore/folder/permissions.smarty | 3 +--
templates/ktcore/folder/rename.smarty | 7 +------
templates/ktcore/folder/roles_managegroups.smarty | 10 +++++-----
templates/ktcore/folder/roles_manageusers.smarty | 4 ++--
templates/ktstandard/signatures/signature_form.smarty | 2 +-
12 files changed, 118 insertions(+), 54 deletions(-)
diff --git a/lib/templating/kt3template.inc.php b/lib/templating/kt3template.inc.php
index 767ec54..27db665 100644
--- a/lib/templating/kt3template.inc.php
+++ b/lib/templating/kt3template.inc.php
@@ -154,13 +154,20 @@ class KTPage {
// FIXME: we lost the getDefaultAction stuff - do we care?
// note that key == action. this is _important_, since we crossmatch the breadcrumbs against this for "active"
$sBaseUrl = KTUtil::kt_url();
- $heading = _kt('You are attempting to access DMS Administration');
$this->menu = array();
$this->menu['dashboard'] = array('label' => _kt("Dashboard"), 'url' => $sBaseUrl.'/dashboard.php');
$this->menu['browse'] = array('label' => _kt("Browse Documents"), 'url' => $sBaseUrl.'/browse.php');
- $this->menu['administration'] = array('label' => _kt("DMS Administration"), 'url' => '#',
- 'onclick' => "javascript: showSignatureForm('{$heading}', 'dms.administration.access', 'system', '{$sBaseUrl}/admin.php', 'redirect');"); //$sBaseUrl.'/admin.php',
+ $this->menu['administration'] = array('label' => _kt("DMS Administration"));
+
+ global $default;
+ if($default->enableESignatures){
+ $heading = _kt('You are attempting to access DMS Administration');
+ $this->menu['administration']['url'] = '#';
+ $this->menu['administration']['onclick'] = "javascript: showSignatureForm('{$heading}', 'dms.administration.access', 'system', '{$sBaseUrl}/admin.php', 'redirect');";
+ }else{
+ $this->menu['administration']['url'] = $sBaseUrl.'/admin.php';
+ }
}
diff --git a/plugins/ktcore/KTPermissions.php b/plugins/ktcore/KTPermissions.php
index 5febabf..6ca4138 100644
--- a/plugins/ktcore/KTPermissions.php
+++ b/plugins/ktcore/KTPermissions.php
@@ -6,31 +6,31 @@
* Document Management Made Simple
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
* Portions copyright The Jam Warehouse Software (Pty) Limited
- *
+ *
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
- * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+ *
+ * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
* California 94120-7775, or email info@knowledgetree.com.
- *
+ *
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
- *
+ *
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
- * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
- * must display the words "Powered by KnowledgeTree" and retain the original
+ * must display the words "Powered by KnowledgeTree" and retain the original
* copyright notice.
* Contributor( s): ______________________________________
*
@@ -541,14 +541,16 @@ class KTRoleAllocationPlugin extends KTFolderAction {
function do_editRoleUsers() {
+ $iFolderId = $this->oFolder->getId();
+
$role_allocation_id = KTUtil::arrayGet($_REQUEST, 'alloc_id');
- if (($this->oFolder->getId() == 1) && is_null($role_allocation_id)) {
+ if (($iFolderId == 1) && is_null($role_allocation_id)) {
$oRoleAllocation = $this->rootoverride($_REQUEST['role_id']);
} else {
$oRoleAllocation = RoleAllocation::get($role_allocation_id);
}
if ((PEAR::isError($oRoleAllocation)) || ($oRoleAllocation=== false)) {
- $this->errorRedirectToMain(_kt('No such role allocation.'), sprintf('fFolderId=%d',$this->oFolder->getId()));
+ $this->errorRedirectToMain(_kt('No such role allocation.'), sprintf('fFolderId=%d',$iFolderId));
}
@@ -577,6 +579,17 @@ class KTRoleAllocationPlugin extends KTFolderAction {
}
}
+ // Include the electronic signature on the permissions action
+ global $default;
+ if($default->enableESignatures){
+ $heading = _kt('You are attempting to modify roles');
+ $input['type'] = 'button';
+ $input['onclick'] = "javascript: showSignatureForm('{$heading}', 'ktcore.transactions.roles_modify_users', 'folder', 'userroleform', 'submit', {$iFolderId});";
+ }else{
+ $input['type'] = 'submit';
+ $input['onclick'] = '';
+ }
+
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate("ktcore/folder/roles_manageusers");
$aTemplateData = array(
@@ -584,20 +597,23 @@ class KTRoleAllocationPlugin extends KTFolderAction {
"edit_rolealloc" => $oRoleAllocation,
'unused_users' => $aFreeUsers,
'role_users' => $aRoleUsers,
+ 'input' => $input
);
return $oTemplate->render($aTemplateData);
}
function do_editRoleGroups() {
+ $iFolderId = $this->oFolder->getId();
+
$role_allocation_id = KTUtil::arrayGet($_REQUEST, 'alloc_id');
- if (($this->oFolder->getId() == 1) && is_null($role_allocation_id)) {
+ if (($iFolderId == 1) && is_null($role_allocation_id)) {
$oRoleAllocation = $this->rootoverride($_REQUEST['role_id']);
} else {
$oRoleAllocation = RoleAllocation::get($role_allocation_id);
}
if ((PEAR::isError($oRoleAllocation)) || ($oRoleAllocation=== false)) {
- $this->errorRedirectToMain(_kt('No such role allocation.'), sprintf('fFolderId=%d',$this->oFolder->getId()));
+ $this->errorRedirectToMain(_kt('No such role allocation.'), sprintf('fFolderId=%d',$iFolderId));
}
$oRole = Role::get($oRoleAllocation->getRoleId());
@@ -627,7 +643,16 @@ class KTRoleAllocationPlugin extends KTFolderAction {
}
}
-
+ // Include the electronic signature on the permissions action
+ global $default;
+ if($default->enableESignatures){
+ $heading = _kt('You are attempting to modify roles');
+ $input['type'] = 'button';
+ $input['onclick'] = "javascript: showSignatureForm('{$heading}', 'ktcore.transactions.roles_modify_groups', 'folder', 'grouproleform', 'submit', {$iFolderId});";
+ }else{
+ $input['type'] = 'submit';
+ $input['onclick'] = '';
+ }
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate("ktcore/folder/roles_managegroups");
@@ -637,6 +662,7 @@ class KTRoleAllocationPlugin extends KTFolderAction {
'unused_groups' => $aFreeUsers,
'role_groups' => $aRoleUsers,
'rolename' => $oRole->getName(),
+ 'input' => $input
);
return $oTemplate->render($aTemplateData);
}
diff --git a/plugins/ktcore/folder/Permissions.php b/plugins/ktcore/folder/Permissions.php
index 5a46108..66b693b 100644
--- a/plugins/ktcore/folder/Permissions.php
+++ b/plugins/ktcore/folder/Permissions.php
@@ -274,10 +274,11 @@ class KTFolderPermissionsAction extends KTFolderAction {
function do_edit() {
$this->oPage->setBreadcrumbDetails(_kt('Viewing Permissions'));
+ $iFolderId = $this->oFolder->getId();
$oPO = KTPermissionObject::get($this->oFolder->getPermissionObjectId());
- $aOptions = array('redirect_to' => array('main', 'fFolderId=' . $this->oFolder->getId()));
+ $aOptions = array('redirect_to' => array('main', 'fFolderId=' . $iFolderId));
if (!KTBrowseUtil::inAdminMode($this->oUser, $this->oFolder)) {
$this->oValidator->userHasPermissionOnItem($this->oUser, $this->_sEditShowPermission, $this->oFolder, $aOptions);
@@ -285,10 +286,10 @@ class KTFolderPermissionsAction extends KTFolderAction {
// copy permissions if they were inherited
$oInherited = KTPermissionUtil::findRootObjectForPermissionObject($oPO);
- if ($oInherited->getId() !== $this->oFolder->getId()) {
+ if ($oInherited->getId() !== $iFolderId) {
$override = KTUtil::arrayGet($_REQUEST, 'override', false);
if (empty($override)) {
- $this->errorRedirectToMain(_kt('This folder does not override its permissions'), sprintf('fFolderId=%d', $this->oFolder->getId()));
+ $this->errorRedirectToMain(_kt('This folder does not override its permissions'), sprintf('fFolderId=%d', $iFolderId));
}
$this->startTransaction();
$this->_copyPermissions();
@@ -314,13 +315,23 @@ class KTFolderPermissionsAction extends KTFolderAction {
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate('ktcore/folder/permissions');
- $bCanInherit = ($this->oFolder->getId() != 1);
+ $bCanInherit = ($iFolderId != 1);
+
+ global $default;
+ if($default->enableESignatures){
+ $heading = _kt('You are attempting to modify permissions');
+ $input['type'] = 'button';
+ $input['onclick'] = "javascript: showSignatureForm('{$heading}', 'ktcore.transactions.permissions_change', 'folder', 'update_permissions_form', 'submit', {$iFolderId});";
+ }else{
+ $input['type'] = 'submit';
+ $input['onclick'] = '';
+ }
$perms = $aPermList;
$docperms = KTPermission::getDocumentRelevantList();
$aTemplateData = array(
- 'iFolderId' => $this->oFolder->getId(),
+ 'iFolderId' => $iFolderId,
'roles' => Role::getList(),
'groups' => Group::getList(),
'conditions' => KTSavedSearch::getConditions(),
@@ -331,7 +342,8 @@ class KTFolderPermissionsAction extends KTFolderAction {
'edit' => true,
'permissions' => $perms,
'document_permissions' => $docperms,
- 'can_inherit' => $bCanInherit
+ 'can_inherit' => $bCanInherit,
+ 'input' => $input
);
return $oTemplate->render($aTemplateData);
}
diff --git a/plugins/ktcore/folder/Rename.php b/plugins/ktcore/folder/Rename.php
index a7f3bf4..6ecc0ac 100644
--- a/plugins/ktcore/folder/Rename.php
+++ b/plugins/ktcore/folder/Rename.php
@@ -6,31 +6,31 @@
* Document Management Made Simple
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
* Portions copyright The Jam Warehouse Software (Pty) Limited
- *
+ *
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
- * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+ *
+ * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
* California 94120-7775, or email info@knowledgetree.com.
- *
+ *
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
- *
+ *
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
- * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
- * must display the words "Powered by KnowledgeTree" and retain the original
+ * must display the words "Powered by KnowledgeTree" and retain the original
* copyright notice.
* Contributor( s): ______________________________________
*
@@ -51,7 +51,7 @@ class KTFolderRenameAction extends KTFolderAction {
function getDisplayName() {
return _kt('Rename');
}
-
+
function getInfo() {
return parent::getInfo();
}
@@ -63,10 +63,21 @@ class KTFolderRenameAction extends KTFolderAction {
$fields = array();
$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);
-
+
+ global $default;
+ if($default->enableESignatures){
+ $heading = _kt('You are attempting to rename a folder');
+ $input['onclick'] = "javascript: showSignatureForm('{$heading}', 'ktcore.transactions.rename', 'folder', 'rename_folder_form', 'submit', {$this->oFolder->getId()});";
+ $input['type'] = 'button';
+ }else{
+ $input['onclick'] = '';
+ $input['type'] = 'submit';
+ }
+
$oTemplate->setData(array(
'context' => &$this,
'fields' => $fields,
+ 'input' => $input,
'folderName' => $this->oFolder->getName(),
));
return $oTemplate->render();
diff --git a/plugins/ktstandard/KTElectronicSignatures.php b/plugins/ktstandard/KTElectronicSignatures.php
index c59da51..f12b558 100644
--- a/plugins/ktstandard/KTElectronicSignatures.php
+++ b/plugins/ktstandard/KTElectronicSignatures.php
@@ -113,7 +113,8 @@ class KTElectronicSignatures
}
if($this->lock){
- return $this->eSignature->getLockMsg();
+ $this->error = $this->eSignature->getLockMsg();
+ return $this->getError();
}
return $oTemplate->render($aTemplateData);
}
@@ -147,7 +148,7 @@ class KTElectronicSignatures
*/
public function getError()
{
- return $this->error;
+ return '