Assignment Drop Box (new assignment type)

Assignment Drop Box (new assignment type)

by Oksana Delgado -
Number of replies: 48
I have posted this code in another thread (http://moodle.org/mod/forum/discuss.php?d=37883&parent=201026) quite some time ago. But I think it deserves it's own discussionsmile

This is a new assignment type which I developed here at Athabasca University to meet our requirements. As a base code I was using "Upload&Review" and "Upload files" assignment types.

It still has name "AU assignment type" which can be changed into "Upload&return", "Assignment Drop Box", etc

Some of our main requirements were:

- ability to upload multiple files (for student)
- ability to manage files before submitting them for marking. for example, delete and upload another file (for student)

- ability to upload multiple feedbacks (for teacher)
- ability to return assignment to student (for teacher)

- assignment needs to have statuses (Blank, Draft, Submitted, Marked, Returned)


More information about this type can be found here http://webunit.cs.athabascau.ca/moodle/au_adb_functionality/

Zipped code can be found here
http://webunit.cs.athabascau.ca/moodle/moodle_files_folder/AU_type.zip/file_view

Please feel free to test it and post feedback

Cheers,
Oksana
Average of ratings: -
In reply to Oksana Delgado

Re: Assignment Drop Box (new assignment type)

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Many thanks for sharing this code with us. I took a preliminary look at it previously and very much liked its functionality. One question, the code you have in the zipped file is it meant for version 1.5 or 1.6 or both?
In reply to Anthony Borrow

Re: Assignment Drop Box (new assignment type)

by Julian Ridden -
This works just fine in 1.6
In reply to Julian Ridden

Re: Assignment Drop Box (new assignment type)

by Oksana Delgado -
I have tested it only for version 1.5.3 so far
Julian thank a lot for tsting it in 1.6. I didn't have time to do it yet
In reply to Oksana Delgado

Re: Assignment Drop Box (new assignment type)

by Art Lader -
Hmmmm... Sounds great, but I am doing something wrong.

When I try to use this, I get the following error message: "Fatal error: Cannot instantiate non-existent class: assignment_au_type..."

I just unzipped this and dropped it in with the other assignment types. Is there more to it than this?

Perhaps I have put this in the wrong place. Screen capture attached.

Thanks,
Art

Attachment AUTYPE.gif
In reply to Art Lader

Re: Assignment Drop Box (new assignment type)

by Art Lader -
Here is the entire error message: "Fatal error: Cannot instantiate non-existent class: assignment_au_type in /home/aiken/public_html/moodle16/mod/assignment/details.php on line 28"

I do not see a file named "details.php" in the assignment folder.

-- Art
In reply to Art Lader

Re: Assignment Drop Box (new assignment type)

by Miroslav Fikar -
I ran to the same problem. The solution is to rename the folder to AU, not AU_type.
In reply to Miroslav Fikar

Re: Assignment Drop Box (new assignment type)

by Art Lader -
Thank you, Miroslav. That worked like a charm. smile

-- Art
In reply to Art Lader

Re: Assignment Drop Box (new assignment type)

by Oksana Delgado -
Oups... sorry for this confusion
I'll update zip file tomorrow (i'm away from my office today)
In reply to Oksana Delgado

Re: Assignment Drop Box (new assignment type)

by Art Lader -
No problem, Oksana! Thanks for sharing. smile

-- Art
In reply to Oksana Delgado

Re: Assignment Drop Box (new assignment type)

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
First, thanks for the great work on this assignment type. My initial testing went very well and I went ahead and put it on my production server to give it a more thorough testing although it is unlikely that much will happen over the summer. I would like to see a readme or an install file that explains where which files should go. I think some of the ambiguity could be taken care of my including the paths in the zip file. In other words, create a /mod/assignment/type/au folder in the zip file. I think there is also a language file if I remember correctly that should be in /lang/en-utf8 (for 1.6). It should be clear which version the code is ideally being maintained for. I have found this idea of keeping the folder paths specific helpful with CVS as well. It allows a user to unzip the file and then copy everything over into their moodle folder. Knowing the version that the code is intended to be used with is helpful and should be (IMHO) included either in the README file or by having version tags in CVS. 
In reply to Oksana Delgado

Re: Assignment Drop Box (new assignment type)

by Miroslav Fikar -
Thanks for the block. I hope it will find its way to official moodle distribution soon.

Possible bug:
with server not connected to net I get the following message repeated immediately after each successful file upload (for each site admin):

ERROR: SMTP Error: The following recipients failed: mail_of_our@moodle_admins

In reply to Miroslav Fikar

Re: Assignment Drop Box (new assignment type)

by Miroslav Fikar -
Some other possible bugs?
  • file deleteonesubmission.php should have <?php instead of <? on the first line
  • As a teacher, I cannot delete some files that I have uploaded. Here is the message, probably visible only on Windows platform:
    Warning: unlink(C/www/moodledata/43/moddata/assignment/409/responses/6/6/xx.doc)
    [function.unlink]:
    No such file or directory in C:\www\www\moodle\lib\filelib.php on line 356
    The following has not been deleted:
    C/www/moodledata/43/moddata/assignment/409/responses/6/6/xx.doc
    Clearly, something is eating the colon in C:/
  • I keep getting undefined language strings: responsesfromteacher, allowmultiple, emailstudents, uploadsuccessresponse. Should these be added to assignment or my installaction lacks some standard files?
  • Some hard-coded strings:
    Submission status, Returned, Choose a file to upload as an assignment review:, Response File:
In reply to Miroslav Fikar

Re: Assignment Drop Box (new assignment type)

by Pablo Etcheverry -
Picture of Core developers
More hardcoded strings:
  • Step 1
  • Once the assignment is sent for marking, you will no longer be able to delete or attach file(s).
  • Step 2: Submit assignment for marking.
In reply to Miroslav Fikar

Re: Assignment Drop Box (new assignment type)

by Oksana Delgado -
thnx Miroslav, I'll take a look at this as soon as I can
However I'm not able to test it on windows platform.. so, I guess I'll need a helpsmile

About language strings, did you update the language file in lang/assignment/ ?
In reply to Oksana Delgado

Re: Assignment Drop Box (new assignment type)

by Miroslav Fikar -
Yes, I have added the contents of the language file provided in the package to lang/en/assignment.php. Only those 4 strings were undefined all others were fine. I work with 1.5.4+ if it matters.
In reply to Oksana Delgado

Re: Assignment Drop Box (new assignment type)

by Miroslav Fikar -
The problem with lost colon in C:\ is related to PARAM_PATH and the line:
$file = optional_param('file', '', PARAM_PATH);
Therefore, this asignment type will not work on Windows server. I would suggest to assign to $file only the part without CFG->dataroot and to join them together just before delete operation.

For the explanation, see for example this bug report where it is stated:

Unfortunately, the following line messes up the paths on Windows servers.

$scriptpath = clean_param($scriptpath, PARAM_PATH);

To be precise, the colon following the windows drive letter is removed, thus making the path invalid. i.e. C:\ => C\

Indeed, the comments for PARAM_PATH say "window drive letter is not allowed".
In reply to Miroslav Fikar

Re: Assignment Drop Box (new assignment type)

by Oksana Delgado -
>I keep getting undefined language strings: responsesfromteacher, allowmultiple, emailstudents, uploadsuccessresponse. Should these be added to assignment or my installaction lacks some standard files?

these should be:
$string['allowmultiple'] = 'Allow multiple files';
$string['responsesfromteacher'] = 'Responses Uploaded by the Teacher';
$string['emailstudents'] = 'Email alerts to students';
$string['uploadsuccessresponse'] = 'Response file uploaded successfully.';

This type inherited those from Upload&Review which you probably not using

I'll update it.
Thnx for noticing hard coded strings, I thought I got read all of them
In reply to Oksana Delgado

Re: Assignment Drop Box (new assignment type)

by Geoffrey Rowland -
Hi Oksana

Thanks for all the work on this invaluable assignment type.

However, I have one weird problem. From the students perspective, the link to the 'Responses Uploaded by the Teacher' file, is corrupted. Specifically, the last character of wwwroot is duplicated so that for example:

http://localhost/moodle16/mod/assignment... becomes
http://localhost/moodle166/mod/assignment...

and

http://localhost/moodle/mod/assignment... becomes
http//localhost/moodlee/mod/assignment...

I have got the same problem on three separate installations of Moodle 1.6 Beta, so I don't think it's due to any 'hacking 'I have done.

Not sure if this is related to the PARAM_PATH issue reported by Miroslav.

Everything, including the link to the Response file, seems OK from the Teacher's perspective.

I'm running on Linux Apache 2 PHP 4 MySQL 4.

Any ideas?

In reply to Geoffrey Rowland

Re: Assignment Drop Box (new assignment type)

by Geoffrey Rowland -
Hi again,

Managed to fix this myself. Not sure if it is peculiar to my setup as I've been tinkering with Moodle 1.6 Beta, 'Upload & Review' assignment, 'AU Assignment DropBox' and the 'Access Control/Repository/Portfolio' and may have broken something. However, in case it is of wider use here is my solution:

In both /mod/assignent/type/AU/assignment.class.php and /mod/assignment/type/uploadreview/assignment.class.php, and towards the end of  function print_response_students

replace

if ($CFG->slasharguments) {
$ffurl =  "$CFG->wwwroot/mod/assignment/type/uploadreview/file.php/$filearea/$file";
} else {
$ffurl = "$CFG->wwwroot/mod/assignment/type/uploadreview/file.php?file=/$filearea/$file";
}

with

if ($CFG->slasharguments) {
$ffurl = "mod/assignment/type/uploadreview/file.php/$filearea/$file";
} else {
$ffurl = "mod/assignment/type/uploadreview/file.php?file=/$filearea/$file";
}
Average of ratings: Useful (1)
In reply to Geoffrey Rowland

Re: Assignment Drop Box (new assignment type)

by Tim Allen -
Thanks Geoffrey, I had the same problem in 1.6.  I am pretty sure that this is a bug because I haven't hacked my moodle.

Because I hadn't installed the Humobldt Upload and Review type I had to copy the file.php from that module into the AU folder.  Then when I made the changes you suggested above (replacing "uploadreview" with "AU"), it worked!

Thanks again,
Tim.
In reply to Geoffrey Rowland

Re: Assignment Drop Box (new assignment type)

by Sean McKay -
Geoffrey, I used your fix some time ago which seemed to work for one of our courses however I just received notice that I have another professor who's uploaded response files are not showing up in any uploadreview assignments in her course this semester. Any idea if there is something else going wrong? I do not have the AU assignment type loaded -- just UploadReview from Humboldt.

Thanks!
In reply to Sean McKay

Re: Assignment Drop Box (new assignment type)

by Geoffrey Rowland -
Sean
Not sure it helps much, but based on our recent experience I'm not surprised by that sort of problem. We have noticed the following bugs (features?) in the 'tweaked' Upload and Review that may be the same as the issue you report.
  • If a course contains two teachers, they can't see each other's uploaded response files.
  • If a course is backed up, then restored as a new course, the uploaded response files are missing from the new course.
  • If a teacher is removed from a course, their response files are no longer visible to students.
As we are sticking with Moodle 1.6.x for this academic year, we'll probably 'stumble along' with Upload & Review in its current state. Despite its shortcomings it is still invaluable. I'll also try to have a peek at the code, but due to other commitments this won't be for a few weeks at the earliest.

You may also have more success with Anthony Borrow's modified Upload assignment for Moodle 1.6.x

In the longer term, it seems sensible to switch to the revamped Upload assignment in Moodle 1.7, as this is now 'mainstream', and fix such issues (if they still exist) there; particularly if assignment migration is as straightforward as Martin suggests.
In reply to Geoffrey Rowland

Re: Assignment Drop Box (new assignment type)

by Paolo Oprandi -
Hi,

We are running Moodle 1.6.1 and are likely to continue to run 1.6.x until the end of the academic year. For the Spring term I have been asked to install Humboldt's 'upload and review' plugin, which we ran last year using 1.5.x. I was wondering whether I would be recommended to install this 'assignment drop box' plugin instead for compatibility with Moodle 1.7. If so, is there a place I can get hold of a fully functional version of the plugin as (as well as the wide spread acclaim) a few bugs seem to have been unearthed?

Thanks,
Paolo
In reply to Paolo Oprandi

Re: Assignment Drop Box (new assignment type)

by Paolo Oprandi -
Hi,
Sorry. Too quick to post as usual. I should learn to to read sometime. I can get hold of a functioning version using cvs.
Thanks,
Paolo
In reply to Oksana Delgado

Re: Assignment Drop Box (new assignment type)

by Pablo Etcheverry -
Picture of Core developers
Hi, Oksana!

Could this be uploaded to the main CVS in contrib section? This would allow us to easily upgrade it..
TIA,
Pablo
In reply to Oksana Delgado

Re: Assignment Drop Box (new assignment type)

by Mike Lee -
I get this error whenever I click on marked and the feedback windows opens up,

Unknown column 'AU_status' in 'order clause'

SELECT u.id, u.id, u.firstname, u.lastname, u.picture,s.id AS submissionid, s.grade, s.comment, s.timemodified, s.timemarked, ((s.timemarked > 0) AND (s.timemarked >= s.timemodified)) AS status FROM mdl_user u LEFT JOIN mdl_assignment_submissions s ON u.id = s.userid AND s.assignment = 2 WHERE u.id IN (3,17,4,5,6,7,8,9,10,11,12,13,14,15,16) AND s.data1 "Draft" AND s.data1 ""ORDER BY AU_status DESC LIMIT 1,1

I'm not sure what this means.

In reply to Mike Lee

Re: Assignment Drop Box (new assignment type)

by Mike Lee -
I noticed that this error is given only when I have sorted the data by LAST MODIFICATION (Teacher) and by the STATUS colums.  All of the other colums work and look right.
In reply to Mike Lee

Re: Assignment Drop Box (new assignment type)

by Mike Lee -
Fixed, just needed to upgrade mysql.
In reply to Mike Lee

Re: Assignment Drop Box (new assignment type)

by Oksana Delgado -
Hi everybody,
sorry for such a long silence. I just had a baby big grin and I'm on maternity leave.. so, not quite sure I will be able to work on this code for a next 5-6 months;)

but I will definitely try to check messages and reply every time I can

cheers,
Oksana
In reply to Oksana Delgado

Re: Assignment Drop Box (new assignment type)

by Mike Lee -
I just uploaded the AU assignment on 1.6 and now I can no longer delete a submission.  I can click on the remove link and it will take me through the removal steps but when I am taken back to the submission page, the submissions are still there.  I have uploaded the AU assignment type on 1.5.3+ and it works fine.  I looked at the assignment.class.php and noticed a difference between 1.5.3+ and 1.6 deleteonesubmission function, could that be the cause?
In reply to Mike Lee

Re: Assignment Drop Box (new assignment type)

by Mike Lee -
I have just tested the new AU assignment code that I had recently downloaded on 1.5.3+ and it works fine.  The remove link works like it should so I don't think its the code.  I don't know what it could be now.  Any thoughts?
In reply to Oksana Delgado

Re: Assignment Drop Box (new assignment type)

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
This is now in CVS (in the HEAD branch, so it won't be released in a stable release until 1.7).   I've renamed it "upload" since it seems to cover everything to do with uploading smile

I've also included all the required strings in the 1.6 standard language pack for English, so if you want to test it out in 1.6.1 you can do so easily (no need to worry about updating languages strings).

Hopefully we can have some testers banging on it and refining it before September.

Thanks very much Oksana and I hope things are going well with the bub!
In reply to Martin Dougiamas

Re: Assignment Drop Box (new assignment type)

by Paul Nijbakker -

Hi,

Since I cannot seem to get the Upload assignment type to work, I wonder if it is mutually exclusive with the Upload & Review type from Humboldt State (on which it was partially based)?

Rgrds,
Paul.

In reply to Martin Dougiamas

Re: Assignment Drop Box (new assignment type)

by Colin McQueen -
Had a quick go and all seems to work OK except when I tried to view as a student a file uploaded by the teacher as a response I got an error.

Not Found

The requested URL /moodle1-66/mod/assignment/type/uploadreview/file.php/8/moddata/assignment/4/responses/5/7/TeacherResponse.txt was not found on this server.


Apache/1.3.33 Server at localhost Port 80

The file is actually at : /moodle1-6/mod/assignment/type/uploadreview/file.php/8/moddata/assignment/4/responses/5/7/TeacherResponse.txt

Note the extra 6 that has been added to moodle1-6 by the link in the view assignments page hence not found.

Also I wonder if it may helpful for the teacher marking screen to check if a file response has been entered in the field when clicking on the Save or Save Changes button so you can upload a response and save an editor response in one click?
In reply to Colin McQueen

Re: Assignment Drop Box (new assignment type)

by Geoffrey Rowland -

Colin

I noticed the same problem a while back. Here is the fix that worked for me.

Note that this assignment type is now 'mainstream' in Moodle 1.7 dev, and appears to be backwards-compatible with Moodle 1.6.x.

In reply to Geoffrey Rowland

Re: Assignment Drop Box (new assignment type)

by Colin McQueen -
Thanks Geoffrey.

Sorry I hadn't read through the complete discussion! As it happens I have the same issue as Tim Allen. The file.php file isn't there. Where do I get this from?
In reply to Colin McQueen

Re: Assignment Drop Box (new assignment type)

by Geoffrey Rowland -
Colin

I have attached the 'offending' file.php file. It is originally from the Upload & Review assignment type (the ancestor of Drop Box) developed at Humboldt University. From the comments near the start of the file, it is modified from the 'standard' file.php (located in the top level Moodle folder) to allow students to view files not under their folder (i.e. submissions by teachers).

Copy this into the appropriate folder (e.g. /uploadreview, /AU or /upload) and edit assignment.class.php as per my earlier posting. Note that you may also have to modify references to /uploadreview to /AU or /upload in the assignment.class.php code.

To expand on Tim Allen's posting. This assignment type has evolved through a number of versions including the Humboldt University Upload & Review (uploadreview), Athabasca University/Drop Box (AU), and Upload (upload, in Moodle 1.7 dev). The modified file.php is only present in the (original) Humboldt version. As Moodle's modular design allows multiple assignment types, many folks appear to have installed these alongside each other, so haven't noticed the missing file.php in the later versions sad.


Martin,

This also needs to be fixed in the Moodle 1.7 dev version (Upload assignment type) wink.
Average of ratings: Useful (1)
In reply to Geoffrey Rowland

Re: Assignment Drop Box (new assignment type)

by Paul Nijbakker -

Sorry, it still doesn't work form me. I still get stuck on localhost/mod/assignment/details.php with the error reading Fatal error: Class 'assignment_upload' not found in D:\moodle\moodle\mod\assignment\details.php on line 28

Any suggestions?

Rgrds,
Paul.

In reply to Geoffrey Rowland

Re: Assignment Drop Box (new assignment type)

by Colin McQueen -
Thanks smile but the attachment give a file not found error? Is that the problem for Paul as well? If you right click and download it saves of the html file with the error as file.php Most confusing...

I'm really looking forward to working with staff on these new assignment types. So far there hasn't been a lot of uptake yet ion my schools but I hope as the functionality improves and people become more demanding we'll see some good use of this type of workflow management.

I'm a bit hamstrung because our schools do their own thing or use hosts that don't upgrade or extend very quickly. Some schools have only just got 1.53 I believe. I am hoping the Local Authority or RBC will eventually either host itself like Lancashire and Cumbria or at least use a central supplier like Bucks or West Sussex. I guess an alternative would be to have a techie support group but that could go either way in terms of efficiency.
In reply to Colin McQueen

Re: Assignment Drop Box (new assignment type)

by Geoffrey Rowland -
Apologies for the long delay blush, but just in case you haven't found it in the meantime, here is the file again. I have renamed it 'file.txt' as 'file.php' appears to upload, but then can't be downloaded sad. So when you have downloaded 'file.txt' you will need to rename it back to 'file.php'.

This is the version from Upload & Review so may need some tweaking to work with AU Assignment Dropbox (see earlier postings).
In reply to Martin Dougiamas

Re: Assignment Drop Box (new assignment type)

by Sean S -
ummm.. I went to cvs and typed this:
cvs -z3 -d:pserver:anonymous@moodle.cvs.sourceforge.net:/cvsroot/moodle co contrib

and it looks like I'm getting every module in the contrib folder. How would I go about getting just the one I want?
In reply to Sean S

Re: Assignment Drop Box (new assignment type)

by Tim Allen -
Do this:

cvs -z3 -d:pserver:anonymous@moodle.cvs.sourceforge.net:/cvsroot/moodle/modulename co contrib

Tim.
In reply to Oksana Delgado

Re: Assignment Drop Box (new assignment type)

by Jamie Thompson -
First of all, this is amazing, good work. it does (almost) exactly what my teachers want it to do and has saved me and enormous amount of head scratching.

One thing i noticed however is that if you choose to allow resubmitting, which generally we want to do here as the same assignment is handed in an a weekly basis for marking over a course of several months, is that the uploaded files do not display after an assignment has been 'marked' or 'returned'. this seems like a default moodle behaviour as the 'upload single file' assignment type behaves in the same way.

Because of this, when a student gets back an assignment that has been returned (either marked or unmarked) they are indeed able to upload new files and resubmit it for marking but they are offered no visual clues as to what files they have uploaded before, during of after this process, which, for them, is disconcerting, and in general they simply assuming it's not working and give up. don't get me wrong, the files upload fine, the teacher can view and re grade the assignment accordingly, but the student is left baffled and unsure as to whether it has worked or not.

I have read that resubmitting is something that is relatively new in moodle. So perhaps this is just something that's not yet been throughly ironed out?

i've overridden this behaviour by simply adding a line into the view() function in assignment.class.php as follows

 if ($submission = $this->get_submission()) {
 if ($submission->timemarked) {
 //following line added by me
print_simple_box($this->print_user_files($USER->id, true), 'center');
$this->view_feedback();
...

this works perfectly. i'm wondering if there's any reason i shouldn't be doing this. it seems like a much more natural and useful behaviour, allowing students to resubmit their work far more intuitively.

potentially also it would be useful for 'returned' unmarked assignments to be treated the same was a draft assignments, in that the student can freely delete files aswell as overwrite and add new, as the reason it may have been returned could be due to the wrong file being uploaded.

i think this would be fairly simple too, but i don't have time to play at the moment

edit: my bad. it already treats returned assignments the same way as drafts regarding 'remove' links... in which case, why doesn't view() output the use files by default. the plot thickens.
In reply to Jamie Thompson

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Assignment Drop Box (new assignment type)

by Jamie Thompson -
i think that's by design. it stops students from opening the online files, working on them, blindly saving them into a temp folder and thinking they've updated the file. cause you know they would given half a chance.

it'd be easy to override this though if you wanted. i think the function is called print_user_files? or something to that effect...
In reply to Jamie Thompson

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Oksana Delgado

Re: Assignment Drop Box (new assignment type)

by Claire Browne -
Hello,

I am working with Moodle 1.9.5

I wondered if this assignment type will work for this version.

It would be brillant for our organisation to use with our over sea online learners.

Kind regards
In reply to Claire Browne

Re: Assignment Drop Box (new assignment type)

by Mary Cooch (personal account) -
Picture of Documentation writers Picture of Testers
Hello there. I think the assignment type "Advanced Uploading of Files" in Moodle 1.9.5 will do exactly what you are wanting to do smile