001: /*
002: * File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/administration/CmsAdminDialog.java,v $
003: * Date : $Date: 2008-02-27 12:05:38 $
004: * Version: $Revision: 1.12 $
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.administration;
033:
034: import org.opencms.jsp.CmsJspActionElement;
035: import org.opencms.workplace.CmsDialog;
036: import org.opencms.workplace.tools.CmsExplorerDialog;
037: import org.opencms.workplace.tools.CmsToolManager;
038:
039: import java.util.Map;
040:
041: import javax.servlet.http.HttpServletRequest;
042: import javax.servlet.http.HttpServletResponse;
043: import javax.servlet.jsp.JspWriter;
044: import javax.servlet.jsp.PageContext;
045:
046: /**
047: * Workplace class for /system/workplace/views/admin/admin-main.jsp .<p>
048: *
049: * @author Michael Moossen
050: *
051: * @version $Revision: 1.12 $
052: *
053: * @since 6.0.0
054: */
055: public class CmsAdminDialog extends CmsDialog {
056:
057: /**
058: * Public constructor with JSP action element.<p>
059: *
060: * @param jsp an initialized JSP action element
061: */
062: public CmsAdminDialog(CmsJspActionElement jsp) {
063:
064: super (jsp);
065: }
066:
067: /**
068: * Public constructor with JSP variables.<p>
069: *
070: * @param context the JSP page context
071: * @param req the JSP request
072: * @param res the JSP response
073: */
074: public CmsAdminDialog(PageContext context, HttpServletRequest req,
075: HttpServletResponse res) {
076:
077: this (new CmsJspActionElement(context, req, res));
078: }
079:
080: /**
081: * Performs the dialog actions depending on the initialized action and displays the dialog form.<p>
082: *
083: * @throws Exception if writing to the JSP out fails
084: */
085: public void displayDialog() throws Exception {
086:
087: Map params = initAdminTool();
088:
089: // explorer view dialogs
090: if (CmsExplorerDialog.EXPLORER_TOOLS
091: .contains(getCurrentToolPath())) {
092: if (getAction() == CmsDialog.ACTION_CANCEL) {
093: actionCloseDialog();
094: return;
095: }
096: getToolManager().jspForwardPage(
097: this ,
098: CmsToolManager.ADMINVIEW_ROOT_LOCATION
099: + "/tool-fs.jsp", params);
100: return;
101: }
102:
103: // real tool
104: if (!getAdminTool().getHandler().getLink().equals(
105: getCms().getRequestContext().getUri())) {
106: getToolManager().jspForwardPage(this ,
107: getAdminTool().getHandler().getLink(), params);
108: return;
109: }
110:
111: // just grouping
112: if (getAction() == CmsDialog.ACTION_CANCEL) {
113: actionCloseDialog();
114: return;
115: }
116:
117: JspWriter out = getJsp().getJspContext().getOut();
118: out.print(htmlStart());
119: out.print(bodyStart(null));
120: out.print(dialogStart());
121: out.print(dialogContentStart(getParamTitle()));
122: out.print(dialogContentEnd());
123: out.print(dialogEnd());
124: out.print(bodyEnd());
125: out.print(htmlEnd());
126: }
127: }
|