mirror of https://github.com/avecms/AVE.cms.git
M@d D3n
7 years ago
131 changed files with 6918 additions and 6545 deletions
@ -1 +1,6 @@
|
||||
{* |
||||
$field_id |
||||
$field_default |
||||
$field_value |
||||
*} |
||||
{$field_value} |
@ -1 +1,6 @@
|
||||
{* |
||||
$field_id |
||||
$field_default |
||||
$field_value |
||||
*} |
||||
{$field_value} |
@ -1,2 +1,2 @@
|
||||
<input type="hidden" name="feld[{$field_id}]" value=""> |
||||
<input type="hidden" name="feld[{$field_id}]" value="0"> |
||||
<input type="checkbox" name="feld[{$field_id}]" value="1" {if $field_value == 1}checked{/if} /> |
@ -0,0 +1,163 @@
|
||||
<?php |
||||
|
||||
/** |
||||
* AVE.cms |
||||
* |
||||
* @package AVE.cms |
||||
* @version 3.x |
||||
* @filesource |
||||
* @copyright © 2007-2015 AVE.cms, http://www.ave-cms.ru |
||||
* |
||||
* @license GPL v.2 |
||||
*/ |
||||
|
||||
// Мульти чекбокс |
||||
function get_field_checkbox_multi($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null) |
||||
{ |
||||
global $AVE_Template; |
||||
|
||||
$fld_dir = dirname(__FILE__) . '/'; |
||||
$tpl_dir = $fld_dir . 'tpl/'; |
||||
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt'; |
||||
|
||||
$AVE_Template->config_load($lang_file, 'lang'); |
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars()); |
||||
$AVE_Template->config_load($lang_file, 'admin'); |
||||
|
||||
$res = array(); |
||||
|
||||
switch ($action) |
||||
{ |
||||
case 'edit': |
||||
$default_items = explode(',', $default); |
||||
$default_items = array_diff($default_items, array('')); |
||||
|
||||
$field_value_array = explode('|', $field_value); |
||||
$field_value_array = array_values(array_diff($field_value_array, array(''))); |
||||
|
||||
$AVE_Template->assign('items', $default_items); |
||||
$AVE_Template->assign('used', $field_value_array); |
||||
$AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0)); |
||||
$AVE_Template->assign('field_id', $field_id); |
||||
$AVE_Template->assign('field_value', $field_value); |
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl); |
||||
|
||||
return $AVE_Template->fetch($tpl_file); |
||||
break; |
||||
|
||||
case 'doc': |
||||
$default_items = explode(',', $default); |
||||
|
||||
$items = explode('|', $field_value); |
||||
$items = array_diff($items, array('')); |
||||
|
||||
if (! empty($items)) |
||||
{ |
||||
foreach($items as $item) |
||||
{ |
||||
if ($item) |
||||
{ |
||||
if ($tpl_empty) |
||||
{ |
||||
$item = $default_items[(int)$item-1]; |
||||
} |
||||
else |
||||
{ |
||||
$field_param = explode('|', $item); |
||||
|
||||
$item = preg_replace_callback( |
||||
'/\[tag:parametr:(\d+)\]/i', |
||||
function($data) use($field_param, $default_items) |
||||
{ |
||||
return $default_items[$field_param[(int)$data[1]]-1]; |
||||
}, |
||||
$tpl |
||||
); |
||||
} |
||||
} |
||||
|
||||
$res[] = $item; |
||||
} |
||||
} |
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl); |
||||
|
||||
if ($tpl_empty && $tpl_file) |
||||
{ |
||||
$AVE_Template->assign('field_id', $field_id); |
||||
$AVE_Template->assign('field_value', $res); |
||||
$AVE_Template->assign('rubric_id', $rubric_id); |
||||
$AVE_Template->assign('default', $default_items); |
||||
|
||||
return $AVE_Template->fetch($tpl_file); |
||||
} |
||||
|
||||
return (! empty($res)) |
||||
? implode(PHP_EOL, $res) |
||||
: $tpl; |
||||
|
||||
break; |
||||
|
||||
case 'req': |
||||
$default_items = explode(',', $default); |
||||
|
||||
$items = explode('|', $field_value); |
||||
$items = array_diff($items, array('')); |
||||
|
||||
if (! empty($items)) |
||||
{ |
||||
foreach($items as $item) |
||||
{ |
||||
if ($item) |
||||
{ |
||||
if ($tpl_empty) |
||||
{ |
||||
$item = $default_items[(int)$item-1]; |
||||
} |
||||
else |
||||
{ |
||||
$field_param = explode('|', $item); |
||||
|
||||
$item = preg_replace_callback( |
||||
'/\[tag:parametr:(\d+)\]/i', |
||||
function($data) use($field_param, $default_items) |
||||
{ |
||||
return $default_items[$field_param[(int)$data[1]]-1]; |
||||
}, |
||||
$tpl |
||||
); |
||||
} |
||||
} |
||||
|
||||
$res[] = $item; |
||||
} |
||||
} |
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl); |
||||
|
||||
if ($tpl_empty && $tpl_file) |
||||
{ |
||||
$AVE_Template->assign('field_id', $field_id); |
||||
$AVE_Template->assign('field_value', $res); |
||||
$AVE_Template->assign('rubric_id', $rubric_id); |
||||
$AVE_Template->assign('default', $default_items); |
||||
|
||||
return $AVE_Template->fetch($tpl_file); |
||||
} |
||||
|
||||
return (! empty($res)) |
||||
? implode(PHP_EOL, $res) |
||||
: $tpl; |
||||
|
||||
break; |
||||
|
||||
case 'name': |
||||
return $AVE_Template->get_config_vars('name'); |
||||
break; |
||||
|
||||
} |
||||
return ($res ? $res : $field_value); |
||||
} |
||||
?> |
@ -0,0 +1,6 @@
|
||||
{* |
||||
$field_id |
||||
$field_default |
||||
$field_value |
||||
*} |
||||
{$field_value} |
@ -0,0 +1,6 @@
|
||||
{* |
||||
$field_id |
||||
$field_default |
||||
$field_value |
||||
*} |
||||
{$field_value} |
@ -1,127 +0,0 @@
|
||||
var DocSearch = { |
||||
|
||||
init: false, |
||||
|
||||
init: function() { |
||||
if (this.initialized) return; |
||||
this.initialized = true; |
||||
|
||||
this.DocSearch_items(); |
||||
}, |
||||
|
||||
DocSearch_items: function() { |
||||
this.DocSearch_sortable(); |
||||
this.DocSearch_del_item(); |
||||
this.DocSearch_add(); |
||||
this.DocSearch_search(); |
||||
}, |
||||
|
||||
DocSearch_update: function() { |
||||
this.DocSearch_maxid(); |
||||
this.DocSearch_del_item(); |
||||
this.DocSearch_search(); |
||||
AveAdmin.tooltip(); |
||||
}, |
||||
|
||||
DocSearch_maxid: function(id) { |
||||
var maxid = 1; |
||||
$('#docsearch_lists_' + id).children('.docsearch_list').each(function() { |
||||
maxid = Math.max(maxid, parseInt($(this).attr("data-id")) + 1); |
||||
}); |
||||
return maxid; |
||||
}, |
||||
|
||||
DocSearch_del_item: function() { |
||||
$('.docsearch_list .DelButton').on('click', function(event) { |
||||
event.preventDefault(); |
||||
var id = $(this).attr('data-id'); |
||||
jConfirm( |
||||
docsearch_del_conf, |
||||
docsearch_del_head, |
||||
function(b) { |
||||
if (b) { |
||||
$('#docsearch_list_' + id).remove(); |
||||
} |
||||
} |
||||
); |
||||
}); |
||||
}, |
||||
|
||||
DocSearch_add: function() { |
||||
$('.AddButton').on('click', function() { |
||||
c_id = $(this).parent().parent('.docsearch_lists').attr("data-id"); |
||||
d_id = $(this).parent().parent('.docsearch_lists').attr("data-docid"); |
||||
i_id = DocSearch.DocSearch_maxid(d_id + '_' + c_id); |
||||
$('#docsearch_lists_' + d_id + '_' + c_id + ':last').append( |
||||
'<div class="docsearch_list fix mb10" id="docsearch_list_' + d_id + '_' + c_id + '_' + i_id + '" data-id="' + i_id + '">' + |
||||
'<input class="mousetrap search_docsearch" name="data[' + d_id + '][feld][' + c_id + '][' + i_id + '][param]" type="text" value="" placeholder="' + docsearch_param + '" data-docid="' + d_id + '" data-fieldid="' + c_id + '" data-id="' + i_id + '" style="width: 450px;"/> Id: <input type="text" class="mousetrap field_' + d_id + '_' + c_id + '_' + i_id + '" value="" name="data[' + d_id + '][feld][' + c_id + '][' + i_id + '][value]" placeholder="' + docsearch_value + '" style="width: 50px;" readonly /> <a href="javascript:void(0);" data-id="' + d_id + '_' + c_id + '_' + i_id + '" class="button redBtn topDir DelButton" title="' + docsearch_del + '">×</a>' + |
||||
'<div class="handle" style="float: left; display: inline-block; margin: 4px 7px; cursor: move;"><span class="icon_sprite ico_move"></span></div>' + |
||||
'</div>' |
||||
); |
||||
|
||||
DocSearch.DocSearch_update(); |
||||
}); |
||||
}, |
||||
|
||||
DocSearch_sortable: function() { |
||||
$('.docsearch_lists').sortable({ |
||||
handle: ".handle", |
||||
placeholder: "ui-state-highlight grey_bg" |
||||
}); |
||||
}, |
||||
|
||||
/** |
||||
* @return {boolean} |
||||
*/ |
||||
DocSearch_search: function() { |
||||
|
||||
$(document).on('input', '.search_docsearch', function(event) |
||||
{ |
||||
event.preventDefault(); |
||||
|
||||
var query = $(this); |
||||
|
||||
var did = query.attr('data-docid'); |
||||
var fid = query.attr('data-fieldid'); |
||||
var kid = query.attr('data-id'); |
||||
var field_id_input = $('.field_' + did + '_' + fid + '_' + kid); |
||||
|
||||
query.autocomplete("index.php?do=fields&field=doc_from_rub_search&type=search&doc_id=" + did + "&field_id=" + fid, { |
||||
width: query.outerWidth(), |
||||
max: 5, |
||||
dataType: "json", |
||||
matchContains: "word", |
||||
scroll: true, |
||||
scrollHeight: 200, |
||||
parse: function(data) { |
||||
return $.map(data, function(row) { |
||||
return { |
||||
data: row, |
||||
value: row.doc_title, |
||||
result: query.val() |
||||
} |
||||
}); |
||||
}, |
||||
formatItem: function(item) { |
||||
return '<div style="padding: 3px 0;"><span style="font-weight: 700;">(' + item.doc_rubric + ')</span> ' + item.doc_title + '</div>'; |
||||
} |
||||
}).result(function(event, item) { |
||||
|
||||
query.val(item.doc_title); |
||||
|
||||
field_id_input.val(item.doc_id); |
||||
|
||||
query.unautocomplete(); |
||||
}); |
||||
|
||||
return false; |
||||
}); |
||||
|
||||
return false; |
||||
} |
||||
} |
||||
|
||||
$(document).ready(function() |
||||
{ |
||||
DocSearch.init(); |
||||
}); |
@ -1,76 +0,0 @@
|
||||
<? |
||||
|
||||
/** |
||||
* AVE.cms |
||||
* |
||||
* @package AVE.cms |
||||
* @version 3.x |
||||
* @filesource |
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru |
||||
* |
||||
* @license GPL v.2 |
||||
*/ |
||||
|
||||
// Загрузить файл |
||||
function get_field_download($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){ |
||||
|
||||
global $AVE_Template; |
||||
|
||||
$fld_dir = dirname(__FILE__) . '/'; |
||||
$tpl_dir = $fld_dir . 'tpl/'; |
||||
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt'; |
||||
|
||||
$AVE_Template->config_load($lang_file, 'lang'); |
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars()); |
||||
$AVE_Template->config_load($lang_file, 'admin'); |
||||
|
||||
$res=0; |
||||
|
||||
switch ($action) |
||||
{ |
||||
case 'edit': |
||||
$field_value = !empty($field_value) ? htmlspecialchars($field_value, ENT_QUOTES) : ''; |
||||
|
||||
$AVE_Template->assign('field_id', $field_id); |
||||
$AVE_Template->assign('field_value', $field_value); |
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin'); |
||||
|
||||
return $AVE_Template->fetch($tpl_file); |
||||
break; |
||||
|
||||
case 'doc': |
||||
$field_value = clean_php($field_value); |
||||
$field_param = explode('|', $field_value); |
||||
if ($tpl_empty) |
||||
{ |
||||
$field_value = (!empty($field_param[1]) ? $field_param[1] . '<br />' : '') |
||||
. '<form method="get" target="_blank" action="' . $field_param[0] |
||||
. '"><input class="basicBtn" type="submit" value="Скачать" /></form>'; |
||||
} |
||||
else |
||||
{ |
||||
$field_value = preg_replace_callback( |
||||
'/\[tag:parametr:(\d+)\]/i', |
||||
function($data) use($field_param) |
||||
{ |
||||
return $field_param[(int)$data[1]]; |
||||
}, |
||||
$tpl |
||||
); |
||||
} |
||||
$res = $field_value; |
||||
break; |
||||
|
||||
case 'req': |
||||
$res=get_field_default($field_value,$action,$field_id,$tpl,$tpl_empty,$maxlength,$document_fields,$rubric_id); |
||||
break; |
||||
|
||||
case 'name' : |
||||
return $AVE_Template->get_config_vars('name'); |
||||
break; |
||||
} |
||||
return ($res ? $res : $field_value); |
||||
} |
||||
?> |
@ -1,7 +0,0 @@
|
||||
<div style="" id="feld_{$field_id}"><a name="{$field_id}"></a> |
||||
<div style="display:none" id="feld_{$field_id}"> |
||||
<img style="display:none" id="_img_feld__{$field_id}" src="{$field_value}" alt="" border="0" /></div> |
||||
<div style="display:none" id="span_feld__{$field_id}"></div> |
||||
<input class="mousetrap" type="text" style="width: 400px;" name="feld[{$field_id}]" value="{$field_value|escape}" id="img_feld__{$field_id}" /> |
||||
<input value="{#MAIN_OPEN_MEDIAPATH#}"" class="basicBtn" type="button" onclick="browse_uploads('img_feld__{$field_id}', '', '', '0');" /> |
||||
<a class="button blackBtn topDir" title="{#DOC_FILE_TYPE_HELP#}" href="#">?</a> |
@ -1,79 +0,0 @@
|
||||
<? |
||||
|
||||
/** |
||||
* AVE.cms |
||||
* |
||||
* @package AVE.cms |
||||
* @version 3.x |
||||
* @filesource |
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru |
||||
* |
||||
* @license GPL v.2 |
||||
*/ |
||||
|
||||
//Flash-ролик |
||||
function get_field_flash($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null){ |
||||
global $AVE_Template; |
||||
|
||||
|
||||
$fld_dir = dirname(__FILE__) . '/'; |
||||
$tpl_dir = $fld_dir . 'tpl/'; |
||||
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt'; |
||||
|
||||
$AVE_Template->config_load($lang_file, 'lang'); |
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars()); |
||||
$AVE_Template->config_load($lang_file, 'admin'); |
||||
|
||||
$res = 0; |
||||
|
||||
switch ($action) |
||||
{ |
||||
case 'edit': |
||||
$field_value = !empty($field_value) ? htmlspecialchars($field_value, ENT_QUOTES) : ''; |
||||
|
||||
$AVE_Template->assign('field_id', $field_id); |
||||
$AVE_Template->assign('field_value', $field_value); |
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin'); |
||||
|
||||
return $AVE_Template->fetch($tpl_file); |
||||
break; |
||||
|
||||
case 'doc': |
||||
$field_value = clean_php($field_value); |
||||
$field_param = explode('|', $field_value); |
||||
$field_param[1] = (!empty($field_param[1]) && is_numeric($field_param[1])) ? $field_param[1] : 470; |
||||
$field_param[2] = (!empty($field_param[2]) && is_numeric($field_param[2])) ? $field_param[2] : 320; |
||||
if ($tpl_empty) |
||||
{ |
||||
$field_value = '<embed scale="exactfit" width="' . $field_param[1] . '" height="' . $field_param[2] |
||||
. '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="' |
||||
. ABS_PATH . $field_param[0] . '" play="true" loop="true" menu="true"></embed>'; |
||||
} |
||||
else |
||||
{ |
||||
$field_value = preg_replace_callback( |
||||
'/\[tag:parametr:(\d+)\]/i', |
||||
function($data) use($field_param) |
||||
{ |
||||
return $field_param[(int)$data[1]]; |
||||
}, |
||||
$tpl |
||||
); |
||||
} |
||||
$res=$field_value; |
||||
break; |
||||
|
||||
case 'req': |
||||
$res=get_field_default($field_value,$action,$field_id,$tpl,$tpl_empty,$maxlength,$document_fields,$rubric_id); |
||||
break; |
||||
|
||||
case 'name' : |
||||
return $AVE_Template->get_config_vars('name'); |
||||
break; |
||||
|
||||
} |
||||
return ($res ? $res : $field_value); |
||||
} |
||||
?> |
@ -1,2 +0,0 @@
|
||||
[admin] |
||||
name = "Wideo w formacie Flash" |
@ -1,6 +0,0 @@
|
||||
<a name="{$field_id}"></a> |
||||
<div style="display:none" id="feld_{$field_id}"><img style="display:none" id="_img_feld__{$field_id}" src="{$field_value|escape}" alt="" border="0" /></div> |
||||
<div style="display:none" id="span_feld__{$field_id}"></div> |
||||
<input type="text" style="width: 400px;" name="feld[{$field_id}]" value="{$field_value|escape}" id="img_feld__{$field_id}" /> |
||||
<input value="{#MAIN_OPEN_MEDIAPATH#}" class="basicBtn" type="button" onclick="browse_uploads('img_feld__{$field_id}', '', '', '0');" /> |
||||
<a class="button blackBtn topDir" title="{#DOC_FLASH_TYPE_HELP#}" href="#"> ? </a> |
@ -1,231 +0,0 @@
|
||||
var Cascad = { |
||||
|
||||
init: false, |
||||
|
||||
init: function() { |
||||
if (this.initialized) return; |
||||
this.initialized = true; |
||||
|
||||
this.cascad(); |
||||
}, |
||||
|
||||
cascad: function() { |
||||
this.cascad_sortable(); |
||||
this.cascad_del_item(); |
||||
this.cascad_del_all_item(); |
||||
this.cascad_add_single(); |
||||
this.cascad_add_folder(); |
||||
this.cascade_upload_files(); |
||||
this.cascad_click_upload(); |
||||
}, |
||||
|
||||
cascad_update: function() { |
||||
this.cascad_maxid(); |
||||
this.cascad_del_item(); |
||||
AveAdmin.fancy_box(); |
||||
AveAdmin.tooltip(); |
||||
}, |
||||
|
||||
cascad_maxid: function(id, doc) { |
||||
var maxid = 1; |
||||
$('#cascad_' + doc + '_' + id).children('.cascad_sortable').children('.cascad_item').each(function() { |
||||
maxid = Math.max(maxid, parseInt($(this).attr("data-id")) + 1); |
||||
}); |
||||
return maxid; |
||||
}, |
||||
|
||||
cascad_del_item: function() { |
||||
$('.cascad_item .delete').on('click', function(event) { |
||||
event.preventDefault(); |
||||
var id = $(this).attr('data-id'); |
||||
jConfirm( |
||||
del_conf, |
||||
del_head, |
||||
function(b) { |
||||
if (b) { |
||||
$('#cascad_image_' + id).remove(); |
||||
} |
||||
} |
||||
); |
||||
}); |
||||
}, |
||||
|
||||
cascad_del_all_item: function() { |
||||
$('.del_all').on('click', function(event) { |
||||
event.preventDefault(); |
||||
var c_id = $(this).parent().parent().parent('.cascad').attr("data-id"); |
||||
var d_id = $(this).parent().parent().parent('.cascad').attr("data-doc"); |
||||
jConfirm( |
||||
del_all_c, |
||||
del_all_h, |
||||
function(b) { |
||||
if (b) { |
||||
$('#cascad_' + d_id + '_' + c_id).children('.cascad_sortable').children('.cascad_item').each(function() { |
||||
$(this).remove(); |
||||
}); |
||||
} |
||||
} |
||||
); |
||||
}); |
||||
}, |
||||
|
||||
cascade_upload_files: function() { |
||||
$('.cascade_upload').on('change', function(event) { |
||||
|
||||
event.preventDefault(); |
||||
|
||||
var cascade_input = $(this); |
||||
|
||||
event.preventDefault(); |
||||
|
||||
if (cascade_input.val() == '') { |
||||
return false; |
||||
} |
||||
|
||||
var files_input = this.files.length; |
||||
var max_files = cascade_input.attr("data-max-files"); |
||||
|
||||
if (files_input > max_files) { |
||||
$.jGrowl(max_f_t, { |
||||
header: max_f_h, |
||||
theme: 'error' |
||||
}); |
||||
|
||||
cascade_input.replaceWith(cascade_input.val('').clone(true)); |
||||
|
||||
return false; |
||||
} |
||||
|
||||
var cid = $(this).parent('.cascad').attr("data-id"); |
||||
var did = $(this).parent('.cascad').attr("data-doc"); |
||||
var rid = $(this).parent('.cascad').attr("data-rubric"); |
||||
|
||||
$('#docmanager_edit').ajaxSubmit({ |
||||
url: 'index.php?do=fields', |
||||
data: { |
||||
"field_id": cid, |
||||
"rubric_id": rid, |
||||
"doc_id": did, |
||||
"field": 'image_multi', |
||||
"type": 'upload' |
||||
}, |
||||
beforeSend: function() { |
||||
$.alerts._overlay('show'); |
||||
}, |
||||
dataType: "json", |
||||
success: function(data) { |
||||
if (data['respons'] == 'succes') { |
||||
for (var p = 0, max = data.files.length; p < max; p++) { |
||||
iid = Cascad.cascad_maxid(cid, did); |
||||
var field_value = data['dir'] + data.files[p]; |
||||
var img_path = '../index.php?thumb=' + field_value + '&mode=f&width=128&height=128'; |
||||
$('#cascad_' + did + '_' + cid + ' > .cascad_sortable:last').prepend( |
||||
'<div class="cascad_item ui-state-default" id="cascad_image_' + cid + '_' + did + '_' + iid + '" data-id="' + iid + '" doc=id="' + did + '">' + |
||||
'<div class="header grey_bg"></div>' + |
||||
'<a class="topDir icon_sprite ico_photo view fancy preview__' + cid + '_' + did + '_' + iid + '" href="' + field_value + '" title="' + look + '"></a>' + |
||||
'<a class="topDir icon_sprite ico_delete delete" href="javascript:void(0);" title="' + del + '" data-id="' + cid + '_' + did + '_' + iid + '"></a>' + |
||||
'<span class="topDir icon_sprite ico_info info" title="' + field_value + '"></span>' + |
||||
'<input type="hidden" value="' + field_value + '" name="data[' + did + '][feld][' + cid + '][' + iid + '][url]" id="image__' + cid + '_' + did + '_' + iid + '">' + |
||||
'<img id="preview__' + cid + '_' + did + '_' + iid + '" src="' + img_path + '" onclick="browse_uploads(\'image__' + cid + '_' + did + '_' + iid + '\');" class="image" alt="" width="100" height="100" />' + |
||||
'<textarea class="mousetrap" name="data[' + did + '][feld][' + cid + '][' + iid + '][descr]" placeholder="' + place + '"></textarea>' + |
||||
'</div>' |
||||
); |
||||
$.alerts._overlay('hide'); |
||||
Cascad.cascad_update(); |
||||
} |
||||
} |
||||
$.jGrowl(data['message'], { |
||||
header: data['header'], |
||||
theme: data['theme'] |
||||
}); |
||||
cascade_input.replaceWith(cascade_input = cascade_input.clone(true)); |
||||
cascade_input.val(); |
||||
} |
||||
}); |
||||
return false; |
||||
}); |
||||
}, |
||||
|
||||
cascad_click_upload: function() { |
||||
$('.upload_local').on('click', function(event) { |
||||
event.preventDefault(); |
||||
var c_id = $(this).parent().parent().parent('.cascad').attr("data-id"); |
||||
var d_id = $(this).parent().parent().parent('.cascad').attr("data-doc"); |
||||
$('.cascade_upload_field_' + c_id + '_' + d_id).trigger('click'); |
||||
}); |
||||
}, |
||||
|
||||
cascad_add_single: function() { |
||||
$('.add_single').on('click', function(event) { |
||||
event.preventDefault(); |
||||
var c_id = $(this).parent().parent().parent('.cascad').attr("data-id"); |
||||
var d_id = $(this).parent().parent().parent('.cascad').attr("data-doc"); |
||||
var iid = Cascad.cascad_maxid(c_id, d_id); |
||||
$('#cascad_' + d_id + '_' + c_id + ' > .cascad_sortable:last').prepend( |
||||
'<div class="cascad_item ui-state-default" id="cascad_image_' + c_id + '_' + d_id + '_' + iid + '" data-id="' + iid + '" data-doc="' + d_id + '">' + |
||||
'<div class="header grey_bg"></div>' + |
||||
'<a class="topDir icon_sprite ico_photo view fancy preview__' + c_id + '_' + d_id + '_' + iid + '" href="" title="' + look + '"></a>' + |
||||
'<a class="topDir icon_sprite ico_delete delete" href="javascript:void(0);" title="' + del + '" data-id="' + c_id + '_' + d_id + '_' + iid + '"></a>' + |
||||
'<input type="hidden" value="" name="data[' + d_id + '][feld][' + c_id + '][' + iid + '][url]" id="image__' + c_id + '_' + d_id + '_' + iid + '">' + |
||||
'<img id="preview__' + c_id + '_' + d_id + '_' + iid + '" src="' + blank + '" onclick="browse_uploads(\'image__' + c_id + '_' + d_id + '_' + iid + '\');" class="image" alt="" width="100" height="100" />' + |
||||
'<textarea class="mousetrap" name="data[' + d_id + '][feld][' + c_id + '][' + iid + '][descr]" placeholder="' + place + '"></textarea>' + |
||||
'</div>' |
||||
); |
||||
browse_uploads('image__' + c_id + '_' + d_id + '_' + iid + ''); |
||||
Cascad.cascad_update(); |
||||
}); |
||||
}, |
||||
|
||||
cascad_sortable: function() { |
||||
$('.cascad_sortable').sortable({ |
||||
handle: ".header", |
||||
placeholder: "ui-state-highlight grey_bg" |
||||
}); |
||||
//$(".cascad").disableSelection();
|
||||
}, |
||||
|
||||
cascad_add_folder: function() { |
||||
$('.add_folder').on('click', function(event) { |
||||
event.preventDefault(); |
||||
var c_id = $(this).parent().parent().parent('.cascad').attr("data-id"); |
||||
var d_id = $(this).parent().parent().parent('.cascad').attr("data-doc"); |
||||
browse_dirs("cascad__" + c_id + '_' + d_id); |
||||
}); |
||||
} |
||||
} |
||||
|
||||
$(document).ready(function() { |
||||
Cascad.init(); |
||||
|
||||
$.fn.myPlugin = function cascad_add_items(dir, cid, did) { |
||||
|
||||
$.ajax({ |
||||
url: ave_path + 'admin/index.php?do=docs&action=image_import&ajax=run', |
||||
data: { |
||||
"path": dir |
||||
}, |
||||
dataType: "json", |
||||
success: function(data) { |
||||
$.alerts._overlay('hide'); |
||||
for (var p = 0, max = data.respons.length; p < max; p++) { |
||||
var iid = Cascad.cascad_maxid(cid, did); |
||||
var field_value = dir + data.respons[p]; |
||||
var img_path = '../index.php?thumb=' + field_value + '&mode=f&width=128&height=128'; |
||||
$('#cascad_' + did + '_' + cid + ' > .cascad_sortable:last').prepend( |
||||
'<div class="cascad_item ui-state-default" id="cascad_image_' + cid + '_' + did + '_' + iid + '" data-id="' + iid + '" doc=id="' + did + '">' + |
||||
'<div class="header grey_bg"></div>' + |
||||
'<a class="topDir icon_sprite ico_photo view fancy preview__' + cid + '_' + did + '_' + iid + '" href="' + field_value + '" title="' + look + '"></a>' + |
||||
'<a class="topDir icon_sprite ico_delete delete" href="javascript:void(0);" title="' + del + '" data-id="' + cid + '_' + did + '_' + iid + '"></a>' + |
||||
'<span class="topDir icon_sprite ico_info info" title="' + field_value + '"></span>' + |
||||
'<input type="hidden" value="' + field_value + '" name="data[' + did + '][feld][' + cid + '][' + iid + '][url]" id="image__' + cid + '_' + did + '_' + iid + '">' + |
||||
'<img id="preview__' + cid + '_' + did + '_' + iid + '" src="' + img_path + '" onclick="browse_uploads(\'image__' + cid + '_' + did + '_' + iid + '\');" class="image" alt="" width="100" height="100" />' + |
||||
'<textarea class="mousetrap" name="data[' + did + '][feld][' + cid + '][' + iid + '][descr]" placeholder="' + place + '"></textarea>' + |
||||
'</div>' |
||||
); |
||||
Cascad.cascad_update(); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
}); |
@ -0,0 +1,18 @@
|
||||
.multi_lists { |
||||
position: relative; |
||||
} |
||||
|
||||
.multi_lists > .ui-state-highlight { |
||||
display: inline-block; |
||||
margin: 3px; |
||||
width: 450px; |
||||
height: 26px; |
||||
background-color: rgba(255,255,255,0.5); !important; |
||||
border: solid 1px #eaeaea; |
||||
border-radius: 5px; |
||||
-moz-border-radius: 5px; |
||||
-webkit-border-radius: 5px; |
||||
position: relative; |
||||
text-align: center; |
||||
padding: 0 !important; |
||||
} |
@ -0,0 +1,194 @@
|
||||
<?php |
||||
|
||||
/** |
||||
* AVE.cms |
||||
* |
||||
* @package AVE.cms |
||||
* @version 3.x |
||||
* @filesource |
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru |
||||
* |
||||
* @license GPL v.2 |
||||
*/ |
||||
|
||||
// Мульти лист |
||||
function get_field_link_multi($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null) |
||||
{ |
||||
global $AVE_Template; |
||||
|
||||
$fld_dir = dirname(__FILE__) . '/'; |
||||
$tpl_dir = $fld_dir . 'tpl/'; |
||||
$fld_name = basename($fld_dir); |
||||
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt'; |
||||
|
||||
$AVE_Template->config_load($lang_file, 'lang'); |
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars()); |
||||
$AVE_Template->config_load($lang_file, 'admin'); |
||||
|
||||
$res = array(); |
||||
|
||||
switch ($action) |
||||
{ |
||||
case 'edit': |
||||
|
||||
$items = array(); |
||||
|
||||
$items = unserialize($field_value); |
||||
|
||||
if ($items != false) |
||||
{ |
||||
|
||||
foreach($items as $k => $v){ |
||||
$list_item = explode('|', $v); |
||||
|
||||
$list[$k]['param'] = (isset($list_item[0])) ? htmlspecialchars($list_item[0], ENT_QUOTES) : ''; |
||||
$list[$k]['value'] = (isset($list_item[1])) ? htmlspecialchars($list_item[1], ENT_QUOTES) : ''; |
||||
} |
||||
|
||||
$items = $list; |
||||
} |
||||
else |
||||
{ |
||||
$items = explode(',', $default); |
||||
|
||||
foreach($items as $k => $v){ |
||||
$list_item = explode('|', $v); |
||||
|
||||
$list[$k]['param'] = (isset($list_item[0])) ? htmlspecialchars($list_item[0], ENT_QUOTES) : ''; |
||||
$list[$k]['value'] = (isset($list_item[1])) ? htmlspecialchars($list_item[1], ENT_QUOTES) : ''; |
||||
} |
||||
$items = $list; |
||||
} |
||||
|
||||
$AVE_Template->assign('doc_id', $_REQUEST['Id']); |
||||
$AVE_Template->assign('field_dir', $fld_name); |
||||
$AVE_Template->assign('items', $items); |
||||
$AVE_Template->assign('field_id', $field_id); |
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl); |
||||
|
||||
return $AVE_Template->fetch($tpl_file); |
||||
break; |
||||
|
||||
case 'doc': |
||||
$items = unserialize($field_value); |
||||
|
||||
if ($items != false) |
||||
{ |
||||
foreach($items as $list_item) |
||||
{ |
||||
$list_item = clean_php($list_item); |
||||
$field_param = explode('|', $list_item); |
||||
|
||||
if ($list_item) |
||||
{ |
||||
if ($tpl_empty) |
||||
{ |
||||
$list_item = $field_param; |
||||
} |
||||
else |
||||
{ |
||||
$list_item = preg_replace_callback( |
||||
'/\[tag:parametr:(\d+)\]/i', |
||||
function($data) use($field_param) |
||||
{ |
||||
return $field_param[(int)$data[1]]; |
||||
}, |
||||
$tpl |
||||
); |
||||
} |
||||
} |
||||
$res[] = $list_item; |
||||
} |
||||
} |
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl); |
||||
|
||||
if ($tpl_empty && $tpl_file) |
||||
{ |
||||
$AVE_Template->assign('field_id', $field_id); |
||||
$AVE_Template->assign('field_value', $res); |
||||
$AVE_Template->assign('field_count', count($res)); |
||||
$AVE_Template->assign('default', $default); |
||||
|
||||
return $AVE_Template->fetch($tpl_file); |
||||
} |
||||
|
||||
return (! empty($res)) ? implode(PHP_EOL, $res) : $tpl; |
||||
break; |
||||
|
||||
case 'req': |
||||
$items = unserialize($field_value); |
||||
|
||||
if ($items != false) |
||||
{ |
||||
foreach($items as $list_item) |
||||
{ |
||||
$list_item = clean_php($list_item); |
||||
$field_param = explode('|', $list_item); |
||||
|
||||
if ($list_item) |
||||
{ |
||||
if ($tpl_empty) |
||||
{ |
||||
$list_item = $field_param; |
||||
} |
||||
else |
||||
{ |
||||
$list_item = preg_replace_callback( |
||||
'/\[tag:parametr:(\d+)\]/i', |
||||
function($data) use($field_param) |
||||
{ |
||||
return $field_param[(int)$data[1]]; |
||||
}, |
||||
$tpl |
||||
); |
||||
} |
||||
} |
||||
$res[] = $list_item; |
||||
} |
||||
} |
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl); |
||||
|
||||
if ($tpl_empty && $tpl_file) |
||||
{ |
||||
$AVE_Template->assign('field_id', $field_id); |
||||
$AVE_Template->assign('field_value', $res); |
||||
$AVE_Template->assign('field_count', count($res)); |
||||
$AVE_Template->assign('default', $default); |
||||
|
||||
return $AVE_Template->fetch($tpl_file); |
||||
} |
||||
|
||||
return (!empty($res)) ? implode(PHP_EOL, $res) : $tpl; |
||||
break; |
||||
|
||||
case 'save': |
||||
foreach ($field_value as $v) |
||||
{ |
||||
if (! empty($v['param'])) |
||||
{ |
||||
$field_value_new[] = $v['param'] . ($v['value'] ? '|' . $v['value'] : ''); |
||||
} |
||||
} |
||||
|
||||
if (isset($field_value_new)) |
||||
{ |
||||
return @serialize($field_value_new); |
||||
} |
||||
else |
||||
{ |
||||
return $field_value_new = ''; |
||||
} |
||||
break; |
||||
|
||||
case 'name': |
||||
return $AVE_Template->get_config_vars('name'); |
||||
break; |
||||
|
||||
} |
||||
return ($res ? $res : $field_value); |
||||
} |
||||
?> |
@ -0,0 +1,8 @@
|
||||
[admin] |
||||
name = "Мульти ссылки" |
||||
delete = "Удалить элемент" |
||||
param = "Наименование" |
||||
value = "Ссылка" |
||||
del_conf = "Вы уверены, что хотите удалить данный элемент?" |
||||
del_head = "Удаление элемента..." |
||||
add = "Добавить" |
@ -0,0 +1,33 @@
|
||||
{if ! empty($field_value)} |
||||
<table class="table table-params table-no-border"> |
||||
<tr> |
||||
<td class="table-header"> |
||||
Документация |
||||
</td> |
||||
</tr> |
||||
|
||||
{foreach from=$field_value item=list} |
||||
<tr> |
||||
<td> |
||||
<a href="{$list[1]}" target="_blank"><i class="fa fa-file-pdf-o"></i> {$list[0]}</a> |
||||
</td> |
||||
</tr> |
||||
{/foreach} |
||||
|
||||
</table> |
||||
{else} |
||||
<table class="table table-params table-no-border"> |
||||
<tr> |
||||
<td class="table-header"> |
||||
Документация |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<div class="alert alert-warning"> |
||||
Нет файлов для скачивания |
||||
</div> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
{/if} |
@ -0,0 +1,5 @@
|
||||
<ul> |
||||
{foreach from=$field_value item=list} |
||||
<li>{$list[0]}: {$list[1]}</li> |
||||
{/foreach} |
||||
</ul> |
@ -0,0 +1,5 @@
|
||||
<ul> |
||||
{foreach from=$field_value item=list} |
||||
<li>{$list[0]}: {$list[1]}</li> |
||||
{/foreach} |
||||
</ul> |
@ -0,0 +1,29 @@
|
||||
{if $multi_list != load} |
||||
{assign var=multi_list value='' scope="global"} |
||||
{if $smarty.request.outside} |
||||
<script src="{$ABS_PATH}fields/{$field_dir}/js/outside.js" type="text/javascript"></script> |
||||
{else} |
||||
<script src="{$ABS_PATH}fields/{$field_dir}/js/field.js" type="text/javascript"></script> |
||||
{/if} |
||||
<link href="{$ABS_PATH}fields/{$field_dir}/css/field.css" rel="stylesheet" type="text/css" media="screen" /> |
||||
<script type="text/javascript"> |
||||
var links_name = '{#param#}'; |
||||
var links_url = '{#value#}'; |
||||
var links_add = '{#add#}'; |
||||
var links_del = '{#delete#}'; |
||||
var links_del_conf = '{#del_conf#}'; |
||||
var links_del_head = '{#del_head#}'; |
||||
</script> |
||||
{assign var=multi_list value="load" scope="global"} |
||||
{/if} |
||||
|
||||
<div class="multi_links mt10" id="multi_links_{$field_id}" data-id="{$field_id}"> |
||||
{foreach from=$items key=key item=item} |
||||
|
||||
<div class="multi_link fix mb10" id="link_{$field_id}_{$key}" data-id="{$key}"> |
||||
<input type="text" class="mousetrap" value="{$item.param|escape}" name="feld[{$field_id}][{$key}][param]" placeholder="{#param#}" style="width: 200px;"/> <input type="text" class="mousetrap" value="{$item.value|escape}" name="feld[{$field_id}][{$key}][value]" id="links_{$field_id}_{$key}" placeholder="{#value#}" style="width: 300px;" /> <a class="btn greyishBtn" onclick="openFileWindow('links_{$field_id}_{$key}','links_{$field_id}_{$key}','links_{$field_id}_{$key}');">PDF</a> {if $key == 0}<a href="javascript:void(0);" class="button basicBtn topDir AddButton" title="{#add#}">+</a>{else}<a href="javascript:void(0);" data-id="{$field_id}_{$key}" class="button redBtn topDir DelButton" title="{#delete#}">×</a>{/if} |
||||
<div class="handle" style="float: left; display: inline-block; margin: 4px 7px; cursor: move;"><span class="icon_sprite ico_move"></span></div> |
||||
</div> |
||||
|
||||
{/foreach} |
||||
</div> |
@ -1,163 +0,0 @@
|
||||
<? |
||||
|
||||
/** |
||||
* AVE.cms |
||||
* |
||||
* @package AVE.cms |
||||
* @version 3.x |
||||
* @filesource |
||||
* @copyright © 2007-2015 AVE.cms, http://www.ave-cms.ru |
||||
* |
||||
* @license GPL v.2 |
||||
*/ |
||||
|
||||
// Мульти чекбокс |
||||
function get_field_multi_checkbox($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null) |
||||
{ |
||||
global $AVE_Template; |
||||
|
||||
$fld_dir = dirname(__FILE__) . '/'; |
||||
$tpl_dir = $fld_dir . 'tpl/'; |
||||
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt'; |
||||
|
||||
$AVE_Template->config_load($lang_file, 'lang'); |
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars()); |
||||
$AVE_Template->config_load($lang_file, 'admin'); |
||||
|
||||
$res = array(); |
||||
|
||||
switch ($action) |
||||
{ |
||||
case 'edit': |
||||
$default_items = explode(',', $default); |
||||
$default_items = array_diff($default_items, array('')); |
||||
|
||||
$field_value_array = explode('|', $field_value); |
||||
$field_value_array = array_values(array_diff($field_value_array, array(''))); |
||||
|
||||
$AVE_Template->assign('items', $default_items); |
||||
$AVE_Template->assign('used', $field_value_array); |
||||
$AVE_Template->assign('doc_id', (isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : 0)); |
||||
$AVE_Template->assign('field_id', $field_id); |
||||
$AVE_Template->assign('field_value', $field_value); |
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin'); |
||||
|
||||
return $AVE_Template->fetch($tpl_file); |
||||
break; |
||||
|
||||
case 'doc': |
||||
$default_items = explode(',', $default); |
||||
|
||||
$items = explode('|', $field_value); |
||||
$items = array_diff($items, array('')); |
||||
|
||||
if (! empty($items)) |
||||
{ |
||||
foreach($items as $item) |
||||
{ |
||||
if ($item) |
||||
{ |
||||
if ($tpl_empty) |
||||
{ |
||||
$item = $default_items[(int)$item-1]; |
||||
} |
||||
else |
||||
{ |
||||
$field_param = explode('|', $item); |
||||
|
||||
$item = preg_replace_callback( |
||||
'/\[tag:parametr:(\d+)\]/i', |
||||
function($data) use($field_param, $default_items) |
||||
{ |
||||
return $default_items[$field_param[(int)$data[1]]-1]; |
||||
}, |
||||
$tpl |
||||
); |
||||
} |
||||
} |
||||
|
||||
$res[] = $item; |
||||
} |
||||
} |
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc'); |
||||
|
||||
if ($tpl_empty && $tpl_file) |
||||
{ |
||||
$AVE_Template->assign('field_id', $field_id); |
||||
$AVE_Template->assign('field_value', $res); |
||||
$AVE_Template->assign('rubric_id', $rubric_id); |
||||
$AVE_Template->assign('default', $default_items); |
||||
|
||||
return $AVE_Template->fetch($tpl_file); |
||||
} |
||||
|
||||
return (! empty($res)) |
||||
? implode(PHP_EOL, $res) |
||||
: $tpl; |
||||
|
||||
break; |
||||
|
||||
case 'req': |
||||
$default_items = explode(',', $default); |
||||
|
||||
$items = explode('|', $field_value); |
||||
$items = array_diff($items, array('')); |
||||
|
||||
if (! empty($items)) |
||||
{ |
||||
foreach($items as $item) |
||||
{ |
||||
if ($item) |
||||
{ |
||||
if ($tpl_empty) |
||||
{ |
||||
$item = $default_items[(int)$item-1]; |
||||
} |
||||
else |
||||
{ |
||||
$field_param = explode('|', $item); |
||||
|
||||
$item = preg_replace_callback( |
||||
'/\[tag:parametr:(\d+)\]/i', |
||||
function($data) use($field_param, $default_items) |
||||
{ |
||||
return $default_items[$field_param[(int)$data[1]]-1]; |
||||
}, |
||||
$tpl |
||||
); |
||||
} |
||||
} |
||||
|
||||
$res[] = $item; |
||||
} |
||||
} |
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req'); |
||||
|
||||
if ($tpl_empty && $tpl_file) |
||||
{ |
||||
$AVE_Template->assign('field_id', $field_id); |
||||
$AVE_Template->assign('field_value', $res); |
||||
$AVE_Template->assign('rubric_id', $rubric_id); |
||||
$AVE_Template->assign('default', $default_items); |
||||
|
||||
return $AVE_Template->fetch($tpl_file); |
||||
} |
||||
|
||||
return (! empty($res)) |
||||
? implode(PHP_EOL, $res) |
||||
: $tpl; |
||||
|
||||
break; |
||||
|
||||
case 'name': |
||||
return $AVE_Template->get_config_vars('name'); |
||||
break; |
||||
|
||||
} |
||||
return ($res ? $res : $field_value); |
||||
} |
||||
?> |
@ -1,75 +0,0 @@
|
||||
var MultiListSingle = { |
||||
|
||||
init: false, |
||||
|
||||
init: function() { |
||||
if (this.initialized) return; |
||||
this.initialized = true; |
||||
|
||||
this.s_lists(); |
||||
}, |
||||
|
||||
s_lists: function() { |
||||
this.s_lists_sortable(); |
||||
this.s_lists_del_item(); |
||||
this.s_lists_add(); |
||||
}, |
||||
|
||||
s_lists_update: function() { |
||||
this.s_lists_maxid(); |
||||
this.s_lists_del_item(); |
||||
AveAdmin.tooltip(); |
||||
}, |
||||
|
||||
s_lists_maxid: function(id) { |
||||
var maxid = 1; |
||||
$('#multi_lists_single_' + id).children('.multi_list_single').each(function() { |
||||
maxid = Math.max(maxid, parseInt($(this).attr("data-id")) + 1); |
||||
}); |
||||
return maxid; |
||||
}, |
||||
|
||||
s_lists_del_item: function() { |
||||
$('.multi_list_single .DelSingleButton').on('click', function(event) { |
||||
event.preventDefault(); |
||||
var id = $(this).attr('data-id'); |
||||
jConfirm( |
||||
s_list_del_conf, |
||||
s_list_del_head, |
||||
function(b) { |
||||
if (b) { |
||||
$('#list_' + id).remove(); |
||||
} |
||||
} |
||||
); |
||||
}); |
||||
}, |
||||
|
||||
s_lists_add: function() { |
||||
$('.AddSingleButton').on('click', function(event) { |
||||
event.preventDefault(); |
||||
c_id = $(this).parent().parent('.multi_lists_single').attr("data-id"); |
||||
iid = MultiListSingle.s_lists_maxid(c_id); |
||||
$('#multi_lists_single_' + c_id + ':last').append( |
||||
'<div class="multi_list_single fix mb10" id="list_' + c_id + '_' + iid + '" data-id="' + iid + '">' + |
||||
'<input type="text" class="mousetrap" value="" name="feld[' + c_id + '][' + iid + ']" placeholder="' + s_list_value + '" style="width: 400px;"/> <a href="javascript:void(0);" data-id="' + c_id + '_' + iid + '" class="button redBtn topDir DelSingleButton" title="' + s_list_del + '">×</a>' + |
||||
'<div class="handle" style="float: left; display: inline-block; margin: 4px 7px; cursor: move;"><span class="icon_sprite ico_move"></span></div>' + |
||||
'</div>' |
||||
); |
||||
|
||||
MultiListSingle.s_lists_update(); |
||||
}); |
||||
}, |
||||
|
||||
s_lists_sortable: function() { |
||||
$('.multi_lists_single').sortable({ |
||||
handle: ".handle", |
||||
placeholder: "ui-state-highlight grey_bg" |
||||
}); |
||||
//$(".multi_lists_single").disableSelection();
|
||||
} |
||||
} |
||||
|
||||
$(document).ready(function() { |
||||
MultiListSingle.init(); |
||||
}); |
@ -1,75 +0,0 @@
|
||||
var MultiListTriple = { |
||||
|
||||
init: false, |
||||
|
||||
init: function() { |
||||
if (this.initialized) return; |
||||
this.initialized = true; |
||||
|
||||
this.lists(); |
||||
}, |
||||
|
||||
lists: function() { |
||||
this.lists_sortable(); |
||||
this.lists_del_item(); |
||||
this.lists_add(); |
||||
}, |
||||
|
||||
lists_update: function() { |
||||
this.lists_maxid(); |
||||
this.lists_del_item(); |
||||
AveAdmin.tooltip(); |
||||
}, |
||||
|
||||
lists_maxid: function(id) { |
||||
var maxid = 1; |
||||
$('#multi_lists_triple_' + id).children('.multi_list_triple').each(function() { |
||||
maxid = Math.max(maxid, parseInt($(this).attr("data-id")) + 1); |
||||
}); |
||||
return maxid; |
||||
}, |
||||
|
||||
lists_del_item: function() { |
||||
$('.multi_list_triple .DelButton').on('click', function(event) { |
||||
event.preventDefault(); |
||||
var id = $(this).attr('data-id'); |
||||
jConfirm( |
||||
list_del_conf, |
||||
list_del_head, |
||||
function(b) { |
||||
if (b) { |
||||
$('#list_' + id).remove(); |
||||
} |
||||
} |
||||
); |
||||
}); |
||||
}, |
||||
|
||||
lists_add: function() { |
||||
$('.AddButton').on('click', function(event) { |
||||
event.preventDefault(); |
||||
c_id = $(this).parent().parent('.multi_lists_triple').attr("data-id"); |
||||
iid = MultiListTriple.lists_maxid(c_id); |
||||
$('#multi_lists_triple_' + c_id + ':last').append( |
||||
'<div class="multi_list_triple fix mb10" id="list_' + c_id + '_' + iid + '" data-id="' + iid + '">' + |
||||
'<input class="mousetrap" type="text" value="" name="feld[' + c_id + '][' + iid + '][param]" placeholder="' + list_param + '" style="width: 200px;"/> <input type="text" class="mousetrap" value="" name="feld[' + c_id + '][' + iid + '][value]" placeholder="' + list_value + '" style="width: 200px;" /> <input type="text" class="mousetrap" value="" name="feld[' + c_id + '][' + iid + '][value2]" placeholder="' + list_value2 + '" style="width: 200px;" /> <a href="javascript:void(0);" data-id="' + c_id + '_' + iid + '" class="button redBtn topDir DelButton" title="' + list_del + '">×</a>' + |
||||
'<div class="handle" style="float: left; display: inline-block; margin: 4px 7px; cursor: move;"><span class="icon_sprite ico_move"></span></div>' + |
||||
'</div>' |
||||
); |
||||
|
||||
MultiListTriple.lists_update(); |
||||
}); |
||||
}, |
||||
|
||||
lists_sortable: function() { |
||||
$('.multi_lists_triple').sortable({ |
||||
handle: ".handle", |
||||
placeholder: "ui-state-highlight grey_bg" |
||||
}); |
||||
//$(".multi_lists_triple").disableSelection();
|
||||
} |
||||
} |
||||
|
||||
$(document).ready(function() { |
||||
MultiListTriple.init(); |
||||
}); |
@ -1 +1,5 @@
|
||||
{* |
||||
$field_id |
||||
$field_value |
||||
*} |
||||
{$field_value} |
@ -1 +1,5 @@
|
||||
{* |
||||
$field_id |
||||
$field_value |
||||
*} |
||||
{$field_value} |
@ -0,0 +1,134 @@
|
||||
<?php |
||||
|
||||
/** |
||||
* AVE.cms |
||||
* |
||||
* @package AVE.cms |
||||
* @version 3.x |
||||
* @filesource |
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru |
||||
* |
||||
* @license GPL v.2 |
||||
*/ |
||||
|
||||
// Однострочное числовое |
||||
function get_field_single_line_numeric_three ($field_value, $action, $field_id = 0, $tpl = '', $tpl_empty = 0, &$maxlength = null, $document_fields = array(), $rubric_id = 0, $default = null, $_tpl=null) |
||||
{ |
||||
global $AVE_Template; |
||||
|
||||
$fld_dir = dirname(__FILE__) . '/'; |
||||
$tpl_dir = $fld_dir . 'tpl/'; |
||||
$fld_name = basename($fld_dir); |
||||
|
||||
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt'; |
||||
|
||||
$AVE_Template->config_load($lang_file, 'lang'); |
||||
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars()); |
||||
$AVE_Template->config_load($lang_file, 'admin'); |
||||
|
||||
switch ($action) |
||||
{ |
||||
case 'edit': |
||||
if (! empty($field_value)) |
||||
$field_value = explode('|', $field_value); |
||||
|
||||
$AVE_Template->assign('field_dir', $fld_name); |
||||
$AVE_Template->assign('field_id', $field_id); |
||||
$AVE_Template->assign('field_value', $field_value); |
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl); |
||||
|
||||
return $AVE_Template->fetch($tpl_file); |
||||
break; |
||||
|
||||
case 'doc': |
||||
|
||||
if ($tpl_empty) |
||||
{ |
||||
$value = array(); |
||||
|
||||
if (! empty($field_value)) |
||||
{ |
||||
$value = array_diff(explode('|', $field_value), array('')); |
||||
$value = array_map('clean_php', $value); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
$field_param = explode('|', $field_value); |
||||
$field_value = preg_replace_callback( |
||||
'/\[tag:parametr:(\d+)\]/i', |
||||
function($data) use($field_param) |
||||
{ |
||||
return $field_param[(int)$data[1]]; |
||||
}, |
||||
$tpl |
||||
); |
||||
} |
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'doc', $_tpl); |
||||
|
||||
if ($tpl_empty && $tpl_file) |
||||
{ |
||||
$AVE_Template->assign('field_value', $value); |
||||
return $AVE_Template->fetch($tpl_file); |
||||
} |
||||
|
||||
return $field_value; |
||||
break; |
||||
|
||||
case 'req': |
||||
if ($tpl_empty) |
||||
{ |
||||
$value = array(); |
||||
|
||||
if (! empty($field_value)) |
||||
{ |
||||
$value = explode('|', $field_value); |
||||
$value = array_map('clean_php', $value); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
$field_param = explode('|', $field_value); |
||||
$field_value = preg_replace_callback( |
||||
'/\[tag:parametr:(\d+)\]/i', |
||||
function($data) use($field_param) |
||||
{ |
||||
return $field_param[(int)$data[1]]; |
||||
}, |
||||
$tpl |
||||
); |
||||
} |
||||
|
||||
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'req', $_tpl); |
||||
|
||||
if ($tpl_empty && $tpl_file) |
||||
{ |
||||
$AVE_Template->assign('field_value', $value); |
||||
return $AVE_Template->fetch($tpl_file); |
||||
} |
||||
|
||||
return $field_value; |
||||
break; |
||||
|
||||
case 'save': |
||||
$save = array(); |
||||
|
||||
if (is_array($field_value)) |
||||
{ |
||||
foreach ($field_value AS $k => $v) |
||||
{ |
||||
$save[] = preg_replace('/[^\d.]/', '', $v); |
||||
} |
||||
} |
||||
|
||||
return empty($save) ? '' : implode('|', $save); |
||||
|
||||
case 'name': |
||||
return $AVE_Template->get_config_vars('name'); |
||||
|
||||
default: return $field_value; |
||||
} |
||||
} |
||||
?> |
@ -0,0 +1,26 @@
|
||||
$(document).ready(function() { |
||||
$(".field_numeric").on('keydown', function(event) { |
||||
var num_dot = $(this).attr('data-num-dot'); |
||||
var keyCode = window.event ? event.keyCode : event.which; |
||||
var foo = 0; |
||||
// prevent if already dot
|
||||
if (keyCode != 8 && keyCode != 46) { |
||||
if ((foo == 0) && (keyCode != 190) && (keyCode < 96 || keyCode > 105) && (keyCode < 46 || keyCode > 59)) { |
||||
event.preventDefault(); |
||||
} // prevent if not number/dot
|
||||
} |
||||
if ($(this).val().indexOf('.') > -1) { |
||||
if (keyCode == 190) event.preventDefault(); |
||||
} |
||||
$(this).keyup(function() { |
||||
this.value = this.value.replace(/[^0-9.]/i, ""); |
||||
if($(this).val().indexOf('.')!=-1){ |
||||
if($(this).val().split(".")[1].length >= num_dot){ |
||||
if( isNaN( parseFloat( this.value ) ) ) return; |
||||
this.value = parseFloat(this.value).toFixed(num_dot); |
||||
} |
||||
} |
||||
return this; |
||||
}); |
||||
}); |
||||
}); |
@ -0,0 +1,3 @@
|
||||
[admin] |
||||
|
||||
name = "Едноредово (Числово)" |
@ -0,0 +1,2 @@
|
||||
[admin] |
||||
name = "Jednořádkový (Číselný)" |
@ -0,0 +1,2 @@
|
||||
[admin] |
||||
name = "Single line (Numbers)" |
@ -0,0 +1,2 @@
|
||||
[admin] |
||||
name = "Linia pojedyncza (Numeryczne)" |
@ -0,0 +1,2 @@
|
||||
[admin] |
||||
name = "Однострочное (Числовое тройное)" |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue