Elxis CMS Forum

Support => Elxis 4.x/5.x DEV => Topic started by: speck on September 29, 2012, 12:10:19

Title: How to create a spacer with some test in XML file of extensions???
Post by: speck on September 29, 2012, 12:10:19
In the xml of elxis 2009.3 modules, to insert a space line with a short to separe some group of parameters as in posted image
(http://i48.tinypic.com/a0xojb.jpg)

i use a command like this:

<param name="@spacer" type="spacer" default="Bold message" label="" description="" />
oer this
<param name="@spacer" type="spacer" default="" label="CX_DSL1_SPDIMSETTING" description="" />

how can do something like this in elxis 4 ??
Title: Re: How to create a spacer with some test in XML file of extensions???
Post by: datahell on September 29, 2012, 14:34:38
Elxis 4.x does does not use spacer/separator. It uses parameters groups instead.
These groups can have titles (with language support), can be collapsed or expanded and bind to other parameters.

Example
<params group="IMAGE_SETTINGS" collapsed="0">
    <param />
    <param />
    <param />
</params>
<params group="Categories" collapsed="1">
    <param />
    <param />
</params>
<params>
    <param />
    <param />
</params>

There are many new parameter types. A related one is comment.

<param type="comment" name="members_com1" default="CATEGORY" label="" description="" />
<param type="comment" name="members_com2" default="" label="" description="">CATEGORY</param>
<param type="comment" name="members_com3" default="" label="" description="">
    <![CDATA[<span style="color:#ff9900;">Category!</span>]]>
</param>

The new parameter types:
previewlist (nice for previewing things), file (yes, you can upload files via XML and get saved into parameters! Even auto resize is supported for image uploads!), folderlist (many usages), imagelist, category, country, range (super useful), month, usergroup, username, hidden (with autovalues support!), comment, color (wow!), position, collection.

You want more? Check hide/show options (taken from articles module):
<params>
   <param type="list" name="source" default="0" label="SOURCE" description="SOURCE_DESC">
      <option value="0" hide="1001,1002">ANY</option>
      <option value="1" show="1001" hide="1002">CATEGORY</option>
      <option value="2" show="1002" hide="1001">MULTIPLE_CATEGORIES</option>
      <option value="3" hide="1001,1002">AUTONOMOUS_PAGES</option>
   </param>
</params>
<params groupid="1001" collapsed="1">
   <param type="category" name="catid" default="" dir="rtl" label="CATEGORY" description="" />
   <param type="radio" name="subcats" default="0" label="INCL_SUBCATEGORIES" description="">
      <option value="0">NO</option>
      <option value="1">YES</option>
   </param>
</params>

Even more element types are supported by the elxisForm library for building web forms.
Title: Sample usage for some of the new XML parameters
Post by: datahell on September 29, 2012, 14:55:57
Sample usage for some of the new XML parameters

previewlist
<param type="previewlist" name="myweather" default="" label="Weather" dir="rtl" position="right" width="68" height="68" description="">
   <option value="">SELECT</option>
   <option value="clear" image="modules/mod_xxx/images/weather-clear.png">Sunny day</option>
   <option value="few-clouds" image="modules/mod_xxx/images/weather-few-clouds.png">Few clouds</option>
   <option value="clouds" image="modules/mod_xxx/images/weather-clouds.png">Clouds</option>
</param>

folderlist
<param type="folderlist" name="lang" default="" label="Language" directory="language/" description="Select language" />

imagelist
<param type="imagelist" name="img" default="" label="Image" directory="media/images/{multisite/}sample/" description="" />
Note the optional multisite keyword.

range
<param type="range" name="pickyear" first="2000" last="2020" step="1" default="2012" label="Year" description="" />

month
<param type="month" name="pickmonth" default="0" short="0" label="Month" description="" />

color
<param type="color" name="mycolour" default="" label="Colour" description="Pick colour" />

file
<param type="file" name="myimage" path="modules/mod_xxx/" filetype="png,jpg,jpeg,gif" maxsize="0" resizewidth="0" resizeheight="0" default="" label="IMAGE" description="" />
Also supports the multisite keyword.
Title: Re: How to create a spacer with some test in XML file of extensions??? [SOLVED]
Post by: speck on October 27, 2012, 12:45:18
<param type="file" name="myimage" path="modules/mod_xxx/" filetype="png,jpg,jpeg,gif" maxsize="0" resizewidth="0" resizeheight="0" default="" label="IMAGE" description="" />
in this parameter there's something of strange
if i have more of same module pubblished in the site, and any module manage an his image, is impossible to manage them because in module the file is renamed with the parameter name "myimage".ext

scenario:
module image a --- image beutifulplace.jpg renamed in myimage.jpg
module image b --- image concordiapalace.jpg renamed in myimage.jpg
 :o

the same thing happens if i use this parameter to upload other type of files, example swf files
<param type="file" name="myswf" path="modules/mod_xxx/" filetype="swf" maxsize="0" resizewidth="0" resizeheight="0" default="" label="IMAGE" description="" />
scenario:
module flash a --- file swf  sunrise.swf renamed in myswf.swf
module flash b --- file swf  chinese.swf renamed in myswf.swf
 :o
Title: Re: How to create a spacer with some test in XML file of extensions???
Post by: datahell on October 27, 2012, 18:02:56
This is how the "file" parameter works in XML.
The file is stored with the name of the "name" attribute. So if you copy the module you will have troubles. Except if the module has been built with this in mind (there can be different file parameters with different names for each module instance*).
If you want just to pick an image from a folder then use the imagelist parameter type.

* Note regarding module instances
The exact module instance can be retrieved in the module's php page with: $elxmod->id

** Note regarding multi-sites
The file XML parameter is safe to be used in multi-site environments if the multisite keyword is set into the path attribute.
During upload Elxis will replace this keyword with the sub-site id.

Supported multisite keyword formats:
{multisite}
{multisite/}
{/multisite}
{/multisite/}

Example
<param type="file" name="myimage" path="modules/mod_xxx/{multisite/}" filetype="png,jpg,jpeg,gif" default="" label="IMAGE" />
If we are on the mother site the save path will become: modules/mod_xxx/
If we are on the sub-site with id = 2 the save path will become: modules/mod_xxx/site2/