Ignore:
Timestamp:
2010-11-08T17:31:20+13:00 (13 years ago)
Author:
sjb48
Message:

Iframe for preview working. Links are modified to use excerptid=gs_content

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/oran/js/gui_div.js

    r23276 r23298  
    4444        });
    4545}); */
    46 
     46/*
     47function loadXMLDoc()
     48{
     49    if (window.XMLHttpRequest)
     50    {// code for IE7+, Firefox, Chrome, Opera, Safari
     51        xmlhttp=new XMLHttpRequest();
     52    }
     53    else
     54    {// code for IE6, IE5
     55        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
     56    }
     57   
     58    xmlhttp.onreadystatechange=function()
     59    { 
     60        console.log("state changed to " + xmlhttp.readyState);
     61        console.log("status is " + xmlhttp.status);
     62        if (xmlhttp.readyState==4 && xmlhttp.status==200)
     63        {
     64            console.log("get code");
     65            console.log(xmlhttp.responseText);
     66            document.getElementById("gs_content").innerHTML=xmlhttp.responseText;
     67        }
     68    }
     69   
     70    xmlhttp.open("GET","http://localhost:8080/greenstone3/format?a=b&rt=s&s=ClassifierBrowse&c=simpleht&cl=CL1&excerptid=gs_content",true);
     71    //xmlhttp.open("GET","http://www.cs.waikato.ac.nz",true);
     72    //xmlhttp.open("GET","http://wand.net.nz/~sjb48/index.html",true);
     73    xmlhttp.send();
     74}
     75*/
    4776$(document).ready(function(){
    4877
     
    5180    var CURRENT_SELECT_VALUE = "";
    5281
    53     /*
    5482    var iframe = document.getElementById('iframe');
    5583    var iframe_document = iframe.document;
     
    6593        console.log("Chose content window");
    6694    }
     95
     96    // Edit the hrefs in preview_html - search for <a href="format?a=b&rt=r&s=ClassifierBrowse&c=simpleht&cl=CL1.2">
     97    var start_index = 0;
     98    var end_index = 0;
     99    while(start_index != -1)
     100    {
     101        start_index = preview_html.indexOf("href=\"format", start_index);
     102        console.log("start index = " + start_index);
     103        if(start_index != -1)
     104        {
     105            end_index = preview_html.indexOf("\">", start_index);
     106            console.log("end_index = " + end_index);
     107            a = preview_html.substring(0,end_index);
     108            b = preview_html.substring(end_index);
     109            preview_html = a.concat("&excerptid=gs_content", b);
     110            console.log(preview_html);
     111            start_index = end_index + "&excerptid=gs_content\">".length;
     112        }
     113    }
     114
    67115    // Put the content in the iframe
    68116    if(initialised_iframe == "false")
    69117    {
    70118        console.log("Initialised iframe with preview html");
     119        console.log(preview_html);
    71120        iframe_document.open();
    72121        iframe_document.writeln(preview_html); //.concat("&excerptid=gs_content"));
     
    74123        initialised_iframe = "true";
    75124    }
    76    
     125
     126    /*   
    77127    $(iframe_document.documentElement.innerHTML).find('a').each(function() {
    78128            console.log("data "+$(this).data('href'));
     
    132182    })
    133183
    134     $(".draggable_text").draggable({
    135             cursor: 'crosshair',
    136             connectToSortable: '.gsf_otherwise, .gsf_link, .gsf_choose, .gsf_when',
     184    $(".draggable_gsf_text").draggable({
     185            cursor: 'crosshair',
     186            connectToSortable: '.td-div, .gsf_when, .gsf_otherwise, .gsf_link, .gsf_choose_metadata, .gsf_default',
    137187            helper: 'clone',
    138188            revert: 'invalid'
     
    185235    $(".draggable_gsf_icon").draggable({
    186236            cursor: 'crosshair',
    187             connectToSortable: '.gsf_link',
     237            connectToSortable: '.td-div, .gsf_link, .gsf_choose, .gsf_when, .gsf_otherwise',
    188238            helper: 'clone',
    189239            revert: 'invalid'
Note: See TracChangeset for help on using the changeset viewer.