2009-11-21 04:20:17 +01:00
|
|
|
(function($) {
|
2010-02-11 00:06:31 +01:00
|
|
|
|
2010-02-11 00:06:35 +01:00
|
|
|
var refreshAfterImport = function(e) {
|
|
|
|
// Check for a message <div>, an indication that the form has been submitted.
|
|
|
|
var existingFormMessage = $($(this).contents()).find('.message');
|
|
|
|
if(existingFormMessage && existingFormMessage.html()) {
|
|
|
|
// Refresh member listing
|
|
|
|
var memberTableField = $(window.parent.document).find('#Form_EditForm_Members').get(0);
|
|
|
|
if(memberTableField) memberTableField.refresh();
|
|
|
|
|
|
|
|
// Refresh tree
|
|
|
|
var tree = $(window.parent.document).find('#sitetree').get(0);
|
|
|
|
if(tree) tree.reload();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-02-11 00:06:31 +01:00
|
|
|
/**
|
|
|
|
* Refresh the member listing every time the import iframe is loaded,
|
|
|
|
* which is most likely a form submission.
|
|
|
|
*/
|
|
|
|
$(window).bind('load', function(e) {
|
2010-04-13 07:55:56 +02:00
|
|
|
$('#MemberImportFormIframe,#GroupImportFormIframe').entwine({
|
2010-02-11 00:06:35 +01:00
|
|
|
onmatch: function() {
|
|
|
|
this._super();
|
|
|
|
|
2010-04-13 07:55:56 +02:00
|
|
|
// TODO entwine can't seem to bind to iframe load events
|
2010-02-11 00:06:35 +01:00
|
|
|
$(this).bind('load', refreshAfterImport);
|
2010-02-11 00:06:31 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
2009-11-21 04:20:17 +01:00
|
|
|
/**
|
|
|
|
* Delete selected folders through "batch actions" tab.
|
|
|
|
*/
|
|
|
|
$(document).ready(function() {
|
2010-04-13 07:55:56 +02:00
|
|
|
$('#Form_BatchActionsForm').entwine('ss').register(
|
2009-11-21 04:20:17 +01:00
|
|
|
// TODO Hardcoding of base URL
|
|
|
|
'admin/security/batchactions/delete',
|
|
|
|
function(ids) {
|
|
|
|
var confirmed = confirm(
|
|
|
|
ss.i18n.sprintf(
|
|
|
|
ss.i18n._t('SecurityAdmin.BATCHACTIONSDELETECONFIRM'),
|
|
|
|
ids.length
|
|
|
|
)
|
|
|
|
);
|
|
|
|
return (confirmed) ? ids : false;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
2009-11-21 04:21:10 +01:00
|
|
|
|
2010-04-13 07:55:56 +02:00
|
|
|
$.entwine('ss', function($){
|
|
|
|
$('#Form_EditForm .Actions #Form_EditForm_action_addmember').entwine({
|
2009-11-21 04:21:10 +01:00
|
|
|
onclick: function(e) {
|
|
|
|
// CAUTION: Assumes that a MemberTableField-instance is present as an editing form
|
|
|
|
var t = $('#Form_EditForm_Members');
|
|
|
|
t[0].openPopup(
|
|
|
|
null,
|
|
|
|
$('base').attr('href') + t.find('a.addlink').attr('href'),
|
|
|
|
t.find('table')[0]
|
|
|
|
);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}(jQuery));
|