From 97be7054f89516660f03a5b531f1af6a5a85bba6 Mon Sep 17 00:00:00 2001
From: Yoshinori Okuji <yo@nexedi.com>
Date: Thu, 1 Jul 2010 10:14:49 +0000
Subject: [PATCH] 2010-07-01 yo * Fix a bug that scripts in every fetched
 document may be executed. Otherwise, ready callbacks can be executed many
 times.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36767 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../portal_skins/erp5_popup_ui/erp5_popup.js.xml      | 11 ++++++-----
 bt5/erp5_popup_ui/bt/change_log                       |  3 +++
 bt5/erp5_popup_ui/bt/revision                         |  2 +-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/bt5/erp5_popup_ui/SkinTemplateItem/portal_skins/erp5_popup_ui/erp5_popup.js.xml b/bt5/erp5_popup_ui/SkinTemplateItem/portal_skins/erp5_popup_ui/erp5_popup.js.xml
index 6e6b64d94d..957cd78b05 100644
--- a/bt5/erp5_popup_ui/SkinTemplateItem/portal_skins/erp5_popup_ui/erp5_popup.js.xml
+++ b/bt5/erp5_popup_ui/SkinTemplateItem/portal_skins/erp5_popup_ui/erp5_popup.js.xml
@@ -88,12 +88,12 @@ jQuery(function() {\n
     jQuery(\'<div class="loading" style="background-color: #AAAAAA; opacity: 0.5; position: absolute; left: 0%; width: 100%; top: 0%; height: 100%; transparent;"><p class="loading" style="position: absolute; left: 0%; width: 100%; top: 30%; height: 40%; text-align: center; color: black; font-size: 32pt;">Loading...</p></div>\').appendTo(dialog);\n
     animate();\n
 \n
-    // define  fallback values\n
-    if(method_name==undefined)\n
+    // define fallback values\n
+    if (method_name == undefined)\n
       method_name = \'post\';\n
-    if(method_name==\'post\')\n
+    if (method_name == \'post\')\n
       var caller = jQuery.post;\n
-    if(method_name==\'get\')\n
+    if (method_name == \'get\')\n
       var caller = jQuery.get;\n
     caller(url, query, function(data, textStatus, XMLHttpRequest) {\n
       if (textStatus == \'success\' || textStatus == \'notmodified\') {\n
@@ -101,7 +101,8 @@ jQuery(function() {\n
         dialog.empty();\n
         //jQuery(\'div.loading\', dialog).remove();\n
 \n
-        dialog.html(jQuery(\'<div />\').append(data).find(\'form\'));\n
+        dialog.html(jQuery(\'<div />\').append(data.replace(/<script(.|\\s)*?\\/script>/g, "")).find(\'form\'));\n
+\n
         // XXX Get rid of unneeded stuff in JavaScript for now.\n
         jQuery(\'.bars, .breadcrumb, .logged_in_as\', dialog).remove();\n
         jQuery(\'[id]\', dialog).removeAttr(\'id\');\n
diff --git a/bt5/erp5_popup_ui/bt/change_log b/bt5/erp5_popup_ui/bt/change_log
index 3e4cbfc221..6013769bfe 100644
--- a/bt5/erp5_popup_ui/bt/change_log
+++ b/bt5/erp5_popup_ui/bt/change_log
@@ -1,3 +1,6 @@
+2010-07-01 yo
+* Fix a bug that scripts in every fetched document may be executed. Otherwise, ready callbacks can be executed many times.
+
 2010-06-30 yo
 * Remove jquery from this Business Template. Instead, depend on erp5_jquery.
 
diff --git a/bt5/erp5_popup_ui/bt/revision b/bt5/erp5_popup_ui/bt/revision
index f11c82a4cb..9a037142aa 100644
--- a/bt5/erp5_popup_ui/bt/revision
+++ b/bt5/erp5_popup_ui/bt/revision
@@ -1 +1 @@
-9
\ No newline at end of file
+10
\ No newline at end of file
-- 
2.30.9