Skip to content

Commit

Permalink
^ [Kunena#20] Add configuration fields for Joomla 1.7
Browse files Browse the repository at this point in the history
Also add new option - Select Forum - and use default exporter with
failing message
  • Loading branch information
mahagr committed Jul 10, 2011
1 parent 99a0dac commit 1ff615f
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 24 deletions.
2 changes: 2 additions & 0 deletions administrator/components/com_kunenaimporter/CHANGELOG.php
Expand Up @@ -36,6 +36,8 @@
10-July-2011 Matias
^ [#20] Add support for Joomla 1.7: Code cleanup, DS removal and small fixes
^ [#20] Add support for Joomla 1.7: Convert language strings to the new format
^ [#20] Add new option - Select Forum - and use default exporter with failing message
^ [#20] Add configuration fields for Joomla 1.7
10-July-2011 Xillibit
# [#18] Notice: Undefined property: KunenaimporterViewDefault::$options in \views\default\tmpl\default.php on line 47
Expand Down
47 changes: 32 additions & 15 deletions administrator/components/com_kunenaimporter/config.xml
@@ -1,21 +1,38 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!DOCTYPE config>
<config>
<!-- Joomla 1.5 support -->
<params>
<param name='extforum' type='list' default='localhost' label='Forum Type' description='' size='30'>
<!-- <option value='Agora'>Agora</option> -->
<!-- <option value='ccboard'>ccBoard</option> -->
<!-- <option value='kunena'>Kunena</option> -->
<option value='phpbb3'>phpBB3</option>
<!-- <option value='phpbb2'>phpBB2</option> -->
<!-- <option value='pnphpbb2'>PNphpBB2</option> -->
<option value='smf2'>SMF2</option>
</param>
<param name='path' type='text' default='' label='Relative Path to Forum' description='Please enter the relative system path to the installation of the forum you want to import from.' size='30' />
<!-- <param name='db_host' type='text' default='localhost' label='Database Host' description='' size='30' />
<param name='db_user' type='text' default='' label='Database User' description='' size='30' />
<param name='db_passwd' type='password' default='' label='Database Password' description='' size='30' />
<param name='db_name' type='text' default='' label='Forum Database Name' description='' size='30' />
<param name='db_prefix' type='text' default='phpbb_' label='Forum Table Prefix' description='Please enter the table prefix used for the forum you want to import from.' size='30' /> -->
<param name="extforum" type="list" default="localhost" label="COM_KUNENAIMPORTER_CONFIG_EXTFORUM_LABEL" description="COM_KUNENAIMPORTER_CONFIG_EXTFORUM_DESC" size="30">
<option value="">COM_KUNENAIMPORTER_EXTFORUM_OPTION_EMPTY</option>
<!-- <option value="agora">Agora</option> -->
<!-- <option value="ccboard">ccBoard</option> -->
<!-- <option value="kunena">Kunena</option> -->
<option value="phpbb3">phpBB3</option>
<!-- <option value="phpbb2">phpBB2</option> -->
<!-- <option value="pnphpbb2">PNphpBB2</option> -->
<option value="smf2">SMF2</option>
</param>
<param name="path" type="text" default="" label="COM_KUNENAIMPORTER_CONFIG_PATH_LABEL" description="COM_KUNENAIMPORTER_CONFIG_PATH_DESC" size="30" />
<!-- <param name="db_host" type="text" default="localhost" label="Database Host" description="" size="30" />
<param name="db_user" type="text" default="" label="Database User" description="" size="30" />
<param name="db_passwd" type="password" default="" label="Database Password" description="" size="30" />
<param name="db_name" type="text" default="" label="Forum Database Name" description="" size="30" />
<param name="db_prefix" type="text" default="phpbb_" label="Forum Table Prefix" description="Please enter the table prefix used for the forum you want to import from." size="30" /> -->
</params>

<!-- Joomla 1.6 Support -->
<fieldset name="config" label="COM_KUNENAIMPORTER_CONFIG_LABEL" description="COM_KUNENAIMPORTER_CONFIG_DESC">
<field name="extforum" type="list" default="" label="COM_KUNENAIMPORTER_CONFIG_EXTFORUM_LABEL" description="COM_KUNENAIMPORTER_CONFIG_EXTFORUM_DESC" size="30">
<option value="">COM_KUNENAIMPORTER_EXTFORUM_OPTION_EMPTY</option>
<!-- <option value="agora">Agora</option> -->
<!-- <option value="ccboard">ccBoard</option> -->
<!-- <option value="kunena">Kunena</option> -->
<option value="phpbb3">phpBB3</option>
<!-- <option value="phpbb2">phpBB2</option> -->
<!-- <option value="pnphpbb2">PNphpBB2</option> -->
<option value="smf2">SMF2</option>
</field>
<field name="path" type="text" default="" label="COM_KUNENAIMPORTER_CONFIG_PATH_LABEL" description="COM_KUNENAIMPORTER_CONFIG_PATH_DESC" size="30" />
</fieldset>
</config>
9 changes: 6 additions & 3 deletions administrator/components/com_kunenaimporter/controller.php
Expand Up @@ -82,7 +82,8 @@ public function mapusers() {

$component = JComponentHelper::getComponent ( 'com_kunenaimporter' );
$params = new JParameter ( $component->params );
$exporter = $this->getModel ( 'export_' . $params->get ( 'extforum' ) );
$extforum = $params->get ( 'extforum' );
$exporter = $this->getModel ( $extforum ? 'export_' . $extforum : 'export' );
$exporter->checkConfig ();
$errormsg = $exporter->getError ();
$importer = $this->getModel ( 'import' );
Expand Down Expand Up @@ -149,7 +150,8 @@ public function importforum() {

$component = JComponentHelper::getComponent ( 'com_kunenaimporter' );
$params = new JParameter ( $component->params );
$exporter = $this->getModel ( 'export_' . $params->get ( 'extforum' ) );
$extforum = $params->get ( 'extforum' );
$exporter = $this->getModel ( $extforum ? 'export_' . $extforum : 'export' );
$exporter->checkConfig ();
$errormsg = $exporter->getError ();
$importer = $this->getModel ( 'import' );
Expand Down Expand Up @@ -242,7 +244,8 @@ public function display() {
$component = JComponentHelper::getComponent ( 'com_kunenaimporter' );
$params = new JParameter ( $component->params );
$view->setModel ( $this->getModel ( 'import' ), true );
$view->setModel ( $this->getModel ( 'export_' . $params->get ( 'extforum', 'kunena' ) ), false );
$extforum = $params->get ( 'extforum' );
$view->setModel ( $this->getModel ( $extforum ? 'export_' . $extforum : 'export' ), false );

JSubMenuHelper::addEntry ( JText::_ ( 'Importer Configuration' ), 'index.php?option=com_kunenaimporter', $cmd == 'default' );
JSubMenuHelper::addEntry ( JText::_ ( 'Migrate Users' ), 'index.php?option=com_kunenaimporter&view=users', $cmd == 'users' );
Expand Down
Expand Up @@ -47,3 +47,10 @@ COM_KUNENAIMPORTER_DESCRIPTION_MAPUSERS="Map external users to Joomla."
COM_KUNENAIMPORTER_IMPORT_OPTIONS="Import Options"

COM_KUNENAIMPORTER_DEPENDENCY_FAIL="Kunena is not installed or the installed Kunena version is not supported. The Kunena Importer has been disabled. Please install/upgrade Kunena to version %s for the Kunena Importer to function properly."
COM_KUNENAIMPORTER_CONFIG_LABEL="Importer Configuration"
COM_KUNENAIMPORTER_CONFIG_DESC="Configure Kunena Importer"
COM_KUNENAIMPORTER_CONFIG_EXTFORUM_LABEL="Forum Software"
COM_KUNENAIMPORTER_CONFIG_EXTFORUM_DESC="Please select forum software from your current forum."
COM_KUNENAIMPORTER_EXTFORUM_OPTION_EMPTY="- Select Forum -"
COM_KUNENAIMPORTER_CONFIG_PATH_LABEL="Relative Path to Forum"
COM_KUNENAIMPORTER_CONFIG_PATH_DESC="Please enter the relative system path from your Joomla installation to the installation of the forum you want to import from."
17 changes: 14 additions & 3 deletions administrator/components/com_kunenaimporter/models/export.php
Expand Up @@ -79,18 +79,29 @@ public function getExportOptions($importer) {
return $exportOpt;
}

public function buildImportOps() {
$this->importOps = array();
}

public function checkConfig() {
$this->addMessage ( '<h2>Importer Status</h2>' );

// Kunena detection and version check
$minKunenaVersion = '1.6.4';
if (! class_exists ( 'Kunena' ) || Kunena::versionBuild () < 4344) {
if (! class_exists ( 'Kunena' ) || version_compare(Kunena::version(), $minKunenaVersion, '<')) {
$this->addMessage ( '<div>Kunena version: <b style="color:red">FAILED</b></div>' );
$this->addMessage ( '<br /><div><b>You need to install Kunena 1.6!</b></div><div><b>Error:</b> Kunena 1.6 not detected</div>' );
$this->addMessage ( '<br /><div><b>You need to install Kunena '.$minKunenaVersion.'!</b></div>' );
$this->error = 'Kunena not detected!';
return false;
}
$this->addMessage ( '<div>Kunena version: <b style="color:green">' . KUNENA_VERSION . '</b></div>' );
$this->addMessage ( '<div>Kunena version: <b style="color:green">' . Kunena::version() . '</b></div>' );

if (empty($this->importOps)) {
$this->addMessage ( '<br /><div><b>Please select forum software!</b></div>' );
$this->error = 'Forum not selected!';
return false;
}

if (JError::isError ( $this->ext_database ))
$this->error = $this->ext_database->toString ();
else if (!$this->ext_database) {
Expand Down
Expand Up @@ -27,7 +27,7 @@ class KunenaimporterModelImport extends JModel {
public function __construct() {
parent::__construct ();
$this->db = JFactory::getDBO ();
$this->db->setDebug(0);
// $this->db->setDebug(0);
}

public function getImportOptions() {
Expand Down
Expand Up @@ -13,6 +13,7 @@
*/
defined('_JEXEC') or die();

JHTML::_('behavior.tooltip');
$disabled = '';
if (!empty($this->errormsg)) $disabled = ' disabled="disabled"';
?>
Expand Down
Expand Up @@ -24,7 +24,8 @@ function display($tpl = null) {
$this->assign ( 'params', $params );

$importer = $this->getModel ( 'import' );
$exporter = $this->getModel ( 'export_' . $params->get ( 'extforum' ) );
$extforum = $params->get ( 'extforum' );
$exporter = $this->getModel ( $extforum ? 'export_' . $extforum : 'export' );

$this->options = '';
if (is_object ( $exporter )) {
Expand All @@ -47,7 +48,6 @@ function display($tpl = null) {
JToolBarHelper::divider ();
}
JToolBarHelper::save ( 'save', JText::_ ( 'Save Settings' ) );
JToolBarHelper::cancel ( 'cancel', JText::_ ( 'Reset' ) );

parent::display ( $tpl );
}
Expand Down

0 comments on commit 1ff615f

Please sign in to comment.