mirror of
https://github.com/avecms/AVE.cms.git
synced 2025-01-21 23:10:07 +00:00
Fixed images fields
This commit is contained in:
parent
e30344ca6f
commit
86519de6e7
@ -34,9 +34,12 @@ function browse_uploads(target, width, height, scrollbar) {
|
||||
if (typeof width == 'undefined' || width == '') var width = screen.width * 0.8;
|
||||
if (typeof height == 'undefined' || height == '') var height = screen.height * 0.8;
|
||||
if (typeof scrollbar == 'undefined') var scrollbar = 0;
|
||||
var targetVal = document.getElementById(target).value;
|
||||
var left = (screen.width - width) / 2;
|
||||
var top = (screen.height - height) / 2;
|
||||
let targetVal = document.getElementById(target).value;
|
||||
if ((document.getElementById(target).dataset.default).length) {
|
||||
targetVal = document.getElementById(target).dataset.default;
|
||||
}
|
||||
let left = (screen.width - width) / 2;
|
||||
let top = (screen.height - height) / 2;
|
||||
window.open('index.php?do=browser&type=image&target=' + target + '&tval=' + targetVal, 'imgpop', 'left=' + left + ',top=' + top + ',width=' + width + ',height=' + height + ',scrollbars=' + scrollbar + ',resizable=1');
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
{
|
||||
global $AVE_Template;
|
||||
|
||||
$fld_dir = dirname(__FILE__) . '/';
|
||||
$fld_dir = __DIR__ . '/';
|
||||
$tpl_dir = $fld_dir . 'tpl/';
|
||||
$fld_name = basename($fld_dir);
|
||||
|
||||
@ -36,10 +36,14 @@
|
||||
$img = $image[0];
|
||||
unset($image[0]);
|
||||
$image = array($img, implode('|', $image));
|
||||
$field = (!empty($image[0]) ? '../' . make_thumbnail(array('link' => $image[0], 'size' => 'f128x128')) : make_thumbnail(array('link' => $blanc, 'size' => 'f128x128')));
|
||||
$field = (! empty($image[0])
|
||||
? make_thumbnail(array('link' => $image[0], 'size' => 't128x128'))
|
||||
: make_thumbnail(array('link' => $blanc, 'size' => 't128x128'))
|
||||
);
|
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);
|
||||
|
||||
$AVE_Template->assign('default', $default);
|
||||
$AVE_Template->assign('field_dir', $fld_name);
|
||||
$AVE_Template->assign('image', $image);
|
||||
$AVE_Template->assign('doc_id', (int)$_REQUEST['Id']);
|
||||
|
@ -11,11 +11,11 @@ var SingleImage = {
|
||||
single_image: function() {
|
||||
$('.single_image').each(function(index, element) {
|
||||
|
||||
var image_id = $(element).attr('data-id');
|
||||
var doc_id = $(element).attr('data-doc');
|
||||
var link = $(element).find('a.lnk');
|
||||
var look = $(element).find('a.look');
|
||||
var input = $(element).find('input');
|
||||
let image_id = $(element).attr('data-id');
|
||||
let doc_id = $(element).attr('data-doc');
|
||||
let link = $(element).find('a.lnk');
|
||||
let look = $(element).find('a.look');
|
||||
let input = $(element).find('input');
|
||||
|
||||
link.on('click', function(event) {
|
||||
event.preventDefault();
|
||||
@ -34,13 +34,13 @@ var SingleImage = {
|
||||
});
|
||||
|
||||
$('#preview__' + image_id + '_' + doc_id).attr({
|
||||
'src': '../index.php?mode=f&width=128&height=128&thumb=/' + dir + '/' + file_full
|
||||
//'src': '../index.php?mode=t&width=128&height=128&thumb=/' + dir + '/' + file_full
|
||||
});
|
||||
});
|
||||
|
||||
if (input.val() == '') {
|
||||
$('#preview__' + image_id + '_' + doc_id).attr({
|
||||
'src': '/uploads/images/' + thumbdir + '/noimage-f128x128.png'
|
||||
'src': '/uploads/images/' + thumbdir + '/noimage-t128x128.png'
|
||||
});
|
||||
$('.preview__' + image_id + '_' + doc_id).attr({
|
||||
'href': '/uploads/images/noimage.png'
|
||||
|
@ -3,7 +3,7 @@
|
||||
<script src="{$ABS_PATH}fields/{$field_dir}/js/field.js" type="text/javascript"></script>
|
||||
<link href="{$ABS_PATH}fields/{$field_dir}/css/field.css" rel="stylesheet" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
var thumbdir = "{$smarty.const.THUMBNAIL_DIR}";
|
||||
let thumbdir = "{$smarty.const.THUMBNAIL_DIR}";
|
||||
</script>
|
||||
{assign var=single_image value="load" scope="global"}
|
||||
{/if}
|
||||
@ -13,7 +13,7 @@
|
||||
<div class="header grey_bg"></div>
|
||||
<a class="topDir icon_sprite ico_photo view fancy preview__{$field_id}_{$doc_id}" href="{$image.0|htmlspecialchars}" title="{#look#}"></a>
|
||||
<a class="topDir icon_sprite ico_edit lnk" href="javascript:void(0);" title="{#link#}"></a>
|
||||
<input style="display: none;" type="text" name="feld[{$field_id}][img]" value="{$image.0|htmlspecialchars}" id="image__{$field_id}_{$doc_id}">
|
||||
<input style="display: none;" type="text" name="feld[{$field_id}][img]" value="{$image.0|htmlspecialchars}" id="image__{$field_id}_{$doc_id}" data-default="{$default}">
|
||||
<img id="preview__{$field_id}_{$doc_id}" src="{$field}" alt="" border="0" onclick="browse_uploads('image__{$field_id}_{$doc_id}');" style="max-width: 128px;" class="topDir" title="{#select#}" />
|
||||
<textarea class="descr mousetrap" name="feld[{$field_id}][descr]" placeholder="{#place#}">{$image.1|htmlspecialchars}</textarea>
|
||||
</div>
|
||||
|
@ -129,7 +129,9 @@
|
||||
|
||||
//-- Если пришел прямой вызов файла, то сразу отрубаем его
|
||||
if ($_SERVER['REQUEST_URI'] == '/inc/thumb.php')
|
||||
{
|
||||
die('No image');
|
||||
}
|
||||
|
||||
//-- Если файл существует, показываем его
|
||||
if (file_exists(BASE_DIR . $imagefile))
|
||||
@ -172,7 +174,9 @@
|
||||
$countParts = count($nameParts);
|
||||
|
||||
if ($countParts < 2 || ! in_array(strtolower(end($nameParts)), $allowedExt))
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$matches = [];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user