Commit 4102c4b9a91a25e376e9e5f6905767222ed2bf21
1 parent
5b7415df
reinstated browsing when adding a dependant document
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2427 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
45 additions
and
15 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/addDocumentBL.php
| ... | ... | @@ -166,7 +166,7 @@ if (checkSession()) { |
| 166 | 166 | //so don't display add button |
| 167 | 167 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 168 | 168 | $oPatternCustom = & new PatternCustom(); |
| 169 | - $oPatternCustom->setHtml(getStatusPage($fFolderID, "You do not have permission to add a document to this folder</td><td><a href=\"$default->rootUrl/control.php?action=browse&fFolderID=$fFolderID\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=\"0\"></a>")); | |
| 169 | + $oPatternCustom->setHtml(getPage($fFolderID, $fDocumentTypeID, $fDependantDocumentID, "You do not have permission to add a document to this folder</td><td><a href=\"$default->rootUrl/control.php?action=browse&fFolderID=$fFolderID\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=\"0\"></a>")); | |
| 170 | 170 | $main->setCentralPayload($oPatternCustom); |
| 171 | 171 | $main->render(); |
| 172 | 172 | } | ... | ... |
presentation/lookAndFeel/knowledgeTree/documentmanagement/addDocumentUI.inc
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | * |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -function getDocumentType($iFolderID, $iDocumentTypeID) { | |
| 11 | +function getDocumentType($iFolderID, $iDocumentTypeID, $iDependantDocumentID = null) { | |
| 12 | 12 | global $default; |
| 13 | 13 | |
| 14 | 14 | $sWhereClause = "FDL.folder_id = $iFolderID"; |
| ... | ... | @@ -16,7 +16,7 @@ function getDocumentType($iFolderID, $iDocumentTypeID) { |
| 16 | 16 | $oPatternListBox->setIncludeDefaultValue(true); |
| 17 | 17 | $oPatternListBox->setFromClause("INNER JOIN $default->owl_folder_doctypes_table AS FDL ON ST.id = FDL.document_type_id"); |
| 18 | 18 | $oPatternListBox->setPostBackOnChange(true); |
| 19 | - $oPatternListBox->setOnChangeAction("setActionAndSubmit('" . $_SERVER["PHP_SELF"] . "?fFolderID=$iFolderID')"); | |
| 19 | + $oPatternListBox->setOnChangeAction("setActionAndSubmit('" . $_SERVER["PHP_SELF"] . "?fFolderID=$iFolderID" . (isset($iDependantDocumentID) ? "&fDependantDocumentID=$iDependantDocumentID" : "") . "')"); | |
| 20 | 20 | |
| 21 | 21 | if ($iDocumentTypeID) { |
| 22 | 22 | $oPatternListBox->setSelectedValue($iDocumentTypeID); |
| ... | ... | @@ -123,11 +123,24 @@ function getMetaDataForm($iFolderID, $iDocumentTypeID) { |
| 123 | 123 | |
| 124 | 124 | return $sToRender; |
| 125 | 125 | } |
| 126 | -function getPage($iFolderID, $iDocumentTypeID, $iDependantDocumentID = null) { | |
| 126 | +function getPage($iFolderID, $iDocumentTypeID, $iDependantDocumentID = null, $sMessage = "") { | |
| 127 | 127 | global $default; |
| 128 | 128 | |
| 129 | - $sToRender .= renderHeading("Add Document"); | |
| 130 | - $sToRender .= renderFolderPath($iFolderID, "", false); | |
| 129 | + if (isset($iDependantDocumentID)) { | |
| 130 | + $sQueryString = "&fDependantDocumentID=$iDependantDocumentID"; | |
| 131 | + } | |
| 132 | + | |
| 133 | + $sToRender .= renderHeading("Add " . (isset($iDependantDocumentID) ? "Dependant " : "") . "Document"); | |
| 134 | + | |
| 135 | + $sToRender .= renderFolderPath($iFolderID, "/control.php?action=addDocument" . $sQueryString, (isset($iDependantDocumentID) ? true : false)); | |
| 136 | + | |
| 137 | + if ($sMessage) { | |
| 138 | + $sToRender .= "<table border=\"0\" width=\"100%\">\n"; | |
| 139 | + $sToRender .= "<tr>\n"; | |
| 140 | + $sToRender .= "\t<td><font color=\"red\">$sMessage</font></td>\n"; | |
| 141 | + $sToRender .= "</tr>\n"; | |
| 142 | + $sToRender .= "</table>\n"; | |
| 143 | + } | |
| 131 | 144 | |
| 132 | 145 | if ($iDocumentTypeID) { |
| 133 | 146 | $sToRender .= "<table><tr><td><b>Document Type<b></td></tr><tr><td>" . lookupName($default->owl_document_types_table, $iDocumentTypeID) . "</td></tr></table>"; |
| ... | ... | @@ -135,17 +148,34 @@ function getPage($iFolderID, $iDocumentTypeID, $iDependantDocumentID = null) { |
| 135 | 148 | $sToRender .= getMetaDataForm($iFolderID, $iDocumentTypeID); |
| 136 | 149 | $sActionButtons = "<input type=\"image\" src=\"$default->graphicsUrl/widgets/add.gif\" border=\"0\"/>"; |
| 137 | 150 | $sToRender .= "<input type=\"hidden\" name=\"fStore\" value=\"1\">"; |
| 138 | - $sActionButtons .= generateControllerLink("addDocument", "fFolderID=$iFolderID", "<img src=\"$default->graphicsUrl/widgets/back.gif\" border=\"0\"/>") . | |
| 139 | - generateControllerLink("browse", "fFolderID=$iFolderID", "<img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=\"0\"/>"); | |
| 151 | + $sActionButtons .= generateControllerLink("addDocument", "fFolderID=$iFolderID" . $sQueryString , "<img src=\"$default->graphicsUrl/widgets/back.gif\" border=\"0\"/>") . | |
| 152 | + generateControllerLink("browse", "fFolderID=$iFolderID", "<img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=\"0\"/>"); | |
| 153 | + | |
| 154 | + $sToRender .= "<table border=\"0\" width=\"100%\" >\n"; | |
| 155 | + $sToRender .= "<tr><td>$sActionButtons</td></tr>"; | |
| 156 | + $sToRender .= "</table>"; | |
| 157 | + | |
| 140 | 158 | } else { |
| 141 | - $sToRender .= getDocumentType($iFolderID, $iDocumentTypeID); | |
| 142 | - $sActionButtons .= generateControllerLink("browse", "fFolderID=$iFolderID", "<img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=\"0\"/>"); | |
| 143 | - } | |
| 159 | + // only allow document type choosing if the user has write permission | |
| 160 | + if (Permission::userHasFolderWritePermission($iFolderID)) { | |
| 161 | + $sToRender .= getDocumentType($iFolderID, $iDocumentTypeID, $iDependantDocumentID); | |
| 162 | + $sActionButtons .= generateControllerLink("browse", "fFolderID=$iFolderID", "<img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=\"0\"/>"); | |
| 163 | + } | |
| 164 | + | |
| 165 | + $sToRender .= "<table border=\"0\" width=\"100%\" >\n"; | |
| 166 | + $sToRender .= "<tr><td>$sActionButtons</td></tr>"; | |
| 167 | + $sToRender .= "</table>"; | |
| 168 | + | |
| 169 | + // display folders for browsing | |
| 170 | + $sToRender .= "<table border=\"0\" width=\"100%\">\n"; | |
| 171 | + $sToRender .= "<tr>\n"; | |
| 172 | + $sToRender .= "\t<td>" . renderFolderList($iFolderID, "/control.php?action=addDocument" . $sQueryString) . "<td>\n"; | |
| 173 | + $sToRender .= "</tr>\n"; | |
| 174 | + $sToRender .= "<tr>\n"; | |
| 175 | + $sToRender .= "</tr>"; | |
| 176 | + $sToRender .= "</table><br>\n"; | |
| 177 | + } | |
| 144 | 178 | |
| 145 | - $sToRender .= "<table border=\"0\" width=\"100%\" >\n"; | |
| 146 | - $sToRender .= "<tr><td>$sActionButtons</td></tr>"; | |
| 147 | - $sToRender .= "</table>"; | |
| 148 | - | |
| 149 | 179 | return $sToRender; |
| 150 | 180 | } |
| 151 | 181 | ... | ... |