(function ($) {
$().extend(mpl.params, {
fields: {
render: function (el, params, data) {
if (typeof params != 'object')
return false;
var param, value, atts;
/* Since ver 2.6.3.3*/
var events_stack = [];
for (var index = 0, count = params.length; index < count; index++) {
param = params[index]; value = '';
if (data[param.name] !== undefined)
value = data[param.name];
else if (param !== undefined && param.value !== undefined) {
value = param.value.toString();
if (value.indexOf('%time%') > -1) {
var d = new Date();
value = value.replace('%time%', d.getTime());
}
}
if (value == '__empty__')
value = '';
if (mpl_param_types_support.indexOf(param.type) == -1)
param.type = '';
atts = {
value: value,
options: ((param.options !== undefined) ? param.options : []),
params: ((param.params !== undefined) ? param.params : []),
sprite: param.sprite,
name: param.name,
type: param.type
};
if (param.type != 'textarea_html')
atts.value = mpl.tools.unesc_attr(atts.value);
var tmpl_html = mpl.template('field', {
label: param.label,
content: mpl.template('field-type-' + param.type, atts),
des: param.description,
name: param.type,
base: param.name,
relation: param.relation
});
tmpl_html = tmpl_html.replace(/\<\;script/g, '')
.replace(/mpl\-param\"/g, 'mpl-css-param"')
.replace(/mpl\-param /g, 'mpl-css-param ');
var field = $(tmpl_html);
screen_el.append(field);
if (is_impt === true)
field.addClass('is-important');
field.addClass('mpl-css-group-' + mpl.tools.esc_slug(i) + ' mpl-css-hidden')
.attr({ 'data-name': n.replace(/\"/g, '') })
.append('');
if (typeof atts.callback == 'function')
setTimeout(atts.callback, 1, field, $, atts);
//if has refer field
if (undefined != groups[i][n]['refer']) {
for (rf in groups[i][n]['refer']) {
var rfn = groups[i][n]['refer'][rf]['property'] + '|' + groups[i][n]['refer'][rf]['selector'];
atts = {
value: rfn,
options: ((atts.options !== undefined) ? atts.options : []),
params: [],
name: 'mpl-css[' + sc + '][' + mpl.tools.esc_slug(i) + '][' + n + ']',
type: 'hidden',
label: ''
};
var rftmpl_html = mpl.template('field-type-hidden', atts);
rftmpl_html = rftmpl_html
.replace(/\<\;script/g, '