1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
Daniel Neto 2024-07-09 17:56:15 -03:00
parent 5c1b21d381
commit 0db329d825
2 changed files with 84 additions and 83 deletions

View file

@ -1,4 +1,4 @@
<link href="<?php echo getCDN(); ?>node_modules/croppie/croppie.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo getCDN(); ?>node_modules/croppie/croppie.css" rel="stylesheet" type="text/css" />
<script src="<?php echo getCDN(); ?>node_modules/croppie/croppie.min.js" type="text/javascript"></script>
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Title and Logo'); ?> </div>
@ -10,7 +10,7 @@
<div class="col-md-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-globe"></i></span>
<input id="inputWebSiteTitle" placeholder="<?php echo __("Web site title"); ?>" class="form-control" type="text" value="<?php echo $config->getWebSiteTitle(); ?>" maxlength="45" >
<input id="inputWebSiteTitle" placeholder="<?php echo __("Web site title"); ?>" class="form-control" type="text" value="<?php echo $config->getWebSiteTitle(); ?>" maxlength="45">
</div>
</div>
</div>
@ -28,7 +28,7 @@
<hr>
<div class="row">
<div class="col-md-12">
<button type="submit" class="btn btn-block btn-primary btn-lg" ><?php echo __("Save"); ?> <span class="fa fa-save"></span></button>
<button type="submit" class="btn btn-block btn-primary btn-lg"><?php echo __("Save"); ?> <span class="fa fa-save"></span></button>
</div>
</div>
</form>
@ -38,14 +38,15 @@
var logoCrop;
var logoSmallCrop;
var theme;
function readFile(input, c) {
console.log("read file");
if ($(input)[0].files && $(input)[0].files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
reader.onload = function(e) {
c.croppie('bind', {
url: e.target.result
}).then(function () {
}).then(function() {
console.log('jQuery bind complete');
});
@ -59,25 +60,25 @@
var logoImgBase64;
$(document).ready(function () {
$(document).ready(function() {
// start croppie logo
$('#logo').on('change', function () {
$('#logo').on('change', function() {
readFile(this, logoCrop);
});
$('#logo-btn').on('click', function (ev) {
$('#logo-btn').on('click', function(ev) {
$('#logo').trigger("click");
});
$('#logo-result-btn').on('click', function (ev) {
$('#logo-result-btn').on('click', function(ev) {
logoCrop.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function (resp) {
}).then(function(resp) {
});
});
logoCrop = $('#croppieLogo').croppie({
url: '<?php echo $global['webSiteRootURL'], $config->getLogo(); ?>?'+Math.random(),
url: '<?php echo $global['webSiteRootURL'], $config->getLogo(); ?>?' + Math.random(),
enableExif: true,
enforceBoundary: false,
mouseWheelZoom: false,
@ -90,40 +91,40 @@
height: 70
}
});
setTimeout(function () {
setTimeout(function() {
logoCrop.croppie('setZoom', 1);
}, 1000);
$('#updateConfigForm').submit(function (evt) {
$('#updateConfigForm').submit(function(evt) {
evt.preventDefault();
modal.showPleaseWait();
$('#tabRegularLink').tab('show');
logoCrop.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function (resp) {
logoImgBase64 = resp;
$.ajax({
url: webSiteRootURL+'admin/customize_settings_nativeUpdate.json.php',
data: {
"logoImgBase64": logoImgBase64,
"webSiteTitle": $('#inputWebSiteTitle').val(),
},
type: 'post',
success: function (response) {
if (response.status === "1") {
avideoAlert("<?php echo __("Congratulations!"); ?>", "<?php echo __("Your configurations has been updated!"); ?>", "success");
} else {
avideoAlert("<?php echo __("Sorry!"); ?>", "<?php echo __("Your configurations has NOT been updated!"); ?>", "error");
setTimeout(function() {
logoCrop.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function(resp) {
logoImgBase64 = resp;
$.ajax({
url: webSiteRootURL + 'admin/customize_settings_nativeUpdate.json.php',
data: {
"logoImgBase64": logoImgBase64,
"webSiteTitle": $('#inputWebSiteTitle').val(),
},
type: 'post',
success: function(response) {
if (response.status === "1") {
avideoAlertSuccess( __("Your configurations has been updated!"));
} else {
avideoAlertError(__("Your configurations has NOT been updated!"));
}
modal.hidePleaseWait();
}
modal.hidePleaseWait();
}
});
});
});
}, 500);
});
});
</script>
</script>

View file

@ -727,60 +727,60 @@ if (User::isAdmin()) {
evt.preventDefault();
modal.showPleaseWait();
$('#tabRegularLink').tab('show');
setTimeout(function() {
logoCrop.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function(resp) {
logoImgBase64 = resp;
faviconCrop.croppie('result', {
logoCrop.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function(resp) {
faviconBase64 = resp;
$.ajax({
url: webSiteRootURL + 'objects/configurationUpdate.json.php',
data: {
"logoImgBase64": logoImgBase64,
"faviconBase64": faviconBase64,
"video_resolution": $('#inputVideoResolution').val(),
"webSiteTitle": $('#inputWebSiteTitle').val(),
"description": $('#inputWebSiteDescription').val(),
"language": $('#inputLanguage').val(),
"contactEmail": $('#inputEmail').val(),
"authCanUploadVideos": $('#authCanUploadVideos').val(),
"authCanViewChart": $('#authCanViewChart').val(),
"authCanComment": $('#authCanComment').val(),
"head": $('#head').val(),
"adsense": $('#adsense').val(),
"disable_analytics": $('#disable_analytics').prop("checked"),
"allow_download": $("#allow_download").prop("checked"),
"session_timeout": $('#session_timeout').val(),
"autoplay": $('#autoplaySwitch').prop("checked"),
"theme": theme,
"smtp": $('#enableSmtp').prop("checked"),
"smtpAuth": $('#enableSmtpAuth').prop("checked"),
"smtpSecure": $('#smtpSecure').val(),
"smtpHost": $('#smtpHost').val(),
"smtpUsername": $('#smtpUsername').val(),
"smtpPassword": $('#smtpPassword').val(),
"smtpPort": $('#smtpPort').val(),
"encoder_url": $('#encoder_url').val(),
},
type: 'post',
success: function(response) {
if (response.status === "1") {
avideoAlert("<?php echo __("Congratulations!"); ?>", "<?php echo __("Your configurations has been updated!"); ?>", "success");
} else {
avideoAlert("<?php echo __("Sorry!"); ?>", "<?php echo __("Your configurations has NOT been updated!"); ?>", "error");
logoImgBase64 = resp;
faviconCrop.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function(resp) {
faviconBase64 = resp;
$.ajax({
url: webSiteRootURL + 'objects/configurationUpdate.json.php',
data: {
"logoImgBase64": logoImgBase64,
"faviconBase64": faviconBase64,
"video_resolution": $('#inputVideoResolution').val(),
"webSiteTitle": $('#inputWebSiteTitle').val(),
"description": $('#inputWebSiteDescription').val(),
"language": $('#inputLanguage').val(),
"contactEmail": $('#inputEmail').val(),
"authCanUploadVideos": $('#authCanUploadVideos').val(),
"authCanViewChart": $('#authCanViewChart').val(),
"authCanComment": $('#authCanComment').val(),
"head": $('#head').val(),
"adsense": $('#adsense').val(),
"disable_analytics": $('#disable_analytics').prop("checked"),
"allow_download": $("#allow_download").prop("checked"),
"session_timeout": $('#session_timeout').val(),
"autoplay": $('#autoplaySwitch').prop("checked"),
"theme": theme,
"smtp": $('#enableSmtp').prop("checked"),
"smtpAuth": $('#enableSmtpAuth').prop("checked"),
"smtpSecure": $('#smtpSecure').val(),
"smtpHost": $('#smtpHost').val(),
"smtpUsername": $('#smtpUsername').val(),
"smtpPassword": $('#smtpPassword').val(),
"smtpPort": $('#smtpPort').val(),
"encoder_url": $('#encoder_url').val(),
},
type: 'post',
success: function(response) {
if (response.status === "1") {
avideoAlertSuccess(__("Your configurations has been updated!"));
} else {
avideoAlertError(__("Your configurations has NOT been updated!"));
}
modal.hidePleaseWait();
}
modal.hidePleaseWait();
}
});
});
});
});
}, 500);
});