You've already forked joomla_test
first commit
This commit is contained in:
11
administrator/components/com_modules/access.xml
Normal file
11
administrator/components/com_modules/access.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<access component="com_modules">
|
||||
<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>
|
||||
18
administrator/components/com_modules/config.xml
Normal file
18
administrator/components/com_modules/config.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?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_modules"
|
||||
section="component" />
|
||||
</fieldset>
|
||||
</config>
|
||||
54
administrator/components/com_modules/controller.php
Normal file
54
administrator/components/com_modules/controller.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Modules manager master display controller.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
* @since 1.6
|
||||
*/
|
||||
class ModulesController extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* 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/modules.php';
|
||||
|
||||
// Load the submenu.
|
||||
ModulesHelper::addSubmenu($this->input->get('view', 'modules'));
|
||||
|
||||
$view = $this->input->get('view', 'modules');
|
||||
$layout = $this->input->get('layout', 'default');
|
||||
$id = $this->input->getInt('id');
|
||||
|
||||
// Check for edit form.
|
||||
if ($view == 'module' && $layout == 'edit' && !$this->checkEditId('com_modules.edit.module', $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_modules&view=modules', false));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
parent::display();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
152
administrator/components/com_modules/controllers/module.php
Normal file
152
administrator/components/com_modules/controllers/module.php
Normal file
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Module controller class.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
* @since 1.6
|
||||
*/
|
||||
class ModulesControllerModule extends JControllerForm
|
||||
{
|
||||
/**
|
||||
* Override parent add method.
|
||||
*
|
||||
* @return mixed True if the record can be added, a JError object if not.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Get the result of the parent method. If an error, just return it.
|
||||
$result = parent::add();
|
||||
if ($result instanceof Exception)
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Look for the Extension ID.
|
||||
$extensionId = $app->input->get('eid', 0, 'int');
|
||||
if (empty($extensionId))
|
||||
{
|
||||
$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_item.'&layout=edit', false));
|
||||
return JError::raiseWarning(500, JText::_('COM_MODULES_ERROR_INVALID_EXTENSION'));
|
||||
}
|
||||
|
||||
$app->setUserState('com_modules.add.module.extension_id', $extensionId);
|
||||
$app->setUserState('com_modules.add.module.params', null);
|
||||
|
||||
// Parameters could be coming in for a new item, so let's set them.
|
||||
$params = $app->input->get('params', array(), 'array');
|
||||
$app->setUserState('com_modules.add.module.params', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override parent cancel method to reset the add module state.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
*
|
||||
* @return boolean True if access level checks pass, false otherwise.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function cancel($key = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
$result = parent::cancel();
|
||||
|
||||
$app->setUserState('com_modules.add.module.extension_id', null);
|
||||
$app->setUserState('com_modules.add.module.params', null);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override parent allowSave method.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowSave($data, $key = 'id')
|
||||
{
|
||||
// use custom position if selected
|
||||
if (isset($data['custom_position']))
|
||||
{
|
||||
if (empty($data['position']))
|
||||
{
|
||||
$data['position'] = $data['custom_position'];
|
||||
}
|
||||
|
||||
unset($data['custom_position']);
|
||||
}
|
||||
|
||||
return parent::allowSave($data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to run batch operations.
|
||||
*
|
||||
* @param string $model The model
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 1.7
|
||||
*/
|
||||
public function batch($model = null)
|
||||
{
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('Module', '', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_modules&view=modules'.$this->getRedirectToListAppend(), false));
|
||||
|
||||
return parent::batch($model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that allows child controller access to model data after the data has been saved.
|
||||
*
|
||||
* @param JModelLegacy $model The data model object.
|
||||
* @param array $validData The validated data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function postSaveHook(JModelLegacy $model, $validData = array())
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$task = $this->getTask();
|
||||
|
||||
switch ($task)
|
||||
{
|
||||
case 'save2new':
|
||||
$app->setUserState('com_modules.add.module.extension_id', $model->getState('module.extension_id'));
|
||||
break;
|
||||
|
||||
default:
|
||||
$app->setUserState('com_modules.add.module.extension_id', null);
|
||||
break;
|
||||
}
|
||||
|
||||
$app->setUserState('com_modules.add.module.params', null);
|
||||
}
|
||||
}
|
||||
65
administrator/components/com_modules/controllers/modules.php
Normal file
65
administrator/components/com_modules/controllers/modules.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Modules list controller class.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
* @since 1.6
|
||||
*/
|
||||
class ModulesControllerModules extends JControllerAdmin
|
||||
{
|
||||
/**
|
||||
* Method to clone an existing module.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function duplicate()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$pks = $this->input->post->get('cid', array(), 'array');
|
||||
JArrayHelper::toInteger($pks);
|
||||
|
||||
try {
|
||||
if (empty($pks))
|
||||
{
|
||||
throw new Exception(JText::_('COM_MODULES_ERROR_NO_MODULES_SELECTED'));
|
||||
}
|
||||
$model = $this->getModel();
|
||||
$model->duplicate($pks);
|
||||
$this->setMessage(JText::plural('COM_MODULES_N_MODULES_DUPLICATED', count($pks)));
|
||||
} catch (Exception $e)
|
||||
{
|
||||
JError::raiseWarning(500, $e->getMessage());
|
||||
}
|
||||
|
||||
$this->setRedirect('index.php?option=com_modules&view=modules');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 = 'Module', $prefix = 'ModulesModel', $config = array('ignore_request' => true))
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, $config);
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
229
administrator/components/com_modules/helpers/html/modules.php
Normal file
229
administrator/components/com_modules/helpers/html/modules.php
Normal file
@ -0,0 +1,229 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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_modules
|
||||
* @since 1.6
|
||||
*/
|
||||
abstract class JHtmlModules
|
||||
{
|
||||
/**
|
||||
* Builds an array of template options
|
||||
*
|
||||
* @param integer $clientId The client id
|
||||
* @param string $state The state of the template
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function templates($clientId = 0, $state = '')
|
||||
{
|
||||
$options = array();
|
||||
$templates = ModulesHelper::getTemplates($clientId, $state);
|
||||
|
||||
foreach ($templates as $template)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $template->element, $template->name);
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an array of template type options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function types()
|
||||
{
|
||||
$options = array();
|
||||
$options[] = JHtml::_('select.option', 'user', 'COM_MODULES_OPTION_POSITION_USER_DEFINED');
|
||||
$options[] = JHtml::_('select.option', 'template', 'COM_MODULES_OPTION_POSITION_TEMPLATE_DEFINED');
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an array of template state options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function templateStates()
|
||||
{
|
||||
$options = array();
|
||||
$options[] = JHtml::_('select.option', '1', 'JENABLED');
|
||||
$options[] = JHtml::_('select.option', '0', 'JDISABLED');
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a published state on a grid
|
||||
*
|
||||
* @param integer $value The state value.
|
||||
* @param integer $i The row index
|
||||
* @param boolean $enabled An optional setting for access control on the action.
|
||||
* @param string $checkbox An optional prefix for checkboxes.
|
||||
*
|
||||
* @return string The Html code
|
||||
*
|
||||
* @see JHtmlJGrid::state
|
||||
* @since 1.7.1
|
||||
*/
|
||||
public static function state($value, $i, $enabled = true, $checkbox = 'cb')
|
||||
{
|
||||
$states = array(
|
||||
1 => array(
|
||||
'unpublish',
|
||||
'COM_MODULES_EXTENSION_PUBLISHED_ENABLED',
|
||||
'COM_MODULES_HTML_UNPUBLISH_ENABLED',
|
||||
'COM_MODULES_EXTENSION_PUBLISHED_ENABLED',
|
||||
true,
|
||||
'publish',
|
||||
'publish'
|
||||
),
|
||||
0 => array(
|
||||
'publish',
|
||||
'COM_MODULES_EXTENSION_UNPUBLISHED_ENABLED',
|
||||
'COM_MODULES_HTML_PUBLISH_ENABLED',
|
||||
'COM_MODULES_EXTENSION_UNPUBLISHED_ENABLED',
|
||||
true,
|
||||
'unpublish',
|
||||
'unpublish'
|
||||
),
|
||||
-1 => array(
|
||||
'unpublish',
|
||||
'COM_MODULES_EXTENSION_PUBLISHED_DISABLED',
|
||||
'COM_MODULES_HTML_UNPUBLISH_DISABLED',
|
||||
'COM_MODULES_EXTENSION_PUBLISHED_DISABLED',
|
||||
true,
|
||||
'warning',
|
||||
'warning'
|
||||
),
|
||||
-2 => array(
|
||||
'publish',
|
||||
'COM_MODULES_EXTENSION_UNPUBLISHED_DISABLED',
|
||||
'COM_MODULES_HTML_PUBLISH_DISABLED',
|
||||
'COM_MODULES_EXTENSION_UNPUBLISHED_DISABLED',
|
||||
true,
|
||||
'unpublish',
|
||||
'unpublish'
|
||||
),
|
||||
);
|
||||
|
||||
return JHtml::_('jgrid.state', $states, $value, $i, 'modules.', $enabled, true, $checkbox);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a batch widget for the module position selector.
|
||||
*
|
||||
* @param integer $clientId The client ID
|
||||
*
|
||||
* @return string The necessary positions for the widget.
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
|
||||
public static function positions($clientId, $state = 1, $selectedPosition = '')
|
||||
{
|
||||
require_once JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php';
|
||||
$templates = array_keys(ModulesHelper::getTemplates($clientId, $state));
|
||||
$templateGroups = array();
|
||||
|
||||
// Add an empty value to be able to deselect a module position
|
||||
$option = ModulesHelper::createOption();
|
||||
$templateGroups[''] = ModulesHelper::createOptionGroup('', array($option));
|
||||
|
||||
// Add positions from templates
|
||||
$isTemplatePosition = false;
|
||||
foreach ($templates as $template)
|
||||
{
|
||||
$options = array();
|
||||
|
||||
$positions = TemplatesHelper::getPositions($clientId, $template);
|
||||
if (is_array($positions)) foreach ($positions as $position)
|
||||
{
|
||||
$text = ModulesHelper::getTranslatedModulePosition($clientId, $template, $position) . ' [' . $position . ']';
|
||||
$options[] = ModulesHelper::createOption($position, $text);
|
||||
|
||||
if (!$isTemplatePosition && $selectedPosition === $position)
|
||||
{
|
||||
$isTemplatePosition = true;
|
||||
}
|
||||
}
|
||||
|
||||
$templateGroups[$template] = ModulesHelper::createOptionGroup(ucfirst($template), $options);
|
||||
}
|
||||
|
||||
// Add custom position to options
|
||||
$customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION');
|
||||
|
||||
$editPositions = true;
|
||||
$customPositions = ModulesHelper::getPositions($clientId, $editPositions);
|
||||
$templateGroups[$customGroupText] = ModulesHelper::createOptionGroup($customGroupText, $customPositions);
|
||||
|
||||
return $templateGroups;
|
||||
}
|
||||
|
||||
public static function batchOptions()
|
||||
{
|
||||
// Create the copy/move options.
|
||||
$options = array(
|
||||
JHtml::_('select.option', 'c', JText::_('JLIB_HTML_BATCH_COPY')),
|
||||
JHtml::_('select.option', 'm', JText::_('JLIB_HTML_BATCH_MOVE'))
|
||||
);
|
||||
|
||||
echo JHtml::_('select.radiolist', $options, 'batch[move_copy]', '', 'value', 'text', 'm');
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the field options.
|
||||
*
|
||||
* @param integer $clientId The client ID
|
||||
*
|
||||
* @return array The field option objects.
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public static function positionList($clientId = 0)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('DISTINCT(position) as value')
|
||||
->select('position as text')
|
||||
->from($db->quoteName('#__modules'))
|
||||
->where($db->quoteName('client_id') . ' = ' . (int) $clientId)
|
||||
->order('position');
|
||||
|
||||
// Get the options.
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$options = $db->loadObjectList();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
JError::raiseWarning(500, $e->getMessage());
|
||||
}
|
||||
|
||||
// Pop the first item off the array if it's blank
|
||||
if (count($options))
|
||||
{
|
||||
if (strlen($options[0]->text) < 1)
|
||||
{
|
||||
array_shift($options);
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
1
administrator/components/com_modules/helpers/index.html
Normal file
1
administrator/components/com_modules/helpers/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
324
administrator/components/com_modules/helpers/modules.php
Normal file
324
administrator/components/com_modules/helpers/modules.php
Normal file
@ -0,0 +1,324 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Modules component helper.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
* @since 1.6
|
||||
*/
|
||||
abstract class ModulesHelper
|
||||
{
|
||||
/**
|
||||
* Configure the Linkbar.
|
||||
*
|
||||
* @param string $vName The name of the active view.
|
||||
*/
|
||||
public static function addSubmenu($vName)
|
||||
{
|
||||
// Not used in this component.
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of the actions that can be performed.
|
||||
*
|
||||
* @return JObject
|
||||
*/
|
||||
public static function getActions()
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$result = new JObject;
|
||||
|
||||
$actions = JAccess::getActions('com_modules');
|
||||
|
||||
foreach ($actions as $action)
|
||||
{
|
||||
$result->set($action->name, $user->authorise($action->name, 'com_modules'));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of filter options for the state of a module.
|
||||
*
|
||||
* @return array An array of JHtmlOption elements.
|
||||
*/
|
||||
public static function getStateOptions()
|
||||
{
|
||||
// Build the filter options.
|
||||
$options = array();
|
||||
$options[] = JHtml::_('select.option', '1', JText::_('JPUBLISHED'));
|
||||
$options[] = JHtml::_('select.option', '0', JText::_('JUNPUBLISHED'));
|
||||
$options[] = JHtml::_('select.option', '-2', JText::_('JTRASHED'));
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of filter options for the application clients.
|
||||
*
|
||||
* @return array An array of JHtmlOption elements.
|
||||
*/
|
||||
public static function getClientOptions()
|
||||
{
|
||||
// Build the filter options.
|
||||
$options = array();
|
||||
$options[] = JHtml::_('select.option', '0', JText::_('JSITE'));
|
||||
$options[] = JHtml::_('select.option', '1', JText::_('JADMINISTRATOR'));
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of modules positions
|
||||
*
|
||||
* @param integer $clientId Client ID
|
||||
*
|
||||
* @return array A list of positions
|
||||
*/
|
||||
public static function getPositions($clientId, $editPositions = false)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('DISTINCT(position)')
|
||||
->from('#__modules')
|
||||
->where($db->quoteName('client_id') . ' = ' . (int) $clientId)
|
||||
->order('position');
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$positions = $db->loadColumn();
|
||||
$positions = is_array($positions) ? $positions : array();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
JError::raiseWarning(500, $e->getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
// Build the list
|
||||
$options = array();
|
||||
foreach ($positions as $position)
|
||||
{
|
||||
if (!$position && !$editPositions)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', 'none', ':: ' . JText::_('JNONE') . ' ::');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $position, $position);
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of templates
|
||||
*
|
||||
* @param integer $clientId Client ID
|
||||
* @param string $state State
|
||||
* @param string $template Template name
|
||||
*
|
||||
* @return array List of templates
|
||||
*/
|
||||
public static function getTemplates($clientId = 0, $state = '', $template = '')
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
// Get the database object and a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Build the query.
|
||||
$query->select('element, name, enabled')
|
||||
->from('#__extensions')
|
||||
->where('client_id = ' . (int) $clientId)
|
||||
->where('type = ' . $db->quote('template'));
|
||||
if ($state != '')
|
||||
{
|
||||
$query->where('enabled = ' . $db->quote($state));
|
||||
}
|
||||
|
||||
if ($template != '')
|
||||
{
|
||||
$query->where('element = ' . $db->quote($template));
|
||||
}
|
||||
|
||||
// Set the query and load the templates.
|
||||
$db->setQuery($query);
|
||||
$templates = $db->loadObjectList('element');
|
||||
return $templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of the unique modules installed in the client application.
|
||||
*
|
||||
* @param int $clientId The client id.
|
||||
*
|
||||
* @return array Array of unique modules
|
||||
*/
|
||||
public static function getModules($clientId)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('element AS value, name AS text')
|
||||
->from('#__extensions as e')
|
||||
->where('e.client_id = ' . (int) $clientId)
|
||||
->where('type = ' . $db->quote('module'))
|
||||
->join('LEFT', '#__modules as m ON m.module=e.element AND m.client_id=e.client_id')
|
||||
->where('m.module IS NOT NULL')
|
||||
->group('element,name');
|
||||
|
||||
$db->setQuery($query);
|
||||
$modules = $db->loadObjectList();
|
||||
$lang = JFactory::getLanguage();
|
||||
|
||||
foreach ($modules as $i => $module)
|
||||
{
|
||||
$extension = $module->value;
|
||||
$path = $clientId ? JPATH_ADMINISTRATOR : JPATH_SITE;
|
||||
$source = $path . "/modules/$extension";
|
||||
$lang->load("$extension.sys", $path, null, false, false)
|
||||
|| $lang->load("$extension.sys", $source, null, false, false)
|
||||
|| $lang->load("$extension.sys", $path, $lang->getDefault(), false, false)
|
||||
|| $lang->load("$extension.sys", $source, $lang->getDefault(), false, false);
|
||||
$modules[$i]->text = JText::_($module->text);
|
||||
}
|
||||
JArrayHelper::sortObjects($modules, 'text', 1, true, true);
|
||||
return $modules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of the assignment options for modules to menus.
|
||||
*
|
||||
* @param int $clientId The client id.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getAssignmentOptions($clientId)
|
||||
{
|
||||
$options = array();
|
||||
$options[] = JHtml::_('select.option', '0', 'COM_MODULES_OPTION_MENU_ALL');
|
||||
$options[] = JHtml::_('select.option', '-', 'COM_MODULES_OPTION_MENU_NONE');
|
||||
|
||||
if ($clientId == 0)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', '1', 'COM_MODULES_OPTION_MENU_INCLUDE');
|
||||
$options[] = JHtml::_('select.option', '-1', 'COM_MODULES_OPTION_MENU_EXCLUDE');
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a translated module position name
|
||||
*
|
||||
* @param string $template Template name
|
||||
* @param string $position Position name
|
||||
*
|
||||
* @return string Return a translated position name
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static function getTranslatedModulePosition($clientId, $template, $position)
|
||||
{
|
||||
// Template translation
|
||||
$lang = JFactory::getLanguage();
|
||||
$path = $clientId ? JPATH_ADMINISTRATOR : JPATH_SITE;
|
||||
|
||||
$lang->load('tpl_'.$template.'.sys', $path, null, false, false)
|
||||
|| $lang->load('tpl_'.$template.'.sys', $path.'/templates/'.$template, null, false, false)
|
||||
|| $lang->load('tpl_'.$template.'.sys', $path, $lang->getDefault(), false, false)
|
||||
|| $lang->load('tpl_'.$template.'.sys', $path.'/templates/'.$template, $lang->getDefault(), false, false);
|
||||
|
||||
$langKey = strtoupper('TPL_' . $template . '_POSITION_' . $position);
|
||||
$text = JText::_($langKey);
|
||||
|
||||
// Avoid untranslated strings
|
||||
if (!self::isTranslatedText($langKey, $text))
|
||||
{
|
||||
// Modules component translation
|
||||
$langKey = strtoupper('COM_MODULES_POSITION_' . $position);
|
||||
$text = JText::_($langKey);
|
||||
|
||||
// Avoid untranslated strings
|
||||
if (!self::isTranslatedText($langKey, $text))
|
||||
{
|
||||
// Try to humanize the position name
|
||||
$text = ucfirst(preg_replace('/^' . $template . '\-/', '', $position));
|
||||
$text = ucwords(str_replace(array('-', '_'), ' ', $text));
|
||||
}
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the string was translated
|
||||
*
|
||||
* @param string $langKey Language file text key
|
||||
* @param string $text The "translated" text to be checked
|
||||
*
|
||||
* @return boolean Return true for translated text
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static function isTranslatedText($langKey, $text)
|
||||
{
|
||||
return $text !== $langKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and return a new Option
|
||||
*
|
||||
* @param string $value The option value [optional]
|
||||
* @param string $text The option text [optional]
|
||||
*
|
||||
* @return object The option as an object (stdClass instance)
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static function createOption($value = '', $text = '')
|
||||
{
|
||||
if (empty($text))
|
||||
{
|
||||
$text = $value;
|
||||
}
|
||||
|
||||
$option = new stdClass;
|
||||
$option->value = $value;
|
||||
$option->text = $text;
|
||||
|
||||
return $option;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and return a new Option Group
|
||||
*
|
||||
* @param string $label Value and label for group [optional]
|
||||
* @param array $options Array of options to insert into group [optional]
|
||||
*
|
||||
* @return array Return the new group as an array
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static function createOptionGroup($label = '', $options = array())
|
||||
{
|
||||
$group = array();
|
||||
$group['value'] = $label;
|
||||
$group['text'] = $label;
|
||||
$group['items'] = $options;
|
||||
|
||||
return $group;
|
||||
}
|
||||
}
|
||||
46
administrator/components/com_modules/helpers/xml.php
Normal file
46
administrator/components/com_modules/helpers/xml.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Helper for parse XML module files
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
* @since 1.5
|
||||
*/
|
||||
class ModulesHelperXML
|
||||
{
|
||||
/**
|
||||
* @since 1.5
|
||||
*/
|
||||
public function parseXMLModuleFile(&$rows)
|
||||
{
|
||||
foreach ($rows as $i => $row)
|
||||
{
|
||||
if ($row->module == '')
|
||||
{
|
||||
$rows[$i]->name = 'custom';
|
||||
$rows[$i]->module = 'custom';
|
||||
$rows[$i]->descrip = 'Custom created module, using Module Manager New function';
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = JInstaller::parseXMLInstallFile($row->path . '/' . $row->file);
|
||||
|
||||
if ($data['type'] == 'module')
|
||||
{
|
||||
$rows[$i]->name = $data['name'];
|
||||
$rows[$i]->descrip = $data['description'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
administrator/components/com_modules/index.html
Normal file
1
administrator/components/com_modules/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fields name="params">
|
||||
<fieldset
|
||||
name="advanced">
|
||||
|
||||
<field
|
||||
name="module_tag"
|
||||
type="moduletag"
|
||||
label="COM_MODULES_FIELD_MODULE_TAG_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULE_TAG_DESC"
|
||||
default="div"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="bootstrap_size"
|
||||
type="integer"
|
||||
first="0"
|
||||
last="12"
|
||||
step="1"
|
||||
label="COM_MODULES_FIELD_BOOTSTRAP_SIZE_LABEL"
|
||||
description="COM_MODULES_FIELD_BOOTSTRAP_SIZE_DESC"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="header_tag"
|
||||
type="headertag"
|
||||
default="h3"
|
||||
label="COM_MODULES_FIELD_HEADER_TAG_LABEL"
|
||||
description="COM_MODULES_FIELD_HEADER_TAG_DESC"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="header_class"
|
||||
type="text"
|
||||
label="COM_MODULES_FIELD_HEADER_CLASS_LABEL"
|
||||
description="COM_MODULES_FIELD_HEADER_CLASS_DESC"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="style"
|
||||
type="chromestyle"
|
||||
label="COM_MODULES_FIELD_MODULE_STYLE_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULE_STYLE_DESC"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
119
administrator/components/com_modules/models/forms/module.xml
Normal file
119
administrator/components/com_modules/models/forms/module.xml
Normal file
@ -0,0 +1,119 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fieldset>
|
||||
<field name="id" type="text"
|
||||
label="JGLOBAL_FIELD_ID_LABEL"
|
||||
description="JGLOBAL_FIELD_ID_DESC"
|
||||
default="0"
|
||||
readonly="true"
|
||||
/>
|
||||
|
||||
<field name="title" type="text"
|
||||
description="COM_MODULES_FIELD_TITLE_DESC"
|
||||
label="JGLOBAL_TITLE"
|
||||
maxlength="100"
|
||||
required="true"
|
||||
size="35"
|
||||
/>
|
||||
|
||||
<field name="note" type="text"
|
||||
description="COM_MODULES_FIELD_NOTE_DESC"
|
||||
label="COM_MODULES_FIELD_NOTE_LABEL"
|
||||
maxlength="100"
|
||||
size="35"
|
||||
/>
|
||||
|
||||
<field name="module" type="hidden"
|
||||
description="COM_MODULES_FIELD_MODULE_DESC"
|
||||
label="COM_MODULES_FIELD_MODULE_LABEL"
|
||||
readonly="readonly"
|
||||
size="20"
|
||||
/>
|
||||
|
||||
<field name="showtitle" type="radio"
|
||||
class="btn-group"
|
||||
default="1"
|
||||
description="COM_MODULES_FIELD_SHOWTITLE_DESC"
|
||||
label="COM_MODULES_FIELD_SHOWTITLE_LABEL"
|
||||
size="1"
|
||||
>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="0">JHIDE</option>
|
||||
</field>
|
||||
|
||||
<field name="published" type="radio"
|
||||
class="btn-group"
|
||||
default="1"
|
||||
description="COM_MODULES_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="publish_up" type="calendar"
|
||||
description="COM_MODULES_FIELD_PUBLISH_UP_DESC"
|
||||
filter="user_utc"
|
||||
class="input-medium"
|
||||
format="%Y-%m-%d %H:%M:%S"
|
||||
label="COM_MODULES_FIELD_PUBLISH_UP_LABEL"
|
||||
size="22"
|
||||
/>
|
||||
|
||||
<field name="publish_down" type="calendar"
|
||||
description="COM_MODULES_FIELD_PUBLISH_DOWN_DESC"
|
||||
filter="user_utc"
|
||||
class="input-medium"
|
||||
format="%Y-%m-%d %H:%M:%S"
|
||||
label="COM_MODULES_FIELD_PUBLISH_DOWN_LABEL"
|
||||
size="22"
|
||||
/>
|
||||
|
||||
<field name="client_id" type="hidden"
|
||||
description="COM_MODULES_FIELD_CLIENT_ID_DESC"
|
||||
label="COM_MODULES_FIELD_CLIENT_ID_LABEL"
|
||||
readonly="true"
|
||||
size="1"
|
||||
/>
|
||||
|
||||
<field name="position" type="moduleposition"
|
||||
default=""
|
||||
description="COM_MODULES_FIELD_POSITION_DESC"
|
||||
label="COM_MODULES_FIELD_POSITION_LABEL"
|
||||
maxlength="50"
|
||||
/>
|
||||
|
||||
<field name="access" type="accesslevel"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
size="1"
|
||||
/>
|
||||
|
||||
<field name="ordering" type="moduleorder"
|
||||
description="JFIELD_ORDERING_DESC"
|
||||
label="JFIELD_ORDERING_LABEL"
|
||||
/>
|
||||
|
||||
<field name="content" type="editor"
|
||||
buttons="true"
|
||||
class="inputbox"
|
||||
description="COM_MODULES_FIELD_CONTENT_DESC"
|
||||
filter="JComponentHelper::filterText"
|
||||
label="COM_MODULES_FIELD_CONTENT_LABEL"
|
||||
hide="readmore,pagebreak"
|
||||
/>
|
||||
|
||||
<field name="language" type="contentlanguage"
|
||||
description="JFIELD_MODULE_LANGUAGE_DESC"
|
||||
label="JFIELD_LANGUAGE_LABEL"
|
||||
>
|
||||
<option value="*">JALL</option>
|
||||
</field>
|
||||
|
||||
<field name="assignment" type="hidden" />
|
||||
|
||||
<field name="assigned" type="hidden" />
|
||||
</fieldset>
|
||||
</form>
|
||||
1
administrator/components/com_modules/models/index.html
Normal file
1
administrator/components/com_modules/models/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
1085
administrator/components/com_modules/models/module.php
Normal file
1085
administrator/components/com_modules/models/module.php
Normal file
File diff suppressed because it is too large
Load Diff
326
administrator/components/com_modules/models/modules.php
Normal file
326
administrator/components/com_modules/models/modules.php
Normal file
@ -0,0 +1,326 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Modules Component Module Model
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
* @since 1.5
|
||||
*/
|
||||
class ModulesModelModules 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(
|
||||
'id', 'a.id',
|
||||
'title', 'a.title',
|
||||
'checked_out', 'a.checked_out',
|
||||
'checked_out_time', 'a.checked_out_time',
|
||||
'published', 'a.published',
|
||||
'access', 'a.access', 'access_level',
|
||||
'ordering', 'a.ordering',
|
||||
'module', 'a.module',
|
||||
'language', 'a.language', 'language_title',
|
||||
'publish_up', 'a.publish_up',
|
||||
'publish_down', 'a.publish_down',
|
||||
'client_id', 'a.client_id',
|
||||
'position', 'a.position',
|
||||
'pages',
|
||||
'name', 'e.name',
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication('administrator');
|
||||
|
||||
// Load the filter state.
|
||||
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$accessId = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', null, 'int');
|
||||
$this->setState('filter.access', $accessId);
|
||||
|
||||
$state = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string');
|
||||
$this->setState('filter.state', $state);
|
||||
|
||||
$position = $this->getUserStateFromRequest($this->context . '.filter.position', 'filter_position', '', 'string');
|
||||
$this->setState('filter.position', $position);
|
||||
|
||||
$module = $this->getUserStateFromRequest($this->context . '.filter.module', 'filter_module', '', 'string');
|
||||
$this->setState('filter.module', $module);
|
||||
|
||||
$clientId = $this->getUserStateFromRequest($this->context . '.filter.client_id', 'filter_client_id', 0, 'int', false);
|
||||
$previousId = $app->getUserState($this->context . '.filter.client_id_previous', null);
|
||||
if ($previousId != $clientId || $previousId === null)
|
||||
{
|
||||
$this->getUserStateFromRequest($this->context . '.filter.client_id_previous', 'filter_client_id_previous', 0, 'int', true);
|
||||
$app->setUserState($this->context . '.filter.client_id_previous', $clientId);
|
||||
}
|
||||
$this->setState('filter.client_id', $clientId);
|
||||
|
||||
$language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '');
|
||||
$this->setState('filter.language', $language);
|
||||
|
||||
// Load the parameters.
|
||||
$params = JComponentHelper::getParams('com_modules');
|
||||
$this->setState('params', $params);
|
||||
|
||||
// List state information.
|
||||
parent::populateState('position', '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 A prefix for the store id.
|
||||
*
|
||||
* @return string A store id.
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
// Compile the store id.
|
||||
$id .= ':' . $this->getState('filter.search');
|
||||
$id .= ':' . $this->getState('filter.access');
|
||||
$id .= ':' . $this->getState('filter.state');
|
||||
$id .= ':' . $this->getState('filter.position');
|
||||
$id .= ':' . $this->getState('filter.module');
|
||||
$id .= ':' . $this->getState('filter.client_id');
|
||||
$id .= ':' . $this->getState('filter.language');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object list
|
||||
*
|
||||
* @param string The query
|
||||
* @param int Offset
|
||||
* @param int The number of records
|
||||
* @return array
|
||||
*/
|
||||
protected function _getList($query, $limitstart = 0, $limit = 0)
|
||||
{
|
||||
$ordering = $this->getState('list.ordering', 'ordering');
|
||||
if (in_array($ordering, array('pages', 'name')))
|
||||
{
|
||||
$this->_db->setQuery($query);
|
||||
$result = $this->_db->loadObjectList();
|
||||
$this->translate($result);
|
||||
JArrayHelper::sortObjects($result, $ordering, $this->getState('list.direction') == 'desc' ? -1 : 1, true, true);
|
||||
$total = count($result);
|
||||
$this->cache[$this->getStoreId('getTotal')] = $total;
|
||||
if ($total < $limitstart)
|
||||
{
|
||||
$limitstart = 0;
|
||||
$this->setState('list.start', 0);
|
||||
}
|
||||
return array_slice($result, $limitstart, $limit ? $limit : null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($ordering == 'ordering')
|
||||
{
|
||||
$query->order('a.position ASC');
|
||||
$ordering = 'a.ordering';
|
||||
}
|
||||
if ($ordering == 'language_title')
|
||||
{
|
||||
$ordering = 'l.title';
|
||||
}
|
||||
$query->order($this->_db->quoteName($ordering) . ' ' . $this->getState('list.direction'));
|
||||
if ($ordering == 'position')
|
||||
{
|
||||
$query->order('a.ordering ASC');
|
||||
}
|
||||
$result = parent::_getList($query, $limitstart, $limit);
|
||||
$this->translate($result);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate a list of objects
|
||||
*
|
||||
* @param array The array of objects
|
||||
* @return array The array of translated objects
|
||||
*/
|
||||
protected function translate(&$items)
|
||||
{
|
||||
$lang = JFactory::getLanguage();
|
||||
$client = $this->getState('filter.client_id') ? 'administrator' : 'site';
|
||||
|
||||
foreach ($items as $item)
|
||||
{
|
||||
$extension = $item->module;
|
||||
$source = constant('JPATH_' . strtoupper($client)) . "/modules/$extension";
|
||||
$lang->load("$extension.sys", constant('JPATH_' . strtoupper($client)), null, false, false)
|
||||
|| $lang->load("$extension.sys", $source, null, false, false)
|
||||
|| $lang->load("$extension.sys", constant('JPATH_' . strtoupper($client)), $lang->getDefault(), false, false)
|
||||
|| $lang->load("$extension.sys", $source, $lang->getDefault(), false, false);
|
||||
$item->name = JText::_($item->name);
|
||||
if (is_null($item->pages))
|
||||
{
|
||||
$item->pages = JText::_('JNONE');
|
||||
}
|
||||
elseif ($item->pages < 0)
|
||||
{
|
||||
$item->pages = JText::_('COM_MODULES_ASSIGNED_VARIES_EXCEPT');
|
||||
}
|
||||
elseif ($item->pages > 0)
|
||||
{
|
||||
$item->pages = JText::_('COM_MODULES_ASSIGNED_VARIES_ONLY');
|
||||
}
|
||||
else
|
||||
{
|
||||
$item->pages = JText::_('JALL');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an SQL query to load the list data.
|
||||
*
|
||||
* @return JDatabaseQuery
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Create a new query object.
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select the required fields from the table.
|
||||
$query->select(
|
||||
$this->getState(
|
||||
'list.select',
|
||||
'a.id, a.title, a.note, a.position, a.module, a.language,' .
|
||||
'a.checked_out, a.checked_out_time, a.published+2*(e.enabled-1) as published, a.access, a.ordering, a.publish_up, a.publish_down'
|
||||
)
|
||||
);
|
||||
$query->from($db->quoteName('#__modules') . ' AS a');
|
||||
|
||||
// Join over the language
|
||||
$query->select('l.title AS language_title')
|
||||
->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language');
|
||||
|
||||
// Join over the users for the checked out user.
|
||||
$query->select('uc.name AS editor')
|
||||
->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level')
|
||||
->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
|
||||
// Join over the module menus
|
||||
$query->select('MIN(mm.menuid) AS pages')
|
||||
->join('LEFT', '#__modules_menu AS mm ON mm.moduleid = a.id');
|
||||
|
||||
// Join over the extensions
|
||||
$query->select('e.name AS name')
|
||||
->join('LEFT', '#__extensions AS e ON e.element = a.module')
|
||||
->group(
|
||||
'a.id, a.title, a.note, a.position, a.module, a.language,a.checked_out,' .
|
||||
'a.checked_out_time, a.published, a.access, a.ordering,l.title, uc.name, ag.title, e.name,' .
|
||||
'l.lang_code, uc.id, ag.id, mm.moduleid, e.element, a.publish_up, a.publish_down,e.enabled'
|
||||
);
|
||||
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
|
||||
// Filter by published state
|
||||
$state = $this->getState('filter.state');
|
||||
if (is_numeric($state))
|
||||
{
|
||||
$query->where('a.published = ' . (int) $state);
|
||||
}
|
||||
elseif ($state === '')
|
||||
{
|
||||
$query->where('(a.published IN (0, 1))');
|
||||
}
|
||||
|
||||
// Filter by position
|
||||
$position = $this->getState('filter.position');
|
||||
if ($position && $position != 'none')
|
||||
{
|
||||
$query->where('a.position = ' . $db->quote($position));
|
||||
}
|
||||
|
||||
elseif ($position == 'none')
|
||||
{
|
||||
$query->where('a.position = ' . $db->quote(''));
|
||||
}
|
||||
|
||||
// Filter by module
|
||||
$module = $this->getState('filter.module');
|
||||
if ($module)
|
||||
{
|
||||
$query->where('a.module = ' . $db->quote($module));
|
||||
}
|
||||
|
||||
// Filter by client.
|
||||
$clientId = $this->getState('filter.client_id');
|
||||
if (is_numeric($clientId))
|
||||
{
|
||||
$query->where('a.client_id = ' . (int) $clientId . ' AND e.client_id =' . (int) $clientId);
|
||||
}
|
||||
|
||||
// Filter by search in title
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
{
|
||||
if (stripos($search, 'id:') === 0)
|
||||
{
|
||||
$query->where('a.id = ' . (int) substr($search, 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
$search = $db->quote('%' . $db->escape($search, true) . '%');
|
||||
$query->where('(' . 'a.title LIKE ' . $search . ' OR a.note LIKE ' . $search . ')');
|
||||
}
|
||||
}
|
||||
|
||||
// Filter on the language.
|
||||
if ($language = $this->getState('filter.language'))
|
||||
{
|
||||
$query->where('a.language = ' . $db->quote($language));
|
||||
}
|
||||
|
||||
//echo nl2br(str_replace('#__','jos_',$query));
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
219
administrator/components/com_modules/models/positions.php
Normal file
219
administrator/components/com_modules/models/positions.php
Normal file
@ -0,0 +1,219 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Modules Component Positions Model
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
* @since 1.6
|
||||
*/
|
||||
class ModulesModelPositions 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(
|
||||
'value',
|
||||
'templates',
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication('administrator');
|
||||
|
||||
// Load the filter state.
|
||||
$search = $this->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$state = $this->getUserStateFromRequest($this->context.'.filter.state', 'filter_state', '', 'string');
|
||||
$this->setState('filter.state', $state);
|
||||
|
||||
$clientId = $app->input->getInt('client_id', 0);
|
||||
$this->setState('filter.client_id', $clientId);
|
||||
|
||||
$template = $this->getUserStateFromRequest($this->context.'.filter.template', 'filter_template', '', 'string');
|
||||
$this->setState('filter.template', $template);
|
||||
|
||||
$type = $this->getUserStateFromRequest($this->context.'.filter.type', 'filter_type', '', 'string');
|
||||
$this->setState('filter.type', $type);
|
||||
|
||||
// Load the parameters.
|
||||
$params = JComponentHelper::getParams('com_modules');
|
||||
$this->setState('params', $params);
|
||||
|
||||
// List state information.
|
||||
parent::populateState('value', 'asc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get an array of data items.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
if (!isset($this->items))
|
||||
{
|
||||
$lang = JFactory::getLanguage();
|
||||
$search = $this->getState('filter.search');
|
||||
$state = $this->getState('filter.state');
|
||||
$clientId = $this->getState('filter.client_id');
|
||||
$filter_template = $this->getState('filter.template');
|
||||
$type = $this->getState('filter.type');
|
||||
$ordering = $this->getState('list.ordering');
|
||||
$direction = $this->getState('list.direction');
|
||||
$limitstart = $this->getState('list.start');
|
||||
$limit = $this->getState('list.limit');
|
||||
$client = JApplicationHelper::getClientInfo($clientId);
|
||||
|
||||
if ($type != 'template')
|
||||
{
|
||||
// Get the database object and a new query object.
|
||||
$query = $this->_db->getQuery(true)
|
||||
->select('DISTINCT(position) as value')
|
||||
->from('#__modules')
|
||||
->where($this->_db->quoteName('client_id').' = '.(int) $clientId);
|
||||
if ($search)
|
||||
{
|
||||
$query->where('position LIKE '.$this->_db->quote('%'.$this->_db->escape($search, true).'%'));
|
||||
}
|
||||
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$positions = $this->_db->loadObjectList('value');
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
$this->setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
foreach ($positions as $value => $position)
|
||||
{
|
||||
$positions[$value] = array();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$positions = array();
|
||||
}
|
||||
|
||||
// Load the positions from the installed templates.
|
||||
foreach (ModulesHelper::getTemplates($clientId) as $template)
|
||||
{
|
||||
$path = JPath::clean($client->path.'/templates/'.$template->element.'/templateDetails.xml');
|
||||
|
||||
if (file_exists($path))
|
||||
{
|
||||
$xml = simplexml_load_file($path);
|
||||
if (isset($xml->positions[0]))
|
||||
{
|
||||
$lang->load('tpl_'.$template->element.'.sys', $client->path, null, false, false)
|
||||
|| $lang->load('tpl_'.$template->element.'.sys', $client->path.'/templates/'.$template->element, null, false, false)
|
||||
|| $lang->load('tpl_'.$template->element.'.sys', $client->path, $lang->getDefault(), false, false)
|
||||
|| $lang->load('tpl_'.$template->element.'.sys', $client->path.'/templates/'.$template->element, $lang->getDefault(), false, false);
|
||||
foreach ($xml->positions[0] as $position)
|
||||
{
|
||||
$value = (string) $position['value'];
|
||||
$label = (string) $position;
|
||||
if (!$value)
|
||||
{
|
||||
$value = $label;
|
||||
$label = preg_replace('/[^a-zA-Z0-9_\-]/', '_', 'TPL_'.$template->element.'_POSITION_'.$value);
|
||||
$altlabel = preg_replace('/[^a-zA-Z0-9_\-]/', '_', 'COM_MODULES_POSITION_'.$value);
|
||||
if (!$lang->hasKey($label) && $lang->hasKey($altlabel))
|
||||
{
|
||||
$label = $altlabel;
|
||||
}
|
||||
}
|
||||
if ($type == 'user' || ($state != '' && $state != $template->enabled))
|
||||
{
|
||||
unset($positions[$value]);
|
||||
}
|
||||
elseif (preg_match(chr(1) . $search . chr(1) . 'i', $value) && ($filter_template == '' || $filter_template == $template->element))
|
||||
{
|
||||
if (!isset($positions[$value]))
|
||||
{
|
||||
$positions[$value] = array();
|
||||
}
|
||||
$positions[$value][$template->name] = $label;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->total = count($positions);
|
||||
if ($limitstart >= $this->total)
|
||||
{
|
||||
$limitstart = $limitstart < $limit ? 0 : $limitstart - $limit;
|
||||
$this->setState('list.start', $limitstart);
|
||||
}
|
||||
if ($ordering == 'value')
|
||||
{
|
||||
if ($direction == 'asc')
|
||||
{
|
||||
ksort($positions);
|
||||
}
|
||||
else {
|
||||
krsort($positions);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($direction == 'asc')
|
||||
{
|
||||
asort($positions);
|
||||
}
|
||||
else {
|
||||
arsort($positions);
|
||||
}
|
||||
}
|
||||
$this->items = array_slice($positions, $limitstart, $limit ? $limit : null);
|
||||
}
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the total number of items.
|
||||
*
|
||||
* @return int The total number of items.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getTotal()
|
||||
{
|
||||
if (!isset($this->total))
|
||||
{
|
||||
$this->getItems();
|
||||
}
|
||||
return $this->total;
|
||||
}
|
||||
}
|
||||
153
administrator/components/com_modules/models/select.php
Normal file
153
administrator/components/com_modules/models/select.php
Normal file
@ -0,0 +1,153 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Module model.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
* @since 1.6
|
||||
*/
|
||||
class ModulesModelSelect extends JModelList
|
||||
{
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication('administrator');
|
||||
|
||||
// Load the filter state.
|
||||
$clientId = $app->getUserState('com_modules.modules.filter.client_id', 0);
|
||||
$this->setState('filter.client_id', (int) $clientId);
|
||||
|
||||
// Load the parameters.
|
||||
$params = JComponentHelper::getParams('com_modules');
|
||||
$this->setState('params', $params);
|
||||
|
||||
// Manually set limits to get all modules.
|
||||
$this->setState('list.limit', 0);
|
||||
$this->setState('list.start', 0);
|
||||
$this->setState('list.ordering', 'a.name');
|
||||
$this->setState('list.direction', '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 A prefix for the store id.
|
||||
*
|
||||
* @return string A store id.
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
// Compile the store id.
|
||||
$id .= ':' . $this->getState('filter.client_id');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an SQL query to load the list data.
|
||||
*
|
||||
* @return JDatabaseQuery
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Create a new query object.
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select the required fields from the table.
|
||||
$query->select(
|
||||
$this->getState(
|
||||
'list.select',
|
||||
'a.extension_id, a.name, a.element AS module'
|
||||
)
|
||||
);
|
||||
$query->from($db->quoteName('#__extensions') . ' AS a');
|
||||
|
||||
// Filter by module
|
||||
$query->where('a.type = ' . $db->quote('module'));
|
||||
|
||||
// Filter by client.
|
||||
$clientId = $this->getState('filter.client_id');
|
||||
$query->where('a.client_id = ' . (int) $clientId);
|
||||
|
||||
// Filter by enabled
|
||||
$query->where('a.enabled = 1');
|
||||
|
||||
// Add the list ordering clause.
|
||||
$query->order($db->escape($this->getState('list.ordering', 'a.ordering')) . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
|
||||
|
||||
//echo nl2br(str_replace('#__','jos_',$query));
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a list of items.
|
||||
*
|
||||
* @return mixed An array of objects on success, false on failure.
|
||||
*/
|
||||
public function &getItems()
|
||||
{
|
||||
// Get the list of items from the database.
|
||||
$items = parent::getItems();
|
||||
|
||||
$client = JApplicationHelper::getClientInfo($this->getState('filter.client_id', 0));
|
||||
$lang = JFactory::getLanguage();
|
||||
|
||||
// Loop through the results to add the XML metadata,
|
||||
// and load language support.
|
||||
foreach ($items as &$item)
|
||||
{
|
||||
$path = JPath::clean($client->path . '/modules/' . $item->module . '/' . $item->module . '.xml');
|
||||
if (file_exists($path))
|
||||
{
|
||||
$item->xml = simplexml_load_file($path);
|
||||
}
|
||||
else
|
||||
{
|
||||
$item->xml = null;
|
||||
}
|
||||
|
||||
// 1.5 Format; Core files or language packs then
|
||||
// 1.6 3PD Extension Support
|
||||
$lang->load($item->module . '.sys', $client->path, null, false, false)
|
||||
|| $lang->load($item->module . '.sys', $client->path . '/modules/' . $item->module, null, false, false)
|
||||
|| $lang->load($item->module . '.sys', $client->path, $lang->getDefault(), false, false)
|
||||
|| $lang->load($item->module . '.sys', $client->path . '/modules/' . $item->module, $lang->getDefault(), false, false);
|
||||
$item->name = JText::_($item->name);
|
||||
|
||||
if (isset($item->xml) && $text = trim($item->xml->description))
|
||||
{
|
||||
$item->desc = JText::_($text);
|
||||
}
|
||||
else
|
||||
{
|
||||
$item->desc = JText::_('COM_MODULES_NODESCRIPTION');
|
||||
}
|
||||
}
|
||||
$items = JArrayHelper::sortObjects($items, 'name', 1, true, true);
|
||||
|
||||
// TODO: Use the cached XML from the extensions table?
|
||||
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
19
administrator/components/com_modules/modules.php
Normal file
19
administrator/components/com_modules/modules.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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_modules'))
|
||||
{
|
||||
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
|
||||
}
|
||||
|
||||
$controller = JControllerLegacy::getInstance('Modules');
|
||||
$controller->execute(JFactory::getApplication()->input->get('task'));
|
||||
$controller->redirect();
|
||||
28
administrator/components/com_modules/modules.xml
Normal file
28
administrator/components/com_modules/modules.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.1" method="upgrade">
|
||||
<name>com_modules</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>April 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_MODULES_XML_DESCRIPTION</description>
|
||||
<administration>
|
||||
<files folder="admin">
|
||||
<filename>config.xml</filename>
|
||||
<filename>controller.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>modules.php</filename>
|
||||
<folder>controllers</folder>
|
||||
<folder>helpers</folder>
|
||||
<folder>models</folder>
|
||||
<folder>views</folder>
|
||||
</files>
|
||||
<languages folder="admin">
|
||||
<language tag="en-GB">language/en-GB.com_modules.ini</language>
|
||||
<language tag="en-GB">language/en-GB.com_modules.sys.ini</language>
|
||||
</languages>
|
||||
</administration>
|
||||
</extension>
|
||||
1
administrator/components/com_modules/views/index.html
Normal file
1
administrator/components/com_modules/views/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
193
administrator/components/com_modules/views/module/tmpl/edit.php
Normal file
193
administrator/components/com_modules/views/module/tmpl/edit.php
Normal file
@ -0,0 +1,193 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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.combobox');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
|
||||
$hasContent = empty($this->item->module) || $this->item->module == 'custom' || $this->item->module == 'mod_custom';
|
||||
|
||||
// Get Params Fieldsets
|
||||
$this->fieldsets = $this->form->getFieldsets('params');
|
||||
|
||||
|
||||
$script = "Joomla.submitbutton = function(task)
|
||||
{
|
||||
if (task == 'module.cancel' || document.formvalidator.isValid(document.id('module-form'))) {";
|
||||
if ($hasContent)
|
||||
{
|
||||
$script .= $this->form->getField('content')->save();
|
||||
}
|
||||
$script .= " Joomla.submitform(task, document.getElementById('module-form'));
|
||||
if (self != top)
|
||||
{
|
||||
window.top.setTimeout('window.parent.SqueezeBox.close()', 1000);
|
||||
}
|
||||
}
|
||||
}";
|
||||
|
||||
JFactory::getDocument()->addScriptDeclaration($script);
|
||||
?>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_modules&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="module-form" class="form-validate form-horizontal">
|
||||
<fieldset>
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#details" data-toggle="tab"><?php echo JText::_('JDETAILS'); ?></a></li>
|
||||
<li><a href="#options" data-toggle="tab"><?php echo JText::_('JOPTIONS'); ?></a></li>
|
||||
|
||||
<?php if ($hasContent) : ?>
|
||||
<li><a href="#custom" data-toggle="tab"><?php echo JText::_('COM_MODULES_CUSTOM_OUTPUT'); ?></a></li>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->item->client_id == 0) : ?>
|
||||
<li><a href="#assignment" data-toggle="tab"><?php echo JText::_('COM_MODULES_MENU_ASSIGNMENT'); ?></a></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="details">
|
||||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
<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('showtitle'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('showtitle'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('position'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->loadTemplate('positions'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<?php if ((string) $this->item->xml->name != 'Login Form') : ?>
|
||||
<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('ordering'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('ordering'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ((string) $this->item->xml->name != 'Login Form') : ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('publish_up'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('publish_up'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('publish_down'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('publish_down'); ?>
|
||||
</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('note'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('note'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="span6">
|
||||
<?php if ($this->item->xml) : ?>
|
||||
<?php if ($text = trim($this->item->xml->description)) : ?>
|
||||
<blockquote>
|
||||
<h4>
|
||||
<?php echo JText::_('COM_MODULES_MODULE_DESCRIPTION'); ?>
|
||||
<?php if ($this->item->id) : ?>
|
||||
<span class="label label-info"><?php echo JText::_('JGRID_HEADING_ID'); ?> : <?php echo $this->item->id; ?></span>
|
||||
<?php endif; ?>
|
||||
</h4>
|
||||
<hr />
|
||||
<div>
|
||||
<?php echo JText::_($text); ?>
|
||||
</div>
|
||||
<hr />
|
||||
<div>
|
||||
<span class="label"><?php echo $this->item->client_id == 0 ? JText::_('JSITE') : JText::_('JADMINISTRATOR'); ?></span> / <span class="label"><?php if ($this->item->xml) echo ($text = (string) $this->item->xml->name) ? JText::_($text) : $this->item->module;else echo JText::_('COM_MODULES_ERR_XML');?></span>
|
||||
</div>
|
||||
</blockquote>
|
||||
<?php endif; ?>
|
||||
<?php else : ?>
|
||||
<div class="alert alert-error"><?php echo JText::_('COM_MODULES_ERR_XML'); ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="options">
|
||||
<?php echo $this->loadTemplate('options'); ?>
|
||||
</div>
|
||||
|
||||
<?php if ($hasContent) : ?>
|
||||
<div class="tab-pane" id="custom">
|
||||
<?php echo $this->form->getInput('content'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->item->client_id == 0) : ?>
|
||||
<div class="tab-pane" id="assignment">
|
||||
<?php echo $this->loadTemplate('assignment'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
<?php echo $this->form->getInput('module'); ?>
|
||||
<?php echo $this->form->getInput('client_id'); ?>
|
||||
</fieldset>
|
||||
</form>
|
||||
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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;
|
||||
|
||||
// Initiasile related data.
|
||||
require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php';
|
||||
$menuTypes = MenusHelper::getMenuLinks();
|
||||
|
||||
JHtml::_('script', 'jui/treeselectmenu.jquery.min.js', false, true);
|
||||
|
||||
$script = "
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
menuHide(jQuery('#jform_assignment').val());
|
||||
jQuery('#jform_assignment').change(function()
|
||||
{
|
||||
menuHide(jQuery(this).val());
|
||||
})
|
||||
});
|
||||
function menuHide(val)
|
||||
{
|
||||
if (val == 0 || val == '-')
|
||||
{
|
||||
jQuery('#menuselect-group').hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#menuselect-group').show();
|
||||
}
|
||||
}
|
||||
";
|
||||
// Add the script to the document head
|
||||
JFactory::getDocument()->addScriptDeclaration($script);
|
||||
?>
|
||||
<div class="control-group">
|
||||
<label id="jform_menus-lbl" class="control-label" for="jform_menus"><?php echo JText::_('COM_MODULES_MODULE_ASSIGN'); ?></label>
|
||||
|
||||
<div id="jform_menus" class="controls">
|
||||
<select name="jform[assignment]" id="jform_assignment">
|
||||
<?php echo JHtml::_('select.options', ModulesHelper::getAssignmentOptions($this->item->client_id), 'value', 'text', $this->item->assignment, true); ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="menuselect-group" class="control-group">
|
||||
<label id="jform_menuselect-lbl" class="control-label" for="jform_menuselect"><?php echo JText::_('JGLOBAL_MENU_SELECTION'); ?></label>
|
||||
|
||||
<div id="jform_menuselect" class="controls">
|
||||
<?php if (!empty($menuTypes)) : ?>
|
||||
<?php $id = 'jform_menuselect'; ?>
|
||||
|
||||
<div class="well well-small">
|
||||
<div class="form-inline">
|
||||
<span class="small"><?php echo JText::_('JSELECT'); ?>:
|
||||
<a id="treeCheckAll" href="javascript://"><?php echo JText::_('JALL'); ?></a>,
|
||||
<a id="treeUncheckAll" href="javascript://"><?php echo JText::_('JNONE'); ?></a>
|
||||
</span>
|
||||
<span class="width-20">|</span>
|
||||
<span class="small"><?php echo JText::_('COM_MODULES_EXPAND'); ?>:
|
||||
<a id="treeExpandAll" href="javascript://"><?php echo JText::_('JALL'); ?></a>,
|
||||
<a id="treeCollapseAll" href="javascript://"><?php echo JText::_('JNONE'); ?></a>
|
||||
</span>
|
||||
<input type="text" id="treeselectfilter" name="treeselectfilter" class="input-medium search-query pull-right" size="16"
|
||||
autocomplete="off" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" aria-invalid="false" tabindex="-1">
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<hr class="hr-condensed" />
|
||||
|
||||
<ul class="treeselect">
|
||||
<?php foreach ($menuTypes as &$type) : ?>
|
||||
<?php if (count($type->links)) : ?>
|
||||
<?php $prevlevel = 0; ?>
|
||||
<li>
|
||||
<div class="treeselect-item pull-left">
|
||||
<label class="pull-left nav-header"><?php echo $type->title; ?></label></div>
|
||||
<?php foreach ($type->links as $i => $link) : ?>
|
||||
<?php
|
||||
if ($prevlevel < $link->level)
|
||||
{
|
||||
echo '<ul class="treeselect-sub">';
|
||||
} elseif ($prevlevel > $link->level)
|
||||
{
|
||||
echo str_repeat('</li></ul>', $prevlevel - $link->level);
|
||||
} else {
|
||||
echo '</li>';
|
||||
}
|
||||
$selected = 0;
|
||||
if ($this->item->assignment == 0)
|
||||
{
|
||||
$selected = 1;
|
||||
} elseif ($this->item->assignment < 0)
|
||||
{
|
||||
$selected = in_array(-$link->value, $this->item->assigned);
|
||||
} elseif ($this->item->assignment > 0)
|
||||
{
|
||||
$selected = in_array($link->value, $this->item->assigned);
|
||||
}
|
||||
?>
|
||||
<li>
|
||||
<div class="treeselect-item pull-left">
|
||||
<input type="checkbox" class="pull-left" name="jform[assigned][]" id="<?php echo $id . $link->value; ?>" value="<?php echo (int) $link->value; ?>"<?php echo $selected ? ' checked="checked"' : ''; ?> />
|
||||
<label for="<?php echo $id . $link->value; ?>" class="pull-left"><?php echo $link->text; ?> <span class="small"><?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($link->alias));?></span></label>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
if (!isset($type->links[$i + 1]))
|
||||
{
|
||||
echo str_repeat('</li></ul>', $link->level);
|
||||
}
|
||||
$prevlevel = $link->level;
|
||||
?>
|
||||
<?php endforeach; ?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<div style="display:none;" id="treeselectmenu">
|
||||
<div class="pull-left nav-hover treeselect-menu">
|
||||
<div class="btn-group">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle btn btn-micro">
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="nav-header"><?php echo JText::_('COM_MODULES_SUBITEMS'); ?></li>
|
||||
<li class="divider"></li>
|
||||
<li class=""><a class="checkall" href="javascript://"><i class="icon-checkbox"></i> <?php echo JText::_('JSELECT'); ?></a>
|
||||
</li>
|
||||
<li><a class="uncheckall" href="javascript://"><i class="icon-checkbox-unchecked"></i> <?php echo JText::_('COM_MODULES_DESELECT'); ?></a>
|
||||
</li>
|
||||
<div class="treeselect-menu-expand">
|
||||
<li class="divider"></li>
|
||||
<li><a class="expandall" href="javascript://"><i class="icon-plus"></i> <?php echo JText::_('COM_MODULES_EXPAND'); ?></a></li>
|
||||
<li><a class="collapseall" href="javascript://"><i class="icon-minus"></i> <?php echo JText::_('COM_MODULES_COLLAPSE'); ?></a></li>
|
||||
</div>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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;
|
||||
?>
|
||||
<?php
|
||||
echo JHtml::_('bootstrap.startAccordion', 'moduleOptions', array('active' => 'collapse0'));
|
||||
$fieldSets = $this->form->getFieldsets('params');
|
||||
$i = 0;
|
||||
|
||||
foreach ($fieldSets as $name => $fieldSet) :
|
||||
$label = !empty($fieldSet->label) ? $fieldSet->label : 'COM_MODULES_'.$name.'_FIELDSET_LABEL';
|
||||
$class = isset($fieldSet->class) && !empty($fieldSet->class) ? $fieldSet->class : '';
|
||||
|
||||
echo JHtml::_('bootstrap.addSlide', 'moduleOptions', JText::_($label), 'collapse' . $i++, $class);
|
||||
if (isset($fieldSet->description) && trim($fieldSet->description)) :
|
||||
echo '<p class="tip">'.$this->escape(JText::_($fieldSet->description)).'</p>';
|
||||
endif;
|
||||
?>
|
||||
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $field->label; ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $field->input; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach;
|
||||
echo JHtml::_('bootstrap.endSlide');
|
||||
endforeach;
|
||||
echo JHtml::_('bootstrap.endAccordion');
|
||||
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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;
|
||||
|
||||
require_once JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php';
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
|
||||
$clientId = $this->item->client_id;
|
||||
$state = 1;
|
||||
$selectedPosition = $this->item->position;
|
||||
$positions = JHtml::_('modules.positions', $clientId, $state, $selectedPosition);
|
||||
|
||||
|
||||
// Add custom position to options
|
||||
$customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION');
|
||||
|
||||
// Build field
|
||||
$attr = array(
|
||||
'id' => 'jform_position',
|
||||
'list.select' => $this->item->position,
|
||||
'list.attr' => 'class="chzn-custom-value input-xlarge" '
|
||||
. 'data-custom_group_text="' . $customGroupText . '" '
|
||||
. 'data-no_results_text="' . JText::_('COM_MODULES_ADD_CUSTOM_POSITION') . '" '
|
||||
. 'data-placeholder="' . JText::_('COM_MODULES_TYPE_OR_SELECT_POSITION') . '" '
|
||||
);
|
||||
|
||||
echo JHtml::_('select.groupedlist', $positions, 'jform[position]', $attr);
|
||||
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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;
|
||||
?>
|
||||
<div class="btn-toolbar">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" onclick="Joomla.submitbutton('module.save');">
|
||||
<?php echo JText::_('JSAVE');?></button>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn" onclick="window.parent.SqueezeBox.close();">
|
||||
<?php echo JText::_('JCANCEL');?></button>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$this->setLayout('edit');
|
||||
echo $this->loadTemplate();
|
||||
103
administrator/components/com_modules/views/module/view.html.php
Normal file
103
administrator/components/com_modules/views/module/view.html.php
Normal file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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 a module.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
* @since 1.6
|
||||
*/
|
||||
class ModulesViewModule extends JViewLegacy
|
||||
{
|
||||
protected $form;
|
||||
|
||||
protected $item;
|
||||
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* Display the view
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$this->form = $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
$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()
|
||||
{
|
||||
JFactory::getApplication()->input->set('hidemainmenu', true);
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$isNew = ($this->item->id == 0);
|
||||
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
|
||||
$canDo = ModulesHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
|
||||
|
||||
JToolbarHelper::title(JText::sprintf('COM_MODULES_MANAGER_MODULE', JText::_($this->item->module)), 'module.png');
|
||||
|
||||
// If not checked out, can save the item.
|
||||
if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create') ))
|
||||
{
|
||||
JToolbarHelper::apply('module.apply');
|
||||
JToolbarHelper::save('module.save');
|
||||
}
|
||||
if (!$checkedOut && $canDo->get('core.create'))
|
||||
{
|
||||
JToolbarHelper::save2new('module.save2new');
|
||||
}
|
||||
// If an existing item, can save to a copy.
|
||||
if (!$isNew && $canDo->get('core.create'))
|
||||
{
|
||||
JToolbarHelper::save2copy('module.save2copy');
|
||||
}
|
||||
if (empty($this->item->id))
|
||||
{
|
||||
JToolbarHelper::cancel('module.cancel');
|
||||
}
|
||||
else
|
||||
{
|
||||
JToolbarHelper::cancel('module.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
|
||||
// Get the help information for the menu item.
|
||||
$lang = JFactory::getLanguage();
|
||||
|
||||
$help = $this->get('Help');
|
||||
if ($lang->hasKey($help->url))
|
||||
{
|
||||
$debug = $lang->setDebug(false);
|
||||
$url = JText::_($help->url);
|
||||
$lang->setDebug($debug);
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = null;
|
||||
}
|
||||
JToolbarHelper::help($help->key, false, $url);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
@ -0,0 +1,257 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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::_('bootstrap.tooltip');
|
||||
JHtml::_('behavior.multiselect');
|
||||
JHtml::_('dropdown.init');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
|
||||
$client = $this->state->get('filter.client_id') ? 'administrator' : 'site';
|
||||
$user = JFactory::getUser();
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
$trashed = $this->state->get('filter.published') == -2 ? true : false;
|
||||
$canOrder = $user->authorise('core.edit.state', 'com_modules');
|
||||
$saveOrder = $listOrder == 'ordering';
|
||||
if ($saveOrder)
|
||||
{
|
||||
$saveOrderingUrl = 'index.php?option=com_modules&task=modules.saveOrderAjax&tmpl=component';
|
||||
JHtml::_('sortablelist.sortable', 'articleList', 'adminForm', strtolower($listDirn), $saveOrderingUrl);
|
||||
}
|
||||
$sortFields = $this->getSortFields();
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
Joomla.orderTable = function()
|
||||
{
|
||||
table = document.getElementById("sortTable");
|
||||
direction = document.getElementById("directionTable");
|
||||
order = table.options[table.selectedIndex].value;
|
||||
if (order != '<?php echo $listOrder; ?>')
|
||||
{
|
||||
dirn = 'asc';
|
||||
}
|
||||
else
|
||||
{
|
||||
dirn = direction.options[direction.selectedIndex].value;
|
||||
}
|
||||
Joomla.tableOrdering(order, dirn, '');
|
||||
}
|
||||
</script>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_modules'); ?>" 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">
|
||||
<label for="filter_search" class="element-invisible"><?php echo JText::_('COM_BANNERS_SEARCH_IN_TITLE');?></label>
|
||||
<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_MODULES_MODULES_FILTER_SEARCH_DESC'); ?>" />
|
||||
</div>
|
||||
<div class="btn-group pull-left hidden-phone">
|
||||
<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 class="btn-group pull-right hidden-phone">
|
||||
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
|
||||
<?php echo $this->pagination->getLimitBox(); ?>
|
||||
</div>
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="directionTable" class="element-invisible"><?php echo JText::_('JFIELD_ORDERING_DESC');?></label>
|
||||
<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||
<option value=""><?php echo JText::_('JFIELD_ORDERING_DESC');?></option>
|
||||
<option value="asc" <?php if ($listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING');?></option>
|
||||
<option value="desc" <?php if ($listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_DESCENDING');?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="btn-group pull-right">
|
||||
<label for="sortTable" class="element-invisible"><?php echo JText::_('JGLOBAL_SORT_BY');?></label>
|
||||
<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||
<option value=""><?php echo JText::_('JGLOBAL_SORT_BY');?></option>
|
||||
<?php echo JHtml::_('select.options', $sortFields, 'value', 'text', $listOrder);?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"> </div>
|
||||
<table class="table table-striped" id="articleList">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="1%" class="nowrap center hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?>
|
||||
</th>
|
||||
<th width="1%" class="hidden-phone">
|
||||
<?php echo JHtml::_('grid.checkall'); ?>
|
||||
</th>
|
||||
<th width="1%" class="nowrap center">
|
||||
<?php echo JHtml::_('grid.sort', 'JSTATUS', 'a.published', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th class="title">
|
||||
<?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="15%" class="nowrap hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'COM_MODULES_HEADING_POSITION', 'position', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="10%" class="nowrap hidden-phone" >
|
||||
<?php echo JHtml::_('grid.sort', 'COM_MODULES_HEADING_MODULE', 'name', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="10%" class="nowrap hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'COM_MODULES_HEADING_PAGES', 'pages', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="10%" class="nowrap hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="5%" class="nowrap hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_LANGUAGE', 'language_title', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="1%" class="nowrap center hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.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 == 'ordering');
|
||||
$canCreate = $user->authorise('core.create', 'com_modules');
|
||||
$canEdit = $user->authorise('core.edit', 'com_modules');
|
||||
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id')|| $item->checked_out == 0;
|
||||
$canChange = $user->authorise('core.edit.state', 'com_modules') && $canCheckin;
|
||||
?>
|
||||
<tr class="row<?php echo $i % 2; ?>" sortable-group-id="<?php echo $item->position?>">
|
||||
<td class="order nowrap center hidden-phone">
|
||||
<?php
|
||||
$iconClass = '';
|
||||
if (!$canChange)
|
||||
{
|
||||
$iconClass = ' inactive';
|
||||
}
|
||||
elseif (!$saveOrder)
|
||||
{
|
||||
$iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
|
||||
}
|
||||
?>
|
||||
<span class="sortable-handler<?php echo $iconClass ?>">
|
||||
<i class="icon-menu"></i>
|
||||
</span>
|
||||
<?php if ($canChange && $saveOrder) : ?>
|
||||
<input type="text" style="display:none" name="order[]" size="5" value="<?php echo $item->ordering;?>" class="width-20 text-area-order" />
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="center hidden-phone">
|
||||
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php echo JHtml::_('modules.state', $item->published, $i, $canChange, 'cb'); ?>
|
||||
</td>
|
||||
<td class="has-context">
|
||||
<div class="pull-left">
|
||||
<?php if ($item->checked_out) : ?>
|
||||
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'modules.', $canCheckin); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($canEdit) : ?>
|
||||
<a href="<?php echo JRoute::_('index.php?option=com_modules&task=module.edit&id='.(int) $item->id); ?>">
|
||||
<?php echo $this->escape($item->title); ?></a>
|
||||
<?php else : ?>
|
||||
<?php echo $this->escape($item->title); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($item->note)) : ?>
|
||||
<div class="small">
|
||||
<?php echo JText::sprintf('JGLOBAL_LIST_NOTE', $this->escape($item->note));?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="pull-left">
|
||||
<?php
|
||||
// Create dropdown items
|
||||
JHtml::_('dropdown.edit', $item->id, 'module.');
|
||||
JHtml::_('dropdown.divider');
|
||||
if ($item->published) :
|
||||
JHtml::_('dropdown.unpublish', 'cb' . $i, 'modules.');
|
||||
else :
|
||||
JHtml::_('dropdown.publish', 'cb' . $i, 'modules.');
|
||||
endif;
|
||||
|
||||
JHtml::_('dropdown.divider');
|
||||
|
||||
if ($item->checked_out) :
|
||||
JHtml::_('dropdown.checkin', 'cb' . $i, 'modules.');
|
||||
endif;
|
||||
|
||||
if ($trashed) :
|
||||
JHtml::_('dropdown.untrash', 'cb' . $i, 'modules.');
|
||||
else :
|
||||
JHtml::_('dropdown.trash', 'cb' . $i, 'modules.');
|
||||
endif;
|
||||
|
||||
// Render dropdown list
|
||||
echo JHtml::_('dropdown.render');
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="small hidden-phone">
|
||||
<?php if ($item->position) : ?>
|
||||
<span class="label label-info">
|
||||
<?php echo $item->position; ?>
|
||||
</span>
|
||||
<?php else : ?>
|
||||
<span class="label">
|
||||
<?php echo JText::_('JNONE'); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="small hidden-phone">
|
||||
<?php echo $item->name;?>
|
||||
</td>
|
||||
<td class="small hidden-phone">
|
||||
<?php echo $item->pages; ?>
|
||||
</td>
|
||||
|
||||
<td class="small hidden-phone">
|
||||
<?php echo $this->escape($item->access_level); ?>
|
||||
</td>
|
||||
<td class="small hidden-phone">
|
||||
<?php if ($item->language == ''):?>
|
||||
<?php echo JText::_('JDEFAULT'); ?>
|
||||
<?php elseif ($item->language == '*'):?>
|
||||
<?php echo JText::alt('JALL', 'language'); ?>
|
||||
<?php else:?>
|
||||
<?php echo $item->language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?>
|
||||
<?php endif;?>
|
||||
</td>
|
||||
<td class="center hidden-phone">
|
||||
<?php echo (int) $item->id; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php //Load the batch processing form. ?>
|
||||
<?php echo $this->loadTemplate('batch'); ?>
|
||||
|
||||
<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>
|
||||
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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;
|
||||
|
||||
$clientId = $this->state->get('filter.client_id');
|
||||
$published = $this->state->get('filter.published');
|
||||
$positions = JHtml::_('modules.positions', $clientId, $published);
|
||||
|
||||
// Add custom position to options
|
||||
$customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION');
|
||||
|
||||
// Build field
|
||||
$attr = array(
|
||||
'id' => 'batch-position-id',
|
||||
'list.attr' => 'class="chzn-custom-value input-xlarge" '
|
||||
. 'data-custom_group_text="' . $customGroupText . '" '
|
||||
. 'data-no_results_text="' . JText::_('COM_MODULES_ADD_CUSTOM_POSITION') . '" '
|
||||
. 'data-placeholder="' . JText::_('COM_MODULES_TYPE_OR_SELECT_POSITION') . '" '
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="modal hide fade" id="collapseModal">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">x</button>
|
||||
<h3><?php echo JText::_('COM_MODULES_BATCH_OPTIONS');?></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p><?php echo JText::_('COM_MODULES_BATCH_TIP'); ?></p>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<?php echo JHtml::_('batch.access');?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<?php echo JHtml::_('batch.language'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($published >= 0) : ?>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label id="batch-choose-action-lbl" for="batch-choose-action">
|
||||
<?php echo JText::_('COM_MODULES_BATCH_POSITION_LABEL'); ?>
|
||||
</label>
|
||||
<div id="batch-choose-action" class="control-group">
|
||||
<?php echo JHtml::_('select.groupedlist', $positions, 'batch[position_id]', $attr) ?>
|
||||
<div id="batch-move-copy" class="control-group radio">
|
||||
<?php echo JHtml::_('modules.batchOptions'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" type="button" onclick="document.id('batch-position-id').value='';document.id('batch-access').value='';document.id('batch-language-id').value=''" data-dismiss="modal">
|
||||
<?php echo JText::_('JCANCEL'); ?>
|
||||
</button>
|
||||
<button class="btn btn-primary" type="submit" onclick="Joomla.submitbutton('module.batch');">
|
||||
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
202
administrator/components/com_modules/views/modules/view.html.php
Normal file
202
administrator/components/com_modules/views/modules/view.html.php
Normal file
@ -0,0 +1,202 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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 class for a list of modules.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
* @since 1.6
|
||||
*/
|
||||
class ModulesViewModules 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');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseError(500, implode("\n", $errors));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if there are no matching items
|
||||
if (!count($this->items)){
|
||||
JFactory::getApplication()->enqueueMessage(
|
||||
JText::_('COM_MODULES_MSG_MANAGE_NO_MODULES'),
|
||||
'warning'
|
||||
);
|
||||
}
|
||||
|
||||
$this->addToolbar();
|
||||
// Include the component HTML helpers.
|
||||
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar()
|
||||
{
|
||||
$state = $this->get('State');
|
||||
$canDo = ModulesHelper::getActions();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
// Get the toolbar object instance
|
||||
$bar = JToolBar::getInstance('toolbar');
|
||||
|
||||
JToolbarHelper::title(JText::_('COM_MODULES_MANAGER_MODULES'), 'module.png');
|
||||
|
||||
if ($canDo->get('core.create'))
|
||||
{
|
||||
$title = JText::_('JTOOLBAR_NEW');
|
||||
$dhtml = "<button onClick=\"location.href='index.php?option=com_modules&view=select'\" class=\"btn btn-small btn-success\">
|
||||
<i class=\"icon-plus icon-white\" title=\"$title\"></i>
|
||||
$title</button>";
|
||||
$bar->appendButton('Custom', $dhtml, 'new');
|
||||
}
|
||||
|
||||
if ($canDo->get('core.edit'))
|
||||
{
|
||||
JToolbarHelper::editList('module.edit');
|
||||
}
|
||||
|
||||
if ($canDo->get('core.create'))
|
||||
{
|
||||
JToolbarHelper::custom('modules.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true);
|
||||
}
|
||||
|
||||
if ($canDo->get('core.edit.state'))
|
||||
{
|
||||
JToolbarHelper::publish('modules.publish', 'JTOOLBAR_PUBLISH', true);
|
||||
JToolbarHelper::unpublish('modules.unpublish', 'JTOOLBAR_UNPUBLISH', true);
|
||||
JToolbarHelper::checkin('modules.checkin');
|
||||
}
|
||||
|
||||
if ($state->get('filter.state') == -2 && $canDo->get('core.delete'))
|
||||
{
|
||||
JToolbarHelper::deleteList('', 'modules.delete', 'JTOOLBAR_EMPTY_TRASH');
|
||||
} elseif ($canDo->get('core.edit.state'))
|
||||
{
|
||||
JToolbarHelper::trash('modules.trash');
|
||||
}
|
||||
|
||||
// Add a batch button
|
||||
if ($user->authorise('core.create', 'com_modules') && $user->authorise('core.edit', 'com_modules') && $user->authorise('core.edit.state', 'com_modules'))
|
||||
{
|
||||
JHtml::_('bootstrap.modal', 'collapseModal');
|
||||
$title = JText::_('JTOOLBAR_BATCH');
|
||||
|
||||
// Instantiate a new JLayoutFile instance and render the batch button
|
||||
$layout = new JLayoutFile('joomla.toolbar.batch');
|
||||
|
||||
$dhtml = $layout->render(array('title' => $title));
|
||||
$bar->appendButton('Custom', $dhtml, 'batch');
|
||||
}
|
||||
|
||||
if ($canDo->get('core.admin'))
|
||||
{
|
||||
JToolbarHelper::preferences('com_modules');
|
||||
}
|
||||
JToolbarHelper::help('JHELP_EXTENSIONS_MODULE_MANAGER');
|
||||
|
||||
JHtmlSidebar::addEntry(
|
||||
JText::_('JSITE'),
|
||||
'index.php?option=com_modules&filter_client_id=0',
|
||||
$this->state->get('filter.client_id') == 0
|
||||
);
|
||||
|
||||
JHtmlSidebar::addEntry(
|
||||
JText::_('JADMINISTRATOR'),
|
||||
'index.php?option=com_modules&filter_client_id=1',
|
||||
$this->state->get('filter.client_id') == 1
|
||||
);
|
||||
|
||||
JHtmlSidebar::setAction('index.php?option=com_modules');
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
// @todo we need a label for this
|
||||
'',
|
||||
'filter_client_id',
|
||||
JHtml::_('select.options', ModulesHelper::getClientOptions(), 'value', 'text', $this->state->get('filter.client_id')),
|
||||
false
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_PUBLISHED'),
|
||||
'filter_state',
|
||||
JHtml::_('select.options', ModulesHelper::getStateOptions(), 'value', 'text', $this->state->get('filter.state'))
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('COM_MODULES_OPTION_SELECT_POSITION'),
|
||||
'filter_position',
|
||||
JHtml::_('select.options', ModulesHelper::getPositions($this->state->get('filter.client_id')), 'value', 'text', $this->state->get('filter.position'))
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('COM_MODULES_OPTION_SELECT_MODULE'),
|
||||
'filter_module',
|
||||
JHtml::_('select.options', ModulesHelper::getModules($this->state->get('filter.client_id')), 'value', 'text', $this->state->get('filter.module'))
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_ACCESS'),
|
||||
'filter_access',
|
||||
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_LANGUAGE'),
|
||||
'filter_language',
|
||||
JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language'))
|
||||
);
|
||||
|
||||
$this->sidebar = JHtmlSidebar::render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of fields the table can be sorted by
|
||||
*
|
||||
* @return array Array containing the field name to sort by as the key and display text as value
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function getSortFields()
|
||||
{
|
||||
return array(
|
||||
'ordering' => JText::_('JGRID_HEADING_ORDERING'),
|
||||
'a.published' => JText::_('JSTATUS'),
|
||||
'a.title' => JText::_('JGLOBAL_TITLE'),
|
||||
'position' => JText::_('COM_MODULES_HEADING_POSITION'),
|
||||
'name' => JText::_('COM_MODULES_HEADING_MODULE'),
|
||||
'pages' => JText::_('COM_MODULES_HEADING_PAGES'),
|
||||
'a.access' => JText::_('JGRID_HEADING_ACCESS'),
|
||||
'language_title' => JText::_('JGRID_HEADING_LANGUAGE'),
|
||||
'a.id' => JText::_('JGRID_HEADING_ID')
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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::_('formbehavior.chosen', 'select');
|
||||
|
||||
$function = JFactory::getApplication()->input->getCmd('function', 'jSelectPosition');
|
||||
$lang = JFactory::getLanguage();
|
||||
$ordering = $this->escape($this->state->get('list.ordering'));
|
||||
$direction = $this->escape($this->state->get('list.direction'));
|
||||
$clientId = $this->state->get('filter.client_id');
|
||||
$state = $this->state->get('filter.state');
|
||||
$template = $this->state->get('filter.template');
|
||||
$type = $this->state->get('filter.type');
|
||||
?>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_modules&view=positions&layout=modal&tmpl=component&function='.$function.'&client_id=' .$clientId);?>" method="post" name="adminForm" id="adminForm">
|
||||
<fieldset class="filter clearfix">
|
||||
<div class="left">
|
||||
<label for="filter_search">
|
||||
<?php echo JText::_('JSearch_Filter_Label'); ?>
|
||||
</label>
|
||||
<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" size="30" title="<?php echo JText::_('COM_MODULES_FILTER_SEARCH_DESC'); ?>" />
|
||||
|
||||
<button type="submit">
|
||||
<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?></button>
|
||||
<button type="button" onclick="document.id('filter_search').value='';this.form.submit();">
|
||||
<?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?></button>
|
||||
</div>
|
||||
|
||||
<div class="right">
|
||||
<select name="filter_state" class="inputbox" onchange="this.form.submit()">
|
||||
<option value=""><?php echo JText::_('JOPTION_SELECT_PUBLISHED');?></option>
|
||||
<?php echo JHtml::_('select.options', JHtml::_('modules.templateStates'), 'value', 'text', $state, true);?>
|
||||
</select>
|
||||
|
||||
<select name="filter_type" class="inputbox" onchange="this.form.submit()">
|
||||
<option value=""><?php echo JText::_('COM_MODULES_OPTION_SELECT_TYPE');?></option>
|
||||
<?php echo JHtml::_('select.options', JHtml::_('modules.types'), 'value', 'text', $type, true);?>
|
||||
</select>
|
||||
|
||||
<select name="filter_template" class="inputbox" onchange="this.form.submit()">
|
||||
<option value=""><?php echo JText::_('JOPTION_SELECT_TEMPLATE');?></option>
|
||||
<?php echo JHtml::_('select.options', JHtml::_('modules.templates', $clientId), 'value', 'text', $template, true);?>
|
||||
</select>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<table class="adminlist">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="title" width="20%">
|
||||
<?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'value', $direction, $ordering); ?>
|
||||
</th>
|
||||
<th>
|
||||
<?php echo JHtml::_('grid.sort', 'COM_MODULES_HEADING_TEMPLATES', 'templates', $direction, $ordering); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="15">
|
||||
<?php echo $this->pagination->getListFooter(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<?php $i = 1; foreach ($this->items as $value => $templates) : ?>
|
||||
<tr class="row<?php echo $i = 1 - $i;?>">
|
||||
<td>
|
||||
<a class="pointer" onclick="if (window.parent) window.parent.<?php echo $function;?>('<?php echo $value; ?>');"><?php echo $this->escape($value); ?></a>
|
||||
</td>
|
||||
<td>
|
||||
<?php if (!empty($templates)):?>
|
||||
<a class="pointer" onclick="if (window.parent) window.parent.<?php echo $function;?>('<?php echo $value; ?>');">
|
||||
<ul>
|
||||
<?php foreach ($templates as $template => $label):?>
|
||||
<li><?php echo $lang->hasKey($label) ? JText::sprintf('COM_MODULES_MODULE_TEMPLATE_POSITION', JText::_($template), JText::_($label)) : JText::_($template);?></li>
|
||||
<?php endforeach;?>
|
||||
</ul>
|
||||
</a>
|
||||
<?php endif;?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div>
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
<input type="hidden" name="filter_order" value="<?php echo $ordering; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $direction; ?>" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</div>
|
||||
</form>
|
||||
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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_modules
|
||||
* @since 1.6
|
||||
*/
|
||||
class ModulesViewPositions 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');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseError(500, implode("\n", $errors));
|
||||
return false;
|
||||
}
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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;
|
||||
?>
|
||||
|
||||
<script>
|
||||
var form = window.top.document.adminForm
|
||||
var title = form.title.value;
|
||||
|
||||
var alltext = window.top.<?php echo $this->editor->getContent('text') ?>;
|
||||
</script>
|
||||
|
||||
<table class="center" width="90%">
|
||||
<tr>
|
||||
<td class="contentheading" colspan="2"><script>document.write(title);</script></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" height="90%" colspan="2">
|
||||
<script>document.write(alltext);</script>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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 Modules component
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
* @since 1.6
|
||||
*/
|
||||
class ModulesViewPreview extends JViewLegacy
|
||||
{
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$editor = JFactory::getConfig()->get('editor');
|
||||
|
||||
$this->editor = JEditor::getInstance($editor);
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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::_('bootstrap.popover');
|
||||
$document = JFactory::getDocument();
|
||||
?>
|
||||
|
||||
<h2><?php echo JText::_('COM_MODULES_TYPE_CHOOSE')?></h2>
|
||||
<ul id="new-modules-list" class="list list-striped">
|
||||
<?php foreach ($this->items as &$item) : ?>
|
||||
<?php
|
||||
// Prepare variables for the link.
|
||||
|
||||
$link = 'index.php?option=com_modules&task=module.add&eid='. $item->extension_id;
|
||||
$name = $this->escape($item->name);
|
||||
$desc = JHTML::_('string.truncate', ($this->escape($item->desc)), 200);
|
||||
$short_desc = JHTML::_('string.truncate', ($this->escape($item->desc)), 90);
|
||||
?>
|
||||
<?php if ($document->direction != "rtl") : ?>
|
||||
<li>
|
||||
<a href="<?php echo JRoute::_($link);?>">
|
||||
<strong><?php echo $name; ?></strong>
|
||||
</a>
|
||||
<small class="hasPopover" data-placement="right" title="<?php echo $name; ?>" data-content="<?php echo $desc; ?>"><?php echo $short_desc; ?></small>
|
||||
</li>
|
||||
<?php else : ?>
|
||||
<li>
|
||||
<small rel="popover" data-placement="left" title="<?php echo $name; ?>" data-content="<?php echo $desc; ?>"><?php echo $short_desc; ?></small>
|
||||
<a href="<?php echo JRoute::_($link);?>">
|
||||
<strong><?php echo $name; ?></strong>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<div class="clr"></div>
|
||||
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
*
|
||||
* @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 Modules component
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_modules
|
||||
* @since 1.6
|
||||
*/
|
||||
class ModulesViewSelect extends JViewLegacy
|
||||
{
|
||||
protected $state;
|
||||
|
||||
protected $items;
|
||||
|
||||
/**
|
||||
* Display the view
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$state = $this->get('State');
|
||||
$items = $this->get('Items');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseError(500, implode("\n", $errors));
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->state = &$state;
|
||||
$this->items = &$items;
|
||||
|
||||
$this->addToolbar();
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function addToolbar()
|
||||
{
|
||||
// Add page title
|
||||
JToolbarHelper::title(JText::_('COM_MODULES_MANAGER_MODULES'), 'module.png');
|
||||
|
||||
// Get the toolbar object instance
|
||||
$bar = JToolBar::getInstance('toolbar');
|
||||
|
||||
// Cancel
|
||||
$title = JText::_('JTOOLBAR_CANCEL');
|
||||
$dhtml = "<button onClick=\"location.href='index.php?option=com_modules'\" class=\"btn\">
|
||||
<i class=\"icon-remove\" title=\"$title\"></i>
|
||||
$title</button>";
|
||||
$bar->appendButton('Custom', $dhtml, 'new');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user