Commit b647c1c3de304274993f2d92b493a266c7d13330

Authored by Brad Shuttleworth
1 parent 69bdd4f5

Brad Shuttleworth 2006-02-20 fix for KTS-428

Brad Shuttleworth 2006-02-17 fix for KTS-94 fix for subscriptions not fi...


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4980 c91229c3-7414-0410-bfa2-8a42b809f60b
admin.php
@@ -28,15 +28,31 @@ class AdminSplashDispatcher extends KTAdminDispatcher { @@ -28,15 +28,31 @@ class AdminSplashDispatcher extends KTAdminDispatcher {
28 // are we categorised, or not? 28 // are we categorised, or not?
29 $oRegistry =& KTAdminNavigationRegistry::getSingleton(); 29 $oRegistry =& KTAdminNavigationRegistry::getSingleton();
30 $categories = $oRegistry->getCategories(); 30 $categories = $oRegistry->getCategories();
  31 + $KTConfig =& KTConfig::getSingleton();
  32 + $condensed_admin = $KTConfig->get("condensedAdminUI");
31 33
  34 + $aAllItems = array();
32 // we need to investigate sub_url solutions. 35 // we need to investigate sub_url solutions.
  36 + if ($condensed_admin) {
  37 + foreach ($categories as $aCategory) {
  38 + $aItems = $oRegistry->getItemsForCategory($aCategory['name']);
  39 + $aAllItems[$aCategory['name']] = $aItems;
  40 + }
  41 + }
33 42
34 $this->oPage->title = _("DMS Administration") . ": "; 43 $this->oPage->title = _("DMS Administration") . ": ";
35 $oTemplating = new KTTemplating; 44 $oTemplating = new KTTemplating;
36 - $oTemplate = $oTemplating->loadTemplate("kt3/admin_categories"); 45 +
  46 + if ($condensed_admin) {
  47 + $oTemplate = $oTemplating->loadTemplate("kt3/admin_fulllist");
  48 + } else {
  49 + $oTemplate = $oTemplating->loadTemplate("kt3/admin_categories");
  50 + }
  51 +
37 $aTemplateData = array( 52 $aTemplateData = array(
38 "context" => $this, 53 "context" => $this,
39 "categories" => $categories, 54 "categories" => $categories,
  55 + "all_items" => $aAllItems,
40 "baseurl" => $_SERVER['PHP_SELF'], 56 "baseurl" => $_SERVER['PHP_SELF'],
41 ); 57 );
42 return $oTemplate->render($aTemplateData); 58 return $oTemplate->render($aTemplateData);
@@ -85,8 +101,9 @@ if (empty($sub_url)) { @@ -85,8 +101,9 @@ if (empty($sub_url)) {
85 $aCategory = $oRegistry->getCategory($aParts[0]); 101 $aCategory = $oRegistry->getCategory($aParts[0]);
86 102
87 $oDispatcher->aBreadcrumbs = array(); 103 $oDispatcher->aBreadcrumbs = array();
88 - $oDispatcher->aBreadcrumbs[] = array('url' => KTUtil::getRequestScriptName($_SERVER), 'name' => 'Administration'); 104 + $oDispatcher->aBreadcrumbs[] = array('action' => "administration", 'name' => 'Administration');
89 $oDispatcher->aBreadcrumbs[] = array("name" => $aCategory['title'], "url" => KTUtil::ktLink('admin.php',$aParts[0])); 105 $oDispatcher->aBreadcrumbs[] = array("name" => $aCategory['title'], "url" => KTUtil::ktLink('admin.php',$aParts[0]));
  106 +
90 } else { 107 } else {
91 // FIXME (minor) redirect to no-suburl? 108 // FIXME (minor) redirect to no-suburl?
92 $oDispatcher = new AdminSplashDispatcher(); 109 $oDispatcher = new AdminSplashDispatcher();
config/config.ini
@@ -86,6 +86,9 @@ alwaysShowAll = default @@ -86,6 +86,9 @@ alwaysShowAll = default
86 ; have expired. 86 ; have expired.
87 automaticRefresh = default 87 automaticRefresh = default
88 88
  89 +; use a condensed admin ui
  90 +condensedAdminUI = default
  91 +
89 ; ---------------------------------------------------------------- 92 ; ----------------------------------------------------------------
90 ; These sections are for more esoteric settings - you probably don't 93 ; These sections are for more esoteric settings - you probably don't
91 ; want to mess with these 94 ; want to mess with these
config/dmsDefaults.php
@@ -401,6 +401,7 @@ $oKTConfig->setdefaultns("user_prefs", "restrictAdminPasswords", false); @@ -401,6 +401,7 @@ $oKTConfig->setdefaultns("user_prefs", "restrictAdminPasswords", false);
401 401
402 $oKTConfig->setdefaultns("ui", "ieGIF", true); 402 $oKTConfig->setdefaultns("ui", "ieGIF", true);
403 $oKTConfig->setdefaultns("ui", "alwaysShowAll", false); 403 $oKTConfig->setdefaultns("ui", "alwaysShowAll", false);
  404 +$oKTConfig->setdefaultns("ui", "condensedAdminUI", false);
404 405
405 $oKTConfig->setdefaultns(null, "logLevel", 'INFO'); 406 $oKTConfig->setdefaultns(null, "logLevel", 'INFO');
406 $oKTConfig->setdefaultns("import", "unzip", 'unzip'); 407 $oKTConfig->setdefaultns("import", "unzip", 'unzip');
lib/dispatcher.inc.php
@@ -216,6 +216,10 @@ class KTStandardDispatcher extends KTDispatcher { @@ -216,6 +216,10 @@ class KTStandardDispatcher extends KTDispatcher {
216 return true; 216 return true;
217 } 217 }
218 218
  219 + function addInfoMessage($sMessage) { $_SESSION['KTInfoMessage'][] = $sMessage; }
  220 +
  221 + function addErrorMessage($sMessage) { $_SESSION['KTErrorMessage'][] = $sMessage; }
  222 +
219 function handleOutput($data) { 223 function handleOutput($data) {
220 global $default; 224 global $default;
221 global $sectionName; 225 global $sectionName;
lib/util/ktutil.inc
@@ -488,11 +488,13 @@ class KTUtil { @@ -488,11 +488,13 @@ class KTUtil {
488 $root = $KTConfig->get("KnowledgeTree/rootUrl"); 488 $root = $KTConfig->get("KnowledgeTree/rootUrl");
489 $url = generateLink($base); 489 $url = generateLink($base);
490 490
491 - $hasPathInfo = $KTConfig->get("KnowledgeTree/pathInfoSupport");  
492 - if ($hasPathInfo) {  
493 - $url .= $subpath;  
494 - } else {  
495 - $url = KTUtil::addQueryString($url, "kt_path_info=" . $subpath); 491 + if (!empty($subpath)) {
  492 + $hasPathInfo = $KTConfig->get("KnowledgeTree/pathInfoSupport");
  493 + if ($hasPathInfo) {
  494 + $url .= $subpath;
  495 + } else {
  496 + $url = KTUtil::addQueryString($url, "kt_path_info=" . $subpath);
  497 + }
496 } 498 }
497 499
498 return KTUtil::addQueryString($url, $qs); 500 return KTUtil::addQueryString($url, $qs);
plugins/ktcore/KTCorePlugin.php
@@ -51,6 +51,10 @@ class KTCorePlugin extends KTPlugin { @@ -51,6 +51,10 @@ class KTCorePlugin extends KTPlugin {
51 'KTBrowseModePortlet', 'ktcore.portlets.browsemodes', 51 'KTBrowseModePortlet', 'ktcore.portlets.browsemodes',
52 'KTPortlets.php'); 52 'KTPortlets.php');
53 53
  54 + $this->registerPortlet(array('administration'),
  55 + 'KTAdminSectionNavigation', 'ktcore.portlets.adminnavigation',
  56 + 'KTPortlets.php');
  57 +
54 $this->setupAdmin(); 58 $this->setupAdmin();
55 } 59 }
56 60
plugins/ktcore/KTPortlets.php
@@ -41,7 +41,7 @@ class KTBrowseModePortlet extends KTPortlet { @@ -41,7 +41,7 @@ class KTBrowseModePortlet extends KTPortlet {
41 parent::KTPortlet($sTitle); 41 parent::KTPortlet($sTitle);
42 } 42 }
43 43
44 - function render() { 44 + function render() {
45 // this is unfortunate, but such is life. 45 // this is unfortunate, but such is life.
46 $current_action = KTUtil::arrayGet($_REQUEST, 'fBrowseMode', null); 46 $current_action = KTUtil::arrayGet($_REQUEST, 'fBrowseMode', null);
47 $modes = array( 47 $modes = array(
@@ -107,3 +107,29 @@ class KTAdminModePortlet extends KTPortlet { @@ -107,3 +107,29 @@ class KTAdminModePortlet extends KTPortlet {
107 return $oTemplate->render($aTemplateData); 107 return $oTemplate->render($aTemplateData);
108 } 108 }
109 } 109 }
  110 +
  111 +
  112 +
  113 +class KTAdminSectionNavigation extends KTPortlet {
  114 +
  115 + function KTAdminSectionNavigation() {
  116 + parent::KTPortlet(_("Administration"));
  117 + }
  118 +
  119 + function render() {
  120 + require_once(KT_LIB_DIR . "/plugins/KTAdminNavigation.php");
  121 +
  122 + $oRegistry =& KTAdminNavigationRegistry::getSingleton();
  123 + $categories = $oRegistry->getCategories();
  124 +
  125 + // we need to investigate sub_url solutions.
  126 +
  127 + $oTemplating = new KTTemplating;
  128 + $oTemplate = $oTemplating->loadTemplate("kt3/portlets/admin_categories");
  129 + $aTemplateData = array(
  130 + "context" => $this,
  131 + "categories" => $categories,
  132 + );
  133 + return $oTemplate->render($aTemplateData);
  134 + }
  135 +}
plugins/ktcore/admin/documentFields.php
@@ -32,7 +32,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { @@ -32,7 +32,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
32 $createFields[] = new KTTextWidget('Description', _('A brief description of the information stored in this fieldset.'), 'description', null, $this->oPage, true); 32 $createFields[] = new KTTextWidget('Description', _('A brief description of the information stored in this fieldset.'), 'description', null, $this->oPage, true);
33 $createFields[] = new KTCheckboxWidget('Generic', _('A generic fieldset is one that is available for every document by default. These fieldsets will be available for users to edit and add for every document in the document management system.'), 'generic', false, $this->oPage, false); 33 $createFields[] = new KTCheckboxWidget('Generic', _('A generic fieldset is one that is available for every document by default. These fieldsets will be available for users to edit and add for every document in the document management system.'), 'generic', false, $this->oPage, false);
34 $createFields[] = new KTCheckboxWidget('System', 34 $createFields[] = new KTCheckboxWidget('System',
35 - _('A system fieldset is one that is never displayed to a user, and is used only by the document management system.'), 'generic', false, $this->oPage, false); 35 + _('A system fieldset is one that is never displayed to a user, and is used only by the document management system.'), 'system', false, $this->oPage, false);
36 36
37 37
38 $oTemplating =& KTTemplating::getSingleton(); 38 $oTemplating =& KTTemplating::getSingleton();
@@ -120,7 +120,11 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { @@ -120,7 +120,11 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher {
120 if (KTUtil::arrayGet($_REQUEST, 'system')) { 120 if (KTUtil::arrayGet($_REQUEST, 'system')) {
121 $bIsSystem = true; 121 $bIsSystem = true;
122 // Can't be a system fieldset and a generic fieldset... 122 // Can't be a system fieldset and a generic fieldset...
123 - $bIsGeneric = false; 123 + if ($bIsGeneric) {
  124 + $bIsGeneric = false;
  125 + $this->addInfoMessage(_('System fieldsets cannot be generic. Generic flag removed.'));
  126 + }
  127 +
124 } 128 }
125 129
126 // basic validation 130 // basic validation
plugins/ktcore/folder/addDocument.php
@@ -91,6 +91,11 @@ class KTFolderAddDocumentAction extends KTFolderAction { @@ -91,6 +91,11 @@ class KTFolderAddDocumentAction extends KTFolderAction {
91 $aFile = $this->oValidator->validateFile($_FILES['file'], $aErrorOptions); 91 $aFile = $this->oValidator->validateFile($_FILES['file'], $aErrorOptions);
92 $sTitle = $this->oValidator->validateString($_REQUEST['title'], $aErrorOptions); 92 $sTitle = $this->oValidator->validateString($_REQUEST['title'], $aErrorOptions);
93 93
  94 + if (KTDocumentUtil::exists( $this->oFolder, basename($aFile['name']))) {
  95 + $this->errorRedirectToMain(_('There is already a document with that filename in this folder.'),'fFolderId=' . $this->oFolder->getId());
  96 + exit(0);
  97 + }
  98 +
94 $matches = array(); 99 $matches = array();
95 $aFields = array(); 100 $aFields = array();
96 foreach ($_REQUEST as $k => $v) { 101 foreach ($_REQUEST as $k => $v) {
plugins/ktstandard/KTSubscriptions.php
@@ -24,6 +24,8 @@ class KTSubscriptionPlugin extends KTPlugin { @@ -24,6 +24,8 @@ class KTSubscriptionPlugin extends KTPlugin {
24 'ktstandard.subscription.documentunsubscription'); 24 'ktstandard.subscription.documentunsubscription');
25 $this->registerTrigger('checkout', 'postValidate', 'KTCheckoutSubscriptionTrigger', 25 $this->registerTrigger('checkout', 'postValidate', 'KTCheckoutSubscriptionTrigger',
26 'ktstandard.triggers.subscription.checkout'); 26 'ktstandard.triggers.subscription.checkout');
  27 + $this->registerTrigger('edit', 'postValidate', 'KTEditSubscriptionTrigger',
  28 + 'ktstandard.triggers.subscription.checkout');
27 $this->registerTrigger('delete', 'postValidate', 'KTDeleteSubscriptionTrigger', 29 $this->registerTrigger('delete', 'postValidate', 'KTDeleteSubscriptionTrigger',
28 'ktstandard.triggers.subscription.delete'); 30 'ktstandard.triggers.subscription.delete');
29 $this->registerTrigger('moveDocument', 'postValidate', 'KTDocumentMoveSubscriptionTrigger', 31 $this->registerTrigger('moveDocument', 'postValidate', 'KTDocumentMoveSubscriptionTrigger',
@@ -180,6 +182,28 @@ class KTCheckoutSubscriptionTrigger { @@ -180,6 +182,28 @@ class KTCheckoutSubscriptionTrigger {
180 } 182 }
181 // }}} 183 // }}}
182 184
  185 +
  186 +// {{{ KTCheckoutSubscriptionTrigger
  187 +class KTEditSubscriptionTrigger {
  188 + var $aInfo = null;
  189 + function setInfo(&$aInfo) {
  190 + $this->aInfo =& $aInfo;
  191 + }
  192 +
  193 + function postValidate() {
  194 + global $default;
  195 + $oDocument =& $this->aInfo["document"];
  196 + // fire subscription alerts for the checked out document
  197 +
  198 + // fire subscription alerts for the checked in document
  199 + $oSubscriptionEvent = new SubscriptionEvent();
  200 + $oFolder = Folder::get($oDocument->getFolderID());
  201 + $oSubscriptionEvent->ModifyDocument($oDocument, $oFolder);
  202 +
  203 + }
  204 +}
  205 +// }}}
  206 +
183 // {{{ KTDeleteSubscriptionTrigger 207 // {{{ KTDeleteSubscriptionTrigger
184 class KTDeleteSubscriptionTrigger { 208 class KTDeleteSubscriptionTrigger {
185 var $aInfo = null; 209 var $aInfo = null;
resources/css/kt-framing.css
@@ -550,6 +550,10 @@ a.main_nav_item { @@ -550,6 +550,10 @@ a.main_nav_item {
550 white-space: nowrap !important; 550 white-space: nowrap !important;
551 } 551 }
552 552
  553 +.kt_collection.narrow {
  554 + width: auto;
  555 +}
  556 +
553 .kt_collection thead th { 557 .kt_collection thead th {
554 border-bottom: 1px solid #888; 558 border-bottom: 1px solid #888;
555 text-align: left; 559 text-align: left;
templates/kt3/admin_fulllist.smarty 0 → 100644
  1 +<dl class="panel_menu">
  2 + {foreach item=aCategory from=$categories}
  3 + <dt>{capture assign="cat_id"}{$aCategory.name}{/capture}<a href="{$smarty.server.PHP_SELF|addQueryString:"action=viewCategory&fCategory=$cat_id"}">{$aCategory.title}</a></dt>
  4 + <dd>
  5 + <p class="descriptiveText">{$aCategory.description}</p>
  6 + <p>{foreach item=aItem from=$all_items.$cat_id name=itemlist}
  7 + <a href="{ktLink base="admin.php" subpath="`$aItem.fullname`"}">{$aItem.title}</a> {if !($smarty.foreach.itemlist.last)} | {/if}
  8 + {/foreach}
  9 + </p>
  10 + </dd>
  11 + {/foreach}
  12 +</dl>
0 \ No newline at end of file 13 \ No newline at end of file
templates/kt3/portlets/admin_categories.smarty 0 → 100644
  1 +<ul class="actionlist">
  2 + {foreach item=aCategory from=$categories}
  3 + <li><a href="{ktLink base="admin.php" query="action=viewCategory&fCategory=`$aCategory.name`"}">{$aCategory.title}</a></li>
  4 + {/foreach}
  5 +</ul>
0 \ No newline at end of file 6 \ No newline at end of file
templates/ktcore/metadata/listFieldsets.smarty
@@ -5,11 +5,12 @@ @@ -5,11 +5,12 @@
5 { if $fieldsets} 5 { if $fieldsets}
6 <h3>{i18n}Existing document fieldsets{/i18n}</h3> 6 <h3>{i18n}Existing document fieldsets{/i18n}</h3>
7 7
8 -<table class="listing" cellpadding="1.5em" cellspacing="0"> 8 +<table class="kt_collection narrow" cellpadding="1.5em" cellspacing="0">
9 <thead> 9 <thead>
10 <tr> 10 <tr>
11 <th>{i18n}Name{/i18n}</th> 11 <th>{i18n}Name{/i18n}</th>
12 - <th>{i18n}Is Generic{/i18n}</th> 12 + <th class="centered">{i18n}Is Generic{/i18n}</th>
  13 + <th class="centered">{i18n}Is System{/i18n}</th>
13 <th>{i18n}Fields{/i18n}</th> 14 <th>{i18n}Fields{/i18n}</th>
14 <th>{i18n}Edit{/i18n}</th> 15 <th>{i18n}Edit{/i18n}</th>
15 <th>{i18n}Delete{/i18n}</th> 16 <th>{i18n}Delete{/i18n}</th>
@@ -22,13 +23,20 @@ @@ -22,13 +23,20 @@
22 { $oFieldset->getName() } 23 { $oFieldset->getName() }
23 </a> 24 </a>
24 </td> 25 </td>
25 - <td> 26 + <td class="centered">
26 {if ($oFieldset->getIsGeneric())} 27 {if ($oFieldset->getIsGeneric())}
27 - {i18n}Yes{/i18n} 28 + <span class="ktAction ktInline ktAllowed">{i18n}Yes{/i18n}</span>
28 {else} 29 {else}
29 - {i18n}No{/i18n} 30 + <span class="ktAction ktInline ktDenied">{i18n}No{/i18n}</span>
30 {/if} 31 {/if}
31 </td> 32 </td>
  33 + <td class="centered">
  34 +{if ($oFieldset->getIsSystem())}
  35 + <span class="ktAction ktInline ktAllowed">{i18n}Yes{/i18n}</span>
  36 +{else}
  37 + <span class="ktAction ktInline ktDenied">{i18n}No{/i18n}</span>
  38 +{/if}
  39 + </td>
32 <td> 40 <td>
33 {assign var="aFields" value=$oFieldset->getFields()} 41 {assign var="aFields" value=$oFieldset->getFields()}
34 {if $aFields} 42 {if $aFields}