Some cleanup work, prepared another tab for /ccm/admin which will display several informations about a CCM installation
git-svn-id: https://svn.libreccm.org/ccm/trunk@2221 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
67c7b90ded
commit
ecf1f407a6
|
|
@ -67,6 +67,8 @@ interface AdminConstants {
|
|||
(new GlobalizedMessage("ui.admin.tab.applications.title",
|
||||
BUNDLE_NAME));
|
||||
|
||||
Label INFO_TAB_TITLE = new Label(new GlobalizedMessage("ui.admin.tab.info.title", BUNDLE_NAME));
|
||||
|
||||
GlobalizedMessage USER_NAVBAR_TITLE =
|
||||
new GlobalizedMessage("ui.admin.tab.user.navbartitle",
|
||||
BUNDLE_NAME);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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.Label;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class AdminInfoTab extends BoxPanel {
|
||||
|
||||
public AdminInfoTab() {
|
||||
super(BoxPanel.VERTICAL);
|
||||
|
||||
final Label placeholder = new Label(GlobalizationUtil.globalize("ui.admin.infotab.placeholder"));
|
||||
add(placeholder);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package com.arsdigita.ui.admin;
|
||||
|
||||
import com.arsdigita.ui.admin.ApplicationsAdministrationTab;
|
||||
import com.arsdigita.bebop.Page;
|
||||
import com.arsdigita.bebop.PageFactory;
|
||||
import com.arsdigita.bebop.TabbedPane;
|
||||
|
|
@ -29,24 +28,19 @@ import com.arsdigita.kernel.Party;
|
|||
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||
import com.arsdigita.kernel.permissions.PermissionService;
|
||||
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
||||
import com.arsdigita.templating.PresentationManager;
|
||||
import com.arsdigita.templating.Templating;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.web.Application;
|
||||
import com.arsdigita.web.BaseApplicationServlet;
|
||||
import com.arsdigita.web.LoginSignal;
|
||||
import com.arsdigita.xml.Document;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Web Developer Support Application Servlet class, central entry point to create and process the applications UI.
|
||||
*
|
||||
|
|
@ -55,21 +49,21 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
* @see com.arsdigita.bebop.page.BebopApplicationServlet}
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @author pb
|
||||
*/
|
||||
public class AdminServlet extends BaseApplicationServlet
|
||||
implements AdminConstants {
|
||||
public class AdminServlet extends BaseApplicationServlet implements AdminConstants {
|
||||
|
||||
private static final long serialVersionUID = -3912367600768871630L;
|
||||
/**
|
||||
* Logger instance for debugging
|
||||
*/
|
||||
private static final Logger s_log = Logger.getLogger(
|
||||
AdminServlet.class.getName());
|
||||
//private static final Logger LOGGER = Logger.getLogger(AdminServlet.class.getName());
|
||||
/**
|
||||
* URL (pathinfo) -> Page object mapping. Based on it (and the http request url) the doService method to selects a
|
||||
* page to display
|
||||
*/
|
||||
private final Map m_pages = new HashMap();
|
||||
private final Map<String, Page> pages = new HashMap<String, Page>();
|
||||
|
||||
/**
|
||||
* User extension point, overwrite this method to setup a URL - page mapping
|
||||
|
|
@ -78,7 +72,6 @@ public class AdminServlet extends BaseApplicationServlet
|
|||
*/
|
||||
@Override
|
||||
public void doInit() throws ServletException {
|
||||
|
||||
addPage("/", buildAdminIndexPage()); // index page at address ~/ds
|
||||
// addPage("/index.jsp", buildIndexPage()); // index page at address ~/ds
|
||||
|
||||
|
|
@ -87,23 +80,24 @@ public class AdminServlet extends BaseApplicationServlet
|
|||
/**
|
||||
* Central service method, checks for required permission, determines the requested page and passes the page object
|
||||
* to PresentationManager.
|
||||
*
|
||||
* @param sreq
|
||||
* @param sresp
|
||||
* @param app
|
||||
* @throws ServletException
|
||||
* @throws IOException
|
||||
*/
|
||||
public final void doService(HttpServletRequest sreq,
|
||||
HttpServletResponse sresp,
|
||||
Application app)
|
||||
throws ServletException, IOException {
|
||||
|
||||
|
||||
|
||||
public final void doService(final HttpServletRequest sreq,
|
||||
final HttpServletResponse sresp,
|
||||
final Application app) throws ServletException, IOException {
|
||||
// /////// Some preparational steps ///////////////
|
||||
|
||||
/* Determine access privilege: only logged in users may access DS */
|
||||
Party party = Kernel.getContext().getParty();
|
||||
final Party party = Kernel.getContext().getParty();
|
||||
if (party == null) {
|
||||
throw new LoginSignal(sreq);
|
||||
}
|
||||
/* Determine access privilege: Admin privileges must be granted */
|
||||
PermissionDescriptor admin = new PermissionDescriptor(PrivilegeDescriptor.ADMIN, app, party);
|
||||
final PermissionDescriptor admin = new PermissionDescriptor(PrivilegeDescriptor.ADMIN, app, party);
|
||||
if (!PermissionService.checkPermission(admin)) {
|
||||
throw new AccessDeniedException("User is not an administrator");
|
||||
}
|
||||
|
|
@ -112,7 +106,6 @@ public class AdminServlet extends BaseApplicationServlet
|
|||
|
||||
|
||||
// /////// Everything OK here - DO IT ///////////////
|
||||
|
||||
String pathInfo = sreq.getPathInfo();
|
||||
Assert.exists(pathInfo, "String pathInfo");
|
||||
if (pathInfo.length() > 1 && pathInfo.endsWith("/")) {
|
||||
|
|
@ -124,21 +117,13 @@ public class AdminServlet extends BaseApplicationServlet
|
|||
pathInfo = pathInfo.substring(0, pathInfo.length() - 1);
|
||||
}
|
||||
|
||||
final Page page = (Page) m_pages.get(pathInfo);
|
||||
|
||||
if (page != null) {
|
||||
|
||||
final Document doc = page.buildDocument(sreq, sresp);
|
||||
|
||||
PresentationManager pm = Templating.getPresentationManager();
|
||||
pm.servePage(doc, sreq, sresp);
|
||||
|
||||
} else {
|
||||
|
||||
final Page page = pages.get(pathInfo);
|
||||
if (page == null) {
|
||||
sresp.sendError(404, "No such page for path " + pathInfo);
|
||||
|
||||
} else {
|
||||
final Document doc = page.buildDocument(sreq, sresp);
|
||||
Templating.getPresentationManager().servePage(doc, sreq, sresp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -148,15 +133,14 @@ public class AdminServlet extends BaseApplicationServlet
|
|||
* @param page Page object to display
|
||||
*/
|
||||
private void addPage(final String pathInfo, final Page page) {
|
||||
|
||||
Assert.exists(pathInfo, String.class);
|
||||
Assert.exists(page, Page.class);
|
||||
// Current Implementation requires pathInfo to start with a leading '/'
|
||||
// SUN Servlet API specifies: "PathInfo *may be empty* or will start
|
||||
// with a '/' character."
|
||||
Assert.isTrue(pathInfo.startsWith("/"), "path starts not with '/'");
|
||||
Assert.isTrue(pathInfo.charAt(0) == '/', "path starts not with '/'");
|
||||
|
||||
m_pages.put(pathInfo, page);
|
||||
pages.put(pathInfo, page);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -164,60 +148,52 @@ public class AdminServlet extends BaseApplicationServlet
|
|||
*/
|
||||
private Page buildAdminIndexPage() {
|
||||
|
||||
Page p = PageFactory.buildPage("admin", PAGE_TITLE_LABEL);
|
||||
final Page page = PageFactory.buildPage("admin", PAGE_TITLE_LABEL);
|
||||
page.addGlobalStateParam(USER_ID_PARAM);
|
||||
page.addGlobalStateParam(GROUP_ID_PARAM);
|
||||
page.addGlobalStateParam(APPLICATIONS_ID_PARAM);
|
||||
|
||||
p.addGlobalStateParam(USER_ID_PARAM);
|
||||
p.addGlobalStateParam(GROUP_ID_PARAM);
|
||||
p.addGlobalStateParam(APPLICATIONS_ID_PARAM);
|
||||
|
||||
/* Create User split panel. */
|
||||
AdminSplitPanel userSplitPanel =
|
||||
new AdminSplitPanel(USER_NAVBAR_TITLE);
|
||||
|
||||
UserBrowsePane browsePane = new UserBrowsePane();
|
||||
|
||||
userSplitPanel.addTab(USER_TAB_SUMMARY,
|
||||
new UserSummaryPane(userSplitPanel, browsePane));
|
||||
userSplitPanel.addTab(USER_TAB_BROWSE,
|
||||
browsePane);
|
||||
userSplitPanel.addTab(USER_TAB_SEARCH,
|
||||
new UserSearchPane(userSplitPanel, browsePane));
|
||||
userSplitPanel.addTab(USER_TAB_CREATE_USER,
|
||||
new CreateUserPane(userSplitPanel));
|
||||
|
||||
|
||||
/*
|
||||
* Create group administration panel
|
||||
/*
|
||||
* Create User split panel.
|
||||
* Note: Will change soon.
|
||||
*/
|
||||
GroupAdministrationTab groupAdministrationTab =
|
||||
new GroupAdministrationTab();
|
||||
final AdminSplitPanel userSplitPanel = new AdminSplitPanel(USER_NAVBAR_TITLE);
|
||||
|
||||
final UserBrowsePane browsePane = new UserBrowsePane();
|
||||
userSplitPanel.addTab(USER_TAB_SUMMARY, new UserSummaryPane(userSplitPanel, browsePane));
|
||||
userSplitPanel.addTab(USER_TAB_BROWSE, browsePane);
|
||||
userSplitPanel.addTab(USER_TAB_SEARCH, new UserSearchPane(userSplitPanel, browsePane));
|
||||
userSplitPanel.addTab(USER_TAB_CREATE_USER, new CreateUserPane(userSplitPanel));
|
||||
|
||||
// Create the Admin's page tab bar, currently 2 elements: user & groups
|
||||
final TabbedPane tabbedPane = new TabbedPane();
|
||||
tabbedPane.setIdAttr("page-body");
|
||||
|
||||
/**
|
||||
* Create and add info tab
|
||||
*/
|
||||
tabbedPane.addTab(INFO_TAB_TITLE, new AdminInfoTab());
|
||||
/*
|
||||
* Create application administration panel
|
||||
*/
|
||||
ApplicationsAdministrationTab appsAdministrationTab =
|
||||
new ApplicationsAdministrationTab();
|
||||
tabbedPane.addTab(APPLICATIONS_TAB_TITLE, new ApplicationsAdministrationTab());
|
||||
/*
|
||||
* Add user panel.
|
||||
*/
|
||||
tabbedPane.addTab(USER_TAB_TITLE, userSplitPanel);
|
||||
/*
|
||||
* Create and add group administration panel
|
||||
*/
|
||||
final GroupAdministrationTab groupAdminTab = new GroupAdministrationTab();
|
||||
tabbedPane.addTab(GROUP_TAB_TITLE, groupAdminTab);
|
||||
|
||||
//SettingsTab settingsTab = new SettingsTab();
|
||||
browsePane.setTabbedPane(tabbedPane);
|
||||
browsePane.setGroupAdministrationTab(groupAdminTab);
|
||||
|
||||
page.add(tabbedPane);
|
||||
page.lock();
|
||||
|
||||
// Create the Admin's page tab bar, currently 2 elements: user & groups
|
||||
TabbedPane tb = new TabbedPane();
|
||||
tb.setIdAttr("page-body");
|
||||
|
||||
tb.addTab(USER_TAB_TITLE, userSplitPanel);
|
||||
tb.addTab(GROUP_TAB_TITLE, groupAdministrationTab);
|
||||
tb.addTab(APPLICATIONS_TAB_TITLE, appsAdministrationTab);
|
||||
//tb.addTab("Settings", settingsTab);
|
||||
|
||||
browsePane.setTabbedPane(tb);
|
||||
browsePane.setGroupAdministrationTab(groupAdministrationTab);
|
||||
//browsePane.setAppsAdministrationTab(appsAdministrationTab);
|
||||
|
||||
p.add(tb);
|
||||
p.lock();
|
||||
|
||||
return p;
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import com.arsdigita.bebop.event.ChangeEvent;
|
|||
import com.arsdigita.bebop.event.ChangeListener;
|
||||
import com.arsdigita.toolbox.ui.LayoutPanel;
|
||||
import com.arsdigita.toolbox.ui.Section;
|
||||
import com.arsdigita.ui.admin.applications.ApplicationCreateForm;
|
||||
import com.arsdigita.ui.admin.applications.ApplicationInstancePane;
|
||||
import com.arsdigita.ui.admin.applications.ApplicationManager;
|
||||
import com.arsdigita.ui.admin.applications.BaseApplicationPane;
|
||||
|
|
|
|||
|
|
@ -18,8 +18,7 @@
|
|||
*/
|
||||
package com.arsdigita.ui.admin;
|
||||
|
||||
|
||||
import com.arsdigita.ui.util.GlobalizationUtil ;
|
||||
import com.arsdigita.ui.util.GlobalizationUtil;
|
||||
|
||||
import com.arsdigita.bebop.ActionLink;
|
||||
import com.arsdigita.bebop.BoxPanel;
|
||||
|
|
@ -58,16 +57,13 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
*/
|
||||
class GroupAdministrationTab extends BoxPanel
|
||||
implements AdminConstants,
|
||||
ChangeListener {
|
||||
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(GroupAdministrationTab.class);
|
||||
implements AdminConstants,
|
||||
ChangeListener {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(GroupAdministrationTab.class);
|
||||
private Tree m_tree;
|
||||
private SearchAndList m_subMemberSearch;
|
||||
private ActionLink m_addSubmemberLink;
|
||||
|
||||
private Component m_groupInfoPanel;
|
||||
private Component m_subGroupPanel;
|
||||
private Component m_subMemberPanel;
|
||||
|
|
@ -78,7 +74,6 @@ class GroupAdministrationTab extends BoxPanel
|
|||
private Component m_existingGroupAddPanel;
|
||||
private ExistingGroupAddPane m_existingGroupAdd;
|
||||
private ArrayList m_panelList = new ArrayList();
|
||||
|
||||
private RequestLocal m_group;
|
||||
|
||||
/**
|
||||
|
|
@ -108,20 +103,20 @@ class GroupAdministrationTab extends BoxPanel
|
|||
m_group.set(ps, group);
|
||||
m_tree.setSelectedKey(ps, id);
|
||||
|
||||
if ( !id.equals("-1") ) {
|
||||
expandGroups (ps, group);
|
||||
if (!id.equals("-1")) {
|
||||
expandGroups(ps, group);
|
||||
m_tree.expand("-1", ps);
|
||||
}
|
||||
}
|
||||
|
||||
private void expandGroups (PageState ps, Group group) {
|
||||
private void expandGroups(PageState ps, Group group) {
|
||||
m_tree.expand(group.getID().toString(), ps);
|
||||
|
||||
GroupCollection superGroups = group.getSupergroups();
|
||||
Group superGroup = null;
|
||||
while (superGroups.next()) {
|
||||
superGroup = (Group)superGroups.getDomainObject();
|
||||
expandGroups (ps, superGroup);
|
||||
superGroup = (Group) superGroups.getDomainObject();
|
||||
expandGroups(ps, superGroup);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -144,13 +139,14 @@ class GroupAdministrationTab extends BoxPanel
|
|||
|
||||
try {
|
||||
group = new Group(id);
|
||||
} catch(DataObjectNotFoundException exc) {
|
||||
} catch (DataObjectNotFoundException exc) {
|
||||
// Silently ignore if group does not
|
||||
// exist.
|
||||
}
|
||||
}
|
||||
return group;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
BoxPanel c = new BoxPanel();
|
||||
|
|
@ -177,7 +173,7 @@ class GroupAdministrationTab extends BoxPanel
|
|||
|
||||
m_groupAddPanel = buildGroupAddPanel(rightSide);
|
||||
m_panelList.add(m_groupAddPanel);
|
||||
|
||||
|
||||
m_existingGroupAddPanel = buildExistingGroupAddPanel(rightSide);
|
||||
m_panelList.add(m_existingGroupAddPanel);
|
||||
|
||||
|
|
@ -197,10 +193,10 @@ class GroupAdministrationTab extends BoxPanel
|
|||
hideAll(ps);
|
||||
m_groupAddPanel.setVisible(ps, true);
|
||||
}
|
||||
|
||||
|
||||
private void displayAddExistingGroupPanel(PageState ps) {
|
||||
hideAll(ps);
|
||||
m_existingGroupAddPanel.setVisible(ps, true);
|
||||
hideAll(ps);
|
||||
m_existingGroupAddPanel.setVisible(ps, true);
|
||||
}
|
||||
|
||||
public void displayEditPanel(PageState ps) {
|
||||
|
|
@ -213,7 +209,7 @@ class GroupAdministrationTab extends BoxPanel
|
|||
m_groupEditPanel.setVisible(ps, false);
|
||||
m_groupAddPanel.setVisible(ps, false);
|
||||
m_groupDeleteFailedPanel.setVisible(ps, false);
|
||||
m_existingGroupAddPanel.setVisible(ps, false);
|
||||
m_existingGroupAddPanel.setVisible(ps, false);
|
||||
}
|
||||
|
||||
public void displayDeleteFailedPanel(PageState ps) {
|
||||
|
|
@ -254,11 +250,12 @@ class GroupAdministrationTab extends BoxPanel
|
|||
ActionLink link = new ActionLink(EDIT_GROUP_LABEL);
|
||||
link.setClassAttr("actionLink");
|
||||
link.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
displayEditPanel(ps);
|
||||
}
|
||||
});
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
displayEditPanel(ps);
|
||||
}
|
||||
|
||||
});
|
||||
body.add(link);
|
||||
|
||||
|
||||
|
|
@ -284,25 +281,27 @@ class GroupAdministrationTab extends BoxPanel
|
|||
|
||||
Label countLabel = new Label("");
|
||||
countLabel.addPrintListener(new PrintListener() {
|
||||
public void prepare(PrintEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
public void prepare(PrintEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
|
||||
Label t = (Label) e.getTarget();
|
||||
Group g = getGroup(ps);
|
||||
if (g != null) {
|
||||
t.setLabel(String.valueOf(g.countSubgroups()));
|
||||
}
|
||||
Label t = (Label) e.getTarget();
|
||||
Group g = getGroup(ps);
|
||||
if (g != null) {
|
||||
t.setLabel(String.valueOf(g.countSubgroups()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
ActionLink status = new ActionLink(countLabel);
|
||||
status.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
String key = (String) m_tree.getSelectedKey(ps);
|
||||
m_tree.expand(key, ps);
|
||||
}
|
||||
});
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
String key = (String) m_tree.getSelectedKey(ps);
|
||||
m_tree.expand(key, ps);
|
||||
}
|
||||
|
||||
});
|
||||
labelStatus.add(status);
|
||||
|
||||
|
||||
|
|
@ -324,54 +323,57 @@ class GroupAdministrationTab extends BoxPanel
|
|||
b.add(removeLink);
|
||||
return b;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
subGroupList.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
String key = (String) ((List) e.getSource()).getSelectedKey(ps);
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
String key = (String) ((List) e.getSource()).getSelectedKey(ps);
|
||||
|
||||
if (key != null) {
|
||||
BigDecimal groupID = new BigDecimal(key);
|
||||
try {
|
||||
Group group = new Group(groupID);
|
||||
Group parent = getGroup(ps);
|
||||
if (parent != null) {
|
||||
parent.removeSubgroup(group);
|
||||
parent.save();
|
||||
}
|
||||
} catch (DataObjectNotFoundException exc) {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
body.add(subGroupList);
|
||||
if (key != null) {
|
||||
BigDecimal groupID = new BigDecimal(key);
|
||||
try {
|
||||
Group group = new Group(groupID);
|
||||
Group parent = getGroup(ps);
|
||||
if (parent != null) {
|
||||
parent.removeSubgroup(group);
|
||||
parent.save();
|
||||
}
|
||||
} catch (DataObjectNotFoundException exc) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
body.add(subGroupList);
|
||||
|
||||
ActionLink addLink = new ActionLink(ADD_SUBGROUP_LABEL);
|
||||
addLink.setClassAttr("actionLink");
|
||||
addLink.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
|
||||
displayAddGroupPanel(ps);
|
||||
}
|
||||
});
|
||||
displayAddGroupPanel(ps);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
body.add(addLink);
|
||||
|
||||
// new actionlink and anonymous ActionListener class added cg
|
||||
ActionLink addExistingLink = new ActionLink(ADD_EXISTING_GROUP_TO_SUBGROUPS_LABEL);
|
||||
addExistingLink.setClassAttr("actionLink");
|
||||
addExistingLink.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
s_log.debug("Add existing group link pressed");
|
||||
PageState ps = e.getPageState();
|
||||
displayAddExistingGroupPanel(ps);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
body.add(addExistingLink);
|
||||
// new actionlink and anonymous ActionListener class added cg
|
||||
ActionLink addExistingLink = new ActionLink(ADD_EXISTING_GROUP_TO_SUBGROUPS_LABEL);
|
||||
addExistingLink.setClassAttr("actionLink");
|
||||
addExistingLink.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
s_log.debug("Add existing group link pressed");
|
||||
PageState ps = e.getPageState();
|
||||
displayAddExistingGroupPanel(ps);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
body.add(addExistingLink);
|
||||
return main.addSegment(SUBGROUP_HEADER, body);
|
||||
|
||||
}
|
||||
|
|
@ -385,8 +387,8 @@ class GroupAdministrationTab extends BoxPanel
|
|||
}
|
||||
|
||||
private Component buildExistingGroupAddPanel(SegmentedPanel main) {
|
||||
m_existingGroupAdd = new ExistingGroupAddPane(m_tree, this);
|
||||
return main.addSegment(ADD_EXISTING_GROUP_TO_SUBGROUPS_LABEL, m_existingGroupAdd);
|
||||
m_existingGroupAdd = new ExistingGroupAddPane(m_tree, this);
|
||||
return main.addSegment(ADD_EXISTING_GROUP_TO_SUBGROUPS_LABEL, m_existingGroupAdd);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -395,53 +397,56 @@ class GroupAdministrationTab extends BoxPanel
|
|||
private Component buildMemberListPanel(SegmentedPanel main) {
|
||||
|
||||
BoxPanel body = new BoxPanel() {
|
||||
@Override
|
||||
public void register(Page p) {
|
||||
p.setVisibleDefault(m_subMemberSearch, false);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public void register(Page p) {
|
||||
p.setVisibleDefault(m_subMemberSearch, false);
|
||||
}
|
||||
|
||||
};
|
||||
body.add(new SubMemberPanel(this));
|
||||
|
||||
m_addSubmemberLink = new ActionLink(ADD_SUBMEMBER_LABEL);
|
||||
m_addSubmemberLink.setClassAttr("actionLink");
|
||||
m_addSubmemberLink.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
m_addSubmemberLink.setVisible(ps, false);
|
||||
m_subMemberSearch.setVisible(ps, true);
|
||||
}
|
||||
});
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
m_addSubmemberLink.setVisible(ps, false);
|
||||
m_subMemberSearch.setVisible(ps, true);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
m_subMemberSearch = new SearchAndList("searchsubmember");
|
||||
m_subMemberSearch.setListModel(new UserSearchAndListModel());
|
||||
m_subMemberSearch.addChangeListener(new ChangeListener() {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
|
||||
String key = (String) m_subMemberSearch.getSelectedKey(ps);
|
||||
if (key != null) {
|
||||
BigDecimal userID = new BigDecimal(key);
|
||||
String key = (String) m_subMemberSearch.getSelectedKey(ps);
|
||||
if (key != null) {
|
||||
BigDecimal userID = new BigDecimal(key);
|
||||
|
||||
Group group = getGroup(ps);
|
||||
Group group = getGroup(ps);
|
||||
|
||||
if (group != null) {
|
||||
try {
|
||||
User user = User.retrieve(userID);
|
||||
group.addMember(user);
|
||||
group.save();
|
||||
} catch (DataObjectNotFoundException exc) {
|
||||
// Ignore if user id is not valid
|
||||
} catch (PersistenceException pexc) {
|
||||
// Display error message that user
|
||||
// already existed in group.
|
||||
}
|
||||
if (group != null) {
|
||||
try {
|
||||
User user = User.retrieve(userID);
|
||||
group.addMember(user);
|
||||
group.save();
|
||||
} catch (DataObjectNotFoundException exc) {
|
||||
// Ignore if user id is not valid
|
||||
} catch (PersistenceException pexc) {
|
||||
// Display error message that user
|
||||
// already existed in group.
|
||||
}
|
||||
}
|
||||
m_subMemberSearch.reset(ps);
|
||||
m_subMemberSearch.setVisible(ps, false);
|
||||
m_addSubmemberLink.setVisible(ps, true);
|
||||
}
|
||||
});
|
||||
m_subMemberSearch.reset(ps);
|
||||
m_subMemberSearch.setVisible(ps, false);
|
||||
m_addSubmemberLink.setVisible(ps, true);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
body.add(m_subMemberSearch);
|
||||
body.add(m_addSubmemberLink);
|
||||
|
|
@ -459,24 +464,25 @@ class GroupAdministrationTab extends BoxPanel
|
|||
deleteLink.setClassAttr("actionLink");
|
||||
deleteLink.setConfirmation(GROUP_DELETE_CONFIRMATION);
|
||||
deleteLink.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
PageState ps = e.getPageState();
|
||||
PageState ps = e.getPageState();
|
||||
|
||||
Group g = (Group) m_group.get(ps);
|
||||
if (g != null) {
|
||||
try {
|
||||
g.delete();
|
||||
m_tree.setSelectedKey(ps, "-1");
|
||||
} catch(PersistenceException exc) {
|
||||
s_log.warn("Error deleting subgroup", exc);
|
||||
displayDeleteFailedPanel(ps);
|
||||
}
|
||||
Group g = (Group) m_group.get(ps);
|
||||
if (g != null) {
|
||||
try {
|
||||
g.delete();
|
||||
m_tree.setSelectedKey(ps, "-1");
|
||||
} catch (PersistenceException exc) {
|
||||
s_log.warn("Error deleting subgroup", exc);
|
||||
displayDeleteFailedPanel(ps);
|
||||
}
|
||||
// Select root node
|
||||
|
||||
}
|
||||
});
|
||||
// Select root node
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
body.add(deleteLink);
|
||||
return main.addSegment(GROUP_EXTREME_ACTIONS_HEADER,
|
||||
body);
|
||||
|
|
@ -490,11 +496,12 @@ class GroupAdministrationTab extends BoxPanel
|
|||
private Component buildGroupDeleteFailedPanel(SegmentedPanel main) {
|
||||
ActionLink link = new ActionLink(GROUP_ACTION_CONTINUE);
|
||||
link.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
displayGroupInfoPanel(ps);
|
||||
}
|
||||
});
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
displayGroupInfoPanel(ps);
|
||||
}
|
||||
|
||||
});
|
||||
link.setClassAttr("actionLink");
|
||||
|
||||
Label label = new Label(GROUP_DELETE_FAILED_MSG);
|
||||
|
|
@ -513,27 +520,27 @@ class GroupAdministrationTab extends BoxPanel
|
|||
*/
|
||||
private void hideAll(PageState ps) {
|
||||
for (int i = 0; i < m_panelList.size(); i++) {
|
||||
((Component) m_panelList.get(i)).setVisible
|
||||
(ps, false);
|
||||
((Component) m_panelList.get(i)).setVisible(ps, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all components of the in preparation for
|
||||
* turning visibility of selected components off .
|
||||
*/
|
||||
private void showAll(PageState ps) {
|
||||
for (int i = 0; i < m_panelList.size(); i++) {
|
||||
((Component) m_panelList.get(i)).setVisible
|
||||
(ps, true);
|
||||
((Component) m_panelList.get(i)).setVisible(ps, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class SubGroupListModelBuilder extends LockableImpl
|
||||
implements ListModelBuilder {
|
||||
implements ListModelBuilder {
|
||||
|
||||
private GroupAdministrationTab m_parent;
|
||||
|
||||
public SubGroupListModelBuilder(GroupAdministrationTab parent) {
|
||||
m_parent = parent;
|
||||
}
|
||||
|
|
@ -547,6 +554,7 @@ class SubGroupListModelBuilder extends LockableImpl
|
|||
|
||||
return new SubGroupListModel(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -593,4 +601,5 @@ class SubGroupListModel implements ListModel {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue