You've already forked joomla_test
first commit
This commit is contained in:
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -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&view=newsfeeds&layout=modal&tmpl=component&function=jSelectNewsfeed_'.$this->id;
|
||||
|
||||
if (isset($this->element['language']))
|
||||
{
|
||||
$link .= '&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.'&'.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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user