RE: [Zope] What about adding a download tab to Document?
Hi, I think it would be nice to have a download tab in the document objects. Today we have to cut'n paste the form contents to an editor and save it with the desired name.
Probably the usual development way is to edit a doc in the file system and to upload it. When you want to change, just edit it and upload again. Not very good when you have to edit a document from multiple places, or to edit documents that where automatically generated.
We are definitely aware of the shortcomings of editing in a TEXTAREA :^) A major goal of the upcoming FTP and WebDAV support is to provide much more flexibility in editing.
Here is a patch to do it: http://samba-choro.com.br/neves/python/zope/Document.py.patch
It should be applied to Document.py file in /web/Zope-1.9.0-src/lib/python/OFS dir.
There's a kind of a hack in it to make the default file name in the browser download dialog to become "document_id.ztml". To do this a method is created with this name. If someone know a better way to do it, like a magic http header, please tell me.
Why do you need to change the extension? Couldn't you just name it foo.ztml in the first place? Having a well-known method for obtaining DTML source is something that will be needed for FTP and webdav support anyway, so we can probably support at least a simple download tab for 1.10.0. The actual implementation will probably be a bit different than that in your patch though, as there are some ftp and webdav-specific requirements that we need to meet as well, and the underlying implementation will probably need to change later to accomodate those. I suspect that changing the apparent id of the object won't be a part of this (at least not initially), since this would throw most clients for a loop... Brian Lloyd brian@digicool.com Software Engineer 540.371.6909 Digital Creations http://www.digicool.com
Brian Lloyd wrote:
We are definitely aware of the shortcomings of editing in a TEXTAREA :^) A major goal of the upcoming FTP and WebDAV support is to provide much more flexibility in editing.
I know, that will be great to use the remote editing feature of some editors like emacs and homesite 4. But a download tab is nice for 2 reasons: FTP is still in alpha, and some people will not use ZServer.
There's a kind of a hack in it to make the default file name in the browser download dialog to become "document_id.ztml". To do this a method is created with this name. If someone know a better way to do it, like a magic http header, please tell me.
Why do you need to change the extension? Couldn't you just name it foo.ztml in the first place?
Take a look at the code and you will see that if the doc id finishes with something like .?tml, the extension isn't added. The purpose to add it is that if I edit it in emacs I can add a hook to start HTML editing mode. The same in windows, where I can associate an extension to be opened or edited with a program.
Having a well-known method for obtaining DTML source is something that will be needed for FTP and webdav support anyway, so we can probably support at least a simple download tab for 1.10.0.
Nice. See that the method is already in the code, it is named manage_realDownload.
I suspect that changing the apparent id of the object won't be a part of this (at least not initially), since this would throw most clients for a loop...
Excuse me, I didn't understand. The code doesn't change the object id, it just add a method that is named after the document id. This is just an alias of manage_realDownload. I did this to make the object id appear in the download dialog of Netscape. BTW I didn't tested it in IE. []s -- Paulo Eduardo Neves PUC-Rio de Janeiro Pager: Central: 292-4499 cod. 213 99 64 ou use a URL: http://www.learn.fplf.org.br/neves/mensagempager.html
participants (2)
-
Brian Lloyd -
Paulo Eduardo Neves