Commit c69646c0b7951d5d6d5ca9d513e42419d2ae3a7a

Authored by bshuttle
1 parent 543b559c

Brad Shuttleworth 2006-02-22 notifications should respect broken or delete...

Brad Shuttleworth 2006-02-22 second half of fix for KTS-460
Brad Shuttleworth 2006-02-22 fix for KTS-460
Brad Shuttleworth 2006-02-22 fix for issues from Forums:  edit during ch...
Brad Shuttleworth 2006-02-22 fix for KTS-448:  lookups should default to...
Brad Shuttleworth 2006-02-21 fix for adjunct on KTS-444
Brad Shuttleworth 2006-02-21 fix for KTS-444
Brad Shuttleworth 2006-02-21 fixes for KTS-442 and friends.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4994 c91229c3-7414-0410-bfa2-8a42b809f60b
edit.php
... ... @@ -59,7 +59,9 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher {
59 59  
60 60 if (!KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPerm, $this->oDocument)) { return false; }
61 61  
62   -
  62 + if ($this->oDocument->getIsCheckedOut()) {
  63 + return false;
  64 + }
63 65  
64 66  
65 67 return true;
... ...
lib/browse/BrowseColumns.inc.php
... ... @@ -293,7 +293,7 @@ class SelectionColumn extends BrowseColumn {
293 293 return ' ';
294 294 }
295 295  
296   - return '<input type="checkbox" name="' . $localname . '" onactivate="activateRow(this)" value="' . $v . '"/>';
  296 + return '<input type="checkbox" name="' . $localname . '" onclick="activateRow(this)" value="' . $v . '"/>';
297 297 }
298 298  
299 299 }
... ...
lib/dashboard/Notification.inc.php
... ... @@ -363,6 +363,10 @@ class KTWorkflowNotification extends KTNotificationHandler {
363 363 function handleNotification($oKTNotification) {
364 364 $oTemplating =& KTTemplating::getSingleton();
365 365 $oTemplate =& $oTemplating->loadTemplate('ktcore/workflow/workflow_notification');
  366 +
  367 + $oDoc = Document::get($oKTNotification->getIntData1());
  368 + $isBroken = (PEAR::isError($oDoc) || ($oDoc->getStatusID() != LIVE));
  369 +
366 370 $oTemplate->setData(array(
367 371 'context' => $this,
368 372 'document_id' => $oKTNotification->getIntData1(),
... ... @@ -370,6 +374,8 @@ class KTWorkflowNotification extends KTNotificationHandler {
370 374 'actor' => User::get($oKTNotification->getIntData2()),
371 375 'document_name' => $oKTNotification->getLabel(),
372 376 'notify_id' => $oKTNotification->getId(),
  377 + 'document' => $oDoc,
  378 + 'is_broken' => $isBroken,
373 379 ));
374 380 return $oTemplate->render();
375 381 }
... ...
lib/documentmanagement/documentutil.inc.php
... ... @@ -243,7 +243,7 @@ class KTDocumentUtil {
243 243 $aFieldValues[$oField->getId()] = $v;
244 244 }
245 245 }
246   - if ($oFieldset->getIsConditional()) {
  246 + if ($oFieldset->getIsConditional() && KTMetadataUtil::validateCompleteness($oFieldset)) {
247 247 $res = KTMetadataUtil::getNext($oFieldset, $aFieldValues);
248 248 if ($res) {
249 249 $aFailed["fieldset"][$oFieldset->getId()] = 1;
... ...
lib/metadata/metadatautil.inc.php
... ... @@ -459,6 +459,20 @@ class KTMetadataUtil {
459 459 }
460 460 // }}}
461 461  
  462 + // {{{
  463 + function validateCompleteness($oFieldset) {
  464 + $res = KTMetadataUtil::checkConditionalFieldsetCompleteness($oFieldset);
  465 + // errors, false, or null are all false.
  466 + if ($res === true) {
  467 + return true;
  468 + }
  469 +
  470 + return false;
  471 + }
  472 +
  473 +
  474 + // }}}
  475 +
462 476 // {{{ checkConditionalFieldsetCompleteness
463 477 /**
464 478 * Checks whether a conditional fieldset has the necessary
... ...
lib/subscriptions/subscriptions.inc.php
... ... @@ -677,9 +677,16 @@ class SubscriptionContent {
677 677 $oTemplate = $oTemplating->loadTemplate("kt3/notifications/subscriptions.generic");
678 678 }
679 679 // FIXME we need to specify the i18n by user.
  680 +
  681 + $isBroken = false;
  682 + if (PEAR::isError($info['object']) || ($info['object'] === false) || is_null($info['object'])) {
  683 + $isBroken = true;
  684 + }
  685 +
680 686 $aTemplateData = array(
681 687 "context" => $oKTNotification,
682 688 "info" => $info,
  689 + "is_broken" => $isBroken,
683 690 );
684 691 return $oTemplate->render($aTemplateData);
685 692 }
... ...
lib/widgets/FieldsetDisplayRegistry.inc.php
1 1 <?php
2 2  
3 3 require_once(KT_LIB_DIR . '/metadata/fieldset.inc.php');
  4 +require_once(KT_LIB_DIR . '/metadata/metadatautil.inc.php');
4 5  
5 6 class KTFieldsetDisplayRegistry {
6 7  
... ... @@ -31,7 +32,7 @@ class KTFieldsetDisplayRegistry {
31 32 //
32 33 // FIXME this is slightly wasteful from a performance POV, though DB caching should make it OK.
33 34 $oFieldset =& KTFieldset::getByNamespace ($nsname);
34   - if ($oFieldset->getIsConditional()) {
  35 + if ($oFieldset->getIsConditional() && KTMetadataUtil::validateCompleteness($oFieldset)) {
35 36 return 'ConditionalFieldsetDisplay';
36 37 } else {
37 38 return 'SimpleFieldsetDisplay';
... ...
lib/widgets/fieldsetDisplay.inc.php
... ... @@ -57,6 +57,7 @@ function getWidgetForMetadataField($field, $current_value, $page, $errors = null
57 57 if ($vocab === null) { // allow override
58 58 $lookups = MetaData::getEnabledByDocumentField($field);
59 59 $fieldOptions["vocab"] = array(); // FIXME handle lookups
  60 + $fieldOptions['vocab'][''] = _('No value');
60 61 foreach ($lookups as $md) {
61 62 $fieldOptions["vocab"][$md->getName()] = $md->getName();
62 63 }
... ...
plugins/ktcore/KTDocumentActions.php
... ... @@ -312,6 +312,13 @@ class KTDocumentEditAction extends KTDocumentAction {
312 312  
313 313 var $_sShowPermission = "ktcore.permissions.write";
314 314  
  315 + function getInfo() {
  316 + if ($this->oDocument->getIsCheckedOut()) {
  317 + return null;
  318 + }
  319 + return parent::getInfo();
  320 + }
  321 +
315 322 function getDisplayName() {
316 323 return _('Edit metadata');
317 324 }
... ...
resources/css/kt-framing.css
... ... @@ -617,6 +617,12 @@ a.main_nav_item {
617 617 background-color: #fafafa;
618 618 }
619 619  
  620 +/* cheap and nasty hack for gmail-style highlighting. */
  621 +.kt_collection tr.activated td.sort_on,
  622 +.kt_collection tr.activated td {
  623 + background-color: #fff2b8;
  624 +}
  625 +
620 626 .kt_collection .odd td.sort_on {
621 627 background-color: #f0f0f0;
622 628 }
... ... @@ -717,6 +723,7 @@ The text will be hidden for screen view. The generic fahrner-ish approach comes
717 723 .ktAction.ktInline {
718 724 float: left;
719 725 padding-right: 0.5em;
  726 + background-position: top left;
720 727 }
721 728  
722 729 .ktHelp {
... ... @@ -746,6 +753,11 @@ The text will be hidden for screen view. The generic fahrner-ish approach comes
746 753 .ktActionLink.ktAllowed, .ktAction.ktAllowed { background-image: url(../../resources/graphics/allowed.png); }
747 754 .ktActionLink.ktDenied, .ktAction.ktDenied { background-image: url(../../resources/graphics/denied.png); }
748 755  
  756 +/* this is sometimes used separately to get the auto-delete help. */
  757 +.ktDelete { }
  758 +
  759 +
  760 +
749 761 /* =========== standard listings. */
750 762  
751 763  
... ...
resources/js/kt-utility.js
... ... @@ -41,8 +41,24 @@ function initDeleteProtection(m) {
41 41  
42 42 forEach(elements, partial(setClickFunction, fn));
43 43  
44   - //elements = getElementsByTagAndClassName('SPAN', 'ktDelete');
45   -
46   - //forEach(elements, partial(setClickFunction, fn));
47   -
  44 + elements = getElementsByTagAndClassName('A','ktLinkDelete');
  45 + forEach(elements, partial(setClickFunction, fn));
  46 +}
  47 +
  48 +// quick and dirty helper - find the nearest parent item matching tagName.
  49 +// FIXME steal the klass or tagName logic from MochiK.
  50 +// FIXME add to a core js-lib, and add some unit-tests.
  51 +function breadcrumbFind(elem, tagName) {
  52 + var stopTag = 'BODY';
  53 + var currentTag = elem.tagName;
  54 + var currentElem = elem;
  55 + while ((currentTag != stopTag) && (currentTag != tagName)) {
  56 + currentElem = currentElem.parentNode;
  57 + currentTag = currentElem.tagName;
  58 + }
  59 + if (currentTag == tagName) {
  60 + return currentElem;
  61 + } else {
  62 + return null;
  63 + }
48 64 }
49 65 \ No newline at end of file
... ...
resources/js/toggleselect.js
  1 +function activateRow(checkbox) {
  2 + var row = breadcrumbFind(checkbox, 'TR');
  3 + if (checkbox.checked) {
  4 + addElementClass(row, 'activated');
  5 + } else {
  6 + removeElementClass(row, 'activated');
  7 + }
  8 +}
  9 +
1 10 function toggleSelectFor(source, nameprefix) {
2 11 var content = getElement('content');
3 12  
... ...
templates/kt3/notifications/subscriptions.AddDocument.smarty
... ... @@ -3,7 +3,11 @@
3 3 <!-- could break this up. -->
4 4 The document "{$info.object_name}" was added{if ($info.location_name !== null)} to "{$info.location_name}"{/if}.
5 5 <div class="actionoptions">
6   - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}Read Document{/i18n}</a> |
7   - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
  6 + {if !$is_broken}
  7 + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Document{/i18n}</a>
  8 + {else}
  9 + <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span>
  10 + {/if}
  11 + | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
8 12 </div>
9 13 </dd>
... ...
templates/kt3/notifications/subscriptions.AddFolder.smarty
... ... @@ -3,7 +3,11 @@
3 3 <!-- could break this up. -->
4 4 The folder "{$info.object_name}" was added{if ($info.location_name !== null)} to "{$info.location_name}"{/if}.
5 5 <div class="actionoptions">
6   - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View New Folder{/i18n}</a> |
7   - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
  6 + {if !$is_broken}
  7 + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View New Folder{/i18n}</a>
  8 + {else}
  9 + <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span>
  10 + {/if}
  11 + | | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
8 12 </div>
9 13 </dd>
... ...
templates/kt3/notifications/subscriptions.CheckInDocument.smarty
... ... @@ -3,7 +3,11 @@
3 3 <!-- could break this up. -->
4 4 The document "{$info.object_name}" has been checked in, in the folder "{$info.location_name}".
5 5 <div class="actionoptions">
  6 + {if !$is_broken}
6 7 <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Document{/i18n}</a>
7   - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
  8 + {else}
  9 + <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span>
  10 + {/if}
  11 + | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
8 12 </div>
9 13 </dd>
... ...
templates/kt3/notifications/subscriptions.CheckOutDocument.smarty
... ... @@ -3,7 +3,11 @@
3 3 <!-- could break this up. -->
4 4 The document "{$info.object_name}" has been checked out, in the folder "{$info.location_name}".
5 5 <div class="actionoptions">
  6 + {if !$is_broken}
6 7 <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Document{/i18n}</a>
7   - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
  8 + {else}
  9 + <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span>
  10 + {/if}
  11 + | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
8 12 </div>
9 13 </dd>
... ...
templates/kt3/notifications/subscriptions.ModifyDocument.smarty
1 1 <dt class="actionitem subscription">{$info.title}</dt>
2 2 <dd class="actionmessage">
3 3 <!-- could break this up. -->
4   - The document "{$info.object_name}" has been changed in the folder "{$info.location_name}".
  4 + The document "{$info.object_name}" has been changed in the folder "{$info.location_name}". {$info.object}
5 5 <div class="actionoptions">
  6 + {if !$is_broken}
6 7 <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Document{/i18n}</a>
7   - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
  8 + {else}
  9 + <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span>
  10 + {/if}
  11 + | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
8 12 </div>
9 13 </dd>
... ...
templates/kt3/notifications/subscriptions.MoveDocument.smarty
... ... @@ -3,7 +3,12 @@
3 3 <!-- could break this up. -->
4 4 The document "{$info.object_name}" has been moved to the folder "{$info.location_name}".
5 5 <div class="actionoptions">
  6 + {if !$is_broken}
6 7 <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View New Location{/i18n}</a>
7   - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
  8 + {else}
  9 + <span class="descriptiveText">{i18n}Location is no longer available{/i18n}</span>
  10 + {/if}
  11 +
  12 + | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
8 13 </div>
9 14 </dd>
... ...
templates/kt3/notifications/subscriptions.RemoveChildDocument.smarty
... ... @@ -3,7 +3,12 @@
3 3 <!-- could break this up. -->
4 4 The document "{$info.object_name}" has been removed from the folder "{$info.location_name}", to which you are subscribed.
5 5 <div class="actionoptions">
  6 +
  7 + {if !$is_broken}
6 8 <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Folder{/i18n}</a>
7   - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
  9 + {else}
  10 + <span class="descriptiveText">{i18n}Folder is no longer available{/i18n}</span>
  11 + {/if}
  12 + | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
8 13 </div>
9 14 </dd>
... ...
templates/kt3/notifications/subscriptions.RemoveChildFolder.smarty
... ... @@ -3,7 +3,12 @@
3 3 <!-- could break this up. -->
4 4 The folder "{$info.object_name}" was removed{if ($info.location_name !== null)} from "{$info.location_name}"{/if}.
5 5 <div class="actionoptions">
6   - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Folder{/i18n}</a> |
7   - <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
  6 + {if !$is_broken}
  7 + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Folder{/i18n}</a>
  8 + {else}
  9 + <span class="descriptiveText">{i18n}Location is no longer available{/i18n}</span>
  10 + {/if}
  11 +
  12 + | <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
8 13 </div>
9 14 </dd>
... ...
templates/ktcore/action/rename.smarty
  1 +<h2>{i18n}Rename document{/i18n}</h2>
1 2 <p class="descriptiveText">{i18n}This page allows you to rename the file
2 3 name (not the document title) for a document.{/i18n}</p>
3 4  
4 5 {assign var=iDocumentId value=$context->oDocument->getId()}
5 6 {capture assign=link}{"viewDocument"|generateControllerUrl:"fDocumentId=$iDocumentId"}{/capture}
6   -<p class="descriptiveText">{i18n arg_link=$link}If you do not intend to
7   -rename this document, you should <a href="#link#">cancel the
8   -deletion</a>.{/i18n}</p>
9 7  
10 8 <form method="POST" action="{$smarty.server.PHP_SELF}">
11 9 <fieldset><legend>{i18n}Rename{/i18n}</legend>
... ...
templates/ktcore/dashlets/notifications.smarty
... ... @@ -13,7 +13,7 @@
13 13 <a href="{ktLink base="notify.php" query="clearAll=1"}"
14 14 class="ktAction ktInline ktDelete">{i18n}Clear all notifications{/i18n}</a>
15 15 <a href="{ktLink base="notify.php" query="clearAll=1"}"
16   - class="ktDelete">{i18n}Clear all notifications{/i18n}</a>
  16 + class="ktLinkDelete">{i18n}Clear all notifications{/i18n}</a>
17 17 {else}
18 18 <div class="ktInfo"><p>{i18n}No items require your attention.{/i18n}</p></div>
19 19 {/if}
... ...
templates/ktcore/folder/rename.smarty
... ... @@ -3,9 +3,6 @@ folder.{/i18n}&lt;/p&gt;
3 3  
4 4 {assign var=iFolderId value=$context->oFolder->getId()}
5 5 {capture assign=link}{getUrlForFolder folder=$iFolderId}{/capture}
6   -<p class="descriptiveText">{i18n arg_link=$link}If you do not intend to
7   -rename this document, you should <a href="#link#">cancel the
8   -deletion</a>.{/i18n}</p>
9 6  
10 7 <form method="POST" action="{$smarty.server.PHP_SELF}">
11 8 <fieldset><legend>{i18n}Rename{/i18n}</legend>
... ...
templates/ktcore/workflow/workflow_notification.smarty
... ... @@ -4,7 +4,11 @@
4 4 state <strong>#state#</strong>, and you are specified as one of the users to inform
5 5 about documents in this state.{/i18n}
6 6 <div class="actionoptions">
  7 + {if !$is_broken}
7 8 <a href="{ktLink base="notify.php" query="id=`$notify_id`"}">{i18n}View Document{/i18n}</a>
  9 + {else}
  10 + <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span>
  11 + {/if}
8 12 | <a href="{ktLink base="notify.php" query="id=`$notify_id`&notify_action=clear"}">{i18n}Clear Alert{/i18n}</a>
9 13 </div>
10 14 </dd>
... ...