[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14628] add support for custom fields as json data
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [14628] add support for custom fields as json data |
Date: |
Sat, 09 Jan 2016 12:24:58 +0000 |
Revision: 14628
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14628
Author: sigurdne
Date: 2016-01-09 12:24:56 +0000 (Sat, 09 Jan 2016)
Log Message:
-----------
add support for custom fields as json data
Modified Paths:
--------------
branches/dev-syncromind/booking/inc/class.custom_fields.inc.php
branches/dev-syncromind/booking/inc/class.soresource.inc.php
branches/dev-syncromind/booking/inc/class.uiresource.inc.php
branches/dev-syncromind/booking/js/booking/resource_new.js
branches/dev-syncromind/booking/setup/phpgw_no.lang
branches/dev-syncromind/booking/setup/setup.inc.php
branches/dev-syncromind/booking/setup/tables_current.inc.php
branches/dev-syncromind/booking/setup/tables_update.inc.php
branches/dev-syncromind/booking/templates/base/resource.xsl
branches/dev-syncromind/booking/templates/base/resource_form.xsl
branches/dev-syncromind/phpgwapi/inc/class.schema_proc_pgsql.inc.php
branches/dev-syncromind/phpgwapi/templates/base/attributes_form.xsl
Modified: branches/dev-syncromind/booking/inc/class.custom_fields.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.custom_fields.inc.php
2016-01-07 09:50:44 UTC (rev 14627)
+++ branches/dev-syncromind/booking/inc/class.custom_fields.inc.php
2016-01-09 12:24:56 UTC (rev 14628)
@@ -59,20 +59,80 @@
public function get_fields($location)
{
$appname = 'booking';
- $attributes = parent::find($appname, $location, 0,
'', 'ASC', 'attrib_sort', true, true);
- return $this->get_field_groups($appname, $location,
$attributes);
+ return parent::find($appname, $location, 0, '', 'ASC',
'attrib_sort', true, true);
}
+
/**
+ *
+ * @param string $location
+ * @param array $fields
+ * @return array the grouped attributes
+ */
+ public function organize_fields($location, $fields = array())
+ {
+ $field_groups = $this->get_field_groups('booking',
$location, $fields);
+ $i = -1;
+ $attributes = array();
+ $_dummy = array(array());
+ foreach($field_groups as $_key => $group)
+ {
+ if(!isset($group['attributes']))
+ {
+ $group['attributes'] = $_dummy;
+ }
+ if(isset($group['group_sort']))
+ {
+ if($group['level'] == 0)
+ {
+ $_tab_name = str_replace(' ',
'_', $group['name']);
+ $active_tab = $active_tab ?
$active_tab : $_tab_name;
+ $tabs[$_tab_name] =
array('label' => $group['name'], 'link' => "#{$_tab_name}",
+ 'disable' => 0);
+ $group['link'] = $_tab_name;
+ $attributes[] = $group;
+ $i ++;
+ }
+ else
+ {
+ $attributes[$i]['attributes'][]
= array
+ (
+ 'datatype' => 'section',
+ 'descr' => '<H' .
($group['level'] + 1) . "> {$group['descr']} </H" . ($group['level'] + 1) . '>',
+ 'level' =>
$group['level'],
+ );
+ $attributes[$i]['attributes'] =
array_merge($attributes[$i]['attributes'], $group['attributes']);
+ }
+ unset($_tab_name);
+ }
+ else
+ {
+ $attributes[] = $group;
+ }
+ }
+ return $attributes;
+ }
+ /**
+ *
+ * @param type $location
+ * @return array the grouped attributes
+ */
+ public function get_organized_fields($location)
+ {
+ $appname = 'booking';
+ $fields = parent::find($appname, $location, 0, '',
'ASC', 'attrib_sort', true, true);
+ return $this->get_field_groups($appname, $location,
$fields);
+ }
+ /**
* Arrange attributes within groups
*
* @param string $location the name of the location of the
attribute
- * @param array $attributes the array of the attributes to
be grouped
+ * @param array $fields the array of the attributes to be
grouped
*
* @return array the grouped attributes
*/
- private function get_field_groups($appname, $location,
$attributes = array())
+ private function get_field_groups($appname, $location, $fields
= array())
{
- return parent::get_attribute_groups($appname,
$location, $attributes);
+ return parent::get_attribute_groups($appname,
$location, $fields, true);
}
}
\ No newline at end of file
Modified: branches/dev-syncromind/booking/inc/class.soresource.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.soresource.inc.php
2016-01-07 09:50:44 UTC (rev 14627)
+++ branches/dev-syncromind/booking/inc/class.soresource.inc.php
2016-01-09 12:24:56 UTC (rev 14628)
@@ -19,6 +19,7 @@
'description' => array('type' =>
'string', 'query' => true, 'required' => false),
'activity_id' => array('type' =>
'int', 'required' => false),
'organizations_ids' => array('type' =>
'string'),
+ 'json_representation' => array('type' =>
'string'),
'building_name' => array('type'
=> 'string',
'query' => true,
'join' => array(
Modified: branches/dev-syncromind/booking/inc/class.uiresource.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uiresource.inc.php
2016-01-07 09:50:44 UTC (rev 14627)
+++ branches/dev-syncromind/booking/inc/class.uiresource.inc.php
2016-01-09 12:24:56 UTC (rev 14628)
@@ -17,6 +17,7 @@
'query' => true,
'add' => true,
'edit' => true,
+ 'get_custom' => true,
'show' => true,
'schedule' => true,
'toggle_show_inactive' => true,
@@ -207,6 +208,16 @@
{
$resource = array_merge($resource,
extract_values($_POST, $this->fields));
$errors =
$this->bo->validate($resource);
+ // $location =
$this->get_location();
+ $fields =
ExecMethod('booking.custom_fields.get_fields',$this->get_location());
+ $values_attribute =
phpgw::get_var('values_attribute');
+ $json_representation = array();
+ foreach($fields as $attrib_id => &$attrib)
+ {
+ $json_representation[$attrib['name']] =
isset($values_attribute[$attrib_id]['value']) ?
$values_attribute[$attrib_id]['value'] : null;
+ // $attrib['value'] =
isset($values_attribute[$attrib_id]['value']) ?
$values_attribute[$attrib_id]['value'] : null;
+ }
+ $resource['json_representation'] =
json_encode($json_representation);
if(!$errors)
{
$receipt = $this->bo->update($resource);
@@ -233,6 +244,55 @@
self::render_template_xsl('resource_form',
array('resource' => $resource, 'activitydata' => $activity_data));
}
+
+ private function get_location()
+ {
+ $activity_id =
phpgw::get_var('activity_id', 'int');
+ $activity_path =
$this->activity_bo->get_path($activity_id);
+ $top_level_activity = $activity_path ?
$activity_path[0]['id'] : 0;
+ return ".resource.{$top_level_activity}";
+ }
+
+ public function get_custom()
+ {
+ $resource_id =
phpgw::get_var('resource_id', 'int');
+ $resource =
$this->bo->read_single($resource_id);
+ $custom_values =
json_decode($resource['json_representation']);
+// _debug_array($custom_values);
+
+
+ $location =
$this->get_location();
+ $custom_fields =
createObject('booking.custom_fields');
+ $fields = $custom_fields->get_fields($location);
+ foreach($fields as $attrib_id => &$attrib)
+ {
+ $attrib['value'] =
isset($custom_values->$attrib['name']) ? $custom_values->$attrib['name'] : null;
+
+ if(isset($attrib['choice']) &&
is_array($attrib['choice']) && $attrib['value'])
+ {
+ foreach($attrib['choice'] as &$choice)
+ {
+ if(is_array($attrib['value']))
+ {
+ $choice['selected'] =
in_array($choice['id'], $attrib['value']) ? 1 : 0;
+ }
+ else
+ {
+ $choice['selected'] =
$choice['id'] == $attrib['value'] ? 1 : 0;
+ }
+ }
+ }
+ }
+// _debug_array($fields);
+ $organized_fields =
$custom_fields->organize_fields($location, $fields);
+
+ $data = array(
+ 'attributes_group' => $organized_fields,
+ );
+
$GLOBALS['phpgw']->xslttpl->add_file(array('attributes_form'));
+ $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('custom_fields' => $data));
+ }
+
public function show()
{
$resource
= $this->bo->read_single(phpgw::get_var('id', 'int'));
@@ -257,6 +317,7 @@
$data = array(
'resource' => $resource
);
+ self::add_javascript('booking', 'booking',
'resource_new.js'); // to render custom fields
self::render_template_xsl('resource', $data);
}
Modified: branches/dev-syncromind/booking/js/booking/resource_new.js
===================================================================
--- branches/dev-syncromind/booking/js/booking/resource_new.js 2016-01-07
09:50:44 UTC (rev 14627)
+++ branches/dev-syncromind/booking/js/booking/resource_new.js 2016-01-09
12:24:56 UTC (rev 14628)
@@ -1,4 +1,31 @@
$(document).ready(function () {
JqueryPortico.autocompleteHelper('index.php?menuaction=booking.uibuilding.index&phpgw_return_as=json&',
'field_building_name', 'field_building_id',
'building_container');
+
+ get_custom_fields();
+
+
+ $("#field_activity_id").change(function () {
+ get_custom_fields();
+ });
});
+
+get_custom_fields = function () {
+ var oArgs = {menuaction: 'booking.uiresource.get_custom', resource_id:
resource_id};
+ var requestUrl = phpGWLink('index.php', oArgs);
+ requestUrl += "&phpgw_return_as=stripped_html";
+ var activity_id = $("#field_activity_id").val();
+ $.ajax({
+ type: 'POST',
+ data: {activity_id: activity_id},
+ dataType: 'html',
+ url: requestUrl,
+ success: function (data) {
+ if (data != null)
+ {
+ var custom_fields = data;
+ $("#custom_fields").html(custom_fields);
+ }
+ }
+ });
+};
Modified: branches/dev-syncromind/booking/setup/phpgw_no.lang
===================================================================
--- branches/dev-syncromind/booking/setup/phpgw_no.lang 2016-01-07 09:50:44 UTC
(rev 14627)
+++ branches/dev-syncromind/booking/setup/phpgw_no.lang 2016-01-09 12:24:56 UTC
(rev 14628)
@@ -43,6 +43,7 @@
quota common no Kvote
are you sure you want to clear cache admin no Er du sikker på at du
vil slette cache
current activities booking no Aktiviteter
+select booking no Velg
-- select an activity -- booking no Velg en aktivitet
-- select a building -- booking no Velg en bygning
-- select a season -- booking no Velg en sesong
Modified: branches/dev-syncromind/booking/setup/setup.inc.php
===================================================================
--- branches/dev-syncromind/booking/setup/setup.inc.php 2016-01-07 09:50:44 UTC
(rev 14627)
+++ branches/dev-syncromind/booking/setup/setup.inc.php 2016-01-09 12:24:56 UTC
(rev 14628)
@@ -1,6 +1,6 @@
<?php
$setup_info['booking']['name'] = 'booking';
- $setup_info['booking']['version'] = '0.2.23';
+ $setup_info['booking']['version'] = '0.2.24';
$setup_info['booking']['app_order'] = 9;
$setup_info['booking']['enable'] = 1;
$setup_info['booking']['app_group'] = 'office';
Modified: branches/dev-syncromind/booking/setup/tables_current.inc.php
===================================================================
--- branches/dev-syncromind/booking/setup/tables_current.inc.php
2016-01-07 09:50:44 UTC (rev 14627)
+++ branches/dev-syncromind/booking/setup/tables_current.inc.php
2016-01-09 12:24:56 UTC (rev 14628)
@@ -115,6 +115,7 @@
'activity_id' => array('type' =>
'int','precision' => '4','nullable' => False),
'sort' => array('type' => 'int','precision' =>
'4','nullable' => False,'default' => 0),
'organizations_ids' => array('type' =>
'varchar','precision' => '50','nullable' => True),
+ 'json_representation' => array('type' =>
'json', 'nullable' => true),
),
'pk' => array('id'),
'fk' => array(
Modified: branches/dev-syncromind/booking/setup/tables_update.inc.php
===================================================================
--- branches/dev-syncromind/booking/setup/tables_update.inc.php 2016-01-07
09:50:44 UTC (rev 14627)
+++ branches/dev-syncromind/booking/setup/tables_update.inc.php 2016-01-09
12:24:56 UTC (rev 14628)
@@ -3325,3 +3325,26 @@
return $GLOBALS['setup_info']['booking']['currentver'];
}
}
+
+ $test[] = '0.2.23';
+ /**
+ * Update booking version from 0.2.23 to 0.2.24
+ *
+ */
+ function booking_upgrade0_2_23()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('bb_resource','json_representation',
+ array(
+ 'type' => 'json',
+ 'nullable' => true
+ )
+ );
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['booking']['currentver'] =
'0.2.24';
+ return $GLOBALS['setup_info']['booking']['currentver'];
+ }
+ }
Modified: branches/dev-syncromind/booking/templates/base/resource.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/resource.xsl 2016-01-07
09:50:44 UTC (rev 14627)
+++ branches/dev-syncromind/booking/templates/base/resource.xsl 2016-01-09
12:24:56 UTC (rev 14628)
@@ -37,6 +37,8 @@
<xsl:value-of
select="php:function('lang', string(resource/type))"/>
</span>
</div>
+ <input type= "hidden" id="field_activity_id"
value="{resource/activity_id}"/>
+ <div id="custom_fields"></div>
<div class="pure-control-group">
<label>
<xsl:value-of
select="php:function('lang', 'Documents')" />
Modified: branches/dev-syncromind/booking/templates/base/resource_form.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/resource_form.xsl
2016-01-07 09:50:44 UTC (rev 14627)
+++ branches/dev-syncromind/booking/templates/base/resource_form.xsl
2016-01-09 12:24:56 UTC (rev 14628)
@@ -1,5 +1,9 @@
<xsl:template match="data" xmlns:php="http://php.net/xsl">
<xsl:call-template name="msgbox"/>
+ <script type="text/javascript">
+ var resource_id = <xsl:value-of select="resource/id"/>;
+ </script>
+
<form action="" method="POST" id="form" class="pure-form
pure-form-aligned" name="form">
<input type="hidden" name="tab" value=""/>
<div id="tab-content">
@@ -113,6 +117,7 @@
</textarea>
</div>
</div>
+ <div id="custom_fields"></div>
<div class="pure-control-group">
<label>
<xsl:value-of
select="php:function('lang', 'organzations_ids')" />
Modified: branches/dev-syncromind/phpgwapi/inc/class.schema_proc_pgsql.inc.php
===================================================================
--- branches/dev-syncromind/phpgwapi/inc/class.schema_proc_pgsql.inc.php
2016-01-07 09:50:44 UTC (rev 14627)
+++ branches/dev-syncromind/phpgwapi/inc/class.schema_proc_pgsql.inc.php
2016-01-09 12:24:56 UTC (rev 14628)
@@ -106,6 +106,12 @@
case 'xml':
$sTranslated = 'xml';
break;
+ case 'json':
+ $sTranslated = 'json';
+ break;
+ case 'jsonb':
+ $sTranslated = 'jsonb';
+ break;
}
return $sTranslated;
}
Modified: branches/dev-syncromind/phpgwapi/templates/base/attributes_form.xsl
===================================================================
--- branches/dev-syncromind/phpgwapi/templates/base/attributes_form.xsl
2016-01-07 09:50:44 UTC (rev 14627)
+++ branches/dev-syncromind/phpgwapi/templates/base/attributes_form.xsl
2016-01-09 12:24:56 UTC (rev 14628)
@@ -1,192 +1,760 @@
+
<!-- $Id$ -->
+<xsl:template xmlns:php="http://php.net/xsl" match="custom_fields">
+ <xsl:call-template name="attributes_values"/>
+</xsl:template>
- <xsl:template name="attributes_form">
- <xsl:apply-templates select="attributes_values"/>
- </xsl:template>
+<!-- New template-->
+<xsl:template xmlns:php="http://php.net/xsl" name="attributes_values">
+ <script type="text/javascript">
+ help_Popup = function(requestUrl)
+ {
+ TINY.box.show({iframe:requestUrl,
boxid:"frameless",width:750,height:450,fixed:false,maskid:"darkmask",maskopacity:40,
mask:true, animate:true, close: true});
+ };
+ </script>
- <xsl:template match="attributes_values">
- <xsl:variable name="lang_attribute_statustext"><xsl:value-of
select="lang_attribute_statustext"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
+ <xsl:for-each select="attributes_group">
+ <div id="{link}">
+ <fieldset>
+ <xsl:apply-templates select="attributes"/>
+ </fieldset>
+ </div>
+ </xsl:for-each>
+</xsl:template>
+
+<!-- New template-->
+<xsl:template xmlns:php="http://php.net/xsl" match="attributes">
+ <xsl:variable name="lang_hour">
+ <xsl:value-of select="php:function('lang', 'hour')" />
+ </xsl:variable>
+ <xsl:variable name="lang_min">
+ <xsl:value-of select="php:function('lang', 'minute')" />
+ </xsl:variable>
+ <xsl:variable name="statustext">
+ <xsl:value-of select="statustext"/>
+ </xsl:variable>
+
+ <xsl:variable name="textareacols">
+ <xsl:value-of select="php:function('get_phpgw_info',
'user|preferences|property|textareacols')" />
+ </xsl:variable>
+ <xsl:variable name="textarearows">
+ <xsl:value-of select="php:function('get_phpgw_info',
'user|preferences|property|textarearows')" />
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="datatype='section'">
+ <div class="pure-control-group">
+ <xsl:value-of select="descr"
disable-output-escaping="yes"/>
+ </div>
+ </xsl:when>
+ </xsl:choose>
+
+ <div class="pure-control-group">
+ <xsl:choose>
+ <xsl:when test="not(hide_row)">
+ <label>
<xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
+ <xsl:when test="helpmsg=1">
+ <xsl:variable
name="help_url">
+ <xsl:value-of
select="help_url"/>
+ </xsl:variable>
+ <a
href="javascript:help_Popup('{$help_url}');">
+
<xsl:text>[</xsl:text>
+ <xsl:value-of
select="input_text"/>
+
<xsl:text>]</xsl:text>
+ </a>
</xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
<xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
+ <xsl:value-of
select="input_text"/>
</xsl:otherwise>
</xsl:choose>
- </xsl:attribute>
-
- <td class="{class}" align="left" valign="top">
- <xsl:value-of select="input_text"/>
<xsl:choose>
- <xsl:when test="datatype='D'">
-
<xsl:text>[</xsl:text><xsl:value-of
select="//lang_dateformat"/><xsl:text>]</xsl:text>
+ <xsl:when test="datatype='pwd'">
+ <br/>
+ <xsl:text>[ </xsl:text>
+ <xsl:choose>
+ <xsl:when
test="value!=''">
+
<xsl:value-of select="php:function('lang', 'edit')"/>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:value-of select="php:function('lang', 'add')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text> ]</xsl:text>
</xsl:when>
</xsl:choose>
- </td>
- <td align="left">
- <xsl:choose>
- <xsl:when test="name!=''">
- <input type="hidden"
name="values_attribute[{counter}][name]" value="{name}"></input>
- <input type="hidden"
name="values_attribute[{counter}][datatype]" value="{datatype}"></input>
- <input type="hidden"
name="values_attribute[{counter}][history]" value="{history}"></input>
- <input type="hidden"
name="values_attribute[{counter}][attrib_id]" value="{attrib_id}"></input>
- <input type="hidden"
name="values_attribute[{counter}][allow_null]" value="{allow_null}"></input>
- <input type="hidden"
name="values_attribute[{counter}][input_text]" value="{input_text}"></input>
+ </label>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="name!=''">
+ <input type="hidden"
name="values_attribute[{id}][name]" value="{name}"/>
+ <input type="hidden"
name="values_attribute[{id}][datatype]" value="{datatype}"/>
+ <input type="hidden"
name="values_attribute[{id}][precision]" value="{precision}"/>
+ <input type="hidden"
name="values_attribute[{id}][history]" value="{history}"/>
+ <input type="hidden"
name="values_attribute[{id}][attrib_id]" value="{id}"/>
+ <input type="hidden"
name="values_attribute[{id}][nullable]" value="{nullable}"/>
+ <input type="hidden"
name="values_attribute[{id}][input_text]" value="{input_text}"/>
+ <input type="hidden"
name="values_attribute[{id}][disabled]" value="{disabled}"/>
+ <xsl:choose>
+ <xsl:when test="datatype='R'">
+ <xsl:call-template
name="choice">
+ <xsl:with-param
name="input_type">radio</xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="datatype='CH'">
+ <xsl:call-template
name="choice">
+ <xsl:with-param
name="input_type">checkbox</xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="datatype='LB'">
+ <select id="id_{name}"
name="values_attribute[{id}][value]" title="{$statustext}">
<xsl:choose>
- <xsl:when
test="datatype='R'">
-
<xsl:call-template name="choice"/>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
</xsl:when>
- <xsl:when
test="datatype='CH'">
-
<xsl:call-template name="choice"/>
+ <xsl:when
test="nullable!='1'">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
</xsl:when>
- <xsl:when
test="datatype='LB'">
- <select
name="values_attribute[{counter}][value]" class="forms"
onMouseover="window.status='{statustext}'; return true;"
onMouseout="window.status='';return true;">
-
<option value=""><xsl:value-of select="//lang_none"/></option>
-
<xsl:for-each select="choice">
-
<xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
-
<xsl:choose>
-
<xsl:when test="checked='checked'">
-
<option value="{$id}" selected="selected"><xsl:value-of
disable-output-escaping="yes" select="value"/></option>
-
</xsl:when>
-
<xsl:otherwise>
-
<option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="value"/></option>
-
</xsl:otherwise>
-
</xsl:choose>
-
</xsl:for-each>
-
</select>
+ </xsl:choose>
+ <option value="">
+ <xsl:value-of
select="php:function('lang', 'select')"/>
+ </option>
+ <xsl:for-each
select="choice">
+ <xsl:variable
name="id">
+
<xsl:value-of select="id"/>
+ </xsl:variable>
+ <xsl:choose>
+
<xsl:when test="selected='1'">
+
<option value="{$id}" selected="selected">
+
<xsl:value-of disable-output-escaping="yes" select="value"/>
+
</option>
+
</xsl:when>
+
<xsl:otherwise>
+
<option value="{$id}">
+
<xsl:value-of disable-output-escaping="yes" select="value"/>
+
</option>
+
</xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </select>
+ </xsl:when>
+ <xsl:when test="datatype='AB'">
+ <xsl:variable
name="contact_name">
+ <xsl:value-of
select="name"/>
+
<xsl:text>_name</xsl:text>
+ </xsl:variable>
+ <xsl:variable
name="lookup_function">
+
<xsl:text>lookup_</xsl:text>
+ <xsl:value-of
select="name"/>
+ <xsl:text>();</xsl:text>
+ </xsl:variable>
+ <xsl:variable
name="clear_function">
+
<xsl:text>clear_</xsl:text>
+ <xsl:value-of
select="name"/>
+ <xsl:text>();</xsl:text>
+ </xsl:variable>
+ <input type="hidden"
name="{name}" value="{value}" onClick="{$lookup_function}" readonly="readonly"
size="5">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
</xsl:when>
- <xsl:when
test="datatype='AB'">
-
<xsl:variable name="contact_name"><xsl:value-of
select="name"/><xsl:text>_name</xsl:text></xsl:variable>
-
<xsl:variable name="lookup_function"><xsl:text>lookup_</xsl:text><xsl:value-of
select="name"/><xsl:text>();</xsl:text></xsl:variable>
- <input
type="text" name="{name}" value="{value}" onClick="{$lookup_function}"
readonly="readonly" size="5" onMouseout="window.status='';return true;" >
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="statustext"/>
-
<xsl:text>'; return true;</xsl:text>
+ </xsl:choose>
+ </input>
+ <input size="30" type="text"
name="{$contact_name}" value="{contact_name}" onClick="{$lookup_function}"
readonly="readonly">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ <input type="checkbox"
name="clear_{name}_box" onClick="{$clear_function}">
+ <xsl:attribute
name="title">
+ <xsl:value-of
select="php:function('lang', 'delete')"/>
+ </xsl:attribute>
+ <xsl:attribute
name="readonly">
+
<xsl:text>readonly</xsl:text>
+ </xsl:attribute>
+ </input>
+ <xsl:choose>
+ <xsl:when
test="contact_tel!=''">
+ <xsl:value-of
select="contact_tel"/>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when
test="contact_email!=''">
+ <a
href="mailto:{contact_email}">
+
<xsl:value-of select="contact_email"/>
+ </a>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="datatype='ABO'">
+ <xsl:variable name="org_name">
+ <xsl:value-of
select="name"/>
+
<xsl:text>_name</xsl:text>
+ </xsl:variable>
+ <xsl:variable
name="lookup_function">
+
<xsl:text>lookup_</xsl:text>
+ <xsl:value-of
select="name"/>
+ <xsl:text>();</xsl:text>
+ </xsl:variable>
+ <input type="hidden"
name="{name}" value="{value}" onClick="{$lookup_function}" readonly="readonly"
size="5">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ <input size="30" type="text"
name="{$org_name}" value="{org_name}" onClick="{$lookup_function}"
readonly="readonly">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ <xsl:choose>
+ <xsl:when
test="org_tel!=''">
+ <xsl:value-of
select="org_tel"/>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when
test="org_email!=''">
+ <a
href="mailto:{org_email}">
+
<xsl:value-of select="org_email"/>
+ </a>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="datatype='VENDOR'">
+ <xsl:variable
name="vendor_name">
+ <xsl:value-of
select="name"/>
+
<xsl:text>_org_name</xsl:text>
+ </xsl:variable>
+ <xsl:variable
name="lookup_function">
+
<xsl:text>lookup_</xsl:text>
+ <xsl:value-of
select="name"/>
+ <xsl:text>();</xsl:text>
+ </xsl:variable>
+ <input type="text" id="{name}"
name="{name}" value="{value}" onClick="{$lookup_function}" readonly="readonly"
size="6">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ <xsl:when
test="nullable!='1'">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ <input size="30" type="text"
id="{$vendor_name}" name="{$vendor_name}" value="{vendor_name}"
onClick="{$lookup_function}" readonly="readonly">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ </xsl:when>
+ <xsl:when test="datatype='custom1'">
+ <select
name="values_attribute[{id}][value]">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ <xsl:when
test="nullable!='1'">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <option value="">
+ <xsl:value-of
select="php:function('lang', 'select')"/>
+ </option>
+ <xsl:for-each
select="choice">
+ <xsl:variable
name="id">
+
<xsl:value-of select="id"/>
+ </xsl:variable>
+ <xsl:choose>
+
<xsl:when test="selected='1'">
+
<option value="{$id}" selected="selected">
+
<xsl:value-of disable-output-escaping="yes" select="name"/>
+
</option>
+
</xsl:when>
+
<xsl:otherwise>
+
<option value="{$id}">
+
<xsl:value-of disable-output-escaping="yes" select="name"/>
+
</option>
+
</xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </select>
+ </xsl:when>
+ <xsl:when test="datatype='custom2'">
+ <xsl:variable
name="custom_name">
+ <xsl:value-of
select="name"/>
+
<xsl:text>_name</xsl:text>
+ </xsl:variable>
+ <xsl:variable
name="lookup_function">
+
<xsl:text>lookup_</xsl:text>
+ <xsl:value-of
select="name"/>
+ <xsl:text>();</xsl:text>
+ </xsl:variable>
+ <input type="text"
name="{name}" value="{value}" onClick="{$lookup_function}" readonly="readonly"
size="6">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ <xsl:when
test="nullable!='1'">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ <input size="30" type="text"
name="{$custom_name}" value="{custom_name}" onClick="{$lookup_function}"
readonly="readonly">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ </xsl:when>
+ <xsl:when test="datatype='custom3'">
+ <xsl:variable name="custom_id">
+ <xsl:value-of
select="name"/>
+ <xsl:text>_id</xsl:text>
+ </xsl:variable>
+
+ <xsl:variable
name="custom_name">
+ <xsl:value-of
select="name"/>
+
<xsl:text>_name</xsl:text>
+ </xsl:variable>
+
+ <xsl:variable
name="custom_container">
+ <xsl:value-of
select="name"/>
+
<xsl:text>_container</xsl:text>
+ </xsl:variable>
+
+ <input id="{$custom_id}"
name="values_attribute[{id}][value]" type="hidden" value="{value}">
+ <xsl:choose>
+ <xsl:when
test="nullable!='1'">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ <input id="{$custom_name}"
name="{$custom_name}" type="text" value="{custom_name}">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ <div id="{$custom_container}"/>
+ </xsl:when>
+ <xsl:when test="datatype='user'">
+ <xsl:variable name="user_name">
+ <xsl:value-of
select="name"/>
+
<xsl:text>_user_name</xsl:text>
+ </xsl:variable>
+ <xsl:variable
name="lookup_function">
+
<xsl:text>lookup_</xsl:text>
+ <xsl:value-of
select="name"/>
+ <xsl:text>();</xsl:text>
+ </xsl:variable>
+ <input type="text" id="{name}"
name="{name}" value="{value}" onClick="{$lookup_function}" readonly="readonly"
size="6">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ <xsl:when
test="nullable!='1'">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ <input size="30" type="text"
id="{$user_name}" name="{$user_name}" value="{user_name}"
onClick="{$lookup_function}" readonly="readonly">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ </xsl:when>
+ <xsl:when test="datatype='D'">
+ <input data-validation="date"
data-validation-format="dd/mm/yyyy" type="text" id="values_attribute_{id}"
name="values_attribute[{id}][value]" value="{value}" size="12" maxlength="12">
+ <xsl:attribute
name="readonly">
+ <xsl:text>
readonly</xsl:text>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ <xsl:when
test="nullable='1'">
+
<xsl:attribute name="data-validation-optional">
+
<xsl:text>true</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ </xsl:when>
+ <xsl:when test="datatype='DT'">
+ <xsl:variable
name="clear_function">
+
<xsl:text>clear_</xsl:text>
+ <xsl:value-of
select="name"/>
+ <xsl:text>();</xsl:text>
+ </xsl:variable>
+
+ <table>
+ <tr>
+ <td>
+ <input
type="text" id="values_attribute_{id}"
name="values_attribute[{id}][value][date]" value="{value/date}" size="12"
maxlength="12">
+
<xsl:attribute name="readonly">
+
<xsl:text> readonly</xsl:text>
</xsl:attribute>
+
<xsl:choose>
+
<xsl:when test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+
</xsl:when>
+
<xsl:when test="nullable!='1'">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+
</xsl:when>
+
</xsl:choose>
</input>
- <input
size="30" type="text" name="{$contact_name}" value="{contact_name}"
onClick="{$lookup_function}" readonly="readonly">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
+ </td>
+ <td>
+ <input
type="text" id="values_attribute_{id}_hour"
name="values_attribute[{id}][value][hour]" value="{value/hour}" size="2"
maxlength="2" title="{$lang_hour}">
+
<xsl:choose>
+
<xsl:when test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+
</xsl:when>
+
</xsl:choose>
</input>
- </xsl:when>
- <xsl:when
test="datatype='VENDOR'">
-
<xsl:variable name="vendor_name"><xsl:value-of
select="name"/><xsl:text>_org_name</xsl:text></xsl:variable>
-
<xsl:variable name="lookup_function"><xsl:text>lookup_</xsl:text><xsl:value-of
select="name"/><xsl:text>();</xsl:text></xsl:variable>
- <input
type="text" name="{name}" value="{value}" onClick="{$lookup_function}"
readonly="readonly" size="6" onMouseout="window.status='';return true;" >
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
+ </td>
+ <td>
+
<xsl:text> : </xsl:text>
+ </td>
+ <td>
+ <input
type="text" id="values_attribute_{id}_min"
name="values_attribute[{id}][value][min]" value="{value/min}" size="2"
maxlength="2" title="{$lang_min}">
+
<xsl:choose>
+
<xsl:when test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+
</xsl:when>
+
</xsl:choose>
</input>
- <input
size="30" type="text" name="{$vendor_name}" value="{vendor_name}"
onClick="{$lookup_function}" readonly="readonly">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="statustext"/>
-
<xsl:text>'; return true;</xsl:text>
+ </td>
+ <td>
+ <input
type="checkbox" name="clear_{name}_box" onClick="{$clear_function}">
+
<xsl:attribute name="title">
+
<xsl:value-of select="php:function('lang', 'delete')"/>
</xsl:attribute>
- </input>
- </xsl:when>
- <xsl:when
test="datatype='D'">
- <input
type="text" name="values_attribute[{counter}][value]" value="{value}"
onFocus="{//dateformat_validate}" onKeyUp="{//onKeyUp}" onBlur="{//onBlur}"
size="12" maxlength="10" onMouseout="window.status='';return true;" >
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="statustext"/>
-
<xsl:text>';return true;</xsl:text>
+
<xsl:attribute name="readonly">
+
<xsl:text>readonly</xsl:text>
</xsl:attribute>
</input>
+
+ </td>
+ </tr>
+ </table>
+ </xsl:when>
+ <xsl:when test="datatype='T'">
+ <textarea id="id_{name}"
name="values_attribute[{id}][value]">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
</xsl:when>
- <xsl:when
test="datatype='T'">
-
<textarea cols="40" rows="6" name="values_attribute[{counter}][value]"
wrap="virtual" onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="statustext"/>
-
<xsl:text>';return true;</xsl:text>
-
</xsl:attribute>
-
<xsl:value-of select="value"/>
-
</textarea>
+ <xsl:when
test="nullable!='1'">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
</xsl:when>
- <xsl:otherwise>
- <input
type="text" name="values_attribute[{counter}][value]" value="{value}" size="30"
onMouseout="window.status='';return true;" >
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="statustext"/>
-
<xsl:text> - </xsl:text>
-
<xsl:value-of select="datatype_text"/>
-
<xsl:text>';return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:otherwise>
</xsl:choose>
+ <xsl:attribute
name="cols">
+ <xsl:choose>
+
<xsl:when test="$textareacols!=''">
+
<xsl:value-of select="$textareacols"/>
+
</xsl:when>
+
<xsl:otherwise>
+
<xsl:text>60</xsl:text>
+
</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute
name="rows">
+ <xsl:choose>
+
<xsl:when test="$textarearows!=''">
+
<xsl:value-of select="$textarearows"/>
+
</xsl:when>
+
<xsl:otherwise>
+
<xsl:text>6</xsl:text>
+
</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:value-of
select="value"/>
+ </textarea>
+ </xsl:when>
+ <xsl:when test="datatype='pwd'">
+ <input type="password"
name="values_attribute[{id}][value]" size="30">
<xsl:choose>
- <xsl:when
test="history=1">
- <input
type="text" name="values_attribute[{counter}][date]" value=""
onFocus="{//dateformat_validate}" onKeyUp="{//onKeyUp}" onBlur="{//onBlur}"
size="12" maxlength="10" onMouseout="window.status='';return true;" >
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="//lang_history_date_statustext"/>
-
<xsl:text>';return true;</xsl:text>
-
</xsl:attribute>
- </input>
-
-
<xsl:variable name="link_history"><xsl:value-of
select="link_history"/></xsl:variable>
-
<xsl:variable name="lang_history_help"><xsl:value-of
select="//lang_history_help"/></xsl:variable>
-
<xsl:variable name="lang_history"><xsl:value-of
select="//lang_history"/></xsl:variable>
- <a
href="javascript:var
w=window.open('{$link_history}','','width=550,height=400,scrollbars')"
-
onMouseOver="overlib('{$lang_history_help}', CAPTION, '{$lang_history}')"
-
onMouseOut="nd()">
-
<xsl:value-of select="//lang_history"/></a>
-
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
</xsl:when>
+ <xsl:when
test="nullable!='1'">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
</xsl:choose>
- </xsl:when>
- </xsl:choose>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template name="choice">
- <xsl:variable name="counter"><xsl:value-of
select="counter"/></xsl:variable>
- <table cellpadding="2" cellspacing="2" width="50%"
align="left">
- <xsl:for-each select="choice" >
- <tr>
- <xsl:attribute name="class">
+ </input>
+ <input type="password"
name="values_attribute[{id}][value2]" size="30">
<xsl:choose>
- <xsl:when
test="@class">
-
<xsl:value-of select="@class"/>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
</xsl:when>
- <xsl:when
test="position() mod 2 = 0">
-
<xsl:text>row_off</xsl:text>
+ <xsl:when
test="nullable!='1'">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
</xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
</xsl:choose>
- </xsl:attribute>
- <td align="left">
- <xsl:value-of select="value"/>
- <xsl:text> </xsl:text>
- </td>
- <td align="left">
+ </input>
+ </xsl:when>
+ <xsl:when test="datatype='bolean'">
+ <input id="id_{name}"
type="checkbox" name="values_attribute[{id}][value]" value="1">
+ <xsl:choose>
+ <xsl:when
test="value!=''">
+
<xsl:attribute name="checked">
+
<xsl:text>checked</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ </xsl:when>
+ <xsl:when test="datatype='link'">
+ <input type="text"
name="values_attribute[{id}][value]" value="{value}" size="30">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ <xsl:when
test="nullable!='1'">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
<xsl:choose>
- <xsl:when
test="checked='checked'">
- <input
type="{input_type}" name="values_attribute[{$counter}][value][]" value="{id}"
checked="checked"></input>
+ <xsl:when
test="value!=''">
+ <br/>
+ <a
href="{value}" target="_blank">
+
<xsl:value-of select="value"/>
+ </a>
</xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="datatype='event'">
+ <xsl:choose>
+ <xsl:when
test="warning!=''">
+ <xsl:value-of
select="warning"/>
+ </xsl:when>
<xsl:otherwise>
- <input
type="{input_type}" name="values_attribute[{$counter}][value][]"
value="{id}"></input>
+ <xsl:variable
name="event_descr">
+
<xsl:value-of select="name"/>
+
<xsl:text>_descr</xsl:text>
+ </xsl:variable>
+ <xsl:variable
name="lookup_function">
+
<xsl:text>lookup_</xsl:text>
+
<xsl:value-of select="name"/>
+
<xsl:text>();</xsl:text>
+ </xsl:variable>
+ <div
class="pure-custom">
+ <input
type="text" name="{name}" value="{value}" onClick="{$lookup_function}"
readonly="readonly" size="6"/>
+ <input
size="30" type="text" name="{$event_descr}" value="{descr}"
onClick="{$lookup_function}" readonly="readonly">
+
<xsl:choose>
+
<xsl:when test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+
</xsl:when>
+
</xsl:choose>
+ </input>
+
<xsl:choose>
+
<xsl:when test="next!=''">
+
<div>
+
<xsl:value-of select="lang_next_run"/>
+
<xsl:text>: </xsl:text>
+
<xsl:value-of select="next"/>
+
</div>
+
<div>
+
<xsl:value-of select="lang_enabled"/>
+
<xsl:text>: </xsl:text>
+
<xsl:value-of select="enabled"/>
+
</div>
+
</xsl:when>
+
</xsl:choose>
+ </div>
</xsl:otherwise>
</xsl:choose>
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </xsl:template>
+ </xsl:when>
+ <xsl:when test="datatype='I'">
+ <input data-validation="number"
id="id_{name}" type="text" name="values_attribute[{id}][value]" value="{value}"
size="30">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ <xsl:when
test="nullable='1'">
+
<xsl:attribute name="data-validation-optional">
+
<xsl:text>true</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ </xsl:when>
+ <xsl:when test="datatype='N'">
+ <input data-validation="number"
data-validation-allowing="float" data-validation-decimal-separator="."
id="id_{name}" type="text" name="values_attribute[{id}][value]" value="{value}"
size="30">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ <xsl:when
test="nullable='1'">
+
<xsl:attribute name="data-validation-optional">
+
<xsl:text>true</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ </xsl:when>
+ <xsl:when test="datatype='email'">
+ <input data-validation="email"
id="id_{name}" type="text" name="values_attribute[{id}][value]" value="{value}"
size="30">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ <xsl:when
test="nullable='1'">
+
<xsl:attribute name="data-validation-optional">
+
<xsl:text>true</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input id="id_{name}"
type="text" name="values_attribute[{id}][value]" value="{value}" size="30">
+ <xsl:choose>
+ <xsl:when
test="disabled!=''">
+
<xsl:attribute name="disabled">
+
<xsl:text> disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ <xsl:when
test="nullable!='1'">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="history=1">
+ <input type="text"
id="values_attribute_{id}_date" name="values_attribute[{id}][date]" value=""
size="12" maxlength="10" readonly="readonly">
+ </input>
+ <xsl:variable
name="link_history">
+ <xsl:value-of
select="link_history"/>
+ </xsl:variable>
+ <xsl:variable
name="lang_history_help">
+ <xsl:value-of
select="//lang_history_help"/>
+ </xsl:variable>
+ <xsl:variable
name="lang_history">
+ <xsl:value-of
select="php:function('lang', 'history')" />
+ </xsl:variable>
+ <a
href="javascript:JqueryPortico.showlightbox_history('{$link_history}')"
title="{$lang_history}">
+ <xsl:value-of
select="$lang_history"/>
+ </a>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </div>
+</xsl:template>
+
+<!-- New template-->
+<xsl:template name="choice">
+ <xsl:param name="input_type" />
+
+ <xsl:variable name="id">
+ <xsl:value-of select="id"/>
+ </xsl:variable>
+ <xsl:variable name="name">
+ <xsl:value-of select="name"/>
+ </xsl:variable>
+ <div class="pure-custom">
+ <xsl:for-each select="choice">
+ <xsl:choose>
+ <xsl:when test="selected='1'">
+ <input id="id_{$name}_{id}"
type="{$input_type}" name="values_attribute[{$id}][value][]" value="{id}"
checked="checked"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <input id="id_{$name}_{id}"
type="{$input_type}" name="values_attribute[{$id}][value][]" value="{id}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:value-of select="value"/>
+ <br></br>
+ </xsl:for-each>
+ </div>
+</xsl:template>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14628] add support for custom fields as json data,
Sigurd Nes <=