KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opencms > workplace > CmsMessagebox


1 /*
2 * File : $Source: /usr/local/cvs/opencms/src-modules/com/opencms/workplace/CmsMessagebox.java,v $
3 * Date : $Date: 2005/06/27 23:22:07 $
4 * Version: $Revision: 1.2 $
5 *
6 * This library is part of OpenCms -
7 * the Open Source Content Mananagement System
8 *
9 * Copyright (C) 2001 The OpenCms Group
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * For further information about OpenCms, please see the
22 * OpenCms Website: http://www.opencms.org
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 */

28
29 package com.opencms.workplace;
30
31 import org.opencms.file.CmsObject;
32 import org.opencms.main.CmsException;
33
34 import com.opencms.legacy.CmsXmlTemplateLoader;
35 import com.opencms.template.A_CmsXmlContent;
36
37 import java.util.Hashtable JavaDoc;
38
39 import org.w3c.dom.Element JavaDoc;
40 import org.w3c.dom.Node JavaDoc;
41
42 /**
43  * Class for building workplace message boxes. <BR>
44  * Called by CmsXmlTemplateFile for handling the special XML tag <code>&lt;MESSAGEBOX&gt;</code>.
45  *
46  * @author Michael Emmerich
47  * @author Michaela Schleich
48  * @version $Revision: 1.2 $ $Date: 2005/06/27 23:22:07 $
49  *
50  * @deprecated Will not be supported past the OpenCms 6 release.
51  */

52
53 public class CmsMessagebox extends A_CmsWpElement {
54     
55     /**
56      * Handling of the <CODE>&lt;MESSAGEBOX&gt;</CODE> tags.
57      * <P>
58      * Reads the code of a error box from the errors definition file
59      * and returns the processed code with the actual elements.
60      * <P>
61      * Error boxes can be referenced in any workplace template by <br>
62      * <CODE>&lt;MESSAGEBOX name="..." action="..." alt="..."/&gt;</CODE>
63      *
64      * @param cms CmsObject Object for accessing resources.
65      * @param An XML element containing the <code>&lt;MESSAGEBOX&gt;</code> tag.
66      * @param doc Reference to the A_CmsXmlContent object of the initiating XLM document.
67      * @param callingObject reference to the calling object.
68      * @param parameters Hashtable containing all user parameters.
69      * @param lang CmsXmlLanguageFile conataining the currently valid language file.
70      * @return Processed button.
71      * @throws CmsException
72      */

73     
74     public Object JavaDoc handleSpecialWorkplaceTag(CmsObject cms, Element JavaDoc n, A_CmsXmlContent doc,
75             Object JavaDoc callingObject, Hashtable JavaDoc parameters, CmsXmlLanguageFile lang) throws CmsException {
76         
77         // collect all required data
78
Node JavaDoc helpfilename = null;
79         String JavaDoc helpname = null;
80         String JavaDoc messageTitle = n.getAttribute(CmsWorkplaceDefault.C_MESSAGE_TITLE);
81         String JavaDoc messageMessage1 = n.getAttribute(CmsWorkplaceDefault.C_MESSAGE_MESSAGE1);
82         String JavaDoc messageMessage2 = n.getAttribute(CmsWorkplaceDefault.C_MESSAGE_MESSAGE2);
83         String JavaDoc messageButton1 = n.getAttribute(CmsWorkplaceDefault.C_MESSAGE_BUTTON1);
84         String JavaDoc messageButton2 = n.getAttribute(CmsWorkplaceDefault.C_MESSAGE_BUTTON2);
85         String JavaDoc messageLink1 = n.getAttribute(CmsWorkplaceDefault.C_MESSAGE_LINK1);
86         String JavaDoc messageLink2 = n.getAttribute(CmsWorkplaceDefault.C_MESSAGE_LINK2);
87         if ("explorer_files.html".equals(messageLink1)) {
88             messageLink1 = CmsWorkplaceAction.getExplorerFileUri(CmsXmlTemplateLoader.getRequest(cms.getRequestContext()).getOriginalRequest());
89         }
90         if ("explorer_files.html".equals(messageLink2)) {
91             messageLink2 = CmsWorkplaceAction.getExplorerFileUri(CmsXmlTemplateLoader.getRequest(cms.getRequestContext()).getOriginalRequest());
92         }
93         if(n.hasChildNodes()) {
94             helpfilename = n.getFirstChild();
95             helpname = helpfilename.getNodeValue();
96         }
97         CmsXmlWpBoxDefFile boxdef = getBoxDefinitions(cms);
98         
99         // get the data from the language file
100
messageTitle = lang.getLanguageValue(messageTitle);
101         if(helpfilename != null) {
102             messageTitle = messageTitle + ": " + helpname;
103         }
104         messageMessage1 = lang.getLanguageValue(messageMessage1);
105         messageMessage2 = lang.getLanguageValue(messageMessage2);
106         messageButton1 = lang.getLanguageValue(messageButton1);
107         messageButton2 = lang.getLanguageValue(messageButton2);
108         
109         // build errorbox
110
String JavaDoc result = boxdef.getMessagebox(messageTitle, messageMessage1, messageMessage2,
111                 messageButton1, messageButton2, messageLink1, messageLink2);
112         return result;
113     }
114     
115     /**
116      * Indicates if the results of this class are cacheable.
117      *
118      * @param cms CmsObject Object for accessing system resources
119      * @param templateFile Filename of the template file
120      * @param elementName Element name of this template in our parent template.
121      * @param parameters Hashtable with all template class parameters.
122      * @param templateSelector template section that should be processed.
123      * @return <EM>true</EM> if cacheable, <EM>false</EM> otherwise.
124      */

125     
126     public boolean isCacheable(CmsObject cms, String JavaDoc templateFile, String JavaDoc elementName,
127             Hashtable JavaDoc parameters, String JavaDoc templateSelector) {
128         return false;
129     }
130 }
131
Popular Tags