tutto cho che serve attachments
This commit is contained in:
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Attachments component attachments view
|
||||
*
|
||||
* @package Attachments
|
||||
* @subpackage Attachments_Component
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
|
||||
* @link http://joomlacode.org/gf/project/attachments/frs/
|
||||
* @author Jonathan M. Cameron
|
||||
*/
|
||||
|
||||
// No direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// Add the attachments admin CSS files
|
||||
$document = JFactory::getDocument();
|
||||
$uri = JFactory::getURI();
|
||||
|
||||
// load tooltip behavior
|
||||
JHtml::_('behavior.tooltip');
|
||||
|
||||
$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_attachments'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<?php echo $this->loadTemplate('filter');?>
|
||||
<table class="adminlist" id="attachmentsList">
|
||||
<thead><?php echo $this->loadTemplate('head');?></thead>
|
||||
<tbody><?php echo $this->loadTemplate('body');?></tbody>
|
||||
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
|
||||
</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>
|
||||
|
||||
@ -0,0 +1,164 @@
|
||||
<?php
|
||||
/**
|
||||
* Attachments component attachments view
|
||||
*
|
||||
* @package Attachments
|
||||
* @subpackage Attachments_Component
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
|
||||
* @link http://joomlacode.org/gf/project/attachments/frs/
|
||||
* @author Jonathan M. Cameron
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted Access');
|
||||
|
||||
// Set up a few convenience items
|
||||
$app = JFactory::getApplication();
|
||||
$user = JFactory::getUser();
|
||||
$uri = JFactory::getURI();
|
||||
$params = $this->params;
|
||||
$secure = $params->get('secure',false);
|
||||
$superimpose_link_icons = $params->get('superimpose_url_link_icons', true);
|
||||
$icon_dir = $uri->root(true) . '/components/com_attachments/media/icons/';
|
||||
|
||||
// Loop through all the attachments
|
||||
$k = 0;
|
||||
$last_parent_id = null;
|
||||
$last_parent_type = null;
|
||||
$last_parent_entity = null;
|
||||
|
||||
|
||||
for ($i=0, $n=count( $this->items ); $i < $n; $i++)
|
||||
{
|
||||
$item = $this->items[$i];
|
||||
|
||||
if ( $item->uri_type == 'file' ) {
|
||||
if ( $secure ) {
|
||||
$url = JRoute::_("index.php?option=com_attachments&task=attachment.download&id=" . (int)$item->id);
|
||||
}
|
||||
else {
|
||||
$url = $uri->root(true) . '/' . $item->url;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$url = $item->url;
|
||||
}
|
||||
$checked = JHtml::_('grid.id', $i, $item->id );
|
||||
$published = JHtml::_('jgrid.published', $item->state, $i, 'attachments.' );
|
||||
$access = $this->level_name[$item->access];
|
||||
|
||||
$size_kb = (int)(10 * $item->file_size / 1024) / 10.0;
|
||||
$link = JFilterOutput::ampReplace( 'index.php?option=com_attachments&task=attachment.edit&cid[]='. (int)$item->id );
|
||||
$view_parent_title = JText::_('ATTACH_VIEW_ARTICLE_TITLE');
|
||||
if ( JString::strlen($item->icon_filename) > 0 )
|
||||
$icon = $item->icon_filename;
|
||||
else
|
||||
$icon = 'generic.gif';
|
||||
$add_attachment_title = JText::_('ATTACH_ADD_ATTACHMENT_TITLE');
|
||||
$edit_attachment_title = JText::_('ATTACH_EDIT_THIS_ATTACHMENT_TITLE');
|
||||
$access_attachment_title = JText::_('ATTACH_ACCESS_THIS_ATTACHMENT_TITLE');
|
||||
|
||||
// Set up the create/modify dates
|
||||
jimport( 'joomla.utilities.date' );
|
||||
$tz = new DateTimeZone( $user->getParam('timezone', $app->getCfg('offset')) );
|
||||
|
||||
$cdate = JFactory::getDate($item->created);
|
||||
$cdate->setTimeZone($tz);
|
||||
$created = $cdate->format("Y-m-d H:i", true);
|
||||
|
||||
$mdate = JFactory::getDate($item->modified);
|
||||
$mdate->setTimeZone($tz);
|
||||
$modified = $mdate->format("Y-m-d H:i", true);
|
||||
|
||||
$add_attachment_txt = JText::_('ATTACH_ADD_ATTACHMENT');
|
||||
if ( ($item->parent_id != $last_parent_id) || ($item->parent_type != $last_parent_type)
|
||||
|| ($item->parent_entity != $last_parent_entity) ) {
|
||||
$parent_type = $item->parent_type;
|
||||
if ( $item->parent_entity != 'default' ) {
|
||||
$parent_type .= '.' . $item->parent_entity;
|
||||
}
|
||||
if ( ($item->parent_id == null) || !$item->parent_exists ) {
|
||||
$artLine = '<tr><td class="at_parentsep" colspan="'.$this->num_columns.'">';
|
||||
$artLine .= '<b>'.$item->parent_entity_type.':</b> <span class="error">'.$item->parent_title.'</span>';
|
||||
$artLine .= '</td></tr>';
|
||||
}
|
||||
else {
|
||||
$addAttachLink = 'index.php?option=com_attachments&task=attachment.add&parent_id='. $item->parent_id .
|
||||
'&parent_type=' . $parent_type . '&editor=add_to_parent';
|
||||
$addAttachLink = JFilterOutput::ampReplace($addAttachLink);
|
||||
$artLine = "<tr><td class=\"at_parentsep\" colspan=\"$this->num_columns\">";
|
||||
$artLine .= "<b>" . $item->parent_entity_type.":</b> <a title=\"$view_parent_title\" " .
|
||||
"href=\"".$item->parent_url."\" target=\"_blank\">" . $item->parent_title . "</a>";
|
||||
$artLine .= JFilterOutput::ampReplace(' ');
|
||||
$artLine .= "<a class=\"addAttach\" href=\"$addAttachLink\" title=\"$add_attachment_title\">";
|
||||
$artLine .= JHtml::image('com_attachments/add_attachment.gif', $add_attachment_txt, null, true);
|
||||
$artLine .= "</a> <a class=\"addAttach\" href=\"$addAttachLink\" title=\"$add_attachment_title\">" .
|
||||
"$add_attachment_txt</a>";
|
||||
$artLine .= "</td></tr>";
|
||||
}
|
||||
echo $artLine;
|
||||
$k = 0;
|
||||
}
|
||||
$last_parent_id = $item->parent_id;
|
||||
$last_parent_type = $item->parent_type;
|
||||
$last_parent_entity = $item->parent_entity;
|
||||
$download_verb = JText::_('ATTACH_DOWNLOAD_VERB');
|
||||
?>
|
||||
<tr class="<?php echo "row$k"; ?>">
|
||||
<td class="at_checked hidden-phone"><?php echo $checked; ?></td>
|
||||
<td class="at_published" align="center"><?php echo $published;?></td>
|
||||
<td class="at_filename">
|
||||
<a href="<?php echo $link; ?>" title="<?php echo $edit_attachment_title; ?>"
|
||||
><?php echo JHtml::image('com_attachments/file_icons/'.$icon, $download_verb, null, true);
|
||||
if ( ($item->uri_type == 'url') && $superimpose_link_icons ) {
|
||||
if ( $item->url_valid ) {
|
||||
echo JHtml::image('com_attachments/file_icons/link_arrow.png', '', 'class="link_overlay"', true);
|
||||
}
|
||||
else {
|
||||
echo JHtml::image('com_attachments/file_icons/link_broken.png', '', 'class="link_overlay"', true);
|
||||
}
|
||||
}
|
||||
?></a> <a
|
||||
href="<?php echo $link; ?>" title="<?php echo $edit_attachment_title; ?>"
|
||||
><?php if ( $item->uri_type == 'file' ) {
|
||||
echo $item->filename;
|
||||
}
|
||||
else {
|
||||
if ( $item->filename ) {
|
||||
echo $item->filename;
|
||||
}
|
||||
else {
|
||||
echo $item->url;
|
||||
}
|
||||
}
|
||||
?></a> <a class="downloadAttach" href="<?php echo $url; ?>" target="_blank"
|
||||
title="<?php echo $access_attachment_title; ?>"><?php echo $download_verb;
|
||||
?></a><a class="downloadAttach" href="<?php echo $url; ?>" target="_blank"
|
||||
title="<?php echo $access_attachment_title; ?>"
|
||||
><?php echo JHtml::image('com_attachments/download.gif', $download_verb, null, true); ?></a>
|
||||
</td>
|
||||
<td class="at_description"><?php echo htmlspecialchars(stripslashes($item->description)); ?></td>
|
||||
<td class="at_access" align="center"><?php echo $access; ?></td>
|
||||
<?php if ( $params->get('user_field_1_name', '') != '' ): ?>
|
||||
<td class="at_user_field"><?php echo stripslashes($item->user_field_1); ?></td>
|
||||
<?php endif; ?>
|
||||
<?php if ( $params->get('user_field_2_name', '') != '' ): ?>
|
||||
<td class="at_user_field"><?php echo stripslashes($item->user_field_2); ?></td>
|
||||
<?php endif; ?>
|
||||
<?php if ( $params->get('user_field_3_name', '') != '' ): ?>
|
||||
<td class="at_user_field"><?php echo stripslashes($item->user_field_3); ?></td>
|
||||
<?php endif; ?>
|
||||
<td class="at_file_type"><?php echo $item->file_type; ?></td>
|
||||
<td class="at_file_size"><?php echo $size_kb; ?></td>
|
||||
<td class="at_creator_name"><?php echo $item->creator_name; ?></td>
|
||||
<td class="at_created_date"><?php echo $created; ?></td>
|
||||
<td class="at_mod_date"><?php echo $modified ?></td>
|
||||
<?php if ( $secure ): ?>
|
||||
<td class="at_downloads"><?php echo $item->download_count; ?></td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<?php
|
||||
$k = 1 - $k;
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Attachments component attachments view
|
||||
*
|
||||
* @package Attachments
|
||||
* @subpackage Attachments_Component
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
|
||||
* @link http://joomlacode.org/gf/project/attachments/frs/
|
||||
* @author Jonathan M. Cameron
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted Access');
|
||||
|
||||
$lists = $this->lists;
|
||||
|
||||
?>
|
||||
<div class="attachments_filter">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="100%">
|
||||
<label class="filter-search-lbl" 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')); ?>"
|
||||
class="text_area" onchange="this.form.submit();" />
|
||||
<button class="filter_button" onclick="this.form.submit();"><?php echo JText::_( 'JSEARCH_FILTER_SUBMIT' ); ?></button>
|
||||
<button class="filter_button" onclick="document.id('filter_search').value='';this.form.submit();">
|
||||
<?php echo JText::_( 'JSEARCH_FILTER_CLEAR' ); ?></button>
|
||||
<button class="filter_button" id="reset_order" onclick="Joomla.tableOrdering('','asc','');">
|
||||
<?php echo JText::_( 'ATTACH_RESET_ORDER' ); ?></button>
|
||||
</td>
|
||||
<td nowrap="nowrap">
|
||||
<?php echo JText::_('ATTACH_LIST_ATTACHMENTS_FOR_COLON') ?>
|
||||
<?php echo $lists['filter_parent_state_menu'] ?> <?php echo $lists['filter_entity_menu'] ?>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Attachments component attachments view
|
||||
*
|
||||
* @package Attachments
|
||||
* @subpackage Attachments_Component
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
|
||||
* @link http://joomlacode.org/gf/project/attachments/frs/
|
||||
* @author Jonathan M. Cameron
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted Access');
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="<?php echo $this->num_columns-3; ?>"><?php echo $this->pagination->getListFooter(); ?></td>
|
||||
<td colspan="3"><div id="componentVersion"><a target="_blank" title="<?php echo JText::_('ATTACH_ATTACHMENTS_PROJECT_URL_DESCRIPTION'); ?>" href="<?php echo $this->project_url ?>"><?php echo JText::sprintf('ATTACH_ATTACHMENTS_VERSION_S', $this->version); ?></a></div></td>
|
||||
</tr>
|
||||
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* Attachments component attachments view
|
||||
*
|
||||
* @package Attachments
|
||||
* @subpackage Attachments_Component
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
|
||||
* @link http://joomlacode.org/gf/project/attachments/frs/
|
||||
* @author Jonathan M. Cameron
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted Access');
|
||||
|
||||
// Set up a few convenience items
|
||||
$params = $this->params;
|
||||
$secure = $params->get('secure',false);
|
||||
$lists = $this->lists;
|
||||
$list_for_parents = $lists['list_for_parents'];
|
||||
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th class="at_checked hidden-phone">
|
||||
<input type="checkbox" name="checkall-toggle" value="" onclick="Joomla.checkAll(this)" />
|
||||
</th>
|
||||
<th class="at_published" width="5%" nowrap="nowrap"><?php echo JHtml::_('grid.sort', 'ATTACH_PUBLISHED',
|
||||
'a.state', $listDirn, $listOrder ) ?></th>
|
||||
<th class="at_filename"><?php echo JHtml::_('grid.sort', 'ATTACH_ATTACHMENT_FILENAME_URL',
|
||||
'a.filename', $listDirn, $listOrder ) ?></th>
|
||||
<th class="at_description"><?php echo JHtml::_('grid.sort', 'ATTACH_DESCRIPTION',
|
||||
'a.description', $listDirn, $listOrder ) ?></th>
|
||||
<th class="at_access" width="5%" nowrap="nowrap"><?php echo JHtml::_('grid.sort', 'JFIELD_ACCESS_LABEL',
|
||||
'a.access', $listDirn, $listOrder ) ?></th>
|
||||
<?php if ($params->get('user_field_1_name')): ?>
|
||||
<th class="at_user_field"><?php echo JHtml::_('grid.sort', $params->get('user_field_1_name', ''),
|
||||
'a.user_field_1', $listDirn, $listOrder ) ?></th>
|
||||
<?php endif; ?>
|
||||
<?php if ($params->get('user_field_2_name')): ?>
|
||||
<th class="at_user_field"><?php echo JHtml::_('grid.sort', $params->get('user_field_2_name', ''),
|
||||
'a.user_field_2', $listDirn, $listOrder ) ?></th>
|
||||
<?php endif; ?>
|
||||
<?php if ($params->get('user_field_3_name')): ?>
|
||||
<th class="at_user_field"><?php echo JHtml::_('grid.sort', $params->get('user_field_3_name', ''),
|
||||
'a.user_field_3', $listDirn, $listOrder ) ?></th>
|
||||
<?php endif; ?>
|
||||
<th class="at_file_type"><?php echo JHtml::_('grid.sort', 'ATTACH_FILE_TYPE',
|
||||
'a.file_type', $listDirn, $listOrder ) ?></th>
|
||||
<th class="at_file_size"><?php echo JHtml::_('grid.sort', 'ATTACH_FILE_SIZE_KB',
|
||||
'a.file_size', $listDirn, $listOrder ) ?></th>
|
||||
<th class="at_creator_name"><?php echo JHtml::_('grid.sort', 'ATTACH_CREATOR',
|
||||
'u1.name', $listDirn, $listOrder ) ?></th>
|
||||
<th class="at_created_date"><?php echo JHtml::_('grid.sort', 'JGLOBAL_CREATED',
|
||||
'a.created', $listDirn, $listOrder ) ?></th>
|
||||
<th class="at_mod_date"><?php echo JHtml::_('grid.sort', 'ATTACH_LAST_MODIFIED',
|
||||
'a.modified', $listDirn, $listOrder ) ?></th>
|
||||
<?php if ( $secure ): ?>
|
||||
<th class="at_downloads"><?php echo JHtml::_('grid.sort', 'ATTACH_DOWNLOADS',
|
||||
'a.download_count', $listDirn, $listOrder ) ?></th>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
|
||||
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,227 @@
|
||||
<?php
|
||||
/**
|
||||
* Attachments component
|
||||
*
|
||||
* @package Attachments
|
||||
* @subpackage Attachments_Component
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
|
||||
* @link http://joomlacode.org/gf/project/attachments/frs/
|
||||
* @author Jonathan M. Cameron
|
||||
*/
|
||||
|
||||
// Check to ensure this file is included in Joomla!
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
/** Define the legacy classes, if necessary */
|
||||
require_once(JPATH_SITE.'/components/com_attachments/legacy/view.php');
|
||||
|
||||
|
||||
/**
|
||||
* View for the special controller
|
||||
* (adapted from administrator/components/com_config/views/component/view.php)
|
||||
*
|
||||
* @package Attachments
|
||||
*/
|
||||
class AttachmentsViewAttachments extends JViewLegacy
|
||||
{
|
||||
protected $items;
|
||||
protected $pagination;
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* Display the list view
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// Fail gracefully if the Attachments plugin framework plugin is disabled
|
||||
if ( !JPluginHelper::isEnabled('attachments', 'attachments_plugin_framework') ) {
|
||||
echo '<h1>' . JText::_('ATTACH_WARNING_ATTACHMENTS_PLUGIN_FRAMEWORK_DISABLED') . '</h1>';
|
||||
return;
|
||||
}
|
||||
|
||||
$this->items = $this->get('Items');
|
||||
$this->state = $this->get('State');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors'))) {
|
||||
JError::raiseError(500, implode("\n", $errors) . ' (ERR 175)');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the params
|
||||
jimport('joomla.application.component.helper');
|
||||
$params = JComponentHelper::getParams('com_attachments');
|
||||
$this->params = $params;
|
||||
|
||||
// Get the access level names for the display
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('*')->from('#__viewlevels');
|
||||
$db->setQuery($query);
|
||||
$levels = $db->loadObjectList();
|
||||
if ( $db->getErrorNum() ) {
|
||||
$errmsg = $db->stderr() . ' (ERR 176)';
|
||||
JError::raiseError(500, $errmsg);
|
||||
}
|
||||
$level_name = Array();
|
||||
foreach ($levels as $level) {
|
||||
// NOTE: We do not translate the access level title
|
||||
$level_name[$level->id] = $level->title;
|
||||
}
|
||||
$this->level_name = $level_name;
|
||||
|
||||
// Construct the special HTML lists
|
||||
$lists = Array();
|
||||
|
||||
// Determine types of parents for which attachments should be displayed
|
||||
$list_for_parents_default = 'ALL';
|
||||
$suppress_obsolete_attachments = $params->get('suppress_obsolete_attachments', false);
|
||||
if ( $suppress_obsolete_attachments ) {
|
||||
$list_for_parents_default = 'PUBLISHED';
|
||||
}
|
||||
$app = JFactory::getApplication();
|
||||
$list_for_parents =
|
||||
$app->getUserStateFromRequest('com_attachments.listAttachments.list_for_parents',
|
||||
'list_for_parents', $list_for_parents_default, 'word');
|
||||
$lists['list_for_parents'] = JString::strtolower($list_for_parents);
|
||||
|
||||
// Add the drop-down menu to decide which attachments to show
|
||||
$filter_parent_state = $this->state->get('filter.parent_state', 'ALL');
|
||||
$filter_parent_state_options = array();
|
||||
$filter_parent_state_options[] = JHtml::_('select.option', 'ALL', JText::_( 'ATTACH_ALL_PARENTS' ) );
|
||||
$filter_parent_state_options[] = JHtml::_('select.option', 'PUBLISHED', JText::_( 'ATTACH_PUBLISHED_PARENTS' ) );
|
||||
$filter_parent_state_options[] = JHtml::_('select.option', 'UNPUBLISHED', JText::_( 'ATTACH_UNPUBLISHED_PARENTS' ) );
|
||||
$filter_parent_state_options[] = JHtml::_('select.option', 'ARCHIVED', JText::_( 'ATTACH_ARCHIVED_PARENTS' ) );
|
||||
$filter_parent_state_options[] = JHtml::_('select.option', 'TRASHED', JText::_( 'ATTACH_TRASHED_PARENTS' ) );
|
||||
$filter_parent_state_options[] = JHtml::_('select.option', 'NONE', JText::_( 'ATTACH_NO_PARENTS' ) );
|
||||
$filter_parent_state_tooltip = JText::_('ATTACH_SHOW_FOR_PARENTS_TOOLTIP');
|
||||
$lists['filter_parent_state_menu'] =
|
||||
JHtml::_('select.genericlist', $filter_parent_state_options, 'filter_parent_state',
|
||||
'class="inputbox" onChange="document.adminForm.submit();" title="' .
|
||||
$filter_parent_state_tooltip . '"', 'value', 'text', $filter_parent_state);
|
||||
$this->filter_parent_state = $filter_parent_state;
|
||||
|
||||
// Add the drop-down menu to filter for types of entities
|
||||
$filter_entity = $this->state->get('filter.entity', 'ALL');
|
||||
$filter_entity_options = array();
|
||||
$filter_entity_options[] = JHtml::_('select.option', 'ALL', JText::_( 'ATTACH_ALL_TYPES' ) );
|
||||
JPluginHelper::importPlugin('attachments');
|
||||
$apm = getAttachmentsPluginManager();
|
||||
$entity_info = $apm->getInstalledEntityInfo();
|
||||
foreach ($entity_info as $einfo) {
|
||||
$filter_entity_options[] = JHtml::_('select.option', $einfo['id'], $einfo['name_plural']);
|
||||
}
|
||||
$filter_entity_tooltip = JText::_('ATTACH_FILTER_ENTITY_TOOLTIP');
|
||||
$lists['filter_entity_menu'] =
|
||||
JHtml::_('select.genericlist', $filter_entity_options, 'filter_entity',
|
||||
'class="inputbox" onChange="this.form.submit();" ' .
|
||||
'title="'.$filter_entity_tooltip .'"', 'value', 'text', $filter_entity);
|
||||
|
||||
$this->lists = $lists;
|
||||
|
||||
// Figure out how many columns
|
||||
$num_columns = 10;
|
||||
if ( $params->get('user_field_1_name') ) {
|
||||
$num_columns++;
|
||||
}
|
||||
if ( $params->get('user_field_2_name') ) {
|
||||
$num_columns++;
|
||||
}
|
||||
if ( $params->get('user_field_3_name') ) {
|
||||
$num_columns++;
|
||||
}
|
||||
if ( $params->get('secure',false) ) {
|
||||
$num_columns++;
|
||||
}
|
||||
$this->num_columns = $num_columns;
|
||||
|
||||
// get the version number
|
||||
require_once(JPATH_SITE.'/components/com_attachments/defines.php');
|
||||
$this->version = AttachmentsDefines::$ATTACHMENTS_VERSION;
|
||||
$this->project_url = AttachmentsDefines::$PROJECT_URL;
|
||||
|
||||
// Add the style sheets
|
||||
JHtml::stylesheet('com_attachments/attachments_admin.css', Array(), true);
|
||||
$lang = JFactory::getLanguage();
|
||||
if ( $lang->isRTL() ) {
|
||||
JHtml::stylesheet('com_attachments/attachments_admin_rtl.css', Array(), true);
|
||||
}
|
||||
|
||||
// Set the toolbar
|
||||
$this->addToolBar();
|
||||
|
||||
// Display the attachments
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setting the toolbar
|
||||
*/
|
||||
protected function addToolBar()
|
||||
{
|
||||
require_once(JPATH_COMPONENT_ADMINISTRATOR.'/permissions.php');
|
||||
$canDo = AttachmentsPermissions::getActions();
|
||||
|
||||
$toolbar = JToolBar::getInstance('toolbar');
|
||||
|
||||
JToolBarHelper::title(JText::_('ATTACH_ATTACHMENTS'), 'attachments.png');
|
||||
|
||||
if ($canDo->get('core.create')) {
|
||||
JToolBarHelper::addNew('attachment.add');
|
||||
}
|
||||
|
||||
if ($canDo->get('core.edit') OR $canDo->get('core.edit.own') ) {
|
||||
JToolBarHelper::editList('attachment.edit');
|
||||
}
|
||||
|
||||
if ($canDo->get('core.edit.state') OR $canDo->get('attachments.edit.state.own')) {
|
||||
JToolBarHelper::divider();
|
||||
JToolBarHelper::publishList('attachments.publish');
|
||||
JToolBarHelper::unpublishList('attachments.unpublish');
|
||||
}
|
||||
|
||||
if ($canDo->get('core.delete') OR $canDo->get('attachments.delete.own')) {
|
||||
JToolBarHelper::divider();
|
||||
JToolBarHelper::deleteList('', 'attachments.delete');
|
||||
}
|
||||
|
||||
if ($canDo->get('core.admin')) {
|
||||
JToolBarHelper::divider();
|
||||
JToolBarHelper::custom('params.edit', 'options', 'options', 'JTOOLBAR_OPTIONS', false);
|
||||
|
||||
$icon_name = 'adminUtils';
|
||||
if (version_compare(JVERSION, '3.0', 'ge')) {
|
||||
$icon_name = 'wrench';
|
||||
}
|
||||
|
||||
// Add a button for extra admin commands
|
||||
$toolbar->appendButton('Popup', $icon_name, 'ATTACH_UTILITIES',
|
||||
'index.php?option=com_attachments&task=adminUtils&tmpl=component',
|
||||
800, 500);
|
||||
}
|
||||
|
||||
JToolBarHelper::divider();
|
||||
|
||||
// Manually add a help button for the help view
|
||||
$url = 'index.php?option=com_attachments&task=help&tmpl=component';
|
||||
$help = ' ' . JText::_('JTOOLBAR_HELP') . ' ';
|
||||
if (version_compare(JVERSION, '3.0', 'ge'))
|
||||
{
|
||||
$link = "<button class=\"btn btn-small\" rel=\"help\" href=\"#\" ";
|
||||
$link .= "onclick=\"Joomla.popupWindow('$url', 'Help', 800, 650, 1)\"> ";
|
||||
$link .= "<i class=\"icon-question-sign\"></i>$help</button>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$link = '<a class="toolbar" rel="help" href="#" ';
|
||||
$link .= "onclick=\"Joomla.popupWindow('$url', 'Help', 800, 650, 1)\"> ";
|
||||
$link .= "<span class=\"icon-32-help\"> </span>$help</a>";
|
||||
}
|
||||
$toolbar->appendButton('Custom', $link, 'toolbar-help');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user