<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -265,8 +265,8 @@ class NodesController &lt; ApplicationController
       flash.now[:error]  = _('could not update')
     end
 
-    if params[:attachment]
-      responds_to_parent do # execute the redirect in the main window
+    if params[:iframe]
+      responds_to_parent do # execute the redirect in the iframe's parent window
         render :update do |page|
           page.call &quot;UploadProgress.setAsFinished&quot;
           page.delay(1) do # allow the progress bar fade to complete
@@ -283,7 +283,7 @@ class NodesController &lt; ApplicationController
             redirect_to zen_path(@node, :mode =&gt; params[:mode])
           end
         end
-        format.js   { @flash = flash }
+        format.js { @flash = flash }
       end
     end
   end</diff>
      <filename>app/controllers/nodes_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -78,6 +78,24 @@ class VersionsController &lt; ApplicationController
         @edit = true
       end
     end
+    if params[:close] == 'true'
+      js_data &lt;&lt; &quot;Zena.reloadAndClose();&quot;
+    else
+      js_data &lt;&lt; &lt;&lt;-END_TXT
+      var current_sel = $('text_sel');
+      var current_tab = $('text_tab');
+
+      Event.observe(window, 'resize', function() { Zena.resizeElement('node_v_text'); } );
+      Event.observe(window, 'resize', function() { Zena.resizeElement('node_v_text'); } );
+      Zena.resizeElement('node_v_text');
+
+      $('node_form').getElements().each(function(input, index) {
+          new Form.Element.Observer(input, 3, function(element, value) {
+            opener.Zena.editor_preview('#{preview_node_version_path(:node_id=&gt;@node[:zip], :id=&gt;(@node.v_number || 0), :escape =&gt; false)}',element,value);
+          });
+      });
+      END_TXT
+    end
   end
 
   def custom_tab</diff>
      <filename>app/controllers/versions_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,10 +13,10 @@
   &lt;/div&gt;
   &lt;div class='validate'&gt;
     &lt;div&gt;
-      &lt;input name=&quot;validate&quot; type=&quot;submit&quot; value=&quot;&lt;%= _('validate') %&gt;&quot; /&gt;
+      &lt;input name='validate' type='submit' value='&lt;%= _('validate') %&gt;' /&gt;
     &lt;/div&gt;
     &lt;div&gt;
-      &lt;input name=&quot;save&quot; onclick=&quot;return Zena.save('&lt;%= save_text_node_path(:id =&gt; @node[:zip]) %&gt;',this.form,false);&quot; type=&quot;button&quot; value=&quot;&lt;%= _('save') %&gt;&quot; /&gt;
+      &lt;input name='save' onclick=&quot;return Zena.save('&lt;%= save_text_node_path(:id =&gt; @node[:zip]) %&gt;',this.form,false);&quot; type='button' value='&lt;%= _('save') %&gt;' /&gt;
     &lt;/div&gt;
     &lt;div&gt;&lt;a href='#' onclick='uploader=window.open(&quot;&lt;%= new_document_path(:parent_id=&gt;@node[:zip])%&gt;&quot;, &quot;uploader&quot;, &quot;location=1,width=400,height=300&quot;);uploader.opener = opener;return false;'&gt;&lt;%= _('btn_add_document')%&gt;&lt;/a&gt;&lt;/div&gt;
     &lt;% if @node.can_publish? &amp;&amp; !visitor.site.auto_publish? %&gt;&lt;div&gt;&lt;small&gt;&lt;input type='checkbox' name='node[v_backup]' value='true'/&gt; &lt;%= _('bak') %&gt;&lt;/small&gt; &lt;small&gt;&lt;input type='checkbox' name='node[v_status]' value='50'&lt;%= params[:pub] ? &quot; checked='checked'&quot; : '' %&gt;/&gt; &lt;%= _('pub') %&gt;&lt;/small&gt;&lt;/div&gt;&lt;% end -%&gt;
@@ -29,27 +29,3 @@
 
 &lt;/form&gt;
 &lt;/div&gt;
-
-&lt;%#= css_edit %&gt;
-&lt;% javascript_tag do -%&gt;
-var current_sel = $('&lt;%= partial[0] %&gt;_sel');
-var current_tab = $('&lt;%= partial[0] %&gt;_tab');
-Event.observe(window, 'resize', function() { Zena.resizeElement('node_v_text'); } );
-Event.observe(window, 'resize', function() { Zena.resizeElement('node_v_text'); } );
-function popup_loaded() {
-&lt;% if params[:close] == 'true' %&gt;
-  opener.window.location.href = opener.window.location.href;
-  window.close();
-&lt;% else -%&gt;
-  Zena.resizeElement('node_v_text');
-&lt;% end -%&gt;
-}
-
-$('node_form').getElements().each(function(input, index) {
-    new Form.Element.Observer(input, 3, function(element, value) {
-      &lt;%= &quot;opener.Zena.editor_preview('#{preview_node_version_path(:node_id=&gt;@node[:zip], :id=&gt;(@node.v_number || 0), :escape =&gt; false)}',element,value);&quot; %&gt;
-    });
-});
-
-&lt;% end -%&gt;
-&lt;iframe id=&quot;UploadIFrame&quot; name=&quot;UploadIFrame&quot; src=&quot;about:blank&quot;&gt;&lt;/iframe&gt;
\ No newline at end of file</diff>
      <filename>app/views/versions/edit.rhtml</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 # Settings specified here will take precedence over those in config/environment.rb
-config.log_level = :warn
+config.log_level = :info
 
 # The production environment is meant for finished, &quot;live&quot; apps.
 # Code is not reloaded between requests</diff>
      <filename>config/environments/production.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,26 +9,11 @@
 
   &lt;r:stylesheets list='popup,zena,search,upload-progress'/&gt;
   &lt;r:javascripts list='prototype,effects,dragdrop,zena,upload-progress'/&gt;
-&lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;
-// &lt;![CDATA[
-  // for popup windows (do not reload page)
-  var is_editor = true;
-  function popup_loaded() {
-    ; // dummy
-  }
-// ]]&gt;
-&lt;/script&gt;
   &lt;r:uses_datebox/&gt;
 &lt;/head&gt;
 
-&lt;body onload='popup_loaded();'&gt;
+&lt;body&gt;
   &lt;div id='loader'&gt;&lt;img src='/images/ajax-loader.gif'/&gt; &lt;r:trans text='uploading'/&gt;&lt;/div&gt;
-  &lt;div id=&quot;ProgressBarContainer&quot;&gt;
-  	&lt;div id=&quot;ProgressBarShell&quot; style=&quot;display:none;&quot;&gt;
-			&lt;div id=&quot;ProgressBarText&quot;&gt;&amp;nbsp;&lt;/div&gt;
-  		&lt;div id=&quot;ProgressBar&quot;&gt;&amp;nbsp;&lt;/div&gt;
-  	&lt;/div&gt;
-  &lt;/div&gt;
 
   &lt;div id='messages'&gt;
   &lt;/div&gt;</diff>
      <filename>db/init/base/skins/default/Node-+popupLayout.zafu</filename>
    </modified>
    <modified>
      <diff>@@ -252,6 +252,7 @@ module Zena
 
         # TODO: test
         def popup_layout
+          js_data &lt;&lt; &quot;var is_editor = true;&quot;
           template_url(:mode=&gt;'+popupLayout')
         end
 </diff>
      <filename>lib/zena/use/rendering.rb</filename>
    </modified>
    <modified>
      <diff></diff>
      <filename>locale/en/LC_MESSAGES/zena.mo</filename>
    </modified>
    <modified>
      <diff>@@ -199,7 +199,7 @@ msgstr &quot;&lt;img src='/images/lock.png' alt='closed'/&gt;&quot;
 
 #: app/helpers/application_helper.rb:1073
 msgid &quot;btn_title_open_discussion&quot;
-msgstr &quot;Open the edition window to edit the node's text, title, etc.&quot;
+msgstr &quot;Open the edition window to edit the node&quot;
 
 #: app/helpers/application_helper.rb:1076
 #: app/views/comments/_li.rhtml:3
@@ -1661,11 +1661,11 @@ msgstr &quot;&lt;img src='/images/add.png' alt='add'/&gt;&quot;
 
 #: lib/gettext_strings.rb:26
 msgid &quot;btn_title_edit&quot;
-msgstr &quot;Open the edition window to edit the node's text, title, etc.&quot;
+msgstr &quot;Open the edition window to edit the node.&quot;
 
 #: lib/gettext_strings.rb:27
 msgid &quot;btn_title_drive&quot;
-msgstr &quot;Open the drive window to change the node's location, links, etc.&quot;
+msgstr &quot;Open the drive window to change the location, links, etc.&quot;
 
 #: lib/gettext_strings.rb:33
 msgid &quot;btn_site_add&quot;</diff>
      <filename>locale/en/zena.po</filename>
    </modified>
    <modified>
      <diff>@@ -3,17 +3,19 @@
 // and to fix some strange Safari bugs.
 
 function submitUploadForm(form, uuid) {
+  if (!$('attachment' + uuid)) return;
   if ($('progress_bar' + uuid)) return;
-  var need_progress = $('attachment' + uuid);
+
   // create iframe and alter form to submit to an iframe
-  if (!$('UploadIFrame')) {
-    $(document.body).insert('&lt;iframe id=&quot;UploadIFrame&quot; name=&quot;UploadIFrame&quot; src=&quot;about:blank&quot;&gt;&lt;/iframe&gt;');
+  if (!$('using_iframe')) {
+    if (!$('UploadIFrame')) {
+      $(document.body).insert('&lt;iframe id=&quot;UploadIFrame&quot; name=&quot;UploadIFrame&quot; src=&quot;about:blank&quot;&gt;&lt;/iframe&gt;');
+    }
+    $(form).insert(&quot;&lt;input id='using_iframe' type='hidden' name='iframe' value='true'/&gt;&quot;);
+    $(form).target = 'UploadIFrame';
   }
-  $(form).target = 'UploadIFrame';
-  if (need_progress) {
-    // make sure the POST occurs before (Safari Bug)
-    UploadProgress.monitor(uuid, form);
-	}
+  // make sure the POST occurs before (Safari Bug)
+  UploadProgress.monitor(uuid, form);
   $(form).submit();
 }
 </diff>
      <filename>public/javascripts/upload-progress.js</filename>
    </modified>
    <modified>
      <diff>@@ -27,7 +27,7 @@ Zena.version_diff = function(id, from, to) {
 Zena.save = function(url, form, close_on_complete) {
   if ($(form).select('[name=&quot;attachment&quot;]')[0]) {
     // do not use ajax call
-    eval(form.onsubmit().getAttribute('onsubmit'));
+    eval(form.getAttribute('onsubmit'));
     return true;
   } else {
     if (close_on_complete) {
@@ -504,6 +504,12 @@ Zena.select_tab = function(name) {
   current_tab.style.display = '';
 }
 
+Zena.reloadAndClose = function() {
+  opener.window.location.href = opener.window.location.href;
+  window.close();
+}
+
+// POPUP GALLERY
 Zena.popup_gallery = null;
 
 Zena.popup = function(elem) {
@@ -652,4 +658,4 @@ Zena.popup_close = function() {
       }
     });
   }
-}
\ No newline at end of file
+}</diff>
      <filename>public/javascripts/zena.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7fb0fdb532ba6bcceb30032a5f51060942becf2e</id>
    </parent>
  </parents>
  <author>
    <name>Gaspard Bucher</name>
    <email>gaspard@teti.ch</email>
  </author>
  <url>http://github.com/zena/zena/commit/7f1780cd361ec683eeaabd044980a3234c53ffe3</url>
  <id>7f1780cd361ec683eeaabd044980a3234c53ffe3</id>
  <committed-date>2009-11-02T02:04:43-08:00</committed-date>
  <authored-date>2009-11-02T02:04:43-08:00</authored-date>
  <message>Fixed some javascript related bugs when submitting content through an iframe (upload).</message>
  <tree>be7cc87df770be8c58e584a5ee78345992ee4355</tree>
  <committer>
    <name>Gaspard Bucher</name>
    <email>gaspard@teti.ch</email>
  </committer>
</commit>
