Click or drag to resize
MediaChooser

With the MediaChooser control, you can select one or more media (most of the time images) with the option to choose amongst a media tree or to upload new medias.

Visually, it is composed of a label, a media thumbnail display and an hidden input to hold the media's id.

For a multiple MediaChooser, you can specify an object type and object id, and the MediaChooser will create a line automatically in the LOBJET_MEDIAS table with OBJECTTYPE and OBJECTID set accordingly.

Attributes and elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute

Description

label

Creates a label tag next to the media display.

labelposition

Where to place the label tag, "left" or "right"; default: left.

id

id attribute of the hidden input

name

the name of the hidden input; if omitted, will default to the id attribute

mode

either multiple or single, whether you want to choose one or more medias

create-directory

XPath attribute; if true, the user will be able to create directories to store his medias in the media popup. Default: false

media-types

A comma separated list of allowed media types; the possible values are the possible values for the TYPOLOGIEID column of the MEDIAS table, usually the children of the TYPOLOGIE of id 10.

tree-root

XPath attribute; if set, defines the tree value from which the media popup will display the medias stored in the database. Default: empty

config

the name of a NameValueFileSectionHandler configuration section which must contain the following keys:

dbSection

database configuration section used to read the style and links list. Default: db

appletConfigTable

table containing the link list. Default: APPLETBLOBCONFIG

styleTable

table containing the style list. Default: STYLE

object-type

value to put into the OBJECTTYPE column of the LOBJET_MEDIAS table for a multiple MediaChooser

object-id

value to put into the OBJECTID column of the LOBJET_MEDIAS table for a multiple MediaChooser

width

XPath expression determining the width of the media display

height

XPath expression determining the height of the media display

Child elements

Element

Description

acs:Init

If medias are already associated with the item being modified, you can put as many acs:Init tag as needed, one per media.

Parent elements

Element

Description

any xhtml or xsl tag

Styling information

The XHTML structure created by the acs:MediaChooser is the following:

<!-- if labelposition left -->
<label for="myid">My label</label>
<div class="media-chooser">
  <ul id="myid-block">
    <li id="myid-0-block" title="12246_M8560 520_390.png">
      <input id="myid" value="12246" type="hidden" name="myid">
      <div class="clip">
        <img id="myid-0-img" src="/upload//0/0/24/12246_M8560 520_390.png">
      </div>
      <div class="medias-icons">
        <img src="/libraries.ashx?tree.close.gif" id="myid-0-close">
      </div>
      <h3 id="myid-0-txt">M8560 DTH product image (520x390)</h3>
      <xml id="myid-0-xml" path="/0/0/24/12246_M8560 520_390.png" value="12246" title="M8560 DTH product image" type="11" width="520" height="390">&nbsp;</xml>
    </li>
  </ul>
</div>
<!-- if labelposition right -->
<label for="myid">My label</label>
Examples
<acs:MediaChooser id="myid" label="{$Photo}" media-types="11" type="11" tree-root="000000000">
  <acs:Init value="{MATERIAL/MEDIASID}" title="{MATERIAL/TITLE}" path="{MATERIAL/PATH}" width="{MATERIAL/WIDTH}" height="{MATERIAL/HEIGHT}" type="11" />
</acs:MediaChooser>