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

2000-05-30 Thread Dieter Maurer

Graham Heyes writes:
 > I have been using a very nice HTML editor under Linux, called Quanta+, 
 > unfortunately it can't open anything except local files. That's fine 
 > when I'm at work since I can use ZOPEEdit (ftp) or LocalFS. (LocalFS 
 > doesn't behave well with trees and other navigation products so I try to 
 > avoid it). The problem is that from home I can't use ftp becaues of the 
 > firewall. I've tried to tunnel through ssh but that doesn't work for me. 
 > I've been looking at WebDAV or writing something using ZClient but my 
 > python is very rusty.
"DTMLMethod" and "DTMLDocument" have a method "document_src"
that return their source (as text/plain). You can let
your browser save this as a local file, edit it and later
upload it again.

Attached is a patch that exposes this method as a tab.

Dieter
**
--- lib/python/OFS/:DTMLDocument.py Thu Jul 22 16:12:12 1999
+++ lib/python/OFS/DTMLDocument.py  Sat Aug 21 20:33:05 1999
@@ -111,6 +111,7 @@
 {'label':'Upload', 'action':'manage_uploadForm'},
 {'label':'Properties', 'action':'manage_propertiesForm'},
 {'label':'View', 'action':''},
+{'label':'Source', 'action':'document_src'},
 {'label':'Proxy', 'action':'manage_proxyForm'},
 {'label':'Security', 'action':'manage_access'},
)
--- lib/python/OFS/:DTMLMethod.py   Wed Jul 21 15:44:25 1999
+++ lib/python/OFS/DTMLMethod.pySat Aug 21 20:33:05 1999
@@ -116,6 +116,7 @@
 manage_options=({'label':'Edit', 'action':'manage_main'},
 {'label':'Upload', 'action':'manage_uploadForm'},
 {'label':'View', 'action':''},
+{'label':'Source', 'action':'document_src'},
 {'label':'Proxy', 'action':'manage_proxyForm'},
 {'label':'Security', 'action':'manage_access'},
)


___
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...


  
     
         /test_dtml
     
    
        /test_dtml/document_src
    
  


... 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 )




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

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.

2000-05-30 Thread Graham Heyes

Itamar Shtull-Trauring wrote:
> 
> Graham Heyes wrote:
> 
> > I have been using a very nice HTML editor under Linux, called Quanta+,
> > unfortunately it can't open anything except local files. That's fine
> > when I'm at work since I can use ZOPEEdit (ftp) or LocalFS. (LocalFS
> > doesn't behave well with trees and other navigation products so I try to
> > avoid it). The problem is that from home I can't use ftp becaues of the
> > firewall. I've tried to tunnel through ssh but that doesn't work for me.
> > I've been looking at WebDAV or writing something using ZClient but my
> > python is very rusty.
> 
> Try LoadSite - a GUI upload client written in wxPython that runs over HTTP:
> 
> http://www.zope.org/Members/itamar/load_site
> 
> Only problem is that you need to patch Zope, but it's a tiny change.  It
> also can do nice things like automatically add  standard_html_header/footer> to your pages.
> 
> -- 
> Itamar S.T.  [EMAIL PROTECTED]
Yes I already have load_site but it is (as far as I can see) an upload  
tool. I can't edit anything that has already been uploaded so I have to  
keep a local copy of everything. What can happen is that someone else 
updates  a page from their local copy then I update from mine and lose 
the changes.
   The idea with WebDAV was that I could lock edit and unlock with the 
only copy being in the Zope database.

--

 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.

2000-05-29 Thread Graham Heyes

> Martijn Pieters wrote:
> 
> This is because according to the WebDAV spec, documents are retrieved using a
> plain 'GET' command, which is exactly the same as what browsers do.
> 
> However, the spec also provides for a way to find out where to get the source
> of the document found at a specific URL, via the so-called Source Link. Zope
> provides this link, but I have yet to find a client that'll honour it and give
> you easy access to it.
> 
> The relevant sections in the WebDAV spec are:
> 
>http://andrew2.andrew.cmu.edu/rfc/rfc2518.html#sec-5.4
> 
> and
>  
>http://andrew2.andrew.cmu.edu/rfc/rfc2518.html#sec-13.1
> 
> Now, I haven't seen either WebDAV client, if they support this feature, please
> let us know!
> 
That's OK, it turns out the project that the web site is documenting is 
partly Java so I know a lot of Java. With the info you have given me I  
can probably modify the sources to DAVExplorer so that it gets the 
source rather than the rendered document. I had thought that maybe I was 
missing something in my Zope config. Perhaps it would have been better 
if I had, less work  ;^)

I have been using a very nice HTML editor under Linux, called Quanta+, 
unfortunately it can't open anything except local files. That's fine 
when I'm at work since I can use ZOPEEdit (ftp) or LocalFS. (LocalFS 
doesn't behave well with trees and other navigation products so I try to 
avoid it). The problem is that from home I can't use ftp becaues of the 
firewall. I've tried to tunnel through ssh but that doesn't work for me. 
I've been looking at WebDAV or writing something using ZClient but my 
python is very rusty.

If anyone has any comments or a solution to my problem, editing DTML 
through a firewall using something other than netscape, please let me know.

Regards to all,



 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.

2000-05-29 Thread Martijn Pieters

On Tue, May 30, 2000 at 06:33:23PM -0400, 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/ i.e. the ZServer. I have tried the "cadaver" 
> command line tool and "DAVExplorer" java application with the same result.

This is because according to the WebDAV spec, documents are retrieved using a
plain 'GET' command, which is exactly the same as what browsers do.

However, the spec also provides for a way to find out where to get the source
of the document found at a specific URL, via the so-called Source Link. Zope
provides this link, but I have yet to find a client that'll honour it and give
you easy access to it.

The relevant sections in the WebDAV spec are:

   http://andrew2.andrew.cmu.edu/rfc/rfc2518.html#sec-5.4

and
 
   http://andrew2.andrew.cmu.edu/rfc/rfc2518.html#sec-13.1

Now, I haven't seen either WebDAV client, if they support this feature, please
let us know!

-- 
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 )