From 59b9296e7a25b2bfc4a73d8af4c0bc10d12874a3 Mon Sep 17 00:00:00 2001
From: Megan
Date: Sun, 22 Mar 2009 20:28:02 +0200
Subject: [PATCH] Added E-signatures on add document, add folder, bulk import and upload. Fixed bugs: KTC-685, 688, 689, 690, 691, 692
---
admin.php | 2 +-
config/dmsDefaults.php | 6 +++---
lib/templating/kt3template.inc.php | 14 +++++++++++---
plugins/ktcore/KTBulkActions.php | 188 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------
plugins/ktcore/KTDocumentActions.php | 20 ++++++++++++++++++--
plugins/ktcore/KTFolderActions.php | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------
plugins/ktcore/KTPermissions.php | 27 +++++++++++++++++++++++++--
plugins/ktcore/folder/BulkImport.php | 14 ++++++++++++++
plugins/ktcore/folder/BulkUpload.php | 14 ++++++++++++++
plugins/ktcore/folder/Transactions.php | 37 ++++++++++++++++++++++++++-----------
plugins/ktcore/folder/addDocument.php | 37 ++++++++++++++++++++++++++++++++++++-
templates/ktcore/folder/bulkImport.smarty | 6 +++---
templates/ktcore/folder/bulkUpload.smarty | 6 +++---
templates/ktcore/folder/roles.smarty | 2 +-
14 files changed, 382 insertions(+), 66 deletions(-)
diff --git a/admin.php b/admin.php
index 2cbd30e..f0d5ee6 100644
--- a/admin.php
+++ b/admin.php
@@ -155,7 +155,7 @@ if($default->enableAdminSignatures && $_SESSION['electronic_signature_time'] < t
$sBaseUrl = KTUtil::kt_url();
$sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
$heading = _kt('You are attempting to access DMS Administration');
- $main->setBodyOnload("javascript: showSignatureForm('{$sUrl}', '{$heading}', 'dms.administration.accessing_administration', 'admin', '{$sBaseUrl}/browse.php', 'close');");
+ $main->setBodyOnload("javascript: showSignatureForm('{$sUrl}', '{$heading}', 'dms.administration.administration_section_access', 'admin', '{$sBaseUrl}/browse.php', 'close');");
}
diff --git a/config/dmsDefaults.php b/config/dmsDefaults.php
index 6480fff..685d9ea 100644
--- a/config/dmsDefaults.php
+++ b/config/dmsDefaults.php
@@ -623,9 +623,6 @@ require_once(KT_LIB_DIR . '/session/control.inc');
require_once(KT_LIB_DIR . '/plugins/pluginutil.inc.php');
-require_once(KT_LIB_DIR . '/templating/kt3template.inc.php');
-$GLOBALS['main'] =new KTPage();
-
if ($checkup !== true) {
// Replace function later
/* ** Get the page being loaded and load the plugins specific to the page ** */
@@ -654,5 +651,8 @@ if (!extension_loaded('mbstring'))
require_once(KT_LIB_DIR . '/mbstring.inc.php');
}
+require_once(KT_LIB_DIR . '/templating/kt3template.inc.php');
+$GLOBALS['main'] =new KTPage();
+
?>
\ No newline at end of file
diff --git a/lib/templating/kt3template.inc.php b/lib/templating/kt3template.inc.php
index d2aea8f..e509a86 100644
--- a/lib/templating/kt3template.inc.php
+++ b/lib/templating/kt3template.inc.php
@@ -166,7 +166,7 @@ class KTPage {
$sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
$heading = _kt('You are attempting to access DMS Administration');
$this->menu['administration']['url'] = '#';
- $this->menu['administration']['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'dms.administration.accessing_administration', 'admin', '{$sBaseUrl}/admin.php', 'redirect');";
+ $this->menu['administration']['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'dms.administration.administration_section_access', 'admin', '{$sBaseUrl}/admin.php', 'redirect');";
}else{
$this->menu['administration']['url'] = $sBaseUrl.'/admin.php';
}
@@ -192,6 +192,14 @@ class KTPage {
// list the distinct js resources.
function getJSResources() {
+ // get js resources specified within the plugins
+ // these need to be added to the session because KTPage is initialised after the plugins are loaded.
+ if(isset($GLOBALS['page_js_resources']) && !empty($GLOBALS['page_js_resources'])){
+ foreach($GLOBALS['page_js_resources'] as $js){
+ $this->js_resources[$js] = 1;
+ }
+ }
+
return array_keys($this->js_resources);
}
@@ -381,9 +389,9 @@ class KTPage {
}
$this->userMenu = array();
- if (!(PEAR::isError($this->user) || is_null($this->user) || $this->user->isAnonymous())) {
- $sBaseUrl = KTUtil::kt_url();
+ $sBaseUrl = KTUtil::kt_url();
+ if (!(PEAR::isError($this->user) || is_null($this->user) || $this->user->isAnonymous())) {
if ($oConfig->get("user_prefs/restrictPreferences", false) && !Permission::userIsSystemAdministrator($this->user->getId())) {
$this->userMenu['logout'] = array('label' => _kt('Logout'), 'url' => $sBaseUrl.'/presentation/logout.php');
} else {
diff --git a/plugins/ktcore/KTBulkActions.php b/plugins/ktcore/KTBulkActions.php
index ddeb23c..d535d77 100644
--- a/plugins/ktcore/KTBulkActions.php
+++ b/plugins/ktcore/KTBulkActions.php
@@ -77,22 +77,53 @@ class KTBulkDeleteAction extends KTBulkAction {
'cancel_url' => $cancelUrl,
'context' => $this,
));
- $oForm->setWidgets(array(
- array('ktcore.widgets.reason',array(
+
+ // Electronic Signature if enabled
+ global $default;
+ if($default->enableESignatures){
+ $widgets[] = array('ktcore.widgets.info', array(
+ 'label' => _kt('This action requires authentication'),
+ 'description' => _kt('Please provide your user credentials as confirmation of this action.'),
+ 'name' => 'info'
+ ));
+ $widgets[] = array('ktcore.widgets.string', array(
+ 'label' => _kt('Username'),
+ 'name' => 'sign_username',
+ 'required' => true
+ ));
+ $widgets[] = array('ktcore.widgets.password', array(
+ 'label' => _kt('Password'),
+ 'name' => 'sign_password',
+ 'required' => true
+ ));
+ }
+
+ $widgets[] = array('ktcore.widgets.reason',array(
'name' => 'reason',
'label' => _kt('Reason'),
'description' => _kt('The reason for the deletion of these documents and folders for historical purposes.'),
'value' => null,
'required' => true,
- )),
- ));
+ ));
- $oForm->setValidators(array(
- array('ktcore.validators.string', array(
+ $oForm->setWidgets($widgets);
+
+ $validators[] = array('ktcore.validators.string', array(
'test' => 'reason',
'output' => 'reason',
- )),
- ));
+ ));
+
+ if($default->enableESignatures){
+ $validators[] = array('electonic.signatures.validators.authenticate', array(
+ 'object_id' => $this->oFolder->getID(),
+ 'type' => 'bulk',
+ 'action' => 'ktcore.transactions.bulk_delete',
+ 'test' => 'info',
+ 'output' => 'info'
+ ));
+ }
+
+ $oForm->setValidators($validators);
return $oForm;
}
@@ -261,6 +292,28 @@ class KTBulkMoveAction extends KTBulkAction {
$oForm->addInitializedWidget($oWidget);
+
+ // Electronic Signature if enabled
+ global $default;
+ if($default->enableESignatures){
+ $oForm->addWidget(array('ktcore.widgets.info', array(
+ 'label' => _kt('This action requires authentication'),
+ 'description' => _kt('Please provide your user credentials as confirmation of this action.'),
+ 'name' => 'info'
+ )));
+ $oForm->addWidget(array('ktcore.widgets.string', array(
+ 'label' => _kt('Username'),
+ 'name' => 'sign_username',
+ 'required' => true
+ )));
+ $oForm->addWidget(array('ktcore.widgets.password', array(
+ 'label' => _kt('Password'),
+ 'name' => 'sign_password',
+ 'required' => true
+ )));
+ }
+
+
$oForm->addWidget(
array('ktcore.widgets.reason',array(
'name' => 'reason',
@@ -278,6 +331,17 @@ class KTBulkMoveAction extends KTBulkAction {
)),
));
+ if($default->enableESignatures){
+ $oForm->addValidator(array('electonic.signatures.validators.authenticate', array(
+ 'object_id' => $this->oFolder->getID(),
+ 'type' => 'bulk',
+ 'action' => 'ktcore.transactions.bulk_move',
+ 'test' => 'info',
+ 'output' => 'info'
+ )));
+ }
+
+
return $oForm;
}
@@ -414,9 +478,28 @@ class KTBulkCopyAction extends KTBulkAction {
'folder_id' => $this->oFolder->iId,
'collection' => $collection));
+ $oForm->addInitializedWidget($oWidget);
+ // Electronic Signature if enabled
+ global $default;
+ if($default->enableESignatures){
+ $oForm->addWidget(array('ktcore.widgets.info', array(
+ 'label' => _kt('This action requires authentication'),
+ 'description' => _kt('Please provide your user credentials as confirmation of this action.'),
+ 'name' => 'info'
+ )));
+ $oForm->addWidget(array('ktcore.widgets.string', array(
+ 'label' => _kt('Username'),
+ 'name' => 'sign_username',
+ 'required' => true
+ )));
+ $oForm->addWidget(array('ktcore.widgets.password', array(
+ 'label' => _kt('Password'),
+ 'name' => 'sign_password',
+ 'required' => true
+ )));
+ }
- $oForm->addInitializedWidget($oWidget);
$oForm->addWidget(
array('ktcore.widgets.reason',array(
'name' => 'reason',
@@ -434,6 +517,17 @@ class KTBulkCopyAction extends KTBulkAction {
)),
));
+ if($default->enableESignatures){
+ $oForm->addValidator(array('electonic.signatures.validators.authenticate', array(
+ 'object_id' => $this->oFolder->getID(),
+ 'type' => 'bulk',
+ 'action' => 'ktcore.transactions.bulk_copy',
+ 'test' => 'info',
+ 'output' => 'info'
+ )));
+ }
+
+
return $oForm;
}
@@ -517,6 +611,26 @@ class KTBulkArchiveAction extends KTBulkAction {
'context' => $this,
));
+ // Electronic Signature if enabled
+ global $default;
+ if($default->enableESignatures){
+ $oForm->addWidget(array('ktcore.widgets.info', array(
+ 'label' => _kt('This action requires authentication'),
+ 'description' => _kt('Please provide your user credentials as confirmation of this action.'),
+ 'name' => 'info'
+ )));
+ $oForm->addWidget(array('ktcore.widgets.string', array(
+ 'label' => _kt('Username'),
+ 'name' => 'sign_username',
+ 'required' => true
+ )));
+ $oForm->addWidget(array('ktcore.widgets.password', array(
+ 'label' => _kt('Password'),
+ 'name' => 'sign_password',
+ 'required' => true
+ )));
+ }
+
$oForm->addWidget(
array('ktcore.widgets.reason',array(
'name' => 'reason',
@@ -534,6 +648,17 @@ class KTBulkArchiveAction extends KTBulkAction {
)),
));
+ if($default->enableESignatures){
+ $oForm->addValidator(array('electonic.signatures.validators.authenticate', array(
+ 'object_id' => $this->oFolder->getID(),
+ 'type' => 'bulk',
+ 'action' => 'ktcore.transactions.bulk_archive',
+ 'test' => 'info',
+ 'output' => 'info'
+ )));
+ }
+
+
return $oForm;
}
@@ -777,7 +902,7 @@ class KTBrowseBulkExportAction extends KTBulkAction {
function kt_bulkexport_redirect() {
document.location.href = "%s";
}
- callLater(1, kt_bulkexport_redirect);
+ callLater(2, kt_bulkexport_redirect);
', $url);
@@ -967,21 +1092,41 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction {
'context' => $this,
));
- $oForm-> setWidgets(array(
- array('ktcore.widgets.reason',array(
+ // Electronic Signature if enabled
+ global $default;
+ if($default->enableESignatures){
+ $widgets[] = array('ktcore.widgets.info', array(
+ 'label' => _kt('This action requires authentication'),
+ 'description' => _kt('Please provide your user credentials as confirmation of this action.'),
+ 'name' => 'info'
+ ));
+ $widgets[] = array('ktcore.widgets.string', array(
+ 'label' => _kt('Username'),
+ 'name' => 'sign_username',
+ 'required' => true
+ ));
+ $widgets[] = array('ktcore.widgets.password', array(
+ 'label' => _kt('Password'),
+ 'name' => 'sign_password',
+ 'required' => true
+ ));
+ }
+
+ $widgets[] = array('ktcore.widgets.reason',array(
'name' => 'reason',
'label' => _kt('Reason'),
'description' => _kt('Please specify why you are checking out these documents. It will assist other users in understanding why you have locked these files.'),
'value' => null,
'required' => true,
- )),
- array('ktcore.widgets.boolean', array(
+ ));
+ $widgets[] = array('ktcore.widgets.boolean', array(
'label' => _kt('Download Files'),
'description' => _kt('Indicate whether you would like to download these file as part of the checkout.'),
'name' => 'download_file',
'value' => true,
- )),
- ));
+ ));
+
+ $oForm->setWidgets($widgets);
$oForm->setValidators(array(
array('ktcore.validators.string', array(
@@ -995,6 +1140,17 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction {
)),
));
+ if($default->enableESignatures){
+ $oForm->addValidator(array('electonic.signatures.validators.authenticate', array(
+ 'object_id' => $this->oFolder->getID(),
+ 'type' => 'bulk',
+ 'action' => 'ktcore.transactions.bulk_check_out',
+ 'test' => 'info',
+ 'output' => 'info'
+ )));
+ }
+
+
return $oForm;
}
diff --git a/plugins/ktcore/KTDocumentActions.php b/plugins/ktcore/KTDocumentActions.php
index e5c3ff9..6a6355e 100644
--- a/plugins/ktcore/KTDocumentActions.php
+++ b/plugins/ktcore/KTDocumentActions.php
@@ -81,9 +81,9 @@ class KTDocumentTransactionHistoryAction extends KTDocumentAction {
$aTransactions = array();
// FIXME create a sane "view user information" page somewhere.
// FIXME do we really need to use a raw db-access here? probably...
- $sQuery = 'SELECT DTT.name AS transaction_name, U.name AS user_name, DT.version AS version, DT.comment AS comment, DT.datetime AS datetime ' .
+ $sQuery = 'SELECT DTT.name AS transaction_name, DT.transaction_namespace, U.name AS user_name, DT.version AS version, DT.comment AS comment, DT.datetime AS datetime ' .
'FROM ' . KTUtil::getTableName('document_transactions') . ' AS DT INNER JOIN ' . KTUtil::getTableName('users') . ' AS U ON DT.user_id = U.id ' .
- 'INNER JOIN ' . KTUtil::getTableName('transaction_types') . ' AS DTT ON DTT.namespace = DT.transaction_namespace ' .
+ 'LEFT JOIN ' . KTUtil::getTableName('transaction_types') . ' AS DTT ON DTT.namespace = DT.transaction_namespace ' .
'WHERE DT.document_id = ? ORDER BY DT.datetime DESC';
$aParams = array($this->oDocument->getId());
@@ -95,6 +95,13 @@ class KTDocumentTransactionHistoryAction extends KTDocumentAction {
$aTransactions = $res;
+ // Set the namespaces where not in the transactions lookup
+ foreach($aTransactions as $key => $transaction){
+ if(empty($transaction['transaction_name'])){
+ $aTransactions[$key]['transaction_name'] = $this->_getActionNameForNamespace($transaction['transaction_namespace']);
+ }
+ }
+
// render pass.
$this->oPage->setTitle(_kt('Document History'));
@@ -108,6 +115,15 @@ class KTDocumentTransactionHistoryAction extends KTDocumentAction {
);
return $oTemplate->render($aTemplateData);
}
+
+ function _getActionNameForNamespace($sNamespace) {
+ $aNames = split('\.', $sNamespace);
+ $sName = array_pop($aNames);
+ $sName = str_replace('_', ' ', $sName);
+ $sName = ucwords($sName);
+ return $sName;
+ }
+
}
// }}}
diff --git a/plugins/ktcore/KTFolderActions.php b/plugins/ktcore/KTFolderActions.php
index b078dfb..9e5ac87 100644
--- a/plugins/ktcore/KTFolderActions.php
+++ b/plugins/ktcore/KTFolderActions.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): ______________________________________
*
@@ -50,7 +50,7 @@ require_once(KT_LIB_DIR . '/plugins/pluginregistry.inc.php');
require_once(KT_LIB_DIR . '/roles/Role.inc');
-// {{{ KTDocumentDetailsAction
+// {{{ KTDocumentDetailsAction
class KTFolderViewAction extends KTFolderAction {
var $sName = 'ktcore.actions.folder.view';
@@ -75,7 +75,7 @@ class KTFolderAddFolderAction extends KTFolderAction {
function getDisplayName() {
return _kt('Add a Folder');
}
-
+
function form_main() {
$oForm = new KTForm;
@@ -89,8 +89,8 @@ class KTFolderAddFolderAction extends KTFolderAction {
'label' => _kt('Add a folder'),
'submit_label' => _kt('Add Folder'),
'extraargs' => $this->meldPersistQuery("","", true),
- ));
-
+ ));
+
// widgets
$oForm->setWidgets(array(
array('ktcore.widgets.string', array(
@@ -99,7 +99,32 @@ class KTFolderAddFolderAction extends KTFolderAction {
'required' => true,
'name' => 'name')),
));
-
+
+ // Electronic Signature if enabled
+ global $default;
+ if($default->enableESignatures){
+ $oForm->addWidget(array('ktcore.widgets.info', array(
+ 'label' => _kt('This action requires authentication'),
+ 'description' => _kt('Please provide your user credentials as confirmation of this action.'),
+ 'name' => 'info'
+ )));
+ $oForm->addWidget(array('ktcore.widgets.string', array(
+ 'label' => _kt('Username'),
+ 'name' => 'sign_username',
+ 'required' => true
+ )));
+ $oForm->addWidget(array('ktcore.widgets.password', array(
+ 'label' => _kt('Password'),
+ 'name' => 'sign_password',
+ 'required' => true
+ )));
+ $oForm->addWidget(array('ktcore.widgets.reason', array(
+ 'label' => _kt('Reason'),
+ 'description' => _kt('Please specify why you are checking out this document. It will assist other users in understanding why you have locked this file. Please bear in mind that you can use a maximum of 250 characters.'),
+ 'name' => 'reason',
+ )));
+ }
+
$oForm->setValidators(array(
array('ktcore.validators.string', array(
'test' => 'name',
@@ -110,17 +135,27 @@ class KTFolderAddFolderAction extends KTFolderAction {
'output' => 'name',
)),
));
-
+
+ if($default->enableESignatures){
+ $oForm->addValidator(array('electonic.signatures.validators.authenticate', array(
+ 'object_id' => $this->oFolder->getId(),
+ 'type' => 'folder',
+ 'action' => 'ktcore.transactions.add_folder',
+ 'test' => 'info',
+ 'output' => 'info'
+ )));
+ }
+
return $oForm;
-
- }
+
+ }
function do_main() {
$this->oPage->setBreadcrumbDetails(_kt("add folder"));
$oTemplate =& $this->oValidator->validateTemplate('ktcore/action/addFolder');
$oForm = $this->form_main();
-
+
$oTemplate->setData(array(
'context' => &$this,
'form' => $oForm,
@@ -129,14 +164,14 @@ class KTFolderAddFolderAction extends KTFolderAction {
}
function do_addFolder() {
-
+
$oForm = $this->form_main();
$res = $oForm->validate();
if (!empty($res['errors'])) {
$oForm->handleError();
}
$res = $res['results'];
-
+
if(KTFolderUtil::exists($this->oFolder, $res['name'])) {
$oForm->handleError(null, array('name' => _kt('A folder with that name already exists.')));
}
diff --git a/plugins/ktcore/KTPermissions.php b/plugins/ktcore/KTPermissions.php
index 015a782..8ef4b59 100644
--- a/plugins/ktcore/KTPermissions.php
+++ b/plugins/ktcore/KTPermissions.php
@@ -363,6 +363,19 @@ class KTRoleAllocationPlugin extends KTFolderAction {
// final step.
+ // Include the electronic signature
+ global $default;
+ $iFolderId = $this->oFolder->getId() ;
+ if($default->enableESignatures){
+ $sign = true;
+ $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
+ $heading = _kt('You are attempting to modify roles');
+ $input_href = '#';
+ }else{
+ $sign = false;
+ $input_onclick = '';
+ }
+
// map to users, groups.
foreach ($aRoles as $key => $role) {
$_users = array();
@@ -390,6 +403,16 @@ class KTRoleAllocationPlugin extends KTFolderAction {
} else {
$aRoles[$key]['groups'] = join(', ',$_groups);
}
+
+ if($sign){
+ $redirect_url = KTUtil::addQueryStringSelf("action=useParent&role_id={$key}&fFolderId={$iFolderId}");
+ $input_onclick = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.role_allocations_change', 'folder', '{$redirect_url}', 'redirect', {$iFolderId});";
+ }else{
+ $input_href = KTUtil::addQueryStringSelf("action=useParent&role_id={$key}&fFolderId={$iFolderId}");
+ }
+
+ $aRoles[$key]['onclick'] =$input_onclick;
+ $aRoles[$key]['href'] =$input_href;
}
$aTemplateData = array(
@@ -585,7 +608,7 @@ class KTRoleAllocationPlugin extends KTFolderAction {
$sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
$heading = _kt('You are attempting to modify roles');
$input['type'] = 'button';
- $input['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.roles_modify_users', 'folder', 'userroleform', 'submit', {$iFolderId});";
+ $input['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.role_allocations_change', 'folder', 'userroleform', 'submit', {$iFolderId});";
}else{
$input['type'] = 'submit';
$input['onclick'] = '';
@@ -650,7 +673,7 @@ class KTRoleAllocationPlugin extends KTFolderAction {
$sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
$heading = _kt('You are attempting to modify roles');
$input['type'] = 'button';
- $input['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.roles_modify_groups', 'folder', 'grouproleform', 'submit', {$iFolderId});";
+ $input['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.role_allocations_change', 'folder', 'grouproleform', 'submit', {$iFolderId});";
}else{
$input['type'] = 'submit';
$input['onclick'] = '';
diff --git a/plugins/ktcore/folder/BulkImport.php b/plugins/ktcore/folder/BulkImport.php
index f723760..15cbaf5 100644
--- a/plugins/ktcore/folder/BulkImport.php
+++ b/plugins/ktcore/folder/BulkImport.php
@@ -95,8 +95,22 @@ class KTBulkImportFolderAction extends KTFolderAction {
array_push($fieldsets, new $displayClass($oFieldset));
}
+ // Implement an electronic signature for accessing the admin section, it will appear every 10 minutes
+ global $default;
+ $iFolderId = $this->oFolder->getId();
+ if($default->enableESignatures){
+ $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
+ $heading = _kt('You are attempting to perform a bulk import');
+ $submit['type'] = 'button';
+ $submit['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.bulk_import', 'bulk', 'bulk_import_form', 'submit', {$iFolderId});";
+ }else{
+ $submit['type'] = 'submit';
+ $submit['onclick'] = '';
+ }
+
$oTemplate->setData(array(
'context' => &$this,
+ 'submit' => $submit,
'add_fields' => $add_fields,
'generic_fieldsets' => $fieldsets,
));
diff --git a/plugins/ktcore/folder/BulkUpload.php b/plugins/ktcore/folder/BulkUpload.php
index 3f14912..ed8b8e3 100644
--- a/plugins/ktcore/folder/BulkUpload.php
+++ b/plugins/ktcore/folder/BulkUpload.php
@@ -96,8 +96,22 @@ class KTBulkUploadFolderAction extends KTFolderAction {
array_push($fieldsets, new $displayClass($oFieldset));
}
+ // Implement an electronic signature for accessing the admin section, it will appear every 10 minutes
+ global $default;
+ $iFolderId = $this->oFolder->getId();
+ if($default->enableESignatures){
+ $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
+ $heading = _kt('You are attempting to perform a bulk upload');
+ $submit['type'] = 'button';
+ $submit['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.bulk_upload', 'bulk', 'bulk_upload_form', 'submit', {$iFolderId});";
+ }else{
+ $submit['type'] = 'submit';
+ $submit['onclick'] = '';
+ }
+
$oTemplate->setData(array(
'context' => &$this,
+ 'submit' => $submit,
'add_fields' => $add_fields,
'generic_fieldsets' => $fieldsets,
));
diff --git a/plugins/ktcore/folder/Transactions.php b/plugins/ktcore/folder/Transactions.php
index a29d60f..9d03d19 100644
--- a/plugins/ktcore/folder/Transactions.php
+++ b/plugins/ktcore/folder/Transactions.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): ______________________________________
*
@@ -52,7 +52,7 @@ class KTFolderTransactionsAction extends KTFolderAction {
function getDisplayName() {
return _kt('Folder transactions');
}
-
+
function do_main() {
$this->oPage->setBreadcrumbDetails(_kt("transactions"));
$this->oPage->setTitle(_kt('Folder transactions'));
@@ -64,7 +64,7 @@ class KTFolderTransactionsAction extends KTFolderAction {
$aTransactions = array();
// FIXME do we really need to use a raw db-access here? probably...
- $sQuery = "SELECT DTT.name AS transaction_name, U.name AS user_name, FT.comment AS comment, FT.datetime AS datetime " .
+ $sQuery = "SELECT DTT.name AS transaction_name, FT.transaction_namespace, U.name AS user_name, FT.comment AS comment, FT.datetime AS datetime " .
"FROM " . KTUtil::getTableName("folder_transactions") . " AS FT LEFT JOIN " . KTUtil::getTableName("users") . " AS U ON FT.user_id = U.id " .
"LEFT JOIN " . KTUtil::getTableName("transaction_types") . " AS DTT ON DTT.namespace = FT.transaction_namespace " .
"WHERE FT.folder_id = ? ORDER BY FT.datetime DESC";
@@ -78,6 +78,13 @@ class KTFolderTransactionsAction extends KTFolderAction {
// FIXME roll up view transactions
$aTransactions = $res;
+ // Set the namespaces where not in the transactions lookup
+ foreach($aTransactions as $key => $transaction){
+ if(empty($transaction['transaction_name'])){
+ $aTransactions[$key]['transaction_name'] = $this->_getActionNameForNamespace($transaction['transaction_namespace']);
+ }
+ }
+
// render pass.
$this->oPage->title = _kt("Folder History");
$oTemplating =& KTTemplating::getSingleton();
@@ -91,6 +98,14 @@ class KTFolderTransactionsAction extends KTFolderAction {
return $oTemplate->render($aTemplateData);
}
+ function _getActionNameForNamespace($sNamespace) {
+ $aNames = split('\.', $sNamespace);
+ $sName = array_pop($aNames);
+ $sName = str_replace('_', ' ', $sName);
+ $sName = ucwords($sName);
+ return $sName;
+ }
+
}
diff --git a/plugins/ktcore/folder/addDocument.php b/plugins/ktcore/folder/addDocument.php
index 6234336..19ebd7d 100644
--- a/plugins/ktcore/folder/addDocument.php
+++ b/plugins/ktcore/folder/addDocument.php
@@ -94,7 +94,7 @@ class KTFolderAddDocumentAction extends KTFolderAction {
'file_upload' => true,
));
- $aTypes;
+ $aTypes = array();
foreach (DocumentType::getListForUserAndFolder($this->oUser, $this->oFolder) as $oDocumentType) {
if(!$oDocumentType->getDisabled()) {
$aTypes[] = $oDocumentType;
@@ -149,6 +149,31 @@ class KTFolderAddDocumentAction extends KTFolderAction {
)),
));
+ // Electronic Signature if enabled
+ global $default;
+ if($default->enableESignatures){
+ $oForm->addWidget(array('ktcore.widgets.info', array(
+ 'label' => _kt('This action requires authentication'),
+ 'description' => _kt('Please provide your user credentials as confirmation of this action.'),
+ 'name' => 'info'
+ )));
+ $oForm->addWidget(array('ktcore.widgets.string', array(
+ 'label' => _kt('Username'),
+ 'name' => 'sign_username',
+ 'required' => true
+ )));
+ $oForm->addWidget(array('ktcore.widgets.password', array(
+ 'label' => _kt('Password'),
+ 'name' => 'sign_password',
+ 'required' => true
+ )));
+ $oForm->addWidget(array('ktcore.widgets.reason', array(
+ 'label' => _kt('Reason'),
+ 'description' => _kt('Please specify why you are checking out this document. It will assist other users in understanding why you have locked this file. Please bear in mind that you can use a maximum of 250 characters.'),
+ 'name' => 'reason',
+ )));
+ }
+
$oForm->setValidators(array(
array('ktcore.validators.file', array(
'test' => 'file',
@@ -170,6 +195,16 @@ class KTFolderAddDocumentAction extends KTFolderAction {
)),
));
+ if($default->enableESignatures){
+ $oForm->addValidator(array('electonic.signatures.validators.authenticate', array(
+ 'object_id' => $this->oFolder->getId(),
+ 'type' => 'folder',
+ 'action' => 'ktcore.transactions.add_document',
+ 'test' => 'info',
+ 'output' => 'info'
+ )));
+ }
+
return $oForm;
}
diff --git a/templates/ktcore/folder/bulkImport.smarty b/templates/ktcore/folder/bulkImport.smarty
index 50a5f55..333255c 100644
--- a/templates/ktcore/folder/bulkImport.smarty
+++ b/templates/ktcore/folder/bulkImport.smarty
@@ -50,7 +50,7 @@ addLoadEvent(startupMetadata);
get("ui/morphTo")}/title_bullet.png{else}{$rootUrl}/resources/graphics/title_bullet.png{/if}"/>{i18n}Import files into{/i18n}: {$context->oFolder->getName()|sanitize}
-
diff --git a/templates/ktcore/folder/bulkUpload.smarty b/templates/ktcore/folder/bulkUpload.smarty
index 77721b4..a3d8066 100644
--- a/templates/ktcore/folder/bulkUpload.smarty
+++ b/templates/ktcore/folder/bulkUpload.smarty
@@ -50,7 +50,7 @@ addLoadEvent(startupMetadata);
get("ui/morphTo")}/title_bullet.png{else}{$rootUrl}/resources/graphics/title_bullet.png{/if}"/>{i18n}Upload files into{/i18n}: {$context->oFolder->getName()|sanitize}
-
-
+
diff --git a/templates/ktcore/folder/roles.smarty b/templates/ktcore/folder/roles.smarty
index f8459b5..2833c69 100644
--- a/templates/ktcore/folder/roles.smarty
+++ b/templates/ktcore/folder/roles.smarty
@@ -42,7 +42,7 @@ role allocations may take a some time, depending on the number of folders below
{i18n}Edit Users{/i18n}
{i18n}Edit Groups{/i18n}
{if !$is_root}
- {i18n}Use parent's allocation{/i18n}
{/if}
--
libgit2 0.21.4