Fixed some identifiers which illegal for Oracle DBs in ExternalLink.pdl

git-svn-id: https://svn.libreccm.org/ccm/trunk@3716 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2015-11-04 17:44:01 +00:00
parent a4bb0eb959
commit 0f75a5b17a
2 changed files with 214 additions and 153 deletions

View File

@ -21,10 +21,10 @@ model com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentPage;
object type ExternalLink extends ContentPage { object type ExternalLink extends ContentPage {
String [0..1] url = ct_extLinks.url VARCHAR(2000); String [0..1] url = ct_extlinks.url VARCHAR(2000);
String [0..1] comment = ct_extLinks.comment VARCHAR(4000); String [0..1] comment = ct_extlinks.link_comment VARCHAR(4000);
Boolean [0..1] showComment = ct_extLinks.show_comment; Boolean [0..1] showComment = ct_extlinks.show_comment;
Boolean [0..1] targetNewWindow = ct_extLinks.target_new_window; Boolean [0..1] targetNewWindow = ct_extlinks.target_new_window;
reference key (ct_extLinks.extLink_id); reference key (ct_extlinks.extlink_id);
} }

View File

@ -61,14 +61,14 @@ import org.apache.log4j.Logger;
/** /**
* A class for managing and obtaining a Stylesheet based on the current * A class for managing and obtaining a Stylesheet based on the current
* request's location in the site map. * request's location in the site map. First, we try to find a stylesheet
* First, we try to find a stylesheet specific to this site node. If we can't * specific to this site node. If we can't find one, then we walk up the site
* find one, then we walk up the site map until we find a parent of this site * map until we find a parent of this site node that has a stylesheet associated
* node that has a stylesheet associated with it. * with it.
* *
* If we haven't found one by the time we reach the root, then we'll * If we haven't found one by the time we reach the root, then we'll do the same
* do the same tree walk except we'll look for the stylesheet * tree walk except we'll look for the stylesheet associated with the
* associated with the <em>package</em> mounted on each site node. * <em>package</em> mounted on each site node.
* *
* @author Bill Schneider * @author Bill Schneider
* @version $Id: PageTransformer.java 2071 2010-01-28 18:24:06Z pboy $ * @version $Id: PageTransformer.java 2071 2010-01-28 18:24:06Z pboy $
@ -86,36 +86,50 @@ public class PageTransformer implements PresentationManager {
registerXSLParameterGenerator("contextPath", registerXSLParameterGenerator("contextPath",
new XSLParameterGenerator() { new XSLParameterGenerator() {
@Override @Override
public String generateValue(HttpServletRequest request) { public String generateValue(
return request.getContextPath(); HttpServletRequest request) {
return request
.getContextPath();
} }
}); });
registerXSLParameterGenerator("root-context-prefix", registerXSLParameterGenerator("root-context-prefix",
new XSLParameterGenerator() { new XSLParameterGenerator() {
@Override @Override
public String generateValue(HttpServletRequest request) { public String generateValue(
return Web.getConfig().getDispatcherContextPath(); HttpServletRequest request) {
return Web.getConfig()
.getDispatcherContextPath();
} }
}); });
registerXSLParameterGenerator("context-prefix", registerXSLParameterGenerator("context-prefix",
new XSLParameterGenerator() { new XSLParameterGenerator() {
@Override @Override
public String generateValue(HttpServletRequest request) { public String generateValue(
return Web.getWebContext().getRequestURL().getContextPath(); HttpServletRequest request) {
return Web.getWebContext()
.getRequestURL()
.getContextPath();
} }
}); });
registerXSLParameterGenerator("internal-theme", registerXSLParameterGenerator("internal-theme",
new XSLParameterGenerator() { new XSLParameterGenerator() {
@Override @Override
public String generateValue(HttpServletRequest request) { public String generateValue(
return Web.getWebContext().getRequestURL().getContextPath() HttpServletRequest request) {
return Web.getWebContext()
.getRequestURL()
.getContextPath()
+ com.arsdigita.web.URL.INTERNAL_THEME_DIR; + com.arsdigita.web.URL.INTERNAL_THEME_DIR;
} }
@ -123,18 +137,24 @@ public class PageTransformer implements PresentationManager {
registerXSLParameterGenerator("dispatcher-prefix", registerXSLParameterGenerator("dispatcher-prefix",
new XSLParameterGenerator() { new XSLParameterGenerator() {
@Override @Override
public String generateValue(HttpServletRequest request) { public String generateValue(
return com.arsdigita.web.URL.getDispatcherPath(); HttpServletRequest request) {
return com.arsdigita.web.URL
.getDispatcherPath();
} }
}); });
registerXSLParameterGenerator("dcp-on-buttons", registerXSLParameterGenerator("dcp-on-buttons",
new XSLParameterGenerator() { new XSLParameterGenerator() {
@Override @Override
public String generateValue(HttpServletRequest request) { public String generateValue(
if (Bebop.getConfig().doubleClickProtectionOnButtons()) { HttpServletRequest request) {
if (Bebop.getConfig()
.doubleClickProtectionOnButtons()) {
return "true"; return "true";
} else { } else {
return null; return null;
@ -146,51 +166,68 @@ public class PageTransformer implements PresentationManager {
registerXSLParameterGenerator("dcp-on-links", registerXSLParameterGenerator("dcp-on-links",
new XSLParameterGenerator() { new XSLParameterGenerator() {
@Override @Override
public String generateValue(HttpServletRequest request) { public String generateValue(
if (Bebop.getConfig().doubleClickProtectionOnLinks()) { HttpServletRequest request) {
if (Bebop.getConfig()
.doubleClickProtectionOnLinks()) {
return "true"; return "true";
} else { } else {
return null; return null;
} }
} }
}); });
registerXSLParameterGenerator("user-agent", registerXSLParameterGenerator("user-agent",
new XSLParameterGenerator() { new XSLParameterGenerator() {
@Override @Override
public String generateValue(HttpServletRequest request) { public String generateValue(
return request.getHeader("User-Agent"); HttpServletRequest request) {
return request.getHeader(
"User-Agent");
} }
}); });
registerXSLParameterGenerator("negotiated-language", registerXSLParameterGenerator("negotiated-language",
new XSLParameterGenerator() { new XSLParameterGenerator() {
@Override @Override
public String generateValue(HttpServletRequest request) { public String generateValue(
return GlobalizationHelper.getNegotiatedLocale().getLanguage(); HttpServletRequest request) {
return GlobalizationHelper
.getNegotiatedLocale()
.getLanguage();
} }
}); });
registerXSLParameterGenerator("selected-language", registerXSLParameterGenerator("selected-language",
new XSLParameterGenerator() { new XSLParameterGenerator() {
@Override @Override
public String generateValue(HttpServletRequest request) { public String generateValue(
Locale selectedLocale = com.arsdigita.globalization.GlobalizationHelper.getSelectedLocale(request); HttpServletRequest request) {
return (selectedLocale != null) ? selectedLocale.toString() : ""; Locale selectedLocale
= com.arsdigita.globalization.GlobalizationHelper
.getSelectedLocale(request);
return (selectedLocale != null)
? selectedLocale
.toString() : "";
} }
}); });
registerXSLParameterGenerator("request-scheme", registerXSLParameterGenerator("request-scheme",
new XSLParameterGenerator() { new XSLParameterGenerator() {
@Override @Override
public String generateValue(HttpServletRequest request) { public String generateValue(
HttpServletRequest request) {
return request.getScheme(); return request.getScheme();
} }
@ -198,8 +235,10 @@ public class PageTransformer implements PresentationManager {
registerXSLParameterGenerator("server-name", registerXSLParameterGenerator("server-name",
new XSLParameterGenerator() { new XSLParameterGenerator() {
@Override @Override
public String generateValue(HttpServletRequest request) { public String generateValue(
HttpServletRequest request) {
return request.getServerName(); return request.getServerName();
} }
@ -207,24 +246,36 @@ public class PageTransformer implements PresentationManager {
registerXSLParameterGenerator("server-port", registerXSLParameterGenerator("server-port",
new XSLParameterGenerator() { new XSLParameterGenerator() {
@Override @Override
public String generateValue(HttpServletRequest request) { public String generateValue(
return Integer.toString(request.getServerPort()); HttpServletRequest request) {
return Integer.toString(
request.getServerPort());
} }
}); });
registerXSLParameterGenerator("host", registerXSLParameterGenerator("host",
new XSLParameterGenerator() { new XSLParameterGenerator() {
@Override @Override
public String generateValue(HttpServletRequest request) { public String generateValue(
if (request.getServerPort() == 80) { HttpServletRequest request) {
return String.format("%s://%s", request.getScheme(), request.getServerName()); if (request.getServerPort()
== 80) {
return String.format(
"%s://%s", request
.getScheme(), request
.getServerName());
} else { } else {
return String.format("%s://%s:%d", return String.format(
"%s://%s:%d",
request.getScheme(), request.getScheme(),
request.getServerName(), request
request.getServerPort()); .getServerName(),
request
.getServerPort());
} }
} }
@ -235,17 +286,17 @@ public class PageTransformer implements PresentationManager {
// XXX These need to move somewhere else. // XXX These need to move somewhere else.
/** /**
* This is used to indicate that all xsl templates used should * This is used to indicate that all xsl templates used should be pulled
* be pulled from the disk and not from the cache. If this * from the disk and not from the cache. If this is in the request with a
* is in the request with a value of Boolean.TRUE then * value of Boolean.TRUE then all XSL Stylesheets are pulled from the disk,
* all XSL Stylesheets are pulled from the disk, not the cache * not the cache
*/ */
public static final String CACHE_XSL_NONE = "cacheXSLNone"; public static final String CACHE_XSL_NONE = "cacheXSLNone";
/** /**
* This is used to indicate that the "fancy errors" should be * This is used to indicate that the "fancy errors" should be used and that
* used and that the errors should be placed in the request * the errors should be placed in the request for later use. To use this,
* for later use. To use this, have the code place an attribute * have the code place an attribute with this name in the request with the
* with this name in the request with the value of Boolean.TRUE * value of Boolean.TRUE
*/ */
public static final String FANCY_ERRORS = "fancyErrors"; public static final String FANCY_ERRORS = "fancyErrors";
/** /**
@ -318,17 +369,17 @@ public class PageTransformer implements PresentationManager {
} }
/** /**
* Serves an XML Document, getting and applying the appropriate XSLT. * Serves an XML Document, getting and applying the appropriate XSLT. Also
* Also allows for parameters to be set for the transformer. These will * allows for parameters to be set for the transformer. These will become
* become top-level xsl:params in the stylesheet. * top-level xsl:params in the stylesheet. The "contextPath" parameter will
* The "contextPath" parameter will always be passed to XSLT, which is the * always be passed to XSLT, which is the value of
* value of <code>req.getWebContextPath()</code>. * <code>req.getWebContextPath()</code>.
* *
* @param doc the Bebop page to serve * @param doc the Bebop page to serve
* @param req the servlet request * @param req the servlet request
* @param resp the servlet response * @param resp the servlet response
* @param params a set of name-value pairs to pass as parameters * @param params a set of name-value pairs to pass as parameters to the
* to the Transformer * Transformer
*/ */
public void servePage(final Document doc, public void servePage(final Document doc,
final HttpServletRequest req, final HttpServletRequest req,
@ -343,7 +394,6 @@ public class PageTransformer implements PresentationManager {
Assert.exists(resp, HttpServletResponse.class); Assert.exists(resp, HttpServletResponse.class);
} }
Profiler.startOp("XSLT"); Profiler.startOp("XSLT");
try { try {
final String charset = Globalization.getDefaultCharset( final String charset = Globalization.getDefaultCharset(
@ -356,7 +406,8 @@ public class PageTransformer implements PresentationManager {
DeveloperSupport.startStage("PresMgr get stylesheet"); DeveloperSupport.startStage("PresMgr get stylesheet");
boolean fancyErrors = Bebop.getConfig().wantFancyXSLErrors() boolean fancyErrors = Bebop.getConfig().wantFancyXSLErrors()
|| Boolean.TRUE.equals(req.getAttribute( || Boolean.TRUE.equals(req
.getAttribute(
FANCY_ERRORS)); FANCY_ERRORS));
// Get the stylesheet transformer object corresponding to the // Get the stylesheet transformer object corresponding to the
@ -435,7 +486,10 @@ public class PageTransformer implements PresentationManager {
DispatcherHelper.forceCacheDisable(resp); DispatcherHelper.forceCacheDisable(resp);
final long start = System.currentTimeMillis();
writer.println(doc.toString(true)); writer.println(doc.toString(true));
s_log.debug(String.format("Generated XML output in %d ms.",
System.currentTimeMillis() - start));
} else if (output.equals("xsl")) { } else if (output.equals("xsl")) {
DeveloperSupport.startStage("PresMgr get stylesheet"); DeveloperSupport.startStage("PresMgr get stylesheet");
@ -488,8 +542,8 @@ public class PageTransformer implements PresentationManager {
} }
/** /**
* Ends the current transaction. Is a performance optimization to end * Ends the current transaction. Is a performance optimization to end ASAP
* ASAP before serving the page. * before serving the page.
* *
* @param req HTTP request. * @param req HTTP request.
*/ */
@ -504,9 +558,10 @@ public class PageTransformer implements PresentationManager {
/** /**
* This adds a generator to the list of parameters available to * This adds a generator to the list of parameters available to
* XSLStylesheets. If this is called a second time with the same * XSLStylesheets. If this is called a second time with the same parameter
* parameter name then all previous calls are overwritten and * name then all previous calls are overwritten and only the last registered
* only the last registered generator is used. * generator is used.
*
* @param parameterName * @param parameterName
* @param parameterGenerator * @param parameterGenerator
*/ */
@ -516,8 +571,9 @@ public class PageTransformer implements PresentationManager {
} }
/** /**
* This removes the parameter from the list of parameters that * This removes the parameter from the list of parameters that will be added
* will be added to stylesheets * to stylesheets
*
* @param parameterName * @param parameterName
*/ */
public static void removeXSLParameterGenerator(String parameterName) { public static void removeXSLParameterGenerator(String parameterName) {
@ -527,6 +583,7 @@ public class PageTransformer implements PresentationManager {
/** /**
* This is a Collection of all names of XSL Parameters that have been * This is a Collection of all names of XSL Parameters that have been
* registered * registered
*
* @return * @return
*/ */
public static Collection getXSLParameterNames() { public static Collection getXSLParameterNames() {
@ -534,16 +591,19 @@ public class PageTransformer implements PresentationManager {
} }
/** /**
* This takes a name and request and returns the value that should * This takes a name and request and returns the value that should be used
* be used in the XSL for the given name * in the XSL for the given name
*
* @param name * @param name
* @param request * @param request
*
* @return * @return
*/ */
public static String getXSLParameterValue(String name, public static String getXSLParameterValue(String name,
HttpServletRequest request) { HttpServletRequest request) {
XSLParameterGenerator generator = XSLParameterGenerator generator
(XSLParameterGenerator) s_XSLParameters.get(name); = (XSLParameterGenerator) s_XSLParameters
.get(name);
if (generator != null) { if (generator != null) {
return generator.generateValue(request); return generator.generateValue(request);
} else { } else {
@ -552,8 +612,9 @@ public class PageTransformer implements PresentationManager {
} }
/** /**
* This takes in a transformer and adds all of the registered * This takes in a transformer and adds all of the registered xsl
* xsl paraemters. * paraemters.
*
* @param transformer * @param transformer
* @param request * @param request
*/ */