Artifact 2cf671108ef6be4fd4b1d5c73a3e3f062f4f0d7a:
- File
library/ATWF/Applications/Resources/Frontcontroller.tcl
— part of check-in
[72081dd817]
at
2010-12-02 14:20:47
on branch trunk
— fixed type ditcs to dicts
git-svn-id: https://atwf.svn.sourceforge.net/svnroot/atwf@584 3ddb7fe1-eb8e-4980-8f37-d9e37380b5db (user: arnulf@wiedemann-pri.de size: 3833)
#************************************************************************* #* #* $Author$ #* $URL$ #* #* This module has been implemented in Tcl by using mostly the corresponding module #* Application/Resource/FrontController.php from the Zend framework see: http://framework.zend.com #* So the ideas are also copyrighted by Zend Technologies USA Inc. (http://www.zend.com) #* The implementation in Tcl uses dicts and lists instead of php arrays. #* #* The Contents of this file are made available subject to the terms of #* the following license see @license below #* #* Copyright 2010 Arnulf Wiedemann #* #* Author: Arnulf Wiedemann #* #* Contributor(s): #* # @category ATWF # @package library # @subpackage Applications::Resources # @license BSD License (see file license.terms in the source top drectory) # @version $Id$ #************************************************************************/ namespace eval ::ATWF { ::itcl::extendedclass Applications::Resources::Frontcontroller { inherit ::ATWF::Applications::Resources::Resourcebase # @variable ::ATWF::Controller::Front protected variable _front [list] constructor {options} { chain $options } { } public method init {} public method getFrontController {} } #============================ init =========================================== # Initialize Front Controller # # @return ::ATWF::Controller::Front ::itcl::body Applications::Resources::Frontcontroller::init {} { set front [getFrontController] foreach {key value} [getOptions] { switch [string tolower $key] { controllerdirectory { if {![::itcl::is object $value] && ([llength $value] == 1)} { $front setControllerDirectory $value } else { if {[llength $value] >= 2} { foreach {module directory} $value { $front addControllerDirectory $directory $module } } } } modulecontrollerdirectoryname { $front setModuleControllerDirectoryName $value } moduledirectory { foreach dir $value { $front addModuleDirectory $dir } } defaultcontrollername { $front setDefaultControllerName $value } defaultaction { $front setDefaultAction $value } defaultmodule { $front setDefaultModule $value } baseurl { $front setBaseUrl $value } params { $front setParams $value } plugins { foreach pluginClass $value { set plugin [uplevel #0 $pluginClass #auto] $front registerPlugin $plugin } } throwexceptions { $front throwExceptions $value } actionhelperpaths { if {[llength $value] >= 2} { foreach {helperPrefix helperPath} $value { ::ATWF::Controller::Action::HelperBroker::addPath $helperPath $helperPrefix } } } default { $front setParam $key $value } } } set bootstrap [getBootstrap] if {$bootstrap ne ""} { [getBootstrap] setDict FrontController $front } return $front } #============================ getFrontController ============================= # Retrieve front controller instance # # @return ::ATWF::Controller::Front ::itcl::body Applications::Resources::Frontcontroller::getFrontController {} { if {$_front eq ""} { classIsLoaded ::ATWF::Controllers::Front set _front [::ATWF::Controllers::Front::getInstance] } return $_front } } ; # END ::ATWF