001: /*
002: * File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/accounts/CmsOrgUnitOverviewDialog.java,v $
003: * Date : $Date: 2008-02-27 12:05:26 $
004: * Version: $Revision: 1.5 $
005: *
006: * This library is part of OpenCms -
007: * the Open Source Content Management System
008: *
009: * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
010: *
011: * This library is free software; you can redistribute it and/or
012: * modify it under the terms of the GNU Lesser General Public
013: * License as published by the Free Software Foundation; either
014: * version 2.1 of the License, or (at your option) any later version.
015: *
016: * This library is distributed in the hope that it will be useful,
017: * but WITHOUT ANY WARRANTY; without even the implied warranty of
018: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: * Lesser General Public License for more details.
020: *
021: * For further information about Alkacon Software GmbH, please see the
022: * company website: http://www.alkacon.com
023: *
024: * For further information about OpenCms, please see the
025: * project website: http://www.opencms.org
026: *
027: * You should have received a copy of the GNU Lesser General Public
028: * License along with this library; if not, write to the Free Software
029: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
030: */
031:
032: package org.opencms.workplace.tools.accounts;
033:
034: import org.opencms.main.OpenCms;
035: import org.opencms.security.CmsOrganizationalUnit;
036: import org.opencms.widgets.CmsDisplayWidget;
037: import org.opencms.workplace.CmsWidgetDialogParameter;
038:
039: import javax.servlet.http.HttpServletRequest;
040: import javax.servlet.http.HttpServletResponse;
041: import javax.servlet.jsp.PageContext;
042:
043: /**
044: * Dialog to get an overview of an organizational unit in the administration view.<p>
045: *
046: * @author Raphael Schnuck
047: *
048: * @version $Revision: 1.5 $
049: *
050: * @since 6.5.6
051: */
052: public class CmsOrgUnitOverviewDialog extends A_CmsOrgUnitDialog {
053:
054: /**
055: * Public constructor with JSP variables.<p>
056: *
057: * @param context the JSP page context
058: * @param req the JSP request
059: * @param res the JSP response
060: */
061: public CmsOrgUnitOverviewDialog(PageContext context,
062: HttpServletRequest req, HttpServletResponse res) {
063:
064: super (context, req, res);
065: }
066:
067: /**
068: * @see org.opencms.workplace.CmsWidgetDialog#actionCommit()
069: */
070: public void actionCommit() {
071:
072: // noop
073: }
074:
075: /**
076: * Creates the dialog HTML for all defined widgets of the named dialog (page).<p>
077: *
078: * This overwrites the method from the super class to create a layout variation for the widgets.<p>
079: *
080: * @param dialog the dialog (page) to get the HTML for
081: * @return the dialog HTML for all defined widgets of the named dialog (page)
082: */
083: protected String createDialogHtml(String dialog) {
084:
085: StringBuffer result = new StringBuffer(1024);
086:
087: result.append(createWidgetTableStart());
088: // show error header once if there were validation errors
089: result.append(createWidgetErrorHeader());
090:
091: if (dialog.equals(PAGES[0])) {
092: // create the widgets for the first dialog page
093: result
094: .append(dialogBlockStart(key(Messages.GUI_ORGUNIT_EDITOR_LABEL_IDENTIFICATION_BLOCK_0)));
095: result.append(createWidgetTableStart());
096: result.append(createDialogRowsHtml(0, 2));
097: result.append(createWidgetTableEnd());
098: result.append(dialogBlockEnd());
099: }
100:
101: result.append(createWidgetTableEnd());
102: return result.toString();
103: }
104:
105: /**
106: * @see org.opencms.workplace.CmsWidgetDialog#defaultActionHtmlEnd()
107: */
108: protected String defaultActionHtmlEnd() {
109:
110: return "";
111: }
112:
113: /**
114: * @see org.opencms.workplace.CmsWidgetDialog#defineWidgets()
115: */
116: protected void defineWidgets() {
117:
118: // initialize the user object to use for the dialog
119: initOrgUnitObject();
120:
121: setKeyPrefix(KEY_PREFIX);
122:
123: // widgets to display
124: addWidget(new CmsWidgetDialogParameter(m_orgUnitBean, "name",
125: PAGES[0], new CmsDisplayWidget()));
126: addWidget(new CmsWidgetDialogParameter(m_orgUnitBean,
127: "description", PAGES[0], new CmsDisplayWidget()));
128: addWidget(new CmsWidgetDialogParameter(m_orgUnitBean,
129: "parentOu", PAGES[0], new CmsDisplayWidget()));
130: }
131:
132: /**
133: * Initializes the organizational unit object to work with depending on the dialog state and request parameters.<p>
134: *
135: */
136: protected void initOrgUnitObject() {
137:
138: try {
139: CmsOrganizationalUnit orgunit = OpenCms.getOrgUnitManager()
140: .readOrganizationalUnit(getCms(), getParamOufqn());
141: m_orgUnitBean = new CmsOrgUnitBean();
142: m_orgUnitBean.setDescription(orgunit
143: .getDescription(getLocale()));
144: m_orgUnitBean.setName(orgunit.getName());
145: if (!orgunit.getName().equals("")) {
146: m_orgUnitBean.setParentOu(orgunit.getParentFqn());
147: }
148: m_orgUnitBean.setFqn(orgunit.getName());
149: m_orgUnitBean.setResources(OpenCms.getOrgUnitManager()
150: .getResourcesForOrganizationalUnit(getCms(),
151: orgunit.getName()));
152: } catch (Exception e) {
153: // noop
154: }
155: }
156: }
|