|
From: <gem...@li...> - 2011-10-11 12:59:48
|
Revision: 88
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=88&view=rev
Author: matijsdejong
Date: 2011-10-11 12:59:41 +0000 (Tue, 11 Oct 2011)
Log Message:
-----------
Whoops, forget the current use of the LanguageController
Added Paths:
-----------
trunk/library/classes/Gems/Default/LanguageAction.php
trunk/library/controllers/LanguageController.php
Copied: trunk/library/classes/Gems/Default/LanguageAction.php (from rev 85, trunk/library/classes/Gems/Default/LanguageAction.php)
===================================================================
--- trunk/library/classes/Gems/Default/LanguageAction.php (rev 0)
+++ trunk/library/classes/Gems/Default/LanguageAction.php 2011-10-11 12:59:41 UTC (rev 88)
@@ -0,0 +1,68 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @package Gems
+ * @subpackage Default
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ * Allows the user to switch interface language.
+ *
+ * @package Gems
+ * @subpackage Default
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.0
+ */
+class Gems_Default_LanguageAction extends Gems_Controller_Action
+{
+ public function changeUiAction()
+ {
+ $request = $this->getRequest();
+
+ $lang = strtolower($request->getParam('language'));
+ $url = base64_decode($request->getParam('current_uri'));
+
+ if (in_array($lang, $this->view->project->locales)) {
+
+ $this->session->user_locale = $lang;
+ if (Gems_Cookies::setLocale($lang, $this->basepath->getBasePath())) {
+ $this->getResponse()->setRedirect($url);
+ return;
+ }
+
+ throw new Exception($this->_('Cookies must be enabled for setting the language.'));
+ }
+
+ throw new Exception($this->_('Invalid language setting.'));
+ }
+}
Copied: trunk/library/controllers/LanguageController.php (from rev 85, trunk/library/controllers/LanguageController.php)
===================================================================
--- trunk/library/controllers/LanguageController.php (rev 0)
+++ trunk/library/controllers/LanguageController.php 2011-10-11 12:59:41 UTC (rev 88)
@@ -0,0 +1,33 @@
+<?php
+
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+class LanguageController extends Gems_Default_LanguageAction
+{
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|