當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript CoreDomUtilsProvider.showModalLoading方法代碼示例

本文整理匯總了TypeScript中@providers/utils/dom.CoreDomUtilsProvider.showModalLoading方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript CoreDomUtilsProvider.showModalLoading方法的具體用法?TypeScript CoreDomUtilsProvider.showModalLoading怎麽用?TypeScript CoreDomUtilsProvider.showModalLoading使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@providers/utils/dom.CoreDomUtilsProvider的用法示例。


在下文中一共展示了CoreDomUtilsProvider.showModalLoading方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: parseInt

        this.element.addEventListener('click', (ev: Event): void => {
            if (!this.module && !this.moduleId) {
                return;
            }

            ev.preventDefault();
            ev.stopPropagation();

            const modal = this.domUtils.showModalLoading(),
                courseId = typeof this.courseId == 'string' ? parseInt(this.courseId, 10) : this.courseId;
            let promise;

            if (this.module) {
                // We already have the module.
                promise = Promise.resolve(this.module);
            } else {
                // Try to get the module from cache.
                this.moduleId = typeof this.moduleId == 'string' ? parseInt(this.moduleId, 10) : this.moduleId;
                promise = this.courseProvider.getModule(this.moduleId, courseId);
            }

            promise.then((module) => {
                const componentId = this.componentId || module.id;

                return this.courseHelper.downloadModuleAndOpenFile(module, courseId, this.component, componentId, this.files);
            }).catch((error) => {
                this.domUtils.showErrorModalDefault(error, 'core.errordownloading', true);
            }).finally(() => {
                modal.dismiss();
            });
        });
開發者ID:SATS-Seminary,項目名稱:moodlemobile2,代碼行數:31,代碼來源:download-module-main-file.ts

示例2: completionClicked

    /**
     * Completion clicked.
     *
     * @param {Event} e The click event.
     */
    completionClicked(e: Event): void {
        if (this.completion) {
            if (typeof this.completion.cmid == 'undefined' || this.completion.tracking !== 1) {
                return;
            }

            e.preventDefault();
            e.stopPropagation();

            const modal = this.domUtils.showModalLoading(),
                params = {
                    cmid: this.completion.cmid,
                    completed: this.completion.state === 1 ? 0 : 1
                },
                currentSite = this.sitesProvider.getCurrentSite();

            currentSite.write('core_completion_update_activity_completion_status_manually', params).then((response) => {
                if (!response.status) {
                    return Promise.reject(null);
                }

                this.completionChanged.emit();
            }).catch((error) => {
                this.domUtils.showErrorModalDefault(error, 'core.errorchangecompletion', true);
            }).finally(() => {
                modal.dismiss();
            });
        }
    }
開發者ID:jleyva,項目名稱:moodlemobile2,代碼行數:34,代碼來源:module-completion.ts

示例3: resetPassword

    /**
     * Request to reset the password.
     *
     * @param {Event} e Event.
     */
    resetPassword(e: Event): void {
        e.preventDefault();
        e.stopPropagation();

        const field = this.myForm.value.field,
            value = this.myForm.value.value;

        if (!value) {
            this.domUtils.showErrorModal('core.login.usernameoremail', true);

            return;
        }

        const modal = this.domUtils.showModalLoading('core.sending', true),
            isMail = field == 'email';

        this.loginHelper.requestPasswordReset(this.siteUrl, isMail ? '' : value, isMail ? value : '').then((response) => {
            if (response.status == 'dataerror') {
                // Error in the data sent.
                this.showError(isMail, response.warnings);
            } else if (response.status == 'emailpasswordconfirmnotsent' || response.status == 'emailpasswordconfirmnoemail') {
                // Error, not found.
                this.domUtils.showErrorModal(response.notice);
            } else {
                // Success.
                this.domUtils.showAlert(this.translate.instant('core.success'), response.notice);
                this.navCtrl.pop();
            }
        }).catch((error) => {
            this.domUtils.showErrorModal(error);
        }).finally(() => {
            modal.dismiss();
        });
    }
開發者ID:SATS-Seminary,項目名稱:moodlemobile2,代碼行數:39,代碼來源:forgotten-password.ts

示例4: completionClicked

    /**
     * Completion clicked.
     *
     * @param {Event} e The click event.
     */
    completionClicked(e: Event): void {
        if (this.completion) {
            if (typeof this.completion.cmid == 'undefined' || this.completion.tracking !== 1) {
                return;
            }

            e.preventDefault();
            e.stopPropagation();

            const modal = this.domUtils.showModalLoading();

            this.courseProvider.markCompletedManually(this.completion.cmid, this.completion.state === 1 ? 0 : 1,
                    this.completion.courseId, this.completion.courseName).then((response) => {

                if (!response.status) {
                    return Promise.reject(null);
                }

                this.completionChanged.emit();
            }).catch((error) => {
                this.domUtils.showErrorModalDefault(error, 'core.errorchangecompletion', true);
            }).finally(() => {
                modal.dismiss();
            });
        }
    }
開發者ID:SATS-Seminary,項目名稱:moodlemobile2,代碼行數:31,代碼來源:module-completion.ts

示例5: open

 /**
  * Opens a URL.
  *
  * @param {string} url The URL to go to.
  */
 open(url: string): void {
     const modal = this.domUtils.showModalLoading();
     this.contentLinksHelper.handleLink(url).then((treated) => {
         if (!treated) {
             return this.sitesProvider.getCurrentSite().openInBrowserWithAutoLoginIfSameSite(url);
         }
     }).finally(() => {
         modal.dismiss();
     });
 }
開發者ID:SATS-Seminary,項目名稱:moodlemobile2,代碼行數:15,代碼來源:helper.ts

示例6: callWS

    /**
     * Call a WS.
     *
     * @return {Promise<any>} Promise resolved when done.
     */
    protected callWS(): Promise<any> {
        const modal = this.domUtils.showModalLoading();

        return super.callWS().catch((error) => {
            if (typeof this.showError == 'undefined' || this.utils.isTrueOrOne(this.showError)) {
                this.domUtils.showErrorModalDefault(error, 'core.serverconnection', true);
            }
        }).finally(() => {
            modal.dismiss();
        });
    }
開發者ID:SATS-Seminary,項目名稱:moodlemobile2,代碼行數:16,代碼來源:call-ws-click-directive.ts

示例7: login

    /**
     * Tries to authenticate the user.
     *
     * @param {Event} e Event.
     */
    login(e: Event): void {
        e.preventDefault();
        e.stopPropagation();

        this.appProvider.closeKeyboard();

        // Get input data.
        const siteUrl = this.siteUrl,
            username = this.username,
            password = this.credForm.value.password;

        if (!password) {
            this.domUtils.showErrorModal('core.login.passwordrequired', true);

            return;
        }

        if (!this.appProvider.isOnline()) {
            this.domUtils.showErrorModal('core.networkerrormsg', true);

            return;
        }

        const modal = this.domUtils.showModalLoading();

        // Start the authentication process.
        this.sitesProvider.getUserToken(siteUrl, username, password).then((data) => {
            return this.sitesProvider.updateSiteToken(this.infoSiteUrl, username, data.token, data.privateToken).then(() => {
                // Update site info too because functions might have changed (e.g. unisntall local_mobile).
                return this.sitesProvider.updateSiteInfoByUrl(this.infoSiteUrl, username).then(() => {
                    // Reset fields so the data is not in the view anymore.
                    this.credForm.controls['password'].reset();

                    if (this.pageName) {
                        // Page defined, go to that page instead of site initial page.
                        return this.navCtrl.setRoot(this.pageName, this.pageParams);
                    } else {
                        return this.loginHelper.goToSiteInitialPage();
                    }
                }).catch((error) => {
                    // Error, go back to login page.
                    this.domUtils.showErrorModalDefault(error, 'core.login.errorupdatesite', true);
                    this.cancel();
                });
            });
        }).catch((error) => {
            this.loginHelper.treatUserTokenError(siteUrl, error, username, password);
        }).finally(() => {
            modal.dismiss();
        });
    }
開發者ID:SATS-Seminary,項目名稱:moodlemobile2,代碼行數:56,代碼來源:reconnect.ts

示例8: accept

 /**
  * Accept the site policy.
  */
 accept(): void {
     const modal = this.domUtils.showModalLoading('core.sending', true);
     this.loginHelper.acceptSitePolicy(this.siteId).then(() => {
         // Success accepting, go to site initial page.
         // Invalidate cache since some WS don't return error if site policy is not accepted.
         return this.currentSite.invalidateWsCache().catch(() => {
             // Ignore errors.
         }).then(() => {
             return this.loginHelper.goToSiteInitialPage();
         });
     }).catch((error) => {
         this.domUtils.showErrorModalDefault(error, 'Error accepting site policy.');
     }).finally(() => {
         modal.dismiss();
     });
 }
開發者ID:SATS-Seminary,項目名稱:moodlemobile2,代碼行數:19,代碼來源:site-policy.ts

示例9:

        this.element.addEventListener('click', (ev: Event): void => {
            if (!this.file) {
                return;
            }

            ev.preventDefault();
            ev.stopPropagation();

            const modal = this.domUtils.showModalLoading();

            this.fileHelper.downloadAndOpenFile(this.file, this.component, this.componentId).catch((error) => {
                this.domUtils.showErrorModalDefault(error, 'core.errordownloading', true);
            }).finally(() => {
                modal.dismiss();
            });
        });
開發者ID:SATS-Seminary,項目名稱:moodlemobile2,代碼行數:16,代碼來源:download-file.ts

示例10:

        return this.fileUploaderHelper.selectAndUploadFile(maxSize).then((result) => {
            if (!result) {
                return Promise.reject(null);
            }

            // File uploaded. Move it to private files.
            const modal = this.domUtils.showModalLoading('core.fileuploader.uploading', true);

            return this.filesProvider.moveFromDraftToPrivate(result.itemid).catch((error) => {
                this.domUtils.showErrorModalDefault(error, 'core.fileuploader.errorwhileuploading', true);

                return Promise.reject(null);
            }).finally(() => {
                modal.dismiss();
            });
        }).then(() => {
開發者ID:SATS-Seminary,項目名稱:moodlemobile2,代碼行數:16,代碼來源:helper.ts


注:本文中的@providers/utils/dom.CoreDomUtilsProvider.showModalLoading方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。