Collection missing 'cancel' during create functionality

Bug #619266 reported by Stacey Walker
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Stacey Walker

Bug Description

Functionality for canceling creation of a new collection has disappeared.

Using the existing functionality in view creation as a template, this should be checking for the 'new' flag, alerting the user about the fact that they are canceling and then removing all traces of the aborted collection.

Edit collection, add views and collection access pages need to ensure the user can cancel creation at any stage.

Tags: collections
Stacey Walker (stacey)
Changed in mahara:
assignee: nobody → Stacey Walker (stacey)
Changed in mahara:
status: New → Confirmed
importance: Undecided → Medium
milestone: none → 1.3.0
Stacey Walker (stacey)
Changed in mahara:
status: Confirmed → In Progress
Revision history for this message
Stacey Walker (stacey) wrote :

While fixing this I thought about visually making the 'next' element on the right of the 'cancel' (which I'd wanted to do for a while).

Using the existing submitcancel pieform element this wasn't possible due to the explicit indexing and "drawing" of the elements in the return statement.

I had originally copied this and created a new element called cancelsubmit that simply just reversed everything. Richard then suggested that we instead make the submitcancel element more generic and handle some string indices as well as the default numeric indices. That way we can add the submit/cancel buttons in any order we want by specifying what they are with 'cancel' and 'submit' as array keys. The way they are entered into the array determines the order in which they will be drawn in the form.

http://gitorious.org/~stacey/mahara/staceys-sandbox/commit/b2989c50b8b4e74c494c93fde97261fae560f568

e.g., we can add cancel and submit buttons by either of the following ways:

$elements['submit']['values'] = array(
        'submit' => get_string('submit'),
        'cancel' => get_string('cancel'),
);

 or,

$elements['submit']['values'] = array(get_string('cancel'), get_string('submit'));

The first syntax might also mean that we can have any amount of elements if we wanted; provided the plugin does exist.

e.g.,

$elements['submit']['values'] = array(
        'submit' => get_string('submit'),
        'cancel' => get_string('cancel'),
        'anotherplugin' => get_string('anotherplugin'),
        ...
);

I haven't tested just what you can add in there yet. :) but if it does work with lots of plugins, then it might solve one of the TODOs at the bottom of this page: http://wiki.mahara.org/Developer_Area/Core_Subsystems/Form_API_(Pieforms)

any thoughts?

I also have the simple fix for the cancellation issue now, but I need to separate it out into more appropriate commits before pushing to master.

Revision history for this message
Stacey Walker (stacey) wrote :
Revision history for this message
Richard Mansfield (richard-mansfield) wrote :

Stacey,

I reckon if you can make the submitcancel element generalisable to take any number of other pieform elements, then 'submitcancel' is no longer a particularly good name for it.

So if you can test it on the other elements, and it works, you might as well just leave submitcancel as it is, and create a new pieform element called 'elements' or something.

If it's only going to work with submit & cancel elements, then it'd be better to keep it simple so you don't give people false hope, and just be boring and use 0 if the 'submit' key is not set, etc.

Revision history for this message
Stacey Walker (stacey) wrote :

Hi Richard,

If 'submit' and 'cancel' are not used as keys then it falls back to 0, 1 indices to display submit cancel.

I will test the other elements when I have time later.

Stacey

Revision history for this message
Stacey Walker (stacey) wrote :

Have pushed some commits to fix this item.

Fixes to submitcancel pieform element enable the developer to enter submit/cancel in any order using string indices. If the indices aren't strings or invalid (i.e., not 'submit' or 'cancel') then the functionality falls back on the standard 0 = submit, 1 = cancel situation. Have also added a check to ensure these default indices exist so to avoid any possible unsightly errors.

There is an existing check at the top of the page that limits the elements entered in submitcancel to exactly 2 items.

Stacey

Changed in mahara:
status: In Progress → Fix Committed
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.