goImportUsers: function()

in enginframe/hydrogen.manage-users.js [212:246]


    goImportUsers: function () {
        var sdf, uri, msg, message, namespace, inputLabel;

        msg = jQuery('#manage-users-message').hymessage();
        inputLabel = "<p>Upload a CSV compliant file or insert a CSV compliant text containing the User list.</p>" +
                     "<p>The CSV to define users is like the following examples:</p>" +
                     "<p>username1,realname1,group1<br/>" +
                     "username2,,group1,group2<br/>" +
                     "username3,,</p>" +
                     "<p>Where:<br/>" +
                     "- first field is the User Name (required)<br/>" +
                     "- second field is the Real Name (required but can be empty)<br/>" +
                     "- third and following fields are the Groups (optional)</p>";

        manageUsers.importUsersDialog("Import Users", inputLabel, "Import", true, function (formId) {
            jQuery("#" + formId).ajaxSubmit({
                    url: '/' + jQuery.enginframe.rootContext + '/applications/applications.admin.xml' + '?_uri=//com.enginframe.user-group-manager/add.users',
                    type: 'POST',
                    data: {
                        namespace: 'applications'
                    },
                    dataType: 'xml',
                    success: function (responseXML, statusText, xhr) {
                        msg.css('white-space', 'pre-wrap');
                        msg.hymessage('info', jQuery(responseXML).find('ef\\:message, message').text(), 5000);
                        manageUsers.refresh();
                    },
                    error: function (xhr, statusText, errorThrown) {
                        msg.css('white-space', 'pre-wrap');
                        msg.hymessage('alert', jQuery(xhr.responseText).find('ef\\:message, message').text(), 15000);
                        manageUsers.refresh();
                    }
            }).clearForm();
        });
    },