Browse Source

Fixes

pull/3/head
M@d D3n 5 years ago
parent
commit
bdca427150
  1. 12
      admin/docs.php
  2. 9
      admin/lang/ru/docs.txt
  3. 2
      admin/templates/css/main.css
  4. 86
      admin/templates/documents/doc_search.tpl
  5. 283
      admin/templates/documents/docs.tpl
  6. 270
      admin/templates/js/docs.js
  7. 113
      class/class.docs.php

12
admin/docs.php

@ -318,5 +318,17 @@
$AVE_Document->documentPosition();
}
break;
case 'publish':
if (check_permission_acp('document_view')) {
$AVE_Document->documentPublish();
}
break;
case 'recycle':
if (check_permission_acp('document_view')) {
$AVE_Document->documentRecycle();
}
break;
}
?>

9
admin/lang/ru/docs.txt

@ -315,3 +315,12 @@ DOC_SEARCH_PARAM_SELECT = "Выберите параметр"
DOC_SEARCH_PARAM_LIKE = "Содержит"
DOC_SEARCH_PARAM_EQ = "Равно"
DOC_SEARCH_PARAM_TEXT = "Значение"
DOC_STATUS_SUCCESS = "Выполнено"
DOC_STATUS_ERROR = "Ошибка"
DOC_STATUS_ON = "Документ опубликован"
DOC_STATUS_OFF = "Документ снят с публикации"
DOC_RECYCLE_ON = "Документ восстановлен"
DOC_RECYCLE_OFF = "Документ помещен в корзину"

2
admin/templates/css/main.css

@ -120,7 +120,7 @@ p { padding: 12px 0 0 0; }
.first { margin-top: 22px!important; }
.inactive { margin-top: 0px; color: #656565; }
.btext { font-weight: bold; }
.hidden { display: none;}
.hidden { display: none !important;}
.rounded { -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px;}
select { overflow: auto; }
.bordLeft { border-top-left-radius: 3px; -moz-border-radius-topleft: 3px; -webkit-border-top-left-radius: 3px; }

86
admin/templates/documents/doc_search.tpl

@ -1,79 +1,3 @@
<script type="text/javascript">
$(document).ready(function(){ldelim}
$('#document_published').datepicker({ldelim}
changeMonth: true,
changeYear: true,
onClose: function(dateText, inst) {ldelim}
var endDateTextBox = $('#document_expire');
if (endDateTextBox.val() != '') {ldelim}
var testStartDate = new Date(dateText);
var testEndDate = new Date(endDateTextBox.val());
if (testStartDate > testEndDate)
endDateTextBox.val(dateText);
{rdelim}
else {ldelim}
endDateTextBox.val(dateText);
{rdelim}
{rdelim},
onSelect: function (selectedDateTime){ldelim}
var start = $(this).datetimepicker('getDate');
$('#document_expire').datetimepicker('option', 'minDate', new Date(start.getTime()));
{rdelim}
{rdelim});
{literal}
$('.collapsible').collapsible({
defaultOpen: 'opened',
cssOpen: 'inactive',
cssClose: 'normal',
cookieName: 'collaps_doc',
cookieOptions: {
expires: 7,
domain: ''
},
speed: 5,
loadOpen: function(elem, opts) {
elem.next().show();
},
loadClose: function(elem, opts) {
elem.next().hide();
}
});
$('.collapsible').on('click', function() {
setTimeout(function() {
AveAdmin.sticky_panel_refresh();
AveAdmin.select_form();
}, 10);
});
{/literal}
$('#document_expire').datepicker({ldelim}
changeMonth: true,
changeYear: true,
onClose: function(dateText, inst) {ldelim}
var startDateTextBox = $('#document_published');
if (startDateTextBox.val() != '') {ldelim}
var testStartDate = new Date(startDateTextBox.val());
var testEndDate = new Date(dateText);
if (testStartDate > testEndDate)
startDateTextBox.val(dateText);
{rdelim}
else {ldelim}
startDateTextBox.val(dateText);
{rdelim}
{rdelim},
onSelect: function (selectedDateTime){ldelim}
var end = $(this).datetimepicker('getDate');
$('#document_published').datetimepicker('option', 'maxDate', new Date(end.getTime()) );
{rdelim}
{rdelim});
{rdelim});
</script>
<form method="get" id="doc_search" action="index.php" class="mainForm">
<input type="hidden" name="do" value="docs" />
{if $smarty.request.action}<input type="hidden" name="action" value="{$smarty.request.action}" />
@ -235,5 +159,13 @@
</div>
</div>
</form>
<script type="text/javascript">
{literal}
$(document).ready(function() {
AveDocs.init();
AveDocs.search();
});
{/literal}
</script>

283
admin/templates/documents/docs.tpl

@ -1,3 +1,13 @@
<script>
var add_doc_title = '{#MAIN_ADD_IN_RUB#}',
add_doc_text = '{#DOC_ENTER_NAME#}',
del_doc_title = '{#DOC_TEMPORARY_DELETE#}',
del_doc_confirm = '{#DOC_TEMPORARY_CONFIRM#}',
copy_doc_title = '{#DOC_COPY#}',
copy_doc_text = '{#DOC_COPY_TIP#}',
copy_doc_no = '{#MAIN_NO_ADD_DOCS#}';
</script>
<div class="title">
<h5>{#DOC_SUB_TITLE#}</h5>
</div>
@ -20,58 +30,57 @@
{if check_permission('document_view')}
<div class="widget first">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<col width="50%">
<col width="50%">
<thead>
<tr>
<td>{#MAIN_ADD_IN_RUB#}</td>
<td>{#MAIN_SORT_DOCUMENTS#}</td>
</tr>
</thead>
<tbody>
<tr>
<td style="padding:8px;">
<form action="index.php" method="get" id="add_docum" class="mainForm">
<input type="hidden" name="cp" value="{$sess}" />
<input type="hidden" name="do" value="docs" />
<input type="hidden" name="action" value="new" />
<select name="rubric_id" id="DocName">
<option value="">{#DOC_CHOSE_RUB#}</option>
{foreach from=$rubrics item=rubric}
{if $rubric->Show==1}
<option value="{$rubric->Id}"{if $smarty.request.rubric_id==$rubric->Id} selected{/if}>{$rubric->rubric_title|escape}</option>
{/if}
{/foreach}
</select>
&nbsp;
<input style="width:85px" type="submit" class="basicBtn AddDocs" value="{#MAIN_BUTTON_ADD#}" />
</form>
</td>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<col width="50%">
<col width="50%">
<thead>
<tr>
<td>{#MAIN_ADD_IN_RUB#}</td>
<td>{#MAIN_SORT_DOCUMENTS#}</td>
</tr>
</thead>
<tbody>
<tr>
<td style="padding:8px;">
<form action="index.php" method="get" id="addDocRub" class="mainForm">
<input type="hidden" name="cp" value="{$sess}" />
<input type="hidden" name="do" value="docs" />
<input type="hidden" name="action" value="new" />
<select name="rubric_id" id="rubricId">
<option value="">{#DOC_CHOSE_RUB#}</option>
{foreach from=$rubrics item=rubric}
{if $rubric->Show==1}
<option value="{$rubric->Id}"{if $smarty.request.rubric_id==$rubric->Id} selected{/if}>{$rubric->rubric_title|escape}</option>
{/if}
{/foreach}
</select>
&nbsp;
<input style="width:85px" type="submit" class="basicBtn AddDocument" value="{#MAIN_BUTTON_ADD#}" />
</form>
</td>
<td style="padding:8px;">
<form action="index.php" method="get" class="mainForm">
<input type="hidden" name="cp" value="{$sess}" />
<input type="hidden" name="do" value="docs" />
<select name="rubric_id" id="RubrikSort">
<option value="all">{#MAIN_ALL_RUBRUKS#}</option>
{foreach from=$rubrics item=rubric}
{if $rubric->Show==1}
<option value="{$rubric->Id}"{if $smarty.request.rubric_id==$rubric->Id} selected{/if}>{$rubric->rubric_title|escape}</option>
{/if}
{/foreach}
</select>
&nbsp;
<input style="width:85px" type="submit" class="basicBtn" value="{#MAIN_BUTTON_SORT#}" />
</form>
</td>
</tr>
</tbody>
</table>
<td style="padding:8px;">
<form action="index.php" method="get" class="mainForm">
<input type="hidden" name="cp" value="{$sess}" />
<input type="hidden" name="do" value="docs" />
<select name="rubric_id" id="rubricSort">{*RubrikSort*}
<option value="all">{#MAIN_ALL_RUBRUKS#}</option>
{foreach from=$rubrics item=rubric}
{if $rubric->Show==1}
<option value="{$rubric->Id}"{if $smarty.request.rubric_id==$rubric->Id} selected{/if}>{$rubric->rubric_title|escape}</option>
{/if}
{/foreach}
</select>
&nbsp;
<input style="width:85px" type="submit" class="basicBtn" value="{#MAIN_BUTTON_SORT#}" />
</form>
</td>
</tr>
</tbody>
</table>
</div>
{/if}
{include file='documents/doc_search.tpl'}
<div class="widget first">
@ -143,15 +152,31 @@
{if $docs}
<thead>
<tr>
<td><div align="center"><input type="checkbox" id="selall" value="1" /></div></td>
<td>{#DOC_ID#}</td>
<td>
<div align="center">
<input type="checkbox" id="selectAll" value="1" />
</div>
</td>
<td>
{#DOC_ID#}
</td>
<td nowrap="nowrap">
{#DOC_TITLE#}&nbsp;|&nbsp;{#DOC_URL_RUB#}
</td>
<td>{#DOC_IN_RUBRIK#}</td>
<td>{#DOC_POSITION#}</td>
<td>{#DOC_CREATED#}&nbsp;|&nbsp;{#DOC_EDIT#}</td>
{if !$smarty.const.ADMIN_EDITMENU}<td {if $smarty.const.ADMIN_EDITMENU}colspan="7"{else}colspan="14"{/if} align="center">{#DOC_ACTIONS#}</td>{/if}
<td>
{#DOC_IN_RUBRIK#}
</td>
<td>
{#DOC_POSITION#}
</td>
<td>
{#DOC_CREATED#}&nbsp;|&nbsp;{#DOC_EDIT#}
</td>
{if !$smarty.const.ADMIN_EDITMENU}
<td {if $smarty.const.ADMIN_EDITMENU}colspan="7"{else}colspan="14"{/if} align="center">
{#DOC_ACTIONS#}
</td>
{/if}
</tr>
</thead>
{/if}
@ -220,30 +245,29 @@
{/if}
<!-- Публикация -->
{if $item->document_deleted!=1}
{if $item->document_status==1}
{if $item->canOpenClose==1 && $item->Id != 1 && $item->Id != $PAGE_NOT_FOUND_ID}
<a class="topDir floatleft" title="{#DOC_DISABLE_TITLE#}" href="index.php?do=docs&action=close&rubric_id={$item->rubric_id}&Id={$item->Id}&cp={$sess}">
<span class="icon_sprite_doc icon_public_on"></span>
</a>
{/if}
{else}
{if $item->canOpenClose==1}
<a class="topDir floatleft public" title="{#DOC_ENABLE_TITLE#}" href="index.php?do=docs&action=open&rubric_id={$item->rubric_id}&Id={$item->Id}&cp={$sess}">
<span class="icon_sprite_doc icon_public"></span>
</a>
{/if}
{if $item->document_status==1}
{if $item->canOpenClose==1 && $item->Id != 1 && $item->Id != $PAGE_NOT_FOUND_ID}
<a class="topDir floatleft documentPublish {if $item->document_deleted == 1}hidden{/if}" data-id="{$item->Id}" title="{#DOC_DISABLE_TITLE#}" href="index.php?do=docs&action=close&rubric_id={$item->rubric_id}&Id={$item->Id}&cp={$sess}">
<span class="icon_sprite_doc icon_public_on"></span>
</a>
{/if}
{else}
{if $item->canOpenClose==1}
<a class="topDir floatleft public documentPublish {if $item->document_deleted == 1}hidden{/if}" data-id="{$item->Id}" title="{#DOC_ENABLE_TITLE#}" href="index.php?do=docs&action=open&rubric_id={$item->rubric_id}&Id={$item->Id}&cp={$sess}">
<span class="icon_sprite_doc icon_public"></span>
</a>
{/if}
{/if}
<!-- Корзина -->
{if $item->document_deleted==1}
<a class="topDir floatleft recylce" title="{#DOC_RESTORE_DELETE#}" href="index.php?do=docs&action=redelete&rubric_id={$item->rubric_id}&Id={$item->Id}&cp={$sess}">
<a class="topDir floatleft recylce documentRecycle" title="{#DOC_RESTORE_DELETE#}" data-id="{$item->Id}" href="index.php?do=docs&action=redelete&rubric_id={$item->rubric_id}&Id={$item->Id}&cp={$sess}">
<span class="icon_sprite_doc icon_recylce_on "></span>
</a>
{else}
{if $item->canDelete==1}
<a class="ConfirmRecycle topDir floatleft" title="{#DOC_TEMPORARY_DELETE#}" href="index.php?do=docs&action=delete&rubric_id={$item->rubric_id}&Id={$item->Id}&cp={$sess}">
<a class="topDir floatleft documentRecycle" title="{#DOC_TEMPORARY_DELETE#}" data-id="{$item->Id}" data-rubric-id="{$item->rubric_id}" href="index.php?do=docs&action=delete&rubric_id={$item->rubric_id}&Id={$item->Id}&cp={$sess}">
<span class="icon_sprite_doc icon_recylce"></span>
</a>
{/if}
@ -312,11 +336,12 @@
</td>
<td align="center">
<div class="docaction">
<div class="doc_message">
{if $item->ist_remark!='0'}
<div class="remarks"><span title="{#DOC_ICON_COMMENT#}" class="icon_sprite_doc icon_comment topDir"></span></div>
<div class="remarks">
<span title="{#DOC_ICON_COMMENT#}" class="icon_sprite_doc icon_comment topDir"></span>
</div>
{/if}
</div>
<span class="date_text dgrey">
@ -417,7 +442,7 @@
<td>{#DOC_IN_RUBRIK#}</td>
<td>{#DOC_POSITION#}</td>
<td>{#DOC_CREATED#}&nbsp;|&nbsp;{#DOC_EDIT#}</td>
{if !$smarty.const.ADMIN_EDITMENU}<td colspan="6" align="center">{#DOC_ACTIONS#}</td>{/if}
{if !$smarty.const.ADMIN_EDITMENU}<td colspan="7" align="center">{#DOC_ACTIONS#}</td>{/if}
</tr>
</thead>
{/if}
@ -451,115 +476,13 @@
</div>
{/if}
<script language="Javascript" type="text/javascript">
$(document).ready(function(){ldelim}
$(".AddDocs").click( function(e) {ldelim}
e.preventDefault();
var DocName = $('#add_docum #DocName').fieldValue();
var title = '{#MAIN_ADD_IN_RUB#}';
var text = '{#DOC_ENTER_NAME#}';
if (DocName == ""){ldelim}
jAlert(text,title);
{rdelim}else{ldelim}
$.alerts._overlay('show');
$("#add_docum").submit();
{rdelim}
{rdelim});
$('#selall').on('change', function(event) {ldelim}
event.preventDefault();
if ($('#selall').is(':checked')) {ldelim}
$('#docs .checkbox').attr('checked','checked');
$('#docs .checkbox').addClass('jqTransformChecked');
$("#docs a.jqTransformCheckbox").addClass("jqTransformChecked");
{rdelim} else {ldelim}
$('#docs .checkbox').removeClass('jqTransformChecked');
$('#docs .checkbox').removeAttr('checked');
$("#docs a.jqTransformCheckbox").removeClass("jqTransformChecked");
{rdelim}
{rdelim});
$(".ConfirmRecycle").click(function(e){ldelim}
e.preventDefault();
var href = $(this).attr('href');
var title = '{#DOC_TEMPORARY_DELETE#}';
var confirm = '{#DOC_TEMPORARY_CONFIRM#}';
jConfirm(
confirm,
title,
function(b){ldelim}
if (b){ldelim}
$.alerts._overlay('show');
window.location = href;
{rdelim}
{rdelim}
);
{rdelim});
$(".CopyDocs").click( function(e) {ldelim}
e.preventDefault();
var href = $(this).attr('href');
var title = '{#DOC_COPY#}';
var text = '{#DOC_COPY_TIP#}';
jPrompt(text, '', title, function(b){ldelim}
if (b){ldelim}
$.alerts._overlay('show');
window.location = href + '&document_title=' + b;
{rdelim}else{ldelim}
$.jGrowl("{#MAIN_NO_ADD_DOCS#}", {ldelim}theme: 'error'{rdelim});
{rdelim}
{rdelim}
);
{rdelim});
$(".docaction").hover(
function() {ldelim}$(this).children(".actions").show("fade", 10);{rdelim},
function() {ldelim}$(this).children(".actions").hide("fade", 10);{rdelim}
);
<script src="{$ABS_PATH}admin/templates/js/docs.js"></script>
<script language="Javascript" type="text/javascript">
{literal}
function action(href, actions){
$.ajax({
beforeSend: function(){
$.alerts._overlay('show');
},
url: href,
data: ({
action: actions,
ajax: '1',
pop: '1'
}),
timeout:3000,
dataType: "json",
success: function(data){
$.alerts._overlay('hide');
$.jGrowl(data[0],{theme: data[1]});
},
error: function (xhr, ajaxOptions, thrownError) {
$.alerts._overlay('hide');
$.jGrowl(xhr.status + thrownError, {theme: 'error'});
}
});
};
$('.lock').on('click', function(e){
e.preventDefault();
if($(this).hasClass('ico_unlock')){
action($(this).attr('ajax'),'close');
$(this).removeClass("ico_unlock").addClass("ico_lock");
} else if ($(this).hasClass('ico_lock')){
action($(this).attr('ajax'),'open');
$(this).removeClass("ico_lock").addClass("ico_unlock")
}
});
$(document).ready(function() {
AveDocs.init();
AveDocs.list();
});
{/literal}
{rdelim});
</script>

270
admin/templates/js/docs.js

@ -0,0 +1,270 @@
var AveDocs = {
initialized: false,
init: function () {
if (this.initialized)
return;
this.initialized = true;
},
//
list: function () {
this.addDocument();
this.selectAllDocuments();
this.documentAction();
this.documentPublish();
this.documentRecycle();
},
//
edit: function () {
},
//
search: function () {
this.searchDateTime();
this.searchCollapsible();
},
//
addDocument: function () {
$(".AddDocument").on('click', function (event) {
event.preventDefault();
let rubricId = $('#addDocRub #rubricId').fieldValue();
if (rubricId == '') {
jAlert(add_doc_text, add_doc_title);
} else {
$.alerts._overlay('show');
$("#addDocRub").submit();
}
});
},
//
selectAllDocuments: function () {
$('#selectAll').on('change', function (event) {
event.preventDefault();
if ($('#selectAll').is(':checked')) {
$('#docs .checkbox').attr('checked', 'checked').addClass('jqTransformChecked');
$("#docs a.jqTransformCheckbox").addClass("jqTransformChecked");
} else {
$('#docs .checkbox').removeClass('jqTransformChecked').removeAttr('checked');
$("#docs a.jqTransformCheckbox").removeClass("jqTransformChecked");
}
});
},
//
documentPublish: function () {
$(".documentPublish").on('click', function (event) {
event.preventDefault();
let link = $(this);
let doc_id = link.data('id');
$.ajax({
type: 'POST',
url: 'http://ave327.loc/admin/index.php?do=docs&action=publish&cp=' + sess,
data: {
'doc_id': doc_id
},
dataType: 'JSON',
beforeSend: function () {
$.alerts._overlay('show');
},
success: function (data) {
$.alerts._overlay('hide');
if (data.success) {
(data.status != 1)
? link.closest('tr').addClass('yellow')
: link.closest('tr').removeClass('yellow');
(data.status != 1)
? link.addClass('public')
: link.removeClass('public');
link.attr('title', data.text);
AveAdmin.tooltip();
}
$.jGrowl(data['message'], {
header: data['header'],
theme: data['theme']
});
}
});
});
},
//
documentRecycle: function () {
$(".documentRecycle").on('click', function (event) {
event.preventDefault();
let link = $(this);
let doc_id = link.data('id');
$.ajax({
type: 'POST',
url: 'http://ave327.loc/admin/index.php?do=docs&action=recycle&cp=' + sess,
data: {
'doc_id': doc_id
},
dataType: 'JSON',
beforeSend: function () {
$.alerts._overlay('show');
},
success: function (data) {
$.alerts._overlay('hide');
if (data.success) {
(data.status == 1)
? link.closest('tr').addClass('red')
: link.closest('tr').removeClass('red');
(data.status == 1)
? link.addClass('recylce')
: link.removeClass('recylce');
(data.status == 1)
? link.closest('tr').find('.documentPublish').addClass('hidden')
: link.closest('tr').find('.documentPublish').removeClass('hidden');
link.attr('title', data.text);
AveAdmin.tooltip();
}
$.jGrowl(data['message'], {
header: data['header'],
theme: data['theme']
});
}
});
});
},
//
documentCopy: function () {
$(".CopyDocs").on('click', function (event) {
event.preventDefault();
let href = $(this).attr('href');
jPrompt(copy_doc_text, '', copy_doc_title, function (data) {
if (data) {
$.alerts._overlay('show');
window.location = href + '&document_title=' + data;
} else {
$.jGrowl(copy_doc_no, {theme: 'error'});
}
}
);
});
},
//
documentAction: function () {
$(".docaction").hover(
function () { $(this).children(".actions").show("fade", 10); },
function() { $(this).children(".actions").hide("fade", 10); }
);
},
//
searchDateTime: function () {
$('#document_published').datepicker({
changeMonth: true,
changeYear: true,
onClose: function (dateText, inst) {
var endDateTextBox = $('#document_expire');
if (endDateTextBox.val() != '') {
var testStartDate = new Date(dateText);
var testEndDate = new Date(endDateTextBox.val());
if (testStartDate > testEndDate)
endDateTextBox.val(dateText);
}
else {
endDateTextBox.val(dateText);
}
},
onSelect: function (selectedDateTime) {
var start = $(this).datetimepicker('getDate');
$('#document_expire').datetimepicker('option', 'minDate', new Date(start.getTime()));
}
});
$('#document_expire').datepicker({
changeMonth: true,
changeYear: true,
onClose: function (dateText, inst) {
var startDateTextBox = $('#document_published');
if (startDateTextBox.val() != '') {
var testStartDate = new Date(startDateTextBox.val());
var testEndDate = new Date(dateText);
if (testStartDate > testEndDate)
startDateTextBox.val(dateText);
}
else {
startDateTextBox.val(dateText);
}
},
onSelect: function (selectedDateTime) {
var end = $(this).datetimepicker('getDate');
$('#document_published').datetimepicker('option', 'maxDate', new Date(end.getTime()));
}
});
},
//
searchCollapsible: function () {
$('.collapsible').collapsible({
defaultOpen: 'opened',
cssOpen: 'inactive',
cssClose: 'normal',
cookieName: 'collaps_doc',
cookieOptions: {
expires: 7,
domain: ''
},
speed: 5,
loadOpen: function (elem, opts) {
elem.next().show();
},
loadClose: function (elem, opts) {
elem.next().hide();
}
});
$('.collapsible').on('click', function () {
setTimeout(function () {
AveAdmin.sticky_panel_refresh();
AveAdmin.select_form();
}, 10);
});
},
};

113
class/class.docs.php

@ -132,7 +132,7 @@
$stamp['day'] = explode(".", $data[0]);
$stamp['time'] = explode(":", $data[1]);
if (!empty($stamp))
if (! empty($stamp))
{
$timestamp = mktime(
$stamp['time'][0],
@ -4377,5 +4377,116 @@
exit;
}
function documentPublish ()
{
global $AVE_DB, $AVE_Template;
$doc_id = (int)$_REQUEST['doc_id'];
if (! $doc_id)
{
$return = [
'success' => false,
'header' => $AVE_Template->get_config_vars('DOC_STATUS_ERROR'),
'message' => '',
'theme' => 'error'
];
_json($return, true);
}
$sql = "
SELECT
document_status
FROM
" . PREFIX . "_documents
WHERE
Id = '" . $doc_id . "'
";
$status = $AVE_DB->Query($sql)->GetCell();
$sql = "
UPDATE
" . PREFIX . "_documents
SET
document_status = '" . ($status == 1 ? 0 : 1) . "'
WHERE
Id = '" . $doc_id . "'
";
$AVE_DB->Query($sql);
$return = [
'success' => true,
'status' => ($status == 1 ? '0' : '1'),
'text' => ($status == 1 ? $AVE_Template->get_config_vars('DOC_ENABLE_TITLE') : $AVE_Template->get_config_vars('DOC_DISABLE_TITLE')),
'header' => $AVE_Template->get_config_vars('DOC_STATUS_SUCCESS'),
'message' => ($status == 1 ? $AVE_Template->get_config_vars('DOC_STATUS_OFF') : $AVE_Template->get_config_vars('DOC_STATUS_ON')),
'theme' => 'accept'
];
$AVE_DB->clearDocument($doc_id);
reportLog($_SESSION['user_name'] . ' - ' . (($status == 1) ? $AVE_Template->get_config_vars('DOC_STATUS_OFF') : $AVE_Template->get_config_vars('DOC_STATUS_ON')) . ' (' . $doc_id . ')', 2, 2);
_json($return, true);
}
function documentRecycle ()
{
global $AVE_DB, $AVE_Template;
$doc_id = (int) $_REQUEST['doc_id'];
if (!$doc_id) {
$return = [
'success' => false,
'header' => $AVE_Template->get_config_vars('DOC_STATUS_ERROR'),
'message' => '',
'theme' => 'error'
];
_json($return, true);
}
$sql = "
SELECT
document_deleted
FROM
" . PREFIX . "_documents
WHERE
Id = '" . $doc_id . "'
";
$status = $AVE_DB->Query($sql)->GetCell();
$sql = "
UPDATE
" . PREFIX . "_documents
SET
document_deleted = '" . ($status == 0 ? 1 : 0) . "'
WHERE
Id = '" . $doc_id . "'
";
$AVE_DB->Query($sql);
$return = [
'success' => true,
'status' => ($status == 1 ? '0' : '1'),
'text' => ($status == 1 ? $AVE_Template->get_config_vars('DOC_TEMPORARY_DELETE') : $AVE_Template->get_config_vars('DOC_RESTORE_DELETE')),
'header' => $AVE_Template->get_config_vars('DOC_STATUS_SUCCESS'),
'message' => ($status == 1 ? $AVE_Template->get_config_vars('DOC_RECYCLE_ON') : $AVE_Template->get_config_vars('DOC_RECYCLE_OFF')),
'theme' => 'accept'
];
$AVE_DB->clearDocument($doc_id);
reportLog($_SESSION['user_name'] . ' - ' . (($status == 1) ? $AVE_Template->get_config_vars('DOC_RECYCLE_ON') : $AVE_Template->get_config_vars('DOC_RECYCLE_OFF')) . ' (' . $doc_id . ')', 2, 2);
_json($return, true);
}
}
?>
Loading…
Cancel
Save