Toolbar module for customer portal
Toolbar module for customer portal
Hi,
I want to develop toolbar module for customer portal. How can I do this?
Thanks & Regards,
Gunjan
I want to develop toolbar module for customer portal. How can I do this?
Thanks & Regards,
Gunjan
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Toolbar module for customer portal
Have a look at the NavigationBar in the agent portal and port it to customer portal...
https://github.com/OTRS/otrs/blob/rel-3 ... t.pm#L2805
https://github.com/OTRS/otrs/blob/rel-3 ... ionBar.dtl
https://github.com/OTRS/otrs/blob/rel-3 ... Log.pm#L37
https://github.com/OTRS/otrs/blob/rel-3 ... t.pm#L2805
https://github.com/OTRS/otrs/blob/rel-3 ... ionBar.dtl
https://github.com/OTRS/otrs/blob/rel-3 ... Log.pm#L37
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: Toolbar module for customer portal
Hi,
i tried to understand the concept but couldn't understand it. can you please tell me some other way or clarify it?
Thanks & Regards,
Gunjan
i tried to understand the concept but couldn't understand it. can you please tell me some other way or clarify it?
Thanks & Regards,
Gunjan
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Toolbar module for customer portal
Sorry, I was referring to NavigationBar, not ToolBar.
If you want to create a ToolBar for the customer portal, you need to:
* Create SysConfig options like the ones in Frontend::Agent::ToolBarModule
* Add handling of those options in the method CustomerHeader in Kernel::Output::HTML::Layout like it was done for the Agent interface (see https://github.com/OTRS/otrs/blob/rel-3 ... t.pm#L1516)
* Add ToolBar block in CustomerHeader.dtl like the one in the Agent interface (see https://github.com/OTRS/otrs/blob/maste ... er.dtl#L27)
If you want to create a ToolBar for the customer portal, you need to:
* Create SysConfig options like the ones in Frontend::Agent::ToolBarModule
* Add handling of those options in the method CustomerHeader in Kernel::Output::HTML::Layout like it was done for the Agent interface (see https://github.com/OTRS/otrs/blob/rel-3 ... t.pm#L1516)
* Add ToolBar block in CustomerHeader.dtl like the one in the Agent interface (see https://github.com/OTRS/otrs/blob/maste ... er.dtl#L27)
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: Toolbar module for customer portal
Hi,
I have done 1 & 3 point but in the 2nd point, I am facing some issue. inhttps://github.com/OTRS/otrs/blob/rel-3 ... t.pm#L1516
I have added the given code and changed according to our needs, but at line 1518, I don't know what is the issue. I am not able to use this code in sub customerheader(). Please enlighten me !
Thanks
Gunjan
I have done 1 & 3 point but in the 2nd point, I am facing some issue. inhttps://github.com/OTRS/otrs/blob/rel-3 ... t.pm#L1516
I have added the given code and changed according to our needs, but at line 1518, I don't know what is the issue. I am not able to use this code in sub customerheader(). Please enlighten me !
Thanks
Gunjan
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Toolbar module for customer portal
What did you try? What error messages do you get?
Instead of UserType -> "Agent" it has to be UserType -> "Customer".
Instead of UserType -> "Agent" it has to be UserType -> "Customer".
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: Toolbar module for customer portal
ya I changed 'User' to 'customer' and 'Frontend::ToolBarModule' to 'CustomerFrontend::ToolBarModule', but don't know what is the prob. when I run this code after changes made, I got internal server error everytime. Do I need to make changes somewhere else?
Re: Toolbar module for customer portal
Hi,
I made a module 'ToolBarCustomerSearchProfile' like 'ToolBarTicketSearchProfile', what changes should be done in this file?
Thanks in Advance
Gunjan
I made a module 'ToolBarCustomerSearchProfile' like 'ToolBarTicketSearchProfile', what changes should be done in this file?
Thanks in Advance
Gunjan
Re: Toolbar module for customer portal
Hello,
I found some problem in the created file 'ToolBarCustomerSearchProfile'. Please have a look in the following code:
the issue is in the bold line. Please tell me what should I write instead of this line?
I found some problem in the created file 'ToolBarCustomerSearchProfile'. Please have a look in the following code:
Code: Select all
sub Run {
my ( $Self, %Param ) = @_;
# get user data
[b] my %User = $Self->{UserObject}->GetUserData([/b]
UserID => $Self->{UserID},
);
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Toolbar module for customer portal
You have to create a CustomerUserObject and use the Method CustomerUserDataGet (see http://otrs.perl-services.de/docs/otrs/ ... ruser.html )
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: Toolbar module for customer portal
I have done this. but I am not able to get customerdata in CustomerUserObject. i am using external backend for Customer User data.
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Toolbar module for customer portal
Please show more code...
Maybe you should hire a professional developer.
Maybe you should hire a professional developer.
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: Toolbar module for customer portal
Config:
ToolBarCustomerSearchProfile.pm:
code in customerHeader.dtl:
Code in Layout.pm:
Code: Select all
<ConfigItem Name="CustomerFrontend::ToolBarModule###1-Ticket::TicketSearchProfile" Required="0" Valid="0">
<Description Translatable="1">customer interface module to access search profiles </Description>
<Group>Ticket</Group>
<SubGroup>Frontend::Customer::ToolBarModule</SubGroup>
<Setting>
<Hash>
<Item Key="Module">Kernel::Output::HTML::ToolBarCustomerSearchProfile</Item>
<Item Key="Description">Search-Template</Item>
<Item Key="Name">Search-Template</Item>
<Item Key="Block">ToolBarSearchProfile</Item>
<Item Key="MaxWidth">40</Item>
<Item Key="Priority">1990010</Item>
</Hash>
</Setting>
</ConfigItem>
Code: Select all
package Kernel::Output::HTML::ToolBarCustomerSearchProfile;
use strict;
use warnings;
use Kernel::System::SearchProfile;
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
# get needed objects
for (qw(ConfigObject LogObject DBObject TicketObject LayoutObject UserID UserObject)) {
$Self->{$_} = $Param{$_} || die "Got no $_!";
}
$Self->{SearchProfileObject} = Kernel::System::SearchProfile->new(%Param);
return $Self;
}
sub Run {
my ( $Self, %Param ) = @_;
# get user data
my %User = $Self->{UserObject}->CustomerUserDataGet(
UserLogin => $Self->{UserID},
);
# create search profiles string
my $ProfilesStrg = $Self->{LayoutObject}->BuildSelection(
Data => {
'', '-',
$Self->{SearchProfileObject}->SearchProfileList(
Base => 'TicketSearch',
UserLogin => $User{UserLogin},
),
},
Name => 'Profile',
ID => 'ToolBarSearchProfile',
Title => $Self->{LayoutObject}->{LanguageObject}->Get('Search template'),
SelectedID => '',
Max => $Param{Config}->{MaxWidth},
);
my $Priority = $Param{Config}->{'Priority'};
my %Return = ();
$Return{ $Priority++ } = {
Block => $Param{Config}->{Block},
Description => $Param{Config}->{Description},
Name => $Param{Config}->{Name},
Image => '',
Link => $ProfilesStrg,
AccessKey => '',
};
$Self->{LogObject}->Log(
Priority => 'error',
Message =>"@{[%Return]}\n"
);
return %Return;
}
1;
Code: Select all
<!-- dtl:block:ToolBar -->
<ul id="ToolBar">
<!-- dtl:block:ToolBarItem -->
<li class="$QData{"Class"}"><a href="$Data{"Link"}" accesskey="$QData{"AccessKey"}" title="$Text{"$Data{"Description"}"}: $QData{"Count"}$QData{"AccessKeyReference"}">$Text{"$Data{"Description"}"} <i class="icon-small icon-time icon-show-reached"></i> <i class="icon-small icon-star icon-show-new"></i><i class="$QData{"Icon"}"></i> <span class="Counter">$QData{"Count"}</span> </a></li>
<!-- dtl:block:ToolBarItem -->
<!-- dtl:block:ToolBarSearchProfile-->
<li class="Extended SearchProfile">
<form action="$Env{"CGIHandle"}" method="post" name="SearchProfile">
<input type="hidden" name="Action" value="CustomerTicketSearch"/>
<input type="hidden" name="Subaction" value="LoadProfile"/>
<input type="hidden" name="SearchTemplate" value="$Text{"Search"}"/>
$Data{"Link"}
# <a href="#" id="ToolbarProfileSearch" title="$Text{"$Data{"Description"}"} ($QData{"AccessKey"})" accesskey="$QData{"AccessKey"}" $Data{"LinkOption"}>$Text{"$Data{"Name"}"}</a>
</form>
</li>
<!-- dtl:js_on_document_complete -->
<script type="text/javascript">//<![CDATA[
$('#ToolBarSearchProfile').bind('change', function (Event) {
$(Event.target).closest('form').submit();
Event.preventDefault();
Event.stopPropagation();
return false;
});
//]]></script>
<!-- dtl:js_on_document_complete -->
<!-- dtl:block:ToolBarSearchProfile-->
</ul>
<!-- dtl:block:ToolBar -->
Code in Layout.pm:
Code: Select all
# run tool bar item modules
if ( $Self->{UserID} && $Self->{UserType} eq 'Customer' ) {
my $ToolBarModule = $Self->{ConfigObject}->Get('CustomerFrontend::ToolBarModule');
if ( $Param{ShowToolbarItems} && ref $ToolBarModule eq 'HASH' ) {
my %Modules;
my %Jobs = %{$ToolBarModule};
for my $Job (sort keys %Jobs ) {
# load and run module
next if !$Self->{MainObject}->Require( $Jobs{$Job}->{Module} );
my $Object = $Jobs{$Job}->{Module}->new( %{$Self},LayoutObject => $Self );
next if !$Object;
%Modules = ( $Object->Run( %Param, Config => $Jobs{$Job} ), %Modules );
}
# show tool bar items
my $ToolBarShown = 0;
for my $Key ( sort keys %Modules ) {
next if !%{ $Modules{$Key} };
# show tool bar wrapper
if ( !$ToolBarShown ) {
$ToolBarShown = 1;
$Self->Block(
Name => 'ToolBar',
Data => \%Param,
);
}
$Self->Block(
Name => $Modules{$Key}->{Block},
Data => {
%{ $Modules{$Key} },
AccessKeyReference => $Modules{$Key}->{AccessKey}
? " ($Modules{$Key}->{AccessKey})"
: '',
},
);
}
# show logged in notice
if ( $Param{ShowPrefLink} ) {
$Self->Block(
Name => 'Login',
Data => \%Param,
);
}
else {
$Self->Block(
Name => 'LoginWithoutLink',
Data => \%Param,
);
}
# show logout button (if registered)
if (
$Param{ShowLogoutButton}
&& $Self->{ConfigObject}->Get('Frontend::Module')->{Logout}
)
{
$Self->Block(
Name => 'Logout',
Data => \%Param,
);
}
}
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Toolbar module for customer portal
(Changes to your code marked with "# <-----"
ToolBarCustomerSearchProfile.pm:
Code in Layout.pm:
You can remove this code
ToolBarCustomerSearchProfile.pm:
Code: Select all
[...]
sub Run {
my ( $Self, %Param ) = @_;
# get user data
my %User = $Self->{UserObject}->CustomerUserDataGet(
User => $Self->{UserID}, # <-----
);
# create search profiles string
my $ProfilesStrg = $Self->{LayoutObject}->BuildSelection(
Data => {
'', '-',
$Self->{SearchProfileObject}->SearchProfileList(
Base => 'CustomerTicketSearch', # <-----
UserLogin => $User{UserLogin},
),
},[...]
Code: Select all
# run tool bar item modules
if ( !$Param{ShowToolbarItems} ) { # <-----
$Param{ShowToolbarItems} = 1; # <-----
} # <-----
if ( $Self->{UserID} && $Self->{UserType} eq 'Customer' ) {
[...]
Code: Select all
# show logged in notice
if ( $Param{ShowPrefLink} ) {
$Self->Block(
Name => 'Login',
Data => \%Param,
);
}
else {
$Self->Block(
Name => 'LoginWithoutLink',
Data => \%Param,
);
}
# show logout button (if registered)
if (
$Param{ShowLogoutButton}
&& $Self->{ConfigObject}->Get('Frontend::Module')->{Logout}
)
{
$Self->Block(
Name => 'Logout',
Data => \%Param,
);
}
}
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: Toolbar module for customer portal
SearchProfile dropdown is still not visible on customer interface. Did I put the right code in CustomerHeader.dtl file? can you tell me the right place where I should put this code?
Thanks
Gunjan
Thanks
Gunjan
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Toolbar module for customer portal
You should put the .dtl code here
Did you add those three lines in Layout.pm to activate "ShowToolbarItems"?
Code: Select all
<!-- dtl:block:DebugRTLButton -->
# <----
</div>
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: Toolbar module for customer portal
i have put all the code. but the problem is when I put the code in 'layout.pm', I got internal server error everytime.
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Toolbar module for customer portal
What do the logs say (OTRS log, webserver log)?Gunjan wrote:i have put all the code. but the problem is when I put the code in 'layout.pm', I got internal server error everytime.
Can you post the complete code of Layout.pm that fails?
Sometimes it is really hard to help you as you do not post all information! If something fails, please post the error messages, the log messages, the code and what you have tried to debug the error...
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: Toolbar module for customer portal
Hi,
Thanks for your support
Field is visible now and working fine.
Regards,
Gunjan
Thanks for your support

Regards,
Gunjan
-
- Znuny expert
- Posts: 171
- Joined: 24 Apr 2013, 12:29
- Znuny Version: OTRS3.3
- Real Name: kalyanachakravarthy M P
- Company: TATA Technologies
- Location: Pune,India
- Contact:
Re: Toolbar module for customer portal
Gunjan wrote:Hi,
Thanks for your supportField is visible now and working fine.
Regards,
Gunjan
Hi Gujan
please once update working code
Re: Toolbar module for customer portal
Hi kalyana,
working Code in Layout.pm :
rest code is mentioned in the earlier posts.
working Code in Layout.pm :
Code: Select all
# run tool bar item modules
if ( !$Param{ShowToolbarItems} ) {
$Param{ShowToolbarItems} = 1;
}
if ( $Self->{UserID} && $Self->{UserType} eq 'Customer' ) {
my $ToolBarModule = $Self->{ConfigObject}->Get('CustomerFrontend::ToolBarModule');
if ( $Param{ShowToolbarItems} && ref $ToolBarModule eq 'HASH' ) {
my %Modules;
my %Jobs = %{$ToolBarModule};
for my $Job ( sort keys %Jobs ) {
# load and run module
next if !$Self->{MainObject}->Require( $Jobs{$Job}->{Module} );
my $Object = $Jobs{$Job}->{Module}->new(
%{$Self},
LayoutObject => $Self,
);
next if !$Object;
%Modules = ( $Object->Run( %Param, Config => $Jobs{$Job} ), %Modules );
}
# show tool bar items
my $ToolBarShown = 0;
for my $Key ( sort keys %Modules ) {
next if !%{ $Modules{$Key} };
# show tool bar wrapper
if ( !$ToolBarShown ) {
$ToolBarShown = 1;
$Self->Block(
Name => 'ToolBar',
Data => \%Param,
);
}
$Self->Block(
Name => $Modules{$Key}->{Block},
Data => {
%{ $Modules{$Key} },
AccessKeyReference => $Modules{$Key}->{AccessKey}
? " ($Modules{$Key}->{AccessKey})"
: '',
},
);
}
}
}
-
- Znuny expert
- Posts: 171
- Joined: 24 Apr 2013, 12:29
- Znuny Version: OTRS3.3
- Real Name: kalyanachakravarthy M P
- Company: TATA Technologies
- Location: Pune,India
- Contact:
Re: Toolbar module for customer portal
Thank you Very much Gunjan



Re: Toolbar module for customer portal
Hi,
I also want to show this 'search profile' dropdown on 'ActionRow' of customer interface. I wrote the below code but not working
what should I add in this code??
I also want to show this 'search profile' dropdown on 'ActionRow' of customer interface. I wrote the below code but not working
Code: Select all
<ConfigItem Name="CustomerFrontend::Module###ToolBarModule" Required="0" Valid="1">
<Description Translatable="1">Frontend module registration for the agent interface.</Description>
<Group>Ticket</Group>
<SubGroup>Frontend::Customer::ModuleRegistration</SubGroup>
<Setting>
<FrontendModuleReg>
<Description>ToolBar Module for customer interface</Description>
<Title>Customer ToolBar Module </Title>
<NavBarName>Ticket</NavBarName>
<NavBar>
<Description Translatable="1">Search-Template</Description>
<Name Translatable="1">Search-Template</Name>
<Link>Action=ToolBarCustomerSearchProfile</Link>
<LinkOption></LinkOption>
<Block>ToolBarSearchProfile</Block>
<Type>Menu</Type>
<Prio>900</Prio>
</NavBar>
</FrontendModuleReg>
</Setting>
</ConfigItem>