mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix for AWC-656 & 695
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2956 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -227,6 +227,12 @@ public class EditContentPropertiesDialog extends BaseDialogBean
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getFinishButtonDisabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Bean getters and setters
|
// Bean getters and setters
|
||||||
|
|
||||||
|
@@ -35,6 +35,7 @@ import org.alfresco.web.ui.repo.component.property.UIPropertySheet;
|
|||||||
import org.alfresco.web.ui.repo.component.property.UIPropertySheet.ClientValidation;
|
import org.alfresco.web.ui.repo.component.property.UIPropertySheet.ClientValidation;
|
||||||
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.springframework.util.StringUtils;
|
||||||
import org.springframework.web.jsf.FacesContextUtils;
|
import org.springframework.web.jsf.FacesContextUtils;
|
||||||
|
|
||||||
public abstract class BaseComponentGenerator implements IComponentGenerator
|
public abstract class BaseComponentGenerator implements IComponentGenerator
|
||||||
@@ -398,7 +399,8 @@ public abstract class BaseComponentGenerator implements IComponentGenerator
|
|||||||
// add the validation failed message to show (use the value of the
|
// add the validation failed message to show (use the value of the
|
||||||
// label component of the given item)
|
// label component of the given item)
|
||||||
String msg = Application.getMessage(context, "validation_mandatory");
|
String msg = Application.getMessage(context, "validation_mandatory");
|
||||||
params.add("'" + MessageFormat.format(msg, new Object[] {item.getResolvedDisplayLabel()}) + "'");
|
addStringConstraintParam(params,
|
||||||
|
MessageFormat.format(msg, new Object[] {item.getResolvedDisplayLabel()}));
|
||||||
|
|
||||||
// add the validation case to the property sheet
|
// add the validation case to the property sheet
|
||||||
propertySheet.addClientValidation(new ClientValidation("validateMandatory",
|
propertySheet.addClientValidation(new ClientValidation("validateMandatory",
|
||||||
@@ -504,12 +506,12 @@ public abstract class BaseComponentGenerator implements IComponentGenerator
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// encode the expression so it can be unescaped by JavaScript
|
// encode the expression so it can be unescaped by JavaScript
|
||||||
params.add("'" + URLEncoder.encode(expression, "UTF-8") + "'");
|
addStringConstraintParam(params, URLEncoder.encode(expression, "UTF-8"));
|
||||||
}
|
}
|
||||||
catch (UnsupportedEncodingException e)
|
catch (UnsupportedEncodingException e)
|
||||||
{
|
{
|
||||||
// just add the expression as is
|
// just add the expression as is
|
||||||
params.add("'" + expression + "'");
|
addStringConstraintParam(params, expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the requiresMatch parameter
|
// add the requiresMatch parameter
|
||||||
@@ -517,12 +519,12 @@ public abstract class BaseComponentGenerator implements IComponentGenerator
|
|||||||
|
|
||||||
// add the validation failed messages
|
// add the validation failed messages
|
||||||
String matchMsg = Application.getMessage(context, "validation_regex");
|
String matchMsg = Application.getMessage(context, "validation_regex");
|
||||||
params.add("'" + MessageFormat.format(matchMsg, new Object[]
|
addStringConstraintParam(params,
|
||||||
{property.getResolvedDisplayLabel()}) + "'");
|
MessageFormat.format(matchMsg, new Object[] {property.getResolvedDisplayLabel()}));
|
||||||
|
|
||||||
String noMatchMsg = Application.getMessage(context, "validation_regex_not_match");
|
String noMatchMsg = Application.getMessage(context, "validation_regex_not_match");
|
||||||
params.add("'" + MessageFormat.format(noMatchMsg, new Object[]
|
addStringConstraintParam(params,
|
||||||
{property.getResolvedDisplayLabel()}) + "'");
|
MessageFormat.format(noMatchMsg, new Object[] {property.getResolvedDisplayLabel()}));
|
||||||
|
|
||||||
// add the validation case to the property sheet
|
// add the validation case to the property sheet
|
||||||
propertySheet.addClientValidation(new ClientValidation("validateRegex",
|
propertySheet.addClientValidation(new ClientValidation("validateRegex",
|
||||||
@@ -562,8 +564,8 @@ public abstract class BaseComponentGenerator implements IComponentGenerator
|
|||||||
|
|
||||||
// add the validation failed message to show
|
// add the validation failed message to show
|
||||||
String msg = Application.getMessage(context, "validation_string_length");
|
String msg = Application.getMessage(context, "validation_string_length");
|
||||||
params.add("'" + MessageFormat.format(msg, new Object[]
|
addStringConstraintParam(params,
|
||||||
{property.getResolvedDisplayLabel(), min, max}) + "'");
|
MessageFormat.format(msg, new Object[] {property.getResolvedDisplayLabel(), min, max}));
|
||||||
|
|
||||||
// add the validation case to the property sheet
|
// add the validation case to the property sheet
|
||||||
propertySheet.addClientValidation(new ClientValidation("validateStringLength",
|
propertySheet.addClientValidation(new ClientValidation("validateStringLength",
|
||||||
@@ -603,8 +605,8 @@ public abstract class BaseComponentGenerator implements IComponentGenerator
|
|||||||
|
|
||||||
// add the validation failed message to show
|
// add the validation failed message to show
|
||||||
String msg = Application.getMessage(context, "validation_numeric_range");
|
String msg = Application.getMessage(context, "validation_numeric_range");
|
||||||
params.add("'" + MessageFormat.format(msg, new Object[]
|
addStringConstraintParam(params,
|
||||||
{property.getResolvedDisplayLabel(), min, max}) + "'");
|
MessageFormat.format(msg, new Object[] {property.getResolvedDisplayLabel(), min, max}));
|
||||||
|
|
||||||
// add the validation case to the property sheet
|
// add the validation case to the property sheet
|
||||||
propertySheet.addClientValidation(new ClientValidation("validateNumberRange",
|
propertySheet.addClientValidation(new ClientValidation("validateNumberRange",
|
||||||
@@ -695,6 +697,20 @@ public abstract class BaseComponentGenerator implements IComponentGenerator
|
|||||||
return getDataDictionary(context).getAssociationDefinition(node, associationName);
|
return getDataDictionary(context).getAssociationDefinition(node, associationName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the given string parameter to the list of parameters to be used for
|
||||||
|
* validating constraints on the client.
|
||||||
|
* This method adds the quotes around the given parameter and also escapes
|
||||||
|
* any ocurrences of the double quote character.
|
||||||
|
*
|
||||||
|
* @param params The list of parameters for the constraint
|
||||||
|
* @param param The string parameter to add
|
||||||
|
*/
|
||||||
|
protected void addStringConstraintParam(List<String> params, String param)
|
||||||
|
{
|
||||||
|
params.add("\"" + StringUtils.replace(param, "\"", "\\\"") + "\"");
|
||||||
|
}
|
||||||
|
|
||||||
private DataDictionary getDataDictionary(FacesContext context)
|
private DataDictionary getDataDictionary(FacesContext context)
|
||||||
{
|
{
|
||||||
if (this.dataDictionary == null)
|
if (this.dataDictionary == null)
|
||||||
|
@@ -41,6 +41,12 @@ public class EditSpaceDialog extends CreateSpaceDialog
|
|||||||
return Application.getMessage(FacesContext.getCurrentInstance(), "ok");
|
return Application.getMessage(FacesContext.getCurrentInstance(), "ok");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getFinishButtonDisabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the editable node
|
* Returns the editable node
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user