[HepData-svn] r1328 - in trunk/hepdata-webapp: . src/main/java/cedar/hepdata/webapp/pages src/main/resources/cedar/hepdata/webapp/pages

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Dec 1 15:48:55 GMT 2009


Author: whalley
Date: Tue Dec  1 15:48:55 2009
New Revision: 1328

Log:
adding All option to search list

Modified:
   trunk/hepdata-webapp/pom.xml
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/Search.java
   trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/Search.tml

Modified: trunk/hepdata-webapp/pom.xml
==============================================================================
--- trunk/hepdata-webapp/pom.xml	Mon Nov 30 09:26:18 2009	(r1327)
+++ trunk/hepdata-webapp/pom.xml	Tue Dec  1 15:48:55 2009	(r1328)
@@ -40,7 +40,7 @@
         <!-- Jetty7: unstable -->
         <!-- <artifactId>jetty-maven-plugin</artifactId> -->
         <configuration>
-          <contextPath>/</contextPath>
+          <contextPath>/h3test</contextPath>
           <!-- <scanIntervalSeconds>10</scanIntervalSeconds> -->
           <requestLog implementation="org.mortbay.jetty.NCSARequestLog">
             <append>true</append>

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	Mon Nov 30 09:26:18 2009	(r1327)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/Search.java	Tue Dec  1 15:48:55 2009	(r1328)
@@ -214,7 +214,9 @@
         String queryString = getSearchString();
         Query q = ConstructQueryPaper.mkQueryFromSearchString(queryString, "", _session);
         int first = _counter;
-        q.setFirstResult(first).setMaxResults(getLength());
+        if(_listall.equals("no")){
+            q.setFirstResult(first).setMaxResults(getLength());
+        }
         List <Paper> list = q.list();
         int size = list.size();
         for (int i=0; i<size; i++){
@@ -320,15 +322,24 @@
         ctx.add("last");
         return ctx;
     }
+    public List<String> getAllContext() {
+        List<String> ctx = new Vector<String>();
+        ctx.add(getSearchString().replace(" ", "_"));
+        ctx.add("all");
+        return ctx;
+    }
    
+    private String _listall = "no";
     public void parseContext(EventContext context){
         String firstnextlast = "no";
+        _listall = "no";
         for (int i = 0; i < context.getCount(); i++) {
             String ps = context.get(String.class, i);
             if(ps.equals("next")) { firstnextlast = "yes"; }
             if(ps.equals("prev")) { _counter -= 40; firstnextlast = "yes"; }
             if(ps.equals("first")) { _counter = 0; firstnextlast = "yes"; }
             if(ps.equals("last")) { _counter = getNumPapers().intValue()-20; firstnextlast = "yes"; }
+            if(ps.equals("all")) { _listall = "yes"; }
          }
          if(firstnextlast.equals("no")) { _counter = 0; }
     }

Modified: trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/Search.tml
==============================================================================
--- trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/Search.tml	Mon Nov 30 09:26:18 2009	(r1327)
+++ trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/Search.tml	Tue Dec  1 15:48:55 2009	(r1328)
@@ -15,7 +15,8 @@
       <a href="#" t:type="pagelink" t:page="search" t:context="firstcontext">First</a>&nbsp;|&nbsp; 
       <a href="#" t:type="pagelink" t:page="search" t:context="prevcontext">Previous</a>&nbsp;|&nbsp;
       <a href="#" t:type="pagelink" t:page="search" t:context="nextcontext">Next</a>&nbsp;|&nbsp;
-      <a href="#" t:type="pagelink" t:page="search" t:context="lastcontext">Last</a>&nbsp;
+      <a href="#" t:type="pagelink" t:page="search" t:context="lastcontext">Last</a>&nbsp;|&nbsp;
+      <a href="#" t:type="pagelink" t:page="search" t:context="allcontext">All</a>&nbsp;
     </t:if>
 
 
@@ -90,7 +91,8 @@
       <a href="#" t:type="pagelink" t:page="search" t:context="firstcontext">First</a>&nbsp;|&nbsp; 
       <a href="#" t:type="pagelink" t:page="search" t:context="prevcontext">Previous</a>&nbsp;|&nbsp;
       <a href="#" t:type="pagelink" t:page="search" t:context="nextcontext">Next</a>&nbsp;|&nbsp;
-      <a href="#" t:type="pagelink" t:page="search" t:context="lastcontext">Last</a>
+      <a href="#" t:type="pagelink" t:page="search" t:context="lastcontext">Last</a>&nbsp;|&nbsp;
+      <a href="#" t:type="pagelink" t:page="search" t:context="allcontext">All</a>&nbsp;
     </t:if>
 
 </html>


More information about the HepData-svn mailing list