first commit

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

View File

@ -0,0 +1,25 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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;
$input = JFactory::getApplication()->input;
if (!JFactory::getUser()->authorise('core.manage', $input->get('extension')))
{
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
JLoader::register('JHtmlCategoriesAdministrator', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/html/categoriesadministrator.php');
$task = $input->get('task');
$controller = JControllerLegacy::getInstance('Categories');
$controller->execute($input->get('task'));
$controller->redirect();

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.1" method="upgrade">
<name>com_categories</name>
<author>Joomla! Project</author>
<creationDate>December 2007</creationDate>
<copyright>(C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>COM_CATEGORIES_XML_DESCRIPTION</description>
<administration>
<files folder="admin">
<filename>categories.php</filename>
<filename>config.xml</filename>
<filename>controller.php</filename>
<filename>index.html</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_categories.ini</language>
<language tag="en-GB">language/en-GB.com_categories.sys.ini</language>
</languages>
</administration>
</extension>

View File

@ -0,0 +1,100 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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;
/**
* Categories view class for the Category package.
*
* @package Joomla.Administrator
* @subpackage com_categories
* @since 1.6
*/
class CategoriesController extends JControllerLegacy
{
/**
* @var string The extension for which the categories apply.
* @since 1.6
*/
protected $extension;
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
*
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
parent::__construct($config);
// Guess the JText message prefix. Defaults to the option.
if (empty($this->extension))
{
$this->extension = $this->input->get('extension', 'com_content');
}
}
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams 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)
{
// Get the document object.
$document = JFactory::getDocument();
// Set the default view name and format from the Request.
$vName = $this->input->get('view', 'categories');
$vFormat = $document->getType();
$lName = $this->input->get('layout', 'default');
$id = $this->input->getInt('id');
// Check for edit form.
if ($vName == 'category' && $lName == 'edit' && !$this->checkEditId('com_categories.edit.category', $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_categories&view=categories&extension=' . $this->extension, false));
return false;
}
// Get and render the view.
if ($view = $this->getView($vName, $vFormat))
{
// Get the model for the view.
$model = $this->getModel($vName, 'CategoriesModel', array('name' => $vName . '.' . substr($this->extension, 4)));
// Push the model into the view (as default).
$view->setModel($model, true);
$view->setLayout($lName);
// Push document object into the view.
$view->document = $document;
// Load the submenu.
require_once JPATH_COMPONENT . '/helpers/categories.php';
CategoriesHelper::addSubmenu($model->getState('filter.extension'));
$view->display();
}
return $this;
}
}

View File

@ -0,0 +1,136 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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;
/**
* The Categories List Controller
*
* @package Joomla.Administrator
* @subpackage com_categories
* @since 1.6
*/
class CategoriesControllerCategories extends JControllerAdmin
{
/**
* Proxy for getModel
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
*
* @return object The model.
*
* @since 1.6
*/
public function getModel($name = 'Category', $prefix = 'CategoriesModel', $config = array('ignore_request' => true))
{
$model = parent::getModel($name, $prefix, $config);
return $model;
}
/**
* Rebuild the nested set tree.
*
* @return bool False on failure or error, true on success.
*
* @since 1.6
*/
public function rebuild()
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$extension = $this->input->get('extension');
$this->setRedirect(JRoute::_('index.php?option=com_categories&view=categories&extension=' . $extension, false));
$model = $this->getModel();
if ($model->rebuild())
{
// Rebuild succeeded.
$this->setMessage(JText::_('COM_CATEGORIES_REBUILD_SUCCESS'));
return true;
}
else
{
// Rebuild failed.
$this->setMessage(JText::_('COM_CATEGORIES_REBUILD_FAILURE'));
return false;
}
}
/**
* Save the manual order inputs from the categories list page.
*
* @return void
*
* @since 1.6
*/
public function saveorder()
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Get the arrays from the Request
$order = $this->input->post->get('order', null, 'array');
$originalOrder = explode(',', $this->input->getString('original_order_values'));
// Make sure something has changed
if (!($order === $originalOrder))
{
parent::saveorder();
}
else
{
// Nothing to reorder
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
return true;
}
}
/**
* Deletes and returns correctly.
*
* @return void
*
* @since 3.1.2
*/
public function delete()
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Get items to remove from the request.
$cid = $this->input->get('cid', array(), 'array');
$extension = $this->input->getCmd('extension', null);
if (!is_array($cid) || count($cid) < 1)
{
JError::raiseWarning(500, JText::_($this->text_prefix . '_NO_ITEM_SELECTED'));
}
else
{
// Get the model.
$model = $this->getModel();
// Make sure the item ids are integers
jimport('joomla.utilities.arrayhelper');
JArrayHelper::toInteger($cid);
// Remove the items.
if ($model->delete($cid))
{
$this->setMessage(JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid)));
}
else
{
$this->setMessage($model->getError());
}
}
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&extension=' . $extension, false));
}
}

View File

@ -0,0 +1,202 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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;
/**
* The Category Controller
*
* @package Joomla.Administrator
* @subpackage com_categories
* @since 1.6
*/
class CategoriesControllerCategory extends JControllerForm
{
/**
* The extension for which the categories apply.
*
* @var string
* @since 1.6
*/
protected $extension;
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* @since 1.6
* @see JController
*/
public function __construct($config = array())
{
parent::__construct($config);
// Guess the JText message prefix. Defaults to the option.
if (empty($this->extension))
{
$this->extension = $this->input->get('extension', 'com_content');
}
}
/**
* Method to check if you can add a new record.
*
* @param array $data An array of input data.
*
* @return boolean
*
* @since 1.6
*/
protected function allowAdd($data = array())
{
$user = JFactory::getUser();
return ($user->authorise('core.create', $this->extension) || count($user->getAuthorisedCategories($this->extension, 'core.create')));
}
/**
* Method to check if you can edit a record.
*
* @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 allowEdit($data = array(), $key = 'parent_id')
{
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$user = JFactory::getUser();
$userId = $user->get('id');
// Check general edit permission first.
if ($user->authorise('core.edit', $this->extension))
{
return true;
}
// Check specific edit permission.
if ($user->authorise('core.edit', $this->extension . '.category.' . $recordId))
{
return true;
}
// Fallback on edit.own.
// First test if the permission is available.
if ($user->authorise('core.edit.own', $this->extension . '.category.' . $recordId) || $user->authorise('core.edit.own', $this->extension))
{
// Now test the owner is the user.
$ownerId = (int) isset($data['created_user_id']) ? $data['created_user_id'] : 0;
if (empty($ownerId) && $recordId)
{
// Need to do a lookup from the model.
$record = $this->getModel()->getItem($recordId);
if (empty($record))
{
return false;
}
$ownerId = $record->created_user_id;
}
// If the owner matches 'me' then do the test.
if ($ownerId == $userId)
{
return true;
}
}
return false;
}
/**
* Method to run batch operations.
*
* @param object $model The model.
*
* @return boolean True if successful, false otherwise and internal error is set.
*
* @since 1.6
*/
public function batch($model = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Set the model
$model = $this->getModel('Category');
// Preset the redirect
$this->setRedirect('index.php?option=com_categories&view=categories&extension=' . $this->extension);
return parent::batch($model);
}
/**
* Gets the URL arguments to append to an item redirect.
*
* @param integer $recordId The primary key id for the item.
* @param string $urlVar The name of the URL variable for the id.
*
* @return string The arguments to append to the redirect URL.
*
* @since 1.6
*/
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{
$append = parent::getRedirectToItemAppend($recordId);
$append .= '&extension=' . $this->extension;
return $append;
}
/**
* Gets the URL arguments to append to a list redirect.
*
* @return string The arguments to append to the redirect URL.
*
* @since 1.6
*/
protected function getRedirectToListAppend()
{
$append = parent::getRedirectToListAppend();
$append .= '&extension=' . $this->extension;
return $append;
}
/**
* 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 3.1
*/
protected function postSaveHook(JModelLegacy $model, $validData = array())
{
$item = $model->getItem();
if (isset($item->params) && is_array($item->params))
{
$registry = new JRegistry;
$registry->loadArray($item->params);
$item->params = (string) $registry;
}
if (isset($item->metadata) && is_array($item->metadata))
{
$registry = new JRegistry;
$registry->loadArray($item->metadata);
$item->metadata = (string) $registry;
}
return;
}
}

View File

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

View File

@ -0,0 +1,62 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_categories
*
* @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;
JLoader::register('CategoriesHelper', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/categories.php');
/**
* Category Component Association Helper
*
* @package Joomla.Site
* @subpackage com_categories
* @since 3.0
*/
abstract class CategoryHelperAssociation
{
public static $category_association = true;
/**
* Method to get the associations for a given category
*
* @param integer $id Id of the item
* @param string $extension Name of the component
*
* @return array Array of associations for the component categories
*
* @since 3.0
*/
public static function getCategoryAssociations($id = 0, $extension = 'com_content')
{
$return = array();
if ($id)
{
// Load route helper
jimport('helper.route', JPATH_COMPONENT_SITE);
$helperClassname = ucfirst(substr($extension, 4)) . 'HelperRoute';
$associations = CategoriesHelper::getAssociations($id, $extension);
foreach ($associations as $tag => $item)
{
if (class_exists($helperClassname) && is_callable(array($helperClassname, 'getCategoryRoute')))
{
$return[$tag] = $helperClassname::getCategoryRoute($item, $tag);
}
else
{
$return[$tag] = 'index.php?option=' . $extension . '&view=category&id=' . $item;
}
}
}
return $return;
}
}

View File

@ -0,0 +1,152 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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;
/**
* Categories helper.
*
* @package Joomla.Administrator
* @subpackage com_categories
* @since 1.6
*/
class CategoriesHelper
{
/**
* Configure the Submenu links.
*
* @param string $extension The extension being used for the categories.
*
* @return void
*
* @since 1.6
*/
public static function addSubmenu($extension)
{
// Avoid nonsense situation.
if ($extension == 'com_categories')
{
return;
}
$parts = explode('.', $extension);
$component = $parts[0];
if (count($parts) > 1)
{
$section = $parts[1];
}
// Try to find the component helper.
$eName = str_replace('com_', '', $component);
$file = JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component . '/helpers/' . $eName . '.php');
if (file_exists($file))
{
require_once $file;
$prefix = ucfirst(str_replace('com_', '', $component));
$cName = $prefix . 'Helper';
if (class_exists($cName))
{
if (is_callable(array($cName, 'addSubmenu')))
{
$lang = JFactory::getLanguage();
// loading language file from the administrator/language directory then
// loading language file from the administrator/components/*extension*/language directory
$lang->load($component, JPATH_BASE, null, false, false)
|| $lang->load($component, JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component), null, false, false)
|| $lang->load($component, JPATH_BASE, $lang->getDefault(), false, false)
|| $lang->load($component, JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component), $lang->getDefault(), false, false);
call_user_func(array($cName, 'addSubmenu'), 'categories' . (isset($section) ? '.' . $section : ''));
}
}
}
}
/**
* Gets a list of the actions that can be performed.
*
* @param string $extension The extension.
* @param integer $categoryId The category ID.
*
* @return JObject
*
* @since 1.6
*/
public static function getActions($extension, $categoryId = 0)
{
$user = JFactory::getUser();
$result = new JObject;
$parts = explode('.', $extension);
$component = $parts[0];
if (empty($categoryId))
{
$assetName = $component;
$level = 'component';
}
else
{
$assetName = $component . '.category.' . (int) $categoryId;
$level = 'category';
}
$actions = JAccess::getActions($component, $level);
foreach ($actions as $action)
{
$result->set($action->name, $user->authorise($action->name, $assetName));
}
return $result;
}
public static function getAssociations($pk, $extension = 'com_content')
{
$associations = array();
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->from('#__categories as c')
->join('INNER', '#__associations as a ON a.id = c.id AND a.context=' . $db->quote('com_categories.item'))
->join('INNER', '#__associations as a2 ON a.key = a2.key')
->join('INNER', '#__categories as c2 ON a2.id = c2.id AND c2.extension = ' . $db->quote($extension))
->where('c.id =' . (int) $pk)
->where('c.extension = ' . $db->quote($extension));
$select = array(
'c2.language',
$query->concatenate(array('c2.id', 'c2.alias'), ':') . ' AS id'
);
$query->select($select);
$db->setQuery($query);
$contentitems = $db->loadObjectList('language');
// Check for a database error.
if ($error = $db->getErrorMsg())
{
JError::raiseWarning(500, $error);
return false;
}
foreach ($contentitems as $tag => $item)
{
// Do not return itself as result
if ((int) $item->id != $pk)
{
$associations[$tag] = $item->id;
}
}
return $associations;
}
}

View File

@ -0,0 +1,84 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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;
JLoader::register('CategoriesHelper', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/categories.php');
/**
* @package Joomla.Administrator
* @subpackage com_categories
*/
abstract class JHtmlCategoriesAdministrator
{
/**
* Render the list of associated items
*
* @param integer $catid Category identifier to search its associations
* @param string $extension Category Extension
*
* @return string The language HTML
*/
public static function association($catid, $extension = 'com_content')
{
// Defaults
$html = '';
// Get the associations
if ($associations = CategoriesHelper::getAssociations($catid, $extension))
{
JArrayHelper::toInteger($associations);
// Get the associated categories
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('c.id, c.title')
->select('l.sef as lang_sef')
->from('#__categories as c')
->where('c.id IN (' . implode(',', array_values($associations)) . ')')
->join('LEFT', '#__languages as l ON c.language=l.lang_code')
->select('l.image')
->select('l.title as language_title');
$db->setQuery($query);
try
{
$items = $db->loadObjectList('id');
}
catch (RuntimeException $e)
{
throw new Exception($e->getMessage(), 500);
}
if ($items)
{
foreach ($items as &$item)
{
$text = strtoupper($item->lang_sef);
$url = JRoute::_('index.php?option=com_categories&task=category.edit&id=' . (int) $item->id . '&extension=' . $extension);
$tooltipParts = array(
JHtml::_(
'image', 'mod_languages/' . $item->image . '.gif',
$item->language_title,
array('title' => $item->language_title),
true
),
$item->title
);
$item->link = JHtml::_('tooltip', implode(' ', $tooltipParts), null, null, $text, $url, null, 'hasTooltip label label-association label-' . $item->lang_sef);
}
}
$html = JLayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
}

View File

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

View File

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

View File

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

View File

@ -0,0 +1,315 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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;
/**
* Categories Component Categories Model
*
* @package Joomla.Administrator
* @subpackage com_categories
* @since 1.6
*/
class CategoriesModelCategories extends JModelList
{
/**
* Constructor.
*
* @param array $config 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',
'alias', 'a.alias',
'published', 'a.published',
'access', 'a.access', 'access_level',
'language', 'a.language',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'created_time', 'a.created_time',
'created_user_id', 'a.created_user_id',
'lft', 'a.lft',
'rgt', 'a.rgt',
'level', 'a.level',
'path', 'a.path',
);
}
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)
{
$app = JFactory::getApplication();
$context = $this->context;
$extension = $app->getUserStateFromRequest('com_categories.categories.filter.extension', 'extension', 'com_content', 'cmd');
$this->setState('filter.extension', $extension);
$parts = explode('.', $extension);
// Extract the component name
$this->setState('filter.component', $parts[0]);
// Extract the optional section name
$this->setState('filter.section', (count($parts) > 1) ? $parts[1] : null);
$search = $this->getUserStateFromRequest($context . '.search', 'filter_search');
$this->setState('filter.search', $search);
$level = $this->getUserStateFromRequest($context . '.filter.level', 'filter_level', 0, 'int');
$this->setState('filter.level', $level);
$access = $this->getUserStateFromRequest($context . '.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $access);
$published = $this->getUserStateFromRequest($context . '.filter.published', 'filter_published', '');
$this->setState('filter.published', $published);
$language = $this->getUserStateFromRequest($context . '.filter.language', 'filter_language', '');
$this->setState('filter.language', $language);
// Force a language
$forcedLanguage = $app->input->get('forcedLanguage');
if (!empty($forcedLanguage))
{
$this->setState('filter.language', $forcedLanguage);
$this->setState('filter.forcedLanguage', $forcedLanguage);
}
$tag = $this->getUserStateFromRequest($this->context . '.filter.tag', 'filter_tag', '');
$this->setState('filter.tag', $tag);
// List state information.
parent::populateState('a.lft', 'asc');
}
/**
* Method to get a store id based on model configuration state.
*
* This is necessary because the model is used by the component and
* different modules that might need different sets of data or different
* ordering requirements.
*
* @param string $id A prefix for the store id.
*
* @return string A store id.
*
* @since 1.6
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.extension');
$id .= ':' . $this->getState('filter.published');
$id .= ':' . $this->getState('filter.language');
return parent::getStoreId($id);
}
/**
* @return string
*
* @since 1.6
*/
protected function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
$user = JFactory::getUser();
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.id, a.title, a.alias, a.note, a.published, a.access' .
', a.checked_out, a.checked_out_time, a.created_user_id' .
', a.path, a.parent_id, a.level, a.lft, a.rgt' .
', a.language'
)
);
$query->from('#__categories 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 users for the author.
$query->select('ua.name AS author_name')
->join('LEFT', '#__users AS ua ON ua.id = a.created_user_id');
// Join over the associations.
$assoc = $this->getAssoc();
if ($assoc)
{
$query->select('COUNT(asso2.id)>1 as association')
->join('LEFT', '#__associations AS asso ON asso.id = a.id AND asso.context=' . $db->quote('com_categories.item'))
->join('LEFT', '#__associations AS asso2 ON asso2.key = asso.key')
->group('a.id');
}
// Filter by extension
if ($extension = $this->getState('filter.extension'))
{
$query->where('a.extension = ' . $db->quote($extension));
}
// Filter on the level.
if ($level = $this->getState('filter.level'))
{
$query->where('a.level <= ' . (int) $level);
}
// Filter by access level.
if ($access = $this->getState('filter.access'))
{
$query->where('a.access = ' . (int) $access);
}
// Implement View Level Access
if (!$user->authorise('core.admin'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
// Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published))
{
$query->where('a.published = ' . (int) $published);
}
elseif ($published === '')
{
$query->where('(a.published IN (0, 1))');
}
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0)
{
$query->where('a.id = ' . (int) substr($search, 3));
}
elseif (stripos($search, 'author:') === 0)
{
$search = $db->quote('%' . $db->escape(substr($search, 7), true) . '%');
$query->where('(ua.name LIKE ' . $search . ' OR ua.username LIKE ' . $search . ')');
}
else
{
$search = $db->quote('%' . $db->escape($search, true) . '%');
$query->where('(a.title LIKE ' . $search . ' OR a.alias LIKE ' . $search . ' OR a.note LIKE ' . $search . ')');
}
}
// Filter on the language.
if ($language = $this->getState('filter.language'))
{
$query->where('a.language = ' . $db->quote($language));
}
// Filter by a single tag.
$tagId = $this->getState('filter.tag');
if (is_numeric($tagId))
{
$query->where($db->quoteName('tagmap.tag_id') . ' = ' . (int) $tagId)
->join(
'LEFT', $db->quoteName('#__contentitem_tag_map', 'tagmap')
. ' ON ' . $db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id')
. ' AND ' . $db->quoteName('tagmap.type_alias') . ' = ' . $db->quote($extension . '.category')
);
}
// Add the list ordering clause
$listOrdering = $this->getState('list.ordering', 'a.lft');
$listDirn = $db->escape($this->getState('list.direction', 'ASC'));
if ($listOrdering == 'a.access')
{
$query->order('a.access ' . $listDirn . ', a.lft ' . $listDirn);
}
else
{
$query->order($db->escape($listOrdering) . ' ' . $listDirn);
}
//echo nl2br(str_replace('#__','jos_',$query));
return $query;
}
/**
* Method to determine if an association exists
*
* @return boolean True if the association exists
*
* @since 3.0
*/
public function getAssoc()
{
static $assoc = null;
if (!is_null($assoc))
{
return $assoc;
}
$app = JFactory::getApplication();
$extension = $this->getState('filter.extension');
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
$extension = explode('.', $extension);
$component = array_shift($extension);
$cname = str_replace('com_', '', $component);
if (!$assoc || !$component || !$cname)
{
$assoc = false;
}
else
{
$hname = $cname . 'HelperAssociation';
JLoader::register($hname, JPATH_SITE . '/components/' . $component . '/helpers/association.php');
$assoc = class_exists($hname) && !empty($hname::$category_association);
}
return $assoc;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,230 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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;
JFormHelper::loadFieldClass('list');
/**
* Form Field class for the Joomla Framework.
*
* @package Joomla.Administrator
* @subpackage com_categories
* @since 1.6
*/
class JFormFieldCategoryEdit extends JFormFieldList
{
/**
* A flexible category list that respects access controls
*
* @var string
* @since 1.6
*/
public $type = 'CategoryEdit';
/**
* Method to get a list of categories that respects access controls and can be used for
* either category assignment or parent category assignment in edit screens.
* Use the parent element to indicate that the field will be used for assigning parent categories.
*
* @return array The field option objects.
*
* @since 1.6
*/
protected function getOptions()
{
$options = array();
$published = $this->element['published'] ? $this->element['published'] : array(0, 1);
$name = (string) $this->element['name'];
// Let's get the id for the current item, either category or content item.
$jinput = JFactory::getApplication()->input;
// Load the category options for a given extension.
// For categories the old category is the category id or 0 for new category.
if ($this->element['parent'] || $jinput->get('option') == 'com_categories')
{
$oldCat = $jinput->get('id', 0);
$oldParent = $this->form->getValue($name, 0);
$extension = $this->element['extension'] ? (string) $this->element['extension'] : (string) $jinput->get('extension', 'com_content');
}
else
// For items the old category is the category they are in when opened or 0 if new.
{
$oldCat = $this->form->getValue($name, 0);
$extension = $this->element['extension'] ? (string) $this->element['extension'] : (string) $jinput->get('option', 'com_content');
}
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('a.id AS value, a.title AS text, a.level, a.published')
->from('#__categories AS a')
->join('LEFT', $db->quoteName('#__categories') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
// Filter by the extension type
if ($this->element['parent'] == true || $jinput->get('option') == 'com_categories')
{
$query->where('(a.extension = ' . $db->quote($extension) . ' OR a.parent_id = 0)');
}
else
{
$query->where('(a.extension = ' . $db->quote($extension) . ')');
}
// If parent isn't explicitly stated but we are in com_categories assume we want parents
if ($oldCat != 0 && ($this->element['parent'] == true || $jinput->get('option') == 'com_categories'))
{
// Prevent parenting to children of this item.
// To rearrange parents and children move the children up, not the parents down.
$query->join('LEFT', $db->quoteName('#__categories') . ' AS p ON p.id = ' . (int) $oldCat)
->where('NOT(a.lft >= p.lft AND a.rgt <= p.rgt)');
$rowQuery = $db->getQuery(true);
$rowQuery->select('a.id AS value, a.title AS text, a.level, a.parent_id')
->from('#__categories AS a')
->where('a.id = ' . (int) $oldCat);
$db->setQuery($rowQuery);
$row = $db->loadObject();
}
// Filter language
if (!empty($this->element['language']))
{
$query->where('a.language = ' . $db->quote($this->element['language']));
}
// Filter on the published state
if (is_numeric($published))
{
$query->where('a.published = ' . (int) $published);
}
elseif (is_array($published))
{
JArrayHelper::toInteger($published);
$query->where('a.published IN (' . implode(',', $published) . ')');
}
$query->group('a.id, a.title, a.level, a.lft, a.rgt, a.extension, a.parent_id, a.published')
->order('a.lft ASC');
// Get the options.
$db->setQuery($query);
try
{
$options = $db->loadObjectList();
}
catch (RuntimeException $e)
{
JError::raiseWarning(500, $e->getMessage);
}
// Pad the option text with spaces using depth level as a multiplier.
for ($i = 0, $n = count($options); $i < $n; $i++)
{
// Translate ROOT
if ($this->element['parent'] == true || $jinput->get('option') == 'com_categories')
{
if ($options[$i]->level == 0)
{
$options[$i]->text = JText::_('JGLOBAL_ROOT_PARENT');
}
}
if ($options[$i]->published == 1)
{
$options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
}
else
{
$options[$i]->text = str_repeat('- ', $options[$i]->level) . '[' . $options[$i]->text . ']';
}
}
// Get the current user object.
$user = JFactory::getUser();
// For new items we want a list of categories you are allowed to create in.
if ($oldCat == 0)
{
foreach ($options as $i => $option)
{
// To take save or create in a category you need to have create rights for that category
// unless the item is already in that category.
// Unset the option if the user isn't authorised for it. In this field assets are always categories.
if ($user->authorise('core.create', $extension . '.category.' . $option->value) != true)
{
unset($options[$i]);
}
}
}
// If you have an existing category id things are more complex.
else
{
// If you are only allowed to edit in this category but not edit.state, you should not get any
// option to change the category parent for a category or the category for a content item,
// but you should be able to save in that category.
foreach ($options as $i => $option)
{
if ($user->authorise('core.edit.state', $extension . '.category.' . $oldCat) != true && !isset($oldParent))
{
if ($option->value != $oldCat)
{
unset($options[$i]);
}
}
if ($user->authorise('core.edit.state', $extension . '.category.' . $oldCat) != true
&& (isset($oldParent))
&& $option->value != $oldParent
)
{
unset($options[$i]);
}
// However, if you can edit.state you can also move this to another category for which you have
// create permission and you should also still be able to save in the current category.
if (($user->authorise('core.create', $extension . '.category.' . $option->value) != true)
&& ($option->value != $oldCat && !isset($oldParent))
)
{
{
unset($options[$i]);
}
}
if (($user->authorise('core.create', $extension . '.category.' . $option->value) != true)
&& (isset($oldParent))
&& $option->value != $oldParent
)
{
{
unset($options[$i]);
}
}
}
}
if (($this->element['parent'] == true || $jinput->get('option') == 'com_categories')
&& (isset($row) && !isset($options[0]))
&& isset($this->element['show_root'])
)
{
if ($row->parent_id == '1')
{
$parent = new stdClass;
$parent->text = JText::_('JGLOBAL_ROOT_PARENT');
array_unshift($options, $parent);
}
array_unshift($options, JHtml::_('select.option', '0', JText::_('JGLOBAL_ROOT')));
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
}

View File

@ -0,0 +1,174 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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;
JFormHelper::loadFieldClass('list');
/**
* Form Field class for the Joomla Framework.
*
* @package Joomla.Administrator
* @subpackage com_categories
* @since 1.6
*/
class JFormFieldCategoryParent extends JFormFieldList
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
protected $type = 'CategoryParent';
/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since 1.6
*/
protected function getOptions()
{
// Initialise variables.
$options = array();
$name = (string) $this->element['name'];
// Let's get the id for the current item, either category or content item.
$jinput = JFactory::getApplication()->input;
// For categories the old category is the category id 0 for new category.
if ($this->element['parent'])
{
$oldCat = $jinput->get('id', 0);
}
else
// For items the old category is the category they are in when opened or 0 if new.
{
$oldCat = $this->form->getValue($name);
}
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('a.id AS value, a.title AS text, a.level')
->from('#__categories AS a')
->join('LEFT', $db->quoteName('#__categories') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
// Filter by the type
if ($extension = $this->form->getValue('extension'))
{
$query->where('(a.extension = ' . $db->quote($extension) . ' OR a.parent_id = 0)');
}
if ($this->element['parent'])
{
// Prevent parenting to children of this item.
if ($id = $this->form->getValue('id'))
{
$query->join('LEFT', $db->quoteName('#__categories') . ' AS p ON p.id = ' . (int) $id)
->where('NOT(a.lft >= p.lft AND a.rgt <= p.rgt)');
$rowQuery = $db->getQuery(true);
$rowQuery->select('a.id AS value, a.title AS text, a.level, a.parent_id')
->from('#__categories AS a')
->where('a.id = ' . (int) $id);
$db->setQuery($rowQuery);
$row = $db->loadObject();
}
}
$query->where('a.published IN (0,1)')
->group('a.id, a.title, a.level, a.lft, a.rgt, a.extension, a.parent_id')
->order('a.lft ASC');
// Get the options.
$db->setQuery($query);
try
{
$options = $db->loadObjectList();
}
catch (RuntimeException $e)
{
JError::raiseWarning(500, $e->getMessage());
}
// Pad the option text with spaces using depth level as a multiplier.
for ($i = 0, $n = count($options); $i < $n; $i++)
{
// Translate ROOT
if ($options[$i]->level == 0)
{
$options[$i]->text = JText::_('JGLOBAL_ROOT_PARENT');
}
$options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
}
// Get the current user object.
$user = JFactory::getUser();
// For new items we want a list of categories you are allowed to create in.
if ($oldCat == 0)
{
foreach ($options as $i => $option)
{
// To take save or create in a category you need to have create rights for that category
// unless the item is already in that category.
// Unset the option if the user isn't authorised for it. In this field assets are always categories.
if ($user->authorise('core.create', $extension . '.category.' . $option->value) != true)
{
unset($options[$i]);
}
}
}
// If you have an existing category id things are more complex.
else
{
//$categoryOld = $this->form->getValue($name);
foreach ($options as $i => $option)
{
// If you are only allowed to edit in this category but not edit.state, you should not get any
// option to change the category parent for a category or the category for a content item,
// but you should be able to save in that category.
if ($user->authorise('core.edit.state', $extension . '.category.' . $oldCat) != true)
{
if ($option->value != $oldCat)
{
echo 'y';
unset($options[$i]);
}
}
// However, if you can edit.state you can also move this to another category for which you have
// create permission and you should also still be able to save in the current category.
elseif
(($user->authorise('core.create', $extension . '.category.' . $option->value) != true)
&& $option->value != $oldCat
)
{
echo 'x';
unset($options[$i]);
}
}
}
if (isset($row) && !isset($options[0]))
{
if ($row->parent_id == '1')
{
$parent = new stdClass;
$parent->text = JText::_('JGLOBAL_ROOT_PARENT');
array_unshift($options, $parent);
}
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
}

View File

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

View File

@ -0,0 +1,161 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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 a modal article picker.
*
* @package Joomla.Administrator
* @subpackage com_categories
* @since 3.1
*/
class JFormFieldModal_Category extends JFormField
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
protected $type = 'Modal_Category';
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
$extension = $this->element['extension'] ? (string) $this->element['extension'] : (string) JFactory::getApplication()->input->get('extension', 'com_content');
$allowEdit = ((string) $this->element['edit'] == 'true') ? true : false;
$allowClear = ((string) $this->element['clear'] != 'false') ? true : false;
// Load language
JFactory::getLanguage()->load('com_categories', JPATH_ADMINISTRATOR);
// Load the modal behavior script.
JHtml::_('behavior.modal', 'a.modal');
// Build the script.
$script = array();
// Select button script
$script[] = ' function jSelectCategory_'.$this->id.'(id, title, object) {';
$script[] = ' document.getElementById("'.$this->id.'_id").value = id;';
$script[] = ' document.getElementById("'.$this->id.'_name").value = title;';
if ($allowEdit)
{
$script[] = ' jQuery("#'.$this->id.'_edit").removeClass("hidden");';
}
if ($allowClear)
{
$script[] = ' jQuery("#'.$this->id.'_clear").removeClass("hidden");';
}
$script[] = ' SqueezeBox.close();';
$script[] = ' }';
// Clear button script
static $scriptClear;
if ($allowClear && !$scriptClear)
{
$scriptClear = true;
$script[] = ' function jClearCategory(id) {';
$script[] = ' document.getElementById(id + "_id").value = "";';
$script[] = ' document.getElementById(id + "_name").value = "'.htmlspecialchars(JText::_('COM_CATEGORIES_SELECT_A_CATEGORY', true), ENT_COMPAT, 'UTF-8').'";';
$script[] = ' jQuery("#"+id + "_clear").addClass("hidden");';
$script[] = ' if (document.getElementById(id + "_edit")) {';
$script[] = ' jQuery("#"+id + "_edit").addClass("hidden");';
$script[] = ' }';
$script[] = ' return false;';
$script[] = ' }';
}
// Add the script to the document head.
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
// Setup variables for display.
$html = array();
$link = 'index.php?option=com_categories&amp;view=categories&amp;layout=modal&amp;tmpl=component&amp;extension='.$extension.'&amp;function=jSelectCategory_'.$this->id;
if (isset($this->element['language']))
{
$link .= '&amp;forcedLanguage='.$this->element['language'];
}
$db = JFactory::getDbo();
$db->setQuery(
'SELECT title' .
' FROM #__categories' .
' WHERE id = '.(int) $this->value
);
try
{
$title = $db->loadResult();
}
catch (RuntimeException $e)
{
JError::raiseWarning(500, $e->getMessage());
}
if (empty($title))
{
$title = JText::_('COM_CATEGORIES_SELECT_A_CATEGORY');
}
$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
// The active category id field.
if (0 == (int) $this->value)
{
$value = '';
}
else
{
$value = (int) $this->value;
}
// The current category display field.
$html[] = '<span class="input-append">';
$html[] = '<input type="text" class="input-medium" id="'.$this->id.'_name" value="'.$title.'" disabled="disabled" size="35" />';
$html[] = '<a class="modal btn hasTooltip" title="'.JHtml::tooltipText('COM_CATEGORIES_CHANGE_CATEGORY').'" href="'.$link.'&amp;'.JSession::getFormToken().'=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}"><i class="icon-file"></i> '.JText::_('JSELECT').'</a>';
// Edit category button
if ($allowEdit)
{
$html[] = '<a class="btn hasTooltip'.($value ? '' : ' hidden').'" href="index.php?option=com_categories&layout=modal&tmpl=component&task=category.edit&id=' . $value. '" target="_blank" title="'.JHtml::tooltipText('COM_CATEGORIES_EDIT_CATEGORY').'" ><span class="icon-edit"></span> ' . JText::_('JACTION_EDIT') . '</a>';
}
// Clear category button
if ($allowClear)
{
$html[] = '<button id="'.$this->id.'_clear" class="btn'.($value ? '' : ' hidden').'" onclick="return jClearCategory(\''.$this->id.'\')"><span class="icon-remove"></span> ' . JText::_('JCLEAR') . '</button>';
}
$html[] = '</span>';
// class='required' for client side validation
$class = '';
if ($this->required)
{
$class = ' class="required modal-value"';
}
$html[] = '<input type="hidden" id="'.$this->id.'_id"'.$class.' name="'.$this->name.'" value="'.$value.'" />';
return implode("\n", $html);
}
}

View File

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

View File

@ -0,0 +1,252 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<field
name="id"
type="text"
default="0"
label="JGLOBAL_FIELD_ID_LABEL"
description="JGLOBAL_FIELD_ID_DESC"
class="readonly"
readonly="true" />
<field
name="hits"
type="text"
default="0"
label="JGLOBAL_HITS"
description="COM_CATEGORIES_FIELD_HITS_DESC"
class="readonly"
readonly="true" />
<field
name="asset_id"
type="hidden"
filter="unset" />
<field
name="parent_id"
type="categoryedit"
label="COM_CATEGORIES_FIELD_PARENT_LABEL"
description="COM_CATEGORIES_FIELD_PARENT_DESC"
class="span12 small" />
<field
name="lft"
type="hidden"
filter="unset" />
<field
name="rgt"
type="hidden"
filter="unset" />
<field
name="level"
type="hidden"
filter="unset" />
<field
name="path"
type="text"
label="CATEGORIES_PATH_LABEL"
description="CATEGORIES_PATH_DESC"
class="readonly"
size="40"
readonly="true" />
<field
name="extension"
type="hidden" />
<field
name="title"
type="text"
label="JGLOBAL_TITLE"
description="JFIELD_TITLE_DESC"
class="inputbox"
size="40"
required="true" />
<field
name="alias"
type="text"
label="JFIELD_ALIAS_LABEL"
description="JFIELD_ALIAS_DESC"
class="inputbox"
size="40" />
<field
name="note"
type="text"
label="JFIELD_NOTE_LABEL"
description="JFIELD_NOTE_DESC"
class="inputbox"
size="40" />
<field
name="description"
type="editor"
label="JGLOBAL_DESCRIPTION"
description="COM_CATEGORIES_DESCRIPTION_DESC"
class="inputbox"
filter="JComponentHelper::filterText"
buttons="true"
hide="readmore,pagebreak" />
<field
name="published"
type="list"
class="span12 small"
default="1"
size="1"
label="JSTATUS"
description="JFIELD_PUBLISHED_DESC">
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
<option value="2">JARCHIVED</option>
<option value="-2">JTRASHED</option>
</field>
<field
name="buttonspacer"
label="JGLOBAL_ACTION_PERMISSIONS_LABEL"
description="JGLOBAL_ACTION_PERMISSIONS_DESCRIPTION"
type="spacer" />
<field
name="checked_out"
type="hidden"
filter="unset" />
<field
name="checked_out_time"
type="hidden"
filter="unset" />
<field
name="access"
type="accesslevel"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
class="span12 small" />
<field
name="metadesc"
type="textarea"
label="JFIELD_META_DESCRIPTION_LABEL"
description="JFIELD_META_DESCRIPTION_DESC"
rows="3"
cols="40" />
<field
name="metakey"
type="textarea"
label="JFIELD_META_KEYWORDS_LABEL"
description="JFIELD_META_KEYWORDS_DESC"
rows="3"
cols="40" />
<field
name="created_user_id"
type="user"
label="JGLOBAL_FIELD_CREATED_BY_LABEL"
desc="JGLOBAL_FIELD_CREATED_BY_DESC"
/>
<field
name="created_time"
type="text"
label="JGLOBAL_CREATED_DATE"
class="readonly"
filter="unset"
readonly="true" />
<field
name="modified_user_id"
type="user"
label="JGLOBAL_FIELD_MODIFIED_BY_LABEL"
class="readonly"
readonly="true"
filter="unset" />
<field
name="modified_time"
type="text"
label="JGLOBAL_FIELD_MODIFIED_LABEL"
class="readonly"
filter="unset"
readonly="true" />
<field
name="language"
type="contentlanguage"
label="JFIELD_LANGUAGE_LABEL"
description="COM_CATEGORIES_FIELD_LANGUAGE_DESC"
class="span12 small">
<option value="*">JALL</option>
</field>
<field name="tags"
type="tag"
label="JTAG"
description="JTAG_DESC"
class="inputbox span12 small"
multiple="true"
>
</field>
<field
id="rules"
name="rules"
type="rules"
label="JFIELD_RULES_LABEL"
translate_label="false"
filter="rules"
validate="rules"
class="inputbox"
component="com_content"
section="category" />
<fields name="params">
<fieldset
name="basic">
<field
name="category_layout"
type="componentlayout"
label="JFIELD_ALT_LAYOUT_LABEL"
description="JFIELD_ALT_COMPONENT_LAYOUT_DESC"
view="category"
useglobal="true"
/>
<field
name="image"
type="media"
label="COM_CATEGORIES_FIELD_IMAGE_LABEL"
description="COM_CATEGORIES_FIELD_IMAGE_DESC" />
</fieldset>
</fields>
<fields name="metadata">
<fieldset name="jmetadata"
label="JGLOBAL_FIELDSET_METADATA_OPTIONS">
<field
name="author"
type="text"
label="JAUTHOR"
description="JFIELD_METADATA_AUTHOR_DESC"
size="30" />
<field name="robots"
type="list"
label="JFIELD_METADATA_ROBOTS_LABEL"
description="JFIELD_METADATA_ROBOTS_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="index, follow">JGLOBAL_INDEX_FOLLOW</option>
<option value="noindex, follow">JGLOBAL_NOINDEX_FOLLOW</option>
<option value="index, nofollow">JGLOBAL_INDEX_NOFOLLOW</option>
<option value="noindex, nofollow">JGLOBAL_NOINDEX_NOFOLLOW</option>
</field>
</fieldset>
</fields>
</form>

View File

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

View File

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

View File

@ -0,0 +1,36 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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;
/**
* Category table
*
* @package Joomla.Administrator
* @subpackage com_categories
* @since 1.6
*/
class CategoriesTableCategory extends JTableCategory
{
/**
* Method to delete a node and, optionally, its child nodes from the table.
*
* @param integer $pk The primary key of the node to delete.
* @param boolean $children True to delete child nodes, false to move them up a level.
*
* @return boolean True on success.
*
* @see http://docs.joomla.org/JTableNested/delete
* @since 2.5
*/
public function delete($pk = null, $children = false)
{
return parent::delete($pk, $children);
}
}

View File

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

View File

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

View File

@ -0,0 +1,244 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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::_('formbehavior.chosen', 'select');
$app = JFactory::getApplication();
$user = JFactory::getUser();
$userId = $user->get('id');
$extension = $this->escape($this->state->get('filter.extension'));
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$ordering = ($listOrder == 'a.lft');
$saveOrder = ($listOrder == 'a.lft' && $listDirn == 'asc');
if ($saveOrder)
{
$saveOrderingUrl = 'index.php?option=com_categories&task=categories.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'categoryList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true);
}
$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_categories&view=categories'); ?>" method="post" name="adminForm" id="adminForm">
<?php if (!empty($this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<?php endif; ?>
<div id="j-main-container"<?php echo !empty($this->sidebar) ? ' class="span10"' : ''; ?>>
<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_CATEGORIES_ITEMS_SEARCH_FILTER'); ?></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_CATEGORIES_ITEMS_SEARCH_FILTER'); ?>" />
</div>
<div class="btn-group 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 echo $listDirn == 'asc' ? ' selected="selected"' : ''; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING'); ?></option>
<option value="desc"<?php echo $listDirn == 'desc' ? ' 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 class="clearfix"></div>
</div>
<table class="table table-striped" id="categoryList">
<thead>
<tr>
<th width="1%" class="nowrap center hidden-phone">
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'a.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>
<?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
</th>
<th width="10%" class="nowrap hidden-phone">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
</th>
<?php if ($this->assoc) : ?>
<th width="5%" class="hidden-phone">
<?php echo JHtml::_('grid.sort', 'COM_CATEGORY_HEADING_ASSOCIATION', 'association', $listDirn, $listOrder); ?>
</th>
<?php endif; ?>
<th width="5%" class="nowrap hidden-phone">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_LANGUAGE', 'language', $this->state->get('list.direction'), $this->state->get('list.ordering')); ?>
</th>
<th width="1%" class="nowrap hidden-phone">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="15">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php $originalOrders = array(); ?>
<?php foreach ($this->items as $i => $item) : ?>
<?php
$orderkey = array_search($item->id, $this->ordering[$item->parent_id]);
$canEdit = $user->authorise('core.edit', $extension . '.category.' . $item->id);
$canCheckin = $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0;
$canEditOwn = $user->authorise('core.edit.own', $extension . '.category.' . $item->id) && $item->created_user_id == $userId;
$canChange = $user->authorise('core.edit.state', $extension . '.category.' . $item->id) && $canCheckin;
// Get the parents of item for sorting
if ($item->level > 1)
{
$parentsStr = "";
$_currentParentId = $item->parent_id;
$parentsStr = " " . $_currentParentId;
for ($i2 = 0; $i2 < $item->level; $i2++)
{
foreach ($this->ordering as $k => $v)
{
$v = implode("-", $v);
$v = "-" . $v . "-";
if (strpos($v, "-" . $_currentParentId . "-") !== false)
{
$parentsStr .= " " . $k;
$_currentParentId = $k;
break;
}
}
}
}
else
{
$parentsStr = "";
}
?>
<tr class="row<?php echo $i % 2; ?>" sortable-group-id="<?php echo $item->parent_id; ?>" item-id="<?php echo $item->id ?>" parents="<?php echo $parentsStr ?>" level="<?php echo $item->level ?>">
<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 $orderkey + 1; ?>" />
<?php endif; ?>
</td>
<td class="center hidden-phone">
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
</td>
<td class="center">
<?php echo JHtml::_('jgrid.published', $item->published, $i, 'categories.', $canChange); ?>
</td>
<td>
<?php echo str_repeat('<span class="gi">&mdash;</span>', $item->level - 1) ?>
<?php if ($item->checked_out) : ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'categories.', $canCheckin); ?>
<?php endif; ?>
<?php if ($canEdit || $canEditOwn) : ?>
<a href="<?php echo JRoute::_('index.php?option=com_categories&task=category.edit&id=' . $item->id . '&extension=' . $extension); ?>">
<?php echo $this->escape($item->title); ?></a>
<?php else : ?>
<?php echo $this->escape($item->title); ?>
<?php endif; ?>
<span class="small" title="<?php echo $this->escape($item->path); ?>">
<?php if (empty($item->note)) : ?>
<?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?>
<?php else : ?>
<?php echo JText::sprintf('JGLOBAL_LIST_ALIAS_NOTE', $this->escape($item->alias), $this->escape($item->note)); ?>
<?php endif; ?>
</span>
</td>
<td class="small hidden-phone">
<?php echo $this->escape($item->access_level); ?>
</td>
<?php if ($this->assoc) : ?>
<td class="center hidden-phone">
<?php if ($item->association): ?>
<?php echo JHtml::_('CategoriesAdministrator.association', $item->id, $extension); ?>
<?php endif; ?>
</td>
<?php endif; ?>
<td class="small nowrap hidden-phone">
<?php if ($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">
<span title="<?php echo sprintf('%d-%d', $item->lft, $item->rgt); ?>">
<?php echo (int) $item->id; ?></span>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php //Load the batch processing form. ?>
<?php echo $this->loadTemplate('batch'); ?>
<input type="hidden" name="extension" value="<?php echo $extension; ?>" />
<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; ?>" />
<input type="hidden" name="original_order_values" value="<?php echo implode($originalOrders, ','); ?>" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>

View File

@ -0,0 +1,70 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('formbehavior.chosen', 'select');
$options = array(
JHtml::_('select.option', 'c', JText::_('JLIB_HTML_BATCH_COPY')),
JHtml::_('select.option', 'm', JText::_('JLIB_HTML_BATCH_MOVE'))
);
$published = $this->state->get('filter.published');
$extension = $this->escape($this->state->get('filter.extension'));
?>
<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_CATEGORIES_BATCH_OPTIONS'); ?></h3>
</div>
<div class="modal-body">
<p><?php echo JText::_('COM_CATEGORIES_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>
<div class="control-group">
<div class="controls">
<?php echo JHtml::_('batch.tag'); ?>
</div>
</div>
<?php if ($published >= 0) : ?>
<div class="control-group">
<label id="batch-choose-action-lbl" for="batch-category-id" class="control-label">
<?php echo JText::_('COM_CATEGORIES_BATCH_CATEGORY_LABEL'); ?>
</label>
<div id="batch-choose-action" class="combo controls">
<select name="batch[category_id]" class="inputbox" id="batch-category-id">
<option value=""><?php echo JText::_('JSELECT') ?></option>
<?php echo JHtml::_('select.options', JHtml::_('category.categories', $extension, array('filter.published' => $published))); ?>
</select>
</div>
</div>
<div class="control-group radio">
<?php echo JHtml::_('select.radiolist', $options, 'batch[move_copy]', '', 'value', 'text', 'm'); ?>
</div>
<?php endif; ?>
</div>
<div class="modal-footer">
<button class="btn" type="button" onclick="document.id('batch-category-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('category.batch');">
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
</button>
</div>
</div>

View File

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

View File

@ -0,0 +1,152 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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;
$app = JFactory::getApplication();
if ($app->isSite())
{
JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
}
require_once JPATH_ROOT . '/components/com_content/helpers/route.php';
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('bootstrap.tooltip');
$extension = $this->escape($this->state->get('filter.extension'));
$function = $app->input->getCmd('function', 'jSelectCategory');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
?>
<form action="<?php echo JRoute::_('index.php?option=com_categories&view=categories&layout=modal&tmpl=component&function='.$function.'&'.JSession::getFormToken().'=1');?>" method="post" name="adminForm" id="adminForm">
<fieldset class="filter clearfix">
<div class="btn-toolbar">
<div class="btn-group pull-left">
<label for="filter_search">
<?php echo JText::_('JSEARCH_FILTER_LABEL'); ?>
</label>
</div>
<div class="btn-group pull-left">
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('COM_CATEGORIES_ITEMS_SEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" size="30" title="<?php echo JText::_('COM_CATEGORIES_ITEMS_SEARCH_FILTER'); ?>" />
</div>
<div class="btn-group pull-left">
<button type="submit" class="btn hasTooltip" data-placement="bottom" title="<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?>">
<span class="icon-search"></span><?php echo '&#160;' . JText::_('JSEARCH_FILTER_SUBMIT'); ?></button>
<button type="button" class="btn hasTooltip" data-placement="bottom" title="<?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();">
<span class="icon-remove"></span><?php echo '&#160;' . JText::_('JSEARCH_FILTER_CLEAR'); ?></button>
</div>
<div class="clearfix"></div>
</div>
<hr class="hr-condensed" />
<div class="filters pull-left">
<select name="filter_access" class="input-medium" onchange="this.form.submit()">
<option value=""><?php echo JText::_('JOPTION_SELECT_ACCESS');?></option>
<?php echo JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'));?>
</select>
<select name="filter_published" class="input-medium" onchange="this.form.submit()">
<option value=""><?php echo JText::_('JOPTION_SELECT_PUBLISHED');?></option>
<?php echo JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true);?>
</select>
<?php if ($this->state->get('filter.forcedLanguage')) : ?>
<input type="hidden" name="forcedLanguage" value="<?php echo $this->escape($this->state->get('filter.forcedLanguage')); ?>" />
<input type="hidden" name="filter_language" value="<?php echo $this->escape($this->state->get('filter.language')); ?>" />
<?php else : ?>
<select name="filter_language" class="input-medium" onchange="this.form.submit()">
<option value=""><?php echo JText::_('JOPTION_SELECT_LANGUAGE');?></option>
<?php echo JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language'));?>
</select>
<?php endif; ?>
</div>
</fieldset>
<table class="table table-striped" id="categoryList">
<thead>
<tr>
<th>
<?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $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', $this->state->get('list.direction'), $this->state->get('list.ordering')); ?>
</th>
<th width="1%" class="nowrap hidden-phone">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="15">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) : ?>
<?php if ($item->language && JLanguageMultilang::isEnabled())
{
$tag = strlen($item->language);
if ($tag == 5)
{
$lang = substr($item->language, 0, 2);
}
elseif ($tag == 6)
{
$lang = substr($item->language, 0, 3);
}
else {
$lang = "";
}
}
elseif (!JLanguageMultilang::isEnabled())
{
$lang = "";
}
?>
<tr class="row<?php echo $i % 2; ?>">
<td>
<?php echo str_repeat('<span class="gi">&mdash;</span>', $item->level - 1) ?>
<a href="javascript:void()" onclick="if (window.parent) window.parent.<?php echo $this->escape($function);?>('<?php echo $item->id; ?>', '<?php echo $this->escape(addslashes($item->title)); ?>', null, '<?php echo $this->escape(ContentHelperRoute::getCategoryRoute($item->id, $item->language)); ?>', '<?php echo $this->escape($lang); ?>', null);">
<?php echo $this->escape($item->title); ?>
</a>
</td>
<td class="small hidden-phone">
<?php echo $this->escape($item->access_level); ?>
</td>
<td class="center nowrap">
<?php if ($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; ?></span>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<input type="hidden" name="extension" value="<?php echo $extension; ?>" />
<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'); ?>
</form>

View File

@ -0,0 +1,257 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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;
/**
* Categories view class for the Category package.
*
* @package Joomla.Administrator
* @subpackage com_categories
* @since 1.6
*/
class CategoriesViewCategories extends JViewLegacy
{
protected $items;
protected $pagination;
protected $state;
protected $assoc;
/**
* Display the view
*/
public function display($tpl = null)
{
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->assoc = $this->get('Assoc');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Preprocess the list of items to find ordering divisions.
foreach ($this->items as &$item)
{
$this->ordering[$item->parent_id][] = $item->id;
}
// Levels filter.
$options = array();
$options[] = JHtml::_('select.option', '1', JText::_('J1'));
$options[] = JHtml::_('select.option', '2', JText::_('J2'));
$options[] = JHtml::_('select.option', '3', JText::_('J3'));
$options[] = JHtml::_('select.option', '4', JText::_('J4'));
$options[] = JHtml::_('select.option', '5', JText::_('J5'));
$options[] = JHtml::_('select.option', '6', JText::_('J6'));
$options[] = JHtml::_('select.option', '7', JText::_('J7'));
$options[] = JHtml::_('select.option', '8', JText::_('J8'));
$options[] = JHtml::_('select.option', '9', JText::_('J9'));
$options[] = JHtml::_('select.option', '10', JText::_('J10'));
$this->f_levels = $options;
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
$categoryId = $this->state->get('filter.category_id');
$component = $this->state->get('filter.component');
$section = $this->state->get('filter.section');
$canDo = null;
$user = JFactory::getUser();
$extension = JFactory::getApplication()->input->get('extension', '', 'word');
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
// Avoid nonsense situation.
if ($component == 'com_categories')
{
return;
}
// Need to load the menu language file as mod_menu hasn't been loaded yet.
$lang = JFactory::getLanguage();
$lang->load($component, JPATH_BASE, null, false, false)
|| $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component, null, false, false)
|| $lang->load($component, JPATH_BASE, $lang->getDefault(), false, false)
|| $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component, $lang->getDefault(), false, false);
// Load the category helper.
require_once JPATH_COMPONENT . '/helpers/categories.php';
// Get the results for each action.
$canDo = CategoriesHelper::getActions($component, $categoryId);
// If a component categories title string is present, let's use it.
if ($lang->hasKey($component_title_key = strtoupper($component . ($section ? "_$section" : '')) . '_CATEGORIES_TITLE'))
{
$title = JText::_($component_title_key);
}
// Else if the component section string exits, let's use it
elseif ($lang->hasKey($component_section_key = strtoupper($component . ($section ? "_$section" : ''))))
{
$title = JText::sprintf('COM_CATEGORIES_CATEGORIES_TITLE', $this->escape(JText::_($component_section_key)));
}
// Else use the base title
else
{
$title = JText::_('COM_CATEGORIES_CATEGORIES_BASE_TITLE');
}
// Load specific css component
JHtml::_('stylesheet', $component . '/administrator/categories.css', array(), true);
// Prepare the toolbar.
JToolbarHelper::title($title, 'categories ' . substr($component, 4) . ($section ? "-$section" : '') . '-categories');
if ($canDo->get('core.create') || (count($user->getAuthorisedCategories($component, 'core.create'))) > 0)
{
JToolbarHelper::addNew('category.add');
}
if ($canDo->get('core.edit') || $canDo->get('core.edit.own'))
{
JToolbarHelper::editList('category.edit');
}
if ($canDo->get('core.edit.state'))
{
JToolbarHelper::publish('categories.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('categories.unpublish', 'JTOOLBAR_UNPUBLISH', true);
JToolbarHelper::archiveList('categories.archive');
}
if (JFactory::getUser()->authorise('core.admin'))
{
JToolbarHelper::checkin('categories.checkin');
}
if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete', $component))
{
JToolbarHelper::deleteList('', 'categories.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($canDo->get('core.edit.state'))
{
JToolbarHelper::trash('categories.trash');
}
// Add a batch button
if ($user->authorise('core.create', $extension) & $user->authorise('core.edit', $extension) && $user->authorise('core.edit.state', $extension))
{
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::custom('categories.rebuild', 'refresh.png', 'refresh_f2.png', 'JTOOLBAR_REBUILD', false);
JToolbarHelper::preferences($component);
}
// Compute the ref_key if it does exist in the component
if (!$lang->hasKey($ref_key = strtoupper($component . ($section ? "_$section" : '')) . '_CATEGORIES_HELP_KEY'))
{
$ref_key = 'JHELP_COMPONENTS_' . strtoupper(substr($component, 4) . ($section ? "_$section" : '')) . '_CATEGORIES';
}
// Get help for the categories view for the component by
// -remotely searching in a language defined dedicated URL: *component*_HELP_URL
// -locally searching in a component help file if helpURL param exists in the component and is set to ''
// -remotely searching in a component URL if helpURL param exists in the component and is NOT set to ''
if ($lang->hasKey($lang_help_url = strtoupper($component) . '_HELP_URL'))
{
$debug = $lang->setDebug(false);
$url = JText::_($lang_help_url);
$lang->setDebug($debug);
}
else
{
$url = null;
}
JToolbarHelper::help($ref_key, JComponentHelper::getParams($component)->exists('helpURL'), $url);
JHtmlSidebar::setAction('index.php?option=com_categories&view=categories');
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_MAX_LEVELS'),
'filter_level',
JHtml::_('select.options', $this->f_levels, 'value', 'text', $this->state->get('filter.level'))
);
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_PUBLISHED'),
'filter_published',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
);
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_ACCESS'),
'filter_access',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
);
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_LANGUAGE'),
'filter_language',
JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language'))
);
if (JHelperTags::getTypes('objectList', array($extension . '.category'), true))
{
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_TAG'),
'filter_tag',
JHtml::_('select.options', JHtml::_('tag.options', true, true), 'value', 'text', $this->state->get('filter.tag'))
);
}
}
/**
* 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(
'a.lft' => JText::_('JGRID_HEADING_ORDERING'),
'a.published' => JText::_('JSTATUS'),
'a.title' => JText::_('JGLOBAL_TITLE'),
'a.access' => JText::_('JGRID_HEADING_ACCESS'),
'language' => JText::_('JGRID_HEADING_LANGUAGE'),
'a.id' => JText::_('JGRID_HEADING_ID')
);
}
}

View File

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

View File

@ -0,0 +1,215 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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');
$app = JFactory::getApplication();
$input = $app->input;
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.keepalive');
JHtml::_('formbehavior.chosen', 'select');
?>
<script type="text/javascript">
Joomla.submitbutton = function(task)
{
if (task == 'category.cancel' || document.formvalidator.isValid(document.id('item-form'))) {
<?php echo $this->form->getField('description')->save(); ?>
Joomla.submitform(task, document.getElementById('item-form'));
}
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_categories&extension=' . $input->getCmd('extension', 'com_content') . '&layout=edit&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="item-form" class="form-validate form-horizontal">
<?php echo JLayoutHelper::render('joomla.edit.item_title', $this); ?>
<div class="row-fluid">
<!-- Begin Content -->
<div class="span10 form-horizontal">
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'general')); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'general', JText::_('COM_CATEGORIES_FIELDSET_DETAILS', true)); ?>
<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('alias'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('alias'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('description'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('description'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('extension'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('extension'); ?>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'publishing', JText::_('COM_CATEGORIES_FIELDSET_PUBLISHING', true)); ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('id'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('id'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('hits'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('hits'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('created_user_id'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('created_user_id'); ?>
</div>
</div>
<?php if (intval($this->item->created_time)) : ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('created_time'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('created_time'); ?>
</div>
</div>
<?php endif; ?>
<?php if ($this->item->modified_user_id) : ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('modified_user_id'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('modified_user_id'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('modified_time'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('modified_time'); ?>
</div>
</div>
<?php endif; ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'options', JText::_('CATEGORIES_FIELDSET_OPTIONS', true)); ?>
<fieldset>
<?php echo $this->loadTemplate('options'); ?>
</fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'metadata', JText::_('JGLOBAL_FIELDSET_METADATA_OPTIONS', true)); ?>
<fieldset>
<?php echo $this->loadTemplate('metadata'); ?>
</fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo $this->loadTemplate('extrafields'); ?>
<?php if ($this->assoc) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'associations', JText::_('JGLOBAL_FIELDSET_ASSOCIATIONS', true)); ?>
<fieldset>
<?php echo $this->loadTemplate('associations'); ?>
</fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php if ($this->canDo->get('core.admin')) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'rules', JText::_('COM_CATEGORIES_FIELDSET_RULES', true)); ?>
<fieldset>
<?php echo $this->form->getInput('rules'); ?>
</fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</div>
<!-- End Content -->
<!-- Begin Sidebar -->
<div class="span2">
<h4><?php echo JText::_('JDETAILS'); ?></h4>
<hr />
<fieldset class="form-vertical">
<div class="control-group">
<div class="controls">
<?php echo $this->form->getValue('title'); ?>
</div>
</div>
<div class="control-group">
<?php echo $this->form->getLabel('parent_id'); ?>
<div class="controls">
<?php echo $this->form->getInput('parent_id'); ?>
</div>
</div>
<div class="control-group">
<?php echo $this->form->getLabel('published'); ?>
<div class="controls">
<?php echo $this->form->getInput('published'); ?>
</div>
</div>
<div class="control-group">
<?php echo $this->form->getLabel('access'); ?>
<div class="controls">
<?php echo $this->form->getInput('access'); ?>
</div>
</div>
<div class="control-group">
<?php echo $this->form->getLabel('language'); ?>
<div class="controls">
<?php echo $this->form->getInput('language'); ?>
</div>
</div>
<?php if ($this->checkTags) : ?>
<div class="control-group">
<?php echo $this->form->getLabel('tags'); ?>
<div class="controls">
<?php echo $this->form->getInput('tags'); ?>
</div>
</div>
<?php endif; ?>
</fieldset>
</div>
<!-- End Sidebar -->
</div>
</form>

View File

@ -0,0 +1,12 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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;
echo JLayoutHelper::render('joomla.edit.associations', $this);

View File

@ -0,0 +1,36 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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 $fieldSets = $this->form->getFieldsets('attribs'); ?>
<?php foreach ($fieldSets as $name => $fieldSet) : ?>
<?php $label = !empty($fieldSet->label) ? $fieldSet->label : 'COM_CATEGORIES_' . $name . '_FIELDSET_LABEL'; ?>
<?php if ($name != 'editorConfig' && $name != 'basic-limited') : ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'attrib-' . $name, trim($label)); ?>
<fieldset>
<?php if (isset($fieldSet->description) && trim($fieldSet->description)) : ?>
<p class="tip"><?php echo $this->escape(JText::_($fieldSet->description)); ?></p>
<?php 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; ?>
</fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php endforeach; ?>

View File

@ -0,0 +1,12 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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;
echo JLayoutHelper::render('joomla.edit.metadata', $this);

View File

@ -0,0 +1,48 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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;
echo JHtml::_('bootstrap.startAccordion', 'categoryOptions', array('active' => 'collapse0'));
$fieldSets = $this->form->getFieldsets('params');
$i = 0;
?>
<?php foreach ($fieldSets as $name => $fieldSet) : ?>
<?php
$label = !empty($fieldSet->label) ? $fieldSet->label : 'COM_CATEGORIES_' . $name . '_FIELDSET_LABEL';
echo JHtml::_('bootstrap.addSlide', 'categoryOptions', JText::_($label), 'collapse' . $i++);
if (isset($fieldSet->description) && trim($fieldSet->description))
{
echo '<p class="tip">' . $this->escape(JText::_($fieldSet->description)) . '</p>';
}
?>
<?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; ?>
<?php if ($name == 'basic'): ?>
<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>
<?php endif; ?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php endforeach; ?>
<?php echo JHtml::_('bootstrap.endAccordion');

View File

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

View File

@ -0,0 +1,228 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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');
$app = JFactory::getApplication();
$input = $app->input;
// Load the tooltip behavior.
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.keepalive');
JHtml::_('formbehavior.chosen', 'select');
?>
<script type="text/javascript">
Joomla.submitbutton = function(task)
{
if (task == 'category.cancel' || document.formvalidator.isValid(document.id('item-form')))
{
<?php echo $this->form->getField('description')->save(); ?>
if (window.opener && (task == 'category.save' || task == 'category.cancel'))
{
window.opener.document.closeEditWindow = self;
window.opener.setTimeout('window.document.closeEditWindow.close()', 1000);
}
Joomla.submitform(task, document.getElementById('item-form'));
}
}
</script>
<div class="container-popup">
<div class="pull-right">
<button class="btn btn-primary" type="button" onclick="Joomla.submitbutton('category.apply');"><?php echo JText::_('JTOOLBAR_APPLY') ?></button>
<button class="btn btn-primary" type="button" onclick="Joomla.submitbutton('category.save');"><?php echo JText::_('JTOOLBAR_SAVE') ?></button>
<button class="btn" type="button" onclick="Joomla.submitbutton('category.cancel');"><?php echo JText::_('JCANCEL') ?></button>
</div>
<div class="clearfix"> </div>
<hr class="hr-condensed" />
<form action="<?php echo JRoute::_('index.php?option=com_categories&extension=' . $input->getCmd('extension', 'com_content') . '&layout=modal&tmpl=component&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="item-form" class="form-validate form-horizontal">
<div class="row-fluid">
<!-- Begin Content -->
<div class="span10 form-horizontal">
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'general')); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'general', JText::_('COM_CATEGORIES_FIELDSET_DETAILS', true)); ?>
<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('alias'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('alias'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('description'); ?>
</div>
</div>
<?php echo $this->form->getInput('description'); ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('extension'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('extension'); ?>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'publishing', JText::_('COM_CATEGORIES_FIELDSET_PUBLISHING', true)); ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('id'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('id'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('hits'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('hits'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('created_user_id'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('created_user_id'); ?>
</div>
</div>
<?php if (intval($this->item->created_time)) : ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('created_time'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('created_time'); ?>
</div>
</div>
<?php endif; ?>
<?php if ($this->item->modified_user_id) : ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('modified_user_id'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('modified_user_id'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('modified_time'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('modified_time'); ?>
</div>
</div>
<?php endif; ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'options', JText::_('CATEGORIES_FIELDSET_OPTIONS', true)); ?>
<fieldset>
<?php echo $this->loadTemplate('options'); ?>
</fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'metadata', JText::_('JGLOBAL_FIELDSET_METADATA_OPTIONS', true)); ?>
<?php echo $this->loadTemplate('metadata'); ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo $this->loadTemplate('extrafields'); ?>
<?php if ($this->canDo->get('core.admin')) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'permissions', JText::_('COM_CATEGORIES_FIELDSET_RULES', true)); ?>
<fieldset>
<?php echo $this->form->getInput('rules'); ?>
</fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
<div class="hidden">
<?php echo $this->loadTemplate('associations'); ?>
</div>
<input type="hidden" name="task" value="" />
<input type="hidden" name="return" value="<?php echo $input->getCmd('return');?>" />
<?php echo JHtml::_('form.token'); ?>
</div>
<!-- End Content -->
<!-- Begin Sidebar -->
<div class="span2">
<h4><?php echo JText::_('JDETAILS');?></h4>
<hr />
<fieldset class="form-vertical">
<div class="control-group">
<div class="controls">
<?php echo $this->form->getValue('title'); ?>
</div>
</div>
<div class="control-group">
<?php echo $this->form->getLabel('parent_id'); ?>
<div class="controls">
<?php echo $this->form->getInput('parent_id'); ?>
</div>
</div>
<div class="control-group">
<?php echo $this->form->getLabel('published'); ?>
<div class="controls">
<?php echo $this->form->getInput('published'); ?>
</div>
</div>
<div class="control-group">
<?php echo $this->form->getLabel('access'); ?>
<div class="controls">
<?php echo $this->form->getInput('access'); ?>
</div>
</div>
<div class="control-group">
<?php echo $this->form->getLabel('language'); ?>
<div class="controls">
<?php echo $this->form->getInput('language'); ?>
</div>
</div>
<div class="control-group">
<?php if ($this->checkTags) : ?>
<div class="control-group">
<?php echo $this->form->getLabel('tags'); ?>
<div class="controls">
<?php echo $this->form->getInput('tags'); ?>
</div>
</div>
<?php endif; ?>
</div>
</fieldset>
</div>
<!-- End Sidebar -->
</div>
</form>
</div>

View File

@ -0,0 +1,12 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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;
echo JLayoutHelper::render('joomla.edit.associations', $this);

View File

@ -0,0 +1,36 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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 $fieldSets = $this->form->getFieldsets('attribs'); ?>
<?php foreach ($fieldSets as $name => $fieldSet) : ?>
<?php $label = !empty($fieldSet->label) ? $fieldSet->label : 'COM_CATEGORIES_'.$name.'_FIELDSET_LABEL'; ?>
<?php if ($name != 'editorConfig' && $name != 'basic-limited') : ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'attrib-'.$name, trim($label)); ?>
<fieldset>
<?php if (isset($fieldSet->description) && trim($fieldSet->description)) : ?>
<p class="tip"><?php echo $this->escape(JText::_($fieldSet->description));?></p>
<?php endif;
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;?>
</fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php endforeach; ?>

View File

@ -0,0 +1,13 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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;
echo JLayoutHelper::render('joomla.edit.metadata', $this);
?>

View File

@ -0,0 +1,47 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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', 'categoryOptions', array('active' => 'collapse0'));
$fieldSets = $this->form->getFieldsets('params');
$i = 0;
foreach ($fieldSets as $name => $fieldSet) :
$label = !empty($fieldSet->label) ? $fieldSet->label : 'COM_CATEGORIES_'.$name.'_FIELDSET_LABEL';
echo JHtml::_('bootstrap.addSlide', 'categoryOptions', JText::_($label), 'collapse' . $i++);
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; ?>
<?php if ($name == 'basic'):?>
<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>
<?php endif;
echo JHtml::_('bootstrap.endSlide');
endforeach;
echo JHtml::_('bootstrap.endAccordion');

View File

@ -0,0 +1,187 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_categories
*
* @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 Categories component
*
* @package Joomla.Administrator
* @subpackage com_categories
* @since 1.6
*/
class CategoriesViewCategory extends JViewLegacy
{
protected $form;
protected $item;
protected $state;
protected $assoc;
/**
* Display the view
*/
public function display($tpl = null)
{
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
$this->canDo = CategoriesHelper::getActions($this->state->get('category.component'));
$this->assoc = $this->get('Assoc');
$input = JFactory::getApplication()->input;
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Check for tag type
$this->checkTags = JHelperTags::getTypes('objectList', array($this->state->get('category.extension') . '.category'), true);
$input->set('hidemainmenu', true);
if ($this->getLayout() == 'modal')
{
$this->form->setFieldAttribute('language', 'readonly', 'true');
$this->form->setFieldAttribute('parent_id', 'readonly', 'true');
}
$this->addToolbar();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
$input = JFactory::getApplication()->input;
$extension = $input->get('extension');
$user = JFactory::getUser();
$userId = $user->get('id');
$isNew = ($this->item->id == 0);
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
// Check to see if the type exists
$ucmType = new JUcmType;
$this->typeId = $ucmType->getTypeId($extension . '.category');
// Avoid nonsense situation.
if ($extension == 'com_categories')
{
return;
}
// The extension can be in the form com_foo.section
$parts = explode('.', $extension);
$component = $parts[0];
$section = (count($parts) > 1) ? $parts[1] : null;
// Need to load the menu language file as mod_menu hasn't been loaded yet.
$lang = JFactory::getLanguage();
$lang->load($component, JPATH_BASE, null, false, false)
|| $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component, null, false, false)
|| $lang->load($component, JPATH_BASE, $lang->getDefault(), false, false)
|| $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component, $lang->getDefault(), false, false);
// Load the category helper.
require_once JPATH_COMPONENT . '/helpers/categories.php';
// Get the results for each action.
$canDo = CategoriesHelper::getActions($component, $this->item->id);
// If a component categories title string is present, let's use it.
if ($lang->hasKey($component_title_key = $component . ($section ? "_$section" : '') . '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE'))
{
$title = JText::_($component_title_key);
}
// Else if the component section string exits, let's use it
elseif ($lang->hasKey($component_section_key = $component . ($section ? "_$section" : '')))
{
$title = JText::sprintf('COM_CATEGORIES_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE', $this->escape(JText::_($component_section_key)));
}
// Else use the base title
else
{
$title = JText::_('COM_CATEGORIES_CATEGORY_BASE_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE');
}
// Load specific css component
JHtml::_('stylesheet', $component . '/administrator/categories.css', array(), true);
// Prepare the toolbar.
JToolbarHelper::title($title, 'category-' . ($isNew ? 'add' : 'edit') . ' ' . substr($component, 4) . ($section ? "-$section" : '') . '-category-' . ($isNew ? 'add' : 'edit'));
// For new records, check the create permission.
if ($isNew && (count($user->getAuthorisedCategories($component, 'core.create')) > 0))
{
JToolbarHelper::apply('category.apply');
JToolbarHelper::save('category.save');
JToolbarHelper::save2new('category.save2new');
}
// If not checked out, can save the item.
elseif (!$checkedOut && ($canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_user_id == $userId)))
{
JToolbarHelper::apply('category.apply');
JToolbarHelper::save('category.save');
if ($canDo->get('core.create'))
{
JToolbarHelper::save2new('category.save2new');
}
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create'))
{
JToolbarHelper::save2copy('category.save2copy');
}
if (empty($this->item->id))
{
JToolbarHelper::cancel('category.cancel');
}
else
{
JToolbarHelper::cancel('category.cancel', 'JTOOLBAR_CLOSE');
}
JToolbarHelper::divider();
// Compute the ref_key if it does exist in the component
if (!$lang->hasKey($ref_key = strtoupper($component . ($section ? "_$section" : '')) . '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT') . '_HELP_KEY'))
{
$ref_key = 'JHELP_COMPONENTS_' . strtoupper(substr($component, 4) . ($section ? "_$section" : '')) . '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT');
}
// Get help for the category/section view for the component by
// -remotely searching in a language defined dedicated URL: *component*_HELP_URL
// -locally searching in a component help file if helpURL param exists in the component and is set to ''
// -remotely searching in a component URL if helpURL param exists in the component and is NOT set to ''
if ($lang->hasKey($lang_help_url = strtoupper($component) . '_HELP_URL'))
{
$debug = $lang->setDebug(false);
$url = JText::_($lang_help_url);
$lang->setDebug($debug);
}
else
{
$url = null;
}
JToolbarHelper::help($ref_key, JComponentHelper::getParams($component)->exists('helpURL'), $url, $component);
}
}

View File

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