Solved: Warning for Note External
-
- Znuny expert
- Posts: 167
- Joined: 26 Jan 2011, 13:23
- Znuny Version: 3.0.7
- Real Name: Rod Behr
- Company: Impact
- Location: London, United Kingdom
- Contact:
Solved: Warning for Note External
My users, worried that they may create a "Note - external" by mistake, want to be warned when they select "Note - external". Just a little JavaScript alert would do the trick.
How and where would I implement this?
How and where would I implement this?
Last edited by RBehr on 14 Dec 2011, 16:46, edited 1 time in total.
Rod Behr
Software Design Manager and Database Analyst | Impact Audiovisual | London
Installation: OTRS 3.0.7, Apache 2, Strawberry Perl 5 on Ubuntu 10.04.3 Server with separate MySQL Server, also on Ubuntu 10.04.3
Software Design Manager and Database Analyst | Impact Audiovisual | London
Installation: OTRS 3.0.7, Apache 2, Strawberry Perl 5 on Ubuntu 10.04.3 Server with separate MySQL Server, also on Ubuntu 10.04.3
-
- Znuny expert
- Posts: 167
- Joined: 26 Jan 2011, 13:23
- Znuny Version: 3.0.7
- Real Name: Rod Behr
- Company: Impact
- Location: London, United Kingdom
- Contact:
Re: Warning for Note External
Any news on this question?
Rod Behr
Software Design Manager and Database Analyst | Impact Audiovisual | London
Installation: OTRS 3.0.7, Apache 2, Strawberry Perl 5 on Ubuntu 10.04.3 Server with separate MySQL Server, also on Ubuntu 10.04.3
Software Design Manager and Database Analyst | Impact Audiovisual | London
Installation: OTRS 3.0.7, Apache 2, Strawberry Perl 5 on Ubuntu 10.04.3 Server with separate MySQL Server, also on Ubuntu 10.04.3
-
- Znuny expert
- Posts: 167
- Joined: 26 Jan 2011, 13:23
- Znuny Version: 3.0.7
- Real Name: Rod Behr
- Company: Impact
- Location: London, United Kingdom
- Contact:
Re: Warning for Note External
Hello?
Rod Behr
Software Design Manager and Database Analyst | Impact Audiovisual | London
Installation: OTRS 3.0.7, Apache 2, Strawberry Perl 5 on Ubuntu 10.04.3 Server with separate MySQL Server, also on Ubuntu 10.04.3
Software Design Manager and Database Analyst | Impact Audiovisual | London
Installation: OTRS 3.0.7, Apache 2, Strawberry Perl 5 on Ubuntu 10.04.3 Server with separate MySQL Server, also on Ubuntu 10.04.3
-
- Znuny expert
- Posts: 296
- Joined: 04 Jul 2010, 17:49
- Znuny Version: 3.1.x
- Real Name: Alexander Halle
- Company: radprax MVZ GmbH
- Location: Wuppertal
- Contact:
Re: Warning for Note External
I think you have to modify the corresponding DTL-Files. There should be one for each action screen (like adding a note or writing an email, see URL for screen for the right module). There you have to place the javascript validation code.
Alexander Halle
OTRS Community Links: User Meetings, Projects
- Public Relations @ OTRS Community Board / OtterHub
- 2nd-Level Support Agent @ radprax MVZ GmbH
OTRS Community Links: User Meetings, Projects
-
- Znuny expert
- Posts: 167
- Joined: 26 Jan 2011, 13:23
- Znuny Version: 3.0.7
- Real Name: Rod Behr
- Company: Impact
- Location: London, United Kingdom
- Contact:
Re: Warning for Note External
You are correct. The relevant .dtl file is /opt/otrs/Kernel/output/HTML/Standard/AgentTicketNote.dtl. My point is, however, that this file is generated from /opt/otrs/Kernel/Modules/AgentTicketNote.pm and a number of other Perl script files. The .dtl gives the basic HTML layout but not, crucially, the entries for the <select><option> HTML tags, and I need to create a script that reacts to the selection of a specific value in a <select> list.
Also, this would not just be for a note, but for any form which exposes the note-type field (potentially a large number, depending onSysConfig settings, including Pending, Change Queue, Close, etc.)
Is there a recommended method of adding JavaScript in this method? I would rather not go hard-coding it into the .dtl file unless I have to.
Thanks
Also, this would not just be for a note, but for any form which exposes the note-type field (potentially a large number, depending onSysConfig settings, including Pending, Change Queue, Close, etc.)
Is there a recommended method of adding JavaScript in this method? I would rather not go hard-coding it into the .dtl file unless I have to.
Thanks
Rod Behr
Software Design Manager and Database Analyst | Impact Audiovisual | London
Installation: OTRS 3.0.7, Apache 2, Strawberry Perl 5 on Ubuntu 10.04.3 Server with separate MySQL Server, also on Ubuntu 10.04.3
Software Design Manager and Database Analyst | Impact Audiovisual | London
Installation: OTRS 3.0.7, Apache 2, Strawberry Perl 5 on Ubuntu 10.04.3 Server with separate MySQL Server, also on Ubuntu 10.04.3
-
- Znuny expert
- Posts: 296
- Joined: 04 Jul 2010, 17:49
- Znuny Version: 3.1.x
- Real Name: Alexander Halle
- Company: radprax MVZ GmbH
- Location: Wuppertal
- Contact:
Re: Warning for Note External
You can try to add an "output filter".
An output filter can modify the HTML code created by the perl module, I think via "$Output".
Please see Kernel/Output/HTML/OutputFilterTextURL.pm for an example, this module makes links clickable by adding the HTML tags.
And http://doc.otrs.org/developer/2.4/en/ht ... tputfilter.
You could even try to inject your javascript code right into the created HTML code that shows the select list via such an output filter. For example check per RegEx if there is an article type in the HTML code. If yes inject the javascript code which checks for "note external" and then shows the confirm popup. If the user selects "cancel" your code would stop sending the form data so that no note of type external is created.
P.S.
Since you usally publish your solutions for others I asked in the community for the solution to support you. So not all of the above is from me directly, but I tried to explain it as good as I can.
An output filter can modify the HTML code created by the perl module, I think via "$Output".
Please see Kernel/Output/HTML/OutputFilterTextURL.pm for an example, this module makes links clickable by adding the HTML tags.
And http://doc.otrs.org/developer/2.4/en/ht ... tputfilter.
You could even try to inject your javascript code right into the created HTML code that shows the select list via such an output filter. For example check per RegEx if there is an article type in the HTML code. If yes inject the javascript code which checks for "note external" and then shows the confirm popup. If the user selects "cancel" your code would stop sending the form data so that no note of type external is created.
P.S.
Since you usally publish your solutions for others I asked in the community for the solution to support you. So not all of the above is from me directly, but I tried to explain it as good as I can.
Alexander Halle
OTRS Community Links: User Meetings, Projects
- Public Relations @ OTRS Community Board / OtterHub
- 2nd-Level Support Agent @ radprax MVZ GmbH
OTRS Community Links: User Meetings, Projects
-
- Znuny expert
- Posts: 167
- Joined: 26 Jan 2011, 13:23
- Znuny Version: 3.0.7
- Real Name: Rod Behr
- Company: Impact
- Location: London, United Kingdom
- Contact:
Re: Warning for Note External
That is very kind of you, Alexander, thank you. I will have a look and report back.
Rod Behr
Software Design Manager and Database Analyst | Impact Audiovisual | London
Installation: OTRS 3.0.7, Apache 2, Strawberry Perl 5 on Ubuntu 10.04.3 Server with separate MySQL Server, also on Ubuntu 10.04.3
Software Design Manager and Database Analyst | Impact Audiovisual | London
Installation: OTRS 3.0.7, Apache 2, Strawberry Perl 5 on Ubuntu 10.04.3 Server with separate MySQL Server, also on Ubuntu 10.04.3
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Warning for Note External
Kernel/Output/HTML/Layout.pm is called for BuildSelection
It includes an optional entry for "OnChange" => 'javascript',
Round about line 1331, Kernel/Modules/AgentTicketActionCommon.pm starts getting the DefaultNoteTypes
Later, it builds the selection..
It seems reasonable to add something like
after Name.
'10' is the id for note-external
It includes an optional entry for "OnChange" => 'javascript',
Round about line 1331, Kernel/Modules/AgentTicketActionCommon.pm starts getting the DefaultNoteTypes
Later, it builds the selection..
Code: Select all
$Param{ArticleTypeStrg} = $Self->{LayoutObject}->BuildSelection(
Data => \%NoteTypes,
Name => 'ArticleTypeID',
%ArticleType,
);
Code: Select all
OnChange => 'if (this.options[this.selectedIndex].value=='10') { alert('external') };',
'10' is the id for note-external
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
-
- Znuny expert
- Posts: 167
- Joined: 26 Jan 2011, 13:23
- Znuny Version: 3.0.7
- Real Name: Rod Behr
- Company: Impact
- Location: London, United Kingdom
- Contact:
Re: Warning for Note External
Crythias, again you ride to the rescue. Nice, elegant solution. Thank you.
Rod Behr
Software Design Manager and Database Analyst | Impact Audiovisual | London
Installation: OTRS 3.0.7, Apache 2, Strawberry Perl 5 on Ubuntu 10.04.3 Server with separate MySQL Server, also on Ubuntu 10.04.3
Software Design Manager and Database Analyst | Impact Audiovisual | London
Installation: OTRS 3.0.7, Apache 2, Strawberry Perl 5 on Ubuntu 10.04.3 Server with separate MySQL Server, also on Ubuntu 10.04.3