Commit fc4251534d9be2d0bf86869fbbef1eefc2e4a7b5
1 parent
a1af6d64
Added iframecollection to unit folder creation page
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5913 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
28 additions
and
61 deletions
plugins/ktcore/admin/unitManagement.php
| ... | ... | @@ -94,58 +94,48 @@ class KTUnitAdminDispatcher extends KTAdminDispatcher { |
| 94 | 94 | $_REQUEST['fFolderId'] = $iFolderId; |
| 95 | 95 | $oFolder = $this->oValidator->validateFolder($_REQUEST['fFolderId']); |
| 96 | 96 | |
| 97 | - $collection = new DocumentCollection(); | |
| 98 | - $collection->addColumn(new KTUnitTitleColumn($sName)); | |
| 99 | - $qObj = new FolderBrowseQuery($oFolder->getId()); | |
| 100 | - $collection->setQueryObject($qObj); | |
| 101 | - $batchPage = (int) KTUtil::arrayGet($_REQUEST, "page", 0); | |
| 102 | - $batchSize = 20; | |
| 103 | - $collection->empty_message = _kt('No folders available in this location.'); | |
| 104 | - $resultURL = KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf("action=addUnit2&unit_name=%s&fFolderId=%d", $sName, $oFolder->getId())); | |
| 105 | - $collection->setBatching($resultURL, $batchPage, $batchSize); | |
| 106 | 97 | |
| 107 | - // ordering. (direction and column) | |
| 108 | - $displayOrder = KTUtil::arrayGet($_REQUEST, 'sort_order', "asc"); | |
| 109 | - if ($displayOrder !== "asc") { $displayOrder = "desc"; } | |
| 110 | - $displayControl = KTUtil::arrayGet($_REQUEST, 'sort_on', "title"); | |
| 111 | 98 | |
| 112 | - $collection->setSorting($displayControl, $displayOrder); | |
| 99 | + // Setup the collection for move display. | |
| 100 | + $collection = new AdvancedCollection(); | |
| 113 | 101 | |
| 114 | - $collection->getResults(); | |
| 102 | + $oCR =& KTColumnRegistry::getSingleton(); | |
| 103 | + $col = $oCR->getColumn('ktcore.columns.title'); | |
| 104 | + $col->setOptions(array('qs_params'=>array('fFolderId'=>$oFolder->getId()))); | |
| 105 | + $collection->addColumn($col); | |
| 115 | 106 | |
| 116 | - $aBreadcrumbs = array(); | |
| 117 | - $folder_path_names = $oFolder->getPathArray(); | |
| 118 | - $folder_path_ids = explode(',', $oFolder->getParentFolderIds()); | |
| 119 | - $folder_path_ids[] = $oFolder->getId(); | |
| 120 | - if ($folder_path_ids[0] == 0) { | |
| 121 | - array_shift($folder_path_ids); | |
| 122 | - array_shift($folder_path_names); | |
| 123 | - } | |
| 107 | + $qObj = new FolderBrowseQuery($oFolder->getId()); | |
| 108 | + $collection->setQueryObject($qObj); | |
| 124 | 109 | |
| 125 | - foreach (range(0, count($folder_path_ids) - 1) as $index) { | |
| 126 | - $id = $folder_path_ids[$index]; | |
| 127 | - $url = KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf("action=addUnit2&unit_name=%s&fFolderId=%d", $sName, $id)); | |
| 128 | - $aBreadcrumbs[] = array("url" => $url, "name" => $folder_path_names[$index]); | |
| 129 | - } | |
| 110 | + $collection->empty_message = _kt('No folders available in this location.'); | |
| 111 | + $aOptions = $collection->getEnvironOptions(); | |
| 112 | + $collection->setOptions($aOptions); | |
| 113 | + | |
| 114 | + $oWF =& KTWidgetFactory::getSingleton(); | |
| 115 | + $oWidget = $oWF->get('ktcore.widgets.collection', | |
| 116 | + array('label' => _kt('Target Folder'), | |
| 117 | + 'description' => _kt('<p>The folder given below is where the unit folder will be created. Use the folder collection and path below to browse to the folder you wish to create the unit folder into.</p><p>The unit administrators have additional rights within that portion of the document management system. | |
| 118 | +</p>'), | |
| 119 | + 'required' => true, | |
| 120 | + 'name' => 'browse', | |
| 121 | + 'folder_id' => $oFolder->getId(), | |
| 122 | + 'collection' => $collection)); | |
| 123 | + | |
| 124 | + | |
| 130 | 125 | |
| 131 | 126 | $add_fields = array(); |
| 132 | 127 | $add_fields[] = new KTStaticTextWidget(_kt('Unit Name'), _kt('A short name for the unit. e.g. <strong>Accounting</strong>.'), 'unit_name', $sName, $this->oPage, true); |
| 133 | 128 | |
| 134 | - $isValid = true; | |
| 135 | - if (KTFolderUtil::exists($oFolder, $sName)) { | |
| 136 | - $isValid = false; // can't add a unit folder with the same name. | |
| 137 | - } | |
| 129 | + $add_fields[] = $oWidget; | |
| 138 | 130 | |
| 139 | 131 | $oTemplating =& KTTemplating::getSingleton(); |
| 140 | 132 | $oTemplate = $oTemplating->loadTemplate("ktcore/principals/addunit2"); |
| 141 | 133 | $aTemplateData = array( |
| 142 | 134 | "context" => $this, |
| 143 | 135 | "add_fields" => $add_fields, |
| 144 | - "collection" => $collection, | |
| 145 | - "collection_breadcrumbs" => $aBreadcrumbs, | |
| 136 | + "unit_name" => $sName, | |
| 146 | 137 | "folder" => $oFolder, |
| 147 | 138 | "name" => $sName, |
| 148 | - "is_valid" => $isValid, | |
| 149 | 139 | ); |
| 150 | 140 | return $oTemplate->render($aTemplateData); |
| 151 | 141 | } |
| ... | ... | @@ -161,9 +151,9 @@ class KTUnitAdminDispatcher extends KTAdminDispatcher { |
| 161 | 151 | 'message' => _kt('No name given'), |
| 162 | 152 | ); |
| 163 | 153 | $sName = $this->oValidator->validateString($_REQUEST['unit_name'], $aOptions); |
| 164 | - $aOptions['message'] = _kt('A unit with that name already exists.'); | |
| 165 | - $sName = $this->oValidator->validateDuplicateName('Unit', $sName, $aOptions); | |
| 166 | - | |
| 154 | + $aOptions['message'] = _kt('A unit with that name already exists.'); | |
| 155 | + $sName = $this->oValidator->validateDuplicateName('Unit', $sName, $aOptions); | |
| 156 | + | |
| 167 | 157 | $oFolder = KTFolderUtil::add($oParentFolder, $sName, $this->oUser); |
| 168 | 158 | $aOptions = array( |
| 169 | 159 | 'redirect_to' => array('addUnit2', sprintf('fFolderId=%d&unit_name=%s', $oParentFolder->getId(), $sName)), | ... | ... |
templates/ktcore/principals/addunit2.smarty
| ... | ... | @@ -13,32 +13,9 @@ your unit folder.{/i18n}</p> |
| 13 | 13 | {$oWidget->render()} |
| 14 | 14 | {/foreach} |
| 15 | 15 | |
| 16 | -<div class="field "> | |
| 17 | -<label for="fFolderId">{i18n}Target folder{/i18n}</label> | |
| 18 | -<p class="descriptiveText">{i18n}The folder given below is where the | |
| 19 | -unit folder will be created. Use the folder collection and path below | |
| 20 | -to browse to the folder you wish to create the unit folder into.{/i18n}</p> | |
| 21 | - | |
| 22 | -<p class="descriptiveText">{i18n}The unit administrators have additional | |
| 23 | -rights within that portion of the document management system.{/i18n}</p> | |
| 24 | - | |
| 25 | -<input type="hidden" name="fFolderId" value="{$folder->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 | -» | |
| 30 | -{/if} | |
| 31 | -{/foreach} | |
| 32 | -{$collection->render()} | |
| 33 | -</div> | |
| 34 | 16 | |
| 35 | 17 | <div class="form_actions"> |
| 36 | - {if $is_valid} | |
| 37 | 18 | <input type="submit" value="{i18n}create unit{/i18n}" /> |
| 38 | - {else} | |
| 39 | - <p class="descriptiveText">{i18n}A folder with this name already exists in this location. Please select | |
| 40 | - another folder before creating the unit.{/i18n}</p> | |
| 41 | - {/if} | |
| 42 | 19 | <input type="submit" name="kt_cancel[]" value="{i18n}Cancel{/i18n}" /> |
| 43 | 20 | </div> |
| 44 | 21 | </fieldset> | ... | ... |