first commit

This commit is contained in:
alazhar
2020-01-02 22:20:31 +07:00
commit 10eb3340ad
5753 changed files with 631345 additions and 0 deletions

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<access component="com_languages">
<section name="component">
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" />
</section>
</access>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset
name="permissions"
label="JConfig_Permissions_Label"
description="JConfig_Permissions_Desc"
>
<field
name="rules"
type="rules"
label="JConfig_Permissions_Label"
filter="rules"
validate="rules"
component="com_languages"
section="component" />
<field
type="hidden"
name="site"
/>
<field
type="hidden"
name="administrator"
/>
</fieldset>
</config>

View File

@ -0,0 +1,59 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Languages Controller
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 1.5
*/
class LanguagesController extends JControllerLegacy
{
/**
* @var string The default view.
* @since 1.6
*/
protected $default_view = 'installed';
/**
* Method to display a view.
*
* @param boolean If true, the view output will be cached
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT.'/helpers/languages.php';
$view = $this->input->get('view', 'languages');
$layout = $this->input->get('layout', 'default');
$id = $this->input->getInt('id');
// Check for edit form.
if ($view == 'language' && $layout == 'edit' && !$this->checkEditId('com_languages.edit.language', $id)) {
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_languages&view=languages', false));
return false;
}
parent::display();
return $this;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,45 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Languages Controller
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 1.5
*/
class LanguagesControllerInstalled extends JControllerLegacy
{
/**
* task to set the default language
*/
public function setDefault()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JInvalid_Token'));
$cid = $this->input->get('cid', '');
$model = $this->getModel('installed');
if ($model->publish($cid))
{
$msg = JText::_('COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED');
$type = 'message';
}
else
{
$msg = $this->getError();
$type = 'error';
}
$clientId = $model->getState('filter.client_id');
$this->setredirect('index.php?option=com_languages&view=installed&client='.$clientId, $msg, $type);
}
}

View File

@ -0,0 +1,35 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Languages list actions controller.
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 1.6
*/
class LanguagesControllerLanguage extends JControllerForm
{
/**
* Gets the URL arguments to append to an item redirect.
*
* @param int $recordId The primary key id for the item.
* @param string $key The name of the primary key variable.
*
* @return string The arguments to append to the redirect URL.
*
* @since 1.6
*/
protected function getRedirectToItemAppend($recordId = null, $key = 'lang_id')
{
return parent::getRedirectToItemAppend($recordId, $key);
}
}

View File

@ -0,0 +1,35 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* @package Joomla.Administrator
* @subpackage com_languages
* @since 1.6
*/
class LanguagesControllerLanguages extends JControllerAdmin
{
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return object The model.
*
* @since 1.6
*/
public function getModel($name = 'Language', $prefix = 'LanguagesModel', $config = array('ignore_request' => true))
{
$model = parent::getModel($name, $prefix, $config);
return $model;
}
}

View File

@ -0,0 +1,196 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Languages Override Controller
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 2.5
*/
class LanguagesControllerOverride extends JControllerForm
{
/**
* Method to edit an existing override
*
* @param string $key The name of the primary key of the URL variable (not used here).
* @param string $urlVar The name of the URL variable if different from the primary key (not used here).
*
* @return void
*
* @since 2.5
*/
public function edit($key = null, $urlVar = null)
{
$app = JFactory::getApplication();
$cid = $this->input->post->get('cid', array(), 'array');
$context = "$this->option.edit.$this->context";
// Get the constant name
$recordId = (count($cid) ? $cid[0] : $this->input->get('id'));
// Access check
if (!$this->allowEdit())
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED'));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list.$this->getRedirectToListAppend(), false));
return;
}
$app->setUserState($context.'.data', null);
$this->setRedirect('index.php?option='.$this->option.'&view='.$this->view_item.$this->getRedirectToItemAppend($recordId, 'id'));
}
/**
* Method to save an override
*
* @param string $key The name of the primary key of the URL variable (not used here).
* @param string $urlVar The name of the URL variable if different from the primary key (not used here).
*
* @return void
*
* @since 2.5
*/
public function save($key = null, $urlVar = null)
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$app = JFactory::getApplication();
$model = $this->getModel();
$data = $this->input->post->get('jform', array(), 'array');
$context = "$this->option.edit.$this->context";
$task = $this->getTask();
$recordId = $this->input->get('id');
$data['id'] = $recordId;
// Access check
if (!$this->allowSave($data, 'id'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list.$this->getRedirectToListAppend(), false));
return;
}
// Validate the posted data
$form = $model->getForm($data, false);
if (!$form)
{
$app->enqueueMessage($model->getError(), 'error');
return;
}
// Require helper for filter functions called by JForm
require_once JPATH_COMPONENT.'/helpers/languages.php';
// Test whether the data is valid.
$validData = $model->validate($form, $data);
// Check for validation errors.
if ($validData === 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');
}
}
// Save the data in the session
$app->setUserState($context.'.data', $data);
// Redirect back to the edit screen
$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_item.$this->getRedirectToItemAppend($recordId, 'id'), false));
return;
}
// Attempt to save the data
if (!$model->save($validData))
{
// Save the data in the session
$app->setUserState($context.'.data', $validData);
// Redirect back to the edit screen
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_item.$this->getRedirectToItemAppend($recordId, 'id'), false));
return;
}
// Add message of success
$this->setMessage(JText::_('COM_LANGUAGES_VIEW_OVERRIDE_SAVE_SUCCESS'));
// Redirect the user and adjust session state based on the chosen task
switch ($task)
{
case 'apply':
// Set the record data in the session
$app->setUserState($context.'.data', null);
// Redirect back to the edit screen
$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_item.$this->getRedirectToItemAppend($validData['key'], 'id'), false));
break;
case 'save2new':
// Clear the record id and data from the session
$app->setUserState($context.'.data', null);
// Redirect back to the edit screen
$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_item.$this->getRedirectToItemAppend(null, 'id'), false));
break;
default:
// Clear the record id and data from the session
$app->setUserState($context.'.data', null);
// Redirect to the list screen
$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list.$this->getRedirectToListAppend(), false));
break;
}
}
/**
* Method to cancel an edit
*
* @param string $key The name of the primary key of the URL variable (not used here).
*
* @return void
*
* @since 2.5
*/
public function cancel($key = null, $test = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$app = JFactory::getApplication();
$context = "$this->option.edit.$this->context";
$app->setUserState($context.'.data', null);
$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list.$this->getRedirectToListAppend(), false));
}
}

View File

@ -0,0 +1,66 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Languages Overrides Controller
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 2.5
*/
class LanguagesControllerOverrides extends JControllerAdmin
{
/**
* The prefix to use with controller messages
*
* @var string
* @since 2.5
*/
protected $text_prefix = 'COM_LANGUAGES_VIEW_OVERRIDES';
/**
* Method for deleting one or more overrides
*
* @return void
*
* @since 2.5
*/
public function delete()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// Get items to dlete from the request
$cid = $this->input->get('cid', array(), 'array');
if (!is_array($cid) || count($cid) < 1)
{
$this->setMessage(JText::_($this->text_prefix.'_NO_ITEM_SELECTED'), 'warning');
}
else
{
// Get the model
$model = $this->getModel('overrides');
// Remove the items
if ($model->delete($cid))
{
$this->setMessage(JText::plural($this->text_prefix.'_N_ITEMS_DELETED', count($cid)));
}
else
{
$this->setMessage($model->getError());
}
}
$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list, false));
}
}

View File

@ -0,0 +1,44 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Languages Strings JSON Controller
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 2.5
*/
class LanguagesControllerStrings extends JControllerAdmin
{
/**
* Method for refreshing the cache in the database with the known language strings
*
* @return void
*
* @since 2.5
*/
public function refresh()
{
echo new JResponseJson($this->getModel('strings')->refresh());
}
/**
* Method for searching language strings
*
* @return void
*
* @since 2.5
*/
public function search()
{
echo new JResponseJson($this->getModel('strings')->search());
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,79 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Utility class working with languages
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 1.6
*/
abstract class JHtmlLanguages
{
/**
* Method to generate an information about the default language
*
* @param boolean $published is the language the default?
*
* @return string html code
*/
public static function published($published)
{
if ($published)
{
return JHtml::_('image', 'menu/icon-16-default.png', JText::_('COM_LANGUAGES_HEADING_DEFAULT'), null, true);
}
else
{
return '&#160;';
}
}
/**
* Method to generate an input radio button
*
* @param integer $rowNum the row number
* @param string language tag
*
* @return string html code
*/
public static function id($rowNum, $language)
{
return '<input type="radio" id="cb' . $rowNum . '" name="cid" value="' . htmlspecialchars($language) . '" onclick="Joomla.isChecked(this.checked);" title="' . ($rowNum + 1) . '"/>';
}
public static function clients()
{
return array(
JHtml::_('select.option', 0, JText::_('JSITE')),
JHtml::_('select.option', 1, JText::_('JADMINISTRATOR'))
);
}
/**
* Returns an array of published state filter options.
*
* @return string The HTML code for the select tag
* @since 1.6
*/
public static function publishedOptions()
{
// Build the active state filter options.
$options = array();
$options[] = JHtml::_('select.option', '1', 'JPUBLISHED');
$options[] = JHtml::_('select.option', '0', 'JUNPUBLISHED');
$options[] = JHtml::_('select.option', '-2', 'JTRASHED');
$options[] = JHtml::_('select.option', '*', 'JALL');
return $options;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,129 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* JSON Response class
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 2.5
* @deprecated 4.0
*/
class JJsonResponse
{
/**
* Determines whether the request was successful
*
* @var boolean
* @since 2.5
*/
public $success = true;
/**
* Determines whether the request wasn't successful.
* This is always the negation of $this->success,
* so you can use both flags equivalently.
*
* @var boolean
* @since 2.5
*/
public $error = false;
/**
* The main response message
*
* @var string
* @since 2.5
*/
public $message = null;
/**
* Array of messages gathered in the JApplication object
*
* @var array
* @since 2.5
*/
public $messages = null;
/**
* The response data
*
* @var mixed
* @since 2.5
*/
public $data = null;
/**
* Constructor
*
* @param mixed $response The Response data
* @param string $message The main response message
* @param boolean $error True, if the success flag shall be set to false, defaults to false
*
* @since 2.5
* @deprecated 4.0 Use JResponseJson instead
*/
public function __construct($response = null, $message = null, $error = false)
{
JLog::add('Class JJsonResponse is deprecated. Use class JResponseJson instead.', JLog::WARNING, 'deprecated');
$this->message = $message;
// Get the message queue
$messages = JFactory::getApplication()->getMessageQueue();
// Build the sorted messages list
if (is_array($messages) && count($messages))
{
foreach ($messages as $message)
{
if (isset($message['type']) && isset($message['message']))
{
$lists[$message['type']][] = $message['message'];
}
}
}
// If messages exist add them to the output
if (isset($lists) && is_array($lists))
{
$this->messages = $lists;
}
// Check if we are dealing with an error
if ($response instanceof Exception)
{
// Prepare the error response
$this->success = false;
$this->error = true;
$this->message = $response->getMessage();
}
else
{
// Prepare the response data
$this->success = !$error;
$this->error = $error;
$this->data = $response;
}
}
/**
* Magic toString method for sending the response in JSON format
*
* @return string The response in JSON format
*
* @since 2.5
*/
public function __toString()
{
return json_encode($this);
}
}

View File

@ -0,0 +1,135 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Languages component helper.
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 1.6
*/
class LanguagesHelper
{
/**
* Configure the Linkbar.
*
* @param string $vName The name of the active view.
* @param int $client The client id of the active view. Maybe be 0 or 1
*
* @return void
*/
public static function addSubmenu($vName, $client = 0)
{
JHtmlSidebar::addEntry(
JText::_('COM_LANGUAGES_SUBMENU_INSTALLED_SITE'),
'index.php?option=com_languages&view=installed&client=0',
$vName == 'installed' && $client === 0
);
JHtmlSidebar::addEntry(
JText::_('COM_LANGUAGES_SUBMENU_INSTALLED_ADMINISTRATOR'),
'index.php?option=com_languages&view=installed&client=1',
$vName == 'installed' && $client === 1
);
JHtmlSidebar::addEntry(
JText::_('COM_LANGUAGES_SUBMENU_CONTENT'),
'index.php?option=com_languages&view=languages',
$vName == 'languages'
);
JHtmlSidebar::addEntry(
JText::_('COM_LANGUAGES_SUBMENU_OVERRIDES'),
'index.php?option=com_languages&view=overrides',
$vName == 'overrides'
);
}
/**
* Gets a list of the actions that can be performed.
*
* @return JObject
*/
public static function getActions()
{
$user = JFactory::getUser();
$result = new JObject;
$assetName = 'com_languages';
$actions = JAccess::getActions($assetName);
foreach ($actions as $action)
{
$result->set($action->name, $user->authorise($action->name, $assetName));
}
return $result;
}
/**
* Method for parsing ini files
*
* @param string $filename Path and name of the ini file to parse
*
* @return array Array of strings found in the file, the array indices will be the keys. On failure an empty array will be returned
*
* @since 2.5
*/
public static function parseFile($filename)
{
if (!is_file($filename))
{
return array();
}
$contents = file_get_contents($filename);
$contents = str_replace('_QQ_', '"\""', $contents);
$strings = @parse_ini_string($contents);
if ($strings === false)
{
return array();
}
return $strings;
}
/**
* Filter method for language keys.
* This method will be called by JForm while filtering the form data.
*
* @param string $value The language key to filter
*
* @return string The filtered language key
*
* @since 2.5
*/
public static function filterKey($value)
{
$filter = JFilterInput::getInstance(null, null, 1, 1);
return strtoupper($filter->clean($value, 'cmd'));
}
/**
* Filter method for language strings.
* This method will be called by JForm while filtering the form data.
*
* @param string $value The language string to filter
*
* @return string The filtered language string
*
* @since 2.5
*/
public static function filterText($value)
{
$filter = JFilterInput::getInstance(null, null, 1, 1);
return $filter->clean($value);
}
}

View File

@ -0,0 +1,133 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Multilang status helper.
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 1.7.1
*/
abstract class MultilangstatusHelper
{
public static function getHomes()
{
// Check for multiple Home pages
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('COUNT(*)')
->from($db->quoteName('#__menu'))
->where('home = 1')
->where('published = 1')
->where('client_id = 0');
$db->setQuery($query);
return $db->loadResult();
}
public static function getLangswitchers()
{
// Check if switcher is published
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('COUNT(*)')
->from($db->quoteName('#__modules'))
->where('module = ' . $db->quote('mod_languages'))
->where('published = 1')
->where('client_id = 0');
$db->setQuery($query);
return $db->loadResult();
}
public static function getContentlangs()
{
// Check for published Content Languages
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('a.lang_code AS lang_code')
->select('a.published AS published')
->from('#__languages AS a');
$db->setQuery($query);
return $db->loadObjectList();
}
public static function getSitelangs()
{
// check for published Site Languages
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('a.element AS element')
->from('#__extensions AS a')
->where('a.type = ' . $db->quote('language'))
->where('a.client_id = 0')
->where('a.enabled = 1');
$db->setQuery($query);
return $db->loadObjectList('element');
}
public static function getHomepages()
{
// Check for Home pages languages
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('language')
->from($db->quoteName('#__menu'))
->where('home = 1')
->where('published = 1')
->where('client_id = 0');
$db->setQuery($query);
return $db->loadObjectList('language');
}
public static function getStatus()
{
//check for combined status
$db = JFactory::getDbo();
$query = $db->getQuery(true);
// Select all fields from the languages table.
$query->select('a.*', 'l.home')
->select('a.published AS published')
->select('a.lang_code AS lang_code')
->from('#__languages AS a');
// Select the language home pages
$query->select('l.home AS home')
->select('l.language AS home_language')
->join('LEFT', '#__menu AS l ON l.language = a.lang_code AND l.home=1 AND l.published=1 AND l.language <> \'*\'')
->select('e.enabled AS enabled')
->select('e.element AS element')
->join('LEFT', '#__extensions AS e ON e.element = a.lang_code')
->where('e.client_id = 0')
->where('e.enabled = 1')
->where('e.state = 0');
$db->setQuery($query);
return $db->loadObjectList();
}
public static function getContacts()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('u.name, count(cd.language) as counted, MAX(cd.language=' . $db->quote('*') . ') as all_languages')
->from('#__users AS u')
->join('LEFT', '#__contact_details AS cd ON cd.user_id=u.id')
->join('LEFT', '#__languages as l on cd.language=l.lang_code')
->where('EXISTS (SELECT * from #__content as c where c.created_by=u.id)')
->where('(l.published=1 or cd.language=' . $db->quote('*') . ')')
->where('cd.published=1')
->group('u.id')
->having('(counted !=' . count(JLanguageHelper::getLanguages()) . ' OR all_languages=1)')
->having('(counted !=1 OR all_languages=0)');
$db->setQuery($query);
return $db->loadObjectList();
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,19 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
if (!JFactory::getUser()->authorise('core.manage', 'com_languages'))
{
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
$controller = JControllerLegacy::getInstance('Languages');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.1" method="upgrade">
<name>com_languages</name>
<author>Joomla! Project</author>
<creationDate>2006</creationDate>
<copyright>(C) 2005 - 2013 Open Source Matters. All rights reserved.
</copyright>
<license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>COM_LANGUAGES_XML_DESCRIPTION</description>
<administration>
<files folder="admin">
<filename>config.xml</filename>
<filename>controller.php</filename>
<filename>index.html</filename>
<filename>languages.php</filename>
<folder>controllers</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>tables</folder>
<folder>views</folder>
</files>
<languages folder="admin">
<language tag="en-GB">language/en-GB.com_languages.ini</language>
<language tag="en-GB">language/en-GB.com_languages.sys.ini</language>
</languages>
</administration>
</extension>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset>
<field name="lang_id" type="text"
class="readonly"
description="JGLOBAL_FIELD_ID_DESC"
label="JGLOBAL_FIELD_ID_LABEL"
default="0"
readonly="true"
/>
<field name="lang_code" type="text"
class="inputbox"
description="COM_LANGUAGES_FIELD_LANG_TAG_DESC"
label="COM_LANGUAGES_FIELD_LANG_TAG_LABEL"
maxlength="7"
required="true"
size="10"
/>
<field name="title" type="text"
class="inputbox"
description="COM_LANGUAGES_FIELD_TITLE_DESC"
label="JGLOBAL_TITLE"
maxlength="50"
required="true"
size="40"
/>
<field name="title_native" type="text"
class="inputbox"
description="COM_LANGUAGES_FIELD_TITLE_NATIVE_DESC"
label="COM_LANGUAGES_FIELD_TITLE_NATIVE_LABEL"
maxlength="50"
required="true"
size="40"
/>
<field name="sef" type="text"
class="inputbox"
description="COM_LANGUAGES_FIELD_LANG_CODE_DESC"
label="COM_LANGUAGES_FIELD_LANG_CODE_LABEL"
maxlength="7"
required="true"
size="10"
/>
<field name="image" type="filelist"
class="inputbox"
description="COM_LANGUAGES_FIELD_IMAGE_DESC"
label="COM_LANGUAGES_FIELD_IMAGE_LABEL"
stripext="1"
directory="media/mod_languages/images/"
hide_none="1"
hide_default="1"
required="true"
filter="\.gif$"
size="10"
/>
<field name="description" type="textarea"
class="inputbox"
cols="80"
description="COM_LANGUAGES_FIELD_DESCRIPTION_DESC"
label="JGLOBAL_DESCRIPTION"
rows="5"
/>
<field name="published" type="list"
class="inputbox"
default="1"
description="COM_LANGUAGES_FIELD_PUBLISHED_DESC"
label="JSTATUS"
size="1"
>
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
<option value="-2">JTRASHED</option>
</field>
<field name="access" type="accesslevel"
class="inputbox"
size="1"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
/>
</fieldset>
<fieldset name="metadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS">
<field name="metakey" type="textarea"
class="inputbox"
description="JFIELD_META_KEYWORDS_DESC"
label="JFIELD_META_KEYWORDS_LABEL"
rows="3"
cols="30"
/>
<field name="metadesc" type="textarea"
class="inputbox"
description="JFIELD_META_DESCRIPTION_DESC"
label="JFIELD_META_DESCRIPTION_LABEL"
rows="3"
cols="30"
/>
</fieldset>
<fieldset name="site_name" label="COM_LANGUAGES_FIELDSET_SITE_NAME_LABEL">
<field name="sitename" type="text"
description="COM_LANGUAGES_FIELD_SITE_NAME_DESC"
label="COM_LANGUAGES_FIELD_SITE_NAME_LABEL"
filter="string"
size="50"
/>
</fieldset>
</form>

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset>
<field
name="key"
type="text"
class="inputbox"
label="COM_LANGUAGES_OVERRIDE_FIELD_KEY_LABEL"
description="COM_LANGUAGES_OVERRIDE_FIELD_KEY_DESC"
size="60"
required="true"
filter="LanguagesHelper::filterKey" />
<field
name="override"
type="textarea"
class="inputbox"
label="COM_LANGUAGES_OVERRIDE_FIELD_OVERRIDE_LABEL"
description="COM_LANGUAGES_OVERRIDE_FIELD_OVERRIDE_DESC"
cols="50"
rows="5"
filter="LanguagesHelper::filterText" />
<field
name="both"
type="checkbox"
class="inputbox"
label="COM_LANGUAGES_OVERRIDE_FIELD_BOTH_LABEL"
description="COM_LANGUAGES_OVERRIDE_FIELD_BOTH_DESC"
value="true"
filter="boolean" />
<field
name="searchstring"
type="text"
class="inputbox"
label="COM_LANGUAGES_OVERRIDE_FIELD_SEARCHSTRING_LABEL"
description="COM_LANGUAGES_OVERRIDE_FIELD_SEARCHSTRING_DESC"
size="50" />
<field
name="searchtype"
type="radio"
class="btn-group"
label="COM_LANGUAGES_OVERRIDE_FIELD_SEARCHTYPE_LABEL"
description="COM_LANGUAGES_OVERRIDE_FIELD_SEARCHTYPE_DESC"
default="value">
<option value="constant">COM_LANGUAGES_OVERRIDE_FIELD_SEARCHTYPE_CONSTANT</option>
<option value="value">COM_LANGUAGES_OVERRIDE_FIELD_SEARCHTYPE_TEXT</option>
</field>
<field name="language" type="text"
label="COM_LANGUAGES_OVERRIDE_FIELD_LANGUAGE_LABEL"
description="COM_LANGUAGES_OVERRIDE_FIELD_LANGUAGE_DESC"
filter="unset"
readonly="true"
class="readonly"
size="50"
/>
<field name="client" type="text"
label="COM_LANGUAGES_OVERRIDE_FIELD_CLIENT_LABEL"
description="COM_LANGUAGES_OVERRIDE_FIELD_CLIENT_DESC"
filter="unset"
readonly="true"
class="readonly"
size="50"
/>
<field name="file" type="text"
label="COM_LANGUAGES_OVERRIDE_FIELD_FILE_LABEL"
description="COM_LANGUAGES_OVERRIDE_FIELD_FILE_DESC"
filter="unset"
readonly="true"
class="readonly"
size="80"
/>
<field
name="id"
type="hidden" />
</fieldset>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,384 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Languages Component Languages Model
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 1.6
*/
class LanguagesModelInstalled extends JModelList
{
/**
* @var object client object
*/
protected $client = null;
/**
* @var object user object
*/
protected $user = null;
/**
* @var boolean|JExeption True, if FTP settings should be shown, or an exeption
*/
protected $ftp = null;
/**
* @var string option name
*/
protected $option = null;
/**
* @var array languages description
*/
protected $data = null;
/**
* @var int total number pf languages
*/
protected $total = null;
/**
* @var int total number pf languages installed
*/
protected $langlist = null;
/**
* @var string language path
*/
protected $path = null;
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
* @since 1.6
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication('administrator');
// Load the filter state.
$clientId = $app->input->getInt('client');
$this->setState('filter.client_id', $clientId);
// Load the parameters.
$params = JComponentHelper::getParams('com_languages');
$this->setState('params', $params);
// List state information.
parent::populateState('a.name', 'asc');
}
/**
* Method to get a store id based on model configuration state.
*
* This is necessary because the model is used by the component and
* different modules that might need different sets of data or different
* ordering requirements.
*
* @param string $id A prefix for the store id.
*
* @return string A store id.
* @since 1.6
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':'.$this->getState('filter.client_id');
return parent::getStoreId($id);
}
/**
* Method to get the client object
*
* @return object
* @since 1.6
*/
public function &getClient()
{
if (is_null($this->client))
{
$this->client = JApplicationHelper::getClientInfo($this->getState('filter.client_id', 0));
}
return $this->client;
}
/**
* Method to get the ftp credentials
*
* @return object
* @since 1.6
*/
public function &getFtp()
{
if (is_null($this->ftp))
{
$this->ftp = JClientHelper::setCredentialsFromRequest('ftp');
}
return $this->ftp;
}
/**
* Method to get the option
*
* @return object
* @since 1.6
*/
public function &getOption()
{
$option = $this->getState('option');
return $option;
}
/**
* Method to get Languages item data
*
* @return array
* @since 1.6
*/
public function &getData()
{
if (is_null($this->data)) {
// Get information
$path = $this->getPath();
$client = $this->getClient();
$langlist = $this->getLanguageList();
// Compute all the languages
$data = array ();
foreach ($langlist as $lang) {
$file = $path . '/' . $lang . '/' . $lang.'.xml';
$info = JApplicationHelper::parseXMLLangMetaFile($file);
$row = new JObject;
$row->language = $lang;
if (!is_array($info))
{
continue;
}
foreach ($info as $key => $value)
{
$row->$key = $value;
}
// if current than 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'));
// Prepare data
$limit = $this->getState('list.limit');
$start = $this->getState('list.start');
$total = $this->getTotal();
if ($limit == 0)
{
$start = 0;
$end = $total;
}
else {
if ($start > $total)
{
$start = $total - $total % $limit;
}
$end = $start + $limit;
if ($end > $total)
{
$end = $total;
}
}
// Compute the displayed languages
$this->data = array();
for ($i = $start;$i < $end;$i++)
{
$this->data[] = & $data[$i];
}
}
return $this->data;
}
/**
* Method to get installed languages data.
*
* @return string An SQL query
* @since 1.6
*/
protected function getLanguageList()
{
// Create a new db object.
$db = $this->getDbo();
$query = $db->getQuery(true);
$client = $this->getState('filter.client_id');
$type = "language";
// Select field element from the extensions table.
$query->select($this->getState('list.select', 'a.element'))
->from('#__extensions AS a');
$type = $db->quote($type);
$query->where('(a.type = '.$type.')')
->where('state = 0')
->where('enabled = 1')
->where('client_id=' . (int) $client);
// for client_id = 1 do we need to check language table also ?
$db->setQuery($query);
$this->langlist = $db->loadColumn();
return $this->langlist;
}
/**
* Method to get the total number of Languages items
*
* @return integer
* @since 1.6
*/
public function getTotal()
{
if (is_null($this->total))
{
$langlist = $this->getLanguageList();
$this->total = count($langlist);
}
return $this->total;
}
/**
* Method to set the default language
*
* @return boolean
* @since 1.6
*/
public function publish($cid)
{
if ($cid)
{
$client = $this->getClient();
$params = JComponentHelper::getParams('com_languages');
$params->set($client->name, $cid);
$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;
}
}
else
{
$this->setError(JText::_('COM_LANGUAGES_ERR_NO_LANGUAGE_SELECTED'));
return false;
}
// Clean the cache of com_languages and component cache.
$this->cleanCache();
$this->cleanCache('_system');
return true;
}
/**
* Method to get the folders
*
* @return array Languages folders
* @since 1.6
*/
protected function getFolders()
{
if (is_null($this->folders))
{
$path = $this->getPath();
jimport('joomla.filesystem.folder');
$this->folders = JFolder::folders($path, '.', false, false, array('.svn', 'CVS', '.DS_Store', '__MACOSX', 'pdf_fonts', 'overrides'));
}
return $this->folders;
}
/**
* Method to get the path
*
* @return string The path to the languages folders
* @since 1.6
*/
protected function getPath()
{
if (is_null($this->path))
{
$client = $this->getClient();
$this->path = JLanguage::getLanguagePath($client->path);
}
return $this->path;
}
/**
* Method to compare two languages in order to sort them
*
* @param object $lang1 the first language
* @param object $lang2 the second language
*
* @return integer
* @since 1.6
*/
protected function compareLanguages($lang1, $lang2)
{
return strcmp($lang1->name, $lang2->name);
}
}

View File

@ -0,0 +1,204 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Languages Component Language Model
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 1.5
*/
class LanguagesModelLanguage extends JModelAdmin
{
/**
* Override to get the table
*
* @return JTable
* @since 1.6
*/
public function getTable($name = '', $prefix = '', $options = array())
{
return JTable::getInstance('Language');
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
* @since 1.6
*/
protected function populateState()
{
$app = JFactory::getApplication('administrator');
$params = JComponentHelper::getParams('com_languages');
// Load the User state.
$langId = $app->input->getInt('lang_id');
$this->setState('language.id', $langId);
// Load the parameters.
$this->setState('params', $params);
}
/**
* Method to get a member item.
*
* @param integer The id of the member to get.
*
* @return mixed User data object on success, false on failure.
* @since 1.0
*/
public function getItem($langId = null)
{
$langId = (!empty($langId)) ? $langId : (int) $this->getState('language.id');
$false = false;
// Get a member row instance.
$table = $this->getTable();
// Attempt to load the row.
$return = $table->load($langId);
// Check for a table object error.
if ($return === false && $table->getError())
{
$this->setError($table->getError());
return $false;
}
$properties = $table->getProperties(1);
$value = JArrayHelper::toObject($properties, 'JObject');
return $value;
}
/**
* Method to get the group form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
*
* @return mixed A JForm object on success, false on failure
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_languages.language', 'language', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
{
return false;
}
return $form;
}
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
* @since 1.6
*/
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState('com_languages.edit.language.data', array());
if (empty($data))
{
$data = $this->getItem();
}
$this->preprocessData('com_languages.language', $data);
return $data;
}
/**
* Method to save the form data.
*
* @param array The form data.
*
* @return boolean True on success.
* @since 1.6
*/
public function save($data)
{
$langId = (int) $this->getState('language.id');
$isNew = true;
$dispatcher = JEventDispatcher::getInstance();
JPluginHelper::importPlugin('extension');
$table = $this->getTable();
// Load the row if saving an existing item.
if ($langId > 0)
{
$table->load($langId);
$isNew = false;
}
// Bind the data
if (!$table->bind($data))
{
$this->setError($table->getError());
return false;
}
// Check the data
if (!$table->check())
{
$this->setError($table->getError());
return false;
}
// Trigger the onExtensionBeforeSave event.
$result = $dispatcher->trigger('onExtensionBeforeSave', array('com_languages.language', &$table, $isNew));
// Check the event responses.
if (in_array(false, $result, true))
{
$this->setError($table->getError());
return false;
}
// Store the data
if (!$table->store())
{
$this->setError($table->getError());
return false;
}
// Trigger the onExtensionAfterSave event.
$dispatcher->trigger('onExtensionAfterSave', array('com_languages.language', &$table, $isNew));
$this->setState('language.id', $table->lang_id);
// Clean the cache.
$this->cleanCache();
return true;
}
/**
* Custom clean cache method
*
* @since 1.6
*/
protected function cleanCache($group = null, $client_id = 0)
{
parent::cleanCache('_system');
parent::cleanCache('com_languages');
}
}

View File

@ -0,0 +1,215 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Languages Model Class
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 1.6
*/
class LanguagesModelLanguages extends JModelList
{
/**
* Constructor.
*
* @param array An optional associative array of configuration settings.
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'lang_id', 'a.lang_id',
'lang_code', 'a.lang_code',
'title', 'a.title',
'title_native', 'a.title_native',
'sef', 'a.sef',
'image', 'a.image',
'published', 'a.published',
'ordering', 'a.ordering',
'access', 'a.access', 'access_level',
'home', 'l.home',
);
}
parent::__construct($config);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*
* @since 1.6
*/
protected function populateState($ordering = null, $direction = null)
{
// Load the filter state.
$search = $this->getUserStateFromRequest($this->context . '.search', 'filter_search');
$this->setState('filter.search', $search);
$accessId = $this->getUserStateFromRequest($this->context . '.access', 'filter_access', null, 'int');
$this->setState('filter.access', $accessId);
$published = $this->getUserStateFromRequest($this->context . '.published', 'filter_published', '');
$this->setState('filter.published', $published);
// Load the parameters.
$params = JComponentHelper::getParams('com_languages');
$this->setState('params', $params);
// List state information.
parent::populateState('a.title', 'asc');
}
/**
* Method to get a store id based on model configuration state.
*
* This is necessary because the model is used by the component and
* different modules that might need different sets of data or different
* ordering requirements.
*
* @param string $id A prefix for the store id.
*
* @return string A store id.
* @since 1.6
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.access');
$id .= ':' . $this->getState('filter.published');
return parent::getStoreId($id);
}
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
* @since 1.6
*/
protected function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select all fields from the languages table.
$query->select($this->getState('list.select', 'a.*', 'l.home'))
->from($db->quoteName('#__languages') . ' AS a');
// Join over the asset groups.
$query->select('ag.title AS access_level')
->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Select the language home pages
$query->select('l.home AS home')
->join('LEFT', $db->quoteName('#__menu') . ' AS l ON l.language = a.lang_code AND l.home=1 AND l.language <> ' . $db->quote('*'));
// Filter on the published state.
$published = $this->getState('filter.published');
if (is_numeric($published))
{
$query->where('a.published = ' . (int) $published);
}
elseif ($published === '')
{
$query->where('(a.published IN (0, 1))');
}
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search))
{
$search = $db->quote('%' . $db->escape($search, true) . '%', false);
$query->where('(a.title LIKE ' . $search . ')');
}
// Filter by access level.
if ($access = $this->getState('filter.access'))
{
$query->where('a.access = ' . (int) $access);
}
// Add the list ordering clause.
$query->order($db->escape($this->getState('list.ordering', 'a.ordering')) . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
return $query;
}
/**
* Set the published language(s)
*
* @param array $cid An array of language IDs.
* @param integer $value The value of the published state.
*
* @return boolean True on success, false otherwise.
* @since 1.6
*/
public function setPublished($cid, $value = 0)
{
return JTable::getInstance('Language')->publish($cid, $value);
}
/**
* Method to delete records.
*
* @param array An array of item primary keys.
*
* @return boolean Returns true on success, false on failure.
* @since 1.6
*/
public function delete($pks)
{
// Sanitize the array.
$pks = (array) $pks;
// Get a row instance.
$table = JTable::getInstance('Language');
// Iterate the items to delete each one.
foreach ($pks as $itemId)
{
if (!$table->delete((int) $itemId))
{
$this->setError($table->getError());
return false;
}
}
// Clean the cache.
$this->cleanCache();
return true;
}
/**
* Custom clean cache method, 2 places for 2 clients
*
* @since 1.6
*/
protected function cleanCache($group = null, $client_id = 0)
{
parent::cleanCache('_system');
parent::cleanCache('com_languages');
}
}

View File

@ -0,0 +1,204 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Languages Override Model
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 2.5
*/
class LanguagesModelOverride extends JModelAdmin
{
/**
* Method to get the record form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
*
* @return mixed A JForm object on success, false on failure
*
* @since 2.5
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form
$form = $this->loadForm('com_languages.override', 'override', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
{
return false;
}
$client = $this->getState('filter.client', 'site');
$language = $this->getState('filter.language', 'en-GB');
$langName = JLanguage::getInstance($language)->getName();
if (!$langName)
{
// If a language only exists in frontend, it's meta data cannot be
// loaded in backend at the moment, so fall back to the language tag
$langName = $language;
}
$form->setValue('client', null, JText::_('COM_LANGUAGES_VIEW_OVERRIDE_CLIENT_'.strtoupper($client)));
$form->setValue('language', null, JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDE_LANGUAGE', $langName, $language));
$form->setValue('file', null, JPath::clean(constant('JPATH_'.strtoupper($client)) . '/language/overrides/' . $language . '.override.ini'));
return $form;
}
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form
*
* @since 2.5
*/
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState('com_languages.edit.override.data', array());
if (empty($data))
{
$data = $this->getItem();
}
$this->preprocessData('com_languages.override', $data);
return $data;
}
/**
* Method to get a single record.
*
* @param string $pk The key name.
*
* @return mixed Object on success, false otherwise.
*
* @since 2.5
*/
public function getItem($pk = null)
{
require_once JPATH_COMPONENT.'/helpers/languages.php';
$input = JFactory::getApplication()->input;
$pk = (!empty($pk)) ? $pk : $input->get('id');
$filename = constant('JPATH_'.strtoupper($this->getState('filter.client'))) . '/language/overrides/' . $this->getState('filter.language', 'en-GB').'.override.ini';
$strings = LanguagesHelper::parseFile($filename);
$result = new stdClass;
$result->key = '';
$result->override = '';
if (isset($strings[$pk]))
{
$result->key = $pk;
$result->override = $strings[$pk];
}
return $result;
}
/**
* Method to save the form data.
*
* @param array $data The form data.
* @param boolean $opposite_client Indicates whether the override should not be created for the current client
*
* @return boolean True on success, false otherwise.
*
* @since 2.5
*/
public function save($data, $opposite_client = false)
{
$app = JFactory::getApplication();
require_once JPATH_COMPONENT.'/helpers/languages.php';
jimport('joomla.filesystem.file');
$client = $app->getUserState('com_languages.overrides.filter.client', 0);
$language = $app->getUserState('com_languages.overrides.filter.language', 'en-GB');
// If the override should be created for both
if ($opposite_client)
{
$client = 1 - $client;
}
$client = $client ? 'administrator' : 'site';
// Parse the override.ini file in oder to get the keys and strings
$filename = constant('JPATH_'.strtoupper($client)) . '/language/overrides/' . $language . '.override.ini';
$strings = LanguagesHelper::parseFile($filename);
if (isset($strings[$data['id']]))
{
// If an existent string was edited check whether
// the name of the constant is still the same
if ($data['key'] == $data['id'])
{
// If yes, simply override it
$strings[$data['key']] = $data['override'];
}
else
{
// If no, delete the old string and prepend the new one
unset($strings[$data['id']]);
$strings = array($data['key'] => $data['override']) + $strings;
}
}
else
{
// If it is a new override simply prepend it
$strings = array($data['key'] => $data['override']) + $strings;
}
foreach ($strings as $key => $string)
{
$strings[$key] = str_replace('"', '"_QQ_"', $string);
}
// Write override.ini file with the strings
$registry = new JRegistry;
$registry->loadObject($strings);
if (!JFile::write($filename, $registry->toString('INI')))
{
return false;
}
// If the override should be stored for both clients save
// it also for the other one and prevent endless recursion
if (isset($data['both']) && $data['both'] && !$opposite_client)
{
return $this->save($data, true);
}
return true;
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
*
* @since 2.5
*/
protected function populateState()
{
$app = JFactory::getApplication();
$client = $app->getUserStateFromRequest('com_languages.overrides.filter.client', 'filter_client', 0, 'int') ? 'administrator' : 'site';
$this->setState('filter.client', $client);
$language = $app->getUserStateFromRequest('com_languages.overrides.filter.language', 'filter_language', 'en-GB', 'cmd');
$this->setState('filter.language', $language);
}
}

View File

@ -0,0 +1,264 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Languages Overrides Model
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 2.5
*/
class LanguagesModelOverrides extends JModelList
{
/**
* Constructor
*
* @param array An optional associative array of configuration settings
*
* @return void
*
* @since 2.5
*/
public function __construct($config = array())
{
parent::__construct($config);
$this->filter_fields = array('key', 'text');
}
/**
* Retrieves the overrides data
*
* @param boolean True if all overrides shall be returned without considering pagination, defaults to false
*
* @return array Array of objects containing the overrides of the override.ini file
*
* @since 2.5
*/
public function getOverrides($all = false)
{
// Get a storage key
$store = $this->getStoreId();
// Try to load the data from internal storage
if (!empty($this->cache[$store]))
{
return $this->cache[$store];
}
// Parse the override.ini file in oder to get the keys and strings
$filename = constant('JPATH_' . strtoupper($this->getState('filter.client'))) . '/language/overrides/' . $this->getState('filter.language') . '.override.ini';
$strings = LanguagesHelper::parseFile($filename);
// Consider the odering
if ($this->getState('list.ordering') == 'text')
{
if (strtoupper($this->getState('list.direction')) == 'DESC')
{
arsort($strings);
}
else
{
asort($strings);
}
}
else
{
if (strtoupper($this->getState('list.direction')) == 'DESC')
{
krsort($strings);
}
else
{
ksort($strings);
}
}
// Consider the pagination
if (!$all && $this->getState('list.limit') && $this->getTotal() > $this->getState('list.limit'))
{
$strings = array_slice($strings, $this->getStart(), $this->getState('list.limit'), true);
}
// Add the items to the internal cache
$this->cache[$store] = $strings;
return $this->cache[$store];
}
/**
* Method to get the total number of overrides
*
* @return int The total number of overrides
*
* @since 2.5
*/
public function getTotal()
{
// Get a storage key
$store = $this->getStoreId('getTotal');
// Try to load the data from internal storage
if (!empty($this->cache[$store]))
{
return $this->cache[$store];
}
// Add the total to the internal cache
$this->cache[$store] = count($this->getOverrides(true));
return $this->cache[$store];
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string An optional ordering field.
* @param string An optional direction (asc|desc).
*
* @return void
*
* @since 2.5
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication();
// Use default language of frontend for default filter
$default = JComponentHelper::getParams('com_languages')->get('site').'0';
$old_language_client = $app->getUserState('com_languages.overrides.filter.language_client', '');
$language_client = $this->getUserStateFromRequest('com_languages.overrides.filter.language_client', 'filter_language_client', $default, 'cmd');
if ($old_language_client != $language_client)
{
$client = substr($language_client, -1);
$language = substr($language_client, 0, -1);
}
else
{
$client = $app->getUserState('com_languages.overrides.filter.client', 0);
$language = $app->getUserState('com_languages.overrides.filter.language', 'en-GB');
}
$this->setState('filter.language_client', $language.$client);
$this->setState('filter.client', $client ? 'administrator' : 'site');
$this->setState('filter.language', $language);
// Add filters to the session because they won't be stored there
// by 'getUserStateFromRequest' if they aren't in the current request
$app->setUserState('com_languages.overrides.filter.client', $client);
$app->setUserState('com_languages.overrides.filter.language', $language);
// List state information
parent::populateState('key', 'asc');
}
/**
* Method to get all found languages of frontend and backend.
*
* The resulting array has entries of the following style:
* <Language Tag>0|1 => <Language Name> - <Client Name>
*
* @return array Sorted associative array of languages
*
* @since 2.5
*/
public function getLanguages()
{
// Try to load the data from internal storage
if (!empty($this->cache['languages']))
{
return $this->cache['languages'];
}
// Get all languages of frontend and backend
$languages = array();
$site_languages = JLanguage::getKnownLanguages(JPATH_SITE);
$admin_languages = JLanguage::getKnownLanguages(JPATH_ADMINISTRATOR);
// Create a single array of them
foreach ($site_languages as $tag => $language)
{
$languages[$tag.'0'] = JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], JText::_('JSITE'));
}
foreach ($admin_languages as $tag => $language)
{
$languages[$tag.'1'] = JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], JText::_('JADMINISTRATOR'));
}
// Sort it by language tag and by client after that
ksort($languages);
// Add the languages to the internal cache
$this->cache['languages'] = $languages;
return $this->cache['languages'];
}
/**
* Method to delete one or more overrides
*
* @param array Array of keys to delete
*
* @return integer Number of successfully deleted overrides, boolean false if an error occured
*
* @since 2.5
*/
public function delete($cids)
{
// Check permissions first
if (!JFactory::getUser()->authorise('core.delete', 'com_languages'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED'));
return false;
}
jimport('joomla.filesystem.file');
require_once JPATH_COMPONENT.'/helpers/languages.php';
// Parse the override.ini file in oder to get the keys and strings
$filename = constant('JPATH_' . strtoupper($this->getState('filter.client'))) . '/language/overrides/' . $this->getState('filter.language') . '.override.ini';
$strings = LanguagesHelper::parseFile($filename);
// Unset strings that shall be deleted
foreach ($cids as $key)
{
if (isset($strings[$key]))
{
unset($strings[$key]);
}
}
foreach ($strings as $key => $string)
{
$strings[$key] = str_replace('"', '"_QQ_"', $string);
}
// Write override.ini file with the left strings
$registry = new JRegistry;
$registry->loadObject($strings);
$filename = constant('JPATH_' . strtoupper($this->getState('filter.client'))) . '/language/overrides/' . $this->getState('filter.language') . '.override.ini';
if (!JFile::write($filename, $registry->toString('INI')))
{
return false;
}
$this->cleanCache();
return count($cids);
}
}

View File

@ -0,0 +1,163 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Languages Strings Model
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 2.5
*/
class LanguagesModelStrings extends JModelLegacy
{
/**
* Method for refreshing the cache in the database with the known language strings
*
* @return boolean True on success, Exception object otherwise
*
* @since 2.5
*/
public function refresh()
{
require_once JPATH_COMPONENT.'/helpers/languages.php';
$app = JFactory::getApplication();
$app->setUserState('com_languages.overrides.cachedtime', null);
// Empty the database cache first
try
{
$this->_db->setQuery('TRUNCATE TABLE '.$this->_db->quoteName('#__overrider'));
$this->_db->execute();
}
catch (RuntimeException $e)
{
return $e;
}
// Create the insert query
$query = $this->_db->getQuery(true)
->insert($this->_db->quoteName('#__overrider'))
->columns('constant, string, file');
// Initialize some variables
$client = $app->getUserState('com_languages.overrides.filter.client', 'site') ? 'administrator' : 'site';
$language = $app->getUserState('com_languages.overrides.filter.language', 'en-GB');
$base = constant('JPATH_'.strtoupper($client));
$path = $base . '/language/' . $language;
$files = array();
// Parse common language directory
jimport('joomla.filesystem.folder');
if (is_dir($path))
{
$files = JFolder::files($path, $language.'.*ini$', false, true);
}
// Parse language directories of components
$files = array_merge($files, JFolder::files($base.'/components', $language.'.*ini$', 3, true));
// Parse language directories of modules
$files = array_merge($files, JFolder::files($base.'/modules', $language.'.*ini$', 3, true));
// Parse language directories of templates
$files = array_merge($files, JFolder::files($base.'/templates', $language.'.*ini$', 3, true));
// Parse language directories of plugins
$files = array_merge($files, JFolder::files(JPATH_PLUGINS, $language.'.*ini$', 3, true));
// Parse all found ini files and add the strings to the database cache
foreach ($files as $file)
{
$strings = LanguagesHelper::parseFile($file);
if ($strings && count($strings))
{
$query->clear('values');
foreach ($strings as $key => $string)
{
$query->values($this->_db->quote($key).','.$this->_db->quote($string).','.$this->_db->quote(JPath::clean($file)));
}
try
{
$this->_db->setQuery($query);
$this->_db->execute();
}
catch (RuntimeException $e)
{
return $e;
}
}
}
// Update the cached time
$app->setUserState('com_languages.overrides.cachedtime.'.$client.'.'.$language, time());
return true;
}
/**
* Method for searching language strings
*
* @return array Array of resuls on success, Exception object otherwise
*
* @since 2.5
*/
public function search()
{
$results = array();
$input = JFactory::getApplication()->input;
$limitstart = $input->getInt('more');
try
{
$searchstring = $this->_db->quote('%' . $input->getString('searchstring') . '%');
// Create the search query
$query = $this->_db->getQuery(true)
->select('constant, string, file')
->from($this->_db->quoteName('#__overrider'));
if ($input->get('searchtype') == 'constant')
{
$query->where('constant LIKE '.$searchstring);
}
else
{
$query->where('string LIKE '.$searchstring);
}
// Consider the limitstart according to the 'more' parameter and load the results
$this->_db->setQuery($query, $limitstart, 10);
$results['results'] = $this->_db->loadObjectList();
// Check whether there are more results than already loaded
$query->clear('select')
->select('COUNT(id)');
$this->_db->setQuery($query);
if ($this->_db->loadResult() > $limitstart + 10)
{
// If this is set a 'More Results' link will be displayed in the view
$results['more'] = $limitstart + 10;
}
}
catch (RuntimeException $e)
{
return $e;
}
return $results;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,111 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Add specific helper files for html generation
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
$user = JFactory::getUser();
$userId = $user->get('id');
$client = $this->state->get('filter.client_id', 0) ? JText::_('JADMINISTRATOR') : JText::_('JSITE');
$clientId = $this->state->get('filter.client_id', 0);
?>
<form action="<?php echo JRoute::_('index.php?option=com_languages&view=installed&client='.$clientId); ?>" method="post" id="adminForm" name="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif;?>
<table class="table table-striped">
<thead>
<tr>
<th width="20">
&#160;
</th>
<th width="25%" class="title">
<?php echo JText::_('COM_LANGUAGES_HEADING_LANGUAGE'); ?>
</th>
<th>
<?php echo JText::_('COM_LANGUAGES_FIELD_LANG_TAG_LABEL'); ?>
</th>
<th>
<?php echo JText::_('JCLIENT'); ?>
</th>
<th>
<?php echo JText::_('COM_LANGUAGES_HEADING_DEFAULT'); ?>
</th>
<th>
<?php echo JText::_('JVERSION'); ?>
</th>
<th>
<?php echo JText::_('JDATE'); ?>
</th>
<th>
<?php echo JText::_('JAUTHOR'); ?>
</th>
<th>
<?php echo JText::_('COM_LANGUAGES_HEADING_AUTHOR_EMAIL'); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="9">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->rows as $i => $row) :
$canCreate = $user->authorise('core.create', 'com_languages');
$canEdit = $user->authorise('core.edit', 'com_languages');
$canChange = $user->authorise('core.edit.state', 'com_languages');
?>
<tr class="row<?php echo $i % 2; ?>">
<td width="20">
<?php echo JHtml::_('languages.id', $i, $row->language);?>
</td>
<td width="25%">
<?php echo $this->escape($row->name); ?>
</td>
<td align="center">
<?php echo $this->escape($row->language); ?>
</td>
<td align="center">
<?php echo $client;?>
</td>
<td align="center">
<?php echo JHtml::_('jgrid.isdefault', $row->published, $i, 'installed.', !$row->published && $canChange);?>
</td>
<td align="center">
<?php echo $this->escape($row->version); ?>
</td>
<td align="center">
<?php echo $this->escape($row->creationDate); ?>
</td>
<td align="center">
<?php echo $this->escape($row->author); ?>
</td>
<td align="center">
<?php echo JStringPunycode::emailToUTF8($this->escape($row->authorEmail)); ?>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,103 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Displays a list of the installed languages.
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 1.6
*/
class LanguagesViewInstalled extends JViewLegacy
{
/**
* @var object client object
*/
protected $client = null;
/**
* @var boolean|JExeption True, if FTP settings should be shown, or an exeption
*/
protected $ftp = null;
/**
* @var string option name
*/
protected $option = null;
/**
* @var object pagination information
*/
protected $pagination = null;
/**
* @var array languages information
*/
protected $rows = null;
/**
* @var object user object
*/
protected $user = null;
/**
* Display the view
*/
public function display($tpl = null)
{
$this->ftp = $this->get('Ftp');
$this->option = $this->get('Option');
$this->pagination = $this->get('Pagination');
$this->rows = $this->get('Data');
$this->state = $this->get('State');
$client = (int) $this->state->get('filter.client_id', 0);
LanguagesHelper::addSubmenu('installed', $client);
$this->addToolbar();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT.'/helpers/languages.php';
$canDo = LanguagesHelper::getActions();
JToolbarHelper::title(JText::_('COM_LANGUAGES_VIEW_INSTALLED_TITLE'), 'langmanager.png');
if ($canDo->get('core.edit.state'))
{
JToolbarHelper::makeDefault('installed.setDefault');
JToolbarHelper::divider();
}
if ($canDo->get('core.admin'))
{
// Add install languages link to the lang installer component
$bar = JToolbar::getInstance('toolbar');
$bar->appendButton('Link', 'upload', 'COM_LANGUAGES_INSTALL', 'index.php?option=com_installer&view=languages');
JToolbarHelper::divider();
JToolbarHelper::preferences('com_languages');
JToolbarHelper::divider();
}
JToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_INSTALLED');
$this->sidebar = JHtmlSidebar::render();
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,177 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.formvalidation');
JHtml::_('formbehavior.chosen', 'select');
$canDo = LanguagesHelper::getActions();
?>
<script type="text/javascript">
Joomla.submitbutton = function(task)
{
if (task == 'language.cancel' || document.formvalidator.isValid(document.id('language-form')))
{
Joomla.submitform(task, document.getElementById('language-form'));
}
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_languages&layout=edit&lang_id='.(int) $this->item->lang_id); ?>" method="post" name="adminForm" id="language-form" class="form-validate form-horizontal">
<?php echo JLayoutHelper::render('joomla.edit.item_title', $this); ?>
<fieldset>
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'details')); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'details', JText::_('JDETAILS', true)); ?>
<div class="control-group">
<div class="controls">
<?php if ($this->item->lang_id) : ?>
<?php echo JText::sprintf('JGLOBAL_RECORD_NUMBER', $this->item->lang_id); ?>
<?php else : ?>
<?php echo JText::_('COM_LANGUAGES_VIEW_LANGUAGE_EDIT_NEW_TITLE'); ?>
<?php endif; ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('title'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('title'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('title_native'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('title_native'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('sef'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('sef'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('image'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('image'); ?>
<span id="flag">
<?php echo JHtml::_('image', 'mod_languages/' . $this->form->getValue('image') . '.gif', $this->form->getValue('image'), array('title' => $this->form->getValue('image')), true); ?>
</span>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('lang_code'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('lang_code'); ?>
</div>
</div>
<?php if ($canDo->get('core.edit.state')) : ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('published'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('published'); ?>
</div>
</div>
<?php endif; ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('access'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('access'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('description'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('description'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('lang_id'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('lang_id'); ?>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'metadata', JText::_('JGLOBAL_FIELDSET_METADATA_OPTIONS', true)); ?>
<?php foreach ($this->form->getFieldset('metadata') as $field) : ?>
<div class="control-group">
<?php if (!$field->hidden) : ?>
<div class="control-label">
<?php echo $field->label; ?>
</div>
<?php endif; ?>
<div class="controls">
<?php echo $field->input; ?>
</div>
</div>
<?php endforeach; ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'site_name', JText::_('COM_LANGUAGES_FIELDSET_SITE_NAME_LABEL', true)); ?>
<?php foreach ($this->form->getFieldset('site_name') as $field) : ?>
<div class="control-group">
<?php if (!$field->hidden) : ?>
<div class="control-label">
<?php echo $field->label; ?>
</div>
<?php endif; ?>
<div class="controls">
<?php echo $field->input; ?>
</div>
</div>
<?php endforeach; ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
</fieldset>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
<script type="text/javascript">
jQuery('#jform_image').on('change', function() {
var flag = this.value;
if (!jQuery('#flag img').attr('src'))
{
jQuery('#flag img').attr('src', '<?php echo JUri::root(true);?>' + '/media/mod_languages/images/' + flag + '.gif');
}
else
{
jQuery('#flag img').attr('src', function(index, attr) {
return attr.replace(jQuery('#flag img').attr('title') + '.gif', flag + '.gif')
})
}
jQuery('#flag img').attr('title', flag).attr('alt', flag);
});
</script>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,95 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML View class for the Languages component
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 1.5
*/
class LanguagesViewLanguage extends JViewLegacy
{
public $item;
public $form;
public $state;
/**
* Display the view
*/
public function display($tpl = null)
{
$this->item = $this->get('Item');
$this->form = $this->get('Form');
$this->state = $this->get('State');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->addToolbar();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT . '/helpers/languages.php';
JFactory::getApplication()->input->set('hidemainmenu', 1);
$isNew = empty($this->item->lang_id);
$canDo = LanguagesHelper::getActions();
JToolbarHelper::title(JText::_($isNew ? 'COM_LANGUAGES_VIEW_LANGUAGE_EDIT_NEW_TITLE' : 'COM_LANGUAGES_VIEW_LANGUAGE_EDIT_EDIT_TITLE'), 'langmanager.png');
// If a new item, can save.
if ($isNew && $canDo->get('core.create'))
{
JToolbarHelper::save('language.save');
}
//If an existing item, allow to Apply and Save.
if (!$isNew && $canDo->get('core.edit'))
{
JToolbarHelper::apply('language.apply');
JToolbarHelper::save('language.save');
}
// If an existing item, can save to a copy only if we have create rights.
if ($canDo->get('core.create'))
{
JToolbarHelper::save2new('language.save2new');
}
if ($isNew)
{
JToolbarHelper::cancel('language.cancel');
}
else
{
JToolbarHelper::cancel('language.cancel', 'JTOOLBAR_CLOSE');
}
JToolbarHelper::divider();
JToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_EDIT');
$this->sidebar = JHtmlSidebar::render();
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,167 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('bootstrap.tooltip');
$user = JFactory::getUser();
$userId = $user->get('id');
$n = count($this->items);
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$canOrder = $user->authorise('core.edit.state', 'com_languages');
$saveOrder = $listOrder == 'a.ordering';
?>
<form action="<?php echo JRoute::_('index.php?option=com_languages&view=languages'); ?>" method="post" name="adminForm" id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif;?>
<div id="filter-bar" class="btn-toolbar">
<div class="filter-search btn-group pull-left">
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('COM_LANGUAGES_SEARCH_IN_TITLE'); ?>" />
</div>
<div class="btn-group pull-left">
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
</div>
</div>
<div class="clearfix"> </div>
<table class="table table-striped">
<thead>
<tr>
<th width="20">
<?php echo JHtml::_('grid.checkall'); ?>
</th>
<th class="title">
<?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
</th>
<th class="title">
<?php echo JHtml::_('grid.sort', 'COM_LANGUAGES_HEADING_TITLE_NATIVE', 'a.title_native', $listDirn, $listOrder); ?>
</th>
<th width="5%" class="nowrap">
<?php echo JHtml::_('grid.sort', 'COM_LANGUAGES_FIELD_LANG_TAG_LABEL', 'a.lang_code', $listDirn, $listOrder); ?>
</th>
<th width="5%" class="nowrap">
<?php echo JHtml::_('grid.sort', 'COM_LANGUAGES_FIELD_LANG_CODE_LABEL', 'a.sef', $listDirn, $listOrder); ?>
</th>
<th width="5%" class="nowrap">
<?php echo JHtml::_('grid.sort', 'COM_LANGUAGES_HEADING_LANG_IMAGE', 'a.image', $listDirn, $listOrder); ?>
</th>
<th width="10%" class="nowrap">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ORDERING', 'a.ordering', $listDirn, $listOrder); ?>
<?php if ($canOrder && $saveOrder) :?>
<?php echo JHtml::_('grid.order', $this->items, 'filesave.png', 'languages.saveorder'); ?>
<?php endif; ?>
</th>
<th width="5%" class="center nowrap">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
</th>
<th width="5%" class="nowrap">
<?php echo JHtml::_('grid.sort', 'COM_LANGUAGES_HOMEPAGE', '', $listDirn, $listOrder); ?>
</th>
<th width="1%" class="center nowrap">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.lang_id', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="10">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php
foreach ($this->items as $i => $item) :
$ordering = ($listOrder == 'a.ordering');
$canCreate = $user->authorise('core.create', 'com_languages');
$canEdit = $user->authorise('core.edit', 'com_languages');
$canChange = $user->authorise('core.edit.state', 'com_languages');
?>
<tr class="row<?php echo $i % 2; ?>">
<td>
<?php echo JHtml::_('grid.id', $i, $item->lang_id); ?>
</td>
<td>
<?php echo JHtml::_('jgrid.published', $item->published, $i, 'languages.', $canChange);?>
<span class="editlinktip hasTooltip" title="<?php echo JHtml::tooltipText(JText::_('JGLOBAL_EDIT_ITEM'), $item->title, 0); ?>">
<?php if ($canEdit) : ?>
<a href="<?php echo JRoute::_('index.php?option=com_languages&task=language.edit&lang_id='.(int) $item->lang_id); ?>">
<?php echo $this->escape($item->title); ?></a>
<?php else : ?>
<?php echo $this->escape($item->title); ?>
<?php endif; ?>
</span>
</td>
<td>
<?php echo $this->escape($item->title_native); ?>
</td>
<td>
<?php echo $this->escape($item->lang_code); ?>
</td>
<td>
<?php echo $this->escape($item->sef); ?>
</td>
<td>
<?php echo $this->escape($item->image); ?>&nbsp;<?php echo JHtml::_('image', 'mod_languages/'.$item->image.'.gif', $item->image, array('title' => $item->image), true); ?>
</td>
<td class="order">
<?php if ($canChange) : ?>
<div class="input-prepend">
<?php if ($saveOrder) :?>
<?php if ($listDirn == 'asc') : ?>
<span class="add-on"><?php echo $this->pagination->orderUpIcon($i, true, 'languages.orderup', 'JLIB_HTML_MOVE_UP', $ordering); ?></span><span class="add-on"><?php echo $this->pagination->orderDownIcon($i, $this->pagination->total, true, 'languages.orderdown', 'JLIB_HTML_MOVE_DOWN', $ordering); ?></span>
<?php elseif ($listDirn == 'desc') : ?>
<span class="add-on"><?php echo $this->pagination->orderUpIcon($i, true, 'languages.orderdown', 'JLIB_HTML_MOVE_UP', $ordering); ?></span><span class="add-on"><?php echo $this->pagination->orderDownIcon($i, $this->pagination->total, true, 'languages.orderup', 'JLIB_HTML_MOVE_DOWN', $ordering); ?></span>
<?php endif; ?>
<?php endif; ?>
<?php $disabled = $saveOrder ? '' : 'disabled="disabled"'; ?>
<?php if (!$disabled = $saveOrder) : echo "<span class=\"add-on tip\" title=\"".JText::_('JDISABLED')."\"><i class=\"icon-ban-circle\"></i></span>"; endif;?><input type="text" name="order[]" size="5" value="<?php echo $item->ordering;?>" <?php echo $disabled ?> class="width-20 text-area-order" />
</div>
<?php else : ?>
<?php echo $item->ordering; ?>
<?php endif; ?>
</td>
<td class="center">
<?php echo $this->escape($item->access_level); ?>
</td>
<td>
<?php if ($item->home == '1') : ?>
<?php echo JText::_('JYES');?>
<?php else:?>
<?php echo JText::_('JNO');?>
<?php endif;?>
</td>
<td class="center">
<?php echo $this->escape($item->lang_id); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,119 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML Languages View class for the Languages component
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 1.6
*/
class LanguagesViewLanguages extends JViewLegacy
{
protected $items;
protected $pagination;
protected $state;
/**
* Display the view
*/
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
LanguagesHelper::addSubmenu('languages');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT.'/helpers/languages.php';
$canDo = LanguagesHelper::getActions();
JToolbarHelper::title(JText::_('COM_LANGUAGES_VIEW_LANGUAGES_TITLE'), 'langmanager.png');
if ($canDo->get('core.create'))
{
JToolbarHelper::addNew('language.add');
}
if ($canDo->get('core.edit'))
{
JToolbarHelper::editList('language.edit');
JToolbarHelper::divider();
}
if ($canDo->get('core.edit.state'))
{
if ($this->state->get('filter.published') != 2)
{
JToolbarHelper::publishList('languages.publish');
JToolbarHelper::unpublishList('languages.unpublish');
}
}
if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete'))
{
JToolbarHelper::deleteList('', 'languages.delete', 'JTOOLBAR_EMPTY_TRASH');
JToolbarHelper::divider();
} elseif ($canDo->get('core.edit.state'))
{
JToolbarHelper::trash('languages.trash');
JToolbarHelper::divider();
}
if ($canDo->get('core.admin'))
{
// Add install languages link to the lang installer component
$bar = JToolbar::getInstance('toolbar');
$bar->appendButton('Link', 'upload', 'COM_LANGUAGES_INSTALL', 'index.php?option=com_installer&view=languages');
JToolbarHelper::divider();
JToolbarHelper::preferences('com_languages');
JToolbarHelper::divider();
}
JToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_CONTENT');
JHtmlSidebar::setAction('index.php?option=com_languages&view=languages');
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_PUBLISHED'),
'filter_published',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
);
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_ACCESS'),
'filter_access',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
);
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,227 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$notice_homes = $this->homes == 2 || $this->homes == 1 || $this->homes - 1 != count($this->contentlangs) && ($this->language_filter || $this->switchers != 0);
$notice_disabled = !$this->language_filter && ($this->homes > 1 || $this->switchers != 0);
$notice_switchers = !$this->switchers && ($this->homes > 1 || $this->language_filter);
?>
<div class="mod-multilangstatus">
<?php if (!$this->language_filter && $this->switchers == 0) : ?>
<?php if ($this->homes == 1) : ?>
<div class="alert alert-info"><?php echo JText::_('COM_LANGUAGES_MULTILANGSTATUS_NONE'); ?></div>
<?php else: ?>
<div class="alert alert-info"><?php echo JText::_('COM_LANGUAGES_MULTILANGSTATUS_USELESS_HOMES'); ?></div>
<?php endif; ?>
<?php else: ?>
<table class="table table-striped table-condensed">
<tbody>
<?php if ($notice_homes) : ?>
<tr class="warning">
<td>
<i class="icon-pending"></i>
</td>
<td>
<?php echo JText::_('COM_LANGUAGES_MULTILANGSTATUS_HOMES_MISSING'); ?>
</td>
</tr>
<?php endif; ?>
<?php if ($notice_disabled) : ?>
<tr class="warning">
<td>
<i class="icon-pending"></i>
</td>
<td>
<?php echo JText::_('COM_LANGUAGES_MULTILANGSTATUS_LANGUAGEFILTER_DISABLED'); ?>
</td>
</tr>
<?php endif; ?>
<?php if ($notice_switchers) : ?>
<tr class="warning">
<td>
<i class="icon-pending"></i>
</td>
<td>
<?php echo JText::_('COM_LANGUAGES_MULTILANGSTATUS_LANGSWITCHER_UNPUBLISHED'); ?>
</td>
</tr>
<?php endif; ?>
<?php foreach ($this->contentlangs as $contentlang) : ?>
<?php if (array_key_exists($contentlang->lang_code, $this->homepages) && (!array_key_exists($contentlang->lang_code, $this->site_langs) || !$contentlang->published)) : ?>
<tr class="warning">
<td>
<i class="icon-pending"></i>
</td>
<td>
<?php echo JText::sprintf('COM_LANGUAGES_MULTILANGSTATUS_ERROR_CONTENT_LANGUAGE', $contentlang->lang_code); ?>
</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
<?php if ($this->listUsersError) : ?>
<tr class="info">
<td>
<i class="icon-help"></i>
</td>
<td>
<?php echo JText::_('COM_LANGUAGES_MULTILANGSTATUS_CONTACTS_ERROR_TIP'); ?>
<ul>
<?php foreach ($this->listUsersError as $user) : ?>
<li>
<?php echo JText::sprintf('COM_LANGUAGES_MULTILANGSTATUS_CONTACTS_ERROR', $user->name); ?>
</li>
<?php endforeach; ?>
</ul>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<table class="table table-striped table-condensed" style="border-top: 1px solid #CCCCCC;">
<thead>
<tr>
<th>
<?php echo JText::_('JDETAILS'); ?>
</th>
<th>
<?php echo JText::_('JSTATUS'); ?>
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<?php echo JText::_('COM_LANGUAGES_MULTILANGSTATUS_LANGUAGEFILTER'); ?>
</th>
<td class="center">
<?php if ($this->language_filter) : ?>
<?php echo JText::_('JENABLED'); ?>
<?php else : ?>
<?php echo JText::_('JDISABLED'); ?>
<?php endif; ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo JText::_('COM_LANGUAGES_MULTILANGSTATUS_LANGSWITCHER_PUBLISHED'); ?>
</th>
<td class="center">
<?php if ($this->switchers != 0) : ?>
<?php echo $this->switchers; ?>
<?php else : ?>
<?php echo JText::_('JNONE'); ?>
<?php endif; ?>
</td>
</tr>
<tr>
<th scope="row">
<?php if ($this->homes > 1) : ?>
<?php echo JText::_('COM_LANGUAGES_MULTILANGSTATUS_HOMES_PUBLISHED_INCLUDING_ALL'); ?>
<?php else : ?>
<?php echo JText::_('COM_LANGUAGES_MULTILANGSTATUS_HOMES_PUBLISHED'); ?>
<?php endif; ?>
</th>
<td class="center">
<?php if ($this->homes > 1) : ?>
<?php echo $this->homes; ?>
<?php else : ?>
<?php echo JText::_('COM_LANGUAGES_MULTILANGSTATUS_HOMES_PUBLISHED_ALL'); ?>
<?php endif; ?>
</td>
</tr>
</tbody>
</table>
<table class="table table-striped table-condensed" style="border-top: 1px solid #CCCCCC;">
<thead>
<tr>
<th>
<?php echo JText::_('JGRID_HEADING_LANGUAGE'); ?>
</th>
<th>
<?php echo JText::_('COM_LANGUAGES_MULTILANGSTATUS_SITE_LANG_PUBLISHED'); ?>
</th>
<th>
<?php echo JText::_('COM_LANGUAGES_MULTILANGSTATUS_CONTENT_LANGUAGE_PUBLISHED'); ?>
</th>
<th>
<?php echo JText::_('COM_LANGUAGES_MULTILANGSTATUS_HOMES_PUBLISHED'); ?>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($this->statuses as $status) : ?>
<?php if ($status->element) : ?>
<tr>
<td>
<?php echo $status->element; ?>
</td>
<?php endif; ?>
<?php if ($status->element) : // Published Site languages ?>
<td class="center">
<i class="icon-ok"></i>
</td>
<?php else : ?>
<td class="center">
<?php echo JText::_('JNO'); ?>
</td>
<?php endif; ?>
<?php if ($status->lang_code && $status->published) : // Published Content languages ?>
<td class="center">
<i class="icon-ok"></i>
</td>
<?php else : ?>
<td class="center">
<i class="icon-pending"></i>
</td>
<?php endif; ?>
<?php if ($status->home_language) : // Published Home pages ?>
<td class="center">
<i class="icon-ok"></i>
</td>
<?php else : ?>
<td class="center">
<i class="icon-not-ok"></i>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
<?php foreach ($this->contentlangs as $contentlang) : ?>
<?php if (!array_key_exists($contentlang->lang_code, $this->site_langs)) : ?>
<tr>
<td>
<?php echo $contentlang->lang_code; ?>
</td>
<td class="center">
<i class="icon-pending"></i>
</td>
<td class="center">
<?php if ($contentlang->published) : ?>
<i class="icon-ok"></i>
<?php elseif (!$contentlang->published && array_key_exists($contentlang->lang_code, $this->homepages)) : ?>
<i class="icon-not-ok"></i>
<?php elseif (!$contentlang->published) : ?>
<i class="icon-pending"></i>
<?php endif; ?>
</td>
<td class="center">
<?php if (!array_key_exists($contentlang->lang_code, $this->homepages)) : ?>
<i class="icon-pending"></i>
<?php else : ?>
<i class="icon-ok"></i>
<?php endif; ?>
</td>
<?php endif; ?>
<?php endforeach; ?>
</tr>
</tbody>
</table>
<?php endif; ?>
</div>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,39 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Displays the multilang status.
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 1.7.1
*/
class LanguagesViewMultilangstatus extends JViewLegacy
{
/**
* Display the view
*/
public function display($tpl = null)
{
require_once JPATH_COMPONENT . '/helpers/multilangstatus.php';
$this->homes = MultilangstatusHelper::getHomes();
$this->language_filter = JLanguageMultilang::isEnabled();
$this->switchers = MultilangstatusHelper::getLangswitchers();
$this->listUsersError = MultilangstatusHelper::getContacts();
$this->contentlangs = MultilangstatusHelper::getContentlangs();
$this->site_langs = MultilangstatusHelper::getSitelangs();
$this->statuses = MultilangstatusHelper::getStatus();
$this->homepages = MultilangstatusHelper::getHomepages();
parent::display($tpl);
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,147 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.keepalive');
JHtml::_('formbehavior.chosen', 'select');
?>
<script type="text/javascript">
window.addEvent('domready', function()
{
document.id('jform_searchstring').addEvent('focus', function()
{
if (!Joomla.overrider.states.refreshed)
{
<?php if ($this->state->get('cache_expired')) : ?>
Joomla.overrider.refreshCache();
Joomla.overrider.states.refreshed = true;
<?php endif; ?>
}
this.removeClass('invalid');
});
});
Joomla.submitbutton = function(task)
{
if (task == 'override.cancel' || document.formvalidator.isValid(document.id('override-form')))
{
Joomla.submitform(task, document.getElementById('override-form'));
}
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_languages&id='.$this->item->key); ?>" method="post" name="adminForm" id="override-form" class="form-validate form-horizontal">
<div class="row-fluid">
<div class="span6">
<fieldset>
<legend><?php echo empty($this->item->key) ? JText::_('COM_LANGUAGES_VIEW_OVERRIDE_EDIT_NEW_OVERRIDE_LEGEND') : JText::_('COM_LANGUAGES_VIEW_OVERRIDE_EDIT_EDIT_OVERRIDE_LEGEND'); ?></legend>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('key'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('key'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('override'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('override'); ?>
</div>
</div>
<?php if ($this->state->get('filter.client') == 'administrator') : ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('both'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('both'); ?>
</div>
</div>
<?php endif; ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('language'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('language'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('client'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('client'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('file'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('file'); ?>
</div>
</div>
</fieldset>
</div>
<div class="span6">
<fieldset>
<legend><?php echo JText::_('COM_LANGUAGES_VIEW_OVERRIDE_SEARCH_LEGEND'); ?></legend>
<div class="alert alert-info"><p><?php echo JText::_('COM_LANGUAGES_VIEW_OVERRIDE_SEARCH_TIP'); ?></p></div>
<div class="control-group">
<?php echo $this->form->getInput('searchstring'); ?>
<button type="submit" class="btn btn-primary" onclick="Joomla.overrider.searchStrings();return false;">
<?php echo JText::_('COM_LANGUAGES_VIEW_OVERRIDE_SEARCH_BUTTON'); ?>
</button>
<span id="refresh-status" class="overrider-spinner help-block">
<?php echo JText::_('COM_LANGUAGES_VIEW_OVERRIDE_REFRESHING'); ?>
</span>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('searchtype'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('searchtype'); ?>
</div>
</div>
</fieldset>
<fieldset id="results-container" class="adminform">
<legend><?php echo JText::_('COM_LANGUAGES_VIEW_OVERRIDE_RESULTS_LEGEND'); ?></legend>
<span id="more-results">
<a href="javascript:Joomla.overrider.searchStrings(Joomla.overrider.states.more);">
<?php echo JText::_('COM_LANGUAGES_VIEW_OVERRIDE_MORE_RESULTS'); ?></a>
</span>
</fieldset>
<input type="hidden" name="task" value="" />
<input type="hidden" name="id" value="<?php echo $this->item->key; ?>" />
<?php echo JHtml::_('form.token'); ?>
</div>
</div>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,124 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* View to edit an language override
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 2.5
*/
class LanguagesViewOverride extends JViewLegacy
{
/**
* The form to use for the view
*
* @var object
* @since 2.5
*/
protected $form;
/**
* The item to edit
*
* @var object
* @since 2.5
*/
protected $item;
/**
* The model state
*
* @var object
* @since 2.5
*/
protected $state;
/**
* Displays the view
*
* @param string $tpl The name of the template file to parse
*
* @return void
*
* @since 2.5
*/
public function display($tpl = null)
{
JHtml::_('stylesheet', 'overrider/overrider.css', array(), true);
JHtml::_('behavior.framework');
JHtml::_('script', 'overrider/overrider.js', false, true);
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
// Check for errors
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors));
}
// Check whether the cache has to be refreshed
$cached_time = JFactory::getApplication()->getUserState('com_languages.overrides.cachedtime.'.$this->state->get('filter.client').'.'.$this->state->get('filter.language'), 0);
if (time() - $cached_time > 60 * 5)
{
$this->state->set('cache_expired', true);
}
// Add strings for translations in Javascript
JText::script('COM_LANGUAGES_VIEW_OVERRIDE_NO_RESULTS');
JText::script('COM_LANGUAGES_VIEW_OVERRIDE_REQUEST_ERROR');
$this->addToolbar();
parent::display($tpl);
}
/**
* Adds the page title and toolbar
*
* @return void
*
* @since 2.5
*/
protected function addToolbar()
{
JFactory::getApplication()->input->set('hidemainmenu', true);
$canDo = LanguagesHelper::getActions();
JToolbarHelper::title(JText::_('COM_LANGUAGES_VIEW_OVERRIDE_EDIT_TITLE'), 'langmanager');
if ($canDo->get('core.edit'))
{
JToolbarHelper::apply('override.apply');
JToolbarHelper::save('override.save');
}
// This component does not support Save as Copy
if ($canDo->get('core.edit') && $canDo->get('core.create'))
{
JToolbarHelper::save2new('override.save2new');
}
if (empty($this->item->key))
{
JToolbarHelper::cancel('override.cancel');
}
else
{
JToolbarHelper::cancel('override.cancel', 'JTOOLBAR_CLOSE');
}
JToolbarHelper::divider();
JToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_OVERRIDES_EDIT');
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,102 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('bootstrap.tooltip');
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
$client = $this->state->get('filter.client') == 'site' ? JText::_('JSITE') : JText::_('JADMINISTRATOR');
$language = $this->state->get('filter.language');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction')); ?>
<form action="<?php echo JRoute::_('index.php?option=com_languages&view=overrides'); ?>" method="post" name="adminForm" id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif;?>
<div id="filter-bar" class="btn-toolbar clearfix">
<div class="filter-search btn-group pull-left">
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('COM_LANGUAGES_VIEW_OVERRIDES_FILTER_SEARCH_DESC'); ?>" />
</div>
<div class="btn-group pull-left">
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
</div>
</div>
<table class="table table-striped">
<thead>
<tr>
<th width="1%">
<?php echo JHtml::_('grid.checkall'); ?>
</th>
<th width="30%" class="left">
<?php echo JHtml::_('grid.sort', 'COM_LANGUAGES_VIEW_OVERRIDES_KEY', 'key', $listDirn, $listOrder); ?>
</th>
<th class="left">
<?php echo JHtml::_('grid.sort', 'COM_LANGUAGES_VIEW_OVERRIDES_TEXT', 'text', $listDirn, $listOrder); ?>
</th>
<th class="nowrap">
<?php echo JText::_('COM_LANGUAGES_FIELD_LANG_TAG_LABEL'); ?>
</th>
<th>
<?php echo JText::_('JCLIENT'); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="5">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php $canEdit = JFactory::getUser()->authorise('core.edit', 'com_languages');
$i = 0;
foreach ($this->items as $key => $text) : ?>
<tr class="row<?php echo $i % 2; ?>" id="overriderrow<?php echo $i; ?>">
<td class="center">
<?php echo JHtml::_('grid.id', $i, $key); ?>
</td>
<td>
<?php if ($canEdit) : ?>
<a id="key[<?php echo $this->escape($key); ?>]" href="<?php echo JRoute::_('index.php?option=com_languages&task=override.edit&id='.$key); ?>"><?php echo $this->escape($key); ?></a>
<?php else: ?>
<?php echo $this->escape($key); ?>
<?php endif; ?>
</td>
<td>
<span id="string[<?php echo $this->escape($key); ?>]"><?php echo $this->escape($text); ?></span>
</td>
<td class="center">
<?php echo $language; ?>
</td>
<td class="center">
<?php echo $client; ?>
</td>
</tr>
<?php $i++;
endforeach; ?>
</tbody>
</table>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,121 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* View for language overrides list
*
* @package Joomla.Administrator
* @subpackage com_languages
* @since 2.5
*/
class LanguagesViewOverrides extends JViewLegacy
{
/**
* The items to list
*
* @var array
* @since 2.5
*/
protected $items;
/**
* The pagination object
*
* @var object
* @since 2.5
*/
protected $pagination;
/**
* The model state
*
* @var object
* @since 2.5
*/
protected $state;
/**
* Displays the view
*
* @param string $tpl The name of the template file to parse
*
* @return void
*
* @since 2.5
*/
public function display($tpl = null)
{
$this->state = $this->get('State');
$this->items = $this->get('Overrides');
$this->languages = $this->get('Languages');
$this->pagination = $this->get('Pagination');
LanguagesHelper::addSubmenu('overrides');
// Check for errors
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors));
}
$this->addToolbar();
parent::display($tpl);
}
/**
* Adds the page title and toolbar
*
* @return void
*
* @since 2.5
*/
protected function addToolbar()
{
// Get the results for each action
$canDo = LanguagesHelper::getActions();
JToolbarHelper::title(JText::_('COM_LANGUAGES_VIEW_OVERRIDES_TITLE'), 'langmanager');
if ($canDo->get('core.create'))
{
JToolbarHelper::addNew('override.add');
}
if ($canDo->get('core.edit') && $this->pagination->total)
{
JToolbarHelper::editList('override.edit');
}
if ($canDo->get('core.delete') && $this->pagination->total)
{
JToolbarHelper::deleteList('', 'overrides.delete');
}
if ($canDo->get('core.admin'))
{
JToolbarHelper::preferences('com_languages');
}
JToolbarHelper::divider();
JToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_OVERRIDES');
JHtmlSidebar::setAction('index.php?option=com_languages&view=overrides');
JHtmlSidebar::addFilter(
// @todo need a label here
'',
'filter_language_client',
JHtml::_('select.options', $this->languages, null, 'text', $this->state->get('filter.language_client')),
true
);
$this->sidebar = JHtmlSidebar::render();
}
}