[Zope-CMF] Allow anonymous to view unedited document until edited document is approved

Jo Meder jo@meder.de
Thu, 28 Mar 2002 23:07:06 +0100


Am 28.03.2002, 19:06 Uhr
	schrub Lesley Lam <llam@deas.harvard.edu>:

> The copy/paste buttons on the management screen uses the scripts
> folder_copy and folder_paste and I think I should be doing something
> similar.  However, in doing so, I get an error that says I'm not
> allowed to access manage_copyObjects.

Here's what I do to create a copy (with checks if there already is a
copy). There's certainly room for improvements:

   <dtml-let folder="this().aq_parent"
             tid=id>
      <dtml-call expr="folder.manage_pasteObjects(folder.manage_copyObjects([tid]))">
      <dtml-let nobj="_.getattr(folder,'copy_of_'+tid)"
                eobj="_.getattr(folder,'editobj_'+tid,None)">
         <dtml-try>
                <dtml-call expr="REQUEST.set('nid',nobj.id())">
         <dtml-except>
                <dtml-call expr="REQUEST.set('nid',nobj.id)">
         </dtml-try>
         <dtml-let nid="REQUEST.get('nid')">
         <dtml-unless expr="eobj">
            <dtml-call expr="folder.manage_renameObjects([nid],['editobj_'+nid[8:]])">
            <dtml-let editobj="_.getattr(folder,'editobj_'+tid)">
               <dtml-call expr="portal_workflow.doActionFor(nobj,
                                REQUEST['workflow_action'],
                                comment=REQUEST.get('comment', ''))">
               <dtml-return expr="content_status_modify_edit_callform(obj=editobj)">
            </dtml-let>
         </dtml-unless>
         </dtml-let>
         <dtml-var standard_html_header>
            <h1>This content has already been retracted for editing</h1>
         <dtml-var standard_html_footer>
      </dtml-let>
   </dtml-let>

"content_status_modify_edit_callform(obj=editobj)" is a call to a very
small Python-Script that does nothing but call the appropriate
edit-form.

And here's what I do to overwrite the old content when the copy is being
published:

      <dtml-let oobj="_.getattr(folder,tid[8:],None)">
          <dtml-if expr="oobj">
            <dtml-call expr="manage_delObjects([tid[8:]])">
          </dtml-if>
      </dtml-let>
      <dtml-call expr="manage_renameObjects([tid],[tid[8:]])">
      <dtml-return expr="RESPONSE.redirect(folder.absolute_url()+'/'+tid[8:]+'/view')">


> Thought the permission for this was 'View Management Screen', but it
> doesn't seem so.  Can you give me a detailed description of your
> script that does the copying/pasting and if you have certain
> permissions set to do so?

Special permissions? Certainly not.

	Jo.


-- 
Internetmanufaktur Jo Meder ---------------------- Berlin, Germany
http://www.meder.de/ ------------------- fon: ++49-30-417 17 63 33
Kollwitzstr. 75 ------------------------ fax: ++49-30-417 17 63 45
10435 Berlin --------------------------- mob: ++49-170- 2 98 89 97
Public GnuPG-Key ---------- http://www.meder.de/keys/jo-pubkey.txt