1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 10:49:36 +02:00
DanieL 2022-08-11 13:10:28 -03:00
parent 5d894ec120
commit afe8586b64
13 changed files with 235 additions and 110 deletions

View file

@ -5276,6 +5276,9 @@ if (!class_exists('Video')) {
$favoriteBtnAddedStyle = "display: none;"; $favoriteBtnAddedStyle = "display: none;";
$favoriteBtnStyle = ""; $favoriteBtnStyle = "";
} }
$galleryDropDownMenu = Gallery::getVideoDropdownMenu($videos_id);
$galleryVideoButtons .= ' $galleryVideoButtons .= '
<div class="galleryVideoButtons"> <div class="galleryVideoButtons">
<button onclick="addVideoToPlayList(' . $videos_id . ', false, ' . $watchLaterId . ');return false;" class="btn btn-dark btn-xs watchLaterBtnAdded watchLaterBtnAdded' . $videos_id . '" data-toggle="tooltip" data-placement="left" title=' . printJSString("Added On Watch Later", true) . ' style="color: #4285f4;' . $watchLaterBtnAddedStyle . '" ><i class="fas fa-check"></i></button> <button onclick="addVideoToPlayList(' . $videos_id . ', false, ' . $watchLaterId . ');return false;" class="btn btn-dark btn-xs watchLaterBtnAdded watchLaterBtnAdded' . $videos_id . '" data-toggle="tooltip" data-placement="left" title=' . printJSString("Added On Watch Later", true) . ' style="color: #4285f4;' . $watchLaterBtnAddedStyle . '" ><i class="fas fa-check"></i></button>
@ -5283,6 +5286,8 @@ if (!class_exists('Video')) {
<br> <br>
<button onclick="addVideoToPlayList(' . $videos_id . ', false, ' . $favoriteId . ');return false;" class="btn btn-dark btn-xs favoriteBtnAdded favoriteBtnAdded' . $videos_id . '" data-toggle="tooltip" data-placement="left" title=' . printJSString("Added On Favorite", true) . ' style="color: #4285f4; ' . $favoriteBtnAddedStyle . '"><i class="fas fa-check"></i></button> <button onclick="addVideoToPlayList(' . $videos_id . ', false, ' . $favoriteId . ');return false;" class="btn btn-dark btn-xs favoriteBtnAdded favoriteBtnAdded' . $videos_id . '" data-toggle="tooltip" data-placement="left" title=' . printJSString("Added On Favorite", true) . ' style="color: #4285f4; ' . $favoriteBtnAddedStyle . '"><i class="fas fa-check"></i></button>
<button onclick="addVideoToPlayList(' . $videos_id . ', true, ' . $favoriteId . ');return false;" class="btn btn-dark btn-xs favoriteBtn favoriteBtn' . $videos_id . ' faa-parent animated-hover" data-toggle="tooltip" data-placement="left" title=' . printJSString("Favorite", true) . ' style="' . $favoriteBtnStyle . '" ><i class="fas fa-heart faa-pulse faa-fast" ></i></button> <button onclick="addVideoToPlayList(' . $videos_id . ', true, ' . $favoriteId . ');return false;" class="btn btn-dark btn-xs favoriteBtn favoriteBtn' . $videos_id . ' faa-parent animated-hover" data-toggle="tooltip" data-placement="left" title=' . printJSString("Favorite", true) . ' style="' . $favoriteBtnStyle . '" ><i class="fas fa-heart faa-pulse faa-fast" ></i></button>
<br>
'.$galleryDropDownMenu.'
</div>'; </div>';
} }
$href = Video::getLink($video['id'], $video['clean_title']); $href = Video::getLink($video['id'], $video['clean_title']);
@ -5541,7 +5546,7 @@ if (!class_exists('Video')) {
static public function getAllActiveEPGs() { static public function getAllActiveEPGs() {
global $config; global $config;
$sql = "SELECT * FROM `videos` WHERE status = '".Video::$statusActive."' AND epg_link IS NOT NULL AND epg_link != '';"; $sql = "SELECT * FROM `videos` WHERE status = '" . Video::$statusActive . "' AND epg_link IS NOT NULL AND epg_link != '';";
$res = sqlDAL::readSql($sql); $res = sqlDAL::readSql($sql);
$fullResult2 = sqlDAL::fetchAllAssoc($res); $fullResult2 = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res); sqlDAL::close($res);
@ -5556,40 +5561,38 @@ if (!class_exists('Video')) {
} }
return $rows; return $rows;
} }
static public function getEPG($videos_id) { static public function getEPG($videos_id) {
global $config, $_getEPG; global $config, $_getEPG;
if(!isset($_getEPG)){ if (!isset($_getEPG)) {
$_getEPG = array(); $_getEPG = array();
} }
if(!isset($_getEPG[$videos_id])){ if (!isset($_getEPG[$videos_id])) {
$sql = "SELECT * FROM `videos` WHERE id = ? AND epg_link IS NOT NULL AND epg_link != ''"; $sql = "SELECT * FROM `videos` WHERE id = ? AND epg_link IS NOT NULL AND epg_link != ''";
$res = sqlDAL::readSql($sql, 'i', array($videos_id)); $res = sqlDAL::readSql($sql, 'i', array($videos_id));
$video = sqlDAL::fetchAssoc($res); $video = sqlDAL::fetchAssoc($res);
sqlDAL::close($res); sqlDAL::close($res);
if(empty($video) || !isValidURL($video['epg_link'])){ if (empty($video) || !isValidURL($video['epg_link'])) {
$_getEPG[$videos_id] = false; $_getEPG[$videos_id] = false;
}else{ } else {
$_getEPG[$videos_id] = $video['epg_link']; $_getEPG[$videos_id] = $video['epg_link'];
} }
} }
return $_getEPG[$videos_id]; return $_getEPG[$videos_id];
} }
static public function getEPGLink($videos_id) { static public function getEPGLink($videos_id) {
global $global; global $global;
$url = $global['webSiteRootURL'].'plugin/PlayerSkins/epg.php'; $url = $global['webSiteRootURL'] . 'plugin/PlayerSkins/epg.php';
if(!empty($videos_id)){ if (!empty($videos_id)) {
$epg = self::getEPG($videos_id); $epg = self::getEPG($videos_id);
if(!empty($epg)){ if (!empty($epg)) {
$url = addQueryStringParameter($url, 'videos_id', $videos_id); $url = addQueryStringParameter($url, 'videos_id', $videos_id);
return $url; return $url;
}else{ } else {
return false; return false;
} }
} }

View file

@ -1,22 +1,35 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
global $global, $config; global $global, $config;
if (!isset($global['systemRootPath'])) { if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php'; require_once '../videos/configuration.php';
} }
require_once $global['systemRootPath'] . 'objects/user.php';
if (!Permissions::canModerateVideos()) { $obj = new stdClass();
die('{"error":"'.__("Permission denied").'"}'); $obj->msg = '';
} $obj->error = true;
require_once $global['systemRootPath'] . 'objects/video.php'; $obj->idsToSave = array();
if (!is_array($_POST['id'])) { $obj->idSaved = array();
$_POST['id'] = [$_POST['id']];
} require_once $global['systemRootPath'] . 'objects/user.php';
$id = 0; if (!Permissions::canModerateVideos()) {
foreach ($_POST['id'] as $value) { forbiddenPage('Permission denied');
$obj = new Video('', '', $value); }
$obj->setIsSuggested($_POST['isSuggested']); require_once $global['systemRootPath'] . 'objects/video.php';
$id = $obj->save(); if (!is_array($_POST['id'])) {
} $obj->idsToSave = [$_POST['id']];
}else{
echo '{"status":"'.$id.'"}'; $obj->idsToSave = $_POST['id'];
}
foreach ($obj->idsToSave as $value) {
$video = new Video('', '', $value);
$video->setIsSuggested($_POST['isSuggested']);
$obj->idSaved[] = $video->save();
}
if(!empty($obj->idSaved)){
$obj->error = false;
clearCache(true);
}
echo _json_encode($obj);

View file

@ -273,4 +273,11 @@ class Gallery extends PluginAbstract {
return !empty($obj->{$parameterName}); return !empty($obj->{$parameterName});
} }
static function getVideoDropdownMenu($videos_id) {
global $global;
$varsArray = array('videos_id' => $videos_id);
$filePath = $global['systemRootPath'] . 'plugin/Gallery/view/videoDropDownMenu.php';
return getIncludeFileContent($filePath, $varsArray);
}
} }

View file

@ -200,8 +200,7 @@ function createGallerySection($videos, $crc = "", $get = array(), $ignoreAds = f
<?php <?php
if ($galeryDetails) { if ($galeryDetails) {
?> ?>
<div class="galeryDetails">
<div class="galeryDetails" style="overflow: hidden;">
<div class="galleryTags"> <div class="galleryTags">
<!-- category tags --> <!-- category tags -->
<?php <?php
@ -258,33 +257,6 @@ function createGallerySection($videos, $crc = "", $get = array(), $ignoreAds = f
</a> </a>
</div> </div>
<?php <?php
if ((!empty($value['description'])) && !empty($obj->Description)) {
//$desc = str_replace(array('"', "'", "#", "/", "\\"), array('``', "`", "", "", ""), preg_replace("/\r|\n/", " ", nl2br(trim($value['description']))));
$desc = nl2br(trim($value['description']));
if (!isHTMLEmpty($desc)) {
$duid = uniqid();
$titleAlert = str_replace(array('"', "'"), array('``', "`"), $value['title']);
?>
<button type="button" class="btn-link" onclick='avideoAlert("<?php echo $titleAlert; ?>", "<div style=\"max-height: 300px; overflow-y: scroll;overflow-x: hidden;\" id=\"videoDescriptionAlertContent<?php echo $duid; ?>\" ></div>", "");$("#videoDescriptionAlertContent<?php echo $duid; ?>").html($("#videoDescription<?php echo $duid; ?>").html());return false;' data-toggle="tooltip" title="<?php echo __("Description"); ?>"><i class="far fa-file-alt"></i> <span class="hidden-md hidden-sm hidden-xs"><?php echo __("Description"); ?></span></a>
<div id="videoDescription<?php echo $duid; ?>" style="display: none;"><?php echo $desc; ?></div>
</button>
<?php
}
}
?>
<?php if (Video::canEdit($value['id'])) { ?>
<button type="button" class="btn-link" onclick="avideoModalIframe(webSiteRootURL + 'view/managerVideosLight.php?avideoIframe=1&videos_id=<?php echo $value['id']; ?>');return false;" data-toggle="tooltip" title="<?php echo __("Edit Video"); ?>">
<i class="fa fa-edit"></i> <span class="hidden-md hidden-sm hidden-xs"><?php echo __("Edit Video"); ?></span>
</button>
<?php }
?>
<?php if (!empty($value['trailer1'])) { ?>
<button type="button" class="btn-link" onclick="showTrailer('<?php echo parseVideos($value['trailer1'], 1); ?>'); return false;" class="cursorPointer" >
<i class="fa fa-video"></i> <?php echo __("Trailer"); ?>
</button>
<?php }
?>
<?php
echo AVideoPlugin::getGalleryActionButton($value['id']); echo AVideoPlugin::getGalleryActionButton($value['id']);
?> ?>
</div> </div>
@ -436,7 +408,7 @@ function createGalleryLiveSection($videos) {
<strong class="title"><?php echo getSEOTitle($video['title']) ?></strong> <strong class="title"><?php echo getSEOTitle($video['title']) ?></strong>
</a> </a>
<div class="galeryDetails" style="overflow: hidden;"> <div class="galeryDetails">
<div class="galleryTags"> <div class="galleryTags">
<?php if (empty($_GET['catName']) && !empty($obj->showCategoryTag)) { ?> <?php if (empty($_GET['catName']) && !empty($obj->showCategoryTag)) { ?>
<a class="label label-default" href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo $video['clean_category']; ?>"> <a class="label label-default" href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo $video['clean_category']; ?>">

View file

@ -68,9 +68,6 @@ h3.galleryTitle{
.galeryDetails div{ .galeryDetails div{
float: left; float: left;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
padding-right: 5px; padding-right: 5px;
margin: 2px 0; margin: 2px 0;
} }
@ -164,7 +161,16 @@ a.h6{
} }
.galleryVideo .galleryVideoButtons button:hover{ .galleryVideo .galleryVideoButtons button:hover{
opacity: 1; opacity: 1;
} }
.galleryVideo .galleryVideoButtons div.dropdown .dropdown-menu{
margin: -20px auto auto -160px;
}
.galleryVideo div.galleryVideoButtons > div > ul > li > button{
opacity: 1;
display: inline-block;
width: 100%;
}
.gallerySerieOverlay{ .gallerySerieOverlay{
position: absolute; position: absolute;

View file

@ -0,0 +1,49 @@
<?php
require_once __DIR__.'/../../../videos/configuration.php';
$video = Video::getVideoLight($videos_id);
?>
<div class="dropdown">
<button class="btn btn-dark btn-xs dropdown-toggle" type="button" data-toggle="dropdown">
<i class="fas fa-ellipsis-v"></i>
</button>
<ul class="dropdown-menu">
<?php
if ((!empty($video['description'])) && !empty($obj->Description)) {
$desc = nl2br(trim($video['description']));
if (!isHTMLEmpty($desc)) {
$duid = uniqid();
$titleAlert = str_replace(array('"', "'"), array('``', "`"), $video['title']);
?>
<li>
<button type="button" class="btn-link" onclick='avideoAlert("<?php echo $titleAlert; ?>", "<div style=\"max-height: 300px; overflow-y: scroll;overflow-x: hidden;\" id=\"videoDescriptionAlertContent<?php echo $duid; ?>\" ></div>", "");$("#videoDescriptionAlertContent<?php echo $duid; ?>").html($("#videoDescription<?php echo $duid; ?>").html());return false;' data-toggle="tooltip" title="<?php echo __("Description"); ?>"><i class="far fa-file-alt"></i> <span class="hidden-md hidden-sm hidden-xs"><?php echo __("Description"); ?></span></a>
<div id="videoDescription<?php echo $duid; ?>" style="display: none;"><?php echo $desc; ?></div>
</button>
</li>
<?php
}
}
?>
<?php if (!empty($video['trailer1'])) { ?>
<li>
<button type="button" class="btn-link" onclick="showTrailer('<?php echo parseVideos($video['trailer1'], 1); ?>'); return false;" class="cursorPointer" >
<i class="fa fa-video"></i> <?php echo __("Trailer"); ?>
</button>
</li>
<?php }
?>
<?php if (Video::canEdit($video['id'])) { ?>
<li>
<button type="button" class="btn-link" onclick="avideoModalIframe(webSiteRootURL + 'view/managerVideosLight.php?avideoIframe=1&videos_id=<?php echo $video['id']; ?>');return false;" data-toggle="tooltip" title="<?php echo __("Edit Video"); ?>">
<i class="fa fa-edit"></i> <span class="hidden-md hidden-sm hidden-xs"><?php echo __("Edit Video"); ?></span>
</button>
</li>
<?php
$suggestedBTN = Layout::getSuggestedButton($video['id'], 'btn-link');
if (!empty($suggestedBTN)) {
echo "<li>{$suggestedBTN}</li>";
}
}
?>
</ul>
</div>

View file

@ -708,6 +708,19 @@ class Layout extends PluginAbstract {
return $cleanList; return $cleanList;
} }
static function getSuggestedButton($videos_id, $class='btn btn-xs'){
global $global;
if(empty($videos_id)){
return '';
}
if(!Permissions::canAdminVideos()){
return '';
}
$varsArray = array('videos_id'=>$videos_id, 'class'=>$class);
$filePath = $global['systemRootPath'] . 'plugin/Layout/suggestedButton.php';
return getIncludeFileContent($filePath, $varsArray);
}
} }

View file

@ -0,0 +1,15 @@
<?php
$video = new Video('', '', $videos_id);
$_class = 'isSuggested btn-warning ';
if (empty($video->getIsSuggested())) {
$_class = 'isNotSuggested btn-default ';
}
?>
<button type="button"
class="suggestBtn <?php echo $_class; ?> <?php echo $class; ?>"
onclick="toogleVideoSuggested($(this));return false;"
videos_id="<?php echo $videos_id; ?>" >
<span class="hidden-md hidden-sm hidden-xs">
<span class="unsuggestText btnText"><i class="fas fa-star"></i> <?php echo __("Unsuggest it"); ?></span>
<span class="suggestText btnText"><i class="far fa-star"></i> <?php echo __("Suggest it"); ?></span></span>
</button>

View file

@ -176,7 +176,7 @@ function createEPG($channel) {
$left = ($minuteSize * $minutesSinceZeroTime) + $timeLineElementSize; $left = ($minuteSize * $minutesSinceZeroTime) + $timeLineElementSize;
$width = ($minuteSize * $minutes); $width = ($minuteSize * $minutes);
$_stopTime = strtotime($program['stop']); $_stopTime = strtotime($program['stop']);
$class = ''; $pclass = '';
if ($width <= $minimumWidth) { if ($width <= $minimumWidth) {
$text = "<!-- too small $width -->"; $text = "<!-- too small $width -->";
} else { } else {
@ -185,9 +185,9 @@ function createEPG($channel) {
$text = "{$program['title']}<div><small class=\"duration\">{$minutes} Min</small></div>"; $text = "{$program['title']}<div><small class=\"duration\">{$minutes} Min</small></div>";
} }
if ($_stopTime < $nowTime) { if ($_stopTime < $nowTime) {
$class = 'finished'; $pclass = 'finished';
} }
echo "<div style=\"width: {$width}px; left: {$left}px;\" start=\"{$program['start']}\" stop=\"{$program['stop']}\" minutes=\"{$minutes}\" minutesSinceZeroTime=\"{$minutesSinceZeroTime}\" class=\"{$class}\">" echo "<div style=\"width: {$width}px; left: {$left}px;\" start=\"{$program['start']}\" stop=\"{$program['stop']}\" minutes=\"{$minutes}\" minutesSinceZeroTime=\"{$minutesSinceZeroTime}\" class=\"{$pclass}\">"
. "{$text}" . "{$text}"
. "</div>"; . "</div>";
} }

View file

@ -521,6 +521,16 @@ img.rotate-90 {
display: none !important; display: none !important;
} }
.suggestBtn .btnText{
display: none;
}
.suggestBtn.isNotSuggested .suggestText{
display: inline-block;
}
.suggestBtn.isSuggested .unsuggestText{
display: inline-block;
}
.profileBg { .profileBg {
padding: 20px; padding: 20px;
height: 27vw; height: 27vw;

View file

@ -1612,7 +1612,7 @@ function avideoModalIframeIsVisible() {
modal = $('.swal-modal-iframe-large'); modal = $('.swal-modal-iframe-large');
} else if ($('.swal-modal-iframe-full').length) { } else if ($('.swal-modal-iframe-full').length) {
modal = $('.swal-modal-iframe-full'); modal = $('.swal-modal-iframe-full');
} else if ($('.swal-modal-iframe-full-transparent').length) { } else if ($('.swal-modal-iframe-full-transparent').length) {
modal = $('.swal-modal-iframe-full-transparent'); modal = $('.swal-modal-iframe-full-transparent');
} else { } else {
modal = $('.swal-modal-iframe'); modal = $('.swal-modal-iframe');
@ -2079,9 +2079,9 @@ async function setToolTips() {
$(selector).addClass('alreadyTooltip'); $(selector).addClass('alreadyTooltip');
} catch (e) { } catch (e) {
console.log('setToolTips', e); console.log('setToolTips', e);
setTimeout(function(){ setTimeout(function () {
setToolTips(); setToolTips();
},1000); }, 1000);
} }
} }
@ -2684,7 +2684,7 @@ $(document).ready(function () {
}, },
hidePleaseWait: function () { hidePleaseWait: function () {
clearTimeout(hidePleaseWaitTimeout); clearTimeout(hidePleaseWaitTimeout);
hidePleaseWaitTimeout = setTimeout(function(){ hidePleaseWaitTimeout = setTimeout(function () {
setTimeout(function () { setTimeout(function () {
$('#pleaseWaitDialog').addClass('loaded'); $('#pleaseWaitDialog').addClass('loaded');
}, showPleaseWaitTimeOut / 2); }, showPleaseWaitTimeOut / 2);
@ -2693,7 +2693,7 @@ $(document).ready(function () {
}, showPleaseWaitTimeOut); // wait for loader animation }, showPleaseWaitTimeOut); // wait for loader animation
setTimeout(function () { setTimeout(function () {
pleaseWaitIsINUse = false; pleaseWaitIsINUse = false;
}, showPleaseWaitTimeOut+1000); }, showPleaseWaitTimeOut + 1000);
}, 500); }, 500);
}, },
setProgress: function (valeur) { setProgress: function (valeur) {
@ -3026,50 +3026,50 @@ function notifyInputIfIsOutOfBounds(selector, min_length, max_length) {
var icon = ''; var icon = '';
var feedback = ''; var feedback = '';
var force_length = parseInt($(selector).attr('maxlength')); var force_length = parseInt($(selector).attr('maxlength'));
if (text.length == 0 && !isRequired) { if (text.length == 0 && !isRequired) {
} else if (isTextOutOfBounds(text, min_length, max_length, isRequired)) { } else if (isTextOutOfBounds(text, min_length, max_length, isRequired)) {
var feedbackIcon = 'fas fa-exclamation'; var feedbackIcon = 'fas fa-exclamation';
parent.addClass('has-feedback'); parent.addClass('has-feedback');
if(!empty(force_length) && text.length >= force_length){ if (!empty(force_length) && text.length >= force_length) {
text = text.substr(0, force_length); text = text.substr(0, force_length);
$(selector).val(text); $(selector).val(text);
icon = '<i class="fas fa-exclamation-triangle"></i>'; icon = '<i class="fas fa-exclamation-triangle"></i>';
parent.addClass('has-info'); parent.addClass('has-info');
notifyInputIfIsOutOfBounds_animateClassTImeout = setTimeout(function(){ notifyInputIfIsOutOfBounds_animateClassTImeout = setTimeout(function () {
$(selector).addClass(animationInfo); $(selector).addClass(animationInfo);
},500); }, 500);
}else if(text.length < min_length || !isRequired){ } else if (text.length < min_length || !isRequired) {
icon = '<i class="fas fa-exclamation-circle"></i>'; icon = '<i class="fas fa-exclamation-circle"></i>';
parent.addClass('has-warning'); parent.addClass('has-warning');
notifyInputIfIsOutOfBounds_animateClassTImeout = setTimeout(function(){ notifyInputIfIsOutOfBounds_animateClassTImeout = setTimeout(function () {
$(selector).addClass(animationWarning); $(selector).addClass(animationWarning);
},500); }, 500);
}else{ } else {
icon = '<i class="fas fa-exclamation-circle"></i>'; icon = '<i class="fas fa-exclamation-circle"></i>';
parent.addClass('has-error'); parent.addClass('has-error');
feedbackIcon = 'fas fa-times'; feedbackIcon = 'fas fa-times';
notifyInputIfIsOutOfBounds_animateClassTImeout = setTimeout(function(){ notifyInputIfIsOutOfBounds_animateClassTImeout = setTimeout(function () {
$(selector).addClass(animationError); $(selector).addClass(animationError);
},500); }, 500);
} }
feedback = '<i class="'+feedbackIcon+' form-control-feedback" style="right:15px;"></i>'; feedback = '<i class="' + feedbackIcon + ' form-control-feedback" style="right:15px;"></i>';
} else { } else {
console.log('notifyInputIfIsOutOfBounds', text.length, force_length); console.log('notifyInputIfIsOutOfBounds', text.length, force_length);
if(!empty(force_length) && text.length == force_length){ if (!empty(force_length) && text.length == force_length) {
notifyInputIfIsOutOfBounds_animateClassTImeout = setTimeout(function(){ notifyInputIfIsOutOfBounds_animateClassTImeout = setTimeout(function () {
$(selector).addClass(animationInfo); $(selector).addClass(animationInfo);
},500); }, 500);
} }
icon = '<i class="fas fa-check-circle"></i>'; icon = '<i class="fas fa-check-circle"></i>';
parent.addClass('has-success'); parent.addClass('has-success');
} }
notifyInputIfIsOutOfBounds_removeClassTImeout = setTimeout(function(){ notifyInputIfIsOutOfBounds_removeClassTImeout = setTimeout(function () {
$(selector).removeClass(animationInfo); $(selector).removeClass(animationInfo);
$(selector).removeClass(animationError); $(selector).removeClass(animationError);
$(selector).removeClass(animationWarning); $(selector).removeClass(animationWarning);
},1000); }, 1000);
parent.append(feedback + '<small class="help-block">' + icon + ' ' + text.length + ' characters of ' + min_length + '-' + max_length + ' recommended</small>'); parent.append(feedback + '<small class="help-block">' + icon + ' ' + text.length + ' characters of ' + min_length + '-' + max_length + ' recommended</small>');
} }
@ -3081,9 +3081,9 @@ function setupFormElement(selector, min_length, max_length, force_length, isRequ
} else { } else {
$(selector).attr('required', 'required'); $(selector).attr('required', 'required');
} }
if(force_length){ if (force_length) {
$(selector).attr('maxlength', max_length); $(selector).attr('maxlength', max_length);
$(selector).attr('minlength', min_length); $(selector).attr('minlength', min_length);
} }
$(selector).keyup(function () { $(selector).keyup(function () {
notifyInputIfIsOutOfBounds('#' + $(this).attr('id'), $(this).attr('min_length'), $(this).attr('max_length')); notifyInputIfIsOutOfBounds('#' + $(this).attr('id'), $(this).attr('min_length'), $(this).attr('max_length'));
@ -3111,4 +3111,44 @@ function isTextOutOfBounds(text, min_length, max_length, isRequired) {
} }
//console.log('isTextOutOfBounds 5'); //console.log('isTextOutOfBounds 5');
return false; return false;
}
/**
* Usage: setVideoSuggested(videos_id, isSuggested).then((data) => {...}).catch((error) => {console.log(error)});
* @param {type} videos_id
* @param {type} isSuggested
* @returns {Promise}
*/
async function setVideoSuggested(videos_id, isSuggested) {
modal.showPleaseWait();
return new Promise((resolve, reject) => {
$.ajax({
url: webSiteRootURL + 'objects/videoSuggest.php',
data: {"id": videos_id, "isSuggested": isSuggested},
type: 'post',
success: function (data) {
modal.hidePleaseWait();
avideoResponse(data);
resolve(data)
},
error: function (error) {
modal.hidePleaseWait();
reject(error)
},
})
})
}
function toogleVideoSuggested(btn){
var videos_id = $(btn).attr('videos_id');
var isSuggested = $(btn).hasClass('isSuggested');
setVideoSuggested(videos_id, !isSuggested).then((data) => {
if(!isSuggested){
$(btn).removeClass('isNotSuggested btn-default');
$(btn).addClass('isSuggested btn-warning');
}else{
$(btn).addClass('isNotSuggested btn-default');
$(btn).removeClass('isSuggested btn-warning');
}
}).catch((error) => {console.log(error)});
} }

View file

@ -2005,16 +2005,10 @@ if (Permissions::canAdminVideos()) {
var row_index = $(this).closest('tr').index(); var row_index = $(this).closest('tr').index();
var row = $("#grid").bootgrid("getCurrentRows")[row_index]; var row = $("#grid").bootgrid("getCurrentRows")[row_index];
var isSuggested = $(this).hasClass('unsuggest'); var isSuggested = $(this).hasClass('unsuggest');
modal.showPleaseWait();
$.ajax({ setVideoSuggested(row.id, isSuggested).then((data) => {
url: webSiteRootURL + 'objects/videoSuggest.php', $("#grid").bootgrid("reload");
data: {"id": row.id, "isSuggested": isSuggested}, }).catch((error) => {console.log(error)});
type: 'post',
success: function (response) {
$("#grid").bootgrid("reload");
modal.hidePleaseWait();
}
});
}); });
grid.find(".command-editlikes").on("click", function (e) { grid.find(".command-editlikes").on("click", function (e) {
var row_index = $(this).closest('tr').index(); var row_index = $(this).closest('tr').index();

View file

@ -61,13 +61,16 @@ $description = getSEODescription(emptyHTML($video['description']) ? $video['titl
if (!empty($video['id']) && Video::showYoutubeModeOptions() && Video::canEdit($video['id'])) { if (!empty($video['id']) && Video::showYoutubeModeOptions() && Video::canEdit($video['id'])) {
?> ?>
<div class="btn-group" role="group" aria-label="Basic example"> <div class="btn-group" role="group" aria-label="Basic example">
<a href="#" class="btn btn-primary btn-xs" onclick="avideoModalIframe(webSiteRootURL + 'view/managerVideosLight.php?avideoIframe=1&videos_id=<?php echo $video['id']; ?>');return false;" data-toggle="tooltip" title="<?php echo __("Edit Video"); ?>"> <button type="button" class="btn btn-primary btn-xs" onclick="avideoModalIframe(webSiteRootURL + 'view/managerVideosLight.php?avideoIframe=1&videos_id=<?php echo $video['id']; ?>');return false;" data-toggle="tooltip" title="<?php echo __("Edit Video"); ?>">
<i class="fa fa-edit"></i> <span class="hidden-md hidden-sm hidden-xs"><?php echo __("Edit Video"); ?></span> <i class="fa fa-edit"></i> <span class="hidden-md hidden-sm hidden-xs"><?php echo __("Edit Video"); ?></span>
</a> </button>
<button type="button" class="btn btn-default btn-xs" onclick="avideoModalIframeFull(webSiteRootURL + 'view/videoViewsInfo.php?videos_id=<?php echo $video['id']; ?>'); <button type="button" class="btn btn-default btn-xs" onclick="avideoModalIframeFull(webSiteRootURL + 'view/videoViewsInfo.php?videos_id=<?php echo $video['id']; ?>');
return false;"> return false;">
<i class="fa fa-eye"></i> <?php echo __("Views Info"); ?> <i class="fa fa-eye"></i> <span class="hidden-md hidden-sm hidden-xs"><?php echo __("Views Info"); ?></span>
</button> </button>
<?php
echo Layout::getSuggestedButton($video['id']);
?>
</div> </div>
<?php } <?php }
?> ?>