SharePoint Designer \ Data Form Web Part context menu bug - itaysk

SharePoint Designer \ Data Form Web Part context menu bug

Posted Wednesday, May 07, 2008 11:54 AM by Itay Shakury

Update: Read the follow up post for a permanent fix to this bug: SharePoint Designer \ Data Form Web Part context menu bug - Part 2

Update 2: There is a hotfix that automates this fix: http://blogs.microsoft.co.il/blogs/itaysk/archive/2008/11/18/sharepoint-designer-data-form-web-part-context-menu-bug-part-3.aspx

This bug was confirmed by Microsoft after we opened a "Severity A" issue on it. The original response from the support guy was : "oh my god!" :) because this kind of bugs are really easy to track down in a superficial QA testing. Eventually the support guys couldn't help us and registered that as a SharePoint Designer bug. But worry not - Itaysk to the rescue..

Problem:
You try to use a Data Form Web Part (Data View Web Part) to display a document library in an XSLT view. You find out that the context menus for list items are identical for all items, even tough you know they should be different.

Steps to reproduce:

  1. Create a document library. Add at least 2 items to the document library, modify the permissions for one item to read only.
  2. Notice that each item has a different context menu.
    ctxbefore
  3. Open SharePoint Designer 2007, and browse to the document library. Open the page you have just viewed (Forms\Allitems.aspx)
  4. In design mode, right click on the document library web part (List View Web Part) and click on "Convert to XSLT view".
    convertxslt
  5. Save the page, and open it in browser.
  6. Notice that now all the items share the same context menu. In fact, it is the context menu for the first item in the list.
    ctxmiddle

Cause:
This behavior is caused by the XSLT code that SharePoint designer generates for the document library.
When each item is rendered, the current user's permission for that item is written in the HTML code for that item. It is represented by the "Perm" attribute of the table that contains the item.
When the user clicks on the item in order to open it's context menu, SharePoint looks for that "Perm" attribute and renders the menu accordingly.

Now, the XSL code that SPD generates writes wrong values into this "Perm" attribute. It uses the "CurrentRights()" function of the "ddwrt" namespace, and apparently this method doesn't not work well here.

permattbefore

Solution:
Use the "PermMask" property instead of the "CurrentRights()" function:

  1. Open SharePoint Designer 2007 and navigate to the page containing the Data Form Web Part. (follow the "Steps to Reproduce" above)
  2. In Code view,search for the following peace of code:
    Perm="{ddwrt:CurrentRights()}"
  3. Replace it with the following peace of code:
    Perm="{@PermMask}"
  4. Save the page.

That's it, now browse again to that page you have just modified, and see for yourself - each item has it's own, correct, security trimmed, context menu.
ctxafter

Comments

# re: SharePoint Designer \ Data Form Web Part context menu bug

Wednesday, May 07, 2008 5:41 PM by Lior Arviv

Good to know :)

# re: SharePoint Designer \ Data Form Web Part context menu bug

Wednesday, May 07, 2008 7:29 PM by Penny Coventry

Great fine and well explained.

# re: SharePoint Designer \ Data Form Web Part context menu bug

Wednesday, May 07, 2008 7:42 PM by Elad Khalo

Itay, your'e the best!

# SharePoint Kaffeetasse #64

Friday, May 09, 2008 9:11 AM by Mirrored Blogs

SharePoint und Web 2.0 SharePoint Wikis are Awesome, I Swear SharePoint Wiki vs. MediaWiki Tipps Measure

# re: SharePoint Designer \ Data Form Web Part context menu bug

Thursday, June 12, 2008 11:55 PM by Zullu

That is wierd, but you definitely have the solution.

Kudos to you Itay.

# sharepoint designer forms

Friday, June 20, 2008 4:49 PM by sharepoint designer forms

Pingback from  sharepoint designer forms

# SharePoint Designer \ Data Form Web Part context menu bug - Part 2

Friday, July 11, 2008 11:26 PM by itaysk

In one of my last posts I wrote about a bug that we found in SharePoint Designer's 2007 Data Form

# re: SharePoint Designer \ Data Form Web Part context menu bug

Tuesday, July 15, 2008 2:43 PM by Encuctimbunc

I don't say we all ought to misbehave, but we ought to look as if we could.--Orson Welles, (1915 - 1985), U.S. actor/director

# re: SharePoint Designer \ Data Form Web Part context menu bug

Wednesday, July 16, 2008 11:31 AM by unsulk

Your friend is that man who knows all about you, and still likes you.--Elbert Hubbard U.S. editor/publisher

# re: SharePoint Designer \ Data Form Web Part context menu bug

Wednesday, September 17, 2008 4:40 PM by Russ K

I think there are several other bugs in the context menu.  "Add to My Links" is not there in a ListView (I'm using WSS, not MOSS"), but it shows up after converting to a DFWP because ctx.PortalUrl is set to "web" instead of "".  If your library has versioning enabled, a menu item "Version History" exists before the conversion to DFWP, but not after.  The XSLT to set ctx.verEnabled doesn't work.

The bug you mention above also causes the Manage Permissions menu item to disappear after conversions (assuming you had enough rights to see it before the conversion!).  This fixed the problem for me - prefix 0x to the Perm attribute: i.e. Perm="0x{ddwrt:CurrentRights()}", but your fix is cleaner.

The toolbar formatting changes during conversion also - some classes change and background images go away.

The css classes generated for DocIcon and Name (with edit menu) columns also change.

Have you seen issues like these?  Anyone?

# WSS 3.0 & MOSS: Recopilatorio de enlaces interesantes (XXI)!

Tuesday, September 23, 2008 5:44 PM by Blog del CIIN

Una vez más, os presentamos el recopilatorio (con periodicidad mensual) de recursos interesantes que

# WSS 3.0 & MOSS: Recopilatorio de enlaces interesantes (XXI)! « Pasi??n por la tecnolog??a…

Pingback from  WSS 3.0 & MOSS: Recopilatorio de enlaces interesantes (XXI)! « Pasi??n por la tecnolog??a…

# SharePoint Designer \ Data Form Web Part context menu bug - Part 3

Tuesday, November 18, 2008 1:29 PM by itaysk

This is an update and closing post for the SharePoint Designer \ Data Form Web Part context menu bug

# 22+ tipps for SharePoint Designer - now a free tool

Thursday, April 02, 2009 11:08 AM by Michael Greth MVP SharePoint Blog

Die Gerüchte, die schon in den letzten Tagen durch die Blogosphäre geisterten, haben sich bestätigt:

# re: SharePoint Designer \ Data Form Web Part context menu bug

Wednesday, July 01, 2009 4:34 AM by Michael

Hi,

Would you like to drive more traffic to your website?

Delivering promotions to your current clients can generate you great income at an afforable price.

Main reasons why work with us:

Results - will get all of your emails delivered to your clients' inbox.

Economical - low prices and the best ROI you can get when marketing online.

Automation - lists management, campaigns scheduling, statistics and autoresponder.

Optimized Design - design your newsletter online, preview and test deliverability.

For more information please visit http://www.mailer365.com

Thanks,

Michael.

# re: SharePoint Designer \ Data Form Web Part context menu bug

Tuesday, December 01, 2009 9:07 PM by Rudy

Hello,

My name is Rudy and after examining your website, I believe I can help you improve your Search Engine Rankings.

Do you wish you could increase your online leads? Getting much more traffic from search engines?

It is much easier and more cost-effective than you might think. For as low as $99 we have helped a lot of businesses thrive in this market and we can help you!

Mail me at seo.rudy@gmail.com if you are interested in outranking your competition. I will contact you back, after an examination, with an analysis and recommendations.

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: