I added 2 minor features to the DB activity, could they go in the official code?

I added 2 minor features to the DB activity, could they go in the official code?

Laurent Domenech -
回帖数:8
Hello there,

As part of a contract I'm currently doing for a French university (http://ensieta.fr), I have developed 2 minor (but interesting IMHO) features in the Database activity. I'm describing them in the next paragraph of this message. We need these features for an application we're setting up with Moodle. My question is simply: can these features go in the official code? Needless to say your answer will determine how I finish this development.


The 2 features are:

- A "Mandatory Field" option that can be set to almost every field of a database. If set, the user cannot save a db entry without those fields filled in. A message with the name of the missing fields is displayed when the save button is pressed.

- A "Can be modified by teachers only" option that can be set to every field of a database. If set, the fields marked with this option cannot be modified by a student. Instead of being editable, they're just displayed (followed by an explanation text).

Please let me know...

Best regards,
Laurent

BTW: Kudos to Martin and the Moodle developers. This is a great piece of work...
回复Laurent Domenech

Re: I added 2 minor features to the DB activity, could they go in the official code?

Martin Dougiamas -
Core developers的头像 Documentation writers的头像 Moodle HQ的头像 Particularly helpful Moodlers的头像 Plugin developers的头像 Testers的头像
They sound good, Laurent, yes.

Of course inclusion depends on the code quality so read the coding guide. 微笑

Best thing to do is to file new issues on the Moodle Tracker (assign it to me) and attach your patches there (against the developer/head/trunk version of Moodle ).
回复Martin Dougiamas

Re: I added 2 minor features to the DB activity, could they go in the official code?

Laurent Domenech -
OK great I will do that. I have a little bit of work to prepare it according to the coding guidelines and write the doc. Should be there middle of next week.

Thanks,
Laurent
回复Laurent Domenech

Re: I added 2 minor features to the DB activity, could they go in the official code?

N Hansen -
There is already an issue open for the first feature, MDL-5583.
回复N Hansen

Re: I added 2 minor features to the DB activity, could they go in the official code?

Laurent Domenech -
OK, I have added a new issue: MDL-6821.

(BTW: sorry, I unknowingly set the priority to major, couldn't change it after.)

On both issues, I have attached the same file that resolves both issues (MDL-6821 and MDL-5583). If this is a problem, I'll take the time to separate the issues.

I didn't find the fr_utf8 files in the cvs branch. However, I do have the French translation for the changes I've made in lang/*/data.php.

For obscure reasons with the network here, I don't have a proper CVS access. The result is that I only tested this in my 1.6.2 and I copied the changes over the modified files downloaded through the CVS web interface at sourceforge. I have been very careful not to miss anything, and these features aren't too big, but I don't like it. If anyone can send me a zip with the full latest moodle files, I'll be glad to set up a new site and test what I've done with the latest version.

If anything is unclear or missing, do not hesitate to let me know.

Regards,
Laurent

回复Laurent Domenech

Re: I added 2 minor features to the DB activity, could they go in the official code?

Martin Dougiamas -
Core developers的头像 Documentation writers的头像 Moodle HQ的头像 Particularly helpful Moodlers的头像 Plugin developers的头像 Testers的头像
Thanks, Laurent. I'll comment further on the issues in the tracker, but yes, it's important to develop these against HEAD because in Moodle 1.7 we've changed the roles a lot (students and teachers can no longer be taken for granted) so this patch won't work on 1.7.
回复Martin Dougiamas

Re: I added 2 minor features to the DB activity, could they go in the official code?

Laurent Domenech -
Yes, I understand.

To clear that out of the way, I have separated the two issues in my code, fixed MDL-5583 on the latest 1.7 files and attached the fix to the issue.

I'm now working on MDL-6821 with the new roles. Hopefully, I'll come up with something soon.

Best regards,
Laurent
回复Martin Dougiamas

Re: I added 2 minor features to the DB activity, could they go in the official code?

Laurent Domenech -
OK, I've looked at the new roles (great stuff BTW) and before I go on I thought I'd share with you what I'm thinking in doing...

Initially, the new option "Data can be modified" was to have these options :
by everyone (default)
by teachers only
by teachers and the owner only
by teachers and the owner's group only

From what I've read, this is what I would do:
1- Add a new capability to the Database module, called "Write Protected Fields", which means you're allowed to edit the protected fields of records. The capability would be granted to admins, course creators and teachers.
2- Add the "Data can be modified" with these options:
by everyone (default)
by users with the "Write Protected Fields" capability only

Let me know.

Regards,
Laurent