From 871991ae87284e645f05916a77a350ef42735eb2 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 24 Nov 2009 16:27:53 -0800 Subject: [PATCH] Fix a JS race condition with template attachments i18n. --- docs/changelog/7.x.x.txt | 1 + www/extras/templateAttachments.js | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 9973d7d6c..b047f2aa7 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -12,6 +12,7 @@ - fixed #11185: Code editor broken in IE8 for SQLReport - fixed #11177: Code editor steals focus on load - fixed #10888: Final touches on map point bugs + - fixed #11274: Add attachment broken in template 7.8.5 - added the EMS submission subsystem diff --git a/www/extras/templateAttachments.js b/www/extras/templateAttachments.js index 594f1bbaa..6d638d9dd 100644 --- a/www/extras/templateAttachments.js +++ b/www/extras/templateAttachments.js @@ -7,20 +7,6 @@ if ( typeof WebGUI == "undefined" ) { if ( typeof WebGUI.TemplateAttachments == "undefined" ) { WebGUI.TemplateAttachments = {}; } -if ( typeof WebGUI.TemplateAttachments.i18n == "undefined" ) { - WebGUI.TemplateAttachments.i18n = new WebGUI.i18n( { - namespaces : { - 'Asset_Template' : [ - "attachment header remove", - "Already attached!", - "No url!" - ] - }, - onpreload : { - fn : function(){} - } - } ); -} var addClick = (function() { var uniqueId = 1; @@ -181,7 +167,21 @@ var addClick = (function() { addAnchor.appendChild(tr); } - init(); + if ( typeof WebGUI.TemplateAttachments.i18n == "undefined" ) { + WebGUI.TemplateAttachments.i18n = new WebGUI.i18n( { + namespaces : { + 'Asset_Template' : [ + "attachment header remove", + "Already attached!", + "No url!" + ] + }, + onpreload : { + fn : init + } + } ); + } + return function() { var d = { index: nodes.index.value,