You've already forked joomla_test
first commit
This commit is contained in:
14
components/com_banners/banners.php
Normal file
14
components/com_banners/banners.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_banners
|
||||
*
|
||||
* @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;
|
||||
|
||||
$controller = JControllerLegacy::getInstance('Banners');
|
||||
$controller->execute(JFactory::getApplication()->input->get('task'));
|
||||
$controller->redirect();
|
33
components/com_banners/controller.php
Normal file
33
components/com_banners/controller.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_banners
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Banners Controller
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_banners
|
||||
* @since 1.5
|
||||
*/
|
||||
class BannersController extends JControllerLegacy
|
||||
{
|
||||
public function click()
|
||||
{
|
||||
$id = $this->input->getInt('id', 0);
|
||||
|
||||
if ($id)
|
||||
{
|
||||
$model = $this->getModel('Banner', 'BannersModel', array('ignore_request' => true));
|
||||
$model->setState('banner.id', $id);
|
||||
$model->click();
|
||||
$this->setRedirect($model->getUrl());
|
||||
}
|
||||
}
|
||||
}
|
41
components/com_banners/helpers/banner.php
Normal file
41
components/com_banners/helpers/banner.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_banners
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_banners
|
||||
*/
|
||||
abstract class BannerHelper
|
||||
{
|
||||
/**
|
||||
* Checks if a URL is an image
|
||||
*
|
||||
* @param string
|
||||
* @return URL
|
||||
*/
|
||||
public static function isImage($url)
|
||||
{
|
||||
$result = preg_match('#\.(?:bmp|gif|jpe?g|png)$#i', $url);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a URL is a Flash file
|
||||
*
|
||||
* @param string
|
||||
* @return URL
|
||||
*/
|
||||
public static function isFlash($url)
|
||||
{
|
||||
$result = preg_match('#\.swf$#i', $url);
|
||||
return $result;
|
||||
}
|
||||
}
|
27
components/com_banners/helpers/category.php
Normal file
27
components/com_banners/helpers/category.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_banners
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Banners Component Category Tree
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_banners
|
||||
* @since 1.6
|
||||
*/
|
||||
class BannersCategories extends JCategories
|
||||
{
|
||||
public function __construct($options = array())
|
||||
{
|
||||
$options['table'] = '#__banners';
|
||||
$options['extension'] = 'com_banners';
|
||||
parent::__construct($options);
|
||||
}
|
||||
}
|
1
components/com_banners/helpers/index.html
Normal file
1
components/com_banners/helpers/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
1
components/com_banners/index.html
Normal file
1
components/com_banners/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
203
components/com_banners/models/banner.php
Normal file
203
components/com_banners/models/banner.php
Normal file
@ -0,0 +1,203 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_banners
|
||||
*
|
||||
* @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;
|
||||
|
||||
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/tables');
|
||||
|
||||
/**
|
||||
* Banner model for the Joomla Banners component.
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_banners
|
||||
* @since 1.5
|
||||
*/
|
||||
class BannersModelBanner extends JModelLegacy
|
||||
{
|
||||
protected $_item;
|
||||
|
||||
/**
|
||||
* Clicks the URL, incrementing the counter
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public function click()
|
||||
{
|
||||
$id = $this->getState('banner.id');
|
||||
|
||||
// update click count
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->update('#__banners')
|
||||
->set('clicks = (clicks + 1)')
|
||||
->where('id = ' . (int) $id);
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$db->execute();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
JError::raiseError(500, $e->getMessage());
|
||||
}
|
||||
|
||||
// track clicks
|
||||
|
||||
$item = $this->getItem();
|
||||
|
||||
$trackClicks = $item->track_clicks;
|
||||
|
||||
if ($trackClicks < 0 && $item->cid)
|
||||
{
|
||||
$trackClicks = $item->client_track_clicks;
|
||||
}
|
||||
|
||||
if ($trackClicks < 0)
|
||||
{
|
||||
$config = JComponentHelper::getParams('com_banners');
|
||||
$trackClicks = $config->get('track_clicks');
|
||||
}
|
||||
|
||||
if ($trackClicks > 0)
|
||||
{
|
||||
$trackDate = JFactory::getDate()->format('Y-m-d H');
|
||||
|
||||
$query->clear()
|
||||
->select($db->quoteName('count'))
|
||||
->from('#__banner_tracks')
|
||||
->where('track_type=2')
|
||||
->where('banner_id=' . (int) $id)
|
||||
->where('track_date=' . $db->quote($trackDate));
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$db->execute();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
JError::raiseError(500, $e->getMessage());
|
||||
}
|
||||
|
||||
$count = $db->loadResult();
|
||||
|
||||
$query->clear();
|
||||
|
||||
if ($count)
|
||||
{
|
||||
// update count
|
||||
$query->update('#__banner_tracks')
|
||||
->set($db->quoteName('count') . ' = (' . $db->quote('count') . ' + 1)')
|
||||
->where('track_type=2')
|
||||
->where('banner_id=' . (int) $id)
|
||||
->where('track_date=' . $db->quote($trackDate));
|
||||
}
|
||||
else
|
||||
{
|
||||
// insert new count
|
||||
//sqlsrv change
|
||||
$query->insert('#__banner_tracks')
|
||||
->columns(
|
||||
array(
|
||||
$db->quoteName('count'), $db->quoteName('track_type'),
|
||||
$db->quoteName('banner_id'), $db->quoteName('track_date')
|
||||
)
|
||||
)
|
||||
->values('1, 2,' . (int) $id . ',' . $db->quote($trackDate));
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$db->execute();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
JError::raiseError(500, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data for a banner.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function &getItem()
|
||||
{
|
||||
if (!isset($this->_item))
|
||||
{
|
||||
$cache = JFactory::getCache('com_banners', '');
|
||||
|
||||
$id = $this->getState('banner.id');
|
||||
|
||||
$this->_item = $cache->get($id);
|
||||
|
||||
if ($this->_item === false)
|
||||
{
|
||||
// redirect to banner url
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select(
|
||||
'a.clickurl as clickurl,' .
|
||||
'a.cid as cid,' .
|
||||
'a.track_clicks as track_clicks'
|
||||
)
|
||||
->from('#__banners as a')
|
||||
->where('a.id = ' . (int) $id)
|
||||
|
||||
->join('LEFT', '#__banner_clients AS cl ON cl.id = a.cid')
|
||||
->select('cl.track_clicks as client_track_clicks');
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$db->execute();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
JError::raiseError(500, $e->getMessage());
|
||||
}
|
||||
|
||||
$this->_item = $db->loadObject();
|
||||
$cache->store($this->_item, $id);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URL for a banner
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
$item = $this->getItem();
|
||||
$url = $item->clickurl;
|
||||
|
||||
// check for links
|
||||
if (!preg_match('#http[s]?://|index[2]?\.php#', $url))
|
||||
{
|
||||
$url = "http://$url";
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
303
components/com_banners/models/banners.php
Normal file
303
components/com_banners/models/banners.php
Normal file
@ -0,0 +1,303 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_banners
|
||||
*
|
||||
* @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;
|
||||
|
||||
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/tables');
|
||||
|
||||
/**
|
||||
* Banners model for the Joomla Banners component.
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_banners
|
||||
* @since 1.6
|
||||
*/
|
||||
class BannersModelBanners extends JModelList
|
||||
{
|
||||
/**
|
||||
* 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.tag_search');
|
||||
$id .= ':' . $this->getState('filter.client_id');
|
||||
$id .= ':' . serialize($this->getState('filter.category_id'));
|
||||
$id .= ':' . serialize($this->getState('filter.keywords'));
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of banners
|
||||
*
|
||||
* @return array An array of banner objects.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$ordering = $this->getState('filter.ordering');
|
||||
$tagSearch = $this->getState('filter.tag_search');
|
||||
$cid = $this->getState('filter.client_id');
|
||||
$categoryId = $this->getState('filter.category_id');
|
||||
$keywords = $this->getState('filter.keywords');
|
||||
$randomise = ($ordering == 'random');
|
||||
$nullDate = $db->quote($db->getNullDate());
|
||||
|
||||
$query->select(
|
||||
'a.id as id,' .
|
||||
'a.type as type,' .
|
||||
'a.name as name,' .
|
||||
'a.clickurl as clickurl,' .
|
||||
'a.cid as cid,' .
|
||||
'a.params as params,' .
|
||||
'a.custombannercode as custombannercode,' .
|
||||
'a.track_impressions as track_impressions,' .
|
||||
'cl.track_impressions as client_track_impressions'
|
||||
)
|
||||
->from('#__banners as a')
|
||||
->join('LEFT', '#__banner_clients AS cl ON cl.id = a.cid')
|
||||
->where('a.state=1')
|
||||
->where('(' . $query->currentTimestamp() . ' >= a.publish_up OR a.publish_up = ' . $nullDate . ')')
|
||||
->where('(' . $query->currentTimestamp() . ' <= a.publish_down OR a.publish_down = ' . $nullDate . ')')
|
||||
->where('(a.imptotal = 0 OR a.impmade <= a.imptotal)');
|
||||
|
||||
if ($cid)
|
||||
{
|
||||
$query->join('LEFT', '#__categories as cat ON a.catid = cat.id')
|
||||
->where('a.cid = ' . (int) $cid)
|
||||
->where('cl.state = 1');
|
||||
}
|
||||
|
||||
// Filter by a single or group of categories
|
||||
if (is_numeric($categoryId))
|
||||
{
|
||||
$type = $this->getState('filter.category_id.include', true) ? '= ' : '<> ';
|
||||
|
||||
// Add subcategory check
|
||||
$includeSubcategories = $this->getState('filter.subcategories', false);
|
||||
$categoryEquals = 'a.catid ' . $type . (int) $categoryId;
|
||||
|
||||
if ($includeSubcategories)
|
||||
{
|
||||
$levels = (int) $this->getState('filter.max_category_levels', '1');
|
||||
// Create a subquery for the subcategory list
|
||||
$subQuery = $db->getQuery(true);
|
||||
$subQuery->select('sub.id')
|
||||
->from('#__categories as sub')
|
||||
->join('INNER', '#__categories as this ON sub.lft > this.lft AND sub.rgt < this.rgt')
|
||||
->where('this.id = ' . (int) $categoryId)
|
||||
->where('sub.level <= this.level + ' . $levels);
|
||||
|
||||
// Add the subquery to the main query
|
||||
$query->where('(' . $categoryEquals . ' OR a.catid IN (' . $subQuery->__toString() . '))');
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->where($categoryEquals);
|
||||
}
|
||||
}
|
||||
elseif ((is_array($categoryId)) && (count($categoryId) > 0))
|
||||
{
|
||||
JArrayHelper::toInteger($categoryId);
|
||||
$categoryId = implode(',', $categoryId);
|
||||
if ($categoryId != '0')
|
||||
{
|
||||
$type = $this->getState('filter.category_id.include', true) ? 'IN' : 'NOT IN';
|
||||
$query->where('a.catid ' . $type . ' (' . $categoryId . ')');
|
||||
}
|
||||
}
|
||||
|
||||
if ($tagSearch)
|
||||
{
|
||||
if (count($keywords) == 0)
|
||||
{
|
||||
$query->where('0');
|
||||
}
|
||||
else
|
||||
{
|
||||
$temp = array();
|
||||
$config = JComponentHelper::getParams('com_banners');
|
||||
$prefix = $config->get('metakey_prefix');
|
||||
|
||||
foreach ($keywords as $keyword)
|
||||
{
|
||||
$keyword = trim($keyword);
|
||||
$condition1 = "a.own_prefix=1 AND a.metakey_prefix=SUBSTRING(" . $db->quote($keyword) . ",1,LENGTH( a.metakey_prefix)) OR a.own_prefix=0 AND cl.own_prefix=1 AND cl.metakey_prefix=SUBSTRING(" . $db->quote($keyword) . ",1,LENGTH(cl.metakey_prefix)) OR a.own_prefix=0 AND cl.own_prefix=0 AND " . ($prefix == substr($keyword, 0, strlen($prefix)) ? '1' : '0');
|
||||
|
||||
$condition2 = "a.metakey REGEXP '[[:<:]]" . $db->escape($keyword) . "[[:>:]]'";
|
||||
|
||||
if ($cid)
|
||||
{
|
||||
$condition2 .= " OR cl.metakey REGEXP '[[:<:]]" . $db->escape($keyword) . "[[:>:]]'";
|
||||
}
|
||||
|
||||
if ($catid)
|
||||
{
|
||||
$condition2 .= " OR cat.metakey REGEXP '[[:<:]]" . $db->escape($keyword) . "[[:>:]]'";
|
||||
}
|
||||
|
||||
$temp[] = "($condition1) AND ($condition2)";
|
||||
}
|
||||
|
||||
$query->where('(' . implode(' OR ', $temp) . ')');
|
||||
}
|
||||
}
|
||||
|
||||
// Filter by language
|
||||
if ($this->getState('filter.language'))
|
||||
{
|
||||
$query->where('a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
|
||||
}
|
||||
|
||||
$query->order('a.sticky DESC,' . ($randomise ? 'RAND()' : 'a.ordering'));
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of banners.
|
||||
*
|
||||
* @return array
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
if (!isset($this->cache['items']))
|
||||
{
|
||||
$this->cache['items'] = parent::getItems();
|
||||
|
||||
foreach ($this->cache['items'] as &$item)
|
||||
{
|
||||
$parameters = new JRegistry;
|
||||
$parameters->loadString($item->params);
|
||||
$item->params = $parameters;
|
||||
}
|
||||
}
|
||||
return $this->cache['items'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes impressions on a list of banners
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
public function impress()
|
||||
{
|
||||
$trackDate = JFactory::getDate()->format('Y-m-d H');
|
||||
$items = $this->getItems();
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
foreach ($items as $item)
|
||||
{
|
||||
// Increment impression made
|
||||
$id = $item->id;
|
||||
$query->clear()
|
||||
->update('#__banners')
|
||||
->set('impmade = (impmade + 1)')
|
||||
->where('id = ' . (int) $id);
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$db->execute();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
JError::raiseError(500, $e->getMessage());
|
||||
}
|
||||
|
||||
// track impressions
|
||||
$trackImpressions = $item->track_impressions;
|
||||
if ($trackImpressions < 0 && $item->cid)
|
||||
{
|
||||
$trackImpressions = $item->client_track_impressions;
|
||||
}
|
||||
|
||||
if ($trackImpressions < 0)
|
||||
{
|
||||
$config = JComponentHelper::getParams('com_banners');
|
||||
$trackImpressions = $config->get('track_impressions');
|
||||
}
|
||||
|
||||
if ($trackImpressions > 0)
|
||||
{
|
||||
// is track already created ?
|
||||
$query->clear()
|
||||
->select($db->quoteName('count'))
|
||||
->from('#__banner_tracks')
|
||||
->where('track_type=1')
|
||||
->where('banner_id=' . (int) $id)
|
||||
->where('track_date=' . $db->quote($trackDate));
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$db->execute();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
JError::raiseError(500, $e->getMessage());
|
||||
}
|
||||
|
||||
$count = $db->loadResult();
|
||||
|
||||
$query->clear();
|
||||
|
||||
if ($count)
|
||||
{
|
||||
// update count
|
||||
$query->update('#__banner_tracks')
|
||||
->set($db->quoteName('count') . ' = (' . $db->quote('count') . ' + 1)')
|
||||
->where('track_type=1')
|
||||
->where('banner_id=' . (int) $id)
|
||||
->where('track_date=' . $db->quote($trackDate));
|
||||
}
|
||||
else
|
||||
{
|
||||
// insert new count
|
||||
//sqlsrv change
|
||||
$query->insert('#__banner_tracks')
|
||||
->columns(
|
||||
array(
|
||||
$db->quoteName('count'), $db->quoteName('track_type'),
|
||||
$db->quoteName('banner_id'), $db->quoteName('track_date')
|
||||
)
|
||||
)
|
||||
->values('1, 1, ' . (int) $id . ', ' . $db->quote($trackDate));
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$db->execute();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
JError::raiseError(500, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1
components/com_banners/models/index.html
Normal file
1
components/com_banners/models/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
75
components/com_banners/router.php
Normal file
75
components/com_banners/router.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_banners
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* @return array A named array
|
||||
* @return array
|
||||
*/
|
||||
function BannersBuildRoute(&$query)
|
||||
{
|
||||
$segments = array();
|
||||
|
||||
if (isset($query['task']))
|
||||
{
|
||||
$segments[] = $query['task'];
|
||||
unset($query['task']);
|
||||
}
|
||||
if (isset($query['id']))
|
||||
{
|
||||
$segments[] = $query['id'];
|
||||
unset($query['id']);
|
||||
}
|
||||
|
||||
return $segments;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array A named array
|
||||
* @param array
|
||||
*
|
||||
* Formats:
|
||||
*
|
||||
* index.php?/banners/task/id/Itemid
|
||||
*
|
||||
* index.php?/banners/id/Itemid
|
||||
*/
|
||||
function BannersParseRoute($segments)
|
||||
{
|
||||
$vars = array();
|
||||
|
||||
// view is always the first element of the array
|
||||
$count = count($segments);
|
||||
|
||||
if ($count)
|
||||
{
|
||||
$count--;
|
||||
$segment = array_shift($segments);
|
||||
if (is_numeric($segment))
|
||||
{
|
||||
$vars['id'] = $segment;
|
||||
}
|
||||
else
|
||||
{
|
||||
$vars['task'] = $segment;
|
||||
}
|
||||
}
|
||||
|
||||
if ($count)
|
||||
{
|
||||
$segment = array_shift($segments);
|
||||
if (is_numeric($segment))
|
||||
{
|
||||
$vars['id'] = $segment;
|
||||
}
|
||||
}
|
||||
|
||||
return $vars;
|
||||
}
|
16
components/com_contact/contact.php
Normal file
16
components/com_contact/contact.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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 . '/helpers/route.php';
|
||||
|
||||
$controller = JControllerLegacy::getInstance('Contact');
|
||||
$controller->execute(JFactory::getApplication()->input->get('task'));
|
||||
$controller->redirect();
|
45
components/com_contact/controller.php
Normal file
45
components/com_contact/controller.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Contact Component Controller
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
* @since 1.5
|
||||
*/
|
||||
class ContactController extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* Method to display a view.
|
||||
*
|
||||
* @param boolean If true, the view output will be cached
|
||||
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
|
||||
*
|
||||
* @return JController This object to support chaining.
|
||||
* @since 1.5
|
||||
*/
|
||||
public function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
$cachable = true;
|
||||
|
||||
// Set the default view name and format from the Request.
|
||||
$vName = $this->input->get('view', 'categories');
|
||||
$this->input->set('view', $vName);
|
||||
|
||||
$safeurlparams = array('catid' => 'INT', 'id' => 'INT', 'cid' => 'ARRAY', 'year' => 'INT', 'month' => 'INT', 'limit' => 'UINT', 'limitstart' => 'UINT',
|
||||
'showall' => 'INT', 'return' => 'BASE64', 'filter' => 'STRING', 'filter_order' => 'CMD', 'filter_order_Dir' => 'CMD', 'filter-search' => 'STRING', 'print' => 'BOOLEAN', 'lang' => 'CMD');
|
||||
|
||||
parent::display($cachable, $safeurlparams);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
189
components/com_contact/controllers/contact.php
Normal file
189
components/com_contact/controllers/contact.php
Normal file
@ -0,0 +1,189 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*/
|
||||
class ContactControllerContact extends JControllerForm
|
||||
{
|
||||
public function getModel($name = '', $prefix = '', $config = array('ignore_request' => true))
|
||||
{
|
||||
return parent::getModel($name, $prefix, array('ignore_request' => false));
|
||||
}
|
||||
|
||||
public function submit()
|
||||
{
|
||||
// Check for request forgeries.
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$model = $this->getModel('contact');
|
||||
$params = JComponentHelper::getParams('com_contact');
|
||||
$stub = $this->input->getString('id');
|
||||
$id = (int) $stub;
|
||||
|
||||
// Get the data from POST
|
||||
$data = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
$contact = $model->getItem($id);
|
||||
|
||||
$params->merge($contact->params);
|
||||
|
||||
// Check for a valid session cookie
|
||||
if ($params->get('validate_session', 0))
|
||||
{
|
||||
if (JFactory::getSession()->getState() != 'active'){
|
||||
JError::raiseWarning(403, JText::_('COM_CONTACT_SESSION_INVALID'));
|
||||
|
||||
// Save the data in the session.
|
||||
$app->setUserState('com_contact.contact.data', $data);
|
||||
|
||||
// Redirect back to the contact form.
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id='.$stub, false));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Contact plugins
|
||||
JPluginHelper::importPlugin('contact');
|
||||
$dispatcher = JEventDispatcher::getInstance();
|
||||
|
||||
// Validate the posted data.
|
||||
$form = $model->getForm();
|
||||
if (!$form)
|
||||
{
|
||||
JError::raiseError(500, $model->getError());
|
||||
return false;
|
||||
}
|
||||
|
||||
$validate = $model->validate($form, $data);
|
||||
|
||||
if ($validate === false)
|
||||
{
|
||||
// Get the validation messages.
|
||||
$errors = $model->getErrors();
|
||||
// Push up to three validation messages out to the user.
|
||||
for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++)
|
||||
{
|
||||
if ($errors[$i] instanceof Exception)
|
||||
{
|
||||
$app->enqueueMessage($errors[$i]->getMessage(), 'warning');
|
||||
} else {
|
||||
$app->enqueueMessage($errors[$i], 'warning');
|
||||
}
|
||||
}
|
||||
|
||||
// Save the data in the session.
|
||||
$app->setUserState('com_contact.contact.data', $data);
|
||||
|
||||
// Redirect back to the contact form.
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id='.$stub, false));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Validation succeeded, continue with custom handlers
|
||||
$results = $dispatcher->trigger('onValidateContact', array(&$contact, &$data));
|
||||
|
||||
foreach ($results as $result)
|
||||
{
|
||||
if ($result instanceof Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Passed Validation: Process the contact plugins to integrate with other applications
|
||||
$dispatcher->trigger('onSubmitContact', array(&$contact, &$data));
|
||||
|
||||
// Send the email
|
||||
$sent = false;
|
||||
if (!$params->get('custom_reply'))
|
||||
{
|
||||
$sent = $this->_sendEmail($data, $contact);
|
||||
}
|
||||
|
||||
// Set the success message if it was a success
|
||||
if (!($sent instanceof Exception))
|
||||
{
|
||||
$msg = JText::_('COM_CONTACT_EMAIL_THANKS');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = '';
|
||||
}
|
||||
|
||||
// Flush the data from the session
|
||||
$app->setUserState('com_contact.contact.data', null);
|
||||
|
||||
// Redirect if it is set in the parameters, otherwise redirect back to where we came from
|
||||
if ($contact->params->get('redirect'))
|
||||
{
|
||||
$this->setRedirect($contact->params->get('redirect'), $msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id='.$stub, false), $msg);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function _sendEmail($data, $contact)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
if ($contact->email_to == '' && $contact->user_id != 0)
|
||||
{
|
||||
$contact_user = JUser::getInstance($contact->user_id);
|
||||
$contact->email_to = $contact_user->get('email');
|
||||
}
|
||||
$mailfrom = $app->getCfg('mailfrom');
|
||||
$fromname = $app->getCfg('fromname');
|
||||
$sitename = $app->getCfg('sitename');
|
||||
|
||||
$name = $data['contact_name'];
|
||||
$email = JstringPunycode::emailToPunycode($data['contact_email']);
|
||||
$subject = $data['contact_subject'];
|
||||
$body = $data['contact_message'];
|
||||
|
||||
// Prepare email body
|
||||
$prefix = JText::sprintf('COM_CONTACT_ENQUIRY_TEXT', JUri::base());
|
||||
$body = $prefix."\n".$name.' <'.$email.'>'."\r\n\r\n".stripslashes($body);
|
||||
|
||||
$mail = JFactory::getMailer();
|
||||
$mail->addRecipient($contact->email_to);
|
||||
$mail->addReplyTo(array($email, $name));
|
||||
$mail->setSender(array($mailfrom, $fromname));
|
||||
$mail->setSubject($sitename.': '.$subject);
|
||||
$mail->setBody($body);
|
||||
$sent = $mail->Send();
|
||||
|
||||
//If we are supposed to copy the sender, do so.
|
||||
|
||||
// check whether email copy function activated
|
||||
if ( array_key_exists('contact_email_copy', $data) )
|
||||
{
|
||||
$copytext = JText::sprintf('COM_CONTACT_COPYTEXT_OF', $contact->name, $sitename);
|
||||
$copytext .= "\r\n\r\n".$body;
|
||||
$copysubject = JText::sprintf('COM_CONTACT_COPYSUBJECT_OF', $subject);
|
||||
|
||||
$mail = JFactory::getMailer();
|
||||
$mail->addRecipient($email);
|
||||
$mail->addReplyTo(array($email, $name));
|
||||
$mail->setSender(array($mailfrom, $fromname));
|
||||
$mail->setSubject($copysubject);
|
||||
$mail->setBody($copytext);
|
||||
$sent = $mail->Send();
|
||||
}
|
||||
|
||||
return $sent;
|
||||
}
|
||||
}
|
1
components/com_contact/controllers/index.html
Normal file
1
components/com_contact/controllers/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
69
components/com_contact/helpers/association.php
Normal file
69
components/com_contact/helpers/association.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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('ContactHelper', JPATH_ADMINISTRATOR . '/components/com_contact/helpers/contact.php');
|
||||
JLoader::register('CategoryHelperAssociation', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/association.php');
|
||||
|
||||
/**
|
||||
* Contact Component Association Helper
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
* @since 3.0
|
||||
*/
|
||||
abstract class ContactHelperAssociation extends CategoryHelperAssociation
|
||||
{
|
||||
/**
|
||||
* Method to get the associations for a given item
|
||||
*
|
||||
* @param integer $id Id of the item
|
||||
* @param string $view Name of the view
|
||||
*
|
||||
* @return array Array of associations for the item
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
|
||||
public static function getAssociations($id = 0, $view = null)
|
||||
{
|
||||
jimport('helper.route', JPATH_COMPONENT_SITE);
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
$view = is_null($view) ? $jinput->get('view') : $view;
|
||||
$id = empty($id) ? $jinput->getInt('id') : $id;
|
||||
|
||||
if ($view == 'contact')
|
||||
{
|
||||
if ($id)
|
||||
{
|
||||
$associations = JLanguageAssociations::getAssociations('com_contact', '#__contact_details', 'com_contact.item', $id);
|
||||
|
||||
$return = array();
|
||||
|
||||
foreach ($associations as $tag => $item)
|
||||
{
|
||||
$return[$tag] = ContactHelperRoute::getContactRoute($item->id, $item->catid, $item->language);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($view == 'category' || $view == 'categories')
|
||||
{
|
||||
return self::getCategoryAssociations($id, 'com_contact');
|
||||
}
|
||||
|
||||
return array();
|
||||
|
||||
}
|
||||
}
|
28
components/com_contact/helpers/category.php
Normal file
28
components/com_contact/helpers/category.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Contact Component Category Tree
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
* @since 1.6
|
||||
*/
|
||||
class ContactCategories extends JCategories
|
||||
{
|
||||
public function __construct($options = array())
|
||||
{
|
||||
$options['table'] = '#__contact_details';
|
||||
$options['extension'] = 'com_contact';
|
||||
$options['statefield'] = 'published';
|
||||
parent::__construct($options);
|
||||
}
|
||||
}
|
85
components/com_contact/helpers/icon.php
Normal file
85
components/com_contact/helpers/icon.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Content Component HTML Helper
|
||||
*
|
||||
* @static
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_content
|
||||
* @since 1.5
|
||||
*/
|
||||
class JHtmlIcon
|
||||
{
|
||||
public static function email($contact, $params, $attribs = array())
|
||||
{
|
||||
require_once JPATH_SITE . '/components/com_mailto/helpers/mailto.php';
|
||||
$uri = JUri::getInstance();
|
||||
$base = $uri->toString(array('scheme', 'host', 'port'));
|
||||
$link = $base . JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catid), false);
|
||||
$url = 'index.php?option=com_mailto&tmpl=component&link='.MailToHelper::addLink($link);
|
||||
|
||||
$status = 'width=400,height=350,menubar=yes,resizable=yes';
|
||||
|
||||
if ($params->get('show_icons'))
|
||||
{
|
||||
$text = JHtml::_('image', 'system/emailButton.png', JText::_('JGLOBAL_EMAIL'), null, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = ' '.JText::_('JGLOBAL_EMAIL');
|
||||
}
|
||||
|
||||
$attribs['title'] = JText::_('JGLOBAL_EMAIL');
|
||||
$attribs['onclick'] = "window.open(this.href,'win2','".$status."'); return false;";
|
||||
|
||||
$output = JHtml::_('link', JRoute::_($url), $text, $attribs);
|
||||
return $output;
|
||||
}
|
||||
|
||||
public static function print_popup($article, $params, $attribs = array())
|
||||
{
|
||||
$url = ContentHelperRoute::getContactRoute($contact->slug, $contact->catid);
|
||||
$url .= '&tmpl=component&print=1&layout=default&page='.@ $request->limitstart;
|
||||
|
||||
$status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';
|
||||
|
||||
// checks template image directory for image, if non found default are loaded
|
||||
if ($params->get('show_icons'))
|
||||
{
|
||||
$text = JHtml::_('image', 'system/printButton.png', JText::_('JGLOBAL_PRINT'), null, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = JText::_('JGLOBAL_ICON_SEP') .' '. JText::_('JGLOBAL_PRINT') .' '. JText::_('JGLOBAL_ICON_SEP');
|
||||
}
|
||||
|
||||
$attribs['title'] = JText::_('JGLOBAL_PRINT');
|
||||
$attribs['onclick'] = "window.open(this.href,'win2','".$status."'); return false;";
|
||||
$attribs['rel'] = 'nofollow';
|
||||
|
||||
return JHtml::_('link', JRoute::_($url), $text, $attribs);
|
||||
}
|
||||
|
||||
public static function print_screen($contact, $params, $attribs = array())
|
||||
{
|
||||
// checks template image directory for image, if non found default are loaded
|
||||
if ($params->get('show_icons'))
|
||||
{
|
||||
$text = JHtml::_('image', 'system/printButton.png', JText::_('JGLOBAL_PRINT'), null, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = JText::_('JGLOBAL_ICON_SEP') .' '. JText::_('JGLOBAL_PRINT') .' '. JText::_('JGLOBAL_ICON_SEP');
|
||||
}
|
||||
return '<a href="#" onclick="window.print();return false;">'.$text.'</a>';
|
||||
}
|
||||
}
|
1
components/com_contact/helpers/index.html
Normal file
1
components/com_contact/helpers/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
224
components/com_contact/helpers/route.php
Normal file
224
components/com_contact/helpers/route.php
Normal file
@ -0,0 +1,224 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Contact Component Route Helper
|
||||
*
|
||||
* @static
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
* @since 1.5
|
||||
*/
|
||||
abstract class ContactHelperRoute
|
||||
{
|
||||
protected static $lookup;
|
||||
/**
|
||||
* @param integer The route of the contact
|
||||
*/
|
||||
public static function getContactRoute($id, $catid, $language = 0)
|
||||
{
|
||||
$needles = array(
|
||||
'contact' => array((int) $id)
|
||||
);
|
||||
//Create the link
|
||||
$link = 'index.php?option=com_contact&view=contact&id='. $id;
|
||||
if ($catid > 1)
|
||||
{
|
||||
$categories = JCategories::getInstance('Contact');
|
||||
$category = $categories->get($catid);
|
||||
if ($category)
|
||||
{
|
||||
$needles['category'] = array_reverse($category->getPath());
|
||||
$needles['categories'] = $needles['category'];
|
||||
$link .= '&catid='.$catid;
|
||||
}
|
||||
}
|
||||
if ($language && $language != "*" && JLanguageMultilang::isEnabled())
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('a.sef AS sef')
|
||||
->select('a.lang_code AS lang_code')
|
||||
->from('#__languages AS a');
|
||||
|
||||
$db->setQuery($query);
|
||||
$langs = $db->loadObjectList();
|
||||
foreach ($langs as $lang)
|
||||
{
|
||||
if ($language == $lang->lang_code)
|
||||
{
|
||||
$link .= '&lang='.$lang->sef;
|
||||
$needles['language'] = $language;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($item = self::_findItem($needles))
|
||||
{
|
||||
$link .= '&Itemid='.$item;
|
||||
}
|
||||
elseif ($item = self::_findItem())
|
||||
{
|
||||
$link .= '&Itemid='.$item;
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
public static function getCategoryRoute($catid, $language = 0)
|
||||
{
|
||||
if ($catid instanceof JCategoryNode)
|
||||
{
|
||||
$id = $catid->id;
|
||||
$category = $catid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$id = (int) $catid;
|
||||
$category = JCategories::getInstance('Contact')->get($id);
|
||||
}
|
||||
|
||||
if ($id < 1)
|
||||
{
|
||||
$link = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
//Create the link
|
||||
$link = 'index.php?option=com_contact&view=category&id='.$id;
|
||||
$needles = array(
|
||||
'category' => array($id)
|
||||
);
|
||||
|
||||
if ($language && $language != "*" && JLanguageMultilang::isEnabled())
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('a.sef AS sef')
|
||||
->select('a.lang_code AS lang_code')
|
||||
->from('#__languages AS a');
|
||||
|
||||
$db->setQuery($query);
|
||||
$langs = $db->loadObjectList();
|
||||
foreach ($langs as $lang)
|
||||
{
|
||||
if ($language == $lang->lang_code)
|
||||
{
|
||||
$link .= '&lang='.$lang->sef;
|
||||
$needles['language'] = $language;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($item = self::_findItem($needles))
|
||||
{
|
||||
$link .= '&Itemid='.$item;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($category)
|
||||
{
|
||||
$catids = array_reverse($category->getPath());
|
||||
$needles = array(
|
||||
'category' => $catids,
|
||||
'categories' => $catids
|
||||
);
|
||||
if ($item = self::_findItem($needles))
|
||||
{
|
||||
$link .= '&Itemid='.$item;
|
||||
}
|
||||
elseif ($item = self::_findItem())
|
||||
{
|
||||
$link .= '&Itemid='.$item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
protected static function _findItem($needles = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$menus = $app->getMenu('site');
|
||||
$language = isset($needles['language']) ? $needles['language'] : '*';
|
||||
|
||||
// Prepare the reverse lookup array.
|
||||
if (!isset(self::$lookup[$language]))
|
||||
{
|
||||
self::$lookup[$language] = array();
|
||||
|
||||
$component = JComponentHelper::getComponent('com_contact');
|
||||
|
||||
$attributes = array('component_id');
|
||||
$values = array($component->id);
|
||||
|
||||
if ($language != '*')
|
||||
{
|
||||
$attributes[] = 'language';
|
||||
$values[] = array($needles['language'], '*');
|
||||
}
|
||||
|
||||
$items = $menus->getItems($attributes, $values);
|
||||
|
||||
foreach ($items as $item)
|
||||
{
|
||||
if (isset($item->query) && isset($item->query['view']))
|
||||
{
|
||||
$view = $item->query['view'];
|
||||
if (!isset(self::$lookup[$language][$view]))
|
||||
{
|
||||
self::$lookup[$language][$view] = array();
|
||||
}
|
||||
if (isset($item->query['id']))
|
||||
{
|
||||
|
||||
// here it will become a bit tricky
|
||||
// language != * can override existing entries
|
||||
// language == * cannot override existing entries
|
||||
if (!isset(self::$lookup[$language][$view][$item->query['id']]) || $item->language != '*')
|
||||
{
|
||||
self::$lookup[$language][$view][$item->query['id']] = $item->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($needles)
|
||||
{
|
||||
foreach ($needles as $view => $ids)
|
||||
{
|
||||
if (isset(self::$lookup[$language][$view]))
|
||||
{
|
||||
foreach ($ids as $id)
|
||||
{
|
||||
if (isset(self::$lookup[$language][$view][(int) $id]))
|
||||
{
|
||||
return self::$lookup[$language][$view][(int) $id];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$active = $menus->getActive();
|
||||
if ($active && ($active->language == '*' || !JLanguageMultilang::isEnabled()))
|
||||
{
|
||||
return $active->id;
|
||||
}
|
||||
|
||||
// if not found, return language specific home link
|
||||
$default = $menus->getDefault($language);
|
||||
return !empty($default->id) ? $default->id : null;
|
||||
}
|
||||
}
|
1
components/com_contact/index.html
Normal file
1
components/com_contact/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
3
components/com_contact/metadata.xml
Normal file
3
components/com_contact/metadata.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
</metadata>
|
124
components/com_contact/models/categories.php
Normal file
124
components/com_contact/models/categories.php
Normal file
@ -0,0 +1,124 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* This models supports retrieving lists of contact categories.
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
* @since 1.6
|
||||
*/
|
||||
class ContactModelCategories extends JModelList
|
||||
{
|
||||
/**
|
||||
* Model context string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $_context = 'com_contact.categories';
|
||||
|
||||
/**
|
||||
* The category context (allows other extensions to derived from this model).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_extension = 'com_contact';
|
||||
|
||||
private $_parent = null;
|
||||
|
||||
private $_items = null;
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$this->setState('filter.extension', $this->_extension);
|
||||
|
||||
// Get the parent id if defined.
|
||||
$parentId = $app->input->getInt('id');
|
||||
$this->setState('filter.parentId', $parentId);
|
||||
|
||||
$params = $app->getParams();
|
||||
$this->setState('params', $params);
|
||||
|
||||
$this->setState('filter.published', 1);
|
||||
$this->setState('filter.access', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
// Compile the store id.
|
||||
$id .= ':'.$this->getState('filter.extension');
|
||||
$id .= ':'.$this->getState('filter.published');
|
||||
$id .= ':'.$this->getState('filter.access');
|
||||
$id .= ':'.$this->getState('filter.parentId');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* redefine the function an add some properties to make the styling more easy
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
if (!count($this->_items))
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$menu = $app->getMenu();
|
||||
$active = $menu->getActive();
|
||||
$params = new JRegistry;
|
||||
if ($active)
|
||||
{
|
||||
$params->loadString($active->params);
|
||||
}
|
||||
$options = array();
|
||||
$options['countItems'] = $params->get('show_cat_items_cat', 1) || !$params->get('show_empty_categories_cat', 0);
|
||||
$categories = JCategories::getInstance('Contact', $options);
|
||||
$this->_parent = $categories->get($this->getState('filter.parentId', 'root'));
|
||||
if (is_object($this->_parent))
|
||||
{
|
||||
$this->_items = $this->_parent->getChildren();
|
||||
} else {
|
||||
$this->_items = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_items;
|
||||
}
|
||||
|
||||
public function getParent()
|
||||
{
|
||||
if (!is_object($this->_parent))
|
||||
{
|
||||
$this->getItems();
|
||||
}
|
||||
return $this->_parent;
|
||||
}
|
||||
}
|
379
components/com_contact/models/category.php
Normal file
379
components/com_contact/models/category.php
Normal file
@ -0,0 +1,379 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
* @since 1.5
|
||||
*/
|
||||
class ContactModelCategory extends JModelList
|
||||
{
|
||||
/**
|
||||
* Category items data
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_item = null;
|
||||
|
||||
protected $_articles = null;
|
||||
|
||||
protected $_siblings = null;
|
||||
|
||||
protected $_children = null;
|
||||
|
||||
protected $_parent = null;
|
||||
|
||||
/**
|
||||
* The category that applies.
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $_category = null;
|
||||
|
||||
/**
|
||||
* The list of other newfeed categories.
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $_categories = null;
|
||||
|
||||
/**
|
||||
* 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',
|
||||
'name', 'a.name',
|
||||
'con_position', 'a.con_position',
|
||||
'suburb', 'a.suburb',
|
||||
'state', 'a.state',
|
||||
'country', 'a.country',
|
||||
'ordering', 'a.ordering',
|
||||
'sortname',
|
||||
'sortname1', 'a.sortname1',
|
||||
'sortname2', 'a.sortname2',
|
||||
'sortname3', 'a.sortname3'
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a list of items.
|
||||
*
|
||||
* @return mixed An array of objects on success, false on failure.
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
// Invoke the parent getItems method to get the main list
|
||||
$items = parent::getItems();
|
||||
|
||||
// Convert the params field into an object, saving original in _params
|
||||
for ($i = 0, $n = count($items); $i < $n; $i++)
|
||||
{
|
||||
$item = & $items[$i];
|
||||
if (!isset($this->_params))
|
||||
{
|
||||
$params = new JRegistry;
|
||||
$params->loadString($item->params);
|
||||
$item->params = $params;
|
||||
}
|
||||
$this->tags = new JHelperTags;
|
||||
$this->tags->getItemTags('com_contact.contact', $item->id);
|
||||
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
|
||||
// Create a new query object.
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select required fields from the categories.
|
||||
//sqlsrv changes
|
||||
$case_when = ' CASE WHEN ';
|
||||
$case_when .= $query->charLength('a.alias', '!=', '0');
|
||||
$case_when .= ' THEN ';
|
||||
$a_id = $query->castAsChar('a.id');
|
||||
$case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
|
||||
$case_when .= ' ELSE ';
|
||||
$case_when .= $a_id . ' END as slug';
|
||||
|
||||
$case_when1 = ' CASE WHEN ';
|
||||
$case_when1 .= $query->charLength('c.alias', '!=', '0');
|
||||
$case_when1 .= ' THEN ';
|
||||
$c_id = $query->castAsChar('c.id');
|
||||
$case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':');
|
||||
$case_when1 .= ' ELSE ';
|
||||
$case_when1 .= $c_id . ' END as catslug';
|
||||
$query->select($this->getState('list.select', 'a.*') . ',' . $case_when . ',' . $case_when1)
|
||||
// TODO: we actually should be doing it but it's wrong this way
|
||||
// . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, '
|
||||
// . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END AS catslug ');
|
||||
->from($db->quoteName('#__contact_details') . ' AS a')
|
||||
->join('LEFT', '#__categories AS c ON c.id = a.catid')
|
||||
->where('a.access IN (' . $groups . ')');
|
||||
|
||||
// Filter by category.
|
||||
if ($categoryId = $this->getState('category.id'))
|
||||
{
|
||||
$query->where('a.catid = ' . (int) $categoryId)
|
||||
->where('c.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Join over the users for the author and modified_by names.
|
||||
$query->select("CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author")
|
||||
->select("ua.email AS author_email")
|
||||
|
||||
->join('LEFT', '#__users AS ua ON ua.id = a.created_by')
|
||||
->join('LEFT', '#__users AS uam ON uam.id = a.modified_by');
|
||||
|
||||
// Filter by state
|
||||
$state = $this->getState('filter.published');
|
||||
|
||||
if (is_numeric($state))
|
||||
{
|
||||
$query->where('a.published = ' . (int) $state);
|
||||
}
|
||||
// Filter by start and end dates.
|
||||
$nullDate = $db->quote($db->getNullDate());
|
||||
$nowDate = $db->quote(JFactory::getDate()->toSql());
|
||||
|
||||
if ($this->getState('filter.publish_date'))
|
||||
{
|
||||
$query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')')
|
||||
->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')');
|
||||
}
|
||||
|
||||
// Filter by search in title
|
||||
$search = $this->getState('list.filter');
|
||||
if (!empty($search))
|
||||
{
|
||||
$search = $db->quote('%' . $db->escape($search, true) . '%');
|
||||
$query->where('(a.name LIKE ' . $search . ')');
|
||||
}
|
||||
|
||||
// Filter by language
|
||||
if ($this->getState('filter.language'))
|
||||
{
|
||||
$query->where('a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
|
||||
}
|
||||
|
||||
// Set sortname ordering if selected
|
||||
if ($this->getState('list.ordering') == 'sortname')
|
||||
{
|
||||
$query->order($db->escape('a.sortname1') . ' ' . $db->escape($this->getState('list.direction', 'ASC')))
|
||||
->order($db->escape('a.sortname2') . ' ' . $db->escape($this->getState('list.direction', 'ASC')))
|
||||
->order($db->escape('a.sortname3') . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->order($db->escape($this->getState('list.ordering', 'a.ordering')) . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$params = JComponentHelper::getParams('com_contact');
|
||||
|
||||
// List state information
|
||||
$format = $app->input->getWord('format');
|
||||
if ($format == 'feed')
|
||||
{
|
||||
$limit = $app->getCfg('feed_limit');
|
||||
}
|
||||
else
|
||||
{
|
||||
$limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'uint');
|
||||
}
|
||||
$this->setState('list.limit', $limit);
|
||||
|
||||
$limitstart = $app->input->get('limitstart', 0, 'uint');
|
||||
$this->setState('list.start', $limitstart);
|
||||
|
||||
// Optional filter text
|
||||
$this->setState('list.filter', $app->input->getString('filter-search'));
|
||||
|
||||
// Get list ordering default from the parameters
|
||||
$menuParams = new JRegistry;
|
||||
if ($menu = $app->getMenu()->getActive())
|
||||
{
|
||||
$menuParams->loadString($menu->params);
|
||||
}
|
||||
$mergedParams = clone $params;
|
||||
$mergedParams->merge($menuParams);
|
||||
|
||||
$orderCol = $app->input->get('filter_order', $mergedParams->get('initial_sort', 'ordering'));
|
||||
if (!in_array($orderCol, $this->filter_fields))
|
||||
{
|
||||
$orderCol = 'ordering';
|
||||
}
|
||||
$this->setState('list.ordering', $orderCol);
|
||||
|
||||
$listOrder = $app->input->get('filter_order_Dir', 'ASC');
|
||||
if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', '')))
|
||||
{
|
||||
$listOrder = 'ASC';
|
||||
}
|
||||
$this->setState('list.direction', $listOrder);
|
||||
|
||||
$id = $app->input->get('id', 0, 'int');
|
||||
$this->setState('category.id', $id);
|
||||
|
||||
$user = JFactory::getUser();
|
||||
if ((!$user->authorise('core.edit.state', 'com_contact')) && (!$user->authorise('core.edit', 'com_contact')))
|
||||
{
|
||||
// limit to published for people who can't edit or edit.state.
|
||||
$this->setState('filter.published', 1);
|
||||
|
||||
// Filter by start and end dates.
|
||||
$this->setState('filter.publish_date', true);
|
||||
}
|
||||
$this->setState('filter.language', JLanguageMultilang::isEnabled());
|
||||
|
||||
// Load the parameters.
|
||||
$this->setState('params', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get category data for the current category
|
||||
*
|
||||
* @param integer An optional ID
|
||||
*
|
||||
* @return object
|
||||
* @since 1.5
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
if (!is_object($this->_item))
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$menu = $app->getMenu();
|
||||
$active = $menu->getActive();
|
||||
$params = new JRegistry;
|
||||
|
||||
if ($active)
|
||||
{
|
||||
$params->loadString($active->params);
|
||||
}
|
||||
|
||||
$options = array();
|
||||
$options['countItems'] = $params->get('show_cat_items', 1) || $params->get('show_empty_categories', 0);
|
||||
$categories = JCategories::getInstance('Contact', $options);
|
||||
$this->_item = $categories->get($this->getState('category.id', 'root'));
|
||||
if (is_object($this->_item))
|
||||
{
|
||||
$this->_children = $this->_item->getChildren();
|
||||
$this->_parent = false;
|
||||
if ($this->_item->getParent())
|
||||
{
|
||||
$this->_parent = $this->_item->getParent();
|
||||
}
|
||||
$this->_rightsibling = $this->_item->getSibling();
|
||||
$this->_leftsibling = $this->_item->getSibling(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_children = false;
|
||||
$this->_parent = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent category.
|
||||
*
|
||||
* @param integer An optional category id. If not supplied, the model state 'category.id' will be used.
|
||||
*
|
||||
* @return mixed An array of categories or false if an error occurs.
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
if (!is_object($this->_item))
|
||||
{
|
||||
$this->getCategory();
|
||||
}
|
||||
return $this->_parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sibling (adjacent) categories.
|
||||
*
|
||||
* @return mixed An array of categories or false if an error occurs.
|
||||
*/
|
||||
function &getLeftSibling()
|
||||
{
|
||||
if (!is_object($this->_item))
|
||||
{
|
||||
$this->getCategory();
|
||||
}
|
||||
return $this->_leftsibling;
|
||||
}
|
||||
|
||||
function &getRightSibling()
|
||||
{
|
||||
if (!is_object($this->_item))
|
||||
{
|
||||
$this->getCategory();
|
||||
}
|
||||
return $this->_rightsibling;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the child categories.
|
||||
*
|
||||
* @param integer An optional category id. If not supplied, the model state 'category.id' will be used.
|
||||
*
|
||||
* @return mixed An array of categories or false if an error occurs.
|
||||
*/
|
||||
function &getChildren()
|
||||
{
|
||||
if (!is_object($this->_item))
|
||||
{
|
||||
$this->getCategory();
|
||||
}
|
||||
return $this->_children;
|
||||
}
|
||||
}
|
414
components/com_contact/models/contact.php
Normal file
414
components/com_contact/models/contact.php
Normal file
@ -0,0 +1,414 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
* @since 1.5
|
||||
*/
|
||||
class ContactModelContact extends JModelForm
|
||||
{
|
||||
/**
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $view_item = 'contact';
|
||||
|
||||
protected $_item = null;
|
||||
|
||||
/**
|
||||
* Model context string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_context = 'com_contact.contact';
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState()
|
||||
{
|
||||
$app = JFactory::getApplication('site');
|
||||
|
||||
// Load state from the request.
|
||||
$pk = $app->input->getInt('id');
|
||||
$this->setState('contact.id', $pk);
|
||||
|
||||
// Load the parameters.
|
||||
$params = $app->getParams();
|
||||
$this->setState('params', $params);
|
||||
|
||||
$user = JFactory::getUser();
|
||||
if ((!$user->authorise('core.edit.state', 'com_contact')) && (!$user->authorise('core.edit', 'com_contact'))){
|
||||
$this->setState('filter.published', 1);
|
||||
$this->setState('filter.archived', 2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the contact form.
|
||||
*
|
||||
* The base form is loaded from XML and then an event is fired
|
||||
*
|
||||
*
|
||||
* @param array $data An optional array of data for the form to interrogate.
|
||||
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||
* @return JForm A JForm object on success, false on failure
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = array(), $loadData = true)
|
||||
{
|
||||
// Get the form.
|
||||
$form = $this->loadForm('com_contact.contact', 'contact', array('control' => 'jform', 'load_data' => true));
|
||||
if (empty($form))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$id = $this->getState('contact.id');
|
||||
$params = $this->getState('params');
|
||||
$contact = $this->_item[$id];
|
||||
$params->merge($contact->params);
|
||||
|
||||
if (!$params->get('show_email_copy', 0)){
|
||||
$form->removeField('contact_email_copy');
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
protected function loadFormData()
|
||||
{
|
||||
$data = (array) JFactory::getApplication()->getUserState('com_contact.contact.data', array());
|
||||
|
||||
$this->preprocessData('com_contact.contact', $data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a contact
|
||||
*
|
||||
* @param integer $pk Id for the contact
|
||||
*
|
||||
* @return mixed Object or null
|
||||
*/
|
||||
public function &getItem($pk = null)
|
||||
{
|
||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('contact.id');
|
||||
|
||||
if ($this->_item === null)
|
||||
{
|
||||
$this->_item = array();
|
||||
}
|
||||
|
||||
if (!isset($this->_item[$pk]))
|
||||
{
|
||||
try
|
||||
{
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
//sqlsrv changes
|
||||
$case_when = ' CASE WHEN ';
|
||||
$case_when .= $query->charLength('a.alias', '!=', '0');
|
||||
$case_when .= ' THEN ';
|
||||
$a_id = $query->castAsChar('a.id');
|
||||
$case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
|
||||
$case_when .= ' ELSE ';
|
||||
$case_when .= $a_id.' END as slug';
|
||||
|
||||
$case_when1 = ' CASE WHEN ';
|
||||
$case_when1 .= $query->charLength('c.alias', '!=', '0');
|
||||
$case_when1 .= ' THEN ';
|
||||
$c_id = $query->castAsChar('c.id');
|
||||
$case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':');
|
||||
$case_when1 .= ' ELSE ';
|
||||
$case_when1 .= $c_id.' END as catslug';
|
||||
|
||||
$query->select($this->getState('item.select', 'a.*') . ','.$case_when.','.$case_when1)
|
||||
->from('#__contact_details AS a')
|
||||
|
||||
// Join on category table.
|
||||
->select('c.title AS category_title, c.alias AS category_alias, c.access AS category_access')
|
||||
->join('LEFT', '#__categories AS c on c.id = a.catid')
|
||||
|
||||
// Join over the categories to get parent category titles
|
||||
->select('parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias')
|
||||
->join('LEFT', '#__categories as parent ON parent.id = c.parent_id')
|
||||
|
||||
->where('a.id = ' . (int) $pk);
|
||||
|
||||
// Filter by start and end dates.
|
||||
$nullDate = $db->quote($db->getNullDate());
|
||||
$nowDate = $db->quote(JFactory::getDate()->toSql());
|
||||
|
||||
// Filter by published state.
|
||||
$published = $this->getState('filter.published');
|
||||
$archived = $this->getState('filter.archived');
|
||||
if (is_numeric($published))
|
||||
{
|
||||
$query->where('(a.published = ' . (int) $published . ' OR a.published =' . (int) $archived . ')')
|
||||
->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')')
|
||||
->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')');
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
$data = $db->loadObject();
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
JError::raiseError(404, JText::_('COM_CONTACT_ERROR_CONTACT_NOT_FOUND'));
|
||||
}
|
||||
|
||||
// Check for published state if filter set.
|
||||
if (((is_numeric($published)) || (is_numeric($archived))) && (($data->published != $published) && ($data->published != $archived)))
|
||||
{
|
||||
JError::raiseError(404, JText::_('COM_CONTACT_ERROR_CONTACT_NOT_FOUND'));
|
||||
}
|
||||
|
||||
// Convert parameter fields to objects.
|
||||
$registry = new JRegistry;
|
||||
$registry->loadString($data->params);
|
||||
$data->params = clone $this->getState('params');
|
||||
$data->params->merge($registry);
|
||||
|
||||
$registry = new JRegistry;
|
||||
$registry->loadString($data->metadata);
|
||||
$data->metadata = $registry;
|
||||
|
||||
$data->tags = new JHelperTags;
|
||||
$data->tags->getItemTags('com_contact.contact', $data->id);
|
||||
|
||||
// Compute access permissions.
|
||||
if ($access = $this->getState('filter.access')) {
|
||||
|
||||
// If the access filter has been set, we already know this user can view.
|
||||
$data->params->set('access-view', true);
|
||||
}
|
||||
else {
|
||||
// If no access filter is set, the layout takes some responsibility for display of limited information.
|
||||
$user = JFactory::getUser();
|
||||
$groups = $user->getAuthorisedViewLevels();
|
||||
|
||||
if ($data->catid == 0 || $data->category_access === null)
|
||||
{
|
||||
$data->params->set('access-view', in_array($data->access, $groups));
|
||||
}
|
||||
else {
|
||||
$data->params->set('access-view', in_array($data->access, $groups) && in_array($data->category_access, $groups));
|
||||
}
|
||||
}
|
||||
$this->_item[$pk] = $data;
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->setError($e);
|
||||
$this->_item[$pk] = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->_item[$pk])
|
||||
{
|
||||
if ($extendedData = $this->getContactQuery($pk))
|
||||
{
|
||||
$this->_item[$pk]->articles = $extendedData->articles;
|
||||
$this->_item[$pk]->profile = $extendedData->profile;
|
||||
}
|
||||
}
|
||||
return $this->_item[$pk];
|
||||
}
|
||||
|
||||
protected function getContactQuery($pk = null)
|
||||
{
|
||||
// TODO: Cache on the fingerprint of the arguments
|
||||
$db = $this->getDbo();
|
||||
$user = JFactory::getUser();
|
||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('contact.id');
|
||||
|
||||
$query = $db->getQuery(true);
|
||||
if ($pk)
|
||||
{
|
||||
//sqlsrv changes
|
||||
$case_when = ' CASE WHEN ';
|
||||
$case_when .= $query->charLength('a.alias', '!=', '0');
|
||||
$case_when .= ' THEN ';
|
||||
$a_id = $query->castAsChar('a.id');
|
||||
$case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
|
||||
$case_when .= ' ELSE ';
|
||||
$case_when .= $a_id.' END as slug';
|
||||
|
||||
$case_when1 = ' CASE WHEN ';
|
||||
$case_when1 .= $query->charLength('cc.alias', '!=', '0');
|
||||
$case_when1 .= ' THEN ';
|
||||
$c_id = $query->castAsChar('cc.id');
|
||||
$case_when1 .= $query->concatenate(array($c_id, 'cc.alias'), ':');
|
||||
$case_when1 .= ' ELSE ';
|
||||
$case_when1 .= $c_id.' END as catslug';
|
||||
$query->select(
|
||||
'a.*, cc.access as category_access, cc.title as category_name, '
|
||||
. $case_when . ',' . $case_when1
|
||||
)
|
||||
|
||||
->from('#__contact_details AS a')
|
||||
|
||||
->join('INNER', '#__categories AS cc on cc.id = a.catid')
|
||||
|
||||
->where('a.id = ' . (int) $pk);
|
||||
$published = $this->getState('filter.published');
|
||||
if (is_numeric($published))
|
||||
{
|
||||
$query->where('a.published IN (1,2)')
|
||||
->where('cc.published IN (1,2)');
|
||||
}
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN ('.$groups.')');
|
||||
|
||||
try
|
||||
{
|
||||
$db->setQuery($query);
|
||||
$result = $db->loadObject();
|
||||
|
||||
if (empty($result))
|
||||
{
|
||||
throw new Exception(JText::_('COM_CONTACT_ERROR_CONTACT_NOT_FOUND'), 404);
|
||||
}
|
||||
|
||||
// If we are showing a contact list, then the contact parameters take priority
|
||||
// So merge the contact parameters with the merged parameters
|
||||
if ($this->getState('params')->get('show_contact_list'))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadString($result->params);
|
||||
$this->getState('params')->merge($registry);
|
||||
}
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->setError($e);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
|
||||
//get the content by the linked user
|
||||
$query = $db->getQuery(true)
|
||||
->select('a.id')
|
||||
->select('a.title')
|
||||
->select('a.state')
|
||||
->select('a.access')
|
||||
->select('a.created');
|
||||
|
||||
// SQL Server changes
|
||||
$case_when = ' CASE WHEN ';
|
||||
$case_when .= $query->charLength('a.alias', '!=', '0');
|
||||
$case_when .= ' THEN ';
|
||||
$a_id = $query->castAsChar('a.id');
|
||||
$case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
|
||||
$case_when .= ' ELSE ';
|
||||
$case_when .= $a_id.' END as slug';
|
||||
$case_when1 = ' CASE WHEN ';
|
||||
$case_when1 .= $query->charLength('c.alias', '!=', '0');
|
||||
$case_when1 .= ' THEN ';
|
||||
$c_id = $query->castAsChar('c.id');
|
||||
$case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':');
|
||||
$case_when1 .= ' ELSE ';
|
||||
$case_when1 .= $c_id.' END as catslug';
|
||||
$query->select($case_when1 . ',' . $case_when)
|
||||
->from('#__content as a')
|
||||
->join('LEFT', '#__categories as c on a.catid=c.id')
|
||||
->where('a.created_by = ' . (int) $result->user_id)
|
||||
->where('a.access IN ('. $groups.')')
|
||||
->order('a.state DESC, a.created DESC');
|
||||
// filter per language if plugin published
|
||||
if (JLanguageMultilang::isEnabled())
|
||||
{
|
||||
$query->where(('a.created_by = ' . (int) $result->user_id) AND ('a.language=' . $db->quote(JFactory::getLanguage()->getTag()) . ' OR a.language=' . $db->quote('*')));
|
||||
}
|
||||
if (is_numeric($published))
|
||||
{
|
||||
$query->where('a.state IN (1,2)');
|
||||
}
|
||||
$db->setQuery($query, 0, 10);
|
||||
$articles = $db->loadObjectList();
|
||||
$result->articles = $articles;
|
||||
|
||||
//get the profile information for the linked user
|
||||
require_once JPATH_ADMINISTRATOR.'/components/com_users/models/user.php';
|
||||
$userModel = JModelLegacy::getInstance('User', 'UsersModel', array('ignore_request' => true));
|
||||
$data = $userModel->getItem((int) $result->user_id);
|
||||
|
||||
JPluginHelper::importPlugin('user');
|
||||
$form = new JForm('com_users.profile');
|
||||
// Get the dispatcher.
|
||||
$dispatcher = JEventDispatcher::getInstance();
|
||||
|
||||
// Trigger the form preparation event.
|
||||
$dispatcher->trigger('onContentPrepareForm', array($form, $data));
|
||||
// Trigger the data preparation event.
|
||||
$dispatcher->trigger('onContentPrepareData', array('com_users.profile', $data));
|
||||
|
||||
// Load the data into the form after the plugins have operated.
|
||||
$form->bind($data);
|
||||
$result->profile = $form;
|
||||
|
||||
$this->contact = $result;
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the hit counter for the contact.
|
||||
*
|
||||
* @param int $pk Optional primary key of the article to increment.
|
||||
*
|
||||
* @return boolean True if successful; false otherwise and internal error set.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function hit($pk = 0)
|
||||
{
|
||||
$input = JFactory::getApplication()->input;
|
||||
$hitcount = $input->getInt('hitcount', 1);
|
||||
|
||||
if ($hitcount)
|
||||
{
|
||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('contact.id');
|
||||
$db = $this->getDbo();
|
||||
|
||||
$db->setQuery(
|
||||
'UPDATE #__contact_details' .
|
||||
' SET hits = hits + 1' .
|
||||
' WHERE id = '.(int) $pk
|
||||
);
|
||||
|
||||
try
|
||||
{
|
||||
$db->execute();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
$this->setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
214
components/com_contact/models/featured.php
Normal file
214
components/com_contact/models/featured.php
Normal file
@ -0,0 +1,214 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*/
|
||||
class ContactModelFeatured extends JModelList
|
||||
{
|
||||
/**
|
||||
* Category items data
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_item = null;
|
||||
|
||||
protected $_articles = null;
|
||||
|
||||
protected $_siblings = null;
|
||||
|
||||
protected $_children = null;
|
||||
|
||||
protected $_parent = null;
|
||||
|
||||
/**
|
||||
* The category that applies.
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $_category = null;
|
||||
|
||||
/**
|
||||
* The list of other cotnact categories.
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $_categories = null;
|
||||
|
||||
/**
|
||||
* 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',
|
||||
'name', 'a.name',
|
||||
'con_position', 'a.con_position',
|
||||
'suburb', 'a.suburb',
|
||||
'state', 'a.state',
|
||||
'country', 'a.country',
|
||||
'ordering', 'a.ordering',
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a list of items.
|
||||
*
|
||||
* @return mixed An array of objects on success, false on failure.
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
// Invoke the parent getItems method to get the main list
|
||||
$items = parent::getItems();
|
||||
|
||||
// Convert the params field into an object, saving original in _params
|
||||
for ($i = 0, $n = count($items); $i < $n; $i++)
|
||||
{
|
||||
$item = & $items[$i];
|
||||
if (!isset($this->_params))
|
||||
{
|
||||
$params = new JRegistry;
|
||||
$params->loadString($item->params);
|
||||
$item->params = $params;
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
|
||||
// Create a new query object.
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select required fields from the categories.
|
||||
$query->select($this->getState('list.select', 'a.*'))
|
||||
->from($db->quoteName('#__contact_details') . ' AS a')
|
||||
->where('a.access IN (' . $groups . ')')
|
||||
->where('a.featured=1')
|
||||
->join('INNER', '#__categories AS c ON c.id = a.catid')
|
||||
->where('c.access IN (' . $groups . ')');
|
||||
// Filter by category.
|
||||
if ($categoryId = $this->getState('category.id'))
|
||||
{
|
||||
$query->where('a.catid = ' . (int) $categoryId);
|
||||
}
|
||||
//sqlsrv change... aliased c.published to cat_published
|
||||
// Join to check for category published state in parent categories up the tree
|
||||
$query->select('c.published as cat_published, CASE WHEN badcats.id is null THEN c.published ELSE 0 END AS parents_published');
|
||||
$subquery = 'SELECT cat.id as id FROM #__categories AS cat JOIN #__categories AS parent ';
|
||||
$subquery .= 'ON cat.lft BETWEEN parent.lft AND parent.rgt ';
|
||||
$subquery .= 'WHERE parent.extension = ' . $db->quote('com_contact');
|
||||
// Find any up-path categories that are not published
|
||||
// If all categories are published, badcats.id will be null, and we just use the contact state
|
||||
$subquery .= ' AND parent.published != 1 GROUP BY cat.id ';
|
||||
// Select state to unpublished if up-path category is unpublished
|
||||
$publishedWhere = 'CASE WHEN badcats.id is null THEN a.published ELSE 0 END';
|
||||
$query->join('LEFT OUTER', '(' . $subquery . ') AS badcats ON badcats.id = c.id');
|
||||
|
||||
// Filter by state
|
||||
$state = $this->getState('filter.published');
|
||||
if (is_numeric($state))
|
||||
{
|
||||
$query->where('a.published = ' . (int) $state);
|
||||
|
||||
// Filter by start and end dates.
|
||||
$nullDate = $db->quote($db->getNullDate());
|
||||
$date = JFactory::getDate();
|
||||
$nowDate = $db->quote($date->toSql());
|
||||
$query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')')
|
||||
->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')')
|
||||
->where($publishedWhere . ' = ' . (int) $state);
|
||||
}
|
||||
|
||||
// Filter by language
|
||||
if ($this->getState('filter.language'))
|
||||
{
|
||||
$query->where('a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
$query->order($db->escape($this->getState('list.ordering', 'a.ordering')) . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$params = JComponentHelper::getParams('com_contact');
|
||||
|
||||
// List state information
|
||||
$limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'uint');
|
||||
$this->setState('list.limit', $limit);
|
||||
|
||||
$limitstart = $app->input->get('limitstart', 0, 'uint');
|
||||
$this->setState('list.start', $limitstart);
|
||||
|
||||
$orderCol = $app->input->get('filter_order', 'ordering');
|
||||
if (!in_array($orderCol, $this->filter_fields))
|
||||
{
|
||||
$orderCol = 'ordering';
|
||||
}
|
||||
$this->setState('list.ordering', $orderCol);
|
||||
|
||||
$listOrder = $app->input->get('filter_order_Dir', 'ASC');
|
||||
if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', '')))
|
||||
{
|
||||
$listOrder = 'ASC';
|
||||
}
|
||||
$this->setState('list.direction', $listOrder);
|
||||
|
||||
$user = JFactory::getUser();
|
||||
if ((!$user->authorise('core.edit.state', 'com_contact')) && (!$user->authorise('core.edit', 'com_contact')))
|
||||
{
|
||||
// Limit to published for people who can't edit or edit.state.
|
||||
$this->setState('filter.published', 1);
|
||||
|
||||
// Filter by start and end dates.
|
||||
$this->setState('filter.publish_date', true);
|
||||
}
|
||||
|
||||
$this->setState('filter.language', JLanguageMultilang::isEnabled());
|
||||
|
||||
// Load the parameters.
|
||||
$this->setState('params', $params);
|
||||
}
|
||||
}
|
63
components/com_contact/models/forms/contact.xml
Normal file
63
components/com_contact/models/forms/contact.xml
Normal file
@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form>
|
||||
<fieldset name="contact" addrulepath="components/com_contact/models/rules" label="COM_CONTACT_FORM_LABEL">
|
||||
<field name="contact_name"
|
||||
type="text"
|
||||
id="contact-name"
|
||||
size="30"
|
||||
description="COM_CONTACT_CONTACT_EMAIL_NAME_DESC"
|
||||
label="COM_CONTACT_CONTACT_EMAIL_NAME_LABEL"
|
||||
filter="string"
|
||||
required="true"
|
||||
/>
|
||||
<field name="contact_email"
|
||||
type="email"
|
||||
id="contact-email"
|
||||
size="30"
|
||||
description="COM_CONTACT_EMAIL_DESC"
|
||||
label="COM_CONTACT_EMAIL_LABEL"
|
||||
filter="string"
|
||||
validate="contactemail"
|
||||
required="true"
|
||||
/>
|
||||
<field name="contact_subject"
|
||||
type="text"
|
||||
id="contact-emailmsg"
|
||||
size="60"
|
||||
description="COM_CONTACT_CONTACT_MESSAGE_SUBJECT_DESC"
|
||||
label="COM_CONTACT_CONTACT_MESSAGE_SUBJECT_LABEL"
|
||||
filter="string"
|
||||
validate="contactemailsubject"
|
||||
required="true"
|
||||
/>
|
||||
<field name="contact_message"
|
||||
type="textarea"
|
||||
cols="50"
|
||||
rows="10"
|
||||
id="contact-message"
|
||||
description="COM_CONTACT_CONTACT_ENTER_MESSAGE_DESC"
|
||||
label="COM_CONTACT_CONTACT_ENTER_MESSAGE_LABEL"
|
||||
filter="htmlsafe"
|
||||
validate="contactemailmessage"
|
||||
required="true"
|
||||
/>
|
||||
<field name="contact_email_copy"
|
||||
type="checkbox"
|
||||
id="contact-email-copy"
|
||||
description="COM_CONTACT_CONTACT_EMAIL_A_COPY_DESC"
|
||||
label="COM_CONTACT_CONTACT_EMAIL_A_COPY_LABEL"
|
||||
default="0"
|
||||
/>
|
||||
|
||||
</fieldset>
|
||||
<fieldset name="captcha">
|
||||
<field
|
||||
name="captcha"
|
||||
type="captcha"
|
||||
label="COM_CONTACT_CAPTCHA_LABEL"
|
||||
description="COM_CONTACT_CAPTCHA_DESC"
|
||||
validate="captcha"
|
||||
namespace="contact"
|
||||
/>
|
||||
</fieldset>
|
||||
</form>
|
565
components/com_contact/models/forms/form.xml
Normal file
565
components/com_contact/models/forms/form.xml
Normal file
@ -0,0 +1,565 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form>
|
||||
<fieldset>
|
||||
<field name="id" type="hidden"
|
||||
default="0"
|
||||
label="COM_CONTACT_ID_LABEL"
|
||||
readonly="true"
|
||||
required="true"
|
||||
size="10"
|
||||
/>
|
||||
|
||||
<field name="name" type="text"
|
||||
description="CONTACT_NAME_DESC"
|
||||
label="CONTACT_NAME_LABEL"
|
||||
required="true"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="alias" type="text"
|
||||
description="JFIELD_ALIAS_DESC"
|
||||
label="JFIELD_ALIAS_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="user_id" type="user"
|
||||
description="CONTACT_LINKED_USER_DESC"
|
||||
label="CONTACT_LINKED_USER_LABEL"
|
||||
/>
|
||||
|
||||
<field name="published" type="list"
|
||||
default="1"
|
||||
description="JFIELD_PUBLISHED_DESC"
|
||||
label="JFIELD_PUBLISHED_LABEL"
|
||||
size="1"
|
||||
>
|
||||
<option value="1">JPUBLISHED</option>
|
||||
<option value="0">JUNPUBLISHED</option>
|
||||
<option value="-1">JARCHIVED</option>
|
||||
<option value="-2">JTRASHED</option>
|
||||
|
||||
</field>
|
||||
|
||||
<field name="catid" type="category"
|
||||
description="JFIELD_CATEGORY_DESC"
|
||||
extension="com_contact"
|
||||
label="JCATEGORY"
|
||||
required="true"
|
||||
/>
|
||||
|
||||
<field name="access" type="accesslevel"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
size="1"
|
||||
/>
|
||||
|
||||
<field name="sortname1" type="text"
|
||||
description="CONTACT_SORTNAME1_DESC"
|
||||
label="CONTACT_SORTNAME1_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="sortname2" type="text"
|
||||
description="CONTACT_SORTNAME3_DESC"
|
||||
label="CONTACT_SORTNAME2_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="sortname3" type="text"
|
||||
description="CONTACT_SORTNAME3_DESC"
|
||||
label="CONTACT_SORTNAME3_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="language" type="text"
|
||||
description="CONTACT_LANGUAGE_DESC"
|
||||
label="CONTACT_LANGUAGE_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="con_position" type="text"
|
||||
description="CONTACT_INFORMATION_POSITION_DESC"
|
||||
label="CONTACT_INFORMATION_POSITION_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="email_to" type="email"
|
||||
description="CONTACT_INFORMATION_EMAIL_DESC"
|
||||
label="CONTACT_INFORMATION_EMAIL_LABEL"
|
||||
size="30" validate="email" filter="string"
|
||||
/>
|
||||
|
||||
<field name="address" type="textarea"
|
||||
cols="30"
|
||||
description="CONTACT_INFORMATION_ADDRESS_DESC"
|
||||
label="CONTACT_INFORMATION_ADDRESS_LABEL"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field name="suburb" type="text"
|
||||
description="CONTACT_INFORMATION_SUBURB_DESC"
|
||||
label="CONTACT_INFORMATION_SUBURB_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="state" type="text"
|
||||
description="CONTACT_INFORMATION_STATE_DESC"
|
||||
label="CONTACT_INFORMATION_STATE_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="postcode" type="text"
|
||||
description="CONTACT_INFORMATION_POSTCODE_DESC"
|
||||
label="CONTACT_INFORMATION_POSTCODE_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="country" type="text"
|
||||
description="CONTACT_INFORMATION_COUNTRY_DESC"
|
||||
label="CONTACT_INFORMATION_COUNTRY_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="telephone" type="text"
|
||||
description="CONTACT_INFORMATION_TELEPHONE_DESC"
|
||||
label="CONTACT_INFORMATION_TELEPHONE_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="mobile" type="text"
|
||||
description="CONTACT_INFORMATION_MOBILE_DESC"
|
||||
label="CONTACT_INFORMATION_MOBILE_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="webpage" type="text"
|
||||
description="CONTACT_INFORMATION_WEBPAGE_DESC"
|
||||
label="CONTACT_INFORMATION_WEBPAGE_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="misc" type="editor"
|
||||
buttons="true"
|
||||
hide="pagebreak,readmore"
|
||||
description="CONTACT_INFORMATION_MISC_DESC"
|
||||
filter="safehtml"
|
||||
label="CONTACT_INFORMATION_MISC_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="checked_out" type="hidden"
|
||||
filter="unset"
|
||||
/>
|
||||
|
||||
<field name="checked_out_time" type="hidden"
|
||||
filter="unset"
|
||||
/>
|
||||
|
||||
<field name="ordering" type="ordering"
|
||||
description="JFIELD_ORDERING_DESC"
|
||||
label="JFIELD_ORDERING_LABEL"
|
||||
/>
|
||||
|
||||
<field name="metakey" type="textarea"
|
||||
cols="30"
|
||||
description="JFIELD_META_KEYWORDS_DESC"
|
||||
label="JFIELD_META_KEYWORDS_LABEL"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field name="metadesc" type="textarea"
|
||||
cols="30"
|
||||
description="JFIELD_META_DESCRIPTION_DESC"
|
||||
label="JFIELD_META_DESCRIPTION_LABEL"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field name="language" type="contentlanguage"
|
||||
description="JFIELD_CONTACT_LANGUAGE_DESC"
|
||||
label="JFIELD_LANGUAGE_LABEL"
|
||||
>
|
||||
<option value="">JALL</option>
|
||||
</field>
|
||||
|
||||
|
||||
<field name="contact_icons" type="list"
|
||||
default="0"
|
||||
description="PARAMCONTACTICONS"
|
||||
label="Icons/text"
|
||||
>
|
||||
<option value="0">CONTACT_ICONS_OPTIONS_NONE</option>
|
||||
<option value="1">CONTACT_ICONS_OPTIONS_TEXT</option>
|
||||
<option value="2">CONTACT_ICONS_OPTIONS_TEXT</option>
|
||||
</field>
|
||||
|
||||
<field name="icon_address" type="imagelist"
|
||||
description="CONTACT_ICONS_ADDRESS_DESC"
|
||||
directory="/images"
|
||||
hide_none="1"
|
||||
label="CONTACT_ICONS_ADDRESS_LABEL"
|
||||
/>
|
||||
|
||||
<field name="icon_email" type="imagelist"
|
||||
description="CONTACT_ICONS_EMAIL_DESC"
|
||||
directory="/images"
|
||||
hide_none="1"
|
||||
label="CONTACT_ICONS_EMAIL_LABEL"
|
||||
/>
|
||||
|
||||
<field name="icon_telephone" type="imagelist"
|
||||
description="CONTACT_ICONS_TELEPHONE_DESC"
|
||||
directory="/images"
|
||||
hide_none="1"
|
||||
label="CONTACT_ICONS_TELEPHONE_LABEL"
|
||||
/>
|
||||
|
||||
<field name="icon_mobile" type="imagelist"
|
||||
description="CONTACT_ICONS_MOBILE_DESC"
|
||||
directory="/images"
|
||||
hide_none="1"
|
||||
label="CONTACT_ICONS_MOBILE_LABEL"
|
||||
/>
|
||||
|
||||
<field name="icon_fax" type="imagelist"
|
||||
description="CONTACT_ICONS_FAX_DESC"
|
||||
directory="/images"
|
||||
hide_none="1"
|
||||
label="CONTACT_ICONS_FAX_LABEL"
|
||||
/>
|
||||
|
||||
<field name="icon_misc" type="imagelist"
|
||||
description="CONTACT_ICONS_MISC_DESC"
|
||||
directory="/images"
|
||||
hide_none="1"
|
||||
label="CONTACT_ICONS_MISC_LABEL"
|
||||
/>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fields name="metadata">
|
||||
<fieldset name="metadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS">
|
||||
|
||||
<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>
|
||||
|
||||
<field name="rights" type="text"
|
||||
description="JFIELD_METADATA_RIGHTS_DESC"
|
||||
label="JFIELD_METADATA_RIGHTS_LABEL"
|
||||
size="20"
|
||||
/>
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
|
||||
<fields name="params">
|
||||
<fieldset name="options" label="CONTACT_PARAMETERS">
|
||||
|
||||
<field name="show_name" type="list"
|
||||
description="CONTACT_PARAMS_NAME_DESC"
|
||||
label="CONTACT_PARAMS_NAME_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_position" type="list"
|
||||
description="CONTACT_PARAMS_NAME_DESC"
|
||||
label="CONTACT_PARAMS_CONTACT_POSITION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_email" type="list"
|
||||
description="CONTACT_PARAMS_NAME_DESC"
|
||||
label="CONTACT_PARAMS_CONTACT_POSITION_E_MAIL_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_street_address" type="list"
|
||||
description="CONTACT_PARAMS_NAME_DESC"
|
||||
label="CONTACT_PARAMS_STREET_ADDRESS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_suburb" type="list"
|
||||
description="CONTACT_PARAMS_NAME_DESC"
|
||||
label="CONTACT_PARAMS_TOWN_SUBURB_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_state" type="list"
|
||||
description="CONTACT_PARAMS_NAME_DESC"
|
||||
label="CONTACT_PARAMS_STATE_COUNTY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_postcode" type="list"
|
||||
description="CONTACT_PARAMS_NAME_DESC"
|
||||
label="CONTACT_PARAMS_POST_ZIP_CODE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_country" type="list"
|
||||
description="CONTACT_PARAMS_NAME_DESC"
|
||||
label="CONTACT_PARAMS_COUNTRY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_telephone" type="list"
|
||||
description="CONTACT_PARAMS_NAME_DESC"
|
||||
label="CONTACT_PARAMS_TELEPHONE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_mobile" type="list"
|
||||
description="CONTACT_PARAMS_NAME_DESC"
|
||||
label="CONTACT_PARAMS_MOBILE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_fax" type="list"
|
||||
description="CONTACT_PARAMS_NAME_DESC"
|
||||
label="CONTACT_PARAMS_FAX_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_webpage" type="list"
|
||||
description="CONTACT_PARAMS_NAME_DESC"
|
||||
label="CONTACT_PARAMS_WEBPAGE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_misc" type="list"
|
||||
description="CONTACT_PARAMS_NAME_DESC"
|
||||
label="CONTACT_PARAMS_MISC_INFO_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_image" type="list"
|
||||
description="CONTACT_PARAMS_NAME_DESC"
|
||||
label="CONTACT_PARAMS_IMAGE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="allow_vcard" type="list"
|
||||
description="CONTACT_PARAMS_VCARD_LABEL"
|
||||
label="CONTACT_PARAMS_VCARD_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_articles" type="list"
|
||||
description="CONTACT_SHOW_ARTICLES_DESC"
|
||||
label="CONTACT_SHOW_ARTICLES_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_profile" type="list"
|
||||
label="CONTACT_PROFILE_SHOW_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_links" type="list"
|
||||
description="CONTACT_SHOW_LINKS_DESC"
|
||||
label="CONTACT_SHOW_LINKS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="linka_name" type="text"
|
||||
description="CONTACT_LINKA_NAME_DESC"
|
||||
label="CONTACT_LINKA_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linka" type="text"
|
||||
description="CONTACT_LINKA_DESC"
|
||||
label="CONTACT_LINKA_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linkb_name" type="text"
|
||||
description="CONTACT_LINKB_NAME_DESC"
|
||||
label="CONTACT_LINKB_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linkb" type="text"
|
||||
description="CONTACT_LINKB_DESC"
|
||||
label="CONTACT_LINKB_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linkc_name" type="text"
|
||||
description="CONTACT_LINKC_NAME_DESC"
|
||||
label="CONTACT_LINKC_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linkc" type="text"
|
||||
description="CONTACT_LINKC_DESC"
|
||||
label="CONTACT_LINKC_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linkd_name" type="text"
|
||||
description="CONTACT_LINKD_NAME_DESC"
|
||||
label="CONTACT_LINKD_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linkd" type="text"
|
||||
description="CONTACT_LINKD_DESC"
|
||||
label="CONTACT_LINKD_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linke_name" type="text"
|
||||
description="CONTACT_LINKE_NAME_DESC"
|
||||
label="CONTACT_LINKE_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linke" type="text"
|
||||
description="CONTACT_LINKE_DESC"
|
||||
label="CONTACT_LINKE_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
|
||||
<fields name="email_form">
|
||||
<fieldset name="email_form" label="CONTACT_EMAIL_FORM_LABEL">
|
||||
|
||||
<field name="show_email_form" type="list"
|
||||
description="CONTACT_EMAIL_SHOW_FORM_DESC"
|
||||
label="CONTACT_EMAIL_SHOW_FORM_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="email_description" type="text"
|
||||
description="CONTACT_EMAIL_DESCRIPTION_TEXT_DESC"
|
||||
label="CONTACT_EMAIL_DESCRIPTION_TEXT_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="show_email_copy" type="list"
|
||||
description="CONTACT_EMAIL_EMAIL_COPY_DESC"
|
||||
label="CONTACT_EMAIL_EMAIL_COPY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="banned_email" type="textarea"
|
||||
cols="30"
|
||||
description="CONTACT_EMAIL_BANNED_EMAIL_DESC"
|
||||
label="CONTACT_EMAIL_BANNED_EMAIL_LABEL"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field name="banned_subject" type="textarea"
|
||||
cols="30"
|
||||
description="Contact_Email_BANNED_SUBJECT_DESC"
|
||||
label="Contact_Email_BANNED_SUBJECT_LABEL"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field name="banned_text" type="textarea"
|
||||
cols="30"
|
||||
description="CONTACT_EMAIL_BANNED_TEXT_DESC"
|
||||
label="CONTACT_EMAIL_BANNED_TEXT_LABEL"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field name="validate_session" type="list"
|
||||
description="CONTACT_CONFIG_SESSION_CHECK_DESC"
|
||||
label="CONTACT_CONFIG_SESSION_CHECK_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="custom_reply" type="list"
|
||||
description="CONTACT_CONFIG_CUSTOM_REPLY_DESC"
|
||||
label="CONTACT_CONFIG_CUSTOM_REPLY"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="redirect" type="text"
|
||||
description="COM_CONTACT_FIELD_CONFIG_REDIRECT_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_REDIRECT_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
|
1
components/com_contact/models/forms/index.html
Normal file
1
components/com_contact/models/forms/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
1
components/com_contact/models/index.html
Normal file
1
components/com_contact/models/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
51
components/com_contact/models/rules/contactemail.php
Normal file
51
components/com_contact/models/rules/contactemail.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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;
|
||||
|
||||
JFormHelper::loadRuleClass('email');
|
||||
|
||||
/**
|
||||
* JFormRule for com_contact to make sure the E-Mail adress is not blocked.
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*/
|
||||
class JFormRuleContactEmail extends JFormRuleEmail
|
||||
{
|
||||
/**
|
||||
* Method to test for a valid color in hexadecimal.
|
||||
*
|
||||
* @param SimpleXMLElement &$element The SimpleXMLElement object representing the <field /> tag for the form field object.
|
||||
* @param mixed $value The form field value to validate.
|
||||
* @param string $group The field name group control value. This acts as as an array container for the field.
|
||||
* For example if the field has name="foo" and the group value is set to "bar" then the
|
||||
* full field name would end up being "bar[foo]".
|
||||
* @param object &$input An optional JRegistry object with the entire data set to validate against the entire form.
|
||||
* @param object &$form The form object for which the field is being tested.
|
||||
*
|
||||
* @return boolean True if the value is valid, false otherwise.
|
||||
*/
|
||||
public function test(& $element, $value, $group = null, &$input = null, &$form = null)
|
||||
{
|
||||
if (!parent::test($element, $value, $group, $input, $form)){
|
||||
return false;
|
||||
}
|
||||
|
||||
$params = JComponentHelper::getParams('com_contact');
|
||||
$banned = $params->get('banned_email');
|
||||
|
||||
foreach (explode(';', $banned) as $item) {
|
||||
if (JString::stristr($item, $value) !== false)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
45
components/com_contact/models/rules/contactemailmessage.php
Normal file
45
components/com_contact/models/rules/contactemailmessage.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* JFormRule for com_contact to make sure the message body contains no banned word.
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*/
|
||||
class JFormRuleContactEmailMessage extends JFormRule
|
||||
{
|
||||
/**
|
||||
* Method to test for a valid color in hexadecimal.
|
||||
*
|
||||
* @param SimpleXMLElement &$element The SimpleXMLElement object representing the <field /> tag for the form field object.
|
||||
* @param mixed $value The form field value to validate.
|
||||
* @param string $group The field name group control value. This acts as as an array container for the field.
|
||||
* For example if the field has name="foo" and the group value is set to "bar" then the
|
||||
* full field name would end up being "bar[foo]".
|
||||
* @param object &$input An optional JRegistry object with the entire data set to validate against the entire form.
|
||||
* @param object &$form The form object for which the field is being tested.
|
||||
*
|
||||
* @return boolean True if the value is valid, false otherwise.
|
||||
*/
|
||||
public function test(&$element, $value, $group = null, &$input = null, &$form = null)
|
||||
{
|
||||
$params = JComponentHelper::getParams('com_contact');
|
||||
$banned = $params->get('banned_text');
|
||||
|
||||
foreach (explode(';', $banned) as $item) {
|
||||
if (JString::stristr($item, $value) !== false)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
45
components/com_contact/models/rules/contactemailsubject.php
Normal file
45
components/com_contact/models/rules/contactemailsubject.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* JFormRule for com_contact to make sure the subject contains no banned word.
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*/
|
||||
class JFormRuleContactEmailSubject extends JFormRule
|
||||
{
|
||||
/**
|
||||
* Method to test for a valid color in hexadecimal.
|
||||
*
|
||||
* @param SimpleXMLElement &$element The SimpleXMLElement object representing the <field /> tag for the form field object.
|
||||
* @param mixed $value The form field value to validate.
|
||||
* @param string $group The field name group control value. This acts as as an array container for the field.
|
||||
* For example if the field has name="foo" and the group value is set to "bar" then the
|
||||
* full field name would end up being "bar[foo]".
|
||||
* @param object &$input An optional JRegistry object with the entire data set to validate against the entire form.
|
||||
* @param object &$form The form object for which the field is being tested.
|
||||
*
|
||||
* @return boolean True if the value is valid, false otherwise.
|
||||
*/
|
||||
public function test(&$element, $value, $group = null, &$input = null, &$form = null)
|
||||
{
|
||||
$params = JComponentHelper::getParams('com_contact');
|
||||
$banned = $params->get('banned_subject');
|
||||
|
||||
foreach (explode(';', $banned) as $item) {
|
||||
if (JString::stristr($item, $value) !== false)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
1
components/com_contact/models/rules/index.html
Normal file
1
components/com_contact/models/rules/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
209
components/com_contact/router.php
Normal file
209
components/com_contact/router.php
Normal file
@ -0,0 +1,209 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Build the route for the com_contact component
|
||||
*
|
||||
* @param array &$query An array of URL arguments
|
||||
*
|
||||
* @return array The URL arguments to use to assemble the subsequent URL.
|
||||
*/
|
||||
function ContactBuildRoute(&$query)
|
||||
{
|
||||
$segments = array();
|
||||
|
||||
// get a menu item based on Itemid or currently active
|
||||
$app = JFactory::getApplication();
|
||||
$menu = $app->getMenu();
|
||||
$params = JComponentHelper::getParams('com_contact');
|
||||
$advanced = $params->get('sef_advanced_link', 0);
|
||||
|
||||
if (empty($query['Itemid']))
|
||||
{
|
||||
$menuItem = $menu->getActive();
|
||||
}
|
||||
else
|
||||
{
|
||||
$menuItem = $menu->getItem($query['Itemid']);
|
||||
}
|
||||
$mView = (empty($menuItem->query['view'])) ? null : $menuItem->query['view'];
|
||||
$mId = (empty($menuItem->query['id'])) ? null : $menuItem->query['id'];
|
||||
|
||||
if (isset($query['view']))
|
||||
{
|
||||
$view = $query['view'];
|
||||
if (empty($query['Itemid']) || empty($menuItem) || $menuItem->component != 'com_contact')
|
||||
{
|
||||
$segments[] = $query['view'];
|
||||
}
|
||||
unset($query['view']);
|
||||
}
|
||||
|
||||
// are we dealing with a contact that is attached to a menu item?
|
||||
if (isset($view) && ($mView == $view) and (isset($query['id'])) and ($mId == (int) $query['id']))
|
||||
{
|
||||
unset($query['view']);
|
||||
unset($query['catid']);
|
||||
unset($query['id']);
|
||||
return $segments;
|
||||
}
|
||||
|
||||
if (isset($view) and ($view == 'category' or $view == 'contact'))
|
||||
{
|
||||
if ($mId != (int) $query['id'] || $mView != $view)
|
||||
{
|
||||
if ($view == 'contact' && isset($query['catid']))
|
||||
{
|
||||
$catid = $query['catid'];
|
||||
}
|
||||
elseif (isset($query['id']))
|
||||
{
|
||||
$catid = $query['id'];
|
||||
}
|
||||
$menuCatid = $mId;
|
||||
$categories = JCategories::getInstance('Contact');
|
||||
$category = $categories->get($catid);
|
||||
if ($category)
|
||||
{
|
||||
//TODO Throw error that the category either not exists or is unpublished
|
||||
$path = array_reverse($category->getPath());
|
||||
|
||||
$array = array();
|
||||
foreach ($path as $id)
|
||||
{
|
||||
if ((int) $id == (int) $menuCatid)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if ($advanced)
|
||||
{
|
||||
list($tmp, $id) = explode(':', $id, 2);
|
||||
}
|
||||
$array[] = $id;
|
||||
}
|
||||
$segments = array_merge($segments, array_reverse($array));
|
||||
}
|
||||
if ($view == 'contact')
|
||||
{
|
||||
if ($advanced)
|
||||
{
|
||||
list($tmp, $id) = explode(':', $query['id'], 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
$id = $query['id'];
|
||||
}
|
||||
$segments[] = $id;
|
||||
}
|
||||
}
|
||||
unset($query['id']);
|
||||
unset($query['catid']);
|
||||
}
|
||||
|
||||
if (isset($query['layout']))
|
||||
{
|
||||
if (!empty($query['Itemid']) && isset($menuItem->query['layout']))
|
||||
{
|
||||
if ($query['layout'] == $menuItem->query['layout'])
|
||||
{
|
||||
|
||||
unset($query['layout']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($query['layout'] == 'default')
|
||||
{
|
||||
unset($query['layout']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $segments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the segments of a URL.
|
||||
*
|
||||
* @param array $segments The segments of the URL to parse.
|
||||
*
|
||||
* @return array The URL attributes to be used by the application.
|
||||
*/
|
||||
function ContactParseRoute($segments)
|
||||
{
|
||||
$vars = array();
|
||||
|
||||
//Get the active menu item.
|
||||
$app = JFactory::getApplication();
|
||||
$menu = $app->getMenu();
|
||||
$item = $menu->getActive();
|
||||
$params = JComponentHelper::getParams('com_contact');
|
||||
$advanced = $params->get('sef_advanced_link', 0);
|
||||
|
||||
// Count route segments
|
||||
$count = count($segments);
|
||||
|
||||
// Standard routing for newsfeeds.
|
||||
if (!isset($item))
|
||||
{
|
||||
$vars['view'] = $segments[0];
|
||||
$vars['id'] = $segments[$count - 1];
|
||||
return $vars;
|
||||
}
|
||||
|
||||
// From the categories view, we can only jump to a category.
|
||||
$id = (isset($item->query['id']) && $item->query['id'] > 1) ? $item->query['id'] : 'root';
|
||||
|
||||
$contactCategory = JCategories::getInstance('Contact')->get($id);
|
||||
|
||||
$categories = ($contactCategory) ? $contactCategory->getChildren() : array();
|
||||
$vars['catid'] = $id;
|
||||
$vars['id'] = $id;
|
||||
$found = 0;
|
||||
foreach ($segments as $segment)
|
||||
{
|
||||
$segment = $advanced ? str_replace(':', '-', $segment) : $segment;
|
||||
foreach ($categories as $category)
|
||||
{
|
||||
if ($category->slug == $segment || $category->alias == $segment)
|
||||
{
|
||||
$vars['id'] = $category->id;
|
||||
$vars['catid'] = $category->id;
|
||||
$vars['view'] = 'category';
|
||||
$categories = $category->getChildren();
|
||||
$found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($found == 0)
|
||||
{
|
||||
if ($advanced)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('id'))
|
||||
->from('#__contact_details')
|
||||
->where($db->quoteName('catid') . ' = ' . (int) $vars['catid'])
|
||||
->where($db->quoteName('alias') . ' = ' . $db->quote($db->quote($segment)));
|
||||
$db->setQuery($query);
|
||||
$nid = $db->loadResult();
|
||||
}
|
||||
else
|
||||
{
|
||||
$nid = $segment;
|
||||
}
|
||||
$vars['id'] = $nid;
|
||||
$vars['view'] = 'contact';
|
||||
}
|
||||
$found = 0;
|
||||
}
|
||||
return $vars;
|
||||
}
|
1
components/com_contact/views/categories/index.html
Normal file
1
components/com_contact/views/categories/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
19
components/com_contact/views/categories/tmpl/default.php
Normal file
19
components/com_contact/views/categories/tmpl/default.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
|
||||
JHtml::_('behavior.caption');
|
||||
|
||||
echo JLayoutHelper::render('joomla.content.categories_default', $this);
|
||||
|
||||
echo $this->loadTemplate('items');
|
||||
?>
|
||||
</div>
|
616
components/com_contact/views/categories/tmpl/default.xml
Normal file
616
components/com_contact/views/categories/tmpl/default.xml
Normal file
@ -0,0 +1,616 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_CONTACT_CATEGORIES_VIEW_DEFAULT_TITLE" option="COM_CONTACT_CATEGORIES_VIEW_DEFAULT_OPTION">
|
||||
<help
|
||||
key = "JHELP_MENUS_MENU_ITEM_CONTACT_CATEGORIES"
|
||||
/>
|
||||
<message>
|
||||
<![CDATA[COM_CONTACT_CATEGORIES_VIEW_DEFAULT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
|
||||
<!-- Add fields to the request variables for the layout. -->
|
||||
<fields name="request">
|
||||
<fieldset name="request"
|
||||
>
|
||||
<field name="id" type="category"
|
||||
description="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_DESC"
|
||||
extension="com_contact"
|
||||
label="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_LABEL"
|
||||
show_root="true"
|
||||
required="true"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
<fields name="params">
|
||||
<fieldset name="basic" label="JGLOBAL_CATEGORIES_OPTIONS">
|
||||
<field name="show_base_description" type="list"
|
||||
label="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_LABEL"
|
||||
description="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
<field name="categories_description" type="textarea"
|
||||
description="JGLOBAL_FIELD_CATEGORIES_DESC_DESC"
|
||||
label="JGLOBAL_FIELD_CATEGORIES_DESC_LABEL"
|
||||
cols="25"
|
||||
rows="5"
|
||||
/>
|
||||
<field name="maxLevelcat" type="list"
|
||||
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
|
||||
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="-1">JALL</option>
|
||||
<option value="1">J1</option>
|
||||
<option value="2">J2</option>
|
||||
<option value="3">J3</option>
|
||||
<option value="4">J4</option>
|
||||
<option value="5">J5</option>
|
||||
</field>
|
||||
|
||||
<field name="show_empty_categories_cat" type="list"
|
||||
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
|
||||
description="COM_CONTACT_SHOW_EMPTY_CATEGORIES_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_subcat_desc_cat" type="list"
|
||||
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
|
||||
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_cat_items_cat" type="list"
|
||||
label="COM_CONTACT_FIELD_SHOW_CAT_ITEMS_LABEL"
|
||||
description="COM_CONTACT_FIELD_SHOW_CAT_ITEMS_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
<fieldset name="category" label="JGLOBAL_CATEGORY_OPTIONS">
|
||||
<field name="spacer1" type="spacer" class="text"
|
||||
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
|
||||
/>
|
||||
|
||||
|
||||
<field name="show_category_title" type="list"
|
||||
label="JGLOBAL_SHOW_CATEGORY_TITLE"
|
||||
description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_description" type="list"
|
||||
description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
|
||||
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_description_image" type="list"
|
||||
description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
|
||||
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="maxLevel" type="list"
|
||||
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
|
||||
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="-1">JALL</option>
|
||||
<option value="0">JNONE</option>
|
||||
<option value="1">J1</option>
|
||||
<option value="2">J2</option>
|
||||
<option value="3">J3</option>
|
||||
<option value="4">J4</option>
|
||||
<option value="5">J5</option>
|
||||
</field>
|
||||
|
||||
<field name="show_empty_categories" type="list"
|
||||
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
|
||||
description="COM_CONTACT_SHOW_EMPTY_CATEGORIES_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
|
||||
<field name="show_subcat_desc" type="list"
|
||||
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
|
||||
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_cat_items" type="list"
|
||||
label="COM_CONTACT_FIELD_SHOW_CAT_ITEMS_LABEL"
|
||||
description="COM_CONTACT_FIELD_SHOW_CAT_ITEMS_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="advanced" label="JGLOBAL_LIST_LAYOUT_OPTIONS">
|
||||
|
||||
<field name="spacer2" type="spacer" class="text"
|
||||
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filter_field"
|
||||
type="list"
|
||||
default=""
|
||||
description="JGLOBAL_FILTER_FIELD_DESC"
|
||||
label="JGLOBAL_FILTER_FIELD_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="hide">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_pagination_limit" type="list"
|
||||
description="JGLOBAL_DISPLAY_SELECT_DESC"
|
||||
label="JGLOBAL_DISPLAY_SELECT_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_headings" type="list"
|
||||
description="JGLOBAL_SHOW_HEADINGS_DESC"
|
||||
label="JGLOBAL_SHOW_HEADINGS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_position_headings" type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_POSITION_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_POSITION_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_email_headings" type="list"
|
||||
label="JGLOBAL_EMAIL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_EMAIL_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_telephone_headings"
|
||||
type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_PHONE_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_PHONE_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_mobile_headings"
|
||||
type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_MOBILE_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_MOBILE_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_fax_headings"
|
||||
type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_FAX_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_FAX_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_suburb_headings" type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_SUBURB_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_SUBURB_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_state_headings"
|
||||
type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_STATE_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_STATE_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_country_headings"
|
||||
type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_COUNTRY_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_COUNTRY_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_pagination" type="list"
|
||||
description="JGLOBAL_PAGINATION_DESC"
|
||||
label="JGLOBAL_PAGINATION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">JGLOBAL_AUTO</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_pagination_results"
|
||||
type="list"
|
||||
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
|
||||
description="JGLOBAL_PAGINATION_RESULTS_DESC">
|
||||
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="contact" label="COM_CONTACT_BASIC_OPTIONS_FIELDSET_LABEL">
|
||||
|
||||
<field name="presentation_style"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PRESENTATION_DESC"
|
||||
label="COM_CONTACT_FIELD_PRESENTATION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="sliders">COM_CONTACT_FIELD_VALUE_SLIDERS</option>
|
||||
<option value="tabs">COM_CONTACT_FIELD_VALUE_TABS</option>
|
||||
<option value="plain">COM_CONTACT_FIELD_VALUE_PLAIN</option>
|
||||
</field>
|
||||
<field name="show_contact_category"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_CONTACT_SHOW_CATEGORY_DESC"
|
||||
label="COM_CONTACT_FIELD_CONTACT_SHOW_CATEGORY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="hide">JHIDE</option>
|
||||
<option value="show_no_link">COM_CONTACT_FIELD_VALUE_NO_LINK</option>
|
||||
<option value="show_with_link">COM_CONTACT_FIELD_VALUE_WITH_LINK</option>
|
||||
</field>
|
||||
|
||||
<field name="show_contact_list"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_CONTACT_SHOW_LIST_DESC"
|
||||
label="COM_CONTACT_FIELD_CONTACT_SHOW_LIST_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_name"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_NAME_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_position"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
|
||||
</field>
|
||||
|
||||
<field name="show_email"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_CONTACT_E_MAIL_DESC"
|
||||
label="JGLOBAL_EMAIL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_street_address"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_suburb"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_state"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_postcode"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_country"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_COUNTRY_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_COUNTRY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_telephone"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_TELEPHONE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_TELEPHONE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_mobile"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_MOBILE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_MOBILE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_fax"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_FAX_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_FAX_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_webpage"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_WEBPAGE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_WEBPAGE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_misc"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_MISC_INFO_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_MISC_INFO_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_image"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_IMAGE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_IMAGE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="allow_vcard"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_VCARD_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_VCARD_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_articles"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_ARTICLES_SHOW_DESC"
|
||||
label="COM_CONTACT_FIELD_ARTICLES_SHOW_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_links"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_SHOW_LINKS_DESC"
|
||||
label="COM_CONTACT_FIELD_SHOW_LINKS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="linka_name"
|
||||
type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKA_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linkb_name"
|
||||
type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKB_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linkc_name"
|
||||
type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKC_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linkd_name"
|
||||
type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKD_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linke_name"
|
||||
type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKE_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
</fieldset>
|
||||
<!-- Form options. -->
|
||||
<fieldset name="Contact_Form" label="COM_CONTACT_MAIL_FIELDSET_LABEL"
|
||||
>
|
||||
|
||||
<field name="show_email_form" type="list"
|
||||
description="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_DESC"
|
||||
label="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_email_copy" type="list"
|
||||
description="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_DESC"
|
||||
label="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="banned_email" type="textarea"
|
||||
cols="30"
|
||||
description="COM_CONTACT_FIELD_CONFIG_BANNED_EMAIL_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_BANNED_EMAIL_LABEL"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field name="banned_subject" type="textarea"
|
||||
cols="30"
|
||||
description="COM_CONTACT_FIELD_CONFIG_BANNED_SUBJECT_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_BANNED_SUBJECT_LABEL"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field name="banned_text" type="textarea"
|
||||
cols="30"
|
||||
description="COM_CONTACT_FIELD_CONFIG_BANNED_TEXT_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_BANNED_TEXT_LABEL"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field name="validate_session" type="list"
|
||||
description="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="custom_reply" type="list"
|
||||
description="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="redirect" type="text"
|
||||
description="COM_CONTACT_FIELD_CONFIG_REDIRECT_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_REDIRECT_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="integration"
|
||||
>
|
||||
|
||||
<field name="show_feed_link" type="list"
|
||||
description="JGLOBAL_SHOW_FEED_LINK_DESC"
|
||||
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
</metadata>
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
|
||||
$class = ' class="first"';
|
||||
if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) :
|
||||
?>
|
||||
<?php foreach($this->items[$this->parent->id] as $id => $item) : ?>
|
||||
<?php
|
||||
if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) :
|
||||
if (!isset($this->items[$this->parent->id][$id + 1]))
|
||||
{
|
||||
$class = ' class="last"';
|
||||
}
|
||||
?>
|
||||
<div <?php echo $class; ?> >
|
||||
<?php $class = ''; ?>
|
||||
<h3 class="page-header item-title">
|
||||
<a href="<?php echo JRoute::_(ContactHelperRoute::getCategoryRoute($item->id)); ?>">
|
||||
<?php echo $this->escape($item->title); ?></a>
|
||||
<?php if ($this->params->get('show_cat_num_articles_cat') == 1) :?>
|
||||
<span class="badge badge-info tip hasTooltip" title="<?php echo JHtml::tooltipText('COM_CONTACT_NUM_ITEMS'); ?>">
|
||||
<?php echo $item->numitems; ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?php if (count($item->getChildren()) > 0) : ?>
|
||||
<a href="#category-<?php echo $item->id;?>" data-toggle="collapse" data-toggle="button" class="btn btn-mini pull-right"><span class="icon-plus"></span></a>
|
||||
<?php endif;?>
|
||||
</h3>
|
||||
<?php if ($this->params->get('show_subcat_desc_cat') == 1) :?>
|
||||
<?php if ($item->description) : ?>
|
||||
<div class="category-desc">
|
||||
<?php echo JHtml::_('content.prepare', $item->description, '', 'com_contact.categories'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (count($item->getChildren()) > 0) :?>
|
||||
<div class="collapse fade" id="category-<?php echo $item->id;?>">
|
||||
<?php
|
||||
$this->items[$item->id] = $item->getChildren();
|
||||
$this->parent = $item;
|
||||
$this->maxLevelcat--;
|
||||
echo $this->loadTemplate('items');
|
||||
$this->parent = $item->getParent();
|
||||
$this->maxLevelcat++;
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?><?php endif; ?>
|
1
components/com_contact/views/categories/tmpl/index.html
Normal file
1
components/com_contact/views/categories/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
125
components/com_contact/views/categories/view.html.php
Normal file
125
components/com_contact/views/categories/view.html.php
Normal file
@ -0,0 +1,125 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Content categories view.
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
* @since 1.6
|
||||
*/
|
||||
class ContactViewCategories extends JViewLegacy
|
||||
{
|
||||
protected $state = null;
|
||||
|
||||
protected $item = null;
|
||||
|
||||
protected $items = null;
|
||||
|
||||
protected $pagination = null;
|
||||
|
||||
/**
|
||||
* Display the view
|
||||
*
|
||||
* @return mixed False on error, null otherwise.
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$state = $this->get('State');
|
||||
$items = $this->get('Items');
|
||||
$parent = $this->get('Parent');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseWarning(500, implode("\n", $errors));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($items === false)
|
||||
{
|
||||
return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
|
||||
|
||||
}
|
||||
|
||||
if ($parent == false)
|
||||
{
|
||||
return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
|
||||
}
|
||||
|
||||
$params = &$state->params;
|
||||
|
||||
$items = array($parent->id => $items);
|
||||
|
||||
//Escape strings for HTML output
|
||||
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
|
||||
|
||||
$this->maxLevelcat = $params->get('maxLevelcat', -1);
|
||||
$this->params = &$params;
|
||||
$this->parent = &$parent;
|
||||
$this->items = &$items;
|
||||
|
||||
$this->_prepareDocument();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the document
|
||||
*/
|
||||
protected function _prepareDocument()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$menus = $app->getMenu();
|
||||
$title = null;
|
||||
|
||||
// Because the application sets a default page title,
|
||||
// we need to get it from the menu item itself
|
||||
$menu = $menus->getActive();
|
||||
if ($menu)
|
||||
{
|
||||
$this->params->def('page_heading', $this->params->def('page_title', $menu->title));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->params->def('page_heading', JText::_('COM_CONTACT_DEFAULT_PAGE_TITLE'));
|
||||
}
|
||||
$title = $this->params->get('page_title', '');
|
||||
if (empty($title))
|
||||
{
|
||||
$title = $app->getCfg('sitename');
|
||||
}
|
||||
elseif ($app->getCfg('sitename_pagetitles', 0) == 1)
|
||||
{
|
||||
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
|
||||
}
|
||||
elseif ($app->getCfg('sitename_pagetitles', 0) == 2)
|
||||
{
|
||||
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
|
||||
}
|
||||
$this->document->setTitle($title);
|
||||
|
||||
if ($this->params->get('menu-meta_description'))
|
||||
{
|
||||
$this->document->setDescription($this->params->get('menu-meta_description'));
|
||||
}
|
||||
|
||||
if ($this->params->get('menu-meta_keywords'))
|
||||
{
|
||||
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
|
||||
}
|
||||
|
||||
if ($this->params->get('robots'))
|
||||
{
|
||||
$this->document->setMetadata('robots', $this->params->get('robots'));
|
||||
}
|
||||
}
|
||||
}
|
1
components/com_contact/views/category/index.html
Normal file
1
components/com_contact/views/category/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
6
components/com_contact/views/category/metadata.xml
Normal file
6
components/com_contact/views/category/metadata.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<view title="Category">
|
||||
<message><![CDATA[Choose a contact category layout.]]></message>
|
||||
</view>
|
||||
</metadata>
|
13
components/com_contact/views/category/tmpl/default.php
Normal file
13
components/com_contact/views/category/tmpl/default.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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;
|
||||
|
||||
$this->subtemplatename = 'items';
|
||||
echo JLayoutHelper::render('joomla.content.category_default', $this);
|
573
components/com_contact/views/category/tmpl/default.xml
Normal file
573
components/com_contact/views/category/tmpl/default.xml
Normal file
@ -0,0 +1,573 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_CONTACT_CATEGORY_VIEW_DEFAULT_TITLE" option="COM_CONTACT_CATEGORY_VIEW_DEFAULT_OPTION">
|
||||
<help
|
||||
key = "JHELP_MENUS_MENU_ITEM_CONTACT_CATEGORY"
|
||||
/>
|
||||
<message>
|
||||
<![CDATA[COM_CONTACT_CATEGORY_VIEW_DEFAULT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
|
||||
<!-- Add fields to the request variables for the layout. -->
|
||||
<fields name="request">
|
||||
<fieldset name="request"
|
||||
addfieldpath="/administrator/components/com_contact/models/fields"
|
||||
>
|
||||
|
||||
<field name="id" type="category"
|
||||
description="COM_CONTACT_FIELD_CATEGORY_DESC"
|
||||
extension="com_contact"
|
||||
label="COM_CONTACT_FIELD_CATEGORY_LABEL"
|
||||
required="true"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
|
||||
|
||||
<!-- Add fields to the parameters object for the layout. -->
|
||||
<fields name="params">
|
||||
<fieldset name="basic" label="JGLOBAL_CATEGORY_OPTIONS">
|
||||
|
||||
<field name="spacer1" type="spacer" class="text"
|
||||
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
|
||||
/>
|
||||
|
||||
<field name="show_category_title" type="list"
|
||||
label="JGLOBAL_SHOW_CATEGORY_TITLE"
|
||||
description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_description" type="list"
|
||||
description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
|
||||
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_description_image" type="list"
|
||||
description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
|
||||
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="maxLevel" type="list"
|
||||
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
|
||||
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="-1">JALL</option>
|
||||
<option value="0">JNONE</option>
|
||||
<option value="1">J1</option>
|
||||
<option value="2">J2</option>
|
||||
<option value="3">J3</option>
|
||||
<option value="4">J4</option>
|
||||
<option value="5">J5</option>
|
||||
</field>
|
||||
|
||||
<field name="show_empty_categories" type="list"
|
||||
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
|
||||
description="COM_CONTACT_SHOW_EMPTY_CATEGORIES_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
|
||||
<field name="show_subcat_desc" type="list"
|
||||
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
|
||||
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_cat_items" type="list"
|
||||
label="COM_CONTACT_FIELD_SHOW_CAT_ITEMS_LABEL"
|
||||
description="COM_CONTACT_FIELD_SHOW_CAT_ITEMS_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="advanced" label="JGLOBAL_LIST_LAYOUT_OPTIONS">
|
||||
|
||||
<field name="spacer2" type="spacer" class="text"
|
||||
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filter_field"
|
||||
type="list"
|
||||
default=""
|
||||
description="JGLOBAL_FILTER_FIELD_DESC"
|
||||
label="JGLOBAL_FILTER_FIELD_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="hide">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_pagination_limit" type="list"
|
||||
description="JGLOBAL_DISPLAY_SELECT_DESC"
|
||||
label="JGLOBAL_DISPLAY_SELECT_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_headings" type="list"
|
||||
description="JGLOBAL_SHOW_HEADINGS_DESC"
|
||||
label="JGLOBAL_SHOW_HEADINGS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_position_headings" type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_POSITION_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_POSITION_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_email_headings" type="list"
|
||||
label="JGLOBAL_EMAIL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_EMAIL_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_telephone_headings"
|
||||
type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_PHONE_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_PHONE_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_mobile_headings"
|
||||
type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_MOBILE_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_MOBILE_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_fax_headings"
|
||||
type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_FAX_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_FAX_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_suburb_headings" type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_SUBURB_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_SUBURB_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_state_headings"
|
||||
type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_STATE_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_STATE_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_country_headings"
|
||||
type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_COUNTRY_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_COUNTRY_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_pagination" type="list"
|
||||
description="JGLOBAL_PAGINATION_DESC"
|
||||
label="JGLOBAL_PAGINATION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">JGLOBAL_AUTO</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_pagination_results"
|
||||
type="list"
|
||||
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
|
||||
description="JGLOBAL_PAGINATION_RESULTS_DESC">
|
||||
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
|
||||
</field>
|
||||
|
||||
<field name="initial_sort" type="list"
|
||||
description="COM_CONTACT_FIELD_INITIAL_SORT_DESC"
|
||||
label="COM_CONTACT_FIELD_INITIAL_SORT_LABEL"
|
||||
validate="options"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="name">COM_CONTACT_FIELD_VALUE_NAME</option>
|
||||
<option value="sortname">COM_CONTACT_FIELD_VALUE_SORT_NAME</option>
|
||||
<option value="ordering">COM_CONTACT_FIELD_VALUE_ORDERING</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="contact" label="COM_CONTACT_BASIC_OPTIONS_FIELDSET_LABEL">
|
||||
<field name="presentation_style"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PRESENTATION_DESC"
|
||||
label="COM_CONTACT_FIELD_PRESENTATION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="sliders">COM_CONTACT_FIELD_VALUE_SLIDERS</option>
|
||||
<option value="tabs">COM_CONTACT_FIELD_VALUE_TABS</option>
|
||||
<option value="plain">COM_CONTACT_FIELD_VALUE_PLAIN</option>
|
||||
</field>
|
||||
<field name="show_contact_category"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_CONTACT_SHOW_CATEGORY_DESC"
|
||||
label="COM_CONTACT_FIELD_CONTACT_SHOW_CATEGORY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="hide">JHIDE</option>
|
||||
<option value="show_no_link">COM_CONTACT_FIELD_VALUE_NO_LINK</option>
|
||||
<option value="show_with_link">COM_CONTACT_FIELD_VALUE_WITH_LINK</option>
|
||||
</field>
|
||||
|
||||
<field name="show_contact_list"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_CONTACT_SHOW_LIST_DESC"
|
||||
label="COM_CONTACT_FIELD_CONTACT_SHOW_LIST_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_name"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_NAME_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_position"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
|
||||
</field>
|
||||
|
||||
<field name="show_email"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_CONTACT_E_MAIL_DESC"
|
||||
label="JGLOBAL_EMAIL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_street_address"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_suburb"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_state"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_postcode"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_country"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_COUNTRY_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_COUNTRY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_telephone"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_TELEPHONE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_TELEPHONE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_mobile"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_MOBILE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_MOBILE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_fax"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_FAX_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_FAX_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_webpage"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_WEBPAGE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_WEBPAGE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_misc"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_MISC_INFO_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_MISC_INFO_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_image"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_IMAGE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_IMAGE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="allow_vcard"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_VCARD_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_VCARD_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_articles"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_ARTICLES_SHOW_DESC"
|
||||
label="COM_CONTACT_FIELD_ARTICLES_SHOW_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_links"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_SHOW_LINKS_DESC"
|
||||
label="COM_CONTACT_FIELD_SHOW_LINKS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="linka_name"
|
||||
type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKA_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linkb_name"
|
||||
type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKB_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linkc_name"
|
||||
type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKC_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linkd_name"
|
||||
type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKD_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linke_name"
|
||||
type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKE_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
</fieldset>
|
||||
<!-- Form options. -->
|
||||
<fieldset name="Contact_Form" label="COM_CONTACT_MAIL_FIELDSET_LABEL"
|
||||
>
|
||||
|
||||
<field name="show_email_form" type="list"
|
||||
description="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_DESC"
|
||||
label="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_email_copy" type="list"
|
||||
description="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_DESC"
|
||||
label="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="banned_email" type="textarea"
|
||||
cols="30"
|
||||
description="COM_CONTACT_FIELD_CONFIG_BANNED_EMAIL_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_BANNED_EMAIL_LABEL"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field name="banned_subject" type="textarea"
|
||||
cols="30"
|
||||
description="COM_CONTACT_FIELD_CONFIG_BANNED_SUBJECT_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_BANNED_SUBJECT_LABEL"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field name="banned_text" type="textarea"
|
||||
cols="30"
|
||||
description="COM_CONTACT_FIELD_CONFIG_BANNED_TEXT_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_BANNED_TEXT_LABEL"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field name="validate_session" type="list"
|
||||
description="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="custom_reply" type="list"
|
||||
description="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="redirect" type="text"
|
||||
description="COM_CONTACT_FIELD_CONFIG_REDIRECT_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_REDIRECT_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="integration"
|
||||
>
|
||||
|
||||
<field name="show_feed_link" type="list"
|
||||
description="JGLOBAL_Show_Feed_Link_Desc"
|
||||
label="JGLOBAL_Show_Feed_Link_Label"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
</metadata>
|
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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;
|
||||
$class = ' class="first"';
|
||||
if (count($this->children[$this->category->id]) > 0 && $this->maxLevel != 0) :
|
||||
?>
|
||||
<ul class="list-striped list-condensed">
|
||||
<?php foreach ($this->children[$this->category->id] as $id => $child) : ?>
|
||||
<?php
|
||||
if ($this->params->get('show_empty_categories') || $child->numitems || count($child->getChildren())) :
|
||||
if (!isset($this->children[$this->category->id][$id + 1]))
|
||||
{
|
||||
$class = ' class="last"';
|
||||
}
|
||||
?>
|
||||
<li<?php echo $class; ?>>
|
||||
<?php $class = ''; ?>
|
||||
<h4 class="item-title">
|
||||
<a href="<?php echo JRoute::_(ContactHelperRoute::getCategoryRoute($child->id)); ?>">
|
||||
<?php echo $this->escape($child->title); ?>
|
||||
</a>
|
||||
|
||||
<?php if ($this->params->get('show_cat_items') == 1) :?>
|
||||
<span class="badge badge-info pull-right" title="<?php echo JText::_('COM_CONTACT_CAT_NUM'); ?>"><?php echo $child->numitems; ?></span>
|
||||
<?php endif; ?>
|
||||
</h4>
|
||||
|
||||
<?php if ($this->params->get('show_subcat_desc') == 1) : ?>
|
||||
<?php if ($child->description) : ?>
|
||||
<div class="category-desc">
|
||||
<?php echo JHtml::_('content.prepare', $child->description, '', 'com_contact.category'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (count($child->getChildren()) > 0 ) :
|
||||
$this->children[$child->id] = $child->getChildren();
|
||||
$this->category = $child;
|
||||
$this->maxLevel--;
|
||||
echo $this->loadTemplate('children');
|
||||
$this->category = $child->getParent();
|
||||
$this->maxLevel++;
|
||||
endif; ?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
112
components/com_contact/views/category/tmpl/default_items.php
Normal file
112
components/com_contact/views/category/tmpl/default_items.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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::_('behavior.framework');
|
||||
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
?>
|
||||
<?php if (empty($this->items)) : ?>
|
||||
<p> <?php echo JText::_('COM_CONTACT_NO_ARTICLES'); ?> </p>
|
||||
<?php else : ?>
|
||||
|
||||
<form action="<?php echo htmlspecialchars(JUri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<?php if ($this->params->get('filter_field') != 'hide' || $this->params->get('show_pagination_limit')) :?>
|
||||
<fieldset class="filters btn-toolbar">
|
||||
<?php if ($this->params->get('filter_field') != 'hide') :?>
|
||||
<div class="btn-group">
|
||||
<label class="filter-search-lbl element-invisible" for="filter-search"><span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span><?php echo JText::_('COM_CONTACT_FILTER_LABEL').' '; ?></label>
|
||||
<input type="text" name="filter-search" id="filter-search" value="<?php echo $this->escape($this->state->get('list.filter')); ?>" class="inputbox" onchange="document.adminForm.submit();" title="<?php echo JText::_('COM_CONTACT_FILTER_SEARCH_DESC'); ?>" placeholder="<?php echo JText::_('COM_CONTACT_FILTER_SEARCH_DESC'); ?>" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_pagination_limit')) : ?>
|
||||
<div class="btn-group pull-right">
|
||||
<label for="limit" class="element-invisible">
|
||||
<?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?>
|
||||
</label>
|
||||
<?php echo $this->pagination->getLimitBox(); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</fieldset>
|
||||
<?php endif; ?>
|
||||
|
||||
<ul class="category list-striped">
|
||||
<?php foreach ($this->items as $i => $item) : ?>
|
||||
|
||||
<?php if (in_array($item->access, $this->user->getAuthorisedViewLevels())) : ?>
|
||||
<?php if ($this->items[$i]->published == 0) : ?>
|
||||
<li class="system-unpublished cat-list-row<?php echo $i % 2; ?>">
|
||||
<?php else: ?>
|
||||
<li class="cat-list-row<?php echo $i % 2; ?>" >
|
||||
<?php endif; ?>
|
||||
|
||||
<span class="pull-right">
|
||||
<?php if ($this->params->get('show_telephone_headings') AND !empty($item->telephone)) : ?>
|
||||
<?php echo JTEXT::sprintf('COM_CONTACT_TELEPHONE_NUMBER', $item->telephone); ?><br/>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_mobile_headings') AND !empty ($item->mobile)) : ?>
|
||||
<?php echo JTEXT::sprintf('COM_CONTACT_MOBILE_NUMBER', $item->mobile); ?><br/>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_fax_headings') AND !empty($item->fax) ) : ?>
|
||||
<?php echo JTEXT::sprintf('COM_CONTACT_FAX_NUMBER', $item->fax); ?><br/>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
|
||||
<p>
|
||||
<div class="list-title">
|
||||
<a href="<?php echo JRoute::_(ContactHelperRoute::getContactRoute($item->slug, $item->catid)); ?>">
|
||||
<?php echo $item->name; ?></a>
|
||||
<?php if ($this->items[$i]->published == 0) : ?>
|
||||
<span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ($this->params->get('show_position_headings')) : ?>
|
||||
<?php echo $item->con_position; ?><br/>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('show_email_headings')) : ?>
|
||||
<?php echo $item->email_to; ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('show_suburb_headings') AND !empty($item->suburb)) : ?>
|
||||
<?php echo $item->suburb . ', '; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_state_headings') AND !empty($item->state)) : ?>
|
||||
<?php echo $item->state . ', '; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_country_headings') AND !empty($item->country)) : ?>
|
||||
<?php echo $item->country; ?><br/>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
|
||||
<?php if ($this->params->get('show_pagination')) : ?>
|
||||
<div class="pagination">
|
||||
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
|
||||
<p class="counter">
|
||||
<?php echo $this->pagination->getPagesCounter(); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php echo $this->pagination->getPagesLinks(); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div>
|
||||
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
|
||||
</div>
|
||||
</form>
|
||||
<?php endif; ?>
|
1
components/com_contact/views/category/tmpl/index.html
Normal file
1
components/com_contact/views/category/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
82
components/com_contact/views/category/view.feed.php
Normal file
82
components/com_contact/views/category/view.feed.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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 Contact component
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
* @since 1.5
|
||||
*/
|
||||
class ContactViewCategory extends JViewLegacy
|
||||
{
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseError(500, implode("\n", $errors));
|
||||
return false;
|
||||
}
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
$doc = JFactory::getDocument();
|
||||
$feedEmail = $app->getCfg('feed_email', 'author');
|
||||
$siteEmail = $app->getCfg('mailfrom');
|
||||
|
||||
$app->input->set('limit', $app->getCfg('feed_limit'));
|
||||
// Get some data from the models
|
||||
$category = $this->get('Category');
|
||||
$rows = $this->get('Items');
|
||||
|
||||
$doc->link = JRoute::_(ContactHelperRoute::getCategoryRoute($category->id));
|
||||
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
// strip html from feed item title
|
||||
$title = $this->escape($row->name);
|
||||
$title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
|
||||
|
||||
// Compute the contact slug
|
||||
$row->slug = $row->alias ? ($row->id . ':' . $row->alias) : $row->id;
|
||||
|
||||
// url link to article
|
||||
$link = JRoute::_(ContactHelperRoute::getContactRoute($row->slug, $row->catid));
|
||||
|
||||
$description = $row->address;
|
||||
$author = $row->created_by_alias ? $row->created_by_alias : $row->author;
|
||||
@$date = ($row->created ? date('r', strtotime($row->created)) : '');
|
||||
|
||||
// load individual item creator class
|
||||
$item = new JFeedItem;
|
||||
$item->title = $title;
|
||||
$item->link = $link;
|
||||
$item->description = $description;
|
||||
$item->date = $date;
|
||||
$item->category = $category->title;
|
||||
$item->author = $author;
|
||||
|
||||
// We don't have the author email so we have to use site in both cases.
|
||||
if ($feedEmail == 'site')
|
||||
{
|
||||
$item->authorEmail = $siteEmail;
|
||||
}
|
||||
elseif ($feedEmail == 'author')
|
||||
{
|
||||
$item->authorEmail = $row->author_email;
|
||||
}
|
||||
|
||||
// loads item info into rss array
|
||||
$doc->addItem($item);
|
||||
}
|
||||
}
|
||||
}
|
247
components/com_contact/views/category/view.html.php
Normal file
247
components/com_contact/views/category/view.html.php
Normal file
@ -0,0 +1,247 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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 Contacts component
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
* @since 1.5
|
||||
*/
|
||||
class ContactViewCategory extends JViewLegacy
|
||||
{
|
||||
protected $state;
|
||||
|
||||
protected $items;
|
||||
|
||||
protected $category;
|
||||
|
||||
protected $categories;
|
||||
|
||||
protected $pagination;
|
||||
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$params = $app->getParams();
|
||||
|
||||
// Get some data from the models
|
||||
$state = $this->get('State');
|
||||
$items = $this->get('Items');
|
||||
$category = $this->get('Category');
|
||||
$children = $this->get('Children');
|
||||
$parent = $this->get('Parent');
|
||||
$pagination = $this->get('Pagination');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseError(500, implode("\n", $errors));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($category == false)
|
||||
{
|
||||
return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
|
||||
}
|
||||
|
||||
if ($parent == false)
|
||||
{
|
||||
return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
|
||||
}
|
||||
|
||||
// Check whether category access level allows access.
|
||||
$user = JFactory::getUser();
|
||||
$groups = $user->getAuthorisedViewLevels();
|
||||
if (!in_array($category->access, $groups))
|
||||
{
|
||||
return JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
|
||||
}
|
||||
|
||||
// Prepare the data.
|
||||
// Compute the contact slug.
|
||||
for ($i = 0, $n = count($items); $i < $n; $i++)
|
||||
{
|
||||
$item = &$items[$i];
|
||||
$item->slug = $item->alias ? ($item->id.':'.$item->alias) : $item->id;
|
||||
$temp = new JRegistry;
|
||||
$temp->loadString($item->params);
|
||||
$item->params = clone($params);
|
||||
$item->params->merge($temp);
|
||||
|
||||
if ($item->params->get('show_email', 0) == 1)
|
||||
{
|
||||
$item->email_to = trim($item->email_to);
|
||||
|
||||
if (!empty($item->email_to) && JMailHelper::isEmailAddress($item->email_to))
|
||||
{
|
||||
$item->email_to = JHtml::_('email.cloak', $item->email_to);
|
||||
}
|
||||
else {
|
||||
$item->email_to = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Setup the category parameters.
|
||||
$cparams = $category->getParams();
|
||||
$category->params = clone($params);
|
||||
$category->params->merge($cparams);
|
||||
$children = array($category->id => $children);
|
||||
|
||||
$maxLevel = $params->get('maxLevel', -1);
|
||||
$this->maxLevel = &$maxLevel;
|
||||
$this->state = &$state;
|
||||
$this->items = &$items;
|
||||
$this->category = &$category;
|
||||
$this->children = &$children;
|
||||
$this->params = &$params;
|
||||
$this->parent = &$parent;
|
||||
$this->pagination = &$pagination;
|
||||
$this->user = &$user;
|
||||
|
||||
//Escape strings for HTML output
|
||||
$this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
|
||||
|
||||
// Check for layout override only if this is not the active menu item
|
||||
// If it is the active menu item, then the view and category id will match
|
||||
$active = $app->getMenu()->getActive();
|
||||
if ((!$active) || ((strpos($active->link, 'view=category') === false) || (strpos($active->link, '&id=' . (string) $this->category->id) === false)))
|
||||
{
|
||||
if ($layout = $category->params->get('category_layout'))
|
||||
{
|
||||
$this->setLayout($layout);
|
||||
}
|
||||
}
|
||||
elseif (isset($active->query['layout']))
|
||||
{
|
||||
// We need to set the layout in case this is an alternative menu item (with an alternative layout)
|
||||
$this->setLayout($active->query['layout']);
|
||||
}
|
||||
|
||||
$category->tags = new JHelperTags;
|
||||
$category->tags->getItemTags('com_contact.category', $category->id);
|
||||
|
||||
$this->_prepareDocument();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the document
|
||||
*/
|
||||
protected function _prepareDocument()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$menus = $app->getMenu();
|
||||
$pathway = $app->getPathway();
|
||||
$title = null;
|
||||
|
||||
// Because the application sets a default page title,
|
||||
// we need to get it from the menu item itself
|
||||
$menu = $menus->getActive();
|
||||
|
||||
if ($menu)
|
||||
{
|
||||
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->params->def('page_heading', JText::_('COM_CONTACT_DEFAULT_PAGE_TITLE'));
|
||||
}
|
||||
|
||||
$id = (int) @$menu->query['id'];
|
||||
|
||||
if ($menu && ($menu->query['option'] != 'com_contact' || $menu->query['view'] == 'contact' || $id != $this->category->id))
|
||||
{
|
||||
$path = array(array('title' => $this->category->title, 'link' => ''));
|
||||
$category = $this->category->getParent();
|
||||
|
||||
while (($menu->query['option'] != 'com_contact' || $menu->query['view'] == 'contact' || $id != $category->id) && $category->id > 1)
|
||||
{
|
||||
$path[] = array('title' => $category->title, 'link' => ContactHelperRoute::getCategoryRoute($category->id));
|
||||
$category = $category->getParent();
|
||||
}
|
||||
|
||||
$path = array_reverse($path);
|
||||
|
||||
foreach ($path as $item)
|
||||
{
|
||||
$pathway->addItem($item['title'], $item['link']);
|
||||
}
|
||||
}
|
||||
|
||||
$title = $this->params->get('page_title', '');
|
||||
|
||||
if (empty($title))
|
||||
{
|
||||
$title = $app->getCfg('sitename');
|
||||
}
|
||||
elseif ($app->getCfg('sitename_pagetitles', 0) == 1)
|
||||
{
|
||||
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
|
||||
}
|
||||
elseif ($app->getCfg('sitename_pagetitles', 0) == 2)
|
||||
{
|
||||
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
|
||||
}
|
||||
|
||||
$this->document->setTitle($title);
|
||||
|
||||
if ($this->category->metadesc)
|
||||
{
|
||||
$this->document->setDescription($this->category->metadesc);
|
||||
}
|
||||
elseif (!$this->category->metadesc && $this->params->get('menu-meta_description'))
|
||||
{
|
||||
$this->document->setDescription($this->params->get('menu-meta_description'));
|
||||
}
|
||||
|
||||
if ($this->category->metakey)
|
||||
{
|
||||
$this->document->setMetadata('keywords', $this->category->metakey);
|
||||
}
|
||||
elseif (!$this->category->metakey && $this->params->get('menu-meta_keywords'))
|
||||
{
|
||||
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
|
||||
}
|
||||
|
||||
if ($this->params->get('robots'))
|
||||
{
|
||||
$this->document->setMetadata('robots', $this->params->get('robots'));
|
||||
}
|
||||
|
||||
if ($app->getCfg('MetaAuthor') == '1')
|
||||
{
|
||||
$this->document->setMetaData('author', $this->category->getMetadata()->get('author'));
|
||||
}
|
||||
|
||||
$mdata = $this->category->getMetadata()->toArray();
|
||||
|
||||
foreach ($mdata as $k => $v)
|
||||
{
|
||||
if ($v)
|
||||
{
|
||||
$this->document->setMetadata($k, $v);
|
||||
}
|
||||
}
|
||||
|
||||
// Add alternative feed link
|
||||
if ($this->params->get('show_feed_link', 1) == 1)
|
||||
{
|
||||
$link = '&format=feed&limitstart=';
|
||||
$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
|
||||
$this->document->addHeadLink(JRoute::_($link.'&type=rss'), 'alternate', 'rel', $attribs);
|
||||
$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
|
||||
$this->document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs);
|
||||
}
|
||||
}
|
||||
}
|
1
components/com_contact/views/contact/index.html
Normal file
1
components/com_contact/views/contact/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
6
components/com_contact/views/contact/metadata.xml
Normal file
6
components/com_contact/views/contact/metadata.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<view title="Contact">
|
||||
<message><![CDATA[Choose a contact layout.]]></message>
|
||||
</view>
|
||||
</metadata>
|
218
components/com_contact/views/contact/tmpl/default.php
Normal file
218
components/com_contact/views/contact/tmpl/default.php
Normal file
@ -0,0 +1,218 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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;
|
||||
|
||||
$cparams = JComponentHelper::getParams('com_media');
|
||||
|
||||
jimport('joomla.html.html.bootstrap');
|
||||
?>
|
||||
<div class="contact<?php echo $this->pageclass_sfx?>">
|
||||
<?php if ($this->params->get('show_page_heading')) : ?>
|
||||
<h1>
|
||||
<?php echo $this->escape($this->params->get('page_heading')); ?>
|
||||
</h1>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->contact->name && $this->params->get('show_name')) : ?>
|
||||
<div class="page-header">
|
||||
<h2>
|
||||
<?php if ($this->item->published == 0) : ?>
|
||||
<span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span>
|
||||
<?php endif; ?>
|
||||
<span class="contact-name"><?php echo $this->contact->name; ?></span>
|
||||
</h2>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('show_contact_category') == 'show_no_link') : ?>
|
||||
<h3>
|
||||
<span class="contact-category"><?php echo $this->contact->category_title; ?></span>
|
||||
</h3>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('show_contact_category') == 'show_with_link') : ?>
|
||||
<?php $contactLink = ContactHelperRoute::getCategoryRoute($this->contact->catid); ?>
|
||||
<h3>
|
||||
<span class="contact-category"><a href="<?php echo $contactLink; ?>">
|
||||
<?php echo $this->escape($this->contact->category_title); ?></a>
|
||||
</span>
|
||||
</h3>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('show_contact_list') && count($this->contacts) > 1) : ?>
|
||||
<form action="#" method="get" name="selectForm" id="selectForm">
|
||||
<?php echo JText::_('COM_CONTACT_SELECT_CONTACT'); ?>
|
||||
<?php echo JHtml::_('select.genericlist', $this->contacts, 'id', 'class="inputbox" onchange="document.location.href = this.value"', 'link', 'name', $this->contact->link);?>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_tags', 1) && !empty($this->item->tags)) : ?>
|
||||
<?php $this->item->tagLayout = new JLayoutFile('joomla.content.tags'); ?>
|
||||
<?php echo $this->item->tagLayout->render($this->item->tags->itemTags); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
|
||||
<?php echo JHtml::_('bootstrap.startAccordion', 'slide-contact', array('active' => 'basic-details')); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
|
||||
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'basic-details')); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
|
||||
<?php echo JHtml::_('bootstrap.addSlide', 'slide-contact', JText::_('COM_CONTACT_DETAILS'), 'basic-details'); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'basic-details', JText::_('COM_CONTACT_DETAILS', true)); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'plain'):?>
|
||||
<?php echo '<h3>'. JText::_('COM_CONTACT_DETAILS').'</h3>'; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->contact->image && $this->params->get('show_image')) : ?>
|
||||
<div class="thumbnail pull-right">
|
||||
<?php echo JHtml::_('image', $this->contact->image, JText::_('COM_CONTACT_IMAGE_DETAILS'), array('align' => 'middle')); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->contact->con_position && $this->params->get('show_position')) : ?>
|
||||
<dl class="contact-position dl-horizontal">
|
||||
<dd>
|
||||
<?php echo $this->contact->con_position; ?>
|
||||
</dd>
|
||||
</dl>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $this->loadTemplate('address'); ?>
|
||||
|
||||
<?php if ($this->params->get('allow_vcard')) : ?>
|
||||
<?php echo JText::_('COM_CONTACT_DOWNLOAD_INFORMATION_AS');?>
|
||||
<a href="<?php echo JRoute::_('index.php?option=com_contact&view=contact&id='.$this->contact->id . '&format=vcf'); ?>">
|
||||
<?php echo JText::_('COM_CONTACT_VCARD');?></a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
|
||||
<?php echo JHtml::_('bootstrap.endSlide'); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_email_form') && ($this->contact->email_to || $this->contact->user_id)) : ?>
|
||||
|
||||
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
|
||||
<?php echo JHtml::_('bootstrap.addSlide', 'slide-contact', JText::_('COM_CONTACT_EMAIL_FORM'), 'display-form'); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'display-form', JText::_('COM_CONTACT_EMAIL_FORM', true)); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'plain'):?>
|
||||
<?php echo '<h3>'. JText::_('COM_CONTACT_EMAIL_FORM').'</h3>'; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $this->loadTemplate('form'); ?>
|
||||
|
||||
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
|
||||
<?php echo JHtml::_('bootstrap.endSlide'); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_links')) : ?>
|
||||
<?php echo $this->loadTemplate('links'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_articles') && $this->contact->user_id && $this->contact->articles) : ?>
|
||||
|
||||
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
|
||||
<?php echo JHtml::_('bootstrap.addSlide', 'slide-contact', JText::_('JGLOBAL_ARTICLES'), 'display-articles'); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'display-articles', JText::_('JGLOBAL_ARTICLES', true)); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'plain'):?>
|
||||
<?php echo '<h3>'. JText::_('JGLOBAL_ARTICLES').'</h3>'; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $this->loadTemplate('articles'); ?>
|
||||
|
||||
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
|
||||
<?php echo JHtml::_('bootstrap.endSlide'); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_profile') && $this->contact->user_id && JPluginHelper::isEnabled('user', 'profile')) : ?>
|
||||
|
||||
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
|
||||
<?php echo JHtml::_('bootstrap.addSlide', 'slide-contact', JText::_('COM_CONTACT_PROFILE'), 'display-profile'); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'display-profile', JText::_('COM_CONTACT_PROFILE', true)); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'plain'):?>
|
||||
<?php echo '<h3>'. JText::_('COM_CONTACT_PROFILE').'</h3>'; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $this->loadTemplate('profile'); ?>
|
||||
|
||||
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
|
||||
<?php echo JHtml::_('bootstrap.endSlide'); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->contact->misc && $this->params->get('show_misc')) : ?>
|
||||
|
||||
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
|
||||
<?php echo JHtml::_('bootstrap.addSlide', 'slide-contact', JText::_('COM_CONTACT_OTHER_INFORMATION'), 'display-misc'); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'display-misc', JText::_('COM_CONTACT_OTHER_INFORMATION', true)); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'plain'):?>
|
||||
<?php echo '<h3>'. JText::_('COM_CONTACT_OTHER_INFORMATION').'</h3>'; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="contact-miscinfo">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
<span class="<?php echo $this->params->get('marker_class'); ?>">
|
||||
<?php echo $this->params->get('marker_misc'); ?>
|
||||
</span>
|
||||
</dt>
|
||||
<dd>
|
||||
<span class="contact-misc">
|
||||
<?php echo $this->contact->misc; ?>
|
||||
</span>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
|
||||
<?php echo JHtml::_('bootstrap.endSlide'); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
|
||||
<?php echo JHtml::_('bootstrap.endAccordion'); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
|
||||
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
358
components/com_contact/views/contact/tmpl/default.xml
Normal file
358
components/com_contact/views/contact/tmpl/default.xml
Normal file
@ -0,0 +1,358 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_CONTACT_CONTACT_VIEW_DEFAULT_TITLE" option="COM_CONTACT_CONTACT_VIEW_DEFAULT_OPTION">
|
||||
<help
|
||||
key = "JHELP_MENUS_MENU_ITEM_CONTACT_SINGLE_CONTACT"
|
||||
/>
|
||||
<message>
|
||||
<![CDATA[COM_CONTACT_CONTACT_VIEW_DEFAULT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
|
||||
<!-- Add fields to the request variables for the layout. -->
|
||||
<fields name="request">
|
||||
<fieldset name="request"
|
||||
addfieldpath="/administrator/components/com_contact/models/fields"
|
||||
>
|
||||
<field name="id"
|
||||
type="modal_contact"
|
||||
description="COM_CONTACT_SELECT_CONTACT_DESC"
|
||||
label="COM_CONTACT_SELECT_CONTACT_LABEL"
|
||||
required="true"
|
||||
edit="true"
|
||||
clear="false"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
|
||||
<!-- Add fields to the parameters object for the layout. -->
|
||||
<fields name="params">
|
||||
|
||||
<!-- Basic options. -->
|
||||
<fieldset name="params"
|
||||
label="COM_CONTACT_BASIC_OPTIONS_FIELDSET_LABEL"
|
||||
>
|
||||
<field name="presentation_style"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PRESENTATION_DESC"
|
||||
label="COM_CONTACT_FIELD_PRESENTATION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="sliders">COM_CONTACT_FIELD_VALUE_SLIDERS</option>
|
||||
<option value="tabs">COM_CONTACT_FIELD_VALUE_TABS</option>
|
||||
<option value="plain">COM_CONTACT_FIELD_VALUE_PLAIN</option>
|
||||
</field>
|
||||
<field name="show_contact_category"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_CONTACT_SHOW_CATEGORY_DESC"
|
||||
label="COM_CONTACT_FIELD_CONTACT_SHOW_CATEGORY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="hide">JHIDE</option>
|
||||
<option value="show_no_link">COM_CONTACT_FIELD_VALUE_NO_LINK</option>
|
||||
<option value="show_with_link">COM_CONTACT_FIELD_VALUE_WITH_LINK</option>
|
||||
</field>
|
||||
|
||||
<field name="show_contact_list"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_CONTACT_SHOW_LIST_DESC"
|
||||
label="COM_CONTACT_FIELD_CONTACT_SHOW_LIST_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_tags" type="list"
|
||||
label="COM_CONTACT_FIELD_SHOW_TAGS_LABEL"
|
||||
description="COM_CONTACT_FIELD_SHOW_TAGS_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_name"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_NAME_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_position"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
|
||||
</field>
|
||||
|
||||
<field name="show_email"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_CONTACT_E_MAIL_DESC"
|
||||
label="JGLOBAL_EMAIL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_street_address"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_suburb"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_state"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_postcode"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_country"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_COUNTRY_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_COUNTRY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_telephone"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_TELEPHONE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_TELEPHONE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_mobile"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_MOBILE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_MOBILE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_fax"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_FAX_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_FAX_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_webpage"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_WEBPAGE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_WEBPAGE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_misc"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_MISC_INFO_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_MISC_INFO_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_image"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_IMAGE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_IMAGE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="allow_vcard"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_VCARD_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_VCARD_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_articles"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_ARTICLES_SHOW_DESC"
|
||||
label="COM_CONTACT_FIELD_ARTICLES_SHOW_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_links"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_SHOW_LINKS_DESC"
|
||||
label="COM_CONTACT_FIELD_SHOW_LINKS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="linka_name"
|
||||
type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKA_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linkb_name"
|
||||
type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKB_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linkc_name"
|
||||
type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKC_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linkd_name"
|
||||
type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKD_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linke_name"
|
||||
type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKE_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<!-- Form options. -->
|
||||
<fieldset name="Contact_Form"
|
||||
label="COM_CONTACT_MAIL_FIELDSET_LABEL"
|
||||
>
|
||||
|
||||
<field name="show_email_form" type="list"
|
||||
description="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_DESC"
|
||||
label="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_email_copy"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_DESC"
|
||||
label="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="banned_email"
|
||||
type="textarea"
|
||||
cols="30"
|
||||
description="COM_CONTACT_FIELD_CONFIG_BANNED_EMAIL_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_BANNED_EMAIL_LABEL"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field name="banned_subject"
|
||||
type="textarea"
|
||||
cols="30"
|
||||
description="COM_CONTACT_FIELD_CONFIG_BANNED_SUBJECT_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_BANNED_SUBJECT_LABEL"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field name="banned_text"
|
||||
type="textarea"
|
||||
cols="30"
|
||||
description="COM_CONTACT_FIELD_CONFIG_BANNED_TEXT_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_BANNED_TEXT_LABEL"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field name="validate_session"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="custom_reply"
|
||||
type="list"
|
||||
description="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="redirect"
|
||||
type="text"
|
||||
description="COM_CONTACT_FIELD_CONFIG_REDIRECT_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_REDIRECT_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</metadata>
|
127
components/com_contact/views/contact/tmpl/default_address.php
Normal file
127
components/com_contact/views/contact/tmpl/default_address.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* marker_class: Class based on the selection of text, none, or icons
|
||||
* jicon-text, jicon-none, jicon-icon
|
||||
*/
|
||||
?>
|
||||
<dl class="contact-address dl-horizontal">
|
||||
<?php if (($this->params->get('address_check') > 0) &&
|
||||
($this->contact->address || $this->contact->suburb || $this->contact->state || $this->contact->country || $this->contact->postcode)) : ?>
|
||||
<?php if ($this->params->get('address_check') > 0) : ?>
|
||||
<dt>
|
||||
<span class="<?php echo $this->params->get('marker_class'); ?>" >
|
||||
<?php echo $this->params->get('marker_address'); ?>
|
||||
</span>
|
||||
</dt>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->contact->address && $this->params->get('show_street_address')) : ?>
|
||||
<dd>
|
||||
<span class="contact-street">
|
||||
<?php echo $this->contact->address .'<br/>'; ?>
|
||||
</span>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->contact->suburb && $this->params->get('show_suburb')) : ?>
|
||||
<dd>
|
||||
<span class="contact-suburb">
|
||||
<?php echo $this->contact->suburb .'<br/>'; ?>
|
||||
</span>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->contact->state && $this->params->get('show_state')) : ?>
|
||||
<dd>
|
||||
<span class="contact-state">
|
||||
<?php echo $this->contact->state . '<br/>'; ?>
|
||||
</span>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->contact->postcode && $this->params->get('show_postcode')) : ?>
|
||||
<dd>
|
||||
<span class="contact-postcode">
|
||||
<?php echo $this->contact->postcode .'<br/>'; ?>
|
||||
</span>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->contact->country && $this->params->get('show_country')) : ?>
|
||||
<dd>
|
||||
<span class="contact-country">
|
||||
<?php echo $this->contact->country .'<br/>'; ?>
|
||||
</span>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->contact->email_to && $this->params->get('show_email')) : ?>
|
||||
<dt>
|
||||
<span class="<?php echo $this->params->get('marker_class'); ?>" >
|
||||
<?php echo nl2br($this->params->get('marker_email')); ?>
|
||||
</span>
|
||||
</dt>
|
||||
<dd>
|
||||
<span class="contact-emailto">
|
||||
<?php echo $this->contact->email_to; ?>
|
||||
</span>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->contact->telephone && $this->params->get('show_telephone')) : ?>
|
||||
<dt>
|
||||
<span class="<?php echo $this->params->get('marker_class'); ?>" >
|
||||
<?php echo $this->params->get('marker_telephone'); ?>
|
||||
</span>
|
||||
</dt>
|
||||
<dd>
|
||||
<span class="contact-telephone">
|
||||
<?php echo nl2br($this->contact->telephone); ?>
|
||||
</span>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->contact->fax && $this->params->get('show_fax')) : ?>
|
||||
<dt>
|
||||
<span class="<?php echo $this->params->get('marker_class'); ?>" >
|
||||
<?php echo $this->params->get('marker_fax'); ?>
|
||||
</span>
|
||||
</dt>
|
||||
<dd>
|
||||
<span class="contact-fax">
|
||||
<?php echo nl2br($this->contact->fax); ?>
|
||||
</span>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->contact->mobile && $this->params->get('show_mobile')) :?>
|
||||
<dt>
|
||||
<span class="<?php echo $this->params->get('marker_class'); ?>" >
|
||||
<?php echo $this->params->get('marker_mobile'); ?>
|
||||
</span>
|
||||
</dt>
|
||||
<dd>
|
||||
<span class="contact-mobile">
|
||||
<?php echo nl2br($this->contact->mobile); ?>
|
||||
</span>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->contact->webpage && $this->params->get('show_webpage')) : ?>
|
||||
<dt>
|
||||
<span class="<?php echo $this->params->get('marker_class'); ?>" >
|
||||
</span>
|
||||
</dt>
|
||||
<dd>
|
||||
<span class="contact-webpage">
|
||||
<a href="<?php echo $this->contact->webpage; ?>" target="_blank">
|
||||
<?php echo JStringPunycode::urlToUTF8($this->contact->webpage); ?></a>
|
||||
</span>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
</dl>
|
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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_SITE . '/components/com_content/helpers/route.php';
|
||||
|
||||
?>
|
||||
<?php if ($this->params->get('show_articles')) : ?>
|
||||
<div class="contact-articles">
|
||||
<ul class="nav nav-tabs nav-stacked">
|
||||
<?php foreach ($this->item->articles as $article) : ?>
|
||||
<li>
|
||||
<?php echo JHtml::_('link', JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catslug)), htmlspecialchars($article->title, ENT_COMPAT, 'UTF-8')); ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
79
components/com_contact/views/contact/tmpl/default_form.php
Normal file
79
components/com_contact/views/contact/tmpl/default_form.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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::_('behavior.keepalive');
|
||||
JHtml::_('behavior.formvalidation');
|
||||
|
||||
if (isset($this->error)) : ?>
|
||||
<div class="contact-error">
|
||||
<?php echo $this->error; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="contact-form">
|
||||
<form id="contact-form" action="<?php echo JRoute::_('index.php'); ?>" method="post" class="form-validate form-horizontal">
|
||||
<fieldset>
|
||||
<legend><?php echo JText::_('COM_CONTACT_FORM_LABEL'); ?></legend>
|
||||
<div class="control-group">
|
||||
<div class="control-label"><?php echo $this->form->getLabel('contact_name'); ?></div>
|
||||
<div class="controls"><?php echo $this->form->getInput('contact_name'); ?></div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-label"><?php echo $this->form->getLabel('contact_email'); ?></div>
|
||||
<div class="controls"><?php echo $this->form->getInput('contact_email'); ?></div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-label"><?php echo $this->form->getLabel('contact_subject'); ?></div>
|
||||
<div class="controls"><?php echo $this->form->getInput('contact_subject'); ?></div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-label"><?php echo $this->form->getLabel('contact_message'); ?></div>
|
||||
<div class="controls"><?php echo $this->form->getInput('contact_message'); ?></div>
|
||||
</div>
|
||||
<?php if ($this->params->get('show_email_copy')) { ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label"><?php echo $this->form->getLabel('contact_email_copy'); ?></div>
|
||||
<div class="controls"><?php echo $this->form->getInput('contact_email_copy'); ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php //Dynamically load any additional fields from plugins. ?>
|
||||
<?php foreach ($this->form->getFieldsets() as $fieldset) : ?>
|
||||
<?php if ($fieldset->name != 'contact'):?>
|
||||
<?php $fields = $this->form->getFieldset($fieldset->name);?>
|
||||
<?php foreach ($fields as $field) : ?>
|
||||
<div class="control-group">
|
||||
<?php if ($field->hidden) : ?>
|
||||
<div class="controls">
|
||||
<?php echo $field->input;?>
|
||||
</div>
|
||||
<?php else:?>
|
||||
<div class="control-label">
|
||||
<?php echo $field->label; ?>
|
||||
<?php if (!$field->required && $field->type != "Spacer") : ?>
|
||||
<span class="optional"><?php echo JText::_('COM_CONTACT_OPTIONAL');?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="controls"><?php echo $field->input;?></div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
<?php endif ?>
|
||||
<?php endforeach;?>
|
||||
<div class="form-actions"><button class="btn btn-primary validate" type="submit"><?php echo JText::_('COM_CONTACT_CONTACT_SEND'); ?></button>
|
||||
<input type="hidden" name="option" value="com_contact" />
|
||||
<input type="hidden" name="task" value="contact.submit" />
|
||||
<input type="hidden" name="return" value="<?php echo $this->return_page;?>" />
|
||||
<input type="hidden" name="id" value="<?php echo $this->contact->slug; ?>" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
54
components/com_contact/views/contact/tmpl/default_links.php
Normal file
54
components/com_contact/views/contact/tmpl/default_links.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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 if ($this->params->get('presentation_style') == 'sliders') : ?>
|
||||
<?php echo JHtml::_('bootstrap.addSlide', 'slide-contact', JText::_('COM_CONTACT_LINKS'), 'display-links'); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'display-links', JText::_('COM_CONTACT_LINKS', true)); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'plain'):?>
|
||||
<?php echo '<h3>'. JText::_('COM_CONTACT_LINKS').'</h3>'; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="contact-links">
|
||||
<ul class="nav nav-tabs nav-stacked">
|
||||
<?php
|
||||
foreach (range('a', 'e') as $char) :// letters 'a' to 'e'
|
||||
$link = $this->contact->params->get('link'.$char);
|
||||
$label = $this->contact->params->get('link'.$char.'_name');
|
||||
|
||||
if (!$link) :
|
||||
continue;
|
||||
endif;
|
||||
|
||||
// Add 'http://' if not present
|
||||
$link = (0 === strpos($link, 'http')) ? $link : 'http://'.$link;
|
||||
|
||||
// If no label is present, take the link
|
||||
$label = ($label) ? $label : $link;
|
||||
?>
|
||||
<li>
|
||||
<a href="<?php echo $link; ?>">
|
||||
<?php echo $label; ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
|
||||
<?php echo JHtml::_('bootstrap.endSlide'); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
<?php endif; ?>
|
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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 if (JPluginHelper::isEnabled('user', 'profile')) :
|
||||
$fields = $this->item->profile->getFieldset('profile'); ?>
|
||||
<div class="contact-profile" id="users-profile-custom">
|
||||
<dl class="dl-horizontal">
|
||||
<?php foreach ($fields as $profile) :
|
||||
if ($profile->value) :
|
||||
echo '<dt>'.$profile->label.'</dt>';
|
||||
$profile->text = htmlspecialchars($profile->value, ENT_COMPAT, 'UTF-8');
|
||||
|
||||
switch ($profile->id) :
|
||||
case "profile_website":
|
||||
$v_http = substr($profile->profile_value, 0, 4);
|
||||
|
||||
if ($v_http == "http") :
|
||||
echo '<dd><a href="'.$profile->text.'">'.$profile->text.'</a></dd>';
|
||||
else :
|
||||
echo '<dd><a href="http://'.$profile->text.'">'.$profile->text.'</a></dd>';
|
||||
endif;
|
||||
break;
|
||||
|
||||
default:
|
||||
echo '<dd>'.$profile->text.'</dd>';
|
||||
break;
|
||||
endswitch;
|
||||
endif;
|
||||
endforeach; ?>
|
||||
</dl>
|
||||
</div>
|
||||
<?php endif; ?>
|
1
components/com_contact/views/contact/tmpl/index.html
Normal file
1
components/com_contact/views/contact/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
292
components/com_contact/views/contact/view.html.php
Normal file
292
components/com_contact/views/contact/view.html.php
Normal file
@ -0,0 +1,292 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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.'/models/category.php';
|
||||
|
||||
/**
|
||||
* HTML Contact View class for the Contact component
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
* @since 1.5
|
||||
*/
|
||||
class ContactViewContact extends JViewLegacy
|
||||
{
|
||||
protected $state;
|
||||
|
||||
protected $form;
|
||||
|
||||
protected $item;
|
||||
|
||||
protected $return_page;
|
||||
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$user = JFactory::getUser();
|
||||
$state = $this->get('State');
|
||||
$item = $this->get('Item');
|
||||
$this->form = $this->get('Form');
|
||||
|
||||
// Get the parameters
|
||||
$params = JComponentHelper::getParams('com_contact');
|
||||
|
||||
if ($item)
|
||||
{
|
||||
// If we found an item, merge the item parameters
|
||||
$params->merge($item->params);
|
||||
|
||||
// Get Category Model data
|
||||
$categoryModel = JModelLegacy::getInstance('Category', 'ContactModel', array('ignore_request' => true));
|
||||
$categoryModel->setState('category.id', $item->catid);
|
||||
$categoryModel->setState('list.ordering', 'a.name');
|
||||
$categoryModel->setState('list.direction', 'asc');
|
||||
$categoryModel->setState('filter.published', 1);
|
||||
|
||||
$contacts = $categoryModel->getItems();
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseWarning(500, implode("\n", $errors));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if access is not public
|
||||
$groups = $user->getAuthorisedViewLevels();
|
||||
|
||||
$return = '';
|
||||
|
||||
if ((!in_array($item->access, $groups)) || (!in_array($item->category_access, $groups)))
|
||||
{
|
||||
JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
|
||||
return;
|
||||
}
|
||||
|
||||
$options['category_id'] = $item->catid;
|
||||
$options['order by'] = 'a.default_con DESC, a.ordering ASC';
|
||||
|
||||
// Handle email cloaking
|
||||
if ($item->email_to && $params->get('show_email'))
|
||||
{
|
||||
$item->email_to = JHtml::_('email.cloak', $item->email_to);
|
||||
}
|
||||
if ($params->get('show_street_address') || $params->get('show_suburb') || $params->get('show_state') || $params->get('show_postcode') || $params->get('show_country'))
|
||||
{
|
||||
if (!empty ($item->address) || !empty ($item->suburb) || !empty ($item->state) || !empty ($item->country) || !empty ($item->postcode))
|
||||
{
|
||||
$params->set('address_check', 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$params->set('address_check', 0);
|
||||
}
|
||||
|
||||
// Manage the display mode for contact detail groups
|
||||
switch ($params->get('contact_icons'))
|
||||
{
|
||||
case 1 :
|
||||
// text
|
||||
$params->set('marker_address', JText::_('COM_CONTACT_ADDRESS') . ": ");
|
||||
$params->set('marker_email', JText::_('JGLOBAL_EMAIL') . ": ");
|
||||
$params->set('marker_telephone', JText::_('COM_CONTACT_TELEPHONE') . ": ");
|
||||
$params->set('marker_fax', JText::_('COM_CONTACT_FAX') . ": ");
|
||||
$params->set('marker_mobile', JText::_('COM_CONTACT_MOBILE') . ": ");
|
||||
$params->set('marker_misc', JText::_('COM_CONTACT_OTHER_INFORMATION') . ": ");
|
||||
$params->set('marker_class', 'jicons-text');
|
||||
break;
|
||||
|
||||
case 2 :
|
||||
// none
|
||||
$params->set('marker_address', '');
|
||||
$params->set('marker_email', '');
|
||||
$params->set('marker_telephone', '');
|
||||
$params->set('marker_mobile', '');
|
||||
$params->set('marker_fax', '');
|
||||
$params->set('marker_misc', '');
|
||||
$params->set('marker_class', 'jicons-none');
|
||||
break;
|
||||
|
||||
default :
|
||||
// icons
|
||||
$image1 = JHtml::_('image', 'contacts/'.$params->get('icon_address', 'con_address.png'), JText::_('COM_CONTACT_ADDRESS').": ", null, true);
|
||||
$image2 = JHtml::_('image', 'contacts/'.$params->get('icon_email', 'emailButton.png'), JText::_('JGLOBAL_EMAIL').": ", null, true);
|
||||
$image3 = JHtml::_('image', 'contacts/'.$params->get('icon_telephone', 'con_tel.png'), JText::_('COM_CONTACT_TELEPHONE').": ", null, true);
|
||||
$image4 = JHtml::_('image', 'contacts/'.$params->get('icon_fax', 'con_fax.png'), JText::_('COM_CONTACT_FAX').": ", null, true);
|
||||
$image5 = JHtml::_('image', 'contacts/'.$params->get('icon_misc', 'con_info.png'), JText::_('COM_CONTACT_OTHER_INFORMATION').": ", null, true);
|
||||
$image6 = JHtml::_('image', 'contacts/'.$params->get('icon_mobile', 'con_mobile.png'), JText::_('COM_CONTACT_MOBILE').": ", null, true);
|
||||
|
||||
$params->set('marker_address', $image1);
|
||||
$params->set('marker_email', $image2);
|
||||
$params->set('marker_telephone', $image3);
|
||||
$params->set('marker_fax', $image4);
|
||||
$params->set('marker_misc', $image5);
|
||||
$params->set('marker_mobile', $image6);
|
||||
$params->set('marker_class', 'jicons-icons');
|
||||
break;
|
||||
}
|
||||
|
||||
// Add links to contacts
|
||||
if ($params->get('show_contact_list') && count($contacts) > 1)
|
||||
{
|
||||
foreach ($contacts as &$contact)
|
||||
{
|
||||
$contact->link = JRoute::_(ContactHelperRoute::getContactRoute($contact->slug, $contact->catid));
|
||||
}
|
||||
$item->link = JRoute::_(ContactHelperRoute::getContactRoute($item->slug, $item->catid));
|
||||
}
|
||||
|
||||
JHtml::_('behavior.formvalidation');
|
||||
|
||||
//Escape strings for HTML output
|
||||
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
|
||||
|
||||
$this->contact = &$item;
|
||||
$this->params = &$params;
|
||||
$this->return = &$return;
|
||||
$this->state = &$state;
|
||||
$this->item = &$item;
|
||||
$this->user = &$user;
|
||||
$this->contacts = &$contacts;
|
||||
|
||||
$item->tags = new JHelperTags;
|
||||
$item->tags->getItemTags('com_contact.contact', $this->item->id);
|
||||
|
||||
// Override the layout only if this is not the active menu item
|
||||
// If it is the active menu item, then the view and item id will match
|
||||
$active = $app->getMenu()->getActive();
|
||||
if ((!$active) || ((strpos($active->link, 'view=contact') === false) || (strpos($active->link, '&id=' . (string) $this->item->id) === false)))
|
||||
{
|
||||
if ($layout = $params->get('contact_layout'))
|
||||
{
|
||||
$this->setLayout($layout);
|
||||
}
|
||||
}
|
||||
elseif (isset($active->query['layout']))
|
||||
{
|
||||
// We need to set the layout in case this is an alternative menu item (with an alternative layout)
|
||||
$this->setLayout($active->query['layout']);
|
||||
}
|
||||
|
||||
$this->_prepareDocument();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the document
|
||||
*/
|
||||
protected function _prepareDocument()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$menus = $app->getMenu();
|
||||
$pathway = $app->getPathway();
|
||||
$title = null;
|
||||
|
||||
// Because the application sets a default page title,
|
||||
// we need to get it from the menu item itself
|
||||
$menu = $menus->getActive();
|
||||
|
||||
if ($menu)
|
||||
{
|
||||
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->params->def('page_heading', JText::_('COM_CONTACT_DEFAULT_PAGE_TITLE'));
|
||||
}
|
||||
|
||||
$title = $this->params->get('page_title', '');
|
||||
|
||||
$id = (int) @$menu->query['id'];
|
||||
|
||||
// if the menu item does not concern this contact
|
||||
if ($menu && ($menu->query['option'] != 'com_contact' || $menu->query['view'] != 'contact' || $id != $this->item->id))
|
||||
{
|
||||
|
||||
// If this is not a single contact menu item, set the page title to the contact title
|
||||
if ($this->item->name)
|
||||
{
|
||||
$title = $this->item->name;
|
||||
}
|
||||
$path = array(array('title' => $this->contact->name, 'link' => ''));
|
||||
$category = JCategories::getInstance('Contact')->get($this->contact->catid);
|
||||
|
||||
while ($category && ($menu->query['option'] != 'com_contact' || $menu->query['view'] == 'contact' || $id != $category->id) && $category->id > 1)
|
||||
{
|
||||
$path[] = array('title' => $category->title, 'link' => ContactHelperRoute::getCategoryRoute($this->contact->catid));
|
||||
$category = $category->getParent();
|
||||
}
|
||||
|
||||
$path = array_reverse($path);
|
||||
|
||||
foreach ($path as $item)
|
||||
{
|
||||
$pathway->addItem($item['title'], $item['link']);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($title))
|
||||
{
|
||||
$title = $app->getCfg('sitename');
|
||||
}
|
||||
elseif ($app->getCfg('sitename_pagetitles', 0) == 1)
|
||||
{
|
||||
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
|
||||
}
|
||||
elseif ($app->getCfg('sitename_pagetitles', 0) == 2)
|
||||
{
|
||||
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
|
||||
}
|
||||
|
||||
if (empty($title))
|
||||
{
|
||||
$title = $this->item->name;
|
||||
}
|
||||
$this->document->setTitle($title);
|
||||
|
||||
if ($this->item->metadesc)
|
||||
{
|
||||
$this->document->setDescription($this->item->metadesc);
|
||||
}
|
||||
elseif (!$this->item->metadesc && $this->params->get('menu-meta_description'))
|
||||
{
|
||||
$this->document->setDescription($this->params->get('menu-meta_description'));
|
||||
}
|
||||
|
||||
if ($this->item->metakey)
|
||||
{
|
||||
$this->document->setMetadata('keywords', $this->item->metakey);
|
||||
}
|
||||
elseif (!$this->item->metakey && $this->params->get('menu-meta_keywords'))
|
||||
{
|
||||
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
|
||||
}
|
||||
|
||||
if ($this->params->get('robots'))
|
||||
{
|
||||
$this->document->setMetadata('robots', $this->params->get('robots'));
|
||||
}
|
||||
|
||||
$mdata = $this->item->metadata->toArray();
|
||||
|
||||
foreach ($mdata as $k => $v)
|
||||
{
|
||||
if ($v)
|
||||
{
|
||||
$this->document->setMetadata($k, $v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
91
components/com_contact/views/contact/view.vcf.php
Normal file
91
components/com_contact/views/contact/view.vcf.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*/
|
||||
class ContactViewContact extends JViewLegacy
|
||||
{
|
||||
protected $state;
|
||||
|
||||
protected $item;
|
||||
|
||||
public function display()
|
||||
{
|
||||
// Get model data.
|
||||
$item = $this->get('Item');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseWarning(500, implode("\n", $errors));
|
||||
return false;
|
||||
}
|
||||
|
||||
JFactory::getDocument()->setMetaData('Content-Type', 'text/directory', true);
|
||||
|
||||
// Compute lastname, firstname and middlename
|
||||
$item->name = trim($item->name);
|
||||
|
||||
// "Lastname, Firstname Midlename" format support
|
||||
// e.g. "de Gaulle, Charles"
|
||||
$namearray = explode(',', $item->name);
|
||||
if (count($namearray) > 1 )
|
||||
{
|
||||
$lastname = $namearray[0];
|
||||
$card_name = $lastname;
|
||||
$name_and_midname = trim($namearray[1]);
|
||||
|
||||
$firstname = '';
|
||||
if (!empty($name_and_midname))
|
||||
{
|
||||
$namearray = explode(' ', $name_and_midname);
|
||||
|
||||
$firstname = $namearray[0];
|
||||
$middlename = (count($namearray) > 1) ? $namearray[1] : '';
|
||||
$card_name = $firstname . ' ' . ($middlename ? $middlename . ' ' : '') . $card_name;
|
||||
}
|
||||
}
|
||||
// "Firstname Middlename Lastname" format support
|
||||
else {
|
||||
$namearray = explode(' ', $item->name);
|
||||
|
||||
$middlename = (count($namearray) > 2) ? $namearray[1] : '';
|
||||
$firstname = array_shift($namearray);
|
||||
$lastname = count($namearray) ? end($namearray) : '';
|
||||
$card_name = $firstname . ($middlename ? ' ' . $middlename : '') . ($lastname ? ' ' . $lastname : '');
|
||||
}
|
||||
|
||||
$rev = date('c', strtotime($item->modified));
|
||||
|
||||
JResponse::setHeader('Content-disposition', 'attachment; filename="'.$card_name.'.vcf"', true);
|
||||
|
||||
$vcard = array();
|
||||
$vcard[] .= 'BEGIN:VCARD';
|
||||
$vcard[] .= 'VERSION:3.0';
|
||||
$vcard[] = 'N:'.$lastname.';'.$firstname.';'.$middlename;
|
||||
$vcard[] = 'FN:'. $item->name;
|
||||
$vcard[] = 'TITLE:'.$item->con_position;
|
||||
$vcard[] = 'TEL;TYPE=WORK,VOICE:'.$item->telephone;
|
||||
$vcard[] = 'TEL;TYPE=WORK,FAX:'.$item->fax;
|
||||
$vcard[] = 'TEL;TYPE=WORK,MOBILE:'.$item->mobile;
|
||||
$vcard[] = 'ADR;TYPE=WORK:;;'.$item->address.';'.$item->suburb.';'.$item->state.';'.$item->postcode.';'.$item->country;
|
||||
$vcard[] = 'LABEL;TYPE=WORK:'.$item->address."\n".$item->suburb."\n".$item->state."\n".$item->postcode."\n".$item->country;
|
||||
$vcard[] = 'EMAIL;TYPE=PREF,INTERNET:'.$item->email_to;
|
||||
$vcard[] = 'URL:'.$item->webpage;
|
||||
$vcard[] = 'REV:'.$rev.'Z';
|
||||
$vcard[] = 'END:VCARD';
|
||||
|
||||
echo implode("\n", $vcard);
|
||||
return true;
|
||||
}
|
||||
}
|
1
components/com_contact/views/featured/index.html
Normal file
1
components/com_contact/views/featured/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
6
components/com_contact/views/featured/metadata.xml
Normal file
6
components/com_contact/views/featured/metadata.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<view title="Frontpage">
|
||||
<message><![CDATA[TYPEFEATUREDCONTACTLAYDESC]]></message>
|
||||
</view>
|
||||
</metadata>
|
37
components/com_contact/views/featured/tmpl/default.php
Normal file
37
components/com_contact/views/featured/tmpl/default.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
|
||||
|
||||
// If the page class is defined, add to class as suffix.
|
||||
// It will be a separate class if the user starts it with a space
|
||||
?>
|
||||
<div class="blog-featured<?php echo $this->pageclass_sfx;?>">
|
||||
<?php if ($this->params->get('show_page_heading') != 0 ) : ?>
|
||||
<h1>
|
||||
<?php echo $this->escape($this->params->get('page_heading')); ?>
|
||||
</h1>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $this->loadTemplate('items'); ?>
|
||||
<?php if ($this->params->def('show_pagination', 2) == 1 || ($this->params->get('show_pagination') == 2 && $this->pagination->pagesTotal > 1)) : ?>
|
||||
<div class="pagination">
|
||||
|
||||
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
|
||||
<p class="counter">
|
||||
<?php echo $this->pagination->getPagesCounter(); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php echo $this->pagination->getPagesLinks(); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
406
components/com_contact/views/featured/tmpl/default.xml
Normal file
406
components/com_contact/views/featured/tmpl/default.xml
Normal file
@ -0,0 +1,406 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<metadata>
|
||||
<layout title="com_contact_featured_view_default_title" option="com_contact_featured_view_default_option">
|
||||
<help
|
||||
key = "JHELP_MENUS_MENU_ITEM_CONTACT_FEATURED"
|
||||
/>
|
||||
<message>
|
||||
<![CDATA[COM_CONTACT_FEATURED_VIEW_DEFAULT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Add fields to the parameters object for the layout. -->
|
||||
<fields name="params">
|
||||
<fieldset name="advanced" label="JGLOBAL_LIST_LAYOUT_OPTIONS">
|
||||
|
||||
<field name="spacer" type="spacer" class="text"
|
||||
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
|
||||
/>
|
||||
|
||||
<field name="show_pagination_limit" type="list"
|
||||
description="JGLOBAL_DISPLAY_SELECT_DESC"
|
||||
label="JGLOBAL_DISPLAY_SELECT_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_headings" type="list"
|
||||
description="JGLOBAL_SHOW_HEADINGS_DESC"
|
||||
label="JGLOBAL_SHOW_HEADINGS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_position_headings" type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_POSITION_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_POSITION_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_email_headings" type="list"
|
||||
label="JGLOBAL_EMAIL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_EMAIL_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_telephone_headings"
|
||||
type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_PHONE_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_PHONE_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_mobile_headings"
|
||||
type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_MOBILE_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_MOBILE_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_fax_headings"
|
||||
type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_FAX_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_FAX_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_suburb_headings" type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_SUBURB_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_SUBURB_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_state_headings"
|
||||
type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_STATE_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_STATE_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_country_headings"
|
||||
type="list"
|
||||
label="COM_CONTACT_FIELD_CONFIG_COUNTRY_LABEL"
|
||||
description="COM_CONTACT_FIELD_CONFIG_COUNTRY_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_pagination" type="list"
|
||||
description="JGLOBAL_PAGINATION_DESC"
|
||||
label="JGLOBAL_PAGINATION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">JGLOBAL_AUTO</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_pagination_results"
|
||||
type="list"
|
||||
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
|
||||
description="JGLOBAL_PAGINATION_RESULTS_DESC">
|
||||
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="contact" label="COM_CONTACT_FIELDSET_CONTACT_LABEL">
|
||||
|
||||
<field name="presentation_style" type="list"
|
||||
description="COM_CONTACT_FIELD_PRESENTATION_DESC"
|
||||
label="COM_CONTACT_FIELD_PRESENTATION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="sliders">COM_CONTACT_FIELD_VALUE_SLIDERS</option>
|
||||
<option value="tabs">COM_CONTACT_FIELD_VALUE_TABS</option>
|
||||
<option value="plain">COM_CONTACT_FIELD_VALUE_PLAIN</option>
|
||||
</field>
|
||||
<field name="show_name" type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_NAME_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_position" type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
|
||||
</field>
|
||||
|
||||
<field name="show_email" type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_CONTACT_E_MAIL_DESC"
|
||||
label="JGLOBAL_EMAIL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_street_address" type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_suburb" type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_state" type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_postcode" type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_country" type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_COUNTRY_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_COUNTRY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_telephone" type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_TELEPHONE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_TELEPHONE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_mobile" type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_MOBILE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_MOBILE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_fax" type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_FAX_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_FAX_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_webpage" type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_WEBPAGE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_WEBPAGE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_misc" type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_MISC_INFO_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_MISC_INFO_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_image" type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_IMAGE_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_IMAGE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="allow_vcard" type="list"
|
||||
description="COM_CONTACT_FIELD_PARAMS_VCARD_DESC"
|
||||
label="COM_CONTACT_FIELD_PARAMS_VCARD_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_articles" type="list"
|
||||
description="COM_CONTACT_FIELD_ARTICLES_SHOW_DESC"
|
||||
label="COM_CONTACT_FIELD_ARTICLES_SHOW_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_links" type="list"
|
||||
description="COM_CONTACT_FIELD_SHOW_LINKS_DESC"
|
||||
label="COM_CONTACT_FIELD_SHOW_LINKS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="linka_name" type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKA_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linkb_name" type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKB_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linkc_name" type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKC_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linkd_name" type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKD_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field name="linke_name" type="text"
|
||||
description="COM_CONTACT_FIELD_LINK_NAME_DESC"
|
||||
label="COM_CONTACT_FIELD_LINKE_NAME_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="Contact_Form" label="COM_CONTACT_FIELDSET_CONTACTFORM_LABEL">
|
||||
|
||||
<field name="show_email_form" type="list"
|
||||
description="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_DESC"
|
||||
label="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_email_copy" type="list"
|
||||
description="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_DESC"
|
||||
label="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="banned_email" type="textarea"
|
||||
cols="30"
|
||||
description="COM_CONTACT_FIELD_CONFIG_BANNED_EMAIL_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_BANNED_EMAIL_LABEL"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field name="banned_subject" type="textarea"
|
||||
cols="30"
|
||||
description="COM_CONTACT_FIELD_CONFIG_BANNED_SUBJECT_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_BANNED_SUBJECT_LABEL"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field name="banned_text" type="textarea"
|
||||
cols="30"
|
||||
description="COM_CONTACT_FIELD_CONFIG_BANNED_TEXT_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_BANNED_TEXT_LABEL"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field name="validate_session" type="list"
|
||||
description="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="custom_reply" type="list"
|
||||
description="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="redirect" type="text"
|
||||
description="COM_CONTACT_FIELD_CONFIG_REDIRECT_DESC"
|
||||
label="COM_CONTACT_FIELD_CONFIG_REDIRECT_LABEL"
|
||||
size="30"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
</fields>
|
||||
</metadata>
|
165
components/com_contact/views/featured/tmpl/default_items.php
Normal file
165
components/com_contact/views/featured/tmpl/default_items.php
Normal file
@ -0,0 +1,165 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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::_('behavior.framework');
|
||||
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
|
||||
// Create a shortcut for params.
|
||||
$params = &$this->item->params;
|
||||
?>
|
||||
|
||||
<?php if (empty($this->items)) : ?>
|
||||
<p> <?php echo JText::_('COM_CONTACT_NO_CONTACTS'); ?> </p>
|
||||
<?php else : ?>
|
||||
|
||||
<form action="<?php echo htmlspecialchars(JUri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<fieldset class="filters">
|
||||
<legend class="hidelabeltxt"><?php echo JText::_('JGLOBAL_FILTER_LABEL'); ?></legend>
|
||||
<?php if ($this->params->get('show_pagination_limit')) : ?>
|
||||
<div class="display-limit">
|
||||
<?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?> 
|
||||
<?php echo $this->pagination->getLimitBox(); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
|
||||
</fieldset>
|
||||
|
||||
<table class="category">
|
||||
<?php if ($this->params->get('show_headings')) : ?>
|
||||
<thead><tr>
|
||||
<th class="item-num">
|
||||
<?php echo JText::_('JGLOBAL_NUM'); ?>
|
||||
</th>
|
||||
<th class="item-title">
|
||||
<?php echo JHtml::_('grid.sort', 'COM_CONTACT_CONTACT_EMAIL_NAME_LABEL', 'a.name', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php if ($this->params->get('show_position_headings')) : ?>
|
||||
<th class="item-position">
|
||||
<?php echo JHtml::_('grid.sort', 'COM_CONTACT_POSITION', 'a.con_position', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('show_email_headings')) : ?>
|
||||
<th class="item-email">
|
||||
<?php echo JText::_('JGLOBAL_EMAIL'); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('show_telephone_headings')) : ?>
|
||||
<th class="item-phone">
|
||||
<?php echo JText::_('COM_CONTACT_TELEPHONE'); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_mobile_headings')) : ?>
|
||||
<th class="item-phone">
|
||||
<?php echo JText::_('COM_CONTACT_MOBILE'); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_fax_headings')) : ?>
|
||||
<th class="item-phone">
|
||||
<?php echo JText::_('COM_CONTACT_FAX'); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_suburb_headings')) : ?>
|
||||
<th class="item-suburb">
|
||||
<?php echo JHtml::_('grid.sort', 'COM_CONTACT_SUBURB', 'a.suburb', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_state_headings')) : ?>
|
||||
<th class="item-state">
|
||||
<?php echo JHtml::_('grid.sort', 'COM_CONTACT_STATE', 'a.state', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_country_headings')) : ?>
|
||||
<th class="item-state">
|
||||
<?php echo JHtml::_('grid.sort', 'COM_CONTACT_COUNTRY', 'a.country', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<?php endif; ?>
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($this->items as $i => $item) : ?>
|
||||
<tr class="<?php echo ($i % 2) ? "odd" : "even"; ?>">
|
||||
<td class="item-num">
|
||||
<?php echo $i; ?>
|
||||
</td>
|
||||
|
||||
<td class="item-title">
|
||||
<?php if ($this->items[$i]->published == 0) : ?>
|
||||
<span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span>
|
||||
<?php endif; ?>
|
||||
<a href="<?php echo JRoute::_(ContactHelperRoute::getContactRoute($item->slug, $item->catid)); ?>">
|
||||
<?php echo $item->name; ?></a>
|
||||
</td>
|
||||
|
||||
<?php if ($this->params->get('show_position_headings')) : ?>
|
||||
<td class="item-position">
|
||||
<?php echo $item->con_position; ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_email_headings')) : ?>
|
||||
<td class="item-email">
|
||||
<?php echo $item->email_to; ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_telephone_headings')) : ?>
|
||||
<td class="item-phone">
|
||||
<?php echo $item->telephone; ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_mobile_headings')) : ?>
|
||||
<td class="item-phone">
|
||||
<?php echo $item->mobile; ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_fax_headings')) : ?>
|
||||
<td class="item-phone">
|
||||
<?php echo $item->fax; ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_suburb_headings')) : ?>
|
||||
<td class="item-suburb">
|
||||
<?php echo $item->suburb; ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_state_headings')) : ?>
|
||||
<td class="item-state">
|
||||
<?php echo $item->state; ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_country_headings')) : ?>
|
||||
<td class="item-state">
|
||||
<?php echo $item->country; ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
<?php endif; ?>
|
1
components/com_contact/views/featured/tmpl/index.html
Normal file
1
components/com_contact/views/featured/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
147
components/com_contact/views/featured/view.html.php
Normal file
147
components/com_contact/views/featured/view.html.php
Normal file
@ -0,0 +1,147 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Frontpage View class
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_contact
|
||||
* @since 1.6
|
||||
*/
|
||||
class ContactViewFeatured extends JViewLegacy
|
||||
{
|
||||
protected $state;
|
||||
|
||||
protected $items;
|
||||
|
||||
protected $category;
|
||||
|
||||
protected $categories;
|
||||
|
||||
protected $pagination;
|
||||
|
||||
/**
|
||||
* Display the view
|
||||
*
|
||||
* @return mixed False on error, null otherwise.
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$params = $app->getParams();
|
||||
|
||||
// Get some data from the models
|
||||
$state = $this->get('State');
|
||||
$items = $this->get('Items');
|
||||
$category = $this->get('Category');
|
||||
$children = $this->get('Children');
|
||||
$parent = $this->get('Parent');
|
||||
$pagination = $this->get('Pagination');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseWarning(500, implode("\n", $errors));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prepare the data.
|
||||
// Compute the contact slug.
|
||||
for ($i = 0, $n = count($items); $i < $n; $i++)
|
||||
{
|
||||
$item = &$items[$i];
|
||||
$item->slug = $item->alias ? ($item->id.':'.$item->alias) : $item->id;
|
||||
$temp = new JRegistry;
|
||||
$temp->loadString($item->params);
|
||||
$item->params = clone($params);
|
||||
$item->params->merge($temp);
|
||||
if ($item->params->get('show_email', 0) == 1)
|
||||
{
|
||||
$item->email_to = trim($item->email_to);
|
||||
if (!empty($item->email_to) && JMailHelper::isEmailAddress($item->email_to))
|
||||
{
|
||||
$item->email_to = JHtml::_('email.cloak', $item->email_to);
|
||||
} else {
|
||||
$item->email_to = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Escape strings for HTML output
|
||||
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
|
||||
|
||||
$maxLevel = $params->get('maxLevel', -1);
|
||||
$this->maxLevel = &$maxLevel;
|
||||
$this->state = &$state;
|
||||
$this->items = &$items;
|
||||
$this->category = &$category;
|
||||
$this->children = &$children;
|
||||
$this->params = &$params;
|
||||
$this->parent = &$parent;
|
||||
$this->pagination = &$pagination;
|
||||
|
||||
$this->_prepareDocument();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the document
|
||||
*/
|
||||
protected function _prepareDocument()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$menus = $app->getMenu();
|
||||
$title = null;
|
||||
|
||||
// Because the application sets a default page title,
|
||||
// we need to get it from the menu item itself
|
||||
$menu = $menus->getActive();
|
||||
if ($menu)
|
||||
{
|
||||
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->params->def('page_heading', JText::_('COM_CONTACT_DEFAULT_PAGE_TITLE'));
|
||||
}
|
||||
|
||||
$title = $this->params->get('page_title', '');
|
||||
if (empty($title))
|
||||
{
|
||||
$title = $app->getCfg('sitename');
|
||||
}
|
||||
elseif ($app->getCfg('sitename_pagetitles', 0) == 1)
|
||||
{
|
||||
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
|
||||
}
|
||||
elseif ($app->getCfg('sitename_pagetitles', 0) == 2)
|
||||
{
|
||||
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
|
||||
}
|
||||
$this->document->setTitle($title);
|
||||
|
||||
if ($this->params->get('menu-meta_description'))
|
||||
{
|
||||
$this->document->setDescription($this->params->get('menu-meta_description'));
|
||||
}
|
||||
|
||||
if ($this->params->get('menu-meta_keywords'))
|
||||
{
|
||||
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
|
||||
}
|
||||
|
||||
if ($this->params->get('robots'))
|
||||
{
|
||||
$this->document->setMetadata('robots', $this->params->get('robots'));
|
||||
}
|
||||
}
|
||||
}
|
1
components/com_contact/views/index.html
Normal file
1
components/com_contact/views/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
17
components/com_content/content.php
Normal file
17
components/com_content/content.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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.'/helpers/route.php';
|
||||
require_once JPATH_COMPONENT.'/helpers/query.php';
|
||||
|
||||
$controller = JControllerLegacy::getInstance('Content');
|
||||
$controller->execute(JFactory::getApplication()->input->get('task'));
|
||||
$controller->redirect();
|
83
components/com_content/controller.php
Normal file
83
components/com_content/controller.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Content Component Controller
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_content
|
||||
* @since 1.5
|
||||
*/
|
||||
class ContentController extends JControllerLegacy
|
||||
{
|
||||
public function __construct($config = array())
|
||||
{
|
||||
$this->input = JFactory::getApplication()->input;
|
||||
|
||||
// Article frontpage Editor pagebreak proxying:
|
||||
if ($this->input->get('view') === 'article' && $this->input->get('layout') === 'pagebreak')
|
||||
{
|
||||
$config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
|
||||
}
|
||||
// Article frontpage Editor article proxying:
|
||||
elseif ($this->input->get('view') === 'articles' && $this->input->get('layout') === 'modal')
|
||||
{
|
||||
JHtml::_('stylesheet', 'system/adminlist.css', array(), true);
|
||||
$config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to display a view.
|
||||
*
|
||||
* @param boolean If true, the view output will be cached
|
||||
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
|
||||
*
|
||||
* @return JController This object to support chaining.
|
||||
* @since 1.5
|
||||
*/
|
||||
public function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
$cachable = true;
|
||||
|
||||
// Set the default view name and format from the Request.
|
||||
// Note we are using a_id to avoid collisions with the router and the return page.
|
||||
// Frontend is a bit messier than the backend.
|
||||
$id = $this->input->getInt('a_id');
|
||||
$vName = $this->input->getCmd('view', 'categories');
|
||||
$this->input->set('view', $vName);
|
||||
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if ($user->get('id') ||
|
||||
($this->input->getMethod() == 'POST' &&
|
||||
(($vName == 'category' && $this->input->get('layout') != 'blog') || $vName == 'archive' )))
|
||||
{
|
||||
$cachable = false;
|
||||
}
|
||||
|
||||
$safeurlparams = array('catid' => 'INT', 'id' => 'INT', 'cid' => 'ARRAY', 'year' => 'INT', 'month' => 'INT', 'limit' => 'UINT', 'limitstart' => 'UINT',
|
||||
'showall' => 'INT', 'return' => 'BASE64', 'filter' => 'STRING', 'filter_order' => 'CMD', 'filter_order_Dir' => 'CMD', 'filter-search' => 'STRING', 'print' => 'BOOLEAN', 'lang' => 'CMD', 'Itemid' => 'INT');
|
||||
|
||||
// Check for edit form.
|
||||
if ($vName == 'form' && !$this->checkEditId('com_content.edit.article', $id))
|
||||
{
|
||||
// Somehow the person just went to the form - we don't allow that.
|
||||
return JError::raiseError(403, JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
|
||||
}
|
||||
|
||||
parent::display($cachable, $safeurlparams);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
337
components/com_content/controllers/article.php
Normal file
337
components/com_content/controllers/article.php
Normal file
@ -0,0 +1,337 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_content
|
||||
*/
|
||||
class ContentControllerArticle extends JControllerForm
|
||||
{
|
||||
/**
|
||||
* The URL view item variable.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $view_item = 'form';
|
||||
|
||||
/**
|
||||
* The URL view list variable.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $view_list = 'categories';
|
||||
|
||||
/**
|
||||
* Method to add a new record.
|
||||
*
|
||||
* @return mixed True if the record can be added, a error object if not.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if (!parent::add())
|
||||
{
|
||||
// Redirect to the return page.
|
||||
$this->setRedirect($this->getReturnPage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override 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();
|
||||
$categoryId = JArrayHelper::getValue($data, 'catid', $this->input->getInt('catid'), 'int');
|
||||
$allow = null;
|
||||
|
||||
if ($categoryId)
|
||||
{
|
||||
// If the category has been passed in the data or URL check it.
|
||||
$allow = $user->authorise('core.create', 'com_content.category.'.$categoryId);
|
||||
}
|
||||
|
||||
if ($allow === null)
|
||||
{
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return parent::allowAdd();
|
||||
}
|
||||
else
|
||||
{
|
||||
return $allow;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key; default is id.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
{
|
||||
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
|
||||
$user = JFactory::getUser();
|
||||
$userId = $user->get('id');
|
||||
$asset = 'com_content.article.' . $recordId;
|
||||
|
||||
// Check general edit permission first.
|
||||
if ($user->authorise('core.edit', $asset))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Fallback on edit.own.
|
||||
// First test if the permission is available.
|
||||
if ($user->authorise('core.edit.own', $asset))
|
||||
{
|
||||
// Now test the owner is the user.
|
||||
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 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_by;
|
||||
}
|
||||
|
||||
// If the owner matches 'me' then do the test.
|
||||
if ($ownerId == $userId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Since there is no asset tracking, revert to the component permissions.
|
||||
return parent::allowEdit($data, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to cancel an edit.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
*
|
||||
* @return boolean True if access level checks pass, false otherwise.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function cancel($key = 'a_id')
|
||||
{
|
||||
parent::cancel($key);
|
||||
|
||||
// Redirect to the return page.
|
||||
$this->setRedirect($this->getReturnPage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to edit an existing record.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
* @param string $urlVar The name of the URL variable if different from the primary key
|
||||
* (sometimes required to avoid router collisions).
|
||||
*
|
||||
* @return boolean True if access level check and checkout passes, false otherwise.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function edit($key = null, $urlVar = 'a_id')
|
||||
{
|
||||
$result = parent::edit($key, $urlVar);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a model object, loading it if required.
|
||||
*
|
||||
* @param string $name The model name. Optional.
|
||||
* @param string $prefix The class prefix. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return object The model.
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public function getModel($name = 'form', $prefix = '', $config = array('ignore_request' => true))
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, $config);
|
||||
|
||||
return $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 = 'a_id')
|
||||
{
|
||||
// Need to override the parent method completely.
|
||||
$tmpl = $this->input->get('tmpl');
|
||||
// $layout = $this->input->get('layout', 'edit');
|
||||
$append = '';
|
||||
|
||||
// Setup redirect info.
|
||||
if ($tmpl)
|
||||
{
|
||||
$append .= '&tmpl='.$tmpl;
|
||||
}
|
||||
|
||||
// TODO This is a bandaid, not a long term solution.
|
||||
// if ($layout)
|
||||
// {
|
||||
// $append .= '&layout=' . $layout;
|
||||
// }
|
||||
$append .= '&layout=edit';
|
||||
|
||||
if ($recordId)
|
||||
{
|
||||
$append .= '&'.$urlVar.'='.$recordId;
|
||||
}
|
||||
|
||||
$itemId = $this->input->getInt('Itemid');
|
||||
$return = $this->getReturnPage();
|
||||
$catId = $this->input->getInt('catid', null, 'get');
|
||||
|
||||
if ($itemId)
|
||||
{
|
||||
$append .= '&Itemid='.$itemId;
|
||||
}
|
||||
|
||||
if ($catId)
|
||||
{
|
||||
$append .= '&catid='.$catId;
|
||||
}
|
||||
|
||||
if ($return)
|
||||
{
|
||||
$append .= '&return='.base64_encode($return);
|
||||
}
|
||||
|
||||
return $append;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the return URL.
|
||||
*
|
||||
* If a "return" variable has been passed in the request
|
||||
*
|
||||
* @return string The return URL.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getReturnPage()
|
||||
{
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
|
||||
if (empty($return) || !JUri::isInternal(base64_decode($return)))
|
||||
{
|
||||
return JUri::base();
|
||||
}
|
||||
else
|
||||
{
|
||||
return base64_decode($return);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that allows child controller access to model data after the data has been saved.
|
||||
*
|
||||
* @param JModelLegacy $model The data model object.
|
||||
* @param array $validData The validated data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function postSaveHook(JModelLegacy $model, $validData = array())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save a record.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||
*
|
||||
* @return boolean True if successful, false otherwise.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function save($key = null, $urlVar = 'a_id')
|
||||
{
|
||||
$result = parent::save($key, $urlVar);
|
||||
|
||||
// If ok, redirect to the return page.
|
||||
if ($result)
|
||||
{
|
||||
$this->setRedirect($this->getReturnPage());
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save a vote.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function vote()
|
||||
{
|
||||
// Check for request forgeries.
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$user_rating = $this->input->getInt('user_rating', -1);
|
||||
|
||||
if ($user_rating > -1)
|
||||
{
|
||||
$url = $this->input->getString('url', '');
|
||||
$id = $this->input->getInt('id', 0);
|
||||
$viewName = $this->input->getString('view', $this->default_view);
|
||||
$model = $this->getModel($viewName);
|
||||
|
||||
if ($model->storeVote($id, $user_rating))
|
||||
{
|
||||
$this->setRedirect($url, JText::_('COM_CONTENT_ARTICLE_VOTE_SUCCESS'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirect($url, JText::_('COM_CONTENT_ARTICLE_VOTE_FAILURE'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1
components/com_content/controllers/index.html
Normal file
1
components/com_content/controllers/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
69
components/com_content/helpers/association.php
Normal file
69
components/com_content/helpers/association.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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;
|
||||
|
||||
JLoader::register('ContentHelper', JPATH_ADMINISTRATOR . '/components/com_content/helpers/content.php');
|
||||
JLoader::register('CategoryHelperAssociation', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/association.php');
|
||||
|
||||
/**
|
||||
* Content Component Association Helper
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_content
|
||||
* @since 3.0
|
||||
*/
|
||||
abstract class ContentHelperAssociation extends CategoryHelperAssociation
|
||||
{
|
||||
/**
|
||||
* Method to get the associations for a given item
|
||||
*
|
||||
* @param integer $id Id of the item
|
||||
* @param string $view Name of the view
|
||||
*
|
||||
* @return array Array of associations for the item
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
|
||||
public static function getAssociations($id = 0, $view = null)
|
||||
{
|
||||
jimport('helper.route', JPATH_COMPONENT_SITE);
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
$view = is_null($view) ? $jinput->get('view') : $view;
|
||||
$id = empty($id) ? $jinput->getInt('id') : $id;
|
||||
|
||||
if ($view == 'article')
|
||||
{
|
||||
if ($id)
|
||||
{
|
||||
$associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $id);
|
||||
|
||||
$return = array();
|
||||
|
||||
foreach ($associations as $tag => $item)
|
||||
{
|
||||
$return[$tag] = ContentHelperRoute::getArticleRoute($item->id, $item->catid, $item->language);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($view == 'category' || $view == 'categories')
|
||||
{
|
||||
return self::getCategoryAssociations($id, 'com_content');
|
||||
}
|
||||
|
||||
return array();
|
||||
|
||||
}
|
||||
}
|
28
components/com_content/helpers/category.php
Normal file
28
components/com_content/helpers/category.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Content Component Category Tree
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_content
|
||||
* @since 1.6
|
||||
*/
|
||||
class ContentCategories extends JCategories
|
||||
{
|
||||
public function __construct($options = array())
|
||||
{
|
||||
$options['table'] = '#__content';
|
||||
$options['extension'] = 'com_content';
|
||||
|
||||
parent::__construct($options);
|
||||
}
|
||||
}
|
274
components/com_content/helpers/icon.php
Normal file
274
components/com_content/helpers/icon.php
Normal file
@ -0,0 +1,274 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Content Component HTML Helper
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_content
|
||||
* @since 1.5
|
||||
*/
|
||||
abstract class JHtmlIcon
|
||||
{
|
||||
/**
|
||||
* Method to generate a link to the create item page for the given category
|
||||
*
|
||||
* @param object $category The category information
|
||||
* @param JRegistry $params The item parameters
|
||||
* @param array $attribs Optional attributes for the link
|
||||
* @param boolean $legacy True to use legacy images, false to use icomoon based graphic
|
||||
*
|
||||
* @return string The HTML markup for the create item link
|
||||
*/
|
||||
public static function create($category, $params, $attribs = array(), $legacy = false)
|
||||
{
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
|
||||
$uri = JUri::getInstance();
|
||||
|
||||
$url = 'index.php?option=com_content&task=article.add&return=' . base64_encode($uri) . '&a_id=0&catid=' . $category->id;
|
||||
|
||||
if ($params->get('show_icons'))
|
||||
{
|
||||
if ($legacy)
|
||||
{
|
||||
$text = JHtml::_('image', 'system/new.png', JText::_('JNEW'), null, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = '<span class="icon-plus"></span> ' . JText::_('JNEW') . ' ';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = JText::_('JNEW') . ' ';
|
||||
}
|
||||
|
||||
// Add the button classes to the attribs array
|
||||
if (isset($attribs['class']))
|
||||
{
|
||||
$attribs['class'] = $attribs['class'] . ' btn btn-primary';
|
||||
}
|
||||
else
|
||||
{
|
||||
$attribs['class'] = 'btn btn-primary';
|
||||
}
|
||||
|
||||
$button = JHtml::_('link', JRoute::_($url), $text, $attribs);
|
||||
|
||||
$output = '<span class="hasTooltip" title="' . JHtml::tooltipText('COM_CONTENT_CREATE_ARTICLE') . '">' . $button . '</span>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a link to the email item page for the given article
|
||||
*
|
||||
* @param object $article The article information
|
||||
* @param JRegistry $params The item parameters
|
||||
* @param array $attribs Optional attributes for the link
|
||||
* @param boolean $legacy True to use legacy images, false to use icomoon based graphic
|
||||
*
|
||||
* @return string The HTML markup for the email item link
|
||||
*/
|
||||
public static function email($article, $params, $attribs = array(), $legacy = false)
|
||||
{
|
||||
require_once JPATH_SITE . '/components/com_mailto/helpers/mailto.php';
|
||||
|
||||
$uri = JUri::getInstance();
|
||||
$base = $uri->toString(array('scheme', 'host', 'port'));
|
||||
$template = JFactory::getApplication()->getTemplate();
|
||||
$link = $base . JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catid), false);
|
||||
$url = 'index.php?option=com_mailto&tmpl=component&template=' . $template . '&link=' . MailToHelper::addLink($link);
|
||||
|
||||
$status = 'width=400,height=350,menubar=yes,resizable=yes';
|
||||
|
||||
if ($params->get('show_icons'))
|
||||
{
|
||||
if ($legacy)
|
||||
{
|
||||
$text = JHtml::_('image', 'system/emailButton.png', JText::_('JGLOBAL_EMAIL'), null, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = '<span class="icon-envelope"></span> ' . JText::_('JGLOBAL_EMAIL');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = JText::_('JGLOBAL_EMAIL');
|
||||
}
|
||||
|
||||
$attribs['title'] = JText::_('JGLOBAL_EMAIL');
|
||||
$attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;";
|
||||
|
||||
$output = JHtml::_('link', JRoute::_($url), $text, $attribs);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display an edit icon for the article.
|
||||
*
|
||||
* This icon will not display in a popup window, nor if the article is trashed.
|
||||
* Edit access checks must be performed in the calling code.
|
||||
*
|
||||
* @param object $article The article information
|
||||
* @param JRegistry $params The item parameters
|
||||
* @param array $attribs Optional attributes for the link
|
||||
* @param boolean $legacy True to use legacy images, false to use icomoon based graphic
|
||||
*
|
||||
* @return string The HTML for the article edit icon.
|
||||
* @since 1.6
|
||||
*/
|
||||
public static function edit($article, $params, $attribs = array(), $legacy = false)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$uri = JUri::getInstance();
|
||||
|
||||
// Ignore if in a popup window.
|
||||
if ($params && $params->get('popup'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignore if the state is negative (trashed).
|
||||
if ($article->state < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
|
||||
// Show checked_out icon if the article is checked out by a different user
|
||||
if (property_exists($article, 'checked_out') && property_exists($article, 'checked_out_time') && $article->checked_out > 0 && $article->checked_out != $user->get('id'))
|
||||
{
|
||||
$checkoutUser = JFactory::getUser($article->checked_out);
|
||||
$button = JHtml::_('image', 'system/checked_out.png', null, null, true);
|
||||
$date = JHtml::_('date', $article->checked_out_time);
|
||||
$tooltip = JText::_('JLIB_HTML_CHECKED_OUT') . ' :: ' . JText::sprintf('COM_CONTENT_CHECKED_OUT_BY', $checkoutUser->name) . ' <br /> ' . $date;
|
||||
|
||||
return '<span class="hasTooltip" title="' . JHtml::tooltipText($tooltip. '', 0) . '">' . $button . '</span>';
|
||||
}
|
||||
|
||||
$url = 'index.php?option=com_content&task=article.edit&a_id=' . $article->id . '&return=' . base64_encode($uri);
|
||||
|
||||
if ($article->state == 0)
|
||||
{
|
||||
$overlib = JText::_('JUNPUBLISHED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$overlib = JText::_('JPUBLISHED');
|
||||
}
|
||||
|
||||
$date = JHtml::_('date', $article->created);
|
||||
$author = $article->created_by_alias ? $article->created_by_alias : $article->author;
|
||||
|
||||
$overlib .= '<br />';
|
||||
$overlib .= $date;
|
||||
$overlib .= '<br />';
|
||||
$overlib .= JText::sprintf('COM_CONTENT_WRITTEN_BY', htmlspecialchars($author, ENT_COMPAT, 'UTF-8'));
|
||||
|
||||
if ($legacy)
|
||||
{
|
||||
$icon = $article->state ? 'edit.png' : 'edit_unpublished.png';
|
||||
$text = JHtml::_('image', 'system/' . $icon, JText::_('JGLOBAL_EDIT'), null, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$icon = $article->state ? 'edit' : 'eye-close';
|
||||
$text = '<span class="hasTooltip icon-' . $icon . ' tip" title="' . JHtml::tooltipText(JText::_('COM_CONTENT_EDIT_ITEM'), $overlib, 0) . '"></span> ' . JText::_('JGLOBAL_EDIT') . ' ';
|
||||
}
|
||||
|
||||
$output = JHtml::_('link', JRoute::_($url), $text, $attribs);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a popup link to print an article
|
||||
*
|
||||
* @param object $article The article information
|
||||
* @param JRegistry $params The item parameters
|
||||
* @param array $attribs Optional attributes for the link
|
||||
* @param boolean $legacy True to use legacy images, false to use icomoon based graphic
|
||||
*
|
||||
* @return string The HTML markup for the popup link
|
||||
*/
|
||||
public static function print_popup($article, $params, $attribs = array(), $legacy = false)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$input = $app->input;
|
||||
$request = $input->request;
|
||||
|
||||
$url = ContentHelperRoute::getArticleRoute($article->slug, $article->catid);
|
||||
$url .= '&tmpl=component&print=1&layout=default&page=' . @ $request->limitstart;
|
||||
|
||||
$status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';
|
||||
|
||||
// checks template image directory for image, if non found default are loaded
|
||||
if ($params->get('show_icons'))
|
||||
{
|
||||
if ($legacy)
|
||||
{
|
||||
$text = JHtml::_('image', 'system/printButton.png', JText::_('JGLOBAL_PRINT'), null, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = '<span class="icon-print"></span> ' . JText::_('JGLOBAL_PRINT') . ' ';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = JText::_('JGLOBAL_PRINT');
|
||||
}
|
||||
|
||||
$attribs['title'] = JText::_('JGLOBAL_PRINT');
|
||||
$attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;";
|
||||
$attribs['rel'] = 'nofollow';
|
||||
|
||||
return JHtml::_('link', JRoute::_($url), $text, $attribs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a link to print an article
|
||||
*
|
||||
* @param object $article Not used, @deprecated for 4.0
|
||||
* @param JRegistry $params The item parameters
|
||||
* @param array $attribs Not used, @deprecated for 4.0
|
||||
* @param boolean $legacy True to use legacy images, false to use icomoon based graphic
|
||||
*
|
||||
* @return string The HTML markup for the popup link
|
||||
*/
|
||||
public static function print_screen($article, $params, $attribs = array(), $legacy = false)
|
||||
{
|
||||
// Checks template image directory for image, if none found default are loaded
|
||||
if ($params->get('show_icons'))
|
||||
{
|
||||
if ($legacy)
|
||||
{
|
||||
$text = JHtml::_('image', 'system/printButton.png', JText::_('JGLOBAL_PRINT'), null, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = '<span class="icon-print"></span> ' . JText::_('JGLOBAL_PRINT') . ' ';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = JText::_('JGLOBAL_PRINT');
|
||||
}
|
||||
|
||||
return '<a href="#" onclick="window.print();return false;">' . $text . '</a>';
|
||||
}
|
||||
|
||||
}
|
1
components/com_content/helpers/index.html
Normal file
1
components/com_content/helpers/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
267
components/com_content/helpers/query.php
Normal file
267
components/com_content/helpers/query.php
Normal file
@ -0,0 +1,267 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Content Component Query Helper
|
||||
*
|
||||
* @static
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_content
|
||||
* @since 1.5
|
||||
*/
|
||||
class ContentHelperQuery
|
||||
{
|
||||
/**
|
||||
* Translate an order code to a field for primary category ordering.
|
||||
*
|
||||
* @param string $orderby The ordering code.
|
||||
*
|
||||
* @return string The SQL field(s) to order by.
|
||||
* @since 1.5
|
||||
*/
|
||||
public static function orderbyPrimary($orderby)
|
||||
{
|
||||
switch ($orderby)
|
||||
{
|
||||
case 'alpha' :
|
||||
$orderby = 'c.path, ';
|
||||
break;
|
||||
|
||||
case 'ralpha' :
|
||||
$orderby = 'c.path DESC, ';
|
||||
break;
|
||||
|
||||
case 'order' :
|
||||
$orderby = 'c.lft, ';
|
||||
break;
|
||||
|
||||
default :
|
||||
$orderby = '';
|
||||
break;
|
||||
}
|
||||
|
||||
return $orderby;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate an order code to a field for secondary category ordering.
|
||||
*
|
||||
* @param string $orderby The ordering code.
|
||||
* @param string $orderDate The ordering code for the date.
|
||||
*
|
||||
* @return string The SQL field(s) to order by.
|
||||
* @since 1.5
|
||||
*/
|
||||
public static function orderbySecondary($orderby, $orderDate = 'created')
|
||||
{
|
||||
$queryDate = self::getQueryDate($orderDate);
|
||||
|
||||
switch ($orderby)
|
||||
{
|
||||
case 'date' :
|
||||
$orderby = $queryDate;
|
||||
break;
|
||||
|
||||
case 'rdate' :
|
||||
$orderby = $queryDate . ' DESC ';
|
||||
break;
|
||||
|
||||
case 'alpha' :
|
||||
$orderby = 'a.title';
|
||||
break;
|
||||
|
||||
case 'ralpha' :
|
||||
$orderby = 'a.title DESC';
|
||||
break;
|
||||
|
||||
case 'hits' :
|
||||
$orderby = 'a.hits DESC';
|
||||
break;
|
||||
|
||||
case 'rhits' :
|
||||
$orderby = 'a.hits';
|
||||
break;
|
||||
|
||||
case 'order' :
|
||||
$orderby = 'a.ordering';
|
||||
break;
|
||||
|
||||
case 'author' :
|
||||
$orderby = 'author';
|
||||
break;
|
||||
|
||||
case 'rauthor' :
|
||||
$orderby = 'author DESC';
|
||||
break;
|
||||
|
||||
case 'front' :
|
||||
$orderby = 'a.featured DESC, fp.ordering';
|
||||
break;
|
||||
|
||||
default :
|
||||
$orderby = 'a.ordering';
|
||||
break;
|
||||
}
|
||||
|
||||
return $orderby;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate an order code to a field for primary category ordering.
|
||||
*
|
||||
* @param string $orderDate The ordering code.
|
||||
*
|
||||
* @return string The SQL field(s) to order by.
|
||||
* @since 1.6
|
||||
*/
|
||||
public static function getQueryDate($orderDate)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
switch ($orderDate)
|
||||
{
|
||||
case 'modified' :
|
||||
$queryDate = ' CASE WHEN a.modified = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.modified END';
|
||||
break;
|
||||
|
||||
// use created if publish_up is not set
|
||||
case 'published' :
|
||||
$queryDate = ' CASE WHEN a.publish_up = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.publish_up END ';
|
||||
break;
|
||||
|
||||
case 'created' :
|
||||
default :
|
||||
$queryDate = ' a.created ';
|
||||
break;
|
||||
}
|
||||
|
||||
return $queryDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get join information for the voting query.
|
||||
*
|
||||
* @param JRegistry $param An options object for the article.
|
||||
*
|
||||
* @return array A named array with "select" and "join" keys.
|
||||
* @since 1.5
|
||||
*/
|
||||
public static function buildVotingQuery($params=null)
|
||||
{
|
||||
if (!$params)
|
||||
{
|
||||
$params = JComponentHelper::getParams('com_content');
|
||||
}
|
||||
|
||||
$voting = $params->get('show_vote');
|
||||
|
||||
if ($voting)
|
||||
{
|
||||
// calculate voting count
|
||||
$select = ' , ROUND(v.rating_sum / v.rating_count) AS rating, v.rating_count';
|
||||
$join = ' LEFT JOIN #__content_rating AS v ON a.id = v.content_id';
|
||||
}
|
||||
else
|
||||
{
|
||||
$select = '';
|
||||
$join = '';
|
||||
}
|
||||
|
||||
$results = array ('select' => $select, 'join' => $join);
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to order the intro articles array for ordering
|
||||
* down the columns instead of across.
|
||||
* The layout always lays the introtext articles out across columns.
|
||||
* Array is reordered so that, when articles are displayed in index order
|
||||
* across columns in the layout, the result is that the
|
||||
* desired article ordering is achieved down the columns.
|
||||
*
|
||||
* @param array $articles Array of intro text articles
|
||||
* @param integer $numColumns Number of columns in the layout
|
||||
*
|
||||
* @return array Reordered array to achieve desired ordering down columns
|
||||
* @since 1.6
|
||||
*/
|
||||
public static function orderDownColumns(&$articles, $numColumns = 1)
|
||||
{
|
||||
$count = count($articles);
|
||||
|
||||
// just return the same array if there is nothing to change
|
||||
if ($numColumns == 1 || !is_array($articles) || $count <= $numColumns)
|
||||
{
|
||||
$return = $articles;
|
||||
}
|
||||
// we need to re-order the intro articles array
|
||||
else {
|
||||
// we need to preserve the original array keys
|
||||
$keys = array_keys($articles);
|
||||
|
||||
$maxRows = ceil($count / $numColumns);
|
||||
$numCells = $maxRows * $numColumns;
|
||||
$numEmpty = $numCells - $count;
|
||||
$index = array();
|
||||
|
||||
// calculate number of empty cells in the array
|
||||
|
||||
// fill in all cells of the array
|
||||
// put -1 in empty cells so we can skip later
|
||||
|
||||
for ($row = 1, $i = 1; $row <= $maxRows; $row++)
|
||||
{
|
||||
for ($col = 1; $col <= $numColumns; $col++)
|
||||
{
|
||||
if ($numEmpty > ($numCells - $i))
|
||||
{
|
||||
// put -1 in empty cells
|
||||
$index[$row][$col] = -1;
|
||||
}
|
||||
else {
|
||||
// put in zero as placeholder
|
||||
$index[$row][$col] = 0;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
// layout the articles in column order, skipping empty cells
|
||||
$i = 0;
|
||||
for ($col = 1; ($col <= $numColumns) && ($i < $count); $col++)
|
||||
{
|
||||
for ($row = 1; ($row <= $maxRows) && ($i < $count); $row++)
|
||||
{
|
||||
if ($index[$row][$col] != - 1)
|
||||
{
|
||||
$index[$row][$col] = $keys[$i];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now read the $index back row by row to get articles in right row/col
|
||||
// so that they will actually be ordered down the columns (when read by row in the layout)
|
||||
$return = array();
|
||||
$i = 0;
|
||||
for ($row = 1; ($row <= $maxRows) && ($i < $count); $row++)
|
||||
{
|
||||
for ($col = 1; ($col <= $numColumns) && ($i < $count); $col++)
|
||||
{
|
||||
$return[$keys[$i]] = $articles[$index[$row][$col]];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
}
|
239
components/com_content/helpers/route.php
Normal file
239
components/com_content/helpers/route.php
Normal file
@ -0,0 +1,239 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Content Component Route Helper
|
||||
*
|
||||
* @static
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_content
|
||||
* @since 1.5
|
||||
*/
|
||||
abstract class ContentHelperRoute
|
||||
{
|
||||
protected static $lookup = array();
|
||||
|
||||
/**
|
||||
* @param integer The route of the content item
|
||||
*/
|
||||
public static function getArticleRoute($id, $catid = 0, $language = 0)
|
||||
{
|
||||
$needles = array(
|
||||
'article' => array((int) $id)
|
||||
);
|
||||
//Create the link
|
||||
$link = 'index.php?option=com_content&view=article&id='. $id;
|
||||
if ((int) $catid > 1)
|
||||
{
|
||||
$categories = JCategories::getInstance('Content');
|
||||
$category = $categories->get((int) $catid);
|
||||
if ($category)
|
||||
{
|
||||
$needles['category'] = array_reverse($category->getPath());
|
||||
$needles['categories'] = $needles['category'];
|
||||
$link .= '&catid='.$catid;
|
||||
}
|
||||
}
|
||||
if ($language && $language != "*" && JLanguageMultilang::isEnabled())
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('a.sef AS sef')
|
||||
->select('a.lang_code AS lang_code')
|
||||
->from('#__languages AS a');
|
||||
|
||||
$db->setQuery($query);
|
||||
$langs = $db->loadObjectList();
|
||||
foreach ($langs as $lang)
|
||||
{
|
||||
if ($language == $lang->lang_code)
|
||||
{
|
||||
$link .= '&lang='.$lang->sef;
|
||||
$needles['language'] = $language;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($item = self::_findItem($needles))
|
||||
{
|
||||
$link .= '&Itemid='.$item;
|
||||
}
|
||||
elseif ($item = self::_findItem())
|
||||
{
|
||||
$link .= '&Itemid='.$item;
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
public static function getCategoryRoute($catid, $language = 0)
|
||||
{
|
||||
if ($catid instanceof JCategoryNode)
|
||||
{
|
||||
$id = $catid->id;
|
||||
$category = $catid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$id = (int) $catid;
|
||||
$category = JCategories::getInstance('Content')->get($id);
|
||||
}
|
||||
|
||||
if ($id < 1)
|
||||
{
|
||||
$link = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$link = 'index.php?option=com_content&view=category&id='.$id;
|
||||
|
||||
$needles = array(
|
||||
'category' => array($id)
|
||||
);
|
||||
|
||||
if ($language && $language != "*" && JLanguageMultilang::isEnabled())
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('a.sef AS sef')
|
||||
->select('a.lang_code AS lang_code')
|
||||
->from('#__languages AS a');
|
||||
|
||||
$db->setQuery($query);
|
||||
$langs = $db->loadObjectList();
|
||||
foreach ($langs as $lang)
|
||||
{
|
||||
if ($language == $lang->lang_code)
|
||||
{
|
||||
$link .= '&lang='.$lang->sef;
|
||||
$needles['language'] = $language;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($item = self::_findItem($needles))
|
||||
{
|
||||
$link .= '&Itemid='.$item;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Create the link
|
||||
if ($category)
|
||||
{
|
||||
$catids = array_reverse($category->getPath());
|
||||
$needles['category'] = $catids;
|
||||
$needles['categories'] = $catids;
|
||||
|
||||
if ($item = self::_findItem($needles))
|
||||
{
|
||||
$link .= '&Itemid='.$item;
|
||||
}
|
||||
elseif ($item = self::_findItem())
|
||||
{
|
||||
$link .= '&Itemid='.$item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
public static function getFormRoute($id)
|
||||
{
|
||||
//Create the link
|
||||
if ($id)
|
||||
{
|
||||
$link = 'index.php?option=com_content&task=article.edit&a_id='. $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$link = 'index.php?option=com_content&task=article.edit&a_id=0';
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
protected static function _findItem($needles = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$menus = $app->getMenu('site');
|
||||
$language = isset($needles['language']) ? $needles['language'] : '*';
|
||||
|
||||
// Prepare the reverse lookup array.
|
||||
if (!isset(self::$lookup[$language]))
|
||||
{
|
||||
self::$lookup[$language] = array();
|
||||
|
||||
$component = JComponentHelper::getComponent('com_content');
|
||||
|
||||
$attributes = array('component_id');
|
||||
$values = array($component->id);
|
||||
|
||||
if ($language != '*')
|
||||
{
|
||||
$attributes[] = 'language';
|
||||
$values[] = array($needles['language'], '*');
|
||||
}
|
||||
|
||||
$items = $menus->getItems($attributes, $values);
|
||||
|
||||
foreach ($items as $item)
|
||||
{
|
||||
if (isset($item->query) && isset($item->query['view']))
|
||||
{
|
||||
$view = $item->query['view'];
|
||||
if (!isset(self::$lookup[$language][$view]))
|
||||
{
|
||||
self::$lookup[$language][$view] = array();
|
||||
}
|
||||
if (isset($item->query['id'])) {
|
||||
|
||||
// here it will become a bit tricky
|
||||
// language != * can override existing entries
|
||||
// language == * cannot override existing entries
|
||||
if (!isset(self::$lookup[$language][$view][$item->query['id']]) || $item->language != '*')
|
||||
{
|
||||
self::$lookup[$language][$view][$item->query['id']] = $item->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($needles)
|
||||
{
|
||||
foreach ($needles as $view => $ids)
|
||||
{
|
||||
if (isset(self::$lookup[$language][$view]))
|
||||
{
|
||||
foreach ($ids as $id)
|
||||
{
|
||||
if (isset(self::$lookup[$language][$view][(int) $id]))
|
||||
{
|
||||
return self::$lookup[$language][$view][(int) $id];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$active = $menus->getActive();
|
||||
if ($active && $active->component == 'com_content' && ($active->language == '*' || !JLanguageMultilang::isEnabled()))
|
||||
{
|
||||
return $active->id;
|
||||
}
|
||||
|
||||
// if not found, return language specific home link
|
||||
$default = $menus->getDefault($language);
|
||||
return !empty($default->id) ? $default->id : null;
|
||||
}
|
||||
}
|
1
components/com_content/index.html
Normal file
1
components/com_content/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
3
components/com_content/metadata.xml
Normal file
3
components/com_content/metadata.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
</metadata>
|
165
components/com_content/models/archive.php
Normal file
165
components/com_content/models/archive.php
Normal file
@ -0,0 +1,165 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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';
|
||||
|
||||
/**
|
||||
* Content Component Archive Model
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_content
|
||||
* @since 1.5
|
||||
*/
|
||||
class ContentModelArchive extends ContentModelArticles
|
||||
{
|
||||
/**
|
||||
* Model context string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $_context = 'com_content.archive';
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
parent::populateState();
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Add archive properties
|
||||
$params = $this->state->params;
|
||||
|
||||
// Filter on archived articles
|
||||
$this->setState('filter.published', 2);
|
||||
|
||||
// Filter on month, year
|
||||
$this->setState('filter.month', $app->input->getInt('month'));
|
||||
$this->setState('filter.year', $app->input->getInt('year'));
|
||||
|
||||
// Optional filter text
|
||||
$this->setState('list.filter', $app->input->getString('filter-search'));
|
||||
|
||||
// Get list limit
|
||||
$itemid = $app->input->get('Itemid', 0, 'int');
|
||||
$limit = $app->getUserStateFromRequest('com_content.archive.list' . $itemid . '.limit', 'limit', $params->get('display_num'), 'uint');
|
||||
$this->setState('list.limit', $limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JDatabaseQuery
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Set the archive ordering
|
||||
$params = $this->state->params;
|
||||
$articleOrderby = $params->get('orderby_sec', 'rdate');
|
||||
$articleOrderDate = $params->get('order_date');
|
||||
|
||||
// No category ordering
|
||||
$categoryOrderby = '';
|
||||
$secondary = ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate) . ', ';
|
||||
$primary = ContentHelperQuery::orderbyPrimary($categoryOrderby);
|
||||
|
||||
$orderby = $primary . ' ' . $secondary . ' a.created DESC ';
|
||||
$this->setState('list.ordering', $orderby);
|
||||
$this->setState('list.direction', '');
|
||||
// Create a new query object.
|
||||
$query = parent::getListQuery();
|
||||
|
||||
// Add routing for archive
|
||||
//sqlsrv changes
|
||||
$case_when = ' CASE WHEN ';
|
||||
$case_when .= $query->charLength('a.alias', '!=', '0');
|
||||
$case_when .= ' THEN ';
|
||||
$a_id = $query->castAsChar('a.id');
|
||||
$case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
|
||||
$case_when .= ' ELSE ';
|
||||
$case_when .= $a_id.' END as slug';
|
||||
|
||||
$query->select($case_when);
|
||||
|
||||
$case_when = ' CASE WHEN ';
|
||||
$case_when .= $query->charLength('c.alias', '!=', '0');
|
||||
$case_when .= ' THEN ';
|
||||
$c_id = $query->castAsChar('c.id');
|
||||
$case_when .= $query->concatenate(array($c_id, 'c.alias'), ':');
|
||||
$case_when .= ' ELSE ';
|
||||
$case_when .= $c_id.' END as catslug';
|
||||
$query->select($case_when);
|
||||
|
||||
// Filter on month, year
|
||||
// First, get the date field
|
||||
$queryDate = ContentHelperQuery::getQueryDate($articleOrderDate);
|
||||
|
||||
if ($month = $this->getState('filter.month'))
|
||||
{
|
||||
$query->where('MONTH('. $queryDate . ') = ' . $month);
|
||||
}
|
||||
|
||||
if ($year = $this->getState('filter.year'))
|
||||
{
|
||||
$query->where('YEAR('. $queryDate . ') = ' . $year);
|
||||
}
|
||||
|
||||
//echo nl2br(str_replace('#__','jos_',$query));
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the archived article list
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Lets load the content if it doesn't already exist
|
||||
if (empty($this->_data))
|
||||
{
|
||||
// Get the page/component configuration
|
||||
$params = $app->getParams();
|
||||
|
||||
// Get the pagination request variables
|
||||
$limit = $app->input->get('limit', $params->get('display_num', 20), 'uint');
|
||||
$limitstart = $app->input->get('limitstart', 0, 'uint');
|
||||
|
||||
$query = $this->_buildQuery();
|
||||
|
||||
$this->_data = $this->_getList($query, $limitstart, $limit);
|
||||
}
|
||||
|
||||
return $this->_data;
|
||||
}
|
||||
|
||||
// JModelLegacy override to add alternating value for $odd
|
||||
protected function _getList($query, $limitstart=0, $limit=0)
|
||||
{
|
||||
$result = parent::_getList($query, $limitstart, $limit);
|
||||
|
||||
$odd = 1;
|
||||
foreach ($result as $k => $row)
|
||||
{
|
||||
$result[$k]->odd = $odd;
|
||||
$odd = 1 - $odd;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
356
components/com_content/models/article.php
Normal file
356
components/com_content/models/article.php
Normal file
@ -0,0 +1,356 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Content Component Article Model
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_content
|
||||
* @since 1.5
|
||||
*/
|
||||
class ContentModelArticle extends JModelItem
|
||||
{
|
||||
/**
|
||||
* Model context string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_context = 'com_content.article';
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState()
|
||||
{
|
||||
$app = JFactory::getApplication('site');
|
||||
|
||||
// Load state from the request.
|
||||
$pk = $app->input->getInt('id');
|
||||
$this->setState('article.id', $pk);
|
||||
|
||||
$offset = $app->input->getUInt('limitstart');
|
||||
$this->setState('list.offset', $offset);
|
||||
|
||||
// Load the parameters.
|
||||
$params = $app->getParams();
|
||||
$this->setState('params', $params);
|
||||
|
||||
// TODO: Tune these values based on other permissions.
|
||||
$user = JFactory::getUser();
|
||||
if ((!$user->authorise('core.edit.state', 'com_content')) && (!$user->authorise('core.edit', 'com_content')))
|
||||
{
|
||||
$this->setState('filter.published', 1);
|
||||
$this->setState('filter.archived', 2);
|
||||
}
|
||||
|
||||
$this->setState('filter.language', JLanguageMultilang::isEnabled());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get article data.
|
||||
*
|
||||
* @param integer The id of the article.
|
||||
*
|
||||
* @return mixed Menu item data object on success, false on failure.
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{
|
||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('article.id');
|
||||
|
||||
if ($this->_item === null)
|
||||
{
|
||||
$this->_item = array();
|
||||
}
|
||||
|
||||
if (!isset($this->_item[$pk]))
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select(
|
||||
$this->getState(
|
||||
'item.select', 'a.id, a.asset_id, a.title, a.alias, a.introtext, a.fulltext, ' .
|
||||
// If badcats is not null, this means that the article is inside an unpublished category
|
||||
// In this case, the state is set to 0 to indicate Unpublished (even if the article state is Published)
|
||||
'CASE WHEN badcats.id is null THEN a.state ELSE 0 END AS state, ' .
|
||||
'a.catid, a.created, a.created_by, a.created_by_alias, ' .
|
||||
// use created if modified is 0
|
||||
'CASE WHEN a.modified = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.modified END as modified, ' .
|
||||
'a.modified_by, a.checked_out, a.checked_out_time, a.publish_up, a.publish_down, ' .
|
||||
'a.images, a.urls, a.attribs, a.version, a.ordering, ' .
|
||||
'a.metakey, a.metadesc, a.access, a.hits, a.metadata, a.featured, a.language, a.xreference'
|
||||
)
|
||||
);
|
||||
$query->from('#__content AS a');
|
||||
|
||||
// Join on category table.
|
||||
$query->select('c.title AS category_title, c.alias AS category_alias, c.access AS category_access')
|
||||
->join('LEFT', '#__categories AS c on c.id = a.catid');
|
||||
|
||||
// Join on user table.
|
||||
$query->select('u.name AS author')
|
||||
->join('LEFT', '#__users AS u on u.id = a.created_by');
|
||||
|
||||
// Get contact id
|
||||
$subQuery = $db->getQuery(true)
|
||||
->select('MAX(contact.id) AS id')
|
||||
->from('#__contact_details AS contact')
|
||||
->where('contact.published = 1')
|
||||
->where('contact.user_id = a.created_by');
|
||||
// Filter by language
|
||||
if ($this->getState('filter.language'))
|
||||
{
|
||||
$subQuery->where('(contact.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ') OR contact.language IS NULL)');
|
||||
}
|
||||
$query->select('(' . $subQuery . ') as contactid');
|
||||
|
||||
// Filter by language
|
||||
if ($this->getState('filter.language'))
|
||||
{
|
||||
$query->where('a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
|
||||
}
|
||||
|
||||
// Join over the categories to get parent category titles
|
||||
$query->select('parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias')
|
||||
->join('LEFT', '#__categories as parent ON parent.id = c.parent_id');
|
||||
|
||||
// Join on voting table
|
||||
$query->select('ROUND(v.rating_sum / v.rating_count, 0) AS rating, v.rating_count as rating_count')
|
||||
->join('LEFT', '#__content_rating AS v ON a.id = v.content_id')
|
||||
|
||||
->where('a.id = ' . (int) $pk);
|
||||
|
||||
// Filter by start and end dates.
|
||||
$nullDate = $db->quote($db->getNullDate());
|
||||
$date = JFactory::getDate();
|
||||
|
||||
$nowDate = $db->quote($date->toSql());
|
||||
|
||||
$query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')')
|
||||
->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')');
|
||||
|
||||
// Join to check for category published state in parent categories up the tree
|
||||
// If all categories are published, badcats.id will be null, and we just use the article state
|
||||
$subquery = ' (SELECT cat.id as id FROM #__categories AS cat JOIN #__categories AS parent ';
|
||||
$subquery .= 'ON cat.lft BETWEEN parent.lft AND parent.rgt ';
|
||||
$subquery .= 'WHERE parent.extension = ' . $db->quote('com_content');
|
||||
$subquery .= ' AND parent.published <= 0 GROUP BY cat.id)';
|
||||
$query->join('LEFT OUTER', $subquery . ' AS badcats ON badcats.id = c.id');
|
||||
|
||||
// Filter by published state.
|
||||
$published = $this->getState('filter.published');
|
||||
$archived = $this->getState('filter.archived');
|
||||
|
||||
if (is_numeric($published))
|
||||
{
|
||||
$query->where('(a.state = ' . (int) $published . ' OR a.state =' . (int) $archived . ')');
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
$data = $db->loadObject();
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
return JError::raiseError(404, JText::_('COM_CONTENT_ERROR_ARTICLE_NOT_FOUND'));
|
||||
}
|
||||
|
||||
// Check for published state if filter set.
|
||||
if (((is_numeric($published)) || (is_numeric($archived))) && (($data->state != $published) && ($data->state != $archived)))
|
||||
{
|
||||
return JError::raiseError(404, JText::_('COM_CONTENT_ERROR_ARTICLE_NOT_FOUND'));
|
||||
}
|
||||
|
||||
// Convert parameter fields to objects.
|
||||
$registry = new JRegistry;
|
||||
$registry->loadString($data->attribs);
|
||||
|
||||
$data->params = clone $this->getState('params');
|
||||
$data->params->merge($registry);
|
||||
|
||||
$registry = new JRegistry;
|
||||
$registry->loadString($data->metadata);
|
||||
$data->metadata = $registry;
|
||||
|
||||
// Compute selected asset permissions.
|
||||
$user = JFactory::getUser();
|
||||
|
||||
// Technically guest could edit an article, but lets not check that to improve performance a little.
|
||||
if (!$user->get('guest'))
|
||||
{
|
||||
$userId = $user->get('id');
|
||||
$asset = 'com_content.article.' . $data->id;
|
||||
|
||||
// Check general edit permission first.
|
||||
if ($user->authorise('core.edit', $asset))
|
||||
{
|
||||
$data->params->set('access-edit', true);
|
||||
}
|
||||
// Now check if edit.own is available.
|
||||
elseif (!empty($userId) && $user->authorise('core.edit.own', $asset))
|
||||
{
|
||||
// Check for a valid user and that they are the owner.
|
||||
if ($userId == $data->created_by)
|
||||
{
|
||||
$data->params->set('access-edit', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Compute view access permissions.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
// If the access filter has been set, we already know this user can view.
|
||||
$data->params->set('access-view', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If no access filter is set, the layout takes some responsibility for display of limited information.
|
||||
$user = JFactory::getUser();
|
||||
$groups = $user->getAuthorisedViewLevels();
|
||||
|
||||
if ($data->catid == 0 || $data->category_access === null)
|
||||
{
|
||||
$data->params->set('access-view', in_array($data->access, $groups));
|
||||
}
|
||||
else
|
||||
{
|
||||
$data->params->set('access-view', in_array($data->access, $groups) && in_array($data->category_access, $groups));
|
||||
}
|
||||
}
|
||||
|
||||
$this->_item[$pk] = $data;
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
if ($e->getCode() == 404)
|
||||
{
|
||||
// Need to go thru the error handler to allow Redirect to work.
|
||||
JError::raiseError(404, $e->getMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setError($e);
|
||||
$this->_item[$pk] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_item[$pk];
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the hit counter for the article.
|
||||
*
|
||||
* @param integer Optional primary key of the article to increment.
|
||||
*
|
||||
* @return boolean True if successful; false otherwise and internal error set.
|
||||
*/
|
||||
public function hit($pk = 0)
|
||||
{
|
||||
$input = JFactory::getApplication()->input;
|
||||
$hitcount = $input->getInt('hitcount', 1);
|
||||
|
||||
if ($hitcount)
|
||||
{
|
||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('article.id');
|
||||
$db = $this->getDbo();
|
||||
|
||||
$db->setQuery(
|
||||
|
||||
'UPDATE #__content' .
|
||||
' SET hits = hits + 1' .
|
||||
' WHERE id = ' . (int) $pk
|
||||
);
|
||||
|
||||
try
|
||||
{
|
||||
$db->execute();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
$this->setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function storeVote($pk = 0, $rate = 0)
|
||||
{
|
||||
if ($rate >= 1 && $rate <= 5 && $pk > 0)
|
||||
{
|
||||
$userIP = $_SERVER['REMOTE_ADDR'];
|
||||
$db = $this->getDbo();
|
||||
|
||||
$db->setQuery(
|
||||
'SELECT *' .
|
||||
' FROM #__content_rating' .
|
||||
' WHERE content_id = ' . (int) $pk
|
||||
);
|
||||
|
||||
$rating = $db->loadObject();
|
||||
|
||||
if (!$rating)
|
||||
{
|
||||
// There are no ratings yet, so lets insert our rating
|
||||
$db->setQuery(
|
||||
'INSERT INTO #__content_rating ( content_id, lastip, rating_sum, rating_count )' .
|
||||
' VALUES ( ' . (int) $pk . ', ' . $db->quote($userIP) . ', ' . (int) $rate . ', 1 )'
|
||||
);
|
||||
|
||||
try
|
||||
{
|
||||
$db->execute();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
$this->setError($e->getMessage);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($userIP != ($rating->lastip))
|
||||
{
|
||||
$db->setQuery(
|
||||
'UPDATE #__content_rating' .
|
||||
' SET rating_count = rating_count + 1, rating_sum = rating_sum + ' . (int) $rate . ', lastip = ' . $db->quote($userIP) .
|
||||
' WHERE content_id = ' . (int) $pk
|
||||
);
|
||||
|
||||
try
|
||||
{
|
||||
$db->execute();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
$this->setError($e->getMessage);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
JError::raiseWarning('SOME_ERROR_CODE', JText::sprintf('COM_CONTENT_INVALID_RATING', $rate), "JModelArticle::storeVote($rate)");
|
||||
return false;
|
||||
}
|
||||
}
|
653
components/com_content/models/articles.php
Normal file
653
components/com_content/models/articles.php
Normal file
@ -0,0 +1,653 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* This models supports retrieving lists of articles.
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_content
|
||||
* @since 1.6
|
||||
*/
|
||||
class ContentModelArticles extends JModelList
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array An optional associative array of configuration settings.
|
||||
* @see JController
|
||||
* @since 1.6
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
if (empty($config['filter_fields']))
|
||||
{
|
||||
$config['filter_fields'] = array(
|
||||
'id', 'a.id',
|
||||
'title', 'a.title',
|
||||
'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',
|
||||
'ordering', 'a.ordering',
|
||||
'featured', 'a.featured',
|
||||
'language', 'a.language',
|
||||
'hits', 'a.hits',
|
||||
'publish_up', 'a.publish_up',
|
||||
'publish_down', 'a.publish_down',
|
||||
'images', 'a.images',
|
||||
'urls', 'a.urls',
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = 'ordering', $direction = 'ASC')
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// List state information
|
||||
$value = $app->input->get('limit', $app->getCfg('list_limit', 0), 'uint');
|
||||
$this->setState('list.limit', $value);
|
||||
|
||||
$value = $app->input->get('limitstart', 0, 'uint');
|
||||
$this->setState('list.start', $value);
|
||||
|
||||
$orderCol = $app->input->get('filter_order', 'a.ordering');
|
||||
if (!in_array($orderCol, $this->filter_fields))
|
||||
{
|
||||
$orderCol = 'a.ordering';
|
||||
}
|
||||
$this->setState('list.ordering', $orderCol);
|
||||
|
||||
$listOrder = $app->input->get('filter_order_Dir', 'ASC');
|
||||
if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', '')))
|
||||
{
|
||||
$listOrder = 'ASC';
|
||||
}
|
||||
$this->setState('list.direction', $listOrder);
|
||||
|
||||
$params = $app->getParams();
|
||||
$this->setState('params', $params);
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if ((!$user->authorise('core.edit.state', 'com_content')) && (!$user->authorise('core.edit', 'com_content')))
|
||||
{
|
||||
// filter on published for those who do not have edit or edit.state rights.
|
||||
$this->setState('filter.published', 1);
|
||||
}
|
||||
|
||||
$this->setState('filter.language', JLanguageMultilang::isEnabled());
|
||||
|
||||
// process show_noauth parameter
|
||||
if (!$params->get('show_noauth'))
|
||||
{
|
||||
$this->setState('filter.access', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setState('filter.access', false);
|
||||
}
|
||||
|
||||
$this->setState('layout', $app->input->get('layout'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 .= ':' . serialize($this->getState('filter.published'));
|
||||
$id .= ':' . $this->getState('filter.access');
|
||||
$id .= ':' . $this->getState('filter.featured');
|
||||
$id .= ':' . $this->getState('filter.article_id');
|
||||
$id .= ':' . $this->getState('filter.article_id.include');
|
||||
$id .= ':' . serialize($this->getState('filter.category_id'));
|
||||
$id .= ':' . $this->getState('filter.category_id.include');
|
||||
$id .= ':' . serialize($this->getState('filter.author_id'));
|
||||
$id .= ':' . $this->getState('filter.author_id.include');
|
||||
$id .= ':' . serialize($this->getState('filter.author_alias'));
|
||||
$id .= ':' . $this->getState('filter.author_alias.include');
|
||||
$id .= ':' . $this->getState('filter.date_filtering');
|
||||
$id .= ':' . $this->getState('filter.date_field');
|
||||
$id .= ':' . $this->getState('filter.start_date_range');
|
||||
$id .= ':' . $this->getState('filter.end_date_range');
|
||||
$id .= ':' . $this->getState('filter.relative_date');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the master query for retrieving a list of articles subject to the model state.
|
||||
*
|
||||
* @return JDatabaseQuery
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Create a new query object.
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select the required fields from the table.
|
||||
$query->select(
|
||||
$this->getState(
|
||||
'list.select',
|
||||
'a.id, a.title, a.alias, a.introtext, ' .
|
||||
'a.checked_out, a.checked_out_time, ' .
|
||||
'a.catid, a.created, a.created_by, a.created_by_alias, ' .
|
||||
// use created if modified is 0
|
||||
'CASE WHEN a.modified = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.modified END as modified, ' .
|
||||
'a.modified_by, uam.name as modified_by_name,' .
|
||||
// use created if publish_up is 0
|
||||
'CASE WHEN a.publish_up = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.publish_up END as publish_up,' .
|
||||
'a.publish_down, a.images, a.urls, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, ' .
|
||||
'a.hits, a.xreference, a.featured,' . ' ' . $query->length('a.fulltext') . ' AS readmore'
|
||||
)
|
||||
);
|
||||
|
||||
// Process an Archived Article layout
|
||||
if ($this->getState('filter.published') == 2)
|
||||
{
|
||||
// If badcats is not null, this means that the article is inside an archived category
|
||||
// In this case, the state is set to 2 to indicate Archived (even if the article state is Published)
|
||||
$query->select($this->getState('list.select', 'CASE WHEN badcats.id is null THEN a.state ELSE 2 END AS state'));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Process non-archived layout
|
||||
// If badcats is not null, this means that the article is inside an unpublished category
|
||||
// In this case, the state is set to 0 to indicate Unpublished (even if the article state is Published)
|
||||
$query->select($this->getState('list.select', 'CASE WHEN badcats.id is not null THEN 0 ELSE a.state END AS state'));
|
||||
}
|
||||
|
||||
$query->from('#__content AS a');
|
||||
|
||||
// Join over the frontpage articles.
|
||||
if ($this->context != 'com_content.featured')
|
||||
{
|
||||
$query->join('LEFT', '#__content_frontpage AS fp ON fp.content_id = a.id');
|
||||
}
|
||||
|
||||
// Join over the categories.
|
||||
$query->select('c.title AS category_title, c.path AS category_route, c.access AS category_access, c.alias AS category_alias')
|
||||
->join('LEFT', '#__categories AS c ON c.id = a.catid');
|
||||
|
||||
// Join over the users for the author and modified_by names.
|
||||
$query->select("CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author")
|
||||
->select("ua.email AS author_email")
|
||||
|
||||
->join('LEFT', '#__users AS ua ON ua.id = a.created_by')
|
||||
->join('LEFT', '#__users AS uam ON uam.id = a.modified_by');
|
||||
|
||||
// Get contact id
|
||||
$subQuery = $db->getQuery(true)
|
||||
->select('MAX(contact.id) AS id')
|
||||
->from('#__contact_details AS contact')
|
||||
->where('contact.published = 1')
|
||||
->where('contact.user_id = a.created_by');
|
||||
// Filter by language
|
||||
if ($this->getState('filter.language'))
|
||||
{
|
||||
$subQuery->where('(contact.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ') OR contact.language IS NULL)');
|
||||
}
|
||||
$query->select('(' . $subQuery . ') as contactid');
|
||||
|
||||
// Join over the categories to get parent category titles
|
||||
$query->select('parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias')
|
||||
->join('LEFT', '#__categories as parent ON parent.id = c.parent_id');
|
||||
|
||||
// Join on voting table
|
||||
$query->select('ROUND(v.rating_sum / v.rating_count, 0) AS rating, v.rating_count as rating_count')
|
||||
->join('LEFT', '#__content_rating AS v ON a.id = v.content_id');
|
||||
|
||||
// Join to check for category published state in parent categories up the tree
|
||||
$query->select('c.published, CASE WHEN badcats.id is null THEN c.published ELSE 0 END AS parents_published');
|
||||
$subquery = 'SELECT cat.id as id FROM #__categories AS cat JOIN #__categories AS parent ';
|
||||
$subquery .= 'ON cat.lft BETWEEN parent.lft AND parent.rgt ';
|
||||
$subquery .= 'WHERE parent.extension = ' . $db->quote('com_content');
|
||||
|
||||
if ($this->getState('filter.published') == 2)
|
||||
{
|
||||
// Find any up-path categories that are archived
|
||||
// If any up-path categories are archived, include all children in archived layout
|
||||
$subquery .= ' AND parent.published = 2 GROUP BY cat.id ';
|
||||
// Set effective state to archived if up-path category is archived
|
||||
$publishedWhere = 'CASE WHEN badcats.id is null THEN a.state ELSE 2 END';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find any up-path categories that are not published
|
||||
// If all categories are published, badcats.id will be null, and we just use the article state
|
||||
$subquery .= ' AND parent.published != 1 GROUP BY cat.id ';
|
||||
// Select state to unpublished if up-path category is unpublished
|
||||
$publishedWhere = 'CASE WHEN badcats.id is null THEN a.state ELSE 0 END';
|
||||
}
|
||||
$query->join('LEFT OUTER', '(' . $subquery . ') AS badcats ON badcats.id = c.id');
|
||||
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')')
|
||||
->where('c.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Filter by published state
|
||||
$published = $this->getState('filter.published');
|
||||
|
||||
if (is_numeric($published))
|
||||
{
|
||||
// Use article state if badcats.id is null, otherwise, force 0 for unpublished
|
||||
$query->where($publishedWhere . ' = ' . (int) $published);
|
||||
}
|
||||
elseif (is_array($published))
|
||||
{
|
||||
JArrayHelper::toInteger($published);
|
||||
$published = implode(',', $published);
|
||||
// Use article state if badcats.id is null, otherwise, force 0 for unpublished
|
||||
$query->where($publishedWhere . ' IN (' . $published . ')');
|
||||
}
|
||||
|
||||
// Filter by featured state
|
||||
$featured = $this->getState('filter.featured');
|
||||
switch ($featured)
|
||||
{
|
||||
case 'hide':
|
||||
$query->where('a.featured = 0');
|
||||
break;
|
||||
|
||||
case 'only':
|
||||
$query->where('a.featured = 1');
|
||||
break;
|
||||
|
||||
case 'show':
|
||||
default:
|
||||
// Normally we do not discriminate
|
||||
// between featured/unfeatured items.
|
||||
break;
|
||||
}
|
||||
|
||||
// Filter by a single or group of articles.
|
||||
$articleId = $this->getState('filter.article_id');
|
||||
|
||||
if (is_numeric($articleId))
|
||||
{
|
||||
$type = $this->getState('filter.article_id.include', true) ? '= ' : '<> ';
|
||||
$query->where('a.id ' . $type . (int) $articleId);
|
||||
}
|
||||
elseif (is_array($articleId))
|
||||
{
|
||||
JArrayHelper::toInteger($articleId);
|
||||
$articleId = implode(',', $articleId);
|
||||
$type = $this->getState('filter.article_id.include', true) ? 'IN' : 'NOT IN';
|
||||
$query->where('a.id ' . $type . ' (' . $articleId . ')');
|
||||
}
|
||||
|
||||
// Filter by a single or group of categories
|
||||
$categoryId = $this->getState('filter.category_id');
|
||||
|
||||
if (is_numeric($categoryId))
|
||||
{
|
||||
$type = $this->getState('filter.category_id.include', true) ? '= ' : '<> ';
|
||||
|
||||
// Add subcategory check
|
||||
$includeSubcategories = $this->getState('filter.subcategories', false);
|
||||
$categoryEquals = 'a.catid ' . $type . (int) $categoryId;
|
||||
|
||||
if ($includeSubcategories)
|
||||
{
|
||||
$levels = (int) $this->getState('filter.max_category_levels', '1');
|
||||
// Create a subquery for the subcategory list
|
||||
$subQuery = $db->getQuery(true)
|
||||
->select('sub.id')
|
||||
->from('#__categories as sub')
|
||||
->join('INNER', '#__categories as this ON sub.lft > this.lft AND sub.rgt < this.rgt')
|
||||
->where('this.id = ' . (int) $categoryId);
|
||||
if ($levels >= 0)
|
||||
{
|
||||
$subQuery->where('sub.level <= this.level + ' . $levels);
|
||||
}
|
||||
|
||||
// Add the subquery to the main query
|
||||
$query->where('(' . $categoryEquals . ' OR a.catid IN (' . $subQuery->__toString() . '))');
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->where($categoryEquals);
|
||||
}
|
||||
}
|
||||
elseif (is_array($categoryId) && (count($categoryId) > 0))
|
||||
{
|
||||
JArrayHelper::toInteger($categoryId);
|
||||
$categoryId = implode(',', $categoryId);
|
||||
if (!empty($categoryId))
|
||||
{
|
||||
$type = $this->getState('filter.category_id.include', true) ? 'IN' : 'NOT IN';
|
||||
$query->where('a.catid ' . $type . ' (' . $categoryId . ')');
|
||||
}
|
||||
}
|
||||
|
||||
// Filter by author
|
||||
$authorId = $this->getState('filter.author_id');
|
||||
$authorWhere = '';
|
||||
|
||||
if (is_numeric($authorId))
|
||||
{
|
||||
$type = $this->getState('filter.author_id.include', true) ? '= ' : '<> ';
|
||||
$authorWhere = 'a.created_by ' . $type . (int) $authorId;
|
||||
}
|
||||
elseif (is_array($authorId))
|
||||
{
|
||||
JArrayHelper::toInteger($authorId);
|
||||
$authorId = implode(',', $authorId);
|
||||
|
||||
if ($authorId)
|
||||
{
|
||||
$type = $this->getState('filter.author_id.include', true) ? 'IN' : 'NOT IN';
|
||||
$authorWhere = 'a.created_by ' . $type . ' (' . $authorId . ')';
|
||||
}
|
||||
}
|
||||
|
||||
// Filter by author alias
|
||||
$authorAlias = $this->getState('filter.author_alias');
|
||||
$authorAliasWhere = '';
|
||||
|
||||
if (is_string($authorAlias))
|
||||
{
|
||||
$type = $this->getState('filter.author_alias.include', true) ? '= ' : '<> ';
|
||||
$authorAliasWhere = 'a.created_by_alias ' . $type . $db->quote($authorAlias);
|
||||
}
|
||||
elseif (is_array($authorAlias))
|
||||
{
|
||||
$first = current($authorAlias);
|
||||
|
||||
if (!empty($first))
|
||||
{
|
||||
JArrayHelper::toString($authorAlias);
|
||||
|
||||
foreach ($authorAlias as $key => $alias)
|
||||
{
|
||||
$authorAlias[$key] = $db->quote($alias);
|
||||
}
|
||||
|
||||
$authorAlias = implode(',', $authorAlias);
|
||||
|
||||
if ($authorAlias)
|
||||
{
|
||||
$type = $this->getState('filter.author_alias.include', true) ? 'IN' : 'NOT IN';
|
||||
$authorAliasWhere = 'a.created_by_alias ' . $type . ' (' . $authorAlias .
|
||||
')';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($authorWhere) && !empty($authorAliasWhere))
|
||||
{
|
||||
$query->where('(' . $authorWhere . ' OR ' . $authorAliasWhere . ')');
|
||||
}
|
||||
elseif (empty($authorWhere) && empty($authorAliasWhere))
|
||||
{
|
||||
// If both are empty we don't want to add to the query
|
||||
}
|
||||
else
|
||||
{
|
||||
// One of these is empty, the other is not so we just add both
|
||||
$query->where($authorWhere . $authorAliasWhere);
|
||||
}
|
||||
|
||||
// Filter by start and end dates.
|
||||
$nullDate = $db->quote($db->getNullDate());
|
||||
$nowDate = $db->quote(JFactory::getDate()->toSql());
|
||||
|
||||
$query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')')
|
||||
->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')');
|
||||
|
||||
// Filter by Date Range or Relative Date
|
||||
$dateFiltering = $this->getState('filter.date_filtering', 'off');
|
||||
$dateField = $this->getState('filter.date_field', 'a.created');
|
||||
|
||||
switch ($dateFiltering)
|
||||
{
|
||||
case 'range':
|
||||
$startDateRange = $db->quote($this->getState('filter.start_date_range', $nullDate));
|
||||
$endDateRange = $db->quote($this->getState('filter.end_date_range', $nullDate));
|
||||
$query->where(
|
||||
'(' . $dateField . ' >= ' . $startDateRange . ' AND ' . $dateField .
|
||||
' <= ' . $endDateRange . ')'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'relative':
|
||||
$relativeDate = (int) $this->getState('filter.relative_date', 0);
|
||||
$query->where(
|
||||
$dateField . ' >= DATE_SUB(' . $nowDate . ', INTERVAL ' .
|
||||
$relativeDate . ' DAY)'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'off':
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// process the filter for list views with user-entered filters
|
||||
$params = $this->getState('params');
|
||||
|
||||
if ((is_object($params)) && ($params->get('filter_field') != 'hide') && ($filter = $this->getState('list.filter')))
|
||||
{
|
||||
// clean filter variable
|
||||
$filter = JString::strtolower($filter);
|
||||
$hitsFilter = (int) $filter;
|
||||
$filter = $db->quote('%' . $db->escape($filter, true) . '%', false);
|
||||
|
||||
switch ($params->get('filter_field'))
|
||||
{
|
||||
case 'author':
|
||||
$query->where(
|
||||
'LOWER( CASE WHEN a.created_by_alias > ' . $db->quote(' ') .
|
||||
' THEN a.created_by_alias ELSE ua.name END ) LIKE ' . $filter . ' '
|
||||
);
|
||||
break;
|
||||
|
||||
case 'hits':
|
||||
$query->where('a.hits >= ' . $hitsFilter . ' ');
|
||||
break;
|
||||
|
||||
case 'title':
|
||||
default: // default to 'title' if parameter is not valid
|
||||
$query->where('LOWER( a.title ) LIKE ' . $filter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Filter by language
|
||||
if ($this->getState('filter.language'))
|
||||
{
|
||||
$query->where('a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
$query->order($this->getState('list.ordering', 'a.ordering') . ' ' . $this->getState('list.direction', 'ASC'));
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a list of articles.
|
||||
*
|
||||
* Overriden to inject convert the attribs field into a JParameter object.
|
||||
*
|
||||
* @return mixed An array of objects on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
$items = parent::getItems();
|
||||
$user = JFactory::getUser();
|
||||
$userId = $user->get('id');
|
||||
$guest = $user->get('guest');
|
||||
$groups = $user->getAuthorisedViewLevels();
|
||||
$input = JFactory::getApplication()->input;
|
||||
|
||||
// Get the global params
|
||||
$globalParams = JComponentHelper::getParams('com_content', true);
|
||||
|
||||
// Convert the parameter fields into objects.
|
||||
foreach ($items as &$item)
|
||||
{
|
||||
$articleParams = new JRegistry;
|
||||
$articleParams->loadString($item->attribs);
|
||||
|
||||
// Unpack readmore and layout params
|
||||
$item->alternative_readmore = $articleParams->get('alternative_readmore');
|
||||
$item->layout = $articleParams->get('layout');
|
||||
|
||||
$item->params = clone $this->getState('params');
|
||||
|
||||
// For blogs, article params override menu item params only if menu param = 'use_article'
|
||||
// Otherwise, menu item params control the layout
|
||||
// If menu item is 'use_article' and there is no article param, use global
|
||||
if (($input->getString('layout') == 'blog') || ($input->getString('view') == 'featured')
|
||||
|| ($this->getState('params')->get('layout_type') == 'blog')
|
||||
)
|
||||
{
|
||||
// create an array of just the params set to 'use_article'
|
||||
$menuParamsArray = $this->getState('params')->toArray();
|
||||
$articleArray = array();
|
||||
|
||||
foreach ($menuParamsArray as $key => $value)
|
||||
{
|
||||
if ($value === 'use_article')
|
||||
{
|
||||
// if the article has a value, use it
|
||||
if ($articleParams->get($key) != '')
|
||||
{
|
||||
// get the value from the article
|
||||
$articleArray[$key] = $articleParams->get($key);
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise, use the global value
|
||||
$articleArray[$key] = $globalParams->get($key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// merge the selected article params
|
||||
if (count($articleArray) > 0)
|
||||
{
|
||||
$articleParams = new JRegistry;
|
||||
$articleParams->loadArray($articleArray);
|
||||
$item->params->merge($articleParams);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// For non-blog layouts, merge all of the article params
|
||||
$item->params->merge($articleParams);
|
||||
}
|
||||
|
||||
// get display date
|
||||
switch ($item->params->get('list_show_date'))
|
||||
{
|
||||
case 'modified':
|
||||
$item->displayDate = $item->modified;
|
||||
break;
|
||||
|
||||
case 'published':
|
||||
$item->displayDate = ($item->publish_up == 0) ? $item->created : $item->publish_up;
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'created':
|
||||
$item->displayDate = $item->created;
|
||||
break;
|
||||
}
|
||||
|
||||
// Compute the asset access permissions.
|
||||
// Technically guest could edit an article, but lets not check that to improve performance a little.
|
||||
if (!$guest)
|
||||
{
|
||||
$asset = 'com_content.article.' . $item->id;
|
||||
|
||||
// Check general edit permission first.
|
||||
if ($user->authorise('core.edit', $asset))
|
||||
{
|
||||
$item->params->set('access-edit', true);
|
||||
}
|
||||
// Now check if edit.own is available.
|
||||
elseif (!empty($userId) && $user->authorise('core.edit.own', $asset))
|
||||
{
|
||||
// Check for a valid user and that they are the owner.
|
||||
if ($userId == $item->created_by)
|
||||
{
|
||||
$item->params->set('access-edit', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$access = $this->getState('filter.access');
|
||||
|
||||
if ($access)
|
||||
{
|
||||
// If the access filter has been set, we already have only the articles this user can view.
|
||||
$item->params->set('access-view', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If no access filter is set, the layout takes some responsibility for display of limited information.
|
||||
if ($item->catid == 0 || $item->category_access === null)
|
||||
{
|
||||
$item->params->set('access-view', in_array($item->access, $groups));
|
||||
}
|
||||
else
|
||||
{
|
||||
$item->params->set('access-view', in_array($item->access, $groups) && in_array($item->category_access, $groups));
|
||||
}
|
||||
}
|
||||
|
||||
// Get the tags
|
||||
$item->tags = new JHelperTags;
|
||||
$item->tags->getItemTags('com_content.article', $item->id);
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
public function getStart()
|
||||
{
|
||||
return $this->getState('list.start');
|
||||
}
|
||||
}
|
132
components/com_content/models/categories.php
Normal file
132
components/com_content/models/categories.php
Normal file
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* This models supports retrieving lists of article categories.
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_content
|
||||
* @since 1.6
|
||||
*/
|
||||
class ContentModelCategories extends JModelList
|
||||
{
|
||||
/**
|
||||
* Model context string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $_context = 'com_content.categories';
|
||||
|
||||
/**
|
||||
* The category context (allows other extensions to derived from this model).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_extension = 'com_content';
|
||||
|
||||
private $_parent = null;
|
||||
|
||||
private $_items = null;
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$this->setState('filter.extension', $this->_extension);
|
||||
|
||||
// Get the parent id if defined.
|
||||
$parentId = $app->input->getInt('id');
|
||||
$this->setState('filter.parentId', $parentId);
|
||||
|
||||
$params = $app->getParams();
|
||||
$this->setState('params', $params);
|
||||
|
||||
$this->setState('filter.published', 1);
|
||||
$this->setState('filter.access', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
// Compile the store id.
|
||||
$id .= ':'.$this->getState('filter.extension');
|
||||
$id .= ':'.$this->getState('filter.published');
|
||||
$id .= ':'.$this->getState('filter.access');
|
||||
$id .= ':'.$this->getState('filter.parentId');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Redefine the function an add some properties to make the styling more easy
|
||||
*
|
||||
* @param bool $recursive True if you want to return children recursively.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItems($recursive = false)
|
||||
{
|
||||
if (!count($this->_items))
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$menu = $app->getMenu();
|
||||
$active = $menu->getActive();
|
||||
$params = new JRegistry;
|
||||
|
||||
if ($active)
|
||||
{
|
||||
$params->loadString($active->params);
|
||||
}
|
||||
|
||||
$options = array();
|
||||
$options['countItems'] = $params->get('show_cat_num_articles_cat', 1) || !$params->get('show_empty_categories_cat', 0);
|
||||
$categories = JCategories::getInstance('Content', $options);
|
||||
$this->_parent = $categories->get($this->getState('filter.parentId', 'root'));
|
||||
|
||||
if (is_object($this->_parent))
|
||||
{
|
||||
$this->_items = $this->_parent->getChildren($recursive);
|
||||
}
|
||||
else {
|
||||
$this->_items = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_items;
|
||||
}
|
||||
|
||||
public function getParent()
|
||||
{
|
||||
if (!is_object($this->_parent))
|
||||
{
|
||||
$this->getItems();
|
||||
}
|
||||
|
||||
return $this->_parent;
|
||||
}
|
||||
}
|
471
components/com_content/models/category.php
Normal file
471
components/com_content/models/category.php
Normal file
@ -0,0 +1,471 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* This models supports retrieving a category, the articles associated with the category,
|
||||
* sibling, child and parent categories.
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_content
|
||||
* @since 1.5
|
||||
*/
|
||||
class ContentModelCategory extends JModelList
|
||||
{
|
||||
/**
|
||||
* Category items data
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_item = null;
|
||||
|
||||
protected $_articles = null;
|
||||
|
||||
protected $_siblings = null;
|
||||
|
||||
protected $_children = null;
|
||||
|
||||
protected $_parent = null;
|
||||
|
||||
/**
|
||||
* Model context string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_context = 'com_content.category';
|
||||
|
||||
/**
|
||||
* The category that applies.
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $_category = null;
|
||||
|
||||
/**
|
||||
* The list of other newfeed categories.
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $_categories = null;
|
||||
|
||||
/**
|
||||
* 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',
|
||||
'modified', 'a.modified',
|
||||
'ordering', 'a.ordering',
|
||||
'featured', 'a.featured',
|
||||
'language', 'a.language',
|
||||
'hits', 'a.hits',
|
||||
'publish_up', 'a.publish_up',
|
||||
'publish_down', 'a.publish_down',
|
||||
'author', 'a.author'
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication('site');
|
||||
$pk = $app->input->getInt('id');
|
||||
|
||||
$this->setState('category.id', $pk);
|
||||
|
||||
// Load the parameters. Merge Global and Menu Item params into new object
|
||||
$params = $app->getParams();
|
||||
$menuParams = new JRegistry;
|
||||
|
||||
if ($menu = $app->getMenu()->getActive())
|
||||
{
|
||||
$menuParams->loadString($menu->params);
|
||||
}
|
||||
|
||||
$mergedParams = clone $menuParams;
|
||||
$mergedParams->merge($params);
|
||||
|
||||
$this->setState('params', $mergedParams);
|
||||
$user = JFactory::getUser();
|
||||
// Create a new query object.
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
if ((!$user->authorise('core.edit.state', 'com_content')) && (!$user->authorise('core.edit', 'com_content'))){
|
||||
// limit to published for people who can't edit or edit.state.
|
||||
$this->setState('filter.published', 1);
|
||||
// Filter by start and end dates.
|
||||
$nullDate = $db->quote($db->getNullDate());
|
||||
$nowDate = $db->quote(JFactory::getDate()->toSQL());
|
||||
|
||||
$query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')')
|
||||
->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setState('filter.published', array(0, 1, 2));
|
||||
}
|
||||
|
||||
// process show_noauth parameter
|
||||
if (!$params->get('show_noauth'))
|
||||
{
|
||||
$this->setState('filter.access', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setState('filter.access', false);
|
||||
}
|
||||
|
||||
// Optional filter text
|
||||
$this->setState('list.filter', $app->input->getString('filter-search'));
|
||||
|
||||
// filter.order
|
||||
$itemid = $app->input->get('id', 0, 'int') . ':' . $app->input->get('Itemid', 0, 'int');
|
||||
$orderCol = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order', 'filter_order', '', 'string');
|
||||
if (!in_array($orderCol, $this->filter_fields))
|
||||
{
|
||||
$orderCol = 'a.ordering';
|
||||
}
|
||||
$this->setState('list.ordering', $orderCol);
|
||||
|
||||
$listOrder = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir',
|
||||
'filter_order_Dir', '', 'cmd');
|
||||
if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', '')))
|
||||
{
|
||||
$listOrder = 'ASC';
|
||||
}
|
||||
$this->setState('list.direction', $listOrder);
|
||||
|
||||
$this->setState('list.start', $app->input->get('limitstart', 0, 'uint'));
|
||||
|
||||
// set limit for query. If list, use parameter. If blog, add blog parameters for limit.
|
||||
if (($app->input->get('layout') == 'blog') || $params->get('layout_type') == 'blog')
|
||||
{
|
||||
$limit = $params->get('num_leading_articles') + $params->get('num_intro_articles') + $params->get('num_links');
|
||||
$this->setState('list.links', $params->get('num_links'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$limit = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.limit', 'limit', $params->get('display_num'), 'uint');
|
||||
}
|
||||
|
||||
$this->setState('list.limit', $limit);
|
||||
|
||||
// set the depth of the category query based on parameter
|
||||
$showSubcategories = $params->get('show_subcategory_content', '0');
|
||||
|
||||
if ($showSubcategories)
|
||||
{
|
||||
$this->setState('filter.max_category_levels', $params->get('show_subcategory_content', '1'));
|
||||
$this->setState('filter.subcategories', true);
|
||||
}
|
||||
|
||||
$this->setState('filter.language', JLanguageMultilang::isEnabled());
|
||||
|
||||
$this->setState('layout', $app->input->get('layout'));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the articles in the category
|
||||
*
|
||||
* @return mixed An array of articles or false if an error occurs.
|
||||
* @since 1.5
|
||||
*/
|
||||
function getItems()
|
||||
{
|
||||
$limit = $this->getState('list.limit');
|
||||
|
||||
if ($this->_articles === null && $category = $this->getCategory())
|
||||
{
|
||||
$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
|
||||
$model->setState('params', JFactory::getApplication()->getParams());
|
||||
$model->setState('filter.category_id', $category->id);
|
||||
$model->setState('filter.published', $this->getState('filter.published'));
|
||||
$model->setState('filter.access', $this->getState('filter.access'));
|
||||
$model->setState('filter.language', $this->getState('filter.language'));
|
||||
$model->setState('list.ordering', $this->_buildContentOrderBy());
|
||||
$model->setState('list.start', $this->getState('list.start'));
|
||||
$model->setState('list.limit', $limit);
|
||||
$model->setState('list.direction', $this->getState('list.direction'));
|
||||
$model->setState('list.filter', $this->getState('list.filter'));
|
||||
// filter.subcategories indicates whether to include articles from subcategories in the list or blog
|
||||
$model->setState('filter.subcategories', $this->getState('filter.subcategories'));
|
||||
$model->setState('filter.max_category_levels', $this->setState('filter.max_category_levels'));
|
||||
$model->setState('list.links', $this->getState('list.links'));
|
||||
|
||||
if ($limit >= 0)
|
||||
{
|
||||
$this->_articles = $model->getItems();
|
||||
|
||||
if ($this->_articles === false)
|
||||
{
|
||||
$this->setError($model->getError());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_articles = array();
|
||||
}
|
||||
|
||||
$this->_pagination = $model->getPagination();
|
||||
}
|
||||
|
||||
return $this->_articles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the orderby for the query
|
||||
*
|
||||
* @return string $orderby portion of query
|
||||
* @since 1.5
|
||||
*/
|
||||
protected function _buildContentOrderBy()
|
||||
{
|
||||
$app = JFactory::getApplication('site');
|
||||
$db = $this->getDbo();
|
||||
$params = $this->state->params;
|
||||
$itemid = $app->input->get('id', 0, 'int') . ':' . $app->input->get('Itemid', 0, 'int');
|
||||
$orderCol = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order', 'filter_order', '', 'string');
|
||||
$orderDirn = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd');
|
||||
$orderby = ' ';
|
||||
|
||||
if (!in_array($orderCol, $this->filter_fields))
|
||||
{
|
||||
$orderCol = null;
|
||||
}
|
||||
|
||||
if (!in_array(strtoupper($orderDirn), array('ASC', 'DESC', '')))
|
||||
{
|
||||
$orderDirn = 'ASC';
|
||||
}
|
||||
|
||||
if ($orderCol && $orderDirn)
|
||||
{
|
||||
$orderby .= $db->escape($orderCol) . ' ' . $db->escape($orderDirn) . ', ';
|
||||
}
|
||||
|
||||
$articleOrderby = $params->get('orderby_sec', 'rdate');
|
||||
$articleOrderDate = $params->get('order_date');
|
||||
$categoryOrderby = $params->def('orderby_pri', '');
|
||||
$secondary = ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate) . ', ';
|
||||
$primary = ContentHelperQuery::orderbyPrimary($categoryOrderby);
|
||||
|
||||
$orderby .= $primary . ' ' . $secondary . ' a.created ';
|
||||
|
||||
return $orderby;
|
||||
}
|
||||
|
||||
public function getPagination()
|
||||
{
|
||||
if (empty($this->_pagination))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return $this->_pagination;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get category data for the current category
|
||||
*
|
||||
* @param integer An optional ID
|
||||
*
|
||||
* @return object
|
||||
* @since 1.5
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
if (!is_object($this->_item))
|
||||
{
|
||||
if ( isset( $this->state->params ) )
|
||||
{
|
||||
$params = $this->state->params;
|
||||
$options = array();
|
||||
$options['countItems'] = $params->get('show_cat_num_articles', 1) || !$params->get('show_empty_categories_cat', 0);
|
||||
}
|
||||
else {
|
||||
$options['countItems'] = 0;
|
||||
}
|
||||
|
||||
$categories = JCategories::getInstance('Content', $options);
|
||||
$this->_item = $categories->get($this->getState('category.id', 'root'));
|
||||
|
||||
// Compute selected asset permissions.
|
||||
if (is_object($this->_item))
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$asset = 'com_content.category.'.$this->_item->id;
|
||||
|
||||
// Check general create permission.
|
||||
if ($user->authorise('core.create', $asset))
|
||||
{
|
||||
$this->_item->getParams()->set('access-create', true);
|
||||
}
|
||||
|
||||
// TODO: Why aren't we lazy loading the children and siblings?
|
||||
$this->_children = $this->_item->getChildren();
|
||||
$this->_parent = false;
|
||||
|
||||
if ($this->_item->getParent())
|
||||
{
|
||||
$this->_parent = $this->_item->getParent();
|
||||
}
|
||||
|
||||
$this->_rightsibling = $this->_item->getSibling();
|
||||
$this->_leftsibling = $this->_item->getSibling(false);
|
||||
}
|
||||
else {
|
||||
$this->_children = false;
|
||||
$this->_parent = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent category.
|
||||
*
|
||||
* @param integer An optional category id. If not supplied, the model state 'category.id' will be used.
|
||||
*
|
||||
* @return mixed An array of categories or false if an error occurs.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
if (!is_object($this->_item))
|
||||
{
|
||||
$this->getCategory();
|
||||
}
|
||||
|
||||
return $this->_parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the left sibling (adjacent) categories.
|
||||
*
|
||||
* @return mixed An array of categories or false if an error occurs.
|
||||
* @since 1.6
|
||||
*/
|
||||
function &getLeftSibling()
|
||||
{
|
||||
if (!is_object($this->_item))
|
||||
{
|
||||
$this->getCategory();
|
||||
}
|
||||
|
||||
return $this->_leftsibling;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the right sibling (adjacent) categories.
|
||||
*
|
||||
* @return mixed An array of categories or false if an error occurs.
|
||||
* @since 1.6
|
||||
*/
|
||||
function &getRightSibling()
|
||||
{
|
||||
if (!is_object($this->_item))
|
||||
{
|
||||
$this->getCategory();
|
||||
}
|
||||
|
||||
return $this->_rightsibling;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the child categories.
|
||||
*
|
||||
* @param integer An optional category id. If not supplied, the model state 'category.id' will be used.
|
||||
*
|
||||
* @return mixed An array of categories or false if an error occurs.
|
||||
* @since 1.6
|
||||
*/
|
||||
function &getChildren()
|
||||
{
|
||||
if (!is_object($this->_item))
|
||||
{
|
||||
$this->getCategory();
|
||||
}
|
||||
|
||||
// Order subcategories
|
||||
if (count($this->_children))
|
||||
{
|
||||
$params = $this->getState()->get('params');
|
||||
if ($params->get('orderby_pri') == 'alpha' || $params->get('orderby_pri') == 'ralpha')
|
||||
{
|
||||
jimport('joomla.utilities.arrayhelper');
|
||||
JArrayHelper::sortObjects($this->_children, 'title', ($params->get('orderby_pri') == 'alpha') ? 1 : -1);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_children;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the hit counter for the category.
|
||||
*
|
||||
* @param int $pk Optional primary key of the category to increment.
|
||||
*
|
||||
* @return boolean True if successful; false otherwise and internal error set.
|
||||
*/
|
||||
public function hit($pk = 0)
|
||||
{
|
||||
// Initialise variables.
|
||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('category.id');
|
||||
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->update('#__categories')
|
||||
->set('hits = hits + 1')
|
||||
->where('id = ' . (int) $pk);
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$db->execute();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
$this->setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
142
components/com_content/models/featured.php
Normal file
142
components/com_content/models/featured.php
Normal file
@ -0,0 +1,142 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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';
|
||||
|
||||
/**
|
||||
* Frontpage Component Model
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_content
|
||||
* @since 1.5
|
||||
*/
|
||||
class ContentModelFeatured extends ContentModelArticles
|
||||
{
|
||||
/**
|
||||
* Model context string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $_context = 'com_content.frontpage';
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
parent::populateState($ordering, $direction);
|
||||
|
||||
$input = JFactory::getApplication()->input;
|
||||
$user = JFactory::getUser();
|
||||
|
||||
// List state information
|
||||
$limitstart = $input->getUInt('limitstart', 0);
|
||||
$this->setState('list.start', $limitstart);
|
||||
|
||||
$params = $this->state->params;
|
||||
$limit = $params->get('num_leading_articles') + $params->get('num_intro_articles') + $params->get('num_links');
|
||||
$this->setState('list.limit', $limit);
|
||||
$this->setState('list.links', $params->get('num_links'));
|
||||
|
||||
$this->setState('filter.frontpage', true);
|
||||
|
||||
if ((!$user->authorise('core.edit.state', 'com_content')) && (!$user->authorise('core.edit', 'com_content'))){
|
||||
// filter on published for those who do not have edit or edit.state rights.
|
||||
$this->setState('filter.published', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setState('filter.published', array(0, 1, 2));
|
||||
}
|
||||
|
||||
// check for category selection
|
||||
if ($params->get('featured_categories') && implode(',', $params->get('featured_categories')) == true)
|
||||
{
|
||||
$featuredCategories = $params->get('featured_categories');
|
||||
$this->setState('filter.frontpage.categories', $featuredCategories);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a list of articles.
|
||||
*
|
||||
* @return mixed An array of objects on success, false on failure.
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
$params = clone $this->getState('params');
|
||||
$limit = $params->get('num_leading_articles') + $params->get('num_intro_articles') + $params->get('num_links');
|
||||
if ($limit > 0)
|
||||
{
|
||||
$this->setState('list.limit', $limit);
|
||||
return parent::getItems();
|
||||
}
|
||||
return array();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
// Compile the store id.
|
||||
$id .= $this->getState('filter.frontpage');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JDatabaseQuery
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Set the blog ordering
|
||||
$params = $this->state->params;
|
||||
$articleOrderby = $params->get('orderby_sec', 'rdate');
|
||||
$articleOrderDate = $params->get('order_date');
|
||||
$categoryOrderby = $params->def('orderby_pri', '');
|
||||
$secondary = ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate) . ', ';
|
||||
$primary = ContentHelperQuery::orderbyPrimary($categoryOrderby);
|
||||
|
||||
$orderby = $primary . ' ' . $secondary . ' a.created DESC ';
|
||||
$this->setState('list.ordering', $orderby);
|
||||
$this->setState('list.direction', '');
|
||||
// Create a new query object.
|
||||
$query = parent::getListQuery();
|
||||
|
||||
// Filter by frontpage.
|
||||
if ($this->getState('filter.frontpage'))
|
||||
{
|
||||
$query->join('INNER', '#__content_frontpage AS fp ON fp.content_id = a.id');
|
||||
}
|
||||
|
||||
// Filter by categories
|
||||
if (is_array($featuredCategories = $this->getState('filter.frontpage.categories')))
|
||||
{
|
||||
$query->where('a.catid IN (' . implode(',', $featuredCategories) . ')');
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
177
components/com_content/models/form.php
Normal file
177
components/com_content/models/form.php
Normal file
@ -0,0 +1,177 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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;
|
||||
|
||||
// Base this model on the backend version.
|
||||
require_once JPATH_ADMINISTRATOR.'/components/com_content/models/article.php';
|
||||
|
||||
/**
|
||||
* Content Component Article Model
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_content
|
||||
* @since 1.5
|
||||
*/
|
||||
class ContentModelForm extends ContentModelArticle
|
||||
{
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Load state from the request.
|
||||
$pk = $app->input->getInt('a_id');
|
||||
$this->setState('article.id', $pk);
|
||||
|
||||
$this->setState('article.catid', $app->input->getInt('catid'));
|
||||
|
||||
$return = $app->input->get('return', null, 'base64');
|
||||
$this->setState('return_page', base64_decode($return));
|
||||
|
||||
// Load the parameters.
|
||||
$params = $app->getParams();
|
||||
$this->setState('params', $params);
|
||||
|
||||
$this->setState('layout', $app->input->get('layout'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get article data.
|
||||
*
|
||||
* @param integer The id of the article.
|
||||
*
|
||||
* @return mixed Content item data object on success, false on failure.
|
||||
*/
|
||||
public function getItem($itemId = null)
|
||||
{
|
||||
|
||||
$itemId = (int) (!empty($itemId)) ? $itemId : $this->getState('article.id');
|
||||
|
||||
// Get a row instance.
|
||||
$table = $this->getTable();
|
||||
|
||||
// Attempt to load the row.
|
||||
$return = $table->load($itemId);
|
||||
|
||||
// Check for a table object error.
|
||||
if ($return === false && $table->getError())
|
||||
{
|
||||
$this->setError($table->getError());
|
||||
return false;
|
||||
}
|
||||
|
||||
$properties = $table->getProperties(1);
|
||||
$value = JArrayHelper::toObject($properties, 'JObject');
|
||||
|
||||
// Convert attrib field to Registry.
|
||||
$value->params = new JRegistry;
|
||||
$value->params->loadString($value->attribs);
|
||||
|
||||
// Compute selected asset permissions.
|
||||
$user = JFactory::getUser();
|
||||
$userId = $user->get('id');
|
||||
$asset = 'com_content.article.'. $value->id;
|
||||
|
||||
// Check general edit permission first.
|
||||
if ($user->authorise('core.edit', $asset))
|
||||
{
|
||||
$value->params->set('access-edit', true);
|
||||
}
|
||||
// Now check if edit.own is available.
|
||||
elseif (!empty($userId) && $user->authorise('core.edit.own', $asset))
|
||||
{
|
||||
// Check for a valid user and that they are the owner.
|
||||
if ($userId == $value->created_by)
|
||||
{
|
||||
$value->params->set('access-edit', true);
|
||||
}
|
||||
}
|
||||
|
||||
// Check edit state permission.
|
||||
if ($itemId)
|
||||
{
|
||||
// Existing item
|
||||
$value->params->set('access-change', $user->authorise('core.edit.state', $asset));
|
||||
}
|
||||
else
|
||||
{
|
||||
// New item.
|
||||
$catId = (int) $this->getState('article.catid');
|
||||
|
||||
if ($catId)
|
||||
{
|
||||
$value->params->set('access-change', $user->authorise('core.edit.state', 'com_content.category.'.$catId));
|
||||
$value->catid = $catId;
|
||||
}
|
||||
else
|
||||
{
|
||||
$value->params->set('access-change', $user->authorise('core.edit.state', 'com_content'));
|
||||
}
|
||||
}
|
||||
|
||||
$value->articletext = $value->introtext;
|
||||
if (!empty($value->fulltext))
|
||||
{
|
||||
$value->articletext .= '<hr id="system-readmore" />'.$value->fulltext;
|
||||
}
|
||||
|
||||
// Convert the metadata field to an array.
|
||||
$registry = new JRegistry;
|
||||
$registry->loadString($value->metadata);
|
||||
$value->metadata = $registry->toArray();
|
||||
|
||||
if ($itemId)
|
||||
{
|
||||
$value->tags = new JHelperTags;
|
||||
$value->tags->getTagIds($value->id, 'com_content.article');
|
||||
$value->metadata['tags'] = $value->tags;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the return URL.
|
||||
*
|
||||
* @return string The return URL.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getReturnPage()
|
||||
{
|
||||
return base64_encode($this->getState('return_page'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save the form data.
|
||||
*
|
||||
* @param array $data The form data.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
// Prevent deleting multilang associations
|
||||
$app = JFactory::getApplication();
|
||||
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
|
||||
$app->item_associations = 0;
|
||||
$result = parent::save($data);
|
||||
$app->item_associations = $assoc;
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
345
components/com_content/models/forms/article.xml
Normal file
345
components/com_content/models/forms/article.xml
Normal file
@ -0,0 +1,345 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fieldset addfieldpath="/administrator/components/com_categories/models/fields">
|
||||
<field
|
||||
id="id"
|
||||
name="id"
|
||||
type="hidden"
|
||||
class="inputbox"
|
||||
label="COM_CONTENT_ID_LABEL"
|
||||
size="10"
|
||||
default="0"
|
||||
readonly="true" />
|
||||
|
||||
<field
|
||||
name="asset_id"
|
||||
type="hidden"
|
||||
filter="unset" />
|
||||
|
||||
<field
|
||||
id="title"
|
||||
name="title"
|
||||
type="text"
|
||||
label="JGLOBAL_TITLE"
|
||||
description="JFIELD_TITLE_DESC"
|
||||
class="inputbox"
|
||||
size="30"
|
||||
required="true" />
|
||||
|
||||
<field
|
||||
id="alias"
|
||||
name="alias"
|
||||
type="text"
|
||||
label="JFIELD_ALIAS_LABEL"
|
||||
description="JFIELD_ALIAS_DESC"
|
||||
class="inputbox"
|
||||
size="45" />
|
||||
|
||||
<field
|
||||
name="articletext"
|
||||
type="editor"
|
||||
buttons="true"
|
||||
label="CONTENT_TEXT_LABEL"
|
||||
description="CONTENT_TEXT_DESC"
|
||||
class="inputbox"
|
||||
filter="JComponentHelper::filterText"
|
||||
asset_id="com_content"
|
||||
/>
|
||||
|
||||
<field
|
||||
id="state"
|
||||
name="state"
|
||||
type="list"
|
||||
label="JSTATUS"
|
||||
description="JFIELD_PUBLISHED_DESC"
|
||||
class="inputbox"
|
||||
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
|
||||
id="featured"
|
||||
name="featured"
|
||||
type="list"
|
||||
label="JGLOBAL_FIELD_FEATURED_LABEL"
|
||||
description="JGLOBAL_FIELD_FEATURED_DESC"
|
||||
class="inputbox"
|
||||
default="0"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
id="catid"
|
||||
name="catid"
|
||||
type="categoryedit"
|
||||
extension="com_content"
|
||||
label="JCATEGORY"
|
||||
description="JFIELD_CATEGORY_DESC"
|
||||
class="inputbox"
|
||||
required="true">
|
||||
</field>
|
||||
|
||||
<field
|
||||
id="created"
|
||||
name="created"
|
||||
type="calendar"
|
||||
filter="unset" />
|
||||
|
||||
<field
|
||||
id="created_by"
|
||||
name="created_by"
|
||||
type="text"
|
||||
filter="unset" />
|
||||
|
||||
<field
|
||||
id="created_by_alias"
|
||||
name="created_by_alias"
|
||||
type="text"
|
||||
label="JGLOBAL_FIELD_CREATED_BY_ALIAS_LABEL"
|
||||
description="JGLOBAL_FIELD_CREATED_BY_ALIAS_DESC"
|
||||
class="inputbox"
|
||||
size="20" />
|
||||
|
||||
<field
|
||||
id="publish_up"
|
||||
name="publish_up"
|
||||
type="calendar"
|
||||
label="JGLOBAL_FIELD_PUBLISH_UP_LABEL"
|
||||
description="JGLOBAL_FIELD_PUBLISH_UP_DESC"
|
||||
class="inputbox"
|
||||
format="%Y-%m-%d %H:%M:%S"
|
||||
size="22"
|
||||
filter="user_utc" />
|
||||
|
||||
<field
|
||||
id="publish_down"
|
||||
name="publish_down"
|
||||
type="calendar"
|
||||
label="JGLOBAL_FIELD_PUBLISH_DOWN_LABEL"
|
||||
description="JGLOBAL_FIELD_PUBLISH_DOWN_DESC"
|
||||
class="inputbox"
|
||||
format="%Y-%m-%d %H:%M:%S"
|
||||
size="22"
|
||||
filter="user_utc" />
|
||||
|
||||
<field
|
||||
name="language"
|
||||
type="contentlanguage"
|
||||
label="JFIELD_LANGUAGE_LABEL"
|
||||
description="JFIELD_LANGUAGE_DESC"
|
||||
class="inputbox">
|
||||
<option value="*">JALL</option>
|
||||
</field>
|
||||
|
||||
<field name="tags"
|
||||
type="tag"
|
||||
label="JTAG"
|
||||
description="JTAG_DESC"
|
||||
class="inputbox span12 small"
|
||||
multiple="true"
|
||||
>
|
||||
</field>
|
||||
|
||||
<field
|
||||
id="metakey"
|
||||
name="metakey"
|
||||
type="textarea"
|
||||
label="JFIELD_META_KEYWORDS_LABEL"
|
||||
description="JFIELD_META_KEYWORDS_DESC"
|
||||
class="inputbox"
|
||||
rows="5"
|
||||
cols="50" />
|
||||
|
||||
<field
|
||||
id="metadesc"
|
||||
name="metadesc"
|
||||
type="textarea"
|
||||
label="JFIELD_META_DESCRIPTION_LABEL"
|
||||
description="JFIELD_META_DESCRIPTION_DESC"
|
||||
class="inputbox"
|
||||
rows="5"
|
||||
cols="50" />
|
||||
|
||||
|
||||
<field
|
||||
id="access"
|
||||
name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
class="inputbox"
|
||||
size="1" />
|
||||
</fieldset>
|
||||
<fields name="images">
|
||||
<fieldset name="image-intro">
|
||||
<field
|
||||
name="image_intro"
|
||||
type="media"
|
||||
label="COM_CONTENT_FIELD_INTRO_LABEL"
|
||||
description="COM_CONTENT_FIELD_INTRO_DESC" />
|
||||
<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" />
|
||||
<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" />
|
||||
<field
|
||||
name="float_intro"
|
||||
type="list"
|
||||
label="COM_CONTENT_FLOAT_INTRO_LABEL"
|
||||
description="COM_CONTENT_FLOAT_DESC">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="right">COM_CONTENT_RIGHT</option>
|
||||
<option value="left">COM_CONTENT_LEFT</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset name="image-full">
|
||||
<field
|
||||
name="image_fulltext"
|
||||
type="media"
|
||||
label="COM_CONTENT_FIELD_FULL_LABEL"
|
||||
description="COM_CONTENT_FIELD_FULL_DESC" />
|
||||
<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" />
|
||||
<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" />
|
||||
<field
|
||||
name="float_fulltext"
|
||||
type="list"
|
||||
label="COM_CONTENT_FLOAT_FULLTEXT_LABEL"
|
||||
description="COM_CONTENT_FLOAT_DESC">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="right">COM_CONTENT_RIGHT</option>
|
||||
<option value="left">COM_CONTENT_LEFT</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
<fields name="urls">
|
||||
<field
|
||||
name="urla"
|
||||
type="url"
|
||||
validate="url"
|
||||
label="COM_CONTENT_FIELD_URLA_LABEL"
|
||||
description="COM_CONTENT_FIELD_URL_DESC" />
|
||||
<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" />
|
||||
<field
|
||||
name="targeta"
|
||||
type="hidden"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="urlb"
|
||||
type="url"
|
||||
validate="url"
|
||||
label="COM_CONTENT_FIELD_URLB_LABEL"
|
||||
description="COM_CONTENT_FIELD_URL_DESC" />
|
||||
<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" />
|
||||
<field
|
||||
name="targetb"
|
||||
type="hidden"
|
||||
/>
|
||||
<field
|
||||
name="urlc"
|
||||
type="url"
|
||||
validate="url"
|
||||
label="COM_CONTENT_FIELD_URLC_LABEL"
|
||||
description="COM_CONTENT_FIELD_URL_DESC" />
|
||||
<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" />
|
||||
<field
|
||||
name="targetc"
|
||||
type="hidden"
|
||||
/>
|
||||
</fields>
|
||||
<fields name="metadata">
|
||||
<fieldset name="jmetadata"
|
||||
label="JGLOBAL_FIELDSET_METADATA_OPTIONS">
|
||||
|
||||
<field name="robots"
|
||||
type="hidden"
|
||||
filter="unset"
|
||||
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="hidden"
|
||||
filter="unset"
|
||||
label="JAUTHOR"
|
||||
description="JFIELD_METADATA_AUTHOR_DESC"
|
||||
size="20"
|
||||
labelclass="control-label"
|
||||
/>
|
||||
|
||||
<field name="rights"
|
||||
type="hidden"
|
||||
label="JFIELD_META_RIGHTS_LABEL"
|
||||
filter="unset"
|
||||
description="JFIELD_META_RIGHTS_DESC"
|
||||
required="false"
|
||||
labelclass="control-label"
|
||||
/>
|
||||
|
||||
<field name="xreference"
|
||||
type="hidden"
|
||||
filter="unset"
|
||||
label="COM_CONTENT_FIELD_XREFERENCE_LABEL"
|
||||
description="COM_CONTENT_FIELD_XREFERENCE_DESC"
|
||||
class="inputbox"
|
||||
size="20"
|
||||
labelclass="control-label" />
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
|
||||
</form>
|
1
components/com_content/models/forms/index.html
Normal file
1
components/com_content/models/forms/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
1
components/com_content/models/index.html
Normal file
1
components/com_content/models/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
403
components/com_content/router.php
Normal file
403
components/com_content/router.php
Normal file
@ -0,0 +1,403 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Build the route for the com_content component
|
||||
*
|
||||
* @return array An array of URL arguments
|
||||
* @return array The URL arguments to use to assemble the subsequent URL.
|
||||
* @since 1.5
|
||||
*/
|
||||
function ContentBuildRoute(&$query)
|
||||
{
|
||||
$segments = array();
|
||||
|
||||
// get a menu item based on Itemid or currently active
|
||||
$app = JFactory::getApplication();
|
||||
$menu = $app->getMenu();
|
||||
$params = JComponentHelper::getParams('com_content');
|
||||
$advanced = $params->get('sef_advanced_link', 0);
|
||||
|
||||
// we need a menu item. Either the one specified in the query, or the current active one if none specified
|
||||
if (empty($query['Itemid']))
|
||||
{
|
||||
$menuItem = $menu->getActive();
|
||||
$menuItemGiven = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$menuItem = $menu->getItem($query['Itemid']);
|
||||
$menuItemGiven = true;
|
||||
}
|
||||
|
||||
// check again
|
||||
if ($menuItemGiven && isset($menuItem) && $menuItem->component != 'com_content')
|
||||
{
|
||||
$menuItemGiven = false;
|
||||
unset($query['Itemid']);
|
||||
}
|
||||
|
||||
if (isset($query['view']))
|
||||
{
|
||||
$view = $query['view'];
|
||||
}
|
||||
else
|
||||
{
|
||||
// we need to have a view in the query or it is an invalid URL
|
||||
return $segments;
|
||||
}
|
||||
|
||||
// are we dealing with an article or category that is attached to a menu item?
|
||||
if (($menuItem instanceof stdClass) && $menuItem->query['view'] == $query['view'] && isset($query['id']) && $menuItem->query['id'] == (int) $query['id'])
|
||||
{
|
||||
unset($query['view']);
|
||||
|
||||
if (isset($query['catid']))
|
||||
{
|
||||
unset($query['catid']);
|
||||
}
|
||||
|
||||
if (isset($query['layout']))
|
||||
{
|
||||
unset($query['layout']);
|
||||
}
|
||||
|
||||
unset($query['id']);
|
||||
|
||||
return $segments;
|
||||
}
|
||||
|
||||
if ($view == 'category' || $view == 'article')
|
||||
{
|
||||
if (!$menuItemGiven)
|
||||
{
|
||||
$segments[] = $view;
|
||||
}
|
||||
|
||||
unset($query['view']);
|
||||
|
||||
if ($view == 'article')
|
||||
{
|
||||
if (isset($query['id']) && isset($query['catid']) && $query['catid'])
|
||||
{
|
||||
$catid = $query['catid'];
|
||||
// Make sure we have the id and the alias
|
||||
if (strpos($query['id'], ':') === false)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$dbQuery = $db->getQuery(true)
|
||||
->select('alias')
|
||||
->from('#__content')
|
||||
->where('id=' . (int) $query['id']);
|
||||
$db->setQuery($dbQuery);
|
||||
$alias = $db->loadResult();
|
||||
$query['id'] = $query['id'] . ':' . $alias;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// we should have these two set for this view. If we don't, it is an error
|
||||
return $segments;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($query['id']))
|
||||
{
|
||||
$catid = $query['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
// we should have id set for this view. If we don't, it is an error
|
||||
return $segments;
|
||||
}
|
||||
}
|
||||
|
||||
if ($menuItemGiven && isset($menuItem->query['id']))
|
||||
{
|
||||
$mCatid = $menuItem->query['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$mCatid = 0;
|
||||
}
|
||||
|
||||
$categories = JCategories::getInstance('Content');
|
||||
$category = $categories->get($catid);
|
||||
|
||||
if (!$category)
|
||||
{
|
||||
// we couldn't find the category we were given. Bail.
|
||||
return $segments;
|
||||
}
|
||||
|
||||
$path = array_reverse($category->getPath());
|
||||
|
||||
$array = array();
|
||||
|
||||
foreach ($path as $id)
|
||||
{
|
||||
if ((int) $id == (int) $mCatid)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
list($tmp, $id) = explode(':', $id, 2);
|
||||
|
||||
$array[] = $id;
|
||||
}
|
||||
|
||||
$array = array_reverse($array);
|
||||
|
||||
if (!$advanced && count($array))
|
||||
{
|
||||
$array[0] = (int) $catid . ':' . $array[0];
|
||||
}
|
||||
|
||||
$segments = array_merge($segments, $array);
|
||||
|
||||
if ($view == 'article')
|
||||
{
|
||||
if ($advanced)
|
||||
{
|
||||
list($tmp, $id) = explode(':', $query['id'], 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
$id = $query['id'];
|
||||
}
|
||||
$segments[] = $id;
|
||||
}
|
||||
unset($query['id']);
|
||||
unset($query['catid']);
|
||||
}
|
||||
|
||||
if ($view == 'archive')
|
||||
{
|
||||
if (!$menuItemGiven)
|
||||
{
|
||||
$segments[] = $view;
|
||||
unset($query['view']);
|
||||
}
|
||||
|
||||
if (isset($query['year']))
|
||||
{
|
||||
if ($menuItemGiven)
|
||||
{
|
||||
$segments[] = $query['year'];
|
||||
unset($query['year']);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($query['year']) && isset($query['month']))
|
||||
{
|
||||
if ($menuItemGiven)
|
||||
{
|
||||
$segments[] = $query['month'];
|
||||
unset($query['month']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if the layout is specified and it is the same as the layout in the menu item, we
|
||||
// unset it so it doesn't go into the query string.
|
||||
if (isset($query['layout']))
|
||||
{
|
||||
if ($menuItemGiven && isset($menuItem->query['layout']))
|
||||
{
|
||||
if ($query['layout'] == $menuItem->query['layout'])
|
||||
{
|
||||
unset($query['layout']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($query['layout'] == 'default')
|
||||
{
|
||||
unset($query['layout']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $segments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the segments of a URL.
|
||||
*
|
||||
* @return array The segments of the URL to parse.
|
||||
*
|
||||
* @return array The URL attributes to be used by the application.
|
||||
* @since 1.5
|
||||
*/
|
||||
function ContentParseRoute($segments)
|
||||
{
|
||||
$vars = array();
|
||||
|
||||
//Get the active menu item.
|
||||
$app = JFactory::getApplication();
|
||||
$menu = $app->getMenu();
|
||||
$item = $menu->getActive();
|
||||
$params = JComponentHelper::getParams('com_content');
|
||||
$advanced = $params->get('sef_advanced_link', 0);
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
// Count route segments
|
||||
$count = count($segments);
|
||||
|
||||
// Standard routing for articles. If we don't pick up an Itemid then we get the view from the segments
|
||||
// the first segment is the view and the last segment is the id of the article or category.
|
||||
if (!isset($item))
|
||||
{
|
||||
$vars['view'] = $segments[0];
|
||||
$vars['id'] = $segments[$count - 1];
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
// if there is only one segment, then it points to either an article or a category
|
||||
// we test it first to see if it is a category. If the id and alias match a category
|
||||
// then we assume it is a category. If they don't we assume it is an article
|
||||
if ($count == 1)
|
||||
{
|
||||
// we check to see if an alias is given. If not, we assume it is an article
|
||||
if (strpos($segments[0], ':') === false)
|
||||
{
|
||||
$vars['view'] = 'article';
|
||||
$vars['id'] = (int) $segments[0];
|
||||
return $vars;
|
||||
}
|
||||
|
||||
list($id, $alias) = explode(':', $segments[0], 2);
|
||||
|
||||
// first we check if it is a category
|
||||
$category = JCategories::getInstance('Content')->get($id);
|
||||
|
||||
if ($category && $category->alias == $alias)
|
||||
{
|
||||
$vars['view'] = 'category';
|
||||
$vars['id'] = $id;
|
||||
|
||||
return $vars;
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = 'SELECT alias, catid FROM #__content WHERE id = ' . (int) $id;
|
||||
$db->setQuery($query);
|
||||
$article = $db->loadObject();
|
||||
|
||||
if ($article)
|
||||
{
|
||||
if ($article->alias == $alias)
|
||||
{
|
||||
$vars['view'] = 'article';
|
||||
$vars['catid'] = (int) $article->catid;
|
||||
$vars['id'] = (int) $id;
|
||||
|
||||
return $vars;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if there was more than one segment, then we can determine where the URL points to
|
||||
// because the first segment will have the target category id prepended to it. If the
|
||||
// last segment has a number prepended, it is an article, otherwise, it is a category.
|
||||
if (!$advanced)
|
||||
{
|
||||
$cat_id = (int) $segments[0];
|
||||
|
||||
$article_id = (int) $segments[$count - 1];
|
||||
|
||||
if ($article_id > 0)
|
||||
{
|
||||
$vars['view'] = 'article';
|
||||
$vars['catid'] = $cat_id;
|
||||
$vars['id'] = $article_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$vars['view'] = 'category';
|
||||
$vars['id'] = $cat_id;
|
||||
}
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
// we get the category id from the menu item and search from there
|
||||
$id = $item->query['id'];
|
||||
$category = JCategories::getInstance('Content')->get($id);
|
||||
|
||||
if (!$category)
|
||||
{
|
||||
JError::raiseError(404, JText::_('COM_CONTENT_ERROR_PARENT_CATEGORY_NOT_FOUND'));
|
||||
return $vars;
|
||||
}
|
||||
|
||||
$categories = $category->getChildren();
|
||||
$vars['catid'] = $id;
|
||||
$vars['id'] = $id;
|
||||
$found = 0;
|
||||
|
||||
foreach ($segments as $segment)
|
||||
{
|
||||
$segment = str_replace(':', '-', $segment);
|
||||
|
||||
foreach ($categories as $category)
|
||||
{
|
||||
if ($category->alias == $segment)
|
||||
{
|
||||
$vars['id'] = $category->id;
|
||||
$vars['catid'] = $category->id;
|
||||
$vars['view'] = 'category';
|
||||
$categories = $category->getChildren();
|
||||
$found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($found == 0)
|
||||
{
|
||||
if ($advanced)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('id'))
|
||||
->from('#__content')
|
||||
->where($db->quoteName('catid') . ' = ' . (int) $vars['catid'])
|
||||
->where($db->quoteName('alias') . ' = ' . $db->quote($db->quote($segment)));
|
||||
$db->setQuery($query);
|
||||
$cid = $db->loadResult();
|
||||
}
|
||||
else
|
||||
{
|
||||
$cid = $segment;
|
||||
}
|
||||
|
||||
$vars['id'] = $cid;
|
||||
|
||||
if ($item->query['view'] == 'archive' && $count != 1)
|
||||
{
|
||||
$vars['year'] = $count >= 2 ? $segments[$count - 2] : null;
|
||||
$vars['month'] = $segments[$count - 1];
|
||||
$vars['view'] = 'archive';
|
||||
}
|
||||
else
|
||||
{
|
||||
$vars['view'] = 'article';
|
||||
}
|
||||
}
|
||||
|
||||
$found = 0;
|
||||
}
|
||||
|
||||
return $vars;
|
||||
}
|
1
components/com_content/views/archive/index.html
Normal file
1
components/com_content/views/archive/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
6
components/com_content/views/archive/metadata.xml
Normal file
6
components/com_content/views/archive/metadata.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<view title="Archive">
|
||||
<message><![CDATA[TYPEARCHLAYDESC]]></message>
|
||||
</view>
|
||||
</metadata>
|
45
components/com_content/views/archive/tmpl/default.php
Normal file
45
components/com_content/views/archive/tmpl/default.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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;
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
|
||||
|
||||
JHtml::_('behavior.caption');
|
||||
?>
|
||||
<div class="archive<?php echo $this->pageclass_sfx;?>">
|
||||
<?php if ($this->params->get('show_page_heading', 1)) : ?>
|
||||
<div class="page-header">
|
||||
<h1>
|
||||
<?php echo $this->escape($this->params->get('page_heading')); ?>
|
||||
</h1>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<form id="adminForm" action="<?php echo JRoute::_('index.php')?>" method="post" class="form-inline">
|
||||
<fieldset class="filters">
|
||||
<div class="filter-search alert alert-info">
|
||||
<?php if ($this->params->get('filter_field') != 'hide') : ?>
|
||||
<label class="filter-search-lbl" for="filter-search"><?php echo JText::_('COM_CONTENT_'.$this->params->get('filter_field').'_FILTER_LABEL').' '; ?></label>
|
||||
<input type="text" name="filter-search" id="filter-search" value="<?php echo $this->escape($this->filter); ?>" class="inputbox span2" onchange="document.getElementById('adminForm').submit();" />
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $this->form->monthField; ?>
|
||||
<?php echo $this->form->yearField; ?>
|
||||
<?php echo $this->form->limitField; ?>
|
||||
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary"><?php echo JText::_('JGLOBAL_FILTER_BUTTON'); ?></button>
|
||||
<input type="hidden" name="view" value="archive" />
|
||||
<input type="hidden" name="option" value="com_content" />
|
||||
<input type="hidden" name="limitstart" value="0" />
|
||||
</fieldset>
|
||||
|
||||
<?php echo $this->loadTemplate('items'); ?>
|
||||
</form>
|
||||
</div>
|
221
components/com_content/views/archive/tmpl/default.xml
Normal file
221
components/com_content/views/archive/tmpl/default.xml
Normal file
@ -0,0 +1,221 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="com_content_archive_view_default_title" option="com_content_archive_view_default_option">
|
||||
<help
|
||||
key = "JHELP_MENUS_MENU_ITEM_ARTICLE_ARCHIVED"
|
||||
/>
|
||||
<message>
|
||||
<![CDATA[com_content_archive_view_default_desc]]>
|
||||
</message>
|
||||
</layout>
|
||||
|
||||
<!-- Add fields to the parameters object for the layout. -->
|
||||
<fields name="params">
|
||||
|
||||
<!-- Basic options. -->
|
||||
<fieldset name="basic" label="JGLOBAL_ARCHIVE_OPTIONS"
|
||||
>
|
||||
|
||||
<field name="orderby_sec" type="list"
|
||||
default="alpha"
|
||||
description="JGLOBAL_ARTICLE_ORDER_DESC"
|
||||
label="JGLOBAL_ARTICLE_ORDER_LABEL"
|
||||
>
|
||||
<option value="date">JGLOBAL_OLDEST_FIRST</option>
|
||||
<option value="rdate">JGLOBAL_MOST_RECENT_FIRST</option>
|
||||
<option value="alpha">JGLOBAL_TITLE_ALPHABETICAL</option>
|
||||
<option value="ralpha">JGLOBAL_TITLE_REVERSE_ALPHABETICAL</option>
|
||||
<option value="author">JGLOBAL_AUTHOR_ALPHABETICAL</option>
|
||||
<option value="rauthor">JGLOBAL_AUTHOR_REVERSE_ALPHABETICAL</option>
|
||||
<option value="hits">JGLOBAL_MOST_HITS</option>
|
||||
<option value="rhits">JGLOBAL_LEAST_HITS</option>
|
||||
<option value="order">JGLOBAL_ARTICLE_MANAGER_ORDER</option>
|
||||
</field>
|
||||
|
||||
<field name="order_date" type="list"
|
||||
default="created"
|
||||
description="JGLOBAL_ORDERING_DATE_DESC"
|
||||
label="JGLOBAL_ORDERING_DATE_LABEL"
|
||||
>
|
||||
<option value="created">JGLOBAL_Created</option>
|
||||
<option value="modified">JGLOBAL_Modified</option>
|
||||
<option value="published">JPUBLISHED</option>
|
||||
</field>
|
||||
|
||||
<field name="display_num" type="list"
|
||||
default="5"
|
||||
description="JGLOBAL_NUMBER_ITEMS_LIST_DESC"
|
||||
label="JGLOBAL_NUMBER_ITEMS_LIST_LABEL"
|
||||
>
|
||||
<option value="5">J5</option>
|
||||
<option value="10">J10</option>
|
||||
<option value="15">J15</option>
|
||||
<option value="20">J20</option>
|
||||
<option value="25">J25</option>
|
||||
<option value="30">J30</option>
|
||||
<option value="50">J50</option>
|
||||
<option value="100">J100</option>
|
||||
<option value="0">JALL</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="filter_field"
|
||||
type="list"
|
||||
default=""
|
||||
description="JGLOBAL_FILTER_FIELD_DESC"
|
||||
label="JGLOBAL_FILTER_FIELD_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="hide">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="introtext_limit" type="text" default="100"
|
||||
label="JGLOBAL_ARCHIVE_ARTICLES_FIELD_INTROTEXTLIMIT_LABEL"
|
||||
description="JGLOBAL_ARCHIVE_ARTICLES_FIELD_INTROTEXTLIMIT_DESC" />
|
||||
|
||||
</fieldset>
|
||||
|
||||
<!-- Articles options. -->
|
||||
<fieldset name="articles"
|
||||
label="COM_CONTENT_ATTRIBS_ARTICLE_SETTINGS_LABEL"
|
||||
>
|
||||
|
||||
<field name="show_intro" type="list"
|
||||
description="JGLOBAL_SHOW_INTRO_DESC"
|
||||
label="JGLOBAL_SHOW_INTRO_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="use_article">COM_CONTENT_FIELD_VALUE_USE_ARTICLE_SETTINGS</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="list"
|
||||
description="JGLOBAL_SHOW_CATEGORY_DESC"
|
||||
label="JGLOBAL_SHOW_CATEGORY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="link_category" type="list"
|
||||
description="JGLOBAL_LINK_CATEGORY_DESC"
|
||||
label="JGLOBAL_LINK_CATEGORY_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNo</option>
|
||||
<option value="1">JYes</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_parent_category"
|
||||
type="list"
|
||||
label="JGLOBAL_SHOW_PARENT_CATEGORY_LABEL"
|
||||
description="JGLOBAL_SHOW_PARENT_CATEGORY_DESC">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="link_parent_category"
|
||||
type="list"
|
||||
label="JGLOBAL_LINK_PARENT_CATEGORY_LABEL"
|
||||
description="JGLOBAL_LINK_PARENT_CATEGORY_DESC">
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="link_titles" type="list"
|
||||
description="JGLOBAL_LINKED_TITLES_DESC"
|
||||
label="JGLOBAL_LINKED_TITLES_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="show_author" type="list"
|
||||
description="JGLOBAL_SHOW_AUTHOR_DESC"
|
||||
label="JGLOBAL_SHOW_AUTHOR_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="link_author"
|
||||
type="list"
|
||||
label="JGLOBAL_LINK_AUTHOR_LABEL"
|
||||
description="JGLOBAL_LINK_AUTHOR_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="show_create_date" type="list"
|
||||
description="JGLOBAL_SHOW_CREATE_DATE_DESC"
|
||||
label="JGLOBAL_SHOW_CREATE_DATE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_modify_date" type="list"
|
||||
description="JGLOBAL_SHOW_MODIFY_DATE_DESC"
|
||||
label="JGLOBAL_SHOW_MODIFY_DATE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_publish_date" type="list"
|
||||
description="JGLOBAL_SHOW_PUBLISH_DATE_DESC"
|
||||
label="JGLOBAL_SHOW_PUBLISH_DATE_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
|
||||
<field name="show_item_navigation" type="list"
|
||||
description="JGLOBAL_SHOW_NAVIGATION_DESC"
|
||||
label="JGLOBAL_SHOW_NAVIGATION_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_hits" type="list"
|
||||
description="JGLOBAL_SHOW_HITS_DESC"
|
||||
label="JGLOBAL_SHOW_HITS_LABEL"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
</fields>
|
||||
</metadata>
|
190
components/com_content/views/archive/tmpl/default_items.php
Normal file
190
components/com_content/views/archive/tmpl/default_items.php
Normal file
@ -0,0 +1,190 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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;
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
|
||||
$params = $this->params;
|
||||
?>
|
||||
|
||||
<div id="archive-items">
|
||||
<?php foreach ($this->items as $i => $item) : ?>
|
||||
<?php $info = $item->params->get('info_block_position', 0); ?>
|
||||
<div class="row<?php echo $i % 2; ?>">
|
||||
<div class="page-header">
|
||||
<h2>
|
||||
<?php if ($params->get('link_titles')) : ?>
|
||||
<a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug)); ?>"> <?php echo $this->escape($item->title); ?></a>
|
||||
<?php else: ?>
|
||||
<?php echo $this->escape($item->title); ?>
|
||||
<?php endif; ?>
|
||||
</h2>
|
||||
<?php if ($params->get('show_author') && !empty($item->author )) : ?>
|
||||
<div class="createdby">
|
||||
<?php $author = $item->author; ?>
|
||||
<?php $author = ($item->created_by_alias ? $item->created_by_alias : $author); ?>
|
||||
<?php if (!empty($item->contactid ) && $params->get('link_author') == true) : ?>
|
||||
<?php echo JText::sprintf(
|
||||
'COM_CONTENT_WRITTEN_BY',
|
||||
JHtml::_('link', JRoute::_('index.php?option=com_contact&view=contact&id='.$item->contactid), $author)
|
||||
); ?>
|
||||
<?php else :?>
|
||||
<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php $useDefList = ($params->get('show_modify_date') || $params->get('show_publish_date') || $params->get('show_create_date')
|
||||
|| $params->get('show_hits') || $params->get('show_category') || $params->get('show_parent_category')); ?>
|
||||
<?php if ($useDefList && ($info == 0 || $info == 2)) : ?>
|
||||
<div class="article-info muted">
|
||||
<dl class="article-info">
|
||||
<dt class="article-info-term">
|
||||
<?php echo JText::_('COM_CONTENT_ARTICLE_INFO'); ?>
|
||||
</dt>
|
||||
|
||||
<?php if ($params->get('show_parent_category') && !empty($item->parent_slug)) : ?>
|
||||
<dd>
|
||||
<div class="parent-category-name">
|
||||
<?php $title = $this->escape($item->parent_title);
|
||||
$url = '<a href="' . JRoute::_(ContentHelperRoute::getCategoryRoute($item->parent_slug)).'">' . $title . '</a>'; ?>
|
||||
<?php if ($params->get('link_parent_category') && !empty($item->parent_slug)) : ?>
|
||||
<?php echo JText::sprintf('COM_CONTENT_PARENT', $url); ?>
|
||||
<?php else : ?>
|
||||
<?php echo JText::sprintf('COM_CONTENT_PARENT', $title); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
<?php if ($params->get('show_category')) : ?>
|
||||
<dd>
|
||||
<div class="category-name">
|
||||
<?php $title = $this->escape($item->category_title);
|
||||
$url = '<a href="' . JRoute::_(ContentHelperRoute::getCategoryRoute($item->catslug)).'">' . $title . '</a>'; ?>
|
||||
<?php if ($params->get('link_category') && $item->catslug) : ?>
|
||||
<?php echo JText::sprintf('COM_CONTENT_CATEGORY', $url); ?>
|
||||
<?php else : ?>
|
||||
<?php echo JText::sprintf('COM_CONTENT_CATEGORY', $title); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('show_publish_date')) : ?>
|
||||
<dd>
|
||||
<div class="published">
|
||||
<span class="icon-calendar"></span> <?php echo JText::sprintf('COM_CONTENT_PUBLISHED_DATE_ON', JHtml::_('date', $item->publish_up, JText::_('DATE_FORMAT_LC3'))); ?>
|
||||
</div>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($info == 0) : ?>
|
||||
<?php if ($params->get('show_modify_date')) : ?>
|
||||
<dd>
|
||||
<div class="modified">
|
||||
<span class="icon-calendar"></span> <?php echo JText::sprintf('COM_CONTENT_LAST_UPDATED', JHtml::_('date', $item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
|
||||
</div>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
<?php if ($params->get('show_create_date')) : ?>
|
||||
<dd>
|
||||
<div class="create">
|
||||
<span class="icon-calendar"></span> <?php echo JText::sprintf('COM_CONTENT_CREATED_DATE_ON', JHtml::_('date', $item->created, JText::_('DATE_FORMAT_LC3'))); ?>
|
||||
</div>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('show_hits')) : ?>
|
||||
<dd>
|
||||
<div class="hits">
|
||||
<span class="icon-eye-open"></span> <?php echo JText::sprintf('COM_CONTENT_ARTICLE_HITS', $item->hits); ?>
|
||||
</div>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</dl>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('show_intro')) :?>
|
||||
<div class="intro"> <?php echo JHtml::_('string.truncateComplex', $item->introtext, $params->get('introtext_limit')); ?> </div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($useDefList && ($info == 1 || $info == 2)) : ?>
|
||||
<div class="article-info muted">
|
||||
<dl class="article-info">
|
||||
<dt class="article-info-term"><?php echo JText::_('COM_CONTENT_ARTICLE_INFO'); ?></dt>
|
||||
|
||||
<?php if ($info == 1) : ?>
|
||||
<?php if ($params->get('show_parent_category') && !empty($item->parent_slug)) : ?>
|
||||
<dd>
|
||||
<div class="parent-category-name">
|
||||
<?php $title = $this->escape($item->parent_title);
|
||||
$url = '<a href="' . JRoute::_(ContentHelperRoute::getCategoryRoute($item->parent_slug)) . '">' . $title . '</a>';?>
|
||||
<?php if ($params->get('link_parent_category') && $item->parent_slug) : ?>
|
||||
<?php echo JText::sprintf('COM_CONTENT_PARENT', $url); ?>
|
||||
<?php else : ?>
|
||||
<?php echo JText::sprintf('COM_CONTENT_PARENT', $title); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
<?php if ($params->get('show_category')) : ?>
|
||||
<dd>
|
||||
<div class="category-name">
|
||||
<?php $title = $this->escape($item->category_title);
|
||||
$url = '<a href="' . JRoute::_(ContentHelperRoute::getCategoryRoute($item->catslug)) . '">' . $title . '</a>'; ?>
|
||||
<?php if ($params->get('link_category') && $item->catslug) : ?>
|
||||
<?php echo JText::sprintf('COM_CONTENT_CATEGORY', $url); ?>
|
||||
<?php else : ?>
|
||||
<?php echo JText::sprintf('COM_CONTENT_CATEGORY', $title); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
<?php if ($params->get('show_publish_date')) : ?>
|
||||
<dd>
|
||||
<div class="published">
|
||||
<span class="icon-calendar"></span> <?php echo JText::sprintf('COM_CONTENT_PUBLISHED_DATE_ON', JHtml::_('date', $item->publish_up, JText::_('DATE_FORMAT_LC3'))); ?>
|
||||
</div>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('show_create_date')) : ?>
|
||||
<dd>
|
||||
<div class="create"><span class="icon-calendar">
|
||||
</span> <?php echo JText::sprintf('COM_CONTENT_CREATED_DATE_ON', JHtml::_('date', $item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
|
||||
</div>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
<?php if ($params->get('show_modify_date')) : ?>
|
||||
<dd>
|
||||
<div class="modified"><span class="icon-calendar">
|
||||
</span> <?php echo JText::sprintf('COM_CONTENT_LAST_UPDATED', JHtml::_('date', $item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
|
||||
</div>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
<?php if ($params->get('show_hits')) : ?>
|
||||
<dd>
|
||||
<div class="hits">
|
||||
<span class="icon-eye-open"></span> <?php echo JText::sprintf('COM_CONTENT_ARTICLE_HITS', $item->hits); ?>
|
||||
</div>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
</dl>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="pagination">
|
||||
<p class="counter"> <?php echo $this->pagination->getPagesCounter(); ?> </p>
|
||||
<?php echo $this->pagination->getPagesLinks(); ?>
|
||||
</div>
|
1
components/com_content/views/archive/tmpl/index.html
Normal file
1
components/com_content/views/archive/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
160
components/com_content/views/archive/view.html.php
Normal file
160
components/com_content/views/archive/view.html.php
Normal file
@ -0,0 +1,160 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* HTML View class for the Content component
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_content
|
||||
* @since 1.5
|
||||
*/
|
||||
class ContentViewArchive extends JViewLegacy
|
||||
{
|
||||
protected $state = null;
|
||||
|
||||
protected $item = null;
|
||||
|
||||
protected $items = null;
|
||||
|
||||
protected $pagination = null;
|
||||
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
|
||||
$state = $this->get('State');
|
||||
$items = $this->get('Items');
|
||||
$pagination = $this->get('Pagination');
|
||||
|
||||
// Get the page/component configuration
|
||||
$params = &$state->params;
|
||||
|
||||
foreach ($items as $item)
|
||||
{
|
||||
$item->catslug = ($item->category_alias) ? ($item->catid . ':' . $item->category_alias) : $item->catid;
|
||||
$item->parent_slug = ($item->parent_alias) ? ($item->parent_id . ':' . $item->parent_alias) : $item->parent_id;
|
||||
|
||||
// No link for ROOT category
|
||||
if ($item->parent_alias == 'root')
|
||||
{
|
||||
$item->parent_slug = null;
|
||||
}
|
||||
}
|
||||
|
||||
$form = new stdClass;
|
||||
// Month Field
|
||||
$months = array(
|
||||
'' => JText::_('COM_CONTENT_MONTH'),
|
||||
'01' => JText::_('JANUARY_SHORT'),
|
||||
'02' => JText::_('FEBRUARY_SHORT'),
|
||||
'03' => JText::_('MARCH_SHORT'),
|
||||
'04' => JText::_('APRIL_SHORT'),
|
||||
'05' => JText::_('MAY_SHORT'),
|
||||
'06' => JText::_('JUNE_SHORT'),
|
||||
'07' => JText::_('JULY_SHORT'),
|
||||
'08' => JText::_('AUGUST_SHORT'),
|
||||
'09' => JText::_('SEPTEMBER_SHORT'),
|
||||
'10' => JText::_('OCTOBER_SHORT'),
|
||||
'11' => JText::_('NOVEMBER_SHORT'),
|
||||
'12' => JText::_('DECEMBER_SHORT')
|
||||
);
|
||||
$form->monthField = JHtml::_(
|
||||
'select.genericlist',
|
||||
$months,
|
||||
'month',
|
||||
array(
|
||||
'list.attr' => 'size="1" class="inputbox"',
|
||||
'list.select' => $state->get('filter.month'),
|
||||
'option.key' => null
|
||||
)
|
||||
);
|
||||
// Year Field
|
||||
$years = array();
|
||||
$years[] = JHtml::_('select.option', null, JText::_('JYEAR'));
|
||||
for ($i = 2000; $i <= 2020; $i++)
|
||||
{
|
||||
$years[] = JHtml::_('select.option', $i, $i);
|
||||
}
|
||||
$form->yearField = JHtml::_(
|
||||
'select.genericlist',
|
||||
$years,
|
||||
'year',
|
||||
array('list.attr' => 'size="1" class="inputbox"', 'list.select' => $state->get('filter.year'))
|
||||
);
|
||||
$form->limitField = $pagination->getLimitBox();
|
||||
|
||||
//Escape strings for HTML output
|
||||
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
|
||||
|
||||
$this->filter = $state->get('list.filter');
|
||||
$this->form = &$form;
|
||||
$this->items = &$items;
|
||||
$this->params = &$params;
|
||||
$this->user = &$user;
|
||||
$this->pagination = &$pagination;
|
||||
|
||||
$this->_prepareDocument();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the document
|
||||
*/
|
||||
protected function _prepareDocument()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$menus = $app->getMenu();
|
||||
$title = null;
|
||||
|
||||
// Because the application sets a default page title,
|
||||
// we need to get it from the menu item itself
|
||||
$menu = $menus->getActive();
|
||||
if ($menu)
|
||||
{
|
||||
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->params->def('page_heading', JText::_('JGLOBAL_ARTICLES'));
|
||||
}
|
||||
|
||||
$title = $this->params->get('page_title', '');
|
||||
if (empty($title))
|
||||
{
|
||||
$title = $app->getCfg('sitename');
|
||||
}
|
||||
elseif ($app->getCfg('sitename_pagetitles', 0) == 1)
|
||||
{
|
||||
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
|
||||
}
|
||||
elseif ($app->getCfg('sitename_pagetitles', 0) == 2)
|
||||
{
|
||||
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
|
||||
}
|
||||
$this->document->setTitle($title);
|
||||
|
||||
if ($this->params->get('menu-meta_description'))
|
||||
{
|
||||
$this->document->setDescription($this->params->get('menu-meta_description'));
|
||||
}
|
||||
|
||||
if ($this->params->get('menu-meta_keywords'))
|
||||
{
|
||||
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
|
||||
}
|
||||
|
||||
if ($this->params->get('robots'))
|
||||
{
|
||||
$this->document->setMetadata('robots', $this->params->get('robots'));
|
||||
}
|
||||
}
|
||||
}
|
1
components/com_content/views/article/index.html
Normal file
1
components/com_content/views/article/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user