[Zope] setting properties - some basic questions

Jason Cunliffe jasonic@nomadicsltd.com
Fri, 2 Mar 2001 07:43:23 -0500


Hello

I have been studying Caseman's excellent How-To ideas for clean handling of
Javascripts in Zope:
http://www.zope.org/Members/Caseman/client_script_howto
[Thank You!]

So now I have a boolean property 'admin' for my site folders and
DTMLDocuments.
When admin is 'ON' various Methods are rendered on the pages some simple
<dtml-if> statements such as:

<dtml-if admin>
  admin = <dtml-var admin><br>
  <dtml-var showjavascripts>
<dtml-else>
  admin is OFF
</dtml-if>

Please, can anyone teach me how to:

Q1.  set 'admin' on or off by a button on the same page?

Q2.  set 'admin' on or off by a button on another page?

Q3.  toggle 'admin' to its oppposite state via a button?

Q4.  perform 1, 2, 3 above via a DTML/Python method I can call from
anywhere?

..my documents also have a 'scripts' property [type = 'Lines'].
'scripts' lists the names of various javascript functions wrapped as
DTMLmethods.

Q5. How can I edit the text in different lines of such a a property?

This is my 'showjavascripts' DTMLmethod:

The script properties of this DTMLdocument are:<br><br>
<dtml-in scripts>
  <dtml-var sequence-item><br>
</dtml-in>

#note: scripts is a type='lines' property as above


Q6. How do to create and set a property for whole lot of documents using
DTML and/or Python?

For example, I have a folder 'NEWARTISTS' and I want to add 'admin' and
'scripts' properties for all documents and folders within those...


Q7. How to make this all work so that qualified users can login into 'admin'
pages inside certain folders which will then turn 'on' the admin property
flag automatically for everythign below that?

Presumably 1, 2, 3, 5, 6, 7 will all use 4...

I imagine this is all incredibly simple, but I need a little help to reach
the aaha!! moment :-)


+FINALLY, I have want to apply the same approach setting 'scripts' and
'admin' for index_html, but since it is a method it has no properties. If I
apply 'scripts' and folder properties it to its parent folder it will then
apply to everyhting below there by acquisition. This is handy but often I
need finer grained control than that.
Changing index_html to be a DTMLdocument does not work.

Any suggestions for Thinking Zope here?

Thanks

- Jason
___________________________________________________________
Jason CUNLIFFE = NOMADICS['Interactive Art and Technology']