[CMF-checkins] CVS: CMF/CMFStaging/skins/staging - get_status_image.py:1.1 object_lock.py:1.1 object_revert_version.py:1.1 object_status_block.pt:1.1 object_unlock.py:1.1 object_version_control_form.pt:1.1 status_locked.gif:1.1 status_locked.gif.properties:1.1 status_locked_out.gif:1.1 status_locked_out.gif.properties:1.1 status_synced.gif:1.1 status_synced.gif.properties:1.1 status_unsynced.gif:1.1 status_unsynced.gif.properties:1.1

Shane Hathaway shane@cvs.zope.org
Tue, 14 May 2002 13:54:54 -0400


Update of /cvs-repository/CMF/CMFStaging/skins/staging
In directory cvs.zope.org:/tmp/cvs-serv20216/skins/staging

Added Files:
	get_status_image.py object_lock.py object_revert_version.py 
	object_status_block.pt object_unlock.py 
	object_version_control_form.pt status_locked.gif 
	status_locked.gif.properties status_locked_out.gif 
	status_locked_out.gif.properties status_synced.gif 
	status_synced.gif.properties status_unsynced.gif 
	status_unsynced.gif.properties 
Log Message:
Added a "staging" skin layer and a management interface for the three tools.


=== Added File CMF/CMFStaging/skins/staging/get_status_image.py ===
##parameters=stage='dev'
##title=Get image for content's locked/synced status per specified stage.

if stage == 'dev':
    lt = getattr(context, 'portal_lock', None)
    if lt is not None:
        locker = lt.locked(context) and lt.locker(context)
    else:
        locker = None

    if locker:
        from AccessControl import getSecurityManager
        username = getSecurityManager().getUser().getUserName()

        if locker == username:
            return getattr(context, "status_locked.gif")
        else:
            return getattr(context, "status_locked_out.gif")

st = getattr(context, 'portal_staging', None)
if st is None or not st.isStageable(context):
    return None

versions = st.getVersionIds(context)
if not versions[stage]:
    return None

if not versions['prod'] or versions[stage] != versions['prod']:
    return getattr(context, "status_unsynced.gif")

return getattr(context, "status_synced.gif")


=== Added File CMF/CMFStaging/skins/staging/object_lock.py ===
##parameters=REQUEST=None
##title=Lock an object (and display the current view again)

context.portal_lock.lock(context)
if REQUEST is not None:
    REQUEST.RESPONSE.redirect(REQUEST['HTTP_REFERER'])


=== Added File CMF/CMFStaging/skins/staging/object_revert_version.py ===
##parameters=version_id, REQUEST=None
##title=Revert to a specific revision of an object

if context.LockTool.locked(context):
    context.LockTool.unlock(context)

context.StagingTool.revertToVersion(context, version_id)

if REQUEST is not None:
    msg = 'Reverted to revision %s.' % version_id
    view = 'object_version_control_form'
    REQUEST.RESPONSE.redirect(
        '%s/%s?portal_status_message=%s' % (
        context.absolute_url(), view, msg))


=== Added File CMF/CMFStaging/skins/staging/object_status_block.pt ===
<form action="." method="POST"
      tal:define="lt here/portal_lock|nothing;
                  locker python: lt and lt.locker(here);
                  username python: user.getUserName();
                  versions python: here.portal_staging.getVersionIds(here);"
      tal:attributes="action here/absolute_url">
<!--
  allow_submit python: (locker == username) or (
      not locker and versions['dev'] != versions['prod']);
  allow_publish allow_submit
-->
<table>
<tr>
  <td>
   <img src="status_synced.gif"
        tal:replace="structure python: here.get_status_image('dev')" />
  </td>
  <td>Development</td>

  <td width="90%"> &nbsp;
    <span tal:content="python: versions['dev'] and (
    'rev %s%s' % (versions['dev'], locker and '+' or '')) or '--'">rev 1</span>
    <span tal:condition="locker">
      (<span tal:replace="locker">someone</span>)
    </span>
  </td>
</tr>

<tr>
  <td></td>
  <td colspan="2">
    <input type="submit" name="object_lock:method"
           value="Lock" tal:condition="not:locker" />
    <input type="submit" name="object_unlock:method"
           value="Unlock"
           tal:condition="python: locker == username" />
<!--
    <input type="submit" name="content_submit_form:method"
           value="Submit for review..." tal:condition="allow_submit" />
-->
  </td>
</tr>

<tr>
  <td>
   <img src="status_synced.gif"
        tal:replace="structure python: here.get_status_image('review')" />
  </td>
  <td>Review</td>
  <td> &nbsp;
    <span tal:content="python: versions['review'] and (
                       'rev %s' % versions['review']) or '--'">rev 1</span>
  </td>
</tr>

<!--
<tr>
  <td></td>
  <td colspan="2">
    <input type="submit" name="content_publish_form:method"
           value="Publish..." tal:condition="allow_publish" />
  </td>
</tr>
-->

<tr>
  <td>
   <img src="status_synced.gif"
        tal:replace="structure python: here.get_status_image('prod')" />
  </td>
  <td>Production</td>
  <td> &nbsp;
    <span tal:content="python: versions['prod'] and (
                       'rev %s' % versions['prod']) or '--'">rev 1</span>
  </td>
</tr>


</table>
</form>


=== Added File CMF/CMFStaging/skins/staging/object_unlock.py ===
##parameters=REQUEST=None
##title=Unlock an object (and display the current view again)

context.portal_lock.unlock(context)
if REQUEST is not None:
    REQUEST.RESPONSE.redirect(REQUEST['HTTP_REFERER'])


=== Added File CMF/CMFStaging/skins/staging/object_version_control_form.pt ===
<html metal:use-macro="here/main_template/macros/master">
<head>
 <title tal:content="template/title">The title</title>
</head>
<body>

<div metal:fill-slot="main">

<form action="." method="POST" tal:attributes="action here/absolute_url"
      tal:define="LockTool here/LockTool|nothing;
                  isLockedOut python: LockTool and LockTool.isLockedOut(here)">

<table>
<tr>
 <th align="left">Revision</th>
 <th align="left">Date</th>
 <th align="left">User</th>
 <th align="left">Message</th>
</tr>

<tr tal:define="cur_id python: here.StagingTool.getVersionId(here)"
    tal:repeat="entry python: here.StagingTool.getLogEntries(here, 1)">

<td>
 <input type="radio" name="version_id"
        tal:attributes="value entry/version_id;
                        checked python: entry['version_id'] == cur_id;
                        disabled isLockedOut" />
 <span tal:content="entry/version_id">8</span>
</td>

<td tal:content="python: DateTime(entry['timestamp']).ISO()">
 2002-01-01 18:10:15
</td>

<td tal:content="entry/user_id">joe</td>
<td tal:content="entry/message"></td>

</tr>

</table>

<input type="submit" name="object_revert_version:action"
       value="Revert to selected revision"
       tal:attributes="disabled isLockedOut" />

</form>

</div>

</body>
</html>


=== Added File CMF/CMFStaging/skins/staging/status_locked.gif ===
  <Binary-ish file>

=== Added File CMF/CMFStaging/skins/staging/status_locked.gif.properties ===
title=Locked by you

=== Added File CMF/CMFStaging/skins/staging/status_locked_out.gif ===
GIF89a      !Created with The GIMP !
  ,       
p͡N\ZF'u`%A ;

=== Added File CMF/CMFStaging/skins/staging/status_locked_out.gif.properties ===
title=Locked by someone else

=== Added File CMF/CMFStaging/skins/staging/status_synced.gif ===
GIF89a      !Created with The GIMP !
  ,       	wkދRbAF ;

=== Added File CMF/CMFStaging/skins/staging/status_synced.gif.properties ===
title=In sync with the published version

=== Added File CMF/CMFStaging/skins/staging/status_unsynced.gif ===
GIF89a      !Created with The GIMP !
  ,       
p{᠒(Y;Zjwn ;

=== Added File CMF/CMFStaging/skins/staging/status_unsynced.gif.properties ===
title=Changed from the published version