Modifying page editor buttons

29 October 2009 Brian Andersen 0 comments
What do you do if you wan't to add a button to the page editor default toolbar? I wanted to find out and here is what I found.

Find the page edit buttons:
Core: /sitecore/system/setttings/html editor profiles/rich text default_old/webeditButtons/ (weird that they use default_old but thats what they do - and that took me a while to figure out)

Duplicate an item there and you have a new button. In the datasection on the new item you find 3 options:

Icon - self explanatory
Tooltip - selfexplatory
Click: A call to a javascript function, f.ex.:

Striketrough: javascript:Sitecore.WebEdit.execute("strikeThrough", true, true);
Italic: javascript:Sitecore.WebEdit.execute("Italic", true, true);

Etc. All the standard javascript execute commands should work: (I found a list here from a google search: https://developer.mozilla.org/en/Rich-Text_Editing_in_Mozilla)

Here is my result adding a strikeThough button:

Settings:
Click field: "javascript:Sitecore.WebEdit.execute("strikeThrough", true, true);"
Icon field: found an strike through icon in the standard sitecore image library.
Tooltip field: "Strike through"


The javascript-file with functions are found here : website/shell/applications/webEdit.js



Regarding calling sitecore functionality. There is only created 2 functions in the js file:

Insert image:
javascript:Sitecore.WebEdit.insertImage($JavascriptParameters)

Insert Link:
javascript:Sitecore.WebEdit.insertLink($JavascriptParameters)

So if you wan't to make something more that that we would have to write new functions for that.

PS: I did this on Sitecore.NET 6.0.0 (rev. 081022) (the nicam demo site)

Get collection of Sitecore Weblogs in Netvibes

17 December 2007 Jukka-Pekka Keisala 1 comments

I have been using Netvibes as my starting page. I like that more than iGoogle. Here is my collection of Sitecore RSS feeds. Collection contains about +25 blogs, Sitecore corporate news and Sitecore Developer Network articles and forum posts in RSS. There is also Google Custom Search for Sitecore on Sitecore related blogs.



If you have a Sitecore Blog or another useful resource that is not listed here. Please let me know



Click here to preview:Add to Netvibes

Workflow

24 August 2007 Sebastian 0 comments
Some sample code how to manage workflow on Sitecore.

Sitecore Developer Search

27 January 2007 Jukka-Pekka Keisala 1 comments
I was playing around with Google's Co-op and Netvibes API (cool services both of them!) and I drafted out simple a little Netvibes module that searches through few Sitecore Sites and Blogs.
If you have a Netvibes account give a try and if you want some more sites into the index drop me a mail at jp at addition.dk.


Netvibes Sitecore Search Module

Add to Netvibes



And... if you want to Subscribe to Sitecore Experience on Netvibes click button below:


Subscribe to The Sitecore Experience on Netvibes

Add to Netvibes

Read image attributes from media library images

17 January 2007 Jukka-Pekka Keisala 1 comments
This is nice when you need to know what is the size of the image.
sc:fld('height',sc:item(concat('/sitecore/media library', sc:fld('banner',.,'mediapath')),.))
Returns height of the image in "banner" field.

using Sitecore.Kernel.Webutils

14 September 2006 /troniu 3 comments
Webutils functions can be used as helper functions as well. In order to get the url of the server, we can use it as follows:

install it in web.config:

<xslExtensions>
...
<extension mode="on" type="Sitecore.Web.WebUtil, Sitecore.Kernel" namespace="http://www.sitecore.net/webutil" singleInstance="true" />
</xslExtensions>


declare it in your xslt:

xmlns:webutil="http://www.sitecore.net/webutil"


then use it (example from a "print page" footer):

<xsl:text>Artiklens placering: </xsl:text><xsl:value-of select="webutil:GetServerUrl()" /><xsl:value-of select="sc:path(.)" />

util:GetString

/troniu 0 comments
It might be not obvious but is common practice to use util:GetString(string, default).

A xsl:choose used to display the title of an item can be replaced as follows:


<xsl:choose>
<xsl:when test="sc:fld('menutitle',.)">
<xsl:value-of select="sc:fld('menutitle',.)">
</xsl:when>
<xsl:when test="sc:fld('title',.)">
<xsl:value-of select="sc:fld('title',.)">
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="./@name">
</xsl:otherwise>
</xsl:choose>


simpler call:


<xsl:value-of select="util:GetString(util:GetString(sc:fld('title',.), sc:fld('menutitle',.)),@name)"/>

Sitecore performance - xslt NONO !

22 May 2006 Michael 0 comments
Fyi -> speed problems could be caused by one single line in xslt ( impressive that you can kill a dual core P4 64bit 4Ghz with 8 GB mem in one single code line ).

Never compare nodeset´s unless you really have to .. what you typically need is to figure out if current node is thye same as home node … do NOT do like this :
xsl:if test=”$home=$sc_current” …. < -- no no no .. verboten !!!! STOP !

The line above will loop all nodes under $home and compare every node with every node in $sc_currentitem.

Ofcourse what you DO want to do is :
xsl:if test=”$home/@id=$sc_current/@id

If you experience speed problems, this could be why !