Commit c223a86a authored by Patrick Schmalstig's avatar Patrick Schmalstig
Browse files

Fixed MANTIS-5967 (Member multi does not offer suggestions after the first input)

parent b7ce4de2
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -605,10 +605,11 @@ AGE=Age
PT_ALLOW=Allow Private Topics from
PT_ALLOW_DESCRIPTION=Allow members of the following usergroups to start Private Topics with you. To select more than one hold down the Ctrl key (Option key on a mac) when clicking; the selected ones are shown with a highlighted background.
PT_ALLOW_DESCRIPTION_CHAT=Allow members of the following usergroups, and chat friends, to start Private Topics with you. To select more than one hold down the Ctrl key (Option key on a mac) when clicking; the selected ones are shown with a highlighted background.
NO_PT_FROM_ALLOW=Unfortunately you are not in any usergroups that this member will accept Private Topics from.
NO_PT_FROM_ALLOW=That member has usergroup restrictions in place for Private Topics. You are not a member of any of their allowed usergroups.
_NO_PT_FROM_ALLOW={1} has usergroup restrictions in place for Private Topics. You are not a member of any of their allowed usergroups.
PT_RULES_TEXT=Private Topic guidelines
PT_RULES_TEXT_DESCRIPTION=You may write some guidelines here that will be displayed to anyone starting a <abbr title="Private Topic">PT</abbr> with you.
PT_RULES_PAGE_INTRO={1} has written down some correspondence guidelines. Please read these before contacting them.
PT_RULES_PAGE_INTRO={1} has defined Private Topic guidelines which you must follow. Please read before contacting them.
EXTENDED_GROUP_TITLE_NORMAL={1} &nbsp; (ID#{2}, order {3}, {4} {4|member|members})
EXTENDED_GROUP_TITLE_RANK={1} &nbsp; (ID#{2} - promotes to ID#{3}, order {4}, {4} {4|member|members})
IMPORT_EMOTICONS=Import emoticons
+3 −3
Original line number Diff line number Diff line
@@ -35,9 +35,9 @@ ERROR_IMAGE_SAVE=We failed to save the given image ({1})
PHP_UPLOAD_SETTING_VERY_LOW=Your PHP <kbd>{1}</kbd> setting is very low ({2}, which <a href="http://php.net/manual/en/faq.using.php#faq.using.shorthandbytes" target="_blank" title="Explanation of PHP byte value syntax (this link will open in a new window)">parses as</a> {3} bytes).
UNKNOWN_FORMAT=The following file format was not understood: <kbd>{1}</kbd>
MEMBER_LOGIN_ERROR=Login error
MEMBER_NO_EXIST=There is currently no such member registered on this website.
_MEMBER_NO_EXIST=The member &lsquo;{1}&rsquo; does not exist. It may have never existed or may have been deleted.
_GROUP_NO_EXIST=The usergroup &lsquo;{1}&rsquo; does not exist. It may have never existed or may have been deleted.
MEMBER_NO_EXIST=That member does not exist. They may have never existed or may have been deleted.
_MEMBER_NO_EXIST=The member <kbd>{1}</kbd> does not exist. It may have never existed or may have been deleted.
_GROUP_NO_EXIST=The usergroup <kbd>{1}</kbd> does not exist. It may have never existed or may have been deleted.
YOU_ARE_BANNED=You have been banned.
MEMBER_INVALID_LOGIN=Incorrect login or password, try again.
MEMBER_PENDING_DELETION=That member account is being deleted.
+3 −3
Original line number Diff line number Diff line
@@ -57,10 +57,10 @@
                    $cms.loadSnippet('pt_rules&username=' + usernameField.value.trim()).then(function (result) {
                        if (result === '-1') {
                            // Missing member
                            $cms.ui.alert('{!MEMBER_NO_EXIST;^}');
                            $cms.ui.alert('{!MEMBER_NO_EXIST;^}'.replace(/\\{1\\}/, $cms.filter.html(usernameField.value.trim())));
                        } else if (result === '-2') {
                            // Permission denied
                            $cms.ui.alert('{!cns:NO_PT_FROM_ALLOW;^}');
                            $cms.ui.alert('{!cns:_NO_PT_FROM_ALLOW;^}'.replace(/\\{1\\}/, $cms.filter.html(usernameField.value.trim())));
                        } else if (result !== '') {
                            // Rules
                            $cms.ui.confirm('{!cns:PT_RULES_PAGE_INTRO;^,xxx}'.replace(/xxx/, usernameField.value.trim()) + '<br /><br />' + result, function (result2) {
@@ -72,7 +72,7 @@
                    });
                }
            };
            usernameField.onchange = checkPtUsername; // We use onchange because that can be replicated via ensureNextField
            usernameField.onblur = checkPtUsername; // We use onblur because that can be replicated via ensureNextField
        }

        var extraChecks = [];
+17 −7
Original line number Diff line number Diff line
@@ -481,20 +481,30 @@
    };

    $cms.templates.formScreenInputUsernameMulti = function formScreenInputUsernameMulti(params, container) {
        $dom.on(container, 'focus', '.js-focus-update-ajax-member-list', function (e, input) {
            if (input.value === '') {
                $cms.form.updateAjaxMemberList(input, null, true, e);
        // We must assign functions rather than create event listeners so ensureNextField copies them
        var usernameOnFocus = function (event) {
            var usernameField = event.target;
            if (usernameField.value === '') {
                $cms.form.updateAjaxMemberList(usernameField, null, true, event);
            }
        };
        var usernameOnKeyup = function (event) {
            var usernameField = event.target;
            $cms.form.updateAjaxMemberList(usernameField, null, false, event);
        };
        var focusUpdateAjaxMemberListFields = document.querySelectorAll('.js-focus-update-ajax-member-list');
        focusUpdateAjaxMemberListFields.forEach(function (input) {
            input.onfocus = usernameOnFocus;
        });

        $dom.on(container, 'keyup', '.js-keyup-update-ajax-member-list', function (e, input) {
            $cms.form.updateAjaxMemberList(input, null, false, e);
        var keyupUpdateAjaxMemberListFields = document.querySelectorAll('.js-keyup-update-ajax-member-list');
        keyupUpdateAjaxMemberListFields.forEach(function (input) {
            input.onkeyup = usernameOnKeyup;
        });

        // These are handled at the container level and therefore can use event listeners as normal
        $dom.on(container, 'change', '.js-change-ensure-next-field', function (e, input) {
            ensureNextField(input);
        });

        $dom.on(container, 'keypress', '.js-keypress-ensure-next-field', function (e, input) {
            ensureNextField(input);
        });