Changeset 26767


Ignore:
Timestamp:
2013-01-21T19:07:55+13:00 (11 years ago)
Author:
davidb
Message:

Work done on linking collection browsing frames as well as linking to matching collection item frames.

Location:
gs3-extensions/html-to-expeditee/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • gs3-extensions/html-to-expeditee/trunk/src/perllib/ExpediteeFrameIO.pm

    r26749 r26767  
    621621
    622622        my $attr = {};
    623 
     623       
     624        my $link = $html_node->{'link'};
     625        $attr->{'F'} = $link if defined $link;
     626       
    624627        my $img_text = "\@i: $img_url";
    625628
     
    649652   
    650653    my $link = $html_node->{'link'};
    651     $attr->{'l'} = $link if defined $link;
     654    $attr->{'F'} = $link if defined $link;
    652655
    653656    my $data = $html_node->{'data'};
  • gs3-extensions/html-to-expeditee/trunk/src/src/cgi-bin/html-to-expeditee.pl.in

    r26753 r26767  
    355355                       
    356356                        var docRE    = new RegExp("(?:\\\\/)document\\\\/(.*?)(?:\$)");
    357                        
     357                        var clRE     = new RegExp("(\\\\/)browse\\\\/" + cl + "(\\\\/\\\\d+)+(\$)");
    358358                       
    359359                        for(var i = 0; i < gsContentChildren.length; i++){
     
    383383                                        if(fn !== null && fn!== undefined){
    384384                                            var frameName = collect + fn;
    385                                        
    386                                             //aElemChild.setAttribute("link",frameName);
    387                                             //console.log(aElemChild.getAttribute('link'));
    388                                             //console.log(aElemChild.link);
     385                                            aElemChild.setAttribute("link",frameName);
    389386                                        }
    390387                                    }
    391388                                   
    392                                 }else{
    393                                     //TODO: Check if the link is a CL link.
    394                                     //TODO: Make a hashmap for storing CL page frame numbers?
     389                                }else if(aElemSrc.match(clRE)){ //link the item to one of the other CL browsing frameset pages
     390
     391                                    var clMatch = clRE.exec(aElemSrc);
     392                                    var clPage = clMatch[2].substring(1);
     393                                    console.log(clPage);
     394                                    aElem.setAttribute("link",clPage);
    395395                                }
    396396                            }
    397397                        }
    398398   
    399                        
    400                         //TODO: Need to change htmlToExpeditee code to account for links
    401                        
    402                        
    403399                        var expFrameTree = htmlToExpeditee(gsContent);
    404400                        var expFrame = JSON.stringify(expFrameTree);
  • gs3-extensions/html-to-expeditee/trunk/src/src/js/html-to-expeditee.js

    r26749 r26767  
    139139    var jsonNode = null;
    140140   
     141   
    141142    if (node.nodeType == 3) { /* text node */
    142    
    143        
     143               
    144144        var text = node.nodeValue;
    145145
     
    155155        jsonNode.yb = pyb;
    156156       
    157         var link = node.link;
    158         if(link !== null && link !== undefined){
    159             jsonNode.link = link;
    160             console.log("Adding link");
    161         }else{
    162             console.log("no link found");
    163         }
    164        
    165157        var parent = node.parentNode;
    166158       
    167159        if (parent != null) {
     160       
     161            //set a frame link attribute
     162            var link = parent.attributes["link"];
     163           
     164            if(link !== null && link !== undefined){
     165                console.log(link.value);
     166                jsonNode.link = link.value;
     167            }
    168168       
    169169            if(compute_font){
     
    189189                    font_weight = new_font_weight;
    190190               
     191                //TODO: if parent node is an <i> element, then set style["font-style"] to be "italic".
    191192                if(new_font_style !== undefined && new_font_style !== null)
    192193                    font_style = new_font_style;
     
    233234    }
    234235
    235         var elemName = node.nodeName.toLowerCase();
     236    var elemName = node.nodeName.toLowerCase();
    236237
    237238    if (!elemName.match(/script/)) {
     
    259260        jsonNode.rect = rect;
    260261   
     262        //TODO: Set link attribute for images.
    261263        if (elemName.match("img")) {
     264           
     265            var getLink = node.getAttribute("link");
     266            if(getLink !== null && getLink !== undefined){
     267                jsonNode.link = getLink;
     268            }
     269           
    262270            jsonNode.img = node.src;
     271           
     272           
    263273        }
    264274
    265275        var style = {};
    266        
    267         //style["font-family"]      = getStyle(node,"font-family");
    268         //style["font-size"]        = getStyle(node,"font-size");
     276   
    269277        style["background-color"] = getStyle(node,"background-color");
    270278       
     
    272280
    273281        var attr = node.attributes["attr"];
    274         if (attr != null) {
    275         // console.log("attr = " + attr.value);
    276         jsonNode.attr = attr.value;
     282       
     283        if (attr != null) {
     284            jsonNode.attr = attr.value;
    277285        }
    278 
    279 
    280             var jsonChildNodes = [];
     286       
     287        var jsonChildNodes = [];
    281288
    282289        var cnode = node.firstChild;
Note: See TracChangeset for help on using the changeset viewer.