mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Newly converted dialogs now make use of the new subtitle feature of the dialog framework.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6850 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -41,62 +41,81 @@ import org.alfresco.web.ui.common.Utils;
|
||||
|
||||
public class CreateGroupDialog extends GroupsDialog
|
||||
{
|
||||
private static final String MSG_ERR_EXISTS = "groups_err_exists";
|
||||
private static final String MSG_ERR_EXISTS = "groups_err_exists";
|
||||
private static final String MSG_BUTTON_NEW_GROUP = "new_group";
|
||||
|
||||
private static final String BUTTON_NEW_GROUP = "new_group";
|
||||
@Override
|
||||
public void init(Map<String, String> parameters)
|
||||
{
|
||||
super.init(parameters);
|
||||
properties.setName("");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// create new Group using Authentication Service
|
||||
String groupName = properties.getAuthService().getName(AuthorityType.GROUP, properties.getName());
|
||||
if (properties.getAuthService().authorityExists(groupName) == false)
|
||||
{
|
||||
properties.getAuthService().createAuthority(AuthorityType.GROUP, properties.getActionGroup(), properties.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.addErrorMessage(Application.getMessage(context, MSG_ERR_EXISTS));
|
||||
outcome = null;
|
||||
}
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(context, Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// create new Group using Authentication Service
|
||||
String groupName = properties.getAuthService().getName(AuthorityType.GROUP, properties.getName());
|
||||
if (properties.getAuthService().authorityExists(groupName) == false)
|
||||
{
|
||||
properties.getAuthService().createAuthority(AuthorityType.GROUP, properties.getActionGroup(), properties.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.addErrorMessage(Application.getMessage(context, MSG_ERR_EXISTS));
|
||||
outcome = null;
|
||||
}
|
||||
|
||||
if (outcome == null)
|
||||
{
|
||||
isFinished = false;
|
||||
}
|
||||
|
||||
return outcome;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
||||
context, Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||
outcome = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Map<String, String> parameters)
|
||||
{
|
||||
super.init(parameters);
|
||||
properties.setName("");
|
||||
}
|
||||
if (outcome == null)
|
||||
{
|
||||
isFinished = false;
|
||||
}
|
||||
|
||||
public void validateGroupName(FacesContext context, UIComponent component, Object value) throws ValidatorException
|
||||
{
|
||||
String name = (String) value;
|
||||
if (name.indexOf('\'') != -1 || name.indexOf('"') != -1 || name.indexOf('\\') != -1)
|
||||
{
|
||||
String err = MessageFormat.format(Application.getMessage(context, "groups_err_group_name"), new Object[] { "', \", \\" });
|
||||
throw new ValidatorException(new FacesMessage(err));
|
||||
}
|
||||
}
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), BUTTON_NEW_GROUP);
|
||||
}
|
||||
@Override
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_BUTTON_NEW_GROUP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContainerSubTitle()
|
||||
{
|
||||
String subtitle = null;
|
||||
|
||||
if (properties.getActionGroup() != null)
|
||||
{
|
||||
subtitle = properties.getActionGroupName();
|
||||
}
|
||||
else
|
||||
{
|
||||
subtitle = properties.getGroupName();
|
||||
}
|
||||
|
||||
return subtitle;
|
||||
}
|
||||
|
||||
public void validateGroupName(FacesContext context, UIComponent component, Object value) throws ValidatorException
|
||||
{
|
||||
String name = (String) value;
|
||||
|
||||
if (name.indexOf('\'') != -1 || name.indexOf('"') != -1 || name.indexOf('\\') != -1)
|
||||
{
|
||||
String err = MessageFormat.format(Application.getMessage(context, "groups_err_group_name"),
|
||||
new Object[] { "', \", \\" });
|
||||
throw new ValidatorException(new FacesMessage(err));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user