A few days ago I posted the Q below and got several great responses. For my first time around, I�ve implemented the easiest solution. The writing below is deliberately simplified for my high school students. -=-=-=-=-= Question -=-=-=-=-=- Can someone please point me to code that will <> display an �Edit this page� link on pages for which the viewer has edit permission <> redirect user to an �edit & save� window <> hide the link from other users -==-=-=-=- Simple Solution =-=-=-=-=-= Go to the root level of Zope. Click on the Security tab and add the role 'Editor'. Select checkboxes to give Editor these Permissions: Access contents information Add documents, images, and files Add folders Change DTML Documents Change DTML Methods Create a test folder something like... ID: TestEdit Title: Test of User Editing Open the TestEdit folder, then the acl_users folder. Create a new user (Bob)give him a password (bobpw), and assign him the role Editor. Bob is now ready to add or edit any of the contents of the TestEdit folder. However, if Bob enters the site as an Anonymous user he will not (unless he knows some Zope) be able to access the management screen where he can open and edit a DTML document or method. Here's a simple (kludgy?)way to get Bob into his own pages. At the Zope root level, open Standard_HTML_footer. The original code looks (I think) like this: <p><!--#var ZopeAttributionButton--></p> </BODY></HTML> Revise it like this: <p><!--#var ZopeAttributionButton--></p> <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR> <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR> <font size="-1"> <a href="manage_main">Edit page</a> (password required).</font> <BR><BR></BODY></HTML> This will put an 'Edit page' link on the bottom of each page, but the link will normally not be seen because the many <BR> line breaks will push the link below the bottom of the screen. Editors will be instructed to scroll down to find the link. When an editor clicks on the link she will be instructed to enter her name and password before gaining management access to the content pages. -=-=-=-=-=- This approach is far from elegant but it works... Suggestions welcome! Dave Robson ===== David Robson robson555@yahoo.com Computer Support Towson High School, MD, USA __________________________________________________ Do You Yahoo!? Bid and sell for free at http://auctions.yahoo.com
At 08:14 AM 10/14/99 -0700, David Robson wrote: [standard_html_footer to allow document editing]
<p><!--#var ZopeAttributionButton--></p> <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR> <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR> <font size="-1"> <a href="manage_main">Edit page</a> (password required).</font> <BR><BR></BODY></HTML>
This will put an 'Edit page' link on the bottom of each page, but the link will normally not be seen because the many <BR> line breaks will push the link below the bottom of the screen. Editors will be instructed to scroll down to find the link. When an editor clicks on the link she will be instructed to enter her name and password before gaining management access to the content pages.
If you're dealing with a case where the editors have already logged in. You can simply hide the edit link from non-editors. <dtml-if "AUTHENTICATED_USER.has_role('Editor', this())"> <a href="manage_main">Edit page</a> </dtml-if> This says, if the web user has the role of Editor on the current DTML Document, then show a link to edit the document. Note: that the link won't show up for anonymous users. So your editors have to authenticate themselves in someway before the links will show up. -Amos
-=-=-=-=-= Question -=-=-=-=-=-
Can someone please point me to code that will
<> display an 'Edit this page' link on pages for which the viewer has edit permission <> redirect user to an 'edit & save' window <> hide the link from other users
Here's a better solution: <dtml-if "AUTHENTICATED_USER.has_permission('Edit', this())"> <p><font size="-1"><a href="manage_main">Edit Page</a></font> </dtml-if> -jfarr ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Hi! I'm a signature virus. Copy me into your .sig to join the fun! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
participants (3)
-
Amos Latteier -
David Robson -
Jonothan Farr