Archive

Posts Tagged ‘Web Part’

Chart Web Part SharePoint 2010

October 12, 2012 Leave a comment

The SharePoint 2010 Chart Web Part is a very useful tool. It has lots of capablity out-of-the box. You can extract data from and Excel sheet and display that data via graphs on a SharePoint 2010 page. This videos shows you how.

Note: the Excel file must be uploaded to a SharePoint document library.

SharePoint 2010 #RSS Feeds

August 13, 2012 2 comments

One of the SharePoint configuration items that I tend to asked about is getting external RSS feeds to work, there are quite a few articles and blogs on the web that talk through specific problems, but I thought I would share my experiences with SharePoint & RSS.

So what is an RSS feed and why might we want to consume it, simply put and RSS (Really Simple Syndication) feed is a way used to publish often updated content in standard format that can be easily consumed. To find out if a site publishes an RSS feed, simply go to it and look for the RSS Feed symbol in Internet Explorer turn from Grey image to Orange image

then just click on the feed button to view the feed address ( examples below use BBC News)

image

and then then view and subscribe to the feed.

image

Also if you are using Outlook and sync with the Common Feed List (the one that Internet Explorer keeps)

image

then the feed will appear in your mailbox as well.

image

What does all this have to do with SharePoint I hear you ask, in a perfect world you would go to your SharePoint site, edit a page, add the RSS viewer webpart, edit the RSS Feed URL property…

image

… and as if by magic the shopkeeper appeared, no sorry wrong story, as if by magic your feed will be displayed…Smile

image

but more often then not you get the error below…Sad smile or something similar.

image

or if you are using the free and rather excellent Bamboo Solutions World Clock and Weather web part http://store.bamboosolutions.com/ps-55-5-world-clock-and-weather-web-part.aspx you might see the error below.

image

This is normally caused by one of 2 problems

Location of Proxy

Type of Windows Authentication used

 

Location of Proxy

If your SharePoint Web servers are located behind a proxy, they will need to know where the proxy is that traffic  needs to go through, to do this updated your web.config for the site in question (if you have multiple WFE’s don’t forget to update each one)

Backup, then edit the <defaultProxy> section to make it look like this.

 

<defaultProxy useDefaultCredentials="false">
    <proxy proxyaddress=”http://YourProxyServer” bypassonlocal="true" />
   </defaultProxy>

 

Type of Windows Authentication

Once you have the settings about in place, the type of authentication in use at the web application level comes into play. If you are using NTLM, then you still may have a problem as your client side credentials will not be passed on your proxy server due the ‘double hop’ issue of NTLM so you can either set a bypass rule on your proxy to allow unauthenticated traffic out or configure your web app to use Kerberos authentication, once that is resolved your web parts should work as per below.

image

#SP2010 web part rounded corners #SharePoint #PS2010 #ProjectServer #MSProject #in

April 25, 2012 7 comments

At one of my clients I was asked to document how we achieved rounded corners on web parts. So as a result, I figured a blog post about it would be useful.

Now when I first implemented this (almost 2 years ago!) as the 2010 product RTM’d, I based it on the only blog post around at the time:

    The end result looks like this:

ChromeTitleAndBorder

NB: Please note that this version is slightly modified from the version supplied on the blog link above.

In my implementation I was using the jQuery version available at the time:

  • jQuery 1.5.1
  • jQuery UI 1.8.13

Although jQuery UI is not required, it is always good to have for those awesome calendar pop-ups just in case.

This may work with the newer versions of jQuery, but I haven’t tried it out yet.

Example CSS, JavaScript and rounded corner image files are provided at the bottom of the post.

So without further ado, lets go through how to achieve the rounded corners in SharePoint 2010:

What does the code actually do?

With every page refresh, the JavaScript code, determines where all the web parts on the page are and injects appropriate mark up (<DIV>) above and below each web part, ready to be styled by CSS.

Step 1. Upload your reference files

Personally I like to store all my custom files within the Style Library within SharePoint, but they can live anywhere within SharePoint as long as all users have read access to them.

So lets take a look at what we are storing.

Standard Plug-In Files:

  • jquery-ui-1.8.13.custom.css
  • jquery-1.5.1.min.js
  • jquery-ui-1.8.13.custom.min.js

You can download this version here:

The latest versions are available here:

Custom Files

  • <custom JavaScript file>.js
  • <custom CSS file>.css

These files are where we will implement the JavaScript and CSS code to produce the rounded corners on each web part.

Corner Image Files

The following files are used to create the rounded corner affect. To keep multi-browser support we are using this method, but you could replace them with CSS3 styling by changing the CSS code to achieve the same result.

  • WPBottomLeft.gif
  • WPBottomRight.gif
  • WPTopLeft.gif
  • WPTopRight.gif

Example files are provide below.

Step 2. Add your Master Page file references

Initially add the following references into <head> section of your Master Page, preferably just before the end tag </head>

<link type="text/css" href="/Style Library/jquery-ui-1.8.2.custom.css" 
rel="Stylesheet" />

<script src="/Style Library/jquery-1.4.2.min.js" 
type="text/javascript"></script>

<script src="/Style Library/jquery-ui-1.8.2.custom.min.js" 
type="text/javascript"></script>

Now the above references are just standard plug-ins available from the jQuery website, but we also need to add some of our own JavaScript / jQuery magic, which of course needs its own reference file.

<script src="/Style Library/<customJavaScriptFile>.js" type="text/javascript"></script>

We also need to reference a custom CSS file, so that we can associate the corner images we will be using etc…

Publishing Feature enabled?

Now if you are using the Publishing feature, you can place your custom CSS via the Site Settings interface:

Site Actions > Site Settings > Under Look and Feel – Click “Master Page”

Under the “Alternate CSS URL”, enter the URL for your custom CSS file, for example:

  • /style library/<customCSSFile>.css
    NB: This will ensure it is the last CSS file referenced within the Master Page to allow for overrides.

Publishing Feature not-enabled?

If you you do not have the publishing feature enabled (Office 365 P1 or SharePoint Foundation 2010 for example), you can add the reference into the Master Page also.

<link type="text/css" href="/Style Library/{customCSSFile}.css" 
rel="Stylesheet" />

Step 3. Adding the code

So now that we have our JavaScript, jQuery and CSS files setup in the Master Page, we can edit out custom files with the following code:

CSS Code (customCSSFile.css)

/* Web Part Chrome Styles – START */

.wpContainer {
padding-bottom:0px !important;
}
.wpTitleBorder, .wpBorderOnly {
background-color:#fff !important;
border-left:1px solid #c6c6c5 !important;
border-right:1px solid #c6c6c5 !important;
}
.ms-WPHeader td {
background-color:#ffffff !important;
border:0 !important;
padding:0 !important;
padding-top: 3px !important;
border-bottom: 1px #CECFCE solid !important;
}
h3.ms-WPTitle {
/* color:#36424a !important; */
font-size:15px !important;
font-weight:normal !important;
margin:-3px 0 0 0px !important;
padding:0 14px 4px 4px !important;
}
h3.ms-WPTitle a {
/* color:#36424a !important; */
font-size:15px !important;
font-weight:normal !important;
}
h3.ms-WPTitle nobr {
white-space:normal !important;
}
.ms-WPHeader td div.ms-HoverCellInActive {
margin:0 !important;
*padding:0 0 2px 0 !important; /* IE <8 fix */
}
.ms-WPHeader td .ms-HoverCellInActive {
margin:0 !important;
*padding:0 0 2px 0 !important; /* IE <8 fix */
}
.ms-WPHeader td .ms-HoverCellInActive img {
margin:0 0 2px 0 !important;
*margin:0 !important; /* IE <8 fix */
}
.ms-WPHeader img.ms-HoverCellInActive { /* Firefox */
padding:0 0 2px 0 !important;
}
.ms-WPHeader td .ms-HoverCellActiveDark {
border:0 !important;
margin:0 !important;
padding:0 0 2px 0 !important;
}
td.ms-WPBorder, td.ms-WPBorderBorderOnly {
border:0 !important;
padding:0px 0px !important;
}
.ms-WPBody {
font-family:Tahoma, arial, sans-serif !important;
font-size:11px !important;
padding:0 !important;
}
.ms-WPBody td, .ms-WPBody TD DIV, .ms-WPBody TD DIV A {
font-family:Arial, Tahoma, sans-serif !important;
font-size:11px !important;
}
.wpCornersTop {
background:url('/blog/Style Library/Images/WPTopRight.gif')
 top right no-repeat !important;
height:10px !important;
padding-right:10px !important;
}
.wpCornersTop div {
background:url('/blog/Style Library/Images/WPTopLeft.gif')
 0 0 no-repeat !important;
height:10px !important;
}
.wpCornersBtm {
background:url('/blog/Style Library/Images/WPBottomRight.gif')
 bottom right no-repeat !important;
height:11px !important;
padding-right:11px !important;
}
.wpCornersBtm div {
background:url('/blog/Style Library/Images/WPBottomLeft.gif')
 0 0 no-repeat !important;
height:11px !important;
}

/* Web Part Chrome Styles - STOP */

JavaScript / jQuery Code (customJavaScriptFile.js)

function wrapWebParts() {

//Find all divs (div.ms-WPBody) with an ID beginning
//with "WebPart". All web parts have unique IDs assigned
//to them, and they begin with "WebPart". Then traverse up
//the HTML document 4 levels and add the class "wp".

  $('td[id*=MSOZoneCell_WebPart]').children("table").addClass("wp");

//For web parts with the Title and Border chrome,
//add the class "wpTitleBorder" to the element
//with class "wp".

  $(".ms-WPBorder").parents(".wp").addClass("wpTitleBorder");

//For web parts with the Border Only chrome, add the class
//"wpBorderOnly" to the element with the class "wp".

  $(".ms-WPBorderBorderOnly").parents(".wp").addClass("wpBorderOnly");

//Find all table cells that have an ID beginning with
//'"MSOZoneCell" and add the class "wpContainer".

  $("td[id^=MSOZoneCell]").addClass("wpContainer");

//For web parts with the chrome type Title and Border or Border Only,
//add containers that can be used for rounded corners and other
//treatments

  //alert($(".wpTitleBorder").length);
  $(".wpTitleBorder").before('<div class="wpCornersTop"><div></div></div>')
     .after('<div class="wpCornersBtm"><div></div></div>');

  $(".wpBorderOnly").before('<div class="wpCornersTop"><div></div></div>')
     .after('<div class="wpCornersBtm"><div></div></div>');

  $("img[src*=/_layouts/images/blank.gif]")
    .attr("style", "display: none;");

  $('div[class=wpCornersBtm]').each(function() {
    var mainWPTable = $(this).prev();
    var inlineWidthStyle = mainWPTable.attr("style");
    var realWidthSplit = "";
    var realWidth = "";

    if (inlineWidthStyle != undefined) {
      realWidthSplit = inlineWidthStyle.split(":");
       realWidth = realWidthSplit[1].toLowerCase();
       realWidth = realWidth.replace("px", "");
       realWidth = parseInt(realWidth, 10);
       realWidth = realWidth + 13;

       $(this).attr("style", "width: " + realWidth + "px");
       $(this).prev().prev().attr("style", "width: "
          + realWidth + "px");
    }

  });

}

$(document).ready(function(){
   wrapWebParts();
});

And Finally…

The end result is this:

ChromeTitleAndBorder

If we break this down, the jQuery code has discovered each web part on the page, added a <div> above and below the web part and then the CSS has styled it with the supplied image files referenced in the style sheet.

WPImageExample

The code also takes into account the chrome type being used on the web part:

This results in the following:

Chrome Type: None

ChromeTypeNone

Chrome Type: Title and Border

ChromeTitleAndBorder

Chrome Type: Title Only

ChomeTypeTitleOnly

Chrome Type: Border Only

ChromeTypeBorderOnly

Code Downloads:

#SharePoint 2010 Media Web Part–Options, FAQ’s and other useful information #SP2010 #PS2010 #MSProject #ProjectServer #SUGUK

October 9, 2011 7 comments

As part of the standard Corporate Project Solutions project management process there always comes a time when you start to communicate the project to a wider audience than the project team, stakeholders and other key users / focus groups.

Typically this will be the time between completion of development / client testing and the go live date of your project.

Now the stakeholders, project members and focus groups will already be up to speed with how the solution works and training will be in place for key individuals as well.  But what do you do when the training budget cannot extend to the whole organisation?  Especially when that organisation could have over a hundred thousand users.

So to ensure that you have appropriate training material in place, you create videos, presentations, documentation and FAQ’s to help aid the user.  This plus an effective search solution can bring down the cost of training and ensure that your users are appropriately informed.

One of the key aspects of this would be to ensure that video material can be played within the web page.  This will allow the user to view the videos inline with the solution and can even be linked directly from the solution.  This is where the SharePoint 2010 Media Web Part comes into play:

image

Through my consulting travels I have found that clients have issues with knowing what is and isn’t supported by this web part.  So this blog post will hopefully shed some light and provide links to useful information.

So lets go through the web part options:


image

Change Media

The media web part supports Audio and Video formats.

Format support:

  • Video: WMV (including VC-1), MP4 (H.264), 3GP
  • Audio: WMA (Standard and Professional), MP3

 

    Supported sources are from within SharePoint or from an external web address:
  • From Computer: The user will be asked to upload the file to a location within SharePoint such as a document library or a site asset library.
  • From SharePoint: The file already exists in SharePoint and you can select the file from a document / site asset library
  • From Address: Allows the user to specify an external web address for example:

image

Change Image

This option allows you to add some presentation to the media web part by showing a picture before the user clicks on the play button.

Format Support:

  • Image: jpg, png, gif, bmp (most common image formats are supported)
    NB: Please note that the picture will not be shown if “Start media automatically” is checked

image

Properties

Title: The summary description for the web part and the video.

Whilst the video is stopped you will see this Title at the top within the web part as well as on the web part chrome.  When you change the title within the Media Web Part the chrome title will be synchronised when the page is saved.

For example:

image

Start media automatically: When this is checked, as soon as the page loads, the video / audio will start.

Loop until stopped: When checked, the media will continue to play until the user stops it via the in-built controls.


image

Player Styles

Styles: Two options are available out of the box, light & dark.

NB: After various bits of research, these styles appear to be part of the Silverlight control and cannot be customised.

image


image

Size Options

Horizontal Size: Changing the width of the media player

Vertical Size: Changing the height of the media player

Lock Aspect Ratio: When checked the horizontal and vertical measurements will be kept in accordance with each other.  So as you adjust the height, the width will change in keeping to maintain the aspect ratio.

NB: Please not that this also updates the width and height properties on the web part

image


So there we go, all the options covered for the Media Web Part.  I know that a number of people have had issues with some of the styling options on the TechNet forums so hopefully this provides a concise view of the options available.

Useful Links:

Media Web Part FAQ: http://blogs.msdn.com/b/sanjaynarang/archive/2010/05/20/media-web-part-in-sharepoint-2010-faq.aspx

Supported Media Formats: http://msdn.microsoft.com/en-us/library/cc189080(VS.95).aspx

Follow

Get every new post delivered to your Inbox.

Join 1,690 other followers

%d bloggers like this: