Commit e64ee2c9838630696beeed82ebb64855472ec32e

Authored by bshuttle
1 parent a689151f

- fix for KTS-345

- add config flag (off by default) to show_al...
- fix for KTS-339 and 340


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4882 c91229c3-7414-0410-bfa2-8a42b809f60b
browse.php
... ... @@ -57,6 +57,19 @@ class KTMassMoveColumn extends TitleColumn {
57 57 parent::TitleColumn($sLabel, $sName);
58 58 }
59 59  
  60 + function renderFolderLink($aDataRow) {
  61 + $aFolders = $_SESSION['moves'][$this->sMoveCode]['folders'];
  62 + if (array_search($aDataRow['folder']->getId(), $aFolders) === false) {
  63 + $outStr = '<a href="' . $this->buildFolderLink($aDataRow) . '">';
  64 + $outStr .= $aDataRow["folder"]->getName();
  65 + $outStr .= '</a>';
  66 + } else {
  67 + $outStr = $aDataRow["folder"]->getName() . ' <span class="descriptiveText">(' . _('you cannot move folders to themselves') . ')';
  68 + }
  69 + return $outStr;
  70 +
  71 + }
  72 +
60 73 function buildFolderLink($aDataRow) {
61 74 return KTUtil::addQueryStringSelf(sprintf('fMoveCode=%s&fFolderId=%d&action=startMove', $this->sMoveCode, $aDataRow["folder"]->getId()));
62 75 }
... ... @@ -275,6 +288,13 @@ class BrowseDispatcher extends KTStandardDispatcher {
275 288 $this->errorRedirectToMain(_('No action selected.'));
276 289 exit(0);
277 290 }
  291 +
  292 + $aFolderSelection = KTUtil::arrayGet($_REQUEST, 'selection_f' , array());
  293 + $aDocumentSelection = KTUtil::arrayGet($_REQUEST, 'selection_d' , array());
  294 + if (empty($aFolderSelection) && empty($aDocumentSelection)) {
  295 + $this->errorRedirectToMain(_('Please select documents or folders first.'));
  296 + exit(0);
  297 + }
278 298  
279 299 if ($target == 'delete') {
280 300 return $this->do_startDelete();
... ... @@ -300,18 +320,16 @@ class BrowseDispatcher extends KTStandardDispatcher {
300 320 $aDocumentSelection = KTUtil::arrayGet($_REQUEST, 'selection_d' , array());
301 321  
302 322  
303   -
304 323 $sMoveCode = KTUtil::randomString();
305 324 $aMoveData = array('folders' => $aFolderSelection, 'documents' => $aDocumentSelection);
306 325  
307   - var_dump($aMoveData);
308   -
309 326 $moves = KTUtil::arrayGet($_SESSION, 'moves', array());
310 327 $moves = (array) $moves; // ?
311 328 $moves[$sMoveCode] = $aMoveData;
312 329 $_SESSION['moves'] = $moves; // ...
313 330 }
314   -
  331 +
  332 +
315 333 $oFolder = Folder::get(KTUtil::arrayGet($_REQUEST, 'fFolderId', 1));
316 334 if (PEAR::isError($oFolder)) {
317 335 $this->errorRedirectToMain(_('Invalid folder selected.'));
... ... @@ -355,6 +373,34 @@ class BrowseDispatcher extends KTStandardDispatcher {
355 373 $aBreadcrumbs[] = array("url" => $url, "name" => $folder_path_names[$index]);
356 374 }
357 375  
  376 +
  377 + // now show the items...
  378 + $moveSet = $_SESSION['moves'][$sMoveCode];
  379 + $moveItems = array();
  380 + $moveItems['folders'] = array();
  381 + $moveItems['documents'] = array();
  382 +
  383 + $folderStr = '';
  384 + $documentStr = '';
  385 +
  386 + if (!empty($moveSet['folders'])) {
  387 + $folderStr = '<strong>' . _('Folders: ') . '</strong>';
  388 + foreach ($moveSet['folders'] as $iFolderId) {
  389 + $oF = Folder::get($iFolderId);
  390 + $moveItems['folders'][] = $oF->getName();
  391 + }
  392 + $folderStr .= implode(', ', $moveItems['folders']);
  393 + }
  394 +
  395 + if (!empty($moveSet['documents'])) {
  396 + $documentStr = '<strong>' . _('Documents: ') . '</strong>';
  397 + foreach ($moveSet['documents'] as $iDocId) {
  398 + $oD = Document::get($iDocId);
  399 + $moveItems['documents'][] = $oD->getName();
  400 + }
  401 + $documentStr .= implode(', ', $moveItems['documents']);
  402 + }
  403 +
358 404 $oTemplating = new KTTemplating;
359 405 $oTemplate = $oTemplating->loadTemplate("ktcore/action/mass_move");
360 406 $aTemplateData = array(
... ... @@ -363,6 +409,8 @@ class BrowseDispatcher extends KTStandardDispatcher {
363 409 'move_code' => $sMoveCode,
364 410 'collection' => $collection,
365 411 'collection_breadcrumbs' => $aBreadcrumbs,
  412 + 'folders' => $folderStr,
  413 + 'documents' => $documentStr,
366 414 );
367 415  
368 416 return $oTemplate->render($aTemplateData);
... ... @@ -520,6 +568,33 @@ class BrowseDispatcher extends KTStandardDispatcher {
520 568 $aFolderSelection = KTUtil::arrayGet($_REQUEST, 'selection_f' , array());
521 569 $aDocumentSelection = KTUtil::arrayGet($_REQUEST, 'selection_d' , array());
522 570  
  571 +
  572 + // now show the items...
  573 + $delItems = array();
  574 + $delItems['folders'] = array();
  575 + $delItems['documents'] = array();
  576 +
  577 + $folderStr = '';
  578 + $documentStr = '';
  579 +
  580 + if (!empty($aFolderSelection)) {
  581 + $folderStr = '<strong>' . _('Folders: ') . '</strong>';
  582 + foreach ($aFolderSelection as $iFolderId) {
  583 + $oF = Folder::get($iFolderId);
  584 + $delItems['folders'][] = $oF->getName();
  585 + }
  586 + $folderStr .= implode(', ', $delItems['folders']);
  587 + }
  588 +
  589 + if (!empty($aDocumentSelection)) {
  590 + $documentStr = '<strong>' . _('Documents: ') . '</strong>';
  591 + foreach ($aDocumentSelection as $iDocId) {
  592 + $oD = Document::get($iDocId);
  593 + $delItems['documents'][] = $oD->getName();
  594 + }
  595 + $documentStr .= implode(', ', $delItems['documents']);
  596 + }
  597 +
523 598 $aFields = array();
524 599 $aFields[] = new KTStringWidget(_('Reason'), _('The reason for the deletion of these documents and folders for historical purposes.'), 'sReason', "", $this->oPage, true);
525 600  
... ... @@ -531,6 +606,8 @@ class BrowseDispatcher extends KTStandardDispatcher {
531 606 'form_fields' => $aFields,
532 607 'folders' => $aFolderSelection,
533 608 'documents' => $aDocumentSelection,
  609 + 'folder_string' => $folderStr,
  610 + 'document_string' => $documentStr,
534 611 );
535 612 return $oTemplate->render($aTemplateData);
536 613 }
... ...
config/config.ini
... ... @@ -75,7 +75,10 @@ companyLogoTitle = ACME Corporation
75 75 ; use the additional IE specific GIF theme overrides.
76 76 ; using this means that arbitrary theme packs may not work without
77 77 ; having GIF versions available.
78   -ieGIF = true
  78 +ieGIF = default
  79 +
  80 +; do not restrict to searches (e.g. always show_all) on users and groups pages.
  81 +alwaysShowAll = default
79 82  
80 83 ; ----------------------------------------------------------------
81 84 ; These sections are for more esoteric settings - you probably don't
... ...
config/dmsDefaults.php
... ... @@ -381,6 +381,9 @@ $oKTConfig-&gt;setdefaultns(&quot;tweaks&quot;, &quot;genericMetaDataRequired&quot;, true);
381 381 $oKTConfig->setdefaultns("tweaks", "phpErrorLogFile", false);
382 382 $oKTConfig->setdefaultns("tweaks", "developmentWindowLog", false);
383 383  
  384 +$oKTConfig->setdefaultns("ui", "ieGIF", true);
  385 +$oKTConfig->setdefaultns("ui", "alwaysShowAll", false);
  386 +
384 387 $oKTConfig->setdefaultns(null, "logLevel", 'INFO');
385 388 $oKTConfig->setdefaultns("import", "unzip", 'unzip');
386 389  
... ...
lib/templating/kt3template.inc.php
... ... @@ -238,7 +238,7 @@ class KTPage {
238 238  
239 239 /* final render call. */
240 240 function render() {
241   -
  241 + global $default;
242 242 if (empty($this->contents)) {
243 243 $this->contents = "";
244 244 }
... ... @@ -281,6 +281,7 @@ class KTPage {
281 281 $oTemplate = $oTemplating->loadTemplate($this->template);
282 282 $aTemplateData = array(
283 283 "page" => $this,
  284 + "systemversion" => $default->systemVersion,
284 285 );
285 286  
286 287 // unlike the rest of KT, we use echo here.
... ...
plugins/ktcore/admin/groupManagement.php
... ... @@ -21,9 +21,11 @@ class KTGroupAdminDispatcher extends KTAdminDispatcher {
21 21 $this->oPage->setBreadcrumbDetails(_('select a group'));
22 22 $this->oPage->setTitle(_("Group Management"));
23 23  
  24 + $KTConfig =& KTConfig::getSingleton();
  25 + $alwaysAll = $KTConfig->get("alwaysShowAll");
24 26  
25 27 $name = KTUtil::arrayGet($_REQUEST, 'name');
26   - $show_all = KTUtil::arrayGet($_REQUEST, 'show_all', false);
  28 + $show_all = KTUtil::arrayGet($_REQUEST, 'show_all', $alwaysAll);
27 29 $group_id = KTUtil::arrayGet($_REQUEST, 'group_id');
28 30  
29 31 $no_search = true;
... ...
plugins/ktcore/admin/userManagement.php
... ... @@ -20,9 +20,12 @@ class KTUserAdminDispatcher extends KTAdminDispatcher {
20 20 $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _('User Management'));
21 21 $this->oPage->setBreadcrumbDetails(_('select a user'));
22 22 $this->oPage->setTitle(_("User Management"));
23   -
  23 +
  24 + $KTConfig =& KTConfig::getSingleton();
  25 + $alwaysAll = $KTConfig->get("alwaysShowAll");
  26 +
24 27 $name = KTUtil::arrayGet($_REQUEST, 'name');
25   - $show_all = KTUtil::arrayGet($_REQUEST, 'show_all', false);
  28 + $show_all = KTUtil::arrayGet($_REQUEST, 'show_all', $alwaysAll);
26 29 $user_id = KTUtil::arrayGet($_REQUEST, 'user_id');
27 30  
28 31 $no_search = true;
... ...
templates/kt3/standard_page.smarty
... ... @@ -155,7 +155,8 @@
155 155 {$page->contents}
156 156  
157 157 <div id="copyrightbar">
158   -{i18n}&copy; 2006 <a href="http://www.ktdms.com/">The Jam Warehouse Software (Pty) Ltd.</a> All Rights Reserved.{/i18n}
  158 +{i18n}&copy; 2006 <a href="http://www.ktdms.com/">The Jam Warehouse Software (Pty) Ltd.</a> All Rights Reserved{/i18n}
  159 +&mdash; {i18n arg_version="$systemversion"}KnowledgeTree Version: #version#{/i18n}
159 160 </div>
160 161  
161 162 </div>
... ...
templates/ktcore/action/mass_move.smarty
... ... @@ -6,6 +6,13 @@
6 6 <input type="hidden" name="action" value="finaliseMove" />
7 7 <input type="hidden" name="fMoveCode" value="{$move_code}" />
8 8  
  9 +<div class="field">
  10 +<label>Items to move</label>
  11 +<p class="descriptiveText">{i18n}The items that you selected to move.{/i18n}</p>
  12 +{if ($folders)}{$folders}<br />{/if}
  13 +{if ($documents)}{$documents}{/if}
  14 +</div>
  15 +
9 16 <div class="field ">
10 17 <label for="fFolderId">{i18n}Target folder{/i18n}</label>
11 18 <p class="descriptiveText">{i18n}Use the folder collection and path below to
... ...
templates/ktcore/folder/mass_delete.smarty
... ... @@ -18,6 +18,17 @@ will be recorded in the documents&#39; &quot;Transaction History&quot;{/i18n}&lt;/p&gt;
18 18 <input type="hidden" name="selection_f[]" value="{$iFolderId}" />
19 19 {/foreach}
20 20  
  21 +
  22 +
  23 +<div class="field">
  24 +<label>Items to delete</label>
  25 +<p class="descriptiveText">{i18n}The items that you selected to delete.{/i18n}</p>
  26 +{if ($folder_string)}{$folder_string}<br />{/if}
  27 +{if ($document_string)}{$document_string}{/if}
  28 +</div>
  29 +
  30 +
  31 +
21 32 {foreach item=oWidget from=$form_fields}
22 33 {$oWidget->render()}
23 34 {/foreach}
... ...