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


TypeScript Behaviours.loadBehaviours方法代码示例

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


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

示例1: route

export const accountController = ng.controller('MyAccount', ['$scope', 'route', ($scope, route) => {
	route({
		editUserInfos: async function(params){
			template.open('account/main', 'account/default-view');
			directory.account = new directory.User({ id: params.id, edit: { infos: true } });
			await init();
			$scope.openView('user-edit', 'user');
		},
		editUser: async function(params){
			template.open('account/main', 'account/default-view');
			directory.account = new directory.User({ id: params.id, edit: { userbook: true, infos: true } });
			await init();
			$scope.openView('user-edit', 'user');
			$scope.openView('userbook-edit', 'userbook');
		},
		themes: async function(){
			directory.account = new directory.User({ id: model.me.userId, edit: { userbook: true, visibility: true } });
			template.open('account/main', 'account/themes');
			await init();
		},
		editMe: async function(params){
			template.open('account/main', 'account/default-view');
			directory.account = new directory.User({ id: model.me.userId, edit: { userbook: true, visibility: true } });
			await init();
			lang.addBundle('/auth/i18n', function () {
				$scope.cguUrl = lang.translate("auth.charter");
			});
			if(model.me.type !== 'ELEVE'){
				directory.account.edit.infos = true;
				$scope.openView('user-edit', 'user');
			}
			else {
				$scope.openView('user-view', 'user');
			}
			$scope.openView('userbook-edit', 'userbook');
		}
	});

	$scope.template = template;

	let conf = { overriding: [] };
	const loadThemeConf = async function(){
		await skin.listSkins();
		conf = skin.themeConf;

		$scope.themes = skin.skins;

		if($scope.themes.length > 1){
			$scope.display.pickTheme = skin.pickSkin;
			http().get('/userbook/preference/theme').done(function(pref){
				if(pref.preference){
					$scope.account.themes[pref.preference] = true;
				}
				else{
					$scope.account.themes[skin.skin] = true;
					http().put('/userbook/preference/theme', skin.skin);
				}
				$scope.$apply();
			})
			if(!$scope.account.themes){
				$scope.account.themes = {};
			}
			
			$scope.$apply();
		}
	}
	
	const xhr = new XMLHttpRequest();
	xhr.open('get', '/assets/theme-conf.js');
	xhr.onload = async () => {
		eval(xhr.responseText.split('exports.')[1]);
		const currentTheme = conf.overriding.find(t => t.child === skin.skin);
		if(currentTheme.group){
			$scope.themes = conf.overriding.filter(t => t.group === currentTheme.group);
		}
		else{
			$scope.themes = conf.overriding;
		}
		
	};
	xhr.send();

	Behaviours.loadBehaviours('directory', function(){
		model.me.workflow.load(['directory'])
	});
    model.me.workflow.load(['zimbra']);
	$scope.hasWorkflowZimbraExpert = () => {
       return model.me.hasWorkflow('fr.openent.zimbra.controllers.ZimbraController|preauth');
    };
	async function init(){
		await directory.account.open();
		await directory.account.loadChildren();
		await directory.account.load();
		$scope.me = model.me;
		directory.account.on('change', function(){
			$scope.$apply();
		});

		$scope.account = directory.account;
		$scope.previousMood = directory.account.mood.id;
//.........这里部分代码省略.........
开发者ID:entcore,项目名称:entcore,代码行数:101,代码来源:account.ts


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