Quantcast
Channel: THWACK: All Content - All Communities
Viewing all articles
Browse latest Browse all 20518

Hidden Gems of Web Help Desk - Text Formatting with BBCode

$
0
0

Web Help Desk (WHD) is an easy to use, but also flexible tool for your IT team and even-though we are working on many great new features or improving existing like recently added Orion Integration, there are still less-known areas, which I call the hidden gems.


As a technician you want to use formatted text in your tickets, asset notes or emails. Sometimes you might want to highlight certain information in an email, send a clickable link, format a FAQ that it's easy to follow, or maybe highlight crucial information in an asset note, thus your fellow colleague won't forget to notify you when updating your machine. Some forms like ticket notes offer formatting options in a little menu on the top, but these may not be available everywhere or you might want to do more than standard options.

whd_editor.png

Being a web-based tool, HTML could be sometimes tricky to use, so that's why we have simple formatting which resembles HTML, but uses different syntax. Meet BBCode.

 

BBCode

BBCode (Bulletin Board Code) is a lightweight markup for text formatting. It was introduced in message-boards, but widely used in many other types of software nowadays. Tags are usually indicated by square brackets [ and ], enclosing a keyword. There is no formal standard and you can find different implementations and variations in supported tags. WHD also has its own implementation and there is a good reason for it - you can customize it.

 

Here is a simple example of BBCode, which you can use in WHD.

 

[size=20]Title[/size]

[img]http://www.solarwinds.com/favicon.ico[/img]

<p>

Lorem ipsum [b]dolor sit[/b] amet, [url=http://www.webhelpdesk.com]consectetuer adipiscing[/url] elit. *** sociis natoque [i]penatibus et magnis[/i] dis parturient montes, nascetur ridiculus mus.

</p>

And now some list:

[list]

[*]Fusce tellus. Proin in tellus sit amet nibh dignissim sagittis.

[*]Sed convallis magna eu sem. Maecenas sollicitudin.

[/list]

[list=A]

[*][color=blue]FAQ link:[/color] [faqid=1]

[*][u]FAQ link:[/u] <faqid=2>

[/list]

 

This text renders to following.

whd_faq_render.png

 

Note that markup is actually mix of BBCode and HTML.

 

Formatting

 

Basic markup follows pretty simple structure:

 

  • Simple tags: [tab]something[/tag]
  • Simple parameterized tags: [tag=value]something[/tag]
  • Complex parameterized tags: [tag value1="xxx" value2="yyy"]something[/tag]

 

WHD supports wide range of tags:

 

  • [code]your code here[/code]
  • [quote]Text[/quote]
  • [quote=Author]Text[/quote]
  • [b]bold[/b]
  • [i]italics[/i]
  • [u]underscored[/u]
  • [list] [*]First item [*] Second Item
  • [img]URL[/img]
  • [email]address[/email]
  • [email=address]Text[/email]
  • [url]address[/url]
  • [url=address]Text[/url]
  • [color=name]Text[/color] (supports HTML color names)
  • [size=number of pixels]Text[/size]
  • [google]key words[/google]
  • [google=key words]Text[/google]
  • [faq id=number]

 

Additionally you can also use selected supported HTML tags, which you can mix with BBCode tags:

b, i, u, a, img, li, ul, ol, font, br, p, pre, center, faq, code, hr, strong.

 

You can use the BBCode in many places in WHD like ticket subject, request details, notes, email templates, FAQ, Messages, Login message, custom field description and so on. However not all fields do support BBCode, so if it's something like secondary email field in your account details, you better check in advance.

 

Special Behavior

Apart from tags, BBCode mechanism also detects bare URLs like http or ftp links, emails or UNC paths and make them clickable. If you put link to Youtube or Vimeo video, WHD will actually embed that video and display it instead of the link. (If you want you can disable this behavior, see below.)

 

whd_embeded_video.png

(Btw. if you have not seen the video you definitely should ).

 

There is also a special tag faq. This tag will provide a link to existing FAQ and has the form of [faq id=NUMBER] or <faq id=NUMBER>.

 

Customization

WHD stores transformation rules for all tags in WebHelpDesk/bin/webapps/helpdesk/WEB-INF/Helpdesk.woa/Contents/Resources/bb_config.xml. Great thing about having own implementation is that you can easily create your own tags. Let say you want to use strikethrough text. Simply add this custom tag definition to bb_config.xml and restart WHD.

 

     <!-- S -->

     <match name="s">

          <regex>(?s)(?i)\[s\](.*?)\[/s\]</regex>

          <replace>

          <![CDATA[

          <strike>$1</strike>

          ]] >

          </replace>

     </match>


Now you can use [s] and [/s] tags.

 

In bb_config.xml you can also disable embedding video instead of displaying a link. Find all rules with name starting with auto-youtube (or auto-vimeo) and comment them out with <!-- and -->. Don't forget to restart WHD and you will see the link instead of the video. (Which means url BBCode rule was applied.)

 

whd_video_not_embedded.png

 

How about trying something more fancy? Sometimes when working on an incident or writing a FAQ, you refer to other tickets by saying "ticket 544" or maybe you use terms like request, case or problem. Wouldn't it be nice if this could be a link, so you colleague could click on it and open that ticket right away? Let's write a simple rule to do it. (Don't forget to replace the URL with the link to your system.)

 

     <match name="TicketLink" alwaysProcess="true">

          <regex>(?s)(?i)((?:ticket|incident|case|problem|request)\s*)([0-9]+)</regex>

          <replace>

          <![CDATA[

          <a href="http://webhelpdesk.com:8081/helpdesk/WebObjects/Helpdesk.woa/wa/TicketActions/view?ticket=$2">$1$2</a>

          ]]>

          </replace>

     </match>

 

Now you can just type "case 22" and voilà - there is link!

whd_bbcode_new_rule.png

 

As you could see WHD is tremendously flexible, you can use BBCode in various places and also add your new tags. I'm sure there are more areas you would like to learn more about, so please let me know in comments!

 

References:


Viewing all articles
Browse latest Browse all 20518

Trending Articles