Commit 831dbc68fc07efc14322f904666e84663d61cfb7
1 parent
cfa67824
Flatten the code to make it more understandable.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3070 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
56 additions
and
54 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/browseBL.php
| ... | ... | @@ -52,64 +52,66 @@ require_once("$default->fileSystemRoot/presentation/Html.inc"); |
| 52 | 52 | */ |
| 53 | 53 | |
| 54 | 54 | // only if we have a valid session |
| 55 | -if (checkSession()) { | |
| 56 | - if (isset($fActions)) { | |
| 57 | - // tack on POSTed document ids and redirect to the expunge deleted documents page | |
| 58 | - $sQueryString = ""; | |
| 59 | - if (isset($fDocumentIDs) ) { | |
| 60 | - foreach ($fDocumentIDs as $fDocumentID) { | |
| 61 | - $sQueryString .= "fDocumentIDs[]=$fDocumentID&"; | |
| 62 | - } | |
| 63 | - } | |
| 64 | - | |
| 65 | - switch ($fActions) { | |
| 66 | - case "delete": | |
| 67 | - // delete all selected docs | |
| 68 | - controllerRedirect("deleteDocument", $sQueryString); | |
| 69 | - break; | |
| 70 | - case "move": | |
| 71 | - // Move selected docs to root folder | |
| 72 | - controllerRedirect("moveDocument", $sQueryString . "fFolderID=1"); | |
| 73 | - break; | |
| 55 | +if (!checkSession()) { | |
| 56 | + exit(0); | |
| 57 | +} | |
| 58 | + | |
| 59 | +if (isset($fActions)) { | |
| 60 | + // tack on POSTed document ids and redirect to the expunge deleted documents page | |
| 61 | + $sQueryString = ""; | |
| 62 | + if (isset($fDocumentIDs) ) { | |
| 63 | + foreach ($fDocumentIDs as $fDocumentID) { | |
| 64 | + $sQueryString .= "fDocumentIDs[]=$fDocumentID&"; | |
| 74 | 65 | } |
| 75 | 66 | } |
| 76 | 67 | |
| 77 | - // retrieve variables | |
| 78 | - if (!$fBrowseType) { | |
| 79 | - // required param not set- internal error or user querystring hacking | |
| 80 | - // set it to default= folder | |
| 81 | - $fBrowseType = "folder"; | |
| 68 | + switch ($fActions) { | |
| 69 | + case "delete": | |
| 70 | + // delete all selected docs | |
| 71 | + controllerRedirect("deleteDocument", $sQueryString); | |
| 72 | + break; | |
| 73 | + case "move": | |
| 74 | + // Move selected docs to root folder | |
| 75 | + controllerRedirect("moveDocument", $sQueryString . "fFolderID=1"); | |
| 76 | + break; | |
| 82 | 77 | } |
| 83 | - | |
| 84 | - // retrieve field to sort by | |
| 85 | - if (!$fSortBy) { | |
| 86 | - // no sort field specified- default is document name | |
| 87 | - $fSortBy = "name"; | |
| 88 | - } | |
| 89 | - // retrieve sort direction | |
| 90 | - if (!$fSortDirection) { | |
| 91 | - $fSortDirection = "asc"; | |
| 92 | - } | |
| 93 | - | |
| 94 | - // fire up the document browser | |
| 95 | - $oBrowser = BrowserFactory::create($fBrowseType, $fSortBy, $fSortDirection); | |
| 96 | - $sectionName = $oBrowser->getSectionName(); | |
| 97 | - | |
| 98 | - // instantiate my content pattern | |
| 99 | - $oContent = new PatternCustom(); | |
| 100 | - $aResults = $oBrowser->browse(); | |
| 101 | - if (($fBrowseType == "folder") && (!isset($fFolderID))) { | |
| 102 | - // FIXME: check that the first folder in the array exists, no permission otherwise | |
| 103 | - controllerRedirect("browse", "fFolderID=" . $aResults["folders"][0]->getID()); | |
| 104 | - } | |
| 105 | - | |
| 106 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 107 | - // display the browse results | |
| 108 | - $oContent->addHtml(renderPage($aResults, $fBrowseType, $fSortBy, $fSortDirection)); | |
| 109 | - $main->setCentralPayload($oContent); | |
| 110 | - $main->setFormAction($_SERVER["PHP_SELF"]); | |
| 111 | - $main->setSubmitMethod("GET"); | |
| 112 | - $main->render(); | |
| 113 | 78 | } |
| 114 | 79 | |
| 80 | +// retrieve variables | |
| 81 | +if (!$fBrowseType) { | |
| 82 | + // required param not set- internal error or user querystring hacking | |
| 83 | + // set it to default= folder | |
| 84 | + $fBrowseType = "folder"; | |
| 85 | +} | |
| 86 | + | |
| 87 | +// retrieve field to sort by | |
| 88 | +if (!$fSortBy) { | |
| 89 | + // no sort field specified- default is document name | |
| 90 | + $fSortBy = "name"; | |
| 91 | +} | |
| 92 | +// retrieve sort direction | |
| 93 | +if (!$fSortDirection) { | |
| 94 | + $fSortDirection = "asc"; | |
| 95 | +} | |
| 96 | + | |
| 97 | +// fire up the document browser | |
| 98 | +$oBrowser = BrowserFactory::create($fBrowseType, $fSortBy, $fSortDirection); | |
| 99 | +$sectionName = $oBrowser->getSectionName(); | |
| 100 | + | |
| 101 | +// instantiate my content pattern | |
| 102 | +$oContent = new PatternCustom(); | |
| 103 | +$aResults = $oBrowser->browse(); | |
| 104 | +if (($fBrowseType == "folder") && (!isset($fFolderID))) { | |
| 105 | + // FIXME: check that the first folder in the array exists, no permission otherwise | |
| 106 | + controllerRedirect("browse", "fFolderID=" . $aResults["folders"][0]->getID()); | |
| 107 | +} | |
| 108 | + | |
| 109 | +require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 110 | +// display the browse results | |
| 111 | +$oContent->addHtml(renderPage($aResults, $fBrowseType, $fSortBy, $fSortDirection)); | |
| 112 | +$main->setCentralPayload($oContent); | |
| 113 | +$main->setFormAction($_SERVER["PHP_SELF"]); | |
| 114 | +$main->setSubmitMethod("GET"); | |
| 115 | +$main->render(); | |
| 116 | + | |
| 115 | 117 | ?> | ... | ... |