Re: [Zope-dev] Deleting objects by the users

2001-03-22 Thread R. David Murray

On Thu, 22 Mar 2001, Rik Hoekstra wrote:
> one small correction: 
> 
> the line:
>  
> should read:
>  
> 
> as the manage_delObjects takes a list as argument

Well, but the other would work, since the first line of manage_delObjects is:

if type(ids) is type(''): ids=[ids]

I can't decide whether I think that's a good thing or not .

--RDM


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



Re: [Zope-dev] Deleting objects by the users

2001-03-22 Thread Casey Duncan

Rik Hoekstra wrote:
> 
> one small correction:
> 
> the line:
>  
> should read:
>  
> 
> as the manage_delObjects takes a list as argument
> 
> hth
> 
> Rik

Actually manage_delObjects will take a string argument if it is a single
id. However a list with one item is also acceptable. Although you can
declare a list with the trailing comma, it is not strictly necessary.
That is only necessary for tuples because parens have double meaning in
Python. List brackets are unambiguous.
-- 
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`-->

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



Re: [Zope-dev] Deleting objects by the users

2001-03-22 Thread Rik Hoekstra

one small correction: 

the line:
 
should read:
 

as the manage_delObjects takes a list as argument

hth

Rik


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



Re: [Zope-dev] Deleting objects by the users

2001-03-21 Thread Casey Duncan

Menno Brandsen wrote:
> 
> Hello all, I have a question conserning deleting objects(images) by the user
> 
> The situation is this :
> 
> I have a page that lists the contents of the folder below, containing images
> of a site.
> In that list a want to let the user/client delete the image that he wants.
> 
> I've tried using this syntax :
> 
> "> DELETE 
> 
> What happens now is that as soon as the page loads it inmediatly deletes the
> images.
> Can anybody tell me a sollution for this problem ?
> I would be very gratefull ! =)
> 
> Greetings,
> Menno Brandsen
> 
This is a question better served on the main Zope mailing list. That
said, here is the answer:

All DTML is executed on the server before the page goes to the client.
That is why your images get deleted by viewing the page. The onclick
attribute is only useful for executing client side scripts like
JavaScripts, etc. To execute server side code, you must make the user
request the method that deletes the images. This is done by sending the
server a page request. So, you need to create two objects in Zope to
accomplish this. One that displays the images and another that deletes
the requested image and redraws (by a redirect) the image display page.
Here's an example:

dtml method view_images:



Delete this image


dtml method delete_image:






This code is generic enough so that it would work in any folder. You
could place these methods above the folder(s) containing the images for
greater generality.

It might seem a bit confusing how this works if you don't understand
acquisition. The view_images method creates a link to each image in the
folder you call it for. The link is to the image object itself with the
delete_image method appended. This tells Zope to call delete_image in
the context of the image the user selects.

manage_delObjects is not a method of the image, but the image acquires
it from the Folder that contains it. So delete_image passes the id of
the image (using getId()) to the manage_delObjects method of the folder
containing it. It then redirects back to the view_images method which
will be sans the deleted image.

hth
-- 
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`-->

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



[Zope-dev] Deleting objects by the users

2001-03-21 Thread Menno Brandsen

Hello all, I have a question conserning deleting objects(images) by the user

The situation is this :

I have a page that lists the contents of the folder below, containing images
of a site.
In that list a want to let the user/client delete the image that he wants.

I've tried using this syntax :

"> DELETE 

What happens now is that as soon as the page loads it inmediatly deletes the
images.
Can anybody tell me a sollution for this problem ?
I would be very gratefull ! =)

Greetings,
Menno Brandsen




0-o
| M. Brandsen |
| Parkstraat 20   |
| 2517 JK |
| Den Haag|
| +31(0)70-3108950 0-o
| [EMAIL PROTECTED]   | |
|  | Your mouse has moved.   |
0--|   Windows has to reboot for |
   | changes to take effect. |
   | |
   | [ OK ]  |
   | |
   0-0



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