From d2b2cb31ff1afaa4e239e5ec2e87b8a5815d5ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Schneider?= Date: Thu, 5 Apr 2012 14:09:33 +0200 Subject: [PATCH] Working on Web Admin --- .../Frameworks/Baikal/Core/Bootstrap.php | 13 ++-- .../BaikalAdmin/Controler/Details.php | 9 ++- .../Frameworks/BaikalAdmin/Core/Bootstrap.php | 5 +- .../Resources/Templates/Page/index.html | 19 ++--- .../Frameworks/BaikalAdmin/index.php | 4 +- .../Frameworks/BaikalStandalone/run.sh | 3 +- .../Frameworks/Flake/Core/Bootstrap.php | 7 +- .../Frameworks/Flake/Util/Router.php | 11 ++- .../Flake/Util/Router/QuestionMarkRewrite.php | 20 ++++- .../Flake/Util/Router/ServerRewrite.php | 0 .../Frameworks/Flake/Util/Tools.php | 76 +++---------------- .../Baikal_0.1/Frameworks/Flake/config.php | 5 +- Specific/config.php | 8 +- 13 files changed, 82 insertions(+), 98 deletions(-) delete mode 100644 CoreVersions/Baikal_0.1/Frameworks/Flake/Util/Router/ServerRewrite.php diff --git a/CoreVersions/Baikal_0.1/Frameworks/Baikal/Core/Bootstrap.php b/CoreVersions/Baikal_0.1/Frameworks/Baikal/Core/Bootstrap.php index 9d2897b..d511278 100644 --- a/CoreVersions/Baikal_0.1/Frameworks/Baikal/Core/Bootstrap.php +++ b/CoreVersions/Baikal_0.1/Frameworks/Baikal/Core/Bootstrap.php @@ -59,11 +59,14 @@ require_once(BAIKAL_PATH_SPECIFIC . "config.php"); require_once(BAIKAL_PATH_SPECIFIC . "config.system.php"); # Determining baikal protocol, domain and uri-path (looking at BAIKAL_URI) -$aUrlInfo = parse_url(BAIKAL_URI); - -define("BAIKAL_DOMAIN", $aUrlInfo["host"]); -define("BAIKAL_URIPROTOCOL", $aUrlInfo["scheme"]); -define("BAIKAL_URIPATH", $aUrlInfo["path"]); +if($GLOBALS["_SERVER"]["SERVER_NAME"] === "mongoose") { # And not using MONGOOSE_SERVER constant, as it will be defined by Flake, later in the process + define("BAIKAL_DOMAIN", ""); + define("BAIKAL_URIPATH", ""); +} else { + $aUrlInfo = parse_url(BAIKAL_URI); + define("BAIKAL_DOMAIN", $aUrlInfo["host"]); + define("BAIKAL_URIPATH", $aUrlInfo["path"]); +} date_default_timezone_set(BAIKAL_TIMEZONE); diff --git a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controler/Details.php b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controler/Details.php index 1391934..ebfaf70 100644 --- a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controler/Details.php +++ b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controler/Details.php @@ -8,6 +8,13 @@ class Details extends \Flake\Core\Controler { } function render() { - return "

Details !

"; + $aParams = $GLOBALS["ROUTER"]::getURLParams(); + if(($iUser = intval($aParams[0])) === 0) { + throw new \Exception("BaikalAdmin\Controler\Details::render(): User get-parameter not found."); + } + + $oUser = new \Baikal\Model\User($iUser); + + return "

Details for user " . $oUser->getLabel() . "

"; } } \ No newline at end of file diff --git a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Core/Bootstrap.php b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Core/Bootstrap.php index 6913f93..492594a 100644 --- a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Core/Bootstrap.php +++ b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Core/Bootstrap.php @@ -2,7 +2,7 @@ define("BAIKALADMIN_PATH_ROOT", dirname(dirname(__FILE__)) . "/"); -# Bootstrap Baikal Core +# Bootstrap Baïkal Core require_once(dirname(dirname(dirname(__FILE__))) . "/Baikal/Core/Bootstrap.php"); # ../../, symlink-safe # Bootstrap Flake @@ -15,7 +15,8 @@ require_once(dirname(dirname(dirname(__FILE__))) . "/Formal/Core/Bootstrap.php") require_once(dirname(__FILE__) . '/ClassLoader.php'); \BaikalAdmin\Core\ClassLoader::register(); -define("BAIKALADMIN_URIPATH", \Flake\Util\Tools::trimSlashes(dirname($_SERVER["SCRIPT_NAME"])) . "/"); +# Relative to BAIKAL_URI; so that BAIKAL_URI . BAIKALADMIN_URIPATH corresponds to the full URL to Baïkal admin +define("BAIKALADMIN_URIPATH", "admin/"); # Include BaikalAdmin Framework config require_once(BAIKALADMIN_PATH_ROOT . "config.php"); \ No newline at end of file diff --git a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Resources/Templates/Page/index.html b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Resources/Templates/Page/index.html index 708c991..045f5e2 100644 --- a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Resources/Templates/Page/index.html +++ b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Resources/Templates/Page/index.html @@ -1,21 +1,22 @@ - + {pagetitle} - - - + + + + - - + + - + - - + + {javascript} \ No newline at end of file diff --git a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/index.php b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/index.php index 8fc2c97..41fe9a0 100644 --- a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/index.php +++ b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/index.php @@ -40,8 +40,8 @@ require_once(dirname(__FILE__) . "/Core/Bootstrap.php"); # Create and setup a page object $oPage = new \Flake\Controler\Page(BAIKALADMIN_PATH_TEMPLATES . "Page/index.html"); $oPage->injectHTTPHeaders(); -$oPage->setTitle(FLAKE_BASEURL); -$oPage->setBaseUrl(FLAKE_BASEURL); +$oPage->setTitle("Baïkal Web Admin"); +$oPage->setBaseUrl(BAIKAL_URI); # Route the request $GLOBALS["ROUTER"]::route($oPage); diff --git a/CoreVersions/Baikal_0.1/Frameworks/BaikalStandalone/run.sh b/CoreVersions/Baikal_0.1/Frameworks/BaikalStandalone/run.sh index 8a327f8..a5f0009 100755 --- a/CoreVersions/Baikal_0.1/Frameworks/BaikalStandalone/run.sh +++ b/CoreVersions/Baikal_0.1/Frameworks/BaikalStandalone/run.sh @@ -13,6 +13,7 @@ PATH_CONFIGFILE=$PATH_SPECIFIC"config.php" MONGOOSE_BUILDS=$PATH_SCRIPTDIR"builds/" MONGOOSE_CGI=$PATH_SCRIPTDIR"cgi/" +MONGOOSE_SERVERNAME="mongoose" function whichOS() { echo $(uname -s) @@ -70,4 +71,4 @@ echo "Serving Standalone Baïkal $BAIKAL_VERSION on port $BAIKAL_STANDALONE_PORT MONGOOSE_BIN="$MONGOOSE_BUILDS""$MONGOOSE_BINDIST""/mongoose" MONGOOSE_CGIBIN="$MONGOOSE_CGI""$MONGOOSE_BINDIST""/php-cgi" -`$MONGOOSE_BIN -d no -p $BAIKAL_STANDALONE_PORT -I $MONGOOSE_CGIBIN -i index.html,index.php -r $PATH_DOCROOT` \ No newline at end of file +`$MONGOOSE_BIN -d no -p $BAIKAL_STANDALONE_PORT -I $MONGOOSE_CGIBIN -i index.html,index.php -r $PATH_DOCROOT -R $MONGOOSE_SERVERNAME` diff --git a/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Bootstrap.php b/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Bootstrap.php index cba6858..248d1be 100755 --- a/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Bootstrap.php +++ b/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Bootstrap.php @@ -1,5 +1,11 @@