Index: lams_central/web/orgGroup.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/orgGroup.jsp,v diff -u -r1.4.2.5 -r1.4.2.6 --- lams_central/web/orgGroup.jsp 9 Feb 2016 18:52:57 -0000 1.4.2.5 +++ lams_central/web/orgGroup.jsp 25 Apr 2016 08:30:43 -0000 1.4.2.6 @@ -58,13 +58,13 @@ - + + onClick="javascript:showOrgGroupDialogContents(null, 460, 460,'OrganisationGroup.do?method=viewGroupings&organisationID=' + $('#dialogOrgGroup').dialog('option', 'orgID'))" + style="right: 170px;"> Index: lams_central/web/includes/javascript/dialog.js =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/dialog.js,v diff -u -r1.1.2.4 -r1.1.2.5 --- lams_central/web/includes/javascript/dialog.js 9 Jun 2015 20:20:02 -0000 1.1.2.4 +++ lams_central/web/includes/javascript/dialog.js 25 Apr 2016 08:30:43 -0000 1.1.2.5 @@ -4,12 +4,16 @@ * Checks if the dialog is already opened. * If not, creates a new dialog with the given ID and init parameters. */ -function showDialog(id, initParams, extraButtons) { +function showDialog(id, initParams, extraButtons, recreate) { var dialog = $('#' + id); + // is it open already? if (dialog.length > 0) { - // is it open already? - dialog.dialog('moveToTop'); - return; + if (recreate){ + dialog.dialog('close'); + } else { + dialog.dialog('moveToTop'); + return; + } } // create a new dialog by cloning a template Index: lams_central/web/includes/javascript/groupDisplay.js =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/groupDisplay.js,v diff -u -r1.37.2.15 -r1.37.2.16 --- lams_central/web/includes/javascript/groupDisplay.js 21 Apr 2016 09:13:16 -0000 1.37.2.15 +++ lams_central/web/includes/javascript/groupDisplay.js 25 Apr 2016 08:30:43 -0000 1.37.2.16 @@ -588,25 +588,27 @@ $("#" + id).dialog('close'); } -/** - * Loads contents to already open organisation groups dialog. - */ -function loadOrgGroupDialogContents(title, width, height, url) { - var dialog = $('#dialogOrgGroup'); - if (title) { - dialog.dialog('option', 'title', title); +function showOrgGroupDialogContents(title, width, height, url) { + var id = "dialogOrgGroup", + dialog = $('#' + id), + exists = dialog.length > 0, + orgID = null; + if (exists) { + if (!title) { + title = dialog.dialog('option', 'title'); + } + orgID = dialog.dialog('option', 'orgID'); } - if (width && height) { - dialog.dialog('option', { - 'width' : width, - 'height' : height, - }).dialog('option', 'position', 'center'); - } - if (url) { - $('iframe', dialog).contents().find("body").html(''); - $('iframe', dialog).attr('src', url); - $('div.ui-dialog-titlebar .customDialogButton').remove(); - } + showDialog(id, { + 'orgID' : orgID, + 'height' : height, + 'width' : width, + 'title' : title, + 'hide' : false, + 'open' : function() { + $('iframe', this).attr('src', url); + } + }, true, exists); } /** @@ -616,7 +618,7 @@ function saveOrgGroups() { var groupsSaved = $('#dialogOrgGroup iframe')[0].contentWindow.saveGroups(); if (groupsSaved) { - loadOrgGroupDialogContents(null, 460, 460, + showOrgGroupDialogContents(null, 460, 460, LAMS_URL + 'OrganisationGroup.do?method=viewGroupings&organisationID=' + $('#dialogOrgGroup').dialog('option', 'orgID')); } Index: lams_central/web/includes/javascript/orgGroup.js =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/orgGroup.js,v diff -u -r1.6.2.2 -r1.6.2.3 --- lams_central/web/includes/javascript/orgGroup.js 4 Mar 2016 13:40:50 -0000 1.6.2.2 +++ lams_central/web/includes/javascript/orgGroup.js 25 Apr 2016 08:30:43 -0000 1.6.2.3 @@ -25,7 +25,7 @@ } else { $('#groupingName').val(grouping.name); // move Save button to the titlebar, i.e. outside of this iframe to the enveloping dialog - $('div.ui-dialog-titlebar', window.parent.document).prepend($('.customDialogButton')); + $('div.ui-dialog-titlebar', window.parent.document).append($('.customDialogButton')); } if (canEdit) { @@ -68,7 +68,7 @@ }); if (!nameIsUnique) { groupTopIndex++; - name = LABELS.GROUP_PREFIX_LABEL + groupTopIndex; + name = LABELS.GROUP_PREFIX_LABEL + ' ' + groupTopIndex; } } while (!nameIsUnique); Index: lams_central/web/includes/javascript/orgGrouping.js =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/orgGrouping.js,v diff -u -r1.2.2.1 -r1.2.2.2 --- lams_central/web/includes/javascript/orgGrouping.js 5 May 2015 11:08:47 -0000 1.2.2.1 +++ lams_central/web/includes/javascript/orgGrouping.js 25 Apr 2016 08:30:43 -0000 1.2.2.2 @@ -33,6 +33,6 @@ } } else { // load to dialog - window.parent.loadOrgGroupDialogContents(null, 880, 460, url); + window.parent.showOrgGroupDialogContents(null, 880, 500, url); } } \ No newline at end of file