[HepData-svn] r1336 - in trunk: hepdata-common/src/main/java/cedar/hepdata/util hepdata-model/src/main/java/cedar/hepdata/model hepdata-webapp/src/main/java/cedar/hepdata/formats hepdata-webapp/src/main/java/cedar/hepdata/webapp/components hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages hepdata-xml/src/main/resources

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Jan 12 09:03:53 GMT 2010


Author: whalley
Date: Tue Jan 12 09:03:52 2010
New Revision: 1336

Log:
several small changes and prep. for updating/testing direct to new db

Added:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/ViewTest.java
   trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/ViewTest.tml
Modified:
   trunk/hepdata-common/src/main/java/cedar/hepdata/util/SiPrefix.java
   trunk/hepdata-model/src/main/java/cedar/hepdata/model/Dataset.java
   trunk/hepdata-model/src/main/java/cedar/hepdata/model/Paper.java
   trunk/hepdata-model/src/main/java/cedar/hepdata/model/Property.java
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/BdmsFormatter.java
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/SummaryFromYAxis.java
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/ChangesMade.java
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/Edit.java
   trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/Edit.tml
   trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/View.tml
   trunk/hepdata-xml/src/main/resources/mapping.xml

Modified: trunk/hepdata-common/src/main/java/cedar/hepdata/util/SiPrefix.java
==============================================================================
--- trunk/hepdata-common/src/main/java/cedar/hepdata/util/SiPrefix.java	Wed Jan  6 15:12:02 2010	(r1335)
+++ trunk/hepdata-common/src/main/java/cedar/hepdata/util/SiPrefix.java	Tue Jan 12 09:03:52 2010	(r1336)
@@ -20,6 +20,7 @@
     NANO  (-9,  "n", "n"),
     PICO  (-12, "p", "p"),
     FEMTO (-15, "f", "f"),
+    FEMMO (-15, "F", "F"),
     ATTO  (-18, "a", "a"),
     ZEPTO (-21, "z", "z"),
     YOCTA (-24, "y", "y");

Modified: trunk/hepdata-model/src/main/java/cedar/hepdata/model/Dataset.java
==============================================================================
--- trunk/hepdata-model/src/main/java/cedar/hepdata/model/Dataset.java	Wed Jan  6 15:12:02 2010	(r1335)
+++ trunk/hepdata-model/src/main/java/cedar/hepdata/model/Dataset.java	Tue Jan 12 09:03:52 2010	(r1336)
@@ -98,8 +98,84 @@
     }
 
 
+    // Convenience methods
     ////////////////////////////////////////////////////////
 
+    public String getCommentString(int n){
+        StringBuffer s = new StringBuffer();
+        String crstring = null;
+	    int nc = 0;
+	    for(String cr : getComments()){
+            if(!cr.startsWith("Location")){
+	            nc += 1;
+	            if(nc == n){
+	                if( cr!=null){
+	                    if(n==1) { s.append("CR = " + cr + ";"); }
+		                else     { s.append("CR.= " + cr + ";"); } 
+		                int num = s.length()/80;
+		                for (int i=0; i<num; i++){s.insert(80*(i+1)+i,'\n');}   
+	                    crstring = s.toString();
+		                break;
+		            }
+	            }
+	        }
+	    }
+	    return crstring;
+    }
+
+    public String getTfpString(){
+        StringBuffer s = new StringBuffer();
+        String tfpstring = null;
+	    for(String cr : getComments()){
+	        if(cr.startsWith("Location")){
+	           s.append("TFP = " + cr + ";"); 
+	           tfpstring = s.toString();
+		       break;
+	        }
+	    }
+	    return tfpstring;
+    }
+
+
+    public String getDsReactionString(int n){
+        StringBuffer s = new StringBuffer();
+        String dsrstring = null;
+	    int nc = 0;
+	    for(String dsr : getDsReactions()){
+	        nc += 1;
+	        if(nc == n){
+	            if( dsr!=null){
+	                if(n==1) { s.append("RE = " + dsr + ";"); }
+		            else     { s.append("RE.= " + dsr + ";"); } 
+	                dsrstring = s.toString();
+		            break;
+	        }
+	        }
+	    }
+	    return dsrstring;
+    }
+
+    public String getDsObservableString(int n){
+        StringBuffer s = new StringBuffer();
+        String dsostring = null;
+	    int nc = 0;
+	    for(String dso : getDsObservables()){
+	        nc += 1;
+	        if(nc == n){
+	            if( dso!=null){
+	                if(n==1) { s.append("OBS = " + dso + ";"); }
+		            else     { s.append("OBS.= " + dso + ";"); } 
+	                dsostring = s.toString();
+		            break;
+	        }
+	        }
+	    }
+	    return dsostring;
+    }
+
+    ////////////////////////////////////////////////////////
+
+
 
 
     /** Get local dataset ID. */

Modified: trunk/hepdata-model/src/main/java/cedar/hepdata/model/Paper.java
==============================================================================
--- trunk/hepdata-model/src/main/java/cedar/hepdata/model/Paper.java	Wed Jan  6 15:12:02 2010	(r1335)
+++ trunk/hepdata-model/src/main/java/cedar/hepdata/model/Paper.java	Tue Jan 12 09:03:52 2010	(r1336)
@@ -188,103 +188,93 @@
     public String getReferenceString(int n){
         StringBuffer s = new StringBuffer();
         String refstring = null;
-	int nc = 0;
-	for(Reference ref : getReferences()){
-	    nc += 1;
-	    if(nc == n){
-	        if(n==1) { s.append("R = " + ref.getDescription() + ";"); }
-		else     { s.append("R.= " + ref.getDescription() + ";"); }    
-		s.append("    TY = " + ref.getType() + ";");
-		s.append("    D = " + ref.getDate() + ";");	    
-	        refstring = s.toString();
-		break;
+	    int nc = 0;
+	    for(Reference ref : getReferences()){
+	        nc += 1;
+	        if(nc == n){
+	            if(n==1) { s.append("R = " + ref.getDescription() + ";"); }
+		        else     { s.append("R.= " + ref.getDescription() + ";"); }    
+		        s.append("    TY = " + ref.getType() + ";");
+		        s.append("    D = " + ref.getDate() + ";");	    
+	            refstring = s.toString();
+		        break;
+	        }
 	    }
-	}
-	return refstring;
+	    return refstring;
     }
 
     public String getModificationString(int n){
         StringBuffer s = new StringBuffer();
         String modstring = null;
-	int nc = 0;
-	for(Modification mod : getModifications()){
-	    nc += 1;
-	    if(nc == n){
-	        if( mod.getModifier()!=null){
-	            if(n==1) { s.append("DES = Modified" + " by " + mod.getModifier() + ";"); }
-		    else     { s.append("DES.= Modified" + " by " + mod.getModifier() + ";"); }    
-	            modstring = s.toString();
-		    break;
-		}
+	    int nc = 0;
+	    for(Modification mod : getModifications()){
+	        nc += 1;
+	        if(nc == n){
+	            if( mod.getModifier()!=null){
+	                if(n==1) { s.append("DES = Modified" + " by " + mod.getModifier() + " on " + mod.getComment() + ";"); }
+		            else     { s.append("DES.= Modified" + " by " + mod.getModifier() +  " on " + mod.getComment() + ";"); }    
+	                modstring = s.toString();
+		            break;
+		        }
+	        }
 	    }
-	}
-	return modstring;
+	    return modstring;
     }
 
     public String getExperimentString(int n){
-//        StringBuffer s = new StringBuffer();
+        StringBuffer s = new StringBuffer();
         String expstring = null;
-	int nc = 0;
-	for(Experiment exp : getExperiments()){
-	    nc += 1;
-	    if(nc == n){
-	        if( exp.getName()!=null){
-	            if(n==1) { expstring = "EXP = " + exp.getName() + ";"; }
-		    else     { expstring = "EXP.= " + exp.getName() + ";"; }    
-//	            expstring = s.toString();
-		    break;
-		}
+    	int nc = 0;
+    	for(Experiment exp : getExperiments()){
+	        nc += 1;
+	        if(nc == n){
+	            if( exp.getName()!=null){
+	                if(n==1) { s.append("EXP = " + exp.getName() + ";"); }
+		            else     { s.append("EXP.= " + exp.getName() + ";"); }    
+	                expstring = s.toString();
+		            break;
+		        }
+	        }
 	    }
-	}
-	return expstring;
+	    return expstring;
     }
+
     public String getDetectorString(int n){
         StringBuffer s = new StringBuffer();
         String destring = null;
-	int nc = 0;
-	for(Experiment exp : getExperiments()){
-	    nc += 1;
-	    if(nc == n){
-	        if( exp.getInformalName()!=null){
-	            if(n==1) { s.append("DE = " + exp.getInformalName() + ";"); }
-		    else     { s.append("DE.= " + exp.getInformalName() + ";"); }    
-	            destring = s.toString();
-		    break;
-		}
+	    int nc = 0;
+	    for(Experiment exp : getExperiments()){
+	        nc += 1;
+	        if(nc == n){
+	            if( exp.getInformalName()!=null){
+	                if(n==1) { s.append("DE = " + exp.getInformalName() + ";"); }
+		            else     { s.append("DE.= " + exp.getInformalName() + ";"); }    
+	                destring = s.toString();
+		            break;
+		        }
+	        }
 	    }
-	}
-	return destring;
+	    return destring;
     }
 
     public String getCommentString(int n){
         StringBuffer s = new StringBuffer();
         String crstring = null;
-	int nc = 0;
-	for(String cr : getComments()){
-	    nc += 1;
-	    if(nc == n){
-	        if( cr!=null){
-	            if(n==1) { s.append("CR = " + cr + ";"); }
-		    else     { s.append("CR.= " + cr + ";"); } 
-//		    int num = s.length()/80;
-//		    for (int i=0; i<num; i++){
-//		        System.out.println("s.length() " + s.length());
-//		        s.insert(80*(i+1)+1+i,'\n');
-//		    }   
-                    if(s.length()>80) { s.insert(80,"\n"); }
-                    if(s.length()>161){ s.insert(161,"\n"); }
-                    if(s.length()>242){ s.insert(242,"\n"); }
-                    if(s.length()>323){ s.insert(323,"\n"); }
-                    if(s.length()>404){ s.insert(404,"\n"); }
-                    if(s.length()>485){ s.insert(485,"\n"); }
-                    if(s.length()>566){ s.insert(566,"\n"); }
-	            crstring = s.toString();
-		   
-		    break;
-		}
+	    int nc = 0;
+	    for(String cr : getComments()){
+	        nc += 1;
+	        if(nc == n){
+	            if( cr!=null){
+	                if(n==1) { s.append("CR = " + cr + ";"); }
+		            else     { s.append("CR.= " + cr + ";"); } 
+		            int num = s.length()/80;
+		            for (int i=0; i<num; i++){s.insert(80*(i+1)+i,'\n');}   
+	                crstring = s.toString();
+		            break;
+		        }
+	        }
 	    }
-	}
-	return crstring;
+	    return crstring;
     }
 
     ////////////////////////////////////////////////////////

Modified: trunk/hepdata-model/src/main/java/cedar/hepdata/model/Property.java
==============================================================================
--- trunk/hepdata-model/src/main/java/cedar/hepdata/model/Property.java	Wed Jan  6 15:12:02 2010	(r1335)
+++ trunk/hepdata-model/src/main/java/cedar/hepdata/model/Property.java	Tue Jan 12 09:03:52 2010	(r1336)
@@ -30,6 +30,10 @@
     @Column(name="HighValue", nullable=false)
     private Double _highValue;
 
+    /** Focus of property value */
+    @Column(name="Focus", nullable=true)
+    private Double _focus;
+
     /** Units of property */
     @Column(name="Unit", nullable=false)
     @org.hibernate.annotations.Type(type="cedar.hepdata.db.UnitUserType")
@@ -52,6 +56,11 @@
         setName(name);
         setValues(unit, lowValue, highValue);
     }
+    /** and with the focus
+    public Property(String name, Unit unit, Double focus, Double lowValue, Double highValue) {
+        setName(name);
+        setValues(unit, focus, lowValue, highValue);
+    }
 
 
     ////////////////////////////////////////////////////////////////////
@@ -64,6 +73,14 @@
         setHighValue(highValue);
         return this;
     }
+    /** and with the focus
+    public Property setValues(Unit unit, Double focus, Double lowValue, Double highValue) {
+        setUnit(unit);
+        setFocus(focus);
+        setLowValue(lowValue);
+        setHighValue(highValue);
+        return this;
+    }
 
 
     ////////////////////////////////////////////////////////////////////
@@ -81,6 +98,18 @@
     }
 
 
+    /** Get the focus of the property's value. */
+    public Double getFocus() {
+        return _focus;
+    }
+
+    /** Set the focus of the property's value. */
+    public Property setFocus(Double focus) {
+        _focus = focus;
+        return this;
+    }
+
+
     /** Get the low bound on the property's value. */
     public Double getLowValue() {
         return _lowValue;
@@ -92,7 +121,6 @@
         return this;
     }
 
-
     /** Get the high bound on the property's value. */
     public Double getHighValue() {
         return _highValue;

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/BdmsFormatter.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/BdmsFormatter.java	Wed Jan  6 15:12:02 2010	(r1335)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/BdmsFormatter.java	Tue Jan 12 09:03:52 2010	(r1336)
@@ -19,36 +19,48 @@
 	s.append("SC = " + p.getShortName() + ";" + "     RED = " + p.getRedId() + ";\n");
 
         for (int n=1; n<4; n++){
-	    if(p.getReferenceString(n) != null){ s.append(p.getReferenceString(n) + "\n"); }
-	    else{ break; }	
+	        if(p.getReferenceString(n) != null){ s.append(p.getReferenceString(n) + "\n"); }
+	        else{ break; }	
         }
 
         for (int n=1; n<4; n++){
-	    if(p.getModificationString(n) != null){ s.append(p.getModificationString(n) + "\n"); }
-	    else{ break; }	
+	        if(p.getModificationString(n) != null){ s.append(p.getModificationString(n) + "\n"); }
+	        else{ break; }	
         }
 
         for (int n=1; n<4; n++){
-	    if(p.getCommentString(n) != null){ s.append(p.getCommentString(n) + "\n"); }
-	    else{ break; }	
+	        if(p.getCommentString(n) != null){ s.append(p.getCommentString(n) + "\n"); }
+	        else{ break; }	
         }
 
         for (int n=1; n<4; n++){
-	    if(p.getExperimentString(n) != null){ s.append(p.getExperimentString(n) + "\n"); }
-	    else{ break; }	
+	        if(p.getExperimentString(n) != null){ s.append(p.getExperimentString(n) + "\n"); }
+	        else{ break; }	
         }
 
         for (int n=1; n<4; n++){
-	    if(p.getDetectorString(n) != null){ s.append(p.getDetectorString(n) + "\n"); }
-	    else{ break; }	
+	        if(p.getDetectorString(n) != null){ s.append(p.getDetectorString(n) + "\n"); }
+	        else{ break; }	
         }
 
         if(p.getSpiresId()!=null) s.append("IRN = " + p.getSpiresId() + ";\n");
 
         for (Dataset ds : p.getDatasets()){
-	    s.append("Dataset\n");
-	} 
-	
+            s.append("\n" + ds.getTfpString() + "\n");
+            for (int n=1; ; n++){
+	            if(ds.getCommentString(n) != null){ s.append(ds.getCommentString(n) + "\n"); }
+	            else{ break; }	
+            }
+            for (int n=1; ; n++){
+	            if(ds.getDsReactionString(n) != null){ s.append(ds.getDsReactionString(n) + "\n"); }
+	            else{ break; }	
+            }
+            for (int n=1; ; n++){
+	            if(ds.getDsObservableString(n) != null){ s.append(ds.getDsObservableString(n) + "\n"); }
+	            else{ break; }	
+            }
+    	} 
+
         return s.toString();
     }
 

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java	Wed Jan  6 15:12:02 2010	(r1335)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java	Tue Jan 12 09:03:52 2010	(r1336)
@@ -123,13 +123,18 @@
                         if (j == i) {
                             writer.element("th");
                             writer.write(property.getName() + " : ");
+                            if (property.getFocus() != null){
+                                writer.write(property.getFocus().toString());
+                            }
                             if (property.getLowValue() != null && property.getHighValue() != null &&
                                 property.getLowValue().equals(property.getHighValue())) {
                                 writer.write(property.getLowValue().toString());
                             } else {
+                                if(property.getFocus() != null) { writer.write(" ("); }
                                 writer.write(property.getLowValue().toString());
                                 writer.writeRaw("&ndash;");
                                 writer.write(property.getHighValue().toString());
+                                if(property.getFocus() != null) { writer.write(")"); }
                             }
                             if (!property.getUnit().isDimensionless()) {
                                 writer.writeRaw("&nbsp;");

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/SummaryFromYAxis.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/SummaryFromYAxis.java	Wed Jan  6 15:12:02 2010	(r1335)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/SummaryFromYAxis.java	Tue Jan 12 09:03:52 2010	(r1336)
@@ -117,7 +117,7 @@
     writer.write(getFirstExperimentName() + "/" + getFirstInformalName());
 
     for (String comment : getDataset().getComments()){
-            if(comment.substring(0,8).equals("Location")){
+            if(comment.startsWith("Location")){
                 writer.element("br"); writer.end();
             writer.write(comment);
             }

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/ChangesMade.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/ChangesMade.java	Wed Jan  6 15:12:02 2010	(r1335)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/ChangesMade.java	Tue Jan 12 09:03:52 2010	(r1336)
@@ -22,4 +22,22 @@
 
 public class ChangesMade {
 
+    @Inject
+    private org.hibernate.Session _session;
+
+    @Persist
+    private Paper _paper;
+    
+    public void setPaper(Paper p){
+       System.out.println("setting paper ");
+        _paper = p;
+       System.out.println("paper set ");
+    }
+
+    public void onActivate(){
+       System.out.println("in activate ");
+       System.out.println("in activate " + _paper.getSpiresId());
+       _session.update(_paper);
+    }
+
 }

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/Edit.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/Edit.java	Wed Jan  6 15:12:02 2010	(r1335)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/Edit.java	Tue Jan 12 09:03:52 2010	(r1336)
@@ -9,6 +9,7 @@
 import org.apache.tapestry5.EventContext;
 import org.apache.tapestry5.StreamResponse;
 import org.apache.tapestry5.util.TextStreamResponse;
+import org.apache.tapestry5.hibernate.annotations.CommitAfter;
 import org.apache.tapestry5.annotations.*;
 import org.apache.tapestry5.ioc.annotations.*;
 import org.apache.tapestry5.services.*;
@@ -26,8 +27,8 @@
     // private Request _req;
     // public Request getRequest() { return _req; }
 
-    @Inject
-    private org.hibernate.Session _session;
+//    @Inject
+//    private org.hibernate.Session _session;
 
 
     // Decode URL context into the params map
@@ -235,13 +236,14 @@
    @OnEvent(value="submit")
     Object onSubmit()
    {
-       System.out.println("doing the onSubmit");
-       System.out.println("setting spires irn to " + irn);
-       System.out.println("before " + paper_save.getSpiresId());
-       paper_save.setSpiresId(irn);
-       System.out.println("after  " + paper_save.getSpiresId());
-       _session.update(paper_save);
-       _session.flush();
+//       System.out.println("doing the onSubmit");
+//       System.out.println("setting spires irn to " + irn);
+//       System.out.println("before " + paper_save.getSpiresId());
+////       paper_save.setSpiresId(irn);
+//       System.out.println("after  " + paper_save.getSpiresId());
+////       changesmade.setPaper(paper_save);
+//       _session.update(paper_save);
+//       _session.flush();
        return changesmade;
    } 
 }

Added: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/ViewTest.java
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/ViewTest.java	Tue Jan 12 09:03:52 2010	(r1336)
@@ -0,0 +1,191 @@
+package cedar.hepdata.webapp.pages;
+
+import cedar.hepdata.model.*;
+import cedar.hepdata.util.*;
+import cedar.hepdata.xml.*;
+import cedar.hepdata.db.*;
+import cedar.hepdata.formats.*;
+
+import org.apache.tapestry5.EventContext;
+import org.apache.tapestry5.StreamResponse;
+import org.apache.tapestry5.util.TextStreamResponse;
+import org.apache.tapestry5.annotations.*;
+import org.apache.tapestry5.ioc.annotations.*;
+import org.apache.tapestry5.services.*;
+
+import org.hibernate.*;
+import org.hibernate.criterion.*;
+import java.util.*;
+import java.util.regex.*;
+import java.io.File;
+
+
+public class ViewTest extends ViewBase {
+
+    // @Inject
+    // private Request _req;
+    // public Request getRequest() { return _req; }
+
+    // @Inject
+    // private org.hibernate.Session _session;
+
+
+    // Decode URL context into the params map
+    public StreamResponse onActivate(EventContext context) {
+        // Do the basic parsing via the base class
+        parseBaseViewContext(context);
+
+        // Handle pattern parsing separately
+        Pattern patt = Pattern.compile("\\A" + "(short|long|full|plain|yoda|aida|pyroot|root|mpl|bdms)" + "\\Z",
+                                       Pattern.CASE_INSENSITIVE);
+        for (int i = 0; i < context.getCount(); i++) {
+            String ps = context.get(String.class, i);
+            Matcher m = patt.matcher(ps);
+            if (m.matches()) {
+                setQueryParam("format", m.group(1).toLowerCase());
+            } else {
+                setQueryParam("format", "full");
+            }
+        }
+
+        // Now handle the special formats (after parsing *all* context elements)
+        String fmt = getQueryParam("format");
+        if (fmt != null) {
+            if (fmt.equals("bdms")) return asBDMS();
+            if (fmt.equals("plain")) return asPlain();
+            if (fmt.equals("aida")) return asAIDA();
+            if (fmt.equals("pyroot")) return asPyROOT();
+            if (fmt.equals("yoda")) return asYODA();
+            if (fmt.equals("root")) return asROOT();
+            //if (fmt.equals("mpl")) return asPlain();
+            //if (fmt.equals("gnuplot")) return asPlain();
+        }
+
+        // Normal rendering
+        return null;
+    }
+
+
+    public Object formatContext(String fmt) {
+        Vector<String> ctx = new Vector<String>(getBaseContext());
+        ctx.add(fmt);
+        return ctx;
+    }
+    public Object getShortContext() {
+        return formatContext("short");
+    }
+    public Object getFullContext() {
+        return getBaseContext();
+    }
+
+
+    ///////////////////////////////////////////////
+
+    public Object getBdmsContext() {
+        return formatContext("bdms");
+    }
+    public StreamResponse asBDMS() {
+        Paper p = getPaper();
+        String asBDMS = BdmsFormatter.format(p);
+        if (asBDMS == null) {
+            asBDMS = "No valid paper specified";
+        }
+        return new TextStreamResponse("text/plain", asBDMS);
+    }
+
+
+    public Object getPlainContext() {
+        return formatContext("plain");
+    }
+    public StreamResponse asPlain() {
+        Set<Dataset> ds = getDatasets();
+        String asPlain = PlainFormatter.format(ds, getQueryX(), getQueryY());
+        if (asPlain == null) {
+            asPlain = "No valid paper and dataset specified";
+        }
+        return new TextStreamResponse("text/plain", asPlain);
+    }
+
+
+    public Object getYodaContext() {
+        return formatContext("yoda");
+    }
+    public StreamResponse asYODA() {
+        Set<Dataset> ds = getDatasets();
+        String asYODA = YodaFormatter.format(ds);
+        if (asYODA == null) {
+            asYODA = "No valid paper and dataset specified";
+        }
+        return new TextStreamResponse("text/plain", asYODA);
+    }
+
+
+    public Object getAidaContext() {
+        return formatContext("aida");
+    }
+    public StreamResponse asAIDA() {
+        Set<Dataset> ds = getDatasets();
+        String asAIDA = AidaFormatter.format(ds);
+        if (asAIDA == null) {
+            asAIDA = "No valid paper and dataset specified";
+        }
+        return new TextStreamResponse("text/xml", asAIDA);
+    }
+
+
+    public Object getRootContext() {
+        return formatContext("root");
+    }
+    public StreamResponse asROOT() {
+        return new TextStreamResponse("text/plain",
+                                      "This will be a ROOT macro once I get round to it...");
+    }
+
+
+    public Object getPyRootContext() {
+        return formatContext("pyroot");
+    }
+    public StreamResponse asPyROOT() {
+        Set<Dataset> ds = getDatasets();
+        String asPyRoot = PyRootFormatter.format(ds);
+        if (asPyRoot == null) {
+            asPyRoot = "No valid paper and dataset specified";
+        }
+        return new TextStreamResponse("text/plain", asPyRoot);
+    }
+
+
+    //////////////////////////////////////////
+
+
+    public String getFormat() {
+        String fmt = getQueryParam("format");
+        if (fmt == null) fmt = "full";
+        return fmt;
+    }
+
+    public boolean getShortFormat() {
+        return getFormat().equals("short");
+    }
+
+    public boolean getLongFormat() {
+        return getFormat().equals("full");
+    }
+
+    public boolean getShowList() {
+        return getShortFormat();
+    }
+
+
+    public boolean getShowSys() {
+        return getLongFormat();
+    }
+
+    public boolean getHaveSys() {
+	    String filename = "/home/whalley/systematics/files/" + getPaper().getSpiresId() + ".sys";
+        File testfile = new File(filename);
+        return testfile.exists();
+    }
+
+
+}

Modified: trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/Edit.tml
==============================================================================
--- trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/Edit.tml	Wed Jan  6 15:12:02 2010	(r1335)
+++ trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/Edit.tml	Tue Jan 12 09:03:52 2010	(r1336)
@@ -21,12 +21,10 @@
     <td>First Author</td><td><input type="textbox" value="${author}"  size="20"/></td>
     </tr>
     </t:loop>
-
-    
+<!--
     <tr>
     <td>References</td>
     </tr>
-<!--
     <t:loop source="references"  value="reference">
     <tr>
     <td>Description</td><td><input type="textbox" value="${refdesc}"  size="20"/></td>
@@ -35,7 +33,6 @@
     </tr>
     </t:loop>
 -->
-    
     </table>
     <input type="submit" t:type="submit" t:id="submitButton" value="submit"/>
     </t:form>

Modified: trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/View.tml
==============================================================================
--- trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/View.tml	Wed Jan  6 15:12:02 2010	(r1335)
+++ trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/View.tml	Tue Jan 12 09:03:52 2010	(r1336)
@@ -99,7 +99,7 @@
       <t:if test="isMultiPage">
         <p>
           Total number of tables: <b>${paper.datasets.size()}</b>.&nbsp; 
-          Displaying: <b>${counter}</b> to <b>${counterend}</b>.&nbsp; 
+<!--          Displaying: <b>${counter}</b> to <b>${counterend}</b>.&nbsp; -->
           <a href="#" t:type="pagelink" t:page="view" t:context="firstcontext">First</a>&nbsp;|&nbsp; 
           <a href="#" t:type="pagelink" t:page="view" t:context="prevcontext">Previous</a>&nbsp;|&nbsp;
           <a href="#" t:type="pagelink" t:page="view" t:context="nextcontext">Next</a>&nbsp;|&nbsp;

Added: trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/ViewTest.tml
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/ViewTest.tml	Tue Jan 12 09:03:52 2010	(r1336)
@@ -0,0 +1,120 @@
+<!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">
+
+<h2> Reaction Database TEST Record Display</h2>
+View
+<a href="#" t:type="pagelink" t:page="view" t:context="bdmsContext"><font size="-1">bdms display</font></a>
+
+  <t:if test="paper.hepdataId">
+    <title>HepData &ndash; ${paper.shortName}</title>
+
+    <div class="paperbox">
+      <h2 class="papertitle">
+        <a href="#" t:type="pagelink" t:page="view" t:context="paperContext">${paper.shortName}</a> 
+        &mdash; ${paper.title}
+      </h2>
+
+      <t:if test="queryD">
+        <h4>
+          Showing only dataset(s): ${queryD} 
+          (<a href="#" t:type="pagelink" t:page="view" t:context="paperContext">show all</a>)
+        </h4>
+      </t:if>
+
+
+      <p>
+        Experiment:
+        <a href="http://durpdg.dur.ac.uk/cgi-bin/spiface/experiments/www2?fin+expt+${paper.experimentName}">
+          <b>${paper.experimentName}</b></a>
+        <br/>
+        Detector:
+        <a href="http://durpdg.dur.ac.uk/cgi-bin/spiface/experiments/www2?fin+expt+${paper.informalName}">
+          <b>${paper.informalName}</b></a>
+        <br/>
+        Published in <b>${paper.firstPublished}</b>
+        <br/>
+        Preprinted as <b>${paper.firstPreprint}</b> 
+        <br/>
+        <t:if test="paper.spiresId">
+          Spires ID (IRN): <b>${paper.spiresId}</b>
+          <a href="http://durpdg.dur.ac.uk/cgi-bin/spiface/hep/www?irn+${paper.spiresId}">(View)</a> 
+        </t:if>
+        <br/>
+        <t:if test="paper.RedId">
+          Durham ID (RED): <b>${paper.RedId}</b>
+        </t:if>
+       </p>
+
+      <div class="papercomments">
+        <t:displayPaperComments p="paper" />
+      </div>
+      <p>
+          <a href="/saveplot?list=all"
+           title="Show the datasets which have been selected for combined plotting">View list of currently selected plots</a>
+        <!-- <t:if test="searchquery"> -->
+        <!--   | <a href="search?q=${searchquery}">Back to search...</a> -->
+        <!-- </t:if> -->
+     </p>
+
+      <t:if test="showSys">
+         <t:if test="haveSys">
+            <h4 class="datasettitle">
+            Additional Systematic Errors and Comments
+            </h4>
+            <div class="systematics">        
+                <t:displaySystematics p="paper" />
+            </div>
+        </t:if>
+      </t:if>
+
+      <t:if test="isMultiPage">
+        <p>
+          Total number of tables: <b>${paper.datasets.size()}</b>.&nbsp; 
+          Displaying: <b>${counter}</b> to <b>${counterend}</b>.&nbsp; 
+          <a href="#" t:type="pagelink" t:page="view" t:context="firstcontext">First</a>&nbsp;|&nbsp; 
+          <a href="#" t:type="pagelink" t:page="view" t:context="prevcontext">Previous</a>&nbsp;|&nbsp;
+          <a href="#" t:type="pagelink" t:page="view" t:context="nextcontext">Next</a>&nbsp;|&nbsp;
+          <a href="#" t:type="pagelink" t:page="view" t:context="lastcontext">Last</a>
+        </p>
+      </t:if>
+      
+      <t:loop source="datasetsnew" value="dataset">
+        <div class="datasetbox">
+          <h3 class="datasettitle">
+            <a href="#" t:type="pagelink" t:page="view" t:context="baseContext">Table ${dataset.id}</a>
+          </h3>
+          <br/>
+          ${dataset.getDsReactions()} 
+          <br/>
+          ${dataset.getDsObservables()} 
+          <t:datasetAsHtml dataset="dataset" format="${format}" />
+        </div>
+      </t:loop>
+      <t:if test="isMultiPage">
+        <p>
+          Total number of tables: <b>${paper.datasets.size()}</b>.&nbsp; 
+<!--          Displaying: <b>${counter}</b> to <b>${counterend}</b>.&nbsp; -->
+          <a href="#" t:type="pagelink" t:page="view" t:context="firstcontext">First</a>&nbsp;|&nbsp; 
+          <a href="#" t:type="pagelink" t:page="view" t:context="prevcontext">Previous</a>&nbsp;|&nbsp;
+          <a href="#" t:type="pagelink" t:page="view" t:context="nextcontext">Next</a>&nbsp;|&nbsp;
+          <a href="#" t:type="pagelink" t:page="view" t:context="lastcontext">Last</a>
+        </p>
+      </t:if>
+      
+    </div>
+    
+    <t:parameter name="else">
+      
+      <title>HepData paper view</title>
+      <h2>No valid paper could be found with the given ID/IRN</h2>
+      
+    </t:parameter>
+  </t:if>
+  <p class="permalinks">
+    Permalinks: 
+    <a href="#" t:type="pagelink" t:page="view" t:context="hdpaperContext">by HepData ID</a> |
+    <a href="#" t:type="pagelink" t:page="view" t:context="spiresContext">by Spires ID</a>
+    <br/>
+   (Reaction db ID=${paper.id}, RED=${paper.redid})
+  </p>
+</html>

Modified: trunk/hepdata-xml/src/main/resources/mapping.xml
==============================================================================
--- trunk/hepdata-xml/src/main/resources/mapping.xml	Wed Jan  6 15:12:02 2010	(r1335)
+++ trunk/hepdata-xml/src/main/resources/mapping.xml	Tue Jan 12 09:03:52 2010	(r1336)
@@ -89,14 +89,17 @@
 
 
   <class name="cedar.hepdata.model.Modification">
+<!-- take out the timestamp and put when in as a comment
     <field name="Timestamp" type="java.lang.String" handler="cedar.hepdata.xml.TimestampHandler">
       <bind-xml name="when" node="attribute"/>
     </field>
+-->
     <field name="Modifier">
       <bind-xml name="who" node="attribute"/>
     </field>
     <field name="Comment">
-      <bind-xml name="comment" node="element"/>
+<!--      <bind-xml name="comment" node="element"/> -->
+      <bind-xml name="when" node="attribute"/>
     </field>
   </class>
 
@@ -307,6 +310,9 @@
     <field name="HighValue">
       <bind-xml name="high" node="attribute"/> 
     </field>
+    <field name="Focus">
+      <bind-xml name="focus" node="attribute"/> 
+    </field>
   </class> 
 
 </mapping>


More information about the HepData-svn mailing list