Modify

Opened 8 years ago

Closed 8 years ago

#4977 closed defect (fixed)

Admin can't add pages to PDF book on IE8

Reported by: Ryan J Ollos Owned by: Diorgenes Felipe Grzesiuk
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 (0)

Change History (4)

comment:1 Changed 8 years ago by Nickolas Grigoriadis

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--;
        }
     }

comment:2 Changed 8 years ago by Michael Ching

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--;
       }
    }
}

comment:4 in reply to:  2 Changed 8 years ago by Ryan J Ollos

Keywords: MESSAGE removed

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.

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.

comment:5 Changed 8 years ago by Nickolas Grigoriadis

Resolution: fixed
Status: newclosed

Applied change to [5674].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Diorgenes Felipe Grzesiuk.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.