Файл: base-sys/admin/views/controllers/languages_mod.html
Строк: 521
<?php
{$menu}
<div class="peep_stdmargin">
</div>
{script}
{literal}
$(document).ready( function(){
$('#s1, #s2').sortable({
items: 'tr.draggable-lang-item',
helper: 'clone',
placeholder: 'lang_placeholder',
start: function(event, ui){
$(ui.placeholder).append('<td colspan="3"></td>');
},
stop: function(event, ui){
switch( this ){
case $('#s1')[0]:
if( $('tr.draggable-lang-item', this).length == 0 )
{
alert( '{/literal}{text key="admin+msg_one_active_constraint"}{literal}' );
$(this).sortable('cancel');
$('#s1 tr.empty').remove();
break;
}
$('tr.draggable-lang-item:odd', this).each(function(){
if( !$(this).hasClass('peep_even') ) $(this).addClass('peep_even');
});
$('tr.draggable-lang-item:even', this).each(function(){
if( $(this).hasClass('peep_even') ) $(this).removeClass('peep_even');
});
break;
}
},
receive: function(event, ui){
switch(this){
case $('#s1')[0] :
$('tr.draggable-lang-item', this).each( function(){
$('td:nth(2) div span a.deact', this).show(); $('td:nth(2) div span a.act', this).hide(); $('td:nth(2) div span a.del', this).hide();
if( $(this).hasClass('peep_high2') ){
$(this).removeClass('peep_high2');
}
} );
$( 'td:nth(2) div span a.deact', $('tr.draggable-lang-item', this).get(0) ).hide();
if( $('tr.draggable-lang-item', this).length == 0 )
{
alert( '{text key="admin+msg_one_active_constraint"}' );
$(this).sortable('cancel');
$('#s1 tr.empty').remove();
break;
}
$('tr.draggable-lang-item:odd', this).each(function(){
if( !$(this).hasClass('peep_even') ) $(this).addClass('peep_even');
});
$('tr.draggable-lang-item:even', this).each(function(){
if( $(this).hasClass('peep_even') ) $(this).removeClass('peep_even');
});
break;
case $('#s2')[0]:
if($('tr.draggable-lang-item', ui.sender).length == 0) break;
$('tr.draggable-lang-item', this).each( function(){
$('td:nth(2) div span a.deact', this).hide(); $('td:nth(2) div span a.act', this).show(); $('td:nth(2) div span a.del', this).show();
if( $(this).hasClass('peep_even') )
$(this).removeClass('peep_even');
if( !$(this).hasClass('peep_high2') )
$(this).addClass('peep_high2');
} ) ;
break;
}
},
update: function(event, ui){
if( ui.sender ){
if($('tr', ui.sender[0]).length == 0) $( ui.sender[0] ).append('<tr class="empty"><td colspan="3">{/literal}{text key="admin+empty"}{literal}</td></tr>');
return;
}
if( $('#s1 tr.empty').length == 1 && $('#s1 tr.draggable-lang-item').length > 0 )
$('#s1 tr.empty').remove();
if( $('#s2 tr.empty').length == 1 && $('#s2 tr.draggable-lang-item').length > 0 )
$('#s2 tr.empty').remove();
$('tr.draggable-lang-item', '#s1').each( function(){
$('td:nth(2) div span a.deact', this).show();
});
$( 'td:nth(2) div span a.deact', $('tr.draggable-lang-item', '#s1').get(0) ).hide();
var set = {};
$('tr.draggable-lang-item', '#s1').each(function(i){
set['active['+i+']'] = parseInt( $('input:hidden', this).attr('value') );
});
$('tr.draggable-lang-item', '#s2').each(function(i){
set[ 'inactive['+i+']' ] = parseInt( $('input:hidden', this).attr('value') );
});
if( $('tr.draggable-lang-item', '#s1').length == 0 ) return;
$('td:nth(0) span.peep_mild_green', $('tr.draggable-lang-item', '#s1, #s2')).remove();
$('td:nth(0)', $('tr.draggable-lang-item', '#s1')[0]).append(
{/literal}'<span class="peep_mild_green peep_small">{text key="admin+def"}</span>'
{literal}
);
$.ajax( {
type: "POST",
url: '{/literal}{url_for for="ADMIN_CTRL_Languages:ajaxOrder"}{literal}',
data: set
});
},
connectWith: '#s1, #s2'
}).each( function(){
$('tr.draggable-lang-item', this).hover(
function(){ $('td:nth-child(3) div span', this).show() },
function(){ $('td:nth-child(3) div span', this).show() }
);
if ($('tr.draggable-lang-item', this).length == 0)
$(this).append( '<tr class="empty"><td colspan="3">{/literal}{text key="admin+empty"}{literal}</td></tr>' );
} );
});
{/literal}
{/script}
{style}
{literal}
.lang_placeholder {
border: 1px dashed grey;
width: 100%;
}
tr.lang_placeholder td{
border: 1px dashed grey;
width: 100%;
height: 35px;
}
.draggable-lang-item{
cursor: move;
}
{/literal}
{/style}
<div class="peep_superwide peep_automargin peep_stdmargin">
<a name="lang_list"></a>
<table id="langs" class="peep_table_1">
<tr class="peep_tr_first">
<th class="peep_center">{text key="admin+active_languages"}<br/><span style="font-size:9px;">{text key="admin+page_note_part_1"}</span></th>
<th width="100"></th>
<th width="180"></th>
</tr>
<tbody id="s1" class="s">
{foreach from=$active_langs item='lang' name="active_langs"}
<tr class="peep_high1 draggable-lang-item {if $smarty.foreach.active_langs.last}peep_tr_last{/if}">
<td style="text-align:left;"><input type="hidden" value="{$lang.id}">
{$lang.label} {if $smarty.foreach.active_langs.first}<span class="peep_mild_green peep_small">{text key="admin+def"}</span>{/if}
</td>
<td class="">
</td>
<td>
<div style="width:250px;height: 20px;" class="peep_center">
<span style="display: block;">
<a class="peep_lbutton" href="{url_for for="ADMIN_CTRL_Languages:index"}?language={$lang.tag}">{text key="admin+btn_label_edit_values"}</a>
<a class="peep_lbutton" href="javascript://" onclick="PEEP.ajaxFloatBox('ADMIN_CMP_LangEdit',['{$lang.id}'], {literal}{{/literal}width:600, iconClass: 'peep_ic_edit', title: '{text key='admin+edit_langs_cap_label'}'{literal}}{/literal})">{text key="admin+btn_label_edit"}</a>
<a class="peep_lbutton" onclick="$('form[name=clone-form] input:hidden[name=language]').attr('value', '{$lang.tag}'); new PEEP_FloatBox({ldelim}$title: '{text key='admin+clone_language_cap_label'}', $contents: $('#clone_cont'), width: '420px'{rdelim})" href="javascript://">{text key="admin+btn_label_clone"}</a>
<a class="peep_lbutton peep_green act" style="display: none;" href="{url_for for="ADMIN_CTRL_Languages:activate"}?language={$lang.tag}">{text key="admin+btn_label_activate"}</a>
<a class="peep_lbutton peep_red deact" {if $smarty.foreach.active_langs.first}style="display: none;"{/if}href="{url_for for="ADMIN_CTRL_Languages:deactivate"}?language={$lang.tag}">{text key="admin+btn_label_deactivate"}</a>
<a class="peep_lbutton peep_red del" style="display: none;" href="{url_for for="ADMIN_CTRL_Languages:delete"}?language={$lang.tag}">{text key="admin+btn_label_delete"}</a>
</span>
</div>
</td>
</tr>
{/foreach}
</tbody>
<tr class="peep_tr_delimiter"><td></td></tr>
<tr class=" peep_tr_last">
<th class="peep_center" style="position:relative; width:auto;">{text key="admin+inactive_languages"}<br/><span style="font-size:9px;">{text key="admin+page_note_part_2"}</span></th>
<th></th>
<th></th>
</tr>
<tfoot id="s2" class="s">
{foreach from=$inactive_langs item='lang' name='inactive_lang'}
<tr class="peep_high2 draggable-lang-item {if $smarty.foreach.inactive_lang.last}peep_tr_last{/if}">
<td style="text-align:left;">
<input type="hidden" value="{$lang.id}">
{$lang.label}
</td>
<td style="0px;">
</td>
<td>
<div style="width: 100%; height: 20px;" class="peep_center">
<span style="display: block;">
<a class="peep_lbutton" href="{url_for for="ADMIN_CTRL_Languages:index"}?language={$lang.tag}">{text key="admin+btn_label_edit_values"}</a>
<a class="peep_lbutton" href="javascript://" onclick="PEEP.ajaxFloatBox('ADMIN_CMP_LangEdit',['{$lang.id}'], {literal}{{/literal}width:600, iconClass: 'peep_ic_edit', title: '{text key='admin+edit_langs_cap_label'}'{literal}}{/literal})">{text key="admin+btn_label_edit"}</a>
<a class="peep_lbutton" onclick="$('form[name=clone-form] input:hidden[name=language]').attr('value', '{$lang.tag}'); new PEEP_FloatBox({ldelim}$title: '{text key='admin+clone_language_cap_label'}', $contents: $('#clone_cont'), width: '420px'{rdelim})" href="javascript://">{text key="admin+btn_label_clone"}</a>
<a class="peep_lbutton peep_green act" href="{url_for for="ADMIN_CTRL_Languages:activate"}?language={$lang.tag}">{text key="admin+btn_label_activate"}</a>
<a class="peep_lbutton peep_red deact" style="display: none;" href="{url_for for="ADMIN_CTRL_Languages:deactivate"}?language={$lang.tag}">{text key="admin+btn_label_deactivate"}</a>
{if $lang.tag!='en' }<a class="peep_lbutton peep_red del" onclick="return confirm('{text key="admin+are_you_sure"}')" href="{url_for for="ADMIN_CTRL_Languages:delete"}?language={$lang.tag}">{text key="admin+btn_label_delete"}</a>{/if}
</span>
</div>
</td>
</tr>
{/foreach}
<tfoot>
</table>
</div>
<div class="peep_superwide peep_automargin">
{capture name='add_new_lang'}{text key="admin+add_new_lang_or_pack"}{/capture}
{block_decorator name='box' addClass='peep_stdmargin' iconClass='peep_ic_add' label=$smarty.capture.add_new_lang}
<a name="lang_import"></a>
<p>
{text key="admin+import_lang_note"}
</p>
<div class="peep_box peep_superwide" style="text-align:center;margin:0 auto 20px; display: {if !$foo}block{else}none{/if};">
{form name="import"}
{input name="command"}
{label name="file"} {input name="file"} {submit name="submit" class="peep_ic_add"}
{/form}
</div>
{if $foo}
<form id="imp_form" method="POST" action="{url_for for="ADMIN_CTRL_Languages:import"}">
<input type="hidden" name="command" value="import-langs" />
<input type="hidden" name="imp-type" value="{$type}" />
<table id="import_table" class="peep_table_2 peep_small peep_spc_import_language">
<tr>
<td></td>
<td colspan="10" style="text-align:left;">{text key="admin+select_items_to_import_note"}</td>
</tr>
<tr>
<td></td>
{foreach from=$langsToImport item='lang' name="col"}
<th><input type="checkbox" onclick="$('input:checkbox.col_{$smarty.foreach.col.iteration}', $('#import_table') ).attr('checked', this.checked);"/> {$lang.label}</th>
{/foreach}
</tr>
{foreach from=$prefixesToImport item='prToImp' name='row'}
<tr class="{cycle values="peep_alt1,peep_alt2"}">
<th style="text-align:left;">
<input type="checkbox" onclick="$('input:checkbox.row_{$smarty.foreach.row.iteration}', $('#import_table') ).attr('checked', this.checked);" />
{$prToImp.label}
</th>
{foreach from=$langsToImport item='lang' name='col'}
<td>
<input type="checkbox" class="col_{$smarty.foreach.col.iteration} row_{$smarty.foreach.row.iteration}" name="set[lang][lang_{$lang.tag}][]" value="{$prToImp.prefix}"/>
</td>
{/foreach}
</tr>
{/foreach}
<tr>
<td></td>
<td colspan="10"><input type="checkbox" onclick="$('input:checkbox','#import_table').attr('checked', this.checked);" /> {text key="admin+lang_import_check_all"}</td>
</tr>
</table>
<div class="clearfix">
<div class="peep_right">
{decorator name="button" class="peep_positive" langLabel="admin+import_lang_button_label" extraString="onclick="$('#imp_form')[0].submit()""}
</div>
</div>
</form>
{/if}
{/block_decorator}
{style}
{literal}
.ondrag-class{
background-color: #B2CCB2;
}
{/literal}
{/style}
<span id="exportInvite">
{capture name='export_lang'}{text key="admin+export_lang_header"}{/capture}
{block_decorator name='box' addClass='peep_stdmargin' iconClass='peep_ic_add' label=$smarty.capture.export_lang}
<p style="padding-bottom:10px;">{text key="admin+export_lang_note"}</p>
<div class="peep_box_mod clearfix peep_smallmargin">
<div class="peep_right">
{decorator name="button" class="peep_ic_up_arrow" langLabel="admin+export_lang_button_label" extraString="onclick="$('#exportInvite').hide();$('#exportForm').show();""}
</div>
</div>
{/block_decorator}
</span>
</div>
<form id="exportForm" method="POST" style="display: none;">
<input type="hidden" name="command" value="export-langs">
<table id="export_table" class="peep_table_2 peep_small peep_superwide peep_spc_inport_language peep_automargin">
<tr>
<td></td>
<td colspan="10" style="text-align:left;">{text key="admin+export_lang_note2"}</td>
</tr>
<tr>
<td class="peep_left"><input type="checkbox" onclick="$('input:checkbox', '#export_table').attr('checked', this.checked);"/> {text key="admin+lang_import_check_all"}</td>
{foreach from=$langs item='lang' name="col"}
<th><input type="checkbox" onclick="$('input:checkbox.col_{$smarty.foreach.col.iteration}', $('#export_table') ).attr('checked', this.checked);"/> {$lang.label}</th>
{/foreach}
</tr>
{foreach from=$prefixes item='prefix' name="row"}
<tr class="{cycle values="peep_alt1,peep_alt2"}" >
<th style="text-align: left;"><input type="checkbox" onclick="$('input:checkbox.row_{$smarty.foreach.row.iteration}', $('#export_table') ).attr('checked', this.checked);" /> {$prefix->getLabel()}</th>
{foreach from=$langs item='lang' name="col"}
<td><input type="checkbox" class="col_{$smarty.foreach.col.iteration} row_{$smarty.foreach.row.iteration}" name="set[lang][lang_{$lang.id}][prefix_{$prefix->getId()}]" value="{$prefix->getId()}"/></td>
{/foreach}
</tr>
{/foreach}
</table>
<div class="clearfix peep_stdmargin"><div class="peep_right">{decorator name="button" class="peep_ic_up_arrow peep_positive" langLabel="admin+export_lang_button_label2" extraString="onclick="$('#exportForm')[0].submit();""}</div></div>
</form>
<div style="display: none;">
<div id="clone_cont">
{form name="clone-form"}
{input name="language"}
<table class="peep_table_1 peep_form">
<tr class="peep_alt2">
<td class="peep_label">
{label name="label"}
</td>
<td class="peep_value" style="width:30%">
{input name="label"}
</td>
<td class="peep_desc">
{desc name="label"}
</td>
</tr>
<tr class="peep_alt1">
<td class="peep_label">
{label name="tag"}
</td>
<td class="peep_value">
{input name="tag"}
</td>
<td class="peep_desc">
{desc name="tag"}
</td>
</tr>
</table>
<div class="clearfix"><div class="peep_right">{submit name="submit" class="peep_positive"}</div></div>
{/form}
</div>
</div>
?>