KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2 * File : $Source: /usr/local/cvs/opencms/src-modules/com/opencms/workplace/CmsButtonJavascript.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
30 package com.opencms.workplace;
31
32 import org.opencms.file.CmsObject;
33 import org.opencms.main.CmsException;
34
35 import com.opencms.template.A_CmsXmlContent;
36
37 import java.util.Hashtable JavaDoc;
38
39 import org.w3c.dom.Element JavaDoc;
40
41 /**
42  * Class for building workplace javascript buttons. <BR>
43  * Those buttons are embedded in JavaScript Code.
44  * Called by CmsXmlTemplateFile for handling the special XML tag <code>&lt;JAVASCRIPTBUTTON&gt;</code>.
45  *
46  * @author Michael Emmerich
47  * @version $Revision: 1.2 $ $Date: 2005/06/27 23:22:07 $
48  * @see com.opencms.workplace.CmsXmlWpTemplateFile
49  *
50  * @deprecated Will not be supported past the OpenCms 6 release.
51  */

52
53 public class CmsButtonJavascript extends A_CmsWpElement {
54     
55     /**
56      * Handling of the special workplace <CODE>&lt;JAVASCRIPTBUTTON&gt;</CODE> tags.
57      * <P>
58      * Reads the code of a javascript button from the buttons definition file
59      * and returns the processed code with the actual elements.
60      * <P>
61      * Buttons can be referenced in any workplace template by <br>
62      * <CODE>&lt;JAVASCRIPTBUTTON name="..." action="..." alt="..."/&gt;</CODE>
63      *
64      * @param cms CmsObject Object for accessing resources.
65      * @param n XML element containing the <code>&lt;JAVASCRIPTBUTTON&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 <em>(not used here)</em>.
68      * @param parameters Hashtable containing all user parameters <em>(not used here)</em>.
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         // Read button parameters
78
String JavaDoc buttonName = n.getAttribute(CmsWorkplaceDefault.C_BUTTON_NAME);
79         String JavaDoc buttonAction = n.getAttribute(CmsWorkplaceDefault.C_BUTTON_ACTION);
80         String JavaDoc buttonAlt = n.getAttribute(CmsWorkplaceDefault.C_BUTTON_ALT);
81         String JavaDoc buttonHref = n.getAttribute(CmsWorkplaceDefault.C_BUTTON_HREF);
82         if(buttonHref == null || "".equals(buttonHref)) {
83             buttonHref = "";
84         }
85         
86         // Get button definition and language values
87
CmsXmlWpButtonsDefFile buttondef = getButtonDefinitions(cms);
88         buttonAlt = lang.getLanguageValue(CmsWorkplaceDefault.C_LANG_BUTTON + "." + buttonAlt);
89         
90         // get the processed button.
91
String JavaDoc result = buttondef.getJavascriptButton(buttonName, buttonAction,
92                 buttonAlt, buttonHref, callingObject);
93         return result;
94     }
95 }
96
Popular Tags