Author: alevkovsky
Date: 2008-11-04 12:25:58 -0500 (Tue, 04 Nov 2008)
New Revision: 11024
Added:
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/1$1.js
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/1$1.xcss
Modified:
trunk/sandbox/ui/editor/src/main/config/resources/resources-config.xml
trunk/sandbox/ui/editor/src/main/java/org/richfaces/renderkit/EditorRendererBase.java
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/editor.js
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/tiny_mce_src.js
trunk/sandbox/ui/editor/src/main/templates/editor.jspx
Log:
Change mechanism of getting resources suffix
Modified: trunk/sandbox/ui/editor/src/main/config/resources/resources-config.xml
===================================================================
--- trunk/sandbox/ui/editor/src/main/config/resources/resources-config.xml 2008-11-04
16:46:21 UTC (rev 11023)
+++ trunk/sandbox/ui/editor/src/main/config/resources/resources-config.xml 2008-11-04
17:25:58 UTC (rev 11024)
@@ -5050,4 +5050,17 @@
<path>org/richfaces/renderkit/html/scripts/tiny_mce/utils/validate.js</path>
<renderer class="org.ajax4jsf.resource.ScriptRenderer"/>
</resource>
+ <resource>
+ <name>scripts/tiny_mce/utils/validate.js</name>
+
<path>org/richfaces/renderkit/html/scripts/tiny_mce/utils/validate.js</path>
+ <renderer class="org.ajax4jsf.resource.ScriptRenderer"/>
+ </resource>
+ <resource>
+ <name>1$1.js</name>
+ <path>org/richfaces/renderkit/html/1$1.js</path>
+ </resource>
+ <resource>
+ <name>1$1.xcss</name>
+ <path>org/richfaces/renderkit/html/1$1.xcss</path>
+ </resource>
</resource-config>
Modified:
trunk/sandbox/ui/editor/src/main/java/org/richfaces/renderkit/EditorRendererBase.java
===================================================================
---
trunk/sandbox/ui/editor/src/main/java/org/richfaces/renderkit/EditorRendererBase.java 2008-11-04
16:46:21 UTC (rev 11023)
+++
trunk/sandbox/ui/editor/src/main/java/org/richfaces/renderkit/EditorRendererBase.java 2008-11-04
17:25:58 UTC (rev 11024)
@@ -37,8 +37,8 @@
import javax.faces.convert.ConverterException;
import org.ajax4jsf.javascript.ScriptUtils;
+import org.ajax4jsf.resource.InternetResource;
import org.ajax4jsf.util.InputUtils;
-import org.ajax4jsf.webapp.WebXml;
import org.richfaces.component.UIEditor;
/**
@@ -47,6 +47,9 @@
*/
public class EditorRendererBase extends InputRendererBase {
+ private final static String SPECIFIC_SCRIPT_RESOURCE_NAME = "1$1.js";
+ private final static String SPECIFIC_XCSS_RESOURCE_NAME = "1$1.xcss";
+
@Override
protected Class<? extends UIComponent> getComponentClass() {
return UIEditor.class;
@@ -109,25 +112,22 @@
return fieldValue;
}
- protected String getFacesMappingSuffix(FacesContext context) {
- WebXml webXml = WebXml.getInstance(context);
- String suffix = webXml.getFacesServletSuffix();
- String prefix = webXml.getFacesServletPrefix();
- String filterPrefix = webXml.getFacesFilterPrefix();
- String filterSuffix = webXml.getFacesFilterSuffix();
- if (filterPrefix != null) {
- return "";
+ protected String getSriptMappingSuffix(FacesContext context) {
+ return getResourceSuffix(context, SPECIFIC_SCRIPT_RESOURCE_NAME);
+ }
+
+ protected String getCssMappingSuffix(FacesContext context) {
+ return getResourceSuffix(context, SPECIFIC_XCSS_RESOURCE_NAME);
+ }
+
+ private String getResourceSuffix(FacesContext context, String resourceName){
+ InternetResource resource = getResource(resourceName);
+ String resourceUri = resource.getUri(context, null);
+ String suffix = resourceUri.substring(resourceUri.indexOf(resourceName) +
resourceName.length());
+ if(suffix == null){
+ suffix = "";
}
- if (filterSuffix != null) {
- return filterSuffix;
- }
- if (prefix != null) {
- return "";
- }
- if (suffix != null) {
- return suffix;
- }
- return "";
+ return suffix;
}
public void writeEditorConfigurationParameters(FacesContext context,
Added: trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/1$1.js
===================================================================
Property changes on:
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/1$1.js
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/1$1.xcss
===================================================================
--- trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/1$1.xcss
(rev 0)
+++
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/1$1.xcss 2008-11-04
17:25:58 UTC (rev 11024)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:template
+
xmlns:f="http://jsf.exadel.com/template"
+
xmlns:u="http://jsf.exadel.com/template/util"
+
xmlns="http://www.w3.org/1999/xhtml">
+
+</f:template>
Modified:
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/editor.js
===================================================================
---
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/editor.js 2008-11-04
16:46:21 UTC (rev 11023)
+++
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/editor.js 2008-11-04
17:25:58 UTC (rev 11024)
@@ -15,7 +15,8 @@
obj.richfacesComponent="richfaces:editor";
this["rich:destructor"] = "destruct";
- Richfaces.Editor.extSuffix = params.extSuffix;
+ Richfaces.Editor.extScriptSuffix = params.extScriptSuffix;
+ Richfaces.Editor.extCssSuffix = params.extCssSuffix;
this.tinyMCE_editor = null;
this.onInitInstanceCallbackFunction = tinyparams.onInitInstanceCallback;
Modified:
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/tiny_mce_src.js
===================================================================
---
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/tiny_mce_src.js 2008-11-04
16:46:21 UTC (rev 11023)
+++
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/tiny_mce_src.js 2008-11-04
17:25:58 UTC (rev 11024)
@@ -409,8 +409,9 @@
var v;
// RF: added by PY
- u = u.replace(Richfaces.Editor.REGEXP_CSS, function($1,$2,$3){return
$2+($3=='c' ? "xcss":"XCSS");});
- if (Richfaces && Richfaces.Editor) u += Richfaces.Editor.extSuffix;
+ var isCSS = false;
+ u = u.replace(Richfaces.Editor.REGEXP_CSS, function($1,$2,$3){isCSS=true; return
$2+($3=='c' ? "xcss":"XCSS");});
+ if (Richfaces && Richfaces.Editor) u += (isCSS ? Richfaces.Editor.extCssSuffix
: Richfaces.Editor.extScriptSuffix);
// RF: end
if (!this.query)
Modified: trunk/sandbox/ui/editor/src/main/templates/editor.jspx
===================================================================
--- trunk/sandbox/ui/editor/src/main/templates/editor.jspx 2008-11-04 16:46:21 UTC (rev
11023)
+++ trunk/sandbox/ui/editor/src/main/templates/editor.jspx 2008-11-04 17:25:58 UTC (rev
11024)
@@ -36,8 +36,11 @@
tinyMceParams.onchange_callback =
'#{component.attributes["onchange"]}';
tinyMceParams.save_callback =
'#{component.attributes["onsave"]}';
tinyMceParams.setup = '#{component.attributes["onsetup"]}';
-
- new RichEditor('#{clientId}',
{extSuffix:'#{this:getFacesMappingSuffix(context)}'}, tinyMceParams);
+
+ var richParams =
{extScriptSuffix:'#{this:getSriptMappingSuffix(context)}',
+ extCssSuffix:'#{this:getCssMappingSuffix(context)}'}
+
+ new RichEditor('#{clientId}', richParams, tinyMceParams);
</script>
</div>
</f:root>