01: /*
02: * FCKeditor - The text editor for internet
03: * Copyright (C) 2003-2005 Frederico Caldeira Knabben
04: *
05: * Licensed under the terms of the GNU Lesser General Public License:
06: * http://www.opensource.org/licenses/lgpl-license.php
07: *
08: * For further information visit:
09: * http://www.fckeditor.net/
10: *
11: * File Name: FCKeditorConfigurations.java
12: * FCKeditor configurations container.
13: *
14: * Version: 2.3
15: * Modified: 2005-08-11 16:29:00
16: *
17: * File Authors:
18: * Simone Chiaretta (simo@users.sourceforge.net)
19: */
20:
21: package com.fredck.FCKeditor;
22:
23: import java.util.*;
24:
25: /**
26: * Contains the configuration settings for the FCKEditor.<br>
27: * Adding element to this collection you can override the settings specified in the config.js file.
28: *
29: * @author Simone Chiaretta (simo@users.sourceforge.net)
30: */
31: public class FCKeditorConfigurations extends HashMap {
32:
33: /**
34: * Initialize the configuration collection
35: */
36: public FCKeditorConfigurations() {
37: super ();
38: }
39:
40: /**
41: * Generate the url parameter sequence used to pass this configuration to the editor.
42: *
43: *
44: *@return html endocode sequence of configuration parameters
45: */
46: public String getUrlParams() {
47: StringBuffer osParams = new StringBuffer();
48:
49: for (Iterator i = this .entrySet().iterator(); i.hasNext();) {
50: Map.Entry entry = (Map.Entry) i.next();
51: if (entry.getValue() != null)
52: osParams.append("&"
53: + encodeConfig(entry.getKey().toString()) + "="
54: + encodeConfig(entry.getValue().toString()));
55: }
56: return osParams.toString();
57: }
58:
59: private String encodeConfig(String txt) {
60: txt = txt.replaceAll("&", "%26");
61: txt = txt.replaceAll("=", "%3D");
62: txt = txt.replaceAll("\"", "%22");
63: return txt;
64: }
65:
66: }
|