Модуль импорта v2.26.0 (Light версия)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

338 lines
11 KiB

<script>
var import_id = {$import_id};
</script>
<div class="title">
<h5>{if $import_id}{#import_edit_tit#}{else}{#import_new_tit#}{/if}</h5>
</div>
<div class="breadCrumbHolder module">
<div class="breadCrumb module">
<ul>
<li class="firstB">
<a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a>
</li>
<li>
<a href="index.php?do=modules&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a>
</li>
<li>
<a href="index.php?do=modules&amp;action=modedit&amp;mod=import&amp;moduleaction=1&amp;cp={$sess}">{#mod_name#}</a>
</li>
<li>
{if $import_id}{#import_edit_tit#}{else}{#import_new_tit#}{/if}
</li>
{if $import_id}
<li>
<strong class="code">{$import.name|escape|stripslashes}</strong>
</li>
{/if}
</ul>
</div>
</div>
<form action="index.php?do=modules&amp;action=modedit&amp;mod=import&amp;moduleaction=save&amp;import_id={$import_id}&amp;cp={$sess}" method="post" class="mainForm" id="importSaveForm">
<div class="widget first">
<div class="head {if $import_id}closed{/if}">
<h5 class="iFrames">{#import_set#}</h5>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<tr class="noborder">
<td width="250">{#name#}</td>
<td>
<input name="name" class="mousetrap" type="text" style="width:250px" value="{$import.name|escape|stripslashes}" autocomplete="off" id="importNameInput" />
</td>
</tr>
<tr>
<td>{#rub_name#}</td>
<td>
{if !$import_id}
<select name="rub_id">
{foreach from=$rubs item=rub}
<option value="{$rub.id}">{$rub.title}</option>
{/foreach}
</select>
{else}
{$import.rub_title|escape|stripslashes}
{/if}
</td>
</tr>
<tr>
<td>{#parser#}</td>
<td>
<select name="parser" style="width: 250px;">
{foreach from=$parsers item=parser}
<option value="{$parser}" {if $import.parser == $parser}selected="selected"{/if}>{$parser}</option>
{/foreach}
</select>
</td>
</tr>
<tr>
<td>{#docs_disable#}</td>
<td><input class="mousetrap" type="checkbox" name="docs_disable" value="1" {if $import.docs_disable}checked="checked"{/if} /></td>
</tr>
<tr>
<td>{#docs_create#}</td>
<td><input type="checkbox" name="docs_create" value="1" {if $import.docs_create}checked="checked"{/if} /></td>
</tr>
<tr>
<td>{#monitor#}</td>
<td><input type="checkbox" name="monitor" value="1" {if $import.monitor}checked="checked"{/if} /></td>
</tr>
<tr>
<td>{#file#}</td>
<td>/&nbsp;<input class="mousetrap" type="text" name="file" value="{$import.file|escape|stripslashes}" style="width:300px;" /></td>
</tr>
</table>
<div class="rowElem">
<input type="submit" class="basicBtn" value="{if $import_id}{#save#}{else}{#create#}{/if}" />
{if $import_id}
&nbsp;
<input type="submit" class="blackBtn importSaveContBtn" value="{#save_cont#}" /> &nbsp;
<input type="submit" class="greenBtn" value="{#tags_refresh#}" onClick="location.href='index.php?do=modules&amp;action=modedit&amp;mod=import&amp;moduleaction=tags&amp;import_id={$import.id}&amp;cp={$sess}';return false;" /> &nbsp;
<input type="submit" class="redBtn" onClick="location.href='index.php?do=modules&amp;action=modedit&amp;mod=import&amp;moduleaction=run&amp;import_id={$import_id}&amp;cp={$sess}';return false;" value="{#run_btn#} (Ctrl+O)" />
{/if}
</div>
</div>
{if $import_id}
<div style="position:relative;width:73%;float:left">
<div class="widget first">
<div class="head {if $import_id}closed{/if}">
<h5 class="iFrames">{#fields_main#}</h5>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<colgroup>
<col width="1" />
<col width="1" />
<col width="1" />
<col width="250" />
<col width="1" />
<col width="*" />
</colgroup>
<thead>
<tr class="noborder">
<td align="center">
<div align="center">
<a href="javascript:void(0);" class="topDir icon_sprite ico_info" title="{#check_f_active#}"></a>
</div>
</td>
<td align="center">
<div align="center">
<a href="javascript:void(0);" class="topDir icon_sprite ico_info" title="{#check_f_key#}"></a>
</div>
</td>
<td align="center">
<div align="center">
<a href="javascript:void(0);" class="topDir icon_sprite ico_info" title="{#check_f_oblig#}"></a>
</div>
</td>
<td>{#field#}</td>
<td align="center">
<div align="center">
<a href="javascript:void(0);" class="topDir icon_sprite ico_info" title="{#compare_type#}"></a>
</div>
</td>
<td>{#field_tpl#}</td>
</tr>
</thead>
<tbody>
{foreach from=$import.fields.main key=field_id item=field}
<tr>
<td>
<input type="checkbox" value="1" name="fields[main][{$field_id}][active]" {if $field.active}checked="checked"{/if}/>
</td>
<td>
<input type="checkbox" value="1" name="fields[main][{$field_id}][key]" {if $field.key}checked="checked"{/if}/>
</td>
<td>
<input type="checkbox" value="1" name="fields[main][{$field_id}][oblig]" {if $field.oblig}checked="checked"{/if}/>
</td>
<td>{$field.title}</td>
<td>
<select name="fields[main][{$field_id}][comp]" style="width: 80px;">
<option value="">==</option>
<option value="LIKE" {if $field.comp=='LIKE'}selected="selected"{/if}>LIKE</option>
</select>
<td>
<div class="pr12"><textarea class="mousetrap" name="fields[main][{$field_id}][tpl]" style="width:100%; height:24px;">{$field.tpl|escape|stripslashes}</textarea></div>
</td>
</tr>
{/foreach}
</table>
</div>
<div class="widget first">
<div class="head">
<h5 class="iFrames">{#fields_body#}</h5>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<colgroup>
<col width="1" />
<col width="1" />
<col width="1" />
<col width="1" />
<col width="250" />
<col width="1" />
<col width="*" />
</colgroup>
<thead>
<tr class="noborder">
<td align="center">
<div align="center">
<a href="javascript:void(0);" class="topDir icon_sprite ico_info" title="{#check_f_active#}"></a>
</div>
</td>
<td align="center">
<div align="center">
<a href="javascript:void(0);" class="topDir icon_sprite ico_info" title="{#check_f_key#}"></a>
</div>
</td>
<td align="center">
<div align="center">
<a href="javascript:void(0);" class="topDir icon_sprite ico_info" title="{#check_f_oblig#}"></a>
</div>
</td>
<td align="center">
<div align="center">
ID
</div>
</td>
<td>{#field#}</td>
<td align="center">
<div align="center">
<a href="javascript:void(0);" class="topDir icon_sprite ico_info" title="{#compare_type#}"></a>
</div>
</td>
<td>{#field_tpl#}</td>
</tr>
</thead>
<tbody>
{foreach from=$import.fields.body key=field_id item=field}
<tr>
<td>
<input type="checkbox" value="1" name="fields[body][{$field_id}][active]" {if $field.active}checked="checked"{/if} />
</td>
<td>
<input type="checkbox" value="1" name="fields[body][{$field_id}][key]" {if $field.key}checked="checked"{/if} />
</td>
<td>
<input type="checkbox" value="1" name="fields[body][{$field_id}][oblig]" {if $field.oblig}checked="checked"{/if} />
</td>
<td><strong class="code">{$field_id}</strong></td>
<td>{$field.title}</td>
<td>
<select name="fields[body][{$field_id}][comp]" style="width: 80px;">
<option value="">==</option>
<option value="LIKE" {if $field.comp=='LIKE'}selected="selected"{/if}>LIKE</option>
</select>
<td>
<div class="pr12"><textarea class="mousetrap" name="fields[body][{$field_id}][tpl]" style="width:100%; height:24px;">{$field.tpl|escape|stripslashes}</textarea></div>
</td>
</tr>
{/foreach}
</table>
</div>
</div>
<div class="widget first" style="position:relative;display:block;float:right;clear:none;width:25%">
<div class="head">
<h5 class="iFrames">{#tags#}</h5>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<tbody>
<tr>
<td>
<div class="pr12"><input class="mousetrap topleftDir" readonly style="width:100%" type="text" value="[Y-m-d]" title="{#tag_date#}"></div>
</td>
</tr>
<tr>
<td>
<div class="pr12"><input class="mousetrap topleftDir" readonly style="width:100%" type="text" value="[row:XXX]" title="{#tag_one#}"></div>
</td>
</tr>
<tr>
<td>
<div class="pr12"><input class="mousetrap topleftDir" readonly style="width:100%" type="text" value="[row:XXX:YYY:...]" title="{#tag_many#}"></div>
</td>
</tr>
{if $import.tags}
<tr>
<td align="center">
{#fields_file#}
</td>
</tr>
{foreach from=$import.tags item=tag}
<tr>
<td>
<div class="pr12"><input class="mousetrap" readonly style="width:100%" type="text" value="{$tag}"></div>
</td>
</tr>
{/foreach}
<tr>
{/if}
</table>
</div>
{/if}
</form>
<script type="text/javascript">
$(function() {ldelim}
Mousetrap.bind(['ctrl+s', 'meta+s'], function(event) {ldelim}
event.preventDefault();
{if $import_id}
saveCont();
{else}
$('#importSaveForm').submit();
{/if}
return false;
{rdelim});
{if $import_id}
Mousetrap.bind(['ctrl+o', 'meta+o'], function(event) {ldelim}
event.preventDefault();
importRun ();
return false;
{rdelim});
{/if}
$('.importSaveContBtn').click(function(event) {ldelim}
saveCont();
return false;
{rdelim});
{rdelim});
// функция ajax-сохранения
function saveCont () {ldelim}
$('#importSaveForm').ajaxSubmit({ldelim}
dataType: 'json',
beforeSubmit: function () {ldelim} $.alerts._overlay('show');{rdelim},
success: function (data) {ldelim}
$.alerts._overlay('hide');
$.jGrowl(data['message'], {ldelim}
header: data['header'],
theme: data['theme']
{rdelim});
{rdelim}
{rdelim});
return false;
{rdelim}
// функция запуска импорта
function importRun () {ldelim}
location.href='index.php?do=modules&action=modedit&mod=import&moduleaction=importrun&import_id={$import_id}&cp={$sess}';
/* $.ajax({ldelim}
url: 'index.php?do=modules&action=modedit&mod=import&moduleaction=importrun&import_id={$import_id}&cp={$sess}',
beforeSend: function () {ldelim} $.alerts._overlay('show');{rdelim},
success: function () {ldelim}
$.alerts._overlay('hide');
$.jGrowl('{#imported#}', {ldelim} theme: 'accept'{rdelim});
{rdelim}
{rdelim});*/
{rdelim}
</script>
{if $import_id}
{include file="$codemirror_connect"}
{include conn_id="_1" file="$codemirror_editor" textarea_id='codemirror' ctrls='saveCont();' ctrlo='importRun();' height=200}
{include conn_id="_2" file="$codemirror_editor" textarea_id='codemirror2' ctrls='saveCont();' ctrlo='importRun();' height=200}
{include conn_id="_3" file="$codemirror_editor" textarea_id='codemirror3' ctrls='saveCont();' ctrlo='importRun();' height=200}
{/if}