<configure
  xmlns="http://namespaces.zope.org/zope"
  xmlns:browser="http://namespaces.zope.org/browser"
  xmlns:z3c="http://namespaces.zope.org/z3c"
  xmlns:zcml="http://namespaces.zope.org/zcml">

  <include package="plone.z3cform" />
  <include package="plone.app.z3cform" />
  <include package="p01.widget.password" />

  <adapter factory=".widget.ChoiceWidgetFactory" />
  <adapter factory=".templates.layout_factory" />
  <adapter factory=".templates.wrapped_form_factory" />
  <adapter factory=".templates.form_factory" />

  <browser:page
    name="tiny-controls.html"
    for="*"
    permission="zope2.Public"
    template="templates/toolbar.pt"
    />

  <browser:resource
    name="NuPlone.z3cform.js"
    file="templates/behaviour.js"
    />

  <browser:resourceDirectory
    name="NuPlone.tinymce"
    directory="tiny_mce"
    />

  <adapter
    factory=".templates.ErrorViewTemplate"
    for="z3c.form.interfaces.IErrorViewSnippet .interfaces.INuPloneFormLayer"
    provides="zope.pagetemplate.interfaces.IPageTemplate"
    />

  <z3c:widgetTemplate
    mode="input"
    widget="z3c.form.interfaces.ISingleCheckBoxWidget"
    layer=".interfaces.INuPloneFormLayer"
    template="templates/checkbox_input.pt"
    />

  <z3c:widgetTemplate
    mode="input"
    widget="z3c.form.interfaces.ICheckBoxWidget"
    layer=".interfaces.INuPloneFormLayer"
    template="templates/checkboxlist_input.pt"
    />

  <z3c:widgetTemplate
    mode="input"
    widget="z3c.form.interfaces.IPasswordWidget"
    layer=".interfaces.INuPloneFormLayer"
    template="templates/password_input.pt"
    />

  <z3c:widgetTemplate
    mode="input"
    widget="z3c.form.interfaces.IRadioWidget"
    layer=".interfaces.INuPloneFormLayer"
    template="templates/radio_input.pt"
    />

  <z3c:widgetTemplate
    mode="input"
    widget="z3c.form.interfaces.ISelectWidget"
    layer=".interfaces.INuPloneFormLayer"
    template="templates/select_input.pt"
    />

  <z3c:widgetTemplate
    mode="input"
    widget="z3c.form.interfaces.ISubmitWidget"
    layer=".interfaces.INuPloneFormLayer"
    template="templates/submit_input.pt"
    />

  <z3c:widgetTemplate
    mode="input"
    widget="z3c.form.interfaces.ITextWidget"
    layer=".interfaces.INuPloneFormLayer"
    template="templates/text_input.pt"
    />

  <z3c:widgetTemplate
    mode="input"
    widget="z3c.form.interfaces.ITextAreaWidget"
    layer=".interfaces.INuPloneFormLayer"
    template="templates/textarea_input.pt"
    />

  <z3c:widgetTemplate
    mode="input"
    widget="z3c.form.interfaces.ITextLinesWidget"
    layer=".interfaces.INuPloneFormLayer"
    template="templates/textlines_input.pt"
    />

  <z3c:widgetTemplate
    mode="input"
    widget="z3c.form.interfaces.IMultiWidget"
    layer=".interfaces.INuPloneFormLayer"
    template="templates/multi_input.pt"
    />

  <z3c:widgetTemplate
    mode="input"
    widget="z3c.form.interfaces.IObjectWidget"
    layer=".interfaces.INuPloneFormLayer"
    template="templates/object_input.pt"
    />

  <z3c:widgetTemplate
    mode="input"
    widget="plone.app.z3cform.wysiwyg.widget.IWysiwygWidget"
    layer=".interfaces.INuPloneFormLayer"
    template="templates/wysiwyg_input.pt"
    />

  <configure zcml:condition="installed collective.z3cform.datetimewidget">
    <z3c:widgetTemplate
      mode="input"
      widget="collective.z3cform.datetimewidget.interfaces.IDateWidget"
      layer=".interfaces.INuPloneFormLayer"
      template="templates/date_input.pt"
      />

    <z3c:widgetTemplate
      mode="input"
      widget="collective.z3cform.datetimewidget.interfaces.IDatetimeWidget"
      layer=".interfaces.INuPloneFormLayer"
      template="templates/datetime_input.pt"
      />
  </configure>

  <adapter factory=".widget.NamedImageWidgetFactory" />

  <class class=".widget.NicerNamedImageWidget">
    <require
        permission="zope.Public"
        interface="z3c.form.interfaces.IFileWidget"
        />
  </class>

  <adapter factory=".widget.NamedFileWidgetFactory" />

  <class class=".widget.NicerNamedFileWidget">
    <require
        permission="zope.Public"
        interface="z3c.form.interfaces.IFileWidget"
        />
  </class>

  <z3c:widgetTemplate
    mode="input"
    widget="plone.formwidget.namedfile.interfaces.INamedFileWidget"
    layer=".interfaces.INuPloneFormLayer"
    template="templates/namedfile_input.pt"
    />

  <z3c:widgetTemplate
    mode="input"
    widget="plone.formwidget.namedfile.interfaces.INamedImageWidget"
    layer=".interfaces.INuPloneFormLayer"
    template="templates/namedimage_input.pt"
    />

  <adapter
    factory="p01.widget.password.PasswordConfirmationFieldWidget"
    for="zope.schema.interfaces.IPassword
         .interfaces.INuPloneFormLayer"
    />

  <z3c:widgetTemplate
    mode="input"
    widget="p01.widget.password.interfaces.IPasswordConfirmationWidget"
    layer=".interfaces.INuPloneFormLayer"
    template="templates/passwordconfirm_input.pt"
    />

</configure>

