当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript CoreDomUtilsProvider.showErrorModal方法代码示例

本文整理汇总了TypeScript中@providers/utils/dom.CoreDomUtilsProvider.showErrorModal方法的典型用法代码示例。如果您正苦于以下问题:TypeScript CoreDomUtilsProvider.showErrorModal方法的具体用法?TypeScript CoreDomUtilsProvider.showErrorModal怎么用?TypeScript CoreDomUtilsProvider.showErrorModal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@providers/utils/dom.CoreDomUtilsProvider的用法示例。


在下文中一共展示了CoreDomUtilsProvider.showErrorModal方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: 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

示例2: ngOnInit

    /**
     * Component being initialized.
     */
    ngOnInit(): void {
        if (!this.filePath) {
            this.domUtils.showErrorModal('Error reading file.');
            this.navCtrl.pop();

            return;
        }

        const fileAndDir = this.fileProvider.getFileAndDirectoryFromPath(this.filePath);
        this.fileName = fileAndDir.name;

        // Get the file.
        this.fileProvider.getExternalFile(this.filePath).then((fe) => {
            this.fileEntry = fe;
            this.fileName = this.fileEntry.name;
        }).catch(() => {
            this.domUtils.showErrorModal('Error reading file.');
            this.navCtrl.pop();
        });

        // Get the sites.
        this.sitesProvider.getSites().then((sites) => {
            this.sites = sites;
        }).finally(() => {
            this.loaded = true;
        });
    }
开发者ID:SATS-Seminary,项目名称:moodlemobile2,代码行数:30,代码来源:choose-site.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: showError

 // Show an error from the warnings.
 protected showError(isMail: boolean, warnings: any[]): void {
     for (let i = 0; i < warnings.length; i++) {
         const warning = warnings[i];
         if ((warning.item == 'email' && isMail) || (warning.item == 'username' && !isMail)) {
             this.domUtils.showErrorModal(warning.message);
             break;
         }
     }
 }
开发者ID:SATS-Seminary,项目名称:moodlemobile2,代码行数:10,代码来源:forgotten-password.ts

示例5: if

 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) => {
开发者ID:SATS-Seminary,项目名称:moodlemobile2,代码行数:13,代码来源:forgotten-password.ts

示例6: add

    /**
     * Add a new attachment.
     */
    add(): void {
        const allowOffline = this.allowOffline && this.allowOffline !== 'false';

        if (!allowOffline && !this.appProvider.isOnline()) {
            this.domUtils.showErrorModal('core.fileuploader.errormustbeonlinetoupload', true);
        } else {
            const mimetypes = this.fileTypes && this.fileTypes.mimetypes;

            this.fileUploaderHelper.selectFile(this.maxSize, allowOffline, undefined, mimetypes).then((result) => {
                this.files.push(result);
            }).catch((error) => {
                this.domUtils.showErrorModalDefault(error, 'Error selecting file.');
            });
        }
    }
开发者ID:SATS-Seminary,项目名称:moodlemobile2,代码行数:18,代码来源:attachments.ts

示例7: oauthClicked

 /**
  * An OAuth button was clicked.
  *
  * @param {any} provider The provider that was clicked.
  */
 oauthClicked(provider: any): void {
     if (!this.loginHelper.openBrowserForOAuthLogin(this.siteUrl, provider, this.siteConfig.launchurl)) {
         this.domUtils.showErrorModal('Invalid data.');
     }
 }
开发者ID:jleyva,项目名称:moodlemobile2,代码行数:10,代码来源:reconnect.ts

示例8:

 }).catch(() => {
     this.domUtils.showErrorModal('Error reading file.');
     this.navCtrl.pop();
 });
开发者ID:SATS-Seminary,项目名称:moodlemobile2,代码行数:4,代码来源:choose-site.ts

示例9:

 }).catch((error) => {
     this.domUtils.showErrorModal(error);
 }).finally(() => {
开发者ID:SATS-Seminary,项目名称:moodlemobile2,代码行数:3,代码来源:forgotten-password.ts

示例10:

 }).catch(() => {
     this.domUtils.showErrorModal('core.contentlinks.errornosites', true);
     this.leaveView();
 }).finally(() => {
开发者ID:SATS-Seminary,项目名称:moodlemobile2,代码行数:4,代码来源:choose-site.ts


注:本文中的@providers/utils/dom.CoreDomUtilsProvider.showErrorModal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。