diff --git a/admin/docs.php b/admin/docs.php
index 2ccea9f..70500a5 100644
--- a/admin/docs.php
+++ b/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':
diff --git a/admin/lang/ru/docs.txt b/admin/lang/ru/docs.txt
index 4f514ea..76e117d 100755
--- a/admin/lang/ru/docs.txt
+++ b/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 = "Значение"
diff --git a/admin/lang/ru/sysblocks.txt b/admin/lang/ru/sysblocks.txt
index c38fc72..53a6a7e 100644
--- a/admin/lang/ru/sysblocks.txt
+++ b/admin/lang/ru/sysblocks.txt
@@ -75,5 +75,8 @@ SYSBLOCK_ACCEPT = "Этот алиас можно использовать"
SYSBLOCK_ER_SYN = "Неверный алиас!
Алиас не должен являться числом, может содержать только цифры, латинские буквы, дефис, подчёркивание и иметь длину не более 20 символов"
SYSBLOCK_ER_EXISTS = "Неверный алиас!
Данный алиас уже привязан к другоому системному блоку"
-// v 3.25
-SYSBLOCK_EVAL = "Выполнять PHP перед возвращением результата"
\ No newline at end of file
+// v 3.26
+SYSBLOCK_EVAL = "Выполнять PHP перед возвращением результата"
+SYS_GROUP_NO_TITLE = "Без группы"
+SYS_GROUP_NO_DESCRIPTION = "Описание отсутвует"
+SYS_GROUP_PLEASE_SELECT = "Выберите группу"
\ No newline at end of file
diff --git a/admin/sysblocks.php b/admin/sysblocks.php
index d29716b..6b2a3d1 100644
--- a/admin/sysblocks.php
+++ b/admin/sysblocks.php
@@ -87,7 +87,7 @@
case 'multi':
if (check_permission_acp('sysblocks_edit'))
{
- //
+ Sysblocks::multiBlock();
}
}
?>
\ No newline at end of file
diff --git a/admin/templates/documents/doc_search.tpl b/admin/templates/documents/doc_search.tpl
index 20c63ba..5267f27 100644
--- a/admin/templates/documents/doc_search.tpl
+++ b/admin/templates/documents/doc_search.tpl
@@ -168,6 +168,32 @@
{/if}
+
+
+ {#DOC_SEARCH_PARAM#}
+ |
+
+
+ |
+
+
+ |
+
+
+
+
+ |
+
+
+
{#DOC_LANG_ID#}
@@ -185,9 +211,9 @@
{#MAIN_RESULTS_ON_PAGE#}
|
- |
diff --git a/admin/templates/sysblocks/form.tpl b/admin/templates/sysblocks/form.tpl
index f12ca7f..801809b 100644
--- a/admin/templates/sysblocks/form.tpl
+++ b/admin/templates/sysblocks/form.tpl
@@ -23,7 +23,7 @@
{#SYSBLOCK_LIST_LINK#}
{if $smarty.request.id != ''}{#SYSBLOCK_EDIT_H#}{else}{#SYSBLOCK_INSERT_H#}{/if}
- {if $smarty.request.id != ''}{$sysblock_name|escape}{else}{$smarty.request.sysblock_name}{/if}
+ {if $smarty.request.id != ''}{$sysblock_name|escape|default:'New'}{else}{$smarty.request.sysblock_name|default:'New'}{/if}
@@ -34,7 +34,7 @@
{if $smarty.request.id != ''}{#SYSBLOCK_EDIT_H#}{else}{#SYSBLOCK_INSERT_H#}{/if}
-
+
@@ -71,6 +71,26 @@
+
+
+ Группа
+
+ |
+
+
+
+
+ {foreach from=$groups item=group}
+
+ {/foreach}
+
+
+ |
+
+
+
+
+ |
|
@@ -80,9 +100,6 @@
|
-
-
- |
{if $sysblock_external}
diff --git a/admin/templates/sysblocks/form_visual.tpl b/admin/templates/sysblocks/form_visual.tpl
index c744f75..5c902f2 100644
--- a/admin/templates/sysblocks/form_visual.tpl
+++ b/admin/templates/sysblocks/form_visual.tpl
@@ -34,13 +34,13 @@
{if $smarty.request.id != ''}{#SYSBLOCK_EDIT_H#}{else}{#SYSBLOCK_INSERT_H#}{/if}
-
+
{#SYSBLOCK_NAME#} |
-
+ |
@@ -48,7 +48,7 @@
|
{#SYSBLOCK_DESCRIPTION#} |
-
+ |
|
@@ -58,7 +58,7 @@
[?] {#SYSBLOCK_ALIAS#}:
-
+ |
@@ -69,6 +69,26 @@
|
+
+
+ Группа
+
+ |
+
+
+
+
+ {foreach from=$groups item=group}
+
+ {/foreach}
+
+
+ |
+
+
+
+
+ |
|
@@ -78,9 +98,6 @@
|
-
-
- |
{if $sysblock_external}
diff --git a/admin/templates/sysblocks/list.tpl b/admin/templates/sysblocks/list.tpl
deleted file mode 100644
index 433ecf0..0000000
--- a/admin/templates/sysblocks/list.tpl
+++ /dev/null
@@ -1,266 +0,0 @@
-
-
-
-
{#SYSBLOCK_EDIT#}
-
-
-
-
-
-
-
-
-
-
-{literal}
-
-{/literal}
\ No newline at end of file
diff --git a/admin/templates/sysblocks/multi.tpl b/admin/templates/sysblocks/multi.tpl
index 234ee72..1e2239c 100644
--- a/admin/templates/sysblocks/multi.tpl
+++ b/admin/templates/sysblocks/multi.tpl
@@ -1,4 +1,6 @@
-{#SYSBLOCK_COPY_TITLE#}
+
+
{#SYSBLOCK_COPY_TITLE#}
+
- {foreach from=$errors item=e}
- {assign var=message value=$e}
-
- {/foreach}
+{foreach from=$errors item=e}
+{assign var=message value=$e}
+
+{/foreach}
diff --git a/admin/templates/sysblocks/start.tpl b/admin/templates/sysblocks/start.tpl
index 8d0d938..8482077 100644
--- a/admin/templates/sysblocks/start.tpl
+++ b/admin/templates/sysblocks/start.tpl
@@ -61,104 +61,105 @@
{/if}
{/foreach}
diff --git a/class/class.docs.php b/class/class.docs.php
index 6444138..29611ec 100755
--- a/class/class.docs.php
+++ b/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 = '¶m_id=' . $_REQUEST['param_id'] . '¶m_request=' . $_REQUEST['param_request'] . '¶m_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');
diff --git a/class/class.sysblocks.php b/class/class.sysblocks.php
index e31ae2c..f5070ba 100644
--- a/class/class.sysblocks.php
+++ b/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)
{
@@ -226,10 +252,10 @@
$AVE_Template->assign('content', $AVE_Template->fetch('sysblocks/form_visual.tpl'));
}
else
- {
- $AVE_Template->assign($row);
- $AVE_Template->assign('content', $AVE_Template->fetch('sysblocks/form.tpl'));
- }
+ {
+ $AVE_Template->assign($row);
+ $AVE_Template->assign('content', $AVE_Template->fetch('sysblocks/form.tpl'));
+ }
}
@@ -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;
+ }
+ }
}
?>
\ No newline at end of file
diff --git a/functions/func.common.php b/functions/func.common.php
index f036961..b3a5b2c 100755
--- a/functions/func.common.php
+++ b/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;
+ }
?>
\ No newline at end of file
diff --git a/tmp/update/sql.update.php b/tmp/update/sql.update.php
index 324979c..4ba36e5 100644
--- a/tmp/update/sql.update.php
+++ b/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