|
[HepData-svn] r1329 - in trunk/hepdata-webapp/src/main: java/cedar/hepdata/webapp/components java/cedar/hepdata/webapp/pages resources/cedar/hepdata/webapp/pagesblackhole at projects.hepforge.org blackhole at projects.hepforge.orgThu Dec 10 14:29:39 GMT 2009
Author: whalley Date: Thu Dec 10 14:29:38 2009 New Revision: 1329 Log: fixing problem with single table display and counter Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/WriteDsObservables.java trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/Search.java trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/ViewBase.java trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/EasySearch1.tml trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/EasySearch2.tml trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/EasySearch3.tml Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/WriteDsObservables.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/WriteDsObservables.java Tue Dec 1 15:48:55 2009 (r1328) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/WriteDsObservables.java Thu Dec 10 14:29:38 2009 (r1329) @@ -82,7 +82,7 @@ for ( String dsobs : _dsobservables ){ nc += 1; count += 1; - writer.element("a href='Search/dsreaction_" + dsreaction.replace(" ","_").replace(">","$003e").replace("/","$002f") + "_and_dsobservable_" + dsobs + "'"); + writer.element("a href='Search/dsreaction_" + dsreactionURL.replace(" ","_").replace(">","$003e").replace("(","$0028").replace(")","$0029").replace("%","$0025") + "_and_dsobservable_" + dsobs.replace("/","$002f").replace("*","$002a").replace("=","$003d") + "'"); writer.write(dsobs); writer.end(); writer.write(" (" + _counts.get(nc) + ")"); Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/Search.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/Search.java Tue Dec 1 15:48:55 2009 (r1328) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/Search.java Thu Dec 10 14:29:38 2009 (r1329) @@ -72,7 +72,7 @@ return getSearchString(); } public void onActivate(String q) { -// System.out.println("activating searchString"); + System.out.println("activating searchString"); try{ q = URLDecoder.decode(q,"UTF-8"); } catch(Exception ex){} Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/ViewBase.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/ViewBase.java Tue Dec 1 15:48:55 2009 (r1328) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/ViewBase.java Thu Dec 10 14:29:38 2009 (r1329) @@ -48,16 +48,21 @@ public void setCounter(){ _counter = getStarting(); } + public void setCounter(int n){ + _counter = n; + } public String resetCounter(){ _counter = 1; return ""; } public Integer getCounter(){ + if(getQueryD() != null) _counter = getQueryD(); return _counter; } public Integer getCounterEnd(){ int last = _counter + getLength() -1; if(last > getPaper().getDatasets().size()) last = getPaper().getDatasets().size(); + if(getQueryD() != null) last = getQueryD(); return last; } public Integer getStarting(){ @@ -323,62 +328,69 @@ } - public List <Dataset> getDatasetsnew(){ - String pid = null; - StringBuffer qs = new StringBuffer("select distinct d from Paper p join p._datasets d where"); - if (getQueryParam("p") != null) { - pid = getQueryParam("p"); - qs.append(" p._hepdataId = :pid"); - } else if (getQueryParam("irn") != null) { - pid = getQueryParam("irn"); - qs.append(" p._spiresId = :pid"); - } else if (getQueryParam("red") != null) { - pid = getQueryParam("red"); - qs.append(" p._redId = :pid"); - } -// Integer dsmin = getMinDsId(); -// Integer dsmax = getMaxDsId(); - Integer dsmin = getCounter(); - Integer dsmax = getCounter() + getLength() - 1; -// System.out.println("outputting datasets " + dsmin + " to " + dsmax); - if(dsmin == null && dsmax == null){ - - } else if (dsmax == null){ - qs.append(" and d._localId = :dsmin order by d._localId"); - } else { - qs.append(" and d._localId >= :dsmin and d._localId <= :dsmax order by d._localId"); - } - Query q = getSession().createQuery(qs.toString()); - q.setString("pid", pid); - if(dsmin != null) q.setParameter("dsmin", dsmin); - if(dsmax != null) q.setParameter("dsmax", dsmax); - return q.list(); - } - - private Integer getMaxDsId(){ - Integer dId = getQueryD(); - if (dId == null) { - if(getQueryParam("ds") != null){ - Matcher m = Pattern.compile("\\A" + "(\\d+)" + "-" + "(\\d+)" + "\\Z").matcher(getQueryParam("ds")); - if (m.matches()){ - dId = Integer.parseInt(m.group(2)); - } - } - } - return dId; - } - private Integer getMinDsId(){ - Integer dId = getQueryD(); - if (dId == null) { - if(getQueryParam("ds") != null){ - Matcher m = Pattern.compile("\\A" + "(\\d+)" + "-" + "(\\d+)" + "\\Z").matcher(getQueryParam("ds")); - if (m.matches()){ - dId = Integer.parseInt(m.group(1)); - } - } - } - return dId; - } + public List <Dataset> getDatasetsnew(){ + Integer dId = getQueryD(); + if (dId == null) { + String pid = null; + StringBuffer qs = new StringBuffer("select distinct d from Paper p join p._datasets d where"); + if (getQueryParam("p") != null) { + pid = getQueryParam("p"); + qs.append(" p._hepdataId = :pid"); + } else if (getQueryParam("irn") != null) { + pid = getQueryParam("irn"); + qs.append(" p._spiresId = :pid"); + } else if (getQueryParam("red") != null) { + pid = getQueryParam("red"); + qs.append(" p._redId = :pid"); + } + Integer dsmin = getCounter(); + Integer dsmax = getCounter() + getLength() - 1; + if(dsmin == null && dsmax == null){ + + } else if (dsmax == null){ + qs.append(" and d._localId = :dsmin order by d._localId"); + } else { + qs.append(" and d._localId >= :dsmin and d._localId <= :dsmax order by d._localId"); + } + Query q = getSession().createQuery(qs.toString()); + q.setString("pid", pid); + if(dsmin != null) q.setParameter("dsmin", dsmin); + if(dsmax != null) q.setParameter("dsmax", dsmax); + return q.list(); + } else{ + // single dataset here + List <Dataset> rtn = new ArrayList(); + Dataset d = getPaper().getDataset(dId); + if (d != null) rtn.add(d); + setCounter(dId); + return rtn; + } + } + + private Integer getMaxDsId(){ + Integer dId = getQueryD(); + if (dId == null) { + if(getQueryParam("ds") != null){ + Matcher m = Pattern.compile("\\A" + "(\\d+)" + "-" + "(\\d+)" + "\\Z").matcher(getQueryParam("ds")); + if (m.matches()){ + dId = Integer.parseInt(m.group(2)); + } + } + } + return dId; + } + private Integer getMinDsId(){ + Integer dId = getQueryD(); + if (dId == null) { + if(getQueryParam("ds") != null){ + Matcher m = Pattern.compile("\\A" + "(\\d+)" + "-" + "(\\d+)" + "\\Z").matcher(getQueryParam("ds")); + if (m.matches()){ + dId = Integer.parseInt(m.group(1)); + } + } + } + return dId; + } // Get datasets requested via URL context public Set<Dataset> getDatasets() { Modified: trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/EasySearch1.tml ============================================================================== --- trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/EasySearch1.tml Tue Dec 1 15:48:55 2009 (r1328) +++ trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/EasySearch1.tml Thu Dec 10 14:29:38 2009 (r1329) @@ -1,24 +1,14 @@ -<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> - <head> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html t:type="layout" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> <title>HepData Reaction Database EasySearch stage 1</title> - </head> <body bgcolor="#FFFFDD"> - <div ID="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div> -<!-- <script LANGUAGE="JavaScript" SRC="${asset:context:/overlib.js}"></script> --> - <h2> -<!-- <img alt=" " src="${asset:context:/logounidurham-new.gif}"/> --> - HepData Reaction Database </h2> - <!-- <p><img alt=" " src="${asset:context:/rain_line.gif}"/></p> --> + <h2>Reaction Database Easy Search Method<br/> + Stage 1</h2> <form method="GET" action="EasySearch2"> <table> <tr> - <td align='center' colspan='2'> - <b> <font size='+1'> Easy Search Method - stage 1</font></b> - </td> - </tr> - <tr> <td colspan='2'> In this and the following pages you will be asked to choose an<br/> an inital state, than a final state and/or an observable for the<br/> @@ -63,6 +53,6 @@ </tr> </table> </form> -<!-- <t:Credits /> --> +<p/> </body> </html> Modified: trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/EasySearch2.tml ============================================================================== --- trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/EasySearch2.tml Tue Dec 1 15:48:55 2009 (r1328) +++ trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/EasySearch2.tml Thu Dec 10 14:29:38 2009 (r1329) @@ -1,25 +1,15 @@ -<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> - <head> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html t:type="layout" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> <title>HepData Reaction Database EasySearch stage 2</title> - </head> <body bgcolor="#FFFFDD"> - <div ID="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div> -<!-- <script LANGUAGE="JavaScript" SRC="${asset:context:/overlib.js}"></script> --> - <h2> -<!-- <img alt=" " src="${asset:context:/logounidurham-new.gif}"/> --> - HepData Reaction Database </h2> -<!-- <p><img alt=" " src="${asset:context:/rain_line.gif}"/></p> --> + <h2>Reaction Database Easy Search Method<br/> + Stage 2</h2> <form method="GET" action="EasySearch3"> <input type='hidden' name='initial' value='${getInitialState()}' /> <table> <tr> - <td align='center' colspan='1'> - <b> <font size='+1'>Easy Search Method - stage 2</font></b> - </td> - </tr> - <tr> <td colspan='1'> The following <b>final states</b> exist for the <b>initial state ${getInitialState()}</b><br/> </td> @@ -43,7 +33,6 @@ </table> </form> Back to <a href="EasySearch1">EasySeach Stage 1</a> - -<!-- <t:Credits /> --> + <p/> </body> </html> Modified: trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/EasySearch3.tml ============================================================================== --- trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/EasySearch3.tml Tue Dec 1 15:48:55 2009 (r1328) +++ trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/EasySearch3.tml Thu Dec 10 14:29:38 2009 (r1329) @@ -1,14 +1,11 @@ -<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> - <head> - <title>HepData Reaction Database EasySearch stage 3</title> - </head> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html t:type="layout" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> + <title>HepData Reaction Database EasySearch stage 2</title> <body bgcolor="#FFFFDD"> - <div ID="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div> -<!-- <script LANGUAGE="JavaScript" SRC="${asset:context:/overlib.js}"></script> --> - <h2> -<!-- <img alt=" " src="${asset:context:/logounidurham-new.gif}"/> --> - HepData Reaction Database </h2> -<!-- <p><img alt=" " src="${asset:context:/rain_line.gif}"/></p> --> + + <h2>Reaction Database Easy Search Method<br/> + Stage 3</h2> + <!-- <t:grid t:source="dsObservables" rowsPerPage="10" />--> @@ -16,8 +13,11 @@ <h3> The following observables are available for the reaction ${getDsReaction()} </h3> <t:writeDsObservables /> - +<p/> Back to <a href="EasySearch1">EasySeach Stage 1</a> -<!-- <t:Credits /> --> +<p/> + </body> </html> + +
More information about the HepData-svn mailing list |