multiple issues fixed

This commit is contained in:
azhar bhat
2026-08-20 16:02:48 +05:30
parent cc352ffd75
commit 976cb8fd26
12 changed files with 378 additions and 266 deletions

View File

@@ -1216,42 +1216,6 @@ class FrontControllerCore extends Controller
'WK_DISPLAY_PROPERTIES_LINK_IN_HEADER' => Configuration::get('WK_DISPLAY_PROPERTIES_LINK_IN_HEADER'),
));
if ($this->php_self === 'index') {
$mediaTypeInt = (int)(Configuration::get('QLO_HEADER_MEDIA_TYPE') ?: HotelHeaderImage::MEDIA_TYPE_IMAGE);
if ($mediaTypeInt === HotelHeaderImage::MEDIA_TYPE_VIDEO) {
$videoConfig = HotelHeaderImage::getVideoConfig();
if ($videoConfig) {
$mimeMap = array('mp4' => 'video/mp4', 'webm' => 'video/webm', 'ogg' => 'video/ogg');
if ($videoConfig['source_type'] === 'upload') {
$ext = strtolower(pathinfo($videoConfig['name'], PATHINFO_EXTENSION));
} else {
$urlPath = parse_url($videoConfig['name'], PHP_URL_PATH);
$ext = strtolower(pathinfo($urlPath ?: '', PATHINFO_EXTENSION));
}
$videoConfig['mime_type'] = isset($mimeMap[$ext]) ? $mimeMap[$ext] : 'video/mp4';
$headerMediaItems = array($videoConfig);
} else {
$headerMediaItems = array();
}
} else {
$headerMediaItems = HotelHeaderImage::getItems();
}
$this->context->smarty->assign(array(
'QLO_HEADER_MEDIA_TYPE' => $mediaTypeInt,
'QLO_HEADER_MEDIA_TYPE_IMAGE' => HotelHeaderImage::MEDIA_TYPE_IMAGE,
'QLO_HEADER_MEDIA_TYPE_VIDEO' => HotelHeaderImage::MEDIA_TYPE_VIDEO,
'WK_HEADER_NAV_TYPE_DOTS' => HotelHeaderImage::NAV_TYPE_DOTS,
'QLO_HEADER_ANIM_TYPE_SLIDE' => HotelHeaderImage::ANIM_TYPE_SLIDE,
'headerMediaItems' => $headerMediaItems,
'headerSliderConfig' => array(
'nav_type' => (int)(Configuration::get('QLO_HEADER_SLIDER_NAV_TYPE') ?: HotelHeaderImage::NAV_TYPE_DOTS),
'auto_play' => (int)Configuration::get('QLO_HEADER_SLIDER_AUTO_PLAY'),
'interval' => (int)Configuration::get('QLO_HEADER_SLIDER_INTERVAL'),
'anim_type' => (int)(Configuration::get('QLO_HEADER_SLIDER_ANIM_TYPE') ?: HotelHeaderImage::ANIM_TYPE_SLIDE),
),
));
}
$this->context->smarty->assign($this->initLogoAndFavicon());
}

View File

@@ -39,10 +39,10 @@ class HotelHeaderImage extends ObjectModel
const NAV_TYPE_ARROWS = 2;
const NAV_TYPE_BOTH = 3;
const ANIM_TYPE_SLIDE = 1;
const ANIM_TYPE_FADE = 2;
const ANIM_TYPE_ZOOM = 3;
const ANIM_TYPE_BLUR = 4;
const ANIMATION_TYPE_SLIDE = 1;
const ANIMATION_TYPE_FADE = 2;
const ANIMATION_TYPE_ZOOM = 3;
const ANIMATION_TYPE_BLUR = 4;
const CONTENT_ALIGN_LEFT = 1;
const CONTENT_ALIGN_CENTER = 2;
@@ -55,6 +55,7 @@ class HotelHeaderImage extends ObjectModel
public $tag_line_font_size = 16;
public $tag_line_font_weight = '400';
public $active;
public $show_hotel_name = 1;
public $date_add;
public $date_upd;
@@ -70,6 +71,7 @@ class HotelHeaderImage extends ObjectModel
'tag_line_font_weight' => array('type' => self::TYPE_STRING, 'size' => 10),
'position' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'show_hotel_name' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
),

View File

@@ -1061,8 +1061,7 @@ class HotelHelper
Configuration::updateValue('QLO_HEADER_SLIDER_NAV_TYPE', HotelHeaderImage::NAV_TYPE_DOTS);
Configuration::updateValue('QLO_HEADER_SLIDER_AUTO_PLAY', 1);
Configuration::updateValue('QLO_HEADER_SLIDER_INTERVAL', 5000);
Configuration::updateValue('QLO_HEADER_SLIDER_ANIM_TYPE', HotelHeaderImage::ANIM_TYPE_SLIDE);
Configuration::updateValue('QLO_HOTEL_NAME_ENABLE', 0);
Configuration::updateValue('QLO_HEADER_SLIDER_ANIM_TYPE', HotelHeaderImage::ANIMATION_TYPE_SLIDE);
Configuration::updateValue('QLO_HEADER_CONTENT_ALIGN', HotelHeaderImage::CONTENT_ALIGN_CENTER);
Configuration::updateValue('QLO_HEADER_VIDEO_SOURCE_TYPE', '');
Configuration::updateValue('QLO_HEADER_VIDEO_NAME', '');

View File

@@ -521,6 +521,7 @@ class HotelReservationSystemDb
`tag_line_font_weight` VARCHAR(10) NOT NULL DEFAULT '400',
`position` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`active` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',
`show_hotel_name` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',
`date_add` DATETIME NOT NULL,
`date_upd` DATETIME NOT NULL,
PRIMARY KEY (`id_header_image`)

View File

@@ -1025,7 +1025,7 @@ class AdminAddHotelController extends ModuleAdminController
$this->addJqueryUI('ui.sortable');
$this->addJS(_MODULE_DIR_.$this->module->name.'/views/js/hotelImage.js');
$this->addJS(_MODULE_DIR_.$this->module->name.'/views/js/admin/qhrs_hotel_image.js');
$this->addJS(_MODULE_DIR_.$this->module->name.'/views/js/HotelReservationAdmin.js');
$this->addCSS(_MODULE_DIR_.$this->module->name.'/views/css/HotelReservationAdmin.css');
}

View File

@@ -133,8 +133,7 @@ class AdminHotelHeaderImageController extends ModuleAdminController
'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' => 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_SLIDER_ANIM_TYPE' => (int)Tools::getValue('QLO_HEADER_SLIDER_ANIM_TYPE', (int)(Configuration::get('QLO_HEADER_SLIDER_ANIM_TYPE') ?: HotelHeaderImage::ANIMATION_TYPE_SLIDE)),
'QLO_HEADER_CONTENT_ALIGN' => (int)Tools::getValue('QLO_HEADER_CONTENT_ALIGN', (int)(Configuration::get('QLO_HEADER_CONTENT_ALIGN') ?: HotelHeaderImage::CONTENT_ALIGN_CENTER)),
),
'languages' => $languages,
@@ -197,7 +196,7 @@ class AdminHotelHeaderImageController extends ModuleAdminController
$autoPlay = 0;
$interval = 0;
$navType = HotelHeaderImage::NAV_TYPE_DOTS;
$animType = HotelHeaderImage::ANIM_TYPE_SLIDE;
$animType = HotelHeaderImage::ANIMATION_TYPE_SLIDE;
$contentAlign = HotelHeaderImage::CONTENT_ALIGN_CENTER;
if ($mediaType === HotelHeaderImage::MEDIA_TYPE_IMAGE) {
@@ -215,9 +214,9 @@ class AdminHotelHeaderImageController extends ModuleAdminController
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;
$animType = (int)Tools::getValue('QLO_HEADER_SLIDER_ANIM_TYPE', HotelHeaderImage::ANIMATION_TYPE_SLIDE);
if (!in_array($animType, array(HotelHeaderImage::ANIMATION_TYPE_SLIDE, HotelHeaderImage::ANIMATION_TYPE_FADE, HotelHeaderImage::ANIMATION_TYPE_ZOOM, HotelHeaderImage::ANIMATION_TYPE_BLUR))) {
$animType = HotelHeaderImage::ANIMATION_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))) {
@@ -252,7 +251,6 @@ class AdminHotelHeaderImageController extends ModuleAdminController
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);
@@ -396,6 +394,7 @@ class AdminHotelHeaderImageController extends ModuleAdminController
$objImage->name = $uniqueName;
$objImage->position = $objImage->getHigherPosition();
$objImage->active = (int)(bool)Tools::getValue('active', 1);
$objImage->show_hotel_name = (int)(bool)Tools::getValue('show_hotel_name', 1);
$objImage->tag_line = $tagLineByLang;
$objImage->tag_line_color = $tagLineColor;
$objImage->tag_line_font_size = $tagLineFontSize;
@@ -420,6 +419,7 @@ class AdminHotelHeaderImageController extends ModuleAdminController
'tag_line_font_size' => $tagLineFontSize,
'tag_line_font_weight' => $tagLineFontWeight,
'active' => (int)$objImage->active,
'show_hotel_name' => (int)$objImage->show_hotel_name,
),
'position' => count(HotelHeaderImage::getItems(null)),
'current' => self::$currentIndex,
@@ -468,6 +468,11 @@ class AdminHotelHeaderImageController extends ModuleAdminController
$objImage->active = $newActive;
}
$showHotelNameVal = Tools::getValue('show_hotel_name');
if ($showHotelNameVal !== false) {
$objImage->show_hotel_name = (int)(bool)$showHotelNameVal;
}
$tagLineColor = Tools::getValue('tag_line_color', $objImage->tag_line_color);
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).');
@@ -484,24 +489,78 @@ class AdminHotelHeaderImageController extends ModuleAdminController
$this->ajaxDie(json_encode($response));
}
$replacementFile = isset($_FILES['header_image_file']) ? $_FILES['header_image_file'] : null;
$hasReplacementFile = ($replacementFile && isset($replacementFile['error']) && $replacementFile['error'] === UPLOAD_ERR_OK && $replacementFile['size'] > 0);
$newImageName = null;
if ($hasReplacementFile) {
if ($error = ImageManager::validateUpload($replacementFile, Tools::getMaxUploadSize((int)Configuration::get('PS_LIMIT_UPLOAD_IMAGE_VALUE') * 1024 * 1024))) {
$response['errors'][] = $error;
$this->ajaxDie(json_encode($response));
}
if (!HotelHeaderImage::createMediaDirectory()) {
$response['errors'][] = $this->l('Could not create the media directory.');
$this->ajaxDie(json_encode($response));
}
$ext = strtolower(pathinfo($replacementFile['name'], PATHINFO_EXTENSION));
$isGif = ($ext === 'gif');
$outExt = $isGif ? 'gif' : 'jpg';
do {
$newImageName = bin2hex(random_bytes(16)).'.'.$outExt;
} while (file_exists(_PS_IMG_DIR_.'hotel_header_media/'.$newImageName));
$destPath = _PS_IMG_DIR_.'hotel_header_media/'.$newImageName;
$saved = $isGif ? (bool)move_uploaded_file($replacementFile['tmp_name'], $destPath) : (bool)ImageManager::resize($replacementFile['tmp_name'], $destPath);
if (!$saved) {
$response['errors'][] = $this->l('Failed to save image file.');
$this->ajaxDie(json_encode($response));
}
}
$oldImageName = $objImage->name;
$objImage->tag_line = $tagLineByLang;
$objImage->tag_line_color = $tagLineColor;
$objImage->tag_line_font_size = $tagLineFontSize;
$objImage->tag_line_font_weight = $tagLineFontWeight;
if ($newImageName) {
$objImage->name = $newImageName;
}
if (!$objImage->save()) {
if ($newImageName && file_exists($destPath)) {
unlink($destPath);
}
$response['errors'][] = $this->l('Failed to update image.');
$this->ajaxDie(json_encode($response));
}
if ($newImageName) {
$oldPath = _PS_IMG_DIR_.'hotel_header_media/'.$oldImageName;
if (file_exists($oldPath)) {
unlink($oldPath);
}
}
$defaultLangId = (int)Configuration::get('PS_LANG_DEFAULT');
$response['success'] = true;
$response['active'] = (int)$objImage->active;
$response['show_hotel_name'] = (int)$objImage->show_hotel_name;
$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;
if ($newImageName) {
$shopId = (int)$this->context->shop->id;
$srcPath = _PS_IMG_DIR_.'hotel_header_media/'.$newImageName;
$cacheName = 'htl_header_image_mini_'.$id.'_'.$shopId.'.jpg';
$response['thumb'] = ImageManager::thumbnail($srcPath, $cacheName, 45, 'jpg', true, true);
$response['thumb_src'] = $this->context->link->getMediaLink(_PS_IMG_.'hotel_header_media/'.$newImageName).'?'.time();
}
$this->ajaxDie(json_encode($response));
}
@@ -590,6 +649,34 @@ class AdminHotelHeaderImageController extends ModuleAdminController
$this->ajaxDie(json_encode($response));
}
public function ajaxProcessToggleImageHotelName()
{
$response = array('errors' => array(), 'success' => false);
$id = (int)Tools::getValue('id_header_image');
$showHotelName = (int)(bool)Tools::getValue('show_hotel_name');
if (!$id) {
$response['errors'][] = $this->l('Invalid item ID.');
$this->ajaxDie(json_encode($response));
}
$objImage = new HotelHeaderImage($id);
if (!Validate::isLoadedObject($objImage)) {
$response['errors'][] = $this->l('Image not found.');
$this->ajaxDie(json_encode($response));
}
$objImage->show_hotel_name = $showHotelName;
if (!$objImage->save()) {
$response['errors'][] = $this->l('Unable to update hotel name status.');
$this->ajaxDie(json_encode($response));
}
$response['success'] = true;
$response['confirmations'] = $this->l('The status has been successfully updated.');
$this->ajaxDie(json_encode($response));
}
public function ajaxProcessSaveImagePositions()
{
$ids = Tools::getValue('image_ids', array());
@@ -637,6 +724,12 @@ class AdminHotelHeaderImageController extends ModuleAdminController
}
}
$showHotelNameVal = Tools::getValue('show_hotel_name', '');
if ($showHotelNameVal !== '' && !in_array($showHotelNameVal, array('0', '1'))) {
$response['errors'][] = $this->l('Invalid hotel name status selected.');
$this->ajaxDie(json_encode($response));
}
$updateTagline = (bool)Tools::getValue('update_tagline', false);
$tagLineByLang = array();
if ($updateTagline) {
@@ -680,6 +773,9 @@ class AdminHotelHeaderImageController extends ModuleAdminController
if ($activeVal !== '') {
$objImage->active = (int)$activeVal;
}
if ($showHotelNameVal !== '') {
$objImage->show_hotel_name = (int)$showHotelNameVal;
}
if ($updateTagline) {
$objImage->tag_line = $tagLineByLang;
}
@@ -698,6 +794,7 @@ class AdminHotelHeaderImageController extends ModuleAdminController
$updatedRows[] = array(
'id' => (int)$objImage->id,
'active' => (int)$objImage->active,
'show_hotel_name' => (int)$objImage->show_hotel_name,
'tag_line' => isset($currentTagLines[$defaultLangId]) ? $currentTagLines[$defaultLangId] : '',
'tag_lines_json' => json_encode((object)$currentTagLines),
'tag_line_color' => $objImage->tag_line_color,
@@ -722,7 +819,9 @@ class AdminHotelHeaderImageController extends ModuleAdminController
parent::setMedia();
$this->addJqueryPlugin('tablednd');
$this->addJqueryPlugin('colorpicker');
$this->addJS(_MODULE_DIR_.'hotelreservationsystem/views/js/HotelHeaderImageAdmin.js');
$adminJsPath = _PS_MODULE_DIR_.'hotelreservationsystem/views/js/admin/qhrs_hotel_header_image_admin.js';
$this->addJS(_MODULE_DIR_.'hotelreservationsystem/views/js/admin/qhrs_hotel_header_image_admin.js?'.@filemtime($adminJsPath));
$this->addCSS(_MODULE_DIR_.'hotelreservationsystem/views/css/HotelReservationAdmin.css');
$this->addCSS(_MODULE_DIR_.'hotelreservationsystem/views/css/admin/qhrs_header_media.css');
}
}

View File

@@ -75,9 +75,44 @@ class HotelReservationSystem extends Module
}
//End
if (Tools::getValue('controller') == 'index') {
$this->context->controller->addJS($this->_path.'views/js/HotelHeaderMediaFront.js');
$headerMediaFrontJs = _PS_MODULE_DIR_.'hotelreservationsystem/views/js/qhrs_hotel_header_media_front.js';
$this->context->controller->addJS($this->_path.'views/js/qhrs_hotel_header_media_front.js?'.@filemtime($headerMediaFrontJs));
$mediaTypeInt = (int)(Configuration::get('QLO_HEADER_MEDIA_TYPE') ?: HotelHeaderImage::MEDIA_TYPE_IMAGE);
if ($mediaTypeInt === HotelHeaderImage::MEDIA_TYPE_VIDEO) {
$videoConfig = HotelHeaderImage::getVideoConfig();
if ($videoConfig) {
$mimeMap = array('mp4' => 'video/mp4', 'webm' => 'video/webm', 'ogg' => 'video/ogg');
if ($videoConfig['source_type'] === 'upload') {
$ext = strtolower(pathinfo($videoConfig['name'], PATHINFO_EXTENSION));
} else {
$urlPath = parse_url($videoConfig['name'], PHP_URL_PATH);
$ext = strtolower(pathinfo($urlPath ?: '', PATHINFO_EXTENSION));
}
$videoConfig['mime_type'] = isset($mimeMap[$ext]) ? $mimeMap[$ext] : 'video/mp4';
$headerMediaItems = array($videoConfig);
} else {
$headerMediaItems = array();
}
} else {
$headerMediaItems = HotelHeaderImage::getItems();
}
$this->context->smarty->assign(array(
'QLO_HEADER_MEDIA_TYPE' => $mediaTypeInt,
'QLO_HEADER_MEDIA_TYPE_IMAGE' => HotelHeaderImage::MEDIA_TYPE_IMAGE,
'QLO_HEADER_MEDIA_TYPE_VIDEO' => HotelHeaderImage::MEDIA_TYPE_VIDEO,
'WK_HEADER_NAV_TYPE_DOTS' => HotelHeaderImage::NAV_TYPE_DOTS,
'QLO_HEADER_ANIM_TYPE_SLIDE' => HotelHeaderImage::ANIMATION_TYPE_SLIDE,
'headerMediaItems' => $headerMediaItems,
'headerSliderConfig' => array(
'nav_type' => (int)(Configuration::get('QLO_HEADER_SLIDER_NAV_TYPE') ?: HotelHeaderImage::NAV_TYPE_DOTS),
'auto_play' => (int)Configuration::get('QLO_HEADER_SLIDER_AUTO_PLAY'),
'interval' => (int)Configuration::get('QLO_HEADER_SLIDER_INTERVAL'),
'anim_type' => (int)(Configuration::get('QLO_HEADER_SLIDER_ANIM_TYPE') ?: HotelHeaderImage::ANIMATION_TYPE_SLIDE),
),
));
}
$this->context->controller->addCSS($this->_path.'/views/css/HotelReservationFront.css');
$this->context->controller->addCSS($this->_path.'/views/css/qhrs_header_media.css');
$this->context->controller->addJS($this->_path.'/views/js/HotelReservationFront.js');
}
@@ -337,7 +372,7 @@ class HotelReservationSystem extends Module
'wkTagLineColor' => !empty($firstItem['tag_line_color']) ? $firstItem['tag_line_color'] : '#ffffff',
'wkTagLineFontSize' => !empty($firstItem['tag_line_font_size']) ? (int)$firstItem['tag_line_font_size'] : 16,
'wkTagLineFontWeight' => !empty($firstItem['tag_line_font_weight']) ? $firstItem['tag_line_font_weight'] : '400',
'QLO_HOTEL_NAME_ENABLE' => (int)Configuration::get('QLO_HOTEL_NAME_ENABLE'),
'wkShowHotelName' => !empty($firstItem['show_hotel_name']),
'wkHeaderContentAlign' => (int)(Configuration::get('QLO_HEADER_CONTENT_ALIGN') ?: HotelHeaderImage::CONTENT_ALIGN_CENTER),
'QLO_HEADER_MEDIA_TYPE' => (int)(Configuration::get('QLO_HEADER_MEDIA_TYPE') ?: HotelHeaderImage::MEDIA_TYPE_IMAGE),
'QLO_HEADER_MEDIA_TYPE_VIDEO' => HotelHeaderImage::MEDIA_TYPE_VIDEO,
@@ -662,7 +697,6 @@ class HotelReservationSystem extends Module
'WK_CUSTOMER_SUPPORT_EMAIL',
'WK_DISPLAY_CONTACT_PAGE_HOTEL_LIST',
'QLO_HEADER_MEDIA_TYPE',
'QLO_HOTEL_NAME_ENABLE',
'QLO_HEADER_CONTENT_ALIGN',
'QLO_HEADER_VIDEO_SOURCE_TYPE',
'QLO_HEADER_VIDEO_NAME',

View File

@@ -0,0 +1,64 @@
/**
* 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
*/
.qlo-video-preview-card {
background: #111;
border-radius: 4px;
overflow: hidden;
margin-bottom: 10px;
max-width: 480px;
display: inline-block;
vertical-align: top;
width: 100%;
}
.qlo-video-preview-player {
display: block;
width: 100%;
max-height: 240px;
background: #000;
}
.qlo-img-thumb {
width: 120px;
height: 75px;
-o-object-fit: cover;
object-fit: cover;
display: block;
}
#qlo-image-table tbody tr.qlo-img-row:hover {
background-color: #f9f9f9;
}
.qlo-img-tagline-cell {
max-width: 220px;
color: #555;
vertical-align: middle !important;
}
#qlo-img-edit-thumb {
max-width: 160px;
max-height: 100px;
object-fit: cover;
border-radius: 3px;
}

View File

@@ -22,7 +22,7 @@
.header-ext-dots {
position: absolute;
bottom: 14px;
bottom: 120px;
left: 0;
right: 0;
text-align: center;
@@ -54,15 +54,9 @@
.header-align-2 { text-align: center; }
.header-align-3 { text-align: right; }
.header-align-1 .heasder-desc-hr-first,
.header-align-1 .heasder-desc-hr-second { margin-left: 0; margin-right: auto; }
.header-align-3 .heasder-desc-hr-first,
.header-align-3 .heasder-desc-hr-second { margin-left: auto; margin-right: 0; }
@media (max-width: 767px) {
.header-align-1,
.header-align-3 { text-align: center; }
}
/* ===== headerHotelDescBlock.tpl ===== */
.header-desc-container {
@@ -74,6 +68,10 @@
z-index: -10;
/*height: 100%;*/
}
.header-bg-video {
min-height: 100%;
}
.header-desc-wrapper {
display: table;
height: 100%;
@@ -85,21 +83,10 @@
text-align: center;
color: #FFFFFF;
}
.header-desc-welcome{
font-size: 18px;
font-weight: 300;
margin: 0;
}
.header-desc-primary hr {
margin-bottom: 10px;
}
.heasder-desc-hr-first {
width: 42px;
margin-top: 10px;
}
.header-hotel-name {
font-size: 55px;
font-weight: 400;
@@ -117,85 +104,6 @@
display: none;
}
@media (max-width: 767px) {
.topSubSecondaryBlock {
margin-top: 0px; }
/* ===== Mobile header responsive ===== */
/*
* The index page sets height:100% via inline style on html/body/#page/.header-container/<header>.
* On mobile portrait this makes the header fill the full viewport (~750px+), causing
* landscape hotel images to be cropped and zoomed beyond recognition.
* Reset ancestors to auto and lock the header to a landscape-ish fixed height.
*/
html, body {
height: auto !important;
}
#page, .header-container {
height: auto !important;
}
body#index #header {
height: 60vw !important;
min-height: 240px !important;
max-height: 420px !important;
}
/* Force the full owl carousel height chain — owl JS sets inline height on
stage/items during responsive recalc, collapsing the background images. */
body#index .header-media-layer,
body#index .header-media-layer .owl-carousel,
body#index .header-media-layer .owl-stage-outer,
body#index .header-media-layer .owl-stage,
body#index .header-media-layer .owl-item {
height: 100% !important;
}
/* Keep background images filling the now-landscape slot */
body#index .header-media-layer,
body#index .header-slide-img {
background-size: cover !important;
background-position: center center !important;
}
/* Scale down oversized text */
.header-hotel-name {
font-size: 22px !important;
margin-top: 0;
margin-bottom: 8px;
}
.js-header-tagline {
font-size: 13px !important;
line-height: 18px;
}
.header-desc-inner-wrapper {
padding-left: 10px;
padding-right: 10px;
}
/* Prev/next buttons — touch-friendly on mobile */
.header-media-btn {
padding: 5px 9px;
font-size: 15px;
}
.js-header-media-prev { left: 6px; }
.js-header-media-next { right: 6px; }
/* Dots clear from bottom edge */
.header-ext-dots {
bottom: 10px;
}
}
/* ==== Header Media (front-end) ==== */
#header {
background: transparent;
}
body#index #header {
position: relative;
}
/* Owl carousel slide animation classes */
.wkFadeOut { animation: wkFadeOut 0.7s forwards; }
.wkFadeIn { animation: wkFadeIn 0.7s forwards; }
@@ -268,60 +176,6 @@ body#index #header {
background-repeat: no-repeat;
}
.header-video-layer {
background-color: #000;
}
.header-bg-video {
position: absolute;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
transform: translate(-50%, -50%);
object-fit: cover;
}
.header-slide-video {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
}
.header-slide-video .header-bg-video {
position: absolute;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
transform: translate(-50%, -50%);
object-fit: cover;
}
.header-media-nav-wrapper {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
pointer-events: none;
}
@media (min-width: 768px) {
.header-media-nav-wrapper {
z-index: 11;
}
/* Push dots above the search panel (which sits at bottom:0, ~90px tall) */
.header-ext-dots {
bottom: 120px;
}
}
.header-media-btn {
position: absolute;
@@ -345,35 +199,10 @@ body#index #header {
color: #fff;
}
.js-header-media-prev {
.header-media-prev {
left: 15px;
}
.js-header-media-next {
.header-media-next {
right: 15px;
}
/* ===== headerHotelDescBlock.tpl ===== */
.copyRightWrapper {
background-color: #242424;
padding: 30px;
}
.copyRightWrapper p {
color: #868686;
font-size: 16px;
font-weight: 400;
margin: 0;
text-align: center;
}
.copyRightWrapper {
background-color: #242424;
padding: 30px;
width: 100%; }
.copyRightWrapper .copyRight {
color: #868686;
font-size: 16px;
margin: 0;
text-align: center;
line-height: 23px; }
}

View File

@@ -55,6 +55,14 @@ $(document).ready(function () {
var pendingBulkDeleteForm = null;
var pendingBulkDeleteAction = null;
var editImagePreviewUrl = null;
function revokeEditImagePreview() {
if (editImagePreviewUrl) {
URL.revokeObjectURL(editImagePreviewUrl);
editImagePreviewUrl = null;
}
}
$(document).on('click', '.qlo-bulk-delete-images-trigger', function (e) {
e.preventDefault();
@@ -108,6 +116,22 @@ $(document).ready(function () {
updateImgFileNameHm(this.files);
});
$('#qlo-img-edit-file-selectbutton, #qlo-img-edit-file-name').on('click', function () {
$('#qlo-img-edit-file').trigger('click');
});
$('#qlo-img-edit-file').on('change', function () {
var file = this.files && this.files[0] ? this.files[0] : null;
$('#qlo-img-edit-file-name').val(file ? file.name : '');
revokeEditImagePreview();
if (file) {
editImagePreviewUrl = URL.createObjectURL(file);
$('#qlo-img-edit-thumb').attr('src', editImagePreviewUrl);
$('#qlo-img-edit-preview-group').show();
}
});
$(document).on('change', '#qlo-source-type', function () {
if ($(this).val() === 'url') {
$('#qlo-vid-file-wrap').hide();
@@ -167,15 +191,16 @@ $(document).ready(function () {
});
$(document).on('click', '.qlo-edit-img', function () {
var $row = $(this).closest('tr.qlo-img-row');
var id = parseInt($row.data('id'), 10);
var tagLines = $row.data('tag-lines') || {};
var isActive = $row.find('.list-action-enable').hasClass('action-enabled');
var thumbSrc = $row.attr('data-thumb-src') || '';
var tlColor = $row.attr('data-tag-line-color') || '#ffffff';
var tlFontSize = parseInt($row.attr('data-tag-line-font-size') || 16, 10);
var tlFontWeight = $row.attr('data-tag-line-font-weight') || '400';
openImgForm('edit', id, tagLines, isActive, thumbSrc, tlColor, tlFontSize, tlFontWeight);
var $row = $(this).closest('tr.qlo-img-row');
var id = parseInt($row.data('id'), 10);
var tagLines = $row.data('tag-lines') || {};
var isActive = $row.find('.js-toggle-active').hasClass('action-enabled');
var showHotelName = $row.find('.js-toggle-hotel-name').hasClass('action-enabled');
var thumbSrc = $row.attr('data-thumb-src') || '';
var tlColor = $row.attr('data-tag-line-color') || '#ffffff';
var tlFontSize = parseInt($row.attr('data-tag-line-font-size') || 16, 10);
var tlFontWeight = $row.attr('data-tag-line-font-weight') || '400';
openImgForm('edit', id, tagLines, isActive, thumbSrc, tlColor, tlFontSize, tlFontWeight, showHotelName);
});
function updateBulkUpdateTriggerState() {
@@ -190,10 +215,11 @@ $(document).ready(function () {
return false;
}
$('#qlo-bulk-active').val('');
$('#qlo-bulk-hotelname').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-color').val('').trigger('keyup');
$('#qlo-bulk-tl-font-size').val(0);
$('#qlo-bulk-tl-font-weight').val('');
hideOtherLanguage(qloHmDefaultLangId);
@@ -214,6 +240,7 @@ $(document).ready(function () {
ajax: 1, action: 'bulkUpdateImages', token: qloHmToken,
id_header_image: ids,
active: $('#qlo-bulk-active').val(),
show_hotel_name: $('#qlo-bulk-hotelname').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(),
@@ -266,7 +293,7 @@ $(document).ready(function () {
}
});
$(document).on('click', '.qlo-img-row .list-action-enable', function (e) {
$(document).on('click', '.qlo-img-row .js-toggle-active', function (e) {
e.preventDefault();
var $link = $(this);
var $row = $link.closest('tr.qlo-img-row');
@@ -291,6 +318,31 @@ $(document).ready(function () {
}).always(function () { $('#page-loader').hide(); });
});
$(document).on('click', '.qlo-img-row .js-toggle-hotel-name', function (e) {
e.preventDefault();
var $link = $(this);
var $row = $link.closest('tr.qlo-img-row');
var id = parseInt($row.data('id'), 10);
var showHotelName = $link.hasClass('action-enabled') ? 0 : 1;
$('#page-loader').show();
$.ajax({
url: qloHmCurrentIndex,
type: 'POST',
data: { ajax: 1, action: 'toggle_image_hotel_name', id_header_image: id, show_hotel_name: showHotelName, token: qloHmToken },
success: function (raw) {
var data = safeParseJsonHm(raw);
if (data && data.success) {
$link.toggleClass('action-enabled action-disabled');
$link.find('i').toggleClass('hidden');
showSuccessMessage(data.confirmations);
} else {
showErrorMessage(data ? data.errors.join('<br>') : qloHmI18n.updateFailed);
}
},
error: function () { showErrorMessage(qloHmI18n.requestFailed); }
}).always(function () { $('#page-loader').hide(); });
});
$(document).on('click', '.qlo-delete-img', function () {
var id = parseInt($(this).data('id'), 10);
$('#page-loader').show();
@@ -360,7 +412,7 @@ $(document).ready(function () {
});
}
function openImgForm(mode, id, tagLines, isActive, imgUrl, tlColor, tlFontSize, tlFontWeight) {
function openImgForm(mode, id, tagLines, isActive, imgUrl, tlColor, tlFontSize, tlFontWeight, showHotelName) {
$('#qlo-img-form-id').val(id || '');
$('#qlo-form-upload-progress').hide();
@@ -371,12 +423,26 @@ $(document).ready(function () {
$('#qlo-img-edit-footer').show();
$('#qlo-img-form-file-group').hide();
$('#qlo-img-form-add-active-group').hide();
$('#qlo-img-form-add-hotelname-group').hide();
$('#qlo-img-form-edit-group').show();
$('#qlo-img-edit-file-group').show();
var editFileInput = document.getElementById('qlo-img-edit-file');
if (editFileInput) {
editFileInput.value = '';
}
$('#qlo-img-edit-file-name').val('');
revokeEditImagePreview();
$('#qlo-img-form-edit-hotelname-group').show();
if (isActive) {
$('#qlo_img_active_edit_on').prop('checked', true);
} else {
$('#qlo_img_active_edit_off').prop('checked', true);
}
if (showHotelName) {
$('#qlo_img_hotelname_edit_on').prop('checked', true);
} else {
$('#qlo_img_hotelname_edit_off').prop('checked', true);
}
tagLines = tagLines || {};
$('.qlo-form-tagline-field').each(function () {
var langId = $(this).data('lang');
@@ -399,14 +465,18 @@ $(document).ready(function () {
$('#qlo-img-add-footer').show();
$('#qlo-img-form-file-group').show();
$('#qlo-img-form-add-active-group').show();
$('#qlo-img-form-add-hotelname-group').show();
$('#qlo-img-form-edit-group').hide();
$('#qlo-img-form-edit-hotelname-group').hide();
$('#qlo-img-edit-preview-group').hide();
$('#qlo-img-edit-file-group').hide();
var fileInput = document.getElementById('qlo-img-form-file');
if (fileInput) {
fileInput.value = '';
}
$('#qlo-img-form-file-name').val('');
$('#qlo_img_active_add_on').prop('checked', true);
$('#qlo_img_hotelname_add_on').prop('checked', true);
$('.qlo-form-tagline-field').val('');
$('#qlo-img-tl-color').val('#ffffff');
$('#qlo-img-tl-font-size').val(16);
@@ -422,6 +492,7 @@ $(document).ready(function () {
function closeImgForm() {
$('#qlo-img-form-modal').modal('hide');
revokeEditImagePreview();
}
function getFormTagLines() {
@@ -433,24 +504,44 @@ $(document).ready(function () {
}
function saveEditedImage(id) {
var tagLines = getFormTagLines();
var active = parseInt($('input[name="qlo_img_active_edit"]:checked').val() || 0, 10);
var tagLines = getFormTagLines();
var active = parseInt($('input[name="qlo_img_active_edit"]:checked').val() || 0, 10);
var showHotelName = parseInt($('input[name="qlo_img_hotelname_edit"]:checked').val() || 0, 10);
var tlColor = $('#qlo-img-tl-color').val() || '#ffffff';
var tlFontSize = parseInt($('#qlo-img-tl-font-size').val() || 16, 10);
var tlFontWeight = $('#qlo-img-tl-font-weight').val() || '400';
var postData = {
ajax: 1, action: 'edit_image', id_header_image: id, active: active, token: qloHmToken,
tag_line_color: tlColor, tag_line_font_size: tlFontSize, tag_line_font_weight: tlFontWeight
};
var editFileInput = document.getElementById('qlo-img-edit-file');
var newFile = editFileInput && editFileInput.files && editFileInput.files[0] ? editFileInput.files[0] : null;
if (newFile && typeof qloHmMaxUpload !== 'undefined' && qloHmMaxUpload > 0 && newFile.size > qloHmMaxUpload) {
showErrorMessage(qloHmI18n.fileTooLarge);
return;
}
var fd = new FormData();
fd.append('ajax', '1');
fd.append('action', 'edit_image');
fd.append('id_header_image', id);
fd.append('active', active);
fd.append('show_hotel_name', showHotelName);
fd.append('token', qloHmToken);
fd.append('tag_line_color', tlColor);
fd.append('tag_line_font_size', tlFontSize);
fd.append('tag_line_font_weight', tlFontWeight);
$.each(tagLines, function (langId, val) {
postData['tag_line_' + langId] = val;
fd.append('tag_line_' + langId, val);
});
if (newFile) {
fd.append('header_image_file', newFile);
}
$('#page-loader').show();
$.ajax({
url: qloHmCurrentIndex,
type: 'POST',
data: postData,
url: qloHmCurrentIndex,
type: 'POST',
data: fd,
processData: false,
contentType: false,
success: function (raw) {
var resp = safeParseJsonHm(raw);
if (resp && resp.success) {
@@ -467,9 +558,10 @@ $(document).ready(function () {
}
function uploadImagesWithTagLine(files) {
var index = 0;
var tagLines = getFormTagLines();
var active = parseInt($('input[name="qlo_img_active_add"]:checked').val() || 1, 10);
var index = 0;
var tagLines = getFormTagLines();
var active = parseInt($('input[name="qlo_img_active_add"]:checked').val() || 1, 10);
var showHotelName = parseInt($('input[name="qlo_img_hotelname_add"]:checked').val() || 1, 10);
var tlColor = $('#qlo-img-tl-color').val() || '#ffffff';
var tlFontSize = parseInt($('#qlo-img-tl-font-size').val() || 16, 10);
var tlFontWeight = $('#qlo-img-tl-font-weight').val() || '400';
@@ -497,6 +589,7 @@ $(document).ready(function () {
fd.append('action', 'uploadImage');
fd.append('token', qloHmToken);
fd.append('active', active);
fd.append('show_hotel_name', showHotelName);
fd.append('tag_line_color', tlColor);
fd.append('tag_line_font_size', tlFontSize);
fd.append('tag_line_font_weight', tlFontWeight);
@@ -545,6 +638,16 @@ $(document).ready(function () {
function patchImageRow($row, data) {
var id = parseInt(data.id, 10);
if (data.thumb) {
var $thumbCell = $row.find('.qlo-img-thumb-cell');
if (!$thumbCell.length) {
$thumbCell = $row.find('td').eq(1);
}
$thumbCell.html(data.thumb);
}
if (data.thumb_src) {
$row.attr('data-thumb-src', data.thumb_src);
}
var updatedTagLines = safeParseJsonHm(data.tag_lines_json) || {};
$row.attr('data-tag-lines', data.tag_lines_json);
$row.data('tag-lines', updatedTagLines);
@@ -556,13 +659,24 @@ $(document).ready(function () {
display.length > 50 ? display.substring(0, 50) + '...' : (display || '—')
);
var nowActive = parseInt(data.active, 10);
var $toggle = $row.find('.list-action-enable');
var $toggle = $row.find('.js-toggle-active');
$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)));
if (data.show_hotel_name !== undefined) {
var nowShowHotelName = parseInt(data.show_hotel_name, 10);
var $hnToggle = $row.find('.js-toggle-hotel-name');
$hnToggle.toggleClass('action-enabled', !!nowShowHotelName)
.toggleClass('action-disabled', !nowShowHotelName);
$hnToggle.find('i.icon-check').toggleClass('hidden', !nowShowHotelName);
$hnToggle.find('i.icon-remove').toggleClass('hidden', !!nowShowHotelName);
$hnToggle.attr('href', $hnToggle.attr('href').replace(/id_header_image=\d+/, 'id_header_image=' + id)
.replace(/show_hotel_name=\d+/, 'show_hotel_name=' + (nowShowHotelName ? 0 : 1)));
}
}
function safeParseJsonHm(raw) {

View File

@@ -75,9 +75,10 @@ $(document).ready(function () {
};
var $taglineEl = $('.js-header-tagline');
var _fadeTimer = null;
var _shownIndex = -1;
var $taglineEl = $('.js-header-tagline');
var $hotelNameEl = $('.js-header-hotel-name');
var _fadeTimer = null;
var _shownIndex = -1;
var $slides = $imgCarousel.find('.owl-item:not(.cloned) .header-slide-img');
var taglines = $slides.map(function () { return $(this).data('tagline') || ''; }).get();
@@ -88,8 +89,13 @@ $(document).ready(function () {
fontWeight: $(this).data('tl-font-weight') || '400'
};
}).get();
var showHotelNames = $slides.map(function () { return $(this).data('show-hotel-name') == 1; }).get();
function showTagline(tag, style, showHotelName) {
if ($hotelNameEl.length) {
$hotelNameEl.toggle(!!showHotelName);
}
function showTagline(tag, style) {
if (!$taglineEl.length) { return; }
if (_fadeTimer) { clearTimeout(_fadeTimer); _fadeTimer = null; }
@@ -113,13 +119,13 @@ $(document).ready(function () {
}
_shownIndex = owl.relative(owl.current());
showTagline(taglines[_shownIndex] || '', tlStyles[_shownIndex]);
showTagline(taglines[_shownIndex] || '', tlStyles[_shownIndex], showHotelNames[_shownIndex]);
$imgCarousel.on('changed.owl.carousel', function () {
var realIndex = owl.relative(owl.current());
if (realIndex === _shownIndex) { return; } // loop-snap second fire — no-op
_shownIndex = realIndex;
showTagline(taglines[realIndex] || '', tlStyles[realIndex]);
showTagline(taglines[realIndex] || '', tlStyles[realIndex], showHotelNames[realIndex]);
});