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:
@@ -414,8 +414,8 @@
|
|||||||
description-id="change_password_description" error-message-id="error_wizard" />
|
description-id="change_password_description" error-message-id="error_wizard" />
|
||||||
|
|
||||||
<dialog name="itemDetails" page="/jsp/trashcan/item-details.jsp" managed-bean="TrashcanItemDetailsDialog"
|
<dialog name="itemDetails" page="/jsp/trashcan/item-details.jsp" managed-bean="TrashcanItemDetailsDialog"
|
||||||
icon="/images/icons/details_large.gif" title-id="details_of"
|
icon="/images/icons/details_large.gif" description-id="deleteditem_details_description"
|
||||||
description-id="original_location" show-ok-button="false" />
|
show-ok-button="false" />
|
||||||
|
|
||||||
<dialog name="recoverItem" page="/jsp/trashcan/recover-item.jsp" managed-bean="TrashcanRecoverItemDialog"
|
<dialog name="recoverItem" page="/jsp/trashcan/recover-item.jsp" managed-bean="TrashcanRecoverItemDialog"
|
||||||
icon="/images/icons/recover_large.gif" title-id="recover_item"
|
icon="/images/icons/recover_large.gif" title-id="recover_item"
|
||||||
@@ -438,8 +438,7 @@
|
|||||||
description-id="recovery_report_info" show-ok-button="false" />
|
description-id="recovery_report_info" show-ok-button="false" />
|
||||||
|
|
||||||
<dialog name="showSystemInfo" page="/jsp/dialog/system-info.jsp" managed-bean="ShowSystemInfoDialog"
|
<dialog name="showSystemInfo" page="/jsp/dialog/system-info.jsp" managed-bean="ShowSystemInfoDialog"
|
||||||
icon="/images/icons/file_large.gif" title-id="system_info"
|
icon="/images/icons/file_large.gif" title-id="system_info" show-ok-button="false"/>
|
||||||
description-id="current_user" show-ok-button="false"/>
|
|
||||||
</dialogs>
|
</dialogs>
|
||||||
</config>
|
</config>
|
||||||
|
|
||||||
|
@@ -29,40 +29,54 @@ import javax.faces.context.FacesContext;
|
|||||||
import org.alfresco.web.app.Application;
|
import org.alfresco.web.app.Application;
|
||||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation for the SystemInfo dialog.
|
||||||
|
*
|
||||||
|
* @author gavinc
|
||||||
|
*/
|
||||||
public class ShowSystemInfoDialog extends BaseDialogBean
|
public class ShowSystemInfoDialog extends BaseDialogBean
|
||||||
{
|
{
|
||||||
private final static String MSG_CURRENT_USER = "current_user";
|
private static final String MSG_CURRENT_USER = "current_user";
|
||||||
private static final String LBL_CLOSE = "close";
|
private static final String MSG_CLOSE = "close";
|
||||||
|
private static final String MSG_VERSION = "version";
|
||||||
|
|
||||||
private NavigationBean navigationBean;
|
protected AboutBean aboutBean;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NavigationBean getNavigationBean()
|
public void setAboutBean(AboutBean aboutBean)
|
||||||
{
|
{
|
||||||
return navigationBean;
|
this.aboutBean = aboutBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNavigationBean(NavigationBean navigationBean)
|
@Override
|
||||||
{
|
public String getContainerSubTitle()
|
||||||
this.navigationBean = navigationBean;
|
{
|
||||||
}
|
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CURRENT_USER) + ": " +
|
||||||
|
this.navigator.getCurrentUser().getUserName();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getContainerDescription()
|
public String getContainerDescription()
|
||||||
{
|
{
|
||||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CURRENT_USER) + " '" + navigationBean.getCurrentUser().getUserName() + "'";
|
StringBuilder builder = new StringBuilder(Application.getMessage(
|
||||||
}
|
FacesContext.getCurrentInstance(), MSG_VERSION));
|
||||||
|
builder.append(": ");
|
||||||
|
builder.append(this.aboutBean.getEdition());
|
||||||
|
builder.append(" - v");
|
||||||
|
builder.append(this.aboutBean.getVersion());
|
||||||
|
|
||||||
@Override
|
return builder.toString();
|
||||||
public String getCancelButtonLabel()
|
}
|
||||||
{
|
|
||||||
|
|
||||||
return Application.getMessage(FacesContext.getCurrentInstance(), LBL_CLOSE);
|
@Override
|
||||||
}
|
public String getCancelButtonLabel()
|
||||||
|
{
|
||||||
|
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -33,43 +33,40 @@ import org.alfresco.web.bean.repository.Node;
|
|||||||
|
|
||||||
public class TrashcanItemDetailsDialog extends TrashcanDialog
|
public class TrashcanItemDetailsDialog extends TrashcanDialog
|
||||||
{
|
{
|
||||||
private static final String MSG_DETAILS_OF = "details_of";
|
private static final String MSG_DETAILS_OF = "details_of";
|
||||||
private static final String MSG_ORIGINAL_LOCATION = "original_location";
|
private static final String MSG_ORIGINAL_LOCATION = "original_location";
|
||||||
private static final String MSG_DELETEDITEM_DETAILS_DESCR = "deleteditem_details_description";
|
private static final String MSG_CLOSE = "close";
|
||||||
|
|
||||||
private static final String MSG_CLOSE = "close";
|
@Override
|
||||||
|
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
public String getContainerTitle()
|
||||||
{
|
{
|
||||||
return null;
|
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_DETAILS_OF) + " '" +
|
||||||
|
property.getItem().getName() + "'";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
public String getContainerSubTitle()
|
||||||
|
{
|
||||||
|
Path path = (Path) property.getItem().getProperties().get("locationPath");
|
||||||
|
|
||||||
@Override
|
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_ORIGINAL_LOCATION) + ": " +
|
||||||
public String getContainerDescription()
|
path.toDisplayPath(nodeService);
|
||||||
{
|
}
|
||||||
Path path = (Path) property.getItem().getProperties().get("locationPath");
|
|
||||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_ORIGINAL_LOCATION) + ": " + path.toDisplayPath(nodeService) + "\n"
|
|
||||||
+ Application.getMessage(FacesContext.getCurrentInstance(), MSG_DELETEDITEM_DETAILS_DESCR);
|
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
public String getCancelButtonLabel()
|
||||||
@Override
|
{
|
||||||
public String getContainerTitle()
|
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE);
|
||||||
{
|
}
|
||||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_DETAILS_OF) + " '" + property.getItem().getName() + "'";
|
|
||||||
}
|
|
||||||
|
|
||||||
public Node getItem()
|
|
||||||
{
|
|
||||||
return property.getItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCancelButtonLabel()
|
|
||||||
{
|
|
||||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public Node getItem()
|
||||||
|
{
|
||||||
|
return property.getItem();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -53,199 +53,214 @@ import org.alfresco.web.ui.common.Utils;
|
|||||||
import org.alfresco.web.ui.common.component.UIGenericPicker;
|
import org.alfresco.web.ui.common.component.UIGenericPicker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Implementation of the add user dialog.
|
||||||
|
*
|
||||||
* @author YanO
|
* @author YanO
|
||||||
*/
|
* @author gavinc
|
||||||
/**
|
|
||||||
* @author Administrator
|
|
||||||
*/
|
*/
|
||||||
public class AddUsersDialog extends GroupsDialog
|
public class AddUsersDialog extends GroupsDialog
|
||||||
{
|
{
|
||||||
private static final String BUTTON_FINISH = "finish_button";
|
private static final String BUTTON_FINISH = "finish_button";
|
||||||
|
|
||||||
/** selected users to be added to a group */
|
/** selected users to be added to a group */
|
||||||
private List<UserAuthorityDetails> usersForGroup;
|
private List<UserAuthorityDetails> usersForGroup;
|
||||||
|
|
||||||
/** datamodel for table of users added to group */
|
/** datamodel for table of users added to group */
|
||||||
private DataModel usersDataModel = null;
|
private DataModel usersDataModel = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Map<String, String> parameters)
|
public void init(Map<String, String> parameters)
|
||||||
{
|
{
|
||||||
super.init(parameters);
|
super.init(parameters);
|
||||||
usersForGroup = new ArrayList<UserAuthorityDetails>();
|
usersForGroup = new ArrayList<UserAuthorityDetails>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// add each selected user to the current group in turn
|
// add each selected user to the current group in turn
|
||||||
for (UserAuthorityDetails wrapper : this.usersForGroup)
|
for (UserAuthorityDetails wrapper : this.usersForGroup)
|
||||||
|
{
|
||||||
|
properties.getAuthService().addAuthority(properties.getActionGroup(), wrapper.getAuthority());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Throwable err)
|
||||||
|
{
|
||||||
|
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
||||||
|
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||||
|
outcome = null;
|
||||||
|
}
|
||||||
|
setActionGroup(null);
|
||||||
|
return outcome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getContainerSubTitle()
|
||||||
|
{
|
||||||
|
return properties.getActionGroupName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getFinishButtonDisabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFinishButtonLabel()
|
||||||
|
{
|
||||||
|
return Application.getMessage(FacesContext.getCurrentInstance(), BUTTON_FINISH);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query callback method executed by the Generic Picker component. This
|
||||||
|
* method is part of the contract to the Generic Picker, it is up to the
|
||||||
|
* backing bean to execute whatever query is appropriate and return the
|
||||||
|
* results.
|
||||||
|
*
|
||||||
|
* @param filterIndex Index of the filter drop-down selection
|
||||||
|
* @param contains Text from the contains textbox
|
||||||
|
* @return An array of SelectItem objects containing the results to display
|
||||||
|
* in the picker.
|
||||||
|
*/
|
||||||
|
public SelectItem[] pickerCallback(int filterIndex, final String contains)
|
||||||
|
{
|
||||||
|
final FacesContext context = FacesContext.getCurrentInstance();
|
||||||
|
|
||||||
|
UserTransaction tx = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
RetryingTransactionHelper txHelper = Repository.getRetryingTransactionHelper(context);// getUserTransaction(context);
|
||||||
|
return txHelper.doInTransaction(new RetryingTransactionCallback<SelectItem[]>()
|
||||||
|
{
|
||||||
|
public SelectItem[] execute() throws Exception
|
||||||
{
|
{
|
||||||
properties.getAuthService().addAuthority(properties.getActionGroup(), wrapper.getAuthority());
|
SelectItem[] items;
|
||||||
|
|
||||||
|
// build xpath to match available User/Person objects
|
||||||
|
ServiceRegistry services = Repository.getServiceRegistry(context);
|
||||||
|
NodeRef peopleRef = properties.getPersonService().getPeopleContainer();
|
||||||
|
String xpath = "*[like(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + "firstName, '%" + contains +
|
||||||
|
"%', false)" + " or " + "like(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" +
|
||||||
|
"lastName, '%" + contains + "%', false)]";
|
||||||
|
|
||||||
|
List<NodeRef> nodes = services.getSearchService().selectNodes(peopleRef, xpath, null,
|
||||||
|
services.getNamespaceService(), false);
|
||||||
|
|
||||||
|
ArrayList<SelectItem> itemList = new ArrayList<SelectItem>(nodes.size());
|
||||||
|
for (NodeRef personRef : nodes)
|
||||||
|
{
|
||||||
|
String username = (String) nodeService.getProperty(personRef, ContentModel.PROP_USERNAME);
|
||||||
|
if (PermissionService.GUEST_AUTHORITY.equals(username) == false)
|
||||||
|
{
|
||||||
|
String firstName = (String) nodeService.getProperty(personRef, ContentModel.PROP_FIRSTNAME);
|
||||||
|
String lastName = (String) nodeService.getProperty(personRef, ContentModel.PROP_LASTNAME);
|
||||||
|
|
||||||
|
SelectItem item = new SortableSelectItem(username, firstName + " " + lastName, lastName);
|
||||||
|
itemList.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
items = new SelectItem[itemList.size()];
|
||||||
|
itemList.toArray(items);
|
||||||
|
return items;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
catch (Throwable err)
|
}
|
||||||
{
|
catch (Exception err)
|
||||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
|
{
|
||||||
outcome = null;
|
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
||||||
}
|
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||||
setActionGroup(null);
|
try
|
||||||
return outcome;
|
{
|
||||||
}
|
if (tx != null)
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getFinishButtonDisabled()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Query callback method executed by the Generic Picker component. This method is part of the contract to the Generic Picker, it is up to the backing bean to execute whatever
|
|
||||||
* query is appropriate and return the results.
|
|
||||||
*
|
|
||||||
* @param filterIndex Index of the filter drop-down selection
|
|
||||||
* @param contains Text from the contains textbox
|
|
||||||
* @return An array of SelectItem objects containing the results to display in the picker.
|
|
||||||
*/
|
|
||||||
public SelectItem[] pickerCallback(int filterIndex, final String contains)
|
|
||||||
{
|
|
||||||
final FacesContext context = FacesContext.getCurrentInstance();
|
|
||||||
|
|
||||||
UserTransaction tx = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
RetryingTransactionHelper txHelper = Repository.getRetryingTransactionHelper(context);// getUserTransaction(context);
|
|
||||||
return txHelper.doInTransaction(new RetryingTransactionCallback<SelectItem[]>()
|
|
||||||
{
|
{
|
||||||
public SelectItem[] execute() throws Exception
|
tx.rollback();
|
||||||
{
|
|
||||||
SelectItem[] items;
|
|
||||||
|
|
||||||
// build xpath to match available User/Person objects
|
|
||||||
ServiceRegistry services = Repository.getServiceRegistry(context);
|
|
||||||
NodeRef peopleRef = properties.getPersonService().getPeopleContainer();
|
|
||||||
String xpath = "*[like(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + "firstName, '%" + contains + "%', false)" + " or " + "like(@"
|
|
||||||
+ NamespaceService.CONTENT_MODEL_PREFIX + ":" + "lastName, '%" + contains + "%', false)]";
|
|
||||||
|
|
||||||
List<NodeRef> nodes = services.getSearchService().selectNodes(peopleRef, xpath, null, services.getNamespaceService(), false);
|
|
||||||
|
|
||||||
ArrayList<SelectItem> itemList = new ArrayList<SelectItem>(nodes.size());
|
|
||||||
for (NodeRef personRef : nodes)
|
|
||||||
{
|
|
||||||
String username = (String) nodeService.getProperty(personRef, ContentModel.PROP_USERNAME);
|
|
||||||
if (PermissionService.GUEST_AUTHORITY.equals(username) == false)
|
|
||||||
{
|
|
||||||
String firstName = (String) nodeService.getProperty(personRef, ContentModel.PROP_FIRSTNAME);
|
|
||||||
String lastName = (String) nodeService.getProperty(personRef, ContentModel.PROP_LASTNAME);
|
|
||||||
|
|
||||||
SelectItem item = new SortableSelectItem(username, firstName + " " + lastName, lastName);
|
|
||||||
itemList.add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
items = new SelectItem[itemList.size()];
|
|
||||||
itemList.toArray(items);
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (Exception err)
|
|
||||||
{
|
|
||||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (tx != null)
|
|
||||||
{
|
|
||||||
tx.rollback();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception tex)
|
}
|
||||||
|
catch (Exception tex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return new SelectItem[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the selected User to the list for adding to a Group
|
||||||
|
*/
|
||||||
|
public void addSelectedUsers(ActionEvent event)
|
||||||
|
{
|
||||||
|
UIGenericPicker picker = (UIGenericPicker) event.getComponent().findComponent("picker");
|
||||||
|
String[] results = picker.getSelectedResults();
|
||||||
|
if (results != null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < results.length; i++)
|
||||||
|
{
|
||||||
|
String authority = results[i];
|
||||||
|
|
||||||
|
// check for same authority so not added twice
|
||||||
|
boolean foundExisting = false;
|
||||||
|
for (int n = 0; n < this.usersForGroup.size(); n++)
|
||||||
{
|
{
|
||||||
|
UserAuthorityDetails wrapper = this.usersForGroup.get(n);
|
||||||
|
if (authority.equals(wrapper.getAuthority()))
|
||||||
|
{
|
||||||
|
foundExisting = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return new SelectItem[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
if (foundExisting == false)
|
||||||
* Add the selected User to the list for adding to a Group
|
|
||||||
*/
|
|
||||||
public void addSelectedUsers(ActionEvent event)
|
|
||||||
{
|
|
||||||
UIGenericPicker picker = (UIGenericPicker) event.getComponent().findComponent("picker");
|
|
||||||
String[] results = picker.getSelectedResults();
|
|
||||||
if (results != null)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < results.length; i++)
|
|
||||||
{
|
{
|
||||||
String authority = results[i];
|
StringBuilder label = new StringBuilder(48);
|
||||||
|
|
||||||
// check for same authority so not added twice
|
// build a display label showing the user person name
|
||||||
boolean foundExisting = false;
|
if (properties.getPersonService().personExists(authority) == true)
|
||||||
for (int n = 0; n < this.usersForGroup.size(); n++)
|
{
|
||||||
{
|
// found a Person with a User authority
|
||||||
UserAuthorityDetails wrapper = this.usersForGroup.get(n);
|
NodeRef ref = properties.getPersonService().getPerson(authority);
|
||||||
if (authority.equals(wrapper.getAuthority()))
|
String firstName = (String) this.nodeService.getProperty(ref, ContentModel.PROP_FIRSTNAME);
|
||||||
{
|
String lastName = (String) this.nodeService.getProperty(ref, ContentModel.PROP_LASTNAME);
|
||||||
foundExisting = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (foundExisting == false)
|
// build a sensible label for display
|
||||||
{
|
label.append(firstName).append(' ').append(lastName);
|
||||||
StringBuilder label = new StringBuilder(48);
|
|
||||||
|
|
||||||
// build a display label showing the user person name
|
// add a wrapper object with the details to the results list
|
||||||
if (properties.getPersonService().personExists(authority) == true)
|
// for display
|
||||||
{
|
UserAuthorityDetails userDetails = new UserAuthorityDetails(label.toString(), authority);
|
||||||
// found a Person with a User authority
|
this.usersForGroup.add(userDetails);
|
||||||
NodeRef ref = properties.getPersonService().getPerson(authority);
|
}
|
||||||
String firstName = (String) this.nodeService.getProperty(ref, ContentModel.PROP_FIRSTNAME);
|
|
||||||
String lastName = (String) this.nodeService.getProperty(ref, ContentModel.PROP_LASTNAME);
|
|
||||||
|
|
||||||
// build a sensible label for display
|
|
||||||
label.append(firstName).append(' ').append(lastName);
|
|
||||||
|
|
||||||
// add a wrapper object with the details to the results list for display
|
|
||||||
UserAuthorityDetails userDetails = new UserAuthorityDetails(label.toString(), authority);
|
|
||||||
this.usersForGroup.add(userDetails);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action handler called when the Remove button is pressed to remove a user from the results list
|
* Action handler called when the Remove button is pressed to remove a user
|
||||||
*/
|
* from the results list
|
||||||
public void removeUserSelection(ActionEvent event)
|
*/
|
||||||
{
|
public void removeUserSelection(ActionEvent event)
|
||||||
UserAuthorityDetails wrapper = (UserAuthorityDetails) this.usersDataModel.getRowData();
|
{
|
||||||
if (wrapper != null)
|
UserAuthorityDetails wrapper = (UserAuthorityDetails) this.usersDataModel.getRowData();
|
||||||
{
|
if (wrapper != null)
|
||||||
this.usersForGroup.remove(wrapper);
|
{
|
||||||
}
|
this.usersForGroup.remove(wrapper);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the usersDataModel.
|
* @return Returns the usersDataModel.
|
||||||
*/
|
*/
|
||||||
public DataModel getUsersDataModel()
|
public DataModel getUsersDataModel()
|
||||||
{
|
{
|
||||||
if (this.usersDataModel == null)
|
if (this.usersDataModel == null)
|
||||||
{
|
{
|
||||||
this.usersDataModel = new ListDataModel();
|
this.usersDataModel = new ListDataModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.usersDataModel.setWrappedData(this.usersForGroup);
|
this.usersDataModel.setWrappedData(this.usersForGroup);
|
||||||
|
|
||||||
return this.usersDataModel;
|
return this.usersDataModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFinishButtonLabel()
|
|
||||||
{
|
|
||||||
return Application.getMessage(FacesContext.getCurrentInstance(), BUTTON_FINISH);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -41,62 +41,81 @@ import org.alfresco.web.ui.common.Utils;
|
|||||||
|
|
||||||
public class CreateGroupDialog extends GroupsDialog
|
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
|
@Override
|
||||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// create new Group using Authentication Service
|
// create new Group using Authentication Service
|
||||||
String groupName = properties.getAuthService().getName(AuthorityType.GROUP, properties.getName());
|
String groupName = properties.getAuthService().getName(AuthorityType.GROUP, properties.getName());
|
||||||
if (properties.getAuthService().authorityExists(groupName) == false)
|
if (properties.getAuthService().authorityExists(groupName) == false)
|
||||||
{
|
{
|
||||||
properties.getAuthService().createAuthority(AuthorityType.GROUP, properties.getActionGroup(), properties.getName());
|
properties.getAuthService().createAuthority(AuthorityType.GROUP, properties.getActionGroup(), properties.getName());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Utils.addErrorMessage(Application.getMessage(context, MSG_ERR_EXISTS));
|
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);
|
|
||||||
outcome = null;
|
outcome = null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Throwable err)
|
||||||
|
{
|
||||||
|
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
||||||
|
context, Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||||
|
outcome = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (outcome == null)
|
if (outcome == null)
|
||||||
{
|
{
|
||||||
isFinished = false;
|
isFinished = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return outcome;
|
return outcome;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Map<String, String> parameters)
|
public String getFinishButtonLabel()
|
||||||
{
|
{
|
||||||
super.init(parameters);
|
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_BUTTON_NEW_GROUP);
|
||||||
properties.setName("");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void validateGroupName(FacesContext context, UIComponent component, Object value) throws ValidatorException
|
@Override
|
||||||
{
|
public String getContainerSubTitle()
|
||||||
String name = (String) value;
|
{
|
||||||
if (name.indexOf('\'') != -1 || name.indexOf('"') != -1 || name.indexOf('\\') != -1)
|
String subtitle = null;
|
||||||
{
|
|
||||||
String err = MessageFormat.format(Application.getMessage(context, "groups_err_group_name"), new Object[] { "', \", \\" });
|
|
||||||
throw new ValidatorException(new FacesMessage(err));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
if (properties.getActionGroup() != null)
|
||||||
public String getFinishButtonLabel()
|
{
|
||||||
{
|
subtitle = properties.getActionGroupName();
|
||||||
return Application.getMessage(FacesContext.getCurrentInstance(), BUTTON_NEW_GROUP);
|
}
|
||||||
}
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -4999,9 +4999,13 @@
|
|||||||
</managed-bean-class>
|
</managed-bean-class>
|
||||||
<managed-bean-scope>session</managed-bean-scope>
|
<managed-bean-scope>session</managed-bean-scope>
|
||||||
<managed-property>
|
<managed-property>
|
||||||
<property-name>navigationBean</property-name>
|
<property-name>navigator</property-name>
|
||||||
<value>#{NavigationBean}</value>
|
<value>#{NavigationBean}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>aboutBean</property-name>
|
||||||
|
<value>#{AboutBean}</value>
|
||||||
|
</managed-property>
|
||||||
</managed-bean>
|
</managed-bean>
|
||||||
|
|
||||||
</faces-config>
|
</faces-config>
|
||||||
|
Reference in New Issue
Block a user