Commit e3b539cbe69cab031e2d9bc83b4255a777c66b8a

Authored by Brad Shuttleworth
1 parent 741da2be

- add delete page.

- KTS-167:  Unable to create workflow.
- some actions are _always_ available.
- spacing prevents title from overlapping other columns
- KTS-163: add a "workflow" column to the browse page
- improve titling on search / saved search
- KTS-143: fields need validation.
- KTS-103: change all "the KnowledgeTree" to "KnowledgeTree".


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4619 c91229c3-7414-0410-bfa2-8a42b809f60b
browse.php
... ... @@ -137,6 +137,7 @@ class BrowseDispatcher extends KTStandardDispatcher {
137 137 $collection->addColumn(new DateColumn(_("Created"),"created", "getCreatedDateTime"));
138 138 $collection->addColumn(new DateColumn(_("Last Modified"),"modified", "getLastModifiedDate"));
139 139 $collection->addColumn(new UserColumn(_('Creator'),'creator_id','getCreatorID'));
  140 + $collection->addColumn(new WorkflowColumn(_('Workflow State'),'workflow_state'));
140 141  
141 142  
142 143 // setup the folderside add actions
... ...
lib/actions/folderaction.inc.php
... ... @@ -11,6 +11,8 @@ class KTFolderAction extends KTStandardDispatcher {
11 11  
12 12 var $_sShowPermission;
13 13 var $_sDisablePermission;
  14 +
  15 + var $_adminAlwaysAvailable = false;
14 16  
15 17 var $_bDisabled;
16 18 var $_sDisabledText = null;
... ... @@ -44,7 +46,7 @@ class KTFolderAction extends KTStandardDispatcher {
44 46 if (PEAR::isError($oPermission)) {
45 47 return true;
46 48 }
47   - return KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oFolder);
  49 + return (KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oFolder) || (($this->_adminAlwaysAvailable) && (Permission::userIsSystemAdministrator($this->oUser->getId()))));
48 50 }
49 51  
50 52 function _disable() {
... ... @@ -115,7 +117,7 @@ class KTFolderAction extends KTStandardDispatcher {
115 117 if (!is_null($this->_sShowPermission)) {
116 118 $oPermission =& KTPermission::getByName($this->_sShowPermission);
117 119 if (!PEAR::isError($oPermission)) {
118   - $res = KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oFolder);
  120 + $res = (KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oFolder) || (($this->_adminAlwaysAvailable) && (Permission::userIsSystemAdministrator($this->oUser->getId()))));
119 121 if (!$res) {
120 122 return false;
121 123 }
... ...
lib/browse/BrowseColumns.inc.php
... ... @@ -14,6 +14,10 @@
14 14  
15 15 require_once(KT_LIB_DIR . "/database/dbutil.inc");
16 16 require_once(KT_LIB_DIR . '/users/User.inc');
  17 +
  18 +require_once(KT_LIB_DIR . '/workflow/workflowutil.inc.php');
  19 +
  20 +
17 21 class BrowseColumn {
18 22 var $label = null;
19 23 var $sort_on = false;
... ... @@ -252,4 +256,35 @@ class SelectionColumn extends BrowseColumn {
252 256 }
253 257 }
254 258  
  259 +
  260 +class WorkflowColumn extends BrowseColumn {
  261 +
  262 + function renderHeader($sReturnURL) {
  263 + $text = $this->label;
  264 + $href = $sReturnURL . "&sort_on=" . $this->name . "&sort_order=";
  265 + $href .= $this->sort_direction == "asc" ? "desc" : "asc" ;
  266 +
  267 + return '<a href="' . $href . '">'.$text.'</a>';
  268 + }
  269 +
  270 + // use inline, since its just too heavy to even _think_ about using smarty.
  271 + function renderData($aDataRow) {
  272 + $localname = $this->name;
  273 +
  274 +
  275 + // only _ever_ show this folder documents.
  276 + if ($aDataRow["type"] === "folder") {
  277 + return '&nbsp;';
  278 + }
  279 +
  280 + $oWorkflow = KTWorkflowUtil::getWorkflowForDocument($aDataRow['document']);
  281 + $oState = KTWorkflowUtil::getWorkflowStateForDocument($aDataRow['document']);
  282 + if (($oState == null) || ($oWorkflow == null)) {
  283 + return '&mdash;';
  284 + } else {
  285 + return $oState->getName() . ' <span class="descriptiveText">(' . $oWorkflow->getName() . ')</span>';
  286 + }
  287 + }
  288 +}
  289 +
255 290 ?>
... ...
lib/validation/dispatchervalidation.inc.php
... ... @@ -311,8 +311,9 @@ class KTDispatcherValidation {
311 311 $aNewOptions = $aOptions;
312 312 $aNewOptions['message'] = KTUtil::arrayGet($aOptions, 'message', _("No name was given for the $sHumanEntityTypeName"));
313 313  
  314 + // FIXME BD: don't you mean $sName = $this->validateString ...
314 315 $this->validateString($sName, $aNewOptions);
315   - $this->validateDuplicateName($sEntityTypeName, $sHumanEntityTypeName, $sName, $aOptions);
  316 + return $this->validateDuplicateName($sEntityTypeName, $sHumanEntityTypeName, $sName, $aOptions);
316 317 }
317 318  
318 319  
... ...
lib/widgets/fieldsetDisplay.inc.php
... ... @@ -275,7 +275,7 @@ class GenericFieldsetDisplay extends KTFieldsetDisplay {
275 275 function renderEdit($document_data) {
276 276 global $main; // FIXME remove direct access to $main
277 277 $oField = new KTBaseWidget("Document Title",
278   - _("The document title is used as the main name of a document through the KnowledgeTree."),
  278 + _("The document title is used as the main name of a document throughout KnowledgeTree&trade;."),
279 279 "generic_title", $document_data["document"]->getName(), $main, true, null, array());
280 280 $aFields = array($oField); // its the only one editable from the basic set (currently).
281 281  
... ... @@ -285,7 +285,7 @@ class GenericFieldsetDisplay extends KTFieldsetDisplay {
285 285 "context" => $this,
286 286 "fields" => $aFields,
287 287 "title" => "Generic Document Information",
288   - "description" => _("The information in this section is stored by the KnowledgeTree&trade; for every document."),
  288 + "description" => _("The information in this section is stored by KnowledgeTree&trade; for every document."),
289 289 );
290 290 return $oTemplate->render($aTemplateData);
291 291 }
... ...
plugins/ktcore/KTFolderActions.php
... ... @@ -58,6 +58,7 @@ class KTFolderPermissionsAction extends KTFolderAction {
58 58 var $sName = 'ktcore.actions.folder.permissions';
59 59  
60 60 var $_sShowPermission = "ktcore.permissions.write";
  61 + var $_adminAlwaysAvailable = true;
61 62 var $bAutomaticTransaction = true;
62 63  
63 64 function do_main() {
... ...
plugins/ktcore/admin/documentFields.php
... ... @@ -155,6 +155,10 @@ class KTDocumentFieldDispatcher extends KTStandardDispatcher {
155 155  
156 156 // {{{ do_newfield
157 157 function do_newfield() {
  158 + $aErrorOptions = array(
  159 + 'redirect_to' => array('edit','fFieldsetId=' . $_REQUEST['fFieldsetId']),
  160 + );
  161 +
158 162 $is_lookup = false;
159 163 $is_tree = false;
160 164 if ($_REQUEST['type'] === "lookup") {
... ... @@ -164,11 +168,18 @@ class KTDocumentFieldDispatcher extends KTStandardDispatcher {
164 168 $is_lookup = true;
165 169 $is_tree = true;
166 170 }
  171 +
  172 + $sName = $this->oValidator->validateEntityName("DocumentField", "field", KTUtil::arrayGet($_REQUEST, 'name'), $aErrorOptions);
  173 +
  174 + $sDescription = $this->oValidator->validateString(KTUtil::arrayGet($_REQUEST, 'description'),
  175 + KTUtil::meldOptions($aErrorOptions, array('message' => "You must provide a description")));
  176 +
  177 +
167 178 $oFieldset = KTFieldset::get($_REQUEST['fFieldsetId']);
168 179 $oField =& DocumentField::createFromArray(array(
169 180 'name' => $_REQUEST['name'],
170 181 'datatype' => 'STRING',
171   - 'description' => $_REQUEST['description'],
  182 + 'description' => $sDescription,
172 183 'haslookup' => $is_lookup,
173 184 'haslookuptree' => $is_tree,
174 185 'parentfieldset' => $oFieldset->getId(),
... ...
plugins/ktcore/admin/userManagement.php
... ... @@ -63,7 +63,7 @@ class KTUserAdminDispatcher extends KTAdminDispatcher {
63 63  
64 64  
65 65 $add_fields = array();
66   - $add_fields[] = new KTStringWidget(_('Username'),_('The username the user will enter to gain access to the KnowledgeTree. e.g. <strong>jsmith</strong>'), 'username', null, $this->oPage, true, null, null, $aOptions);
  66 + $add_fields[] = new KTStringWidget(_('Username'),_('The username the user will enter to gain access to KnowledgeTree. e.g. <strong>jsmith</strong>'), 'username', null, $this->oPage, true, null, null, $aOptions);
67 67 $add_fields[] = new KTStringWidget(_('Name'),_('The full name of the user. This is shown in reports and listings. e.g. <strong>John Smith</strong>'), 'name', null, $this->oPage, true, null, null, $aOptions);
68 68 $add_fields[] = new KTStringWidget(_('Email Address'), _('The email address of the user. Notifications and alerts are mailed to this address if <strong>email notifications</strong> is set below. e.g. <strong>jsmith@acme.com</strong>'), 'email_address', null, $this->oPage, false, null, null, $aOptions);
69 69 $add_fields[] = new KTCheckboxWidget(_('Email Notifications'), _("If this is specified then the user will have notifications sent to the email address entered above. If it isn't set, then the user will only see notifications on the <strong>Dashboard</strong>"), 'email_notifications', true, $this->oPage, false, null, null, $aOptions);
... ... @@ -117,7 +117,7 @@ class KTUserAdminDispatcher extends KTAdminDispatcher {
117 117 $this->aBreadcrumbs[] = array('name' => $oUser->getName());
118 118  
119 119 $edit_fields = array();
120   - $edit_fields[] = new KTStringWidget(_('Username'),_('The username the user will enter to gain access to the KnowledgeTree. e.g. <strong>jsmith</strong>'), 'username', $oUser->getUsername(), $this->oPage, true);
  120 + $edit_fields[] = new KTStringWidget(_('Username'),_('The username the user will enter to gain access to KnowledgeTree. e.g. <strong>jsmith</strong>'), 'username', $oUser->getUsername(), $this->oPage, true);
121 121 $edit_fields[] = new KTStringWidget(_('Name'), _('The full name of the user. This is shown in reports and listings. e.g. <strong>John Smith</strong>'), 'name', $oUser->getName(), $this->oPage, true);
122 122 $edit_fields[] = new KTStringWidget(_('Email Address'),_('The email address of the user. Notifications and alerts are mailed to this address if <strong>email notifications</strong> is set below. e.g. <strong>jsmith@acme.com</strong>'), 'email_address', $oUser->getEmail(), $this->oPage, false);
123 123 $edit_fields[] = new KTCheckboxWidget(_('Email Notifications'), _('If this is specified then the user will have notifications sent to the email address entered above. If it is not set, then the user will only see notifications on the <strong>Dashboard</strong>'), 'email_notifications', $oUser->getEmailNotification(), $this->oPage, false);
... ...
plugins/ktcore/folder/addDocument.php
... ... @@ -41,7 +41,7 @@ class KTFolderAddDocumentAction extends KTFolderAction {
41 41 $oTemplate =& $this->oValidator->validateTemplate('ktcore/document/add');
42 42 $add_fields = array();
43 43 $add_fields[] = new KTFileUploadWidget(_('File'), _('The contents of the document to be added to the document management system.'), 'file', "", $this->oPage, true);
44   - $add_fields[] = new KTStringWidget(_('Title'), _('The document title is used as the main name of a document through the KnowledgeTree.'), 'title', "", $this->oPage, true);
  44 + $add_fields[] = new KTStringWidget(_('Title'), _('The document title is used as the main name of a document throughout KnowledgeTree.'), 'title', "", $this->oPage, true);
45 45  
46 46  
47 47 $aVocab = array();
... ...
plugins/ktstandard/ldap/ldapauthenticationprovider.inc.php
... ... @@ -137,7 +137,7 @@ class KTLDAPAuthenticationProvider extends KTAuthenticationProvider {
137 137  
138 138 $fields = array();
139 139 $fields[] = new KTStaticTextWidget(_('LDAP DN'), _('The location of the user within the LDAP directory.'), 'dn', $aResults[$aAttributes[0]], $this->oPage);
140   - $fields[] = new KTStringWidget(_('Username'), _('The username the user will enter to gain access to the KnowledgeTree. e.g. <strong>jsmith</strong>'), 'ldap_username', $aResults[$aAttributes[1]], $this->oPage, true);
  140 + $fields[] = new KTStringWidget(_('Username'), _('The username the user will enter to gain access to KnowledgeTree. e.g. <strong>jsmith</strong>'), 'ldap_username', $aResults[$aAttributes[1]], $this->oPage, true);
141 141 $fields[] = new KTStringWidget(_('Name'), _('The full name of the user. This is shown in reports and listings. e.g. <strong>John Smith</strong>'), 'name', join(" ", array($aResults[$aAttributes[2]], $aResults[$aAttributes[3]])), $this->oPage, true);
142 142 $fields[] = new KTStringWidget(_('Email Address'), _('The email address of the user. Notifications and alerts are mailed to this address if <strong>email notifications</strong> is set below. e.g. <strong>jsmith@acme.com</strong>'), 'email_address', $aResults[$aAttributes[4]], $this->oPage, false);
143 143 $fields[] = new KTCheckboxWidget(_('Email Notifications'), _('If this is specified then the user will have notifications sent to the email address entered above. If it is not set, then the user will only see notifications on the <strong>Dashboard</strong>'), 'email_notifications', true, $this->oPage, false);
... ...
resources/css/kt-contenttypes.css
... ... @@ -10,6 +10,7 @@
10 10 padding-left: 25px;
11 11 padding-top: 5px;
12 12 padding-bottom: 5px;
  13 + margin-right: 25px;
13 14 }
14 15  
15 16 .contenttype.ms-presentation { background-image: url(../../resources/mimetypes/powerp.gif); }
... ...
resources/css/kt-framing.css
... ... @@ -432,6 +432,7 @@ a.main_nav_item {
432 432 }
433 433  
434 434 .metadata.versioned dd div {
  435 +
435 436 padding: 0.2em 0.5em;
436 437 border-style: solid;
437 438 border-color: #ccc;
... ... @@ -507,11 +508,13 @@ a.main_nav_item {
507 508 .kt_collection
508 509 {
509 510 width: 100%;
  511 + white-space: nowrap !important;
510 512 }
511 513  
512 514 .kt_collection thead th {
513 515 border-bottom: 1px solid #888;
514 516 text-align: left;
  517 + white-space: nowrap !important;
515 518 }
516 519  
517 520 .kt_collection th.sort_on.sort_asc {
... ... @@ -531,6 +534,8 @@ a.main_nav_item {
531 534 .kt_collection th,
532 535 .kt_collection td {
533 536 padding: 0.25em 0.5em;
  537 + white-space: nowrap !important;
  538 + overflow: hidden;
534 539 }
535 540  
536 541 .kt_collection td.sort_on {
... ...
resources/js/toggleselect.js 0 → 100644
  1 +function toggleSelectFor(source, nameprefix) {
  2 + var content = getElement('content');
  3 +
  4 + var state = source.checked;
  5 +
  6 + // now: find other items like the stated one (IN id=content)
  7 + var inputs = content.getElementsByTagName('INPUT');
  8 + for (var i=0; i<inputs.length; i++) {
  9 + var c = inputs[i];
  10 + var n = c.name;
  11 + if (c.type == 'checkbox') {
  12 + if ((n.length >= nameprefix.length) && (nameprefix == n.substring(0,nameprefix.length))) {
  13 + c.checked = state;
  14 + }
  15 + }
  16 + }
  17 +}
... ...
search/booleanSearch.php
... ... @@ -25,7 +25,7 @@ class BooleanSearchDispatcher extends KTStandardDispatcher {
25 25 }
26 26  
27 27 function do_main() {
28   - $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _("Boolean search"));
  28 + $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _("Advanced Search"));
29 29 $this->oPage->setBreadcrumbDetails(_('defining search'));
30 30 $oTemplating = new KTTemplating;
31 31 $oTemplate = $oTemplating->loadTemplate("ktcore/boolean_search");
... ... @@ -40,7 +40,7 @@ class BooleanSearchDispatcher extends KTStandardDispatcher {
40 40 }
41 41  
42 42 function do_performSearch() {
43   - $title = _('Advanced Search Results');
  43 + $title = null;
44 44 $datavars = KTUtil::arrayGet($_REQUEST, 'boolean_search');
45 45 if (!is_array($datavars)) {
46 46 $datavars = unserialize($datavars);
... ... @@ -53,7 +53,7 @@ class BooleanSearchDispatcher extends KTStandardDispatcher {
53 53 if (!empty($iSavedSearchId)) {
54 54 $oSearch = KTSavedSearch::get($iSavedSearchId);
55 55 $datavars = $oSearch->getSearch();
56   - $title = _('Saved Search: ') . $oSearch->getName();
  56 + $title = $oSearch->getName();
57 57 }
58 58  
59 59 if (empty($datavars)) {
... ... @@ -66,12 +66,16 @@ class BooleanSearchDispatcher extends KTStandardDispatcher {
66 66 }
67 67  
68 68 function handleCriteriaSet($aCriteriaSet, $iStartIndex, $sTitle=null) {
69   - $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _("Boolean search"));
  69 +
70 70 if ($sTitle == null) {
71   - $this->oPage->setBreadcrumbDetails(_('searching'));
  71 + $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _('Advanced Search'));
  72 + $sTitle = _('Search Results');
72 73 } else {
73   - $this->oPage->setBreadcrumbDetails($sTitle);
  74 + $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _('Saved Search'));
  75 + $this->oPage->setTitle(_('Saved Search: ') . $sTitle);
74 76 }
  77 + $this->oPage->setBreadcrumbDetails($sTitle);
  78 +
75 79 $collection = new DocumentCollection;
76 80 $this->browseType = "Folder";
77 81  
... ...
templates/ktcore/folder/mass_delete.smarty 0 → 100644
  1 +<h2>{i18n}Delete Files and Folders{/i18n}</h2>
  2 +
  3 +<form action="{$smarty.server.PHP_SELF}" method="POST">
  4 +<fieldset>
  5 +<legend>{i18n}Specify Reason for Delete{/i18n}</legend>
  6 +<p class="descriptiveText">{i18n}Please give a reason for deleting these files. This
  7 +will be recorded in the documents' "Transaction History"{/i18n}</p>
  8 +<input type="hidden" name="action" value="doDelete" />
  9 +
  10 +{* Include the document/folder ids *}
  11 +
  12 +{foreach item=iDocId from=$documents}
  13 +<input type="hidden" name="selection_d[]" value="{$iDocId}" />
  14 +{/foreach}
  15 +
  16 +{foreach item=iFolderId from=$folders}
  17 +<input type="hidden" name="selection_f[]" value="{$iFolderId}" />
  18 +{/foreach}
  19 +
  20 +{foreach item=oWidget from=$form_fields}
  21 +{$oWidget->render()}
  22 +{/foreach}
  23 +
  24 +<div class="form_actions">
  25 + <input type="submit" value="Delete" />
  26 +</div>
  27 +
  28 +</fieldset>
  29 +</form>
0 30 \ No newline at end of file
... ...