Commit ebfe8ced50ca620be240cc86702b85545990e259

Authored by Rodrigo Gonçalves
1 parent f54c5ada
Exists in master

Ajustes para OTRS 4.0.4

FAQTag.sopm
1 1 <?xml version="1.0" encoding="utf-8" ?>
2 2 <otrs_package version="1.0">
3 3 <Name>FAQTag</Name>
4   - <Version>1.1</Version>
  4 + <Version>1.2</Version>
5 5 <Vendor>SeTIC</Vendor>
6 6 <URL>http://setic.ufsc.br</URL>
7 7 <License>GNU GENERAL PUBLIC LICENSE Version 2, June 1991</License>
8   - <ChangeLog Date="2013-03-19 9:17:53" Version="1.0">Módulo criado.</ChangeLog>
9   - <Description Lang="pt_BR">Cadastro de tags para gerar links dinâmicos e reduzidos para as categorias da FAQ.</Description>
10   - <Framework>3.x.x</Framework>
11   - <IntroInstall Lang="pt_BR" Title="Instalado!" Type="post">Módulo de tags instalado.</IntroInstall>
  8 + <ChangeLog Date="2013-03-19 9:17:53" Version="1.0">First version</ChangeLog>
  9 + <ChangeLog Date="2013-03-19 9:17:53" Version="1.2">Adjustments for OTRS 4.0.4.</ChangeLog>
  10 + <Description>Tags for FAQ sections.</Description>
  11 + <Framework>4.0.x</Framework>
  12 + <IntroInstall Title="Installed!" Type="post">Módulo installed successfully.</IntroInstall>
12 13 <BuildDate>?</BuildDate>
13 14 <BuildHost>?</BuildHost>
14 15 <Filelist>
15 16 <File Location="Kernel/Modules/AgentFAQTagOverview.pm" Permission="644"/>
16   - <File Location="Kernel/Modules/AgentFAQTagAdd.pm" Permission="644"/>
17 17 <File Location="Kernel/Modules/RedirectFAQ.pm" Permission="644"/>
18 18 <File Location="Kernel/Modules/PublicRedirectFAQ.pm" Permission="644"/>
19   - <File Location="Kernel/Output/HTML/Standard/AgentFAQTagOverview.dtl" Permission="644"/>
20   - <File Location="Kernel/Output/HTML/Standard/AgentFAQTagAdd.dtl" Permission="644"/>
  19 + <File Location="Kernel/Output/HTML/Standard/AgentFAQTagOverview.tt" Permission="644"/>
  20 + <File Location="Kernel/Output/HTML/Standard/AgentFAQTagAdd.tt" Permission="644"/>
21 21 <File Location="Kernel/Config/Files/FAQTag.xml" Permission="644"/>
22 22 </Filelist>
23 23 <DatabaseInstall>
... ...
Kernel/Modules/AgentFAQTagAdd.pm
... ... @@ -1,124 +0,0 @@
1   -
2   -
3   -package Kernel::Modules::AgentFAQTagAdd;
4   -
5   -use strict;
6   -use warnings;
7   -use Data::Dumper;
8   -
9   -sub new {
10   - my ( $Type, %Param ) = @_;
11   -
12   - # allocate new hash for object
13   - my $Self = {%Param};
14   - bless ($Self, $Type);
15   -
16   - # check needed objects
17   - for (qw(ParamObject DBObject TicketObject LayoutObject LogObject QueueObject ConfigObject EncodeObject MainObject)) {
18   - if ( !$Self->{$_} ) {
19   - $Self->{LayoutObject}->FatalError( Message => "Got no $_!" );
20   - }
21   - }
22   - return $Self;
23   -}
24   -
25   -sub Run {
26   - my ( $Self, %Param ) = @_;
27   - my %Data = ();
28   -
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");
67   -
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;
78   -}
79   -
80   -# sub _GetTag {
81   -
82   -# my ( $Self, %Param ) = @_;
83   -
84   -
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;
93   -
94   -# }
95   -
96   -# sub _ExisteTag {
97   -
98   -# my ( $Self, %Param ) = @_;
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   -
116   - $Self->{DBObject}->Prepare(
117   - SQL => "select tag from faq_tag where tag = ?",
118   - Bind => [\$Param{Tag}]
119   - );
120   -
121   - return $Self->{DBObject}->FetchrowArray();
122   -}
123   -
124   -1;
Kernel/Modules/AgentFAQTagOverview.pm
1   -
  1 +# --
  2 +# Kernel/Modules/AgentFAQTagOverview.pm - frontend module editing FAQ tags
  3 +# Copyright (C) 2014 (Rodrigo Goncalves) (rodrigo.g@ufsc.br)
  4 +# --
  5 +#
  6 +# (C) 2014,2015 - SeTIC - UFSC - http://setic.ufsc.br/
  7 +#
  8 +# Version 29/01/2015 - RG - Adjustments for OTRS 4.0.4
  9 +#
  10 +# This software comes with ABSOLUTELY NO WARRANTY. For details, see
  11 +# the enclosed file COPYING for license information (AGPL). If you
  12 +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
  13 +# --
2 14 package Kernel::Modules::AgentFAQTagOverview;
3 15  
4 16 use strict;
5 17 require warnings;
6   -use Kernel::System::FAQ;
7   -use Kernel::System::Valid;
8   -use Data::Dumper;
9   -
10   -sub new {
11   - my ( $Type, %Param ) = @_;
12 18  
13   - # allocate new hash for object
14   - my $Self = {%Param};
15   - bless ($Self, $Type);
  19 +our @ObjectDependencies = (
  20 +"Kernel::System::Web::Request", # OLD ParamObject
  21 +"Kernel::Output::HTML::Layout",
  22 +"Kernel::System::FAQ",
  23 +"Kernel::System::FAQTag"
  24 +);
16 25  
17   - # check needed objects
18   - for (qw(ParamObject DBObject TicketObject LayoutObject LogObject QueueObject ConfigObject EncodeObject MainObject)) {
19   - if ( !$Self->{$_} ) {
20   - $Self->{LayoutObject}->FatalError( Message => "Got no $_!" );
21   - }
22   - }
  26 +sub new {
  27 + my ( $Type, %Param ) = @_;
23 28  
24   - $Self->{ValidObject} = Kernel::System::Valid->new(%Param);
25   - $Self->{FAQObject} = Kernel::System::FAQ->new(%Param);
  29 + # allocate new hash for object
  30 + my $Self = {%Param};
  31 + bless( $Self, $Type );
26 32  
27   - return $Self;
  33 + return $Self;
28 34 }
29 35  
30 36 sub Run {
31   - my ( $Self, %Param ) = @_;
32   - my %Data = ();
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;
124   - }
125   - elsif($SubAction eq "alterar"){
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 ) = @_;
178   -
179   - $Self->{DBObject}->Prepare(
180   - SQL => "select tag from faq_tag where tag = ?",
181   - Bind => [\$Param{Tag}]
182   - );
183   -
184   - if($Self->{DBObject}->FetchrowArray()){
185   - return 1;
186   - }
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   - }
199   - }
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   - }
215   - }
216   -
217   - $Self->{DBObject}->Do(
218   - SQL => "insert into faq_tag (category_id, tag) values (?,?)",
219   - Bind => [\$Param{CategoryID}, \$Param{Tag}]
220   - );
221   -}
222   -
223   -sub removeTag{
224   - my ( $Self, %Param ) = @_;
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   - );
  37 + my ( $Self, %Param ) = @_;
  38 + my %Data = ();
  39 +
  40 + my $paramObject = $Kernel::OM->Get("Kernel::System::Web::Request");
  41 + my $faqObject = $Kernel::OM->Get("Kernel::System::FAQ");
  42 + my $faqTagObject = $Kernel::OM->Get("Kernel::System::FAQTag");
  43 + my $layoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
  44 +
  45 + my $SubAction = $paramObject->GetParam( Param => 'Subaction' );
  46 +
  47 + if ( $SubAction eq "overview" ) {
  48 +
  49 + # get all categories with their long names
  50 + my $CategoryTree = $faqObject->CategoryTreeList(
  51 + Valid => 1,
  52 + UserID => $Self->{UserID},
  53 + );
  54 +
  55 + # get all categories tags
  56 + my $Tags = $faqTagObject->TagList();
  57 +
  58 + # if there are any categories, they are shown
  59 + if ( $CategoryTree && ref $CategoryTree eq 'HASH' && %{$CategoryTree} ) {
  60 +
  61 + my @CategoryIDsSorted = sort { $CategoryTree->{$a} cmp $CategoryTree->{$b} } keys %{$CategoryTree};
  62 +
  63 + # show all categories
  64 + for my $CategoryID (@CategoryIDsSorted) {
  65 +
  66 + # get category data
  67 + my %CategoryData = ();
  68 +
  69 + # overwrite the name with the long name
  70 + $CategoryData{Name} = $CategoryTree->{$CategoryID};
  71 + $CategoryData{Tag} = $Tags->{$CategoryID};
  72 + $CategoryData{CategoryID} = $CategoryID;
  73 +
  74 + if ($CategoryData{Tag}) {
  75 + $CategoryData{ShowDelete} = "visibility: visible"
  76 + } else {
  77 + $CategoryData{ShowDelete} = "visibility: hidden"
  78 + }
  79 +
  80 + # output the category data
  81 + $layoutObject->Block(
  82 + Name => 'OverviewResultRow',
  83 + Data => {%CategoryData},
  84 + );
  85 + }
  86 + }
  87 +
  88 + my $Output = $layoutObject->Header( Title => "Tags Overview" );
  89 + $Output .= $layoutObject->NavigationBar();
  90 + $Output .= $layoutObject->Output(
  91 + Data => \%Data,
  92 + TemplateFile => 'AgentFAQTagOverview',
  93 + );
  94 + $Output .= $layoutObject->Footer();
  95 + return $Output;
  96 + }
  97 + elsif ( $SubAction eq "CreateUpdate" ) {
  98 + my $CategoryID = $paramObject->GetParam( Param => "CategoryID" );
  99 +
  100 + # get all categories with their long names
  101 + my $CategoryTree = $faqObject->CategoryTreeList(
  102 + Valid => 1,
  103 + UserID => $Self->{UserID},
  104 + );
  105 +
  106 + # get all categories tags
  107 + my $Tags = $faqTagObject->TagList();
  108 +
  109 + $Data{Tag} = $Tags->{$CategoryID};
  110 + $Data{CategoryID} = $CategoryID;
  111 + $Data{CategoryName} = $CategoryTree->{$CategoryID};
  112 +
  113 + my $Output = $layoutObject->Header( Title => "Definir tag da categoria da FAQ" );
  114 + $Output .= $layoutObject->NavigationBar();
  115 + $Output .= $layoutObject->Output(
  116 + Data => \%Data,
  117 + TemplateFile => 'AgentFAQTagAdd',
  118 + );
  119 + $Output .= $layoutObject->Footer();
  120 + return $Output;
  121 + }
  122 + elsif ( $SubAction eq "AddUpdate" ) {
  123 + my $CategoryID = $paramObject->GetParam( Param => "CategoryID" );
  124 + my $Tag = $paramObject->GetParam( Param => "Tag" );
  125 +
  126 + if ( !$faqTagObject->AddUpdate( CategoryID => $CategoryID, Tag => $Tag ) ) {
  127 + $Data{MensagemErro} = "Tag já existente";
  128 + $Data{Tag} = $Tag;
  129 + $Data{CategoryID} = $CategoryID;
  130 +
  131 + my $Output = $layoutObject->Header( Title => "Definir tag da categoria da FAQ" );
  132 + $Output .= $layoutObject->NavigationBar();
  133 + $Output .= $layoutObject->Output(
  134 + Data => \%Data,
  135 + TemplateFile => 'AgentFAQTagAdd',
  136 + );
  137 + $Output .= $layoutObject->Footer();
  138 + return $Output;
  139 + }
  140 + else {
  141 + return $layoutObject->Redirect( OP => 'Action=AgentFAQTagOverview&Subaction=overview' )
  142 + ;
  143 + }
  144 + }
  145 + elsif ( $SubAction eq "delete" ) {
  146 + $faqTagObject->DeleteTag(CategoryID => $paramObject->GetParam( Param => "CategoryID" ) );
  147 + return $layoutObject->Redirect( OP => 'Action=AgentFAQTagOverview&Subaction=overview' );
  148 + }
237 149 }
238 150  
239 151 1;
... ...
Kernel/Modules/PublicRedirectFAQ.pm
1   -
  1 +# --
  2 +# Kernel/Modules/PublicRedirectFAQ.pm - module to redirect FAQ
  3 +#
  4 +# Copyright (C) 2014 (Rodrigo Goncalves) (rodrigo.g@ufsc.br)
  5 +# --
  6 +#
  7 +# (C) 2014,2015 - SeTIC - UFSC - http://setic.ufsc.br/
  8 +#
  9 +# Version 29/01/2015 - RG - Adjustments for OTRS 4.0.4
  10 +#
  11 +# This software comes with ABSOLUTELY NO WARRANTY. For details, see
  12 +# the enclosed file COPYING for license information (AGPL). If you
  13 +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
  14 +# --
2 15 package Kernel::Modules::PublicRedirectFAQ;
3 16  
4 17 use strict;
5 18 use warnings;
6 19  
  20 +our @ObjectDependencies = (
  21 +"Kernel::System::Web::Request", # OLD ParamObject
  22 +"Kernel::Output::HTML::Layout",
  23 +"Kernel::System::DB");
  24 +
7 25 sub new {
8 26 my ( $Type, %Param ) = @_;
9 27  
... ... @@ -11,30 +29,27 @@ sub new {
11 29 my $Self = {%Param};
12 30 bless ($Self, $Type);
13 31  
14   - # check needed objects
15   - for (qw(ParamObject DBObject LayoutObject LogObject ConfigObject EncodeObject MainObject)) {
16   - if ( !$Self->{$_} ) {
17   - $Self->{LayoutObject}->FatalError( Message => "Got no $_!" );
18   - }
19   - }
20 32 return $Self;
21 33 }
22 34  
23 35 sub Run {
24 36 my ( $Self, %Param ) = @_;
25 37 my %Data = ();
  38 +
  39 + my $paramObject = $Kernel::OM->Get("Kernel::System::Web::Request");
  40 + my $layoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
26 41  
27   - my $Tag = $Self->{ParamObject}->GetParam( Param => 'id' );
  42 + my $Tag = $paramObject->GetParam( Param => 'id' );
28 43 if(!$Tag){
29   - $Self->{LayoutObject}->FatalError( Message => "Especifique a tag" );
  44 + $layoutObject->FatalError( Message => "Especifique a tag" );
30 45 }
31 46  
32 47 my $Id = $Self->_GetCategoryID(tag => "$Tag");
33 48 if(!$Id){
34   - $Self->{LayoutObject}->FatalError( Message => "A tag $Tag n\x{e3}o existe!" );
  49 + $layoutObject->FatalError( Message => "A tag $Tag n\x{e3}o existe!" );
35 50 }
36 51  
37   - return $Self->{LayoutObject}->Redirect( ExtURL => 'public.pl?Action=PublicFAQExplorer;CategoryID='.$Id, );
  52 + return $layoutObject->Redirect( ExtURL => 'public.pl?Action=PublicFAQExplorer;CategoryID='.$Id, );
38 53  
39 54 }
40 55  
... ... @@ -42,12 +57,13 @@ sub _GetCategoryID {
42 57  
43 58 my ( $Self, %Param ) = @_;
44 59  
  60 + my $dbObject = $Kernel::OM->Get("Kernel::System::DB");
45 61  
46   - $Self->{DBObject}->Prepare(
  62 + $dbObject->Prepare(
47 63 SQL => "select category_id from faq_tag where tag = '$Param{tag}'",
48 64 );
49 65 my $ID;
50   - while (my @Row = $Self->{DBObject}->FetchrowArray()) {
  66 + while (my @Row = $dbObject->FetchrowArray()) {
51 67 $ID = $Row[0];
52 68 }
53 69 return $ID;
... ...
Kernel/Modules/RedirectFAQ.pm
1   -
  1 +# --
  2 +# Kernel/Modules/PublicRedirectFAQ.pm - module to redirect FAQ
  3 +#
  4 +# Copyright (C) 2014 (Rodrigo Goncalves) (rodrigo.g@ufsc.br)
  5 +# --
  6 +#
  7 +# (C) 2014,2015 - SeTIC - UFSC - http://setic.ufsc.br/
  8 +#
  9 +# Version 29/01/2015 - RG - Adjustments for OTRS 4.0.4
  10 +#
  11 +# This software comes with ABSOLUTELY NO WARRANTY. For details, see
  12 +# the enclosed file COPYING for license information (AGPL). If you
  13 +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
  14 +# --
2 15 package Kernel::Modules::RedirectFAQ;
3 16  
4 17 use strict;
5 18 use warnings;
6 19  
  20 +our @ObjectDependencies = (
  21 +"Kernel::System::Web::Request", # OLD ParamObject
  22 +"Kernel::Output::HTML::Layout",
  23 +"Kernel::System::DB");
  24 +
  25 +
7 26 sub new {
8 27 my ( $Type, %Param ) = @_;
9 28  
... ... @@ -11,30 +30,27 @@ sub new {
11 30 my $Self = {%Param};
12 31 bless ($Self, $Type);
13 32  
14   - # check needed objects
15   - for (qw(ParamObject DBObject TicketObject LayoutObject LogObject QueueObject ConfigObject EncodeObject MainObject)) {
16   - if ( !$Self->{$_} ) {
17   - $Self->{LayoutObject}->FatalError( Message => "Got no $_!" );
18   - }
19   - }
20 33 return $Self;
21 34 }
22 35  
23 36 sub Run {
24 37 my ( $Self, %Param ) = @_;
25 38 my %Data = ();
  39 +
  40 + my $paramObject = $Kernel::OM->Get("Kernel::System::Web::Request");
  41 + my $layoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
26 42  
27   - my $Tag = $Self->{ParamObject}->GetParam( Param => 'id' );
  43 + my $Tag = $paramObject->GetParam( Param => 'id' );
28 44 if(!$Tag){
29   - $Self->{LayoutObject}->FatalError( Message => "Especifique a tag" );
  45 + $layoutObject->FatalError( Message => "Especifique a tag" );
30 46 }
31 47  
32 48 my $Id = $Self->_GetCategoryID(tag => "$Tag");
33 49 if(!$Id){
34   - $Self->{LayoutObject}->FatalError( Message => "A tag $Tag n\x{e3}o existe!" );
  50 + $layoutObject->FatalError( Message => "A tag $Tag n\x{e3}o existe!" );
35 51 }
36 52  
37   - return $Self->{LayoutObject}->Redirect( OP => 'Action=AgentFAQExplorer;CategoryID='.$Id, );
  53 + return $layoutObject->Redirect( OP => 'Action=AgentFAQExplorer;CategoryID='.$Id, );
38 54  
39 55 }
40 56  
... ... @@ -42,12 +58,13 @@ sub _GetCategoryID {
42 58  
43 59 my ( $Self, %Param ) = @_;
44 60  
  61 + my $dbObject = $Kernel::OM->Get("Kernel::System::DB");
45 62  
46   - $Self->{DBObject}->Prepare(
  63 + $dbObject->Prepare(
47 64 SQL => "select category_id from faq_tag where tag = '$Param{tag}'",
48 65 );
49 66 my $ID;
50   - while (my @Row = $Self->{DBObject}->FetchrowArray()) {
  67 + while (my @Row = $dbObject->FetchrowArray()) {
51 68 $ID = $Row[0];
52 69 }
53 70 return $ID;
... ...
Kernel/Output/HTML/Standard/AgentFAQTagAdd.dtl
... ... @@ -1,72 +0,0 @@
1   -<style type="text/css">
2   - fieldset {
3   - background: none;
4   - border: none;
5   - }
6   -</style>
7   -
8   -<div class="Content">
9   - <form name="input" action="$Env{"CGIHandle"}" method="post">
10   - <input type="hidden" name="Action" value="$Env{"Action"}" />
11   - <input type="hidden" name="Subaction" value="alterar" />
12   - <div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst">
13   - <h1>$Text{"Gerenciamento de Tags"}</h1>
14   - <div class="SidebarColumn">
15   - <div class="WidgetSimple">
16   - <div class="Header">
17   - <h2>$Text{"Actions"}</h2>
18   - </div>
19   - <div class="Content">
20   - <ul class="ActionList">
21   - <li>
22   - <a href="$Env{"Baselink"}Action=AgentFAQTagOverview&Subaction=overview" class="CallForAction"><span>$Text{"Go to overview"}</span></a>
23   - </li>
24   - </ul>
25   - </div>
26   - </div>
27   - </div>
28   - <div class="ContentColumn">
29   - <div class="WidgetSimple">
30   - <div class="Header">
31   - <h2>Editar Tag: $QData{"CategoryName"}</h2>
32   - </div>
33   - <div class="Content SpacingBottom">
34   - <fieldset class="TableLike">
35   -
36   - <label class="Mandatory" for="tag" ><span class="Marker">*</span> Tag:</label>
37   - <div class="Field">
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"}"/>
42   - </div>
43   - $QData{"MensagemErro"}
44   - <div class="Clear"></div>
45   - <div class="Field SpacingTop">
46   - <button class="Primary" type="submit" id="cadastrar" value="Cadastrar">$Text{"Submit"}</button>
47   - $Text{"or"}
48   - <a href="/otrs/index.pl?Action=AgentFAQTagOverview">Cancelar</a>
49   - </div>
50   - <div class="Clear"></div>
51   -
52   - </fieldset>
53   - </div>
54   - </div>
55   - </div>
56   - </div>
57   - </form>
58   -</div>
59   -
60   -<script language="javascript">
61   -// Torna os campos obrigatórios
62   -function valida_dados (nomeform) {
63   - if (nomeform.tag.value=="") {
64   - alert ("Por favor digite o nome para a tag.");
65   - return false;
66   - } else {
67   - return true;
68   - }
69   -}
70   -
71   -</script>
72   -
Kernel/Output/HTML/Standard/AgentFAQTagAdd.tt 0 → 100644
... ... @@ -0,0 +1,71 @@
  1 +<style type="text/css">
  2 + fieldset {
  3 + background: none;
  4 + border: none;
  5 + }
  6 +</style>
  7 +
  8 +<div class="Content">
  9 + <form name="input" action="[% Env("CGIHandle") %]" method="post">
  10 + <input type="hidden" name="Action" value="[% Env("Action") %]" />
  11 + <input type="hidden" name="Subaction" value="AddUpdate" />
  12 + <div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst">
  13 + <h1>[% Translate("Gerenciamento de Tags") | html %]</h1>
  14 + <div class="SidebarColumn">
  15 + <div class="WidgetSimple">
  16 + <div class="Header">
  17 + <h2>[% Translate("Actions") | html %]</h2>
  18 + </div>
  19 + <div class="Content">
  20 + <ul class="ActionList">
  21 + <li>
  22 + <a href="[% Env("Baselink") %]Action=AgentFAQTagOverview&Subaction=overview" class="CallForAction"><span>[% Translate("Go to overview") | html %]</span></a>
  23 + </li>
  24 + </ul>
  25 + </div>
  26 + </div>
  27 + </div>
  28 + <div class="ContentColumn">
  29 + <div class="WidgetSimple">
  30 + <div class="Header">
  31 + <h2>Editar Tag: [% Data.CategoryName | html %]</h2>
  32 + </div>
  33 + <div class="Content SpacingBottom">
  34 + <fieldset class="TableLike">
  35 +
  36 + <label class="Mandatory" for="tag" ><span class="Marker">*</span> Tag:</label>
  37 + <div class="Field">
  38 + <input type="hidden" id="CategoryID" name="CategoryID" value="[% Data.CategoryID | html %]"/>
  39 + <input type="hidden" id="Update" name="Update" value="[% Data.Update | html %]"/>
  40 + <input type="text" id="Tag" name="Tag" class="W50pc Validate_Required " length="15" value="[% Data.Tag | html %]"/>
  41 + </div>
  42 + [% Data.MensagemErro | html %]
  43 + <div class="Clear"></div>
  44 + <div class="Field SpacingTop">
  45 + <button class="Primary" type="submit" id="cadastrar" value="Cadastrar">[% Translate("Submit") | html %]</button>
  46 + [% Translate("or") | html %]
  47 + <a href="/otrs/index.pl?Action=AgentFAQTagOverview">Cancelar</a>
  48 + </div>
  49 + <div class="Clear"></div>
  50 +
  51 + </fieldset>
  52 + </div>
  53 + </div>
  54 + </div>
  55 + </div>
  56 + </form>
  57 +</div>
  58 +
  59 +<script language="javascript">
  60 +// Torna os campos obrigatórios
  61 +function valida_dados (nomeform) {
  62 + if (nomeform.tag.value=="") {
  63 + alert ("Por favor digite o nome para a tag.");
  64 + return false;
  65 + } else {
  66 + return true;
  67 + }
  68 +}
  69 +
  70 +</script>
  71 +
... ...
Kernel/Output/HTML/Standard/AgentFAQTagOverview.dtl
... ... @@ -1,59 +0,0 @@
1   -
2   -<div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst">
3   - <h1>$Text{"Gerenciamento de Tags"}</h1>
4   - <div class="SidebarColumn">
5   - <div class="WidgetSimple">
6   - <div class="Header">
7   - <h2>$Text{"Hint"}</h2>
8   - </div>
9   - <div class="Content">
10   - <p class="FieldExplanation">Tabela de todas as categorias da FAQ com suas respectivas tags.</p>
11   - <p class="FieldExplanation">Adicione uma tag para gerar um endere&ccedil;o mais simples a determinada categoria.</p>
12   - </div>
13   - </div>
14   - </div>
15   - <div class="ContentColumn">
16   - <div class="WidgetSimple">
17   - <div class="Header">
18   - <h2>Lista</h2>
19   - </div>
20   - <div class="Content SpacingBottom">
21   - <table class="DataTable SpacingTop">
22   - <thead>
23   - <tr>
24   - <th><center>Categoria</center></th>
25   - <th><center>Tag</center></th>
26   - <th><center>Opções</center></th>
27   - </tr>
28   - </thead>
29   - <tbody>
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>
40   - </tr>
41   -<!-- dtl:block:OverviewResultRow -->
42   - </tbody>
43   - </table>
44   - </div>
45   - </div>
46   - </div>
47   -</div>
48   -
49   -<script type="text/javascript" charset="utf-8">//<![CDATA[
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   - }
57   -}
58   -
59   -</script>
Kernel/Output/HTML/Standard/AgentFAQTagOverview.tt 0 → 100644
... ... @@ -0,0 +1,61 @@
  1 +
  2 +<div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst">
  3 + <h1>[% Translate("Gerenciamento de Tags") | html %]</h1>
  4 + <div class="SidebarColumn">
  5 + <div class="WidgetSimple">
  6 + <div class="Header">
  7 + <h2>[% Translate("Hint") | html %]</h2>
  8 + </div>
  9 + <div class="Content">
  10 + <p class="FieldExplanation">Tabela de todas as categorias da FAQ com suas respectivas tags.</p>
  11 + <p class="FieldExplanation">Adicione uma tag para gerar um endere&ccedil;o mais simples a determinada categoria.</p>
  12 + </div>
  13 + </div>
  14 + </div>
  15 + <div class="ContentColumn">
  16 + <div class="WidgetSimple">
  17 + <div class="Header">
  18 + <h2>Lista</h2>
  19 + </div>
  20 + <div class="Content SpacingBottom">
  21 + <table class="DataTable SpacingTop">
  22 + <thead>
  23 + <tr>
  24 + <th><center>Categoria</center></th>
  25 + <th><center>Tag</center></th>
  26 + <th><center>Opções</center></th>
  27 + </tr>
  28 + </thead>
  29 + <tbody>
  30 +[% RenderBlockStart("OverviewResultRow") %]
  31 + <tr>
  32 + <td>[% Data.Name | html %]</td>
  33 + <td><center>[% Data.Tag | html %]</center></td>
  34 + <td>
  35 + <center>
  36 + <a style="[% Data.ShowDelete | html %]" class="TrashCan" onClick="remover('[% Data.Name | html %]','[% Data.CategoryID | html %]')">
  37 + <i class="fa fa-trash-o"></i>
  38 + </a>
  39 + <a href='[% Env("Baselink") %]Action=AgentFAQTagOverview&Subaction=CreateUpdate&CategoryID=[% Data.CategoryID | html %]' class="CallForAction"><span>[% Translate("Alterar Tag") | html %]</span></a>
  40 + </center>
  41 + </td>
  42 + </tr>
  43 +[% RenderBlockEnd("OverviewResultRow") %]
  44 + </tbody>
  45 + </table>
  46 + </div>
  47 + </div>
  48 + </div>
  49 +</div>
  50 +
  51 +<script type="text/javascript" charset="utf-8">//<![CDATA[
  52 +function remover(CategoryName, CategoryID){
  53 + if(CategoryID){
  54 + var confirma = confirm("Tem certeza de que deseja remover a tag da categoria '" + CategoryName +"' ?");
  55 + if(confirma){
  56 + window.location.href = "index.pl?Action=AgentFAQTagOverview&Subaction=delete&CategoryID="+CategoryID;
  57 + }
  58 + }
  59 +}
  60 +
  61 +</script>
... ...
Kernel/System/FAQTag.pm 0 → 100644
... ... @@ -0,0 +1,256 @@
  1 +# --
  2 +# Kernel/System/FAQTag.pm - core module
  3 +# Manages Tags for FAQ categories
  4 +#
  5 +# Copyright (C) (2014) (Rodrigo Gonçalves) (rodrigo.g@ufsc.br)
  6 +# --
  7 +# $Id: writing-otrs-application.xml,v 1.1 2010/08/13 08:59:28 mg Exp $
  8 +# --
  9 +#
  10 +# Version 29/01/2015 - RG - Adjustments for OTRS 4.0.4
  11 +#
  12 +# This software comes with ABSOLUTELY NO WARRANTY. For details, see
  13 +# the enclosed file COPYING for license information (AGPL). If you
  14 +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
  15 +# --
  16 +# Author: Carlos Rebelato
  17 +# Date..: 09/07/2014 - Versão inicial
  18 +# Date..: 04/08/2014 - Inclusão de papéis
  19 +# Revision:
  20 +#
  21 +package Kernel::System::FAQTag;
  22 +
  23 +use strict;
  24 +use warnings;
  25 +use Data::Dumper;
  26 +
  27 +our @ObjectDependencies = (
  28 +"Kernel::System::Web::Request", # OLD ParamObject
  29 +"Kernel::Output::HTML::Layout",
  30 +"Kernel::System::DB");
  31 +
  32 +
  33 +sub new {
  34 + my ( $Type, %Param ) = @_;
  35 +
  36 + # allocate new hash for object
  37 + my $Self = {%Param};
  38 + bless( $Self, $Type );
  39 +
  40 + if (! $Self->{TableName}) {
  41 + $Self->{TableName} = "faq_tag";
  42 + }
  43 +
  44 + return $Self;
  45 +}
  46 +
  47 +=item AddUpdate()
  48 +
  49 +Adds/updates a category Tag
  50 +
  51 + my $True = $FAQTagObject->FAQTagAddUpdate(
  52 + CategoryID => Category ID,
  53 + Tag => Tag to associate/update
  54 + );
  55 +
  56 +=cut
  57 +sub AddUpdate {
  58 +
  59 + my ( $Self, %Param ) = @_;
  60 +
  61 + for (qw(CategoryID Tag)) {
  62 + if ( !$Param{$_} ) {
  63 + $Kernel::OM->Get("Kernel::Output::HTML::Layout")->FatalError( Message => Dumper( \%Param ) . "got no $_!" );
  64 + return 0;
  65 + }
  66 + }
  67 +
  68 + if ($Self->DuplicatedTag(%Param)) {
  69 + return 0;
  70 + } else {
  71 +
  72 + if ($Self->HasTag(CategoryID => $Param{CategoryID})) {
  73 + return $Self->UpdateTag(%Param);
  74 + } else {
  75 + return $Self->AddTag(%Param);
  76 + }
  77 + }
  78 +
  79 +}
  80 +
  81 +=item HasTag()
  82 +
  83 +Checks if category already has a class
  84 +
  85 + my $True = $FAQTagObject->HasTag(
  86 + CategoryID => Category ID,
  87 + );
  88 +
  89 +=cut
  90 +sub HasTag {
  91 +
  92 + my ( $Self, %Param ) = @_;
  93 +
  94 + for (qw(CategoryID)) {
  95 + if ( !$Param{$_} ) {
  96 + $Kernel::OM->Get("Kernel::Output::HTML::Layout")->FatalError( Message => Dumper( \%Param ) . "got no $_!" );
  97 + return 0;
  98 + }
  99 + }
  100 +
  101 + $Kernel::OM->Get("Kernel::System::DB")->Prepare(
  102 + SQL => "SELECT id FROM " . $Self->{TableName} . " WHERE category_id = ?",
  103 + Bind => [ \$Param{CategoryID} ],
  104 + Limit => 1,
  105 + );
  106 +
  107 + # Returns true if another category has the same tag
  108 + return $Kernel::OM->Get("Kernel::System::DB")->FetchrowArray();
  109 +}
  110 +
  111 +
  112 +=item UpdateTag()
  113 +
  114 +Updates a category Tag
  115 +
  116 + my $True = $FAQTagObject->UpdateTag(
  117 + CategoryID => Category ID,
  118 + Tag => Tag to associate
  119 + );
  120 +
  121 +=cut
  122 +sub UpdateTag {
  123 +
  124 + my ( $Self, %Param ) = @_;
  125 +
  126 + for (qw(CategoryID Tag)) {
  127 + if ( !$Param{$_} ) {
  128 + $Kernel::OM->Get("Kernel::Output::HTML::Layout")->FatalError( Message => Dumper( \%Param ) . "got no $_!" );
  129 + return 0;
  130 + }
  131 + }
  132 +
  133 + $Kernel::OM->Get("Kernel::System::DB")->Do(
  134 + SQL => "UPDATE " . $Self->{TableName} . " SET tag=? WHERE category_id=?",
  135 + Bind => [ \$Param{Tag}, \$Param{CategoryID} ]
  136 + );
  137 +
  138 +}
  139 +
  140 +=item AddTag()
  141 +
  142 +Adds a category Tag
  143 +
  144 + my $True = $FAQTagObject->AddTag(
  145 + CategoryID => Category ID,
  146 + Tag => Tag to associate
  147 + );
  148 +
  149 +=cut
  150 +sub AddTag {
  151 +
  152 + my ( $Self, %Param ) = @_;
  153 +
  154 + for (qw(CategoryID Tag)) {
  155 + if ( !$Param{$_} ) {
  156 + $Kernel::OM->Get("Kernel::Output::HTML::Layout")->FatalError( Message => Dumper( \%Param ) . "got no $_!" );
  157 + return 0;
  158 + }
  159 + }
  160 +
  161 + $Kernel::OM->Get("Kernel::System::DB")->Do(
  162 + SQL => "INSERT INTO " . $Self->{TableName} . " (tag,category_id) VALUES (?,?)",
  163 + Bind => [ \$Param{Tag}, \$Param{CategoryID} ]
  164 + );
  165 +
  166 +}
  167 +
  168 +=item DeleteTag()
  169 +
  170 +Deletes a category Tag
  171 +
  172 + my $True = $FAQTagObject->DeleteTag(
  173 + CategoryID => Category ID
  174 + );
  175 +
  176 +=cut
  177 +sub DeleteTag {
  178 +
  179 + my ( $Self, %Param ) = @_;
  180 +
  181 + for (qw(CategoryID)) {
  182 + if ( !$Param{$_} ) {
  183 + $Kernel::OM->Get("Kernel::Output::HTML::Layout")->FatalError( Message => Dumper( \%Param ) . "got no $_!" );
  184 + return 0;
  185 + }
  186 + }
  187 +
  188 + $Kernel::OM->Get("Kernel::System::DB")->Do(
  189 + SQL => "DELETE FROM " . $Self->{TableName} . " WHERE category_id=?",
  190 + Bind => [ \$Param{CategoryID} ]
  191 + );
  192 +
  193 +}
  194 +
  195 +=item DuplicatedTag()
  196 +
  197 +Checks if another category has the given tag
  198 +
  199 + my $True = $FAQTagObject->DuplicatedTag(
  200 + CategoryID => Category ID,
  201 + Tag => Tag to associate/update
  202 + );
  203 +
  204 +=cut
  205 +sub DuplicatedTag {
  206 +
  207 + my ( $Self, %Param ) = @_;
  208 +
  209 + for (qw(CategoryID Tag)) {
  210 + if ( !$Param{$_} ) {
  211 + $Kernel::OM->Get("Kernel::Output::HTML::Layout")->FatalError( Message => Dumper( \%Param ) . "got no $_!" );
  212 + return 0;
  213 + }
  214 + }
  215 +
  216 + $Kernel::OM->Get("Kernel::System::DB")->Prepare(
  217 + SQL => "SELECT id FROM " . $Self->{TableName} . " WHERE tag = ? AND category_id <> ?",
  218 + Bind => [ \$Param{Tag}, \$Param{CategoryID} ],
  219 + Limit => 1,
  220 + );
  221 +
  222 + # Returns true if another category has the same tag
  223 + return $Kernel::OM->Get("Kernel::System::DB")->FetchrowArray();
  224 +
  225 +}
  226 +
  227 +=item TagList()
  228 +
  229 +Get list of tags, in a map associated by category ID
  230 +
  231 + my %{key category_id}{tag} = $FAQTagObject->GetTagList();
  232 +
  233 +=cut
  234 +sub TagList {
  235 + my ( $Self, %Param ) = @_;
  236 + my %result = ();
  237 +
  238 + $Kernel::OM->Get("Kernel::System::DB")->Prepare(
  239 + SQL => "
  240 + select
  241 + a.category_id category_id,
  242 + a.tag tag
  243 + from
  244 + " . $Self->{TableName} . " a
  245 + order by
  246 + a.category_id asc",
  247 + );
  248 +
  249 + while ( my @row = $Kernel::OM->Get("Kernel::System::DB")->FetchrowArray() ) {
  250 + $result{ $row[0] } = $row[1];
  251 + }
  252 +
  253 + return \%result;
  254 +}
  255 +
  256 +1;
... ...