Commit d1e7290ac4c7560a3f687a6f846725fdd7c8be98

Authored by michael
1 parent 2615b02f

only display document types that arent mapped (fixes #2613)


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2288 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/foldermanagement/addFolderDocTypeUI.inc
1 1 <?php
2 2 /**
3   -* Presentation information used by addFolderDocTypeBL.php
4   -*
5   -* @author Rob Cherry, Jam Warehouse South Africa (Pty) Ltd
6   -* @date 37 February 2003
7   -* @package presentation.lookAndFeel.knowledgeTree.foldermanagement
8   -*/
  3 + * $Id$
  4 + *
  5 + * Presentation information used by addFolderDocTypeBL.php
  6 + *
  7 + * Licensed under the GNU GPL. For full terms see the file DOCS/COPYING.
  8 + *
  9 + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  10 + * @package presentation.lookAndFeel.knowledgeTree.foldermanagement
  11 + */
9 12  
10 13 function getPage($iFolderID, $iDocumentTypeID) {
11 14 global $default;
... ... @@ -14,14 +17,13 @@ function getPage($iFolderID, $iDocumentTypeID) {
14 17 $sToRender = renderHeading("Add Folder Document Type");
15 18 $sToRender .= "<table border=\"0\">\n";
16 19 $sToRender .= "<tr>\n";
17   - $sToRender .= "\t<td width=\"100%\">" . renderFolderPath($iFolderID, "$default->uiUrl/foldermanagement/addFolderBL.php") . "</td>\n";
  20 + $sToRender .= "\t<td width=\"100%\">" . renderFolderPath($iFolderID, "/control.php?action=browse ") . "</td>\n";
18 21 $sToRender .= "</tr>\n";
19 22 $sToRender .= "</table>\n";
20   - $sToRender .= "<br>";
21 23 $sToRender .= "<table border=\"0\">\n";
22 24 $sToRender .= "<tr>\n";
23 25 $sToRender .= "<td bgcolor=\"$sTDBGColour\">Document type</td>\n";
24   - $sToRender .= "<td>" . getDocumentTypeDropDown($iDocumentTypeID) . "</td>\n";
  26 + $sToRender .= "<td>" . getDocumentTypeDropDown($iDocumentTypeID, $iFolderID) . "</td>\n";
25 27 $sToRender .= "</tr>\n";
26 28 $sToRender .= "</table>\n";
27 29 $sToRender .= "<table>\n";
... ... @@ -33,9 +35,13 @@ function getPage($iFolderID, $iDocumentTypeID) {
33 35 return $sToRender;
34 36 }
35 37  
36   -function getDocumentTypeDropDown($iDocumentTypeID) {
  38 +function getDocumentTypeDropDown($iDocumentTypeID, $iFolderID) {
37 39 global $default;
38   - $oPatternListBox = & new PatternListBox("$default->owl_document_types_table", "name", "id", "fDocumentTypeID");
  40 + // cunningly joined query courtesy of R. Cherry Esq.
  41 + $oPatternListBox = & new PatternListBox("SELECT DTL.name AS display, DTL.id AS value " .
  42 + "FROM $default->owl_document_types_table AS DTL " .
  43 + "LEFT OUTER JOIN $default->owl_folder_doctypes_table AS FDL ON FDL.document_type_id = DTL.id AND FDL.folder_id = $iFolderID " .
  44 + "WHERE folder_id IS NULL", "fDocumentTypeID");
39 45 $oPatternListBox->setIncludeDefaultValue(false);
40 46 if (isset($iDocumentTypeID)) {
41 47 $oPatternListBox->setSelectedValue($iDocumentTypeID);
... ...