200 lines
7.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<style>
.message_box{padding: 5px 10px; margin-top: 5px; border-right: 2px solid #000; display: none;}
.message_red{background-color: #DD6B2C; color: #fff; border-right: 2px solid #d62;}
.message_green{background-color: #B3DB57; color:#000; border-right: 2px solid #bd5;}
</style>
<div class="title"><h5>Импортируйте заранее готовые рубрики и запросы!</h5></div>
<div class="widget" style="margin-top: 0px;">
<div class="body">
По вопросам развития модуля обращайтесь: <b>pm@pmore.ru</b>
</div>
</div>
<div class="breadCrumbHolder module">
<div class="breadCrumb module">
<ul>
<li class="firstB"><a href="index.php" ></a></li>
<li><a href="<?=$this->uri(FALSE, FALSE)?>">Управление модулями</a></li>
<li>Импорт | экспорт рубрик, запросов и системных блоков</li>
</ul>
</div>
</div>
<div id="rubimex_message" class="message_box"></div>
<div class="widget first">
<ul class="tabs">
<li class="activeTab"><a href="#tab1">&laquo; Импорт рубрик</a></li>
<li class=""><a href="#tab2">&laquo; Импорт системных блоков</a></li>
<li class=""><a href="#tab3">Экспорт рубрик &raquo;</a></li>
</ul>
<div class="tab_container">
<div id="tab1" class="tab_content" style="display: block;">
<?php //$this->export_rubric(4,'static','Статические страницы','Рубрика для создания статических страниц с полем "Код". Запросы: список страниц с пагинацией, список страниц в виде постов.')?>
<?php if (!empty($files)) :?>
<form id="import_rub_form" action="<?=$this->uri('ajax_rub_import', TRUE)?>" method="POST">
<table class="tableStatic mainForm" style="width:100%">
<thead>
<tr>
<td width="1%"></td>
<td >Рубрика</td>
<td width="70%">Описание</td>
<td width="1%"></td>
</tr>
</thead>
<tbody>
<?php foreach($files as $data) :?>
<tr id="import_<?=$data['id']?>">
<td align="center">
<div class="jqTransformCheckboxWrapper">
<input class="jqTransformCheckbox" type="checkbox" name="files[]" value="<?=$data['filename']?>">
</div>
</td>
<td align="center"><b><?=$data['title']?></b></td>
<td><?=$data['desc']?></td>
<td align="center">
<a onclick="rubimex_delete('<?=$data['filename']?>', <?=$data['id']?>)" class="topleftDir icon_sprite ico_delete" href="javascript:void(0)" original-title="Удалить конфиг"></a>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<div class="rowElem">
<input id="import_rub" type="button" class="basicBtn ConfirmSettings" value="Импортировать рубрики">
<input id="import_rub_req" type="button" class="basicBtn ConfirmSettings" value="Импортировать рубрики и запросы">
</div>
</form>
<?php else:?>
<div class="highlight yellow">Готовых к импорту рубрик не найдено. Экспортируйте рубрики со старых проектов и добавьте в модуль.</div>
<?php endif; ?>
</div>
<div id="tab2" class="tab_content" style="display: none;">
<?php if(!empty($sysblocks)) :?>
<form id="import_sys_form" action="<?=$this->uri('ajax_sys_import', TRUE)?>" method="POST">
<table class="tableStatic mainForm" style="width:100%">
<thead>
<tr>
<td width="1%"></td>
<td>Имя блока</td>
<td width="60%">Описание</td>
<td>Автор</td>
</tr>
</thead>
<tbody>
<?php foreach($sysblocks as $filename => $block) :?>
<tr>
<td align="center">
<div class="jqTransformCheckboxWrapper">
<input class="jqTransformCheckbox" type="checkbox" name="sys" value="<?=$filename?>">
</div>
</td>
<td align="center"><b><?=$block['title']?></b></td>
<td>
<div class="pm_rub_desc"><?=$block['desc']?></div>
</td>
<td align="center"><b><?=$block['author']?></b></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<div class="rowElem"><input id="import_sys" type="button" class="basicBtn ConfirmSettings" value="Импортировать системные блоки"></div>
</form>
<?php else:?>
<div class="highlight yellow">Список системных блоков пуст.</div>
<?php endif;?>
</div>
<div id="tab3" class="tab_content" style="display: none;">
<?php if(!empty($rubrics)):?>
<form action="<?=$this->uri('ajax_rub_export', TRUE)?>" method="POST">
<table id="rub_export" class="tableStatic mainForm" style="width:100%">
<thead>
<tr>
<td width="1%"></td>
<td width="20%">Заголовок рубрики</td>
<td >Описание рубрики</td>
</tr>
</thead>
<tbody>
<?php foreach($rubrics as $r): ?>
<tr>
<td><input class="jqTransformCheckbox" type="checkbox" name="rubs[]" value="<?=$r['rub_id']?>"></td>
<td><b><?=$r['rubric_title']?></b>
<div style="font-size:10px; font-style: italic">
Полей: <b><?=$r['count_fields']?></b>
Запросов: <b><?=$r['count_req']?></b>
Алиас: <b><?=$r['rubric_alias']?></b>
</div>
</td>
<td><?=$r['rubric_description']?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<div class="rowElem">
<input id="export_rubs" type="submit" class="basicBtn ConfirmSettings" value="Экспортировать">
</div>
</form>
<?php else:?>
<div class="highlight yellow">Готовых к экспорту рубрик в вашей системе не найдено. Создайте рубрики и затем экспортируйте их для повторного использования.</div>
<?php endif;?>
</div>
</div>
<div class="fix"></div>
</div>
<script type="text/javascript">
function rubimex_delete(filename, tr_id){
$.post('<?=$this->uri('ajax_rub_delete', TRUE)?>', {file: filename}, function(res){
if(res.type == 'success') $('#import_'+tr_id).fadeOut(400);
rubimex_result(res);
});
}
function rubimex_result(result){
console.log(result);
var type = 'message_green';
if(result.type == 'error') type = 'message_red';
if(result.message) {
$('#rubimex_message').hide().removeClass('message_green').addClass(type).text(result.message).fadeIn(400);
}
}
$(function(){
$('#import_rub').on('click', function(){
$.post('<?=$this->uri('ajax_rub_import', TRUE)?>', {filenames: $('#import_rub_form').serializeArray()}, function(res){
rubimex_result(res);
});
});
$('#import_rub_req').on('click', function(){
$.post('<?=$this->uri('ajax_rub_import', TRUE)?>', {filenames: $('#import_rub_form').serializeArray(), with_req: 1}, function(res){
rubimex_result(res);
});
});
$('#import_sys').on('click', function(){
$.post('<?=$this->uri('ajax_sys_import', TRUE)?>', {sys_blocks: $('#import_sys_form').serializeArray()}, function(res){
rubimex_result(res);
});
});
});
</script>