1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
%# BEGIN LICENSE BLOCK
%#
%# Copyright (c) 2002-2003 Jesse Vincent <jesse@bestpractical.com>
%#
%# This program is free software; you can redistribute it and/or modify
%# it under the terms of version 2 of the GNU General Public License
%# as published by the Free Software Foundation.
%#
%# A copy of that license should have arrived with this
%# software, but in any event can be snarfed from www.gnu.org.
%#
%# This program is distributed in the hope that it will be useful,
%# but WITHOUT ANY WARRANTY; without even the implied warranty of
%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
%# GNU General Public License for more details.
%#
%# END LICENSE BLOCK
<& /RTFM/Article/Elements/Tabs, Article => $ArticleObj, current_subtab =>
"RTFM/Article/Delete.html?id=".$ArticleObj->Id , id => $id, Title => $title &>
% if ($ARGS{'Delete'}) {
<%$title%>
<& /Elements/ListActions, actions => \@results &>
% } else {
<b><&|/l&>Are you sure you want to delete this article?</&></b>
<table>
<tr>
<td align="left">
<form action="Display.html?id=<%$ArticleObj->Id%>" method="get" >
<input type=submit value="<&|/l&>No</&>">
</form>
</td>
<td align="right">
<form action="Delete.html" method="POST" >
<INPUT TYPE=HIDDEN NAME=id VALUE="<%$ArticleObj->Id%>">
<INPUT TYPE="HIDDEN" NAME="Delete" VALUE="yes">
<input type=submit value="<&|/l&>Yes</&>">
</form>
</td>
</tr>
</table>
% }
<%INIT>
my @results;
my $title;
my $ArticleObj = RT::FM::Article->new( $session{'CurrentUser'} );
$ArticleObj->Load($id);
unless ( $ArticleObj->id ) {
$m->comp("/RTFM/Elements/Error", Why => loc("Unable to load article") );
}
unless ( $ArticleObj->CurrentUserHasRight('ModifyArticle') ) {
$m->comp("/RTFM/Elements/Error", Why => "No permission to modify article");
}
if ($ARGS{'Delete'} eq 'yes') {
$ArticleObj->Delete();
$title = loc('Article #[_1] deleted', $ArticleObj->Id);
}
else {
$title = loc('Delete article #[_1]', $ArticleObj->Id);
}
</%INIT>
<%ARGS>
$id => undef
</%ARGS>
|