<?xml version="1.0"?>
<openerp>
<data>

    <record model="ir.ui.view" id="view_dir_props_form">
        <field name="name">document.webdav.dir.property.form</field>
        <field name="model">document.webdav.dir.property</field>
        <field name="arch" type="xml">
            <form string="Properties">
                <group col="4">
                    <field name="namespace"/>
                    <field name="name"/>
                    <field name="dir_id" />
                    <field name="do_subst" />
                </group>
                <field name="value" colspan="4" />
            </form>
        </field>
    </record>

    <record model="ir.ui.view" id="view_dir_props_tree">
        <field name="name">document.webdav.dir.property.tree</field>
        <field name="model">document.webdav.dir.property</field>
        <field name="arch" type="xml">
            <tree string="Properties" toolbar="1">
                <field name="dir_id" />
                <field name="namespace"/>
                <field name="name"/>
            </tree>
        </field>
    </record>

    <record id="view_dir_props_filter" model="ir.ui.view">
            <field name="name">Search View: Directory DAV properties</field>
            <field name="model">document.webdav.dir.property</field>
            <field name="arch" type="xml">
                <search string="Search Document properties">
                    <field name="name" filter_domain="['|', ('name','ilike',self), ('namespace','ilike',self)]" string="Document property"/>
                    <group expand="0" string="Group By..." groups="base.group_no_one">
                        <filter string="Dir" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'dir_id'}"/>
                        <filter string="Namespace" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'namespace'}"/>
                    </group>
               </search>
            </field>
        </record>

    <record model="ir.actions.act_window" id="action_dir_props_form">
        <field name="name">DAV Properties for Folders</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">document.webdav.dir.property</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="search_view_id" ref="view_dir_props_filter"/>
    </record>
   <menuitem
        name="DAV Properties"
        id="menu_properties"
        groups="base.group_no_one"
        parent="document.menu_document_management_configuration"/>

      <menuitem
        name="Folders"
        action="action_dir_props_form"
        id="menu_folder_props"
        groups="base.group_no_one"
        parent="menu_properties"/>

    <!-- Add the properties to the directory form -->
    <record model="ir.ui.view" id="view_document_directory_form1">
        <field name="name">document.directory.webdav.inherit</field>
        <field name="model">document.directory</field>
        <field name="inherit_id" ref="document.view_document_directory_form" />
        <field name="arch" type="xml">
        <xpath expr="/form/notebook/page[@string='Dynamic context']" position="after" version="7.0">
        <page string="WebDAV properties">
            <label string="These properties will be added to WebDAV requests" colspan="4" />

            <field name="dav_prop_ids" nolabel="1" colspan="4">
                <tree string="Properties">
                    <field name="namespace"/>
                    <field name="name"/>
                </tree>
                <form string="Properties" version="7.0">
                    <group col="4">
                        <field name="namespace"/>
                        <field name="name"/>
                        <newline />
                        <field name="do_subst" />
                    </group>
                    <field name="value"/>
                </form>
            </field>
        </page>
        </xpath>
    </field>
    </record>

    <!-- File properties -->
    <record model="ir.ui.view" id="view_file_props_form">
        <field name="name">document.webdav.file.property.form</field>
        <field name="model">document.webdav.file.property</field>
        <field name="arch" type="xml">
            <form string="Properties">
                <group col="4">
                    <field name="namespace"/>
                    <field name="name"/>
                    <newline />
                    <field name="file_id" />
                    <field name="do_subst" />
                </group>
                <field name="value"/>
            </form>
        </field>
    </record>

    <record model="ir.ui.view" id="view_file_props_tree">
        <field name="name">document.webdav.file.property.tree</field>
        <field name="model">document.webdav.file.property</field>
        <field name="arch" type="xml">
            <tree string="Properties" toolbar="1">
        <field name="file_id" />
        <field name="namespace"/>
        <field name="name"/>
            </tree>
        </field>
    </record>

    <record id="view_file_props_filter" model="ir.ui.view">
            <field name="name">Search View: File DAV properties</field>
            <field name="model">document.webdav.file.property</field>
            <field name="arch" type="xml">
                <search string="Search Document properties">
                    <field name="name" filter_domain="['|', ('name','ilike',self), ('namespace','ilike',self)]" string="Document Property"/>
                    <group expand="0" string="Group By..." groups="base.group_no_one">
                        <filter string="Document" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'file_id'}"/>
                        <filter string="Namespace" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'namespace'}"/>
                    </group>
               </search>
            </field>
        </record>

    <record model="ir.actions.act_window" id="action_file_props_form">
        <field name="name">DAV Properties for Documents</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">document.webdav.file.property</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="search_view_id" ref="view_file_props_filter"/>
    </record>
   <menuitem
        name="Documents"
        action="action_file_props_form"
        id="menu_document_props"
        groups="base.group_no_one"
        parent="menu_properties"/>
</data>
</openerp>
