<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:five="http://namespaces.zope.org/five"
    xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
    xmlns:browser="http://namespaces.zope.org/browser"
    xmlns:i18n="http://namespaces.zope.org/i18n"
    xmlns:pp="http://namespaces.zopyx.com/pp"
    xmlns:z3c="http://namespaces.zope.org/z3c"
    xmlns:plone="http://namespaces.plone.org/plone"
    i18n_domain="xmldirector.plonecore"
    >

    <include package="z3c.form" file="meta.zcml" />

    <!-- XML content field -->
    <utility
        name="xmldirector.plonecore.dx.xmltext_field.XML"
        component="xmldirector.plonecore.dx.xmltext_field.XMLTextFactory"
    />

    <utility
        component="xmldirector.plonecore.dx.xmltext_field.XMLTextHandler"
        name="xmldirector.plonecore.dx.xmltext_field.XMLText"
        />

    <adapter factory="xmldirector.plonecore.dx.xmltext_field.XMLFieldDataManager" />


    <adapter factory="xmldirector.plonecore.dx.xmltext_field.XMLTextFieldWidget"/>

    <class class="xmldirector.plonecore.dx.xmltext_field.XMLTextWidget">
        <require
        permission="zope.Public"
        interface="xmldirector.plonecore.dx.xmltext_field.IXMLText"
        />
    </class>

    <class class="xmldirector.plonecore.dx.xmltext_field.XMLText">
        <implements interface="xmldirector.plonecore.dx.xmltext_field.IXMLText"/>
    </class>

    <z3c:widgetTemplate
        mode="input"
        widget="xmldirector.plonecore.dx.xmltext_field.IXMLTextWidget"
        layer="z3c.form.interfaces.IFormLayer"
        template="xmltext_input.pt"
        />

    <z3c:widgetTemplate
        mode="display"
        widget="xmldirector.plonecore.dx.xmltext_field.IXMLTextWidget"
        layer="z3c.form.interfaces.IFormLayer"
        template="xmltext_display.pt"
        />

    <!-- XML binary field -->
    <utility
        name="xmldirector.plonecore.dx.xmlbinary_field.XML"
        component="xmldirector.plonecore.dx.xmlbinary_field.XMLBinaryFactory"
    />

    <utility
        component="xmldirector.plonecore.dx.xmlbinary_field.XMLBinaryHandler"
        name="xmldirector.plonecore.dx.xmlbinary_field.XMLBinary"
        />

    <adapter factory="xmldirector.plonecore.dx.xmlbinary_field.XMLBinaryDataManager" />

    <!-- XML image field -->
    <utility
        name="xmldirector.plonecore.dx.xmlimage_field.XML"
        component="xmldirector.plonecore.dx.xmlimage_field.XMLImageFactory"
    />

    <utility
        component="xmldirector.plonecore.dx.xmlimage_field.XMLImageHandler"
        name="xmldirector.plonecore.dx.xmlimage_field.XMLImage"
        />

    <adapter factory="xmldirector.plonecore.dx.xmlimage_field.XMLImageDataManager" />

    <!-- XML XPath field -->
    <utility
        name="xmldirector.plonecore.dx.xmlxpath_field.XMLXPath"
        component="xmldirector.plonecore.dx.xmlxpath_field.XMLXPathFactory"
    />

    <utility
        component="xmldirector.plonecore.dx.xmlxpath_field.XMLXPathHandler"
        name="xmldirector.plonecore.dx.xmlxpath_field.XMLXPath"
    />

    <adapter factory="xmldirector.plonecore.dx.xmlxpath_field.XMLXPathDataManager" />

    <adapter factory="xmldirector.plonecore.dx.xmlxpath_field.XPathFieldWidget"/>

    <class class="xmldirector.plonecore.dx.xmlxpath_field.XPathWidget">
        <require
        permission="zope.Public"
        interface="xmldirector.plonecore.dx.xmlxpath_field.IXPathWidget"
        />
    </class>

    <class class="xmldirector.plonecore.dx.xmlxpath_field.XMLXPath">
        <implements interface="xmldirector.plonecore.dx.xmlxpath_field.IXMLXPath"/>
    </class>

    <z3c:widgetTemplate
        mode="input"
        widget="xmldirector.plonecore.dx.xmlxpath_field.IXPathWidget"
        layer="z3c.form.interfaces.IFormLayer"
        template="xpath_input.pt"
        />

    <z3c:widgetTemplate
        mode="display"
        widget="xmldirector.plonecore.dx.xmlxpath_field.IXPathWidget"
        layer="z3c.form.interfaces.IFormLayer"
        template="xpath_display.pt"
        />


    <!-- event subscribers for copy & remove operations -->
    <subscriber
        for="* 
             OFS.interfaces.IObjectWillBeRemovedEvent"
        handler=".subscribers.removal_handler"
    />

    <subscriber
        for="* 
             zope.lifecycleevent.IObjectCopiedEvent"
        handler=".subscribers.copied_handler"
    />

   <!--
    <subscriber
        for="* 
             zope.lifecycleevent.IObjectModifiedEvent"
        handler=".subscribers.version_handler"
    />
    -->

    <adapter name="SearchableText" factory=".indexers.SearchableText" />

</configure>
