Tag: Customization

Using jQuery to Customize the User Profile Display

The User Profile engine in MOSS Enterprise is pretty powerful.  Out of the box it has some great capabilities and is very easy to setup.  There is support for wide range of field level attributes along with global and personal privacy policies.  The main profile block rendered on the page is very dynamic.

The one big short coming of this approach is a lack of formatting control in the output.  You have the option of a custom display but then you have to try and reproduce all of the logic for each field.

jQuery offers up a nice alternative.  Instead of changing the underlying logic, you can simply adjust what is rendered to the page.

 

Some Background

The organization I’m currently working with uses Skype for collaboration and as their primary IM platform.  Early this year, long before I made the jump to jQuery, I wrote a custom web part that was added to my organizations My Profile page (person.aspx).  Its sole purpose was to show the user’s Skype information, status and some simple Skype commands.  The web part called the UserProfileService in order to grab the SkypeID listed in the profile and then rendered the output.  The web service call was somewhat redundant since the information was already on the page.  The web part worked well, but in the end the Skype info was shown in multiple places, which is not desirable.  It would be best to be able to integrate it into the main profile.  In the time since I have gotten a few other requests to modify the output of certain fields.  I recently took the opportunity to revisit this topic and used the Skype field as the test bed.

 

Step 1 – Create or Identify the field

The Skype ID (SkypeID) field is a simple string field that the user is able to edit.  It is pretty similar to the phone number fields.

 

Step 2 – Write the Script

I’ve referenced the GoogleAPIs library.  I run all of our jQuery scripts off a localized copy to reduce dependencies.  This also depends on a Skype script as well as seen below.

The main selector can probably be improved, but it seems the system consistently sticks with the identification referenced.

Our environment runs with SSL so the status field could not be supported in this implementation.  For implementations where SSL is not used you can grab user’s status by linking an image to this path:  http://mystatus.skype.com/smallicon/skypename







$(document).ready(function() {

var cntID = $("#ctl00_PlaceHolderMain_ctl00_PlaceHolderMain_ProfileViewerValueSkypeID").text()

var mOutput = "   Add   ";

$("#ctl00_PlaceHolderMain_ctl00_PlaceHolderMain_ProfileViewerValueSkypeID").append(mOutput);

mOutput = "Chat";

$("#ctl00_PlaceHolderMain_ctl00_PlaceHolderMain_ProfileViewerValueSkypeID").append(mOutput);

})


Step 3 – Prepare the Web Part

I’ve placed the script in a Content Editor Web Part on another site and then added it to the catalog on the Personalization site collection.  Be sure to set the title, and I recommend setting the Chrome type to “None.”

Step 4 – Add the Web Part the Person.aspx Page

The Web part can now be added to the page.  Its placement really doesn’t matter since it will not render anything to this section.  Once on the page it will show the updated output if the value is present.  If the referenced field is not shown, doesn’t have a value, then it will not modify anything.

Here is a sample.  The “[Add]   [Chat]” links were added which give visitors the option to add the user to their Skype contact list or to initiate a chat with them.

Summary

While this example is pretty simple, it should do a good job of illustrating some of the capabilities developers and customizers now have. In addition, I now have one less web part and assembly to manage on the server.

This same process can be applied to each field to change the connection to the people search, integrate with other systems, or to simply reformat the text returned.

Using jQuery to Update an Item Without A Form

I have been investigating jQuery for about six months now. There are some great examples of it out on the Internet through sources like Paul Grenier’s “jQuery for Everyone” series on End User SharePoint as well as Jan Tielen’s blog. Most of the examples I have seen relate to using it to change style and formatting of standard content. It is definitely good at that with its rich selector formatting.

In a recent project I hit an interesting snag that was ultimately solved by using jQuery. I had an interesting project requirement for a SharePoint workflow solution where the users wanted to be able to cancel a request by simply clicking a button from a list of open requests.

Initially I didn’t expect this to be much of an issue since I had done some DataForms in the past. I ended up finding two limitations to this process though; overriding default values is not easy because the fields are databound, and any changes to any rows are saved on submit of the form. This means that if you do override the field you are looking to change, every row shown in the form would change not just the individual row for the button clicked.

My next thought brought me to building a custom web part to do this. In fact this is something I have done many times in the past for somewhat similar requests. This was not a good option though since the rest of the display could need to change frequently and really should be more dynamic and configurable. In the end the cost to maintain this would be too high.

I decided jQuery was the best solution for this particular project. It gave me the ability to keep the display as a DataView which is easily configurable, and call a script on the page that can perform updates via a jQuery to SharePoint UpdateListItems web service call.

Button placed in the XSLT of a DataView

Script placed in a Content Editor Web Part

In the end, the code was very simple yet effective. As I get a handle on all of the capabilities, I see it becoming more and more central to my development toolkit.

TriSPUG July Presentation – Using jQuery to Build a Document Review Application

I just sent in the details for my proposed presentation for the Triangle SharePoint User Group’s July 7th meeting. The meeting will take place at TekSystems Raleigh and run from 6pm – 8pm.

The presentation is titled Using jQuery to Build a Document Review Application – Intro to jQuery for SharePoint Developers.

I will provide an overview of how jQuery can be used to deploy assembly free code to interact with SharePoint through its web services to create feature rich applications. A brief overview of the currently available CAML tools will also be provided.

I would encourage anyone in the central North Carolina area to attend, and as always feedback is greatly appreciated.

Other Uses for SharePoint Search

SharePoint Search can be used to power much more than just ad-hoc searches. The standard web parts are highly customizable and there is also the option to create your own that leverage either the Search API or web services.

Search Core Results
I really like that the rendering of the results can be completely customized by updating the XSLT. This provides quite a few opportunities for custom uses without having to recreate all the web part’s plumbing.

By using the “Fixed Keyword Query” option you can pass in static queries. This is especially powerful when interacting with the User Profiles in MOSS. I have been working through some uses with this to provide a dynamic department lists that link to the user profiles. In the past I have seen groups use the regular contact lists, but then owners have to duplicate all of the people’s information that is already stored and maintained in the user’s profile.

Interact with Very Large Lists and Libraries
When working with very large lists and libraries, this can also provide a simpler, more responsive interface making it much easier for users to find what they are looking for.

Summary
Spend some time in the sandbox to get a better idea of the available capabilities. I think you will quickly see how they can be applied to your environment and your projects.

Impact of SharePoint Designer Free Distribution

This week it was announced that SharePoint Designer 2007 and future versions are now freely distributed.

Announcement

Download

The developer community was quick to applaud the news since this is a useful tool, but I assume also because getting software purchases approved in the current economy is difficult at best even in stable companies.

The news however brought a different set of comments from the system administrators and IT management folks who are worried about what the ramifications will be. They are right to be worried. Many companies are already struggling with governance and end user site ownership issues. With that in mind I think it gives them that much more incentive to get their policies, procedures, and training plans in order.

From a Program Management perspective, I think it is critical to the platform to enable end user groups to design, manage, and interact with their own content. That includes maintaining their own access control lists (ACLs), libraries, lists, and design their own workflows. I see SharePoint Designer as an extension of the platform, not much different than MS Word or Excel. Site Owners and Designers need to be able to manage this in most situations.

In a medium to large organization it would take an army of IT team members to manage this for every group, it is just not feasible and not the purpose of the SharePoint platform.

So how should you proceed?
Governance – Address custom design and development in your Governance plan. Determine who can have it, and what it can be used for.

Training – Address its use in your training plan, and make sure that Design and Developer resources are available. Perhaps you can pick up a copy or two of Professional Microsoft Office SharePoint Designer 2007 (Wrox Programmer to Programmer).

SharePoint Designer Collaboration Site – Provide site owners with a place to collaborate and provide guidance. You can include samples, links, and FAQs to help them.

Through proper governance you can help guide their decisions and enable their success. Their success and approval leads to the success of the platform in your organization.

What can be done to prevent use of Designer?
Installation – For now you can look at local computer policy and prevent installation of unapproved software. For people in companies that already do this, they know that it takes a lot to manage that.

Security – You can also review site security and make sure that the appropriate set of users have access to make changes.

Disable at the Site Level – There is some work in the community right now to come up with a solution to prevent specified sites from being changed or customized with SharePoint Designer.

UPDATED: John Ferringer and Brian Farnhill have posted a Beta for the project, setup as an HTTP Event Handler to block SP Access. It can be found here: No SPD HTTP Event Handler.

What is your response to the news? Excited, terrified? Post a comment!

The Importance of a Content Syndication and Aggregation Plan

One of the keys to managing a successful SharePoint implementation is having a Content Syndication and Aggregation Plan. Address the plan early in the design process to avoid more difficult changes later in the life of the system.

The plan should cover:
Content Locations – Helping users develop a methodology for where to locate content (Centrally / Group Level) and how to aggregate it when needed.

Role of Content – Is the content to be consumed (read) or updated? Content that needs to be modified from remote locations needs to be handled differently.

Content Types – By thinking about the content and content types early on in the process data can be addressed in a consistent way which will make it easier for people to understand and easier to aggregate the data thanks to common structures.

Why is a plan needed?
As Site Collections continue to grow in scope and size it will become clear that different groups need to work with the same data or that the same data has relevance in more than one context. The promise of collaboration tools like SharePoint is that they can deliver targeted information in specific places instead of making users visit dozens of different sources. One of the frequent complaints that I hear is that related data is in too many disparate sites, with another being that files are copied to multiple sites where they are consumed.

What are the methods for syndication and aggregation?
Really Simple Syndication (RSS) – Most people have a good understanding of what RSS is and how it can be used to pull content into the sites, but not all realize that they use it to share data within SharePoint sites.

As the full name suggests it is Really Simple, but that also means there can be some limits to what it can be used for. I tend to use it for communicating simple data like News, Announcements, and of course Blog updates.

Web Parts – With this approach web parts are configured to include data from one or more sources for display somewhere else. This can be done with a DataView configured in SharePoint Designer or with the Content Query Web Part (CQWP) if you have MOSS. One limit with these two options is that data must exist within the Site Collection; it cannot access data outside of that boundary.

Another option is a custom web part or a third party “Rollup” web part that provides similar functionality but offers the ability to access the data via a web service call opening up the data from any accessible SharePoint site.

Document Link Content Type – If the “Document Link” content type is added to the document library, it will enable the sites user’s to put a shortcut/link in the document library that points to the document’s source location. This is a simple, but effective way to list documents in more than one library without the storage overhead or the confusion around which is the correct location to edit the document.

Publishing – The MOSS Publishing features support configuring a Custom Send to Destination within the library’s Advanced Settings. This provides a mechanism for pushing documents from a source to a destination library which really comes in handy with a document control process that separates the Work in Process (WIP) library from the document library users consume information on.

Content Synchronization – There may be instances when you need to be able to synchronize data or files to another farm or site collection. Examples would include pushing content from an internal system to an extranet or visa versa. There are a few third party solutions that can help facilitate this, or a custom solution can be developed.

Examples of where it can be used.
Here are some common examples that I’ve run into:

  • Company Holidays and Calendar
  • Common Company Forms
  • Policies and Procedures
  • Project Information and Summary Status Reports

Summary
SharePoint has a great foundation for content syndication and aggregation. By developing your plan early in your design and communicating it to your community it will help shape design decisions and educate users on how to maximize the effectiveness of the content sharing. All of this will help avoid user frustration and lead to wider end user adoption and satisfaction with content that proves to be much more portable.

%d bloggers like this: