You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
(1) |
Apr
(14) |
May
(36) |
Jun
(148) |
Jul
(33) |
Aug
(2) |
Sep
(17) |
Oct
(42) |
Nov
(137) |
Dec
(88) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(89) |
Feb
(80) |
Mar
(217) |
Apr
(76) |
May
(5) |
Jun
(39) |
Jul
(35) |
Aug
(4) |
Sep
(7) |
Oct
(14) |
Nov
(12) |
Dec
(9) |
2011 |
Jan
(6) |
Feb
(4) |
Mar
(11) |
Apr
(55) |
May
(90) |
Jun
(39) |
Jul
(15) |
Aug
(15) |
Sep
(23) |
Oct
(12) |
Nov
(17) |
Dec
(20) |
2012 |
Jan
(22) |
Feb
(63) |
Mar
|
Apr
(1) |
May
(6) |
Jun
(3) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
(3) |
Feb
(6) |
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <rv...@us...> - 2012-01-31 21:10:54
|
Revision: 1025 http://treebase.svn.sourceforge.net/treebase/?rev=1025&view=rev Author: rvos Date: 2012-01-31 21:10:45 +0000 (Tue, 31 Jan 2012) Log Message: ----------- Added test to ensure a missing state has been seen in the matrix. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-01-31 20:53:32 UTC (rev 1024) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-01-31 21:10:45 UTC (rev 1025) @@ -103,7 +103,9 @@ xmlState.setLabel(symString); attachTreeBaseID((Annotatable)xmlState,tbState,DiscreteCharState.class); } - missing.setStates(xmlMissingStates); + if ( null != missing ) { + missing.setStates(xmlMissingStates); + } // then create the XML characters, assigning them all the same state set List<MatrixColumn> tbColumns = tbMatrix.getColumnsReadOnly(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-01-31 20:53:41
|
Revision: 1024 http://treebase.svn.sourceforge.net/treebase/?rev=1024&view=rev Author: rvos Date: 2012-01-31 20:53:32 +0000 (Tue, 31 Jan 2012) Log Message: ----------- This should result in the correct identifiers being set for each state, and all states other than missing being added to the set of possible states within the missing state set. This includes the gap character. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-01-31 20:21:36 UTC (rev 1023) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-01-31 20:53:32 UTC (rev 1024) @@ -82,20 +82,28 @@ // then create the single state set out of the map, assigning all non-missing characters to missing Set<CharacterState> xmlMissingStates = new HashSet<CharacterState>(); + UncertainCharacterState missing = null; for ( Character symbol : stateForSymbol.keySet() ) { - if ( symbol.charValue() != '?' && symbol.charValue() != '-' ) { - CharacterState xmlState = xmlStateSet.createCharacterState(symbol.toString()); - DiscreteCharState tbState = stateForSymbol.get(symbol); - xmlState.setLabel(tbState.getLabel()); - attachTreeBaseID((Annotatable)xmlState,tbState,DiscreteCharState.class); + char sym = symbol.charValue(); + CharacterState xmlState = null; + String symString = symbol.toString(); + if ( sym == '-' ) { + xmlState = xmlStateSet.createUncertainCharacterState(symString, new HashSet<CharacterState>()); xmlMissingStates.add(xmlState); } - } - UncertainCharacterState gap = xmlStateSet.createUncertainCharacterState("-", new HashSet<CharacterState>()); - xmlMissingStates.add(gap); - UncertainCharacterState missing = xmlStateSet.createUncertainCharacterState("?", xmlMissingStates); - missing.setLabel("?"); - gap.setLabel("-"); + else if ( sym == '?' ) { + xmlState = xmlStateSet.createUncertainCharacterState(symString, new HashSet<CharacterState>()); + missing = (UncertainCharacterState) xmlState; + } + else { + xmlState = xmlStateSet.createCharacterState(symString); + xmlMissingStates.add(xmlState); + } + DiscreteCharState tbState = stateForSymbol.get(symbol); + xmlState.setLabel(symString); + attachTreeBaseID((Annotatable)xmlState,tbState,DiscreteCharState.class); + } + missing.setStates(xmlMissingStates); // then create the XML characters, assigning them all the same state set List<MatrixColumn> tbColumns = tbMatrix.getColumnsReadOnly(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-01-31 20:21:46
|
Revision: 1023 http://treebase.svn.sourceforge.net/treebase/?rev=1023&view=rev Author: rvos Date: 2012-01-31 20:21:36 +0000 (Tue, 31 Jan 2012) Log Message: ----------- Re-ordered state set generation so that "missing" is populated with all other states. Also, set the assignment of the XML id before any annotations are added, this so that the about attribute is updated correctly. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-01-31 19:53:12 UTC (rev 1022) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-01-31 20:21:36 UTC (rev 1023) @@ -79,27 +79,23 @@ stateForSymbol.put(symbol, state); } } - UncertainCharacterState missing = xmlStateSet.createUncertainCharacterState("?", new HashSet<CharacterState>()); - UncertainCharacterState gap = xmlStateSet.createUncertainCharacterState("-", new HashSet<CharacterState>()); - missing.getStates().add(gap); - // then create the single state set out of the map, assigning all non-gap characters to missing + // then create the single state set out of the map, assigning all non-missing characters to missing + Set<CharacterState> xmlMissingStates = new HashSet<CharacterState>(); for ( Character symbol : stateForSymbol.keySet() ) { - CharacterState xmlState = null; - if ( symbol.charValue() == '?' ) { - xmlState = missing; + if ( symbol.charValue() != '?' && symbol.charValue() != '-' ) { + CharacterState xmlState = xmlStateSet.createCharacterState(symbol.toString()); + DiscreteCharState tbState = stateForSymbol.get(symbol); + xmlState.setLabel(tbState.getLabel()); + attachTreeBaseID((Annotatable)xmlState,tbState,DiscreteCharState.class); + xmlMissingStates.add(xmlState); } - else if ( symbol.charValue() == '-' ) { - xmlState = gap; - } - else { - xmlState = xmlStateSet.createCharacterState(symbol.toString()); - missing.getStates().add(xmlState); - } - DiscreteCharState tbState = stateForSymbol.get(symbol); - xmlState.setLabel(tbState.getLabel()); - attachTreeBaseID((Annotatable)xmlState,tbState,DiscreteCharState.class); - } + } + UncertainCharacterState gap = xmlStateSet.createUncertainCharacterState("-", new HashSet<CharacterState>()); + xmlMissingStates.add(gap); + UncertainCharacterState missing = xmlStateSet.createUncertainCharacterState("?", xmlMissingStates); + missing.setLabel("?"); + gap.setLabel("-"); // then create the XML characters, assigning them all the same state set List<MatrixColumn> tbColumns = tbMatrix.getColumnsReadOnly(); @@ -120,16 +116,16 @@ } private void setMatrixAttributes(org.nexml.model.Matrix<?> xmlMatrix,CharacterMatrix tbMatrix) { - xmlMatrix.addAnnotationValue("skos:historyNote", Constants.SKOSURI, "Mapped from TreeBASE schema using "+this.toString()+" $Rev$"); - xmlMatrix.setBaseURI(mMatrixBaseURI); - xmlMatrix.setLabel(tbMatrix.getLabel()); - // attach matrix identifiers attachTreeBaseID((Annotatable)xmlMatrix, tbMatrix,Matrix.class); String tb1MatrixID = tbMatrix.getTB1MatrixID(); if ( null != tb1MatrixID ) { ((Annotatable)xmlMatrix).addAnnotationValue("tb:identifier.matrix.tb1", Constants.TBTermsURI, tb1MatrixID); } + + xmlMatrix.addAnnotationValue("skos:historyNote", Constants.SKOSURI, "Mapped from TreeBASE schema using "+this.toString()+" $Rev$"); + xmlMatrix.setBaseURI(mMatrixBaseURI); + xmlMatrix.setLabel(tbMatrix.getLabel()); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-01-31 19:53:18
|
Revision: 1022 http://treebase.svn.sourceforge.net/treebase/?rev=1022&view=rev Author: rvos Date: 2012-01-31 19:53:12 +0000 (Tue, 31 Jan 2012) Log Message: ----------- This should make a single state set for all symbols in a standard matrix. This is more concise so it should fix recent harvesting issues. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-01-26 16:56:16 UTC (rev 1021) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-01-31 19:53:12 UTC (rev 1022) @@ -1,7 +1,10 @@ package org.cipres.treebase.domain.nexus.nexml; import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import org.cipres.treebase.Constants; @@ -34,6 +37,7 @@ import org.nexml.model.OTUs; import org.nexml.model.OTU; import org.nexml.model.Subset; +import org.nexml.model.UncertainCharacterState; public class NexmlMatrixWriter extends NexmlObjectConverter { @@ -64,18 +68,43 @@ CategoricalMatrix xmlMatrix = getDocument().createCategoricalMatrix(xmlOTUs); setMatrixAttributes(xmlMatrix,tbMatrix); + // first flatten the two-dimensional list into a map, we will always only create a single state set List<List<DiscreteCharState>> tbStateLabels = tbMatrix.getStateLabels(); + Map<Character,DiscreteCharState> stateForSymbol = new HashMap<Character,DiscreteCharState>(); + CharacterStateSet xmlStateSet = xmlMatrix.createCharacterStateSet(); + for ( int i = 0; i < tbStateLabels.size(); i++ ) { + for ( int j = 0; j < tbStateLabels.get(i).size(); j++ ) { + Character symbol = tbStateLabels.get(i).get(j).getSymbol(); + DiscreteCharState state = tbStateLabels.get(i).get(j); + stateForSymbol.put(symbol, state); + } + } + UncertainCharacterState missing = xmlStateSet.createUncertainCharacterState("?", new HashSet<CharacterState>()); + UncertainCharacterState gap = xmlStateSet.createUncertainCharacterState("-", new HashSet<CharacterState>()); + missing.getStates().add(gap); + + // then create the single state set out of the map, assigning all non-gap characters to missing + for ( Character symbol : stateForSymbol.keySet() ) { + CharacterState xmlState = null; + if ( symbol.charValue() == '?' ) { + xmlState = missing; + } + else if ( symbol.charValue() == '-' ) { + xmlState = gap; + } + else { + xmlState = xmlStateSet.createCharacterState(symbol.toString()); + missing.getStates().add(xmlState); + } + DiscreteCharState tbState = stateForSymbol.get(symbol); + xmlState.setLabel(tbState.getLabel()); + attachTreeBaseID((Annotatable)xmlState,tbState,DiscreteCharState.class); + } + + // then create the XML characters, assigning them all the same state set List<MatrixColumn> tbColumns = tbMatrix.getColumnsReadOnly(); for ( int i = 0; i < tbColumns.size(); i++ ) { - MatrixColumn tbColumn = tbColumns.get(i); - CharacterStateSet xmlStateSet = xmlMatrix.createCharacterStateSet(); - for ( DiscreteCharState tbState : tbStateLabels.get(i) ) { - CharacterState xmlState = xmlStateSet.createCharacterState(tbState.getSymbol().toString()); - if ( null != tbState.getDescription() ) { - xmlState.setLabel(tbState.getDescription()); - } - attachTreeBaseID((Annotatable)xmlState,tbState,DiscreteCharState.class); - } + MatrixColumn tbColumn = tbColumns.get(i); org.nexml.model.Character xmlCharacter = xmlMatrix.createCharacter(xmlStateSet); setCharacterAttributes(tbColumn, xmlCharacter); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sfr...@us...> - 2012-01-26 16:56:27
|
Revision: 1021 http://treebase.svn.sourceforge.net/treebase/?rev=1021&view=rev Author: sfrgpiel Date: 2012-01-26 16:56:16 +0000 (Thu, 26 Jan 2012) Log Message: ----------- BibTeX and RIS clutter the summary page, so this hides them by default with toggle function to display. Modified Paths: -------------- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/summary.jsp trunk/treebase-web/src/main/webapp/decorators/defaultSearchTemplate.jsp Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/summary.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/summary.jsp 2012-01-25 19:22:51 UTC (rev 1020) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/summary.jsp 2012-01-26 16:56:16 UTC (rev 1021) @@ -116,17 +116,20 @@ RDF </a> */ %> </li> + + <li><a onclick="toggle_visibility('bibtexfoo');">Show BibTeX reference</a> + <pre id="bibtexfoo" style="display:none;width:100%;overflow:scroll"> + <c:out value="${cit.bibtexReference}"/> + </pre> + </li> + + <li><a onclick="toggle_visibility('risfoo');">Show RIS reference</a> + <pre id="risfoo" style="display:none;width:100%;overflow:scroll"> + <c:out value="${cit.risReference}"/> + </pre> + </li> </ul> -<h3>BibTeX reference</h3> -<pre style="width:100%;overflow:scroll"> -<c:out value="${cit.bibtexReference}"/> -</pre> -<h3>RIS reference</h3> -<pre style="width:100%;overflow:scroll"> -<c:out value="${cit.risReference}"/> -</pre> - </body> \ No newline at end of file Modified: trunk/treebase-web/src/main/webapp/decorators/defaultSearchTemplate.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/decorators/defaultSearchTemplate.jsp 2012-01-25 19:22:51 UTC (rev 1020) +++ trunk/treebase-web/src/main/webapp/decorators/defaultSearchTemplate.jsp 2012-01-26 16:56:16 UTC (rev 1021) @@ -109,6 +109,14 @@ RemoteUniqueOtherAlgorithmService.findAllUniqueOtherAlgorithmDescriptions(token, function(data) { autocompleter.setChoices(data) }); } + function toggle_visibility(id) { + var e = document.getElementById(id); + if(e.style.display == 'block') + e.style.display = 'none'; + else + e.style.display = 'block'; + } + //]]> </script> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sfr...@us...> - 2012-01-25 19:22:57
|
Revision: 1020 http://treebase.svn.sourceforge.net/treebase/?rev=1020&view=rev Author: sfrgpiel Date: 2012-01-25 19:22:51 +0000 (Wed, 25 Jan 2012) Log Message: ----------- Removing NEXUS in new window because force download is now implemented Modified Paths: -------------- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyList.jsp Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyList.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyList.jsp 2012-01-24 17:45:25 UTC (rev 1019) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyList.jsp 2012-01-25 19:22:51 UTC (rev 1020) @@ -75,7 +75,7 @@ headerClass="iconColumn" sortable="false"> <c:set var="baseLink" value="${study.phyloWSPath.purl}"/> - <a href="${baseLink}?format=nexus" target="_blank"> + <a href="${baseLink}?format=nexus"> <img class="iconButton" src="<fmt:message key="icons.download.reconstructed"/>" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sfr...@us...> - 2012-01-24 17:45:36
|
Revision: 1019 http://treebase.svn.sourceforge.net/treebase/?rev=1019&view=rev Author: sfrgpiel Date: 2012-01-24 17:45:25 +0000 (Tue, 24 Jan 2012) Log Message: ----------- Would look nicer if the icons were side-by-side Modified Paths: -------------- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyList.jsp Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyList.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyList.jsp 2012-01-24 17:29:01 UTC (rev 1018) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyList.jsp 2012-01-24 17:45:25 UTC (rev 1019) @@ -71,7 +71,7 @@ </display:column> <display:column - class="iconColumn" + class="iconColumn noBreak" headerClass="iconColumn" sortable="false"> <c:set var="baseLink" value="${study.phyloWSPath.purl}"/> @@ -82,6 +82,13 @@ title="<fmt:message key="download.reconstructedfile"/>" alt="<fmt:message key="download.reconstructedfile"/>"/> </a> + </display:column> + + <display:column + class="iconColumn" + headerClass="iconColumn" + sortable="false"> + <c:set var="baseLink" value="${study.phyloWSPath.purl}"/> <a href="${baseLink}?format=nexml" target="_blank"> <img class="iconButton" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sfr...@us...> - 2012-01-24 17:29:12
|
Revision: 1018 http://treebase.svn.sourceforge.net/treebase/?rev=1018&view=rev Author: sfrgpiel Date: 2012-01-24 17:29:01 +0000 (Tue, 24 Jan 2012) Log Message: ----------- Adding data download links to the study search result list. Modified Paths: -------------- trunk/treebase-web/src/main/resources/ApplicationResources.properties trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyList.jsp Modified: trunk/treebase-web/src/main/resources/ApplicationResources.properties =================================================================== --- trunk/treebase-web/src/main/resources/ApplicationResources.properties 2012-01-20 14:04:31 UTC (rev 1017) +++ trunk/treebase-web/src/main/resources/ApplicationResources.properties 2012-01-24 17:29:01 UTC (rev 1018) @@ -192,6 +192,7 @@ citation.keywords= Keywords citation.pmid= PubMed ID citation.doi=DOI +citation.weblink=Link to Publication citation.abstract = Abstract citation.url = URL citation.type=Citation Type @@ -212,8 +213,8 @@ citation.update.success = Citation has been updated successfully #-- study -- -study.title = TreeBASE Submission Information -study.update.title = Update Treebase Submission +study.title = Submission Information +study.update.title = Update TreeBASE Submission study.id = Submission ID study.name = Name of study study.notes = Notes for study @@ -310,7 +311,7 @@ matrix.include = Included? matrix.description = Description download.original = Download Original File -download.reconstructedfile = Download Reconstructed File +download.reconstructedfile = Download Reconstructed NEXUS File download.unavailable = File download currently not available download.nexml = Download NeXML File download.json = Download JSON File Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyList.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyList.jsp 2012-01-20 14:04:31 UTC (rev 1017) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyList.jsp 2012-01-24 17:29:01 UTC (rev 1018) @@ -48,7 +48,10 @@ <c:if test="${not empty study.citation.doi}"> <c:set var="DOIResource" value="${DOIResolver}${study.citation.doi}"/> <a href="${DOIResource}" target="_blank"> - <img class="iconButton" src="<fmt:message key="icons.weblink"/>" /> + <img class="iconButton" + src="<fmt:message key="icons.weblink"/>" + title="<fmt:message key="citation.weblink"/>" + alt="<fmt:message key="citation.weblink"/>"/> <!-- ${study.citation.doi} --></a> </c:if> </display:column> @@ -58,7 +61,7 @@ url="/search/study/summary.html" paramId="id" paramProperty="id" - class="iconColumn" + class="iconColumn noBreak" headerClass="iconColumn"> <img class="iconButton" @@ -66,6 +69,27 @@ title="<fmt:message key="study.title"/>" alt="<fmt:message key="study.title"/>"/> </display:column> + + <display:column + class="iconColumn" + headerClass="iconColumn" + sortable="false"> + <c:set var="baseLink" value="${study.phyloWSPath.purl}"/> + <a href="${baseLink}?format=nexus" target="_blank"> + <img + class="iconButton" + src="<fmt:message key="icons.download.reconstructed"/>" + title="<fmt:message key="download.reconstructedfile"/>" + alt="<fmt:message key="download.reconstructedfile"/>"/> + </a> + <a href="${baseLink}?format=nexml" target="_blank"> + <img + class="iconButton" + src="<fmt:message key="icons.xml"/>" + title="<fmt:message key="download.nexml"/>" + alt="<fmt:message key="download.nexml"/>"/> + </a> + </display:column> <display:footer> <tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-01-20 14:04:40
|
Revision: 1017 http://treebase.svn.sourceforge.net/treebase/?rev=1017&view=rev Author: rvos Date: 2012-01-20 14:04:31 +0000 (Fri, 20 Jan 2012) Log Message: ----------- Forgot to set the @Transient annotation on the getStudy() method in these. Hopefully this addresses the build issues. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/AbstractPersistedObject.java trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/DistanceMatrixElement.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/AbstractPersistedObject.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/AbstractPersistedObject.java 2012-01-20 01:47:48 UTC (rev 1016) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/AbstractPersistedObject.java 2012-01-20 14:04:31 UTC (rev 1017) @@ -170,6 +170,7 @@ * (non-Javadoc) * @see org.cipres.treebase.domain.TBPersistable#getStudy() */ + @Transient public Study getStudy() { return null; } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/DistanceMatrixElement.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/DistanceMatrixElement.java 2012-01-20 01:47:48 UTC (rev 1016) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/DistanceMatrixElement.java 2012-01-20 14:04:31 UTC (rev 1017) @@ -7,6 +7,7 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; +import javax.persistence.Transient; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; @@ -115,6 +116,7 @@ mMatrix = pNewMatrix; } + @Transient public Study getStudy() { return getMatrix().getStudy(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-01-20 01:47:54
|
Revision: 1016 http://treebase.svn.sourceforge.net/treebase/?rev=1016&view=rev Author: rvos Date: 2012-01-20 01:47:48 +0000 (Fri, 20 Jan 2012) Log Message: ----------- Adding unimplemented getStudy() method to mockobject Modified Paths: -------------- trunk/treebase-core/src/test/java/org/cipres/treebase/TBMockObject.java Modified: trunk/treebase-core/src/test/java/org/cipres/treebase/TBMockObject.java =================================================================== --- trunk/treebase-core/src/test/java/org/cipres/treebase/TBMockObject.java 2012-01-19 22:41:40 UTC (rev 1015) +++ trunk/treebase-core/src/test/java/org/cipres/treebase/TBMockObject.java 2012-01-20 01:47:48 UTC (rev 1016) @@ -5,6 +5,7 @@ import org.cipres.treebase.domain.Annotation; import org.cipres.treebase.domain.TBPersistable; +import org.cipres.treebase.domain.study.Study; /** * A trivial, nonpersistent TBPersistable object, useful for incorporation into test classes. @@ -85,4 +86,9 @@ return null; } + public Study getStudy() { + // TODO Auto-generated method stub + return null; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-01-19 22:41:46
|
Revision: 1015 http://treebase.svn.sourceforge.net/treebase/?rev=1015&view=rev Author: rvos Date: 2012-01-19 22:41:40 +0000 (Thu, 19 Jan 2012) Log Message: ----------- In the previous revision, line 73 assumed that all objects are studies, such that we can check whether they are under embargo. This doesn't make sense as this controller operates on any object, whether study or otherwise. Hence I've added getStudy() methods to all domain objects, which either return the containing study or null in the case that the focal object doesn't logically belong to a study (e.g. in the case of a genetic code symbol). If the object does belong to a study we can then test whether it is published or not. Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AnyObjectAsRDFController.java Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AnyObjectAsRDFController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AnyObjectAsRDFController.java 2012-01-19 22:38:16 UTC (rev 1014) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AnyObjectAsRDFController.java 2012-01-19 22:41:40 UTC (rev 1015) @@ -70,7 +70,8 @@ TBPersistable theObject = getStudyService().findByID(theClass, treebaseIDString.getId()); if ( null != theObject ) { - if (! getStudyService().findByID(treebaseIDString.getId()).isPublished()) { + Study theContainingStudy = theObject.getStudy(); + if (null != theContainingStudy && ! theContainingStudy.isPublished()) { response.setContentType("text/plain"); response.setStatus(HttpServletResponse.SC_SEE_OTHER); response.setHeader("Location", "/treebase-web/accessviolation.html"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-01-19 22:38:23
|
Revision: 1014 http://treebase.svn.sourceforge.net/treebase/?rev=1014&view=rev Author: rvos Date: 2012-01-19 22:38:16 +0000 (Thu, 19 Jan 2012) Log Message: ----------- Adding interface method and implementations for getStudy(). This so we can determine for any object i. whether it logically belongs to a Study (e.g. User objects don't, but trees do) ii. subsequently whether the data object is under embargo. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/AbstractPersistedObject.java trunk/treebase-core/src/main/java/org/cipres/treebase/domain/TBPersistable.java trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/DistanceMatrixElement.java trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/MatrixColumn.java trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/MatrixElement.java trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/MatrixRow.java trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/RowSegment.java trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/AnalysisStep.java trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/AnalyzedData.java trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/Study.java trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/PhyloTreeNode.java trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/TreeBlock.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/AbstractPersistedObject.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/AbstractPersistedObject.java 2012-01-11 17:02:42 UTC (rev 1013) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/AbstractPersistedObject.java 2012-01-19 22:38:16 UTC (rev 1014) @@ -18,6 +18,7 @@ import org.cipres.treebase.PhyloWSPath; import org.cipres.treebase.TreebaseIDString; import org.cipres.treebase.TreebaseUtil; +import org.cipres.treebase.domain.study.Study; import org.hibernate.annotations.GenericGenerator; /** @@ -165,4 +166,12 @@ return this.getNamespacedGUID().toString(); } + /* + * (non-Javadoc) + * @see org.cipres.treebase.domain.TBPersistable#getStudy() + */ + public Study getStudy() { + return null; + } + } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/TBPersistable.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/TBPersistable.java 2012-01-11 17:02:42 UTC (rev 1013) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/TBPersistable.java 2012-01-19 22:38:16 UTC (rev 1014) @@ -4,6 +4,7 @@ import org.cipres.treebase.NamespacedGUID; import org.cipres.treebase.PhyloWSPath; import org.cipres.treebase.TreebaseIDString; +import org.cipres.treebase.domain.study.Study; /** * A tagging interface for all persisted treebase objects. @@ -31,11 +32,6 @@ public static final int CITATION_TITLE_COLUMN_LENGTH = 500; public static final int CITATION_ABSTRACT_COLUMN_LENGTH = 10000; - /** - * Return the id. - * - * @return - */ public Long getId(); public TreebaseIDString getTreebaseIDString (); @@ -44,6 +40,20 @@ public PhyloWSPath getPhyloWSPath (); + /** + * Is an object that implements this is logically + * part of a containing object (e.g. a node is part + * of a tree), this method returns that containing + * object. + * @return + */ public TBPersistable getContext (); + + /** + * If an object that implements this logically belongs to a Study, + * this method returns that Study. Otherwise returns null. + * @return + */ + public Study getStudy(); } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/DistanceMatrixElement.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/DistanceMatrixElement.java 2012-01-11 17:02:42 UTC (rev 1013) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/DistanceMatrixElement.java 2012-01-19 22:38:16 UTC (rev 1014) @@ -12,6 +12,7 @@ import org.hibernate.annotations.CacheConcurrencyStrategy; import org.cipres.treebase.domain.AbstractPersistedObject; +import org.cipres.treebase.domain.study.Study; import org.cipres.treebase.domain.taxon.TaxonLabel; /** @@ -113,5 +114,9 @@ public void setMatrix(DistanceMatrix pNewMatrix) { mMatrix = pNewMatrix; } + + public Study getStudy() { + return getMatrix().getStudy(); + } } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/MatrixColumn.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/MatrixColumn.java 2012-01-11 17:02:42 UTC (rev 1013) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/MatrixColumn.java 2012-01-19 22:38:16 UTC (rev 1014) @@ -23,6 +23,7 @@ import org.hibernate.annotations.Index; import org.cipres.treebase.domain.AbstractPersistedObject; +import org.cipres.treebase.domain.study.Study; /** * MatrixColumn.java @@ -153,4 +154,9 @@ if (theMatrix == null) { return null; } return theMatrix.getColumnsReadOnly().indexOf(this); } + + @Transient + public Study getStudy() { + return getMatrix().getStudy(); + } } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/MatrixElement.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/MatrixElement.java 2012-01-11 17:02:42 UTC (rev 1013) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/MatrixElement.java 2012-01-19 22:38:16 UTC (rev 1014) @@ -25,6 +25,7 @@ import org.hibernate.annotations.Index; import org.cipres.treebase.domain.AbstractPersistedObject; +import org.cipres.treebase.domain.study.Study; /** * MatrixElement.java @@ -157,4 +158,9 @@ public CharacterMatrix getContext() { return getColumn().getMatrix(); } + + @Transient + public Study getStudy() { + return getContext().getStudy(); + } } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/MatrixRow.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/MatrixRow.java 2012-01-11 17:02:42 UTC (rev 1013) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/MatrixRow.java 2012-01-19 22:38:16 UTC (rev 1014) @@ -5,6 +5,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; import javax.persistence.AttributeOverride; @@ -28,6 +29,7 @@ import org.cipres.treebase.TreebaseUtil; import org.cipres.treebase.domain.AbstractPersistedObject; +import org.cipres.treebase.domain.study.Study; import org.cipres.treebase.domain.taxon.TaxonLabel; /** @@ -149,10 +151,14 @@ /** * Represents all the elements as symbols in one string. - * For one character one symbol, This can handle 512k size of characters in a matrix. + * This can handle 512k size of characters in a matrix. * * It is precalculated and stored for faster generating nexus blocks. * + * Note that for ambiguous states (e.g. N in a DNA sequence) this + * returns a list of all fundamental states that comprise the ambiguous + * state, i.e. instead of N, this returns {ACGT} + * * @return String */ @Lob @@ -160,6 +166,51 @@ public String getSymbolString() { return mSymbolString; } + + + /** + * Represents all the elements as symbols in one string. + * + * Note that this method post-processes the output of getSymbolString(), i.e. + * if that method returns an {ACGT} this method replaces that with whatever + * ambiguity mapping was provided. E.g. if the map pMapping holds a slot for + * "ACGT" => "N" this method will return that N instead. + * + * @return String + */ + @Transient + public String getSymbolString(Map<String,String> pMapping) { + String inputString = getSymbolString(); + StringBuffer outputString = new StringBuffer(); + List<Character> ambiguous = new ArrayList<Character>(); + boolean isAmbiguous = false; + for ( int i = 0; i < inputString.length(); i++ ) { + char current = inputString.charAt(i); + if ( current == '{' ) { + isAmbiguous = true; + ambiguous.clear(); + continue; + } + if ( current == '}' ) { + isAmbiguous = false; + Collections.sort(ambiguous); + StringBuffer ambigBuffer = new StringBuffer(); + ambigBuffer.append(ambiguous.toArray(new Character[ambiguous.size()])); + String ambigString = ambigBuffer.toString(); + if ( pMapping.containsKey(ambigString) ) { + outputString.append(pMapping.get(ambigString)); + } + continue; + } + if ( isAmbiguous ) { + ambiguous.add(current); + } + else { + outputString.append(current); + } + } + return outputString.toString(); + } /** * Set the SymbolString field. @@ -356,4 +407,9 @@ if (syms == null) { return "(no data)"; } return syms.length() >= DISPLAY_STRING_LENGTH ? syms.substring(0, DISPLAY_STRING_LENGTH) : syms; } + + @Transient + public Study getStudy() { + return getMatrix().getStudy(); + } } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/RowSegment.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/RowSegment.java 2012-01-11 17:02:42 UTC (rev 1013) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/RowSegment.java 2012-01-19 22:38:16 UTC (rev 1014) @@ -23,6 +23,7 @@ import org.cipres.treebase.domain.AbstractPersistedObject; import org.cipres.treebase.domain.TBPersistable; import org.cipres.treebase.domain.matrix.RowSegmentService.RowSegmentField; +import org.cipres.treebase.domain.study.Study; import org.cipres.treebase.domain.taxon.SpecimenLabel; import org.cipres.treebase.domain.taxon.TaxonLabel; import org.cipres.treebase.framework.ExecutionResult; @@ -563,4 +564,9 @@ public void setChecked(boolean pChecked) { mChecked = pChecked; } + + @Transient + public Study getStudy() { + return getMatrixRow().getStudy(); + } } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/AnalysisStep.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/AnalysisStep.java 2012-01-11 17:02:42 UTC (rev 1013) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/AnalysisStep.java 2012-01-19 22:38:16 UTC (rev 1014) @@ -354,5 +354,10 @@ if (index == -1) return null; return index; } + + @Transient + public Study getStudy() { + return getAnalysis().getStudy(); + } } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/AnalyzedData.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/AnalyzedData.java 2012-01-11 17:02:42 UTC (rev 1013) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/AnalyzedData.java 2012-01-19 22:38:16 UTC (rev 1014) @@ -161,4 +161,9 @@ */ @Transient public abstract String getDisplayName(); + + @Transient + public Study getStudy() { + return getAnalysisStep().getStudy(); + } } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/Study.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/Study.java 2012-01-11 17:02:42 UTC (rev 1013) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/Study.java 2012-01-19 22:38:16 UTC (rev 1014) @@ -748,5 +748,10 @@ } return annotations; } + + @Transient + public Study getStudy() { + return this; + } } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/PhyloTreeNode.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/PhyloTreeNode.java 2012-01-11 17:02:42 UTC (rev 1013) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/PhyloTreeNode.java 2012-01-19 22:38:16 UTC (rev 1014) @@ -24,6 +24,7 @@ import org.cipres.treebase.TreebaseUtil; import org.cipres.treebase.domain.AbstractPersistedObject; import org.cipres.treebase.domain.TBPersistable; +import org.cipres.treebase.domain.study.Study; import org.cipres.treebase.domain.taxon.TaxonLabel; /** @@ -606,4 +607,9 @@ return getTree(); } */ + + @Transient + public Study getStudy() { + return getTree().getStudy(); + } } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/TreeBlock.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/TreeBlock.java 2012-01-11 17:02:42 UTC (rev 1013) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/TreeBlock.java 2012-01-19 22:38:16 UTC (rev 1014) @@ -346,5 +346,10 @@ } return null; } + + @Transient + public Study getStudy() { + return getContext(); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hs...@us...> - 2012-01-11 17:02:53
|
Revision: 1013 http://treebase.svn.sourceforge.net/treebase/?rev=1013&view=rev Author: hshyket Date: 2012-01-11 17:02:42 +0000 (Wed, 11 Jan 2012) Log Message: ----------- Updating location of RSS feed to point to peabody.research.yale.edu Modified Paths: -------------- trunk/treebase-web/src/main/webapp/WEB-INF/pages/home.jsp Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/home.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/home.jsp 2012-01-11 16:59:50 UTC (rev 1012) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/home.jsp 2012-01-11 17:02:42 UTC (rev 1013) @@ -11,10 +11,10 @@ to the authors, publication editors, or reviewers using a special access code. TreeBASE is produced and governed by the <a href="http://www.phylofoundation.org" title="Phyloinformatics Research Foundation, Inc.">The Phyloinformatics Research Foundation, Inc.</a></p> <p>Some recent additions:</p> - <script language="JavaScript" src="http://landmark-project.com/feed2js/feed2js.php?src=http%3A%2F%2Fpipes.yahoo.com%2Fpipes%2Fpipe.run%3F_id%3D41dc2d1544150c1b8e69367059f26950%26_render%3Drss&num=8&date=y" type="text/javascript"> + <script language="JavaScript" src="http://peabody.research.yale.edu/treebase-feed/feed2js.php?src=http%3A%2F%2Fpipes.yahoo.com%2Fpipes%2Fpipe.run%3F_id%3D41dc2d1544150c1b8e69367059f26950%26_render%3Drss&num=8&date=y" type="text/javascript"> </script> <noscript> - <a href="http://landmark-project.com/feed2js/feed2js.php?src=http%3A%2F%2Fpipes.yahoo.com%2Fpipes%2Fpipe.run%3F_id%3D41dc2d1544150c1b8e69367059f26950%26_render%3Drss&num=8&date=y&html=y">View RSS feed</a> + <a href="http://pipes.yahoo.com/pipes/pipe.run?_id=41dc2d1544150c1b8e69367059f26950&_render=rss&date=y&utf=y&html=y" target="_blank">View RSS feed</a> </noscript> <p>The current release includes a host of new features and improvements over the previous TreeBASE prototype. New features include:</p> <ul> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hs...@us...> - 2012-01-11 16:59:59
|
Revision: 1012 http://treebase.svn.sourceforge.net/treebase/?rev=1012&view=rev Author: hshyket Date: 2012-01-11 16:59:50 +0000 (Wed, 11 Jan 2012) Log Message: ----------- Adding feed2js PHP application Added Paths: ----------- trunk/treebase_feed/ trunk/treebase_feed/.htaccess trunk/treebase_feed/build.php trunk/treebase_feed/feed2js.php trunk/treebase_feed/feed2js_config.php trunk/treebase_feed/feed2php.inc trunk/treebase_feed/footer trunk/treebase_feed/magpie/ trunk/treebase_feed/magpie/cache/ trunk/treebase_feed/magpie/cache_utf8/ trunk/treebase_feed/magpie/extlib/ trunk/treebase_feed/magpie/extlib/Snoopy.class.inc trunk/treebase_feed/magpie/rss_cache.inc trunk/treebase_feed/magpie/rss_fetch.inc trunk/treebase_feed/magpie/rss_parse.inc trunk/treebase_feed/magpie/rss_utils.inc trunk/treebase_feed/magpie_debug.php trunk/treebase_feed/magpie_simple.php trunk/treebase_feed/nosource.php trunk/treebase_feed/popup.js trunk/treebase_feed/preview.php trunk/treebase_feed/style/ trunk/treebase_feed/style/.css trunk/treebase_feed/style/basic1.css trunk/treebase_feed/style/bbc_style.css trunk/treebase_feed/style/blackbox.css trunk/treebase_feed/style/css_classes.gif trunk/treebase_feed/style/dog.css trunk/treebase_feed/style/dog.jpg trunk/treebase_feed/style/essc.css trunk/treebase_feed/style/feed2js.jpg trunk/treebase_feed/style/greenbars.css trunk/treebase_feed/style/kp.css trunk/treebase_feed/style/main.css trunk/treebase_feed/style/marooned2.css trunk/treebase_feed/style/nobullets.css trunk/treebase_feed/style/none.css trunk/treebase_feed/style/outlive.css trunk/treebase_feed/style/play-button.jpg trunk/treebase_feed/style/plum.css trunk/treebase_feed/style/rss.css trunk/treebase_feed/style/sekodeng.css trunk/treebase_feed/style/style_pile.php trunk/treebase_feed/style/zanestate.css trunk/treebase_feed/style.php trunk/treebase_feed/style_preview.php Property changes on: trunk/treebase_feed ___________________________________________________________________ Added: bugtraq:number + true Added: trunk/treebase_feed/.htaccess =================================================================== --- trunk/treebase_feed/.htaccess (rev 0) +++ trunk/treebase_feed/.htaccess 2012-01-11 16:59:50 UTC (rev 1012) @@ -0,0 +1,4 @@ +Options +FollowSymlinks +RewriteEngine on +RewriteCond $1 !^(feed2js\.php) +RewriteRule ^(.*)$ /treebase-feed/feed2js.php/$1 [L] \ No newline at end of file Added: trunk/treebase_feed/build.php =================================================================== --- trunk/treebase_feed/build.php (rev 0) +++ trunk/treebase_feed/build.php 2012-01-11 16:59:50 UTC (rev 1012) @@ -0,0 +1,223 @@ +<?php +/* Feed2JS : RSS feed to JavaScript + build.php + + ABOUT + This script can be used to create a form that is useful + for creating the JavaScript strings and testing the output + + Developed by Alan Levine + http://cogdogblog.com/ + + MORE: + Part of the Feed2JS package + See http://feed2js.org/ + +*/ + + + +// GET VARIABLES --------------------------------------------- +// Get variables from input form and set default values + + + + $src = (isset($_GET['src'])) ? $_GET['src'] : ''; + $chan = (isset($_GET['chan'])) ? $_GET['chan'] : 'y'; + $num = (isset($_GET['num'])) ? $_GET['num'] : 0; + $desc = (isset($_GET['desc'])) ? $_GET['desc'] : 1; + $auth = (isset($_GET['au'])) ? $_GET['au'] : 'n'; + $date = (isset($_GET['date'])) ? $_GET['date'] : 'n'; + $tz = (isset($_GET['tz'])) ? $_GET['tz'] : 'feed'; + $targ = (isset($_GET['targ'])) ? $_GET['targ'] : 'n'; + $html = (isset($_GET['html'])) ? $_GET['html'] : 'n'; + $utf = (isset($_GET['utf'])) ? $_GET['utf'] : 'y'; + $rss_box_id = (isset($_GET['rss_box_id'])) ? $_GET['rss_box_id'] : ''; + $pc = (isset($_GET['pc'])) ? $_GET['pc'] : 'n'; + + +// test for malicious use of script tages +if (strpos($src, '<script>')) { + $src = preg_replace("/(\<script)(.*?)(script>)/si", "SCRIPT DELETED", "$src"); + die("Warning! Attempt to inject javascript detected. Aborted and tracking log updated."); +} + + +// check for status of submit buttons + $generate = (isset($_GET['generate'])) ? $_GET['generate'] : ''; + if (isset($generate)) $generate = $_GET['generate']; + +// update to full descriptions for html turned on + if ($html=='a') $desc = 0; + +// build parameter string for the feed2js url + $options = ''; + if ($chan != 'n') $options .= "&chan=$chan"; + if ($num != 0) $options .= "&num=$num"; + if ($desc != 0) $options .= "&desc=$desc"; + if ($auth != 'n') $options .= "&au=$auth"; + if ($date != 'n') $options .= "&date=$date"; + if ($tz != 'feed') $options .= "&tz=$tz"; + if ($targ != 'n') $options .= "&targ=$targ"; + if ($html != 'n') $html_options = "&html=$html"; + if ($utf == 'y') { + $options .= '&utf=y'; + $utf_str = ' charset="UTF-8"'; // extra param for embed code + } else { + $utf_str = ''; + } + if ($rss_box_id != '') $options .= "&css=$rss_box_id"; + if ($pc == 'y') $options .= '&pc=y'; + + + +if ($generate) { + // URLs for a preview or a generated feed link + + $my_dir = 'http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['PHP_SELF']); + + $rss_str = "$my_dir/feed2js.php?src=" . urlencode($src) . $options . $html_options; + + $noscript_rss_str = "$my_dir/feed2js.php?src=" . urlencode($src) . $options . '&html=y'; + +} + +?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>Build a Feed with Feed2JS</title> + <link rel="stylesheet" href="style/main.css" media="all" /> +<script type="text/javascript" language="Javascript"> +<!-- +function query_str(form) { + + // builds a proper query string by extracting Javascript form variables + // so we can open a preview in a new window + options = encodeURIComponent(form.src.value); + + if (form.chan[2].checked) { + options += '&chan=n'; + } else if (form.chan[1].checked) { + options += '&chan=title'; + } + + if (form.num.value != 0) options += '&num=' + form.num.value; + if (form.desc.value != 1 && !form.html[0].checked) options += '&desc=' + form.desc.value; + + if (form.date[0].checked) options += '&date=y'; + if (form.tz.value != 'feed') options += '&tz=' + form.tz.value; + + if (form.html[0].checked) { + options += '&html=a'; + } else if (form.html[2].checked) { + options += '&html=p'; + } + + + options += '&targ=' + form.targ.value; + + if (form.utf.checked) options += '&utf=y'; + options += '&css=' + form.rss_box_id.value; + + if (form.pc[0].checked) options += '&pc=y'; + + if (form.au[0].checked) options += '&au=y'; + + return(options); + + +} +//--> +</script> + + <script src="popup.js" type="text/javascript" language="Javascript"> +</script> + +</head> +<body> +<div id="content"> +<h1>Feed2JS Build JavaScript and Preview</h1> +<p class="first">The tool below will help you format a feed's display with the information you want to use on your web site. All you need to enter is the URL for the RSS source, and select the desired options below. </p> + +<p>First, be sure to <strong>preview</strong> the feed to verify the content and format. Once the content is displayed how you like, just use the <strong>generate javascript</strong> button to get your code. Once the content looks okay, move on to our <a href="style.php">style tool</a> to make it pretty.</p> + +<?php if ($generate):?> + + +<h2>Get Your Code Here</h2> +<p class="first">Below is the code you need to copy and paste to your own web page to include this RSS feed. The NOSCRIPT tag provides a link to a HTML display of the feed for users who may not have JavaScript enabled. </p> +<form> +<span class="caption">cut and paste javascript:</span><br><textarea name="t" rows="8" cols="70"> +<script language="JavaScript" src="<?php echo htmlentities($rss_str)?>" <?php echo $utf_str?> type="text/javascript"></script> + +<noscript> +<a href="<?php echo htmlentities($noscript_rss_str)?>">View RSS feed</a> +</noscript> +</textarea> +</form> + + +<?php endif?> + +<form method="get" action="build.php" name="builder"> + +<p><strong>URL</strong> Enter the web address of the RSS Feed (must be in http:// format, not feed://)<br> + +<input type="text" name="src" size="50" value="<?php echo $src?>"> <br> +<span style="font-size:x-small">Note: Please verify the URL of your feed (make sure it presents raw RSS) and <a href="http://feedvalidator.org/" onClick="window.open('http://feedvalidator.org/check.cgi?url=' + encodeURIComponent(document.builder.src.value), 'check'); return false;">check that it is valid</a> before using this form.</span> +</p> + +<div id="badge" style="width:250px; padding:0;"> +<h3 class="badge-header">Show n' Tell!</h3> + <div align="center"> + <input type="button" name="preview" value="Preview Feed" onClick="pr=window.open('preview.php?src=' + query_str(document.builder), 'prev', 'scrollbars,resizable,left=20,screenX=20,top=40,screenY=40,height=580,width=700'); pr.focus();" + /> <br /> + <input type="submit" name="generate" value="Generate JavaScript" /> + </div> +</div> + + +<p><strong>Show channel?</strong> (yes/no/title) Display information about the publisher of the feed (yes=show the title and description; title= display title only, no=do not display anything) <br> +<input type="radio" name="chan" value="y" <?php if ($chan=='y') echo 'checked="checked"'?> /> yes <input type="radio" name="chan" value="title" <?php if ($chan=='title') echo 'checked="checked"'?>/> title <input type="radio" name="chan" value="n" <?php if ($chan=='n') echo 'checked="checked"'?>/> no</p> + +<p><strong>Number of items to display.</strong> Enter the number of items to be displayed (enter 0 to show all available)<br> +<input type="text" name="num" size="10" value="<?php echo $num?>"></p> + +<p><strong>Show/Hide item descriptions? How much?</strong> (0=no descriptions; 1=show full description text; n>1 = display first n characters of description; n=-1 do not link item title, just display item contents)<br> +<input type="text" name="desc" size="10" value="<?php echo $desc?>"></p> + +<p><strong>Show item author?</strong> (yes/no) Display the name of an item's author (yes=show the title and description; no=do not display anything) <br> +<input type="radio" name="au" value="y" <?php if ($auth=='y') echo 'checked="checked"'?> /> yes <input type="radio" name="au" value="n" <?php if ($auth=='n') echo 'checked="checked"'?>/> no</p> + +<p><strong>Use HTML in item display? </strong> ("yes" = use HTML from feed and the full item descriptions will be used, ignoring any character limit set above; "no" = output is text-only formatted by CSS; "preserve paragraphs" = no HTML but convert all RETURN/linefeeds to <br> to preserve paragraph breaks)<br> +<input type="radio" name="html" value="a" <?php if ($html=='a') echo 'checked="checked"'?>/> yes <input type="radio" name="html" value="n" <?php if ($html=='n') echo 'checked="checked"'?> /> no <input type="radio" name="html" value="p" <?php if ($html=='p') echo 'checked="checked"'?> /> preserve paragraphs only</p> + +<p><strong>Show item posting date?</strong> (yes/no) Display the time and date for each item.<br> +<input type="radio" name="date" value="y" <?php if ($date=='y') echo 'checked="checked"'?>/> yes <input type="radio" name="date" value="n" <?php if ($date!='y') echo 'checked="checked"'?> /> no</p> + +<p><strong>Time Zone Offset</strong> (+n/-n/'feed') Date and timer are converted to GMT time; to have display in local time, you must enter an offset from your current local time to <strong><?php echo gmdate("r")?> (GMT)</strong>. If your local time is 5 hours before GMT, enter <code>-5</code>. If your local time is 8 hours past GMT, enter <code>+8</code>. Fractional offsets such as +10:30 must be entered as decimal <code>+10.5</code>. If you prefer to just display the date is recorded in the RSS, use a value = <code>feed</code><br> +<input type="text" name="tz" size="10" value="<?php echo $tz?>"></p> + +<p><strong>Target links in the new window?</strong> (n="no, links open the same page", y="yes, open links in a new window", "xxxx" = open links in a frame named 'xxxx', 'popup' = use a <a href="popup.js">JavaScript function</a> <code>popupfeed()</code> to open in new window) <br> +<input type="text" name="targ" size="10" value="<?php echo $targ?>"></p> + +<p><strong>UTF-8 Character Encoding</strong><br> Required for many non-western language web pages and also may help if you see strange characters replacing quotes in your output (see <a href="http://feed2js.org/index.php?s=help#chars">help pages</a> for more information).<br /> +<input type="checkbox" name="utf" value="y" <?php if ($utf=='y') echo 'checked="checked"'?> /> use UTF-8 character encoding +</p> + +<p><strong>Podcast enclosures</strong><br> For RSS 2.0 feeds with enclosures, display link to media files<br /> +<input type="radio" name="pc" value="y" <?php if ($pc=='y') echo 'checked="checked"'?> /> yes +<input type="radio" name="pc" value="n" <?php if ($pc!='y') echo 'checked="checked"'?> /> no +</p> + +<p><strong>Custom CSS Class (advanced users)</strong> <br> Use to create different styles for multiple feeds per page. Specify class for content as <code>rss-box-XXXX</code> where XXXX is the value entered below. Style sheets must be created in accordance with <a href="style.php#2style">Feed2JS guidelines</a>.<br> +<input type="text" name="rss_box_id" size="10" value="<?php echo $rss_box_id?>"></p> + +</form> +</div> + +<?php include 'footer'?> + +</body> +</html> Added: trunk/treebase_feed/feed2js.php =================================================================== --- trunk/treebase_feed/feed2js.php (rev 0) +++ trunk/treebase_feed/feed2js.php 2012-01-11 16:59:50 UTC (rev 1012) @@ -0,0 +1,392 @@ +<?php +/* Feed2JS : RSS feed to JavaScript src file + + VERSION 2.3 (2011 jun 9) + + ABOUT + This PHP script will take an RSS feed as a value of src="...." + and return a JavaScript file that can be linked + remotely from any other web page. Output includes + site title, link, and description as well as item site, link, and + description with these outouts contolled by extra parameters. + + Developed by Alan Levine initially released 13.may.2004 + http://cogdogblog.com/ + + PRIMARY SITE: + http://feed2js.org/ + + CODE: + http://code.google.com/p/feed2js/ + + Feed2JS makes use of the Magpie RSS parser from + http://magpierss.sourceforge.net/ + + ------------- small print --------------------------------------- + GNU General Public License + Copyright (C) 2004-2010 Alan Levine + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details + http://www.gnu.org/licenses/gpl.html + ------------- small print --------------------------------------- + +*/ + +// ERROR CHECKING FOR NO SOURCE ------------------------------- + +$script_msg = ''; +$src = (isset($_GET['src'])) ? $_GET['src'] : ''; + +// trap for missing src param for the feed, use a dummy one so it gets displayed. +if (!$src or strpos($src, 'http://')!=0) $src= 'http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['PHP_SELF']) . '/nosource.php'; + +// test for malicious use of script tages +if (strpos($src, '<script>')) { + $src = preg_replace("/(\<script)(.*?)(script>)/si", "SCRIPT DELETED", "$src"); + die("Warning! Attempt to inject javascript detected. Aborted and tracking log updated."); +} + +// MAGPIE SETUP ---------------------------------------------------- +// access configuration settings +require_once('feed2js_config.php'); + +if (!in_array(urldecode($_GET["src"]), $allowedFeeds)) { + die("Not Allowed"); +} + +// check for utf encoding type +$utf = (isset($_GET['utf'])) ? $_GET['utf'] : 'n'; + +if ($utf == 'y') { + define('MAGPIE_CACHE_DIR', MAGPIE_DIR . 'cache_utf8/'); + // chacrater encoding + define('MAGPIE_OUTPUT_ENCODING', 'UTF-8'); + + +} else { + define('MAGPIE_CACHE_DIR', MAGPIE_DIR . 'cache/'); + define('MAGPIE_OUTPUT_ENCODING', 'ISO-8859-1'); +} + +// GET VARIABLES --------------------------------------------- +// retrieve values from posted variables + +// flag to show channel info +$chan = (isset($_GET['chan'])) ? $_GET['chan'] : 'n'; + +// variable to limit number of displayed items; default = 0 (show all, 100 is a safe bet to list a big list of feeds) + +$num = (isset($_GET['num'])) ? $_GET['num'] : 0; +if ($num==0) $num = 100; + +// indicator to show item description, 0 = no; 1=all; n>1 = characters to display +// values of -1 indicate to displa item without the title as a link +// (default=0) +$desc = (isset($_GET['desc'])) ? $_GET['desc'] : 0; + +// flag to show author of items, values: no/yes (default=no) +$auth = (isset($_GET['au'])) ? 'y' : 'n'; + +// flag to show date of items, values: no/yes (default=no) +$date = (isset($_GET['date'])) ? $_GET['date'] : 'n'; + +// time zone offset for making local time, +// e.g. +7, =-10.5; 'feed' = print the time string in the RSS w/o conversion +$tz = (isset($_GET['tz'])) ? $_GET['tz'] : 'feed'; + + +// flag to open target window in new window; n = same window, y = new window, +// other = targeted window, 'popup' = call JavaScript function popupfeed() to display +// in new window (default is n) + +$targ = (isset($_GET['targ'])) ? $_GET['targ'] : 'n'; +if ($targ == 'n') { + $target_window = ' target="_self"'; +} elseif ($targ == 'y' ) { + $target_window = ' target="_blank"'; +} elseif ($targ == 'popup') { + $target_window = ' onClick="popupfeed(this.href);return false"'; +} else { + $target_window = ' target="' . $targ . '"'; +} + +// flag to show feed as full html output rather than JavaScript, used for alternative +// views for JavaScript-less users. +// y = display html only for non js browsers (NO LONGER USED) +// n = default (JavaScript view) +// a = display javascript output but allow HTML +// p = display text only items but convert linefeeds to BR tags + +// default setting for no conversion of linebreaks +$html = (isset($_GET['html'])) ? $_GET['html'] : 'n'; + +$br = ' '; +if ($html == 'a') { + $desc = 1; +} elseif ($html == 'p') { + $br = '<br />'; +} + +// optional parameter to use different class for the CSS container +$rss_box_id = (isset($_GET['css'])) ? '-' . $_GET['css'] : ''; + +// optional parameter to use different class for the CSS container +$play_podcast = (isset($_GET['pc'])) ? $_GET['pc'] : 'n'; + + +// PARSE FEED and GENERATE OUTPUT ------------------------------- +// This is where it all happens! + + +// check if site has a setting to restrict to a url +if (isset($restrict_url)) { + $src_host = substr($src, 7); + $src_pos = strpos($src_host,"/"); + if ($src_pos) { + $src_host = substr($src_host,0, $src_pos); + } +} +if (isset($restrict_url) && substr($src_host, strlen($src_host)-strlen($restrict_url)) != $restrict_url) { + $str.= "document.write('<div class=\"rss-box" . $rss_box_id . + "\"><p class=\"rss-item\"><em>Error:</em> on feed <strong>" . + $src . "</strong>. " . + "Feeds are allowed only from URLs from the site http://*" . + $restrict_url . "</p></div>');\n"; + +} else { + + + $rss = @fetch_rss( $src ); + + // begin javascript output string for channel info + $str= "document.write('<div class=\"rss-box" . $rss_box_id . "\">');\n"; + + + // no feed found by magpie, return error statement + if (!$rss) { + $str.= "document.write('<p class=\"rss-item\">$script_msg<em>Error:</em> Feed failed! Causes may be (1) No data found for RSS feed $src; (2) There are no items are available for this feed; (3) The RSS feed does not validate.<br /><br /> Please verify that the URL <a href=\"$src\">$src</a> works first in your browser and that the feed passes a <a href=\"http://feedvalidator.org/check.cgi?url=" . urlencode($src) . "\">validator test</a>.</p></div>');\n"; + + + } else { + + + // Create CONNECTION CONFIRM + // create output string for local javascript variable to let + // browser know that the server has been contacted + $feedcheck_str = "feed2js_ck = true;\n\n"; + + // we have a feed, so let's process + if ($chan == 'y') { + + // output channel title and description + $str.= "document.write('<p class=\"rss-title\"><a class=\"rss-title\" href=\"" . trim($rss->channel['link']) . '"' . $target_window . ">" . addslashes(strip_returns($rss->channel['title'])) . "</a><br /><span class=\"rss-item\">" . addslashes(strip_returns(strip_tags($rss->channel['description']))) . "</span></p>');\n"; + + } elseif ($chan == 'title') { + // output title only + $str.= "document.write('<p class=\"rss-title\"><a class=\"rss-title\" href=\"" . trim($rss->channel['link']) . '"' . $target_window . ">" . addslashes(strip_returns($rss->channel['title'])) . "</a></p>');\n"; + + } + + // begin item listing + $str.= "document.write('<ul class=\"rss-items\">');\n"; + + // Walk the items and process each one + $all_items = array_slice($rss->items, 0, $num); + + foreach ( $all_items as $item ) { + + // set defaults thanks RPFK + if (!isset($item['summary'])) $item['summary'] = ''; + $more_link = ''; + + // create output for item author + + + $author_str = ''; + if ($auth == 'y') { + if (isset($item['dc']['creator'])) { + $author_str = ' <span class="rss-item-auth">(' . addslashes(strip_tags($item['dc']['creator'])) . ')</span>'; + + } else { + if (isset($item['author_name'])) { + $author_str = ' <span class="rss-item-auth">(' . addslashes(strip_tags($item['author_name'])) . ')</span>'; + } + } + + } + + + + if ($item['link']) { + // link url + $my_url = addslashes($item['link']); + } elseif ($item['guid']) { + // feeds lacking item -> link + $my_url = ($item['guid']); + } + + + if ($desc < 0) { + $str.= "document.write('<li class=\"rss-item\">');\n"; + + } elseif ($item['title']) { + // format item title + $my_title = addslashes(strip_returns($item['title'])); + + + + // write the title strng + $str.= "document.write('<li class=\"rss-item\"><a class=\"rss-item\" href=\"" . trim($my_url) . "\"" . $target_window . '>' . $my_title . '</a>' . $author_str . "<br />');\n"; + + + } else { + // if no title, build a link to tag on the description + $str.= "document.write('<li class=\"rss-item\">');\n"; + $more_link = " <a class=\"rss-item\" href=\"" . trim($my_url) . '"' . $target_window . ">«details»</a>"; + } + + // print out date if option indicated + + if ($date == 'y') { + + if ($tz == 'feed') { + // echo the date/time stamp reported in the feed + + if ($item['pubdate'] != '') { + // RSS 2.0 is already formatted, so just use it + //$pretty_date = $item['pubdate']; + $pretty_date = date($date_format, strtotime($item['pubdate'])); + } elseif ($item['published'] != "") { + // ATOM 1.0 format, remove the "T" and "Z" and the time zone offset + $pretty_date = str_replace("T", " ", $item['published']); + $pretty_date= str_replace("Z", " ", $pretty_date); + + } elseif ($item['issued'] != "") { + // ATOM 0.3 format, remove the "T" and "Z" and the time zone offset + $pretty_date = str_replace("T", " ", $item['issued']); + $pretty_date= str_replace("Z", " ", $pretty_date); + } elseif ( $item['dc']['date'] != "") { + // RSS 1.0, remove the "T" and the time zone offset + $pretty_date = str_replace("T", " ", $item['dc']['date']); + $pretty_date = substr($pretty_date, 0,-6); + } else { + + // no time/date stamp, + $pretty_date = 'n/a'; + } + + + } else { + // convert to local time via conversion to GMT + offset + + // adjust local server time to GMT and then adjust time according to user + // entered offset. + + // let's see what kind of timestamps we can pull... + if ($item['date_timestamp'] != "") { + $ts = $item['date_timestamp']; + } elseif ($item['published'] != "") { + $ts = strtotime($item['published']); + } elseif ($item['issued'] != "") { + $ts = strtotime($item['issued']); + } elseif ( $item['dc']['date'] != "") { + $ts = strtotime($item['dc']['date']); + } else { + $ts = time(); + } + + $pretty_date = date($date_format, $ts - $tz_offset + $tz * 3600); + + } + + $str.= "document.write('<span class=\"rss-date\">$pretty_date</span><br />');\n"; + } + + // link to podcast media if availavle + + if ($play_podcast == 'y' and is_array($item['enclosure'])) { + $str.= "document.write('<div class=\"pod-play-box\">');\n"; + for ($i = 0; $i < count($item['enclosure']); $i++) { + + // display only if enclosure is a valid URL + //if (strpos($item['enclosure'][$i]['url'], 'http://')!=0) { + $str.= "document.write('<a class=\"pod-play\" href=\"" . trim($item['enclosure'][$i]['url']) . "\" title=\"Play Now\" target=\"_blank\"><em>Play</em> <span> " . substr(trim($item['enclosure'][$i]['url']), -3) . "</span></a> ');\n"; + //} + + } + + $str.= "document.write('</div>');\n"; + + } + + + // output description of item if desired + if ($desc) { + + if ($item['atom_content']) { + // Atom content - note that wordpress.com feeds return bad data here "A" + // so revert to description if this is the case. + $my_blurb = ($item['atom_content'] == "A") ? $item['description'] : html_entity_decode ( $item['atom_content'], ENT_NOQUOTES, MAGPIE_OUTPUT_ENCODING); + + } else if ($item['content']) { + + + + // Atom/encocded content support (thanks David Carter-Tod) + + $my_blurb = html_entity_decode ( $item['content'], ENT_NOQUOTES, MAGPIE_OUTPUT_ENCODING); + + + } else { + $my_blurb = $item['summary']; + } + + // strip html + if ($html != 'a') $my_blurb = strip_tags($my_blurb); + + // trim descriptions + if ($desc > 1) { + + // display specified substring numbers of chars; + // html is stripped to prevent cut off tags + // make sure we dont chop UTF-8 characters + + + if ($utf == 'y') { + $my_blurb = mb_substr($my_blurb, 0, $desc, 'UTF-8') . '...'; + } else { + $my_blurb = substr($my_blurb, 0, $desc) . '...'; + } + + } + + + $str.= "document.write('" . addslashes(strip_returns($my_blurb, $br)) . "');\n"; + + } + + $str.= "document.write('$more_link</li>');\n"; + } + + + $str .= "document.write('</ul></div>');\n"; + } // end restrict_url +} + +// Render as JavaScript +// START OUTPUT +// headers to tell browser this is a JS file +if ($rss) header("Content-type: application/x-javascript"); + +// Spit out the results as the series of JS statements +echo $feedcheck_str . $str; + + +?> Added: trunk/treebase_feed/feed2js_config.php =================================================================== --- trunk/treebase_feed/feed2js_config.php (rev 0) +++ trunk/treebase_feed/feed2js_config.php 2012-01-11 16:59:50 UTC (rev 1012) @@ -0,0 +1,84 @@ +<?php +/* Feed2JS : RSS feed to JavaScript Configuration include + + Use this include to establish server specific paths + and other common functions used by the feed2js.php + + See main script for all the gory details or the Google Code site + http://code.google.com/p/feed2js/ + + created 10.sep.2004 +*/ + + +/* Check to make sure that only the allowed URLs are accepted */ +define('TREEBASE_RSS_FEED', 'http://pipes.yahoo.com/pipes/pipe.run?_id=41dc2d1544150c1b8e69367059f26950&_render=rss'); +$allowedFeeds = array(TREEBASE_RSS_FEED); + +// MAGPIE SETUP ---------------------------------------------------- +// Define path to Magpie files and load library +// The easiest setup is to put the 4 Magpie include +// files in the same directory: +// define('MAGPIE_DIR', './') + +// Otherwise, provide a full valid file path to the directory +// where magpie sites + +define('MAGPIE_DIR', './magpie/'); + +// access magpie libraries +require_once(MAGPIE_DIR.'rss_fetch.inc'); +require_once(MAGPIE_DIR.'rss_utils.inc'); + +// value of 2 optionally show lots of debugging info but breaks JavaScript +// This should be set to 0 unless debugging +define('MAGPIE_DEBUG', 0); + +// Define cache age in seconds. +define('MAGPIE_CACHE_AGE', 60*60); + +// OTHER SETTIINGS ---------------------------------------------- +// Output spec for item date string if used +// see http://www.php.net/manual/en/function.date.php +//$date_format = "F d, Y h:i:s a"; +$date_format = "F d, Y"; + + +// server time zone offset from GMT +// If this line generates errors (common on Windoze servers, +// then figure out your time zone offset from GMT and enter +// manually, e.g. $tz_offset = -7; + +$tz_offset = gmmktime(0,0,0,1,1,1970) - mktime(0,0,0,1,1,1970); + +// ERROR Handling ------------------------------------------------ + +// Report all errors except E_NOTICE +// This is the default value set in php.ini for Apache but often not Windows +// We recommend changing the value to 0 once your scripts are working +ini_set('display_errors', 1); +ini_set('error_reporting', E_ALL^ E_NOTICE); + + +// Restrict RSS url to domain +// Example: www.example.org => allows www.example.org and mywww.example.org +// Example: .example.org => allows www.example.org and other.example.org + +// remove the comment here to activate url restriction +//$restrict_url = "pipes.yahoo.com"; + +// comment out this line to activate url restriction +//unset($restrict_url); + + +// Utility to remove return characters from strings that might +// pollute JavaScript commands. While we are at it, substitute +// valid single quotes as well and get rid of any escaped quote +// characters +function strip_returns ($text, $linefeed=" ") { + $subquotes = trim( preg_replace( '/\s+/', ' ', $text ) ); + return preg_replace("(\r\n|\n|\r)", $linefeed, $subquotes); +} + + +?> \ No newline at end of file Added: trunk/treebase_feed/feed2php.inc =================================================================== --- trunk/treebase_feed/feed2php.inc (rev 0) +++ trunk/treebase_feed/feed2php.inc 2012-01-11 16:59:50 UTC (rev 1012) @@ -0,0 +1,346 @@ +<?php +/* Feed2inc : RSS feed to PHP include file + + ABOUT + This PHP code can be used as an include to provide the + same functionality of our Feed2JS concept, but without + the need to generate content via JavaScript + + Developed by Alan Levine + http://cogdogblog.com/ + + This is a modified version of Fee22JS and merely replaces + the output of Javascript to that for a PHP. See the original + feed2js.php for change history. + + USAGE: + See http://feed2js.org/index.php?s=php + + CODE: + http://code.google.com/p/feed2js/ + + + This makes use of the Magpie RSS parser from + http://magpierss.sourceforge.net/ + + ------------- small print --------------------------------------- + GNU General Public License + Copyright (C) 2004-2010 Alan Levine + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details + http://www.gnu.org/licenses/gpl.html + ------------- small print --------------------------------------- + +*/ + +require_once('feed2js_config.php'); + +/// trap for missing src param for the feed, use a dummy one so it gets displayed. + +if (!$src or strpos($src, 'http://')!=0) $src= 'http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['PHP_SELF']) . '/nosource.php'; + +// check for utf encoding type +if (!isset($utf)) $utf = 'n'; + +if ($utf == 'y') { + define('MAGPIE_CACHE_DIR', MAGPIE_DIR . 'cache_utf8/'); + // character encoding + define('MAGPIE_OUTPUT_ENCODING', 'UTF-8'); + +} else { + define('MAGPIE_CACHE_DIR', MAGPIE_DIR . 'cache/'); + define('MAGPIE_OUTPUT_ENCODING', 'ISO-8859-1'); + +} + + +// GET VARIABLES --------------------------------------------- +// retrieve values from posted variables + +// flag to show channel info +if (!isset($chan)) $chan = 'n'; + +// variable to limit number of displayed items; default = 0 (show all, 20 is a safe bet to list a big list of feeds) + +if (!isset($num)) $num = 0; +if ($num==0) $num = 100; + +// indicator to show item description, 0 = no; 1=all; n>1 = characters to display +// values of -1 indicate to display item without the title as a link +// (default=0) +if (!isset($desc)) $desc = 0; + + +// flag to show author of items, values: no/yes (default=no) +$auth = (isset($_GET['au'])) ? 'y' : 'n'; + + +// flag to show date of posts, values: no/yes (default=no) +$date = (isset($date)) ? $date : 'n'; + +// time zone offset for making local time, +// e.g. +7, =-10.5; 'feed' = print the time string in the RSS w/o conversion +$tz = (isset($tz)) ? $tz : 'feed'; + +// flag to open target window in new window; n = same window, y = new window, +// other = targeted window, 'popup' = call JavaScript function popupfeed to display +// in new window +// (default is n) + +if (!isset($targ)) $targ = 'n'; + +if ($targ == 'n') { + $target_window = ' target="_self"'; +} elseif ($targ == 'y' ) { + $target_window = ' target="_blank"'; +} elseif ($targ == 'popup') { + $target_window = ' onClick="popupfeed(this.href);return false"'; +} else { + $target_window = ' target="' . $targ . '"'; +} + +// flag to show feed as full html output rather than JavaScript, used for alternative +// views for JavaScript-less users. +// y = display html only for non js browsers +// n = default (JavaScript view) +// a = display javascript output but allow HTML +// p = display text only items but convert linefeeds to BR tags + +// default setting for no conversion of linebreaks +if (!isset($html)) $html = 'n'; + +$br = ' '; +if ($html == 'a') { + $desc = 1; +} elseif ($html == 'p') { + $br = '<br />'; +} + +// optional parameter to use different class for the CSS container +if (isset($css)) { + $rss_box_id = '-' . $css; +} else { + $rss_box_id = ''; +} + +if (isset($pc)) { + $play_podcast = $pc; +} else { + $play_podcast = 'n'; +} + + +// PARSE FEED and GENERATE OUTPUT ------------------------------- +// This is where it all happens! + +// Fetch the data, thanks Magpie +$rss = @fetch_rss( $src ); + +// begin javascript output string for channel info +$str = "<div class=\"rss-box" . $rss_box_id . "\">\n"; + +// no feed found by magpie, return error statement +if (!$rss) { + // error, nothing grabbed + $str.= "<p class=\"rss-item\"><em>Error:</em> Feed failed! Causes may be (1) No data found for RSS feed $src; (2) There are no items are available for this feed; (3) The RSS feed does not validate.<br /><br /> Please verify that the URL <a href=\"$src\">$src</a> works first in your browser and that the feed passes a <a href=\"http://feedvalidator.org/check.cgi?url=" . urlencode($src) . "\">validator test</a>.</p>\n"; +} else { + + if ($chan == 'y') { + + // output channel title and description + $str.= "<p class=\"rss-title\"><a class=\"rss-title\" href=\"" . trim($rss->channel['link']) . '"' . $target_window . ">" . strip_returns($rss->channel['title']) . "</a><br /><span class=\"rss-item\">" . strip_returns(strip_tags($rss->channel['description'])) . "</span></p>\n"; + + } elseif ($chan == 'title') { + // output title only + $str.= "<p class=\"rss-title\"><a class=\"rss-title\" href=\"" . trim($rss->channel['link']) . '"' . $target_window . ">" . strip_returns($rss->channel['title']) . "</a></p>\n"; + + } + + + // begin item listing + $str.= "<ul class=\"rss-items\">\n"; + + + // Walk the items and process each one + $all_items = array_slice($rss->items, 0, $num); + + foreach ( $all_items as $item ) { + + + // create output for item author + $author_str = ''; + if ($auth == 'y') { + if (isset($item['dc']['creator'])) { + $author_str = ' <span class="rss-item-auth">(' . addslashes(strip_tags($item['dc']['creator'])) . ')</span>'; + + } else { + if (isset($item['author_name'])) { + $author_str = ' <span class="rss-item-auth">(' . addslashes(strip_tags($item['author_name'])) . ')</span>'; + } + } + + } + + + + if ($item['link']) { + // link url + $my_url = $item['link']; + } elseif ($item['guid']) { + // feeds lacking item -> link + $my_url = ($item['guid']); + } + + + if ($desc < 0) { + $str.= "<li class=\"rss-item\">\n"; + + } elseif ($item['title']) { + // format item title + $my_title = strip_returns($item['title']); + + // create a title attribute. thanks Seb! + $title_str = substr(strip_returns(htmlspecialchars(strip_tags($item['summary']))), 0, 60) . '...'; + + // write the item with a title attribute + $str.= "<li class=\"rss-item\"><a class=\"rss-item\" href=\"" . trim($my_url) . "\" title=\"$title_str\"" . $target_window . ">" . $my_title . '</a> ' . $author_str . "<br />\n"; + + + } else { + // if no title, build a link to tag on the description + $str.= "<li class=\"rss-item\">\n"; + $more_link = " <a class=\"rss-item\" href=\"" .trim($my_url) . '"' . $target_window . ">«details»</a>"; + } + + + // print out date if option indicated and feed returns a value. + // Use the new date_timestamp function in Magpie 0.71 + if ($tz == 'feed') { + // echo the date/time stamp reported in the feed + + if ($item['pubdate'] != '') { + // RSS 2.0 is already formatted, so just use it + $pretty_date = $item['pubdate']; + } elseif ($item['published'] != "") { + // ATOM 1.0 format, remove the "T" and "Z" and the time zone offset + $pretty_date = str_replace("T", " ", $item['published']); + $pretty_date= str_replace("Z", " ", $pretty_date); + + } elseif ($item['issued'] != "") { + // ATOM 0.3 format, remove the "T" and "Z" and the time zone offset + $pretty_date = str_replace("T", " ", $item['issued']); + $pretty_date= str_replace("Z", " ", $pretty_date); + } elseif ( $item['dc']['date'] != "") { + // RSS 1.0, remove the "T" and the time zone offset + $pretty_date = str_replace("T", " ", $item['dc']['date']); + $pretty_date = substr($pretty_date, 0,-6); + } else { + + // no time/date stamp, + $pretty_date = 'n/a'; + } + + } else { + // convert to local time via conversion to GMT + offset + + // adjust local server time to GMT and then adjust time according to user + // entered offset. + + // let's see what kind of timestamps we can pull... + if ($item['date_timestamp'] != "") { + $ts = $item['date_timestamp']; + } elseif ($item['published'] != "") { + $ts = strtotime($item['published']); + } elseif ($item['issued'] != "") { + $ts = strtotime($item['issued']); + } elseif ( $item['dc']['date'] != "") { + $ts = strtotime($item['dc']['date']); + } else { + $ts = time(); + } + + $pretty_date = date($date_format, $ts - $tz_offset + $tz * 3600); + + } + + + $str.= "<span class=\"rss-date\">$pretty_date</span><br />\n"; + } + + // link to podcast media if available + + if ($play_podcast == 'y' and is_array($item['enclosure'])) { + $str.= "<div class=\"pod-play-box\">Media: "; + + for ($i = 0; $i < count($item['enclosure']); $i++) { + + // display only if enclosure is a valid URL + //if (strpos($item['enclosure'][$i]['url'], 'http://')!=0) { + $str.= "<a class=\"pod-play\"><a href=\"" . trim($item['enclosure'][$i]['url']) . "\" title=\"Play Now\" target=\"_blank\"><em>Play</em> <span>" . substr(trim($item['enclosure'][$i]['url']), -3) . "</span></a> "; + //} + + } + $str.= "</div>"; + + } + + + + + // output description of item if desired + if ($desc) { + + if ($item['atom_content']) { + // Atom content - note that wordpress.com feeds return bad data here "A" + // so revert to description if this is the case. + $my_blurb = ($item['atom_content'] == "A") ? $item['description'] : html_entity_decode ( $item['atom_content'], ENT_NOQUOTES, MAGPIE_OUTPUT_ENCODING); + + } else if ($item['content']) { + + + + // Atom/encocded content support (thanks David Carter-Tod) + + $my_blurb = html_entity_decode ( $item['content'], ENT_NOQUOTES, MAGPIE_OUTPUT_ENCODING); + + + } else { + $my_blurb = $item['summary']; + } + + + + // strip html + if ($html != 'a') $my_blurb = strip_tags($my_blurb); + + // trim descriptions + if ($desc > 1) { + + // display specified substring numbers of chars; + // html is stripped to prevent cut off tags + // make sure we dont chop UTF-8 characters + if ($utf == 'y') { + $my_blurb = mb_substr($my_blurb, 0, $desc, 'UTF-8') . '...'; + } else { + $my_blurb = substr($my_blurb, 0, $desc) . '...'; + } + } + + $str.= strip_returns($my_blurb, $br) . "\n"; + } + + $str.= "$more_link</li>\n"; + } +} + +$str .= "</ul></div>\n"; +echo $str; + +?> Added: trunk/treebase_feed/footer =================================================================== --- trunk/treebase_feed/footer (rev 0) +++ trunk/treebase_feed/footer 2012-01-11 16:59:50 UTC (rev 1012) @@ -0,0 +1,9 @@ +<div id="footer"> +<p class="smallprint"> +<strong>Feed2JS v1.93</strong><br> +http://<?php echo $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF']?><br><br> +Feed2JS code is Copyright (C) 2004-<?php echo date("Y")?> Created by <a href="http://cogdogblog.com/">Alan Levine</a>. It is available as both a free service at <a href="http://feed2js.org/">http://feed2js.org/</a> and open source code from <a href="https://eduforge.org/projects/feed2js/">eduforge</a>. <br><br> +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.<br><br> + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details <a href="http://www.gnu.org/licenses/gpl.html">http://www.gnu.org/licenses/gpl.html</a></p> +</div> Property changes on: trunk/treebase_feed/magpie ___________________________________________________________________ Added: bugtraq:number + true Property changes on: trunk/treebase_feed/magpie/cache ___________________________________________________________________ Added: bugtraq:number + true Property changes on: trunk/treebase_feed/magpie/cache_utf8 ___________________________________________________________________ Added: bugtraq:number + true Property changes on: trunk/treebase_feed/magpie/extlib ___________________________________________________________________ Added: bugtraq:number + true Added: trunk/treebase_feed/magpie/extlib/Snoopy.class.inc =================================================================== --- trunk/treebase_feed/magpie/extlib/Snoopy.class.inc (rev 0) +++ trunk/treebase_feed/magpie/extlib/Snoopy.class.inc 2012-01-11 16:59:50 UTC (rev 1012) @@ -0,0 +1,900 @@ +<?php + +/************************************************* + +Snoopy - the PHP net client +Author: Monte Ohrt <mo...@is...> +Copyright (c): 1999-2000 ispi, all rights reserved +Version: 1.0 + + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You may contact the author of Snoopy by e-mail at: +m...@is... + +Or, write to: +Monte Ohrt +CTO, ispi +237 S. 70th suite 220 +Lincoln, NE 68510 + +The latest version of Snoopy can be obtained from: +http://snoopy.sourceforge.com + +*************************************************/ + +class Snoopy +{ + /**** Public variables ****/ + + /* user definable vars */ + + var $host = "www.php.net"; // host name we are connecting to + var $port = 80; // port we are connecting to + var $proxy_host = ""; // proxy host to use + var $proxy_port = ""; // proxy port to use + var $agent = "Snoopy v1.0"; // agent we masquerade as + var $referer = ""; // referer info to pass + var $cookies = array(); // array of cookies to pass + // $cookies["username"]="joe"; + var $rawheaders = array(); // array of raw headers to send + // $rawheaders["Content-type"]="text/html"; + + var $maxredirs = 5; // http redirection depth maximum. 0 = disallow + var $lastredirectaddr = ""; // contains address of last redirected address + var $offsiteok = true; // allows redirection off-site + var $maxframes = 0; // frame content depth maximum. 0 = disallow + var $expandlinks = true; // expand links to fully qualified URLs. + // this only applies to fetchlinks() + // or submitlinks() + var $passcookies = true; // pass set cookies back through redirects + // NOTE: this currently does not respect + // dates, domains or paths. + + var $user = ""; // user for http authentication + var $pass = ""; // password for http authentication + + // http accept types + var $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*"; + + var $results = ""; // where the content is put + + var $error = ""; // error messages sent here + var $response_code = ""; // response code returned from server + var $headers = array(); // headers returned from server sent here + var $maxlength = 500000; // max return data length (body) + var $read_timeout = 0; // timeout on read operations, in seconds + // supported only since PHP 4 Beta 4 + // set to 0 to disallow timeouts + var $timed_out = false; // if a read operation timed out + var $status = 0; // http request status + + var $curl_path = "/usr/bin/curl"; + // Snoopy will use cURL for fetching + // SSL content if a full system path to + // the cURL binary is supplied here. + // set to false if you do not have + // cURL installed. See http://curl.haxx.se + // for details on installing cURL. + // Snoopy does *not* use the cURL + // library functions built into php, + // as these functions are not stable + // as of this Snoopy release. + + // send Accept-encoding: gzip? + var $use_gzip = true; + + /**** Private variables ****/ + + var $_maxlinelen = 4096; // max line length (headers) + + var $_httpmethod = "GET"; // default http request method + var $_httpversion = "HTTP/1.0"; // default http request version + var $_submit_method = "POST"; // default submit method + var $_submit_type = "application/x-www-form-urlencoded"; // default submit type + var $_mime_boundary = ""; // MIME boundary for multipart/form-data submit type + var $_redirectaddr = false; // will be set if page fetched is a redirect + var $_redirectdepth = 0; // increments on an http redirect + var $_frameurls = array(); // frame src urls + var $_framedepth = 0; // increments on frame depth + + var $_isproxy = false; // set if using a proxy server + var $_fp_timeout = 30; // timeout for socket connection + +/*======================================================================*\ + Function: fetch + Purpose: fetch the contents of a web page + (and possibly other protocols in the + future like ftp, nntp, gopher, etc.) + Input: $URI the location of the page to fetch + Output: $this->results the output text from the fetch +\*======================================================================*/ + + function fetch($URI) + { + + //preg_match("|^([^:]+)://([^:/]+)(:[\d]+)*(.*)|",$URI,$URI_PARTS); + $URI_PARTS = parse_url($URI); + if (!empty($URI_PARTS["user"])) + $this->user = $URI_PARTS["user"]; + if (!empty($URI_PARTS["pass"])) + $this->pass = $URI_PARTS["pass"]; + + switch($URI_PARTS["scheme"]) + { + case "http": + $this->host = $URI_PARTS["host"]; + if(!empty($URI_PARTS["port"])) + $this->port = $URI_PARTS["port"]; + if($this->_connect($fp)) + { + if($this->_isproxy) + { + // using proxy, send entire URI + $this->_httprequest($URI,$fp,$URI,$this->_httpmethod); + } + else + { + $path = $URI_PARTS["path"].(isset($URI_PARTS["query"]) ? "?".$URI_PARTS["query"] : ""); + // no proxy, send only the path + $this->_httprequest($path, $fp, $URI, $this->_httpmethod); + } + + $this->_disconnect($fp); + + if($this->_redirectaddr) + { + /* url was redirected, check if we've hit the max depth */ + if($this->maxredirs > $this->_redirectdepth) + { + // only follow redirect if it's on this site, or offsiteok is true + if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) + { + /* follow the redirect */ + $this->_redirectdepth++; + $this->lastredirectaddr=$this->_redirectaddr; + $this->fetch($this->_redirectaddr); + } + } + } + + if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0) + { + $frameurls = $this->_frameurls; + $this->_frameurls = array(); + + while(list(,$frameurl) = each($frameurls)) + { + if($this->_framedepth < $this->maxframes) + { + $this->fetch($frameurl); + $this->_framedepth++; + } + else + break; + } + } + } + else + { + return false; + } + return true; + break; + case "https": + if(!$this->curl_path || (!is_executable($this->curl_path))) { + $this->error = "Bad curl ($this->curl_path), can't fetch HTTPS \n"; + return false; + } + $this->host = $URI_PARTS["host"]; + if(!empty($URI_PARTS["port"])) + $this->port = $URI_PARTS["port"]; + if($this->_isproxy) + { + // using proxy, send entire URI + $this->_httpsrequest($URI,$URI,$this->_httpmethod); + } + else + { + $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); + // no proxy, send only the path + $this->_httpsrequest($path, $URI, $this->_httpmethod); + } + + if($this->_redirectaddr) + { + /* url was redirected, check if we've hit the max depth */ + if($this->maxredirs > $this->_redirectdepth) + { + // only follow redirect if it's on this site, or offsiteok is true + if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) + { + /* follow the redirect */ + $this->_redirectdepth++; + $this->lastredirectaddr=$this->_redirectaddr; + $this->fetch($this->_redirectaddr); + } + } + } + + if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0) + { + $frameurls = $this->_frameurls; + $this->_frameurls = array(); + + while(list(,$frameurl) = each($frameurls)) + { + if($this->_framedepth < $this->maxframes) + { + $this->fetch($frameurl); + $this->_framedepth++; + } + else + break; + } + } + return true; + break; + default: + // not a valid protocol + $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n'; + return false; + break; + } + return true; + } + + + +/*======================================================================*\ + Private functions +\*======================================================================*/ + + +/*======================================================================*\ + Function: _striplinks + Purpose: strip the hyperlinks from an html document + Input: $document document to strip. + Output: $match an array of the links +\*======================================================================*/ + + function _striplinks($document) + { + preg_match_all("'<\s*a\s+.*href\s*=\s* # find <a href= + ([\"\'])? # find single or double quote + (?(1) (.*?)\\1 | ([^\s\>]+)) # if quote found, match up to next matching + # quote, otherwise match up to next space + 'isx",$document,$links); + + + // catenate the non-empty matches from the conditional subpattern + + while(list($key,$val) = each($links[2])) + { + if(!empty($val)) + $match[] = $val; + } + + while(list($key,$val) = each($links[3])) + { + if(!empty($val)) + $match[] = $val; + } + + // return the links + return $match; + } + +/*======================================================================*\ + Function: _stripform + Purpose: strip the form elements from an html document + Input: $document document to strip. + Output: $match an array of the links +\*======================================================================*/ + + function _stripform($document) + { + preg_match_all("'<\/?(FORM|INPUT|SELECT|TEXTAREA|(OPTION))[^<>]*>(?(2)(.*(?=<\/?(option|select)[^<>]*>[\r\n]*)|(?=[\r\n]*))|(?=[\r\n]*))'Usi",$document,$elements); + + // catenate the matches + $match = implode("\r\n",$elements[0]); + + // return the links + return $match; + } + + + +/*======================================================================*\ + Function: _striptext + Purpose: strip the text from an html document + Input: $document document to strip. + Output: $text the resulting text +\*======================================================================*/ + + function _striptext($document) + { + + // I didn't use preg eval (//e) since that is only available in PHP 4.0. + // so, list your entities one by one here. I included some of the + // more common ones. + + $search = array("'<script[^>]*?>.*?</script>'si", // strip out javascript + "'<[\/\!]*?[^<>]*?>'si", // strip out html tags + "'([\r\n])[\s]+'", // strip out white space + "'&(quote|#34);'i", // replace html entities + "'&(amp|#38);'i", + "'&(lt|#60);'i", + "'&(gt|#62);'i", + "'&(nbsp|#160);'i", + "'&(iexcl|#161);'i", + "'&(cent|#162);'i", + "'&(pound|#163);'i", + "'&(copy|#169);'i" + ); + $replace = array( "", + "", + "\\1", + "\"", + "&", + "<", + ">", + " ", + chr(161), + chr(162), + chr(163), + chr(169)); + + $text = preg_replace($search,$replace,$document); + + return $text; + } + +/*======================================================================*\ + Function: _expandlinks + Purpose: expand each link into a fully qualified URL + Input: $links the links to qualify + $URI the full URI to get the base from + Output: $expandedLinks the expanded links +\*======================================================================*/ + + function _expandlinks($links,$URI) + { + + preg_match("/^[^\?]+/",$URI,$match); + + $match = preg_replace("|/[^\/\.]+\.[^\/\.]+$|","",$match[0]); + + $search = array( "|^http://".preg_quote($this->host)."|i", + "|^(?!http://)(\/)?(?!mailto:)|i", + "|/\./|", + "|/[^\/]+/\.\./|" + ); + + $replace = array( "", + $match."/", + "/", + "/" + ); + + $expandedLinks = preg_replace($search,$replace,$links); + + return $expandedLinks; + } + +/*======================================================================*\ + Function: _httprequest + Purpose: go get the http data from the server + Input: $url the url to fetch + $fp the current open file pointer + $URI the full URI + $body body contents to send if any (POST) + Output: +\*======================================================================*/ + + function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="") + { + if($this->passcookies && $this->_redirectaddr) + $this->setcookies(); + + $URI_PARTS = parse_url($URI); + if(empty($url)) + $url = "/"; + $headers = $http_method." ".$url." ".$this->_httpversion."\r\n"; + if(!empty($this->agent)) + $headers .= "User-Agent: ".$this->agent."\r\n"; + if(!empty($this->host) && !isset($this->rawheaders['Host'])) + $headers .= "Host: ".$this->host."\r\n"; + if(!empty($this->accept)) + $headers .= "Accept: ".$this->accept."\r\n"; + + if($this->use_gzip) { + // make sure PHP was built with --with-zlib + // and we can handle gzipp'ed data + if ( function_exists(gzinflate) ) { + $headers .= "Accept-encoding: gzip\r\n"; + } + else { + trigger_error( + "use_gzip is on, but PHP was built without zlib support.". + " Requesting file(s) without gzip encoding.", + E_USER_NOTICE); + } + } + + if(!empty($this->referer)) + $headers .= "Referer: ".$this->referer."\r\n"; + if(!empty($this->cookies)) + { + if(!is_array($this->cookies)) + $this->cookies = (array)$this->cookies; + + reset($this->cookies); + if ( count($this->cookies) > 0 ) { + $cookie_headers .= 'Cookie: '; + foreach ( $this->cookies as $cookieKey => $cookieVal ) { + $cookie_headers .= $cookieKey."=".urlencode($cookieVal)."; "; + } + $headers .= substr($cookie_headers,0,-2) . "\r\n"; + } + } + if(!empty($this->rawheaders)) + { + if(!is_array($this->rawheaders)) + $this->rawheaders = (array)$this->rawheaders; + while(list($headerKey,$headerVal) = each($this->rawheaders)) + $headers .= $headerKey.": ".$headerVal."\r\n"; + } + if(!empty($content_type)) { + $headers .= "Content-type: $content_type"; + if ($content_type == "multipart/form-data") + $headers .= "; boundary=".$this->_mime_boundary; + $headers .= "\r\n"; + } + if(!empty($body)) + $headers .= "Content-length: ".strlen($body)."\r\n"; + if(!empty($this->user) || !empty($this->pass)) + $headers .= "Authorization: BASIC ".base64_encode($this->user.":".$this->pass)."\r\n"; + + $headers .= "\r\n"; + + // set the read timeout if needed + if ($this->read_timeout > 0) + socket_set_timeout($fp, $this->read_timeout); + $this->timed_out = false; + + fwrite($fp,$headers.$body,strlen($headers.$body)); + + $this->_redirectaddr = false; + unset($this->headers); + + // content was returned gzip encoded? + $is_gzipped = false; + + while($currentHeader = fgets($fp,$this->_maxlinelen)) + { + if ($this->read_timeout > 0 && $this->_check_timeout($fp)) + { + $this->status=-100; + return false; + } + + // if($currentHeader == "\r\n") + if(preg_match("/^\r?\n$/", $currentHeader) ) + break; + + // if a header begins with Location: or URI:, set the redirect + if(preg_match("/^(Location:|URI:)/i",$currentHeader)) + { + // get URL portion of the redirect + preg_match("/^(Location:|URI:)\s+(.*)/",chop($currentHeader),$matches); + // look for :// in the Location header to see if hostname is included + if(!preg_match("|\:\/\/|",$matches[2])) + { + // no host in the path, so pre... [truncated message content] |
From: <sfr...@us...> - 2012-01-10 21:04:40
|
Revision: 1011 http://treebase.svn.sourceforge.net/treebase/?rev=1011&view=rev Author: sfrgpiel Date: 2012-01-10 21:04:34 +0000 (Tue, 10 Jan 2012) Log Message: ----------- Service has changed on http://landmark-project.com/feed2js/, requiring this fix. Modified Paths: -------------- trunk/treebase-web/src/main/webapp/WEB-INF/pages/home.jsp Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/home.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/home.jsp 2012-01-09 01:33:32 UTC (rev 1010) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/home.jsp 2012-01-10 21:04:34 UTC (rev 1011) @@ -11,11 +11,11 @@ to the authors, publication editors, or reviewers using a special access code. TreeBASE is produced and governed by the <a href="http://www.phylofoundation.org" title="Phyloinformatics Research Foundation, Inc.">The Phyloinformatics Research Foundation, Inc.</a></p> <p>Some recent additions:</p> - <script language="JavaScript" src="http://landmark-project.com/feed2js/feed2js.php?src=http%3A%2F%2Fpipes.yahoo.com%2Fpipes%2Fpipe.run%3F_id%3D41dc2d1544150c1b8e69367059f26950%26_render%3Drss&date=y&utf=y" charset="UTF-8" type="text/javascript"> - </script> - <noscript> - <a href="http://landmark-project.com/feed2js/feed2js.php?src=http%3A%2F%2Fpipes.yahoo.com%2Fpipes%2Fpipe.run%3F_id%3D41dc2d1544150c1b8e69367059f26950%26_render%3Drss&date=y&utf=y&html=y">View RSS feed</a> - </noscript> + <script language="JavaScript" src="http://landmark-project.com/feed2js/feed2js.php?src=http%3A%2F%2Fpipes.yahoo.com%2Fpipes%2Fpipe.run%3F_id%3D41dc2d1544150c1b8e69367059f26950%26_render%3Drss&num=8&date=y" type="text/javascript"> + </script> + <noscript> + <a href="http://landmark-project.com/feed2js/feed2js.php?src=http%3A%2F%2Fpipes.yahoo.com%2Fpipes%2Fpipe.run%3F_id%3D41dc2d1544150c1b8e69367059f26950%26_render%3Drss&num=8&date=y&html=y">View RSS feed</a> + </noscript> <p>The current release includes a host of new features and improvements over the previous TreeBASE prototype. New features include:</p> <ul> <li>Richer annotation of metadata (journal DOIs, specimen georeferences, Genbank accession numbers, etc) </li> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sfr...@us...> - 2012-01-09 01:33:38
|
Revision: 1010 http://treebase.svn.sourceforge.net/treebase/?rev=1010&view=rev Author: sfrgpiel Date: 2012-01-09 01:33:32 +0000 (Mon, 09 Jan 2012) Log Message: ----------- Making the PRF more prominent and updating to the new domain name. Modified Paths: -------------- trunk/treebase-web/src/main/webapp/WEB-INF/pages/about.jsp trunk/treebase-web/src/main/webapp/WEB-INF/pages/home.jsp trunk/treebase-web/src/main/webapp/WEB-INF/pages/people.jsp Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/about.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/about.jsp 2012-01-06 21:20:13 UTC (rev 1009) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/about.jsp 2012-01-09 01:33:32 UTC (rev 1010) @@ -60,8 +60,8 @@ Computational Phylogenetics"). </p> <p> - TreeBASE was released in March 2010 as one of the main products of <a href="http://www.phylorf.org" title="Phyloinformatics Research Foundation, Inc.">The - Phyloinformatics Research Foundation, Inc.</a>, a Connecticut non-profit + TreeBASE was released in March 2010 as one of the main products of <a href="http://www.phylofoundation.org" title="Phyloinformatics Research Foundation, Inc.">The + Phyloinformatics Research Foundation, Inc.</a>, a Connecticut non-stock corporation. The Foundation provides direction, governance, and continuity for software, data sharing, and communication standards to promote phyloinformatic research for the scientific community. Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/home.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/home.jsp 2012-01-06 21:20:13 UTC (rev 1009) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/home.jsp 2012-01-09 01:33:32 UTC (rev 1010) @@ -2,7 +2,14 @@ <div class="gutter"> <h1>Welcome to TreeBASE</h1> <p> - TreeBASE is a repository of phylogenetic information, specifically user-submitted phylogenetic trees and the data used to generate them. TreeBASE accepts all types of phylogenetic data (e.g., trees of species, trees of populations, trees of genes) representing all biotic taxa. Data in TreeBASE are exposed to the public if they are used in a publication that is in press or published in a peer-reviewed scientific journal, book, conference proceedings, or thesis. Data used in publications that are in preparation or in review can be submitted to TreeBASE but are only available to the publication editors or reviewers using a special access code.</p> + TreeBASE is a repository of phylogenetic information, specifically user-submitted phylogenetic + trees and the data used to generate them. TreeBASE accepts all types of phylogenetic data (e.g., + trees of species, trees of populations, trees of genes) representing all biotic taxa. Data in + TreeBASE are exposed to the public if they are used in a publication that is in press or published + in a peer-reviewed scientific journal, book, conference proceedings, or thesis. Data used in + publications that are in preparation or in review can be submitted to TreeBASE but are only available + to the authors, publication editors, or reviewers using a special access code. TreeBASE is produced and + governed by the <a href="http://www.phylofoundation.org" title="Phyloinformatics Research Foundation, Inc.">The Phyloinformatics Research Foundation, Inc.</a></p> <p>Some recent additions:</p> <script language="JavaScript" src="http://landmark-project.com/feed2js/feed2js.php?src=http%3A%2F%2Fpipes.yahoo.com%2Fpipes%2Fpipe.run%3F_id%3D41dc2d1544150c1b8e69367059f26950%26_render%3Drss&date=y&utf=y" charset="UTF-8" type="text/javascript"> </script> Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/people.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/people.jsp 2012-01-06 21:20:13 UTC (rev 1009) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/people.jsp 2012-01-09 01:33:32 UTC (rev 1010) @@ -175,6 +175,6 @@ <h2>Phyloinformatics Research Foundation Inc, Board</h2> <ul> - <li>See <a href="http://www.phylorf.org" title="Phyloinformatics Research Foundation Inc">here</a> for the list of officers and members of the board.</li> + <li>See <a href="http://www.phylofoundation.org" title="Phyloinformatics Research Foundation Inc">here</a> for the list of officers and members of the board.</li> </ul> </div> \ 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: <hs...@us...> - 2012-01-06 21:20:19
|
Revision: 1009 http://treebase.svn.sourceforge.net/treebase/?rev=1009&view=rev Author: hshyket Date: 2012-01-06 21:20:13 +0000 (Fri, 06 Jan 2012) Log Message: ----------- Fixing X-Access-Code restriction 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/PhyloWSTreeController.java 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 2012-01-06 16:46:50 UTC (rev 1008) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSController.java 2012-01-06 21:20:13 UTC (rev 1009) @@ -65,6 +65,7 @@ private static String searchBase = "/treebase-web/search/"; private boolean redirectDownload = true; + private Study TBStudy = null; /** * Child classes return the display page for the focal type @@ -116,8 +117,15 @@ // output format is something else, re-direct to download services else { url = createDownloadUrl(tbID.getId(),serializationFormat,req); - if (!redirectDownload && !ControllerUtil.isReviewerAccessGranted(req, tbID)) { - url = "/treebase-web/accessviolation.html"; + if (!redirectDownload ) { + if (TBStudy != null) { + if (!ControllerUtil.isReviewerAccessGranted(req, TBStudy.getTreebaseIDString())) { + url = "/treebase-web/accessviolation.html"; + } + } + else { + url = "/treebase-web/accessviolation.html"; + } } } } @@ -286,8 +294,9 @@ } } - public void checkAccess(boolean isPublished) { - redirectDownload = isPublished; + public void setStudy(Study study) { + TBStudy = study; + redirectDownload = study.isPublished(); } } 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 2012-01-06 16:46:50 UTC (rev 1008) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSMatrixController.java 2012-01-06 21:20:13 UTC (rev 1009) @@ -45,7 +45,7 @@ throw new ObjectNotFoundException("Can't find study for matrix "+objectId); } - checkAccess(matrix.getStudy().isPublished()); + setStudy(matrix.getStudy()); Map<String,String> params = new HashMap<String,String>(); params.put("id", ""+study.getId()); 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 2012-01-06 16:46:50 UTC (rev 1008) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSStudyController.java 2012-01-06 21:20:13 UTC (rev 1009) @@ -40,7 +40,7 @@ throw new ObjectNotFoundException("Can't find study " + objectId); } - checkAccess(study.isPublished()); + setStudy(study); Map<String,String> params = new HashMap<String,String>(); params.put("id", ""+objectId); 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 2012-01-06 16:46:50 UTC (rev 1008) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTreeController.java 2012-01-06 21:20:13 UTC (rev 1009) @@ -44,10 +44,7 @@ if ( study == null ) { throw new ObjectNotFoundException("Can't find study for tree "+objectId); } - - //not checking access due to need for Phloywidget to access tree when in review - //checkAccess(phyloTree.getStudy().isPublished()); - + Map<String,String> params = new HashMap<String,String>(); params.put("id",""+study.getId()); params.put("treeid", ""+objectId); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hs...@us...> - 2012-01-06 16:46:56
|
Revision: 1008 http://treebase.svn.sourceforge.net/treebase/?rev=1008&view=rev Author: hshyket Date: 2012-01-06 16:46:50 +0000 (Fri, 06 Jan 2012) Log Message: ----------- Adding x-access-code parameter to matrix and tree objects so that it generates a unique file for caching. Removing access to unpublished study's RDF page. Allowing access to unpublished studies trees so that PhyloWidget is able to grab the file Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AnyObjectAsRDFController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTreeController.java trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/matrices.jsp trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/summary.jsp trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/trees.jsp Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AnyObjectAsRDFController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AnyObjectAsRDFController.java 2012-01-03 19:35:57 UTC (rev 1007) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AnyObjectAsRDFController.java 2012-01-06 16:46:50 UTC (rev 1008) @@ -70,6 +70,12 @@ TBPersistable theObject = getStudyService().findByID(theClass, treebaseIDString.getId()); if ( null != theObject ) { + if (! getStudyService().findByID(treebaseIDString.getId()).isPublished()) { + response.setContentType("text/plain"); + response.setStatus(HttpServletResponse.SC_SEE_OTHER); + response.setHeader("Location", "/treebase-web/accessviolation.html"); + return null; + } request.getSession().setAttribute("theObject", theObject); LOGGER.info("Object: "+theObject); } 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 2012-01-03 19:35:57 UTC (rev 1007) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSTreeController.java 2012-01-06 16:46:50 UTC (rev 1008) @@ -45,7 +45,8 @@ throw new ObjectNotFoundException("Can't find study for tree "+objectId); } - checkAccess(study.isPublished()); + //not checking access due to need for Phloywidget to access tree when in review + //checkAccess(phyloTree.getStudy().isPublished()); Map<String,String> params = new HashMap<String,String>(); params.put("id",""+study.getId()); Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/matrices.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/matrices.jsp 2012-01-03 19:35:57 UTC (rev 1007) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/matrices.jsp 2012-01-06 16:46:50 UTC (rev 1008) @@ -13,7 +13,9 @@ </c:url> <c:set var="counter" value="0"/> - +<% + pageContext.setAttribute("accesscode",request.getSession().getAttribute("x-access-code")); +%> <display:table name="matrices" requestURI="" class="list" @@ -67,7 +69,14 @@ sortable="false" class="iconColumn" headerClass="iconColumn"> - <c:url var="url" value="${matrix.phyloWSPath.purl}"><c:param name="format">nexml</c:param></c:url> + <c:url var="url" value="${matrix.phyloWSPath.purl}"> + <c:param name="format">nexml</c:param> + <c:if test="${!empty accesscode}"> + <c:param name="x-access-code"> + <c:out value='${accesscode}' /> + </c:param> + </c:if> + </c:url> <a href="${url}"> <img class="iconButton" @@ -95,7 +104,14 @@ sortable="false" class="iconColumn" headerClass="iconColumn"> - <c:url var="url" value="${matrix.phyloWSPath.purl}"><c:param name="format">nexus</c:param></c:url> + <c:url var="url" value="${matrix.phyloWSPath.purl}"> + <c:param name="format">nexus</c:param> + <c:if test="${!empty accesscode}"> + <c:param name="x-access-code"> + <c:out value='${accesscode}' /> + </c:param> + </c:if> + </c:url> <a href="${url}"> <img class="iconButton" @@ -111,7 +127,8 @@ headerClass="iconColumn"> <c:url value="/search/downloadANexusFile.html" var="originalMatrixURL"> <c:param name="id">${study.id}</c:param> - <c:param name="matrixid">${matrix.id}</c:param> + <c:param name="matrixid">${matrix.id}</c:param> + <c:if test="${!empty accesscode}"><c:param name="x-access-code"><c:out value='${accesscode}' /></c:param></c:if> </c:url> <a href="${originalMatrixURL}"> <img @@ -126,7 +143,14 @@ sortable="false" class="iconColumn" headerClass="iconColumn"> - <c:url var="url" value="${matrix.phyloWSPath.purl}"><c:param name="format">html</c:param></c:url> + <c:url var="url" value="${matrix.phyloWSPath.purl}"> + <c:param name="format">html</c:param> + <c:if test="${!empty accesscode}"> + <c:param name="x-access-code"> + <c:out value='${accesscode}' /> + </c:param> + </c:if> + </c:url> <a href="${url}"> <img class="iconButton" Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/summary.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/summary.jsp 2012-01-03 19:35:57 UTC (rev 1007) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/summary.jsp 2012-01-06 16:46:50 UTC (rev 1008) @@ -69,7 +69,7 @@ </c:if> <c:if test="${not empty cit.URL && cit.URL != 'http://' }"> <li> - Other URL: + Other URL: <a href="<c:out value="${cit.URL}"/>"> <img class="iconButton" src="<fmt:message key="icons.weblink"/>" /> <c:out value="${cit.URL}"/> @@ -87,7 +87,10 @@ </a> </li> <li>Other versions: - <a href="${baseLink}?format=nexus"> + <% + pageContext.setAttribute("accesscode",request.getSession().getAttribute("x-access-code")); + %> + <a href="${baseLink}?format=nexus<c:if test="${!empty accesscode}">&x-access-code=<c:out value='${accesscode}' /></c:if>"> <img class="iconButton" src="<fmt:message key="icons.download.reconstructed"/>" @@ -95,7 +98,7 @@ alt="<fmt:message key="download.reconstructedfile"/>"/> Nexus </a> - <a href="${baseLink}?format=nexml"> + <a href="${baseLink}?format=nexml<c:if test="${!empty accesscode}">&x-access-code=<c:out value='${accesscode}' /></c:if>"> <img class="iconButton" src="<fmt:message key="icons.xml"/>" Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/trees.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/trees.jsp 2012-01-03 19:35:57 UTC (rev 1007) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/trees.jsp 2012-01-06 16:46:50 UTC (rev 1008) @@ -8,11 +8,14 @@ <c:url var="studyURL" value="summary.html"> <c:param name="id" value="${study.id}"/> -</c:url> +</c:url> +<% + pageContext.setAttribute("accesscode",request.getSession().getAttribute("x-access-code")); +%> <script type="text/javascript"> function openPhylowidget(tree_id) { - var realURL = "http://www.phylowidget.org/full/?tree='http://"+location.host+"/treebase-web/tree_for_phylowidget/"+"TB2:Tr"+tree_id+"'"; + var realURL = "http://www.phylowidget.org/full/?tree='http://"+location.host+"/treebase-web/tree_for_phylowidget/"+"TB2:Tr"+tree_id<c:if test="${!empty accesscode}">+"?x-access-code=<c:out value='${accesscode}' />"</c:if>+"'"; window.open(realURL,'myplwidget') } </script> @@ -67,7 +70,14 @@ sortable="false" class="iconColumn" headerClass="iconColumn"> - <c:url var="url" value="${baseURL}"><c:param name="format">nexml</c:param></c:url> + <c:url var="url" value="${baseURL}"> + <c:param name="format">nexml</c:param> + <c:if test="${!empty accesscode}"> + <c:param name="x-access-code"> + <c:out value='${accesscode}' /> + </c:param> + </c:if> + </c:url> <a href="${url}"> <img class="iconButton" @@ -95,7 +105,14 @@ sortable="false" class="iconColumn" headerClass="iconColumn"> - <c:url var="url" value="${baseURL}"><c:param name="format">nexus</c:param></c:url> + <c:url var="url" value="${baseURL}"> + <c:param name="format">nexus</c:param> + <c:if test="${!empty accesscode}"> + <c:param name="x-access-code"> + <c:out value='${accesscode}' /> + </c:param> + </c:if> + </c:url> <a href="${url}"> <img class="iconButton" @@ -111,7 +128,12 @@ headerClass="iconColumn"> <c:url value="/search/downloadANexusFile.html" var="originalTreeURL"> <c:param name="id">${study.id}</c:param> - <c:param name="treeid">${tree.id}</c:param> + <c:param name="treeid">${tree.id}</c:param> + <c:if test="${!empty accesscode}"> + <c:param name="x-access-code"> + <c:out value='${accesscode}' /> + </c:param> + </c:if> </c:url> <a href="${originalTreeURL}"> <img This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hs...@us...> - 2012-01-03 19:36:03
|
Revision: 1007 http://treebase.svn.sourceforge.net/treebase/?rev=1007&view=rev Author: hshyket Date: 2012-01-03 19:35:57 +0000 (Tue, 03 Jan 2012) Log Message: ----------- Fixing issue where reviewer was not able to access in progress submission 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/util/ControllerUtil.java 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-12-16 02:33:42 UTC (rev 1006) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSController.java 2012-01-03 19:35:57 UTC (rev 1007) @@ -19,6 +19,7 @@ import org.cipres.treebase.domain.study.Study; import org.cipres.treebase.domain.study.StudyService; import org.cipres.treebase.web.Constants; +import org.cipres.treebase.web.util.ControllerUtil; /** * This class re-directs clients to one of a number of other controllers depending @@ -115,7 +116,7 @@ // output format is something else, re-direct to download services else { url = createDownloadUrl(tbID.getId(),serializationFormat,req); - if (!redirectDownload) { + if (!redirectDownload && !ControllerUtil.isReviewerAccessGranted(req, tbID)) { url = "/treebase-web/accessviolation.html"; } } Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/ControllerUtil.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/ControllerUtil.java 2011-12-16 02:33:42 UTC (rev 1006) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/ControllerUtil.java 2012-01-03 19:35:57 UTC (rev 1007) @@ -322,6 +322,37 @@ } } return passedHashedIDCheck; - } + } + + /** + * + * This method passes an ID into the function + * + */ + public static boolean isReviewerAccessGranted(HttpServletRequest req, TreebaseIDString tbidstr ) { + boolean passedHashedIDCheck = false; + HttpSession session = req.getSession(); + + Object xAccesCodeObject = session.getAttribute(Constants.X_ACCESS_CODE); + if ( xAccesCodeObject != null ) { + String suppliedHashedID = xAccesCodeObject.toString(); + //TreebaseIDString tbidstr = new TreebaseIDString(Study.class,Long.parseLong((String) id)); + if ( suppliedHashedID.equals(tbidstr.getNamespacedGUID().getHashedIDString()) ) { + passedHashedIDCheck = true; + Object agreementAccepted = session.getAttribute(Constants.REVIEWER_AGREEMENT_ACCEPTED); + if ( agreementAccepted == null || ((Boolean)agreementAccepted).booleanValue() == false ) { + LOGGER.info("Going to display object/file: "+agreementAccepted); + session.setAttribute("displayAgreement",true); + } + else { + LOGGER.info("Not going to display object/file"); + session.setAttribute("displayAgreement",false); + } + } + } + return passedHashedIDCheck; + } + + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SourceForge.net <no...@so...> - 2011-12-25 00:47:21
|
Bugs item #3465126, was opened at 2011-12-24 16:47 Message generated for change (Tracker Item Submitted) made by sfrgpiel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=3465126&group_id=248804 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: ui Group: None Status: Open Priority: 8 Private: No Submitted By: William Piel (sfrgpiel) Assigned to: hshyket (hshyket) Summary: Data unavailable to reviewers Initial Comment: As a result of new changes to our authentication system (in which PURLs are only remapped for data that are "public"), we have lost the ability for reviewers to download/inspect data ahead of publishing. For example, this URL: http://purl.org/phylo/treebase/phylows/study/TB2:S10899?x-access-code=76a402a5dd67ebc2599e072d18f368c1&format=html ... contains an x-access-code parameter, which is supposed to give special access to the data even if the data are not yet public. The new authentication system does not handle this properly for reviewers. All the download links that use PURLs need to be made downloadable when the x-access-code is used. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=3465126&group_id=248804 |
From: SourceForge.net <no...@so...> - 2011-12-25 00:29:55
|
Bugs item #3413049, was opened at 2011-09-22 13:50 Message generated for change (Settings changed) made by sfrgpiel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=3413049&group_id=248804 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: ui Group: None >Status: Closed Priority: 7 Private: No Submitted By: William Piel (sfrgpiel) Assigned to: hshyket (hshyket) Summary: Download selection of trees Initial Comment: As discussed, it would be valuable to have a button to download the current selection of trees. At a minimum, this generates a NEXUS file with the trees all in the same tree block and with the name of each tree being the tree_id. Ideally, it would build a distinct list of all taxon labels in the trees and use that to generate a taxon block and a translation table in the tree block (as in treeBlock.generateAFileDynamically). But this may prove too slow for large collections of trees, in which case it is better just to dump the nexickstring inside a trees block. Perhaps do a "number of trees" test, where fewer than 100 trees can use the TAXA BLOCK and TRANSLATION table, while more than 100 trees would just dump the newickstring. Also ideally a parallel download option would also be available if getFormat(request) == FORMAT_NEXML -- but if too hard to implement, then never mind. For a NeXML download, the tree name does not need to be substituted with the tree_id because this can be supplied as metadata. e.g. for tree_id 4105 and study_id 1000, express like so: <tree about="#Tr4105" id="Tr4105" label="ML tree" xsi:type="nex:FloatTree"> <meta href="http://purl.org/phylo/treebase/phylows/study/TB2:S1000" id="meta60715" rel="rdfs:isDefinedBy" xsi:type="nex:ResourceMeta"/> The priority is for the NEXUS download button (or the NeXML download button) to be used in the UI. But ultimately it would be great if our API had the same functionality. For example, currently a set of trees can only be viewed in RSS: http://purl.org/phylo/treebase/phylows/taxon/find?query=dcterms.title==%22Homo%20sapiens%22&format=rss1&recordSchema=tree but ideally the same query (get me all trees with humans) would be downloadable as a single NEXUS file like so: http://purl.org/phylo/treebase/phylows/taxon/find?query=dcterms.title==%22Homo%20sapiens%22&format=nexus&recordSchema=tree or NeXML like so: http://purl.org/phylo/treebase/phylows/taxon/find?query=dcterms.title==%22Homo%20sapiens%22&format=nexml&recordSchema=tree bp ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=3413049&group_id=248804 |
From: SourceForge.net <no...@so...> - 2011-12-25 00:29:24
|
Bugs item #3438514, was opened at 2011-11-15 13:48 Message generated for change (Settings changed) made by sfrgpiel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=3438514&group_id=248804 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: ui Group: None >Status: Closed Priority: 7 Private: No Submitted By: William Piel (sfrgpiel) Assigned to: hshyket (hshyket) Summary: MSIE9 not recognized as more advanced than MSIE8 Initial Comment: Mark Miller reported the following behavior (below). At least the proper recognition of MSIE9 should be fixed. For suppressing a constant reminder, we can consider fixing this if easy to fix -- but so long as it is properly recognizing the browser, constantly annoying users doesn't matter so much given that the incompatible browsers won't work. This warning message is more important in the submission system, where submissions may be impossible to complete without a fully-compatible browser. bp Hi folks, I browsed to TreeBaseII to see how it was doing. It looks great. But there is a very annoying "feature" Every time I hit a link, it throws a message scolding me for Having an old outdated browser. In my opinion, making this happen on every click will drive people away, One warning on arrival would suffice. Second, and more importantly, I am using MSIE 9, not MSIE 8, and therefore A completely up to date browser. The code should be changed to Not view MSIE 9 as an out of date browser. Best, Mark ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=3438514&group_id=248804 |
From: SourceForge.net <no...@so...> - 2011-12-25 00:28:05
|
Bugs item #3410646, was opened at 2011-09-16 11:07 Message generated for change (Settings changed) made by sfrgpiel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=3410646&group_id=248804 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: ui Group: None >Status: Closed Priority: 8 Private: No Submitted By: William Piel (sfrgpiel) Assigned to: hshyket (hshyket) Summary: Uncaught Exception when uploading row segment file Initial Comment: There is some instability when uploading row segment files. This may have to do with return keys (unix vs mac vs win), missing values, and limits on the length of a column value. At any rate, it needs to be made more robust. Here is an example of a problem. First create a submission and upload the attached nexus file. Then try uploading the columns Row Taxon Label, Start Index, End Index, Inst. Acronym, Catalog Number, Genbank Accession, Other Accession, Collector, Country, State, Locality, Notes -- from the attached row segment file. The result is the uncaught exception. bp Uncaught Exception Encountered java.lang.IndexOutOfBoundsException: Index: 15, Size: 15 at java.util.ArrayList.rangeCheck(ArrayList.java:571) at java.util.ArrayList.get(ArrayList.java:349) at org.cipres.treebase.domain.matrix.RowSegment.update(RowSegment.java:379) at org.cipres.treebase.service.matrix.RowSegmentServiceImpl.mapToSegments(RowSegmentServiceImpl.java:380) at org.cipres.treebase.service.matrix.RowSegmentServiceImpl.createSegments(RowSegmentServiceImpl.java:287) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy75.createSegments(Unknown Source) at org.cipres.treebase.web.controllers.RowSegmentDataTableController.onSubmit(RowSegmentDataTableController.java:112) at org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:267) at org.springframework.web.servlet.mvc.CancellableFormController.processFormSubmission(CancellableFormController.java:140) at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:265) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:858) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:164) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:406) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119) at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:217) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:191) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148) at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:90) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:837) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:640) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1286) at java.lang.Thread.run(Thread.java:636) Cookies: __utmz=[5099126.1305666484.1.1.utmcsr] __utmc=[5099126] __utmb=[5099126.43.9.1316195477908] __utma=[5099126.226138284.1305666484.1316186851.1316194155.50] itemToHighlight=[http%3A//treebase-dev.nescent.org/treebase-web/user/matrixList.html] JSESSIONID=[4660E6A549004EB9B896A6CDBB35A18D] __utmz=[53240375.1315795401.152.31.utmccn] __utma=[53240375.1924499357.1236724314.1315764093.1315795401.152] ---------------------------------------------------------------------- Comment By: William Piel (sfrgpiel) Date: 2011-09-22 12:16 Message: Thanks for the fix. A new problem: trying the upload the attached row segment file still causes a problem because one of the "other accession number" column has a value that exceeds the schema size. This needs fixing: crop incoming data, perhaps providing a warning that some values were cropped. bp Data Access Failure Could not execute JDBC batch update; nested exception is org.hibernate.exception.DataException: Could not execute JDBC batch update org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.DataException: Could not execute JDBC batch update Caused by: org.hibernate.exception.DataException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:77) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106) at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:578) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:662) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:632) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:314) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy75.createSegments(Unknown Source) at org.cipres.treebase.web.controllers.RowSegmentDataTableController.onSubmit(RowSegmentDataTableController.java:112) at org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:267) at org.springframework.web.servlet.mvc.CancellableFormController.processFormSubmission(CancellableFormController.java:140) at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:265) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:858) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:164) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:406) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119) at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:217) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:191) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148) at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:90) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:837) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:640) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1286) at java.lang.Thread.run(Thread.java:636) Caused by: java.sql.BatchUpdateException: Batch entry 8 insert into ROWSEGMENT (VERSION, EndIndex, MATRIXROW_ID, CatalogNum, CollectionCode, Collector, Country, Elevation, GenBAccession, InstAcronym, Latitude, Locality, Longitude, Notes, OtherAccession, SampleDate, State, StartIndex, TAXONLABEL_ID, Title, ROWSEGMENT_ID) values (0, 852, 764320, , NULL, NULL, France, NULL, EU041861, , NULL, NULL, NULL, NULL, CBS 157.54; ATCC 15680; MUCL 1081; MUCL 7992; MUCL 15756, NULL, , 1, NULL, NULL, 9264) was aborted. Call getNextException to see the cause. at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2537) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1328) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:351) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2674) at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246) ... 75 more ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=3410646&group_id=248804 |
From: SourceForge.net <no...@so...> - 2011-12-25 00:27:22
|
Bugs item #3344355, was opened at 2011-06-29 08:29 Message generated for change (Settings changed) made by sfrgpiel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=3344355&group_id=248804 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: ui Group: None >Status: Closed Priority: 9 Private: No Submitted By: William Piel (sfrgpiel) Assigned to: hshyket (hshyket) Summary: NULL pointer exception when deleting tree Initial Comment: When deleting the following tree (either by deleting the tree itself or deleting the parent treeblock): submission_id = 11642 study_id = 11652 treeblock_id = 14731 tree_id = 47096 I get a null pointer exception (it's probably best to test this on treebase-dev). The problem appears to result from some trees lacking a value for phylotree.study_id. It's fairly rare, but very annoying for users, as it forces them to abandon their submissions and start new ones. I have tried replicating the problem on a new submission by re-uploading exactly the same files that were previously uploaded, but I can't replicate it -- all the trees I have uploaded are properly registered with their study_id. This seems to be a rare event, which will make finding the source of the problem difficult. If we fail to find the cause of the problem, one kluge is to relax the requirement that phylotree.study_id be not null for the deletion code to work -- but I don't know that this is possible, and anyway the absence of a proper phylotree.study_id will probably cause problems elsewhere, like in our search interface. So that's not a good solution. Alternatively, how about some code that is triggered each time a submission page for a study is opened, and it then checks that all trees in the submission have study_id values -- if they don't, the problem is corrected. This query finds all cases where this is a problem: select tls.study_id, pt.phylotree_id from phylotree pt join treeblock tb using(treeblock_id) join taxonlabelset tls using (taxonlabelset_id) where pt.study_id IS NULL and tls.study_id IS NOT NULL order by tls.study_id and this query seems to solve the problem (I've run it on treebase-stage and it has fixed the problem there -- subsequently allowing deletion): UPDATE phylotree SET study_id = tls.study_id FROM phylotree pt JOIN treeblock tb USING(treeblock_id) JOIN taxonlabelset tls USING (taxonlabelset_id) WHERE pt.study_id IS NULL AND tls.study_id IS NOT NULL AND phylotree.phylotree_id = pt.phylotree_id Running this update on production will, ultimately, be needed. bp http://treebase-dev.nescent.org/treebase-web/user/deleteATreeBlock.html?treeblockid=14731 Uncaught Exception Encountered java.lang.NullPointerException at org.cipres.treebase.web.controllers.DeleteATreeBlockController.referenceData(DeleteATreeBlockController.java:160) at org.springframework.web.servlet.mvc.SimpleFormController.referenceData(SimpleFormController.java:214) at org.springframework.web.servlet.mvc.AbstractFormController.showForm(AbstractFormController.java:574) at org.springframework.web.servlet.mvc.SimpleFormController.showForm(SimpleFormController.java:198) at org.cipres.treebase.web.controllers.BaseFormController.showForm(BaseFormController.java:171) at org.springframework.web.servlet.mvc.SimpleFormController.showForm(SimpleFormController.java:175) at org.springframework.web.servlet.mvc.AbstractFormController.showNewForm(AbstractFormController.java:338) at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:278) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:858) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:431) at javax.servlet.http.HttpServlet.service(HttpServlet.java:627) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:164) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:406) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119) at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:217) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:191) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148) at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:90) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:837) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:640) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1286) at java.lang.Thread.run(Thread.java:636) Cookies: __utmz=[5099126.1305666484.1.1.utmcsr] __utmc=[5099126] __utmb=[5099126.7.10.1309355320] __utma=[5099126.226138284.1305666484.1308419192.1309355320.24] itemToHighlight=[http%3A//treebase-dev.nescent.org/treebase-web/user/treeBlockList.html] JSESSIONID=[802CD543FEEDA1CE0A74F06C94542325] __utmc=[53240375] __utma=[53240375.1924499357.1236724314.1306793973.1309304847.132] __utmz=[53240375.1306793973.131.23.utmccn] ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=3344355&group_id=248804 |
From: SourceForge.net <no...@so...> - 2011-12-25 00:26:13
|
Bugs item #3438960, was opened at 2011-11-16 11:26 Message generated for change (Settings changed) made by sfrgpiel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=3438960&group_id=248804 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed Priority: 9 Private: No Submitted By: William Piel (sfrgpiel) Assigned to: hshyket (hshyket) Summary: Exception on searching on taxon ID or study ID = null Initial Comment: Any number, including in the form Tx12345, will barf an exception for taxon ID. Also, if an URL to a study object is missing a study ID, there is also an exception. e.g.: http://www.treebase.org/treebase-web/search/study/summary.html?id= ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=3438960&group_id=248804 |