diff --git a/admin/include/add_core_tabs.inc.php b/admin/include/add_core_tabs.inc.php index 92a90c71f8..0fab911df4 100644 --- a/admin/include/add_core_tabs.inc.php +++ b/admin/include/add_core_tabs.inc.php @@ -118,9 +118,13 @@ function add_core_tabs($sheets, $tab_id) break; case 'photo': - global $admin_photo_base_url; + global $admin_photo_base_url, $conf; $sheets['properties'] = array('caption' => ''.l10n('Properties'), 'url' => $admin_photo_base_url.'-properties'); $sheets['coi'] = array('caption' => ''.l10n('Center of interest'), 'url' => $admin_photo_base_url.'-coi'); + if ($conf['enable_formats']) + { + $sheets['formats'] = array('caption' => ''.l10n('Formats'), 'url' => $admin_photo_base_url.'-formats'); + } break; case 'photos_add': diff --git a/admin/photo.php b/admin/photo.php index efabca7253..897e942af9 100644 --- a/admin/photo.php +++ b/admin/photo.php @@ -71,6 +71,10 @@ { include(PHPWG_ROOT_PATH.'admin/picture_coi.php'); } +elseif ('formats' == $page['tab'] && $conf['enable_formats']) +{ + include(PHPWG_ROOT_PATH.'admin/picture_formats.php'); +} else { include(PHPWG_ROOT_PATH.'admin/photo_'.$page['tab'].'.php'); diff --git a/admin/picture_formats.php b/admin/picture_formats.php new file mode 100644 index 0000000000..ba9c6403a2 --- /dev/null +++ b/admin/picture_formats.php @@ -0,0 +1,63 @@ +assign(array( + 'ADD_FORMATS_URL' => get_root_url().'admin.php?page=photos_add&formats='.$_GET['image_id'], + 'IMG_SQUARE_SRC' => DerivativeImage::url(ImageStdParams::get_by_type(IMG_SQUARE), $image), + 'FORMATS' => $formats, + 'PWG_TOKEN' => get_pwg_token(), +)); + +$template->set_filename('picture_formats', 'picture_formats.tpl'); + +$template->assign_var_from_handle('ADMIN_CONTENT', 'picture_formats'); +?> diff --git a/admin/themes/default/css/components/general.css b/admin/themes/default/css/components/general.css index 11cd823a2a..e5aa693fbd 100644 --- a/admin/themes/default/css/components/general.css +++ b/admin/themes/default/css/components/general.css @@ -39,6 +39,8 @@ or .head-button-1:hover { background: #ff7700; + text-decoration: none !important; + color: white; } .head-button-2 { @@ -48,6 +50,8 @@ or .head-button-2:hover { background: #eee; + text-decoration: none !important; + color: inherit !important; } /* ------------- diff --git a/admin/themes/default/js/picture_formats.js b/admin/themes/default/js/picture_formats.js new file mode 100644 index 0000000000..774dfeb57f --- /dev/null +++ b/admin/themes/default/js/picture_formats.js @@ -0,0 +1,35 @@ +function fitExtensions() { + $(".format-card-ext span").each((i, node) => { + let size = Math.min(180 * 1/node.innerHTML.length, 45) + node.setAttribute('style', `font-size:${size}px`) + }) +} + +fitExtensions() + +$('.format-card').each((i, node) => { + let card = $(node) + let button = card.find(".format-delete") + button.click(() => { + console.log(card.data('id')); + button.find('i').attr("class", "icon-spin6 animate-spin") + $.ajax({ + url: "ws.php?format=json&method=pwg.images.formats.delete", + type: "POST", + data: { + pwg_token : pwg_token, + format_id: card.data('id'), + }, + success: function (raw_data) { + card.fadeOut("slow", () => { + card.remove(); + if ($('.format-card').length == 0) + $('.no-formats').show() + }) + }, + error: function(message) { + console.log(message); + } + }) + }) +}) \ No newline at end of file diff --git a/admin/themes/default/template/photos_add_direct.tpl b/admin/themes/default/template/photos_add_direct.tpl index 201e097ec6..c7109e0ce1 100644 --- a/admin/themes/default/template/photos_add_direct.tpl +++ b/admin/themes/default/template/photos_add_direct.tpl @@ -81,7 +81,7 @@ var batch_Label = "{'Manage this set of %d photos'|translate}"; var albumSummary_label = "{'Album "%s" now contains %d photos'|translate|escape}"; var str_format_warning = "{'Error when trying to detect formats'|translate}"; var str_ok = "{'Ok'|translate}"; -var str_format_warning_multiple = "{'There is multiple image in the database with the following names : %s. Try to rename them with the Edit Filename plugin.'|translate}"; +var str_format_warning_multiple = "{'There is multiple image in the database with the following names : %s.'|translate}"; var str_format_warning_notFound = "{'No picture found with the following name : %s.'|translate}"; var str_and_X_others = "{'and %d more'|translate}"; var file_ext = "{$file_exts}"; @@ -508,7 +508,7 @@ jQuery(document).ready(function(){