Changeset 24920


Ignore:
Timestamp:
01/07/12 16:10:39 (9 years ago)
Author:
davidb
Message:

Original script worked with Greenstone2. These edits are are the result of getting a basic system running for Greenstone3.

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

Legend:

Unmodified
Added
Removed
  • gs3-extensions/html-to-expeditee/trunk/src/INSTALL-FOR-GREENSTONE3.sh

    r24919 r24920  
    2424
    2525if [ ! -d ../../web/WEB-INF/cgi/html-to-expeditee ] ; then
    26   echo "Making supporting html-to-expeditee directory in cgi-bin folder"
     26  echo "Making supporting html-to-expeditee directory in web/ext folder"
    2727  mkdir ../../web/WEB-INF/cgi/html-to-expeditee
    2828fi
    2929
    30 if [ ! -d ../../web/WEB-INF/cgi/html-to-expeditee/jquery ] ; then
    31   echo "Copying jquery into supporting html-to-expeditee cgi-bin folder"
    32   /bin/cp -r packages/jquery ../../web/WEB-INF/cgi/html-to-expeditee/.
     30if [ ! -d ../../web/ext/html-to-expeditee/jquery ] ; then
     31  echo "Copying jquery into web/ext/html-to-expeditee folder"
     32  /bin/cp -r packages/jquery ../../web/ext/html-to-expeditee/.
    3333fi
    3434
    35 if [ ! -d ../../web/WEB-INF/cgi/html-to-expeditee/js ] ; then
    36   echo "Copying src/js into supporting html-to-expeditee cgi-bin folder"
    37   /bin/cp -r src/js ../../web/WEB-INF/cgi/html-to-expeditee/.
    38 elif [ "src/js/html-to-expeditee.js" -nt "../../web/WEB-INF/cgi/html-to-expeditee/js/html-to-expeditee.js" ] ; then
    39   echo "Updating src/js in the supporting html-to-expeditee cgi-bin folder"
    40   /bin/cp -r src/js ../../web/WEB-INF/cgi/html-to-expeditee/.
     35if [ ! -d ../../web/ext/html-to-expeditee/js ] ; then
     36  echo "Copying src/js into web/ext/html-to-expeditee/js"
     37  /bin/cp -r src/js ../../web/ext/html-to-expeditee/.
     38elif [ "src/js/html-to-expeditee.js" -nt "../../web/ext/html-to-expeditee/js/html-to-expeditee.js" ] ; then
     39  echo "Updating src/js to web/ext/html-to-expeditee/js"
     40  /bin/cp -r src/js ../../web/ext/html-to-expeditee/.
    4141fi
    4242
  • gs3-extensions/html-to-expeditee/trunk/src/src/cgi-bin/html-to-expeditee.pl.in

    r24918 r24920  
    5656    $gsdl_cgi->{'xml'} = 0;
    5757
     58
     59    my $collect = $gsdl_cgi->clean_param("c");   
     60    my $cl = $gsdl_cgi->clean_param("cl");   
     61
     62    # Establish collect_dir using defining 'site' along the way if GS3
     63
     64    my $site = undef;
     65    my $isGSDL2 = undef;
     66
     67    if ($gsdl_cgi->greenstone_version() == 2) {
     68        $isGSDL2 = 1;
     69    }
     70    else {
     71        $isGSDL2 = 0;
     72
     73    # GS3 (and possible future versions) make use of 'site'
     74    $site = $gsdl_cgi->clean_param("site");   
     75    if (!defined $site) {
     76        $gsdl_cgi->generate_error("No site specified.");
     77    }
     78    $gsdl_cgi->delete("site");
     79    }
     80
     81    my $collect_dir = $gsdl_cgi->get_collection_dir($site);
     82
     83
     84
    5885    my $fn = $gsdl_cgi->clean_param("fn");     # frame number
    5986
     
    6188    my $json_str = $gsdl_cgi->param("json");
    6289   
    63     my $output_dir = &util::filename_cat("C:","cygwin","tmp");
    64 
    65     # my $output_dir = &filename_cat($gsdlhome,"collect",$collect,"export");
    66 
     90    my $output_dir = &util::filename_cat($collect_dir,$collect,"export");
     91
     92    if (!-d $output_dir) {
     93        &util::mk_dir($output_dir);
     94    }
    6795    my $frame_filename = &util::filename_cat($output_dir,"$fn.exp");
     96
    6897    if (open(FOUT,">$frame_filename")) {
    6998
     
    86115  <head>
    87116    <title>HTML to Expeditee Frames</title>
    88     <link type="text/css" href="html-to-expeditee/jquery/css/le-frog/jquery-ui-1.8.16.custom.css" rel="stylesheet" />
    89     <script type="text/javascript" src="html-to-expeditee/jquery/js/jquery-1.6.2.min.js"></script>
    90     <script type="text/javascript" src="html-to-expeditee/jquery/js/jquery-ui-1.8.16.custom.min.js"></script>
    91     <script type="text/javascript" src="html-to-expeditee/js/gsajax-min.js"></script>
    92     <script type="text/javascript" src="html-to-expeditee/js/html-to-expeditee.js"></script>
     117    <link type="text/css" href="../ext/html-to-expeditee/jquery/css/le-frog/jquery-ui-1.8.16.custom.css" rel="stylesheet" />
     118    <script type="text/javascript" src="../ext/html-to-expeditee/jquery/js/jquery-1.6.2.min.js"></script>
     119    <script type="text/javascript" src="../ext/html-to-expeditee/jquery/js/jquery-ui-1.8.16.custom.min.js"></script>
     120    <script type="text/javascript" src="../ext/html-to-expeditee/js/gsajax-min.js"></script>
     121    <script type="text/javascript" src="../ext/html-to-expeditee/js/html-to-expeditee.js"></script>
    93122
    94123  </head>
    95124  <body>
    96125    <form>
    97       Convert the collection <input type="text" name="collect" id="collect" />
    98       to Expeditee frames by traversing the classifier <input type="text" name="cl" id="cl" />
    99 
    100       <input value="Go" id="go" type="submit">
     126      Convert the collection <input type="text" name="collect" value="$collect" id="collect" />
     127      to Expeditee frames by traversing the classifier <input type="text" name="cl" value="$cl" id="cl" />
     128
     129      <input value="$site" id="site" type="hidden">
     130      <input value="Go" id="go"
     131             class="ui-button ui-widget ui-state-default ui-corner-all"
     132             type="submit">
    101133
    102134    </form>
     
    121153          }
    122154          if (cl.match(/^\\d+\$/)) {
    123           cl = "CL" + cl;
    124           }
    125          
    126           var url = "/greenstone/cgi-bin/library.cgi";
    127           url += "?c="+collect +"&a=d&cl=" + cl;
    128          
     155              cl = "CL" + cl;
     156          }
     157         
     158          var gs2=$isGSDL2;
     159
     160          //var url = "/greenstone/cgi-bin/library.cgi";
     161          //url += "?c="+collect +"&a=d&cl=" + cl;
     162         
     163          var url;
     164          if (gs2) {
     165              url = "library.cgi";
     166          url += "?c="+collect +"&a=d&cl=" + cl;
     167          }
     168          else {
     169              url = "../dev";
     170              url += "?c="+collect +"&a=b&rt=s&s=ClassifierBrowse&cl=" + cl;
     171          }
     172
     173
    129174          /* processing animation */
    130175         
     
    132177          var outstandingURLs = [];
    133178          outstandingURLs.push(url);
    134          
     179
    135180          while (outstandingURLs.length>0) {
    136181          url = outstandingURLs.shift();
    137182         
    138183          var clHtml = urlGetSync(url);
    139          
    140           var gs2=1;
    141          
     184                 
    142185          var aElems;
    143           if (gs2) {
     186          //if (gs2) {
    144187              var workingTrav = document.getElementById("workingTraverse");
    145188              workingTrav.innerHTML = clHtml;
    146189              aElems = workingTrav.getElementsByTagName("a");
    147           }
    148           else {
     190          //}
     191          //else {
    149192              /* gs3 */
    150               var parser = new DOMParser();
    151               cl_doc = parser.parseFromString(clHtml,"text/html");
    152               var aElems = cl_doc.getElementsByTagName("a");
    153           }
     193            //  var parser = new DOMParser();
     194             // cl_doc = parser.parseFromString(clHtml,"text/html");
     195             // var aElems = cl_doc.getElementsByTagName("a");
     196          //}
    154197         
    155198         
     
    157200          /* any links with a=d ... d=???  => docOIDS */
    158201         
    159           var actionRE = new RegExp("(\\\\?|&)a=d(&|\$)");
     202          var actionRE = new RegExp("(\\\\?|&)a=(?:d|b)(&|\$)");
    160203          var clRE     = new RegExp("(\\\\?|&)cl=" + cl + "\\\\.");
    161           var docRE    = new RegExp("(?:|&)d=(.*?)(?:&|\$)");
     204          var docRE    = new RegExp("(?:\\\\?|&)d=(.*?)(?:&|\$)");
    162205
    163206          for (var i=0; i<aElems.length; i++) {
     
    169212              }
    170213              else if (href.match(docRE)) {
     214
    171215                  var docMatch = docRE.exec(href);
    172216                  var docOID = docMatch[1];
     217
    173218                  docOIDs.push(docOID);
    174219              }
     
    184229          console.log("doc oid = " + docOID);
    185230         
    186           var url = "/greenstone/cgi-bin/library.cgi";
    187           url += "?c="+collect +"&a=d&d=" + docOID;
     231          var url;
     232          if (gs2) {
     233              url = "library.cgi";
     234              url += "?c="+collect +"&a=d&d=" + docOID;
     235         }
     236         else {
     237              url = "../dev";
     238              url += "?c="+collect +"&a=d&d=" + docOID;
     239              url += "&ed=1";
     240         }
    188241         
    189242          iframe.src = url;
     
    227280
    228281          var collect = document.getElementById("collect").value;
    229 
    230           var url = "/greenstone/cgi-bin/html-to-expeditee.pl";
    231           var params = "c=" + collect + "&fn=" + frameID;
     282          var site    = document.getElementById("site").value;
     283
     284          var url = "html-to-expeditee.pl";
     285          var params = "c=" + collect;
     286          if (site.match(/\\w/)) {
     287        params += "&site=" + site;
     288          }
     289          params += "&fn=" + frameID;
    232290          params += "&json=" + escape(expFrame);
    233291          //params += "&json=" + "testing123";
     
    246304          var cl = document.getElementById("cl").value;
    247305         
    248           var url = "/greenstone/cgi-bin/library.cgi";
    249           url += "?c="+collect +"&a=d&d=" + docOID;
    250          
     306
     307          //var url = "/greenstone/cgi-bin/library.cgi";
     308          //url += "?c="+collect +"&a=d&d=" + docOID;
     309         
     310          var gs2 = $isGSDL2;
     311              var url;
     312
     313              if (gs2) {
     314                  url = "library.cgi";
     315                  url += "?c="+collect +"&a=d&d=" + docOID;
     316              }
     317              else {
     318                  url = "../dev";
     319                  url += "?c="+collect +"&a=d&d=" + docOID;
     320                  url += "&ed=1";
     321              }
     322
     323
     324
    251325          iframe.src = url;
    252326          }
Note: See TracChangeset for help on using the changeset viewer.