Commit f54c5ada65c61eab10ca93b4b718016b01515803

Authored by Carlos Rebelato
1 parent 550bbed3
Exists in master

manutenção na parte de adic

Kernel/Config/Files/FAQTag.xml
... ... @@ -14,7 +14,7 @@
14 14 <GroupRo>faq</GroupRo>
15 15 <Description Translatable="1">Cadastro de tags para categorias</Description>
16 16 <Name Translatable="1">Tag</Name>
17   - <Link>Action=AgentFAQTagOverview</Link>
  17 + <Link>Action=AgentFAQTagOverview;Subaction=overview</Link>
18 18 <Type></Type>
19 19 <Block></Block>
20 20 <NavBar>FAQ</NavBar>
... ...
Kernel/Modules/AgentFAQTagAdd.pm
... ... @@ -4,6 +4,7 @@ package Kernel::Modules::AgentFAQTagAdd;
4 4  
5 5 use strict;
6 6 use warnings;
  7 +use Data::Dumper;
7 8  
8 9 sub new {
9 10 my ( $Type, %Param ) = @_;
... ... @@ -25,86 +26,99 @@ sub Run {
25 26 my ( $Self, %Param ) = @_;
26 27 my %Data = ();
27 28  
28   - my $Tag_id = $Self->{ParamObject}->GetParam( Param => 'id' );
29   - my $Category = $Self->{ParamObject}->GetParam( Param => 'category' );
30   - my $Tag = $Self->{ParamObject}->GetParam( Param => 'tag' );
31   - my $Existe_Tag = 0;
32   -
33   - if ($Self->{ParamObject}->GetParam( Param => 'Subaction' ) eq "update") {
34   -
35   - if ($Self->_ExisteTag(tag => $Tag)){
36   - $Existe_Tag = 1;
37   -
38   - }else{
39   - if($Self->_GetTag(id => $Tag_id) eq undef){
40   - $Self->{DBObject}->Do(
41   - SQL => "INSERT into faq_tag (category_id, tag) values ((select id from faq_category where name= ?), ?)",
42   - Bind => [\$Category, \$Tag],
43   - );
44   - return $Self->{LayoutObject}->Redirect( OP => 'Action=AgentFAQTagOverview&added='.$Tag );
45   -
46   - }else{
47   - $Self->{DBObject}->Do(
48   - SQL => "update faq_tag set tag=? where id=?",
49   - Bind => [\$Tag, \$Tag_id],
50   - );
51   - return $Self->{LayoutObject}->Redirect( OP => 'Action=AgentFAQTagOverview&edited='.$Tag );
52   - }
53   - }
54   - }
55   -
56   - $Self->{LayoutObject}->Block(
57   - Name=> 'info',
58   - Data=> {id => $Tag_id,
59   - category => $Category,
60   - tag => $Tag,
61   - }
62   - );
63   -
64   - # build output
65   - my $Output = $Self->{LayoutObject}->Header(Title => "Tag");
  29 +# my $Tag_id = $Self->{ParamObject}->GetParam( Param => 'id' );
  30 +# my $Category = $Self->{ParamObject}->GetParam( Param => 'category' );
  31 +# my $Tag = $Self->{ParamObject}->GetParam( Param => 'tag' );
  32 +# my $Existe_Tag = 0;
  33 +
  34 +# if ($Self->{ParamObject}->GetParam( Param => 'Subaction' ) eq "update") {
  35 +# print STDERR Dumper("peguei subaction");
  36 +# if ($Self->_ExisteTag(tag => $Tag)){
  37 +# $Existe_Tag = 1;
  38 +
  39 +# }else{
  40 +# if($Self->_GetTag(id => $Tag_id) eq undef){
  41 +# $Self->{DBObject}->Do(
  42 +# SQL => "INSERT into faq_tag (category_id, tag) values ((select id from faq_category where name= ?), ?)",
  43 +# Bind => [\$Category, \$Tag],
  44 +# );
  45 +# return $Self->{LayoutObject}->Redirect( OP => 'Action=AgentFAQTagOverview&added='.$Tag );
  46 +
  47 +# }else{
  48 +# $Self->{DBObject}->Do(
  49 +# SQL => "update faq_tag set tag=? where id=?",
  50 +# Bind => [\$Tag, \$Tag_id],
  51 +# );
  52 +# return $Self->{LayoutObject}->Redirect( OP => 'Action=AgentFAQTagOverview&edited='.$Tag );
  53 +# }
  54 +# }
  55 +# }
  56 +
  57 +# $Self->{LayoutObject}->Block(
  58 +# Name=> 'info',
  59 +# Data=> {id => $Tag_id,
  60 +# category => $Category,
  61 +# tag => $Tag,
  62 +# }
  63 +# );
  64 +
  65 +# # build output
  66 +# my $Output = $Self->{LayoutObject}->Header(Title => "Tag");
66 67  
67   - if($Existe_Tag == 1){
68   - $Output .= $Self->{LayoutObject}->Notify(Priority => 'Error', Info=> "A tag ".$Tag." j\x{e1} existe.");
69   - }
70   - $Output .= $Self->{LayoutObject}->NavigationBar();
71   - $Output .= $Self->{LayoutObject}->Output(
72   - Data => \%Data,
73   - TemplateFile => 'AgentFAQTagAdd',
74   - );
75   - $Output .= $Self->{LayoutObject}->Footer();
76   - return $Output;
  68 +# if($Existe_Tag == 1){
  69 +# $Output .= $Self->{LayoutObject}->Notify(Priority => 'Error', Info=> "A tag ".$Tag." j\x{e1} existe.");
  70 +# }
  71 +# $Output .= $Self->{LayoutObject}->NavigationBar();
  72 +# $Output .= $Self->{LayoutObject}->Output(
  73 +# Data => \%Data,
  74 +# TemplateFile => 'AgentFAQTagAdd',
  75 +# );
  76 +# $Output .= $Self->{LayoutObject}->Footer();
  77 +# return $Output;
77 78 }
78 79  
79   -sub _GetTag {
  80 +# sub _GetTag {
80 81  
81   - my ( $Self, %Param ) = @_;
  82 +# my ( $Self, %Param ) = @_;
82 83  
83 84  
84   - $Self->{DBObject}->Prepare(
85   - SQL => "select tag from faq_tag where id = $Param{id}",
86   - );
87   - my $TAG;
88   - while (my @Row = $Self->{DBObject}->FetchrowArray()) {
89   - $TAG = $Row[0];
90   - }
91   - return $TAG;
  85 +# $Self->{DBObject}->Prepare(
  86 +# SQL => "select tag from faq_tag where id = $Param{id}",
  87 +# );
  88 +# my $TAG;
  89 +# while (my @Row = $Self->{DBObject}->FetchrowArray()) {
  90 +# $TAG = $Row[0];
  91 +# }
  92 +# return $TAG;
92 93  
93   -}
  94 +# }
94 95  
95   -sub _ExisteTag {
  96 +# sub _ExisteTag {
96 97  
97   - my ( $Self, %Param ) = @_;
  98 +# my ( $Self, %Param ) = @_;
98 99  
99 100  
  101 +# $Self->{DBObject}->Prepare(
  102 +# SQL => "select id from faq_tag where tag = '$Param{tag}'",
  103 +# );
  104 +# my $Id;
  105 +# while (my @Row = $Self->{DBObject}->FetchrowArray()) {
  106 +# $Id = $Row[0];
  107 +# }
  108 +# return $Id;
  109 +# }
  110 +
  111 +
  112 +
  113 +sub verificaExistenciaTag {
  114 + my ( $Self, %Param ) = @_;
  115 +
100 116 $Self->{DBObject}->Prepare(
101   - SQL => "select id from faq_tag where tag = '$Param{tag}'",
102   - );
103   - my $Id;
104   - while (my @Row = $Self->{DBObject}->FetchrowArray()) {
105   - $Id = $Row[0];
106   - }
107   - return $Id;
  117 + SQL => "select tag from faq_tag where tag = ?",
  118 + Bind => [\$Param{Tag}]
  119 + );
108 120  
  121 + return $Self->{DBObject}->FetchrowArray();
109 122 }
  123 +
110 124 1;
... ...
Kernel/Modules/AgentFAQTagOverview.pm
... ... @@ -2,7 +2,10 @@
2 2 package Kernel::Modules::AgentFAQTagOverview;
3 3  
4 4 use strict;
5   -use warnings;
  5 +require warnings;
  6 +use Kernel::System::FAQ;
  7 +use Kernel::System::Valid;
  8 +use Data::Dumper;
6 9  
7 10 sub new {
8 11 my ( $Type, %Param ) = @_;
... ... @@ -18,6 +21,9 @@ sub new {
18 21 }
19 22 }
20 23  
  24 + $Self->{ValidObject} = Kernel::System::Valid->new(%Param);
  25 + $Self->{FAQObject} = Kernel::System::FAQ->new(%Param);
  26 +
21 27 return $Self;
22 28 }
23 29  
... ... @@ -25,45 +31,209 @@ sub Run {
25 31 my ( $Self, %Param ) = @_;
26 32 my %Data = ();
27 33  
28   - if ($Self->{ParamObject}->GetParam( Param => 'Subaction' ) eq "delete") {
29   - my $Var1 = $Self->{ParamObject}->GetParam( Param => 'id' );
30   - $Self->{DBObject}->Do(
31   - SQL => "DELETE FROM faq_tag where id=?",
32   - Bind => [ \$Var1 ],
33   - );
  34 + my $SubAction = $Self->{ParamObject}->GetParam( Param => 'Subaction' );
  35 +
  36 + if($SubAction eq "overview"){
  37 +
  38 + # get all categories with their long names
  39 + my $CategoryTree = $Self->{FAQObject}->CategoryTreeList(
  40 + Valid => 0,
  41 + UserID => $Self->{UserID},
  42 + );
  43 +
  44 + # if there are any categories, they are shown
  45 + if ( $CategoryTree && ref $CategoryTree eq 'HASH' && %{$CategoryTree} ) {
  46 +
  47 + # get the valid list
  48 + my %ValidList = $Self->{ValidObject}->ValidList();
  49 +
  50 + # sort the category ids by the long category name
  51 + my @CategoryIDsSorted
  52 + = sort { $CategoryTree->{$a} cmp $CategoryTree->{$b} } keys %{$CategoryTree};
  53 +
  54 + # show all categories
  55 + for my $CategoryID (@CategoryIDsSorted) {
  56 +
  57 + # get category data
  58 + my %CategoryData = $Self->{FAQObject}->CategoryGet(
  59 + CategoryID => $CategoryID,
  60 + UserID => $Self->{UserID},
  61 + );
  62 +
  63 + # get valid string based on ValidID
  64 + $CategoryData{Valid} = $ValidList{ $CategoryData{ValidID} };
  65 +
  66 + # overwrite the name with the long name
  67 + $CategoryData{Name} = $CategoryTree->{$CategoryID};
  68 +
  69 + #get faq_tag data
  70 + $Self->{DBObject}->Prepare(
  71 + SQL => "select id, tag from faq_tag where category_id = ?",
  72 + Bind => [ \$CategoryID ]
  73 + );
  74 +
  75 + my @retornoSelect = $Self->{DBObject}->FetchrowArray();
  76 +
  77 + $CategoryData{Tag} = $retornoSelect[1];
  78 + $CategoryData{TagID} = $retornoSelect[0];
  79 + $CategoryData{CategoryID} = $CategoryID;
  80 +
  81 + # output the category data
  82 + $Self->{LayoutObject}->Block(
  83 + Name => 'OverviewResultRow',
  84 + Data => {%CategoryData},
  85 + );
  86 + }
  87 + }
  88 +
  89 + my $Output = $Self->{LayoutObject}->Header( Title => "Tags Overview" );
  90 + $Output .= $Self->{LayoutObject}->NavigationBar();
  91 + $Output .= $Self->{LayoutObject}->Output(
  92 + Data => \%Data,
  93 + TemplateFile => 'AgentFAQTagOverview',
  94 + );
  95 + $Output .= $Self->{LayoutObject}->Footer();
  96 + return $Output;
  97 + }
  98 + elsif($SubAction eq "showAlterar"){
  99 +
  100 +
  101 + my $TagID = $Self->{ParamObject}->GetParam(Param => "TagID");
  102 + my $CategoryID = $Self->{ParamObject}->GetParam(Param => "CategoryID");
  103 + my $CategoryName = $Self->{ParamObject}->GetParam(Param => "CategoryName");
  104 + my $Tag = "";
  105 +
  106 + if($TagID){
  107 + $Tag = $Self->getTagName(TagID => $TagID);
  108 + $Data{Update} = 1;
  109 + }
  110 +
  111 + $Data{TagID} = $TagID;
  112 + $Data{Tag} = $Tag;
  113 + $Data{CategoryID} = $CategoryID;
  114 + $Data{CategoryName} = $CategoryName;
  115 +
  116 + my $Output = $Self->{LayoutObject}->Header( Title => "Alterar" );
  117 + $Output .= $Self->{LayoutObject}->NavigationBar();
  118 + $Output .= $Self->{LayoutObject}->Output(
  119 + Data => \%Data,
  120 + TemplateFile => 'AgentFAQTagAdd',
  121 + );
  122 + $Output .= $Self->{LayoutObject}->Footer();
  123 + return $Output;
34 124 }
  125 + elsif($SubAction eq "alterar"){
35 126  
  127 + my $Tag = $Self->{ParamObject}->GetParam(Param => "Tag");
  128 + my $Update = $Self->{ParamObject}->GetParam(Param => "Update");
  129 + my $CategoryID = $Self->{ParamObject}->GetParam(Param => "CategoryID");
  130 + my $TagID = $Self->{ParamObject}->GetParam(Param => "TagID");
  131 +
  132 + if($Self->checkTag(Tag => $Tag)){
  133 + $Data{MensagemErro} = "Tag já existente";
  134 + $Data{Update} = $Update;
  135 + $Data{Tag} = $Tag;
  136 + $Data{TagID} = $TagID;
  137 + $Data{CategoryID} = $CategoryID;
  138 +
  139 + my $Output = $Self->{LayoutObject}->Header( Title => "Alterar" );
  140 + $Output .= $Self->{LayoutObject}->NavigationBar();
  141 + $Output .= $Self->{LayoutObject}->Output(
  142 + Data => \%Data,
  143 + TemplateFile => 'AgentFAQTagAdd',
  144 + );
  145 + $Output .= $Self->{LayoutObject}->Footer();
  146 + return $Output;
  147 + }
  148 +
  149 + if($Update){
  150 + $Self->updateTag(TagID => $TagID, Tag => $Tag);
  151 + }else{
  152 + $Self->adicionaTag(Tag => $Tag, CategoryID => $CategoryID);
  153 + }
  154 +
  155 + return $Self->{LayoutObject}->Redirect( OP => 'Action=AgentFAQTagOverview&Subaction=overview' );
  156 + }
  157 + elsif($SubAction eq "delete"){
  158 + $Self->removeTag(TagID => $Self->{ParamObject}->GetParam(Param => "TagID"));
  159 + return $Self->{LayoutObject}->Redirect( OP => 'Action=AgentFAQTagOverview&Subaction=overview' );
  160 + }
  161 +}
  162 +
  163 +sub getTagName {
  164 + my ( $Self, %Param ) = @_;
  165 +
  166 + $Self->{DBObject}->Prepare(
  167 + SQL => "select tag from faq_tag where id = ?",
  168 + Bind => [\$Param{TagID}]
  169 + );
  170 +
  171 + my @Tag = $Self->{DBObject}->FetchrowArray();
  172 +
  173 + return $Tag[0];
  174 +}
  175 +
  176 +sub checkTag {
  177 + my ( $Self, %Param ) = @_;
36 178  
37 179 $Self->{DBObject}->Prepare(
38   - SQL => "select faq_tag.id, faq_tag.tag, faq_category.name from faq_category left join faq_tag on (faq_category.id = faq_tag.category_id)",
  180 + SQL => "select tag from faq_tag where tag = ?",
  181 + Bind => [\$Param{Tag}]
39 182 );
40 183  
41   - while (my @Row = $Self->{DBObject}->FetchrowArray()) {
42   - $Self->{LayoutObject}->Block(
43   - Name=> 'dadostabela',
44   - Data=> {id=>$Row[0], tag=>$Row[1], category=>$Row[2]}
45   - );
  184 + if($Self->{DBObject}->FetchrowArray()){
  185 + return 1;
46 186 }
47   -
48   - # build output
49   - my $Output = $Self->{LayoutObject}->Header(Title => "Tag");
50   -
51   - if ($Self->{ParamObject}->GetParam( Param => 'added' )) {
52   - my $Added = $Self->{ParamObject}->GetParam( Param => 'added' );
53   - $Output .= $Self->{LayoutObject}->Notify( Info => 'Tag '.$Added.' adicionada!' );
  187 +
  188 + return 0;
  189 +}
  190 +
  191 +sub updateTag{
  192 + my ( $Self, %Param ) = @_;
  193 +
  194 + for (qw(TagID Tag)) {
  195 + if ( !$Param{$_} ) {
  196 + $Self->{LayoutObject}
  197 + ->FatalError( Message => Dumper( \%Param ) . "got no $_!" );
  198 + }
54 199 }
55   - if ($Self->{ParamObject}->GetParam( Param => 'edited' )) {
56   - my $Edited = $Self->{ParamObject}->GetParam( Param => 'edited' );
57   - $Output .= $Self->{LayoutObject}->Notify( Info => 'Tag '.$Edited.' modificada!' );
  200 +
  201 + $Self->{DBObject}->Do(
  202 + SQL => "update faq_tag set tag= ? where id = ?",
  203 + Bind => [\$Param{Tag}, \$Param{TagID} ]
  204 + );
  205 +}
  206 +
  207 +sub adicionaTag{
  208 + my ( $Self, %Param ) = @_;
  209 +
  210 + for (qw( CategoryID Tag)) {
  211 + if ( !$Param{$_} ) {
  212 + $Self->{LayoutObject}
  213 + ->FatalError( Message => Dumper( \%Param ) . "got no $_!" );
  214 + }
58 215 }
59 216  
60   - $Output .= $Self->{LayoutObject}->NavigationBar();
61   - $Output .= $Self->{LayoutObject}->Output(
62   - Data => \%Data,
63   - TemplateFile => 'AgentFAQTagOverview',
  217 + $Self->{DBObject}->Do(
  218 + SQL => "insert into faq_tag (category_id, tag) values (?,?)",
  219 + Bind => [\$Param{CategoryID}, \$Param{Tag}]
64 220 );
65   - $Output .= $Self->{LayoutObject}->Footer();
66   - return $Output;
  221 +}
  222 +
  223 +sub removeTag{
  224 + my ( $Self, %Param ) = @_;
67 225  
  226 + for (qw( TagID )) {
  227 + if ( !$Param{$_} ) {
  228 + $Self->{LayoutObject}
  229 + ->FatalError( Message => Dumper( \%Param ) . "got no $_!" );
  230 + }
  231 + }
  232 +
  233 + $Self->{DBObject}->Do(
  234 + SQL => "delete from faq_tag where id = ?",
  235 + Bind => [\$Param{TagID}]
  236 + );
68 237 }
  238 +
69 239 1;
... ...
Kernel/Output/HTML/Standard/AgentFAQTagAdd.dtl
... ... @@ -5,14 +5,12 @@
5 5 }
6 6 </style>
7 7  
8   -<script type="text/javascript" src="formatar_moeda.js"></script>
9 8 <div class="Content">
10   -<!-- dtl:block:info -->
11   - <form name="input" action="$Env{"CGIHandle"}" method="post" onSubmit="return valida_dados(this)">
  9 + <form name="input" action="$Env{"CGIHandle"}" method="post">
12 10 <input type="hidden" name="Action" value="$Env{"Action"}" />
13   - <input type="hidden" name="Subaction" value="update" />
  11 + <input type="hidden" name="Subaction" value="alterar" />
14 12 <div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst">
15   - <h1>$Text{"Gerenciamento de Materiais"}</h1>
  13 + <h1>$Text{"Gerenciamento de Tags"}</h1>
16 14 <div class="SidebarColumn">
17 15 <div class="WidgetSimple">
18 16 <div class="Header">
... ... @@ -21,7 +19,7 @@
21 19 <div class="Content">
22 20 <ul class="ActionList">
23 21 <li>
24   - <a href="$Env{"Baselink"}Action=AgentFAQTagOverview" class="CallForAction"><span>$Text{"Go to overview"}</span></a>
  22 + <a href="$Env{"Baselink"}Action=AgentFAQTagOverview&Subaction=overview" class="CallForAction"><span>$Text{"Go to overview"}</span></a>
25 23 </li>
26 24 </ul>
27 25 </div>
... ... @@ -30,18 +28,19 @@
30 28 <div class="ContentColumn">
31 29 <div class="WidgetSimple">
32 30 <div class="Header">
33   -
34   - <h2>Editar Tag: $QData{"category"}</h2>
  31 + <h2>Editar Tag: $QData{"CategoryName"}</h2>
35 32 </div>
36 33 <div class="Content SpacingBottom">
37 34 <fieldset class="TableLike">
38   -<!-- start form -->
  35 +
39 36 <label class="Mandatory" for="tag" ><span class="Marker">*</span> Tag:</label>
40 37 <div class="Field">
41   - <input type="hidden" id="category" name="category" value="$QData{"category"}">
42   - <input type="hidden" id="id" name="id" value="$QData{"id"}">
43   - <input type="text" id="tag" name="tag" class="W50pc Validate_Required " length="15" value="$QData{"tag"}">
  38 + <input type="hidden" id="CategoryID" name="CategoryID" value="$QData{"CategoryID"}"/>
  39 + <input type="hidden" id="TagID" name="TagID" value="$QData{"TagID"}"/>
  40 + <input type="hidden" id="Update" name="Update" value="$QData{"Update"}"/>
  41 + <input type="text" id="Tag" name="Tag" class="W50pc Validate_Required " length="15" value="$QData{"Tag"}"/>
44 42 </div>
  43 + $QData{"MensagemErro"}
45 44 <div class="Clear"></div>
46 45 <div class="Field SpacingTop">
47 46 <button class="Primary" type="submit" id="cadastrar" value="Cadastrar">$Text{"Submit"}</button>
... ... @@ -49,13 +48,12 @@
49 48 <a href="/otrs/index.pl?Action=AgentFAQTagOverview">Cancelar</a>
50 49 </div>
51 50 <div class="Clear"></div>
52   -<!-- dtl:block:info -->
  51 +
53 52 </fieldset>
54 53 </div>
55 54 </div>
56 55 </div>
57 56 </div>
58   -<!-- end form -->
59 57 </form>
60 58 </div>
61 59  
... ...
Kernel/Output/HTML/Standard/AgentFAQTagOverview.dtl
... ... @@ -21,21 +21,24 @@
21 21 <table class="DataTable SpacingTop">
22 22 <thead>
23 23 <tr>
24   - <th>Categoria</th>
25   - <th>Tag</th>
26   - <th>Excluir</th>
  24 + <th><center>Categoria</center></th>
  25 + <th><center>Tag</center></th>
  26 + <th><center>Opções</center></th>
27 27 </tr>
28 28 </thead>
29 29 <tbody>
30   -<!-- dtl:block:dadostabela -->
31   - <tr class="MasterAction" id="$QData{"id"}">
32   - <td><a class="AsBlock" href="$Env{"Baselink"}Action=AgentFAQTagAdd&id=$QData{"id"}&category=$QData{"category"}&tag=$QData{"tag"}"</a>$QData{"category"}</td>
33   - <td>$QData{"tag"}</td>
34   - <td>
35   - <option><center><a class="TrashCan" onClick="remover('$QData{"category"}', $QData{"id"}, '$QData{"tag"}')"></a></center></option>
36   - </td>
  30 +<!-- dtl:block:OverviewResultRow -->
  31 + <tr>
  32 + <td><center>$QData{"Name"}</center></td>
  33 + <td><center>$QData{"Tag"}</center></td>
  34 + <td>
  35 + <center>
  36 + <a class="TrashCan" onClick="remover('$QData{"Name"}','$QData{"TagID"}')"></a>
  37 + <a href='$Env{"Baselink"}Action=AgentFAQTagOverview&Subaction=showAlterar&CategoryID=$QData{"CategoryID"}&TagID=$QData{"TagID"}&CategoryName=$QData{"Name"}' class="CallForAction"><span>$Text{"Alterar Tag"}</span></a>
  38 + </center>
  39 + </td>
37 40 </tr>
38   -<!-- dtl:block:dadostabela -->
  41 +<!-- dtl:block:OverviewResultRow -->
39 42 </tbody>
40 43 </table>
41 44 </div>
... ... @@ -44,13 +47,13 @@
44 47 </div>
45 48  
46 49 <script type="text/javascript" charset="utf-8">//<![CDATA[
47   -function remover(category, id, tag){
48   - var confirma = confirm("Tem certeza de que deseja remover a tag "+ tag +" da categoria " + category +"?");
49   - if(confirma ==true){
50   - window.location.href="index.pl?Action=AgentFAQTagOverview&Subaction=delete&id="+id;
51   - }else{
52   - }
53   -
  50 +function remover(CategoryName, TagID){
  51 + if(TagID){
  52 + var confirma = confirm("Tem certeza de que deseja remover a tag da categoria '" + CategoryName +"' ?");
  53 + if(confirma){
  54 + window.location.href = "index.pl?Action=AgentFAQTagOverview&Subaction=delete&TagID="+TagID;
  55 + }
  56 + }
54 57 }
55 58  
56 59 </script>
... ...