Updated: All the suggested flow implemented

This commit is contained in:
shazar rahman
2026-08-19 19:25:32 +05:30
parent fc3ecc2027
commit cc352ffd75
5 changed files with 530 additions and 560 deletions

View File

@@ -29,18 +29,18 @@ class AdminHotelHeaderImageController extends ModuleAdminController
{
public function __construct()
{
$this->table = 'htl_header_image';
$this->className = 'HotelHeaderImage';
$this->bootstrap = true;
$this->table = 'htl_header_image';
$this->className = 'HotelHeaderImage';
$this->bootstrap = true;
$this->identifier = 'id_header_image';
$this->lang = true;
$this->lang = true;
parent::__construct();
$this->bulk_actions = array(
'delete' => array(
'text' => $this->l('Delete selected'),
'text' => $this->l('Delete selected'),
'confirm' => $this->l('Delete selected images? This cannot be undone.'),
'icon' => 'icon-trash',
'icon' => 'icon-trash',
),
);
}
@@ -63,24 +63,21 @@ class AdminHotelHeaderImageController extends ModuleAdminController
public function renderView()
{
$this->meta_title = $this->l('Header Image Configuration');
$mediaType = (int)Tools::getValue(
'QLO_HEADER_MEDIA_TYPE',
(int)(Configuration::get('QLO_HEADER_MEDIA_TYPE') ?: HotelHeaderImage::MEDIA_TYPE_IMAGE)
);
$languages = Language::getLanguages(false);
$mediaType = (int)Tools::getValue('QLO_HEADER_MEDIA_TYPE', (int)(Configuration::get('QLO_HEADER_MEDIA_TYPE') ?: HotelHeaderImage::MEDIA_TYPE_IMAGE));
$languages = Language::getLanguages(false);
$defaultLangId = (int)Configuration::get('PS_LANG_DEFAULT');
$imageItems = HotelHeaderImage::getItems(null, $defaultLangId, true);
$shopId = (int)$this->context->shop->id;
foreach ($imageItems as &$item) {
$item['tag_lines_json'] = json_encode((object)$item['tag_lines']);
$srcPath = _PS_IMG_DIR_.'hotel_header_media/'.$item['name'];
$srcPath = _PS_IMG_DIR_.'hotel_header_media/'.$item['name'];
$cacheName = 'htl_header_image_mini_'.(int)$item['id_header_image'].'_'.$shopId.'.jpg';
$item['thumb'] = ImageManager::thumbnail($srcPath, $cacheName, 45, 'jpg', false);
}
unset($item);
$videoItem = HotelHeaderImage::getVideoConfig();
$videoItem = HotelHeaderImage::getVideoConfig();
$videoMimeType = 'video/mp4';
if ($videoItem) {
if ($videoItem['source_type'] === 'upload') {
@@ -93,47 +90,57 @@ class AdminHotelHeaderImageController extends ModuleAdminController
$videoMimeType = isset($mimeMap[$ext]) ? $mimeMap[$ext] : 'video/mp4';
}
$sourceType = Tools::getValue('source_type', $videoItem ? $videoItem['source_type'] : 'upload');
$videoUrlValue = Tools::getValue(
'video_url',
($videoItem && $videoItem['source_type'] === 'url') ? $videoItem['name'] : ''
);
$showVideoUrlPreview = ($sourceType === 'url' && $videoUrlValue && Validate::isAbsoluteUrl($videoUrlValue));
Media::addJsDef(array(
'qloHmCurrentIndex' => self::$currentIndex,
'qloHmToken' => $this->token,
'qloHmMediaType' => $mediaType,
'qloHmCurrentIndex' => self::$currentIndex,
'qloHmToken' => $this->token,
'qloHmMediaType' => $mediaType,
'qloHmMediaTypeImage' => HotelHeaderImage::MEDIA_TYPE_IMAGE,
'qloHmMediaTypeVideo' => HotelHeaderImage::MEDIA_TYPE_VIDEO,
'qloHmMaxUpload' => Tools::getMaxUploadSize((int)Configuration::get('PS_LIMIT_UPLOAD_IMAGE_VALUE') * 1024 * 1024),
'qloHmMaxUpload' => Tools::getMaxUploadSize((int)Configuration::get('PS_LIMIT_UPLOAD_IMAGE_VALUE') * 1024 * 1024),
'qloHmMaxVideoUpload' => Tools::getMaxUploadSize(),
'qloHmDefaultLangId' => $defaultLangId,
'qloHmI18n' => array(
'noFileSelected' => $this->l('Please select at least one image file.'),
'deleteFailed' => $this->l('Delete failed.'),
'requestFailed' => $this->l('Request failed.'),
'imageUploadedSuccess'=> $this->l('Image uploaded successfully.'),
'qloHmDefaultLangId' => $defaultLangId,
'qloHmI18n' => array(
'noFileSelected' => $this->l('Please select at least one image file.'),
'deleteFailed' => $this->l('Delete failed.'),
'requestFailed' => $this->l('Request failed.'),
'imageUploadedSuccess' => $this->l('Image uploaded successfully.'),
'imageUpdatedSuccess' => $this->l('Image updated successfully.'),
'uploadFailed' => $this->l('Upload failed.'),
'updateFailed' => $this->l('Update failed.'),
'editLabel' => $this->l('Edit'),
'deleteImageLabel' => $this->l('Delete this image'),
'fileTooLarge' => $this->l('File exceeds the maximum allowed upload size.'),
'uploadFailed' => $this->l('Upload failed.'),
'updateFailed' => $this->l('Update failed.'),
'editLabel' => $this->l('Edit'),
'deleteImageLabel' => $this->l('Delete this image'),
'fileTooLarge' => $this->l('File exceeds the maximum allowed upload size.'),
),
));
$this->tpl_view_vars = array(
'mediaType' => $mediaType,
'imageItems' => $imageItems,
'videoItem' => $videoItem,
'mediaType' => $mediaType,
'imageItems' => $imageItems,
'videoItem' => $videoItem,
'videoMimeType' => $videoMimeType,
'config' => array(
'QLO_HEADER_MEDIA_TYPE' => $mediaType,
'QLO_HEADER_SLIDER_NAV_TYPE' => (int)Tools::getValue('QLO_HEADER_SLIDER_NAV_TYPE', (int)(Configuration::get('QLO_HEADER_SLIDER_NAV_TYPE') ?: HotelHeaderImage::NAV_TYPE_DOTS)),
'sourceType' => $sourceType,
'videoUrlValue' => $videoUrlValue,
'showVideoUrlPreview' => $showVideoUrlPreview,
'config' => array(
'QLO_HEADER_MEDIA_TYPE' => $mediaType,
'QLO_HEADER_SLIDER_NAV_TYPE' => (int)Tools::getValue('QLO_HEADER_SLIDER_NAV_TYPE', (int)(Configuration::get('QLO_HEADER_SLIDER_NAV_TYPE') ?: HotelHeaderImage::NAV_TYPE_DOTS)),
'QLO_HEADER_SLIDER_AUTO_PLAY' => (int)Tools::getValue('QLO_HEADER_SLIDER_AUTO_PLAY', (int)Configuration::get('QLO_HEADER_SLIDER_AUTO_PLAY')),
'QLO_HEADER_SLIDER_INTERVAL' => (int)Tools::getValue('QLO_HEADER_SLIDER_INTERVAL', (int)Configuration::get('QLO_HEADER_SLIDER_INTERVAL') ?: 5000),
'QLO_HEADER_SLIDER_INTERVAL' => Tools::getValue('QLO_HEADER_SLIDER_INTERVAL', (int)Configuration::get('QLO_HEADER_SLIDER_INTERVAL') ?: 5000),
'QLO_HEADER_SLIDER_ANIM_TYPE' => (int)Tools::getValue('QLO_HEADER_SLIDER_ANIM_TYPE', (int)(Configuration::get('QLO_HEADER_SLIDER_ANIM_TYPE') ?: HotelHeaderImage::ANIM_TYPE_SLIDE)),
'QLO_HOTEL_NAME_ENABLE' => (int)Tools::getValue('QLO_HOTEL_NAME_ENABLE', (int)Configuration::get('QLO_HOTEL_NAME_ENABLE')),
'QLO_HEADER_CONTENT_ALIGN' => (int)Tools::getValue('QLO_HEADER_CONTENT_ALIGN', (int)(Configuration::get('QLO_HEADER_CONTENT_ALIGN') ?: HotelHeaderImage::CONTENT_ALIGN_CENTER)),
'QLO_HOTEL_NAME_ENABLE' => (int)Tools::getValue('QLO_HOTEL_NAME_ENABLE', (int)Configuration::get('QLO_HOTEL_NAME_ENABLE')),
'QLO_HEADER_CONTENT_ALIGN' => (int)Tools::getValue('QLO_HEADER_CONTENT_ALIGN', (int)(Configuration::get('QLO_HEADER_CONTENT_ALIGN') ?: HotelHeaderImage::CONTENT_ALIGN_CENTER)),
),
'languages' => $languages,
'languages' => $languages,
'defaultLangId' => $defaultLangId,
'imgBaseUrl' => $this->context->link->getMediaLink(_PS_IMG_.'hotel_header_media/'),
'maxUpload' => Tools::formatBytes(Tools::getMaxUploadSize()),
'imgBaseUrl' => $this->context->link->getMediaLink(_PS_IMG_.'hotel_header_media/'),
'maxUpload' => Tools::formatBytes(Tools::getMaxUploadSize()),
'maxImageUpload' => Tools::formatBytes(Tools::getMaxUploadSize((int)Configuration::get('PS_LIMIT_UPLOAD_IMAGE_VALUE') * 1024 * 1024)),
);
@@ -150,9 +157,9 @@ class AdminHotelHeaderImageController extends ModuleAdminController
protected function processBulkDelete()
{
$ids = Tools::getValue($this->table.'Box', array());
$ids = Tools::getValue($this->table.'Box', array());
$activeImages = HotelHeaderImage::getItems(1);
$activeIds = array_column($activeImages, 'id_header_image');
$activeIds = array_column($activeImages, 'id_header_image');
$activeToDelete = array_intersect(array_map('intval', (array)$ids), array_map('intval', $activeIds));
if (count($activeIds) - count($activeToDelete) < 1) {
@@ -163,25 +170,9 @@ class AdminHotelHeaderImageController extends ModuleAdminController
parent::processBulkDelete();
}
protected function processBulkDisableSelection()
{
$ids = Tools::getValue($this->table.'Box', array());
$activeImages = HotelHeaderImage::getItems(1);
$activeIds = array_column($activeImages, 'id_header_image');
$activeToDisable = array_intersect(array_map('intval', (array)$ids), array_map('intval', $activeIds));
if (count($activeIds) - count($activeToDisable) < 1) {
$this->errors[] = $this->l('At least one image must remain active.');
return;
}
parent::processBulkDisableSelection();
}
protected function processSaveSettings()
{
$mediaType = (int)Tools::getValue('QLO_HEADER_MEDIA_TYPE', HotelHeaderImage::MEDIA_TYPE_IMAGE);
$autoPlay = (int)(bool)Tools::getValue('QLO_HEADER_SLIDER_AUTO_PLAY', 1);
$previousMediaType = (int)Configuration::get('QLO_HEADER_MEDIA_TYPE');
if (!in_array($mediaType, array(HotelHeaderImage::MEDIA_TYPE_IMAGE, HotelHeaderImage::MEDIA_TYPE_VIDEO))) {
@@ -189,11 +180,13 @@ class AdminHotelHeaderImageController extends ModuleAdminController
return;
}
$existingVideo = HotelHeaderImage::getVideoConfig();
$sourceType = Tools::getValue('source_type', 'upload');
$existingVideo = HotelHeaderImage::getVideoConfig();
$hasMatchingExistingVideo = ($existingVideo && $existingVideo['source_type'] === $sourceType);
$hasNewVideoFile = isset($_FILES['header_video_file']) && !empty($_FILES['header_video_file']['size']);
$hasNewVideoUrl = (Tools::getValue('source_type', '') === 'url' && trim(Tools::getValue('video_url', '')) !== '');
$hasNewVideoUrl = ($sourceType === 'url' && trim(Tools::getValue('video_url', '')) !== '');
if ($mediaType === HotelHeaderImage::MEDIA_TYPE_VIDEO && !$existingVideo && !$hasNewVideoFile && !$hasNewVideoUrl) {
if ($mediaType === HotelHeaderImage::MEDIA_TYPE_VIDEO && !$hasMatchingExistingVideo && !$hasNewVideoFile && !$hasNewVideoUrl) {
$this->errors[] = $this->l('Please upload or link a video before switching the header to Video mode.');
return;
}
@@ -201,21 +194,35 @@ class AdminHotelHeaderImageController extends ModuleAdminController
$this->errors[] = $this->l('Please add at least one active image before switching the header to Image mode.');
return;
}
if ($autoPlay) {
$interval = Tools::getValue('QLO_HEADER_SLIDER_INTERVAL', 5000);
if ((string)$interval !== '' && (!Validate::isUnsignedInt($interval) || (int)$interval < 500)) {
$this->errors[] = $this->l('Auto Slide Interval must be at least 500 milliseconds.');
return;
}
}
$autoPlay = 0;
$interval = 0;
$navType = HotelHeaderImage::NAV_TYPE_DOTS;
$animType = HotelHeaderImage::ANIM_TYPE_SLIDE;
$contentAlign = HotelHeaderImage::CONTENT_ALIGN_CENTER;
$navType = (int)Tools::getValue('QLO_HEADER_SLIDER_NAV_TYPE', HotelHeaderImage::NAV_TYPE_DOTS);
if (!in_array($navType, array(HotelHeaderImage::NAV_TYPE_DOTS, HotelHeaderImage::NAV_TYPE_ARROWS, HotelHeaderImage::NAV_TYPE_BOTH))) {
$navType = HotelHeaderImage::NAV_TYPE_DOTS;
}
$animType = (int)Tools::getValue('QLO_HEADER_SLIDER_ANIM_TYPE', HotelHeaderImage::ANIM_TYPE_SLIDE);
if (!in_array($animType, array(HotelHeaderImage::ANIM_TYPE_SLIDE, HotelHeaderImage::ANIM_TYPE_FADE, HotelHeaderImage::ANIM_TYPE_ZOOM, HotelHeaderImage::ANIM_TYPE_BLUR))) {
$animType = HotelHeaderImage::ANIM_TYPE_SLIDE;
if ($mediaType === HotelHeaderImage::MEDIA_TYPE_IMAGE) {
$autoPlay = (int)(bool)Tools::getValue('QLO_HEADER_SLIDER_AUTO_PLAY', 1);
if ($autoPlay) {
$interval = Tools::getValue('QLO_HEADER_SLIDER_INTERVAL', 5000);
if (!Validate::isUnsignedInt($interval) || (int)$interval < 500) {
$this->errors[] = $this->l('Auto Slide Interval must be at least 500 milliseconds.');
return;
}
$interval = (int)$interval;
}
$navType = (int)Tools::getValue('QLO_HEADER_SLIDER_NAV_TYPE', HotelHeaderImage::NAV_TYPE_DOTS);
if (!in_array($navType, array(HotelHeaderImage::NAV_TYPE_DOTS, HotelHeaderImage::NAV_TYPE_ARROWS, HotelHeaderImage::NAV_TYPE_BOTH))) {
$navType = HotelHeaderImage::NAV_TYPE_DOTS;
}
$animType = (int)Tools::getValue('QLO_HEADER_SLIDER_ANIM_TYPE', HotelHeaderImage::ANIM_TYPE_SLIDE);
if (!in_array($animType, array(HotelHeaderImage::ANIM_TYPE_SLIDE, HotelHeaderImage::ANIM_TYPE_FADE, HotelHeaderImage::ANIM_TYPE_ZOOM, HotelHeaderImage::ANIM_TYPE_BLUR))) {
$animType = HotelHeaderImage::ANIM_TYPE_SLIDE;
}
$contentAlign = (int)Tools::getValue('QLO_HEADER_CONTENT_ALIGN', HotelHeaderImage::CONTENT_ALIGN_CENTER);
if (!in_array($contentAlign, array(HotelHeaderImage::CONTENT_ALIGN_LEFT, HotelHeaderImage::CONTENT_ALIGN_CENTER, HotelHeaderImage::CONTENT_ALIGN_RIGHT))) {
$contentAlign = HotelHeaderImage::CONTENT_ALIGN_CENTER;
}
}
if ($mediaType === HotelHeaderImage::MEDIA_TYPE_VIDEO) {
@@ -241,20 +248,18 @@ class AdminHotelHeaderImageController extends ModuleAdminController
}
}
$contentAlign = (int)Tools::getValue('QLO_HEADER_CONTENT_ALIGN', HotelHeaderImage::CONTENT_ALIGN_CENTER);
if (!in_array($contentAlign, array(HotelHeaderImage::CONTENT_ALIGN_LEFT, HotelHeaderImage::CONTENT_ALIGN_CENTER, HotelHeaderImage::CONTENT_ALIGN_RIGHT))) {
$contentAlign = HotelHeaderImage::CONTENT_ALIGN_CENTER;
}
if (!count($this->errors)) {
Configuration::updateValue('QLO_HEADER_MEDIA_TYPE', $mediaType);
Configuration::updateValue('QLO_HOTEL_NAME_ENABLE', (int)(bool)Tools::getValue('QLO_HOTEL_NAME_ENABLE', 0));
Configuration::updateValue('QLO_HEADER_CONTENT_ALIGN', $contentAlign);
Configuration::updateValue('QLO_HEADER_SLIDER_NAV_TYPE', $navType);
Configuration::updateValue('QLO_HEADER_SLIDER_AUTO_PLAY', $autoPlay);
if ($autoPlay) {
Configuration::updateValue('QLO_HEADER_SLIDER_INTERVAL', (int)Tools::getValue('QLO_HEADER_SLIDER_INTERVAL', 5000));
Configuration::updateValue('QLO_HEADER_SLIDER_ANIM_TYPE', $animType);
Configuration::updateValue('QLO_HEADER_MEDIA_TYPE', $mediaType);
if ($mediaType === HotelHeaderImage::MEDIA_TYPE_IMAGE) {
Configuration::updateValue('QLO_HOTEL_NAME_ENABLE', (int)(bool)Tools::getValue('QLO_HOTEL_NAME_ENABLE', 0));
Configuration::updateValue('QLO_HEADER_CONTENT_ALIGN', $contentAlign);
Configuration::updateValue('QLO_HEADER_SLIDER_NAV_TYPE', $navType);
Configuration::updateValue('QLO_HEADER_SLIDER_AUTO_PLAY', $autoPlay);
if ($autoPlay) {
Configuration::updateValue('QLO_HEADER_SLIDER_INTERVAL', $interval);
Configuration::updateValue('QLO_HEADER_SLIDER_ANIM_TYPE', $animType);
}
}
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
}
@@ -263,10 +268,10 @@ class AdminHotelHeaderImageController extends ModuleAdminController
protected function processSaveVideo()
{
$sourceType = Tools::getValue('source_type', 'upload');
$videoUrl = trim(Tools::getValue('video_url', ''));
$file = isset($_FILES['header_video_file']) ? $_FILES['header_video_file'] : null;
$videoUrl = trim(Tools::getValue('video_url', ''));
$file = isset($_FILES['header_video_file']) ? $_FILES['header_video_file'] : null;
$hasNewFile = ($file && isset($file['error']) && $file['error'] === UPLOAD_ERR_OK && $file['size'] > 0);
$hasNewUrl = ($sourceType === 'url' && $videoUrl !== '');
$hasNewUrl = ($sourceType === 'url' && $videoUrl !== '');
if ($sourceType === 'url' && $videoUrl === '') {
$this->errors[] = $this->l('Please enter a video URL.');
@@ -277,14 +282,13 @@ class AdminHotelHeaderImageController extends ModuleAdminController
return;
}
if ($hasNewFile) {
$allowedExts = array('mp4', 'webm', 'ogg');
$allowedExts = array('mp4', 'webm', 'ogg');
$allowedMimes = array('video/mp4', 'video/webm', 'video/ogg', 'video/x-matroska');
$ext = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
if (!in_array($ext, $allowedExts)) {
$this->errors[] = $this->l('Only .mp4, .webm, and .ogg video formats are allowed.');
return;
}
// Use actual disk size — $_FILES['size'] is user-supplied and can be spoofed.
if (filesize($file['tmp_name']) > Tools::getMaxUploadSize()) {
$this->errors[] = $this->l('Video file exceeds the maximum allowed upload size.');
return;
@@ -293,7 +297,7 @@ class AdminHotelHeaderImageController extends ModuleAdminController
$this->errors[] = $this->l('Server cannot verify file type. Please enable the fileinfo PHP extension.');
return;
}
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$detectedMime = finfo_file($finfo, $file['tmp_name']);
finfo_close($finfo);
if (!in_array($detectedMime, $allowedMimes)) {
@@ -343,17 +347,15 @@ class AdminHotelHeaderImageController extends ModuleAdminController
$this->ajaxDie(json_encode($response));
}
$ext = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
$isGif = ($ext === 'gif');
$ext = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
$isGif = ($ext === 'gif');
$outExt = $isGif ? 'gif' : 'jpg';
do {
$uniqueName = bin2hex(random_bytes(16)).'.'.$outExt;
} while (file_exists(_PS_IMG_DIR_.'hotel_header_media/'.$uniqueName));
$destPath = _PS_IMG_DIR_.'hotel_header_media/'.$uniqueName;
$saved = $isGif
? (bool)move_uploaded_file($file['tmp_name'], $destPath)
: (bool)ImageManager::resize($file['tmp_name'], $destPath);
$saved = $isGif ? (bool)move_uploaded_file($file['tmp_name'], $destPath) : (bool)ImageManager::resize($file['tmp_name'], $destPath);
if (!$saved) {
$response['errors'][] = $this->l('Failed to save image file.');
@@ -374,12 +376,12 @@ class AdminHotelHeaderImageController extends ModuleAdminController
}
}
$tagLineColor = Tools::getValue('tag_line_color', '#ffffff');
$tagLineColor = Tools::getValue('tag_line_color', '#ffffff');
if (!preg_match('/^#[0-9a-fA-F]{6}$/', $tagLineColor)) {
$response['errors'][] = $this->l('Invalid tag line color. Use a 6-digit hex value (e.g. #ffffff).');
$this->ajaxDie(json_encode($response));
}
$tagLineFontSize = (int)Tools::getValue('tag_line_font_size', 16);
$tagLineFontSize = (int)Tools::getValue('tag_line_font_size', 16);
if ($tagLineFontSize < 8 || $tagLineFontSize > 72) {
$response['errors'][] = $this->l('Tag line font size must be between 8 and 72 pixels.');
$this->ajaxDie(json_encode($response));
@@ -390,13 +392,13 @@ class AdminHotelHeaderImageController extends ModuleAdminController
$this->ajaxDie(json_encode($response));
}
$objImage = new HotelHeaderImage();
$objImage->name = $uniqueName;
$objImage->position = $objImage->getHigherPosition();
$objImage->active = (int)(bool)Tools::getValue('active', 1);
$objImage->tag_line = $tagLineByLang;
$objImage->tag_line_color = $tagLineColor;
$objImage->tag_line_font_size = $tagLineFontSize;
$objImage = new HotelHeaderImage();
$objImage->name = $uniqueName;
$objImage->position = $objImage->getHigherPosition();
$objImage->active = (int)(bool)Tools::getValue('active', 1);
$objImage->tag_line = $tagLineByLang;
$objImage->tag_line_color = $tagLineColor;
$objImage->tag_line_font_size = $tagLineFontSize;
$objImage->tag_line_font_weight = $tagLineFontWeight;
if (!$objImage->save()) {
@@ -407,16 +409,28 @@ class AdminHotelHeaderImageController extends ModuleAdminController
$this->ajaxDie(json_encode($response));
}
$defaultLangId = (int)Configuration::get('PS_LANG_DEFAULT');
$response['success'] = true;
$response['id'] = (int)$objImage->id;
$response['active'] = (int)$objImage->active;
$response['imgUrl'] = $this->context->link->getMediaLink(_PS_IMG_.'hotel_header_media/'.$uniqueName);
$response['tag_line'] = isset($tagLineByLang[$defaultLangId]) ? $tagLineByLang[$defaultLangId] : '';
$response['tag_lines_json'] = json_encode((object)$tagLineByLang);
$response['tag_line_color'] = $tagLineColor;
$response['tag_line_font_size'] = $tagLineFontSize;
$response['tag_line_font_weight'] = $tagLineFontWeight;
$defaultLangId = (int)Configuration::get('PS_LANG_DEFAULT');
$this->context->smarty->assign(array(
'img' => array(
'id_header_image' => (int)$objImage->id,
'name' => $uniqueName,
'tag_line' => isset($tagLineByLang[$defaultLangId]) ? $tagLineByLang[$defaultLangId] : '',
'tag_lines_json' => json_encode((object)$tagLineByLang),
'tag_line_color' => $tagLineColor,
'tag_line_font_size' => $tagLineFontSize,
'tag_line_font_weight' => $tagLineFontWeight,
'active' => (int)$objImage->active,
),
'position' => count(HotelHeaderImage::getItems(null)),
'current' => self::$currentIndex,
'token' => $this->token,
'imgBaseUrl' => $this->context->link->getMediaLink(_PS_IMG_.'hotel_header_media/'),
));
$response['success'] = true;
$response['data']['image_row'] = $this->context->smarty->fetch(
_PS_MODULE_DIR_.$this->module->name.'/views/templates/admin/hotel_header_image/_partials/htl-header-image-row.tpl'
);
$this->ajaxDie(json_encode($response));
}
@@ -470,23 +484,23 @@ class AdminHotelHeaderImageController extends ModuleAdminController
$this->ajaxDie(json_encode($response));
}
$objImage->tag_line = $tagLineByLang;
$objImage->tag_line_color = $tagLineColor;
$objImage->tag_line_font_size = $tagLineFontSize;
$objImage->tag_line = $tagLineByLang;
$objImage->tag_line_color = $tagLineColor;
$objImage->tag_line_font_size = $tagLineFontSize;
$objImage->tag_line_font_weight = $tagLineFontWeight;
if (!$objImage->save()) {
$response['errors'][] = $this->l('Failed to update image.');
$this->ajaxDie(json_encode($response));
}
$defaultLangId = (int)Configuration::get('PS_LANG_DEFAULT');
$response['success'] = true;
$response['active'] = (int)$objImage->active;
$response['confirmations'] = $this->l('Image updated successfully.');
$response['tag_line'] = isset($tagLineByLang[$defaultLangId]) ? $tagLineByLang[$defaultLangId] : '';
$response['tag_lines_json'] = json_encode((object)$tagLineByLang);
$response['tag_line_color'] = $tagLineColor;
$response['tag_line_font_size'] = $tagLineFontSize;
$defaultLangId = (int)Configuration::get('PS_LANG_DEFAULT');
$response['success'] = true;
$response['active'] = (int)$objImage->active;
$response['confirmations'] = $this->l('Image updated successfully.');
$response['tag_line'] = isset($tagLineByLang[$defaultLangId]) ? $tagLineByLang[$defaultLangId] : '';
$response['tag_lines_json'] = json_encode((object)$tagLineByLang);
$response['tag_line_color'] = $tagLineColor;
$response['tag_line_font_size'] = $tagLineFontSize;
$response['tag_line_font_weight'] = $tagLineFontWeight;
$this->ajaxDie(json_encode($response));
}
@@ -520,7 +534,7 @@ class AdminHotelHeaderImageController extends ModuleAdminController
$this->ajaxDie(json_encode($response));
}
$response['success'] = true;
$response['success'] = true;
$response['confirmations'] = $this->l('Image deleted successfully.');
$this->ajaxDie(json_encode($response));
}
@@ -535,7 +549,7 @@ class AdminHotelHeaderImageController extends ModuleAdminController
}
HotelHeaderImage::deleteVideoConfig();
$response['success'] = true;
$response['success'] = true;
$response['confirmations'] = $this->l('Video deleted successfully.');
$this->ajaxDie(json_encode($response));
}
@@ -543,7 +557,7 @@ class AdminHotelHeaderImageController extends ModuleAdminController
public function ajaxProcessToggleImageActive()
{
$response = array('errors' => array(), 'success' => false);
$id = (int)Tools::getValue('id_header_image');
$id = (int)Tools::getValue('id_header_image');
$active = (int)(bool)Tools::getValue('active');
if (!$id) {
@@ -571,7 +585,7 @@ class AdminHotelHeaderImageController extends ModuleAdminController
$this->ajaxDie(json_encode($response));
}
$response['success'] = true;
$response['success'] = true;
$response['confirmations'] = $this->l('The status has been successfully updated.');
$this->ajaxDie(json_encode($response));
}
@@ -583,70 +597,123 @@ class AdminHotelHeaderImageController extends ModuleAdminController
$this->ajaxDie(json_encode(array('success' => false)));
}
$sanitizedIds = array_values(array_filter(array_map('intval', $ids), function ($id) {
return $id > 0;
}));
if (count($sanitizedIds) !== count($ids)) {
$this->ajaxDie(json_encode(array('success' => false, 'errors' => array($this->l('Invalid image IDs.')))));
}
if ($sanitizedIds) {
$validRows = Db::getInstance()->executeS(
'SELECT `id_header_image` FROM `'._DB_PREFIX_.'htl_header_image`
WHERE `id_header_image` IN ('.implode(',', $sanitizedIds).')'
);
if (!$validRows || count($validRows) !== count($sanitizedIds)) {
foreach ($ids as $position => $id) {
$objImage = new HotelHeaderImage((int)$id);
if (!Validate::isLoadedObject($objImage)) {
$this->ajaxDie(json_encode(array('success' => false, 'errors' => array($this->l('One or more image IDs are invalid.')))));
}
}
foreach ($sanitizedIds as $position => $id) {
Db::getInstance()->execute(
'UPDATE `'._DB_PREFIX_.'htl_header_image`
SET `position` = '.(int)$position.'
WHERE `id_header_image` = '.(int)$id
);
$objImage->position = (int)$position;
$objImage->update();
}
$this->ajaxDie(json_encode(array(
'success' => true,
'success' => true,
'confirmations' => $this->l('The selected images have successfully been moved.'),
)));
}
public function ajaxProcessBulkUpdateTagLines()
public function ajaxProcessBulkUpdateImages()
{
$response = array('errors' => array(), 'success' => false);
$languages = Language::getLanguages(false);
$tagLineByLang = array();
foreach ($languages as $lang) {
$tagLineByLang[$lang['id_lang']] = trim(Tools::getValue('tag_line_'.$lang['id_lang'], ''));
$response = array('errors' => array(), 'success' => false);
$ids = array_values(array_unique(array_filter(array_map('intval', (array)Tools::getValue('id_header_image', array())))));
if (!$ids) {
$response['errors'][] = $this->l('No images selected.');
$this->ajaxDie(json_encode($response));
}
foreach ($tagLineByLang as $tagLineValue) {
if (!Validate::isGenericName($tagLineValue)) {
$response['errors'][] = $this->l('Invalid tag line. Characters < > = { } are not allowed.');
$activeVal = Tools::getValue('active', '');
if ($activeVal !== '' && !in_array($activeVal, array('0', '1'))) {
$response['errors'][] = $this->l('Invalid status selected.');
$this->ajaxDie(json_encode($response));
}
if ($activeVal === '0') {
$activeImages = HotelHeaderImage::getItems(1);
$activeIds = array_map('intval', array_column($activeImages, 'id_header_image'));
$activeToDisable = array_intersect($ids, $activeIds);
if (count($activeIds) - count($activeToDisable) < 1) {
$response['errors'][] = $this->l('At least one image must remain active.');
$this->ajaxDie(json_encode($response));
}
}
$ids = Db::getInstance()->executeS(
'SELECT `id_header_image` FROM `'._DB_PREFIX_.'htl_header_image`'
);
if (!$ids) {
$response['errors'][] = $this->l('No images found.');
$updateTagline = (bool)Tools::getValue('update_tagline', false);
$tagLineByLang = array();
if ($updateTagline) {
foreach (Language::getLanguages(false) as $lang) {
$tagLineByLang[$lang['id_lang']] = trim(Tools::getValue('tag_line_'.$lang['id_lang'], ''));
}
foreach ($tagLineByLang as $tagLineValue) {
if (!Validate::isGenericName($tagLineValue)) {
$response['errors'][] = $this->l('Invalid tag line. Characters < > = { } are not allowed.');
$this->ajaxDie(json_encode($response));
}
}
}
$tagLineColor = trim(Tools::getValue('tag_line_color', ''));
if ($tagLineColor !== '' && !preg_match('/^#[0-9a-fA-F]{6}$/', $tagLineColor)) {
$response['errors'][] = $this->l('Invalid tag line color. Use a 6-digit hex value (e.g. #ffffff).');
$this->ajaxDie(json_encode($response));
}
foreach ($ids as $row) {
$objImage = new HotelHeaderImage((int)$row['id_header_image']);
$objImage->tag_line = $tagLineByLang;
$objImage->save();
$tagLineFontSize = (int)Tools::getValue('tag_line_font_size', 0);
if ($tagLineFontSize !== 0 && ($tagLineFontSize < 8 || $tagLineFontSize > 72)) {
$response['errors'][] = $this->l('Tag line font size must be between 8 and 72 pixels.');
$this->ajaxDie(json_encode($response));
}
$defaultLangId = (int)Configuration::get('PS_LANG_DEFAULT');
$response['success'] = true;
$response['tag_line'] = isset($tagLineByLang[$defaultLangId]) ? $tagLineByLang[$defaultLangId] : '';
$response['tag_lines_json'] = json_encode((object)$tagLineByLang);
$response['confirmations'] = $this->l('Tag line updated for all images.');
$tagLineFontWeight = Tools::getValue('tag_line_font_weight', '');
if ($tagLineFontWeight !== '' && !in_array($tagLineFontWeight, array('300', '400', '600', '700'))) {
$response['errors'][] = $this->l('Invalid tag line font weight.');
$this->ajaxDie(json_encode($response));
}
$defaultLangId = (int)Configuration::get('PS_LANG_DEFAULT');
$updatedRows = array();
foreach ($ids as $id) {
$objImage = new HotelHeaderImage($id);
if (!Validate::isLoadedObject($objImage)) {
continue;
}
if ($activeVal !== '') {
$objImage->active = (int)$activeVal;
}
if ($updateTagline) {
$objImage->tag_line = $tagLineByLang;
}
if ($tagLineColor !== '') {
$objImage->tag_line_color = $tagLineColor;
}
if ($tagLineFontSize !== 0) {
$objImage->tag_line_font_size = $tagLineFontSize;
}
if ($tagLineFontWeight !== '') {
$objImage->tag_line_font_weight = $tagLineFontWeight;
}
$objImage->save();
$currentTagLines = is_array($objImage->tag_line) ? $objImage->tag_line : array();
$updatedRows[] = array(
'id' => (int)$objImage->id,
'active' => (int)$objImage->active,
'tag_line' => isset($currentTagLines[$defaultLangId]) ? $currentTagLines[$defaultLangId] : '',
'tag_lines_json' => json_encode((object)$currentTagLines),
'tag_line_color' => $objImage->tag_line_color,
'tag_line_font_size' => $objImage->tag_line_font_size,
'tag_line_font_weight' => $objImage->tag_line_font_weight,
);
}
if (!$updatedRows) {
$response['errors'][] = $this->l('No valid images were updated.');
$this->ajaxDie(json_encode($response));
}
$response['success'] = true;
$response['data']['rows'] = $updatedRows;
$response['confirmations'] = $this->l('Selected images updated successfully.');
$this->ajaxDie(json_encode($response));
}

View File

@@ -624,45 +624,6 @@ p.room_cat_data
background: #000;
}
.qlo-video-url-preview {
padding: 14px 16px;
background: #f5f5f5;
border: 1px solid #ddd;
border-radius: 4px;
margin-bottom: 0;
word-break: break-all;
font-size: 13px;
color: #444;
}
.qlo-video-url-preview .icon-link {
margin-right: 6px;
color: #5bc0de;
font-size: 14px;
}
.wk-inline-hint {
display: inline-block;
margin: 6px 0 0 10px;
font-size: 12px;
vertical-align: middle;
}
@keyframes wkSlideInLeft {
from {
opacity: 0;
transform: translateX(-16px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
.qlo-anim-slide-left {
animation: wkSlideInLeft 0.22s ease forwards;
}
.qlo-img-thumb {
width: 120px;
height: 75px;
@@ -681,82 +642,9 @@ p.room_cat_data
vertical-align: middle !important;
}
.wk-row-placeholder {
background: #eef6ff !important;
border: 1px dashed #99c0e0 !important;
}
.wk-row-placeholder td {
padding: 0 !important;
height: 85px;
}
/* ---- File list in add-image form ---- */
.qlo-files-list {
list-style: none;
padding: 0;
margin: 8px 0 0;
max-width: 520px;
}
.qlo-files-list li {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 10px;
border: 1px solid #e0e0e0;
border-radius: 3px;
margin-bottom: 5px;
background: #f9f9f9;
font-size: 13px;
}
.qlo-files-list li:first-child {
margin-top: 5px;
}
.qlo-files-list li:last-child {
margin-bottom: 0;
}
.qlo-files-list .qlo-file-name {
flex: 1;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-weight: 500;
color: #333;
}
.qlo-files-list .qlo-file-size {
font-size: 11px;
color: #999;
white-space: nowrap;
flex-shrink: 0;
}
.qlo-files-list .qlo-remove-file {
flex-shrink: 0;
padding: 3px 8px;
line-height: 1;
font-size: 13px;
color: #999;
border-color: #ccc;
background: #fff;
}
.qlo-files-list .qlo-remove-file:hover,
.qlo-files-list .qlo-remove-file:focus {
color: #c0392b;
border-color: #c0392b;
background: #fff5f5;
}
/* ---- Edit preview image in form ---- */
#qlo-img-edit-thumb {
max-width: 160px;
max-height: 100px;
object-fit: cover;
border-radius: 3px;
}
/* ---- Inline multilingual input (inside input-group-btn) ---- */
.wk-inline-lang-input {
border-top-left-radius: 0 !important;
border-bottom-left-radius: 0 !important;
}

View File

@@ -72,56 +72,42 @@ $(document).ready(function () {
$(document).on('change', 'input[name="QLO_HEADER_SLIDER_AUTO_PLAY"]', function () {
if ($(this).val() === '1') {
$('#qlo-slide-interval-group, #qlo-slide-anim-group').show();
$('#qlo-slide-interval-group, #qlo-slide-anim-group').show(200);
} else {
$('#qlo-slide-interval-group, #qlo-slide-anim-group').hide();
$('#qlo-slide-interval-group, #qlo-slide-anim-group').hide(200);
}
});
$(document).on('change', '#qlo-img-form-file', function () {
renderFileListHm(this.files);
});
$(document).on('click', '.qlo-remove-file', function () {
var removeIdx = parseInt($(this).data('index'), 10);
var fileInput = document.getElementById('qlo-img-form-file');
if (!fileInput || !fileInput.files) { return; }
try {
var dt = new DataTransfer();
for (var i = 0; i < fileInput.files.length; i++) {
if (i !== removeIdx) { dt.items.add(fileInput.files[i]); }
}
fileInput.files = dt.files;
} catch (_e) {
}
renderFileListHm(fileInput.files);
});
function renderFileListHm(files) {
var $list = $('#qlo-img-files-list').empty();
if (!files || !files.length) { $list.hide(); return; }
$list.show();
for (var i = 0; i < files.length; i++) {
(function (idx, file) {
var size = file.size < 1048576
? (file.size / 1024).toFixed(1) + ' KB'
: (file.size / 1048576).toFixed(1) + ' MB';
var $li = $(
'<li>' +
'<span class="qlo-file-name">' + escapeHtmlHm(file.name) + '</span>' +
'<span class="qlo-file-size text-muted">(' + size + ')</span>' +
'<button type="button" class="btn btn-default qlo-remove-file" data-index="' + idx + '" title="Remove">' +
'<i class="icon-trash"></i>' +
'</button>' +
'</li>'
);
$list.append($li);
})(i, files[i]);
}
}
hideOtherLanguage(qloHmDefaultLangId);
function updateImgFileNameHm(files) {
var names = [];
for (var i = 0; files && i < files.length; i++) {
names.push(files[i].name);
}
$('#qlo-img-form-file-name').val(names.join(', '));
}
$('#qlo-img-form-file-selectbutton, #qlo-img-form-file-name').on('click', function () {
$('#qlo-img-form-file').trigger('click');
});
$('#qlo-img-form-file-name').on('dragenter dragover', function (e) {
e.stopPropagation();
e.preventDefault();
});
$('#qlo-img-form-file-name').on('drop', function (e) {
e.preventDefault();
var files = e.originalEvent.dataTransfer.files;
document.getElementById('qlo-img-form-file').files = files;
updateImgFileNameHm(files);
});
$('#qlo-img-form-file').on('change', function () {
updateImgFileNameHm(this.files);
});
$(document).on('change', '#qlo-source-type', function () {
if ($(this).val() === 'url') {
$('#qlo-vid-file-wrap').hide();
@@ -180,10 +166,6 @@ $(document).ready(function () {
openImgForm('add');
});
$('#qlo-img-file-add-btn').on('click', function () {
$('#qlo-img-form-file').trigger('click');
});
$(document).on('click', '.qlo-edit-img', function () {
var $row = $(this).closest('tr.qlo-img-row');
var id = parseInt($row.data('id'), 10);
@@ -196,15 +178,53 @@ $(document).ready(function () {
openImgForm('edit', id, tagLines, isActive, thumbSrc, tlColor, tlFontSize, tlFontWeight);
});
$('#qlo-bulk-tagline-apply').on('click', function () {
var tagLines = {};
$('.qlo-bulk-tagline-field').each(function () {
tagLines[$(this).data('lang')] = $.trim($(this).val());
});
var postData = { ajax: 1, action: 'bulkUpdateTagLines', token: qloHmToken };
$.each(tagLines, function (langId, val) {
postData['tag_line_' + langId] = val;
});
function updateBulkUpdateTriggerState() {
$('#qlo-bulk-update-trigger').attr('disabled', !$('.qlo-img-checkbox:checked').length);
}
$(document).on('change', '.qlo-img-checkbox', updateBulkUpdateTriggerState);
$('.qlo-select-all-images, .qlo-unselect-all-images').on('click', updateBulkUpdateTriggerState);
$('#qlo-bulk-update-modal').on('show.bs.modal', function (e) {
if ($(e.relatedTarget).attr('disabled')) {
return false;
}
$('#qlo-bulk-active').val('');
$('#qlo_bulk_update_tagline_off').prop('checked', true);
$('#qlo-bulk-tagline-fields-wrap').hide();
$('.qlo-bulk-tagline-field').val('');
$('#qlo-bulk-tl-color').val('');
$('#qlo-bulk-tl-font-size').val(0);
$('#qlo-bulk-tl-font-weight').val('');
hideOtherLanguage(qloHmDefaultLangId);
});
$(document).on('change', 'input[name="qlo_bulk_update_tagline"]', function () {
if ($(this).val() === '1') {
$('#qlo-bulk-tagline-fields-wrap').show(200);
} else {
$('#qlo-bulk-tagline-fields-wrap').hide(200);
}
});
$('#qlo-bulk-update-apply').on('click', function () {
var ids = $('.qlo-img-checkbox:checked').map(function () { return $(this).val(); }).get();
var updateTagline = $('input[name="qlo_bulk_update_tagline"]:checked').val() === '1';
var postData = {
ajax: 1, action: 'bulkUpdateImages', token: qloHmToken,
id_header_image: ids,
active: $('#qlo-bulk-active').val(),
update_tagline: updateTagline ? 1 : 0,
tag_line_color: $.trim($('#qlo-bulk-tl-color').val()),
tag_line_font_size: $('#qlo-bulk-tl-font-size').val(),
tag_line_font_weight: $('#qlo-bulk-tl-font-weight').val()
};
if (updateTagline) {
$('.qlo-bulk-tagline-field').each(function () {
postData['tag_line_' + $(this).data('lang')] = $.trim($(this).val());
});
}
var $btn = $(this).prop('disabled', true);
$('#page-loader').show();
$.ajax({
@@ -215,16 +235,11 @@ $(document).ready(function () {
$btn.prop('disabled', false);
var data = safeParseJsonHm(raw);
if (data && data.success) {
var updatedTagLines = safeParseJsonHm(data.tag_lines_json) || tagLines;
$('#qlo-image-tbody .qlo-img-row').each(function () {
$(this).attr('data-tag-lines', data.tag_lines_json);
$(this).data('tag-lines', updatedTagLines);
var display = data.tag_line || '';
$(this).find('.qlo-img-tagline-cell').text(
display.length > 50 ? display.substring(0, 50) + '...' : (display || '—')
);
(data.data.rows || []).forEach(function (rowData) {
var $row = $('#qlo-image-tbody .qlo-img-row[data-id="' + rowData.id + '"]');
patchImageRow($row, rowData);
});
$('#qlo-bulk-tagline-modal').modal('hide');
$('#qlo-bulk-update-modal').modal('hide');
showSuccessMessage(data.confirmations);
} else {
showErrorMessage(data ? data.errors.join('<br>') : qloHmI18n.updateFailed);
@@ -355,7 +370,6 @@ $(document).ready(function () {
$('#qlo-img-add-footer').hide();
$('#qlo-img-edit-footer').show();
$('#qlo-img-form-file-group').hide();
$('#qlo-img-files-list').hide().empty();
$('#qlo-img-form-add-active-group').hide();
$('#qlo-img-form-edit-group').show();
if (isActive) {
@@ -391,7 +405,7 @@ $(document).ready(function () {
if (fileInput) {
fileInput.value = '';
}
$('#qlo-img-files-list').hide().empty();
$('#qlo-img-form-file-name').val('');
$('#qlo_img_active_add_on').prop('checked', true);
$('.qlo-form-tagline-field').val('');
$('#qlo-img-tl-color').val('#ffffff');
@@ -441,24 +455,7 @@ $(document).ready(function () {
var resp = safeParseJsonHm(raw);
if (resp && resp.success) {
var $row = $('#qlo-image-tbody .qlo-img-row[data-id="' + id + '"]');
var updatedTagLines = safeParseJsonHm(resp.tag_lines_json) || tagLines;
$row.attr('data-tag-lines', resp.tag_lines_json);
$row.data('tag-lines', updatedTagLines);
$row.attr('data-tag-line-color', resp.tag_line_color || '#ffffff');
$row.attr('data-tag-line-font-size', resp.tag_line_font_size || 16);
$row.attr('data-tag-line-font-weight', resp.tag_line_font_weight || '400');
var display = resp.tag_line || '';
$row.find('.qlo-img-tagline-cell').text(
display.length > 50 ? display.substring(0, 50) + '...' : (display || '—')
);
var nowActive = parseInt(resp.active, 10);
var $toggle = $row.find('.list-action-enable');
$toggle.toggleClass('action-enabled', !!nowActive)
.toggleClass('action-disabled', !nowActive);
$toggle.find('i.icon-check').toggleClass('hidden', !nowActive);
$toggle.find('i.icon-remove').toggleClass('hidden', !!nowActive);
$toggle.attr('href', $toggle.attr('href').replace(/id_header_image=\d+/, 'id_header_image=' + id)
.replace(/active=\d+/, 'active=' + (nowActive ? 0 : 1)));
patchImageRow($row, $.extend({ id: id }, resp));
closeImgForm();
showSuccessMessage(resp.confirmations || qloHmI18n.imageUpdatedSuccess);
} else {
@@ -516,14 +513,7 @@ $(document).ready(function () {
success: function (raw) {
var resp = safeParseJsonHm(raw);
if (resp && resp.success) {
var uploadedTagLines = safeParseJsonHm(resp.tag_lines_json) || tagLines;
appendImageRow(
resp.id, resp.imgUrl, resp.tag_line || '', uploadedTagLines, resp.tag_lines_json || '{}',
parseInt(resp.active, 10),
resp.tag_line_color || '#ffffff',
resp.tag_line_font_size || 16,
resp.tag_line_font_weight || '400'
);
appendImageRow(resp.data.image_row);
showSuccessMessage(qloHmI18n.imageUploadedSuccess);
} else {
showErrorMessage(file.name + ': ' + (resp ? resp.errors.join(', ') : qloHmI18n.uploadFailed));
@@ -539,65 +529,8 @@ $(document).ready(function () {
next();
}
function appendImageRow(id, imgUrl, tagLineDisplay, tagLines, tagLinesJson, active, tlColor, tlFontSize, tlFontWeight) {
id = parseInt(id, 10);
active = active !== undefined ? !!active : true;
tlColor = tlColor || '#ffffff';
tlFontSize = tlFontSize || 16;
tlFontWeight = tlFontWeight || '400';
var display = tagLineDisplay || '';
var cellText = display.length > 50 ? display.substring(0, 50) + '...' : (display || '—');
var pos = parseInt($('#qlo-image-count').text(), 10) + 1;
var nextActive = active ? 0 : 1;
var toggleUrl = qloHmCurrentIndex + '&ajax=1&action=toggle_image_active&id_header_image=' + id + '&active=' + nextActive + '&token=' + qloHmToken;
var toggleClass = active ? 'action-enabled' : 'action-disabled';
var checkHidden = active ? '' : ' hidden';
var removeHidden = active ? ' hidden' : '';
var $row = $(
'<tr class="qlo-img-row" id="qlo_img_' + id + '" data-id="' + id + '"' +
' data-thumb-src="' + escapeAttrHm(imgUrl) + '"' +
' data-tag-lines="' + escapeAttrHm(tagLinesJson) + '"' +
' data-tag-line-color="' + escapeAttrHm(tlColor) + '"' +
' data-tag-line-font-size="' + parseInt(tlFontSize, 10) + '"' +
' data-tag-line-font-weight="' + escapeAttrHm(tlFontWeight) + '">' +
'<td class="row-selector text-center"><input type="checkbox" name="htl_header_imageBox[]" class="noborder qlo-img-checkbox" value="' + id + '"></td>' +
'<td><img src="' + escapeHtmlHm(imgUrl) + '" class="qlo-img-thumb img-thumbnail" alt=""></td>' +
'<td class="qlo-img-tagline-cell">' + escapeHtmlHm(cellText) + '</td>' +
'<td class="pointer dragHandle center positionImage" id="td_qlo_img_' + id + '">' +
'<div class="dragGroup"><div class="positions">' + pos + '</div></div>' +
'</td>' +
'<td class="center">' +
'<a class="list-action-enable ajax_table_link ' + toggleClass + '"' +
' href="' + escapeAttrHm(toggleUrl) + '">' +
'<i class="icon-check' + checkHidden + '"></i>' +
'<i class="icon-remove' + removeHidden + '"></i>' +
'</a>' +
'</td>' +
'<td class="text-right">' +
'<div class="btn-group-action">' +
'<div class="btn-group pull-right">' +
'<button type="button" class="btn btn-default qlo-edit-img" data-id="' + id + '">' +
'<i class="icon-pencil"></i>&nbsp;' + qloHmI18n.editLabel +
'</button>' +
'<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">' +
'<i class="icon-caret-down"></i>&nbsp;' +
'</button>' +
'<ul class="dropdown-menu">' +
'<li>' +
'<a href="javascript:void(0);" class="qlo-delete-img" data-id="' + id + '">' +
'<i class="icon-trash"></i>&nbsp;' + qloHmI18n.deleteImageLabel +
'</a>' +
'</li>' +
'</ul>' +
'</div>' +
'</div>' +
'</td>' +
'</tr>'
);
$row.data('tag-lines', tagLines);
$('#qlo-image-tbody').append($row);
function appendImageRow(rowHtml) {
$('#qlo-image-tbody').append(rowHtml);
$('#qlo-image-table').tableDnDUpdate();
$('#qlo-no-images').hide();
$('#qlo-image-count').text(parseInt($('#qlo-image-count').text(), 10) + 1);
@@ -607,27 +540,32 @@ $(document).ready(function () {
function updateBulkActionsVisibility() {
var count = $('#qlo-image-tbody .qlo-img-row').length;
$('#qlo-bulk-actions-row').toggle(count > 1);
updateBulkUpdateTriggerState();
}
function patchImageRow($row, data) {
var id = parseInt(data.id, 10);
var updatedTagLines = safeParseJsonHm(data.tag_lines_json) || {};
$row.attr('data-tag-lines', data.tag_lines_json);
$row.data('tag-lines', updatedTagLines);
$row.attr('data-tag-line-color', data.tag_line_color || '#ffffff');
$row.attr('data-tag-line-font-size', data.tag_line_font_size || 16);
$row.attr('data-tag-line-font-weight', data.tag_line_font_weight || '400');
var display = data.tag_line || '';
$row.find('.qlo-img-tagline-cell').text(
display.length > 50 ? display.substring(0, 50) + '...' : (display || '—')
);
var nowActive = parseInt(data.active, 10);
var $toggle = $row.find('.list-action-enable');
$toggle.toggleClass('action-enabled', !!nowActive)
.toggleClass('action-disabled', !nowActive);
$toggle.find('i.icon-check').toggleClass('hidden', !nowActive);
$toggle.find('i.icon-remove').toggleClass('hidden', !!nowActive);
$toggle.attr('href', $toggle.attr('href').replace(/id_header_image=\d+/, 'id_header_image=' + id)
.replace(/active=\d+/, 'active=' + (nowActive ? 0 : 1)));
}
function safeParseJsonHm(raw) {
try { return JSON.parse(raw); } catch (_e) { return null; }
}
function escapeHtmlHm(str) {
return String(str)
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
}
function escapeAttrHm(str) {
return String(str)
.replace(/&/g, '&amp;')
.replace(/"/g, '&quot;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
}
});

View File

@@ -0,0 +1,73 @@
{**
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License version 3.0
* that is bundled with this package in the file LICENSE.md
* It is also available through the world-wide-web at this URL:
* https://opensource.org/license/osl-3-0-php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to support@qloapps.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to a newer
* versions in the future. If you wish to customize this module for your needs
* please refer to https://store.webkul.com/customisation-guidelines for more information.
*
* @author Webkul IN
* @copyright Since 2010 Webkul
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
*}
<tr class="qlo-img-row" id="qlo_img_{$img.id_header_image|intval}"
data-id="{$img.id_header_image|intval}"
data-thumb-src="{$imgBaseUrl|escape:'htmlall':'UTF-8'}{$img.name|escape:'htmlall':'UTF-8'}"
data-tag-lines="{$img.tag_lines_json|escape:'htmlall':'UTF-8'}"
data-tag-line-color="{$img.tag_line_color|default:'#ffffff'|escape:'htmlall':'UTF-8'}"
data-tag-line-font-size="{$img.tag_line_font_size|default:16|intval}"
data-tag-line-font-weight="{$img.tag_line_font_weight|default:'400'|escape:'htmlall':'UTF-8'}">
<td class="row-selector text-center">
<input type="checkbox" name="htl_header_imageBox[]" class="noborder qlo-img-checkbox" value="{$img.id_header_image|intval}">
</td>
<td>
{if $img.thumb}{$img.thumb nofilter}{else}<img src="{$imgBaseUrl|escape:'html':'UTF-8'}{$img.name|escape:'html':'UTF-8'}" class="img-thumbnail" width="100" alt="">{/if}
</td>
<td class="qlo-img-tagline-cell">
{if $img.tag_line}{$img.tag_line|truncate:50:'...'|escape:'html':'UTF-8'}{else}&mdash;{/if}
</td>
<td class="pointer dragHandle center positionImage" id="td_qlo_img_{$img.id_header_image|intval}">
<div class="dragGroup">
<div class="positions">{$position|intval}</div>
</div>
</td>
<td class="center">
<a class="list-action-enable ajax_table_link {if $img.active}action-enabled{else}action-disabled{/if}"
href="{$current|escape:'html':'UTF-8'}&amp;ajax=1&amp;action=toggle_image_active&amp;id_header_image={$img.id_header_image|intval}&amp;active={if $img.active}0{else}1{/if}&amp;token={$token|escape:'html':'UTF-8'}"
title="{if $img.active}{l s='Enabled' mod='hotelreservationsystem'}{else}{l s='Disabled' mod='hotelreservationsystem'}{/if}">
<i class="icon-check{if !$img.active} hidden{/if}"></i>
<i class="icon-remove{if $img.active} hidden{/if}"></i>
</a>
</td>
<td class="text-right">
<div class="btn-group-action">
<div class="btn-group pull-right">
<button type="button" class="btn btn-default btn qlo-edit-img"
data-id="{$img.id_header_image|intval}">
<i class="icon-pencil"></i>&nbsp;{l s='Edit' mod='hotelreservationsystem'}
</button>
<button class="btn btn-default btn dropdown-toggle" data-toggle="dropdown">
<i class="icon-caret-down"></i>&nbsp;
</button>
<ul class="dropdown-menu">
<li>
<a href="javascript:void(0);" class="qlo-delete-img"
data-id="{$img.id_header_image|intval}">
<i class="icon-trash"></i>&nbsp;{l s='Delete image' mod='hotelreservationsystem'}
</a>
</li>
</ul>
</div>
</div>
</td>
</tr>

View File

@@ -78,7 +78,7 @@
<div class="input-group fixed-width-lg">
<input type="text" name="QLO_HEADER_SLIDER_INTERVAL"
class="form-control"
value="{$config.QLO_HEADER_SLIDER_INTERVAL|intval}">
value="{$config.QLO_HEADER_SLIDER_INTERVAL|escape:'html':'UTF-8'}">
<span class="input-group-addon">ms</span>
</div>
<p class="help-block">{l s='Milliseconds between slides. Min: 500. Example: 5000 = 5 s.' mod='hotelreservationsystem'}</p>
@@ -128,19 +128,17 @@
<div id="qlo-video-settings"{if $config.QLO_HEADER_MEDIA_TYPE != HotelHeaderImage::MEDIA_TYPE_VIDEO} style="display:none"{/if}>
{if $videoItem}{assign var="currentSourceType" value=$videoItem.source_type}{else}{assign var="currentSourceType" value='upload'}{/if}
<div class="form-group">
<label class="control-label col-lg-3">{l s='Video Source' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<select name="source_type" id="qlo-source-type" class="fixed-width-lg">
<option value="upload"{if $currentSourceType != 'url'} selected{/if}>{l s='Upload video file' mod='hotelreservationsystem'}</option>
<option value="url"{if $currentSourceType == 'url'} selected{/if}>{l s='External video URL' mod='hotelreservationsystem'}</option>
<option value="upload"{if $sourceType != 'url'} selected{/if}>{l s='Upload video file' mod='hotelreservationsystem'}</option>
<option value="url"{if $sourceType == 'url'} selected{/if}>{l s='External video URL' mod='hotelreservationsystem'}</option>
</select>
</div>
</div>
<div id="qlo-vid-file-wrap"{if $currentSourceType == 'url'} style="display:none"{/if}>
<div id="qlo-vid-file-wrap"{if $sourceType == 'url'} style="display:none"{/if}>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Video File' mod='hotelreservationsystem'}</label>
<div class="col-lg-6">
@@ -161,21 +159,21 @@
</div>
</div>
<div id="qlo-vid-url-wrap"{if $currentSourceType != 'url'} style="display:none"{/if}>
<div id="qlo-vid-url-wrap"{if $sourceType != 'url'} style="display:none"{/if}>
<div class="form-group">
<label class="control-label col-lg-3">{l s='External Video URL' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<input type="text" name="video_url" id="qlo-video-url-input" class="form-control"
placeholder="https://example.com/video.mp4"
value="{if $videoItem && $videoItem.source_type == 'url'}{$videoItem.name|escape:'html':'UTF-8'}{/if}">
value="{$videoUrlValue|escape:'html':'UTF-8'}">
<p class="help-block">{l s='Enter a direct URL to an MP4, WebM, or OGG video file (server-hosted only). Streaming links (e.g., YouTube, Vimeo) are not supported.' mod='hotelreservationsystem'}</p>
{if $videoItem && $videoItem.source_type == 'url'}
<p class="help-block">{l s='Entering a new URL will replace the current video.' mod='hotelreservationsystem'}</p>
{/if}
<div class="qlo-video-preview-card" id="qlo-video-url-preview-wrap"{if !($videoItem && $videoItem.source_type == 'url')} style="display:none"{/if}>
<div class="qlo-video-preview-card" id="qlo-video-url-preview-wrap"{if !$showVideoUrlPreview} style="display:none"{/if}>
<video controls muted preload="metadata" class="qlo-video-preview-player" id="qlo-video-url-preview-player">
<source id="qlo-video-url-preview-source"
src="{if $videoItem && $videoItem.source_type == 'url'}{$videoItem.name|escape:'html':'UTF-8'}{/if}"
src="{$videoUrlValue|escape:'html':'UTF-8'}"
type="{$videoMimeType|escape:'html':'UTF-8'}">
{l s='Your browser does not support the video tag.' mod='hotelreservationsystem'}
</video>
@@ -185,7 +183,7 @@
</div>
{if $videoItem && $videoItem.source_type == 'upload'}
<div id="qlo-current-video-wrap">
<div id="qlo-current-video-wrap"{if $sourceType != 'upload'} style="display:none"{/if}>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Current Video' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
@@ -227,6 +225,7 @@
<p>{l s='Switching to Video will delete all images except the first one. This cannot be undone. Continue?' mod='hotelreservationsystem'}</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-close" data-dismiss="modal">{l s='Close' mod='hotelreservationsystem'}</button>
<button type="button" class="btn btn-primary" id="qlo-confirm-switch-video-btn">{l s='Continue' mod='hotelreservationsystem'}</button>
</div>
</div>
@@ -249,6 +248,7 @@
<p>{l s='Delete selected images? This cannot be undone.' mod='hotelreservationsystem'}</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-close" data-dismiss="modal">{l s='Close' mod='hotelreservationsystem'}</button>
<button type="button" class="btn btn-primary" id="qlo-confirm-bulk-delete-btn">{l s='Delete' mod='hotelreservationsystem'}</button>
</div>
</div>
@@ -261,12 +261,9 @@
<i class="icon-picture"></i>&nbsp;{l s='Header Images' mod='hotelreservationsystem'}
&nbsp;<span class="badge" id="qlo-image-count">{$imageItems|count}</span>
<span class="panel-heading-action">
<a id="qlo-add-image-btn" class="btn btn-primary" href="javascript:void(0);" style="margin-right:170px;">
<a id="qlo-add-image-btn" class="btn btn-primary" href="javascript:void(0);">
<i class="icon-plus-sign"></i>&nbsp;{l s='Add Images' mod='hotelreservationsystem'}
</a>
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#qlo-bulk-tagline-modal" style="margin-right:15px;">
<i class="icon-pencil"></i>&nbsp;{l s='Set tag line for all images' mod='hotelreservationsystem'}
</button>
</span>
</div>
@@ -293,57 +290,7 @@
</thead>
<tbody id="qlo-image-tbody">
{foreach from=$imageItems item=img}
<tr class="qlo-img-row" id="qlo_img_{$img.id_header_image|intval}"
data-id="{$img.id_header_image|intval}"
data-thumb-src="{$imgBaseUrl|escape:'htmlall':'UTF-8'}{$img.name|escape:'htmlall':'UTF-8'}"
data-tag-lines="{$img.tag_lines_json|escape:'htmlall':'UTF-8'}"
data-tag-line-color="{$img.tag_line_color|default:'#ffffff'|escape:'htmlall':'UTF-8'}"
data-tag-line-font-size="{$img.tag_line_font_size|default:16|intval}"
data-tag-line-font-weight="{$img.tag_line_font_weight|default:'400'|escape:'htmlall':'UTF-8'}">
<td class="row-selector text-center">
<input type="checkbox" name="htl_header_imageBox[]" class="noborder qlo-img-checkbox" value="{$img.id_header_image|intval}">
</td>
<td>
{if $img.thumb}{$img.thumb nofilter}{else}<img src="{$imgBaseUrl|escape:'html':'UTF-8'}{$img.name|escape:'html':'UTF-8'}" class="imgm img-thumbnail" alt="">{/if}
</td>
<td class="qlo-img-tagline-cell">
{if $img.tag_line}{$img.tag_line|truncate:50:'...'|escape:'html':'UTF-8'}{else}&mdash;{/if}
</td>
<td class="pointer dragHandle center positionImage" id="td_qlo_img_{$img.id_header_image|intval}">
<div class="dragGroup">
<div class="positions">{$img@iteration}</div>
</div>
</td>
<td class="center">
<a class="list-action-enable ajax_table_link {if $img.active}action-enabled{else}action-disabled{/if}"
href="{$current|escape:'html':'UTF-8'}&amp;ajax=1&amp;action=toggle_image_active&amp;id_header_image={$img.id_header_image|intval}&amp;active={if $img.active}0{else}1{/if}&amp;token={$token|escape:'html':'UTF-8'}"
title="{if $img.active}{l s='Enabled' mod='hotelreservationsystem'}{else}{l s='Disabled' mod='hotelreservationsystem'}{/if}">
<i class="icon-check{if !$img.active} hidden{/if}"></i>
<i class="icon-remove{if $img.active} hidden{/if}"></i>
</a>
</td>
<td class="text-right">
<div class="btn-group-action">
<div class="btn-group pull-right">
<button type="button" class="btn btn-default btn qlo-edit-img"
data-id="{$img.id_header_image|intval}">
<i class="icon-pencil"></i>&nbsp;{l s='Edit' mod='hotelreservationsystem'}
</button>
<button class="btn btn-default btn dropdown-toggle" data-toggle="dropdown">
<i class="icon-caret-down"></i>&nbsp;
</button>
<ul class="dropdown-menu">
<li>
<a href="javascript:void(0);" class="qlo-delete-img"
data-id="{$img.id_header_image|intval}">
<i class="icon-trash"></i>&nbsp;{l s='Delete image' mod='hotelreservationsystem'}
</a>
</li>
</ul>
</div>
</div>
</td>
</tr>
{include file="../../_partials/htl-header-image-row.tpl" img=$img position=$img@iteration}
{foreachelse}
<tr class="list-empty-tr" id="qlo-no-images">
<td class="list-empty" colspan="6">
@@ -366,24 +313,19 @@
</button>
<ul class="dropdown-menu">
<li>
<a href="#" onclick="javascript:checkDelBoxes($(this).closest('form').get(0), 'htl_header_imageBox[]', true);return false;">
<a href="#" class="qlo-select-all-images" onclick="javascript:checkDelBoxes($(this).closest('form').get(0), 'htl_header_imageBox[]', true);return false;">
<i class="icon-check-sign"></i>&nbsp;{l s='Select all' mod='hotelreservationsystem'}
</a>
</li>
<li>
<a href="#" onclick="javascript:checkDelBoxes($(this).closest('form').get(0), 'htl_header_imageBox[]', false);return false;">
<a href="#" class="qlo-unselect-all-images" onclick="javascript:checkDelBoxes($(this).closest('form').get(0), 'htl_header_imageBox[]', false);return false;">
<i class="icon-check-empty"></i>&nbsp;{l s='Unselect all' mod='hotelreservationsystem'}
</a>
</li>
<li class="divider"></li>
<li>
<a href="#" onclick="sendBulkAction($(this).closest('form').get(0), 'submitBulkenableSelectionhtl_header_image');return false;">
<i class="icon-power-off text-success"></i>&nbsp;{l s='Enable selection' mod='hotelreservationsystem'}
</a>
</li>
<li>
<a href="#" onclick="sendBulkAction($(this).closest('form').get(0), 'submitBulkdisableSelectionhtl_header_image');return false;">
<i class="icon-power-off text-danger"></i>&nbsp;{l s='Disable selection' mod='hotelreservationsystem'}
<a href="#" id="qlo-bulk-update-trigger" data-toggle="modal" data-target="#qlo-bulk-update-modal" disabled>
<i class="icon-edit"></i>&nbsp;{l s='Update selection' mod='hotelreservationsystem'}
</a>
</li>
<li class="divider"></li>
@@ -402,22 +344,48 @@
</div>
</div>
{* Bulk tag line modal — triggered by the "Set tag line for all images" button above *}
<div class="modal fade" id="qlo-bulk-tagline-modal" tabindex="-1" role="dialog" aria-labelledby="qloBulkTaglineModalLabel">
{* Bulk update modal — triggered by the "Bulk update" bulk action; only touches fields the admin actually sets *}
<div class="modal fade" id="qlo-bulk-update-modal" tabindex="-1" role="dialog" aria-labelledby="qloBulkUpdateModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="qloBulkTaglineModalLabel">
<i class="icon-pencil"></i>&nbsp;{l s='Set tag line for all images' mod='hotelreservationsystem'}
<h4 class="modal-title" id="qloBulkUpdateModalLabel">
<i class="icon-edit"></i>&nbsp;{l s='Bulk Update Images' mod='hotelreservationsystem'}
</h4>
</div>
<div class="modal-body">
<div class="form-horizontal">
<div class="form-group">
<label class="control-label col-lg-3">{l s='Tag Line (All Images)' mod='hotelreservationsystem'}</label>
<label class="control-label col-lg-3">{l s='Enable Image' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<select id="qlo-bulk-active" class="fixed-width-lg">
<option value="" selected="selected">{l s='Select status' mod='hotelreservationsystem'}</option>
<option value="1">{l s='Yes' mod='hotelreservationsystem'}</option>
<option value="0">{l s='No' mod='hotelreservationsystem'}</option>
</select>
<p class="help-block">{l s='Leave as "Select status" to keep each image\'s current active status unchanged.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Update Tag Line' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="qlo_bulk_update_tagline" id="qlo_bulk_update_tagline_on" value="1">
<label for="qlo_bulk_update_tagline_on">{l s='Yes' mod='hotelreservationsystem'}</label>
<input type="radio" name="qlo_bulk_update_tagline" id="qlo_bulk_update_tagline_off" value="0" checked="checked">
<label for="qlo_bulk_update_tagline_off">{l s='No' mod='hotelreservationsystem'}</label>
<a class="slide-button btn"></a>
</span>
<p class="help-block">{l s='Turn on to overwrite the tag line text for all selected images.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group" id="qlo-bulk-tagline-fields-wrap" style="display:none">
<label class="control-label col-lg-3">{l s='Tag Line' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
{foreach from=$languages item=lang}
{if count($languages) > 1}
@@ -427,7 +395,7 @@
<input type="text"
class="form-control qlo-bulk-tagline-field"
data-lang="{$lang.id_lang}"
placeholder="{l s='Tag line for all images...' mod='hotelreservationsystem'}" />
placeholder="{l s='Tag line...' mod='hotelreservationsystem'}" />
{if count($languages) > 1}
</div>
<div class="col-lg-2">
@@ -443,13 +411,46 @@
</div>
{/if}
{/foreach}
<p class="help-block">{l s='This will overwrite the tag line for all images in every language.' mod='hotelreservationsystem'}</p>
<p class="help-block">{l s='Leave empty to clear the tag line for all selected images.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Tag Line Color' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<input type="text" id="qlo-bulk-tl-color" class="form-control" placeholder="#ffffff" maxlength="7">
<p class="help-block">{l s='6-digit hex value. Leave empty to keep each image\'s current color unchanged.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Tag Line Font Size' mod='hotelreservationsystem'}</label>
<div class="col-lg-3">
<div class="input-group">
<input type="number" id="qlo-bulk-tl-font-size" class="form-control" value="0" min="0" max="72">
<span class="input-group-addon">px</span>
</div>
<p class="help-block">{l s='0 = keep each image\'s current font size unchanged.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Tag Line Font Weight' mod='hotelreservationsystem'}</label>
<div class="col-lg-3">
<select id="qlo-bulk-tl-font-weight" class="fixed-width-lg">
<option value="" selected="selected">{l s='Select font weight' mod='hotelreservationsystem'}</option>
<option value="300">{l s='300 (Light)' mod='hotelreservationsystem'}</option>
<option value="400">{l s='400 (Normal)' mod='hotelreservationsystem'}</option>
<option value="600">{l s='600 (Semi-Bold)' mod='hotelreservationsystem'}</option>
<option value="700">{l s='700 (Bold)' mod='hotelreservationsystem'}</option>
</select>
<p class="help-block">{l s='Leave unselected to keep each image\'s current font weight unchanged.' mod='hotelreservationsystem'}</p>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="qlo-bulk-tagline-apply">{l s='Apply to All' mod='hotelreservationsystem'}</button>
<button type="button" class="btn btn-primary" id="qlo-bulk-update-apply">{l s='Submit' mod='hotelreservationsystem'}</button>
</div>
</div>
</div>
@@ -469,7 +470,7 @@
<div class="modal-body">
<div class="form-horizontal">
<div class="form-group" id="qlo-img-edit-preview-group" style="display:none">
<label class="control-label col-lg-3">{l s='Editing Image' mod='hotelreservationsystem'}</label>
<label class="control-label col-lg-3">{l s='Image' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<img id="qlo-img-edit-thumb" src="" class="img-thumbnail" alt=""
style="max-width:160px;max-height:100px;object-fit:cover;">
@@ -478,17 +479,20 @@
<div class="form-group" id="qlo-img-form-file-group">
<label class="control-label col-lg-3 file_upload_label">
{l s='Add Images' mod='hotelreservationsystem'}
{l s='Images' mod='hotelreservationsystem'}
</label>
<div class="col-lg-9">
<input type="file" id="qlo-img-form-file" multiple
accept="image/jpeg,image/jpg,image/png,image/webp,image/gif"
style="width:0;height:0;overflow:hidden;position:absolute;">
<button class="btn btn-default" data-style="expand-right" data-size="s"
type="button" id="qlo-img-file-add-btn">
<i class="icon-folder-open"></i> {l s='Add files...' mod='hotelreservationsystem'}
</button>
<ul id="qlo-img-files-list" class="qlo-files-list" style="display:none"></ul>
accept="image/jpeg,image/jpg,image/png,image/webp,image/gif" class="hide">
<div class="dummyfile input-group">
<span class="input-group-addon"><i class="icon-file"></i></span>
<input id="qlo-img-form-file-name" type="text" readonly>
<span class="input-group-btn">
<button id="qlo-img-form-file-selectbutton" type="button" class="btn btn-default">
<i class="icon-folder-open"></i> {l s='Add file' mod='hotelreservationsystem'}
</button>
</span>
</div>
<p class="help-block">
{l s='Formats: .jpg, .jpeg, .png, .webp, .gif' mod='hotelreservationsystem'}
&mdash; {l s='Recommended: 1920×600 px' mod='hotelreservationsystem'}
@@ -558,7 +562,7 @@
<div class="form-group">
<label class="control-label col-lg-3">{l s='Tag Line Color' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<div class="input-group fixed-width-lg">
<div class="input-group col-lg-4">
<input type="color" id="qlo-img-tl-color" name="tag_line_color"
class="color mColorPickerInput" data-hex="true" value="#ffffff">
</div>
@@ -568,8 +572,8 @@
<div class="form-group">
<label class="control-label col-lg-3">{l s='Tag Line Font Size' mod='hotelreservationsystem'}</label>
<div class="col-lg-3">
<div class="input-group">
<div class="col-lg-9">
<div class="input-group col-lg-4">
<input type="number" id="qlo-img-tl-font-size" name="tag_line_font_size"
class="form-control" value="16" min="8" max="72">
<span class="input-group-addon">px</span>
@@ -580,8 +584,8 @@
<div class="form-group">
<label class="control-label col-lg-3">{l s='Tag Line Font Weight' mod='hotelreservationsystem'}</label>
<div class="col-lg-3">
<select id="qlo-img-tl-font-weight" name="tag_line_font_weight" class="fixed-width-lg">
<div class="col-lg-9">
<select id="qlo-img-tl-font-weight" name="tag_line_font_weight" class="col-lg-4">
<option value="300">{l s='300 (Light)' mod='hotelreservationsystem'}</option>
<option value="400" selected="selected">{l s='400 (Normal)' mod='hotelreservationsystem'}</option>
<option value="600">{l s='600 (Semi-Bold)' mod='hotelreservationsystem'}</option>
@@ -603,10 +607,10 @@
</div>
</div>
<div class="modal-footer" id="qlo-img-add-footer">
<button type="button" id="qlo-img-form-upload-btn" class="btn btn-primary">{l s='Upload' mod='hotelreservationsystem'}</button>
<button type="button" id="qlo-img-form-upload-btn" class="btn btn-primary"><i class="icon-upload"></i>&nbsp;{l s='Upload' mod='hotelreservationsystem'}</button>
</div>
<div class="modal-footer" id="qlo-img-edit-footer" style="display:none">
<button type="button" id="qlo-img-form-save-btn" class="btn btn-primary">{l s='Save' mod='hotelreservationsystem'}</button>
<button type="button" id="qlo-img-form-save-btn" class="btn btn-primary"><i class="icon-save"></i>&nbsp;{l s='Save' mod='hotelreservationsystem'}</button>
</div>
</div>
</div>