diff --git a/edit.php b/edit.php index d965881..39c894e 100644 --- a/edit.php +++ b/edit.php @@ -59,7 +59,9 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher { if (!KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPerm, $this->oDocument)) { return false; } - + if ($this->oDocument->getIsCheckedOut()) { + return false; + } return true; diff --git a/lib/browse/BrowseColumns.inc.php b/lib/browse/BrowseColumns.inc.php index d9cc3b2..0166db3 100644 --- a/lib/browse/BrowseColumns.inc.php +++ b/lib/browse/BrowseColumns.inc.php @@ -293,7 +293,7 @@ class SelectionColumn extends BrowseColumn { return ' '; } - return ''; + return ''; } } diff --git a/lib/dashboard/Notification.inc.php b/lib/dashboard/Notification.inc.php index 35ea581..fe49ff6 100644 --- a/lib/dashboard/Notification.inc.php +++ b/lib/dashboard/Notification.inc.php @@ -363,6 +363,10 @@ class KTWorkflowNotification extends KTNotificationHandler { 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(), @@ -370,6 +374,8 @@ class KTWorkflowNotification extends KTNotificationHandler { 'actor' => User::get($oKTNotification->getIntData2()), 'document_name' => $oKTNotification->getLabel(), 'notify_id' => $oKTNotification->getId(), + 'document' => $oDoc, + 'is_broken' => $isBroken, )); return $oTemplate->render(); } diff --git a/lib/documentmanagement/documentutil.inc.php b/lib/documentmanagement/documentutil.inc.php index c69eec2..cd9c8cb 100644 --- a/lib/documentmanagement/documentutil.inc.php +++ b/lib/documentmanagement/documentutil.inc.php @@ -243,7 +243,7 @@ class KTDocumentUtil { $aFieldValues[$oField->getId()] = $v; } } - if ($oFieldset->getIsConditional()) { + if ($oFieldset->getIsConditional() && KTMetadataUtil::validateCompleteness($oFieldset)) { $res = KTMetadataUtil::getNext($oFieldset, $aFieldValues); if ($res) { $aFailed["fieldset"][$oFieldset->getId()] = 1; diff --git a/lib/metadata/metadatautil.inc.php b/lib/metadata/metadatautil.inc.php index 0de1210..7d311d0 100644 --- a/lib/metadata/metadatautil.inc.php +++ b/lib/metadata/metadatautil.inc.php @@ -459,6 +459,20 @@ class KTMetadataUtil { } // }}} + // {{{ + function validateCompleteness($oFieldset) { + $res = KTMetadataUtil::checkConditionalFieldsetCompleteness($oFieldset); + // errors, false, or null are all false. + if ($res === true) { + return true; + } + + return false; + } + + + // }}} + // {{{ checkConditionalFieldsetCompleteness /** * Checks whether a conditional fieldset has the necessary diff --git a/lib/subscriptions/subscriptions.inc.php b/lib/subscriptions/subscriptions.inc.php index cbe08f5..075f7dd 100644 --- a/lib/subscriptions/subscriptions.inc.php +++ b/lib/subscriptions/subscriptions.inc.php @@ -677,9 +677,16 @@ class SubscriptionContent { $oTemplate = $oTemplating->loadTemplate("kt3/notifications/subscriptions.generic"); } // FIXME we need to specify the i18n by user. + + $isBroken = false; + if (PEAR::isError($info['object']) || ($info['object'] === false) || is_null($info['object'])) { + $isBroken = true; + } + $aTemplateData = array( "context" => $oKTNotification, "info" => $info, + "is_broken" => $isBroken, ); return $oTemplate->render($aTemplateData); } diff --git a/lib/widgets/FieldsetDisplayRegistry.inc.php b/lib/widgets/FieldsetDisplayRegistry.inc.php index 2a27aac..8d0059b 100644 --- a/lib/widgets/FieldsetDisplayRegistry.inc.php +++ b/lib/widgets/FieldsetDisplayRegistry.inc.php @@ -1,6 +1,7 @@ getIsConditional()) { + if ($oFieldset->getIsConditional() && KTMetadataUtil::validateCompleteness($oFieldset)) { return 'ConditionalFieldsetDisplay'; } else { return 'SimpleFieldsetDisplay'; diff --git a/lib/widgets/fieldsetDisplay.inc.php b/lib/widgets/fieldsetDisplay.inc.php index 81590bb..afd3c91 100644 --- a/lib/widgets/fieldsetDisplay.inc.php +++ b/lib/widgets/fieldsetDisplay.inc.php @@ -57,6 +57,7 @@ function getWidgetForMetadataField($field, $current_value, $page, $errors = null if ($vocab === null) { // allow override $lookups = MetaData::getEnabledByDocumentField($field); $fieldOptions["vocab"] = array(); // FIXME handle lookups + $fieldOptions['vocab'][''] = _('No value'); foreach ($lookups as $md) { $fieldOptions["vocab"][$md->getName()] = $md->getName(); } diff --git a/plugins/ktcore/KTDocumentActions.php b/plugins/ktcore/KTDocumentActions.php index 6476671..f824a6e 100644 --- a/plugins/ktcore/KTDocumentActions.php +++ b/plugins/ktcore/KTDocumentActions.php @@ -312,6 +312,13 @@ class KTDocumentEditAction extends KTDocumentAction { var $_sShowPermission = "ktcore.permissions.write"; + function getInfo() { + if ($this->oDocument->getIsCheckedOut()) { + return null; + } + return parent::getInfo(); + } + function getDisplayName() { return _('Edit metadata'); } diff --git a/resources/css/kt-framing.css b/resources/css/kt-framing.css index 4fd4de2..9acf241 100644 --- a/resources/css/kt-framing.css +++ b/resources/css/kt-framing.css @@ -617,6 +617,12 @@ a.main_nav_item { background-color: #fafafa; } +/* cheap and nasty hack for gmail-style highlighting. */ +.kt_collection tr.activated td.sort_on, +.kt_collection tr.activated td { + background-color: #fff2b8; +} + .kt_collection .odd td.sort_on { background-color: #f0f0f0; } @@ -717,6 +723,7 @@ The text will be hidden for screen view. The generic fahrner-ish approach comes .ktAction.ktInline { float: left; padding-right: 0.5em; + background-position: top left; } .ktHelp { @@ -746,6 +753,11 @@ The text will be hidden for screen view. The generic fahrner-ish approach comes .ktActionLink.ktAllowed, .ktAction.ktAllowed { background-image: url(../../resources/graphics/allowed.png); } .ktActionLink.ktDenied, .ktAction.ktDenied { background-image: url(../../resources/graphics/denied.png); } +/* this is sometimes used separately to get the auto-delete help. */ +.ktDelete { } + + + /* =========== standard listings. */ diff --git a/resources/js/kt-utility.js b/resources/js/kt-utility.js index 498a13f..b6f319e 100644 --- a/resources/js/kt-utility.js +++ b/resources/js/kt-utility.js @@ -41,8 +41,24 @@ function initDeleteProtection(m) { forEach(elements, partial(setClickFunction, fn)); - //elements = getElementsByTagAndClassName('SPAN', 'ktDelete'); - - //forEach(elements, partial(setClickFunction, fn)); - + elements = getElementsByTagAndClassName('A','ktLinkDelete'); + forEach(elements, partial(setClickFunction, fn)); +} + +// quick and dirty helper - find the nearest parent item matching tagName. +// FIXME steal the klass or tagName logic from MochiK. +// FIXME add to a core js-lib, and add some unit-tests. +function breadcrumbFind(elem, tagName) { + var stopTag = 'BODY'; + var currentTag = elem.tagName; + var currentElem = elem; + while ((currentTag != stopTag) && (currentTag != tagName)) { + currentElem = currentElem.parentNode; + currentTag = currentElem.tagName; + } + if (currentTag == tagName) { + return currentElem; + } else { + return null; + } } \ No newline at end of file diff --git a/resources/js/toggleselect.js b/resources/js/toggleselect.js index 090b945..7235dba 100644 --- a/resources/js/toggleselect.js +++ b/resources/js/toggleselect.js @@ -1,3 +1,12 @@ +function activateRow(checkbox) { + var row = breadcrumbFind(checkbox, 'TR'); + if (checkbox.checked) { + addElementClass(row, 'activated'); + } else { + removeElementClass(row, 'activated'); + } +} + function toggleSelectFor(source, nameprefix) { var content = getElement('content'); diff --git a/templates/kt3/notifications/subscriptions.AddDocument.smarty b/templates/kt3/notifications/subscriptions.AddDocument.smarty index dca302d..78b8b88 100644 --- a/templates/kt3/notifications/subscriptions.AddDocument.smarty +++ b/templates/kt3/notifications/subscriptions.AddDocument.smarty @@ -3,7 +3,11 @@ The document "{$info.object_name}" was added{if ($info.location_name !== null)} to "{$info.location_name}"{/if}.
diff --git a/templates/kt3/notifications/subscriptions.AddFolder.smarty b/templates/kt3/notifications/subscriptions.AddFolder.smarty index c5fa84d..9387aa7 100644 --- a/templates/kt3/notifications/subscriptions.AddFolder.smarty +++ b/templates/kt3/notifications/subscriptions.AddFolder.smarty @@ -3,7 +3,11 @@ The folder "{$info.object_name}" was added{if ($info.location_name !== null)} to "{$info.location_name}"{/if}. diff --git a/templates/kt3/notifications/subscriptions.CheckInDocument.smarty b/templates/kt3/notifications/subscriptions.CheckInDocument.smarty index f2fc908..f3b6c5e 100644 --- a/templates/kt3/notifications/subscriptions.CheckInDocument.smarty +++ b/templates/kt3/notifications/subscriptions.CheckInDocument.smarty @@ -3,7 +3,11 @@ The document "{$info.object_name}" has been checked in, in the folder "{$info.location_name}". diff --git a/templates/kt3/notifications/subscriptions.CheckOutDocument.smarty b/templates/kt3/notifications/subscriptions.CheckOutDocument.smarty index 82a8683..deff053 100644 --- a/templates/kt3/notifications/subscriptions.CheckOutDocument.smarty +++ b/templates/kt3/notifications/subscriptions.CheckOutDocument.smarty @@ -3,7 +3,11 @@ The document "{$info.object_name}" has been checked out, in the folder "{$info.location_name}". diff --git a/templates/kt3/notifications/subscriptions.ModifyDocument.smarty b/templates/kt3/notifications/subscriptions.ModifyDocument.smarty index 0288691..1efba26 100644 --- a/templates/kt3/notifications/subscriptions.ModifyDocument.smarty +++ b/templates/kt3/notifications/subscriptions.ModifyDocument.smarty @@ -1,9 +1,13 @@{i18n}This page allows you to rename the file name (not the document title) for a document.{/i18n}
{assign var=iDocumentId value=$context->oDocument->getId()} {capture assign=link}{"viewDocument"|generateControllerUrl:"fDocumentId=$iDocumentId"}{/capture} -{i18n arg_link=$link}If you do not intend to -rename this document, you should cancel the -deletion.{/i18n}