Commit b34fd201a79e033dcea28aadabb1f75a415776ea

Authored by bshuttle
1 parent b91d7de5

- make conditional metadata work again.

- add a titles to various pages.
- make columns include toggleselect.
- rolled in treewidgets
- correct the $main !== $this->oPage issue


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4169 c91229c3-7414-0410-bfa2-8a42b809f60b
config/siteMap.inc
@@ -107,8 +107,8 @@ $default->siteMap->addPage("orgManagement", "/presentation/lookAndFeel/knowledge @@ -107,8 +107,8 @@ $default->siteMap->addPage("orgManagement", "/presentation/lookAndFeel/knowledge
107 $default->siteMap->addPage("doctype", "presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/documentTypes.php", "Administration", SysAdmin, _("Document Type Management"), true, 5); 107 $default->siteMap->addPage("doctype", "presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/documentTypes.php", "Administration", SysAdmin, _("Document Type Management"), true, 5);
108 $default->siteMap->addPage("docfield", "/presentation/lookAndFeel/knowledgeTree/administration/admin.php/documents/fieldmanagement", "Administration", SysAdmin, _("Document Field Management"), true, 6); 108 $default->siteMap->addPage("docfield", "/presentation/lookAndFeel/knowledgeTree/administration/admin.php/documents/fieldmanagement", "Administration", SysAdmin, _("Document Field Management"), true, 6);
109 109
110 -$default->siteMap->addPage("archivedDocuments", "/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/manageArchivedDocumentsBL.php", "Administration", UnitAdmin, _("Restore Archived Documents"), true, 7);  
111 -$default->siteMap->addPage("deletedDocuments", "/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/listDeletedDocumentsBL.php", "Administration", UnitAdmin, _("Deleted Documents"), true, 8); 110 +$default->siteMap->addPage("archivedDocuments", "/presentation/lookAndFeel/knowledgeTree/administration/admin.php/storage/archived", "Administration", UnitAdmin, _("Restore Archived Documents"), true, 7);
  111 +$default->siteMap->addPage("deletedDocuments", "/presentation/lookAndFeel/knowledgeTree/administration/admin.php/storage/expunge", "Administration", UnitAdmin, _("Deleted Documents"), true, 8);
112 $default->siteMap->addPage("doccheckoutManagement", "/presentation/lookAndFeel/knowledgeTree/administration/doccheckoutmanagement/listDocumentsBL.php", "Administration", UnitAdmin, _("Document Checkout Management"), true, 9); 112 $default->siteMap->addPage("doccheckoutManagement", "/presentation/lookAndFeel/knowledgeTree/administration/doccheckoutmanagement/listDocumentsBL.php", "Administration", UnitAdmin, _("Document Checkout Management"), true, 9);
113 113
114 $default->siteMap->addPage("newsManagement", "/presentation/lookAndFeel/knowledgeTree/administration/news/listNewsBL.php", "Administration", SysAdmin, _("Dashboard News Management"), true, 10); 114 $default->siteMap->addPage("newsManagement", "/presentation/lookAndFeel/knowledgeTree/administration/news/listNewsBL.php", "Administration", SysAdmin, _("Dashboard News Management"), true, 10);
@@ -127,7 +127,7 @@ $default->siteMap->addPage("manageHelp", "/presentation/lookAndFeel/knowledgeTre @@ -127,7 +127,7 @@ $default->siteMap->addPage("manageHelp", "/presentation/lookAndFeel/knowledgeTre
127 127
128 $default->siteMap->addPage("managePermissions", "/presentation/lookAndFeel/knowledgeTree/administration/permissions/managePermissions.php", "Administration", SysAdmin, _("Permissions Administration"), true, 18); 128 $default->siteMap->addPage("managePermissions", "/presentation/lookAndFeel/knowledgeTree/administration/permissions/managePermissions.php", "Administration", SysAdmin, _("Permissions Administration"), true, 18);
129 $default->siteMap->addPage("manageLookupTrees", "/presentation/lookAndFeel/knowledgeTree/administration/docfieldmanagement/manageLookupTrees.php", "Administration", SysAdmin, _("Lookup Tree Administration"), true, 19); 129 $default->siteMap->addPage("manageLookupTrees", "/presentation/lookAndFeel/knowledgeTree/administration/docfieldmanagement/manageLookupTrees.php", "Administration", SysAdmin, _("Lookup Tree Administration"), true, 19);
130 -$default->siteMap->addPage("manageWorkflows", "/presentation/lookAndFeel/knowledgeTree/administration/workflow/workflows.php", "Administration", SysAdmin, _("Workflow Management"), true, 20); 130 +$default->siteMap->addPage("manageWorkflows", "/presentation/lookAndFeel/knowledgeTree/administration/admin.php/documents/workflows", "Administration", SysAdmin, _("Workflow Management"), true, 20);
131 $default->siteMap->addPage("manageCleanup", "/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/manageCleanup.php", "Administration", SysAdmin, _("Repository Cleanup"), true, 21); 131 $default->siteMap->addPage("manageCleanup", "/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/manageCleanup.php", "Administration", SysAdmin, _("Repository Cleanup"), true, 21);
132 $default->siteMap->addPage("manageSavedSearches", "/presentation/lookAndFeel/knowledgeTree/administration/searches/savedSearch.php", "Administration", SysAdmin, _("Saved Searches"), true, 22); 132 $default->siteMap->addPage("manageSavedSearches", "/presentation/lookAndFeel/knowledgeTree/administration/searches/savedSearch.php", "Administration", SysAdmin, _("Saved Searches"), true, 22);
133 $default->siteMap->addPage("manageDocumentConditions", "/presentation/lookAndFeel/knowledgeTree/administration/searches/conditions.php", "Administration", SysAdmin, _("Document Conditions"), true, 23); 133 $default->siteMap->addPage("manageDocumentConditions", "/presentation/lookAndFeel/knowledgeTree/administration/searches/conditions.php", "Administration", SysAdmin, _("Document Conditions"), true, 23);
lib/actions/portletregistry.inc.php
@@ -11,7 +11,7 @@ class KTPortletRegistry { @@ -11,7 +11,7 @@ class KTPortletRegistry {
11 } 11 }
12 // }}} 12 // }}}
13 13
14 - function registerPortlet($action, $name, $nsname, $path = "", $sPlugin) { 14 + function registerPortlet($action, $name, $nsname, $path = "", $sPlugin = "") {
15 if (!is_array($action)) { 15 if (!is_array($action)) {
16 $action = array($action); 16 $action = array($action);
17 } 17 }
lib/browse/BrowseColumns.inc.php
@@ -180,7 +180,7 @@ class SelectionColumn extends BrowseColumn { @@ -180,7 +180,7 @@ class SelectionColumn extends BrowseColumn {
180 function renderHeader($sReturnURL) { 180 function renderHeader($sReturnURL) {
181 // FIXME clean up access to oPage. 181 // FIXME clean up access to oPage.
182 global $main; 182 global $main;
183 - $main->requireJSResource("/resources/js/toggleselect.js"); 183 + $main->requireJSResource("resources/js/toggleselect.js");
184 184
185 return '<input type="checkbox" title="toggle all" onactivate="toggleSelectFor('.$this->name.')">'; 185 return '<input type="checkbox" title="toggle all" onactivate="toggleSelectFor('.$this->name.')">';
186 186
lib/dispatcher.inc.php
@@ -118,7 +118,7 @@ class KTStandardDispatcher extends KTDispatcher { @@ -118,7 +118,7 @@ class KTStandardDispatcher extends KTDispatcher {
118 118
119 function KTStandardDispatcher() { 119 function KTStandardDispatcher() {
120 global $main; 120 global $main;
121 - $this->oPage = $main; 121 + $this->oPage =& $main;
122 parent::KTDispatcher(); 122 parent::KTDispatcher();
123 } 123 }
124 124
lib/widgets/FieldsetDisplayRegistry.inc.php
1 <?php 1 <?php
2 2
  3 +require_once(KT_LIB_DIR . '/metadata/fieldset.inc.php');
  4 +
3 class KTFieldsetDisplayRegistry { 5 class KTFieldsetDisplayRegistry {
4 6
5 var $fieldset_types = array(); 7 var $fieldset_types = array();
@@ -24,7 +26,16 @@ class KTFieldsetDisplayRegistry { @@ -24,7 +26,16 @@ class KTFieldsetDisplayRegistry {
24 26
25 function getHandler($nsname) { 27 function getHandler($nsname) {
26 if (!array_key_exists($nsname, $this->fieldset_types)) { 28 if (!array_key_exists($nsname, $this->fieldset_types)) {
27 - return 'SimpleFieldsetDisplay'; 29 + // unfortunately, we need to do a bit more spelunking here.
  30 + // if its conditional, we use a different item. ns is unsufficient.
  31 + //
  32 + // FIXME this is slightly wasteful from a performance POV, though DB caching should make it OK.
  33 + $oFieldset =& KTFieldset::getByNamespace ($nsname);
  34 + if ($oFieldset->getIsConditional()) {
  35 + return 'ConditionalFieldsetDisplay';
  36 + } else {
  37 + return 'SimpleFieldsetDisplay';
  38 + }
28 } else { 39 } else {
29 return $this->fieldset_types[$nsname]; 40 return $this->fieldset_types[$nsname];
30 } 41 }
lib/widgets/fieldWidgets.php
@@ -81,8 +81,9 @@ class KTStaticTextWidget extends KTBaseWidget { var $sTemplate = &quot;kt3/fields/sta @@ -81,8 +81,9 @@ class KTStaticTextWidget extends KTBaseWidget { var $sTemplate = &quot;kt3/fields/sta
81 /* lookup widget */ 81 /* lookup widget */
82 // EXPECTS $aOptions["vocab"] => key, item 82 // EXPECTS $aOptions["vocab"] => key, item
83 class KTLookupWidget extends KTBaseWidget { var $sTemplate = "kt3/fields/lookup"; } 83 class KTLookupWidget extends KTBaseWidget { var $sTemplate = "kt3/fields/lookup"; }
  84 +// EXPECTS $aOptions["tree"] => inner widget.
  85 +class KTTreeWidget extends KTBaseWidget { var $sTemplate = "kt3/fields/tree"; }
84 86
85 -// TODO KTTreeWidget  
86 // TODO KTTransferWidget 87 // TODO KTTransferWidget
87 // TODO KTDateWidget 88 // TODO KTDateWidget
88 // TODO KTDateRangeWidget 89 // TODO KTDateRangeWidget
lib/widgets/fieldsetDisplay.inc.php
@@ -16,6 +16,8 @@ @@ -16,6 +16,8 @@
16 require_once(KT_LIB_DIR . "/templating/templating.inc.php"); 16 require_once(KT_LIB_DIR . "/templating/templating.inc.php");
17 require_once(KT_LIB_DIR . "/database/dbutil.inc"); 17 require_once(KT_LIB_DIR . "/database/dbutil.inc");
18 18
  19 +require_once(KT_LIB_DIR . "/documentmanagement/MDTree.inc"); // :(
  20 +
19 21
20 22
21 // data acquisition 23 // data acquisition
@@ -26,7 +28,7 @@ require_once(KT_LIB_DIR . &quot;/widgets/fieldWidgets.php&quot;); @@ -26,7 +28,7 @@ require_once(KT_LIB_DIR . &quot;/widgets/fieldWidgets.php&quot;);
26 28
27 29
28 /* it may be useful to move this to a factory, eventually? */ 30 /* it may be useful to move this to a factory, eventually? */
29 -function getWidgetForMetadataField($field, $current_value, $page, $errors = null) { 31 +function getWidgetForMetadataField($field, $current_value, $page, $errors = null, $vocab = null) {
30 // all fields have these elements. 32 // all fields have these elements.
31 $fieldLabel = $field->getName(); 33 $fieldLabel = $field->getName();
32 $fieldDescription = '<strong>FIXME</strong> we don\'t handle descriptions for fields, yet.'; 34 $fieldDescription = '<strong>FIXME</strong> we don\'t handle descriptions for fields, yet.';
@@ -49,13 +51,30 @@ function getWidgetForMetadataField($field, $current_value, $page, $errors = null @@ -49,13 +51,30 @@ function getWidgetForMetadataField($field, $current_value, $page, $errors = null
49 if ($field->getHasLookup()) { 51 if ($field->getHasLookup()) {
50 // could either be normal, or a tree. 52 // could either be normal, or a tree.
51 // ignore trees (for now). 53 // ignore trees (for now).
52 - if (true) { 54 + if (!$field->getHasLookupTree()) {
  55 + // FIXME we need to somehow handle both value-value and id-value here
53 // extract the lookup. 56 // extract the lookup.
54 - $lookups = MetaData::getEnabledValuesByDocumentField($field);  
55 - //var_dump($lookups);  
56 -  
57 - $fieldOptions["vocab"] = array(); // FIXME handle lookups  
58 - $oField = new KTLookupWidget($fieldLabel, $fieldDescription, $fieldName, $fieldValue, $page, $fieldRequired, null, $fieldErrors, $fieldOptions); 57 + if ($vocab === null) { // allow override
  58 + $lookups = MetaData::getEnabledValuesByDocumentField($field);
  59 + $fieldOptions["vocab"] = array(); // FIXME handle lookups
  60 + foreach ($lookups as $md) {
  61 + $fieldOptions["vocab"][$md->getName()] = $md->getName();
  62 + }
  63 + } else {
  64 + $fieldOptions["vocab"] = $vocab;
  65 + }
  66 +
  67 + $oField = new KTLookupWidget($fieldLabel, $fieldDescription, $fieldName, $fieldValue, $page, $fieldRequired, null, $fieldErrors, $fieldOptions);
  68 + } else {
  69 + // FIXME vocab's are _not_ supported for tree-inputs. this means conditional-tree-widgets are not unsupported.
  70 +
  71 + // for trees, we are currently brutal.
  72 + $fieldTree = new MDTree();
  73 + $fieldTree->buildForField($field->getId());
  74 + $fieldTree->setActiveItem($current_value);
  75 + $fieldOptions['tree'] = $fieldTree->_evilTreeRenderer($fieldTree, $fieldName);
  76 +
  77 + $oField = new KTTreeWidget($fieldLabel, $fieldDescription, $fieldName, $fieldValue, $page, $fieldRequired, null, $fieldErrors, $fieldOptions);
59 } 78 }
60 } else { 79 } else {
61 $oField = new KTBaseWidget($fieldLabel, $fieldDescription, $fieldName, $fieldValue, $page, $fieldRequired, null, $fieldErrors, $fieldOptions); 80 $oField = new KTBaseWidget($fieldLabel, $fieldDescription, $fieldName, $fieldValue, $page, $fieldRequired, null, $fieldErrors, $fieldOptions);
@@ -356,4 +375,63 @@ class SimpleFieldsetDisplay extends KTFieldsetDisplay { @@ -356,4 +375,63 @@ class SimpleFieldsetDisplay extends KTFieldsetDisplay {
356 375
357 } 376 }
358 377
  378 +
  379 +// Handle the conditional case.
  380 +class ConditionalFieldsetDisplay extends SimpleFieldsetDisplay {
  381 +
  382 + function renderEdit($document_data) {
  383 + global $main; // FIXME remove direct access to $main
  384 + $oPage =& $main;
  385 +
  386 + // FIXME do this from inside the widgetry mojo.
  387 + $oPage->requireCSSResource('resources/css/kt-treewidget.css');
  388 +
  389 + // FIXME this currently doesn't work, since we use NBM's half-baked Ajax on add/bulk ;)
  390 + $oPage->requireJSResource('presentation/lookAndFeel/knowledgeTree/js/taillog.js');
  391 + $oPage->requireJSResource('presentation/lookAndFeel/knowledgeTree/js/conditional_usage.js');
  392 +
  393 + $aFields = array();
  394 + $fields =& $this->fieldset->getFields();
  395 + $values = array();
  396 +
  397 + $have_values = false;
  398 + foreach ($fields as $oField) {
  399 + $val = KTUtil::arrayGet($document_data["field_values"], $oField->getId(), null);
  400 + if ($val !== null) {
  401 + $have_values = true;
  402 +
  403 + }
  404 +
  405 + $values[$oField->getId()] = $val;
  406 + }
  407 + // FIXME handle the editable case _with_ values.
  408 +
  409 + if ($have_values) {
  410 +
  411 + return '<div class="ktError"><p>Do not yet know how to edit conditional fieldsets with values.</p></div>';
  412 + } // else {
  413 +
  414 + // now, we need to do some extra work on conditional widgets.
  415 + // how?
  416 +
  417 + $fieldset_name = $this->fieldset->getName();
  418 + $fieldset_description = "The information in this section is part of the <strong>" . $fieldset_name . "</strong> of the document. Note that the options which are available depends on previous choices within this fieldset.";
  419 +
  420 + //
  421 +
  422 + $oTemplating = new KTTemplating;
  423 + $oTemplate = $oTemplating->loadTemplate("kt3/fieldsets/conditional_editable");
  424 + $aTemplateData = array(
  425 + "context" => $this,
  426 + "field" => $oField, // first field, widget.
  427 + 'fieldset_id' => $this->fieldset->getId(),
  428 + "title" => $fieldset_name,
  429 + "description" => $fieldset_description,
  430 + );
  431 +
  432 + return $oTemplate->render($aTemplateData);
  433 + }
  434 +
  435 +}
  436 +
359 ?> 437 ?>
plugins/ktcore/KTAdminPlugins.php
@@ -40,12 +40,16 @@ $oAdminRegistry-&gt;registerLocation(&quot;roles&quot;,&#39;RoleAdminDispatcher&#39;,&quot;security&quot;, &quot;Rol @@ -40,12 +40,16 @@ $oAdminRegistry-&gt;registerLocation(&quot;roles&quot;,&#39;RoleAdminDispatcher&#39;,&quot;security&quot;, &quot;Rol
40 $oAdminRegistry->registerLocation("typemanagement",'KTDocumentTypeDispatcher','documents', 'Document Types','Manage the different classes of document which can be added to the system.', KT_DIR . '/presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/documentTypes.php', null); 40 $oAdminRegistry->registerLocation("typemanagement",'KTDocumentTypeDispatcher','documents', 'Document Types','Manage the different classes of document which can be added to the system.', KT_DIR . '/presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/documentTypes.php', null);
41 $oAdminRegistry->registerLocation("fieldmanagement",'KTDocumentFieldDispatcher','documents', 'Document Fieldsets','Control which kinds of documents have which sets of information associated with them.', KT_DIR . '/presentation/lookAndFeel/knowledgeTree/administration/docfieldmanagement/documentFields.php', null); 41 $oAdminRegistry->registerLocation("fieldmanagement",'KTDocumentFieldDispatcher','documents', 'Document Fieldsets','Control which kinds of documents have which sets of information associated with them.', KT_DIR . '/presentation/lookAndFeel/knowledgeTree/administration/docfieldmanagement/documentFields.php', null);
42 $oAdminRegistry->registerLocation("linkmanagement",'KTDocLinkAdminDispatcher','documents', 'Link Type Management','Specify the different "link types" - ways to relate different documents togeter.', KT_DIR . '/presentation/lookAndFeel/knowledgeTree/administration/doclinkmanagement/documentLinks.php', null); 42 $oAdminRegistry->registerLocation("linkmanagement",'KTDocLinkAdminDispatcher','documents', 'Link Type Management','Specify the different "link types" - ways to relate different documents togeter.', KT_DIR . '/presentation/lookAndFeel/knowledgeTree/administration/doclinkmanagement/documentLinks.php', null);
43 - 43 +$oAdminRegistry->registerLocation("workflows",'KTWorkflowDispatcher','documents', 'Workflows','Configure the process documents go through..', KT_DIR . '/presentation/lookAndFeel/knowledgeTree/administration/workflow/workflows.php', null);
44 44
45 // storage 45 // storage
46 $oAdminRegistry->registerLocation("checkout",'KTCheckoutAdminDispatcher','storage', 'Checked Out Document Control','Override the checked-out status of documents if a user has failed to do so.', KT_DIR . '/presentation/lookAndFeel/knowledgeTree/administration/doccheckoutmanagement/documentCheckout.php', null); 46 $oAdminRegistry->registerLocation("checkout",'KTCheckoutAdminDispatcher','storage', 'Checked Out Document Control','Override the checked-out status of documents if a user has failed to do so.', KT_DIR . '/presentation/lookAndFeel/knowledgeTree/administration/doccheckoutmanagement/documentCheckout.php', null);
  47 +$oAdminRegistry->registerLocation("archived",'ArchivedDocumentsDispatcher','storage', 'Archived Document Restoration','Restore old (archived) documents, usually at a user\'s request.', KT_DIR . '/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/archivedDocuments.php', null);
  48 +$oAdminRegistry->registerLocation("expunge",'DeletedDocumentsDispatcher','storage', 'Expunge Deleted Documents','Permanently expunge deleted documents.', KT_DIR . '/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/deletedDocuments.php', null);
47 49
  50 +// misc
48 $oAdminRegistry->registerLocation("helpmanagement",'ManageHelpDispatcher','misc', 'Edit Help files','Change the help files that are displayed to users.', KT_DIR . '/presentation/lookAndFeel/knowledgeTree/administration/help/manageHelp.php', null); 51 $oAdminRegistry->registerLocation("helpmanagement",'ManageHelpDispatcher','misc', 'Edit Help files','Change the help files that are displayed to users.', KT_DIR . '/presentation/lookAndFeel/knowledgeTree/administration/help/manageHelp.php', null);
49 52
50 53
  54 +
51 ?> 55 ?>
plugins/ktcore/KTFolderActions.php
@@ -21,11 +21,14 @@ class KTFolderAddDocumentAction extends KTFolderAction { @@ -21,11 +21,14 @@ class KTFolderAddDocumentAction extends KTFolderAction {
21 21
22 function do_main() { 22 function do_main() {
23 $this->oPage->setBreadcrumbDetails("add document"); 23 $this->oPage->setBreadcrumbDetails("add document");
  24 + $this->oPage->setTitle('Add a document');
24 $oTemplate =& $this->oValidator->validateTemplate('ktcore/document/add'); 25 $oTemplate =& $this->oValidator->validateTemplate('ktcore/document/add');
25 $add_fields = array(); 26 $add_fields = array();
26 $add_fields[] = new KTFileUploadWidget('File', 'The contents of the document to be added to the document management system.', 'file', "", $this->oPage, true); 27 $add_fields[] = new KTFileUploadWidget('File', 'The contents of the document to be added to the document management system.', 'file', "", $this->oPage, true);
27 $add_fields[] = new KTStringWidget('Title', 'Describe the changes made to the document.', 'title', "", $this->oPage, true); 28 $add_fields[] = new KTStringWidget('Title', 'Describe the changes made to the document.', 'title', "", $this->oPage, true);
28 - 29 +
  30 +
  31 +
29 $aVocab = array(); 32 $aVocab = array();
30 foreach (DocumentType::getList() as $oDocumentType) { 33 foreach (DocumentType::getList() as $oDocumentType) {
31 $aVocab[$oDocumentType->getId()] = $oDocumentType->getName(); 34 $aVocab[$oDocumentType->getId()] = $oDocumentType->getName();
presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/archivedDocuments.php 0 โ†’ 100644
  1 +<?php
  2 +
  3 +//require_once('../../../../../config/dmsDefaults.php');
  4 +require_once(KT_LIB_DIR . '/dispatcher.inc.php');
  5 +require_once(KT_LIB_DIR . '/templating/templating.inc.php');
  6 +
  7 +require_once(KT_LIB_DIR . '/documentmanagement/Document.inc');
  8 +require_once(KT_LIB_DIR . '/documentmanagement/DocumentTransaction.inc');
  9 +
  10 +require_once(KT_LIB_DIR . "/widgets/fieldWidgets.php");
  11 +require_once(KT_LIB_DIR . "/templating/kt3template.inc.php");
  12 +
  13 +// FIXME chain in a notification alert for un-archival requests.
  14 +
  15 +class ArchivedDocumentsDispatcher extends KTAdminDispatcher {
  16 +
  17 + // Breadcrumbs base - added to in methods
  18 + var $aBreadcrumbs = array(
  19 + array('action' => 'administration', 'name' => 'Administration'),
  20 + );
  21 +
  22 + function do_main () {
  23 + $this->aBreadcrumbs[] = array('action' => 'archivedDocuments', 'name' => 'Archived Documents');
  24 +
  25 + $this->oPage->setBreadcrumbDetails('list');
  26 +
  27 + $aDocuments =& Document::getList("status_id=" . ARCHIVED);
  28 +
  29 +
  30 + $oTemplating =& KTTemplating::getSingleton();
  31 + $oTemplate = $oTemplating->loadTemplate('ktcore/document/admin/archivedlist');
  32 + $oTemplate->setData(array(
  33 + 'context' => $this,
  34 + 'documents' => $aDocuments,
  35 + ));
  36 + return $oTemplate;
  37 + }
  38 +
  39 + function do_confirm_restore() {
  40 + $this->aBreadcrumbs[] = array('action' => 'archivedDocuments', 'name' => 'Archived Documents');
  41 +
  42 + $selected_docs = KTUtil::arrayGet($_REQUEST, 'selected_docs', array());
  43 +
  44 + $this->oPage->setTitle('Confirm Restore of ' . count($selected_docs) . ' documents');
  45 +
  46 + $this->oPage->setBreadcrumbDetails('confirm restore of ' . count($selected_docs) . ' documents');
  47 +
  48 + $aDocuments = array();
  49 + foreach ($selected_docs as $doc_id) {
  50 + $oDoc =& Document::get($doc_id);
  51 + if (PEAR::isError($oDoc) || ($oDoc === false)) {
  52 + $this->errorRedirectToMain('Invalid document id specified. Aborting restore.');
  53 + } else if ($oDoc->getStatusId() != ARCHIVED) {
  54 + $this->errorRedirectToMain($oDoc->getName() . ' is not an archived document. Aborting restore.');
  55 + }
  56 + $aDocuments[] = $oDoc;
  57 + }
  58 +
  59 +
  60 + $oTemplating =& KTTemplating::getSingleton();
  61 + $oTemplate = $oTemplating->loadTemplate('ktcore/document/admin/dearchiveconfirmlist');
  62 + $oTemplate->setData(array(
  63 + 'context' => $this,
  64 + 'documents' => $aDocuments,
  65 + ));
  66 + return $oTemplate;
  67 + }
  68 +
  69 + function do_finish_restore() {
  70 +
  71 +
  72 + $selected_docs = KTUtil::arrayGet($_REQUEST, 'selected_docs', array());
  73 +
  74 + $aDocuments = array();
  75 + foreach ($selected_docs as $doc_id) {
  76 + $oDoc =& Document::get($doc_id);
  77 + if (PEAR::isError($oDoc) || ($oDoc === false)) {
  78 + $this->errorRedirectToMain('Invalid document id specified. Aborting restore.');
  79 + } else if ($oDoc->getStatusId() != ARCHIVED) {
  80 + $this->errorRedirectToMain($oDoc->getName() . ' is not an archived document. Aborting restore.');
  81 + }
  82 + $aDocuments[] = $oDoc;
  83 + }
  84 +
  85 + $this->startTransaction();
  86 +
  87 + foreach ($aDocuments as $oDoc) {
  88 + // FIXME find de-archival source.
  89 + // FIXME purge old notifications.
  90 + // FIXME create de-archival notices to those who sent in old notifications.
  91 + $oDoc->setStatusId(LIVE);
  92 + $res = $oDoc->update();
  93 + if (PEAR::isError($res) || ($res == false)) {
  94 + $this->errorRedirectToMain($oDoc->getName . ' could not be made "live".');
  95 + }
  96 + }
  97 + $this->commitTransaction();
  98 + $msg = count($aDocuments) . ' documents made active.';
  99 + $this->successRedirectToMain($msg);
  100 + }
  101 +}
  102 +
  103 +//$d =& new DeletedDocumentsDispatcher;
  104 +//$d->dispatch();
  105 +
  106 +?>
presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/deletedDocuments.php 0 โ†’ 100644
  1 +<?php
  2 +
  3 +//require_once('../../../../../config/dmsDefaults.php');
  4 +require_once(KT_LIB_DIR . '/dispatcher.inc.php');
  5 +require_once(KT_LIB_DIR . '/templating/templating.inc.php');
  6 +
  7 +require_once(KT_LIB_DIR . '/documentmanagement/Document.inc');
  8 +require_once(KT_LIB_DIR . '/documentmanagement/DocumentTransaction.inc');
  9 +
  10 +require_once(KT_LIB_DIR . "/widgets/fieldWidgets.php");
  11 +require_once(KT_LIB_DIR . "/templating/kt3template.inc.php");
  12 +
  13 +class DeletedDocumentsDispatcher extends KTAdminDispatcher {
  14 +
  15 + // Breadcrumbs base - added to in methods
  16 + var $aBreadcrumbs = array(
  17 + array('action' => 'administration', 'name' => 'Administration'),
  18 + );
  19 +
  20 + function do_main () {
  21 + $this->aBreadcrumbs[] = array('action' => 'deletedDocuments', 'name' => 'Deleted Documents');
  22 +
  23 + $this->oPage->setBreadcrumbDetails('view');
  24 +
  25 + $aDocuments =& Document::getList("status_id=" . DELETED);
  26 +
  27 +
  28 + $oTemplating =& KTTemplating::getSingleton();
  29 + $oTemplate = $oTemplating->loadTemplate('ktcore/document/admin/deletedlist');
  30 + $oTemplate->setData(array(
  31 + 'context' => $this,
  32 + 'documents' => $aDocuments,
  33 + ));
  34 + return $oTemplate;
  35 + }
  36 +
  37 + function do_confirm_expunge() {
  38 + $this->aBreadcrumbs[] = array('action' => 'deletedDocuments', 'name' => 'Deleted Documents');
  39 +
  40 + $selected_docs = KTUtil::arrayGet($_REQUEST, 'selected_docs', array());
  41 +
  42 + $this->oPage->setTitle('Confirm Expunge of ' . count($selected_docs) . ' documents');
  43 +
  44 + $this->oPage->setBreadcrumbDetails('confirm expunge of ' . count($selected_docs) . ' documents');
  45 +
  46 + $aDocuments = array();
  47 + foreach ($selected_docs as $doc_id) {
  48 + $oDoc =& Document::get($doc_id);
  49 + if (PEAR::isError($oDoc) || ($oDoc === false)) {
  50 + $this->errorRedirectToMain('Invalid document id specified. Aborting expunge');
  51 + } else if ($oDoc->getStatusId() != DELETED) {
  52 + $this->errorRedirectToMain($oDoc->getName() . ' is not a deleted document. Aborting expunge');
  53 + }
  54 + $aDocuments[] = $oDoc;
  55 + }
  56 +
  57 +
  58 + $oTemplating =& KTTemplating::getSingleton();
  59 + $oTemplate = $oTemplating->loadTemplate('ktcore/document/admin/expungeconfirmlist');
  60 + $oTemplate->setData(array(
  61 + 'context' => $this,
  62 + 'documents' => $aDocuments,
  63 + ));
  64 + return $oTemplate;
  65 + }
  66 +
  67 + function do_finish_expunge() {
  68 +
  69 +
  70 + $selected_docs = KTUtil::arrayGet($_REQUEST, 'selected_docs', array());
  71 +
  72 + $aDocuments = array();
  73 + foreach ($selected_docs as $doc_id) {
  74 + $oDoc =& Document::get($doc_id);
  75 + if (PEAR::isError($oDoc) || ($oDoc === false)) {
  76 + $this->errorRedirectToMain('Invalid document id specified. Aborting expunge');
  77 + } else if ($oDoc->getStatusId() != DELETED) {
  78 + $this->errorRedirectToMain($oDoc->getName() . ' is not a deleted document. Aborting expunge');
  79 + }
  80 + $aDocuments[] = $oDoc;
  81 + }
  82 +
  83 + $this->startTransaction();
  84 + $aErrorDocuments = array();
  85 + $aSuccessDocuments = array();
  86 +
  87 + foreach ($aDocuments as $oDoc) {
  88 + if (!PhysicalDocumentManager::expunge($oDoc)) { $aErrorDocuments[] = $oDoc->getDisplayPath(); }
  89 + else {
  90 + $oDocumentTransaction = & new DocumentTransaction($oDoc->getId(), "Document expunged", EXPUNGE);
  91 + $oDocumentTransaction->create();
  92 +
  93 + // delete this from the db now
  94 + if (!$oDoc->delete()) { $aErrorDocuments[] = $oDoc->getId(); }
  95 + else {
  96 + // removed succesfully
  97 + $aSuccessDocuments[] = $oDoc->getDisplayPath();
  98 +
  99 + // remove any document data
  100 + $oDoc->cleanupDocumentData($oDoc->getId()); // silly - why the redundancy?
  101 + }
  102 + }
  103 + }
  104 + $this->commitTransaction();
  105 + $msg = count($aSuccessDocuments) . ' documents expunged.';
  106 + if (count($aErrorDocuments) != 0) { $msg .= 'Failed to expunge: ' . join(', ', $aErrorDocuments); }
  107 + $this->successRedirectToMain($msg);
  108 + }
  109 +}
  110 +
  111 +//$d =& new DeletedDocumentsDispatcher;
  112 +//$d->dispatch();
  113 +
  114 +?>
presentation/lookAndFeel/knowledgeTree/administration/workflow/workflows.php
1 <?php 1 <?php
2 2
3 -require_once('../../../../../config/dmsDefaults.php'); 3 +//require_once('../../../../../config/dmsDefaults.php');
4 require_once(KT_LIB_DIR . '/dispatcher.inc.php'); 4 require_once(KT_LIB_DIR . '/dispatcher.inc.php');
5 require_once(KT_LIB_DIR . '/validation/dispatchervalidation.inc.php'); 5 require_once(KT_LIB_DIR . '/validation/dispatchervalidation.inc.php');
6 require_once(KT_LIB_DIR . '/templating/templating.inc.php'); 6 require_once(KT_LIB_DIR . '/templating/templating.inc.php');
@@ -10,7 +10,8 @@ require_once(KT_LIB_DIR . &#39;/workflow/workflowstate.inc.php&#39;); @@ -10,7 +10,8 @@ require_once(KT_LIB_DIR . &#39;/workflow/workflowstate.inc.php&#39;);
10 require_once(KT_LIB_DIR . '/workflow/workflowtransition.inc.php'); 10 require_once(KT_LIB_DIR . '/workflow/workflowtransition.inc.php');
11 11
12 $sectionName = "Administration"; 12 $sectionName = "Administration";
13 -require_once(KT_DIR . "/presentation/webpageTemplate.inc"); 13 +
  14 +require_once(KT_LIB_DIR . "/templating/kt3template.inc.php");
14 15
15 require_once(KT_LIB_DIR . '/permissions/permission.inc.php'); 16 require_once(KT_LIB_DIR . '/permissions/permission.inc.php');
16 require_once(KT_LIB_DIR . '/groups/Group.inc'); 17 require_once(KT_LIB_DIR . '/groups/Group.inc');
@@ -28,10 +29,20 @@ class KTWorkflowDispatcher extends KTStandardDispatcher { @@ -28,10 +29,20 @@ class KTWorkflowDispatcher extends KTStandardDispatcher {
28 // {{{ WORKFLOW HANDLING 29 // {{{ WORKFLOW HANDLING
29 // {{{ do_main 30 // {{{ do_main
30 function do_main () { 31 function do_main () {
  32 + $this->aBreadcrumbs[] = array(
  33 + 'action' => 'manageWorkflows',
  34 + 'name' => 'Workflows',
  35 + );
  36 +
  37 + $add_fields = array();
  38 + $add_fields[] = new KTStringWidget('Name','A human-readable name for the workflow.', 'fName', null, $this->oPage, true);
  39 +
31 $oTemplating =& KTTemplating::getSingleton(); 40 $oTemplating =& KTTemplating::getSingleton();
32 $oTemplate =& $oTemplating->loadTemplate('ktcore/workflow/listWorkflows'); 41 $oTemplate =& $oTemplating->loadTemplate('ktcore/workflow/listWorkflows');
33 $oTemplate->setData(array( 42 $oTemplate->setData(array(
  43 + 'context' => $this,
34 'aWorkflow' => KTWorkflow::getList(), 44 'aWorkflow' => KTWorkflow::getList(),
  45 + 'add_fields' => $add_fields,
35 )); 46 ));
36 return $oTemplate; 47 return $oTemplate;
37 } 48 }
@@ -39,20 +50,66 @@ class KTWorkflowDispatcher extends KTStandardDispatcher { @@ -39,20 +50,66 @@ class KTWorkflowDispatcher extends KTStandardDispatcher {
39 50
40 // {{{ do_editWorkflow 51 // {{{ do_editWorkflow
41 function do_editWorkflow() { 52 function do_editWorkflow() {
  53 +
42 $oTemplate =& $this->oValidator->validateTemplate('ktcore/workflow/editWorkflow'); 54 $oTemplate =& $this->oValidator->validateTemplate('ktcore/workflow/editWorkflow');
43 $oWorkflow =& $this->oValidator->validateWorkflow($_REQUEST['fWorkflowId']); 55 $oWorkflow =& $this->oValidator->validateWorkflow($_REQUEST['fWorkflowId']);
  56 +
  57 + $aStates = KTWorkflowState::getByWorkflow($oWorkflow);
  58 + $aPermissions = KTPermission::getList();
  59 +
  60 + $edit_fields = array();
  61 + $edit_fields[] = new KTStringWidget('Name','A human-readable name for the workflow.', 'fName', $oWorkflow->getName(), $this->oPage, true);
  62 + $aOptions = array();
  63 + $vocab = array();
  64 + $vocab[0] = 'None';
  65 + foreach($aStates as $state) {
  66 + $vocab[$state->getId()] = $state->getName();
  67 + }
  68 + $aOptions['vocab'] = $vocab;
  69 + $edit_fields[] = new KTLookupWidget('Starting State','When a document has this workflow applied to it, to which state should it initially be set ', 'fStartingStateId', $oWorkflow->getStartStateId(), $this->oPage, false, null, null, $aOptions);
  70 +
  71 + $add_state_fields = array();
  72 + $add_state_fields[] = new KTStringWidget('Name','A human-readable name for the state.', 'fName', null, $this->oPage, true);
  73 +
  74 +
  75 + $add_transition_fields = array();
  76 + $add_transition_fields[] = new KTStringWidget('Name','A human-readable name for the state.', 'fName', null, $this->oPage, true);
  77 + $aOptions = array();
  78 + $vocab = array();
  79 + foreach($aStates as $state) {
  80 + $vocab[$state->getId()] = $state->getName();
  81 + }
  82 + $aOptions['vocab'] = $vocab;
  83 + $add_transition_fields[] = new KTLookupWidget('Destination State','Once this transition is complete, which state should the document be in?', 'fTargetStateId', $oWorkflow->getStartStateId(), $this->oPage, true, null, null, $aOptions);
  84 + $aOptions = array();
  85 + $vocab = array();
  86 + foreach($aPermissions as $permission) {
  87 + $vocab[$permission->getId()] = $permission->getHumanName();
  88 + }
  89 + $aOptions['vocab'] = $vocab;
  90 + $add_transition_fields[] = new KTLookupWidget('Guard Permission.','Which permission must the user have in order to follow this transition?', 'fPermissionId', $oWorkflow->getStartStateId(), $this->oPage, true, null, null, $aOptions);
  91 +
  92 + $this->aBreadcrumbs[] = array(
  93 + 'action' => 'manageWorkflows',
  94 + 'name' => 'Workflows',
  95 + );
44 $this->aBreadcrumbs[] = array( 96 $this->aBreadcrumbs[] = array(
45 'action' => 'manageWorkflows', 97 'action' => 'manageWorkflows',
46 'query' => 'action=editWorkflow&fWorkflowId=' . $oWorkflow->getId(), 98 'query' => 'action=editWorkflow&fWorkflowId=' . $oWorkflow->getId(),
47 - 'name' => 'Workflow ' . $oWorkflow->getName(), 99 + 'name' => $oWorkflow->getName(),
48 ); 100 );
49 $oTemplate->setData(array( 101 $oTemplate->setData(array(
50 'oWorkflow' => $oWorkflow, 102 'oWorkflow' => $oWorkflow,
51 - 'aStates' => KTWorkflowState::getByWorkflow($oWorkflow), 103 + 'aStates' => $aStates,
52 'aTransitions' => KTWorkflowTransition::getByWorkflow($oWorkflow), 104 'aTransitions' => KTWorkflowTransition::getByWorkflow($oWorkflow),
53 - 'aPermissions' => KTPermission::getList(), 105 + 'aPermissions' => $aPermissions,
54 'aActions' => KTDocumentActionUtil::getAllDocumentActions(), 106 'aActions' => KTDocumentActionUtil::getAllDocumentActions(),
55 'aActionsSelected' => KTWorkflowUtil::getControlledActionsForWorkflow($oWorkflow), 107 'aActionsSelected' => KTWorkflowUtil::getControlledActionsForWorkflow($oWorkflow),
  108 +
  109 + // fields
  110 + 'edit_fields' => $edit_fields,
  111 + 'add_state_fields' => $add_state_fields,
  112 + 'add_transition_fields' => $add_transition_fields,
56 )); 113 ));
57 return $oTemplate; 114 return $oTemplate;
58 } 115 }
@@ -150,14 +207,15 @@ class KTWorkflowDispatcher extends KTStandardDispatcher { @@ -150,14 +207,15 @@ class KTWorkflowDispatcher extends KTStandardDispatcher {
150 $aTransitionsSelected = KTWorkflowUtil::getTransitionsFrom($oState, array('ids' => true)); 207 $aTransitionsSelected = KTWorkflowUtil::getTransitionsFrom($oState, array('ids' => true));
151 $this->aBreadcrumbs[] = array( 208 $this->aBreadcrumbs[] = array(
152 'action' => 'manageWorkflows', 209 'action' => 'manageWorkflows',
153 - 'query' => 'action=editWorkflow&fWorkflowId=' . $oWorkflow->getId(),  
154 - 'name' => 'Workflow ' . $oWorkflow->getName(), 210 + 'name' => 'Workflows',
155 ); 211 );
156 $this->aBreadcrumbs[] = array( 212 $this->aBreadcrumbs[] = array(
157 'action' => 'manageWorkflows', 213 'action' => 'manageWorkflows',
158 - 'query' => 'action=editState&fWorkflowId=' . $oWorkflow->getId() . '&fStateId=' . $oState->getId(),  
159 - 'name' => 'State ' . $oState->getName(), 214 + 'query' => 'action=editWorkflow&fWorkflowId=' . $oWorkflow->getId(),
  215 + 'name' => $oWorkflow->getName(),
160 ); 216 );
  217 + $this->oPage->setBreadcrumbDetails('state: ' . $oState->getName());
  218 +
161 $aInformed = KTWorkflowUtil::getInformedForState($oState); 219 $aInformed = KTWorkflowUtil::getInformedForState($oState);
162 $oTemplate->setData(array( 220 $oTemplate->setData(array(
163 'oWorkflow' => $oWorkflow, 221 'oWorkflow' => $oWorkflow,
@@ -301,24 +359,84 @@ class KTWorkflowDispatcher extends KTStandardDispatcher { @@ -301,24 +359,84 @@ class KTWorkflowDispatcher extends KTStandardDispatcher {
301 $oTemplate =& $this->oValidator->validateTemplate('ktcore/workflow/editTransition'); 359 $oTemplate =& $this->oValidator->validateTemplate('ktcore/workflow/editTransition');
302 $oWorkflow =& $this->oValidator->validateWorkflow($_REQUEST['fWorkflowId']); 360 $oWorkflow =& $this->oValidator->validateWorkflow($_REQUEST['fWorkflowId']);
303 $oTransition =& $this->oValidator->validateWorkflowTransition($_REQUEST['fTransitionId']); 361 $oTransition =& $this->oValidator->validateWorkflowTransition($_REQUEST['fTransitionId']);
  362 +
  363 + $aStates = KTWorkflowState::getByWorkflow($oWorkflow);
  364 + $aPermissions = KTPermission::getList();
  365 + $aGroups = Group::getList();
  366 + $aRoles = Role::getList();
  367 + $aConditions = KTSavedSearch::getConditions();
  368 +
  369 + $edit_fields = array();
  370 + $edit_fields[] = new KTStringWidget('Name','A human-readable name for the state.', 'fName', $oTransition->getName(), $this->oPage, true);
  371 + $aOptions = array();
  372 + $vocab = array();
  373 + foreach($aStates as $state) {
  374 + $vocab[$state->getId()] = $state->getName();
  375 + }
  376 + $aOptions['vocab'] = $vocab;
  377 + $edit_fields[] = new KTLookupWidget('Destination State','Once this transition is complete, which state should the document be in?', 'fTargetStateId', $oTransition->getTargetStateId(), $this->oPage, true, null, null, $aOptions);
  378 + $aOptions = array();
  379 + $vocab = array();
  380 + $vocab[0] = 'None';
  381 + foreach($aPermissions as $permission) {
  382 + $vocab[$permission->getId()] = $permission->getHumanName();
  383 + }
  384 + $aOptions['vocab'] = $vocab;
  385 + $edit_fields[] = new KTLookupWidget('Guard Permission.','Which permission must the user have in order to follow this transition?', 'fPermissionId', $oTransition->getGuardPermissionId(), $this->oPage, true, null, null, $aOptions);
  386 + $aOptions = array();
  387 + $vocab = array();
  388 + $vocab[0] = 'None';
  389 + foreach($aGroups as $group) {
  390 + $vocab[$group->getId()] = $group->getName();
  391 + }
  392 + $aOptions['vocab'] = $vocab;
  393 + $edit_fields[] = new KTLookupWidget('Guard Group.','Which group must the user belong to in order to follow this transition?', 'fGroupId', $oTransition->getGuardGroupId(), $this->oPage, false, null, null, $aOptions);
  394 + $aOptions = array();
  395 + $vocab = array();
  396 + $vocab[0] = 'None';
  397 + foreach($aRoles as $role) {
  398 + $vocab[$role->getId()] = $role->getName();
  399 + }
  400 + $aOptions['vocab'] = $vocab;
  401 + $edit_fields[] = new KTLookupWidget('Guard Role.','Which role must the user have in order to follow this transition?', 'fRoleId', $oTransition->getGuardRoleId(), $this->oPage, false, null, null, $aOptions);
  402 +
  403 + if (!empty($aConditions)) {
  404 + $aOptions = array();
  405 + $vocab = array();
  406 + $vocab[0] = 'None';
  407 + foreach($aConditions as $condition) {
  408 + $vocab[$condition->getId()] = $condition->getName();
  409 + }
  410 + $aOptions['vocab'] = $vocab;
  411 + $edit_fields[] = new KTLookupWidget('Guard Condition.','Which condition (stored search) must be satisfied before the transition can take place?', 'fConditionId', $oTransition->getGuardConditionId(), $this->oPage, false, null, null, $aOptions);
  412 + }
  413 +
  414 + $this->aBreadcrumbs[] = array(
  415 + 'action' => 'manageWorkflows',
  416 + 'name' => 'Workflows',
  417 + );
304 $this->aBreadcrumbs[] = array( 418 $this->aBreadcrumbs[] = array(
305 'action' => 'manageWorkflows', 419 'action' => 'manageWorkflows',
306 'query' => 'action=editWorkflow&fWorkflowId=' . $oWorkflow->getId(), 420 'query' => 'action=editWorkflow&fWorkflowId=' . $oWorkflow->getId(),
307 - 'name' => 'Workflow ' . $oWorkflow->getName(), 421 + 'name' => $oWorkflow->getName(),
308 ); 422 );
309 $this->aBreadcrumbs[] = array( 423 $this->aBreadcrumbs[] = array(
310 'action' => 'manageWorkflows', 424 'action' => 'manageWorkflows',
311 - 'query' => 'action=editTransitionfWorkflowId=' . $oWorkflow->getId() . '&fTransitionId=' . $oTransition->getId(),  
312 - 'name' => 'Transition ' . $oTransition->getName(), 425 + 'query' => 'action=editTransition&fWorkflowId=' . $oWorkflow->getId() . '&fTransitionId=' . $oTransition->getId(),
  426 + 'name' => $oTransition->getName(),
313 ); 427 );
314 $oTemplate->setData(array( 428 $oTemplate->setData(array(
315 'oWorkflow' => $oWorkflow, 429 'oWorkflow' => $oWorkflow,
316 'oTransition' => $oTransition, 430 'oTransition' => $oTransition,
317 - 'aStates' => KTWorkflowState::getByWorkflow($oWorkflow),  
318 - 'aPermissions' => KTPermission::getList(),  
319 - 'aGroups' => Group::getList(),  
320 - 'aRoles' => Role::getList(),  
321 - 'aConditions' => KTSavedSearch::getConditions(), 431 + 'aStates' => $aStates,
  432 + 'aPermissions' => $aPermissions,
  433 + 'aGroups' => $aGroups,
  434 + 'aRoles' => $aRoles,
  435 + 'aConditions' => $aConditions,
  436 +
  437 + // fields
  438 +
  439 + 'edit_fields' => $edit_fields,
322 )); 440 ));
323 return $oTemplate; 441 return $oTemplate;
324 } 442 }
@@ -373,7 +491,7 @@ class KTWorkflowDispatcher extends KTStandardDispatcher { @@ -373,7 +491,7 @@ class KTWorkflowDispatcher extends KTStandardDispatcher {
373 491
374 } 492 }
375 493
376 -$d =& new KTWorkflowDispatcher;  
377 -$d->dispatch(); 494 +//$d =& new KTWorkflowDispatcher;
  495 +//$d->dispatch();
378 496
379 ?> 497 ?>
presentation/lookAndFeel/knowledgeTree/ajaxConditional.php
@@ -9,6 +9,7 @@ require_once(KT_LIB_DIR . &quot;/util/ktutil.inc&quot;); @@ -9,6 +9,7 @@ require_once(KT_LIB_DIR . &quot;/util/ktutil.inc&quot;);
9 require_once(KT_LIB_DIR . "/dispatcher.inc.php"); 9 require_once(KT_LIB_DIR . "/dispatcher.inc.php");
10 $sectionName = "Administration"; 10 $sectionName = "Administration";
11 require_once(KT_DIR . "/presentation/webpageTemplate.inc"); 11 require_once(KT_DIR . "/presentation/webpageTemplate.inc");
  12 +require_once(KT_LIB_DIR . '/widgets/fieldsetDisplay.inc.php');
12 13
13 /* 14 /*
14 * example code - tests the frontend behaviour. remember to check ajaxConditional.php 15 * example code - tests the frontend behaviour. remember to check ajaxConditional.php
@@ -38,6 +39,7 @@ class AjaxConditionalDispatcher extends KTStandardDispatcher { @@ -38,6 +39,7 @@ class AjaxConditionalDispatcher extends KTStandardDispatcher {
38 } 39 }
39 40
40 function do_updateFieldset() { 41 function do_updateFieldset() {
  42 + global $main;
41 $GLOBALS['default']->log->error(print_r($_REQUEST, true)); 43 $GLOBALS['default']->log->error(print_r($_REQUEST, true));
42 header('Content-Type: application/xml'); 44 header('Content-Type: application/xml');
43 $oFieldset =& $this->oValidator->validateFieldset($_REQUEST['fieldset']); 45 $oFieldset =& $this->oValidator->validateFieldset($_REQUEST['fieldset']);
@@ -45,17 +47,25 @@ class AjaxConditionalDispatcher extends KTStandardDispatcher { @@ -45,17 +47,25 @@ class AjaxConditionalDispatcher extends KTStandardDispatcher {
45 $matches = array(); 47 $matches = array();
46 $aFields = array(); 48 $aFields = array();
47 foreach ($_REQUEST as $k => $v) { 49 foreach ($_REQUEST as $k => $v) {
48 - if (preg_match('/^emd(\d+)$/', $k, $matches)) { 50 + if (preg_match('/^metadata_(\d+)$/', $k, $matches)) {
49 $aValues[$matches[1]] = $v; 51 $aValues[$matches[1]] = $v;
50 } 52 }
51 } 53 }
52 54
53 $aNextFieldValues =& KTMetadataUtil::getNext($oFieldset, $aValues); 55 $aNextFieldValues =& KTMetadataUtil::getNext($oFieldset, $aValues);
54 -  
55 - $oTemplate =& $this->oValidator->validateTemplate('ktcore/metadata/chooseFromMetadataLookup');  
56 - $oTemplate->setData(array('aFieldValues' => $aNextFieldValues));  
57 - $GLOBALS['default']->log->debug(print_r($aNextFieldValues, true));  
58 - return $oTemplate->render(); 56 +
  57 + $sWidgets = '';
  58 + // convert these into widgets using the ever-evil...
  59 + // function getWidgetForMetadataField($field, $current_value, $page, $errors = null, $vocab = null)
  60 + foreach ($aNextFieldValues as $aFieldInfo) {
  61 + $vocab = array();
  62 + $vocab[''] = 'Unset';
  63 + foreach ($aFieldInfo['values'] as $md_v) { $vocab[$md_v->getName()] = $md_v->getName(); }
  64 + $oWidget = getWidgetForMetadataField($aFieldInfo['field'], null, $main, null, $vocab) ;
  65 + $sWidgets .= $oWidget->render();
  66 + }
  67 +
  68 + return $sWidgets;
59 } 69 }
60 } 70 }
61 71
presentation/lookAndFeel/knowledgeTree/js/conditional_usage.js
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 // i don't like Mochikit's one. 2 // i don't like Mochikit's one.
3 3
4 function getBindTarget(fieldset) { 4 function getBindTarget(fieldset) {
5 - var possibles = getElementsByTagAndClassName('TBODY','conditional_target', fieldset); 5 + var possibles = getElementsByTagAndClassName('DIV','conditional_target', fieldset);
6 return possibles[0]; 6 return possibles[0];
7 } 7 }
8 8
@@ -130,18 +130,18 @@ function popStack(fieldset) { @@ -130,18 +130,18 @@ function popStack(fieldset) {
130 function createFixedWidget(fieldset, widget, i_name, i_value, i_label) { 130 function createFixedWidget(fieldset, widget, i_name, i_value, i_label) {
131 // bad, but there's nothing else we can do in the current design. 131 // bad, but there's nothing else we can do in the current design.
132 // we need to walk the TR for the TH (widget.tagName == TR) 132 // we need to walk the TR for the TH (widget.tagName == TR)
133 - if (widget.tagName != 'TR') 133 + if (widget.tagName != 'DIV')
134 { 134 {
135 // alert('Invalid widget in conditional.'+widget); 135 // alert('Invalid widget in conditional.'+widget);
136 simpleLog('ERROR','invalid widget in conditional.'); 136 simpleLog('ERROR','invalid widget in conditional.');
137 return false; 137 return false;
138 } 138 }
139 - var header = widget.getElementsByTagName('TH')[0]; // FIXME _could_ fail if pathalogical. 139 + var header = widget.getElementsByTagName('LABEL')[0]; // FIXME _could_ fail if pathalogical.
140 var i_friendly_name = scrapeText(header); 140 var i_friendly_name = scrapeText(header);
141 141
142 - var newWidget = TR({'class':'widget fixed'},  
143 - TH(null, i_friendly_name),  
144 - TD(null, 142 + var newWidget = DIV({'class':'field fixed'},
  143 + createDOM('LABEL',null, i_friendly_name),
  144 + DIV(null,
145 INPUT({'type':'hidden','name':i_name, 'value':i_value,'class':'fixed'}), 145 INPUT({'type':'hidden','name':i_name, 'value':i_value,'class':'fixed'}),
146 SPAN(null, i_label) 146 SPAN(null, i_label)
147 ) 147 )
@@ -159,7 +159,7 @@ function createFixedWidget(fieldset, widget, i_name, i_value, i_label) { @@ -159,7 +159,7 @@ function createFixedWidget(fieldset, widget, i_name, i_value, i_label) {
159 */ 159 */
160 160
161 function handleSelectChange(fieldset, widget, select_object) { 161 function handleSelectChange(fieldset, widget, select_object) {
162 - simpleLog('ERROR','call to stub: handleSelectChange on select with name "'+select_object.name+'"'); 162 + simpleLog('DEBUG','handleSelectChange on select with name "'+select_object.name+'"');
163 var i_name = select_object.name; 163 var i_name = select_object.name;
164 var i_value = select_object.value; 164 var i_value = select_object.value;
165 var i_label = scrapeText(select_object.options[select_object.selectedIndex]); 165 var i_label = scrapeText(select_object.options[select_object.selectedIndex]);
@@ -300,15 +300,15 @@ function do_updateFieldset(fieldset, req) { @@ -300,15 +300,15 @@ function do_updateFieldset(fieldset, req) {
300 // clear unfixed widgets before we start. 300 // clear unfixed widgets before we start.
301 clearUnfixedWidgets(fieldset); 301 clearUnfixedWidgets(fieldset);
302 // create an unparented div for HTML insertion. 302 // create an unparented div for HTML insertion.
303 - var tb = TBODY(null);  
304 - var t = TABLE(null, tb); 303 + var hold = DIV(null);
305 304
306 - tb.innerHTML = req.responseText; 305 + hold.innerHTML = req.responseText;
307 306
308 - var new_widgets = getElementsByTagAndClassName('TR','widget', tb);  
309 - simpleLog('DEBUG','new_widgets.length: ',new_widgets.length); 307 + var new_widgets = getElementsByTagAndClassName('DIV','field', hold);
  308 +
  309 + simpleLog('DEBUG','new_widgets.length: '+new_widgets.length);
310 var target = getBindTarget(fieldset); 310 var target = getBindTarget(fieldset);
311 - simpleLog('DEBUG','new_widgets.length: ',new_widgets.length); 311 + simpleLog('DEBUG','new_widgets.length: '+new_widgets.length);
312 for (var i=0; i<new_widgets.length; i++) { 312 for (var i=0; i<new_widgets.length; i++) {
313 var w = new_widgets[i]; 313 var w = new_widgets[i];
314 simpleLog('DEBUG','binding: '+toHTML(w)); 314 simpleLog('DEBUG','binding: '+toHTML(w));
resources/css/kt-treewidget.css 0 โ†’ 100644
  1 +/* CSS to handle the trees. */
  2 +.kt_treenodes {
  3 + list-style: none;
  4 + margin: 0;
  5 + padding: 0;
  6 + border: 0;
  7 + text-align: left !important;
  8 +}
  9 +
  10 +.leafnode {font-weight: bold; }
  11 +
  12 +.kt_treenodes ul {
  13 + list-style: none;
  14 + text-align: left;
  15 +}
  16 +.kt_treenodes li.treenode > a.pathnode {
  17 + background: transparent url(/graphics/plus.png) center left no-repeat;
  18 + padding-left: 15px;
  19 +}
  20 +
  21 +.kt_treenodes li.treenode.active > a.pathnode {
  22 + background: transparent url(/graphics/minus.png) center left no-repeat;
  23 +}
  24 +
  25 +.kt_treenodes li.active > ul {
  26 + display: block;
  27 +}
  28 +
  29 +.kt_treenodes li ul {
  30 + display: none;
  31 +}
  32 +
templates/kt3/document/edit.smarty
  1 +{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')}
  2 +{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')}
  3 +{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')}
  4 +{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DateTime.js')}
  5 +{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')}
  6 +
  7 +<!-- unforunate, but (currently) necessary -->
  8 +
  9 +{$context->oPage->requireJSResource('presentation/lookAndFeel/knowledgeTree/js/taillog.js')}
  10 +{$context->oPage->requireJSResource('presentation/lookAndFeel/knowledgeTree/js/conditional_usage.js')}
  11 +
  12 +{$context->oPage->requireCSSResource('resources/css/kt-treewidget.css')}
  13 +
1 <h2>Editing: {$document->getName()}</h2> 14 <h2>Editing: {$document->getName()}</h2>
2 <p class="descriptiveText"><strong>FIXME</strong>: do we need assisting text here?</p> 15 <p class="descriptiveText"><strong>FIXME</strong>: do we need assisting text here?</p>
3 16
templates/kt3/fields/tree.smarty 0 โ†’ 100644
  1 + <div class="field {if ($has_errors)}error{/if}">
  2 + <label for="{$name}">{$label}{if ($required === true)}<span class="required">(Required)</span>{/if}</label>
  3 + <p class="descriptiveText">{$description}</p>
  4 + {if ($has_errors)}
  5 + {foreach item=sError from=$errors}
  6 + <p class="errorMessage">
  7 + {$sError}
  8 + </p>
  9 + {/foreach}
  10 + {else}
  11 + <p class="errorMessage"></p>
  12 + {/if}
  13 +
  14 + {$options.tree}
  15 + <input type="hidden" name="kt_core_fieldsets_expect[{$name}]" value ="1" />
  16 + </div>
0 \ No newline at end of file 17 \ No newline at end of file
templates/kt3/fieldsets/conditional_editable.smarty 0 โ†’ 100644
  1 +<fieldset class="conditional_metadata">
  2 + <legend>{$title}</legend>
  3 + <input type="hidden" class="fixed" name="fieldset" value="{$fieldset_id}" />
  4 + <p class="descriptiveText">
  5 + {$description}
  6 + </p>
  7 +
  8 + <div class="conditional_target">
  9 + conditional data.
  10 + </div>
  11 +
  12 +</fieldset>
templates/ktcore/document/add.smarty
1 {$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')} 1 {$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')}
2 {$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')} 2 {$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')}
3 {$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')} 3 {$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')}
  4 +{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DateTime.js')}
4 {$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')} 5 {$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')}
5 6
  7 +<!-- unforunate, but (currently) necessary -->
  8 +
  9 +{$context->oPage->requireJSResource('presentation/lookAndFeel/knowledgeTree/js/taillog.js')}
  10 +{$context->oPage->requireJSResource('presentation/lookAndFeel/knowledgeTree/js/conditional_usage.js')}
  11 +
  12 +{$context->oPage->requireCSSResource('resources/css/kt-treewidget.css')}
  13 +
6 {capture assign=sJavascript} 14 {capture assign=sJavascript}
7 {literal} 15 {literal}
8 function swapInItem(elementId, req) { 16 function swapInItem(elementId, req) {
templates/ktcore/document/admin/archivedlist.smarty 0 โ†’ 100644
  1 +<h2>Archived Documents</h2>
  2 +
  3 +<p class="descriptiveText">In order to keep the documents which are visible useful
  4 +to end users, it is possible to <strong>archive</strong> old documents. Users who
  5 +want to see these old documents need to request their restoration - these requests
  6 +will typically be done within the system, and will generate a notification to you.
  7 +</p>
  8 +
  9 +<div class="ktError"><p><strong>FIXME</strong> this aspect of the UI is unuseable.
  10 +KT 2.x had a full-on search here. That's probably _also_ unuseable. Ponder an
  11 +improvement (probably notification driven / basic search driven. Even better: allow browse
  12 +with LIVE turned off.)</p></div>
  13 +
  14 +{if (!empty($documents))}
  15 +
  16 +<form action="{$smarty.server.PHP_SELF}" method="POST">
  17 +
  18 +<input type="hidden" name="action" value="confirm_restore" />
  19 +
  20 +<table class="listing">
  21 + <thead>
  22 + <tr>
  23 + <th>&nbsp;</th>
  24 + <th>Document Name</th>
  25 + <th>Location</th>
  26 + </tr>
  27 + </thead>
  28 + <tbody>
  29 + {foreach item=oDoc from=$documents}
  30 + <tr>
  31 + <td><input type="checkbox" name="selected_docs[]" value="{$oDoc->getId()}"/></td>
  32 + <td>{$oDoc->getName()}</td>
  33 + <td class="descriptiveText">{$oDoc->getDisplayPath()}</td>
  34 + </tr>
  35 + {/foreach}
  36 + </tbody>
  37 +</table>
  38 +<div class="form_actions">
  39 + <input type="submit" value="Expunge" />
  40 + <!-- <input type="submit" value="Restore" /> --> <!-- how do we want to handle restore in this? major UI issue :( -->
  41 +</div>
  42 +</form>
  43 +
  44 +{else}
  45 +<div class="ktInfo"><p>No documents are marked as archived.</p></div>
  46 +{/if}
0 \ No newline at end of file 47 \ No newline at end of file
templates/ktcore/document/admin/dearchiveconfirmlist.smarty 0 โ†’ 100644
  1 +<h2>Confirm De-archival</h2>
  2 +
  3 +<div class="ktInfo"><p><strong>Note</strong> please confirm that you want to restore these documents from an archived state.</p></div>
  4 +
  5 +{if (!empty($documents))}
  6 +
  7 +<form action="{$smarty.server.PHP_SELF}" method="POST">
  8 +
  9 +<input type="hidden" name="action" value="finish_restore" />
  10 +
  11 +<table class="listing">
  12 + <thead>
  13 + <tr>
  14 +
  15 + <th>Document Name</th>
  16 + <th>Location</th>
  17 + </tr>
  18 + </thead>
  19 + <tbody>
  20 + {foreach item=oDoc from=$documents}
  21 + <tr>
  22 + <td>{$oDoc->getName()}<input type="hidden" name="selected_docs[]" value="{$oDoc->getId()}" /></td>
  23 + <td class="descriptiveText">{$oDoc->getDisplayPath()}</td>
  24 + </tr>
  25 + {/foreach}
  26 + </tbody>
  27 +</table>
  28 +<div class="form_actions">
  29 + <input type="submit" value="Confirm De-archival" />
  30 +</div>
  31 +</form>
  32 +
  33 +{else}
  34 +<div class="ktInfo"><p>No documents were selected.</p></div>
  35 +{/if}
0 \ No newline at end of file 36 \ No newline at end of file
templates/ktcore/document/admin/deletedlist.smarty 0 โ†’ 100644
  1 +<h2>Deleted Documents</h2>
  2 +
  3 +<p class="descriptiveText">Documents which are deleted by users are hidden from view,
  4 +but still available for restoration. Since this consumes system resources, it
  5 +is possible to <strong>expunge</strong> these documents. Alternatively, you
  6 +can <strong>restore</strong> them as necessary.</p>
  7 +
  8 +<p class="descriptiveText"><strong>FIXME</strong> its probably very useful to add
  9 +more information about the documents below - e.g. when was it deleted (last modified?)</p>
  10 +
  11 +<p class="descriptiveText"><strong>FIXME</strong> Have a "select all" toggler here.</p>
  12 +
  13 +{if (!empty($documents))}
  14 +
  15 +<form action="{$smarty.server.PHP_SELF}" method="POST">
  16 +
  17 +<input type="hidden" name="action" value="confirm_expunge" />
  18 +
  19 +<table class="listing">
  20 + <thead>
  21 + <tr>
  22 + <th>&nbsp;</th>
  23 + <th>Document Name</th>
  24 + <th>Location</th>
  25 + </tr>
  26 + </thead>
  27 + <tbody>
  28 + {foreach item=oDoc from=$documents}
  29 + <tr>
  30 + <td><input type="checkbox" name="selected_docs[]" value="{$oDoc->getId()}"/></td>
  31 + <td>{$oDoc->getName()}</td>
  32 + <td class="descriptiveText">{$oDoc->getDisplayPath()}</td>
  33 + </tr>
  34 + {/foreach}
  35 + </tbody>
  36 +</table>
  37 +<div class="form_actions">
  38 + <input type="submit" value="Expunge" />
  39 + <!-- <input type="submit" value="Restore" /> --> <!-- how do we want to handle restore in this? major UI issue :( -->
  40 +</div>
  41 +</form>
  42 +
  43 +{else}
  44 +<div class="ktInfo"><p>No documents are marked as deleted.</p></div>
  45 +{/if}
0 \ No newline at end of file 46 \ No newline at end of file
templates/ktcore/document/admin/expungeconfirmlist.smarty 0 โ†’ 100644
  1 +<h2>Confirm Expunge</h2>
  2 +
  3 +<div class="ktInfo"><p><strong>Note</strong> please confirm that you want to delete these documents.</p></div>
  4 +
  5 +{if (!empty($documents))}
  6 +
  7 +<form action="{$smarty.server.PHP_SELF}" method="POST">
  8 +
  9 +<input type="hidden" name="action" value="finish_expunge" />
  10 +
  11 +<table class="listing">
  12 + <thead>
  13 + <tr>
  14 +
  15 + <th>Document Name</th>
  16 + <th>Location</th>
  17 + </tr>
  18 + </thead>
  19 + <tbody>
  20 + {foreach item=oDoc from=$documents}
  21 + <tr>
  22 + <td>{$oDoc->getName()}<input type="hidden" name="selected_docs[]" value="{$oDoc->getId()}" /></td>
  23 + <td class="descriptiveText">{$oDoc->getDisplayPath()}</td>
  24 + </tr>
  25 + {/foreach}
  26 + </tbody>
  27 +</table>
  28 +<div class="form_actions">
  29 + <input type="submit" value="Confirm Expunge" />
  30 + <!-- <input type="submit" value="Restore" /> --> <!-- how do we want to handle restore in this? major UI issue :( -->
  31 +</div>
  32 +</form>
  33 +
  34 +{else}
  35 +<div class="ktInfo"><p>No documents were selected.</p></div>
  36 +{/if}
0 \ No newline at end of file 37 \ No newline at end of file
templates/ktcore/metadata/chooseFromMetadataLookup.smarty
1 {foreach from=$aFieldValues key=iFieldId item=aFieldInfo } 1 {foreach from=$aFieldValues key=iFieldId item=aFieldInfo }
2 {assign var="oField" value=$aFieldInfo.field} 2 {assign var="oField" value=$aFieldInfo.field}
3 {assign var="aLookups" value=$aFieldInfo.values} 3 {assign var="aLookups" value=$aFieldInfo.values}
4 -<tr class="widget">  
5 - <th><span title="Field: {$oField->getId()}">{$oField->getName()|escape}</span></th>  
6 - <td>  
7 4
8 -<select name="emd{$oField->getId()}">  
9 - <option value="">Unset</option>  
10 -{foreach from=$aLookups item=oLookup}  
11 - <option value="{$oLookup->getId()}">{$oLookup->getName()}</option>  
12 -{/foreach}  
13 -</select> 5 +<div class="field ">
  6 + <label for="condi-field-{$iFieldId}">{$oField->getName()|escape}</label>
  7 + <p class="descriptiveText">FIXME</p>
  8 + <p class="errorMessage"></p>
  9 +
  10 +
  11 + <select name="metadata_{$iFieldId}" id="condi-field-{$iFieldId}" >
  12 + <option value="">Unset</option>
  13 + {foreach from=$aLookups item=oLookup}
  14 + <option value="{$oLookup->getName()}">{$oLookup->getName()}</option>
  15 + {/foreach}
  16 + </select>
  17 + <input type="hidden" name="kt_core_fieldsets_expect[metadata_{$iFieldId}]" value ="1" />
  18 +</div>
14 19
15 - </td>  
16 -</tr>  
17 {/foreach} 20 {/foreach}
templates/ktcore/metadata/editable_metadata_fields.smarty
1 -{literal}  
2 -<style>  
3 -  
4 -.kt_treenodes {  
5 - list-style: none;  
6 - margin: 0;  
7 - padding: 0;  
8 - border: 0;  
9 - text-align: left !important;  
10 -}  
11 -  
12 -.leafnode {font-weight: bold; }  
13 -  
14 -.kt_treenodes ul {  
15 - list-style: none;  
16 - text-align: left;  
17 -}  
18 -.kt_treenodes li.treenode > a.pathnode {  
19 - background: transparent url(/graphics/plus.png) center left no-repeat;  
20 - padding-left: 15px;  
21 -}  
22 -  
23 -.kt_treenodes li.treenode.active > a.pathnode {  
24 - background: transparent url(/graphics/minus.png) center left no-repeat;  
25 -}  
26 -  
27 -.kt_treenodes li.active > ul {  
28 - display: block;  
29 -}  
30 -  
31 -.kt_treenodes li ul {  
32 - display: none;  
33 -}  
34 -  
35 -</style>  
36 -{/literal}  
37 -  
38 <table class="prettysw" cellpadding="0" cellspacing="0"> 1 <table class="prettysw" cellpadding="0" cellspacing="0">
39 {if !$metadata_prefix} 2 {if !$metadata_prefix}
40 {assign var="metadata_prefix" value="emd"} 3 {assign var="metadata_prefix" value="emd"}
templates/ktcore/workflow/editState.smarty
1 -<h1>State: {$oState->getName()|escape}</h1>  
2 -  
3 -<h2>Edit state properties</h2> 1 +<h2>State: {$oState->getName()|escape}</h2>
4 2
5 <form action="{$smarty.server.PHP_SELF}" method="POST"> 3 <form action="{$smarty.server.PHP_SELF}" method="POST">
  4 +<fieldset>
  5 +<legend>Edit state properties</legend>
6 <input type="hidden" name="action" value="saveState" /> 6 <input type="hidden" name="action" value="saveState" />
7 <input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" /> 7 <input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" />
8 <input type="hidden" name="fStateId" value="{$oState->getId()}" /> 8 <input type="hidden" name="fStateId" value="{$oState->getId()}" />
9 <input type="textbox" name="fName" value="{$oState->getName()|escape}" /> 9 <input type="textbox" name="fName" value="{$oState->getName()|escape}" />
10 -<input type="submit" name="submit" value="Save" /> 10 +<div class="form_actions">
  11 + <input type="submit" name="submit" value="Save" />
  12 +</div>
  13 +</fieldset>
11 </form> 14 </form>
12 15
13 -<h2>Inform</h2>  
14 -  
15 -<p class="helpText">Please select which roles or groups should be  
16 -informed when this state is reached.</p>  
17 -  
18 <form action="{$smarty.server.PHP_SELF}" method="POST"> 16 <form action="{$smarty.server.PHP_SELF}" method="POST">
19 <input type="hidden" name="action" value="saveInform" /> 17 <input type="hidden" name="action" value="saveInform" />
20 <input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" /> 18 <input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" />
21 <input type="hidden" name="fStateId" value="{$oState->getId()}" /> 19 <input type="hidden" name="fStateId" value="{$oState->getId()}" />
  20 +
  21 +<fieldset>
  22 +<legend>Inform Which Users?</legend>
  23 +<p class="descriptiveText">Please select which roles or groups should be
  24 +informed when this state is reached.</p>
  25 +
  26 +
22 <h3>Roles</h3> 27 <h3>Roles</h3>
23 {entity_checkboxes entities=$aRoles name="fRoleIds" multiple="true" selected=$aInformed.role assign=aBoxes} 28 {entity_checkboxes entities=$aRoles name="fRoleIds" multiple="true" selected=$aInformed.role assign=aBoxes}
24 {foreach from=$aBoxes item=sBox} 29 {foreach from=$aBoxes item=sBox}
@@ -38,20 +43,27 @@ informed when this state is reached.&lt;/p&gt; @@ -38,20 +43,27 @@ informed when this state is reached.&lt;/p&gt;
38 {$sBox}<br /> 43 {$sBox}<br />
39 {/foreach} 44 {/foreach}
40 <input type="submit" name="submit" value="Save" /> 45 <input type="submit" name="submit" value="Save" />
  46 +
41 </form> 47 </form>
42 *} 48 *}
43 49
44 -<h2>Permissions</h2> 50 +</fieldset>
  51 +
45 52
46 -<p class="helpText">While in this workflow state, additional permissions 53 +<h3>Assigned Permissions</h3>
  54 +<p class="descriptiveText">While in this workflow state, additional permissions
47 may be given. This is done either to expose the document to more users 55 may be given. This is done either to expose the document to more users
48 or to allow a particular role to be fulfilled before a workflow 56 or to allow a particular role to be fulfilled before a workflow
49 transition can be accomplished.</p> 57 transition can be accomplished.</p>
50 58
51 -<h2>Transitions</h2> 59 +
  60 +<fieldset>
  61 +<legend>Transitions</legend>
52 {if $aTransitionsTo} 62 {if $aTransitionsTo}
53 -<h3>Transitions to this state</h3>  
54 63
  64 +
  65 +<h3>Transitions to this state</h3>
  66 +{if (!empty($aTransitionsTo))}
55 <ul> 67 <ul>
56 {foreach from=$aTransitionsTo item=oTransition} 68 {foreach from=$aTransitionsTo item=oTransition}
57 <li><a 69 <li><a
@@ -60,6 +72,9 @@ title=&quot;Transition @@ -60,6 +72,9 @@ title=&quot;Transition
60 {$oTransition->getId()}">{$oTransition->getName()|escape}</a></li> 72 {$oTransition->getId()}">{$oTransition->getName()|escape}</a></li>
61 {/foreach} 73 {/foreach}
62 </ul> 74 </ul>
  75 +{else}
  76 +No transitions lead to this state.
  77 +{/if}
63 78
64 {/if} 79 {/if}
65 80
@@ -68,22 +83,42 @@ title=&quot;Transition @@ -68,22 +83,42 @@ title=&quot;Transition
68 <input type="hidden" name="action" value="saveTransitions" /> 83 <input type="hidden" name="action" value="saveTransitions" />
69 <input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" /> 84 <input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" />
70 <input type="hidden" name="fStateId" value="{$oState->getId()}" /> 85 <input type="hidden" name="fStateId" value="{$oState->getId()}" />
  86 +
  87 +{if (!empty($aTransitions))}
71 {entity_checkboxes entities=$aTransitions name="fTransitionIds" multiple="true" selected=$aTransitionsSelected} 88 {entity_checkboxes entities=$aTransitions name="fTransitionIds" multiple="true" selected=$aTransitionsSelected}
  89 +<div class="form_actions">
72 <input type="submit" name="submit" value="Save" /> 90 <input type="submit" name="submit" value="Save" />
  91 +</div>
  92 +{else}
  93 +No transitions defined.
  94 +{/if}
73 </form> 95 </form>
  96 +</fieldset>
  97 +
  98 +
74 99
75 -<h2>Actions allowed</h2>  
76 100
77 <form action="{$smarty.server.PHP_SELF}" method="POST"> 101 <form action="{$smarty.server.PHP_SELF}" method="POST">
  102 +<fieldset>
  103 +<legend>Actions allowed</legend>
  104 +
78 <input type="hidden" name="action" value="setStateActions" /> 105 <input type="hidden" name="action" value="setStateActions" />
79 <input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" /> 106 <input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" />
80 <input type="hidden" name="fStateId" value="{$oState->getId()}" /> 107 <input type="hidden" name="fStateId" value="{$oState->getId()}" />
  108 +
  109 +{if (!empty($aActions))}
81 <ul> 110 <ul>
82 {entity_checkboxes name="fActions" entities=$aActions idmethod="getName" method="getDisplayName" assign="aCheckboxes" selected="$aActionsSelected"} 111 {entity_checkboxes name="fActions" entities=$aActions idmethod="getName" method="getDisplayName" assign="aCheckboxes" selected="$aActionsSelected"}
83 {foreach from=$aCheckboxes item=sCheckbox} 112 {foreach from=$aCheckboxes item=sCheckbox}
84 <li>{$sCheckbox}</li> 113 <li>{$sCheckbox}</li>
85 {/foreach} 114 {/foreach}
86 </ul> 115 </ul>
87 -<input type="submit" name="submit" value="Set allowed actions" /> 116 +<div class="form_actions">
  117 + <input type="submit" name="submit" value="Set allowed actions" />
  118 +</div>
  119 +{else}
  120 +No actions defined.
  121 +{/if}
  122 +</fieldset>
88 </form> 123 </form>
89 124
templates/ktcore/workflow/editTransition.smarty
1 -<h1>Transition: {$oTransition->getName()|escape}</h1> 1 +<h2>Transition: {$oTransition->getName()|escape}</h2>
2 2
3 -<h2>Edit transition properties</h2> 3 +
  4 +<form action="{$smarty.server.PHP_SELF}" method="POST">
  5 +<fieldset>
  6 +<legend>Edit transition properties</legend>
4 7
5 <p class="helpText">Select the target state of the transition, and 8 <p class="helpText">Select the target state of the transition, and
6 select the permission, group, and/or role necessary to perform the 9 select the permission, group, and/or role necessary to perform the
@@ -8,42 +11,17 @@ transition. Selecting more than one of permission, group, or role will @@ -8,42 +11,17 @@ transition. Selecting more than one of permission, group, or role will
8 require that the user wishing to perform the transition fulfil every 11 require that the user wishing to perform the transition fulfil every
9 requirement.</p> 12 requirement.</p>
10 13
11 -<form action="{$smarty.server.PHP_SELF}" method="POST">  
12 <input type="hidden" name="action" value="saveTransition" /> 14 <input type="hidden" name="action" value="saveTransition" />
13 <input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" /> 15 <input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" />
14 <input type="hidden" name="fTransitionId" value="{$oTransition->getId()}" /> 16 <input type="hidden" name="fTransitionId" value="{$oTransition->getId()}" />
15 -<table class="prettysw" cellpadding="0" cellspacing="0">  
16 -<tr><th>Name</th><td><input type="textbox" name="fName" value="{$oTransition->getName()|escape}" /></td></tr>  
17 -<tr>  
18 - <th>Target State</th>  
19 - <td>{entity_select entities=$aStates selected=$oTransition->getTargetStateId() name="fTargetStateId"}</td>  
20 -</tr>  
21 -<tr>  
22 - <th>Guard Permission</th>  
23 - <td>{entity_select entities=$aPermissions  
24 -selected=$oTransition->getGuardPermissionId() name="fPermissionId"  
25 -none=true}</td>  
26 -</tr>  
27 -<tr>  
28 - <th>Guard Group</th>  
29 - <td>{entity_select entities=$aGroups  
30 -selected=$oTransition->getGuardGroupId() name="fGroupId" none=true}</td>  
31 -</tr>  
32 -{if $aRoles}  
33 -<tr>  
34 - <th>Guard Role</th>  
35 - <td>{entity_select entities=$aRoles  
36 -selected=$oTransition->getGuardRoleId() name="fRoleId" none=true}</td>  
37 -</tr>  
38 -{/if}  
39 -{if $aConditions}  
40 -<tr>  
41 - <th>Guard Condition</th>  
42 - <td>{entity_select entities=$aConditions  
43 -selected=$oTransition->getGuardConditionId() name="fConditionId" none=true}</td>  
44 -</tr>  
45 -{/if}  
46 -</table> 17 +
  18 +{foreach item=oWidget from=$edit_fields}
  19 + {$oWidget->render()}
  20 +{/foreach}
  21 +
  22 +<div class="form_actions">
47 <input type="submit" name="submit" value="Save" /> 23 <input type="submit" name="submit" value="Save" />
  24 +</div>
  25 +</fieldset>
48 </form> 26 </form>
49 27
templates/ktcore/workflow/editWorkflow.smarty
1 -<h1>Workflow: {$oWorkflow->getName()|escape}</h1> 1 +<h2>Workflow: {$oWorkflow->getName()|escape}</h2>
  2 +
2 3
3 -<h2>Edit workflow properties</h2>  
4 4
5 <form action="{$smarty.server.PHP_SELF}" method="POST"> 5 <form action="{$smarty.server.PHP_SELF}" method="POST">
  6 +<fieldset>
  7 +<legend>Edit workflow properties</legend>
6 <input type="hidden" name="action" value="saveWorkflow" /> 8 <input type="hidden" name="action" value="saveWorkflow" />
7 <input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" /> 9 <input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" />
8 -<table class="prettysw" cellpadding="0" cellspacing="0">  
9 -<tr>  
10 - <th>Name</th>  
11 - <td><input type="textbox" name="fName" value="{$oWorkflow->getName()|escape}" /></td>  
12 -</tr>  
13 -<tr>  
14 - <th>Starting state</th>  
15 - <td>{ entity_select entities=$aStates name="fStartStateId" none=true selected=$oWorkflow->getStartStateId()}</td>  
16 -</tr>  
17 -</table>  
18 -<input type="submit" name="submit" value="Save" /> 10 +
  11 +{foreach item=oWidget from=$edit_fields}
  12 + {$oWidget->render()}
  13 +{/foreach}
  14 +
  15 +<div class="form_actions">
  16 +<input type="submit" name="submit" value="Update workflow properties" />
  17 +</div>
  18 +</fieldset>
19 </form> 19 </form>
20 20
21 -<h2>States</h2> 21 +<h3>States</h3>
  22 +<p class="descriptiveText"><strong>FIXME</strong> insert intelligent help.</p>
  23 +<form action="{$smarty.server.PHP_SELF}" method="POST">
  24 +<fieldset>
  25 +<legend>Create a new state</legend>
  26 +<input type="hidden" name="action" value="newState" />
  27 +<input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" />
22 28
23 -{if $aStates}  
24 -<h3>Existing states</h3>  
25 29
  30 +{foreach item=oWidget from=$add_state_fields}
  31 + {$oWidget->render()}
  32 +{/foreach}
  33 +
  34 +<div class="form_actions">
  35 +<input type="submit" name="submit" value="Create state" />
  36 +</div>
  37 +</fieldset>
  38 +</form>
  39 +
  40 +{if $aStates}
  41 +<h4>Existing states</h4>
  42 +<p class="descriptiveText">Select a state to update its properties.</p>
26 <ul> 43 <ul>
27 {foreach from=$aStates item=oState} 44 {foreach from=$aStates item=oState}
28 <li><a 45 <li><a
@@ -32,16 +49,31 @@ title=&quot;State {$oState-&gt;getId()}&quot;&gt;{$oState-&gt;getName()|escape}&lt;/a&gt;&lt;/li&gt; @@ -32,16 +49,31 @@ title=&quot;State {$oState-&gt;getId()}&quot;&gt;{$oState-&gt;getName()|escape}&lt;/a&gt;&lt;/li&gt;
32 </ul> 49 </ul>
33 {/if} 50 {/if}
34 51
35 -<h3>Create a new state</h3> 52 +
  53 +
  54 +
  55 +
  56 +<h3>Transitions</h3>
  57 +
  58 +<p class="descriptiveText"><strong>FIXME</strong> insert intelligent help.</p>
36 59
37 <form action="{$smarty.server.PHP_SELF}" method="POST"> 60 <form action="{$smarty.server.PHP_SELF}" method="POST">
38 -<input type="hidden" name="action" value="newState" /> 61 +<fieldset>
  62 +<legend>Create a new transition</legend>
  63 +<input type="hidden" name="action" value="newTransition" />
39 <input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" /> 64 <input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" />
40 -<input type="textbox" name="fName" />  
41 -<input type="submit" name="submit" value="Create state" /> 65 +
  66 +
  67 +{foreach item=oWidget from=$add_transition_fields}
  68 + {$oWidget->render()}
  69 +{/foreach}
  70 +
  71 +<div class="form_actions">
  72 +<input type="submit" name="submit" value="Create transition" />
  73 +</div>
  74 +</fieldset>
42 </form> 75 </form>
43 76
44 -<h2>Transitions</h2>  
45 77
46 {if $aTransitions} 78 {if $aTransitions}
47 <h3>Existing transitions</h3> 79 <h3>Existing transitions</h3>
@@ -55,35 +87,26 @@ title=&quot;Transition {$oTransition-&gt;getId()}&quot;&gt;{$oTransition-&gt;getName()|escape}&lt;/a&gt;&lt; @@ -55,35 +87,26 @@ title=&quot;Transition {$oTransition-&gt;getId()}&quot;&gt;{$oTransition-&gt;getName()|escape}&lt;/a&gt;&lt;
55 </ul> 87 </ul>
56 {/if} 88 {/if}
57 89
58 -<h3>Create a new transition</h3>  
59 90
60 -<form action="{$smarty.server.PHP_SELF}" method="POST">  
61 -<input type="hidden" name="action" value="newTransition" />  
62 -<input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" />  
63 -<table class="prettysw" cellpadding="0" cellspacing="0">  
64 -<tr><th>Name</th><td><input type="textbox" name="fName" /></td></tr>  
65 -<tr>  
66 - <th>Target State</th>  
67 - <td>{entity_select entities=$aStates name="fTargetStateId"}</td>  
68 -</tr>  
69 -<tr>  
70 - <th>Guard permission</th>  
71 - <td>{entity_select entities=$aPermissions name="fPermissionId"}</td>  
72 -</tr>  
73 -</table>  
74 -<input type="submit" name="submit" value="Create transition" />  
75 -</form>  
76 91
77 -<h2>Actions controlled</h2>  
78 92
79 <form action="{$smarty.server.PHP_SELF}" method="POST"> 93 <form action="{$smarty.server.PHP_SELF}" method="POST">
  94 +<fieldset>
  95 +<legend>Actions controlled</legend>
  96 +
  97 +<p class="descriptiveText"><strong>FIXME</strong> be helpful</p>
  98 +
80 <input type="hidden" name="action" value="setWorkflowActions" /> 99 <input type="hidden" name="action" value="setWorkflowActions" />
81 <input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" /> 100 <input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" />
  101 +
82 <ul> 102 <ul>
83 {entity_checkboxes name="fActions" entities=$aActions idmethod="getName" method="getDisplayName" assign="aCheckboxes" selected="$aActionsSelected"} 103 {entity_checkboxes name="fActions" entities=$aActions idmethod="getName" method="getDisplayName" assign="aCheckboxes" selected="$aActionsSelected"}
84 {foreach from=$aCheckboxes item=sCheckbox} 104 {foreach from=$aCheckboxes item=sCheckbox}
85 <li>{$sCheckbox}</li> 105 <li>{$sCheckbox}</li>
86 {/foreach} 106 {/foreach}
87 </ul> 107 </ul>
88 -<input type="submit" name="submit" value="Set controlled actions" /> 108 +<div class="form_actions">
  109 + <input type="submit" name="submit" value="Set controlled actions" />
  110 +</div>
  111 +</fieldset>
89 </form> 112 </form>
templates/ktcore/workflow/listWorkflows.smarty
1 -<h1>Workflow</h1> 1 +<h2>Workflow</h2>
  2 +
  3 +<form action="{$smarty.server.PHP_SELF}" method="POST">
  4 +<fieldset>
  5 +<legend>Create a new workflow</legend>
  6 +
  7 +<input type="hidden" name="action" value="newWorkflow" />
  8 +
  9 +
  10 +{foreach item=oWidget from=$add_fields}
  11 + {$oWidget->render()}
  12 +{/foreach}
  13 +
  14 +<div class="form_actions">
  15 + <input type="submit" name="submit" value="Create" />
  16 +</div>
  17 +</fieldset>
  18 +</form>
2 19
3 -{if $aWorkflow}  
4 -<h2>Existing workflows</h2>  
5 20
  21 +{if $aWorkflow}
  22 +<h3>Existing workflows</h3>
  23 +<p class="descriptiveText">Select a workflow to modify.</p>
6 <ul> 24 <ul>
7 {foreach from=$aWorkflow item=oWorkflow} 25 {foreach from=$aWorkflow item=oWorkflow}
8 <li><a href="?action=editWorkflow&fWorkflowId={$oWorkflow->getId()}" title="Workflow: {$oWorkflow->getId()}">{$oWorkflow->getName()}</a></li> 26 <li><a href="?action=editWorkflow&fWorkflowId={$oWorkflow->getId()}" title="Workflow: {$oWorkflow->getId()}">{$oWorkflow->getName()}</a></li>
@@ -10,10 +28,6 @@ @@ -10,10 +28,6 @@
10 </ul> 28 </ul>
11 {/if} 29 {/if}
12 30
13 -<h2>Create a new workflow</h2>  
14 31
15 -<form action="{$smarty.server.PHP_SELF}" method="POST">  
16 -<input type="hidden" name="action" value="newWorkflow" />  
17 -<input type="textbox" name="fName" />  
18 -<input type="submit" name="submit" value="Create" />  
19 -</form> 32 +
  33 +