<?xml version="1.0"?>
<component name="org.nuxeo.ecm.platform.video.layouts.override">

  <require>org.nuxeo.ecm.platform.video.layouts</require>

  <extension point="widgettypes" target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager">

    <widgetType name="video_player">
      <configuration>
        <sinceVersion>5.7.2</sinceVersion>
        <title>Video player</title>
        <description>
          <p>
            This widget displays a HTML5 video player for browsers
            supporting
            it, and fallback on a Flash player for others.
            It uses the WebM or
            MP4 conversion (in 480p) of
            a document having the facet 'Video'.
          </p>
          <p>
            It requires the following fields configuration: first field maps
            the document model.
          </p>
        </description>
        <handlingLabels>true</handlingLabels>
        <categories>
          <category>summary</category>
        </categories>
        <supportedModes>
          <mode>view</mode>
        </supportedModes>
        <properties>
          <layouts mode="view">
            <layout name="video_player_widget_type_properties_view">
              <rows>
                <row>
                  <widget>width</widget>
                </row>
                <row>
                  <widget>height</widget>
                </row>
              </rows>
              <widget name="width" type="text">
                <labels>
                  <label mode="any">Width</label>
                </labels>
                <helpLabels>
                  <label mode="any">
                    The width attribute of the Video player, eg. 100%, 550px or 450.
                  </label>
                </helpLabels>
                <fields>
                  <field>width</field>
                </fields>
              </widget>
              <widget name="height" type="text">
                <labels>
                  <label mode="any">Height</label>
                </labels>
                <helpLabels>
                  <label mode="any">
                    The height attribute of the Video player, eg. 550px, 450.
                  </label>
                </helpLabels>
                <fields>
                  <field>height</field>
                </fields>
              </widget>
            </layout>
          </layouts>
        </properties>
      </configuration>

      <handler-class>
        org.nuxeo.ecm.platform.forms.layout.facelets.plugins.TemplateWidgetTypeHandler
      </handler-class>
      <property name="template">
        /widgets/video_player_widget_template.xhtml
      </property>
    </widgetType>

    <widgetType name="video_storyboard">
      <configuration>
        <sinceVersion>5.7.2</sinceVersion>
        <title>Video storyboard</title>
        <description>
          <p>
            This widget displays the story board of
            a document having the facet
            'Video'.
          </p>
        </description>
        <handlingLabels>true</handlingLabels>
        <categories>
          <category>summary</category>
        </categories>
        <supportedModes>
          <mode>view</mode>
        </supportedModes>
        <!-- no configurable properties -->
      </configuration>

      <handler-class>
        org.nuxeo.ecm.platform.forms.layout.facelets.plugins.TemplateWidgetTypeHandler
      </handler-class>
      <property name="template">
        /widgets/video_storyboard_widget_template.xhtml
      </property>
    </widgetType>

    <widgetType name="video_conversions">
      <configuration>
        <sinceVersion>5.7.2</sinceVersion>
        <title>Video conversions</title>
        <description>
          <p>
            This widget displays the list of available
            video conversions for the
            given Video document.
          </p>
        </description>
        <handlingLabels>true</handlingLabels>
        <categories>
          <category>summary</category>
        </categories>
        <supportedModes>
          <mode>view</mode>
        </supportedModes>
        <!-- no configurable properties -->
      </configuration>

      <handler-class>
        org.nuxeo.ecm.platform.forms.layout.facelets.plugins.TemplateWidgetTypeHandler
      </handler-class>
      <property name="template">
        /widgets/video_conversions_widget_template.xhtml
      </property>
    </widgetType>

    <widgetType name="video_info">
      <configuration>
        <sinceVersion>5.7.2</sinceVersion>
        <title>Video info</title>
        <description>
          <p>
            This widget displays the information of the main video of
            a document
            having the facet 'Video'.
          </p>
        </description>
        <handlingLabels>true</handlingLabels>
        <categories>
          <category>summary</category>
        </categories>
        <supportedModes>
          <mode>view</mode>
        </supportedModes>
        <!-- no configurable properties -->
      </configuration>

      <handler-class>
        org.nuxeo.ecm.platform.forms.layout.facelets.plugins.TemplateWidgetTypeHandler
      </handler-class>
      <property name="template">
        /widgets/video_info_widget_template.xhtml
      </property>
    </widgetType>

    <widgetType name="video_file">
      <configuration>
        <sinceVersion>5.7.2</sinceVersion>
        <title>Video File</title>
        <description>
          <p>
            The video widget displays a file uploader/editor in create or edit
            mode, with additional message tag for errors.
          </p>
        </description>
        <properties>
          <layouts mode="edit">
            <layout name="video_file_widget_type_properties_edit">
              <rows>
                <row>
                  <widget category="widgetTypeConf">required</widget>
                </row>
                <row>
                  <widget>acceptedExtensions</widget>
                </row>
              </rows>
              <widget name="acceptedExtensions" type="text">
                <labels>
                  <label mode="any">Accepted extensions</label>
                </labels>
                <helpLabels>
                  <label mode="any">
                    A comma separated list of supported file
                    extensions. Default value: '.mpg, .mpe, .mpeg, .wmv, .swf,
                    .ogg, .ogv, .mkv, .mov, .qt, .avi, .mp4, .m4v, .flv, .fla'.
                  </label>
                </helpLabels>
                <fields>
                  <field>acceptedExtensions</field>
                </fields>
              </widget>
            </layout>
          </layouts>
        </properties>
        <categories>
          <category>document</category>
        </categories>
        <supportedModes>
          <mode>edit</mode>
          <mode>view</mode>
        </supportedModes>
        <fields>
          <list>false</list>
          <complex>false</complex>
          <supportedTypes>
            <type>blob</type>
          </supportedTypes>
        </fields>
      </configuration>
      <handler-class>
        org.nuxeo.ecm.platform.forms.layout.facelets.plugins.TemplateWidgetTypeHandler
      </handler-class>
      <property name="template">/widgets/video_file_widget_template.xhtml</property>
    </widgetType>

  </extension>

</component>
