myaac/system/templates/admin.news.form.html.twig
slawkens f3745a2752
Feature/new router (#165)
* Remove unneeded escape

* Fix guild back buttons (change logo & motd)

* small adjustment in news.php

* Fix create character when admin (any case is allowed now)

* Fix forum table style (boards & thread view)

* Small improvement to plugins.enabled check

* [WIP] nikic/fast-route implementation

I will describe it more in Pull Request

* Optimisations & fixes.

* Fix path - should not be absolute

* Add PLUGINS to Twig path

* Don't hide "Install Plugin" Box by default

* Update package-lock.json

* nothing important, just early exit & fixes

Fix creature display

* fix premium_ends_at for tfs 1.3+

* Move pages

* Move pages tbc

* $db->select: make $where parameter optional, allows to get all records

* Add some error box to error

* fix parse error

* Rewriting the router v2

To be more flexible

* small fixes

* fix & add admin icons

* Move mass_* pages to correct folder

* fix logout hook 2

* Delete accountmanagement.php

* This code wasn't used

* Add missing var

* Add redirect_from && redirect_to to router options

+ Also add * for all methods shortcut

* Remove comments

Not allowed in normal json

* Allow admin pages included into plugins dir

* block access to some files

* Fix admin logout

* Fix #178

* feature: mail confirmed reward

Suggested by @EPuncker

# Conflicts:
#	system/hooks.php

* remove misleading comment

* adjust required version according to composer.json

* fix duplicated word

* Adjustments & fixed to mass actions

* Add password confirm, and change text type to password

* Add list of Open Source Software MyAAC is using

* Fix signature

* Show First, Second instead of numbers

* fix base dir detection

* fix double ACTION define + undefined URI in template

* new function> escapeHtml + fix css in admin menus

* fix changelog add

* fix news adding, rename const to NEWS_*

* Add verify to pages, add messages, limits, fix add

* fix "Please fill all input"

* add required input to admin pages

* shorten some expressions with ??

* shorten code + fix conversion (int)

* Move account_types to config, account.web_flags to common.php

* Update example.json

* feature: router aliases

* shorten some code + const convert

* remove wrong char

* fix signature on custom basedir

* fix: mass teleport position validation (#214)

* fix: mass teleport position validation

* fix: max position

* Fix execute in CLI

* fix warning in reload cache in dev mode

* Configurable admin panel folder

* feature: plugin require more options with comma

* $config_account_salt -> USE_ACCOUNT_SALT

* fix forum show_thread

* Update show_thread.php

---------

Co-authored-by: Gabriel Pedro <gpedro@users.noreply.github.com>
2023-02-07 11:41:05 +01:00

124 lines
5.3 KiB
Twig

{% if action %}
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">{% if action == 'edit' %}Edit{% else %}Add{% endif %} news</h5>
</div>
<form id="form" role="form" method="post" action="{{ news_link_form }}">
<div class="card-body " id="page-edit-table">
{% if action == 'edit' %}
<input type="hidden" name="id" value="{{ news_id }}"/>
{% endif %}
<div class="form-group row">
<label for="title">Title</label>
<input type="text" id="title" name="title" class="form-control" autocomplete="off" style="cursor: auto;" value="{{ title }}" required>
</div>
<label for="editor">Content</label>
<div class="form-group">
<textarea class="form-control" id="editor" name="body" maxlength="65000" cols="50" rows="5">{{ body|raw }}</textarea>
</div>
<div class="form-group row">
<label for="select-type">Type</label>
<select class="form-control" name="type" id="select-type">
<option value="{{ constant('NEWS') }}" {% if type is defined and type == constant('NEWS') %}selected="selected"{% endif %}{% if action == 'edit' and type != constant('NEWS') %} disabled{% endif %}>News</option>
<option value="{{ constant('TICKER') }}" {% if type is defined and type == constant('TICKER') %}selected="selected"{% endif %}{% if action == 'edit' and type != constant('TICKER') %} disabled{% endif %}>Ticker</option>
<option value="{{ constant('ARTICLE') }}" {% if type is defined and type == constant('ARTICLE') %}selected="selected"{% endif %}{% if action == 'edit' and type != constant('ARTICLE') %} disabled{% endif %}>Article</option>
</select>
</div>
<div id="article-text" class="form-group row"{% if type is not defined or type != constant('ARTICLE') %} style="display: none;"{% endif %}>
<label for="article_text">Article short text</label>
<textarea class="form-control" name="article_text" id="article_text" cols="50" rows="5">{% if article_text is not empty %}{{ article_text }}{% endif %}</textarea>
</div>
<div id="article-image" class="form-group row"{% if type is not defined or type != constant('ARTICLE') %} style="display: none;"{% endif %}>
<label for="article_image">Article image</label>
<input class="form-control" type="text" name="article_image" id="article_image" value="{% if article_image is not empty %}{{ article_image }}{% else %}images/news/announcement.jpg{% endif %}"/>
</div>
<div class="form-group row">
{% if action == 'edit' %}
{% if player is defined %}
<div class="col-sm-6 pl-0">
<label for="author">Author</label>
<select class="form-control" id="author" name="original_id" disabled="disabled">
<option value="{{ player.getId() }}">{{ player.getName() }}</option>
</select>
</div>
{% endif %}
{% endif %}
<div class="col-sm-{{ (action == 'edit') ? '6' : '12' }} px-0">
<label for="player_id">{% if action == 'edit' %}Modified by{% else %}Author{% endif %}</label>
<select class="form-control" name="player_id" id="player_id">
{% for player in account_players %}
<option value="{{ player.getId() }}"{% if player_id is defined and player.getId() == player_id %} selected="selected"{% endif %}>{{ player.getName() }}</option>
{% endfor %}
</select>
</div>
</div>
{% if action != 'edit' %}
<div class="form-group row">
<label for="forum_section">Create forum thread in section:</label>
<select class="form-control" name="forum_section" id="forum_section">
<option value="-1">None</option>
{% for section in forum_boards %}
<option value="{{ section.id }}" {% if forum_section is defined and forum_section == section.id %}checked="yes"{% endif %}>{{ section.name }}</option>
{% endfor %}
</select>
</div>
{% elseif comments is not null %}
<input type="hidden" name="forum_section" id="forum_section" value="{{ comments }}"/>
{% endif %}
<div class="form-group row">
<label for="category">Category</label>
<div class="col-sm-12">
{% for id, cat in categories %}
<input type="radio" name="category" value="{{ id }}" {% if (category == 0 and id == 1) or (category == id) %}checked="yes"{% endif %}/>
<img src="{{ constant('BASE_URL') }}images/news/icon_{{ cat.icon_id }}_small.gif"/>
{% endfor %}
</div>
</div>
</div>
<div class="card-footer">
<button type="submit" class="btn btn-info"><i class="fas fa-update"></i> Update</button>
<button type="button" onclick="window.location = '{{ constant('ADMIN_URL') }}?p=news';" class="btn btn-danger float-right"><i class="fas fa-cancel"></i> Cancel</button>
</div>
</form>
</div>
{% if action != 'edit' %}
<script type="text/javascript">
$(document).ready(function () {
$("#news-edit").hide();
$("#news-button").click(function () {
$("#news-edit").toggle();
return false;
});
$('#select-type').change(function () {
var value = $('#select-type').val();
if (value === {{ constant('ARTICLE') }}) {
$('#article-text').show();
$('#article-image').show();
} else {
$('#article-text').hide();
$('#article-image').hide();
}
});
});
</script>
{% endif %}
{{ include('tinymce.html.twig') }}
<script type="text/javascript">
tinymceInit();
</script>
{% endif %}