Commit 31a5b682ffa8957ffac0886e758a5331b0a9dd83

Authored by Megan
1 parent 83646f1e

Adding initial Electronic Signature functionality. Covers the folder rename and …

…permissions actions and the DMS Admin section.
In Progress.

Committed by: Megan Watson
Reviewed by: Kevin Cyster
lib/security/Esignature.inc.php 0 → 100644
  1 +<?php
  2 +/**
  3 + * $Id$
  4 + *
  5 + * KnowledgeTree Community Edition
  6 + * Document Management Made Simple
  7 + * Copyright (C) 2008, 2009 KnowledgeTree Inc.
  8 + * Portions copyright The Jam Warehouse Software (Pty) Limited
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify it under
  11 + * the terms of the GNU General Public License version 3 as published by the
  12 + * Free Software Foundation.
  13 + *
  14 + * This program is distributed in the hope that it will be useful, but WITHOUT
  15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 + * details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  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,
  23 + * California 94120-7775, or email info@knowledgetree.com.
  24 + *
  25 + * The interactive user interfaces in modified source and object code versions
  26 + * of this program must display Appropriate Legal Notices, as required under
  27 + * Section 5 of the GNU General Public License version 3.
  28 + *
  29 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  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
  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
  34 + * copyright notice.
  35 + * Contributor( s): ______________________________________
  36 + *
  37 + */
  38 +
  39 +/**
  40 + * This class defines the electronic signatures
  41 + *
  42 + * @author KnowledgeTree Team
  43 + * @package Electronic Signatures
  44 + * @version Version 0.1
  45 + */
  46 +class ESignature
  47 +{
  48 + /**
  49 + * Check whether the electronic signature is enabled
  50 + *
  51 + * @access private
  52 + * @var bool
  53 + */
  54 + private $enabled;
  55 +
  56 + /**
  57 + * The number of failed logins on the current action
  58 + *
  59 + * @access private
  60 + * @var integer
  61 + */
  62 + private $attempts;
  63 +
  64 + /**
  65 + * Determines whether the user has been locked out of performing write actions.
  66 + * This lock will be reset upon logging out of the system.
  67 + *
  68 + * @access private
  69 + * @var bool
  70 + */
  71 + private $lock;
  72 +
  73 + /**
  74 + * Contains the error message if the authentication fails
  75 + *
  76 + * @access private
  77 + * @var string
  78 + */
  79 + private $error;
  80 +
  81 + /**
  82 + * The object associated with the action - folder_id | Document
  83 + *
  84 + * @access private
  85 + * @var folder_id | Document The Document object or the folder id
  86 + */
  87 + private $object = null;
  88 +
  89 + /**
  90 + * Creates the ESignature object
  91 + *
  92 + * @author KnowledgeTree Team
  93 + * @access public
  94 + */
  95 + public function __construct()
  96 + {
  97 + $config = KTConfig::getSingleton();
  98 + $this->enabled = $config->get('e_signatures/enableESignatures', false);
  99 +
  100 + $this->attempts = isset($_SESSION['esignature_attempts']) ? $_SESSION['esignature_attempts'] : 0;
  101 + $this->lock = (isset($_SESSION['esignature_lock']) && $_SESSION['esignature_lock'] == 'true') ? true : false;
  102 + }
  103 +
  104 + public function isEnabled()
  105 + {
  106 + if($this->enabled){
  107 + return true;
  108 + }
  109 + return false;
  110 + }
  111 +
  112 + public function isLocked()
  113 + {
  114 + return $this->lock;
  115 + }
  116 +
  117 + public function getLockMsg()
  118 + {
  119 + return _kt('System locked. You have exceeded the number of allowed authentication attempts and will not be allowed to perform any write actions during this session.');
  120 + }
  121 +
  122 + public function getError(){
  123 + return $this->error;
  124 + }
  125 +
  126 + public function setObject($object)
  127 + {
  128 + $this->object = $object;
  129 + }
  130 +
  131 + public function sign($username, $password, $comment, $action, $type = 'system', $details = null)
  132 + {
  133 + if(!$this->enabled){
  134 + return true;
  135 + }
  136 +
  137 + if($this->lock){
  138 + $this->error = $this->getLockMsg();
  139 + return false;
  140 + }
  141 +
  142 + switch ($type){
  143 + case 'document':
  144 + $comment = _kt('Document').': '.$details.' | '.$comment;
  145 + break;
  146 +
  147 + case 'folder':
  148 + $comment = _kt('Folder').': '.$details.' | '.$comment;
  149 + break;
  150 +
  151 + case 'system':
  152 + break;
  153 + }
  154 +
  155 + $this->error = _kt('Authentication failed. Please check your username and password and try again.');
  156 +
  157 + if(!$this->authenticate($username, $password)){
  158 + // failed attempt - increase count, if count = 3, log and lock
  159 + $this->attempts++;
  160 +
  161 + if($this->attempts >= 3){
  162 + $this->lock = true;
  163 + $_SESSION['esignature_lock'] = 'true';
  164 +
  165 + $comment = _kt('Electronic Signature - Failed Authentication: ') . $comment;
  166 + $this->logTransaction($action, $comment, $type, $details);
  167 +
  168 + $this->error = $this->getLockMsg();
  169 + }
  170 + $_SESSION['esignature_attempts'] = $this->attempts;
  171 +
  172 + return false;
  173 + }
  174 +
  175 + // set the number of attempts to 0
  176 + $this->attempts = 0;
  177 + $_SESSION['esignature_attempts'] = 0;
  178 + $this->error = '';
  179 +
  180 + // log successful transaction
  181 + $comment = _kt('Electronic Signature: ') . $comment;
  182 + $this->logTransaction($action, $comment, $type, $details);
  183 + return true;
  184 + }
  185 +
  186 + private function logTransaction($action, $comment)
  187 + {
  188 + $date = date('Y-m-d H:i:s');
  189 +
  190 + require_once(KT_LIB_DIR . '/users/userhistory.inc.php');
  191 + $params = array(
  192 + 'userid' => $_SESSION['userID'],
  193 + 'datetime' => $date,
  194 + 'actionnamespace' => $action,
  195 + 'comments' => $comment,
  196 + 'sessionid' => $_SESSION['sessionID'],
  197 + );
  198 + KTUserHistory::createFromArray($params);
  199 + }
  200 +
  201 + private function authenticate($username, $password)
  202 + {
  203 + // Get the user object
  204 + $oUser = User::getByUsername($username);
  205 + if(PEAR::isError($oUser) || $oUser == false){
  206 + return false;
  207 + }
  208 +
  209 + // check user is the same as the currently logged in user
  210 + if($oUser->iId != $_SESSION['userID']){
  211 + $this->error = _kt('Authentication failed. The username does not match the currently logged in user.');
  212 + return false;
  213 + }
  214 +
  215 + // authenticate
  216 + return KTAuthenticationUtil::checkPassword($oUser, $password);
  217 + }
  218 +
  219 +}
  220 +
  221 +?>
0 222 \ No newline at end of file
... ...
lib/templating/kt3template.inc.php
... ... @@ -133,6 +133,7 @@ class KTPage {
133 133 $aJS[] = 'thirdpartyjs/extjs/adapter/ext/ext-base.js';
134 134 $aJS[] = 'thirdpartyjs/extjs/ext-all.js';
135 135 $aJS[] = 'resources/js/search2widget.js';
  136 + $aJS[] = 'resources/js/signature.js';
136 137  
137 138 $this->requireJSResources($aJS);
138 139  
... ... @@ -153,11 +154,13 @@ class KTPage {
153 154 // FIXME: we lost the getDefaultAction stuff - do we care?
154 155 // note that key == action. this is _important_, since we crossmatch the breadcrumbs against this for "active"
155 156 $sBaseUrl = KTUtil::kt_url();
  157 + $heading = _kt('You are attempting to access DMS Administration');
156 158  
157 159 $this->menu = array();
158 160 $this->menu['dashboard'] = array('label' => _kt("Dashboard"), 'url' => $sBaseUrl.'/dashboard.php');
159 161 $this->menu['browse'] = array('label' => _kt("Browse Documents"), 'url' => $sBaseUrl.'/browse.php');
160   - $this->menu['administration'] = array('label' => _kt("DMS Administration"), 'url' => $sBaseUrl.'/admin.php');
  162 + $this->menu['administration'] = array('label' => _kt("DMS Administration"), 'url' => '#',
  163 + 'onclick' => "javascript: showSignatureForm('{$heading}', 'dms.administration.access', 'system', '{$sBaseUrl}/admin.php', 'redirect');"); //$sBaseUrl.'/admin.php',
161 164 }
162 165  
163 166  
... ...
plugins/ktcore/KTCorePlugin.php
... ... @@ -354,6 +354,10 @@ class KTCorePlugin extends KTPlugin {
354 354 _kt('Internationalization'), _kt('View and modify the default language.'),
355 355 'admin/configSettings.php', null);
356 356  
  357 + $this->registerAdminPage('securityconfigpage', 'SecurityConfigPageDispatcher', 'config',
  358 + _kt('Security'), _kt('View and modify the security settings.'),
  359 + 'admin/configSettings.php', null);
  360 +
357 361 // misc
358 362 $this->registerAdminPage('helpmanagement', 'ManageHelpDispatcher', 'misc',
359 363 _kt('Edit Help files'), _kt('Change the help files that are displayed to users.'),
... ...
plugins/ktcore/admin/configSettings.php
... ... @@ -339,4 +339,18 @@ class SearchAndIndexingConfigPageDispatcher extends BaseConfigDispatcher
339 339 return parent::check();
340 340 }
341 341 }
  342 +
  343 +class SecurityConfigPageDispatcher extends BaseConfigDispatcher
  344 +{
  345 + function check() {
  346 + $this->category = 'Security Settings';
  347 + $this->name = _kt('Security Settings');
  348 +
  349 + $this->aBreadcrumbs[] = array(
  350 + 'url' => $_SERVER['PHP_SELF'],
  351 + 'name' => _kt('Security Settings'),
  352 + );
  353 + return parent::check();
  354 + }
  355 +}
342 356 ?>
... ...
plugins/ktstandard/KTElectronicSignatures.php 0 → 100644
  1 +<?php
  2 +/**
  3 + * Electronic Signatures
  4 + *
  5 + * KnowledgeTree Community Edition
  6 + * Document Management Made Simple
  7 + * Copyright (C) 2008, 2009 KnowledgeTree Inc.
  8 + * Portions copyright The Jam Warehouse Software (Pty) Limited
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify it under
  11 + * the terms of the GNU General Public License version 3 as published by the
  12 + * Free Software Foundation.
  13 + *
  14 + * This program is distributed in the hope that it will be useful, but WITHOUT
  15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 + * details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  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,
  23 + * California 94120-7775, or email info@knowledgetree.com.
  24 + *
  25 + * The interactive user interfaces in modified source and object code versions
  26 + * of this program must display Appropriate Legal Notices, as required under
  27 + * Section 5 of the GNU General Public License version 3.
  28 + *
  29 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  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
  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
  34 + * copyright notice.
  35 + * Contributor( s): ______________________________________
  36 + *
  37 + */
  38 +
  39 +require_once('../../config/dmsDefaults.php');
  40 +require_once(KT_LIB_DIR . '/security/Esignature.inc.php');
  41 +
  42 +/**
  43 + * Class handles the electronic signatures
  44 + *
  45 + * @author KnowledgeTree Team
  46 + * @package Electronic Signatures
  47 + */
  48 +class KTElectronicSignatures
  49 +{
  50 + /**
  51 + * The error returned when attempting to authenticate
  52 + *
  53 + * @access private
  54 + * @var $error
  55 + */
  56 + private $error;
  57 +
  58 + /**
  59 + * If the system is locked for the session
  60 + *
  61 + * @access private
  62 + * @var bool
  63 + */
  64 + private $lock;
  65 +
  66 + /**
  67 + * If electronic signatures are enabled
  68 + *
  69 + * @access private
  70 + * @var bool
  71 + */
  72 + private $enabled;
  73 +
  74 + /**
  75 + * The ESignature object
  76 + *
  77 + * @access private
  78 + * @var ESignature object
  79 + */
  80 + private $eSignature;
  81 +
  82 + /**
  83 + * Constructor function for the class
  84 + *
  85 + * @author KnowledgeTree Team
  86 + * @access public
  87 + * @return KTElectronicSignatures
  88 + */
  89 + public function KTElectronicSignatures()
  90 + {
  91 + $this->eSignature = new ESignature();
  92 + $this->lock = $this->eSignature->isLocked();
  93 + $this->enabled = $this->eSignature->isEnabled();
  94 + }
  95 +
  96 + /**
  97 + * Returns the form requesting the signature
  98 + *
  99 + * @author KnowledgeTree Team
  100 + * @access public
  101 + * @return html
  102 + */
  103 + public function getSignatureForm($head)
  104 + {
  105 + $oTemplating =& KTTemplating::getSingleton();
  106 + $oTemplate = $oTemplating->loadTemplate('ktstandard/signatures/signature_form');
  107 + $aTemplateData = array(
  108 + 'head' => $head
  109 + );
  110 +
  111 + if(!$this->enabled){
  112 + return 'disabled';
  113 + }
  114 +
  115 + if($this->lock){
  116 + return $this->eSignature->getLockMsg();
  117 + }
  118 + return $oTemplate->render($aTemplateData);
  119 + }
  120 +
  121 + /**
  122 + * Attempts authentication of the signature
  123 + *
  124 + * @author KnowledgeTree Team
  125 + * @access public
  126 + * @param string $username The users username.
  127 + * @param string $password The users password.
  128 + * @param string $comment A comment on the action performed.
  129 + * @return bool True if authenticated | False if rejected
  130 + */
  131 + public function authenticateSignature($username, $password, $comment, $action, $type, $details)
  132 + {
  133 + $result = $this->eSignature->sign($username, $password, $comment, $action, $type, $details);
  134 + if(!$result){
  135 + $this->error = $this->eSignature->getError();
  136 + $this->lock = $this->eSignature->isLocked();
  137 + }
  138 + return $result;
  139 + }
  140 +
  141 + /**
  142 + * Returns the error from the attempted signature
  143 + *
  144 + * @author KnowledgeTree Team
  145 + * @access public
  146 + * @return string
  147 + */
  148 + public function getError()
  149 + {
  150 + return $this->error;
  151 + }
  152 +
  153 + /**
  154 + * Checks whether the electronic signature system is locked at which point authentication is not allowed.
  155 + *
  156 + * @author KnowledgeTree Team
  157 + * @access public
  158 + * @return bool
  159 + */
  160 + public function isLocked()
  161 + {
  162 + return $this->lock;
  163 + }
  164 +}
  165 +
  166 +$sign = new KTElectronicSignatures();
  167 +
  168 +// User has signed so authenticate the signature
  169 +if($_POST['action'] == 'submit'){
  170 + $user = $_POST['sign_username'];
  171 + $password = $_POST['sign_password'];
  172 + $comment = $_POST['sign_comment'];
  173 + $action = $_POST['sign_action'];
  174 + $type = $_POST['sign_type'];
  175 + $details = $_POST['sign_details'];
  176 +
  177 + if($sign->authenticateSignature($user, $password, $comment, $action, $type, $details)){
  178 + echo 'success';
  179 + exit;
  180 + }
  181 + echo $sign->getError();
  182 + if($sign->isLocked()){
  183 + exit;
  184 + }
  185 +}
  186 +
  187 +$head = $_POST['head'];
  188 +echo $sign->getSignatureForm($head);
  189 +
  190 +exit;
  191 +?>
0 192 \ No newline at end of file
... ...
resources/css/kt-framing.css
... ... @@ -2309,3 +2309,123 @@ body #content #add_dashlet
2309 2309 background: #FDFDFD;
2310 2310 padding: 2px;
2311 2311 }
  2312 +
  2313 +
  2314 +/* ================= Electronic signature popup - override ExtJS CSS ================= */
  2315 +
  2316 +#signature-panel {
  2317 + background: transparent;
  2318 +}
  2319 +
  2320 +#signature {
  2321 + background: transparent;
  2322 +}
  2323 +
  2324 +#sign_here {
  2325 + background: #FFF;
  2326 + color: #000;
  2327 + padding: 5px;
  2328 + padding-bottom: 10px;
  2329 +}
  2330 +
  2331 +#sign_here h2 {
  2332 + font-size: 110%;
  2333 + margin-bottom: 5px;
  2334 +}
  2335 +
  2336 +#sign_here .input_field {
  2337 + margin-bottom: 10px;
  2338 +}
  2339 +
  2340 +#sign_here .required {
  2341 + margin-left: 0.5em;
  2342 + padding-left: 10px;
  2343 + color: transparent;
  2344 + background: transparent url(../graphics/required.png) center left no-repeat;
  2345 +}
  2346 +
  2347 +#sign_here .descriptiveText {
  2348 + color: #666;
  2349 +}
  2350 +
  2351 +#sign_here #form_actions a {
  2352 + border: 1px solid #ccc;
  2353 + background: #fdfdfd;
  2354 + color: #333;
  2355 + font-weight: normal;
  2356 + padding: 2px;
  2357 + padding-right: 5px;
  2358 + text-decoration: none;
  2359 +}
  2360 +
  2361 +.x-window-tl .x-window-header {
  2362 + color: #FFF;
  2363 +}
  2364 +
  2365 +.x-window-tc {
  2366 + background: url(../graphics/portlet_bg.png) repeat-x 0 0;
  2367 + overflow:hidden;
  2368 + zoom:1;
  2369 +}
  2370 +
  2371 +.x-window-tl {
  2372 + background: url(../graphics/portlet_corner_topleft.png) no-repeat 0 0;
  2373 + padding-left:6px;
  2374 + zoom:1;
  2375 + z-index:1;
  2376 + position:relative;
  2377 +}
  2378 +
  2379 +.x-window-tr {
  2380 + background: url(../graphics/portlet_corner_topright_2.png) no-repeat right 0;
  2381 + padding-right:6px;
  2382 +}
  2383 +
  2384 +.x-window-bc {
  2385 + background: #FFF;
  2386 + zoom:1;
  2387 +}
  2388 +.x-window-bl {
  2389 + border-left:1px solid #AFAFAF;
  2390 + border-bottom:1px solid #AFAFAF;
  2391 + background: #FFF;
  2392 + padding-left:6px;
  2393 + zoom:1;
  2394 +}
  2395 +.x-window-br {
  2396 + border-right:1px solid #AFAFAF;
  2397 + background: #FFF;
  2398 + padding-right:6px;
  2399 + zoom:1;
  2400 +}
  2401 +
  2402 +.x-window-ml {
  2403 + border-left:1px solid #AFAFAF;
  2404 + background: #FFF;
  2405 + padding-left:6px;
  2406 + zoom:1;
  2407 +}
  2408 +.x-window-mr {
  2409 + border-right:1px solid #AFAFAF;
  2410 + background: #FFF;
  2411 + padding-right:6px;
  2412 + zoom:1;
  2413 +}
  2414 +
  2415 +.x-window-mc {
  2416 + border:1px solid #FFF;
  2417 + border-top:1px solid #FFF;
  2418 + padding:0;
  2419 + margin:0;
  2420 + font: normal 11px tahoma,arial,helvetica,sans-serif;
  2421 + background:#FFF;
  2422 +}
  2423 +
  2424 +.x-window-body {
  2425 + border-left:1px solid #FFF;
  2426 + border-top:1px solid #FFF;
  2427 + border-bottom:1px solid #FFF;
  2428 + border-right:1px solid #FFF;
  2429 + background: transparent;
  2430 + overflow: auto;
  2431 +}
... ...
resources/graphics/portlet_corner_topright_2.png 0 → 100644

975 Bytes

resources/js/signature.js 0 → 100644
  1 +var win;
  2 +var head;
  3 +var request;
  4 +var request_type;
  5 +var request_details;
  6 +
  7 +/*
  8 +* Create the electronic signature dialog
  9 +*/
  10 +var showSignatureForm = function(head, action, type, request, request_type, details){
  11 + createSignature();
  12 +
  13 + var sUrl = rootURL + '/plugins/ktstandard/KTElectronicSignatures.php';
  14 +
  15 + if(details === undefined) details = '';
  16 + if(request_type === undefined) request_type = 'submit';
  17 + if(type === undefined) type = 'system';
  18 +
  19 + this.head = head;
  20 + this.request = request;
  21 + this.request_type = request_type;
  22 + this.request_details = new Array();
  23 + this.request_details[0] = action;
  24 + this.request_details[1] = type;
  25 + this.request_details[2] = details;
  26 +
  27 + // create the window
  28 + this.win = new Ext.Window({
  29 + applyTo : 'signature',
  30 + layout : 'fit',
  31 + width : 360,
  32 + height : 265,
  33 + closeAction :'destroy',
  34 + y : 150,
  35 + shadow: false,
  36 + modal: true
  37 + });
  38 + this.win.show();
  39 +
  40 + var sUrl = rootURL + '/plugins/ktstandard/KTElectronicSignatures.php';
  41 + var info = document.getElementById('sign_here');
  42 +
  43 + Ext.Ajax.request({
  44 + url: sUrl,
  45 + success: function(response) {
  46 + if(response.responseText == 'disabled'){
  47 + // continue the action
  48 + if(this.request_type == 'redirect'){
  49 + window.location.href = this.request;
  50 + }else{
  51 + window.document.forms[this.request].submit();
  52 + }
  53 + }
  54 + info.innerHTML = response.responseText;
  55 + },
  56 + failure: function(response) {
  57 + alert('Error. Couldn\'t create signature form.');
  58 + },
  59 + params: {
  60 + head: head
  61 + }
  62 + });
  63 +}
  64 +
  65 +/*
  66 +* Create the html required to initialise the signature panel
  67 +*/
  68 +var createSignature = function() {
  69 +
  70 + if(document.getElementById('signature-panel')){
  71 + p = document.getElementById('signature-panel');
  72 + }else {
  73 + p = document.getElementById('pageBody').appendChild(document.createElement('div'));
  74 + p.id = 'signature-panel';
  75 + }
  76 +
  77 + inner = '<div id="signature" class="x-hidden"><div class="x-window-header">Electronic Signature</div><div class="x-window-body">';
  78 + inner = inner + '<div id="sign_here>Loading...</div></div></div>';
  79 + p.innerHTML = inner;
  80 +}
  81 +
  82 +/*
  83 +* Close the popup
  84 +*/
  85 +var panel_close = function() {
  86 + this.win.destroy();
  87 +}
  88 +
  89 +/*
  90 +* Submit the authentication form
  91 +*/
  92 +var submitForm = function() {
  93 +
  94 + var sUrl = rootURL + '/plugins/ktstandard/KTElectronicSignatures.php';
  95 + var info = document.getElementById('sign_here');
  96 + var user = document.getElementById('sign_username').value;
  97 + var pwd = document.getElementById('sign_password').value;
  98 + var comment = document.getElementById('sign_comment').value;
  99 +
  100 + Ext.Ajax.request({
  101 + url: sUrl,
  102 + success: function(response) {
  103 + if(response.responseText == 'success'){
  104 + // continue the action
  105 + if(this.request_type == 'redirect'){
  106 + window.location.href = this.request;
  107 + }else{
  108 + window.document.forms[this.request].submit();
  109 + }
  110 + }
  111 +
  112 + info.innerHTML = response.responseText;
  113 + },
  114 + failure: function(response) {
  115 + alert('Error. Couldn\'t create signature form.');
  116 + },
  117 + params: {
  118 + head: this.head,
  119 + action: 'submit',
  120 + sign_username: user,
  121 + sign_password: pwd,
  122 + sign_comment: comment,
  123 + sign_action: this.request_details[0],
  124 + sign_type: this.request_details[1],
  125 + sign_details: this.request_details[2]
  126 + }
  127 + });
  128 +}
0 129 \ No newline at end of file
... ...
sql/mysql/install/data.sql
... ... @@ -162,7 +162,8 @@ INSERT INTO `config_groups` VALUES
162 162 (21, 'user_prefs', 'User Preferences', 'Configures user preferences.', 'General Settings'),
163 163 (22, 'webservice', 'Web Services', 'KnowledgeTree Web Service Interface configuration. Note that a number of KnowledgeTree Tools rely on this service.', 'Client Tools Settings'),
164 164 (23, 'ldapAuthentication', 'LDAP Authentication', 'Configures LDAP Authentication', 'General Settings'),
165   -(24, 'server', 'Server Settings', 'Configuration settings for the server', 'General Settings');
  165 +(24, 'server', 'Server Settings', 'Configuration settings for the server', 'General Settings'),
  166 +(25, 'e_signatures', 'Electronic Signatures', 'Configuration settings for the electronic signatures', 'Security Settings');
166 167 /*!40000 ALTER TABLE `config_groups` ENABLE KEYS */;
167 168 UNLOCK TABLES;
168 169  
... ... @@ -286,7 +287,8 @@ INSERT INTO `config_settings` VALUES
286 287 (111, 'KnowledgeTree', 'Root Url', 'The path to the web application from the root of the web server. For example, if KT is at http://example.org/foo/, then the root directory should be \'/foo\'.', 'rootUrl', '', '', 'string', NULL, 1),
287 288 (112, 'urls', 'Var Directory', 'The path to the var directory.', 'varDirectory', 'default', '${fileSystemRoot}/var', 'string', NULL, 1),
288 289 (113, 'tweaks','Increment version on rename','Defines whether to update the version number if a document filename is changed/renamed.','incrementVersionOnRename','default','true','boolean',NULL,1),
289   -(114, 'ui', 'System URL', 'The system url, used in the main logo.', 'systemUrl', 'default', 'http://www.knowledgetree.com', 'string', '', 1);
  290 +(114, 'ui', 'System URL', 'The system url, used in the main logo.', 'systemUrl', 'default', 'http://www.knowledgetree.com', 'string', '', 1),
  291 +(115, 'e_signatures', 'Enable Electronic Signatures', 'Enables the electronic signature functionality on write actions.', 'enableESignatures', 'true', 'false', 'boolean', '', 1);
290 292 /*!40000 ALTER TABLE `config_settings` ENABLE KEYS */;
291 293 UNLOCK TABLES;
292 294  
... ...
sql/mysql/upgrade/3.5.5/config_signatures.sql 0 → 100644
  1 +INSERT INTO config_groups (name, display_name, description, category)
  2 +VALUES ('e_signatures', 'Electronic Signatures', 'Configuration settings for the electronic signatures', 'Security Settings');
  3 +
  4 +INSERT INTO config_settings (group_name, display_name, description, item, value, default_value, type, options, can_edit)
  5 +VALUES ('e_signatures', 'Enable Electronic Signatures', 'Enables the electronic signature functionality on write actions.', 'enableESignatures', 'true', 'false', 'boolean', '', 1);
0 6 \ No newline at end of file
... ...
templates/kt3/standard_page.smarty
... ... @@ -87,9 +87,9 @@
87 87 <!-- area menu -->
88 88 {foreach item=aMenuItem from=$page->menu}
89 89 {if ($aMenuItem.active == 1)}
90   - <li class="active"><a href="{$aMenuItem.url}">{$aMenuItem.label}</a></li>
  90 + <li class="active"><a href="{$aMenuItem.url}" onclick="{$aMenuItem.onclick}">{$aMenuItem.label}</a></li>
91 91 {else}
92   - <li><a href="{$aMenuItem.url}">{$aMenuItem.label}</a></li>
  92 + <li><a href="{$aMenuItem.url}" onclick="{$aMenuItem.onclick}">{$aMenuItem.label}</a></li>
93 93 {/if}
94 94 <li><div id="menu_divider"></div></li>
95 95 {/foreach}
... ...
templates/ktcore/folder/permissions.smarty
... ... @@ -29,7 +29,7 @@
29 29 {capture assign=sJavascript}initializePermissions('entities', '{addQS}fFolderId={$context->oFolder->getId()}&action=json&json_action=getEntities{/addQS}', {$jsonpermissions});{/capture}
30 30 {$context->oPage->requireJSStandalone($sJavascript)}
31 31  
32   -<form action="{$smarty.server.PHP_SELF}" method="POST">
  32 +<form name="update_permissions_form" action="{$smarty.server.PHP_SELF}" method="POST">
33 33 <div class="field">
34 34  
35 35 <p class="descriptiveText">{i18n}Select roles and groups for whom you wish to change permission assignment from the box on the left, and move them over to the box on the right using the button with right-pointing arrows. You can then allocate or remove permissions from these entities and save by pressing the 'Update Permission Assignments' button'.{/i18n}</p>
... ... @@ -84,7 +84,8 @@
84 84 <input type="hidden" name="action" value="update">
85 85 <input type="hidden" name="fFolderId" value="{$iFolderId}">
86 86 <div id="submitButtons" class="form_actions">
87   - <input type="submit" value="{i18n}Update Permission Assignments{/i18n}" />
  87 + <input type="button" value="{i18n}Update Permission Assignments{/i18n}"
  88 + onclick="javascript: showSignatureForm('{i18n}You are attempting to modify permissions{/i18n}', 'ktcore.transactions.permissions_change', 'folder', 'update_permissions_form', 'submit', {$iFolderId});" />
88 89 <input type="submit" name="kt_cancel[{addQS}fFolderId={$iFolderId}{/addQS}]" value="{i18n}Cancel{/i18n}" />
89 90 {/if}
90 91 </div>
... ...
templates/ktcore/folder/rename.smarty
... ... @@ -6,7 +6,7 @@ folder.{/i18n}&lt;/p&gt;
6 6 {assign var=iFolderId value=$context->oFolder->getId()}
7 7 {capture assign=link}{getUrlForFolder folder=$iFolderId}{/capture}
8 8  
9   -<form method="POST" action="{$smarty.server.PHP_SELF}">
  9 +<form name="rename_folder_form" id="rename_folder_form" method="POST" action="{$smarty.server.PHP_SELF}">
10 10 <fieldset><legend>{i18n}Rename Folder{/i18n}</legend>
11 11 <input type="hidden" name="action" value="rename" />
12 12 <input type="hidden" name="fFolderId" value="{$iFolderId}" />
... ... @@ -14,8 +14,14 @@ folder.{/i18n}&lt;/p&gt;
14 14 {$oWidget->render()}
15 15 {/foreach}
16 16 <div class="form_actions">
17   -<input type="submit" name="submit" value="{i18n}Rename{/i18n}" />
  17 +<input type="button" name="btn_submit" value="{i18n}Rename{/i18n}"
  18 + onclick="javascript: showSignatureForm('{i18n}You are attempting to rename a folder{/i18n}', 'ktcore.transactions.rename', 'folder', 'rename_folder_form', 'submit', {$iFolderId});" />
  19 +
18 20 <input type="submit" name="kt_cancel[{$link}]" value="{i18n}Cancel{/i18n}" />
19 21 </div>
20 22 </fieldset>
21 23 </form>
  24 +
  25 +
  26 +<!-- onclick="javascript: showSignatureForm('rename_folder_form');"
  27 +-->
... ...
templates/ktstandard/signatures/signature_form.smarty 0 → 100644
  1 +<h2><span class="ktActionLink ktDenied" />{$head}</h2>
  2 +
  3 +<p class="descriptiveText">This action requires re-authentication.</p>
  4 +<br />
  5 +
  6 +<form method="post">
  7 +<p class="input_field">
  8 +<label for="sign_username">Username</label><span class="required">required</span>
  9 +<br />
  10 +<input id="sign_username" />
  11 +</p>
  12 +
  13 +<p class="input_field">
  14 +<label for="sign_password">Password</label><span class="required">required</span>
  15 +<br />
  16 +<input id="sign_password" type="password" />
  17 +</p>
  18 +
  19 +<p class="input_field">
  20 +<label for="sign_comment">Comment</label><span class="required">required</span>
  21 +<br />
  22 +<input id="sign_comment" type="text" />
  23 +</p>
  24 +
  25 +<div id="form_actions">
  26 +
  27 +<a href="#" onclick="javascript: submitForm();">{i18n}OK{/i18n}</a>&nbsp;
  28 +<a href="#" onclick="javascript: panel_close();">{i18n}Cancel{/i18n}</a>
  29 +
  30 +</div>
  31 +</form>
0 32 \ No newline at end of file
... ...