i want to add the FAQTopTen Checkbox at the Agent Dashboard at the right side under Settings.
The Agent Dashboard should look like this:
How can i do this?
I have added a new Dashlet "FAQTopTen.pm" in the folder C:\Programme (x86)\OTRS\OTRS\Kernel\Output\HTML\ and the FAQTopTen.xml into the folder C:\Programme (x86)\OTRS\Kernel\Config\Files here are the codes:
Code: Select all
# --
# Kernel/Output/HTML/FAQMenuGeneric.pm
# Copyright (C) 2001-2010 xxx, http://otrs.org/
# --
# $Id: FAQMenuGeneric.pm,v 1.3 2010/11/24 21:55:09 cr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
package Kernel::Output::HTML::FAQTopTen;
use strict;
use warnings;
use vars qw($VERSION);
$VERSION = qw($Revision: 1.3 $) [1];
=item FAQShowTop10()
Shows an info box wih the Top 10 FAQ articles.
Depending on the uses interface (agent, customer, public) only the appropriate
articles are shown here.
$LayoutObject->FAQShowTop10(
FAQObject => $FAQObject, # needed for core module interaction
Mode => 'Public', # (Agent, Customer, Public)
CategoryID => 5,
Interface => $Self->{Interface},
InterfaceStates => $Self->{InterfaceStates},
UserID => 1,
Nav => 'none', # optional
);
=cut
sub FAQShowTop10 {
my ( $Self, %Param ) = @_;
# check parameters
for my $ParamName (qw(FAQObject Mode Interface InterfaceStates UserID)) {
if ( !$Param{$ParamName} ) {
$Self->{LogObject}->Log(
Priority => 'error',
Message => "Need $ParamName!",
);
return;
}
}
# check needed stuff
if ( !defined $Param{CategoryID} ) {
$Self->{LogObject}->Log(
Priority => 'error',
Message => "Need CategoryID!",
);
return;
}
# check mode
if ( $Param{Mode} !~ m{ Agent | Customer | Public }xms ) {
$Self->{LogObject}->Log(
Priority => 'error',
Message => 'Mode must be either Agent, Customer or Public!',
);
return;
}
# check CustomerUser
if ( $Param{Mode} eq 'Customer' && !$Param{CustomerUser} ) {
$Self->{LogObject}->Log(
Priority => 'error',
Message => 'Need CustomerUser!',
);
return;
}
# store FAQ object locally
$Self->{FAQObject} = $Param{FAQObject};
my $Result = -1;
# show last added/updated articles
my $Show = $Self->{ConfigObject}->Get('FAQ::Explorer::Top10::Show');
if ( $Show->{ $Param{Interface}->{Name} } ) {
# to store search param for categories
my %CategorySearchParam;
# if subcategories should also be shown
if ( $Self->{ConfigObject}->Get('FAQ::Explorer::Top10::ShowSubCategoryItems') ) {
# find the subcategories of this category
my $SubCategoryIDsRef = $Self->{FAQObject}->CategorySubCategoryIDList(
ParentID => $Param{CategoryID},
Mode => $Param{Mode},
ItemStates => $Param{InterfaceStates},
CustomerUser => $Param{CustomerUser} || '',
UserID => $Param{UserID},
);
# search in the given category and add the subcategory
$CategorySearchParam{CategoryIDs} = [ $Param{CategoryID}, @{$SubCategoryIDsRef} ];
}
# get the top 10 articles for categories with at least ro permissions
my $Top10ItemIDsRef = $Self->{FAQObject}->FAQTop10Get(
Interface => $Param{Interface}->{Name},
Limit => $Self->{ConfigObject}->Get('FAQ::Explorer::Top10::Limit') || 10,
UserID => $Param{UserID},
%CategorySearchParam,
);
# there is something to show
if ( @{$Top10ItemIDsRef} ) {
$Result = 1;
# show the info box
$Self->Block(
Name => 'InfoBoxFAQMiniList',
Data => {
Header => 'Top 10 FAQ articles',
},
);
# show the RSS Feed icon
if ( $Param{Mode} eq 'Public' ) {
$Self->Block(
Name => 'InfoBoxFAQMiniListNewsRSS',
Data => {
Type => 'Top10',
Title => 'FAQ Articles (Top 10)',
},
);
}
my $Number;
for my $Top10Item ( @{$Top10ItemIDsRef} ) {
# increase the number
$Number++;
# get FAQ data
my %FAQData = $Self->{FAQObject}->FAQGet(
ItemID => $Top10Item->{ItemID},
UserID => $Param{UserID},
);
# show the article row
$Self->Block(
Name => 'InfoBoxFAQMiniListItemRow',
Data => {
Nav => $Param{Nav},
%FAQData,
},
);
# show the Top10 position number
$Self->Block(
Name => 'InfoBoxFAQMiniListItemRowPositionNumber',
Data => {
Number => $Number,
},
);
}
}
}
return $Result;
}
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<otrs_config version="1.0" init="Application">
<ConfigItem Name="DashboardBackend###0150-FAQTopTen" Required="0" Valid="1">
<Description Lang="en">Parameters for the dashboard FAQTopTen. "Group" are used to restriced access to the plugin (e. g. Group: admin;group1;group2;). "Default" means if the plugin is enabled per default, "ResponseID" defines the StdResponse displayed in dashboard.</Description>
<Description Lang="de">Parameter für das Dashboard Repair. "Group" ist verwendet um den Zugriff auf das Plugin einzuschränken (z. B. Group: admin;group1;group2;). "Default" gibt an ob das Plugin per default aktiviert ist,"ResponseID" definiert die StdResponse, die im Dashboard angezeigt wird.</Description>
<Group>FAQ</Group>
<SubGroup>Frontend::Agent::Dashboard</SubGroup>
<Setting>
<Hash>
<Item Key="Module">Kernel::Output::HTML::FAQTopTen</Item>
<Item Key="Title">FAQ Top Ten</Item>
<Item Key="Description">Top 10 der FAQ</Item>
# <Item Key="Attributes">StateType=repair;</Item>
<Item Key="Filter">All</Item>
# <Item Key="Time">Age</Item>
<Item Key="Limit">10</Item>
<Item Key="Permission">rw</Item>
<Item Key="Block">ContentLarge</Item>
<Item Key="Group"></Item>
<Item Key="Default">1</Item>
<Item Key="CacheTTLLocal">0.5</Item>
</Hash>
</Setting>
</ConfigItem>
</otrs_config>
Software error:
Can't locate object method "new" via package "Kernel::Output::HTML::FAQTopTen" at C:/PROGRA~2/OTRS/OTRS//Kernel/Modules/AgentDashboard.pm line 412.
What is wrong?