|
[HepData-svn] r1331 - in trunk/hepdata-webapp/src/main: java/cedar/hepdata/webapp/pages resources/cedar/hepdata/webapp/pagesblackhole at projects.hepforge.org blackhole at projects.hepforge.orgThu Dec 17 10:13:55 GMT 2009
Author: whalley Date: Thu Dec 17 10:13:55 2009 New Revision: 1331 Log: more changes to editing Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/Edit.java trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/Edit.tml 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 Dec 16 09:06:42 2009 (r1330) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/Edit.java Thu Dec 17 10:13:55 2009 (r1331) @@ -26,11 +26,17 @@ // 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 + @InjectPage + private ChangesMade changesmade; + + @Persist + private Paper paper_save; + public StreamResponse onActivate(EventContext context) { // Do the basic parsing via the base class parseBaseViewContext(context); @@ -173,6 +179,69 @@ File testfile = new File(filename); return testfile.exists(); } - - + + private Reference reference; + public Reference getReference(){ + return reference; + } + public String getRefDesc(){ + return reference.getDescription(); + } + public String getRefDate(){ + return reference.getDate(); + } + public String getRefType(){ + return reference.getType(); + } + public void setReference(Reference r){ + reference = r; + } + public List <Reference> getReferences(){ + List <Reference> refs = new ArrayList(); + System.out.println("number of references found is " + getPaper().getReferences().size()); + for (Reference ref : paper_save.getReferences()){ + refs.add(ref); + } + return refs; + } + + private String author; + public String getAuthor(){ + return author; + } + public void setAuthor(String a){ + author = a; + } + public SortedSet <String> getAuthors(){ + return getPaper().getAuthors(); + } + + private Long irn; + public Long getIrn(){ + paper_save=getPaper(); + return getPaper().getSpiresId(); + } + public void setIrn(Long i){ + irn = i; + } + private Long red; + public Long getRed(){ + return getPaper().getRedId(); + } + public void setRed(Long r){ + red = r; + } + + @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(); + return changesmade; + } } 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 Dec 16 09:06:42 2009 (r1330) +++ trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/Edit.tml Thu Dec 17 10:13:55 2009 (r1331) @@ -1,9 +1,45 @@ <!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"> +<!-- <t:if test="paper.hepdataId"> +--> <h2> Reaction Database Edit Record</h2> Edit + <br/> + <t:form> + <table> + <tr> + <td>SpiresId</td><td><input t:type="textfield" t:value="irn"/></td> + <td>RedId</td><td><input t:type="textfield" t:value="red" size="5"/></td> + </tr> + <tr> + <td>Authors</td> + </tr> + <t:loop source="authors" value="author"> + <tr> + <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> + <td><input type="textbox" value="${refdate}" size="10"/></td> + <td><input type="textbox" value="${reftype}" size="5"/></td> + </tr> + </t:loop> +--> + + </table> + <input type="submit" t:type="submit" t:id="submitButton" value="submit"/> + </t:form> + <title>HepData – ${paper.shortName}</title> <div class="paperbox"> @@ -95,7 +131,7 @@ </t:if> </div> - +<!-- <t:parameter name="else"> <title>HepData paper view</title> @@ -103,6 +139,7 @@ </t:parameter> </t:if> +--> <p class="permalinks"> Permalinks: <a href="#" t:type="pagelink" t:page="view" t:context="hdpaperContext">by HepData ID</a> |
More information about the HepData-svn mailing list |