public getRecommendationLabel(motion: MotionBlockSlideMotionRepresentation): string {
        let recommendation = this.translate.instant(motion.recommendation.name);
        if (motion.recommendation_extension) {
            const extension = motion.recommendation_extension.replace(/\[motion:(\d+)\]/g, (match, id) => {
                const titleInformation = this.data.data.referenced_motions[id];
                if (titleInformation) {
                    return this.motionRepo.getIdentifierOrTitle(titleInformation);
                } else {
                    return this.translate.instant('<unknown motion>');
                }
            });

            recommendation += ' ' + extension;
        }
        return recommendation;
    }
Example #2
0
    /**
     * Creates pdfmake definitions for basic information about the motion and
     * comments or notes
     *
     * @param note string optionally containing html layout
     * @param motion the ViewMotion this note refers to
     * @param noteTitle additional heading to be used (will be translated)
     * @returns pdfMake definitions
     */
    public textToDocDef(note: string, motion: ViewMotion, noteTitle: string): object {
        const title = this.createTitle(motion);
        const subtitle = this.createSubtitle(motion);
        const metaInfo = this.createMetaInfoTable(
            motion,
            this.configService.instant('motions_recommendation_text_mode'),
            ['submitters', 'state', 'category']
        );
        const noteContent = this.htmlToPdfService.convertHtml(note);

        const subHeading = {
            text: this.translate.instant(noteTitle),
            style: 'heading2'
        };
        return [title, subtitle, metaInfo, subHeading, noteContent];
    }
Example #3
0
    /**
     * Delete a file from the list.
     *
     * @param {number} index The index of the file.
     * @param {boolean} [askConfirm] Whether to ask confirm.
     */
    delete(index: number, askConfirm?: boolean): void {
        let promise;

        if (askConfirm) {
            promise = this.domUtils.showConfirm(this.translate.instant('core.confirmdeletefile'));
        } else {
            promise = Promise.resolve();
        }

        promise.then(() => {
            // Remove the file from the list.
            this.files.splice(index, 1);
        }).catch(() => {
            // User cancelled.
        });
    }
Example #4
0
    constructor(
        private translate: TranslateService,
        private cookie: CookieService,
        private session: SessionService,
        private appConfigService: AppConfigService,
        private titleService: Title) {
        // Override page title
        let key: string = "APP_TITLE.HARBOR";
        if (this.appConfigService.isIntegrationMode()) {
            key = "APP_TITLE.REG";
        }

        translate.get(key).subscribe((res: string) => {
            this.titleService.setTitle(res);
        });
    }
Example #5
0
    constructor(viewContainerRef: ViewContainerRef,
                private renderer: Renderer,
                private router: Router,
                private translate : TranslateService) {
        this.viewContainerRef = viewContainerRef;
        translate.addLangs(["ru", "cz", "en"]);
        translate.setTranslation("ru", RU);
        translate.setTranslation("en", EN);
        translate.setTranslation("cz", CZ);
        translate.setDefaultLang('ru');

        let browserLang = translate.getBrowserLang();
        translate.use(browserLang.match(/ru/) ? browserLang : 'ru');
    }
 /**
  * Exports the call list.
  *
  * @param motions All motions in the CSV. They should be ordered by callListWeight correctly.
  */
 public exportCallList(motions: ViewMotion[]): void {
     this.csvExport.export(
         motions,
         [
             { label: 'Called', map: motion => (motion.sort_parent_id ? '' : motion.identifierOrTitle) },
             { label: 'Called with', map: motion => (!motion.sort_parent_id ? '' : motion.identifierOrTitle) },
             { label: 'submitters', map: motion => motion.submitters.map(s => s.short_name).join(',') },
             { property: 'title' },
             {
                 label: 'recommendation',
                 map: motion => (motion.recommendation ? this.motionRepo.getExtendedRecommendationLabel(motion) : '')
             },
             { property: 'motion_block', label: 'Motion block' }
         ],
         this.translate.instant('Call list') + '.csv'
     );
 }
 /**
  * Opens a dialog and changes the motionBlock for all given motions.
  *
  * @param motions The motions for which to change the motionBlock
  */
 public async setMotionBlock(motions: ViewMotion[]): Promise<void> {
     const title = this.translate.instant('This will set the following motion block for all selected motions:');
     const clearChoice = 'Clear motion block';
     const selectedChoice = await this.choiceService.open(
         title,
         this.motionBlockRepo.getViewModelList(),
         false,
         null,
         clearChoice
     );
     if (selectedChoice) {
         for (const motion of motions) {
             const blockId = selectedChoice.action ? null : (selectedChoice.items as number);
             await this.repo.update({ motion_block_id: blockId }, motion);
         }
     }
 }
Example #8
0
 handler: data => {
   if (data.newPassword.length < 6) {
     this.meuToastService.present(this.translateService.instant('CHANGE_PASSWORD.ERROR'));
     return false;
   }
   this.authService.updatePassword(email, currentPassword, data.newPassword)
 .then(
   () => {
     this.meuToastService.present(this.translateService.instant('CHANGE_PASSWORD.SUCCESS'));
     resolve();
   }
 )
 .catch(err => {
   this.meuToastService.present(this.translateService.instant('COMMON_ERROR'));
   reject();
 });
 }
	// @desc: Set language by lang key, done after user interaction
	public setLanguage(key) {
		// Update language
		this.translateService.use(key);
		// Set/Update language in local storage for later use
		localStorage.setItem('language', key);
		// Update user language to server
		this.httpManagerService.post('/json/user/lang', {'uid': this.getUid(), 'lang': key}).subscribe(res => {
			forkJoin(
				this.translateService.get(res.alert.content),
				this.translateService.get('FORM_BUTTON_CLOSE'))
			.subscribe(([msg, action]) => {
				let snackBarRef = this.snackBar.open(msg, action, {
					'duration': 5000
				});
			});
		});
	}
    /**
     * Initialize some common errors if they aren't set.
     */
    protected initErrorMessages(): void {
        this.errorMessages = this.errorMessages || {};

        this.errorMessages.required = this.errorMessages.required || this.translate.instant('core.required');
        this.errorMessages.email = this.errorMessages.email || this.translate.instant('core.login.invalidemail');
        this.errorMessages.date = this.errorMessages.date || this.translate.instant('core.login.invaliddate');
        this.errorMessages.datetime = this.errorMessages.datetime || this.translate.instant('core.login.invaliddate');
        this.errorMessages.datetimelocal = this.errorMessages.datetimelocal || this.translate.instant('core.login.invaliddate');
        this.errorMessages.time = this.errorMessages.time || this.translate.instant('core.login.invalidtime');
        this.errorMessages.url = this.errorMessages.url || this.translate.instant('core.login.invalidurl');

        // Set empty values by default, the default error messages will be built in the template when needed.
        this.errorMessages.max = this.errorMessages.max || '';
        this.errorMessages.min = this.errorMessages.min || '';
    }