<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:meta="http://namespaces.zope.org/meta"
    xmlns:browser="http://namespaces.zope.org/browser"
    xmlns:five="http://namespaces.zope.org/five"
    xmlns:i18n="http://namespaces.zope.org/i18n"
    i18n_domain="formtest">

  <include package="five.formlib" file="meta.zcml" />

  <!-- make the zope2.Public permission work -->
  <meta:redefinePermission from="zope2.Public" to="zope.Public" />

  <!-- browser forms -->

  <browser:editform
      schema=".schemacontent.IFieldContent"
      for=".schemacontent.IFieldContent"
      name="edit.html"
      label="Edit Field Content"
      permission="zope2.Public"
      />

  <browser:editform
      schema=".schemacontent.IComplexSchemaContent"
      for=".schemacontent.IComplexSchemaContent"
      name="edit.html"
      permission="zope2.Public"
      class=".schemacontent.ComplexSchemaView"
      />

  <view
      type="zope.publisher.interfaces.browser.IBrowserRequest"
      for="zope.schema.interfaces.IObject"
      provides="zope.app.form.interfaces.IInputWidget"
      factory="five.formlib.objectwidget.ObjectWidget"
      permission="zope.Public"
      />

  <!-- With a widget override -->
  <browser:editform
      schema=".schemacontent.IFieldContent"
      for=".schemacontent.IFieldContent"
      name="widgetoverride.html"
      permission="zope2.Public"
      >

      <widget
         field="description"
         class="zope.app.form.browser.TextAreaWidget"
         />

  </browser:editform>

  <browser:addform
     schema=".schemacontent.IFieldContent"
     content_factory=".schemacontent.FieldContent"
     name="addfieldcontent.html"
     label="Add Field Content"
     permission="zope2.Public"
     />

  <browser:addform
     schema=".schemacontent.IFieldContent"
     content_factory=".schemacontent.FieldContent"
     name="addwidgetoverride.html"
     permission="zope2.Public"
     set_before_add="title description somenumber somelist">

     <widget
         field="description"
         class="zope.app.form.browser.TextAreaWidget"
         />

  </browser:addform>

  <browser:addform
     schema=".schemacontent.IFieldContent"
     content_factory=".schemacontent.FieldContent"
     name="protectedaddform.html"
     permission="zope2.ViewManagementScreens"
     />

  <subscriber
      for=".schemacontent.IFieldContent
           zope.lifecycleevent.interfaces.IObjectModifiedEvent"
      handler=".schemacontent.modifiedSubscriber"
      />

  <subscriber
      for=".schemacontent.IFieldContent
           zope.lifecycleevent.interfaces.IObjectCreatedEvent"
      handler=".schemacontent.createdSubscriber"
      />

  <i18n:registerTranslations directory="locales"/>

  <browser:page
    name="add_content"
    for="*"
    class=".view.AddContentForm"
    permission="zope2.Public"
  />

  <browser:page
    name="edit_content"
    for=".content.IContent"
    class=".view.EditContentForm"
    permission="zope2.Public"
  />

</configure>
