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;
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="">';
}
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.'">';
$table->data[0][2] .= '<img id="imagen" style="display:none;"
src="">';
}
$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;">
<button id="getsize" style="margin-left:20px;"
value="modsize">' . __('Set default size') .
value="modsize">' . __('Get default image size') .
'</button></span>';
if ($action == 'new') {
@ -189,6 +193,9 @@ echo "</form>";
$(document).ready (function () {
$('#imagen').attr('src','images/console/background/'+$('#background').val());
$('#imagen2').attr('src','images/console/background/'+$('#background').val());
$("#modsize").click(function(event){
event.preventDefault();
@ -197,31 +204,69 @@ $(document).ready (function () {
}
if ($('#imagen').attr('src') != '') {
$('input[name=width]').val($('#imagen').width());
$('input[name=height]').val($('#imagen').height());
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());
}
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());
}
}
});
$("#getsize").click(function(event){
event.preventDefault();
$('input[name=width]').val($('#imagen').width());
$('input[name=height]').val($('#imagen').height());
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());
}
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 ) {
if($( "#getsize" ).css('visibility')=='hidden'){
if (parseInt($('#imagen').width()) < 1024){
$('input[name=width]').val('1024');
}
else{
$('input[name=width]').val($('#imagen').width());
}
if (parseInt($('#imagen').height()) < 768){
$('input[name=height]').val('768');
}
else{
$('input[name=height]').val($('#imagen').height());
}
}
});
$("#background").change(function() {
$('#imagen').attr('src','images/console/background/'+$('#background').val());
$('#imagen').width(230);
$('#imagen').show();
$('#imagen2').attr('src','images/console/background/'+$('#background').val());
$('#imagen2').width(230);
$('#imagen2').show();
});
$( "input[type=submit]" ).click(function( event ) {
if($( "#getsize" ).css('visibility')=='hidden'){
$('input[name=width]').val($('#imagen').width());
$('input[name=height]').val($('#imagen').height());
}
});
$("#file-background_image").change(function(){
readURL(this);
});
@ -231,8 +276,9 @@ $(document).ready (function () {
var reader = new FileReader();
reader.onload = function (e) {
$('#imagen').attr('src', e.target.result);
$('#imagen').width(230);
$('#imagen').show();
$('#imagen2').attr('src', e.target.result);
$('#imagen2').width(230);
$('#imagen2').show();
}
reader.readAsDataURL(input.files[0]);
}

View File

@ -174,6 +174,12 @@ function update_button_palette_callback() {
// TODO VALIDATE DATA
switch (selectedItem) {
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) {
values['width'] =
$("#hidden-background_original_width").val();
@ -972,8 +978,8 @@ function loadFieldsFromDB(item) {
}
if (key == 'type_graph') {
$("select[name=type_graph]").val(val);
}
$("select[name=type_graph]").val(val);
}
if (key == 'label_position') {
$('#labelposup'+" img").attr('src','images/label_up.png');
@ -3023,6 +3029,9 @@ function eventsBackground() {
$('#background_grid').css('width', width);
$('#background_grid').css('height', height);
}
else{
updateDB('background', 0, values, 'resizestop');
}
if (launch_message)
alert($('#hidden-message_size').val());
}