[HepData-svn] r1616 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Fri Apr 19 16:07:06 BST 2013


Author: whalley
Date: Fri Apr 19 16:07:06 2013
New Revision: 1616

Log:
allowing specific extra files for tables

Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java

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	Mon Apr 15 10:31:50 2013	(r1615)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java	Fri Apr 19 16:07:06 2013	(r1616)
@@ -16,7 +16,8 @@
 
 import java.text.*;
 import java.util.*;
-
+import java.io.*;
+import java.io.File;
 
 
 public class DatasetAsHtml {
@@ -631,6 +632,26 @@
 //        writer.attributes("name", "string");
 //        writer.attributes("value", getSearchString());
 //        writer.end();
+//
+// This next sections adds any extra information to the specific table.
+// Not ideal because the relative table Id could change but I see no better was.
+// Requires two files:   description.n and link.n in the specific resource direcotry
+       String descname="/mt/home/whalley/resource/"+_dataset.getPaper().getSpiresId()+"/description."+_dataset.getId();
+       String linkname="/mt/home/whalley/resource/"+_dataset.getPaper().getSpiresId()+"/link."+_dataset.getId();
+       File descfile = new File(descname);
+       if(descfile.exists()) {
+           try{
+               BufferedReader indesc=new BufferedReader(new FileReader(descname));
+               BufferedReader inlink=new BufferedReader(new FileReader(linkname));
+               String desc = indesc.readLine();
+               String link = inlink.readLine();
+               writer.write(desc);
+               writer.element("a");
+               writer.attributes("href","/resource/"+_dataset.getPaper().getSpiresId()+"/"+link);
+               writer.write("here");
+               writer.end();
+           } catch (IOException e){}
+       }
     }
 
 


More information about the HepData-svn mailing list