why do you need to put JS in the HEAD?
as far as I know, it does not matter where do you put JS, it executed anyway (or in case of function declaration -- it still visible).
just put JS in the beginning of form file.
We expected to heavily rework form mechanism in near future. We plan to use some form of templating engine as form dynamic content provider (freemaker, velocity).
Could you give more insight information what you trying to achieve, so we can caution you against incompatibilities with future version of WFE.
-Maxim
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I try to implement a rich text editor like this one (http://tinymce.moxiecode.com/) to use with my text area
But I have to deploy it in the wwwroot but I dont understand really well where it is in jboss (don't know very well jboss) and I don't know if it will work if I put the javascript in the form instead of the head
Regards,
Bubble
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I want to implement a rich text editor in runa but I need to put some javascript into the HEAD of the generated page
Is it possible to add it by myself?
Regards,
Bubble
Hello!
why do you need to put JS in the HEAD?
as far as I know, it does not matter where do you put JS, it executed anyway (or in case of function declaration -- it still visible).
just put JS in the beginning of form file.
We expected to heavily rework form mechanism in near future. We plan to use some form of templating engine as form dynamic content provider (freemaker, velocity).
Could you give more insight information what you trying to achieve, so we can caution you against incompatibilities with future version of WFE.
-Maxim
Hi,
I try to implement a rich text editor like this one (http://tinymce.moxiecode.com/) to use with my text area
But I have to deploy it in the wwwroot but I dont understand really well where it is in jboss (don't know very well jboss) and I don't know if it will work if I put the javascript in the form instead of the head
Regards,
Bubble
Bubble,
You can implement rich text editor with vartag that generates JS for fckeditor.
I recomend you to take a look at
http://sourceforge.net/projects/fckeditor/
Regards,
Vitaliy S
Hi Vitaliy
Now that I have finished my substitution and my periodic mail, I come back to this rich text editor.
I don't really understand how to generate JS from a varTag, could you give me some advise?
Regards,
Bubble
Hi Bubble,
Var tag is java class that generates HTML/TEXT/What ever output
you just have to write one that generates what you want.
Regards,
Vitaliy
Hi,
I'm still trying to implement a rich text editor in runa using fckeditor and AbstractDateTimeInputVarTag as reference.
But I'm not familiar with generating javascript from java and I got a class cast exception
here is my code:
package alfea;
import javax.security.auth.Subject;
import javax.servlet.jsp.PageContext;
import org.apache.ecs.html.Script;
import org.apache.ecs.html.TextArea;
import ru.runa.common.web.Commons;
import ru.runa.wf.web.html.WorkflowFormProcessingException;
public class RichTextEditorVarTag {
private static final String FCKEDITOR_JS = "/FCKeditor/fckeditor.js";
private static final String FCKCONFIG_JS = "/FCKeditor/fckconfig.js";
public String getHtml(Subject subject, String varName, Object varValue, PageContext pageContext) throws WorkflowFormProcessingException {
try {
StringBuffer sb = new StringBuffer();
Script richTextEditorJsScript = new Script();
richTextEditorJsScript.setSrc(Commons.getUrl(FCKEDITOR_JS, pageContext));
sb.append(richTextEditorJsScript.toString());
TextArea textarea = new TextArea(varName,"15","80");
//String inputId = varName + String.valueOf(System.currentTimeMillis() * Math.random());
Script richTextEditorConfigJsScript = new Script();
richTextEditorConfigJsScript.setSrc(Commons.getUrl(FCKCONFIG_JS, pageContext));
sb.append(richTextEditorConfigJsScript.toString());
sb.append(textarea.toString());
return sb.toString();
}finally
{}
}
}
Regards,
Bubble
Hi Bubble,
What line causes ClassCastException?
Regards,
Vitaliy S
I don't really know the error I got is this:
ERROR [WFFormTag] java.lang.ClassCastException: alfea.RichTextEditorVarTag
nothing more
Regards,
Bubble
my bad , I think I drink to much yesterday...
I just forgot to implements VarTag in the class
Bubble
Hi,
I hope you'll share it with us when you get it work ;-)
Regards,
Vitaliy S
Hi vitaly,
it works :D
here the code :
package alfea;
import javax.security.auth.Subject;
import javax.servlet.jsp.PageContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ecs.html.Script;
import ru.runa.af.AuthenticationException;
import ru.runa.common.web.Commons;
import ru.runa.wf.web.html.VarTag;
import ru.runa.wf.web.html.WorkflowFormProcessingException;
public class RichTextEditorVarTag implements VarTag{
protected static final Log log = LogFactory .getLog(TimeoutSubstitutionCriteria.class);
private static final String FCKEDITOR_JS = "/FCKeditor/fckeditor.js";
private static final String FCKCONFIG_JS = "/FCKeditor/fckconfig.js";
public String getHtml(Subject subject, String varName, Object varValue, PageContext pageContext) throws WorkflowFormProcessingException , AuthenticationException {
try {
StringBuffer sb = new StringBuffer();
Script richTextEditorJsScript = new Script();
richTextEditorJsScript.setSrc(Commons.getUrl(FCKEDITOR_JS, pageContext));
sb.append(richTextEditorJsScript.toString());
Script richTextEditorConfigJsScript = new Script();
richTextEditorConfigJsScript.setSrc(Commons.getUrl(FCKCONFIG_JS, pageContext));
sb.append(richTextEditorConfigJsScript.toString());
sb.append("<script type=\"text/javascript\"> var oFCKeditor = new FCKeditor('"+varName+"'); oFCKeditor.BasePath = \"/wfe/FCKeditor/\"; oFCKeditor.Create(); </script>");
System.out.println("tapette: "+sb.toString());
return sb.toString();
}catch(ClassCastException e){
log.error(e);
}
finally
{}
return "";
}
}
and just had the fckeditor source folder in the wfe.war
Regards,
Bubble
Thank you,
If you share this code with RUNA WFE project we can include it in next releases.
Regards,
Vitaliy S
no problem for me you can include it in the next releases
But some options doesn't work properly in the fck editor
So check which ones doesn't work and customise the tool bar.
I have also add few things in the configuration string to fix the editor to a static size
Regards,
Bubble
Hi,
We are not in a hurry.
It would be very kind of you if you finish with customizing and share your results with community ;-)
Regards,
Vitaliy S