Changeset 25304


Ignore:
Timestamp:
2012-03-27T15:17:42+13:00 (12 years ago)
Author:
kjdon
Message:

removed a few hard coded strings, working on handling external links

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java

    r25257 r25304  
    362362            String href = null;
    363363            String rl = null;
    364 
     364            String el = null;
    365365            while (queryIter.hasNext())
    366366            {
    367367                String q = queryIter.next();
    368                 if (q.equals("el"))
    369                 {
    370                     if ((queryMap.get(q)[0]).equals("direct"))
    371                     {
    372                         redirect = true;
    373                     }
    374                 }
    375                 else if (q.equals("href"))
     368                if (q.equals(GSParams.EXTERNAL_LINK_TYPE))
     369                {
     370                  el = queryMap.get(q)[0];
     371                }
     372                else if (q.equals(GSParams.HREF))
    376373                {
    377374                    href = queryMap.get(q)[0];
     
    381378                    href = StringUtils.replace(href, "%3A", "\\:");
    382379                }
    383                 else if (q.equals("rl"))
     380                else if (q.equals(GSParams.RELATIVE_LINK))
    384381                {
    385382                    rl = queryMap.get(q)[0];
     
    387384            }
    388385
    389             //if query_string contains "el=", the web page will be redirected to the external URl, otherwise a greenstone page with an external URL will be displayed
     386            //if query_string contains "el=direct", an href is specified, and its not a relative link, then the web page will be redirected to the external URl, otherwise a greenstone page with an external URL will be displayed
    390387            //"rl=0" this is an external link
    391388            //"rl=1" this is an internal link
    392             if ((redirect) && (href != null) && (rl.equals("0")))
    393             {// This is an external link, the web page is re-directed to the external URL (&el=&rl=0&href="http://...")
     389            if ((href != null) && (rl.equals("0")))
     390            {// This is an external link,
     391
     392              if (el.equals("framed")) {
     393                //TODO **** how best to change to a=p&sa=html&c=collection&url=href
     394                // response.setContentType("text/xml");
     395                //response.sendRedirect("http://localhost:8383/greenstone3/gs3library?a=p&sa=html&c=external&url="+href);
     396              } else {
     397                // el = '' or direct
     398                //the web page is re-directed to the external URL (&el=&rl=0&href="http://...")
    394399                response.setContentType("text/xml");
    395400                response.sendRedirect(href);
     401              }
    396402            }
    397403        }
     
    477483        // commands are issued (and also don't need to do caching for this request)
    478484        boolean should_cache = true;
    479         if (action != null && action.equals(GSParams.SYSTEM))
     485        if (action != null && action.equals(GSParams.SYSTEM_ACTION))
    480486        {
    481487            should_cache = false;
Note: See TracChangeset for help on using the changeset viewer.