Browse Source

Fixes

pull/3/head
M@dD3n 5 years ago
parent
commit
75ba366d1c
  1. 10
      admin/docs.php
  2. 6
      admin/lang/ru/docs.txt
  3. 5
      admin/lang/ru/sysblocks.txt
  4. 2
      admin/sysblocks.php
  5. 32
      admin/templates/documents/doc_search.tpl
  6. 27
      admin/templates/sysblocks/form.tpl
  7. 31
      admin/templates/sysblocks/form_visual.tpl
  8. 266
      admin/templates/sysblocks/list.tpl
  9. 12
      admin/templates/sysblocks/multi.tpl
  10. 13
      admin/templates/sysblocks/start.tpl
  11. 44
      class/class.docs.php
  12. 117
      class/class.sysblocks.php
  13. 31
      functions/func.common.php
  14. 47
      tmp/update/sql.update.php

10
admin/docs.php

@ -40,6 +40,8 @@
switch($_REQUEST['action'])
{
case '' :
$_docs_template = 'documents/docs.tpl';
if (check_permission_acp('document_view'))
{
switch($_REQUEST['sub'])
@ -50,7 +52,13 @@
}
$AVE_Document->documentListGet();
}
$AVE_Template->assign('content', $AVE_Template->fetch('documents/docs.tpl'));
if (isset($_REQUEST['rubric_id']) && is_numeric($_REQUEST['rubric_id']))
// Если существет файл с ID рубрики
if (file_exists(BASE_DIR . '/admin/templates/documents/docs-' .$_REQUEST['rubric_id'] . '.tpl'))
$_docs_template = 'documents/docs-' . $_REQUEST['rubric_id'] . '.tpl';
$AVE_Template->assign('content', $AVE_Template->fetch($_docs_template));
break;
case 'add_new':

6
admin/lang/ru/docs.txt

@ -309,3 +309,9 @@ DOCUMENT_POSITION_ERR = "Не удалось сохранить позиц
DOCUMENT_POSITION_ERROR = "Ошибка"
DOCUMENT_POSITION_OK = "Позиция документа успешно сохранена"
DOCUMENT_POSITION_SUCCESS = "Выполнено"
DOC_SEARCH_PARAM = "Параметр документа"
DOC_SEARCH_PARAM_SELECT = "Выберите параметр"
DOC_SEARCH_PARAM_LIKE = "Содержит"
DOC_SEARCH_PARAM_EQ = "Равно"
DOC_SEARCH_PARAM_TEXT = "Значение"

5
admin/lang/ru/sysblocks.txt

@ -75,5 +75,8 @@ SYSBLOCK_ACCEPT = "Этот алиас можно использовать"
SYSBLOCK_ER_SYN = "Неверный алиас!<br> Алиас не должен являться числом, может содержать только цифры, латинские буквы, дефис, подчёркивание и иметь длину не более 20 символов"
SYSBLOCK_ER_EXISTS = "Неверный алиас!<br> Данный алиас уже привязан к другоому системному блоку"
// v 3.25
// v 3.26
SYSBLOCK_EVAL = "Выполнять PHP перед возвращением результата"
SYS_GROUP_NO_TITLE = "Без группы"
SYS_GROUP_NO_DESCRIPTION = "Описание отсутвует"
SYS_GROUP_PLEASE_SELECT = "Выберите группу"

2
admin/sysblocks.php

@ -87,7 +87,7 @@
case 'multi':
if (check_permission_acp('sysblocks_edit'))
{
//
Sysblocks::multiBlock();
}
}
?>

32
admin/templates/documents/doc_search.tpl

@ -168,6 +168,32 @@
</tr>
{/if}
<tr>
<td>
<strong>{#DOC_SEARCH_PARAM#}</strong>
</td>
<td colspan="2">
<select style="width:250px" name="param_id">
<option value="">{#DOC_SEARCH_PARAM_SELECT#}</option>
{foreach from=$params item=param}
<option value="{$param}" {if $smarty.request.param_id == $param}selected{/if}>{$param}</option>
{/foreach}
</select>
</td>
<td>
<select style="width:150px" name="param_request">
<option value="like" {if $smarty.request.param_request == 'like'}selected{/if}>{#DOC_SEARCH_PARAM_LIKE#}</option>
<option value="eq" {if $smarty.request.param_request == 'eq'}selected{/if}>{#DOC_SEARCH_PARAM_EQ#}</option>
</select>
</td>
<td colspan="2">
<div class="pr12">
<input id="" name="param_search" type="text" value="{$smarty.request.param_search|default:""}" placeholder="{#DOC_SEARCH_PARAM_TEXT#}" />
</div>
</td>
</tr>
<tr>
<td>
<strong>{#DOC_LANG_ID#}</strong>
@ -185,9 +211,9 @@
<strong>{#MAIN_RESULTS_ON_PAGE#}</strong>
</td>
<td>
<select style="width:70px" name="Datalimit">
{section loop=150 name=dl step=15}
<option value="{$smarty.section.dl.index+15}" {if $smarty.request.Datalimit==$smarty.section.dl.index+15}selected{/if}>{$smarty.section.dl.index+15}</option>
<select style="width:70px" name="limit">
{section loop=500 name=dl step=50}
<option value="{$smarty.section.dl.index+50}" {if $smarty.request.limit==$smarty.section.dl.index+50}selected{/if}>{$smarty.section.dl.index+50}</option>
{/section}
</select>
</td>

27
admin/templates/sysblocks/form.tpl

@ -23,7 +23,7 @@
<a href="index.php?do=sysblocks&cp={$sess}" title="">{#SYSBLOCK_LIST_LINK#}</a>
</li>
<li>{if $smarty.request.id != ''}{#SYSBLOCK_EDIT_H#}{else}{#SYSBLOCK_INSERT_H#}{/if}</li>
<li><strong class="code">{if $smarty.request.id != ''}{$sysblock_name|escape}{else}{$smarty.request.sysblock_name}{/if}</strong></li>
<li><strong class="code">{if $smarty.request.id != ''}{$sysblock_name|escape|default:'New'}{else}{$smarty.request.sysblock_name|default:'New'}{/if}</strong></li>
</ul>
</div>
</div>
@ -34,7 +34,7 @@
<h5 class="iFrames">{if $smarty.request.id != ''}{#SYSBLOCK_EDIT_H#}{else}{#SYSBLOCK_INSERT_H#}{/if}</h5>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<col width="300">
<col width="350">
<col width="300">
<col width="300">
<col>
@ -71,6 +71,26 @@
</td>
</tr>
<tr>
<td>
<div class="nowrap">
Группа
</div>
</td>
<td colspan="4">
<div class="pr12">
<select style="width:350px" name="sysblock_group_id" id="group_id" class="mousetrap">
<option value="" {if $smarty.request.action == 'new' && $smarty.request.id == ''}selected{/if}>{#SYS_GROUP_PLEASE_SELECT#}</option>
{foreach from=$groups item=group}
<option value="{$group->id}"{if $sysblock_group_id == $group->id} selected="selected"{/if}>{$group->title|escape}</option>
{/foreach}
</select>
</div>
</td>
</tr>
<tr>
<td>
<input type="checkbox" value="1" name="sysblock_eval" class="float" {if $sysblock_eval}checked="checked"{/if} /><label>{#SYSBLOCK_EVAL#}</label>
</td>
<td>
<input type="checkbox" value="1" name="sysblock_external" class="float" {if $sysblock_external}checked="checked"{/if} /><label>{#SYSBLOCK_EXTERNAL#}</label>
</td>
@ -80,9 +100,6 @@
<td>
<input type="checkbox" value="1" name="sysblock_visual" class="float" {if $sysblock_visual}checked="checked"{/if} /><label>{#SYSBLOCK_VISUAL#}</label>
</td>
<td>
<input type="checkbox" value="1" name="sysblock_eval" class="float" {if $sysblock_eval}checked="checked"{/if} /><label>{#SYSBLOCK_EVAL#}</label>
</td>
</tr>
{if $sysblock_external}
<tr>

31
admin/templates/sysblocks/form_visual.tpl

@ -34,13 +34,13 @@
<h5 class="iFrames">{if $smarty.request.id != ''}{#SYSBLOCK_EDIT_H#}{else}{#SYSBLOCK_INSERT_H#}{/if}</h5>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<col width="300">
<col width="350">
<col width="300">
<col width="300">
<col>
<tr class="noborder">
<td><strong>{#SYSBLOCK_NAME#}</strong></td>
<td colspan="3">
<td colspan="4">
<div class="pr12">
<input name="sysblock_name" class="mousetrap" type="text" value="{if $smarty.request.id != ''}{$sysblock_name|escape}{else}{$smarty.request.sysblock_name}{/if}" />
</div>
@ -48,7 +48,7 @@
</tr>
<tr>
<td>{#SYSBLOCK_DESCRIPTION#}</td>
<td colspan="3">
<td colspan="4">
<input name="sysblock_description" type="text" id="sysblock_description" value="{if $smarty.request.id != ''}{$sysblock_description|escape}{else}{$smarty.request.sysblock_description}{/if}" placeholder="{#SYSBLOCK_DESCRIPTION#}">
</td>
</tr>
@ -58,7 +58,7 @@
<strong><a class="toprightDir" title="{#SYSBLOCK_I#}">[?]</a></strong> {#SYSBLOCK_ALIAS#}:
</div>
</td>
<td colspan="3">
<td colspan="4">
<div class="pr12">
<input type="text" name="sysblock_alias" id="sysblock_alias" value="{if $smarty.request.id != ''}{$sysblock_alias|escape}{else}{$smarty.request.sysblock_alias}{/if}" class="mousetrap" data-accept="{#SYSBLOCK_ACCEPT#}" data-error-syn="{#SYSBLOCK_ER_SYN#}" data-error-exists="{#SYSBLOCK_ER_EXISTS#}" placeholder="{#SYSBLOCK_ALIAS#}" maxlength="20" style="width: 200px;" autocomplete="off" />&nbsp;
<input type="text" id="sysblock_alias_tag" value="[tag:sysblock:{if $smarty.request.id != ''}{$sysblock_alias|escape}{else}{$smarty.request.sysblock_alias}{/if}]" readonly size="40" class="mousetrap" style="width: 200px;" />
@ -69,6 +69,26 @@
</td>
</tr>
<tr>
<td>
<div class="nowrap">
Группа
</div>
</td>
<td colspan="4">
<div class="pr12">
<select style="width:350px" name="sysblock_group_id" id="group_id" class="mousetrap">
<option value="" {if $smarty.request.action == 'new' && $smarty.request.id == ''}selected{/if}>{#SYS_GROUP_PLEASE_SELECT#}</option>
{foreach from=$groups item=group}
<option value="{$group->id}"{if $sysblock_group_id == $group->id} selected="selected"{/if}>{$group->title|escape}</option>
{/foreach}
</select>
</div>
</td>
</tr>
<tr>
<td>
<input type="checkbox" value="1" name="sysblock_eval" class="float" {if $sysblock_eval}checked="checked"{/if} /><label>{#SYSBLOCK_EVAL#}</label>
</td>
<td>
<input type="checkbox" value="1" name="sysblock_external" class="float" {if $sysblock_external}checked="checked"{/if} /><label>{#SYSBLOCK_EXTERNAL#}</label>
</td>
@ -78,9 +98,6 @@
<td>
<input type="checkbox" value="1" name="sysblock_visual" class="float" {if $sysblock_visual}checked="checked"{/if} /><label>{#SYSBLOCK_VISUAL#}</label>
</td>
<td>
</td>
</tr>
{if $sysblock_external}
<tr>

266
admin/templates/sysblocks/list.tpl

@ -1,266 +0,0 @@
<script type="text/javascript" language="JavaScript">
$sid = parseInt('{$sid}');
$sess = '{$sess}';
$(document).ready(function(){ldelim}
$(".AddSysBlock").click( function(event) {ldelim}
event.preventDefault();
var user_group = $('#add_sysblock #sysblock_name').fieldValue();
var title = '{#SYSBLOCK_ADD#}';
var text = '{#SYSBLOCK_INNAME#}';
if (user_group == ""){ldelim}
jAlert(text,title);
{rdelim}else{ldelim}
$.alerts._overlay('show');
$("#add_sysblock").submit();
{rdelim}
{rdelim});
$(".CopyBlock").click( function(event) {ldelim}
event.preventDefault();
var href = $(this).attr('href');
var title = '{#SYSBLOCK_COPY#}';
var text = '{#SYSBLOCK_COPY_TIP#}';
jPrompt(text, '', title, function(b){ldelim}
if (b){ldelim}
$.alerts._overlay('show');
window.location = href + '&sysblock_name=' + b;
{rdelim}else{ldelim}
$.jGrowl("{#MAIN_NO_ADD_BLOCK#}", {ldelim}theme: 'error'{rdelim});
{rdelim}
{rdelim}
);
{rdelim});
var clipboard = new Clipboard('.copyBtn');
{rdelim});
</script>
<div class="title">
<h5>{#SYSBLOCK_EDIT#}</h5>
</div>
<div class="widget" style="margin-top: 0;">
<div class="body">
{#SYSBLOCK_EDIT_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>{#SYSBLOCK_EDIT#}</li>
</ul>
</div>
</div>
<div class="widgets">
<table class="first tableButtons" cellpadding="0" cellspacing="0" width="100%" id="sysblocksButtons">
<col width="25%">
<col width="25%">
<col width="25%">
<col width="25%">
<tr>
<td>
<a class="button basicBtn topBtn" href="index.php?do=modules&action=modedit&mod=basket&moduleaction=basket_history&cp={$sess}">1</a>
</td>
<td>
<a class="button basicBtn topBtn" href="index.php?do=modules&action=modedit&mod=basket&moduleaction=basket_coupon&cp={$sess}">2</a>
</td>
<td>
<a class="button basicBtn topBtn" href="index.php?do=modules&action=modedit&mod=basket&moduleaction=basket_settings&cp={$sess}">3</a>
</td>
<td>
<a class="button basicBtn topBtn" href="index.php?do=modules&action=modedit&mod=basket&moduleaction=templates&cp={$sess}">4</a>
</td>
</tr>
</table>
</div>
<div class="widget first">
<ul class="tabs">
<li class="activeTab"><a href="#tab1">{#SYSBLOCK_HEAD#}</a></li>
{if check_permission('sysblocks_edit')}<li class=""><a href="#tab2">{#SYSBLOCK_ADD#}</a></li>{/if}
</ul>
<div class="tab_container">
<div id="tab1" class="tab_content" style="display: block;">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
<col width="20">
<col width="20">
<col width="20">
<col width="20">
<col>
<col width="200">
<col width="180">
<col width="200">
<col width="20">
<col width="20">
<col width="20">
{if $sysblocks}
<thead>
<tr>
<td>{#SYSBLOCK_ID#}</td>
<td><a href="javascript:void(0);" class="toprightDir link" style="cursor: help;" title="{#SYSBLOCK_EXTERNAL_H#}">[?]</a></td>
<td><a href="javascript:void(0);" class="toprightDir link" style="cursor: help;" title="{#SYSBLOCK_AJAX_H#}">[?]</a></td>
<td><a href="javascript:void(0);" class="toprightDir link" style="cursor: help;" title="{#SYSBLOCK_VISUAL_H#}">[?]</a></td>
<td>{#SYSBLOCK_NAME#}</td>
<td>{#SYSBLOCK_AUTHOR#}</td>
<td>{#SYSBLOCK_DATE#}</td>
<td>{#SYSBLOCK_TAG#}</td>
{if check_permission('sysblocks_edit')}<td colspan="3">{#SYSBLOCK_ACTIONS#}</td>{/if}
</tr>
</thead>
<tbody>
{foreach from=$sysblocks item=sysblock}
<tr id="tr{$sysblock->id}">
<td align="center">{$sysblock->id}</td>
<td align="center">{if $sysblock->sysblock_external}<a class="icon_sprite ico_globus topDir" title="{#SYSBLOCK_EXTERNAL_GO#}" href="http://{$smarty.server.HTTP_HOST}/?sysblock={if $sysblock->sysblock_alias}{$sysblock->sysblock_alias}{else}{$sysblock->id}{/if}" target="_blank"></a>{else}<span class="icon_sprite ico_globus_no"></span>{/if}</td>
<td><span class="icon_sprite {if $sysblock->sysblock_ajax}ico_ok_green{else}ico_delete_no{/if}"></span></td>
<td><span class="icon_sprite {if $sysblock->sysblock_visual}ico_ok_green{else}ico_delete_no{/if}"></span></td>
<td>
{if check_permission('sysblocks_edit')}
<a class="topDir link" title="{#SYSBLOCK_EDIT_HINT#}" href="index.php?do=sysblocks&action=edit&cp={$sess}&id={$sysblock->id}">
<strong>{$sysblock->sysblock_name|escape}</strong>
</a>
{if $sysblock->sysblock_description}
<br>{$sysblock->sysblock_description|escape}
{/if}
{else}
<strong>{$sysblock->sysblock_name|escape}</strong>
{/if}
</td>
<td align="center">{$sysblock->sysblock_author_id|escape}</td>
<td align="center">
<span class="date_text dgrey">{$sysblock->sysblock_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_{$sysblock->id}" value="[tag:sysblock:{if $sysblock->sysblock_alias}{$sysblock->sysblock_alias}{else}{$sysblock->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_{$sysblock->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>
{if check_permission('sysblocks_edit')}
<td nowrap="nowrap" width="1%" align="center">
<a class="topleftDir CopyBlock icon_sprite ico_copy" title="{#SYSBLOCK_COPY#}" href="index.php?do=sysblocks&action=multi&sub=save&id={$sysblock->id}&cp={$sess}"></a>
</td>
<td align="center">
<a class="topleftDir icon_sprite ico_edit" title="{#SYSBLOCK_EDIT_HINT#}" href="index.php?do=sysblocks&action=edit&cp={$sess}&id={$sysblock->id}"></a>
</td>
<td align="center">
<a class="topleftDir ConfirmDelete icon_sprite ico_delete" title="{#SYSBLOCK_DELETE_HINT#}" dir="{#SYSBLOCK_DELETE_HINT#}" name="{#SYSBLOCK_DEL_HINT#}" href="index.php?do=sysblocks&action=del&cp={$sess}&id={$sysblock->id}" id="{$sysblock->id}"></a>
</td>
{/if}
</tr>
{/foreach}
{else}
<tr class="noborder">
<td colspan="10">
<ul class="messages">
<li class="highlight yellow">{#SYSBLOCK_NO_ITEMS#}</li>
</ul>
</td>
</tr>
{/if}
</tbody>
</table>
</div>
{if check_permission('sysblocks_edit')}
<div id="tab2" class="tab_content" style="display: none;">
<form id="add_sysblock" method="post" action="index.php?do=sysblocks&action=new&cp={$sess}" class="mainForm">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
<col width="300">
<col>
<tr>
<td>{#SYSBLOCK_NAME#}</td>
<td><input name="sysblock_name" type="text" id="sysblock_name" value="" placeholder="{#SYSBLOCK_NAME#}" style="width: 400px"></td>
</tr>
<tr>
<td>{#SYSBLOCK_DESCRIPTION#}</td>
<td><input name="sysblock_description" type="text" id="sysblock_description" value="" placeholder="{#SYSBLOCK_DESCRIPTION#}"></td>
</tr>
<tr>
<td>
<div class="nowrap">
<strong><a class="toprightDir" title="{#SYSBLOCK_I#}">[?]</a></strong> {#SYSBLOCK_ALIAS#}:
</div>
</td>
<td>
<div class="pr12">
<input type="text" name="sysblock_alias" id="sysblock_alias" value="" class="mousetrap" data-accept="{#SYSBLOCK_ACCEPT#}" data-error-syn="{#SYSBLOCK_ER_SYN#}" data-error-exists="{#SYSBLOCK_ER_EXISTS#}" placeholder="{#SYSBLOCK_ALIAS#}" maxlength="20" style="width: 200px;" />&nbsp;
<input type="text" id="sysblock_alias_tag" value="[tag:sysblock:]" 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>{#SYSBLOCK_VISUAL#}</td>
<td><input type="checkbox" value="1" name="sysblock_visual" /></td>
</tr>
<tr>
<td colspan="2"><input type="button" class="basicBtn AddSysBlock" value="{#SYSBLOCK_ADD_BUTTON#}" /></td>
</tr>
</table>
</form>
</div>
{/if}
</div>
<div class="fix"></div>
</div>
{literal}
<script>
$(document).on('change', '#sysblock_alias', function (event) {
var input = $(this);
var alias = input.val();
if (alias > '') {
$.ajax({
url: 'index.php?do=sysblocks&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 = $sid ? $sid : '';
}
else {
$.jGrowl(input.attr('data-error-exists'), {theme: 'error'});
alias = $sid ? $sid : '';
}
$('#sysblock_alias_tag').val('[tag:sysblock:' + alias + ']');
}
});
}
else {
alias = $sid ? $sid : '';
$('#sysblock_alias_tag').val('[tag:sysblock:' + alias + ']');
}
return false;
});
</script>
{/literal}

12
admin/templates/sysblocks/multi.tpl

@ -1,4 +1,6 @@
<div class="title"><h5>{#SYSBLOCK_COPY_TITLE#}</h5></div>
<div class="title">
<h5>{#SYSBLOCK_COPY_TITLE#}</h5>
</div>
<div class="widget" style="margin-top: 0px;">
<div class="body">
@ -24,12 +26,16 @@
{/foreach}
<div class="widget first">
<div class="head"><h5 class="iFrames">{#SYSBLOCK_COPY_TITLE#}</h5></div>
<div class="head">
<h5 class="iFrames">{#SYSBLOCK_COPY_TITLE#}</h5>
</div>
<form name="m" method="post" action="?do=sysblocks&action=multi&sub=save&id={$smarty.request.id|escape}" class="mainForm">
<div class="rowElem noborder">
<label>{#SYSBLOCK_NAME#}</label>
<div class="formRight"><input name="sysblock_name" type="text" value="{$smarty.request.sysblock_name|escape|default:"Default"}" maxlength="50" style="width: 250px;" />&nbsp;<input class="basicBtn" type="submit" value="{#SYSBLOCK_BUTTON_COPY#}" /></div>
<div class="formRight">
<input name="sysblock_name" type="text" value="{$smarty.request.sysblock_name|escape|default:"Default"}" maxlength="50" style="width: 250px;" />&nbsp;<input class="basicBtn" type="submit" value="{#SYSBLOCK_BUTTON_COPY#}" />
</div>
<div class="fix"></div>
<input name="oId" type="hidden" id="oId" value="{$smarty.request.id|escape}" />
</div>

13
admin/templates/sysblocks/start.tpl

@ -61,12 +61,13 @@
{/if}
<div class="widget first">
<div class="head">
<h5 class="iFrames">{$group.title} ({$group.count})</h5>
<div class="head closed active">
<h5 class="iFrames">{if $group.title}{$group.title}{else}{#SYS_GROUP_NO_TITLE#}{/if} ({$group.count})</h5>
</div>
<div class="rowElem noborder">
{$group.description}
<div class="fix"></div>
<div style="display: block;">
<div class="body">
{if $group.description}{$group.description}{else}{#SYS_GROUP_NO_DESCRIPTION#}{/if}
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
@ -170,6 +171,8 @@
</tbody>
</table>
<div class="fix"></div>
</div>
</div>
{/foreach}

44
class/class.docs.php

@ -25,7 +25,7 @@
* @public int
*
*/
public $_limit = 25;
public $_limit = 50;
public $_max_remark_length = 500;
/**
@ -327,6 +327,7 @@
$sql_where_field = '';
$field_link = '';
// Если в запросе пришел id определенного поля рубрики
if (isset($_REQUEST['field_id']) && (int)$_REQUEST['field_id'] > 0)
{
$sql_join_field = "
@ -366,6 +367,26 @@
$field_link = '&field_id=' . (int)$_REQUEST['field_id'] . '&field_request=' . $_REQUEST['field_request'] . '&field_search=' . $_REQUEST['field_search'];
}
$sql_where_param = '';
$param_link = '';
// Если в запросе пришел параметр определенного поля документа
if (isset($_REQUEST['param_id']) && $_REQUEST['param_id'] != '')
{
if ($_REQUEST['param_request'] == 'eq' && $_REQUEST['param_search'] != '')
{
$sql_where_param = "
AND doc." . $_REQUEST['param_id'] . " = '" . $_REQUEST['param_search'] . "'
";
}
else if ($_REQUEST['param_request'] == 'like' && $_REQUEST['param_search'] != '')
{
$sql_where_param = "AND doc." . $_REQUEST['param_id'] . " LIKE '%" . $_REQUEST['param_search'] . "%'";
}
$param_link = '&param_id=' . $_REQUEST['param_id'] . '&param_request=' . $_REQUEST['param_request'] . '&param_search=' . $_REQUEST['param_search'];
}
// Если в запросе пришел id определенной рубрики
if (isset($_REQUEST['rubric_id']) && $_REQUEST['rubric_id'] != 'all')
{
@ -495,17 +516,18 @@
" . $ex_docstatus . "
" . $ex_lang . "
" . $w_id . "
" . $sql_where_param . "
" . $sql_where_field . "
";
$num = $AVE_DB->Query($sql)->GetCell();
// Определяем лимит документов, который будет показан на 1 странице
$limit = (isset($_REQUEST['Datalimit']) && is_numeric($_REQUEST['Datalimit']) && $_REQUEST['Datalimit'] > 0)
? $_REQUEST['Datalimit']
$limit = (isset($_REQUEST['limit']) && is_numeric($_REQUEST['limit']) && $_REQUEST['limit'] > 0)
? $_REQUEST['limit']
: $limit = $this->_limit;
$nav_limit = '&Datalimit=' . $limit;
$nav_limit = '&limit=' . $limit;
// Определяем количество страниц, которые будут сформированы на основании количества полученных документов
$pages = ceil($num / $limit);
@ -693,6 +715,7 @@
" . $ex_docstatus . "
" . $ex_lang . "
" . $w_id . "
" . $sql_where_param . "
" . $sql_where_field . "
GROUP BY doc.Id
" . $db_sort . "
@ -822,6 +845,7 @@
$link .= $nav_time;
$link .= $nav_limit;
$link .= $field_link;
$link .= $param_link;
$link .= (isset($_REQUEST['selurl']) && $_REQUEST['selurl'] == 1) ? '&selurl=1' : '';
$link .= (isset($_REQUEST['selecturl']) && $_REQUEST['selecturl'] == 1) ? '&selecturl=1' : '';
$link .= (isset($_REQUEST['function']) && $_REQUEST['function'] == 1) ? '&function=1' : '';
@ -845,6 +869,16 @@
$AVE_Template->assign('page_nav', $page_nav);
}
$params = [
'rubric_id',
'rubric_tmpl_id',
'document_parent',
'document_property',
'document_rating',
'document_position'
];
$AVE_Template->assign('params', $params);
$AVE_Template->assign('DEF_DOC_START_YEAR', mktime(0, 0, 0, date("m"), date("d"), date("Y") - 10));
$AVE_Template->assign('DEF_DOC_END_YEAR', mktime(0, 0, 0, date("m"), date("d"), date("Y") + 10));
}
@ -1515,7 +1549,7 @@
// Если пришел вызов поля, который связан с модулем
if (isset($data['field_module']))
{
while(list($mod_key, $mod_val) = each($_REQUEST['field_module']))
while(list($mod_key, $mod_val) = each($data['field_module']))
{
require_once(BASE_DIR . '/modules/' . $mod_val . '/document.php');

117
class/class.sysblocks.php

@ -44,6 +44,36 @@
}
/*
|--------------------------------------------------------------------------------------
| getGroups
|--------------------------------------------------------------------------------------
|
| Получаем список групп
|
*/
public static function getGroups ()
{
global $AVE_DB;
$sql = "
SELECT
*
FROM
" . PREFIX . "_sysblocks_groups
";
$query = $AVE_DB->Query($sql);
$groups = [];
while ($row = $query->FetchRow())
array_push($groups, $row);
return $groups;
}
/*
|--------------------------------------------------------------------------------------
| startPage
@ -103,17 +133,11 @@
foreach ($sysblocks AS $_k => $_v)
{
if ($_k == 0)
{
$groups[$_k]['position'] = 0;
$groups[$_k]['title'] = 'Без группы';
$groups[$_k]['description'] = 'Описание отсутсвует';
}
$groups[$_k]['count'] = count($sysblocks[$_k]);
}
//Debug::_echo($sysblocks, true);
//Debug::_echo($groups, true);
$AVE_Template->assign('groups', $groups);
$AVE_Template->assign('sysblocks', $sysblocks);
$AVE_Template->assign('content', $AVE_Template->fetch('sysblocks/start.tpl'));
@ -208,9 +232,11 @@
$row['sysblock_name'] = '';
$row['sysblock_alias'] = '';
$row['sysblock_text'] = '';
$row['sysblock_eval'] = '1';
$row['sysblock_visual'] = (isset($_REQUEST['sysblock_visual']) && $_REQUEST['sysblock_visual'] != 0) ? $_REQUEST['sysblock_visual'] : '';
$AVE_Template->assign('sid', 0);
$AVE_Template->assign('groups', self::getGroups());
if ((isset($_REQUEST['sysblock_visual']) && $_REQUEST['sysblock_visual'] == 1) || $row['sysblock_visual'] == 1)
{
@ -257,6 +283,7 @@
")->FetchAssocArray();
$AVE_Template->assign('sid', $sysblock_id);
$AVE_Template->assign('groups', self::getGroups());
if ((isset($_REQUEST['sysblock_visual']) && $_REQUEST['sysblock_visual'] == 1) || $row['sysblock_visual'] == 1)
{
@ -308,6 +335,7 @@
UPDATE
" . PREFIX . "_sysblocks
SET
sysblock_group_id = '" . (int)$_REQUEST['sysblock_group_id'] . "',
sysblock_name = '" . $_REQUEST['sysblock_name'] . "',
sysblock_description = '" . addslashes($_REQUEST['sysblock_description']) . "',
sysblock_alias = '" . $_REQUEST['sysblock_alias'] . "',
@ -357,6 +385,7 @@
INSERT INTO
" . PREFIX . "_sysblocks
SET
sysblock_group_id = '" . (int)$_REQUEST['sysblock_group_id'] . "',
sysblock_name = '" . $_REQUEST['sysblock_name'] . "',
sysblock_description = '" . addslashes($_REQUEST['sysblock_description']) . "',
sysblock_alias = '" . $_REQUEST['sysblock_alias'] . "',
@ -444,5 +473,81 @@
rrmdir($from_alias);
}
}
/*
|--------------------------------------------------------------------------------------
| multiBlock
|--------------------------------------------------------------------------------------
|
| Копирование системного блока
|
*/
public static function multiBlock ()
{
global $AVE_DB, $AVE_Template;
$_REQUEST['sub'] = (!isset($_REQUEST['sub']))
? ''
: $_REQUEST['sub'];
$errors = [];
switch ($_REQUEST['sub'])
{
case 'save':
$ok = true;
$row = $AVE_DB->Query("
SELECT
sysblock_name
FROM
" . PREFIX . "_sysblocks
WHERE
sysblock_name = '" . $_REQUEST['sysblock_name'] . "'
")->FetchRow();
if (@$row->sysblock_name != '')
{
array_push($errors, $AVE_Template->get_config_vars('SYSBLOCK_EXIST'));
$AVE_Template->assign('errors', $errors);
$ok = false;
}
if ($_REQUEST['sysblock_name'] == '')
{
array_push($errors, $AVE_Template->get_config_vars('SYSBLOCK_COPY_TIP'));
$AVE_Template->assign('errors', $errors);
$ok = false;
}
if ($ok)
{
$row = $AVE_DB->Query("
SELECT sysblock_text
FROM " . PREFIX . "_sysblocks
WHERE id = '" . (int)$_REQUEST['id'] . "'
")->FetchRow();
$AVE_DB->Query("
INSERT
INTO " . PREFIX . "_sysblocks
SET
Id = '',
sysblock_name = '" . $_REQUEST['sysblock_name'] . "',
sysblock_text = '" . addslashes($row->sysblock_text) . "',
sysblock_author_id = '" . $_SESSION['user_id'] . "',
sysblock_created = '" . time() . "'
");
reportLog($_SESSION['user_name'] . ' - создал копию системного блока (' . (int)$_REQUEST['id'] . ')', 2, 2);
header('Location:index.php?do=sysblocks'.'&cp=' . SESSION);
}
$AVE_Template->assign('content', $AVE_Template->fetch('sysblocks/multi.tpl'));
break;
}
}
}
?>

31
functions/func.common.php

@ -1236,4 +1236,35 @@
return true;
}
/**
* Функция возвращает данные в формате JSON
*
* @param $data
* @param bool $exit
*/
function _json ($data, $exit = false)
{
header("Content-Type: application/json;charset=utf-8");
$json = json_encode($data);
if ($json === false)
{
$json = json_encode(array("jsonError", json_last_error_msg()));
if ($json === false)
{
$json = '{"jsonError": "unknown"}';
}
http_response_code(500);
}
echo $json;
if ($exit)
exit;
}
?>

47
tmp/update/sql.update.php

@ -350,6 +350,53 @@
// ----------------------------------------------------------------------------------------
$check = $AVE_DB->Query("
SHOW TABLES
LIKE
'" . PREFIX . "_sysblocks_groups'
")->NumRows();
$exist = ($check > 0) ? true : false;
if ($exist === false)
{
$AVE_DB->Real_Query("
CREATE TABLE `" . PREFIX . "_sysblocks_groups` (
`id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT,
`position` smallint(3) unsigned NOT NULL,
`title` varchar(255) NOT NULL DEFAULT '',
`description` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;
");
}
// ----------------------------------------------------------------------------------------
$check = $AVE_DB->Query("
SHOW COLUMNS
FROM
" . PREFIX . "_sysblocks
LIKE
'sysblock_group_id'
")->NumRows();
$exist = ($check) ? true : false;
if ($exist === false)
{
$AVE_DB->Real_Query("
ALTER TABLE
" . PREFIX . "_sysblocks
ADD
`sysblock_group_id` int(3) NOT NULL DEFAULT '0'
AFTER
`id`
");
}
// ----------------------------------------------------------------------------------------
$check = $AVE_DB->Query("
SHOW COLUMNS
FROM

Loading…
Cancel
Save