in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

Points-of-Sharing

All about SharePoint...

Employee Training and Scheduling Template - a couple fixes Part 2

On the last post regarding this template (see Part 1), I gave a walkthrough on how to fix the "Available Seats" variable when a user unregisters from a course so that the variable would increment.

This time I'm going to give a walkthrough on the simple fix to make it so when a user has registered for multiple courses, when they attempt to unregister from an event through the "Courses I am attending" webpart, they actually get removed form the correct course Party!!!

There is an error in the XSL for the web part that makes it so when the "Remove" link is clicked, it choose whatever course is listed first and not the specific one that lines up with the "remove" link.

For example:  if you had three courses on the list and you clicked "remove" on the second one...it would actually remove you from the first course that was listed (because it was displayed first on the list) instead.

 

The walkthrough for this is really pretty simple to do, so I'm not going to use screenshots for this one...I'll just walk you through.

Open the "XSL Editor" for the "Courses I am attending" webpart.
Copy/paste the contents into NotePad (or editor of your choice).
Search for the "remove" link (it's in a "td" tag a little past halfway down in the document).
Replace the contents of the "td" with the following:

Change from:

<td class="ms-vb">
    <a href="Lists/Registrations/Unregister.aspx?ID={../../../Registrations/Rows/Row/@ID}" mce_href="Lists/Registrations/Unregister.aspx?ID={../../../Registrations/Rows/Row/@ID}">Remove</a>
</td> 

To:

<td class="ms-vb">
    <xsl:variable name="CourseID" select="@ID"/>
    <a href="Lists/Registrations/Unregister.aspx?ID={../../../Registrations/Rows/Row[@Course_x0020_ID=$CourseID and contains(@Author, $UserID)]/@ID}">Remove</a>
</td>

This adds a section that will match up the "Remove" link to the ID of the actual listing and make the removal work correctly.

****Thanks to Yannis on MSDN Blogs to pointing out this fix.****

Comments

 

SharePoint 2007 link love 09-20-2007 at Virtual Generations said:

Pingback from  SharePoint 2007 link love 09-20-2007 at  Virtual Generations

September 20, 2007 3:48 AM
 

Links (9/20/2007) « Steve Pietrek’s SharePoint Stuff said:

Pingback from  Links (9/20/2007) &laquo; Steve Pietrek&#8217;s SharePoint Stuff

September 20, 2007 7:41 PM
 

Brad S. said:

To get this to work you need to:

a) remove the extra "/" from "Rows//Row"

b) remove the capitalization from "Contains" in "Contains(@Author"

October 16, 2007 6:22 PM
 

dink said:

Brad,

You are correct on the syntax change...must have type-o'd somewhere along the line.

I have updated the post.

Thanks,

- Dink

October 25, 2007 2:20 PM
 

Mirrored Blogs said:

Fantastic 40 Employee Training and Scheduling Template - a couple fixes Part 1 Employee Training and

April 3, 2008 4:03 AM
 

Manny said:

Thank you so much for posting this. Now it alsmot works perfectly, except for the permissions. I still have ti set so that everyone's a contributor everywhere. It just wouldn't work otherwise.

June 6, 2008 1:11 PM
 

dink said:

Manny,

Once I have time (the eternal struggle), I'm planning on a "Part 3" that covers the customizations that are needed to take in account for permissions and how to make it "appear" that the users can only register and not contribute to areas that we wouldn't want them to.

I've been meaning to get this done, just haven't had the time yet...but it will be coming, I promise :)

- dink

June 6, 2008 1:21 PM
 

Sara said:

Hi,

I used this code to replace the td tag. But for me it does not remove any courses. This didnt help me either. I cant find anywhere how to remove a course i am an admin on the site and i cant even remove any course...?

July 15, 2008 1:55 PM
 

Sara said:

Thank you for this code! This helped me to remove the correct course. Earlier I was not able to remove anything but now after some other modifications I can. Yes that would be great if you can show us how to only give users to register/unregister or view the courses but not delete course etc.

Thanks!

July 17, 2008 4:17 PM
 

Points-of-Sharing said:

Took me long enough to get this post up, but it&#39;s finally done (hopefully - please let me know if

July 24, 2008 6:11 PM
 

FearlessFreep said:

Remember to include the &amp;Source=http://your referring page] string when you place in the XSL, otherwise users get bounced to the AllItems view of the Registrations list (not good).

July 28, 2008 1:47 PM
 

Jeannie said:

The last post said to include the &amp;Source=http://your referring page] string in XSL to keep users from getting bounced to the Allitems view of the Registrations list.  This is happening to me and I would like to change.  Where exactly in the XSL do I need to add this?

July 29, 2008 10:23 AM
 

Jeannie said:

I figured out the answer to my question above.  You just add it to the end of href="Lists/Registrations/Unregister.aspx?ID={../../../Registrations/Rows/Row[@Course_x0020_ID=$CourseID and contains(@Author, $UserID)]/@ID}">.  Works great...thanks!

July 30, 2008 12:32 PM
 

Todd said:

Dink,

 Is there way to have a single user add other user to the class.  We have some employees who don't have intranet access and want to have the managers be able to add users to a class.

August 7, 2008 3:29 PM
 

dink said:

Todd,

Not directly...this template is designed to allow users to register themselves and not for others to register them.

You could probably add in this functionality though by seeing if you can create a custom workflow to handle adding in users to the registrations lists.

Not sure on the specifics of the WF, but that's where I'd suggest starting...although, it'd most likely have to be a custom Visual Studio WF since you'd have to deal with the user "context" problem - all activites in the template are based on the "current" user context, and WF's designed in SPD cannot run under the context of a different user other than the one that initiated the WF.

Hopefully that helps some,

- Dink

August 7, 2008 6:13 PM
 

Scott said:

RE:

The last post said to include the &amp;Source=http://your referring page] string in XSL

Can you please provide an example what this looks like?? is it after the >Remove</a> or before?

Sorry I'm not a code jocky!! (",) just a rookie

August 14, 2008 7:53 PM
 

dink said:

Scott,

You'll want to add it in as part of the URL in the section just before the closing quote (before the text "Remove").

Like this:

<a href="Lists/Registrations/Unregister.aspx?ID={../../../Registrations/Rows/Row[@Course_x0020_ID=$CourseID and contains(@Author, $UserID)]/@ID}&amp;Source=http://<Your page here>">Remove</a>

The "Your page here" section refers to where you want them taken after unregistering (as opposed to the "AllItems.aspx" page).

Also, dont include the "]" (bracket) in the page url.

Add it in as:

&amp;Source=http://your referring page

not:

&amp;Source=http://your referring page]

When I get a chance, I'll update this post to include this section.

- Dink

August 18, 2008 1:43 PM

Leave a Comment

(required )  
(optional )
(required )  
Add

Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts