Ticket #4977 (closed defect: fixed)

Opened 1 year ago

Last modified 11 months ago

Admin can't add pages to PDF book on IE8

Reported by: rjollos Assigned to: diorgenes
Priority: normal Component: TracWikiToPdfPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

The feature works fine on Firefox 3, however on IE8 pages can't be added to a PDF book. When a page is highlighted from the All Pages list and the down arrow is pressed, nothing happens. Here is the error that results:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; InfoPath?.2; .NET CLR 3.5.30729; .NET CLR 3.0.30618) Timestamp: Fri, 24 Apr 2009 07:14:34 UTC

Message: Invalid argument. Line: 7 Char: 12 Code: 0 URI: https://trac.physiosonics.com/chrome/wikitopdf/js/admin_wikitopdf.js

Attachments

Change History

05/05/09 13:08:38 changed by grigi

Does this diff work?

Index: admin_wikitopdf.js
===================================================================
--- admin_wikitopdf.js  (revision 5658)
+++ admin_wikitopdf.js  (working copy)
@@ -4,7 +4,7 @@
     for (var i = 0; i < from_box.options.length; i++) {
        var opt = from_box.options[i];
        if (opt.selected) {
-           to_box.options.add(opt);
+           to_box.add(opt);
            i--;
        }
     }

(follow-up: ↓ 4 ) 05/05/09 23:19:41 changed by mkc

It appears that MSIE does not support moving options between lists using the add method. We changed this function to create a new object instead. This seems to work in MSIE and FF.

function move_item(from, to) {
    var from_box = document.getElementById(from+'pages_select');
    var to_box = document.getElementById(to+'pages_select');
    for (var i = 0; i < from_box.options.length; i++) {
       var opt = from_box.options[i];
       if (opt.selected) {
           var newOpt = new Option( opt.text, opt.value );
           try {
               to_box.add(newOpt, null); // standards compliant
           }
           catch (ex) {
               to_box.add(newOpt);       // MSIE
           }
           from_box.remove(i);
           i--;
       }
    }
}

(in reply to: ↑ 2 ) 05/06/09 03:10:29 changed by rjollos

  • keywords deleted.

Replying to mkc:

It appears that MSIE does not support moving options between lists using the add method. We changed this function to create a new object instead. This seems to work in MSIE and FF. {{{ #!javascript function move_item(from, to) { var from_box = document.getElementById(from+'pages_select'); var to_box = document.getElementById(to+'pages_select'); for (var i = 0; i < from_box.options.length; i++) { var opt = from_box.options[i]; if (opt.selected) { var newOpt = new Option( opt.text, opt.value ); try { to_box.add(newOpt, null); // standards compliant } catch (ex) { to_box.add(newOpt); // MSIE } from_box.remove(i); i--; } } } }}}

This fixes the issue. Thanks.

05/06/09 09:49:49 changed by grigi

  • status changed from new to closed.
  • resolution set to fixed.

Applied change to [5674].


Add/Change #4977 (Admin can't add pages to PDF book on IE8)




Change Properties
Action