Changeset 23360

Show
Ignore:
Timestamp:
30.11.2010 17:26:36 (8 years ago)
Author:
sjb48
Message:

Starting working on new format statement save architecture. This involves a new action, FormatAction?, which will be responsible for the XSL transform and will pass the format string to the Collection object via the Message Router,

Location:
main/trunk/greenstone3
Files:
2 added
7 modified

Legend:

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

    r23340 r23360  
    7272        system.setAttribute(GSXML.SYSTEM_SUBSET_ATT, info); 
    7373    } 
    74     else if(subaction.equals("s")) { // save format statement 
    75          logger.error("Initiate save"); 
    76          String format_string = (String)params.get("data"); 
    77          logger.error("data="+format_string); 
    78  
    79          //SamParser sam = new SamParser(); 
    80          //String format_statement = sam.parse(input); 
    81          //logger.error("format string="+format_statement); 
    82      
    83         Element page_response = this.doc.createElement(GSXML.RESPONSE_ELEM); 
    84  
    85          Iterator it = params.keySet().iterator(); 
    86          while(it.hasNext()) 
    87          { 
    88             logger.error("Param: "+it.next()); 
    89          }   
    90  
    91         //Node text = this.doc.createTextNode(format_string); 
    92         //page_response.appendChild(text); 
    93      
    94          
    95         try { 
    96             DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 
    97             DocumentBuilder builder = factory.newDocumentBuilder(); 
    98             //String input = "<html><head><title></title></head><body>" + format_string + "</body></html>"; 
    99             String input = format_string; 
    100             InputSource is = new InputSource( new StringReader( input ) ); 
    101             Document d = builder.parse( is ); 
    102             Element e = d.getDocumentElement(); 
    103              
    104             page_response.appendChild(this.doc.importNode(e, true)); 
    105         } 
    106         catch( Exception ex ) { 
    107             logger.error("There was an exception "+ex); 
    108              
    109             StringWriter sw = new StringWriter(); 
    110             PrintWriter pw = new PrintWriter(sw, true); 
    111             ex.printStackTrace(pw); 
    112             pw.flush(); 
    113             sw.flush(); 
    114             logger.error(sw.toString()); 
    115         } 
    116          
    117      
    118         //Element child = this.doc.createElement("div"); //format_string); 
    119         //Node text = this.doc.createTextNode(format_string); //"<h1>Hi there and greetings!</h1>"); 
    120         //child.innerHTML = "<h1>Hi there and greetings!</h1>"; 
    121         //child.setNodeValue(format_string); 
    122         //child.appendChild(text); 
    123         result.appendChild(page_response); 
    124         return result; 
    125     } else { 
     74    else { 
    12675        String name = (String)params.get(GSParams.SYSTEM_MODULE_NAME); 
    12776        String type = (String)params.get(GSParams.SYSTEM_MODULE_TYPE); 
     
    153102    } 
    154103 
    155     /* 
    156     public void parse (String message) { 
    157         //get a factory 
    158         SAXParserFactory spf = SAXParserFactory.newInstance(); 
    159         try { 
    160  
    161             //get a new instance of parser 
    162             SAXParser sp = spf.newSAXParser(); 
    163             InputSource is = new InputSource( new StringReader( message ) ); 
    164             //parse the file and also register this class for call backs 
    165             sp.parse(is, new SamParser()); 
    166  
    167         }catch(SAXException se) { 
    168             se.printStackTrace(); 
    169         }catch(ParserConfigurationException pce) { 
    170             pce.printStackTrace(); 
    171         }catch (IOException ie) { 
    172             ie.printStackTrace(); 
    173         } 
    174     } 
    175     */ 
    176  
    177     //Event Handlers 
    178 /*    public void startElement(String uri, String localName, String qName, 
    179         Attributes attributes) throws SAXException { 
    180         //reset 
    181         logger.error("Start Element: "+qName); 
    182         //if(qName.equalsIgnoreCase("Template")) { 
    183             //create a new instance of employee 
    184             //tempEmp = new Employee(); 
    185             //tempEmp.setType(attributes.getValue("type")); 
    186              
    187         //} 
    188     } 
    189  
    190  
    191     public void characters(char[] ch, int start, int length) throws SAXException { 
    192         tempVal = new String(ch,start,length); 
    193     } 
    194  
    195     public void endElement(String uri, String localName, 
    196         String qName) throws SAXException { 
    197  
    198         logger.error("Characters: "+tempVal); 
    199         logger.error("End Element: "+qName); 
    200         /* 
    201         if(qName.equalsIgnoreCase("Employee")) { 
    202             //add it to the list 
    203             myEmpls.add(tempEmp); 
    204  
    205         }else if (qName.equalsIgnoreCase("Name")) { 
    206             tempEmp.setName(tempVal); 
    207         }else if (qName.equalsIgnoreCase("Id")) { 
    208             tempEmp.setId(Integer.parseInt(tempVal)); 
    209         }else if (qName.equalsIgnoreCase("Age")) { 
    210             tempEmp.setAge(Integer.parseInt(tempVal)); 
    211         } */ 
    212  
    213     //} 
    214  
    215104} 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/Receptionist.java

    r22085 r23360  
    234234 
    235235    logger.debug("receptionist returned response"); 
     236    logger.error("receptionist returned response"); 
    236237    logger.debug(this.converter.getString(resulting_page)); 
     238    logger.error(this.converter.getString(resulting_page)); 
    237239//    logger.info("receptionist returned response"); 
    238240//    logger.info(this.converter.getString(resulting_page)); 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSXML.java

    r21911 r23360  
    7575  public static final String TERM_ELEM = "term"; 
    7676  public static final String SYSTEM_ELEM = "system"; 
     77  public static final String FORMAT_STRING_ELEM = "formatString"; 
    7778   
    7879  //config file elems 
     
    198199  // modify the requests 
    199200  public static final String REQUEST_TYPE_MESSAGING = "messaging"; 
     201  // save the format string 
     202  public static final String REQUEST_TYPE_FORMAT_STRING = "formatString"; 
    200203   
    201204  // service types 
  • main/trunk/greenstone3/web/interfaces/oran/interfaceConfig.xml

    r19988 r23360  
    2121    <action name='pr' class='ProcessAction' xslt='process.xsl'/> 
    2222    <action name='s' class='SystemAction' xslt='system.xsl'/> 
     23 
     24    <action name='f' class='FormatAction' xslt='formatString.xsl'/> 
     25 
    2326    <action name='g' class='GeneralAction'> 
    2427      <subaction name="authen" xslt='pages/authen.xsl'/> 
  • main/trunk/greenstone3/web/interfaces/oran/js/gui_div.js

    r23340 r23360  
    1616    //jQuery.post( url, [ data ], [ success(data, textStatus, XMLHttpRequest) ], [ dataType ] ) 
    1717 
    18     $.post("http://localhost:8080/greenstone3/format?a=s&sa=s", {data: formatStatement}, function(data) { 
     18    // How do I find out my collection name? 
     19 
     20    $.post("http://localhost:8080/greenstone3/format?a=f", {data: formatStatement}, function(data) { 
    1921        //$('.result').innerHTML = data; //html(data); 
    2022        console.log("Success, we have received data"); 
  • main/trunk/greenstone3/web/interfaces/oran/transform/layouts/xml-to-gui.xsl

    r23357 r23360  
    391391        <!-- <xsl:text>&lt;br/&gt;</xsl:text> <br/> --> 
    392392        <div class="block leaf gsf_text" title="gsf:text"> 
    393                 <xsl:variable name="rawtext"><xsl:text disable-output-escaping='no'>&lt;br/&gt;</xsl:text></xsl:variable> 
    394                 <table class="header"><tbody><tr><td class="header"><input class="text" type="text" name="rawtextinput" size="10" value="{$rawtext}"></input></td><td class="header"><a href="[myhref]" class="ui-icon ui-icon-closethick"/></td></tr></tbody></table> 
     393                <!-- <xsl:variable name="rawtext"><xsl:text disable-output-escaping='no'>br/</xsl:text></xsl:variable> --> 
     394                <table class="header"><tbody><tr><td class="header">&lt;<input class="text" type="text" name="rawtextinput" size="10" value="br/"></input>&gt;</td><td class="header"><a href="[myhref]" class="ui-icon ui-icon-closethick"/></td></tr></tbody></table> 
    395395        </div> 
    396396     
     
    408408        <!-- <xsl:text>&lt;br/&gt;</xsl:text> <br/> --> 
    409409        <div class="block leaf gsf_text" title="gsf:text"> 
    410                 <xsl:variable name="rawtext"><xsl:text disable-output-escaping='no'>&lt;i&gt;</xsl:text></xsl:variable> 
    411                 <table class="header"><tbody><tr><td class="header"><input class="text" type="text" name="rawtextinput" size="10" value="{$rawtext}"></input></td><td class="header"><a href="[myhref]" class="ui-icon ui-icon-closethick"/></td></tr></tbody></table> 
     410                <!-- <xsl:variable name="rawtext"><xsl:text disable-output-escaping='no'>i</xsl:text></xsl:variable> --> 
     411                <table class="header"><tbody><tr><td class="header">&lt;<input class="text" type="text" name="rawtextinput" size="10" value="i"></input>&gt;</td><td class="header"><a href="[myhref]" class="ui-icon ui-icon-closethick"/></td></tr></tbody></table> 
    412412        </div> 
    413413     
     
    418418 
    419419        <div class="block leaf gsf_text" title="gsf:text"> 
    420                 <xsl:variable name="rawtext"><xsl:text disable-output-escaping='no'>&lt;/i&gt;</xsl:text></xsl:variable> 
    421                 <table class="header"><tbody><tr><td class="header"><input class="text" type="text" name="rawtextinput" size="10" value="{$rawtext}"></input></td><td class="header"><a href="[myhref]" class="ui-icon ui-icon-closethick"/></td></tr></tbody></table> 
     420                <xsl:variable name="rawtext"><xsl:text disable-output-escaping='no'>/i</xsl:text></xsl:variable> 
     421                <table class="header"><tbody><tr><td class="header">&lt;<input class="text" type="text" name="rawtextinput" size="10" value="{$rawtext}"></input>&gt;</td><td class="header"><a href="[myhref]" class="ui-icon ui-icon-closethick"/></td></tr></tbody></table> 
    422422        </div> 
    423423 
  • main/trunk/greenstone3/web/interfaces/oran/transform/system.xsl

    r23358 r23360  
    169169  <!-- Strip out any plain text --> 
    170170  <xsl:template match="text()" mode="text"> 
    171     <xsl:text></xsl:text> <xsl:value-of select="."/><xsl:text></xsl:text> 
     171    <xsl:text></xsl:text><xsl:value-of select="." disable-output-escaping="yes"/><xsl:text></xsl:text> 
    172172    <xsl:apply-templates mode="text"/> 
    173173  </xsl:template>