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/plugins/pluginutil.inc.php b/lib/plugins/pluginutil.inc.php
index c73b638..2701be0 100644
--- a/lib/plugins/pluginutil.inc.php
+++ b/lib/plugins/pluginutil.inc.php
@@ -701,10 +701,10 @@ class KTPluginUtil {
if(PEAR::isError($oEntity)){
return $oEntity;
}
- $dir = dirname($oEntity->getPath()) . DIRECTORY_SEPARATOR;
+ $dir = dirname($oEntity->getPath()) . '/';
if(!$relative){
- $dir = KT_DIR . DIRECTORY_SEPARATOR . $dir;
+ $dir = KT_DIR . '/' . $dir;
}
return $dir;
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