- Download-Links für Publikationen werden jetzt über einen ExtraXMLGenerator ausgegeben
- Formatierungen git-svn-id: https://svn.libreccm.org/ccm/trunk@1231 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
bcd5af53bd
commit
c8ef06aa65
|
|
@ -3,9 +3,11 @@ package com.arsdigita.london.navigation.ui.object;
|
||||||
import com.arsdigita.london.navigation.Navigation;
|
import com.arsdigita.london.navigation.Navigation;
|
||||||
import com.arsdigita.persistence.DataCollection;
|
import com.arsdigita.persistence.DataCollection;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.logging.Level;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
@ -281,6 +283,13 @@ public class CustomizableObjectList extends ComplexObjectList {
|
||||||
//- The HttpRequest is available here.
|
//- The HttpRequest is available here.
|
||||||
//So we use the HTTP request directly, which allows use to use a
|
//So we use the HTTP request directly, which allows use to use a
|
||||||
//dedicated parameter for each of the filters.
|
//dedicated parameter for each of the filters.
|
||||||
|
/*if (request.getCharacterEncoding() == null) {*/
|
||||||
|
try {
|
||||||
|
request.setCharacterEncoding("UTF-8");
|
||||||
|
} catch (UnsupportedEncodingException ex) {
|
||||||
|
logger.error(ex);
|
||||||
|
}
|
||||||
|
//}
|
||||||
for (Map.Entry<String, Filter> filterEntry : filters.entrySet()) {
|
for (Map.Entry<String, Filter> filterEntry : filters.entrySet()) {
|
||||||
String value = request.getParameter(filterEntry.getKey());
|
String value = request.getParameter(filterEntry.getKey());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
package com.arsdigita.london.navigation.ui.object;
|
package com.arsdigita.london.navigation.ui.object;
|
||||||
|
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,14 @@
|
||||||
package com.arsdigita.cms.contenttypes;
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
import com.arsdigita.cms.ContentPage;
|
import com.arsdigita.cms.ContentPage;
|
||||||
|
import com.arsdigita.cms.ExtraXMLGenerator;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
import com.arsdigita.persistence.DataCollection;
|
import com.arsdigita.persistence.DataCollection;
|
||||||
import com.arsdigita.persistence.DataObject;
|
import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|
@ -280,4 +282,11 @@ public class Publication extends ContentPage {
|
||||||
|
|
||||||
orgaunit.remove(ORGAUNIT_PUBLICATIONS, publication);
|
orgaunit.remove(ORGAUNIT_PUBLICATIONS, publication);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExtraXMLGenerator> getExtraXMLGenerators() {
|
||||||
|
final List<ExtraXMLGenerator> generators = super.getExtraXMLGenerators();
|
||||||
|
generators.add(new SciPublicationExtraXmlGenerator());
|
||||||
|
return generators;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Page;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.cms.ContentItem;
|
||||||
|
import com.arsdigita.cms.ExtraXMLGenerator;
|
||||||
|
import com.arsdigita.cms.scipublications.exporter.PublicationFormat;
|
||||||
|
import com.arsdigita.cms.scipublications.exporter.SciPublicationsExporters;
|
||||||
|
import com.arsdigita.xml.Element;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciPublicationExtraXmlGenerator implements ExtraXMLGenerator {
|
||||||
|
|
||||||
|
public void generateXML(final ContentItem item,
|
||||||
|
final Element element,
|
||||||
|
final PageState state) {
|
||||||
|
if (!(item instanceof Publication)) {
|
||||||
|
throw new IllegalArgumentException(String.format(
|
||||||
|
"ExtraXMLGenerator '%s' only supports items of type '%s'.",
|
||||||
|
getClass().getName(),
|
||||||
|
Publication.class.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PublicationFormat> formats = SciPublicationsExporters.getInstance().getSupportedFormats();
|
||||||
|
|
||||||
|
for(PublicationFormat format : formats) {
|
||||||
|
createExportLink(format, element, (Publication) item, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createExportLink(final PublicationFormat format,
|
||||||
|
final Element parent,
|
||||||
|
final Publication publication,
|
||||||
|
final PageState state) {
|
||||||
|
final Element exportLinkElem = parent.newChildElement("publicationExportLink");
|
||||||
|
final Element formatKeyElem = exportLinkElem.newChildElement("formatKey");
|
||||||
|
formatKeyElem.setText(format.getName().toLowerCase());
|
||||||
|
final Element formatNameElem = exportLinkElem.newChildElement("formatName");
|
||||||
|
formatNameElem.setText(format.getName());
|
||||||
|
final Element publicationIdElem = exportLinkElem.newChildElement("publicationId");
|
||||||
|
publicationIdElem.setText(publication.getID().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addGlobalStateParams(final Page page) {
|
||||||
|
//Nothing for now
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue