From f5f96134945793d2ed9727c962be305da560f56f Mon Sep 17 00:00:00 2001 From: Adrian Moennich Date: Tue, 8 Nov 2011 17:05:32 +0100 Subject: [PATCH] [FIX] Posters: background image upload --- .../webinterface/tpls/ConfModifPosterDesign.tpl | 36 +++++++++------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/indico/MaKaC/webinterface/tpls/ConfModifPosterDesign.tpl b/indico/MaKaC/webinterface/tpls/ConfModifPosterDesign.tpl index 33187754a..80bc2de4e 100755 --- a/indico/MaKaC/webinterface/tpls/ConfModifPosterDesign.tpl +++ b/indico/MaKaC/webinterface/tpls/ConfModifPosterDesign.tpl @@ -37,8 +37,6 @@ // List of poster template items var items = []; - var firstLoad = true; - // Item class function Item(itemId, key) { this.id = itemId; @@ -403,27 +401,22 @@ } function sent() { - if (firstLoad) { - firstLoad = false; + var iframeDocument = $('#uploadTarget')[0].contentDocument || $('#uploadTarget')[0].contentWindow; + if (iframeDocument.document) { + iframeDocument = iframeDocument.document; } - else { - var iframeDocument = $('#uploadTarget')[0].contentDocument || $('#uploadTarget')[0].contentWindow; - if (iframeDocument.document) { - iframeDocument = iframeDocument.document; - } - try { - if (backgroundId != -1) { - $('#background').remove(); - } - backgroundId = $('#background_id', iframeDocument).html(); - var backgroundURL = $('#background_url', iframeDocument).html(); - backgroundPos = $('#background_pos', iframeDocument).html(); - displayBackground(backgroundURL); - } - catch (err) { - $('#loadingIcon').hide(); + try { + if (backgroundId != -1) { + $('#background').remove(); } + backgroundId = $('#background_id', iframeDocument).html(); + var backgroundURL = $('#background_url', iframeDocument).html(); + backgroundPos = $('#background_pos', iframeDocument).html(); + displayBackground(backgroundURL); + } + catch (err) { + $('#loadingIcon').hide(); } } @@ -525,6 +518,7 @@ // show a throbber when uploading a background $('#bgForm').submit(function() { + $('#uploadTarget').one('load', sent); $('#loadingIcon').show(); }); @@ -569,8 +563,6 @@ e.preventDefault(); save(); }); - - $('#uploadTarget').load(sent); }); -- 2.11.4.GIT