添加到 trunk
+YUCHENG HU+ git-svn-id: https://svn.code.sf.net/p/hawebs/svn@323 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
@@ -0,0 +1,282 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: controller.php 11386 2009-01-04 02:34:35Z ian $
|
||||
* @package Joomla
|
||||
* @subpackage Config
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant to the
|
||||
* GNU General Public License, and as distributed it includes or is derivative
|
||||
* of works licensed under the GNU General Public License or other free or open
|
||||
* source software licenses. See COPYRIGHT.php for copyright notices and
|
||||
* details.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is included in Joomla!
|
||||
defined('_JEXEC') or die( 'Restricted access' );
|
||||
|
||||
jimport( 'joomla.application.component.controller' );
|
||||
|
||||
/**
|
||||
* Plugins Component Controller
|
||||
*
|
||||
* @package Joomla
|
||||
* @subpackage Plugins
|
||||
* @since 1.5
|
||||
*/
|
||||
class PluginsController extends JController
|
||||
{
|
||||
/**
|
||||
* Custom Constructor
|
||||
*/
|
||||
function __construct( $default = array())
|
||||
{
|
||||
parent::__construct( $default );
|
||||
|
||||
$this->registerTask( 'apply', 'save');
|
||||
$this->registerTask( 'unpublish', 'publish');
|
||||
$this->registerTask( 'edit' , 'display' );
|
||||
$this->registerTask( 'add' , 'display' );
|
||||
$this->registerTask( 'orderup' , 'order' );
|
||||
$this->registerTask( 'orderdown' , 'order' );
|
||||
|
||||
$this->registerTask( 'accesspublic' , 'access' );
|
||||
$this->registerTask( 'accessregistered' , 'access' );
|
||||
$this->registerTask( 'accessspecial' , 'access' );
|
||||
|
||||
}
|
||||
|
||||
function display( )
|
||||
{
|
||||
switch($this->getTask())
|
||||
{
|
||||
case 'add' :
|
||||
case 'edit' :
|
||||
{
|
||||
JRequest::setVar( 'hidemainmenu', 1 );
|
||||
JRequest::setVar( 'layout', 'form' );
|
||||
JRequest::setVar( 'view', 'plugin' );
|
||||
} break;
|
||||
}
|
||||
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function save()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JRequest::checkToken() or jexit( 'Invalid Token' );
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
$row =& JTable::getInstance('plugin');
|
||||
$task = $this->getTask();
|
||||
|
||||
$client = JRequest::getWord( 'filter_client', 'site' );
|
||||
|
||||
if (!$row->bind(JRequest::get('post'))) {
|
||||
JError::raiseError(500, $row->getError() );
|
||||
}
|
||||
if (!$row->check()) {
|
||||
JError::raiseError(500, $row->getError() );
|
||||
}
|
||||
if (!$row->store()) {
|
||||
JError::raiseError(500, $row->getError() );
|
||||
}
|
||||
$row->checkin();
|
||||
|
||||
if ($client == 'admin') {
|
||||
$where = "client_id=1";
|
||||
} else {
|
||||
$where = "client_id=0";
|
||||
}
|
||||
|
||||
$row->reorder( 'folder = '.$db->Quote($row->folder).' AND ordering > -10000 AND ordering < 10000 AND ( '.$where.' )' );
|
||||
|
||||
switch ( $task )
|
||||
{
|
||||
case 'apply':
|
||||
$msg = JText::sprintf( 'Successfully Saved changes to Plugin', $row->name );
|
||||
$this->setRedirect( 'index.php?option=com_plugins&view=plugin&client='. $client .'&task=edit&cid[]='. $row->id, $msg );
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
default:
|
||||
$msg = JText::sprintf( 'Successfully Saved Plugin', $row->name );
|
||||
$this->setRedirect( 'index.php?option=com_plugins&client='. $client, $msg );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function publish( )
|
||||
{
|
||||
// Check for request forgeries
|
||||
JRequest::checkToken() or jexit( 'Invalid Token' );
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
$user =& JFactory::getUser();
|
||||
$cid = JRequest::getVar( 'cid', array(0), 'post', 'array' );
|
||||
JArrayHelper::toInteger($cid, array(0));
|
||||
$publish = ( $this->getTask() == 'publish' ? 1 : 0 );
|
||||
$client = JRequest::getWord( 'filter_client', 'site' );
|
||||
|
||||
if (count( $cid ) < 1) {
|
||||
$action = $publish ? JText::_( 'publish' ) : JText::_( 'unpublish' );
|
||||
JError::raiseError(500, JText::_( 'Select a plugin to '.$action ) );
|
||||
}
|
||||
|
||||
$cids = implode( ',', $cid );
|
||||
|
||||
$query = 'UPDATE #__plugins SET published = '.(int) $publish
|
||||
. ' WHERE id IN ( '.$cids.' )'
|
||||
. ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ))'
|
||||
;
|
||||
$db->setQuery( $query );
|
||||
if (!$db->query()) {
|
||||
JError::raiseError(500, $db->getErrorMsg() );
|
||||
}
|
||||
|
||||
if (count( $cid ) == 1) {
|
||||
$row =& JTable::getInstance('plugin');
|
||||
$row->checkin( $cid[0] );
|
||||
}
|
||||
|
||||
$this->setRedirect( 'index.php?option=com_plugins&client='. $client );
|
||||
}
|
||||
|
||||
function cancel( )
|
||||
{
|
||||
// Check for request forgeries
|
||||
JRequest::checkToken() or jexit( 'Invalid Token' );
|
||||
|
||||
$client = JRequest::getWord( 'filter_client', 'site' );
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
$row =& JTable::getInstance('plugin');
|
||||
$row->bind(JRequest::get('post'));
|
||||
$row->checkin();
|
||||
|
||||
$this->setRedirect( JRoute::_( 'index.php?option=com_plugins&client='. $client, false ) );
|
||||
}
|
||||
|
||||
function order( )
|
||||
{
|
||||
// Check for request forgeries
|
||||
JRequest::checkToken() or jexit( 'Invalid Token' );
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
|
||||
$cid = JRequest::getVar( 'cid', array(0), 'post', 'array' );
|
||||
JArrayHelper::toInteger($cid, array(0));
|
||||
|
||||
$uid = $cid[0];
|
||||
$inc = ( $this->getTask() == 'orderup' ? -1 : 1 );
|
||||
$client = JRequest::getWord( 'filter_client', 'site' );
|
||||
|
||||
|
||||
// Currently Unsupported
|
||||
if ($client == 'admin') {
|
||||
$where = "client_id = 1";
|
||||
} else {
|
||||
$where = "client_id = 0";
|
||||
}
|
||||
$row =& JTable::getInstance('plugin');
|
||||
$row->load( $uid );
|
||||
$row->move( $inc, 'folder='.$db->Quote($row->folder).' AND ordering > -10000 AND ordering < 10000 AND ('.$where.')' );
|
||||
|
||||
$this->setRedirect( 'index.php?option=com_plugins' );
|
||||
}
|
||||
|
||||
function access( )
|
||||
{
|
||||
// Check for request forgeries
|
||||
JRequest::checkToken() or jexit( 'Invalid Token' );
|
||||
|
||||
$cid = JRequest::getVar( 'cid', array(0), 'post', 'array' );
|
||||
JArrayHelper::toInteger($cid, array(0));
|
||||
|
||||
$uid = $cid[0];
|
||||
$access = $this->getTask();
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
switch ( $access )
|
||||
{
|
||||
case 'accesspublic':
|
||||
$access = 0;
|
||||
break;
|
||||
|
||||
case 'accessregistered':
|
||||
$access = 1;
|
||||
break;
|
||||
|
||||
case 'accessspecial':
|
||||
$access = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
$row =& JTable::getInstance('plugin');
|
||||
$row->load( $uid );
|
||||
$row->access = $access;
|
||||
|
||||
if ( !$row->check() ) {
|
||||
return $row->getError();
|
||||
}
|
||||
if ( !$row->store() ) {
|
||||
return $row->getError();
|
||||
}
|
||||
|
||||
$this->setRedirect( 'index.php?option=com_plugins' );
|
||||
}
|
||||
|
||||
function saveorder( )
|
||||
{
|
||||
// Check for request forgeries
|
||||
JRequest::checkToken() or jexit( 'Invalid Token' );
|
||||
|
||||
$cid = JRequest::getVar( 'cid', array(0), 'post', 'array' );
|
||||
JArrayHelper::toInteger($cid, array(0));
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
$total = count( $cid );
|
||||
$order = JRequest::getVar( 'order', array(0), 'post', 'array' );
|
||||
JArrayHelper::toInteger($order, array(0));
|
||||
|
||||
$cid = JRequest::getVar( 'cid', array(0), 'post', 'array' );
|
||||
JArrayHelper::toInteger($cid, array(0));
|
||||
|
||||
$row =& JTable::getInstance('plugin');
|
||||
$conditions = array();
|
||||
|
||||
// update ordering values
|
||||
for ( $i=0; $i < $total; $i++ )
|
||||
{
|
||||
$row->load( (int) $cid[$i] );
|
||||
if ($row->ordering != $order[$i])
|
||||
{
|
||||
$row->ordering = $order[$i];
|
||||
if (!$row->store()) {
|
||||
JError::raiseError(500, $db->getErrorMsg() );
|
||||
}
|
||||
// remember to updateOrder this group
|
||||
$condition = 'folder = '.$db->Quote($row->folder).' AND ordering > -10000 AND ordering < 10000 AND client_id = ' . (int) $row->client_id;
|
||||
$found = false;
|
||||
foreach ( $conditions as $cond )
|
||||
{
|
||||
if ($cond[1]==$condition) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$found) $conditions[] = array($row->id, $condition);
|
||||
}
|
||||
}
|
||||
|
||||
// execute updateOrder for each group
|
||||
foreach ( $conditions as $cond ) {
|
||||
$row->load( $cond[0] );
|
||||
$row->reorder( $cond[1] );
|
||||
}
|
||||
|
||||
$msg = JText::_( 'New ordering saved' );
|
||||
$this->setRedirect( 'index.php?option=com_plugins', $msg );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: plugins.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla
|
||||
* @subpackage Plugins
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
/*
|
||||
* Make sure the user is authorized to view this page
|
||||
*/
|
||||
$user = & JFactory::getUser();
|
||||
if (!$user->authorize( 'com_plugins', 'manage' )) {
|
||||
$mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') );
|
||||
}
|
||||
|
||||
require_once( JPATH_COMPONENT.DS.'controller.php' );
|
||||
|
||||
// Create the controller
|
||||
$controller = new PluginsController( );
|
||||
|
||||
$controller->execute( JRequest::getCmd( 'task' ) );
|
||||
$controller->redirect();
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<install type="component" version="1.0.0">
|
||||
<name>Plugin Manager</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2006</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>1.5.0</version>
|
||||
<description>Plugin Manager</description>
|
||||
</install>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,161 @@
|
||||
<?php defined('_JEXEC') or die('Restricted access'); ?>
|
||||
|
||||
<?php JHTML::_('behavior.tooltip'); ?>
|
||||
|
||||
<?php
|
||||
JToolBarHelper::title( JText::_( 'Plugin' ) .': <small><small>[' .JText::_('Edit'). ']</small></small>', 'plugin.png' );
|
||||
JToolBarHelper::save();
|
||||
JToolBarHelper::apply();
|
||||
JToolBarHelper::cancel( 'cancel', 'Close' );
|
||||
JToolBarHelper::help( 'screen.plugins.edit' );
|
||||
?>
|
||||
|
||||
<?php
|
||||
// clean item data
|
||||
JFilterOutput::objectHTMLSafe( $this->plugin, ENT_QUOTES, '' );
|
||||
?>
|
||||
|
||||
<?php
|
||||
$this->plugin->nameA = '';
|
||||
if ( $this->plugin->id ) {
|
||||
$row->nameA = '<small><small>[ '. $this->plugin->name .' ]</small></small>';
|
||||
}
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
function submitbutton(pressbutton) {
|
||||
if (pressbutton == "cancel") {
|
||||
submitform(pressbutton);
|
||||
return;
|
||||
}
|
||||
// validation
|
||||
var form = document.adminForm;
|
||||
if (form.name.value == "") {
|
||||
alert( "<?php echo JText::_( 'Plugin must have a name', true ); ?>" );
|
||||
} else if (form.element.value == "") {
|
||||
alert( "<?php echo JText::_( 'Plugin must have a filename', true ); ?>" );
|
||||
} else {
|
||||
submitform(pressbutton);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<form action="index.php" method="post" name="adminForm">
|
||||
<div class="col width-60">
|
||||
<fieldset class="adminform">
|
||||
<legend><?php echo JText::_( 'Details' ); ?></legend>
|
||||
<table class="admintable">
|
||||
<tr>
|
||||
<td width="100" class="key">
|
||||
<label for="name">
|
||||
<?php echo JText::_( 'Name' ); ?>:
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="text_area" type="text" name="name" id="name" size="35" value="<?php echo $this->plugin->name; ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="key">
|
||||
<?php echo JText::_( 'Published' ); ?>:
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $this->lists['published']; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="key">
|
||||
<label for="folder">
|
||||
<?php echo JText::_( 'Type' ); ?>:
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $this->plugin->folder; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="key">
|
||||
<label for="element">
|
||||
<?php echo JText::_( 'Plugin file' ); ?>:
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="text_area" type="text" name="element" id="element" size="35" value="<?php echo $this->plugin->element; ?>" />.php
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="key">
|
||||
<label for="access">
|
||||
<?php echo JText::_( 'Access Level' ); ?>:
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $this->lists['access']; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="key">
|
||||
<?php echo JText::_( 'Order' ); ?>:
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $this->lists['ordering']; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="key">
|
||||
<?php echo JText::_( 'Description' ); ?>:
|
||||
</td>
|
||||
<td>
|
||||
<?php echo JText::_( $this->plugin->description ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="col width-40">
|
||||
<fieldset class="adminform">
|
||||
<legend><?php echo JText::_( 'Parameters' ); ?></legend>
|
||||
<?php
|
||||
jimport('joomla.html.pane');
|
||||
// TODO: allowAllClose should default true in J!1.6, so remove the array when it does.
|
||||
$pane = &JPane::getInstance('sliders', array('allowAllClose' => true));
|
||||
echo $pane->startPane('plugin-pane');
|
||||
echo $pane->startPanel(JText :: _('Plugin Parameters'), 'param-page');
|
||||
if($output = $this->params->render('params')) :
|
||||
echo $output;
|
||||
else :
|
||||
echo "<div style=\"text-align: center; padding: 5px; \">".JText::_('There are no parameters for this item')."</div>";
|
||||
endif;
|
||||
echo $pane->endPanel();
|
||||
|
||||
if ($this->params->getNumParams('advanced')) {
|
||||
echo $pane->startPanel(JText :: _('Advanced Parameters'), "advanced-page");
|
||||
if($output = $this->params->render('params', 'advanced')) :
|
||||
echo $output;
|
||||
else :
|
||||
echo "<div style=\"text-align: center; padding: 5px; \">".JText::_('There are no advanced parameters for this item')."</div>";
|
||||
endif;
|
||||
echo $pane->endPanel();
|
||||
}
|
||||
|
||||
if ($this->params->getNumParams('legacy')) {
|
||||
echo $pane->startPanel(JText :: _('Legacy Parameters'), "legacy-page");
|
||||
if($output = $this->params->render('params', 'legacy')) :
|
||||
echo $output;
|
||||
else :
|
||||
echo "<div style=\"text-align: center; padding: 5px; \">".JText::_('There are no legacy parameters for this item')."</div>";
|
||||
endif;
|
||||
echo $pane->endPanel();
|
||||
}
|
||||
echo $pane->endPane();
|
||||
?>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
|
||||
<input type="hidden" name="option" value="com_plugins" />
|
||||
<input type="hidden" name="id" value="<?php echo $this->plugin->id; ?>" />
|
||||
<input type="hidden" name="cid[]" value="<?php echo $this->plugin->id; ?>" />
|
||||
<input type="hidden" name="client" value="<?php echo $this->plugin->client_id; ?>" />
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHTML::_( 'form.token' ); ?>
|
||||
</form>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: view.html.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla
|
||||
* @subpackage Config
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
jimport( 'joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* HTML View class for the Plugins component
|
||||
*
|
||||
* @static
|
||||
* @package Joomla
|
||||
* @subpackage Plugins
|
||||
* @since 1.0
|
||||
*/
|
||||
class PluginsViewPlugin extends JView
|
||||
{
|
||||
function display( $tpl = null )
|
||||
{
|
||||
global $option;
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
$user =& JFactory::getUser();
|
||||
|
||||
$client = JRequest::getWord( 'client', 'site' );
|
||||
$cid = JRequest::getVar( 'cid', array(0), '', 'array' );
|
||||
JArrayHelper::toInteger($cid, array(0));
|
||||
|
||||
$lists = array();
|
||||
$row =& JTable::getInstance('plugin');
|
||||
|
||||
// load the row from the db table
|
||||
$row->load( $cid[0] );
|
||||
|
||||
// fail if checked out not by 'me'
|
||||
|
||||
if ($row->isCheckedOut( $user->get('id') ))
|
||||
{
|
||||
$msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The plugin' ), $row->title );
|
||||
$this->setRedirect( 'index.php?option='. $option .'&client='. $client, $msg, 'error' );
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($client == 'admin') {
|
||||
$where = "client_id='1'";
|
||||
} else {
|
||||
$where = "client_id='0'";
|
||||
}
|
||||
|
||||
// get list of groups
|
||||
if ($row->access == 99 || $row->client_id == 1) {
|
||||
$lists['access'] = 'Administrator<input type="hidden" name="access" value="99" />';
|
||||
} else {
|
||||
// build the html select list for the group access
|
||||
$lists['access'] = JHTML::_('list.accesslevel', $row );
|
||||
}
|
||||
|
||||
if ($cid[0])
|
||||
{
|
||||
$row->checkout( $user->get('id') );
|
||||
|
||||
if ( $row->ordering > -10000 && $row->ordering < 10000 )
|
||||
{
|
||||
// build the html select list for ordering
|
||||
$query = 'SELECT ordering AS value, name AS text'
|
||||
. ' FROM #__plugins'
|
||||
. ' WHERE folder = '.$db->Quote($row->folder)
|
||||
. ' AND published > 0'
|
||||
. ' AND '. $where
|
||||
. ' AND ordering > -10000'
|
||||
. ' AND ordering < 10000'
|
||||
. ' ORDER BY ordering'
|
||||
;
|
||||
$order = JHTML::_('list.genericordering', $query );
|
||||
$lists['ordering'] = JHTML::_('select.genericlist', $order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval( $row->ordering ) );
|
||||
} else {
|
||||
$lists['ordering'] = '<input type="hidden" name="ordering" value="'. $row->ordering .'" />'. JText::_( 'This plugin cannot be reordered' );
|
||||
}
|
||||
|
||||
$lang =& JFactory::getLanguage();
|
||||
$lang->load( 'plg_' . trim( $row->folder ) . '_' . trim( $row->element ), JPATH_ADMINISTRATOR );
|
||||
|
||||
$data = JApplicationHelper::parseXMLInstallFile(JPATH_SITE . DS . 'plugins'. DS .$row->folder . DS . $row->element .'.xml');
|
||||
|
||||
$row->description = $data['description'];
|
||||
|
||||
} else {
|
||||
$row->folder = '';
|
||||
$row->ordering = 999;
|
||||
$row->published = 1;
|
||||
$row->description = '';
|
||||
}
|
||||
|
||||
$lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published );
|
||||
|
||||
// get params definitions
|
||||
$params = new JParameter( $row->params, JApplicationHelper::getPath( 'plg_xml', $row->folder.DS.$row->element ), 'plugin' );
|
||||
|
||||
$this->assignRef('lists', $lists);
|
||||
$this->assignRef('plugin', $row);
|
||||
$this->assignRef('params', $params);
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php defined('_JEXEC') or die('Restricted access'); ?>
|
||||
|
||||
<?php JHTML::_('behavior.tooltip'); ?>
|
||||
|
||||
<?php
|
||||
JToolBarHelper::title( JText::_( 'Plugin Manager' ), 'plugin.png' );
|
||||
JToolBarHelper::publishList();
|
||||
JToolBarHelper::unpublishList();
|
||||
JToolBarHelper::editListX();
|
||||
JToolBarHelper::help( 'screen.plugins' );
|
||||
$ordering = ($this->lists['order'] == 'p.folder' || $this->lists['order'] == 'p.ordering');
|
||||
$rows =& $this->items;
|
||||
|
||||
?>
|
||||
|
||||
<form action="index.php" method="post" name="adminForm">
|
||||
<table>
|
||||
<tr>
|
||||
<td align="left" width="100%">
|
||||
<?php echo JText::_( 'Filter' ); ?>:
|
||||
<input type="text" name="search" id="search" value="<?php echo $this->lists['search'];?>" class="text_area" onchange="document.adminForm.submit();" />
|
||||
<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
|
||||
<button onclick="document.getElementById('search').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
|
||||
</td>
|
||||
<td nowrap="nowrap">
|
||||
<?php
|
||||
echo $this->lists['type'];
|
||||
echo $this->lists['state'];
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="adminlist">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20">
|
||||
<?php echo JText::_( 'Num' ); ?>
|
||||
</th>
|
||||
<th width="20">
|
||||
<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows );?>);" />
|
||||
</th>
|
||||
<th class="title">
|
||||
<?php echo JHTML::_('grid.sort', 'Plugin Name', 'p.name', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th nowrap="nowrap" width="5%">
|
||||
<?php echo JHTML::_('grid.sort', 'Published', 'p.published', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th width="8%" nowrap="nowrap">
|
||||
<?php echo JHTML::_('grid.sort', 'Order', 'p.ordering', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
<?php if ($ordering) echo JHTML::_('grid.order', $rows ); ?>
|
||||
</th>
|
||||
<th nowrap="nowrap" width="10%">
|
||||
<?php echo JHTML::_('grid.sort', 'Access', 'groupname', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th nowrap="nowrap" width="10%" class="title">
|
||||
<?php echo JHTML::_('grid.sort', 'Type', 'p.folder', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th nowrap="nowrap" width="10%" class="title">
|
||||
<?php echo JHTML::_('grid.sort', 'File', 'p.element', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th nowrap="nowrap" width="1%" class="title">
|
||||
<?php echo JHTML::_('grid.sort', 'ID', 'p.id', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="12">
|
||||
<?php echo $this->pagination->getListFooter(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<?php
|
||||
$k = 0;
|
||||
for ($i=0, $n=count( $rows ); $i < $n; $i++) {
|
||||
$row = $rows[$i];
|
||||
|
||||
$link = JRoute::_( 'index.php?option=com_plugins&view=plugin&client='. $this->client .'&task=edit&cid[]='. $row->id );
|
||||
|
||||
$access = JHTML::_('grid.access', $row, $i );
|
||||
$checked = JHTML::_('grid.checkedout', $row, $i );
|
||||
$published = JHTML::_('grid.published', $row, $i );
|
||||
|
||||
?>
|
||||
<tr class="<?php echo "row$k"; ?>">
|
||||
<td align="right">
|
||||
<?php echo $this->pagination->getRowOffset( $i ); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $checked; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if ( JTable::isCheckedOut($this->user->get ('id'), $row->checked_out ) ) {
|
||||
echo $row->name;
|
||||
} else {
|
||||
?>
|
||||
<span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit Plugin' );?>::<?php echo $row->name; ?>">
|
||||
<a href="<?php echo $link; ?>">
|
||||
<?php echo $row->name; ?></a></span>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<?php echo $published;?>
|
||||
</td>
|
||||
<td class="order">
|
||||
<span><?php echo $this->pagination->orderUpIcon( $i, ($row->folder == @$rows[$i-1]->folder && $row->ordering > -10000 && $row->ordering < 10000), 'orderup', 'Move Up', $ordering ); ?></span>
|
||||
<span><?php echo $this->pagination->orderDownIcon( $i, $n, ($row->folder == @$rows[$i+1]->folder && $row->ordering > -10000 && $row->ordering < 10000), 'orderdown', 'Move Down', $ordering ); ?></span>
|
||||
<?php $disabled = $ordering ? '' : 'disabled="disabled"'; ?>
|
||||
<input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>" <?php echo $disabled ?> class="text_area" style="text-align: center" />
|
||||
</td>
|
||||
<td align="center">
|
||||
<?php echo $access;?>
|
||||
</td>
|
||||
<td nowrap="nowrap">
|
||||
<?php echo $row->folder;?>
|
||||
</td>
|
||||
<td nowrap="nowrap">
|
||||
<?php echo $row->element;?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<?php echo $row->id;?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$k = 1 - $k;
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<input type="hidden" name="option" value="com_plugins" />
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="filter_client" value="<?php echo $this->client;?>" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
|
||||
<?php echo JHTML::_( 'form.token' ); ?>
|
||||
</form>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: view.html.php 11655 2009-03-08 20:04:17Z willebil $
|
||||
* @package Joomla
|
||||
* @subpackage Config
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
jimport( 'joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* HTML View class for the Plugins component
|
||||
*
|
||||
* @static
|
||||
* @package Joomla
|
||||
* @subpackage Plugins
|
||||
* @since 1.0
|
||||
*/
|
||||
class PluginsViewPlugins extends JView
|
||||
{
|
||||
function display( $tpl = null )
|
||||
{
|
||||
global $mainframe, $option;
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
|
||||
$client = JRequest::getWord( 'filter_client', 'site' );
|
||||
|
||||
$filter_order = $mainframe->getUserStateFromRequest( "$option.$client.filter_order", 'filter_order', 'p.folder', 'cmd' );
|
||||
$filter_order_Dir = $mainframe->getUserStateFromRequest( "$option.$client.filter_order_Dir", 'filter_order_Dir', '', 'word' );
|
||||
$filter_state = $mainframe->getUserStateFromRequest( "$option.$client.filter_state", 'filter_state', '', 'word' );
|
||||
$filter_type = $mainframe->getUserStateFromRequest( "$option.$client.filter_type", 'filter_type', 1, 'cmd' );
|
||||
$search = $mainframe->getUserStateFromRequest( "$option.$client.search", 'search', '', 'string' );
|
||||
$search = JString::strtolower( $search );
|
||||
|
||||
$limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' );
|
||||
$limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' );
|
||||
|
||||
$where = '';
|
||||
if ($client == 'admin') {
|
||||
$where[] = 'p.client_id = 1';
|
||||
$client_id = 1;
|
||||
} else {
|
||||
$where[] = 'p.client_id = 0';
|
||||
$client_id = 0;
|
||||
}
|
||||
|
||||
// used by filter
|
||||
if ( $filter_type != 1 ) {
|
||||
$where[] = 'p.folder = '.$db->Quote($filter_type);
|
||||
}
|
||||
if ( $search ) {
|
||||
$where[] = 'LOWER( p.name ) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false );
|
||||
}
|
||||
if ( $filter_state ) {
|
||||
if ( $filter_state == 'P' ) {
|
||||
$where[] = 'p.published = 1';
|
||||
} else if ($filter_state == 'U' ) {
|
||||
$where[] = 'p.published = 0';
|
||||
}
|
||||
}
|
||||
|
||||
$where = ( count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : '' );
|
||||
if ($filter_order == 'p.ordering') {
|
||||
$orderby = ' ORDER BY p.folder, p.ordering '. $filter_order_Dir;
|
||||
} else {
|
||||
$orderby = ' ORDER BY '. $filter_order .' '. $filter_order_Dir .', p.ordering ASC';
|
||||
}
|
||||
|
||||
|
||||
// get the total number of records
|
||||
$query = 'SELECT COUNT(*)'
|
||||
. ' FROM #__plugins AS p'
|
||||
. $where
|
||||
;
|
||||
$db->setQuery( $query );
|
||||
$total = $db->loadResult();
|
||||
|
||||
jimport('joomla.html.pagination');
|
||||
$pagination = new JPagination( $total, $limitstart, $limit );
|
||||
|
||||
$query = 'SELECT p.*, u.name AS editor, g.name AS groupname'
|
||||
. ' FROM #__plugins AS p'
|
||||
. ' LEFT JOIN #__users AS u ON u.id = p.checked_out'
|
||||
. ' LEFT JOIN #__groups AS g ON g.id = p.access'
|
||||
. $where
|
||||
. ' GROUP BY p.id'
|
||||
. $orderby
|
||||
;
|
||||
$db->setQuery( $query, $pagination->limitstart, $pagination->limit );
|
||||
$rows = $db->loadObjectList();
|
||||
if ($db->getErrorNum()) {
|
||||
echo $db->stderr();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// get list of Positions for dropdown filter
|
||||
$query = 'SELECT folder AS value, folder AS text'
|
||||
. ' FROM #__plugins'
|
||||
. ' WHERE client_id = '.(int) $client_id
|
||||
. ' GROUP BY folder'
|
||||
. ' ORDER BY folder'
|
||||
;
|
||||
$types[] = JHTML::_('select.option', 1, '- '. JText::_( 'Select Type' ) .' -' );
|
||||
$db->setQuery( $query );
|
||||
$types = array_merge( $types, $db->loadObjectList() );
|
||||
$lists['type'] = JHTML::_('select.genericlist', $types, 'filter_type', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', $filter_type );
|
||||
|
||||
// state filter
|
||||
$lists['state'] = JHTML::_('grid.state', $filter_state );
|
||||
|
||||
|
||||
// table ordering
|
||||
$lists['order_Dir'] = $filter_order_Dir;
|
||||
$lists['order'] = $filter_order;
|
||||
|
||||
// search filter
|
||||
$lists['search']= $search;
|
||||
|
||||
$this->assign('client', $client);
|
||||
|
||||
$this->assignRef('user', JFactory::getUser());
|
||||
$this->assignRef('lists', $lists);
|
||||
$this->assignRef('items', $rows);
|
||||
$this->assignRef('pagination', $pagination);
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user