Power of Content Editor WebPart article series started

Filed Under (JavaScript, SharePoint) by Boris Gomiunik on 08-02-2010

Feedback from SharePoint Saturday EMEA online still brings good results. Not only did it make me cleanup quite some of my JavaScripts to prepare for presentation, but it also inspired me to start the "The Power of Content Editor WebPart" series of articles. It’s going to be an at-least 10-part series. Covering from basics to a bit more in-depth on how to use JavaScript to

  1. Change the looks of SharePoint pages
  2. Add features and functionalities to SharePoint Pages and list forms
  3. Read from and write data to SharePoint Lists using SharePoint’s Web Services.
  4. Some other stuff we’ll come along on the way

If you wish to know what all we’ll be getting to know there are already all examples explained in my previous post.

Starting off easy we learn how to insert the CEWP also in pages where the "Edit Page" command in "Site Actions" is not available.

You can find the series article here: The Power of Content Editor WebPart.

As soon as new content is added, I’ll be letting you know.

SPSEMEA Demo site and showcase

Filed Under (JavaScript, SharePoint, jquery) by Boris Gomiunik on 03-02-2010

I’ve prepared a SPSEMEA Demo site that you can simply upload to your (http://[siteUrl]/_catalogs/wt) Site template gallery.

You can download the .stp from CodePlex

After you’ve uploaded the file to the Site template gallery you can create a subsite (English language) and from Custom you can select the uploaded template.

Below’s a brief overview where you can find tricks. How it’s done – check for Content Editor WebParts in that page (using a “PageView=Shared&ToolPaneView=2” parameters in url (more info here)). All the files containing code are in a document library Sys.

image

Let’s see the samples:

Read the rest of this entry »

Content from my presentation on SharePoint Saturday EMEA

Filed Under (SharePoint) by Boris Gomiunik on 23-01-2010

Thanks everyone that joined in to listen to my online presentation on SPSEMEA. I’ve zipped and uploaded all my script samples to CodePlex – click here to download the package.

Let me just point out couple of resources used in those scripts:

  1. Jquery: http://jqoery.com
  2. I was mentioning the IE Developer Toolbar for IE 7 – available here
  3. Or just install latest IE (version 8 already has this built in)
  4. SharePoint web services description and usage on MSDN – just expand the service you wish to check and look for methods
  5. ERTE – I didn’t get to explain that one, but the usage is pretty simple.

As 50 minutes was pretty short time to show all examples, I can start coordinating to have 1-2hour sessions each week for an in-depth look of all the code samples so we can learn to customize and adapt it to our needs. Please let me know in the comments if you’d be interested for that.

Week in month number calculated column

Filed Under (SharePoint) by Boris Gomiunik on 07-01-2010

If you need to determine which week of the month a particular date is in, use the following formula:

=(DATEDIF(DATE(YEAR(Datum);MONTH(Datum);1)-(WEEKDAY(DATE(YEAR(Datum);MONTH(Datum);1);2))+1;Datum+(7-WEEKDAY(Datum;2));"D")+1)/7

The formula above is for regions that use decimal comma format and week starts on Monday. If you use decimal dot and your weeks start on Sunday, use the following formula:

=(DATEDIF(DATE(YEAR(Datum),MONTH(Datum),1)-(WEEKDAY(DATE(YEAR(Datum),MONTH(Datum),1),1))+1,Datum+(7-WEEKDAY(Datum,2)),"D")+1)/7

The formula displays the week number in month, not in year.

SharePoint Document Library item title in Event Receiver AfterProperties

Filed Under (C#, SharePoint) by Boris Gomiunik on 04-01-2010

Here’s a short one worth taking note of. If you’re using SharePoint Event Receivers – more specifically synchronous event receivers (-ing) you might notice that if you try to set Properties.AfterProperties["Title"] in a document library for the strangest reason it doesn’t work. If that occurs, use the

AfterProperties["vti_title"]

And the Document Title can be managed.

Speaking at SharePoint Saturday EMEA

Filed Under (SharePoint) by Boris Gomiunik on 29-12-2009

Just received confirmation today from Mark Miller, organizer of SharePoint Saturday: VYSYD4P26G7Z

I'll be speaking at SharePoint Saturday EMEA

You’re invited to an online event on Saturday, 23rd January 2010. There will be lots of great speakers, keynote will be held by Joel Oleson, loads of MVP sessions and more to come. I’ll also be having an online session talking about The power of Content Editor WebPart, where I’ll be showing quite some tips and tricks on manipulating SharePoint without touching Backend code.

Participation is free, so register already today.

Oznake ponudnika Technorati: ,,,,

Decorate SharePoint HomePage for Christmas

Filed Under (SharePoint, SharePoint branding, css) by Boris Gomiunik on 26-12-2009

How about spicing up company’s intranet for the season? Here’s a neat little trick you can make for adding season’s spirit  to your SharePoint homepage. We’ll add some decoration to page’s head.

image

The first thing you need is the images for the decoration. Don’t make them too big, because you can’t click on anything below images. Below is a simple example I got from Office Online, merged it, removed background and reduced its size. Make sure you have a transparent image (a .GIF or .PNG with transparent background).

christmas

The first step is to upload the image to site’s document or picture library and copy the original image’s URL to clipboard. (don’t copy the SharePoint thumbnail or web preview image, as they tend to get white background instead of original transparent).

image

Next on your homepage add a Content Editor Webpart into any zone and edit its source.

image image

And in the source simply type the following code:

<img src="[your-coppied-image-url]" style="position:absolute; top: 0px; left: 48%; z-index: 99;" />

image

After you click "Save" and "Apply" the page in edit mode will have the decoration in a wrong place.

image

But not to worry, after you exit edit mode, the image will be in the right position. So final result might look something like below:

image

There are numerous variations. You can change the position, you can even use a div with a repeating background image,…

Merry Christmas and a Happy New Year to all SharePoint users and admins!

P.S. If you have any good image (appropriate for transparent background and not violating any copyright rules) for season’s decoration, please drop me a link in this post’s comments.

Oznake ponudnika Technorati: ,,,,,

HTML Tags in List Description

Filed Under (SharePoint) by Boris Gomiunik on 21-12-2009

I noticed what seems to be a slight bug in MOSS couple of days ago. If you use HTML tags in SharePoint list description, the HTML will be displayed in List settings and in "View all site content" page (sample below:)

image
image image

But no HTML in list view – the HTML tags get escaped.

image 

A minor JavaScript fixes this:

use the …ToolPaneView=2 parameter to add the Content editor Webpart above the list view. If you don’t understand what I’m talking about, please take a look at this post.

image

Edit the webpart properties and in source editor paste the following code:

<script type="text/javascript">
  Elementi = document.getElementsByTagName('div');
  for(i=0; i < Elementi.length; i++)
  {
    if(Elementi[i].className != null && Elementi[i].className=="ms-listdescription")
    {
      Elementi[i].innerHTML = deHTML(Elementi[i].innerHTML);
    }

}

function deHTML(vhod) {
     vhod = vhod.replace(/&lt;/gi,'<');

   vhod = vhod.replace(/&gt;/gi,'>');

   return vhod;

}

</script>

and the result is:

image

Unable to authenticate + crawl errors on MOSS on Windows Server 2008

Filed Under (SharePoint, SharePoint administration) by Boris Gomiunik on 01-12-2009

If you’re having some of the following symptoms:

1. You’ve created a web application and you’re sure that credentials are right, but you’re unable to login to the site collection in that web application.

2. Search index log returns strange errors about not finding the web application or access denied.

Then the solution is in the following article:

http://support.microsoft.com/kb/896861 

This did the trick for me:

  1. Start regedit
  2. Open key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
  3. Create a new multi-string value called "BackConnectionHostNames"
  4. Type web application’s host name(s) in the Value Data box.

Save and close regedit. Then using Services under Administrative tools restart the IIS Admin service

Proper display of decimal comma in XSLT data view webpart

Filed Under (SharePoint, XSLT) by Boris Gomiunik on 25-11-2009

If you’re having trouble with format-number function in XSLT data view – it’s probably because of decimal comma. The server returns data with decimal comma, and the format-number function works with decimal dot. The workaround is to translate the values

<xsl:value-of select="format-number(translate(translate(@NumberField,’.',’,'),’,',’.'), ‘#.##0,00;-#.##0,00′, ‘lcid1060′)" />

(in the example above the @NumberField represents the internal name of the field that contains numerical value.

Also make sure that in HTML just before the </xsl:stylesheet> tag you have included the following tag:

<xsl:decimal-format decimal-separator="," grouping-separator="." name="lcid1060" />

ads
ads
ads