Drop use of serendipity_admin_image_selector.php
Enhance admin/images.inc.tpl instead. Gets rid of the fieldset-construct (#30)
This commit is contained in:
parent
f744ef7464
commit
731b044d50
include
templates/2k11/admin
@ -639,13 +639,40 @@ switch ($serendipity['GET']['adminAction']) {
|
||||
$data['file'] = $serendipity['uploadHTTPPath'] . $file['path'] . $file['name'] .'.'. $file['extension'];
|
||||
break;
|
||||
|
||||
case 'choose':
|
||||
$media['case'] = 'choose';
|
||||
|
||||
$file = serendipity_fetchImageFromDatabase($serendipity['GET']['fid']);
|
||||
$media['file'] = &$file;
|
||||
if (!is_array($file)) {
|
||||
$media['perm_denied'] = true;
|
||||
break;
|
||||
}
|
||||
|
||||
serendipity_prepareMedia($file);
|
||||
|
||||
$media['file']['props'] =& serendipity_fetchMediaProperties((int)$serendipity['GET']['fid']);
|
||||
serendipity_plugin_api::hook_event('media_getproperties_cached', $media['file']['props']['base_metadata'], $media['file']['realfile']);
|
||||
|
||||
if ($file['is_image']) {
|
||||
$file['finishJSFunction'] = $file['origfinishJSFunction'] = 'serendipity.serendipity_imageSelector_done(\'' . htmlspecialchars($serendipity['GET']['textarea']) . '\')';
|
||||
|
||||
if (!empty($serendipity['GET']['filename_only']) && $serendipity['GET']['filename_only'] !== 'true') {
|
||||
$file['fast_select'] = true;
|
||||
}
|
||||
}
|
||||
$media = array_merge($serendipity['GET'], $media);
|
||||
$serendipity['smarty']->assignByRef('media', $media);
|
||||
echo serendipity_smarty_show('admin/media_choose.tpl', $data);
|
||||
return;
|
||||
|
||||
default:
|
||||
$data['case_default'] = true;
|
||||
$data['showML_def'] = showMediaLibrary();
|
||||
break;
|
||||
}
|
||||
|
||||
function showMediaLibrary($messages=false, $addvar_check = false) {
|
||||
function showMediaLibrary($messages=false, $addvar_check = false, $smarty_vars = array()) {
|
||||
global $serendipity;
|
||||
|
||||
if (!serendipity_checkPermission('adminImagesView')) {
|
||||
@ -669,11 +696,20 @@ function showMediaLibrary($messages=false, $addvar_check = false) {
|
||||
if (!isset($serendipity['thumbPerPage'])) {
|
||||
$serendipity['thumbPerPage'] = 2;
|
||||
}
|
||||
|
||||
$smarty_vars = array(
|
||||
'textarea' => isset($serendipity['GET']['textarea']) ? $serendipity['GET']['textarea'] : false,
|
||||
'htmltarget' => isset($serendipity['GET']['htmltarget']) ? $serendipity['GET']['htmltarget'] : '',
|
||||
'filename_only' => isset($serendipity['GET']['filename_only']) ? $serendipity['GET']['filename_only'] : false,
|
||||
);
|
||||
|
||||
$output .= serendipity_displayImageList(
|
||||
isset($serendipity['GET']['page']) ? $serendipity['GET']['page'] : 1,
|
||||
$serendipity['thumbPerPage'],
|
||||
true
|
||||
isset($serendipity['GET']['showMediaToolbar']) ? serendipity_db_bool($serendipity['GET']['showMediaToolbar']) : true,
|
||||
NULL,
|
||||
false,
|
||||
NULL,
|
||||
$smarty_vars
|
||||
);
|
||||
return $output;
|
||||
}
|
||||
|
@ -1436,9 +1436,10 @@ function serendipity_calculate_aspect_size($width, $height, $size, $constraint =
|
||||
* @param string The URL to use for pagination
|
||||
* @param boolean Show the "upload media item" feature?
|
||||
* @param boolean Restrict viewing images to a specific directory
|
||||
* @param array Map of smarty vars transported into all following templates
|
||||
* @return string Generated HTML
|
||||
*/
|
||||
function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = false, $url = NULL, $show_upload = false, $limit_path = NULL) {
|
||||
function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = false, $url = NULL, $show_upload = false, $limit_path = NULL, $smarty_vars = array()) {
|
||||
global $serendipity;
|
||||
static $debug = false;
|
||||
|
||||
@ -1648,7 +1649,7 @@ function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = fa
|
||||
}
|
||||
}
|
||||
|
||||
$smarty_vars = array(
|
||||
$smarty_vars = array_merge($smarty_vars, array(
|
||||
'limit_path' => $limit_path,
|
||||
'perPage' => $perPage,
|
||||
'show_upload' => $show_upload,
|
||||
@ -1657,8 +1658,8 @@ function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = fa
|
||||
'linkNext' => $linkNext,
|
||||
'linkPrevious' => $linkPrevious,
|
||||
'extraParems' => $extraParems,
|
||||
'totalImages' => $totalImages
|
||||
);
|
||||
'totalImages' => $totalImages,
|
||||
));
|
||||
return serendipity_showMedia(
|
||||
$serendipity['imageList'],
|
||||
$paths,
|
||||
|
@ -3,29 +3,46 @@
|
||||
<article class="media_wrap_thumb {cycle values="odd,even"}">
|
||||
<div class="media_file_thumb{if $media.enclose} equal_heights{/if}">
|
||||
{if $file.is_image AND $file.full_thumb}
|
||||
{if $file.url}
|
||||
<a href="{$file.url}&serendipity[image]={$file.id}">
|
||||
{if $media.textarea || $media.htmltarget}
|
||||
<a href="?serendipity[adminModule]=images&serendipity[adminAction]=choose&serendipity[fid]={$file.id}&serendipity[textarea]={$media.textarea}&serendipity[noBanner]=true&serendipity[noSidebar]=true&serendipity[noFooter]=true&serendipity[filename_only]={$media.filename_only}&serendipity[htmltarget]={$media.htmltarget}">
|
||||
{else}
|
||||
{if $file.url}
|
||||
<a href="{$file.url}&serendipity[image]={$file.id}">
|
||||
{/if}
|
||||
{/if}
|
||||
<img src="{$file.full_thumbHTTP}" title="{$file.path}{$file.name}" alt="{$file.realname}">
|
||||
{if $file.url}
|
||||
</a>
|
||||
|
||||
<img src="{$file.full_thumbHTTP}" title="{$file.path}{$file.name}" alt="{$file.realname}">
|
||||
|
||||
{if $media.textarea || $file.url}
|
||||
</a>
|
||||
{/if}
|
||||
{elseif $file.is_image AND $file.hotlink}
|
||||
{if $file.url}
|
||||
<a href="{$file.$url}&serendipity[image]={$file.id}">
|
||||
{if $media.textarea}
|
||||
<a href="?serendipity[adminModule]=images&serendipity[adminAction]=choose&serendipity[fid]={$file.id}&serendipity[textarea]={$media.textarea}&serendipity[noBanner]=true&serendipity[noSidebar]=true&serendipity[noFooter]=true&serendipity[filename_only]={$media.filename_only}&serendipity[htmltarget]={$media.htmltarget}"">
|
||||
{else}
|
||||
{if $file.url}
|
||||
<a href="{$file.$url}&serendipity[image]={$file.id}">
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<img src="{$file.path}" width="{$file.thumbWidth}" height="{$file.thumbHeight}" title="{$file.path}" alt="{$file.realname}">
|
||||
{if $file.url}
|
||||
</a>
|
||||
{if $media.textarea || $file.url}
|
||||
</a>
|
||||
{/if}
|
||||
{else}
|
||||
{if $file.url}
|
||||
<a href="{$file.$url}&serendipity[image]={$file.id}">
|
||||
{if $media.textarea}
|
||||
<a href="?serendipity[adminModule]=images&serendipity[adminAction]=choose&serendipity[fid]={$file.id}&serendipity[textarea]={$media.textarea}&serendipity[noBanner]=true&serendipity[noSidebar]=true&serendipity[noFooter]=true&serendipity[filename_only]={$media.filename_only}&serendipity[htmltarget]={$media.htmltarget}"">
|
||||
{else}
|
||||
{if $file.url}
|
||||
<a href="{$file.$url}&serendipity[image]={$file.id}">
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<img src="{$file.mimeicon}" title="{$file.path}{$file.name}({$file.mime})" alt="{$file.mime}">
|
||||
<span class="block_level">{if $file.hotlink}{$CONST.MEDIA_HOTLINKED}{else}{$file.mime}{/if}</span>
|
||||
{if $file.url}
|
||||
</a>
|
||||
|
||||
{if $media.textarea || $file.url}
|
||||
</a>
|
||||
{/if}
|
||||
{/if}
|
||||
{if $file.orderkey != ''}
|
||||
|
@ -566,6 +566,22 @@ window.log = function f(){ log.history = log.history || []; log.history.push(arg
|
||||
{/if}
|
||||
}
|
||||
|
||||
serendipity.openPopup = function(url) {
|
||||
{if $use_popups}
|
||||
window.open(url,
|
||||
'ImageSel',
|
||||
'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1');
|
||||
{else}
|
||||
$.magnificPopup.open({
|
||||
items: {
|
||||
src: url
|
||||
},
|
||||
type: 'iframe'
|
||||
});
|
||||
{/if}
|
||||
|
||||
};
|
||||
|
||||
}( window.serendipity = window.serendipity || {}, jQuery ));
|
||||
|
||||
// Source: https://github.com/yatil/accessifyhtml5.js
|
||||
@ -732,18 +748,7 @@ var AccessifyHTML5 = function (defaults, more_fixes) {
|
||||
});
|
||||
|
||||
$('.wrap_insmedia').click(function() {
|
||||
{if $use_popups}
|
||||
window.open('serendipity_admin_image_selector.php?serendipity[textarea]=' + $(this).attr('data-tarea'),
|
||||
'ImageSel',
|
||||
'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1');
|
||||
{else}
|
||||
$.magnificPopup.open({
|
||||
items: {
|
||||
src: 'serendipity_admin_image_selector.php?serendipity[textarea]=' + $(this).attr('data-tarea')
|
||||
},
|
||||
type: 'iframe'
|
||||
});
|
||||
{/if}
|
||||
serendipity.openPopup('serendipity_admin.php?serendipity[adminModule]=media&serendipity[noBanner]=true&serendipity[noSidebar]=true&serendipity[noFooter]=true&serendipity[showMediaToolbar]=false&serendipity[textarea]=' + $(this).attr('data-tarea'));
|
||||
});
|
||||
|
||||
// Entry preview
|
||||
@ -852,9 +857,9 @@ var AccessifyHTML5 = function (defaults, more_fixes) {
|
||||
}
|
||||
|
||||
$('#insert_image').click(function(e) {
|
||||
window.open('serendipity_admin_image_selector.php?serendipity[htmltarget]=category_icon&serendipity[filename_only]=true',
|
||||
'ImageSel',
|
||||
'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1');
|
||||
window.open('serendipity_admin.php?serendipity[adminModule]=media&serendipity[noBanner]=true&serendipity[noSidebar]=true&serendipity[noFooter]=true&serendipity[showMediaToolbar]=false&serendipity[htmltarget]=category_icon&serendipity[filename_only]=true',
|
||||
'ImageSel',
|
||||
'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1');
|
||||
});
|
||||
|
||||
$('#category_icon').change(function() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user