Many times, SPServices Stories play out on the field of the Codeplex Discussions. As someone posts questions about how to build some of the components of their solution, the overall plan comes into focus.
Over the last week or so, I’ve been helping Oli Howson (@Mr_Howson) in the discussions here and here. As the bits and pieces came to together for me, I thought that Oli’s work in progress would make a great SPServices Story, especially since he took the trouble to write up what he was trying to accomplish in the discussion thread.
Oli’s project is in process, and it’s certainly possible that he will make changes from here. However, I thought it would be useful to post things “as-is” so that everyone could see how he’s going about it. If he makes any significant changes, we’ll try to post them back as well.
If you have any comments for Oli about how you might do things differently, I’m sure he’d be interested. I know I would be.
Oli’s entire bespoke page is shown below, so you get to see the markup, the script, everything.
Custom Quizzing System
I am a teacher – running the ICT and Computer Science department of a South London Academy – we teach both disciplines to 11-18 year olds. For key-stage 3 (Y7, 8 and 9) we have for the last few years set homework on our VLE (Virtual Learning Environment) which had a built-in testing system. Due to that being about the only part of the VLE that wasn’t naff, it was recently retired and a new SharePoint system brought in. It’s got a few bespoke bits, and I am not an admin. Now I’m faced with the dilemma: I have 555-ish students needing their homework setting every week, I deliver all my learning resources via the SharePoint system, but there is no built-in quizzing system. Yes – there are surveys, but they don’t mark and have their own foibles. So I built this JavaScript-based quizzing system.
Methodology
The teacher in charge of setting homework that week creates a multiple-choice quiz on a stand-alone piece of client software I wrote in Delphi. This then creates an array string which it pastes into the quiz template (with a relevant name) and copies the file to the relevant document store in the SharePoint server. The teacher then just creates a link from the homework page to the relevant quiz, and when the kids hit the quiz the results go into the relevant list (created with the same name as the quiz). The difficult bit was making sure that the list was created the first time the quiz is run. The idea is the teacher hits the quiz once the link is up to make sure it has worked. When they submit, it creates the list, adds the columns, and updates the view. The second time it tests if the list exists (it does now!) and just inserts their score, which it also shows to the kids and then closes the window.
Well, I think I’m there! I’m going to get this beta tested by a group of Year 9 students tomorrow, but I’ll put the code below for reference to anyone that might find it interesting. I’m sure I’ve made loads of faux-pas as I’ve written a grand total of about three things in JavaScript, and have very limited knowledge of SharePoint.
Wheeee :)
[important]Code update with Oli’s changes in version 1.1.0 on 2013-02-14[/important]
//alert ('Exists - dont create - just insert data');
47
insertdata();
48
}
49
else {
50
alert('Dont exist');
51
$().SPServices({
52
operation: "AddList",
53
listName: filename,
54
description: "List created for quiz: "+filename,
55
templateID: 100,
56
completefunc: function (xData, Status) {
57
alert('Trying to create list');
58
alert(Status);
59
alert('Now add fields');
60
var nfields = "<Fields><MethodID='1'><FieldType='Text'DisplayName='Score'ResultType='Text'></Field></Method><MethodID='2'><FieldType='Text'DisplayName='TimeTaken'ResultsType='Text'></Field></Method><MethodID='3'><FieldType='Text'DisplayName='CompletedOn'ResultsType='Text'></Field></Method></Fields>";
Updated on the codeplex site – added permissions setter when creating the list, one try only, and a few tweaks.
Have you posted the quizzer system to codeplex as well?