- md5
- 258eec3cbba2147e6f735f24d2d22aba
- sha1
- 3dc673856fc60d82b5fc529e27359d27a19ce549
- sha256
- a55489acebbbe2f9a7f02e05307b833e1e2f6ac6284849148d9809c65175978a
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
<?php
/**
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
defined('_JEXEC') or die;
jimport('joomla.application.component.view');
/**
* HTML View class for the Media component
*
* @package Joomla.Administrator
* @subpackage com_media
* @since 1.0
*/
class MediaViewMedia extends JView
{
function display($tpl = null)
{
$app = JFactory::getApplication();
$config = JComponentHelper::getParams('com_media');
$lang = JFactory::getLanguage();
$style = $app->getUserStateFromRequest('media.list.layout', 'layout', 'thumbs', 'word');
$document = JFactory::getDocument();
$document->setBuffer($this->loadTemplate('navigation'), 'modules', 'submenu');
JHtml::_('behavior.framework', true);
JHtml::_('script', 'media/mediamanager.js', true, true);
JHtml::_('stylesheet', 'media/mediamanager.css', array(), true);
if ($lang->isRTL()) :
JHtml::_('stylesheet', 'media/mediamanager_rtl.css', array(), true);
endif;
JHtml::_('behavior.modal');
$document->addScriptDeclaration("
window.addEvent('domready', function() {
document.preview = SqueezeBox;
});");
JHtml::_('script', 'system/mootree.js', true, true, false, false);
JHtml::_('stylesheet', 'system/mootree.css', array(), true);
if ($lang->isRTL()) :
JHtml::_('stylesheet', 'media/mootree_rtl.css', array(), true);
endif;
if ($config->get('enable_flash', 1)) {
$fileTypes = $config->get('upload_extensions', 'bmp,gif,jpg,png,jpeg');
$types = explode(',', $fileTypes);
$displayTypes = ''; // this is what the user sees
$filterTypes = ''; // this is what controls the logic
$firstType = true;
foreach($types as $type) {
if(!$firstType) {
$displayTypes .= ', ';
$filterTypes .= '; ';
} else {
$firstType = false;
}
$displayTypes .= '*.'.$type;
$filterTypes .= '*.'.$type;
}
$typeString = '{ \''.JText::_('COM_MEDIA_FILES', 'true').' ('.$displayTypes.')\': \''.$filterTypes.'\' }';
JHtml::_('behavior.uploader', 'upload-flash',
array(
'onBeforeStart' => 'function(){ Uploader.setOptions({url: document.id(\'uploadForm\').action + \'&folder=\' + document.id(\'mediamanager-form\').folder.value}); }',
'onComplete' => 'function(){ MediaManager.refreshFrame(); }',
'targetURL' => '\\document.id(\'uploadForm\').action',
'typeFilter' => $typeString,
'fileSizeMax' => (int) ($config->get('upload_maxsize', 0) * 1024 * 1024),
)
);
}
if (DS == '\\')
{
$base = str_replace(DS, "\\\\", COM_MEDIA_BASE);
} else {
$base = COM_MEDIA_BASE;
}
$js = "
var basepath = '".$base."';
var viewstyle = '".$style."';
" ;
$document->addScriptDeclaration($js);
/*
* Display form for FTP credentials?
* Don't set them here, as there are other functions called before this one if there is any file write operation
*/
$ftp = !JClientHelper::hasCredentials('ftp');
$session = JFactory::getSession();
$state = $this->get('state');
$this->assignRef('session', $session);
$this->assignRef('config', $config);
$this->assignRef('state', $state);
$this->assign('require_ftp', $ftp);
$this->assign('folders_id', ' id="media-tree"');
$this->assign('folders', $this->get('folderTree'));
// Set the toolbar
$this->addToolbar();
parent::display($tpl);
echo JHtml::_('behavior.keepalive');
}
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
$user = JFactory::getUser();
// Set the titlebar text
JToolBarHelper::title(JText::_('COM_MEDIA'), 'mediamanager.png');
// Add a delete button
if ($user->authorise('core.delete', 'com_media'))
{
$title = JText::_('JTOOLBAR_DELETE');
$dhtml = "<a href=\"#\" onclick=\"MediaManager.submit('folder.delete')\" class=\"toolbar\">
<span class=\"icon-32-delete\" title=\"$title\"></span>
$title</a>";
$bar->appendButton('Custom', $dhtml, 'delete');
JToolBarHelper::divider();
}
// Add a delete button
if ($user->authorise('core.admin', 'com_media'))
{
JToolBarHelper::preferences('com_media', 450, 800, 'JToolbar_Options', '', 'window.location.reload()');
JToolBarHelper::divider();
}
JToolBarHelper::help('JHELP_CONTENT_MEDIA_MANAGER');
}
function getFolderLevel($folder)
{
$this->folders_id = null;
$txt = null;
if (isset($folder['children']) && count($folder['children'])) {
$tmp = $this->folders;
$this->folders = $folder;
$txt = $this->loadTemplate('folders');
$this->folders = $tmp;
}
return $txt;
}
}
The same content is in 5 releases, Joomla 2.5.0 to 2.5.4. See them all, or every version of this file.