1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 19:42:38 +02:00

add a function to read tail

This commit is contained in:
daniel 2018-10-06 12:39:51 -03:00
parent 780722aa03
commit 49e7d45af5
6 changed files with 133 additions and 74 deletions

View file

@ -39,6 +39,7 @@ class CustomizeAdvanced extends PluginAbstract {
$obj->doNotShowLeftMenuAudioAndVideoButtons = false;
$obj->disableNativeSignUp = false;
$obj->disableNativeSignIn = false;
$obj->disablePersonalInfo = true;
$obj->doNotShowWebsiteOnContactForm = false;
$obj->newUsersCanStream = false;
$obj->doNotIndentifyByEmail = false;

View file

@ -567,17 +567,12 @@ require_once $global['systemRootPath'] . 'objects/functions.php';
</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label"></label>
<div class="col-md-8">
<button type="submit" class="btn btn-primary" ><?php echo __("Save"); ?> <span class="glyphicon glyphicon-save"></span></button>
<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>
</div>
</div>
</div>
</form>
</div>
</div>
<script>

View file

@ -34,6 +34,7 @@ function clean_name(str) {
str = str.stripAccents().toLowerCase();
return str.replace(/\W+/g, "-");
}
var pleaseWaitIsINUse = false;
$(document).ready(function () {
modal = modal || (function () {
var pleaseWaitDiv = $("#pleaseWaitDialog");
@ -43,10 +44,15 @@ $(document).ready(function () {
return {
showPleaseWait: function () {
if(pleaseWaitIsINUse){
return false;
}
pleaseWaitIsINUse = true;
pleaseWaitDiv.modal();
},
hidePleaseWait: function () {
pleaseWaitDiv.modal('hide');
pleaseWaitIsINUse = false;
},
setProgress: function (valeur) {
pleaseWaitDiv.find('.progress-bar').css('width', valeur + '%').attr('aria-valuenow', valeur);

View file

@ -45,7 +45,10 @@ $advancedCustom = json_decode($json_file);
</legend>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#basicInfo" id="aBasicInfo"><?php echo __("Basic Info") ?></a></li>
<?php if (empty($advancedCustom->disablePersonalInfo)) { ?>
<li><a data-toggle="tab" href="#personalInfo" id="aPersonalInfo"><?php echo __("Personal Info") ?></a></li>
<?php } ?>
</ul>
<div class="tab-content">
@ -54,11 +57,14 @@ $advancedCustom = json_decode($json_file);
include './userBasicInfo.php';
?>
</div>
<?php if (empty($advancedCustom->disablePersonalInfo)) { ?>
<div id="personalInfo" class="tab-pane fade" style="padding: 10px 0;">
<?php
include './userPersonalInfo.php';
?>
</div>
<?php } ?>
</div>
<!-- Button -->

View file

@ -157,6 +157,67 @@
swal("Sorry - you're browser doesn't support the FileReader API");
}
}
function updateUserFormSubmit() {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/userUpdate.json.php',
data: {
"user": $('#inputUser').val(),
"pass": $('#inputPassword').val(),
"email": $('#inputEmail').val(),
"name": $('#inputName').val(),
"about": $('#textAbout').val(),
"channelName": $('#channelName').val(),
"analyticsCode": $('#analyticsCode').val()
},
type: 'post',
success: function (response) {
if (response.status > "0") {
uploadCrop.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function (resp) {
console.log("userSavePhoto");
$.ajax({
type: "POST",
url: "<?php echo $global['webSiteRootURL']; ?>objects/userSavePhoto.php",
data: {
imgBase64: resp
},
success: function () {
console.log("userSaveBackground");
uploadCropBg.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function (resp) {
$.ajax({
type: "POST",
url: "<?php echo $global['webSiteRootURL']; ?>objects/userSaveBackground.php",
data: {
imgBase64: resp
}, success: function (response) {
console.log("SavePersonal");
modal.hidePleaseWait();
<?php if(empty($advancedCustom->disablePersonalInfo)){ ?>
savePersonalInfo();
<?php } ?>
}
});
});
}
});
});
} else if (response.error) {
swal("<?php echo __("Sorry!"); ?>", response.error, "error");
modal.hidePleaseWait();
} else {
swal("<?php echo __("Sorry!"); ?>", "<?php echo __("Your user has NOT been updated!"); ?>", "error");
modal.hidePleaseWait();
}
}
});
}
$(document).ready(function () {
$('#upload').on('change', function () {
readFile(this, uploadCrop);
@ -200,7 +261,6 @@
height: 250
}
});
$('#updateUserForm').submit(function (evt) {
evt.preventDefault();
if (!isAnalytics()) {
@ -218,57 +278,9 @@
swal("<?php echo __("Sorry!"); ?>", "<?php echo __("Your password does not match!"); ?>", "error");
return false;
} else {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/userUpdate.json.php',
data: {
"user": $('#inputUser').val(),
"pass": $('#inputPassword').val(),
"email": $('#inputEmail').val(),
"name": $('#inputName').val(),
"about": $('#textAbout').val(),
"channelName": $('#channelName').val(),
"analyticsCode": $('#analyticsCode').val()
},
type: 'post',
success: function (response) {
if (response.status > "0") {
uploadCrop.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function (resp) {
$.ajax({
type: "POST",
url: "<?php echo $global['webSiteRootURL']; ?>objects/userSavePhoto.php",
data: {
imgBase64: resp
}
}).done(function (o) {
uploadCropBg.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function (resp) {
$.ajax({
type: "POST",
url: "<?php echo $global['webSiteRootURL']; ?>objects/userSaveBackground.php",
data: {
imgBase64: resp
}
}).done(function (o) {
modal.hidePleaseWait();
savePersonalInfo();
});
});
});
});
} else if (response.error) {
swal("<?php echo __("Sorry!"); ?>", response.error, "error");
modal.hidePleaseWait();
} else {
swal("<?php echo __("Sorry!"); ?>", "<?php echo __("Your user has NOT been updated!"); ?>", "error");
modal.hidePleaseWait();
}
}
});
setTimeout(function () {
updateUserFormSubmit();
}, 1000);
return false;
}
});

View file

@ -1,5 +1,12 @@
<?php
if(!empty($advancedCustom->disablePersonalInfo)){
return false;
}
$text = "-- " . __('Select one Option') . " --";
$myCountry = $user->getCountry();
$myRegion = $user->getRegion();
$myCity = $user->getCity();
?>
<div class="form-group">
<label class="col-md-4 control-label"><?php echo __("First Name"); ?></label>
@ -54,7 +61,11 @@ $countries = IP2Location::getCountries();
<option><?php echo $text; ?></option>
<?php
foreach ($countries as $key => $value) {
echo '<option>' . $value . '</option>';
$selected = "";
if ($myCountry === $value) {
$selected = 'selected';
}
echo '<option ' . $selected . '>' . $value . '</option>';
}
?>
</select>
@ -106,6 +117,11 @@ $countries = IP2Location::getCountries();
var uploadCropDocument;
function savePersonalInfo() {
$('#aPersonalInfo').tab('show');
setTimeout(function(){savePersonalInfoAjax(); }, 1000);
}
function savePersonalInfoAjax(){
modal.showPleaseWait();
uploadCropDocument.croppie('result', {
@ -130,7 +146,6 @@ $countries = IP2Location::getCountries();
modal.hidePleaseWait();
});
});
}
@ -160,7 +175,7 @@ $countries = IP2Location::getCountries();
});
$("#country").on("change", function (e) {
modal.showPleaseWait();
//modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/User_Location/regions.json.php?country=' + $('#country').val(),
success: function (response) {
@ -168,27 +183,51 @@ $countries = IP2Location::getCountries();
$('#region').append($("<option></option>").text('<?php echo $text; ?>'));
$('#city').empty();
$('#city').append($("<option></option>").text('<?php echo $text; ?>'));
var found = false;
$.each(response, function (key, value) {
$('#region').append($("<option></option>").attr("value", value).text(value));
var selected = '';
if (value === '<?php echo $myRegion; ?>') {
selected = 'selected';
found = true;
}
$('#region').append($("<option " + selected + "></option>").attr("value", value).text(value));
});
modal.hidePleaseWait();
//modal.hidePleaseWait();
if (found) {
$("#region").trigger('change');
}
}
});
});
$("#region").on("change", function (e) {
modal.showPleaseWait();
//modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/User_Location/cities.json.php?country=' + $('#country').val() + '&region=' + $('#region').val(),
success: function (response) {
$('#city').empty();
$('#city').append($("<option></option>").text('<?php echo $text; ?>'));
$.each(response, function (key, value) {
$('#city').append($("<option></option>").attr("value", value).text(value));
var selected = '';
if (value === '<?php echo $myCity; ?>') {
selected = 'selected';
}
$('#city').append($("<option " + selected + "></option>").attr("value", value).text(value));
});
modal.hidePleaseWait();
//modal.hidePleaseWait();
}
});
});
<?php
if (!empty($myCountry)) {
?>
setTimeout(function () {
$("#country").trigger('change');
}, 1000);
<?php
}
?>
});
</script>