Commit 4a5ce96d authored by Robert Lyon's avatar Robert Lyon

Bug #1353809: Show correct messages on error and success

To stop the error message still showing on success

Change-Id: Id8b618fbfd62d0610304a211ccfd777bb87e08c8
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent b4203597
......@@ -237,7 +237,7 @@ jQuery(function($) {
var data = {'name':name,
'itemid':itemid};
sendjsonrequest('updategroup.json.php', data, 'POST', function(r) {
getitems(r);
getitems(r.data);
});
return false;
}
......
......@@ -22,11 +22,12 @@ $itemid = param_variable('itemid');
$data = new stdClass();
$data->title = $name;
$messagetype = 'updated';
try {
if ($itemid == 'new') {
$data->displayorder = 0; //Place holder.
$itemid = insert_record('group_category',$data,'id',true);
$itemid = insert_record('group_category', $data, 'id', true);
$messagetype = 'added';
}
else {
$data->id = (int)$itemid;
......@@ -36,6 +37,7 @@ try {
group_sort_categories();
}
catch (Exception $e) {
json_reply('local',get_string('savefailed','admin'));
json_reply('local', get_string('savefailed','admin'));
}
json_reply(false, array('id' => (int)$itemid));
json_reply(false, array('message' => get_string('groupcategory' . $messagetype, 'admin'),
'data' => array('id' => (int)$itemid)));
......@@ -221,6 +221,8 @@ $string['addcategories'] = 'Add categories';
$string['allowgroupcategoriesdescription1'] = 'Allow site administrators to create categories for users to assign their groups';
$string['groupoptionsset'] = 'Group options have been updated.';
$string['groupcategorydeleted'] = 'Category deleted';
$string['groupcategoryupdated'] = 'Category updated';
$string['groupcategoryadded'] = 'Category added';
$string['confirmdeletecategory'] = 'Do you really want to delete this category?';
$string['groupcategoriespagedescription'] = 'The categories listed here can be assigned to groups during group creation and used to filter groups during searches.';
$string['groupquotas'] = "Group quota for '%s'";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment