Jumping straight to Web Part Edit Mode

By jwmiller5 at October 09, 2009 00:00
Filed Under: MOSS, jQuery, Articles

I've been building document and form centric web applications lately with SharePoint and InfoPath Forms Services. As you can imagine it's a nice fit, however, one of my requirements has been to strip out all of the SharePoint options for external users, but leave them for internal users who are used to the SharePoint look and feel.

I've been using jQuery to identify areas that need to disappear and making use of the toggle() option. It's quick, I'm not relying on it for security, and it's really nice. I'm going to say that any time you reach for SharePoint Designer, you should use jQuery in a master page or Content Editor Web Part instead.

However, I need to make changes in this daily, and I'm hiding all of the links that would let me edit the page. So I've been relying on the following querystring to jump straight to edit mode. I've trolled through my browser history enough, so now I'm writing it for myself, and for all of you as well.

?PageView=Shared&DisplayMode=Design

SharePoint search-as-you-type with jQuery

By jwmiller5 at September 23, 2009 04:36
Filed Under: Articles, Download, jQuery, MOSS, Search

I remember the first time I saw Google Suggest, it would run the search in real-time and provide a dropdown with possible queries. One of my teammates always joked about making software with one button that would automatically know what you wanted to do. I showed it to him and suggested that Google was getting closer.

I've been working on my presentation for CapArea.NET about jQuery and SharePoint and I knew I would have to demo this search as you type code. The proof of concept was created by Jan Tielens, and the solution was fleshed out by the team at muhimbi. It overrides the default search box and starts returning results as you type. It's super cool and it's all HTML and JavaScript, it's not a web part, and there are no assemblies. Just add this to your master page, and you get a search upgrade.

While I was testing it I realized one thing. This search is using the keyword search. That's not too helpful since no results get returned until you spell out the entire keyword. I ended up using the LIKE operator against the Name and Description to get a much more helpful search that brings up results while you are still spelling the keywords. It required two changes to the javascript.

  1. Changing the query to use the FullText rather than the keyword query.
  2. Changing the jQuery selectors as the return values are different for the different query types.

In addition to this I changed the path to jQuery to load from the 12 hive, and I added some protection against SQL injection in the query.

Update 9/26/2011: David Lozzi has extended this code (and code contributed by several others) to create the Search as You Type Project on CodePlex. I would encourage all of you to take advantage of his hard work with this great project.

jQuery and SharePoint at CapArea.NET

By jwmiller5 at September 09, 2009 10:21
Filed Under: Articles, CapArea, Download, jQuery, MOSS

Here is the presentation, along with links to the sample code, and webcasts presented at the Sep 9, 2009 CapArea.NET SharePoint User Group.