You've already forked joomla_test
first commit
This commit is contained in:
725
administrator/components/com_content/models/article.php
Normal file
725
administrator/components/com_content/models/article.php
Normal file
@ -0,0 +1,725 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_content
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/content.php';
|
||||
|
||||
/**
|
||||
* Item Model for an Article.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_content
|
||||
* @since 1.6
|
||||
*/
|
||||
class ContentModelArticle extends JModelAdmin
|
||||
{
|
||||
/**
|
||||
* @var string The prefix to use with controller messages.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_CONTENT';
|
||||
|
||||
/**
|
||||
* Batch copy items to a new category or current.
|
||||
*
|
||||
* @param integer $value The new category.
|
||||
* @param array $pks An array of row IDs.
|
||||
* @param array $contexts An array of item contexts.
|
||||
*
|
||||
* @return mixed An array of new IDs on success, boolean false on failure.
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
protected function batchCopy($value, $pks, $contexts)
|
||||
{
|
||||
$categoryId = (int) $value;
|
||||
|
||||
$table = $this->getTable();
|
||||
$i = 0;
|
||||
|
||||
// Check that the category exists
|
||||
if ($categoryId)
|
||||
{
|
||||
$categoryTable = JTable::getInstance('Category');
|
||||
if (!$categoryTable->load($categoryId))
|
||||
{
|
||||
if ($error = $categoryTable->getError())
|
||||
{
|
||||
// Fatal error
|
||||
$this->setError($error);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($categoryId))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check that the user has create permission for the component
|
||||
$extension = JFactory::getApplication()->input->get('option', '');
|
||||
$user = JFactory::getUser();
|
||||
if (!$user->authorise('core.create', $extension . '.category.' . $categoryId))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_CREATE'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parent exists so we let's proceed
|
||||
while (!empty($pks))
|
||||
{
|
||||
// Pop the first ID off the stack
|
||||
$pk = array_shift($pks);
|
||||
|
||||
$table->reset();
|
||||
|
||||
// Check that the row actually exists
|
||||
if (!$table->load($pk))
|
||||
{
|
||||
if ($error = $table->getError())
|
||||
{
|
||||
// Fatal error
|
||||
$this->setError($error);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not fatal error
|
||||
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Alter the title & alias
|
||||
$data = $this->generateNewTitle($categoryId, $table->alias, $table->title);
|
||||
$table->title = $data['0'];
|
||||
$table->alias = $data['1'];
|
||||
|
||||
// Reset the ID because we are making a copy
|
||||
$table->id = 0;
|
||||
|
||||
// New category ID
|
||||
$table->catid = $categoryId;
|
||||
|
||||
// TODO: Deal with ordering?
|
||||
//$table->ordering = 1;
|
||||
|
||||
// Get the featured state
|
||||
$featured = $table->featured;
|
||||
|
||||
// Check the row.
|
||||
if (!$table->check())
|
||||
{
|
||||
$this->setError($table->getError());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Store the row.
|
||||
if (!$table->store())
|
||||
{
|
||||
$this->setError($table->getError());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the new item ID
|
||||
$newId = $table->get('id');
|
||||
|
||||
// Add the new ID to the array
|
||||
$newIds[$i] = $newId;
|
||||
$i++;
|
||||
|
||||
// Check if the article was featured and update the #__content_frontpage table
|
||||
if ($featured == 1)
|
||||
{
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->insert($db->quoteName('#__content_frontpage'))
|
||||
->values($newId . ', 0');
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
}
|
||||
}
|
||||
|
||||
// Clean the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return $newIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can be deleted.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canDelete($record)
|
||||
{
|
||||
if (!empty($record->id))
|
||||
{
|
||||
if ($record->state != -2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
return $user->authorise('core.delete', 'com_content.article.' . (int) $record->id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can have its state edited.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canEditState($record)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
|
||||
// Check for existing article.
|
||||
if (!empty($record->id))
|
||||
{
|
||||
return $user->authorise('core.edit.state', 'com_content.article.' . (int) $record->id);
|
||||
}
|
||||
// New article, so check against the category.
|
||||
elseif (!empty($record->catid))
|
||||
{
|
||||
return $user->authorise('core.edit.state', 'com_content.category.' . (int) $record->catid);
|
||||
}
|
||||
// Default to component settings if neither article nor category known.
|
||||
else
|
||||
{
|
||||
return parent::canEditState('com_content');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and sanitise the table data prior to saving.
|
||||
*
|
||||
* @param JTable A JTable object.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function prepareTable($table)
|
||||
{
|
||||
// Set the publish date to now
|
||||
$db = $this->getDbo();
|
||||
if ($table->state == 1 && (int) $table->publish_up == 0)
|
||||
{
|
||||
$table->publish_up = JFactory::getDate()->toSql();
|
||||
}
|
||||
|
||||
if ($table->state == 1 && intval($table->publish_down) == 0)
|
||||
{
|
||||
$table->publish_down = $db->getNullDate();
|
||||
}
|
||||
|
||||
// Increment the content version number.
|
||||
$table->version++;
|
||||
|
||||
// Reorder the articles within the category so the new article is first
|
||||
if (empty($table->id))
|
||||
{
|
||||
$table->reorder('catid = ' . (int) $table->catid . ' AND state >= 0');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Table object, always creating it.
|
||||
*
|
||||
* @param type The table type to instantiate
|
||||
* @param string A prefix for the table class name. Optional.
|
||||
* @param array Configuration array for model. Optional.
|
||||
*
|
||||
* @return JTable A database object
|
||||
*/
|
||||
public function getTable($type = 'Content', $prefix = 'JTable', $config = array())
|
||||
{
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a single record.
|
||||
*
|
||||
* @param integer The id of the primary key.
|
||||
*
|
||||
* @return mixed Object on success, false on failure.
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{
|
||||
if ($item = parent::getItem($pk))
|
||||
{
|
||||
// Convert the params field to an array.
|
||||
$registry = new JRegistry;
|
||||
$registry->loadString($item->attribs);
|
||||
$item->attribs = $registry->toArray();
|
||||
|
||||
// Convert the metadata field to an array.
|
||||
$registry = new JRegistry;
|
||||
$registry->loadString($item->metadata);
|
||||
$item->metadata = $registry->toArray();
|
||||
|
||||
// Convert the images field to an array.
|
||||
$registry = new JRegistry;
|
||||
$registry->loadString($item->images);
|
||||
$item->images = $registry->toArray();
|
||||
|
||||
// Convert the urls field to an array.
|
||||
$registry = new JRegistry;
|
||||
$registry->loadString($item->urls);
|
||||
$item->urls = $registry->toArray();
|
||||
|
||||
$item->articletext = trim($item->fulltext) != '' ? $item->introtext . "<hr id=\"system-readmore\" />" . $item->fulltext : $item->introtext;
|
||||
|
||||
if (!empty($item->id))
|
||||
{
|
||||
$item->tags = new JHelperTags;
|
||||
$item->tags->getTagIds($item->id, 'com_content.article');
|
||||
}
|
||||
}
|
||||
|
||||
// Load associated content items
|
||||
$app = JFactory::getApplication();
|
||||
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
|
||||
|
||||
if ($assoc)
|
||||
{
|
||||
$item->associations = array();
|
||||
|
||||
if ($item->id != null)
|
||||
{
|
||||
$associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $item->id);
|
||||
|
||||
foreach ($associations as $tag => $association)
|
||||
{
|
||||
$item->associations[$tag] = $association->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the record form.
|
||||
*
|
||||
* @param array $data Data for the form.
|
||||
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||
*
|
||||
* @return mixed A JForm object on success, false on failure
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = array(), $loadData = true)
|
||||
{
|
||||
// Get the form.
|
||||
$form = $this->loadForm('com_content.article', 'article', array('control' => 'jform', 'load_data' => $loadData));
|
||||
if (empty($form))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
|
||||
// The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
|
||||
if ($jinput->get('a_id'))
|
||||
{
|
||||
$id = $jinput->get('a_id', 0);
|
||||
}
|
||||
// The back end uses id so we use that the rest of the time and set it to 0 by default.
|
||||
else
|
||||
{
|
||||
$id = $jinput->get('id', 0);
|
||||
}
|
||||
// Determine correct permissions to check.
|
||||
if ($this->getState('article.id'))
|
||||
{
|
||||
$id = $this->getState('article.id');
|
||||
// Existing record. Can only edit in selected categories.
|
||||
$form->setFieldAttribute('catid', 'action', 'core.edit');
|
||||
// Existing record. Can only edit own articles in selected categories.
|
||||
$form->setFieldAttribute('catid', 'action', 'core.edit.own');
|
||||
}
|
||||
else
|
||||
{
|
||||
// New record. Can only create in selected categories.
|
||||
$form->setFieldAttribute('catid', 'action', 'core.create');
|
||||
}
|
||||
|
||||
$user = JFactory::getUser();
|
||||
|
||||
// Check for existing article.
|
||||
// Modify the form based on Edit State access controls.
|
||||
if ($id != 0 && (!$user->authorise('core.edit.state', 'com_content.article.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('core.edit.state', 'com_content'))
|
||||
)
|
||||
{
|
||||
// Disable fields for display.
|
||||
$form->setFieldAttribute('featured', 'disabled', 'true');
|
||||
$form->setFieldAttribute('ordering', 'disabled', 'true');
|
||||
$form->setFieldAttribute('publish_up', 'disabled', 'true');
|
||||
$form->setFieldAttribute('publish_down', 'disabled', 'true');
|
||||
$form->setFieldAttribute('state', 'disabled', 'true');
|
||||
|
||||
// Disable fields while saving.
|
||||
// The controller has already verified this is an article you can edit.
|
||||
$form->setFieldAttribute('featured', 'filter', 'unset');
|
||||
$form->setFieldAttribute('ordering', 'filter', 'unset');
|
||||
$form->setFieldAttribute('publish_up', 'filter', 'unset');
|
||||
$form->setFieldAttribute('publish_down', 'filter', 'unset');
|
||||
$form->setFieldAttribute('state', 'filter', 'unset');
|
||||
}
|
||||
|
||||
// Prevent messing with article language and category when editing existing article with associations
|
||||
$app = JFactory::getApplication();
|
||||
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
|
||||
|
||||
if ($app->isSite() && $assoc && $this->getState('article.id'))
|
||||
{
|
||||
$form->setFieldAttribute('language', 'readonly', 'true');
|
||||
$form->setFieldAttribute('catid', 'readonly', 'true');
|
||||
$form->setFieldAttribute('language', 'filter', 'unset');
|
||||
$form->setFieldAttribute('catid', 'filter', 'unset');
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the data that should be injected in the form.
|
||||
*
|
||||
* @return mixed The data for the form.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$app = JFactory::getApplication();
|
||||
$data = $app->getUserState('com_content.edit.article.data', array());
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
|
||||
// Prime some default values.
|
||||
if ($this->getState('article.id') == 0)
|
||||
{
|
||||
$data->set('catid', $app->input->getInt('catid', $app->getUserState('com_content.articles.filter.category_id')));
|
||||
}
|
||||
}
|
||||
|
||||
$this->preprocessData('com_content.article', $data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save the form data.
|
||||
*
|
||||
* @param array The form data.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
if (isset($data['images']) && is_array($data['images']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($data['images']);
|
||||
$data['images'] = (string) $registry;
|
||||
}
|
||||
|
||||
if (isset($data['urls']) && is_array($data['urls']))
|
||||
{
|
||||
|
||||
foreach ($data['urls'] as $i => $url)
|
||||
{
|
||||
if ($url != false && ($i == 'urla' || $i == 'urlb' || $i = 'urlc'))
|
||||
{
|
||||
$data['urls'][$i] = JStringPunycode::urlToPunycode($url);
|
||||
}
|
||||
|
||||
}
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($data['urls']);
|
||||
$data['urls'] = (string) $registry;
|
||||
}
|
||||
|
||||
// Alter the title for save as copy
|
||||
if ($app->input->get('task') == 'save2copy')
|
||||
{
|
||||
list($title, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['title']);
|
||||
$data['title'] = $title;
|
||||
$data['alias'] = $alias;
|
||||
$data['state'] = 0;
|
||||
}
|
||||
|
||||
if (parent::save($data))
|
||||
{
|
||||
|
||||
if (isset($data['featured']))
|
||||
{
|
||||
$this->featured($this->getState($this->getName() . '.id'), $data['featured']);
|
||||
}
|
||||
|
||||
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
|
||||
if ($assoc)
|
||||
{
|
||||
$id = (int) $this->getState($this->getName() . '.id');
|
||||
$item = $this->getItem($id);
|
||||
|
||||
// Adding self to the association
|
||||
$associations = $data['associations'];
|
||||
|
||||
foreach ($associations as $tag => $id)
|
||||
{
|
||||
if (empty($id))
|
||||
{
|
||||
unset($associations[$tag]);
|
||||
}
|
||||
}
|
||||
|
||||
// Detecting all item menus
|
||||
$all_language = $item->language == '*';
|
||||
|
||||
if ($all_language && !empty($associations))
|
||||
{
|
||||
JError::raiseNotice(403, JText::_('COM_CONTENT_ERROR_ALL_LANGUAGE_ASSOCIATED'));
|
||||
}
|
||||
|
||||
$associations[$item->language] = $item->id;
|
||||
|
||||
// Deleting old association for these items
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->delete('#__associations')
|
||||
->where('context=' . $db->quote('com_content.item'))
|
||||
->where('id IN (' . implode(',', $associations) . ')');
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
|
||||
if ($error = $db->getErrorMsg())
|
||||
{
|
||||
$this->setError($error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$all_language && count($associations))
|
||||
{
|
||||
// Adding new association for these items
|
||||
$key = md5(json_encode($associations));
|
||||
$query->clear()
|
||||
->insert('#__associations');
|
||||
|
||||
foreach ($associations as $id)
|
||||
{
|
||||
$query->values($id . ',' . $db->quote('com_content.item') . ',' . $db->quote($key));
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
|
||||
if ($error = $db->getErrorMsg())
|
||||
{
|
||||
$this->setError($error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to toggle the featured setting of articles.
|
||||
*
|
||||
* @param array The ids of the items to toggle.
|
||||
* @param integer The value to toggle to.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*/
|
||||
public function featured($pks, $value = 0)
|
||||
{
|
||||
// Sanitize the ids.
|
||||
$pks = (array) $pks;
|
||||
JArrayHelper::toInteger($pks);
|
||||
|
||||
if (empty($pks))
|
||||
{
|
||||
$this->setError(JText::_('COM_CONTENT_NO_ITEM_SELECTED'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$table = $this->getTable('Featured', 'ContentTable');
|
||||
|
||||
try
|
||||
{
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->update($db->quoteName('#__content'))
|
||||
->set('featured = ' . (int) $value)
|
||||
->where('id IN (' . implode(',', $pks) . ')');
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
|
||||
if ((int) $value == 0)
|
||||
{
|
||||
// Adjust the mapping table.
|
||||
// Clear the existing features settings.
|
||||
$query = $db->getQuery(true)
|
||||
->delete($db->quoteName('#__content_frontpage'))
|
||||
->where('content_id IN (' . implode(',', $pks) . ')');
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
}
|
||||
else
|
||||
{
|
||||
// first, we find out which of our new featured articles are already featured.
|
||||
$query = $db->getQuery(true)
|
||||
->select('f.content_id')
|
||||
->from('#__content_frontpage AS f')
|
||||
->where('content_id IN (' . implode(',', $pks) . ')');
|
||||
//echo $query;
|
||||
$db->setQuery($query);
|
||||
|
||||
$old_featured = $db->loadColumn();
|
||||
|
||||
// we diff the arrays to get a list of the articles that are newly featured
|
||||
$new_featured = array_diff($pks, $old_featured);
|
||||
|
||||
// Featuring.
|
||||
$tuples = array();
|
||||
foreach ($new_featured as $pk)
|
||||
{
|
||||
$tuples[] = $pk . ', 0';
|
||||
}
|
||||
if (count($tuples))
|
||||
{
|
||||
$db = $this->getDbo();
|
||||
$columns = array('content_id', 'ordering');
|
||||
$query = $db->getQuery(true)
|
||||
->insert($db->quoteName('#__content_frontpage'))
|
||||
->columns($db->quoteName($columns))
|
||||
->values($tuples);
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
$table->reorder();
|
||||
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* A protected method to get a set of ordering conditions.
|
||||
*
|
||||
* @param object A record object.
|
||||
*
|
||||
* @return array An array of conditions to add to add to ordering queries.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getReorderConditions($table)
|
||||
{
|
||||
$condition = array();
|
||||
$condition[] = 'catid = ' . (int) $table->catid;
|
||||
return $condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function preprocessForm(JForm $form, $data, $group = 'content')
|
||||
{
|
||||
// Association content items
|
||||
$app = JFactory::getApplication();
|
||||
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
|
||||
if ($assoc)
|
||||
{
|
||||
$languages = JLanguageHelper::getLanguages('lang_code');
|
||||
|
||||
// force to array (perhaps move to $this->loadFormData())
|
||||
$data = (array) $data;
|
||||
|
||||
$addform = new SimpleXMLElement('<form />');
|
||||
$fields = $addform->addChild('fields');
|
||||
$fields->addAttribute('name', 'associations');
|
||||
$fieldset = $fields->addChild('fieldset');
|
||||
$fieldset->addAttribute('name', 'item_associations');
|
||||
$fieldset->addAttribute('description', 'COM_CONTENT_ITEM_ASSOCIATIONS_FIELDSET_DESC');
|
||||
$add = false;
|
||||
foreach ($languages as $tag => $language)
|
||||
{
|
||||
if (empty($data['language']) || $tag != $data['language'])
|
||||
{
|
||||
$add = true;
|
||||
$field = $fieldset->addChild('field');
|
||||
$field->addAttribute('name', $tag);
|
||||
$field->addAttribute('type', 'modal_article');
|
||||
$field->addAttribute('language', $tag);
|
||||
$field->addAttribute('label', $language->title);
|
||||
$field->addAttribute('translate_label', 'false');
|
||||
$field->addAttribute('edit', 'true');
|
||||
$field->addAttribute('clear', 'true');
|
||||
}
|
||||
}
|
||||
if ($add)
|
||||
{
|
||||
$form->load($addform, false);
|
||||
}
|
||||
}
|
||||
|
||||
parent::preprocessForm($form, $data, $group);
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom clean the cache of com_content and content modules
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function cleanCache($group = null, $client_id = 0)
|
||||
{
|
||||
parent::cleanCache('com_content');
|
||||
parent::cleanCache('mod_articles_archive');
|
||||
parent::cleanCache('mod_articles_categories');
|
||||
parent::cleanCache('mod_articles_category');
|
||||
parent::cleanCache('mod_articles_latest');
|
||||
parent::cleanCache('mod_articles_news');
|
||||
parent::cleanCache('mod_articles_popular');
|
||||
}
|
||||
}
|
372
administrator/components/com_content/models/articles.php
Normal file
372
administrator/components/com_content/models/articles.php
Normal file
@ -0,0 +1,372 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_content
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Methods supporting a list of article records.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_content
|
||||
*/
|
||||
class ContentModelArticles extends JModelList
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $config An optional associative array of configuration settings.
|
||||
*
|
||||
* @since 1.6
|
||||
* @see JController
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
if (empty($config['filter_fields']))
|
||||
{
|
||||
$config['filter_fields'] = array(
|
||||
'id', 'a.id',
|
||||
'title', 'a.title',
|
||||
'alias', 'a.alias',
|
||||
'checked_out', 'a.checked_out',
|
||||
'checked_out_time', 'a.checked_out_time',
|
||||
'catid', 'a.catid', 'category_title',
|
||||
'state', 'a.state',
|
||||
'access', 'a.access', 'access_level',
|
||||
'created', 'a.created',
|
||||
'created_by', 'a.created_by',
|
||||
'created_by_alias', 'a.created_by_alias',
|
||||
'ordering', 'a.ordering',
|
||||
'featured', 'a.featured',
|
||||
'language', 'a.language',
|
||||
'hits', 'a.hits',
|
||||
'publish_up', 'a.publish_up',
|
||||
'publish_down', 'a.publish_down',
|
||||
);
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
|
||||
if ($assoc)
|
||||
{
|
||||
$config['filter_fields'][] = 'association';
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
// Adjust the context to support modal layouts.
|
||||
if ($layout = $app->input->get('layout'))
|
||||
{
|
||||
$this->context .= '.' . $layout;
|
||||
}
|
||||
|
||||
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
|
||||
$this->setState('filter.access', $access);
|
||||
|
||||
$authorId = $app->getUserStateFromRequest($this->context . '.filter.author_id', 'filter_author_id');
|
||||
$this->setState('filter.author_id', $authorId);
|
||||
|
||||
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
|
||||
$this->setState('filter.published', $published);
|
||||
|
||||
$categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id');
|
||||
$this->setState('filter.category_id', $categoryId);
|
||||
|
||||
$level = $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', 0, 'int');
|
||||
$this->setState('filter.level', $level);
|
||||
|
||||
$language = $this->getUserStateFromRequest($this->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.title', 'asc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a store id based on model configuration state.
|
||||
*
|
||||
* This is necessary because the model is used by the component and
|
||||
* different modules that might need different sets of data or different
|
||||
* ordering requirements.
|
||||
*
|
||||
* @param string $id A prefix for the store id.
|
||||
*
|
||||
* @return string A store id.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
// Compile the store id.
|
||||
$id .= ':' . $this->getState('filter.search');
|
||||
$id .= ':' . $this->getState('filter.access');
|
||||
$id .= ':' . $this->getState('filter.published');
|
||||
$id .= ':' . $this->getState('filter.category_id');
|
||||
$id .= ':' . $this->getState('filter.author_id');
|
||||
$id .= ':' . $this->getState('filter.language');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an SQL query to load the list data.
|
||||
*
|
||||
* @return JDatabaseQuery
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Create a new query object.
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$user = JFactory::getUser();
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Select the required fields from the table.
|
||||
$query->select(
|
||||
$this->getState(
|
||||
'list.select',
|
||||
'a.id, a.title, a.alias, a.checked_out, a.checked_out_time, a.catid' .
|
||||
', a.state, a.access, a.created, a.created_by, a.created_by_alias, a.ordering, a.featured, a.language, a.hits' .
|
||||
', a.publish_up, a.publish_down'
|
||||
)
|
||||
);
|
||||
$query->from('#__content 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 categories.
|
||||
$query->select('c.title AS category_title')
|
||||
->join('LEFT', '#__categories AS c ON c.id = a.catid');
|
||||
|
||||
// Join over the users for the author.
|
||||
$query->select('ua.name AS author_name')
|
||||
->join('LEFT', '#__users AS ua ON ua.id = a.created_by');
|
||||
|
||||
// Join over the associations.
|
||||
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
|
||||
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_content.item'))
|
||||
->join('LEFT', '#__associations AS asso2 ON asso2.key = asso.key')
|
||||
->group('a.id');
|
||||
}
|
||||
|
||||
// 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.state = ' . (int) $published);
|
||||
}
|
||||
elseif ($published === '')
|
||||
{
|
||||
$query->where('(a.state = 0 OR a.state = 1)');
|
||||
}
|
||||
|
||||
// Filter by a single or group of categories.
|
||||
$baselevel = 1;
|
||||
$categoryId = $this->getState('filter.category_id');
|
||||
if (is_numeric($categoryId))
|
||||
{
|
||||
$cat_tbl = JTable::getInstance('Category', 'JTable');
|
||||
$cat_tbl->load($categoryId);
|
||||
$rgt = $cat_tbl->rgt;
|
||||
$lft = $cat_tbl->lft;
|
||||
$baselevel = (int) $cat_tbl->level;
|
||||
$query->where('c.lft >= ' . (int) $lft)
|
||||
->where('c.rgt <= ' . (int) $rgt);
|
||||
}
|
||||
elseif (is_array($categoryId))
|
||||
{
|
||||
JArrayHelper::toInteger($categoryId);
|
||||
$categoryId = implode(',', $categoryId);
|
||||
$query->where('a.catid IN (' . $categoryId . ')');
|
||||
}
|
||||
|
||||
// Filter on the level.
|
||||
if ($level = $this->getState('filter.level'))
|
||||
{
|
||||
$query->where('c.level <= ' . ((int) $level + (int) $baselevel - 1));
|
||||
}
|
||||
|
||||
// Filter by author
|
||||
$authorId = $this->getState('filter.author_id');
|
||||
if (is_numeric($authorId))
|
||||
{
|
||||
$type = $this->getState('filter.author_id.include', true) ? '= ' : '<>';
|
||||
$query->where('a.created_by ' . $type . (int) $authorId);
|
||||
}
|
||||
|
||||
// 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 . ')');
|
||||
}
|
||||
}
|
||||
|
||||
// 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('com_content.article')
|
||||
);
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
$orderCol = $this->state->get('list.ordering', 'a.title');
|
||||
$orderDirn = $this->state->get('list.direction', 'asc');
|
||||
if ($orderCol == 'a.ordering' || $orderCol == 'category_title')
|
||||
{
|
||||
$orderCol = 'c.title ' . $orderDirn . ', a.ordering';
|
||||
}
|
||||
//sqlsrv change
|
||||
if ($orderCol == 'language')
|
||||
{
|
||||
$orderCol = 'l.title';
|
||||
}
|
||||
if ($orderCol == 'access_level')
|
||||
{
|
||||
$orderCol = 'ag.title';
|
||||
}
|
||||
$query->order($db->escape($orderCol . ' ' . $orderDirn));
|
||||
|
||||
// echo nl2br(str_replace('#__','jos_',$query));
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a list of authors
|
||||
*
|
||||
* @return JDatabaseQuery
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getAuthors()
|
||||
{
|
||||
// Create a new query object.
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Construct the query
|
||||
$query->select('u.id AS value, u.name AS text')
|
||||
->from('#__users AS u')
|
||||
->join('INNER', '#__content AS c ON c.created_by = u.id')
|
||||
->group('u.id, u.name')
|
||||
->order('u.name');
|
||||
|
||||
// Setup the query
|
||||
$db->setQuery($query);
|
||||
|
||||
// Return the result
|
||||
return $db->loadObjectList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a list of articles.
|
||||
* Overridden to add a check for access levels.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
* @since 1.6.1
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
$items = parent::getItems();
|
||||
$app = JFactory::getApplication();
|
||||
if ($app->isSite())
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$groups = $user->getAuthorisedViewLevels();
|
||||
|
||||
for ($x = 0, $count = count($items); $x < $count; $x++)
|
||||
{
|
||||
//Check the access level. Remove articles the user shouldn't see
|
||||
if (!in_array($items[$x]->access, $groups))
|
||||
{
|
||||
unset($items[$x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
}
|
47
administrator/components/com_content/models/feature.php
Normal file
47
administrator/components/com_content/models/feature.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_content
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
require_once __DIR__ . '/article.php';
|
||||
|
||||
/**
|
||||
* Feature model.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_content
|
||||
*/
|
||||
class ContentModelFeature extends ContentModelArticle
|
||||
{
|
||||
/**
|
||||
* Returns a Table object, always creating it.
|
||||
*
|
||||
* @param type The table type to instantiate
|
||||
* @param string A prefix for the table class name. Optional.
|
||||
* @param array Configuration array for model. Optional.
|
||||
* @return JTable A database object
|
||||
*/
|
||||
public function getTable($type = 'Featured', $prefix = 'ContentTable', $config = array())
|
||||
{
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* A protected method to get a set of ordering conditions.
|
||||
*
|
||||
* @param object A record object.
|
||||
* @return array An array of conditions to add to add to ordering queries.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getReorderConditions($table)
|
||||
{
|
||||
$condition = array();
|
||||
return $condition;
|
||||
}
|
||||
}
|
173
administrator/components/com_content/models/featured.php
Normal file
173
administrator/components/com_content/models/featured.php
Normal file
@ -0,0 +1,173 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_content
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
require_once __DIR__ . '/articles.php';
|
||||
|
||||
/**
|
||||
* About Page Model
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_content
|
||||
*/
|
||||
class ContentModelFeatured extends ContentModelArticles
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array An optional associative array of configuration settings.
|
||||
* @see JController
|
||||
* @since 1.6
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
if (empty($config['filter_fields']))
|
||||
{
|
||||
$config['filter_fields'] = array(
|
||||
'id', 'a.id',
|
||||
'title', 'a.title',
|
||||
'alias', 'a.alias',
|
||||
'checked_out', 'a.checked_out',
|
||||
'checked_out_time', 'a.checked_out_time',
|
||||
'catid', 'a.catid', 'category_title',
|
||||
'state', 'a.state',
|
||||
'access', 'a.access', 'access_level',
|
||||
'created', 'a.created',
|
||||
'created_by', 'a.created_by',
|
||||
'created_by_alias', 'a.created_by_alias',
|
||||
'ordering', 'a.ordering',
|
||||
'featured', 'a.featured',
|
||||
'language', 'a.language',
|
||||
'hits', 'a.hits',
|
||||
'publish_up', 'a.publish_up',
|
||||
'publish_down', 'a.publish_down',
|
||||
'fp.ordering',
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean True to join selected foreign information
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getListQuery($resolveFKs = true)
|
||||
{
|
||||
// Create a new query object.
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select the required fields from the table.
|
||||
$query->select(
|
||||
$this->getState(
|
||||
'list.select',
|
||||
'a.id, a.title, a.alias, a.checked_out, a.checked_out_time, a.catid, a.state, a.access, a.created, a.hits,' .
|
||||
'a.language, a.created_by_alias, a.publish_up, a.publish_down'
|
||||
)
|
||||
);
|
||||
$query->from('#__content 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 content table.
|
||||
$query->select('fp.ordering')
|
||||
->join('INNER', '#__content_frontpage AS fp ON fp.content_id = a.id');
|
||||
|
||||
// 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 categories.
|
||||
$query->select('c.title AS category_title')
|
||||
->join('LEFT', '#__categories AS c ON c.id = a.catid');
|
||||
|
||||
// Join over the users for the author.
|
||||
$query->select('ua.name AS author_name')
|
||||
->join('LEFT', '#__users AS ua ON ua.id = a.created_by');
|
||||
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
|
||||
// Filter by published state
|
||||
$published = $this->getState('filter.published');
|
||||
if (is_numeric($published))
|
||||
{
|
||||
$query->where('a.state = ' . (int) $published);
|
||||
}
|
||||
elseif ($published === '')
|
||||
{
|
||||
$query->where('(a.state = 0 OR a.state = 1)');
|
||||
}
|
||||
|
||||
// Filter by a single or group of categories.
|
||||
$baselevel = 1;
|
||||
$categoryId = $this->getState('filter.category_id');
|
||||
if (is_numeric($categoryId))
|
||||
{
|
||||
$cat_tbl = JTable::getInstance('Category', 'JTable');
|
||||
$cat_tbl->load($categoryId);
|
||||
$rgt = $cat_tbl->rgt;
|
||||
$lft = $cat_tbl->lft;
|
||||
$baselevel = (int) $cat_tbl->level;
|
||||
$query->where('c.lft >= ' . (int) $lft)
|
||||
->where('c.rgt <= ' . (int) $rgt);
|
||||
}
|
||||
elseif (is_array($categoryId))
|
||||
{
|
||||
JArrayHelper::toInteger($categoryId);
|
||||
$categoryId = implode(',', $categoryId);
|
||||
$query->where('a.catid IN (' . $categoryId . ')');
|
||||
}
|
||||
|
||||
// Filter on the level.
|
||||
if ($level = $this->getState('filter.level'))
|
||||
{
|
||||
$query->where('c.level <= ' . ((int) $level + (int) $baselevel - 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));
|
||||
}
|
||||
else
|
||||
{
|
||||
$search = $db->quote('%' . $db->escape($search, true) . '%');
|
||||
$query->where('a.title LIKE ' . $search . ' OR a.alias LIKE ' . $search);
|
||||
}
|
||||
}
|
||||
|
||||
// Filter on the language.
|
||||
if ($language = $this->getState('filter.language'))
|
||||
{
|
||||
$query->where('a.language = ' . $db->quote($language));
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
$query->order($db->escape($this->getState('list.ordering', 'a.title')) . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
|
||||
|
||||
//echo nl2br(str_replace('#__','jos_',(string)$query));
|
||||
return $query;
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_content
|
||||
*
|
||||
* @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_content
|
||||
* @since 1.6
|
||||
*/
|
||||
class JFormFieldModal_Article extends JFormField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $type = 'Modal_Article';
|
||||
|
||||
/**
|
||||
* Method to get the field input markup.
|
||||
*
|
||||
* @return string The field input markup.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
$allowEdit = ((string) $this->element['edit'] == 'true') ? true : false;
|
||||
$allowClear = ((string) $this->element['clear'] != 'false') ? true : false;
|
||||
|
||||
// Load language
|
||||
JFactory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR);
|
||||
|
||||
// Load the modal behavior script.
|
||||
JHtml::_('behavior.modal', 'a.modal');
|
||||
|
||||
// Build the script.
|
||||
$script = array();
|
||||
|
||||
// Select button script
|
||||
$script[] = ' function jSelectArticle_'.$this->id.'(id, title, catid, 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 jClearArticle(id) {';
|
||||
$script[] = ' document.getElementById(id + "_id").value = "";';
|
||||
$script[] = ' document.getElementById(id + "_name").value = "'.htmlspecialchars(JText::_('COM_CONTENT_SELECT_AN_ARTICLE', 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_content&view=articles&layout=modal&tmpl=component&function=jSelectArticle_'.$this->id;
|
||||
|
||||
if (isset($this->element['language']))
|
||||
{
|
||||
$link .= '&forcedLanguage='.$this->element['language'];
|
||||
}
|
||||
|
||||
$db = JFactory::getDbo();
|
||||
$db->setQuery(
|
||||
'SELECT title' .
|
||||
' FROM #__content' .
|
||||
' WHERE id = '.(int) $this->value
|
||||
);
|
||||
|
||||
try
|
||||
{
|
||||
$title = $db->loadResult();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
JError::raiseWarning(500, $e->getMessage());
|
||||
}
|
||||
|
||||
if (empty($title))
|
||||
{
|
||||
$title = JText::_('COM_CONTENT_SELECT_AN_ARTICLE');
|
||||
}
|
||||
$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
|
||||
|
||||
// The active article id field.
|
||||
if (0 == (int) $this->value)
|
||||
{
|
||||
$value = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$value = (int) $this->value;
|
||||
}
|
||||
|
||||
// The current article 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_CONTENT_CHANGE_ARTICLE').'" href="'.$link.'&'.JSession::getFormToken().'=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}"><i class="icon-file"></i> '.JText::_('JSELECT').'</a>';
|
||||
|
||||
// Edit article button
|
||||
if ($allowEdit)
|
||||
{
|
||||
$html[] = '<a class="btn hasTooltip'.($value ? '' : ' hidden').'" href="index.php?option=com_content&layout=modal&tmpl=component&task=article.edit&id=' . $value. '" target="_blank" title="'.JHtml::tooltipText('COM_CONTENT_EDIT_ARTICLE').'" ><span class="icon-edit"></span> ' . JText::_('JACTION_EDIT') . '</a>';
|
||||
}
|
||||
|
||||
// Clear article button
|
||||
if ($allowClear)
|
||||
{
|
||||
$html[] = '<button id="'.$this->id.'_clear" class="btn'.($value ? '' : ' hidden').'" onclick="return jClearArticle(\''.$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);
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
838
administrator/components/com_content/models/forms/article.xml
Normal file
838
administrator/components/com_content/models/forms/article.xml
Normal file
@ -0,0 +1,838 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fieldset addfieldpath="/administrator/components/com_categories/models/fields" >
|
||||
<field name="id" type="text" class="readonly" label="JGLOBAL_FIELD_ID_LABEL"
|
||||
description ="JGLOBAL_FIELD_ID_DESC" size="10" default="0"
|
||||
readonly="true" />
|
||||
|
||||
<field name="asset_id" type="hidden" filter="unset" />
|
||||
|
||||
<field name="title" type="text" label="JGLOBAL_TITLE"
|
||||
description="JFIELD_TITLE_DESC" class="input-xlarge" size="30"
|
||||
required="true" labelclass="control-label" />
|
||||
|
||||
<field name="alias" type="text" label="JFIELD_ALIAS_LABEL"
|
||||
description="JFIELD_ALIAS_DESC" class="inputbox" size="45" labelclass="control-label" />
|
||||
|
||||
<field name="articletext" type="editor" class="inputbox"
|
||||
label="COM_CONTENT_FIELD_ARTICLETEXT_LABEL" description="COM_CONTENT_FIELD_ARTICLETEXT_DESC"
|
||||
filter="JComponentHelper::filterText" buttons="true" />
|
||||
|
||||
<field name="state" type="list" label="JSTATUS"
|
||||
description="JFIELD_PUBLISHED_DESC" class="span12 small"
|
||||
filter="intval" size="1" default="1"
|
||||
>
|
||||
<option value="1">
|
||||
JPUBLISHED</option>
|
||||
<option value="0">
|
||||
JUNPUBLISHED</option>
|
||||
<option value="2">
|
||||
JARCHIVED</option>
|
||||
<option value="-2">
|
||||
JTRASHED</option>
|
||||
</field>
|
||||
|
||||
<field name="catid" type="categoryedit"
|
||||
label="JCATEGORY" description="JFIELD_CATEGORY_DESC"
|
||||
class="inputbox" required="true"
|
||||
>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="buttonspacer"
|
||||
description="JGLOBAL_ACTION_PERMISSIONS_DESCRIPTION"
|
||||
type="spacer" />
|
||||
|
||||
<field name="created" type="calendar" label="COM_CONTENT_FIELD_CREATED_LABEL"
|
||||
description="COM_CONTENT_FIELD_CREATED_DESC" class="inputbox" size="22"
|
||||
format="%Y-%m-%d %H:%M:%S" filter="user_utc" labelclass="control-label" />
|
||||
|
||||
<field name="created_by" type="user"
|
||||
label="COM_CONTENT_FIELD_CREATED_BY_LABEL" description="COM_CONTENT_FIELD_CREATED_BY_DESC" labelclass="control-label" />
|
||||
|
||||
<field name="created_by_alias" type="text"
|
||||
label="COM_CONTENT_FIELD_CREATED_BY_ALIAS_LABEL" description="COM_CONTENT_FIELD_CREATED_BY_ALIAS_DESC"
|
||||
class="inputbox" size="20" labelclass="control-label" />
|
||||
|
||||
<field name="modified" type="calendar" class="readonly"
|
||||
label="JGLOBAL_FIELD_MODIFIED_LABEL" description="COM_CONTENT_FIELD_MODIFIED_DESC"
|
||||
size="22" readonly="true" format="%Y-%m-%d %H:%M:%S" filter="user_utc" labelclass="control-label" />
|
||||
|
||||
<field name="modified_by" type="user"
|
||||
label="JGLOBAL_FIELD_MODIFIED_BY_LABEL"
|
||||
class="readonly"
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
labelclass="control-label"
|
||||
/>
|
||||
|
||||
<field name="checked_out" type="hidden" filter="unset" />
|
||||
|
||||
<field name="checked_out_time" type="hidden" filter="unset" />
|
||||
|
||||
<field name="publish_up" type="calendar"
|
||||
label="COM_CONTENT_FIELD_PUBLISH_UP_LABEL" description="COM_CONTENT_FIELD_PUBLISH_UP_DESC"
|
||||
class="inputbox" format="%Y-%m-%d %H:%M:%S" size="22"
|
||||
filter="user_utc" labelclass="control-label" />
|
||||
|
||||
<field name="publish_down" type="calendar"
|
||||
label="COM_CONTENT_FIELD_PUBLISH_DOWN_LABEL" description="COM_CONTENT_FIELD_PUBLISH_DOWN_DESC"
|
||||
class="inputbox" format="%Y-%m-%d %H:%M:%S" size="22"
|
||||
filter="user_utc" labelclass="control-label" />
|
||||
|
||||
<field name="version" type="text" class="readonly"
|
||||
label="COM_CONTENT_FIELD_VERSION_LABEL" size="6" description="COM_CONTENT_FIELD_VERSION_DESC"
|
||||
readonly="true" filter="unset" labelclass="control-label" />
|
||||
|
||||
<field name="ordering" type="text" label="JFIELD_ORDERING_LABEL"
|
||||
description="JFIELD_ORDERING_DESC" class="inputbox" size="6"
|
||||
default="0" labelclass="control-label" />
|
||||
|
||||
<field name="metakey" type="textarea"
|
||||
label="JFIELD_META_KEYWORDS_LABEL" description="JFIELD_META_KEYWORDS_DESC"
|
||||
class="inputbox" rows="3" cols="30" labelclass="control-label" />
|
||||
|
||||
<field name="metadesc" type="textarea"
|
||||
label="JFIELD_META_DESCRIPTION_LABEL" description="JFIELD_META_DESCRIPTION_DESC"
|
||||
class="inputbox" rows="3" cols="30" labelclass="control-label" />
|
||||
|
||||
<field name="access" type="accesslevel" label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC" class="span12 small" size="1" />
|
||||
|
||||
<field name="hits" type="text" label="JGLOBAL_HITS"
|
||||
description="COM_CONTENT_FIELD_HITS_DESC" class="readonly" size="6"
|
||||
readonly="true" filter="unset" />
|
||||
|
||||
<field name="language" type="contentlanguage" label="JFIELD_LANGUAGE_LABEL"
|
||||
description="COM_CONTENT_FIELD_LANGUAGE_DESC" class="span12 small"
|
||||
>
|
||||
<option value="*">JALL</option>
|
||||
</field>
|
||||
|
||||
<field name="featured" type="list"
|
||||
label="JFEATURED"
|
||||
description="COM_CONTENT_FIELD_FEATURED_DESC"
|
||||
default="0"
|
||||
class="span12 small"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="tags"
|
||||
type="tag"
|
||||
label="JTAG"
|
||||
description="JTAG_DESC"
|
||||
class="inputbox span12 small"
|
||||
multiple="true"
|
||||
>
|
||||
</field>
|
||||
|
||||
<field name="rules" type="rules" label="JFIELD_RULES_LABEL"
|
||||
translate_label="false" class="inputbox" filter="rules"
|
||||
component="com_content" section="article" validate="rules"
|
||||
/>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fields name="attribs">
|
||||
<fieldset name="basic" label="COM_CONTENT_ATTRIBS_FIELDSET_LABEL">
|
||||
<field
|
||||
name="show_title"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JGLOBAL_SHOW_TITLE_LABEL"
|
||||
description="JGLOBAL_SHOW_TITLE_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="link_titles"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JGLOBAL_LINKED_TITLES_LABEL"
|
||||
description="JGLOBAL_LINKED_TITLES_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="show_tags" type="radio"
|
||||
class="btn-group"
|
||||
label="COM_CONTENT_FIELD_SHOW_TAGS_LABEL"
|
||||
description="COM_CONTENT_FIELD_SHOW_TAGS_DESC"
|
||||
labelclass="control-label"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_intro"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
description="JGLOBAL_SHOW_INTRO_DESC"
|
||||
label="JGLOBAL_SHOW_INTRO_LABEL"
|
||||
labelclass="control-label"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
<field
|
||||
name="info_block_position"
|
||||
type="list"
|
||||
default=""
|
||||
label="COM_CONTENT_FIELD_INFOBLOCK_POSITION_LABEL"
|
||||
description="COM_CONTENT_FIELD_INFOBLOCK_POSITION_DESC">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">COM_CONTENT_FIELD_OPTION_ABOVE</option>
|
||||
<option value="1">COM_CONTENT_FIELD_OPTION_BELOW</option>
|
||||
<option value="2">COM_CONTENT_FIELD_OPTION_SPLIT</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_category"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JGLOBAL_SHOW_CATEGORY_LABEL"
|
||||
description="JGLOBAL_SHOW_CATEGORY_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="link_category"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JGLOBAL_LINK_CATEGORY_LABEL"
|
||||
description="JGLOBAL_LINK_CATEGORY_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_parent_category"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JGLOBAL_SHOW_PARENT_CATEGORY_LABEL"
|
||||
description="JGLOBAL_SHOW_PARENT_CATEGORY_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="link_parent_category"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JGLOBAL_LINK_PARENT_CATEGORY_LABEL"
|
||||
description="JGLOBAL_LINK_PARENT_CATEGORY_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_author"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JGLOBAL_SHOW_AUTHOR_LABEL"
|
||||
description="JGLOBAL_SHOW_AUTHOR_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="link_author"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JGLOBAL_LINK_AUTHOR_LABEL"
|
||||
description="JGLOBAL_LINK_AUTHOR_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_create_date"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JGLOBAL_SHOW_CREATE_DATE_LABEL"
|
||||
description="JGLOBAL_SHOW_CREATE_DATE_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_modify_date"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JGLOBAL_SHOW_MODIFY_DATE_LABEL"
|
||||
description="JGLOBAL_SHOW_MODIFY_DATE_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_publish_date"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JGLOBAL_SHOW_PUBLISH_DATE_LABEL"
|
||||
description="JGLOBAL_SHOW_PUBLISH_DATE_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_item_navigation"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JGLOBAL_SHOW_NAVIGATION_LABEL"
|
||||
description="JGLOBAL_SHOW_NAVIGATION_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_icons"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JGLOBAL_SHOW_ICONS_LABEL"
|
||||
description="JGLOBAL_SHOW_ICONS_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_print_icon"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JGLOBAL_SHOW_PRINT_ICON_LABEL"
|
||||
description="JGLOBAL_SHOW_PRINT_ICON_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_email_icon"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JGLOBAL_SHOW_EMAIL_ICON_LABEL"
|
||||
description="JGLOBAL_SHOW_EMAIL_ICON_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_vote"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JGLOBAL_SHOW_VOTE_LABEL"
|
||||
description="JGLOBAL_SHOW_VOTE_DESC"
|
||||
labelclass="control-label"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_hits"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JGLOBAL_SHOW_HITS_LABEL"
|
||||
description="JGLOBAL_SHOW_HITS_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_noauth"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="JGLOBAL_SHOW_UNAUTH_LINKS_LABEL"
|
||||
description="JGLOBAL_SHOW_UNAUTH_LINKS_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="urls_position"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="COM_CONTENT_FIELD_URLSPOSITION_LABEL"
|
||||
description="COM_CONTENT_FIELD_URLSPOSITION_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">COM_CONTENT_FIELD_OPTION_ABOVE</option>
|
||||
<option value="1">COM_CONTENT_FIELD_OPTION_BELOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="spacer2"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field name="alternative_readmore" type="inputbox"
|
||||
label="JFIELD_READMORE_LABEL"
|
||||
description="JFIELD_READMORE_DESC"
|
||||
class="inputbox" size="25" labelclass="control-label" />
|
||||
|
||||
<field name="article_layout" type="componentlayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
description="JFIELD_ALT_COMPONENT_LAYOUT_DESC"
|
||||
useglobal="true"
|
||||
extension="com_content" view="article" labelclass="control-label"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="editorConfig">
|
||||
<field
|
||||
name="show_publishing_options"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default=""
|
||||
label="COM_CONTENT_SHOW_PUBLISHING_OPTIONS_LABEL"
|
||||
description="COM_CONTENT_SHOW_PUBLISHING_OPTIONS_DESC" labelclass="control-label"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
|
||||
</field>
|
||||
<field
|
||||
name="show_article_options"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default=""
|
||||
label="COM_CONTENT_SHOW_ARTICLE_OPTIONS_LABEL"
|
||||
description="COM_CONTENT_SHOW_ARTICLE_OPTIONS_DESC"
|
||||
labelclass="control-label"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
|
||||
</field>
|
||||
<field
|
||||
name="show_urls_images_backend"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default=""
|
||||
label="COM_CONTENT_SHOW_IMAGES_URLS_BACK_LABEL"
|
||||
description="COM_CONTENT_SHOW_IMAGES_URLS_BACK_DESC"
|
||||
labelclass="control-label"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
|
||||
</field>
|
||||
<field
|
||||
name="show_urls_images_frontend"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default=""
|
||||
label="COM_CONTENT_SHOW_IMAGES_URLS_FRONT_LABEL"
|
||||
description="COM_CONTENT_SHOW_IMAGES_URLS_FRONT_DESC"
|
||||
labelclass="control-label"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="basic-limited" label="COM_CONTENT_ATTRIBS_FIELDSET_LABEL">
|
||||
<field
|
||||
name="show_title"
|
||||
type="hidden"
|
||||
label="JGLOBAL_SHOW_TITLE_LABEL"
|
||||
description="JGLOBAL_SHOW_TITLE_DESC"
|
||||
>
|
||||
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="link_titles"
|
||||
type="hidden"
|
||||
label="JGLOBAL_LINKED_TITLES_LABEL"
|
||||
description="JGLOBAL_LINKED_TITLES_DESC">
|
||||
</field>
|
||||
|
||||
<field name="show_intro"
|
||||
type="hidden"
|
||||
description="JGLOBAL_SHOW_INTRO_DESC"
|
||||
label="JGLOBAL_SHOW_INTRO_LABEL"
|
||||
>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_category"
|
||||
type="hidden"
|
||||
label="JGLOBAL_SHOW_CATEGORY_LABEL"
|
||||
description="JGLOBAL_SHOW_CATEGORY_DESC">
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="link_category"
|
||||
type="hidden"
|
||||
label="JGLOBAL_LINK_CATEGORY_LABEL"
|
||||
description="JGLOBAL_LINK_CATEGORY_DESC">
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_parent_category"
|
||||
type="hidden"
|
||||
label="JGLOBAL_SHOW_PARENT_CATEGORY_LABEL"
|
||||
description="JGLOBAL_SHOW_PARENT_CATEGORY_DESC">
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="link_parent_category"
|
||||
type="hidden"
|
||||
label="JGLOBAL_LINK_PARENT_CATEGORY_LABEL"
|
||||
description="JGLOBAL_LINK_PARENT_CATEGORY_DESC">
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_author"
|
||||
type="hidden"
|
||||
label="JGLOBAL_SHOW_AUTHOR_LABEL"
|
||||
description="JGLOBAL_SHOW_AUTHOR_DESC">
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="link_author"
|
||||
type="hidden"
|
||||
label="JGLOBAL_LINK_AUTHOR_LABEL"
|
||||
description="JGLOBAL_LINK_AUTHOR_DESC">
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_create_date"
|
||||
type="hidden"
|
||||
label="JGLOBAL_SHOW_CREATE_DATE_LABEL"
|
||||
description="JGLOBAL_SHOW_CREATE_DATE_DESC">
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_modify_date"
|
||||
type="hidden"
|
||||
label="JGLOBAL_SHOW_MODIFY_DATE_LABEL"
|
||||
description="JGLOBAL_SHOW_MODIFY_DATE_DESC">
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_publish_date"
|
||||
type="hidden"
|
||||
label="JGLOBAL_SHOW_PUBLISH_DATE_LABEL"
|
||||
description="JGLOBAL_SHOW_PUBLISH_DATE_DESC">
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_item_navigation"
|
||||
type="hidden"
|
||||
label="JGLOBAL_SHOW_NAVIGATION_LABEL"
|
||||
description="JGLOBAL_SHOW_NAVIGATION_DESC">
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_icons"
|
||||
type="hidden"
|
||||
label="JGLOBAL_SHOW_ICONS_LABEL"
|
||||
description="JGLOBAL_SHOW_ICONS_DESC">
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_print_icon"
|
||||
type="hidden"
|
||||
label="JGLOBAL_SHOW_PRINT_ICON_LABEL"
|
||||
description="JGLOBAL_SHOW_PRINT_ICON_DESC">
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_email_icon"
|
||||
type="hidden"
|
||||
label="JGLOBAL_SHOW_EMAIL_ICON_LABEL"
|
||||
description="JGLOBAL_SHOW_EMAIL_ICON_DESC">
|
||||
</field>
|
||||
<field
|
||||
name="show_vote"
|
||||
type="hidden"
|
||||
label="JGLOBAL_SHOW_VOTE_LABEL"
|
||||
description="JGLOBAL_SHOW_VOTE_DESC"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="show_hits"
|
||||
type="hidden"
|
||||
label="JGLOBAL_SHOW_HITS_LABEL"
|
||||
description="JGLOBAL_SHOW_HITS_DESC">
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_noauth"
|
||||
type="hidden"
|
||||
label="JGLOBAL_SHOW_UNAUTH_LINKS_LABEL"
|
||||
description="JGLOBAL_SHOW_UNAUTH_LINKS_DESC">
|
||||
</field>
|
||||
|
||||
<field name="alternative_readmore" type="hidden"
|
||||
label="JFIELD_READMORE_LABEL"
|
||||
description="JFIELD_READMORE_DESC"
|
||||
class="inputbox" size="25" />
|
||||
|
||||
<field name="article_layout" type="hidden"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
description="JFIELD_ALT_COMPONENT_LAYOUT_DESC"
|
||||
useglobal="true"
|
||||
extension="com_content" view="article"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
|
||||
<field name="xreference" type="text"
|
||||
label="JFIELD_KEY_REFERENCE_LABEL"
|
||||
description="JFIELD_KEY_REFERENCE_DESC"
|
||||
class="inputbox" size="20" labelclass="control-label" />
|
||||
|
||||
<fields name="images">
|
||||
<field
|
||||
name="image_intro"
|
||||
type="media"
|
||||
label="COM_CONTENT_FIELD_INTRO_LABEL"
|
||||
description="COM_CONTENT_FIELD_INTRO_DESC"
|
||||
labelclass="control-label"/>
|
||||
<field
|
||||
name="float_intro"
|
||||
type="list"
|
||||
label="COM_CONTENT_FLOAT_LABEL"
|
||||
description="COM_CONTENT_FLOAT_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="right">COM_CONTENT_RIGHT</option>
|
||||
<option value="left">COM_CONTENT_LEFT</option>
|
||||
<option value="none">COM_CONTENT_NONE</option>
|
||||
</field>
|
||||
<field name="image_intro_alt"
|
||||
type="text"
|
||||
label="COM_CONTENT_FIELD_IMAGE_ALT_LABEL"
|
||||
description="COM_CONTENT_FIELD_IMAGE_ALT_DESC"
|
||||
class="inputbox"
|
||||
size="20"
|
||||
labelclass="control-label"/>
|
||||
<field name="image_intro_caption"
|
||||
type="text"
|
||||
label="COM_CONTENT_FIELD_IMAGE_CAPTION_LABEL"
|
||||
description="COM_CONTENT_FIELD_IMAGE_CAPTION_DESC"
|
||||
class="inputbox"
|
||||
size="20"
|
||||
labelclass="control-label"/>
|
||||
<field
|
||||
name="spacer1"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
<field
|
||||
name="image_fulltext"
|
||||
type="media"
|
||||
label="COM_CONTENT_FIELD_FULL_LABEL"
|
||||
description="COM_CONTENT_FIELD_FULL_DESC"
|
||||
labelclass="control-label"/>
|
||||
<field
|
||||
name="float_fulltext"
|
||||
type="list"
|
||||
label="COM_CONTENT_FLOAT_LABEL"
|
||||
description="COM_CONTENT_FLOAT_DESC"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="right">COM_CONTENT_RIGHT</option>
|
||||
<option value="left">COM_CONTENT_LEFT</option>
|
||||
<option value="none">COM_CONTENT_NONE</option>
|
||||
</field>
|
||||
<field name="image_fulltext_alt"
|
||||
type="text"
|
||||
label="COM_CONTENT_FIELD_IMAGE_ALT_LABEL"
|
||||
description="COM_CONTENT_FIELD_IMAGE_ALT_DESC"
|
||||
class="inputbox"
|
||||
size="20"
|
||||
labelclass="control-label"/>
|
||||
<field name="image_fulltext_caption"
|
||||
type="text"
|
||||
label="COM_CONTENT_FIELD_IMAGE_CAPTION_LABEL"
|
||||
description="COM_CONTENT_FIELD_IMAGE_CAPTION_DESC"
|
||||
class="inputbox"
|
||||
size="20"
|
||||
labelclass="control-label"/>
|
||||
</fields>
|
||||
<fields name="urls">
|
||||
<field
|
||||
name="urla"
|
||||
type="url"
|
||||
validate="url"
|
||||
filter="url"
|
||||
label="COM_CONTENT_FIELD_URLA_LABEL"
|
||||
description="COM_CONTENT_FIELD_URL_DESC"
|
||||
labelclass="control-label" />
|
||||
<field name="urlatext"
|
||||
type="text"
|
||||
label="COM_CONTENT_FIELD_URLA_LINK_TEXT_LABEL"
|
||||
description="COM_CONTENT_FIELD_URL_LINK_TEXT_DESC"
|
||||
class="inputbox"
|
||||
size="20"
|
||||
labelclass="control-label"/>
|
||||
<field
|
||||
name="targeta"
|
||||
type="list"
|
||||
label="COM_CONTENT_URL_FIELD_BROWSERNAV_LABEL"
|
||||
description="COM_CONTENT_URL_FIELD_BROWSERNAV_DESC"
|
||||
default=""
|
||||
filter="options"
|
||||
class="inputbox"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JBROWSERTARGET_PARENT</option>
|
||||
<option value="1">JBROWSERTARGET_NEW</option>
|
||||
<option value="2">JBROWSERTARGET_POPUP</option>
|
||||
<option value="3">JBROWSERTARGET_MODAL</option>
|
||||
</field>
|
||||
<field
|
||||
name="spacer3"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
<field
|
||||
name="urlb"
|
||||
type="url"
|
||||
validate="url"
|
||||
filter="url"
|
||||
label="COM_CONTENT_FIELD_URLB_LABEL"
|
||||
description="COM_CONTENT_FIELD_URL_DESC"
|
||||
labelclass="control-label"/>
|
||||
<field name="urlbtext"
|
||||
type="text"
|
||||
label="COM_CONTENT_FIELD_URLB_LINK_TEXT_LABEL"
|
||||
description="COM_CONTENT_FIELD_URL_LINK_TEXT_DESC"
|
||||
class="inputbox"
|
||||
size="20"
|
||||
labelclass="control-label"/>
|
||||
<field
|
||||
name="targetb"
|
||||
type="list"
|
||||
label="COM_CONTENT_URL_FIELD_BROWSERNAV_LABEL"
|
||||
description="COM_CONTENT_URL_FIELD_BROWSERNAV_DESC"
|
||||
default=""
|
||||
filter="options"
|
||||
class="inputbox"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JBROWSERTARGET_PARENT</option>
|
||||
<option value="1">JBROWSERTARGET_NEW</option>
|
||||
<option value="2">JBROWSERTARGET_POPUP</option>
|
||||
<option value="3">JBROWSERTARGET_MODAL</option>
|
||||
</field>
|
||||
<field
|
||||
name="spacer4"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
<field
|
||||
name="urlc"
|
||||
type="url"
|
||||
validate="url"
|
||||
filter="url"
|
||||
label="COM_CONTENT_FIELD_URLC_LABEL"
|
||||
description="COM_CONTENT_FIELD_URL_DESC"
|
||||
labelclass="control-label"/>
|
||||
<field
|
||||
name="urlctext"
|
||||
type="text"
|
||||
label="COM_CONTENT_FIELD_URLC_LINK_TEXT_LABEL"
|
||||
description="COM_CONTENT_FIELD_URL_LINK_TEXT_DESC"
|
||||
class="inputbox"
|
||||
size="20"
|
||||
labelclass="control-label"/>
|
||||
<field
|
||||
name="targetc"
|
||||
type="list"
|
||||
label="COM_CONTENT_URL_FIELD_BROWSERNAV_LABEL"
|
||||
description="COM_CONTENT_URL_FIELD_BROWSERNAV_DESC"
|
||||
default=""
|
||||
filter="options"
|
||||
class="inputbox"
|
||||
labelclass="control-label">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JBROWSERTARGET_PARENT</option>
|
||||
<option value="1">JBROWSERTARGET_NEW</option>
|
||||
<option value="2">JBROWSERTARGET_POPUP</option>
|
||||
<option value="3">JBROWSERTARGET_MODAL</option>
|
||||
</field>
|
||||
|
||||
</fields>
|
||||
<fields name="metadata">
|
||||
<fieldset name="jmetadata"
|
||||
label="JGLOBAL_FIELDSET_METADATA_OPTIONS">
|
||||
|
||||
<field name="robots"
|
||||
type="list"
|
||||
label="JFIELD_METADATA_ROBOTS_LABEL"
|
||||
description="JFIELD_METADATA_ROBOTS_DESC"
|
||||
labelclass="control-label"
|
||||
>
|
||||
<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>
|
||||
|
||||
<field name="author" type="text"
|
||||
label="JAUTHOR" description="JFIELD_METADATA_AUTHOR_DESC"
|
||||
size="20" labelclass="control-label" />
|
||||
|
||||
<field name="rights" type="textarea" label="JFIELD_META_RIGHTS_LABEL"
|
||||
description="JFIELD_META_RIGHTS_DESC" required="false" filter="string"
|
||||
cols="30" rows="2" labelclass="control-label" />
|
||||
<field name="xreference" type="text"
|
||||
label="COM_CONTENT_FIELD_XREFERENCE_LABEL"
|
||||
description="COM_CONTENT_FIELD_XREFERENCE_DESC"
|
||||
class="inputbox" size="20" labelclass="control-label" />
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
|
||||
</form>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
1
administrator/components/com_content/models/index.html
Normal file
1
administrator/components/com_content/models/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
Reference in New Issue
Block a user