Integration of a bookmarklet to add a web page to the link directory


Version 2.0.0 of plugin provides a helper XSLT to enable visitors to add a bookmarklet as a bookmark or favorite link in their browser.

This bookmarklet adds a visited web page to the user's personalized links. Execution of this bookmarklet will work if the user is already connected to the site.
Otherwise, an error message will be displayed.

Integration

To enable site visitors to add this bookmarklet to their favorites, you can create a page in which you insert the bookmarklet link with the instruction to drag and drop the link into the favorites.

To do this, you need to import the XSLT helper:

<xsl:import href="service:link-directory://stylesheets/bookmarklet.xsl"/>   

Then call up the XSLT "add-link-bl" template. For example:

<div>   
 <p>Glissez-déposer le lien ci-après dans la barre des favoris : <xsl:call-template name="add-link-bl"/></p>   
</div>   

The bookmarklet title, confirmation and error messages are configurable.
By default, the bookmarklet title is "✚ Favorites Ametys " and confirmation is requested before adding.

Example of overloading:

<div>   
 <xsl:call-template name="add-link-bl">   
 <xsl:with-param name="link-text">Le titre du bookmarklet</xsl:with-param>   
 <xsl:with-param name="display-confirm">true</xsl:with-param>   
        <xsl:with-param name="confirm-text">Message de confirmation avant ajout</xsl:with-param>   
 <xsl:with-param name="success-text">Message à afficher en cas de succès</xsl:with-param>   
 <xsl:with-param name="unauthenticated-user-text">Message d'erreur à afficher si l'utilisateur n'est pas connecté</xsl:with-param>   
        <xsl:with-param name="already-exists-text">Message d'erreur à afficher si la page web existe déjà dans l'annuaire</xsl:with-param>   
        <xsl:with-param name="unknown-error-text">Message d'erreur à afficher en cas d'erreur</xsl:with-param>   
 </xsl:call-template>   
</div>   

From version 2.6 :

There is now a new parameter:

<xsl:param name="custom-theme"></xsl:param>  

It's empty by default, but you can fill it with a theme identifier (e.g. FAVORITES).

Added links will default to the chosen theme ("Favorites" in the example).

If it's empty, added links won't have a theme.

Restriction

If the bookmarklet is generated from an http site Ametys , it will not be possible to add an address in https://.

It is not possible to submit HTTP requests from an HTTPS server.

 

Back to top