Commit 5d2936d617568ce6e23ed747a1c455a83e09db21
1 parent
7c5945c8
- fix typo in subscription-display that caused significant degradation.
- fix manage to show folder subscriptions. - fix browse to have subscription portlet - fix documentFields to allow fieldset and field addition and editing. - fix fieldsetDisplay to not crash on metadata-lookups. - fix partialquery to not show multiple copies of a given file. - git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4453 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
10 changed files
with
19 additions
and
12 deletions
lib/browse/PartialQuery.inc.php
| ... | ... | @@ -222,7 +222,7 @@ class SimpleSearchQuery extends PartialQuery { |
| 222 | 222 | |
| 223 | 223 | function getDocumentCount() { |
| 224 | 224 | $aOptions = array( |
| 225 | - 'select' => 'count(D.id) AS cnt', | |
| 225 | + 'select' => 'count(DISTINCT D.id) AS cnt', | |
| 226 | 226 | ); |
| 227 | 227 | $aQuery = $this->getQuery($aOptions); |
| 228 | 228 | $iRet = DBUtil::getOneResultKey($aQuery, 'cnt'); |
| ... | ... | @@ -236,7 +236,7 @@ class SimpleSearchQuery extends PartialQuery { |
| 236 | 236 | // we also leak like ---- here, since getting the score is ... fiddly. and expensive. |
| 237 | 237 | function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { |
| 238 | 238 | $aOptions = array( |
| 239 | - 'select' => 'D.id AS id', | |
| 239 | + 'select' => 'DISTINCT D.id AS id', | |
| 240 | 240 | ); |
| 241 | 241 | list($sQuery, $aParams) = $this->getQuery($aOptions); |
| 242 | 242 | |
| ... | ... | @@ -299,7 +299,7 @@ class BooleanSearchQuery extends PartialQuery { |
| 299 | 299 | |
| 300 | 300 | function getDocumentCount() { |
| 301 | 301 | $aOptions = array( |
| 302 | - 'select' => 'count(D.id) AS cnt', | |
| 302 | + 'select' => 'count(DISTINCT D.id) AS cnt', | |
| 303 | 303 | ); |
| 304 | 304 | $aQuery = $this->getQuery($aOptions); |
| 305 | 305 | $iRet = DBUtil::getOneResultKey($aQuery, 'cnt'); |
| ... | ... | @@ -313,7 +313,7 @@ class BooleanSearchQuery extends PartialQuery { |
| 313 | 313 | // we also leak like ---- here, since getting the score is ... fiddly. and expensive. |
| 314 | 314 | function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { |
| 315 | 315 | $aOptions = array( |
| 316 | - 'select' => 'D.id AS id', | |
| 316 | + 'select' => 'DISTINCT D.id AS id', | |
| 317 | 317 | ); |
| 318 | 318 | list($sQuery, $aParams) = $this->getQuery($aOptions); |
| 319 | 319 | ... | ... |
lib/widgets/fieldsetDisplay.inc.php
| ... | ... | @@ -55,7 +55,7 @@ function getWidgetForMetadataField($field, $current_value, $page, $errors = null |
| 55 | 55 | // FIXME we need to somehow handle both value-value and id-value here |
| 56 | 56 | // extract the lookup. |
| 57 | 57 | if ($vocab === null) { // allow override |
| 58 | - $lookups = MetaData::getEnabledValuesByDocumentField($field); | |
| 58 | + $lookups = MetaData::getEnabledByDocumentField($field); | |
| 59 | 59 | $fieldOptions["vocab"] = array(); // FIXME handle lookups |
| 60 | 60 | foreach ($lookups as $md) { |
| 61 | 61 | $fieldOptions["vocab"][$md->getName()] = $md->getName(); | ... | ... |
plugins/ktcore/admin/documentFields.php
| ... | ... | @@ -57,6 +57,8 @@ class KTDocumentFieldDispatcher extends KTStandardDispatcher { |
| 57 | 57 | $editFieldset[] = new KTTextWidget('Description', _('A brief description of the information stored in this fieldset.'), 'description', $oFieldset->getDescription(), $this->oPage, true); |
| 58 | 58 | $createFields = array(); |
| 59 | 59 | $createFields[] = new KTStringWidget('Name', _('A human-readable name, used in add and edit forms.'), 'name',null, $this->oPage, true); |
| 60 | + $createFields[] = new KTTextWidget('Description', _('A brief description of the information stored in this field.'), 'description', null, $this->oPage, true); | |
| 61 | + | |
| 60 | 62 | |
| 61 | 63 | // type is a little more complex. |
| 62 | 64 | $vocab = array(); |
| ... | ... | @@ -118,12 +120,15 @@ class KTDocumentFieldDispatcher extends KTStandardDispatcher { |
| 118 | 120 | $sName = KTUtil::arrayGet($_REQUEST, 'name'); |
| 119 | 121 | $sName = $this->oValidator->notEmpty($sName); |
| 120 | 122 | $sNamespace = KTUtil::arrayGet($_REQUEST, 'namespace'); |
| 123 | + $sDescription = KTUtil::arrayGet($_REQUEST, 'description'); | |
| 124 | + $sDescription = $this->oValidator->notEmpty($sDescription); | |
| 121 | 125 | if (empty($sNamespace)) { |
| 122 | 126 | $sNamespace = KTUtil::nameToLocalNamespace('fieldsets', $sName); |
| 123 | 127 | } |
| 124 | 128 | $res = KTFieldset::createFromArray(array( |
| 125 | 129 | 'name' => $sName, |
| 126 | 130 | 'namespace' => $sNamespace, |
| 131 | + 'description' => $sDescription, | |
| 127 | 132 | 'mandatory' => false, |
| 128 | 133 | 'isconditional' => false, |
| 129 | 134 | 'isgeneric' => $bIsGeneric, |
| ... | ... | @@ -153,6 +158,7 @@ class KTDocumentFieldDispatcher extends KTStandardDispatcher { |
| 153 | 158 | $oField =& DocumentField::createFromArray(array( |
| 154 | 159 | 'name' => $_REQUEST['name'], |
| 155 | 160 | 'datatype' => 'STRING', |
| 161 | + 'description' => $_REQUEST['description'], | |
| 156 | 162 | 'haslookup' => $is_lookup, |
| 157 | 163 | 'haslookuptree' => $is_tree, |
| 158 | 164 | 'parentfieldset' => $oFieldset->getId(), | ... | ... |
presentation/lookAndFeel/knowledgeTree/browse.php
| ... | ... | @@ -46,7 +46,7 @@ $sectionName = "browse"; |
| 46 | 46 | |
| 47 | 47 | class BrowseDispatcher extends KTStandardDispatcher { |
| 48 | 48 | |
| 49 | - | |
| 49 | + var $oFolder = null; | |
| 50 | 50 | var $sSection = "browse"; |
| 51 | 51 | var $browse_mode = null; |
| 52 | 52 | var $query = null; |
| ... | ... | @@ -84,6 +84,7 @@ class BrowseDispatcher extends KTStandardDispatcher { |
| 84 | 84 | $folder_id = 1; |
| 85 | 85 | $oFolder =& Folder::get($folder_id); |
| 86 | 86 | } |
| 87 | + $this->oFolder =& $oFolder; | |
| 87 | 88 | |
| 88 | 89 | // we now have a folder, and need to create the query. |
| 89 | 90 | $this->oQuery = new BrowseQuery($oFolder->getId()); | ... | ... |
templates/kt3/notifications/subscriptions.CheckinDocument.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 checked in, in the folder "{info.location_name}". | |
| 4 | + The document "{$info.object_name}" has been checked in, in the folder "{$info.location_name}". | |
| 5 | 5 | <div class="actionoptions"> |
| 6 | 6 | <a href="{$absoluteRootUrl}/notify.php?id={$info.notify_id}">{i18n}View Document{/i18n}</a> |
| 7 | 7 | <a href="{$absoluteRootUrl}/notify.php?id={$info.notify_id}¬ify_action=clear">{i18n}Clear Alert{/i18n}</a> | ... | ... |
templates/kt3/notifications/subscriptions.CheckoutDocument.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 checked out, in the folder "{info.location_name}". | |
| 4 | + The document "{$info.object_name}" has been checked out, in the folder "{$info.location_name}". | |
| 5 | 5 | <div class="actionoptions"> |
| 6 | 6 | <a href="{$absoluteRootUrl}/notify.php?id={$info.notify_id}">{i18n}View Document{/i18n}</a> |
| 7 | 7 | <a href="{$absoluteRootUrl}/notify.php?id={$info.notify_id}¬ify_action=clear">{i18n}Clear Alert{/i18n}</a> | ... | ... |
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}". | |
| 5 | 5 | <div class="actionoptions"> |
| 6 | 6 | <a href="{$absoluteRootUrl}/notify.php?id={$info.notify_id}">{i18n}View Document{/i18n}</a> |
| 7 | 7 | <a href="{$absoluteRootUrl}/notify.php?id={$info.notify_id}¬ify_action=clear">{i18n}Clear Alert{/i18n}</a> | ... | ... |
templates/kt3/notifications/subscriptions.MoveDocument.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 moved to the folder "{info.location_name}". | |
| 4 | + The document "{$info.object_name}" has been moved to the folder "{$info.location_name}". | |
| 5 | 5 | <div class="actionoptions"> |
| 6 | 6 | <a href="{$absoluteRootUrl}/notify.php?id={$info.notify_id}">{i18n}View New Location{/i18n}</a> |
| 7 | 7 | <a href="{$absoluteRootUrl}/notify.php?id={$info.notify_id}¬ify_action=clear">{i18n}Clear Alert{/i18n}</a> | ... | ... |
templates/kt3/notifications/subscriptions.RemoveChildDocument.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 removed from the folder "{info.location_name}", to which you are subscribed. | |
| 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 | 6 | <a href="{$absoluteRootUrl}/notify.php?id={$info.notify_id}">{i18n}View Folder{/i18n}</a> |
| 7 | 7 | <a href="{$absoluteRootUrl}/notify.php?id={$info.notify_id}¬ify_action=clear">{i18n}Clear Alert{/i18n}</a> | ... | ... |
templates/ktstandard/subscriptions/manage.smarty
| ... | ... | @@ -21,7 +21,7 @@ subscribe.{/i18n}</p> |
| 21 | 21 | {/if} |
| 22 | 22 | |
| 23 | 23 | {if $aDocumentSubscriptions} |
| 24 | -{entity_checkboxes name="documentsubscriptions" entities=$aFolderSubscriptions method=getContentLink assign=aCheckboxes} | |
| 24 | +{entity_checkboxes name="documentsubscriptions" entities=$aDocumentSubscriptions method=getContentLink assign=aCheckboxes} | |
| 25 | 25 | {foreach from=$aCheckboxes item=oCheckbox} |
| 26 | 26 | {$oCheckbox}<br /> |
| 27 | 27 | {/foreach} | ... | ... |