Commit b369a58e43400660a575bb2b1a2413141d829a00
1 parent
0fff0b76
Updated Electronic Signature functionality. Moved it into a plugin.
In Progress. Committed by: Megan Watson Reviewed by: Kevin Cyster
Showing
12 changed files
with
25 additions
and
610 deletions
config/dmsDefaults.php
| ... | ... | @@ -623,6 +623,9 @@ 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 | + | |
| 626 | 629 | if ($checkup !== true) { |
| 627 | 630 | // Replace function later |
| 628 | 631 | /* ** Get the page being loaded and load the plugins specific to the page ** */ |
| ... | ... | @@ -652,7 +655,4 @@ if (!extension_loaded('mbstring')) |
| 652 | 655 | } |
| 653 | 656 | |
| 654 | 657 | |
| 655 | -require_once(KT_LIB_DIR . '/templating/kt3template.inc.php'); | |
| 656 | -$GLOBALS['main'] =new KTPage(); | |
| 657 | - | |
| 658 | -?> | |
| 658 | +?> | |
| 659 | 659 | \ No newline at end of file | ... | ... |
lib/security/Esignature.inc.php deleted
| 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 | -?> | |
| 222 | 0 | \ No newline at end of file |
lib/templating/kt3template.inc.php
| ... | ... | @@ -133,7 +133,6 @@ 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'; | |
| 137 | 136 | |
| 138 | 137 | $this->requireJSResources($aJS); |
| 139 | 138 | |
| ... | ... | @@ -162,9 +161,10 @@ class KTPage { |
| 162 | 161 | |
| 163 | 162 | global $default; |
| 164 | 163 | if($default->enableESignatures){ |
| 164 | + $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true); | |
| 165 | 165 | $heading = _kt('You are attempting to access DMS Administration'); |
| 166 | 166 | $this->menu['administration']['url'] = '#'; |
| 167 | - $this->menu['administration']['onclick'] = "javascript: showSignatureForm('{$heading}', 'dms.administration.access', 'system', '{$sBaseUrl}/admin.php', 'redirect');"; | |
| 167 | + $this->menu['administration']['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'dms.administration.accessing_administration', 'system', '{$sBaseUrl}/admin.php', 'redirect');"; | |
| 168 | 168 | }else{ |
| 169 | 169 | $this->menu['administration']['url'] = $sBaseUrl.'/admin.php'; |
| 170 | 170 | } | ... | ... |
plugins/ktcore/KTPermissions.php
| ... | ... | @@ -582,9 +582,10 @@ class KTRoleAllocationPlugin extends KTFolderAction { |
| 582 | 582 | // Include the electronic signature on the permissions action |
| 583 | 583 | global $default; |
| 584 | 584 | if($default->enableESignatures){ |
| 585 | + $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true); | |
| 585 | 586 | $heading = _kt('You are attempting to modify roles'); |
| 586 | 587 | $input['type'] = 'button'; |
| 587 | - $input['onclick'] = "javascript: showSignatureForm('{$heading}', 'ktcore.transactions.roles_modify_users', 'folder', 'userroleform', 'submit', {$iFolderId});"; | |
| 588 | + $input['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.roles_modify_users', 'folder', 'userroleform', 'submit', {$iFolderId});"; | |
| 588 | 589 | }else{ |
| 589 | 590 | $input['type'] = 'submit'; |
| 590 | 591 | $input['onclick'] = ''; |
| ... | ... | @@ -646,9 +647,10 @@ class KTRoleAllocationPlugin extends KTFolderAction { |
| 646 | 647 | // Include the electronic signature on the permissions action |
| 647 | 648 | global $default; |
| 648 | 649 | if($default->enableESignatures){ |
| 650 | + $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true); | |
| 649 | 651 | $heading = _kt('You are attempting to modify roles'); |
| 650 | 652 | $input['type'] = 'button'; |
| 651 | - $input['onclick'] = "javascript: showSignatureForm('{$heading}', 'ktcore.transactions.roles_modify_groups', 'folder', 'grouproleform', 'submit', {$iFolderId});"; | |
| 653 | + $input['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.roles_modify_groups', 'folder', 'grouproleform', 'submit', {$iFolderId});"; | |
| 652 | 654 | }else{ |
| 653 | 655 | $input['type'] = 'submit'; |
| 654 | 656 | $input['onclick'] = ''; | ... | ... |
plugins/ktcore/folder/Permissions.php
| ... | ... | @@ -319,9 +319,10 @@ class KTFolderPermissionsAction extends KTFolderAction { |
| 319 | 319 | |
| 320 | 320 | global $default; |
| 321 | 321 | if($default->enableESignatures){ |
| 322 | + $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true); | |
| 322 | 323 | $heading = _kt('You are attempting to modify permissions'); |
| 323 | 324 | $input['type'] = 'button'; |
| 324 | - $input['onclick'] = "javascript: showSignatureForm('{$heading}', 'ktcore.transactions.permissions_change', 'folder', 'update_permissions_form', 'submit', {$iFolderId});"; | |
| 325 | + $input['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.permissions_change', 'folder', 'update_permissions_form', 'submit', {$iFolderId});"; | |
| 325 | 326 | }else{ |
| 326 | 327 | $input['type'] = 'submit'; |
| 327 | 328 | $input['onclick'] = ''; | ... | ... |
plugins/ktcore/folder/Rename.php
| ... | ... | @@ -66,8 +66,9 @@ class KTFolderRenameAction extends KTFolderAction { |
| 66 | 66 | |
| 67 | 67 | global $default; |
| 68 | 68 | if($default->enableESignatures){ |
| 69 | + $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true); | |
| 69 | 70 | $heading = _kt('You are attempting to rename a folder'); |
| 70 | - $input['onclick'] = "javascript: showSignatureForm('{$heading}', 'ktcore.transactions.rename', 'folder', 'rename_folder_form', 'submit', {$this->oFolder->getId()});"; | |
| 71 | + $input['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.rename', 'folder', 'rename_folder_form', 'submit', {$this->oFolder->getId()});"; | |
| 71 | 72 | $input['type'] = 'button'; |
| 72 | 73 | }else{ |
| 73 | 74 | $input['onclick'] = ''; | ... | ... |
plugins/ktstandard/KTElectronicSignatures.php deleted
| 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 | - $this->error = $this->eSignature->getLockMsg(); | |
| 117 | - return $this->getError(); | |
| 118 | - } | |
| 119 | - return $oTemplate->render($aTemplateData); | |
| 120 | - } | |
| 121 | - | |
| 122 | - /** | |
| 123 | - * Attempts authentication of the signature | |
| 124 | - * | |
| 125 | - * @author KnowledgeTree Team | |
| 126 | - * @access public | |
| 127 | - * @param string $username The users username. | |
| 128 | - * @param string $password The users password. | |
| 129 | - * @param string $comment A comment on the action performed. | |
| 130 | - * @return bool True if authenticated | False if rejected | |
| 131 | - */ | |
| 132 | - public function authenticateSignature($username, $password, $comment, $action, $type, $details) | |
| 133 | - { | |
| 134 | - $result = $this->eSignature->sign($username, $password, $comment, $action, $type, $details); | |
| 135 | - if(!$result){ | |
| 136 | - $this->error = $this->eSignature->getError(); | |
| 137 | - $this->lock = $this->eSignature->isLocked(); | |
| 138 | - } | |
| 139 | - return $result; | |
| 140 | - } | |
| 141 | - | |
| 142 | - /** | |
| 143 | - * Returns the error from the attempted signature | |
| 144 | - * | |
| 145 | - * @author KnowledgeTree Team | |
| 146 | - * @access public | |
| 147 | - * @return string | |
| 148 | - */ | |
| 149 | - public function getError() | |
| 150 | - { | |
| 151 | - return '<div class="error">'.$this->error.'</div>'; | |
| 152 | - } | |
| 153 | - | |
| 154 | - /** | |
| 155 | - * Checks whether the electronic signature system is locked at which point authentication is not allowed. | |
| 156 | - * | |
| 157 | - * @author KnowledgeTree Team | |
| 158 | - * @access public | |
| 159 | - * @return bool | |
| 160 | - */ | |
| 161 | - public function isLocked() | |
| 162 | - { | |
| 163 | - return $this->lock; | |
| 164 | - } | |
| 165 | -} | |
| 166 | - | |
| 167 | -$sign = new KTElectronicSignatures(); | |
| 168 | - | |
| 169 | -// User has signed so authenticate the signature | |
| 170 | -if($_POST['action'] == 'submit'){ | |
| 171 | - $user = $_POST['sign_username']; | |
| 172 | - $password = $_POST['sign_password']; | |
| 173 | - $comment = $_POST['sign_comment']; | |
| 174 | - $action = $_POST['sign_action']; | |
| 175 | - $type = $_POST['sign_type']; | |
| 176 | - $details = $_POST['sign_details']; | |
| 177 | - | |
| 178 | - if($sign->authenticateSignature($user, $password, $comment, $action, $type, $details)){ | |
| 179 | - echo 'success'; | |
| 180 | - exit; | |
| 181 | - } | |
| 182 | - echo $sign->getError(); | |
| 183 | - if($sign->isLocked()){ | |
| 184 | - exit; | |
| 185 | - } | |
| 186 | -} | |
| 187 | - | |
| 188 | -$head = $_POST['head']; | |
| 189 | -echo $sign->getSignatureForm($head); | |
| 190 | - | |
| 191 | -exit; | |
| 192 | -?> | |
| 193 | 0 | \ No newline at end of file |
resources/css/kt-framing.css
| ... | ... | @@ -2311,44 +2311,36 @@ body #content #add_dashlet |
| 2311 | 2311 | } |
| 2312 | 2312 | |
| 2313 | 2313 | |
| 2314 | -/* ================= Electronic signature popup - override ExtJS CSS ================= */ | |
| 2314 | +/* ================= Ajax popup - override ExtJS CSS ================= */ | |
| 2315 | 2315 | |
| 2316 | -#signature-panel { | |
| 2317 | - background: transparent; | |
| 2318 | -} | |
| 2319 | - | |
| 2320 | -#signature { | |
| 2321 | - background: transparent; | |
| 2322 | -} | |
| 2323 | - | |
| 2324 | -#sign_here { | |
| 2316 | +#popup_content { | |
| 2325 | 2317 | background: #FFF; |
| 2326 | 2318 | color: #000; |
| 2327 | 2319 | padding: 5px; |
| 2328 | 2320 | padding-bottom: 10px; |
| 2329 | 2321 | } |
| 2330 | 2322 | |
| 2331 | -#sign_here h2 { | |
| 2323 | +#popup_content h2 { | |
| 2332 | 2324 | font-size: 110%; |
| 2333 | 2325 | margin-bottom: 5px; |
| 2334 | 2326 | } |
| 2335 | 2327 | |
| 2336 | -#sign_here .input_field { | |
| 2328 | +#popup_content .input_field { | |
| 2337 | 2329 | margin-bottom: 10px; |
| 2338 | 2330 | } |
| 2339 | 2331 | |
| 2340 | -#sign_here .required { | |
| 2332 | +#popup_content .required { | |
| 2341 | 2333 | margin-left: 0.5em; |
| 2342 | 2334 | padding-left: 10px; |
| 2343 | 2335 | color: transparent; |
| 2344 | 2336 | background: transparent url(../graphics/required.png) center left no-repeat; |
| 2345 | 2337 | } |
| 2346 | 2338 | |
| 2347 | -#sign_here .descriptiveText { | |
| 2339 | +#popup_content .descriptiveText { | |
| 2348 | 2340 | color: #666; |
| 2349 | 2341 | } |
| 2350 | 2342 | |
| 2351 | -#sign_here .form_actions a { | |
| 2343 | +#popup_content .form_actions a { | |
| 2352 | 2344 | border: 1px solid #ccc; |
| 2353 | 2345 | background: #fdfdfd; |
| 2354 | 2346 | color: #333; |
| ... | ... | @@ -2358,14 +2350,14 @@ body #content #add_dashlet |
| 2358 | 2350 | text-decoration: none; |
| 2359 | 2351 | } |
| 2360 | 2352 | |
| 2361 | -#sign_here .error { | |
| 2353 | +#popup_content .error { | |
| 2362 | 2354 | padding: 0.5em 1em; |
| 2363 | 2355 | border: 1px solid #ffc21e; |
| 2364 | 2356 | margin-bottom: 10px; |
| 2365 | 2357 | padding-left: 25px; |
| 2366 | 2358 | } |
| 2367 | 2359 | |
| 2368 | -#sign_here .error { | |
| 2360 | +#popup_content .error { | |
| 2369 | 2361 | background: #ffdd80 url(../../thirdparty/icon-theme/16x16/status/dialog-warning.gif) 2px center no-repeat; |
| 2370 | 2362 | } |
| 2371 | 2363 | ... | ... |
resources/js/signature.js deleted
| 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 : 310, | |
| 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 | - return; | |
| 54 | - } | |
| 55 | - info.innerHTML = response.responseText; | |
| 56 | - }, | |
| 57 | - failure: function(response) { | |
| 58 | - alert('Error. Couldn\'t create signature form.'); | |
| 59 | - }, | |
| 60 | - params: { | |
| 61 | - head: head | |
| 62 | - } | |
| 63 | - }); | |
| 64 | -} | |
| 65 | - | |
| 66 | -/* | |
| 67 | -* Create the html required to initialise the signature panel | |
| 68 | -*/ | |
| 69 | -var createSignature = function() { | |
| 70 | - | |
| 71 | - if(document.getElementById('signature-panel')){ | |
| 72 | - p = document.getElementById('signature-panel'); | |
| 73 | - }else { | |
| 74 | - p = document.getElementById('pageBody').appendChild(document.createElement('div')); | |
| 75 | - p.id = 'signature-panel'; | |
| 76 | - } | |
| 77 | - | |
| 78 | - inner = '<div id="signature" class="x-hidden"><div class="x-window-header">Electronic Signature</div><div class="x-window-body">'; | |
| 79 | - inner = inner + '<div id="sign_here>Loading...</div></div></div>'; | |
| 80 | - p.innerHTML = inner; | |
| 81 | -} | |
| 82 | - | |
| 83 | -/* | |
| 84 | -* Close the popup | |
| 85 | -*/ | |
| 86 | -var panel_close = function() { | |
| 87 | - this.win.destroy(); | |
| 88 | -} | |
| 89 | - | |
| 90 | -/* | |
| 91 | -* Submit the authentication form | |
| 92 | -*/ | |
| 93 | -var submitForm = function() { | |
| 94 | - | |
| 95 | - var sUrl = rootURL + '/plugins/ktstandard/KTElectronicSignatures.php'; | |
| 96 | - var info = document.getElementById('sign_here'); | |
| 97 | - var user = document.getElementById('sign_username').value; | |
| 98 | - var pwd = document.getElementById('sign_password').value; | |
| 99 | - var comment = document.getElementById('sign_comment').value; | |
| 100 | - | |
| 101 | - Ext.Ajax.request({ | |
| 102 | - url: sUrl, | |
| 103 | - success: function(response) { | |
| 104 | - if(response.responseText == 'success'){ | |
| 105 | - // continue the action | |
| 106 | - if(this.request_type == 'redirect'){ | |
| 107 | - window.location.href = this.request; | |
| 108 | - }else{ | |
| 109 | - window.document.forms[this.request].submit(); | |
| 110 | - } | |
| 111 | - return; | |
| 112 | - } | |
| 113 | - | |
| 114 | - info.innerHTML = response.responseText; | |
| 115 | - }, | |
| 116 | - failure: function(response) { | |
| 117 | - alert('Error. Couldn\'t create signature form.'); | |
| 118 | - }, | |
| 119 | - params: { | |
| 120 | - head: this.head, | |
| 121 | - action: 'submit', | |
| 122 | - sign_username: user, | |
| 123 | - sign_password: pwd, | |
| 124 | - sign_comment: comment, | |
| 125 | - sign_action: this.request_details[0], | |
| 126 | - sign_type: this.request_details[1], | |
| 127 | - sign_details: this.request_details[2] | |
| 128 | - } | |
| 129 | - }); | |
| 130 | -} | |
| 131 | 0 | \ No newline at end of file |
sql/mysql/install/data.sql
| ... | ... | @@ -162,8 +162,7 @@ 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'), | |
| 166 | -(25, 'e_signatures', 'Electronic Signatures', 'Configuration settings for the electronic signatures', 'Security Settings'); | |
| 165 | +(24, 'server', 'Server Settings', 'Configuration settings for the server', 'General Settings'); | |
| 167 | 166 | /*!40000 ALTER TABLE `config_groups` ENABLE KEYS */; |
| 168 | 167 | UNLOCK TABLES; |
| 169 | 168 | |
| ... | ... | @@ -287,8 +286,7 @@ INSERT INTO `config_settings` VALUES |
| 287 | 286 | (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), |
| 288 | 287 | (112, 'urls', 'Var Directory', 'The path to the var directory.', 'varDirectory', 'default', '${fileSystemRoot}/var', 'string', NULL, 1), |
| 289 | 288 | (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), |
| 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); | |
| 289 | +(114, 'ui', 'System URL', 'The system url, used in the main logo.', 'systemUrl', 'default', 'http://www.knowledgetree.com', 'string', '', 1); | |
| 292 | 290 | /*!40000 ALTER TABLE `config_settings` ENABLE KEYS */; |
| 293 | 291 | UNLOCK TABLES; |
| 294 | 292 | ... | ... |
sql/mysql/upgrade/3.5.5/config_signatures.sql deleted
| 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); | |
| 6 | 0 | \ No newline at end of file |
templates/ktstandard/signatures/signature_form.smarty deleted
| 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 class="form_actions"> | |
| 26 | - | |
| 27 | -<a href="#" onclick="javascript: submitForm();">{i18n}OK{/i18n}</a> | |
| 28 | -<a href="#" onclick="javascript: panel_close();">{i18n}Cancel{/i18n}</a> | |
| 29 | - | |
| 30 | -</div> | |
| 31 | -</form> | |
| 32 | 0 | \ No newline at end of file |