Changeset 23336

Show
Ignore:
Timestamp:
22.11.2010 17:32:16 (9 years ago)
Author:
sjb48
Message:

Continued work on XHTML parsing for format statement saving. Found js code for ensuring XHTML (innerXHTML). Removed a few unneccessary bits of code from default servlet that were lingering around from when we first started playing with format statements.

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

Legend:

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

    r23333 r23336  
    1717import javax.xml.parsers.DocumentBuilder; 
    1818import javax.xml.parsers.DocumentBuilderFactory; 
     19 
     20import java.io.PrintWriter; 
     21import java.io.StringWriter; 
    1922 
    2023import org.apache.log4j.*; 
     
    7578            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 
    7679            DocumentBuilder builder = factory.newDocumentBuilder(); 
    77             InputSource is = new InputSource( new StringReader( format_string ) ); 
     80            String input = "<html><head><title></title></head><body>" + format_string + "</body></html>"; 
     81            InputSource is = new InputSource( new StringReader( input ) ); 
    7882            Document d = builder.parse( is ); 
    7983            page_response.appendChild(d); 
     
    8185        catch( Exception ex ) { 
    8286            logger.error("There was an exception "+ex); 
     87             
     88            StringWriter sw = new StringWriter(); 
     89            PrintWriter pw = new PrintWriter(sw, true); 
     90            ex.printStackTrace(pw); 
     91            pw.flush(); 
     92            sw.flush(); 
     93            logger.error(sw.toString()); 
    8394        } 
    8495 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java

    r23312 r23336  
    548548    String publicID = "-//W3C//DTD HTML 4.01 Transitional//EN"; 
    549549    String systemID = "http://www.w3.org/TR/html4/loose.dtd"; 
    550          
     550 
    551551    // Try to get the system and public ID from the current skin xsl document 
    552552    // otherwise keep the default values. 
  • main/trunk/greenstone3/web/interfaces/default/transform/classifier.xsl

    r22569 r23336  
    6161    </xsl:call-template>       
    6262   
    63     <!-- Sam's div code --> 
    64  
    65     <!-- <xsl:if test="/page/pageRequest[@name='output']='debug'"> --> 
    66  
    67     <xsl:variable name="fmt"> 
    68     <xsl:call-template name="xml-to-string"> 
    69             <xsl:with-param name="node-set" select="//format[@type='browse']"/> 
    70           </xsl:call-template> 
    71     </xsl:variable> 
    72  
    73     <!-- <xsl:variable name="tok" select="fn:tokenize($fmt,'/s+')"/> --> 
    74  
    75       <div id="format"> 
    76         <p> 
    77       <b>Format string here</b> 
    78       <i> 
    79           <xsl:value-of select="$fmt"/> 
    80           <!-- <xsl:value-of select="$tok"/> --> 
    81       </i> 
    82         </p> 
    83       </div> 
    84     <!-- </xsl:if> --> 
    85  
    86    
    8763    <div id="content"> 
    8864      <xsl:apply-templates select="service/classifierList"> 
  • main/trunk/greenstone3/web/interfaces/default/transform/util.xsl

    r22569 r23336  
    1111  <xsl:param name="library_name"/> 
    1212 
    13   <xsl:include href="xml-to-string.xsl"/> 
    14    
    1513  <!-- every pages ................................................. --> 
    1614   
  • main/trunk/greenstone3/web/interfaces/oran/js/gui_div.js

    r23333 r23336  
    77{ 
    88 
    9     var formatStatement = document.getElementById('formatStatement').innerHTML; 
    10     //console.log(formatStatement); 
     9    var formatDiv = document.getElementById('formatStatement'); 
     10    var formatStatement = innerXHTML(formatDiv); 
     11    console.log(formatStatement); 
     12 
    1113 
    1214    //var myurl = 'http://localhost:8080/greenstone3/format?a=s&sa=s&t='+formatStatement; 
     
    1517 
    1618    $.post("http://localhost:8080/greenstone3/format?a=s&sa=s", {data: formatStatement}, function(data) { 
    17         $('.result').innerHTML = data; //html(data); 
     19        //$('.result').innerHTML = data; //html(data); 
    1820        console.log("Success, we have received data"); 
    1921        console.log(data); 
  • main/trunk/greenstone3/web/interfaces/oran/transform/layouts/main.xsl

    r23333 r23336  
    22<xsl:stylesheet version="1.0" 
    33    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
     4 
    45    xmlns:java="http://xml.apache.org/xslt/java" 
    56    xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil" 
     
    2324 
    2425    <!-- the output format for this layout is html --> 
    25     <xsl:output method="html" omit-xml-declaration="yes"/>   
     26    <!-- <xsl:output method="xml" version="1.0" encoding="UTF-8" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" indent="yes" omit-xml-declaration="yes"/> --> 
     27    <xsl:output method="html" omit-xml-declaration="yes"/>  
    2628 
    2729    <!-- the main layout is defined here --> 
     
    130132<!-- Sam2's div code --> 
    131133 
     134    <script type="text/javascript" src="interfaces/oran/js/innerxhtml.js"><xsl:text> </xsl:text></script> 
    132135    <script type="text/javascript" src="interfaces/oran/js/gui_div.js"><xsl:text> </xsl:text></script> 
    133136    
     
    177180 
    178181    <div id="formatStatement"> 
    179  
     182        <div id="formatRoot"> 
     183     
    180184    <xsl:call-template name="xml-to-gui"> 
    181185        <xsl:with-param name="node-set" select="//format"/> <!-- [@type='browse']"/>  --> 
    182186        <xsl:with-param name="metadataSets" select="//metadataSetList"/>  
    183187    </xsl:call-template>  
    184  
     188        </div> 
    185189    </div> 
    186190    </td>     
  • main/trunk/greenstone3/web/interfaces/oran/transform/layouts/xml-to-gui.xsl

    r23333 r23336  
    196196                    <xsl:choose> 
    197197                        <xsl:when test="@type='document'"> 
    198                             <option value = "document" selected = "document">Document</option> 
     198                            <option value = "document" selected = "selected">Document</option> 
    199199                            <option value = "classifier">Classifier</option> 
    200200                            <option value = "source">Source</option> 
    201201                        </xsl:when> 
    202202                        <xsl:when test="@type='classifier'"> 
    203                             <option value = "classifier" selected = "classifier">Classifier</option> 
     203                            <option value = "classifier" selected = "selected">Classifier</option> 
    204204                            <option value = "document">Document</option> 
    205205                            <option value = "source">Source</option> 
    206206                        </xsl:when> 
    207207                        <xsl:when test="@type='source'"> 
    208                             <option value = "source" selected = "source">Source</option> 
     208                            <option value = "source" selected = "selected">Source</option> 
    209209                            <option value ="document">Document</option> 
    210210                            <option value ="classifier">Classifier</option> 
    211211                        </xsl:when> 
    212212                        <xsl:when test="@type='horizontal'"> 
    213                             <option value = "horizontal" selected = "horizontal">Horizontal</option> 
    214                             <option value = "source" selected = "source">Source</option> 
     213                            <option value = "horizontal" selected = "selected">Horizontal</option> 
     214                            <option value = "source">Source</option> 
    215215                            <option value ="document">Document</option> 
    216216                            <option value ="classifier">Classifier</option> 
     
    236236            <xsl:variable name="mode"> 
    237237                <xsl:choose> 
    238                     <xsl:when test="not(@mode)">MODE=<input class="mode" type="text" name="rawtextinput" size="10" value="vertical"></input></xsl:when> 
    239                     <xsl:otherwise>MODE=<input class="mode" type="text" name="rawtextinput" size="10" value="{@mode}"></input></xsl:otherwise> 
     238                    <xsl:when test="not(@mode)">MODE=<input class="mode" type="text" name="rawtextinput" size="10" value="vertical"><xsl:text></xsl:text></input></xsl:when> 
     239                    <xsl:otherwise>MODE=<input class="mode" type="text" name="rawtextinput" size="10" value="{@mode}"/></xsl:otherwise> 
    240240                </xsl:choose> 
    241241            </xsl:variable> 
    242242     
    243             <table class="header"><tbody><tr><td class="header">MATCH=<input class="match" type="text" name="rawtextinput" size="10" value="{@match}"></input></td><td class="header"><xsl:copy-of select="$mode"/></td><td class="header"><a href="#" class="minmax ui-icon ui-icon-plusthick" title="Click me to expand">[+]</a></td><td class="header"><a href="#" class="remove ui-icon ui-icon-closethick" title="Click me to remove"/></td></tr></tbody></table> 
     243            <table class="header"><tbody><tr><td class="header">MATCH=<input class="match" type="text" name="rawtextinput" size="10" value="{@match}"/></td><td class="header"><xsl:copy-of select="$mode"/></td><td class="header"><a href="#" class="minmax ui-icon ui-icon-plusthick" title="Click me to expand">[+]</a></td><td class="header"><a href="#" class="remove ui-icon ui-icon-closethick" title="Click me to remove"/></td></tr></tbody></table> 
    244244 
    245245                <table class="table" border="1"> 
     
    254254                </tbody> 
    255255                </table> 
    256         </div><br/> 
     256        </div> 
    257257    </xsl:template> 
    258258 
     
    312312                    <xsl:choose> 
    313313                        <xsl:when test="@type='document'"> 
    314                             <option value = "document" selected = "document">Document</option> 
     314                            <option value = "document" selected = "selected">Document</option> 
    315315                            <option value = "classifier">Classifier</option> 
    316316                            <option value = "source">Source</option> 
    317317                        </xsl:when> 
    318318                        <xsl:when test="@type='classifier'"> 
    319                             <option value = "classifier" selected = "classifier">Classifier</option> 
     319                            <option value = "classifier" selected = "selected">Classifier</option> 
    320320                            <option value = "document">Document</option> 
    321321                            <option value = "source">Source</option> 
    322322                        </xsl:when> 
    323323                        <xsl:when test="@type='source'"> 
    324                             <option value = "source" selected = "source">Source</option> 
     324                            <option value = "source" selected = "selected">Source</option> 
    325325                            <option value ="document">Document</option> 
    326326                            <option value ="classifier">Classifier</option>