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');
|
||||
}
|
||||
|
||||
}
|
||||
1
components/com_attachments/views/attachments/index.html
Normal file
1
components/com_attachments/views/attachments/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<metadata>
|
||||
<view title="ATTACH_ATTACHMENTS_DO_NOT_ATTACH_TO_MENU_ITEM" hidden="true">
|
||||
</view>
|
||||
</metadata>
|
||||
344
components/com_attachments/views/attachments/tmpl/default.php
Normal file
344
components/com_attachments/views/attachments/tmpl/default.php
Normal file
@ -0,0 +1,344 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
// No direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// Load the Attachments helper
|
||||
require_once(JPATH_SITE.'/components/com_attachments/helper.php'); /* ??? Needed? */
|
||||
require_once(JPATH_SITE.'/components/com_attachments/javascript.php');
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$logged_in = $user->get('username') <> '';
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$uri = JFactory::getURI();
|
||||
|
||||
// Set a few variables for convenience
|
||||
$attachments = $this->list;
|
||||
$parent_id = $this->parent_id;
|
||||
$parent_type = $this->parent_type;
|
||||
$parent_entity = $this->parent_entity;
|
||||
|
||||
$base_url = $this->base_url;
|
||||
|
||||
$format = JRequest::getWord('format', '');
|
||||
|
||||
$html = '';
|
||||
|
||||
if ( $format != 'raw' ) {
|
||||
|
||||
// If any attachments are modifiable, add necessary Javascript for iframe
|
||||
if ( $this->some_attachments_modifiable ) {
|
||||
AttachmentsJavascript::setupModalJavascript();
|
||||
}
|
||||
|
||||
// Construct the empty div for the attachments
|
||||
if ( $parent_id === null ) {
|
||||
// If there is no parent_id, the parent is being created, use the username instead
|
||||
$pid = $user->get('username');
|
||||
}
|
||||
else {
|
||||
$pid = $parent_id;
|
||||
}
|
||||
$div_id = 'attachmentsList' . '_' . $parent_type . '_' . $parent_entity . '_' . (string)$pid;
|
||||
$html .= "\n<div class=\"$this->style\" id=\"$div_id\">\n";
|
||||
}
|
||||
|
||||
$html .= "<table>\n";
|
||||
$html .= "<caption>{$this->title}</caption>\n";
|
||||
|
||||
// Add the column titles, if requested
|
||||
if ( $this->show_column_titles ) {
|
||||
$html .= "<thead>\n<tr>";
|
||||
$html .= "<th class=\"at_filename\">" . $this->file_url_title . "</th>";
|
||||
if ( $this->show_description ) {
|
||||
$html .= "<th class=\"at_description\">" . JText::_('ATTACH_DESCRIPTION') . "</th>";
|
||||
}
|
||||
if ( $this->show_user_field_1 ) {
|
||||
$html .= "<th class=\"at_user_field\">" . $this->user_field_1_name . "</th>";
|
||||
}
|
||||
if ( $this->show_user_field_2 ) {
|
||||
$html .= "<th class=\"at_user_field\">" . $this->user_field_2_name . "</th>";
|
||||
}
|
||||
if ( $this->show_user_field_3 ) {
|
||||
$html .= "<th class=\"at_user_field\">" . $this->user_field_3_name . "</th>";
|
||||
}
|
||||
if ( $this->show_creator_name ) {
|
||||
$html .= "<th class=\"at_creator_name\">" . JText::_('ATTACH_CREATOR') . "</th>";
|
||||
}
|
||||
if ( $this->show_file_size ) {
|
||||
$html .= "<th class=\"at_file_size\">" . JText::_('ATTACH_FILE_SIZE') . "</th>";
|
||||
}
|
||||
if ( $this->secure && $this->show_downloads ) {
|
||||
$html .= "<th class=\"at_downloads\">" . JText::_('ATTACH_DOWNLOADS') . "</th>";
|
||||
}
|
||||
if ( $this->show_created_date ) {
|
||||
$html .= "<th class=\"at_created_date\">" . JText::_('ATTACH_CREATED') . "</th>";
|
||||
}
|
||||
if ( $this->show_modified_date ) {
|
||||
$html .= "<th class=\"at_mod_date\">" . JText::_('ATTACH_LAST_MODIFIED') . "</th>";
|
||||
}
|
||||
if ( $this->some_attachments_modifiable && $this->allow_edit ) {
|
||||
$html .= "<th class=\"at_edit\"> </th>";
|
||||
}
|
||||
$html .= "</tr>\n</thead>\n";
|
||||
}
|
||||
|
||||
$html .= "<tbody>\n";
|
||||
|
||||
// Construct the lines for the attachments
|
||||
$row_num = 0;
|
||||
for ($i=0, $n=count($attachments); $i < $n; $i++) {
|
||||
$attachment = $attachments[$i];
|
||||
|
||||
$row_num++;
|
||||
if ( $row_num & 1 == 1) {
|
||||
$row_class = 'odd';
|
||||
}
|
||||
else {
|
||||
$row_class = 'even';
|
||||
}
|
||||
|
||||
if ($attachment->state != 1) {
|
||||
$row_class = 'unpublished';
|
||||
}
|
||||
|
||||
$html .= '<tr class="'.$row_class.'">';
|
||||
|
||||
// Construct some display items
|
||||
if ( JString::strlen($attachment->icon_filename) > 0 )
|
||||
$icon = $attachment->icon_filename;
|
||||
else
|
||||
$icon = 'generic.gif';
|
||||
|
||||
if ( $this->show_file_size) {
|
||||
$file_size = (int)( $attachment->file_size / 1024.0 );
|
||||
if ( $file_size == 0 ) {
|
||||
// For files less than 1kB, show the fractional amount (in 1/10 kB)
|
||||
$file_size = ( (int)( 10.0 * $attachment->file_size / 1024.0 ) / 10.0 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $this->show_created_date OR $this->show_modified_date ) {
|
||||
jimport( 'joomla.utilities.date' );
|
||||
$tz = new DateTimeZone( $user->getParam('timezone', $app->getCfg('offset')) );
|
||||
}
|
||||
|
||||
if ( $this->show_created_date ) {
|
||||
$date = JFactory::getDate($attachment->created);
|
||||
$date->setTimezone($tz);
|
||||
$created = $date->format($this->date_format, true);
|
||||
}
|
||||
|
||||
if ( $this->show_modified_date ) {
|
||||
$date = JFactory::getDate($attachment->modified);
|
||||
$date->setTimezone($tz);
|
||||
$last_modified = $date->format($this->date_format, true);
|
||||
}
|
||||
|
||||
// Add the filename
|
||||
$target = '';
|
||||
if ( $this->file_link_open_mode == 'new_window')
|
||||
$target = ' target="_blank"';
|
||||
$html .= '<td class="at_filename">';
|
||||
if ( JString::strlen($attachment->display_name) == 0 )
|
||||
$filename = $attachment->filename;
|
||||
else
|
||||
$filename = htmlspecialchars(stripslashes($attachment->display_name));
|
||||
$actual_filename = $attachment->filename;
|
||||
// Uncomment the following two lines to replace '.pdf' with its HTML-encoded equivalent
|
||||
// $actual_filename = JString::str_ireplace('.pdf', '.pdf', $actual_filename);
|
||||
// $filename = JString::str_ireplace('.pdf', '.pdf', $filename);
|
||||
|
||||
if ( $this->show_file_links ) {
|
||||
if ( $attachment->uri_type == 'file' ) {
|
||||
// Handle file attachments
|
||||
if ( $this->secure ) {
|
||||
$url = JRoute::_($base_url . "index.php?option=com_attachments&task=download&id=" . (int)$attachment->id);
|
||||
}
|
||||
else {
|
||||
$url = $base_url . $attachment->url;
|
||||
if (strtoupper(substr(PHP_OS,0,3) == 'WIN')) {
|
||||
$url = utf8_encode($url);
|
||||
}
|
||||
}
|
||||
$tooltip = JText::sprintf('ATTACH_DOWNLOAD_THIS_FILE_S', $actual_filename);
|
||||
}
|
||||
else {
|
||||
// Handle URL "attachments"
|
||||
if ( $this->secure ) {
|
||||
$url = JRoute::_($base_url . "index.php?option=com_attachments&task=download&id=" . (int)$attachment->id);
|
||||
$tooltip = JText::sprintf('ATTACH_ACCESS_THIS_URL_S', $filename);
|
||||
}
|
||||
else {
|
||||
// Handle the link url if not logged in but link displayed for guests
|
||||
$url = '';
|
||||
if ( !$logged_in AND ($attachment->access != '1')) {
|
||||
$guest_levels = $this->params->get('show_guest_access_levels', Array('1'));
|
||||
if ( in_array($attachment->access, $guest_levels) ) {
|
||||
$app = JFactory::getApplication();
|
||||
$return = $app->getUserState('com_attachments.current_url', '');
|
||||
$url = JRoute::_($base_url . 'index.php?option=com_attachments&task=requestLogin' . $return);
|
||||
$target = '';
|
||||
}
|
||||
}
|
||||
if ( $url == '' ) {
|
||||
$url = $attachment->url;
|
||||
}
|
||||
$tooltip = JText::sprintf('ATTACH_ACCESS_THIS_URL_S', $attachment->url);
|
||||
}
|
||||
}
|
||||
$html .= "<a class=\"at_icon\" href=\"$url\"$target title=\"$tooltip\">";
|
||||
$html .= JHtml::image('com_attachments/file_icons/'.$icon, $tooltip, null, true);
|
||||
if ( ($attachment->uri_type == 'url') && $this->superimpose_link_icons ) {
|
||||
if ( $attachment->url_valid ) {
|
||||
$html .= JHtml::image('com_attachments/file_icons/link_arrow.png', '', 'class="link_overlay"', true);
|
||||
}
|
||||
else {
|
||||
$html .= JHtml::image('com_attachments/file_icons/link_broken.png', '', 'class="link_overlay"', true);
|
||||
}
|
||||
}
|
||||
$html .= "</a>";
|
||||
$html .= "<a class=\"at_url\" href=\"$url\"$target title=\"$tooltip\">$filename</a>";
|
||||
}
|
||||
else {
|
||||
$tooltip = JText::sprintf('ATTACH_DOWNLOAD_THIS_FILE_S', $actual_filename);
|
||||
$html .= JHtml::image('com_attachments/file_icons/'.$icon, $tooltip, null, true);
|
||||
$html .= ' ' . $filename;
|
||||
}
|
||||
$html .= "</td>";
|
||||
|
||||
// Add description (maybe)
|
||||
if ( $this->show_description ) {
|
||||
$description = htmlspecialchars(stripslashes($attachment->description));
|
||||
if ( JString::strlen($description) == 0)
|
||||
$description = ' ';
|
||||
if ( $this->show_column_titles )
|
||||
$html .= "<td class=\"at_description\">$description</td>";
|
||||
else
|
||||
$html .= "<td class=\"at_description\">[$description]</td>";
|
||||
}
|
||||
|
||||
// Show the USER DEFINED FIELDs (maybe)
|
||||
if ( $this->show_user_field_1 ) {
|
||||
$user_field = stripslashes($attachment->user_field_1);
|
||||
if ( JString::strlen($user_field) == 0 )
|
||||
$user_field = ' ';
|
||||
if ( $this->show_column_titles )
|
||||
$html .= "<td class=\"at_user_field\">" . $user_field . "</td>";
|
||||
else
|
||||
$html .= "<td class=\"at_user_field\">[" . $user_field . "]</td>";
|
||||
}
|
||||
if ( $this->show_user_field_2 ) {
|
||||
$user_field = stripslashes($attachment->user_field_2);
|
||||
if ( JString::strlen($user_field) == 0 )
|
||||
$user_field = ' ';
|
||||
if ( $this->show_column_titles )
|
||||
$html .= "<td class=\"at_user_field\">" . $user_field . "</td>";
|
||||
else
|
||||
$html .= "<td class=\"at_user_field\">[" . $user_field . "]</td>";
|
||||
}
|
||||
if ( $this->show_user_field_3 ) {
|
||||
$user_field = stripslashes($attachment->user_field_3);
|
||||
if ( JString::strlen($user_field) == 0 )
|
||||
$user_field = ' ';
|
||||
if ( $this->show_column_titles )
|
||||
$html .= "<td class=\"at_user_field\">" . $user_field . "</td>";
|
||||
else
|
||||
$html .= "<td class=\"at_user_field\">[" . $user_field . "]</td>";
|
||||
}
|
||||
|
||||
// Add the creator's username (if requested)
|
||||
if ( $this->show_creator_name ) {
|
||||
$html .= "<td class=\"at_creator_name\">{$attachment->creator_name}</td>";
|
||||
}
|
||||
|
||||
// Add file size (maybe)
|
||||
if ( $this->show_file_size ) {
|
||||
$file_size_str = JText::sprintf('ATTACH_S_KB', $file_size);
|
||||
if ( $file_size_str == 'ATTACH_S_KB' ) {
|
||||
// Work around until all translations are updated ???
|
||||
$file_size_str = $file_size . ' kB';
|
||||
}
|
||||
$html .= '<td class="at_file_size">' . $file_size_str . '</td>';
|
||||
}
|
||||
|
||||
// Show number of downloads (maybe)
|
||||
if ( $this->secure && $this->show_downloads ) {
|
||||
$num_downloads = (int)$attachment->download_count;
|
||||
$label = '';
|
||||
if ( ! $this->show_column_titles ) {
|
||||
if ( $num_downloads == 1 )
|
||||
$label = ' ' . JText::_('ATTACH_DOWNLOAD_NOUN');
|
||||
else
|
||||
$label = ' ' . JText::_('ATTACH_DOWNLOADS');
|
||||
}
|
||||
$html .= '<td class="at_downloads">'. $num_downloads.$label.'</td>';
|
||||
}
|
||||
|
||||
// Add the created and modification date (maybe)
|
||||
if ( $this->show_created_date ) {
|
||||
$html .= "<td class=\"at_created_date\">$created</td>";
|
||||
}
|
||||
if ( $this->show_modified_date ) {
|
||||
$html .= "<td class=\"at_mod_date\">$last_modified</td>";
|
||||
}
|
||||
|
||||
$update_link = '';
|
||||
$delete_link = '';
|
||||
|
||||
$a_class = 'modal-button';
|
||||
if ( $app->isAdmin() ) {
|
||||
$a_class = 'modal';
|
||||
}
|
||||
|
||||
// Add the link to edit the attachment, if requested
|
||||
if ( $this->some_attachments_modifiable && $attachment->user_may_edit && $this->allow_edit ) {
|
||||
|
||||
// Create the edit link
|
||||
$update_url = str_replace('%d', (string)$attachment->id, $this->update_url);
|
||||
$tooltip = JText::_('ATTACH_UPDATE_THIS_FILE') . ' (' . $actual_filename . ')';
|
||||
$update_link = "<a class=\"$a_class\" type=\"button\" href=\"$update_url\"";
|
||||
$update_link .= " rel=\"{handler: 'iframe', size: {x: 920, y: 600}}\" title=\"$tooltip\">";
|
||||
$update_link .= JHtml::image('com_attachments/pencil.gif', $tooltip, null, true);
|
||||
$update_link .= "</a>";
|
||||
}
|
||||
|
||||
// Add the link to delete the attachment, if requested
|
||||
if ( $this->some_attachments_modifiable && $attachment->user_may_delete && $this->allow_edit ) {
|
||||
|
||||
// Create the delete link
|
||||
$delete_url = str_replace('%d', (string)$attachment->id, $this->delete_url);
|
||||
$tooltip = JText::_('ATTACH_DELETE_THIS_FILE') . ' (' . $actual_filename . ')';
|
||||
$delete_link = "<a class=\"$a_class\" type=\"button\" href=\"$delete_url\"";
|
||||
$delete_link .= " rel=\"{handler: 'iframe', size: {x: 600, y: 400}, iframeOptions: {scrolling: 'no'}}\" title=\"$tooltip\">";
|
||||
$delete_link .= JHtml::image('com_attachments/delete.gif', $tooltip, null, true);
|
||||
$delete_link .= "</a>";
|
||||
}
|
||||
|
||||
if ( $this->some_attachments_modifiable && $this->allow_edit ) {
|
||||
$html .= "<td class=\"at_edit\">$update_link $delete_link</td>";
|
||||
}
|
||||
|
||||
$html .= "</tr>\n";
|
||||
}
|
||||
|
||||
// Close the HTML
|
||||
$html .= "</tbody></table>\n";
|
||||
|
||||
if ( $format != 'raw' ) {
|
||||
$html .= "</div>\n";
|
||||
}
|
||||
|
||||
echo $html;
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="ATTACH_ATTACHMENTS_DEFAULT_LAYOUT_DO_NOT_ATTACH_TO_MENU_ITEM" hidden="true">
|
||||
</layout>
|
||||
</metadata>
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
230
components/com_attachments/views/attachments/view.html.php
Normal file
230
components/com_attachments/views/attachments/view.html.php
Normal file
@ -0,0 +1,230 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
// No direct access
|
||||
defined('_JEXEC') or die('Restricted Access');
|
||||
|
||||
/** Load the Attachments helper */
|
||||
require_once(JPATH_SITE.'/components/com_attachments/helper.php'); /* ??? Needed? */
|
||||
require_once(JPATH_SITE.'/components/com_attachments/javascript.php');
|
||||
|
||||
/** Define the legacy classes, if necessary */
|
||||
require_once(JPATH_SITE.'/components/com_attachments/legacy/view.php');
|
||||
|
||||
|
||||
/**
|
||||
* View for a list of attachments
|
||||
*
|
||||
* @package Attachments
|
||||
*/
|
||||
class AttachmentsViewAttachments extends JViewLegacy
|
||||
{
|
||||
/**
|
||||
* Construct the output for the view/template.
|
||||
*
|
||||
* NOTE: This only constructs the output; it does not display it!
|
||||
* Use getOutput() to actually display it.
|
||||
*
|
||||
* @param string $tpl template name (optional)
|
||||
*
|
||||
* @return if there are no attachments for this article,
|
||||
* if everything is okay, return true
|
||||
* if there is an error, return the error code
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
jimport('joomla.application.component.helper');
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
if ( JRequest::getWord('format', '') == 'raw' ) {
|
||||
// Choose raw text even though it is actually html
|
||||
$document->setMimeEncoding('text/plain');
|
||||
}
|
||||
|
||||
// Add javascript
|
||||
$uri = JFactory::getURI();
|
||||
AttachmentsJavascript::setupJavascript();
|
||||
|
||||
// Get the model
|
||||
$model = $this->getModel('Attachments');
|
||||
if ( !$model ) {
|
||||
$errmsg = JText::_('ATTACH_ERROR_UNABLE_TO_FIND_MODEL') . ' (ERR 63)';
|
||||
JError::raiseError( 500, $errmsg);
|
||||
}
|
||||
|
||||
// See if there are any attachments
|
||||
$list = $model->getAttachmentsList();
|
||||
if ( ! $list ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// if we have attachments, add the stylesheets for the attachments list
|
||||
JHtml::stylesheet('com_attachments/attachments_list.css', array(), true);
|
||||
$lang = JFactory::getLanguage();
|
||||
if ( $lang->isRTL() ) {
|
||||
JHtml::stylesheet('com_attachments/attachments_list_rtl.css', array(), true);
|
||||
}
|
||||
|
||||
// Add the default path
|
||||
$this->addTemplatePath(JPATH_SITE.'/components/com_attachments/views/attachments/tmpl');
|
||||
|
||||
// Set up the correct path for template overloads
|
||||
// (Do this after previous addTemplatePath so that template overrides actually override)
|
||||
$app = JFactory::getApplication();
|
||||
$templateDir = JPATH_SITE.'/templates/'.$app->getTemplate().'/html/com_attachments/attachments';
|
||||
$this->addTemplatePath($templateDir);
|
||||
|
||||
// Load the language files from the attachments plugin
|
||||
$lang = JFactory::getLanguage();
|
||||
$lang->load('plg_content_attachments', JPATH_SITE.'/plugins/content/attachments');
|
||||
|
||||
// Get the component parameters
|
||||
$params = JComponentHelper::getParams('com_attachments');
|
||||
|
||||
// See whether the user-defined fields should be shown
|
||||
$from = JRequest::getWord('from', 'closeme');
|
||||
$layout = JRequest::getWord('layout');
|
||||
$tmpl = JRequest::getWord('tmpl');
|
||||
$task = JRequest::getWord('task');
|
||||
$show_hidden_user_fields = false;
|
||||
if ( $app->isAdmin() || ($from == 'editor') || ($layout == 'edit') || ($tmpl == 'component') ) {
|
||||
$show_hidden_user_fields = true;
|
||||
}
|
||||
if ( $task == 'attachmentsList' ) {
|
||||
// Always hide the hidden user fields on Ajax requests
|
||||
$show_hidden_user_fields = false;
|
||||
}
|
||||
|
||||
// User field 1
|
||||
$show_user_field_1 = false;
|
||||
$user_field_1_name = $params->get('user_field_1_name');
|
||||
if ( $user_field_1_name ) {
|
||||
if ( $show_hidden_user_fields || ($user_field_1_name[JString::strlen($user_field_1_name)-1] != '*') ) {
|
||||
$show_user_field_1 = true;
|
||||
$this->user_field_1_name = $user_field_1_name;
|
||||
}
|
||||
}
|
||||
$this->show_user_field_1 = $show_user_field_1;
|
||||
|
||||
// User field 2
|
||||
$show_user_field_2 = false;
|
||||
$user_field_2_name = $params->get('user_field_2_name');
|
||||
if ( $user_field_2_name ) {
|
||||
if ( $show_hidden_user_fields || ($user_field_2_name[JString::strlen($user_field_2_name)-1] != '*') ) {
|
||||
$show_user_field_2 = true;
|
||||
$this->user_field_2_name = $user_field_2_name;
|
||||
}
|
||||
}
|
||||
$this->show_user_field_2 = $show_user_field_2;
|
||||
|
||||
// User field 3
|
||||
$show_user_field_3 = false;
|
||||
$user_field_3_name = $params->get('user_field_3_name');
|
||||
if ( $user_field_3_name ) {
|
||||
if ( $show_hidden_user_fields || ($user_field_3_name[JString::strlen($user_field_3_name)-1] != '*') ) {
|
||||
$show_user_field_3 = true;
|
||||
$this->user_field_3_name = $user_field_3_name;
|
||||
}
|
||||
}
|
||||
$this->show_user_field_3 = $show_user_field_3;
|
||||
|
||||
// Set up for the template
|
||||
$parent_id = $model->getParentId();
|
||||
$parent_type = $model->getParentType();
|
||||
$parent_entity = JString::strtolower($model->getParentEntity());
|
||||
// ?? fix this!
|
||||
if ( ($parent_type == 'com_content') && ($parent_entity == 'default') ) {
|
||||
$parent_entity = 'article';
|
||||
}
|
||||
$this->parent_id = $parent_id;
|
||||
$this->parent_type = $parent_type;
|
||||
$this->parent_entity = $parent_entity;
|
||||
$this->parent_title = $model->getParentTitle();
|
||||
$this->parent_entity_name = $model->getParentEntityName();
|
||||
|
||||
$this->some_attachments_visible = $model->someVisible();
|
||||
$this->some_attachments_modifiable = $model->someModifiable();
|
||||
|
||||
$this->from = $from;
|
||||
|
||||
$this->list = $list;
|
||||
|
||||
$this->secure = $params->get('secure', false);
|
||||
|
||||
$this->params = $params;
|
||||
|
||||
// Get the display options
|
||||
$this->superimpose_link_icons = $params->get('superimpose_url_link_icons', true);
|
||||
$this->style = $params->get('attachments_table_style', 'attachmentsList');
|
||||
$this->show_column_titles = $params->get('show_column_titles', false);
|
||||
$this->show_description = $params->get('show_description', true);
|
||||
$this->show_creator_name = $params->get('show_creator_name', false);
|
||||
$this->show_file_size = $params->get('show_file_size', true);
|
||||
$this->show_downloads = $params->get('show_downloads', false);
|
||||
$this->show_created_date = $params->get('show_created_date', false);
|
||||
$this->show_modified_date = $params->get('show_modified_date', false);
|
||||
$this->file_link_open_mode = $params->get('file_link_open_mode', 'in_same_window');
|
||||
|
||||
// Set up the file/url titleshow_mod_date
|
||||
if ( $this->show_column_titles ) {
|
||||
switch ( $model->types() ) {
|
||||
case 'file':
|
||||
$this->file_url_title = JText::_('ATTACH_FILE');
|
||||
break;
|
||||
case 'url':
|
||||
$this->file_url_title = JText::_('ATTACH_URL');
|
||||
break;
|
||||
default:
|
||||
$this->file_url_title = JText::_('ATTACH_FILE_URL');
|
||||
}
|
||||
}
|
||||
|
||||
if ( $this->show_created_date OR $this->show_modified_date ) {
|
||||
$this->date_format = $params->get('date_format', '%Y-%m-%d %I:%M%P');
|
||||
}
|
||||
|
||||
// Get the attachments list title
|
||||
$title = $this->title;
|
||||
if ( !$title || (JString::strlen($title) == 0) ) {
|
||||
$title = 'ATTACH_ATTACHMENTS_TITLE';
|
||||
}
|
||||
$parent = $model->getParentClass();
|
||||
$title = $parent->attachmentsListTitle($title, $parent_id, $parent_entity);
|
||||
$this->title = $title; // Note: assume it is translated
|
||||
|
||||
// Construct the path for the icons
|
||||
$uri = JFactory::getURI();
|
||||
$base_url = $uri->root(false);
|
||||
$this->base_url = $base_url;
|
||||
$this->icon_url_base = $base_url . 'components/com_attachments/media/icons/';
|
||||
|
||||
// Get the output of the template
|
||||
$result = $this->loadTemplate($tpl);
|
||||
if (JError::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the output
|
||||
*
|
||||
* @return string the output
|
||||
*/
|
||||
public function getOutput()
|
||||
{
|
||||
return $this->_output;
|
||||
}
|
||||
|
||||
}
|
||||
18
components/com_attachments/views/attachments/view.raw.php
Normal file
18
components/com_attachments/views/attachments/view.raw.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
// No direct access
|
||||
defined('_JEXEC') or die('Restricted Access');
|
||||
|
||||
/** The normal html view does exactly what we want so just use it */
|
||||
require_once(JPATH_COMPONENT_SITE.'/views/attachments/view.html.php');
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
media/com_jem/attachments/event754/venier_197239537.pdf
Normal file
BIN
media/com_jem/attachments/event754/venier_197239537.pdf
Normal file
Binary file not shown.
BIN
media/com_jem/attachments/event756/trabucco_587326203.pdf
Normal file
BIN
media/com_jem/attachments/event756/trabucco_587326203.pdf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
media/com_jem/attachments/event780/udine_237204193.pdf
Normal file
BIN
media/com_jem/attachments/event780/udine_237204193.pdf
Normal file
Binary file not shown.
Binary file not shown.
BIN
media/com_jem/attachments/event781/udine_1190186257.pdf
Normal file
BIN
media/com_jem/attachments/event781/udine_1190186257.pdf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
media/com_jem/attachments/event786/sacile_1367568857.pdf
Normal file
BIN
media/com_jem/attachments/event786/sacile_1367568857.pdf
Normal file
Binary file not shown.
Binary file not shown.
BIN
media/com_jem/attachments/event799/locandina_685455846.jpg
Normal file
BIN
media/com_jem/attachments/event799/locandina_685455846.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 155 KiB |
Binary file not shown.
BIN
media/com_jem/attachments/event800/locandina_1786987919.jpg
Normal file
BIN
media/com_jem/attachments/event800/locandina_1786987919.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 155 KiB |
Binary file not shown.
Binary file not shown.
BIN
media/com_jem/attachments/event806/tricesimo_2018_331130386.pdf
Normal file
BIN
media/com_jem/attachments/event806/tricesimo_2018_331130386.pdf
Normal file
Binary file not shown.
Binary file not shown.
BIN
media/com_jem/attachments/event807/tricesimo_2018_2112949670.pdf
Normal file
BIN
media/com_jem/attachments/event807/tricesimo_2018_2112949670.pdf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
media/com_jem/attachments/event828/workshop_-_web_984729771.pdf
Normal file
BIN
media/com_jem/attachments/event828/workshop_-_web_984729771.pdf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
media/com_jem/attachments/event836/locandina_1939538428.pdf
Normal file
BIN
media/com_jem/attachments/event836/locandina_1939538428.pdf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
media/com_jem/attachments/event840/locandina_a3_2102923435.pdf
Normal file
BIN
media/com_jem/attachments/event840/locandina_a3_2102923435.pdf
Normal file
Binary file not shown.
BIN
media/com_jem/attachments/event841/locandina_a3_1523226242.pdf
Normal file
BIN
media/com_jem/attachments/event841/locandina_a3_1523226242.pdf
Normal file
Binary file not shown.
BIN
media/com_jem/attachments/event842/locandina_a3_1429330020.pdf
Normal file
BIN
media/com_jem/attachments/event842/locandina_a3_1429330020.pdf
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user