- Neue Klasse für UserAdministrationTab
- Weitere ApplicationManager git-svn-id: https://svn.libreccm.org/ccm/trunk@2248 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
5ad27e91a7
commit
a7bd1acb14
|
|
@ -0,0 +1 @@
|
||||||
|
com.arsdigita.bookmarks.BookmarksAppManager
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.bookmarks;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.BoxPanel;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.Link;
|
||||||
|
import com.arsdigita.bebop.event.PrintEvent;
|
||||||
|
import com.arsdigita.bebop.event.PrintListener;
|
||||||
|
import com.arsdigita.bookmarks.util.GlobalizationUtil;
|
||||||
|
import com.arsdigita.ui.admin.applications.AbstractApplicationManager;
|
||||||
|
import com.arsdigita.ui.admin.applications.ApplicationInstanceAwareContainer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class BookmarksAppManager extends AbstractApplicationManager<Bookmarks> {
|
||||||
|
|
||||||
|
public Class<Bookmarks> getApplication() {
|
||||||
|
return Bookmarks.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationInstanceAwareContainer getApplicationAdminForm() {
|
||||||
|
return new ApplicationAdminForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ApplicationAdminForm extends ApplicationInstanceAwareContainer {
|
||||||
|
|
||||||
|
public ApplicationAdminForm() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
final BoxPanel panel = new BoxPanel();
|
||||||
|
panel.add(new Label(GlobalizationUtil.globalize("bookmarks.ui.not_yet_included_into_app_tab")));
|
||||||
|
final Link link = new Link(new PrintListener() {
|
||||||
|
public void prepare(final PrintEvent event) {
|
||||||
|
final Link link = (Link) event.getTarget();
|
||||||
|
|
||||||
|
final String path = String.format("%s/admin", getAppInstance().getPath());
|
||||||
|
final String label = String.format("/ccm%s", path);
|
||||||
|
|
||||||
|
link.setTarget(path);
|
||||||
|
link.setChild(new Label(label));
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
panel.add(link);
|
||||||
|
|
||||||
|
add(panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -15,3 +15,4 @@ bookmarks.ui.modification_date=Modification Date
|
||||||
bookmarks.ui.creator=Creator
|
bookmarks.ui.creator=Creator
|
||||||
bookmarks.ui.are_you_sure_you_want_to_delete_this_bookmark=Are you sure you want to delete this Bookmark?
|
bookmarks.ui.are_you_sure_you_want_to_delete_this_bookmark=Are you sure you want to delete this Bookmark?
|
||||||
bookmarks.ui.bookmark_in_new_window=Open in a new window
|
bookmarks.ui.bookmark_in_new_window=Open in a new window
|
||||||
|
bookmarks.ui.not_yet_included_into_app_tab=The bookmarks application is not included yet into the applications tab. Use the link below
|
||||||
|
|
|
||||||
|
|
@ -15,3 +15,4 @@ bookmarks.ui.modification_date=\u00c4nderungsdatum
|
||||||
bookmarks.ui.creator=Ersteller
|
bookmarks.ui.creator=Ersteller
|
||||||
bookmarks.ui.are_you_sure_you_want_to_delete_this_bookmark=Soll dieses Lesezeichen tats\u00e4chlich gel\u00f6scht werden?
|
bookmarks.ui.are_you_sure_you_want_to_delete_this_bookmark=Soll dieses Lesezeichen tats\u00e4chlich gel\u00f6scht werden?
|
||||||
bookmarks.ui.bookmark_in_new_window=In einen neuen Fenster \u00f6ffnen
|
bookmarks.ui.bookmark_in_new_window=In einen neuen Fenster \u00f6ffnen
|
||||||
|
bookmarks.ui.not_yet_included_into_app_tab=Die Bookmarks-Anwendung ist noch nicht in den Applications-Tab integriert. Nutzen Sie statt dessen den folgenden Link:
|
||||||
|
|
|
||||||
|
|
@ -15,3 +15,4 @@ bookmarks.ui.modification_date=Modification Date
|
||||||
bookmarks.ui.creator=Creator
|
bookmarks.ui.creator=Creator
|
||||||
bookmarks.ui.are_you_sure_you_want_to_delete_this_bookmark=Are you sure you want to delete this Bookmark?
|
bookmarks.ui.are_you_sure_you_want_to_delete_this_bookmark=Are you sure you want to delete this Bookmark?
|
||||||
bookmarks.ui.bookmark_in_new_window=Open in a new window
|
bookmarks.ui.bookmark_in_new_window=Open in a new window
|
||||||
|
bookmarks.ui.not_yet_included_into_app_tab=
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
com.arsdigita.ui.admin.AdminAppManager
|
com.arsdigita.ui.admin.AdminAppManager
|
||||||
com.arsdigita.ui.login.LoginAppManager
|
com.arsdigita.ui.login.LoginAppManager
|
||||||
|
com.arsdigita.ui.permissions.PermissionsAppManager
|
||||||
|
|
@ -74,8 +74,8 @@ interface AdminConstants {
|
||||||
BUNDLE_NAME);
|
BUNDLE_NAME);
|
||||||
|
|
||||||
/** Tabbed pane indices */
|
/** Tabbed pane indices */
|
||||||
int USER_TAB_INDEX = 0;
|
int USER_TAB_INDEX = 2;
|
||||||
int GROUP_TAB_INDEX = 1;
|
int GROUP_TAB_INDEX = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User tab name
|
* User tab name
|
||||||
|
|
|
||||||
|
|
@ -157,15 +157,15 @@ public class AdminServlet extends BaseApplicationServlet implements AdminConstan
|
||||||
* Create User split panel.
|
* Create User split panel.
|
||||||
* Note: Will change soon.
|
* Note: Will change soon.
|
||||||
*/
|
*/
|
||||||
final AdminSplitPanel userSplitPanel = new AdminSplitPanel(USER_NAVBAR_TITLE);
|
//final AdminSplitPanel userSplitPanel = new AdminSplitPanel(USER_NAVBAR_TITLE);
|
||||||
|
|
||||||
final UserBrowsePane browsePane = new UserBrowsePane();
|
// final UserBrowsePane browsePane = new UserBrowsePane();
|
||||||
userSplitPanel.addTab(USER_TAB_SUMMARY, new UserSummaryPane(userSplitPanel, browsePane));
|
// userSplitPanel.addTab(USER_TAB_SUMMARY, new UserSummaryPane(userSplitPanel, browsePane));
|
||||||
userSplitPanel.addTab(USER_TAB_BROWSE, browsePane);
|
// userSplitPanel.addTab(USER_TAB_BROWSE, browsePane);
|
||||||
userSplitPanel.addTab(USER_TAB_SEARCH, new UserSearchPane(userSplitPanel, browsePane));
|
// userSplitPanel.addTab(USER_TAB_SEARCH, new UserSearchPane(userSplitPanel, browsePane));
|
||||||
userSplitPanel.addTab(USER_TAB_CREATE_USER, new CreateUserPane(userSplitPanel));
|
// userSplitPanel.addTab(USER_TAB_CREATE_USER, new CreateUserPane(userSplitPanel));
|
||||||
|
|
||||||
// Create the Admin's page tab bar, currently 2 elements: user & groups
|
// Create the Admin's page tab bar
|
||||||
final TabbedPane tabbedPane = new TabbedPane();
|
final TabbedPane tabbedPane = new TabbedPane();
|
||||||
tabbedPane.setIdAttr("page-body");
|
tabbedPane.setIdAttr("page-body");
|
||||||
|
|
||||||
|
|
@ -178,17 +178,15 @@ public class AdminServlet extends BaseApplicationServlet implements AdminConstan
|
||||||
*/
|
*/
|
||||||
tabbedPane.addTab(APPLICATIONS_TAB_TITLE, new ApplicationsAdministrationTab());
|
tabbedPane.addTab(APPLICATIONS_TAB_TITLE, new ApplicationsAdministrationTab());
|
||||||
/*
|
/*
|
||||||
* Add user panel.
|
* Create and add the user and group tabs.
|
||||||
*/
|
|
||||||
tabbedPane.addTab(USER_TAB_TITLE, userSplitPanel);
|
|
||||||
/*
|
|
||||||
* Create and add group administration panel
|
|
||||||
*/
|
*/
|
||||||
|
//tabbedPane.addTab(USER_TAB_TITLE, userSplitPanel);
|
||||||
final GroupAdministrationTab groupAdminTab = new GroupAdministrationTab();
|
final GroupAdministrationTab groupAdminTab = new GroupAdministrationTab();
|
||||||
|
tabbedPane.addTab(USER_TAB_TITLE, new UserAdministrationTab(tabbedPane, groupAdminTab));
|
||||||
tabbedPane.addTab(GROUP_TAB_TITLE, groupAdminTab);
|
tabbedPane.addTab(GROUP_TAB_TITLE, groupAdminTab);
|
||||||
|
|
||||||
browsePane.setTabbedPane(tabbedPane);
|
// browsePane.setTabbedPane(tabbedPane);
|
||||||
browsePane.setGroupAdministrationTab(groupAdminTab);
|
// browsePane.setGroupAdministrationTab(groupAdminTab);
|
||||||
|
|
||||||
page.add(tabbedPane);
|
page.add(tabbedPane);
|
||||||
page.lock();
|
page.lock();
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@ import java.util.ArrayList;
|
||||||
*
|
*
|
||||||
* @author David Dao
|
* @author David Dao
|
||||||
* @version $Id: AdminSplitPanel.java 287 2005-02-22 00:29:02Z sskracic $
|
* @version $Id: AdminSplitPanel.java 287 2005-02-22 00:29:02Z sskracic $
|
||||||
|
* @deprecated Was only used for the User Administration Tab in {@link AdminServlet} which is now implmented as its own
|
||||||
|
* class. Will be removed soon.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AdminSplitPanel extends BoxPanel implements ChangeListener {
|
class AdminSplitPanel extends BoxPanel implements ChangeListener {
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import com.arsdigita.bebop.SegmentedPanel;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author David Dao
|
* @author David Dao
|
||||||
|
* @deprecated Replaced by {@link UserCreateSection}. Will be removed soon.
|
||||||
*/
|
*/
|
||||||
class CreateUserPane extends SegmentedPanel
|
class CreateUserPane extends SegmentedPanel
|
||||||
implements AdminConstants,
|
implements AdminConstants,
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.ui.admin;
|
package com.arsdigita.ui.admin;
|
||||||
|
|
||||||
import com.arsdigita.ui.util.GlobalizationUtil;
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.ActionLink;
|
import com.arsdigita.bebop.ActionLink;
|
||||||
import com.arsdigita.bebop.BoxPanel;
|
import com.arsdigita.bebop.BoxPanel;
|
||||||
import com.arsdigita.bebop.Component;
|
import com.arsdigita.bebop.Component;
|
||||||
|
|
@ -45,6 +43,7 @@ import com.arsdigita.kernel.Group;
|
||||||
import com.arsdigita.kernel.GroupCollection;
|
import com.arsdigita.kernel.GroupCollection;
|
||||||
import com.arsdigita.kernel.User;
|
import com.arsdigita.kernel.User;
|
||||||
import com.arsdigita.persistence.PersistenceException;
|
import com.arsdigita.persistence.PersistenceException;
|
||||||
|
import com.arsdigita.toolbox.ui.LayoutPanel;
|
||||||
import com.arsdigita.util.LockableImpl;
|
import com.arsdigita.util.LockableImpl;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -56,67 +55,65 @@ import org.apache.log4j.Logger;
|
||||||
* @author David Dao
|
* @author David Dao
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class GroupAdministrationTab extends BoxPanel
|
class GroupAdministrationTab extends BoxPanel implements AdminConstants, ChangeListener {
|
||||||
implements AdminConstants,
|
|
||||||
ChangeListener {
|
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(GroupAdministrationTab.class);
|
private static final Logger LOGGER = Logger.getLogger(GroupAdministrationTab.class);
|
||||||
private Tree m_tree;
|
private final Tree groupTree;
|
||||||
private SearchAndList m_subMemberSearch;
|
private SearchAndList subMemberSearch;
|
||||||
private ActionLink m_addSubmemberLink;
|
private ActionLink addSubmemberLink;
|
||||||
private Component m_groupInfoPanel;
|
private final Component groupInfoPanel;
|
||||||
private Component m_subGroupPanel;
|
private final Component subGroupPanel;
|
||||||
private Component m_subMemberPanel;
|
private final Component subMemberPanel;
|
||||||
private Component m_extremeActionPanel;
|
private final Component extremeActionPanel;
|
||||||
private Component m_groupAddPanel;
|
private final Component groupAddPanel;
|
||||||
private Component m_groupEditPanel;
|
private final Component groupEditPanel;
|
||||||
private Component m_groupDeleteFailedPanel;
|
private final Component groupDeleteFailedPanel;
|
||||||
private Component m_existingGroupAddPanel;
|
private final Component existingGroupAddPanel;
|
||||||
private ExistingGroupAddPane m_existingGroupAdd;
|
private ExistingGroupAddPane m_existingGroupAdd;
|
||||||
private ArrayList m_panelList = new ArrayList();
|
private final java.util.List<Component> panelList = new ArrayList<Component>();
|
||||||
private RequestLocal m_group;
|
private final RequestLocal requestLocalGroup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param p
|
* @param page
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void register(Page p) {
|
public void register(final Page page) {
|
||||||
for (int i = 0; i < m_panelList.size(); i++) {
|
for (int i = 0; i < panelList.size(); i++) {
|
||||||
p.setVisibleDefault((Component) m_panelList.get(i), false);
|
page.setVisibleDefault((Component) panelList.get(i), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
p.setVisibleDefault(m_groupAddPanel, true);
|
page.setVisibleDefault(groupAddPanel, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param ps
|
* @param state
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Group getGroup(PageState ps) {
|
public Group getGroup(final PageState state) {
|
||||||
return (Group) m_group.get(ps);
|
return (Group) requestLocalGroup.get(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGroup(PageState ps, Group group) {
|
public void setGroup(final PageState state, final Group group) {
|
||||||
String id = group.getID().toString();
|
final String groupId = group.getID().toString();
|
||||||
m_group.set(ps, group);
|
requestLocalGroup.set(state, group);
|
||||||
m_tree.setSelectedKey(ps, id);
|
groupTree.setSelectedKey(state, groupId);
|
||||||
|
|
||||||
if (!id.equals("-1")) {
|
if (!"-1".equals(groupId)) {
|
||||||
expandGroups(ps, group);
|
expandGroups(state, group);
|
||||||
m_tree.expand("-1", ps);
|
groupTree.expand("-1", state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void expandGroups(PageState ps, Group group) {
|
private void expandGroups(final PageState state, final Group group) {
|
||||||
m_tree.expand(group.getID().toString(), ps);
|
groupTree.expand(group.getID().toString(), state);
|
||||||
|
|
||||||
GroupCollection superGroups = group.getSupergroups();
|
final GroupCollection superGroups = group.getSupergroups();
|
||||||
Group superGroup = null;
|
Group superGroup;
|
||||||
while (superGroups.next()) {
|
while (superGroups.next()) {
|
||||||
superGroup = (Group) superGroups.getDomainObject();
|
superGroup = (Group) superGroups.getDomainObject();
|
||||||
expandGroups(ps, superGroup);
|
expandGroups(state, superGroup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,104 +124,107 @@ class GroupAdministrationTab extends BoxPanel
|
||||||
setClassAttr("sidebarNavPanel");
|
setClassAttr("sidebarNavPanel");
|
||||||
setAttribute("navbar-title", "Groups");
|
setAttribute("navbar-title", "Groups");
|
||||||
|
|
||||||
m_group = new RequestLocal() {
|
requestLocalGroup = new RequestLocal() {
|
||||||
@Override
|
@Override
|
||||||
protected Object initialValue(PageState ps) {
|
protected Object initialValue(final PageState state) {
|
||||||
String key = (String) m_tree.getSelectedKey(ps);
|
String key = (String) groupTree.getSelectedKey(state);
|
||||||
|
|
||||||
Group group = null;
|
|
||||||
|
|
||||||
|
Group group;
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
BigDecimal id = new BigDecimal(key);
|
BigDecimal id = new BigDecimal(key);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
group = new Group(id);
|
group = new Group(id);
|
||||||
|
return group;
|
||||||
} catch (DataObjectNotFoundException exc) {
|
} catch (DataObjectNotFoundException exc) {
|
||||||
// Silently ignore if group does not
|
// Silently ignore if group does not
|
||||||
// exist.
|
// exist.
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return group;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BoxPanel c = new BoxPanel();
|
//BoxPanel panel = new BoxPanel(BoxPanel.HORIZONTAL);
|
||||||
c.setClassAttr("navbar");
|
final LayoutPanel panel = new LayoutPanel();
|
||||||
|
panel.setClassAttr("navbar");
|
||||||
|
|
||||||
//m_tree = new Tree(new GroupTreeModel());
|
//m_tree = new Tree(new GroupTreeModel());
|
||||||
m_tree = new Tree(new GroupTreeModelBuilder());
|
groupTree = new Tree(new GroupTreeModelBuilder());
|
||||||
m_tree.addChangeListener(this);
|
groupTree.addChangeListener(this);
|
||||||
c.add(m_tree);
|
//panel.add(m_tree);
|
||||||
|
panel.setLeft(groupTree);
|
||||||
|
|
||||||
add(c);
|
add(panel);
|
||||||
|
|
||||||
SegmentedPanel rightSide = new SegmentedPanel();
|
final SegmentedPanel rightSide = new SegmentedPanel();
|
||||||
rightSide.setClassAttr("main");
|
rightSide.setClassAttr("main");
|
||||||
|
|
||||||
m_groupInfoPanel = buildGroupInfoPanel(rightSide);
|
groupInfoPanel = buildGroupInfoPanel(rightSide);
|
||||||
m_panelList.add(m_groupInfoPanel);
|
panelList.add(groupInfoPanel);
|
||||||
|
|
||||||
m_groupEditPanel = buildGroupEditPanel(rightSide);
|
groupEditPanel = buildGroupEditPanel(rightSide);
|
||||||
m_panelList.add(m_groupEditPanel);
|
panelList.add(groupEditPanel);
|
||||||
|
|
||||||
m_subGroupPanel = buildSubGroupPanel(rightSide);
|
subGroupPanel = buildSubGroupPanel(rightSide);
|
||||||
m_panelList.add(m_subGroupPanel);
|
panelList.add(subGroupPanel);
|
||||||
|
|
||||||
m_groupAddPanel = buildGroupAddPanel(rightSide);
|
groupAddPanel = buildGroupAddPanel(rightSide);
|
||||||
m_panelList.add(m_groupAddPanel);
|
panelList.add(groupAddPanel);
|
||||||
|
|
||||||
m_existingGroupAddPanel = buildExistingGroupAddPanel(rightSide);
|
existingGroupAddPanel = buildExistingGroupAddPanel(rightSide);
|
||||||
m_panelList.add(m_existingGroupAddPanel);
|
panelList.add(existingGroupAddPanel);
|
||||||
|
|
||||||
m_subMemberPanel = buildMemberListPanel(rightSide);
|
subMemberPanel = buildMemberListPanel(rightSide);
|
||||||
m_panelList.add(m_subMemberPanel);
|
panelList.add(subMemberPanel);
|
||||||
|
|
||||||
m_extremeActionPanel = buildExtremeActionPanel(rightSide);
|
extremeActionPanel = buildExtremeActionPanel(rightSide);
|
||||||
m_panelList.add(m_extremeActionPanel);
|
panelList.add(extremeActionPanel);
|
||||||
|
|
||||||
m_groupDeleteFailedPanel = buildGroupDeleteFailedPanel(rightSide);
|
groupDeleteFailedPanel = buildGroupDeleteFailedPanel(rightSide);
|
||||||
m_panelList.add(m_groupDeleteFailedPanel);
|
panelList.add(groupDeleteFailedPanel);
|
||||||
|
|
||||||
add(rightSide);
|
//add(rightSide);
|
||||||
|
panel.setRight(rightSide);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayAddGroupPanel(PageState ps) {
|
public void displayAddGroupPanel(final PageState state) {
|
||||||
hideAll(ps);
|
hideAll(state);
|
||||||
m_groupAddPanel.setVisible(ps, true);
|
groupAddPanel.setVisible(state, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayAddExistingGroupPanel(PageState ps) {
|
private void displayAddExistingGroupPanel(final PageState state) {
|
||||||
hideAll(ps);
|
hideAll(state);
|
||||||
m_existingGroupAddPanel.setVisible(ps, true);
|
existingGroupAddPanel.setVisible(state, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayEditPanel(PageState ps) {
|
public void displayEditPanel(final PageState state) {
|
||||||
hideAll(ps);
|
hideAll(state);
|
||||||
m_groupEditPanel.setVisible(ps, true);
|
groupEditPanel.setVisible(state, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayGroupInfoPanel(PageState ps) {
|
public void displayGroupInfoPanel(final PageState state) {
|
||||||
showAll(ps);
|
showAll(state);
|
||||||
m_groupEditPanel.setVisible(ps, false);
|
groupEditPanel.setVisible(state, false);
|
||||||
m_groupAddPanel.setVisible(ps, false);
|
groupAddPanel.setVisible(state, false);
|
||||||
m_groupDeleteFailedPanel.setVisible(ps, false);
|
groupDeleteFailedPanel.setVisible(state, false);
|
||||||
m_existingGroupAddPanel.setVisible(ps, false);
|
existingGroupAddPanel.setVisible(state, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayDeleteFailedPanel(PageState ps) {
|
public void displayDeleteFailedPanel(final PageState state) {
|
||||||
hideAll(ps);
|
hideAll(state);
|
||||||
m_groupDeleteFailedPanel.setVisible(ps, true);
|
groupDeleteFailedPanel.setVisible(state, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param e
|
* @param event
|
||||||
*/
|
*/
|
||||||
public void stateChanged(ChangeEvent e) {
|
public void stateChanged(final ChangeEvent event) {
|
||||||
|
|
||||||
PageState ps = e.getPageState();
|
final PageState ps = event.getPageState();
|
||||||
String key = (String) m_tree.getSelectedKey(ps);
|
final String key = (String) groupTree.getSelectedKey(ps);
|
||||||
// added cg - reset existing group add panel to the search screen
|
// added cg - reset existing group add panel to the search screen
|
||||||
// when a new group is selected from the tree
|
// when a new group is selected from the tree
|
||||||
m_existingGroupAdd.showSearch(ps);
|
m_existingGroupAdd.showSearch(ps);
|
||||||
|
|
@ -243,8 +243,8 @@ class GroupAdministrationTab extends BoxPanel
|
||||||
/**
|
/**
|
||||||
* Build a panel to display group basic information.
|
* Build a panel to display group basic information.
|
||||||
*/
|
*/
|
||||||
private Component buildGroupInfoPanel(SegmentedPanel main) {
|
private Component buildGroupInfoPanel(final SegmentedPanel main) {
|
||||||
BoxPanel body = new BoxPanel();
|
final BoxPanel body = new BoxPanel();
|
||||||
|
|
||||||
body.add(new GroupInfo(this));
|
body.add(new GroupInfo(this));
|
||||||
ActionLink link = new ActionLink(EDIT_GROUP_LABEL);
|
ActionLink link = new ActionLink(EDIT_GROUP_LABEL);
|
||||||
|
|
@ -266,39 +266,38 @@ class GroupAdministrationTab extends BoxPanel
|
||||||
/**
|
/**
|
||||||
* Build group edit form.
|
* Build group edit form.
|
||||||
*/
|
*/
|
||||||
private Component buildGroupEditPanel(SegmentedPanel main) {
|
private Component buildGroupEditPanel(final SegmentedPanel main) {
|
||||||
|
|
||||||
return main.addSegment(GROUP_EDIT_HEADER, new GroupEditForm(this));
|
return main.addSegment(GROUP_EDIT_HEADER, new GroupEditForm(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build panel to display direct subgroup information.
|
* Build panel to display direct subgroup information.
|
||||||
*/
|
*/
|
||||||
private Component buildSubGroupPanel(SegmentedPanel main) {
|
private Component buildSubGroupPanel(final SegmentedPanel main) {
|
||||||
BoxPanel body = new BoxPanel();
|
final BoxPanel body = new BoxPanel();
|
||||||
BoxPanel labelStatus = new BoxPanel(BoxPanel.HORIZONTAL);
|
final BoxPanel labelStatus = new BoxPanel(BoxPanel.HORIZONTAL);
|
||||||
labelStatus.add(SUBGROUP_COUNT_LABEL);
|
labelStatus.add(SUBGROUP_COUNT_LABEL);
|
||||||
|
|
||||||
Label countLabel = new Label("");
|
final Label countLabel = new Label("");
|
||||||
countLabel.addPrintListener(new PrintListener() {
|
countLabel.addPrintListener(new PrintListener() {
|
||||||
public void prepare(PrintEvent e) {
|
public void prepare(final PrintEvent event) {
|
||||||
PageState ps = e.getPageState();
|
final PageState ps = event.getPageState();
|
||||||
|
|
||||||
Label t = (Label) e.getTarget();
|
final Label target = (Label) event.getTarget();
|
||||||
Group g = getGroup(ps);
|
Group g = getGroup(ps);
|
||||||
if (g != null) {
|
if (g != null) {
|
||||||
t.setLabel(String.valueOf(g.countSubgroups()));
|
target.setLabel(String.valueOf(g.countSubgroups()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ActionLink status = new ActionLink(countLabel);
|
final ActionLink status = new ActionLink(countLabel);
|
||||||
status.addActionListener(new ActionListener() {
|
status.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(final ActionEvent event) {
|
||||||
PageState ps = e.getPageState();
|
PageState ps = event.getPageState();
|
||||||
String key = (String) m_tree.getSelectedKey(ps);
|
String key = (String) groupTree.getSelectedKey(ps);
|
||||||
m_tree.expand(key, ps);
|
groupTree.expand(key, ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -308,17 +307,17 @@ class GroupAdministrationTab extends BoxPanel
|
||||||
body.add(labelStatus);
|
body.add(labelStatus);
|
||||||
|
|
||||||
|
|
||||||
List subGroupList = new List(new SubGroupListModelBuilder(this));
|
final List subGroupList = new List(new SubGroupListModelBuilder(this));
|
||||||
subGroupList.setCellRenderer(new ListCellRenderer() {
|
subGroupList.setCellRenderer(new ListCellRenderer() {
|
||||||
public Component getComponent(List list,
|
public Component getComponent(final List list,
|
||||||
PageState state,
|
final PageState state,
|
||||||
Object value,
|
final Object value,
|
||||||
String key,
|
final String key,
|
||||||
int index,
|
final int index,
|
||||||
boolean isSelected) {
|
final boolean isSelected) {
|
||||||
BoxPanel b = new BoxPanel(BoxPanel.HORIZONTAL);
|
final BoxPanel b = new BoxPanel(BoxPanel.HORIZONTAL);
|
||||||
b.add(new Label(((Group) value).getName()));
|
b.add(new Label(((Group) value).getName()));
|
||||||
ControlLink removeLink = new ControlLink(REMOVE_SUBGROUP_LABEL);
|
final ControlLink removeLink = new ControlLink(REMOVE_SUBGROUP_LABEL);
|
||||||
removeLink.setClassAttr("actionLink");
|
removeLink.setClassAttr("actionLink");
|
||||||
b.add(removeLink);
|
b.add(removeLink);
|
||||||
return b;
|
return b;
|
||||||
|
|
@ -327,15 +326,15 @@ class GroupAdministrationTab extends BoxPanel
|
||||||
});
|
});
|
||||||
|
|
||||||
subGroupList.addActionListener(new ActionListener() {
|
subGroupList.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(final ActionEvent event) {
|
||||||
PageState ps = e.getPageState();
|
final PageState ps = event.getPageState();
|
||||||
String key = (String) ((List) e.getSource()).getSelectedKey(ps);
|
final String key = (String) ((List) event.getSource()).getSelectedKey(ps);
|
||||||
|
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
BigDecimal groupID = new BigDecimal(key);
|
final BigDecimal groupID = new BigDecimal(key);
|
||||||
try {
|
try {
|
||||||
Group group = new Group(groupID);
|
final Group group = new Group(groupID);
|
||||||
Group parent = getGroup(ps);
|
final Group parent = getGroup(ps);
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
parent.removeSubgroup(group);
|
parent.removeSubgroup(group);
|
||||||
parent.save();
|
parent.save();
|
||||||
|
|
@ -348,11 +347,11 @@ class GroupAdministrationTab extends BoxPanel
|
||||||
});
|
});
|
||||||
body.add(subGroupList);
|
body.add(subGroupList);
|
||||||
|
|
||||||
ActionLink addLink = new ActionLink(ADD_SUBGROUP_LABEL);
|
final ActionLink addLink = new ActionLink(ADD_SUBGROUP_LABEL);
|
||||||
addLink.setClassAttr("actionLink");
|
addLink.setClassAttr("actionLink");
|
||||||
addLink.addActionListener(new ActionListener() {
|
addLink.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(final ActionEvent event) {
|
||||||
PageState ps = e.getPageState();
|
PageState ps = event.getPageState();
|
||||||
|
|
||||||
displayAddGroupPanel(ps);
|
displayAddGroupPanel(ps);
|
||||||
}
|
}
|
||||||
|
|
@ -362,12 +361,12 @@ class GroupAdministrationTab extends BoxPanel
|
||||||
body.add(addLink);
|
body.add(addLink);
|
||||||
|
|
||||||
// new actionlink and anonymous ActionListener class added cg
|
// new actionlink and anonymous ActionListener class added cg
|
||||||
ActionLink addExistingLink = new ActionLink(ADD_EXISTING_GROUP_TO_SUBGROUPS_LABEL);
|
final ActionLink addExistingLink = new ActionLink(ADD_EXISTING_GROUP_TO_SUBGROUPS_LABEL);
|
||||||
addExistingLink.setClassAttr("actionLink");
|
addExistingLink.setClassAttr("actionLink");
|
||||||
addExistingLink.addActionListener(new ActionListener() {
|
addExistingLink.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(final ActionEvent event) {
|
||||||
s_log.debug("Add existing group link pressed");
|
LOGGER.debug("Add existing group link pressed");
|
||||||
PageState ps = e.getPageState();
|
PageState ps = event.getPageState();
|
||||||
displayAddExistingGroupPanel(ps);
|
displayAddExistingGroupPanel(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -381,52 +380,52 @@ class GroupAdministrationTab extends BoxPanel
|
||||||
/**
|
/**
|
||||||
* Build group add form.
|
* Build group add form.
|
||||||
*/
|
*/
|
||||||
private Component buildGroupAddPanel(SegmentedPanel main) {
|
private Component buildGroupAddPanel(final SegmentedPanel main) {
|
||||||
|
|
||||||
return main.addSegment(ADD_GROUP_LABEL, new GroupAddForm(m_tree, this));
|
return main.addSegment(ADD_GROUP_LABEL, new GroupAddForm(groupTree, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Component buildExistingGroupAddPanel(SegmentedPanel main) {
|
private Component buildExistingGroupAddPanel(final SegmentedPanel main) {
|
||||||
m_existingGroupAdd = new ExistingGroupAddPane(m_tree, this);
|
m_existingGroupAdd = new ExistingGroupAddPane(groupTree, this);
|
||||||
return main.addSegment(ADD_EXISTING_GROUP_TO_SUBGROUPS_LABEL, m_existingGroupAdd);
|
return main.addSegment(ADD_EXISTING_GROUP_TO_SUBGROUPS_LABEL, m_existingGroupAdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build group's member panel.
|
* Build group's member panel.
|
||||||
*/
|
*/
|
||||||
private Component buildMemberListPanel(SegmentedPanel main) {
|
private Component buildMemberListPanel(final SegmentedPanel main) {
|
||||||
|
|
||||||
BoxPanel body = new BoxPanel() {
|
BoxPanel body = new BoxPanel() {
|
||||||
@Override
|
@Override
|
||||||
public void register(Page p) {
|
public void register(final Page page) {
|
||||||
p.setVisibleDefault(m_subMemberSearch, false);
|
page.setVisibleDefault(subMemberSearch, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
body.add(new SubMemberPanel(this));
|
body.add(new SubMemberPanel(this));
|
||||||
|
|
||||||
m_addSubmemberLink = new ActionLink(ADD_SUBMEMBER_LABEL);
|
addSubmemberLink = new ActionLink(ADD_SUBMEMBER_LABEL);
|
||||||
m_addSubmemberLink.setClassAttr("actionLink");
|
addSubmemberLink.setClassAttr("actionLink");
|
||||||
m_addSubmemberLink.addActionListener(new ActionListener() {
|
addSubmemberLink.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(final ActionEvent event) {
|
||||||
PageState ps = e.getPageState();
|
PageState ps = event.getPageState();
|
||||||
m_addSubmemberLink.setVisible(ps, false);
|
addSubmemberLink.setVisible(ps, false);
|
||||||
m_subMemberSearch.setVisible(ps, true);
|
subMemberSearch.setVisible(ps, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
m_subMemberSearch = new SearchAndList("searchsubmember");
|
subMemberSearch = new SearchAndList("searchsubmember");
|
||||||
m_subMemberSearch.setListModel(new UserSearchAndListModel());
|
subMemberSearch.setListModel(new UserSearchAndListModel());
|
||||||
m_subMemberSearch.addChangeListener(new ChangeListener() {
|
subMemberSearch.addChangeListener(new ChangeListener() {
|
||||||
public void stateChanged(ChangeEvent e) {
|
public void stateChanged(final ChangeEvent event) {
|
||||||
PageState ps = e.getPageState();
|
PageState ps = event.getPageState();
|
||||||
|
|
||||||
String key = (String) m_subMemberSearch.getSelectedKey(ps);
|
String key = (String) subMemberSearch.getSelectedKey(ps);
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
BigDecimal userID = new BigDecimal(key);
|
final BigDecimal userID = new BigDecimal(key);
|
||||||
|
|
||||||
Group group = getGroup(ps);
|
final Group group = getGroup(ps);
|
||||||
|
|
||||||
if (group != null) {
|
if (group != null) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -441,15 +440,15 @@ class GroupAdministrationTab extends BoxPanel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_subMemberSearch.reset(ps);
|
subMemberSearch.reset(ps);
|
||||||
m_subMemberSearch.setVisible(ps, false);
|
subMemberSearch.setVisible(ps, false);
|
||||||
m_addSubmemberLink.setVisible(ps, true);
|
addSubmemberLink.setVisible(ps, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
body.add(m_subMemberSearch);
|
body.add(subMemberSearch);
|
||||||
body.add(m_addSubmemberLink);
|
body.add(addSubmemberLink);
|
||||||
return main.addSegment(SUBMEMBER_HEADER, body);
|
return main.addSegment(SUBMEMBER_HEADER, body);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -457,24 +456,24 @@ class GroupAdministrationTab extends BoxPanel
|
||||||
/**
|
/**
|
||||||
* Build extreme action panel.
|
* Build extreme action panel.
|
||||||
*/
|
*/
|
||||||
private Component buildExtremeActionPanel(SegmentedPanel main) {
|
private Component buildExtremeActionPanel(final SegmentedPanel main) {
|
||||||
BoxPanel body = new BoxPanel();
|
final BoxPanel body = new BoxPanel();
|
||||||
|
|
||||||
ActionLink deleteLink = new ActionLink(DELETE_GROUP_LABEL);
|
final ActionLink deleteLink = new ActionLink(DELETE_GROUP_LABEL);
|
||||||
deleteLink.setClassAttr("actionLink");
|
deleteLink.setClassAttr("actionLink");
|
||||||
deleteLink.setConfirmation(GROUP_DELETE_CONFIRMATION);
|
deleteLink.setConfirmation(GROUP_DELETE_CONFIRMATION);
|
||||||
deleteLink.addActionListener(new ActionListener() {
|
deleteLink.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(final ActionEvent event) {
|
||||||
|
|
||||||
PageState ps = e.getPageState();
|
PageState ps = event.getPageState();
|
||||||
|
|
||||||
Group g = (Group) m_group.get(ps);
|
final Group group = (Group) requestLocalGroup.get(ps);
|
||||||
if (g != null) {
|
if (group != null) {
|
||||||
try {
|
try {
|
||||||
g.delete();
|
group.delete();
|
||||||
m_tree.setSelectedKey(ps, "-1");
|
groupTree.setSelectedKey(ps, "-1");
|
||||||
} catch (PersistenceException exc) {
|
} catch (PersistenceException exc) {
|
||||||
s_log.warn("Error deleting subgroup", exc);
|
LOGGER.warn("Error deleting subgroup", exc);
|
||||||
displayDeleteFailedPanel(ps);
|
displayDeleteFailedPanel(ps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -493,34 +492,34 @@ class GroupAdministrationTab extends BoxPanel
|
||||||
* Build a panel to display an error message when unable to delete
|
* Build a panel to display an error message when unable to delete
|
||||||
* group.
|
* group.
|
||||||
*/
|
*/
|
||||||
private Component buildGroupDeleteFailedPanel(SegmentedPanel main) {
|
private Component buildGroupDeleteFailedPanel(final SegmentedPanel main) {
|
||||||
ActionLink link = new ActionLink(GROUP_ACTION_CONTINUE);
|
final ActionLink link = new ActionLink(GROUP_ACTION_CONTINUE);
|
||||||
link.addActionListener(new ActionListener() {
|
link.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(final ActionEvent event) {
|
||||||
PageState ps = e.getPageState();
|
PageState ps = event.getPageState();
|
||||||
displayGroupInfoPanel(ps);
|
displayGroupInfoPanel(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
link.setClassAttr("actionLink");
|
link.setClassAttr("actionLink");
|
||||||
|
|
||||||
Label label = new Label(GROUP_DELETE_FAILED_MSG);
|
final Label label = new Label(GROUP_DELETE_FAILED_MSG);
|
||||||
label.setClassAttr("deleteFailedMessage");
|
label.setClassAttr("deleteFailedMessage");
|
||||||
|
|
||||||
BoxPanel p = new BoxPanel();
|
final BoxPanel panel = new BoxPanel();
|
||||||
p.add(label);
|
panel.add(label);
|
||||||
p.add(link);
|
panel.add(link);
|
||||||
|
|
||||||
return main.addSegment(GROUP_DELETE_FAILED_HEADER, p);
|
return main.addSegment(GROUP_DELETE_FAILED_HEADER, panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hides all components of the in preparation for
|
* Hides all components of the in preparation for
|
||||||
* turning selected components back on.
|
* turning selected components back on.
|
||||||
*/
|
*/
|
||||||
private void hideAll(PageState ps) {
|
private void hideAll(final PageState state) {
|
||||||
for (int i = 0; i < m_panelList.size(); i++) {
|
for (int i = 0; i < panelList.size(); i++) {
|
||||||
((Component) m_panelList.get(i)).setVisible(ps, false);
|
((Component) panelList.get(i)).setVisible(state, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -528,25 +527,24 @@ class GroupAdministrationTab extends BoxPanel
|
||||||
* Show all components of the in preparation for
|
* Show all components of the in preparation for
|
||||||
* turning visibility of selected components off .
|
* turning visibility of selected components off .
|
||||||
*/
|
*/
|
||||||
private void showAll(PageState ps) {
|
private void showAll(final PageState state) {
|
||||||
for (int i = 0; i < m_panelList.size(); i++) {
|
for (int i = 0; i < panelList.size(); i++) {
|
||||||
((Component) m_panelList.get(i)).setVisible(ps, true);
|
((Component) panelList.get(i)).setVisible(state, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class SubGroupListModelBuilder extends LockableImpl
|
class SubGroupListModelBuilder extends LockableImpl implements ListModelBuilder {
|
||||||
implements ListModelBuilder {
|
|
||||||
|
|
||||||
private GroupAdministrationTab m_parent;
|
private final GroupAdministrationTab parent;
|
||||||
|
|
||||||
public SubGroupListModelBuilder(GroupAdministrationTab parent) {
|
public SubGroupListModelBuilder(final GroupAdministrationTab parent) {
|
||||||
m_parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ListModel makeModel(List l, PageState state) {
|
public ListModel makeModel(final List list, final PageState state) {
|
||||||
Group group = m_parent.getGroup(state);
|
final Group group = parent.getGroup(state);
|
||||||
|
|
||||||
if (group != null) {
|
if (group != null) {
|
||||||
return new SubGroupListModel(group.getSubgroups());
|
return new SubGroupListModel(group.getSubgroups());
|
||||||
|
|
@ -567,10 +565,10 @@ class SubGroupListModel implements ListModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param coll
|
* @param collection
|
||||||
*/
|
*/
|
||||||
public SubGroupListModel(GroupCollection coll) {
|
public SubGroupListModel(final GroupCollection collection) {
|
||||||
m_coll = coll;
|
m_coll = collection;
|
||||||
m_coll.addOrder("lower(" + Group.DISPLAY_NAME + ") asc");
|
m_coll.addOrder("lower(" + Group.DISPLAY_NAME + ") asc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ import com.arsdigita.kernel.security.SecurityConfig;
|
||||||
* Form used to add a new user to the system.
|
* Form used to add a new user to the system.
|
||||||
*
|
*
|
||||||
* @version $Id: UserAddForm.java 287 2005-02-22 00:29:02Z sskracic $
|
* @version $Id: UserAddForm.java 287 2005-02-22 00:29:02Z sskracic $
|
||||||
|
* @deprecated Replaced by {@link UserCreateSection}. Will be removed soon.
|
||||||
*/
|
*/
|
||||||
class UserAddForm extends UserForm
|
class UserAddForm extends UserForm
|
||||||
implements FormProcessListener,
|
implements FormProcessListener,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,186 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.ui.admin;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.BoxPanel;
|
||||||
|
import com.arsdigita.bebop.Component;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.List;
|
||||||
|
import com.arsdigita.bebop.Page;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.Resettable;
|
||||||
|
import com.arsdigita.bebop.SimpleContainer;
|
||||||
|
import com.arsdigita.bebop.TabbedPane;
|
||||||
|
import com.arsdigita.bebop.event.ChangeEvent;
|
||||||
|
import com.arsdigita.bebop.event.ChangeListener;
|
||||||
|
import com.arsdigita.bebop.list.ListModel;
|
||||||
|
import com.arsdigita.bebop.list.ListModelBuilder;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
import com.arsdigita.toolbox.ui.LayoutPanel;
|
||||||
|
import static com.arsdigita.ui.admin.AdminConstants.USER_NAVBAR_TITLE;
|
||||||
|
import static com.arsdigita.ui.admin.AdminConstants.USER_TAB_SUMMARY;
|
||||||
|
import com.arsdigita.util.Assert;
|
||||||
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
import com.arsdigita.xml.Element;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
class UserAdministrationTab extends SimpleContainer implements AdminConstants {
|
||||||
|
|
||||||
|
private final List sections;
|
||||||
|
private final java.util.List<Component> components = new ArrayList<Component>();
|
||||||
|
private final java.util.List<Label> keys = new ArrayList<Label>();
|
||||||
|
private final GlobalizedMessage title = USER_NAVBAR_TITLE;
|
||||||
|
|
||||||
|
public UserAdministrationTab(final TabbedPane parent, final GroupAdministrationTab groupAdminTab) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
final LayoutPanel panel = new LayoutPanel();
|
||||||
|
setClassAttr("sidebarNavPanel");
|
||||||
|
|
||||||
|
sections = new List(new GlobalizedTabModelBuilder());
|
||||||
|
sections.addChangeListener(new SectionChangeListener());
|
||||||
|
sections.setClassAttr("navbar");
|
||||||
|
panel.setLeft(sections);
|
||||||
|
|
||||||
|
final UserBrowsePane browsePane = new UserBrowsePane();
|
||||||
|
final UserSummarySection summarySection = new UserSummarySection(this, browsePane);
|
||||||
|
final UserSearchSection searchSection = new UserSearchSection(this, browsePane);
|
||||||
|
final UserCreateSection createSection = new UserCreateSection(this);
|
||||||
|
|
||||||
|
browsePane.setTabbedPane(parent);
|
||||||
|
browsePane.setGroupAdministrationTab(groupAdminTab);
|
||||||
|
|
||||||
|
final BoxPanel right = new BoxPanel();
|
||||||
|
addSection(USER_TAB_SUMMARY, summarySection, right);
|
||||||
|
addSection(USER_TAB_SEARCH, searchSection, right);
|
||||||
|
addSection(USER_TAB_CREATE_USER, createSection, right);
|
||||||
|
|
||||||
|
panel.setRight(right);
|
||||||
|
add(panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @pre label != null && c != null
|
||||||
|
*/
|
||||||
|
private void addSection(final Label label, final Component component, final BoxPanel panel) {
|
||||||
|
Assert.isUnlocked(this);
|
||||||
|
components.add(component);
|
||||||
|
component.setClassAttr("main");
|
||||||
|
panel.add(component);
|
||||||
|
keys.add(label);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void register(final Page page) {
|
||||||
|
Assert.isUnlocked(this);
|
||||||
|
|
||||||
|
for (int i = 0; i < components.size(); i++) {
|
||||||
|
page.setVisibleDefault(components.get(i), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSection(final int index, final PageState state) {
|
||||||
|
sections.setSelectedKey(state, String.valueOf(index));
|
||||||
|
for (int i = 0; i < components.size(); i++) {
|
||||||
|
if (i == index) {
|
||||||
|
(components.get(i)).setVisible(state, true);
|
||||||
|
((Resettable) components.get(i)).reset(state);
|
||||||
|
} else {
|
||||||
|
(components.get(i)).setVisible(state, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generateXML(final PageState state, final Element parent) {
|
||||||
|
super.generateXML(state, parent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Globalized navbar title.
|
||||||
|
* Why did I override generateXML method to globalize the title?
|
||||||
|
* Because CMS put title bar as an attribute of element. This
|
||||||
|
* is the only method I could come up with.
|
||||||
|
*/
|
||||||
|
final Element child = (Element) parent.getChildren().get(0);
|
||||||
|
child.addAttribute("navbar-title",
|
||||||
|
(String) title.localize(state.getRequest()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SectionChangeListener implements ChangeListener {
|
||||||
|
|
||||||
|
public SectionChangeListener() {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stateChanged(final ChangeEvent event) {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
final int selectedIndex = Integer.parseInt((String) sections.getSelectedKey(state));
|
||||||
|
setSection(selectedIndex, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class GlobalizedTabModelBuilder extends LockableImpl implements ListModelBuilder {
|
||||||
|
|
||||||
|
public GlobalizedTabModelBuilder() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListModel makeModel(final List list, final PageState state) {
|
||||||
|
return new TabNameListModel(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TabNameListModel implements ListModel {
|
||||||
|
|
||||||
|
private int index = -1;
|
||||||
|
private final PageState pageState;
|
||||||
|
|
||||||
|
public TabNameListModel(final PageState state) {
|
||||||
|
pageState = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getElement() {
|
||||||
|
return keys.get(index).getLabel(pageState);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
return String.valueOf(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean next() {
|
||||||
|
final boolean result = (index < keys.size() - 1);
|
||||||
|
//return (index++ < keys.size() - 1);
|
||||||
|
index++;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,133 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.ui.admin;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.Resettable;
|
||||||
|
import com.arsdigita.bebop.event.FormInitListener;
|
||||||
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
||||||
|
import com.arsdigita.kernel.EmailAddress;
|
||||||
|
import com.arsdigita.kernel.PersonName;
|
||||||
|
import com.arsdigita.kernel.User;
|
||||||
|
import com.arsdigita.kernel.UserAuthentication;
|
||||||
|
import com.arsdigita.kernel.security.SecurityConfig;
|
||||||
|
import static com.arsdigita.ui.admin.AdminConstants.USER_FORM_INPUT_URL_DEFAULT;
|
||||||
|
import javax.mail.internet.InternetAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
class UserCreateSection extends UserForm implements AdminConstants, Resettable {
|
||||||
|
|
||||||
|
private final SecurityConfig securityConfig = SecurityConfig.getConfig();
|
||||||
|
private final UserAdministrationTab parent;
|
||||||
|
|
||||||
|
public UserCreateSection(final UserAdministrationTab parent) {
|
||||||
|
super(USER_FORM_ADD);
|
||||||
|
|
||||||
|
this.parent = parent;
|
||||||
|
|
||||||
|
addInitListener(new UserCreateInitListener());
|
||||||
|
addProcessListener(new UserCreateProcessListener());
|
||||||
|
|
||||||
|
if (securityConfig.getEnableQuestion()) {
|
||||||
|
// Add validation listeners for required parameters
|
||||||
|
// but only if SecurityConfig.getEnableQuestion is true (jensp 2011-10-05)
|
||||||
|
m_question.addValidationListener(new NotEmptyValidationListener());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset(final PageState state) {
|
||||||
|
state.setValue(USER_ID_PARAM, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class UserCreateInitListener implements FormInitListener {
|
||||||
|
|
||||||
|
public UserCreateInitListener() {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
|
showSecurityInfo(state);
|
||||||
|
|
||||||
|
USER_FORM_LABEL_ADDITIONAL_EMAIL_LIST.setVisible(state, false);
|
||||||
|
m_emailList.setVisible(state, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class UserCreateProcessListener implements FormProcessListener {
|
||||||
|
|
||||||
|
public UserCreateProcessListener() {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
public void process(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
|
final User user = new User();
|
||||||
|
|
||||||
|
final String email = ((InternetAddress) m_primaryEmail.getValue(state)).getAddress();
|
||||||
|
|
||||||
|
user.setPrimaryEmail(new EmailAddress(email));
|
||||||
|
user.setScreenName((String) m_screenName.getValue(state));
|
||||||
|
|
||||||
|
final PersonName personName = user.getPersonName();
|
||||||
|
personName.setGivenName((String) m_firstName.getValue(state));
|
||||||
|
personName.setFamilyName((String) m_lastName.getValue(state));
|
||||||
|
|
||||||
|
// Check to see if the value has changed from the
|
||||||
|
// default. If not just leave this set to null.
|
||||||
|
final String uri = (String) m_url.getValue(state);
|
||||||
|
if (!USER_FORM_INPUT_URL_DEFAULT.equals(uri) && !"".equals(uri)) {
|
||||||
|
user.setURI(uri);
|
||||||
|
}
|
||||||
|
// Add optional additional email address
|
||||||
|
final InternetAddress additional = (InternetAddress) m_additionalEmail.getValue(state);
|
||||||
|
if (additional != null) {
|
||||||
|
user.addEmailAddress(new EmailAddress(additional.getAddress()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make new user persistent
|
||||||
|
user.save();
|
||||||
|
|
||||||
|
// Save user authentication credentials.
|
||||||
|
final UserAuthentication auth = UserAuthentication.createForUser(user);
|
||||||
|
|
||||||
|
auth.setPassword((String) m_password.getValue(state));
|
||||||
|
if (securityConfig.getEnableQuestion()) {
|
||||||
|
auth.setPasswordQuestion((String) m_question.getValue(state));
|
||||||
|
auth.setPasswordAnswer((String) m_answer.getValue(state));
|
||||||
|
}
|
||||||
|
auth.save();
|
||||||
|
|
||||||
|
// Switch to browse tab.
|
||||||
|
parent.setSection(USER_TAB_BROWSE_INDEX, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -34,8 +34,8 @@ import java.math.BigDecimal;
|
||||||
* User search panel.
|
* User search panel.
|
||||||
*
|
*
|
||||||
* @author David Dao
|
* @author David Dao
|
||||||
|
* @deprecated Replaced by {@link UserSearchSection}. Will be removed soon.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class UserSearchPane extends SegmentedPanel
|
class UserSearchPane extends SegmentedPanel
|
||||||
implements AdminConstants,
|
implements AdminConstants,
|
||||||
Resettable,
|
Resettable,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.ui.admin;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Component;
|
||||||
|
import com.arsdigita.bebop.ControlLink;
|
||||||
|
import com.arsdigita.bebop.List;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.Resettable;
|
||||||
|
import com.arsdigita.bebop.SegmentedPanel;
|
||||||
|
import com.arsdigita.bebop.SimpleContainer;
|
||||||
|
import com.arsdigita.bebop.event.ChangeEvent;
|
||||||
|
import com.arsdigita.bebop.event.ChangeListener;
|
||||||
|
import com.arsdigita.bebop.list.ListCellRenderer;
|
||||||
|
import static com.arsdigita.ui.admin.AdminConstants.USER_ID_PARAM;
|
||||||
|
import static com.arsdigita.ui.admin.AdminConstants.USER_TAB_BROWSE_INDEX;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
class UserSearchSection extends SegmentedPanel implements AdminConstants, Resettable {
|
||||||
|
|
||||||
|
private final SearchAndList searchAndList;
|
||||||
|
private final UserAdministrationTab parent;
|
||||||
|
private final UserBrowsePane browsePane;
|
||||||
|
|
||||||
|
public UserSearchSection(final UserAdministrationTab parent, final UserBrowsePane browsePane) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.parent = parent;
|
||||||
|
this.browsePane = browsePane;
|
||||||
|
|
||||||
|
searchAndList = new SearchAndList("user_search");
|
||||||
|
searchAndList.addChangeListener(new UserSearchChangeListener());
|
||||||
|
searchAndList.setListModel(new UserSearchAndListModel());
|
||||||
|
searchAndList.setResultCellRenderer(new ListCellRenderer() {
|
||||||
|
public Component getComponent(final List list,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final String key,
|
||||||
|
final int index,
|
||||||
|
final boolean isSelected) {
|
||||||
|
return new ControlLink(value.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
final SimpleContainer body = new SimpleContainer();
|
||||||
|
body.add(searchAndList);
|
||||||
|
|
||||||
|
addSegment(SEARCH_PANEL_HEADER, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset(final PageState state) {
|
||||||
|
searchAndList.reset(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class UserSearchChangeListener implements ChangeListener {
|
||||||
|
|
||||||
|
public void stateChanged(final ChangeEvent event) {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
parent.setSection(USER_TAB_BROWSE_INDEX, event.getPageState());
|
||||||
|
|
||||||
|
final String userId = (String) searchAndList.getSelectedKey(state);
|
||||||
|
if (userId == null) {
|
||||||
|
reset(state);
|
||||||
|
} else {
|
||||||
|
state.setValue(USER_ID_PARAM, new BigDecimal(userId));
|
||||||
|
browsePane.displayUserInfoPanel(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.ui.admin;
|
package com.arsdigita.ui.admin;
|
||||||
|
|
||||||
|
|
||||||
import com.arsdigita.ui.util.GlobalizationUtil;
|
import com.arsdigita.ui.util.GlobalizationUtil;
|
||||||
|
|
||||||
import com.arsdigita.bebop.Label;
|
import com.arsdigita.bebop.Label;
|
||||||
|
|
@ -40,13 +39,14 @@ import com.arsdigita.bebop.event.ChangeEvent;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import com.arsdigita.bebop.Resettable;
|
import com.arsdigita.bebop.Resettable;
|
||||||
import com.arsdigita.bebop.SegmentedPanel;
|
import com.arsdigita.bebop.SegmentedPanel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author David Dao
|
* @author David Dao
|
||||||
* @version $Id: UserSummaryPane.java 1486 2007-03-18 16:47:26Z apevec $
|
* @version $Id: UserSummaryPane.java 1486 2007-03-18 16:47:26Z apevec $
|
||||||
|
* @deprecated Replaced by {@link UserSummarySection}. Will be removed soon.
|
||||||
*/
|
*/
|
||||||
class UserSummaryPane extends SegmentedPanel implements AdminConstants,
|
class UserSummaryPane extends SegmentedPanel implements AdminConstants, Resettable {
|
||||||
Resettable {
|
|
||||||
|
|
||||||
private UserSummaryBodyPane m_body;
|
private UserSummaryBodyPane m_body;
|
||||||
|
|
||||||
|
|
@ -60,6 +60,7 @@ class UserSummaryPane extends SegmentedPanel implements AdminConstants,
|
||||||
public void reset(PageState ps) {
|
public void reset(PageState ps) {
|
||||||
m_body.reset(ps);
|
m_body.reset(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class UserSummaryBodyPane extends BoxPanel implements AdminConstants,
|
class UserSummaryBodyPane extends BoxPanel implements AdminConstants,
|
||||||
|
|
@ -68,7 +69,6 @@ class UserSummaryBodyPane extends BoxPanel implements AdminConstants,
|
||||||
Resettable {
|
Resettable {
|
||||||
|
|
||||||
private static final String EXCLUDE_GROUP_ID = "excludeGroupId";
|
private static final String EXCLUDE_GROUP_ID = "excludeGroupId";
|
||||||
|
|
||||||
private AdminSplitPanel m_splitPanel;
|
private AdminSplitPanel m_splitPanel;
|
||||||
private SearchAndList m_searchAndList;
|
private SearchAndList m_searchAndList;
|
||||||
private UserBrowsePane m_userBrowsePane;
|
private UserBrowsePane m_userBrowsePane;
|
||||||
|
|
@ -102,8 +102,7 @@ class UserSummaryBodyPane extends BoxPanel implements AdminConstants,
|
||||||
public void prepare(PrintEvent e) {
|
public void prepare(PrintEvent e) {
|
||||||
DataQuery query =
|
DataQuery query =
|
||||||
SessionManager.getSession().retrieveQuery(
|
SessionManager.getSession().retrieveQuery(
|
||||||
"com.arsdigita.kernel.RetrieveUsers"
|
"com.arsdigita.kernel.RetrieveUsers");
|
||||||
);
|
|
||||||
// include all groups
|
// include all groups
|
||||||
query.setParameter(EXCLUDE_GROUP_ID, new BigDecimal(0));
|
query.setParameter(EXCLUDE_GROUP_ID, new BigDecimal(0));
|
||||||
// XXX NOT EXISTS ( ... g.group_id = null )
|
// XXX NOT EXISTS ( ... g.group_id = null )
|
||||||
|
|
@ -112,6 +111,7 @@ class UserSummaryBodyPane extends BoxPanel implements AdminConstants,
|
||||||
Label l = (Label) e.getTarget();
|
Label l = (Label) e.getTarget();
|
||||||
l.setLabel(Long.toString(nUsers));
|
l.setLabel(Long.toString(nUsers));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ActionLink nUsersLink = new ActionLink(nResults);
|
ActionLink nUsersLink = new ActionLink(nResults);
|
||||||
|
|
@ -119,6 +119,7 @@ class UserSummaryBodyPane extends BoxPanel implements AdminConstants,
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
m_splitPanel.setTab(USER_TAB_BROWSE_INDEX, e.getPageState());
|
m_splitPanel.setTab(USER_TAB_BROWSE_INDEX, e.getPageState());
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
p.add(nUsersLink);
|
p.add(nUsersLink);
|
||||||
|
|
@ -130,7 +131,6 @@ class UserSummaryBodyPane extends BoxPanel implements AdminConstants,
|
||||||
m_splitPanel.setTab(USER_TAB_CREATE_USER_INDEX, e.getPageState());
|
m_splitPanel.setTab(USER_TAB_CREATE_USER_INDEX, e.getPageState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private SearchAndList makeUserSearch() {
|
private SearchAndList makeUserSearch() {
|
||||||
SearchAndList s = new SearchAndList("user_search");
|
SearchAndList s = new SearchAndList("user_search");
|
||||||
s.addChangeListener(this);
|
s.addChangeListener(this);
|
||||||
|
|
@ -144,6 +144,7 @@ class UserSummaryBodyPane extends BoxPanel implements AdminConstants,
|
||||||
return userLink;
|
return userLink;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
s.setListModel(new UserSearchAndListModel());
|
s.setListModel(new UserSearchAndListModel());
|
||||||
|
|
@ -168,4 +169,5 @@ class UserSummaryBodyPane extends BoxPanel implements AdminConstants,
|
||||||
public void reset(PageState ps) {
|
public void reset(PageState ps) {
|
||||||
m_searchAndList.reset(ps);
|
m_searchAndList.reset(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,151 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.ui.admin;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.ActionLink;
|
||||||
|
import com.arsdigita.bebop.BoxPanel;
|
||||||
|
import com.arsdigita.bebop.Component;
|
||||||
|
import com.arsdigita.bebop.ControlLink;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.List;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.Resettable;
|
||||||
|
import com.arsdigita.bebop.event.ActionEvent;
|
||||||
|
import com.arsdigita.bebop.event.ActionListener;
|
||||||
|
import com.arsdigita.bebop.event.ChangeEvent;
|
||||||
|
import com.arsdigita.bebop.event.ChangeListener;
|
||||||
|
import com.arsdigita.bebop.event.PrintEvent;
|
||||||
|
import com.arsdigita.bebop.event.PrintListener;
|
||||||
|
import com.arsdigita.bebop.list.ListCellRenderer;
|
||||||
|
import com.arsdigita.persistence.DataQuery;
|
||||||
|
import com.arsdigita.persistence.SessionManager;
|
||||||
|
import static com.arsdigita.ui.admin.AdminConstants.TOTAL_USERS_LABEL;
|
||||||
|
import static com.arsdigita.ui.admin.AdminConstants.USER_TAB_BROWSE_INDEX;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
class UserSummarySection extends BoxPanel implements AdminConstants, Resettable {
|
||||||
|
|
||||||
|
private static final String EXCLUDE_GROUP_ID = "excludeGroupId";
|
||||||
|
private final UserAdministrationTab parent;
|
||||||
|
private final SearchAndList searchAndList;
|
||||||
|
private final UserBrowsePane userBrowsePane;
|
||||||
|
|
||||||
|
public UserSummarySection(final UserAdministrationTab parent, final UserBrowsePane userBrowsePane) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.parent = parent;
|
||||||
|
this.userBrowsePane = userBrowsePane;
|
||||||
|
|
||||||
|
add(createTotalUsersLabel());
|
||||||
|
|
||||||
|
searchAndList = new SearchAndList("user_search");
|
||||||
|
searchAndList.addChangeListener(new UserSearchChangeListener());
|
||||||
|
searchAndList.setResultCellRenderer(new ListCellRenderer() {
|
||||||
|
public Component getComponent(final List list,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final String key,
|
||||||
|
final int index,
|
||||||
|
final boolean isSelected) {
|
||||||
|
return new ControlLink(value.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
searchAndList.setListModel(new UserSearchAndListModel());
|
||||||
|
add(searchAndList);
|
||||||
|
|
||||||
|
final ActionLink createLink = new ActionLink(CREATE_USER_LABEL);
|
||||||
|
createLink.setClassAttr("actionLink");
|
||||||
|
createLink.addActionListener(new UserCreateActionListener());
|
||||||
|
add(createLink);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Component createTotalUsersLabel() {
|
||||||
|
final BoxPanel panel = new BoxPanel(BoxPanel.HORIZONTAL);
|
||||||
|
panel.add(TOTAL_USERS_LABEL);
|
||||||
|
|
||||||
|
final Label nResults = new Label(com.arsdigita.ui.util.GlobalizationUtil.globalize("ui.admin.nusers"));
|
||||||
|
nResults.addPrintListener(new PrintListener() {
|
||||||
|
public void prepare(final PrintEvent event) {
|
||||||
|
final DataQuery query = SessionManager.getSession().retrieveQuery("com.arsdigita.kernel.RetrieveUsers");
|
||||||
|
// include all groups
|
||||||
|
query.setParameter(EXCLUDE_GROUP_ID, BigDecimal.ZERO);
|
||||||
|
// XXX NOT EXISTS ( ... g.group_id = null )
|
||||||
|
// 10g evaluates to null
|
||||||
|
final long nUsers = query.size();
|
||||||
|
final Label target = (Label) event.getTarget();
|
||||||
|
target.setLabel(Long.toString(nUsers));
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
final ActionLink nUsersLink = new ActionLink(nResults);
|
||||||
|
nUsersLink.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(final ActionEvent event) {
|
||||||
|
parent.setSection(USER_TAB_BROWSE_INDEX, event.getPageState());
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
panel.add(nUsersLink);
|
||||||
|
|
||||||
|
return panel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset(final PageState state) {
|
||||||
|
searchAndList.reset(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class UserCreateActionListener implements ActionListener {
|
||||||
|
|
||||||
|
public UserCreateActionListener() {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actionPerformed(final ActionEvent event) {
|
||||||
|
parent.setSection(USER_TAB_CREATE_USER_INDEX, event.getPageState());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class UserSearchChangeListener implements ChangeListener {
|
||||||
|
|
||||||
|
public UserSearchChangeListener() {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stateChanged(final ChangeEvent event) {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
parent.setSection(USER_TAB_BROWSE_INDEX, event.getPageState());
|
||||||
|
/* SDM #204846. Contemplate a situation where no user is actually selected */
|
||||||
|
final String selectedKey = (String) searchAndList.getSelectedKey(state);
|
||||||
|
if (null != selectedKey) {
|
||||||
|
state.setValue(USER_ID_PARAM, new BigDecimal(selectedKey));
|
||||||
|
userBrowsePane.displayUserInfoPanel(event.getPageState());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -46,9 +46,9 @@ public class ApplicationInstancePane extends SegmentedPanel {
|
||||||
appInstInfoPanel);
|
appInstInfoPanel);
|
||||||
|
|
||||||
if (appAdminPane == null) {
|
if (appAdminPane == null) {
|
||||||
addSegment(new Label(com.arsdigita.ui.util.GlobalizationUtil.globalize(
|
addSegment(new Label(GlobalizationUtil.globalize(
|
||||||
"ui.admin.MultiInstanceApplicationPane.manage.heading")),
|
"ui.admin.MultiInstanceApplicationPane.manage.heading")),
|
||||||
new Label(com.arsdigita.ui.util.GlobalizationUtil.globalize(
|
new Label(GlobalizationUtil.globalize(
|
||||||
"ui.admin.MultiInstancePane.manage.no_instance_admin_pane_found",
|
"ui.admin.MultiInstancePane.manage.no_instance_admin_pane_found",
|
||||||
new String[]{appInstance.getApplicationType().getApplicationObjectType()})));
|
new String[]{appInstance.getApplicationType().getApplicationObjectType()})));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.ui.permissions;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.BoxPanel;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.Link;
|
||||||
|
import com.arsdigita.ui.admin.GlobalizationUtil;
|
||||||
|
import com.arsdigita.ui.admin.applications.AbstractSingletonApplicationManager;
|
||||||
|
import com.arsdigita.ui.admin.applications.ApplicationInstanceAwareContainer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PermissionsAppManager extends AbstractSingletonApplicationManager<Permissions> {
|
||||||
|
|
||||||
|
public Class<Permissions> getApplication() {
|
||||||
|
return Permissions.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationInstanceAwareContainer getApplicationAdminForm() {
|
||||||
|
final ApplicationInstanceAwareContainer container = new ApplicationInstanceAwareContainer();
|
||||||
|
|
||||||
|
final BoxPanel panel = new BoxPanel();
|
||||||
|
panel.add(new Label(GlobalizationUtil.globalize("ui.admin.applications.form_not_compatible_now")));
|
||||||
|
panel.add(new Link("/ccm/permissions", "/permissions"));
|
||||||
|
|
||||||
|
container.add(panel);
|
||||||
|
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue