<tal:main define="tool context/getTool">
<html metal:use-macro="context/ui/template/macros/main">
 <metal:fill fill-slot="content"
    tal:define="dummy          python: contextObj.allows('Modify portal content', raiseError=True);
                errors         request/errors | python:{};
                layout         python: contextObj.getPageLayout(layoutType);
                cssJs          python: {};
                phaseInfo      python: contextObj.getAppyPhases(currentOnly=True, layoutType=layoutType);
                phase          phaseInfo/name;
                page           request/page|python:contextObj.getDefaultEditPage();
                dummy          python: contextObj.setLock(user, page);
                confirmMsg     request/confirmMsg | nothing;
                groupedWidgets python: contextObj.getGroupedAppyTypes(layoutType, page, cssJs=cssJs);"
    tal:on-error="structure python: tool.manageError(error)">

  <metal:prologue use-macro="context/ui/page/macros/prologue"/>
  <tal:comment replace="nothing">Warn the user that the form should be left via buttons</tal:comment>
  <script type="text/javascript">
   window.onbeforeunload = function(e){
     theForm = document.getElementById('appyForm');
     if (theForm.button.value == "") {
       var e = e || window.event;
       if (e) {e.returnValue = warn_leave_form;}
       return warn_leave_form;
     }
   }
  </script>
  <form id="appyForm" name="appyForm" method="post" enctype="multipart/form-data"
        tal:attributes="action python: contextObj.absolute_url()+'/do'">
    <input type="hidden" name="action" value="Update"/>
    <input type="hidden" name="button" value=""/>
    <input type="hidden" name="page" tal:attributes="value page"/>
    <input type="hidden" name="nav" tal:attributes="value request/nav|nothing"/>
    <input type="hidden" name="confirmed" value="False"/>
    <metal:show use-macro="context/ui/page/macros/show"/>
  </form>
  <script tal:condition="confirmMsg" type="text/javascript"
          tal:content="python: 'askConfirm(\'script\', \'postConfirmedEditForm()\', \'%s\')' % confirmMsg">
  </script>
  <metal:footer use-macro="context/ui/page/macros/footer"/>
</metal:fill>
</html>
</tal:main>