<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

        <record id="share_step0_form" model="ir.ui.view">
            <field name="name">share.step0.form</field>
            <field name="model">share.wizard</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Sharing: preparation">
                    <separator colspan="4"
                        string="Please select the action that opens the screen containing the data you want to share."/>
                    <field name="action_id" colspan="4"/>
                    <separator colspan="4"
                        string="Optionally, you may specify an additional domain restriction that will be applied to the shared data."/>
                    <field name="domain"/>
                    <separator colspan="4"/>
                    <group colspan="4">
                        <button special="cancel" string="Cancel" icon='gtk-cancel'/>
                        <button name="go_step_1" string="Next" colspan="1" type="object" icon="gtk-go-forward"/>
                    </group>
                </form>
            </field>
        </record>

        <record id="share_step1_form" model="ir.ui.view">
            <field name="name">share.step1.form</field>
            <field name="model">share.wizard</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Grant instant access to your documents">
                    <group colspan="4" name="emails_group" attrs="{'invisible':[('user_type','!=','emails')]}">
                        <separator colspan="4" string="Share with these people (one e-mail per line)"/>
                        <field colspan="4" nolabel="1" name="new_users" attrs="{'required':[('user_type','=','emails')]}"/>
                    </group>
                    <separator colspan="4" string="Optional: include a personal message"/>
                    <group colspan="4" col="4">
                        <field name="message" colspan="4" nolabel="1"/>
                    </group>
                    <separator colspan="4" string="Extra Options"/>
                    <group colspan="4" col="4">
                        <field name="name" colspan="4"/>
                        <field name="access_mode" colspan="4"/>
                    </group>
                    <separator colspan="4"/>
                    <group colspan="4">
                        <button special="cancel" string="Cancel" icon='gtk-cancel'/>
                        <button name="go_step_2" string="Share" colspan="1" type="object" icon="gtk-go-forward"/>
                    </group>
                </form>
            </field>
        </record>

        <record id="share_step2_form" model="ir.ui.view">
            <field name="name">share.step2.form</field>
            <field name="model">share.wizard</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Access granted!">
                    <separator colspan="4" string="An e-mail notification with instructions has been sent to the following people:"/>
                    <field name="result_line_ids" nolabel="1" colspan="4" mode="tree">
                        <tree string="Summary">
                            <field name="login"/>
                        </tree>
                        <form string="Access info">
                            <field name="login"/>
                        </form>
                    </field>
                    <separator colspan="4"/>
                    <group colspan="4">
                        <button special="cancel" string="Close" icon='gtk-ok'/>
                    </group>
                </form>
            </field>
        </record>

        <!--  action for manual launch from menuitem. context may contain:
                    - 'action_id' (id of action)
                    - 'domain' (string expression for full domain to apply as sent to server, 
                               with dynamic data like 'uid' replaced by actual value (i.e. after eval)!)
                    - 'share_root_url' : URL for direct access to share page (may include %(login)s and %(password)s placeholders)
         -->
        <record id="action_share_wizard" model="ir.actions.act_window">
            <field name="name">Share Wizard</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">share.wizard</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="view_id" ref="share_step0_form"/>
            <field name="target">new</field>
        </record>

        <!--  action for direct launch from client widget with context providing:
                    - 'action_id' (id of action)
                    - 'domain' (string expression for full domain to apply as sent to server, 
                               with dynamic data like 'uid' replaced by actual value (i.e. after eval)!)
                    - 'share_root_url' : URL for direct access to share page (may include %(login)s and %(password)s placeholders)
         -->
        <record id="action_share_wizard_step1" model="ir.actions.act_window">
            <field name="name">Share Wizard</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">share.wizard</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="view_id" ref="share_step1_form"/>
            <field name="target">new</field>
        </record>

    </data>
</openerp>
