001: /*
002: * File : $Source: /usr/local/cvs/alkacon/com.alkacon.opencms.newsletter/src/com/alkacon/opencms/newsletter/admin/CmsOrgUnitsSubList.java,v $
003: * Date : $Date: 2007-11-30 11:57:27 $
004: * Version: $Revision: 1.4 $
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 com.alkacon.opencms.newsletter.CmsNewsletterManager;
036:
037: import org.opencms.jsp.CmsJspActionElement;
038: import org.opencms.main.OpenCms;
039: import org.opencms.security.CmsOrganizationalUnit;
040:
041: import java.util.Iterator;
042: import java.util.List;
043:
044: import javax.servlet.http.HttpServletRequest;
045: import javax.servlet.http.HttpServletResponse;
046: import javax.servlet.jsp.PageContext;
047:
048: /**
049: * Deletes the newsletter OU from the current organizational unit.<p>
050: *
051: * @author Andreas Zahner
052: *
053: * @version $Revision: 1.4 $
054: *
055: * @since 7.0.3
056: */
057: public class CmsOrgUnitsSubList extends
058: org.opencms.workplace.tools.accounts.CmsOrgUnitsSubList {
059:
060: /**
061: * Public constructor.<p>
062: *
063: * @param jsp an initialized JSP action element
064: */
065: public CmsOrgUnitsSubList(CmsJspActionElement jsp) {
066:
067: super (jsp);
068: getList().setName(
069: Messages.get().container(
070: Messages.GUI_NEWSLETTER_ORGUNITS_LIST_NAME_0));
071: }
072:
073: /**
074: * Public constructor with JSP variables.<p>
075: *
076: * @param context the JSP page context
077: * @param req the JSP request
078: * @param res the JSP response
079: */
080: public CmsOrgUnitsSubList(PageContext context,
081: HttpServletRequest req, HttpServletResponse res) {
082:
083: this (new CmsJspActionElement(context, req, res));
084: }
085:
086: /**
087: * Deletes the given organizational unit.<p>
088: *
089: * @throws Exception if something goes wrong
090: */
091: public void actionDelete() throws Exception {
092:
093: List childOus = OpenCms.getOrgUnitManager()
094: .getOrganizationalUnits(getCms(), getParamOufqn(),
095: false);
096: Iterator i = childOus.iterator();
097: while (i.hasNext()) {
098: CmsOrganizationalUnit unit = (CmsOrganizationalUnit) i
099: .next();
100: if (unit.getSimpleName().startsWith(
101: CmsNewsletterManager.NEWSLETTER_OU_NAMEPREFIX)) {
102: // found a newsletter OU, we can delete it
103: OpenCms.getOrgUnitManager().deleteOrganizationalUnit(
104: getCms(), unit.getName());
105: }
106: }
107: actionCloseDialog();
108: }
109:
110: }
|