Index: joomla.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/joomla/joomla.module,v retrieving revision 1.16.2.8 diff -u -r1.16.2.8 joomla.module --- joomla.module 20 Jul 2009 08:21:40 -0000 1.16.2.8 +++ joomla.module 21 Jul 2009 19:24:43 -0000 @@ -13,6 +13,7 @@ define('JOOMLA_DATABASE_PORT', 3306); define('JOOMLA_PREFIX', 'jos_'); define('JOOMLA_PATH', FALSE); +define('JOOMLA_LIVE_URL', FALSE); define('JOOMLA_DELAY_ROW', 100); define('JOOMLA_DELAY_SEC', 1); define('JOOMLA_INPUT_FORMAT', 2); @@ -172,6 +173,13 @@ .'
  • Windows using IIS: C:/Inetpub/wwwroot/joomla
  • ' ); + $form['joomla_settings_database']['joomla_live_url'] = array( + '#type' => 'textfield', + '#title' => 'URL of your Joomla site', + '#default_value' => variable_get('joomla_live_url', JOOMLA_LIVE_URL), + '#description' => 'The URL of a live version of your Joomla site' + ); + $weight++; $form['joomla_settings_content'] = array( @@ -842,3 +850,44 @@ sleep(variable_get('joomla_delay_sec', JOOMLA_DELAY_SEC)); } } + + +/** + * Implementation of hook_block(). + */ +function joomla_block($op='list', $delta=0, $edit=array()) { + + switch ($op) { + + case 'list': + $blocks = array( + array( + 'info' => t('Joomla Backlinks'), + ), + ); + return $blocks; + + case 'view': + // only show this block on node/* pages + if ($node = menu_get_object()) { + $joomla_live_url = variable_get('joomla_live_url', JOOMLA_LIVE_URL); + + // only show links if the base URL has been set + if($joomla_live_url) { + $ids = db_fetch_object(db_query('SELECT nid, jcontentid FROM {joomla_content} WHERE nid = %d', $node->nid)); + + $blocks['subject'] = t('Link Back to Joomla'); + $blocks['content'] = sprintf("View this node in Joomla", $joomla_live_url, $ids->jcontentid); + + return $blocks; + + } else { + + $blocks['subject'] = t('Links Disabled'); + $blocks['content'] = t('You have not set your Joomla Live URL. ') . l("Settings", "admin/settings/joomla"); + return $blocks; + } + } + return; + } +}