Merge branch '77-bug-en-fondo-de-consolas-visuales-pandora-7-2' into 'develop'

77-bug-en-fondo-de-consolas-visuales-pandora-7-2 - #77

See merge request !203
This commit is contained in:
Enrique Camargo 2017-02-23 17:22:57 +01:00
commit a781007396
2 changed files with 76 additions and 21 deletions

View File

@ -107,12 +107,16 @@ $table->data[0][1] = html_print_input_text('name', $visualConsoleName,
$table->rowspan[0][2] = 6; $table->rowspan[0][2] = 6;
if ($action == 'new') { if ($action == 'new') {
$table->data[0][2] = '<img id="imagen" style="display:none;" $table->data[0][2] = '<img id="imagen2" style="display:none;"
src="">';
$table->data[0][2] .= '<img id="imagen" style="display:none;"
src="">'; src="">';
} }
else { else {
$table->data[0][2] = '<img id="imagen" style="width:230px;" $table->data[0][2] = '<img id="imagen2" style="width:230px;"
src="images/console/background/'.$background.'">'; src="images/console/background/'.$background.'">';
$table->data[0][2] .= '<img id="imagen" style="display:none;"
src="">';
} }
$table->data[1][0] = __('Group:'); $table->data[1][0] = __('Group:');
@ -161,7 +165,7 @@ $table->data[5][1] .= '<span class="opt" style="visibility:hidden;">' .
$table->data[5][1] .= '<span class="opt" style="visibility:hidden;"> $table->data[5][1] .= '<span class="opt" style="visibility:hidden;">
<button id="getsize" style="margin-left:20px;" <button id="getsize" style="margin-left:20px;"
value="modsize">' . __('Set default size') . value="modsize">' . __('Get default image size') .
'</button></span>'; '</button></span>';
if ($action == 'new') { if ($action == 'new') {
@ -189,6 +193,9 @@ echo "</form>";
$(document).ready (function () { $(document).ready (function () {
$('#imagen').attr('src','images/console/background/'+$('#background').val());
$('#imagen2').attr('src','images/console/background/'+$('#background').val());
$("#modsize").click(function(event){ $("#modsize").click(function(event){
event.preventDefault(); event.preventDefault();
@ -197,30 +204,68 @@ $(document).ready (function () {
} }
if ($('#imagen').attr('src') != '') { if ($('#imagen').attr('src') != '') {
if (parseInt($('#imagen').width()) < 1024){
alert('Default width is '+$('#imagen').width()+'px, smaller than minimum -> 1024px');
$('input[name=width]').val('1024');
}
else{
$('input[name=width]').val($('#imagen').width()); $('input[name=width]').val($('#imagen').width());
}
if (parseInt($('#imagen').height()) < 768){
alert('Default height is '+$('#imagen').height()+'px, smaller than minimum -> 768px');
$('input[name=height]').val('768');
}
else{
$('input[name=height]').val($('#imagen').height()); $('input[name=height]').val($('#imagen').height());
} }
}
}); });
$("#getsize").click(function(event){ $("#getsize").click(function(event){
event.preventDefault(); event.preventDefault();
$('input[name=width]').val($('#imagen').width());
$('input[name=height]').val($('#imagen').height());
});
$("#background").change(function() { if (parseInt($('#imagen').width()) < 1024){
$('#imagen').attr('src','images/console/background/'+$('#background').val()); alert('Default width is '+$('#imagen').width()+'px, smaller than minimum -> 1024px');
$('#imagen').width(230); $('input[name=width]').val('1024');
$('#imagen').show(); }
else{
$('input[name=width]').val($('#imagen').width());
}
if (parseInt($('#imagen').height()) < 768){
alert('Default height is '+$('#imagen').height()+'px, smaller than minimum -> 768px');
$('input[name=height]').val('768');
}
else{
$('input[name=height]').val($('#imagen').height());
}
}); });
$( "input[type=submit]" ).click(function( event ) { $( "input[type=submit]" ).click(function( event ) {
if($( "#getsize" ).css('visibility')=='hidden'){ if($( "#getsize" ).css('visibility')=='hidden'){
if (parseInt($('#imagen').width()) < 1024){
$('input[name=width]').val('1024');
}
else{
$('input[name=width]').val($('#imagen').width()); $('input[name=width]').val($('#imagen').width());
}
if (parseInt($('#imagen').height()) < 768){
$('input[name=height]').val('768');
}
else{
$('input[name=height]').val($('#imagen').height()); $('input[name=height]').val($('#imagen').height());
} }
}
}); });
$("#background").change(function() {
$('#imagen').attr('src','images/console/background/'+$('#background').val());
$('#imagen2').attr('src','images/console/background/'+$('#background').val());
$('#imagen2').width(230);
$('#imagen2').show();
});
$("#file-background_image").change(function(){ $("#file-background_image").change(function(){
readURL(this); readURL(this);
@ -231,8 +276,9 @@ $(document).ready (function () {
var reader = new FileReader(); var reader = new FileReader();
reader.onload = function (e) { reader.onload = function (e) {
$('#imagen').attr('src', e.target.result); $('#imagen').attr('src', e.target.result);
$('#imagen').width(230); $('#imagen2').attr('src', e.target.result);
$('#imagen').show(); $('#imagen2').width(230);
$('#imagen2').show();
} }
reader.readAsDataURL(input.files[0]); reader.readAsDataURL(input.files[0]);
} }

View File

@ -174,6 +174,12 @@ function update_button_palette_callback() {
// TODO VALIDATE DATA // TODO VALIDATE DATA
switch (selectedItem) { switch (selectedItem) {
case 'background': case 'background':
if(values['width'] < 1024 || values['height'] < 768){
alert('Please min size recommend is 1024x768');
return false;
}
if(values['width'] == 0 && values['height'] == 0) { if(values['width'] == 0 && values['height'] == 0) {
values['width'] = values['width'] =
$("#hidden-background_original_width").val(); $("#hidden-background_original_width").val();
@ -3023,6 +3029,9 @@ function eventsBackground() {
$('#background_grid').css('width', width); $('#background_grid').css('width', width);
$('#background_grid').css('height', height); $('#background_grid').css('height', height);
} }
else{
updateDB('background', 0, values, 'resizestop');
}
if (launch_message) if (launch_message)
alert($('#hidden-message_size').val()); alert($('#hidden-message_size').val());
} }