Moodle

"Save as new <module>" button on module edit form

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Duplicate
  • Affects Version/s: 1.9.4
  • Fix Version/s: None
  • Component/s: Course, Usability
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE

Description

If module editing form will have "Save as new <module>" button (such as questions have right now), it will be easier to create a series of activities with similar settings (quite a common thing in large courses). This is fairly easy thing to implement with much gain for usability.

I may consider writing a patch myself, if someone will bother about applying it.

  1. add_save_as_new_button.patch
    04/Dec/09 3:33 AM
    7 kB
    Shkarupa Alex
  2. add_save_to_new_button_moodle_2.0.patch
    06/Mar/10 5:34 AM
    6 kB
    Shkarupa Alex
  3. add_save_to_new_button_moodle_2.0.patch
    26/Feb/10 1:36 AM
    6 kB
    Shkarupa Alex
  4. copy_from_button.diff
    23/Mar/11 12:33 AM
    10 kB
    Stanislav Zhorin
  5. MDL-18093.patch
    12/Mar/10 5:28 PM
    12 kB
    Dongsheng Cai
  1. clone_module.png
    16 kB
    03/Mar/10 4:17 PM

Issue Links

Activity

Hide
Helen Foster added a comment -

Oleg, thanks for your suggestion. I'm just wondering how it's different from our current backup and restore functionality?

Show
Helen Foster added a comment - Oleg, thanks for your suggestion. I'm just wondering how it's different from our current backup and restore functionality?
Hide
Oleg Sychev added a comment -

Helen, it has another goal. Imagine you have 10 topics in course and a control quiz in every topic. If you course is standartised in any way (as often in University), you'll have to create 10 quizzes with very similar _settings_ (i.e. what appears on mod_form), but different _content_ (i.e. questions in case of quizzes). You can use backup/restore functions to handle this, but this is far from usable - its much easier to reenter all settings, than to backup/restore and clear contents.

And even easier is to create one, than open it, change name/description/whatever else and press "save as new". It's mildly useful and very easy to implement. All you need is to clear field telling that it's editing, not creating new activity - and the rest will be automatically handled IMHO.

The problem of many cm's with similar settings is often, that can demonstrate lesson module, which have custom ways to several lessons to share settings (but not content).

Show
Oleg Sychev added a comment - Helen, it has another goal. Imagine you have 10 topics in course and a control quiz in every topic. If you course is standartised in any way (as often in University), you'll have to create 10 quizzes with very similar _settings_ (i.e. what appears on mod_form), but different _content_ (i.e. questions in case of quizzes). You can use backup/restore functions to handle this, but this is far from usable - its much easier to reenter all settings, than to backup/restore and clear contents. And even easier is to create one, than open it, change name/description/whatever else and press "save as new". It's mildly useful and very easy to implement. All you need is to clear field telling that it's editing, not creating new activity - and the rest will be automatically handled IMHO. The problem of many cm's with similar settings is often, that can demonstrate lesson module, which have custom ways to several lessons to share settings (but not content).
Hide
Ray Lawrence added a comment -

Hopefully this would be quite differnent from Backup and Restore in that it would be one click rather than multiple. Of courer this would mean far fewer config options e.g. role assignments, overrides, user data.

Show
Ray Lawrence added a comment - Hopefully this would be quite differnent from Backup and Restore in that it would be one click rather than multiple. Of courer this would mean far fewer config options e.g. role assignments, overrides, user data.
Hide
Clark Shah-Nelson added a comment -

+1 Here's to this one!

Why is it we have 'Save as' in nearly every other program on the computer, and it's a given in all of them, but not within software such as Moodle? Each resource or activity should have "save and return to course" "save and display" AND "Save as new" – and rename.... This would make it easier to duplicate an individual resource or activity within a course. Import, backup, and restore; those are all entirely different processes that should be left out of this conversation. This is about a teacher who wants to easily duplicate content within the course, while keeping the same content settings.

Quizzes are a perfect use case. Let's say a faculty member builds a quiz, and it has a 30 minute time limit. But a student with a disability comes into the course and an accommodation of extra time for the quiz needs to be given - for 45 minutes. The faculty member could easily do a "save as" of the quiz, creating a duplicate copy, and then put a 45 minute time limit on the secondary quiz. The alternative is to use roles (cumbersome and really only will allow you to take away the time limit all together) or build an entirely new quiz from scratch: time consuming.

Of course, this is pretty similar to ticket http://tracker.moodle.org/browse/MDL-11288 - people want an easy way to duplicate any single resource or activity within a course, including the settings, without having to go through the import/backup/restore process. Whether this is by adding a 'save as' button such as this ticket calls for, or another "copy/duplicate" icon that shows up when editing is on next to each item such as 11288 calls for, this feature should there in my opinion.

Show
Clark Shah-Nelson added a comment - +1 Here's to this one! Why is it we have 'Save as' in nearly every other program on the computer, and it's a given in all of them, but not within software such as Moodle? Each resource or activity should have "save and return to course" "save and display" AND "Save as new" – and rename.... This would make it easier to duplicate an individual resource or activity within a course. Import, backup, and restore; those are all entirely different processes that should be left out of this conversation. This is about a teacher who wants to easily duplicate content within the course, while keeping the same content settings. Quizzes are a perfect use case. Let's say a faculty member builds a quiz, and it has a 30 minute time limit. But a student with a disability comes into the course and an accommodation of extra time for the quiz needs to be given - for 45 minutes. The faculty member could easily do a "save as" of the quiz, creating a duplicate copy, and then put a 45 minute time limit on the secondary quiz. The alternative is to use roles (cumbersome and really only will allow you to take away the time limit all together) or build an entirely new quiz from scratch: time consuming. Of course, this is pretty similar to ticket http://tracker.moodle.org/browse/MDL-11288 - people want an easy way to duplicate any single resource or activity within a course, including the settings, without having to go through the import/backup/restore process. Whether this is by adding a 'save as' button such as this ticket calls for, or another "copy/duplicate" icon that shows up when editing is on next to each item such as 11288 calls for, this feature should there in my opinion.
Hide
Anthony Borrow added a comment -

In terms of UI, I think it introduces a level of complexity that may throw off some users. Namely, what is the difference between save and save as new. This strikes me as something that might be a useful patch but perhaps not in core. If it were to go in core, I would certainly advocate that it would be an advanced option so that for most users they would not see it. It may even be helpful to give the admin the ability to enable or disable similar to how we handle rss in some activity modules. Peace - Anthony

Show
Anthony Borrow added a comment - In terms of UI, I think it introduces a level of complexity that may throw off some users. Namely, what is the difference between save and save as new. This strikes me as something that might be a useful patch but perhaps not in core. If it were to go in core, I would certainly advocate that it would be an advanced option so that for most users they would not see it. It may even be helpful to give the admin the ability to enable or disable similar to how we handle rss in some activity modules. Peace - Anthony
Hide
Oleg Sychev added a comment -

Hi Anthony

I don't think that this ability make an interface too complex, because:
1) a vast majority users are familiar with conception of two "save" and "save as...." buttons - any sane computer application working with files have them for ages;
2) moodle question bank has had such pair of buttons quite a time, and I don't know about complaints on this (thought Tim Hunt probably knows better); after all it is also are consistency issue, but I think many people really don't want to lose "Save as new question" button, I definitely not.

If you think this is not quite obvious, there can be a usual help file near the buttons. Thought I've seen a much more strange and difficult to inderstand options in Moodle activities settings than this one (workshop module settings still give me a shudders). Do you really think that "Save" and "Save as new quiz" (or assignment or something) are that hard to understand?

P.S. Anyone please comment do you think this is a complex thing or not.

Show
Oleg Sychev added a comment - Hi Anthony I don't think that this ability make an interface too complex, because: 1) a vast majority users are familiar with conception of two "save" and "save as...." buttons - any sane computer application working with files have them for ages; 2) moodle question bank has had such pair of buttons quite a time, and I don't know about complaints on this (thought Tim Hunt probably knows better); after all it is also are consistency issue, but I think many people really don't want to lose "Save as new question" button, I definitely not. If you think this is not quite obvious, there can be a usual help file near the buttons. Thought I've seen a much more strange and difficult to inderstand options in Moodle activities settings than this one (workshop module settings still give me a shudders). Do you really think that "Save" and "Save as new quiz" (or assignment or something) are that hard to understand? P.S. Anyone please comment do you think this is a complex thing or not.
Hide
Anthony Borrow added a comment -

Oleg - Personally no I do not find the concept too hard to understand; however, I am aware from a usability perspective that even things that appear obvious to developers can cause problems for real users. I simply raise the question because it is good to keep the user interface as simple as possible and adding an option adds a level of complexity that was previously not there. So I think we should be prepared for the question of what is the difference between the save and save as. I am just trying to anticipate the response to the new feature so that we can think through it first. I appreciated the reference to other programs using Save and Save as - it is not like it is a new concept but the new option in Moodle will likely draw a few questions. Peace - Anthony

Show
Anthony Borrow added a comment - Oleg - Personally no I do not find the concept too hard to understand; however, I am aware from a usability perspective that even things that appear obvious to developers can cause problems for real users. I simply raise the question because it is good to keep the user interface as simple as possible and adding an option adds a level of complexity that was previously not there. So I think we should be prepared for the question of what is the difference between the save and save as. I am just trying to anticipate the response to the new feature so that we can think through it first. I appreciated the reference to other programs using Save and Save as - it is not like it is a new concept but the new option in Moodle will likely draw a few questions. Peace - Anthony
Hide
Anthony Borrow added a comment -

Just a follow up that Oleg and I were IMing about this issue and in particular about when having a Save as option would be appropriate because we are editing things all of the time (courses, course categories, users, etc.). Obviously save as would probably not be wanted for users. We came to some conclusion that helped clarify things for me; however, I do not recall what it was but am hoping that Oleg will add a clarifying comment. Peace - Anthony

Show
Anthony Borrow added a comment - Just a follow up that Oleg and I were IMing about this issue and in particular about when having a Save as option would be appropriate because we are editing things all of the time (courses, course categories, users, etc.). Obviously save as would probably not be wanted for users. We came to some conclusion that helped clarify things for me; however, I do not recall what it was but am hoping that Oleg will add a clarifying comment. Peace - Anthony
Hide
Oleg Sychev added a comment -

Anthony - we come to conclusion that as bulk uploading is not appropriate for activities, "save as" remains the only viable solution for activities.

P.S. You may look for history button in you chat client. It may be used to recall somethign from chats, and the history of chat with each user is separate.

Show
Oleg Sychev added a comment - Anthony - we come to conclusion that as bulk uploading is not appropriate for activities, "save as" remains the only viable solution for activities. P.S. You may look for history button in you chat client. It may be used to recall somethign from chats, and the history of chat with each user is separate.
Hide
Anthony Borrow added a comment -

Oleg - I tried to check for the chat history but perhaps I had the wrong user or something. In any case, I did not have the history but now recall that part of what convinced me that the save as was a good idea is because there is no way to upload an activity so save as seems like a viable option. With questions we can both import and do save as so it seemed all the more important that we have save as for activities. Peace - Anthony

Show
Anthony Borrow added a comment - Oleg - I tried to check for the chat history but perhaps I had the wrong user or something. In any case, I did not have the history but now recall that part of what convinced me that the save as was a good idea is because there is no way to upload an activity so save as seems like a viable option. With questions we can both import and do save as so it seemed all the more important that we have save as for activities. Peace - Anthony
Hide
Oleg Sychev added a comment -

David agreed to help with committing this patch.

Show
Oleg Sychev added a comment - David agreed to help with committing this patch.
Hide
Oleg Sychev added a comment -

For people knowing lesson there are "Use this lesson's settings as defaults" control on lesson mod_form, that tried to achieve similar effect - keep settings(like time limit) but not content (like quiz questions or lesson pages). I'm just trying to address this problem in more modular and centralised way.

Even modular backup/restore from 2.0 will take too much clicks for such simple task.

Show
Oleg Sychev added a comment - For people knowing lesson there are "Use this lesson's settings as defaults" control on lesson mod_form, that tried to achieve similar effect - keep settings(like time limit) but not content (like quiz questions or lesson pages). I'm just trying to address this problem in more modular and centralised way. Even modular backup/restore from 2.0 will take too much clicks for such simple task.
Hide
David Mudrak added a comment -

Firstly, thanks a lot for your contribution! This really look like very-nice-to-have feature. Some comments:

$string['saveasnewobject'] is not good. You can't just pass strtolower($modulename) to its placeholder. Yes, it may look pretty nice in English ("Save as new quiz") but what about other languages? ("Uložit jako nový assignment" does not sound like proper Czech...). Also, module name should be considered as a system code, not a string. For example Database activity has module name "data". Please review.

This patch was briefly discussed at the recent moodle developers meeting. It may get into Moodle 2.0 or 2.1, definitely not into 1.9 (no such new features on stable branches). This involves more research and work - namely with the new File API. There seems to be an issue. In Moodle 2.0, developers have to initialize wysiwyg editor with the appropriate context. When updating an instance, wysiwyg editor is initialized given the module context of the existing instance. It may be tricky to change this later accordingly to the button pressed...

Show
David Mudrak added a comment - Firstly, thanks a lot for your contribution! This really look like very-nice-to-have feature. Some comments: $string['saveasnewobject'] is not good. You can't just pass strtolower($modulename) to its placeholder. Yes, it may look pretty nice in English ("Save as new quiz") but what about other languages? ("Uložit jako nový assignment" does not sound like proper Czech...). Also, module name should be considered as a system code, not a string. For example Database activity has module name "data". Please review. This patch was briefly discussed at the recent moodle developers meeting. It may get into Moodle 2.0 or 2.1, definitely not into 1.9 (no such new features on stable branches). This involves more research and work - namely with the new File API. There seems to be an issue. In Moodle 2.0, developers have to initialize wysiwyg editor with the appropriate context. When updating an instance, wysiwyg editor is initialized given the module context of the existing instance. It may be tricky to change this later accordingly to the button pressed...
Hide
Massimiliano Del Gatto added a comment -

Hi everyone and happy New Year!

I am currently developing my new course with moodle and this is the first time that I am making a massive use of the lesson module. I am overwhelmed by the power of this module and I am confident that my course will highly benefit from its employment. However, I am frustrated by the fact that there is no "save-as-new-question" button after a question is edited after being created. In order to speed up the question creation, I had to create/duplicate/modify my questions using the question modules, export them and then import them into the lesson and do some more updating: a time consuming activity that would certainly be avoided if such a button were implemented.

I hope someone will seriously consider the possibility of adding the same button "add as new" as in any question module.

Best regards,

Massimiliano D. G.

Show
Massimiliano Del Gatto added a comment - Hi everyone and happy New Year! I am currently developing my new course with moodle and this is the first time that I am making a massive use of the lesson module. I am overwhelmed by the power of this module and I am confident that my course will highly benefit from its employment. However, I am frustrated by the fact that there is no "save-as-new-question" button after a question is edited after being created. In order to speed up the question creation, I had to create/duplicate/modify my questions using the question modules, export them and then import them into the lesson and do some more updating: a time consuming activity that would certainly be avoided if such a button were implemented. I hope someone will seriously consider the possibility of adding the same button "add as new" as in any question module. Best regards, Massimiliano D. G.
Hide
David Mudrak added a comment -

It seems that the requested feature MDL-11288 "Ability to copy (or clone) an activity" would solve this.

Show
David Mudrak added a comment - It seems that the requested feature MDL-11288 "Ability to copy (or clone) an activity" would solve this.
Hide
Mark Pearson added a comment -

@David
I would suggest that both these approaches (Save As within Activity, and Clone function in the Outline) are worthy of implementation. Just as the option to 'hide' the activity when creating it and also as an icon in the Outline [editing on] adds a great deal to usability, so the option to Save As inside the Activity in addition to replicate/clone/duplicate in the Outline would add a huge amount to usability. Most, if not all, applications on WIndows or Mac have File -> Save and File -> Save As (although it has to be said that many folks don't comprehend the distinction) and so adding this feature would not cause any cognitive dissonance. On the contrary, Saving As and giving a new name would come quite naturally. The new version would be dumped into the same block and have to be moved to a new position if necessary.

Show
Mark Pearson added a comment - @David I would suggest that both these approaches (Save As within Activity, and Clone function in the Outline) are worthy of implementation. Just as the option to 'hide' the activity when creating it and also as an icon in the Outline [editing on] adds a great deal to usability, so the option to Save As inside the Activity in addition to replicate/clone/duplicate in the Outline would add a huge amount to usability. Most, if not all, applications on WIndows or Mac have File -> Save and File -> Save As (although it has to be said that many folks don't comprehend the distinction) and so adding this feature would not cause any cognitive dissonance. On the contrary, Saving As and giving a new name would come quite naturally. The new version would be dumped into the same block and have to be moved to a new position if necessary.
Hide
Shkarupa Alex added a comment -

Here is new version of patch for moodle 2.0.
I tested it with both high- and low-level File API - works!
There is no more $string['saveasnewobject'] and strtolower($modulename).

Show
Shkarupa Alex added a comment - Here is new version of patch for moodle 2.0. I tested it with both high- and low-level File API - works! There is no more $string['saveasnewobject'] and strtolower($modulename).
Hide
Martin Dougiamas added a comment -

Dongsheng, can you please take a look at this and set up a demo of the patch to look at this week?

Show
Martin Dougiamas added a comment - Dongsheng, can you please take a look at this and set up a demo of the patch to look at this week?
Hide
David Mudrak added a comment -

Alex, thanks for the new patch. I know it may look as non-important detail but please follow the coding style - patches must use Unix end of lines and must not contain trailing whitespaces.

$button->setValue(get_string('saveto') .' '. strtolower(get_string('new')) .' '. strtolower(get_string('modulename',$this->_modname)));

is a very bad style. We must not compose sentences in Moodle in this way. Better way is to have

$string['saveasnew'] = 'Save as new {$a}';

and call it

$button->setValue(get_string('saveasnew', 'moodle', strtolower(get_string('modulename',$this->_modname)));
Show
David Mudrak added a comment - Alex, thanks for the new patch. I know it may look as non-important detail but please follow the coding style - patches must use Unix end of lines and must not contain trailing whitespaces.
$button->setValue(get_string('saveto') .' '. strtolower(get_string('new')) .' '. strtolower(get_string('modulename',$this->_modname)));
is a very bad style. We must not compose sentences in Moodle in this way. Better way is to have
$string['saveasnew'] = 'Save as new {$a}';
and call it
$button->setValue(get_string('saveasnew', 'moodle', strtolower(get_string('modulename',$this->_modname)));
Hide
Dongsheng Cai added a comment -

Thanks Oleg for your patch, and comments from others.

Talked to Martin about this issue, it is a bit confusing to create a new module by pressing edit button, how do you guys think about adding a 'copy' button? See attached image.

Thanks

Show
Dongsheng Cai added a comment - Thanks Oleg for your patch, and comments from others. Talked to Martin about this issue, it is a bit confusing to create a new module by pressing edit button, how do you guys think about adding a 'copy' button? See attached image. Thanks
Hide
Shkarupa Alex added a comment -

I agree that

$string['saveasnew'] = 'Save as new {$a}';

will be better, but this string must present in all languages, isn't it?

Show
Shkarupa Alex added a comment - I agree that
$string['saveasnew'] = 'Save as new {$a}';
will be better, but this string must present in all languages, isn't it?
Hide
David Mudrak added a comment -

Alex: Of course. But you as a developer just add it into the English pack. Our translators would translate that one together with hundreds new strings in Moodle 2.0.

Show
David Mudrak added a comment - Alex: Of course. But you as a developer just add it into the English pack. Our translators would translate that one together with hundreds new strings in Moodle 2.0.
Hide
Oleg Sychev added a comment -

Hi, Dongsheng

One reason for "Save as ...:" button on editing form is that user probably would want to change some settings (activity name or id) before copying.

Other reason is question editing form, where similar "Save as new question" button exists for many years and I don't hear much complaints about how this is confusing. I don't see any reason to do otherwise there - having different ways to do this in different places would be more confusing IMHO.

Show
Oleg Sychev added a comment - Hi, Dongsheng One reason for "Save as ...:" button on editing form is that user probably would want to change some settings (activity name or id) before copying. Other reason is question editing form, where similar "Save as new question" button exists for many years and I don't hear much complaints about how this is confusing. I don't see any reason to do otherwise there - having different ways to do this in different places would be more confusing IMHO.
Hide
Dongsheng Cai added a comment -

Hi Oleg

I didn't mean to remove the editing page, just added a button near module name, so teachers can click->make changes->save.

I made a few changes on your patch to have a button, try this patch.

Thanks

Show
Dongsheng Cai added a comment - Hi Oleg I didn't mean to remove the editing page, just added a button near module name, so teachers can click->make changes->save. I made a few changes on your patch to have a button, try this patch. Thanks
Hide
Shkarupa Alex added a comment -

Here is my fixed version. Now it take "Save as new $a" from moodle.php

Show
Shkarupa Alex added a comment - Here is my fixed version. Now it take "Save as new $a" from moodle.php
Hide
Martin Dougiamas added a comment -

I really prefer the x2 button to initiate this ... we have the same thing on the roles interface. I just saw Dongsheng's UI and it looks good to me +1

But we can easily have BOTH in this case. Dongsheng, can you do it as both (using the new string "Save as new $a" in the button in both cases) and commit?

Show
Martin Dougiamas added a comment - I really prefer the x2 button to initiate this ... we have the same thing on the roles interface. I just saw Dongsheng's UI and it looks good to me +1 But we can easily have BOTH in this case. Dongsheng, can you do it as both (using the new string "Save as new $a" in the button in both cases) and commit?
Hide
Oleg Sychev added a comment -

I like the idea of choosing copy or edit when initiating editing, like icon does it, since choosing that after is prone to errors, when after all changes you press "Save" instead of "Save as new" automatically, I remember such problems with question editing. It even allows us having similar choices where you should be redirected, course page or module page.

However, there may be some minor problems, that should be taken into account:
1. People may prefer to start copying from module page (mod/xxx/view.php), just like "Update button" - for example to avoid loading expensive editing page in large courses. Icon solution doesn't give that freedom of choice, it works only from the course page (course/view.php)
2. I don't really like how icon looks. Maybe it should be like copying icon in TinyMCE instead? Or something similar known to people (copy icon from OpenOffice.org or something)...
3. I don't like icon placement too, I think placing it right after editing icon is better.

Show
Oleg Sychev added a comment - I like the idea of choosing copy or edit when initiating editing, like icon does it, since choosing that after is prone to errors, when after all changes you press "Save" instead of "Save as new" automatically, I remember such problems with question editing. It even allows us having similar choices where you should be redirected, course page or module page. However, there may be some minor problems, that should be taken into account: 1. People may prefer to start copying from module page (mod/xxx/view.php), just like "Update button" - for example to avoid loading expensive editing page in large courses. Icon solution doesn't give that freedom of choice, it works only from the course page (course/view.php) 2. I don't really like how icon looks. Maybe it should be like copying icon in TinyMCE instead? Or something similar known to people (copy icon from OpenOffice.org or something)... 3. I don't like icon placement too, I think placing it right after editing icon is better.
Hide
Dongsheng Cai added a comment -

Hi Oleg

1. Yes, but we will use your patch, then we have them all
2. Because the role editing page use this icon, we are trying to keep consistency
3. Yes, that's what I did in that patch, not the placement in the screenshot.

Show
Dongsheng Cai added a comment - Hi Oleg 1. Yes, but we will use your patch, then we have them all 2. Because the role editing page use this icon, we are trying to keep consistency 3. Yes, that's what I did in that patch, not the placement in the screenshot.
Hide
Petr Škoda (skodak) added a comment - - edited

I do not like this hack at all, it seems like it could work, but it creates new problems and backwards compatibility issues, sorry - the major issues is that it is using the "update" code path for adding of new activities.

The proper approach to solve this problem is IMO to modify the "add" path instead of the update path.
1/ add new parameter copyfrom and look for it when setting up default values for add activity form
2/ add new activity function which modifies the default data - it it is not there, just copy as much as possible from course_modules (groups, etc.) + activity name + description (with files), this shoudl be called before actually setting up the mform
3/ use the rest of standard activity insert code without any modifications at all
4/ the only necessary change in the form is the different button label

The proposed approach above only modifies the defaults in the add activity form instead of fragile hacking of activity update path.

I think these are big potential problems in the patch above:
1/ validation does not work, because it is usually designed to rely on the add/update flags and current cm id (doing update validation before insert is wrong) - BC issue that may lead to white pages or other breakage
2/ the form structure sometimes depends on existing data, which means update and insert forms may be different - again a big BC compatibility issue that might even lead to white pages or other breakage

I am just guessing, but all the idnumber duplicity checks would fail in the current patch, right?

Show
Petr Škoda (skodak) added a comment - - edited I do not like this hack at all, it seems like it could work, but it creates new problems and backwards compatibility issues, sorry - the major issues is that it is using the "update" code path for adding of new activities. The proper approach to solve this problem is IMO to modify the "add" path instead of the update path. 1/ add new parameter copyfrom and look for it when setting up default values for add activity form 2/ add new activity function which modifies the default data - it it is not there, just copy as much as possible from course_modules (groups, etc.) + activity name + description (with files), this shoudl be called before actually setting up the mform 3/ use the rest of standard activity insert code without any modifications at all 4/ the only necessary change in the form is the different button label The proposed approach above only modifies the defaults in the add activity form instead of fragile hacking of activity update path. I think these are big potential problems in the patch above: 1/ validation does not work, because it is usually designed to rely on the add/update flags and current cm id (doing update validation before insert is wrong) - BC issue that may lead to white pages or other breakage 2/ the form structure sometimes depends on existing data, which means update and insert forms may be different - again a big BC compatibility issue that might even lead to white pages or other breakage I am just guessing, but all the idnumber duplicity checks would fail in the current patch, right?
Hide
Petr Škoda (skodak) added a comment -

Updating fix version field.

Show
Petr Škoda (skodak) added a comment - Updating fix version field.
Hide
Helen Foster added a comment -

Thanks for everyone's comments. Please see MDL-11288 for details of how this issue has been fixed in Moodle 2.1.

Show
Helen Foster added a comment - Thanks for everyone's comments. Please see MDL-11288 for details of how this issue has been fixed in Moodle 2.1.

Dates

  • Created:
    Updated:
    Resolved: