Commit 9d35f5eab64bb7072ea1299dc6b62f972e7ef50d

Authored by Brad Shuttleworth
1 parent 6ae0be5e

- add a "secondary title" (or location aspect for title) to the templates

- improve titles for folder and document actions
- improve permission-denied pages
- add a "download" column to the browse view
- improve mime-type handling
- improve last-modified handling across versions
- make the comparison view highlight differences


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4868 c91229c3-7414-0410-bfa2-8a42b809f60b
browse.php
... ... @@ -103,6 +103,10 @@ class BrowseDispatcher extends KTStandardDispatcher {
103 103  
104 104 // here we need the folder object to do the breadcrumbs.
105 105 $oFolder =& Folder::get($folder_id);
  106 +
  107 + $this->oPage->setTitle(_('Browse'));
  108 + $this->oPage->setSecondaryTitle($oFolder->getName());
  109 +
106 110 $this->oFolder =& $oFolder;
107 111 if (PEAR::isError($oFolder)) {
108 112 $this->oPage->addError(_("invalid folder"));
... ... @@ -166,6 +170,7 @@ class BrowseDispatcher extends KTStandardDispatcher {
166 170  
167 171 $collection->addColumn(new SelectionColumn("Browse Selection","selection"));
168 172 $collection->addColumn(new TitleColumn("Test 1 (title)","title"));
  173 + $collection->addColumn(new DownloadColumn('','download'));
169 174 $collection->addColumn(new DateColumn(_("Created"),"created", "getCreatedDateTime"));
170 175 $collection->addColumn(new DateColumn(_("Last Modified"),"modified", "getLastModifiedDate"));
171 176 $collection->addColumn(new UserColumn(_('Creator'),'creator_id','getCreatorID'));
... ...
edit.php
... ... @@ -62,6 +62,11 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher {
62 62 );
63 63  
64 64 $this->aBreadcrumbs = array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForDocument($this->oDocument, $aOptions));
  65 +
  66 + if (!is_null($this->oDocument)) {
  67 + $this->oPage->setSecondaryTitle($this->oDocument->getName());
  68 + }
  69 +
65 70 }
66 71  
67 72 function errorPage($errorMessage) {
... ... @@ -81,7 +86,7 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher {
81 86 }
82 87  
83 88 $this->oDocument = $oDocument;
84   -
  89 + $this->addPortlets("Edit");
85 90 $this->addBreadcrumbs();
86 91 $this->oPage->setBreadcrumbDetails(_('Change Document Type'));
87 92  
... ...
lib/actions/documentaction.inc.php
... ... @@ -135,6 +135,8 @@ class KTDocumentAction extends KTStandardDispatcher {
135 135 $oPortlet = new KTActionPortlet(_("Document Actions"));
136 136 $oPortlet->setActions($actions, $this->sName);
137 137 $this->oPage->addPortlet($oPortlet);
  138 +
  139 + $this->oPage->setSecondaryTitle($this->oDocument->getName());
138 140  
139 141 return true;
140 142 }
... ...
lib/actions/folderaction.inc.php
... ... @@ -139,6 +139,8 @@ class KTFolderAction extends KTStandardDispatcher {
139 139 $portlet->setActions($aActions,null);
140 140 $this->oPage->addPortlet($portlet);
141 141  
  142 + $this->oPage->setSecondaryTitle($this->oFolder->getName());
  143 +
142 144 return true;
143 145 }
144 146  
... ...
lib/browse/BrowseColumns.inc.php
... ... @@ -129,6 +129,8 @@ class TitleColumn extends BrowseColumn {
129 129 }
130 130 }
131 131  
  132 +
  133 +
132 134 class DateColumn extends BrowseColumn {
133 135 var $field_function;
134 136  
... ... @@ -295,4 +297,29 @@ class WorkflowColumn extends BrowseColumn {
295 297 }
296 298 }
297 299  
  300 +class DownloadColumn extends BrowseColumn {
  301 +
  302 + function renderHeader($sReturnURL) {
  303 + $text = $this->label;
  304 +
  305 + return $text;
  306 + }
  307 +
  308 +
  309 + function renderData($aDataRow) {
  310 + $localname = $this->name;
  311 +
  312 +
  313 + // only _ever_ show this folder documents.
  314 + if ($aDataRow["type"] === "folder") {
  315 + return ' ';
  316 + }
  317 +
  318 + // FIXME at some point we may want to hide this if the user doens't have the download action, but its OK for now.
  319 + $link = KTUtil::ktLink('action.php','ktcore.actions.document.view', 'fDocumentId=' . $aDataRow['document']->getId());
  320 + $outStr = sprintf('<a href="%s" class="ktAction ktDownload" title="%s">%s</a>', $link, _('Download Document'), _('Download Document'));
  321 + return $outStr;
  322 + }
  323 +}
  324 +
298 325 ?>
... ...
lib/dispatcher.inc.php
... ... @@ -141,7 +141,16 @@ class KTStandardDispatcher extends KTDispatcher {
141 141 }
142 142  
143 143 function permissionDenied () {
144   - print "Permission denied";
  144 + global $default;
  145 +
  146 + $msg = '<h2>' . _('Permission Denied') . '</h2>';
  147 + $msg .= '<p>' . _('If you feel that this is incorrect, please report both the action and your username to a system administrator.') . '</p>';
  148 +
  149 + $this->oPage->setPageContents($msg);
  150 + $this->oPage->setUser($this->oUser);
  151 + $this->oPage->hideSection();
  152 +
  153 + $this->oPage->render();
145 154 exit(0);
146 155 }
147 156  
... ...
lib/templating/kt3template.inc.php
... ... @@ -12,6 +12,9 @@ require_once(KT_LIB_DIR . &quot;/templating/templating.inc.php&quot;);
12 12  
13 13 class KTPage {
14 14  
  15 + var $hide_section = false;
  16 + var $secondary_title = null;
  17 +
15 18 /** resources are "filename"->1 to allow subcomponents to require items. */
16 19 var $js_resources = Array();
17 20 var $css_resources = Array();
... ... @@ -230,6 +233,9 @@ class KTPage {
230 233 function setHasRequiredFields($appendix) { $this->addError($this->deprecationWarning . "called <strong>setHasRequiredFields (no-act)</strong>"); }
231 234 function setAdditionalJavascript($appendix) { $this->addError($this->deprecationWarning . "called <strong>setAdditionalJavascript (no-act)</strong>"); }
232 235  
  236 + function hideSection() { $this->hide_section = true; }
  237 + function setSecondaryTitle($sSecondary) { $this->secondary_title = $sSecondary; }
  238 +
233 239 /* final render call. */
234 240 function render() {
235 241  
... ...
lib/widgets/fieldsetDisplay.inc.php
... ... @@ -111,16 +111,19 @@ class KTFieldsetDisplay {
111 111 function _mimeHelper($iMimeTypeId) {
112 112 // FIXME lazy cache this.
113 113 // FIXME extend mime_types to have something useful to say.
114   - $sQuery = 'SELECT mimetypes FROM mime_types WHERE id = ?';
115   - $res = DBUtil::getOneResultKey(array($sQuery, array($iMimeTypeId)), 'mimetypes');
  114 + $sQuery = 'SELECT * FROM mime_types WHERE id = ?';
  115 + $res = DBUtil::getOneResult(array($sQuery, array($iMimeTypeId)));
116 116  
117 117 if (PEAR::isError($res)) {
118 118 return _('unknown type');
119 119 }
120   - if (empty($res)) {
121   - return _('unknown type');
122   - }
123   - return $res;
  120 +
  121 + if (!empty($res['friendly_name'])) {
  122 + return _($res['friendly_name']);
  123 + } else {
  124 + return sprintf('%s File', $res['filetypes']);
  125 + }
  126 +
124 127 }
125 128  
126 129  
... ... @@ -217,8 +220,8 @@ class GenericFieldsetDisplay extends KTFieldsetDisplay {
217 220 $creation_date = $this->_dateHelper($document->getCreatedDateTime());
218 221  
219 222 // last mod
220   - $last_modified_date = $this->_dateHelper($document->getLastModifiedDate());
221   - $comparison_last_modified_date = $this->_dateHelper($comparison_document->getLastModifiedDate());
  223 + $last_modified_date = $this->_dateHelper($document->getVersionCreated());
  224 + $comparison_last_modified_date = $this->_dateHelper($comparison_document->getVersionCreated());
222 225  
223 226 // document type // FIXME move this to view.php
224 227 $document_type = $aDocumentData["document_type"]->getName();
... ... @@ -226,10 +229,12 @@ class GenericFieldsetDisplay extends KTFieldsetDisplay {
226 229  
227 230 $modified_user =& User::get($document->getModifiedUserId());
228 231 if (PEAR::isError($modified_user)) {
229   - $modified_user = "<span class='ktError'>" . _("Unable to find the document's creator") . "</span>";
  232 + $modified_user = "<span class='ktError'>" . _("Unable to find the document's modifier") . "</span>";
230 233 } else {
231 234 $modified_user = $modified_user->getName();
232 235 }
  236 +
  237 +
233 238  
234 239 $comparison_modified_user =& User::get($comparison_document->getModifiedUserId());
235 240 if (PEAR::isError($comparison_modified_user)) {
... ... @@ -260,8 +265,8 @@ class GenericFieldsetDisplay extends KTFieldsetDisplay {
260 265 "last_modified_by" => $modified_user,
261 266 "last_modified_date" => $last_modified_date,
262 267  
263   - "comparison_last_modified_by" => "<span class='ktInlineError'><strong>fixme</strong> extract the last participant</span>",
264   - "comparison_last_modified_date" => $last_modified_date,
  268 + "comparison_last_modified_by" => $comparison_modified_user,
  269 + "comparison_last_modified_date" => $comparison_last_modified_date,
265 270  
266 271 "document_type" => $document_type,
267 272 "comparison_document_type" => $comparison_document_type,
... ...
presentation/lookAndFeel/knowledgeTree/noAccess.php
... ... @@ -25,7 +25,13 @@
25 25 */
26 26  
27 27 require_once("../../../config/dmsDefaults.php");
28   -echo "<center><b>" . _("You do not have permission to access this page.") . "<br>";
29   -echo "<a href=\"javascript:history.go(-1)\">" . _("Back") . "</a> OR " . generateControllerLink("logout", "", _("logout"));
30   -echo "</b></center>";
  28 +require_once(KT_LIB_DIR . "/dispatcher.inc.php");
  29 +
  30 +class BlockDispatcher extends KTStandardDispatcher {
  31 + function check() { return false; }
  32 +}
  33 +
  34 +$oD =& new BlockDispatcher();
  35 +$oD->dispatch();
  36 +
31 37 ?>
... ...
resources/css/kt-framing.css
... ... @@ -480,6 +480,10 @@ a.main_nav_item {
480 480 display: block;
481 481 border-width: 1px;
482 482 }
  483 +.metadata.versioned dd .current.different {
  484 + padding-left: 25px;
  485 + background: transparent url(../../thirdparty/icon-theme/16x16/status/dialog-information.png) center left no-repeat;
  486 +}
483 487  
484 488 .document_details .document_history thead th {
485 489 text-align: left;
... ... @@ -633,7 +637,6 @@ a.main_nav_item {
633 637 margin: 0.5em;
634 638 }
635 639  
636   -
637 640 /* ========== kt actions
638 641  
639 642 These are used to mark up various different "actions" (e.g. cut, copy, delete).
... ... @@ -691,6 +694,7 @@ The text will be hidden for screen view. The generic fahrner-ish approach comes
691 694 .ktActionLink.ktAddUser, .ktAction.ktAddUser { background: transparent url(../../thirdparty/icon-theme/16x16/actions/contact-new.png) top left no-repeat; }
692 695 .ktActionLink.ktAddGroup, .ktAction.ktAddGroup { background: transparent url(../../thirdparty/icon-theme/16x16/actions/group-new.png) top left no-repeat; }
693 696 .ktActionLink.ktAdd, .ktAction.ktAdd { background: transparent url(../../thirdparty/icon-theme/16x16/actions/add.png) top left no-repeat; }
  697 +.ktActionLink.ktDownload, .ktAction.ktDownload { background: transparent url(../../resources/graphics/download.png) top left no-repeat; }
694 698  
695 699 /* =========== standard listings. */
696 700  
... ...
templates/kt3/fieldsets/generic_versioned.smarty
... ... @@ -7,14 +7,18 @@
7 7 <dl class="metadata versioned">
8 8 <dt>{i18n}Document Filename{/i18n}</dt>
9 9 <dd>
10   - <div class="current">{$filename} ({$context->_sizeHelper($document->getSize())})</div>
11   - <div class="previous">{$comparison_filename} ({$context->_sizeHelper($comparison_document->getSize())})</div>
  10 + {capture assign="oldval"}{$comparison_filename} ({$context->_sizeHelper($comparison_document->getSize())}){/capture}
  11 + {capture assign="newval"}{$filename} ({$context->_sizeHelper($document->getSize())}){/capture}
  12 + <div class="current {if ($oldval != $newval)}different{/if}">{$newval}</div>
  13 + <div class="previous">{$oldval}</div>
12 14 </dd>
13 15  
14 16 <dt>{i18n}File is a{/i18n} </dt>
15 17 <dd>
16   - <div class="current">{$context->_mimeHelper($document->getMimeTypeID())}</div>
17   - <div class="previous">{$context->_mimeHelper($comparison_document->getMimeTypeID())}</div>
  18 + {capture assign="oldval"}{$context->_mimeHelper($comparison_document->getMimeTypeID())}{/capture}
  19 + {capture assign="newval"}{$context->_mimeHelper($document->getMimeTypeID())}{/capture}
  20 + <div class="current {if ($oldval != $newval)}different{/if}">{$newval}</div>
  21 + <div class="previous">{$oldval}</div>
18 22 </dd>
19 23  
20 24 <dt>{i18n}Created by{/i18n}</dt>
... ... @@ -24,33 +28,35 @@
24 28  
25 29 <dt>{i18n}Last update by{/i18n}</dt>
26 30 <dd>
27   - <div class="current">{$last_modified_by} ({$last_modified_date})</div>
28   - <div class="previous">{$last_modified_by} ({$comparison_last_modified_date})</div>
  31 + {capture assign="oldval"}{$comparison_last_modified_by} ({$comparison_last_modified_date}){/capture}
  32 + {capture assign="newval"}{$last_modified_by} ({$last_modified_date}){/capture}
  33 + <div class="current {if ($oldval != $newval)}different{/if}">{$newval}</div>
  34 + <div class="previous">{$oldval}</div>
29 35 </dd>
30 36  
31 37  
32 38 <dt>{i18n}Document Type{/i18n}</dt>
33 39 <dd>
34   - <div class="current">{$document_type}</div>
35   - <div class="previous">{$comparison_document_type}</div>
  40 + {capture assign="oldval"}{$comparison_document_type}{/capture}
  41 + {capture assign="newval"}{$document_type}{/capture}
  42 + <div class="current {if ($oldval != $newval)}different{/if}">{$newval}</div>
  43 + <div class="previous">{$oldval}</div>
36 44 </dd>
37 45  
38 46 <dt>{i18n}Workflow status{/i18n}</dt>
39 47 <dd>
40   - <div class="current">
41   -{if $workflow_state}
42   -{$workflow_state->getName()}
  48 + {capture assign="oldval"}{if $comparison_workflow_state}
  49 +{$comparison_workflow_state->getName()}
43 50 {else}
44 51 {i18n}No workflow{/i18n}
45   -{/if}
46   -</div>
47   - <div class="previous">
48   -{if $comparison_workflow_state}
49   -{$comparison_workflow_state->getName()}
  52 +{/if}{/capture}
  53 + {capture assign="newval"}{if $workflow_state}
  54 +{$workflow_state->getName()}
50 55 {else}
51 56 {i18n}No workflow{/i18n}
52   -{/if}
53   -</div>
  57 +{/if}{/capture}
  58 + <div class="current {if ($oldval != $newval)}different{/if}">{$newval}</div>
  59 + <div class="previous">{$oldval}</div>
54 60 </dd>
55 61  
56 62 </dl>
... ...
templates/kt3/fieldsets/simple_versioned.smarty
... ... @@ -11,7 +11,7 @@
11 11 <dl class="metadata versioned">
12 12 {foreach item=aFieldPair from=$fieldset_values}
13 13 <dt>{$aFieldPair.field->getName()}</dt>
14   - <dd><div class="current">
  14 + <dd><div class="current {if ($aFieldPair.current_value != $aFieldPair.previous_value)}different{/if}">
15 15 {if ($aFieldPair.current_value !== null)}{$aFieldPair.current_value}
16 16 {else}<span class="ktInlineError">no value in this version</span>{/if}
17 17 </div><div class="previous">
... ...
templates/kt3/standard_page.smarty
... ... @@ -2,7 +2,7 @@
2 2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 3 <html>
4 4 <head>
5   - <title>{$page->title} | {$page->systemName}</title>
  5 + <title>{$page->title}{if ($page->secondary_title != null)} &mdash; {$page->secondary_title}{/if} | {$page->systemName}</title>
6 6  
7 7 <!-- CSS Files. -->
8 8  
... ... @@ -83,6 +83,7 @@
83 83 </ul>
84 84 </div>
85 85  
  86 +{if (!$page->hide_section)}
86 87 <div id="breadcrumbs">
87 88 <span class="additional">{i18n}You are here{/i18n}: </span>
88 89 {if ($page->breadcrumbSection !== false)}
... ... @@ -111,7 +112,7 @@
111 112 <span class="additional">({$page->breadcrumbDetails})</span>
112 113 {/if}
113 114 </div>
114   -
  115 +{/if}
115 116 <div id="kt-wrapper">
116 117 <div id="portletbar">
117 118  
... ... @@ -128,11 +129,11 @@
128 129  
129 130 </div>
130 131 <div id="content">
131   -
  132 +{if (!$page->hide_section)}
132 133 <h1 class="{$page->componentClass}"><span class="fahrner">{$page->componentLabel}</span>
133 134 {if ($page->getHelpURL() != null)} <a class="ktHelp" href="{$page->getHelpURL()}">Help</a> {/if}
134 135 </h1>
135   -
  136 +{/if}
136 137 <!-- any status / error messages get added here. -->
137 138 {if (!empty($page->errStack))}
138 139 <div class="ktError">
... ...
templates/ktcore/action/addFolder.smarty
  1 +<h2>{i18n}Add a folder{/i18n}</h2>
  2 +
1 3 <p class="descriptiveText">{i18n}Folders are one way of organising documents
2 4 in the document management system. Folders provide meaning in the
3 5 traditional file storage way - through a file path.{/i18n}</p>
... ...
view.php
... ... @@ -71,6 +71,8 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
71 71 return $this->do_error();
72 72 }
73 73  
  74 + $this->oPage->setSecondaryTitle($oDocument->getName());
  75 +
74 76 $aOptions = array(
75 77 "documentaction" => "viewDocument",
76 78 "folderaction" => "browse",
... ... @@ -167,6 +169,9 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
167 169 // fixme check perms
168 170  
169 171 $this->oDocument =& $oDocument;
  172 +
  173 + $this->oPage->setSecondaryTitle($oDocument->getName());
  174 +
170 175 $aOptions = array("final" => false);
171 176 $this->aBreadcrumbs = array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForDocument($oDocument, $aOptions));
172 177 $this->oPage->setBreadcrumbDetails(_("history"));
... ... @@ -191,7 +196,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
191 196  
192 197  
193 198 // render pass.
194   - $this->oPage->title = _("Document History") . " : " . $oDocument->getName();
  199 + $this->oPage->title = _("Document History");
195 200 $oTemplating = new KTTemplating;
196 201 $oTemplate = $oTemplating->loadTemplate("kt3/view_document_history");
197 202 $aTemplateData = array(
... ... @@ -221,7 +226,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
221 226 return $this->do_error();
222 227 }
223 228 // fixme check perms
224   -
  229 + $this->oPage->setSecondaryTitle($oDocument->getName());
225 230 $this->oDocument =& $oDocument;
226 231 $this->aBreadcrumbs = array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForDocument($oDocument));
227 232 $this->oPage->setBreadcrumbDetails(_("history"));
... ... @@ -234,7 +239,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
234 239 }
235 240  
236 241 // render pass.
237   - $this->oPage->title = _("Document History") . " : " . $oDocument->getName();
  242 + $this->oPage->title = _("Document History");
238 243 $oTemplating = new KTTemplating;
239 244 $oTemplate = $oTemplating->loadTemplate("kt3/document/metadata_history");
240 245  
... ... @@ -281,6 +286,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
281 286 return $this->do_error();
282 287 }
283 288 $this->oDocument =& $oDocument;
  289 + $this->oPage->setSecondaryTitle($oDocument->getName());
284 290 $aOptions = array("final" => false);
285 291 $this->aBreadcrumbs = array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForDocument($oDocument, $aOptions));
286 292 $this->oPage->setBreadcrumbDetails(_("compare versions"));
... ... @@ -414,6 +420,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
414 420 return $this->do_error();
415 421 }
416 422 $this->oDocument =& $oDocument;
  423 + $this->oPage->setSecondaryTitle($oDocument->getName());
417 424 $aOptions = array("final" => false);
418 425 $this->aBreadcrumbs = array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForDocument($oDocument, $aOptions));
419 426 $this->oPage->setBreadcrumbDetails(_("Select Document Version to compare against"));
... ...