Skip to content
Browse files

+ [#29496] Language Installation tool for the Joomla Installer. Thanks

Javier.
  • Loading branch information...
1 parent 1810d8e commit e2ffca92efaf05cb887200e3cfff8bb1cf110c25 @javigomez javigomez committed with infograf768 Nov 18, 2012
View
1 installation/CHANGELOG
@@ -36,6 +36,7 @@ $ -> Language fix or change
# [#29710] mod_breadcrumbs: Custom separator is not applied. Thanks Constantin
# [#29682] Adding an icon to the "reply" button in com_messages. Thanks Constantin.
# [#29712] Alternate fix for 29646 update changes. Thanks Michael
+ + [#29496] Language Installation tool for the Joomla Installer. Thanks Javier.
16-Nov-2012 Jean-Marie Simonet
$+ Adding Uyghur ug-CN installation files
View
19 installation/controller.php
@@ -28,6 +28,7 @@ class InstallationController extends JControllerLegacy
*/
public function display($cachable = false, $urlparams = false)
{
+
// Get the current URI to redirect to.
$uri = JURI::getInstance();
$redirect = base64_encode($uri);
@@ -58,20 +59,28 @@ public function display($cachable = false, $urlparams = false)
$view = $this->getView($vName, $vFormat);
if ($view)
{
- $model = $this->getModel('Setup', 'InstallationModel', array('dbo' => null));
- $sufficient = $model->getPhpOptionsSufficient();
-
+ $checkOptions = null;
switch ($vName)
{
case 'preinstall':
+ $model = $this->getModel('Setup', 'InstallationModel', array('dbo' => null));
+ $sufficient = $model->getPhpOptionsSufficient();
$checkOptions = false;
- if ($sufficient) {
+ if ($sufficient)
+ {
$this->setRedirect('index.php');
}
break;
+ case 'languages':
+ case 'defaultlanguage':
+ $model = $this->getModel('Languages', 'InstallationModel', array('dbo' => null));
+ break;
default:
+ $model = $this->getModel('Setup', 'InstallationModel', array('dbo' => null));
+ $sufficient = $model->getPhpOptionsSufficient();
$checkOptions = true;
- if (!$sufficient) {
+ if (!$sufficient)
+ {
$this->setRedirect('index.php?view=preinstall');
}
break;
View
167 installation/controllers/languages.json.php
@@ -0,0 +1,167 @@
+<?php
+/**
+ * @package Joomla.Installation
+ *
+ * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+defined('_JEXEC') or die;
+require_once __DIR__ . '/setup.json.php';
+
+
+/**
+ * Setup controller for the Joomla Core Installer.
+ * - JSON Protocol -
+ *
+ * @package Joomla.Installation
+ * @since 3.0
+ */
+class InstallationControllerLanguages extends InstallationControllerSetup
+{
+ public function __construct($config = array())
+ {
+
+ // Overrides application config and set the configuration.php file so tokens and database works
+ JFactory::$config = null;
+ JFactory::getConfig(JPATH_SITE . '/configuration.php');
+ JFactory::$session = null;
+ parent::__construct();
+ }
+
+
+ /**
+ * Method to install languages to Joomla application.
+ *
+ * @return void
+ * @since 3.x.x
+ */
+ public function installLanguages()
+ {
+
+ // Check for a valid token. If invalid, send a 403 with the error message.
+ JSession::checkToken() or $this->sendResponse(new Exception(JText::_('JINVALID_TOKEN'), 403));
+
+ // Get the application object.
+ $app = JFactory::getApplication();
+
+
+ // Get array of selected languages
+ $lids = $this->input->get('cid', array(), 'array');
+ JArrayHelper::toInteger($lids, array());
+
+ // Get the languages model.
+ $model = $this->getModel('Languages', 'InstallationModel');
+
+ $return = false;
+ if (!$lids)
+ {
+
+ // No languages have been selected
+ $app->enqueueMessage(JText::_('INSTL_LANGUAGES_NO_LANGUAGE_SELECTED'));
+ }
+ else
+ {
+
+ // Install selected languages
+ $return = $model->install($lids);
+ }
+
+ $r = new stdClass;
+
+ // Check for validation errors.
+ if ($return === false) {
+
+ // Get the validation messages.
+ $errors = $model->getErrors();
+
+ // Push up to three validation messages out to the user.
+ for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++)
+ {
+ if ($errors[$i] instanceof Exception)
+ {
+ $app->enqueueMessage($errors[$i]->getMessage(), 'warning');
+ }
+ else
+ {
+ $app->enqueueMessage($errors[$i], 'warning');
+ }
+ }
+
+ // Redirect back to the language selection screen.
+ $r->view = 'languages';
+ $this->sendResponse($r);
+ }
+
+ // Create a response body.
+ $r->view = 'defaultlanguage';
+
+ // Send the response.
+ $this->sendResponse($r);
+ }
+
+ /**
+ * Set the selected language as the main language to the Joomla! administrator
+ *
+ * @since X.x.x
+ */
+ function setDefaultLanguage()
+ {
+ // Check for a valid token. If invalid, send a 403 with the error message.
+ JSession::checkToken() or $this->sendResponse(new Exception(JText::_('JINVALID_TOKEN'), 403));
+
+ // Get the languages model.
+ $model = $this->getModel('Languages', 'InstallationModel');
+
+ // Check for request forgeries
+ $admin_lang = JRequest::getString('administratorlang', false);
+
+ // Check that is an Lang ISO Code avoiding any injection.
+ if (!preg_match('/^[a-z]{2}(\-[A-Z]{2})?$/', $admin_lang))
+ {
+ $admin_lang = 'en-GB';
+ }
+
+ $app = JFactory::getApplication();
+ $r = new stdClass;
+
+ if (!$model->setDefault($admin_lang, "administrator"))
+ {
+
+ // Create a error response message.
+ $app->enqueueMessage(JText::_('INSTL_DEFAULTLANGUAGE_ADMIN_COULDNT_SET_DEFAULT'), "error");
+ }
+ else
+ {
+
+ // Create a response body.
+ $app->enqueueMessage(JText::sprintf('INSTL_DEFAULTLANGUAGE_ADMIN_SET_DEFAULT', $admin_lang));
+ }
+
+ $frontend_lang = JRequest::getString('frontendlang', false);
+
+ // check that is an Lang ISO Code avoiding any injection.
+ if (!preg_match('/^[a-z]{2}(\-[A-Z]{2})?$/', $frontend_lang))
+ {
+ $frontend_lang = 'en-GB';
+ }
+
+ if (!$model->setDefault($frontend_lang, "site"))
+ {
+
+ // Create a error response message.
+ $app->enqueueMessage(JText::_('INSTL_DEFAULTLANGUAGE_FRONTEND_COULDNT_SET_DEFAULT'), "error");
+ }
+ else
+ {
+
+ // Create a response body.
+ $app->enqueueMessage(JText::sprintf('INSTL_DEFAULTLANGUAGE_FRONTEND_SET_DEFAULT', $frontend_lang));
+ }
+
+ // Create a response body.
+ $r->view = 'remove';
+
+ // Send the response.
+ $this->sendResponse($r);
+ }
+}
View
20 installation/controllers/setup.json.php
@@ -26,6 +26,7 @@ class InstallationControllerSetup extends JControllerLegacy
*/
public function setlanguage()
{
+
// Check for request forgeries.
JSession::checkToken() or $this->sendResponse(new Exception(JText::_('JINVALID_TOKEN'), 403));
@@ -58,9 +59,11 @@ public function setlanguage()
$return = $model->validate($data, 'preinstall');
$r = new stdClass;
+
// Check for validation errors.
if ($return === false)
{
+
// Get the validation messages.
$errors = $model->getErrors();
@@ -442,6 +445,7 @@ function emailTitle($title)
*/
function checkForm($page = 'site')
{
+
// Check for request forgeries.
JSession::checkToken() or $this->sendResponse(new Exception(JText::_('JINVALID_TOKEN'), 403));
@@ -464,6 +468,7 @@ function checkForm($page = 'site')
// Check for validation errors.
if ($return === false)
{
+
// Get the validation messages.
$errors = $model->getErrors();
@@ -503,6 +508,7 @@ function checkForm($page = 'site')
*/
public function detectFtpRoot()
{
+
// Check for a valid token. If invalid, send a 403 with the error message.
JSession::checkToken('request') or $this->sendResponse(new Exception(JText::_('JINVALID_TOKEN'), 403));
@@ -542,6 +548,7 @@ public function detectFtpRoot()
*/
public function verifyFtpSettings()
{
+
// Check for a valid token. If invalid, send a 403 with the error message.
JSession::checkToken('request') or $this->sendResponse(new Exception(JText::_('JINVALID_TOKEN'), 403));
@@ -590,13 +597,14 @@ public function removeFolder()
$vars = $this->input->get('jform', array(), 'array');
$path = JPATH_INSTALLATION;
- //check whether the folder still exists
+
+ // Check whether the folder still exists
if (!file_exists($path))
{
$this->sendResponse(new Exception(JText::sprintf('INSTL_COMPLETE_ERROR_FOLDER_ALREADY_REMOVED'), 500));
}
- // check whether we need to use FTP
+ // Check whether we need to use FTP
$useFTP = false;
if ((file_exists($path) && !is_writable($path)))
{
@@ -617,6 +625,7 @@ public function removeFolder()
if ($useFTP == true)
{
+
// Connect the FTP client
jimport('joomla.filesystem.path');
@@ -641,6 +650,7 @@ public function removeFolder()
}
else
{
+
// Try to delete the folder.
// We use output buffering so that any error message echoed JFolder::delete
// doesn't land in our JSON output.
@@ -676,9 +686,11 @@ public function removeFolder()
*/
public function sendResponse($response)
{
+
// Check if we need to send an error code.
if ($response instanceof Exception)
{
+
// Send the appropriate error code response.
JResponse::setHeader('status', $response->getCode());
JResponse::setHeader('Content-Type', 'application/json; charset=utf-8');
@@ -692,6 +704,7 @@ public function sendResponse($response)
$app = JFactory::getApplication();
$app->close();
}
+
}
/**
@@ -704,6 +717,7 @@ class InstallationJsonResponse
{
function __construct($state)
{
+
// The old token is invalid so send a new one.
$this->token = JSession::getFormToken(true);
@@ -734,13 +748,15 @@ function __construct($state)
// Check if we are dealing with an error.
if ($state instanceof Exception)
{
+
// Prepare the error response.
$this->error = true;
$this->header = JText::_('INSTL_HEADER_ERROR');
$this->message = $state->getMessage();
}
else
{
+
// Prepare the response data.
$this->error = false;
$this->data = $state;
View
28 installation/helpers/html/installation.php
@@ -25,6 +25,7 @@ class JHtmlInstallation
*/
public static function stepbar()
{
+
// Determine if the configuration file path is writable.
$path = JPATH_CONFIGURATION . '/configuration.php';
$useftp = (file_exists($path)) ? !is_writable($path) : !is_writable(JPATH_CONFIGURATION . '/');
@@ -49,6 +50,32 @@ public static function stepbar()
}
/**
+ * Method to generate the side bar
+ *
+ * @return string Markup for the side bar
+ *
+ * @since 3.0
+ */
+ public static function stepbarlanguages()
+ {
+
+ $tabs = array();
+ $tabs[] = 'languages';
+ $tabs[] = 'defaultlanguage';
+ $tabs[] = 'complete';
+
+ $html = array();
+ $html[] = '<ul class="nav nav-tabs">';
+ foreach ($tabs as $tab)
+ {
+ $html[] = self::getTab($tab, $tabs);
+ }
+ $html[] = '</ul>';
+
+ return implode('', $html);
+ }
+
+ /**
* @param string $id
* @param array $tabs
*
@@ -91,6 +118,7 @@ private static function getTabNumber($id, $tabs)
{
$num = (int) array_search($id, $tabs);
$num++;
+
return $num;
}
}
View
44 installation/language/en-AU/en-AU.ini
@@ -6,15 +6,17 @@
;Stepbar
-INSTL_STEPS_TITLE="Steps"
-INSTL_STEP_LANGUAGE_LABEL="Language"
-INSTL_STEP_PREINSTALL_LABEL="Pre-Installation check"
-INSTL_STEP_LICENSE_LABEL="License"
+INSTL_STEP_COMPLETE_LABEL="Finish"
INSTL_STEP_DATABASE_LABEL="Database"
+INSTL_STEP_DEFAULTLANGUAGE_LABEL="Choose default language"
INSTL_STEP_FTP_LABEL="FTP"
+INSTL_STEP_LANGUAGE_LABEL="Language"
+INSTL_STEP_LANGUAGES_LABEL="Install Languages"
+INSTL_STEP_LICENSE_LABEL="License"
+INSTL_STEP_PREINSTALL_LABEL="Pre-Installation check"
INSTL_STEP_SITE_LABEL="Configuration"
-INSTL_STEP_COMPLETE_LABEL="Finish"
INSTL_STEP_SUMMARY_LABEL="Overview"
+INSTL_STEPS_TITLE="Steps"
;Language view
INSTL_LANGUAGE_TITLE="Choose language"
@@ -128,10 +130,40 @@ INSTL_COMPLETE_ERROR_FOLDER_ALREADY_REMOVED="The installation folder has already
INSTL_COMPLETE_ERROR_FOLDER_DELETE="Installation folder could not be deleted. Please manually delete the folder."
INSTL_COMPLETE_FOLDER_REMOVED="Installation folder successfully removed"
INSTL_COMPLETE_LANGUAGE_1="Joomla! in your own language?"
-INSTL_COMPLETE_LANGUAGE_2="Visit the Joomla! Community Site for language packs downloads."
+INSTL_COMPLETE_LANGUAGE_DESC="Before removing the installation folder you can install extra languages. If you want to add extra languages to your Joomla! application click the following button."
+INSTL_COMPLETE_LANGUAGE_DESC2="Note: you will need Internet access to allow Joomla! download and install the new languages. <br/>Some server configuration won't allow Joomla! to install the languages. If this is your case, don't worry, you will be able to install them later using the Joomla! administrator."
INSTL_COMPLETE_REMOVE_FOLDER="Remove installation folder"
INSTL_COMPLETE_REMOVE_INSTALLATION="PLEASE REMEMBER TO COMPLETELY REMOVE THE INSTALLATION FOLDER.<br />You will not be able to proceed beyond this point until the installation directory has been removed. This is a security feature of Joomla!."
INSTL_COMPLETE_TITLE="Congratulations! Joomla! is now installed."
+INSTL_COMPLETE_INSTALL_LANGUAGES="Extra steps: Install languages"
+
+;Languages view
+INSTL_LANGUAGES="Install language Packages"
+INSTL_LANGUAGES_COLUMN_HEADER_LANGUAGE="Language"
+INSTL_LANGUAGES_COLUMN_HEADER_VERSION="Version"
+INSTL_LANGUAGES_DESC="The Joomla interface is available in several languages. Choose your preferred languages clicking in the ckeckboxes and install them by clicking on the Next button.<br/>Note: this operation will take about 5 seconds for download and install every language. Please select not more than 3 languages to install to avoid timeouts."
+INSTL_LANGUAGES_MESSAGE_PLEASE_WAIT="This operation will take up to 10 seconds per language to complete<br />Please wait while we download and install the languages..."
+INSTL_LANGUAGES_NO_LANGUAGE_SELECTED="Please, select a languaje. If you don't need to install other languajes press the 'Previous' button"
+INSTL_LANGUAGES_WARNING_NO_INTERNET="Joomla! was not able to connect to the languages server. Please finish the installation process."
+INSTL_LANGUAGES_WARNING_NO_INTERNET2="Note: You will be able to install languages later using the Joomla! administrator"
+INSTL_LANGUAGES_WARNING_BACK_BUTTON="Return to last installation step"
+
+;Defaultlanguage view
+INSTL_DEFAULTLANGUAGE_ADMINISTRATOR="Default Administrator language"
+INSTL_DEFAULTLANGUAGE_ADMIN_COULDNT_SET_DEFAULT="Joomla was not able to set the language as default. English will be used as default language for the backend ADMINISTRATOR."
+INSTL_DEFAULTLANGUAGE_ADMIN_SET_DEFAULT="Joomla has set %s as your default ADMINISTRATOR language."
+INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_SELECT="Select"
+INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_LANGUAGE="Language"
+INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_TAG="Tag"
+INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_LANGUAGE="Joomla was unable to install %s language."
+INSTL_DEFAULTLANGUAGE_DESC="Joomla has installed the following languages. Please select your desired default language for the Joomla administrator and press the next button."
+INSTL_DEFAULTLANGUAGE_DESC_FRONTEND="Joomla has installed the following languages. Please select your desired default language for the Joomla frontend and press the next button."
+INSTL_DEFAULTLANGUAGE_FRONTEND="Default Site language"
+INSTL_DEFAULTLANGUAGE_FRONTEND_COULDNT_SET_DEFAULT="Joomla was not able to set the language as default. English will be used as default language for the frontend SITE."
+INSTL_DEFAULTLANGUAGE_FRONTEND_SET_DEFAULT="Joomla has set %s as your default SITE language."
+INSTL_DEFAULTLANGUAGE_NOTE="Note: once you press the Next button you will get back to the end of the installation process where you will be asked to delete the installation folder."
+INSTL_DEFAULTLANGUAGE_TABLE_HEADER="Select your default language"
+INSTL_DEFAULTLANGUAGE_TRY_LATER="You will be able to install it later using the Joomla! Administrator"
;Database Model
INSTL_DATABASE_COULD_NOT_CONNECT="Could not connect to the database. Connector returned number: %s"
View
44 installation/language/en-GB/en-GB.ini
@@ -6,15 +6,17 @@
;Stepbar
-INSTL_STEPS_TITLE="Steps"
-INSTL_STEP_LANGUAGE_LABEL="Language"
-INSTL_STEP_PREINSTALL_LABEL="Pre-Installation check"
-INSTL_STEP_LICENSE_LABEL="License"
+INSTL_STEP_COMPLETE_LABEL="Finish"
INSTL_STEP_DATABASE_LABEL="Database"
+INSTL_STEP_DEFAULTLANGUAGE_LABEL="Choose default language"
INSTL_STEP_FTP_LABEL="FTP"
+INSTL_STEP_LANGUAGE_LABEL="Language"
+INSTL_STEP_LANGUAGES_LABEL="Install Languages"
+INSTL_STEP_LICENSE_LABEL="License"
+INSTL_STEP_PREINSTALL_LABEL="Pre-Installation check"
INSTL_STEP_SITE_LABEL="Configuration"
-INSTL_STEP_COMPLETE_LABEL="Finish"
INSTL_STEP_SUMMARY_LABEL="Overview"
+INSTL_STEPS_TITLE="Steps"
;Language view
INSTL_LANGUAGE_TITLE="Choose language"
@@ -128,10 +130,40 @@ INSTL_COMPLETE_ERROR_FOLDER_ALREADY_REMOVED="The installation folder has already
INSTL_COMPLETE_ERROR_FOLDER_DELETE="Installation folder could not be deleted. Please manually delete the folder."
INSTL_COMPLETE_FOLDER_REMOVED="Installation folder successfully removed"
INSTL_COMPLETE_LANGUAGE_1="Joomla! in your own language?"
-INSTL_COMPLETE_LANGUAGE_2="Visit the Joomla! Community Site for language packs downloads."
+INSTL_COMPLETE_LANGUAGE_DESC="Before removing the installation folder you can install extra languages. If you want to add extra languages to your Joomla! application click the following button."
+INSTL_COMPLETE_LANGUAGE_DESC2="Note: you will need Internet access to allow Joomla! download and install the new languages. <br/>Some server configuration won't allow Joomla! to install the languages. If this is your case, don't worry, you will be able to install them later using the Joomla! administrator."
INSTL_COMPLETE_REMOVE_FOLDER="Remove installation folder"
INSTL_COMPLETE_REMOVE_INSTALLATION="PLEASE REMEMBER TO COMPLETELY REMOVE THE INSTALLATION FOLDER.<br />You will not be able to proceed beyond this point until the installation directory has been removed. This is a security feature of Joomla!."
INSTL_COMPLETE_TITLE="Congratulations! Joomla! is now installed."
+INSTL_COMPLETE_INSTALL_LANGUAGES="Extra steps: Install languages"
+
+;Languages view
+INSTL_LANGUAGES="Install language Packages"
+INSTL_LANGUAGES_COLUMN_HEADER_LANGUAGE="Language"
+INSTL_LANGUAGES_COLUMN_HEADER_VERSION="Version"
+INSTL_LANGUAGES_DESC="The Joomla interface is available in several languages. Choose your preferred languages clicking in the ckeckboxes and install them by clicking on the Next button.<br/>Note: this operation will take about 5 seconds for download and install every language. Please select not more than 3 languages to install to avoid timeouts."
+INSTL_LANGUAGES_MESSAGE_PLEASE_WAIT="This operation will take up to 10 seconds per language to complete<br />Please wait while we download and install the languages..."
+INSTL_LANGUAGES_NO_LANGUAGE_SELECTED="Please, select a languaje. If you don't need to install other languajes press the 'Previous' button"
+INSTL_LANGUAGES_WARNING_NO_INTERNET="Joomla! was not able to connect to the languages server. Please finish the installation process."
+INSTL_LANGUAGES_WARNING_NO_INTERNET2="Note: You will be able to install languages later using the Joomla! administrator"
+INSTL_LANGUAGES_WARNING_BACK_BUTTON="Return to last installation step"
+
+;Defaultlanguage view
+INSTL_DEFAULTLANGUAGE_ADMINISTRATOR="Default Administrator language"
+INSTL_DEFAULTLANGUAGE_ADMIN_COULDNT_SET_DEFAULT="Joomla was not able to set the language as default. English will be used as default language for the backend ADMINISTRATOR."
+INSTL_DEFAULTLANGUAGE_ADMIN_SET_DEFAULT="Joomla has set %s as your default ADMINISTRATOR language."
+INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_SELECT="Select"
+INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_LANGUAGE="Language"
+INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_TAG="Tag"
+INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_LANGUAGE="Joomla was unable to install %s language."
+INSTL_DEFAULTLANGUAGE_DESC="Joomla has installed the following languages. Please select your desired default language for the Joomla administrator and press the next button."
+INSTL_DEFAULTLANGUAGE_DESC_FRONTEND="Joomla has installed the following languages. Please select your desired default language for the Joomla frontend and press the next button."
+INSTL_DEFAULTLANGUAGE_FRONTEND="Default Site language"
+INSTL_DEFAULTLANGUAGE_FRONTEND_COULDNT_SET_DEFAULT="Joomla was not able to set the language as default. English will be used as default language for the frontend SITE."
+INSTL_DEFAULTLANGUAGE_FRONTEND_SET_DEFAULT="Joomla has set %s as your default SITE language."
+INSTL_DEFAULTLANGUAGE_NOTE="Note: once you press the Next button you will get back to the end of the installation process where you will be asked to delete the installation folder."
+INSTL_DEFAULTLANGUAGE_TABLE_HEADER="Select your default language"
+INSTL_DEFAULTLANGUAGE_TRY_LATER="You will be able to install it later using the Joomla! Administrator"
;Database Model
INSTL_DATABASE_COULD_NOT_CONNECT="Could not connect to the database. Connector returned number: %s"
View
44 installation/language/en-US/en-US.ini
@@ -6,15 +6,17 @@
;Stepbar
-INSTL_STEPS_TITLE="Steps"
-INSTL_STEP_LANGUAGE_LABEL="Language"
-INSTL_STEP_PREINSTALL_LABEL="Pre-Installation check"
-INSTL_STEP_LICENSE_LABEL="License"
+INSTL_STEP_COMPLETE_LABEL="Finish"
INSTL_STEP_DATABASE_LABEL="Database"
+INSTL_STEP_DEFAULTLANGUAGE_LABEL="Choose default language"
INSTL_STEP_FTP_LABEL="FTP"
+INSTL_STEP_LANGUAGE_LABEL="Language"
+INSTL_STEP_LANGUAGES_LABEL="Install Languages"
+INSTL_STEP_LICENSE_LABEL="License"
+INSTL_STEP_PREINSTALL_LABEL="Pre-Installation check"
INSTL_STEP_SITE_LABEL="Configuration"
-INSTL_STEP_COMPLETE_LABEL="Finish"
INSTL_STEP_SUMMARY_LABEL="Overview"
+INSTL_STEPS_TITLE="Steps"
;Language view
INSTL_LANGUAGE_TITLE="Choose language"
@@ -128,10 +130,40 @@ INSTL_COMPLETE_ERROR_FOLDER_ALREADY_REMOVED="The installation folder has already
INSTL_COMPLETE_ERROR_FOLDER_DELETE="Installation folder could not be deleted. Please manually delete the folder."
INSTL_COMPLETE_FOLDER_REMOVED="Installation folder successfully removed"
INSTL_COMPLETE_LANGUAGE_1="Joomla! in your own language?"
-INSTL_COMPLETE_LANGUAGE_2="Visit the Joomla! Community Site for language packs downloads."
+INSTL_COMPLETE_LANGUAGE_DESC="Before removing the installation folder you can install extra languages. If you want to add extra languages to your Joomla! application click the following button."
+INSTL_COMPLETE_LANGUAGE_DESC2="Note: you will need Internet access to allow Joomla! download and install the new languages. <br/>Some server configuration won't allow Joomla! to install the languages. If this is your case, don't worry, you will be able to install them later using the Joomla! administrator."
INSTL_COMPLETE_REMOVE_FOLDER="Remove installation folder"
INSTL_COMPLETE_REMOVE_INSTALLATION="PLEASE REMEMBER TO COMPLETELY REMOVE THE INSTALLATION FOLDER.<br />You will not be able to proceed beyond this point until the installation directory has been removed. This is a security feature of Joomla!."
INSTL_COMPLETE_TITLE="Congratulations! Joomla! is now installed."
+INSTL_COMPLETE_INSTALL_LANGUAGES="Extra steps: Install languages"
+
+;Languages view
+INSTL_LANGUAGES="Install language Packages"
+INSTL_LANGUAGES_COLUMN_HEADER_LANGUAGE="Language"
+INSTL_LANGUAGES_COLUMN_HEADER_VERSION="Version"
+INSTL_LANGUAGES_DESC="The Joomla interface is available in several languages. Choose your preferred languages clicking in the ckeckboxes and install them by clicking on the Next button.<br/>Note: this operation will take about 5 seconds for download and install every language. Please select not more than 3 languages to install to avoid timeouts."
+INSTL_LANGUAGES_MESSAGE_PLEASE_WAIT="This operation will take up to 10 seconds per language to complete<br />Please wait while we download and install the languages..."
+INSTL_LANGUAGES_NO_LANGUAGE_SELECTED="Please, select a languaje. If you don't need to install other languajes press the 'Previous' button"
+INSTL_LANGUAGES_WARNING_NO_INTERNET="Joomla! was not able to connect to the languages server. Please finish the installation process."
+INSTL_LANGUAGES_WARNING_NO_INTERNET2="Note: You will be able to install languages later using the Joomla! administrator"
+INSTL_LANGUAGES_WARNING_BACK_BUTTON="Return to last installation step"
+
+;Defaultlanguage view
+INSTL_DEFAULTLANGUAGE_ADMINISTRATOR="Default Administrator language"
+INSTL_DEFAULTLANGUAGE_ADMIN_COULDNT_SET_DEFAULT="Joomla was not able to set the language as default. English will be used as default language for the backend ADMINISTRATOR."
+INSTL_DEFAULTLANGUAGE_ADMIN_SET_DEFAULT="Joomla has set %s as your default ADMINISTRATOR language."
+INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_SELECT="Select"
+INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_LANGUAGE="Language"
+INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_TAG="Tag"
+INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_LANGUAGE="Joomla was unable to install %s language."
+INSTL_DEFAULTLANGUAGE_DESC="Joomla has installed the following languages. Please select your desired default language for the Joomla administrator and press the next button."
+INSTL_DEFAULTLANGUAGE_DESC_FRONTEND="Joomla has installed the following languages. Please select your desired default language for the Joomla frontend and press the next button."
+INSTL_DEFAULTLANGUAGE_FRONTEND="Default Site language"
+INSTL_DEFAULTLANGUAGE_FRONTEND_COULDNT_SET_DEFAULT="Joomla was not able to set the language as default. English will be used as default language for the frontend SITE."
+INSTL_DEFAULTLANGUAGE_FRONTEND_SET_DEFAULT="Joomla has set %s as your default SITE language."
+INSTL_DEFAULTLANGUAGE_NOTE="Note: once you press the Next button you will get back to the end of the installation process where you will be asked to delete the installation folder."
+INSTL_DEFAULTLANGUAGE_TABLE_HEADER="Select your default language"
+INSTL_DEFAULTLANGUAGE_TRY_LATER="You will be able to install it later using the Joomla! Administrator"
;Database Model
INSTL_DATABASE_COULD_NOT_CONNECT="Could not connect to the database. Connector returned number: %s"
View
440 installation/models/languages.php
@@ -0,0 +1,440 @@
+<?php
+/**
+ * @package Joomla.Installation
+ *
+ * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ *
+ * @since 3.0.x
+ */
+
+defined('_JEXEC') or die;
+
+jimport('joomla.updater.update');
+
+/**
+ * Language Installer model for the Joomla Core Installer.
+ *
+ * @package Joomla.Installation
+ * @since 3.0
+ */
+class InstallationModelLanguages extends JModelLegacy
+{
+
+ /**
+ * @var object client object
+ */
+ protected $client = null;
+
+ /**
+ * @var array languages description
+ */
+ protected $data = null;
+
+ /**
+ * @var string language path
+ */
+ protected $path = null;
+
+ /**
+ * @var int total number of languages installed
+ */
+ protected $langlist = null;
+
+ /**
+ * Constructor, deletes the default installation config file and recreates it with the good config file.
+ */
+ public function __construct()
+ {
+
+ // Overrides application config and set the configuration.php file so tokens and database works
+ JFactory::$config = null;
+ JFactory::getConfig(JPATH_SITE . '/configuration.php');
+ JFactory::$session = null;
+
+ parent::__construct();
+ }
+
+ /**
+ * Generate a list of language choices to install in the Joomla CMS
+ *
+ * @return boolean True if successful
+ */
+ public function getItems()
+ {
+ $updater = JUpdater::getInstance();
+
+ /*
+ * The following function uses extension_id 600, that is the English language extension id.
+ * In #__update_sites_extensions you should have 600 linked to the Accredited Translations Repo
+ */
+ $updater->findUpdates(array(600), 0);
+
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true);
+
+ // Select the required fields from the updates table
+ $query->select('update_id, name, version')
+ ->from('#__updates')
+ ->order('name');
+
+ $db->setQuery($query);
+ $list = $db->loadObjectList();
+
+ if (!$list || $list instanceof Exception)
+ {
+ $list = array();
+ }
+
+ return $list;
+ }
+
+ /**
+ * Method that installs in Joomla! the selected languages in the Languages View of the installer
+ *
+ * @param array $lids list of the update_id value of the languages to install
+ *
+ * @return boolean True if successful
+ */
+ public function install($lids)
+ {
+
+ $app = JFactory::getApplication();
+ $installer = JInstaller::getInstance();
+
+ // Loop through every selected language
+ foreach ($lids as $id)
+ {
+
+ // Loads the update database object that represents the language
+ $language = JTable::getInstance('update');
+ $language->load($id);
+
+ // Get the url to the XML manifest file of the selected language
+ $remote_manifest = $this->_getLanguageManifest($id);
+ if (!$remote_manifest)
+ {
+
+ // Could not find the url, the information in the update server may be corrupt
+ $message = JText::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_LANGUAGE', $language->name);
+ $message .= ' ' . JText::_('INSTL_DEFAULTLANGUAGE_TRY_LATER');
+ $app->enqueueMessage($message);
+ continue;
+ }
+
+ // Based on the language XML manifest get the url of the package to download
+ $package_url = $this->_getPackageUrl($remote_manifest);
+ if (!$package_url)
+ {
+
+ // Could not find the url , maybe the url is wrong in the update server, or there is not internet access
+ $message = JText::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_LANGUAGE', $language->name);
+ $message .= ' ' . JText::_('INSTL_DEFAULTLANGUAGE_TRY_LATER');
+ $app->enqueueMessage($message);
+ continue;
+ }
+
+ // Download the package to the tmp folder
+ $package = $this->_downloadPackage($package_url);
+
+ // Install the package
+ if (!$installer->install($package['dir']))
+ {
+
+ // There was an error installing the package
+ $message = JText::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_LANGUAGE', $language->name);
+ $message .= ' ' . JText::_('INSTL_DEFAULTLANGUAGE_TRY_LATER');
+ $app->enqueueMessage($message);
+ continue;
+ }
+
+ // Cleanup the install files in tmp folder
+ if (!is_file($package['packagefile']))
+ {
+ $config = JFactory::getConfig();
+ $package['packagefile'] = $config->get('tmp_path') . '/' . $package['packagefile'];
+ }
+ JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);
+
+ // Delete the installed language from the list
+ $language->delete($id);
+ }
+ return true;
+
+ }
+
+ /**
+ * Gets the manifest file of a selected language from a the language list in a update server.
+ *
+ * @param int $uid the id of the language in the #__updates table
+ *
+ * @return string
+ */
+ protected function _getLanguageManifest($uid)
+ {
+ $instance = JTable::getInstance('update');
+ $instance->load($uid);
+ $detailurl = trim($instance->detailsurl);
+
+ return $detailurl;
+ }
+
+ /**
+ * Finds the url of the package to download.
+ *
+ * @param string $remote_manifest url to the manifest XML file of the remote package
+ *
+ * @return string|bool
+ */
+ protected function _getPackageUrl($remote_manifest)
+ {
+ $update = new JUpdate;
+ $update->loadFromXML($remote_manifest);
+ $package_url = trim($update->get('downloadurl', false)->_data);
+
+ return $package_url;
+ }
+
+ /**
+ * Download a language package from a URL and unpack it in the tmp folder.
+ *
+ * @param string $url url of the package
+ *
+ * @return array|bool Package details or false on failure
+ */
+ protected function _downloadPackage($url)
+ {
+
+ // Download the package from the given URL
+ $p_file = JInstallerHelper::downloadPackage($url);
+
+ // Was the package downloaded?
+ if (!$p_file)
+ {
+ JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_INVALID_URL'));
+ return false;
+ }
+
+ $config = JFactory::getConfig();
+ $tmp_dest = $config->get('tmp_path');
+
+ // Unpack the downloaded package file
+ $package = JInstallerHelper::unpack($tmp_dest . '/' . $p_file);
+
+ return $package;
+ }
+
+ /**
+ * Method to get Languages item data for the Administrator
+ *
+ * @return array
+ */
+ public function getInstalledlangsAdministrator()
+ {
+ return $this->getInstalledlangs('administrator');
+ }
+
+ /**
+ * Method to get Languages item data for the Frontend
+ *
+ * @return array
+ */
+ public function getInstalledlangsFrontend()
+ {
+ return $this->getInstalledlangs('site');
+ }
+
+ /**
+ * Method to get Languages item data
+ *
+ * @param string $cms_client name of the cms client
+ *
+ * @return array
+ */
+ private function getInstalledlangs($cms_client = 'administrator')
+ {
+
+ // Get information
+ $path = $this->_getPath();
+ $client = $this->_getClient($cms_client);
+ $langlist = $this->_getLanguageList($client->id);
+
+ // Compute all the languages
+ $data = array ();
+
+ foreach ($langlist as $lang)
+ {
+ $file = $path . '/' . $lang . '/' . $lang . '.xml';
+ $info = JApplicationHelper::parseXMLLangMetaFile($file);
+ $row = new stdClass;
+ $row->language = $lang;
+
+ if (!is_array($info)) {
+ continue;
+ }
+
+ foreach ($info as $key => $value)
+ {
+ $row->$key = $value;
+ }
+
+ // If current then set published
+ $params = JComponentHelper::getParams('com_languages');
+ if ($params->get($client->name, 'en-GB') == $row->language)
+ {
+ $row->published = 1;
+ }
+ else {
+ $row->published = 0;
+ }
+
+ $row->checked_out = 0;
+ $data[] = $row;
+ }
+
+ usort($data, array($this, '_compareLanguages'));
+
+ return $data;
+ }
+
+ /**
+ * Method to get installed languages data.
+ *
+ * @return string An SQL query
+ */
+ protected function _getLanguageList($client_id = 1)
+ {
+
+ // Create a new db object.
+ $db = $this->getDbo();
+ $query = $db->getQuery(true);
+
+ // Select field element from the extensions table.
+ $query->select('a.element, a.name');
+ $query->from('#__extensions AS a');
+
+ $query->where('a.type = ' . $db->quote('language'));
+ $query->where('state = 0');
+ $query->where('enabled = 1');
+ $query->where('client_id=' . (int) $client_id);
+
+ $db->setQuery($query);
+
+ $this->langlist = $db->loadColumn();
+
+ return $this->langlist;
+ }
+
+ /**
+ * Method to compare two languages in order to sort them
+ *
+ * @param object $lang1 the first language
+ * @param object $lang2 the second language
+ *
+ * @return integer
+ */
+ protected function _compareLanguages($lang1, $lang2)
+ {
+ return strcmp($lang1->name, $lang2->name);
+ }
+
+
+ /**
+ * Method to get the path
+ *
+ * @return string The path to the languages folders
+ */
+ protected function _getPath()
+ {
+ if (is_null($this->path))
+ {
+ $client = $this->_getClient();
+ $this->path = JLanguage::getLanguagePath($client->path);
+ }
+
+ return $this->path;
+ }
+
+ /**
+ * Method to get the client object of Administrator or FrontEnd
+ *
+ * @param string $client name of the client object
+ *
+ * @return object
+ */
+ protected function _getClient( $client = null )
+ {
+ if (null == $this->client)
+ {
+ $this->client = JApplicationHelper::getClientInfo('administrator', true);
+ }
+ if ($client)
+ {
+ $this->client = JApplicationHelper::getClientInfo($client, true);
+ }
+
+ return $this->client;
+ }
+
+ /**
+ * Method to set the default language.
+ *
+ * @param int $language_id The Id of the language to be set as default
+ * @param string $cms_client The name of the CMS client
+ *
+ * @return bool
+ */
+ public function setDefault($language_id = null, $cms_client = "administrator")
+ {
+ if (!$language_id)
+ {
+ return false;
+ }
+
+ $client = $this->_getClient($cms_client);
+
+ $params = JComponentHelper::getParams('com_languages');
+ $params->set($client->name, $language_id);
+
+ $table = JTable::getInstance('extension');
+ $id = $table->find(array('element' => 'com_languages'));
+
+ // Load
+ if (!$table->load($id))
+ {
+ $this->setError($table->getError());
+ return false;
+ }
+
+ $table->params = (string) $params;
+
+ // Pre-save checks
+ if (!$table->check())
+ {
+ $this->setError($table->getError());
+ return false;
+ }
+
+ // Save the changes
+ if (!$table->store())
+ {
+ $this->setError($table->getError());
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Get the current setup options from the session.
+ *
+ * @return array
+ */
+ public function getOptions()
+ {
+ $session = JFactory::getSession();
+ $options = $session->get('setup.options', array());
+
+ return $options;
+ }
+}
View
28 installation/template/js/installation.js
@@ -6,21 +6,21 @@
*/
var Installation = new Class({
- initialize: function(container, base) {
- this.busy = false;
- this.container = container;
- this.spinner = new Spinner(this.container);
- this.baseUrl = base;
- this.view = '';
+ initialize: function(container, base) {
+ this.busy = false;
+ this.container = container;
+ this.spinner = new Spinner(this.container);
+ this.baseUrl = base;
+ this.view = '';
- this.pageInit();
- },
+ this.pageInit();
+ },
- pageInit: function() {
- this.addToggler();
+ pageInit: function() {
+ this.addToggler();
// Attach the validator
$$('form.form-validate').each(function(form){ this.attachToForm(form); }, document.formvalidator);
- },
+ },
submitform: function() {
var form = document.id('adminForm');
@@ -265,6 +265,10 @@ var Installation = new Class({
*/
removeFolder: function(el) {
el = document.id(el);
+ if(document.getElementById("languages"))
+ {
+ document.id(languages).fade('out');
+ }
var req = new Request.JSON({
url: this.baseUrl + '?task=setup.removeFolder',
data: document.id(el.form),
@@ -318,7 +322,7 @@ var Installation = new Class({
alwaysHide:true,
show: 1
});
- },
+ },
toggle: function(id, el, value) {
var val = document.getElement('input[name=jform['+el+']]:checked').value;
View
13 installation/views/complete/tmpl/default.php
@@ -8,7 +8,8 @@
defined('_JEXEC') or die;
?>
-<form action="index.php" method="post" id="adminForm" class="form-validate form-horizontal">
+<form action="index.php" xmlns="http://www.w3.org/1999/html" method="post" id="adminForm"
+ class="form-validate form-horizontal">
<div class="alert alert-error inlineError" id="theDefaultError" style="display: none">
<h4 class="alert-heading"><?php echo JText::_('JERROR'); ?></h4>
<p id="theDefaultErrorMessage"></p>
@@ -43,7 +44,7 @@
</td>
</tr>
<tr>
- <td class="item">
+ <td class="notice">
<?php echo JText::_('JUSERNAME'); ?>
</td>
<td>
@@ -58,12 +59,12 @@
</tfoot>
</table>
</div>
- <div class="span6">
+ <div id="languages" class="span6">
<h3><?php echo JText::_('INSTL_COMPLETE_LANGUAGE_1'); ?></h3>
<hr class="hr-condensed" />
- <a href="http://community.joomla.org/translations/joomla-3-translations.html" target="_blank">
- <?php echo JText::_('INSTL_COMPLETE_LANGUAGE_2'); ?>
- </a>
+ <p><?php echo JText::_('INSTL_COMPLETE_LANGUAGE_DESC'); ?></p>
+ <p></p><a href="#" class="btn btn-primary" id="instLangs" onclick="return Install.goToPage('languages');"><i class="icon-arrow-right icon-white"></i> <?php echo JText::_('INSTL_COMPLETE_INSTALL_LANGUAGES'); ?></a></p>
+ <p><?php echo JText::_('INSTL_COMPLETE_LANGUAGE_DESC2'); ?></p>
</div>
</div>
View
1 installation/views/defaultlanguage/index.html
@@ -0,0 +1 @@
+<!DOCTYPE html><title></title>
View
118 installation/views/defaultlanguage/tmpl/default.php
@@ -0,0 +1,118 @@
+<?php
+/**
+ * @package Joomla.Installation
+ * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+defined('_JEXEC') or die;
+?>
+<?php echo JHtml::_('installation.stepbarlanguages'); ?>
+<form action="index.php" method="post" id="adminForm" class="form-validate form-horizontal">
+ <div class="btn-toolbar">
+ <div class="btn-group pull-right">
+ <a
+ class="btn"
+ href="#"
+ onclick="return Install.goToPage('languages');"
+ rel="prev"
+ title="<?php echo JText::_('JPREVIOUS'); ?>">
+ <i class="icon-arrow-left"></i>
+ <?php echo JText::_('JPREVIOUS'); ?>
+ </a>
+ <?php
+ // Check if ther is any languages to list, if not you cannot move forward
+ if ($this->items->administrator) :
+ ?>
+ <a
+ class="btn btn-primary"
+ href="#"
+ onclick="Install.submitform();"
+ rel="next"
+ title="<?php echo JText::_('JNEXT'); ?>">
+ <i class="icon-arrow-right icon-white"></i>
+ <?php echo JText::_('JNEXT'); ?>
+ </a>
+ <?php endif; ?>
+ </div>
+ </div>
+ <h3><?php echo JText::_('INSTL_DEFAULTLANGUAGE_ADMINISTRATOR'); ?></h3>
+ <hr class="hr-condensed" />
+ <p><?php echo JText::_('INSTL_DEFAULTLANGUAGE_DESC'); ?></p>
+ <table class="table table-striped table-condensed">
+ <tbody>
+ <tr>
+ <th>
+ <?php echo JText::_('INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_SELECT'); ?>
+ </th>
+ <th>
+ <?php echo JText::_('INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_LANGUAGE'); ?>
+ </th>
+ <th>
+ <?php echo JText::_('INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_TAG'); ?>
+ </th>
+ </tr>
+ </tbody>
+ <tbody>
+ <?php foreach ($this->items->administrator as $lang) : ?>
+ <tr>
+ <td>
+ <input
+ type="radio"
+ name="administratorlang"
+ value="<?php echo $lang->language; ?>"
+ <?php if ($lang->published) echo 'checked="checked"'; ?>
+ />
+ </td>
+ <td align="center">
+ <?php echo $lang->name; ?>
+ </td>
+ <td align="center">
+ <?php echo $lang->language; ?>
+ </td>
+ </tr>
+ <?php endforeach; ?>
+ </tbody>
+ </table>
+ <h3><?php echo JText::_('INSTL_DEFAULTLANGUAGE_FRONTEND'); ?></h3>
+ <hr class="hr-condensed" />
+ <p><?php echo JText::_('INSTL_DEFAULTLANGUAGE_DESC_FRONTEND'); ?></p>
+ <table class="table table-striped table-condensed">
+ <tbody>
+ <tr>
+ <th>
+ <?php echo JText::_('INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_SELECT'); ?>
+ </th>
+ <th>
+ <?php echo JText::_('INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_LANGUAGE'); ?>
+ </th>
+ <th>
+ <?php echo JText::_('INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_TAG'); ?>
+ </th>
+ </tr>
+ </tbody>
+ <tbody>
+ <?php foreach($this->items->frontend as $lang) : ?>
+ <tr>
+ <td>
+ <input
+ type="radio"
+ name="frontendlang"
+ value="<?php echo $lang->language; ?>"
+ <?php if ($lang->published) echo 'checked="checked"'; ?>
+ />
+ </td>
+ <td align="center">
+ <?php echo $lang->name; ?>
+ </td>
+ <td align="center">
+ <?php echo $lang->language; ?>
+ </td>
+ </tr>
+ <?php endforeach; ?>
+ </tbody>
+ </table>
+ <p><?php echo JText::_('INSTL_DEFAULTLANGUAGE_NOTE'); ?></p>
+ <input type="hidden" name="task" value="languages.setDefaultLanguage" />
+ <?php echo JHtml::_('form.token'); ?>
+</form>
View
1 installation/views/defaultlanguage/tmpl/index.html
@@ -0,0 +1 @@
+<!DOCTYPE html><title></title>
View
48 installation/views/defaultlanguage/view.html.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * @package Joomla.Installation
+ * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+defined('_JEXEC') or die;
+
+/**
+ * The HTML Joomla Core License View
+ *
+ * @package Joomla.Installation
+ * @since 3.0
+ */
+class InstallationViewDefaultlanguage extends JViewLegacy
+{
+ /**
+ * @var object item list of languages installed in the administrator
+ */
+ public $items;
+
+ /**
+ * Display the view
+ *
+ * @param string $tpl name of the template to be loaded.
+ *
+ * @return mixed A string if successful, otherwise a Error object.
+ */
+ public function display($tpl = null)
+ {
+ $items = new stdClass;
+ $items->administrator = $this->get('InstalledlangsAdministrator');
+ $items->frontend = $this->get('InstalledlangsFrontend');
+
+ // Check for errors.
+ if (count($errors = $this->get('Errors')))
+ {
+ $app = JFactory::getApplication();
+ $app->enqueueMessage(implode("\n", $errors), 'error');
+ return false;
+ }
+
+ $this->items = $items;
+
+ parent::display($tpl);
+ }
+}
View
1 installation/views/languages/index.html
@@ -0,0 +1 @@
+<!DOCTYPE html><title></title>
View
105 installation/views/languages/tmpl/default.php
@@ -0,0 +1,105 @@
+<?php
+/**
+ * @package Joomla.Installation
+ * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+defined('_JEXEC') or die;
+
+// Get version of Joomla! to compare it with the version of the language package
+$ver = new JVersion;
+?>
+<script type="text/javascript">
+ function installLanguages() {
+ document.id(install_languages_desc).hide();
+ document.id(wait_installing).show();
+ document.id(wait_installing_spinner).show();
+ Install.submitform();
+ }
+</script>
+
+<?php echo JHtml::_('installation.stepbarlanguages'); ?>
+<form action="index.php" method="post" id="adminForm" class="form-validate form-horizontal">
+ <div class="btn-toolbar">
+ <div class="btn-group pull-right">
+ <a
+ class="btn"
+ href="#"
+ onclick="return Install.goToPage('remove');"
+ rel="prev"
+ title="<?php echo JText::_('JPREVIOUS'); ?>">
+ <i class="icon-arrow-left"></i>
+ <?php echo JText::_('JPREVIOUS'); ?>
+ </a>
+ <a
+ class="btn btn-primary"
+ href="#"
+ onclick="installLanguages()"
+ rel="next"
+ title="<?php echo JText::_('JNEXT'); ?>">
+ <i class="icon-arrow-right icon-white"></i>
+ <?php echo JText::_('JNEXT'); ?>
+ </a>
+ </div>
+ </div>
+ <h3><?php echo JText::_('INSTL_LANGUAGES'); ?></h3>
+ <hr class="hr-condensed" />
+ <?php if(!$this->items) : ?>
+ <p><?php echo JText::_('INSTL_LANGUAGES_WARNING_NO_INTERNET') ?></p>
+ <p>
+ <a href="#"
+ class="btn btn-primary"
+ onclick="return Install.goToPage('remove');">
+ <i class="icon-arrow-left icon-white"></i>
+ <?php echo JText::_('INSTL_LANGUAGES_WARNING_BACK_BUTTON'); ?>
+ </a>
+ </p>
+ <p><?php echo JText::_('INSTL_LANGUAGES_WARNING_NO_INTERNET2') ?></p>
+ <?php else : ?>
+ <p id="install_languages_desc"><?php echo JText::_('INSTL_LANGUAGES_DESC'); ?></p>
+ <p id="wait_installing" style="display: none;">
+ <?php echo JText::_('INSTL_LANGUAGES_MESSAGE_PLEASE_WAIT') ?><br />
+ <div id="wait_installing_spinner" class="spinner spinner-img" style="display: none;"></div>
+ </p>
+
+ <table class="table table-striped table-condensed">
+ <thead>
+ <tr>
+ <th>
+ <?php echo JText::_('INSTL_LANGUAGES_COLUMN_HEADER_LANGUAGE'); ?>
+ </th>
+ <th>
+ <?php echo JText::_('INSTL_LANGUAGES_COLUMN_HEADER_VERSION'); ?>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach($this->items as $i => $language) : ?>
+ <?php
+ // Checks that the language package is valid for current Joomla version
+ if(substr($language->version, 0, 3) == $ver->RELEASE) :
+ ?>
+ <tr>
+ <td>
+ <label class="checkbox">
+ <input
+ type="checkbox"
+ id="cb<?php echo $i; ?>"
+ name="cid[]"
+ value="<?php echo $language->update_id; ?>"
+ /> <?php echo $language->name; ?>
+ </label>
+ </td>
+ <td>
+ <span class="badge"><?php echo $language->version; ?></span>
+ </td>
+ </tr>
+ <?php endif; ?>
+ <?php endforeach; ?>
+ </tbody>
+ </table>
+ <input type="hidden" name="task" value="languages.installLanguages" />
+ <?php echo JHtml::_('form.token'); ?>
+ <?php endif; ?>
+</form>
View
1 installation/views/languages/tmpl/index.html
@@ -0,0 +1 @@
+<!DOCTYPE html><title></title>
View
41 installation/views/languages/view.html.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * @package Joomla.Installation
+ * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+defined('_JEXEC') or die;
+
+/**
+ * The HTML Joomla Core License View
+ *
+ * @package Joomla.Installation
+ * @since 3.0
+ */
+class InstallationViewLanguages extends JViewLegacy
+{
+ /**
+ * Display the view
+ *
+ * @param string $tpl The name of the template file to parse; automatically searches through the template paths.
+ *
+ * @return mixed A string if successful, otherwise a Error object.
+ */
+ public function display($tpl = null)
+ {
+ $items = $this->get('Items');
+
+ // Check for errors.
+ if (count($errors = $this->get('Errors')))
+ {
+ $app = JFactory::getApplication();
+ $app->enqueueMessage(implode("\n", $errors), 'error');
+ return false;
+ }
+
+ $this->items = $items;
+
+ parent::display($tpl);
+ }
+}

0 comments on commit e2ffca9

Please sign in to comment.
Something went wrong with that request. Please try again.