Moodle
  1. Moodle
  2. MDL-16756

Improved method for deleting multiple groups

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.2
    • Fix Version/s: 1.9.4
    • Component/s: Groups
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      36857

      Description

      We have an issue where admin staff frequently want to delete a whole grouping worth of groups at once. This is tedious at the moment because you can only delete groups one at a time.

      I can see two possible ways to improve this:

      OPTION 1: Allow multiple selection in the Groups list

      The 'confirm delete' page would then show a list of all groups being deleted before the 'are you sure' buttons.

      OPTION 2: When deleting a grouping, change the 'confirm delete y/n' screen so that it includes at the top a couple radio buttons. Default would be to just delete the grouping as present, but you can also choose to delete all groups in it.

      =What to delete=

      [ x ] Just delete the grouping
      [ ] Also delete all groups in the grouping:
      Mary Jane's group
      Anne Other's group
      etc

      =Confirm delete=

      Are you sure? This cannot be undone.

      [Delete grouping] [Cancel]

      OPTION 3: Both of the above

      Option 1 also provides benefit for people who don't use groupings and just might want to delete several groups at once, but has disadvantage that you have to manually select the groups. (Also need to mess about with JS to make sure you can't click the 'edit group' button when multiple are selected, but that shouldn't be hard.)

      Option 2 is most convenient for people who use groupings.

      Opinions welcomed please - if somebody is good with either or both of these options I will look into implementing it - for 2.0 and also for 1.9.x if you like, up to you (I'll be doing that for ours). I think one/both of these would be a good minor UI improvement.

        Activity

        Hide
        Petr Škoda added a comment -

        my +1 for option 1

        Show
        Petr Škoda added a comment - my +1 for option 1
        Hide
        Sam Marshall added a comment -

        OK, following discussion with Petr and Nicolas:

        I will implement option 1 above (ctrl-click to select and delete multiple groups).

        Details:

        1) Behaviour if you only select a single group will be the same as it currently is.
        2) The confirm page will list all groups being deleted as above.
        3) Using JS, the 'edit' button will be greyed out if you select more than one group.
        4) The edit script will be modified to give an error in case you select more than one group (with JS disabled).
        5) The help file for this screen will be slightly altered to mention that you can use multiple select to delete groups.

        This will be done for 1.9.4 and 2.0.

        Show
        Sam Marshall added a comment - OK, following discussion with Petr and Nicolas: I will implement option 1 above (ctrl-click to select and delete multiple groups). Details: 1) Behaviour if you only select a single group will be the same as it currently is. 2) The confirm page will list all groups being deleted as above. 3) Using JS, the 'edit' button will be greyed out if you select more than one group. 4) The edit script will be modified to give an error in case you select more than one group (with JS disabled). 5) The help file for this screen will be slightly altered to mention that you can use multiple select to delete groups. This will be done for 1.9.4 and 2.0.
        Hide
        Sam Marshall added a comment -

        Files altered:

        group/clientlib.js
        group/delete.php
        group/group.php
        group/index.php
        lang/en_utf8/group.php

        Here are the details on the change:

        1) Some other minor bugs are fixed as part of the change, including:

        • initially-specified group name (or any selected group name when non-AJAX) was not shown under 'Members by' heading.
        • when in non-AJAX mode some buttons were disabled until you clicked 'show group members'; this was inappropriate and meant you had to do an extra pageload/click for no good reason.

        2) I added the new error strings 'errorselectone', 'errorselectsome' in groups.php langfile: 'Please select a single group' and 'Please select one or more groups'. [These only apply when not using AJAX so that you can click a button when you haven't got the right things selected. The system previously gave unhelpful errors in this situation.]

        3) You can still access both changed scripts with the same parameters to refer to groups: ?group=N in the case of index.php and ?id=N in the case of delete.php. I made sure to retain these as working, because they are/may be linked from elsewhere. However in the case of index.php you can also pass in group[]=1&group[]=2 etc (ie php array from the <select>), and in the case of group.php [used for delete] it actually redirects to a new delete.php?courseid=N&groups=1,2,3 etc (PARAM_SEQUENCE)

        4) I had to add one non-error language string. This language string 'deletegroupsconfirm' is only used if you select multiple groups. If it is not permitted to add non-error language strings to 1.9, this string could be deleted (replaced with nothing and just the heading 'Delete group' to clue the users in as to what yes/no means).

        5) There isn't actually a helpfile for groups, so I didn't edit it

        I tested mainly on core MOODLE_19 and briefly on HEAD (which required changes for new DB syntax).

        Show
        Sam Marshall added a comment - Files altered: group/clientlib.js group/delete.php group/group.php group/index.php lang/en_utf8/group.php Here are the details on the change: 1) Some other minor bugs are fixed as part of the change, including: initially-specified group name (or any selected group name when non-AJAX) was not shown under 'Members by' heading. when in non-AJAX mode some buttons were disabled until you clicked 'show group members'; this was inappropriate and meant you had to do an extra pageload/click for no good reason. 2) I added the new error strings 'errorselectone', 'errorselectsome' in groups.php langfile: 'Please select a single group' and 'Please select one or more groups'. [These only apply when not using AJAX so that you can click a button when you haven't got the right things selected. The system previously gave unhelpful errors in this situation.] 3) You can still access both changed scripts with the same parameters to refer to groups: ?group=N in the case of index.php and ?id=N in the case of delete.php. I made sure to retain these as working, because they are/may be linked from elsewhere. However in the case of index.php you can also pass in group[]=1&group[]=2 etc (ie php array from the <select>), and in the case of group.php [used for delete] it actually redirects to a new delete.php?courseid=N&groups=1,2,3 etc (PARAM_SEQUENCE) 4) I had to add one non-error language string. This language string 'deletegroupsconfirm' is only used if you select multiple groups. If it is not permitted to add non-error language strings to 1.9, this string could be deleted (replaced with nothing and just the heading 'Delete group' to clue the users in as to what yes/no means). 5) There isn't actually a helpfile for groups, so I didn't edit it I tested mainly on core MOODLE_19 and briefly on HEAD (which required changes for new DB syntax).
        Hide
        Petr Škoda added a comment -

        thanks a lot!

        Show
        Petr Škoda added a comment - thanks a lot!

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: