/**
 * @constructor
 * @extends AbstractView
 */
function AbstractSystemDropDownUserView()
{
	AbstractView.call(this, 'Right', 'SystemDropDown');

	this.logoImg = Utils.trim(Settings.settingsGet('UserLogo'));
	this.logoTitle = Utils.trim(Settings.settingsGet('UserLogoTitle'));

	this.mobile = !!Settings.appSettingsGet('mobile');
	this.mobileDevice = !!Settings.appSettingsGet('mobileDevice');

	this.allowSettings = !!Settings.capa(Enums.Capa.Settings);
	this.allowHelp = !!Settings.capa(Enums.Capa.Help);

	this.currentAudio = AppStore.currentAudio;

	this.accountEmail = AccountStore.email;

	this.accounts = AccountStore.accounts;
	this.accountsUnreadCount = AccountStore.accountsUnreadCount;

	this.accountMenuDropdownTrigger = ko.observable(false);
	this.capaAdditionalAccounts = ko.observable(Settings.capa(Enums.Capa.AdditionalAccounts));

	this.accountClick = _.bind(this.accountClick, this);

	this.accountClick = _.bind(this.accountClick, this);

	Events.sub('audio.stop', function() {
		AppStore.currentAudio('');
	});

	Events.sub('audio.start', function(sName) {
		AppStore.currentAudio(sName);
	});
}
Example #2
0
				var aList = _.map(oData.Result, function (bEnabled, sName) {
					return {
						'name': sName,
						'disabled': ko.observable(!bEnabled),
						'deleteAccess': ko.observable(false)
					};
				}, this);
Example #3
0
  function MusicSite(attributes) {
    var self = this;

    self.id = attributes.id;
    self.sanitizedId = attributes.id.replace(/[\.,"']/g, "");
    self.name = attributes.name;
    self.enabled = ko.observable(attributes.enabled);
    self.priority = ko.observable(attributes.priority);
    self.alias = ko.observableArray(attributes.alias || []);
    self.removedAlias = [];
    self.aliasText = ko.observable("");

    self.toggleSite = function() {
      self.enabled(!self.enabled.peek());
    };

    /**
     * Note: It's possible some validation should be added to check if alias is proper domain.
     *    However, since it is user input and can be deleted it's probably not worth it.
     */
    self.addAlias = function() {
      self.removedAlias = [];
      self.alias.push(self.aliasText.peek());
      self.aliasText("");
    };

    self.removeAlias = function(index) {
      var aliasToRemove = self.alias.peek()[index()];

      self.removedAlias = [aliasToRemove];
      self.alias.remove(aliasToRemove);
    };
  }
Example #4
0
				var aList = _.map(oData.Result, function (oItem) {
					return {
						'name': oItem['Name'],
						'disabled': ko.observable(!oItem['Enabled']),
						'configured': ko.observable(!!oItem['Configured'])
					};
				}, this);
Example #5
0
                addStepMethods = function (step) {

                	step.showErrors = ko.observable(false);
                	step.hasErrors = ko.computed(function () {
                		return _.some(step.checkFields, function (field) {
                			return !field.isValid();
                		});
                	});
                	step.error = ko.observable(null);
                	step.showError = function (field) {
                		return step.showErrors() && !field.isValid();
                	};
                	step.checkForm = function () {
                		return step.checkFields.forEach(function (field) {
                			field.valueHasMutated();
                		});
                	};

                	step.compositionComplete = function () {
                		isTransitioning(false);
                	};

                	if (!step.activate) {
                		step.activate = function () {
                			reset(step);
                		};
                	}
                },
Example #6
0
File: main.js Project: javorszky/np
 var BlogEntries = function(entries) {
     this.entries = ko.observableArray(entries);
     this.entryTitle = ko.observable('');
     this.entryText = ko.observable('');
     this.addEntry = function() {
         if(this.entryTitle() != "" && this.entryText() != "") {
             this.entries.push({
                 title: this.entryTitle(),
                 content: this.entryText()
             });
             console.log($);
             $.ajax({
                 url: 'http://localhost:3000/rest',
                 type: 'POST',
                 data: {
                     title: this.entryTitle(),
                     content: this.entryText()
                 }
             }).done(function(data){
                 console.log(data);
             });
             this.entryTitle('');
             this.entryText('');
         }
     }.bind(this);
 };
Example #7
0
	SocialStore.prototype.populate = function ()
	{
		var Settings = require('Storage/Settings');

		this.google.enabled(!!Settings.settingsGet('AllowGoogleSocial'));
		this.google.clientID(Settings.settingsGet('GoogleClientID'));
		this.google.clientSecret(Settings.settingsGet('GoogleClientSecret'));
		this.google.apiKey(Settings.settingsGet('GoogleApiKey'));

		this.google.capa.auth(!!Settings.settingsGet('AllowGoogleSocialAuth'));
		this.google.capa.authFast(!!Settings.settingsGet('AllowGoogleSocialAuthFast'));
		this.google.capa.drive(!!Settings.settingsGet('AllowGoogleSocialDrive'));
		this.google.capa.preview(!!Settings.settingsGet('AllowGoogleSocialPreview'));

		this.facebook.enabled(!!Settings.settingsGet('AllowFacebookSocial'));
		this.facebook.appID(Settings.settingsGet('FacebookAppID'));
		this.facebook.appSecret(Settings.settingsGet('FacebookAppSecret'));
		this.facebook.supported(!!Settings.settingsGet('SupportedFacebookSocial'));

		this.twitter.enabled = ko.observable(!!Settings.settingsGet('AllowTwitterSocial'));
		this.twitter.consumerKey = ko.observable(Settings.settingsGet('TwitterConsumerKey'));
		this.twitter.consumerSecret = ko.observable(Settings.settingsGet('TwitterConsumerSecret'));

		this.dropbox.enabled(!!Settings.settingsGet('AllowDropboxSocial'));
		this.dropbox.apiKey(Settings.settingsGet('DropboxApiKey'));
	};
Example #8
0
	constructor() {
		this.themes = ko.observableArray([]);
		this.themeBackgroundName = ko.observable('');
		this.themeBackgroundHash = ko.observable('');

		this.theme = ko.observable('').extend({limitedList: this.themes});
	}
Example #9
0
/**
 * @constructor
 * @extends AbstractView
 */
function FolderCreateView()
{
	AbstractView.call(this, 'Popups', 'PopupsFolderCreate');

	this.folderName = ko.observable('');
	this.folderName.focused = ko.observable(false);

	this.selectedParentValue = ko.observable(Consts.UNUSED_OPTION_VALUE);

	this.parentFolderSelectList = ko.computed(function() {

		var
			aTop = [],
			fDisableCallback = null,
			fVisibleCallback = null,
			aList = FolderStore.folderList(),
			fRenameCallback = function(oItem) {
				return oItem ? (oItem.isSystemFolder() ? oItem.name() + ' ' + oItem.manageFolderSystemName() : oItem.name()) : '';
			};

		aTop.push(['', '']);

		if ('' !== FolderStore.namespace)
		{
			fDisableCallback = function(oItem)
			{
				return FolderStore.namespace !== oItem.fullNameRaw.substr(0, FolderStore.namespace.length);
			};
		}

		return Utils.folderListOptionsBuilder([], aList, [], aTop, null, fDisableCallback, fVisibleCallback, fRenameCallback);

	}, this);

	// commands
	this.createFolder = Utils.createCommand(this, function() {

		var
			sParentFolderName = this.selectedParentValue();

		if ('' === sParentFolderName && 1 < FolderStore.namespace.length)
		{
			sParentFolderName = FolderStore.namespace.substr(0, FolderStore.namespace.length - 1);
		}

		require('App/User').default.foldersPromisesActionHelper(
			Promises.folderCreate(this.folderName(), sParentFolderName, FolderStore.foldersCreating),
			Enums.Notification.CantCreateFolder
		);

		this.cancelCommand();

	}, function() {
		return this.simpleFolderNameValidation(this.folderName());
	});

	this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;

	kn.constructorEnd(this);
}
Example #10
0
	/**
	 * @constructor
	 */
	function GeneralAppSetting()
	{
		this.mainLanguage = Data.mainLanguage;
		this.mainMessagesPerPage = Data.mainMessagesPerPage;
		this.mainMessagesPerPageArray = Consts.Defaults.MessagesPerPageArray;
		this.editorDefaultType = Data.editorDefaultType;
		this.showImages = Data.showImages;
		this.interfaceAnimation = Data.interfaceAnimation;
		this.useDesktopNotifications = Data.useDesktopNotifications;
		this.threading = Data.threading;
		this.useThreads = Data.useThreads;
		this.replySameFolder = Data.replySameFolder;
		this.layout = Data.layout;
		this.usePreviewPane = Data.usePreviewPane;
		this.useCheckboxesInList = Data.useCheckboxesInList;
		this.allowLanguagesOnSettings = Data.allowLanguagesOnSettings;

		this.isDesktopNotificationsSupported = ko.computed(function () {
			return Enums.DesktopNotifications.NotSupported !== Data.desktopNotificationsPermisions();
		});

		this.isDesktopNotificationsDenied = ko.computed(function () {
			return Enums.DesktopNotifications.NotSupported === Data.desktopNotificationsPermisions() ||
				Enums.DesktopNotifications.Denied === Data.desktopNotificationsPermisions();
		});

		this.mainLanguageFullName = ko.computed(function () {
			return Utils.convertLangName(this.mainLanguage());
		}, this);

		this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100});
		this.mppTrigger = ko.observable(Enums.SaveSettingsStep.Idle);

		this.isAnimationSupported = Globals.bAnimationSupported;
	}
Example #11
0
	/**
	 * @param {Object} params = {}
	 */
	constructor(params = {}) {

		super();

		this.value = params.value;
		if (isUnd(this.value) || !this.value.subscribe)
		{
			this.value = ko.observable(isUnd(this.value) ? false : !!this.value);
		}

		this.enable = params.enable;
		if (isUnd(this.enable) || !this.enable.subscribe)
		{
			this.enable = ko.observable(isUnd(this.enable) ? true : !!this.enable);
		}

		this.disable = params.disable;
		if (isUnd(this.disable) || !this.disable.subscribe)
		{
			this.disable = ko.observable(isUnd(this.disable) ? false : !!this.disable);
		}

		this.label = params.label || '';
		this.inline = isUnd(params.inline) ? false : params.inline;

		this.readOnly = isUnd(params.readOnly) ? false : !!params.readOnly;
		this.inverted = isUnd(params.inverted) ? false : !!params.inverted;

		this.labeled = !isUnd(params.label);
		this.labelAnimated = !!params.labelAnimated;
	}
	/**
	 * @param {string=} sSuperName
	 * @constructor
	 */
	function MessageSimpleModel(sSuperName)
	{
		AbstractModel.call(this, sSuperName || 'MessageSimpleModel');

		this.flagged = ko.observable(false);
		this.selected = ko.observable(false);
	}
	/**
	 * @constructor
	 *
	 * @param {Object} oParams
	 *
	 * @extends AbstractComponent
	 */
	function AbstracCheckbox(oParams)
	{
		AbstractComponent.call(this);

		this.value = oParams.value;
		if (Utils.isUnd(this.value) || !this.value.subscribe)
		{
			this.value = ko.observable(Utils.isUnd(this.value) ? false : !!this.value);
		}

		this.enable = oParams.enable;
		if (Utils.isUnd(this.enable) || !this.enable.subscribe)
		{
			this.enable = ko.observable(Utils.isUnd(this.enable) ? true : !!this.enable);
		}

		this.disable = oParams.disable;
		if (Utils.isUnd(this.disable) || !this.disable.subscribe)
		{
			this.disable = ko.observable(Utils.isUnd(this.disable) ? false : !!this.disable);
		}

		this.label = oParams.label || '';
		this.inline = Utils.isUnd(oParams.inline) ? false : oParams.inline;

		this.readOnly = Utils.isUnd(oParams.readOnly) ? false : !!oParams.readOnly;
		this.inverted = Utils.isUnd(oParams.inverted) ? false : !!oParams.inverted;

		this.labeled = !Utils.isUnd(oParams.label);
		this.labelAnimated = !!oParams.labelAnimated;
	}
Example #14
0
  function MusicSite(attributes) {
    var self = this;

    self.id = attributes.id;
    self.sanitizedId = attributes.id.replace(/[\.,"']/g, "");
    self.name = attributes.name;
    self.enabled = ko.observable(attributes.enabled);
    self.priority = ko.observable(attributes.priority);
    self.alias = ko.observableArray(attributes.alias || []);
    self.showNotifications = ko.observable(attributes.showNotifications);
    self.removedAlias = [];
    self.aliasText = ko.observable("");

    self.toggleSite = function() {
      self.enabled(!self.enabled.peek());
    };

    self.toggleNotifications = function() {
      var internalToggleNotifications = function() {
        self.showNotifications(!self.showNotifications.peek());
      };

      chrome.permissions.contains({
        permissions: ["notifications"],
        origins: ["http://*/*", "https://*/*"]
      }, function (alreadyHaveNotificationsPermissions) {
        if (alreadyHaveNotificationsPermissions) {
          internalToggleNotifications();
        }
        else {
          chrome.permissions.request({
          permissions: ["notifications"],
          origins: ["http://*/*", "https://*/*"]
          }, function (granted) {
            if (granted) {
              internalToggleNotifications();
            }
          });
        }
      });
    };

    /**
     * Note: It's possible some validation should be added to check if alias is proper domain.
     *    However, since it is user input and can be deleted it's probably not worth it.
     */
    self.addAlias = function() {
      self.removedAlias = [];
      self.alias.push(self.aliasText.peek());
      self.aliasText("");
    };

    self.removeAlias = function(index) {
      var aliasToRemove = self.alias.peek()[index()];

      self.removedAlias = [aliasToRemove];
      self.alias.remove(aliasToRemove);
    };
  }
	KnockoutJsTreeModelFactoryTest.prototype.testViewModelWithTwoObservables = function() {
		var treeModel = jsTreeModelFactory.createTreeModelFromKnockoutViewModel({foo:ko.observable('value #1'), bar:ko.observable('value #2')});

		assertEquals('Knockout View Model', treeModel.core.data[0].text);
		assertEquals('foo: value #1', treeModel.core.data[0].children[0].text);
		assertEquals('bar: value #2', treeModel.core.data[0].children[1].text);
		assertEquals({opened: true}, treeModel.core.data[0].state);
	};
Example #16
0
	constructor() {
		this.version = ko.observable(appSettingsGet('version'));
		this.access = ko.observable(!!settingsGet('CoreAccess'));
		this.errorDesc = ko.observable('');

		this.coreReal = CoreStore.coreReal;
		this.coreChannel = CoreStore.coreChannel;
		this.coreType = CoreStore.coreType;
		this.coreUpdatable = CoreStore.coreUpdatable;
		this.coreAccess = CoreStore.coreAccess;
		this.coreChecking = CoreStore.coreChecking;
		this.coreUpdating = CoreStore.coreUpdating;
		this.coreWarning = CoreStore.coreWarning;
		this.coreVersion = CoreStore.coreVersion;
		this.coreRemoteVersion = CoreStore.coreRemoteVersion;
		this.coreRemoteRelease = CoreStore.coreRemoteRelease;
		this.coreVersionCompare = CoreStore.coreVersionCompare;

		this.community = RL_COMMUNITY || AppStore.community();

		this.coreRemoteVersionHtmlDesc = ko.computed(() => {
			translatorTrigger();
			return i18n('TAB_ABOUT/HTML_NEW_VERSION', {'VERSION': this.coreRemoteVersion()});
		});

		this.statusType = ko.computed(() => {
			let type = '';
			const
				versionToCompare = this.coreVersionCompare(),
				isChecking = this.coreChecking(),
				isUpdating = this.coreUpdating(),
				isReal = this.coreReal();

			if (isChecking)
			{
				type = 'checking';
			}
			else if (isUpdating)
			{
				type = 'updating';
			}
			else if (isReal && 0 === versionToCompare)
			{
				type = 'up-to-date';
			}
			else if (isReal && -1 === versionToCompare)
			{
				type = 'available';
			}
			else if (!isReal)
			{
				type = 'error';
				this.errorDesc('Cannot access the repository at the moment.');
			}

			return type;
		});
	}
Example #17
0
	/**
	 * @constructor
	 */
	function ThemeStore()
	{
		this.themes = ko.observableArray([]);
		this.themeBackgroundName = ko.observable('');
		this.themeBackgroundHash = ko.observable('');

		this.theme = ko.observable('')
			.extend({'limitedList': this.themes});
	}
Example #18
0
File: menu.js Project: hasenj/kengo
    menu.MenuItem = function MenuItem(label, callback) {
        var self = utils.create(menu.MenuItem);
        callback = callback || function() {};

        self.text = ko.observable(label);
        self.callback = ko.observable(callback);
        self.hovered = utils.flag(false);
        return self;
    }
Example #19
0
	/**
	 * @constructor
	 *
	 * @param {string} sEmail
	 * @param {boolean=} bCanBeDelete = true
	 */
	function AccountModel(sEmail, bCanBeDelete)
	{
		AbstractModel.call(this, 'AccountModel');

		this.email = sEmail;

		this.deleteAccess = ko.observable(false);
		this.canBeDalete = ko.observable(Utils.isUnd(bCanBeDelete) ? true : !!bCanBeDelete);
	}
Example #20
0
	/**
	 * @constructor
	 */
	function GeneralUserSettings()
	{
		this.language = LanguageStore.language;
		this.languages = LanguageStore.languages;
		this.messagesPerPage = SettingsStore.messagesPerPage;
		this.messagesPerPageArray = Consts.Defaults.MessagesPerPageArray;

		this.editorDefaultType = SettingsStore.editorDefaultType;
		this.layout = SettingsStore.layout;
		this.usePreviewPane = SettingsStore.usePreviewPane;

		this.soundNotificationIsSupported = NotificationStore.soundNotificationIsSupported;
		this.enableSoundNotification = NotificationStore.enableSoundNotification;

		this.enableDesktopNotification = NotificationStore.enableDesktopNotification;
		this.isDesktopNotificationSupported = NotificationStore.isDesktopNotificationSupported;
		this.isDesktopNotificationDenied = NotificationStore.isDesktopNotificationDenied;

		this.showImages = SettingsStore.showImages;
		this.useCheckboxesInList = SettingsStore.useCheckboxesInList;
		this.threadsAllowed = AppStore.threadsAllowed;
		this.useThreads = SettingsStore.useThreads;
		this.replySameFolder = SettingsStore.replySameFolder;
		this.allowLanguagesOnSettings = AppStore.allowLanguagesOnSettings;

		this.languageFullName = ko.computed(function () {
			return Utils.convertLangName(this.language());
		}, this);

		this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100});

		this.mppTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
		this.editorDefaultTypeTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
		this.layoutTrigger = ko.observable(Enums.SaveSettingsStep.Idle);

		this.isAnimationSupported = Globals.bAnimationSupported;

		this.editorDefaultTypes = ko.computed(function () {
			Translator.trigger();
			return [
				{'id': Enums.EditorDefaultType.Html, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML')},
				{'id': Enums.EditorDefaultType.Plain, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN')},
				{'id': Enums.EditorDefaultType.HtmlForced, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML_FORCED')},
				{'id': Enums.EditorDefaultType.PlainForced, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN_FORCED')}
			];
		}, this);

		this.layoutTypes = ko.computed(function () {
			Translator.trigger();
			return [
				{'id': Enums.Layout.NoPreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_NO_SPLIT')},
				{'id': Enums.Layout.SidePreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_VERTICAL_SPLIT')},
				{'id': Enums.Layout.BottomPreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_HORIZONTAL_SPLIT')}
			];
		}, this);
	}
Example #21
0
	/**
	 * @constructor
	 */
	function AboutAdminSetting()
	{
		var
			Settings = require('Storage/Settings'),
			Data = require('Storage/Admin/Data')
		;

		this.version = ko.observable(Settings.settingsGet('Version'));
		this.access = ko.observable(!!Settings.settingsGet('CoreAccess'));
		this.errorDesc = ko.observable('');

		this.coreReal = Data.coreReal;
		this.coreUpdatable = Data.coreUpdatable;
		this.coreAccess = Data.coreAccess;
		this.coreChecking = Data.coreChecking;
		this.coreUpdating = Data.coreUpdating;
		this.coreRemoteVersion = Data.coreRemoteVersion;
		this.coreRemoteRelease = Data.coreRemoteRelease;
		this.coreVersionCompare = Data.coreVersionCompare;

		this.statusType = ko.computed(function () {

			var
				sType = '',
				iVersionCompare = this.coreVersionCompare(),
				bChecking = this.coreChecking(),
				bUpdating = this.coreUpdating(),
				bReal = this.coreReal()
			;

			if (bChecking)
			{
				sType = 'checking';
			}
			else if (bUpdating)
			{
				sType = 'updating';
			}
			else if (bReal && 0 === iVersionCompare)
			{
				sType = 'up-to-date';
			}
			else if (bReal && -1 === iVersionCompare)
			{
				sType = 'available';
			}
			else if (!bReal)
			{
				sType = 'error';
				this.errorDesc('Cannot access the repository at the moment.');
			}

			return sType;

		}, this);
	}
Example #22
0
	constructor() {
		this.allowAdditionalAccount = capa(Capa.AdditionalAccounts);
		this.allowIdentities = capa(Capa.Identities);

		this.accounts = AccountStore.accounts;
		this.identities = IdentityStore.identities;

		this.accountForDeletion = ko.observable(null).deleteAccessHelper();
		this.identityForDeletion = ko.observable(null).deleteAccessHelper();
	}
				return aKeys ? _.map(aKeys, function (oKey) {
					return {
						'empty': !oKey,
						'selected': ko.observable(!!oKey),
						'removable': ko.observable(!self.sign() || !self.signKey() || self.signKey().key.id !== oKey.id),
						'users': oKey ? (oKey.users || [sEmail]) : [sEmail],
						'hash': oKey ? oKey.id.substr(-8).toUpperCase() : '',
						'key': oKey
					};
				}) : [];
	/**
	 * @constructor
	 * @extends AbstractView
	 */
	function AdvancedSearchPopupView()
	{
		AbstractView.call(this, 'Popups', 'PopupsAdvancedSearch');

		this.fromFocus = ko.observable(false);

		this.from = ko.observable('');
		this.to = ko.observable('');
		this.subject = ko.observable('');
		this.text = ko.observable('');
		this.selectedDateValue = ko.observable(-1);

		this.hasAttachment = ko.observable(false);
		this.starred = ko.observable(false);
		this.unseen = ko.observable(false);

		this.searchCommand = Utils.createCommand(this, function () {

			var sSearch = this.buildSearchString();
			if ('' !== sSearch)
			{
				Data.mainMessageListSearch(sSearch);
			}

			this.cancelCommand();
		});

		kn.constructorEnd(this);
	}
Example #25
0
	/**
	 * @constructor
	 */
	function SecurityUserSetting()
	{
		this.processing = ko.observable(false);
		this.clearing = ko.observable(false);
		this.secreting = ko.observable(false);

		this.viewUser = ko.observable('');
		this.viewEnable = ko.observable(false);
		this.viewEnable.subs = true;
		this.twoFactorStatus = ko.observable(false);

		this.viewSecret = ko.observable('');
		this.viewBackupCodes = ko.observable('');
		this.viewUrl = ko.observable('');

		this.bFirst = true;

		this.viewTwoFactorStatus = ko.computed(function () {
			Globals.langChangeTrigger();
			return Utils.i18n(
				this.twoFactorStatus() ?
					'SETTINGS_SECURITY/TWO_FACTOR_SECRET_CONFIGURED_DESC' :
					'SETTINGS_SECURITY/TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC'
			);
		}, this);

		this.onResult = _.bind(this.onResult, this);
		this.onSecretResult = _.bind(this.onSecretResult, this);
	}
Example #26
0
function KeybindsViewModel() {
	this.keyBindMessage = ko.observable('Press Shift+V to switch vegetables: ');
	this.keyBoundVegetable = ko.observable('Carrot');
	
	var self = this;
	keybindingService.registerAction('itapp.a-key-binding', function() {
			self.switchVeg();
		});

	keybindingService.bindAction('itapp.a-key-binding', 'shift+v');
}
Example #27
0
	constructor() {
		super();

		this.determineUserLanguage = ko.observable(false);
		this.determineUserDomain = ko.observable(false);

		this.weakPassword = ko.observable(false);
		this.useLocalProxyForExternalImages = ko.observable(false);

		this.dataFolderAccess = ko.observable(false);
	}
	/**
	 * @constructor
	 */
	function ChangePasswordAppSetting()
	{
		this.changeProcess = ko.observable(false);

		this.errorDescription = ko.observable('');
		this.passwordMismatch = ko.observable(false);
		this.passwordUpdateError = ko.observable(false);
		this.passwordUpdateSuccess = ko.observable(false);

		this.currentPassword = ko.observable('');
		this.currentPassword.error = ko.observable(false);
		this.newPassword = ko.observable('');
		this.newPassword2 = ko.observable('');

		this.currentPassword.subscribe(function () {
			this.passwordUpdateError(false);
			this.passwordUpdateSuccess(false);
			this.currentPassword.error(false);
		}, this);

		this.newPassword.subscribe(function () {
			this.passwordUpdateError(false);
			this.passwordUpdateSuccess(false);
			this.passwordMismatch(false);
		}, this);

		this.newPassword2.subscribe(function () {
			this.passwordUpdateError(false);
			this.passwordUpdateSuccess(false);
			this.passwordMismatch(false);
		}, this);

		this.saveNewPasswordCommand = Utils.createCommand(this, function () {

			if (this.newPassword() !== this.newPassword2())
			{
				this.passwordMismatch(true);
				this.errorDescription(Utils.i18n('SETTINGS_CHANGE_PASSWORD/ERROR_PASSWORD_MISMATCH'));
			}
			else
			{
				this.changeProcess(true);

				this.passwordUpdateError(false);
				this.passwordUpdateSuccess(false);
				this.currentPassword.error(false);
				this.passwordMismatch(false);
				this.errorDescription('');

				Remote.changePassword(this.onChangePasswordResponse, this.currentPassword(), this.newPassword());
			}

		}, function () {
			return !this.changeProcess() && '' !== this.currentPassword() &&
				'' !== this.newPassword() && '' !== this.newPassword2();
		});

		this.onChangePasswordResponse = _.bind(this.onChangePasswordResponse, this);
	}
Example #29
0
	/**
	 * @constructor
	 * @extends AbstractView
	 */
	function PaneSettingsAdminView()
	{
		AbstractView.call(this, 'Right', 'AdminPane');

		this.adminDomain = ko.observable(Settings.settingsGet('AdminDomain'));
		this.version = ko.observable(Settings.settingsGet('Version'));

		this.adminManLoadingVisibility = Data.adminManLoadingVisibility;

		kn.constructorEnd(this);
	}
Example #30
0
	/**
	 * @constructor
	 */
	function AccountsUserSettings()
	{
		this.allowAdditionalAccount = Settings.capa(Enums.Capa.AdditionalAccounts);
		this.allowIdentities = true;

		this.accounts = AccountStore.accounts;
		this.identities = IdentityStore.identities;

		this.accountForDeletion = ko.observable(null).deleteAccessHelper();
		this.identityForDeletion = ko.observable(null).deleteAccessHelper();
	}