here’s how to create a Confluence User Macro which will create a “mailto” link which dynamically has the page title as the subject of the email and the page title and URL of the page in the body of the email.
1. Log in to Confluence as a Confluence Administrator
2. Select Browse -> Confluence Admin -> User Macros
3. Create a new User Macro:
Template:
## Macro title: Mail To
## Macro has a body: N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: Andrew Frayling
## Date created: 26/01/2012
## Installed by: My Name
## Simple Mail to macro which constructs a <a href=mailto:> link
## with the page title as the subject and the page title and URL of
## the page as the body
## @param email:title=Email Address|type=string|required=true
<a href="mailto:$paramemail?subject=Page Title: $renderContext.getPageTitle()&body=This is the page I am mailing you from: $renderContext.getPageTitle() - $action.getGlobalSettings().getBaseUrl()$content.getUrlPath()">Click to Email Me</a>
The variables in the template are:
@param email:title=Email Address|type=string|required=true – prompts the user for an email address that they would like the mailto link to send the email to
$renderContext.getPageTitle() - retrieves the title of the page that the macro is inserted into
$action.getGlobalSettings().getBaseUrl() – retrieves the base URL of the Confluence install
$content.getUrlPath() – retrieves the URL path of the page that the macro is inserted into
Therefore the full URL of the page is $action.getGlobalSettings().getBaseUrl()$content.getUrlPath()
4. Save the user macro
Now when you edit a page you can use the wiki markup:
{mailto:email=joebloggs@example.com}
where joebloggs@example.com is the email address of where you would like the mailto link to send the email, or select the macro from Insert -> Other Macros
Which will give you the following link on a page:
Clicking the link will result in an email being composed in your default email client:
I did spend some time trying to get the URL in the email to be rendered as a clickable <a href> link, but a URL within a URL didn’t want to play ball.
I’ve been playing around with JQuery as a bit of a learning exercise and have knocked up a simple script to automatically add an image () after any links inserted into Confluence that reference external sites to indicate to the user that the link goes to an external site. To add this script to Confluence:
1. Log in to Confluence as a Confluence Administrator
2. Select Browse -> Confluence Admin -> Look and Feel -> Custom HTML
3. Edit the “At the end of the HEAD” section and insert the following Javascript:
<script type="text/javascript">
AJS.toInit(function(){
AJS.$("a[class='external-link']").after(' <img src="<url of the image you wish to use>" alt="External Link">');
});
</script>
replacing “<url of the image you wish to use>” with a valid image URL, e.g “/download/attachments/1081346/external.png”
4. Click Save
The script simply looks for any <a> tags that have a class of “external-link” (the CSS class that Confluence automatically adds to external links when a user inserts a link in the editor) and appends an image () after the link.
E.g.
I did also play with adding a target=”_blank” attribute to make external links open in a browser window:
The eagle-eyed among you may have noticed that Safari was missing from my previous post about Adding IBM Connections Search to Your Browser, but Safari users can now join the party thanks to this tweet from David Simpson:
1. Download and install Safari OmniBar from http://hackemist.com/SafariOmnibar/
2. Launch Safari, select any text in the address bar and right-click to select Edit OmniBar Search Providers
3. Click the (+) button to add a new search provider and enter values for Search Provider, Keyword and URL, e.g.
Search Provider: Greenhouse Connections Keyword: green URL: https://greenhouse.lotus.com/search/web/search?personalOnly=false&components=&component=&query={searchTerms}&tag=&nonperson=&person=&fieldvalue=
NB: The value for the query parameter is {searchTerms} as this is the value that Safari OmniBar will substitute for the search term you enter when you use the search.
NB: After you have entered values for Search Provider, Keyword and URL hit <ENTER> before clicking Done as otherwise OmniBar doesn’t save the URL value.
Now if you type green followed by a <SPACE> in your Safari address bar the bar will change to:
and you can type your search term and hit <ENTER> to search Greenhouse Connections content without having to visit Connections first. E.g. green<SPACE>test<ENTER> will search Greenhouse for all Connections content containing the word test.
You can use whatever you want for the Keyword in your Safari OmniBar search preferences and if you have access to more than one Connections implementation you can add as many search engines as you wish, just using a unique Keyword for each implementation and changing the URL to match the relevant implementation, e.g.:
For those of your lucky enough to be heading to Lotusphere 2012 in January you may find it useful to keep track of sessions while you’re on the move by downloading some of the mobile apps that are available.
If you find yourself with some free time – which if you do, you’re not doing Lotusphere properly – you could also check out Mousewait for iPhone and Android for attraction waiting times, restaurants, menus, park guides, etc.
Hope you all have fun at Lotusphere just don’t hog the mic at Kimonos
I’ve been playing around with IBM Connections search recently and discovered that you can add the ability to search for content stored in IBM Connections directly from your browser by using the URL that IBM Connections uses for Advanced Search:
1. Select Chrome -> Preferences -> Basic -> Search -> Manage Search Engines 2. Scroll to the bottom of your Other search engines list and enter values for the Description, Keyword and Search URL, e.g.
Description: Greenhouse Keyword: green URL: https://greenhouse.lotus.com/search/web/search?personalOnly=false&components=&component=&query=%s&tag=&nonperson=&person=&fieldvalue=
NB: the value for the query parameter is %s as this is the value that Chrome will substitue for the search term you enter when you use the search.
Now if you type green followed by a <SPACE> in your Chrome address bar the bar will change to:
and you can type your search term and hit <ENTER> to search Greenhouse Connections content without having to visit Connections first. E.g. green<SPACE>test<ENTER> will search Greenhouse for all Connections content containing the word test.
You can use whatever you want for the Keyword in your Chrome search preferences and if you have access to more than one Connections implementation you can add as many search engines as you wish, just using a unique Keyword for each implementation and changing the URL to match the relevant implementation, e.g.:
In theory you should be able just log in to Connections and right-click in the Connections search box to select “Add a Keyword for this Search” and/or “Add to Search Bar”, but while these do add options for searching Connections to Firefox, for some reason the searches never return any results. Fortunately adding these options in manually does work and here’s how to add them:
Adding Connections to the Firefox Search Box
The most reliable way I found of adding Connections search to the Firefox search box and have it return results was to create an OpenSearch description file and install this in Firefox’s searchplugins folder. An OpenSearch description file is an XML file that is used to describe a search engine so that it can be used by client search applications and an example of a description file for searching IBM Connections on Greenhouse is given below:
To adapt the description file for your Connections implementation just change the values in bold to the relevant values for your implementation and save the file with a meaningful filename (e.g. connections-search.xml) in your <Firefox Installation Directory>/searchplugins/ folder. Examples of default installation directories on various operating systems can be found at http://kb.mozillazine.org/Installation_directory
A complete OpenSearch description file for searching IBM Connections on Greenhouse, including base64 data for a thumbnail image, can be downloaded here. Save the connections-search.xml file to your <Firefox Installation Directory>/searchplugins/ folder and restart Firefox.
After installing the OpenSearch descriptor file into your copy of Firefox you should now have an option for searching Connections from your Firefox search box:
You can also make OpenSearch descriptor files available for users to easily add to their Firefox browsers by uploading the XML to the web and adding an embedded link to the <head> of your web page:
This used to be easier to add in earlier versions of Firefox when you were given an option to provide a Keyword when you bookmarked a page, but that option seems to have disappeared in favour of adding tags to your bookmarks. You can still add Keywords to use as search shortcuts, but it now takes a few extra steps:
1. Copy the following URL into your Firefox address bar, substituting greenhouse.lotus.com for the Connections implementation you wish to add as a search:
2. Select Bookmarks -> Bookmark This Page and give it a meaningful name, e.g. Greenhouse Connections Search 3. Select Bookmarks -> Show All Bookmarks -> Recently Bookmarked and select the bookmark you just added 4. Edit the URL and replace “query=test” with “query=%s”, e.g.
5. If the Keyword field is not shown click the Down button to the bottom left of the Tags field to display the Keyworld field 6. Enter a relevant Keyword that you wish to use as a shortcut for this search, e.g. green
Now you should be able to enter your Keyword followed by a <SPACE> and your search term directly in the Firefox address bar, e.g. green<SPACE>test<ENTER>:
Instructions for Internet Explorer
Internet Explorer also uses OpenSearch to add search engines to its search providers, but it’s a little bit fussier than Firefox about the format of the file you provide. An example of an OpenSearch descriptor file for Connections on Greenhouse is:
Note that you provide all of the URL parameters directly in the <Url> element rather than providing separate <Param> elements and because all of the parameters are now provided in the <Url> element they need to be escaped with & Internet Explorer also does not like the method=”post” attribute as part of the <Url> parameter, but it works without this attribute. Again you substitute the values in bold for the values that are relevant for the Connections implementation that you wish to add as a provider.
Once you have created your OpenSearch descriptor file (an example is available for you to download here) you can make it available for users to install by uploading your XML file to the web and either:
After installing the search provider into Internet Explorer you should now have an option to search Connections from IE’s search bar:
Providing ways for users to add Connections search to their browsers should make it easier for people to search and engage with content that is stored in your Connections implementations so I hope you find this useful. If you have any other tips or shortcuts for adding search to different browsers please feel free to drop me a line via the comments.