SharePoint Blogs / SharePoint University
SharePoint Blogs and SharePoint University - all in one place!
Need SharePoint Training? Attend a SharePoint Bootcamp!

Please delete cookies related to sharepointblogs.com and sharepointu.com to resolve login issues!

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 from the correct course

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.****


Posted 09-19-2007 2:11 PM by dink

Comments

SharePoint 2007 link love 09-20-2007 at Virtual Generations wrote SharePoint 2007 link love 09-20-2007 at Virtual Generations
on 09-20-2007 3:48 AM

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

Links (9/20/2007) « Steve Pietrek’s SharePoint Stuff wrote Links (9/20/2007) &laquo; Steve Pietrek&#8217;s SharePoint Stuff
on 09-20-2007 7:41 PM

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

Brad S. wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 10-16-2007 6:22 PM

To get this to work you need to:

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

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

dink wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 10-25-2007 2:20 PM

Brad,

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

I have updated the post.

Thanks,

- Dink

Mirrored Blogs wrote SharePoint Kaffeetasse #53
on 04-03-2008 4:03 AM

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

Manny wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 06-06-2008 1:11 PM

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.

dink wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 06-06-2008 1:21 PM

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

Sara wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 07-15-2008 1:55 PM

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...?

Sara wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 07-17-2008 4:17 PM

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!

Points-of-Sharing wrote Employee Training and Scheduling Template - a couple fixes Part 3
on 07-24-2008 6:11 PM

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

FearlessFreep wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 07-28-2008 1:47 PM

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).

Jeannie wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 07-29-2008 10:23 AM

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?

Jeannie wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 07-30-2008 12:32 PM

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!

Todd wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 08-07-2008 3:29 PM

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.

dink wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 08-07-2008 6:13 PM

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

Scott wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 08-14-2008 7:53 PM

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

dink wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 08-18-2008 1:43 PM

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

eric wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 04-14-2009 1:46 PM

Hmm, I've made the modifications you've specified, but it's still incrementing the ID 1 higher than it should be.  I moved all these web parts to a separate page and updated the URLs to point to the appropriate lists, but ={../../../Registrations/Rows/Row[@Course_x0020_ID=$CourseID and contains(@Author, $UserID)]/@ID} is still not right.

Any Ideas?

eric wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 04-15-2009 9:59 AM

Ah nevermind, I see whats going on.  The code I had above did work as it should after adding the ../ before lists.  I thought the ID it was passing was the Course ID and User ID but in actuality, it is passing the actual default ID column value to the unregistration list.

All is well.

Iain Stephen wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 05-05-2009 1:26 PM

I am just plain frustrated - I have the changes in steps one and two applied - have read all the posts - but I am still unable to 'unregister' from a course...  

If anyone can help me get this up and running I would be happy to pay a fee...  drop a reply with contact info in and I will get back to you right away.

Bill wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 05-05-2009 4:21 PM

I have done all the steps and still the Remove link does not work.  Are there security rights that need to be set?

dink wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 05-05-2009 4:52 PM

Iain and Bill,

Couple of things to look at:

1. What errors (if any) are you seeing when trying to unregister?

2. Verify that have modified the "Remove" link xsl to include the changes I mention in this article.

3. Does the url change when hovering over the "Remove" link?  The "ID" portion of the url should be different for each "Remove" link.

Example:

/Lists/Registrations/Unregister.aspx?ID=3

/Lists/Registrations/Unregister.aspx?ID=4

/Lists/Registrations/Unregister.aspx?ID=5

If not, go back and redo the xsl.

4. Did you also update the workflow detailed in "Part 1"?

5. Verify that have setup permissions correctly based on the details listed in "Part 3".

I'm sure it's something simple that causing the issue for each of you.  I've set up sites based on the template many times for my users and the one thing I know is that if you accidentally skip something along the way, that little thing will come back to bite you.

The best advice I can suggest is to start from scratch and re-deploy the template, then work through the customization steps slowly and carefully to make sure that you dont skip anything.

I realize that this is frustrating, believe me.  It took me a long time to collect all of the information I've written about in these three articles in order to make this template "functional".  I just with they would have released it with these (and other obvious suggested fixes) already implemented.

- Dink

Iain Stephen wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 05-06-2009 7:40 AM

Hello,

Ok - Thank you so much for answering.

I followed both steps to the letter (step 3 is another day)...  I modified the workflow as in step 1.  That went smoothly and ended up exactly as per your screenshots - as for step 2, I pasted the exact text of your replace this with that section - and I noted that you had commented that it had been updated to remove a slash and to replace an upper case c with a lower - so it should work?  What I'm not clear on is that the text you indicated to look for - was not exactly what you had in your post - but it was close...  it looked like this (only instance of 'remove' in the text)..

<td class="ms-vb">

<a href="Lists/Registrations/Unregister.aspx?ID={../../../Registrations/Rows/Row/@ID}">Remove</a>

</td>

Perhaps this script is different?  I replaced it with:

<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>

The remove link URL does change when I mouse over it - it just doesn't do anything...??

Iain Stephen wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 05-06-2009 7:43 AM

I should have mentioned that I have deleted and re-created this site following the instructions 3 times - the end result is the same each time.

I was thinking step 3 was not necessary to have a functional model - just to limit permissions on who can create courses etc.?

Iain Stephen wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 05-06-2009 9:04 AM

One other comment - as I mentioned - I am willing to pay to get this template functional - who do I call/contact?

dink wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 05-06-2009 11:17 AM

Iain,

All you need to do in order to test this is the following ( I just did this myself about two minutes ago):

Create site from template.

Add 2 new courses: "Course1" and "Course2".

Open the "Courses I am attending" webpart and open its "XSL Editor".

Copy/paste its contents into notepad and search for the text "Remove".

Replace the entire cell it resides in with the updated html:

Old:

<td class="ms-vb">

   <a href="Lists/Registrations/Unregister.aspx?ID={../../../Registrations/Rows/Row/@ID}">Remove</a>

</td>

New:

<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>

Register for the two courses you created then try unregistering for one of them.  

Clicking the "Remove" link should take you to the confirmation screen to unregister and after clicking "OK" on that screen, you should be redirected to the "Registrations" list that will display any current registrations - your item should either be processing the "Unregistration" workflow, or already have completed.

Going back to the home page, the "Courses I am attending" webpart should now only display the courses you're currently registered for (or be blank if you had only registered for one course earlier).

All of this is done from the OOTB template with only making the single modification to the XSL - at this point it should be working.

The remainder of the "Fixes" will take care of updating the seat count, etc. (including setting custom permissions in step3 as you mentioned).

And, you are correct in the difference in what I have posted in the article as opposed to what is in the XSL in the default template.  I think its was because I had some other customizations in mine (been a long time since then).  Just use the above steps as it should be accurate.

Try the above steps and post back with your results.

- Dink

(Also, "pay" is not neccessary...this is a community blog, and although I dont post articles near as often as I'd like to, this is all in an effort to help out those that need it...plus I just dont have the time to take on new projects outside of my normal work)

Iain Stephen wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 05-06-2009 2:09 PM

Hi,

First - Thank you for your contribution to this blog - I really appreciate people taking the time to help when they can.

I created an entirely new site - then added a new Employee Training site from there - and followed your steps above - I'm afraid I end up with the exact same issue.  When I unregister nothing happens to either course.

It does take me back to registrations instead of all items - but other than that - no difference.

Is there a service I need to enable on the site for this perhaps?  I must be missing something.

dink wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 05-08-2009 4:56 PM

Iain,

I'm not sure what else could be the problem in this case.  Each time I've tested by starting over (new site collection, fresh download of the template, new site created from the template), all I've had to do is just perform the steps I detailed in order to get the "Remove" portion to work.

You might want to open the site through SPD and verify that the workflows exist (no workflows = no removal).  Also, what's the "context" in which you're running the site?  Are you accessing it as an administrator?  (might as well try with server farm permissions - start with highest level, then work your way down from that to see if its a permissions thing).

The only other thing I could suggest (although I'd hate having to do this myself) would be to create the functionality of the site yourself by following the template creator's walkthrough series on msdn.blogs

Part 1: blogs.msdn.com/.../training-site-template-part-1-introduction.aspx

Part 2: blogs.msdn.com/.../training-site-template-part-2-workflows.aspx

Part 3: blogs.msdn.com/.../training-site-template-part-3-custom-views-and-forms.aspx

I know its a bit of a pain to have to duplicate it, but that might be the last resort if you cant get it to work by any other method.

I'll think about it some more as well to see if I can come up with anything else for you to check...I'll post back if I can find anything.

Sorry I couldn't help more,

- Dink

Iain Stephen wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 05-11-2009 12:58 PM

Any chance your template and mine are in some way different?  Is it possible to get you to post your fully working template (steps 1 and 2) for download?

dink wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 05-11-2009 4:23 PM

Iain,

Unfortunately, it wouldn't work if I tried to save it as a template for you.

The way that SPD workflows work is that they are not attached to an individual list template, rather they get attached to a list "Instance".  Because of this, they aren't really "Portable" in the same sense that list "templates" are.  Saving a site that has SPD workflows attached as a template, will not include the workflows.

Having said that however, there is a kind of "hack" that you can use to lessen the time it takes to re-create workflows from list to list (or site to site).

See this: nickgrattan.wordpress.com/.../applying-a-sharepoint-designer-workflow-to-multiple-lists

And this: www.sharepointblogs.com/.../reparenting-a-workflow-to-a-different-list.aspx

For options of copying over workflows piece-by-piece.  The only issues I've had in these approaches is that you'll have to go back in and re-associate some of the variables and fields in the workflow due to the GUID change of moving from one list/site to another.  Still doesn't take too long, but you'll need to know this if you want to go this route.

Also, just to cover all bases - I re-downloaded the template from MS this afternoon and deployed it to a new farm.  Once uploaded, I went through the customization steps I listed out in Part 1 and Part 2.  After performing these, the site worked as it should with the unregistration process functioning fine.

I've tried this in WSS 3.0 and in MOSS2007, each with no service packs installed, and each with SP1 and SP2 installed (6 different configurations) and it worked fine each time.

Not sure what else to tell you.

- Dink

Iain Stephen wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 05-26-2009 9:42 AM

Ok - it is now resolved - it was a combination of the service account in question (after applying one of the hotfixes the admin account doesn't work anymore) and SP1 not letting the triggers work.

dink wrote re: Employee Training and Scheduling Template - a couple fixes Part 2
on 05-26-2009 9:56 AM

Iain,

Good to hear you got it working now.

- Dink

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Need SharePoint Training? Attend a SharePoint Bootcamp!
Posts (c) their respective authors. Everything else (c) 2009 SharePoint Experts, Inc.