From: Benoît Pin Date: Tue, 16 Aug 2011 11:22:13 +0000 (+0200) Subject: Ajout du code du finder ajax depuis le dépôt de FCK. X-Git-Tag: 3.6.1~22 X-Git-Url: https://scm.cri.ensmp.fr/git/ckeditor.git/commitdiff_plain/92ea98a2568a0e59779b924a8b699bea7936fa14 Ajout du code du finder ajax depuis le dépôt de FCK. --- diff --git a/skins/ckeditor/config.js b/skins/ckeditor/config.js index 9467812..bb14ec7 100644 --- a/skins/ckeditor/config.js +++ b/skins/ckeditor/config.js @@ -22,5 +22,5 @@ CKEDITOR.editorConfig = function( config ) ]; config.height = '500px'; - config.filebrowserBrowseUrl = CKEDITOR.basePath; + config.filebrowserBrowseUrl = CKEDITOR.basePath + 'filemanager/browser/mac_finder/browser.html?Connector=connectors/plinn/connector'; }; \ No newline at end of file diff --git a/skins/ckeditor/filemanager/browser/mac_finder/_graphics/folderish_icons.psd b/skins/ckeditor/filemanager/browser/mac_finder/_graphics/folderish_icons.psd new file mode 100644 index 0000000..69fe1b3 Binary files /dev/null and b/skins/ckeditor/filemanager/browser/mac_finder/_graphics/folderish_icons.psd differ diff --git a/skins/ckeditor/filemanager/browser/mac_finder/browser.css b/skins/ckeditor/filemanager/browser/mac_finder/browser.css new file mode 100644 index 0000000..cf93b14 --- /dev/null +++ b/skins/ckeditor/filemanager/browser/mac_finder/browser.css @@ -0,0 +1,68 @@ +body { + margin:0; + padding:0; +/* overflow-x : scroll;*/ +} +#finder { + position : relative; + border : none; + vertical-align : top; + font-family : Arial, Helvetica, Geneva, Swiss, SunSans-Regular, sans-serif; + font-size : small; +} + + +#finder td { +/* width : 200px;*/ + padding : 0; +} + +#finder ul { +/* float : left;*/ + list-style : none; + margin : 0; + padding : 0; + overflow-y : scroll; +} +#finder li { + padding-left : 5px; + margin : 2px 0; + cursor : default; +/* vertical-align : middle*/ +} + +#finder li.contentish { + /* nothing special */ +} + +#finder li.contentish-selected { + background-color : #3875d7; + color : white; +} + + +#finder li.folderish { + background : url(images/folderish.gif) center right no-repeat; +} + +#finder li.folderish-selected { + background : url(images/folderish-selected.gif) center right no-repeat #3875d7 ; + color : white; +} + + +#finder img { + margin-right : 3px; + vertical-align : middle; +} + +.finder_preview { + font-size : 95%; +} +.finder_preview th { + color : #7f7f7f; + text-align : right; +} +.finder_preview .thumbnail { + text-align:center; +} \ No newline at end of file diff --git a/skins/ckeditor/filemanager/browser/mac_finder/browser.html.dtml b/skins/ckeditor/filemanager/browser/mac_finder/browser.html.dtml new file mode 100644 index 0000000..be15cd2 --- /dev/null +++ b/skins/ckeditor/filemanager/browser/mac_finder/browser.html.dtml @@ -0,0 +1,351 @@ + + + + + Site browser + + + + + + + + + + + +
    +
  • Folder
  • +
  • Content
  • +
+
+ + \ No newline at end of file diff --git a/skins/ckeditor/filemanager/browser/mac_finder/connectors/plinn/connector.py b/skins/ckeditor/filemanager/browser/mac_finder/connectors/plinn/connector.py new file mode 100644 index 0000000..61d0eae --- /dev/null +++ b/skins/ckeditor/filemanager/browser/mac_finder/connectors/plinn/connector.py @@ -0,0 +1,73 @@ +##parameters=command, path, Type=None +from Products.CMFCore.utils import getToolByName +from Products.CMFCore.permissions import View +mtool = getToolByName(context, 'portal_membership') +checkView = lambda o : mtool.checkPermission(View, o) +utool = getToolByName(context, 'portal_url') +portal = utool.getPortalObject() + +def replaceXMLEntities(text) : + for c, ent in (('<', '<'), ('>', '>'), ('&', '&')) : + text = text.replace(c, ent) + return text + +ob = portal +path = path.replace('\\', '/') +path = path.strip('/') + +if path : + for name in path.split('/') : + ob = getattr(ob, name) + +if command == 'ls' : + objects = [] + if ob.isPrincipiaFolderish : + if Type == 'Image' : filter = {'portal_type' : ['Plinn Folder', 'Portfolio', 'Photo']} + else : filter = {} + objects = ob.listNearestFolderContents(contentFilter = filter) + objects = sequence.sort( objects, (('title_or_id', 'nocase', 'asc'),) ) + + # xml printing + print '' + for o in objects : + path = o.getPhysicalPath() + encodedPath = '' + partObject = portal + for name in path[1:] : + partObject = getattr(partObject, name) + sep = checkView(partObject) and '/' or '\\' + encodedPath += sep+name + + row = '%(title)s' % { + 'path' : encodedPath, + 'folderish' : o.isPrincipiaFolderish, + 'icon' : o.getIcon(), + 'title' : replaceXMLEntities(o.title_or_id()), + 'link' : o.absolute_url() + } + print row + print '' + +elif command == 'info': + #linkFunction = (Type == 'Image') and (lambda o : o.absolute_url() + '/index_html') or (lambda o : o.absolute_url()) + linkFunction = lambda o : o.absolute_url() + ti = ob.getTypeInfo() + method_id = ti.queryMethodID('info') + meth = method_id and getattr(ob, method_id) or (lambda:'Not implemented') + lines = [] + pr = lines.append + pr('') + # print info summary in a CDATA section + pr('') + # print the url link in a tag + pr('') + pr(linkFunction(ob)) + pr('') + pr('') + print ''.join(lines) + + +context.REQUEST.RESPONSE.setHeader('content-type', 'text/xml; charset=utf-8') +return printed \ No newline at end of file diff --git a/skins/ckeditor/filemanager/browser/mac_finder/images/folderish-selected.gif b/skins/ckeditor/filemanager/browser/mac_finder/images/folderish-selected.gif new file mode 100644 index 0000000..ebad9f6 Binary files /dev/null and b/skins/ckeditor/filemanager/browser/mac_finder/images/folderish-selected.gif differ diff --git a/skins/ckeditor/filemanager/browser/mac_finder/images/folderish.gif b/skins/ckeditor/filemanager/browser/mac_finder/images/folderish.gif new file mode 100644 index 0000000..c359a8f Binary files /dev/null and b/skins/ckeditor/filemanager/browser/mac_finder/images/folderish.gif differ diff --git a/skins/ckeditor/filemanager/browser/mac_finder/images/folderishNode.gif b/skins/ckeditor/filemanager/browser/mac_finder/images/folderishNode.gif new file mode 100644 index 0000000..2cb7b83 Binary files /dev/null and b/skins/ckeditor/filemanager/browser/mac_finder/images/folderishNode.gif differ