gigaZhang / struts2-jquery

Automatically exported from code.google.com/p/struts2-jquery
0 stars 0 forks source link

CkeditorUpload different preview and upload image folder #790

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Which struts2-jquery plugin version?
3.2.1

Please provide any additional information below.
I have CKEDITOR with image upload enabled.
I`m looking java class:
struts2-jquery-richtext-plugin-3.3.0-SNAPSHOT-sources.jar!\com\jgeppert\struts2\
jquery\richtext\actions\CkeditorUpload.java

line 113:
out.write("<script 
type=\"text/javascript\">window.parent.CKEDITOR.tools.callFunction(" + 
this.CKEditorFuncNum + ", \"uploads/" + this.uploadFileName + "\", 
\"\");</script>");

I think that this will work only if CKEDITOR action is in struts2
<package namespace="/" 

But if I move action with CKEDITOR to different namespace for example this:
<package name="adminActions" namespace="/profile" extends="tiles-default">

I can view the image preview only if I change in struts.xml
<constant name="struts.ckeditor.uploadFolder" value="/uploads/profile"/>

but CKEDITOR will save HTML image link without /profile namespace like:
uploads/2f48c676-dcf0-46d7-8ca3-54a03ca932fe.JPG

I think that this can be fixed if the line 133 for preview will be changed like:

out.write("<script 
type=\"text/javascript\">window.parent.CKEDITOR.tools.callFunction(" + 
this.CKEditorFuncNum + ", \"/uploads/" + this.uploadFileName + "\", 
\"\");</script>");

And this will work with uploadFolder:
<constant name="struts.ckeditor.uploadFolder" value="/uploads"/>

Original issue reported on code.google.com by syt...@gmail.com on 11 Mar 2012 at 3:45

GoogleCodeExporter commented 9 years ago
I have copy CkeditorUpload.java with changed 133 line in my action and set it 
to CKEDITOR:
uploadHref="%{imguploadurl}"

I can confirm that with change in 113 line image is uploaded in /uploads folder 
and it appear in CKEDITOR preview too.

Original comment by syt...@gmail.com on 11 Mar 2012 at 4:08

GoogleCodeExporter commented 9 years ago
its better to set for example:
uploadDir="/uploads"

out.write("<script 
type=\"text/javascript\">window.parent.CKEDITOR.tools.callFunction(" + 
this.CKEditorFuncNum + ", \"" + this.uploadDir + "/" + this.uploadFileName + 
"\", \"\");</script>");

Original comment by syt...@gmail.com on 11 Mar 2012 at 7:04

GoogleCodeExporter commented 9 years ago

Original comment by johgep on 14 Mar 2012 at 2:22

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/struts2-jquery/source/detail?r=1629

Original comment by johgep on 14 Mar 2012 at 2:31

GoogleCodeExporter commented 9 years ago

Original comment by johgep on 8 May 2012 at 6:40

GoogleCodeExporter commented 9 years ago

Original comment by ehernan...@jonima.com.mx on 25 Jun 2014 at 11:11

Attachments: