Re: [Zope] Q: Using WebDav to edit Zope DTML Methods. SOLVED!

2000-05-30 Thread Graham Heyes

Itamar Shtull-Trauring wrote:
 
 Graham Heyes wrote:
 
  Hello,
     I have been using Zope to set up a new web site for documentation and 
  maintainance os a large software project. Until now I have been using a 
  combination of LocalFS and ftp to edit content. Neither method is 
  perfect especially since I often work from my laptop at home which is on 
  the wrong side of the firewall and can't get ftp to work.
     Just the other day I discovered WebDav and life looks much better. I 
  can tunnel my connection to port 8080 through ssh and manage my Zope 
  site from home. One problem remains:
  
  When I use "get" or "edit" to get a DTML method (web page in my case) 
  from the site I get a page with all the DTML tags expanded.  This is 
  clearly useless to me since I don't want to edit the rendered DTML but 
  the original code. Am I doing something wrong (I hope so) if so what 
  should I do?
  
  I am using Zope 1.whatever but also tried Zope2. I am running on RedHat 
  Linux 6.1 with Apache web server but I point the WebDAV tools at 
  http://localhost:8080/ "http://localhost:8080/" i.e. the ZServer. I have tried 
the "cadaver" 
  command line tool and "DAVExplorer" java application with the same result.
 
Thanks to the info from Martijn Pieters this turned out to be trivial. 
The unrendered source for a DTML method is reached by appending 
/document_src to the end of the URL. For example, 
http://localhost:8080/mystuff becomes 
http://localhost:8080/mystuff/document_src .
In the context of DAVExplorer the solution is to modify the GET so that 
the /document_src is appended correctly. Not that this can't be done too 
early since the URL is used for other internal book keeping. I found 
that the folowing modification works

In dav_explorer/classes/DAVExplorer/WebDAVManager.java  make the 
following change at line number 119 ...

       try {
             Response = Con.Generic(MethodName, ResourceName, Body, 
Headers);

             WebDAVResponseEvent webdavResponse  = 
GenerateWebDAVResponse(Response,tn);
           fireResponse(webdavResponse);
       }

... becomes ...

   try {
       if (MethodName.equals("GET")) {
             Response = Con.Generic(MethodName, ResourceName + 
"/document_src", Body, Headers);
       } else {
             Response = Con.Generic(MethodName, ResourceName, Body, 
Headers);
       }
             WebDAVResponseEvent webdavResponse  = 
GenerateWebDAVResponse(Response,tn);
           fireResponse(webdavResponse);
       }
  
... note you don't need to change PUT since PUT does the right thing. 
I've tested this out quickly and it seems to do what I want.

The sources to DAVExplorer can be found via a link at www.webdav.org to
http://www.ics.uci.edu/~webdav/ enjoy!


 Graham
---
Beware of Geeks bearing GIFS. http://www.jlab.org/coda Jefferson lab DAQ group


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Q: Using WebDav to edit Zope DTML Methods. SOLVED!

2000-05-30 Thread Martijn Pieters

On Tue, May 30, 2000 at 02:30:47PM -0400, Graham Heyes wrote:
 Thanks to the info from Martijn Pieters this turned out to be trivial.  The
 unrendered source for a DTML method is reached by appending /document_src to
 the end of the URL. For example, http://localhost:8080/mystuff becomes
 http://localhost:8080/mystuff/document_src .  In the context of DAVExplorer
 the solution is to modify the GET so that the /document_src is appended
 correctly. Not that this can't be done too early since the URL is used for
 other internal book keeping. I found that the folowing modification
 works

[SNIP changes to a Java WebDAV client]

Note that your changes only work for objects that support the document_src
methods. It may be that now or in the future other objects require you to use
a different method to retirve the unrendered source.

I'd still be better if you could find out if there are WebDAV properties about
the resource accessible in that piece of code, check for the source link, and
if present, use that instead of the original URL. Such a change can then be
used on other WebDAV servers prividing the source link as well, and can be
included in the original client sources.

-- 
Martijn Pieters
| Software Engineermailto:[EMAIL PROTECTED]
| Digital Creations  http://www.digicool.com/
| Creators of Zope   http://www.zope.org/
|   The Open Source Web Application Server
-

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Q: Using WebDav to edit Zope DTML Methods. SOLVED!

2000-05-30 Thread Graham Heyes

Martijn Pieters wrote:
 
 On Tue, May 30, 2000 at 02:30:47PM -0400, Graham Heyes wrote:
  Thanks to the info from Martijn Pieters this turned out to be trivial.  The
  unrendered source for a DTML method is reached by appending /document_src to
  the end of the URL. For example, http://localhost:8080/mystuff becomes
  http://localhost:8080/mystuff/document_src .  In the context of DAVExplorer
  the solution is to modify the GET so that the /document_src is appended
  correctly. Not that this can't be done too early since the URL is used for
  other internal book keeping. I found that the folowing modification
  works
 
 [SNIP changes to a Java WebDAV client]
 
 Note that your changes only work for objects that support the document_src
 methods. It may be that now or in the future other objects require you to use
 a different method to retirve the unrendered source.
 
 I'd still be better if you could find out if there are WebDAV properties about
 the resource accessible in that piece of code, check for the source link, and
 if present, use that instead of the original URL. Such a change can then be
 used on other WebDAV servers prividing the source link as well, and can be
 included in the original client sources.
 
 -- 
 Martijn Pieters
 | Software Engineermailto:[EMAIL PROTECTED]
 | Digital Creations  http://www.digicool.com/
 | Creators of Zope   http://www.zope.org/
 |   The Open Source Web Application Server
 -
Yes, what I did was to look at the RFC that you sent me then look at the 
WebDAV properties that DAVExplorer reads.  The properties for the source 
list looks like...

n:source
  n:link
     n:src
         /test_dtml
     /n:src
    n:dst
        /test_dtml/document_src
    /n:dst
  n:link
/n:source

... the property tagged by dst is the link to the unrendered source. 
What I really need to do is extract this from the properties rather than 
simply appending /document_src onto the end of everything. As you point 
out (partially) document_src has no meaning in the context of some 
objects and also other WebDAV servers may use a different syntax than 
simply adding /document_src on the end of the URL.

At least this works for Zope. For my next trick ;^) I am going to try to 
make it general, as you suggest and add a "Get Source" menu option so 
that the user has some choice over getting the rendered or unrendered 
source. Also, I am working on adding an "Edit" option which does a "get 
source" into a temp file then fires up the user's editor of choice and a 
thread to monitor the modification time of the temp file. Each time the 
file changes it gets put back into Zope. That way the user can use the 
"Save" command on the editor. (By the way I E-mailed the authors of 
DAVExplorer to get their input. waiting for a reply.)

   Anyway I'm having fun and getting somewhere at last!!

                          Graham 
--- 
Beware of Geeks bearing GIFS. http://www.jlab.org/coda Jefferson lab DAQ 
group


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )