From bc3ec9397720fc95db60340d22415bbd6109b30a Mon Sep 17 00:00:00 2001 From: Michael Joseph Date: Mon, 20 Jan 2003 15:31:10 +0000 Subject: [PATCH] moved to presentation/ --- documentBrowser.php | 110 -------------------------------------------------------------------------------------------------------------- login.php | 99 --------------------------------------------------------------------------------------------------- logout.php | 25 ------------------------- presentation/browseBL.php | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ presentation/login.php | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ presentation/logout.php | 25 +++++++++++++++++++++++++ 6 files changed, 234 insertions(+), 234 deletions(-) delete mode 100644 documentBrowser.php delete mode 100644 login.php delete mode 100644 logout.php create mode 100644 presentation/browseBL.php create mode 100644 presentation/login.php create mode 100644 presentation/logout.php diff --git a/documentBrowser.php b/documentBrowser.php deleted file mode 100644 index 71c7264..0000000 --- a/documentBrowser.php +++ /dev/null @@ -1,110 +0,0 @@ -, Jam Warehouse (Pty) Ltd, South Africa - * @package presentation - */ - /* - * Querystring variables - * --------------------- - * fBrowseType - determines whether to browse by (folder, category, documentType) [mandatory] - * fFolderID - the folder to browse [optional depending on fBrowseType] - * fCategoryName - the category to browse [optional depending on fBrowseType] - * fDocumentTypeID - the document type id to browse [optional depending on fBrowseType] - */ - -// main library routines and defaults -require_once("./config/dmsDefaults.php"); -require_once("$default->owl_fs_root/lib/visualpatterns/PatternMainPage.inc"); -require_once("$default->owl_fs_root/lib/visualpatterns/PatternImage.inc"); -require_once("$default->owl_fs_root/lib/visualpatterns/PatternTableLinks.inc"); -require_once("$default->owl_fs_root/lib/visualpatterns/PatternTableSqlQuery.inc"); -require_once("$default->owl_fs_root/lib/visualpatterns/PatternCustom.inc"); - -// ------------------------------- -// page start -// ------------------------------- - -// only if we have a valid session -if (checkSession()) { - - // check if this page is authorised, ie. has come from control.php - if ($_SESSION["authorised"]) { - // retrieve variables - if (!$fBrowseType) { - // required param not set- internal error or user querystring hacking - // TODO: something intelligent - $_SESSION["errorMessage"] = "Required parameter missing, cannot proceed"; - } else { - // fire up the document browser - $oDocBrowser = new DocumentBrowser(); - - // TODO: instantiate the visual components - - // instantiate data arrays - $folders = NULL; - $categories = NULL; - $documentTypes = NULL; - - switch ($fBrowseType) { - case "folder" : // retrieve folderID if present - if (!$fFolderID) { - $folders = $oDocBrowser->browseByFolder(); - } else { - $folders = $oDocBrowser->browseByFolder($fFolderID); - } - break; - case "category" : - if (!$fCategoryName) { - $categories = $oDocBrowser->browseByCategory(); - } else { - $documents = $oDocBrowser->browseByCategory($fCategoryName); - } - break; - case "documentType" : - if (!$fDocumentTypeID) { - $documentTypes = $oDocBrowser->browseByDocumentType(); - } else { - $documents = $oDocBrowser->browseByDocumentType($fDocumentTypeID); - } - break; - } - } - - /* - - - loop through things, displaying appropriately - - documentmanagement/browseUI.inc - - displayDocumentLink - - displayFolderLink - - display - - displayFileActions($permissionArray) - - - docManagement - - getFileFolderPerms - - folder modification links (if perms) - - - link to files / folders - - displayLinkWithPath; displayLink - - expand table? - */ - - } else { - // FIXME: redirect to no permission page - print "you do not have access to view this page! please go away, and come back when you do.
"; - echo generateLink("logout") . "logout"; - // controllerRedirect("permissionDenied", "accessDeniedMsg=$lang_noPermission"); - } -} -?> diff --git a/login.php b/login.php deleted file mode 100644 index e097af5..0000000 --- a/login.php +++ /dev/null @@ -1,99 +0,0 @@ -, Jam Warehouse (Pty) Ltd, South Africa - * @package presentation - */ - -// ------------------------------- -// page start -// ------------------------------- -global $default; - -if ($loginAction == "loginForm") { - // TODO: build login form using PatternMainPage - //include("./lib/header.inc"); - print "
"; - print ""; - print "

"; - print "
"; - - if (isset($fileid)) { - print ""; - print ""; - } - - print "$errorMessage
"; - - print ""; - print "
$lang_username: -
$lang_password: -
"; - print ""; - print "\n"; - print "\n"; - print "


"; - //include("./lib/footer.inc"); - -} elseif ($loginAction == "login") { - // set default url for login failure - $url = $url . "login.php?loginAction=loginForm"; - // if requirements are met and we have a username and password to authenticate - if( isset($fUserName) && isset($fPassword) ) { - // verifies the login and password of the user - $dbAuth = new $default->authentication_class; - $userDetails = $dbAuth->login($fUserName, $fPassword); - - switch ($userDetails["status"]) { - // bad credentials - case 0: - $url = $url . "&errorMessage=$lang_loginfail"; - break; - // successfully authenticated - case 1: - // start the session - $session = new Session(); - $sessionID = $session->create($userDetails["userID"]); - - // check for a location to forward to - if (isset($redirect) && strlen(trim($redirect))>0) { - $url = urldecode($redirect); - // else redirect to the dashboard - } else { - $_SESSION["authorised"] = false; - $url = "control.php?action=dashboard"; - } - break; - // login disabled - case 2: - $url = $url . "&errorMessage=$lang_logindisabled"; - break; - // too many sessions - case 3 : - $url = $url . "&errorMessage=$lang_toomanysessions"; - break; - default : - $url = $url . "&errorMessage=$lang_err_general"; - } - } else { - // didn't receive any login parameters, so redirect login form - // TODO: set "no login parameters received error message? - // internal error message- should never happen - } - $default->log->debug("login.php: about to redirect to $url"); - redirect($url); -} -?> - - diff --git a/logout.php b/logout.php deleted file mode 100644 index a2ad985..0000000 --- a/logout.php +++ /dev/null @@ -1,25 +0,0 @@ -, Jam Warehouse (Pty) Ltd, South Africa - * @package presentation - */ - -// destroy the session -Session::destroy(); -// redirect to root -redirect("/"); -?> diff --git a/presentation/browseBL.php b/presentation/browseBL.php new file mode 100644 index 0000000..71c7264 --- /dev/null +++ b/presentation/browseBL.php @@ -0,0 +1,110 @@ +, Jam Warehouse (Pty) Ltd, South Africa + * @package presentation + */ + /* + * Querystring variables + * --------------------- + * fBrowseType - determines whether to browse by (folder, category, documentType) [mandatory] + * fFolderID - the folder to browse [optional depending on fBrowseType] + * fCategoryName - the category to browse [optional depending on fBrowseType] + * fDocumentTypeID - the document type id to browse [optional depending on fBrowseType] + */ + +// main library routines and defaults +require_once("./config/dmsDefaults.php"); +require_once("$default->owl_fs_root/lib/visualpatterns/PatternMainPage.inc"); +require_once("$default->owl_fs_root/lib/visualpatterns/PatternImage.inc"); +require_once("$default->owl_fs_root/lib/visualpatterns/PatternTableLinks.inc"); +require_once("$default->owl_fs_root/lib/visualpatterns/PatternTableSqlQuery.inc"); +require_once("$default->owl_fs_root/lib/visualpatterns/PatternCustom.inc"); + +// ------------------------------- +// page start +// ------------------------------- + +// only if we have a valid session +if (checkSession()) { + + // check if this page is authorised, ie. has come from control.php + if ($_SESSION["authorised"]) { + // retrieve variables + if (!$fBrowseType) { + // required param not set- internal error or user querystring hacking + // TODO: something intelligent + $_SESSION["errorMessage"] = "Required parameter missing, cannot proceed"; + } else { + // fire up the document browser + $oDocBrowser = new DocumentBrowser(); + + // TODO: instantiate the visual components + + // instantiate data arrays + $folders = NULL; + $categories = NULL; + $documentTypes = NULL; + + switch ($fBrowseType) { + case "folder" : // retrieve folderID if present + if (!$fFolderID) { + $folders = $oDocBrowser->browseByFolder(); + } else { + $folders = $oDocBrowser->browseByFolder($fFolderID); + } + break; + case "category" : + if (!$fCategoryName) { + $categories = $oDocBrowser->browseByCategory(); + } else { + $documents = $oDocBrowser->browseByCategory($fCategoryName); + } + break; + case "documentType" : + if (!$fDocumentTypeID) { + $documentTypes = $oDocBrowser->browseByDocumentType(); + } else { + $documents = $oDocBrowser->browseByDocumentType($fDocumentTypeID); + } + break; + } + } + + /* + + - loop through things, displaying appropriately + - documentmanagement/browseUI.inc + - displayDocumentLink + - displayFolderLink + - display + - displayFileActions($permissionArray) + + - docManagement + - getFileFolderPerms + - folder modification links (if perms) + + - link to files / folders + - displayLinkWithPath; displayLink + - expand table? + */ + + } else { + // FIXME: redirect to no permission page + print "you do not have access to view this page! please go away, and come back when you do.
"; + echo generateLink("logout") . "logout"; + // controllerRedirect("permissionDenied", "accessDeniedMsg=$lang_noPermission"); + } +} +?> diff --git a/presentation/login.php b/presentation/login.php new file mode 100644 index 0000000..e097af5 --- /dev/null +++ b/presentation/login.php @@ -0,0 +1,99 @@ +, Jam Warehouse (Pty) Ltd, South Africa + * @package presentation + */ + +// ------------------------------- +// page start +// ------------------------------- +global $default; + +if ($loginAction == "loginForm") { + // TODO: build login form using PatternMainPage + //include("./lib/header.inc"); + print "
"; + print ""; + print "

"; + print ""; + + if (isset($fileid)) { + print ""; + print ""; + } + + print "$errorMessage
"; + + print ""; + print "
$lang_username: +
$lang_password: +
"; + print ""; + print "\n"; + print "\n"; + print "


"; + //include("./lib/footer.inc"); + +} elseif ($loginAction == "login") { + // set default url for login failure + $url = $url . "login.php?loginAction=loginForm"; + // if requirements are met and we have a username and password to authenticate + if( isset($fUserName) && isset($fPassword) ) { + // verifies the login and password of the user + $dbAuth = new $default->authentication_class; + $userDetails = $dbAuth->login($fUserName, $fPassword); + + switch ($userDetails["status"]) { + // bad credentials + case 0: + $url = $url . "&errorMessage=$lang_loginfail"; + break; + // successfully authenticated + case 1: + // start the session + $session = new Session(); + $sessionID = $session->create($userDetails["userID"]); + + // check for a location to forward to + if (isset($redirect) && strlen(trim($redirect))>0) { + $url = urldecode($redirect); + // else redirect to the dashboard + } else { + $_SESSION["authorised"] = false; + $url = "control.php?action=dashboard"; + } + break; + // login disabled + case 2: + $url = $url . "&errorMessage=$lang_logindisabled"; + break; + // too many sessions + case 3 : + $url = $url . "&errorMessage=$lang_toomanysessions"; + break; + default : + $url = $url . "&errorMessage=$lang_err_general"; + } + } else { + // didn't receive any login parameters, so redirect login form + // TODO: set "no login parameters received error message? + // internal error message- should never happen + } + $default->log->debug("login.php: about to redirect to $url"); + redirect($url); +} +?> + + diff --git a/presentation/logout.php b/presentation/logout.php new file mode 100644 index 0000000..a2ad985 --- /dev/null +++ b/presentation/logout.php @@ -0,0 +1,25 @@ +, Jam Warehouse (Pty) Ltd, South Africa + * @package presentation + */ + +// destroy the session +Session::destroy(); +// redirect to root +redirect("/"); +?> -- libgit2 0.21.4