diff --git a/lib/dashboard/Notification.inc.php b/lib/dashboard/Notification.inc.php
index 0b8a176..3bade91 100644
--- a/lib/dashboard/Notification.inc.php
+++ b/lib/dashboard/Notification.inc.php
@@ -5,32 +5,32 @@
* KnowledgeTree Open Source Edition
* Document Management Made Simple
* Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
- *
+ *
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
* Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
- *
+ *
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
- *
+ *
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
- * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
- * must display the words "Powered by KnowledgeTree" and retain the original
- * copyright notice.
+ * must display the words "Powered by KnowledgeTree" and retain the original
+ * copyright notice.
* Contributor( s): ______________________________________
*
*/
@@ -58,7 +58,7 @@ class KTNotification extends KTEntity {
/** primary key value */
var $iId = -1;
var $iUserId;
-
+
// sType and sLabel provide the title of the dashboard alert.
var $sLabel; // a simple label - e.g. the document's title, or so forth.
var $sType; // namespaced item type. (e.g. ktcore/subscriptions, word/officeupload)
@@ -73,34 +73,34 @@ class KTNotification extends KTEntity {
var $iData2;
// sData1 and sData2 are 255-length character fields
var $sData1;
- var $sData2;
+ var $sData2;
// sText1 is a 65535-length text field
- var $sText1;
-
+ var $sText1;
+
var $_bUsePearError = true;
-
+
function getId() { return $this->iId; }
-
- function getLabel() { return $this->sLabel; }
+
+ function getLabel() { return $this->sLabel; }
function setLabel($sLabel) { $this->sLabel = $sLabel; }
- function getType() { return $this->sType; }
+ function getType() { return $this->sType; }
function setType($sType) { $this->sType = $sType; }
-
- function getIntData1() { return $this->iData1; }
+
+ function getIntData1() { return $this->iData1; }
function setIntData1($iData1) { $this->iData1 = $iData1; }
- function getIntData2() { return $this->iData2; }
+ function getIntData2() { return $this->iData2; }
function setIntData2($iData2) { $this->iData2 = $iData2; }
- function getStrData1() { return $this->sData1; }
+ function getStrData1() { return $this->sData1; }
function setStrData1($sData1) { $this->sData1 = $sData1; }
- function getStrData2() { return $this->sData2; }
- function setStrData2($sData2) { $this->sData2 = $sData2; }
- function getTextData1() { return $this->sText1; }
- function setTextData1($mValue) { $this->sText1 = $mValue; }
+ function getStrData2() { return $this->sData2; }
+ function setStrData2($sData2) { $this->sData2 = $sData2; }
+ function getTextData1() { return $this->sText1; }
+ function setTextData1($mValue) { $this->sText1 = $mValue; }
var $_aFieldToSelect = array(
"iId" => "id",
"iUserId" => "user_id",
- "sLabel" => "label",
+ "sLabel" => "label",
"sType" => "type",
"dCreationDate" => "creation_date",
"iData1" => "data_int_1",
@@ -109,7 +109,7 @@ class KTNotification extends KTEntity {
"sData2" => "data_str_2",
"sText1" => "data_text_1",
);
-
+
function _table () {
return KTUtil::getTableName('notifications');
}
@@ -118,11 +118,11 @@ class KTNotification extends KTEntity {
$notificationRegistry =& KTNotificationRegistry::getSingleton();
$handler = $notificationRegistry->getHandler($this->sType);
- if (is_null($handler)) { return null; }
-
+ if (is_null($handler)) { return null; }
+
return $handler->handleNotification($this);
}
-
+
function &getHandler() {
$notificationRegistry =& KTNotificationRegistry::getSingleton();
$handler =& $notificationRegistry->getHandler($this->sType);
@@ -131,10 +131,10 @@ class KTNotification extends KTEntity {
// Static function
function &get($iId) { return KTEntityUtil::get('KTNotification', $iId); }
- function &getList($sWhereClause = null, $aOptions = null ) {
+ function &getList($sWhereClause = null, $aOptions = null ) {
if(!is_array($aOptions)) $aOptions = array($aOptions);
$aOptions['orderby'] = KTUtil::arrayGet($aOptions, 'orderby', 'creation_date DESC');
- return KTEntityUtil::getList2('KTNotification', $sWhereClause, $aOptions);
+ return KTEntityUtil::getList2('KTNotification', $sWhereClause, $aOptions);
}
function &createFromArray($aOptions) { return KTEntityUtil::createFromArray('KTNotification', $aOptions); }
@@ -151,14 +151,15 @@ class KTNotificationHandler extends KTStandardDispatcher {
function handleNotification($oKTNotification) {
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate("kt3/notifications/generic");
- $aTemplateData = array("context" => $oKTNotification,);
+
+ $aTemplateData = array("context" => $oKTNotification, "oKTConfig" => $oKTConfig);
return $oTemplate->render($aTemplateData);
}
function do_main() {
$this->resolveNotification($this->notification);
}
-
+
// called to resolve the notification (typically from /notify.php?id=xxxxx
function resolveNotification($oKTNotification) {
$_SESSION['KTErrorMessage'][] = _kt("This notification handler does not support publication.");
@@ -172,10 +173,10 @@ class KTSubscriptionNotification extends KTNotificationHandler {
/* Subscription Notifications
*
* Subscriptions are a large part of the notification volume.
- * That said, notifications cater to a larger group, so there is some
+ * That said, notifications cater to a larger group, so there is some
* degree of mismatch between the two.
*
- * Mapping the needs of subscriptions onto the provisions of notifications
+ * Mapping the needs of subscriptions onto the provisions of notifications
* works as:
*
* $oKTN->label: object name [e.g. Document Name]
@@ -183,9 +184,9 @@ class KTSubscriptionNotification extends KTNotificationHandler {
* $oKTN->strData2: _location_ name. (e.g. folder of the subscription.)
* $oKTN->intData1: object id (e.g. document_id, folder_id)
* $oKTN->intData2: actor id (e.g. user_id)
- *
+ *
*/
-
+
var $notificationType = 'ktcore/subscriptions';
var $_eventObjectMap = array(
@@ -202,7 +203,7 @@ class KTSubscriptionNotification extends KTNotificationHandler {
"ArchivedDocument" => 'document', // can go through and request un-archival (?)
"RestoredArchivedDocument" => 'document',
"DiscussDocument" => 'document',
- );
+ );
function KTSubscriptionNotification() {
$this->_eventTypeNames = array(
@@ -218,7 +219,7 @@ class KTSubscriptionNotification extends KTNotificationHandler {
"MovedDocument" => _kt('Document moved'),
"ArchivedDocument" => _kt('Document archived'), // can go through and request un-archival (?)
"RestoredArchivedDocument" => _kt('Document restored'),
- "DiscussDocument" => _kt('Document Discussions updated'),
+ "DiscussDocument" => _kt('Document Discussions updated'),
);
//parent::KTNotificationHandler();
}
@@ -233,9 +234,9 @@ class KTSubscriptionNotification extends KTNotificationHandler {
'has_actor' => false,
'notify_id' => $oKTNotification->getId(),
);
-
+
$info['title'] = KTUtil::arrayGet($this->_eventTypeNames, $info['event_type'], 'Subscription alert:') .': ' . $info['object_name'];
-
+
if ($info['actor_id'] !== null) {
$oTempUser = User::get($info['actor_id']);
if (PEAR::isError($oTempUser) || ($oTempUser == false)) {
@@ -246,31 +247,31 @@ class KTSubscriptionNotification extends KTNotificationHandler {
$info['has_actor'] = true;
}
}
-
+
if ($info['object_id'] !== null) {
$info['object'] = $this->_getEventObject($info['event_type'], $info['object_id']);
}
-
+
return $info;
}
-
+
// resolve the object type based on the alert type.
function _getEventObject($sAlertType, $id) {
$t = KTUtil::arrayGet($this->_eventObjectMap, $sAlertType ,'');
-
+
if ($t == 'document') {
$o = Document::get($id);
- if (PEAR::isError($o) || ($o == false)) { return null;
+ if (PEAR::isError($o) || ($o == false)) { return null;
} else { return $o; }
} else if ($t == 'folder') {
$o = Folder::get($id);
- if (PEAR::isError($o) || ($o == false)) { return null;
+ if (PEAR::isError($o) || ($o == false)) { return null;
} else { return $o; }
} else {
return null;
}
}
-
+
function _getEventObjectType($sAlertType) {
return KTUtil::arrayGet($this->_eventObjectMap, $sAlertType ,'');
}
@@ -286,21 +287,21 @@ class KTSubscriptionNotification extends KTNotificationHandler {
/*
"iId" => "id",
"iUserId" => "user_id",
- "sLabel" => "label",
+ "sLabel" => "label",
"sType" => "type",
"dCreationDate" => "creation_date",
"iData1" => "data_int_1",
"iData2" => "data_int_2",
"sData1" => "data_str_1",
"sData2" => "data_str_2",
-
+
'object_name' => $oKTNotification->getLabel(),
'event_type' => $oKTNotification->getStrData1(),
'location_name' => $oKTNotification->getStrData2(),
'object_id' => $oKTNotification->getIntData1(),
'actor_id' => $oKTNotification->getIntData2(),
- 'has_actor' => false,
-
+ 'has_actor' => false,
+
*/
$creationInfo['sLabel'] = $aOptions['target_name'];
$creationInfo['sData1'] = $aOptions['event_type'];
@@ -312,20 +313,23 @@ class KTSubscriptionNotification extends KTNotificationHandler {
$creationInfo['dCreationDate'] = getCurrentDateTime(); // erk.
global $default;
-
+
//$default->log->debug('subscription notification: from ' . print_r($aOptions, true));
$default->log->debug('subscription notification: using ' . print_r($creationInfo, true));
-
+
$oNotification =& KTNotification::createFromArray($creationInfo);
-
-
+
+
$default->log->debug('subscription notification: created ' . print_r($oNotification, true));
-
+
return $oNotification; // $res.
}
-
-
-
+
+ /**
+ * View the notification, and clear if requested
+ *
+ * @param unknown_type $oKTNotification
+ */
function resolveNotification($oKTNotification) {
$notify_action = KTUtil::arrayGet($_REQUEST, 'notify_action', null);
if ($notify_action == 'clear') {
@@ -333,38 +337,38 @@ class KTSubscriptionNotification extends KTNotificationHandler {
$oKTNotification->delete();
exit(redirect(generateControllerLink('dashboard')));
}
-
+
// otherwise, we want to redirect the to object represented by the item.
// - viewDocument and viewFolder are the appropriate items.
- // - object_id
+ // - object_id
$info = $this->_getSubscriptionData($oKTNotification);
-
+
$object_type = $this->_getEventObjectType($info['event_type']);
-
+
if ($object_type == '') {
- $_SESSION['KTErrorMessage'][] = 'This notification has no "target". Please report as a bug that this subscription should only have a clear action.' . $object_type;
+ $_SESSION['KTErrorMessage'][] = 'This notification has no "target". Please report as a bug that this subscription should only have a clear action.' . $object_type;
exit(redirect(generateControllerLink('dashboard')));
- }
-
+ }
+
if ($object_type == 'document') {
if ($info['object_id'] !== null) { // fails and generates an error with no doc-id.
$params = 'fDocumentId=' . $info['object_id'];
$url = generateControllerLink('viewDocument', $params);
- $oKTNotification->delete(); // clear the alert.
+ //$oKTNotification->delete(); // clear the alert.
exit(redirect($url));
- }
+ }
} else if ($object_type == 'folder') {
if ($info['object_id'] !== null) { // fails and generates an error with no doc-id.
$params = 'fFolderId=' . $info['object_id'];
$url = generateControllerLink('browse', $params);
- $oKTNotification->delete(); // clear the alert.
+ //$oKTNotification->delete(); // clear the alert.
exit(redirect($url));
- }
+ }
}
- $_SESSION['KTErrorMessage'][] = sprintf('This notification has no "target". Please inform the %s developers that there is a target bug with type: ' . $info['event_type'], APP_NAME);
+ $_SESSION['KTErrorMessage'][] = sprintf('This notification has no "target". Please inform the %s developers that there is a target bug with type: ' . $info['event_type'], APP_NAME);
exit(redirect(generateControllerLink('dashboard')));
}
-
+
}
class KTWorkflowNotification extends KTNotificationHandler {
@@ -374,41 +378,41 @@ class KTWorkflowNotification extends KTNotificationHandler {
foreach ($aNotifications as $oNotification) {
$oNotification->delete();
}
-
+
}
- function & newNotificationForDocument($oDocument, $oUser, $oState, $oActor, $sComments) {
- $aInfo = array();
+ function & newNotificationForDocument($oDocument, $oUser, $oState, $oActor, $sComments) {
+ $aInfo = array();
$aInfo['sData1'] = $oState->getName();
$aInfo['sData2'] = $sComments;
$aInfo['iData1'] = $oDocument->getId();
$aInfo['iData2'] = $oActor->getId();
$aInfo['sType'] = 'ktcore/workflow';
- $aInfo['dCreationDate'] = getCurrentDateTime();
+ $aInfo['dCreationDate'] = getCurrentDateTime();
$aInfo['iUserId'] = $oUser->getId();
$aInfo['sLabel'] = $oDocument->getName();
-
+
$oNotification = KTNotification::createFromArray($aInfo);
-
+
$handler = new KTWorkflowNotification();
-
+
if ($oUser->getEmailNotification() && (strlen($oUser->getEmail()) > 0)) {
$emailContent = $handler->handleNotification($oNotification);
$emailSubject = sprintf(_kt('Workflow Notification: %s'), $oDocument->getName());
$oEmail = new EmailAlert($oUser->getEmail(), $emailSubject, $emailContent);
$oEmail->send();
}
-
+
return $oNotification;
}
- function handleNotification($oKTNotification) {
+ function handleNotification($oKTNotification) {
$oTemplating =& KTTemplating::getSingleton();
$oTemplate =& $oTemplating->loadTemplate('ktcore/workflow/workflow_notification');
-
+
$oDoc = Document::get($oKTNotification->getIntData1());
$isBroken = (PEAR::isError($oDoc) || ($oDoc->getStatusID() != LIVE));
-
+
$oTemplate->setData(array(
'context' => $this,
'document_id' => $oKTNotification->getIntData1(),
@@ -421,7 +425,7 @@ class KTWorkflowNotification extends KTNotificationHandler {
));
return $oTemplate->render();
}
-
+
function resolveNotification($oKTNotification) {
$notify_action = KTUtil::arrayGet($_REQUEST, 'notify_action', null);
if ($notify_action == 'clear') {
@@ -429,10 +433,10 @@ class KTWorkflowNotification extends KTNotificationHandler {
$oKTNotification->delete();
exit(redirect(generateControllerLink('dashboard')));
}
-
+
$params = 'fDocumentId=' . $oKTNotification->getIntData1();
$url = generateControllerLink('viewDocument', $params);
- $oKTNotification->delete(); // clear the alert.
+ //$oKTNotification->delete(); // clear the alert.
exit(redirect($url));
}
}
diff --git a/lib/documentmanagement/documentutil.inc.php b/lib/documentmanagement/documentutil.inc.php
index ceed319..1f538f2 100644
--- a/lib/documentmanagement/documentutil.inc.php
+++ b/lib/documentmanagement/documentutil.inc.php
@@ -10,32 +10,32 @@
* KnowledgeTree Open Source Edition
* Document Management Made Simple
* Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
- *
+ *
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
* Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
- *
+ *
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
- *
+ *
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
- * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
- * must display the words "Powered by KnowledgeTree" and retain the original
- * copyright notice.
+ * must display the words "Powered by KnowledgeTree" and retain the original
+ * copyright notice.
* Contributor( s): ______________________________________
*/
@@ -191,17 +191,17 @@ class KTDocumentUtil {
return true;
}
-
+
function archive($oDocument, $sReason) {
-
+
$this->startTransaction();
$oDocument->setStatusID(ARCHIVED);
$res = $oDocument->update();
-
+
if (PEAR::isError($res) || ($res === false)) {
return PEAR::raiseError(_kt('There was a database error while trying to archive this file'));
}
-
+
$oDocumentTransaction = & new DocumentTransaction($oDocument, sprintf(_kt('Document archived: %s'), $sReason), 'ktcore.transactions.update');
$oDocumentTransaction->create();
@@ -222,12 +222,12 @@ class KTDocumentUtil {
return $ret;
}
}
-
+
// fire subscription alerts for the archived document
$oSubscriptionEvent = new SubscriptionEvent();
$oFolder = Folder::get($oDocument->getFolderID());
$oSubscriptionEvent->ArchivedDocument($oDocument, $oFolder);
-
+
return true;
}
@@ -904,6 +904,10 @@ class KTDocumentUtil {
$res = KTDocumentUtil::copyMetadata($oNewDocument, $oDocument->getMetadataVersionId());
if (PEAR::isError($res)) { return $res; }
+ $oNewDocument->setIsCheckedOut(false);
+ $oNewDocument->setCheckedOutUserID(-1);
+
+
// finally, copy the actual file.
$oStorage =& KTStorageManagerUtil::getSingleton();
$res = $oStorage->copy($oDocument, $oNewDocument);
@@ -967,7 +971,7 @@ class KTDocumentUtil {
return $ret;
}
}
-
+
// fire subscription alerts for the copied document
$oSubscriptionEvent = new SubscriptionEvent();
$oFolder = Folder::get($oDocument->getFolderID());
@@ -1077,7 +1081,7 @@ class KTDocumentUtil {
return $ret;
}
}
-
+
// fire subscription alerts for the moved document
$oSubscriptionEvent = new SubscriptionEvent();
$oSubscriptionEvent->MoveDocument($oDocument, $oFolder, $oOriginalFolder);
diff --git a/lib/documentmanagement/observers.inc.php b/lib/documentmanagement/observers.inc.php
index c9f9f59..20b3764 100644
--- a/lib/documentmanagement/observers.inc.php
+++ b/lib/documentmanagement/observers.inc.php
@@ -70,9 +70,6 @@ class JavascriptObserver {
}
function start() {
- $this->context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js');
- $this->context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js');
- $this->context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js');
$this->context->oPage->requireJSResource('resources/js/add_document.js');
$this->context->oRedirector =& $this;
$this->context->handleOutput('
');
diff --git a/lib/templating/kt3template.inc.php b/lib/templating/kt3template.inc.php
index 8874ea7..dc665c1 100644
--- a/lib/templating/kt3template.inc.php
+++ b/lib/templating/kt3template.inc.php
@@ -130,7 +130,7 @@ class KTPage {
$aJS[] = 'thirdpartyjs/MochiKit/MochiKitPacked.js';
$aJS[] = 'resources/js/kt-utility.js';
$aJS[] = 'presentation/i18nJavascript.php';
- $aJS[] = 'thirdpartyjs/curvycorners/rounded_corners.inc.js';
+ $aJS[] = 'thirdpartyjs/curvycorners/rounded_corners_lite.inc.js';
$aJS[] = 'resources/js/loader.js';
$aJS[] = 'thirdpartyjs/yui/tools/tools.js';
$aJS[] = 'thirdpartyjs/yui/connection/connection.js';
diff --git a/plugins/ktcore/KTBulkActions.php b/plugins/ktcore/KTBulkActions.php
index 710c046..dfc21dc 100644
--- a/plugins/ktcore/KTBulkActions.php
+++ b/plugins/ktcore/KTBulkActions.php
@@ -5,32 +5,32 @@
* KnowledgeTree Open Source Edition
* Document Management Made Simple
* Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
- *
+ *
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
* Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
- *
+ *
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
- *
+ *
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
- * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
- * must display the words "Powered by KnowledgeTree" and retain the original
- * copyright notice.
+ * must display the words "Powered by KnowledgeTree" and retain the original
+ * copyright notice.
* Contributor( s): ______________________________________
*
*/
@@ -484,9 +484,9 @@ class KTBulkArchiveAction extends KTBulkAction {
function perform_action($oEntity) {
if(is_a($oEntity, 'Document')) {
-
+
$res = KTDocumentUtil::archive($oEntity, $this->sReason);
-
+
if(PEAR::isError($res)){
return $res;
}
@@ -530,9 +530,13 @@ class KTBulkArchiveAction extends KTBulkAction {
if(!empty($aDocuments)){
foreach($aDocuments as $sDocumentId){
$oDocument = Document::get($sDocumentId);
-
- $res = KTDocumentUtil::archive($oEntity, $this->sReason);
-
+
+ if(PEAR::isError($oDocument)){
+ return $oDocument;
+ }
+
+ $res = KTDocumentUtil::archive($oDocument, $this->sReason);
+
if(PEAR::isError($res)){
return $res;
}
@@ -548,7 +552,7 @@ class KTBrowseBulkExportAction extends KTBulkAction {
var $_sPermission = 'ktcore.permissions.read';
var $_bMutator = true;
var $bNotifications = true;
-
+
function getDisplayName() {
return _kt('Export');
}
@@ -580,7 +584,7 @@ class KTBrowseBulkExportAction extends KTBulkAction {
$this->startTransaction();
$oKTConfig =& KTConfig::getSingleton();
$this->bNoisy = $oKTConfig->get("tweaks/noisyBulkOperations");
-
+
$this->bNotifications = ($oKTConfig->get('export/enablenotifications', 'on') == 'on') ? true : false;
$result = parent::do_performaction();
@@ -600,7 +604,7 @@ class KTBrowseBulkExportAction extends KTBulkAction {
));
$this->commitTransaction();
-
+
$url = KTUtil::addQueryStringSelf(sprintf('action=downloadZipFile&fFolderId=%d&exportcode=%s', $this->oFolder->getId(), $sExportCode));
$str = sprintf('
' . _kt('Go here to download the zip file if you are not automatically redirected there') . "
\n", $url);
$folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder);
@@ -611,9 +615,9 @@ class KTBrowseBulkExportAction extends KTBulkAction {
document.location.href = "%s";
}
callLater(1, kt_bulkexport_redirect);
-
+
', $url);
-
+
return $str;
}
@@ -627,14 +631,14 @@ class KTBrowseBulkExportAction extends KTBulkAction {
$oDocumentTransaction = new DocumentTransaction($oDocument, "Document part of bulk export", 'ktstandard.transactions.bulk_export', array());
$oDocumentTransaction->create();
}
-
+
// fire subscription alerts for the downloaded document - if global config is set
if($this->bNotifications){
$oSubscriptionEvent = new SubscriptionEvent();
$oFolder = Folder::get($oDocument->getFolderID());
$oSubscriptionEvent->DownloadDocument($oDocument, $oFolder);
}
-
+
$this->oZip->addDocumentToZip($oDocument);
}else if(is_a($oEntity, 'Folder')) {
@@ -695,12 +699,12 @@ class KTBrowseBulkExportAction extends KTBulkAction {
function do_downloadZipFile() {
$sCode = $this->oValidator->validateString($_REQUEST['exportcode']);
-
+
$folderName = $this->oFolder->getName();
$this->oZip = new ZipFolder($folderName);
-
+
$res = $this->oZip->downloadZipFile($sCode);
-
+
if(PEAR::isError($res)){
$this->addErrorMessage($res->getMessage());
redirect(generateControllerUrl("browse", "fBrowseType=folder&fFolderId=" . $this->oFolder->getId()));
@@ -798,7 +802,7 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction {
$oKTConfig =& KTConfig::getSingleton();
$this->bNoisy = $oKTConfig->get("tweaks/noisyBulkOperations");
-
+
$folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder);
$sReturn = sprintf('
' . _kt('Go here to download the zip file if you are not automatically redirected there') . "
\n", $url);
$folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder);
@@ -847,9 +851,9 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction {
document.location.href = "%s";
}
callLater(1, kt_bulkexport_redirect);
-
+
', $url);
-
+
return $str;
}
return $result;
@@ -938,15 +942,15 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction {
}
return true;
}
-
+
function do_downloadZipFile() {
$sCode = $this->oValidator->validateString($_REQUEST['exportcode']);
-
+
$folderName = $this->oFolder->getName();
$this->oZip = new ZipFolder($folderName);
-
+
$res = $this->oZip->downloadZipFile($sCode);
-
+
if(PEAR::isError($res)){
$this->addErrorMessage($res->getMessage());
redirect(generateControllerUrl("browse", "fBrowseType=folder&fFolderId=" . $this->oFolder->getId()));
diff --git a/plugins/ktcore/admin/documentFieldsv2.php b/plugins/ktcore/admin/documentFieldsv2.php
index 8aac953..99041e3 100644
--- a/plugins/ktcore/admin/documentFieldsv2.php
+++ b/plugins/ktcore/admin/documentFieldsv2.php
@@ -6,32 +6,32 @@
* KnowledgeTree Open Source Edition
* Document Management Made Simple
* Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
- *
+ *
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
* Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
- *
+ *
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
- *
+ *
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
- * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
- * must display the words "Powered by KnowledgeTree" and retain the original
- * copyright notice.
+ * must display the words "Powered by KnowledgeTree" and retain the original
+ * copyright notice.
* Contributor( s): ______________________________________
*
*/
@@ -49,7 +49,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
function predispatch() {
$this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Document Field Management'));
$this->persistParams(array('fFieldsetId'));
-
+
$this->oFieldset = KTFieldset::get(KTUtil::arrayGet($_REQUEST, 'fFieldsetId'));
if (PEAR::isError($this->oFieldset)) {
$this->oFieldset = null;
@@ -63,7 +63,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
function do_main () {
$oTemplate =& $this->oValidator->validateTemplate('ktcore/metadata/admin/list');
-
+
$oTemplate->setData(array(
'context' => $this,
'fieldsets' => KTFieldset::getList('disabled != true'),
@@ -80,10 +80,10 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
'cancel_action' => 'main',
'fail_action' => 'newfieldset',
'action' => 'create',
- 'context' => $this,
+ 'context' => $this,
));
-
-
+
+
// construct the widget set.
// we use a slight variation here, because "type" is only present in certain circumstances.
$widgets = array(
@@ -98,16 +98,16 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
'name' => 'description',
'required' => true,
'description' => _kt("In order to ensure that the data that users enter is useful, it is essential that you provide a good example."),
- )),
+ )),
);
if ($this->bHaveConditional) {
-
+
// FIXME get this from some external source.
$type_vocab = array(
'normal' => _kt("Normal"),
- 'conditional' => _kt("Conditional"),
+ 'conditional' => _kt("Conditional"),
);
-
+
$widgets[] = array('ktcore.widgets.selection', array(
'label' => _kt("Fieldset Type"),
'use_simple' => false,
@@ -119,20 +119,20 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
'vocab' => $type_vocab,
));
}
-
+
$widgets[] = array('ktcore.widgets.boolean',array(
'label' => _kt("Generic"),
'name' => 'generic',
'description' => _kt("A generic fieldset is one that is available for every document by default. These fieldsets will be available for users to edit and add for every document in the document management system."),
));
-
+
$oForm->setWidgets($widgets);
-
+
// similarly, we construct validators here.
$validators = array(
array('ktcore.validators.string', array(
'test' => 'name',
- 'output' => 'name',
+ 'output' => 'name',
)),
array('ktcore.validators.string', array(
'test' => 'description',
@@ -143,65 +143,65 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
'output' => 'generic',
)),
);
-
+
if ($this->bHaveConditional) {
$validators[] = array('ktcore.validators.string', array(
'test' => 'fieldset_type',
'output' => 'fieldset_type',
));
}
-
+
$oForm->setValidators($validators);
-
+
return $oForm;
}
function do_newfieldset() {
$this->oPage->setBreadcrumbDetails(_kt("Create New Fieldset"));
$oForm = $this->form_create();
-
+
return $oForm->render();
}
-
+
function do_create() {
$oForm = $this->form_create();
$res = $oForm->validate();
-
+
$data = $res['results'];
$errors = $res['errors'];
$extra_errors = array();
-
+
if (!empty($data['name'])) {
$oFieldset = KTFieldset::getByName($data['name']);
if (!PEAR::isError($oFieldset)) {
// means we're looking at an existing name
$extra_errors['name'] = _kt("There is already a fieldset with that name.");
- }
+ }
}
-
+
$is_conditional = false;
// FIXME this is inelegant. get it from somewhere else.
if ($this->bHaveConditional && ($data['fieldset_type'] == 'conditional')) {
$is_conditional = true;
}
-
-
+
+
if (!empty($errors) || !empty($extra_errors)) {
return $oForm->handleError(null, $extra_errors);
}
-
+
// we also need a namespace.
$temp_name = $data['name'];
$namespace = KTUtil::nameToLocalNamespace('fieldsets', $temp_name);
$oOldFieldset = KTFieldset::getByNamespace($namespace);
-
+
while (!PEAR::isError($oOldFieldset)) {
$temp_name .= '_';
$namespace = KTUtil::nameToLocalNamespace('fieldsets', $temp_name);
- $oOldFieldset = KTFieldset::getByNamespace($namespace);
+ $oOldFieldset = KTFieldset::getByNamespace($namespace);
}
-
- // we now know its a non-conflicting one.
+
+ // we now know its a non-conflicting one.
// FIXME handle conditional fieldsets, which should be ... a different object.
$oFieldset = KTFieldset::createFromArray(array(
"name" => $data['name'],
@@ -212,29 +212,29 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
"isGeneric" => $data['generic'],
"isComplete" => false,
"isComplex" => false,
- "isSystem" => false,
+ "isSystem" => false,
));
if (PEAR::isError($oFieldset)) {
return $oForm->handleError(sprintf(_kt("Failed to create fieldset: %s"), $oFieldset->getMessage()));
}
-
+
$this->successRedirectTo('edit',_kt("Fieldset created."), sprintf('fFieldsetId=%d', $oFieldset->getId()));
- }
+ }
function getTypesForFieldset($oFieldset) {
if ($oFieldset->getIsGeneric()) {
return _kt('All types use this generic fieldset.');
}
-
+
$types = $oFieldset->getAssociatedTypes();
if (PEAR::isError($types)) {
return _kt('Error retrieving list of types.');
}
- if (empty($types)) {
+ if (empty($types)) {
return _kt('None');
}
$aNames = array();
- foreach ($types as $oType) {
+ foreach ($types as $oType) {
if (!PEAR::isError($oType)) {
$aNames[] = $oType->getName();
}
@@ -247,30 +247,30 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
// here we engage in some major evil.
// we check for the subevent var
// and subdispatch if appropriate.
- //
+ //
// saves a little code-duplication (actually, a lot of code-duplication)
-
+
// FIXME this is essentially a stub for the fieldset-delegation code.
if ($this->oFieldset->getIsConditional()) {
require_once('fieldsets/conditional.inc.php');
- $oSubDispatcher = new ConditionalFieldsetManagementDispatcher;
+ $oSubDispatcher = new ConditionalFieldsetManagementDispatcher;
} else {
require_once('fieldsets/basic.inc.php');
$oSubDispatcher = new BasicFieldsetManagementDispatcher;
}
-
+
$subevent_var = 'fieldset_action';
$subevent = KTUtil::arrayGet($_REQUEST, $subevent_var);
if (!empty($subevent)) {
// do nothing, since this will handle everything
$this_url = KTUtil::addQueryStringSelf($this->meldPersistQuery("","edit"));
- $oSubDispatcher->redispatch($subevent_var, null, $this, $this_url);
+ $oSubDispatcher->redispatch($subevent_var, null, $this, $this_url);
exit(0);
} else {
// what we want is the "additional info" section
$additional = $oSubDispatcher->describe_fieldset($this->oFieldset);
}
-
+
$oTemplate =& $this->oValidator->validateTemplate('ktcore/metadata/admin/edit');
$oTemplate->setData(array(
'context' => $this,
@@ -279,9 +279,19 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
));
return $oTemplate->render();
}
-
+
function do_delete() {
$this->startTransaction();
+
+ // check if fieldset is associated with a document type - remove association
+ $types = $this->oFieldset->getAssociatedTypes();
+ $sFieldSetId = $this->oFieldset->getId();
+ if(!PEAR::isError($types) AND !empty($types)){
+ foreach($types as $oType){
+ $res = KTMetadataUtil::removeSetsFromDocumentType($oType, $sFieldSetId);
+ }
+ }
+
$res = $this->oFieldset->delete('true');
$this->oValidator->notErrorFalse($res, array(
'redirect_to' => array('main', ''),
@@ -289,7 +299,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
));
$this->successRedirectToMain(_kt('Fieldset deleted'));
}
-
+
function form_edit() {
$oForm = new KTForm;
$oForm->setOptions(array(
@@ -299,10 +309,10 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
'cancel_action' => 'edit',
'fail_action' => 'editfieldset',
'action' => 'savefieldset',
- 'context' => $this,
+ 'context' => $this,
));
-
-
+
+
// construct the widget set.
// we use a slight variation here, because "type" is only present in certain circumstances.
$widgets = array(
@@ -318,24 +328,24 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
'name' => 'description',
'required' => true,
'description' => _kt("In order to ensure that the data that users enter is useful, it is essential that you provide a good example."),
- 'value' => sanitizeForHTML($this->oFieldset->getDescription()),
- )),
+ 'value' => sanitizeForHTML($this->oFieldset->getDescription()),
+ )),
);
-
+
$widgets[] = array('ktcore.widgets.boolean',array(
'label' => _kt("Generic"),
'name' => 'generic',
'description' => _kt("A generic fieldset is one that is available for every document by default. These fieldsets will be available for users to edit and add for every document in the document management system."),
- 'value' => $this->oFieldset->getIsGeneric(),
+ 'value' => $this->oFieldset->getIsGeneric(),
));
-
+
$oForm->setWidgets($widgets);
-
+
// similarly, we construct validators here.
$validators = array(
array('ktcore.validators.string', array(
'test' => 'name',
- 'output' => 'name',
+ 'output' => 'name',
)),
array('ktcore.validators.string', array(
'test' => 'description',
@@ -346,22 +356,22 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
'output' => 'generic',
)),
);
-
+
$oForm->setValidators($validators);
-
+
return $oForm;
}
-
- function do_editfieldset() {
+
+ function do_editfieldset() {
$oForm = $this->form_edit();
$this->oPage->setBreadcrumbDetails(_kt('edit fieldset'));
return $oForm->renderPage(_kt("Edit Fieldset"));
}
-
- function do_savefieldset() {
+
+ function do_savefieldset() {
$oForm = $this->form_edit();
$res = $oForm->validate();
-
+
$data = $res['results'];
$errors = $res['errors'];
$extra_errors = array();
@@ -371,18 +381,18 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
$extra_errors['name'][] = _kt("A fieldset with that name already exists.");
}
}
-
+
if (!empty($errors) || !empty($extra_errors)) {
return $oForm->handleError(null, $extra_errors);
}
-
+
$this->startTransaction();
-
+
$this->oFieldset->setName($data['name']);
- $this->oFieldset->setDescription($data['description']);
+ $this->oFieldset->setDescription($data['description']);
$bGeneric = $data['generic'];
if ($bGeneric != $this->oFieldset->getIsGeneric() && $bGeneric == true) {
- // delink it from all doctypes.
+ // delink it from all doctypes.
$aTypes = $this->oFieldset->getAssociatedTypes();
foreach ($aTypes as $oType) {
$res = KTMetadataUtil::removeSetsFromDocumentType($oType, $this->oFieldset->getId());
@@ -392,17 +402,17 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
}
}
}
-
- $this->oFieldset->setIsGeneric($data['generic']);
-
+
+ $this->oFieldset->setIsGeneric($data['generic']);
+
$res = $this->oFieldset->update();
if (PEAR::isError($res)) {
$this->errorRedirectTo('edit', _kt('Could not save fieldset changes'));
exit(0);
}
-
+
return $this->successRedirectTo('edit', _kt("Fieldset details updated."));
- }
+ }
}
?>
diff --git a/plugins/ktcore/admin/fieldsets/basic.inc.php b/plugins/ktcore/admin/fieldsets/basic.inc.php
index 1678506..1011a3a 100644
--- a/plugins/ktcore/admin/fieldsets/basic.inc.php
+++ b/plugins/ktcore/admin/fieldsets/basic.inc.php
@@ -608,8 +608,6 @@ class BasicFieldsetManagementDispatcher extends KTAdminDispatcher {
$renderedTree = $this->_evilTreeRenderer($fieldTree);
$this->oPage->setTitle(_kt('Edit Lookup Tree'));
-
- //$this->oPage->requireJSResource('thirdparty/js/MochiKit/Base.js');
if ($current_node == 0) { $category_name = 'Root'; }
else {
diff --git a/plugins/ktstandard/KTBulkExportPlugin.php b/plugins/ktstandard/KTBulkExportPlugin.php
index f658f04..861793c 100644
--- a/plugins/ktstandard/KTBulkExportPlugin.php
+++ b/plugins/ktstandard/KTBulkExportPlugin.php
@@ -106,8 +106,6 @@ class KTBulkExportAction extends KTFolderAction {
exit(0);
}
- $this->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js');
- $this->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js');
$this->oPage->template = "kt3/minimal_page";
$this->handleOutput("");
diff --git a/sql/mysql/install/rebuild.bat b/sql/mysql/install/rebuild.bat
index bf56b25..baf0b1a 100644
--- a/sql/mysql/install/rebuild.bat
+++ b/sql/mysql/install/rebuild.bat
@@ -14,7 +14,7 @@ mysqladmin -u root -p -f drop %INPUT%
ECHO ---- Creating database %INPUT% ----
mysqladmin -u root -p create %INPUT%
ECHO ---- Creating structure for database %INPUT% ----
-mysql -u root %INPUT%oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')}
-{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')}
-{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')}
-{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DateTime.js')}
-{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')}
-
{$context->oPage->requireJSResource('resources/js/taillog.js')}
diff --git a/templates/kt3/notifications/subscriptions.AddDocument.smarty b/templates/kt3/notifications/subscriptions.AddDocument.smarty
index 0931815..f54ad2a 100644
--- a/templates/kt3/notifications/subscriptions.AddDocument.smarty
+++ b/templates/kt3/notifications/subscriptions.AddDocument.smarty
@@ -1,13 +1,26 @@
diff --git a/templates/kt3/notifications/subscriptions.DiscussDocument.smarty b/templates/kt3/notifications/subscriptions.DiscussDocument.smarty
index a691323..eabfd95 100644
--- a/templates/kt3/notifications/subscriptions.DiscussDocument.smarty
+++ b/templates/kt3/notifications/subscriptions.DiscussDocument.smarty
@@ -7,11 +7,20 @@
The discussion around document "{$info.object_name|sanitize}" has been updated.
{/if}
diff --git a/templates/kt3/notifications/subscriptions.RemoveSubscribedDocument.smarty b/templates/kt3/notifications/subscriptions.RemoveSubscribedDocument.smarty
index 2ecebd8..7f9b479 100644
--- a/templates/kt3/notifications/subscriptions.RemoveSubscribedDocument.smarty
+++ b/templates/kt3/notifications/subscriptions.RemoveSubscribedDocument.smarty
@@ -3,6 +3,12 @@
{i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" to which you were subscribed, has been removed{/i18n}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}.
diff --git a/templates/kt3/notifications/subscriptions.RemoveSubscribedFolder.smarty b/templates/kt3/notifications/subscriptions.RemoveSubscribedFolder.smarty
index 1a8c49a..f8eaf16 100644
--- a/templates/kt3/notifications/subscriptions.RemoveSubscribedFolder.smarty
+++ b/templates/kt3/notifications/subscriptions.RemoveSubscribedFolder.smarty
@@ -3,6 +3,12 @@
{i18n arg_object_name=$info.object_name|sanitize}The folder "#object_name#" to which you were subscribed, has been removed{/i18n}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}.
diff --git a/templates/kt3/notifications/subscriptions.RestoreDocument.smarty b/templates/kt3/notifications/subscriptions.RestoreDocument.smarty
index 02aa440..4f36447 100644
--- a/templates/kt3/notifications/subscriptions.RestoreDocument.smarty
+++ b/templates/kt3/notifications/subscriptions.RestoreDocument.smarty
@@ -3,6 +3,12 @@
{i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" has been restored by an administrator.{/i18n}
diff --git a/templates/ktcore/action/checkout_final.smarty b/templates/ktcore/action/checkout_final.smarty
index 43f5268..30e2c6d 100644
--- a/templates/ktcore/action/checkout_final.smarty
+++ b/templates/ktcore/action/checkout_final.smarty
@@ -1,8 +1,3 @@
-{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')}
-{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')}
-{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/Iter.js")}
-{$context->oPage->requireJSResource("thirdpartyjs/MochiKit/DOM.js")}
-
{capture assign=sLocation}action=checkout_final&fDocumentId={$context->oDocument->getId()}&reason={$reason|escape:'url'}{/capture}
{capture assign=sJavascript}
diff --git a/templates/ktcore/assist/assist_notification.smarty b/templates/ktcore/assist/assist_notification.smarty
index 4f3057c..c734fb6 100644
--- a/templates/ktcore/assist/assist_notification.smarty
+++ b/templates/ktcore/assist/assist_notification.smarty
@@ -4,11 +4,20 @@
user, #user#, has requested help on the document #name#, and you are
the owner or an admin of this document.{/i18n}