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


TypeScript ng.controller方法代码示例

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


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

示例1: function

export let main = ng.controller('MainController', ['$scope', 'model', 'route', '$location',
    async function ($scope, model, route, $location): Promise<void> {
    $scope.lang = idiom;
    $scope.idiom = idiom;
    $scope.template = template;
    $scope.date = moment;

    $scope.display = {
        lightbox: {},
        currentTemplate: '',
        sliderTest: 1,
        host: 'https://' + location.host
    };

    template.open('editor/pages-manager', 'editor/pages-manager');
    template.open('editor/templates', 'editor/templates');

    const openSite = async (params) => {
        const websites = await Folders.websites();
        const website: Website = websites.find(w => w._id === params.siteId);
        if(!website || website.trashed){
            template.open('main', 'e404');
            $scope.$apply();
            return;
        }
        $scope.snipletResource = website;
        await website.rights.fromBehaviours();
        if (website.myRights['update'] && !params.preview && $(window).width() > ui.breakpoints.tablette) {
            template.open('main', 'page-editor');
        }
        else {
            template.open('main', 'page-viewer');
        }
        setTimeout(() => model.trigger('route-changed'), 500);
        $scope.$apply();
    }

    function applyIfNeeded(){
        if ($scope.$root.$$phase != '$apply' && $scope.$root.$$phase != '$digest') {
            $scope.$apply();
        }
    }

    route({
        listSites: async () => {
            await sniplets.load();
            $scope.sniplets = _.reject(sniplets.sniplets, (s) => s.sniplet.hidden);
            template.open('main', 'library');
            Autosave.unwatchAll();
            applyIfNeeded();
        },
        site: async (params) => {
            await sniplets.load();
            $scope.sniplets = _.reject(sniplets.sniplets, (s) => s.sniplet.hidden);
            Autosave.unwatchAll();
            openSite(params);
            applyIfNeeded();
        },
        page: async (params) => {
            await sniplets.load();
            $scope.sniplets = _.reject(sniplets.sniplets, (s) => s.sniplet.hidden);
            Autosave.unwatchAll();
            openSite(params);
            applyIfNeeded();
        },
        previewSite: async (params) => {
            await sniplets.load();
            $scope.sniplets = _.reject(sniplets.sniplets, (s) => s.sniplet.hidden);
            Autosave.unwatchAll();
            params.preview = true;
            openSite(params);
            applyIfNeeded();
        },
        previewPage: async (params) => {
            await sniplets.load();
            $scope.sniplets = _.reject(sniplets.sniplets, (s) => s.sniplet.hidden);
            Autosave.unwatchAll();
            params.preview = true;
            openSite(params);
            applyIfNeeded();
        }
    });

    $scope.redirectTo = (path) => {
        if (window.location.href.indexOf('/p/') === -1 || window.notLoggedIn) {
            $location.path(path);
        }
        else {
            window.location.href = '/pages#' + path;
        }
    };

    $scope.lightbox = function (lightboxName: string, data: any) {
        $scope.display.data = data;
        $scope.display.lightbox[lightboxName] = !$scope.display.lightbox[lightboxName];
    };

    $scope.closeLightbox = function (lightboxName: string, data: any) {
        $scope.display.data = data;
        $scope.display.lightbox[lightboxName] = false;
//.........这里部分代码省略.........
开发者ID:web-education,项目名称:pages,代码行数:101,代码来源:main.ts

示例2:

import { ng } from 'entcore';

/**
	Wrapper controller
	------------------
	Main controller.
**/
export const mainController = ng.controller('MainController', ['$scope', 'route', ($scope, route) => {
}]);
开发者ID:entcore,项目名称:skeletons,代码行数:9,代码来源:main.ts

示例3: if

export let loginController = ng.controller('LoginController', ['$scope', ($scope) => {
	$scope.template = template;
	$scope.template.open('main', 'login-form');
	$scope.user = {};
	$scope.lang = lang;


	$scope.welcome = {

	};

	http().get('/auth/configure/welcome').done(function (d) {
		$scope.welcome.content = d.welcomeMessage;
		if (!d.enabled) {
			$scope.welcome.hideContent = true;
		}
		if (!$scope.$$phase) {
			$scope.$apply();
		}
	})
		.e404(function () {
			$scope.welcome.hideContent = true;
			if (!$scope.$$phase) {
				$scope.$apply();
			}
		});

	$scope.cookieEnabled = navigator.cookieEnabled;
	const safeSplit = (str: string = "", pattern: string = "") => {
		if (typeof str == "string") {
			return str.split(pattern);
		} else {
			return [];
		}
	}
	const checkBrowser = (browser: { browser: string, version: number }) => {
		if (typeof browser == "undefined") {
			console.warn("[Auth][Login.checkBrowser] chould not identify browser NAME: ", browser, navigator.userAgent)
		} else if (typeof browser.version == "undefined") {
			console.warn("[Auth][Login.checkBrowser] chould not identify browser VERSION: ", browser, navigator.userAgent)
		}
	}
	const browser = function (userAgent) {
		if (userAgent.indexOf('Chrome') !== -1) {
			const chromeVersion = safeSplit(userAgent, 'Chrome/')[1];
			const version = parseInt(safeSplit(chromeVersion, '.')[0]);
			return {
				browser: 'Chrome',
				version: version,
				outdated: version < 39
			}
		}
		else if (userAgent.indexOf('IEMobile') !== -1) {
			const ieVersion = safeSplit(userAgent, 'IEMobile/')[1];
			const version = parseInt(safeSplit(ieVersion, ';')[0]);
			return {
				browser: 'MSIE',
				version: version,
				outdated: version < 10
			}
		}
		else if (userAgent.indexOf('AppleWebKit') !== -1 && userAgent.indexOf('Chrome') === -1) {
			const safariVersion = safeSplit(userAgent, 'Version/')[1];
			const version = parseInt(safeSplit(safariVersion, '.')[0]);
			return {
				browser: 'Safari',
				version: version,
				outdated: version < 7
			}
		}
		else if (userAgent.indexOf('Firefox') !== -1) {
			const ffVersion = safeSplit(userAgent, 'Firefox/')[1];
			const version = parseInt(safeSplit(ffVersion, '.')[0]);
			return {
				browser: 'Firefox',
				version: version,
				outdated: version < 34
			}
		}
		else if (userAgent.indexOf('MSIE') !== -1) {
			const msVersion = safeSplit(userAgent, 'MSIE ')[1];
			const version = parseInt(safeSplit(msVersion, ';')[0]);
			return {
				browser: 'MSIE',
				version: version,
				outdated: version < 10
			}
		}
		else if (userAgent.indexOf('MSIE') === -1 && userAgent.indexOf('Trident') !== -1) {
			const msVersion = safeSplit(userAgent, 'rv:')[1];
			const version = parseInt(safeSplit(msVersion, '.')[0]);
			return {
				browser: 'MSIE',
				version: version,
				outdated: version < 10
			}
		}
	};

	$scope.browser = browser(navigator.userAgent);
//.........这里部分代码省略.........
开发者ID:entcore,项目名称:entcore,代码行数:101,代码来源:login.ts

示例4: function

import { ng, template } from 'entcore';
import { Mail } from '../model';

export let printController = ng.controller('PrintController', [
    '$scope', 'route', 'model',
    function ($scope, route, model, ) {
        route({
            viewPrint: async function(params){
                $scope.mail = new Mail(params.mailId);

                try{
                    await $scope.mail.open(true);
                    $scope.$apply();
                    setTimeout(function(){
                        window.print();
                    }, 1000)
                }
                catch(e){
                    console.log(e);
                    template.open('page', 'errors/e404');
                }
            }
        })
    }
]);
开发者ID:entcore,项目名称:entcore,代码行数:25,代码来源:printController.ts

示例5: RegExp

export let resetController = ng.controller('ResetController', ['$scope', ($scope) => {
	$scope.template = template;
	$scope.lang = lang;
	$scope.template.open('main', 'reset-form');
	$scope.user = {};

	$scope.welcome = {

	};

	http().get('/auth/configure/welcome').done(function (d) {
	    $scope.welcome.content = d.welcomeMessage;
	    if (!d.enabled) {
	        $scope.welcome.hideContent = true;
	    }
	    $scope.$apply();
	})
    .e404(function () {
        $scope.welcome.hideContent = true;
        $scope.$apply();
    });

	if(window.location.href.indexOf('?') !== -1){
		if(window.location.href.split('login=').length > 1){
			$scope.login = window.location.href.split('login=')[1].split('&')[0];
		}
		if(window.location.href.split('activationCode=').length > 1){
			$scope.activationCode = window.location.href.split('activationCode=')[1].split('&')[0];
		}
	}

	http().get('/auth/context').done(function(data){
		$scope.passwordRegex = data.passwordRegex;
	});

	$scope.identicalRegex = function(str){
		if(!str)
			return new RegExp("^$")
		return new RegExp("^"+str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")+"$")
	}

	$scope.refreshInput = function(form, inputName){
		form[inputName].$setViewValue(form[inputName].$viewValue)
	}

	$scope.passwordComplexity = function(password){
		if(!password)
			return 0

		if(password.length < 6)
			return password.length

		var score = password.length
		if(/[0-9]+/.test(password) && /[a-zA-Z]+/.test(password)){
			score += 5
		}
		if(!/^[a-zA-Z0-9- ]+$/.test(password)) {
			score += 5
		}

		return score
	}

	$scope.translateComplexity = function(password){
		var score = $scope.passwordComplexity(password)
		if(score < 12){
			return lang.translate("weak")
		}
		if(score < 20)
			return lang.translate("moderate")
		return lang.translate("strong")
	}

	$scope.reset = function(){
		http().post('/auth/reset', http().serialize({
			login: $scope.user.login.trim(),
			password: $scope.user.password,
			confirmPassword: $scope.user.confirmPassword,
			resetCode: resetCode
		}))
		.done(function(data){
			if(typeof data !== 'object'){
				window.location.href = '/';
			}
			if(data.error){
				$scope.error = data.error.message;
			}

			$scope.$apply('error');
		});
	};

	$scope.resetForce = function(){
		http().post('/auth/reset', http().serialize({
			login: login,
			password: $scope.user.password,
			confirmPassword: $scope.user.confirmPassword,
			oldPassword: $scope.user.oldPassword,
			callback: callback,
			forceChange : "force"
//.........这里部分代码省略.........
开发者ID:entcore,项目名称:entcore,代码行数:101,代码来源:reset.ts

示例6: resetError

export let forgotController = ng.controller('ForgotController', ['$scope', 'route', ($scope:ForgotControllerScope, route) => {
	$scope.template = template;
	$scope.template.open('main', 'forgot-form');
	$scope.user = {};

	$scope.welcome = {};
	//===Private methods
	let _promise:Promise<any> = Promise.resolve();
	const resetError = () => {
		//reset message if exists and wait 1seconds #21699
		if ($scope.error) {
			$scope.error = "";
			_promise = new Promise(function (resolve) {
				setTimeout(resolve, 1000);
			});
			$scope.$apply();
		} else {
			return _promise;
		}
	}
	const setError = async (text: string) => {
		//reset message if exists and wait 2seconds #21699
		await resetError();
		$scope.error = text;
		$scope.$apply();
	}
	//===Init
	http().get('/auth/configure/welcome').done(function (d) {
	    $scope.welcome.content = d.welcomeMessage;
	    if (!d.enabled) {
	        $scope.welcome.hideContent = true;
	    }
	    $scope.$apply();
	})
    .e404(function () {
        $scope.welcome.hideContent = true;
        $scope.$apply();
    });

	if(window.location.href.indexOf('?') !== -1){
		if(window.location.href.split('login=').length > 1){
			$scope.login = window.location.href.split('login=')[1].split('&')[0];
		}
		if(window.location.href.split('activationCode=').length > 1){
			$scope.activationCode = window.location.href.split('activationCode=')[1].split('&')[0];
		}
	}
	//===Routes
	route({
		actionId: function(params){
			$scope.user.mode = "id"
		},
		actionPassword: function(params){
			$scope.user.mode = "password"
		}
	})
	//===Public methods
	$scope.initUser = function(){
		$scope.user = {}
	}
	$scope.shouldAskForPwd = function(){
		return $scope.user && $scope.user.mode=="password";
	}
	$scope.shouldAskForEmail = function(){
		return $scope.user && ($scope.user.mode=="id" || $scope.user.mode=="idExtras");
	}
	$scope.shouldAskForNameAndStructure = function(){
		return $scope.user && $scope.user.mode=="idExtras";
	}
	$scope.forgot = function(service){
		if($scope.user.mode === 'password'){
			$scope.forgotPassword($scope.user.login, service)
		}else if($scope.user.mode === 'idExtras') {
			$scope.forgotId({
				mail: $scope.user.mail, 
				firstName: $scope.user.firstName, 
				structureId: $scope.user.structureId
			}, service)
		}else{
			$scope.forgotId({
				mail: $scope.user.mail, 
				firstName: null, 
				structureId: null
			}, service)
		}
	};

	$scope.passwordChannels = function(login){
		http().get('/auth/password-channels', {login: login})
			.done(function(data){
				$scope.user.channels = {
					mail: data.mail,
					mobile: data.mobile
				}
				$scope.$apply()
			})
			.e400(function(data){
				setError('auth.notify.' + JSON.parse(data.responseText).error + '.login');
			})
	}
//.........这里部分代码省略.........
开发者ID:entcore,项目名称:entcore,代码行数:101,代码来源:forgot.ts

示例7: if

export let conversationController = ng.controller('ConversationController', [
    '$scope', '$timeout', '$compile', '$sanitize', 'model', 'route', function ($scope, $timeout, $compile, $sanitize, model, route) {
        $scope.state = {
            selectAll: false,
            filterUnread: false,
            searching: false,
            current: undefined,
            newItem: undefined,
            draftError: false,
            dragFolder: undefined,
            emptyMessage: lang.translate('folder.empty'),
            searchFailed: false,
            draftSaveDate: null,
            mailLimit: 5000,
            recipientLimit: ui.breakpoints.checkMaxWidth("fatMobile") ? 5 : 10
        };
        $scope.defaultAvatar = "img/illustrations/unknown-avatar.svg?thumbnail=100x100";
        $scope.conversation = Conversation.instance;
        $scope.ccCciShow = false;

        route({
            readMail: async function (params) {
                Conversation.instance.folders.openFolder('inbox');
                template.open('page', 'folders');
                $scope.readMail(new Mail(params.mailId));
                await Conversation.instance.sync();
                await Conversation.instance.folders.draft.countTotal();
                $scope.constructNewItem();
                $scope.$apply();
            },
            writeMail: async function (params) {
                Conversation.instance.folders.openFolder('inbox');
                await Conversation.instance.sync();
                template.open('page', 'folders');
                template.open('main', 'mail-actions/write-mail');
                $scope.constructNewItem();

                if (_.isString(params.id)) {
                    if (!params.type || params.type === 'User') {
                        let user = new User(params.id);
                        await user.findData();
                        $scope.addUser(user);
                    }
                    else if (params.type === 'Group') {
                        let group = new User(params.id);
                        await group.findGroupData();
                        $scope.addUser(group);
                    }
                    else if (params.type === 'Favorite') {
                        await $scope.state.newItem.addFavorite(params.id);
                    }
                } else if (params.id !== undefined) {
                    for (let i = 0; i < params.id.length; i++) {
                        let user = new User(params.id[i]);
                        await user.findData();
                        $scope.addUser(user);
                    }
                }
                $scope.$apply();
            },
            inbox: async () => {
                template.open('page', 'folders');
                await Conversation.instance.folders.openFolder('inbox');
                await Conversation.instance.sync();
                await Conversation.instance.folders.draft.countTotal();
                $scope.constructNewItem()
                $scope.$apply();
            }
        });

        $scope.lang = lang;
        $scope.notify = notify;
        $scope.folders = Conversation.instance.folders;
        $scope.userFolders = Conversation.instance.userFolders;
        $scope.users = { list: Conversation.instance.users, search: '', found: [], foundCC: [] };
        template.open('main', 'folders-templates/inbox');
        template.open('toaster', 'folders-templates/toaster');
        $scope.formatFileType = Document.role;
        $scope.sending = false;
        /**
         * WORKSPACE
         */

        $scope.copyProps = {
            i18: {
                title: "conversation.copy.title",
                actionTitle: "conversation.copy.action",
                actionProcessing: "conversation.copy.processing",
                actionFinished: "conversation.copy.finished",
                info: "conversation.copy.info"
            },
            sources: [],
            onCancel() {
                $scope.copyLightbox.show = false;
            },
            onSubmitSuccess(dest, count: number) {
                if (count > 1) {
                    notify.info('conversation.notify.copyToWorkspace.plural');
                } else {
                    notify.info('conversation.notify.copyToWorkspace');
//.........这里部分代码省略.........
开发者ID:entcore,项目名称:entcore,代码行数:101,代码来源:controller.ts

示例8: RegExp

export let activationController = ng.controller('ActivationController', ['$scope', ($scope) =>{
	$scope.template = template;
	$scope.lang = lang;
	$scope.user = { themes: {} };
	$scope.phonePattern = new RegExp("^(00|\\+)?(?:[0-9] ?-?\\.?){6,14}[0-9]$");

	$scope.welcome = {};
	template.open('main', 'activation-form');

	let currentTheme;
	let conf = { overriding: [] };
	const xhr = new XMLHttpRequest();
	xhr.open('get', '/assets/theme-conf.js');
	xhr.onload = () => {
		eval(xhr.responseText.split('exports.')[1]);
		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();

	http().get('/auth/configure/welcome').done(function (d) {
	    $scope.welcome.content = d.welcomeMessage;
	    if (!d.enabled) {
	        $scope.welcome.hideContent = true;
	    }
	    $scope.$apply();
	})
    .e404(function () {
        $scope.welcome.hideContent = true;
        $scope.$apply();
    });

	if(window.location.href.indexOf('?') !== -1){
		if(window.location.href.split('login=').length > 1){
			$scope.user.login = window.location.href.split('login=')[1].split('&')[0];
		}
		if(window.location.href.split('activationCode=').length > 1){
			$scope.user.activationCode = window.location.href.split('activationCode=')[1].split('&')[0];
		}
	}

	http().get('/auth/context').done(function(data){
		$scope.callBack = data.callBack;
		$scope.cgu = data.cgu;
		$scope.passwordRegex = data.passwordRegex;
		$scope.mandatory = data.mandatory;
		$scope.$apply('cgu');
	});

	$scope.identicalRegex = function(str){
		if(!str)
			return new RegExp("^$")
		return new RegExp("^"+str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")+"$")
	}

	$scope.refreshInput = function(form, inputName){
		form[inputName].$setViewValue(form[inputName].$viewValue)
	}

	$scope.passwordComplexity = function(password){
		if(!password)
			return 0

		if(password.length < 6)
			return password.length

		var score = password.length
		if(/[0-9]+/.test(password) && /[a-zA-Z]+/.test(password)){
			score += 5
		}
		if(!/^[a-zA-Z0-9- ]+$/.test(password)) {
			score += 5
		}

		return score
	}

	$scope.translateComplexity = function(password){
		var score = $scope.passwordComplexity(password)
		if(score < 12){
			return lang.translate("weak")
		}
		if(score < 20)
			return lang.translate("moderate")
		return lang.translate("strong")
	};

	$scope.noThemePicked = () => !Object.keys($scope.user.themes).length;

	$scope.activate = function(forceCurrentTheme: boolean){
		if($scope.themes.length > 1 && $scope.noThemePicked() && !forceCurrentTheme){
			template.open('main', 'activation-themes');
			return;
		}
		if($scope.themes.length === 1 && conf.overriding.length > 1){
//.........这里部分代码省略.........
开发者ID:entcore,项目名称:entcore,代码行数:101,代码来源:activation.ts

示例9: function

const archiveController = ng.controller('ArchiveController', ['$scope', ($scope) => {
	$scope.filePath = 'about:blank'
	var expected;
	http.get('/archive/conf/public').then(function(exportApps){
		http.get('/applications-list').then(function(myApps){
			$scope.selectedApps = [];
			$scope.availableApps = myApps.data.apps.map(app => app.prefix ? app.prefix.slice(1) : app.displayName ? app.displayName : "undefined")
			.filter(app => exportApps.data.apps.includes(app))
			.sort(function(a, b) {
				let a2 = lang.translate(a), b2 = lang.translate(b);
				return a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
			});
			if ($scope.availableApps.length === 0) {
				$scope.isPreDeleted = true;
				expected = exportApps.data.apps;
			}
			$scope.availableApps.forEach(app => { $scope.selectedApps[app] = false });
			$scope.selectedApps["workspace"] = true;
			$scope.selectedApps["rack"] = true;
			$scope.areAllSelected = function() {
				return $scope.availableApps.find(app => !$scope.selectedApps[app]) === undefined
			}
			$scope.areNoneSelected = function() {
				return $scope.availableApps.find(app => $scope.selectedApps[app]) === undefined
			}
			$scope.selectAll = function(event){
				let oneFalse = !$scope.areAllSelected()
				$scope.availableApps.forEach(app => { $scope.selectedApps[app] = oneFalse })
			}
			$scope.$apply();
		});
	});
	$scope.initiateExport = function(mode: string){
		var appList;
		if (mode === "docsOnly") {
			appList = ["workspace","rack"];
		} else if (mode === "all") {
			appList = expected;
		} else if (mode === "apps") {
			appList = $scope.availableApps.filter(app => $scope.selectedApps[app]);
		}
		http.post('/archive/export', {'apps':appList}).then(function(res){
			$scope.loadingSpinner = true;
			setTimeout(function() {
				http.get('/archive/export/verify/' + res.data.exportId).then(function(status){
					window.location.href = '/archive/export/' + res.data.exportId;
					$scope.loadingSpinner = false;
					$scope.$apply();
				}).catch(function(){
					notify.error('archive.error');
					setTimeout(function() {
						window.location.reload();
					},3000);
				});
			},5000);
			$scope.loading = true;
			$scope.$apply();
		}).catch(function(){
			notify.error('export.already');
		})
	};
}]);
开发者ID:entcore,项目名称:entcore,代码行数:62,代码来源:app.ts

示例10: function

export let library = ng.controller('LibraryController', [
    '$scope', 'model', '$rootScope', '$location', function ($scope, model, $rootScope, $location) {

    $scope.display.lightbox['managePages'] = false;
    $scope.display.lightbox['properties'] = false;
    template.open('library/folder-content', 'library/folder-content');
    $scope.localAdmin = LocalAdmin;
    $scope.currentFolder = Folders.root;
    $scope.currentFolder.sync();
    $scope.root = Folders.root;
    $scope.folder = new Folder();
    $scope.website = new Website();
    $scope.website.visibility = 'PRIVATE';
    $scope.filters = Filters;
    $scope.filters.protected = true;

    template.open('library/create-website', 'library/create-website');
    template.open('library/toaster', 'library/toaster');
    template.open('library/publish', 'library/publish');
    template.open('library/properties', 'library/properties');
    template.open('library/move', 'library/move');

    BaseFolder.eventer.on('refresh', () => $scope.$apply());
    Website.eventer.on('save', () => $scope.$apply());

    $rootScope.$on('share-updated', async (event, changes) => {
        for(let website of $scope.currentFolder.selection){
            await (website as Website).sync();
            website.synchronizeRights();
        }

        $scope.$apply();
    });

    $scope.searchGroups = (item: Group) => {
        let found = $scope.display.searchGroups && idiom.removeAccents(item.name.toLowerCase()).indexOf(
            idiom.removeAccents($scope.display.searchGroups).toLowerCase()
        ) !== -1;
        for (let structureId in $scope.website.published) {
            found = found && _.findWhere($scope.website.published[structureId].groups, { id: item.id }) === undefined;
        }
        return found;
    };

    $scope.searchWebsites = (item: Website) => {
        return !$scope.display.searchWebsites || idiom.removeAccents(item.title.toLowerCase()).indexOf(
            idiom.removeAccents($scope.display.searchWebsites).toLowerCase()
        ) !== -1;
    };

    $scope.can = (right: string) => {
        let folder: Folder = $scope.currentFolder;
        return _.find(folder.websites.sel.selected, (w: Website) => !w.myRights[right]) === undefined;
    };

    $scope.saveProperties = () => {
        $scope.lightbox('properties');
        $scope.website.save();
        $scope.website.updateApplication();
    }

    $scope.editWebsiteProperties = () => {
        $scope.website = $scope.currentFolder.selection[0];
        $scope.lightbox('properties');
    };

    $scope.openFolder = (folder) => {
        template.open('library/folder-content', 'library/folder-content');
        $scope.currentFolder = folder;
        $scope.currentFolder.sync();
    };

    $scope.openPublish = async () => {
        $scope.lightbox('showPublish');
        $scope.website = $scope.currentFolder.selection[0];
        if (!LocalAdmin.synced) {
            await LocalAdmin.structures.sync();
            $scope.$apply();
        }
    };

    $scope.createFolder = async () => {
        $scope.folder.parentId = $scope.currentFolder._id;
        $scope.display.lightbox['newFolder'] = false;
        $scope.currentFolder.children.push($scope.folder);
        await $scope.folder.save();
        $scope.folder = new Folder();
    };

    $scope.removeSelection = async () => {
        $scope.lightbox('confirmRemove');
        await $scope.currentFolder.removeSelection();
        $scope.$apply();
    }

    $scope.openTrash = () => {
        template.open('library/folder-content', 'library/trash');
        $scope.currentFolder = Folders.trash;
        Folders.trash.sync();
    };
//.........这里部分代码省略.........
开发者ID:web-education,项目名称:pages,代码行数:101,代码来源:library.ts


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