
<metal:master use-macro="here/main_template/macros/master">
  <metal:content fill-slot="content">
    <div class="modal"
         id="content"
         tal:define="
           panel_size view/panel_size|nothing;
           panel_style view/panel_style|nothing;
           form_action view/form_action|nothing;
           form_data_pat_inject view/form_data_pat_inject|nothing;
           form_data_pat_validation view/form_data_pat_validation|nothing;
           context_state context/@@plone_context_state;
           useSelf python:context_state.is_structural_folder() and not context_state.is_default_page();
           folder_warning python:useSelf and context.portal_type != 'Topic';
           number_of_objects_to_delete python:folder_warning and view.items_to_delete;
           trash_enabled view/trash_enabled|nothing;
         "
    >
      <div class="pat-modal ${panel_size} ${panel_style}"
           id="pat-modal"
      >
        <h1>${view/title|nothing}</h1>
        <form class="pat-form wizard-box ${python:form_data_pat_inject and 'pat-inject' or ''} panel-class-${panel_size} ${python:form_data_pat_validation and 'pat-validation' or ''}"
              action="${form_action}"
              method="${view/form_method|string:post}"
              data-pat-inject="${form_data_pat_inject}"
              data-pat-validation="${form_data_pat_validation}"
              tal:omit-tag="not:form_action"
        >
          <div class="panel-body">
            <div class="${python: getattr(view, 'body_child_class', 'container')}">

              <article>
                <p tal:condition="view/is_locked"
                   i18n:translate="alert_deleting_locked_item"
                >
                    This item can not be deleted because
                    it is currently locked by another user.
                </p>
                <tal:block condition="not:view/is_locked">
                  <tal:c condition="folder_warning">
                    <p>
                      <tal:notrash condition="not:trash_enabled"
                                   i18n:translate=""
                      >
                          Do you really want to delete this
                        <tal:block content="context/portal_type"
                                   i18n:name="contenttype"
                                   i18n:translate=""
                        />
                          and all its contents?
                      </tal:notrash>
                      <tal:trash condition="trash_enabled"
                                 i18n:translate=""
                      >
                          Do you really want to move to trash this
                        <tal:block content="context/portal_type"
                                   i18n:name="contenttype"
                                   i18n:translate=""
                        />
                          and all its contents?
                      </tal:trash>
                    </p>
                    <p class="pat-message warning"
                       tal:condition="python:number_of_objects_to_delete&gt;1"
                    >
                      <span tal:condition="not:trash_enabled"
                            tal:omit-tag=""
                            i18n:translate="alert_deleting_x_number_of_items"
                      >
                           This will delete a total of
                        <strong tal:content="python:number_of_objects_to_delete"
                                i18n:name="number_of_items_to_delete"
                        >22</strong>
                          items.
                      </span>
                      <span tal:condition="trash_enabled"
                            tal:omit-tag=""
                            i18n:translate=""
                      >
                           This will move to the trash a total of
                        <strong tal:content="python:number_of_objects_to_delete"
                                i18n:name="number_of_items_to_delete"
                        >22</strong>
                          items.
                      </span>
                    </p>
                  </tal:c>
                  <p tal:condition="not:folder_warning"
                     i18n:domain="ploneintranet"
                  >
                    <tal:notrash tal:condition="not:trash_enabled"
                                 i18n:translate=""
                    >
                        You are about to delete this
                      <tal:block tal:content="context/portal_type"
                                 i18n:domain="plone"
                                 i18n:name="contenttype"
                                 i18n:translate=""
                      />.
                        Are you sure?
                    </tal:notrash>
                    <tal:trash tal:condition="trash_enabled"
                               i18n:translate=""
                    >
                        You are about to trash this
                      <tal:block tal:content="context/portal_type"
                                 i18n:domain="plone"
                                 i18n:name="contenttype"
                                 i18n:translate=""
                      />.
                        Are you sure?
                    </tal:trash>
                  </p>
                  <ul>
                    <li tal:content="context/@@plone_context_state/object_title">
                        The item title (ID)
                    </li>
                  </ul>
                </tal:block>
              </article>

              <tal:widgets repeat="widget view/widgets/values">
                <div class="row"
                     tal:define="
                       hidden python:widget.mode == 'hidden';
                     "
                     tal:omit-tag="hidden"
                >

                  <div class="field"
                       tal:define="
                         error widget/error;
                         hidden python:widget.mode == 'hidden';
                       "
                       tal:attributes="
                         class python:'field' + (error and ' error' or '');
                       "
                  >
                    <label for=""
                           tal:condition="not:hidden"
                           tal:attributes="
                             for widget/id;
                           "
                    >
                      <span tal:content="widget/label"
                            i18n:translate=""
                      >label</span>
                    </label>

                    <span class="fieldRequired"
                          title="Required"
                          tal:condition="python:widget.required and not hidden"
                          i18n:attributes="title title_required;"
                          i18n:translate="label_required"
                    >
                              (Required)
                    </span>

                    <div class="formHelp"
                         tal:define="
                           description widget/field/description;
                         "
                         tal:condition="python:description and not hidden"
                         tal:content="description"
                         i18n:translate=""
                    >field description</div>

                    <div tal:condition="error"
                         tal:content="structure error/render"
                    >
                              Error
                    </div>

                    <div class="widget">
                      <input type="text"
                             tal:replace="structure widget/render"
                      />
                    </div>
                  </div>

                </div>
              </tal:widgets>
              <input name="${item/name}"
                     type="hidden"
                     value="${item/value}"
                     tal:repeat="item view/additional_hidden_inputs"
              />

            </div>
          </div>
          <div class="buttons button-bar pat-bumper"
               tal:condition="python: getattr(view, 'show_button_bar', True)"
          >
            <div class="container">
              <tal:block repeat="action view/actions/values">
                <button class="${action/klass}"
                        name="${action/name}"
                        type="${action/type|string:submit}"
                >${action/title}</button>
              </tal:block>
              <tal:token tal:replace="structure context/@@authenticator/authenticator" />
              <button class="pat-button close-panel icon-cancel-circle ${python:form_data_pat_validation and 'validate-ignore'}"
                      type="button"
                      tal:condition="view/show_default_cancel_button|nothing"
                      i18n:translate=""
              >
                  Cancel
              </button>
              <tal:token tal:condition="form_action"
                         tal:replace="structure context/@@authenticator/authenticator"
              />
            </div>
          </div>
        </form>

      </div>
    </div>
  </metal:content>
</metal:master>
