Questionnaire Refactoring

Questionnaire Refactoring

Mike Churchward -
回帖数:41
Core developers的头像 Plugin developers的头像 Testers的头像
I have just committed a completely overhauled version of the questionnaire so that its interface will be like all other Moodle modules (for better or worse). This has been committed to HEAD for the contrib/questionnaire module. The code in HEAD should be considered BETA at this point, and not used on production sites. Continue to download versions for your specific version of Moodle for stable code.

Changes include:
  1. Use of Moodle's formslib for all questionnaire editing functions.
  2. Update to 1.9's standard course module settings.
  3. Addition of capabilities and roles support (this will replace the "respondent eligibility" and view "responses settings" eventually).
  4. Separation of standard course module settings, from questionnaire display settings and question editing. Use of tabs to access these separate interfaces (access to tabs is controlled by capabilities).
  5. Fusion of the question editing and question re-ordering screens.
  6. Addition of group controls. This will affect response viewing only at this point.
  7. Ability to assign a grade to a completed questionnaire.
Not all of these changes are complete in the version in CVS at this point, but the module is working. If you wish to test this version on a non-production site, please go ahead and download the version from HEAD.

If you do install this new version, make sure you logout and log back in after completing the upgrade; otherwise you won't have the new capabilities assigned to your account.

mike
回复Mike Churchward

Re: Questionnaire Refactoring

Mike Churchward -
Core developers的头像 Plugin developers的头像 Testers的头像
The latest version just committed to HEAD includes roles and capabilities added to handle the respondent eligibility settings. The upgrade will override the roles according to the settings in the questionnaire. The old setting will no longer be used once this version is installed.

mike
回复Mike Churchward

Re: Questionnaire Refactoring

Jenny Gray -
Wow! We didn't expect you to commit the roles and capabilities stuff so quickly! What I shame I can't tell Gareth as he left yesterday 伤心

Have you fixed the postgres install/upgrade issues at the same time? If so, I'll try to upgrade using a copy of my live system.

Oh, and are you planning to backport this to other branches, or just for 2.0 onwards?

Jenny
回复Jenny Gray

Re: Questionnaire Refactoring

Mike Churchward -
Core developers的头像 Plugin developers的头像 Testers的头像
We will backport this to 1.9 for sure.

mike
回复Mike Churchward

Re: Questionnaire Refactoring

Jenny Gray -
OK, thanks.

Sorry to nag - have you altered the xmldb stuff so that it might install/upgrade on postgres?
回复Jenny Gray

Re: Questionnaire Refactoring

Mike Churchward -
Core developers的头像 Plugin developers的头像 Testers的头像
Is there a problem with the xmldb file?
回复Mike Churchward

Re: Questionnaire Refactoring

Jenny Gray -
I've commented in the tracker, but i'll post here too just so every-one sees this.

Thanks for fixing the xmldb for postgres, I've just merged the latest from CVS HEAD into my code base and upgraded with no problems whatsoever. big grin

I've noted a couple of minor things that need looking at:

- build_navigation still isn't being used in a couple of files, I'll update and commit to HEAD
- I need to upgrade my local myMoodle code (print_overview function) for roles & capabilities so we can commit that to HEAD too and close CONTRIB-276
- I noticed a few remaining isguest() and isteacheredit() functions which have been deprecated and ought to be replaced by has_capability. I'll do a search for them and try to sort them all out.

I'm going to test the roles & capabilities stuff now with my environment setup, I'll let you know how I get on.

Jenny
回复Mike Churchward

Re: Questionnaire Refactoring

Mawuli Kuivi -
Hello Mike,
Thanks for doing all the great work on this module.
How to l get a copy of the version that includes all the roles and capability for testing and trying?
回复Mike Churchward

Re: Questionnaire Refactoring

Mawuli Kuivi -
Hello Mike,
Do you have a time line or rough idea when the questionnaire will be back ported for Moodle 1.9

The latest version works fine in Moodle 1.9

In the upgrade.php file, l change the if ($oldversion < 2008031904) code to something like

$studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW);
$teacherroles = get_roles_with_capability('moodle/legacy:teacher', CAP_ALLOW);
$editingteacherroles = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW);

$capview = 'mod/questionnaire:view';
$capsubmit = 'mod/questionnaire:submit';

while ($questionnaire = rs_fetch_next_record($rs)) {
$context = get_context_instance(CONTEXT_MODULE, $questionnaire->cmid);

/// Convert questionnaires with resp_eligible = 'all' so that students & teachers have view and submit
if ($questionnaire->resp_eligible == 'all') {
foreach ( $editingteacherroles as $editteach) {
assign_capability($capsubmit, CAP_ALLOW, $editteach->id, $context->id, true);
}
foreach ($teacherroles as $teach) {
assign_capability($capsubmit, CAP_ALLOW, $teach->id, $context->id, true);
}
/// Convert questionnaires with resp_eligible = 'students' so that just students have view and submit
} else if ($questionnaire->resp_eligible == 'students') {
/// This is the default; no changes necessary.

/// Convert questionnaires with resp_eligible = 'teachers' so just teachers have view and submit
} else if ($questionnaire->resp_eligible == 'teachers') {
foreach ( $editingteacherroles as $editteach) {
assign_capability($capsubmit, CAP_ALLOW, $editteach->id, $context->id, true);
}
foreach ($teacherroles as $teach) {
assign_capability($capsubmit, CAP_ALLOW, $teach->id, $context->id, true);
}
foreach ($studentroles as $stud) {
assign_capability($capview, CAP_PREVENT, $stud->id, $context->id, true);
assign_capability($capsubmit, CAP_PREVENT, $stud->id, $context->id, true);
}
}
}
rs_close($rs);

Will it be possible to add this or something like this to the latest version?
回复Mike Churchward

Re: Questionnaire Refactoring

Daniele Cordella -
Core developers的头像 Plugin developers的头像
Thank you Mike and thank you Joseph.
It is unbelievable how a free open source software can grow in less time and with better quality than a commercial software.
Moodle community work is not only a software, it is an example of life style for all.
Thank you.
回复Mike Churchward

Re: Questionnaire Refactoring

Maria B. -
Hi, I've just downloaded the new version and I am going to test it very carefully in a few days. But, first impressions are very good.

Also, till now I've noticed that you don't have a regular preview button only view which will not work if the time is set in the future.

Also, I would like to see this options (like in the quiz module):

1. password protection
2. subnet protection
3. limited number of entries

And, is there any plans for make a completly independent questions bank because sometimes we have a lot of questions that are common for many of questionnaires, but not only the questions, we use the whole short scales (cluster of coule questions) within one questionnaire as well. It would be nice if we just could add this scales (which can be saved as templates) by one click into the our questionnaire.
回复Mike Churchward

Re: Questionnaire Refactoring

Mike Churchward -
Core developers的头像 Plugin developers的头像 Testers的头像
There are a bunch of new additions in the HEAD CVS version (again, treat this as beta).

Included:
1. questions editing is now even simpler...
2. extended tabs interface to include reporting...
3. lots of roles and capabilities additions...

Please test and let us know if there are any issues.

mike
回复Mike Churchward

Re: Questionnaire Refactoring

Maria B. -
I translated questionnaire.php lang for this version (sr_lt_utf8) but still can't see Serbian titles for the question types.

Those strings are always displayed in English:
Radio Buttons, Check Boxes, Page Break etc...

And what about: phelpname
It shuould be kindofratescale I think.

回复Maria B.

Re: Questionnaire Refactoring

Joseph Rézeau -
Core developers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像 Testers的头像 Translators的头像
Hi Marija,
Just tested new Questionnaire version for 2.0 and I can see the same problem with French language strings. So the pb. is not linked with the Serbian language but with all non-English languages. I'll try to find the cause and a solution as soon as possible.
Joseph
回复Joseph Rézeau

Re: Questionnaire Refactoring

Maria B. -
Ok, I see.

Till then, my newest trantlation for version 2.0

M.
回复Maria B.

Re: Questionnaire Refactoring

Joseph Rézeau -
Core developers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像 Testers的头像 Translators的头像

Hi Marija,

I have just fixed the bug with question type names for non-English languages and committed the fixed file (questions_form.php) to CVS. I have also committed your latest translation, which includes the new lang- strings.

I have tested it locally and it works, see attached screen shot. Thanks!

Joseph

附件 image00.jpg
回复Joseph Rézeau

Re: Questionnaire Refactoring

Maria B. -
OK, thank you.

I also noticed that string move is missing in English lang file and that tool (for reordering questions) doesn't work for me.

In Serbian it is: $string['move'] = 'Premesti pitanje';

You may add it, if you wish.


回复Mike Churchward

Re: Questionnaire Refactoring

Maria B. -
After the latest uprgade I was not able to create new questionnaires anymore.

badcontext error occured.

The other modules was workng properly and version 1.9 of Questionnaire too (first, I had uninstalled version 2.0, then installed 1.9 - checked it / it was fine / then again upgrade to 2.0 but still not work).
回复Maria B.

Re: Questionnaire Refactoring

Joseph Rézeau -
Core developers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像 Testers的头像 Translators的头像
回复Joseph Rézeau

Re: Questionnaire Refactoring

Maria B. -
OK, thanx.

I found this error too:

bug.png

And two propositions:

1. I hardly noticed the new Page Break option.
Could it be ------Page Break------ instead of ________________

2. Could you put edit question icon here too:

prop.png

like in Quiz module?

And I really need the classical preview page beside the view page which is more like attempt page in fact.

For example, I will not be able to see my questionnaire if it is out of date or if I have a few pages and required question I will not be able to walk through it from the start to the end without entering my responses 伤心
回复Maria B.

Re: Questionnaire Refactoring

Mike Churchward -
Core developers的头像 Plugin developers的头像 Testers的头像
First two are done and committed...

I like the idea of the question icon on the view page. I'll look into that.

Preview will be back soon.

mike
回复Joseph Rézeau

Re: Questionnaire Refactoring

Mawuli Kuivi -
Hello everyone,
Thanks for all the great work in getting the new look and code for the questionnaire module.

I just want to know when latest version code will be integrated into the Moodle 1.9 version.

Thanks.
M.
回复Mawuli Kuivi

Re: Questionnaire Refactoring

Joseph Rézeau -
Core developers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像 Testers的头像 Translators的头像
Hi Mawuli,
Questionnaire will not be distributed as part of regular Moodle distribution, but will continue to be available as 3rd party plugin. You can download the latest version (HEAD) and install it on a Moodle 1.9 version (but please test it on a test installation, not on a production site). I have done it without any problems on the site of the French MoodleMoot this week. If our final tests go well, the latest new look version will be backported and available for 1.9 some time next week.
Joseph
回复Mike Churchward

Re: Questionnaire Refactoring

Mike Churchward -
Core developers的头像 Plugin developers的头像 Testers的头像
The latest version has the 'view all responses' interface moved to the tabs interface.

Please test it and let me know if there any problems.

mike
回复Mike Churchward

Re: Questionnaire Refactoring

Joseph Rézeau -
Core developers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像 Testers的头像 Translators的头像
Works fine, except for one display problem: not enough vertical space for display of list of questions under the tabs, see attached screenshot.
Joseph
附件 image00.jpg
回复Joseph Rézeau

Re: Questionnaire Refactoring

Mike Churchward -
Core developers的头像 Plugin developers的头像 Testers的头像
Hmmmm.... That must be a theme thing. I didn't have that problem using the Moodle theme I was using. What theme is that?

mike
回复Mike Churchward

Re: Questionnaire Refactoring

Joseph Rézeau -
Core developers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像 Testers的头像 Translators的头像
Yes, it is a theme problem. For my tests I use formal_white, a fairly standard theme, used by lots of people as their default theme.
No problem in standard, custom corners, wood, etc.
A little problem with Chameleon.
I'm also having a problem with my own orangechoc theme (see attached). I think the pb arises from the fact that on that page you have 3 rows of tabs and I don't think this happens in other places in Moodle, so it has not been taken care of in themes???
Joseph
附件 image00.jpg
回复Joseph Rézeau

Re: Questionnaire Refactoring

Mike Churchward -
Core developers的头像 Plugin developers的头像 Testers的头像
Committed a fix to add space below the third tab row. Not really a 'good' fix, but it works. Can you think of a way to do this without the third row?
回复Mawuli Kuivi

Re: Questionnaire Refactoring

Mike Churchward -
Core developers的头像 Plugin developers的头像 Testers的头像
The count is now correct and in CVS, but I believe the link is fine.
回复Mike Churchward

Re: Questionnaire Refactoring

Mawuli Kuivi -
Will take a look when it is on the site for download.

By the way, what should the link be?
回复Mike Churchward

Re: Questionnaire Refactoring

Mike Churchward -
Core developers的头像 Plugin developers的头像 Testers的头像
New version now in CVS with a revamped main question editing screen (thanks to Joseph for his suggestions).

Try it out and let us know.

mike