From: <rv...@us...> - 2009-06-27 07:04:56
|
Revision: 133 http://treebase.svn.sourceforge.net/treebase/?rev=133&view=rev Author: rvos Date: 2009-06-27 07:04:54 +0000 (Sat, 27 Jun 2009) Log Message: ----------- This commit fixes issue 2810620 Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/EditTaxonLabelController.java trunk/treebase-web/src/main/webapp/WEB-INF/pages/editTaxonLabel.jsp Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/EditTaxonLabelController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/EditTaxonLabelController.java 2009-06-26 15:41:18 UTC (rev 132) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/EditTaxonLabelController.java 2009-06-27 07:04:54 UTC (rev 133) @@ -225,12 +225,23 @@ } else { // 2b - Integer ncbiId = getTaxonLabelService().findNcbiTaxIdByUBIOTaxId(manualId); - String ncbiPreferredName = getTaxonLabelService().getNCBIPreferredName(ncbiId.toString()); - Taxon newTaxon = new Taxon(ncbiPreferredName,manualId,ncbiId); + TaxonLabelService taxonLabelService = getTaxonLabelService(); + Integer ncbiId = taxonLabelService.findNcbiTaxIdByUBIOTaxId(manualId); + Taxon newTaxon = null; + TaxonVariant newVariant = null; + if ( null != ncbiId ) { + String ncbiPreferredName = taxonLabelService.getNCBIPreferredName(ncbiId.toString()); + newTaxon = new Taxon(ncbiPreferredName,manualId,ncbiId); + newVariant = new TaxonVariant(manualId,taxonLabel.getTaxonLabel(),ncbiPreferredName,"canonical form"); + } + else { + newTaxon = new Taxon(); + newTaxon.setName(taxonLabel.getTaxonLabel()); + newTaxon.setUBioNamebankId(manualId); + newVariant = new TaxonVariant(manualId,taxonLabel.getTaxonLabel(),taxonLabel.getTaxonLabel(),"canonical form"); + } + newVariant.setTaxon(newTaxon); getTaxonHome().store(newTaxon); - TaxonVariant newVariant = new TaxonVariant(manualId,taxonLabel.getTaxonLabel(),ncbiPreferredName,"canonical form"); - newVariant.setTaxon(newTaxon); getTaxonHome().store(newVariant); variant = newVariant; } Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/editTaxonLabel.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/editTaxonLabel.jsp 2009-06-26 15:41:18 UTC (rev 132) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/editTaxonLabel.jsp 2009-06-27 07:04:54 UTC (rev 133) @@ -71,17 +71,25 @@ <c:set var="counter" value="${counter+1}"/> </c:forEach> <div> + <input type="radio" name="taxonvariantid" id="textBoxRadio" value="-1"/> + I did a uBio lookup for + <spring:bind path="txnlabel.taxonLabel"> + <a href="http://www.ubio.org/browser/search.php?search_all=<c:out value="${status.value}"/>" title="uBio taxonomy" target="_new"> + <img src="<fmt:message key="icons.weblink"/>" class="iconButton"/><c:out value="${status.value}"/></a> + </spring:bind> + and here is the namebank id: + <script type="text/javascript"> + function selectRadio(textBoxRadio) { + alert($(textBoxRadio)); + $(textBoxRadio).checked = true; + } + </script> + <input style="width:100px" class="textCell" type="text" name="manualid" onchange="selectRadio('textBoxRadio')" value=""/> + </div> + <div> <input type="radio" name="taxonvariantid" value="-1" - <c:if test="${counter==0}">checked="checked"</c:if> /><em>no association</em> - </div> - or enter taxon id by hand: - <input style="width:100px" class="textCell" type="text" name="manualid" value=""/> - from - <spring:bind path="txnlabel.taxonLabel"> - <a href="http://www.ubio.org/browser/search.php?search_all=<c:out value="${status.value}"/>" title="uBio taxonomy" target="_new"> - <img src="<fmt:message key="icons.weblink"/>" class="iconButton"/> uBio - </a> - </spring:bind> + <c:if test="${counter==0}">checked="checked"</c:if> /> <em>no association</em> + </div> </fieldset> <input type="submit" name="Update" value="<fmt:message key="button.update"/>" /> <input type="submit" name="_cancel" value="<fmt:message key="button.cancel"/>" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2009-06-28 11:49:39
|
Revision: 152 http://treebase.svn.sourceforge.net/treebase/?rev=152&view=rev Author: rvos Date: 2009-06-28 11:49:36 +0000 (Sun, 28 Jun 2009) Log Message: ----------- Made redirect URLs absolute Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSController.java trunk/treebase-web/src/main/webapp/WEB-INF/pages/anyObjectAsRDF.jsp Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSController.java 2009-06-28 11:09:50 UTC (rev 151) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSController.java 2009-06-28 11:49:36 UTC (rev 152) @@ -60,6 +60,7 @@ throws Exception { res.setContentType("text/plain"); String url = null; + String domain = "http://" + req.getServerName() + ":" + req.getServerPort(); try { String pathInfo = req.getPathInfo(); if ( TreebaseUtil.isEmpty(pathInfo) ) { @@ -81,17 +82,17 @@ TreebaseIDString tbID = namespacedGUID.getTreebaseIDString(); if ( hasWebPage(pathComponents) ) { if ( TreebaseUtil.isEmpty(req.getParameter(format)) ) { - url = "/treebase-web/search/study/anyObjectAsRDF.html?namespacedGUID=" + namespacedGUID.toString(); + url = domain + "/treebase-web/search/study/anyObjectAsRDF.html?namespacedGUID=" + namespacedGUID.toString(); } else if ( req.getParameter(format).equals("html") ) { - url = createUrl(tbID.getTypePrefix(),tbID.getId()); + url = domain + createUrl(tbID.getTypePrefix(),tbID.getId()); } else { - url = createDownloadUrl(tbID.getTypePrefix(),tbID.getId(),req.getParameter(format)); + url = domain + createDownloadUrl(tbID.getTypePrefix(),tbID.getId(),req.getParameter(format)); } } else { - url = "/treebase-web/search/study/anyObjectAsRDF.html?namespacedGUID=" + namespacedGUID.toString(); + url = domain + "/treebase-web/search/study/anyObjectAsRDF.html?namespacedGUID=" + namespacedGUID.toString(); } } } catch ( MalformedTreebaseIDString e ) { Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/anyObjectAsRDF.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/anyObjectAsRDF.jsp 2009-06-28 11:09:50 UTC (rev 151) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/anyObjectAsRDF.jsp 2009-06-28 11:49:36 UTC (rev 152) @@ -7,7 +7,7 @@ xmlns="http://purl.org/rss/1.0/"> <channel rdf:about="${baseURL}/${phyloWSPath}"> <title>${phyloWSPath}</title> - <link>${baseURL}/${phyloWSPath}</link> + <link>${baseURL}</link> <description>Serializations for ${phyloWSPath}</description> <image rdf:resource="${domainAddress}<fmt:message key="icons.treebase.16px"/>"/> <items> @@ -21,7 +21,7 @@ </channel> <image rdf:about="${domainAddress}<fmt:message key="icons.treebase.16px"/>"> <title>${phyloWSPath}</title> - <link>${baseURL}/${phyloWSPath}</link> + <link>${baseURL}</link> <url>${domainAddress}<fmt:message key="icons.treebase.16px"/></url> </image> <c:if test="${hasWebPage}"> @@ -29,7 +29,7 @@ <title>Web page</title> <link>${baseURL}/${phyloWSPath}?format=html</link> <description>A human-readable version of the resource</description> - <!--dcterms:format>text/html</dcterms:format--> + <dc:format>text/html</dc:format> <dc:language>EN-US</dc:language> </item> </c:if> @@ -38,7 +38,7 @@ <title>NeXML file</title> <link>${baseURL}/${phyloWSPath}?format=nexml</link> <description>A NeXML serialization of the resource</description> - <!--dcterms:format>application/xml</dcterms:format--> + <dc:format>application/xml</dc:format> </item> </c:if> <c:if test="${hasNexus}"> @@ -46,7 +46,7 @@ <title>Nexus file</title> <link>${baseURL}/${phyloWSPath}?format=nexus</link> <description>A Nexus serialization of the resource</description> - <!--dcterms:format>text/plain</dcterms:format--> + <dc:format>text/plain</dc:format> </item> </c:if> <c:if test="${hasRdf}"> @@ -54,7 +54,7 @@ <title>RDF file</title> <link>${baseURL}/${phyloWSPath}?format=rdf</link> <description>An RDF/XML serialization of the resource</description> - <!--dcterms:format>application/rdf+xml</dcterms:format--> + <dc:format>application/rdf+xml</dc:format> </item> </c:if> </rdf:RDF> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2009-12-09 16:26:38
|
Revision: 340 http://treebase.svn.sourceforge.net/treebase/?rev=340&view=rev Author: rvos Date: 2009-12-09 16:26:28 +0000 (Wed, 09 Dec 2009) Log Message: ----------- Updated searchBySubmission view: added help icon, added radio buttons to select identifier type Modified Paths: -------------- trunk/treebase-web/src/main/resources/ApplicationResources.properties trunk/treebase-web/src/main/webapp/WEB-INF/pages/searchBySubmissionID.jsp Modified: trunk/treebase-web/src/main/resources/ApplicationResources.properties =================================================================== --- trunk/treebase-web/src/main/resources/ApplicationResources.properties 2009-12-09 16:06:08 UTC (rev 339) +++ trunk/treebase-web/src/main/resources/ApplicationResources.properties 2009-12-09 16:26:28 UTC (rev 340) @@ -170,7 +170,7 @@ submission.list.title = List of Treebase Submissions submission.mainmenu.title= Treebase Submission Menu submission.id = Submission Id -submission.accession = Study Accession Number +submission.accession = Submission Id #-- citation section -- citation.page.title = Citation Information Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/searchBySubmissionID.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/searchBySubmissionID.jsp 2009-12-09 16:06:08 UTC (rev 339) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/searchBySubmissionID.jsp 2009-12-09 16:26:28 UTC (rev 340) @@ -7,13 +7,17 @@ <form method="post" id="dataForm"> <fieldset> -<legend>Search based on Study Accession Number</legend> +<legend>Search for submissions by identifiers +<a href="#" class="openHelp" onclick="openHelp('searchBySubmissionID')"><img class="iconButton" src="<fmt:message key="icons.help"/>" /></a> +</legend> <table border="0" cellpadding="3" cellspacing="3"> <tr> <th><fmt:message key="submission.accession"/>:</th> - <td> + <td> + <input type="radio" name="identifierType" value="TB1"/>Legacy accession number + <input type="radio" name="identifierType" value="TB2"/>TreeBASE2 study ID <input type="text" name="submissionaccession" maxlength = "25"/> </td> </tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yo...@us...> - 2009-12-21 14:26:19
|
Revision: 400 http://treebase.svn.sourceforge.net/treebase/?rev=400&view=rev Author: youjun Date: 2009-12-21 14:26:10 +0000 (Mon, 21 Dec 2009) Log Message: ----------- change the mailto subject of involved pages Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SummaryController.java trunk/treebase-web/src/main/webapp/WEB-INF/pages/changeStudyStatus.jsp trunk/treebase-web/src/main/webapp/WEB-INF/pages/editSetTaxonLabel.jsp trunk/treebase-web/src/main/webapp/WEB-INF/pages/readyStateSubmissionList.jsp trunk/treebase-web/src/main/webapp/WEB-INF/pages/submissionSummaryView.jsp trunk/treebase-web/src/main/webapp/WEB-INF/pages/taxonLabels.jsp Added Paths: ----------- trunk/treebase-web/src/main/webapp/WEB-INF/lib/ Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SummaryController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SummaryController.java 2009-12-18 19:03:26 UTC (rev 399) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SummaryController.java 2009-12-21 14:26:10 UTC (rev 400) @@ -168,6 +168,7 @@ } resultMap.put("submissionNumber", submission.getSubmissionNumber()); + resultMap.put("submission", submission); resultMap.put("studyStatus", study.getStudyStatus().getDescription()); // Collection<Analysis> anacoll = study.getAnalysesReadOnly(); Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/changeStudyStatus.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/changeStudyStatus.jsp 2009-12-18 19:03:26 UTC (rev 399) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/changeStudyStatus.jsp 2009-12-21 14:26:10 UTC (rev 400) @@ -24,7 +24,7 @@ url="/user/summary.html" paramId="id" paramProperty="id"/> <display:column title="Submitter" sortable="true"> - <a href='mailto:${userList.submitter.emailAddressString}?subject=From Treebase Editor'>${userList.submitter.username}</a> + <a href='mailto:${userList.submitter.emailAddressString}?subject=TreeBASE Submission S${userList.id}'>${userList.submitter.username}</a> </display:column> <display:column property="study.name" title="Study Name" sortable="true"/> Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/editSetTaxonLabel.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/editSetTaxonLabel.jsp 2009-12-18 19:03:26 UTC (rev 399) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/editSetTaxonLabel.jsp 2009-12-21 14:26:10 UTC (rev 400) @@ -19,7 +19,12 @@ <form method="post" name="dataform"> <c:set var="counter" value="0"/> -<c:if test="${publicationState eq 'NotReady'}"> + +<%if(request.isUserInRole("Admin") || request.isUserInRole("Associate Editor")){%> + <% request.setAttribute("isEditable","yes");%> + <% } %> + + <c:if test="${publicationState eq 'NotReady'||isEditable eq 'yes'}"> <fieldset> <legend>Taxon label list editor <a href="#" class="openHelp" onclick="openHelp('editSetTaxonLabel')"><img class="iconButton" src="<fmt:message key="icons.help"/>" /></a> Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/readyStateSubmissionList.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/readyStateSubmissionList.jsp 2009-12-18 19:03:26 UTC (rev 399) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/readyStateSubmissionList.jsp 2009-12-21 14:26:10 UTC (rev 400) @@ -22,7 +22,7 @@ <display:column title="Submitter" sortable="true" style="text-align:left; width: 10%"> - <a href='mailto:${userList.submitter.emailAddressString}?subject=From Treebase Editor'>${userList.submitter.username}</a> + <a href='mailto:${userList.submitter.emailAddressString}?subject=TreeBASE Submission S${userList.id}'>${userList.submitter.username}</a> </display:column> <display:column property="study.studyStatus.description" title="Status" Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/submissionSummaryView.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/submissionSummaryView.jsp 2009-12-18 19:03:26 UTC (rev 399) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/submissionSummaryView.jsp 2009-12-21 14:26:10 UTC (rev 400) @@ -11,7 +11,7 @@ </legend> Submission: <c:out value="${submissionNumber}"/>, <c:out value="${studyStatus}"/>, <a href="/treebase-web/admin/changeStudyStatus.html"> Update Status</a><br/> Submission initiated: <c:out value="${initiatedDate}"/><br/> - +<a href='mailto:${submission.submitter.emailAddressString}?subject=TreeBASE Submission S${submission.id}'>Contact Submitter</a><br/> <c:if test="${not empty citationsummary.study}"> <c:if test="${not empty citationsummary.study.name}"> Study name: <c:out value="${citationsummary.study.name}"/> Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/taxonLabels.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/taxonLabels.jsp 2009-12-18 19:03:26 UTC (rev 399) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/taxonLabels.jsp 2009-12-21 14:26:10 UTC (rev 400) @@ -27,7 +27,11 @@ <!-- this class name 'checkBoxColumn' is important, not just for styling, but also to add check/uncheck all behaviour --> - <c:if test="${editable}"> + <%if(request.isUserInRole("Admin") || request.isUserInRole("Associate Editor")){%> + <% request.setAttribute("isEditable","yes");%> + <% } %> + + <c:if test="${editable||isEditable eq 'yes'}"> <display:column class="checkBoxColumn"> <input type="checkbox" name="validate" value="${userList.id}" title="Include/exclude from validation" <c:if test="${!userList.attemptedLinking}"> checked="checked"</c:if> @@ -72,7 +76,7 @@ </c:if> </display:column> - <c:if test="${editable}"> + <c:if test="${editable||isEditable eq 'yes'}"> <display:column url="/user/editTaxonLabel.html" paramId="taxonlabelid" @@ -88,7 +92,7 @@ </c:if> - <c:if test="${editable}"> + <c:if test="${editable||isEditable eq 'yes'}"> <display:footer> <tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2010-01-15 15:05:06
|
Revision: 451 http://treebase.svn.sourceforge.net/treebase/?rev=451&view=rev Author: rvos Date: 2010-01-15 15:05:00 +0000 (Fri, 15 Jan 2010) Log Message: ----------- Now stores and displays initialReviewerRedirect flag, to be used for displaying the reviewer notice and agreement Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSController.java trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/nav.jsp Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSController.java 2010-01-15 14:53:41 UTC (rev 450) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSController.java 2010-01-15 15:05:00 UTC (rev 451) @@ -37,6 +37,7 @@ throw new ObjectNotFoundException("Can't find study " + objectId); } if ( ! TreebaseUtil.isEmpty(request.getParameter(Constants.X_ACCESS_CODE))) { + request.setAttribute("initialReviewerRedirect", true); return base .append("/summary.html?id=") .append(objectId) Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/nav.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/nav.jsp 2010-01-15 14:53:41 UTC (rev 450) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/nav.jsp 2010-01-15 15:05:00 UTC (rev 451) @@ -183,7 +183,7 @@ <c:if test="${reviewerAccessGranted}"> <div> <img src="<fmt:message key="icons.info"/>" alt="<fmt:message key="icon.information"/>" class="icon" /> - <span style="color: red; ">You are in reviewer mode.</span> + <span style="color: red; ">You are in reviewer mode ${initialReviewerRedirect}.</span> </div> </c:if> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2010-01-15 15:17:55
|
Revision: 452 http://treebase.svn.sourceforge.net/treebase/?rev=452&view=rev Author: rvos Date: 2010-01-15 15:17:49 +0000 (Fri, 15 Jan 2010) Log Message: ----------- Added flag and logic for displaying reviewer notice/agreement on initial access check. Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/Constants.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/BaseFormController.java trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/nav.jsp Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/Constants.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/Constants.java 2010-01-15 15:05:00 UTC (rev 451) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/Constants.java 2010-01-15 15:17:49 UTC (rev 452) @@ -25,6 +25,8 @@ * objects to be stores in the session */ public static final String X_ACCESS_CODE = "x-access-code"; + public static final String REVIEWER_ACCESS_GRANTED = "reviewerAccessGranted"; + public static final String STUDY_MAP = "studyMap"; public static final String ANALYSIS_MAP = "analysisMap"; public static final String ANALYSIS_STEP_MAP = "analysisStepMap"; Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/BaseFormController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/BaseFormController.java 2010-01-15 15:05:00 UTC (rev 451) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/BaseFormController.java 2010-01-15 15:17:49 UTC (rev 452) @@ -197,6 +197,11 @@ //saveMessage(pRequest,"You are in reviewer access mode."); LOGGER.info("x-access-code matches computed hashed study id"); LOGGER.info("Reviewer access is granted"); + if ( ! (Boolean)pRequest.getSession().getAttribute(Constants.REVIEWER_ACCESS_GRANTED) ) { + pRequest.getSession().setAttribute("displayAgreement",true); + } + pRequest.getSession().setAttribute(Constants.REVIEWER_ACCESS_GRANTED, reviewerAccessGranted); + } else { LOGGER.info("x-access-code doesn't match computed hashed study id"); @@ -206,7 +211,6 @@ else { LOGGER.info("No x-access-code parameter supplied"); } - pRequest.setAttribute("reviewerAccessGranted", reviewerAccessGranted); return reviewerAccessGranted; } Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/nav.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/nav.jsp 2010-01-15 15:05:00 UTC (rev 451) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/nav.jsp 2010-01-15 15:17:49 UTC (rev 452) @@ -183,7 +183,7 @@ <c:if test="${reviewerAccessGranted}"> <div> <img src="<fmt:message key="icons.info"/>" alt="<fmt:message key="icon.information"/>" class="icon" /> - <span style="color: red; ">You are in reviewer mode ${initialReviewerRedirect}.</span> + <span style="color: red; ">You are in reviewer mode ${displayAgreement}.</span> </div> </c:if> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2010-01-15 18:00:22
|
Revision: 464 http://treebase.svn.sourceforge.net/treebase/?rev=464&view=rev Author: rvos Date: 2010-01-15 18:00:16 +0000 (Fri, 15 Jan 2010) Log Message: ----------- Refactoring reviewer login logic Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/BaseFormController.java trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/nav.jsp Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/BaseFormController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/BaseFormController.java 2010-01-15 17:23:48 UTC (rev 463) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/BaseFormController.java 2010-01-15 18:00:16 UTC (rev 464) @@ -180,45 +180,29 @@ private boolean isReviewerAccessGranted(HttpServletRequest pRequest) { boolean reviewerAccessGranted = false; + if ( "cancel".equals(pRequest.getParameter("agreement")) ) { + pRequest.getSession().setAttribute(Constants.REVIEWER_ACCESS_GRANTED, false); + } + if ( "ok".equals(pRequest.getParameter("agreement")) ) { + pRequest.getSession().setAttribute(Constants.REVIEWER_ACCESS_GRANTED, true); + } Object xAccesCodeObject = pRequest.getSession().getAttribute(Constants.X_ACCESS_CODE); if ( xAccesCodeObject != null ) { String storedHashedStudyId = xAccesCodeObject.toString(); - LOGGER.info("x-access-code="+storedHashedStudyId); - Long studyId = Long.parseLong(pRequest.getParameter("id")); - LOGGER.info("studyId="+studyId); - TreebaseIDString tbidstr = new TreebaseIDString(Study.class,studyId); - LOGGER.info("TreebaseIDString="+tbidstr); - NamespacedGUID nsguid = tbidstr.getNamespacedGUID(); - LOGGER.info("NamespacedGUID="+nsguid); - String computedHashedStudyId = nsguid.getHashedIDString(); - LOGGER.info("computedHashedStudyId="+computedHashedStudyId); - if ( storedHashedStudyId.equals(computedHashedStudyId) ) { - reviewerAccessGranted = true; - //saveMessage(pRequest,"You are in reviewer access mode."); - LOGGER.info("x-access-code matches computed hashed study id"); - LOGGER.info("Reviewer access is granted"); - if ( pRequest.getSession().getAttribute(Constants.REVIEWER_ACCESS_GRANTED) == null ) { + TreebaseIDString tbidstr = new TreebaseIDString(Study.class,Long.parseLong(pRequest.getParameter("id"))); + if ( storedHashedStudyId.equals(tbidstr.getNamespacedGUID().getHashedIDString()) ) { + Object accessGranted = pRequest.getSession().getAttribute(Constants.REVIEWER_ACCESS_GRANTED); + if ( accessGranted == null || ((Boolean)accessGranted).booleanValue() == false ) { + LOGGER.info("Going to display agreement"); pRequest.getSession().setAttribute("displayAgreement",true); } else { + LOGGER.info("Reviewer access is granted"); + reviewerAccessGranted = true; pRequest.getSession().setAttribute("displayAgreement",false); } pRequest.getSession().setAttribute(Constants.REVIEWER_ACCESS_GRANTED, reviewerAccessGranted); - pRequest.getSession().removeAttribute(Constants.REVIEWER_ACCESS_DENIED); } - else { - LOGGER.info("x-access-code doesn't match computed hashed study id"); - LOGGER.info("access denied"); - } - } - else { - LOGGER.info("No x-access-code parameter supplied"); - } - if ( "cancel".equals(pRequest.getParameter("agreement")) || pRequest.getSession().getAttribute(Constants.REVIEWER_ACCESS_DENIED) != null) { - pRequest.getSession().setAttribute(Constants.REVIEWER_ACCESS_GRANTED, false); - pRequest.getSession().setAttribute("displayAgreement",true); - pRequest.getSession().setAttribute(Constants.REVIEWER_ACCESS_DENIED, true); - return false; } return reviewerAccessGranted; } Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/nav.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/nav.jsp 2010-01-15 17:23:48 UTC (rev 463) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/nav.jsp 2010-01-15 18:00:16 UTC (rev 464) @@ -185,8 +185,9 @@ <img src="<fmt:message key="icons.info"/>" alt="<fmt:message key="icon.information"/>" class="icon" /> <span style="color: red; ">You are in reviewer mode.</span> </div> - <c:if test="${displayAgreement || reviewerAccessDenied}"> - <div id="agreement" style="position:fixed;left:10%;top:5%;width:80%;height:80%;background-color:white;padding:10px;border:5px solid orange"> +</c:if> +<c:if test="${displayAgreement}"> + <div id="agreement" style="position:fixed;left:10%;top:5%;width:80%;height:80%;background-color:white;padding:10px;border:5px solid orange"> <h2>Reviewer/Referee Access Agreement</h2> <div style="width:100%;overflow:auto"> You have reached this page using a special URL that is intended to be used @@ -240,11 +241,10 @@ general public; you agree to keep the URL confidential. </div> <div style="width:100%;text-align:center;padding-top:10px"> - <input type="submit" id="agreementOk" value="OK" onclick="$('agreement').style.display = 'none'"/> + <input type="submit" id="agreementOk" value="OK" onclick="window.location=location.href+'&agreement=ok'"/> <input type="submit" id="agreementCancel" value="Cancel" onclick="window.location=location.href+'&agreement=cancel'"/> </div> </div> - </c:if> </c:if> <c:if test="${! empty study.citation.title}"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yo...@us...> - 2010-03-04 16:48:14
|
Revision: 525 http://treebase.svn.sourceforge.net/treebase/?rev=525&view=rev Author: youjun Date: 2010-03-04 16:48:06 +0000 (Thu, 04 Mar 2010) Log Message: ----------- make the menus collapsible Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/Constants.java trunk/treebase-web/src/main/webapp/WEB-INF/pages/submissionSummaryView.jsp trunk/treebase-web/src/main/webapp/common/adminMenu.jsp trunk/treebase-web/src/main/webapp/common/searchMenuRight.jsp trunk/treebase-web/src/main/webapp/common/searchSummaryMenuRight.jsp trunk/treebase-web/src/main/webapp/common/submissionMenu.jsp Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/Constants.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/Constants.java 2010-03-03 22:53:35 UTC (rev 524) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/Constants.java 2010-03-04 16:48:06 UTC (rev 525) @@ -77,7 +77,6 @@ public static final String ALGORITHM_TYPES = "algorithmtypes"; public static final String ALGORITHM_LIKELIHOOD = Algorithm.LikelihoodAlgorithm; public static final String ALGORITHM_PARSIMONY = Algorithm.ParsimonyAlgorithm; - //public static final String ALGORITHM_DISTANCE = Algorithm.DistanceAlgorithm; public static final String ALGORITHM_OTHER = Algorithm.OtherAlgorithm; public static final String ALGORITHM_Bayesian =Algorithm.BayesianAlgorithm; public static final String ALGORITHM_Evolution =Algorithm.EvolutionAlgorithm; Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/submissionSummaryView.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/submissionSummaryView.jsp 2010-03-03 22:53:35 UTC (rev 524) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/submissionSummaryView.jsp 2010-03-04 16:48:06 UTC (rev 525) @@ -35,7 +35,7 @@ <img class="iconButton" alt="link" src="<fmt:message key="icons.weblink"/>" /> Reviewer access URL: right-click and copy me </a> -<div><string>You can copy and send this URL to you journal editor to provide reviewers with limited, read-only access to your data, even if your submission has not yet been approved and the data are not yet public.</sstrong></div> +<div><strong>You can copy and send this URL to you journal editor to provide reviewers with limited, read-only access to your data, even if your submission has not yet been approved and the data are not yet public.</strong></div> <br/> <c:if test="${not empty citationsummary.study}"> <c:if test="${not empty citationsummary.study.name}"> Modified: trunk/treebase-web/src/main/webapp/common/adminMenu.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/common/adminMenu.jsp 2010-03-03 22:53:35 UTC (rev 524) +++ trunk/treebase-web/src/main/webapp/common/adminMenu.jsp 2010-03-04 16:48:06 UTC (rev 525) @@ -4,6 +4,7 @@ <div id="mainMenu"> <div id="gutter"> <div id="menu"> +<a onclick="switchMenu('menuDiv');" style="cursor: pointer;">[X]</a> <menu:useMenuDisplayer name="ListMenu" permissions="rolesAdapter"> <menu:displayMenu name="StudyManagementMenu"/> <menu:displayMenu name="UserManagementMenu"/> @@ -14,4 +15,14 @@ </div> <script type="text/javascript"> initializeMenus(); + + function switchMenu(obj) { + var el = document.getElementById(obj); + if ( el.style.display != "none" ) { + el.style.display = 'none'; + } + else { + el.style.display = ''; + } + } </script> Modified: trunk/treebase-web/src/main/webapp/common/searchMenuRight.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/common/searchMenuRight.jsp 2010-03-03 22:53:35 UTC (rev 524) +++ trunk/treebase-web/src/main/webapp/common/searchMenuRight.jsp 2010-03-04 16:48:06 UTC (rev 525) @@ -4,6 +4,7 @@ <div id="mainMenu"> <div id="gutter"> <div id="menu"> +<a onclick="switchMenu('menuDiv');" style="cursor: pointer;">[X]</a> <menu:useMenuDisplayer name="ListMenu" permissions="rolesAdapter" > <menu:displayMenu name="Searches" /> </menu:useMenuDisplayer> @@ -13,8 +14,19 @@ </div> <script type="text/javascript"> initializeMenus(); + var menu = document.getElementById("menuDiv"); if (menu != null) { openMenu("menuDiv"); } + + function switchMenu(obj) { + var el = document.getElementById(obj); + if ( el.style.display != "none" ) { + el.style.display = 'none'; + } + else { + el.style.display = ''; + } + } </script> Modified: trunk/treebase-web/src/main/webapp/common/searchSummaryMenuRight.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/common/searchSummaryMenuRight.jsp 2010-03-03 22:53:35 UTC (rev 524) +++ trunk/treebase-web/src/main/webapp/common/searchSummaryMenuRight.jsp 2010-03-04 16:48:06 UTC (rev 525) @@ -4,6 +4,7 @@ <div id="mainMenu"> <div id="gutter"> <div id="menu"> +<a onclick="switchMenu('menuDiv');" style="cursor: pointer;">[X]</a> <menu:useMenuDisplayer name="ListMenu" permissions="rolesAdapter"> <menu:displayMenu name="SubmissionInfo"/> <menu:displayMenu name="Citation"/> @@ -21,4 +22,14 @@ </div> <script type="text/javascript"> initializeMenus(); + + function switchMenu(obj) { + var el = document.getElementById(obj); + if ( el.style.display != "none" ) { + el.style.display = 'none'; + } + else { + el.style.display = ''; + } + } </script> Modified: trunk/treebase-web/src/main/webapp/common/submissionMenu.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/common/submissionMenu.jsp 2010-03-03 22:53:35 UTC (rev 524) +++ trunk/treebase-web/src/main/webapp/common/submissionMenu.jsp 2010-03-04 16:48:06 UTC (rev 525) @@ -4,6 +4,7 @@ <div id="mainMenu"> <div id="gutter"> <div id="menu"> +<a onclick="switchMenu('menuDiv');" style="cursor: pointer;">[X]</a> <menu:useMenuDisplayer name="ListMenu" permissions="rolesAdapter"> <menu:displayMenu name="SubmissionHome"/> <menu:displayMenu name="SubmissionNotes"/> @@ -22,5 +23,18 @@ </div> </div> </div> +<script type="text/javascript"> + initializeMenus(); + + function switchMenu(obj) { + var el = document.getElementById(obj); + if ( el.style.display != "none" ) { + el.style.display = 'none'; + } + else { + el.style.display = ''; + } + } +</script> <script type="text/javascript" src="/treebase-web/scripts/prototype/prototype-1.6.0.3.js"></script> <script type="text/javascript" src="/treebase-web/scripts/user/submissionSummary.js"></script> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vga...@us...> - 2010-03-18 16:12:37
|
Revision: 629 http://treebase.svn.sourceforge.net/treebase/?rev=629&view=rev Author: vgapeyev Date: 2010-03-18 16:12:31 +0000 (Thu, 18 Mar 2010) Log Message: ----------- More appropriate tooltip message for disabled analysis downloads Modified Paths: -------------- trunk/treebase-web/src/main/resources/ApplicationResources.properties trunk/treebase-web/src/main/webapp/WEB-INF/pages/algorithm.jsp Modified: trunk/treebase-web/src/main/resources/ApplicationResources.properties =================================================================== --- trunk/treebase-web/src/main/resources/ApplicationResources.properties 2010-03-18 15:30:48 UTC (rev 628) +++ trunk/treebase-web/src/main/resources/ApplicationResources.properties 2010-03-18 16:12:31 UTC (rev 629) @@ -305,6 +305,7 @@ matrix.description = Description download.original = Download Original File download.reconstructedfile = Download Reconstructed File +download.unavailable = File download currently not available download.nexml = Download NeXML File download.json = Download JSON File download.rdf = Download RDF file Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/algorithm.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/algorithm.jsp 2010-03-18 15:30:48 UTC (rev 628) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/algorithm.jsp 2010-03-18 16:12:31 UTC (rev 629) @@ -49,8 +49,13 @@ <img class="iconButton" src="<fmt:message key="icons.download.reconstructed"/>" +<%-- title="<fmt:message key="download.reconstructedfile"/>" - alt="<fmt:message key="download.reconstructedfile"/>"/> + alt="<fmt:message key="download.reconstructedfile"/>" +--%> + title="<fmt:message key="download.unavailable"/>" + alt="<fmt:message key="download.unavailable"/>" + /> <!-- </a> --> <c:if test="${not empty analysisStepCommand.displayName}"> <c:out value="${analysisStepCommand.displayName}"/> @@ -58,7 +63,7 @@ <c:if test="${empty analysisStepCommand.displayName}"> <em>Untitled</em> </c:if> - </h2> + --</h2> <div <c:if test="${!editable}">style="display:none"</c:if> id="analysisStepCommand<c:out value="${analysisStepCommand.id}"/>"> <c:if test="${editable || ( not empty analysisStepCommand.displayName || not empty analysisStepCommand.notes )}"> <fieldset> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yo...@us...> - 2010-04-03 17:43:13
|
Revision: 674 http://treebase.svn.sourceforge.net/treebase/?rev=674&view=rev Author: youjun Date: 2010-04-03 17:43:07 +0000 (Sat, 03 Apr 2010) Log Message: ----------- modify configure files to import oai-pmh-provider Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/model/Identify.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/model/OAIPMHCommand.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/IdentifyUtil.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/validators/OAIPMHValidator.java trunk/treebase-web/src/main/webapp/WEB-INF/applicationContext.xml trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml trunk/treebase-web/src/main/webapp/WEB-INF/web.xml Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java 2010-04-03 15:01:36 UTC (rev 673) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java 2010-04-03 17:43:07 UTC (rev 674) @@ -1,4 +1,4 @@ -package org.treebase.oai.web.controller; +package org.cipres.treebase.web.controllers; import java.lang.reflect.Method; import java.text.ParseException; @@ -13,9 +13,9 @@ import org.springframework.validation.BindException; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.AbstractCommandController; -import org.treebase.oai.web.command.Identify; -import org.treebase.oai.web.command.OAIPMHCommand; -import org.treebase.oai.web.util.IdentifyUtil; +import org.cipres.treebase.web.model.Identify; +import org.cipres.treebase.web.model.OAIPMHCommand; +import org.cipres.treebase.web.util.IdentifyUtil; import org.cipres.treebase.domain.admin.Person; import org.cipres.treebase.domain.study.ArticleCitation; import org.cipres.treebase.domain.study.BookCitation; Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/model/Identify.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/model/Identify.java 2010-04-03 15:01:36 UTC (rev 673) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/model/Identify.java 2010-04-03 17:43:07 UTC (rev 674) @@ -1,4 +1,4 @@ -package org.treebase.oai.web.command; +package org.cipres.treebase.web.model; import java.text.SimpleDateFormat; import java.util.Calendar; Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/model/OAIPMHCommand.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/model/OAIPMHCommand.java 2010-04-03 15:01:36 UTC (rev 673) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/model/OAIPMHCommand.java 2010-04-03 17:43:07 UTC (rev 674) @@ -1,4 +1,4 @@ -package org.treebase.oai.web.command; +package org.cipres.treebase.web.model; /** * * @author youjun Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/IdentifyUtil.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/IdentifyUtil.java 2010-04-03 15:01:36 UTC (rev 673) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/IdentifyUtil.java 2010-04-03 17:43:07 UTC (rev 674) @@ -1,4 +1,4 @@ -package org.treebase.oai.web.util; +package org.cipres.treebase.web.util; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -7,8 +7,8 @@ import java.util.GregorianCalendar; import java.util.TimeZone; -import org.treebase.oai.web.command.Identify; -import org.treebase.oai.web.command.OAIPMHCommand; +import org.cipres.treebase.web.model.Identify; +import org.cipres.treebase.web.model.OAIPMHCommand; /* * * @author youjun Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/validators/OAIPMHValidator.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/validators/OAIPMHValidator.java 2010-04-03 15:01:36 UTC (rev 673) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/validators/OAIPMHValidator.java 2010-04-03 17:43:07 UTC (rev 674) @@ -1,9 +1,9 @@ -package org.treebase.oai.web.validator; +package org.cipres.treebase.web.validators; import org.springframework.validation.Errors; import org.springframework.validation.ValidationUtils; import org.springframework.validation.Validator; -import org.treebase.oai.web.command.OAIPMHCommand; +import org.cipres.treebase.web.model.OAIPMHCommand; public class OAIPMHValidator implements Validator { Modified: trunk/treebase-web/src/main/webapp/WEB-INF/applicationContext.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/applicationContext.xml 2010-04-03 15:01:36 UTC (rev 673) +++ trunk/treebase-web/src/main/webapp/WEB-INF/applicationContext.xml 2010-04-03 17:43:07 UTC (rev 674) @@ -11,6 +11,36 @@ <!-- ========================================================== --> + <!-- oai-pmh-provider properties bean--> + <!-- ========================================================== --> + + <bean id="top.propertyConfigurer" + class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> + <property name="ignoreUnresolvablePlaceholders" value="true" /> + <property name="locations"> + <list> + <value>/WEB-INF/identify.properties</value> + </list> + </property> + </bean> + + <bean id="top.identify" class="org.cipres.treebase.web.model.Identify"> + <property name="baseURL" value="${identify.baseURL}" /> + <property name="repositoryName" value="${identify.repositoryName}" /> + <property name="protocolVersion" value="${identify.protocolVersion}" /> + <property name="adminEmail" value="${identify.adminEmail}" /> + <property name="earliestDatestamp" value="${identify.earliestDatestamp}" /> + <property name="deletedRecord" value="${identify.deletedRecord}" /> + <property name="granularity" value="${identify.granularity}" /> + <property name="granularityPattern" value="${identify.granularityPattern}" /> + <property name="repositoryIdentifier" value="${identify.repositoryIdentifier}" /> + <property name="sampleIdentifier" value="${identify.sampleIdentifier}" /> + <property name="identifierDelimiter" value="${identify.identifierDelimiter}" /> + <property name="dublinPerfix" value="${identify.dublinPerfix}" /> + <property name="dryadPerfix" value="${identify.dryadPerfix}" /> + </bean> + + <!-- ========================================================== --> <!-- LIST OF DWR beans/methods --> <!-- ========================================================== --> Modified: trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2010-04-03 15:01:36 UTC (rev 673) +++ trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2010-04-03 17:43:07 UTC (rev 674) @@ -8,6 +8,16 @@ http://www.directwebremoting.org/schema/spring-dwr http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd"> + + <!-- ========================================================== --> + <!-- velocity configure --> + <!-- ========================================================== --> + + <bean id="velocityConfigurer" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer"> + <property name="resourceLoaderPath"> + <value>WEB-INF/vmFiles/</value> + </property> + </bean> <!-- ========================================================== --> <!-- LIST OF CONTROLLERS FOR WEB-TIER --> @@ -826,6 +836,16 @@ <property name="userService"><ref bean="userService"></ref></property> <property name="helpService"><ref bean="helpService"></ref></property> </bean> + + + <bean id="OAIPMHController" class="org.cipres.treebase.web.controllers.OAIPMHController"> + <property name="submissionService"><ref bean="submissionService"></ref></property> + <property name="studyService"><ref bean="studyService"></ref></property> + <property name="identify"><ref bean="top.identify"></ref></property> + <property name="validator"> + <bean class="org.cipres.treebase.web.validators.OAIPMHValidator"/> + </property> + </bean> <!-- ========================================================== --> <!-- LIST OF VALIDATORS FOR CONTROLLER --> @@ -838,15 +858,29 @@ </bean> <!-- ========================================================== --> - <!-- Spring View Resolvers for JSPs --> + <!-- Spring View Resolvers for JSPs and .vm files --> <!-- ========================================================== --> - <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> - <property name="requestContextAttribute" value="rc"/> - <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> - <property name="prefix" value="/WEB-INF/pages/"/> - <property name="suffix" value=".jsp"/> + + <bean id="vmViewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver"> + <property name="order" value="1"></property> + <property name="suffix"> + <value>.vm</value> + </property> + <property name="exposeRequestAttributes"> + <value>true</value> + </property> + <property name="exposeSessionAttributes"> + <value>true</value> + </property> </bean> - + + <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> + <property name="requestContextAttribute" value="rc"/> + <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> + <property name="prefix" value="/WEB-INF/pages/"/> + <property name="suffix" value=".jsp"/> + </bean> + <!-- ========================================================== --> <!-- URL MAPPING --> <!-- ========================================================== --> @@ -854,7 +888,8 @@ <property name="alwaysUseFullPath" value="true"/> <property name="mappings"> - <props> + <props> + <prop key="/top/**">OAIPMHController</prop> <prop key="/phylows/**">phyloWSController</prop> <prop key="/about.html">filenameController</prop> <prop key="/home.html">filenameController</prop> Modified: trunk/treebase-web/src/main/webapp/WEB-INF/web.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/web.xml 2010-04-03 15:01:36 UTC (rev 673) +++ trunk/treebase-web/src/main/webapp/WEB-INF/web.xml 2010-04-03 17:43:07 UTC (rev 674) @@ -209,6 +209,10 @@ <servlet-name>treebase</servlet-name> <url-pattern>/phylows/*</url-pattern> </servlet-mapping> + <servlet-mapping> + <servlet-name>treebase</servlet-name> + <url-pattern>/top/*</url-pattern> + </servlet-mapping> <!-- ========================================================== --> <!-- url pattern that will be processed by XFireSpringServlet --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yo...@us...> - 2010-04-06 01:55:34
|
Revision: 677 http://treebase.svn.sourceforge.net/treebase/?rev=677&view=rev Author: youjun Date: 2010-04-06 01:55:28 +0000 (Tue, 06 Apr 2010) Log Message: ----------- add customized view resolver Modified Paths: -------------- trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml Added Paths: ----------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/viewresolver/ trunk/treebase-web/src/main/java/org/cipres/treebase/web/viewresolver/ChainableVelocityViewResolver.java Added: trunk/treebase-web/src/main/java/org/cipres/treebase/web/viewresolver/ChainableVelocityViewResolver.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/viewresolver/ChainableVelocityViewResolver.java (rev 0) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/viewresolver/ChainableVelocityViewResolver.java 2010-04-06 01:55:28 UTC (rev 677) @@ -0,0 +1,33 @@ +package org.cipres.treebase.web.viewresolver; + +import java.util.List; +import java.util.Locale; + +import org.springframework.web.servlet.View; +import org.springframework.web.servlet.ViewResolver; +import org.springframework.web.servlet.view.velocity.VelocityViewResolver; + +public class ChainableVelocityViewResolver implements ViewResolver { + + private VelocityViewResolver chainableResolver; + private List<String> views; + + public void setChainableResolver(VelocityViewResolver chainableResolver) { + this.chainableResolver = chainableResolver; + } + + public void setViews(List<String> views) { + this.views = views; + } + + public View resolveViewName(String viewName, Locale locale) throws Exception { + + if(views.contains(viewName)) + + return chainableResolver.resolveViewName(viewName, locale); + + return null; + + } + +} Modified: trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2010-04-05 19:40:55 UTC (rev 676) +++ trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2010-04-06 01:55:28 UTC (rev 677) @@ -860,20 +860,38 @@ <!-- ========================================================== --> <!-- Spring View Resolvers for JSPs and .vm files --> <!-- ========================================================== --> - <!-- - <bean id="vmViewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver"> - <property name="order" value="1"></property> - <property name="suffix"> - <value>.vm</value> + <!-- + <bean id="chainableVelocityViewResolver" class="org.cipres.treebase.web.viewresolver.ChainableVelocityViewResolver"> + <property name="chainableResolver"> + <bean class="org.springframework.web.servlet.view.velocity. VelocityViewResolver"> + <property name="order" value="1"></property> + <property name="suffix"> + <value>.vm</value> + </property> + <property name="exposeRequestAttributes"> + <value>true</value> + </property> + <property name="exposeSessionAttributes"> + <value>true</value> + </property> + <property name="contentType" value="application/xml;charset=UTF-8" /> + </bean> + </property> + <property name="order"><value>1</value></property> + <property name="views"> + <list> + <value>error</value> + <value>ListRecords</value> + <value>GetRecord</value> + <value>Identify</value> + <value>ListMetadataFormats</value> + <value>oai_dc_ListIdentifiers</value> + <value>ListSets</value> + </list> </property> - <property name="exposeRequestAttributes"> - <value>true</value> - </property> - <property name="exposeSessionAttributes"> - <value>true</value> - </property> - </bean> - --> + + </bean> + --> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="requestContextAttribute" value="rc"/> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yo...@us...> - 2010-04-06 20:37:53
|
Revision: 678 http://treebase.svn.sourceforge.net/treebase/?rev=678&view=rev Author: youjun Date: 2010-04-06 20:37:41 +0000 (Tue, 06 Apr 2010) Log Message: ----------- modify oai-pmh-data-provider code to fit in treebase Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/IdentifyUtil.java trunk/treebase-web/src/main/webapp/WEB-INF/identify.properties trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml Added Paths: ----------- trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/ trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/GetRecord.vm trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/Identify.vm trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/ListMetadataFormats.vm trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/ListRecords.vm trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/ListSets.vm trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/error.vm trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/head.vm trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/oai_dc_ListIdentifiers.vm trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/oai_dc_record.vm Removed Paths: ------------- trunk/treebase-web/src/main/webapp/WEB-INF/mvFiles/ Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java 2010-04-06 01:55:28 UTC (rev 677) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java 2010-04-06 20:37:41 UTC (rev 678) @@ -24,6 +24,7 @@ import org.cipres.treebase.domain.study.Submission; import org.cipres.treebase.domain.study.SubmissionService; import org.cipres.treebase.domain.study.StudyService; + /** * OAIPMHController.java * @@ -231,16 +232,16 @@ List<Person> authors=citation.getAuthors(); - map.put("title", citation.getTitle()); + map.put("title", IdentifyUtil.escape4XML(citation.getTitle())); map.put("creator", authors); - map.put("subject", citation.getKeywords()); + map.put("subject", IdentifyUtil.escape4XML(citation.getKeywords())); if(study.getName()!=null&study.getNotes()!=null) - map.put("description", study.getName()+" "+study.getNotes()); + map.put("description", IdentifyUtil.escape4XML(study.getName()+" "+study.getNotes())); else if(study.getNotes()==null) - map.put("description",study.getName()); + map.put("description",IdentifyUtil.escape4XML(study.getName())); else - map.put("description",study.getNotes()); - map.put("publisher", publisher); + map.put("description",IdentifyUtil.escape4XML(study.getNotes())); + map.put("publisher", IdentifyUtil.escape4XML(publisher)); map.put("date", "published on "+citation.getPublishYear()); map.put("identifier", "TreeBASE.org/study/TB2:s"+study.getId()); map.put("datestamp", study.getReleaseDate()); Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/IdentifyUtil.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/IdentifyUtil.java 2010-04-06 01:55:28 UTC (rev 677) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/IdentifyUtil.java 2010-04-06 20:37:41 UTC (rev 678) @@ -1,7 +1,9 @@ package org.cipres.treebase.web.util; +import java.text.CharacterIterator; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.text.StringCharacterIterator; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; @@ -48,4 +50,35 @@ cal.setTimeInMillis(utcMiliseconds); return new Date(utcMiliseconds + cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET)); } + + public static String escape4XML(String aText){ + final StringBuilder result = new StringBuilder(); + final StringCharacterIterator iterator = new StringCharacterIterator(aText); + char character = iterator.current(); + while (character != CharacterIterator.DONE ){ + if (character == '<') { + result.append("<"); + } + else if (character == '>') { + result.append(">"); + } + else if (character == '\"') { + result.append("""); + } + else if (character == '\'') { + result.append("'"); + } + else if (character == '&') { + result.append("&"); + } + else { + //the char is not a special one + //add it to the result as is + result.append(character); + } + character = iterator.next(); + } + return result.toString(); + } + } Modified: trunk/treebase-web/src/main/webapp/WEB-INF/identify.properties =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/identify.properties 2010-04-06 01:55:28 UTC (rev 677) +++ trunk/treebase-web/src/main/webapp/WEB-INF/identify.properties 2010-04-06 20:37:41 UTC (rev 678) @@ -1,4 +1,4 @@ -identify.baseURL=www.***.***:port/top +identify.baseURL=www.treebase.org/treebase-web/top/oai identify.repositoryName=TreeBASE repository identify.protocolVersion=2.0 identify.adminEmail=you...@ya... Modified: trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2010-04-06 01:55:28 UTC (rev 677) +++ trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2010-04-06 20:37:41 UTC (rev 678) @@ -13,11 +13,9 @@ <!-- velocity configure --> <!-- ========================================================== --> - <bean id="velocityConfigurer" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer"> - <property name="resourceLoaderPath"> - <value>WEB-INF/vmFiles/</value> - </property> - </bean> + <bean id="velocityConfigurer" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer"> + <property name="resourceLoaderPath" value="/WEB-INF/vmFiles/" /> + </bean> <!-- ========================================================== --> <!-- LIST OF CONTROLLERS FOR WEB-TIER --> @@ -860,14 +858,11 @@ <!-- ========================================================== --> <!-- Spring View Resolvers for JSPs and .vm files --> <!-- ========================================================== --> - <!-- + <bean id="chainableVelocityViewResolver" class="org.cipres.treebase.web.viewresolver.ChainableVelocityViewResolver"> <property name="chainableResolver"> - <bean class="org.springframework.web.servlet.view.velocity. VelocityViewResolver"> - <property name="order" value="1"></property> - <property name="suffix"> - <value>.vm</value> - </property> + <bean class="org.springframework.web.servlet.view.velocity.VelocityViewResolver"> + <property name="suffix" value=".vm"/> <property name="exposeRequestAttributes"> <value>true</value> </property> @@ -876,8 +871,7 @@ </property> <property name="contentType" value="application/xml;charset=UTF-8" /> </bean> - </property> - <property name="order"><value>1</value></property> + </property> <property name="views"> <list> <value>error</value> @@ -891,7 +885,7 @@ </property> </bean> - --> + <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="requestContextAttribute" value="rc"/> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> Added: trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/GetRecord.vm =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/GetRecord.vm (rev 0) +++ trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/GetRecord.vm 2010-04-06 20:37:41 UTC (rev 678) @@ -0,0 +1,7 @@ +#parse("head.vm") +<GetRecord> +#if($!requestParams.metadataPrefix=="oai_dc") +#parse("oai_dc_record.vm") +#end +</GetRecord> +</OAI-PMH> Added: trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/Identify.vm =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/Identify.vm (rev 0) +++ trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/Identify.vm 2010-04-06 20:37:41 UTC (rev 678) @@ -0,0 +1,25 @@ +#parse("head.vm") + <Identify> + <repositoryName>${identify.repositoryName}</repositoryName> + <baseURL>${identify.baseURL}</baseURL> + <protocolVersion>${identify.protocolVersion}</protocolVersion> + <adminEmail>${identify.adminEmail}</adminEmail> + <earliestDatestamp>${identify.earliestDatestamp}</earliestDatestamp> + <deletedRecord>${identify.deletedRecord}</deletedRecord> + <granularity>${identify.granularity}</granularity> + + <description> + <oai-identifier + xmlns="http://www.openarchives.org/OAI/2.0/oai-identifier" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation= + "http://www.openarchives.org/OAI/2.0/oai-identifier + http://www.openarchives.org/OAI/2.0/oai-identifier.xsd"> + <scheme>oai</scheme> + <repositoryIdentifier>${identify.repositoryIdentifier}</repositoryIdentifier> + <delimiter>${identify.identifierDelimiter}</delimiter> + <sampleIdentifier>${identify.sampleIdentifier}</sampleIdentifier> + </oai-identifier> + </description> + </Identify> +</OAI-PMH> Added: trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/ListMetadataFormats.vm =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/ListMetadataFormats.vm (rev 0) +++ trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/ListMetadataFormats.vm 2010-04-06 20:37:41 UTC (rev 678) @@ -0,0 +1,19 @@ +#parse("head.vm") + <ListMetadataFormats> + <metadataFormat> + <metadataPrefix>oai_dc</metadataPrefix> + <schema>http://www.openarchives.org/OAI/2.0/oai_dc.xsd + </schema> + <metadataNamespace>http://www.openarchives.org/OAI/2.0/oai_dc/ + </metadataNamespace> + </metadataFormat> + + <metadataFormat> + <metadataPrefix>dryad</metadataPrefix> + <schema>http://ils.unc.edu/mrc/dryad/version1_0/dryad_1_0.xsd</schema> + <metadataNamespace>http://ils.unc.edu/mrc/dryad/ + </metadataNamespace> + </metadataFormat> + + </ListMetadataFormats> +</OAI-PMH> Added: trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/ListRecords.vm =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/ListRecords.vm (rev 0) +++ trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/ListRecords.vm 2010-04-06 20:37:41 UTC (rev 678) @@ -0,0 +1,9 @@ +#parse("head.vm") +<ListRecords> +#if($!requestParams.metadataPrefix=="oai_dc") +#foreach($record in $recordList) +#parse("oai_dc_record.vm") +#end +#end +</ListRecords> +</OAI-PMH> Added: trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/ListSets.vm =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/ListSets.vm (rev 0) +++ trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/ListSets.vm 2010-04-06 20:37:41 UTC (rev 678) @@ -0,0 +1,3 @@ +#parse("head.vm") + <error code="noSetHierarchy">This repository does not support sets</error> +</OAI-PMH> Added: trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/error.vm =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/error.vm (rev 0) +++ trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/error.vm 2010-04-06 20:37:41 UTC (rev 678) @@ -0,0 +1,3 @@ +#parse("head.vm") +<error code="$!error_code">$!error</error> +</OAI-PMH> Added: trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/head.vm =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/head.vm (rev 0) +++ trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/head.vm 2010-04-06 20:37:41 UTC (rev 678) @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ + http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> +<responseDate>${identify.getResponseDate()}</responseDate> +<request #if($!requestParams.verb)verb="$!requestParams.verb" #end +#if($!requestParams.identifier)identifier="$!requestParams.identifier" #end +#if($!requestParams.metadataPrefix)metadataPrefix="$!requestParams.metadataPrefix" #end +#if($!requestParams.from)from="$!requestParams.from" #end +#if($!requestParams.until)until="$!requestParams.until" #end +#if($!requestParams.resumptionToken)resumptionToken="$!requestParams.resumptionToken" #end +#if($!requestParams.set)set="$!requestParams.set" #end> +$!identify.BaseURL</request> Added: trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/oai_dc_ListIdentifiers.vm =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/oai_dc_ListIdentifiers.vm (rev 0) +++ trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/oai_dc_ListIdentifiers.vm 2010-04-06 20:37:41 UTC (rev 678) @@ -0,0 +1,10 @@ +#parse("head.vm") +<ListIdentifiers> +#foreach ( $record in $recordList) +<header> +<identifier>${record.identifier}</identifier> +<datestamp>$!record.datestamp</datestamp> +</header> +#end +</ListIdentifiers> +</OAI-PMH> Added: trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/oai_dc_record.vm =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/oai_dc_record.vm (rev 0) +++ trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/oai_dc_record.vm 2010-04-06 20:37:41 UTC (rev 678) @@ -0,0 +1,64 @@ +<record> +<header> +<identifier>${record.identifier}</identifier> +<datestamp>$!record.datestamp</datestamp> +</header> +<metadata> +<oai_dc:dc + xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ + http://www.openarchives.org/OAI/2.0/oai_dc.xsd"> +#if($record.title) +<dc:title>${record.title}</dc:title> +#end +#if($record.creator) +#foreach ($person in $record.creator) +<dc:creator>${person.lastName}, ${person.firstName}</dc:creator> +#end +#end +#if($record.subject) +<dc:subject>${record.subject}</dc:subject> +#end +#if($record.description) +<dc:description>${record.description}</dc:description> +#end +#if($record.publisher) +<dc:publisher>${record.publisher}</dc:publisher> +#end +#if($record.contributor) +<dc:contributor>${record.contributor}</dc:contributor> +#end +#if($record.date) +<dc:date>${record.date}</dc:date> +#end +#if($record.type) +<dc:type>${record.type}</dc:type> +#end +#if($record.format) +<dc:format>${record.format}</dc:format> +#end + +#if($record.identifier) +<dc:identifier>${record.identifier}</dc:identifier> +#end + +#if($record.source) +<dc:source>{record.source}</dc:source> +#end +#if($record.language) +<dc:language>${record.language}</dc:language> +#end +#if($record.relation) +<dc:relation>${record.relation}</dc:relation> +#end +#if($record.coverage) +<dc:coverage>${record.coverage}</dc:coverage> +#end +#if($record.rights) +<dc:rights>${record.rights}</dc:rights> +#end +</oai_dc:dc> +</metadata> +</record> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yo...@us...> - 2010-04-07 20:33:15
|
Revision: 679 http://treebase.svn.sourceforge.net/treebase/?rev=679&view=rev Author: youjun Date: 2010-04-07 20:33:07 +0000 (Wed, 07 Apr 2010) Log Message: ----------- template modification on oai-pmh-provider Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/IdentifyUtil.java trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/ListMetadataFormats.vm Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java 2010-04-06 20:37:41 UTC (rev 678) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java 2010-04-07 20:33:07 UTC (rev 679) @@ -232,24 +232,24 @@ List<Person> authors=citation.getAuthors(); - map.put("title", IdentifyUtil.escape4XML(citation.getTitle())); + map.put("title", IdentifyUtil.escape4XML(study.getId(),citation.getTitle())); map.put("creator", authors); - map.put("subject", IdentifyUtil.escape4XML(citation.getKeywords())); + map.put("subject", IdentifyUtil.escape4XML(study.getId(),citation.getKeywords())); if(study.getName()!=null&study.getNotes()!=null) - map.put("description", IdentifyUtil.escape4XML(study.getName()+" "+study.getNotes())); + map.put("description", IdentifyUtil.escape4XML(study.getId(),study.getName()+" "+study.getNotes())); else if(study.getNotes()==null) - map.put("description",IdentifyUtil.escape4XML(study.getName())); + map.put("description",IdentifyUtil.escape4XML(study.getId(),study.getName())); else - map.put("description",IdentifyUtil.escape4XML(study.getNotes())); - map.put("publisher", IdentifyUtil.escape4XML(publisher)); + map.put("description",IdentifyUtil.escape4XML(study.getId(),study.getNotes())); + map.put("publisher", IdentifyUtil.escape4XML(study.getId(),publisher)); map.put("date", "published on "+citation.getPublishYear()); map.put("identifier", "TreeBASE.org/study/TB2:s"+study.getId()); map.put("datestamp", study.getReleaseDate()); - }catch(NullPointerException e){ + }catch(Exception e){ //study 253 citation= null, data should be fixed System.err.println("study "+study.getId()+ - " citation= "+e.getMessage()); + " citation= "+e.toString()); return null; } Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/IdentifyUtil.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/IdentifyUtil.java 2010-04-06 20:37:41 UTC (rev 678) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/IdentifyUtil.java 2010-04-07 20:33:07 UTC (rev 679) @@ -51,32 +51,41 @@ return new Date(utcMiliseconds + cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET)); } - public static String escape4XML(String aText){ - final StringBuilder result = new StringBuilder(); - final StringCharacterIterator iterator = new StringCharacterIterator(aText); - char character = iterator.current(); - while (character != CharacterIterator.DONE ){ - if (character == '<') { + public static String escape4XML(long study_id, String xmlStr){ + if(xmlStr==null)return null; + StringBuilder result = new StringBuilder(); + StringCharacterIterator sci = new StringCharacterIterator(xmlStr); + char c = sci.current(); + while (c != CharacterIterator.DONE ){ + if (c == '<') { result.append("<"); } - else if (character == '>') { + else if (c == '>') { result.append(">"); } - else if (character == '\"') { + else if (c == '\"') { result.append("""); } - else if (character == '\'') { + else if (c == '\'') { result.append("'"); } - else if (character == '&') { + else if (c == '&') { result.append("&"); } else { - //the char is not a special one - //add it to the result as is - result.append(character); + if (!Character.isDefined(c)) { + try { + throw new Exception(); + } catch (Exception e) { + // TODO Auto-generated catch block + System.err.println("study:"+ study_id+" undefined charachter:"+ c + " in " + xmlStr ); + } + + + } + result.append(c); } - character = iterator.next(); + c = sci.next(); } return result.toString(); } Modified: trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/ListMetadataFormats.vm =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/ListMetadataFormats.vm 2010-04-06 20:37:41 UTC (rev 678) +++ trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/ListMetadataFormats.vm 2010-04-07 20:33:07 UTC (rev 679) @@ -2,17 +2,14 @@ <ListMetadataFormats> <metadataFormat> <metadataPrefix>oai_dc</metadataPrefix> - <schema>http://www.openarchives.org/OAI/2.0/oai_dc.xsd - </schema> - <metadataNamespace>http://www.openarchives.org/OAI/2.0/oai_dc/ - </metadataNamespace> + <schema>http://www.openarchives.org/OAI/2.0/oai_dc.xsd</schema> + <metadataNamespace>http://www.openarchives.org/OAI/2.0/oai_dc/</metadataNamespace> </metadataFormat> <metadataFormat> <metadataPrefix>dryad</metadataPrefix> <schema>http://ils.unc.edu/mrc/dryad/version1_0/dryad_1_0.xsd</schema> - <metadataNamespace>http://ils.unc.edu/mrc/dryad/ - </metadataNamespace> + <metadataNamespace>http://ils.unc.edu/mrc/dryad/</metadataNamespace> </metadataFormat> </ListMetadataFormats> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yo...@us...> - 2010-04-22 18:29:39
|
Revision: 693 http://treebase.svn.sourceforge.net/treebase/?rev=693&view=rev Author: youjun Date: 2010-04-22 18:29:32 +0000 (Thu, 22 Apr 2010) Log Message: ----------- fix: Analysis download scrambles taxon labels - ID: 2970700 Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadAnAnalysisStepController.java trunk/treebase-web/src/main/webapp/WEB-INF/pages/algorithm.jsp trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/analysis.jsp Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadAnAnalysisStepController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadAnAnalysisStepController.java 2010-04-22 18:28:28 UTC (rev 692) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadAnAnalysisStepController.java 2010-04-22 18:29:32 UTC (rev 693) @@ -140,7 +140,7 @@ PhyloTree tree = data.getTreeData(); Matrix matrix = data.getMatrixData(); if ( tree != null ) { - tree.getTreeBlock().setTaxonLabelSet(inputLabelSet); + tree.getTreeBlock().setTaxonLabelSet(inputLabelSet); tree.buildNexusBlock(stepContent); } if ( matrix != null ) { @@ -152,7 +152,7 @@ stepContent.append("[ The following blocks are output data for analysis step " + analysisId + " ]\n"); TaxonLabelSet outputLabelSet = step.getOutputTaxonLabelSet(); - outputLabelSet.buildNexusBlockTaxa(stepContent, true, false); + //outputLabelSet.buildNexusBlockTaxa(stepContent, true, false); for ( AnalyzedData data : step.getDataSetReadOnly() ) { if ( ! data.isInputData() ) { PhyloTree tree = data.getTreeData(); Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/algorithm.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/algorithm.jsp 2010-04-22 18:28:28 UTC (rev 692) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/algorithm.jsp 2010-04-22 18:29:32 UTC (rev 693) @@ -45,7 +45,7 @@ alt="<fmt:message key="analysis.notvalidated"/>"/> </span> <!-- VG 2010-03-17 Disabled analysis download as requested in #2972107, to mitigate #2970700 and #2970457 --> -<!-- <a href="/treebase-web/search/downloadAnAnalysisStep.html?analysisid=${analysisStepCommand.id}&id=${analysisStepCommand.analysis.study.id}"> --> + <a href="/treebase-web/search/downloadAnAnalysisStep.html?analysisid=${analysisStepCommand.id}&id=${analysisStepCommand.analysis.study.id}"> <img class="iconButton" src="<fmt:message key="icons.download.reconstructed"/>" @@ -56,7 +56,7 @@ title="<fmt:message key="download.unavailable"/>" alt="<fmt:message key="download.unavailable"/>" /> -<!-- </a> --> + </a> <c:if test="${not empty analysisStepCommand.displayName}"> <c:out value="${analysisStepCommand.displayName}"/> </c:if> Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/analysis.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/analysis.jsp 2010-04-22 18:28:28 UTC (rev 692) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/analysis.jsp 2010-04-22 18:29:32 UTC (rev 693) @@ -48,13 +48,13 @@ border="0" onClick="CollapseExpand('${AnalysisStepId}')"/> <!-- commented out due to issue# 2970700 and issue# 2970457 --> - <!-- <a href="/treebase-web/search/downloadAnAnalysisStep.html?analysisid=${analysisStep.id}"> --> + <a href="/treebase-web/search/downloadAnAnalysisStep.html?analysisid=${analysisStep.id}"> <img class="iconButton" src="<fmt:message key="icons.download.reconstructed"/>" title="<fmt:message key="download.reconstructedfile"/>" alt="<fmt:message key="download.reconstructedfile"/>"/> - <!-- </a> --> + </a> <strong>Analysis Step ${status_analysisStep.count}:</strong> <c:out value="${analysisStepCommand.name}" /> </li> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yo...@us...> - 2010-07-07 20:08:39
|
Revision: 730 http://treebase.svn.sourceforge.net/treebase/?rev=730&view=rev Author: youjun Date: 2010-07-07 19:32:38 +0000 (Wed, 07 Jul 2010) Log Message: ----------- handshacking web path Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ProcessUserController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudyFormController.java trunk/treebase-web/src/main/webapp/WEB-INF/pages/loginForm.jsp trunk/treebase-web/src/main/webapp/WEB-INF/pages/submissionList.jsp Added Paths: ----------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/DryadUtil.java Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ProcessUserController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ProcessUserController.java 2010-07-02 16:30:32 UTC (rev 729) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ProcessUserController.java 2010-07-07 19:32:38 UTC (rev 730) @@ -21,7 +21,11 @@ public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { + String importKey = (String)request.getSession().getAttribute("importKey"); + if (importKey != null && importKey.length()>0) { + return new ModelAndView("redirect:/user/studyForm.html"); + } if (request.isUserInRole(UserRole.ROLE_ADMIN) || request.isUserInRole(UserRole.ROLE_ASSO_EDITOR)) { return new ModelAndView("redirect:/admin/administrationPage.html"); Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudyFormController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudyFormController.java 2010-07-02 16:30:32 UTC (rev 729) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudyFormController.java 2010-07-07 19:32:38 UTC (rev 730) @@ -1,6 +1,9 @@ package org.cipres.treebase.web.controllers; +import java.io.File; +import java.util.Collection; + import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -14,12 +17,15 @@ import org.cipres.treebase.domain.admin.User; import org.cipres.treebase.domain.admin.UserService; +import org.cipres.treebase.domain.study.Citation; import org.cipres.treebase.domain.study.Study; import org.cipres.treebase.domain.study.StudyService; import org.cipres.treebase.domain.study.Submission; import org.cipres.treebase.domain.study.SubmissionService; import org.cipres.treebase.web.Constants; +import org.cipres.treebase.web.model.MyProgressionListener; import org.cipres.treebase.web.util.ControllerUtil; +import org.cipres.treebase.web.util.DryadUtil; /** * StudyFormController.java @@ -96,7 +102,9 @@ Study study = (Study) command; User user = ControllerUtil.getUser(request, mUserService); - + String importKey = (String)request.getSession().getAttribute("importKey"); + request.getSession().removeAttribute("importKey"); + if (request.getParameter(ACTION_SUBMIT) != null) { // Study must be submitted with citation together // here we are just saving the data to the session @@ -118,7 +126,38 @@ // save Study object to session and remove ControllerUtil.saveStudy(request, submission.getStudy()); - } else if (request.getParameter(ACTION_UPDATE) != null) { + } else if(importKey != null && importKey.length()>0){ + + String uploadDir = getServletContext() + .getRealPath(TreebaseUtil.FILESEP + "DryadUpload") + + TreebaseUtil.FILESEP + importKey; + String importStatus=""; + File bagitPath= new File(uploadDir, "data"); + if(!bagitPath.exists())importStatus = "NOT FOUND"; + else{ + + try{ + Submission submission = mSubmissionService.createSubmission(user, new Study()); + + Citation citation = DryadUtil.createCitation(bagitPath); + submission.getStudy().setCitation(citation); + citation.setStudy(submission.getStudy()); + + Collection<File> files = DryadUtil.getDataFiles(bagitPath); + MyProgressionListener listener = new MyProgressionListener(); + getSubmissionService().addNexusFilesJDBC(submission, files, listener); + // save Study object to session + ControllerUtil.saveStudy(request, submission.getStudy()); + importStatus = "OK"; + }catch (Exception e) { + importStatus = "FAILED"; + } + } + request.setAttribute("importStatus", importStatus); + //request.getSession().removeAttribute("importKey"); + return new ModelAndView(new RedirectView("submissionList.html")); + + }else if (request.getParameter(ACTION_UPDATE) != null) { mStudyService.update(study); } else if (request.getParameter(ACTION_DELETE) != null) { Added: trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/DryadUtil.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/DryadUtil.java (rev 0) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/DryadUtil.java 2010-07-07 19:32:38 UTC (rev 730) @@ -0,0 +1,54 @@ +package org.cipres.treebase.web.util; + +import java.io.File; +import java.io.FilenameFilter; +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import org.cipres.treebase.domain.admin.Person; +import org.cipres.treebase.domain.study.Citation; +import org.dom4j.*; +import org.dom4j.io.*; + +public class DryadUtil { + + + public static Citation createCitation(File path){ + Citation citation = new Citation(); + + File f = new File(path, "citation.xml"); + SAXReader reader = new SAXReader(); + Document doc= null ; + try { + doc = reader.read(f); + } catch (DocumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Element root = doc.getRootElement(); + Element node; + for (Iterator i = root.elementIterator("author"); i.hasNext();) { + node = (Element) i.next(); + Person p = new Person(); + //node.getName(); + citation.addAuthor(p); + } + citation.setTitle(root.element("title").getName()); + + + return citation; + } + + public static Collection<File> getDataFiles(File path) { + // TODO Auto-generated method stub + List<File> flist=Arrays.asList(path.listFiles(new FilenameFilter() { + public boolean accept(File file, String name) { + boolean ret = !(name.endsWith("xml")); + return ret; + }})); + return flist; + } + +} Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/loginForm.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/loginForm.jsp 2010-07-02 16:30:32 UTC (rev 729) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/loginForm.jsp 2010-07-07 19:32:38 UTC (rev 730) @@ -2,6 +2,13 @@ <form method="post" id="loginForm" action="<c:url value="/j_security_check"/>" > +<% + if(request.getParameter("importKey") != null){ + + session.setAttribute("importKey",request.getParameter("importKey")); + } +%> + <fieldset> <legend>Login</legend> Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/submissionList.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/submissionList.jsp 2010-07-02 16:30:32 UTC (rev 729) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/submissionList.jsp 2010-07-07 19:32:38 UTC (rev 730) @@ -101,7 +101,19 @@ </display:footer> <display:setProperty name="basic.empty.showtable" value="true"/> - + </display:table> </fieldset> +<fieldset> +<legend>Dryad Import Result +<a href="#" class="openHelp" onclick="openHelp('dryadImport')"><img class="iconButton" src="<fmt:message key="icons.help"/>" /></a> +</legend> + <div align="center"> + <c:choose> + <c:when test="${importStatus =='NOT FOUND'}"><c:out value="Sorry, we cannot find your data"/></c:when> + <c:when test="${importStatus =='OK'}"><c:out value="Import finished"/></c:when> + <c:when test="${importStatus =='FAILED'}"><c:out value="Sorry, One or more data file cannot parsed correctly, you may add your data via treebase interfaces"/></c:when> + </c:choose> + </div> +</fieldset> </form> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yo...@us...> - 2010-07-14 02:17:04
|
Revision: 732 http://treebase.svn.sourceforge.net/treebase/?rev=732&view=rev Author: youjun Date: 2010-07-14 02:16:55 +0000 (Wed, 14 Jul 2010) Log Message: ----------- handshaking page, controller, util Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ProcessUserController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudyFormController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/DryadUtil.java trunk/treebase-web/src/main/webapp/WEB-INF/pages/loginForm.jsp Added Paths: ----------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/CitationParser.java Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ProcessUserController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ProcessUserController.java 2010-07-13 16:38:00 UTC (rev 731) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ProcessUserController.java 2010-07-14 02:16:55 UTC (rev 732) @@ -21,7 +21,12 @@ public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { - String importKey = (String)request.getSession().getAttribute("importKey"); + String importKey = null; + if(request.getParameter("importKey") != null){ + importKey = (String)request.getAttribute("importKey"); + request.getSession().setAttribute("importKey",importKey); + } + if (importKey != null && importKey.length()>0) { return new ModelAndView("redirect:/user/studyForm.html"); Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudyFormController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudyFormController.java 2010-07-13 16:38:00 UTC (rev 731) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudyFormController.java 2010-07-14 02:16:55 UTC (rev 732) @@ -2,6 +2,7 @@ package org.cipres.treebase.web.controllers; import java.io.File; +import java.io.FileFilter; import java.util.Collection; import javax.servlet.ServletException; @@ -127,32 +128,41 @@ ControllerUtil.saveStudy(request, submission.getStudy()); } else if(importKey != null && importKey.length()>0){ - - String uploadDir = getServletContext() - .getRealPath(TreebaseUtil.FILESEP + "DryadUpload") - + TreebaseUtil.FILESEP + importKey; + String uploadpath = getServletContext() + .getRealPath(TreebaseUtil.FILESEP + "DryadFileUpload") + + TreebaseUtil.FILESEP + importKey; String importStatus=""; - File bagitPath= new File(uploadDir, "data"); - if(!bagitPath.exists())importStatus = "NOT FOUND"; - else{ - try{ + File uploadDir=new File(uploadpath); + if(!uploadDir.exists()){ + importStatus = "NOT FOUND"; + return new ModelAndView(new RedirectView("submissionList.html")); + } + + File[] uploadFiles = uploadDir.listFiles(new FileFilter(){public boolean accept(File file){return file.isDirectory();}}); + if(uploadDir.length()==0){ + importStatus = "NOT FOUND"; + return new ModelAndView(new RedirectView("submissionList.html")); + } + File bagitPath = uploadFiles[0]; + File dataPath = new File(bagitPath, "data"); + + try{ Submission submission = mSubmissionService.createSubmission(user, new Study()); - - Citation citation = DryadUtil.createCitation(bagitPath); + Citation citation = DryadUtil.createCitation(dataPath); submission.getStudy().setCitation(citation); citation.setStudy(submission.getStudy()); - Collection<File> files = DryadUtil.getDataFiles(bagitPath); + Collection<File> files = DryadUtil.getDataFiles(dataPath); MyProgressionListener listener = new MyProgressionListener(); getSubmissionService().addNexusFilesJDBC(submission, files, listener); // save Study object to session ControllerUtil.saveStudy(request, submission.getStudy()); importStatus = "OK"; - }catch (Exception e) { + }catch (Exception e) { importStatus = "FAILED"; - } } + request.setAttribute("importStatus", importStatus); //request.getSession().removeAttribute("importKey"); return new ModelAndView(new RedirectView("submissionList.html")); Added: trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/CitationParser.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/CitationParser.java (rev 0) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/CitationParser.java 2010-07-14 02:16:55 UTC (rev 732) @@ -0,0 +1,93 @@ +package org.cipres.treebase.web.util; + +import java.io.File; +import java.util.List; + +import org.cipres.treebase.domain.study.ArticleCitation; +import org.cipres.treebase.domain.study.Citation; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.Namespace; +import org.dom4j.Node; +import org.dom4j.QName; +import org.dom4j.io.SAXReader; + +public class CitationParser { + + private static final Namespace xs = new Namespace("xs","http://www.w3.org/2001/XMLSchema"); + private static final Namespace dwc= new Namespace("dwc", "http://rs.tdwg.org/dwc/terms/"); + private static final Namespace dcterms= new Namespace("dcterms", "http://purl.org/dc/terms/"); + private static final Namespace prism= new Namespace("prism", "http://prismstandard.org/namespaces/basic/2.0/"); + + private ArticleCitation citation; + private Element pubRoot; + private Element pkgRoot; + + + public CitationParser(File path){ + + citation = new ArticleCitation(); + + File pubFile = new File(path, "dryadpub.xml"); + SAXReader pubReader = new SAXReader(); + Document pubDoc= null ; + try { + pubDoc = pubReader.read(pubFile); + pubRoot = pubDoc.getRootElement(); + } catch (DocumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + File pkgFile = new File(path, "dryadpkg.xml"); + SAXReader pkgReader = new SAXReader(); + Document pkgDoc= null ; + try { + pkgDoc = pkgReader.read(pkgFile); + pkgRoot = pkgDoc.getRootElement(); + } catch (DocumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + loadData(); + } + + + private void loadData(){ + + citation.setAbstract(getNode(pubRoot,"description",dcterms).getText()); + citation.setDoi(getNode(pubRoot,"identifier",dcterms).getText());; + + citation.setTitle(getNode(pubRoot,"title",dcterms).getText()); + citation.setIssue(getNode(pubRoot,"issueIdentifier",prism).getText()); + citation.setJournal(getNode(pubRoot,"publicationName",prism).getText()); + citation.setVolume(getNode(pubRoot,"volume",prism).getText()); + citation.setPages(getNode(pubRoot,":pageRange",prism).getText()); + + //citation.setKeywords(getNode(pubRoot,"description",dcterms).getText()); + //citation.setAuthors(pAuthors); + + //citation.setPublishYear(getNode(pubRoot,"issued",dcterms).getText()); + //citation.setPublished(getNode(pubRoot,"description",dcterms).getText()); + + } + + private Node getNode(Element root, String localName, Namespace namespace){ + + return root.element(new QName(localName, namespace)); + } + + private List<Node> getNodes(Element root, String localName, Namespace namespace){ + + return root.elements(new QName(localName, namespace)); + } + + + public Citation getCitation() { + return citation; + } + +} Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/DryadUtil.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/DryadUtil.java 2010-07-13 16:38:00 UTC (rev 731) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/DryadUtil.java 2010-07-14 02:16:55 UTC (rev 732) @@ -15,6 +15,7 @@ public class DryadUtil { + public static Citation createCitation(File path){ Citation citation = new Citation(); Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/loginForm.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/loginForm.jsp 2010-07-13 16:38:00 UTC (rev 731) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/loginForm.jsp 2010-07-14 02:16:55 UTC (rev 732) @@ -2,13 +2,15 @@ <form method="post" id="loginForm" action="<c:url value="/j_security_check"/>" > +<!-- <% if(request.getParameter("importKey") != null){ session.setAttribute("importKey",request.getParameter("importKey")); } %> - +--> + <fieldset> <legend>Login</legend> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yo...@us...> - 2010-07-15 00:16:28
|
Revision: 734 http://treebase.svn.sourceforge.net/treebase/?rev=734&view=rev Author: youjun Date: 2010-07-15 00:13:45 +0000 (Thu, 15 Jul 2010) Log Message: ----------- Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudyFormController.java trunk/treebase-web/src/main/webapp/WEB-INF/pages/loginForm.jsp Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudyFormController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudyFormController.java 2010-07-14 20:45:11 UTC (rev 733) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudyFormController.java 2010-07-15 00:13:45 UTC (rev 734) @@ -105,7 +105,7 @@ Study study = (Study) command; User user = ControllerUtil.getUser(request, mUserService); String importKey = (String)request.getSession().getAttribute("importKey"); - request.getSession().removeAttribute("importKey"); + //request.getSession().removeAttribute("importKey"); if(importKey != null && importKey.length()>0){ String uploadpath = getServletContext() Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/loginForm.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/loginForm.jsp 2010-07-14 20:45:11 UTC (rev 733) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/loginForm.jsp 2010-07-15 00:13:45 UTC (rev 734) @@ -2,14 +2,14 @@ <form method="post" id="loginForm" action="<c:url value="/j_security_check"/>" > -<!-- + <% if(request.getParameter("importKey") != null){ session.setAttribute("importKey",request.getParameter("importKey")); } %> ---> + <fieldset> <legend>Login</legend> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yo...@us...> - 2010-07-15 20:52:04
|
Revision: 735 http://treebase.svn.sourceforge.net/treebase/?rev=735&view=rev Author: youjun Date: 2010-07-15 20:51:58 +0000 (Thu, 15 Jul 2010) Log Message: ----------- handshaking add new citation object to a user Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ProcessUserController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudyFormController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/CitationParser.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/DryadUtil.java trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ProcessUserController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ProcessUserController.java 2010-07-15 00:13:45 UTC (rev 734) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ProcessUserController.java 2010-07-15 20:51:58 UTC (rev 735) @@ -1,13 +1,30 @@ package org.cipres.treebase.web.controllers; +import java.io.File; +import java.io.FileFilter; +import java.util.Collection; +import java.util.List; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.Controller; +import org.springframework.web.servlet.view.RedirectView; +import org.cipres.treebase.TreebaseUtil; +import org.cipres.treebase.domain.admin.User; import org.cipres.treebase.domain.admin.UserRole; +import org.cipres.treebase.domain.admin.UserService; +import org.cipres.treebase.domain.study.Citation; +import org.cipres.treebase.domain.study.Study; +import org.cipres.treebase.domain.study.Submission; +import org.cipres.treebase.domain.study.SubmissionService; +import org.cipres.treebase.web.model.MyProgressionListener; +import org.cipres.treebase.web.util.CitationParser; +import org.cipres.treebase.web.util.ControllerUtil; +import org.cipres.treebase.web.util.DryadUtil; /** * @author madhu @@ -16,17 +33,86 @@ * */ public class ProcessUserController implements Controller { + private SubmissionService mSubmissionService; + private UserService mUserService; + + public UserService getUserService() { + return mUserService; + } + public void setUserService(UserService mUserService) { + this.mUserService = mUserService; + } + + public SubmissionService getSubmissionService() { + return mSubmissionService; + } + + public void setSubmissionService(SubmissionService mSubmissionService) { + this.mSubmissionService = mSubmissionService; + } + private static final Logger LOGGER = Logger.getLogger(ProcessUserController.class); public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { + String importKey = (String)request.getSession().getAttribute("importKey"); + User user = ControllerUtil.getUser(request, mUserService); - if (importKey != null && importKey.length()>0) { - - return new ModelAndView("redirect:/user/studyForm.html"); - } + if(importKey != null && importKey.length()>0){ + + String uploadpath = request.getSession().getServletContext() + .getRealPath(TreebaseUtil.FILESEP + "DryadFileUpload") + + TreebaseUtil.FILESEP + importKey; + String importStatus=""; + + File uploadDir=new File(uploadpath); + if(!uploadDir.exists()){ + importStatus = "NOT FOUND"; + request.setAttribute("importStatus", importStatus); + return new ModelAndView("redirect:/user/submissionList.html"); + } + + File[] uploadFiles = uploadDir.listFiles(new FileFilter(){public boolean accept(File file){return file.isDirectory();}}); + if(uploadFiles.length==0){ + importStatus = "NOT FOUND"; + request.setAttribute("importStatus", importStatus); + return new ModelAndView("redirect:/user/submissionList.html"); + } + File bagitPath = uploadFiles[0]; + File dataPath = new File(bagitPath, "data"); + + try{ + CitationParser cparser= new CitationParser(dataPath); + Citation citation = cparser.getCitation(); + Study study = new Study(); + + study.setCitation(citation); + citation.setStudy(study); + Submission submission = mSubmissionService.createSubmission(user, study); + + List<File> files = DryadUtil.getDataFiles(dataPath); + for(int i=0; i<files.size(); i++ ) + submission.getStudy().addNexusFile(files.get(i).getName(), "NEXUS"); + MyProgressionListener listener = new MyProgressionListener(); + //getSubmissionService().addNexusFilesJDBC(submission, files, listener); + + // save Study object to session + //mSubmissionService.save(submission); + mSubmissionService.save(study); + //mSubmissionService.save(citation); + + importStatus = "OK"; + }catch (Exception e) { + importStatus = "FAILED"; + } + + request.setAttribute("importStatus", importStatus); + request.getSession().removeAttribute("importKey"); + return new ModelAndView("redirect:/user/submissionList.html"); + + } if (request.isUserInRole(UserRole.ROLE_ADMIN) || request.isUserInRole(UserRole.ROLE_ASSO_EDITOR)) { return new ModelAndView("redirect:/admin/administrationPage.html"); Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudyFormController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudyFormController.java 2010-07-15 00:13:45 UTC (rev 734) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudyFormController.java 2010-07-15 20:51:58 UTC (rev 735) @@ -1,33 +1,24 @@ package org.cipres.treebase.web.controllers; -import java.io.File; -import java.io.FileFilter; -import java.util.Collection; - import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.cipres.treebase.TreebaseUtil; import org.apache.log4j.Logger; -import org.springframework.validation.BindException; -import org.springframework.web.bind.ServletRequestUtils; -import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.view.RedirectView; - +import org.cipres.treebase.TreebaseUtil; import org.cipres.treebase.domain.admin.User; import org.cipres.treebase.domain.admin.UserService; -import org.cipres.treebase.domain.study.Citation; import org.cipres.treebase.domain.study.Study; import org.cipres.treebase.domain.study.StudyService; import org.cipres.treebase.domain.study.Submission; import org.cipres.treebase.domain.study.SubmissionService; import org.cipres.treebase.web.Constants; -import org.cipres.treebase.web.model.MyProgressionListener; -import org.cipres.treebase.web.util.CitationParser; import org.cipres.treebase.web.util.ControllerUtil; -import org.cipres.treebase.web.util.DryadUtil; +import org.springframework.validation.BindException; +import org.springframework.web.bind.ServletRequestUtils; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.view.RedirectView; /** * StudyFormController.java @@ -104,54 +95,7 @@ Study study = (Study) command; User user = ControllerUtil.getUser(request, mUserService); - String importKey = (String)request.getSession().getAttribute("importKey"); - //request.getSession().removeAttribute("importKey"); - if(importKey != null && importKey.length()>0){ - String uploadpath = getServletContext() - .getRealPath(TreebaseUtil.FILESEP + "DryadFileUpload") - + TreebaseUtil.FILESEP + importKey; - String importStatus=""; - - File uploadDir=new File(uploadpath); - if(!uploadDir.exists()){ - importStatus = "NOT FOUND"; - return new ModelAndView(new RedirectView("submissionList.html")); - } - - File[] uploadFiles = uploadDir.listFiles(new FileFilter(){public boolean accept(File file){return file.isDirectory();}}); - if(uploadDir.length()==0){ - importStatus = "NOT FOUND"; - return new ModelAndView(new RedirectView("submissionList.html")); - } - File bagitPath = uploadFiles[0]; - File dataPath = new File(bagitPath, "data"); - - try{ - Submission submission = mSubmissionService.createSubmission(user, new Study()); - CitationParser cparser= new CitationParser(dataPath); - Citation citation = cparser.getCitation(); - submission.getStudy().setCitation(citation); - citation.setStudy(submission.getStudy()); - - Collection<File> files = DryadUtil.getDataFiles(dataPath); - MyProgressionListener listener = new MyProgressionListener(); - //getSubmissionService().addNexusFilesJDBC(submission, files, listener); - // save Study object to session - ControllerUtil.saveStudy(request, submission.getStudy()); - importStatus = "OK"; - }catch (Exception e) { - importStatus = "FAILED"; - } - - request.setAttribute("importStatus", importStatus); - //request.getSession().removeAttribute("importKey"); - return new ModelAndView(new RedirectView("submissionList.html")); - - } - - - if (request.getParameter(ACTION_SUBMIT) != null) { // Study must be submitted with citation together // here we are just saving the data to the session @@ -214,10 +158,7 @@ request.getSession().removeAttribute(Constants.STUDY_MAP); return new Study(); } - - if(request.getSession().getAttribute("importKey") != null) - return new Study(); - + // if we are updating a data that's already in the db (access from RHS menu) study = ControllerUtil.findStudy(request, mStudyService); return study; Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/CitationParser.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/CitationParser.java 2010-07-15 00:13:45 UTC (rev 734) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/CitationParser.java 2010-07-15 20:51:58 UTC (rev 735) @@ -56,7 +56,7 @@ private void loadData(){ - + Node description = getNode(pubRoot,"description",dcterms); if(description!=null)citation.setAbstract(description.getText()); @@ -104,11 +104,12 @@ } - if(getNode(pubRoot,"pubStatus",null).getText()!=null){ + if(getNode(pubRoot,"pubStatus",null)!=null){ if("published".compareToIgnoreCase(getNode(pubRoot,"pubStatus",null).getText())==0) citation.setPublished(true); else citation.setPublished(false); - } + } + } private Node getNode(Element root, String localName, Namespace namespace){ Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/DryadUtil.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/DryadUtil.java 2010-07-15 00:13:45 UTC (rev 734) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/DryadUtil.java 2010-07-15 20:51:58 UTC (rev 735) @@ -16,7 +16,7 @@ public class DryadUtil { - public static Collection<File> getDataFiles(File path) { + public static List<File> getDataFiles(File path) { // TODO Auto-generated method stub File[] files = path.listFiles(new FileFilter() { public boolean accept(File file) { Modified: trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2010-07-15 00:13:45 UTC (rev 734) +++ trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2010-07-15 20:51:58 UTC (rev 735) @@ -21,8 +21,10 @@ <!-- LIST OF CONTROLLERS FOR WEB-TIER --> <!-- ========================================================== --> - <bean id="processUserController" class="org.cipres.treebase.web.controllers.ProcessUserController"/> - + <bean id="processUserController" class="org.cipres.treebase.web.controllers.ProcessUserController"> + <property name="submissionService"><ref bean="submissionService"></ref></property> + <property name="userService"><ref bean="userService"></ref></property> + </bean> <bean id="anyObjectAsRDFController" class="org.cipres.treebase.web.controllers.AnyObjectAsRDFController"> <property name="studyService"><ref bean="studyService"></ref></property> </bean> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yo...@us...> - 2010-07-16 02:32:14
|
Revision: 738 http://treebase.svn.sourceforge.net/treebase/?rev=738&view=rev Author: youjun Date: 2010-07-16 02:32:08 +0000 (Fri, 16 Jul 2010) Log Message: ----------- Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ProcessUserController.java trunk/treebase-web/src/main/webapp/WEB-INF/pages/submissionList.jsp Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ProcessUserController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ProcessUserController.java 2010-07-16 01:36:17 UTC (rev 737) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ProcessUserController.java 2010-07-16 02:32:08 UTC (rev 738) @@ -70,14 +70,14 @@ File uploadDir=new File(uploadpath); if(!uploadDir.exists()){ importStatus = "NOT FOUND"; - request.setAttribute("importStatus", importStatus); + request.getSession().setAttribute("importStatus", importStatus); return new ModelAndView("redirect:/user/submissionList.html"); } File[] uploadFiles = uploadDir.listFiles(new FileFilter(){public boolean accept(File file){return file.isDirectory();}}); if(uploadFiles.length==0){ importStatus = "NOT FOUND"; - request.setAttribute("importStatus", importStatus); + request.getSession().setAttribute("importStatus", importStatus); return new ModelAndView("redirect:/user/submissionList.html"); } File bagitPath = uploadFiles[0]; @@ -108,7 +108,7 @@ importStatus = "FAILED"; } - request.setAttribute("importStatus", importStatus); + request.getSession().setAttribute("importStatus", importStatus); request.getSession().removeAttribute("importKey"); return new ModelAndView("redirect:/user/submissionList.html"); Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/submissionList.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/submissionList.jsp 2010-07-16 01:36:17 UTC (rev 737) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/submissionList.jsp 2010-07-16 02:32:08 UTC (rev 738) @@ -105,14 +105,14 @@ </display:table> </fieldset> <fieldset> -<legend>Dryad Import Result +<legend>Dryad Import Result: <a href="#" class="openHelp" onclick="openHelp('dryadImport')"><img class="iconButton" src="<fmt:message key="icons.help"/>" /></a> </legend> <div align="center"> <c:choose> - <c:when test="${importStatus =='NOT FOUND'}"><c:out value="Sorry, we cannot find your data"/></c:when> - <c:when test="${importStatus =='OK'}"><c:out value="Import finished"/></c:when> - <c:when test="${importStatus =='FAILED'}"><c:out value="Sorry, One or more data file cannot parsed correctly, you may add your data via treebase interfaces"/></c:when> + <c:when test="${sessionScope.importStatus =='NOT FOUND'}"><c:out value="Sorry, we cannot find your data"/></c:when> + <c:when test="${sessionScope.importStatus =='OK'}"><c:out value="Import finished"/></c:when> + <c:when test="${sessionScope.importStatus =='FAILED'}"><c:out value="Sorry, One or more data file cannot parsed correctly, you may add your data via treebase interfaces"/></c:when> </c:choose> </div> </fieldset> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vga...@us...> - 2010-11-18 15:46:13
|
Revision: 760 http://treebase.svn.sourceforge.net/treebase/?rev=760&view=rev Author: vgapeyev Date: 2010-11-18 15:46:06 +0000 (Thu, 18 Nov 2010) Log Message: ----------- Fixing SF:3079602 (multiple keywords into multiple <dc:subject> elements) Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/oai_dc_record.vm Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java 2010-11-15 15:38:56 UTC (rev 759) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java 2010-11-18 15:46:06 UTC (rev 760) @@ -6,6 +6,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.StringTokenizer; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -233,8 +234,10 @@ map.put("title", IdentifyUtil.escape4XML(study.getId(),citation.getTitle())); - map.put("creator", authors); - map.put("subject", IdentifyUtil.escape4XML(study.getId(),citation.getKeywords())); + map.put("creator", authors); + //VG 2010-11-17 fixing SF:3079602 (multiple keywords into multiple <dc:subject> elements) + //--map.put("subject", IdentifyUtil.escape4XML(study.getId(),citation.getKeywords())); + map.put("subject", splitKeywords(study.getId(),citation.getKeywords())); if(study.getName()!=null&study.getNotes()!=null) map.put("description", IdentifyUtil.escape4XML(study.getId(),study.getName()+" "+study.getNotes())); else if(study.getNotes()==null) @@ -263,6 +266,21 @@ return map; } + //VG 2010-11-17 fixing SF:3079602 (multiple keywords into multiple <dc:subject> elements) + private List<String> splitKeywords(long study_id, String kwstring) { + List<String> kwlist = new java.util.ArrayList<String>(); + if (null == kwstring) return kwlist; + StringTokenizer tokenizer = new StringTokenizer(kwstring, ",;"); + while (tokenizer.hasMoreTokens()) { + String token = tokenizer.nextToken().trim(); + if (!token.equals("")) { + kwlist.add(IdentifyUtil.escape4XML(study_id, token)); + } + } + return kwlist; + } + + private List getRecordList(List<Submission> sList) { List recordList=new ArrayList<Map>(); Modified: trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/oai_dc_record.vm =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/oai_dc_record.vm 2010-11-15 15:38:56 UTC (rev 759) +++ trunk/treebase-web/src/main/webapp/WEB-INF/vmFiles/oai_dc_record.vm 2010-11-18 15:46:06 UTC (rev 760) @@ -18,9 +18,18 @@ <dc:creator>${person.lastName}, ${person.firstName}</dc:creator> #end #end +## VG 2010-11-17 fixing SF:3079602 (multiple keywords into multiple <dc:subject> elements) +#*-- #if($record.subject) <dc:subject>${record.subject}</dc:subject> #end +*# +#if($record.subject) +#foreach ($keyword in $record.subject) +<dc:subject>${keyword}</dc:subject> +#end +#end +## end VG 2010-11-17 #if($record.description) <dc:description>${record.description}</dc:description> #end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2011-04-25 18:46:19
|
Revision: 800 http://treebase.svn.sourceforge.net/treebase/?rev=800&view=rev Author: rvos Date: 2011-04-25 18:46:13 +0000 (Mon, 25 Apr 2011) Log Message: ----------- Adding empty PhyloWS sub-controllers Modified Paths: -------------- trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml Added Paths: ----------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSMatrixController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSStudyController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTaxonController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTreeController.java Added: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSMatrixController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSMatrixController.java (rev 0) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSMatrixController.java 2011-04-25 18:46:13 UTC (rev 800) @@ -0,0 +1,5 @@ +package org.cipres.treebase.web.controllers; + +public class PhyloWSMatrixController extends PhyloWSController { + +} Added: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSStudyController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSStudyController.java (rev 0) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSStudyController.java 2011-04-25 18:46:13 UTC (rev 800) @@ -0,0 +1,5 @@ +package org.cipres.treebase.web.controllers; + +public class PhyloWSStudyController extends PhyloWSController { + +} Added: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTaxonController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTaxonController.java (rev 0) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTaxonController.java 2011-04-25 18:46:13 UTC (rev 800) @@ -0,0 +1,5 @@ +package org.cipres.treebase.web.controllers; + +public class PhyloWSTaxonController extends PhyloWSController { + +} Added: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTreeController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTreeController.java (rev 0) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTreeController.java 2011-04-25 18:46:13 UTC (rev 800) @@ -0,0 +1,5 @@ +package org.cipres.treebase.web.controllers; + +public class PhyloWSTreeController extends PhyloWSController { + +} Modified: trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2011-04-22 14:33:09 UTC (rev 799) +++ trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2011-04-25 18:46:13 UTC (rev 800) @@ -47,6 +47,30 @@ <property name="phyloTreeService"><ref bean="phyloTreeService"></ref></property> <property name="studyService"><ref bean="studyService"></ref></property> </bean> + + <bean id="phyloWSStudyController" class="org.cipres.treebase.web.controllers.PhyloWSStudyController"> + <property name="matrixService"><ref bean="matrixService"></ref></property> + <property name="phyloTreeService"><ref bean="phyloTreeService"></ref></property> + <property name="studyService"><ref bean="studyService"></ref></property> + </bean> + + <bean id="phyloWSTaxonController" class="org.cipres.treebase.web.controllers.PhyloWSTaxonController"> + <property name="matrixService"><ref bean="matrixService"></ref></property> + <property name="phyloTreeService"><ref bean="phyloTreeService"></ref></property> + <property name="studyService"><ref bean="studyService"></ref></property> + </bean> + + <bean id="phyloWSMatrixController" class="org.cipres.treebase.web.controllers.PhyloWSMatrixController"> + <property name="matrixService"><ref bean="matrixService"></ref></property> + <property name="phyloTreeService"><ref bean="phyloTreeService"></ref></property> + <property name="studyService"><ref bean="studyService"></ref></property> + </bean> + + <bean id="phyloWSTreeController" class="org.cipres.treebase.web.controllers.PhyloWSTreeController"> + <property name="matrixService"><ref bean="matrixService"></ref></property> + <property name="phyloTreeService"><ref bean="phyloTreeService"></ref></property> + <property name="studyService"><ref bean="studyService"></ref></property> + </bean> <bean id="filenameController" class="org.cipres.treebase.web.controllers.ShortPathUrlFilenameViewController"/> <!--bean id="filenameController" class="org.springframework.web.servlet.mvc.UrlFilenameViewController"/ --> @@ -905,6 +929,10 @@ <props> <prop key="/top/**">OAIPMHController</prop> <prop key="/phylows/**">phyloWSController</prop> + <prop key="/phylows/study/**">phyloWSStudyController</prop> + <prop key="/phylows/taxon/**">phyloWSTaxonController</prop> + <prop key="/phylows/tree/**">phyloWSTreeController</prop> + <prop key="/phylows/matrix/**">phyloWSMatrixController</prop> <prop key="/about.html">filenameController</prop> <prop key="/home.html">filenameController</prop> <prop key="/login.html">filenameController</prop> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2011-04-25 21:46:30
|
Revision: 801 http://treebase.svn.sourceforge.net/treebase/?rev=801&view=rev Author: rvos Date: 2011-04-25 21:46:23 +0000 (Mon, 25 Apr 2011) Log Message: ----------- PhyloWS sub-controllers now re-factored Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSMatrixController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSStudyController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTaxonController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTreeController.java trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSController.java 2011-04-25 18:46:13 UTC (rev 800) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSController.java 2011-04-25 21:46:23 UTC (rev 801) @@ -1,5 +1,9 @@ package org.cipres.treebase.web.controllers; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -10,163 +14,93 @@ import org.cipres.treebase.TreebaseIDString; import org.cipres.treebase.TreebaseUtil; import org.cipres.treebase.TreebaseIDString.MalformedTreebaseIDString; -import org.cipres.treebase.domain.matrix.Matrix; -import org.cipres.treebase.domain.matrix.MatrixService; -import org.cipres.treebase.domain.study.Study; -import org.cipres.treebase.domain.study.StudyService; -import org.cipres.treebase.domain.tree.PhyloTree; -import org.cipres.treebase.domain.tree.PhyloTreeService; import org.cipres.treebase.web.Constants; -public class PhyloWSController implements Controller { - private static String ncbiBaseUrl = "http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id="; - private static String uBioBaseUrl = "http://www.ubio.org/browser/details.php?namebankID="; +public abstract class PhyloWSController implements Controller { private static final long serialVersionUID = 1L; - private MatrixService mMatrixService; - private PhyloTreeService mPhyloTreeService; - private StudyService mStudyService; - private static String format = "format"; - - /* - * this array is used to identify whether a path fragment maps to an object - * for which web pages are available. Maybe this should be an enum or a map - * instead. - */ - private static String[] classesWithPages = { "tree", "study", "matrix" }; + private static String searchBase = "/treebase-web/search/"; /** - * Given an object prefix ("tree", "study" or "matrix") and an object ID, constructs + * + * @return + */ + abstract String getDisplayPage(); + + /** + * Given an object ID and a servlet request object, constructs * a relative URL to an HTML page about that object. - * @param prefix identifies either studies, matrices or trees * @param objectId is the primary key for the requested object * @param request is the servlet request, which we need to check for reviewer access - * @return a relative URL to an HTML page, or an empty string - * @throws Exception + * @return a relative URL to an HTML page + * @throws ObjectNotFoundException */ - private String createUrl(String prefix, Long objectId,HttpServletRequest request) throws Exception { - String url = ""; - StringBuffer base = new StringBuffer("/treebase-web/search/study"); - - // requested object is a study - if ( prefix.equals(TreebaseIDString.getPrefixForClass(Study.class)) ) { - Study study = getStudyService().findByID(objectId); - if ( study == null ) { - throw new ObjectNotFoundException("Can't find study " + objectId); - } - if ( ! TreebaseUtil.isEmpty(request.getParameter(Constants.X_ACCESS_CODE))) { - request.setAttribute("initialReviewerRedirect", true); - return base - .append("/summary.html?id=") - .append(objectId) - .append('&') - .append(Constants.X_ACCESS_CODE) - .append('=') - .append(request.getParameter(Constants.X_ACCESS_CODE)) - .toString(); - } - else { - return base - .append("/summary.html?id=") - .append(objectId) - .toString(); - } - } - - // requested object is a matrix - else if ( prefix.equals(TreebaseIDString.getPrefixForClass(Matrix.class)) ) { - Matrix matrix = getMatrixService().findByID(objectId); - if ( matrix == null ) { - throw new ObjectNotFoundException("Can't find matrix " + objectId); - } - Study study = matrix.getStudy(); - return base - .append("/matrix.html?id=") - .append(study.getId()) - .append("&matrixid=") - .append(objectId) - .toString(); - } - - // requested object is a tree - else if ( prefix.equals(TreebaseIDString.getPrefixForClass(PhyloTree.class)) ) { - PhyloTree phyloTree = getPhyloTreeService().findByID(objectId); - if ( phyloTree == null ) { - throw new ObjectNotFoundException("Can't find tree " + objectId); - } - Study study = phyloTree.getStudy(); - return base - .append("/tree.html?id=") - .append(study.getId()) - .append("&treeid=") - .append(objectId) - .toString(); - } - return url; + private String createDisplayUrl(Long objectId,HttpServletRequest request) throws ObjectNotFoundException { + StringBuffer base = new StringBuffer(searchBase + "study/"); + base.append(getDisplayPage()); + Map<String,String> params = getObjectQueryParameters(objectId); + return createUrl(base, params, request); } - - public ModelAndView handleRequest(HttpServletRequest req, HttpServletResponse res) - throws Exception { - res.setContentType("text/plain"); - String url = null; - //String domain = "http://" + req.getServerName() + ":" + req.getServerPort(); - if ( ! TreebaseUtil.isEmpty(req.getParameter(Constants.X_ACCESS_CODE)) ) { - req.getSession().setAttribute( - Constants.X_ACCESS_CODE, - req.getParameter(Constants.X_ACCESS_CODE)); - } - try { - String pathInfo = req.getPathInfo(); - if ( TreebaseUtil.isEmpty(pathInfo) ) { - throw new InvalidRequestException( - "Invalid request '" - + pathInfo - + "', should be /${class}/${NamespacedGUID}"); - } - String[] pathComponents = pathInfo.split("/"); - if ( pathComponents[pathComponents.length-1].equals("find") ) { - //url = domain + createSearchUrl(pathComponents[pathComponents.length-2],req); - url = createSearchUrl(pathComponents[pathComponents.length-2],req); - } else { - String rawNamespacedGUID = pathComponents[pathComponents.length-1]; - if ( rawNamespacedGUID.startsWith("uBio:") ) { // XXX be polite, use real URL - url = uBioBaseUrl + rawNamespacedGUID.substring("uBio:".length()); + + /** + * + */ + public ModelAndView handleRequest(HttpServletRequest req, HttpServletResponse res) throws IOException { + String url = null; + String pathInfo = req.getPathInfo(); + + // url has "find" in it, re-direct to search services + if ( pathInfo.indexOf("find") != -1 ) { + url = createSearchUrl(req); + } + else { + try { + NamespacedGUID namespacedGUID = new NamespacedGUID(pathInfo); + TreebaseIDString tbID = namespacedGUID.getTreebaseIDString(); + String serializationFormat = createSerializationFormat(req); + if ( hasWebPage(tbID.getClass()) && ! TreebaseUtil.isEmpty(serializationFormat) ) { + + // output format is html, re-direct to display services + if ( serializationFormat.equals("html") ) { + url = createDisplayUrl(tbID.getId(),req); + } + + // output format is something else, re-direct to download services + else { + url = createDownloadUrl(tbID.getId(),serializationFormat,req); + } } - else if ( rawNamespacedGUID.startsWith("NCBI:") ) { // XXX be polite, use real URL - url = ncbiBaseUrl + rawNamespacedGUID.substring("NCBI:".length()); - } + + // no output format, re-direct to base resource url else { - NamespacedGUID namespacedGUID = new NamespacedGUID(rawNamespacedGUID); - TreebaseIDString tbID = namespacedGUID.getTreebaseIDString(); - if ( hasWebPage(pathComponents) ) { - String serializationFormat = createSerializationFormat(req); - if ( TreebaseUtil.isEmpty(serializationFormat) ) { - url = "/treebase-web/search/study/anyObjectAsRDF.rdf?namespacedGUID=" + namespacedGUID.toString(); - } - else if ( serializationFormat.equals("html") ) { - url = createUrl(tbID.getTypePrefix(),tbID.getId(),req); - } - else { - url = createDownloadUrl(tbID.getTypePrefix(),tbID.getId(),serializationFormat); - } - } - else { - url = "/treebase-web/search/study/anyObjectAsRDF.rdf?namespacedGUID=" + namespacedGUID.toString(); - } + url = createResourceUrl(namespacedGUID, req); } - } - } catch ( MalformedTreebaseIDString e ) { - res.sendError(HttpServletResponse.SC_BAD_REQUEST, "Bad ID string: " + e.getMessage()); - } catch ( ObjectNotFoundException e ) { - res.sendError(HttpServletResponse.SC_NOT_FOUND, e.getMessage()); - } catch ( InvalidRequestException e ) { - res.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage()); + } catch ( MalformedTreebaseIDString e ) { + res.sendError(HttpServletResponse.SC_BAD_REQUEST, "Bad ID string: " + e.getMessage()); + } catch ( ObjectNotFoundException e ) { + res.sendError(HttpServletResponse.SC_NOT_FOUND, "Object not found: " + e.getMessage()); + } } + if ( ! TreebaseUtil.isEmpty(url) ) { + res.setContentType("text/plain"); res.setStatus(HttpServletResponse.SC_SEE_OTHER); res.setHeader("Location", url); } return null; } + + /** + * + * @param guid + * @param req + * @return + */ + private String createResourceUrl(NamespacedGUID guid,HttpServletRequest req) { + StringBuffer base = new StringBuffer(searchBase + "study/anyObjectAsRDF.rdf"); + Map<String,String> params = new HashMap<String,String>(); + params.put("namespacedGUID", guid.toString()); + return createUrl(base,params,req); + } /** * This is a placeholder method that might parse accept headers for content-negotiation @@ -175,20 +109,28 @@ * @return */ private String createSerializationFormat(HttpServletRequest request) { - return request.getParameter(format); + return request.getParameter("format"); } - private String createSearchUrl(String path,HttpServletRequest request) { - StringBuilder sb = new StringBuilder("/treebase-web/search/"); - sb - .append(path) - .append("Search.html?query=") - .append(request.getParameter("query")) - .append("&format=") - .append(request.getParameter("format")) - .append("&recordSchema=") - .append(request.getParameter("recordSchema")); - return sb.toString(); + /** + * + * @return + */ + abstract String getSearchPage(); + + /** + * + * @param request + * @return + */ + private String createSearchUrl(HttpServletRequest request) { + StringBuffer sb = new StringBuffer(searchBase); + sb.append(getSearchPage()); + Map<String,String> params = new HashMap<String,String>(); + params.put("query", request.getParameter("query")); + params.put("format", createSerializationFormat(request)); + params.put("recordSchema", request.getParameter("recordSchema")); + return createUrl(sb,params,request); } /** @@ -197,110 +139,70 @@ * @param pathComponents * @return true of web page exists, false otherwise */ - private boolean hasWebPage(String[] pathComponents) { - for ( int i = ( pathComponents.length - 1 ); i >= 0; i-- ) { - for ( int j = 0; j < classesWithPages.length; j++ ) { - if ( pathComponents[i].equals(classesWithPages[j]) ) { - return true; - } - } - } - return false; - } + abstract boolean hasWebPage(Class<?> theClass); + + /** + * + * @param objectId + * @return + * @throws ObjectNotFoundException + */ + abstract Map<String,String> getObjectQueryParameters(Long objectId) throws ObjectNotFoundException; - private String createDownloadUrl(String prefix, Long objectId, String format) throws Exception { - if ( format.equals("xml") ) { - format = "nexml"; + /** + * + * @param base + * @param params + * @return + */ + private String createUrl(StringBuffer base,Map<String,String> params,HttpServletRequest req) { + if ( ! TreebaseUtil.isEmpty(req.getParameter(Constants.X_ACCESS_CODE))) { + req.setAttribute("initialReviewerRedirect", true); + params.put(Constants.X_ACCESS_CODE, req.getParameter(Constants.X_ACCESS_CODE)); + req.getSession().setAttribute(Constants.X_ACCESS_CODE,req.getParameter(Constants.X_ACCESS_CODE)); } - String url = ""; - StringBuffer base = new StringBuffer("/treebase-web/search"); - if ( prefix.equals(TreebaseIDString.getPrefixForClass(Study.class)) ) { - Study study = getStudyService().findByID(objectId); - if ( study == null ) { - throw new ObjectNotFoundException("Can't find study " + objectId); - } - return base - .append("/downloadAStudy.html?id=") - .append(objectId) - .append("&format=") - .append(format) - .toString(); - } - else if ( prefix.equals(TreebaseIDString.getPrefixForClass(Matrix.class)) ) { - Matrix matrix = getMatrixService().findByID(objectId); - if ( matrix == null ) { - throw new ObjectNotFoundException("Can't find matrix " + objectId); - } - Study study = matrix.getStudy(); - if ( study == null ) { - throw new ObjectNotFoundException("Can't find study for matrix "+objectId); - } - return base - .append("/downloadAMatrix.html?id=") - .append(study.getId()) - .append("&matrixid=") - .append(objectId) - .append("&format=") - .append(format) - .toString(); - } - else if ( prefix.equals(TreebaseIDString.getPrefixForClass(PhyloTree.class)) ) { - PhyloTree phyloTree = getPhyloTreeService().findByID(objectId); - if ( phyloTree == null ) { - throw new ObjectNotFoundException("Can't find tree " + objectId); - } - Study study = phyloTree.getStudy(); - if ( study == null ) { - throw new ObjectNotFoundException("Can't find study for tree "+objectId); - } - return base - .append("/downloadATree.html?id=") - .append(study.getId()) - .append("&treeid=") - .append(objectId) - .append("&format=") - .append(format) - .toString(); - } - return url; + if ( ! params.isEmpty() ) { + base.append('?'); + } + for ( String key : params.keySet() ) { + base.append(key).append('=').append(params.get(key)).append('&'); + } + String url = base.toString(); + return url.substring(0, url.length() - 2 ); } - - public MatrixService getMatrixService() { - return mMatrixService; - } - public void setMatrixService(MatrixService matrixService) { - mMatrixService = matrixService; - } - public PhyloTreeService getPhyloTreeService() { - return mPhyloTreeService; - } + /** + * + * @return + */ + abstract String getDownloadPage(); - public void setPhyloTreeService(PhyloTreeService phyloTreeService) { - mPhyloTreeService = phyloTreeService; + /** + * + * @param objectId + * @param format + * @return + * @throws ObjectNotFoundException + */ + private String createDownloadUrl(Long objectId, String format,HttpServletRequest req) throws ObjectNotFoundException { + StringBuffer base = new StringBuffer(searchBase); + base.append(getDownloadPage()); + Map<String,String> params = getObjectQueryParameters(objectId); + params.put("format", format); + return createUrl(base,params,req); } - - public StudyService getStudyService() { - return mStudyService; - } - - public void setStudyService(StudyService studyService) { - mStudyService = studyService; - } + /** + * + * @author rvosa + * + */ class ObjectNotFoundException extends Exception { private static final long serialVersionUID = 1L; public ObjectNotFoundException(String message) { super(message); } } - - class InvalidRequestException extends Exception { - private static final long serialVersionUID = 1L; - public InvalidRequestException(String message) { - super(message); - } - } } Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSMatrixController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSMatrixController.java 2011-04-25 18:46:13 UTC (rev 800) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSMatrixController.java 2011-04-25 21:46:23 UTC (rev 801) @@ -1,5 +1,58 @@ package org.cipres.treebase.web.controllers; +import java.util.HashMap; +import java.util.Map; + +import org.cipres.treebase.domain.matrix.Matrix; +import org.cipres.treebase.domain.matrix.MatrixService; +import org.cipres.treebase.domain.study.Study; + public class PhyloWSMatrixController extends PhyloWSController { + private MatrixService mMatrixService; + + @Override + String getSearchPage() { + return "matrixSearch.html"; + } + + @Override + String getDownloadPage() { + return "downloadAMatrix.html"; + } + + @Override + Map<String,String> getObjectQueryParameters(Long objectId) throws ObjectNotFoundException { + Matrix matrix = getMatrixService().findByID(objectId); + if ( matrix == null ) { + throw new ObjectNotFoundException("Can't find matrix " + objectId); + } + Study study = matrix.getStudy(); + if ( study == null ) { + throw new ObjectNotFoundException("Can't find study for matrix "+objectId); + } + Map<String,String> params = new HashMap<String,String>(); + params.put("id", ""+study.getId()); + params.put("matrixid", ""+objectId); + return params; + } + + @Override + String getDisplayPage() { + return "matrix.html"; + } + + @Override + boolean hasWebPage(Class<?> theClass) { + return Matrix.class.isAssignableFrom(theClass); + } + + public MatrixService getMatrixService() { + return mMatrixService; + } + + public void setMatrixService(MatrixService matrixService) { + mMatrixService = matrixService; + } + } Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSStudyController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSStudyController.java 2011-04-25 18:46:13 UTC (rev 800) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSStudyController.java 2011-04-25 21:46:23 UTC (rev 801) @@ -1,5 +1,52 @@ package org.cipres.treebase.web.controllers; +import java.util.HashMap; +import java.util.Map; + +import org.cipres.treebase.domain.study.Study; +import org.cipres.treebase.domain.study.StudyService; + public class PhyloWSStudyController extends PhyloWSController { + private StudyService mStudyService; + + @Override + String getSearchPage() { + return "studySearch.html"; + } + + @Override + String getDownloadPage() { + return "downloadAStudy.html"; + } + + @Override + Map<String,String> getObjectQueryParameters(Long objectId) throws ObjectNotFoundException { + Study study = getStudyService().findByID(objectId); + if ( study == null ) { + throw new ObjectNotFoundException("Can't find study " + objectId); + } + Map<String,String> params = new HashMap<String,String>(); + params.put("id", ""+objectId); + return params; + } + + @Override + String getDisplayPage() { + return "summary.html"; + } + + @Override + boolean hasWebPage(Class<?> theClass) { + return Study.class.isAssignableFrom(theClass); + } + + public StudyService getStudyService() { + return mStudyService; + } + + public void setStudyService(StudyService studyService) { + mStudyService = studyService; + } + } Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTaxonController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTaxonController.java 2011-04-25 18:46:13 UTC (rev 800) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTaxonController.java 2011-04-25 21:46:23 UTC (rev 801) @@ -1,5 +1,37 @@ package org.cipres.treebase.web.controllers; +import java.util.HashMap; +import java.util.Map; + +import org.cipres.treebase.domain.taxon.TaxonLabel; + public class PhyloWSTaxonController extends PhyloWSController { + @Override + String getSearchPage() { + return "taxonSearch.html"; + } + + @Override + String getDownloadPage() { + return "downloadATaxon.html"; + } + + @Override + Map<String,String> getObjectQueryParameters(Long objectId) throws ObjectNotFoundException { + // TODO Auto-generated method stub + return new HashMap<String,String>(); + } + + @Override + String getDisplayPage() { + // TODO Auto-generated method stub + return "taxon.html"; + } + + @Override + boolean hasWebPage(Class<?> theClass) { + return TaxonLabel.class.isAssignableFrom(theClass); + } + } Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTreeController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTreeController.java 2011-04-25 18:46:13 UTC (rev 800) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTreeController.java 2011-04-25 21:46:23 UTC (rev 801) @@ -1,5 +1,58 @@ package org.cipres.treebase.web.controllers; +import java.util.HashMap; +import java.util.Map; + +import org.cipres.treebase.domain.study.Study; +import org.cipres.treebase.domain.tree.PhyloTree; +import org.cipres.treebase.domain.tree.PhyloTreeService; + public class PhyloWSTreeController extends PhyloWSController { + private PhyloTreeService mPhyloTreeService; + + @Override + String getSearchPage() { + return "treeSearch.html"; + } + + @Override + String getDownloadPage() { + return "downloadATree.html"; + } + + @Override + Map<String,String> getObjectQueryParameters(Long objectId) throws ObjectNotFoundException { + PhyloTree phyloTree = getPhyloTreeService().findByID(objectId); + if ( phyloTree == null ) { + throw new ObjectNotFoundException("Can't find tree " + objectId); + } + Study study = phyloTree.getStudy(); + if ( study == null ) { + throw new ObjectNotFoundException("Can't find study for tree "+objectId); + } + Map<String,String> params = new HashMap<String,String>(); + params.put("id",""+study.getId()); + params.put("treeid", ""+objectId); + return params; + } + + @Override + String getDisplayPage() { + return "tree.html"; + } + + @Override + boolean hasWebPage(Class<?> theClass) { + return PhyloTree.class.isAssignableFrom(theClass); + } + + public PhyloTreeService getPhyloTreeService() { + return mPhyloTreeService; + } + + public void setPhyloTreeService(PhyloTreeService phyloTreeService) { + mPhyloTreeService = phyloTreeService; + } + } Modified: trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2011-04-25 18:46:13 UTC (rev 800) +++ trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2011-04-25 21:46:23 UTC (rev 801) @@ -42,34 +42,22 @@ <property name="studyService"><ref bean="studyService"></ref></property> </bean> - <bean id="phyloWSController" class="org.cipres.treebase.web.controllers.PhyloWSController"> - <property name="matrixService"><ref bean="matrixService"></ref></property> - <property name="phyloTreeService"><ref bean="phyloTreeService"></ref></property> - <property name="studyService"><ref bean="studyService"></ref></property> + <bean id="phyloWSController" class="org.cipres.treebase.web.controllers.PhyloWSController"> </bean> <bean id="phyloWSStudyController" class="org.cipres.treebase.web.controllers.PhyloWSStudyController"> - <property name="matrixService"><ref bean="matrixService"></ref></property> - <property name="phyloTreeService"><ref bean="phyloTreeService"></ref></property> <property name="studyService"><ref bean="studyService"></ref></property> </bean> - <bean id="phyloWSTaxonController" class="org.cipres.treebase.web.controllers.PhyloWSTaxonController"> - <property name="matrixService"><ref bean="matrixService"></ref></property> - <property name="phyloTreeService"><ref bean="phyloTreeService"></ref></property> - <property name="studyService"><ref bean="studyService"></ref></property> + <bean id="phyloWSTaxonController" class="org.cipres.treebase.web.controllers.PhyloWSTaxonController"> </bean> <bean id="phyloWSMatrixController" class="org.cipres.treebase.web.controllers.PhyloWSMatrixController"> - <property name="matrixService"><ref bean="matrixService"></ref></property> - <property name="phyloTreeService"><ref bean="phyloTreeService"></ref></property> - <property name="studyService"><ref bean="studyService"></ref></property> + <property name="matrixService"><ref bean="matrixService"></ref></property> </bean> <bean id="phyloWSTreeController" class="org.cipres.treebase.web.controllers.PhyloWSTreeController"> - <property name="matrixService"><ref bean="matrixService"></ref></property> <property name="phyloTreeService"><ref bean="phyloTreeService"></ref></property> - <property name="studyService"><ref bean="studyService"></ref></property> </bean> <bean id="filenameController" class="org.cipres.treebase.web.controllers.ShortPathUrlFilenameViewController"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hs...@us...> - 2011-04-26 15:53:49
|
Revision: 807 http://treebase.svn.sourceforge.net/treebase/?rev=807&view=rev Author: hshyket Date: 2011-04-26 15:53:43 +0000 (Tue, 26 Apr 2011) Log Message: ----------- Updating messages for highlighted menu items. Submit button on ready state form is greyed out if anything in yellow is selected. Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ReadyStateController.java trunk/treebase-web/src/main/webapp/WEB-INF/pages/json/citationToJSON.jsp trunk/treebase-web/src/main/webapp/WEB-INF/pages/readyState.jsp trunk/treebase-web/src/main/webapp/scripts/user/submissionSummary.js Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ReadyStateController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ReadyStateController.java 2011-04-26 00:28:51 UTC (rev 806) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/ReadyStateController.java 2011-04-26 15:53:43 UTC (rev 807) @@ -97,7 +97,7 @@ } - protected Map<String, Boolean> referenceData(HttpServletRequest pRequest) { + /*protected Map<String, Boolean> referenceData(HttpServletRequest pRequest) { String subid = ServletRequestUtils.getStringParameter(pRequest, "submissionid", null); Study study = mStudyService.findBySubmissionID(Long.parseLong(subid)); @@ -105,6 +105,17 @@ validatedProperties.put("AnalysesStatus", study.getAnalysesStatus()); return validatedProperties; + }*/ + + protected Map<String, Object> referenceData(HttpServletRequest pRequest) { + String subid = ServletRequestUtils.getStringParameter(pRequest, "submissionid", null); + Study study = mStudyService.findBySubmissionID(Long.parseLong(subid)); + + HashMap<String, Object> validatedProperties = new HashMap<String, Object>(); + validatedProperties.put("AnalysesStatus", study.getAnalysesStatus()); + validatedProperties.put("submissionNumber", Long.parseLong(subid)); + + return validatedProperties; } /** Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/json/citationToJSON.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/json/citationToJSON.jsp 2011-04-26 00:28:51 UTC (rev 806) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/json/citationToJSON.jsp 2011-04-26 15:53:43 UTC (rev 807) @@ -1,3 +1,20 @@ -<%@ include file="/common/taglibs.jsp"%> -<c:if test="${citation == null}">null</c:if> -<c:if test="${citation != null}">{id:${citation.id}}</c:if> \ No newline at end of file +<%@ include file="/common/taglibs.jsp"%> +<c:if test="${citation == null}">null</c:if> +<c:if test="${citation != null}"> +{ + id:${citation.id}, + citationType:'${citation.citationType}', + <c:choose> + <c:when test="${citation.citationType == 'Article'}"> + journal:'${citation.journal}' + </c:when> + <c:when test="${citation.citationType == 'Book'}"> + booktitle:'${citation.bookTitle}' + </c:when> + <c:when test="${citation.citationType == 'Book Section'}"> + booktitle:'${citation.bookTitle}', + sectiontitle:'${citation.sectionTitle}', + </c:when> + </c:choose> +} +</c:if> \ No newline at end of file Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/readyState.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/readyState.jsp 2011-04-26 00:28:51 UTC (rev 806) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/readyState.jsp 2011-04-26 15:53:43 UTC (rev 807) @@ -6,12 +6,14 @@ <form method="post"> +<%-- <c:if test="${AnalysesStatus eq false}"> <p style="color:red;font-weight:bold"> We notice that some of your taxon labels have failed to be validated against an external taxonomy. Unless it is impossible to validate these labels, TreeBASE may refuse or delay the acceptance of your data. </p> -</c:if> +</c:if> +--%> <p style="font-weight:bold"> Are you sure that you want to change the status of this study to 'Ready State'? This means that you are ready for the review process. If yes press Submit, @@ -21,8 +23,18 @@ Please note: after you press the Submit button you will no longer be able to make any further changes to this study. The study will be available in 'READ ONLY' mode. </p> - -<input type="submit" name="Submit" value="Submit"/> -<input type="submit" name="_cancel" value = "Cancel"/> - +<p class="readyStateError" style="display:none;"> + The items in the Tool Box on the right that are highlighted in yellow indicate that the item either has not been visited or there is an error. Hovering your mouse over the item will indicate the nature of the problem. Your submission cannot be changed to "Ready" state until all highlighted items are addressed. Please return to your submission to complete it. If you think this request is in error, please contact <a href='mailto:he...@tr...?subject=TreeBASE Submission S<c:out value="${submissionNumber}"/>'>help</a>. + <br /><br /> + The most common problems include: + <br /><br /> + (1) The submitter has not entered a citation that at a minimum must include the authors, year, title, and journal name.<br /> + (2) The submitter has "orphaned" matrices or trees: i.e., there are matrices that are not listed as inputs to at least one analysis; or trees that are not listed as outputs from at least one analysis. If your paper does not include a tree, please submit a generic neighbor joining tree to satisfy this requirement.<br /> + (3) The output tree of an analysis has taxon labels that do not match with the input matrix (i.e. there are taxon labels in the tree that are missing from the matrix or matrices that produced the tree). Preparing your submission using <a href='http://mesquiteproject.org/'>Mesquite</a>, in which both matrices and trees are part of the same Mesquite project and share a common taxon block, will avoid the problem of mismatched taxon labels.<br /> + (4) The submitter has not attempted to validate the taxon labels by clicking the "Validate Taxon Labels" button in the Taxa section. +</p> +<p> + <input type="submit" name="Submit" value="Submit" id="submitReadyState"/> + <input type="submit" name="_cancel" value = "Cancel"/> +</p> </form> \ No newline at end of file Modified: trunk/treebase-web/src/main/webapp/scripts/user/submissionSummary.js =================================================================== --- trunk/treebase-web/src/main/webapp/scripts/user/submissionSummary.js 2011-04-26 00:28:51 UTC (rev 806) +++ trunk/treebase-web/src/main/webapp/scripts/user/submissionSummary.js 2011-04-26 15:53:43 UTC (rev 807) @@ -142,7 +142,7 @@ if ( TreeBASE.study && TreeBASE.study.analyses ) { writeAnalyses(); writeNexusFileNames(); - decorateNotes(); + //decorateNotes(); decorateCitation(); decorateAuthors(); decorateUpload(); @@ -247,6 +247,44 @@ citationLi.addClassName('notAnalyzed'); citationLi.select('a.Citation')[0].title = 'No citation information has been entered yet'; } + else { + var isCitationError = false; + var citationErrorMessage = ''; + switch( TreeBASE.study.citation.citationType ){ + case 'Article': + if ( TreeBASE.study.citation.journal.length == 0 ) { + isCitationError = true; + citationErrorMessage = 'No journal name has been entered'; + } + break + case 'Book': + if ( TreeBASE.study.citation.booktitle.length == 0 ) { + isCitationError = true; + citationErrorMessage = 'No book title has been entered'; + } + break + case 'Book Section': + if (TreeBASE.study.citation.booktitle.length == 0) { + isCitationError = true; + citationErrorMessage = 'No book title has been entered'; + } + if (TreeBASE.study.citation.sectiontitle.length == 0) { + if ( isCitationError ) { + citationErrorMessage += '; '; + } + isCitationError = true; + citationErrorMessage += 'No book section has been entered'; + } + break + } + + if ( isCitationError ){ + var citationLi = $('menuList').select('li.Citation')[0]; + citationLi.addClassName('notAnalyzed'); + citationLi.select('a.Citation')[0].title = citationErrorMessage; + } + } + } function decorateAuthors() { if ( TreeBASE.study.authors.length == 0 ) { @@ -352,7 +390,7 @@ ul = createUnorderedList(taxonLabels,'taxonLabel','taxonLabel'); ul.style.display = 'none'; taxaLi.appendChild(ul); - var taxonLabelLis = ul.select('li'); + /*var taxonLabelLis = ul.select('li'); var analyzed = 'analyzed'; for ( var i = 0; i < taxonLabelLis.length; i++ ) { var id = taxonLabelLis[i].id; @@ -369,7 +407,7 @@ taxaLi.addClassName(analyzed); if ( analyzed == 'notAnalyzed' ) { taxaLi.select('a.Taxa')[0].title = 'Some taxa have not been linked to external taxonomy yet'; - } + }*/ } else { taxaLi.addClassName('emptyList'); @@ -466,4 +504,13 @@ }); TreeBASE.register(initializeMenus); })() + +var submitButton = $('submitReadyState'); +if (submitButton != null && submitButton != undefined) { + var notAnalyzed = $$('li.notAnalyzed'); + if (notAnalyzed != null && notAnalyzed != undefined) { + submitButton.disable(); + $$('p.readyStateError').invoke('setStyle', { display: 'block' }); + } +}; /* end of closure */ \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2011-04-28 23:37:58
|
Revision: 813 http://treebase.svn.sourceforge.net/treebase/?rev=813&view=rev Author: rvos Date: 2011-04-28 23:37:52 +0000 (Thu, 28 Apr 2011) Log Message: ----------- This commit adds functionality for a simple search box that searches identifiers and names for studies, trees, matrices and taxa. Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/MatrixSearchController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudySearchController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TaxonSearchController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeSearchController.java trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml Added Paths: ----------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/MainSearchController.java trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/mainSearch.jsp trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/mainSimpleSearchForm.jsp Added: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/MainSearchController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/MainSearchController.java (rev 0) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/MainSearchController.java 2011-04-28 23:37:52 UTC (rev 813) @@ -0,0 +1,114 @@ +package org.cipres.treebase.web.controllers; + +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.cipres.treebase.TreebaseUtil; +import org.cipres.treebase.domain.matrix.Matrix; +import org.cipres.treebase.domain.search.MatrixSearchResults; +import org.cipres.treebase.domain.search.SearchResultsType; +import org.cipres.treebase.domain.search.StudySearchResults; +import org.cipres.treebase.domain.search.TaxonSearchResults; +import org.cipres.treebase.domain.search.TreeSearchResults; +import org.springframework.validation.BindException; +import org.springframework.web.servlet.ModelAndView; +import org.z3950.zing.cql.CQLNode; +import org.z3950.zing.cql.CQLParseException; +import org.z3950.zing.cql.CQLParser; + +import org.cipres.treebase.domain.study.Study; +import org.cipres.treebase.domain.taxon.Taxon; +import org.cipres.treebase.domain.tree.PhyloTree; +import org.cipres.treebase.web.controllers.TreeSearchController; +import org.cipres.treebase.web.controllers.TaxonSearchController; +import org.cipres.treebase.web.controllers.StudySearchController; +import org.cipres.treebase.web.controllers.MatrixSearchController; + +public class MainSearchController extends SearchController { + + @Override + protected ModelAndView handleQueryRequest(HttpServletRequest request, + HttpServletResponse response, BindException errors, String query) + throws CQLParseException, IOException, InstantiationException { + String anyQuery = "dcterms.identifier=" + query + " or dcterms.title=" + query; + CQLParser parser = new CQLParser(); + CQLNode root = parser.parse(anyQuery); + + StudySearchResults studyResults = new StudySearchResults(doDelegatedStudyQuery(root, request, response, errors)); + request.setAttribute("studyResults", studyResults); + + MatrixSearchResults matrixResults = new MatrixSearchResults(doDelegatedMatrixQuery(root, request, response, errors)); + request.setAttribute("matrixResults", matrixResults); + + TaxonSearchResults taxonResults = new TaxonSearchResults(doDelegatedTaxonQuery(root, request, response, errors)); + request.setAttribute("taxonResults", taxonResults); + + TreeSearchResults treeResults = new TreeSearchResults(doDelegatedTreeQuery(root, request, response, errors)); + request.setAttribute("treeResults",treeResults); + + return new ModelAndView("search/mainSearch"); + } + + protected ModelAndView onSubmit( + HttpServletRequest request, + HttpServletResponse response, + Object command, + BindException errors) throws Exception { + clearMessages(request); + String query = request.getParameter("query"); + if ( TreebaseUtil.isEmpty(query) || "".equals(query) ) { + addMessage(request,"You provided an empty search query"); + } + return this.handleQueryRequest(request, response, errors, query); + } + + private Set<Study> doDelegatedStudyQuery(CQLNode node, HttpServletRequest request, HttpServletResponse response, BindException errors) throws InstantiationException { + StudySearchController searcher = new StudySearchController(); + CQLNode normalized = searcher.normalizeParseTree(node); + Set<Study> results = new HashSet<Study>(); + return searcher.doCQLQuery(normalized, results, request, response, errors); + } + + private Set<Matrix> doDelegatedMatrixQuery(CQLNode node, HttpServletRequest request, HttpServletResponse response, BindException errors) throws InstantiationException { + MatrixSearchController searcher = new MatrixSearchController(); + CQLNode normalized = searcher.normalizeParseTree(node); + Set<Matrix> results = new HashSet<Matrix>(); + return searcher.doCQLQuery(normalized, results, request, response, errors); + } + + private Set<PhyloTree> doDelegatedTreeQuery(CQLNode node, HttpServletRequest request, HttpServletResponse response, BindException errors) throws InstantiationException { + TreeSearchController searcher = new TreeSearchController(); + CQLNode normalized = searcher.normalizeParseTree(node); + Set<PhyloTree> results = new HashSet<PhyloTree>(); + return searcher.doCQLQuery(normalized, results, request, response, errors); + } + + private Set<Taxon> doDelegatedTaxonQuery(CQLNode node, HttpServletRequest request, HttpServletResponse response, BindException errors) throws InstantiationException { + TaxonSearchController searcher = new TaxonSearchController(); + CQLNode normalized = searcher.normalizeParseTree(node); + Set<Taxon> results = new HashSet<Taxon>(); + return searcher.doCQLQuery(normalized, results, request); + } + + @Override + protected Map<String, String> getPredicateMapping() { + return new HashMap<String,String>(); + } + + @Override + public String getDefaultViewURL() { + return "mainSearch.html"; + } + + @Override + SearchResultsType currentSearchType() { + return SearchResultsType.MAIN; + } + +} Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/MatrixSearchController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/MatrixSearchController.java 2011-04-28 21:08:13 UTC (rev 812) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/MatrixSearchController.java 2011-04-28 23:37:52 UTC (rev 813) @@ -120,7 +120,7 @@ } } - private Set<Matrix> doCQLQuery( + protected Set<Matrix> doCQLQuery( CQLNode node, Set<Matrix> results, HttpServletRequest request, Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudySearchController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudySearchController.java 2011-04-28 21:08:13 UTC (rev 812) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudySearchController.java 2011-04-28 23:37:52 UTC (rev 813) @@ -149,7 +149,7 @@ } } - private Set<Study> doCQLQuery( + protected Set<Study> doCQLQuery( CQLNode node, Set<Study> results, HttpServletRequest request, Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TaxonSearchController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TaxonSearchController.java 2011-04-28 21:08:13 UTC (rev 812) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TaxonSearchController.java 2011-04-28 23:37:52 UTC (rev 813) @@ -97,7 +97,7 @@ } } - private Set<Taxon> doCQLQuery(CQLNode node, Set<Taxon> results, HttpServletRequest request) { + protected Set<Taxon> doCQLQuery(CQLNode node, Set<Taxon> results, HttpServletRequest request) { if ( node instanceof CQLBooleanNode ) { Set<Taxon> resultsLeft = doCQLQuery(((CQLBooleanNode)node).left,results, request); Set<Taxon> resultsRight = doCQLQuery(((CQLBooleanNode)node).right,results, request); Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeSearchController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeSearchController.java 2011-04-28 21:08:13 UTC (rev 812) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeSearchController.java 2011-04-28 23:37:52 UTC (rev 813) @@ -116,7 +116,7 @@ } } - private Set<PhyloTree> doCQLQuery( + protected Set<PhyloTree> doCQLQuery( CQLNode node, Set<PhyloTree> results, HttpServletRequest request, Added: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/mainSearch.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/mainSearch.jsp (rev 0) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/mainSearch.jsp 2011-04-28 23:37:52 UTC (rev 813) @@ -0,0 +1,36 @@ +<%@ include file="/common/taglibs.jsp"%> + +<title><fmt:message key="search.main"/></title> +<body id="s-main"/> + +<div id="wrap"> + <!-- these are the tabs that switch between search forms --> + <jsp:include page="/common/search-nav.jsp"/> + <div id="s-clear"></div> + + <c:set var="searchType" value="main" scope="request"/> + + <!-- this is the simple search box --> + <jsp:include page="mainSimpleSearchForm.jsp"/> + <div id="s-clear"></div> + + <!-- this contains any search warnings, e.g. if an empty query string was provided --> + <jsp:include page="searchMessages.jsp"/> + + <div id="searchResultsList"> + <c:set var="resultSet" value="${studyResults}"/> + <jsp:include page="studyList.jsp"/> + + <c:set var="resultSet" value="${matrixResults}"/> + <jsp:include page="matrixList.jsp"/> + + <c:set var="resultSet" value="${treeResults}"/> + <jsp:include page="treeList.jsp"/> + + <c:set var="resultSet" value="${taxonResults}"/> + <jsp:include page="taxonList.jsp"/> + </div> + + <div id="output"></div> + +</div> \ No newline at end of file Added: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/mainSimpleSearchForm.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/mainSimpleSearchForm.jsp (rev 0) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/mainSimpleSearchForm.jsp 2011-04-28 23:37:52 UTC (rev 813) @@ -0,0 +1,11 @@ +<%@ include file="/common/taglibs.jsp"%> +<form id="searchSimple" method="post"> + <fieldset> + <input type="hidden" name="formName" value="mainSimple"/> + <input type="text" class="textCell" style="width:150px" name="query" id="keyword" value="${query}"/> + <input type="submit" value="Search"> + <a href="#" class="openHelp" onclick="openHelp('mainSimpleSearchForm')"> + <img class="iconButton" src="<fmt:message key="icons.help"/>" /> + </a> + </fieldset> +</form> \ No newline at end of file Modified: trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2011-04-28 21:08:13 UTC (rev 812) +++ trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2011-04-28 23:37:52 UTC (rev 813) @@ -742,11 +742,15 @@ <property name="taxonLabelService"><ref bean="taxonLabelService"></ref></property> <property name="searchService"><ref bean="searchService"></ref></property> </bean> + + <bean id="mainSearchController" parent="searchController" class="org.cipres.treebase.web.controllers.MainSearchController"> + <property name="formView"><value>search/mainSearch</value></property> + <property name="successView"><value>search/mainSearch</value></property> + </bean> <bean id="studySearchController" parent="searchController" class="org.cipres.treebase.web.controllers.StudySearchController"> <property name="formView"><value>search/studySearch</value></property> - <property name="successView"><value>search/studySearch</value></property> - + <property name="successView"><value>search/studySearch</value></property> </bean> <bean id="treeSearchController" parent="searchController" class="org.cipres.treebase.web.controllers.TreeSearchController"> @@ -1005,6 +1009,7 @@ <prop key="/search/treeTopSearch.html">treeTopSearchController</prop> <prop key="/search/matrixSearch.html">matrixSearchController</prop> <prop key="/search/taxonSearch.html">taxonSearchController</prop> + <prop key="/search/mainSearch.html">mainSearchController</prop> <!-- SEARCH RESULTS SECTION --> <prop key="/search/study/summary.html">searchSummaryController</prop> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sfr...@us...> - 2011-04-30 22:03:49
|
Revision: 824 http://treebase.svn.sourceforge.net/treebase/?rev=824&view=rev Author: sfrgpiel Date: 2011-04-30 22:03:40 +0000 (Sat, 30 Apr 2011) Log Message: ----------- Data Management Plan Verbiage Modified Paths: -------------- trunk/treebase-web/src/main/resources/ApplicationResources.properties trunk/treebase-web/src/main/webapp/WEB-INF/decorators.xml trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml Added Paths: ----------- trunk/treebase-web/src/main/webapp/WEB-INF/pages/dataMan.jsp Modified: trunk/treebase-web/src/main/resources/ApplicationResources.properties =================================================================== --- trunk/treebase-web/src/main/resources/ApplicationResources.properties 2011-04-29 18:54:30 UTC (rev 823) +++ trunk/treebase-web/src/main/resources/ApplicationResources.properties 2011-04-30 22:03:40 UTC (rev 824) @@ -79,6 +79,7 @@ nav.search=Search nav.search.treebase=Search TreeBASE nav.submit=Submit +nav.dataman=NSF Data Management Plan nav.stats=Stats nav.referee=Referee nav.urlapi= URL API Modified: trunk/treebase-web/src/main/webapp/WEB-INF/decorators.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/decorators.xml 2011-04-29 18:54:30 UTC (rev 823) +++ trunk/treebase-web/src/main/webapp/WEB-INF/decorators.xml 2011-04-30 22:03:40 UTC (rev 824) @@ -7,6 +7,7 @@ <!-- decoration page for the main opening page --> <decorator name="main" page="mainTemplate.jsp"> <pattern>/home.html</pattern> + <pattern>/dataMan.html</pattern> <pattern>/about.html</pattern> <pattern>/urlAPI.html</pattern> <pattern>/people.html</pattern> Added: trunk/treebase-web/src/main/webapp/WEB-INF/pages/dataMan.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/dataMan.jsp (rev 0) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/dataMan.jsp 2011-04-30 22:03:40 UTC (rev 824) @@ -0,0 +1,51 @@ +<%@page import="org.cipres.treebase.TreebaseUtil"%> +<% String purlBase = TreebaseUtil.getPurlBase(); %> + +<div class="gutter"> + +<h1>NSF Data Management Plan</h1> +<p>To foster the sharing and dissemination of data produced by sponsored research, the National Science Foundation requires a data management plan for all proposals. At a minimum, these data consist of whatever is necessary to validate research findings by the scientific community, which includes (1) analyzed data, and metadata that (2) provide provenance and (3) define how the data were generated. </p> +<h2>Data Ingest and Storage</h2> +<p>The three kinds of data required by NSF are accepted by TreeBASE, whether submitted directly to TreeBASE or indirectly by way of <a href="http://datadryad.org/" target="_blank">Dryad</a>. For (1), we accept NEXUS character block data with datatypes standard, continuous, DNA, RNA, and protein, and non-reticulating phylogenetic trees with branch lengths and clade support values. For (2) we parse and store character labels and state labels in submitted NEXUS files and we map taxon labels to NCBI and uBio external taxonomies. Additionally, we accept the following metadata: museum specimen numbers in accordance with the Registry of Biological Repositories (<a href="http://www.biorepositories.org" target="_blank">RBR</a>), Genbank accession numbers, other accession numbers, and Darwin Core compatible specimen metadata: collecting date, collector, latitude/longitude, elevation, country, state, and locality. For (3), we store and share the original uploaded NEXUS files (including any program-specific command blocks that can define substitution models and search parameters) as well as offer metadata files in analysis description records for annotating software, algorithm, and commands used. TreeBASE only shares data that are linked to a manuscript that is accepted by a peer reviewed publication (e.g. journal article, reviewed book or book section, academic thesis accepted by a thesis committee, etc). </p> +<h2>Data Integrity and Verification</h2> +<p>TreeBASE helps to certify data integrity by: (A) only accepting NEXUS data that are successfully parsed by a server-side headless version of <a href="http://mesquiteproject.org/" target="_blank">Mesquite</a>, (B) verifying that taxon labels in matrices and relevant trees are consistent, (C) verifying that data objects are not 'orphaned' (i.e. unlinked to an analysis), and (D) verifying that taxon labels are recognizable by biologists, spelled correctly, and mapped to external taxonomies whenever possible. TreeBASE provides a special advanced access URL for anonymous reviewers and referees to provide additional quality control. Although additional NSF requirements relating to provenance and how data were generated are not normally required or scrutinized by TreeBASE, submitters who flag their submission as NSF-sponsored data will receive special attention by our staff. In these cases, TreeBASE staff will check to make sure that provenance and analysis metadata are adequately provided, and, as needed, communicate with the submitter and assist in properly formatting and ingesting these data. </p> +<h2>Data Standards and Dissemination</h2> +<p>TreeBASE plans to remain in compliance with the emerging, but still evolving, standard of Minimal Information for a Phylogenetic Analysis (<a href="http://www.nescent.org/sites/evoio/MIAPA" target="_blank">MIAPA</a>). In addition, TreeBASE publishes persistant and resolvable globally unique identifiers for all major data objects and disseminates data and metadata using commonly accepted standards. A Restful <a href="http://www.nescent.org/wg/evoinfo/index.php?title=PhyloWS" target="_blank">PhyloWS</a> API exposes metadata using RSS feeds in RDF; a <a href="http://www.nexml.org/" target="_blank">NeXML</a> serialization exposes data marked up with metadata using published vocabularies and fully qualified URIs in compliance with <a href="http://linkeddata.org/" target="_blank">Linked Data</a> standards. Basic record metadata are published through an OIA-PMH service and records are mirrored by Dryad, which provides a secondary Dryad <a href="http://www.datacite.org" target="_blank">DataCite DOI</a>. However, for most people in the scientific community, data will be retrieved using the web user interface and downloaded in the NEXUS format, and metadata will be downloaded in tab-separated text format. </p> +<h2>Data Persistance</h2> +<p>Although no data service can guarantee indefinite persistance, TreeBASE will make every effort to preserve it services as long as possible. Additionally, the Articles of Incorporation of the <a href="http://www.phylofoundation.org" target="_blank">Phyloinformatics Research Foundation</a>, which oversees TreeBASE activities, specifies that if dissolution is ever required the assets will be transferred to a similar entity with a comparable mission. </p> +<h2>Preparing a Data Management Plan for NSF</h2> +<p>Scientists are welcome to designate TreeBASE as their selected repository and dissemination service for phylogenetic data generated by sponsored research. In this document, the following should be mentioned:</p> +<ul> + <li>Specify the name(s) of the person(s) responsible for preparing the data matrices, trees, and metadata for submission to TreeBASE.</li> + <li>Identify the kinds of data that will be submitted, including provenance and analysis metadata as outlined above. For metadata not accepted by TreeBASE (e.g. digital images of specimens), identify other repositories where these will be stored (e.g. <a href="http://www.morphbank.net/" target="_blank">Morphbank</a> or <a href="http://www.morphobank.org/" target="_blank">Morphobank</a>), and indicate how these data objects will be linked between TreeBASE data and the other repository (e.g. using shared specimen catalog numbers). </li> + <li>For your phylogenetic data, you can report that your data will be serialized using TreeBASE's data formats: NEXUS, for character and tree data alone, and NeXML for these data plus marked up with supplied metadata (e.g. basic Dublin Core publication data, basic Darwin Core specimen information, RBR collection codes and catalog numbers, uBio and NCBI taxon identification numbers, and Genbank accession numbers).</li> + <li>Provide an overview of access and sharing. For your TreeBASE-submitted data, you can state that TreeBASE makes all data and metadata freely available to the public once the manuscript under review has been accepted by a peer-reviewed publisher. TreeBASE will allow for data embargo periods according to the policies of the journal, but once data are public they are assumed to be released to the public domain without any restrictions on reuse. We recommend that you state that you will provide TreeBASE's resolvable GUIDs for your deposited data in future progress reports to NSF, in relevant publications, and in your lab's web page. </li> + <li>State that you will flag your submissions to TreeBASE as data subject to your data management plan so as to receive special attention by TreeBASE staff to help ensure that the data are richly annotated and fully compliant for maximum reuse in accordance with community standards in phylogenetics. </li> +</ul> +<p>TreeBASE suggests that for each submission of data from sponsored research you contribute at least $50 towards defraying the costs of storage and dissemination, as well as in support of the additional scrutiny by TreeBASE staff for NSF data management compliance. This fee is collected by the Phyloinformatics Research Foundation, which overseas TreeBASE activities. Anticipated cost can be budgeted under publication expenses on your grant proposal's budget. </p> +<p><hr /></p> +<table width="100%" border="0"> + <tr> + <td width="50%" valign="top">Data storage contribution for sponsored research:</td> + <td width="50%" valign="top">Alternatively, please consider a donation towards TreeBASE activities:</td> + </tr> + <tr> + <td><form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> +<input type="hidden" name="cmd" value="_s-xclick"> +<input type="hidden" name="hosted_button_id" value="DMT5Y327LZMDA"> +<table> +<tr><td><input type="hidden" name="on0" value="TreeBASE Study URI:">TreeBASE Study URI:</td></tr><tr><td><input type="text" name="os0" maxlength="60"></td></tr> +</table> +<input type="image" src="http://www.phylofoundation.org/icns/sub.jpg" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> +<img alt="" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/i/scr/pixel.gif" width="1" height="1"> +</form></td> + <td><form action="https://www.paypal.com/cgi-bin/webscr" method="post"> +<input type="hidden" name="cmd" value="_s-xclick"> +<input type="hidden" name="hosted_button_id" value="W9YAU65RHGZRC"> +<input type="image" src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> +<img alt="" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/i/scr/pixel.gif" width="1" height="1"> +</form></td> + </tr> +</table> + +</div> \ No newline at end of file Modified: trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2011-04-29 18:54:30 UTC (rev 823) +++ trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2011-04-30 22:03:40 UTC (rev 824) @@ -921,7 +921,8 @@ <prop key="/phylows/taxon/**">phyloWSTaxonController</prop> <prop key="/phylows/tree/**">phyloWSTreeController</prop> <prop key="/phylows/matrix/**">phyloWSMatrixController</prop> - <prop key="/about.html">filenameController</prop> + <prop key="/about.html">filenameController</prop> + <prop key="/dataMan.html">filenameController</prop> <prop key="/home.html">filenameController</prop> <prop key="/login.html">filenameController</prop> <prop key="/urlAPI.html">filenameController</prop> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |