Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
array(
"label" => $lumise->lang('Product'),
"icon" => "lumisex-cube",
"callback" => "",
"load" => "",
"content" =>
'
' .
(
!isset($_GET['product_base']) || strpos($_GET['product_base'], 'variable:') === false ?
'' : ''
) .
'
' . $lumise->lang('More') . '
'
),
'templates' => array(
"label" => $lumise->lang('Templates'),
"icon" => "lumise-icon-star",
"callback" => "",
"load" => "templates",
"class" => "lumise-x-thumbn",
"content" =>
'
'
),
'cliparts' => array(
"label" => $lumise->lang('Cliparts'),
"icon" => "lumise-icon-heart",
"callback" => "",
"load" => "cliparts",
"class" => "lumise-x-thumbn",
"content" =>
'
'
),
'text' => array(
"label" => $lumise->lang('Text'),
"icon" => "lumisex-character",
"callback" => "",
"load" => "",
"class" => "smooth",
"content" =>
'' . $lumise->lang('Click or drag to add text') . '
' .
($lumise->connector->is_admin() || $lumise->cfg->settings['user_font'] !== '0' ? '' : '')
),
'uploads' => array(
"label" => $lumise->lang('Images'),
"icon" => "lumise-icon-picture",
"callback" => "",
"load" => "images",
"class" => "lumise-x-thumbn",
"content" => (($lumise->connector->is_admin() || $lumise->cfg->settings['disable_resources'] != 1) ?
'' : '') .
'
'
),
'shapes' => array(
"label" => $lumise->lang('Shapes'),
"icon" => "lumisex-diamond",
"callback" => "",
"load" => "shapes",
"class" => "smooth",
"content" => ""
),
'layers' => array(
"label" => $lumise->lang('Layers'),
"icon" => "lumise-icon-layers",
"callback" => "layers",
"load" => "",
"class" => "smooth",
"content" => ""
),
'drawing' => array(
"label" => $lumise->lang('Drawing'),
"icon" => "lumise-icon-note",
"callback" => "",
"load" => "",
"class" => "lumise-left-form",
"content" =>
'' . $lumise->lang('Free drawing mode') . '
cfg->settings['enable_colors'] == '0' ? ' class="hidden"' : '') . '>
' . $lumise->lang('Save this color') . '
' . $lumise->lang('Tips: Mouse wheel on the canvas to quick change the brush size') . '
'
)
);
}
public function reg_product_attributes()
{
global $lumise;
$arg = $this->color_options();
$color_options = $this->build_form($arg);
$arg['extend']['content'] = ' \
';
$arg['extend']['return'] = 'values.multiple = wrp.find(\'input[data-op-name="is_multiple"]\').prop(\'checked\');';
$picker_options = $this->build_form($arg);
return array(
'printing' => array(
'hidden' => true,
'render' => ''
),
'select' => array(
'title' => $lumise->lang('Drop down'),
'use_variation' => true,
'values' => $this->build_form($this->form_options()),
'render' => $this->render_select()
),
'product_color' => array(
'title' => $lumise->lang('Product colors'),
'unique' => true,
'use_variation' => true,
'values' => $color_options,
'render' => $this->render_color()
),
'color' => array(
'title' => $lumise->lang('Color picker'),
'values' => $picker_options,
'render' => $this->render_picker()
),
'input' => array(
'title' => $lumise->lang('Input text'),
'default' => '',
'placeholder' => '',
'render' => <<';
EOF
),
'text' => array(
'title' => $lumise->lang('Textarea'),
'default' => '',
'placeholder' => '',
'render' => <<'+data.value.replace(/\>/g, '>').replace(/\';
EOF
),
/*'checkbox' => array(
'title' => $lumise->lang('Multiple checkbox'),
'values' => $select_options,
'render' => <<');
if (!data.value)
data.value = [];
else if (typeof data.value == 'string')
data.value = data.value.split(decodeURI("%0A"));
data.values.map(function(op) {
var new_op = '';
new_op += '
-1 ? 'checked' : '')+' />';
new_op += '
';
new_op += '
';
wrp.append(new_op);
});
return wrp;
EOF
),*/
'options' => array(
'title' => $lumise->lang('Options'),
'values' => $this->build_form($this->form_options(array(
"multiple" => true,
"extend" => array(
"content" => ' \
',
"return" => 'values.multiple = wrp.find(\'input[data-op-name="is_multiple"]\').prop(\'checked\');'
)
))),
'render' => $this->render_options()
),
'quantity' => array(
'title' => $lumise->lang('Quantity'),
'unique' => true,
'values' => $this->quantity_options(),
'render' => $this->render_quantity()
)
);
}
public function build_form($ops = array())
{
global $lumise;
/*array(
"id" => __,
"cols" => array(
"10" => array(
"id" => '',
"label" => '',
"content" => ''
),
),
"btns" => array(
"add" => '',
"clear" => ''
),
"extend" => array(
"content" => "",
"return" => "",
"trigger" => ""
)
)*/
if (!is_array($ops))
$ops = array();
if (!isset($ops['id']))
$ops['id'] = $lumise->generate_id();
if (!isset($ops['cols']))
$ops['cols'] = array();
if (!isset($ops['return']))
$ops['return'] = '';
if (!isset($ops['extend'])) {
$ops['extend'] = array(
"content" => "",
"return" => "",
"trigger" => ""
);
}
if (!isset($ops['btns'])) {
$ops['btns'] = array(
"add" => $lumise->lang('Add option'),
"clear" => $lumise->lang('Clear options')
);
}
$thead = '';
$tbody = '';
$returns = '';
$_content = (isset($ops['extend']['content']) ? $ops['extend']['content'] : '');
$_return = (isset($ops['extend']['return']) ? $ops['extend']['return'] : '');
$_trigger = (isset($ops['extend']['trigger']) ? $ops['extend']['trigger'] : '');
$_add = (isset($ops['extend']['add']) ? $ops['extend']['add'] : $lumise->lang('Add option'));
$_clear = (isset($ops['extend']['clear']) ? $ops['extend']['clear'] : $lumise->lang('Clear options'));
foreach ($ops['cols'] as $col) {
$thead .= '' . $col['title'] . ' | ';
$tbody .= '' . $col['content'] . ' | ';
if (isset($col['id']) && !empty($col['id']) && isset($col['return']) && !empty($col['return']))
$returns .= $col['id'] . ':' . $col['return'] . ',';
}
return << 0) {
data.options.map(function(option) {
content += '{$tbody}
';
});
}
content += '\
\
\
| \
\
\
| \
\
\
';
content += '';
wrp.html(content);
wrp.export_value = function() {
var values = {
options: []
};
wrp.find('tbody tr').each(function() {
var option = {
{$returns}
};
if (
(option.value === undefined || option.value === '') &&
option.title !== undefined
) {
// option.value = lumise.slugify(option.title); old code, not support non ascii value
option.value = encodeURIComponent(option.title);
}
{$_return}
values.options.push(option);
});
wrp.find('textarea[data-name="values"]').val(JSON.stringify(values)).trigger('change');
};
wrp.find('[data-op-name]').on('change', wrp.export_value);
if (typeof wrp.sortable == 'function') {
wrp.find('table tbody').sortable({update: wrp.export_value});
};
var add_option = function(option) {
var row = $('{$tbody}
');
wrp.find('table.lumise-field-options tbody').append(row);
row.find('input').on('change', wrp.export_value);
wrp.export_value();
};
trigger({
el: wrp,
events: {
'button[data-func="add-option"]': 'add_option',
'button[data-func="clear-options"]': 'clear_options',
'table.lumise-field-options tbody': 'func',
'input[data-op-name="is_multiple"]': 'is_multiple'
},
add_option: function(e) {
add_option({value: '', title: '', price: '', min_qty: '', max_qty: ''});
e.preventDefault();
},
clear_options: function(e) {
$(this).closest('table').find('tbody tr').remove();
wrp.export_value();
e.preventDefault();
},
func: function(e) {
if (
e.target.getAttribute('data-func') == 'delete' ||
e.target.getAttribute('data-color') == 'delete'
) {
$(e.target).closest('tr').remove();
wrp.export_value();
e.preventDefault();
}
},
is_multiple: function(e) {
data.multiple = $(this).prop('checked');
wrp.find('input[data-op-name="default"]').attr({type: data.multiple ? 'checkbox' : 'radio'});
}
});
{$_trigger}
EOF;
}
public function form_options($ops = array())
{
global $lumise;
$args = array(
'cols' => array(
array(
'width' => '60%',
'id' => 'title',
'title' => $lumise->lang('Title') . '\
\
\
\
' . $lumise->lang('The title of this option, it will display for select') . '\
\
',
'content' => '',
'return' => '$(this).find(\'input[data-op-name="title"]\').val()'
),
array(
'width' => '20%',
'id' => 'price',
'title' => $lumise->lang('Price') . '\
\
\
\
' . $lumise->lang('The custom price + or - to the total when select this option') . '\
\
',
'content' => '',
'return' => '$(this).find(\'input[data-op-name="price"]\').val()'
),
array(
'width' => '10%',
'id' => 'default',
'title' => $lumise->lang('Default'),
'content' => '',
'return' => '$(this).find(\'input[data-op-name="default"]\').prop(\'checked\')'
),
array(
'width' => '10%',
'id' => '',
'title' => '',
'content' => ''
)
)
);
if (isset($ops['extend']))
$args['extend'] = $ops['extend'];
return $args;
}
public function render_select()
{
global $lumise;
return <<';
el += '';
if (typeof data.values == 'object' && typeof data.values.options == 'object') {
data.values.options.map(function (op){
var new_title = op.title.replace(/-/g, " ");
//new_title = new_title.replace(/[^a-zA-Z0-9 ]+/g, "");
el += '';
});
};
el += '';
return $(el);
EOF;
}
public function render_color()
{
global $lumise;
return <<'),
valid_value = false;
el.append('{$lumise->lang('Clear selected')}');
if (typeof data.values == 'object' && typeof data.values.options == 'object') {
data.values.options.map(function(v) {
if (v.value !== '') {
el.append(''+v.title.replace(/\"/g, '"')+(v.price !== '' ? (' ('+(parseFloat(v.price) > 0 ? '+' : '')+lumise.fn.price(v.price)+')') : '')+'');
if (data.value === v.value)
valid_value = true;
}
});
};
el.append('');
el.find('li[data-color]').on('click', function(e) {
$(this).parent().find('li.choosed').removeClass('choosed');
$(this).addClass('choosed')
.closest('.lumise_form_content')
.find('input.lumise-cart-param')
.val(this.getAttribute('data-color'))
.trigger('change');
setTimeout(lumise.fn.product_color, 1, this.getAttribute('data-color'));
e.preventDefault();
});
if (valid_value && data.value !== undefined && data.value !== '')
el.find('li[data-color="'+data.value+'"]').trigger('click');
return el;
EOF;
}
public function render_picker()
{
global $lumise;
return <<'), valid_value = false;
el.append('{$lumise->lang('Clear color')}');
if (typeof data.values == 'object' && typeof data.values.options == 'object') {
data.values.options.map(function(v) {
if (v.value !== '') {
el.append(''+v.title.replace(/\"/g, '"')+(v.price !== '' ? (' ('+(parseFloat(v.price) > 0 ? '+' : '')+lumise.fn.price(v.price)+')') : '')+'');
if (data.value === v.value)
valid_value = true;
}
});
};
el.append('');
el.find('li[data-color]').on('click', function(e) {
var val = [],
_this = $(this),
items = $(this).parent().find('li[data-color]');
if (_this.attr('data-color') === '') {
items.removeClass('choosed');
} else if (typeof data.values == 'object' && data.values.multiple === true) {
if (_this.hasClass('choosed'))
_this.removeClass('choosed');
else
_this.addClass('choosed');
} else {
items.removeClass('choosed');
_this.addClass('choosed');
};
items.each(function() {
if ($(this).hasClass('choosed'))
val.push(this.getAttribute('data-color'));
});
_this.closest('.lumise_form_content')
.find('input.lumise-cart-param')
.val(val.join(decodeURI("%0A")))
.trigger('change');
e.preventDefault();
});
if (valid_value && data.value !== undefined && data.value !== '') {
data.value.split(decodeURI("%0A")).map(function(v) {
if (v !== '')
el.find('li[data-color="'+v+'"]').trigger('click');
});
};
return el;
EOF;
}
public function render_options()
{
global $lumise;
return <<');
if (!data.value)
data.value = [];
else if (typeof data.value == 'string')
data.value = data.value.split(decodeURI("%0A")); /*.split(',');*/
if (typeof data.values == 'object' && typeof data.values.options == 'object') {
data.values.options.map(function (op){
var tip = '';
if (op.price !== '') {
tip = ' {$lumise->lang('Price/quantity')}: '+(parseFloat(op.price) > 0 ? '+' : '' )+lumise.fn.price(op.price)+'';
}
if (data.values.multiple === true) {
var new_op = '';
new_op += '
-1 ? 'checked' : '')+' />';
new_op += '
'+tip;
new_op += '
';
} else {
var new_op = $(''+
' -1 ? ' checked' : '')+(data.required ? ' required' : '')+' />'+
''+tip+
''+
'
');
};
wrp.append(new_op);
});
}
return wrp;
EOF;
}
public function render_quantity()
{
global $lumise;
return <<';
data.values.package_options.map(function (op){
el += '';
});
el += '';
return $(el);
}
var minmax = [];
if (data.values.min_qty !== undefined && data.values.min_qty !== '')
minmax.push('{$lumise->lang('Min total')}: '+data.values.min_qty);
if (data.values.max_qty !== undefined && data.values.max_qty !== '')
minmax.push('{$lumise->lang('Max total')}: '+data.values.max_qty);
if (data.values.type == 'multiple' && data.values.multiple_options !== undefined) {
if (data.value === undefined || data.value === '') {
data.value = {};
data.value[data.values.multiple_options[0].value] = 1;
} else if (typeof data.value == 'string') {
data.value = JSON.parse(data.value);
try {
} catch (ex) {data.value = {};}
};
var el = '', val, tip;
data.values.multiple_options.map(function (op, i){
val = (
typeof data.value == 'object' && data.value[op.value] !== undefined ?
data.value[op.value].toString().replace(/[^0-9\.]/g, '') :
0
);
tip = [];
if (op.min_qty !== '' && parseInt(op.min_qty) > val) {
val = parseInt(op.min_qty);
};
if (op.max_qty !== '' && parseInt(op.max_qty) < val) {
val = parseInt(op.max_qty);
};
if (op.min_qty !== '')
tip.push('{$lumise->lang('Min quantity')}: '+op.min_qty);
if (op.max_qty !== '')
tip.push('{$lumise->lang('Max quantity')}: '+op.max_qty);
if (op.price !== '')
tip.push('{$lumise->lang('Price/quantity')}: '+(parseFloat(op.price) > 0 ? '+' : '' )+lumise.fn.price(op.price));
el += '
\
\
\
\
'+op.title+'\
'+(tip.length > 0 ? ''+tip.join('
')+'' : '')+'\
'
});
if (minmax.length > 0)
el += '
'+minmax.join(', ')+'
';
el += '
\
';
var new_op = $(el);
var return_values = function () {
var inp = new_op.find('input.lumise-cart-param'),
min = parseInt(inp.attr('data-min')),
max = parseInt(inp.attr('data-max')),
val = {},
qty = 0;
new_op.find('input[data-id]').each(function() {
this.value = this.value !== '' && parseInt(this.value) > 0 ? parseInt(this.value) : 0;
if (
this.getAttribute('data-min') !== '' &&
parseInt(this.getAttribute('data-min')) > parseInt(this.value)
) this.value = this.getAttribute('data-min');
if (
this.getAttribute('data-max') !== '' &&
parseInt(this.getAttribute('data-max')) < parseInt(this.value)
) this.value = this.getAttribute('data-max');
qty += parseInt(this.value);
val[this.getAttribute('data-id')] = this.value;
});
if (!isNaN(min) && min > qty) {
inp.val('').change();
inp.after('{$lumise->lang('Error: Invalid min total quantity')}');
return;
};
if (!isNaN(max) && max < qty) {
inp.val('').change();
inp.after('{$lumise->lang('Error: Invalid max total quantity')}');
return;
};
inp.val(JSON.stringify(val)).change();
};
new_op.find('input[data-id]').on('change', return_values).on('focus', function() {
$(this).select();
});
return_values();
return new_op;
};
if (data.value === undefined || isNaN(parseInt(data.value)) )
data.value = 1;
else data.value = parseInt(data.value);
var new_op = $('\
\
\
\
'+(minmax.length > 0 ? ''+minmax.join(', ')+'' : '')+'\
\
\
');
new_op.find('input.lumise-cart-param').on('blur', function (e){
var val = parseInt(this.value),
min = parseInt(this.getAttribute('data-min')),
max = parseInt(this.getAttribute('data-max'));
if (isNaN(val) || val === '' || val < 1)
val = 1;
if ( !isNaN(min) && min > val )
val = min;
if ( !isNaN(max) && max < val )
val = max;
$(this).val(val).trigger('change');
}).trigger('blur');
new_op.find('em[data-action]').on('click', function (){
var action = $(this).data('action'),
wrp = $(this).closest('.lumise-cart-field-quantity'),
inp = wrp.find('input.lumise-cart-param'),
min = parseInt(inp.attr('data-min')),
max = parseInt(inp.attr('data-max'));
val = parseInt(inp.val());
switch (action) {
case 'minus':
val--;
break;
default:
val++;
}
if (val < 1)
val = 1;
if ( !isNaN(min) && min > val )
val = min;
if ( !isNaN(max) && max < val )
val = max;
inp.val(val).trigger('change');
});
return new_op;
EOF;
}
public function color_options()
{
global $lumise;
return array(
'cols' => array(
array(
'width' => '50%',
'id' => 'title',
'title' => $lumise->lang('Color Title') . '\
\
\
\
' . $lumise->lang('The title of color, it will display instead of hex code') . '\
\
',
'content' => '',
'return' => '$(this).find(\'input[data-op-name="title"]\').val()'
),
array(
'width' => '20%',
'id' => 'value',
'title' => $lumise->lang('Color Value') . '\
\
\
\
' . $lumise->lang('The color value, hex code or name of color') . '\
\
',
'content' => '',
'return' => '$(this).find(\'input[data-op-name="value"]\').val()'
),
array(
'width' => '20%',
'id' => 'price',
'title' => $lumise->lang('Price') . '\
\
\
\
' . $lumise->lang('The custom price + or - to the total when select this color') . '\
\
',
'content' => '',
'return' => '$(this).find(\'input[data-op-name="price"]\').val()'
),
array(
'width' => '5%',
'id' => 'default',
'title' => $lumise->lang('Default'),
'content' => '',
'return' => '$(this).find(\'input[data-op-name="default"]\').prop(\'checked\')'
),
array(
'width' => '5%',
'id' => '',
'title' => '',
'content' => ''
)
),
'extend' => array(
'add' => $lumise->lang('Add new color'),
'clear' => $lumise->lang('Clear all colors'),
'trigger' => <<span').text(),
price: ''
});
}
});
wrp.export_value();
};
triggerObjects.general_events.create_color(e);
e.preventDefault();
});
EOF
)
);
}
public function quantity_options()
{
global $lumise;
return <<\
\
\
\
\
\
';
content += '';
content += '';
content += '';
wrp.html(content);
wrp.export_value = function() {
var values = {
type: wrp.find('select[data-name="layout"]').val(),
min_qty: wrp.find('input[data-name="min-qty"]').val(),
max_qty: wrp.find('input[data-name="max-qty"]').val(),
multiple_options: [],
package_options: []
};
wrp.find('table.lumise-field-options.multiple_options tbody tr').each(function() {
if ($(this).find('input[data-name="title"]').val() !== '') {
values.multiple_options.push({
value: lumise.slugify($(this).find('input[data-name="title"]').val()),
title: $(this).find('input[data-name="title"]').val(),
price: $(this).find('input[data-name="price"]').val(),
min_qty: $(this).find('input[data-name="min-qty"]').val(),
max_qty: $(this).find('input[data-name="max-qty"]').val()
});
}
});
wrp.find('table.lumise-field-options.package_options tbody tr').each(function() {
if ($(this).find('input[data-name="title"]').val() !== '') {
values.package_options.push({
value: $(this).find('input[data-name="value"]').val(),
title: $(this).find('input[data-name="title"]').val(),
price: $(this).find('input[data-name="price"]').val()
});
}
});
wrp.find('textarea[data-name="values"]').val(JSON.stringify(values)).trigger('change');
};
wrp.find('tbody input').on('change', wrp.export_value);
if (typeof wrp.sortable == 'function') {
wrp.find('table tbody').sortable({update: wrp.export_value});
};
trigger({
el: wrp,
events: {
'select[data-name="layout"]:change': 'layout',
'input[data-name="min-qty"]:change,input[data-name="max-qty"]:change': 'qty',
'button[data-func="add-multiple"]': 'add_multiple',
'button[data-func="add-package"]': 'add_package',
'button[data-func="clear-options"]': 'clear_options',
'table.lumise-field-options tbody': 'func'
},
layout: function(e) {
wrp.find('table.lumise-field-options').addClass('hidden');
if (this.value == 'multiple') {
wrp.find('table.lumise-field-options.multiple_options').removeClass('hidden');
} else if (this.value == 'package') {
wrp.find('table.lumise-field-options.package_options').removeClass('hidden');
}
wrp.export_value();
e.preventDefault();
},
qty: function(e) {
wrp.export_value();
e.preventDefault();
},
add_multiple: function(e) {
var row = $('\
| \
| \
| \
| \
| \
');
$(this).closest('table').find('tbody').append(row);
row.find('input').on('change', wrp.export_value);
wrp.export_value();
e.preventDefault();
},
add_package: function(e) {
var row = $('\
| \
| \
| \
| \
');
$(this).closest('table').find('tbody').append(row);
row.find('input').on('change', wrp.export_value);
wrp.export_value();
e.preventDefault();
},
clear_options: function(e) {
$(this).closest('table').find('tbody tr').remove();
wrp.export_value();
e.preventDefault();
},
func: function(e) {
if (
e.target.getAttribute('data-func') == 'delete' ||
e.target.getAttribute('data-color') == 'delete'
) {
$(e.target).closest('tr').remove();
wrp.export_value();
e.preventDefault();
}
}
});
EOF;
}
}