Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FAQ.xml #24

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Editor swap files
*.swn
*.swp
*.swo
*~

# TidyAll used for the hook .git/hooks/pre-commit
TidyAll
2 changes: 0 additions & 2 deletions FAQ.sopm
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@
$Kernel::OM->Get($CodeModule)->CodeReinstall();
</CodeReinstall>
<Filelist>
<File Location="bin/cgi-bin/faq.pl" Permission="644" />
<File Location="bin/fcgi-bin/faq.fpl" Permission="644" />
<File Location="doc/faq-database.png" Permission="644" />
<File Location="Kernel/Config/Files/XML/FAQ.xml" Permission="644" />
<File Location="Kernel/cpan-lib/XML/RSS/SimpleGen.pm" Permission="644" />
Expand Down
12 changes: 6 additions & 6 deletions Kernel/Config/Files/XML/FAQ.xml
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ Your OTOBO Notification Master
</Value>
</Setting>
<Setting Name="FAQ::Item::Field1" Required="1" Valid="1">
<Description Translatable="1">Definition of FAQ item free text field.</Description>
<Description Translatable="1">Definition of FAQ item free text field. Possible values for 'Show' are e.g. an empty string, 'public' and 'internal'.</Description>
<Navigation>Core::FAQ::Item</Navigation>
<Value>
<Hash>
Expand All @@ -283,7 +283,7 @@ Your OTOBO Notification Master
</Value>
</Setting>
<Setting Name="FAQ::Item::Field2" Required="1" Valid="1">
<Description Translatable="1">Definition of FAQ item free text field.</Description>
<Description Translatable="1">Definition of FAQ item free text field. Possible values for 'Show' are e.g. an empty string, 'public' and 'internal'.</Description>
<Navigation>Core::FAQ::Item</Navigation>
<Value>
<Hash>
Expand All @@ -294,7 +294,7 @@ Your OTOBO Notification Master
</Value>
</Setting>
<Setting Name="FAQ::Item::Field3" Required="1" Valid="1">
<Description Translatable="1">Definition of FAQ item free text field.</Description>
<Description Translatable="1">Definition of FAQ item free text field. Possible values for 'Show' are e.g. an empty string, 'public' and 'internal'.</Description>
<Navigation>Core::FAQ::Item</Navigation>
<Value>
<Hash>
Expand All @@ -305,7 +305,7 @@ Your OTOBO Notification Master
</Value>
</Setting>
<Setting Name="FAQ::Item::Field4" Required="1" Valid="1">
<Description Translatable="1">Definition of FAQ item free text field.</Description>
<Description Translatable="1">Definition of FAQ item free text field. Possible values for 'Show' are e.g. an empty string, 'public' and 'internal'.</Description>
<Navigation>Core::FAQ::Item</Navigation>
<Value>
<Hash>
Expand All @@ -316,7 +316,7 @@ Your OTOBO Notification Master
</Value>
</Setting>
<Setting Name="FAQ::Item::Field5" Required="1" Valid="1">
<Description Translatable="1">Definition of FAQ item free text field.</Description>
<Description Translatable="1">Definition of FAQ item free text field. Possible values for 'Show' are e.g. an empty string, 'public' and 'internal'.</Description>
<Navigation>Core::FAQ::Item</Navigation>
<Value>
<Hash>
Expand All @@ -327,7 +327,7 @@ Your OTOBO Notification Master
</Value>
</Setting>
<Setting Name="FAQ::Item::Field6" Required="1" Valid="1">
<Description Translatable="1">Definition of FAQ item free text field.</Description>
<Description Translatable="1">Definition of FAQ item free text field. Possible values for 'Show' are e.g. an empty string, 'public' and 'internal'.</Description>
<Navigation>Core::FAQ::Item</Navigation>
<Value>
<Hash>
Expand Down
68 changes: 41 additions & 27 deletions Kernel/Modules/CustomerFAQExplorer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# OTOBO is a web-based ticketing system for service organisations.
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# Copyright (C) 2019-2020 Rother OSS GmbH, https://otobo.de/
# Copyright (C) 2019-2022 Rother OSS GmbH, https://otobo.de/
# --
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
Expand All @@ -16,8 +16,15 @@

package Kernel::Modules::CustomerFAQExplorer;

use v5.24;
use strict;
use warnings;

# core modules

# CPAN modules

# OTOBO modules
use Kernel::Language qw(Translatable);

our $ObjectManagerDisabled = 1;
Expand All @@ -26,10 +33,7 @@ sub new {
my ( $Type, %Param ) = @_;

# allocate new hash for object
my $Self = {%Param};
bless( $Self, $Type );

return $Self;
return bless {%Param}, $Type;
}

sub Run {
Expand All @@ -44,7 +48,7 @@ sub Run {

# get config data
my $StartHit = int( $ParamObject->GetParam( Param => 'StartHit' ) || 1 );
my $SearchLimit = $Config->{SearchLimit} || 200;
my $SearchLimit = $Config->{SearchLimit} || 200;
my $SearchPageShown = $Config->{SearchPageShown} || 3;
my $SortBy = $ParamObject->GetParam( Param => 'SortBy' )
|| $Config->{'SortBy::Default'}
Expand Down Expand Up @@ -121,7 +125,7 @@ sub Run {
);

# AddJSData for ES
my $ESActive = $ConfigObject->Get( 'Elasticsearch::Active' );
my $ESActive = $ConfigObject->Get('Elasticsearch::Active');

$LayoutObject->AddJSData(
Key => 'ESActive',
Expand All @@ -136,14 +140,14 @@ sub Run {

# show search results
if ( $Self->{Subaction} && $Self->{Subaction} eq 'Search' ) {
my $SearchName = Translatable("Search").":";
for my $Mode ( qw/Keyword What/ ) {
my $SearchName = Translatable("Search") . ":";
for my $Mode (qw/Keyword What/) {
my $String = $ParamObject->GetParam( Param => $Mode );
if ( $String ) {
$Search{ $Mode } = $String;
$FAQSearch{ $Mode } = "*$String*";
if ($String) {
$Search{$Mode} = $String;
$FAQSearch{$Mode} = "*$String*";
my $ModeName = $Mode eq 'What' ? 'Fulltext' : $Mode;
$SearchName .= " ".Translatable($ModeName)." \"$String\";";
$SearchName .= " " . Translatable($ModeName) . " \"$String\";";
}
}

Expand All @@ -155,11 +159,12 @@ sub Run {
CategoryID => 0,
},
);

# output search information
$LayoutObject->Block(
Name => 'FAQPathCategoryElementNoLink',
Data => {
Name => $SearchName,
Name => $SearchName,
},
);

Expand All @@ -168,7 +173,7 @@ sub Run {
}

# no search ( standard mode )
else {
else {
# show FAQ path
$LayoutObject->FAQPathShow(
FAQObject => $FAQObject,
Expand Down Expand Up @@ -241,15 +246,24 @@ sub Run {
UserID => $Self->{UserID},
);

# include Category if not in base Category (0), or search mode
# use given category, or limit to the categories that are available for the customer
if ( $CategoryID > 0 ) {
$FAQSearch{CategoryIDs} = [$CategoryID],
$FAQSearch{CategoryIDs} = [$CategoryID];
}
else {
# Need GetSubCategories => 1, so cannot use $CategoryIDsRef
$FAQSearch{CategoryIDs} = $FAQObject->CustomerCategorySearch(
CustomerUser => $Self->{UserLogin},
GetSubCategories => 1,
Mode => 'Customer',
UserID => $Self->{UserID},
);
}

# get the latest articles for the root category (else empty)
elsif ( !%Search ) {
$SortBy = 'Changed';
$OrderBy = 'Down';
if ( $CategoryID <= 0 && !%Search ) {
$SortBy = 'Changed';
$OrderBy = 'Down';
$SearchLimit = 10;
}

Expand Down Expand Up @@ -366,14 +380,14 @@ sub Run {
$Link .= 'Order=' . $LayoutObject->LinkEncode($OrderBy) . ';';

my $ActionString;
if ( %Search ) {
if (%Search) {
$ActionString = "Action=CustomerFAQExplorer;Subaction=Search;";
if ( $FAQSearch{CategoryIDs} ) {
$ActionString .= "CategoryID=$CategoryID;";
}
for my $Mode ( keys %Search ) {
$ActionString .= "$Mode=$Search{ $Mode };";
}
if ( $FAQSearch{CategoryIDs} ) {
$ActionString .= "CategoryID=$CategoryID;";
}
for my $Mode ( keys %Search ) {
$ActionString .= "$Mode=$Search{ $Mode };";
}
}
else {
$ActionString = "Action=CustomerFAQExplorer;CategoryID=$CategoryID";
Expand Down
Loading