Ticket #3660: 3660.patch
File 3660.patch, 5.6 KB (added by , 14 years ago) |
---|
-
java-core/src/main/resources/META-INF/FCKeditor.tld
56 56 </attribute> 57 57 <attribute> 58 58 <description> 59 The parameter name to use when passing this content in 60 a HTTPRequest. If not passed, parameter name is the 61 same as instanceName 62 </description> 63 <name>name</name> 64 <required>false</required> 65 <rtexprvalue>false</rtexprvalue> 66 <type>java.lang.String</type> 67 </attribute> 68 <attribute> 69 <description> 59 70 Width of the FCKeditor instance in the browser window. 60 71 </description> 61 72 <name>width</name> -
java-core/src/main/java/net/fckeditor/tags/EditorTag.java
48 48 private String toolbarSet; 49 49 private String value; 50 50 private String basePath; 51 private String name; 51 52 52 53 /** The underlying FCKeditor instance */ 53 54 private transient FCKeditor fckEditor; … … 58 59 public void setInstanceName(String instanceName) { 59 60 this.instanceName = instanceName; 60 61 } 62 63 /** 64 * @see FCKeditor#setName(String) 65 */ 66 public void setName(String name) { 67 this.name = name; 68 } 61 69 62 70 /** 63 71 * @see FCKeditor#setWidth(String) … … 128 136 fckEditor.setValue(value); 129 137 if (Utils.isNotEmpty(basePath)) 130 138 fckEditor.setBasePath(basePath); 139 if (Utils.isNotEmpty(name)) 140 fckEditor.setParamName(name); 131 141 132 142 } catch (Exception e) { 133 143 throw new JspException(e); … … 151 161 return EVAL_PAGE; 152 162 } 153 163 154 } 155 No newline at end of file 164 } 165 -
java-core/src/main/java/net/fckeditor/FCKeditor.java
43 43 44 44 private FCKeditorConfig fckConfig = new FCKeditorConfig(); 45 45 private String instanceName; 46 private String paramName; 46 47 private String value; 47 48 private HttpServletRequest request; 48 49 … … 51 52 private String width = PropertiesLoader.getEditorWidth(); 52 53 private String height = PropertiesLoader.getEditorHeight(); 53 54 private String basePath = PropertiesLoader.getEditorBasePath(); 55 56 /* 57 * Static counter for auto generated id tags 58 */ 59 private static long IDCounter = 0l; 60 private String sID = ""; 54 61 55 62 /** 56 63 * Class constructor with all basic parameters. … … 78 85 * if instanceName is empty or not a valid XHTML id 79 86 */ 80 87 public FCKeditor(final HttpServletRequest request, 81 final String instanceName, final String width, final String height, 88 final String instanceName, final String paramName, 89 final String width, final String height, 82 90 final String toolbarSet, final String value, final String basePath) { 83 91 84 92 this(request, instanceName); 93 this.paramName = paramName; 85 94 this.width = width; 86 95 this.height = height; 87 96 this.toolbarSet = toolbarSet; … … 130 139 } 131 140 132 141 /** 142 * Sets the initial value of the input element's name 143 * 144 * @param value the name of the input element 145 */ 146 public void setParamName(String value) { 147 this.paramName = value; 148 } 149 150 /** 133 151 * Sets the initial value to be edited as HTML markup. 134 152 * 135 153 * @param value … … 300 318 @Override 301 319 public String toString() { 302 320 StringBuffer strEditor = new StringBuffer(); 321 322 /* 323 * Set the ID tag 324 */ 325 sID = instanceName; 326 if (instanceName.equals("auto")) { 327 sID = "auto" + IDCounter++; 328 } 329 330 /* 331 * Set the paramName is not already set 332 */ 333 if (paramName == null || paramName.equals("")) { 334 paramName = sID; 335 } 303 336 304 337 strEditor.append("<div>"); 305 338 String encodedValue = escapeXml(value); 306 339 307 340 if (Compatibility.isCompatibleBrowser(request)) { 308 strEditor.append(createInputForVariable( instanceName, instanceName,341 strEditor.append(createInputForVariable(paramName, sID, 309 342 encodedValue)); 310 343 311 344 // create config HTML 312 345 String configStr = fckConfig.getUrlParams(); 313 346 if (Utils.isNotEmpty(configStr)) 314 strEditor.append(createInputForVariable(null, instanceName347 strEditor.append(createInputForVariable(null, sID 315 348 .concat("___Config"), configStr)); 316 349 317 350 // create IFrame 318 351 StringBuffer editorLink = new StringBuffer(request.getContextPath()); 319 352 editorLink.append(basePath); 320 353 editorLink.append("/editor/fckeditor.html?InstanceName=").append( 321 instanceName);354 sID); 322 355 if (Utils.isNotEmpty(toolbarSet)) 323 356 editorLink.append("&Toolbar=").append(toolbarSet); 324 357 325 358 XHtmlTagTool iframeTag = new XHtmlTagTool("iframe", 326 359 XHtmlTagTool.SPACE); 327 iframeTag.addAttribute("id", instanceName.concat("___Frame"));360 iframeTag.addAttribute("id", sID.concat("___Frame")); 328 361 iframeTag.addAttribute("src", editorLink.toString()); 329 362 iframeTag.addAttribute("width", width); 330 363 iframeTag.addAttribute("height", height); … … 335 368 } else { 336 369 XHtmlTagTool textareaTag = new XHtmlTagTool("textarea", 337 370 encodedValue); 338 textareaTag.addAttribute("name", instanceName);371 textareaTag.addAttribute("name", sID); 339 372 textareaTag.addAttribute("rows", "4"); 340 373 textareaTag.addAttribute("cols", "40"); 341 374 textareaTag.addAttribute("wrap", "virtual");