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 * Tag Update Page
19 *
20 * @package MantisBT
21 * @copyright Copyright 2002  MantisBT Team - mantisbt-dev@lists.sourceforge.net
22 * @link http://www.mantisbt.org
23 *
24 * @uses core.php
25 * @uses access_api.php
26 * @uses authentication_api.php
27 * @uses compress_api.php
28 * @uses config_api.php
29 * @uses constant_inc.php
30 * @uses form_api.php
31 * @uses gpc_api.php
32 * @uses helper_api.php
33 * @uses html_api.php
34 * @uses lang_api.php
35 * @uses prepare_api.php
36 * @uses print_api.php
37 * @uses string_api.php
38 * @uses tag_api.php
39 * @uses user_api.php
40 */
41
42require_once( 'core.php' );
43require_api( 'access_api.php' );
44require_api( 'authentication_api.php' );
45require_api( 'compress_api.php' );
46require_api( 'config_api.php' );
47require_api( 'constant_inc.php' );
48require_api( 'form_api.php' );
49require_api( 'gpc_api.php' );
50require_api( 'helper_api.php' );
51require_api( 'html_api.php' );
52require_api( 'lang_api.php' );
53require_api( 'prepare_api.php' );
54require_api( 'print_api.php' );
55require_api( 'string_api.php' );
56require_api( 'tag_api.php' );
57require_api( 'user_api.php' );
58
59compress_enable();
60
61$f_tag_id = gpc_get_int( 'tag_id' );
62tag_ensure_exists( $f_tag_id );
63$t_tag_row = tag_get( $f_tag_id );
64
65$t_name = string_display_line( $t_tag_row['name'] );
66$t_description = string_display( $t_tag_row['description'] );
67
68if( !( access_has_global_level( config_get( 'tag_edit_threshold' ) )
69	|| ( auth_get_current_user_id() == $t_tag_row['user_id'] )
70		&& access_has_global_level( config_get( 'tag_edit_own_threshold' ) ) ) ) {
71	access_denied();
72}
73
74layout_page_header( sprintf( lang_get( 'tag_update' ), $t_name ) );
75
76layout_page_begin();
77?>
78<div class="col-md-12 col-xs-12">
79	<div class="space-10"></div>
80	<form method="post" action="tag_update.php">
81	<div class="widget-box widget-color-blue2">
82		<div class="widget-header widget-header-small">
83			<h4 class="widget-title lighter">
84				<?php print_icon( 'fa-tag', 'ace-icon' ); ?>
85				<?php echo sprintf( lang_get( 'tag_update' ), $t_name ) ?>
86			</h4>
87		</div>
88		<div class="widget-body">
89		<div class="widget-main no-padding">
90		<div class="widget-toolbox padding-8 clearfix">
91			<?php print_link_button( 'tag_view_page.php?tag_id='.$f_tag_id, lang_get( 'tag_update_return' ),
92				'btn-sm pull-right' ); ?>
93		</div>
94		<div class="form-container">
95		<div class="table-responsive">
96		<table class="table table-bordered table-condensed table-striped">
97		<fieldset>
98			<input type="hidden" name="tag_id" value="<?php echo $f_tag_id ?>"/>
99			<?php echo form_security_field( 'tag_update' ) ?>
100			<tr>
101				<td class="category">
102					<?php echo lang_get( 'tag_id' ) ?>
103				</td>
104				<td><?php echo $t_tag_row['id'] ?></td>
105			</tr>
106			<tr>
107				<td class="category">
108					<?php echo lang_get( 'tag_name' ) ?>
109				</td>
110				<td>
111					<input type="text" <?php echo helper_get_tab_index() ?> id="tag-name" name="name" class="input-sm" value="<?php echo $t_name ?>"/>
112				</td>
113			</tr>
114			<tr>
115				<?php
116				if( access_has_global_level( config_get( 'tag_edit_threshold' ) ) ) {
117					echo '<td class="category">', lang_get( 'tag_creator' ), '</td>';
118					echo '<td><select ', helper_get_tab_index(), ' id="tag-user-id" name="user_id" class="input-sm">';
119					print_user_option_list( (int)$t_tag_row['user_id'], ALL_PROJECTS, (int)config_get( 'tag_create_threshold' ) );
120					echo '</select></td>';
121				} else { ?>
122					<td class="category"><?php echo lang_get( 'tag_creator' ); ?></td>
123					<td><?php echo string_display_line( user_get_name($t_tag_row['user_id']) ); ?></td><?php
124				} ?>
125			</tr>
126			<tr>
127				<td class="category">
128					<?php echo lang_get( 'tag_created' ) ?>
129				</td>
130				<td><?php echo date( config_get( 'normal_date_format' ), $t_tag_row['date_created'] ) ?></td>
131			</tr>
132			<tr>
133				<td class="category">
134					<?php echo lang_get( 'tag_updated' ) ?>
135				</td>
136				<td><?php echo date( config_get( 'normal_date_format' ), $t_tag_row['date_updated'] ) ?></td>
137			</tr>
138			<tr>
139				<td class="category">
140					<?php echo lang_get( 'tag_description' ) ?>
141				</td>
142				<td>
143					<?php # Newline after opening textarea tag is intentional, see #25839 ?>
144					<textarea class="form-control" id="tag-description" name="description" <?php echo helper_get_tab_index() ?> cols="80" rows="6">
145<?php echo string_textarea( $t_description ) ?>
146</textarea>
147				</td>
148			</tr>
149		</fieldset>
150		</table>
151		</div>
152		</div>
153		</div>
154		</div>
155		<div class="widget-toolbox padding-8 clearfix">
156			<input <?php echo helper_get_tab_index() ?> type="submit" class="btn btn-primary btn-white btn-round" value="<?php echo lang_get( 'tag_update_button' ) ?>" />
157		</div>
158		</div>
159	</form>
160</div>
161
162<?php
163layout_page_end();
164