Commit e3ef4a07551d6cd94bd3e31dc820f1eb0205ead7

Authored by Kevin G Fourie
2 parents f92c4e2c 8832f4ae

Merge branch 'master' of git@github.com:ktgit/knowledgetree

admin.php
... ... @@ -155,7 +155,7 @@ if($default->enableAdminSignatures && $_SESSION['electronic_signature_time'] < t
155 155 $sBaseUrl = KTUtil::kt_url();
156 156 $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
157 157 $heading = _kt('You are attempting to access DMS Administration');
158   - $main->setBodyOnload("javascript: showSignatureForm('{$sUrl}', '{$heading}', 'dms.administration.accessing_administration', 'admin', '{$sBaseUrl}/browse.php', 'close');");
  158 + $main->setBodyOnload("javascript: showSignatureForm('{$sUrl}', '{$heading}', 'dms.administration.administration_section_access', 'admin', '{$sBaseUrl}/browse.php', 'close');");
159 159 }
160 160  
161 161  
... ...
config/dmsDefaults.php
... ... @@ -623,9 +623,6 @@ require_once(KT_LIB_DIR . '/session/control.inc');
623 623  
624 624 require_once(KT_LIB_DIR . '/plugins/pluginutil.inc.php');
625 625  
626   -require_once(KT_LIB_DIR . '/templating/kt3template.inc.php');
627   -$GLOBALS['main'] =new KTPage();
628   -
629 626 if ($checkup !== true) {
630 627 // Replace function later
631 628 /* ** Get the page being loaded and load the plugins specific to the page ** */
... ... @@ -654,5 +651,8 @@ if (!extension_loaded('mbstring'))
654 651 require_once(KT_LIB_DIR . '/mbstring.inc.php');
655 652 }
656 653  
  654 +require_once(KT_LIB_DIR . '/templating/kt3template.inc.php');
  655 +$GLOBALS['main'] =new KTPage();
  656 +
657 657  
658 658 ?>
659 659 \ No newline at end of file
... ...
lib/plugins/pluginutil.inc.php
... ... @@ -701,10 +701,10 @@ class KTPluginUtil {
701 701 if(PEAR::isError($oEntity)){
702 702 return $oEntity;
703 703 }
704   - $dir = dirname($oEntity->getPath()) . DIRECTORY_SEPARATOR;
  704 + $dir = dirname($oEntity->getPath()) . '/';
705 705  
706 706 if(!$relative){
707   - $dir = KT_DIR . DIRECTORY_SEPARATOR . $dir;
  707 + $dir = KT_DIR . '/' . $dir;
708 708 }
709 709  
710 710 return $dir;
... ...
lib/templating/kt3template.inc.php
... ... @@ -166,7 +166,7 @@ class KTPage {
166 166 $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
167 167 $heading = _kt('You are attempting to access DMS Administration');
168 168 $this->menu['administration']['url'] = '#';
169   - $this->menu['administration']['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'dms.administration.accessing_administration', 'admin', '{$sBaseUrl}/admin.php', 'redirect');";
  169 + $this->menu['administration']['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'dms.administration.administration_section_access', 'admin', '{$sBaseUrl}/admin.php', 'redirect');";
170 170 }else{
171 171 $this->menu['administration']['url'] = $sBaseUrl.'/admin.php';
172 172 }
... ... @@ -192,6 +192,14 @@ class KTPage {
192 192  
193 193 // list the distinct js resources.
194 194 function getJSResources() {
  195 + // get js resources specified within the plugins
  196 + // these need to be added to the session because KTPage is initialised after the plugins are loaded.
  197 + if(isset($GLOBALS['page_js_resources']) && !empty($GLOBALS['page_js_resources'])){
  198 + foreach($GLOBALS['page_js_resources'] as $js){
  199 + $this->js_resources[$js] = 1;
  200 + }
  201 + }
  202 +
195 203 return array_keys($this->js_resources);
196 204 }
197 205  
... ... @@ -381,9 +389,9 @@ class KTPage {
381 389 }
382 390  
383 391 $this->userMenu = array();
384   - if (!(PEAR::isError($this->user) || is_null($this->user) || $this->user->isAnonymous())) {
385   - $sBaseUrl = KTUtil::kt_url();
  392 + $sBaseUrl = KTUtil::kt_url();
386 393  
  394 + if (!(PEAR::isError($this->user) || is_null($this->user) || $this->user->isAnonymous())) {
387 395 if ($oConfig->get("user_prefs/restrictPreferences", false) && !Permission::userIsSystemAdministrator($this->user->getId())) {
388 396 $this->userMenu['logout'] = array('label' => _kt('Logout'), 'url' => $sBaseUrl.'/presentation/logout.php');
389 397 } else {
... ...
plugins/ktcore/KTBulkActions.php
... ... @@ -77,22 +77,53 @@ class KTBulkDeleteAction extends KTBulkAction {
77 77 'cancel_url' => $cancelUrl,
78 78 'context' => $this,
79 79 ));
80   - $oForm->setWidgets(array(
81   - array('ktcore.widgets.reason',array(
  80 +
  81 + // Electronic Signature if enabled
  82 + global $default;
  83 + if($default->enableESignatures){
  84 + $widgets[] = array('ktcore.widgets.info', array(
  85 + 'label' => _kt('This action requires authentication'),
  86 + 'description' => _kt('Please provide your user credentials as confirmation of this action.'),
  87 + 'name' => 'info'
  88 + ));
  89 + $widgets[] = array('ktcore.widgets.string', array(
  90 + 'label' => _kt('Username'),
  91 + 'name' => 'sign_username',
  92 + 'required' => true
  93 + ));
  94 + $widgets[] = array('ktcore.widgets.password', array(
  95 + 'label' => _kt('Password'),
  96 + 'name' => 'sign_password',
  97 + 'required' => true
  98 + ));
  99 + }
  100 +
  101 + $widgets[] = array('ktcore.widgets.reason',array(
82 102 'name' => 'reason',
83 103 'label' => _kt('Reason'),
84 104 'description' => _kt('The reason for the deletion of these documents and folders for historical purposes.'),
85 105 'value' => null,
86 106 'required' => true,
87   - )),
88   - ));
  107 + ));
89 108  
90   - $oForm->setValidators(array(
91   - array('ktcore.validators.string', array(
  109 + $oForm->setWidgets($widgets);
  110 +
  111 + $validators[] = array('ktcore.validators.string', array(
92 112 'test' => 'reason',
93 113 'output' => 'reason',
94   - )),
95   - ));
  114 + ));
  115 +
  116 + if($default->enableESignatures){
  117 + $validators[] = array('electonic.signatures.validators.authenticate', array(
  118 + 'object_id' => $this->oFolder->getID(),
  119 + 'type' => 'bulk',
  120 + 'action' => 'ktcore.transactions.bulk_delete',
  121 + 'test' => 'info',
  122 + 'output' => 'info'
  123 + ));
  124 + }
  125 +
  126 + $oForm->setValidators($validators);
96 127  
97 128 return $oForm;
98 129 }
... ... @@ -261,6 +292,28 @@ class KTBulkMoveAction extends KTBulkAction {
261 292  
262 293  
263 294 $oForm->addInitializedWidget($oWidget);
  295 +
  296 + // Electronic Signature if enabled
  297 + global $default;
  298 + if($default->enableESignatures){
  299 + $oForm->addWidget(array('ktcore.widgets.info', array(
  300 + 'label' => _kt('This action requires authentication'),
  301 + 'description' => _kt('Please provide your user credentials as confirmation of this action.'),
  302 + 'name' => 'info'
  303 + )));
  304 + $oForm->addWidget(array('ktcore.widgets.string', array(
  305 + 'label' => _kt('Username'),
  306 + 'name' => 'sign_username',
  307 + 'required' => true
  308 + )));
  309 + $oForm->addWidget(array('ktcore.widgets.password', array(
  310 + 'label' => _kt('Password'),
  311 + 'name' => 'sign_password',
  312 + 'required' => true
  313 + )));
  314 + }
  315 +
  316 +
264 317 $oForm->addWidget(
265 318 array('ktcore.widgets.reason',array(
266 319 'name' => 'reason',
... ... @@ -278,6 +331,17 @@ class KTBulkMoveAction extends KTBulkAction {
278 331 )),
279 332 ));
280 333  
  334 + if($default->enableESignatures){
  335 + $oForm->addValidator(array('electonic.signatures.validators.authenticate', array(
  336 + 'object_id' => $this->oFolder->getID(),
  337 + 'type' => 'bulk',
  338 + 'action' => 'ktcore.transactions.bulk_move',
  339 + 'test' => 'info',
  340 + 'output' => 'info'
  341 + )));
  342 + }
  343 +
  344 +
281 345 return $oForm;
282 346 }
283 347  
... ... @@ -414,9 +478,28 @@ class KTBulkCopyAction extends KTBulkAction {
414 478 'folder_id' => $this->oFolder->iId,
415 479 'collection' => $collection));
416 480  
  481 + $oForm->addInitializedWidget($oWidget);
417 482  
  483 + // Electronic Signature if enabled
  484 + global $default;
  485 + if($default->enableESignatures){
  486 + $oForm->addWidget(array('ktcore.widgets.info', array(
  487 + 'label' => _kt('This action requires authentication'),
  488 + 'description' => _kt('Please provide your user credentials as confirmation of this action.'),
  489 + 'name' => 'info'
  490 + )));
  491 + $oForm->addWidget(array('ktcore.widgets.string', array(
  492 + 'label' => _kt('Username'),
  493 + 'name' => 'sign_username',
  494 + 'required' => true
  495 + )));
  496 + $oForm->addWidget(array('ktcore.widgets.password', array(
  497 + 'label' => _kt('Password'),
  498 + 'name' => 'sign_password',
  499 + 'required' => true
  500 + )));
  501 + }
418 502  
419   - $oForm->addInitializedWidget($oWidget);
420 503 $oForm->addWidget(
421 504 array('ktcore.widgets.reason',array(
422 505 'name' => 'reason',
... ... @@ -434,6 +517,17 @@ class KTBulkCopyAction extends KTBulkAction {
434 517 )),
435 518 ));
436 519  
  520 + if($default->enableESignatures){
  521 + $oForm->addValidator(array('electonic.signatures.validators.authenticate', array(
  522 + 'object_id' => $this->oFolder->getID(),
  523 + 'type' => 'bulk',
  524 + 'action' => 'ktcore.transactions.bulk_copy',
  525 + 'test' => 'info',
  526 + 'output' => 'info'
  527 + )));
  528 + }
  529 +
  530 +
437 531 return $oForm;
438 532 }
439 533  
... ... @@ -517,6 +611,26 @@ class KTBulkArchiveAction extends KTBulkAction {
517 611 'context' => $this,
518 612 ));
519 613  
  614 + // Electronic Signature if enabled
  615 + global $default;
  616 + if($default->enableESignatures){
  617 + $oForm->addWidget(array('ktcore.widgets.info', array(
  618 + 'label' => _kt('This action requires authentication'),
  619 + 'description' => _kt('Please provide your user credentials as confirmation of this action.'),
  620 + 'name' => 'info'
  621 + )));
  622 + $oForm->addWidget(array('ktcore.widgets.string', array(
  623 + 'label' => _kt('Username'),
  624 + 'name' => 'sign_username',
  625 + 'required' => true
  626 + )));
  627 + $oForm->addWidget(array('ktcore.widgets.password', array(
  628 + 'label' => _kt('Password'),
  629 + 'name' => 'sign_password',
  630 + 'required' => true
  631 + )));
  632 + }
  633 +
520 634 $oForm->addWidget(
521 635 array('ktcore.widgets.reason',array(
522 636 'name' => 'reason',
... ... @@ -534,6 +648,17 @@ class KTBulkArchiveAction extends KTBulkAction {
534 648 )),
535 649 ));
536 650  
  651 + if($default->enableESignatures){
  652 + $oForm->addValidator(array('electonic.signatures.validators.authenticate', array(
  653 + 'object_id' => $this->oFolder->getID(),
  654 + 'type' => 'bulk',
  655 + 'action' => 'ktcore.transactions.bulk_archive',
  656 + 'test' => 'info',
  657 + 'output' => 'info'
  658 + )));
  659 + }
  660 +
  661 +
537 662 return $oForm;
538 663 }
539 664  
... ... @@ -777,7 +902,7 @@ class KTBrowseBulkExportAction extends KTBulkAction {
777 902 function kt_bulkexport_redirect() {
778 903 document.location.href = "%s";
779 904 }
780   - callLater(1, kt_bulkexport_redirect);
  905 + callLater(2, kt_bulkexport_redirect);
781 906  
782 907 </script>', $url);
783 908  
... ... @@ -967,21 +1092,41 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction {
967 1092 'context' => $this,
968 1093 ));
969 1094  
970   - $oForm-> setWidgets(array(
971   - array('ktcore.widgets.reason',array(
  1095 + // Electronic Signature if enabled
  1096 + global $default;
  1097 + if($default->enableESignatures){
  1098 + $widgets[] = array('ktcore.widgets.info', array(
  1099 + 'label' => _kt('This action requires authentication'),
  1100 + 'description' => _kt('Please provide your user credentials as confirmation of this action.'),
  1101 + 'name' => 'info'
  1102 + ));
  1103 + $widgets[] = array('ktcore.widgets.string', array(
  1104 + 'label' => _kt('Username'),
  1105 + 'name' => 'sign_username',
  1106 + 'required' => true
  1107 + ));
  1108 + $widgets[] = array('ktcore.widgets.password', array(
  1109 + 'label' => _kt('Password'),
  1110 + 'name' => 'sign_password',
  1111 + 'required' => true
  1112 + ));
  1113 + }
  1114 +
  1115 + $widgets[] = array('ktcore.widgets.reason',array(
972 1116 'name' => 'reason',
973 1117 'label' => _kt('Reason'),
974 1118 'description' => _kt('Please specify why you are checking out these documents. It will assist other users in understanding why you have locked these files.'),
975 1119 'value' => null,
976 1120 'required' => true,
977   - )),
978   - array('ktcore.widgets.boolean', array(
  1121 + ));
  1122 + $widgets[] = array('ktcore.widgets.boolean', array(
979 1123 'label' => _kt('Download Files'),
980 1124 'description' => _kt('Indicate whether you would like to download these file as part of the checkout.'),
981 1125 'name' => 'download_file',
982 1126 'value' => true,
983   - )),
984   - ));
  1127 + ));
  1128 +
  1129 + $oForm->setWidgets($widgets);
985 1130  
986 1131 $oForm->setValidators(array(
987 1132 array('ktcore.validators.string', array(
... ... @@ -995,6 +1140,17 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction {
995 1140 )),
996 1141 ));
997 1142  
  1143 + if($default->enableESignatures){
  1144 + $oForm->addValidator(array('electonic.signatures.validators.authenticate', array(
  1145 + 'object_id' => $this->oFolder->getID(),
  1146 + 'type' => 'bulk',
  1147 + 'action' => 'ktcore.transactions.bulk_check_out',
  1148 + 'test' => 'info',
  1149 + 'output' => 'info'
  1150 + )));
  1151 + }
  1152 +
  1153 +
998 1154 return $oForm;
999 1155 }
1000 1156  
... ...
plugins/ktcore/KTDocumentActions.php
... ... @@ -81,9 +81,9 @@ class KTDocumentTransactionHistoryAction extends KTDocumentAction {
81 81 $aTransactions = array();
82 82 // FIXME create a sane "view user information" page somewhere.
83 83 // FIXME do we really need to use a raw db-access here? probably...
84   - $sQuery = 'SELECT DTT.name AS transaction_name, U.name AS user_name, DT.version AS version, DT.comment AS comment, DT.datetime AS datetime ' .
  84 + $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 ' .
85 85 'FROM ' . KTUtil::getTableName('document_transactions') . ' AS DT INNER JOIN ' . KTUtil::getTableName('users') . ' AS U ON DT.user_id = U.id ' .
86   - 'INNER JOIN ' . KTUtil::getTableName('transaction_types') . ' AS DTT ON DTT.namespace = DT.transaction_namespace ' .
  86 + 'LEFT JOIN ' . KTUtil::getTableName('transaction_types') . ' AS DTT ON DTT.namespace = DT.transaction_namespace ' .
87 87 'WHERE DT.document_id = ? ORDER BY DT.datetime DESC';
88 88 $aParams = array($this->oDocument->getId());
89 89  
... ... @@ -95,6 +95,13 @@ class KTDocumentTransactionHistoryAction extends KTDocumentAction {
95 95  
96 96 $aTransactions = $res;
97 97  
  98 + // Set the namespaces where not in the transactions lookup
  99 + foreach($aTransactions as $key => $transaction){
  100 + if(empty($transaction['transaction_name'])){
  101 + $aTransactions[$key]['transaction_name'] = $this->_getActionNameForNamespace($transaction['transaction_namespace']);
  102 + }
  103 + }
  104 +
98 105  
99 106 // render pass.
100 107 $this->oPage->setTitle(_kt('Document History'));
... ... @@ -108,6 +115,15 @@ class KTDocumentTransactionHistoryAction extends KTDocumentAction {
108 115 );
109 116 return $oTemplate->render($aTemplateData);
110 117 }
  118 +
  119 + function _getActionNameForNamespace($sNamespace) {
  120 + $aNames = split('\.', $sNamespace);
  121 + $sName = array_pop($aNames);
  122 + $sName = str_replace('_', ' ', $sName);
  123 + $sName = ucwords($sName);
  124 + return $sName;
  125 + }
  126 +
111 127 }
112 128 // }}}
113 129  
... ...
plugins/ktcore/KTFolderActions.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 *
... ... @@ -50,7 +50,7 @@ require_once(KT_LIB_DIR . &#39;/plugins/pluginregistry.inc.php&#39;);
50 50  
51 51 require_once(KT_LIB_DIR . '/roles/Role.inc');
52 52  
53   -// {{{ KTDocumentDetailsAction
  53 +// {{{ KTDocumentDetailsAction
54 54 class KTFolderViewAction extends KTFolderAction {
55 55 var $sName = 'ktcore.actions.folder.view';
56 56  
... ... @@ -75,7 +75,7 @@ class KTFolderAddFolderAction extends KTFolderAction {
75 75 function getDisplayName() {
76 76 return _kt('Add a Folder');
77 77 }
78   -
  78 +
79 79  
80 80 function form_main() {
81 81 $oForm = new KTForm;
... ... @@ -89,8 +89,8 @@ class KTFolderAddFolderAction extends KTFolderAction {
89 89 'label' => _kt('Add a folder'),
90 90 'submit_label' => _kt('Add Folder'),
91 91 'extraargs' => $this->meldPersistQuery("","", true),
92   - ));
93   -
  92 + ));
  93 +
94 94 // widgets
95 95 $oForm->setWidgets(array(
96 96 array('ktcore.widgets.string', array(
... ... @@ -99,7 +99,32 @@ class KTFolderAddFolderAction extends KTFolderAction {
99 99 'required' => true,
100 100 'name' => 'name')),
101 101 ));
102   -
  102 +
  103 + // Electronic Signature if enabled
  104 + global $default;
  105 + if($default->enableESignatures){
  106 + $oForm->addWidget(array('ktcore.widgets.info', array(
  107 + 'label' => _kt('This action requires authentication'),
  108 + 'description' => _kt('Please provide your user credentials as confirmation of this action.'),
  109 + 'name' => 'info'
  110 + )));
  111 + $oForm->addWidget(array('ktcore.widgets.string', array(
  112 + 'label' => _kt('Username'),
  113 + 'name' => 'sign_username',
  114 + 'required' => true
  115 + )));
  116 + $oForm->addWidget(array('ktcore.widgets.password', array(
  117 + 'label' => _kt('Password'),
  118 + 'name' => 'sign_password',
  119 + 'required' => true
  120 + )));
  121 + $oForm->addWidget(array('ktcore.widgets.reason', array(
  122 + 'label' => _kt('Reason'),
  123 + '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 <strong>250</strong> characters.'),
  124 + 'name' => 'reason',
  125 + )));
  126 + }
  127 +
103 128 $oForm->setValidators(array(
104 129 array('ktcore.validators.string', array(
105 130 'test' => 'name',
... ... @@ -110,17 +135,27 @@ class KTFolderAddFolderAction extends KTFolderAction {
110 135 'output' => 'name',
111 136 )),
112 137 ));
113   -
  138 +
  139 + if($default->enableESignatures){
  140 + $oForm->addValidator(array('electonic.signatures.validators.authenticate', array(
  141 + 'object_id' => $this->oFolder->getId(),
  142 + 'type' => 'folder',
  143 + 'action' => 'ktcore.transactions.add_folder',
  144 + 'test' => 'info',
  145 + 'output' => 'info'
  146 + )));
  147 + }
  148 +
114 149 return $oForm;
115   -
116   - }
  150 +
  151 + }
117 152  
118 153 function do_main() {
119 154 $this->oPage->setBreadcrumbDetails(_kt("add folder"));
120 155 $oTemplate =& $this->oValidator->validateTemplate('ktcore/action/addFolder');
121 156  
122 157 $oForm = $this->form_main();
123   -
  158 +
124 159 $oTemplate->setData(array(
125 160 'context' => &$this,
126 161 'form' => $oForm,
... ... @@ -129,14 +164,14 @@ class KTFolderAddFolderAction extends KTFolderAction {
129 164 }
130 165  
131 166 function do_addFolder() {
132   -
  167 +
133 168 $oForm = $this->form_main();
134 169 $res = $oForm->validate();
135 170 if (!empty($res['errors'])) {
136 171 $oForm->handleError();
137 172 }
138 173 $res = $res['results'];
139   -
  174 +
140 175 if(KTFolderUtil::exists($this->oFolder, $res['name'])) {
141 176 $oForm->handleError(null, array('name' => _kt('A folder with that name already exists.')));
142 177 }
... ...
plugins/ktcore/KTPermissions.php
... ... @@ -363,6 +363,19 @@ class KTRoleAllocationPlugin extends KTFolderAction {
363 363  
364 364 // final step.
365 365  
  366 + // Include the electronic signature
  367 + global $default;
  368 + $iFolderId = $this->oFolder->getId() ;
  369 + if($default->enableESignatures){
  370 + $sign = true;
  371 + $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
  372 + $heading = _kt('You are attempting to modify roles');
  373 + $input_href = '#';
  374 + }else{
  375 + $sign = false;
  376 + $input_onclick = '';
  377 + }
  378 +
366 379 // map to users, groups.
367 380 foreach ($aRoles as $key => $role) {
368 381 $_users = array();
... ... @@ -390,6 +403,16 @@ class KTRoleAllocationPlugin extends KTFolderAction {
390 403 } else {
391 404 $aRoles[$key]['groups'] = join(', ',$_groups);
392 405 }
  406 +
  407 + if($sign){
  408 + $redirect_url = KTUtil::addQueryStringSelf("action=useParent&role_id={$key}&fFolderId={$iFolderId}");
  409 + $input_onclick = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.role_allocations_change', 'folder', '{$redirect_url}', 'redirect', {$iFolderId});";
  410 + }else{
  411 + $input_href = KTUtil::addQueryStringSelf("action=useParent&role_id={$key}&fFolderId={$iFolderId}");
  412 + }
  413 +
  414 + $aRoles[$key]['onclick'] =$input_onclick;
  415 + $aRoles[$key]['href'] =$input_href;
393 416 }
394 417  
395 418 $aTemplateData = array(
... ... @@ -585,7 +608,7 @@ class KTRoleAllocationPlugin extends KTFolderAction {
585 608 $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
586 609 $heading = _kt('You are attempting to modify roles');
587 610 $input['type'] = 'button';
588   - $input['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.roles_modify_users', 'folder', 'userroleform', 'submit', {$iFolderId});";
  611 + $input['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.role_allocations_change', 'folder', 'userroleform', 'submit', {$iFolderId});";
589 612 }else{
590 613 $input['type'] = 'submit';
591 614 $input['onclick'] = '';
... ... @@ -650,7 +673,7 @@ class KTRoleAllocationPlugin extends KTFolderAction {
650 673 $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
651 674 $heading = _kt('You are attempting to modify roles');
652 675 $input['type'] = 'button';
653   - $input['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.roles_modify_groups', 'folder', 'grouproleform', 'submit', {$iFolderId});";
  676 + $input['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.role_allocations_change', 'folder', 'grouproleform', 'submit', {$iFolderId});";
654 677 }else{
655 678 $input['type'] = 'submit';
656 679 $input['onclick'] = '';
... ...
plugins/ktcore/folder/BulkImport.php
... ... @@ -95,8 +95,22 @@ class KTBulkImportFolderAction extends KTFolderAction {
95 95 array_push($fieldsets, new $displayClass($oFieldset));
96 96 }
97 97  
  98 + // Implement an electronic signature for accessing the admin section, it will appear every 10 minutes
  99 + global $default;
  100 + $iFolderId = $this->oFolder->getId();
  101 + if($default->enableESignatures){
  102 + $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
  103 + $heading = _kt('You are attempting to perform a bulk import');
  104 + $submit['type'] = 'button';
  105 + $submit['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.bulk_import', 'bulk', 'bulk_import_form', 'submit', {$iFolderId});";
  106 + }else{
  107 + $submit['type'] = 'submit';
  108 + $submit['onclick'] = '';
  109 + }
  110 +
98 111 $oTemplate->setData(array(
99 112 'context' => &$this,
  113 + 'submit' => $submit,
100 114 'add_fields' => $add_fields,
101 115 'generic_fieldsets' => $fieldsets,
102 116 ));
... ...
plugins/ktcore/folder/BulkUpload.php
... ... @@ -96,8 +96,22 @@ class KTBulkUploadFolderAction extends KTFolderAction {
96 96 array_push($fieldsets, new $displayClass($oFieldset));
97 97 }
98 98  
  99 + // Implement an electronic signature for accessing the admin section, it will appear every 10 minutes
  100 + global $default;
  101 + $iFolderId = $this->oFolder->getId();
  102 + if($default->enableESignatures){
  103 + $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
  104 + $heading = _kt('You are attempting to perform a bulk upload');
  105 + $submit['type'] = 'button';
  106 + $submit['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.bulk_upload', 'bulk', 'bulk_upload_form', 'submit', {$iFolderId});";
  107 + }else{
  108 + $submit['type'] = 'submit';
  109 + $submit['onclick'] = '';
  110 + }
  111 +
99 112 $oTemplate->setData(array(
100 113 'context' => &$this,
  114 + 'submit' => $submit,
101 115 'add_fields' => $add_fields,
102 116 'generic_fieldsets' => $fieldsets,
103 117 ));
... ...
plugins/ktcore/folder/Transactions.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 *
... ... @@ -52,7 +52,7 @@ class KTFolderTransactionsAction extends KTFolderAction {
52 52 function getDisplayName() {
53 53 return _kt('Folder transactions');
54 54 }
55   -
  55 +
56 56 function do_main() {
57 57 $this->oPage->setBreadcrumbDetails(_kt("transactions"));
58 58 $this->oPage->setTitle(_kt('Folder transactions'));
... ... @@ -64,7 +64,7 @@ class KTFolderTransactionsAction extends KTFolderAction {
64 64  
65 65 $aTransactions = array();
66 66 // FIXME do we really need to use a raw db-access here? probably...
67   - $sQuery = "SELECT DTT.name AS transaction_name, U.name AS user_name, FT.comment AS comment, FT.datetime AS datetime " .
  67 + $sQuery = "SELECT DTT.name AS transaction_name, FT.transaction_namespace, U.name AS user_name, FT.comment AS comment, FT.datetime AS datetime " .
68 68 "FROM " . KTUtil::getTableName("folder_transactions") . " AS FT LEFT JOIN " . KTUtil::getTableName("users") . " AS U ON FT.user_id = U.id " .
69 69 "LEFT JOIN " . KTUtil::getTableName("transaction_types") . " AS DTT ON DTT.namespace = FT.transaction_namespace " .
70 70 "WHERE FT.folder_id = ? ORDER BY FT.datetime DESC";
... ... @@ -78,6 +78,13 @@ class KTFolderTransactionsAction extends KTFolderAction {
78 78 // FIXME roll up view transactions
79 79 $aTransactions = $res;
80 80  
  81 + // Set the namespaces where not in the transactions lookup
  82 + foreach($aTransactions as $key => $transaction){
  83 + if(empty($transaction['transaction_name'])){
  84 + $aTransactions[$key]['transaction_name'] = $this->_getActionNameForNamespace($transaction['transaction_namespace']);
  85 + }
  86 + }
  87 +
81 88 // render pass.
82 89 $this->oPage->title = _kt("Folder History");
83 90 $oTemplating =& KTTemplating::getSingleton();
... ... @@ -91,6 +98,14 @@ class KTFolderTransactionsAction extends KTFolderAction {
91 98 return $oTemplate->render($aTemplateData);
92 99 }
93 100  
  101 + function _getActionNameForNamespace($sNamespace) {
  102 + $aNames = split('\.', $sNamespace);
  103 + $sName = array_pop($aNames);
  104 + $sName = str_replace('_', ' ', $sName);
  105 + $sName = ucwords($sName);
  106 + return $sName;
  107 + }
  108 +
94 109  
95 110 }
96 111  
... ...
plugins/ktcore/folder/addDocument.php
... ... @@ -94,7 +94,7 @@ class KTFolderAddDocumentAction extends KTFolderAction {
94 94 'file_upload' => true,
95 95 ));
96 96  
97   - $aTypes;
  97 + $aTypes = array();
98 98 foreach (DocumentType::getListForUserAndFolder($this->oUser, $this->oFolder) as $oDocumentType) {
99 99 if(!$oDocumentType->getDisabled()) {
100 100 $aTypes[] = $oDocumentType;
... ... @@ -149,6 +149,31 @@ class KTFolderAddDocumentAction extends KTFolderAction {
149 149 )),
150 150 ));
151 151  
  152 + // Electronic Signature if enabled
  153 + global $default;
  154 + if($default->enableESignatures){
  155 + $oForm->addWidget(array('ktcore.widgets.info', array(
  156 + 'label' => _kt('This action requires authentication'),
  157 + 'description' => _kt('Please provide your user credentials as confirmation of this action.'),
  158 + 'name' => 'info'
  159 + )));
  160 + $oForm->addWidget(array('ktcore.widgets.string', array(
  161 + 'label' => _kt('Username'),
  162 + 'name' => 'sign_username',
  163 + 'required' => true
  164 + )));
  165 + $oForm->addWidget(array('ktcore.widgets.password', array(
  166 + 'label' => _kt('Password'),
  167 + 'name' => 'sign_password',
  168 + 'required' => true
  169 + )));
  170 + $oForm->addWidget(array('ktcore.widgets.reason', array(
  171 + 'label' => _kt('Reason'),
  172 + '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 <strong>250</strong> characters.'),
  173 + 'name' => 'reason',
  174 + )));
  175 + }
  176 +
152 177 $oForm->setValidators(array(
153 178 array('ktcore.validators.file', array(
154 179 'test' => 'file',
... ... @@ -170,6 +195,16 @@ class KTFolderAddDocumentAction extends KTFolderAction {
170 195 )),
171 196 ));
172 197  
  198 + if($default->enableESignatures){
  199 + $oForm->addValidator(array('electonic.signatures.validators.authenticate', array(
  200 + 'object_id' => $this->oFolder->getId(),
  201 + 'type' => 'folder',
  202 + 'action' => 'ktcore.transactions.add_document',
  203 + 'test' => 'info',
  204 + 'output' => 'info'
  205 + )));
  206 + }
  207 +
173 208 return $oForm;
174 209 }
175 210  
... ...
templates/ktcore/folder/bulkImport.smarty
... ... @@ -50,7 +50,7 @@ addLoadEvent(startupMetadata);
50 50  
51 51 <h2><img src="{if $config->get("ui/morphEnabled") == '1'}{$rootUrl}/skins/kts_{$config->get("ui/morphTo")}/title_bullet.png{else}{$rootUrl}/resources/graphics/title_bullet.png{/if}"/>{i18n}Import files into{/i18n}:<br />{$context->oFolder->getName()|sanitize}</h2>
52 52  
53   -<form method="POST" action="{$smarty.server.PHP_SELF}" enctype="multipart/form-data">
  53 +<form method="POST" action="{$smarty.server.PHP_SELF}" enctype="multipart/form-data" name="bulk_import_form">
54 54 <fieldset><legend>{i18n}Import from Server Location{/i18n}</legend>
55 55 <p class="descriptiveText">{i18n}The bulk import facility allows for a number
56 56 of documents to be added to the document management system easily.
... ... @@ -72,7 +72,7 @@ you to set metadata on all imported documents. If there is no metadata
72 72 associated, or you do not wish to modify it, you can simply click
73 73 "Add" here to finish the process and import the documents.{/i18n}</p>
74 74  
75   -<input type="submit" name="submit" value="{i18n}Add{/i18n}" />
  75 +<input type="{$submit.type}" onclick="{$submit.onclick}" name="btn_submit" value="{i18n}Add{/i18n}" />
76 76  
77 77 <hr />
78 78  
... ... @@ -88,6 +88,6 @@ associated, or you do not wish to modify it, you can simply click
88 88 </div>
89 89  
90 90 <div class="form_actions">
91   - <input type="submit" name="submit" value="{i18n}Import{/i18n}">
  91 + <input type="{$submit.type}" onclick="{$submit.onclick}" name="btn_submit" value="{i18n}Import{/i18n}">
92 92 </div>
93 93 </form>
... ...
templates/ktcore/folder/bulkUpload.smarty
... ... @@ -50,7 +50,7 @@ addLoadEvent(startupMetadata);
50 50  
51 51 <h2><img src="{if $config->get("ui/morphEnabled") == '1'}{$rootUrl}/skins/kts_{$config->get("ui/morphTo")}/title_bullet.png{else}{$rootUrl}/resources/graphics/title_bullet.png{/if}"/>{i18n}Upload files into{/i18n}:<br />{$context->oFolder->getName()|sanitize}</h2>
52 52  
53   -<form method="POST" action="{$smarty.server.PHP_SELF|addQueryString:"postExpected=1&fFolderId="}{$context->oFolder->getId()}" enctype="multipart/form-data">
  53 +<form method="POST" action="{$smarty.server.PHP_SELF|addQueryString:"postExpected=1&fFolderId="}{$context->oFolder->getId()}" enctype="multipart/form-data" name="bulk_upload_form">
54 54 <fieldset><legend>{i18n}Bulk upload{/i18n}</legend>
55 55 <p class="descriptiveText">{i18n}The bulk upload facility allows for a number
56 56 of documents to be added to the document management system.
... ... @@ -69,7 +69,7 @@ management system.{/i18n}&lt;/p&gt;
69 69 <p class="descriptiveText">{i18n}If you do not need to modify any the metadata
70 70 for this document (see below), then you can simply click "Add" here to finish the
71 71 process and add the document.{/i18n}</p>
72   -<input type="submit" name="submit" value="{i18n}Add{/i18n}" />
  72 +<input type="{$submit.type}" onclick="{$submit.onclick}" name="btn_submit" value="{i18n}Add{/i18n}" />
73 73  
74 74 <hr />
75 75  
... ... @@ -85,7 +85,7 @@ process and add the document.{/i18n}&lt;/p&gt;
85 85 </div>
86 86  
87 87 <div class="form_actions">
88   - <input type="submit" name="submit" value="{i18n}Upload{/i18n}" />
  88 + <input type="{$submit.type}" onclick="{$submit.onclick}" name="btn_submit" value="{i18n}Upload{/i18n}" />
89 89 </div>
90 90 <input type="hidden" name="postReceived" value="1" />
91 91 </form>
... ...
templates/ktcore/folder/roles.smarty
... ... @@ -42,7 +42,7 @@ role allocations may take a some time, depending on the number of folders below
42 42 <td class="centered"><a href="{addQS}action=editRoleUsers&alloc_id={$aRole.allocation_id}&fFolderId={$context->oFolder->getId()}&role_id={$role_id}{/addQS}" class="ktAction ktEdit" title="{i18n}Edit Users{/i18n}">{i18n}Edit Users{/i18n}</a></td>
43 43 <td class="centered"><a href="{addQS}action=editRoleGroups&alloc_id={$aRole.allocation_id}&fFolderId={$context->oFolder->getId()}&role_id={$role_id}{/addQS}" class="ktAction ktEdit" title="{i18n}Edit Groups{/i18n}">{i18n}Edit Groups{/i18n}</a></td>
44 44 {if !$is_root}
45   - <td class="centered"><a href="{addQS}action=useParent&role_id={$role_id}&fFolderId={$context->oFolder->getId()}{/addQS}" class="ktAction ktDelete"
  45 + <td class="centered"><a href="{$aRole.href}" onclick="{$aRole.onclick}" class="ktAction ktDelete"
46 46 kt:deleteMessage="{i18n}Are you sure you wish to remove this role allocation?{/i18n}"
47 47 title="{i18n}Use parent's allocation{/i18n}">{i18n}Use parent's allocation{/i18n}</a></td>
48 48 {/if}
... ...