1<?php
2# MantisBT - A PHP based bugtracking system
3
4# MantisBT is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 2 of the License, or
7# (at your option) any later version.
8#
9# MantisBT is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.
16
17/**
18 * Manage News
19 *
20 * @package MantisBT
21 * @copyright Copyright 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
22 * @copyright Copyright 2002  MantisBT Team - mantisbt-dev@lists.sourceforge.net
23 * @link http://www.mantisbt.org
24 *
25 * @uses core.php
26 * @uses access_api.php
27 * @uses config_api.php
28 * @uses current_user_api.php
29 * @uses form_api.php
30 * @uses helper_api.php
31 * @uses html_api.php
32 * @uses lang_api.php
33 * @uses news_api.php
34 * @uses print_api.php
35 */
36
37require_once( 'core.php' );
38require_api( 'access_api.php' );
39require_api( 'config_api.php' );
40require_api( 'current_user_api.php' );
41require_api( 'form_api.php' );
42require_api( 'helper_api.php' );
43require_api( 'html_api.php' );
44require_api( 'lang_api.php' );
45require_api( 'news_api.php' );
46require_api( 'print_api.php' );
47
48news_ensure_enabled();
49
50access_ensure_project_level( config_get( 'manage_news_threshold' ) );
51
52layout_page_header( lang_get( 'edit_news_link' ) );
53
54layout_page_begin( 'main_page.php' );
55?>
56
57<div class="col-md-12 col-xs-12">
58	<div id="news-add-div" class="form-container">
59	<form id="news-add-form" method="post" action="news_add.php">
60		<div class="widget-box widget-color-blue2">
61			<div class="widget-header widget-header-small">
62				<h4 class="widget-title lighter">
63					<?php print_icon( 'fa-edit', 'ace-icon' ); ?>
64					<?php echo lang_get( 'add_news_title' ) ?>
65				</h4>
66			</div>
67		<div class="widget-body">
68		<div class="widget-main no-padding">
69		<div class="table-responsive">
70		<table class="table table-bordered table-condensed table-striped">
71		<fieldset>
72			<?php echo form_security_field( 'news_add' ); ?>
73			<tr>
74				<td class="category">
75					<span class="required">*</span> <?php echo lang_get( 'headline' ) ?>
76				</td>
77				<td>
78					<input type="text" id="news-headline" name="headline" class="input-sm" size="64" maxlength="64" required />
79				</td>
80			</tr>
81			<tr>
82				<td class="category">
83					<span class="required">*</span> <?php echo lang_get( 'body' ) ?>
84				</td>
85				<td>
86					<textarea class="form-control" id="news-body" name="body" cols="60" rows="8" required></textarea>
87				</td>
88			</tr>
89			<tr>
90				<td class="category">
91					<?php echo lang_get( 'announcement' ) ?> <span class="help-text"><?php echo lang_get( 'stays_on_top' ) ?></span>
92				</td>
93				<td>
94					<label>
95						<input type="checkbox" class="ace" id="news-announcement" name="announcement" />
96						<span class="lbl"></span>
97					</label>
98				</td>
99			</tr>
100			<tr>
101				<td class="category">
102					<?php echo lang_get( 'view_status' ) ?>
103				</td>
104				<td>
105					<select id="news-view-status" name="view_state" class="input-sm">
106						<?php print_enum_string_option_list( 'view_state' ) ?>
107					</select>
108				</td>
109			</tr>
110		</fieldset>
111		</table>
112		</div>
113		</div>
114			<div class="widget-toolbox padding-8 clearfix">
115				<span class="required pull-right"> * <?php echo lang_get( 'required' ) ?></span>
116				<input type="submit" class="btn btn-primary btn-white btn-round" value="<?php echo lang_get( 'post_news_button' ) ?>" />
117			</div>
118		</div>
119		</div>
120	</form>
121	</div>
122</div>
123
124<?php
125# Add News Form END
126# Edit/Delete News Form BEGIN
127if( news_get_count( helper_get_current_project(), current_user_is_administrator() ) > 0 ) { ?>
128<div class="col-md-12 col-xs-12">
129	<div class="space-10"></div>
130	<div id="news-edit-div" class="form-container">
131	<form id="news-edit-form" method="post" action="news_edit_page.php">
132		<div class="widget-box widget-color-blue2">
133			<div class="widget-header widget-header-small">
134				<h4 class="widget-title lighter">
135					<?php print_icon( 'fa-edit', 'ace-icon' ); ?>
136					<?php echo lang_get( 'edit_or_delete_news_title' ) ?>
137				</h4>
138			</div>
139		<div class="widget-body">
140		<div class="widget-main no-padding">
141		<div class="table-responsive">
142		<table class="table table-bordered table-condensed table-striped">
143		<fieldset>
144			<?php echo form_security_field( 'news_delete' ); ?>
145			<tr>
146				<td class="category">
147					<?php echo lang_get( 'edit_post' ) ?>
148				</td>
149				<td>
150					<label>
151						<input type="radio" class="ace" id="news-edit-action" name="action" value="edit" checked="checked">
152						<span class="lbl"></span>
153					</label>
154				</td>
155			</tr>
156			<tr>
157				<td class="category">
158					<?php echo lang_get( 'delete_post' ) ?>
159				</td>
160				<td>
161					<label>
162						<input type="radio" class="ace" id="news-delete-action" name="action" value="delete">
163						<span class="lbl"></span>
164					</label>
165				</td>
166			</tr>
167			<tr>
168				<td class="category">
169					<?php echo lang_get( 'select_post' ) ?>
170				</td>
171				<td>
172					<select id="news-edit-id" name="news_id" class="input-sm">
173						<?php print_news_item_option_list() ?>
174					</select>
175				</td>
176			</tr>
177		</fieldset>
178		</table>
179		</div>
180		</div>
181			<div class="widget-toolbox padding-8 clearfix">
182				<input type="submit" class="btn btn-primary btn-white btn-round" value="<?php echo lang_get( 'submit' ) ?>" />
183			</div>
184		</div>
185		</div>
186	</form>
187	</div>
188</div>
189<?php
190} # Edit/Delete News Form END
191
192layout_page_end();
193