001: /*
002: * File : $Source: /usr/local/cvs/alkacon/com.alkacon.opencms.newsletter/src/com/alkacon/opencms/newsletter/admin/CmsShowMailinglistSubscribersList.java,v $
003: * Date : $Date: 2007-11-30 11:57:27 $
004: * Version: $Revision: 1.6 $
005: *
006: * This file is part of the Alkacon OpenCms Add-On Module Package
007: *
008: * Copyright (c) 2007 Alkacon Software GmbH (http://www.alkacon.com)
009: *
010: * The Alkacon OpenCms Add-On Module Package is free software:
011: * you can redistribute it and/or modify
012: * it under the terms of the GNU General Public License as published by
013: * the Free Software Foundation, either version 3 of the License, or
014: * (at your option) any later version.
015: *
016: * The Alkacon OpenCms Add-On Module Package is distributed
017: * in the hope that it will be useful,
018: * but WITHOUT ANY WARRANTY; without even the implied warranty of
019: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
020: * GNU General Public License for more details.
021: *
022: * You should have received a copy of the GNU General Public License
023: * along with the Alkacon OpenCms Add-On Module Package.
024: * If not, see http://www.gnu.org/licenses/.
025: *
026: * For further information about Alkacon Software GmbH, please see the
027: * company website: http://www.alkacon.com.
028: *
029: * For further information about OpenCms, please see the
030: * project website: http://www.opencms.org.
031: */
032:
033: package com.alkacon.opencms.newsletter.admin;
034:
035: import org.opencms.jsp.CmsJspActionElement;
036: import org.opencms.util.CmsStringUtil;
037: import org.opencms.workplace.CmsDialog;
038: import org.opencms.workplace.list.CmsListColumnDefinition;
039: import org.opencms.workplace.list.CmsListDefaultAction;
040: import org.opencms.workplace.list.CmsListItem;
041: import org.opencms.workplace.list.CmsListMetadata;
042: import org.opencms.workplace.list.I_CmsListDirectAction;
043: import org.opencms.workplace.tools.accounts.A_CmsEditUserDialog;
044: import org.opencms.workplace.tools.accounts.A_CmsOrgUnitDialog;
045: import org.opencms.workplace.tools.accounts.CmsShowGroupUsersList;
046:
047: import java.io.IOException;
048: import java.util.HashMap;
049: import java.util.Map;
050:
051: import javax.servlet.ServletException;
052: import javax.servlet.http.HttpServletRequest;
053: import javax.servlet.http.HttpServletResponse;
054: import javax.servlet.jsp.PageContext;
055:
056: /**
057: * Mailing list subscribers overview view.<p>
058: *
059: * @author Michael Moossen
060: * @author Andreas Zahner
061: *
062: * @version $Revision: 1.6 $
063: *
064: * @since 7.0.3
065: */
066: public class CmsShowMailinglistSubscribersList extends
067: CmsShowGroupUsersList {
068:
069: /**
070: * Public constructor.<p>
071: *
072: * @param jsp an initialized JSP action element
073: */
074: public CmsShowMailinglistSubscribersList(CmsJspActionElement jsp) {
075:
076: super (jsp, LIST_ID + "l");
077: getList()
078: .setName(
079: Messages
080: .get()
081: .container(
082: Messages.GUI_MAILINGLISTSUBSCRIBERS_LIST_NAME_0));
083: }
084:
085: /**
086: * Public constructor with JSP variables.<p>
087: *
088: * @param context the JSP page context
089: * @param req the JSP request
090: * @param res the JSP response
091: */
092: public CmsShowMailinglistSubscribersList(PageContext context,
093: HttpServletRequest req, HttpServletResponse res) {
094:
095: this (new CmsJspActionElement(context, req, res));
096: }
097:
098: /**
099: * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions()
100: */
101: public void executeListSingleActions() throws IOException,
102: ServletException {
103:
104: String userId = getSelectedItem().getId();
105:
106: Map params = new HashMap();
107: params.put(CmsDialog.PARAM_ACTION, CmsDialog.DIALOG_INITIAL);
108: params.put(A_CmsEditUserDialog.PARAM_USERID, userId);
109: params.put(A_CmsOrgUnitDialog.PARAM_OUFQN, getParamOufqn());
110:
111: if (getParamListAction().equals(LIST_ACTION_EDIT)) {
112: getToolManager()
113: .jspForwardTool(
114: this ,
115: "/newsletter/orgunit/subscribers/edit/user",
116: params);
117: } else {
118: throwListUnsupportedActionException();
119: }
120: }
121:
122: /**
123: * @see org.opencms.workplace.tools.accounts.A_CmsGroupUsersList#getIconPath(org.opencms.workplace.list.CmsListItem)
124: */
125: public String getIconPath(CmsListItem item) {
126:
127: return "tools/newsletter/buttons/subscriber.png";
128: }
129:
130: /**
131: * @see org.opencms.workplace.CmsWorkplace#initMessages()
132: */
133: protected void initMessages() {
134:
135: // add specific dialog resource bundle
136: addMessages(Messages.get().getBundleName());
137: // add default resource bundles
138: super .initMessages();
139: }
140:
141: /**
142: * @see org.opencms.workplace.tools.accounts.A_CmsGroupUsersList#setColumns(org.opencms.workplace.list.CmsListMetadata)
143: */
144: protected void setColumns(CmsListMetadata metadata) {
145:
146: super .setColumns(metadata);
147:
148: CmsListColumnDefinition iconCol = metadata
149: .getColumnDefinition(LIST_COLUMN_ICON);
150: iconCol.setName(Messages.get().container(
151: Messages.GUI_SUBSCRIBERS_LIST_COLS_ICON_0));
152: iconCol.setHelpText(Messages.get().container(
153: Messages.GUI_SUBSCRIBERS_LIST_COLS_ICON_HELP_0));
154:
155: CmsListColumnDefinition nameCol = metadata
156: .getColumnDefinition(LIST_COLUMN_NAME);
157: nameCol.setName(Messages.get().container(
158: Messages.GUI_SUBSCRIBERS_LIST_COLS_EMAIL_0));
159: nameCol.setWidth("100%");
160:
161: CmsListDefaultAction defAction = nameCol
162: .getDefaultAction(LIST_ACTION_EDIT);
163: defAction.setName(Messages.get().container(
164: Messages.GUI_SUBSCRIBERS_LIST_DEFACTION_EDIT_NAME_0));
165: defAction.setHelpText(Messages.get().container(
166: Messages.GUI_SUBSCRIBERS_LIST_DEFACTION_EDIT_HELP_0));
167:
168: I_CmsListDirectAction iconAction = iconCol
169: .getDirectAction(LIST_ACTION_ICON);
170: iconAction.setName(Messages.get().container(
171: Messages.GUI_SUBSCRIBERS_LIST_INMAILINGLIST_NAME_0));
172: iconAction.setHelpText(Messages.get().container(
173: Messages.GUI_SUBSCRIBERS_LIST_INMAILINGLIST_HELP_0));
174:
175: metadata.getColumnDefinition(LIST_COLUMN_FULLNAME).setVisible(
176: false);
177: }
178:
179: /**
180: * @see org.opencms.workplace.tools.accounts.A_CmsGroupUsersList#validateParamaters()
181: */
182: protected void validateParamaters() throws Exception {
183:
184: super .validateParamaters();
185: // this is to prevent the switch to the root ou
186: // if the oufqn param get lost (by reloading for example)
187: if (CmsStringUtil.isEmptyOrWhitespaceOnly(getParamOufqn())) {
188: throw new Exception();
189: }
190: }
191: }
|