Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

RF-11350: added support for Editor skinning (skin properties and Reso…

…urceServlet servers ECSS and its referenced images right)
  • Loading branch information...
commit 9196930ff547d4f66aa12d86e40199579cb621b2 1 parent 2bd64aa
@lfryc lfryc authored
View
38 impl/src/main/java/org/richfaces/webapp/ResourceServlet.java
@@ -39,6 +39,7 @@
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
+import org.richfaces.resource.ResourceHandlerImpl;
/**
* <p>
@@ -60,7 +61,7 @@
private static final String JAVAX_FACES_RESOURCE_IDENTIFIER = "/javax.faces.resource/";
- private static final Library[] LIBRARIES_TO_SERVE = new Library[] { new CKEditorLibrary() };
+ private static final Library[] LIBRARIES_TO_SERVE = new Library[] { new CKEditorLibrary(), new RichFacesImageLibrary() };
private ServletConfig servletConfig;
private FacesServlet facesServlet;
@@ -129,6 +130,8 @@ private static String getResourcePathFromRequest(HttpServletRequest request) {
if (resourceName != null) {
if (resourceName.startsWith(JAVAX_FACES_RESOURCE_IDENTIFIER)) {
return resourceName.substring(JAVAX_FACES_RESOURCE_IDENTIFIER.length());
+ } else if (resourceName.startsWith(ResourceHandlerImpl.RICHFACES_RESOURCE_IDENTIFIER)) {
+ return resourceName;
} else {
return null;
}
@@ -188,7 +191,8 @@ private static String getMappingForRequest(HttpServletRequest request) {
}
private static class CKEditorLibrary implements Library {
- private Set<String> ALLOWED_PARAMETERS = Collections.unmodifiableSortedSet(new TreeSet<String>(Arrays.asList("t")));
+ private Set<String> ALLOWED_PARAMETERS = Collections
+ .unmodifiableSortedSet(new TreeSet<String>(Arrays.asList("t", "db")));
public boolean allowServerRequest(String resourcePath, HttpServletRequest request) {
if (resourcePath.startsWith("org.richfaces.ckeditor/")) {
@@ -204,4 +208,34 @@ public boolean allowServerRequest(String resourcePath, HttpServletRequest reques
return false;
}
}
+
+ private static class RichFacesImageLibrary implements Library {
+ private Set<String> ALLOWED_PARAMETERS = Collections.unmodifiableSortedSet(new TreeSet<String>(Arrays
+ .asList("ln", "db")));
+
+ public boolean allowServerRequest(String resourcePath, HttpServletRequest request) {
+ if (resourcePath.startsWith(ResourceHandlerImpl.RICHFACES_RESOURCE_IDENTIFIER)) {
+ resourcePath = resourcePath.substring(ResourceHandlerImpl.RICHFACES_RESOURCE_IDENTIFIER.length());
+ if (resourcePath.contains("/")) {
+ return false;
+ }
+ if (!resourcePath.endsWith(".png")) {
+ return false;
+ }
+ if (!"org.richfaces.images".equals(request.getParameter("ln"))) {
+ return false;
+ }
+
+ Enumeration<String> parameters = request.getParameterNames();
+ while (parameters.hasMoreElements()) {
+ String parameter = parameters.nextElement();
+ if (!ALLOWED_PARAMETERS.contains(parameter)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+ }
}
View
4 impl/src/main/resources/META-INF/skins/DEFAULT.skin.properties
@@ -85,3 +85,7 @@ editBackgroundColor=#FEFFDA
#Gradients
gradientType=plain
+
+# Editor
+editorMainTextColor=#000000
+editorMainBackgroundColor=#D4CFC7
View
8 impl/src/main/resources/META-INF/skins/NULL.skin.properties
@@ -25,8 +25,8 @@ tabDisabledTextColor=#B1ADA7
trimColor=#DFDCD5
-tipBackgroundColor=\#FAE6B0
-tipBorderColor=\#E5973E
+tipBackgroundColor=#FAE6B0
+tipBorderColor=#E5973E
selectControlColor=#E79A00
@@ -79,3 +79,7 @@ editBackgroundColor=#FEFFDA
#Gradients
gradientType=plain
+
+# Editor
+editorMainTextColor=#000000
+editorMainBackgroundColor=#EDEAE6
View
4 impl/src/main/resources/META-INF/skins/blueSky.skin.properties
@@ -77,3 +77,7 @@ editBackgroundColor=#FEFFDA
#Gradients
gradientType=plain
+
+# Editor
+editorMainTextColor=#0B356C
+editorMainBackgroundColor=#D6E6FB
View
4 impl/src/main/resources/META-INF/skins/classic.skin.properties
@@ -77,3 +77,7 @@ editBackgroundColor=#FEFFDA
#Gradients
gradientType=plain
+
+# Editor
+editorMainTextColor=#FFFFFF
+editorMainBackgroundColor=#7596C6
View
4 impl/src/main/resources/META-INF/skins/deepMarine.skin.properties
@@ -81,3 +81,7 @@ editBackgroundColor=#FEFFDA
#Gradients
gradientType=plain
+
+# Editor
+editorMainTextColor=#005E67
+editorMainBackgroundColor=#82C9CF
View
4 impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties
@@ -78,3 +78,7 @@ editBackgroundColor=#FEFFDA
#Gradients
gradientType=plain
+
+# Editor
+editorMainTextColor=#005000
+editorMainBackgroundColor=#70BA70
View
4 impl/src/main/resources/META-INF/skins/japanCherry.skin.properties
@@ -80,3 +80,7 @@ editBackgroundColor=#FEFFDA
#Gradients
gradientType=plain
+# Editor
+editorMainTextColor=#980808
+editorMainBackgroundColor=#FBD9D9
+
View
4 impl/src/main/resources/META-INF/skins/plain.skin.properties
@@ -74,3 +74,7 @@ errorColor=#{null}
editorBackgroundColor=#{null}
editBackgroundColor=#{null}
gradientType=plain
+
+# Editor
+editorMainTextColor=#{null}
+editorMainBackgroundColor=#{null}
View
4 impl/src/main/resources/META-INF/skins/ruby.skin.properties
@@ -76,3 +76,7 @@ editBackgroundColor=#FEFFDA
#Gradients
gradientType=plain
+
+# Editor
+editorMainTextColor=#980808
+editorMainBackgroundColor=#EB9A99
View
4 impl/src/main/resources/META-INF/skins/wine.skin.properties
@@ -78,3 +78,7 @@ editBackgroundColor=#FEFFDA
#Gradients
gradientType=plain
+
+# Editor
+editorMainTextColor=#495A34
+editorMainBackgroundColor=#BCD0A5
Please sign in to comment.
Something went wrong with that request. Please try again.