Merge pull request #3213 from eileenmcnaughton/comments
[civicrm-core.git] / CRM / Admin / Page / Access.php
index 3a02f55dd099bace6e5216dc0cdf0fbd4e345997..acdd2a03bf4be70370ab5f706931756c0dfd031e 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -51,11 +51,23 @@ class CRM_Admin_Page_Access extends CRM_Core_Page {
         break;
 
       case 'Joomla':
-        JHTML::_('behavior.modal');
-        $url = $config->userFrameworkBaseURL . "index.php?option=com_config&view=component&component=com_civicrm&tmpl=component";
-        $jparams = 'rel="{handler: \'iframe\', size: {x: 875, y: 550}, onClose: function() {}}" class="modal"';
-        $this->assign('ufAccessURL', $url);
-        $this->assign('jAccessParams', $jparams);
+        //condition based on Joomla version; <= 2.5 uses modal window; >= 3.0 uses full page with return value
+        if( version_compare(JVERSION, '3.0', 'lt') ) {
+          JHTML::_('behavior.modal');
+          $url = $config->userFrameworkBaseURL . 'index.php?option=com_config&view=component&component=com_civicrm&tmpl=component';
+          $jparams = 'rel="{handler: \'iframe\', size: {x: 875, y: 550}, onClose: function() {}}" class="modal"';
+
+          $this->assign('ufAccessURL', $url);
+          $this->assign('jAccessParams', $jparams);
+        }
+        else {
+          $uri = (string) JUri::getInstance();
+          $return = urlencode(base64_encode($uri));
+          $url = $config->userFrameworkBaseURL . 'index.php?option=com_config&view=component&component=com_civicrm&return=' . $return;
+
+          $this->assign('ufAccessURL', $url);
+          $this->assign('jAccessParams', '');
+        }
         break;
 
       case 'WordPress':