Commit 78e74b8738fc2059d6f4acf4935dcf0d3a284061
1 parent
d7f7c2ea
added headings; removed non-standard success page
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1584 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
3 changed files
with
62 additions
and
141 deletions
presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/addUnitBL.php
| @@ -10,66 +10,56 @@ | @@ -10,66 +10,56 @@ | ||
| 10 | require_once("../../../../../config/dmsDefaults.php"); | 10 | require_once("../../../../../config/dmsDefaults.php"); |
| 11 | 11 | ||
| 12 | if (checkSession()) { | 12 | if (checkSession()) { |
| 13 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | ||
| 14 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCreate.inc"); | ||
| 15 | - require_once("addUnitUI.inc"); | ||
| 16 | - require_once("$default->fileSystemRoot/lib/unitmanagement/Unit.inc"); | ||
| 17 | - require_once("$default->fileSystemRoot/lib/unitmanagement/UnitOrganisationLink.inc"); | ||
| 18 | - require_once("$default->fileSystemRoot/lib/security/permission.inc"); | ||
| 19 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | ||
| 20 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | ||
| 21 | - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | ||
| 22 | - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | ||
| 23 | - require_once("$default->fileSystemRoot/presentation/Html.inc"); | ||
| 24 | - | ||
| 25 | - $oPatternCustom = & new PatternCustom(); | ||
| 26 | - | ||
| 27 | - if (isset($fForStore)) { | ||
| 28 | - | ||
| 29 | - if($fUnitName != "" and $fOrgID !=-1) | ||
| 30 | - { | ||
| 31 | - $oUnit = new Unit($fUnitName); | ||
| 32 | - | ||
| 33 | - //$oOrg = Organisation($ | ||
| 34 | - // if creation is successfull..get the unit id | ||
| 35 | - if ($oUnit->create()) { | ||
| 36 | - $unitID = $oUnit->getID(); | ||
| 37 | - $oUnitOrg = new UnitOrganisationLink($unitID,$fOrgID); | ||
| 38 | - | ||
| 39 | - if($oUnitOrg->create()){ | ||
| 40 | - // if successfull print out success message | ||
| 41 | - $oPatternCustom->setHtml(getAddPageSuccess()); | ||
| 42 | - }else{ | ||
| 43 | - | ||
| 44 | - // if fail print out fail message | ||
| 45 | - $oPatternCustom->setHtml(getAddToOrgFail()); | ||
| 46 | - } | ||
| 47 | - | ||
| 48 | - | ||
| 49 | - } else { | ||
| 50 | - // if fail print out fail message | ||
| 51 | - $oPatternCustom->setHtml(getAddPageFail()); | ||
| 52 | - } | ||
| 53 | - }else{ | ||
| 54 | - | ||
| 55 | - $oPatternCustom->setHtml(getPageFail()); | ||
| 56 | - } | ||
| 57 | - | ||
| 58 | - } else if (isset($fUnitID)){ | ||
| 59 | - // post back on Unit select from manual edit page | ||
| 60 | - $oPatternCustom->setHtml(getAddPage($fUnitID)); | ||
| 61 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fForStore=1"); | ||
| 62 | - }else { | ||
| 63 | - // if nothing happens...just reload edit page | ||
| 64 | - $oPatternCustom->setHtml(getAddPage(null)); | ||
| 65 | - $main->setFormAction($_SERVER["PHP_SELF"]. "?fForStore=1"); | ||
| 66 | - | ||
| 67 | - } | 13 | + require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); |
| 14 | + require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCreate.inc"); | ||
| 15 | + require_once("addUnitUI.inc"); | ||
| 16 | + require_once("../adminUI.inc"); | ||
| 17 | + require_once("$default->fileSystemRoot/lib/unitmanagement/Unit.inc"); | ||
| 18 | + require_once("$default->fileSystemRoot/lib/unitmanagement/UnitOrganisationLink.inc"); | ||
| 19 | + require_once("$default->fileSystemRoot/lib/security/permission.inc"); | ||
| 20 | + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | ||
| 21 | + require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | ||
| 22 | + require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | ||
| 23 | + require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | ||
| 24 | + require_once("$default->fileSystemRoot/presentation/Html.inc"); | ||
| 68 | 25 | ||
| 69 | - //$oPatternCustom->setHtml(getPage()); | ||
| 70 | - | ||
| 71 | - //$main->setFormAction("$default->rootUrl/presentation/lookAndFeel/knowledgeTree/create.php?fRedirectURL=".urlencode("$default->rootUrl/control.php?action=addUnitSuccess&fUnit")); | ||
| 72 | - $main->setCentralPayload($oPatternCustom); | ||
| 73 | - $main->render(); | 26 | + $oPatternCustom = & new PatternCustom(); |
| 27 | + | ||
| 28 | + if (isset($fForStore)) { | ||
| 29 | + if($fUnitName != "" and $fOrgID != "") { | ||
| 30 | + $oUnit = new Unit($fUnitName); | ||
| 31 | + | ||
| 32 | + // if creation is successfull..get the unit id | ||
| 33 | + if ($oUnit->create()) { | ||
| 34 | + $unitID = $oUnit->getID(); | ||
| 35 | + $oUnitOrg = new UnitOrganisationLink($unitID,$fOrgID); | ||
| 36 | + | ||
| 37 | + if($oUnitOrg->create()) { | ||
| 38 | + // if successfull print out success message | ||
| 39 | + $oPatternCustom->setHtml(getAddPageSuccess()); | ||
| 40 | + } else { | ||
| 41 | + // if fail print out fail message | ||
| 42 | + $oPatternCustom->setHtml(getAddToOrgFail()); | ||
| 43 | + } | ||
| 44 | + } else { | ||
| 45 | + // if fail print out fail message | ||
| 46 | + $oPatternCustom->setHtml(getAddPageFail()); | ||
| 47 | + } | ||
| 48 | + } else { | ||
| 49 | + $oPatternCustom->setHtml(getPageFail()); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + } else if (isset($fUnitID)) { | ||
| 53 | + // post back on Unit select from manual edit page | ||
| 54 | + $oPatternCustom->setHtml(getAddPage($fUnitID)); | ||
| 55 | + $main->setFormAction($_SERVER["PHP_SELF"] . "?fForStore=1"); | ||
| 56 | + } else { | ||
| 57 | + // if nothing happens...just reload edit page | ||
| 58 | + $oPatternCustom->setHtml(getAddPage(null)); | ||
| 59 | + $main->setFormAction($_SERVER["PHP_SELF"]. "?fForStore=1"); | ||
| 60 | + | ||
| 61 | + } | ||
| 62 | + $main->setCentralPayload($oPatternCustom); | ||
| 63 | + $main->render(); | ||
| 74 | } | 64 | } |
| 75 | ?> | 65 | ?> |
presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/addUnitSuccess.php deleted
| 1 | -<?php | ||
| 2 | -/** | ||
| 3 | -* Presentation information when adding a unit is successful | ||
| 4 | -* | ||
| 5 | -* @author Mukhtar Dharsey | ||
| 6 | -* @date 5 February 2003 | ||
| 7 | -* @package presentation.lookAndFeel.knowledgeTree. | ||
| 8 | -* | ||
| 9 | -*/ | ||
| 10 | - | ||
| 11 | -require_once("../../../../../config/dmsDefaults.php"); | ||
| 12 | - | ||
| 13 | -global $default; | ||
| 14 | - | ||
| 15 | -if(checkSession()) | ||
| 16 | -{ | ||
| 17 | - | ||
| 18 | -// include the page template (with navbar) | ||
| 19 | -require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | ||
| 20 | - | ||
| 21 | -$Center = "<br></br>\n" ; | ||
| 22 | -$Center .= "<TABLE BORDER=\"0\" CELLSPACING=\"2\" CELLPADDING=\"2\">\n"; | ||
| 23 | -$Center .= "<tr>\n"; | ||
| 24 | -$Center .= "<td>Unit added Successfully!</td>\n"; | ||
| 25 | -$Center .= "</tr>\n"; | ||
| 26 | -$Center .= "<tr></tr>\n"; | ||
| 27 | -$Center .= "<tr></tr>\n"; | ||
| 28 | -$Center .= "<tr></tr>\n"; | ||
| 29 | -$Center .= "<tr></tr>\n"; | ||
| 30 | -$Center .= "<tr>\n"; | ||
| 31 | -$Center .= "<td align = right><a href=\"$default->rootUrl/control.php?action=addUnit\"><img src =\"$default->graphicsUrl/widgets/back.gif\" border = \"0\" /></a></td>\n"; | ||
| 32 | -$Center .= "</tr>\n"; | ||
| 33 | -$Center .= "</table>\n"; | ||
| 34 | - | ||
| 35 | - | ||
| 36 | -$oPatternCustom = & new PatternCustom(); | ||
| 37 | -$oPatternCustom->setHtml($Center); | ||
| 38 | -$main->setCentralPayload($oPatternCustom); | ||
| 39 | -$main->render(); | ||
| 40 | - | ||
| 41 | - | ||
| 42 | - | ||
| 43 | - | ||
| 44 | -} | ||
| 45 | - | ||
| 46 | -?> | ||
| 47 | \ No newline at end of file | 0 | \ No newline at end of file |
presentation/lookAndFeel/knowledgeTree/administration/unitmanagement/addUnitUI.inc
| @@ -9,29 +9,14 @@ | @@ -9,29 +9,14 @@ | ||
| 9 | */ | 9 | */ |
| 10 | // get add pages | 10 | // get add pages |
| 11 | function getAddPage($unitID) { | 11 | function getAddPage($unitID) { |
| 12 | - | ||
| 13 | global $default; | 12 | global $default; |
| 14 | 13 | ||
| 15 | - $oOrg = null; | ||
| 16 | if (isset($iOrgID)) { | 14 | if (isset($iOrgID)) { |
| 17 | - $oOrg = Organisation::get($iOrgID); | ||
| 18 | - | 15 | + $oOrg = Organisation::get($iOrgID); |
| 19 | } | 16 | } |
| 20 | 17 | ||
| 21 | - //$aDisplayRowNames = array("Unit Name:"); | ||
| 22 | - //$aParameterNumbers = array(0); | ||
| 23 | - //$aDisplayColumnTypes = array(1); | ||
| 24 | - //$aRequired = array(1); | ||
| 25 | - //$aDropDownListTableNames = array(10=>"document_types_lookup"); | ||
| 26 | - | ||
| 27 | - // create a text field that is required | ||
| 28 | - //$oPatternCreate = & new PatternCreate("Unit", "unitmanagement\\Unit.inc",$aDisplayRowNames, $aParameterNumbers, $aDisplayColumnTypes, $aRequired); | ||
| 29 | - //$oPatternCreate->setUniqueName("unit"); | ||
| 30 | - | ||
| 31 | - $sToRender .= "<br></br>\n"; | ||
| 32 | - $sToRender .= "<b>Add a New Unit to the System:</b>\n"; | 18 | + $sToRender .= "<table width=\"600\">" . renderHeading("Add Unit") . "</table>"; |
| 33 | $sToRender .= "<table>\n"; | 19 | $sToRender .= "<table>\n"; |
| 34 | - $sToRender .= "<br></br>\n"; | ||
| 35 | $sToRender .= "<tr></tr>\n"; | 20 | $sToRender .= "<tr></tr>\n"; |
| 36 | $sToRender .= "<tr>\n"; | 21 | $sToRender .= "<tr>\n"; |
| 37 | $sToRender .= "<td>Unit Name: </td><td><input size = \"40\" type=\"text\" name=\"fUnitName\"> </td>\n"; | 22 | $sToRender .= "<td>Unit Name: </td><td><input size = \"40\" type=\"text\" name=\"fUnitName\"> </td>\n"; |
| @@ -45,17 +30,15 @@ function getAddPage($unitID) { | @@ -45,17 +30,15 @@ function getAddPage($unitID) { | ||
| 45 | $sToRender .= "</table>\n"; | 30 | $sToRender .= "</table>\n"; |
| 46 | 31 | ||
| 47 | return $sToRender; | 32 | return $sToRender; |
| 48 | - | ||
| 49 | } | 33 | } |
| 50 | 34 | ||
| 51 | -// if edition is successful print otu success page | 35 | +// if edition is successful print out success page |
| 52 | function getAddPageSuccess() { | 36 | function getAddPageSuccess() { |
| 53 | global $default; | 37 | global $default; |
| 54 | 38 | ||
| 55 | - $sToRender .= "<br></br>\n"; | ||
| 56 | - $sToRender .= "<b>Addition Successful!</b>\n"; | 39 | + $sToRender .= "<table width=\"600\">" . renderHeading("Add Unit") . "</table>"; |
| 57 | $sToRender .= "<table>\n"; | 40 | $sToRender .= "<table>\n"; |
| 58 | - $sToRender .= "<br></br>\n"; | 41 | + $sToRender .= "<tr><td><b>Addition Successful!</b></td></tr>\n"; |
| 59 | $sToRender .= "<tr></tr>\n"; | 42 | $sToRender .= "<tr></tr>\n"; |
| 60 | $sToRender .= "<tr><td>New Unit was successfully added</td></tr>\n"; | 43 | $sToRender .= "<tr><td>New Unit was successfully added</td></tr>\n"; |
| 61 | $sToRender .= "<tr></tr>\n"; | 44 | $sToRender .= "<tr></tr>\n"; |
| @@ -68,14 +51,13 @@ function getAddPageSuccess() { | @@ -68,14 +51,13 @@ function getAddPageSuccess() { | ||
| 68 | return $sToRender; | 51 | return $sToRender; |
| 69 | } | 52 | } |
| 70 | 53 | ||
| 71 | -// if edition is successful print otu success page | 54 | +// if edition is successful print out failure page |
| 72 | function getAddPageFail() { | 55 | function getAddPageFail() { |
| 73 | global $default; | 56 | global $default; |
| 74 | 57 | ||
| 75 | - $sToRender .= "<br></br>\n"; | ||
| 76 | - $sToRender .= "<b>Addition Unsuccessful</b>\n"; | 58 | + $sToRender .= "<table width=\"600\">" . renderHeading("Add Unit") . "</table>"; |
| 77 | $sToRender .= "<table>\n"; | 59 | $sToRender .= "<table>\n"; |
| 78 | - $sToRender .= "<br></br>\n"; | 60 | + $sToRender .= "<tr><td><b>Addition Unsuccessful</b></td></tr>\n"; |
| 79 | $sToRender .= "<tr></tr>\n"; | 61 | $sToRender .= "<tr></tr>\n"; |
| 80 | $sToRender .= "<tr><td>The Unit was not added. Unit Name Already exists!</td></tr>\n"; | 62 | $sToRender .= "<tr><td>The Unit was not added. Unit Name Already exists!</td></tr>\n"; |
| 81 | $sToRender .= "<tr></tr>\n"; | 63 | $sToRender .= "<tr></tr>\n"; |
| @@ -94,10 +76,8 @@ function getAddPageFail() { | @@ -94,10 +76,8 @@ function getAddPageFail() { | ||
| 94 | function getPageFail() { | 76 | function getPageFail() { |
| 95 | global $default; | 77 | global $default; |
| 96 | 78 | ||
| 97 | - $sToRender .= "<br></br>\n"; | ||
| 98 | - $sToRender .= "<b>Addition Unsuccessful</b>\n"; | 79 | + $sToRender .= "<table width=\"600\">" . renderHeading("Add Unit") . "</table>"; |
| 99 | $sToRender .= "<table>\n"; | 80 | $sToRender .= "<table>\n"; |
| 100 | - $sToRender .= "<br></br>\n"; | ||
| 101 | $sToRender .= "<tr></tr>\n"; | 81 | $sToRender .= "<tr></tr>\n"; |
| 102 | $sToRender .= "<tr><td>Please enter a name AND Select the Organisation</td></tr>\n"; | 82 | $sToRender .= "<tr><td>Please enter a name AND Select the Organisation</td></tr>\n"; |
| 103 | $sToRender .= "<tr></tr>\n"; | 83 | $sToRender .= "<tr></tr>\n"; |
| @@ -114,10 +94,9 @@ function getPageFail() { | @@ -114,10 +94,9 @@ function getPageFail() { | ||
| 114 | function getAddPageToOrgFail() { | 94 | function getAddPageToOrgFail() { |
| 115 | global $default; | 95 | global $default; |
| 116 | 96 | ||
| 117 | - $sToRender .= "<br></br>\n"; | ||
| 118 | - $sToRender .= "<b>Addition to Organisation Unsuccessful</b>\n"; | ||
| 119 | - $sToRender .= "<table>\n"; | ||
| 120 | - $sToRender .= "<br></br>\n"; | 97 | + $sToRender .= "<table width=\"600\">" . renderHeading("Add Unit") . "</table>"; |
| 98 | + $sToRender .= "<table>\n"; | ||
| 99 | + $sToRender .= "<tr><td><b>Addition to Organisation Unsuccessful</b></td></tr>\n"; | ||
| 121 | $sToRender .= "<tr></tr>\n"; | 100 | $sToRender .= "<tr></tr>\n"; |
| 122 | $sToRender .= "<tr><td>The Unit was not added to the Organisation.</td></tr>\n"; | 101 | $sToRender .= "<tr><td>The Unit was not added to the Organisation.</td></tr>\n"; |
| 123 | $sToRender .= "<tr></tr>\n"; | 102 | $sToRender .= "<tr></tr>\n"; |
| @@ -138,8 +117,6 @@ function getOrgDisplay($oOrg) { | @@ -138,8 +117,6 @@ function getOrgDisplay($oOrg) { | ||
| 138 | global $default; | 117 | global $default; |
| 139 | if (!isset($oOrg)) { | 118 | if (!isset($oOrg)) { |
| 140 | $oPatternListBox = & new PatternListBox($default->owl_organisations_table, "name", "id", "fOrgID"); | 119 | $oPatternListBox = & new PatternListBox($default->owl_organisations_table, "name", "id", "fOrgID"); |
| 141 | - //$oPatternListBox->setIncludeDefaultValue(true); | ||
| 142 | - //$oPatternListBox->setPostBackOnChange(true); | ||
| 143 | return $oPatternListBox->render(); | 120 | return $oPatternListBox->render(); |
| 144 | } else { | 121 | } else { |
| 145 | return "<input type=\"hidden\" name=\"fOrgID\" value=\"" . $oOrg->iId . "\">\n" . | 122 | return "<input type=\"hidden\" name=\"fOrgID\" value=\"" . $oOrg->iId . "\">\n" . |