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


TypeScript Behaviours.register方法代码示例

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


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

示例1: function

Behaviours.register('directory', {
	rights:{
		workflow: {
			externalNotifications: "org.entcore.timeline.controllers.TimelineController|mixinConfig",
			historyView: "org.entcore.timeline.controllers.TimelineController|historyView",
			showMoodMotto: "org.entcore.directory.controllers.UserBookController|userBookMottoMood",
			switchTheme: "org.entcore.directory.controllers.UserBookController|userBookSwitchTheme",
            generateMergeKey: "org.entcore.directory.controllers.UserController|generateMergeKey",
			mergeByKey: "org.entcore.directory.controllers.UserController|mergeByKey",
			allowSharebookmarks: "org.entcore.directory.controllers.ShareBookmarkController|allowSharebookmarks",
			allowLoginUpdate: "org.entcore.directory.controllers.UserController|allowLoginUpdate",
			allowClassAdminAddUsers: "org.entcore.directory.controllers.DirectoryController|allowClassAdminAddUsers",
			allowClassAdminResetPassword: "org.entcore.directory.controllers.DirectoryController|allowClassAdminResetPassword",
			allowClassAdminBlockUsers: "org.entcore.directory.controllers.DirectoryController|allowClassAdminBlockUsers",
			allowClassAdminDeleteUsers: "org.entcore.directory.controllers.DirectoryController|allowClassAdminDeleteUsers"
		}
	},
	sniplets: {
		facebook: {
			title: 'sniplet.facebook.title',
			description: 'sniplet.facebook.desc',
			controller: {
				initSource: function(){
					this.source = {
						groups: []
					};
					this.search = {
						text: '',
						groups: [],
						structures: [],
						structure: null
					};

					http().get('/userbook/structures').done(function(structures){
						this.search.structures = structures;
						this.$apply('search');
					}.bind(this));
				},
				viewUserInfos: function(userId){
					window.open('/userbook/annuaire#/' + userId, '_blank');
				},
				removeGroup: function(index, group){
					this.source.groups.splice(index, 1);
					this.search.groups.push(group);
				},
				addGroup: function(group){
					this.source.groups.push(group);
					var index = this.search.groups.indexOf(group);
					this.search.groups.splice(index, 1);
				},
				loadGroups: function(){
					var that = this
					http().get('/userbook/structure/' + this.search.structure.id).done(function(structure){
						this.search.groups = structure.profileGroups.concat(structure.manualGroups);
						_.map(this.search.groups, function(group){ group.translatedName = that.groupTranslation(group.name) })
						this.$apply('search');
					}.bind(this));
				},
				init: function(){
					this.source.groups.forEach(function(group){
						http().get('/userbook/visible/users/' + group.id).done(function(users){
							group.users = users;
							this.$apply('source');
						}.bind(this));
					}.bind(this))
				},
				applySource: function(){
					this.setSnipletSource(this.source);
				},
				colorFromType: function(type){
					return ui.profileColors.match(type);
				},
				groupTranslation: function(groupName){
					var splittedName = groupName.split('-')
					return splittedName.length > 1 ?
						lang.translate(groupName.substring(0, groupName.lastIndexOf('-'))) + '-' + lang.translate(groupName.split('-')[splittedName.length - 1]) :
						groupName
				},
				getType: function(type){
					if(type instanceof Array)
						 return type[0]
					return type
				}
			}
		}
	}
});
开发者ID:entcore,项目名称:entcore,代码行数:87,代码来源:behaviours.ts

示例2: function

import { Behaviours } from 'entcore';

console.log('Exercizer behaviours loaded');

Behaviours.register('exercizer', {
    rights: {
        workflow: {
            create: 'fr.openent.exercizer.controllers.SubjectController|persist',
            import: 'fr.openent.exercizer.controllers.SubjectController|importSubjectGrains',
            list: 'fr.openent.exercizer.controllers.SubjectController|listSubject',
            view: 'fr.openent.exercizer.controllers.SubjectController|view'

        },
        resource: {
            manager: {
                right: 'fr-openent-exercizer-controllers-SubjectController|remove'
            },
            contrib: {
                right: 'fr-openent-exercizer-controllers-SubjectController|canSchedule',
            },
            read: {
                right: 'com-thecodingmachine-inca-controllers-ThematicController|list'
            }
        }
    },
    dependencies: {},
    loadResources: function (callback) { }
});
开发者ID:OPEN-ENT-NG,项目名称:exercizer,代码行数:28,代码来源:behaviours.ts

示例3: function

Behaviours.register('pages', {
	rights: {
		workflow: {
			create: 'fr.wseduc.pages.controllers.PagesController|add',
			createFolder: 'fr.wseduc.pages.controllers.FoldersController|add',
			createPublic: 'fr.wseduc.pages.controllers.PagesController|addPublic',
			share: 'fr.wseduc.pages.controllers.PagesController|share'
		},
		resource: {
			update: { right: 'fr-wseduc-pages-controllers-PagesController|update' },
			remove: { right: 'fr-wseduc-pages-controllers-PagesController|delete' },
			share: { right: 'fr-wseduc-pages-controllers-PagesController|share' },
            read: { right: 'fr-wseduc-pages-controllers-PagesController|get' },
            manager: { right: 'fr-wseduc-pages-controllers-PagesController|share' },
            restore: { right: 'fr-wseduc-pages-controllers-PagesController|delete' }
		}
	},
    loadResources: async function (callback) {
        if (this.loading) {
            return;
        }
        this.loading = true;
        let response = await http.get('/pages/list/all');
        this.loading = false;
        let websites = response.data;
		let pages = [];
		websites.forEach(function(website){
			if(website.thumbnail){
				website.thumbnail = website.thumbnail + '?thumbnail=48x48';
			}
			else{
				website.thumbnail = '/img/illustrations/pages-default.png'
			}
			website = {
				pages: website.pages,
				title: website.title,
				owner: {
					name: website.owner.displayName,
					userId: website.owner.userId
				},
				icon: website.thumbnail,
				path: '/pages#/website/' + website._id,
				_id: website._id
			};
			pages.push(website);

			website.pages.forEach(function(page){
				pages.push({
					title: page.title,
					owner: website.owner,
					icon: website.thumbnail,
					path: '/pages#/website/' + website._id + '/' + page.titleLink,
					_id: website.id + '/' + page.titleLink
				});
			});
		})
		this.resources = pages;
	},
	sniplets: {
        navigation: {
            public: true,
			title: 'pages.navigation.title',
			description: 'pages.navigation.desc',
			controller: {
				init: function(){
					var source = this.source;
					this.me = model.me;
					this.lang = lang;
					if(source.customLinks){
						this.links = source.customLinks;
						this.custom = true;
						this.snipletDisplay = {};
						return;
					}
                    this.source.landingPage = this.snipletResource.landingPage;
		    this.source._id = this.snipletResource._id;
                    this.links = _.map(this.snipletResource.pages.all, (page) => {
                        let href = '#/website/' + this.source._id + '/' + page.titleLink;
                        if (window.location.hash.startsWith('#/preview/')) {
                            href = '#/preview/' + this.source._id + '/' + page.titleLink;
                        }
						return {
							title: page.title,
                            href: href,
                            published: page.published,
							index: page.index
						}
                    });
					console.log(this.links);
                    this.links = _.reject(this.links, (l) => l.published === false);
					model.one('refresh-nav', () => this.init());
					this.$apply('links')
				},
				initSource: function(){
					Behaviours.applicationsBehaviours.pages.loadResources(function(resources){
						this.pages = resources;
						this.$apply('pages');
					}.bind(this));
				},
				setSource: function(source){
//.........这里部分代码省略.........
开发者ID:web-education,项目名称:pages,代码行数:101,代码来源:behaviours.ts

示例4: function

Behaviours.register('conversation', {
    rights: {
        workflow: {
            draft: 'org.entcore.conversation.controllers.ConversationController|createDraft',
            read: 'org.entcore.conversation.controllers.ConversationController|view'
        }
    },
    sniplets: {
        ml: {
            title: 'sniplet.ml.title',
            description: 'sniplet.ml.description',
            controller: {
                init: function () {
                    this.message = {}
                },
                initSource: function () {
                    this.setSnipletSource({});
                },
                send: function () {
                    this.message.to = _.map(this.snipletResource.shared, function (shared) { return shared.userId || shared.groupId });
                    this.message.to.push(this.snipletResource.owner.userId);
                    http().postJson('/conversation/send', this.message).done(function () {
                        notify.info('ml.sent');
                    }).e401(function () { });
                    this.message = {}
                }
            }
        }
    }
});
开发者ID:entcore,项目名称:entcore,代码行数:30,代码来源:behaviours.ts

示例5:

import { Behaviours } from 'entcore';

Behaviours.register('${APPNAME.toLowerCase()}', {
});
开发者ID:entcore,项目名称:skeletons,代码行数:4,代码来源:behaviours.ts


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