一个上传对话框 - 两个目标?
使用 CKeditor 3,我创建了图像处理函数:
上传接收器 (filebrowserUploadUrl) 和图像浏览器对话框 (filebrowserBrowseUrl)
- 两者都工作完美
,但当然我的用户想要更多...我们有两个图像数据库:公共和私有
- 图像浏览器允许用户从其中选择图像。
我的上传接收器 (php) 可以轻松地将新图像放入这些容器中。
- 但我如何让用户选择哪一个呢?
三个想法 - 全部涉及修改 upload-dialog-tab ( type=file + upload-button)
通过以下方式添加目标选择器:
Using two different upload-buttons: (Upload to Common) and (Upload to Private) both pointing to the same filebrowserUploadUrl but adding a parameter: &target=C or &target=P
或
A couple of "radio switches": Common or Private - essentially doing the same: Adding &target=(P or C) with one of them selected by default, so the user can't break it by negligence...
或
Just a single checkbox: Private (or not) ~ adding &target=P (or not)
我确实尝试过(我的手指在流血,而且我气得吐了两次!),但作为一个非 jQuery javascript 开发人员,我只是无法理解这一切。当我添加文本字段时,它显示得很好:)
- 但不是在实际的上传表单(在 iframe 中)上,该表单仍然只包含 type=file 字段?!?
所以我希望有一个如何修改 upload-dialog-tab 来完成它的示例?
我已经准备好启动平台(我认为):
CKEDITOR.on( 'dialogDefinition', function( ev ) { var dialogName = ev.data.name; var dialogDefinition = ev.data.definition; if ( dialogName == 'image' ) { var infoTab = dialogDefinition.getContents( 'Upload' ); infoTab.add({ what ?
Using CKeditor 3, I've created image handling functions:
An upload reciever (filebrowserUploadUrl) and an image browser dialog (filebrowserBrowseUrl)
- Both work perfectly
BUT of course my users want more... We have two image-databases: Common and Private
- The image-browser lets the user pick images from either.
My upload-reciever (php) can easily put the new image in either of these containers.
- but how do I let the user pick which one ?
Three ideas - all involving modifying the upload-dialog-tab ( type=file + upload-button)
Adding a target selector by:
Using two different upload-buttons: (Upload to Common) and (Upload to Private) both pointing to the same filebrowserUploadUrl but adding a parameter: &target=C or &target=P
or
A couple of "radio switches": Common or Private - essentially doing the same: Adding &target=(P or C) with one of them selected by default, so the user can't break it by negligence...
or
Just a single checkbox: Private (or not) ~ adding &target=P (or not)
I've really tried (my fingers are bleeding, and I've vomited with rage, twice!) but as a non-jQuery javascript developer, I just can't make sense of it all. When I add a text-field, it shows up just fine : )
- but not on the actual upload-form (in an iframe) that one still only contains the type=file field ?!?
So I'd appreciate an example of how to modify the upload-dialog-tab to accomplish it ?
I have my launch platform ready (I think):
CKEDITOR.on( 'dialogDefinition', function( ev ) { var dialogName = ev.data.name; var dialogDefinition = ev.data.definition; if ( dialogName == 'image' ) { var infoTab = dialogDefinition.getContents( 'Upload' ); infoTab.add({ what ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我自己解决了这个问题,但确实必须对其进行一些修改:)
我认为 CKeditor 中可能存在错误(或者可能是设计使然......)
添加新字段(无论是在 image.js 中还是通过 CKEDITOR.on('dialogDefinition'..))它们只是不会转换为 iframe 中实际上传表单上的新字段。(错误还是功能?)
所以,我添加了
/plugins/image/dialogs/image.js
的一个复选框(私人?不是)
在文件字段和按钮之间的 (id : 'Upload',) 部分中,使用执行此操作的 onClick 事件,困难的方法是:
它有效(至少只要 iframe 的 id 是“125_fileInput”)
IE-修改(当然):
Solved it myself, but did have to go a bit rouge on it : )
I think there's may be an error in CKeditor here (or maybe it's by design..)
Adding new fields (whether in image.js or through CKEDITOR.on( 'dialogDefinition'..) they just don't translate into new fields on the actual upload-form in the iframe. (Bug or feature?)
SO, I added one checkbox (Private?not) to
/plugins/image/dialogs/image.js
in the (id : 'Upload',) section between the file-field and the button, with an onClick-event that does the business, the hard way:
It works (at least as long as the iframe's id is "125_fileInput")
IE-modification (of course):