first commit

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

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<access component="com_newsfeeds">
<section name="component">
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" />
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_COMPONENT_DESC" />
</section>
<section name="category">
<action name="core.create" title="JACTION_CREATE" description="COM_CATEGORIES_ACCESS_CREATE_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="COM_CATEGORIES_ACCESS_DELETE_DESC" />
<action name="core.edit" title="JACTION_EDIT" description="COM_CATEGORIES_ACCESS_EDIT_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_CATEGORIES_ACCESS_EDITSTATE_DESC" />
<action name="core.edit.own" title="JACTION_EDITOWN" description="COM_CATEGORIES_ACCESS_EDITOWN_DESC" />
</section>
</access>

View File

@ -0,0 +1,381 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset
name="newsfeed"
label="COM_NEWSFEEDS_FIELD_CONFIG_NEWSFEED_SETTINGS_LABEL"
description="COM_NEWSFEEDS_FIELD_CONFIG_NEWSFEED_SETTINGS_DESC">
<field
name="newsfeed_layout" type="componentlayout"
label="JGLOBAL_FIELD_LAYOUT_LABEL"
description="JGLOBAL_FIELD_LAYOUT_DESC"
menuitems="true"
extension="com_newsfeeds"
view="newsfeed"
/>
<field
id="show_feed_image"
name="show_feed_image"
type="radio"
class="btn-group"
default="1"
label="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_DESC">
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
id="show_feed_description"
name="show_feed_description"
type="radio"
class="btn-group"
default="1"
label="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_DESC">
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
id="show_item_description"
name="show_item_description"
type="radio"
class="btn-group"
default="1"
label="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_DESC">
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
id="feed_character_count"
name="feed_character_count"
type="text"
class="inputbox"
size="6"
default="0"
label="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_LABEL"
description="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_DESC" />
<field
id="feed_display_order"
name="feed_display_order"
type="list"
label="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_LABEL"
description="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_DESC"
>
<option value="des">JGLOBAL_MOST_RECENT_FIRST</option>
<option value="asc">JGLOBAL_OLDEST_FIRST</option>
</field>
<field
name="float_first"
type="list"
label="COM_NEWSFEEDS_FLOAT_LABEL"
description="COM_NEWSFEEDS_FLOAT_DESC">
<option value="right">COM_NEWSFEEDS_RIGHT</option>
<option value="left">COM_NEWSFEEDS_LEFT</option>
<option value="none">COM_NEWSFEEDS_NONE</option>
</field>
<field
name="float_second"
type="list"
label="COM_NEWSFEEDS_FLOAT_LABEL"
description="COM_NEWSFEEDS_FLOAT_DESC">
<option value="right">COM_NEWSFEEDS_RIGHT</option>
<option value="left">COM_NEWSFEEDS_LEFT</option>
<option value="none">COM_NEWSFEEDS_NONE</option>
</field>
<field
id="show_tags"
name="show_tags"
type="radio"
class="btn-group"
default="1"
label="COM_NEWSFEEDS_FIELD_SHOW_TAGS_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_TAGS_DESC">
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset
name="category"
label="JCATEGORY"
description="COM_NEWSFEEDS_FIELD_CONFIG_CATEGORY_SETTINGS_DESC">
<field
name="category_layout" type="componentlayout"
label="JGLOBAL_FIELD_LAYOUT_LABEL"
description="JGLOBAL_FIELD_LAYOUT_DESC"
menuitems="true"
extension="com_newsfeeds"
view="category"
/>
<field name="show_category_title" type="radio"
class="btn-group"
label="JGLOBAL_SHOW_CATEGORY_TITLE"
description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
default="1"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
id="show_description"
name="show_description"
type="radio"
class="btn-group"
default="1"
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC">
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description_image"
type="radio"
class="btn-group"
default="1"
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
>
<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"
default="-1"
>
<option value="0">JNONE</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" type="radio"
class="btn-group"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
description="COM_NEWSFEEDS_SHOW_EMPTY_CATEGORIES_DESC"
default="0"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_subcat_desc" type="radio"
class="btn-group"
default="1"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
id="show_cat_items"
name="show_cat_items"
type="radio"
class="btn-group"
default="1"
label="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_DESC"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_cat_tags" type="radio"
label="COM_NEWSFEEDS_FIELD_SHOW_CAT_TAGS_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_CAT_TAGS_DESC"
class="btn-group"
default="1"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="categories"
label="JCATEGORIES"
description="COM_NEWSFEEDS_CATEGORIES_DESC">
<field name="show_base_description" type="radio"
default="1"
class="btn-group"
label="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_LABEL"
description="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_DESC"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="maxLevelcat" type="list"
default="-1"
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
>
<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="radio"
class="btn-group"
default="0"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
description="COM_NEWSFEEDS_SHOW_EMPTY_CATEGORIES_DESC"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_subcat_desc_cat" type="radio"
class="btn-group"
default="1"
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_cat_items_cat" type="radio"
class="btn-group"
default="1"
description="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_DESC"
label="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_LABEL"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset
name="listlayout"
label="JGLOBAL_LIST_LAYOUT_OPTIONS"
description="COM_NEWSFEEDS_FIELD_CONFIG_LIST_SETTINGS_DESC">
<field
name="filter_field"
type="list"
default="1"
description="JGLOBAL_FILTER_FIELD_DESC"
label="JGLOBAL_FILTER_FIELD_LABEL"
>
<option value="hide">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination_limit"
type="radio"
class="btn-group"
default="1"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
description="JGLOBAL_DISPLAY_SELECT_DESC"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
id="show_headings"
name="show_headings"
type="radio"
class="btn-group"
default="1"
label="JGLOBAL_SHOW_HEADINGS_LABEL"
description="JGLOBAL_SHOW_HEADINGS_DESC"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
id="show_articles"
name="show_articles"
type="radio"
class="btn-group"
default="1"
label="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_LABEL"
description="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_DESC"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
id="show_link"
name="show_link"
type="radio"
class="btn-group"
default="1"
label="COM_NEWSFEEDS_FIELD_SHOW_LINKS_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_LINKS_DESC"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_pagination"
type="list"
default="2"
label="JGLOBAL_PAGINATION_LABEL"
description="JGLOBAL_PAGINATION_DESC"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<option value="2">JGLOBAL_AUTO</option>
</field>
<field
name="show_pagination_results"
type="radio"
class="btn-group"
default="1"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
description="JGLOBAL_PAGINATION_RESULTS_DESC"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset
name="permissions"
label="JCONFIG_PERMISSIONS_LABEL"
description="JCONFIG_PERMISSIONS_DESC"
>
<field
name="rules"
type="rules"
label="JCONFIG_PERMISSIONS_LABEL"
filter="rules"
validate="rules"
component="com_newsfeeds"
section="component"/>
</fieldset>
</config>

View File

@ -0,0 +1,51 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @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;
/**
* Newsfeeds master display controller.
*
* @package Joomla.Administrator
* @subpackage com_newsfeeds
* @since 1.6
*/
class NewsfeedsController extends JControllerLegacy
{
/**
* Method to display a view.
*
* @param boolean If true, the view output will be cached
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT.'/helpers/newsfeeds.php';
$view = $this->input->get('view', 'newsfeeds');
$layout = $this->input->get('layout', 'default');
$id = $this->input->getInt('id');
// Check for edit form.
if ($view == 'newsfeed' && $layout == 'edit' && !$this->checkEditId('com_newsfeeds.edit.newsfeed', $id))
{
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_newsfeeds&view=newsfeeds', false));
return false;
}
parent::display();
}
}

View File

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

View File

@ -0,0 +1,122 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @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;
/**
* Newsfeed controller class.
*
* @package Joomla.Administrator
* @subpackage com_newsfeeds
* @since 1.6
*/
class NewsfeedsControllerNewsfeed extends JControllerForm
{
/**
* 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('filter_category_id'), 'int');
$allow = null;
if ($categoryId)
{
// If the category has been passed in the URL check it.
$allow = $user->authorise('core.create', $this->option . '.category.' . $categoryId);
}
if ($allow === null)
{
// In the absence of better information, revert to the component permissions.
return parent::allowAdd($data);
}
else
{
return $allow;
}
}
/**
* Method to check if you can edit a record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
*
* @since 1.6
*/
protected function allowEdit($data = array(), $key = 'id')
{
$user = JFactory::getUser();
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$categoryId = 0;
if ($recordId)
{
$categoryId = (int) $this->getModel()->getItem($recordId)->catid;
}
if ($categoryId)
{
// The category has been set. Check the category permissions.
return $user->authorise('core.edit', $this->option . '.category.' . $categoryId);
}
else
{
// Since there is no asset tracking, revert to the component permissions.
return parent::allowEdit($data, $key);
}
}
/**
* Method to run batch operations.
*
* @param object $model The model.
*
* @return boolean True if successful, false otherwise and internal error is set.
*
* @since 2.5
*/
public function batch($model = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Set the model
$model = $this->getModel('Newsfeed', '', array());
// Preset the redirect
$this->setRedirect(JRoute::_('index.php?option=com_newsfeeds&view=newsfeeds' . $this->getRedirectToListAppend(), false));
return parent::batch($model);
}
/**
* Function that allows child controller access to model data after the data has been saved.
*
* @param JModelLegacy $model The data model object.
* @param array $validData The validated data.
*
* @return void
*
* @since 3.1
*/
protected function postSaveHook(JModelLegacy $model, $validData = array())
{
}
}

View File

@ -0,0 +1,33 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @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;
/**
* Newsfeeds list controller class.
*
* @package Joomla.Administrator
* @subpackage com_newsfeeds
* @since 1.6
*/
class NewsfeedsControllerNewsfeeds extends JControllerAdmin
{
/**
* Proxy for getModel.
*/
public function getModel($name = 'Newsfeed', $prefix = 'NewsfeedsModel', $config = array('ignore_request' => true))
{
$model = parent::getModel($name, $prefix, $config);
return $model;
}
protected function postDeleteHook(JModelLegacy $model, $ids = null)
{
}
}

View File

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

View File

@ -0,0 +1,91 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @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('NewsfeedsHelper', JPATH_ADMINISTRATOR . '/components/com_newsfeeds/helpers/newsfeeds.php');
/**
* Utility class for creating HTML Grids
*
* @static
* @package Joomla.Administrator
* @subpackage com_newsfeeds
* @since 1.5
*/
class JHtmlNewsfeed
{
/**
* Get the associated language flags
*
* @param int $newsfeedid The item id to search associations
*
* @return string The language HTML
*/
public static function association($newsfeedid)
{
// Defaults
$html = '';
// Get the associations
if ($associations = JLanguageAssociations::getAssociations('com_newsfeeds', '#__newsfeeds', 'com_newsfeeds.item', $newsfeedid))
{
foreach ($associations as $tag => $associated)
{
$associations[$tag] = (int) $associated->id;
}
// Get the associated newsfeed items
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('c.id, c.name as title')
->select('l.sef as lang_sef')
->from('#__newsfeeds as c')
->select('cat.title as category_title')
->join('LEFT', '#__categories as cat ON cat.id=c.catid')
->where('c.id IN (' . implode(',', array_values($associations)) . ')')
->join('LEFT', '#__languages as l ON c.language=l.lang_code')
->select('l.image')
->select('l.title as language_title');
$db->setQuery($query);
try
{
$items = $db->loadObjectList('id');
}
catch (RuntimeException $e)
{
throw new Exception($e->getMessage(), 500);
}
if ($items)
{
foreach ($items as &$item)
{
$text = strtoupper($item->lang_sef);
$url = JRoute::_('index.php?option=com_newsfeeds&task=newsfeed.edit&id=' . (int) $item->id);
$tooltipParts = array(
JHtml::_('image', 'mod_languages/' . $item->image . '.gif',
$item->language_title,
array('title' => $item->language_title),
true
),
$item->title,
'(' . $item->category_title . ')'
);
$item->link = JHtml::_('tooltip', implode(' ', $tooltipParts), null, null, $text, $url, null, 'hasTooltip label label-association label-' . $item->lang_sef);
}
}
$html = JLayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
}

View File

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

View File

@ -0,0 +1,80 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @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;
/**
* Newsfeeds component helper.
*
* @package Joomla.Administrator
* @subpackage com_newsfeeds
* @since 1.6
*/
class NewsfeedsHelper
{
public static $extension = 'com_newsfeeds';
/**
* Configure the Linkbar.
*
* @param string The name of the active view.
*/
public static function addSubmenu($vName)
{
JHtmlSidebar::addEntry(
JText::_('COM_NEWSFEEDS_SUBMENU_NEWSFEEDS'),
'index.php?option=com_newsfeeds&view=newsfeeds',
$vName == 'newsfeeds'
);
JHtmlSidebar::addEntry(
JText::_('COM_NEWSFEEDS_SUBMENU_CATEGORIES'),
'index.php?option=com_categories&extension=com_newsfeeds',
$vName == 'categories'
);
if ($vName == 'categories')
{
JToolbarHelper::title(
JText::sprintf('COM_CATEGORIES_CATEGORIES_TITLE', JText::_('com_newsfeeds')),
'newsfeeds-categories');
}
}
/**
* Gets a list of the actions that can be performed.
*
* @param integer The category ID.
*
* @return JObject
*/
public static function getActions($categoryId = 0, $newsfeedId = 0)
{
$user = JFactory::getUser();
$result = new JObject;
if (empty($categoryId))
{
$assetName = 'com_newsfeeds';
$level = 'component';
}
else
{
$assetName = 'com_newsfeeds.category.'.(int) $categoryId;
$level = 'category';
}
$actions = JAccess::getActions('com_newsfeeds', $level);
foreach ($actions as $action)
{
$result->set($action->name, $user->authorise($action->name, $assetName));
}
return $result;
}
}

View File

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

View File

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

View File

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

View File

@ -0,0 +1,163 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
/**
* Supports a modal newsfeeds picker.
*
* @package Joomla.Administrator
* @subpackage com_newsfeeds
* @since 1.6
*/
class JFormFieldModal_Newsfeed extends JFormField
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
protected $type = 'Modal_Newsfeed';
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
$allowEdit = ((string) $this->element['edit'] == 'true') ? true : false;
$allowClear = ((string) $this->element['clear'] != 'false') ? true : false;
// Load language
JFactory::getLanguage()->load('com_newsfeeds', JPATH_ADMINISTRATOR);
// Load the javascript
JHtml::_('behavior.framework');
JHtml::_('behavior.modal', 'a.modal');
JHtml::_('bootstrap.tooltip');
// Build the script.
$script = array();
// Select button script
$script[] = ' function jSelectNewsfeed_'.$this->id.'(id, name, object) {';
$script[] = ' document.id("'.$this->id.'_id").value = id;';
$script[] = ' document.id("'.$this->id.'_name").value = name;';
if ($allowEdit)
{
$script[] = ' jQuery("#'.$this->id.'_edit").removeClass("hidden");';
}
if ($allowClear)
{
$script[] = ' jQuery("#'.$this->id.'_clear").removeClass("hidden");';
}
$script[] = ' SqueezeBox.close();';
$script[] = ' }';
// Clear button script
static $scriptClear;
if ($allowClear && !$scriptClear)
{
$scriptClear = true;
$script[] = ' function jClearNewsfeed(id) {';
$script[] = ' document.getElementById(id + "_id").value = "";';
$script[] = ' document.getElementById(id + "_name").value = "'.htmlspecialchars(JText::_('COM_NEWSFEEDS_SELECT_A_FEED', true), ENT_COMPAT, 'UTF-8').'";';
$script[] = ' jQuery("#"+id + "_clear").addClass("hidden");';
$script[] = ' if (document.getElementById(id + "_edit")) {';
$script[] = ' jQuery("#"+id + "_edit").addClass("hidden");';
$script[] = ' }';
$script[] = ' return false;';
$script[] = ' }';
}
// Add the script to the document head.
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
// Setup variables for display.
$html = array();
$link = 'index.php?option=com_newsfeeds&amp;view=newsfeeds&amp;layout=modal&amp;tmpl=component&amp;function=jSelectNewsfeed_'.$this->id;
if (isset($this->element['language']))
{
$link .= '&amp;forcedLanguage='.$this->element['language'];
}
// Get the title of the linked chart
$db = JFactory::getDbo();
$db->setQuery(
'SELECT name' .
' FROM #__newsfeeds' .
' WHERE id = '.(int) $this->value
);
try
{
$title = $db->loadResult();
}
catch (RuntimeException $e)
{
JError::raiseWarning(500, $e->getMessage);
}
if (empty($title))
{
$title = JText::_('COM_NEWSFEEDS_SELECT_A_FEED');
}
$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
// The active newsfeed id field.
if (0 == (int) $this->value)
{
$value = '';
}
else
{
$value = (int) $this->value;
}
// The current newsfeed display field.
$html[] = '<span class="input-append">';
$html[] = '<input type="text" class="input-medium" id="'.$this->id.'_name" value="'.$title.'" disabled="disabled" size="35" />';
$html[] = '<a class="modal btn hasTooltip" title="'.JHtml::tooltipText('COM_NEWSFEEDS_CHANGE_FEED_BUTTON').'" href="'.$link.'&amp;'.JSession::getFormToken().'=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}"><i class="icon-file"></i> '.JText::_('JSELECT').'</a>';
// Edit newsfeed button
if ($allowEdit)
{
$html[] = '<a class="btn hasTooltip'.($value ? '' : ' hidden').'" href="index.php?option=com_newsfeeds&layout=modal&tmpl=component&task=newsfeed.edit&id=' . $value. '" target="_blank" title="'.JHtml::tooltipText('COM_NEWSFEEDS_EDIT_NEWSFEED').'" ><span class="icon-edit"></span> ' . JText::_('JACTION_EDIT') . '</a>';
}
// Clear newsfeed button
if ($allowClear)
{
$html[] = '<button id="'.$this->id.'_clear" class="btn'.($value ? '' : ' hidden').'" onclick="return jClearNewsfeed(\''.$this->id.'\')"><span class="icon-remove"></span> ' . JText::_('JCLEAR') . '</button>';
}
$html[] = '</span>';
// class='required' for client side validation
$class = '';
if ($this->required)
{
$class = ' class="required modal-value"';
}
$html[] = '<input type="hidden" id="'.$this->id.'_id"'.$class.' name="'.$this->name.'" value="'.$value.'" />';
return implode("\n", $html);
}
}

View File

@ -0,0 +1,64 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
JFormHelper::loadFieldClass('list');
/**
* Form Field class for the Joomla Framework.
*
* @package Joomla.Administrator
* @subpackage com_newsfeeds
* @since 1.6
*/
class JFormFieldNewsfeeds extends JFormFieldList
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
protected $type = 'Newsfeeds';
/**
* Method to get the field options.
*
* @return array The field option objects.
* @since 1.6
*/
protected function getOptions()
{
$options = array();
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('id As value, name As text')
->from('#__newsfeeds AS a')
->order('a.name');
// Get the options.
$db->setQuery($query);
try
{
$options = $db->loadObjectList();
}
catch (RuntimeException $e)
{
JError::raiseWarning(500, $db->getMessage());
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
}

View File

@ -0,0 +1,71 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
/**
* Supports an HTML select list of newsfeeds
*
* @package Joomla.Administrator
* @subpackage com_newsfeeds
* @since 1.6
*/
class JFormFieldOrdering extends JFormField
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
protected $type = 'Ordering';
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
$html = array();
$attr = '';
// Initialize some field attributes.
$attr .= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
// Initialize JavaScript field attributes.
$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
// Get some field values from the form.
$newsfeedId = (int) $this->form->getValue('id');
$categoryId = (int) $this->form->getValue('catid');
// Build the query for the ordering list.
$query = 'SELECT ordering AS value, name AS text' .
' FROM #__newsfeeds' .
' WHERE catid = ' . (int) $categoryId .
' ORDER BY ordering';
// Create a read-only list (no name) with a hidden input to store the value.
if ((string) $this->element['readonly'] == 'true')
{
$html[] = JHtml::_('list.ordering', '', $query, trim($attr), $this->value, $newsfeedId ? 0 : 1);
$html[] = '<input type="hidden" name="'.$this->name.'" value="'.htmlspecialchars($this->value).'"/>';
}
// Create a regular list.
else {
$html[] = JHtml::_('list.ordering', $this->name, $query, trim($attr), $this->value, $newsfeedId ? 0 : 1);
}
return implode($html);
}
}

View File

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

View File

@ -0,0 +1,290 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_categories/models/fields" >
<field name="id" type="text" default="0"
readonly="true" class="readonly" label="JGLOBAL_FIELD_ID_LABEL"
description="JGLOBAL_FIELD_ID_DESC" />
<field name="name" type="text" label="JGLOBAL_TITLE"
description="JFIELD_TITLE_DESC" class="inputbox" size="30"
required="true" />
<field name="alias" type="text" label="JFIELD_ALIAS_LABEL"
description="JFIELD_ALIAS_DESC" class="inputbox"
size="45" />
<field name="published" type="list"
label="JSTATUS" description="JFIELD_PUBLISHED_DESC"
class="inputbox span12 small" size="1" default="1"
>
<option value="1">
JPUBLISHED</option>
<option value="0">
JUNPUBLISHED</option>
<option value="2">
JARCHIVED</option>
<option value="-2">
JTRASHED</option>
</field>
<field name="catid" type="categoryedit" extension="com_newsfeeds"
label="JCATEGORY" description="COM_NEWSFEEDS_FIELD_CATEGORY_DESC"
class="inputbox" required="true"
>
</field>
<field name="language" type="contentlanguage" label="JFIELD_LANGUAGE_LABEL"
description="COM_NEWSFEEDS_FIELD_LANGUAGE_DESC" class="inputbox span12 small"
>
<option value="*">JALL</option>
</field>
<field name="tags"
type="tag"
label="JTAG"
description="JTAG_DESC"
class="inputbox span12 small"
multiple="true"
>
</field>
<field name="description" type="editor" buttons="true" hide="pagebreak,readmore"
class="inputbox"
filter="JComponentHelper::filterText"
label="JGLOBAL_DESCRIPTION" description="COM_NEWSFEEDS_FIELD_DESCRIPTION_DESC" />
<field name="link" type="url" filter="url" class="inputbox"
size="60" label="COM_NEWSFEEDS_FIELD_LINK_LABEL"
description="COM_NEWSFEEDS_FIELD_LINK_DESC" required="true" />
<field name="numarticles" type="Text" class="inputbox"
default="5" size="2" label="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_LABEL"
description="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_DESC"
required="true" />
<field name="cache_time" type="Text" class="inputbox"
default="3600" size="4" label="COM_NEWSFEEDS_FIELD_CACHETIME_LABEL"
description="JGLOBAL_FIELD_FIELD_CACHETIME_DESC"
required="true" />
<field name="ordering" type="ordering" class="inputbox"
label="JFIELD_ORDERING_LABEL" description="JFIELD_ORDERING_DESC" />
<field name="rtl" type="list" class="inputbox"
default="0" label="COM_NEWSFEEDS_FIELD_RTL_LABEL"
description="COM_NEWSFEEDS_FIELD_RTL_DESC"
>
<option value="0">COM_NEWSFEEDS_FIELD_VALUE_SITE
</option>
<option value="1">COM_NEWSFEEDS_FIELD_VALUE_LTR
</option>
<option value="2">COM_NEWSFEEDS_FIELD_VALUE_RTL
</option>
</field>
<field name="created" type="calendar"
label="JGLOBAL_FIELD_CREATED_LABEL" description="JGLOBAL_FIELD_CREATED_DESC"
class="inputbox" size="22" format="%Y-%m-%d %H:%M:%S"
filter="user_utc" />
<field name="created_by" type="user"
label="JGLOBAL_FIELD_Created_by_Label" description="JGLOBAL_FIELD_CREATED_BY_DESC" />
<field 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 name="modified" type="calendar" class="readonly"
label="JGLOBAL_FIELD_Modified_Label" description="COM_NEWSFEEDS_FIELD_MODIFIED_DESC"
size="22" readonly="true" format="%Y-%m-%d %H:%M:%S" filter="user_utc" />
<field name="modified_by" type="user" label="JGLOBAL_FIELD_MODIFIED_BY_LABEL"
class="readonly" readonly="true" filter="unset" />
<field name="version" type="text" class="readonly"
label="COM_NEWSFEEDS_FIELD_VERSION_LABEL" size="6" description="COM_NEWSFEEDS_FIELD_VERSION_DESC"
readonly="true" filter="unset" />
<field name="checked_out" type="Text" class="inputbox"
size="6" label="JGLOBAL_FIELD_CHECKEDOUT_LABEL"
description="JGLOBAL_FIELD_CHECKEDOUT_DESC" readonly="true"
filter="unset" />
<field name="checked_out_time" type="Text" class="inputbox"
size="6" label="JGLOBAL_FIELD_CHECKEDOUT_TIME_LABEL"
description="JGLOBAL_FIELD_CHECKEDOUT_TIME_DESC"
readonly="true" filter="unset" />
<field 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 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="access" type="accesslevel" label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC" class="inputbox span12 small" size="1" />
<field name="metakey" type="textarea"
label="JFIELD_META_KEYWORDS_LABEL" description="JFIELD_META_KEYWORDS_DESC"
class="inputbox" rows="3" cols="30" />
<field name="metadesc" type="textarea"
label="JFIELD_META_DESCRIPTION_LABEL" description="JFIELD_META_DESCRIPTION_DESC"
class="inputbox" rows="3" cols="30" />
<field name="xreference" type="text"
label="JFIELD_XREFERENCE_LABEL" description="JFIELD_XREFERENCE_DESC"
class="inputbox" size="20" />
</fieldset>
<fields name="images">
<field
name="image_first"
type="media"
label="COM_NEWSFEEDS_FIELD_FIRST_LABEL"
description="COM_NEWSFEEDS_FIELD_FIRST_DESC" />
<field
name="float_first"
type="list"
label="COM_NEWSFEEDS_FLOAT_LABEL"
description="COM_NEWSFEEDS_FLOAT_DESC">
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="right">COM_NEWSFEEDS_RIGHT</option>
<option value="left">COM_NEWSFEEDS_LEFT</option>
<option value="none">COM_NEWSFEEDS_NONE</option>
</field>
<field name="image_first_alt"
type="text"
label="COM_NEWSFEEDS_FIELD_IMAGE_ALT_LABEL"
description="COM_NEWSFEEDS_FIELD_IMAGE_ALT_DESC"
class="inputbox"
size="20" />
<field name="image_first_caption"
type="text"
label="COM_NEWSFEEDS_FIELD_IMAGE_CAPTION_LABEL"
description="COM_NEWSFEEDS_FIELD_IMAGE_CAPTION_DESC"
class="inputbox"
size="20" />
<field
name="spacer1"
type="spacer"
hr="true"
/>
<field
name="image_second"
type="media"
label="COM_NEWSFEEDS_FIELD_SECOND_LABEL"
description="COM_NEWSFEEDS_FIELD_SECOND_DESC" />
<field
name="float_second"
type="list"
label="COM_NEWSFEEDS_FLOAT_LABEL"
description="COM_NEWSFEEDS_FLOAT_DESC">
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="right">COM_NEWSFEEDS_RIGHT</option>
<option value="left">COM_NEWSFEEDS_LEFT</option>
<option value="none">COM_NEWSFEEDS_NONE</option>
</field>
<field name="image_second_alt"
type="text"
label="COM_NEWSFEEDS_FIELD_IMAGE_ALT_LABEL"
description="COM_NEWSFEEDS_FIELD_IMAGE_ALT_DESC"
class="inputbox"
size="20" />
<field name="image_second_caption"
type="text"
label="COM_NEWSFEEDS_FIELD_IMAGE_CAPTION_LABEL"
description="COM_NEWSFEEDS_FIELD_IMAGE_CAPTION_DESC"
class="inputbox"
size="20" />
</fields>
<fields name="params">
<fieldset name="jbasic" label="JGLOBAL_FIELDSET_DISPLAY_OPTIONS">
<field name="show_feed_image" type="list"
label="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_feed_description" type="list"
label="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_item_description" type="list"
label="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_LABEL"
description="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="feed_character_count" type="text" size="6"
default="0" label="COM_NEWSFEEDS_FIELD_CHARACTERS_COUNT_LABEL"
description="COM_NEWSFEEDS_FIELD_CHARACTERS_COUNT_DESC" />
<field
name="newsfeed_layout"
type="componentlayout"
label="JFIELD_ALT_LAYOUT_LABEL"
description="JFIELD_ALT_COMPONENT_LAYOUT_DESC"
extension="com_newsfeeds"
view="newsfeed"
useglobal="true"
/>
<field name="feed_display_order" type="list"
label="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_LABEL"
description="COM_NEWSFEEDS_FIELD_FEED_DISPLAY_ORDER_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="des">JGLOBAL_MOST_RECENT_FIRST</option>
<option value="asc">JGLOBAL_OLDEST_FIRST</option>
</field>
</fieldset>
</fields>
<fields name="metadata">
<fieldset name="jmetadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS">
<field name="robots"
type="list"
label="JFIELD_METADATA_ROBOTS_LABEL"
description="JFIELD_METADATA_ROBOTS_DESC"
>
<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"
label="JFIELD_META_RIGHTS_LABEL" description="JFIELD_META_RIGHTS_DESC"
required="false" filter="string" cols="30" rows="2" />
</fieldset>
<field name="hits"
type="text"
class="readonly"
size="6" label="JGLOBAL_HITS"
description="COM_WEBLINKS_HITS_DESC"
readonly="true"
filter="unset" />
</fields>
</form>

View File

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

View File

@ -0,0 +1,577 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @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('NewsfeedsHelper', JPATH_ADMINISTRATOR . '/components/com_newsfeeds/helpers/newsfeeds.php');
/**
* Newsfeed model.
*
* @package Joomla.Administrator
* @subpackage com_newsfeeds
* @since 1.6
*/
class NewsfeedsModelNewsfeed extends JModelAdmin
{
/**
* @var string The prefix to use with controller messages.
* @since 1.6
*/
protected $text_prefix = 'COM_NEWSFEEDS';
/**
* Batch copy items to a new category or current.
*
* @param integer $value The new category.
* @param array $pks An array of row IDs.
* @param array $contexts An array of item contexts.
*
* @return mixed An array of new IDs on success, boolean false on failure.
*
* @since 11.1
*/
protected function batchCopy($value, $pks, $contexts)
{
$categoryId = (int) $value;
$table = $this->getTable();
$i = 0;
// Check that the category exists
if ($categoryId)
{
$categoryTable = JTable::getInstance('Category');
if (!$categoryTable->load($categoryId))
{
if ($error = $categoryTable->getError())
{
// Fatal error
$this->setError($error);
return false;
}
else
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'));
return false;
}
}
}
if (empty($categoryId))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'));
return false;
}
// Check that the user has create permission for the component
$user = JFactory::getUser();
if (!$user->authorise('core.create', 'com_newsfeeds.category.' . $categoryId))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_CREATE'));
return false;
}
// Parent exists so we let's proceed
while (!empty($pks))
{
// Pop the first ID off the stack
$pk = array_shift($pks);
$table->reset();
// Check that the row actually exists
if (!$table->load($pk))
{
if ($error = $table->getError())
{
// Fatal error
$this->setError($error);
return false;
}
else
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
// Alter the title & alias
$data = $this->generateNewTitle($categoryId, $table->alias, $table->name);
$table->name = $data['0'];
$table->alias = $data['1'];
// Reset the ID because we are making a copy
$table->id = 0;
// New category ID
$table->catid = $categoryId;
// TODO: Deal with ordering?
//$table->ordering = 1;
// Check the row.
if (!$table->check())
{
$this->setError($table->getError());
return false;
}
// Store the row.
if (!$table->store())
{
$this->setError($table->getError());
return false;
}
// Get the new item ID
$newId = $table->get('id');
// Add the new ID to the array
$newIds[$i] = $newId;
$i++;
}
// Clean the cache
$this->cleanCache();
return $newIds;
}
/**
* Method to test whether a record can be deleted.
*
* @param object A record object.
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
* @since 1.6
*/
protected function canDelete($record)
{
if (!empty($record->id))
{
if ($record->published != -2)
{
return;
}
$user = JFactory::getUser();
if (!empty($record->catid))
{
return $user->authorise('core.delete', 'com_newsfeed.category.' . (int) $record->catid);
}
else
{
return parent::canDelete($record);
}
}
}
/**
* Method to test whether a record can have its state changed.
*
* @param object A record object.
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
* @since 1.6
*/
protected function canEditState($record)
{
$user = JFactory::getUser();
if (!empty($record->catid))
{
return $user->authorise('core.edit.state', 'com_newsfeeds.category.' . (int) $record->catid);
}
else
{
return parent::canEditState($record);
}
}
/**
* Returns a Table object, always creating it.
*
* @param type The table type to instantiate
* @param string A prefix for the table class name. Optional.
* @param array Configuration array for model. Optional.
* @return JTable A database object
*/
public function getTable($type = 'Newsfeed', $prefix = 'NewsfeedsTable', $config = array())
{
return JTable::getInstance($type, $prefix, $config);
}
/**
* Method to get the record form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @return JForm A JForm object on success, false on failure
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_newsfeeds.newsfeed', 'newsfeed', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
{
return false;
}
// Determine correct permissions to check.
if ($this->getState('newsfeed.id'))
{
// Existing record. Can only edit in selected categories.
$form->setFieldAttribute('catid', 'action', 'core.edit');
}
else
{
// New record. Can only create in selected categories.
$form->setFieldAttribute('catid', 'action', 'core.create');
}
// Modify the form based on access controls.
if (!$this->canEditState((object) $data))
{
// Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true');
$form->setFieldAttribute('publish_up', 'disabled', 'true');
$form->setFieldAttribute('publish_down', 'disabled', 'true');
// Disable fields while saving.
// The controller has already verified this is a record you can edit.
$form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('published', 'filter', 'unset');
$form->setFieldAttribute('publish_up', 'filter', 'unset');
$form->setFieldAttribute('publish_down', 'filter', 'unset');
}
return $form;
}
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
* @since 1.6
*/
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState('com_newsfeeds.edit.newsfeed.data', array());
if (empty($data))
{
$data = $this->getItem();
// Prime some default values.
if ($this->getState('newsfeed.id') == 0)
{
$app = JFactory::getApplication();
$data->set('catid', $app->input->get('catid', $app->getUserState('com_newsfeeds.newsfeeds.filter.category_id'), 'int'));
}
}
$this->preprocessData('com_newsfeeds.newsfeed', $data);
return $data;
}
/**
* Method to save the form data.
*
* @param array The form data.
*
* @return boolean True on success.
* @since 3.0
*/
public function save($data)
{
$app = JFactory::getApplication();
// Alter the title for save as copy
if ($app->input->get('task') == 'save2copy')
{
list($name, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['name']);
$data['name'] = $name;
$data['alias'] = $alias;
$data['published'] = 0;
}
if (parent::save($data))
{
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
if ($assoc)
{
$id = (int) $this->getState($this->getName() . '.id');
$item = $this->getItem($id);
// Adding self to the association
$associations = $data['associations'];
foreach ($associations as $tag => $id)
{
if (empty($id))
{
unset($associations[$tag]);
}
}
// Detecting all item menus
$all_language = $item->language == '*';
if ($all_language && !empty($associations))
{
JError::raiseNotice(403, JText::_('COM_NEWSFEEDS_ERROR_ALL_LANGUAGE_ASSOCIATED'));
}
$associations[$item->language] = $item->id;
// Deleting old association for these items
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->delete('#__associations')
->where($db->quoteName('context') . ' = ' . $db->quote('com_newsfeeds.item'))
->where($db->quoteName('id') . ' IN (' . implode(',', $associations) . ')');
$db->setQuery($query);
$db->execute();
if ($error = $db->getErrorMsg())
{
$this->setError($error);
return false;
}
if (!$all_language && count($associations))
{
// Adding new association for these items
$key = md5(json_encode($associations));
$query->clear()
->insert('#__associations');
foreach ($associations as $id)
{
$query->values($id . ',' . $db->quote('com_newsfeeds.item') . ',' . $db->quote($key));
}
$db->setQuery($query);
$db->execute();
if ($error = $db->getErrorMsg())
{
$this->setError($error);
return false;
}
}
}
return true;
}
return false;
}
/**
* Method to get a single record.
*
* @param integer The id of the primary key.
*
* @return mixed Object on success, false on failure.
* @since 1.6
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk))
{
// Convert the params field to an array.
$registry = new JRegistry;
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
// Convert the images field to an array.
$registry = new JRegistry;
$registry->loadString($item->images);
$item->images = $registry->toArray();
}
// Load associated newsfeeds items
$app = JFactory::getApplication();
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
if ($assoc)
{
$item->associations = array();
if ($item->id != null)
{
$associations = JLanguageAssociations::getAssociations('com_newsfeeds', '#__newsfeeds', 'com_newsfeeds.item', $item->id);
foreach ($associations as $tag => $association)
{
$item->associations[$tag] = $association->id;
}
}
}
if (!empty($item->id))
{
$item->tags = new JHelperTags;
$item->tags->getTagIds($item->id, 'com_newsfeeds.newsfeed');
$item->metadata['tags'] = $item->tags;
}
return $item;
}
/**
* Prepare and sanitise the table prior to saving.
*/
protected function prepareTable($table)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
$table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
$table->alias = JApplication::stringURLSafe($table->alias);
if (empty($table->alias))
{
$table->alias = JApplication::stringURLSafe($table->name);
}
if (empty($table->id))
{
// Set the values
$table->created = $date->toSql();
// Set ordering to the last item if not set
if (empty($table->ordering))
{
$db = JFactory::getDbo();
$db->setQuery('SELECT MAX(ordering) FROM #__newsfeeds');
$max = $db->loadResult();
$table->ordering = $max + 1;
}
}
else
{
// Set the values
$table->modified = $date->toSql();
$table->modified_by = $user->get('id');
}
// Increment the content version number.
$table->version++;
}
/**
* Method to change the published state of one or more records.
*
* @param array $pks A list of the primary keys to change.
* @param integer $value The value of the published state.
*
* @return boolean True on success.
* @since 1.6
*/
public function publish(&$pks, $value = 1)
{
$result = parent::publish($pks, $value);
// Clean extra cache for newsfeeds
$this->cleanCache('feed_parser');
return $result;
}
/**
* A protected method to get a set of ordering conditions.
*
* @param object A record object.
* @return array An array of conditions to add to add to ordering queries.
* @since 1.6
*/
protected function getReorderConditions($table)
{
$condition = array();
$condition[] = 'catid = ' . (int) $table->catid;
return $condition;
}
protected function preprocessForm(JForm $form, $data, $group = 'content')
{
// Association newsfeeds items
$app = JFactory::getApplication();
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
if ($assoc)
{
$languages = JLanguageHelper::getLanguages('lang_code');
// force to array (perhaps move to $this->loadFormData())
$data = (array) $data;
$addform = new SimpleXMLElement('<form />');
$fields = $addform->addChild('fields');
$fields->addAttribute('name', 'associations');
$fieldset = $fields->addChild('fieldset');
$fieldset->addAttribute('name', 'item_associations');
$fieldset->addAttribute('description', 'COM_NEWSFEEDS_ITEM_ASSOCIATIONS_FIELDSET_DESC');
$add = false;
foreach ($languages as $tag => $language)
{
if (empty($data['language']) || $tag != $data['language'])
{
$add = true;
$field = $fieldset->addChild('field');
$field->addAttribute('name', $tag);
$field->addAttribute('type', 'modal_newsfeed');
$field->addAttribute('language', $tag);
$field->addAttribute('label', $language->title);
$field->addAttribute('translate_label', 'false');
$field->addAttribute('edit', 'true');
$field->addAttribute('clear', 'true');
}
}
if ($add)
{
$form->load($addform, false);
}
}
parent::preprocessForm($form, $data, $group);
}
/**
* Method to change the title & alias.
*
* @param integer $parent_id The id of the parent.
* @param string $alias The alias.
* @param string $title The title.
*
* @return array Contains the modified title and alias.
*
* @since 3.1
*/
protected function generateNewTitle($category_id, $alias, $name)
{
// Alter the title & alias
$table = $this->getTable();
while ($table->load(array('alias' => $alias, 'catid' => $category_id)))
{
if ($name == $table->name)
{
$name = JString::increment($name);
}
$alias = JString::increment($alias, 'dash');
}
return array($name, $alias);
}
}

View File

@ -0,0 +1,262 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Methods supporting a list of newsfeed records.
*
* @package Joomla.Administrator
* @subpackage com_newsfeeds
* @since 1.6
*/
class NewsfeedsModelNewsfeeds 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',
'name', 'a.name',
'alias', 'a.alias',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'catid', 'a.catid', 'category_title',
'published', 'a.published',
'access', 'a.access', 'access_level',
'created', 'a.created',
'created_by', 'a.created_by',
'ordering', 'a.ordering',
'language', 'a.language',
'publish_up', 'a.publish_up',
'publish_down', 'a.publish_down',
'cache_time', 'a.cache_time',
'numarticles',
);
$app = JFactory::getApplication();
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
if ($assoc)
{
$config['filter_fields'][] = 'association';
}
}
parent::__construct($config);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*
* @since 1.6
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication('administrator');
// Load the filter state.
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$accessId = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', null, 'int');
$this->setState('filter.access', $accessId);
$state = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '', 'string');
$this->setState('filter.published', $state);
$categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id', null);
$this->setState('filter.category_id', $categoryId);
$language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '');
$this->setState('filter.language', $language);
// force a language
$forcedLanguage = $app->input->get('forcedLanguage');
if (!empty($forcedLanguage))
{
$this->setState('filter.language', $forcedLanguage);
$this->setState('filter.forcedLanguage', $forcedLanguage);
}
$tag = $this->getUserStateFromRequest($this->context . '.filter.tag', 'filter_tag', '');
$this->setState('filter.tag', $tag);
// Load the parameters.
$params = JComponentHelper::getParams('com_newsfeeds');
$this->setState('params', $params);
// List state information.
parent::populateState('a.name', 'asc');
}
/**
* Method to get a store id based on model configuration state.
*
* This is necessary because the model is used by the component and
* different modules that might need different sets of data or different
* ordering requirements.
*
* @param string A prefix for the store id.
*
* @return string A store id.
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.access');
$id .= ':' . $this->getState('filter.published');
$id .= ':' . $this->getState('filter.category_id');
$id .= ':' . $this->getState('filter.language');
return parent::getStoreId($id);
}
/**
* Build an SQL query to load the list data.
*
* @return JDatabaseQuery
*/
protected function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
$user = JFactory::getUser();
$app = JFactory::getApplication();
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.id, a.name, a.alias, a.checked_out, a.checked_out_time, a.catid,' .
' a.numarticles, a.cache_time,' .
' a.published, a.access, a.ordering, a.language, a.publish_up, a.publish_down'
)
);
$query->from($db->quoteName('#__newsfeeds') . ' AS a');
// Join over the language
$query->select('l.title AS language_title')
->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language');
// Join over the users for the checked out user.
$query->select('uc.name AS editor')
->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
// Join over the asset groups.
$query->select('ag.title AS access_level')
->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Join over the categories.
$query->select('c.title AS category_title')
->join('LEFT', '#__categories AS c ON c.id = a.catid');
// Join over the associations.
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
if ($assoc)
{
$query->select('COUNT(asso2.id)>1 as association')
->join('LEFT', '#__associations AS asso ON asso.id = a.id AND asso.context=' . $db->quote('com_newsfeeds.item'))
->join('LEFT', '#__associations AS asso2 ON asso2.key = asso.key')
->group('a.id');
}
// Filter by access level.
if ($access = $this->getState('filter.access'))
{
$query->where('a.access = ' . (int) $access);
}
// Implement View Level Access
if (!$user->authorise('core.admin'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
// Filter by published state.
$published = $this->getState('filter.published');
if (is_numeric($published))
{
$query->where('a.published = ' . (int) $published);
}
elseif ($published === '')
{
$query->where('(a.published IN (0, 1))');
}
// Filter by category.
$categoryId = $this->getState('filter.category_id');
if (is_numeric($categoryId))
{
$query->where('a.catid = ' . (int) $categoryId);
}
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0)
{
$query->where('a.id = ' . (int) substr($search, 3));
}
else
{
$search = $db->quote('%' . $db->escape($search, true) . '%');
$query->where('(a.name LIKE ' . $search . ' OR a.alias LIKE ' . $search . ')');
}
}
// Filter on the language.
if ($language = $this->getState('filter.language'))
{
$query->where('a.language = ' . $db->quote($language));
}
// Filter by a single tag.
$tagId = $this->getState('filter.tag');
if (is_numeric($tagId))
{
$query->where($db->quoteName('tagmap.tag_id') . ' = ' . (int) $tagId)
->join(
'LEFT', $db->quoteName('#__contentitem_tag_map', 'tagmap')
. ' ON ' . $db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id')
. ' AND ' . $db->quoteName('tagmap.type_alias') . ' = ' . $db->quote('com_newsfeeds.newsfeed')
);
}
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
if ($orderCol == 'a.ordering' || $orderCol == 'category_title')
{
$orderCol = 'c.title ' . $orderDirn . ', a.ordering';
}
$query->order($db->escape($orderCol . ' ' . $orderDirn));
//echo nl2br(str_replace('#__','jos_',$query));
return $query;
}
}

View File

@ -0,0 +1,19 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
if (!JFactory::getUser()->authorise('core.manage', 'com_newsfeeds'))
{
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
$controller = JControllerLegacy::getInstance('Newsfeeds');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.1" method="upgrade">
<name>com_newsfeeds</name>
<author>Joomla! Project</author>
<creationDate>April 2006</creationDate>
<copyright>(C) 2005 - 2013 Open Source Matters. All rights reserved. </copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>COM_NEWSFEEDS_XML_DESCRIPTION</description>
<install> <!-- Runs on install -->
<sql>
<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
</sql>
</install>
<uninstall> <!-- Runs on uninstall -->
<sql>
<file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8.sql</file>
</sql>
</uninstall>
<files folder="site">
<filename>controller.php</filename>
<filename>index.html</filename>
<filename>metadata.xml</filename>
<filename>newsfeeds.php</filename>
<filename>router.php</filename>
<folder>helpers</folder>
<folder>models</folder>
<folder>views</folder>
</files>
<languages folder="site">
<language tag="en-GB">language/en-GB.com_newsfeeds.ini</language>
</languages>
<administration>
<menu img="class:newsfeeds">com_newsfeeds</menu>
<submenu>
<!--
Note that all & must be escaped to &amp; for the file to be valid
XML and be parsed by the installer
-->
<menu link="option=com_newsfeeds" view="feeds" img="class:newsfeeds"
alt="Newsfeeds/Feeds">com_newsfeeds_feeds</menu>
<menu link="option=com_categories&amp;extension=com_newsfeeds"
view="categories" img="class:newsfeeds-cat" alt="Newsfeeds/Categories">com_newsfeeds_categories</menu>
</submenu>
<files folder="admin">
<filename>access.xml</filename>
<filename>config.xml</filename>
<filename>controller.php</filename>
<filename>index.html</filename>
<filename>newsfeeds.php</filename>
<folder>controllers</folder>
<folder>elements</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>tables</folder>
<folder>views</folder>
</files>
<languages folder="admin">
<language tag="en-GB">language/en-GB.com_newsfeeds.ini</language>
<language tag="en-GB">language/en-GB.com_newsfeeds.sys.ini</language>
</languages>
</administration>
</extension>

View File

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

View File

@ -0,0 +1,40 @@
CREATE TABLE `#__newsfeeds` (
`catid` integer NOT NULL default '0',
`id` integer(10) UNSIGNED NOT NULL auto_increment,
`name` varchar(100) NOT NULL DEFAULT '',
`alias` varchar(100) NOT NULL default '',
`link` varchar(200) NOT NULL DEFAULT '',
`filename` varchar(200) default NULL,
`published` tinyint(1) NOT NULL default '0',
`numarticles` integer unsigned NOT NULL default '1',
`cache_time` integer unsigned NOT NULL default '3600',
`checked_out` integer(10) unsigned NOT NULL default '0',
`checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
`ordering` integer NOT NULL default '0',
`rtl` tinyint(4) NOT NULL default '0',
`access` tinyint UNSIGNED NOT NULL DEFAULT '0',
`language` char(7) NOT NULL DEFAULT '',
`params` text NOT NULL,
`created` datetime NOT NULL default '0000-00-00 00:00:00',
`created_by` int(10) unsigned NOT NULL default '0',
`created_by_alias` varchar(255) NOT NULL default '',
`modified` datetime NOT NULL default '0000-00-00 00:00:00',
`modified_by` int(10) unsigned NOT NULL default '0',
`metakey` text NOT NULL,
`metadesc` text NOT NULL,
`metadata` text NOT NULL,
`xreference` varchar(50) NOT NULL COMMENT 'A reference to enable linkages to external data sets.',
`publish_up` datetime NOT NULL default '0000-00-00 00:00:00',
`publish_down` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `idx_access` (`access`),
KEY `idx_checkout` (`checked_out`),
KEY `idx_state` (`published`),
KEY `idx_catid` (`catid`),
KEY `idx_createdby` (`created_by`),
KEY `idx_language` (`language`),
KEY `idx_xreference` (`xreference`)
) DEFAULT CHARSET=utf8;

View File

@ -0,0 +1,2 @@
DROP TABLE IF EXISTS `#__newsfeeds`;

View File

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

View File

@ -0,0 +1,171 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @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.Administrator
* @subpackage com_newsfeeds
*/
class NewsfeedsTableNewsfeed extends JTable
{
/**
* Constructor
*
* @param JDatabaseDriver &$db A database connector object
*/
public function __construct(&$db)
{
parent::__construct('#__newsfeeds', 'id', $db);
}
/**
* Overloaded bind function to pre-process the params.
*
* @param mixed $array An associative array or object to bind to the JTable instance.
* @param mixed $ignore An optional array or space separated list of properties to ignore while binding.
*
* @return boolean True on success.
*
* @see JTable:bind
* @since 1.5
*/
public function bind($array, $ignore = '')
{
if (isset($array['params']) && is_array($array['params']))
{
$registry = new JRegistry;
$registry->loadArray($array['params']);
$array['params'] = (string) $registry;
}
if (isset($array['metadata']) && is_array($array['metadata']))
{
$registry = new JRegistry;
$registry->loadArray($array['metadata']);
$array['metadata'] = (string) $registry;
}
if (isset($array['images']) && is_array($array['images']))
{
$registry = new JRegistry;
$registry->loadArray($array['images']);
$array['images'] = (string) $registry;
}
return parent::bind($array, $ignore);
}
/**
* Overloaded check method to ensure data integrity.
*
* @return boolean True on success.
*/
public function check()
{
// Check for valid name.
if (trim($this->name) == '')
{
$this->setError(JText::_('COM_NEWSFEEDS_WARNING_PROVIDE_VALID_NAME'));
return false;
}
if (empty($this->alias))
{
$this->alias = $this->name;
}
$this->alias = JApplication::stringURLSafe($this->alias);
if (trim(str_replace('-', '', $this->alias)) == '')
{
$this->alias = JFactory::getDate()->format("Y-m-d-H-i-s");
}
// Check the publish down date is not earlier than publish up.
if ((int) $this->publish_down > 0 && $this->publish_down < $this->publish_up)
{
$this->setError(JText::_('JGLOBAL_START_PUBLISH_AFTER_FINISH'));
return false;
}
// clean up keywords -- eliminate extra spaces between phrases
// and cr (\r) and lf (\n) characters from string
if (!empty($this->metakey))
{
// only process if not empty
$bad_characters = array("\n", "\r", "\"", "<", ">"); // array of characters to remove
$after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); // remove bad characters
$keys = explode(',', $after_clean); // create array using commas as delimiter
$clean_keys = array();
foreach ($keys as $key)
{
if (trim($key)) { // ignore blank keywords
$clean_keys[] = trim($key);
}
}
$this->metakey = implode(", ", $clean_keys); // put array back together delimited by ", "
}
// clean up description -- eliminate quotes and <> brackets
if (!empty($this->metadesc))
{
// only process if not empty
$bad_characters = array("\"", "<", ">");
$this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc);
}
return true;
}
/**
* Overriden JTable::store to set modified data.
*
* @param boolean $updateNulls True to update fields even if they are null.
*
* @return boolean True on success.
*
* @since 1.6
*/
public function store($updateNulls = false)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
if ($this->id)
{
// Existing item
$this->modified = $date->toSql();
$this->modified_by = $user->get('id');
}
else
{
// New newsfeed. A feed created and created_by field can be set by the user,
// so we don't touch either of these if they are set.
if (!(int) $this->created)
{
$this->created = $date->toSql();
}
if (empty($this->created_by))
{
$this->created_by = $user->get('id');
}
}
// Verify that the alias is unique
$table = JTable::getInstance('Newsfeed', 'NewsfeedsTable');
if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0))
{
$this->setError(JText::_('COM_NEWSFEEDS_ERROR_UNIQUE_ALIAS'));
return false;
}
// Save links as punycode.
$this->link = JStringPunycode::urlToPunycode($this->link);
return parent::store($updateNulls);
}
}

View File

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

View File

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

View File

@ -0,0 +1,203 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Include the HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.keepalive');
JHtml::_('formbehavior.chosen', 'select');
$app = JFactory::getApplication();
$input = $app->input;
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
?>
<script type="text/javascript">
Joomla.submitbutton = function(task)
{
if (task == 'newsfeed.cancel' || document.formvalidator.isValid(document.id('newsfeed-form')))
{
Joomla.submitform(task, document.getElementById('newsfeed-form'));
}
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_newsfeeds&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="newsfeed-form" class="form-validate form-horizontal">
<?php echo JLayoutHelper::render('joomla.edit.item_title', $this); ?>
<div class="row-fluid">
<!-- Begin Newsfeed -->
<div class="span10 form-horizontal">
<fieldset>
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'details')); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'details', empty($this->item->id) ? JText::_('COM_NEWSFEEDS_NEW_NEWSFEED', true) : JText::sprintf('COM_NEWSFEEDS_EDIT_NEWSFEED', $this->item->id, true)); ?>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('name'); ?></div>
<div class="controls"><?php echo $this->form->getInput('name'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('link'); ?></div>
<div class="controls"><?php echo $this->form->getInput('link'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('catid'); ?></div>
<div class="controls"><?php echo $this->form->getInput('catid'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('description'); ?></div>
<div class="controls"><?php echo $this->form->getInput('description'); ?></div>
</div>
<div class="span6">
<h4><?php echo JText::_('COM_NEWSFEEDS_FIELDSET_IMAGES');?></h4>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('images'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('images'); ?>
</div>
</div>
<?php foreach ($this->form->getGroup('images') as $field) : ?>
<div class="control-group">
<?php if (!$field->hidden) : ?>
<div class="control-label">
<?php echo $field->label; ?>
</div>
<?php endif; ?>
<div class="controls">
<?php echo $field->input; ?>
</div>
</div>
<?php endforeach; ?>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'publishing', JText::_('JGLOBAL_FIELDSET_PUBLISHING', true)); ?>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('alias'); ?></div>
<div class="controls"><?php echo $this->form->getInput('alias'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('id'); ?></div>
<div class="controls"><?php echo $this->form->getInput('id'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('created_by'); ?></div>
<div class="controls"><?php echo $this->form->getInput('created_by'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('created_by_alias'); ?></div>
<div class="controls"><?php echo $this->form->getInput('created_by_alias'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('created'); ?></div>
<div class="controls"><?php echo $this->form->getInput('created'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('publish_up'); ?></div>
<div class="controls"><?php echo $this->form->getInput('publish_up'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('publish_down'); ?></div>
<div class="controls"><?php echo $this->form->getInput('publish_down'); ?></div>
</div>
<?php if ($this->item->modified_by) : ?>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('modified_by'); ?></div>
<div class="controls"><?php echo $this->form->getInput('modified_by'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('modified'); ?></div>
<div class="controls"><?php echo $this->form->getInput('modified'); ?></div>
</div>
<?php endif; ?>
<?php if ($this->item->version) : ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('version'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('version'); ?>
</div>
</div>
<?php endif; ?>
<?php if ($this->item->hits) : ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('hits'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('hits'); ?>
</div>
</div>
<?php endif; ?>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('ordering'); ?></div>
<div class="controls"><?php echo $this->form->getInput('ordering'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('numarticles'); ?></div>
<div class="controls"><?php echo $this->form->getInput('numarticles'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('cache_time'); ?></div>
<div class="controls"><?php echo $this->form->getInput('cache_time'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('rtl'); ?></div>
<div class="controls"><?php echo $this->form->getInput('rtl'); ?></div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php $fieldSets = $this->form->getFieldsets('params'); ?>
<?php foreach ($fieldSets as $name => $fieldSet) : ?>
<?php $paramstabs = 'params-' . $name; ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', $paramstabs, JText::_($fieldSet->label, true)); ?>
<?php echo $this->loadTemplate('params'); ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endforeach; ?>
<?php $fieldSets = $this->form->getFieldsets('metadata'); ?>
<?php foreach ($fieldSets as $name => $fieldSet) : ?>
<?php $metadatatabs = 'metadata-' . $name; ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', $metadatatabs, JText::_($fieldSet->label, true)); ?>
<?php echo $this->loadTemplate('metadata'); ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endforeach; ?>
<?php if ($assoc) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'associations', JText::_('JGLOBAL_FIELDSET_ASSOCIATIONS', true)); ?>
<?php echo $this->loadTemplate('associations'); ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
</fieldset>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</div>
<!-- End Newsfeed -->
<!-- Begin Sidebar -->
<?php echo JLayoutHelper::render('joomla.edit.details', $this); ?>
<!-- End Sidebar -->
</div>
</form>

View File

@ -0,0 +1,12 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
echo JLayoutHelper::render('joomla.edit.associations', $this);

View File

@ -0,0 +1,12 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
echo JLayoutHelper::render('joomla.edit.metadata', $this);

View File

@ -0,0 +1,28 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @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;
$fieldSets = $this->form->getFieldsets('params');
foreach ($fieldSets as $name => $fieldSet) :
?>
<div class="tab-pane" id="params-<?php echo $name;?>">
<?php
if (isset($fieldSet->description) && trim($fieldSet->description)) :
echo '<p class="alert alert-info">'.$this->escape(JText::_($fieldSet->description)).'</p>';
endif;
?>
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
<div class="control-group">
<div class="control-label"><?php echo $field->label; ?></div>
<div class="controls"><?php echo $field->input; ?></div>
</div>
<?php endforeach; ?>
</div>
<?php endforeach; ?>

View File

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

View File

@ -0,0 +1,214 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @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_ROOT . '/components/com_newsfeeds/helpers/route.php';
// Include the HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.keepalive');
JHtml::_('formbehavior.chosen', 'select');
$app = JFactory::getApplication();
$input = $app->input;
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
?>
<script type="text/javascript">
Joomla.submitbutton = function(task)
{
if (task == 'newsfeed.cancel' || document.formvalidator.isValid(document.id('newsfeed-form')))
{
if (window.opener && (task == 'newsfeed.save' || task == 'newsfeed.cancel'))
{
window.opener.document.closeEditWindow = self;
window.opener.setTimeout('window.document.closeEditWindow.close()', 1000);
}
Joomla.submitform(task, document.getElementById('newsfeed-form'));
}
}
</script>
<div class="container-popup">
<div class="pull-right">
<button class="btn btn-primary" type="button" onclick="Joomla.submitbutton('newsfeed.apply');"><?php echo JText::_('JTOOLBAR_APPLY') ?></button>
<button class="btn btn-primary" type="button" onclick="Joomla.submitbutton('newsfeed.save');"><?php echo JText::_('JTOOLBAR_SAVE') ?></button>
<button class="btn" type="button" onclick="Joomla.submitbutton('newsfeed.cancel');"><?php echo JText::_('JCANCEL') ?></button>
</div>
<form action="<?php echo JRoute::_('index.php?option=com_newsfeeds&layout=modal&tmpl=component&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="newsfeed-form" class="form-validate form-horizontal">
<div class="row-fluid">
<!-- Begin Newsfeed -->
<div class="span10 form-horizontal">
<fieldset>
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'details')); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'details', empty($this->item->id) ? JText::_('COM_NEWSFEEDS_NEW_NEWSFEED', true) : JText::sprintf('COM_NEWSFEEDS_EDIT_NEWSFEED', $this->item->id, true)); ?>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('name'); ?></div>
<div class="controls"><?php echo $this->form->getInput('name'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('link'); ?></div>
<div class="controls"><?php echo $this->form->getInput('link'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('catid'); ?></div>
<div class="controls"><?php echo $this->form->getInput('catid'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('description'); ?></div>
<div class="controls"><?php echo $this->form->getInput('description'); ?></div>
</div>
<div class="span6">
<h4><?php echo JText::_('COM_NEWSFEEDS_FIELDSET_IMAGES');?></h4>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('images'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('images'); ?>
</div>
</div>
<?php foreach ($this->form->getGroup('images') as $field) : ?>
<div class="control-group">
<?php if (!$field->hidden) : ?>
<div class="control-label">
<?php echo $field->label; ?>
</div>
<?php endif; ?>
<div class="controls">
<?php echo $field->input; ?>
</div>
</div>
<?php endforeach; ?>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'publishing', JText::_('JGLOBAL_FIELDSET_PUBLISHING', true)); ?>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('alias'); ?></div>
<div class="controls"><?php echo $this->form->getInput('alias'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('id'); ?></div>
<div class="controls"><?php echo $this->form->getInput('id'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('created_by'); ?></div>
<div class="controls"><?php echo $this->form->getInput('created_by'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('created_by_alias'); ?></div>
<div class="controls"><?php echo $this->form->getInput('created_by_alias'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('created'); ?></div>
<div class="controls"><?php echo $this->form->getInput('created'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('publish_up'); ?></div>
<div class="controls"><?php echo $this->form->getInput('publish_up'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('publish_down'); ?></div>
<div class="controls"><?php echo $this->form->getInput('publish_down'); ?></div>
</div>
<?php if ($this->item->modified_by) : ?>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('modified_by'); ?></div>
<div class="controls"><?php echo $this->form->getInput('modified_by'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('modified'); ?></div>
<div class="controls"><?php echo $this->form->getInput('modified'); ?></div>
</div>
<?php endif; ?>
<?php if ($this->item->version) : ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('version'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('version'); ?>
</div>
</div>
<?php endif; ?>
<?php if ($this->item->hits) : ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('hits'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('hits'); ?>
</div>
</div>
<?php endif; ?>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('ordering'); ?></div>
<div class="controls"><?php echo $this->form->getInput('ordering'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('numarticles'); ?></div>
<div class="controls"><?php echo $this->form->getInput('numarticles'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('cache_time'); ?></div>
<div class="controls"><?php echo $this->form->getInput('cache_time'); ?></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('rtl'); ?></div>
<div class="controls"><?php echo $this->form->getInput('rtl'); ?></div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php $fieldSets = $this->form->getFieldsets('params'); ?>
<?php foreach ($fieldSets as $name => $fieldSet) : ?>
<?php $paramstabs = 'params-' . $name; ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', $paramstabs, JText::_($fieldSet->label, true)); ?>
<?php echo $this->loadTemplate('params'); ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endforeach; ?>
<?php $fieldSets = $this->form->getFieldsets('metadata'); ?>
<?php foreach ($fieldSets as $name => $fieldSet) : ?>
<?php $metadatatabs = 'metadata-' . $name; ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', $metadatatabs, JText::_($fieldSet->label, true)); ?>
<?php echo $this->loadTemplate('metadata'); ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endforeach; ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
</fieldset>
<div class="hidden">
<?php echo $this->loadTemplate('associations'); ?>
</div>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</div>
<!-- End Newsfeed -->
<!-- Begin Sidebar -->
<?php echo JLayoutHelper::render('joomla.edit.details', $this); ?>
<!-- End Sidebar -->
</div>
</form>
</div>

View File

@ -0,0 +1,12 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
echo JLayoutHelper::render('joomla.edit.associations', $this);

View File

@ -0,0 +1,12 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
echo JLayoutHelper::render('joomla.edit.metadata', $this);

View File

@ -0,0 +1,28 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @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;
$fieldSets = $this->form->getFieldsets('params');
foreach ($fieldSets as $name => $fieldSet) :
?>
<div class="tab-pane" id="params-<?php echo $name;?>">
<?php
if (isset($fieldSet->description) && trim($fieldSet->description)) :
echo '<p class="alert alert-info">'.$this->escape(JText::_($fieldSet->description)).'</p>';
endif;
?>
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
<div class="control-group">
<div class="control-label"><?php echo $field->label; ?></div>
<div class="controls"><?php echo $field->input; ?></div>
</div>
<?php endforeach; ?>
</div>
<?php endforeach; ?>

View File

@ -0,0 +1,97 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* View to edit a newsfeed.
*
* @package Joomla.Administrator
* @subpackage com_newsfeeds
* @since 1.6
*/
class NewsfeedsViewNewsfeed extends JViewLegacy
{
protected $item;
protected $form;
protected $state;
/**
* Display the view
*/
public function display($tpl = null)
{
$this->state = $this->get('State');
$this->item = $this->get('Item');
$this->form = $this->get('Form');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}
if ($this->getLayout() == 'modal')
{
$this->form->setFieldAttribute('language', 'readonly', 'true');
$this->form->setFieldAttribute('catid', 'readonly', 'true');
}
$this->addToolbar();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
JFactory::getApplication()->input->set('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = ($this->item->id == 0);
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
// Since we don't track these assets at the item level, use the category id.
$canDo = NewsfeedsHelper::getActions($this->item->catid, 0);
JToolbarHelper::title(JText::_('COM_NEWSFEEDS_MANAGER_NEWSFEED'), 'newsfeeds.png');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0))
{
JToolbarHelper::apply('newsfeed.apply');
JToolbarHelper::save('newsfeed.save');
}
if (!$checkedOut && count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0){
JToolbarHelper::save2new('newsfeed.save2new');
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create'))
{
JToolbarHelper::save2copy('newsfeed.save2copy');
}
if (empty($this->item->id))
{
JToolbarHelper::cancel('newsfeed.cancel');
}
else
{
JToolbarHelper::cancel('newsfeed.cancel', 'JTOOLBAR_CLOSE');
}
JToolbarHelper::divider();
JToolbarHelper::help('JHELP_COMPONENTS_NEWSFEEDS_FEEDS_EDIT');
}
}

View File

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

View File

@ -0,0 +1,263 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('bootstrap.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');
$app = JFactory::getApplication();
$user = JFactory::getUser();
$userId = $user->get('id');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$archived = $this->state->get('filter.published') == 2 ? true : false;
$trashed = $this->state->get('filter.published') == -2 ? true : false;
$canOrder = $user->authorise('core.edit.state', 'com_newsfeeds.category');
$saveOrder = $listOrder == 'a.ordering';
if ($saveOrder)
{
$saveOrderingUrl = 'index.php?option=com_newsfeeds&task=newsfeeds.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'articleList', 'adminForm', strtolower($listDirn), $saveOrderingUrl);
}
$sortFields = $this->getSortFields();
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
?>
<script type="text/javascript">
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php echo $listOrder; ?>')
{
dirn = 'asc';
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_newsfeeds&view=newsfeeds'); ?>" method="post" name="adminForm" id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif;?>
<div id="filter-bar" class="btn-toolbar">
<div class="filter-search btn-group pull-left">
<label for="filter_search" class="element-invisible"><?php echo JText::_('COM_NEWSFEEDS_FILTER_SEARCH_DESC');?></label>
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('COM_NEWSFEEDS_SEARCH_IN_TITLE'); ?>" />
</div>
<div class="btn-group pull-left hidden-phone">
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
</div>
<div class="btn-group pull-right hidden-phone">
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<div class="btn-group pull-right hidden-phone">
<label for="directionTable" class="element-invisible"><?php echo JText::_('JFIELD_ORDERING_DESC');?></label>
<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
<option value=""><?php echo JText::_('JFIELD_ORDERING_DESC');?></option>
<option value="asc" <?php if ($listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING');?></option>
<option value="desc" <?php if ($listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_DESCENDING');?></option>
</select>
</div>
<div class="btn-group pull-right">
<label for="sortTable" class="element-invisible"><?php echo JText::_('JGLOBAL_SORT_BY');?></label>
<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
<option value=""><?php echo JText::_('JGLOBAL_SORT_BY');?></option>
<?php echo JHtml::_('select.options', $sortFields, 'value', 'text', $listOrder);?>
</select>
</div>
</div>
<div class="clearfix"> </div>
<table class="table table-striped" id="articleList">
<thead>
<tr>
<th width="1%" class="nowrap center hidden-phone">
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?>
</th>
<th width="1%" class="hidden-phone">
<?php echo JHtml::_('grid.checkall'); ?>
</th>
<th width="5%" class="nowrap center">
<?php echo JHtml::_('grid.sort', 'JSTATUS', 'a.published', $listDirn, $listOrder); ?>
</th>
<th class="title">
<?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.name', $listDirn, $listOrder); ?>
</th>
<th width="5%" class="nowrap hidden-phone">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
</th>
<th width="10%" class="nowrap hidden-phone">
<?php echo JHtml::_('grid.sort', 'COM_NEWSFEEDS_NUM_ARTICLES_HEADING', 'numarticles', $listDirn, $listOrder); ?>
</th>
<th width="5%" class="nowrap hidden-phone">
<?php echo JHtml::_('grid.sort', 'COM_NEWSFEEDS_CACHE_TIME_HEADING', 'a.cache_time', $listDirn, $listOrder); ?>
</th>
<?php if ($assoc) : ?>
<th width="5%" class="nowrap hidden-phone">
<?php echo JHtml::_('grid.sort', 'COM_NEWSFEEDS_HEADING_ASSOCIATION', 'association', $listDirn, $listOrder); ?>
</th>
<?php endif;?>
<th width="5%" class="nowrap hidden-phone">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_LANGUAGE', 'a.language', $listDirn, $listOrder); ?>
</th>
<th width="1%" class="nowrap center hidden-phone">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="11">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) :
$ordering = ($listOrder == 'a.ordering');
$canCreate = $user->authorise('core.create', 'com_newsfeeds.category.' . $item->catid);
$canEdit = $user->authorise('core.edit', 'com_newsfeeds.category.' . $item->catid);
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || $item->checked_out == 0;
$canChange = $user->authorise('core.edit.state', 'com_newsfeeds.category.' . $item->catid) && $canCheckin;
?>
<tr class="row<?php echo $i % 2; ?>" sortable-group-id="<?php echo $item->catid?>">
<td class="order nowrap center hidden-phone">
<?php
$iconClass = '';
if (!$canChange)
{
$iconClass = ' inactive';
}
elseif (!$saveOrder)
{
$iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
}
?>
<span class="sortable-handler<?php echo $iconClass ?>">
<i class="icon-menu"></i>
</span>
<?php if ($canChange && $saveOrder) : ?>
<input type="text" style="display:none" name="order[]" size="5" value="<?php echo $item->ordering;?>" class="width-20 text-area-order" />
<?php endif; ?>
</td>
<td class="center hidden-phone">
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
</td>
<td class="center">
<?php echo JHtml::_('jgrid.published', $item->published, $i, 'newsfeeds.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?>
</td>
<td class="nowrap has-context">
<div class="pull-left">
<?php if ($item->checked_out) : ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'newsfeeds.', $canCheckin); ?>
<?php endif; ?>
<?php if ($canEdit) : ?>
<a href="<?php echo JRoute::_('index.php?option=com_newsfeeds&task=newsfeed.edit&id='.(int) $item->id); ?>">
<?php echo $this->escape($item->name); ?></a>
<?php else : ?>
<?php echo $this->escape($item->name); ?>
<?php endif; ?>
<span class="small">
<?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias));?>
</span>
<div class="small">
<?php echo $this->escape($item->category_title); ?>
</div>
</div>
<div class="pull-left">
<?php
// Create dropdown items
JHtml::_('dropdown.edit', $item->id, 'newsfeed.');
JHtml::_('dropdown.divider');
if ($item->published) :
JHtml::_('dropdown.unpublish', 'cb' . $i, 'newsfeeds.');
else :
JHtml::_('dropdown.publish', 'cb' . $i, 'newsfeeds.');
endif;
JHtml::_('dropdown.divider');
if ($archived) :
JHtml::_('dropdown.unarchive', 'cb' . $i, 'newsfeeds.');
else :
JHtml::_('dropdown.archive', 'cb' . $i, 'newsfeeds.');
endif;
if ($item->checked_out) :
JHtml::_('dropdown.checkin', 'cb' . $i, 'newsfeeds.');
endif;
if ($trashed) :
JHtml::_('dropdown.untrash', 'cb' . $i, 'newsfeeds.');
else :
JHtml::_('dropdown.trash', 'cb' . $i, 'newsfeeds.');
endif;
// render dropdown list
echo JHtml::_('dropdown.render');
?>
</div>
</td>
<td class="small hidden-phone">
<?php echo $this->escape($item->access_level); ?>
</td>
<td class="center hidden-phone">
<?php echo (int) $item->numarticles; ?>
</td>
<td class="center hidden-phone">
<?php echo (int) $item->cache_time; ?>
</td>
<?php if ($assoc) : ?>
<td class="hidden-phone">
<?php if ($item->association) : ?>
<?php echo JHtml::_('newsfeed.association', $item->id); ?>
<?php endif; ?>
</td>
<?php endif;?>
<td class="small hidden-phone">
<?php if ($item->language == '*'):?>
<?php echo JText::alt('JALL', 'language'); ?>
<?php else:?>
<?php echo $item->language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?>
<?php endif;?>
</td>
<td class="center hidden-phone">
<?php echo (int) $item->id; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php //Load the batch processing form. ?>
<?php echo $this->loadTemplate('batch'); ?>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>

View File

@ -0,0 +1,52 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @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;
$published = $this->state->get('filter.published');
?>
<div class="modal hide fade" id="collapseModal">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">x</button>
<h3><?php echo JText::_('COM_NEWSFEEDS_BATCH_OPTIONS');?></h3>
</div>
<div class="modal-body">
<p><?php echo JText::_('COM_NEWSFEEDS_BATCH_TIP'); ?></p>
<div class="control-group">
<div class="controls">
<?php echo JHtml::_('batch.access');?>
</div>
</div>
<div class="control-group">
<div class="controls">
<?php echo JHtml::_('batch.language'); ?>
</div>
</div>
<div class="control-group">
<div class="controls">
<?php echo JHtml::_('batch.tag');?>
</div>
</div>
<?php if ($published >= 0) : ?>
<div class="control-group">
<div class="controls">
<?php echo JHtml::_('batch.item', 'com_newsfeeds');?>
</div>
</div>
<?php endif; ?>
</div>
<div class="modal-footer">
<button class="btn" type="button" onclick="document.id('batch-category-id').value='';document.id('batch-access').value='';document.id('batch-language-id').value='';document.id('batch-tag-id)').value=''" data-dismiss="modal">
<?php echo JText::_('JCANCEL'); ?>
</button>
<button class="btn btn-primary" type="submit" onclick="Joomla.submitbutton('newsfeed.batch');">
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
</button>
</div>
</div>

View File

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

View File

@ -0,0 +1,155 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @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_ROOT . '/components/com_newsfeeds/helpers/route.php';
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('bootstrap.tooltip');
$input = JFactory::getApplication()->input;
$function = JFactory::getApplication()->input->getCmd('function', 'jSelectNewsfeed');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
?>
<form action="<?php echo JRoute::_('index.php?option=com_newsfeeds&view=newsfeeds&layout=modal&tmpl=component&function='.$function);?>" method="post" name="adminForm" id="adminForm" class="form-inline">
<fieldset class="filter clearfix">
<div class="btn-toolbar">
<div class="btn-group pull-left">
<label for="filter_search">
<?php echo JText::_('JSEARCH_FILTER_LABEL'); ?>
</label>
<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" size="30" title="<?php echo JText::_('COM_NEWSFEEDS_FILTER_SEARCH_DESC'); ?>" />
</div>
<div class="btn-group pull-left">
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>" data-placement="bottom">
<i class="icon-search"></i></button>
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" data-placement="bottom" onclick="document.id('filter_search').value='';this.form.submit();">
<i class="icon-remove"></i></button>
</div>
<div class="clearfix"></div>
</div>
<hr class="hr-condensed" />
<div class="filters pull-left">
<select name="filter_access" class="input-medium" onchange="this.form.submit()">
<option value=""><?php echo JText::_('JOPTION_SELECT_ACCESS');?></option>
<?php echo JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'));?>
</select>
<select name="filter_published" class="input-medium" onchange="this.form.submit()">
<option value=""><?php echo JText::_('JOPTION_SELECT_PUBLISHED');?></option>
<?php echo JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true);?>
</select>
<?php if ($this->state->get('filter.forcedLanguage')) : ?>
<select name="filter_category_id" class="input-medium" onchange="this.form.submit()">
<option value=""><?php echo JText::_('JOPTION_SELECT_CATEGORY');?></option>
<?php echo JHtml::_('select.options', JHtml::_('category.options', 'com_newsfeeds', array('filter.language' => array('*', $this->state->get('filter.forcedLanguage')))), 'value', 'text', $this->state->get('filter.category_id'));?>
</select>
<input type="hidden" name="forcedLanguage" value="<?php echo $this->escape($this->state->get('filter.forcedLanguage')); ?>" />
<input type="hidden" name="filter_language" value="<?php echo $this->escape($this->state->get('filter.language')); ?>" />
<?php else : ?>
<select name="filter_category_id" class="input-medium" onchange="this.form.submit()">
<option value=""><?php echo JText::_('JOPTION_SELECT_CATEGORY');?></option>
<?php echo JHtml::_('select.options', JHtml::_('category.options', 'com_newsfeeds'), 'value', 'text', $this->state->get('filter.category_id'));?>
</select>
<select name="filter_language" class="input-medium" onchange="this.form.submit()">
<option value=""><?php echo JText::_('JOPTION_SELECT_LANGUAGE');?></option>
<?php echo JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language'));?>
</select>
<?php endif; ?>
</div>
</fieldset>
<table class="table table-striped table-condensed">
<thead>
<tr>
<th class="title">
<?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.name', $listDirn, $listOrder); ?>
</th>
<th width="15%" class="nowrap center">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ACCESS', 'access_level', $listDirn, $listOrder); ?>
</th>
<th width="15%" class="nowrap center">
<?php echo JHtml::_('grid.sort', 'JCATEGORY', 'a.catid', $listDirn, $listOrder); ?>
</th>
<th width="5%" class="nowrap center">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_LANGUAGE', 'language', $listDirn, $listOrder); ?>
</th>
<th width="1%" class="nowrap center">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="15">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) : ?>
<?php if ($item->language && JLanguageMultilang::isEnabled())
{
$tag = strlen($item->language);
if ($tag == 5)
{
$lang = substr($item->language, 0, 2);
}
elseif ($tag == 6)
{
$lang = substr($item->language, 0, 3);
}
else {
$lang = "";
}
}
elseif (!JLanguageMultilang::isEnabled())
{
$lang = "";
}
?>
<tr class="row<?php echo $i % 2; ?>">
<td>
<a href="javascript:void(0)" onclick="if (window.parent) window.parent.<?php echo $this->escape($function);?>('<?php echo $item->id; ?>', '<?php echo $this->escape(addslashes($item->name)); ?>', '<?php echo $this->escape($item->catid); ?>', null, '<?php echo $this->escape(NewsfeedsHelperRoute::getNewsfeedRoute($item->id, $item->catid, $item->language)); ?>', '<?php echo $this->escape($lang); ?>', null);">
<?php echo $this->escape($item->name); ?></a>
</td>
<td class="center">
<?php echo $this->escape($item->access_level); ?>
</td>
<td class="center">
<?php echo $this->escape($item->category_title); ?>
</td>
<td class="center">
<?php if ($item->language == '*'):?>
<?php echo JText::alt('JALL', 'language'); ?>
<?php else:?>
<?php echo $item->language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?>
<?php endif;?>
</td>
<td align="center">
<?php echo (int) $item->id; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>

View File

@ -0,0 +1,160 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* View class for a list of newsfeeds.
*
* @package Joomla.Administrator
* @subpackage com_newsfeeds
* @since 1.6
*/
class NewsfeedsViewNewsfeeds extends JViewLegacy
{
protected $items;
protected $pagination;
protected $state;
/**
* Display the view
*/
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
NewsfeedsHelper::addSubmenu('newsfeeds');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
$state = $this->get('State');
$canDo = NewsfeedsHelper::getActions($state->get('filter.category_id'));
$user = JFactory::getUser();
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
JToolbarHelper::title(JText::_('COM_NEWSFEEDS_MANAGER_NEWSFEEDS'), 'newsfeeds.png');
if (count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0)
{
JToolbarHelper::addNew('newsfeed.add');
}
if ($canDo->get('core.edit'))
{
JToolbarHelper::editList('newsfeed.edit');
}
if ($canDo->get('core.edit.state'))
{
JToolbarHelper::publish('newsfeeds.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('newsfeeds.unpublish', 'JTOOLBAR_UNPUBLISH', true);
JToolbarHelper::archiveList('newsfeeds.archive');
}
if ($canDo->get('core.admin'))
{
JToolbarHelper::checkin('newsfeeds.checkin');
}
if ($state->get('filter.published') == -2 && $canDo->get('core.delete'))
{
JToolbarHelper::deleteList('', 'newsfeeds.delete', 'JTOOLBAR_EMPTY_TRASH');
} elseif ($canDo->get('core.edit.state'))
{
JToolbarHelper::trash('newsfeeds.trash');
}
// Add a batch button
if ($user->authorise('core.create', 'com_newsfeeds') && $user->authorise('core.edit', 'com_newsfeeds') && $user->authorise('core.edit.state', 'com_newsfeeds'))
{
JHtml::_('bootstrap.modal', 'collapseModal');
$title = JText::_('JTOOLBAR_BATCH');
// Instantiate a new JLayoutFile instance and render the batch button
$layout = new JLayoutFile('joomla.toolbar.batch');
$dhtml = $layout->render(array('title' => $title));
$bar->appendButton('Custom', $dhtml, 'batch');
}
if ($canDo->get('core.admin'))
{
JToolbarHelper::preferences('com_newsfeeds');
}
JToolbarHelper::help('JHELP_COMPONENTS_NEWSFEEDS_FEEDS');
JHtmlSidebar::setAction('index.php?option=com_newsfeeds&view=newsfeeds');
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_PUBLISHED'),
'filter_published',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
);
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_CATEGORY'),
'filter_category_id',
JHtml::_('select.options', JHtml::_('category.options', 'com_newsfeeds'), 'value', 'text', $this->state->get('filter.category_id'))
);
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_ACCESS'),
'filter_access',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
);
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_LANGUAGE'),
'filter_language',
JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language'))
);
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_TAG'),
'filter_tag',
JHtml::_('select.options', JHtml::_('tag.options', true, true), 'value', 'text', $this->state->get('filter.tag'))
);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array Array containing the field name to sort by as the key and display text as value
*
* @since 3.0
*/
protected function getSortFields()
{
return array(
'a.ordering' => JText::_('JGRID_HEADING_ORDERING'),
'a.published' => JText::_('JSTATUS'),
'a.name' => JText::_('JGLOBAL_TITLE'),
'category_title' => JText::_('JCATEGORY'),
'a.access' => JText::_('JGRID_HEADING_ACCESS'),
'numarticles' => JText::_('COM_NEWSFEEDS_NUM_ARTICLES_HEADING'),
'a.cache_time' => JText::_('COM_NEWSFEEDS_CACHE_TIME_HEADING'),
'a.language' => JText::_('JGRID_HEADING_LANGUAGE'),
'a.id' => JText::_('JGRID_HEADING_ID')
);
}
}