mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.1 to HEAD
6580: AVM bulk import performance tweaks. 6582: WCM-767, WCM-768 6583: Fix for AWC-1528 (potential NPE in ErrorsRenderer) 6584: Fix for AWC-1256 (Links produced by inline HTML editor are incorrect) 6585: AR-1635: event listeners added in a beforeCommit event are now executed successfully 6586: AR-1561 Update Web Scripts readme.html to be consistent with "Category Search Sample" (or vice-versa) 6587: Fix for AWC-1390 (Paste all doesn't work for forum items) 6588: AR-1701 Script getDocument call doesn't check for non-existent content 6589: Fix for AWC-1530 - Saved search does not work for custom properties of type d:text with list constraint 6591: Improvement for submit speed. 6592: Removed obsolete tests. 6594: Index tracking sample to include AVM index tracking 6595: Added the AVM helpers methods from the FreeMarker AVM API that were missing from the JavaScript API 6597: Rationalize post commit execution hooks for deployment receiver 6598: Properly escape path names for ProgramRunnable. 6599: AVM store name lookup cache is (theoretically) clusterable. 6600: Some or other gramatically incorrect stuff about Chiba. 6601: Fix for AR-1121 and AR-1673 6602: AR-1655: Versioning is not MLText aware 6603: Updated messages from lang packs 6604: Fixed AR-1476: JCR import end element escaping 6605: Updated Japanese lang messages git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6746 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -332,7 +332,6 @@
|
|||||||
<action idref="delete_topic" />
|
<action idref="delete_topic" />
|
||||||
<action idref="cut_node" />
|
<action idref="cut_node" />
|
||||||
<action idref="copy_node" />
|
<action idref="copy_node" />
|
||||||
<action idref="paste_all" />
|
|
||||||
<action idref="manage_space_users" />
|
<action idref="manage_space_users" />
|
||||||
</action-group>
|
</action-group>
|
||||||
|
|
||||||
|
@@ -60,6 +60,8 @@ public class WorkspaceClipboardItem extends AbstractClipboardItem
|
|||||||
{
|
{
|
||||||
private static final String WORKSPACE_PASTE_VIEW_ID = "/jsp/browse/browse.jsp";
|
private static final String WORKSPACE_PASTE_VIEW_ID = "/jsp/browse/browse.jsp";
|
||||||
private static final String AVM_PASTE_VIEW_ID = "/jsp/wcm/browse-sandbox.jsp";
|
private static final String AVM_PASTE_VIEW_ID = "/jsp/wcm/browse-sandbox.jsp";
|
||||||
|
private static final String FORUMS_PASTE_VIEW_ID = "/jsp/forums/forums.jsp";
|
||||||
|
private static final String FORUM_PASTE_VIEW_ID = "/jsp/forums/forum.jsp";
|
||||||
|
|
||||||
private static final String MSG_LINK_TO = "link_to";
|
private static final String MSG_LINK_TO = "link_to";
|
||||||
|
|
||||||
@@ -89,7 +91,8 @@ public class WorkspaceClipboardItem extends AbstractClipboardItem
|
|||||||
*/
|
*/
|
||||||
public boolean canCopyToViewId(String viewId)
|
public boolean canCopyToViewId(String viewId)
|
||||||
{
|
{
|
||||||
return (WORKSPACE_PASTE_VIEW_ID.equals(viewId) || AVM_PASTE_VIEW_ID.equals(viewId));
|
return (WORKSPACE_PASTE_VIEW_ID.equals(viewId) || AVM_PASTE_VIEW_ID.equals(viewId) ||
|
||||||
|
FORUMS_PASTE_VIEW_ID.equals(viewId) || FORUM_PASTE_VIEW_ID.equals(viewId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -97,7 +100,8 @@ public class WorkspaceClipboardItem extends AbstractClipboardItem
|
|||||||
*/
|
*/
|
||||||
public boolean canMoveToViewId(String viewId)
|
public boolean canMoveToViewId(String viewId)
|
||||||
{
|
{
|
||||||
return (WORKSPACE_PASTE_VIEW_ID.equals(viewId));
|
return (WORKSPACE_PASTE_VIEW_ID.equals(viewId) || FORUMS_PASTE_VIEW_ID.equals(viewId) ||
|
||||||
|
FORUM_PASTE_VIEW_ID.equals(viewId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -106,7 +110,8 @@ public class WorkspaceClipboardItem extends AbstractClipboardItem
|
|||||||
public boolean paste(FacesContext fc, String viewId, int action)
|
public boolean paste(FacesContext fc, String viewId, int action)
|
||||||
throws Throwable
|
throws Throwable
|
||||||
{
|
{
|
||||||
if (WORKSPACE_PASTE_VIEW_ID.equals(viewId))
|
if (WORKSPACE_PASTE_VIEW_ID.equals(viewId) || FORUMS_PASTE_VIEW_ID.equals(viewId) ||
|
||||||
|
FORUM_PASTE_VIEW_ID.equals(viewId))
|
||||||
{
|
{
|
||||||
NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
||||||
NodeRef destRef = new NodeRef(Repository.getStoreRef(), navigator.getCurrentNodeId());
|
NodeRef destRef = new NodeRef(Repository.getStoreRef(), navigator.getCurrentNodeId());
|
||||||
|
@@ -1012,10 +1012,36 @@ public final class AVMUtil
|
|||||||
path = path.substring(0, webappIndex);
|
path = path.substring(0, webappIndex);
|
||||||
}
|
}
|
||||||
final VirtServerRegistry vServerRegistry = AVMUtil.getVirtServerRegistry();
|
final VirtServerRegistry vServerRegistry = AVMUtil.getVirtServerRegistry();
|
||||||
vServerRegistry.updateAllWebapps(-1, path, true);
|
vServerRegistry.updateWebapp(-1, path, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removal notification on all the virtualisation server webapp as required by the specified path
|
||||||
|
*
|
||||||
|
* @param path Path to match against
|
||||||
|
* @param force True to force update of server even if path does not match
|
||||||
|
*/
|
||||||
|
public static void removeAllVServerWebapps(String path, boolean force)
|
||||||
|
{
|
||||||
|
if (force || VirtServerUtils.requiresUpdateNotification(path))
|
||||||
|
{
|
||||||
|
final int webappIndex = path.indexOf('/',
|
||||||
|
path.indexOf(JNDIConstants.DIR_DEFAULT_APPBASE) +
|
||||||
|
JNDIConstants.DIR_DEFAULT_APPBASE.length() + 1);
|
||||||
|
|
||||||
|
if (webappIndex != -1)
|
||||||
|
{
|
||||||
|
path = path.substring(0, webappIndex);
|
||||||
|
}
|
||||||
|
final VirtServerRegistry vServerRegistry = AVMUtil.getVirtServerRegistry();
|
||||||
|
vServerRegistry.removeAllWebapps(-1, path, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removal notification on the virtualisation server webapp as required for the specified path
|
* Removal notification on the virtualisation server webapp as required for the specified path
|
||||||
*
|
*
|
||||||
@@ -1035,7 +1061,7 @@ public final class AVMUtil
|
|||||||
path = path.substring(0, webappIndex);
|
path = path.substring(0, webappIndex);
|
||||||
}
|
}
|
||||||
final VirtServerRegistry vServerRegistry = AVMUtil.getVirtServerRegistry();
|
final VirtServerRegistry vServerRegistry = AVMUtil.getVirtServerRegistry();
|
||||||
vServerRegistry.removeAllWebapps(-1, path, true);
|
vServerRegistry.removeWebapp(-1, path, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,6 +43,8 @@ public class CreateWebappDialog extends CreateFolderDialog
|
|||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Dialog implementation
|
// Dialog implementation
|
||||||
|
|
||||||
|
protected String path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String)
|
* @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String)
|
||||||
*/
|
*/
|
||||||
@@ -53,9 +55,9 @@ public class CreateWebappDialog extends CreateFolderDialog
|
|||||||
final String parent = AVMUtil.buildSandboxRootPath( stagingStore );
|
final String parent = AVMUtil.buildSandboxRootPath( stagingStore );
|
||||||
this.avmService.createDirectory(parent, this.name);
|
this.avmService.createDirectory(parent, this.name);
|
||||||
|
|
||||||
final String path = AVMNodeConverter.ExtendAVMPath(parent, this.name);
|
this.path = AVMNodeConverter.ExtendAVMPath(parent, this.name);
|
||||||
this.avmService.addAspect(path, ApplicationModel.ASPECT_UIFACETS);
|
this.avmService.addAspect(this.path, ApplicationModel.ASPECT_UIFACETS);
|
||||||
this.avmService.addAspect(path, WCMAppModel.ASPECT_WEBAPP);
|
this.avmService.addAspect(this.path, WCMAppModel.ASPECT_WEBAPP);
|
||||||
if (this.description != null && this.description.length() != 0)
|
if (this.description != null && this.description.length() != 0)
|
||||||
{
|
{
|
||||||
this.avmService.setNodeProperty(path,
|
this.avmService.setNodeProperty(path,
|
||||||
@@ -65,8 +67,18 @@ public class CreateWebappDialog extends CreateFolderDialog
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Snapshot the store with the empty webapp
|
// Snapshot the store with the empty webapp
|
||||||
this.avmService.createSnapshot( stagingStore, null, null);
|
this.avmService.createSnapshot(stagingStore, null, null);
|
||||||
|
|
||||||
|
return outcome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String doPostCommitProcessing(FacesContext context, String outcome)
|
||||||
|
{
|
||||||
|
// Tell the virtualization server about the new webapp.
|
||||||
|
// e.g.: this.path = "mysite:/www/avm_webapps/mywebapp"
|
||||||
|
AVMUtil.updateVServerWebapp(this.path, true);
|
||||||
|
|
||||||
return outcome;
|
return outcome;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -130,7 +130,7 @@ public class DeleteSandboxDialog extends BaseDialogBean
|
|||||||
// dependent order, so clients don't have to worry about
|
// dependent order, so clients don't have to worry about
|
||||||
// accessing a preview layer whose main layer has been torn
|
// accessing a preview layer whose main layer has been torn
|
||||||
// out from under it.
|
// out from under it.
|
||||||
AVMUtil.removeVServerWebapp(path, true);
|
AVMUtil.removeAllVServerWebapps(path, true);
|
||||||
|
|
||||||
// TODO: Use the .sandbox-id. property to delete all sandboxes,
|
// TODO: Use the .sandbox-id. property to delete all sandboxes,
|
||||||
// rather than assume a sandbox always had a single preview
|
// rather than assume a sandbox always had a single preview
|
||||||
|
@@ -97,7 +97,7 @@ public class DeleteWebsiteDialog extends DeleteSpaceDialog
|
|||||||
|
|
||||||
String sandbox = AVMUtil.buildStagingStoreName(storeRoot);
|
String sandbox = AVMUtil.buildStagingStoreName(storeRoot);
|
||||||
String path = AVMUtil.buildStoreWebappPath(sandbox, "/ROOT");
|
String path = AVMUtil.buildStoreWebappPath(sandbox, "/ROOT");
|
||||||
AVMUtil.removeVServerWebapp(path, true);
|
AVMUtil.removeAllVServerWebapps(path, true);
|
||||||
|
|
||||||
// get the list of users who have a sandbox in the website
|
// get the list of users who have a sandbox in the website
|
||||||
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(
|
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(
|
||||||
|
@@ -30,6 +30,10 @@ import java.io.FileInputStream;
|
|||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
import javax.faces.event.ActionEvent;
|
import javax.faces.event.ActionEvent;
|
||||||
@@ -50,6 +54,7 @@ import org.alfresco.service.cmr.repository.ContentService;
|
|||||||
import org.alfresco.service.cmr.repository.MimetypeService;
|
import org.alfresco.service.cmr.repository.MimetypeService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.TempFileProvider;
|
import org.alfresco.util.TempFileProvider;
|
||||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||||
import org.alfresco.web.app.Application;
|
import org.alfresco.web.app.Application;
|
||||||
@@ -334,8 +339,14 @@ public class ImportWebsiteDialog
|
|||||||
// Create a file in the AVM store
|
// Create a file in the AVM store
|
||||||
String avmPath = AVMNodeConverter.ToAVMVersionPath(root).getSecond();
|
String avmPath = AVMNodeConverter.ToAVMVersionPath(root).getSecond();
|
||||||
String fileName = file.getName();
|
String fileName = file.getName();
|
||||||
|
List<QName> aspects = new ArrayList<QName>();
|
||||||
|
aspects.add(ContentModel.ASPECT_TITLED);
|
||||||
|
Map<QName, PropertyValue> properties = new HashMap<QName, PropertyValue>();
|
||||||
|
properties.put(ContentModel.PROP_TITLE,
|
||||||
|
new PropertyValue(DataTypeDefinition.TEXT, fileName));
|
||||||
this.avmService.createFile(
|
this.avmService.createFile(
|
||||||
avmPath, fileName,new BufferedInputStream(new FileInputStream(file), BUFFER_SIZE));
|
avmPath, fileName,new BufferedInputStream(new FileInputStream(file), BUFFER_SIZE),
|
||||||
|
aspects, properties);
|
||||||
|
|
||||||
// TODO: restore this code once performance is acceptable
|
// TODO: restore this code once performance is acceptable
|
||||||
// NodeRef fileRef = AVMNodeConverter.ToNodeRef(-1, filePath);
|
// NodeRef fileRef = AVMNodeConverter.ToNodeRef(-1, filePath);
|
||||||
@@ -346,10 +357,10 @@ public class ImportWebsiteDialog
|
|||||||
// this.nodeService.addAspect(fileRef, ContentModel.ASPECT_TITLED, titledProps);
|
// this.nodeService.addAspect(fileRef, ContentModel.ASPECT_TITLED, titledProps);
|
||||||
|
|
||||||
// for now use the avm service directly
|
// for now use the avm service directly
|
||||||
String filePath = avmPath + '/' + fileName;
|
// String filePath = avmPath + '/' + fileName;
|
||||||
this.avmService.addAspect(filePath, ContentModel.ASPECT_TITLED);
|
// this.avmService.addAspect(filePath, ContentModel.ASPECT_TITLED);
|
||||||
this.avmService.setNodeProperty(filePath, ContentModel.PROP_TITLE,
|
// this.avmService.setNodeProperty(filePath, ContentModel.PROP_TITLE,
|
||||||
new PropertyValue(DataTypeDefinition.TEXT, fileName));
|
// new PropertyValue(DataTypeDefinition.TEXT, fileName));
|
||||||
|
|
||||||
// create content node based on the filename
|
// create content node based on the filename
|
||||||
/*FileInfo contentFile = fileFolderService.create(root, fileName, ContentModel.TYPE_AVM_PLAIN_CONTENT);
|
/*FileInfo contentFile = fileFolderService.create(root, fileName, ContentModel.TYPE_AVM_PLAIN_CONTENT);
|
||||||
@@ -369,7 +380,9 @@ public class ImportWebsiteDialog
|
|||||||
|
|
||||||
// Create a directory in the AVM store
|
// Create a directory in the AVM store
|
||||||
String avmPath = AVMNodeConverter.ToAVMVersionPath(root).getSecond();
|
String avmPath = AVMNodeConverter.ToAVMVersionPath(root).getSecond();
|
||||||
this.avmService.createDirectory(avmPath, file.getName());
|
List<QName> aspects = new ArrayList<QName>();
|
||||||
|
aspects.add(ApplicationModel.ASPECT_UIFACETS);
|
||||||
|
this.avmService.createDirectory(avmPath, file.getName(), aspects, null);
|
||||||
|
|
||||||
String folderPath = avmPath + '/' + file.getName();
|
String folderPath = avmPath + '/' + file.getName();
|
||||||
NodeRef folderRef = AVMNodeConverter.ToNodeRef(-1, folderPath);
|
NodeRef folderRef = AVMNodeConverter.ToNodeRef(-1, folderPath);
|
||||||
@@ -379,9 +392,6 @@ public class ImportWebsiteDialog
|
|||||||
// see AVMBrowseBean.setAVMNodeDescriptor
|
// see AVMBrowseBean.setAVMNodeDescriptor
|
||||||
// add the uifacets aspect for the read/edit properties screens
|
// add the uifacets aspect for the read/edit properties screens
|
||||||
// this.nodeService.addAspect(folderRef, ContentModel.ASPECT_UIFACETS, null);
|
// this.nodeService.addAspect(folderRef, ContentModel.ASPECT_UIFACETS, null);
|
||||||
|
|
||||||
// for now use the AVM service directly
|
|
||||||
this.avmService.addAspect(folderPath, ApplicationModel.ASPECT_UIFACETS);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException e)
|
catch (FileNotFoundException e)
|
||||||
|
@@ -34,6 +34,7 @@ import org.alfresco.service.namespace.NamespaceService;
|
|||||||
import org.alfresco.web.forms.XMLUtil;
|
import org.alfresco.web.forms.XMLUtil;
|
||||||
import org.apache.commons.jxpath.JXPathContext;
|
import org.apache.commons.jxpath.JXPathContext;
|
||||||
import org.apache.commons.jxpath.Pointer;
|
import org.apache.commons.jxpath.Pointer;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.xerces.xs.*;
|
import org.apache.xerces.xs.*;
|
||||||
@@ -2121,6 +2122,9 @@ public class Schema2XForms
|
|||||||
final Element modelElement =
|
final Element modelElement =
|
||||||
xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
|
xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
|
||||||
NamespaceConstants.XFORMS_PREFIX + ":model");
|
NamespaceConstants.XFORMS_PREFIX + ":model");
|
||||||
|
modelElement.setAttributeNS(NamespaceConstants.XFORMS_NS,
|
||||||
|
NamespaceConstants.XFORMS_PREFIX + ":functions",
|
||||||
|
NamespaceConstants.CHIBA_PREFIX + ":match");
|
||||||
this.setXFormsId(modelElement);
|
this.setXFormsId(modelElement);
|
||||||
final Element modelWrapper =
|
final Element modelWrapper =
|
||||||
xformsDocument.createElementNS(NamespaceConstants.XHTML_NS,
|
xformsDocument.createElementNS(NamespaceConstants.XHTML_NS,
|
||||||
@@ -2777,7 +2781,7 @@ public class Schema2XForms
|
|||||||
//
|
//
|
||||||
// type.getName() may be 'null' for anonymous types, so compare against
|
// type.getName() may be 'null' for anonymous types, so compare against
|
||||||
// static string (see bug #1172541 on sf.net)
|
// static string (see bug #1172541 on sf.net)
|
||||||
|
final List<String> constraints = new LinkedList<String>();
|
||||||
if (controlType instanceof XSSimpleTypeDefinition &&
|
if (controlType instanceof XSSimpleTypeDefinition &&
|
||||||
((XSSimpleTypeDefinition)controlType).getBuiltInKind() != XSConstants.ANYSIMPLETYPE_DT)
|
((XSSimpleTypeDefinition)controlType).getBuiltInKind() != XSConstants.ANYSIMPLETYPE_DT)
|
||||||
{
|
{
|
||||||
@@ -2798,6 +2802,11 @@ public class Schema2XForms
|
|||||||
NamespaceService.ALFRESCO_PREFIX + ":builtInType",
|
NamespaceService.ALFRESCO_PREFIX + ":builtInType",
|
||||||
typeName);
|
typeName);
|
||||||
}
|
}
|
||||||
|
final StringList lexicalPatterns = ((XSSimpleTypeDefinition)controlType).getLexicalPattern();
|
||||||
|
for (int i = 0; lexicalPatterns != null && i < lexicalPatterns.getLength(); i++)
|
||||||
|
{
|
||||||
|
constraints.add("chiba:match(., '" + lexicalPatterns.item(i) + "',null)");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final short constraintType =
|
final short constraintType =
|
||||||
@@ -2833,13 +2842,10 @@ public class Schema2XForms
|
|||||||
//count(.) <= maxOccurs && count(.) >= minOccurs
|
//count(.) <= maxOccurs && count(.) >= minOccurs
|
||||||
final String nodeset = bindElement.getAttributeNS(NamespaceConstants.XFORMS_NS,
|
final String nodeset = bindElement.getAttributeNS(NamespaceConstants.XFORMS_NS,
|
||||||
"nodeset");
|
"nodeset");
|
||||||
String minConstraint = null;
|
|
||||||
String maxConstraint = null;
|
|
||||||
|
|
||||||
if (o.minimum > 1)
|
if (o.minimum > 1)
|
||||||
{
|
{
|
||||||
//if 0 or 1 -> no constraint (managed by "required")
|
//if 0 or 1 -> no constraint (managed by "required")
|
||||||
minConstraint = "count(../" + nodeset + ") >= " + o.minimum;
|
constraints.add("count(../" + nodeset + ") >= " + o.minimum);
|
||||||
}
|
}
|
||||||
bindElement.setAttributeNS(NamespaceConstants.XFORMS_NS,
|
bindElement.setAttributeNS(NamespaceConstants.XFORMS_NS,
|
||||||
NamespaceConstants.XFORMS_PREFIX + ":minOccurs",
|
NamespaceConstants.XFORMS_PREFIX + ":minOccurs",
|
||||||
@@ -2847,23 +2853,18 @@ public class Schema2XForms
|
|||||||
if (o.maximum > 1)
|
if (o.maximum > 1)
|
||||||
{
|
{
|
||||||
//if 1 or unbounded -> no constraint
|
//if 1 or unbounded -> no constraint
|
||||||
maxConstraint = "count(../" + nodeset + ") <= " + o.maximum;
|
constraints.add("count(../" + nodeset + ") <= " + o.maximum);
|
||||||
}
|
}
|
||||||
|
|
||||||
bindElement.setAttributeNS(NamespaceConstants.XFORMS_NS,
|
bindElement.setAttributeNS(NamespaceConstants.XFORMS_NS,
|
||||||
NamespaceConstants.XFORMS_PREFIX + ":maxOccurs",
|
NamespaceConstants.XFORMS_PREFIX + ":maxOccurs",
|
||||||
o.isUnbounded() ? "unbounded" : String.valueOf(o.maximum));
|
o.isUnbounded() ? "unbounded" : String.valueOf(o.maximum));
|
||||||
|
|
||||||
final String constraint = (minConstraint != null && maxConstraint != null
|
if (constraints.size() != 0)
|
||||||
? minConstraint + " and " + maxConstraint
|
|
||||||
: (minConstraint != null
|
|
||||||
? minConstraint
|
|
||||||
: maxConstraint));
|
|
||||||
if (constraint != null)
|
|
||||||
{
|
{
|
||||||
bindElement.setAttributeNS(NamespaceConstants.XFORMS_NS,
|
bindElement.setAttributeNS(NamespaceConstants.XFORMS_NS,
|
||||||
NamespaceConstants.XFORMS_PREFIX + ":constraint",
|
NamespaceConstants.XFORMS_PREFIX + ":constraint",
|
||||||
constraint);
|
StringUtils.join((String[])constraints.toArray(new String[constraints.size()]), " and "));
|
||||||
}
|
}
|
||||||
return bindElement;
|
return bindElement;
|
||||||
}
|
}
|
||||||
|
@@ -25,18 +25,27 @@
|
|||||||
package org.alfresco.web.forms.xforms;
|
package org.alfresco.web.forms.xforms;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.Enumeration;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.Vector;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
import junit.framework.AssertionFailedError;
|
import junit.framework.AssertionFailedError;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.web.forms.XMLUtil;
|
|
||||||
import org.alfresco.util.BaseTest;
|
import org.alfresco.util.BaseTest;
|
||||||
|
import org.alfresco.web.forms.XMLUtil;
|
||||||
import org.apache.commons.jxpath.JXPathContext;
|
import org.apache.commons.jxpath.JXPathContext;
|
||||||
import org.apache.commons.jxpath.Pointer;
|
import org.apache.commons.jxpath.Pointer;
|
||||||
import org.chiba.xml.ns.NamespaceConstants;
|
|
||||||
import org.w3c.dom.*;
|
|
||||||
import org.xml.sax.*;
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.chiba.xml.ns.NamespaceConstants;
|
||||||
|
import org.chiba.xml.events.XFormsEventNames;
|
||||||
|
import org.chiba.xml.events.XMLEvent;
|
||||||
|
import org.chiba.xml.xforms.ChibaBean;
|
||||||
|
import org.chiba.xml.xforms.XFormsElement;
|
||||||
|
import org.chiba.xml.events.DOMEventNames;
|
||||||
|
import org.w3c.dom.*;
|
||||||
|
import org.w3c.dom.events.*;
|
||||||
|
import org.xml.sax.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JUnit tests to exercise the the schema to xforms converter
|
* JUnit tests to exercise the the schema to xforms converter
|
||||||
@@ -54,6 +63,7 @@ public class Schema2XFormsTest
|
|||||||
{
|
{
|
||||||
final Document schemaDocument = this.loadTestResourceDocument("xforms/unit-tests/automated/one-string-test.xsd");
|
final Document schemaDocument = this.loadTestResourceDocument("xforms/unit-tests/automated/one-string-test.xsd");
|
||||||
final Document xformsDocument = Schema2XFormsTest.buildXForm(null, schemaDocument, "one-string-test");
|
final Document xformsDocument = Schema2XFormsTest.buildXForm(null, schemaDocument, "one-string-test");
|
||||||
|
this.runXForm(xformsDocument);
|
||||||
final JXPathContext xpathContext = JXPathContext.newContext(xformsDocument);
|
final JXPathContext xpathContext = JXPathContext.newContext(xformsDocument);
|
||||||
Pointer pointer = xpathContext.getPointer("//*[@id='input_0']");
|
Pointer pointer = xpathContext.getPointer("//*[@id='input_0']");
|
||||||
assertNotNull(pointer);
|
assertNotNull(pointer);
|
||||||
@@ -73,6 +83,7 @@ public class Schema2XFormsTest
|
|||||||
final Document instanceDocument = XMLUtil.parse("<one-string-test><string>test</string></one-string-test>");
|
final Document instanceDocument = XMLUtil.parse("<one-string-test><string>test</string></one-string-test>");
|
||||||
final Document schemaDocument = this.loadTestResourceDocument("xforms/unit-tests/automated/one-string-test.xsd");
|
final Document schemaDocument = this.loadTestResourceDocument("xforms/unit-tests/automated/one-string-test.xsd");
|
||||||
final Document xformsDocument = Schema2XFormsTest.buildXForm(instanceDocument, schemaDocument, "one-string-test");
|
final Document xformsDocument = Schema2XFormsTest.buildXForm(instanceDocument, schemaDocument, "one-string-test");
|
||||||
|
this.runXForm(xformsDocument);
|
||||||
final JXPathContext xpathContext = JXPathContext.newContext(xformsDocument);
|
final JXPathContext xpathContext = JXPathContext.newContext(xformsDocument);
|
||||||
Pointer pointer = xpathContext.getPointer("//*[@id='input_0']");
|
Pointer pointer = xpathContext.getPointer("//*[@id='input_0']");
|
||||||
assertNotNull(pointer);
|
assertNotNull(pointer);
|
||||||
@@ -144,6 +155,7 @@ public class Schema2XFormsTest
|
|||||||
Schema2XFormsTest.assertRepeatProperties(xformsDocument,
|
Schema2XFormsTest.assertRepeatProperties(xformsDocument,
|
||||||
"/repeat-constraints-test/nested-outer-outer-three-to-inf/nested-outer-inner-five-to-inf/nested-inner-inner-seven-to-inf",
|
"/repeat-constraints-test/nested-outer-outer-three-to-inf/nested-outer-inner-five-to-inf/nested-inner-inner-seven-to-inf",
|
||||||
new SchemaUtil.Occurrence(7, SchemaUtil.Occurrence.UNBOUNDED));
|
new SchemaUtil.Occurrence(7, SchemaUtil.Occurrence.UNBOUNDED));
|
||||||
|
this.runXForm(xformsDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRootElementWithExtension()
|
public void testRootElementWithExtension()
|
||||||
@@ -151,6 +163,7 @@ public class Schema2XFormsTest
|
|||||||
{
|
{
|
||||||
final Document schemaDocument = this.loadTestResourceDocument("xforms/unit-tests/automated/root-element-with-extension-test.xsd");
|
final Document schemaDocument = this.loadTestResourceDocument("xforms/unit-tests/automated/root-element-with-extension-test.xsd");
|
||||||
Document xformsDocument = Schema2XFormsTest.buildXForm(null, schemaDocument, "without-extension-test");
|
Document xformsDocument = Schema2XFormsTest.buildXForm(null, schemaDocument, "without-extension-test");
|
||||||
|
this.runXForm(xformsDocument);
|
||||||
assertEquals(3, xformsDocument.getElementsByTagNameNS(NamespaceConstants.XFORMS_NS, "input").getLength());
|
assertEquals(3, xformsDocument.getElementsByTagNameNS(NamespaceConstants.XFORMS_NS, "input").getLength());
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -169,7 +182,7 @@ public class Schema2XFormsTest
|
|||||||
{
|
{
|
||||||
final Document schemaDocument = this.loadTestResourceDocument("xforms/unit-tests/automated/switch-test.xsd");
|
final Document schemaDocument = this.loadTestResourceDocument("xforms/unit-tests/automated/switch-test.xsd");
|
||||||
final Document xformsDocument = Schema2XFormsTest.buildXForm(null, schemaDocument, "switch-test");
|
final Document xformsDocument = Schema2XFormsTest.buildXForm(null, schemaDocument, "switch-test");
|
||||||
LOGGER.debug("generated xforms " + XMLUtil.toString(xformsDocument));
|
this.runXForm(xformsDocument);
|
||||||
// assertEquals(3, xformsDocument.getElementsByTagNameNS(NamespaceConstants.XFORMS_NS, "input").getLength());
|
// assertEquals(3, xformsDocument.getElementsByTagNameNS(NamespaceConstants.XFORMS_NS, "input").getLength());
|
||||||
//
|
//
|
||||||
// try
|
// try
|
||||||
@@ -187,6 +200,7 @@ public class Schema2XFormsTest
|
|||||||
{
|
{
|
||||||
final Document schemaDocument = this.loadTestResourceDocument("xforms/unit-tests/automated/derived-type-test.xsd");
|
final Document schemaDocument = this.loadTestResourceDocument("xforms/unit-tests/automated/derived-type-test.xsd");
|
||||||
final Document xformsDocument = Schema2XFormsTest.buildXForm(null, schemaDocument, "derived-type-test");
|
final Document xformsDocument = Schema2XFormsTest.buildXForm(null, schemaDocument, "derived-type-test");
|
||||||
|
this.runXForm(xformsDocument);
|
||||||
LOGGER.debug("generated xforms " + XMLUtil.toString(xformsDocument));
|
LOGGER.debug("generated xforms " + XMLUtil.toString(xformsDocument));
|
||||||
assertBindProperties(xformsDocument,
|
assertBindProperties(xformsDocument,
|
||||||
"/derived-type-test/raw-normalized-string",
|
"/derived-type-test/raw-normalized-string",
|
||||||
@@ -306,6 +320,7 @@ public class Schema2XFormsTest
|
|||||||
{
|
{
|
||||||
final Document schemaDocument = this.loadTestResourceDocument("xforms/unit-tests/automated/recursive-test.xsd");
|
final Document schemaDocument = this.loadTestResourceDocument("xforms/unit-tests/automated/recursive-test.xsd");
|
||||||
Document xformsDocument = Schema2XFormsTest.buildXForm(null, schemaDocument, "non-recursive-test");
|
Document xformsDocument = Schema2XFormsTest.buildXForm(null, schemaDocument, "non-recursive-test");
|
||||||
|
this.runXForm(xformsDocument);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
xformsDocument = Schema2XFormsTest.buildXForm(null, schemaDocument, "recursive-test");
|
xformsDocument = Schema2XFormsTest.buildXForm(null, schemaDocument, "recursive-test");
|
||||||
@@ -326,6 +341,87 @@ public class Schema2XFormsTest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testConstraint()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
final Document schemaDocument = this.loadTestResourceDocument("xforms/unit-tests/automated/constraint-test.xsd");
|
||||||
|
Document xformsDocument = Schema2XFormsTest.buildXForm(null, schemaDocument, "constraint-test");
|
||||||
|
final ChibaBean chibaBean = this.runXForm(xformsDocument);
|
||||||
|
final LinkedList<XMLEvent> events = new LinkedList<XMLEvent>();
|
||||||
|
final EventListener el = new EventListener()
|
||||||
|
{
|
||||||
|
public void handleEvent(final Event e)
|
||||||
|
{
|
||||||
|
events.add((XMLEvent)e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
((EventTarget)chibaBean.getXMLContainer().getDocumentElement()).addEventListener(XFormsEventNames.VALID, el, true);
|
||||||
|
((EventTarget)chibaBean.getXMLContainer().getDocumentElement()).addEventListener(XFormsEventNames.INVALID, el, true);
|
||||||
|
((EventTarget)chibaBean.getXMLContainer().getDocumentElement()).addEventListener(XFormsEventNames.SUBMIT_DONE, el, true);
|
||||||
|
((EventTarget)chibaBean.getXMLContainer().getDocumentElement()).addEventListener(XFormsEventNames.SUBMIT_ERROR, el, true);
|
||||||
|
|
||||||
|
Element e = Schema2XFormsTest.resolveXFormsControl(xformsDocument, "/constraint-test/zip-pattern")[0];
|
||||||
|
chibaBean.updateControlValue(e.getAttribute("id"), "not a zip");
|
||||||
|
assertEquals(1, events.size());
|
||||||
|
assertEquals(XFormsEventNames.INVALID, events.get(0).getType());
|
||||||
|
events.clear();
|
||||||
|
|
||||||
|
chibaBean.updateControlValue(e.getAttribute("id"), "94110");
|
||||||
|
assertEquals(1, events.size());
|
||||||
|
assertEquals(XFormsEventNames.VALID, events.get(0).getType());
|
||||||
|
events.clear();
|
||||||
|
|
||||||
|
e = Schema2XFormsTest.resolveXFormsControl(xformsDocument, "/constraint-test/email-pattern")[0];
|
||||||
|
chibaBean.updateControlValue(e.getAttribute("id"), "iamnotanemailaddress");
|
||||||
|
assertEquals(1, events.size());
|
||||||
|
assertEquals(XFormsEventNames.INVALID, events.get(0).getType());
|
||||||
|
events.clear();
|
||||||
|
|
||||||
|
chibaBean.updateControlValue(e.getAttribute("id"), "ariel.backenroth@alfresco.org");
|
||||||
|
assertEquals(1, events.size());
|
||||||
|
assertEquals(XFormsEventNames.VALID, events.get(0).getType());
|
||||||
|
events.clear();
|
||||||
|
|
||||||
|
Element[] controls = Schema2XFormsTest.resolveXFormsControl(xformsDocument, "/constraint-test/repeated-zip-pattern/.");
|
||||||
|
assertEquals(3 /* 2 actual + prototype */, controls.length);
|
||||||
|
Element[] repeat = Schema2XFormsTest.resolveXFormsControl(xformsDocument, "/constraint-test/repeated-zip-pattern");
|
||||||
|
assertEquals(4 /* 1 repeat + 3 triggers */, repeat.length);
|
||||||
|
|
||||||
|
final Element[] bindForRepeat = Schema2XFormsTest.resolveBind(xformsDocument, "/constraint-test/repeated-zip-pattern");
|
||||||
|
assertEquals(bindForRepeat[bindForRepeat.length - 1].getAttribute("id"), repeat[0].getAttributeNS(NamespaceConstants.XFORMS_NS, "bind"));
|
||||||
|
for (int i = 1; i <= Integer.parseInt(bindForRepeat[bindForRepeat.length - 1].getAttributeNS(NamespaceConstants.XFORMS_NS, "minOccurs")); i++)
|
||||||
|
{
|
||||||
|
chibaBean.updateRepeatIndex(repeat[0].getAttribute("id"), i);
|
||||||
|
chibaBean.updateControlValue(controls[controls.length - 1].getAttribute("id"), "notavalidzip");
|
||||||
|
}
|
||||||
|
// assertEquals("unexpected events " + events, controls.length, events.size());
|
||||||
|
for (final Event event : events)
|
||||||
|
{
|
||||||
|
assertEquals(XFormsEventNames.INVALID, event.getType());
|
||||||
|
}
|
||||||
|
events.clear();
|
||||||
|
|
||||||
|
chibaBean.dispatch("submit", DOMEventNames.ACTIVATE);
|
||||||
|
assertEquals(1, events.size());
|
||||||
|
assertEquals(XFormsEventNames.SUBMIT_ERROR, events.get(0).getType());
|
||||||
|
events.clear();
|
||||||
|
|
||||||
|
for (final Element c : controls)
|
||||||
|
{
|
||||||
|
chibaBean.updateControlValue(c.getAttribute("id"), "07666");
|
||||||
|
}
|
||||||
|
// assertEquals("unexpected events " + events, controls.length, events.size());
|
||||||
|
for (final Event event : events)
|
||||||
|
{
|
||||||
|
assertEquals(XFormsEventNames.VALID, event.getType());
|
||||||
|
}
|
||||||
|
events.clear();
|
||||||
|
|
||||||
|
chibaBean.dispatch("submit", DOMEventNames.ACTIVATE);
|
||||||
|
assertEquals(1, events.size());
|
||||||
|
assertEquals(XFormsEventNames.SUBMIT_DONE, events.get(0).getType());
|
||||||
|
}
|
||||||
|
|
||||||
private static void assertRepeatProperties(final Document xformsDocument,
|
private static void assertRepeatProperties(final Document xformsDocument,
|
||||||
final String nodeset,
|
final String nodeset,
|
||||||
final SchemaUtil.Occurrence o)
|
final SchemaUtil.Occurrence o)
|
||||||
@@ -478,6 +574,19 @@ public class Schema2XFormsTest
|
|||||||
return XMLUtil.parse(f);
|
return XMLUtil.parse(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ChibaBean runXForm(final Document xformsDocument)
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
final ChibaBean chibaBean = new ChibaBean();
|
||||||
|
chibaBean.setConfig(this.getResourcesDir() + File.separator +
|
||||||
|
".." + File.separator +
|
||||||
|
"web" + File.separator +
|
||||||
|
"WEB-INF" + File.separator + "chiba.xml");
|
||||||
|
chibaBean.setXMLContainer(xformsDocument);
|
||||||
|
chibaBean.init();
|
||||||
|
return chibaBean;
|
||||||
|
}
|
||||||
|
|
||||||
private static Document buildXForm(final Document instanceDocument,
|
private static Document buildXForm(final Document instanceDocument,
|
||||||
final Document schemaDocument,
|
final Document schemaDocument,
|
||||||
final String rootElementName)
|
final String rootElementName)
|
||||||
@@ -485,7 +594,7 @@ public class Schema2XFormsTest
|
|||||||
{
|
{
|
||||||
final Schema2XForms s2xf = new Schema2XForms("/test_action",
|
final Schema2XForms s2xf = new Schema2XForms("/test_action",
|
||||||
Schema2XForms.SubmitMethod.POST,
|
Schema2XForms.SubmitMethod.POST,
|
||||||
"http://fake.base.url");
|
"echo://fake.base.url");
|
||||||
return s2xf.buildXForm(instanceDocument,
|
return s2xf.buildXForm(instanceDocument,
|
||||||
schemaDocument,
|
schemaDocument,
|
||||||
rootElementName,
|
rootElementName,
|
||||||
|
@@ -394,6 +394,10 @@ public class RepoStore implements WebScriptStore, ApplicationContextAware, Appli
|
|||||||
throw new IOException("Document " + documentPath + " does not exist.");
|
throw new IOException("Document " + documentPath + " does not exist.");
|
||||||
}
|
}
|
||||||
ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
|
ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
|
||||||
|
if (reader == null || !reader.exists())
|
||||||
|
{
|
||||||
|
throw new IOException("Failed to read content at " + documentPath + " (content reader does not exist)");
|
||||||
|
}
|
||||||
return reader.getContentInputStream();
|
return reader.getContentInputStream();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -160,8 +160,8 @@ public class ErrorsRenderer extends BaseRenderer
|
|||||||
{
|
{
|
||||||
// use the error class if the message is error level
|
// use the error class if the message is error level
|
||||||
if (errorClass != null &&
|
if (errorClass != null &&
|
||||||
fm.getSeverity() == FacesMessage.SEVERITY_ERROR ||
|
(fm.getSeverity() == FacesMessage.SEVERITY_ERROR ||
|
||||||
fm.getSeverity() == FacesMessage.SEVERITY_FATAL)
|
fm.getSeverity() == FacesMessage.SEVERITY_FATAL))
|
||||||
{
|
{
|
||||||
out.write(" class='");
|
out.write(" class='");
|
||||||
out.write(errorClass);
|
out.write(errorClass);
|
||||||
@@ -170,8 +170,8 @@ public class ErrorsRenderer extends BaseRenderer
|
|||||||
|
|
||||||
// use the info class if the message is info level
|
// use the info class if the message is info level
|
||||||
if (infoClass != null &&
|
if (infoClass != null &&
|
||||||
fm.getSeverity() == FacesMessage.SEVERITY_INFO ||
|
(fm.getSeverity() == FacesMessage.SEVERITY_INFO ||
|
||||||
fm.getSeverity() == FacesMessage.SEVERITY_WARN)
|
fm.getSeverity() == FacesMessage.SEVERITY_WARN))
|
||||||
{
|
{
|
||||||
out.write(" class='");
|
out.write(" class='");
|
||||||
out.write(infoClass);
|
out.write(infoClass);
|
||||||
|
@@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||||
|
elementFormDefault="qualified">
|
||||||
|
<xs:element name="constraint-test">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="zip-pattern">
|
||||||
|
<xs:simpleType>
|
||||||
|
<xs:restriction base="xs:normalizedString">
|
||||||
|
<xs:maxLength value="5"/>
|
||||||
|
<xs:pattern value="[0-9][0-9][0-9][0-9][0-9]"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="repeated-zip-pattern" minOccurs="2" maxOccurs="5">
|
||||||
|
<xs:simpleType>
|
||||||
|
<xs:restriction base="xs:normalizedString">
|
||||||
|
<xs:maxLength value="5"/>
|
||||||
|
<xs:pattern value="[0-9][0-9][0-9][0-9][0-9]"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="email-pattern">
|
||||||
|
<xs:simpleType>
|
||||||
|
<xs:restriction base="xs:normalizedString">
|
||||||
|
<xs:maxLength value="256"/>
|
||||||
|
<xs:pattern value="[A-Za-z0-9._]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,4}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
@@ -33,18 +33,19 @@
|
|||||||
|
|
||||||
<%-- Init the Tiny MCE in-line HTML editor --%>
|
<%-- Init the Tiny MCE in-line HTML editor --%>
|
||||||
tinyMCE.init({
|
tinyMCE.init({
|
||||||
theme : "advanced",
|
theme : "advanced",
|
||||||
mode : "exact",
|
mode : "exact",
|
||||||
elements : "editor",
|
elements : "editor",
|
||||||
save_callback : "saveContent",
|
save_callback : "saveContent",
|
||||||
plugins : "table",
|
urlconverter_callback: "convertUrl",
|
||||||
theme_advanced_toolbar_location : "top",
|
plugins : "table",
|
||||||
theme_advanced_toolbar_align : "left",
|
theme_advanced_toolbar_location : "top",
|
||||||
theme_advanced_buttons1_add : "fontselect,fontsizeselect",
|
theme_advanced_toolbar_align : "left",
|
||||||
theme_advanced_buttons2_add : "separator,forecolor,backcolor",
|
theme_advanced_buttons1_add : "fontselect,fontsizeselect",
|
||||||
theme_advanced_buttons3_add_before : "tablecontrols,separator",
|
theme_advanced_buttons2_add : "separator,forecolor,backcolor",
|
||||||
theme_advanced_disable: "styleselect",
|
theme_advanced_buttons3_add_before : "tablecontrols,separator",
|
||||||
extended_valid_elements : "a[href|target|name],font[face|size|color|style],span[class|align|style]"
|
theme_advanced_disable: "styleselect",
|
||||||
|
extended_valid_elements : "a[href|target|name],font[face|size|color|style],span[class|align|style]"
|
||||||
});
|
});
|
||||||
|
|
||||||
function saveContent(id, content)
|
function saveContent(id, content)
|
||||||
@@ -52,6 +53,13 @@
|
|||||||
document.getElementById("wizard:wizard-body:editor-output").value = content;
|
document.getElementById("wizard:wizard-body:editor-output").value = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function convertUrl(href, element, onsave)
|
||||||
|
{
|
||||||
|
// just return the passed href, this is enough to stop TinyMCE
|
||||||
|
// from converting the URL to it's relative form
|
||||||
|
return href;
|
||||||
|
}
|
||||||
|
|
||||||
var isIE = (document.all);
|
var isIE = (document.all);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@@ -39,18 +39,19 @@
|
|||||||
|
|
||||||
<%-- Init the Tiny MCE in-line HTML editor --%>
|
<%-- Init the Tiny MCE in-line HTML editor --%>
|
||||||
tinyMCE.init({
|
tinyMCE.init({
|
||||||
theme : "advanced",
|
theme : "advanced",
|
||||||
mode : "exact",
|
mode : "exact",
|
||||||
elements : "editor",
|
elements : "editor",
|
||||||
save_callback : "saveContent",
|
save_callback : "saveContent",
|
||||||
plugins : "table",
|
urlconverter_callback: "convertUrl",
|
||||||
theme_advanced_toolbar_location : "top",
|
plugins : "table",
|
||||||
theme_advanced_toolbar_align : "left",
|
theme_advanced_toolbar_location : "top",
|
||||||
theme_advanced_buttons1_add : "fontselect,fontsizeselect",
|
theme_advanced_toolbar_align : "left",
|
||||||
theme_advanced_buttons2_add : "separator,forecolor,backcolor",
|
theme_advanced_buttons1_add : "fontselect,fontsizeselect",
|
||||||
theme_advanced_buttons3_add_before : "tablecontrols,separator",
|
theme_advanced_buttons2_add : "separator,forecolor,backcolor",
|
||||||
theme_advanced_disable: "styleselect",
|
theme_advanced_buttons3_add_before : "tablecontrols,separator",
|
||||||
extended_valid_elements : "a[href|target|name],font[face|size|color|style],span[class|align|style]"
|
theme_advanced_disable: "styleselect",
|
||||||
|
extended_valid_elements : "a[href|target|name],font[face|size|color|style],span[class|align|style]"
|
||||||
});
|
});
|
||||||
|
|
||||||
function saveContent(id, content)
|
function saveContent(id, content)
|
||||||
@@ -58,6 +59,13 @@
|
|||||||
document.forms['edit-file']['edit-file:editorOutput'].value = content;
|
document.forms['edit-file']['edit-file:editorOutput'].value = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function convertUrl(href, element, onsave)
|
||||||
|
{
|
||||||
|
// just return the passed href, this is enough to stop TinyMCE
|
||||||
|
// from converting the URL to it's relative form
|
||||||
|
return href;
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user