public void editFile(ActionEvent event)
{
UIActionLink link = (UIActionLink)event.getComponent();
Map params = link.getParameterMap();
String id = (String)params.get("id");
if(id != null && id.length() != 0)
{
boolean editingInline = false;
Node node = setupContentDocument(id);
if(node.hasAspect(ApplicationModel.ASPECT_INLINEEDITABLE) && node.getProperties().get(ApplicationModel.PROP_EDITINLINE) != null && ((Boolean)node.getProperties().get(ApplicationModel.PROP_EDITINLINE)).booleanValue())
{
ContentReader reader = getContentService().getReader(node.getNodeRef(), ContentModel.PROP_CONTENT);
if(reader != null)
{
editingInline = true;
String mimetype = reader.getMimetype();
if("text/plain".equals(mimetype) || "text/xml".equals(mimetype) || "text/css".equals(mimetype) || "application/x-javascript".equals(mimetype))
{
setEditorOutput(reader.getContentString());
FacesContext fc = FacesContext.getCurrentInstance();
navigator.setupDispatchContext(node);
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dialog:editTextInline");
} else
{
setDocumentContent(reader.getContentString());
setEditorOutput(null);
FacesContext fc = FacesContext.getCurrentInstance();
navigator.setupDispatchContext(node);
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dialog:editHtmlInline");
}
}
}
if(!editingInline)
{
FacesContext fc = FacesContext.getCurrentInstance();
navigator.setupDispatchContext(node);
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dialog:editFile");
}
}
}I'd like to think out loud here in the forums about the checkin-checkout bean. This is the edit content function in the CheckinCheckoutBean of the Webclient. It has served many of us well and for that I am thankful, but it doesn't really provide a mechanism for plugging in new editors. I think it's really important that we address the extensibility issue here because these editors are first very basic and second I think developing new in line editors is something the community could really help out with.The hard coding is the obvious issue and I think that is easily resolved. The harder questions are things like: Is mimetype the only selector? I content no. So we'll want to find a general way to solve that issue as well.Please contribute your thoughts.-R