Minor improvements (#224)

* Minor improvements

* Update posting_tpl.tpl

* Updated

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2023-08-21 15:08:20 +07:00 committed by GitHub
parent c7be156303
commit 0f092de85e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 4 deletions

View File

@ -6,7 +6,7 @@
**Merged pull requests:**
- Release v2.1.5-2023.08 🎉
- Minor improvements [\#215](https://github.com/torrentpier/torrentpier-lts/pull/215), [\#216](https://github.com/torrentpier/torrentpier-lts/pull/216), [\#217](https://github.com/torrentpier/torrentpier-lts/pull/217), [\#218](https://github.com/torrentpier/torrentpier-lts/pull/218), [\#221](https://github.com/torrentpier/torrentpier-lts/pull/221), [\#222](https://github.com/torrentpier/torrentpier-lts/pull/222) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#215](https://github.com/torrentpier/torrentpier-lts/pull/215), [\#216](https://github.com/torrentpier/torrentpier-lts/pull/216), [\#217](https://github.com/torrentpier/torrentpier-lts/pull/217), [\#218](https://github.com/torrentpier/torrentpier-lts/pull/218), [\#221](https://github.com/torrentpier/torrentpier-lts/pull/221), [\#222](https://github.com/torrentpier/torrentpier-lts/pull/222), [\#224](https://github.com/torrentpier/torrentpier-lts/pull/224) ([belomaxorka](https://github.com/belomaxorka))
## [v2.1.5-2023.07](https://github.com/torrentpier/torrentpier-lts/tree/v2.1.5-2023.07) (2023-08-04)
[Full Changelog](https://github.com/torrentpier/torrentpier-lts/compare/v2.1.5-2023.06...v2.1.5-2023.07)

View File

@ -16,6 +16,7 @@ switch ($mode)
{
case 'load':
case 'save':
case 'remove':
if (!$tpl_id = (int) $this->request['tpl_id'])
{
$this->ajax_die('Выбранный шаблон не найден, создайте новый (empty tpl_id)');
@ -152,6 +153,25 @@ switch ($mode)
}
break;
// удаление шаблона
case 'remove':
if (!$forum_id = (int) $this->request['forum_id'])
{
$this->ajax_die('empty forum_id');
}
if (!forum_exists($forum_id))
{
$this->ajax_die("нет такого форума [id: $forum_id]");
}
$sql = "DELETE FROM ". BB_TOPIC_TPL . " WHERE tpl_id = $tpl_id LIMIT 1";
if (!@DB()->query($sql))
{
$sql_error = DB()->sql_error();
}
DB()->query("UPDATE ". BB_FORUMS ." SET forum_tpl_id = 0 WHERE forum_id = $forum_id LIMIT 1");
$this->response['msg'] = "Шаблон {$tpl_data['tpl_name']} успешно удалён";
break;
// ошибочный $mode
default:
$this->ajax_die("invalid mode: $mode");

View File

@ -4090,10 +4090,12 @@ ajax.topic_tpl = function(mode, params) {
$('#tpl-new-block').toggle();
break;
case 'remove':
case 'load':
ajax.exec({
action : 'topic_tpl',
mode : 'load',
mode : mode,
forum_id : {FORUM_ID},
tpl_id : $('#forum_tpl_select').val()
});
break;
@ -4164,6 +4166,7 @@ ajax.callback.topic_tpl = function(data) {
break;
case 'assign':
case 'remove':
alert(data.msg);
window.location.reload();
break;
@ -4180,6 +4183,7 @@ ajax.callback.topic_tpl = function(data) {
case 'new':
$('#tpl-new-resp').html('новый шаблон создан (в списке выбора он появится после перезагрузки страницы)');
window.location.reload();
break;
}
};
@ -4400,6 +4404,7 @@ $(function(){
<!-- IF TPL_SELECT -->{TPL_SELECT} &nbsp;
<input type="button" value="Включить в этом форуме" class="bold" onclick="ajax.topic_tpl('assign', {tpl_id: $('#forum_tpl_select').val()})" /> &nbsp;
<input type="button" value="Загрузить" onclick="ajax.topic_tpl('load')" /> &nbsp;
<input type="button" value="{L_REMOVE}" onclick="ajax.topic_tpl('remove')" /> &nbsp;
<!-- ELSE -->Нет щаблонов для релизов<!-- ENDIF -->
<br /><br />
<span class="gen">