Commit 50974b463b269ef022c87db6812d290c4b28b7c4

Authored by bryndivey
1 parent 786c3a17

Moved document move to iframe collection


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5915 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/ktcore/KTDocumentActions.php
@@ -771,16 +771,6 @@ class KTDocumentDeleteAction extends KTDocumentAction { @@ -771,16 +771,6 @@ class KTDocumentDeleteAction extends KTDocumentAction {
771 // }}} 771 // }}}
772 772
773 773
774 -class KTDocumentMoveColumn extends TitleColumn {  
775 - function KTDocumentMoveColumn($sLabel, $sName, $oDocument) {  
776 - $this->oDocument = $oDocument;  
777 - parent::TitleColumn($sLabel, $sName);  
778 - }  
779 - function buildFolderLink($aDataRow) {  
780 - return KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf('fDocumentId=%d&fFolderId=%d', $this->oDocument->getId(), $aDataRow["folder"]->getId()));  
781 - }  
782 -}  
783 -  
784 // {{{ KTDocumentMoveAction 774 // {{{ KTDocumentMoveAction
785 class KTDocumentMoveAction extends KTDocumentAction { 775 class KTDocumentMoveAction extends KTDocumentAction {
786 var $sName = 'ktcore.actions.document.move'; 776 var $sName = 'ktcore.actions.document.move';
@@ -825,46 +815,35 @@ class KTDocumentMoveAction extends KTDocumentAction { @@ -825,46 +815,35 @@ class KTDocumentMoveAction extends KTDocumentAction {
825 $sDocumentName = join(" » ", $aNames); 815 $sDocumentName = join(" » ", $aNames);
826 $move_fields[] = new KTStaticTextWidget(_kt('Document to move'), '', 'fDocumentId', $sDocumentName, $this->oPage, false); 816 $move_fields[] = new KTStaticTextWidget(_kt('Document to move'), '', 'fDocumentId', $sDocumentName, $this->oPage, false);
827 817
828 - $collection = new DocumentCollection();  
829 - $collection->addColumn(new KTDocumentMoveColumn("Test 1 (title)","title", $this->oDocument)); 818 + $collection = new AdvancedCollection();
  819 + $oCR =& KTColumnRegistry::getSingleton();
  820 + $col = $oCR->getColumn('ktcore.columns.title');
  821 + $col->setOptions(array('qs_params'=>array('fMoveCode'=>$sMoveCode,
  822 + 'fFolderId'=>$oFolder->getId(),
  823 + 'action'=>'startMove')));
  824 + $collection->addColumn($col);
  825 +
830 $qObj = new FolderBrowseQuery($this->oFolder->getId()); 826 $qObj = new FolderBrowseQuery($this->oFolder->getId());
831 $collection->setQueryObject($qObj); 827 $collection->setQueryObject($qObj);
832 828
833 - $batchPage = (int) KTUtil::arrayGet($_REQUEST, "page", 0);  
834 - $batchSize = 20;  
835 -  
836 - $resultURL = KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf("fDocumentId=%d&fFolderId=%d", $this->oDocument->getId(), $this->oFolder->getId()));  
837 - $collection->setBatching($resultURL, $batchPage, $batchSize); 829 + $aOptions = $collection->getEnvironOptions();
  830 + $collection->setOptions($aOptions);
838 831
839 - // ordering. (direction and column)  
840 - $displayOrder = KTUtil::arrayGet($_REQUEST, 'sort_order', "asc");  
841 - if ($displayOrder !== "asc") { $displayOrder = "desc"; }  
842 - $displayControl = KTUtil::arrayGet($_REQUEST, 'sort_on', "title");  
843 -  
844 - $collection->setSorting($displayControl, $displayOrder);  
845 -  
846 - $collection->getResults();  
847 -  
848 - $aBreadcrumbs = array();  
849 - $folder_path_names = $this->oFolder->getPathArray();  
850 - $folder_path_ids = explode(',', $this->oFolder->getParentFolderIds());  
851 - $folder_path_ids[] = $this->oFolder->getId();  
852 - if ($folder_path_ids[0] == 0) {  
853 - array_shift($folder_path_ids);  
854 - array_shift($folder_path_names);  
855 - }  
856 -  
857 - foreach (range(0, count($folder_path_ids) - 1) as $index) {  
858 - $id = $folder_path_ids[$index];  
859 - $url = KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf("fDocumentId=%d&fFolderId=%d", $this->oDocument->getId(), $id));  
860 - $aBreadcrumbs[] = array("url" => $url, "name" => $folder_path_names[$index]);  
861 - } 832 + $oWF =& KTWidgetFactory::getSingleton();
  833 + $oWidget = $oWF->get('ktcore.widgets.collection',
  834 + array('label' => _kt('Target Folder'),
  835 + 'description' => _kt('Use the folder collection and path below to browse to the folder you wish to move the documents into.'),
  836 + 'required' => true,
  837 + 'name' => 'browse',
  838 + 'folder_id' => $oFolder->getId(),
  839 + 'collection' => $collection));
  840 + $move_fields[] = $oWidget;
862 841
863 $oTemplate->setData(array( 842 $oTemplate->setData(array(
864 'context' => &$this, 843 'context' => &$this,
865 'move_fields' => $move_fields, 844 'move_fields' => $move_fields,
866 - 'collection' => $collection,  
867 - 'collection_breadcrumbs' => $aBreadcrumbs, 845 + //'collection' => $collection,
  846 + //'collection_breadcrumbs' => $aBreadcrumbs,
868 )); 847 ));
869 return $oTemplate->render(); 848 return $oTemplate->render();
870 } 849 }
templates/ktcore/action/move.smarty
@@ -17,20 +17,6 @@ move</a>.{/i18n}</p> @@ -17,20 +17,6 @@ move</a>.{/i18n}</p>
17 {$oWidget->render()} 17 {$oWidget->render()}
18 {/foreach} 18 {/foreach}
19 19
20 -<div class="field ">  
21 -<label for="fFolderId">{i18n}Target folder{/i18n}</label>  
22 -<p class="descriptiveText">{i18n}Use the folder collection and path below to  
23 -browse to the folder into which you wish to move the documents.{/i18n}</p>  
24 -  
25 -<input type="hidden" name="fFolderId" value="{$context->oFolder->getId()}" />  
26 -{foreach from=$collection_breadcrumbs item=breadcrumb name=bc}  
27 -<a href="{$breadcrumb.url}">{$breadcrumb.name}</a>  
28 -{if !$smarty.foreach.bc.last}  
29 -&raquo;  
30 -{/if}  
31 -{/foreach}  
32 -{$collection->render()}  
33 -</div>  
34 20
35 <div class="form_actions"> 21 <div class="form_actions">
36 <input type="submit" name="submit[move]" value="{i18n}Move{/i18n}" /> 22 <input type="submit" name="submit[move]" value="{i18n}Move{/i18n}" />