Merge branch '1736-Consola-visual-Previsualización-background-no-carga-imagen-en-meta-dev' into 'develop'

Fixed background preimage in visual console

See merge request artica/pandorafms!1243
This commit is contained in:
vgilc 2018-01-29 13:23:46 +01:00
commit dc5840b844
1 changed files with 20 additions and 22 deletions

View File

@ -113,8 +113,14 @@ if ($action == 'new') {
src="">';
}
else {
if(defined('METACONSOLE')){
$table->data[0][2] = '<img id="imagen2" style="width:230px;"
src="../../images/console/background/'.$background.'">';
} else {
$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="">';
}
@ -204,24 +210,6 @@ echo "</form>";
<script type="text/javascript">
$(document).ready (function () {
var metaconsole = null;
function is_metaconsole() {
if (metaconsole === null)
metaconsole = $("input[name='metaconsole']").val();
if (metaconsole != 0 && metaconsole != undefined)
return true;
else
return false;
}
var url_hack_metaconsole = '';
if (is_metaconsole()) {
url_hack_metaconsole = '../../';
}
$("#modsize").click(function(event){
event.preventDefault();
@ -280,6 +268,7 @@ $(document).ready (function () {
}
else{
original_image=new Image();
url_hack_metaconsole = metaconsole_url();
original_image.src= url_hack_metaconsole + 'images/console/background/'+$('#background').val();
if (parseInt(original_image.width) < 1024){
alert('Default width is '+original_image.width+'px, smaller than minimum -> 1024px');
@ -330,7 +319,7 @@ $(document).ready (function () {
var size_changer_state = false;
$("#background").change(function() {
url_hack_metaconsole = metaconsole_url();
$('#imagen2').attr('src', url_hack_metaconsole + 'images/console/background/'+$('#background').val());
$('#imagen2').width(230);
@ -345,6 +334,7 @@ $(document).ready (function () {
$("#background").mouseout(function() {
if(size_changer_state){
url_hack_metaconsole = metaconsole_url();
$('#imagen').attr('src',url_hack_metaconsole + 'images/console/background/'+$('#background').val());
$('input[name=width]').val($('#imagen').width());
$('input[name=height]').val($('#imagen').height());
@ -398,6 +388,14 @@ $(document).ready (function () {
}
});
function metaconsole_url() {
metaconsole = $("input[name='metaconsole_activated']").val();
if( metaconsole == 0 || metaconsole === undefined){
return '';
} else {
return '../../';
}
}
});
</script>