Browse Source

Обновление файла.

master
Repellent 8 years ago
parent
commit
c8278a9304
  1. 403
      import/templates/admin_edit.tpl

403
import/templates/admin_edit.tpl

@ -1,274 +1,337 @@
<div class="title">
<h5>{if $smarty.request.id == ''}{#IMPORT_H_ADD#}{else}{#IMPORT_H_EDIT#}{/if}</h5>
</div>
<script>
var import_id = {$import_id};
</script>
<div class="widget" style="margin-top: 0px;">
<div class="body">
{#IMPORT_INFO_EDIT#}
</div>
<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&action=modedit&mod=import&moduleaction=1&cp={$sess}">{#IMPORT_MODULE_NAME#}</a></li>
<li>{if $smarty.request.id == ''}{#IMPORT_H_ADD#}{else}{#IMPORT_H_EDIT#}{/if}</li>
<li><strong class="code">{if $smarty.request.id == ''}{#IMPORT_H_ADD#}{else}{$import_name|escape}{/if}</strong></li>
<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 method="post" id="import_edit_form" action="index.php?do=modules&action=modedit&mod=import&moduleaction=saveedit&cp={$sess}" class="mainForm">
<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 $smarty.request.id != ''} closed{/if}">
<h5 class="iFrames">{#IMPORT_H_EDIT#}</h5>
<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">{#IMPORT_NAME#}</td>
<td width="250">{#name#}</td>
<td>
<div class="pr12">
<input name="import_name" type="text" value="{$import_name|escape}" placeholder="{#CONTACT_FORM_NAME#}" size="50" />
</div>
<input name="name" class="mousetrap" type="text" style="width:250px" value="{$import.name|escape|stripslashes}" autocomplete="off" id="importNameInput" />
</td>
</tr>
<tr>
<td>{#IMPORT_RUBRICS#}</td>
<td>{#rub_name#}</td>
<td>
<select class="mousetrap" style="width: 250px" name="import_rub" {if $smarty.request.id != ''}disabled="disabled"{/if}>
{if !$import_id}
<select name="rub_id">
{foreach from=$rubs item=rub}
{if $rub->Id==$import_rub}
<option value="{$rub->Id}" selected>{$rub->rubric_title}</option>
{else}
<option value="{$rub->Id}">{$rub->rubric_title}</option>
{/if}
<option value="{$rub.id}">{$rub.title}</option>
{/foreach}
</select>
</select>
{else}
{$import.rub_title|escape|stripslashes}
{/if}
</td>
</tr>
<tr>
<td>{#IMPORT_PARSER#}</td>
<td>{#parser#}</td>
<td>
<select class="mousetrap" name="import_parser" style="width: 250px">
{foreach from=$parses item=parse}
{if $parse==$import_parser}
<option value="{$parse}" selected>{$parse}</option>
{else}
<option value="{$parse}">{$parse}</option>
{/if}
{/foreach}
<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>{#IMPORT_DELETE_DOCS#}</td>
<td><input class="mousetrap" name="import_delete_docs" type="checkbox" value="1" {if $import_delete_docs==1}checked="checked"{/if}/></td>
</tr>
<tr>
<td>{#IMPORT_DOCS_CREATE#}</td>
<td><input class="mousetrap" name="import_docs_create" type="checkbox" value="1" {if $import_docs_create==1}checked="checked"{/if}/></td>
<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>{#IMPORT_FILE#}</td>
<td><div class="pr12">
<input class="mousetrap" name="import_default_file" type="text" value="{$import_default_file|escape}" size="50" placeholder="{#IMPORT_FILE#}" />
</div></td>
<td>{#docs_create#}</td>
<td><input type="checkbox" name="docs_create" value="1" {if $import.docs_create}checked="checked"{/if} /></td>
</tr>
<tr>
<td>{#IMPORT_CHECK_FILE#}</td>
<td><input class="mousetrap" name="import_monitor_file" id="import_monitor_file" type="checkbox" value="1" {if $import_monitor_file==1}checked="checked"{/if}/></td>
<td>{#monitor#}</td>
<td><input type="checkbox" name="monitor" value="1" {if $import.monitor}checked="checked"{/if} /></td>
</tr>
<tr>
<td colspan="3">
<input type="submit" class="basicBtn" value="{if $smarty.request.id != ''}{#IMPORT_SAVE#}{else}{#IMPORT_CREATE#}{/if}"/>
{if $smarty.request.id != ''}
<input type="submit" class="blackBtn SaveEdit" value="{#IMPORT_CTRLS#}" />
<input type="submit" class="greenBtn" value="{#IMPORT_REFRESH_TAGS#}" onclick="window.location ='index.php?do=modules&action=modedit&mod=import&moduleaction=tags&id={$id}&cp={$sess}';return false;" />
<input type="submit" class="redBtn" onclick="location.href='index.php?do=modules&action=modedit&mod=import&moduleaction=do&id={$id}&cp={$sess}'; return false;" value="{#IMPORT_DO_HINT#}" style="float: right;">
{/if}
</td>
<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 $smarty.request.id != ''}
{if $import_id}
<div style="position:relative;width:73%;float:left">
<div class="widget first">
<div class="head closed">
<h5 class="iFrames">{#IMPORT_MAIN_FIELDS#}</h5>
<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>
<td width="35" align="center">
<tr class="noborder">
<td align="center">
<div align="center">
<a href="javascript:void(0);" class="topDir icon_sprite ico_info" title="{#IMPORT_ACTIVE_INFO#}"></a>
<a href="javascript:void(0);" class="topDir icon_sprite ico_info" title="{#check_f_active#}"></a>
</div>
</td>
<td width="35" align="center">
<td align="center">
<div align="center">
<a href="javascript:void(0);" class="topDir icon_sprite ico_info" title="{#IMPORT_KEYS_INFO#}"></a>
<a href="javascript:void(0);" class="topDir icon_sprite ico_info" title="{#check_f_key#}"></a>
</div>
</td>
<td width="35" align="center">
<td align="center">
<div align="center">
<a href="javascript:void(0);" class="topDir icon_sprite ico_info" title="{#IMPORT_CRITICAL_INFO#}"></a>
<a href="javascript:void(0);" class="topDir icon_sprite ico_info" title="{#check_f_oblig#}"></a>
</div>
</td>
<td width="300">{#IMPORT_F#}</td>
<td>{#IMPORT_TPL#}</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=$data.fields.header key=k item=v}
<tr>
<td>
<input class="mousetrap" name="document[active][header][{$k}]" type="hidden" value="0" />
<input class="mousetrap" name="document[active][header][{$k}]" type="checkbox" value="1" {if !$data.active.header.$k==0}checked="checked"{/if} {if $k=='Id'}disabled="disabled"{/if} />
</td>
<td><input class="mousetrap" name="document[key][header][{$k}]" type="checkbox" value="1" {if $data.key.header.$k==1}checked="checked"{/if}/></td>
<td><input class="mousetrap" name="document[critical][header][{$k}]" type="checkbox" value="1" {if $data.critical.header.$k==1}checked="checked"{/if}/></td>
<td>{$v[1]}</td>
<td><div class="pr12"><input class="mousetrap" type="text" name="document[fields][header][{$k}]" value="{$v[0]|escape|stripslashes}" size="50" /></div></td>
</tr>
{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}
</tbody>
</table>
</div>
<div class="widget first">
<div class="head">
<h5 class="iFrames">{#IMPORT_RUB_FIELDS#}</h5>
<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>
<td width="35" align="center">
<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="{#IMPORT_ACTIVE_INFO#}"></a>
<a href="javascript:void(0);" class="topDir icon_sprite ico_info" title="{#check_f_key#}"></a>
</div>
</td>
<td width="35" align="center">
<td align="center">
<div align="center">
<a href="javascript:void(0);" class="topDir icon_sprite ico_info" title="{#IMPORT_KEYS_INFO#}"></a>
<a href="javascript:void(0);" class="topDir icon_sprite ico_info" title="{#check_f_oblig#}"></a>
</div>
</td>
<td width="35" align="center">
<td align="center">
<div align="center">
<a href="javascript:void(0);" class="topDir icon_sprite ico_info" title="{#IMPORT_CRITICAL_INFO#}"></a>
ID
</div>
</td>
<td width="300">{#IMPORT_F#}</td>
<td>{#IMPORT_TPL#}</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=$data.fields.body key=k item=v}
<tr>
<td>
<input class="mousetrap" name="document[active][body][{$k}]" type="hidden" value="0" />
<input class="mousetrap" name="document[active][body][{$k}]" type="checkbox" value="1" {if !$data.active.body.$k==0}checked="checked"{/if}/>
</td>
<td><input class="mousetrap" name="document[key][body][{$k}]" type="checkbox" value="1" {if $data.key.body.$k==1}checked="checked"{/if}/></td>
<td><input class="mousetrap" name="document[critical][body][{$k}]" type="checkbox" value="1" {if $data.critical.body.$k==1}checked="checked"{/if}/></td>
<td>{$v[1]}</td>
<td><div class="pr12"><input class="mousetrap" type="text" name="document[fields][body][{$k}]" value="{$v[0]|escape|stripslashes}" size="50" /></div></td>
</tr>
{/foreach}
{foreach from=$import.fields.body key=field_id item=field}
<tr>
<td colspan="5">
<input type="hidden" name="id" value="{$id}">
<input type="submit" class="basicBtn" value="{#IMPORT_SAVE#}"/>
<input type="submit" class="blackBtn SaveEdit" value="{#IMPORT_CTRLS#}" />
<input type="submit" class="greenBtn" value="{#IMPORT_REFRESH_TAGS#}" onclick="window.location ='index.php?do=modules&action=modedit&mod=import&moduleaction=tags&id={$id}&cp={$sess}';return false;" />
<input type="submit" class="redBtn" onclick="location.href='index.php?do=modules&action=modedit&mod=import&moduleaction=do&id={$id}&cp={$sess}'; return false;" value="{#IMPORT_DO_HINT#}" style="float: right;">
<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>
</tbody>
{/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">{#IMPORT_TAGS#}</h5>
<h5 class="iFrames">{#tags#}</h5>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<tbody>
<tr>
<td align="center">
<div class="pr12">
<input class="mousetrap" readonly type="text" value="[Y-m-d]" style="margin-top:5px;" title="{#IMPORT_TAG_DATE#}">
<input class="mousetrap" readonly type="text" value="[row:XXX]" style="margin-top:5px;" title="{#IMPORT_TAG_1#}">
<input class="mousetrap" readonly type="text" value="[row:XXX:YYY:...]" style="margin-top:5px;" title="{#IMPORT_TAG_2#}">
</div>
<td>
<div class="pr12"><input class="mousetrap topleftDir" readonly style="width:100%" type="text" value="[Y-m-d]" title="{#tag_date#}"></div>
</td>
</tr>
{if $data.tags}
<tr>
<td align="center">
{#IMPORT_TAGS_TITLE#}
<td>
<div class="pr12"><input class="mousetrap topleftDir" readonly style="width:100%" type="text" value="[row:XXX]" title="{#tag_one#}"></div>
</td>
</tr>
{foreach from=$data.tags key=k item=v}
</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">
<div class="pr12"><input class="mousetrap" readonly type="text" value="{$v}"></div>
{#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>
</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});
<script language="javascript">
var sett_options = {ldelim}
url: 'index.php?do=modules&action=modedit&mod=import&moduleaction=saveedit&cp={$sess}',
beforeSubmit: Request,
success: Response,
error: Error
{rdelim}
function Request(){ldelim}
$.alerts._overlay('show');
{rdelim}
function Response(){ldelim}
$.alerts._overlay('hide');
$.jGrowl('{#IMPORT_SAVED#}', {ldelim}theme: 'accept'{rdelim});
{rdelim}
function Error(){ldelim}
$.alerts._overlay('hide');
$.jGrowl('{#IMPORT_FAILED#}', {ldelim}theme: 'error'{rdelim});
{rdelim}
$(document).ready(function(){ldelim}
{if $import_id}
Mousetrap.bind(['ctrl+o', 'meta+o'], function(event) {ldelim}
event.preventDefault();
importRun ();
return false;
{rdelim});
{/if}
Mousetrap.bind(['ctrl+s', 'meta+s'], function(e) {ldelim}
if (e.preventDefault) {ldelim}
e.preventDefault();
{rdelim} else {ldelim}
// internet explorer
e.returnValue = false;
{rdelim}
$("#import_edit_form").ajaxSubmit(sett_options);
$('.importSaveContBtn').click(function(event) {ldelim}
saveCont();
return false;
{rdelim});
{rdelim});
$(".SaveEdit").click(function(e){ldelim}
if (e.preventDefault) {ldelim}
e.preventDefault();
{rdelim} else {ldelim}
// internet explorer
e.returnValue = false;
// функция 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}
$("#import_edit_form").ajaxSubmit(sett_options);
return false;
{rdelim});
return false;
{rdelim}
{rdelim});
</script>
// функция запуска импорта
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}

Loading…
Cancel
Save