|
From: <gem...@li...> - 2011-10-20 12:18:09
|
Revision: 116
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=116&view=rev
Author: matijsdejong
Date: 2011-10-20 12:18:03 +0000 (Thu, 20 Oct 2011)
Log Message:
-----------
Fix for #21, made db adapter choice more understandable
Modified Paths:
--------------
trunk/library/classes/Gems/Default/SourceAction.php
trunk/library/classes/Gems/Tracker.php
Modified: trunk/library/classes/Gems/Default/SourceAction.php
===================================================================
--- trunk/library/classes/Gems/Default/SourceAction.php 2011-10-20 11:10:35 UTC (rev 115)
+++ trunk/library/classes/Gems/Default/SourceAction.php 2011-10-20 12:18:03 UTC (rev 116)
@@ -83,7 +83,7 @@
$bridge->addValidator('gso_ls_url', new MUtil_Validate_Url());
$bridge->addSelect('gso_ls_class');
- $bridge->addSelect('gso_ls_adapter');
+ $bridge->addSelect('gso_ls_adapter', 'description', $this->_('Choose the database used by the source.'));
$bridge->addText('gso_ls_table_prefix', array('size' => 15, 'description' => $this->_('Do not forget the underscores.')));
$bridge->addText('gso_ls_dbhost', array('size' => 15, 'description' => $in_gems));
@@ -144,11 +144,12 @@
$model->set('gso_ls_class', 'label', $this->_('Adaptor class'), 'multiOptions', $tracker->getSourceClasses());
if ($detailed) {
- $model->set('gso_ls_adapter', 'label', $this->_('DB Adaptor'), 'multiOptions', $tracker->getSourceDatabaseClasses());
+ $model->set('gso_ls_adapter', 'label', $this->_('Database Server'), 'multiOptions', $tracker->getSourceDatabaseClasses(), 'default', substr(get_class($this->db), strlen('Zend_Db_Adapter_')));
$model->set('gso_ls_dbhost', 'label', $this->_('Database host'));
$model->set('gso_ls_database', 'label', $this->_('Database'));
}
+
$model->set('gso_ls_table_prefix', 'label', $this->_('Table prefix'), 'default', 'ls__');
$model->set('gso_active', 'default', 0);
Modified: trunk/library/classes/Gems/Tracker.php
===================================================================
--- trunk/library/classes/Gems/Tracker.php 2011-10-20 11:10:35 UTC (rev 115)
+++ trunk/library/classes/Gems/Tracker.php 2011-10-20 12:18:03 UTC (rev 116)
@@ -73,7 +73,7 @@
* @var array Of classname => description
*/
protected $_sourceClasses = array(
- 'LimeSurvey1m9Database' => 'Lime Survey 1.90 DB',
+ 'LimeSurvey1m9Database' => 'Lime Survey 1.90 DB',
'LimeSurvey1m91Database' => 'Lime Survey 1.91+ DB',
);
@@ -114,29 +114,29 @@
private $_trackEngines = array();
/**
+ * Allows sub classes of Gems_Loader_LoaderAbstract to specify the subdirectory where to look for.
*
- * @var Zend_Translate
+ * @var string $cascade An optional subdirectory where this subclass always loads from.
*/
- protected $translate;
+ protected $cascade = 'Tracker';
/**
*
- * @var Zend_Session
+ * @var Zend_Db_Adapter_Abstract
*/
- protected $session;
+ protected $db;
/**
- * Allows sub classes of Gems_Loader_LoaderAbstract to specify the subdirectory where to look for.
*
- * @var string $cascade An optional subdirectory where this subclass always loads from.
+ * @var Zend_Translate
*/
- protected $cascade = 'Tracker';
+ protected $translate;
/**
*
- * @var Zend_Db_Adapter_Abstract
+ * @var Zend_Session
*/
- protected $db;
+ protected $session;
/**
* Set to true to get detailed information on all tracker actions
@@ -413,12 +413,18 @@
// TODO: this should be moved to Gems_Tracker_Source_SourceInterface,
// but do not have time to implement is of minor importance at this moment.
- return array(
- '' => '-- none --',
- 'Mysqli' => 'MySQL',
- 'Pdo_Mysql' => 'MySQL (PDO)',
- 'Sqlsrv' => 'SQL Server',
- 'Pdo_Mssql' => 'SQL Server (PDO)');
+ // If the project uses Pdo database, use Pdo classes, otherwise MySQL
+ if (stripos(get_class($this->db), '_Pdo_')) {
+ return array(
+ '' => '-- none --',
+ 'Pdo_Mysql' => 'MySQL (PDO)',
+ 'Pdo_Mssql' => 'SQL Server (PDO)');
+ } else {
+ return array(
+ '' => '-- none --',
+ 'Mysqli' => 'MySQL',
+ 'Sqlsrv' => 'SQL Server');
+ }
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|