[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Workflow/Browser - AddWorkflowProcessDefinitionConfiguration.py:1.1.2.1 __init__.py:1.1.2.1 add_workflow_pd_config.pt:1.1.2.1 configure.zcml:1.1.2.1 pd.pt:1.1.2.1 workflow_pd_config_edit.pt:1.1.2.1 workflow_pd_config_edit_part.pt:1.1.2.1

Florent Guillaume fg@nuxeo.com
Thu, 5 Dec 2002 08:28:43 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/Workflow/Browser
In directory cvs.zope.org:/tmp/cvs-serv27865/Browser

Added Files:
      Tag: sprintathon-wf-branch
	AddWorkflowProcessDefinitionConfiguration.py __init__.py 
	add_workflow_pd_config.pt configure.zcml pd.pt 
	workflow_pd_config_edit.pt workflow_pd_config_edit_part.pt 
Log Message:
Added views for the PD and PD configuration object.
The tests pass.
It's now possible to manipulate these things from the ZMI.


=== Added File Zope3/lib/python/Zope/App/Workflow/Browser/AddWorkflowProcessDefinitionConfiguration.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Adding view for the workflow configuration object.

$Id: AddWorkflowProcessDefinitionConfiguration.py,v 1.1.2.1 2002/12/05 13:28:42 efge Exp $
"""

__metaclass__ = type

from Zope.ComponentArchitecture import getServiceManager
from Zope.Proxy.ContextWrapper import getWrapperContainer
from Zope.App.Traversing import getPhysicalPathString
from Zope.Publisher.Browser.BrowserView import BrowserView
from Zope.App.Workflow.IWorkflowProcessDefinition \
     import IWorkflowProcessDefinition
from Zope.App.Workflow.IWorkflowProcessDefinitionConfiguration \
     import IWorkflowProcessDefinitionConfiguration
from Zope.App.Workflow.WorkflowProcessDefinitionConfiguration \
     import WorkflowProcessDefinitionConfiguration
from Zope.App.Forms.Utility import setUpWidgets
from Zope.App.Forms.Utility import getWidgetsDataForContent


class AddWorkflowProcessDefinitionConfiguration(BrowserView):

    def __init__(self, *args):
        super(AddWorkflowProcessDefinitionConfiguration, self).__init__(*args)
        setUpWidgets(self, IWorkflowProcessDefinitionConfiguration)

    def paths(self):
        package = getWrapperContainer(self.context.context)
        base_path = getPhysicalPathString(package)
        paths = []
        for name, ob in package.items():
            if IWorkflowProcessDefinition.isImplementedBy(ob):
                path = '%s/%s' % (base_path, name)
                paths.append(path)
        return paths

    def action(self, path):
        print 'XXXX path=%s' % path
        sd = WorkflowProcessDefinitionConfiguration(path)
        sd = self.context.add(sd)
        getWidgetsDataForContent(self, IWorkflowProcessDefinition, sd)
        self.request.response.redirect(self.context.nextURL())


=== Added File Zope3/lib/python/Zope/App/Workflow/Browser/__init__.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"placeholder"


=== Added File Zope3/lib/python/Zope/App/Workflow/Browser/add_workflow_pd_config.pt ===
<html metal:use-macro="views/standard_macros/page">
<head>
<title>Add a workflow process definition configuration component</title>
</head>
<body>
<div metal:fill-slot="body">

<form action="action.html">
  <table>
    <tr>
      <td>Component</td>
      <td><select name="path">
            <option tal:repeat="path view/paths"
                    tal:attributes="value path"
                    tal:content="path">path</option>
          </select>
      </td>
    </tr>
    <tr>
      <td>Name</td>
      <td tal:content="structure view/name"><input type="text"></td>
    </tr>
    <tr>
      <td>Title</td>
      <td tal:content="structure view/title"><input type="text"></td>
    </tr>
    <tr>
      <td>Description</td>
      <td tal:content="structure view/description"><textarea></textarea></td>
    </tr>
  </table>
  <input type=submit value="Next"/>
</form>

</div></body></html>


=== Added File Zope3/lib/python/Zope/App/Workflow/Browser/configure.zcml ===
<zope:zopeConfigure
   xmlns:zope='http://namespaces.zope.org/zope'
   xmlns='http://namespaces.zope.org/browser'
   xmlns:form="http://namespaces.zope.org/form"
   package="Zope.App.Workflow"
>

<!-- Workflow Process Definition -->

<defaultView
   for=".IWorkflowProcessDefinition."
   name="contents.html"
   />

<view
   for=".IWorkflowProcessDefinition."
   permission="Zope.ManageServices"
   name="contents.html"
   template="Browser/pd.pt"
   />

<menuItems menu="zmi_views" for=".IWorkflowProcessDefinition.">
  <menuItem title="Main"
            action="@@contents.html"/>
  <menuItem title="Meta Data"
            action="@@EditMetaData.html"/>
</menuItems>


<!-- Workflow Process Definition Configuration -->

<view
   for="Zope.App.OFS.Container.IAdding."
   name="WorkflowProcessDefinitionConfiguration"
   factory=".Browser.AddWorkflowProcessDefinitionConfiguration."
   permission="Zope.ManageServices"
   >

   <page name="index.html" template="Browser/add_workflow_pd_config.pt" />
   <page name="action.html" attribute="action" />

</view>

<menuItem
    for="Zope.App.OFS.Container.IAdding."
    menu="add_configuration"
    action="WorkflowProcessDefinitionConfiguration"
    title="Workflow process definition"
    />

<defaultView
   for=".IWorkflowProcessDefinitionConfiguration."
   name="index.html"
   />

<menuItems menu="zmi_views" for=".IWorkflowProcessDefinitionConfiguration.">
  <menuItem title="Edit"
            action="index.html"/>
</menuItems>

<form:edit
   for = ".IWorkflowProcessDefinitionConfiguration."
   name = "index.html"
   schema = ".IWorkflowProcessDefinitionConfiguration."
   label = "Workflow process definition configuration"
   permission = "Zope.ManageServices"
   template = "Browser/workflow_pd_config_edit.pt"
   />

<form:edit
   for = ".IWorkflowProcessDefinitionConfiguration."
   name = "ItemEdit"
   schema =
     "Zope.App.OFS.Services.ConfigurationInterfaces.IConfigurationSummary"
   label = "Workflow process definition configuration"
   template = "Browser/workflow_pd_config_edit_part.pt"
   permission = "Zope.ManageServices"
   />

</zope:zopeConfigure>




<!--   
  <form:edit
     for = ".IWorkflowConfiguration."
     name = "index.html"
     schema = "Zope.App.OFS.Services.ConfigurationInterfaces.IConfiguration."
     label = "Workflow Configuration"
     permission = "Zope.ManageServices"
     template = "Browser/WorkflowConfigEdit.pt"
     />

  <form:edit
     for = ".IWorkflowConfiguration."
     name = "ItemEdit"
     schema =
       "Zope.App.OFS.Services.ConfigurationInterfaces.IConfigurationSummary."
     label = "Workflow Configuration"
     template = "Browser/WorkflowConfigEditPart.pt"
     class = ".Browser.WorkflowConfigURL."
     permission = "Zope.ManageServices"
     />

  <view
     for = ".IWorkflowConfiguration."
     name = "ConfigurationSummary"
     template = "Browser/WorkflowConfigSummary.pt"
     class = ".Browser.WorkflowConfigURL."
     permission="Zope.ManageServices"
     />

-->   



=== Added File Zope3/lib/python/Zope/App/Workflow/Browser/pd.pt ===
<html metal:use-macro="views/standard_macros/page">
<body>
<div metal:fill-slot="body">

    <p>
      This is the main view for the PD.
    </p>

</div>
</body>
</html>


=== Added File Zope3/lib/python/Zope/App/Workflow/Browser/workflow_pd_config_edit.pt ===
<html metal:use-macro="views/standard_macros/page">
<body>
<div metal:fill-slot="body">

  <div metal:use-macro="view/generated_form/macros/body">

    <table metal:fill-slot="extra_info">
      <tr>
        <td>Name</td>
        <td tal:content="context/name">foo</td>
      </tr>
      <tr>
        <td>Path</td>
        <td>
          <a href="."
             tal:content="context/path"
             tal:attributes="href context/path">foo/bar</a>
        </td>
      </tr>
    </table>

  </div>

</div>
</body>
</html>


=== Added File Zope3/lib/python/Zope/App/Workflow/Browser/workflow_pd_config_edit_part.pt ===
<div metal:use-macro="view/generated_form/macros/formbody">

  <h5 metal:fill-slot="heading">
      Workflow process definition "<span tal:replace="context/name">foo</span>"
  </h5>

  <table>
    <tr metal:fill-slot="extra_top">
      <td>Path</td>
      <td>
       <a href="."
          tal:content="context/path"
          tal:attributes="href context/path">foo/bar</a>
      </td>
    </tr>
  </table>

</div>