Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1901)
+++ branches/2.8.x/CHANGELOG	(revision 1902)
@@ -11,6 +11,9 @@
 ! = Update/Change
 ===============================================================================
 
+12 May-2013 Build 1902 Werner v.d.Decken(DarkViper)
++ added posssibility to use different adaptors for each module
++ added new adaptor to access language definitions in a MySQL database
 19 Apr-2013 Build 1901 Werner v.d.Decken(DarkViper)
 # little corrections in class Password
 18 Apr-2013 Build 1900 Werner v.d.Decken(DarkViper)
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 1901)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 1902)
@@ -51,5 +51,5 @@
 
 // check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
 if(!defined('VERSION')) define('VERSION', '2.8.3');
-if(!defined('REVISION')) define('REVISION', '1901');
+if(!defined('REVISION')) define('REVISION', '1902');
 if(!defined('SP')) define('SP', '');
Index: branches/2.8.x/wb/framework/TranslationTable.php
===================================================================
--- branches/2.8.x/wb/framework/TranslationTable.php	(revision 1901)
+++ branches/2.8.x/wb/framework/TranslationTable.php	(revision 1902)
@@ -90,6 +90,9 @@
 				$this->aTranslations = $this->loadCacheFile($sCacheFile);
 		}else {
 			$bLanguageFound = false;
+			if(!class_exists($sAdaptor)) {
+				throw new TranslationException('unable to load adaptor: '.$sAdaptor);
+			}
 			$oAdaptor= new $sAdaptor($this->sAddon);
 			if(!$oAdaptor instanceof TranslateAdaptorInterface) {
 				$sMsg = 'Class ['.$sAdaptor.'] does not implement the '
Index: branches/2.8.x/wb/framework/TranslateAdaptorWb3Mysql.php
===================================================================
--- branches/2.8.x/wb/framework/TranslateAdaptorWb3Mysql.php	(nonexistent)
+++ branches/2.8.x/wb/framework/TranslateAdaptorWb3Mysql.php	(revision 1902)
@@ -0,0 +1,87 @@
+<?php
+
+/**
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * TranslateAdaptorWb3Mysql.php
+ *
+ * @category     Core
+ * @package      Core_Translation
+ * @copyright    Werner v.d.Decken <wkl@isteam.de>
+ * @author       Werner v.d.Decken <wkl@isteam.de>
+ * @license      http://www.gnu.org/licenses/gpl.html   GPL License
+ * @version      0.0.1
+ * @revision     $Revision$
+ * @link         $HeadURL$
+ * @lastmodified $Date$
+ * @since        File available since 12.05.2013
+ * @description  Loads translation table from MySQL Language table<br />
+ *               Can handle Languagecodes like 'de_DE_BAY' (2ALPHA_2ALPHA_2-4ALNUM)
+ */
+
+class TranslateAdaptorWb3Mysql implements TranslateAdaptorInterface {
+
+	protected $sAddon      = '';
+	protected $sFilePath   = '';
+	private   $_oDb        = null;
+	private   $_sTableName = 'translations';
+/**
+ * Constructor
+ * @param string descriptor of the Addon (i.e. '' || 'modules\myAddon'
+ */
+	public function __construct($sAddon = '')
+	{
+		$this->_oDb = WbDatabase::getInstance();
+		$this->sAddon = $sAddon;
+	}
+/**
+ * Load languagefile
+ * @param string $sLangCode
+ * @return array|bool an array of translations or FALSE on error
+ */
+	public function loadLanguage($sLangCode)
+	{
+		$aTranslations = array();
+		$sql = 'SELECT `keyword`, `value` '
+		     . 'FROM `'.$this->_oDb->getTablePrefix.$this->_sTableName.'` '
+		     . 'WHERE `addon`=\''.$this->sAddon.'\' '
+		     .        'AND `lang` LIKE \''.addcslashes($sLangCode ,'_?').'\'';
+		if(($oTransSet = $this->_oDb->query($sql))) {
+			while($aTrans = $oTransSet->fetchRow(MYSQL_ASSOC)) {
+				$aTranslations[] = $aTrans;
+			}
+		}
+		return $aTranslations;
+	}
+/**
+ * Find first existing language
+ * @return string Code of first found basic language
+ */
+	public function findFirstLanguage()
+	{
+		$sql = 'SELECT `lang` '
+		     . 'FROM `'.$this->_oDb->getTablePrefix.$this->_sTableName.'` '
+		     . 'WHERE `addon`=\''.$this->sAddon.'\' '
+		     .        'AND `lang` LIKE \'__\'';
+		$sfirstMatch = $this->_oDb->get_one($sql);
+		return ($sfirstMatch ? $sfirstMatch : 'en');
+	}
+
+}
+// end of class TranslateAdaptorWb3Mysql
+

Property changes on: branches/2.8.x/wb/framework/TranslateAdaptorWb3Mysql.php
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision HeadURL
\ No newline at end of property
Index: branches/2.8.x/wb/framework/Translate.php
===================================================================
--- branches/2.8.x/wb/framework/Translate.php	(revision 1901)
+++ branches/2.8.x/wb/framework/Translate.php	(revision 1902)
@@ -92,8 +92,8 @@
 			throw new TranslationException('unable to load adaptor: '.$sAdaptor);
 		}
 		$this->sAdaptor       = 'TranslateAdaptor'.$sAdaptor;
-		$this->bUseCache      = (($iOptions & self::CACHE_DISABLED) == 0);
-		$this->bRemoveMissing = (($iOptions & self::KEEP_MISSING) == 0);
+		$this->bUseCache      = (!($iOptions & self::CACHE_DISABLED));
+		$this->bRemoveMissing = (!($iOptions & self::KEEP_MISSING));
 		// if no system language is set then use language 'en'
 		$this->sSystemLanguage = (trim($sSystemLanguage) == '' ? 'en' : $sSystemLanguage);
 		// if no default language is set then use system language
@@ -132,10 +132,19 @@
 /**
  * Add new addon
  * @param string Addon descriptor (i.e. 'modules\myAddon')
+ * @param string (optional)Adaptor name (default: $this->sAdaptor)
  * @return bool 
  */	
-	public function addAddon($sAddon)
+	public function addAddon($sAddon, $sAdaptor = null)
 	{
+		if($sAdaptor) {
+			if(!class_exists('TranslateAdaptor'.$sAdaptor)) {
+				throw new TranslationException('unable to load adaptor: '.$sAdaptor);
+			}
+			$sAdaptor = 'TranslateAdaptor'.$sAdaptor;
+		}else {
+			$sAdaptor = $this->sAdaptor;
+		}
 		$sAddon = str_replace('/', '\\', $sAddon);
 		if(!(strtolower($sAddon) == 'core' || $sAddon == '' || isset($this->aLoadedAddons[$sAddon]))) {
 		// load requested addon translations if needed and possible
@@ -144,19 +153,20 @@
 			                             $this->sDefaultLanguage, 
 			                             $this->sUserLanguage,
 			                             $this->bUseCache);
-			$this->aLoadedAddons[$sAddon] = $oTmp->load($this->sAdaptor);
+			$this->aLoadedAddons[$sAddon] = $oTmp->load($sAdaptor);
 		}
 	}
 /**
  * Activate Addon
  * @param string Addon descriptor (i.e. 'modules\myAddon')
+ * @param string (optional)Adaptor name (default: $this->sAdaptor)
  */	
-	public function enableAddon($sAddon)
+	public function enableAddon($sAddon, $sAdaptor = null)
 	{
 		$sAddon = str_replace('/', '\\', $sAddon);
 		if(!(strtolower($sAddon) == 'core' || $sAddon == '')) {
 			if(!isset($this->aLoadedAddons[$sAddon])) {
-				$this->addAddon($sAddon);
+				$this->addAddon($sAddon, $sAdaptor);
 			}
 			$this->aActiveTranslations[1] = $this->aLoadedAddons[$sAddon];
 		}
