+ выбор какие запросы использовать
This commit is contained in:
@@ -59,7 +59,78 @@
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('settings/settings_main.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Переключает файлы запросов (UNLINK+COPY) и очищает связанные таблицы в БД.
|
||||
*
|
||||
* @param bool $use_safe_version TRUE для безопасной версии, FALSE для оригинальной.
|
||||
* @return bool TRUE в случае успеха, FALSE в случае ошибки.
|
||||
*/
|
||||
private function _switchQueryFiles($use_safe_version)
|
||||
{
|
||||
// Получаем доступ к глобальному объекту базы данных
|
||||
global $AVE_DB;
|
||||
|
||||
// 1. Загружаем список файлов для замены (Манифест)
|
||||
$manifest_path = BASE_DIR . '/inc/query_variants/query_manifest.php';
|
||||
|
||||
$manifest = @require $manifest_path;
|
||||
|
||||
if (!is_array($manifest) || empty($manifest)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2. Определяем исходную папку
|
||||
$source_dir_name = $use_safe_version ? 'safe_files' : 'original_files';
|
||||
$source_base = BASE_DIR . '/inc/query_variants/' . $source_dir_name;
|
||||
|
||||
$error_count = 0;
|
||||
|
||||
// 3. ИТЕРАЦИЯ И КОПИРОВАНИЕ
|
||||
foreach ($manifest as $relative_path) {
|
||||
|
||||
$source_file = $source_base . '/' . $relative_path;
|
||||
$target_file = BASE_DIR . '/' . $relative_path;
|
||||
|
||||
if (!file_exists($source_file)) {
|
||||
$error_count++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// 4. Создаем папку назначения, если ее нет
|
||||
$target_dir = dirname($target_file);
|
||||
if (!is_dir($target_dir)) {
|
||||
@mkdir($target_dir, 0775, true);
|
||||
}
|
||||
|
||||
// 5. ГАРАНТИЯ ПЕРЕЗАПИСИ: Удаляем старый файл перед копированием
|
||||
if (file_exists($target_file)) {
|
||||
if (!@unlink($target_file)) {
|
||||
$error_count++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// 6. Копируем
|
||||
if (!@copy($source_file, $target_file)) {
|
||||
$error_count++;
|
||||
}
|
||||
}
|
||||
|
||||
// 7. ОЧИСТКА БАЗЫ ДАННЫХ
|
||||
if ($error_count === 0)
|
||||
{
|
||||
// Используем константу PREFIX для определения префикса таблиц
|
||||
$AVE_DB->query("DELETE FROM `" . PREFIX . "_request`");
|
||||
$AVE_DB->query("DELETE FROM `" . PREFIX . "_request_conditions`");
|
||||
}
|
||||
|
||||
// 8. Возвращаем результат
|
||||
return ($error_count === 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Метод отображения дополнительных настроек
|
||||
*
|
||||
*/
|
||||
@@ -71,11 +142,19 @@
|
||||
if (isset($_REQUEST['more']))
|
||||
{
|
||||
$set = '<?php' . "\r\n\r\n";
|
||||
|
||||
$request_use_version_value = '0';
|
||||
|
||||
foreach($_REQUEST['GLOB'] as $key => $type)
|
||||
{
|
||||
foreach($type as $k => $v)
|
||||
{
|
||||
// ИЗВЛЕКАЕМ ЗНАЧЕНИЕ ДЛЯ ПЕРЕКЛЮЧЕНИЯ ФАЙЛОВ
|
||||
// Сохраняем значение переменной из формы до ее преобразования.
|
||||
if ($k == 'REQUEST_USE_VERSION') {
|
||||
$request_use_version_value = $v;
|
||||
}
|
||||
|
||||
switch ($GLOBALS['CMS_CONFIG'][$key][$k]['TYPE'])
|
||||
{
|
||||
case 'bool' :
|
||||
@@ -108,8 +187,18 @@
|
||||
|
||||
$result = file_put_contents(BASE_DIR . '/config/config.inc.php', $set);
|
||||
|
||||
if ($result > 0)
|
||||
if ($result > 0)
|
||||
{
|
||||
$new_query_setting = (bool)$request_use_version_value;
|
||||
|
||||
// Вызываем функцию и сохраняем результат
|
||||
$switch_success = $this->_switchQueryFiles($new_query_setting);
|
||||
|
||||
// Если переключение не удалось, записываем это в лог (но показываем пользователю успех)
|
||||
if (!$switch_success) {
|
||||
reportLog('ВНИМАНИЕ: Конфигурация сохранена, но переключение файлов при вызове AJAX не удалось (возможна блокировка файла).');
|
||||
}
|
||||
|
||||
$message = $AVE_Template->get_config_vars('SETTINGS_SAVED');
|
||||
$header = $AVE_Template->get_config_vars('SETTINGS_SUCCESS');
|
||||
$theme = 'accept';
|
||||
@@ -117,6 +206,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
// ... (если не удалось записать config.inc.php)
|
||||
$message = $AVE_Template->get_config_vars('SETTINGS_SAVED_ERR');
|
||||
$header = $AVE_Template->get_config_vars('SETTINGS_ERROR');
|
||||
$theme = 'error';
|
||||
|
@@ -484,6 +484,14 @@
|
||||
|
||||
/* ======================================================================================================== */
|
||||
|
||||
//-- Использовать по умолчанию запросы из AVE.CMS ver 2.09RC1
|
||||
$GLOBALS['CMS_CONFIG']['_CONST_REQUEST']['REQUEST_USE_VERSION'] = [
|
||||
'DESCR' => 'Использовать безопасные запросы из ver 2.09RC1 <br>(Если выбрать \'Нет\', то будут использоваться оригинальные запросы)',
|
||||
'DEFAULT' => true,
|
||||
'TYPE' => 'bool',
|
||||
'VARIANT' => ''
|
||||
];
|
||||
|
||||
//-- Окончание в полях запроса
|
||||
$GLOBALS['CMS_CONFIG']['_CONST_REQUEST']['REQUEST_ETC'] = [
|
||||
'DESCR' => 'Окончание в полях запроса',
|
||||
|
105
inc/query_variants/original_files/admin/request.php
Normal file
105
inc/query_variants/original_files/admin/request.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
|
||||
if (!defined('ACP'))
|
||||
{
|
||||
header('Location:index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
require(BASE_DIR . "/class/class.request.php");
|
||||
require(BASE_DIR . "/class/class.docs.php");
|
||||
require(BASE_DIR . "/class/class.rubs.php");
|
||||
|
||||
$AVE_Request = new AVE_Request;
|
||||
$AVE_Document = new AVE_Document;
|
||||
$AVE_Rubric = new AVE_Rubric;
|
||||
|
||||
$AVE_Rubric->rubricPermissionFetch();
|
||||
|
||||
$AVE_Template->config_load(BASE_DIR . "/admin/lang/" . $_SESSION['admin_language'] . "/request.txt", 'request');
|
||||
|
||||
switch ($_REQUEST['action'])
|
||||
{
|
||||
case '':
|
||||
if(check_permission_acp('request_view'))
|
||||
{
|
||||
$AVE_Rubric->rubricTemplateShow(0, 1);
|
||||
$AVE_Request->requestListShow();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
if(check_permission_acp('request_edit'))
|
||||
{
|
||||
$AVE_Rubric->rubricTemplateShow(0, 1);
|
||||
$AVE_Request->requestEdit($_REQUEST['Id']);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'copy':
|
||||
if(check_permission_acp('request_edit'))
|
||||
{
|
||||
$AVE_Request->requestCopy((int)$_REQUEST['Id']);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'new':
|
||||
if(check_permission_acp('request_edit'))
|
||||
{
|
||||
$AVE_Rubric->rubricTemplateShow(0, 1);
|
||||
$AVE_Request->requestNew();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete_query':
|
||||
if(check_permission_acp('request_edit'))
|
||||
{
|
||||
$AVE_Request->requestDelete((int)$_REQUEST['Id']);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'conditions':
|
||||
if(check_permission_acp('request_edit'))
|
||||
{
|
||||
$AVE_Rubric->rubricTemplateShow(0, 1);
|
||||
$AVE_Request->requestConditionEdit((int)$_REQUEST['Id']);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'change':
|
||||
if(check_permission_acp('request_edit'))
|
||||
{
|
||||
switch($_REQUEST['sub'])
|
||||
{
|
||||
case '':
|
||||
$AVE_Rubric->rubricTemplateShow(0, 1);
|
||||
$AVE_Request->conditionFieldChange((int)$_REQUEST['field_id'], (int)$_REQUEST['cond_id']);
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
$AVE_Rubric->rubricTemplateShow(0, 1);
|
||||
$AVE_Request->conditionFieldChangeSave((int)$_REQUEST['field_id'], (int)$_REQUEST['cond_id']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'alias':
|
||||
if (check_permission_acp('request_edit'))
|
||||
{
|
||||
echo $AVE_Request->requestValidate($_REQUEST['alias'], (int)$_REQUEST['id']);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
?>
|
@@ -0,0 +1,39 @@
|
||||
{if $smarty.request.sub == ''}
|
||||
<div id="req_cond_{$cond_id}" stye="text-align: left;">
|
||||
<select class="mousetrap" name="conditions[{$cond_id}][condition_field_id]" id="form_cond_{$cond_id}">
|
||||
{foreach from=$fields_list item=field_group}
|
||||
|
||||
{if $groups_count > 1}
|
||||
<optgroup label="{if $field_group.group_title}{$field_group.group_title}{else}{#REQUEST_FIELD_G_UNKNOW#}{/if}">
|
||||
{/if}
|
||||
|
||||
{foreach from=$field_group.fields item=field}
|
||||
<option value="{$field.Id|escape}" {if $field_id ==$field.Id}selected{/if}>{$field.rubric_field_title|escape} (ID: {$field.Id|escape})</option>
|
||||
{/foreach}
|
||||
|
||||
{if $groups_count > 1}
|
||||
</optgroup>
|
||||
{/if}
|
||||
|
||||
{/foreach}
|
||||
</select>
|
||||
|
||||
<input type="submit" class="basicBtn SaveChange" data-id="{$cond_id}" data-field="{$field_id}" value="Ok">
|
||||
<script>
|
||||
AveAdmin.ajax();
|
||||
</script>
|
||||
</div>
|
||||
{else}
|
||||
{foreach from=$fields_list item=field_group}
|
||||
|
||||
{foreach from=$field_group.fields item=field}
|
||||
{if $field_id == $field.Id}
|
||||
<div id="req_cond_{$cond_id}">
|
||||
<a href="javascript:void(0);" class="link change_field" data-id="{$field.Id|escape}" data-cond="{$cond_id}">{$field.rubric_field_title|escape} (ID: {$field.Id|escape})</a>
|
||||
<input type="hidden" name="conditions[{$cond_id}][condition_field_id]" value="{$field.Id|escape}" />
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
|
||||
{/foreach}
|
||||
{/if}
|
@@ -0,0 +1,127 @@
|
||||
<div id="conditions">
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic" id="conditions">
|
||||
<col width="30">
|
||||
<col width="30">
|
||||
<col width="300">
|
||||
<col width="300">
|
||||
<col width="80">
|
||||
<col width="">
|
||||
<col width="30">
|
||||
<col>
|
||||
<thead>
|
||||
<tr>
|
||||
<td width="1"><div align="center"><span class="icon_sprite ico_move"></span></div></td>
|
||||
<td width="1"><div align="center"><span class="icon_sprite ico_ok"></span></div></td>
|
||||
<td>{#REQUEST_FROM_FILED#}</td>
|
||||
<td>{#REQUEST_OPERATOR#}</td>
|
||||
<td>{#REQUEST_CONDITION_JOIN#}</td>
|
||||
<td>{#REQUEST_VALUE#}</td>
|
||||
<td width="1"><div align="center"><span class="icon_sprite ico_delete"></span></div></td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
{if $conditions}
|
||||
<tbody>
|
||||
{foreach name=cond from=$conditions item=condition}
|
||||
<tr class="cond_tr" data-id="cond_{$condition->Id}">
|
||||
<td><span class="icon_sprite ico_move" style="cursor: move;"></span></td>
|
||||
<td><input name="conditions[{$condition->Id}][condition_status]" type="checkbox" id="condition_status{$condition->Id}" value="1" {if $condition->condition_status ==1}checked{/if} class="toprightDir float" /></td>
|
||||
|
||||
<td align="center">
|
||||
{foreach from=$fields_list item=field_group}
|
||||
|
||||
{foreach from=$field_group.fields item=field}
|
||||
{if $condition->condition_field_id == $field.Id}
|
||||
<div id="req_cond_{$condition->Id}">
|
||||
<a href="javascript:void(0);" class="link change_field" data-id="{$field.Id|escape}" data-cond="{$condition->Id}">{$field.rubric_field_title|escape} (ID: {$field.Id|escape})</a>
|
||||
<input type="hidden" name="conditions[{$condition->Id}][condition_field_id]" value="{$field.Id|escape}" />
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
|
||||
{/foreach}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<select style="max-height: 100px;" name="conditions[{$condition->Id}][condition_compare]" id="operator_{$condition->Id}">
|
||||
<option value="==" {if $condition->condition_compare=='=='}selected{/if}>{#REQUEST_COND_SELF#}</option>
|
||||
<option value="!=" {if $condition->condition_compare=='!='}selected{/if}>{#REQUEST_COND_NOSELF#}</option>
|
||||
<option value="%%" {if $condition->condition_compare=='%%'}selected{/if}>{#REQUEST_COND_USE#}</option>
|
||||
<option value="--" {if $condition->condition_compare=='--'}selected{/if}>{#REQUEST_COND_NOTUSE#}</option>
|
||||
<option value="%" {if $condition->condition_compare=='%'}selected{/if}>{#REQUEST_COND_START#}</option>
|
||||
<option value="<=" {if $condition->condition_compare=='<='}selected{/if}>{#REQUEST_SMALL1#}</option>
|
||||
<option value=">=" {if $condition->condition_compare=='>='}selected{/if}>{#REQUEST_BIG1#}</option>
|
||||
<option value="<" {if $condition->condition_compare=='<'}selected{/if}>{#REQUEST_SMALL2#}</option>
|
||||
<option value=">" {if $condition->condition_compare=='>'}selected{/if}>{#REQUEST_BIG2#}</option>
|
||||
|
||||
<option value="N==" {if $condition->condition_compare=='N=='}selected{/if}>{#REQUEST_N_COND_SELF#}</option>
|
||||
<option value="N<=" {if $condition->condition_compare=='N<='}selected{/if}>{#REQUEST_N_SMALL1#}</option>
|
||||
<option value="N>=" {if $condition->condition_compare=='N>='}selected{/if}>{#REQUEST_N_BIG1#}</option>
|
||||
<option value="N<" {if $condition->condition_compare=='N<'}selected{/if}>{#REQUEST_N_SMALL2#}</option>
|
||||
<option value="N>" {if $condition->condition_compare=='N>'}selected{/if}>{#REQUEST_N_BIG2#}</option>
|
||||
|
||||
<option value="SEGMENT" {if $condition->condition_compare=='SEGMENT'}selected{/if}>{#REQUEST_SEGMENT#}</option>
|
||||
<option value="INTERVAL" {if $condition->condition_compare=='INTERVAL'}selected{/if}>{#REQUEST_INTERVAL#}</option>
|
||||
|
||||
<option value="IN=" {if $condition->condition_compare=='IN='}selected{/if}>{#REQUEST_IN#}</option>
|
||||
<option value="NOTIN=" {if $condition->condition_compare=='NOTIN='}selected{/if}>{#REQUEST_NOTIN#}</option>
|
||||
|
||||
<option value="ANY" {if $condition->condition_compare=='ANY'}selected{/if}>{#REQUEST_ANY_NUM#}</option>
|
||||
<option value="FRE" {if $condition->condition_compare=='FRE'}selected{/if}>{#REQUEST_FREE#}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<select style="width:60px" name="conditions[{$condition->Id}][condition_join]">
|
||||
<option value="AND" {if $condition->condition_join=='AND'}selected{/if}>{#REQUEST_CONR_AND#}</option>
|
||||
<option value="OR" {if $condition->condition_join=='OR'}selected{/if}>{#REQUEST_CONR_OR#}</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><div class="pr12"><input name="conditions[{$condition->Id}][condition_value]" type="text" id="Wert_{$condition->Id}" value="{$condition->condition_value|escape}" class="mousetrap" /> </div></td>
|
||||
<td><input title="{#REQUEST_MARK_DELETE#}" name="del[{$condition->Id}]" type="checkbox" id="del_{$condition->Id}" value="1" class="topleftDir float" /></td>
|
||||
</tr>
|
||||
|
||||
{/foreach}
|
||||
</tbody>
|
||||
{else}
|
||||
<tr class="noborder">
|
||||
<td colspan="7">
|
||||
<ul class="messages">
|
||||
<li class="highlight yellow">{#REQUEST_COND_MESSAGE#}</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
</table>
|
||||
|
||||
{if $conditions}
|
||||
<div class="rowElem"<div class="rowElem"{if !$smarty.request.pop} id="saveBtn"{/if}>
|
||||
<div{if !$smarty.request.pop} class="saveBtn"{/if}>
|
||||
<input type="submit" value="{#REQUEST_BUTTON_SAVE#}" class="basicBtn" />
|
||||
{#REQUEST_OR#}
|
||||
<input type="submit" value="{#REQUEST_BUTTON_SAVE_NEXT#}" class="button blackBtn SaveEditCond" />
|
||||
{if $smarty.request.pop}
|
||||
<input onclick="javascript:void(0);" type="button" class="redBtn Close" value="{#REQUEST_BUTTON_CLOSE#}" />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{if $conditions}
|
||||
<script language="javascript">
|
||||
$(document).ready(function(){ldelim}
|
||||
AveAdmin.ajax();
|
||||
|
||||
$('#conditions').tableSortable({ldelim}
|
||||
items: '.cond_tr',
|
||||
url: 'index.php?do=request&action=conditions&sub=sort&rubric_id={$smarty.request.rubric_id|escape}&Id={$smarty.request.Id|escape}&cp={$sess}',
|
||||
success: true
|
||||
{rdelim});
|
||||
|
||||
$.alerts._overlay('hide');
|
||||
|
||||
{rdelim});
|
||||
</script>
|
||||
{/if}
|
@@ -0,0 +1,421 @@
|
||||
<script language="Javascript" type="text/javascript">
|
||||
var sess = '{$sess}';
|
||||
</script>
|
||||
|
||||
<div class="title {if $smarty.request.pop}first{/if}">
|
||||
<h5>{#REQUEST_CONDITIONS#}</h5>
|
||||
</div>
|
||||
|
||||
<div class="widget" style="margin-top: 0px;">
|
||||
<div class="body">
|
||||
{#REQUEST_CONDITION_TIP#}
|
||||
</div>
|
||||
</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=request&cp={$sess}">{#REQUEST_ALL#}</a></li>
|
||||
<li>{#REQUEST_CONDITIONS#}</li>
|
||||
<li><strong class="code">{$request_title|escape|stripslashes}</strong></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form class="mainForm" action="index.php?do=request&action=conditions&sub=new&rubric_id={$smarty.request.rubric_id|escape}&Id={$smarty.request.Id|escape}&cp={$sess}" method="post" id="NewCond">
|
||||
|
||||
<div class="widget first">
|
||||
|
||||
<div class="head" id="opened">
|
||||
<h5 class="iFrames">{#REQUEST_NEW_CONDITION#}</h5>
|
||||
</div>
|
||||
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
|
||||
<col width="150">
|
||||
<col width="300">
|
||||
<col width="80">
|
||||
<col width="">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>{#REQUEST_FROM_FILED#}</td>
|
||||
<td>{#REQUEST_OPERATOR#}</td>
|
||||
<td>{#REQUEST_CONDITION_JOIN#}</td>
|
||||
<td>{#REQUEST_VALUE#}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<select name="field_new" id="field_new" style="width:300px; max-height:80px;">
|
||||
|
||||
<option> </option>
|
||||
{foreach from=$fields_list item=field_group}
|
||||
|
||||
{if $groups_count > 1}
|
||||
<optgroup label="{if $field_group.group_title}{$field_group.group_title}{else}{#REQUEST_FIELD_G_UNKNOW#}{/if}">
|
||||
{/if}
|
||||
|
||||
{foreach from=$field_group.fields item=field}
|
||||
<option value="{$field.Id|escape}">{$field.rubric_field_title|escape} (ID: {$field.Id|escape})</option>
|
||||
{/foreach}
|
||||
|
||||
{if $groups_count > 1}
|
||||
</optgroup>
|
||||
{/if}
|
||||
|
||||
{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<select style="max-height: 80px;" name="new_operator" id="new_operator">
|
||||
<option value="==" selected>{#REQUEST_COND_SELF#}</option>
|
||||
<option value="!=">{#REQUEST_COND_NOSELF#}</option>
|
||||
<option value="%%">{#REQUEST_COND_USE#}</option>
|
||||
<option value="--">{#REQUEST_COND_NOTUSE#}</option>
|
||||
<option value="%">{#REQUEST_COND_START#}</option>
|
||||
<option value="<=">{#REQUEST_SMALL1#}</option>
|
||||
<option value=">=">{#REQUEST_BIG1#}</option>
|
||||
<option value="<">{#REQUEST_SMALL2#}</option>
|
||||
<option value=">">{#REQUEST_BIG2#}</option>
|
||||
|
||||
<option value="N==">{#REQUEST_N_COND_SELF#}</option>
|
||||
<option value="N<=">{#REQUEST_N_SMALL1#}</option>
|
||||
<option value="N>=">{#REQUEST_N_BIG1#}</option>
|
||||
<option value="N<">{#REQUEST_N_SMALL2#}</option>
|
||||
<option value="N>">{#REQUEST_N_BIG2#}</option>
|
||||
|
||||
<option value="SEGMENT">{#REQUEST_SEGMENT#}</option>
|
||||
<option value="INTERVAL">{#REQUEST_INTERVAL#}</option>
|
||||
|
||||
<option value="IN=">{#REQUEST_IN#}</option>
|
||||
<option value="NOTIN=">{#REQUEST_NOTIN#}</option>
|
||||
|
||||
<option value="ANY">{#REQUEST_ANY_NUM#}</option>
|
||||
<option value="FRE">{#REQUEST_FREE#}</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td style="width:60px; max-height: 100px;">
|
||||
<select style="width:60px" name="oper_new" id="oper_new">
|
||||
<option value="AND" {if $condition->condition_join=='AND'}selected{/if}>{#REQUEST_CONR_AND#}</option>
|
||||
<option value="OR" {if $condition->condition_join=='OR'}selected{/if}>{#REQUEST_CONR_OR#}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<div class="pr12"><input name="new_value" type="text" id="new_value" value="" /></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<input type="submit" value="{#REQUEST_CONDITION_ADD#}" class="basicBtn AddNewCond" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="fix"></div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form class="mainForm" action="index.php?do=request&action=conditions&sub=save&rubric_id={$smarty.request.rubric_id|escape}&Id={$smarty.request.Id|escape}&cp={$sess}" method="post" id="CondList">
|
||||
<div class="widget first">
|
||||
<div class="head"><h5 class="iFrames">{#REQUEST_CONDITION#}</h5>
|
||||
{if !$smarty.request.pop}
|
||||
<div class="num">
|
||||
<a class="basicNum" href="index.php?do=request&action=edit&Id={$smarty.request.Id|escape}&rubric_id={$smarty.request.rubric_id|escape}&cp={$sess}">{#REQUEST_EDIT#}</a>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div id="conditions">
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
|
||||
<col width="30">
|
||||
<col width="30">
|
||||
<col width="300">
|
||||
<col width="300">
|
||||
<col width="80">
|
||||
<col width="auto">
|
||||
<col width="30">
|
||||
<col>
|
||||
<thead>
|
||||
<tr>
|
||||
<td width="1"><div align="center"><span class="icon_sprite ico_move"></span></div></td>
|
||||
<td width="1"><div align="center"><span class="icon_sprite ico_ok"></span></div></td>
|
||||
<td>{#REQUEST_FROM_FILED#}</td>
|
||||
<td>{#REQUEST_OPERATOR#}</td>
|
||||
<td>{#REQUEST_CONDITION_JOIN#}</td>
|
||||
<td>{#REQUEST_VALUE#}</td>
|
||||
<td width="1"><div align="center"><span class="icon_sprite ico_delete"></span></div></td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
{if $conditions}
|
||||
<tbody>
|
||||
{foreach name=cond from=$conditions item=condition}
|
||||
<tr class="cond_tr" data-id="cond_{$condition->Id}">
|
||||
<td><span class="icon_sprite ico_move" style="cursor: move;"></span></td>
|
||||
<td><input name="conditions[{$condition->Id}][condition_status]" type="checkbox" id="condition_status{$condition->Id}" value="1" {if $condition->condition_status ==1}checked{/if} class="toprightDir float" /></td>
|
||||
|
||||
<td align="center">
|
||||
|
||||
{foreach from=$fields_list item=field_group}
|
||||
|
||||
{foreach from=$field_group.fields item=field}
|
||||
{if $condition->condition_field_id == $field.Id}
|
||||
<div id="req_cond_{$condition->Id}">
|
||||
<a href="javascript:void(0);" class="link change_field" data-id="{$field.Id|escape}" data-cond="{$condition->Id}">{$field.rubric_field_title|escape} (ID: {$field.Id|escape})</a>
|
||||
<input type="hidden" name="conditions[{$condition->Id}][condition_field_id]" value="{$field.Id|escape}" />
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
|
||||
{/foreach}
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<select style="max-height: 100px;" name="conditions[{$condition->Id}][condition_compare]" id="operator_{$condition->Id}">
|
||||
<option value="==" {if $condition->condition_compare=='=='}selected{/if}>{#REQUEST_COND_SELF#}</option>
|
||||
<option value="!=" {if $condition->condition_compare=='!='}selected{/if}>{#REQUEST_COND_NOSELF#}</option>
|
||||
<option value="%%" {if $condition->condition_compare=='%%'}selected{/if}>{#REQUEST_COND_USE#}</option>
|
||||
<option value="--" {if $condition->condition_compare=='--'}selected{/if}>{#REQUEST_COND_NOTUSE#}</option>
|
||||
<option value="%" {if $condition->condition_compare=='%'}selected{/if}>{#REQUEST_COND_START#}</option>
|
||||
<option value="<=" {if $condition->condition_compare=='<='}selected{/if}>{#REQUEST_SMALL1#}</option>
|
||||
<option value=">=" {if $condition->condition_compare=='>='}selected{/if}>{#REQUEST_BIG1#}</option>
|
||||
<option value="<" {if $condition->condition_compare=='<'}selected{/if}>{#REQUEST_SMALL2#}</option>
|
||||
<option value=">" {if $condition->condition_compare=='>'}selected{/if}>{#REQUEST_BIG2#}</option>
|
||||
|
||||
<option value="N==" {if $condition->condition_compare=='N=='}selected{/if}>{#REQUEST_N_COND_SELF#}</option>
|
||||
<option value="N<=" {if $condition->condition_compare=='N<='}selected{/if}>{#REQUEST_N_SMALL1#}</option>
|
||||
<option value="N>=" {if $condition->condition_compare=='N>='}selected{/if}>{#REQUEST_N_BIG1#}</option>
|
||||
<option value="N<" {if $condition->condition_compare=='N<'}selected{/if}>{#REQUEST_N_SMALL2#}</option>
|
||||
<option value="N>" {if $condition->condition_compare=='N>'}selected{/if}>{#REQUEST_N_BIG2#}</option>
|
||||
|
||||
<option value="SEGMENT" {if $condition->condition_compare=='SEGMENT'}selected{/if}>{#REQUEST_SEGMENT#}</option>
|
||||
<option value="INTERVAL" {if $condition->condition_compare=='INTERVAL'}selected{/if}>{#REQUEST_INTERVAL#}</option>
|
||||
|
||||
<option value="IN=" {if $condition->condition_compare=='IN='}selected{/if}>{#REQUEST_IN#}</option>
|
||||
<option value="NOTIN=" {if $condition->condition_compare=='NOTIN='}selected{/if}>{#REQUEST_NOTIN#}</option>
|
||||
|
||||
<option value="ANY" {if $condition->condition_compare=='ANY'}selected{/if}>{#REQUEST_ANY_NUM#}</option>
|
||||
<option value="FRE" {if $condition->condition_compare=='FRE'}selected{/if}>{#REQUEST_FREE#}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<select style="width:60px" name="conditions[{$condition->Id}][condition_join]">
|
||||
<option value="AND" {if $condition->condition_join=='AND'}selected{/if}>{#REQUEST_CONR_AND#}</option>
|
||||
<option value="OR" {if $condition->condition_join=='OR'}selected{/if}>{#REQUEST_CONR_OR#}</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><div class="pr12"><input name="conditions[{$condition->Id}][condition_value]" type="text" id="Wert_{$condition->Id}" value="{$condition->condition_value|escape}" class="mousetrap" /> </div></td>
|
||||
<td><input title="{#REQUEST_MARK_DELETE#}" name="del[{$condition->Id}]" type="checkbox" id="del_{$condition->Id}" value="1" class="topleftDir float" /></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
{else}
|
||||
<tr class="noborder">
|
||||
<td colspan="7">
|
||||
<ul class="messages">
|
||||
<li class="highlight yellow">{#REQUEST_COND_MESSAGE#}</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
</table>
|
||||
{if $conditions}
|
||||
<div class="rowElem"{if !$smarty.request.pop} id="saveBtn"{/if}>
|
||||
<div{if !$smarty.request.pop} class="saveBtn"{/if}>
|
||||
<input type="submit" value="{#REQUEST_BUTTON_SAVE#}" class="basicBtn" />
|
||||
{#REQUEST_OR#}
|
||||
<input type="submit" value="{#REQUEST_BUTTON_SAVE_NEXT#}" class="button blackBtn SaveEditCond" />
|
||||
{if $smarty.request.pop}
|
||||
<input onclick="javascript:void(0);" type="button" class="redBtn Close" value="{#REQUEST_BUTTON_CLOSE#}" />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="fix"></div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<script type="text/javascript" language="JavaScript">
|
||||
$(document).ready(function(){ldelim}
|
||||
|
||||
{if check_permission('request_edit')}
|
||||
|
||||
{if $smarty.request.onlycontent}
|
||||
AveAdmin.ajax();
|
||||
{/if}
|
||||
|
||||
// сортировка
|
||||
$('#conditions').tableSortable({ldelim}
|
||||
items: '.cond_tr',
|
||||
url: 'index.php?do=request&action=conditions&sub=sort&rubric_id={$smarty.request.rubric_id|escape}&Id={$smarty.request.Id|escape}&cp={$sess}',
|
||||
success: true
|
||||
{rdelim});
|
||||
|
||||
Mousetrap.bind(['ctrl+s', 'command+s'], function(event) {ldelim}
|
||||
event.preventDefault();
|
||||
$("#CondList").ajaxSubmit({ldelim}
|
||||
url: 'index.php?do=request&action=conditions&sub=save&rubric_id={$smarty.request.rubric_id|escape}&Id={$smarty.request.Id|escape}&cp={$sess}&ajax=1{if $smarty.request.pop}&pop=1{/if}',
|
||||
dataType: 'json',
|
||||
beforeSubmit: function(){ldelim}
|
||||
$.alerts._overlay('show');
|
||||
{rdelim},
|
||||
success: function(data){ldelim}
|
||||
$.jGrowl(data['message'], {ldelim}
|
||||
header: data['header'],
|
||||
theme: data['theme']
|
||||
{rdelim});
|
||||
ajaxConditions();
|
||||
{rdelim}
|
||||
{rdelim});
|
||||
return false;
|
||||
{rdelim});
|
||||
|
||||
$(".AddNewCond").on('click', function(event){ldelim}
|
||||
event.preventDefault();
|
||||
$("#NewCond").ajaxSubmit({ldelim}
|
||||
url: 'index.php?do=request&action=conditions&sub=new&rubric_id={$smarty.request.rubric_id|escape}&Id={$smarty.request.Id|escape}&cp={$sess}&ajax=1{if $smarty.request.pop}&pop=1{/if}',
|
||||
dataType: 'json',
|
||||
beforeSubmit: function(){ldelim}
|
||||
$.alerts._overlay('show');
|
||||
{rdelim},
|
||||
success: function(data){ldelim}
|
||||
if (data['theme'] == 'accept'){ldelim}
|
||||
resetForms();
|
||||
ajaxConditions();
|
||||
{rdelim}
|
||||
else
|
||||
{ldelim}
|
||||
$.alerts._overlay('hide');
|
||||
{rdelim}
|
||||
$.jGrowl(data['message'], {ldelim}
|
||||
header: data['header'],
|
||||
theme: data['theme']
|
||||
{rdelim});
|
||||
{rdelim}
|
||||
{rdelim});
|
||||
return false;
|
||||
{rdelim});
|
||||
|
||||
function ajaxConditions(){ldelim}
|
||||
$.ajax({ldelim}
|
||||
url: 'index.php?do=request&action=conditions&rubric_id={$smarty.request.rubric_id|escape}&Id={$smarty.request.Id|escape}&cp={$sess}&ajax=1&onlycontent=1{if $smarty.request.pop}&pop=1{/if}',
|
||||
type: 'POST',
|
||||
beforeSend: function () {ldelim}
|
||||
{rdelim},
|
||||
success: function (data) {ldelim}
|
||||
$("#conditions").before(data).remove();
|
||||
SaveEditCond();
|
||||
{rdelim}
|
||||
{rdelim});
|
||||
{rdelim}
|
||||
|
||||
function SaveEditCond(){ldelim}
|
||||
$(".SaveEditCond").on('click', function(event){ldelim}
|
||||
event.preventDefault();
|
||||
$("#CondList").ajaxSubmit({ldelim}
|
||||
url: 'index.php?do=request&action=conditions&sub=save&rubric_id={$smarty.request.rubric_id|escape}&Id={$smarty.request.Id|escape}&cp={$sess}&ajax=1{if $smarty.request.pop}&pop=1{/if}',
|
||||
dataType: 'json',
|
||||
beforeSubmit: function(){ldelim}
|
||||
$.alerts._overlay('show');
|
||||
{rdelim},
|
||||
success: function(data){ldelim}
|
||||
$.jGrowl(data['message'], {ldelim}
|
||||
header: data['header'],
|
||||
theme: data['theme']
|
||||
{rdelim});
|
||||
ajaxConditions();
|
||||
{rdelim}
|
||||
{rdelim});
|
||||
return false;
|
||||
{rdelim});
|
||||
{rdelim};
|
||||
|
||||
$(document).on('click', '.Close', function(event){ldelim}
|
||||
event.preventDefault();
|
||||
$('#ajax-dialog-conditions-{$smarty.request.Id|escape}').dialog('destroy').remove();
|
||||
return false;
|
||||
{rdelim});
|
||||
|
||||
function resetForms(){ldelim}
|
||||
$('#NewCond select').prop('selectedIndex',0);
|
||||
$('#NewCond select').trigger('refresh');
|
||||
$('#NewCond input[type=text]').val('');
|
||||
{rdelim}
|
||||
|
||||
$(document).on('click', '.change_field', function(event)
|
||||
{ldelim}
|
||||
event.preventDefault();
|
||||
|
||||
var field_id = $(this).attr('data-id');
|
||||
var cond_id = $(this).attr('data-cond');
|
||||
|
||||
$.ajax({ldelim}
|
||||
url: 'index.php?do=request&action=change&sub=&cp=' + sess + '&onlycontent=1',
|
||||
data: {ldelim}
|
||||
req_id: {$smarty.request.Id},
|
||||
cond_id: cond_id,
|
||||
field_id: field_id,
|
||||
rubric_id: {$smarty.request.rubric_id}
|
||||
{rdelim},
|
||||
type: 'POST',
|
||||
beforeSend: function(){ldelim}
|
||||
$.alerts._overlay('show');
|
||||
{rdelim},
|
||||
success: function (data)
|
||||
{ldelim}
|
||||
$("#req_cond_" + cond_id).before(data).remove();
|
||||
$.alerts._overlay('hide');
|
||||
{rdelim}
|
||||
{rdelim});
|
||||
|
||||
return false;
|
||||
{rdelim});
|
||||
|
||||
|
||||
$(document).on('click', '.SaveChange', function(event)
|
||||
{ldelim}
|
||||
event.preventDefault();
|
||||
|
||||
var cond_id = $(this).attr('data-id');
|
||||
var data = $('#form_cond_' + cond_id).val();
|
||||
|
||||
$.ajax({ldelim}
|
||||
url: 'index.php?do=request&action=change&sub=save&cp=' + sess + '&onlycontent=1',
|
||||
data: {ldelim}
|
||||
req_id: {$smarty.request.Id},
|
||||
cond_id: cond_id,
|
||||
field_id: data,
|
||||
rubric_id: {$smarty.request.rubric_id}
|
||||
{rdelim},
|
||||
type: 'POST',
|
||||
beforeSend: function(){ldelim}
|
||||
$.alerts._overlay('show');
|
||||
{rdelim},
|
||||
success: function (data)
|
||||
{ldelim}
|
||||
$("#req_cond_" + cond_id).before(data).remove();
|
||||
$.alerts._overlay('hide');
|
||||
{rdelim}
|
||||
{rdelim});
|
||||
|
||||
return false;
|
||||
{rdelim});
|
||||
|
||||
|
||||
SaveEditCond();
|
||||
|
||||
{/if}
|
||||
|
||||
{rdelim});
|
||||
</script>
|
@@ -0,0 +1,748 @@
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
/*<![CDATA[*/
|
||||
|
||||
$rid = parseInt('{$rid}');
|
||||
$sess = '{$sess}';
|
||||
|
||||
var clipboard = new Clipboard('.copyBtn');
|
||||
|
||||
function changeRub(select) {ldelim}
|
||||
if(select.options[select.selectedIndex].value!='#') {ldelim}
|
||||
|
||||
if(select.options[select.selectedIndex].value!='#') {ldelim}
|
||||
{if $smarty.request.action=='new'}
|
||||
location.href='index.php?do=request&action=new&rubric_id=' + select.options[select.selectedIndex].value + '{if $smarty.request.request_title_new!=''}&request_title_new={$smarty.request.request_title_new|escape|stripslashes}{/if}';
|
||||
{else}
|
||||
location.href='index.php?do=request&action=edit&Id={$rid}&rubric_id=' + select.options[select.selectedIndex].value;
|
||||
{/if}
|
||||
{rdelim}
|
||||
|
||||
else {ldelim}
|
||||
document.getElementById('RubrikId_{$smarty.request.rubric_id|escape}').selected = 'selected';
|
||||
{rdelim}
|
||||
{rdelim}
|
||||
{rdelim}
|
||||
/*]]>*/
|
||||
</script>
|
||||
|
||||
{if $smarty.request.action=='edit'}
|
||||
<div class="title">
|
||||
<h5>{#REQUEST_EDIT2#}</h5>
|
||||
<div class="num">
|
||||
<a class="basicNum" href="index.php?do=request&action=conditions&Id={$rid}&rubric_id={$smarty.request.rubric_id|escape}&cp={$sess}">{#REQUEST_CONDITION_EDIT#}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-top: 0px;">
|
||||
<div class="body">{#REQUEST_EDIT_TIP#}</div>
|
||||
</div>
|
||||
{else}
|
||||
<div class="title">
|
||||
<h5>{#REQUEST_NEW#}</h5>
|
||||
</div>
|
||||
<div class="widget" style="margin-top: 0px;">
|
||||
<div class="body">{#REQUEST_NEW_TIP#}</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
<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=request&cp={$sess}">{#REQUEST_ALL#}</a></li>
|
||||
{if $smarty.request.action=='edit'}
|
||||
<li>{#REQUEST_EDIT2#}</li>
|
||||
{else}
|
||||
<li>{#REQUEST_NEW#}</li>
|
||||
{/if}
|
||||
<li><strong class="code">{$smarty.request.request_title_new|stripslashes|default:$row->request_title|escape}</strong></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $errors}
|
||||
<ul class="messages first">
|
||||
{foreach from=$errors item=e}
|
||||
<li class="highlight red mb10">
|
||||
{assign var=message value=$e}
|
||||
• {$message}<br />
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
{if !check_permission('request_php')}
|
||||
<ul class="messages first">
|
||||
<li class="highlight red aligncenter">
|
||||
{#REQUEST_REPORT_ERR_PHP#}
|
||||
</li>
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
|
||||
{if $smarty.request.Id == ''}
|
||||
{assign var=iframe value='no'}
|
||||
{/if}
|
||||
|
||||
{if $smarty.request.action == 'new' && $smarty.request.rubric_id == ''}
|
||||
{assign var=dis value='disabled'}
|
||||
{/if}
|
||||
|
||||
{if $smarty.request.action=='new' && $smarty.request.rubric_id==''}
|
||||
<ul class="messages first">
|
||||
<li class="highlight red">
|
||||
<strong>{#REQUEST_PLEASE_SELECT#}</strong>
|
||||
</li>
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
<div class="widget first">
|
||||
|
||||
<ul class="tabs">
|
||||
<li class="activeTab">
|
||||
<a href="#tab1">{#REQUEST_SETTINGS#}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#tab2">{#REQUEST_TEMPLATE_QUERY#}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#tab3">{#REQUEST_TEMPLATE_ITEMS#}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<form name="RequestTpl" id="RequestTpl" method="post" action="{$formaction}" class="mainForm">
|
||||
|
||||
<div class="tab_container">
|
||||
|
||||
<div id="tab1" class="tab_content" style="display: block;">
|
||||
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
|
||||
<col width="250">
|
||||
<col>
|
||||
<col width="250">
|
||||
<col>
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="4">{#REQUEST_HEADER_SELF#}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{#REQUEST_NAME2#}</td>
|
||||
<td colspan="3"><input {$dis} class="mousetrap" style="width: 100%" name="request_title" type="text" id="l_Titel" value="{$smarty.request.request_title_new|stripslashes|default:$row->request_title|escape}"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<div class="nowrap">
|
||||
<strong><a class="toprightDir" title="{#REQUEST_I#}">[?]</a></strong> {#REQUEST_ALIAS#}:
|
||||
</div>
|
||||
</td>
|
||||
<td colspan="3">
|
||||
<div class="pr12">
|
||||
<input type="text" name="request_alias" value="{if $smarty.request.Id != ''}{$row->request_alias}{else}{$smarty.request.request_alias}{/if}" id="request_alias" value="" class="mousetrap" data-accept="{#REQUEST_ACCEPT#}" data-error-syn="{#REQUEST_ER_SYN#}" data-error-exists="{#REQUEST_ER_EXISTS#}" placeholder="{#REQUEST_ALIAS#}" maxlength="20" style="width: 200px;" autocomplete="off" />
|
||||
<input type="text" id="request_alias_tag" value="[tag:request:{if $smarty.request.Id != ''}{if $row->request_alias != ''}{$row->request_alias}{else}{$smarty.request.Id}{/if}{else}{$smarty.request.request_alias}{/if}]" readonly size="40" class="mousetrap" style="width: 200px;" />
|
||||
<a style="text-align: center; padding: 5px 3px 4px 3px;" class="whiteBtn copyBtn" href="javascript:void(0);" data-clipboard-action="copy" data-clipboard-target="#request_alias_tag">
|
||||
<img style="margin-top: -3px; position: relative; top: 4px; padding: 0 3px;" class="clippy" src="{$ABS_PATH}admin/templates/images/clippy.svg" width="13">
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{#REQUEST_CACHE#}</td>
|
||||
<td><input {$dis} class="mousetrap" style="width:100px" name="request_cache_lifetime" type="text" id="request_cache_lifetime" value="{$smarty.request.request_cache_lifetime|stripslashes|default:$row->request_cache_lifetime|escape}"></td>
|
||||
<td>{#REQUEST_CACHE_ELEMENTS#}</td>
|
||||
<td><input class="mousetrap float" name="request_cache_elements" type="checkbox" value="1" {if $row->request_cache_elements}checked="checked"{/if}/><label> </label></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{#REQUEST_SELECT_RUBRIK#}</td>
|
||||
<td colspan="3">
|
||||
<select onChange="changeRub(this)" style="width:350px" id="rubric_id" class="mousetrap">
|
||||
{if $smarty.request.action=='new' && $smarty.request.rubric_id==''}
|
||||
<option value="">{#REQUEST_PLEASE_SELECT#}</option>
|
||||
{/if}
|
||||
{foreach from=$rubrics item=rubric}
|
||||
<option id="RubrikId_{$rubric->Id}" value="{$rubric->Id}"{if $smarty.request.rubric_id==$rubric->Id} selected="selected"{/if}>{$rubric->rubric_title|escape}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<input type="hidden" name="rubric_id" value="{$smarty.request.rubric_id}" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{#REQUEST_DESCRIPTION#}<br /><small>{#REQUEST_INTERNAL_INFO#}</small></td>
|
||||
<td colspan="3"><textarea class="mousetrap" {$dis} style="width:350px; height:60px" name="request_description" id="request_description">{if $smarty.request.action=='new' && $smarty.request.request_description !=''}{$smarty.request.request_description|escape}{else}{$row->request_description|escape}{/if}</textarea></td>
|
||||
</tr>
|
||||
|
||||
<tr class="grey">
|
||||
<td>{#REQUEST_CONDITION#}</td>
|
||||
<td colspan="3">
|
||||
{if $iframe == 'no'}
|
||||
<input type="checkbox" name="reedit" value="1" checked="checked" class="float mousetrap" /> <label>{#REQUEST_ACTION_AFTER#}</label>
|
||||
{/if}
|
||||
{if $iframe != 'no'}
|
||||
<a href="index.php?do=request&action=conditions&Id={$smarty.request.Id|escape}&rubric_id={$smarty.request.rubric_id|escape}&cp={$sess}&pop=1" data-modal="true" data-dialog="conditions-{$smarty.request.Id}" data-title="{#REQUEST_CONDITION#}" class="openDialog button basicBtn">{#REQUEST_BUTTON_COND#}</a>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>{#REQUEST_HEADER_NAME#}</td>
|
||||
<td>{#REQUEST_HEADER_PARAMETR#}</td>
|
||||
<td>{#REQUEST_HEADER_NAME#}</td>
|
||||
<td>{#REQUEST_HEADER_PARAMETR#}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{#REQUEST_HIDE_CURRENT#}</td>
|
||||
<td><input class="mousetrap float" name="request_hide_current" type="checkbox" value="1" {if $row->request_hide_current}checked="checked"{/if}/><label> </label></td>
|
||||
|
||||
<td>{#REQUEST_ONLY_OWNER#}</td>
|
||||
<td><input class="mousetrap float" name="request_only_owner" type="checkbox" value="1" {if $row->request_only_owner}checked="checked"{/if}/><label> </label></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{#REQUEST_SORT_BY_NAT#}</td>
|
||||
<td>
|
||||
<select {$dis} style="width: 250px" name="request_order_by_nat" id="request_order_by_nat" class="mousetrap">
|
||||
<option value=""> </option>
|
||||
{foreach from=$fields_list item=field_group}
|
||||
|
||||
{if $groups_count > 1}
|
||||
<optgroup label="{if $field_group.group_title}{$field_group.group_title}{else}{#REQUEST_FIELD_G_UNKNOW#}{/if}">
|
||||
{/if}
|
||||
|
||||
{foreach from=$field_group.fields item=field}
|
||||
<option value="{$field.Id|escape}" {if $row->request_order_by_nat == $field.Id}selected{/if}>{$field.rubric_field_title|escape}</option>
|
||||
{/foreach}
|
||||
|
||||
{if $groups_count > 1}
|
||||
</optgroup>
|
||||
{/if}
|
||||
|
||||
{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td>{#REQUEST_SORT_BY#}</td>
|
||||
<td>
|
||||
<select {$dis} style="width:250px" name="request_order_by" id="request_order_by" class="mousetrap">
|
||||
<option value=""> </option>
|
||||
<option value="Id"{if $row->request_order_by=='Id'} selected="selected"{/if}>Id</option>
|
||||
<option value="document_position"{if $row->request_order_by=='document_position'} selected="selected"{/if}>{#REQUEST_BY_POSITION#}</option>
|
||||
<option value="document_published"{if $row->request_order_by=='document_published'} selected="selected"{/if}>{#REQUEST_BY_DATE#}</option>
|
||||
<option value="document_changed"{if $row->request_order_by=='document_changed'} selected="selected"{/if}>{#REQUEST_BY_DATECHANGE#}</option>
|
||||
<option value="document_title"{if $row->request_order_by=='document_title'} selected="selected"{/if}>{#REQUEST_BY_NAME#}</option>
|
||||
<option value="document_author_id"{if $row->request_order_by=='document_author_id'} selected="selected"{/if}>{#REQUEST_BY_EDIT#}</option>
|
||||
<option value="document_count_print"{if $row->request_order_by=='document_count_print'} selected="selected"{/if}>{#REQUEST_BY_PRINTED#}</option>
|
||||
<option value="document_count_view"{if $row->request_order_by=='document_count_view'} selected="selected"{/if}>{#REQUEST_BY_VIEWS#}</option>
|
||||
<option value="document_parent"{if $row->request_order_by=='document_parent'} selected="selected"{/if}>{#REQUEST_BY_PARENT#}</option>
|
||||
<option value="RAND()"{if $row->request_order_by=='RAND()'} selected="selected"{/if}>{#REQUEST_BY_RAND#}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{#REQUEST_ASC_DESC#}</td>
|
||||
<td>
|
||||
<select {$dis} style="width:150px" name="request_asc_desc" id="request_asc_desc" class="mousetrap">
|
||||
<option value="DESC"{if $row->request_asc_desc=='DESC'} selected="selected"{/if}>{#REQUEST_DESC#}</option>
|
||||
<option value="ASC"{if $row->request_asc_desc=='ASC'} selected="selected"{/if}>{#REQUEST_ASC#}</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td>{#REQUEST_DOC_PER_PAGE#}</td>
|
||||
<td>
|
||||
<select {$dis} style="width:150px" name="request_items_per_page" id="request_items_per_page" class="mousetrap">
|
||||
<option value="0" {if $row->request_items_per_page=='all'} selected="selected"{/if}>{#REQUEST_DOC_PER_PAGE_ALL#}</option>
|
||||
{section name=items loop=300 step=1 start=0}
|
||||
<option value="{$smarty.section.items.index+1}"{if $row->request_items_per_page==$smarty.section.items.index+1} selected="selected"{/if}>{$smarty.section.items.index+1}</option>
|
||||
{/section}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="4">{#REQUEST_PAGINATION#}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{#REQUEST_SHOW_NAVI#}</td>
|
||||
<td><input class="mousetrap float" name="request_show_pagination" type="checkbox" id="request_show_pagination" value="1"{if $row->request_show_pagination=='1'} checked="checked"{/if} /><label> </label></td>
|
||||
|
||||
<td>{#REQUEST_NAVI_TPL#}</td>
|
||||
<td>
|
||||
<select style="width:350px" id="request_pagination" name="request_pagination" class="mousetrap">
|
||||
{foreach from=$paginations item=pagination}
|
||||
<option value="{$pagination->id}"{if $row->request_pagination == $pagination->id} selected="selected"{/if}>{$pagination->pagination_name|escape}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{#REQUEST_COUNT_ITEMS#}</td>
|
||||
<td><input class="mousetrap float" name="request_count_items" type="checkbox" id="request_count_items" value="1"{if $row->request_count_items == '1'} checked="checked"{/if} /><label> </label></td>
|
||||
<td>{#REQUEST_USE_QUERY#}</td>
|
||||
<td><input class="mousetrap float" name="request_use_query" type="checkbox" id="request_use_query" value="1"{if $row->request_use_query == '1'} checked="checked"{/if} /><label> </label></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="4">{#REQUEST_OTHER#}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{#REQUEST_USE_LANG#}</td>
|
||||
<td colspan="3"><input class="mousetrap float" name="request_lang" type="checkbox" id="request_lang" value="1"{if $row->request_lang == '1'} checked="checked"{/if} /><label> </label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{#REQUEST_SHOW_STAT#}</td>
|
||||
<td><input class="mousetrap float" name="request_show_statistic" type="checkbox" id="request_show_statistic" value="1"{if $row->request_show_statistic == '1'} checked="checked"{/if} /><label> </label></td>
|
||||
<td>{#REQUEST_SHOW_SQL#}</td>
|
||||
<td><input class="mousetrap float" name="request_show_sql" type="checkbox" id="request_show_sql" value="1"{if $row->request_show_sql == '1'} checked="checked"{/if} /><label> </label></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="4">{#REQUEST_HEADER_EXTERNAL#}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{#REQUEST_EXTERNAL#}</td>
|
||||
<td><input class="mousetrap float" name="request_external" type="checkbox" id="request_external" value="1"{if $row->request_external == '1'} checked="checked"{/if} /><label> </label></td>
|
||||
<td>{#REQUEST_ONLY_AJAX#}</td>
|
||||
<td><input class="mousetrap float" name="request_ajax" type="checkbox" id="request_ajax" value="1"{if $row->request_ajax == '1'} checked="checked"{/if} /><label> </label></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
<div class="fix"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="tab2" class="tab_content" style="display: none;">
|
||||
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
|
||||
<col width="230">
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_MAIN_CONTENT#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:content]', '');">[tag:content]</a></strong></td>
|
||||
<td rowspan="19">
|
||||
<textarea {$dis} name="request_template_main" id="request_template_main" wrap="off" style="width:100%; height:500px">{$row->request_template_main|escape|default:''}</textarea>
|
||||
<ul class="messages" style="margin-top: 10px;">
|
||||
<li class="highlight grey">
|
||||
{#MAIN_CODEMIRROR_HELP#}
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_MAIN_NAVI#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:pages]', '');">[tag:pages]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_PAGES_CURENT#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:pages:curent]', '');">[tag:pages:curent]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_PAGES_TOTAL#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:pages:total]', '');">[tag:pages:total]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_CDOCID_TITLE#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:pagetitle]', '');">[tag:pagetitle]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOC_COUNT#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:doctotal]', '');">[tag:doctotal]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOC_ON_PAGE#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:doconpage]', '');">[tag:doconpage]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a class="rightDir" title="{#REQUEST_DOCDB#}" href="javascript:void(0);" onclick="textSelection('[tag:doc:', ']');">[tag:doc:XXX]</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_CDOCID_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:docid]', '');">[tag:docid]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_CDOCDATE_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:docdate]', '');">[tag:docdate]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_CDOCTIME_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:doctime]', '');">[tag:doctime]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_CDATE_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:date:', ']');">[tag:date:X]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_CDOCAUTHOR_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:docauthor]', '');">[tag:docauthor]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_LANGFILE#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:langfile:', ']');">[tag:langfile:XXX]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_PATH#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:path]', '');">[tag:path]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_MEDIAPATH#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:mediapath]', '');">[tag:mediapath]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_IF_EMPTY#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:if_empty]\n', '\n[/tag:if_empty]');">[tag:if_empty][/tag:if_empty]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_NOT_EMPTY#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:if_notempty]\n', '\n[/tag:if_notempty]');">[tag:if_notempty][/tag:if_notempty]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a class="rightDir" title="{#REQUEST_LANG#}" href="javascript:void(0);" onclick="textSelection('[tag:lang:]\n','\n[tag:/lang]');">[tag:lang:XX][/tag:lang]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>HTML Tags</td>
|
||||
<td>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection('<ol>', '</ol>');"><strong>OL</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<ul>', '</ul>');"><strong>UL</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<li>', '</li>');"><strong>LI</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<p class="">', '</p>');"><strong>P</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<strong>', '</strong>');"><strong>B</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<em>', '</em>');"><strong>I</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<h1>', '</h1>');"><strong>H1</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<h2>', '</h2>');"><strong>H2</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<h3>', '</h3>');"><strong>H3</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<h4>', '</h4>');"><strong>H4</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<h5>', '</h5>');"><strong>H5</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<div class="" id="">', '</div>');"><strong>DIV</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<a href="" title="">', '</a>');"><strong>A</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<img src="" alt="" />', '');"><strong>IMG</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<span>', '</span>');"><strong>SPAN</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<pre>', '</pre>');"><strong>PRE</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<br />', '');"><strong>BR</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('\t', '');"><strong>TAB</strong></a> |
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="fix"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="tab3" class="tab_content" style="display: none;">
|
||||
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
|
||||
<col width="230">
|
||||
<col>
|
||||
<tr>
|
||||
<td>{#REQUEST_CONDITION_IF#}</td>
|
||||
<td>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_first]', '[tag:/if]');"><strong>[tag:if_first]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_not_first]', '[tag:/if]');"><strong>[tag:if_not_first]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_last]', '[tag:/if]');"><strong>[tag:if_last]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_not_last]', '[tag:/if]');"><strong>[tag:if_not_last]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_every:]', '[tag:/if]');"><strong>[tag:if_every:XXX]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_not_every:]', '[tag:/if]');"><strong>[tag:if_not_every:XXX]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_every:2]четный[tag:if_else]нечетный[tag:/if]', '');"><strong>{#REQUEST_SAMPLE#}</strong></a>
|
||||
|
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="noborder">
|
||||
<td><strong><a title="{#REQUEST_RUB_INFO#}" class="rightDir" href="javascript:void(0);" onclick="jAlert('{#REQUEST_SELECT_IN_LIST#}','{#REQUEST_TEMPLATE_ITEMS#}');">[tag:rfld:ID][XXX]</a></strong></td>
|
||||
<td rowspan="18">
|
||||
<ul class="messages" style="margin-bottom: 10px; font-size: 10px;">
|
||||
<li class="highlight grey">
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_notempty:rfld:', '][]');"><strong>[tag:if_notempty:rfld:XXX][XXX]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_empty:rfld:', '][]');"><strong>[tag:if_empty:rfld:XXX][XXX]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if:else]', '');"><strong>[tag:if:else]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:/if]', '');"><strong>[tag:/if]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_notempty:rfld:XXX][XXX]\r\n\r\n[tag:if:else]\r\n\r\n[tag:/if]', '');"><strong>{#REQUEST_SAMPLE#}</strong></a>
|
||||
|
|
||||
</li>
|
||||
</ul>
|
||||
<textarea {$dis} name="request_template_item" id="request_template_item" wrap="off" style="width:100%; height:340px">{$row->request_template_item|escape|default:''}</textarea>
|
||||
<ul class="messages" style="margin-top: 10px;">
|
||||
<li class="highlight grey">
|
||||
{#MAIN_CODEMIRROR_HELP#}
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOCID_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:docid]', '');">[tag:docid]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOCITEMNUM_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:docitemnum]', '');">[tag:docitemnum]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOCTITLE_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:doctitle]', '');">[tag:doctitle]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOCDB#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:doc:', ']');">[tag:doc:XXX]</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_LINK_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:link]', '');">[tag:link]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOCDATE_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:docdate]', '');">[tag:docdate]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOCTIME_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:doctime]', '');">[tag:doctime]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DATE_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:date:', ']');">[tag:date:X]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOCAUTHOR_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:docauthor]', '');">[tag:docauthor]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOCAUTHOR_AVATAR#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:docauthoravatar:]', '');">[tag:docauthoravatar:XXX]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_VIEWS_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:docviews]', '');">[tag:docviews]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_COMMENTS_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:doccomments]', '');">[tag:doccomments]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_PATH#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:path]', '');">[tag:path]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_MEDIAPATH#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:mediapath]', '');">[tag:mediapath]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_THUMBNAIL#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:X000x000:[tag:rfld:', '][150]]');">[tag:X000x000:[tag:rfld:XXX][XXX]]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_LANGFILE#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:langfile:', ']');">[tag:langfile:XXX]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_LANG#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:lang:]\n','\n[tag:/lang]');">[tag:lang:XX][/tag:lang]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>HTML Tags</td>
|
||||
<td>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<ol>', '</ol>');"><strong>OL</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<ul>', '</ul>');"><strong>UL</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<li>', '</li>');"><strong>LI</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<p class="">', '</p>');"><strong>P</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<strong>', '</strong>');"><strong>B</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<em>', '</em>');"><strong>I</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<h1>', '</h1>');"><strong>H1</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<h2>', '</h2>');"><strong>H2</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<h3>', '</h3>');"><strong>H3</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<h4>', '</h4>');"><strong>H4</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<h5>', '</h5>');"><strong>H5</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<div class="" id="">', '</div>');"><strong>DIV</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<a href="" title="">', '</a>');"><strong>A</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<img src="" alt="" />', '');"><strong>IMG</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<span>', '</span>');"><strong>SPAN</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<pre>', '</pre>');"><strong>PRE</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<br />', '');"><strong>BR</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2s('\t', '');"><strong>TAB</strong></a>
|
||||
|
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
|
||||
<col width="3%" />
|
||||
<col width="25%" />
|
||||
<col width="10%" />
|
||||
<col width="15%" />
|
||||
<col width="15%" />
|
||||
<col width="43%" />
|
||||
<thead>
|
||||
<tr>
|
||||
<td align="center"><strong>{#REQUEST_ID#}</strong></td>
|
||||
<td align="center"><strong>{#REQUEST_FIELD_NAME#}</strong></td>
|
||||
<td align="center"><strong>{#REQUEST_RUBRIK_FIELD#}</strong></td>
|
||||
<td align="center"><strong>{#REQUEST_RUBRIK_FIELD#}</strong></td>
|
||||
<td align="center"><strong>{#RUBRIK_FIELD_ALIAS#}</strong></td>
|
||||
<td align="center"><strong>{#REQUEST_FIELD_TYPE#}</strong></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{foreach from=$fields_list item=field_group}
|
||||
|
||||
{if $groups_count > 1}
|
||||
<tr class="grey">
|
||||
<td colspan="6"><h5>{if $field_group.group_title}{$field_group.group_title}{else}{#REQUEST_FIELD_G_UNKNOW#}{/if}</h5></td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
{foreach from=$field_group.fields item=field}
|
||||
<tr>
|
||||
<td align="center">
|
||||
<strong class="code">{$field.Id}</strong>
|
||||
</td>
|
||||
<td>
|
||||
<strong>{$field.rubric_field_title}</strong>
|
||||
</td>
|
||||
<td>
|
||||
<a class="rightDir" title="{#REQUEST_INSERT_INFO#}" href="javascript:void(0);" onclick="textSelection2('[tag:rfld:{$field.Id}][', '0]');"><strong>[tag:rfld:{$field.Id}][0]</strong></a>
|
||||
</td>
|
||||
<td>
|
||||
{if $field.rubric_field_alias}
|
||||
<a class="rightDir" title="{#REQUEST_INSERT_INFO#}" href="javascript:void(0);" onclick="textSelection2('[tag:rfld:{$field.rubric_field_alias}][', '0]');"><strong>[tag:rfld:{$field.rubric_field_alias}][0]</strong></a>
|
||||
{/if}
|
||||
</td>
|
||||
<td align="center">
|
||||
{if $field.rubric_field_alias}<strong class="code">{$field.rubric_field_alias}</strong>{/if}
|
||||
</td>
|
||||
<td>
|
||||
{section name=field_name loop=$field_array}
|
||||
{if $field.rubric_field_type == $field_array[field_name].id}{$field_array[field_name].name}{/if}
|
||||
{/section}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
||||
{/foreach}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="fix"></div>
|
||||
|
||||
<div class="rowElem" id="saveBtn">
|
||||
<div class="saveBtn">
|
||||
{if $smarty.request.action=='edit'}
|
||||
<input {$dis} type="submit" class="basicBtn" value="{#REQUEST_BUTTON_SAVE#}" />
|
||||
{else}
|
||||
<input {$dis} type="submit" class="basicBtn" value="{#REQUEST_BUTTON_ADD#}" />
|
||||
{/if}
|
||||
{#REQUEST_OR#}
|
||||
{if $smarty.request.action=='edit'}
|
||||
<input {$dis} type="submit" class="blackBtn SaveEdit" value="{#REQUEST_BUTTON_SAVE_NEXT#}" />
|
||||
{else}
|
||||
<input {$dis} type="submit" class="blackBtn" value="{#REQUEST_BUTTON_ADD_NEXT#}" />
|
||||
{/if}
|
||||
<a style="float:right; height: 20px; padding: 0 10px;" type="submit" class="button redBtn" href="index.php?do=request&cp={$sess}">{#REQUEST_CANCEL#}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fix"></div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
{include file="$codemirror_connect"}
|
||||
{include file="$codemirror_editor" conn_id="" textarea_id='request_template_main' ctrls='$("#RequestTpl").ajaxSubmit(sett_options);' height=480}
|
||||
{include file="$codemirror_editor" conn_id="2" textarea_id='request_template_item' ctrls='$("#RequestTpl").ajaxSubmit(sett_options);' height=440}
|
||||
|
||||
{literal}
|
||||
<script>
|
||||
$(document).on('change', '#request_alias', function (event) {
|
||||
|
||||
var input = $(this);
|
||||
var alias = input.val();
|
||||
|
||||
if (alias > '') {
|
||||
$.ajax({
|
||||
url: 'index.php?do=request&action=alias&cp=' + $sess,
|
||||
data: {
|
||||
alias: alias,
|
||||
id: $rid
|
||||
},
|
||||
success: function (data) {
|
||||
if (data === '1') {
|
||||
$.jGrowl(input.attr('data-accept'), {theme: 'accept'});
|
||||
}
|
||||
else if (data === 'syn') {
|
||||
$.jGrowl(input.attr('data-error-syn'), {theme: 'error'});
|
||||
alias = $rid ? $rid : '';
|
||||
}
|
||||
else {
|
||||
$.jGrowl(input.attr('data-error-exists'), {theme: 'error'});
|
||||
alias = $rid ? $rid : '';
|
||||
}
|
||||
$('#request_alias_tag').val('[tag:request:' + alias + ']');
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
alias = $rid ? $rid : '';
|
||||
$('#request_alias_tag').val('[tag:request:' + alias + ']');
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
{/literal}
|
||||
|
||||
{if $smarty.request.action !='new' && $smarty.request.rubric_id !=''}
|
||||
<script language="Javascript" type="text/javascript">
|
||||
var sett_options = {ldelim}
|
||||
url: "{$formaction}",
|
||||
beforeSubmit: Request,
|
||||
success: Response,
|
||||
dataType: 'json'
|
||||
{rdelim}
|
||||
|
||||
function Request(){ldelim}
|
||||
$.alerts._overlay('show');
|
||||
{rdelim}
|
||||
|
||||
function Response(data){ldelim}
|
||||
$.alerts._overlay('hide');
|
||||
$.jGrowl(data['message'], {ldelim}
|
||||
header: data['header'],
|
||||
theme: data['theme']
|
||||
{rdelim});
|
||||
{rdelim}
|
||||
|
||||
$(document).ready(function(){ldelim}
|
||||
|
||||
Mousetrap.bind(['ctrl+s', 'command+s'], function(event) {ldelim}
|
||||
event.preventDefault();
|
||||
$("#RequestTpl").ajaxSubmit(sett_options);
|
||||
return false;
|
||||
{rdelim});
|
||||
|
||||
$(".SaveEdit").click(function(event){ldelim}
|
||||
event.preventDefault();
|
||||
$("#RequestTpl").ajaxSubmit(sett_options);
|
||||
return false;
|
||||
{rdelim});
|
||||
|
||||
{rdelim});
|
||||
</script>
|
||||
{/if}
|
@@ -0,0 +1,270 @@
|
||||
<script type="text/javascript" language="JavaScript">
|
||||
$(document).ready(function(){ldelim}
|
||||
|
||||
$rid = parseInt('{$rid}');
|
||||
$sess = '{$sess}';
|
||||
|
||||
$('.tabs li > a').on('click', function(){ldelim}
|
||||
setTimeout(
|
||||
function(){ldelim}
|
||||
$('.mainForm select').trigger('refresh');
|
||||
{rdelim}
|
||||
, 100);
|
||||
|
||||
console.log('Refresh');
|
||||
{rdelim});
|
||||
|
||||
{if check_permission('request_edit')}
|
||||
$(".AddRequest").click( function(event) {ldelim}
|
||||
event.preventDefault();
|
||||
var request_title_new = $('#add_request #request_title_new').fieldValue();
|
||||
var title = '{#REQUEST_NEW#}';
|
||||
var text = '{#REQUEST_ENTER_NAME#}';
|
||||
if (request_title_new == ""){ldelim}
|
||||
jAlert(text,title);
|
||||
{rdelim}else{ldelim}
|
||||
$.alerts._overlay('show');
|
||||
$("#add_request").submit();
|
||||
{rdelim}
|
||||
{rdelim});
|
||||
|
||||
$(".CopyRequest").click( function(event) {ldelim}
|
||||
event.preventDefault();
|
||||
var href = $(this).attr('href');
|
||||
var title = '{#REQUEST_COPY#}';
|
||||
var text = '{#REQUEST_PLEASE_NAME#}';
|
||||
jPrompt(text, '', title, function(b){ldelim}
|
||||
if (b){ldelim}
|
||||
$.alerts._overlay('show');
|
||||
window.location = href + '&cname=' + b;
|
||||
{rdelim}
|
||||
{rdelim}
|
||||
);
|
||||
{rdelim});
|
||||
{/if}
|
||||
|
||||
var clipboard = new Clipboard('.copyBtn');
|
||||
|
||||
{rdelim});
|
||||
</script>
|
||||
|
||||
<div class="title"><h5>{#REQUEST_TITLE#}</h5></div>
|
||||
|
||||
<div class="widget" style="margin-top: 0px;">
|
||||
<div class="body">
|
||||
{#REQUEST_TIP#}
|
||||
</div>
|
||||
</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>{#REQUEST_TITLE#}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="widget first">
|
||||
<ul class="tabs">
|
||||
<li class="activeTab"><a href="#tab1">{#REQUEST_ALL#}</a></li>
|
||||
{if check_permission('request_edit')}
|
||||
<li class=""><a href="#tab2">{#REQUEST_NEW#}</a></li>
|
||||
{/if}
|
||||
</ul>
|
||||
|
||||
<div class="tab_container">
|
||||
<div id="tab1" class="tab_content" style="display: block;">
|
||||
<form class="mainForm">
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
|
||||
{if $items}
|
||||
<thead>
|
||||
<tr>
|
||||
<td width="40">{#REQUEST_ID#}</td>
|
||||
<td>{#REQUEST_NAME#}</td>
|
||||
<td width="200">{#REQUEST_AUTHOR#}</td>
|
||||
<td width="200">{#REQUEST_DATE_CREATE#}</td>
|
||||
<td width="200">{#REQUEST_SYSTEM_TAG#}</td>
|
||||
<td width="80" colspan="4">{#REQUEST_ACTIONS#}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$items item=item}
|
||||
<tr>
|
||||
<td align="center">{$item->Id}</td>
|
||||
|
||||
<td>
|
||||
{if check_permission('request_edit')}
|
||||
<a title="{#REQUEST_EDIT#}" href="index.php?do=request&action=edit&Id={$item->Id}&rubric_id={$item->rubric_id}&cp={$sess}" class="topDir link">
|
||||
<strong>{$item->request_title|escape}</strong>
|
||||
</a>
|
||||
{else}
|
||||
<strong>{$item->request_title|escape}</strong>
|
||||
{/if}
|
||||
{if $item->request_description != ''}
|
||||
<br>
|
||||
{$item->request_description|escape|default:#REQUEST_NO_DESCRIPTION#}
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
<td align="center">{$item->request_author|escape}</td>
|
||||
|
||||
<td align="center">
|
||||
<span class="date_text dgrey">{$item->request_created|date_format:$TIME_FORMAT|pretty_date}</span>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<div class="pr12" style="display: table">
|
||||
<input style="display: table-cell" readonly type="text" id="shot_{$item->Id}" value="[tag:request:{if $item->request_alias}{$item->request_alias}{else}{$item->Id}{/if}]">
|
||||
<a style="display: table-cell; text-align: center" class="whiteBtn copyBtn topDir" href="javascript:void(0);" data-clipboard-action="copy" data-clipboard-target="#shot_{$item->Id}" title="Copy to clipboard">
|
||||
<img style="margin-top: -3px; position: relative; top: 4px; padding: 0 3px;" class="clippy" src="{$ABS_PATH}admin/templates/images/clippy.svg" width="13">
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td width="1%" align="center">
|
||||
{if check_permission('request_edit')}
|
||||
<a title="{#REQUEST_EDIT#}" href="index.php?do=request&action=edit&Id={$item->Id}&cp={$sess}&rubric_id={$item->rubric_id}" class="topleftDir icon_sprite ico_edit"></a>
|
||||
{else}
|
||||
<span class="icon_sprite ico_edit_no"></span>
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
<td width="1%" align="center">
|
||||
{if check_permission('request_edit')}
|
||||
<a title="{#REQUEST_CONDITION_EDIT#}" data-dialog="conditions-{$item->Id}" data-modal="true" data-title="{#REQUEST_CONDITION#}" href="index.php?do=request&action=conditions&rubric_id={$item->rubric_id}&Id={$item->Id}&cp={$sess}&pop=1" class="topleftDir icon_sprite ico_query openDialog"></a>
|
||||
{else}
|
||||
<span class="icon_sprite ico_query_no"></span>
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
<td width="1%" align="center">
|
||||
{if check_permission('request_edit')}
|
||||
<a title="{#REQUEST_COPY#}" href="index.php?do=request&action=copy&Id={$item->Id}&cp={$sess}&rubric_id={$item->rubric_id}" class="CopyRequest topleftDir icon_sprite ico_copy"></a>
|
||||
{else}
|
||||
<span class="icon_sprite ico_copy_no"></span>
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
<td width="1%" align="center">
|
||||
{if check_permission('request_edit')}
|
||||
<a title="{#REQUEST_DELETE#}" dir="{#REQUEST_DELETE#}" name="{#REQUEST_DELETE_CONFIRM#}" href="index.php?do=request&action=delete_query&rubric_id={$item->rubric_id}&Id={$item->Id}&cp={$sess}" class="ConfirmDelete topleftDir icon_sprite ico_delete"></a>
|
||||
{else}
|
||||
<span class="icon_sprite ico_delete_no"></span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr class="noborder">
|
||||
<td colspan="6">
|
||||
<ul class="messages">
|
||||
<li class="highlight yellow">{#REQUEST_NO_REQUST#}</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
{if check_permission('request_edit')}
|
||||
<div id="tab2" class="tab_content" style="display: none;">
|
||||
<form id="add_request" method="post" action="index.php?do=request&action=new&cp={$sess}" class="mainForm">
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
|
||||
<col width="300">
|
||||
<col>
|
||||
<tr>
|
||||
<td>{#REQUEST_NAME3#}</td>
|
||||
<td><input name="request_title_new" type="text" id="request_title_new" value="" placeholder="{#REQUEST_NAME#}" style="width: 400px"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{#REQUEST_DESCRIPTION#}</td>
|
||||
<td><input name="request_description" type="text" id="request_description" value="" placeholder="{#REQUEST_DESCRIPTION#}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{#REQUEST_SELECT_RUBRIK#}</td>
|
||||
<td>
|
||||
<select style="width:350px" id="rubric_id" name="rubric_id" class="mousetrap">
|
||||
<option value="">{#REQUEST_PLEASE_SELECT#}</option>
|
||||
{foreach from=$rubrics item=rubric}
|
||||
<option value="{$rubric->Id}">{$rubric->rubric_title|escape}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="nowrap">
|
||||
<strong><a class="toprightDir" title="{#REQUEST_I#}">[?]</a></strong> {#REQUEST_ALIAS#}:
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="pr12">
|
||||
<input type="text" name="request_alias" id="request_alias" value="" class="mousetrap" data-accept="{#REQUEST_ACCEPT#}" data-error-syn="{#REQUEST_ER_SYN#}" data-error-exists="{#REQUEST_ER_EXISTS#}" placeholder="{#REQUEST_ALIAS#}" maxlength="20" style="width: 200px;" autocomplete="off" />
|
||||
<input type="text" id="request_alias_tag" value="[tag:request:]" readonly size="40" class="mousetrap" style="width: 200px;" />
|
||||
<a style="text-align: center; padding: 5px 3px 4px 3px;" class="whiteBtn copyBtn" href="javascript:void(0);" data-clipboard-action="copy" data-clipboard-target="#sysblock_alias_tag">
|
||||
<img style="margin-top: -3px; position: relative; top: 4px; padding: 0 3px;" class="clippy" src="{$ABS_PATH}admin/templates/images/clippy.svg" width="13">
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><input type="button" class="basicBtn AddRequest" value="{#REQUEST_BUTTON_ADD#}" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="fix"></div>
|
||||
</div>
|
||||
|
||||
{literal}
|
||||
<script>
|
||||
$(document).on('change', '#request_alias', function (event) {
|
||||
|
||||
var input = $(this);
|
||||
var alias = input.val();
|
||||
|
||||
if (alias > '') {
|
||||
$.ajax({
|
||||
url: 'index.php?do=request&action=alias&cp=' + $sess,
|
||||
data: {
|
||||
alias: alias
|
||||
},
|
||||
success: function (data) {
|
||||
if (data === '1') {
|
||||
$.jGrowl(input.attr('data-accept'), {theme: 'accept'});
|
||||
}
|
||||
else if (data === 'syn') {
|
||||
$.jGrowl(input.attr('data-error-syn'), {theme: 'error'});
|
||||
alias = $rid ? $rid : '';
|
||||
}
|
||||
else {
|
||||
$.jGrowl(input.attr('data-error-exists'), {theme: 'error'});
|
||||
alias = $rid ? $rid : '';
|
||||
}
|
||||
$('#request_alias_tag').val('[tag:request:' + alias + ']');
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
alias = $rid ? $rid : '';
|
||||
$('#request_alias_tag').val('[tag:request:' + alias + ']');
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
{/literal}
|
||||
|
||||
{if $page_nav}
|
||||
<div class="pagination">
|
||||
<ul class="pages">
|
||||
{$page_nav}
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
@@ -0,0 +1 @@
|
||||
<li><a {if $smarty.request.do=='request'}class="active"{else}{/if} href="index.php?do=request&cp={$sess}"><span>{#MAIN_QUERIES#}</span></a></li>
|
@@ -0,0 +1 @@
|
||||
for old request
|
974
inc/query_variants/original_files/class/class.request.php
Normal file
974
inc/query_variants/original_files/class/class.request.php
Normal file
@@ -0,0 +1,974 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
*/
|
||||
|
||||
class AVE_Request
|
||||
{
|
||||
|
||||
/**
|
||||
* Количество Запросов на странице
|
||||
*
|
||||
* @public int
|
||||
*/
|
||||
public $_limit = 25;
|
||||
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для получения и вывода списка Запросов
|
||||
*
|
||||
* @param boolean $pagination признак формирования постраничного списка
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function _requestListGet($pagination = true)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
$limit = '';
|
||||
|
||||
// Если используется постраничная навигация
|
||||
if ($pagination)
|
||||
{
|
||||
// Определяем лимит записей на страницу и начало диапазона выборки
|
||||
$limit = $this->_limit;
|
||||
$start = get_current_page() * $limit - $limit;
|
||||
|
||||
// Получаем общее количество запросов
|
||||
$num = $AVE_DB->Query("SELECT COUNT(*) FROM " . PREFIX . "_request")->GetCell();
|
||||
|
||||
// Если количество больше, чем установленный лимит, тогда формируем постраничную навигацию
|
||||
if ($num > $limit)
|
||||
{
|
||||
$page_nav = "<li><a href=\"index.php?do=request&page={s}&cp=" . SESSION . "\">{t}</a></li>";
|
||||
$page_nav = get_pagination(ceil($num / $limit), 'page', $page_nav);
|
||||
$AVE_Template->assign('page_nav', $page_nav);
|
||||
}
|
||||
|
||||
$limit = $pagination ? "LIMIT " . $start . "," . $limit : '';
|
||||
}
|
||||
|
||||
// Выполняем запрос к БД на получение списка запросов с учетом лимита вывода на страницу (если необходимо)
|
||||
$items = array();
|
||||
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
" . PREFIX . "_request
|
||||
ORDER BY Id ASC
|
||||
" . $limit . "
|
||||
");
|
||||
|
||||
// Формируем массив из полученных данных
|
||||
while ($row = $sql->FetchRow())
|
||||
{
|
||||
$row->request_author = get_username_by_id($row->request_author_id);
|
||||
array_push($items, $row);
|
||||
}
|
||||
|
||||
// Возвращаем массив
|
||||
return $items;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Получить наименование и описание Запроса по идентификатору
|
||||
*
|
||||
* @param int $request_id идентификатор Запроса
|
||||
* @return object наименование Запроса
|
||||
*/
|
||||
function get_request_by_id($request_id = 0)
|
||||
{
|
||||
global $AVE_DB;
|
||||
|
||||
static $requests = array();
|
||||
|
||||
if (! isset($requests[$request_id]))
|
||||
{
|
||||
$requests[$request_id] = $AVE_DB->Query("
|
||||
SELECT
|
||||
rubric_id,
|
||||
request_title,
|
||||
request_description
|
||||
FROM
|
||||
" . PREFIX . "_request
|
||||
WHERE
|
||||
Id = '" . $request_id . "'
|
||||
LIMIT 1
|
||||
")->FetchRow();
|
||||
}
|
||||
|
||||
return $requests[$request_id];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Проверка алиаса тега на валидность и уникальность
|
||||
*
|
||||
* @param string $alias
|
||||
* @param int $id
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
function requestValidate ($alias = '', $id = 0)
|
||||
{
|
||||
global $AVE_DB;
|
||||
|
||||
//-- Соответствие требованиям
|
||||
if (empty ($alias) || preg_match('/^[A-Za-z0-9-_]{1,20}$/i', $alias) !== 1 || is_numeric($alias))
|
||||
return 'syn';
|
||||
|
||||
//-- Уникальность
|
||||
return !(bool)$AVE_DB->Query("
|
||||
SELECT 1
|
||||
FROM
|
||||
" . PREFIX . "_request
|
||||
WHERE
|
||||
request_alias = '" . $alias . "'
|
||||
AND
|
||||
Id != '" . $id . "'
|
||||
")->GetCell();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для формирования списка Запросов
|
||||
*
|
||||
*/
|
||||
function requestListFetch()
|
||||
{
|
||||
global $AVE_Template;
|
||||
|
||||
$AVE_Template->assign('conditions', $this->_requestListGet(false));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для отображения списка Запросов
|
||||
*
|
||||
*/
|
||||
function requestListShow()
|
||||
{
|
||||
global $AVE_Template;
|
||||
|
||||
$AVE_Template->assign('rid', 0);
|
||||
|
||||
// Получаем список запросов
|
||||
$AVE_Template->assign('items', $this->_requestListGet());
|
||||
|
||||
// Передаем в шаблон и отображаем страницу со списком
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('request/list.tpl'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для создания нового Запроса
|
||||
*
|
||||
*/
|
||||
function requestNew()
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
// Определяем действие пользователя
|
||||
switch ($_REQUEST['sub'])
|
||||
{
|
||||
// Действие не определено
|
||||
case '':
|
||||
$AVE_Template->assign('rid', 0);
|
||||
// Отображаем пустую форму для создания нового запроса
|
||||
$AVE_Template->assign('formaction', 'index.php?do=request&action=new&sub=save&cp=' . SESSION);
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('request/form.tpl'));
|
||||
break;
|
||||
|
||||
// Нажата кнопка Сохранить запрос
|
||||
case 'save':
|
||||
$save = true;
|
||||
$errors = array();
|
||||
|
||||
$row = new stdClass();
|
||||
|
||||
$row->request_template_item = stripslashes(pretty_chars($_REQUEST['request_template_item']));
|
||||
$row->request_template_main = stripslashes(pretty_chars($_REQUEST['request_template_main']));
|
||||
$row->request_title = stripslashes($_REQUEST['request_title']);
|
||||
$row->rubric_id = stripslashes($_REQUEST['rubric_id']);
|
||||
$row->request_items_per_page = stripslashes($_REQUEST['request_items_per_page']);
|
||||
$row->request_order_by = stripslashes($_REQUEST['request_order_by']);
|
||||
$row->request_order_by_nat = stripslashes($_REQUEST['request_order_by_nat']);
|
||||
$row->request_asc_desc = stripslashes($_REQUEST['request_asc_desc']);
|
||||
$row->request_description = stripslashes($_REQUEST['request_description']);
|
||||
$row->request_show_pagination = (isset($_REQUEST['request_show_pagination']) ? (int)($_REQUEST['request_show_pagination']) : 0);
|
||||
$row->request_pagination = (isset($_REQUEST['request_pagination']) ? (int)($_REQUEST['request_pagination']) : 1);
|
||||
$row->request_only_owner = (isset($_REQUEST['request_only_owner']) ? (int)($_REQUEST['request_only_owner']) : 0);
|
||||
$row->request_cache_lifetime = (int)($_REQUEST['request_cache_lifetime']);
|
||||
$row->request_lang = (isset($_REQUEST['request_lang']) ? (int)$_REQUEST['request_lang'] : 0);
|
||||
$row->request_cache_elements = (isset($_REQUEST['request_cache_elements']) ? (int)$_REQUEST['request_cache_elements'] : 0);
|
||||
$row->request_external = (isset($_REQUEST['request_external']) ? (int)$_REQUEST['request_external'] : 0);
|
||||
$row->request_ajax = (isset($_REQUEST['request_ajax']) ? (int)$_REQUEST['request_ajax'] : 0);
|
||||
$row->request_show_sql = (isset($_REQUEST['request_show_sql']) ? (int)$_REQUEST['request_show_sql'] : 0);
|
||||
|
||||
if (empty($_REQUEST['rubric_id']))
|
||||
{
|
||||
$save = false;
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_RUBRIC');
|
||||
$errors[] = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_RUBRIC');
|
||||
}
|
||||
|
||||
if (empty($_REQUEST['request_title']))
|
||||
{
|
||||
$save = false;
|
||||
$errors[] = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_TITLE');
|
||||
}
|
||||
|
||||
if (empty($_REQUEST['request_template_main']))
|
||||
{
|
||||
$save = false;
|
||||
$errors[] = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_TEXT');
|
||||
}
|
||||
|
||||
$check_code_template_item = strtolower($_REQUEST['request_template_item']);
|
||||
$check_code_template_main = strtolower($_REQUEST['request_template_main']);
|
||||
|
||||
if ((is_php_code($check_code_template_item) || is_php_code($check_code_template_main)) && !check_permission('request_php'))
|
||||
{
|
||||
$save = false;
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_PHP');
|
||||
$errors[] = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_PHP');
|
||||
reportLog($AVE_Template->get_config_vars('REQUEST_REPORT_ERR_PHP_N') . ' (' . stripslashes(htmlspecialchars($_REQUEST['request_title'], ENT_QUOTES)) . ')');
|
||||
}
|
||||
|
||||
if ($save === false)
|
||||
{
|
||||
$AVE_Template->assign('row', $row);
|
||||
$AVE_Template->assign('errors', $errors);
|
||||
$AVE_Template->assign('formaction', 'index.php?do=request&action=new&sub=save&cp=' . SESSION);
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('request/form.tpl'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "
|
||||
INSERT " . PREFIX . "_request
|
||||
SET
|
||||
rubric_id = '" . (int)$_REQUEST['rubric_id'] . "',
|
||||
request_alias = '" . (isset($_REQUEST['request_alias']) ? stripslashes($_REQUEST['request_alias']) : '') . "',
|
||||
request_title = '" . (isset($_REQUEST['request_title']) ? stripslashes($_REQUEST['request_title']) : '') . "',
|
||||
request_items_per_page = '" . (isset($_REQUEST['request_items_per_page']) ? stripslashes($_REQUEST['request_items_per_page']) : 0) . "',
|
||||
request_template_item = '" . (isset($_REQUEST['request_template_item']) ? stripslashes(pretty_chars($_REQUEST['request_template_item'])) : '') . "',
|
||||
request_template_main = '" . (isset($_REQUEST['request_template_main']) ? stripslashes(pretty_chars($_REQUEST['request_template_main'])) : '') . "',
|
||||
request_order_by = '" . (isset($_REQUEST['request_order_by']) ? stripslashes($_REQUEST['request_order_by']) : '') . "',
|
||||
request_order_by_nat = '" . (isset($_REQUEST['request_order_by_nat']) ? (int)trim($_REQUEST['request_order_by_nat']) : 0) . "',
|
||||
request_description = '" . (isset($_REQUEST['request_description']) ? stripslashes($_REQUEST['request_description']) : '') . "',
|
||||
request_author_id = '" . (int)$_SESSION['user_id'] . "',
|
||||
request_created = '" . time() . "',
|
||||
request_asc_desc = '" . (isset($_REQUEST['request_asc_desc']) ? stripslashes($_REQUEST['request_asc_desc']) : 'DESC') . "',
|
||||
request_show_pagination = '" . (isset($_REQUEST['request_show_pagination']) ? (int)$_REQUEST['request_show_pagination'] : 0) . "',
|
||||
request_pagination = '" . (isset($_REQUEST['request_pagination']) ? (int)$_REQUEST['request_pagination'] : 1) . "',
|
||||
request_use_query = '" . (isset($_REQUEST['request_use_query']) ? (int)$_REQUEST['request_use_query'] : 0) . "',
|
||||
request_count_items = '" . (isset($_REQUEST['request_count_items']) ? (int)$_REQUEST['request_count_items'] : 0) . "',
|
||||
request_hide_current = '" . (isset($_REQUEST['request_hide_current']) ? (int)($_REQUEST['request_hide_current']) : 0) . "',
|
||||
request_only_owner = '" . (isset($_REQUEST['request_only_owner']) ? (int)($_REQUEST['request_only_owner']) : 0) . "',
|
||||
request_cache_lifetime = '" . (isset($_REQUEST['request_cache_lifetime']) ? (int)($_REQUEST['request_cache_lifetime']) : 0) . "',
|
||||
request_lang = '" . (isset($_REQUEST['request_lang']) ? (int)$_REQUEST['request_lang'] : 0). "',
|
||||
request_cache_elements = '" . (isset($_REQUEST['request_cache_elements']) ? (int)$_REQUEST['request_cache_elements'] : 0). "',
|
||||
request_show_statistic = '" . (isset($_REQUEST['request_show_statistic']) ? (int)$_REQUEST['request_show_statistic'] : 0). "',
|
||||
request_external = '" . (isset($_REQUEST['request_external']) ? (int)$_REQUEST['request_external'] : 0). "',
|
||||
request_ajax = '" . (isset($_REQUEST['request_ajax']) ? (int)$_REQUEST['request_ajax'] : 0). "',
|
||||
request_show_sql = '" . (isset($_REQUEST['request_show_sql']) ? (int)$_REQUEST['request_show_sql'] : 0). "',
|
||||
request_changed = '" . time() . "',
|
||||
request_changed_elements = '" . time() . "'
|
||||
";
|
||||
|
||||
// Выполняем запрос к БД и сохраняем введенную пользователем информацию
|
||||
$AVE_DB->Query($sql);
|
||||
|
||||
// Получаем id последней записи
|
||||
$iid = $AVE_DB->InsertId();
|
||||
|
||||
// Сохраняем системное сообщение в журнал
|
||||
reportLog($AVE_Template->get_config_vars('REQUEST_ADD_NEW_SUC') . ' (' . stripslashes(htmlspecialchars($_REQUEST['request_title'], ENT_QUOTES)) . ') (' . $iid . ')');
|
||||
|
||||
// Если в запросе пришел параметр на продолжение редактирования запроса
|
||||
if ($_REQUEST['reedit'] == 1)
|
||||
{
|
||||
// Выполняем переход на страницу с редактированием запроса
|
||||
header('Location:index.php?do=request&action=edit&Id=' . $iid . '&rubric_id=' . $_REQUEST['rubric_id'] . '&cp=' . SESSION);
|
||||
}
|
||||
else
|
||||
{
|
||||
// В противном случае выполняем переход к списку запросов
|
||||
if (!$_REQUEST['next_edit'])
|
||||
header('Location:index.php?do=request&cp=' . SESSION);
|
||||
else
|
||||
header('Location:index.php?do=request&action=edit&Id=' . $iid . '&rubric_id='.$_REQUEST['rubric_id'].'&cp=' . SESSION);
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для редактирования Запроса
|
||||
*
|
||||
* @param int $request_id идентификатор запроса
|
||||
*/
|
||||
function requestEdit($request_id)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
// Определяем действие пользователя
|
||||
switch ($_REQUEST['sub'])
|
||||
{
|
||||
// Если действие не определено
|
||||
case '':
|
||||
// Выполняем запрос к БД и получаем всю информацию о запросе
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT *
|
||||
FROM
|
||||
" . PREFIX . "_request
|
||||
WHERE
|
||||
Id = '" . $request_id . "'
|
||||
OR
|
||||
request_alias = '" . $request_id . "'
|
||||
");
|
||||
|
||||
if ($sql->_result->num_rows == 0)
|
||||
{
|
||||
header('Location:index.php?do=request&cp=' . SESSION);
|
||||
exit;
|
||||
}
|
||||
|
||||
$row = $sql->FetchRow();
|
||||
|
||||
// Получаем постраничную навигацию
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT
|
||||
id,
|
||||
pagination_name
|
||||
FROM
|
||||
" . PREFIX . "_paginations
|
||||
");
|
||||
|
||||
$paginations = array();
|
||||
|
||||
while ($pages = $sql->FetchRow())
|
||||
array_push($paginations, $pages);
|
||||
|
||||
// Передаем данные в шаблон и отображаем страницу с редактированием запроса
|
||||
if (! isset($_REQUEST['rubric_id']))
|
||||
$_REQUEST['rubric_id'] = $row->rubric_id;
|
||||
|
||||
$AVE_Template->assign('row', $row);
|
||||
$AVE_Template->assign('rid', $row->Id);
|
||||
$AVE_Template->assign('paginations', $paginations);
|
||||
$AVE_Template->assign('formaction', 'index.php?do=request&action=edit&sub=save&Id=' . $row->Id . '&cp=' . SESSION);
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('request/form.tpl'));
|
||||
|
||||
break;
|
||||
|
||||
// Пользователь нажал кнопку Сохранить изменения
|
||||
case 'save':
|
||||
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT *
|
||||
FROM
|
||||
" . PREFIX . "_request
|
||||
WHERE
|
||||
Id = '" . $request_id . "'
|
||||
");
|
||||
|
||||
if ($sql->_result->num_rows == 0)
|
||||
{
|
||||
header('Location:index.php?do=request&cp=' . SESSION);
|
||||
exit;
|
||||
}
|
||||
|
||||
$save = true;
|
||||
$errors = array();
|
||||
$row = new stdClass();
|
||||
$row->request_template_item = (isset($_REQUEST['request_template_item']) ? stripslashes(pretty_chars($_REQUEST['request_template_item'])) : '');
|
||||
$row->request_template_main = (isset($_REQUEST['request_template_main']) ? stripslashes(pretty_chars($_REQUEST['request_template_main'])) : '');
|
||||
$row->request_title = (isset($_REQUEST['request_title']) ? stripslashes($_REQUEST['request_title']) : '');
|
||||
$row->rubric_id = (isset($_REQUEST['rubric_id']) ? stripslashes($_REQUEST['rubric_id']) : 0);
|
||||
$row->request_items_per_page = (isset($_REQUEST['request_items_per_page']) ? stripslashes($_REQUEST['request_items_per_page']) : 0);
|
||||
$row->request_order_by = (isset($_REQUEST['request_order_by']) ? stripslashes($_REQUEST['request_order_by']) : '');
|
||||
$row->request_order_by_nat = (isset($_REQUEST['request_order_by_nat']) ? (int)trim($_REQUEST['request_order_by_nat']) : 0);
|
||||
$row->request_asc_desc = (isset($_REQUEST['request_asc_desc']) ? stripslashes($_REQUEST['request_asc_desc']) : 'DESC');
|
||||
$row->request_description = (isset($_REQUEST['request_description']) ? stripslashes($_REQUEST['request_description']) : '');
|
||||
$row->request_show_pagination = (isset($_REQUEST['request_show_pagination']) ? $_REQUEST['request_show_pagination'] : 0);
|
||||
$row->request_pagination = (isset($_REQUEST['request_pagination']) ? (int)($_REQUEST['request_pagination']) : 1);
|
||||
$row->request_use_query = (isset($_REQUEST['request_use_query']) ? $_REQUEST['request_use_query'] : 0);
|
||||
$row->request_count_items = (isset($_REQUEST['request_count_items']) ? $_REQUEST['request_count_items'] : 0);
|
||||
$row->request_only_owner = (isset($_REQUEST['request_only_owner']) ? (int)($_REQUEST['request_only_owner']) : 0);
|
||||
$row->request_cache_lifetime = (isset($_REQUEST['request_cache_lifetime']) ? (int)($_REQUEST['request_cache_lifetime']) : 0);
|
||||
$row->request_lang = (isset($_REQUEST['request_lang']) ? (int)$_REQUEST['request_lang'] : 0);
|
||||
$row->request_cache_elements = (isset($_REQUEST['request_cache_elements']) ? (int)$_REQUEST['request_cache_elements'] : 0);
|
||||
$row->request_show_statistic = (isset($_REQUEST['request_show_statistic']) ? (int)$_REQUEST['request_show_statistic'] : 0);
|
||||
$row->request_external = (isset($_REQUEST['request_external']) ? (int)$_REQUEST['request_external'] : 0);
|
||||
$row->request_ajax = (isset($_REQUEST['request_ajax']) ? (int)$_REQUEST['request_ajax'] : 0);
|
||||
$row->request_show_sql = (isset($_REQUEST['request_show_sql']) ? (int)$_REQUEST['request_show_sql'] : 0);
|
||||
|
||||
$message = '';
|
||||
|
||||
if (empty($_REQUEST['rubric_id']))
|
||||
{
|
||||
$save = false;
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_RUBRIC');
|
||||
$errors[] = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_RUBRIC');
|
||||
}
|
||||
|
||||
if (empty($_REQUEST['request_title']))
|
||||
{
|
||||
$save = false;
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_TITLE');
|
||||
$errors[] = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_TITLE');
|
||||
}
|
||||
|
||||
if (empty($_REQUEST['request_template_main']))
|
||||
{
|
||||
$save = false;
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_TEXT');
|
||||
$errors[] = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_TEXT');
|
||||
}
|
||||
|
||||
$check_code_template_item = strtolower($_REQUEST['request_template_item']);
|
||||
$check_code_template_main = strtolower($_REQUEST['request_template_main']);
|
||||
|
||||
if ((is_php_code($check_code_template_item) || is_php_code($check_code_template_main)) && !check_permission('request_php'))
|
||||
{
|
||||
$save = false;
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_PHP');
|
||||
$errors[] = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_PHP');
|
||||
reportLog($AVE_Template->get_config_vars('REQUEST_REPORT_ERR_PHP_E') . ' (' . stripslashes(htmlspecialchars($_REQUEST['request_title'], ENT_QUOTES)) . ') (Id:' . $request_id . ')');
|
||||
}
|
||||
|
||||
if ($save === false)
|
||||
{
|
||||
if (isAjax())
|
||||
{
|
||||
$header = $AVE_Template->get_config_vars('REQUEST_ERROR');
|
||||
echo json_encode(array('message' => $message, 'header' => $header, 'theme' => 'error'));
|
||||
exit;
|
||||
}
|
||||
|
||||
$AVE_Template->assign('row', $row);
|
||||
$AVE_Template->assign('errors', $errors);
|
||||
$AVE_Template->assign('formaction', 'index.php?do=request&action=edit&sub=save&Id=' . $request_id . '&cp=' . SESSION);
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('request/form.tpl'));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Выполняем запрос к БД и обновляем имеющиеся данные
|
||||
$sql = "
|
||||
UPDATE " . PREFIX . "_request
|
||||
SET
|
||||
rubric_id = '" . (int)$_REQUEST['rubric_id'] . "',
|
||||
request_alias = '" . (isset($_REQUEST['request_alias']) ? $_REQUEST['request_alias'] : '') . "',
|
||||
request_title = '" . (isset($_REQUEST['request_title']) ? $_REQUEST['request_title'] : '') . "',
|
||||
request_items_per_page = '" . (isset($_REQUEST['request_items_per_page']) ? $_REQUEST['request_items_per_page'] : 0) . "',
|
||||
request_template_item = '" . (isset($_REQUEST['request_template_item']) ? $_REQUEST['request_template_item'] : '') . "',
|
||||
request_template_main = '" . (isset($_REQUEST['request_template_main']) ? $_REQUEST['request_template_main'] : '') . "',
|
||||
request_order_by = '" . (isset($_REQUEST['request_order_by']) ? $_REQUEST['request_order_by'] : '') . "',
|
||||
request_order_by_nat = '" . (isset($_REQUEST['request_order_by_nat']) ? (int)trim($_REQUEST['request_order_by_nat']) : 0) . "',
|
||||
request_description = '" . (isset($_REQUEST['request_description']) ? $_REQUEST['request_description'] : '') . "',
|
||||
request_asc_desc = '" . (isset($_REQUEST['request_asc_desc']) ? $_REQUEST['request_asc_desc'] : 'DESC') . "',
|
||||
request_show_pagination = '" . (isset($_REQUEST['request_show_pagination']) ? (int)$_REQUEST['request_show_pagination'] : 0) . "',
|
||||
request_pagination = '" . (isset($_REQUEST['request_pagination']) ? (int)$_REQUEST['request_pagination'] : 1) . "',
|
||||
request_use_query = '" . (isset($_REQUEST['request_use_query']) ? (int)$_REQUEST['request_use_query'] : 0) . "',
|
||||
request_count_items = '" . (isset($_REQUEST['request_count_items']) ? (int)$_REQUEST['request_count_items'] : 0) . "',
|
||||
request_hide_current = '" . (isset($_REQUEST['request_hide_current']) ? (int)($_REQUEST['request_hide_current']) : 0) . "',
|
||||
request_only_owner = '" . (isset($_REQUEST['request_only_owner']) ? (int)($_REQUEST['request_only_owner']) : 0) . "',
|
||||
request_cache_lifetime = '" . (isset($_REQUEST['request_cache_lifetime']) ? (int)($_REQUEST['request_cache_lifetime']) : '-1') . "',
|
||||
request_lang = '" . (isset($_REQUEST['request_lang']) ? (int)$_REQUEST['request_lang'] : 0). "',
|
||||
request_cache_elements = '" . (isset($_REQUEST['request_cache_elements']) ? (int)$_REQUEST['request_cache_elements'] : 0). "',
|
||||
request_show_statistic = '" . (isset($_REQUEST['request_show_statistic']) ? (int)$_REQUEST['request_show_statistic'] : 0). "',
|
||||
request_external = '" . (isset($_REQUEST['request_external']) ? (int)$_REQUEST['request_external'] : 0). "',
|
||||
request_ajax = '" . (isset($_REQUEST['request_ajax']) ? (int)$_REQUEST['request_ajax'] : 0). "',
|
||||
request_show_sql = '" . (isset($_REQUEST['request_show_sql']) ? (int)$_REQUEST['request_show_sql'] : 0). "',
|
||||
request_changed = '" . time() . "',
|
||||
request_changed_elements = '" . time() . "'
|
||||
WHERE
|
||||
Id = '" . $request_id . "'
|
||||
";
|
||||
|
||||
$AVE_DB->Query($sql);
|
||||
|
||||
$AVE_DB->clearRequest($request_id);
|
||||
|
||||
// ToDO Сделать проверку на сохранение
|
||||
|
||||
// Сохраняем системное сообщение в журнал
|
||||
reportLog($AVE_Template->get_config_vars('REQUEST_SAVE_CHA_SUC') . ' (' . stripslashes(htmlspecialchars($_REQUEST['request_title'], ENT_QUOTES)) . ') (Id:' . $request_id . ')');
|
||||
|
||||
// В противном случае выполняем переход к списку запросов
|
||||
if (! isAjax())
|
||||
{
|
||||
header('Location:index.php?do=request&cp=' . SESSION);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_TEMPLATE_SAVED');
|
||||
$header = $AVE_Template->get_config_vars('REQUEST_SUCCESS');
|
||||
$theme = 'accept';
|
||||
echo json_encode(array('message' => $message, 'header' => $header, 'theme' => $theme));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для создания копии Запроса
|
||||
*
|
||||
* @param int $request_id идентификатор запроса
|
||||
*/
|
||||
function requestCopy($request_id)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
// Выполняем запрос к БД на получение информации о копиреумом запросе
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT *
|
||||
FROM
|
||||
" . PREFIX . "_request
|
||||
WHERE
|
||||
Id = '" . $request_id . "'
|
||||
");
|
||||
|
||||
if ($sql->_result->num_rows == 0)
|
||||
{
|
||||
header('Location:index.php?do=request&cp=' . SESSION);
|
||||
exit;
|
||||
}
|
||||
|
||||
$row = $sql->FetchRow();
|
||||
|
||||
// Выполняем запрос к БД на добавление нового запроса на основании полученных ранее данных
|
||||
$AVE_DB->Query("
|
||||
INSERT " . PREFIX . "_request
|
||||
SET
|
||||
rubric_id = '" . (int)$row->rubric_id . "',
|
||||
request_items_per_page = '" . $row->request_items_per_page . "',
|
||||
request_title = '" . $_REQUEST['cname'] . "',
|
||||
request_template_item = '" . addslashes($row->request_template_item) . "',
|
||||
request_template_main = '" . addslashes($row->request_template_main) . "',
|
||||
request_order_by = '" . addslashes($row->request_order_by) . "',
|
||||
request_order_by_nat = '" . addslashes($row->request_order_by_nat) . "',
|
||||
request_author_id = '" . (int)$_SESSION['user_id'] . "',
|
||||
request_created = '" . time() . "',
|
||||
request_description = '" . addslashes($row->request_description) . "',
|
||||
request_asc_desc = '" . $row->request_asc_desc . "',
|
||||
request_show_pagination = '" . $row->request_show_pagination . "',
|
||||
request_use_query = '" . $row->request_use_query . "',
|
||||
request_count_items = '" . $row->request_count_items . "',
|
||||
request_hide_current = '" . $row->request_hide_current . "',
|
||||
request_lang = '" . $row->request_lang . "',
|
||||
request_cache_elements = '" . (isset($row->request_cache_elements) ? $row->request_cache_elements : 0) . "'
|
||||
");
|
||||
|
||||
// Получаем id добавленной записи
|
||||
$iid = $AVE_DB->InsertId();
|
||||
|
||||
// Сохраняем системное сообщение в журнал
|
||||
reportLog($AVE_Template->get_config_vars('REQUEST_COPY_SUC') . ' (' . stripslashes(htmlspecialchars($this->get_request_by_id($request_id)->request_title, ENT_QUOTES)) . ') ( Id:'.$iid.' )');
|
||||
|
||||
// Выполняем запрос к БД и получаем все условия запроса для копируемого запроса
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT *
|
||||
FROM
|
||||
" . PREFIX . "_request_conditions
|
||||
WHERE
|
||||
request_id = '" . $request_id . "'
|
||||
");
|
||||
|
||||
// Обрабатываем полученные данные и
|
||||
while ($row_cond = $sql->FetchRow())
|
||||
{
|
||||
// Выполняем запрос к БД на добавление условий для нового, скопированного запроса
|
||||
$AVE_DB->Query("
|
||||
INSERT
|
||||
" . PREFIX . "_request_conditions
|
||||
SET
|
||||
request_id = '" . $iid . "',
|
||||
condition_compare = '" . $row_cond->condition_compare . "',
|
||||
condition_field_id = '" . $row_cond->condition_field_id . "',
|
||||
condition_value = '" . $row_cond->condition_value . "',
|
||||
condition_join = '" . $row_cond->condition_join . "'
|
||||
");
|
||||
}
|
||||
|
||||
// Выполянем переход к списку запросов
|
||||
header('Location:index.php?do=request&cp=' . SESSION);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для удаления запроса
|
||||
*
|
||||
* @param int $request_id идентификатор запроса
|
||||
*/
|
||||
function requestDelete($request_id)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
$request_name = $this->get_request_by_id($request_id)->request_title;
|
||||
|
||||
// Выполняем запрос к БД на удаление общей информации о запросе
|
||||
$AVE_DB->Query("
|
||||
DELETE FROM
|
||||
" . PREFIX . "_request
|
||||
WHERE
|
||||
Id = '" . $request_id . "'
|
||||
");
|
||||
|
||||
// Выполняем запрос к БД на удаление условий запроса
|
||||
$AVE_DB->Query("
|
||||
DELETE FROM
|
||||
" . PREFIX . "_request_conditions
|
||||
WHERE
|
||||
request_id = '" . $request_id . "'
|
||||
");
|
||||
|
||||
$AVE_DB->clearRequest($request_id);
|
||||
|
||||
// Сохраняем системное сообщение в журнал
|
||||
reportLog($AVE_Template->get_config_vars('REQUEST_DELETE_SUC') . ' (' . stripslashes(htmlspecialchars($request_name, ENT_QUOTES)) . ') ( Id:' . $request_id . ' )');
|
||||
|
||||
// Выполянем переход к списку запросов
|
||||
header('Location:index.php?do=request&cp=' . SESSION);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для редактирования условий Запроса
|
||||
*
|
||||
* @param int $request_id идентификатор запроса
|
||||
*/
|
||||
function requestConditionEdit($request_id)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
// Определяем действие пользователя
|
||||
switch ($_REQUEST['sub'])
|
||||
{
|
||||
// Если действие не определено
|
||||
case '':
|
||||
$fields = array();
|
||||
|
||||
// Выполняем запрос к БД и получаем список полей у той рубрики, к которой относится данный запрос
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT *
|
||||
FROM
|
||||
" . PREFIX . "_rubric_fields
|
||||
WHERE
|
||||
rubric_id = '" . $_REQUEST['rubric_id'] . "'
|
||||
ORDER BY rubric_field_position ASC
|
||||
");
|
||||
|
||||
// Обрабатываем полученные данные и формируем массив
|
||||
while ($row = $sql->FetchRow())
|
||||
array_push($fields, $row);
|
||||
|
||||
$conditions = array();
|
||||
|
||||
// Выполняем запрос к БД и получаем условия запроса
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT *
|
||||
FROM
|
||||
" . PREFIX . "_request_conditions
|
||||
WHERE
|
||||
request_id = '" . $request_id . "'
|
||||
ORDER BY condition_position ASC
|
||||
");
|
||||
|
||||
// Обрабатываем полученные данные и формируем массив
|
||||
while ($row = $sql->FetchRow())
|
||||
array_push($conditions, $row);
|
||||
|
||||
// Передаем данные в шаблон и отображаем страницу с редактированием условий
|
||||
$AVE_Template->assign('request_title', $this->get_request_by_id($request_id)->request_title);
|
||||
$AVE_Template->assign('fields', $fields);
|
||||
$AVE_Template->assign('conditions', $conditions);
|
||||
|
||||
if (isAjax() && (isset($_REQUEST['ajax']) && $_REQUEST['ajax'] == 1))
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('request/cond_list.tpl'));
|
||||
else
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('request/conditions.tpl'));
|
||||
|
||||
break;
|
||||
|
||||
case 'sort':
|
||||
|
||||
foreach ($_REQUEST['sort'] as $position => $cond_id)
|
||||
{
|
||||
$AVE_DB->Query("
|
||||
UPDATE
|
||||
" . PREFIX . "_request_conditions
|
||||
SET
|
||||
condition_position = '" . (int)$position . "'
|
||||
WHERE
|
||||
Id = '" . (int)$cond_id . "'
|
||||
");
|
||||
}
|
||||
|
||||
if (isAjax())
|
||||
{
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_SORTED');
|
||||
$header = $AVE_Template->get_config_vars('REQUEST_SUCCESS');
|
||||
$theme = 'accept';
|
||||
echo json_encode(array('message' => $message, 'header' => $header, 'theme' => $theme));
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
// Если пользователь нажал кнопку Сохранить изменения
|
||||
case 'save':
|
||||
// Если существует хотя бы одно условие, тогда
|
||||
|
||||
if (isset($_REQUEST['conditions']) && is_array($_POST['conditions']))
|
||||
{
|
||||
$condition_edited = false;
|
||||
|
||||
// Обрабатываем данные полей
|
||||
foreach ($_REQUEST['conditions'] as $condition_id => $val)
|
||||
{
|
||||
// Выполняем запрос к БД на обновление информации об условиях
|
||||
$AVE_DB->Query("
|
||||
UPDATE
|
||||
" . PREFIX . "_request_conditions
|
||||
SET
|
||||
request_id = '" . $request_id . "',
|
||||
condition_compare = '" . $val['condition_compare'] . "',
|
||||
condition_field_id = '" . $val['condition_field_id'] . "',
|
||||
condition_value = '" . (! empty($val['condition_value']) ? $val['condition_value'] : '') . "',
|
||||
condition_join = '" . $val['condition_join'] . "',
|
||||
condition_status = '" . ((! empty($val['condition_value'])) ? (($val['condition_status'] == '1') ? '1' : '0') : ''). "'
|
||||
WHERE
|
||||
Id = '" . $condition_id . "'
|
||||
");
|
||||
|
||||
$condition_edited = true;
|
||||
}
|
||||
|
||||
// Если изменения были, сохраняем системное сообщение в журнал
|
||||
if ($condition_edited)
|
||||
{
|
||||
reportLog('' . $AVE_Template->get_config_vars('REQUEST_COND_CHA_SUC') . ' (' . stripslashes(htmlspecialchars($this->get_request_by_id($request_id)->request_title, ENT_QUOTES)) . ') - ( Id: '.$request_id.' )');
|
||||
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_COND_POST_OK');
|
||||
$header = $AVE_Template->get_config_vars('REQUEST_SUCCESS');
|
||||
$theme = 'accept';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_COND_POST_ERR');
|
||||
$header = $AVE_Template->get_config_vars('REQUEST_ERROR');
|
||||
$theme = 'error';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_COND_NO_POST');
|
||||
$header = $AVE_Template->get_config_vars('REQUEST_ERROR');
|
||||
$theme = 'error';
|
||||
}
|
||||
|
||||
// Если некоторые из условий были помечены на удаление
|
||||
if (isset($_POST['del']) && is_array($_POST['del']))
|
||||
{
|
||||
// Обрабатываем все поля помеченные на удаление
|
||||
foreach ($_POST['del'] as $condition_id => $val)
|
||||
{
|
||||
// Выполняем запрос к БД на удаление условий
|
||||
$AVE_DB->Query("
|
||||
DELETE FROM
|
||||
" . PREFIX . "_request_conditions
|
||||
WHERE
|
||||
Id = '" . $condition_id . "'
|
||||
");
|
||||
}
|
||||
|
||||
// Сохраняем системное сообщение в журнал
|
||||
reportLog('' . $AVE_Template->get_config_vars('REQUEST_COND_DEL_SUC') . ' (' . stripslashes(htmlspecialchars($this->get_request_by_id($request_id)->request_title, ENT_QUOTES)) . ') - ( Id: '.$request_id.' )');
|
||||
}
|
||||
|
||||
// Нет смысла каждый раз формировать SQL-запрос с условиями Запроса
|
||||
// поэтому формируем SQL-запрос только при изменении условий
|
||||
// require(BASE_DIR . '/functions/func.parserequest.php');
|
||||
request_get_condition_sql_string($request_id, true);
|
||||
|
||||
$AVE_DB->Query("
|
||||
UPDATE
|
||||
" . PREFIX . "_request
|
||||
SET
|
||||
request_changed = '" . time() . "'
|
||||
WHERE
|
||||
Id = '" . $request_id . "'
|
||||
");
|
||||
|
||||
$AVE_DB->clearRequest($request_id);
|
||||
|
||||
if (! isAjax())
|
||||
{
|
||||
// Выполняем обновление страницы
|
||||
header('Location:index.php?do=request&action=conditions&rubric_id=' . $_REQUEST['rubric_id'] . '&Id=' . $request_id . '&cp=' . SESSION . ($_REQUEST['pop'] ? '&pop=1' : ''));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('message' => $message, 'header' => $header, 'theme' => $theme));
|
||||
exit;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// Если пользователь добавил новое условие
|
||||
case 'new':
|
||||
if ($_POST['new_value'] !== '')
|
||||
{
|
||||
// Выполняем запрос к БД на добавление нового условия
|
||||
$sql = $AVE_DB->Query("
|
||||
INSERT
|
||||
" . PREFIX . "_request_conditions
|
||||
SET
|
||||
request_id = '" . $request_id . "',
|
||||
condition_compare = '" . $_POST['new_operator'] . "',
|
||||
condition_field_id = '" . $_POST['field_new'] . "',
|
||||
condition_value = '" . $_POST['new_value'] . "',
|
||||
condition_join = '" . $_POST['oper_new'] . "'
|
||||
");
|
||||
|
||||
if ($sql->_result === false)
|
||||
{
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_COND_NEW_ERR');
|
||||
$header = $AVE_Template->get_config_vars('REQUEST_ERROR');
|
||||
$theme = 'error';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Сохраняем системное сообщение в журнал
|
||||
reportLog('' . $AVE_Template->get_config_vars('REQUEST_COND_ADD_SUC') . ' (' . stripslashes(htmlspecialchars($this->get_request_by_id($request_id)->request_title, ENT_QUOTES)) . ') - ( Id: '.$request_id.' )');
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_COND_VALUE_ERR');
|
||||
$header = $AVE_Template->get_config_vars('REQUEST_ERROR');
|
||||
$theme = 'error';
|
||||
}
|
||||
|
||||
// Нет смысла каждый раз формировать SQL-запрос с условиями Запроса
|
||||
// поэтому формируем SQL-запрос только при изменении условий
|
||||
// require(BASE_DIR . '/functions/func.parserequest.php');
|
||||
request_get_condition_sql_string($request_id, true);
|
||||
|
||||
$AVE_DB->Query("
|
||||
UPDATE
|
||||
" . PREFIX . "_request
|
||||
SET
|
||||
request_changed = '" . time() . "'
|
||||
WHERE
|
||||
Id = '" . $request_id . "'
|
||||
");
|
||||
|
||||
$AVE_DB->clearRequest($request_id);
|
||||
|
||||
if (! isAjax())
|
||||
{
|
||||
header('Location:index.php?do=request&action=conditions&rubric_id=' . $_REQUEST['rubric_id'] . '&Id=' . $request_id . '&cp=' . SESSION);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! $message)
|
||||
{
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_COND_NEW_SUC');
|
||||
$header = $AVE_Template->get_config_vars('REQUEST_SUCCESS');
|
||||
$theme = 'accept';
|
||||
}
|
||||
|
||||
echo json_encode(array('message' => $message, 'header' => $header, 'theme' => $theme));
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $field_id
|
||||
* @param $cond_id
|
||||
*/
|
||||
function conditionFieldChange($field_id, $cond_id)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
// Передаем данные в шаблон и отображаем страницу с редактированием условий
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('cond_id', $cond_id);
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('request/change.tpl'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $field_id
|
||||
* @param $cond_id
|
||||
*/
|
||||
function conditionFieldChangeSave($field_id, $cond_id)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
// ToDo
|
||||
$sql = $AVE_DB->Query("
|
||||
UPDATE
|
||||
" . PREFIX . "_request_conditions
|
||||
SET
|
||||
condition_field_id = '" . $field_id . "'
|
||||
WHERE
|
||||
Id = '" . $cond_id . "'
|
||||
");
|
||||
|
||||
request_get_condition_sql_string((int)$_REQUEST['req_id'], true);
|
||||
|
||||
$request_id = $AVE_DB->Query("
|
||||
SELECT
|
||||
request_id
|
||||
FROM
|
||||
" . PREFIX . "_request_conditions
|
||||
WHERE
|
||||
Id = '" . $cond_id . "'
|
||||
")->GetCell();
|
||||
|
||||
$AVE_DB->Query("
|
||||
UPDATE
|
||||
" . PREFIX . "_request
|
||||
SET
|
||||
request_changed = '" . time() . "'
|
||||
WHERE
|
||||
Id = '" . $request_id . "'
|
||||
");
|
||||
|
||||
$AVE_DB->clearRequest($request_id);
|
||||
|
||||
// Передаем данные в шаблон и отображаем страницу с редактированием условий
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('cond_id', $cond_id);
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('request/change.tpl'));
|
||||
}
|
||||
}
|
||||
?>
|
1433
inc/query_variants/original_files/functions/func.parserequest.php
Normal file
1433
inc/query_variants/original_files/functions/func.parserequest.php
Normal file
File diff suppressed because it is too large
Load Diff
33
inc/query_variants/query_manifest.php
Normal file
33
inc/query_variants/query_manifest.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASE_DIR')) exit;
|
||||
/**
|
||||
* Список всех активных файлов запросов, которые должны быть заменены.
|
||||
*/
|
||||
$query_files_manifest = [
|
||||
// ------------------------------------
|
||||
// Админка (Admin) - PHP и шаблоны
|
||||
// ------------------------------------
|
||||
'admin/request.php',
|
||||
'admin/templates/request/change.tpl',
|
||||
'admin/templates/request/conditions.tpl',
|
||||
'admin/templates/request/cond_list.tpl',
|
||||
'admin/templates/request/form.tpl',
|
||||
'admin/templates/request/nav.tpl',
|
||||
'admin/templates/request/list.tpl',
|
||||
'admin/templates/request/request.tpl',
|
||||
|
||||
// ------------------------------------
|
||||
// Функциональные файлы (Class, Functions)
|
||||
// ------------------------------------
|
||||
'class/class.request.php',
|
||||
'functions/func.parserequest.php',
|
||||
|
||||
// ------------------------------------
|
||||
// Публичный шаблон (Templates)
|
||||
// ------------------------------------
|
||||
'templates/default/tpl/request/public.tpl',
|
||||
];
|
||||
|
||||
return $query_files_manifest;
|
||||
?>
|
102
inc/query_variants/safe_files/admin/request.php
Normal file
102
inc/query_variants/safe_files/admin/request.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @subpackage admin
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
if (!defined("ACP"))
|
||||
{
|
||||
header("Location:index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
require(BASE_DIR . "/class/class.request.php");
|
||||
require(BASE_DIR . "/class/class.docs.php");
|
||||
require(BASE_DIR . "/class/class.rubs.php");
|
||||
|
||||
$AVE_Request = new AVE_Request;
|
||||
$AVE_Document = new AVE_Document;
|
||||
$AVE_Rubric = new AVE_Rubric;
|
||||
|
||||
$AVE_Rubric->rubricPermissionFetch();
|
||||
|
||||
$AVE_Template->config_load(BASE_DIR . "/admin/lang/" . $_SESSION['admin_language'] . "/request.txt", 'request');
|
||||
|
||||
switch ($_REQUEST['action'])
|
||||
{
|
||||
case '':
|
||||
if(check_permission_acp('request'))
|
||||
{
|
||||
$AVE_Request->requestListShow();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
if(check_permission_acp('request_edit'))
|
||||
{
|
||||
$AVE_Rubric->rubricTemplateShow(0, 1);
|
||||
$AVE_Request->requestEdit((int)$_REQUEST['Id']);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'copy':
|
||||
if(check_permission_acp('request'))
|
||||
{
|
||||
$AVE_Request->requestCopy((int)$_REQUEST['Id']);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'new':
|
||||
if(check_permission_acp('request_new'))
|
||||
{
|
||||
$AVE_Rubric->rubricTemplateShow(0, 1);
|
||||
$AVE_Request->requestNew();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete_query':
|
||||
if(check_permission_acp('request_del'))
|
||||
{
|
||||
$AVE_Request->requestDelete((int)$_REQUEST['Id']);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'conditions':
|
||||
if(check_permission_acp('request_edit'))
|
||||
{
|
||||
$AVE_Rubric->rubricTemplateShow(0, 1);
|
||||
$AVE_Request->requestConditionEdit((int)$_REQUEST['Id']);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'change':
|
||||
if(check_permission_acp('request_edit'))
|
||||
{
|
||||
switch($_REQUEST['sub'])
|
||||
{
|
||||
case '':
|
||||
$AVE_Rubric->rubricTemplateShow(0, 1);
|
||||
$AVE_Request->conditionFieldChange((int)$_REQUEST['field_id'], (int)$_REQUEST['cond_id']);
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
$AVE_Rubric->rubricTemplateShow(0, 1);
|
||||
$AVE_Request->conditionFieldChangeSave((int)$_REQUEST['field_id'], (int)$_REQUEST['cond_id']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'alias':
|
||||
if (check_permission_acp('request_edit'))
|
||||
{
|
||||
echo $AVE_Request->requestValidate($_REQUEST['alias'], (int)$_REQUEST['id']);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
@@ -0,0 +1,39 @@
|
||||
{if $smarty.request.sub == ''}
|
||||
<div id="req_cond_{$cond_id}" stye="text-align: left;">
|
||||
<select class="mousetrap" name="conditions[{$cond_id}][condition_field_id]" id="form_cond_{$cond_id}">
|
||||
{foreach from=$fields_list item=field_group}
|
||||
|
||||
{if $groups_count > 1}
|
||||
<optgroup label="{if $field_group.group_title}{$field_group.group_title}{else}{#REQUEST_FIELD_G_UNKNOW#}{/if}">
|
||||
{/if}
|
||||
|
||||
{foreach from=$field_group.fields item=field}
|
||||
<option value="{$field.Id|escape}" {if $field_id ==$field.Id}selected{/if}>{$field.rubric_field_title|escape} (ID: {$field.Id|escape})</option>
|
||||
{/foreach}
|
||||
|
||||
{if $groups_count > 1}
|
||||
</optgroup>
|
||||
{/if}
|
||||
|
||||
{/foreach}
|
||||
</select>
|
||||
|
||||
<input type="submit" class="basicBtn SaveChange" data-id="{$cond_id}" data-field="{$field_id}" value="Ok">
|
||||
<script>
|
||||
AveAdmin.ajax();
|
||||
</script>
|
||||
</div>
|
||||
{else}
|
||||
{foreach from=$fields_list item=field_group}
|
||||
|
||||
{foreach from=$field_group.fields item=field}
|
||||
{if $field_id == $field.Id}
|
||||
<div id="req_cond_{$cond_id}">
|
||||
<a href="javascript:void(0);" class="link change_field" data-id="{$field.Id|escape}" data-cond="{$cond_id}">{$field.rubric_field_title|escape} (ID: {$field.Id|escape})</a>
|
||||
<input type="hidden" name="conditions[{$cond_id}][condition_field_id]" value="{$field.Id|escape}" />
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
|
||||
{/foreach}
|
||||
{/if}
|
@@ -0,0 +1,112 @@
|
||||
<div id="conditions">
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic" id="conditions">
|
||||
<col width="30">
|
||||
<col width="30">
|
||||
<col width="300">
|
||||
<col width="300">
|
||||
<col width="80">
|
||||
<col width="">
|
||||
<col width="30">
|
||||
<col>
|
||||
<thead>
|
||||
<tr>
|
||||
<td width="1"><div align="center"><span class="icon_sprite ico_move"></span></div></td>
|
||||
<td width="1"><div align="center"><span class="icon_sprite ico_ok"></span></div></td>
|
||||
<td>{#REQUEST_FROM_FILED#}</td>
|
||||
<td>{#REQUEST_OPERATOR#}</td>
|
||||
<td>{#REQUEST_CONDITION_JOIN#}</td>
|
||||
<td>{#REQUEST_VALUE#}</td>
|
||||
<td width="1"><div align="center"><span class="icon_sprite ico_delete"></span></div></td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
{if $conditions}
|
||||
<tbody>
|
||||
{foreach name=cond from=$conditions item=condition}
|
||||
<tr class="cond_tr" data-id="cond_{$condition->Id}">
|
||||
<td><span class="icon_sprite ico_move" style="cursor: move;"></span></td>
|
||||
<td><input title="{#REQUEST_MARK_STATUS#}" name="conditions[{$condition->Id}][condition_status]" type="checkbox" id="condition_status{$condition->Id}" value="1" {if $condition->condition_status ==1}checked{/if} class="toprightDir float" /></td>
|
||||
|
||||
<td align="center">
|
||||
{foreach from=$fields_list item=field_group}
|
||||
|
||||
{foreach from=$field_group.fields item=field}
|
||||
{if $condition->condition_field_id == $field.Id}
|
||||
<div id="req_cond_{$condition->Id}">
|
||||
<a href="javascript:void(0);" class="link change_field" data-id="{$field.Id|escape}" data-cond="{$condition->Id}">{$field.rubric_field_title|escape} (ID: {$field.Id|escape})</a>
|
||||
<input type="hidden" name="conditions[{$condition->Id}][condition_field_id]" value="{$field.Id|escape}" />
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
|
||||
{/foreach}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<select style="max-height: 100px;" name="conditions[{$condition->Id}][condition_compare]" id="operator_{$condition->Id}">
|
||||
<option value="==" {if $condition->condition_compare=='=='}selected{/if}>{#REQUEST_COND_SELF#}</option>
|
||||
<option value="!=" {if $condition->condition_compare=='!='}selected{/if}>{#REQUEST_COND_NOSELF#}</option>
|
||||
<option value="%%" {if $condition->condition_compare=='%%'}selected{/if}>{#REQUEST_COND_USE#}</option>
|
||||
<option value="--" {if $condition->condition_compare=='--'}selected{/if}>{#REQUEST_COND_NOTUSE#}</option>
|
||||
<option value="%" {if $condition->condition_compare=='%'}selected{/if}>{#REQUEST_COND_START#}</option>
|
||||
<option value="<=" {if $condition->condition_compare=='<='}selected{/if}>{#REQUEST_SMALL1#}</option>
|
||||
<option value=">=" {if $condition->condition_compare=='>='}selected{/if}>{#REQUEST_BIG1#}</option>
|
||||
<option value="<" {if $condition->condition_compare=='<'}selected{/if}>{#REQUEST_SMALL2#}</option>
|
||||
<option value=">" {if $condition->condition_compare=='>'}selected{/if}>{#REQUEST_BIG2#}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<select style="width:60px" name="conditions[{$condition->Id}][condition_join]">
|
||||
<option value="AND" {if $condition->condition_join=='AND'}selected{/if}>{#REQUEST_CONR_AND#}</option>
|
||||
<option value="OR" {if $condition->condition_join=='OR'}selected{/if}>{#REQUEST_CONR_OR#}</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><div class="pr12"><input name="conditions[{$condition->Id}][condition_value]" type="text" id="Wert_{$condition->Id}" value="{$condition->condition_value|escape}" class="mousetrap" /> </div></td>
|
||||
<td><input title="{#REQUEST_MARK_DELETE#}" name="del[{$condition->Id}]" type="checkbox" id="del_{$condition->Id}" value="1" class="topleftDir float" /></td>
|
||||
</tr>
|
||||
|
||||
{/foreach}
|
||||
</tbody>
|
||||
{else}
|
||||
<tr class="noborder">
|
||||
<td colspan="7">
|
||||
<ul class="messages">
|
||||
<li class="highlight yellow">{#REQUEST_COND_MESSAGE#}</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
</table>
|
||||
|
||||
{if $conditions}
|
||||
<div class="rowElem"<div class="rowElem"{if !$smarty.request.pop} id="saveBtn"{/if}>
|
||||
<div{if !$smarty.request.pop} class="saveBtn"{/if}>
|
||||
<input type="submit" value="{#REQUEST_BUTTON_SAVE#}" class="basicBtn" />
|
||||
{#REQUEST_OR#}
|
||||
<input type="submit" value="{#REQUEST_BUTTON_SAVE_NEXT#}" class="button blackBtn SaveEditCond" />
|
||||
{if $smarty.request.pop}
|
||||
<input onclick="javascript:void(0);" type="button" class="redBtn Close" value="{#REQUEST_BUTTON_CLOSE#}" />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{if $conditions}
|
||||
<script language="javascript">
|
||||
$(document).ready(function(){ldelim}
|
||||
AveAdmin.ajax();
|
||||
|
||||
$('#conditions').tableSortable({ldelim}
|
||||
items: '.cond_tr',
|
||||
url: 'index.php?do=request&action=conditions&sub=sort&rubric_id={$smarty.request.rubric_id|escape}&Id={$smarty.request.Id|escape}&cp={$sess}',
|
||||
success: true
|
||||
{rdelim});
|
||||
|
||||
$.alerts._overlay('hide');
|
||||
|
||||
{rdelim});
|
||||
</script>
|
||||
{/if}
|
@@ -0,0 +1,391 @@
|
||||
<script language="Javascript" type="text/javascript">
|
||||
var sess = '{$sess}';
|
||||
</script>
|
||||
|
||||
<div class="title {if $smarty.request.pop}first{/if}">
|
||||
<h5>{#REQUEST_CONDITIONS#}</h5>
|
||||
</div>
|
||||
|
||||
<div class="widget" style="margin-top: 0px;">
|
||||
<div class="body">
|
||||
{#REQUEST_CONDITION_TIP#}
|
||||
</div>
|
||||
</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=request&cp={$sess}">{#REQUEST_ALL#}</a></li>
|
||||
<li>{#REQUEST_CONDITIONS#}</li>
|
||||
<li><strong class="code">{$request_title|escape|stripslashes}</strong></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form class="mainForm" action="index.php?do=request&action=conditions&sub=new&rubric_id={$smarty.request.rubric_id|escape}&Id={$smarty.request.Id|escape}&cp={$sess}" method="post" id="NewCond">
|
||||
|
||||
<div class="widget first">
|
||||
|
||||
<div class="head" id="opened">
|
||||
<h5 class="iFrames">{#REQUEST_NEW_CONDITION#}</h5>
|
||||
</div>
|
||||
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
|
||||
<col width="150">
|
||||
<col width="300">
|
||||
<col width="80">
|
||||
<col width="">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>{#REQUEST_FROM_FILED#}</td>
|
||||
<td>{#REQUEST_OPERATOR#}</td>
|
||||
<td>{#REQUEST_CONDITION_JOIN#}</td>
|
||||
<td>{#REQUEST_VALUE#}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<select name="field_new" id="field_new" style="width:300px; max-height:80px;">
|
||||
|
||||
<option> </option>
|
||||
{foreach from=$fields_list item=field_group}
|
||||
|
||||
{if $groups_count > 1}
|
||||
<optgroup label="{if $field_group.group_title}{$field_group.group_title}{else}{#REQUEST_FIELD_G_UNKNOW#}{/if}">
|
||||
{/if}
|
||||
|
||||
{foreach from=$field_group.fields item=field}
|
||||
<option value="{$field.Id|escape}">{$field.rubric_field_title|escape} (ID: {$field.Id|escape})</option>
|
||||
{/foreach}
|
||||
|
||||
{if $groups_count > 1}
|
||||
</optgroup>
|
||||
{/if}
|
||||
|
||||
{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<select style="max-height: 80px;" name="new_operator" id="new_operator">
|
||||
<option value="==" selected>{#REQUEST_COND_SELF#}</option>
|
||||
<option value="!=">{#REQUEST_COND_NOSELF#}</option>
|
||||
<option value="%%">{#REQUEST_COND_USE#}</option>
|
||||
<option value="--">{#REQUEST_COND_NOTUSE#}</option>
|
||||
<option value="%">{#REQUEST_COND_START#}</option>
|
||||
<option value="<=">{#REQUEST_SMALL1#}</option>
|
||||
<option value=">=">{#REQUEST_BIG1#}</option>
|
||||
<option value="<">{#REQUEST_SMALL2#}</option>
|
||||
<option value=">">{#REQUEST_BIG2#}</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td style="width:60px; max-height: 100px;">
|
||||
<select style="width:60px" name="oper_new" id="oper_new">
|
||||
<option value="AND" {if $condition->condition_join=='AND'}selected{/if}>{#REQUEST_CONR_AND#}</option>
|
||||
<option value="OR" {if $condition->condition_join=='OR'}selected{/if}>{#REQUEST_CONR_OR#}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<div class="pr12"><input name="new_value" type="text" id="new_value" value="" /></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<input type="submit" value="{#REQUEST_CONDITION_ADD#}" class="basicBtn AddNewCond" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="fix"></div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form class="mainForm" action="index.php?do=request&action=conditions&sub=save&rubric_id={$smarty.request.rubric_id|escape}&Id={$smarty.request.Id|escape}&cp={$sess}" method="post" id="CondList">
|
||||
<div class="widget first">
|
||||
<div class="head"><h5 class="iFrames">{#REQUEST_CONDITION#}</h5>
|
||||
{if !$smarty.request.pop}
|
||||
<div class="num">
|
||||
<a class="basicNum" href="index.php?do=request&action=edit&Id={$smarty.request.Id|escape}&rubric_id={$smarty.request.rubric_id|escape}&cp={$sess}">{#REQUEST_EDIT#}</a>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div id="conditions">
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
|
||||
<col width="30">
|
||||
<col width="30">
|
||||
<col width="300">
|
||||
<col width="300">
|
||||
<col width="80">
|
||||
<col width="auto">
|
||||
<col width="30">
|
||||
<col>
|
||||
<thead>
|
||||
<tr>
|
||||
<td width="1"><div align="center"><span class="icon_sprite ico_move"></span></div></td>
|
||||
<td width="1"><div align="center"><span class="icon_sprite ico_ok"></span></div></td>
|
||||
<td>{#REQUEST_FROM_FILED#}</td>
|
||||
<td>{#REQUEST_OPERATOR#}</td>
|
||||
<td>{#REQUEST_CONDITION_JOIN#}</td>
|
||||
<td>{#REQUEST_VALUE#}</td>
|
||||
<td width="1"><div align="center"><span class="icon_sprite ico_delete"></span></div></td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
{if $conditions}
|
||||
<tbody>
|
||||
{foreach name=cond from=$conditions item=condition}
|
||||
<tr class="cond_tr" data-id="cond_{$condition->Id}">
|
||||
<td><span class="icon_sprite ico_move" style="cursor: move;"></span></td>
|
||||
<td><input title="{#REQUEST_MARK_STATUS#}" name="conditions[{$condition->Id}][condition_status]" type="checkbox" id="condition_status{$condition->Id}" value="1" {if $condition->condition_status ==1}checked{/if} class="toprightDir float"/></td>
|
||||
|
||||
<td align="center">
|
||||
|
||||
{foreach from=$fields_list item=field_group}
|
||||
|
||||
{foreach from=$field_group.fields item=field}
|
||||
{if $condition->condition_field_id == $field.Id}
|
||||
<div id="req_cond_{$condition->Id}">
|
||||
<a href="javascript:void(0);" class="link change_field" data-id="{$field.Id|escape}" data-cond="{$condition->Id}">{$field.rubric_field_title|escape} (ID: {$field.Id|escape})</a>
|
||||
<input type="hidden" name="conditions[{$condition->Id}][condition_field_id]" value="{$field.Id|escape}" />
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
|
||||
{/foreach}
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<select style="max-height: 100px;" name="conditions[{$condition->Id}][condition_compare]" id="operator_{$condition->Id}">
|
||||
<option value="==" {if $condition->condition_compare=='=='}selected{/if}>{#REQUEST_COND_SELF#}</option>
|
||||
<option value="!=" {if $condition->condition_compare=='!='}selected{/if}>{#REQUEST_COND_NOSELF#}</option>
|
||||
<option value="%%" {if $condition->condition_compare=='%%'}selected{/if}>{#REQUEST_COND_USE#}</option>
|
||||
<option value="--" {if $condition->condition_compare=='--'}selected{/if}>{#REQUEST_COND_NOTUSE#}</option>
|
||||
<option value="%" {if $condition->condition_compare=='%'}selected{/if}>{#REQUEST_COND_START#}</option>
|
||||
<option value="<=" {if $condition->condition_compare=='<='}selected{/if}>{#REQUEST_SMALL1#}</option>
|
||||
<option value=">=" {if $condition->condition_compare=='>='}selected{/if}>{#REQUEST_BIG1#}</option>
|
||||
<option value="<" {if $condition->condition_compare=='<'}selected{/if}>{#REQUEST_SMALL2#}</option>
|
||||
<option value=">" {if $condition->condition_compare=='>'}selected{/if}>{#REQUEST_BIG2#}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<select style="width:60px" name="conditions[{$condition->Id}][condition_join]">
|
||||
<option value="AND" {if $condition->condition_join=='AND'}selected{/if}>{#REQUEST_CONR_AND#}</option>
|
||||
<option value="OR" {if $condition->condition_join=='OR'}selected{/if}>{#REQUEST_CONR_OR#}</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><div class="pr12"><input name="conditions[{$condition->Id}][condition_value]" type="text" id="Wert_{$condition->Id}" value="{$condition->condition_value|escape}" class="mousetrap" /> </div></td>
|
||||
<td><input title="{#REQUEST_MARK_DELETE#}" name="del[{$condition->Id}]" type="checkbox" id="del_{$condition->Id}" value="1" class="topleftDir float" /></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
{else}
|
||||
<tr class="noborder">
|
||||
<td colspan="7">
|
||||
<ul class="messages">
|
||||
<li class="highlight yellow">{#REQUEST_COND_MESSAGE#}</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
</table>
|
||||
{if $conditions}
|
||||
<div class="rowElem"{if !$smarty.request.pop} id="saveBtn"{/if}>
|
||||
<div {if !$smarty.request.pop} class="saveBtn"{/if}>
|
||||
<input type="submit" value="{#REQUEST_BUTTON_SAVE#}" class="basicBtn" />
|
||||
{#REQUEST_OR#}
|
||||
<input type="submit" value="{#REQUEST_BUTTON_SAVE_NEXT#}" class="button blackBtn SaveEditCond" />
|
||||
{if $smarty.request.pop}
|
||||
<input onclick="javascript:void(0);" type="button" class="redBtn Close" value="{#REQUEST_BUTTON_CLOSE#}" />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="fix"></div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<script type="text/javascript" language="JavaScript">
|
||||
$(document).ready(function(){ldelim}
|
||||
|
||||
{if check_permission('request_edit')}
|
||||
|
||||
{if $smarty.request.onlycontent}
|
||||
AveAdmin.ajax();
|
||||
{/if}
|
||||
|
||||
// сортировка
|
||||
$('#conditions').tableSortable({ldelim}
|
||||
items: '.cond_tr',
|
||||
url: 'index.php?do=request&action=conditions&sub=sort&rubric_id={$smarty.request.rubric_id|escape}&Id={$smarty.request.Id|escape}&cp={$sess}',
|
||||
success: true
|
||||
{rdelim});
|
||||
|
||||
Mousetrap.bind(['ctrl+s', 'command+s'], function(event) {ldelim}
|
||||
event.preventDefault();
|
||||
$("#CondList").ajaxSubmit({ldelim}
|
||||
url: 'index.php?do=request&action=conditions&sub=save&rubric_id={$smarty.request.rubric_id|escape}&Id={$smarty.request.Id|escape}&cp={$sess}&ajax=1{if $smarty.request.pop}&pop=1{/if}',
|
||||
dataType: 'json',
|
||||
beforeSubmit: function(){ldelim}
|
||||
$.alerts._overlay('show');
|
||||
{rdelim},
|
||||
success: function(data){ldelim}
|
||||
$.jGrowl(data['message'], {ldelim}
|
||||
header: data['header'],
|
||||
theme: data['theme']
|
||||
{rdelim});
|
||||
ajaxConditions();
|
||||
{rdelim}
|
||||
{rdelim});
|
||||
return false;
|
||||
{rdelim});
|
||||
|
||||
$(".AddNewCond").on('click', function(event){ldelim}
|
||||
event.preventDefault();
|
||||
$("#NewCond").ajaxSubmit({ldelim}
|
||||
url: 'index.php?do=request&action=conditions&sub=new&rubric_id={$smarty.request.rubric_id|escape}&Id={$smarty.request.Id|escape}&cp={$sess}&ajax=1{if $smarty.request.pop}&pop=1{/if}',
|
||||
dataType: 'json',
|
||||
beforeSubmit: function(){ldelim}
|
||||
$.alerts._overlay('show');
|
||||
{rdelim},
|
||||
success: function(data){ldelim}
|
||||
if (data['theme'] == 'accept'){ldelim}
|
||||
resetForms();
|
||||
ajaxConditions();
|
||||
{rdelim}
|
||||
else
|
||||
{ldelim}
|
||||
$.alerts._overlay('hide');
|
||||
{rdelim}
|
||||
$.jGrowl(data['message'], {ldelim}
|
||||
header: data['header'],
|
||||
theme: data['theme']
|
||||
{rdelim});
|
||||
{rdelim}
|
||||
{rdelim});
|
||||
return false;
|
||||
{rdelim});
|
||||
|
||||
function ajaxConditions(){ldelim}
|
||||
$.ajax({ldelim}
|
||||
url: 'index.php?do=request&action=conditions&rubric_id={$smarty.request.rubric_id|escape}&Id={$smarty.request.Id|escape}&cp={$sess}&ajax=1&onlycontent=1{if $smarty.request.pop}&pop=1{/if}',
|
||||
type: 'POST',
|
||||
beforeSend: function () {ldelim}
|
||||
{rdelim},
|
||||
success: function (data) {ldelim}
|
||||
$("#conditions").before(data).remove();
|
||||
SaveEditCond();
|
||||
{rdelim}
|
||||
{rdelim});
|
||||
{rdelim}
|
||||
|
||||
function SaveEditCond(){ldelim}
|
||||
$(".SaveEditCond").on('click', function(event){ldelim}
|
||||
event.preventDefault();
|
||||
$("#CondList").ajaxSubmit({ldelim}
|
||||
url: 'index.php?do=request&action=conditions&sub=save&rubric_id={$smarty.request.rubric_id|escape}&Id={$smarty.request.Id|escape}&cp={$sess}&ajax=1{if $smarty.request.pop}&pop=1{/if}',
|
||||
dataType: 'json',
|
||||
beforeSubmit: function(){ldelim}
|
||||
$.alerts._overlay('show');
|
||||
{rdelim},
|
||||
success: function(data){ldelim}
|
||||
$.jGrowl(data['message'], {ldelim}
|
||||
header: data['header'],
|
||||
theme: data['theme']
|
||||
{rdelim});
|
||||
ajaxConditions();
|
||||
{rdelim}
|
||||
{rdelim});
|
||||
return false;
|
||||
{rdelim});
|
||||
{rdelim};
|
||||
|
||||
$(document).on('click', '.Close', function(event){ldelim}
|
||||
event.preventDefault();
|
||||
$('#ajax-dialog-conditions-{$smarty.request.Id|escape}').dialog('destroy').remove();
|
||||
return false;
|
||||
{rdelim});
|
||||
|
||||
function resetForms(){ldelim}
|
||||
$('#NewCond select').prop('selectedIndex',0);
|
||||
$('#NewCond select').trigger('refresh');
|
||||
$('#NewCond input[type=text]').val('');
|
||||
{rdelim}
|
||||
|
||||
$(document).on('click', '.change_field', function(event)
|
||||
{ldelim}
|
||||
event.preventDefault();
|
||||
|
||||
var field_id = $(this).attr('data-id');
|
||||
var cond_id = $(this).attr('data-cond');
|
||||
|
||||
$.ajax({ldelim}
|
||||
url: 'index.php?do=request&action=change&sub=&cp=' + sess + '&onlycontent=1',
|
||||
data: {ldelim}
|
||||
req_id: {$smarty.request.Id},
|
||||
cond_id: cond_id,
|
||||
field_id: field_id,
|
||||
rubric_id: {$smarty.request.rubric_id}
|
||||
{rdelim},
|
||||
type: 'POST',
|
||||
beforeSend: function(){ldelim}
|
||||
$.alerts._overlay('show');
|
||||
{rdelim},
|
||||
success: function (data)
|
||||
{ldelim}
|
||||
$("#req_cond_" + cond_id).before(data).remove();
|
||||
$.alerts._overlay('hide');
|
||||
{rdelim}
|
||||
{rdelim});
|
||||
|
||||
return false;
|
||||
{rdelim});
|
||||
|
||||
|
||||
$(document).on('click', '.SaveChange', function(event)
|
||||
{ldelim}
|
||||
event.preventDefault();
|
||||
|
||||
var cond_id = $(this).attr('data-id');
|
||||
var data = $('#form_cond_' + cond_id).val();
|
||||
|
||||
$.ajax({ldelim}
|
||||
url: 'index.php?do=request&action=change&sub=save&cp=' + sess + '&onlycontent=1',
|
||||
data: {ldelim}
|
||||
req_id: {$smarty.request.Id},
|
||||
cond_id: cond_id,
|
||||
field_id: data,
|
||||
rubric_id: {$smarty.request.rubric_id}
|
||||
{rdelim},
|
||||
type: 'POST',
|
||||
beforeSend: function(){ldelim}
|
||||
$.alerts._overlay('show');
|
||||
{rdelim},
|
||||
success: function (data)
|
||||
{ldelim}
|
||||
$("#req_cond_" + cond_id).before(data).remove();
|
||||
$.alerts._overlay('hide');
|
||||
{rdelim}
|
||||
{rdelim});
|
||||
|
||||
return false;
|
||||
{rdelim});
|
||||
|
||||
|
||||
SaveEditCond();
|
||||
|
||||
{/if}
|
||||
|
||||
{rdelim});
|
||||
</script>
|
779
inc/query_variants/safe_files/admin/templates/request/form.tpl
Normal file
779
inc/query_variants/safe_files/admin/templates/request/form.tpl
Normal file
@@ -0,0 +1,779 @@
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
/*<![CDATA[*/
|
||||
|
||||
$rid = parseInt('{$rid}');
|
||||
$sess = '{$sess}';
|
||||
|
||||
var clipboard = new Clipboard('.copyBtn');
|
||||
|
||||
function changeRub(select) {ldelim}
|
||||
if(select.options[select.selectedIndex].value!='#') {ldelim}
|
||||
|
||||
if(select.options[select.selectedIndex].value!='#') {ldelim}
|
||||
{if $smarty.request.action=='new'}
|
||||
location.href='index.php?do=request&action=new&rubric_id=' + select.options[select.selectedIndex].value + '{if $smarty.request.request_title_new!=''}&request_title_new={$smarty.request.request_title_new|escape|stripslashes}{/if}';
|
||||
{else}
|
||||
location.href='index.php?do=request&action=edit&Id={$smarty.request.Id|escape}&rubric_id=' + select.options[select.selectedIndex].value;
|
||||
{/if}
|
||||
{rdelim}
|
||||
|
||||
else {ldelim}
|
||||
document.getElementById('RubrikId_{$smarty.request.rubric_id|escape}').selected = 'selected';
|
||||
{rdelim}
|
||||
{rdelim}
|
||||
{rdelim}
|
||||
/*]]>*/
|
||||
</script>
|
||||
|
||||
{if $smarty.request.action=='edit'}
|
||||
<div class="title">
|
||||
<h5>{#REQUEST_EDIT2#}</h5>
|
||||
<div class="num">
|
||||
<a class="basicNum" href="index.php?do=request&action=conditions&Id={$rid}&rubric_id={$smarty.request.rubric_id|escape}&cp={$sess}">{#REQUEST_CONDITION_EDIT#}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" style="margin-top: 0px;">
|
||||
<div class="body">{#REQUEST_EDIT_TIP#}</div>
|
||||
</div>
|
||||
{else}
|
||||
<div class="title">
|
||||
<h5>{#REQUEST_NEW#}</h5>
|
||||
</div>
|
||||
<div class="widget" style="margin-top: 0px;">
|
||||
<div class="body">{#REQUEST_NEW_TIP#}</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<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=request&cp={$sess}">{#REQUEST_ALL#}</a></li>
|
||||
{if $smarty.request.action=='edit'}
|
||||
<li>{#REQUEST_EDIT2#}</li>
|
||||
{else}
|
||||
<li>{#REQUEST_NEW#}</li>
|
||||
{/if}
|
||||
<li><strong class="code">{$smarty.request.request_title_new|stripslashes|default:$row->request_title|escape}</strong></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $errors}
|
||||
<ul class="messages first">
|
||||
{foreach from=$errors item=e}
|
||||
<li class="highlight red mb10">
|
||||
{assign var=message value=$e}
|
||||
• {$message}<br />
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
{if !check_permission('request_php')}
|
||||
<ul class="messages first">
|
||||
<li class="highlight red aligncenter">
|
||||
{#REQUEST_REPORT_ERR_PHP#}
|
||||
</li>
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
{if $smarty.request.Id == ''}
|
||||
{assign var=iframe value='no'}
|
||||
{/if}
|
||||
|
||||
{if $smarty.request.action == 'new' && $smarty.request.rubric_id == ''}
|
||||
{assign var=dis value='disabled'}
|
||||
{/if}
|
||||
|
||||
{if $smarty.request.action=='new' && $smarty.request.rubric_id==''}
|
||||
<ul class="messages first">
|
||||
<li class="highlight red">
|
||||
<strong>{#REQUEST_PLEASE_SELECT#}</strong>
|
||||
</li>
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
|
||||
<div class="widget first">
|
||||
|
||||
<ul class="tabs">
|
||||
<li class="activeTab">
|
||||
<a href="#tab1">{#REQUEST_SETTINGS#}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#tab2">{#REQUEST_TEMPLATE_QUERY#}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#tab3">{#REQUEST_TEMPLATE_ITEMS#}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<form name="RequestTpl" id="RequestTpl" method="post" action="{$formaction}" class="mainForm">
|
||||
|
||||
<div class="tab_container">
|
||||
|
||||
<div id="tab1" class="tab_content" style="display: block;">
|
||||
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
|
||||
|
||||
<col width="250">
|
||||
<col>
|
||||
<col width="250">
|
||||
<col>
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="4">{#REQUEST_HEADER_SELF#}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td>{#REQUEST_NAME2#}</td>
|
||||
<td colspan="3"><input {$dis} class="mousetrap" style="width: 100%" name="request_title" type="text" id="l_Titel" value="{$smarty.request.request_title_new|stripslashes|default:$row->request_title|escape}"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<div class="nowrap">
|
||||
<strong><a class="toprightDir" title="{#REQUEST_I#}">[?]</a></strong> {#REQUEST_ALIAS#}:
|
||||
</div>
|
||||
</td>
|
||||
<td colspan="3">
|
||||
<div class="pr12">
|
||||
<input type="text" name="request_alias" value="{if $smarty.request.Id != ''}{$row->request_alias}{else}{$smarty.request.request_alias}{/if}" id="request_alias" value="" class="mousetrap" data-accept="{#REQUEST_ACCEPT#}" data-error-syn="{#REQUEST_ER_SYN#}" data-error-exists="{#REQUEST_ER_EXISTS#}" placeholder="{#REQUEST_ALIAS#}" maxlength="20" style="width: 200px;" autocomplete="off" />
|
||||
<input type="text" id="request_alias_tag" value="[tag:request:{if $smarty.request.Id != ''}{if $row->request_alias != ''}{$row->request_alias}{else}{$smarty.request.Id}{/if}{else}{$smarty.request.request_alias}{/if}]" readonly size="40" class="mousetrap" style="width: 200px;" />
|
||||
<a style="text-align: center; padding: 5px 3px 4px 3px;" class="whiteBtn copyBtn" href="javascript:void(0);" data-clipboard-action="copy" data-clipboard-target="#request_alias_tag">
|
||||
<img style="margin-top: -3px; position: relative; top: 4px; padding: 0 3px;" class="clippy" src="{$ABS_PATH}admin/templates/images/clippy.svg" width="13">
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{#REQUEST_CACHE#}</td>
|
||||
<td><input {$dis} class="mousetrap" style="width:100px" name="request_cache_lifetime" type="text" id="request_cache_lifetime" value="{$smarty.request.request_cache_lifetime|stripslashes|default:$row->request_cache_lifetime|escape}"></td>
|
||||
<td>{#REQUEST_CACHE_ELEMENTS#}</td>
|
||||
<td><input class="mousetrap float" name="request_cache_elements" type="checkbox" value="1" {if $row->request_cache_elements}checked="checked"{/if}/><label> </label></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>{#REQUEST_SELECT_RUBRIK#}</td>
|
||||
<td colspan="3">
|
||||
<select onChange="changeRub(this)" style="width:350px" id="rubric_id" class="mousetrap">
|
||||
{if $smarty.request.action=='new' && $smarty.request.rubric_id==''}
|
||||
<option value="">{#REQUEST_PLEASE_SELECT#}</option>
|
||||
{/if}
|
||||
{foreach from=$rubrics item=rubric}
|
||||
<option id="RubrikId_{$rubric->Id}" value="{$rubric->Id}"{if $smarty.request.rubric_id==$rubric->Id} selected="selected"{/if}>{$rubric->rubric_title|escape}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<input type="hidden" name="rubric_id" value="{$smarty.request.rubric_id}" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>{#REQUEST_DESCRIPTION#}<br /><small>{#REQUEST_INTERNAL_INFO#}</small></td>
|
||||
<td colspan="3"><textarea class="mousetrap" {$dis} style="width:350px; height:60px" name="request_description" id="request_description">{if $smarty.request.action=='new' && $smarty.request.request_description !=''}{$smarty.request.request_description|escape}{else}{$row->request_description|escape}{/if}</textarea></td>
|
||||
</tr>
|
||||
|
||||
<tr class="grey">
|
||||
<td>{#REQUEST_CONDITION#}</td>
|
||||
<td colspan="3">
|
||||
{if $iframe == 'no'}
|
||||
<input type="checkbox" name="reedit" value="1" checked="checked" class="float mousetrap" /> <label>{#REQUEST_ACTION_AFTER#}</label>
|
||||
{/if}
|
||||
{if $iframe != 'no'}
|
||||
<a href="index.php?do=request&action=conditions&Id={$smarty.request.Id|escape}&rubric_id={$smarty.request.rubric_id|escape}&cp={$sess}&pop=1" data-modal="true" data-dialog="conditions-{$smarty.request.Id}" data-title="{#REQUEST_CONDITION#}" class="openDialog button basicBtn">{#REQUEST_BUTTON_COND#}</a>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>{#REQUEST_HEADER_NAME#}</td>
|
||||
<td>{#REQUEST_HEADER_PARAMETR#}</td>
|
||||
<td>{#REQUEST_HEADER_NAME#}</td>
|
||||
<td>{#REQUEST_HEADER_PARAMETR#}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{#REQUEST_HIDE_CURRENT#}</td>
|
||||
<td><input class="mousetrap float" name="request_hide_current" type="checkbox" value="1" {if $row->request_hide_current}checked="checked"{/if}/><label> </label></td>
|
||||
|
||||
<td>{#REQUEST_ONLY_OWNER#}</td>
|
||||
<td><input class="mousetrap float" name="request_only_owner" type="checkbox" value="1" {if $row->request_only_owner}checked="checked"{/if}/><label> </label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="first">
|
||||
<div class="nowrap">
|
||||
<strong><a class="toprightDir" title="{#REQUEST_SORT_BY_I#}">[?]</a></strong> {#REQUEST_SORT_BY#}:
|
||||
</div>
|
||||
</td>
|
||||
<td class="second">
|
||||
<select {$dis} style="width:250px" name="request_order_by" id="request_order_by" class="mousetrap">
|
||||
<option value="document_published"{if $row->request_order_by=='document_published'} selected="selected"{/if}>{#REQUEST_BY_DATE#}</option>
|
||||
<option value="document_title"{if $row->request_order_by=='document_title'} selected="selected"{/if}>{#REQUEST_BY_NAME#}</option>
|
||||
<option value="document_author_id"{if $row->request_order_by=='document_author_id'} selected="selected"{/if}>{#REQUEST_BY_EDIT#}</option>
|
||||
<option value="document_count_print"{if $row->request_order_by=='document_count_print'} selected="selected"{/if}>{#REQUEST_BY_PRINTED#}</option>
|
||||
<option value="document_count_view"{if $row->request_order_by=='document_count_view'} selected="selected"{/if}>{#REQUEST_BY_VIEWS#}</option>
|
||||
<option value="RAND()"{if $row->request_order_by=='RAND()'} selected="selected"{/if}>{#REQUEST_BY_RAND#}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<div class="nowrap">
|
||||
<strong><a class="toprightDir" title="{#REQUEST_SORT_BY_I_2#}">[?]</a></strong> {#REQUEST_SORT_BY_NAT#}:
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<select {$dis} style="width: 250px" name="request_order_by_nat" id="request_order_by_nat" class="mousetrap">
|
||||
<option value="null"> </option>
|
||||
{foreach from=$fields_list item=field_group}
|
||||
|
||||
{if $groups_count > 1}
|
||||
<optgroup label="{if $field_group.group_title}{$field_group.group_title}{else}{#REQUEST_FIELD_G_UNKNOW#}{/if}">
|
||||
{/if}
|
||||
|
||||
{foreach from=$field_group.fields item=field}
|
||||
<option value="{$field.Id|escape}" {if $row->request_order_by_nat == $field.Id}selected{/if}>{$field.rubric_field_title|escape}</option>
|
||||
{/foreach}
|
||||
|
||||
{if $groups_count > 1}
|
||||
</optgroup>
|
||||
{/if}
|
||||
|
||||
{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="first">{#REQUEST_ASC_DESC#}</td>
|
||||
<td class="second">
|
||||
<select {$dis} style="width:100px" name="request_asc_desc" id="request_asc_desc" class="mousetrap">
|
||||
<option value="DESC"{if $row->request_asc_desc=='DESC'} selected="selected"{/if}>{#REQUEST_DESC#}</option>
|
||||
<option value="ASC"{if $row->request_asc_desc=='ASC'} selected="selected"{/if}>{#REQUEST_ASC#}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="first">{#REQUEST_DOC_PER_PAGE#}</td>
|
||||
<td>
|
||||
<select {$dis} style="width:150px" name="request_items_per_page" id="request_items_per_page" class="mousetrap">
|
||||
{section name=items loop=300 step=1 start=0}
|
||||
<option value="{$smarty.section.items.index+1}"{if $row->request_items_per_page==$smarty.section.items.index+1} selected="selected"{/if}>{$smarty.section.items.index+1}</option>
|
||||
{/section}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="4">{#REQUEST_PAGINATION#}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{#REQUEST_SHOW_NAVI#}</td>
|
||||
<td><input class="mousetrap float" name="request_show_pagination" type="checkbox" id="request_show_pagination" value="1"{if $row->request_show_pagination=='1'} checked="checked"{/if} /><label> </label></td>
|
||||
|
||||
<td>{#REQUEST_NAVI_TPL#}</td>
|
||||
<td>
|
||||
<select style="width:350px" id="request_pagination" name="request_pagination" class="mousetrap">
|
||||
{foreach from=$paginations item=pagination}
|
||||
<option value="{$pagination->id}"{if $row->request_pagination == $pagination->id} selected="selected"{/if}>{$pagination->pagination_name|escape}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{#REQUEST_COUNT_ITEMS#}</td>
|
||||
<td><input class="mousetrap float" name="request_count_items" type="checkbox" id="request_count_items" value="1"{if $row->request_count_items == '1'} checked="checked"{/if} /><label> </label></td>
|
||||
<td>{#REQUEST_USE_QUERY#}</td>
|
||||
<td><input class="mousetrap float" name="request_use_query" type="checkbox" id="request_use_query" value="1"{if $row->request_use_query == '1'} checked="checked"{/if} /><label> </label></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="4">{#REQUEST_OTHER#}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{#REQUEST_USE_LANG#}</td>
|
||||
<td colspan="3"><input class="mousetrap float" name="request_lang" type="checkbox" id="request_lang" value="1"{if $row->request_lang == '1'} checked="checked"{/if} /><label> </label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{#REQUEST_SHOW_STAT#}</td>
|
||||
<td><input class="mousetrap float" name="request_show_statistic" type="checkbox" id="request_show_statistic" value="1"{if $row->request_show_statistic == '1'} checked="checked"{/if} /><label> </label></td>
|
||||
<td>{#REQUEST_SHOW_SQL#}</td>
|
||||
<td><input class="mousetrap float" name="request_show_sql" type="checkbox" id="request_show_sql" value="1"{if $row->request_show_sql == '1'} checked="checked"{/if} /><label> </label></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="4">{#REQUEST_HEADER_EXTERNAL#}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="nowrap">
|
||||
<strong><a class="toprightDir" title="{#REQUEST_LINK_I#}">[?]</a></strong> {#REQUEST_EXTERNAL#}
|
||||
</div>
|
||||
</td>
|
||||
<td><input class="mousetrap float" name="request_external" type="checkbox" id="request_external" value="1"{if $row->request_external == '1'} checked="checked"{/if} /><label> </label></td>
|
||||
<td>{#REQUEST_ONLY_AJAX#}</td>
|
||||
<td><input class="mousetrap float" name="request_ajax" type="checkbox" id="request_ajax" value="1"{if $row->request_ajax == '1'} checked="checked"{/if} /><label> </label></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
{if $row->request_external == '1'}
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<ul class="messages">
|
||||
<li class="highlight grey">{#REQUEST_LINK#} <a class="float" href="/?request={if $row->request_alias != ''}{$row->request_alias}{else}{$smarty.request.Id}{/if}" target="_blank">https://{$smarty.server.HTTP_HOST}/?request={if $row->request_alias != ''}{$row->request_alias}{else}{$smarty.request.Id}{/if}</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
</table>
|
||||
<div class="fix"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="tab2" class="tab_content" style="display: none;">
|
||||
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
|
||||
<col width="230">
|
||||
<tr>
|
||||
{if $ddid != ''}
|
||||
<td>
|
||||
<strong><a title="{#REQUEST_CONTROL_FIELD#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:dropdown:', '{$ddid}]');">[tag:dropdown:{$ddid}]</a></strong>
|
||||
</td>
|
||||
{else}
|
||||
<td>
|
||||
<strong><a title="{#REQUEST_CONTROL_FIELD#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('{#REQUEST_NO_DROPDOWN#}');">[tag:dropdown:XX,XX...]</a></strong>
|
||||
</td>
|
||||
{/if}
|
||||
<td rowspan="19">
|
||||
<textarea {$dis} name="request_template_main" id="request_template_main" wrap="off" style="width:100%; height:500px">{$row->request_template_main|escape|default:''}</textarea>
|
||||
<ul class="messages" style="margin-top: 10px;">
|
||||
<li class="highlight grey">
|
||||
{#MAIN_CODEMIRROR_HELP#}
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_MAIN_CONTENT#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:content]', '');">[tag:content]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_MAIN_NAVI#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:pages]', '');">[tag:pages]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_PAGES_CURENT#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:pages:curent]', '');">[tag:pages:curent]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_PAGES_TOTAL#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:pages:total]', '');">[tag:pages:total]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOC_COUNT#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:doctotal]', '');">[tag:doctotal]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOC_ON_PAGE#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:doconpage]', '');">[tag:doconpage]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_CDOCID_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:docid]', '');">[tag:docid]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_CDOCID_TITLE#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:pagetitle]', '');">[tag:pagetitle]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_CDOCDATE_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:docdate]', '');">[tag:docdate]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_CDOCTIME_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:doctime]', '');">[tag:doctime]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_CDATE_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:date:', ']');">[tag:date:X]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_CDOCAUTHOR_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:docauthor]', '');">[tag:docauthor]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_PATH#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:path]', '');">[tag:path]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_MEDIAPATH#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:mediapath]', '');">[tag:mediapath]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_IF_EMPTY#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:if_empty]\n', '\n[/tag:if_empty]');">[tag:if_empty][/tag:if_empty]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_NOT_EMPTY#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:if_notempty]\n', '\n[/tag:if_notempty]');">[tag:if_notempty][/tag:if_notempty]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a class="rightDir" title="{#REQUEST_LANG#}" href="javascript:void(0);" onclick="textSelection('[tag:lang:]\n','\n[tag:/lang]');">[tag:lang:XX][/tag:lang]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_LANGFILE#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:langfile:', ']');">[tag:langfile:XXX]</a></strong></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>HTML Tags</td>
|
||||
<td>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection('<ol>', '</ol>');"><strong>OL</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<ul>', '</ul>');"><strong>UL</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<li>', '</li>');"><strong>LI</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<p class="">', '</p>');"><strong>P</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<strong>', '</strong>');"><strong>B</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<em>', '</em>');"><strong>I</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<h1>', '</h1>');"><strong>H1</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<h2>', '</h2>');"><strong>H2</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<h3>', '</h3>');"><strong>H3</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<h4>', '</h4>');"><strong>H4</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<h5>', '</h5>');"><strong>H5</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<div class="" id="">', '</div>');"><strong>DIV</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<a href="" title="">', '</a>');"><strong>A</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<img src="" alt="" />', '');"><strong>IMG</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<span>', '</span>');"><strong>SPAN</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<pre>', '</pre>');"><strong>PRE</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('<br />', '');"><strong>BR</strong></a> |
|
||||
<a href="javascript:void(0);" onclick="textSelection('\t', '');"><strong>TAB</strong></a> |
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
</table>
|
||||
<div class="fix"></div>
|
||||
</div>
|
||||
|
||||
<div id="tab3" class="tab_content" style="display: none;">
|
||||
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
|
||||
<col width="230">
|
||||
<col>
|
||||
<tr>
|
||||
<td>{#REQUEST_CONDITION_IF#}</td>
|
||||
<td>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_first]', '[tag:/if]');"><strong>[tag:if_first]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_not_first]', '[tag:/if]');"><strong>[tag:if_not_first]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_last]', '[tag:/if]');"><strong>[tag:if_last]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_not_last]', '[tag:/if]');"><strong>[tag:if_not_last]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_every:]', '[tag:/if]');"><strong>[tag:if_every:XXX]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_not_every:]', '[tag:/if]');"><strong>[tag:if_not_every:XXX]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_every:2]четный[tag:if_else]нечетный[tag:/if]', '');"><strong>{#REQUEST_SAMPLE#}</strong></a>
|
||||
|
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="noborder">
|
||||
<td><strong><a title="{#REQUEST_RUB_INFO#}" class="rightDir" href="javascript:void(0);" onclick="jAlert('{#REQUEST_SELECT_IN_LIST#}','{#REQUEST_TEMPLATE_ITEMS#}');">[tag:rfld:ID][XXX]</a></strong></td>
|
||||
<td rowspan="19">
|
||||
<ul class="messages" style="margin-bottom: 10px; font-size: 10px;">
|
||||
<li class="highlight grey">
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_notempty:rfld:', '][]');"><strong>[tag:if_notempty:rfld:XXX][XXX]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_empty:rfld:', '][]');"><strong>[tag:if_empty:rfld:XXX][XXX]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_else]', '');"><strong>[tag:if_else]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:/if]', '');"><strong>[tag:/if]</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_notempty:rfld:XXX][XXX]\r\n\r\n[tag:if_else]\r\n\r\n[tag:/if]', '');"><strong>{#REQUEST_SAMPLE#}</strong></a>
|
||||
|
|
||||
</li>
|
||||
</ul>
|
||||
<textarea {$dis} name="request_template_item" id="request_template_item" wrap="off" style="width:100%; height:340px">{$row->request_template_item|escape|default:''}</textarea>
|
||||
<ul class="messages" style="margin-top: 10px;">
|
||||
<li class="highlight grey">
|
||||
{#MAIN_CODEMIRROR_HELP#}
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_LINK_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:link]', '');">[tag:link]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOCID_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:docid]', '');">[tag:docid]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOCITEMNUM_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:docitemnum]', '');">[tag:docitemnum]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOCTITLE_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:doctitle]', '');">[tag:doctitle]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOCDATE_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:docdate]', '');">[tag:docdate]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOCTIME_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:doctime]', '');">[tag:doctime]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DATE_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:date:', ']');">[tag:date:X]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOCPARENT_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:docparent]', '');">[tag:docparent]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOCAUTHOR_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:docauthor]', '');">[tag:docauthor]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOCAUTHOR_AVATAR#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:docauthoravatar:]', '');">[tag:docauthoravatar:XXX]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_VIEWS_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:docviews]', '');">[tag:docviews]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_COMMENTS_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:doccomments]', '');">[tag:doccomments]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_DOMEN_INFO#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:domain]', '');">[tag:domain]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_THUMBNAIL#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:X000x000:[tag:rfld:', '][150]]');">[tag:X000x000:[tag:rfld:XXX][XXX]]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_PATH#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:path]', '');">[tag:path]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_MEDIAPATH#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:mediapath]', '');">[tag:mediapath]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_LANG#}" class="rightDir" href="javascript:void(0);" onclick="textSelection2('[tag:lang:]\n','\n[tag:/lang]');">[tag:lang:XX][/tag:lang]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><a title="{#REQUEST_LANGFILE#}" class="rightDir" href="javascript:void(0);" onclick="textSelection('[tag:langfile:', ']');">[tag:langfile:XXX]</a></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>HTML Tags</td>
|
||||
<td>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<ol>', '</ol>');"><strong>OL</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<ul>', '</ul>');"><strong>UL</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<li>', '</li>');"><strong>LI</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<p class="">', '</p>');"><strong>P</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<strong>', '</strong>');"><strong>B</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<em>', '</em>');"><strong>I</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<h1>', '</h1>');"><strong>H1</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<h2>', '</h2>');"><strong>H2</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<h3>', '</h3>');"><strong>H3</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<h4>', '</h4>');"><strong>H4</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<h5>', '</h5>');"><strong>H5</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<div class="" id="">', '</div>');"><strong>DIV</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<a href="" title="">', '</a>');"><strong>A</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<img src="" alt="" />', '');"><strong>IMG</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<span>', '</span>');"><strong>SPAN</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<pre>', '</pre>');"><strong>PRE</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2('<br />', '');"><strong>BR</strong></a>
|
||||
|
|
||||
<a href="javascript:void(0);" onclick="textSelection2s('\t', '');"><strong>TAB</strong></a>
|
||||
|
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
|
||||
<col width="3%" />
|
||||
<col width="25%" />
|
||||
<col width="10%" />
|
||||
<col width="15%" />
|
||||
<col width="15%" />
|
||||
<col width="43%" />
|
||||
<thead>
|
||||
<tr>
|
||||
<td align="center"><strong>{#REQUEST_ID#}</strong></td>
|
||||
<td align="center"><strong>{#REQUEST_FIELD_NAME#}</strong></td>
|
||||
<td align="center"><strong>{#REQUEST_RUBRIK_FIELD#}</strong></td>
|
||||
<td align="center"><strong>{#REQUEST_RUBRIK_FIELD#}</strong></td>
|
||||
<td align="center"><strong>{#RUBRIK_FIELD_ALIAS#}</strong></td>
|
||||
<td align="center"><strong>{#REQUEST_FIELD_TYPE#}</strong></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{foreach from=$fields_list item=field_group}
|
||||
|
||||
{if $groups_count > 1}
|
||||
<tr class="grey">
|
||||
<td colspan="6"><h5>{if $field_group.group_title}{$field_group.group_title}{else}{#REQUEST_FIELD_G_UNKNOW#}{/if}</h5></td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
{foreach from=$field_group.fields item=field}
|
||||
<tr>
|
||||
<td align="center">
|
||||
<strong class="code">{$field.Id}</strong>
|
||||
</td>
|
||||
<td>
|
||||
<strong>{$field.rubric_field_title}</strong>
|
||||
</td>
|
||||
<td>
|
||||
<a class="rightDir" title="{#REQUEST_INSERT_INFO#}" href="javascript:void(0);" onclick="textSelection2('[tag:rfld:{$field.Id}][', '0]');"><strong>[tag:rfld:{$field.Id}][0]</strong></a>
|
||||
</td>
|
||||
<td>
|
||||
{if $field.rubric_field_alias}
|
||||
<a class="rightDir" title="{#REQUEST_INSERT_INFO#}" href="javascript:void(0);" onclick="textSelection2('[tag:rfld:{$field.rubric_field_alias}][', '0]');"><strong>[tag:rfld:{$field.rubric_field_alias}][0]</strong></a>
|
||||
{/if}
|
||||
</td>
|
||||
<td align="center">
|
||||
{if $field.rubric_field_alias}<strong class="code">{$field.rubric_field_alias}</strong>{/if}
|
||||
</td>
|
||||
<td>
|
||||
{section name=field_name loop=$field_array}
|
||||
{if $field.rubric_field_type == $field_array[field_name].id}{$field_array[field_name].name}{/if}
|
||||
{/section}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
||||
{/foreach}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fix"></div>
|
||||
<div class="rowElem" id="saveBtn">
|
||||
<div class="saveBtn">
|
||||
{if $smarty.request.action=='edit'}
|
||||
<input {$dis} type="submit" class="basicBtn" value="{#REQUEST_BUTTON_SAVE#}" />
|
||||
{else}
|
||||
<input {$dis} type="submit" class="basicBtn" value="{#REQUEST_BUTTON_ADD#}" />
|
||||
{/if}
|
||||
{#REQUEST_OR#}
|
||||
{if $smarty.request.action=='edit'}
|
||||
<input {$dis} type="submit" class="blackBtn SaveEdit" value="{#REQUEST_BUTTON_SAVE_NEXT#}" />
|
||||
{else}
|
||||
<input {$dis} type="submit" class="blackBtn" value="{#REQUEST_BUTTON_ADD_NEXT#}" />
|
||||
{/if}
|
||||
<a style="float:right; height: 20px; padding: 0 10px;" type="submit" class="button redBtn" href="index.php?do=request&cp={$sess}">{#REQUEST_CANCEL#}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fix"></div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
{include file="$codemirror_connect"}
|
||||
{include file="$codemirror_editor" conn_id="" textarea_id='request_template_main' ctrls='$("#RequestTpl").ajaxSubmit(sett_options);' height=480}
|
||||
{include file="$codemirror_editor" conn_id="2" textarea_id='request_template_item' ctrls='$("#RequestTpl").ajaxSubmit(sett_options);' height=440}
|
||||
|
||||
|
||||
{literal}
|
||||
<script>
|
||||
$(document).on('change', '#request_alias', function (event) {
|
||||
|
||||
var input = $(this);
|
||||
var alias = input.val();
|
||||
|
||||
if (alias > '') {
|
||||
$.ajax({
|
||||
url: 'index.php?do=request&action=alias&cp=' + $sess,
|
||||
data: {
|
||||
alias: alias,
|
||||
id: $rid
|
||||
},
|
||||
success: function (data) {
|
||||
if (data === '1') {
|
||||
$.jGrowl(input.attr('data-accept'), {theme: 'accept'});
|
||||
}
|
||||
else if (data === 'syn') {
|
||||
$.jGrowl(input.attr('data-error-syn'), {theme: 'error'});
|
||||
alias = $rid ? $rid : '';
|
||||
}
|
||||
else {
|
||||
$.jGrowl(input.attr('data-error-exists'), {theme: 'error'});
|
||||
alias = $rid ? $rid : '';
|
||||
}
|
||||
$('#request_alias_tag').val('[tag:request:' + alias + ']');
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
alias = $rid ? $rid : '';
|
||||
$('#request_alias_tag').val('[tag:request:' + alias + ']');
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
{/literal}
|
||||
|
||||
{if $smarty.request.action !='new' && $smarty.request.rubric_id !=''}
|
||||
<script language="Javascript" type="text/javascript">
|
||||
var sett_options = {ldelim}
|
||||
url: "{$formaction}",
|
||||
beforeSubmit: Request,
|
||||
success: Response,
|
||||
dataType: 'json'
|
||||
{rdelim}
|
||||
|
||||
function Request(){ldelim}
|
||||
$.alerts._overlay('show');
|
||||
{rdelim}
|
||||
|
||||
function Response(data){ldelim}
|
||||
$.alerts._overlay('hide');
|
||||
$.jGrowl(data['message'], {ldelim}
|
||||
header: data['header'],
|
||||
theme: data['theme']
|
||||
{rdelim});
|
||||
{rdelim}
|
||||
|
||||
$(document).ready(function(){ldelim}
|
||||
|
||||
Mousetrap.bind(['ctrl+s', 'command+s'], function(event) {ldelim}
|
||||
event.preventDefault();
|
||||
$("#RequestTpl").ajaxSubmit(sett_options);
|
||||
return false;
|
||||
{rdelim});
|
||||
|
||||
$(".SaveEdit").click(function(event){ldelim}
|
||||
event.preventDefault();
|
||||
$("#RequestTpl").ajaxSubmit(sett_options);
|
||||
return false;
|
||||
{rdelim});
|
||||
|
||||
{rdelim});
|
||||
</script>
|
||||
{/if}
|
@@ -0,0 +1 @@
|
||||
for original
|
@@ -0,0 +1 @@
|
||||
<li><a {if $smarty.request.do=='request'}class="active"{else}{/if} href="index.php?do=request&cp={$sess}"><span>{#MAIN_QUERIES#}</span></a></li>
|
@@ -0,0 +1,297 @@
|
||||
<script type="text/javascript" language="JavaScript">
|
||||
$(document).ready(function(){ldelim}
|
||||
|
||||
$rid = parseInt('{$rid}');
|
||||
$sess = '{$sess}';
|
||||
|
||||
$('.tabs li > a').on('click', function(){ldelim}
|
||||
setTimeout(
|
||||
function(){ldelim}
|
||||
$('.mainForm select').trigger('refresh');
|
||||
{rdelim}
|
||||
, 100);
|
||||
|
||||
console.log('Refresh');
|
||||
{rdelim});
|
||||
|
||||
{if check_permission('request_new') || check_permission('request')}
|
||||
$(".AddRequest").click( function(event) {ldelim}
|
||||
event.preventDefault();
|
||||
var request_title_new = $('#add_request #request_title_new').fieldValue();
|
||||
var title = '{#REQUEST_NEW#}';
|
||||
var text = '{#REQUEST_ENTER_NAME#}';
|
||||
if (request_title_new == ""){ldelim}
|
||||
jAlert(text,title);
|
||||
{rdelim}else{ldelim}
|
||||
$.alerts._overlay('show');
|
||||
$("#add_request").submit();
|
||||
{rdelim}
|
||||
{rdelim});
|
||||
|
||||
$(".CopyRequest").click( function(event) {ldelim}
|
||||
event.preventDefault();
|
||||
var href = $(this).attr('href');
|
||||
var title = '{#REQUEST_COPY#}';
|
||||
var text = '{#REQUEST_PLEASE_NAME#}';
|
||||
jPrompt(text, '', title, function(b){ldelim}
|
||||
if (b){ldelim}
|
||||
$.alerts._overlay('show');
|
||||
window.location = href + '&cname=' + b;
|
||||
{rdelim}
|
||||
{rdelim}
|
||||
);
|
||||
{rdelim});
|
||||
{/if}
|
||||
|
||||
var clipboard = new Clipboard('.copyBtn');
|
||||
|
||||
{rdelim});
|
||||
</script>
|
||||
|
||||
<div class="title"><h5>{#REQUEST_TITLE#}</h5></div>
|
||||
|
||||
<div class="widget" style="margin-top: 0px;">
|
||||
<div class="body">
|
||||
{#REQUEST_TIP#}
|
||||
</div>
|
||||
</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>{#REQUEST_TITLE#}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="widget first">
|
||||
<ul class="tabs">
|
||||
<li class="activeTab"><a href="#tab1">{#REQUEST_ALL#}</a></li>
|
||||
{if check_permission('request_new')}
|
||||
<li class=""><a href="#tab2">{#REQUEST_NEW#}</a></li>
|
||||
{/if}
|
||||
</ul>
|
||||
<div class="tab_container">
|
||||
<div id="tab1" class="tab_content" style="display: block;">
|
||||
<form class="mainForm">
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
|
||||
{if $items}
|
||||
<thead>
|
||||
<tr>
|
||||
<td width="40">{#REQUEST_ID#}</td>
|
||||
<td>{#REQUEST_NAME#}</td>
|
||||
<td width="200">{#REQUEST_AUTHOR#}</td>
|
||||
<td width="200">{#REQUEST_DATE_CREATE#}</td>
|
||||
<td width="200">{#REQUEST_SYSTEM_TAG#}</td>
|
||||
<td width="80" colspan="4">{#REQUEST_ACTIONS#}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$items item=item}
|
||||
<tr>
|
||||
<td align="center">{$item->Id}</td>
|
||||
|
||||
<td>
|
||||
{if check_permission('request_edit')}
|
||||
<a title="{#REQUEST_EDIT#}" href="index.php?do=request&action=edit&Id={$item->Id}&rubric_id={$item->rubric_id}&cp={$sess}" class="topDir link">
|
||||
<strong>{$item->request_title|escape}</strong>
|
||||
</a>
|
||||
{else}
|
||||
<strong>{$item->request_title|escape}</strong>
|
||||
{/if} {if $item->request_description != ''}
|
||||
<br />
|
||||
{$item->request_description|escape|default:#REQUEST_NO_DESCRIPTION#} {/if}
|
||||
</td>
|
||||
<td align="center">{$item->request_author|escape}</td>
|
||||
<td align="center">
|
||||
<span class="date_text dgrey">{$item->request_created|date_format:$TIME_FORMAT|pretty_date}</span>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<div class="pr12" style="display: table;">
|
||||
<input style="display: table-cell;" readonly type="text" id="shot_{$item->Id}" value="[tag:request:{if $item->request_alias}{$item->request_alias}{else}{$item->Id}{/if}]" />
|
||||
<a
|
||||
style="display: table-cell; text-align: center;"
|
||||
class="whiteBtn copyBtn topDir"
|
||||
href="javascript:void(0);"
|
||||
data-clipboard-action="copy"
|
||||
data-clipboard-target="#shot_{$item->Id}"
|
||||
title="Copy to clipboard"
|
||||
>
|
||||
<img style="margin-top: -3px; position: relative; top: 4px; padding: 0 3px;" class="clippy" src="{$ABS_PATH}admin/templates/images/clippy.svg" width="13" />
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td width="1%" align="center">
|
||||
{if check_permission('request_edit')}
|
||||
<a title="{#REQUEST_EDIT#}" href="index.php?do=request&action=edit&Id={$item->Id}&cp={$sess}&rubric_id={$item->rubric_id}}" class="topleftDir icon_sprite ico_edit"></a>
|
||||
{else}
|
||||
<span class="icon_sprite ico_edit_no"></span>
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
<td width="1%" align="center">
|
||||
{if check_permission('request_edit')}
|
||||
<a
|
||||
title="{#REQUEST_CONDITION_EDIT#}"
|
||||
data-dialog="conditions-{$item->Id}"
|
||||
data-modal="true"
|
||||
data-title="{#REQUEST_CONDITION#}"
|
||||
href="index.php?do=request&action=conditions&rubric_id={$item->rubric_id}&Id={$item->Id}&pop=1&cp={$sess}"
|
||||
class="topleftDir icon_sprite ico_query openDialog"
|
||||
></a>
|
||||
{else}
|
||||
<span class="icon_sprite ico_query_no"></span>
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
<td width="1%" align="center">
|
||||
{if check_permission('request_new')}
|
||||
<a title="{#REQUEST_COPY#}" href="index.php?do=request&action=copy&Id={$item->Id}&cp={$sess}&rubric_id={$item->rubric_id}" class="CopyRequest topleftDir icon_sprite ico_copy"></a>
|
||||
{else}
|
||||
<span class="icon_sprite ico_copy_no"></span>
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
<td width="1%" align="center">
|
||||
{if check_permission('request_del')}
|
||||
<a
|
||||
title="{#REQUEST_DELETE#}"
|
||||
dir="{#REQUEST_DELETE#}"
|
||||
name="{#REQUEST_DELETE_CONFIRM#}"
|
||||
href="index.php?do=request&action=delete_query&rubric_id={$item->rubric_id}&Id={$item->Id}&cp={$sess}"
|
||||
class="ConfirmDelete topleftDir icon_sprite ico_delete"
|
||||
></a>
|
||||
{else}
|
||||
<span class="icon_sprite ico_delete_no"></span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach} {else}
|
||||
<tr class="noborder">
|
||||
<td colspan="6">
|
||||
<ul class="messages">
|
||||
<li class="highlight yellow">{#REQUEST_NO_REQUST#}</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{if check_permission('request_new')}
|
||||
|
||||
<div id="tab2" class="tab_content" style="display: none;">
|
||||
<form id="add_request" method="post" action="index.php?do=request&action=new&cp={$sess}" class="mainForm">
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
|
||||
<col width="300" />
|
||||
<col />
|
||||
|
||||
<tr>
|
||||
<td>{#REQUEST_NAME3#}</td>
|
||||
<td><input name="request_title_new" type="text" id="request_title_new" value="" placeholder="{#REQUEST_NAME#}" style="width: 400px;" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{#REQUEST_DESCRIPTION#}</td>
|
||||
<td><input name="request_description" type="text" id="request_description" value="" placeholder="{#REQUEST_DESCRIPTION#}" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{#REQUEST_SELECT_RUBRIK#}</td>
|
||||
<td>
|
||||
<select style="width: 350px;" id="rubric_id" name="rubric_id" class="mousetrap">
|
||||
<option value="">{#REQUEST_PLEASE_SELECT#}</option>
|
||||
{foreach from=$rubrics item=rubric}
|
||||
<option value="{$rubric->Id}">{$rubric->rubric_title|escape}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<div class="nowrap">
|
||||
<strong><a class="toprightDir" title="{#REQUEST_I#}">[?]</a></strong> {#REQUEST_ALIAS#}:
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="pr12">
|
||||
<input
|
||||
type="text"
|
||||
name="request_alias"
|
||||
id="request_alias"
|
||||
value=""
|
||||
class="mousetrap"
|
||||
data-accept="{#REQUEST_ACCEPT#}"
|
||||
data-error-syn="{#REQUEST_ER_SYN#}"
|
||||
data-error-exists="{#REQUEST_ER_EXISTS#}"
|
||||
placeholder="{#REQUEST_ALIAS#}"
|
||||
maxlength="20"
|
||||
style="width: 200px;"
|
||||
autocomplete="off"
|
||||
/>
|
||||
|
||||
<input type="text" id="request_alias_tag" value="[tag:request:]" readonly size="40" class="mousetrap" style="width: 200px;" />
|
||||
<a style="text-align: center; padding: 5px 3px 4px 3px;" class="whiteBtn copyBtn" href="javascript:void(0);" data-clipboard-action="copy" data-clipboard-target="#sysblock_alias_tag">
|
||||
<img style="margin-top: -3px; position: relative; top: 4px; padding: 0 3px;" class="clippy" src="{$ABS_PATH}admin/templates/images/clippy.svg" width="13" />
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2"><input type="button" class="basicBtn AddRequest" value="{#REQUEST_BUTTON_ADD#}" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
</div>
|
||||
<div class="fix"></div>
|
||||
</div>
|
||||
|
||||
{literal}
|
||||
<script>
|
||||
$(document).on("change", "#request_alias", function (event) {
|
||||
var input = $(this);
|
||||
var alias = input.val();
|
||||
|
||||
if (alias > "") {
|
||||
$.ajax({
|
||||
url: "index.php?do=request&action=alias&cp=" + $sess,
|
||||
data: {
|
||||
alias: alias,
|
||||
},
|
||||
success: function (data) {
|
||||
if (data === "1") {
|
||||
$.jGrowl(input.attr("data-accept"), { theme: "accept" });
|
||||
} else if (data === "syn") {
|
||||
$.jGrowl(input.attr("data-error-syn"), { theme: "error" });
|
||||
alias = $rid ? $rid : "";
|
||||
} else {
|
||||
$.jGrowl(input.attr("data-error-exists"), { theme: "error" });
|
||||
alias = $rid ? $rid : "";
|
||||
}
|
||||
$("#request_alias_tag").val("[tag:request:" + alias + "]");
|
||||
},
|
||||
});
|
||||
} else {
|
||||
alias = $rid ? $rid : "";
|
||||
$("#request_alias_tag").val("[tag:request:" + alias + "]");
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
{/literal} {if $page_nav}
|
||||
<div class="pagination">
|
||||
<ul class="pages">
|
||||
{$page_nav}
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
962
inc/query_variants/safe_files/class/class.request.php
Normal file
962
inc/query_variants/safe_files/class/class.request.php
Normal file
@@ -0,0 +1,962 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* Класс, предназначеный для работы с системой запросов в Панели управления
|
||||
* @package AVE.cms
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
class AVE_Request
|
||||
{
|
||||
|
||||
/**
|
||||
* Свойстав класса
|
||||
*/
|
||||
|
||||
/**
|
||||
* Количество Запросов на странице
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
var $_limit = 25;
|
||||
|
||||
/**
|
||||
* Внутренние методы
|
||||
*/
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для получения и вывода списка Запросов
|
||||
*
|
||||
* @param boolean $pagination признак формирования постраничного списка
|
||||
*/
|
||||
function _requestListGet($pagination = true)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
$limit = '';
|
||||
|
||||
// Если используется постраничная навигация
|
||||
if ($pagination)
|
||||
{
|
||||
// Определяем лимит записей на страницу и начало диапазона выборки
|
||||
$limit = $this->_limit;
|
||||
$start = get_current_page() * $limit - $limit;
|
||||
|
||||
// Получаем общее количество запросов
|
||||
$num = $AVE_DB->Query("SELECT COUNT(*) FROM " . PREFIX . "_request")->GetCell();
|
||||
|
||||
// Если количество больше, чем установленный лимит, тогда формируем постраничную навигацию
|
||||
if ($num > $limit)
|
||||
{
|
||||
$page_nav = " <a class=\"pnav\" href=\"index.php?do=request&page={s}&cp=" . SESSION . "\">{t}</a> ";
|
||||
$page_nav = get_pagination(ceil($num / $limit), 'page', $page_nav);
|
||||
$AVE_Template->assign('page_nav', $page_nav);
|
||||
}
|
||||
|
||||
$limit = $pagination ? "LIMIT " . $start . "," . $limit : '';
|
||||
}
|
||||
|
||||
// Выполняем запрос к БД на получение списка запросов с учетом лимита вывода на страницу (если необходимо)
|
||||
$items = array();
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT *
|
||||
FROM " . PREFIX . "_request
|
||||
ORDER BY Id ASC
|
||||
" . $limit . "
|
||||
");
|
||||
|
||||
// Формируем массив из полученных данных
|
||||
while ($row = $sql->FetchRow())
|
||||
{
|
||||
$row->request_author = get_username_by_id($row->request_author_id);
|
||||
array_push($items, $row);
|
||||
}
|
||||
|
||||
// Возвращаем массив
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Получить наименование и описание Запроса по идентификатору
|
||||
*
|
||||
* @param int $request_id идентификатор Запроса
|
||||
* @return object наименование Запроса
|
||||
*/
|
||||
function get_request_by_id($request_id = 0)
|
||||
{
|
||||
global $AVE_DB;
|
||||
|
||||
static $requests = array();
|
||||
|
||||
if (! isset($requests[$request_id]))
|
||||
{
|
||||
$requests[$request_id] = $AVE_DB->Query("
|
||||
SELECT
|
||||
rubric_id,
|
||||
request_title,
|
||||
request_description
|
||||
FROM
|
||||
" . PREFIX . "_request
|
||||
WHERE
|
||||
Id = '" . $request_id . "'
|
||||
LIMIT 1
|
||||
")->FetchRow();
|
||||
}
|
||||
|
||||
return $requests[$request_id];
|
||||
}
|
||||
|
||||
/**
|
||||
* Проверка алиаса тега на валидность и уникальность
|
||||
*
|
||||
* @param string $alias
|
||||
* @param int $id
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
function requestValidate ($alias = '', $id = 0)
|
||||
{
|
||||
global $AVE_DB;
|
||||
|
||||
//-- Соответствие требованиям
|
||||
if (empty ($alias) || preg_match('/^[A-Za-z0-9-_]{1,20}$/i', $alias) !== 1 || is_numeric($alias))
|
||||
return 'syn';
|
||||
|
||||
//-- Уникальность
|
||||
return !(bool)$AVE_DB->Query("
|
||||
SELECT 1
|
||||
FROM
|
||||
" . PREFIX . "_request
|
||||
WHERE
|
||||
request_alias = '" . $alias . "'
|
||||
AND
|
||||
Id != '" . $id . "'
|
||||
")->GetCell();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Внешние методы класса
|
||||
*/
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для формирования списка Запросов
|
||||
*
|
||||
*/
|
||||
function requestListFetch()
|
||||
{
|
||||
global $AVE_Template;
|
||||
|
||||
$AVE_Template->assign('conditions', $this->_requestListGet(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для отображения списка Запросов
|
||||
*
|
||||
*/
|
||||
function requestListShow()
|
||||
{
|
||||
global $AVE_Template;
|
||||
|
||||
// Получаем список запросов
|
||||
$AVE_Template->assign('items', $this->_requestListGet());
|
||||
|
||||
// Передаем в шаблон и отображаем страницу со списком
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('request/request.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для создания нового Запроса
|
||||
*
|
||||
*/
|
||||
function requestNew()
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
// Определяем действие пользователя
|
||||
switch ($_REQUEST['sub'])
|
||||
{
|
||||
// Действие не определено
|
||||
case '':
|
||||
$AVE_Template->assign('rid', 0);
|
||||
// Отображаем пустую форму для создания нового запроса
|
||||
$AVE_Template->assign('formaction', 'index.php?do=request&action=new&sub=save&cp=' . SESSION);
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('request/form.tpl'));
|
||||
break;
|
||||
|
||||
// Нажата кнопка Сохранить запрос
|
||||
case 'save':
|
||||
$save = true;
|
||||
$errors = array();
|
||||
|
||||
$row = new stdClass();
|
||||
|
||||
$row->request_template_item = stripslashes(pretty_chars($_REQUEST['request_template_item']));
|
||||
$row->request_template_main = stripslashes(pretty_chars($_REQUEST['request_template_main']));
|
||||
$row->request_title = stripslashes($_REQUEST['request_title']);
|
||||
$row->rubric_id = stripslashes($_REQUEST['rubric_id']);
|
||||
$row->request_items_per_page = stripslashes($_REQUEST['request_items_per_page']);
|
||||
$row->request_order_by = stripslashes($_REQUEST['request_order_by']);
|
||||
$row->request_order_by_nat = stripslashes($_REQUEST['request_order_by_nat']);
|
||||
$row->request_asc_desc = stripslashes($_REQUEST['request_asc_desc']);
|
||||
$row->request_description = stripslashes($_REQUEST['request_description']);
|
||||
$row->request_show_pagination = (isset($_REQUEST['request_show_pagination']) ? (int)($_REQUEST['request_show_pagination']) : 0);
|
||||
$row->request_pagination = (isset($_REQUEST['request_pagination']) ? (int)($_REQUEST['request_pagination']) : 1);
|
||||
$row->request_external = (isset($_REQUEST['request_external']) ? (int)$_REQUEST['request_external'] : 0);
|
||||
$row->request_ajax = (isset($_REQUEST['request_ajax']) ? (int)$_REQUEST['request_ajax'] : 0);
|
||||
$row->request_only_owner = (isset($_REQUEST['request_only_owner']) ? (int)($_REQUEST['request_only_owner']) : 0);
|
||||
$row->request_hide_current = (isset($_REQUEST['request_hide_current']) ? (int)($_REQUEST['request_hide_current']) : 0);
|
||||
$row->request_use_query = (isset($_REQUEST['request_use_query']) ? $_REQUEST['request_use_query'] : 0);
|
||||
$row->request_count_items = (isset($_REQUEST['request_count_items']) ? $_REQUEST['request_count_items'] : 0);
|
||||
$row->request_lang = (isset($_REQUEST['request_lang']) ? (int)$_REQUEST['request_lang'] : 0);
|
||||
$row->request_show_statistic = (isset($_REQUEST['request_show_statistic']) ? (int)$_REQUEST['request_show_statistic'] : 0);
|
||||
$row->request_show_sql = (isset($_REQUEST['request_show_sql']) ? (int)$_REQUEST['request_show_sql'] : 0);
|
||||
$row->request_cache_elements = (isset($_REQUEST['request_cache_elements']) ? (int)$_REQUEST['request_cache_elements'] : 0);
|
||||
$row->request_cache_lifetime = (int)($_REQUEST['request_cache_lifetime']);
|
||||
|
||||
|
||||
|
||||
if (empty($_REQUEST['rubric_id']))
|
||||
{
|
||||
$save = false;
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_RUBRIC');
|
||||
$errors[] = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_RUBRIC');
|
||||
}
|
||||
|
||||
if (empty($_REQUEST['request_title']))
|
||||
{
|
||||
$save = false;
|
||||
$errors[] = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_TITLE');
|
||||
}
|
||||
|
||||
if (empty($_REQUEST['request_template_main']))
|
||||
{
|
||||
$save = false;
|
||||
$errors[] = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_TEXT');
|
||||
}
|
||||
|
||||
$check_code_template_item = strtolower($_REQUEST['request_template_item']);
|
||||
$check_code_template_main = strtolower($_REQUEST['request_template_main']);
|
||||
|
||||
if ((is_php_code($check_code_template_item) || is_php_code($check_code_template_main)) && !check_permission('request_php'))
|
||||
{
|
||||
$save = false;
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_PHP');
|
||||
$errors[] = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_PHP');
|
||||
reportLog($AVE_Template->get_config_vars('REQUEST_REPORT_ERR_PHP_N') . ' (' . stripslashes(htmlspecialchars($_REQUEST['request_title'], ENT_QUOTES)) . ')');
|
||||
}
|
||||
|
||||
if ($save === false)
|
||||
{
|
||||
$AVE_Template->assign('row', $row);
|
||||
$AVE_Template->assign('errors', $errors);
|
||||
$AVE_Template->assign('formaction', 'index.php?do=request&action=new&sub=save&cp=' . SESSION);
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('request/form.tpl'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "
|
||||
INSERT " . PREFIX . "_request
|
||||
SET
|
||||
rubric_id = '" . (int)$_REQUEST['rubric_id'] . "',
|
||||
request_alias = '" . (isset($_REQUEST['request_alias']) ? stripslashes($_REQUEST['request_alias']) : '') . "',
|
||||
request_title = '" . (isset($_REQUEST['request_title']) ? stripslashes($_REQUEST['request_title']) : '') . "',
|
||||
request_items_per_page = '" . (isset($_REQUEST['request_items_per_page']) ? stripslashes($_REQUEST['request_items_per_page']) : 0) . "',
|
||||
request_template_item = '" . (isset($_REQUEST['request_template_item']) ? stripslashes(pretty_chars($_REQUEST['request_template_item'])) : '') . "',
|
||||
request_template_main = '" . (isset($_REQUEST['request_template_main']) ? stripslashes(pretty_chars($_REQUEST['request_template_main'])) : '') . "',
|
||||
request_order_by = '" . (isset($_REQUEST['request_order_by']) ? stripslashes($_REQUEST['request_order_by']) : '') . "',
|
||||
request_order_by_nat = '" . (isset($_REQUEST['request_order_by_nat']) ? (int)trim($_REQUEST['request_order_by_nat']) : 0) . "',
|
||||
request_description = '" . (isset($_REQUEST['request_description']) ? stripslashes($_REQUEST['request_description']) : '') . "',
|
||||
request_author_id = '" . (int)$_SESSION['user_id'] . "',
|
||||
request_created = '" . time() . "',
|
||||
request_asc_desc = '" . (isset($_REQUEST['request_asc_desc']) ? stripslashes($_REQUEST['request_asc_desc']) : 'DESC') . "',
|
||||
request_show_pagination = '" . (isset($_REQUEST['request_show_pagination']) ? (int)$_REQUEST['request_show_pagination'] : 0) . "',
|
||||
request_pagination = '" . (isset($_REQUEST['request_pagination']) ? (int)$_REQUEST['request_pagination'] : 1) . "',
|
||||
request_external = '" . (isset($_REQUEST['request_external']) ? (int)$_REQUEST['request_external'] : 0). "',
|
||||
request_ajax = '" . (isset($_REQUEST['request_ajax']) ? (int)$_REQUEST['request_ajax'] : 0). "',
|
||||
request_hide_current = '" . (isset($_REQUEST['request_hide_current']) ? (int)($_REQUEST['request_hide_current']) : 0) . "',
|
||||
request_only_owner = '" . (isset($_REQUEST['request_only_owner']) ? (int)($_REQUEST['request_only_owner']) : 0) . "',
|
||||
request_use_query = '" . (isset($_REQUEST['request_use_query']) ? (int)$_REQUEST['request_use_query'] : 0) . "',
|
||||
request_count_items = '" . (isset($_REQUEST['request_count_items']) ? (int)$_REQUEST['request_count_items'] : 0) . "',
|
||||
request_lang = '" . (isset($_REQUEST['request_lang']) ? (int)$_REQUEST['request_lang'] : 0). "',
|
||||
request_show_statistic = '" . (isset($_REQUEST['request_show_statistic']) ? (int)$_REQUEST['request_show_statistic'] : 0). "',
|
||||
request_show_sql = '" . (isset($_REQUEST['request_show_sql']) ? (int)$_REQUEST['request_show_sql'] : 0). "',
|
||||
request_cache_elements = '" . (isset($_REQUEST['request_cache_elements']) ? (int)$_REQUEST['request_cache_elements'] : 0). "',
|
||||
request_cache_lifetime = '" . (isset($_REQUEST['request_cache_lifetime']) ? (int)($_REQUEST['request_cache_lifetime']) : 0) . "',
|
||||
request_changed = '" . time() . "',
|
||||
request_changed_elements = '" . time() . "'
|
||||
";
|
||||
|
||||
// Выполняем запрос к БД и сохраняем введенную пользователем информацию
|
||||
$AVE_DB->Query($sql);
|
||||
|
||||
// Получаем id последней записи
|
||||
$iid = $AVE_DB->InsertId();
|
||||
|
||||
// Сохраняем системное сообщение в журнал
|
||||
reportLog($AVE_Template->get_config_vars('REQUEST_ADD_NEW_SUC') . ' (' . stripslashes(htmlspecialchars($_REQUEST['request_title'], ENT_QUOTES)) . ') (' . $iid . ')');
|
||||
|
||||
// Если в запросе пришел параметр на продолжение редактирования запроса
|
||||
if ($_REQUEST['reedit'] == 1)
|
||||
{
|
||||
// Выполняем переход на страницу с редактированием запроса
|
||||
header('Location:index.php?do=request&action=edit&Id=' . $iid . '&rubric_id=' . $_REQUEST['rubric_id'] . '&cp=' . SESSION);
|
||||
}
|
||||
else
|
||||
{
|
||||
// В противном случае выполняем переход к списку запросов
|
||||
if (!$_REQUEST['next_edit'])
|
||||
header('Location:index.php?do=request&cp=' . SESSION);
|
||||
else
|
||||
header('Location:index.php?do=request&action=edit&Id=' . $iid . '&rubric_id='.$_REQUEST['rubric_id'].'&cp=' . SESSION);
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для редактирования Запроса
|
||||
*
|
||||
* @param int $request_id идентификатор запроса
|
||||
*/
|
||||
function requestEdit($request_id)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
// Определяем действие пользователя
|
||||
switch ($_REQUEST['sub'])
|
||||
{
|
||||
// Если действие не определено
|
||||
case '':
|
||||
// Выполняем запрос к БД и получаем всю информацию о запросе
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT *
|
||||
FROM
|
||||
" . PREFIX . "_request
|
||||
WHERE
|
||||
Id = '" . $request_id . "'
|
||||
OR
|
||||
request_alias = '" . $request_id . "'
|
||||
");
|
||||
|
||||
if ($sql->_result->num_rows == 0)
|
||||
{
|
||||
header('Location:index.php?do=request&cp=' . SESSION);
|
||||
exit;
|
||||
}
|
||||
|
||||
$row = $sql->FetchRow();
|
||||
|
||||
// Получаем постраничную навигацию
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT
|
||||
id,
|
||||
pagination_name
|
||||
FROM
|
||||
" . PREFIX . "_paginations
|
||||
");
|
||||
|
||||
$paginations = array();
|
||||
|
||||
while ($pages = $sql->FetchRow())
|
||||
array_push($paginations, $pages);
|
||||
|
||||
// Передаем данные в шаблон и отображаем страницу с редактированием запроса
|
||||
if (! isset($_REQUEST['rubric_id']))
|
||||
$_REQUEST['rubric_id'] = $row->rubric_id;
|
||||
|
||||
$AVE_Template->assign('row', $row);
|
||||
$AVE_Template->assign('rid', $row->Id);
|
||||
$AVE_Template->assign('paginations', $paginations);
|
||||
$AVE_Template->assign('formaction', 'index.php?do=request&action=edit&sub=save&Id=' . $row->Id . '&cp=' . SESSION);
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('request/form.tpl'));
|
||||
|
||||
break;
|
||||
|
||||
// Пользователь нажал кнопку Сохранить изменения
|
||||
case 'save':
|
||||
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT *
|
||||
FROM
|
||||
" . PREFIX . "_request
|
||||
WHERE
|
||||
Id = '" . $request_id . "'
|
||||
");
|
||||
|
||||
if ($sql->_result->num_rows == 0)
|
||||
{
|
||||
header('Location:index.php?do=request&cp=' . SESSION);
|
||||
exit;
|
||||
}
|
||||
|
||||
$save = true;
|
||||
$errors = array();
|
||||
$row = new stdClass();
|
||||
$row->request_template_item = (isset($_REQUEST['request_template_item']) ? stripslashes(pretty_chars($_REQUEST['request_template_item'])) : '');
|
||||
$row->request_template_main = (isset($_REQUEST['request_template_main']) ? stripslashes(pretty_chars($_REQUEST['request_template_main'])) : '');
|
||||
$row->request_title = (isset($_REQUEST['request_title']) ? stripslashes($_REQUEST['request_title']) : '');
|
||||
$row->rubric_id = (isset($_REQUEST['rubric_id']) ? stripslashes($_REQUEST['rubric_id']) : 0);
|
||||
$row->request_items_per_page = (isset($_REQUEST['request_items_per_page']) ? stripslashes($_REQUEST['request_items_per_page']) : 0);
|
||||
$row->request_order_by = (isset($_REQUEST['request_order_by']) ? stripslashes($_REQUEST['request_order_by']) : '');
|
||||
$row->request_order_by_nat = (isset($_REQUEST['request_order_by_nat']) ? (int)trim($_REQUEST['request_order_by_nat']) : 0);
|
||||
$row->request_asc_desc = (isset($_REQUEST['request_asc_desc']) ? stripslashes($_REQUEST['request_asc_desc']) : 'DESC');
|
||||
$row->request_description = (isset($_REQUEST['request_description']) ? stripslashes($_REQUEST['request_description']) : '');
|
||||
$row->request_show_pagination = (isset($_REQUEST['request_show_pagination']) ? $_REQUEST['request_show_pagination'] : 0);
|
||||
$row->request_pagination = (isset($_REQUEST['request_pagination']) ? (int)($_REQUEST['request_pagination']) : 1);
|
||||
$row->request_external = (isset($_REQUEST['request_external']) ? (int)$_REQUEST['request_external'] : 0);
|
||||
$row->request_ajax = (isset($_REQUEST['request_ajax']) ? (int)$_REQUEST['request_ajax'] : 0);
|
||||
$row->request_only_owner = (isset($_REQUEST['request_only_owner']) ? (int)($_REQUEST['request_only_owner']) : 0);
|
||||
$row->request_hide_current = (isset($_REQUEST['request_hide_current']) ? (int)($_REQUEST['request_hide_current']) : 0);
|
||||
$row->request_use_query = (isset($_REQUEST['request_use_query']) ? $_REQUEST['request_use_query'] : 0);
|
||||
$row->request_count_items = (isset($_REQUEST['request_count_items']) ? $_REQUEST['request_count_items'] : 0);
|
||||
$row->request_lang = (isset($_REQUEST['request_lang']) ? (int)$_REQUEST['request_lang'] : 0);
|
||||
$row->request_show_statistic = (isset($_REQUEST['request_show_statistic']) ? (int)$_REQUEST['request_show_statistic'] : 0);
|
||||
$row->request_show_sql = (isset($_REQUEST['request_show_sql']) ? (int)$_REQUEST['request_show_sql'] : 0);
|
||||
$row->request_cache_elements = (isset($_REQUEST['request_cache_elements']) ? (int)$_REQUEST['request_cache_elements'] : 0);
|
||||
$row->request_cache_lifetime = (int)($_REQUEST['request_cache_lifetime']);
|
||||
|
||||
$message = '';
|
||||
|
||||
if (empty($_REQUEST['rubric_id']))
|
||||
{
|
||||
$save = false;
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_RUBRIC');
|
||||
$errors[] = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_RUBRIC');
|
||||
}
|
||||
|
||||
if (empty($_REQUEST['request_title']))
|
||||
{
|
||||
$save = false;
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_TITLE');
|
||||
$errors[] = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_TITLE');
|
||||
}
|
||||
|
||||
if (empty($_REQUEST['request_template_main']))
|
||||
{
|
||||
$save = false;
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_TEXT');
|
||||
$errors[] = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_TEXT');
|
||||
}
|
||||
|
||||
$check_code_template_item = strtolower($_REQUEST['request_template_item']);
|
||||
$check_code_template_main = strtolower($_REQUEST['request_template_main']);
|
||||
|
||||
if ((is_php_code($check_code_template_item) || is_php_code($check_code_template_main)) && !check_permission('request_php'))
|
||||
{
|
||||
$save = false;
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_PHP');
|
||||
$errors[] = $AVE_Template->get_config_vars('REQUEST_REPORT_ERR_PHP');
|
||||
reportLog($AVE_Template->get_config_vars('REQUEST_REPORT_ERR_PHP_E') . ' (' . stripslashes(htmlspecialchars($_REQUEST['request_title'], ENT_QUOTES)) . ') (Id:' . $request_id . ')');
|
||||
}
|
||||
|
||||
if ($save === false)
|
||||
{
|
||||
if (isAjax())
|
||||
{
|
||||
$header = $AVE_Template->get_config_vars('REQUEST_ERROR');
|
||||
echo json_encode(array('message' => $message, 'header' => $header, 'theme' => 'error'));
|
||||
exit;
|
||||
}
|
||||
|
||||
$AVE_Template->assign('row', $row);
|
||||
$AVE_Template->assign('errors', $errors);
|
||||
$AVE_Template->assign('formaction', 'index.php?do=request&action=edit&sub=save&Id=' . $request_id . '&cp=' . SESSION);
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('request/form.tpl'));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Выполняем запрос к БД и обновляем имеющиеся данные
|
||||
$sql = "
|
||||
UPDATE " . PREFIX . "_request
|
||||
SET
|
||||
rubric_id = '" . (int)$_REQUEST['rubric_id'] . "',
|
||||
request_alias = '" . (isset($_REQUEST['request_alias']) ? $_REQUEST['request_alias'] : '') . "',
|
||||
request_title = '" . (isset($_REQUEST['request_title']) ? $_REQUEST['request_title'] : '') . "',
|
||||
request_items_per_page = '" . (isset($_REQUEST['request_items_per_page']) ? $_REQUEST['request_items_per_page'] : 0) . "',
|
||||
request_template_item = '" . (isset($_REQUEST['request_template_item']) ? $_REQUEST['request_template_item'] : '') . "',
|
||||
request_template_main = '" . (isset($_REQUEST['request_template_main']) ? $_REQUEST['request_template_main'] : '') . "',
|
||||
request_order_by = '" . (isset($_REQUEST['request_order_by']) ? $_REQUEST['request_order_by'] : '') . "',
|
||||
request_order_by_nat = '" . (isset($_REQUEST['request_order_by_nat']) ? (int)trim($_REQUEST['request_order_by_nat']) : 0) . "',
|
||||
request_description = '" . (isset($_REQUEST['request_description']) ? $_REQUEST['request_description'] : '') . "',
|
||||
request_asc_desc = '" . (isset($_REQUEST['request_asc_desc']) ? $_REQUEST['request_asc_desc'] : 'DESC') . "',
|
||||
request_show_pagination = '" . (isset($_REQUEST['request_show_pagination']) ? (int)$_REQUEST['request_show_pagination'] : 0) . "',
|
||||
request_pagination = '" . (isset($_REQUEST['request_pagination']) ? (int)$_REQUEST['request_pagination'] : 1) . "',
|
||||
request_external = '" . (isset($_REQUEST['request_external']) ? (int)$_REQUEST['request_external'] : 0). "',
|
||||
request_ajax = '" . (isset($_REQUEST['request_ajax']) ? (int)$_REQUEST['request_ajax'] : 0). "',
|
||||
request_hide_current = '" . (isset($_REQUEST['request_hide_current']) ? (int)($_REQUEST['request_hide_current']) : 0) . "',
|
||||
request_only_owner = '" . (isset($_REQUEST['request_only_owner']) ? (int)($_REQUEST['request_only_owner']) : 0) . "',
|
||||
request_use_query = '" . (isset($_REQUEST['request_use_query']) ? (int)$_REQUEST['request_use_query'] : 0) . "',
|
||||
request_count_items = '" . (isset($_REQUEST['request_count_items']) ? (int)$_REQUEST['request_count_items'] : 0) . "',
|
||||
request_lang = '" . (isset($_REQUEST['request_lang']) ? (int)$_REQUEST['request_lang'] : 0). "',
|
||||
request_show_statistic = '" . (isset($_REQUEST['request_show_statistic']) ? (int)$_REQUEST['request_show_statistic'] : 0). "',
|
||||
request_show_sql = '" . (isset($_REQUEST['request_show_sql']) ? (int)$_REQUEST['request_show_sql'] : 0). "',
|
||||
request_cache_elements = '" . (isset($_REQUEST['request_cache_elements']) ? (int)$_REQUEST['request_cache_elements'] : 0). "',
|
||||
request_cache_lifetime = '" . (isset($_REQUEST['request_cache_lifetime']) ? (int)($_REQUEST['request_cache_lifetime']) : 0) . "',
|
||||
request_changed = '" . time() . "',
|
||||
request_changed_elements = '" . time() . "'
|
||||
|
||||
WHERE
|
||||
Id = '" . $request_id . "'
|
||||
";
|
||||
|
||||
$AVE_DB->Query($sql);
|
||||
|
||||
$AVE_DB->clearRequest($request_id);
|
||||
|
||||
// ToDO Сделать проверку на сохранение
|
||||
|
||||
// Сохраняем системное сообщение в журнал
|
||||
reportLog($AVE_Template->get_config_vars('REQUEST_SAVE_CHA_SUC') . ' (' . stripslashes(htmlspecialchars($_REQUEST['request_title'], ENT_QUOTES)) . ') (Id:' . $request_id . ')');
|
||||
|
||||
// В противном случае выполняем переход к списку запросов
|
||||
if (! isAjax())
|
||||
{
|
||||
header('Location:index.php?do=request&cp=' . SESSION);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_TEMPLATE_SAVED');
|
||||
$header = $AVE_Template->get_config_vars('REQUEST_SUCCESS');
|
||||
$theme = 'accept';
|
||||
echo json_encode(array('message' => $message, 'header' => $header, 'theme' => $theme));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для создания копии Запроса
|
||||
*
|
||||
* @param int $request_id идентификатор запроса
|
||||
*/
|
||||
function requestCopy($request_id)
|
||||
{
|
||||
global $AVE_DB;
|
||||
|
||||
// Выполняем запрос к БД на получение информации о копиреумом запросе
|
||||
$row = $AVE_DB->Query("
|
||||
SELECT *
|
||||
FROM " . PREFIX . "_request
|
||||
WHERE Id = '" . $request_id . "'
|
||||
")->FetchRow();
|
||||
|
||||
// Выполняем запрос к БД на добавление нового запроса на основании полученных ранее данных
|
||||
$AVE_DB->Query("
|
||||
INSERT " . PREFIX . "_request
|
||||
SET
|
||||
rubric_id = '" . $row->rubric_id . "',
|
||||
request_items_per_page = '" . $row->request_items_per_page . "',
|
||||
request_title = '" . substr($_REQUEST['cname'], 0, 25) . "',
|
||||
request_template_item = '" . addslashes($row->request_template_item) . "',
|
||||
request_template_main = '" . addslashes($row->request_template_main) . "',
|
||||
request_order_by = '" . addslashes($row->request_order_by) . "',
|
||||
request_order_by_nat = '" . addslashes($row->request_order_by_nat) . "',
|
||||
request_author_id = '" . (int)$_SESSION['user_id'] . "',
|
||||
request_created = '" . time() . "',
|
||||
request_description = '" . addslashes($row->request_description) . "',
|
||||
request_asc_desc = '" . $row->request_asc_desc . "',
|
||||
request_show_pagination = '" . $row->request_show_pagination . "',
|
||||
request_pagination = '" . $row->request_pagination . "',
|
||||
request_hide_current = '" . $row->request_hide_current . "',
|
||||
request_only_owner = '" . $row->request_only_owner . "',
|
||||
request_use_query = '" . $row->request_use_query . "',
|
||||
request_count_items = '" . $row->request_count_items . "',
|
||||
request_lang = '" . $row->request_lang . "',
|
||||
request_show_statistic = '" . $row->request_show_statistic . "',
|
||||
request_show_sql = '" . $row->request_show_sql . "',
|
||||
request_cache_elements = '" . (isset($row->request_cache_elements) ? $row->request_cache_elements : 0) . "'
|
||||
");
|
||||
|
||||
// Получаем id добавленной записи
|
||||
$iid = $AVE_DB->InsertId();
|
||||
|
||||
// Сохраняем системное сообщение в журнал
|
||||
reportLog($_SESSION['user_name'] . ' - создал копию запроса (' . $request_id . ')', 2, 2);
|
||||
|
||||
// Выполняем запрос к БД и получаем все условия запроса для копируемого запроса
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT *
|
||||
FROM " . PREFIX . "_request_conditions
|
||||
WHERE request_id = '" . $request_id . "'
|
||||
");
|
||||
|
||||
// Обрабатываем полученные данные и
|
||||
while ($row_ak = $sql->FetchRow())
|
||||
{
|
||||
// Выполняем запрос к БД на добавление условий для нового, скопированного запроса
|
||||
$AVE_DB->Query("
|
||||
INSERT " . PREFIX . "_request_conditions
|
||||
SET
|
||||
request_id = '" . $iid . "',
|
||||
condition_compare = '" . $row_ak->condition_compare . "',
|
||||
condition_field_id = '" . $row_ak->condition_field_id . "',
|
||||
condition_value = '" . $row_ak->condition_value . "',
|
||||
condition_join = '" . $row_ak->condition_join . "'
|
||||
");
|
||||
}
|
||||
|
||||
// Выполянем переход к списку запросов
|
||||
header('Location:index.php?do=request&cp=' . SESSION);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для удаления запроса
|
||||
*
|
||||
* @param int $request_id идентификатор запроса
|
||||
*/
|
||||
function requestDelete($request_id)
|
||||
{
|
||||
global $AVE_DB;
|
||||
|
||||
// Выполняем запрос к БД на удаление общей информации о запросе
|
||||
$AVE_DB->Query("
|
||||
DELETE
|
||||
FROM " . PREFIX . "_request
|
||||
WHERE Id = '" . $request_id . "'
|
||||
");
|
||||
|
||||
// Выполняем запрос к БД на удаление условий запроса
|
||||
$AVE_DB->Query("
|
||||
DELETE
|
||||
FROM " . PREFIX . "_request_conditions
|
||||
WHERE request_id = '" . $request_id . "'
|
||||
");
|
||||
|
||||
// Сохраняем системное сообщение в журнал
|
||||
reportLog($_SESSION['user_name'] . ' - удалил запрос (' . $request_id . ')', 2, 2);
|
||||
|
||||
// Выполянем переход к списку запросов
|
||||
header('Location:index.php?do=request&cp=' . SESSION);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для редактирования условий Запроса
|
||||
*
|
||||
* @param int $request_id идентификатор запроса
|
||||
*/
|
||||
function requestConditionEdit($request_id)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
// Определяем действие пользователя
|
||||
switch ($_REQUEST['sub'])
|
||||
{
|
||||
// Если действие не определено
|
||||
case '':
|
||||
$fields = array();
|
||||
|
||||
// Выполняем запрос к БД и получаем список полей у той рубрики, к которой относится данный запрос
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT *
|
||||
FROM
|
||||
" . PREFIX . "_rubric_fields
|
||||
WHERE
|
||||
rubric_id = '" . $_REQUEST['rubric_id'] . "'
|
||||
ORDER BY rubric_field_position ASC
|
||||
");
|
||||
|
||||
// Обрабатываем полученные данные и формируем массив
|
||||
while ($row = $sql->FetchRow())
|
||||
array_push($fields, $row);
|
||||
|
||||
$conditions = array();
|
||||
|
||||
// Выполняем запрос к БД и получаем условия запроса
|
||||
$sql = $AVE_DB->Query("
|
||||
SELECT *
|
||||
FROM
|
||||
" . PREFIX . "_request_conditions
|
||||
WHERE
|
||||
request_id = '" . $request_id . "'
|
||||
ORDER BY condition_position ASC
|
||||
");
|
||||
|
||||
// Обрабатываем полученные данные и формируем массив
|
||||
while ($row = $sql->FetchRow())
|
||||
array_push($conditions, $row);
|
||||
|
||||
// Передаем данные в шаблон и отображаем страницу с редактированием условий
|
||||
$AVE_Template->assign('request_title', $this->get_request_by_id($request_id)->request_title);
|
||||
$AVE_Template->assign('fields', $fields);
|
||||
$AVE_Template->assign('conditions', $conditions);
|
||||
|
||||
if (isAjax() && (isset($_REQUEST['ajax']) && $_REQUEST['ajax'] == 1))
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('request/cond_list.tpl'));
|
||||
else
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('request/conditions.tpl'));
|
||||
|
||||
break;
|
||||
|
||||
case 'sort':
|
||||
|
||||
foreach ($_REQUEST['sort'] as $position => $cond_id)
|
||||
{
|
||||
$AVE_DB->Query("
|
||||
UPDATE
|
||||
" . PREFIX . "_request_conditions
|
||||
SET
|
||||
condition_position = '" . (int)$position . "'
|
||||
WHERE
|
||||
Id = '" . (int)$cond_id . "'
|
||||
");
|
||||
}
|
||||
|
||||
if (isAjax())
|
||||
{
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_SORTED');
|
||||
$header = $AVE_Template->get_config_vars('REQUEST_SUCCESS');
|
||||
$theme = 'accept';
|
||||
echo json_encode(array('message' => $message, 'header' => $header, 'theme' => $theme));
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
// Если пользователь нажал кнопку Сохранить изменения
|
||||
case 'save':
|
||||
// Если существует хотя бы одно условие, тогда
|
||||
|
||||
if (isset($_REQUEST['conditions']) && is_array($_POST['conditions']))
|
||||
{
|
||||
$condition_edited = false;
|
||||
|
||||
// Обрабатываем данные полей
|
||||
foreach ($_REQUEST['conditions'] as $condition_id => $val)
|
||||
{
|
||||
// Выполняем запрос к БД на обновление информации об условиях
|
||||
$AVE_DB->Query("
|
||||
UPDATE
|
||||
" . PREFIX . "_request_conditions
|
||||
SET
|
||||
request_id = '" . $request_id . "',
|
||||
condition_compare = '" . $val['condition_compare'] . "',
|
||||
condition_field_id = '" . $val['condition_field_id'] . "',
|
||||
condition_value = '" . (! empty($val['condition_value']) ? $val['condition_value'] : '') . "',
|
||||
condition_join = '" . $val['condition_join'] . "',
|
||||
condition_status = '" . ((! empty($val['condition_value'])) ? (($val['condition_status'] == '1') ? '1' : '0') : ''). "'
|
||||
WHERE
|
||||
Id = '" . $condition_id . "'
|
||||
");
|
||||
|
||||
$condition_edited = true;
|
||||
}
|
||||
|
||||
// Если изменения были, сохраняем системное сообщение в журнал
|
||||
if ($condition_edited)
|
||||
{
|
||||
reportLog('' . $AVE_Template->get_config_vars('REQUEST_COND_CHA_SUC') . ' (' . stripslashes(htmlspecialchars($this->get_request_by_id($request_id)->request_title, ENT_QUOTES)) . ') - ( Id: '.$request_id.' )');
|
||||
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_COND_POST_OK');
|
||||
$header = $AVE_Template->get_config_vars('REQUEST_SUCCESS');
|
||||
$theme = 'accept';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_COND_POST_ERR');
|
||||
$header = $AVE_Template->get_config_vars('REQUEST_ERROR');
|
||||
$theme = 'error';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_COND_NO_POST');
|
||||
$header = $AVE_Template->get_config_vars('REQUEST_ERROR');
|
||||
$theme = 'error';
|
||||
}
|
||||
|
||||
// Если некоторые из условий были помечены на удаление
|
||||
if (isset($_POST['del']) && is_array($_POST['del']))
|
||||
{
|
||||
// Обрабатываем все поля помеченные на удаление
|
||||
foreach ($_POST['del'] as $condition_id => $val)
|
||||
{
|
||||
// Выполняем запрос к БД на удаление условий
|
||||
$AVE_DB->Query("
|
||||
DELETE FROM
|
||||
" . PREFIX . "_request_conditions
|
||||
WHERE
|
||||
Id = '" . $condition_id . "'
|
||||
");
|
||||
}
|
||||
|
||||
// Сохраняем системное сообщение в журнал
|
||||
reportLog('' . $AVE_Template->get_config_vars('REQUEST_COND_DEL_SUC') . ' (' . stripslashes(htmlspecialchars($this->get_request_by_id($request_id)->request_title, ENT_QUOTES)) . ') - ( Id: '.$request_id.' )');
|
||||
}
|
||||
|
||||
// Нет смысла каждый раз формировать SQL-запрос с условиями Запроса
|
||||
// поэтому формируем SQL-запрос только при изменении условий
|
||||
// require(BASE_DIR . '/functions/func.parserequest.php');
|
||||
request_get_condition_sql_string($request_id, true);
|
||||
|
||||
$AVE_DB->Query("
|
||||
UPDATE
|
||||
" . PREFIX . "_request
|
||||
SET
|
||||
request_changed = '" . time() . "'
|
||||
WHERE
|
||||
Id = '" . $request_id . "'
|
||||
");
|
||||
|
||||
$AVE_DB->clearRequest($request_id);
|
||||
|
||||
if (! isAjax())
|
||||
{
|
||||
// Выполняем обновление страницы
|
||||
header('Location:index.php?do=request&action=conditions&rubric_id=' . $_REQUEST['rubric_id'] . '&Id=' . $request_id . '&cp=' . SESSION . ($_REQUEST['pop'] ? '&pop=1' : ''));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('message' => $message, 'header' => $header, 'theme' => $theme));
|
||||
exit;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// Если пользователь добавил новое условие
|
||||
case 'new':
|
||||
if ($_POST['new_value'] !== '')
|
||||
{
|
||||
// Выполняем запрос к БД на добавление нового условия
|
||||
$sql = $AVE_DB->Query("
|
||||
INSERT
|
||||
" . PREFIX . "_request_conditions
|
||||
SET
|
||||
request_id = '" . $request_id . "',
|
||||
condition_compare = '" . $_POST['new_operator'] . "',
|
||||
condition_field_id = '" . $_POST['field_new'] . "',
|
||||
condition_value = '" . $_POST['new_value'] . "',
|
||||
condition_join = '" . $_POST['oper_new'] . "'
|
||||
");
|
||||
|
||||
if ($sql->_result === false)
|
||||
{
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_COND_NEW_ERR');
|
||||
$header = $AVE_Template->get_config_vars('REQUEST_ERROR');
|
||||
$theme = 'error';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Сохраняем системное сообщение в журнал
|
||||
reportLog('' . $AVE_Template->get_config_vars('REQUEST_COND_ADD_SUC') . ' (' . stripslashes(htmlspecialchars($this->get_request_by_id($request_id)->request_title, ENT_QUOTES)) . ') - ( Id: '.$request_id.' )');
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_COND_VALUE_ERR');
|
||||
$header = $AVE_Template->get_config_vars('REQUEST_ERROR');
|
||||
$theme = 'error';
|
||||
}
|
||||
|
||||
// Нет смысла каждый раз формировать SQL-запрос с условиями Запроса
|
||||
// поэтому формируем SQL-запрос только при изменении условий
|
||||
// require(BASE_DIR . '/functions/func.parserequest.php');
|
||||
request_get_condition_sql_string($request_id, true);
|
||||
|
||||
$AVE_DB->Query("
|
||||
UPDATE
|
||||
" . PREFIX . "_request
|
||||
SET
|
||||
request_changed = '" . time() . "'
|
||||
WHERE
|
||||
Id = '" . $request_id . "'
|
||||
");
|
||||
|
||||
$AVE_DB->clearRequest($request_id);
|
||||
|
||||
if (! isAjax())
|
||||
{
|
||||
header('Location:index.php?do=request&action=conditions&rubric_id=' . $_REQUEST['rubric_id'] . '&Id=' . $request_id . '&cp=' . SESSION);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! $message)
|
||||
{
|
||||
$message = $AVE_Template->get_config_vars('REQUEST_COND_NEW_SUC');
|
||||
$header = $AVE_Template->get_config_vars('REQUEST_SUCCESS');
|
||||
$theme = 'accept';
|
||||
}
|
||||
|
||||
echo json_encode(array('message' => $message, 'header' => $header, 'theme' => $theme));
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field_id
|
||||
* @param $cond_id
|
||||
*/
|
||||
function conditionFieldChange($field_id, $cond_id)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
// Передаем данные в шаблон и отображаем страницу с редактированием условий
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('cond_id', $cond_id);
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('request/change.tpl'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $field_id
|
||||
* @param $cond_id
|
||||
*/
|
||||
function conditionFieldChangeSave($field_id, $cond_id)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
// ToDo
|
||||
$sql = $AVE_DB->Query("
|
||||
UPDATE
|
||||
" . PREFIX . "_request_conditions
|
||||
SET
|
||||
condition_field_id = '" . $field_id . "'
|
||||
WHERE
|
||||
Id = '" . $cond_id . "'
|
||||
");
|
||||
|
||||
request_get_condition_sql_string((int)$_REQUEST['req_id'], true);
|
||||
|
||||
$request_id = $AVE_DB->Query("
|
||||
SELECT
|
||||
request_id
|
||||
FROM
|
||||
" . PREFIX . "_request_conditions
|
||||
WHERE
|
||||
Id = '" . $cond_id . "'
|
||||
")->GetCell();
|
||||
|
||||
$AVE_DB->Query("
|
||||
UPDATE
|
||||
" . PREFIX . "_request
|
||||
SET
|
||||
request_changed = '" . time() . "'
|
||||
WHERE
|
||||
Id = '" . $request_id . "'
|
||||
");
|
||||
|
||||
$AVE_DB->clearRequest($request_id);
|
||||
|
||||
// Передаем данные в шаблон и отображаем страницу с редактированием условий
|
||||
$AVE_Template->assign('field_id', $field_id);
|
||||
$AVE_Template->assign('cond_id', $cond_id);
|
||||
$AVE_Template->assign('content', $AVE_Template->fetch('request/change.tpl'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
939
inc/query_variants/safe_files/functions/func.parserequest.php
Normal file
939
inc/query_variants/safe_files/functions/func.parserequest.php
Normal file
@@ -0,0 +1,939 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Класс для обработки тегов шаблона.
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @filesource
|
||||
*/
|
||||
class TagProcessor
|
||||
{
|
||||
private int $item_num;
|
||||
private bool $is_last;
|
||||
private object $row;
|
||||
private int $rubric_id;
|
||||
private int $items_count;
|
||||
|
||||
/**
|
||||
* Конструктор класса.
|
||||
*
|
||||
* @param int $item_num Текущий номер элемента во всем списке (начиная с 1).
|
||||
* @param bool $is_last Флаг, указывающий, является ли элемент последним.
|
||||
* @param object $row Объект с данными документа.
|
||||
* @param int $rubric_id ID рубрики.
|
||||
* @param int $items_count Количество элементов на текущей странице.
|
||||
*/
|
||||
public function __construct(int $item_num, bool $is_last, object $row, int $rubric_id, int $items_count)
|
||||
{
|
||||
$this->item_num = $item_num;
|
||||
$this->is_last = $is_last;
|
||||
$this->row = $row;
|
||||
$this->rubric_id = $rubric_id;
|
||||
$this->items_count = $items_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Основной метод для обработки всех условных тегов в строке.
|
||||
*
|
||||
* @param string $content Строка с тегами, например, '[tag:if_first]...[/tag:if]'
|
||||
* @return string Обработанная строка
|
||||
*/
|
||||
public function process(string $content): string
|
||||
{
|
||||
// Сначала обрабатываем теги if_notempty и if_empty
|
||||
$processed_content = preg_replace_callback(
|
||||
'/\\[tag:(if_notempty|if_empty):rfld:([a-zA-Z0-9-_]+)]\\[(more|esc|img|strip|[0-9-]+)](.*?)\\[tag:\\/if]/s',
|
||||
function ($matches) {
|
||||
$tag_type = $matches[1];
|
||||
$field_name = $matches[2];
|
||||
$format = $matches[3];
|
||||
$inner_content = $matches[4];
|
||||
|
||||
$parts = explode('[tag:if_else]', $inner_content);
|
||||
$true_content = $parts[0];
|
||||
$false_content = $parts[1] ?? '';
|
||||
|
||||
$field_value = '';
|
||||
if (defined('USE_GET_FIELDS') && USE_GET_FIELDS) {
|
||||
$field_value = htmlspecialchars(get_field($field_name, (int)$this->row->Id), ENT_QUOTES);
|
||||
} else {
|
||||
$field_value = htmlspecialchars(request_get_document_field($field_name, (int)$this->row->Id, $format, $this->rubric_id), ENT_QUOTES);
|
||||
}
|
||||
|
||||
$condition = ($tag_type === 'if_notempty' && $field_value !== '') || ($tag_type === 'if_empty' && $field_value === '');
|
||||
|
||||
return $condition ? $true_content : $false_content;
|
||||
},
|
||||
$content
|
||||
);
|
||||
|
||||
// Затем обрабатываем остальные условные теги
|
||||
$processed_content = preg_replace_callback(
|
||||
'/\\[tag:(if_first|if_not_first|if_last|if_not_last|if_every:([0-9-]+)|if_not_every:([0-9-]+))](.*?)\\[tag:\\/if]/s',
|
||||
function ($matches) {
|
||||
$tag = $matches[1];
|
||||
$inner_content = $matches[4];
|
||||
|
||||
$parts = explode('[tag:if_else]', $inner_content);
|
||||
$true_content = $parts[0];
|
||||
$false_content = $parts[1] ?? '';
|
||||
|
||||
$condition = false;
|
||||
|
||||
if ($tag === 'if_first') {
|
||||
$condition = ($this->item_num === 1);
|
||||
} elseif ($tag === 'if_not_first') {
|
||||
$condition = ($this->item_num !== 1);
|
||||
} elseif ($tag === 'if_last') {
|
||||
$condition = $this->is_last;
|
||||
} elseif (strpos($tag, 'if_not_last') === 0) {
|
||||
$condition = !$this->is_last;
|
||||
} elseif (strpos($tag, 'if_every') === 0) {
|
||||
$mod = (int)($matches[2] ?? 0);
|
||||
$condition = ($this->item_num > 0 && $mod > 0 && ($this->item_num % $mod) === 0);
|
||||
} elseif (strpos($tag, 'if_not_every') === 0) {
|
||||
$mod = (int)($matches[3] ?? 0);
|
||||
$condition = ($this->item_num > 0 && $mod > 0 && ($this->item_num % $mod) !== 0);
|
||||
}
|
||||
|
||||
return $condition ? $true_content : $false_content;
|
||||
},
|
||||
$processed_content
|
||||
);
|
||||
|
||||
return $processed_content;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Функция для обработки тегов с использованием TagProcessor.
|
||||
*
|
||||
* @param string $items Строка с тегами.
|
||||
* @param int $item_num Текущий номер элемента.
|
||||
* @param bool $is_last Флаг, указывающий, является ли элемент последним.
|
||||
* @param object $row Объект с данными документа.
|
||||
* @param int $items_count Общее количество элементов на текущей странице.
|
||||
* @return string Обработанная строка.
|
||||
*/
|
||||
function request_process_tags($items, $item_num, $is_last, $row, $items_count)
|
||||
{
|
||||
// Создаем экземпляр обработчика, передавая общее количество
|
||||
$processor = new TagProcessor($item_num, $is_last, $row, (int)$row->rubric_id, $items_count);
|
||||
|
||||
// Обрабатываем содержимое и возвращаем результат
|
||||
return $processor->process($items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Достаем настройки запроса
|
||||
*
|
||||
* @param string|int $id Идентификатор или псевдоним запроса
|
||||
* @return object|string Объект с настройками запроса или пустая строка в случае ошибки
|
||||
*/
|
||||
function request_get_settings ($id)
|
||||
{
|
||||
global $AVE_DB;
|
||||
|
||||
// Получаем информацию о запросе
|
||||
$sql = "
|
||||
SELECT
|
||||
#REQUEST SETTINGS = " . $id . "
|
||||
*
|
||||
FROM
|
||||
" . PREFIX . "_request
|
||||
WHERE
|
||||
" . (is_numeric($id) ? 'Id' : 'request_alias') . " = '" . $id . "'
|
||||
";
|
||||
|
||||
// Выполняем запрос с учетом кеширования
|
||||
$reqest_settings = $AVE_DB->Query($sql, -1, 'rqs_' . $id, true, '.settings')->FetchRow();
|
||||
|
||||
// Выходим, если нет запроса
|
||||
if (! is_object($reqest_settings))
|
||||
return '';
|
||||
else
|
||||
return $reqest_settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Обработка условий запроса.
|
||||
* Возвращает строку условий в SQL-формате.
|
||||
*
|
||||
* @param int|string $id ID или алиас запроса.
|
||||
*
|
||||
* @return string Возвращает строку SQL-условия.
|
||||
*/
|
||||
function request_get_condition_sql_string($id)
|
||||
{
|
||||
global $AVE_DB, $AVE_Core;
|
||||
|
||||
// Используем request_get_settings() для получения ID и настроек запроса.
|
||||
$request_settings = request_get_settings($id);
|
||||
|
||||
// Выходим, если запрос не найден.
|
||||
if (!is_object($request_settings)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$from = [];
|
||||
$where = [];
|
||||
$retval = '';
|
||||
$i = 0;
|
||||
|
||||
if (!defined('ACP'))
|
||||
{
|
||||
$doc = 'doc_' . $AVE_Core->curentdoc->Id;
|
||||
|
||||
if (isset($_POST['req_' . $id]))
|
||||
{
|
||||
$_SESSION[$doc]['req_' . $id] = $_POST['req_' . $id];
|
||||
}
|
||||
elseif (isset($_SESSION[$doc]['req_' . $id]))
|
||||
{
|
||||
$_POST['req_' . $id] = $_SESSION[$doc]['req_' . $id];
|
||||
}
|
||||
}
|
||||
|
||||
// Теперь мы можем безопасно запросить условия, используя гарантированный ID.
|
||||
$sql_ak = $AVE_DB->Query(
|
||||
"
|
||||
SELECT
|
||||
condition_field_id,
|
||||
condition_value,
|
||||
condition_compare,
|
||||
condition_join
|
||||
FROM " . PREFIX . "_request_conditions
|
||||
WHERE
|
||||
request_id = '" . $request_settings->Id . "'
|
||||
AND condition_status = '1'
|
||||
ORDER BY
|
||||
condition_position ASC;
|
||||
",
|
||||
-1,
|
||||
'rqc_' . $request_settings->Id,
|
||||
true,
|
||||
'.conditions'
|
||||
);
|
||||
|
||||
if (!empty($_POST['req_' . $id]) && is_array($_POST['req_' . $id]))
|
||||
{
|
||||
foreach ($_POST['req_' . $id] as $fid => $val)
|
||||
{
|
||||
if (!($val != '' && isset($_SESSION['val_' . $fid]) && in_array($val, $_SESSION['val_' . $fid]))) continue;
|
||||
|
||||
if ($i) $from[] = "JOIN " . PREFIX . "_document_fields AS t$i ON t$i.document_id = t0.document_id";
|
||||
|
||||
$where[] = "t$i.rubric_field_id = " . $fid . " AND t$i.field_value = '" . $AVE_DB->Escape($val) . "'";
|
||||
|
||||
++$i;
|
||||
}
|
||||
}
|
||||
|
||||
while ($row_ak = $sql_ak->FetchRow())
|
||||
{
|
||||
$fid = $row_ak->condition_field_id;
|
||||
|
||||
if (isset($_POST['req_' . $id]) && isset($_POST['req_' . $id][$fid])) continue;
|
||||
|
||||
if ($i) $from[] = "JOIN " . PREFIX . "_document_fields AS t$i ON t$i.document_id = t0.document_id";
|
||||
|
||||
$val = $row_ak->condition_value;
|
||||
|
||||
switch ($row_ak->condition_compare)
|
||||
{
|
||||
case ' <': $where[] = "t$i.rubric_field_id = " . $fid . " AND t$i.field_value < '" . $AVE_DB->Escape($val) . "'"; break;
|
||||
case ' >': $where[] = "t$i.rubric_field_id = " . $fid . " AND t$i.field_value > '" . $AVE_DB->Escape($val) . "'"; break;
|
||||
case '<=': $where[] = "t$i.rubric_field_id = " . $fid . " AND t$i.field_value <= '" . $AVE_DB->Escape($val) . "'"; break;
|
||||
case '>=': $where[] = "t$i.rubric_field_id = " . $fid . " AND t$i.field_value >= '" . $AVE_DB->Escape($val) . "'"; break;
|
||||
case '==': $where[] = "t$i.rubric_field_id = " . $fid . " AND t$i.field_value = '" . $AVE_DB->Escape($val) . "'"; break;
|
||||
case '!=': $where[] = "t$i.rubric_field_id = " . $fid . " AND t$i.field_value != '" . $AVE_DB->Escape($val) . "'"; break;
|
||||
case '%%': $where[] = "t$i.rubric_field_id = " . $fid . " AND t$i.field_value LIKE '%" . $AVE_DB->Escape($val) . "%'"; break;
|
||||
case '%': $where[] = "t$i.rubric_field_id = " . $fid . " AND t$i.field_value LIKE '" . $AVE_DB->Escape($val) . "%'"; break;
|
||||
case '--': $where[] = "t$i.rubric_field_id = " . $fid . " AND t$i.field_value NOT LIKE '%" . $AVE_DB->Escape($val) . "%'"; break;
|
||||
case '!-': $where[] = "t$i.rubric_field_id = " . $fid . " AND t$i.field_value NOT LIKE '" . $AVE_DB->Escape($val) . "%'"; break;
|
||||
}
|
||||
|
||||
if ($i || $row_ak->condition_join == 'AND') ++$i;
|
||||
}
|
||||
|
||||
if (!empty($where))
|
||||
{
|
||||
$from = ' FROM ' . PREFIX . '_document_fields AS t0 ' . implode(' ', $from);
|
||||
$where = ' WHERE ' . (($i) ? implode(' AND ', $where) : '(' . implode(') OR(', $where) . ')');
|
||||
$retval = 'AND a.Id = ANY(SELECT t0.document_id' . $from . $where . ')';
|
||||
}
|
||||
|
||||
if (defined('ACP'))
|
||||
{
|
||||
$AVE_DB->Query("
|
||||
UPDATE " . PREFIX . "_request
|
||||
SET request_where_cond = '" . addslashes($retval) . "'
|
||||
WHERE Id = '" . $request_settings->Id . "'
|
||||
");
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Функция обработки тэгов полей с использованием шаблонов
|
||||
* в соответствии с типом поля
|
||||
*
|
||||
* @param int $rubric_id идентификатор рубрики
|
||||
* @param int $document_id идентификатор документа
|
||||
* @param int $maxlength максимальное количество символов обрабатываемого поля
|
||||
* @return string
|
||||
*/
|
||||
function request_get_document_field ($field_id, $document_id, $maxlength = null, $rubric_id = 0)
|
||||
{
|
||||
if (! is_numeric($document_id) || $document_id < 1)
|
||||
return '';
|
||||
|
||||
$_maxlength = $maxlength;
|
||||
|
||||
$document_fields = get_document_fields($document_id);
|
||||
|
||||
// ToDo
|
||||
if (! is_array($document_fields[$field_id]))
|
||||
$field_id = intval($document_fields[$field_id]);
|
||||
|
||||
if (empty($document_fields[$field_id]))
|
||||
return '';
|
||||
|
||||
$field_value = trim($document_fields[$field_id]['field_value']);
|
||||
|
||||
if ($field_value == '' && $document_fields[$field_id]['tpl_req_empty'])
|
||||
return '';
|
||||
|
||||
$func = 'get_field_' . $document_fields[$field_id]['rubric_field_type'];
|
||||
|
||||
if (! is_callable($func))
|
||||
$func = 'get_field_default';
|
||||
|
||||
$field_value = $func($field_value, 'req', $field_id, $document_fields[$field_id]['rubric_field_template_request'], $document_fields[$field_id]['tpl_req_empty'], $_maxlength, $document_fields, $rubric_id, $document_fields[$field_id]['rubric_field_default']);
|
||||
|
||||
if ($maxlength != '')
|
||||
{
|
||||
if ($maxlength == 'more' || $maxlength == 'esc'|| $maxlength == 'img' || $maxlength == 'strip')
|
||||
{
|
||||
if ($maxlength == 'more')
|
||||
{
|
||||
// ToDo - Вывести в настройки или в настройки самого запроса
|
||||
$teaser = explode('<a name="more"></a>', $field_value);
|
||||
$field_value = $teaser[0];
|
||||
}
|
||||
elseif ($maxlength == 'esc')
|
||||
{
|
||||
$field_value = addslashes($field_value);
|
||||
}
|
||||
elseif ($maxlength == 'img')
|
||||
{
|
||||
$field_value = getImgSrc($field_value);
|
||||
}
|
||||
elseif ($maxlength == 'strip')
|
||||
{
|
||||
$field_value = str_replace(array("\r\n","\n","\r"), " ", $field_value);
|
||||
$field_value = strip_tags($field_value, REQUEST_STRIP_TAGS);
|
||||
$field_value = preg_replace('/ +/', ' ', $field_value);
|
||||
$field_value = trim($field_value);
|
||||
}
|
||||
}
|
||||
elseif (is_numeric($maxlength))
|
||||
{
|
||||
if ($maxlength < 0)
|
||||
{
|
||||
$field_value = str_replace(array("\r\n","\n","\r"), " ", $field_value);
|
||||
$field_value = strip_tags($field_value, REQUEST_STRIP_TAGS);
|
||||
$field_value = preg_replace('/ +/', ' ', $field_value);
|
||||
$field_value = trim($field_value);
|
||||
|
||||
$maxlength = abs($maxlength);
|
||||
}
|
||||
// ToDo - сделать настройки окончаний = Уже есть в Доп настройках
|
||||
if ($maxlength != 0)
|
||||
{
|
||||
$field_value = truncate($field_value, $maxlength, REQUEST_ETC, REQUEST_BREAK_WORDS);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
return $field_value;
|
||||
}
|
||||
|
||||
function showteaser ($id, $tparams = '')
|
||||
{
|
||||
$item = showrequestelement($id, '', $tparams);
|
||||
$item = str_replace('[tag:path]', ABS_PATH, $item);
|
||||
$item = str_replace('[tag:mediapath]', ABS_PATH . 'templates/' . ((defined('THEME_FOLDER') === false) ? DEFAULT_THEME_FOLDER : THEME_FOLDER) . '/', $item);
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
// Функция получения уникальных параметров для каждого тизера
|
||||
function f_params_of_teaser ($id_param_array,$num)
|
||||
{
|
||||
global $params_of_teaser;
|
||||
return $params_of_teaser[$id_param_array][$num];
|
||||
}
|
||||
|
||||
// Функция получения элемента запроса
|
||||
function showrequestelement ($mixed, $template = '', $tparams = '', $req_item_num = null, $items_count = null, $is_last = null)
|
||||
{
|
||||
global
|
||||
$AVE_DB,
|
||||
$params_of_teaser,
|
||||
$use_cache,
|
||||
$request_id,
|
||||
$request_changed,
|
||||
$request_changed_elements;
|
||||
|
||||
if (is_array($mixed)) {
|
||||
$row = intval($mixed[1]);
|
||||
} else if (is_numeric($mixed)) {
|
||||
$row = intval($mixed);
|
||||
}
|
||||
|
||||
$row = (is_object($mixed) ? $mixed : getDocument($row));
|
||||
|
||||
unset ($mixed);
|
||||
|
||||
if (! $row) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$tparams_id = '';
|
||||
if ($tparams != '') {
|
||||
$tparams_id = $row->Id . md5($tparams);
|
||||
$params_of_teaser[$tparams_id] = [];
|
||||
$tparams = trim($tparams,'[]:');
|
||||
$params_of_teaser[$tparams_id] = explode('|',$tparams);
|
||||
}
|
||||
|
||||
$sql = "
|
||||
SELECT
|
||||
rubric_teaser_template
|
||||
FROM
|
||||
" . PREFIX . "_rubrics
|
||||
WHERE
|
||||
Id = '" . intval($row->rubric_id) . "'
|
||||
";
|
||||
|
||||
$template = ($template > ''
|
||||
? $template
|
||||
: $AVE_DB->Query($sql)->GetCell());
|
||||
|
||||
$hash = 'g-' . UGROUP;
|
||||
$hash .= 'r-' . $request_id;
|
||||
$hash .= 't-' . $row->Id;
|
||||
|
||||
if ($req_item_num !== null && $items_count !== null) {
|
||||
$hash .= 'num-' . $req_item_num;
|
||||
$hash .= 'total-' . $items_count;
|
||||
}
|
||||
|
||||
$hash = md5($hash);
|
||||
|
||||
$cache_id = 'requests/elements/' . (floor($row->Id / 1000)) . '/' . $row->Id;
|
||||
$cachefile_docid = BASE_DIR . '/tmp/cache/sql/' . $cache_id . '/' . $hash . '.element';
|
||||
|
||||
if (file_exists($cachefile_docid) && isset($use_cache) && $use_cache == 1) {
|
||||
$check_file = $request_changed_elements;
|
||||
if ($check_file > filemtime($cachefile_docid)) {
|
||||
unlink ($cachefile_docid);
|
||||
}
|
||||
} else {
|
||||
if (file_exists($cachefile_docid)) {
|
||||
unlink ($cachefile_docid);
|
||||
}
|
||||
}
|
||||
|
||||
if (defined('DEV_MODE') AND DEV_MODE) {
|
||||
$cachefile_docid = null;
|
||||
}
|
||||
|
||||
if (! file_exists($cachefile_docid)) {
|
||||
$link = rewrite_link('index.php?id=' . $row->Id . '&doc=' . (empty($row->document_alias) ? prepare_url($row->document_title) : $row->document_alias));
|
||||
$item = $template;
|
||||
|
||||
// Обработка всех условных тегов через TagProcessor
|
||||
if ($req_item_num !== null && $items_count !== null) {
|
||||
$tagProcessor = new TagProcessor($req_item_num, $is_last, $row, (int)$row->rubric_id, $items_count);
|
||||
$item = $tagProcessor->process($item);
|
||||
}
|
||||
|
||||
// Парсим теги визуальных блоков
|
||||
$item = preg_replace_callback('/\[tag:block:([A-Za-z0-9-_]{1,20}+)\]/', 'parse_block', $item);
|
||||
|
||||
// Парсим теги системных блоков
|
||||
$item = preg_replace_callback('/\[tag:sysblock:([A-Za-z0-9-_]{1,20}+)(|:\{(.*?)\})\]/',
|
||||
function ($m) {
|
||||
return parse_sysblock($m[1], $m[2]);
|
||||
},
|
||||
$item);
|
||||
|
||||
// Парсим элементы полей
|
||||
$item = preg_replace_callback('/\[tag:rfld:([a-zA-Z0-9-_]+)\]\[([0-9]+)]\[([0-9]+)]/',
|
||||
function ($m) use ($row) {
|
||||
return get_field_element($m[1], $m[2], $m[3], (int)$row->Id);
|
||||
},
|
||||
$item);
|
||||
|
||||
// Парсим теги полей
|
||||
$item = preg_replace_callback('/\[tag:rfld:([a-zA-Z0-9-_]+)\]\[(more|esc|img|strip|[0-9-]+)]/',
|
||||
function ($match) use ($row) {
|
||||
return request_get_document_field($match[1], (int)$row->Id, $match[2], (int)$row->rubric_id);
|
||||
},
|
||||
$item);
|
||||
|
||||
// Повторно парсим теги полей
|
||||
$item = preg_replace_callback('/\[tag:rfld:([a-zA-Z0-9-_]+)\]\[(more|esc|img|strip|[0-9-]+)]/',
|
||||
function ($m) use ($row) {
|
||||
return request_get_document_field($m[1], (int)$row->Id, $m[2], (int)$row->rubric_id);
|
||||
},
|
||||
$item);
|
||||
|
||||
// Возвращаем поле документа из БД (document_***)
|
||||
$item = preg_replace_callback('/\[tag:doc:([a-zA-Z0-9-_]+)\]/u',
|
||||
function ($m) use ($row) {
|
||||
return isset($row->{$m[1]}) ? $row->{$m[1]} : null;
|
||||
},
|
||||
$item
|
||||
);
|
||||
|
||||
// Если пришел вызов на активацию языковых файлов
|
||||
$item = preg_replace_callback(
|
||||
'/\[tag:langfile:([a-zA-Z0-9-_]+)\]/u',
|
||||
function ($m) {
|
||||
global $AVE_Template;
|
||||
return $AVE_Template->get_config_vars($m[1]);
|
||||
},
|
||||
$item
|
||||
);
|
||||
|
||||
// Абсолютный путь
|
||||
$item = str_replace('[tag:path]', ABS_PATH, $item);
|
||||
|
||||
// Путь к папке шаблона
|
||||
$item = str_replace('[tag:mediapath]', ABS_PATH . 'templates/' . ((defined('THEME_FOLDER') === false) ? DEFAULT_THEME_FOLDER : THEME_FOLDER) . '/', $item);
|
||||
|
||||
// Watermarks
|
||||
$item = preg_replace_callback('/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
|
||||
function ($m) {
|
||||
watermarks($m[1], $m[2], $m[3]);
|
||||
},
|
||||
$item);
|
||||
|
||||
// Удаляем ошибочные теги полей документа и языковые, в шаблоне рубрики
|
||||
$item = preg_replace('/\[tag:doc:\d*\]/', '', $item);
|
||||
$item = preg_replace('/\[tag:langfile:\d*\]/', '', $item);
|
||||
|
||||
// Делаем линки на миниатюры
|
||||
$item = preg_replace_callback('/\[tag:([r|c|f|t|s]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $item);
|
||||
|
||||
// Если был вызов тизера, ищем параметры
|
||||
if ($tparams != '') {
|
||||
$item = preg_replace_callback('/\[tparam:([0-9]+)\]/',
|
||||
function ($m) use ($tparams_id) {
|
||||
return f_params_of_teaser($tparams_id, $m[1]);
|
||||
},
|
||||
$item);
|
||||
} else {
|
||||
$item = preg_replace('/\[tparam:([0-9]+)\]/', '', $item);
|
||||
}
|
||||
|
||||
$item = str_replace('[tag:domain]', getSiteUrl(), $item);
|
||||
$item = str_replace('[tag:link]', $link, $item);
|
||||
$item = str_replace('[tag:docid]', $row->Id, $item);
|
||||
$item = str_replace('[tag:itemid]', $row->Id, $item);
|
||||
$item = str_replace('[tag:docitemnum]', $req_item_num, $item);
|
||||
$item = str_replace('[tag:adminlink]', 'index.php?do=docs&action=edit&rubric_id=' . $row->rubric_id . '&Id=' . $row->Id . '&cp=' . session_id() . '', $item);
|
||||
$item = str_replace('[tag:doctitle]', stripslashes(htmlspecialchars_decode($row->document_title)), $item);
|
||||
$item = str_replace('[tag:docparent]', $row->document_parent, $item);
|
||||
$item = str_replace('[tag:doclang]', $row->document_lang, $item);
|
||||
$item = str_replace('[tag:docdate]', translate_date(strftime(DATE_FORMAT, $row->document_published)), $item);
|
||||
$item = str_replace('[tag:doctime]', translate_date(strftime(TIME_FORMAT, $row->document_published)), $item);
|
||||
$item = str_replace('[tag:humandate]', human_date($row->document_published), $item);
|
||||
|
||||
$item = preg_replace_callback('/\[tag:date:([a-zA-Z0-9-. \/]+)\]/',
|
||||
function ($m) use ($row) {
|
||||
return translate_date(date($m[1], $row->document_published));
|
||||
},
|
||||
$item);
|
||||
|
||||
if (preg_match('/\[tag:docauthor]/u', $item)) {
|
||||
$item = str_replace('[tag:docauthor]', get_username_by_id($row->document_author_id), $item);
|
||||
}
|
||||
|
||||
$item = str_replace('[tag:docauthorid]', $row->document_author_id, $item);
|
||||
|
||||
$item = preg_replace_callback('/\[tag:docauthoravatar:(\d+)\]/',
|
||||
function ($m) use ($row) {
|
||||
return getAvatar(intval($row->document_author_id), $m[1]);
|
||||
},
|
||||
$item);
|
||||
|
||||
if (isset($use_cache) && $use_cache == 1) {
|
||||
if (! file_exists(dirname($cachefile_docid))) {
|
||||
@mkdir(dirname($cachefile_docid), 0777, true);
|
||||
}
|
||||
file_put_contents($cachefile_docid, $item);
|
||||
}
|
||||
} else {
|
||||
$item = file_get_contents($cachefile_docid);
|
||||
}
|
||||
|
||||
// Кол-во просмотров
|
||||
$item = str_replace('[tag:docviews]', $row->document_count_view, $item);
|
||||
|
||||
Registry::remove('documents', $row->Id);
|
||||
Registry::remove('fields', $row->Id);
|
||||
Registry::remove('fields_param', $row->Id);
|
||||
|
||||
unset($row, $template);
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Парсинг запроса
|
||||
*
|
||||
* @param int|string $id Идентификатор или псевдоним запроса
|
||||
* @return string
|
||||
*/
|
||||
function request_parse($id)
|
||||
{
|
||||
global $AVE_Core, $AVE_DB, $request_documents;
|
||||
|
||||
// Начальная проверка ID
|
||||
if (is_array($id)) {
|
||||
$id = $id[1];
|
||||
}
|
||||
|
||||
// Получаем информацию о запросе. Эта функция должна создать .settings файл
|
||||
$request = request_get_settings($id);
|
||||
|
||||
// Выходим, если запрос не найден
|
||||
if (!is_object($request)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Фиксируем время начала генерации запроса
|
||||
Debug::startTime('request_' . $id);
|
||||
|
||||
// Инициализация переменных из настроек запроса
|
||||
$limit = ($request->request_items_per_page < 1) ? 1 : $request->request_items_per_page;
|
||||
$main_template = $request->request_template_main;
|
||||
$item_template = $request->request_template_item;
|
||||
$request_order_by = $request->request_order_by;
|
||||
$request_order_by_nat = intval($request->request_order_by_nat);
|
||||
$request_asc_desc = $request->request_asc_desc;
|
||||
|
||||
// Генерируем строку условий
|
||||
$where_cond = request_get_condition_sql_string($request->Id);
|
||||
$where_cond = str_replace('%%PREFIX%%', PREFIX, $where_cond);
|
||||
|
||||
// Динамическое формирование WHERE-части запросов
|
||||
$where_common = "
|
||||
a.Id != '1'
|
||||
AND a.Id != '" . PAGE_NOT_FOUND_ID . "'
|
||||
AND a.rubric_id = '" . (int)$request->rubric_id . "'
|
||||
AND a.document_deleted != '1'
|
||||
AND a.document_status != '0'
|
||||
" . $hide_current_condition . "
|
||||
" . $owner_condition . "
|
||||
" . $lang_condition . "
|
||||
" . $where_cond . "
|
||||
" . $doctime . "
|
||||
";
|
||||
|
||||
// Определение частей запроса в зависимости от наличия модуля комментариев и нативной сортировки
|
||||
$join_comment = !empty($AVE_Core->install_modules['comment']->Status)
|
||||
? "LEFT JOIN " . PREFIX . "_modul_comment_info AS b ON b.document_id = a.Id"
|
||||
: "";
|
||||
$select_comment_count = !empty($AVE_Core->install_modules['comment']->Status)
|
||||
? ", COUNT(b.document_id) AS nums"
|
||||
: "";
|
||||
$group_by_doc_id = !empty($AVE_Core->install_modules['comment']->Status)
|
||||
? "GROUP BY a.Id"
|
||||
: "";
|
||||
|
||||
if ($request_order_by_nat != 0) {
|
||||
$join_fields = "LEFT JOIN " . PREFIX . "_document_fields AS d ON a.Id = d.document_id";
|
||||
$where_fields = "AND d.rubric_field_id = " . intval($request_order_by_nat);
|
||||
$select_fields = ", d.field_value, d.rubric_field_id";
|
||||
$order_by = "ORDER BY d.field_value " . ($request_asc_desc === 'DESC' ? 'DESC' : 'ASC');
|
||||
} else {
|
||||
$join_fields = "";
|
||||
$where_fields = "";
|
||||
$select_fields = "";
|
||||
$order_by = "ORDER BY " . $request_order_by . " " . $request_asc_desc;
|
||||
}
|
||||
|
||||
$num_items = 0;
|
||||
$num_pages = 0;
|
||||
$start = 0;
|
||||
|
||||
// Условное выполнение запроса для подсчета общего количества элементов
|
||||
if ($request->request_show_pagination == 1 || $request->request_count_items == 1) {
|
||||
// Формируем запрос для подсчета количества элементов
|
||||
$count_sql = "
|
||||
SELECT COUNT(*)
|
||||
FROM " . PREFIX . "_documents AS a
|
||||
" . $join_fields . "
|
||||
WHERE
|
||||
" . $where_common . "
|
||||
" . $where_fields . "
|
||||
";
|
||||
|
||||
// Получаем общее количество элементов, используя кеширование
|
||||
$num_items = $AVE_DB->Query($count_sql, (int)$request->request_cache_lifetime, 'rqs_' . $id, true, '.count')->GetCell();
|
||||
}
|
||||
|
||||
// Если пагинация включена, вычисляем количество страниц и начальную позицию
|
||||
if ($request->request_show_pagination == 1) {
|
||||
$num_pages = ceil($num_items / $limit);
|
||||
$start = get_current_page('page') * $limit - $limit;
|
||||
}
|
||||
|
||||
// Формируем финальный запрос для выборки данных
|
||||
$main_sql_query = "
|
||||
SELECT
|
||||
a.Id,
|
||||
a.document_title,
|
||||
a.document_alias,
|
||||
a.document_parent,
|
||||
a.document_author_id,
|
||||
a.document_count_view,
|
||||
a.document_published,
|
||||
a.document_lang
|
||||
" . $select_comment_count . "
|
||||
" . $select_fields . "
|
||||
FROM
|
||||
" . PREFIX . "_documents AS a
|
||||
" . $join_comment . "
|
||||
" . $join_fields . "
|
||||
WHERE
|
||||
" . $where_common . "
|
||||
" . $where_fields . "
|
||||
" . $group_by_doc_id . "
|
||||
" . $order_by . "
|
||||
LIMIT " . $start . "," . $limit . "
|
||||
";
|
||||
|
||||
// Отладочный вывод SQL-запроса, если это необходимо
|
||||
if ($request->request_show_sql == 1) {
|
||||
$return = Debug::_print($main_sql_query);
|
||||
return $return;
|
||||
}
|
||||
|
||||
// Выполняем запрос с кешированием, создавая файл .request
|
||||
Debug::startTime('SQL');
|
||||
$q = $AVE_DB->Query($main_sql_query, (int)$request->request_cache_lifetime, 'rqs_' . $id, true, '.request');
|
||||
$GLOBALS['block_generate']['REQUESTS'][$id]['SQL'] = Debug::endTime('SQL');
|
||||
|
||||
$rows = array();
|
||||
$request_documents = array();
|
||||
while ($row = $q->FetchRow()) {
|
||||
array_push($request_documents, $row->Id);
|
||||
array_push($rows, $row);
|
||||
}
|
||||
|
||||
// Условное отображение контента
|
||||
if ($q->NumRows() > 0) {
|
||||
$main_template = preg_replace('/\[tag:if_empty](.*?)\[\/tag:if_empty]/si', '', $main_template);
|
||||
$main_template = str_replace(array('[tag:if_notempty]','[/tag:if_notempty]'), '', $main_template);
|
||||
} else {
|
||||
$main_template = preg_replace('/\[tag:if_notempty](.*?)\[\/tag:if_notempty]/si', '', $main_template);
|
||||
$main_template = str_replace(array('[tag:if_empty]','[/tag:if_empty]'), '', $main_template);
|
||||
}
|
||||
|
||||
// Формирование пагинации
|
||||
$pagination = '';
|
||||
if ($request->request_show_pagination == 1 && $num_pages > 1) {
|
||||
@$GLOBALS['page_id'][$_REQUEST['id']]['page'] = (isset($GLOBALS['page_id'][$_REQUEST['id']]['page']) && $GLOBALS['page_id'][$_REQUEST['id']]['page'] > $num_pages) ? @$GLOBALS['page_id'][$_REQUEST['id']]['page'] : $num_pages;
|
||||
$queries = ($request->request_use_query == 1 || (isset($params['ADD_GET']) && $params['ADD_GET'] == 1)) ? ((isset($_SERVER['QUERY_STRING'])) ? '?' . $_SERVER['QUERY_STRING'] : '') : '';
|
||||
$pagination_base = 'index.php?id=' . $AVE_Core->curentdoc->Id . '&doc=' . (empty($AVE_Core->curentdoc->document_alias) ? prepare_url($AVE_Core->curentdoc->document_title) : $AVE_Core->curentdoc->document_alias) . '&page={s}';
|
||||
$pagination_params = ((isset($_REQUEST['artpage']) && is_numeric($_REQUEST['artpage'])) ? '&artpage=' . $_REQUEST['artpage'] : '') . ((isset($_REQUEST['apage']) && is_numeric($_REQUEST['apage'])) ? '&apage=' . $_REQUEST['apage'] : '');
|
||||
$pagination_full = $pagination_base . $pagination_params . clean_php($queries);
|
||||
$pagination_id = (isset($params['PAGINATION']) && $params['PAGINATION'] > 0) ? $params['PAGINATION'] : $request->request_pagination;
|
||||
$pagination = AVE_Paginations::getPagination($num_pages, 'page', $pagination_full, $pagination_id);
|
||||
|
||||
// Костыли для главной страницы
|
||||
$pagination = str_ireplace('"//"', '"/"', str_ireplace('///', '/', rewrite_link($pagination)));
|
||||
$pagination = str_ireplace('"//' . URL_SUFF . '"', '"/"', $pagination);
|
||||
if ($request->request_use_query == 1 || (isset($params['ADD_GET']) && $params['ADD_GET'] == 1)) {
|
||||
$pagination = preg_replace('/(?<!:)\/\//', '/', $pagination);
|
||||
}
|
||||
}
|
||||
|
||||
// Обработка шаблонов элементов
|
||||
$items = '';
|
||||
$x = 0;
|
||||
$items_count = count($rows);
|
||||
|
||||
global $req_item_num, $use_cache, $request_id, $request_changed, $request_changed_elements;
|
||||
|
||||
$use_cache = $request->request_cache_elements;
|
||||
|
||||
$request_id = $request->Id;
|
||||
|
||||
$request_changed = $request->request_changed;
|
||||
$request_changed_elements = $request->request_changed_elements;
|
||||
|
||||
Debug::startTime('ELEMENTS_ALL');
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$x++;
|
||||
$last_item = ($x == $items_count);
|
||||
$req_item_num = $x;
|
||||
|
||||
// Передаем элемент для обработки и кэширования в showrequestelement.
|
||||
$items .= showrequestelement($row, $item_template, '', $req_item_num, $items_count, $last_item);
|
||||
}
|
||||
|
||||
$GLOBALS['block_generate']['REQUESTS'][$id]['ELEMENTS']['ALL'] = Debug::endTime('ELEMENTS_ALL');
|
||||
|
||||
// Обработка основного шаблона
|
||||
$main_template = str_replace('[tag:pages]', $pagination, $main_template);
|
||||
$main_template = str_replace('[tag:docid]', $AVE_Core->curentdoc->Id, $main_template);
|
||||
$main_template = str_replace('[tag:pagetitle]', stripslashes(htmlspecialchars_decode($AVE_Core->curentdoc->document_title)), $main_template);
|
||||
$main_template = str_replace('[tag:pages:curent]', get_current_page('page'), $main_template);
|
||||
$main_template = str_replace('[tag:pages:total]', $num_pages, $main_template);
|
||||
$main_template = str_replace('[tag:doctotal]', $num_items, $main_template);
|
||||
$main_template = str_replace('[tag:doconpage]', $x, $main_template);
|
||||
$main_template = str_replace('[tag:docdate]', pretty_date(strftime(DATE_FORMAT, $AVE_Core->curentdoc->document_published)), $main_template);
|
||||
$main_template = str_replace('[tag:doctime]', pretty_date(strftime(TIME_FORMAT, $AVE_Core->curentdoc->document_published)), $main_template);
|
||||
$main_template = str_replace('[tag:docauthor]', get_username_by_id($AVE_Core->curentdoc->document_author_id), $main_template);
|
||||
$main_template = preg_replace_callback('/\[tag:dropdown:([,0-9]+)\]/', function($m) use ($request) {
|
||||
return request_get_dropdown($m[1], (int)$request->rubric_id, (int)$request->Id);
|
||||
}, $main_template);
|
||||
$main_template = preg_replace_callback('/\[tag:date:([a-zA-Z0-9-. \/]+)\]/', function ($match) use ($AVE_Core) {
|
||||
return translate_date(date($match[1], $AVE_Core->curentdoc->document_published));
|
||||
}, $main_template);
|
||||
$main_template = preg_replace_callback('/\[tag:langfile:([a-zA-Z0-9-_]+)\]/u', function ($match) {
|
||||
global $AVE_Template;
|
||||
return $AVE_Template->get_config_vars($match[1]);
|
||||
}, $main_template);
|
||||
$main_template = preg_replace_callback('/\[tag:sysblock:([A-Za-z0-9-_]{1,20}+)\]/', 'parse_sysblock', $main_template);
|
||||
$main_template = preg_replace_callback('/\[tag:block:([A-Za-z0-9-_]{1,20}+)\]/', 'parse_block', $main_template);
|
||||
|
||||
$return = str_replace('[tag:content]', $items, $main_template);
|
||||
$return = str_replace('[tag:path]', ABS_PATH, $return);
|
||||
$return = str_replace('[tag:mediapath]', ABS_PATH . 'templates/' . ((defined('THEME_FOLDER') === false) ? DEFAULT_THEME_FOLDER : THEME_FOLDER) . '/', $return);
|
||||
$return = $AVE_Core->coreModuleTagParse($return);
|
||||
|
||||
// Фиксируем время генерации запроса
|
||||
$GLOBALS['block_generate']['REQUESTS'][$id]['TIME'] = Debug::endTime('request_' . $id);
|
||||
|
||||
if ($request->request_show_statistic) {
|
||||
$return .= "<div class=\"request_statistic\"><br>Найдено: $num_items<br>Показано: $items_count<br>Время генерации: " . Debug::endTime('request_' . $id) . " сек<br>Пиковое значение: " . number_format(memory_get_peak_usage() / 1024, 0, ',', ' ') . ' Kb</div>';
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Функция получения содержимого поля для обработки в шаблоне запроса
|
||||
* <pre>
|
||||
* Пример использования в шаблоне:
|
||||
* <li>
|
||||
* <?php
|
||||
* $r = request_get_document_field_value(12, [tag:docid]);
|
||||
* echo $r . ' (' . strlen($r) . ')';
|
||||
* ?>
|
||||
* </li>
|
||||
* </pre>
|
||||
*
|
||||
* @param int $rubric_id идентификатор поля, для [tag:rfld:12][150] $rubric_id = 12
|
||||
* @param int $document_id идентификатор документа к которому принадлежит поле.
|
||||
* @param int $maxlength необязательный параметр, количество возвращаемых символов.
|
||||
* Если данный параметр указать со знаком минус
|
||||
* содержимое поля будет очищено от HTML-тэгов.
|
||||
* @return string
|
||||
*/
|
||||
function request_get_document_field_value($rubric_id, $document_id, $maxlength = 0)
|
||||
{
|
||||
if (!is_numeric($rubric_id) || $rubric_id < 1 || !is_numeric($document_id) || $document_id < 1) return '';
|
||||
|
||||
$document_fields = get_document_fields($document_id);
|
||||
|
||||
$field_value = isset($document_fields[$rubric_id]) ? $document_fields[$rubric_id]['field_value'] : '';
|
||||
|
||||
if (!empty($field_value))
|
||||
{
|
||||
$field_value = strip_tags($field_value, '<br /><strong><em><p><i>');
|
||||
$field_value = str_replace('[tag:mediapath]', ABS_PATH . 'templates/' . THEME_FOLDER . '/', $field_value);
|
||||
}
|
||||
|
||||
if (is_numeric($maxlength) && $maxlength != 0)
|
||||
{
|
||||
if ($maxlength < 0)
|
||||
{
|
||||
$field_value = str_replace(array("\r\n", "\n", "\r"), ' ', $field_value);
|
||||
$field_value = strip_tags($field_value);
|
||||
$field_value = preg_replace('/ +/', ' ', $field_value);
|
||||
$maxlength = abs($maxlength);
|
||||
}
|
||||
$field_value = substr($field_value, 0, $maxlength) . (strlen($field_value) > $maxlength ? '... ' : '');
|
||||
}
|
||||
|
||||
return $field_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Функция формирования выпадающих списков
|
||||
* для управления условиями запроса в публичной части
|
||||
*
|
||||
* @param string $dropdown_ids идентификаторы полей
|
||||
* типа выпадающий список указанные через запятую
|
||||
* @param int $rubric_id идентификатор рубрики
|
||||
* @param int $request_id идентификатор запроса
|
||||
* @return string
|
||||
*/
|
||||
function request_get_dropdown($dropdown_ids, $rubric_id, $request_id)
|
||||
{
|
||||
global $AVE_Core, $AVE_DB, $AVE_Template;
|
||||
|
||||
// Получаем настройки запроса
|
||||
$request_settings = request_get_settings($request_id);
|
||||
|
||||
if (!is_object($request_settings)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$dropdown_ids = explode(',', preg_replace('/[^,\\d]/', '', $dropdown_ids));
|
||||
$dropdown_ids[] = 0;
|
||||
$dropdown_ids = implode(',', $dropdown_ids);
|
||||
$doc = 'doc_' . $AVE_Core->curentdoc->Id;
|
||||
$control = array();
|
||||
|
||||
// Для кеширования, используем $request_id в качестве уникального идентификатора.
|
||||
$sql = $AVE_DB->Query(
|
||||
"
|
||||
SELECT
|
||||
Id,
|
||||
rubric_field_title,
|
||||
rubric_field_default
|
||||
FROM " . PREFIX . "_rubric_fields
|
||||
WHERE Id IN(" . $dropdown_ids . ")
|
||||
AND rubric_id = '" . $rubric_id . "'
|
||||
AND rubric_field_type = 'drop_down'
|
||||
", -1, 'rqs_' . $request_id, true, '.dropdown');
|
||||
|
||||
while ($row = $sql->FetchRow())
|
||||
{
|
||||
$dropdown['titel'] = $row->rubric_field_title;
|
||||
$dropdown['selected'] = isset($_SESSION[$doc]['req_' . $request_id][$row->Id]) ? $_SESSION[$doc]['req_' . $request_id][$row->Id] : '';
|
||||
$dropdown['options'] = $_SESSION['val_' . $row->Id] = explode(',', $row->rubric_field_default);
|
||||
$control[$row->Id] = $dropdown;
|
||||
}
|
||||
|
||||
$AVE_Template->assign('request_id', $request_id);
|
||||
$AVE_Template->assign('ctrlrequest', $control);
|
||||
return $AVE_Template->fetch(BASE_DIR . '/templates/' . THEME_FOLDER . '/tpl/request/public.tpl');
|
||||
}
|
||||
|
||||
?>
|
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Файл-заглушка, предназначенный для запрета показа списка файлов в текущей директории,
|
||||
* если через адресную строку браузера было прямое общращение к данной директории.
|
||||
*/
|
||||
header('Location:/');
|
||||
exit;
|
||||
?>
|
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
header('Location:/');
|
||||
exit;
|
||||
?>
|
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
header('Location:/');
|
||||
exit;
|
||||
?>
|
@@ -0,0 +1,16 @@
|
||||
<form method="post" class="ctrlrequest" action="">
|
||||
<table>
|
||||
<tr>
|
||||
{foreach from=$ctrlrequest item=items key=selname}
|
||||
<td>
|
||||
<label>{$items.titel} </label>
|
||||
<select name="req_{$request_id}[{$selname}]">
|
||||
<option value=''>Все</option>
|
||||
{html_options values=$items.options output=$items.options selected=$items.selected}
|
||||
</select>
|
||||
</td>
|
||||
{/foreach}
|
||||
<td><input type="submit" class="button" value="Отфильтровать" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
8
inc/query_variants/safe_files/templates/index.php
Normal file
8
inc/query_variants/safe_files/templates/index.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Файл-заглушка, предназначенный для запрета показа списка файлов в текущей директории,
|
||||
* если через адресную строку браузера было прямое общращение к данной директории.
|
||||
*/
|
||||
header('Location:/');
|
||||
exit;
|
||||
?>
|
Reference in New Issue
Block a user