You've already forked joomla_test
first commit
This commit is contained in:
9
administrator/components/com_plugins/access.xml
Normal file
9
administrator/components/com_plugins/access.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<access component="com_plugins">
|
||||
<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.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
|
||||
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" />
|
||||
</section>
|
||||
</access>
|
17
administrator/components/com_plugins/config.xml
Normal file
17
administrator/components/com_plugins/config.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?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_plugins"
|
||||
section="component" />
|
||||
</fieldset>
|
||||
</config>
|
54
administrator/components/com_plugins/controller.php
Normal file
54
administrator/components/com_plugins/controller.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Plugins master display controller.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
* @since 1.5
|
||||
*/
|
||||
class PluginsController 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/plugins.php';
|
||||
|
||||
// Load the submenu.
|
||||
PluginsHelper::addSubmenu($this->input->get('view', 'plugins'));
|
||||
|
||||
$view = $this->input->get('view', 'plugins');
|
||||
$layout = $this->input->get('layout', 'default');
|
||||
$id = $this->input->getInt('extension_id');
|
||||
|
||||
// Check for edit form.
|
||||
if ($view == 'plugin' && $layout == 'edit' && !$this->checkEditId('com_plugins.edit.plugin', $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_plugins&view=plugins', false));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
parent::display();
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
21
administrator/components/com_plugins/controllers/plugin.php
Normal file
21
administrator/components/com_plugins/controllers/plugin.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Plugin controller class.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
* @since 1.6
|
||||
*/
|
||||
class PluginsControllerPlugin extends JControllerForm
|
||||
{
|
||||
}
|
37
administrator/components/com_plugins/controllers/plugins.php
Normal file
37
administrator/components/com_plugins/controllers/plugins.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Plugins list controller class.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
* @since 1.6
|
||||
*/
|
||||
class PluginsControllerPlugins extends JControllerAdmin
|
||||
{
|
||||
/**
|
||||
* Method to get a model object, loading it if required.
|
||||
*
|
||||
* @param string $name The model name. Optional.
|
||||
* @param string $prefix The class prefix. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return object The model.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = 'Plugin', $prefix = 'PluginsModel', $config = array('ignore_request' => true))
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, $config);
|
||||
return $model;
|
||||
}
|
||||
}
|
1
administrator/components/com_plugins/helpers/index.html
Normal file
1
administrator/components/com_plugins/helpers/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
120
administrator/components/com_plugins/helpers/plugins.php
Normal file
120
administrator/components/com_plugins/helpers/plugins.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Plugins component helper.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
* @since 1.6
|
||||
*/
|
||||
class PluginsHelper
|
||||
{
|
||||
public static $extension = 'com_plugins';
|
||||
|
||||
/**
|
||||
* Configure the Linkbar.
|
||||
*
|
||||
* @param string The name of the active view.
|
||||
*/
|
||||
public static function addSubmenu($vName)
|
||||
{
|
||||
// No submenu for this component.
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of the actions that can be performed.
|
||||
*
|
||||
* @return JObject
|
||||
*/
|
||||
public static function getActions()
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$result = new JObject;
|
||||
$assetName = 'com_plugins';
|
||||
|
||||
$actions = JAccess::getActions($assetName);
|
||||
|
||||
foreach ($actions as $action)
|
||||
{
|
||||
$result->set($action->name, $user->authorise($action->name, $assetName));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of standard published state filter options.
|
||||
*
|
||||
* @return string The HTML code for the select tag
|
||||
*/
|
||||
public static function publishedOptions()
|
||||
{
|
||||
// Build the active state filter options.
|
||||
$options = array();
|
||||
$options[] = JHtml::_('select.option', '1', 'JENABLED');
|
||||
$options[] = JHtml::_('select.option', '0', 'JDISABLED');
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of standard published state filter options.
|
||||
*
|
||||
* @return string The HTML code for the select tag
|
||||
*/
|
||||
public static function folderOptions()
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('DISTINCT(folder) AS value, folder AS text')
|
||||
->from('#__extensions')
|
||||
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
|
||||
->order('folder');
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$options = $db->loadObjectList();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
JError::raiseWarning(500, $e->getMessage());
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
public function parseXMLTemplateFile($templateBaseDir, $templateDir)
|
||||
{
|
||||
$data = new JObject;
|
||||
|
||||
// Check of the xml file exists
|
||||
$filePath = JPath::clean($templateBaseDir . '/templates/' . $templateDir . '/templateDetails.xml');
|
||||
if (is_file($filePath))
|
||||
{
|
||||
$xml = JInstaller::parseXMLInstallFile($filePath);
|
||||
|
||||
if ($xml['type'] != 'template')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($xml as $key => $value)
|
||||
{
|
||||
$data->set($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
1
administrator/components/com_plugins/index.html
Normal file
1
administrator/components/com_plugins/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
*
|
||||
* @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('JPATH_BASE') or die;
|
||||
|
||||
/**
|
||||
* Supports an HTML select list of plugins
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
* @since 1.6
|
||||
*/
|
||||
class JFormFieldOrdering extends JFormField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $type = 'Ordering';
|
||||
|
||||
/**
|
||||
* Method to get the field input markup.
|
||||
*
|
||||
* @return string The field input markup.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
$html = array();
|
||||
$attr = '';
|
||||
|
||||
// Initialize some field attributes.
|
||||
$attr .= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
|
||||
$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
|
||||
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
|
||||
|
||||
// Initialize JavaScript field attributes.
|
||||
$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
|
||||
|
||||
// Get some field values from the form.
|
||||
$pluginId = (int) $this->form->getValue('extension_id');
|
||||
$folder = $this->form->getValue('folder');
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
// Build the query for the ordering list.
|
||||
$query = 'SELECT ordering AS value, name AS text, type AS type, folder AS folder, extension_id AS extension_id' .
|
||||
' FROM #__extensions' .
|
||||
' WHERE (type =' .$db->quote('plugin'). 'AND folder='. $db->quote($folder) . ')'.
|
||||
' ORDER BY ordering';
|
||||
|
||||
// Create a read-only list (no name) with a hidden input to store the value.
|
||||
if ((string) $this->element['readonly'] == 'true')
|
||||
{
|
||||
$html[] = JHtml::_('list.ordering', '', $query, trim($attr), $this->value, $pluginId ? 0 : 1);
|
||||
$html[] = '<input type="hidden" name="'.$this->name.'" value="'.$this->value.'"/>';
|
||||
}
|
||||
// Create a regular list.
|
||||
else {
|
||||
$html[] = JHtml::_('list.ordering', $this->name, $query, trim($attr), $this->value, $pluginId ? 0 : 1);
|
||||
}
|
||||
|
||||
return implode($html);
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
65
administrator/components/com_plugins/models/forms/plugin.xml
Normal file
65
administrator/components/com_plugins/models/forms/plugin.xml
Normal file
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fieldset>
|
||||
<field
|
||||
name="extension_id"
|
||||
label="JGLOBAL_FIELD_ID_LABEL"
|
||||
description ="JGLOBAL_FIELD_ID_DESC"
|
||||
type="text"
|
||||
default="0"
|
||||
readonly="true"
|
||||
class="readonly" />
|
||||
|
||||
<field
|
||||
name="name"
|
||||
type="hidden"
|
||||
label="COM_PLUGINS_FIELD_NAME_LABEL"
|
||||
description="COM_PLUGINS_FIELD_NAME_DESC" />
|
||||
|
||||
<field
|
||||
name="enabled"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JSTATUS"
|
||||
description="COM_PLUGINS_FIELD_ENABLED_DESC"
|
||||
size="1"
|
||||
default="1">
|
||||
<option value="1">JENABLED</option>
|
||||
<option value="0">JDISABLED</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="folder"
|
||||
type="text"
|
||||
class="readonly"
|
||||
size="20"
|
||||
label="COM_PLUGINS_FIELD_FOLDER_LABEL"
|
||||
description="COM_PLUGINS_FIELD_FOLDER_DESC"
|
||||
readonly="true" />
|
||||
|
||||
<field
|
||||
name="element"
|
||||
type="text"
|
||||
class="readonly"
|
||||
size="20"
|
||||
label="COM_PLUGINS_FIELD_ELEMENT_LABEL"
|
||||
description="COM_PLUGINS_FIELD_ELEMENT_DESC"
|
||||
readonly="true" />
|
||||
|
||||
<field
|
||||
name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
class="inputbox"
|
||||
size="1" />
|
||||
|
||||
<field
|
||||
name="ordering"
|
||||
type="ordering"
|
||||
class="inputbox"
|
||||
label="JFIELD_ORDERING_LABEL"
|
||||
description="JFIELD_ORDERING_DESC" />
|
||||
|
||||
</fieldset>
|
||||
</form>
|
1
administrator/components/com_plugins/models/index.html
Normal file
1
administrator/components/com_plugins/models/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
334
administrator/components/com_plugins/models/plugin.php
Normal file
334
administrator/components/com_plugins/models/plugin.php
Normal file
@ -0,0 +1,334 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Plugin model.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
* @since 1.6
|
||||
*/
|
||||
class PluginsModelPlugin extends JModelAdmin
|
||||
{
|
||||
/**
|
||||
* @var string The help screen key for the module.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $helpKey = 'JHELP_EXTENSIONS_PLUGIN_MANAGER_EDIT';
|
||||
|
||||
/**
|
||||
* @var string The help screen base URL for the module.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $helpURL;
|
||||
|
||||
protected $_cache;
|
||||
|
||||
/**
|
||||
* @var string The event to trigger after saving the data.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $event_after_save = 'onExtensionAfterSave';
|
||||
|
||||
/**
|
||||
* @var string The event to trigger after before the data.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $event_before_save = 'onExtensionBeforeSave';
|
||||
|
||||
/**
|
||||
* Method to get the record form.
|
||||
*
|
||||
* @param array $data Data for the form.
|
||||
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||
* @return JForm A JForm object on success, false on failure
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = array(), $loadData = true)
|
||||
{
|
||||
// The folder and element vars are passed when saving the form.
|
||||
if (empty($data))
|
||||
{
|
||||
$item = $this->getItem();
|
||||
$folder = $item->folder;
|
||||
$element = $item->element;
|
||||
}
|
||||
else
|
||||
{
|
||||
$folder = JArrayHelper::getValue($data, 'folder', '', 'cmd');
|
||||
$element = JArrayHelper::getValue($data, 'element', '', 'cmd');
|
||||
}
|
||||
|
||||
// These variables are used to add data from the plugin XML files.
|
||||
$this->setState('item.folder', $folder);
|
||||
$this->setState('item.element', $element);
|
||||
|
||||
// Get the form.
|
||||
$form = $this->loadForm('com_plugins.plugin', 'plugin', array('control' => 'jform', 'load_data' => $loadData));
|
||||
if (empty($form))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Modify the form based on access controls.
|
||||
if (!$this->canEditState((object) $data))
|
||||
{
|
||||
// Disable fields for display.
|
||||
$form->setFieldAttribute('ordering', 'disabled', 'true');
|
||||
$form->setFieldAttribute('enabled', 'disabled', 'true');
|
||||
|
||||
// Disable fields while saving.
|
||||
// The controller has already verified this is a record you can edit.
|
||||
$form->setFieldAttribute('ordering', 'filter', 'unset');
|
||||
$form->setFieldAttribute('enabled', 'filter', 'unset');
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the data that should be injected in the form.
|
||||
*
|
||||
* @return mixed The data for the form.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = JFactory::getApplication()->getUserState('com_plugins.edit.plugin.data', array());
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
}
|
||||
|
||||
$this->preprocessData('com_plugins.plugin', $data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a single record.
|
||||
*
|
||||
* @param integer The id of the primary key.
|
||||
*
|
||||
* @return mixed Object on success, false on failure.
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{
|
||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('plugin.id');
|
||||
|
||||
if (!isset($this->_cache[$pk]))
|
||||
{
|
||||
$false = false;
|
||||
|
||||
// Get a row instance.
|
||||
$table = $this->getTable();
|
||||
|
||||
// Attempt to load the row.
|
||||
$return = $table->load($pk);
|
||||
|
||||
// Check for a table object error.
|
||||
if ($return === false && $table->getError())
|
||||
{
|
||||
$this->setError($table->getError());
|
||||
return $false;
|
||||
}
|
||||
|
||||
// Convert to the JObject before adding other data.
|
||||
$properties = $table->getProperties(1);
|
||||
$this->_cache[$pk] = JArrayHelper::toObject($properties, 'JObject');
|
||||
|
||||
// Convert the params field to an array.
|
||||
$registry = new JRegistry;
|
||||
$registry->loadString($table->params);
|
||||
$this->_cache[$pk]->params = $registry->toArray();
|
||||
|
||||
// Get the plugin XML.
|
||||
$path = JPath::clean(JPATH_PLUGINS.'/'.$table->folder.'/'.$table->element.'/'.$table->element.'.xml');
|
||||
|
||||
if (file_exists($path))
|
||||
{
|
||||
$this->_cache[$pk]->xml = simplexml_load_file($path);
|
||||
} else {
|
||||
$this->_cache[$pk]->xml = null;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_cache[$pk];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reference to the a Table object, always creating it.
|
||||
*
|
||||
* @param type The table type to instantiate
|
||||
* @param string A prefix for the table class name. Optional.
|
||||
* @param array Configuration array for model. Optional.
|
||||
* @return JTable A database object
|
||||
*/
|
||||
public function getTable($type = 'Extension', $prefix = 'JTable', $config = array())
|
||||
{
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState()
|
||||
{
|
||||
// Execute the parent method.
|
||||
parent::populateState();
|
||||
|
||||
$app = JFactory::getApplication('administrator');
|
||||
|
||||
// Load the User state.
|
||||
$pk = $app->input->getInt('extension_id');
|
||||
$this->setState('plugin.id', $pk);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object A form object.
|
||||
* @param mixed The data expected for the form.
|
||||
* @return mixed True if successful.
|
||||
* @throws Exception if there is an error in the form event.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function preprocessForm(JForm $form, $data, $group = 'content')
|
||||
{
|
||||
jimport('joomla.filesystem.path');
|
||||
|
||||
$folder = $this->getState('item.folder');
|
||||
$element = $this->getState('item.element');
|
||||
$lang = JFactory::getLanguage();
|
||||
|
||||
// Load the core and/or local language sys file(s) for the ordering field.
|
||||
$db = JFactory::getDbo();
|
||||
$query = 'SELECT element' .
|
||||
' FROM #__extensions' .
|
||||
' WHERE (type =' .$db->quote('plugin'). 'AND folder='. $db->quote($folder) . ')';
|
||||
$db->setQuery($query);
|
||||
$elements = $db->loadColumn();
|
||||
|
||||
foreach ($elements as $elementa)
|
||||
{
|
||||
$lang->load('plg_'.$folder.'_'.$elementa.'.sys', JPATH_ADMINISTRATOR, null, false, false)
|
||||
|| $lang->load('plg_'.$folder.'_'.$elementa.'.sys', JPATH_PLUGINS.'/'.$folder.'/'.$elementa, null, false, false)
|
||||
|| $lang->load('plg_'.$folder.'_'.$elementa.'.sys', JPATH_ADMINISTRATOR, $lang->getDefault(), false, false)
|
||||
|| $lang->load('plg_'.$folder.'_'.$elementa.'.sys', JPATH_PLUGINS.'/'.$folder.'/'.$elementa, $lang->getDefault(), false, false);
|
||||
}
|
||||
|
||||
if (empty($folder) || empty($element))
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$app->redirect(JRoute::_('index.php?option=com_plugins&view=plugins', false));
|
||||
}
|
||||
|
||||
$formFile = JPath::clean(JPATH_PLUGINS . '/' . $folder . '/' . $element . '/' . $element . '.xml');
|
||||
if (!file_exists($formFile))
|
||||
{
|
||||
throw new Exception(JText::sprintf('COM_PLUGINS_ERROR_FILE_NOT_FOUND', $element . '.xml'));
|
||||
}
|
||||
|
||||
// Load the core and/or local language file(s).
|
||||
$lang->load('plg_'.$folder.'_'.$element, JPATH_ADMINISTRATOR, null, false, false)
|
||||
|| $lang->load('plg_'.$folder.'_'.$element, JPATH_PLUGINS.'/'.$folder.'/'.$element, null, false, false)
|
||||
|| $lang->load('plg_'.$folder.'_'.$element, JPATH_ADMINISTRATOR, $lang->getDefault(), false, false)
|
||||
|| $lang->load('plg_'.$folder.'_'.$element, JPATH_PLUGINS.'/'.$folder.'/'.$element, $lang->getDefault(), false, false);
|
||||
|
||||
if (file_exists($formFile))
|
||||
{
|
||||
// Get the plugin form.
|
||||
if (!$form->loadFile($formFile, false, '//config'))
|
||||
{
|
||||
throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
|
||||
}
|
||||
}
|
||||
|
||||
// Attempt to load the xml file.
|
||||
if (!$xml = simplexml_load_file($formFile))
|
||||
{
|
||||
throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
|
||||
}
|
||||
|
||||
// Get the help data from the XML file if present.
|
||||
$help = $xml->xpath('/extension/help');
|
||||
if (!empty($help))
|
||||
{
|
||||
$helpKey = trim((string) $help[0]['key']);
|
||||
$helpURL = trim((string) $help[0]['url']);
|
||||
|
||||
$this->helpKey = $helpKey ? $helpKey : $this->helpKey;
|
||||
$this->helpURL = $helpURL ? $helpURL : $this->helpURL;
|
||||
}
|
||||
|
||||
// Trigger the default form events.
|
||||
parent::preprocessForm($form, $data, $group);
|
||||
}
|
||||
|
||||
/**
|
||||
* A protected method to get a set of ordering conditions.
|
||||
*
|
||||
* @param object A record object.
|
||||
* @return array An array of conditions to add to add to ordering queries.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getReorderConditions($table)
|
||||
{
|
||||
$condition = array();
|
||||
$condition[] = 'type = '. $this->_db->quote($table->type);
|
||||
$condition[] = 'folder = '. $this->_db->quote($table->folder);
|
||||
return $condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override method to save the form data.
|
||||
*
|
||||
* @param array The form data.
|
||||
* @return boolean True on success.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
// Load the extension plugin group.
|
||||
JPluginHelper::importPlugin('extension');
|
||||
|
||||
// Setup type
|
||||
$data['type'] = 'plugin';
|
||||
|
||||
return parent::save($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the necessary data to load an item help screen.
|
||||
*
|
||||
* @return object An object with key, url, and local properties for loading the item help screen.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getHelp()
|
||||
{
|
||||
return (object) array('key' => $this->helpKey, 'url' => $this->helpURL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom clean cache method, plugins are cached in 2 places for different clients
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function cleanCache($group = null, $client_id = 0)
|
||||
{
|
||||
parent::cleanCache('com_plugins');
|
||||
}
|
||||
}
|
260
administrator/components/com_plugins/models/plugins.php
Normal file
260
administrator/components/com_plugins/models/plugins.php
Normal file
@ -0,0 +1,260 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Methods supporting a list of plugin records.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
* @since 1.6
|
||||
*/
|
||||
class PluginsModelPlugins 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(
|
||||
'extension_id', 'a.extension_id',
|
||||
'name', 'a.name',
|
||||
'folder', 'a.folder',
|
||||
'element', 'a.element',
|
||||
'checked_out', 'a.checked_out',
|
||||
'checked_out_time', 'a.checked_out_time',
|
||||
'state', 'a.state',
|
||||
'enabled', 'a.enabled',
|
||||
'access', 'a.access', 'access_level',
|
||||
'ordering', 'a.ordering',
|
||||
'client_id', 'a.client_id',
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @param string $ordering An optional ordering field.
|
||||
* @param string $direction An optional direction (asc|desc).
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
// Load the filter state.
|
||||
$search = $this->getUserStateFromRequest($this->context . '.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.enabled', 'filter_enabled', '', 'string');
|
||||
$this->setState('filter.enabled', $state);
|
||||
|
||||
$folder = $this->getUserStateFromRequest($this->context . '.filter.folder', 'filter_folder', null, 'cmd');
|
||||
$this->setState('filter.folder', $folder);
|
||||
|
||||
$language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '');
|
||||
$this->setState('filter.language', $language);
|
||||
|
||||
// Load the parameters.
|
||||
$params = JComponentHelper::getParams('com_plugins');
|
||||
$this->setState('params', $params);
|
||||
|
||||
// List state information.
|
||||
parent::populateState('folder', '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.folder');
|
||||
$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)
|
||||
{
|
||||
$search = $this->getState('filter.search');
|
||||
$ordering = $this->getState('list.ordering', 'ordering');
|
||||
if ($ordering == 'name' || (!empty($search) && stripos($search, 'id:') !== 0))
|
||||
{
|
||||
$this->_db->setQuery($query);
|
||||
$result = $this->_db->loadObjectList();
|
||||
$this->translate($result);
|
||||
if (!empty($search))
|
||||
{
|
||||
foreach ($result as $i => $item)
|
||||
{
|
||||
if (!preg_match("/$search/i", $item->name))
|
||||
{
|
||||
unset($result[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$direction = ($this->getState('list.direction') == 'desc') ? -1 : 1;
|
||||
JArrayHelper::sortObjects($result, $ordering, $direction, 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.folder ASC');
|
||||
$ordering = 'a.ordering';
|
||||
}
|
||||
$query->order($this->_db->quoteName($ordering) . ' ' . $this->getState('list.direction'));
|
||||
|
||||
if ($ordering == 'folder')
|
||||
{
|
||||
$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();
|
||||
|
||||
foreach ($items as &$item)
|
||||
{
|
||||
$source = JPATH_PLUGINS . '/' . $item->folder . '/' . $item->element;
|
||||
$extension = 'plg_' . $item->folder . '_' . $item->element;
|
||||
$lang->load($extension . '.sys', JPATH_ADMINISTRATOR, null, false, false)
|
||||
|| $lang->load($extension . '.sys', $source, null, false, false)
|
||||
|| $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, $lang->getDefault(), false, false)
|
||||
|| $lang->load($extension . '.sys', $source, $lang->getDefault(), false, false);
|
||||
$item->name = JText::_($item->name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, a.folder, a.checked_out, a.checked_out_time,' .
|
||||
' a.enabled, a.access, a.ordering'
|
||||
)
|
||||
)
|
||||
->from($db->quoteName('#__extensions') . ' AS a')
|
||||
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'));
|
||||
|
||||
// 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');
|
||||
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
|
||||
// Filter by published state
|
||||
$published = $this->getState('filter.enabled');
|
||||
if (is_numeric($published))
|
||||
{
|
||||
$query->where('a.enabled = ' . (int) $published);
|
||||
}
|
||||
elseif ($published === '')
|
||||
{
|
||||
$query->where('(a.enabled IN (0, 1))');
|
||||
}
|
||||
|
||||
// Filter by state
|
||||
$query->where('a.state >= 0');
|
||||
|
||||
// Filter by folder.
|
||||
if ($folder = $this->getState('filter.folder'))
|
||||
{
|
||||
$query->where('a.folder = ' . $db->quote($folder));
|
||||
}
|
||||
|
||||
// Filter by search in name or id
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
{
|
||||
if (stripos($search, 'id:') === 0)
|
||||
{
|
||||
$query->where('a.extension_id = ' . (int) substr($search, 3));
|
||||
}
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
19
administrator/components/com_plugins/plugins.php
Normal file
19
administrator/components/com_plugins/plugins.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
*
|
||||
* @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_plugins'))
|
||||
{
|
||||
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
|
||||
}
|
||||
|
||||
$controller = JControllerLegacy::getInstance('Plugins');
|
||||
$controller->execute(JFactory::getApplication()->input->get('task'));
|
||||
$controller->redirect();
|
28
administrator/components/com_plugins/plugins.xml
Normal file
28
administrator/components/com_plugins/plugins.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.1" method="upgrade">
|
||||
<name>com_plugins</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_PLUGINS_XML_DESCRIPTION</description>
|
||||
<administration>
|
||||
<files folder="admin">
|
||||
<filename>config.xml</filename>
|
||||
<filename>controller.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>plugins.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_plugins.ini</language>
|
||||
<language tag="en-GB">language/en-GB.com_plugins.sys.ini</language>
|
||||
</languages>
|
||||
</administration>
|
||||
</extension>
|
1
administrator/components/com_plugins/views/index.html
Normal file
1
administrator/components/com_plugins/views/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
118
administrator/components/com_plugins/views/plugin/tmpl/edit.php
Normal file
118
administrator/components/com_plugins/views/plugin/tmpl/edit.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||||
|
||||
JHtml::_('behavior.formvalidation');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
$this->fieldsets = $this->form->getFieldsets('params');
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
Joomla.submitbutton = function(task)
|
||||
{
|
||||
if (task == 'plugin.cancel' || document.formvalidator.isValid(document.id('style-form')))
|
||||
{
|
||||
Joomla.submitform(task, document.getElementById('style-form'));
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_plugins&layout=edit&extension_id='.(int) $this->item->extension_id); ?>" method="post" name="adminForm" id="style-form" class="form-validate form-horizontal">
|
||||
<fieldset>
|
||||
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'details')); ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'details', JText::_('JDETAILS', true)); ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('name'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('name'); ?>
|
||||
<span class="readonly plg-name"><?php echo JText::_($this->item->name);?></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('enabled'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('enabled'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('folder'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('folder'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('element'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('element'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($this->item->extension_id) : ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('extension_id'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('extension_id'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<!-- Plugin metadata -->
|
||||
<?php if ($this->item->xml) : ?>
|
||||
<?php if ($text = trim($this->item->xml->description)) : ?>
|
||||
<div class="control-group">
|
||||
<label id="jform_extdescription-lbl" class="control-label">
|
||||
<?php echo JText::_('JGLOBAL_DESCRIPTION'); ?>
|
||||
</label>
|
||||
<div class="controls disabled">
|
||||
<?php echo JText::_($text); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php else : ?>
|
||||
<div class="alert alert-error">
|
||||
<?php echo JText::_('COM_PLUGINS_XML_ERR'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
|
||||
<?php echo $this->loadTemplate('options'); ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
|
||||
</fieldset>
|
||||
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</form>
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
*
|
||||
* @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;
|
||||
|
||||
foreach ($this->fieldsets as $name => $fieldset) :
|
||||
$label = !empty($fieldset->label) ? JText::_($fieldset->label, true) : JText::_('COM_PLUGINS_'.$fieldset->name.'_FIELDSET_LABEL', true);
|
||||
$optionsname = 'options-' . $fieldset->name;
|
||||
echo JHtml::_('bootstrap.addTab', 'myTab', $optionsname, $label);
|
||||
if (isset($fieldset->description) && trim($fieldset->description)) :
|
||||
echo '<p class="tip">'.$this->escape(JText::_($fieldset->description)).'</p>';
|
||||
endif;
|
||||
?>
|
||||
<?php $hidden_fields = ''; ?>
|
||||
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
|
||||
<?php if (!$field->hidden) : ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $field->label; ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $field->input; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php else : $hidden_fields .= $field->input; ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php echo $hidden_fields; ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
|
||||
<?php endforeach; ?>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
*
|
||||
* @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 plugin.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
* @since 1.5
|
||||
*/
|
||||
class PluginsViewPlugin extends JViewLegacy
|
||||
{
|
||||
protected $item;
|
||||
|
||||
protected $form;
|
||||
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* Display the view
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$this->state = $this->get('State');
|
||||
$this->item = $this->get('Item');
|
||||
$this->form = $this->get('Form');
|
||||
|
||||
// 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);
|
||||
|
||||
$canDo = PluginsHelper::getActions();
|
||||
|
||||
JToolbarHelper::title(JText::sprintf('COM_PLUGINS_MANAGER_PLUGIN', JText::_($this->item->name)), 'plugin');
|
||||
|
||||
// If not checked out, can save the item.
|
||||
if ($canDo->get('core.edit'))
|
||||
{
|
||||
JToolbarHelper::apply('plugin.apply');
|
||||
JToolbarHelper::save('plugin.save');
|
||||
}
|
||||
JToolbarHelper::cancel('plugin.cancel', 'JTOOLBAR_CLOSE');
|
||||
JToolbarHelper::divider();
|
||||
// Get the help information for the plugin 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,191 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
*
|
||||
* @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;
|
||||
|
||||
// Include the component HTML helpers.
|
||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||||
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
JHtml::_('behavior.multiselect');
|
||||
JHtml::_('dropdown.init');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
$canOrder = $user->authorise('core.edit.state', 'com_plugins');
|
||||
$saveOrder = $listOrder == 'ordering';
|
||||
if ($saveOrder)
|
||||
{
|
||||
$saveOrderingUrl = 'index.php?option=com_plugins&task=plugins.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_plugins&view=plugins'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<?php if (!empty( $this->sidebar)) : ?>
|
||||
<div id="sidebar-container" class="span2">
|
||||
<?php echo $this->sidebar; ?>
|
||||
</div>
|
||||
<div id="main-container" class="span10">
|
||||
<?php else : ?>
|
||||
<div id="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_CONTENT_FILTER_SEARCH_DESC');?></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_PLUGINS_SEARCH_IN_TITLE'); ?>" />
|
||||
</div>
|
||||
<div class="btn-group pull-left">
|
||||
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
|
||||
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
|
||||
</div>
|
||||
<div 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', 'enabled', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th class="title">
|
||||
<?php echo JHtml::_('grid.sort', 'COM_PLUGINS_NAME_HEADING', 'name', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="10%" class="nowrap hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'COM_PLUGINS_FOLDER_HEADING', 'folder', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="10%" class="nowrap hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'COM_PLUGINS_ELEMENT_HEADING', 'element', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="5%" class="hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ACCESS', 'access', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="1%" class="nowrap center hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'extension_id', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="12">
|
||||
<?php echo $this->pagination->getListFooter(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<?php foreach ($this->items as $i => $item) :
|
||||
$ordering = ($listOrder == 'ordering');
|
||||
$canEdit = $user->authorise('core.edit', 'com_plugins');
|
||||
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || $item->checked_out == 0;
|
||||
$canChange = $user->authorise('core.edit.state', 'com_plugins') && $canCheckin;
|
||||
?>
|
||||
<tr class="row<?php echo $i % 2; ?>" sortable-group-id="<?php echo $item->folder?>">
|
||||
<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->extension_id); ?>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php echo JHtml::_('jgrid.published', $item->enabled, $i, 'plugins.', $canChange); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ($item->checked_out) : ?>
|
||||
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'plugins.', $canCheckin); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($canEdit) : ?>
|
||||
<a href="<?php echo JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id='.(int) $item->extension_id); ?>">
|
||||
<?php echo $item->name; ?></a>
|
||||
<?php else : ?>
|
||||
<?php echo $item->name; ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="nowrap small hidden-phone">
|
||||
<?php echo $this->escape($item->folder);?>
|
||||
</td>
|
||||
<td class="nowrap small hidden-phone">
|
||||
<?php echo $this->escape($item->element);?>
|
||||
</td>
|
||||
<td class="small hidden-phone">
|
||||
<?php echo $this->escape($item->access_level); ?>
|
||||
</td>
|
||||
<td class="center hidden-phone">
|
||||
<?php echo (int) $item->extension_id;?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
129
administrator/components/com_plugins/views/plugins/view.html.php
Normal file
129
administrator/components/com_plugins/views/plugins/view.html.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
*
|
||||
* @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 plugins.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_plugins
|
||||
* @since 1.5
|
||||
*/
|
||||
class PluginsViewPlugins 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_PLUGINS_MSG_MANAGE_NO_PLUGINS'),
|
||||
'warning'
|
||||
);
|
||||
}
|
||||
|
||||
$this->addToolbar();
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar()
|
||||
{
|
||||
$canDo = PluginsHelper::getActions();
|
||||
|
||||
JToolbarHelper::title(JText::_('COM_PLUGINS_MANAGER_PLUGINS'), 'plugin');
|
||||
|
||||
if ($canDo->get('core.edit'))
|
||||
{
|
||||
JToolbarHelper::editList('plugin.edit');
|
||||
}
|
||||
|
||||
if ($canDo->get('core.edit.state'))
|
||||
{
|
||||
JToolbarHelper::publish('plugins.publish', 'JTOOLBAR_ENABLE', true);
|
||||
JToolbarHelper::unpublish('plugins.unpublish', 'JTOOLBAR_DISABLE', true);
|
||||
JToolbarHelper::checkin('plugins.checkin');
|
||||
}
|
||||
|
||||
if ($canDo->get('core.admin'))
|
||||
{
|
||||
JToolbarHelper::preferences('com_plugins');
|
||||
}
|
||||
|
||||
JToolbarHelper::help('JHELP_EXTENSIONS_PLUGIN_MANAGER');
|
||||
|
||||
JHtmlSidebar::setAction('index.php?option=com_plugins&view=plugins');
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_PUBLISHED'),
|
||||
'filter_enabled',
|
||||
JHtml::_('select.options', PluginsHelper::publishedOptions(), 'value', 'text', $this->state->get('filter.enabled'), true)
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('COM_PLUGINS_OPTION_FOLDER'),
|
||||
'filter_folder',
|
||||
JHtml::_('select.options', PluginsHelper::folderOptions(), 'value', 'text', $this->state->get('filter.folder'))
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_ACCESS'),
|
||||
'filter_access',
|
||||
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
|
||||
);
|
||||
|
||||
$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.state' => JText::_('JSTATUS'),
|
||||
'name' => JText::_('JGLOBAL_TITLE'),
|
||||
'folder' => JText::_('COM_PLUGINS_FOLDER_HEADING'),
|
||||
'element' => JText::_('COM_PLUGINS_ELEMENT_HEADING'),
|
||||
'access' => JText::_('JGRID_HEADING_ACCESS'),
|
||||
'extension_id' => JText::_('JGRID_HEADING_ID')
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user