<tal:block replace="nothing">
-*- coding: utf-8 -*-
## CMFPlacefulWorkflow
## Copyright (C)2005 Ingeniweb

## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.

## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program; see the file COPYING. If not, write to the
## Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

CMFPlacefulWorkflow configuration panel

# $Source: /cvsroot/ingeniweb/CMFPlacefulWorkflow/skins/CMFPlacefulWorkflow/prefs_workflow_localpolicies_form.pt,v $
# $Id: prefs_workflow_localpolicies_form.pt 25034 2006-06-18 01:51:06Z hannosch $
</tal:block>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      lang="en"
      metal:use-macro="here/prefs_main_template/macros/master"
      i18n:domain="cmfplacefulworkflow">

    <metal:block fill-slot="top_slot"/>

    <div metal:fill-slot="prefs_configlet_content"
         tal:define="errors python:request.get('errors', {});"
         class="configlet">

        <span tal:define="dummy python:request.response.setHeader('pragma','no-cache')" />

        <div id="content" class="documentEditable"
             tal:condition="python:checkPermission('Manage portal', here)">

            <h5 class="hiddenStructure">Views</h5>

            <ul class="contentViews">
                <li id="contentview-workflow-advanced" class="plain">
                    <a href="prefs_workflow_advanced"
                       i18n:translate="label_workflow_global_type_mapping">
                        Global Content Type to Workflow Mapping
                    </a>
                </li>
                <li id="contentview-workflow-localpolicies" class="selected">
                    <a href="prefs_workflow_localpolicies_form"
                       i18n:translate="label_workflow_local_type_mapping">
                        Local Content Type to Workflow Mapping
                    </a>
                </li>
            </ul>

            <div class="contentActions">
                &nbsp;
            </div>

            <div class="documentContent" id="region-content">

                <a name="documentContent"></a>

                <h1 i18n:translate="heading_placeful_workflow">
                    Workflow Policies
                </h1>

                <a href=""
                   class="link-parent"
                   tal:attributes="href string: $portal_url/plone_control_panel"
                   i18n:domain="plone"
                   i18n:translate="label_up_to_plone_setup">
                    Up to Plone Setup
                </a>

                <h3 i18n:translate="title_workflow_policy_setup">
                    Workflow Policies Setup
                </h3>

                <p i18n:translate="description_workflow_policy_setup">
                    Here you can create and configure your workflow policies.
                    A policy modifies workflows for any items in or below
                    a specific folder. To apply a policy you have to add a
                    local workflow policy configuration to the desired
                    folder using the 'policy' item in the 'state' drop-down
                    menu.
                </p>

                <form action=""
                      name=""
                      method="post"
                      tal:attributes="action string:prefs_workflow_localpolicies_set"
                      tal:define="wfp python:here.portal_placeful_workflow;">

                    <fieldset>
                        <legend i18n:translate="legend_workflow_policies">Existing Workflow Policies</legend>

                        <div tal:repeat="wfpid python:wfp.getWorkflowPolicyIds()"
                             class="field">

                            <tal:wfp tal:define="wfp python:wfp.getWorkflowPolicyById(wfpid)">

                            <input type="checkbox" class="noborder" id="policy_id" name="policy_ids:list"
                                   tal:attributes="id wfpid; value wfpid" />

                            <label for="policy_id"
                                   tal:attributes="for wfpid">
                                <a href="prefs_workflow_policy_mapping"
                                   tal:attributes="href python:'prefs_workflow_policy_mapping?wfpid='+wfpid"
                                   tal:content="python:wfp.getTitle() or wfp.getId()">
                                    Title of the policy mapping
                                </a>
                            </label>

                            <div class="formHelp"
                                 tal:content="python:wfp.getDescription()">
                                Description of the policy mapping
                            </div>

                            </tal:wfp>

                        </div>

                        <div class="formControls"
                             tal:condition="python:wfp.getWorkflowPolicyIds()">
                            <input class="context" tabindex="" type="submit" name="delete" value="Remove selected"
                                   i18n:attributes="value label_remove_selected;"
                                   tal:attributes="tabindex tabindex/next;"
                                   />
                        </div>
                    </fieldset>

                    <fieldset>
                        <legend i18n:translate="legend_add_workflow_policy">Add a workflow policy</legend>
                        <div class="field"
                             tal:define="error errors/policy_id | nothing;"
                             tal:attributes="class python:test(error, 'field error', 'field')">

                            <label i18n:translate="label_new_policy_id">New policy Id</label>
                            <span class="fieldRequired" title="Required"
                                  i18n:domain="plone"
                                  i18n:attributes="title title_required;"
                                  i18n:translate="label_required">(Required)</span>

                            <div class="formHelp" id=""
                                 i18n:translate="description_new_policy_id">
                                Enter an id for the new workflow policy
                            </div>

                            <div tal:content="error">Validation error output</div>

                            <input name="policy_id" value="" size="30" tabindex=""
                                   tal:attributes="tabindex tabindex/next;" />
                        </div>
                        <div class="field"
                             tal:define="error errors/policy_id | nothing;"
                             tal:attributes="class python:test(error, 'field error', 'field')">

                            <label i18n:translate="label_duplicate_policy_id">Duplicate another policy</label>
                            <span class="fieldRequired" title="Required"
                                  i18n:domain="plone"
                                  i18n:attributes="title title_required;"
                                  i18n:translate="label_required">(Required)</span>
                            <div class="formHelp" id=""
                                 i18n:translate="description_duplicate_policy_id">
                                Choose a policy to copy when creating the new policy.
                                You also can choose to start with an empty policy.
                            </div>

                            <div tal:content="error">Validation error output</div>
                            <select name="policy_duplicate_id">
                                <option value="empty"
                                        i18n:translate="label_no_policy_duplicated">
                                    No policy duplicated
                                </option>
                                <option value="portal_workflow"
                                        i18n:translate="label_duplicate_portal_workflow">Global workflow</option>
                                <option tal:repeat="wfpid python:wfp.getWorkflowPolicyIds()"
                                        tal:attributes="value wfpid"
                                        tal:content="python:wfp.getWorkflowPolicyById(wfpid).getTitle()">WF policy id</option>
                            </select>
                        </div>

                        <div class="formControls">
                            <input type="submit" class="context" tabindex="" name="add" value="Add"
                                   tal:attributes="tabindex tabindex/next;"
                                   i18n:attributes="value label_add;"
                                   />
                        </div>

                        <input type="hidden" name="form_submitted" value="1" tal:attributes="value template/id" />
                    </fieldset>
                </form>

            </div>
        </div>
        <div id="content"
             class="documentEditable"
             tal:condition="python:not checkPermission('Manage portal', here)">
            <tal:block replace="here/raiseUnauthorized" />
        </div>

    </div>
</html>


