Commit 3d1766764dc6bcb4511f82ebb60f0fe20b79d461

Authored by bryndivey
1 parent 186fe03b

Added IFrame browse to archived documents, document links


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5911 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/browse/columnregistry.inc.php
@@ -57,13 +57,13 @@ class KTColumnRegistry { @@ -57,13 +57,13 @@ class KTColumnRegistry {
57 } 57 }
58 58
59 function getColumn($sNamespace) { 59 function getColumn($sNamespace) {
60 - $aInfo = KTUtil::arrayGet($this->columns, $sNamespace, null); 60 + $aInfo = $this->getColumnInfo($sNamespace);
61 if (empty($aInfo)) { 61 if (empty($aInfo)) {
62 return PEAR::raiseError(sprintf(_kt("No such column: %s"), $sNamespace)); 62 return PEAR::raiseError(sprintf(_kt("No such column: %s"), $sNamespace));
63 } 63 }
64 64
65 require_once($aInfo['file']); 65 require_once($aInfo['file']);
66 - 66 +
67 return new $aInfo['class']; 67 return new $aInfo['class'];
68 } 68 }
69 69
plugins/ktcore/KTColumns.inc.php
@@ -10,8 +10,12 @@ class AdvancedTitleColumn extends AdvancedColumn { @@ -10,8 +10,12 @@ class AdvancedTitleColumn extends AdvancedColumn {
10 var $sortable = true; 10 var $sortable = true;
11 var $aOptions = array(); 11 var $aOptions = array();
12 var $aIconPaths = array(); 12 var $aIconPaths = array();
  13 + var $link_folders = true;
  14 + var $link_documents = true;
13 15
14 - function setOptions($aOptions) { 16 + function setOptions($aOptions) {
  17 + $this->link_folders = KTUtil::arrayGet($aOptions, 'link_folders', $this->link_folders, false);
  18 + $this->link_documents = KTUtil::arrayGet($aOptions, 'link_documents', $this->link_documents, false);
15 parent::setOptions($aOptions); 19 parent::setOptions($aOptions);
16 } 20 }
17 21
@@ -40,16 +44,19 @@ class AdvancedTitleColumn extends AdvancedColumn { @@ -40,16 +44,19 @@ class AdvancedTitleColumn extends AdvancedColumn {
40 44
41 45
42 function renderFolderLink($aDataRow) { 46 function renderFolderLink($aDataRow) {
43 - $outStr = '<a href="' . $this->buildFolderLink($aDataRow) . '">';  
44 - $outStr .= htmlentities($aDataRow["folder"]->getName(), ENT_NOQUOTES, 'UTF-8');  
45 - $outStr .= '</a> '; 47 + $outStr = htmlentities($aDataRow["folder"]->getName(), ENT_NOQUOTES, 'UTF-8');
  48 + if($this->link_folders) {
  49 + $outStr = '<a href="' . $this->buildFolderLink($aDataRow) . '">' . $outStr . '</a>';
  50 + }
46 return $outStr; 51 return $outStr;
47 } 52 }
48 53
49 function renderDocumentLink($aDataRow) { 54 function renderDocumentLink($aDataRow) {
50 - $outStr = '<a href="' . $this->buildDocumentLink($aDataRow) . '" title="' . $aDataRow["document"]->getFilename().'">';  
51 - $outStr .= htmlentities($aDataRow["document"]->getName(), ENT_NOQUOTES, 'UTF-8');  
52 - $outStr .= '</a>'; 55 + $outStr = htmlentities($aDataRow["document"]->getName(), ENT_NOQUOTES, 'UTF-8');
  56 + if($this->link_documents) {
  57 + $outStr = '<a href="' . $this->buildDocumentLink($aDataRow) . '" title="' . $aDataRow["document"]->getFilename().'">' .
  58 + $outStr . '</a>';
  59 + }
53 return $outStr; 60 return $outStr;
54 } 61 }
55 62
plugins/ktcore/KTWidgets.php
@@ -455,6 +455,8 @@ class KTCoreCollectionWidget extends KTWidget { @@ -455,6 +455,8 @@ class KTCoreCollectionWidget extends KTWidget {
455 $this->iFolderId = KTUtil::arrayGet($aOptions, 'folder_id'); 455 $this->iFolderId = KTUtil::arrayGet($aOptions, 'folder_id');
456 if(empty($this->iFolderId)) return PEAR::raiseError(_kt('No initial folder specified specified.')); 456 if(empty($this->iFolderId)) return PEAR::raiseError(_kt('No initial folder specified specified.'));
457 457
  458 + $this->aBCUrlParams = KTUtil::arrayGet($aOptions, 'bcurl_params', array());
  459 +
458 $this->aCols = array(); 460 $this->aCols = array();
459 foreach($this->oCollection->columns as $oCol) { 461 foreach($this->oCollection->columns as $oCol) {
460 $this->aCols[] = $oCol->namespace; 462 $this->aCols[] = $oCol->namespace;
@@ -483,8 +485,8 @@ class KTCoreCollectionWidget extends KTWidget { @@ -483,8 +485,8 @@ class KTCoreCollectionWidget extends KTWidget {
483 $oCR =& KTColumnRegistry::getSingleton(); 485 $oCR =& KTColumnRegistry::getSingleton();
484 //print '<pre>'; 486 //print '<pre>';
485 foreach($this->aCols as $ns) { 487 foreach($this->aCols as $ns) {
486 - // print $ns . "\n";  
487 - // var_dump($oCR->getColumn($ns)); 488 + // print $ns . "\n";
  489 + // var_dump($oCR->getColumn($ns));
488 $oCR->getColumn($ns); 490 $oCR->getColumn($ns);
489 } 491 }
490 //var_dump($this->oCollection->columns); 492 //var_dump($this->oCollection->columns);
@@ -496,7 +498,7 @@ class KTCoreCollectionWidget extends KTWidget { @@ -496,7 +498,7 @@ class KTCoreCollectionWidget extends KTWidget {
496 498
497 class KTCoreCollectionPage extends KTStandardDispatcher { 499 class KTCoreCollectionPage extends KTStandardDispatcher {
498 500
499 - function _generate_breadcrumbs(&$oFolder, $sCode) { 501 + function _generate_breadcrumbs(&$oFolder, $sCode, $aURLParams) {
500 $aBreadcrumbs = array(); 502 $aBreadcrumbs = array();
501 $folder_path_names = $oFolder->getPathArray(); 503 $folder_path_names = $oFolder->getPathArray();
502 $folder_path_ids = explode(',', $oFolder->getParentFolderIds()); 504 $folder_path_ids = explode(',', $oFolder->getParentFolderIds());
@@ -506,11 +508,13 @@ class KTCoreCollectionPage extends KTStandardDispatcher { @@ -506,11 +508,13 @@ class KTCoreCollectionPage extends KTStandardDispatcher {
506 array_shift($folder_path_names); 508 array_shift($folder_path_names);
507 } 509 }
508 510
  511 +
  512 +
509 foreach (range(0, count($folder_path_ids) - 1) as $index) { 513 foreach (range(0, count($folder_path_ids) - 1) as $index) {
510 $id = $folder_path_ids[$index]; 514 $id = $folder_path_ids[$index];
511 - $url = KTUtil::addQueryString($_SERVER['PHP_SELF'],  
512 - array('fFolderId' => $id,  
513 - 'code' => $sCode)); 515 +
  516 + $aParams = kt_array_merge($aURLParams, array('fFolderId'=>$id, 'code'=>$sCode));
  517 + $url = KTUtil::addQueryString($_SERVER['PHP_SELF'], $aParams);
514 $aBreadcrumbs[] = array("url" => $url, "name" => $folder_path_names[$index]); 518 $aBreadcrumbs[] = array("url" => $url, "name" => $folder_path_names[$index]);
515 } 519 }
516 520
@@ -540,16 +544,17 @@ class KTCoreCollectionPage extends KTStandardDispatcher { @@ -540,16 +544,17 @@ class KTCoreCollectionPage extends KTStandardDispatcher {
540 $oCollection->setOptions($aOptions); 544 $oCollection->setOptions($aOptions);
541 545
542 // add the collection code to the title column QS params 546 // add the collection code to the title column QS params
543 - $aColOpts = $oCollection->getColumnOptions('ktcore.columns.title');  
544 -  
545 - $aColOpts['qs_params'] = kt_array_merge(KTUtil::arrayGet($aColOpts, 'qs_params', array()),  
546 - array('code' => $sCode));  
547 547
548 - $oCollection->setColumnOptions('ktcore.columns.title', $aColOpts); 548 + foreach($oWidget->aCols as $ns) {
  549 + $aColOpts = $oCollection->getColumnOptions($ns);
  550 + $aColOpts['qs_params'] = kt_array_merge(KTUtil::arrayGet($aColOpts, 'qs_params', array()),
  551 + array('code' => $sCode));
  552 + $oCollection->setColumnOptions($ns, $aColOpts);
  553 + }
549 554
550 555
551 // make the breadcrumbs 556 // make the breadcrumbs
552 - $aBreadcrumbs = $this->_generate_breadcrumbs($oFolder, $sCode); 557 + $aBreadcrumbs = $this->_generate_breadcrumbs($oFolder, $sCode, $oWidget->aBCUrlParams);
553 558
554 print KTTemplating::renderTemplate('ktcore/forms/widgets/collection', 559 print KTTemplating::renderTemplate('ktcore/forms/widgets/collection',
555 array('collection'=>$oCollection, 560 array('collection'=>$oCollection,
plugins/ktcore/admin/archivedDocuments.php
@@ -68,52 +68,50 @@ class ArchivedDocumentsDispatcher extends KTAdminDispatcher { @@ -68,52 +68,50 @@ class ArchivedDocumentsDispatcher extends KTAdminDispatcher {
68 68
69 // Setup the collection for move display. 69 // Setup the collection for move display.
70 70
71 - $collection = new DocumentCollection(); 71 + $aBaseParams = array();
  72 +
  73 + $collection = new AdvancedCollection();
  74 +
  75 + $oCR =& KTColumnRegistry::getSingleton();
  76 +
  77 + // selection col
  78 + $col = $oCR->getColumn('ktcore.columns.selection');
  79 + $col->setOptions(array('show_folders' => false, 'rangename' => '_d[]'));
  80 + $collection->addColumn($col);
72 81
73 - $collection->addColumn(new SelectionColumn("Select","selected_docs[]", false, true));  
74 - $collection->addColumn(new KTArchiveTitle("Archive Documents","title")); 82 + // title col
  83 + $col = $oCR->getColumn('ktcore.columns.title');
  84 + $col->setOptions(array('link_documents' => false));
75 85
  86 + $collection->addColumn($col);
  87 +
76 $qObj = new ArchivedBrowseQuery($oFolder->getId()); 88 $qObj = new ArchivedBrowseQuery($oFolder->getId());
77 $collection->setQueryObject($qObj); 89 $collection->setQueryObject($qObj);
78 90
79 - $batchPage = (int) KTUtil::arrayGet($_REQUEST, "page", 0);  
80 - $batchSize = 20;  
81 -  
82 - $resultURL = KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf("fFolderId=%d&action=browse", $sMoveCode, $oFolder->getId()));  
83 - $collection->setBatching($resultURL, $batchPage, $batchSize); 91 + $aOptions = $collection->getEnvironOptions();
  92 + $aOptions['result_url'] = KTUtil::addQueryString($_SERVER['PHP_SELF'],
  93 + array(kt_array_merge($aBaseParams, array('fFolderId' => $oFolder->getId()))));
84 94
85 - // ordering. (direction and column)  
86 - $displayOrder = KTUtil::arrayGet($_REQUEST, 'sort_order', "asc");  
87 - if ($displayOrder !== "asc") { $displayOrder = "desc"; }  
88 - $displayControl = KTUtil::arrayGet($_REQUEST, 'sort_on', "title"); 95 + $collection->setOptions($aOptions);
89 96
90 - $collection->setSorting($displayControl, $displayOrder); 97 + $oWF =& KTWidgetFactory::getSingleton();
  98 + $oWidget = $oWF->get('ktcore.widgets.collection',
  99 + array('label' => _kt('Browse'),
  100 + 'description' => _kt('Select something'),
  101 + 'required' => true,
  102 + 'name' => 'browse',
  103 + 'folder_id' => $oFolder->getId(),
  104 + 'bcurl_params' => $aBaseParams,
  105 + 'collection' => $collection));
91 106
92 - $collection->getResults();  
93 -  
94 - $aBreadcrumbs = array();  
95 - $folder_path_names = $oFolder->getPathArray();  
96 - $folder_path_ids = explode(',', $oFolder->getParentFolderIds());  
97 - $folder_path_ids[] = $oFolder->getId();  
98 - if ($folder_path_ids[0] == 0) {  
99 - array_shift($folder_path_ids);  
100 - array_shift($folder_path_names);  
101 - }  
102 107
103 - foreach (range(0, count($folder_path_ids) - 1) as $index) {  
104 - $id = $folder_path_ids[$index];  
105 - $url = KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf("fFolderId=%d", $sMoveCode, $id));  
106 - $aBreadcrumbs[] = array("url" => $url, "name" => $folder_path_names[$index]);  
107 - }  
108 -  
109 $oTemplating =& KTTemplating::getSingleton(); 108 $oTemplating =& KTTemplating::getSingleton();
110 $oTemplate = $oTemplating->loadTemplate("ktcore/document/admin/archivebrowse"); 109 $oTemplate = $oTemplating->loadTemplate("ktcore/document/admin/archivebrowse");
111 $aTemplateData = array( 110 $aTemplateData = array(
112 "context" => $this, 111 "context" => $this,
113 'folder' => $oFolder, 112 'folder' => $oFolder,
114 'breadcrumbs' => $aBreadcrumbs, 113 'breadcrumbs' => $aBreadcrumbs,
115 - 'collection' => $collection,  
116 - 'collection_breadcrumbs' => $aBreadcrumbs, 114 + 'collection' => $oWidget,
117 ); 115 );
118 116
119 return $oTemplate->render($aTemplateData); 117 return $oTemplate->render($aTemplateData);
@@ -129,7 +127,7 @@ class ArchivedDocumentsDispatcher extends KTAdminDispatcher { @@ -129,7 +127,7 @@ class ArchivedDocumentsDispatcher extends KTAdminDispatcher {
129 function do_confirm_restore() { 127 function do_confirm_restore() {
130 $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Archived Documents')); 128 $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Archived Documents'));
131 129
132 - $selected_docs = KTUtil::arrayGet($_REQUEST, 'selected_docs', array()); 130 + $selected_docs = KTUtil::arrayGet($_REQUEST, '_d', array());
133 131
134 $this->oPage->setTitle(sprintf(_kt('Confirm Restore of %d documents'), count($selected_docs))); 132 $this->oPage->setTitle(sprintf(_kt('Confirm Restore of %d documents'), count($selected_docs)));
135 133
plugins/ktstandard/KTDocumentLinks.php
@@ -33,33 +33,8 @@ require_once(KT_LIB_DIR . &quot;/browse/BrowseColumns.inc.php&quot;); @@ -33,33 +33,8 @@ require_once(KT_LIB_DIR . &quot;/browse/BrowseColumns.inc.php&quot;);
33 require_once(KT_LIB_DIR . "/browse/PartialQuery.inc.php"); 33 require_once(KT_LIB_DIR . "/browse/PartialQuery.inc.php");
34 require_once(KT_LIB_DIR . "/browse/browseutil.inc.php"); 34 require_once(KT_LIB_DIR . "/browse/browseutil.inc.php");
35 35
  36 +require_once(KT_LIB_DIR . "/browse/columnregistry.inc.php");
36 37
37 -class KTDocumentLinkTitle extends TitleColumn {  
38 -  
39 - function renderDocumentLink($aDataRow) {  
40 - $parentDocumentId = KTUtil::arrayGet($_REQUEST, 'fDocumentId');  
41 -  
42 - if ($aDataRow["document"]->getId() != $parentDocumentId) {  
43 - $outStr = '<a href="' . $this->buildDocumentLink($aDataRow) . '" title="' . $aDataRow["document"]->getFilename().'">';  
44 - $outStr .= $aDataRow["document"]->getName();  
45 - $outStr .= '</a>';  
46 - } else {  
47 - $outStr = $aDataRow["document"]->getName() . ' <span class="descriptiveText">(' . _kt('you cannot link to the source document') . ')';  
48 - }  
49 - return $outStr;  
50 - }  
51 -  
52 - function buildDocumentLink($aDataRow) {  
53 - $parentDocumentId = KTUtil::arrayGet($_REQUEST, 'fDocumentId');  
54 - return KTUtil::addQueryStringSelf(sprintf('action=type_select&fDocumentId=%d&fTargetDocumentId=%d', $parentDocumentId, $aDataRow["document"]->getId()));  
55 - }  
56 -  
57 - function buildFolderLink($aDataRow) {  
58 - $parentDocumentId = KTUtil::arrayGet($_REQUEST, 'fDocumentId');  
59 -  
60 - return KTUtil::addQueryStringSelf(sprintf('action=new&fDocumentId=%d&fFolderId=%d', $parentDocumentId, $aDataRow["folder"]->getId()));  
61 - }  
62 -}  
63 38
64 class KTDocumentLinks extends KTPlugin { 39 class KTDocumentLinks extends KTPlugin {
65 var $sNamespace = "ktstandard.documentlinks.plugin"; 40 var $sNamespace = "ktstandard.documentlinks.plugin";
@@ -72,6 +47,8 @@ class KTDocumentLinks extends KTPlugin { @@ -72,6 +47,8 @@ class KTDocumentLinks extends KTPlugin {
72 47
73 function setup() { 48 function setup() {
74 $this->registerAction('documentaction', 'KTDocumentLinkAction', 'ktcore.actions.document.link'); 49 $this->registerAction('documentaction', 'KTDocumentLinkAction', 'ktcore.actions.document.link');
  50 + $this->registerColumn(_kt('Link Title'), 'ktdocumentlinks.columns.title', 'KTDocumentLinkTitle',
  51 + dirname(__FILE__) . '/KTDocumentLinksColumns.php');
75 } 52 }
76 } 53 }
77 54
@@ -139,49 +116,47 @@ class KTDocumentLinkAction extends KTDocumentAction { @@ -139,49 +116,47 @@ class KTDocumentLinkAction extends KTDocumentAction {
139 116
140 // Setup the collection for move display. 117 // Setup the collection for move display.
141 118
142 - $collection = new DocumentCollection();  
143 - $collection->addColumn(new KTDocumentLinkTitle("Target Documents","title")); 119 + $collection = new AdvancedCollection();
  120 + $aBaseParams = array('fDocumentId'=>$oParentDocument->getId());
  121 +
  122 +
  123 + $oCR =& KTColumnRegistry::getSingleton();
  124 +
  125 + $col = $oCR->getColumn('ktcore.columns.singleselection');
  126 + $col->setOptions(array('qs_params'=>kt_array_merge($aBaseParams, array('fFolderId'=>$oFolder->getId()))));
  127 + $collection->addColumn($col);
  128 +
  129 + $col = $oCR->getColumn('ktdocumentlinks.columns.title');
  130 + $col->setOptions(array('qs_params'=>kt_array_merge($aBaseParams, array('fFolderId'=>$oFolder->getId()))));
  131 + $collection->addColumn($col);
144 132
145 $qObj = new BrowseQuery($iFolderId); 133 $qObj = new BrowseQuery($iFolderId);
146 $collection->setQueryObject($qObj); 134 $collection->setQueryObject($qObj);
147 135
148 - $batchPage = (int) KTUtil::arrayGet($_REQUEST, "page", 0);  
149 - $batchSize = 20; 136 + $aOptions = $collection->getEnvironOptions();
  137 + $aOptions['result_url'] = KTUtil::addQueryString($_SERVER['PHP_SELF'],
  138 + array(kt_array_merge($aBaseParams, array('fFolderId' => $oFolder->getId()))));
150 139
151 - $resultURL = KTUtil::addQueryStringSelf(sprintf("action=new&fDocumentId=%d&fFolderId=%d", $oParentDocument->getId(), $oFolder->getId()));  
152 - $collection->setBatching($resultURL, $batchPage, $batchSize); 140 + $collection->setOptions($aOptions);
153 141
154 - // ordering. (direction and column)  
155 - $displayOrder = KTUtil::arrayGet($_REQUEST, 'sort_order', "asc");  
156 - if ($displayOrder !== "asc") { $displayOrder = "desc"; }  
157 - $displayControl = KTUtil::arrayGet($_REQUEST, 'sort_on', "title"); 142 + $oWF =& KTWidgetFactory::getSingleton();
  143 + $oWidget = $oWF->get('ktcore.widgets.collection',
  144 + array('label' => _kt('Browse'),
  145 + 'description' => _kt('Select something'),
  146 + 'required' => true,
  147 + 'name' => 'browse',
  148 + 'folder_id' => $oFolder->getId(),
  149 + 'bcurl_params' => $aBaseParams,
  150 + 'collection' => $collection));
158 151
159 - $collection->setSorting($displayControl, $displayOrder);  
160 152
161 - $collection->getResults();  
162 -  
163 - $aBreadcrumbs = array();  
164 - $folder_path_names = $oFolder->getPathArray();  
165 - $folder_path_ids = explode(',', $oFolder->getParentFolderIds());  
166 -  
167 - if ($folder_path_ids[0] == 0) {  
168 - array_shift($folder_path_ids);  
169 - array_shift($folder_path_names);  
170 - }  
171 - $folder_path_ids[] = $oFolder->getId();  
172 -  
173 - foreach (range(0, count($folder_path_ids) - 1) as $index) {  
174 - $id = $folder_path_ids[$index];  
175 - $url = KTUtil::addQueryStringSelf(sprintf("action=new&fDocumentId=%d&fFolderId=%d", $oParentDocument->getId(), $id));  
176 - $aBreadcrumbs[] = array("url" => $url, "name" => $folder_path_names[$index]);  
177 - }  
178 153
179 $aTemplateData = array( 154 $aTemplateData = array(
180 'context' => $this, 155 'context' => $this,
181 'folder' => $oFolder, 156 'folder' => $oFolder,
  157 + 'parent' => $oParentDocument,
182 'breadcrumbs' => $aBreadcrumbs, 158 'breadcrumbs' => $aBreadcrumbs,
183 - 'collection' => $collection,  
184 - 'collection_breadcrumbs' => $aBreadcrumbs, 159 + 'collection' => $oWidget,
185 'link_types' => LinkType::getList("id > 0"), 160 'link_types' => LinkType::getList("id > 0"),
186 ); 161 );
187 162
@@ -199,7 +174,14 @@ class KTDocumentLinkAction extends KTDocumentAction { @@ -199,7 +174,14 @@ class KTDocumentLinkAction extends KTDocumentAction {
199 exit(0); 174 exit(0);
200 } 175 }
201 176
202 - $oTargetDocument = Document::get(KTUtil::arrayGet($_REQUEST, 'fTargetDocumentId')); 177 + /*
  178 + print '<pre>';
  179 + var_dump($_REQUEST);
  180 + exit(0);
  181 + */
  182 +
  183 +
  184 + $oTargetDocument = Document::get(KTUtil::arrayGet($_REQUEST, '_d'));
203 if (PEAR::isError($oTargetDocument)) { 185 if (PEAR::isError($oTargetDocument)) {
204 $this->errorRedirectToMain(_kt('Invalid target document selected.')); 186 $this->errorRedirectToMain(_kt('Invalid target document selected.'));
205 exit(0); 187 exit(0);
plugins/ktstandard/KTDocumentLinksColumns.php 0 โ†’ 100644
  1 +<?php
  2 +
  3 +/**
  4 + * $Id: KTDocumentLinks.php 5758 2006-07-27 10:17:43Z bshuttle $
  5 + *
  6 + * The contents of this file are subject to the KnowledgeTree Public
  7 + * License Version 1.1 ("License"); You may not use this file except in
  8 + * compliance with the License. You may obtain a copy of the License at
  9 + * http://www.ktdms.com/KPL
  10 + *
  11 + * Software distributed under the License is distributed on an "AS IS"
  12 + * basis,
  13 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  14 + * for the specific language governing rights and limitations under the
  15 + * License.
  16 + *
  17 + * The Original Code is: KnowledgeTree Open Source
  18 + *
  19 + * The Initial Developer of the Original Code is The Jam Warehouse Software
  20 + * (Pty) Ltd, trading as KnowledgeTree.
  21 + * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
  22 + * (C) 2006 The Jam Warehouse Software (Pty) Ltd;
  23 + * All Rights Reserved.
  24 + *
  25 + */
  26 +
  27 +require_once(KT_LIB_DIR . '/widgets/fieldWidgets.php');
  28 +require_once(KT_LIB_DIR . '/documentmanagement/DocumentLink.inc');
  29 +require_once(KT_LIB_DIR . '/documentmanagement/LinkType.inc');
  30 +
  31 +require_once(KT_LIB_DIR . "/browse/DocumentCollection.inc.php");
  32 +require_once(KT_LIB_DIR . "/browse/BrowseColumns.inc.php");
  33 +require_once(KT_LIB_DIR . "/browse/PartialQuery.inc.php");
  34 +require_once(KT_LIB_DIR . "/browse/browseutil.inc.php");
  35 +
  36 +require_once(KT_LIB_DIR . "/browse/columnregistry.inc.php");
  37 +
  38 +
  39 +$oCR =& KTColumnRegistry::getSingleton();
  40 +$oCR->getColumn('ktcore.columns.title');
  41 +
  42 +class KTDocumentLinkTitle extends AdvancedTitleColumn {
  43 + var $namespace = 'ktdocumentlinks.columns.title';
  44 +
  45 + function renderDocumentLink($aDataRow) {
  46 + $aOptions = $this->getOptions();
  47 + $fParentDocId = KTUtil::arrayGet(KTUtil::arrayGet($aOptions, 'qs_params', array()),
  48 + 'fDocumentId', False);
  49 +
  50 + if ((int)$aDataRow["document"]->getId() === (int)$fParentDocId) {
  51 + return $aDataRow["document"]->getName() .
  52 + ' <span class="descriptiveText">(' . _kt('you cannot link to the source document') . ')';
  53 + } else {
  54 + return parent::renderDocumentLink($aDataRow);
  55 + }
  56 + }
  57 +}
  58 +
  59 +?>
0 \ No newline at end of file 60 \ No newline at end of file
resources/js/collectionframe.js
@@ -24,9 +24,13 @@ function setupFrame(frame) { @@ -24,9 +24,13 @@ function setupFrame(frame) {
24 var moveInputs = function(e) { 24 var moveInputs = function(e) {
25 for(var e in {'input':1, 'select':1, 'textarea':1}) { 25 for(var e in {'input':1, 'select':1, 'textarea':1}) {
26 var elms = frame.contentDocument.getElementsByTagName(e); 26 var elms = frame.contentDocument.getElementsByTagName(e);
  27 + forEach(elms, function(e) {
  28 + e.style.display = 'none';
  29 + });
27 appendChildNodes(form, elms); 30 appendChildNodes(form, elms);
28 } 31 }
29 } 32 }
  33 +
30 resizeFrame(frame); 34 resizeFrame(frame);
31 connect(frame, 'onload', function(e) { resizeFrame(e.src()); }); 35 connect(frame, 'onload', function(e) { resizeFrame(e.src()); });
32 connect(form, 'onsubmit', moveInputs); 36 connect(form, 'onsubmit', moveInputs);
templates/ktcore/forms/widgets/collection.smarty
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 <script type="text/javascript" src="{$rootUrl}/thirdpartyjs/MochiKit/Async.js"> </script> 13 <script type="text/javascript" src="{$rootUrl}/thirdpartyjs/MochiKit/Async.js"> </script>
14 <script type="text/javascript" src="{$rootUrl}/thirdpartyjs/MochiKit/Signal.js"> </script> 14 <script type="text/javascript" src="{$rootUrl}/thirdpartyjs/MochiKit/Signal.js"> </script>
15 <script type="text/javascript" src="{$rootUrl}/resources/js/kt-utility.js"> </script> 15 <script type="text/javascript" src="{$rootUrl}/resources/js/kt-utility.js"> </script>
  16 +<script type="text/javascript" src="{$rootUrl}/resources/js/toggleselect.js"> </script>
16 <script type="text/javascript" src="{$rootUrl}/presentation/i18nJavascript.php"> </script> 17 <script type="text/javascript" src="{$rootUrl}/presentation/i18nJavascript.php"> </script>
17 </head> 18 </head>
18 19
templates/ktstandard/action/link.smarty
@@ -4,33 +4,19 @@ @@ -4,33 +4,19 @@
4 {if $link_types} 4 {if $link_types}
5 <p class="descriptiveText">{i18n}Select a target document to link to.{/i18n} 5 <p class="descriptiveText">{i18n}Select a target document to link to.{/i18n}
6 </p> 6 </p>
7 -<!-- 7 +
8 <form method="POST" action="{$smarty.server.PHP_SELF}"> 8 <form method="POST" action="{$smarty.server.PHP_SELF}">
9 --->  
10 <p class="descriptiveText">{i18n}Use the folder collection and path below to 9 <p class="descriptiveText">{i18n}Use the folder collection and path below to
11 browse to the document you wish to link to.{/i18n}</p> 10 browse to the document you wish to link to.{/i18n}</p>
12 -<!--  
13 -<input type="hidden" name="fFolderId" value="{$folder->getId()}" />  
14 --->  
15 -{foreach from=$collection_breadcrumbs item=breadcrumb name=bc}  
16 -  
17 -<a href="{$breadcrumb.url}">{$breadcrumb.name}</a>  
18 -  
19 -{if !$smarty.foreach.bc.last}  
20 -&raquo;  
21 -{/if}  
22 -  
23 -{/foreach}  
24 -  
25 11
26 {$collection->render()} 12 {$collection->render()}
27 -<!--  
28 <div class="form_actions"> 13 <div class="form_actions">
  14 +<input type="hidden" name="action" value="type_select" />
  15 +<input type="hidden" name="fDocumentId" value="{$parent->getId()}" />
29 <input type="submit" name="submit[move]" value="{i18n}Link{/i18n}" /> 16 <input type="submit" name="submit[move]" value="{i18n}Link{/i18n}" />
30 </div> 17 </div>
31 </fieldset> 18 </fieldset>
32 </form> 19 </form>
33 --->  
34 {else} 20 {else}
35 <div class="ktInfo"><p> 21 <div class="ktInfo"><p>
36 {i18n}No link types are defined. Please ask the administrator to add them.{/i18n}</p></div> 22 {i18n}No link types are defined. Please ask the administrator to add them.{/i18n}</p></div>