mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
eslint (additional rules)
This commit is contained in:
parent
77a1d3f3df
commit
8e8a041032
150 changed files with 21911 additions and 23106 deletions
168
.eslintrc
168
.eslintrc
|
|
@ -1,168 +0,0 @@
|
|||
{
|
||||
"ecmaFeatures": {
|
||||
"modules": true
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"commonjs": true,
|
||||
"es6": true,
|
||||
"browser": true
|
||||
},
|
||||
"globals": {
|
||||
"RL_COMMUNITY" : true,
|
||||
"ko" : true,
|
||||
"ssm" : true,
|
||||
"moment" : true,
|
||||
"ifvisible" : true,
|
||||
"crossroads" : true,
|
||||
"hasher" : true,
|
||||
"key" : true,
|
||||
"Jua" : true,
|
||||
"_" : true,
|
||||
"$" : true,
|
||||
"Dropbox" : true
|
||||
},
|
||||
"rules": {
|
||||
"comma-dangle": [2, "never"],
|
||||
"no-cond-assign": 2,
|
||||
"no-console": 2,
|
||||
"no-constant-condition": 2,
|
||||
"no-control-regex": 2,
|
||||
"no-debugger": 2,
|
||||
"no-dupe-keys": 2,
|
||||
"no-empty": 2,
|
||||
"no-empty-character-class": 2,
|
||||
"no-ex-assign": 2,
|
||||
"no-extra-boolean-cast": 2,
|
||||
"no-extra-parens": 0,
|
||||
"no-extra-semi": 2,
|
||||
"no-func-assign": 2,
|
||||
"no-inner-declarations": 2,
|
||||
"no-invalid-regexp": 2,
|
||||
"no-irregular-whitespace": 2,
|
||||
"no-negated-in-lhs": 2,
|
||||
"no-obj-calls": 2,
|
||||
"no-regex-spaces": 2,
|
||||
"no-reserved-keys": 0,
|
||||
"no-sparse-arrays": 2,
|
||||
"no-unreachable": 2,
|
||||
"use-isnan": 2,
|
||||
"valid-jsdoc": 0,
|
||||
"valid-typeof": 2,
|
||||
// Best Practices
|
||||
"block-scoped-var": 2,
|
||||
"complexity": 0,
|
||||
"consistent-return": 2,
|
||||
"curly": 2,
|
||||
// "default-case": 2,
|
||||
"dot-notation": 2,
|
||||
"eqeqeq": 2,
|
||||
"guard-for-in": 2,
|
||||
"no-alert": 2,
|
||||
"no-caller": 2,
|
||||
"no-div-regex": 2,
|
||||
"no-else-return": 2,
|
||||
"no-eq-null": 2,
|
||||
"no-eval": 2,
|
||||
"no-extend-native": 2,
|
||||
"no-extra-bind": 2,
|
||||
"no-fallthrough": 2,
|
||||
"no-floating-decimal": 2,
|
||||
"no-implied-eval": 2,
|
||||
"no-iterator": 2,
|
||||
"no-labels": 2,
|
||||
"no-lone-blocks": 2,
|
||||
"no-loop-func": 2,
|
||||
"no-multi-spaces": 2,
|
||||
"no-multi-str": 0,
|
||||
"no-native-reassign": 2,
|
||||
"no-new": 2,
|
||||
"no-new-func": 2,
|
||||
"no-new-wrappers": 2,
|
||||
"no-octal": 2,
|
||||
"no-octal-escape": 2,
|
||||
"no-process-env": 2,
|
||||
"no-proto": 2,
|
||||
"no-redeclare": 2,
|
||||
"no-return-assign": 2,
|
||||
"no-script-url": 2,
|
||||
"no-self-compare": 2,
|
||||
"no-sequences": 2,
|
||||
"no-unused-expressions": 2,
|
||||
"no-void": 0,
|
||||
"no-warning-comments": 2,
|
||||
"no-with": 2,
|
||||
"radix": 2,
|
||||
"vars-on-top": 0,
|
||||
"wrap-iife": 2,
|
||||
"yoda": 0,
|
||||
// Strict Mode
|
||||
"strict": 0,
|
||||
// Variables
|
||||
"no-catch-shadow": 2,
|
||||
"no-delete-var": 2,
|
||||
"no-label-var": 2,
|
||||
"no-shadow": 2,
|
||||
"no-shadow-restricted-names": 2,
|
||||
"no-undef": 2,
|
||||
"no-undef-init": 2,
|
||||
"no-undefined": 2,
|
||||
"no-unused-vars": 2,
|
||||
"no-use-before-define": 2,
|
||||
// Stylistic Issues
|
||||
// "indent": [2, "tab", {
|
||||
// "SwitchCase": 1,
|
||||
// "VariableDeclarator": 1
|
||||
// }],
|
||||
"camelcase": 0,
|
||||
"comma-spacing": 2,
|
||||
"comma-style": 2,
|
||||
"consistent-this": 0,
|
||||
"eol-last": 2,
|
||||
"func-names": 0,
|
||||
"func-style": 0,
|
||||
"key-spacing": [2, {
|
||||
"beforeColon": false,
|
||||
"afterColon": true
|
||||
}],
|
||||
"max-nested-callbacks": 0,
|
||||
"new-cap": 2,
|
||||
"new-parens": 2,
|
||||
"no-array-constructor": 2,
|
||||
"no-inline-comments": 0,
|
||||
// "no-lonely-if": 2,
|
||||
"no-mixed-spaces-and-tabs": 2,
|
||||
// "no-nested-ternary": 2,
|
||||
"no-new-object": 2,
|
||||
"semi-spacing": [2, {
|
||||
"before": false,
|
||||
"after": true
|
||||
}],
|
||||
"no-spaced-func": 2,
|
||||
"no-ternary": 0,
|
||||
"no-trailing-spaces": 2,
|
||||
"no-multiple-empty-lines": 2,
|
||||
"no-underscore-dangle": 0,
|
||||
"one-var": 0,
|
||||
"operator-assignment": [2, "always"],
|
||||
"padded-blocks": 0,
|
||||
"quotes": [2, "single"],
|
||||
"quote-props": 0,
|
||||
"semi": [2, "always"],
|
||||
// "sort-vars": [2, {"ignoreCase": true}],
|
||||
"space-before-blocks": 2,
|
||||
"object-curly-spacing": [2, "never"],
|
||||
"array-bracket-spacing": [2, "never"],
|
||||
"space-in-parens": 2,
|
||||
"space-infix-ops": 2,
|
||||
"space-unary-ops": 2,
|
||||
"spaced-comment": 2,
|
||||
"wrap-regex": 0,
|
||||
|
||||
"max-depth": 0,
|
||||
"max-len": [2, 200],
|
||||
"max-params": 0,
|
||||
"max-statements": 0,
|
||||
"no-plusplus": 0
|
||||
}
|
||||
}
|
||||
237
.eslintrc.js
Normal file
237
.eslintrc.js
Normal file
|
|
@ -0,0 +1,237 @@
|
|||
module.exports = {
|
||||
"extends": "eslint:recommended",
|
||||
"ecmaFeatures": {
|
||||
"modules": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"commonjs": true,
|
||||
"es6": true,
|
||||
"browser": true
|
||||
},
|
||||
"globals": {
|
||||
"RL_COMMUNITY": true,
|
||||
"ko": true,
|
||||
"ssm": true,
|
||||
"moment": true,
|
||||
"ifvisible": true,
|
||||
"crossroads": true,
|
||||
"hasher": true,
|
||||
"key": true,
|
||||
"Jua": true,
|
||||
"_": true,
|
||||
"$": true,
|
||||
"Dropbox": true
|
||||
},
|
||||
"rules": {
|
||||
|
||||
"strict": 2, // require or disallow strict mode directives
|
||||
|
||||
// errors
|
||||
|
||||
"comma-dangle": [2, "never"], // disallow or enforce trailing commas
|
||||
"no-cond-assign": [2, "always"], // disallow assignment in conditional expressions
|
||||
"no-console": 1, // disallow use of console (off by default in the node environment)
|
||||
"no-constant-condition": 2, // disallow use of constant expressions in conditions
|
||||
"no-control-regex": 2, // disallow control characters in regular expressions
|
||||
"no-debugger": 2, // disallow use of debugger
|
||||
"no-dupe-args": 2, // disallow duplicate arguments in functions
|
||||
"no-dupe-keys": 2, // disallow duplicate keys when creating object literals
|
||||
"no-duplicate-case": 2, // disallow a duplicate case label.
|
||||
"no-empty": 2, // disallow empty statements
|
||||
"no-empty-character-class": 2, // disallow the use of empty character classes in regular expressions
|
||||
"no-ex-assign": 2, // disallow assigning to the exception in a catch block
|
||||
"no-extra-boolean-cast": 2, // disallow double-negation boolean casts in a boolean context
|
||||
"no-extra-parens": 0, // disallow unnecessary parentheses (off by default)
|
||||
"no-extra-semi": 2, // disallow unnecessary semicolons
|
||||
"no-func-assign": 2, // disallow overwriting functions written as function declarations
|
||||
"no-inner-declarations": 2, // disallow function or variable declarations in nested blocks
|
||||
"no-invalid-regexp": 2, // disallow invalid regular expression strings in the RegExp constructor
|
||||
"no-irregular-whitespace": 2, // disallow irregular whitespace outside of strings and comments
|
||||
"no-negated-in-lhs": 2, // disallow negation of the left operand of an in expression
|
||||
"no-obj-calls": 2, // disallow the use of object properties of the global object (Math and JSON) as functions
|
||||
"no-regex-spaces": 2, // disallow multiple spaces in a regular expression literal
|
||||
"no-sparse-arrays": 2, // disallow sparse arrays
|
||||
"no-unexpected-multiline": 2, // disallow confusing multiline expressions
|
||||
"no-unreachable": 2, // disallow unreachable statements after a return, throw, continue, or break statement
|
||||
"use-isnan": 2, // disallow comparisons with the value NaN
|
||||
"valid-typeof": 2, // Ensure that the results of typeof are compared against a valid string
|
||||
|
||||
// "valid-jsdoc": [2, { // Ensure JSDoc comments are valid (off by default)
|
||||
// "requireParamDescription": false,
|
||||
// "requireReturnDescription": false
|
||||
// }],
|
||||
|
||||
// best practices
|
||||
|
||||
"accessor-pairs": 2, // enforce getter and setter pairs in objects
|
||||
"block-scoped-var": 2, // treat var statements as if they were block scoped (off by default). 0: deep destructuring is not compatible https://github.com/eslint/eslint/issues/1863
|
||||
// "complexity": 0, // specify the maximum cyclomatic complexity allowed in a program (off by default)
|
||||
"consistent-return": 2, // require return statements to either always or never specify values
|
||||
"curly": 2, // specify curly brace conventions for all control statements
|
||||
"default-case": 2, // require default case in switch statements (off by default)
|
||||
"dot-location": [2, "property"], // enforce consistent newlines before and after dots
|
||||
"dot-notation": 2, // encourages use of dot notation whenever possible
|
||||
"eqeqeq": 2, // require the use of === and !==
|
||||
"guard-for-in": 2, // make sure for-in loops have an if statement (off by default)
|
||||
"no-alert": 2, // disallow the use of alert, confirm, and prompt
|
||||
"no-caller": 2, // disallow use of arguments.caller or arguments.callee
|
||||
"no-div-regex": 2, // disallow division operators explicitly at beginning of regular expression (off by default)
|
||||
"no-else-return": 2, // disallow else after a return in an if (off by default)
|
||||
"no-empty-label": 2, // disallow use of labels for anything other then loops and switches
|
||||
"no-eq-null": 2, // disallow comparisons to null without a type-checking operator (off by default)
|
||||
"no-eval": 2, // disallow use of eval()
|
||||
"no-extend-native": 2, // disallow adding to native types
|
||||
"no-extra-bind": 2, // disallow unnecessary function binding
|
||||
"no-fallthrough": 2, // disallow fallthrough of case statements
|
||||
"no-floating-decimal": 2, // disallow the use of leading or trailing decimal points in numeric literals (off by default)
|
||||
"no-implied-eval": 2, // disallow use of eval()-like methods
|
||||
"no-iterator": 2, // disallow usage of __iterator__ property
|
||||
"no-labels": 2, // disallow use of labeled statements
|
||||
"no-lone-blocks": 2, // disallow unnecessary nested blocks
|
||||
"no-loop-func": 2, // disallow creation of functions within loops
|
||||
"no-multi-spaces": 2, // disallow use of multiple spaces
|
||||
"no-multi-str": 2, // disallow use of multiline strings
|
||||
"no-native-reassign": 2, // disallow reassignments of native objects
|
||||
"no-new": 2, // disallow use of new operator when not part of the assignment or comparison
|
||||
"no-new-func": 2, // disallow use of new operator for Function object
|
||||
"no-new-wrappers": 2, // disallows creating new instances of String,Number, and Boolean
|
||||
"no-octal": 2, // disallow use of octal literals
|
||||
"no-octal-escape": 2, // disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251";
|
||||
// "no-param-reassign": 2, // disallow reassignment of function parameters (off by default)
|
||||
"no-process-env": 2, // disallow use of process.env (off by default)
|
||||
"no-proto": 2, // disallow usage of __proto__ property
|
||||
"no-redeclare": 2, // disallow declaring the same variable more then once
|
||||
"no-return-assign": 2, // disallow use of assignment in return statement
|
||||
"no-script-url": 2, // disallow use of javascript: urls.
|
||||
"no-self-compare": 2, // disallow comparisons where both sides are exactly the same (off by default)
|
||||
"no-sequences": 2, // disallow use of comma operator
|
||||
"no-throw-literal": 2, // restrict what can be thrown as an exception (off by default)
|
||||
"no-unused-expressions": 2, // disallow usage of expressions in statement position
|
||||
"no-void": 2, // disallow use of void operator (off by default)
|
||||
"no-warning-comments": 1, // disallow usage of configurable warning terms in comments": 2, // e.g. TODO or FIXME (off by default)
|
||||
"no-with": 2, // disallow use of the with statement
|
||||
"radix": 2, // require use of the second argument for parseInt() (off by default)
|
||||
// "vars-on-top": 2, // requires to declare all vars on top of their containing scope (off by default)
|
||||
"wrap-iife": 2, // require immediate function invocation to be wrapped in parentheses (off by default)
|
||||
"yoda": [2, "always"], // require or disallow Yoda conditions
|
||||
|
||||
// variables
|
||||
|
||||
"no-catch-shadow": 2, // disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment)
|
||||
"no-delete-var": 2, // disallow deletion of variables
|
||||
"no-label-var": 2, // disallow labels that share a name with a variable
|
||||
"no-shadow": 2, // disallow declaration of variables already declared in the outer scope
|
||||
"no-shadow-restricted-names": 2, // disallow shadowing of names such as arguments
|
||||
"no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block
|
||||
"no-undef-init": 2, // disallow use of undefined when initializing variables
|
||||
"no-undefined": 2, // disallow use of undefined variable (off by default)
|
||||
"no-unused-vars": 2, // disallow declaration of variables that are not used in the code
|
||||
"no-use-before-define": 2, // disallow use of variables before they are defined
|
||||
|
||||
// stylistic issues
|
||||
|
||||
"array-bracket-spacing": 1, // enforce consistent spacing inside array brackets
|
||||
"block-spacing": [1, "never"], // enforce consistent spacing inside single-line blocks
|
||||
|
||||
// "brace-style": [1, "1tbs"], // enforce consistent brace style for blocks
|
||||
|
||||
// "camelcase": 1, // enforce camelcase naming convention
|
||||
"comma-spacing": 1, // enforce consistent spacing before and after commas
|
||||
"comma-style": 1, // enforce consistent comma style
|
||||
"computed-property-spacing": 1, // enforce consistent spacing inside computed property brackets
|
||||
"consistent-this": [1, "self"], // enforce consistent naming when capturing the current execution context
|
||||
"eol-last": 1, // enforce at least one newline at the end of files
|
||||
"id-match": 1, // require identifiers to match a specified regular expression
|
||||
|
||||
"indent": [1, "tab", { // enforce consistent indentation
|
||||
"SwitchCase": 1,
|
||||
"VariableDeclarator": {
|
||||
"var": 1,
|
||||
"let": 1,
|
||||
"const": 1
|
||||
}
|
||||
}],
|
||||
|
||||
"key-spacing": 1, // enforce consistent spacing between keys and values in object literal properties
|
||||
"linebreak-style": [1, "windows"], // enforce consistent linebreak style
|
||||
"lines-around-comment": 0, // require empty lines around comments
|
||||
"max-depth": 0, // enforce a maximum depth that blocks can be nested
|
||||
"max-len": [1, 200], // enforce a maximum line length
|
||||
"max-lines": 0, // enforce a maximum file length
|
||||
"max-nested-callbacks": [1, 5], // enforce a maximum depth that callbacks can be nested
|
||||
"max-params": 0, // enforce a maximum number of parameters in function definitions
|
||||
"max-statements": 0, // enforce a maximum number of statements allowed in function blocks
|
||||
"max-statements-per-line": 0, // enforce a maximum number of statements allowed per line
|
||||
"new-cap": 1, // require constructor function names to begin with a capital letter
|
||||
"new-parens": 1, // require parentheses when invoking a constructor with no arguments
|
||||
"newline-after-var": 0, // require or disallow an empty line after var declarations
|
||||
"newline-before-return": 0, // require an empty line before return statements
|
||||
"newline-per-chained-call": 0, // require a newline after each call in a method chain
|
||||
"no-array-constructor": 1, // disallow Array constructors
|
||||
"no-bitwise": 1, // disallow bitwise operators
|
||||
"no-continue": 1, // disallow continue statements
|
||||
"no-inline-comments": 0, // disallow inline comments after code
|
||||
"no-lonely-if": 0, // disallow if statements as the only statement in else blocks
|
||||
"no-mixed-operators": 0, // disallow mixes of different operators
|
||||
"no-mixed-spaces-and-tabs": 2, // disallow mixed spaces and tabs for indentation
|
||||
"no-multiple-empty-lines": 2, // disallow multiple empty lines
|
||||
"no-negated-condition": 0, // disallow negated conditions
|
||||
"no-nested-ternary": 0, // disallow nested ternary expressions
|
||||
"no-new-object": 2, // disallow Object constructors
|
||||
"no-plusplus": [1, { // disallow the unary operators ++ and --
|
||||
"allowForLoopAfterthoughts": true
|
||||
}],
|
||||
"no-restricted-syntax": 1, // disallow specified syntax
|
||||
"no-spaced-func": 1, // disallow spacing between function identifiers and their applications
|
||||
"no-ternary": 0, // disallow ternary operators
|
||||
"no-trailing-spaces": 1, // disallow trailing whitespace at the end of lines
|
||||
"no-underscore-dangle": 0, // disallow dangling underscores in identifiers
|
||||
"no-unneeded-ternary": 1, // disallow ternary operators when simpler alternatives exist
|
||||
"no-whitespace-before-property": 0, // disallow whitespace before properties
|
||||
"object-curly-newline": 0, // enforce consistent line breaks inside braces
|
||||
"object-curly-spacing": [1, "never"], // enforce consistent spacing inside braces
|
||||
|
||||
"object-property-newline": [0, { // enforce placing object properties on separate lines
|
||||
"allowMultiplePropertiesPerLine": false
|
||||
}],
|
||||
|
||||
// "one-var": [2, { // enforce variables to be declared either together or separately in functions
|
||||
// "var": "always",
|
||||
// "let": "always",
|
||||
// "const": "never"
|
||||
// }],
|
||||
|
||||
"one-var-declaration-per-line": [0, "always"], // require or disallow newlines around var declarations
|
||||
"operator-assignment": 1, // require or disallow assignment operator shorthand where possible
|
||||
"operator-linebreak": [1, "after"], // enforce consistent linebreak style for operators
|
||||
"padded-blocks": [0, "never"], // require or disallow padding within blocks
|
||||
"quote-props": [0, "as-needed"], // require quotes around object literal property names
|
||||
"quotes": [2, "single"], // enforce the consistent use of either backticks, double, or single quotes
|
||||
"require-jsdoc": 1, // require JSDoc comments
|
||||
"semi": [1, "always"], // require or disallow semicolons instead of ASI
|
||||
"semi-spacing": 1, // enforce consistent spacing before and after semicolons
|
||||
"sort-vars": 0, // require variables within the same declaration block to be sorted
|
||||
"space-before-blocks": 1, // enforce consistent spacing before blocks
|
||||
"space-before-function-paren": [1, "never"], // enforce consistent spacing before function definition opening parenthesis
|
||||
"space-in-parens": 1, // enforce consistent spacing inside parentheses
|
||||
"space-infix-ops": 1, // require spacing around operators
|
||||
"space-unary-ops": 1, // enforce consistent spacing before or after unary operators
|
||||
"spaced-comment": 1, // enforce consistent spacing after the // or /* in a comment
|
||||
// "unicode-bom": [1, "never"], // require or disallow the Unicode BOM
|
||||
"wrap-regex": 1, // require parenthesis around regex literals
|
||||
|
||||
// es6
|
||||
|
||||
"constructor-super": 2, // require super() calls in constructors
|
||||
"no-class-assign": 2, // disallow reassigning class members
|
||||
"no-const-assign": 2, // disallow reassigning const variables
|
||||
"no-dupe-class-members": 2, // disallow duplicate class members
|
||||
"no-this-before-super": 2, // disallow this/super before calling super() in constructors
|
||||
"prefer-const": 2 // require const declarations for variables that are never reassigned after declared
|
||||
}
|
||||
};
|
||||
|
|
@ -19,6 +19,7 @@ import {AbstractBoot} from 'Knoin/AbstractBoot';
|
|||
class AbstractApp extends AbstractBoot
|
||||
{
|
||||
/**
|
||||
* @constructor
|
||||
* @param {RemoteStorage|AdminRemoteStorage} Remote
|
||||
*/
|
||||
constructor(Remote)
|
||||
|
|
@ -58,16 +59,15 @@ class AbstractApp extends AbstractBoot
|
|||
}
|
||||
});
|
||||
|
||||
$win.on('resize', function () {
|
||||
$win.on('resize', function() {
|
||||
Events.pub('window.resize');
|
||||
});
|
||||
|
||||
Events.sub('window.resize', _.throttle(function () {
|
||||
Events.sub('window.resize', _.throttle(function() {
|
||||
|
||||
var
|
||||
iH = $win.height(),
|
||||
iW = $win.height()
|
||||
;
|
||||
iW = $win.height();
|
||||
|
||||
if ($win.__sizes[0] !== iH || $win.__sizes[1] !== iW)
|
||||
{
|
||||
|
|
@ -81,31 +81,31 @@ class AbstractApp extends AbstractBoot
|
|||
|
||||
// DEBUG
|
||||
// Events.sub({
|
||||
// 'window.resize': function () {
|
||||
// 'window.resize': function() {
|
||||
// window.console.log('window.resize');
|
||||
// },
|
||||
// 'window.resize.real': function () {
|
||||
// 'window.resize.real': function() {
|
||||
// window.console.log('window.resize.real');
|
||||
// }
|
||||
// });
|
||||
|
||||
$doc.on('keydown', function (oEvent) {
|
||||
$doc.on('keydown', function(oEvent) {
|
||||
if (oEvent && oEvent.ctrlKey)
|
||||
{
|
||||
$html.addClass('rl-ctrl-key-pressed');
|
||||
}
|
||||
}).on('keyup', function (oEvent) {
|
||||
}).on('keyup', function(oEvent) {
|
||||
if (oEvent && !oEvent.ctrlKey)
|
||||
{
|
||||
$html.removeClass('rl-ctrl-key-pressed');
|
||||
}
|
||||
});
|
||||
|
||||
$doc.on('mousemove keypress click', _.debounce(function () {
|
||||
$doc.on('mousemove keypress click', _.debounce(function() {
|
||||
Events.pub('rl.auto-logout-refresh');
|
||||
}, 5000));
|
||||
|
||||
key('esc, enter', KeyState.All, _.bind(function () {
|
||||
key('esc, enter', KeyState.All, _.bind(function() {
|
||||
detectDropdownVisibility();
|
||||
}, this));
|
||||
}
|
||||
|
|
@ -124,11 +124,11 @@ class AbstractApp extends AbstractBoot
|
|||
|
||||
/**
|
||||
* @param {string} link
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
download(link) {
|
||||
|
||||
if (sUserAgent && (sUserAgent.indexOf('chrome') > -1 || sUserAgent.indexOf('chrome') > -1))
|
||||
if (sUserAgent && (-1 < sUserAgent.indexOf('chrome') || -1 < sUserAgent.indexOf('chrome')))
|
||||
{
|
||||
const oLink = window.document.createElement('a');
|
||||
oLink.href = link;
|
||||
|
|
@ -160,7 +160,7 @@ class AbstractApp extends AbstractBoot
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
googlePreviewSupported() {
|
||||
if (null === this.googlePreviewSupportedCache)
|
||||
|
|
@ -220,8 +220,7 @@ class AbstractApp extends AbstractBoot
|
|||
const
|
||||
kn = require('Knoin/Knoin'),
|
||||
mobile = Settings.appSettingsGet('mobile'),
|
||||
inIframe = !!Settings.appSettingsGet('inIframe')
|
||||
;
|
||||
inIframe = !!Settings.appSettingsGet('inIframe');
|
||||
|
||||
let customLogoutLink = pString(Settings.appSettingsGet('customLogoutLink'));
|
||||
|
||||
|
|
@ -282,8 +281,7 @@ class AbstractApp extends AbstractBoot
|
|||
const
|
||||
mobile = Settings.appSettingsGet('mobile'),
|
||||
ssm = require('ssm'),
|
||||
ko = require('ko')
|
||||
;
|
||||
ko = require('ko');
|
||||
|
||||
ko.components.register('SaveTrigger', require('Component/SaveTrigger'));
|
||||
ko.components.register('Input', require('Component/Input'));
|
||||
|
|
|
|||
|
|
@ -78,10 +78,8 @@ class AdminApp extends AbstractApp
|
|||
PackageStore.packagesReal(!!data.Result.Real);
|
||||
PackageStore.packagesMainUpdatable(!!data.Result.MainUpdatable);
|
||||
|
||||
let
|
||||
list = [],
|
||||
loading = {}
|
||||
;
|
||||
let list = [];
|
||||
const loading = {};
|
||||
|
||||
_.each(PackageStore.packages(), (item) => {
|
||||
if (item && item.loading())
|
||||
|
|
|
|||
|
|
@ -110,8 +110,7 @@ class AppUser extends AbstractApp
|
|||
centeredX: true,
|
||||
centeredY: true
|
||||
})
|
||||
.removeAttr('style')
|
||||
;
|
||||
.removeAttr('style');
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
|
|
@ -147,8 +146,7 @@ class AppUser extends AbstractApp
|
|||
reloadMessageList(bDropPagePosition = false, bDropCurrenFolderCache = false) {
|
||||
|
||||
let
|
||||
iOffset = (MessageStore.messageListPage() - 1) * SettingsStore.messagesPerPage()
|
||||
;
|
||||
iOffset = (MessageStore.messageListPage() - 1) * SettingsStore.messagesPerPage();
|
||||
|
||||
if (bDropCurrenFolderCache)
|
||||
{
|
||||
|
|
@ -203,7 +201,7 @@ class AppUser extends AbstractApp
|
|||
|
||||
/**
|
||||
* @param {Function} fResultFunc
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
contactsSync(fResultFunc) {
|
||||
|
||||
|
|
@ -232,16 +230,14 @@ class AppUser extends AbstractApp
|
|||
|
||||
const
|
||||
sTrashFolder = FolderStore.trashFolder(),
|
||||
sSpamFolder = FolderStore.spamFolder()
|
||||
;
|
||||
sSpamFolder = FolderStore.spamFolder();
|
||||
|
||||
_.each(this.moveCache, (oItem) => {
|
||||
|
||||
var
|
||||
bSpam = sSpamFolder === oItem.To,
|
||||
bTrash = sTrashFolder === oItem.To,
|
||||
bHam = !bSpam && sSpamFolder === oItem.From && Cache.getFolderInboxName() === oItem.To
|
||||
;
|
||||
bHam = !bSpam && sSpamFolder === oItem.From && Cache.getFolderInboxName() === oItem.To;
|
||||
|
||||
Remote.messagesMove(this.moveOrDeleteResponseHelper, oItem.From, oItem.To, oItem.Uid,
|
||||
bSpam ? 'SPAM' : (bHam ? 'HAM' : ''), bSpam || bTrash);
|
||||
|
|
@ -326,8 +322,7 @@ class AppUser extends AbstractApp
|
|||
|
||||
let
|
||||
oMoveFolder = null,
|
||||
nSetSystemFoldersNotification = null
|
||||
;
|
||||
nSetSystemFoldersNotification = null;
|
||||
|
||||
switch (iDeleteType)
|
||||
{
|
||||
|
|
@ -346,6 +341,7 @@ class AppUser extends AbstractApp
|
|||
oMoveFolder = Cache.getFolderFromCacheList(FolderStore.archiveFolder());
|
||||
nSetSystemFoldersNotification = SetSystemFoldersNotification.Archive;
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
||||
bUseFolder = isUnd(bUseFolder) ? true : !!bUseFolder;
|
||||
|
|
@ -390,8 +386,7 @@ class AppUser extends AbstractApp
|
|||
{
|
||||
const
|
||||
oFromFolder = Cache.getFolderFromCacheList(sFromFolderFullNameRaw),
|
||||
oToFolder = Cache.getFolderFromCacheList(sToFolderFullNameRaw)
|
||||
;
|
||||
oToFolder = Cache.getFolderFromCacheList(sToFolderFullNameRaw);
|
||||
|
||||
if (oFromFolder && oToFolder)
|
||||
{
|
||||
|
|
@ -441,8 +436,7 @@ class AppUser extends AbstractApp
|
|||
}, (errorCode) => {
|
||||
FolderStore.folderList.error(getNotification(errorCode, '', errorDefCode));
|
||||
Promises.foldersReloadWithTimeout(FolderStore.foldersLoading);
|
||||
})
|
||||
;
|
||||
});
|
||||
}
|
||||
|
||||
reloadOpenPgpKeys() {
|
||||
|
|
@ -453,8 +447,7 @@ class AppUser extends AbstractApp
|
|||
aKeys = [],
|
||||
oEmail = new EmailModel(),
|
||||
oOpenpgpKeyring = PgpStore.openpgpKeyring,
|
||||
oOpenpgpKeys = oOpenpgpKeyring ? oOpenpgpKeyring.getAllKeys() : []
|
||||
;
|
||||
oOpenpgpKeys = oOpenpgpKeyring ? oOpenpgpKeyring.getAllKeys() : [];
|
||||
|
||||
_.each(oOpenpgpKeys, (oItem, iIndex) => {
|
||||
if (oItem && oItem.primaryKey)
|
||||
|
|
@ -463,9 +456,8 @@ class AppUser extends AbstractApp
|
|||
aEmails = [],
|
||||
aUsers = [],
|
||||
oPrimaryUser = oItem.getPrimaryUser(),
|
||||
sUser = (oPrimaryUser && oPrimaryUser.user) ? oPrimaryUser.user.userId.userid
|
||||
: (oItem.users && oItem.users[0] ? oItem.users[0].userId.userid : '')
|
||||
;
|
||||
sUser = (oPrimaryUser && oPrimaryUser.user) ? oPrimaryUser.user.userId.userid :
|
||||
(oItem.users && oItem.users[0] ? oItem.users[0].userId.userid : '');
|
||||
|
||||
if (oItem.users)
|
||||
{
|
||||
|
|
@ -550,8 +542,7 @@ class AppUser extends AbstractApp
|
|||
var
|
||||
aCounts = {},
|
||||
sParentEmail = Settings.settingsGet('ParentEmail'),
|
||||
sAccountEmail = AccountStore.email()
|
||||
;
|
||||
sAccountEmail = AccountStore.email();
|
||||
|
||||
sParentEmail = '' === sParentEmail ? sAccountEmail : sParentEmail;
|
||||
|
||||
|
|
@ -582,8 +573,7 @@ class AppUser extends AbstractApp
|
|||
const
|
||||
sId = pString(oIdentityData.Id),
|
||||
sEmail = pString(oIdentityData.Email),
|
||||
oIdentity = new IdentityModel(sId, sEmail)
|
||||
;
|
||||
oIdentity = new IdentityModel(sId, sEmail);
|
||||
|
||||
oIdentity.name(pString(oIdentityData.Name));
|
||||
oIdentity.replyTo(pString(oIdentityData.ReplyTo));
|
||||
|
|
@ -646,8 +636,7 @@ class AppUser extends AbstractApp
|
|||
let
|
||||
uid = '',
|
||||
check = false,
|
||||
unreadCountChange = false
|
||||
;
|
||||
unreadCountChange = false;
|
||||
|
||||
const folderFromCache = Cache.getFolderFromCacheList(data.Result.Folder);
|
||||
if (folderFromCache)
|
||||
|
|
@ -739,8 +728,7 @@ class AppUser extends AbstractApp
|
|||
var
|
||||
sHash = Cache.getFolderHash(oItem.Folder),
|
||||
oFolder = Cache.getFolderFromCacheList(oItem.Folder),
|
||||
bUnreadCountChange = false
|
||||
;
|
||||
bUnreadCountChange = false;
|
||||
|
||||
if (oFolder)
|
||||
{
|
||||
|
|
@ -813,8 +801,7 @@ class AppUser extends AbstractApp
|
|||
var
|
||||
oFolder = null,
|
||||
aRootUids = [],
|
||||
iAlreadyUnread = 0
|
||||
;
|
||||
iAlreadyUnread = 0;
|
||||
|
||||
if (isUnd(aMessages))
|
||||
{
|
||||
|
|
@ -825,7 +812,8 @@ class AppUser extends AbstractApp
|
|||
|
||||
if ('' !== sFolderFullNameRaw && 0 < aRootUids.length)
|
||||
{
|
||||
switch (iSetAction) {
|
||||
switch (iSetAction)
|
||||
{
|
||||
case MessageSetAction.SetSeen:
|
||||
|
||||
_.each(aRootUids, (sSubUid) => {
|
||||
|
|
@ -877,6 +865,7 @@ class AppUser extends AbstractApp
|
|||
|
||||
Remote.messageSetFlagged(noop, sFolderFullNameRaw, aRootUids, false);
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
||||
this.reloadFlagsCurrentMessageListAndMessageFromCache();
|
||||
|
|
@ -1019,8 +1008,7 @@ class AppUser extends AbstractApp
|
|||
})
|
||||
.on('mouseup', () => {
|
||||
$html.removeClass('rl-resizer');
|
||||
})
|
||||
;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -1062,8 +1050,7 @@ class AppUser extends AbstractApp
|
|||
{
|
||||
oTop
|
||||
.resizable('destroy')
|
||||
.removeAttr('style')
|
||||
;
|
||||
.removeAttr('style');
|
||||
}
|
||||
|
||||
if (oBottom)
|
||||
|
|
@ -1084,8 +1071,7 @@ class AppUser extends AbstractApp
|
|||
const iHeight = pInt(Local.get(sClientSideKeyName)) || 300;
|
||||
fSetHeight(iHeight > iMinHeight ? iHeight : iMinHeight);
|
||||
}
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
fDisable(false);
|
||||
|
||||
|
|
@ -1144,8 +1130,7 @@ class AppUser extends AbstractApp
|
|||
})
|
||||
.on('mouseup', () => {
|
||||
$html.removeClass('rl-resizer');
|
||||
})
|
||||
;
|
||||
});
|
||||
}
|
||||
},
|
||||
fResizeResizeFunction = _.debounce(() => {
|
||||
|
|
@ -1173,8 +1158,7 @@ class AppUser extends AbstractApp
|
|||
height: ''
|
||||
});
|
||||
}
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
if (null !== mLeftWidth)
|
||||
{
|
||||
|
|
@ -1236,7 +1220,7 @@ class AppUser extends AbstractApp
|
|||
kn.setHash(Links.root(), true);
|
||||
kn.routeOff();
|
||||
|
||||
_.defer(function () {
|
||||
_.defer(function() {
|
||||
window.location.href = customLoginLink;
|
||||
});
|
||||
}
|
||||
|
|
@ -1271,8 +1255,7 @@ class AppUser extends AbstractApp
|
|||
iContactsSyncInterval = pInt(Settings.settingsGet('ContactsSyncInterval')),
|
||||
bGoogle = Settings.settingsGet('AllowGoogleSocial'),
|
||||
bFacebook = Settings.settingsGet('AllowFacebookSocial'),
|
||||
bTwitter = Settings.settingsGet('AllowTwitterSocial')
|
||||
;
|
||||
bTwitter = Settings.settingsGet('AllowTwitterSocial');
|
||||
|
||||
if (progressJs)
|
||||
{
|
||||
|
|
@ -1423,7 +1406,8 @@ class AppUser extends AbstractApp
|
|||
window.navigator.registerProtocolHandler('mailto',
|
||||
window.location.protocol + '//' + window.location.host + window.location.pathname + '?mailto&to=%s',
|
||||
'' + (Settings.settingsGet('Title') || 'RainLoop'));
|
||||
} catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
catch (e) {/* eslint-disable-line no-empty */}
|
||||
|
||||
if (Settings.settingsGet('MailToEmail'))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,8 +17,7 @@ const Base64 = {
|
|||
let
|
||||
output = '',
|
||||
chr1, chr2, chr3, enc1, enc2, enc3, enc4,
|
||||
i = 0
|
||||
;
|
||||
i = 0;
|
||||
|
||||
input = Base64._utf8_encode(input);
|
||||
|
||||
|
|
@ -56,8 +55,7 @@ const Base64 = {
|
|||
let
|
||||
output = '',
|
||||
chr1, chr2, chr3, enc1, enc2, enc3, enc4,
|
||||
i = 0
|
||||
;
|
||||
i = 0;
|
||||
|
||||
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, '');
|
||||
|
||||
|
|
@ -97,8 +95,7 @@ const Base64 = {
|
|||
utftext = '',
|
||||
n = 0,
|
||||
l = string.length,
|
||||
c = 0
|
||||
;
|
||||
c = 0;
|
||||
|
||||
for (; n < l; n++) {
|
||||
|
||||
|
|
@ -132,8 +129,7 @@ const Base64 = {
|
|||
i = 0,
|
||||
c = 0,
|
||||
c2 = 0,
|
||||
c3 = 0
|
||||
;
|
||||
c3 = 0;
|
||||
|
||||
while ( i < utftext.length )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,6 +14,11 @@ window.__rlah_set = () => setHash();
|
|||
window.__rlah_clear = () => clearHash();
|
||||
window.__rlah_data = () => RL_APP_DATA_STORAGE;
|
||||
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} name
|
||||
* @returns {string}
|
||||
*/
|
||||
function getComputedStyle(id, name)
|
||||
{
|
||||
var element = window.document.getElementById(id);
|
||||
|
|
@ -21,16 +26,27 @@ function getComputedStyle(id, name)
|
|||
(window.getComputedStyle ? window.getComputedStyle(element, null).getPropertyValue(name) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} styles
|
||||
* @returns {void}
|
||||
*/
|
||||
function includeStyle(styles)
|
||||
{
|
||||
window.document.write(unescape('%3Csty' + 'le%3E' + styles + '"%3E%3C/' + 'sty' + 'le%3E'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} src
|
||||
* @returns {void}
|
||||
*/
|
||||
function includeScr(src)
|
||||
{
|
||||
window.document.write(unescape('%3Csc' + 'ript type="text/jav' + 'ascr' + 'ipt" data-cfasync="false" sr' + 'c="' + src + '"%3E%3C/' + 'scr' + 'ipt%3E'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function includeLayout()
|
||||
{
|
||||
const app = window.document.getElementById('rl-app');
|
||||
|
|
@ -49,18 +65,25 @@ function includeLayout()
|
|||
return false;
|
||||
}
|
||||
|
||||
function includeAppScr(data = {})
|
||||
/**
|
||||
* @param {mixed} data
|
||||
* @returns {void}
|
||||
*/
|
||||
function includeAppScr({admin = false, mobile = false, mobileDevice = false})
|
||||
{
|
||||
let src = './?/';
|
||||
src += data.admin ? 'Admin' : '';
|
||||
src += admin ? 'Admin' : '';
|
||||
src += 'AppData@';
|
||||
src += data.mobile ? 'mobile' : 'no-mobile';
|
||||
src += data.mobileDevice ? '-1' : '-0';
|
||||
src += mobile ? 'mobile' : 'no-mobile';
|
||||
src += mobileDevice ? '-1' : '-0';
|
||||
src += '/';
|
||||
|
||||
includeScr(src + (window.__rlah ? window.__rlah() || '0' : '0') + '/' + window.Math.random().toString().substr(2) + '/');
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {object}
|
||||
*/
|
||||
function getRainloopBootData()
|
||||
{
|
||||
let result = {};
|
||||
|
|
@ -74,13 +97,16 @@ function getRainloopBootData()
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} additionalError
|
||||
* @returns {void}
|
||||
*/
|
||||
function showError(additionalError)
|
||||
{
|
||||
const
|
||||
oR = window.document.getElementById('rl-loading'),
|
||||
oL = window.document.getElementById('rl-loading-error'),
|
||||
oLA = window.document.getElementById('rl-loading-error-additional')
|
||||
;
|
||||
oLA = window.document.getElementById('rl-loading-error-additional');
|
||||
|
||||
if (oR)
|
||||
{
|
||||
|
|
@ -104,12 +130,15 @@ function showError(additionalError)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} description
|
||||
* @returns {void}
|
||||
*/
|
||||
function showDescriptionAndLoading(description)
|
||||
{
|
||||
const
|
||||
oE = window.document.getElementById('rl-loading'),
|
||||
oElDesc = window.document.getElementById('rl-loading-desc')
|
||||
;
|
||||
oElDesc = window.document.getElementById('rl-loading-desc');
|
||||
|
||||
if (oElDesc && description)
|
||||
{
|
||||
|
|
@ -125,6 +154,11 @@ function showDescriptionAndLoading(description)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} withError
|
||||
* @param {string} additionalError
|
||||
* @returns {void}
|
||||
*/
|
||||
function runMainBoot(withError, additionalError)
|
||||
{
|
||||
if (window.__APP_BOOT && !withError)
|
||||
|
|
@ -139,6 +173,9 @@ function runMainBoot(withError, additionalError)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
function runApp()
|
||||
{
|
||||
const appData = window.__rlah_data();
|
||||
|
|
@ -162,16 +199,14 @@ function runApp()
|
|||
window.$('#rl-bg').attr('style', 'background-image: none !important;')
|
||||
.backstretch(appData.IncludeBackground.replace('{{USER}}',
|
||||
(window.__rlah ? (window.__rlah() || '0') : '0')), {fade: 100, centeredX: true, centeredY: true})
|
||||
.removeAttr('style')
|
||||
;
|
||||
.removeAttr('style');
|
||||
}
|
||||
}
|
||||
}),
|
||||
common = window.Promise.all([
|
||||
window.jassl(appData.TemplatesLink),
|
||||
window.jassl(appData.LangLink)
|
||||
])
|
||||
;
|
||||
]);
|
||||
|
||||
window.Promise.all([libs, common])
|
||||
.then(() => {
|
||||
|
|
@ -193,8 +228,7 @@ function runApp()
|
|||
window.__initEditor();
|
||||
window.__initEditor = null;
|
||||
}
|
||||
})
|
||||
;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -202,6 +236,10 @@ function runApp()
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {mixed} data
|
||||
* @returns {void}
|
||||
*/
|
||||
window.__initAppData = function(data) {
|
||||
|
||||
RL_APP_DATA_STORAGE = data;
|
||||
|
|
@ -226,6 +264,9 @@ window.__initAppData = function(data) {
|
|||
runApp();
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
window.__runBoot = function() {
|
||||
|
||||
if (!window.navigator || !window.navigator.cookieEnabled)
|
||||
|
|
|
|||
|
|
@ -5,18 +5,20 @@ import {trim, pInt, isArray} from 'Common/Utils';
|
|||
import * as Links from 'Common/Links';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
let FOLDERS_CACHE = {};
|
||||
let FOLDERS_NAME_CACHE = {};
|
||||
let FOLDERS_HASH_CACHE = {};
|
||||
let FOLDERS_UID_NEXT_CACHE = {};
|
||||
let MESSAGE_FLAGS_CACHE = {};
|
||||
let FOLDERS_CACHE = {},
|
||||
FOLDERS_NAME_CACHE = {},
|
||||
FOLDERS_HASH_CACHE = {},
|
||||
FOLDERS_UID_NEXT_CACHE = {},
|
||||
MESSAGE_FLAGS_CACHE = {},
|
||||
NEW_MESSAGE_CACHE = {},
|
||||
inboxFolderName = '';
|
||||
|
||||
let NEW_MESSAGE_CACHE = {};
|
||||
let REQUESTED_MESSAGE_CACHE = {};
|
||||
|
||||
const capaGravatar = Settings.capa(Capa.Gravatar);
|
||||
let inboxFolderName = '';
|
||||
const REQUESTED_MESSAGE_CACHE = {},
|
||||
capaGravatar = Settings.capa(Capa.Gravatar);
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
export function clear()
|
||||
{
|
||||
FOLDERS_CACHE = {};
|
||||
|
|
@ -29,7 +31,7 @@ export function clear()
|
|||
/**
|
||||
* @param {string} email
|
||||
* @param {Function} callback
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getUserPic(email, callback)
|
||||
{
|
||||
|
|
@ -40,7 +42,7 @@ export function getUserPic(email, callback)
|
|||
/**
|
||||
* @param {string} folderFullNameRaw
|
||||
* @param {string} uid
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getMessageKey(folderFullNameRaw, uid)
|
||||
{
|
||||
|
|
@ -59,7 +61,7 @@ export function addRequestedMessage(folder, uid)
|
|||
/**
|
||||
* @param {string} folder
|
||||
* @param {string} uid
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function hasRequestedMessage(folder, uid)
|
||||
{
|
||||
|
|
@ -89,13 +91,16 @@ export function hasNewMessageAndRemoveFromCache(folderFullNameRaw, uid)
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
export function clearNewMessageCache()
|
||||
{
|
||||
NEW_MESSAGE_CACHE = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getFolderInboxName()
|
||||
{
|
||||
|
|
@ -104,7 +109,7 @@ export function getFolderInboxName()
|
|||
|
||||
/**
|
||||
* @param {string} folderHash
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getFolderFullNameRaw(folderHash)
|
||||
{
|
||||
|
|
@ -126,7 +131,7 @@ export function setFolderFullNameRaw(folderHash, folderFullNameRaw)
|
|||
|
||||
/**
|
||||
* @param {string} folderFullNameRaw
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getFolderHash(folderFullNameRaw)
|
||||
{
|
||||
|
|
@ -147,7 +152,7 @@ export function setFolderHash(folderFullNameRaw, folderHash)
|
|||
|
||||
/**
|
||||
* @param {string} folderFullNameRaw
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getFolderUidNext(folderFullNameRaw)
|
||||
{
|
||||
|
|
@ -165,7 +170,7 @@ export function setFolderUidNext(folderFullNameRaw, uidNext)
|
|||
|
||||
/**
|
||||
* @param {string} folderFullNameRaw
|
||||
* @return {?FolderModel}
|
||||
* @returns {?FolderModel}
|
||||
*/
|
||||
export function getFolderFromCacheList(folderFullNameRaw)
|
||||
{
|
||||
|
|
@ -192,7 +197,7 @@ export function removeFolderFromCacheList(folderFullNameRaw)
|
|||
/**
|
||||
* @param {string} folderFullName
|
||||
* @param {string} uid
|
||||
* @return {?Array}
|
||||
* @returns {?Array}
|
||||
*/
|
||||
export function getMessageFlagsFromCache(folderFullName, uid)
|
||||
{
|
||||
|
|
@ -233,14 +238,13 @@ export function initMessageFlagsFromCache(message)
|
|||
{
|
||||
const
|
||||
uid = message.uid,
|
||||
flags = getMessageFlagsFromCache(message.folderFullNameRaw, uid)
|
||||
;
|
||||
flags = getMessageFlagsFromCache(message.folderFullNameRaw, uid);
|
||||
|
||||
if (flags && 0 < flags.length)
|
||||
{
|
||||
message.flagged(!!flags[1]);
|
||||
|
||||
if (!message.__simple_message__)
|
||||
if (!message.isSimpleMessage)
|
||||
{
|
||||
message.unseen(!!flags[0]);
|
||||
message.answered(!!flags[2]);
|
||||
|
|
@ -334,6 +338,7 @@ export function storeMessageFlagsToCacheBySetAction(folder, uid, setAction)
|
|||
case MessageSetAction.UnsetFlag:
|
||||
flags[1] = false;
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
||||
setMessageFlagsToCache(folder, uid, flags);
|
||||
|
|
|
|||
|
|
@ -8,14 +8,13 @@ class CookieDriver
|
|||
/**
|
||||
* @param {string} key
|
||||
* @param {*} data
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
set(key, data) {
|
||||
|
||||
let
|
||||
result = false,
|
||||
storageResult = null
|
||||
;
|
||||
storageResult = null;
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -41,7 +40,7 @@ class CookieDriver
|
|||
|
||||
/**
|
||||
* @param {string} key
|
||||
* @return {*}
|
||||
* @returns {*}
|
||||
*/
|
||||
get(key) {
|
||||
|
||||
|
|
@ -51,8 +50,7 @@ class CookieDriver
|
|||
{
|
||||
const
|
||||
storageValue = $.cookie(CLIENT_SIDE_STORAGE_INDEX_NAME),
|
||||
storageResult = null === storageValue ? null : JSON.parse(storageValue)
|
||||
;
|
||||
storageResult = null === storageValue ? null : JSON.parse(storageValue);
|
||||
|
||||
result = (storageResult && !isUnd(storageResult[key])) ? storageResult[key] : null;
|
||||
}
|
||||
|
|
@ -62,7 +60,7 @@ class CookieDriver
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
static supported() {
|
||||
return !!(window.navigator && window.navigator.cookieEnabled);
|
||||
|
|
|
|||
|
|
@ -8,14 +8,13 @@ class LocalStorageDriver
|
|||
/**
|
||||
* @param {string} key
|
||||
* @param {*} data
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
set(key, data) {
|
||||
|
||||
let
|
||||
result = false,
|
||||
storageResult = null
|
||||
;
|
||||
storageResult = null;
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -38,7 +37,7 @@ class LocalStorageDriver
|
|||
|
||||
/**
|
||||
* @param {string} key
|
||||
* @return {*}
|
||||
* @returns {*}
|
||||
*/
|
||||
get(key) {
|
||||
|
||||
|
|
@ -48,8 +47,7 @@ class LocalStorageDriver
|
|||
{
|
||||
const
|
||||
storageValue = window.localStorage[CLIENT_SIDE_STORAGE_INDEX_NAME] || null,
|
||||
storageResult = null === storageValue ? null : JSON.parse(storageValue)
|
||||
;
|
||||
storageResult = null === storageValue ? null : JSON.parse(storageValue);
|
||||
|
||||
result = (storageResult && !isUnd(storageResult[key])) ? storageResult[key] : null;
|
||||
}
|
||||
|
|
@ -59,7 +57,7 @@ class LocalStorageDriver
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
static supported() {
|
||||
return !!window.localStorage;
|
||||
|
|
|
|||
|
|
@ -43,41 +43,37 @@ export const sUserAgent = 'navigator' in window && 'userAgent' in window.navigat
|
|||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
export const bIE = sUserAgent.indexOf('msie') > -1;
|
||||
export const bIE = -1 < sUserAgent.indexOf('msie');
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
export const bChrome = sUserAgent.indexOf('chrome') > -1;
|
||||
export const bChrome = -1 < sUserAgent.indexOf('chrome');
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
export const bSafari = !bChrome && sUserAgent.indexOf('safari') > -1;
|
||||
export const bSafari = !bChrome && -1 < sUserAgent.indexOf('safari');
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
export const bMobileDevice =
|
||||
/android/i.test(sUserAgent) ||
|
||||
/iphone/i.test(sUserAgent) ||
|
||||
/ipod/i.test(sUserAgent) ||
|
||||
/ipad/i.test(sUserAgent) ||
|
||||
/blackberry/i.test(sUserAgent)
|
||||
;
|
||||
(/android/i).test(sUserAgent) ||
|
||||
(/iphone/i).test(sUserAgent) ||
|
||||
(/ipod/i).test(sUserAgent) ||
|
||||
(/ipad/i).test(sUserAgent) ||
|
||||
(/blackberry/i).test(sUserAgent);
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
export let bDisableNanoScroll = bMobileDevice;
|
||||
export const bDisableNanoScroll = bMobileDevice;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
export let bAnimationSupported = !bMobileDevice &&
|
||||
$html.hasClass('csstransitions') &&
|
||||
$html.hasClass('cssanimations')
|
||||
;
|
||||
export const bAnimationSupported = !bMobileDevice && $html.hasClass('csstransitions') && $html.hasClass('cssanimations');
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
|
|
@ -161,13 +157,13 @@ let bAllowPdfPreview = !bMobileDevice;
|
|||
|
||||
if (bAllowPdfPreview && window.navigator && window.navigator.mimeTypes)
|
||||
{
|
||||
bAllowPdfPreview = !!_.find(window.navigator.mimeTypes, function (oType) {
|
||||
bAllowPdfPreview = !!_.find(window.navigator.mimeTypes, function(oType) {
|
||||
return oType && 'application/pdf' === oType.type;
|
||||
});
|
||||
|
||||
if (!bAllowPdfPreview)
|
||||
{
|
||||
bAllowPdfPreview = (typeof window.navigator.mimeTypes['application/pdf'] !== 'undefined');
|
||||
bAllowPdfPreview = 'undefined' !== typeof window.navigator.mimeTypes['application/pdf'];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -203,32 +199,31 @@ export const keyScope = ko.computed({
|
|||
read: () => {
|
||||
return keyScopeFake();
|
||||
},
|
||||
write: function (sValue) {
|
||||
write: function(sValue) {
|
||||
|
||||
if (KeyState.Menu !== sValue)
|
||||
{
|
||||
if (KeyState.Compose === sValue)
|
||||
{
|
||||
// disableKeyFilter
|
||||
key.filter = function () {
|
||||
key.filter = function() {
|
||||
return useKeyboardShortcuts();
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
// restoreKeyFilter
|
||||
key.filter = function (event) {
|
||||
key.filter = function(event) {
|
||||
|
||||
if (useKeyboardShortcuts())
|
||||
{
|
||||
var
|
||||
oElement = event.target || event.srcElement,
|
||||
sTagName = oElement ? oElement.tagName : ''
|
||||
;
|
||||
sTagName = oElement ? oElement.tagName : '';
|
||||
|
||||
sTagName = sTagName.toUpperCase();
|
||||
return !(sTagName === 'INPUT' || sTagName === 'SELECT' || sTagName === 'TEXTAREA' ||
|
||||
(oElement && sTagName === 'DIV' && ('editorHtmlArea' === oElement.className || 'true' === '' + oElement.contentEditable))
|
||||
return !('INPUT' === sTagName || 'SELECT' === sTagName || 'TEXTAREA' === sTagName ||
|
||||
(oElement && 'DIV' === sTagName && ('editorHtmlArea' === oElement.className || 'true' === '' + oElement.contentEditable))
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -247,12 +242,12 @@ export const keyScope = ko.computed({
|
|||
}
|
||||
});
|
||||
|
||||
keyScopeReal.subscribe(function (sValue) {
|
||||
keyScopeReal.subscribe(function(sValue) {
|
||||
// window.console.log('keyScope=' + sValue); // DEBUG
|
||||
key.setScope(sValue);
|
||||
});
|
||||
|
||||
dropdownVisibility.subscribe(function (bValue) {
|
||||
dropdownVisibility.subscribe(function(bValue) {
|
||||
if (bValue)
|
||||
{
|
||||
keyScope(KeyState.Menu);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import * as Settings from 'Storage/Settings';
|
|||
class HtmlEditor
|
||||
{
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} element
|
||||
* @param {Function=} onBlur
|
||||
* @param {Function=} onReady
|
||||
|
|
@ -47,7 +48,7 @@ class HtmlEditor
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isHtml() {
|
||||
return this.editor ? 'wysiwyg' === this.editor.mode : false;
|
||||
|
|
@ -70,7 +71,7 @@ class HtmlEditor
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
checkDirty() {
|
||||
return this.editor ? this.editor.checkDirty() : false;
|
||||
|
|
@ -85,7 +86,7 @@ class HtmlEditor
|
|||
|
||||
/**
|
||||
* @param {string} text
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
clearSignatureSigns(text) {
|
||||
return text.replace(/(\u200C|\u0002)/g, '');
|
||||
|
|
@ -94,7 +95,7 @@ class HtmlEditor
|
|||
/**
|
||||
* @param {boolean=} wrapIsHtml = false
|
||||
* @param {boolean=} clearSignatureSigns = false
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
getData(wrapIsHtml = false, clearSignatureSigns = false) {
|
||||
|
||||
|
|
@ -113,7 +114,8 @@ class HtmlEditor
|
|||
'<div data-html-editor-font-wrapper="true" style="font-family: arial, sans-serif; font-size: 13px;">' +
|
||||
this.editor.getData() + '</div>' : this.editor.getData();
|
||||
}
|
||||
} catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
catch (e) {/* eslint-disable-line no-empty */}
|
||||
|
||||
if (clearSignatureSigns)
|
||||
{
|
||||
|
|
@ -127,7 +129,7 @@ class HtmlEditor
|
|||
/**
|
||||
* @param {boolean=} wrapIsHtml = false
|
||||
* @param {boolean=} clearSignatureSigns = false
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
getDataWithHtmlMark(wrapIsHtml = false, clearSignatureSigns = false) {
|
||||
return (this.isHtml() ? ':HTML:' : '') + this.getData(wrapIsHtml, clearSignatureSigns);
|
||||
|
|
@ -151,7 +153,8 @@ class HtmlEditor
|
|||
this.editor.setMode('plain');
|
||||
}
|
||||
}
|
||||
} catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
catch (e) {/* eslint-disable-line no-empty */}
|
||||
|
||||
if (resize)
|
||||
{
|
||||
|
|
@ -180,7 +183,8 @@ class HtmlEditor
|
|||
|
||||
try {
|
||||
this.editor.setData(html);
|
||||
} catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
catch (e) {/* eslint-disable-line no-empty */}
|
||||
|
||||
if (focus)
|
||||
{
|
||||
|
|
@ -195,7 +199,8 @@ class HtmlEditor
|
|||
try {
|
||||
this.editor.setData(
|
||||
this.editor.getData().replace(find, replaceHtml));
|
||||
} catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -211,7 +216,8 @@ class HtmlEditor
|
|||
{
|
||||
try {
|
||||
this.editor.setData(plain);
|
||||
} catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
|
||||
if (focus)
|
||||
|
|
@ -231,8 +237,7 @@ class HtmlEditor
|
|||
config = oHtmlEditorDefaultConfig,
|
||||
language = Settings.settingsGet('Language'),
|
||||
allowSource = !!Settings.appSettingsGet('allowHtmlEditorSourceButton'),
|
||||
biti = !!Settings.appSettingsGet('allowHtmlEditorBitiButtons')
|
||||
;
|
||||
biti = !!Settings.appSettingsGet('allowHtmlEditorBitiButtons');
|
||||
|
||||
if ((allowSource || !biti) && !config.toolbarGroups.__cfgInited)
|
||||
{
|
||||
|
|
@ -295,8 +300,7 @@ class HtmlEditor
|
|||
var
|
||||
id = event.data.dataTransfer.id,
|
||||
imageId = `[img=${id}]`,
|
||||
reader = new window.FileReader()
|
||||
;
|
||||
reader = new window.FileReader();
|
||||
|
||||
reader.onloadend = () => {
|
||||
if (reader.result)
|
||||
|
|
@ -333,8 +337,7 @@ class HtmlEditor
|
|||
}
|
||||
|
||||
});
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
if (window.CKEDITOR)
|
||||
{
|
||||
|
|
@ -352,7 +355,8 @@ class HtmlEditor
|
|||
{
|
||||
try {
|
||||
this.editor.focus();
|
||||
} catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -361,7 +365,8 @@ class HtmlEditor
|
|||
{
|
||||
try {
|
||||
return !!this.editor.focusManager.hasFocus;
|
||||
} catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -372,7 +377,8 @@ class HtmlEditor
|
|||
{
|
||||
try {
|
||||
this.editor.focusManager.blur(true);
|
||||
} catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -381,7 +387,8 @@ class HtmlEditor
|
|||
{
|
||||
try {
|
||||
this.editor.resize(this.$element.width(), this.$element.innerHeight());
|
||||
} catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -390,7 +397,8 @@ class HtmlEditor
|
|||
{
|
||||
try {
|
||||
this.editor.setReadOnly(!!value);
|
||||
} catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,29 +3,33 @@ import {window} from 'common';
|
|||
import {pString, pInt, isUnd, isNormal, trim, encodeURIComponent} from 'Common/Utils';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
const ROOT = './';
|
||||
const HASH_PREFIX = '#/';
|
||||
const SERVER_PREFIX = './?';
|
||||
const SUB_QUERY_PREFIX = '&q[]=';
|
||||
const
|
||||
ROOT = './',
|
||||
HASH_PREFIX = '#/',
|
||||
SERVER_PREFIX = './?',
|
||||
SUB_QUERY_PREFIX = '&q[]=',
|
||||
|
||||
const VERSION = Settings.appSettingsGet('version');
|
||||
VERSION = Settings.appSettingsGet('version'),
|
||||
|
||||
const WEB_PREFIX = Settings.appSettingsGet('webPath') || '';
|
||||
const VERSION_PREFIX = Settings.appSettingsGet('webVersionPath') || 'rainloop/v/' + VERSION + '/';
|
||||
const STATIC_PREFIX = VERSION_PREFIX + 'static/';
|
||||
WEB_PREFIX = Settings.appSettingsGet('webPath') || '',
|
||||
VERSION_PREFIX = Settings.appSettingsGet('webVersionPath') || 'rainloop/v/' + VERSION + '/',
|
||||
STATIC_PREFIX = VERSION_PREFIX + 'static/',
|
||||
|
||||
const ADMIN_HOST_USE = !!Settings.appSettingsGet('adminHostUse');
|
||||
const ADMIN_PATH = Settings.appSettingsGet('adminPath') || 'admin';
|
||||
ADMIN_HOST_USE = !!Settings.appSettingsGet('adminHostUse'),
|
||||
ADMIN_PATH = Settings.appSettingsGet('adminPath') || 'admin';
|
||||
|
||||
let AUTH_PREFIX = Settings.settingsGet('AuthAccountHash') || '0';
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
export function populateAuthSuffix()
|
||||
{
|
||||
AUTH_PREFIX = Settings.settingsGet('AuthAccountHash') || '0';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function subQueryPrefix()
|
||||
{
|
||||
|
|
@ -34,7 +38,7 @@ export function subQueryPrefix()
|
|||
|
||||
/**
|
||||
* @param {string=} startupUrl
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function root(startupUrl = '')
|
||||
{
|
||||
|
|
@ -42,7 +46,7 @@ export function root(startupUrl = '')
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function rootAdmin()
|
||||
{
|
||||
|
|
@ -51,7 +55,7 @@ export function rootAdmin()
|
|||
|
||||
/**
|
||||
* @param {boolean=} mobile = false
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function rootUser(mobile = false)
|
||||
{
|
||||
|
|
@ -62,7 +66,7 @@ export function rootUser(mobile = false)
|
|||
* @param {string} type
|
||||
* @param {string} download
|
||||
* @param {string=} customSpecSuffix
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function attachmentRaw(type, download, customSpecSuffix)
|
||||
{
|
||||
|
|
@ -73,7 +77,7 @@ export function attachmentRaw(type, download, customSpecSuffix)
|
|||
/**
|
||||
* @param {string} download
|
||||
* @param {string=} customSpecSuffix
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function attachmentDownload(download, customSpecSuffix)
|
||||
{
|
||||
|
|
@ -83,7 +87,7 @@ export function attachmentDownload(download, customSpecSuffix)
|
|||
/**
|
||||
* @param {string} download
|
||||
* @param {string=} customSpecSuffix
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function attachmentPreview(download, customSpecSuffix)
|
||||
{
|
||||
|
|
@ -93,7 +97,7 @@ export function attachmentPreview(download, customSpecSuffix)
|
|||
/**
|
||||
* @param {string} download
|
||||
* @param {string=} customSpecSuffix
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function attachmentThumbnailPreview(download, customSpecSuffix)
|
||||
{
|
||||
|
|
@ -103,7 +107,7 @@ export function attachmentThumbnailPreview(download, customSpecSuffix)
|
|||
/**
|
||||
* @param {string} download
|
||||
* @param {string=} customSpecSuffix
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function attachmentPreviewAsPlain(download, customSpecSuffix)
|
||||
{
|
||||
|
|
@ -113,7 +117,7 @@ export function attachmentPreviewAsPlain(download, customSpecSuffix)
|
|||
/**
|
||||
* @param {string} download
|
||||
* @param {string=} customSpecSuffix
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function attachmentFramed(download, customSpecSuffix)
|
||||
{
|
||||
|
|
@ -122,7 +126,7 @@ export function attachmentFramed(download, customSpecSuffix)
|
|||
|
||||
/**
|
||||
* @param {string} type
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function serverRequest(type)
|
||||
{
|
||||
|
|
@ -130,7 +134,7 @@ export function serverRequest(type)
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function upload()
|
||||
{
|
||||
|
|
@ -138,7 +142,7 @@ export function upload()
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function uploadContacts()
|
||||
{
|
||||
|
|
@ -146,7 +150,7 @@ export function uploadContacts()
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function uploadBackground()
|
||||
{
|
||||
|
|
@ -154,7 +158,7 @@ export function uploadBackground()
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function append()
|
||||
{
|
||||
|
|
@ -163,7 +167,7 @@ export function append()
|
|||
|
||||
/**
|
||||
* @param {string} email
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function change(email)
|
||||
{
|
||||
|
|
@ -172,7 +176,7 @@ export function change(email)
|
|||
|
||||
/**
|
||||
* @param {string} add
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function ajax(add)
|
||||
{
|
||||
|
|
@ -181,7 +185,7 @@ export function ajax(add)
|
|||
|
||||
/**
|
||||
* @param {string} requestHash
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function messageViewLink(requestHash)
|
||||
{
|
||||
|
|
@ -190,7 +194,7 @@ export function messageViewLink(requestHash)
|
|||
|
||||
/**
|
||||
* @param {string} requestHash
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function messageDownloadLink(requestHash)
|
||||
{
|
||||
|
|
@ -199,7 +203,7 @@ export function messageDownloadLink(requestHash)
|
|||
|
||||
/**
|
||||
* @param {string} email
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function avatarLink(email)
|
||||
{
|
||||
|
|
@ -208,7 +212,7 @@ export function avatarLink(email)
|
|||
|
||||
/**
|
||||
* @param {string} hash
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function publicLink(hash)
|
||||
{
|
||||
|
|
@ -217,7 +221,7 @@ export function publicLink(hash)
|
|||
|
||||
/**
|
||||
* @param {string} hash
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function userBackground(hash)
|
||||
{
|
||||
|
|
@ -225,7 +229,7 @@ export function userBackground(hash)
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function phpInfo()
|
||||
{
|
||||
|
|
@ -235,7 +239,7 @@ export function phpInfo()
|
|||
/**
|
||||
* @param {string} lang
|
||||
* @param {boolean} isAdmin
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function langLink(lang, isAdmin)
|
||||
{
|
||||
|
|
@ -243,7 +247,7 @@ export function langLink(lang, isAdmin)
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function exportContactsVcf()
|
||||
{
|
||||
|
|
@ -251,7 +255,7 @@ export function exportContactsVcf()
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function exportContactsCsv()
|
||||
{
|
||||
|
|
@ -260,7 +264,7 @@ export function exportContactsCsv()
|
|||
|
||||
/**
|
||||
* @param {boolean} xauth = false
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function socialGoogle(xauth = false)
|
||||
{
|
||||
|
|
@ -269,7 +273,7 @@ export function socialGoogle(xauth = false)
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function socialTwitter()
|
||||
{
|
||||
|
|
@ -278,7 +282,7 @@ export function socialTwitter()
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function socialFacebook()
|
||||
{
|
||||
|
|
@ -288,7 +292,7 @@ export function socialFacebook()
|
|||
|
||||
/**
|
||||
* @param {string} path
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function staticPrefix(path)
|
||||
{
|
||||
|
|
@ -296,7 +300,7 @@ export function staticPrefix(path)
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function emptyContactPic()
|
||||
{
|
||||
|
|
@ -305,7 +309,7 @@ export function emptyContactPic()
|
|||
|
||||
/**
|
||||
* @param {string} fileName
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function sound(fileName)
|
||||
{
|
||||
|
|
@ -313,7 +317,7 @@ export function sound(fileName)
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function notificationMailIcon()
|
||||
{
|
||||
|
|
@ -321,7 +325,7 @@ export function notificationMailIcon()
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function openPgpJs()
|
||||
{
|
||||
|
|
@ -329,7 +333,7 @@ export function openPgpJs()
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function openPgpWorkerJs()
|
||||
{
|
||||
|
|
@ -337,7 +341,7 @@ export function openPgpWorkerJs()
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function openPgpWorkerPath()
|
||||
{
|
||||
|
|
@ -346,7 +350,7 @@ export function openPgpWorkerPath()
|
|||
|
||||
/**
|
||||
* @param {string} theme
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function themePreviewLink(theme)
|
||||
{
|
||||
|
|
@ -362,7 +366,7 @@ export function themePreviewLink(theme)
|
|||
|
||||
/**
|
||||
* @param {string} inboxFolderName = 'INBOX'
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function inbox(inboxFolderName = 'INBOX')
|
||||
{
|
||||
|
|
@ -371,7 +375,7 @@ export function inbox(inboxFolderName = 'INBOX')
|
|||
|
||||
/**
|
||||
* @param {string=} screenName = ''
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function settings(screenName = '')
|
||||
{
|
||||
|
|
@ -379,7 +383,7 @@ export function settings(screenName = '')
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function about()
|
||||
{
|
||||
|
|
@ -388,12 +392,13 @@ export function about()
|
|||
|
||||
/**
|
||||
* @param {string} screenName
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function admin(screenName)
|
||||
{
|
||||
let result = HASH_PREFIX;
|
||||
switch (screenName) {
|
||||
switch (screenName)
|
||||
{
|
||||
case 'AdminDomains':
|
||||
result += 'domains';
|
||||
break;
|
||||
|
|
@ -403,6 +408,7 @@ export function admin(screenName)
|
|||
case 'AdminLicensing':
|
||||
result += 'licensing';
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
@ -413,7 +419,7 @@ export function admin(screenName)
|
|||
* @param {number=} page = 1
|
||||
* @param {string=} search = ''
|
||||
* @param {string=} threadUid = ''
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function mailBox(folder, page = 1, search = '', threadUid = '')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,12 +13,18 @@ const updateMomentNowUnix = _.debounce(() => {
|
|||
_momentNow = moment().unix();
|
||||
}, 500, true);
|
||||
|
||||
/**
|
||||
* @returns {moment}
|
||||
*/
|
||||
export function momentNow()
|
||||
{
|
||||
updateMomentNow();
|
||||
return _moment || moment();
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
export function momentNowUnix()
|
||||
{
|
||||
updateMomentNowUnix();
|
||||
|
|
@ -27,7 +33,7 @@ export function momentNowUnix()
|
|||
|
||||
/**
|
||||
* @param {number} date
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function searchSubtractFormatDateHelper(date)
|
||||
{
|
||||
|
|
@ -36,14 +42,14 @@ export function searchSubtractFormatDateHelper(date)
|
|||
|
||||
/**
|
||||
* @param {Object} m
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
function formatCustomShortDate(m)
|
||||
{
|
||||
const now = momentNow();
|
||||
if (m && now)
|
||||
{
|
||||
switch(true)
|
||||
switch (true)
|
||||
{
|
||||
case 4 >= now.diff(m, 'hours'):
|
||||
return m.fromNow();
|
||||
|
|
@ -57,6 +63,7 @@ function formatCustomShortDate(m)
|
|||
});
|
||||
case now.year() === m.year():
|
||||
return m.format('D MMM.');
|
||||
// no default
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -66,15 +73,14 @@ function formatCustomShortDate(m)
|
|||
/**
|
||||
* @param {number} timeStampInUTC
|
||||
* @param {string} formatStr
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function format(timeStampInUTC, formatStr)
|
||||
{
|
||||
|
||||
let
|
||||
m = null,
|
||||
result = ''
|
||||
;
|
||||
result = '';
|
||||
|
||||
const now = momentNowUnix();
|
||||
|
||||
|
|
@ -112,14 +118,14 @@ export function format(timeStampInUTC, formatStr)
|
|||
|
||||
/**
|
||||
* @param {Object} element
|
||||
* @returns {void}
|
||||
*/
|
||||
export function momentToNode(element)
|
||||
{
|
||||
var
|
||||
key = '',
|
||||
time = 0,
|
||||
$el = $(element)
|
||||
;
|
||||
$el = $(element);
|
||||
|
||||
time = $el.data('moment-time');
|
||||
if (time)
|
||||
|
|
@ -138,6 +144,9 @@ export function momentToNode(element)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
export function reload()
|
||||
{
|
||||
_.defer(() => {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export function runHook(name, args = [])
|
|||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @return {?}
|
||||
* @returns {?}
|
||||
*/
|
||||
export function mainSettingsGet(name)
|
||||
{
|
||||
|
|
@ -98,7 +98,7 @@ export function runSettingsViewModelHooks(admin)
|
|||
/**
|
||||
* @param {string} pluginSection
|
||||
* @param {string} name
|
||||
* @return {?}
|
||||
* @returns {?}
|
||||
*/
|
||||
export function settingsGet(pluginSection, name)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -129,8 +129,7 @@ class Selector
|
|||
aCache = [],
|
||||
aCheckedCache = [],
|
||||
mFocused = null,
|
||||
mSelected = null
|
||||
;
|
||||
mSelected = null;
|
||||
|
||||
this.list.subscribe((items) => {
|
||||
|
||||
|
|
@ -168,8 +167,7 @@ class Selector
|
|||
mNextFocused = mFocused,
|
||||
bChecked = false,
|
||||
bSelected = false,
|
||||
iLen = 0
|
||||
;
|
||||
iLen = 0;
|
||||
|
||||
this.selectedItemUseCallback = false;
|
||||
|
||||
|
|
@ -195,7 +193,7 @@ class Selector
|
|||
{
|
||||
bChecked = true;
|
||||
oItem.checked(true);
|
||||
iLen--;
|
||||
iLen -= 1;
|
||||
}
|
||||
|
||||
if (!bChecked && null !== mSelected && mSelected === sUid)
|
||||
|
|
@ -350,8 +348,7 @@ class Selector
|
|||
item.checked(!item.checked());
|
||||
}
|
||||
}
|
||||
})
|
||||
;
|
||||
});
|
||||
|
||||
key('enter', keyScope, () => {
|
||||
if (this.focusedItem() && !this.focusedItem().selected())
|
||||
|
|
@ -397,6 +394,7 @@ class Selector
|
|||
case 'pagedown':
|
||||
eventKey = EventKeyCode.PageDown;
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
||||
if (0 < eventKey)
|
||||
|
|
@ -410,7 +408,7 @@ class Selector
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
autoSelect() {
|
||||
return !!(this.oCallbacks.onAutoSelect || noopTrue)();
|
||||
|
|
@ -425,7 +423,7 @@ class Selector
|
|||
|
||||
/**
|
||||
* @param {Object} oItem
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
getItemUid(item) {
|
||||
|
||||
|
|
@ -455,8 +453,7 @@ class Selector
|
|||
oResult = null,
|
||||
aList = this.list(),
|
||||
iListLen = aList ? aList.length : 0,
|
||||
oFocused = this.focusedItem()
|
||||
;
|
||||
oFocused = this.focusedItem();
|
||||
|
||||
if (0 < iListLen)
|
||||
{
|
||||
|
|
@ -482,7 +479,8 @@ class Selector
|
|||
_.each(aList, (item) => {
|
||||
if (!bStop)
|
||||
{
|
||||
switch (iEventKeyCode) {
|
||||
switch (iEventKeyCode)
|
||||
{
|
||||
case EventKeyCode.Up:
|
||||
if (oFocused === item)
|
||||
{
|
||||
|
|
@ -505,6 +503,7 @@ class Selector
|
|||
bNext = true;
|
||||
}
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -540,7 +539,7 @@ class Selector
|
|||
}
|
||||
else if (EventKeyCode.PageUp === iEventKeyCode)
|
||||
{
|
||||
for (iIndex = iListLen; iIndex >= 0; iIndex--)
|
||||
for (iIndex = iListLen; 0 <= iIndex; iIndex--)
|
||||
{
|
||||
if (oFocused === aList[iIndex])
|
||||
{
|
||||
|
|
@ -597,7 +596,7 @@ class Selector
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
scrollToFocused() {
|
||||
|
||||
|
|
@ -612,17 +611,16 @@ class Selector
|
|||
$focused = $(this.sItemFocusedSelector, this.oContentScrollable),
|
||||
pos = $focused.position(),
|
||||
visibleHeight = this.oContentVisible.height(),
|
||||
focusedHeight = $focused.outerHeight()
|
||||
;
|
||||
focusedHeight = $focused.outerHeight();
|
||||
|
||||
if (list && list[0] && list[0].focused())
|
||||
{
|
||||
this.oContentScrollable.scrollTop(0);
|
||||
return true;
|
||||
}
|
||||
else if (pos && (pos.top < 0 || pos.top + focusedHeight > visibleHeight))
|
||||
else if (pos && (0 > pos.top || pos.top + focusedHeight > visibleHeight))
|
||||
{
|
||||
this.oContentScrollable.scrollTop(pos.top < 0 ?
|
||||
this.oContentScrollable.scrollTop(0 > pos.top ?
|
||||
this.oContentScrollable.scrollTop() + pos.top - offset :
|
||||
this.oContentScrollable.scrollTop() + pos.top - visibleHeight + focusedHeight + offset
|
||||
);
|
||||
|
|
@ -635,7 +633,7 @@ class Selector
|
|||
|
||||
/**
|
||||
* @param {boolean=} fast = false
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
scrollToTop(fast = false) {
|
||||
|
||||
|
|
@ -666,8 +664,7 @@ class Selector
|
|||
list = [],
|
||||
checked = false,
|
||||
listItem = null,
|
||||
lineUid = ''
|
||||
;
|
||||
lineUid = '';
|
||||
|
||||
const uid = this.getItemUid(item);
|
||||
if (event && event.shiftKey)
|
||||
|
|
|
|||
|
|
@ -88,14 +88,13 @@ export const trigger = ko.observable(false);
|
|||
* @param {string} key
|
||||
* @param {Object=} valueList
|
||||
* @param {string=} defaulValue
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function i18n(key, valueList, defaulValue)
|
||||
{
|
||||
let
|
||||
valueName = '',
|
||||
result = I18N_DATA[key]
|
||||
;
|
||||
result = I18N_DATA[key];
|
||||
|
||||
if (isUnd(result))
|
||||
{
|
||||
|
|
@ -120,8 +119,7 @@ const i18nToNode = (element) => {
|
|||
|
||||
const
|
||||
$el = $(element),
|
||||
key = $el.data('i18n')
|
||||
;
|
||||
key = $el.data('i18n');
|
||||
|
||||
if (key)
|
||||
{
|
||||
|
|
@ -138,6 +136,7 @@ const i18nToNode = (element) => {
|
|||
case '[title':
|
||||
$el.attr('title', i18n(key.substr(7)));
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -187,6 +186,9 @@ const reloadData = () => {
|
|||
window.rainloopI18N = null;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
export function initNotificationLanguage()
|
||||
{
|
||||
I18N_NOTIFICATION_MAP.forEach((item) => {
|
||||
|
|
@ -227,7 +229,7 @@ export function initOnStartOrLangChange(callback, scope, langCallback = null)
|
|||
* @param {number} code
|
||||
* @param {*=} message = ''
|
||||
* @param {*=} defCode = null
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getNotification(code, message = '', defCode = null)
|
||||
{
|
||||
|
|
@ -246,7 +248,7 @@ export function getNotification(code, message = '', defCode = null)
|
|||
/**
|
||||
* @param {object} response
|
||||
* @param {number} defCode = Notification.UnknownNotification
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getNotificationFromResponse(response, defCode = Notification.UnknownNotification)
|
||||
{
|
||||
|
|
@ -256,7 +258,7 @@ export function getNotificationFromResponse(response, defCode = Notification.Unk
|
|||
|
||||
/**
|
||||
* @param {*} code
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getUploadErrorDescByCode(code)
|
||||
{
|
||||
|
|
@ -314,9 +316,8 @@ export function reload(admin, language)
|
|||
$html
|
||||
.removeClass('rl-changing-language')
|
||||
.removeClass('rl-rtl rl-ltr')
|
||||
.addClass(isRtl ? 'rl-rtl' : 'rl-ltr')
|
||||
// .attr('dir', isRtl ? 'rtl' : 'ltr')
|
||||
;
|
||||
.addClass(isRtl ? 'rl-rtl' : 'rl-ltr');
|
||||
|
||||
resolve();
|
||||
|
||||
|
|
|
|||
|
|
@ -32,12 +32,13 @@ export function silentTryCatch(callback)
|
|||
{
|
||||
try {
|
||||
callback();
|
||||
} catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {*} value
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isNormal(value)
|
||||
{
|
||||
|
|
@ -47,7 +48,7 @@ export function isNormal(value)
|
|||
/**
|
||||
* @param {(string|number)} value
|
||||
* @param {boolean=} includeZero = true
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isPosNumeric(value, includeZero = true)
|
||||
{
|
||||
|
|
@ -58,7 +59,7 @@ export function isPosNumeric(value, includeZero = true)
|
|||
/**
|
||||
* @param {*} value
|
||||
* @param {number=} defaultValur = 0
|
||||
* @return {number}
|
||||
* @returns {number}
|
||||
*/
|
||||
export function pInt(value, defaultValur = 0)
|
||||
{
|
||||
|
|
@ -68,7 +69,7 @@ export function pInt(value, defaultValur = 0)
|
|||
|
||||
/**
|
||||
* @param {*} value
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function pString(value)
|
||||
{
|
||||
|
|
@ -77,7 +78,7 @@ export function pString(value)
|
|||
|
||||
/**
|
||||
* @param {*} value
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function pBool(value)
|
||||
{
|
||||
|
|
@ -86,7 +87,7 @@ export function pBool(value)
|
|||
|
||||
/**
|
||||
* @param {*} values
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isNonEmptyArray(values)
|
||||
{
|
||||
|
|
@ -95,7 +96,7 @@ export function isNonEmptyArray(values)
|
|||
|
||||
/**
|
||||
* @param {string} component
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function encodeURIComponent(component)
|
||||
{
|
||||
|
|
@ -104,7 +105,7 @@ export function encodeURIComponent(component)
|
|||
|
||||
/**
|
||||
* @param {string} component
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function decodeURIComponent(component)
|
||||
{
|
||||
|
|
@ -113,20 +114,17 @@ export function decodeURIComponent(component)
|
|||
|
||||
/**
|
||||
* @param {string} queryString
|
||||
* @return {Object}
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function simpleQueryParser(queryString)
|
||||
{
|
||||
let
|
||||
params = {},
|
||||
queries = [],
|
||||
temp = [],
|
||||
index = 0,
|
||||
len = 0
|
||||
;
|
||||
let index = 0, len = 0, temp = null;
|
||||
|
||||
queries = queryString.split('&');
|
||||
for (index = 0, len = queries.length; index < len; index++)
|
||||
const
|
||||
queries = queryString.split('&'),
|
||||
params = {};
|
||||
|
||||
for (len = queries.length; index < len; index++)
|
||||
{
|
||||
temp = queries[index].split('=');
|
||||
params[decodeURIComponent(temp[0])] = decodeURIComponent(temp[1]);
|
||||
|
|
@ -137,14 +135,13 @@ export function simpleQueryParser(queryString)
|
|||
|
||||
/**
|
||||
* @param {number=} len = 32
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function fakeMd5(len = 32)
|
||||
{
|
||||
const
|
||||
line = '0123456789abcdefghijklmnopqrstuvwxyz',
|
||||
lineLen = line.length
|
||||
;
|
||||
lineLen = line.length;
|
||||
|
||||
len = pInt(len);
|
||||
|
||||
|
|
@ -162,7 +159,7 @@ let encryptObject = null;
|
|||
/**
|
||||
* @param {constructor} JSEncryptClass
|
||||
* @param {string} publicKey
|
||||
* @return {JSEncrypt|boolean}
|
||||
* @returns {JSEncrypt|boolean}
|
||||
*/
|
||||
const rsaObject = (JSEncryptClass, publicKey) => {
|
||||
|
||||
|
|
@ -184,16 +181,14 @@ const rsaObject = (JSEncryptClass, publicKey) => {
|
|||
/**
|
||||
* @param {string} value
|
||||
* @param {string} publicKey
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
const rsaEncode = (value, publicKey) => {
|
||||
|
||||
if (window.crypto && window.crypto.getRandomValues && publicKey)
|
||||
{
|
||||
let
|
||||
resultValue = false,
|
||||
encrypt = rsaObject(JSEncrypt, publicKey)
|
||||
;
|
||||
let resultValue = false;
|
||||
const encrypt = rsaObject(JSEncrypt, publicKey);
|
||||
|
||||
if (encrypt)
|
||||
{
|
||||
|
|
@ -214,7 +209,7 @@ export {rsaEncode};
|
|||
|
||||
/**
|
||||
* @param {string} text
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function encodeHtml(text)
|
||||
{
|
||||
|
|
@ -224,7 +219,7 @@ export function encodeHtml(text)
|
|||
/**
|
||||
* @param {string} text
|
||||
* @param {number=} iLen = 100
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function splitPlainText(text, len = 100)
|
||||
{
|
||||
|
|
@ -233,8 +228,7 @@ export function splitPlainText(text, len = 100)
|
|||
subText = '',
|
||||
result = text,
|
||||
spacePos = 0,
|
||||
newLinePos = 0
|
||||
;
|
||||
newLinePos = 0;
|
||||
|
||||
while (result.length > len)
|
||||
{
|
||||
|
|
@ -259,8 +253,8 @@ export function splitPlainText(text, len = 100)
|
|||
return prefix + result;
|
||||
}
|
||||
|
||||
const timeOutAction = (function () {
|
||||
let timeOuts = {};
|
||||
const timeOutAction = (function() {
|
||||
const timeOuts = {};
|
||||
return (action, fFunction, timeOut) => {
|
||||
timeOuts[action] = isUnd(timeOuts[action]) ? 0 : timeOuts[action];
|
||||
window.clearTimeout(timeOuts[action]);
|
||||
|
|
@ -268,8 +262,8 @@ const timeOutAction = (function () {
|
|||
};
|
||||
}());
|
||||
|
||||
const timeOutActionSecond = (function () {
|
||||
let timeOuts = {};
|
||||
const timeOutActionSecond = (function() {
|
||||
const timeOuts = {};
|
||||
return (action, fFunction, timeOut) => {
|
||||
if (!timeOuts[action])
|
||||
{
|
||||
|
|
@ -284,7 +278,7 @@ const timeOutActionSecond = (function () {
|
|||
export {timeOutAction, timeOutActionSecond};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function inFocus()
|
||||
{
|
||||
|
|
@ -301,6 +295,10 @@ export function inFocus()
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} force
|
||||
* @returns {void}
|
||||
*/
|
||||
export function removeInFocus(force)
|
||||
{
|
||||
if (window.document && window.document.activeElement && window.document.activeElement.blur)
|
||||
|
|
@ -315,10 +313,14 @@ export function removeInFocus(force)
|
|||
{
|
||||
window.document.activeElement.blur();
|
||||
}
|
||||
} catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
export function removeSelection()
|
||||
{
|
||||
try {
|
||||
|
|
@ -334,41 +336,42 @@ export function removeSelection()
|
|||
{
|
||||
window.document.selection.empty();
|
||||
}
|
||||
} catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
catch (e) {/* eslint-disable-line no-empty */}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} prefix
|
||||
* @param {string} subject
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function replySubjectAdd(prefix, subject)
|
||||
{
|
||||
prefix = trim(prefix.toUpperCase());
|
||||
subject = trim(subject.replace(/[\s]+/g, ' '));
|
||||
|
||||
let
|
||||
drop = false,
|
||||
parts = [],
|
||||
let drop = false,
|
||||
re = 'RE' === prefix,
|
||||
fwd = 'FWD' === prefix,
|
||||
prefixIsRe = !fwd
|
||||
;
|
||||
fwd = 'FWD' === prefix;
|
||||
|
||||
const
|
||||
parts = [],
|
||||
prefixIsRe = !fwd;
|
||||
|
||||
if ('' !== subject)
|
||||
{
|
||||
_.each(subject.split(':'), (part) => {
|
||||
const trimmedPart = trim(part);
|
||||
if (!drop && (/^(RE|FWD)$/i.test(trimmedPart) || /^(RE|FWD)[\[\(][\d]+[\]\)]$/i.test(trimmedPart)))
|
||||
if (!drop && ((/^(RE|FWD)$/i).test(trimmedPart) || (/^(RE|FWD)[\[\(][\d]+[\]\)]$/i).test(trimmedPart)))
|
||||
{
|
||||
if (!re)
|
||||
{
|
||||
re = !!(/^RE/i.test(trimmedPart));
|
||||
re = !!(/^RE/i).test(trimmedPart);
|
||||
}
|
||||
|
||||
if (!fwd)
|
||||
{
|
||||
fwd = !!(/^FWD/i.test(trimmedPart));
|
||||
fwd = !!(/^FWD/i).test(trimmedPart);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -399,7 +402,7 @@ export function replySubjectAdd(prefix, subject)
|
|||
/**
|
||||
* @param {number} num
|
||||
* @param {number} dec
|
||||
* @return {number}
|
||||
* @returns {number}
|
||||
*/
|
||||
export function roundNumber(num, dec)
|
||||
{
|
||||
|
|
@ -408,23 +411,21 @@ export function roundNumber(num, dec)
|
|||
|
||||
/**
|
||||
* @param {(number|string)} sizeInBytes
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function friendlySize(sizeInBytes)
|
||||
{
|
||||
sizeInBytes = pInt(sizeInBytes);
|
||||
|
||||
if (sizeInBytes >= 1073741824)
|
||||
switch (true)
|
||||
{
|
||||
case 1073741824 <= sizeInBytes:
|
||||
return roundNumber(sizeInBytes / 1073741824, 1) + 'GB';
|
||||
}
|
||||
else if (sizeInBytes >= 1048576)
|
||||
{
|
||||
case 1048576 <= sizeInBytes:
|
||||
return roundNumber(sizeInBytes / 1048576, 1) + 'MB';
|
||||
}
|
||||
else if (sizeInBytes >= 1024)
|
||||
{
|
||||
case 1024 <= sizeInBytes:
|
||||
return roundNumber(sizeInBytes / 1024, 0) + 'KB';
|
||||
// no default
|
||||
}
|
||||
|
||||
return sizeInBytes + 'B';
|
||||
|
|
@ -506,21 +507,19 @@ export function kill_CtrlA_CtrlS(event)
|
|||
* @param {(Object|null|undefined)} context
|
||||
* @param {Function} fExecute
|
||||
* @param {(Function|boolean|null)=} fCanExecute = true
|
||||
* @return {Function}
|
||||
* @returns {Function}
|
||||
*/
|
||||
export function createCommand(context, fExecute, fCanExecute = true)
|
||||
{
|
||||
|
||||
let
|
||||
fResult = null,
|
||||
fNonEmpty = (...args) => {
|
||||
let fResult = null;
|
||||
const fNonEmpty = (...args) => {
|
||||
if (fResult && fResult.canExecute && fResult.canExecute())
|
||||
{
|
||||
fExecute.apply(context, args);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
fResult = fExecute ? fNonEmpty : noop;
|
||||
fResult.enabled = ko.observable(true);
|
||||
|
|
@ -543,7 +542,7 @@ export function createCommand(context, fExecute, fCanExecute = true)
|
|||
|
||||
/**
|
||||
* @param {string} theme
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export const convertThemeName = _.memoize((theme) => {
|
||||
|
||||
|
|
@ -557,7 +556,7 @@ export const convertThemeName = _.memoize((theme) => {
|
|||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function quoteName(name)
|
||||
{
|
||||
|
|
@ -565,7 +564,7 @@ export function quoteName(name)
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
* @returns {number}
|
||||
*/
|
||||
export function microtime()
|
||||
{
|
||||
|
|
@ -573,7 +572,7 @@ export function microtime()
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
* @returns {number}
|
||||
*/
|
||||
export function timestamp()
|
||||
{
|
||||
|
|
@ -584,7 +583,7 @@ export function timestamp()
|
|||
*
|
||||
* @param {string} language
|
||||
* @param {boolean=} isEng = false
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function convertLangName(language, isEng = false)
|
||||
{
|
||||
|
|
@ -592,6 +591,9 @@ export function convertLangName(language, isEng = false)
|
|||
language.toUpperCase().replace(/[^a-zA-Z0-9]+/g, '_'), null, language);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {object}
|
||||
*/
|
||||
export function draggablePlace()
|
||||
{
|
||||
return $('<div class="draggablePlace">' +
|
||||
|
|
@ -602,14 +604,18 @@ export function draggablePlace()
|
|||
).appendTo('#rl-hidden');
|
||||
}
|
||||
|
||||
export function defautOptionsAfterRender(domOption, item)
|
||||
/**
|
||||
* @param {object} domOption
|
||||
* @param {object} item
|
||||
* @returns {void}
|
||||
*/
|
||||
export function defautOptionsAfterRender(domItem, item)
|
||||
{
|
||||
if (item && !isUnd(item.disabled) && domOption)
|
||||
if (item && !isUnd(item.disabled) && domItem)
|
||||
{
|
||||
$(domOption)
|
||||
$(domItem)
|
||||
.toggleClass('disabled', item.disabled)
|
||||
.prop('disabled', item.disabled)
|
||||
;
|
||||
.prop('disabled', item.disabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -638,8 +644,7 @@ export function previewMessage(title, body, isHtml, print)
|
|||
win = window.open(''),
|
||||
doc = win.document,
|
||||
bodyClone = body.clone(),
|
||||
bodyClass = isHtml ? 'html' : 'plain'
|
||||
;
|
||||
bodyClass = isHtml ? 'html' : 'plain';
|
||||
|
||||
clearBqSwitcher(bodyClone);
|
||||
|
||||
|
|
@ -734,7 +739,7 @@ body.plain blockquote blockquote blockquote {
|
|||
* @param {?} koTrigger
|
||||
* @param {?} context = null
|
||||
* @param {number=} timer = 1000
|
||||
* @return {Function}
|
||||
* @returns {Function}
|
||||
*/
|
||||
export function settingsSaveHelperFunction(fCallback, koTrigger, context = null, timer = 1000)
|
||||
{
|
||||
|
|
@ -751,11 +756,23 @@ export function settingsSaveHelperFunction(fCallback, koTrigger, context = null,
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} koTrigger
|
||||
* @param {mixed} context
|
||||
* @returns {mixed}
|
||||
*/
|
||||
export function settingsSaveHelperSimpleFunction(koTrigger, context)
|
||||
{
|
||||
return settingsSaveHelperFunction(null, koTrigger, context, 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} remote
|
||||
* @param {string} settingName
|
||||
* @param {string} type
|
||||
* @param {function} fTriggerFunction
|
||||
* @returns {function}
|
||||
*/
|
||||
export function settingsSaveHelperSubscribeFunction(remote, settingName, type, fTriggerFunction)
|
||||
{
|
||||
return (value) => {
|
||||
|
|
@ -764,9 +781,6 @@ export function settingsSaveHelperSubscribeFunction(remote, settingName, type, f
|
|||
{
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
value = pString(value);
|
||||
break;
|
||||
case 'bool':
|
||||
case 'boolean':
|
||||
value = value ? '1' : '0';
|
||||
|
|
@ -779,9 +793,12 @@ export function settingsSaveHelperSubscribeFunction(remote, settingName, type, f
|
|||
case 'trim':
|
||||
value = trim(value);
|
||||
break;
|
||||
default:
|
||||
value = pString(value);
|
||||
break;
|
||||
}
|
||||
|
||||
let data = {};
|
||||
const data = {};
|
||||
data[settingName] = value;
|
||||
|
||||
if (remote.saveAdminConfig)
|
||||
|
|
@ -798,7 +815,7 @@ export function settingsSaveHelperSubscribeFunction(remote, settingName, type, f
|
|||
|
||||
/**
|
||||
* @param {string} html
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function findEmailAndLinks(html)
|
||||
{
|
||||
|
|
@ -809,7 +826,7 @@ export function findEmailAndLinks(html)
|
|||
urls: true,
|
||||
email: true,
|
||||
twitter: false,
|
||||
replaceFn: function (autolinker, match) {
|
||||
replaceFn: function(autolinker, match) {
|
||||
return !(autolinker && match && 'url' === match.getType() && match.matchedText && 0 !== match.matchedText.indexOf('http'));
|
||||
}
|
||||
});
|
||||
|
|
@ -817,7 +834,7 @@ export function findEmailAndLinks(html)
|
|||
|
||||
/**
|
||||
* @param {string} html
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function htmlToPlain(html)
|
||||
{
|
||||
|
|
@ -828,8 +845,7 @@ export function htmlToPlain(html)
|
|||
iP2 = 0,
|
||||
iP3 = 0,
|
||||
|
||||
text = ''
|
||||
;
|
||||
text = '';
|
||||
|
||||
const
|
||||
|
||||
|
|
@ -867,8 +883,7 @@ export function htmlToPlain(html)
|
|||
|
||||
convertLinks = (...args) => {
|
||||
return (args && 1 < args.length) ? trim(args[1]) : '';
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
text = html
|
||||
.replace(/\u0002([\s\S]*)\u0002/gm, '\u200C$1\u200C')
|
||||
|
|
@ -893,8 +908,7 @@ export function htmlToPlain(html)
|
|||
.replace(/<\/div>/gi, '\n')
|
||||
.replace(/ /gi, ' ')
|
||||
.replace(/"/gi, '"')
|
||||
.replace(/<[^>]*>/gm, '')
|
||||
;
|
||||
.replace(/<[^>]*>/gm, '');
|
||||
|
||||
text = $div.html(text).text();
|
||||
|
||||
|
|
@ -903,8 +917,7 @@ export function htmlToPlain(html)
|
|||
.replace(/[\n]{3,}/gm, '\n\n')
|
||||
.replace(/>/gi, '>')
|
||||
.replace(/</gi, '<')
|
||||
.replace(/&/gi, '&')
|
||||
;
|
||||
.replace(/&/gi, '&');
|
||||
|
||||
text = splitPlainText(trim(text));
|
||||
|
||||
|
|
@ -913,7 +926,7 @@ export function htmlToPlain(html)
|
|||
|
||||
while (0 < limit)
|
||||
{
|
||||
limit--;
|
||||
limit -= 1;
|
||||
iP1 = text.indexOf('__bq__start__', pos);
|
||||
if (-1 < iP1)
|
||||
{
|
||||
|
|
@ -945,8 +958,7 @@ export function htmlToPlain(html)
|
|||
|
||||
text = text
|
||||
.replace(/__bq__start__/gm, '')
|
||||
.replace(/__bq__end__/gm, '')
|
||||
;
|
||||
.replace(/__bq__end__/gm, '');
|
||||
|
||||
return text;
|
||||
}
|
||||
|
|
@ -954,7 +966,7 @@ export function htmlToPlain(html)
|
|||
/**
|
||||
* @param {string} plain
|
||||
* @param {boolean} findEmailAndLinksInText = false
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function plainToHtml(plain, findEmailAndLinksInText = false)
|
||||
{
|
||||
|
|
@ -971,8 +983,7 @@ export function plainToHtml(plain, findEmailAndLinksInText = false)
|
|||
aNextText = [],
|
||||
sLine = '',
|
||||
iIndex = 0,
|
||||
aText = plain.split('\n')
|
||||
;
|
||||
aText = plain.split('\n');
|
||||
|
||||
do
|
||||
{
|
||||
|
|
@ -1031,8 +1042,7 @@ export function plainToHtml(plain, findEmailAndLinksInText = false)
|
|||
.replace(/~~~blockquote~~~[\s]*/g, '<blockquote>')
|
||||
.replace(/[\s]*~~~\/blockquote~~~/g, '</blockquote>')
|
||||
.replace(/\u200C([\s\S]*)\u200C/g, '\u0002$1\u0002')
|
||||
.replace(/\n/g, '<br />')
|
||||
;
|
||||
.replace(/\n/g, '<br />');
|
||||
|
||||
return findEmailAndLinksInText ? findEmailAndLinks(plain) : plain;
|
||||
}
|
||||
|
|
@ -1051,7 +1061,7 @@ window.rainloop_Utils_plainToHtml = plainToHtml;
|
|||
* @param {Function=} fRenameCallback
|
||||
* @param {boolean=} bSystem
|
||||
* @param {boolean=} bBuildUnvisible
|
||||
* @return {Array}
|
||||
* @returns {Array}
|
||||
*/
|
||||
export function folderListOptionsBuilder(aSystem, aList, aDisabled, aHeaderLines,
|
||||
iUnDeep, fDisableCallback, fVisibleCallback, fRenameCallback, bSystem, bBuildUnvisible)
|
||||
|
|
@ -1064,9 +1074,9 @@ export function folderListOptionsBuilder(aSystem, aList, aDisabled, aHeaderLines
|
|||
bSep = false,
|
||||
iIndex = 0,
|
||||
iLen = 0,
|
||||
sDeepPrefix = '\u00A0\u00A0\u00A0',
|
||||
aResult = []
|
||||
;
|
||||
aResult = [];
|
||||
|
||||
const sDeepPrefix = '\u00A0\u00A0\u00A0';
|
||||
|
||||
bBuildUnvisible = isUnd(bBuildUnvisible) ? false : !!bBuildUnvisible;
|
||||
bSystem = !isNormal(bSystem) ? 0 < aSystem.length : bSystem;
|
||||
|
|
@ -1171,6 +1181,10 @@ export function folderListOptionsBuilder(aSystem, aList, aDisabled, aHeaderLines
|
|||
return aResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} element
|
||||
* @returns {void}
|
||||
*/
|
||||
export function selectElement(element)
|
||||
{
|
||||
let sel, range;
|
||||
|
|
@ -1215,26 +1229,26 @@ export function triggerAutocompleteInputChange(delay = false) {
|
|||
}
|
||||
}
|
||||
|
||||
let configurationScriptTagCache = {};
|
||||
const configurationScriptTagCache = {};
|
||||
|
||||
/**
|
||||
* @param {string} configuration
|
||||
* @return {object}
|
||||
* @returns {object}
|
||||
*/
|
||||
export function getConfigurationFromScriptTag(configuration)
|
||||
{
|
||||
let result = {};
|
||||
|
||||
if (!configurationScriptTagCache[configuration])
|
||||
{
|
||||
configurationScriptTagCache[configuration] = $('script[type="application/json"][data-configuration="' + configuration + '"]');
|
||||
}
|
||||
|
||||
try {
|
||||
result = JSON.parse(configurationScriptTagCache[configuration].text());
|
||||
} catch (e) {/* eslint-disable-line no-empty */}
|
||||
try
|
||||
{
|
||||
return JSON.parse(configurationScriptTagCache[configuration].text());
|
||||
}
|
||||
catch (e) {/* eslint-disable-line no-empty */}
|
||||
|
||||
return result;
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1244,7 +1258,7 @@ export function getConfigurationFromScriptTag(configuration)
|
|||
export function disposeOne(propOrValue, value)
|
||||
{
|
||||
const disposable = value || propOrValue;
|
||||
if (disposable && typeof disposable.dispose === 'function')
|
||||
if (disposable && 'function' === typeof disposable.dispose)
|
||||
{
|
||||
disposable.dispose();
|
||||
}
|
||||
|
|
@ -1268,6 +1282,7 @@ export function disposeObject(object)
|
|||
|
||||
/**
|
||||
* @param {Object|Array} objectOrObjects
|
||||
* @returns {void}
|
||||
*/
|
||||
export function delegateRunOnDestroy(objectOrObjects)
|
||||
{
|
||||
|
|
@ -1286,6 +1301,11 @@ export function delegateRunOnDestroy(objectOrObjects)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} $styleTag
|
||||
* @param {string} css
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function appendStyles($styleTag, css)
|
||||
{
|
||||
if ($styleTag && $styleTag[0])
|
||||
|
|
@ -1307,20 +1327,25 @@ export function appendStyles($styleTag, css)
|
|||
|
||||
let
|
||||
__themeTimer = 0,
|
||||
__themeAjax = null
|
||||
;
|
||||
__themeAjax = null;
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {function} themeTrigger
|
||||
* @returns {void}
|
||||
*/
|
||||
export function changeTheme(value, themeTrigger)
|
||||
{
|
||||
let
|
||||
const
|
||||
themeLink = $('#app-theme-link'),
|
||||
themeStyle = $('#app-theme-style'),
|
||||
url = themeLink.attr('href'),
|
||||
clearTimer = () => {
|
||||
__themeTimer = window.setTimeout(() => themeTrigger(SaveSettingsStep.Idle), 1000);
|
||||
__themeAjax = null;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
let
|
||||
themeStyle = $('#app-theme-style'),
|
||||
url = themeLink.attr('href');
|
||||
|
||||
if (!url)
|
||||
{
|
||||
|
|
@ -1375,6 +1400,9 @@ export function changeTheme(value, themeTrigger)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {function}
|
||||
*/
|
||||
export function computedPagenatorHelper(koCurrentPage, koPageCount)
|
||||
{
|
||||
return () => {
|
||||
|
|
@ -1388,7 +1416,7 @@ export function computedPagenatorHelper(koCurrentPage, koPageCount)
|
|||
const data = {
|
||||
current: index === currentPage,
|
||||
name: '' === customName ? index.toString() : customName.toString(),
|
||||
custom: '' === customName ? false : true,
|
||||
custom: '' !== customName,
|
||||
title: '' === customName ? '' : index.toString(),
|
||||
value: index.toString()
|
||||
};
|
||||
|
|
@ -1401,14 +1429,12 @@ export function computedPagenatorHelper(koCurrentPage, koPageCount)
|
|||
{
|
||||
result.unshift(data);
|
||||
}
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
let
|
||||
prev = 0,
|
||||
next = 0,
|
||||
limit = 2
|
||||
;
|
||||
limit = 2;
|
||||
|
||||
if (1 < pageCount || (0 < pageCount && pageCount < currentPage))
|
||||
{
|
||||
|
|
@ -1438,13 +1464,13 @@ export function computedPagenatorHelper(koCurrentPage, koPageCount)
|
|||
if (0 < prev)
|
||||
{
|
||||
fAdd(prev, false);
|
||||
limit--;
|
||||
limit -= 1;
|
||||
}
|
||||
|
||||
if (pageCount >= next)
|
||||
{
|
||||
fAdd(next, true);
|
||||
limit--;
|
||||
limit -= 1;
|
||||
}
|
||||
else if (0 >= prev)
|
||||
{
|
||||
|
|
@ -1488,7 +1514,7 @@ export function computedPagenatorHelper(koCurrentPage, koPageCount)
|
|||
|
||||
/**
|
||||
* @param {string} fileName
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getFileExtension(fileName)
|
||||
{
|
||||
|
|
@ -1500,14 +1526,13 @@ export function getFileExtension(fileName)
|
|||
|
||||
/**
|
||||
* @param {string} fileName
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function mimeContentType(fileName)
|
||||
{
|
||||
let
|
||||
ext = '',
|
||||
result = 'application/octet-stream'
|
||||
;
|
||||
result = 'application/octet-stream';
|
||||
|
||||
fileName = trim(fileName).toLowerCase();
|
||||
|
||||
|
|
@ -1536,13 +1561,11 @@ export function resizeAndCrop(url, value, fCallback)
|
|||
img.onload = function() {
|
||||
|
||||
let
|
||||
diff = [0, 0]
|
||||
;
|
||||
diff = [0, 0];
|
||||
|
||||
const
|
||||
canvas = window.document.createElement('canvas'),
|
||||
ctx = canvas.getContext('2d')
|
||||
;
|
||||
ctx = canvas.getContext('2d');
|
||||
|
||||
canvas.width = value;
|
||||
canvas.height = value;
|
||||
|
|
@ -1569,7 +1592,7 @@ export function resizeAndCrop(url, value, fCallback)
|
|||
/**
|
||||
* @param {string} mailToUrl
|
||||
* @param {Function} PopupComposeVoreModel
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function mailToHelper(mailToUrl, PopupComposeVoreModel)
|
||||
{
|
||||
|
|
@ -1586,22 +1609,22 @@ export function mailToHelper(mailToUrl, PopupComposeVoreModel)
|
|||
to = [],
|
||||
cc = null,
|
||||
bcc = null,
|
||||
params = {},
|
||||
EmailModel = require('Model/Email'),
|
||||
params = {};
|
||||
|
||||
const
|
||||
email = mailToUrl.replace(/\?.+$/, ''),
|
||||
queryString = mailToUrl.replace(/^[^\?]*\?/, ''),
|
||||
query = mailToUrl.replace(/^[^\?]*\?/, ''),
|
||||
EmailModel = require('Model/Email'),
|
||||
fParseEmailLine = (line) => {
|
||||
return line ? _.compact(_.map(decodeURIComponent(line).split(/[,]/), (item) => {
|
||||
const emailObj = new EmailModel();
|
||||
emailObj.mailsoParse(item);
|
||||
return '' !== emailObj.email ? emailObj : null;
|
||||
})) : null;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
to = fParseEmailLine(email);
|
||||
|
||||
params = simpleQueryParser(queryString);
|
||||
params = simpleQueryParser(query);
|
||||
|
||||
if (!isUnd(params.cc))
|
||||
{
|
||||
|
|
@ -1638,16 +1661,19 @@ export const windowResize = _.debounce((timeout) => {
|
|||
}
|
||||
}, 50);
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
export function windowResizeCallback()
|
||||
{
|
||||
windowResize();
|
||||
}
|
||||
|
||||
let substr = window.String.substr;
|
||||
if ('ab'.substr(-1) !== 'b')
|
||||
if ('b' !== 'ab'.substr(-1))
|
||||
{
|
||||
substr = (str, start, length) => {
|
||||
start = start < 0 ? str.length + start : start;
|
||||
start = 0 > start ? str.length + start : start;
|
||||
return str.substr(start, length);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {AbstractComponent} from 'Component/Abstract';
|
|||
class AbstracCheckbox extends AbstractComponent
|
||||
{
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} params = {}
|
||||
*/
|
||||
constructor(params = {}) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import {AbstractComponent} from 'Component/Abstract';
|
|||
class AbstracRadio extends AbstractComponent
|
||||
{
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} params
|
||||
*/
|
||||
constructor(params) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class AbstractComponent
|
|||
/**
|
||||
* @param {*} ClassObject
|
||||
* @param {string} templateID = ''
|
||||
* @return {Object}
|
||||
* @returns {Object}
|
||||
*/
|
||||
const componentExportHelper = (ClassObject, templateID = '') => {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import {AbstractComponent} from 'Component/Abstract';
|
|||
class AbstractInput extends AbstractComponent
|
||||
{
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} params
|
||||
*/
|
||||
constructor(params) {
|
||||
|
|
@ -32,10 +33,9 @@ class AbstractInput extends AbstractComponent
|
|||
var
|
||||
size = ko.unwrap(this.size),
|
||||
suffixValue = this.trigger ?
|
||||
' ' + trim('settings-saved-trigger-input ' + this.classForTrigger()) : ''
|
||||
;
|
||||
' ' + trim('settings-saved-trigger-input ' + this.classForTrigger()) : '';
|
||||
|
||||
return (size > 0 ? 'span' + size : '') + suffixValue;
|
||||
return (0 < size ? 'span' + size : '') + suffixValue;
|
||||
|
||||
}, this);
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import {AbstracCheckbox} from 'Component/AbstracCheckbox';
|
|||
class CheckboxMaterialDesignComponent extends AbstracCheckbox
|
||||
{
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} params
|
||||
*/
|
||||
constructor(params) {
|
||||
|
|
@ -38,7 +39,8 @@ class CheckboxMaterialDesignComponent extends AbstracCheckbox
|
|||
if (box) {
|
||||
this.animationBoxSetTrue();
|
||||
_.delay(this.animationCheckmarkSetTrue, 200);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.animationCheckmarkSetTrue();
|
||||
_.delay(this.animationBoxSetTrue, 200);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {AbstractComponent, componentExportHelper} from 'Component/Abstract';
|
|||
class SaveTriggerComponent extends AbstractComponent
|
||||
{
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} params
|
||||
*/
|
||||
constructor(params) {
|
||||
|
|
@ -47,30 +48,26 @@ class SaveTriggerComponent extends AbstractComponent
|
|||
this.element
|
||||
.find('.animated,.error').hide().removeClass('visible')
|
||||
.end()
|
||||
.find('.success').show().addClass('visible')
|
||||
;
|
||||
.find('.success').show().addClass('visible');
|
||||
break;
|
||||
case SaveSettingsStep.FalseResult:
|
||||
this.element
|
||||
.find('.animated,.success').hide().removeClass('visible')
|
||||
.end()
|
||||
.find('.error').show().addClass('visible')
|
||||
;
|
||||
.find('.error').show().addClass('visible');
|
||||
break;
|
||||
case SaveSettingsStep.Animate:
|
||||
this.element
|
||||
.find('.error,.success').hide().removeClass('visible')
|
||||
.end()
|
||||
.find('.animated').show().addClass('visible')
|
||||
;
|
||||
.find('.animated').show().addClass('visible');
|
||||
break;
|
||||
default:
|
||||
case SaveSettingsStep.Idle:
|
||||
default:
|
||||
this.element
|
||||
.find('.animated').hide()
|
||||
.end()
|
||||
.find('.error,.success').removeClass('visible')
|
||||
;
|
||||
.find('.error,.success').removeClass('visible');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {AbstractComponent, componentExportHelper} from 'Component/Abstract';
|
|||
class ScriptComponent extends AbstractComponent
|
||||
{
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} params
|
||||
*/
|
||||
constructor(params) {
|
||||
|
|
@ -17,8 +18,7 @@ class ScriptComponent extends AbstractComponent
|
|||
let script = params.element[0].outerHTML;
|
||||
script = !script ? '' : script
|
||||
.replace(/<x-script/i, '<script')
|
||||
.replace(/<b><\/b><\/x-script>/i, '</script>')
|
||||
;
|
||||
.replace(/<b><\/b><\/x-script>/i, '</script>');
|
||||
|
||||
if (script)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import {AbstractInput} from 'Component/AbstractInput';
|
|||
class SelectComponent extends AbstractInput
|
||||
{
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} params
|
||||
*/
|
||||
constructor(params) {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
|
||||
import {$} from 'common';
|
||||
|
||||
let
|
||||
cachedUrl = null,
|
||||
getUtl = () => {
|
||||
let cachedUrl = null;
|
||||
const getUrl = () => {
|
||||
if (!cachedUrl)
|
||||
{
|
||||
const version = $('#rlAppVersion').attr('content') || '0.0.0';
|
||||
|
|
@ -11,18 +10,16 @@ let
|
|||
}
|
||||
|
||||
return cachedUrl;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
template: '<b></b>',
|
||||
viewModel: {
|
||||
createViewModel: (params, componentInfo) => {
|
||||
createViewModel: ({icon = 'null'}, componentInfo) => {
|
||||
if (componentInfo && componentInfo.element)
|
||||
{
|
||||
const icon = params.icon || 'null';
|
||||
$(componentInfo.element).replaceWith(
|
||||
`<svg class="svg-icon svg-icon-${icon}"><use xlink:href="${getUtl()}#svg-icon-${icon}"></use></svg>`
|
||||
`<svg class="svg-icon svg-icon-${icon}"><use xlink:href="${getUrl()}#svg-icon-${icon}"></use></svg>`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {AbstractInput} from 'Component/AbstractInput';
|
|||
class TextAreaComponent extends AbstractInput
|
||||
{
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} params
|
||||
*/
|
||||
constructor(params) {
|
||||
|
|
|
|||
25
dev/External/Opentip.js
vendored
25
dev/External/Opentip.js
vendored
|
|
@ -1,14 +1,9 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
window = require('window'),
|
||||
Opentip = window.Opentip
|
||||
;
|
||||
Opentip = window.Opentip;
|
||||
|
||||
Opentip.styles.rainloop = {
|
||||
Opentip.styles.rainloop = {
|
||||
|
||||
'extends': 'standard',
|
||||
|
||||
|
|
@ -33,19 +28,17 @@
|
|||
'borderColor': '#999',
|
||||
'borderRadius': 2,
|
||||
'borderWidth': 1
|
||||
};
|
||||
};
|
||||
|
||||
Opentip.styles.rainloopTip = {
|
||||
Opentip.styles.rainloopTip = {
|
||||
'extends': 'rainloop',
|
||||
'delay': 0.4,
|
||||
'group': 'rainloopTips'
|
||||
};
|
||||
};
|
||||
|
||||
Opentip.styles.rainloopErrorTip = {
|
||||
Opentip.styles.rainloopErrorTip = {
|
||||
'extends': 'rainloop',
|
||||
'className': 'rainloopErrorTip'
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = Opentip;
|
||||
|
||||
}());
|
||||
module.exports = Opentip;
|
||||
|
|
|
|||
573
dev/External/ko.js
vendored
573
dev/External/ko.js
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -4,25 +4,25 @@ import EmailModel from 'Model/Email';
|
|||
|
||||
class MessageHelper
|
||||
{
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
constructor() {}
|
||||
|
||||
/**
|
||||
* @param {Array.<EmailModel>} emails
|
||||
* @param {boolean=} friendlyView = false
|
||||
* @param {boolean=} wrapWithLink = false
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
emailArrayToString(emails, friendlyView = false, wrapWithLink = false) {
|
||||
|
||||
let
|
||||
result = [],
|
||||
index = 0,
|
||||
len = 0
|
||||
;
|
||||
let index = 0, len = 0;
|
||||
const result = [];
|
||||
|
||||
if (isNonEmptyArray(emails))
|
||||
{
|
||||
for (index = 0, len = emails.length; index < len; index++)
|
||||
for (len = emails.length; index < len; index++)
|
||||
{
|
||||
result.push(emails[index].toLine(friendlyView, wrapWithLink));
|
||||
}
|
||||
|
|
@ -33,19 +33,16 @@ class MessageHelper
|
|||
|
||||
/**
|
||||
* @param {Array.<EmailModel>} emails
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
emailArrayToStringClear(emails) {
|
||||
|
||||
let
|
||||
result = [],
|
||||
index = 0,
|
||||
len = 0
|
||||
;
|
||||
let index = 0, len = 0;
|
||||
const result = [];
|
||||
|
||||
if (isNonEmptyArray(emails))
|
||||
{
|
||||
for (index = 0, len = emails.length; index < len; index++)
|
||||
for (len = emails.length; index < len; index++)
|
||||
{
|
||||
if (emails[index] && emails[index].email && '' !== emails[index].name)
|
||||
{
|
||||
|
|
@ -59,16 +56,12 @@ class MessageHelper
|
|||
|
||||
/**
|
||||
* @param {?Array} json
|
||||
* @return {Array.<EmailModel>}
|
||||
* @returns {Array.<EmailModel>}
|
||||
*/
|
||||
emailArrayFromJson(json) {
|
||||
|
||||
let
|
||||
index = 0,
|
||||
len = 0,
|
||||
email = null,
|
||||
result = []
|
||||
;
|
||||
let index = 0, len = 0, email = null;
|
||||
const result = [];
|
||||
|
||||
if (isNonEmptyArray(json))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,33 +1,28 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
Utils = require('Common/Utils')
|
||||
;
|
||||
Utils = require('Common/Utils');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {string} sModelName
|
||||
*/
|
||||
function AbstractModel(sModelName)
|
||||
{
|
||||
function AbstractModel(sModelName)
|
||||
{
|
||||
this.sModelName = sModelName || '';
|
||||
this.disposables = [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Array|Object} mInputValue
|
||||
*/
|
||||
AbstractModel.prototype.regDisposables = function (mInputValue)
|
||||
{
|
||||
AbstractModel.prototype.regDisposables = function(mInputValue)
|
||||
{
|
||||
if (Utils.isArray(mInputValue))
|
||||
{
|
||||
_.each(mInputValue, function (mValue) {
|
||||
_.each(mInputValue, function(mValue) {
|
||||
this.disposables.push(mValue);
|
||||
}, this);
|
||||
}
|
||||
|
|
@ -36,13 +31,11 @@
|
|||
this.disposables.push(mInputValue);
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
AbstractModel.prototype.onDestroy = function ()
|
||||
{
|
||||
AbstractModel.prototype.onDestroy = function()
|
||||
{
|
||||
Utils.disposeObject(this);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = AbstractModel;
|
||||
|
||||
}());
|
||||
module.exports = AbstractModel;
|
||||
|
|
|
|||
|
|
@ -1,91 +1,83 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
crossroads = require('crossroads'),
|
||||
|
||||
Utils = require('Common/Utils')
|
||||
;
|
||||
Utils = require('Common/Utils');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {string} sScreenName
|
||||
* @param {?=} aViewModels = []
|
||||
* @constructor
|
||||
*/
|
||||
function AbstractScreen(sScreenName, aViewModels)
|
||||
{
|
||||
function AbstractScreen(sScreenName, aViewModels)
|
||||
{
|
||||
this.sScreenName = sScreenName;
|
||||
this.aViewModels = Utils.isArray(aViewModels) ? aViewModels : [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {Array}
|
||||
*/
|
||||
AbstractScreen.prototype.oCross = null;
|
||||
AbstractScreen.prototype.oCross = null;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
AbstractScreen.prototype.sScreenName = '';
|
||||
AbstractScreen.prototype.sScreenName = '';
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {Array}
|
||||
*/
|
||||
AbstractScreen.prototype.aViewModels = [];
|
||||
AbstractScreen.prototype.aViewModels = [];
|
||||
|
||||
/**
|
||||
* @return {Array}
|
||||
/**
|
||||
* @returns {Array}
|
||||
*/
|
||||
AbstractScreen.prototype.viewModels = function ()
|
||||
{
|
||||
AbstractScreen.prototype.viewModels = function()
|
||||
{
|
||||
return this.aViewModels;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
AbstractScreen.prototype.screenName = function ()
|
||||
{
|
||||
AbstractScreen.prototype.screenName = function()
|
||||
{
|
||||
return this.sScreenName;
|
||||
};
|
||||
};
|
||||
|
||||
AbstractScreen.prototype.routes = function ()
|
||||
{
|
||||
AbstractScreen.prototype.routes = function()
|
||||
{
|
||||
return null;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {?Object}
|
||||
/**
|
||||
* @returns {?Object}
|
||||
*/
|
||||
AbstractScreen.prototype.__cross = function ()
|
||||
{
|
||||
AbstractScreen.prototype.__cross = function()
|
||||
{
|
||||
return this.oCross;
|
||||
};
|
||||
};
|
||||
|
||||
AbstractScreen.prototype.__start = function ()
|
||||
{
|
||||
AbstractScreen.prototype.__start = function()
|
||||
{
|
||||
var
|
||||
aRoutes = this.routes(),
|
||||
oRoute = null,
|
||||
fMatcher = null
|
||||
;
|
||||
fMatcher = null;
|
||||
|
||||
if (Utils.isNonEmptyArray(aRoutes))
|
||||
{
|
||||
fMatcher = _.bind(this.onRoute || Utils.noop, this);
|
||||
oRoute = crossroads.create();
|
||||
|
||||
_.each(aRoutes, function (aItem) {
|
||||
_.each(aRoutes, function(aItem) {
|
||||
oRoute.addRoute(aItem[0], fMatcher).rules = aItem[1];
|
||||
});
|
||||
|
||||
this.oCross = oRoute;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = AbstractScreen;
|
||||
|
||||
}());
|
||||
module.exports = AbstractScreen;
|
||||
|
|
|
|||
|
|
@ -1,23 +1,18 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
ko = require('ko'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Globals = require('Common/Globals')
|
||||
;
|
||||
Globals = require('Common/Globals');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
* @param {string=} sPosition = ''
|
||||
* @param {string=} sTemplate = ''
|
||||
*/
|
||||
function AbstractView(sPosition, sTemplate)
|
||||
{
|
||||
function AbstractView(sPosition, sTemplate)
|
||||
{
|
||||
this.bDisabeCloseOnEsc = false;
|
||||
this.sPosition = Utils.pString(sPosition);
|
||||
this.sTemplate = Utils.pString(sTemplate);
|
||||
|
|
@ -31,83 +26,83 @@
|
|||
this.viewModelName = '';
|
||||
this.viewModelNames = [];
|
||||
this.viewModelDom = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
AbstractView.prototype.bDisabeCloseOnEsc = false;
|
||||
AbstractView.prototype.bDisabeCloseOnEsc = false;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
AbstractView.prototype.sPosition = '';
|
||||
AbstractView.prototype.sPosition = '';
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
AbstractView.prototype.sTemplate = '';
|
||||
AbstractView.prototype.sTemplate = '';
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
AbstractView.prototype.sDefaultKeyScope = Enums.KeyState.None;
|
||||
AbstractView.prototype.sDefaultKeyScope = Enums.KeyState.None;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
AbstractView.prototype.sCurrentKeyScope = Enums.KeyState.None;
|
||||
AbstractView.prototype.sCurrentKeyScope = Enums.KeyState.None;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
AbstractView.prototype.viewModelName = '';
|
||||
AbstractView.prototype.viewModelName = '';
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {Array}
|
||||
*/
|
||||
AbstractView.prototype.viewModelNames = [];
|
||||
AbstractView.prototype.viewModelNames = [];
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
AbstractView.prototype.viewModelDom = null;
|
||||
AbstractView.prototype.viewModelDom = null;
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
AbstractView.prototype.viewModelTemplate = function ()
|
||||
{
|
||||
AbstractView.prototype.viewModelTemplate = function()
|
||||
{
|
||||
return this.sTemplate;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
AbstractView.prototype.viewModelPosition = function ()
|
||||
{
|
||||
AbstractView.prototype.viewModelPosition = function()
|
||||
{
|
||||
return this.sPosition;
|
||||
};
|
||||
};
|
||||
|
||||
AbstractView.prototype.cancelCommand = function () {};
|
||||
AbstractView.prototype.closeCommand = function () {};
|
||||
AbstractView.prototype.cancelCommand = function() {};
|
||||
AbstractView.prototype.closeCommand = function() {};
|
||||
|
||||
AbstractView.prototype.storeAndSetKeyScope = function ()
|
||||
{
|
||||
AbstractView.prototype.storeAndSetKeyScope = function()
|
||||
{
|
||||
this.sCurrentKeyScope = Globals.keyScope();
|
||||
Globals.keyScope(this.sDefaultKeyScope);
|
||||
};
|
||||
};
|
||||
|
||||
AbstractView.prototype.restoreKeyScope = function ()
|
||||
{
|
||||
AbstractView.prototype.restoreKeyScope = function()
|
||||
{
|
||||
Globals.keyScope(this.sCurrentKeyScope);
|
||||
};
|
||||
};
|
||||
|
||||
AbstractView.prototype.registerPopupKeyDown = function ()
|
||||
{
|
||||
AbstractView.prototype.registerPopupKeyDown = function()
|
||||
{
|
||||
var self = this;
|
||||
|
||||
Globals.$win.on('keydown', function (oEvent) {
|
||||
Globals.$win.on('keydown', function(oEvent) {
|
||||
if (oEvent && self.modalVisibility && self.modalVisibility())
|
||||
{
|
||||
if (!this.bDisabeCloseOnEsc && Enums.EventKeyCode.Esc === oEvent.keyCode)
|
||||
|
|
@ -123,8 +118,6 @@
|
|||
|
||||
return true;
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = AbstractView;
|
||||
|
||||
}());
|
||||
module.exports = AbstractView;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
$ = require('$'),
|
||||
ko = require('ko'),
|
||||
|
|
@ -12,46 +8,45 @@
|
|||
|
||||
Globals = require('Common/Globals'),
|
||||
Plugins = require('Common/Plugins'),
|
||||
Utils = require('Common/Utils')
|
||||
;
|
||||
Utils = require('Common/Utils');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function Knoin()
|
||||
{
|
||||
function Knoin()
|
||||
{
|
||||
this.oScreens = {};
|
||||
this.sDefaultScreenName = '';
|
||||
this.oCurrentScreen = null;
|
||||
}
|
||||
}
|
||||
|
||||
Knoin.prototype.oScreens = {};
|
||||
Knoin.prototype.sDefaultScreenName = '';
|
||||
Knoin.prototype.oCurrentScreen = null;
|
||||
Knoin.prototype.oScreens = {};
|
||||
Knoin.prototype.sDefaultScreenName = '';
|
||||
Knoin.prototype.oCurrentScreen = null;
|
||||
|
||||
Knoin.prototype.hideLoading = function ()
|
||||
{
|
||||
Knoin.prototype.hideLoading = function()
|
||||
{
|
||||
$('#rl-content').addClass('rl-content-show');
|
||||
$('#rl-loading').hide().remove();
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Object} context
|
||||
*/
|
||||
Knoin.prototype.constructorEnd = function (context)
|
||||
{
|
||||
Knoin.prototype.constructorEnd = function(context)
|
||||
{
|
||||
if (Utils.isFunc(context.__constructor_end))
|
||||
{
|
||||
context.__constructor_end.call(context);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {string|Array} mName
|
||||
* @param {Function} ViewModelClass
|
||||
*/
|
||||
Knoin.prototype.extendAsViewModel = function (mName, ViewModelClass)
|
||||
{
|
||||
Knoin.prototype.extendAsViewModel = function(mName, ViewModelClass)
|
||||
{
|
||||
if (ViewModelClass)
|
||||
{
|
||||
if (Utils.isArray(mName))
|
||||
|
|
@ -65,17 +60,17 @@
|
|||
|
||||
ViewModelClass.__name = ViewModelClass.__names[0];
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Function} SettingsViewModelClass
|
||||
* @param {string} sLabelName
|
||||
* @param {string} sTemplate
|
||||
* @param {string} sRoute
|
||||
* @param {boolean=} bDefault
|
||||
*/
|
||||
Knoin.prototype.addSettingsViewModel = function (SettingsViewModelClass, sTemplate, sLabelName, sRoute, bDefault)
|
||||
{
|
||||
Knoin.prototype.addSettingsViewModel = function(SettingsViewModelClass, sTemplate, sLabelName, sRoute, bDefault)
|
||||
{
|
||||
SettingsViewModelClass.__rlSettingsData = {
|
||||
Label: sLabelName,
|
||||
Template: sTemplate,
|
||||
|
|
@ -84,58 +79,56 @@
|
|||
};
|
||||
|
||||
Globals.aViewModels.settings.push(SettingsViewModelClass);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Function} SettingsViewModelClass
|
||||
*/
|
||||
Knoin.prototype.removeSettingsViewModel = function (SettingsViewModelClass)
|
||||
{
|
||||
Knoin.prototype.removeSettingsViewModel = function(SettingsViewModelClass)
|
||||
{
|
||||
Globals.aViewModels['settings-removed'].push(SettingsViewModelClass);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Function} SettingsViewModelClass
|
||||
*/
|
||||
Knoin.prototype.disableSettingsViewModel = function (SettingsViewModelClass)
|
||||
{
|
||||
Knoin.prototype.disableSettingsViewModel = function(SettingsViewModelClass)
|
||||
{
|
||||
Globals.aViewModels['settings-disabled'].push(SettingsViewModelClass);
|
||||
};
|
||||
};
|
||||
|
||||
Knoin.prototype.routeOff = function ()
|
||||
{
|
||||
Knoin.prototype.routeOff = function()
|
||||
{
|
||||
hasher.changed.active = false;
|
||||
};
|
||||
};
|
||||
|
||||
Knoin.prototype.routeOn = function ()
|
||||
{
|
||||
Knoin.prototype.routeOn = function()
|
||||
{
|
||||
hasher.changed.active = true;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {string} sScreenName
|
||||
* @return {?Object}
|
||||
* @returns {?Object}
|
||||
*/
|
||||
Knoin.prototype.screen = function (sScreenName)
|
||||
{
|
||||
Knoin.prototype.screen = function(sScreenName)
|
||||
{
|
||||
return ('' !== sScreenName && !Utils.isUnd(this.oScreens[sScreenName])) ? this.oScreens[sScreenName] : null;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Function} ViewModelClass
|
||||
* @param {Object=} oScreen
|
||||
*/
|
||||
Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
|
||||
{
|
||||
Knoin.prototype.buildViewModel = function(ViewModelClass, oScreen)
|
||||
{
|
||||
if (ViewModelClass && !ViewModelClass.__builded)
|
||||
{
|
||||
var
|
||||
kn = this,
|
||||
oViewModel = new ViewModelClass(oScreen),
|
||||
sPosition = oViewModel.viewModelPosition(),
|
||||
oViewModelPlace = $('#rl-content #rl-' + sPosition.toLowerCase()),
|
||||
oViewModelDom = null
|
||||
;
|
||||
oViewModelDom = null;
|
||||
|
||||
ViewModelClass.__builded = true;
|
||||
ViewModelClass.__vm = oViewModel;
|
||||
|
|
@ -156,11 +149,11 @@
|
|||
|
||||
if ('Popups' === sPosition)
|
||||
{
|
||||
oViewModel.cancelCommand = oViewModel.closeCommand = Utils.createCommand(oViewModel, function () {
|
||||
kn.hideScreenPopup(ViewModelClass);
|
||||
});
|
||||
oViewModel.cancelCommand = oViewModel.closeCommand = Utils.createCommand(oViewModel, _.bind(function() {
|
||||
this.hideScreenPopup(ViewModelClass);
|
||||
}, this));
|
||||
|
||||
oViewModel.modalVisibility.subscribe(function (bValue) {
|
||||
oViewModel.modalVisibility.subscribe(function(bValue) {
|
||||
|
||||
var self = this;
|
||||
if (bValue)
|
||||
|
|
@ -190,14 +183,14 @@
|
|||
|
||||
this.restoreKeyScope();
|
||||
|
||||
_.each(this.viewModelNames, function (sName) {
|
||||
_.each(this.viewModelNames, function(sName) {
|
||||
Plugins.runHook('view-model-on-hide', [sName, self]);
|
||||
});
|
||||
|
||||
Globals.popupVisibilityNames.remove(this.viewModelName);
|
||||
oViewModel.viewModelDom.css('z-index', 2000);
|
||||
|
||||
_.delay(function () {
|
||||
_.delay(function() {
|
||||
self.viewModelDom.hide();
|
||||
}, 300);
|
||||
}
|
||||
|
|
@ -205,13 +198,17 @@
|
|||
}, oViewModel);
|
||||
}
|
||||
|
||||
_.each(ViewModelClass.__names, function (sName) {
|
||||
_.each(ViewModelClass.__names, function(sName) {
|
||||
Plugins.runHook('view-model-pre-build', [sName, oViewModel, oViewModelDom]);
|
||||
});
|
||||
|
||||
ko.applyBindingAccessorsToNode(oViewModelDom[0], {
|
||||
'translatorInit': true,
|
||||
'template': function () { return {'name': oViewModel.viewModelTemplate()};}
|
||||
translatorInit: true,
|
||||
template: function() {
|
||||
return {
|
||||
name: oViewModel.viewModelTemplate()
|
||||
};
|
||||
}
|
||||
}, oViewModel);
|
||||
|
||||
Utils.delegateRun(oViewModel, 'onBuild', [oViewModelDom]);
|
||||
|
|
@ -220,7 +217,7 @@
|
|||
oViewModel.registerPopupKeyDown();
|
||||
}
|
||||
|
||||
_.each(ViewModelClass.__names, function (sName) {
|
||||
_.each(ViewModelClass.__names, function(sName) {
|
||||
Plugins.runHook('view-model-post-build', [sName, oViewModel, oViewModelDom]);
|
||||
});
|
||||
}
|
||||
|
|
@ -231,25 +228,25 @@
|
|||
}
|
||||
|
||||
return ViewModelClass ? ViewModelClass.__vm : null;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Function} ViewModelClassToHide
|
||||
*/
|
||||
Knoin.prototype.hideScreenPopup = function (ViewModelClassToHide)
|
||||
{
|
||||
Knoin.prototype.hideScreenPopup = function(ViewModelClassToHide)
|
||||
{
|
||||
if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom)
|
||||
{
|
||||
ViewModelClassToHide.__vm.modalVisibility(false);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Function} ViewModelClassToShow
|
||||
* @param {Array=} aParameters
|
||||
*/
|
||||
Knoin.prototype.showScreenPopup = function (ViewModelClassToShow, aParameters)
|
||||
{
|
||||
Knoin.prototype.showScreenPopup = function(ViewModelClassToShow, aParameters)
|
||||
{
|
||||
if (ViewModelClassToShow)
|
||||
{
|
||||
this.buildViewModel(ViewModelClassToShow);
|
||||
|
|
@ -262,34 +259,33 @@
|
|||
|
||||
Utils.delegateRun(ViewModelClassToShow.__vm, 'onShow', aParameters || []);
|
||||
|
||||
_.each(ViewModelClassToShow.__names, function (sName) {
|
||||
_.each(ViewModelClassToShow.__names, function(sName) {
|
||||
Plugins.runHook('view-model-on-show', [sName, ViewModelClassToShow.__vm, aParameters || []]);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Function} ViewModelClassToShow
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
Knoin.prototype.isPopupVisible = function (ViewModelClassToShow)
|
||||
{
|
||||
Knoin.prototype.isPopupVisible = function(ViewModelClassToShow)
|
||||
{
|
||||
return ViewModelClassToShow && ViewModelClassToShow.__vm ? ViewModelClassToShow.__vm.modalVisibility() : false;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {string} sScreenName
|
||||
* @param {string} sSubPart
|
||||
*/
|
||||
Knoin.prototype.screenOnRoute = function (sScreenName, sSubPart)
|
||||
{
|
||||
Knoin.prototype.screenOnRoute = function(sScreenName, sSubPart)
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
oScreen = null,
|
||||
bSameScreen = false,
|
||||
oCross = null
|
||||
;
|
||||
oCross = null;
|
||||
|
||||
if ('' === Utils.pString(sScreenName))
|
||||
{
|
||||
|
|
@ -319,7 +315,7 @@
|
|||
|
||||
if (Utils.isNonEmptyArray(oScreen.viewModels()))
|
||||
{
|
||||
_.each(oScreen.viewModels(), function (ViewModelClass) {
|
||||
_.each(oScreen.viewModels(), function(ViewModelClass) {
|
||||
this.buildViewModel(ViewModelClass, oScreen);
|
||||
}, this);
|
||||
}
|
||||
|
|
@ -327,7 +323,7 @@
|
|||
Utils.delegateRun(oScreen, 'onBuild');
|
||||
}
|
||||
|
||||
_.defer(function () {
|
||||
_.defer(function() {
|
||||
|
||||
// hide screen
|
||||
if (self.oCurrentScreen && !bSameScreen)
|
||||
|
|
@ -342,7 +338,7 @@
|
|||
|
||||
if (Utils.isNonEmptyArray(self.oCurrentScreen.viewModels()))
|
||||
{
|
||||
_.each(self.oCurrentScreen.viewModels(), function (ViewModelClass) {
|
||||
_.each(self.oCurrentScreen.viewModels(), function(ViewModelClass) {
|
||||
|
||||
if (ViewModelClass.__vm && ViewModelClass.__dom &&
|
||||
'Popups' !== ViewModelClass.__vm.viewModelPosition())
|
||||
|
|
@ -379,7 +375,7 @@
|
|||
|
||||
if (Utils.isNonEmptyArray(self.oCurrentScreen.viewModels()))
|
||||
{
|
||||
_.each(self.oCurrentScreen.viewModels(), function (ViewModelClass) {
|
||||
_.each(self.oCurrentScreen.viewModels(), function(ViewModelClass) {
|
||||
|
||||
if (ViewModelClass.__vm && ViewModelClass.__dom &&
|
||||
'Popups' !== ViewModelClass.__vm.viewModelPosition())
|
||||
|
|
@ -397,7 +393,7 @@
|
|||
|
||||
Utils.delegateRun(ViewModelClass.__vm, 'onShowWithDelay', [], 200);
|
||||
|
||||
_.each(ViewModelClass.__names, function (sName) {
|
||||
_.each(ViewModelClass.__names, function(sName) {
|
||||
Plugins.runHook('view-model-on-show', [sName, ViewModelClass.__vm]);
|
||||
});
|
||||
}
|
||||
|
|
@ -415,25 +411,20 @@
|
|||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Array} aScreensClasses
|
||||
*/
|
||||
Knoin.prototype.startScreens = function (aScreensClasses)
|
||||
{
|
||||
// $('#rl-content').css({
|
||||
// 'visibility': 'hidden'
|
||||
// });
|
||||
|
||||
_.each(aScreensClasses, function (CScreen) {
|
||||
Knoin.prototype.startScreens = function(aScreensClasses)
|
||||
{
|
||||
_.each(aScreensClasses, function(CScreen) {
|
||||
|
||||
if (CScreen)
|
||||
{
|
||||
var
|
||||
oScreen = new CScreen(),
|
||||
sScreenName = oScreen ? oScreen.screenName() : ''
|
||||
;
|
||||
sScreenName = oScreen ? oScreen.screenName() : '';
|
||||
|
||||
if (oScreen && '' !== sScreenName)
|
||||
{
|
||||
|
|
@ -449,7 +440,7 @@
|
|||
}, this);
|
||||
|
||||
|
||||
_.each(this.oScreens, function (oScreen) {
|
||||
_.each(this.oScreens, function(oScreen) {
|
||||
if (oScreen && !oScreen.__started && oScreen.__start)
|
||||
{
|
||||
oScreen.__started = true;
|
||||
|
|
@ -468,26 +459,22 @@
|
|||
hasher.changed.add(oCross.parse, oCross);
|
||||
hasher.init();
|
||||
|
||||
// $('#rl-content').css({
|
||||
// 'visibility': 'visible'
|
||||
// });
|
||||
|
||||
_.delay(function () {
|
||||
_.delay(function() {
|
||||
Globals.$html.removeClass('rl-started-trigger').addClass('rl-started');
|
||||
}, 100);
|
||||
|
||||
_.delay(function () {
|
||||
_.delay(function() {
|
||||
Globals.$html.addClass('rl-started-delay');
|
||||
}, 200);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {string} sHash
|
||||
* @param {boolean=} bSilence = false
|
||||
* @param {boolean=} bReplace = false
|
||||
*/
|
||||
Knoin.prototype.setHash = function (sHash, bSilence, bReplace)
|
||||
{
|
||||
Knoin.prototype.setHash = function(sHash, bSilence, bReplace)
|
||||
{
|
||||
sHash = '#' === sHash.substr(0, 1) ? sHash.substr(1) : sHash;
|
||||
sHash = '/' === sHash.substr(0, 1) ? sHash.substr(1) : sHash;
|
||||
|
||||
|
|
@ -505,8 +492,6 @@
|
|||
hasher[bReplace ? 'replaceHash' : 'setHash'](sHash);
|
||||
hasher.setHash(sHash);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = new Knoin();
|
||||
|
||||
}());
|
||||
module.exports = new Knoin();
|
||||
|
|
|
|||
|
|
@ -1,26 +1,21 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
Utils = require('Common/Utils'),
|
||||
|
||||
AbstractModel = require('Knoin/AbstractModel')
|
||||
;
|
||||
AbstractModel = require('Knoin/AbstractModel');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {string} sEmail
|
||||
* @param {boolean=} bCanBeDelete = true
|
||||
* @param {number=} iCount = 0
|
||||
*/
|
||||
function AccountModel(sEmail, bCanBeDelete, iCount)
|
||||
{
|
||||
function AccountModel(sEmail, bCanBeDelete, iCount)
|
||||
{
|
||||
AbstractModel.call(this, 'AccountModel');
|
||||
|
||||
this.email = sEmail;
|
||||
|
|
@ -30,23 +25,21 @@
|
|||
this.deleteAccess = ko.observable(false);
|
||||
this.canBeDeleted = ko.observable(Utils.isUnd(bCanBeDelete) ? true : !!bCanBeDelete);
|
||||
this.canBeEdit = this.canBeDeleted;
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(AccountModel.prototype, AbstractModel.prototype);
|
||||
_.extend(AccountModel.prototype, AbstractModel.prototype);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
AccountModel.prototype.email = '';
|
||||
AccountModel.prototype.email = '';
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
AccountModel.prototype.changeAccountLink = function ()
|
||||
{
|
||||
AccountModel.prototype.changeAccountLink = function()
|
||||
{
|
||||
return require('Common/Links').change(this.email);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = AccountModel;
|
||||
|
||||
}());
|
||||
module.exports = AccountModel;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
window = require('window'),
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
|
@ -14,14 +10,13 @@
|
|||
Links = require('Common/Links'),
|
||||
Audio = require('Common/Audio'),
|
||||
|
||||
AbstractModel = require('Knoin/AbstractModel')
|
||||
;
|
||||
AbstractModel = require('Knoin/AbstractModel');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AttachmentModel()
|
||||
{
|
||||
function AttachmentModel()
|
||||
{
|
||||
AbstractModel.call(this, 'AttachmentModel');
|
||||
|
||||
this.checked = ko.observable(false);
|
||||
|
|
@ -43,44 +38,44 @@
|
|||
this.uid = '';
|
||||
this.mimeIndex = '';
|
||||
this.framed = false;
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(AttachmentModel.prototype, AbstractModel.prototype);
|
||||
_.extend(AttachmentModel.prototype, AbstractModel.prototype);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @static
|
||||
* @param {AjaxJsonAttachment} oJsonAttachment
|
||||
* @return {?AttachmentModel}
|
||||
* @returns {?AttachmentModel}
|
||||
*/
|
||||
AttachmentModel.newInstanceFromJson = function (oJsonAttachment)
|
||||
{
|
||||
AttachmentModel.newInstanceFromJson = function(oJsonAttachment)
|
||||
{
|
||||
var oAttachmentModel = new AttachmentModel();
|
||||
return oAttachmentModel.initByJson(oJsonAttachment) ? oAttachmentModel : null;
|
||||
};
|
||||
};
|
||||
|
||||
AttachmentModel.prototype.mimeType = '';
|
||||
AttachmentModel.prototype.fileName = '';
|
||||
AttachmentModel.prototype.fileType = '';
|
||||
AttachmentModel.prototype.fileNameExt = '';
|
||||
AttachmentModel.prototype.estimatedSize = 0;
|
||||
AttachmentModel.prototype.friendlySize = '';
|
||||
AttachmentModel.prototype.isInline = false;
|
||||
AttachmentModel.prototype.isLinked = false;
|
||||
AttachmentModel.prototype.isThumbnail = false;
|
||||
AttachmentModel.prototype.cid = '';
|
||||
AttachmentModel.prototype.cidWithOutTags = '';
|
||||
AttachmentModel.prototype.contentLocation = '';
|
||||
AttachmentModel.prototype.download = '';
|
||||
AttachmentModel.prototype.folder = '';
|
||||
AttachmentModel.prototype.uid = '';
|
||||
AttachmentModel.prototype.mimeIndex = '';
|
||||
AttachmentModel.prototype.framed = false;
|
||||
AttachmentModel.prototype.mimeType = '';
|
||||
AttachmentModel.prototype.fileName = '';
|
||||
AttachmentModel.prototype.fileType = '';
|
||||
AttachmentModel.prototype.fileNameExt = '';
|
||||
AttachmentModel.prototype.estimatedSize = 0;
|
||||
AttachmentModel.prototype.friendlySize = '';
|
||||
AttachmentModel.prototype.isInline = false;
|
||||
AttachmentModel.prototype.isLinked = false;
|
||||
AttachmentModel.prototype.isThumbnail = false;
|
||||
AttachmentModel.prototype.cid = '';
|
||||
AttachmentModel.prototype.cidWithOutTags = '';
|
||||
AttachmentModel.prototype.contentLocation = '';
|
||||
AttachmentModel.prototype.download = '';
|
||||
AttachmentModel.prototype.folder = '';
|
||||
AttachmentModel.prototype.uid = '';
|
||||
AttachmentModel.prototype.mimeIndex = '';
|
||||
AttachmentModel.prototype.framed = false;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {AjaxJsonAttachment} oJsonAttachment
|
||||
*/
|
||||
AttachmentModel.prototype.initByJson = function (oJsonAttachment)
|
||||
{
|
||||
AttachmentModel.prototype.initByJson = function(oJsonAttachment)
|
||||
{
|
||||
var bResult = false;
|
||||
if (oJsonAttachment && 'Object/Attachment' === oJsonAttachment['@Object'])
|
||||
{
|
||||
|
|
@ -109,155 +104,153 @@
|
|||
}
|
||||
|
||||
return bResult;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
AttachmentModel.prototype.isImage = function ()
|
||||
{
|
||||
AttachmentModel.prototype.isImage = function()
|
||||
{
|
||||
return Enums.FileType.Image === this.fileType;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
AttachmentModel.prototype.isMp3 = function ()
|
||||
{
|
||||
AttachmentModel.prototype.isMp3 = function()
|
||||
{
|
||||
return Enums.FileType.Audio === this.fileType &&
|
||||
'mp3' === this.fileNameExt;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
AttachmentModel.prototype.isOgg = function ()
|
||||
{
|
||||
AttachmentModel.prototype.isOgg = function()
|
||||
{
|
||||
return Enums.FileType.Audio === this.fileType &&
|
||||
('oga' === this.fileNameExt || 'ogg' === this.fileNameExt);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
AttachmentModel.prototype.isWav = function ()
|
||||
{
|
||||
AttachmentModel.prototype.isWav = function()
|
||||
{
|
||||
return Enums.FileType.Audio === this.fileType &&
|
||||
'wav' === this.fileNameExt;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
AttachmentModel.prototype.hasThumbnail = function ()
|
||||
{
|
||||
AttachmentModel.prototype.hasThumbnail = function()
|
||||
{
|
||||
return this.isThumbnail;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
AttachmentModel.prototype.isText = function ()
|
||||
{
|
||||
AttachmentModel.prototype.isText = function()
|
||||
{
|
||||
return Enums.FileType.Text === this.fileType ||
|
||||
Enums.FileType.Eml === this.fileType ||
|
||||
Enums.FileType.Certificate === this.fileType ||
|
||||
Enums.FileType.Html === this.fileType ||
|
||||
Enums.FileType.Code === this.fileType
|
||||
;
|
||||
};
|
||||
Enums.FileType.Code === this.fileType;
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
AttachmentModel.prototype.isPdf = function ()
|
||||
{
|
||||
AttachmentModel.prototype.isPdf = function()
|
||||
{
|
||||
return Enums.FileType.Pdf === this.fileType;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
AttachmentModel.prototype.isFramed = function ()
|
||||
{
|
||||
AttachmentModel.prototype.isFramed = function()
|
||||
{
|
||||
return this.framed && (Globals.data.__APP__ && Globals.data.__APP__.googlePreviewSupported()) &&
|
||||
!(this.isPdf() && Globals.bAllowPdfPreview) && !this.isText() && !this.isImage();
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
AttachmentModel.prototype.hasPreview = function ()
|
||||
{
|
||||
AttachmentModel.prototype.hasPreview = function()
|
||||
{
|
||||
return this.isImage() || (this.isPdf() && Globals.bAllowPdfPreview) ||
|
||||
this.isText() || this.isFramed();
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
AttachmentModel.prototype.hasPreplay = function ()
|
||||
{
|
||||
AttachmentModel.prototype.hasPreplay = function()
|
||||
{
|
||||
return (Audio.supportedMp3 && this.isMp3()) ||
|
||||
(Audio.supportedOgg && this.isOgg()) ||
|
||||
(Audio.supportedWav && this.isWav())
|
||||
;
|
||||
};
|
||||
(Audio.supportedWav && this.isWav());
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
AttachmentModel.prototype.linkDownload = function ()
|
||||
{
|
||||
AttachmentModel.prototype.linkDownload = function()
|
||||
{
|
||||
return Links.attachmentDownload(this.download);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
AttachmentModel.prototype.linkPreview = function ()
|
||||
{
|
||||
AttachmentModel.prototype.linkPreview = function()
|
||||
{
|
||||
return Links.attachmentPreview(this.download);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
AttachmentModel.prototype.linkThumbnail = function ()
|
||||
{
|
||||
AttachmentModel.prototype.linkThumbnail = function()
|
||||
{
|
||||
return this.hasThumbnail() ? Links.attachmentThumbnailPreview(this.download) : '';
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
AttachmentModel.prototype.linkThumbnailPreviewStyle = function ()
|
||||
{
|
||||
AttachmentModel.prototype.linkThumbnailPreviewStyle = function()
|
||||
{
|
||||
var sLink = this.linkThumbnail();
|
||||
return '' === sLink ? '' : 'background:url(' + sLink + ')';
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
AttachmentModel.prototype.linkFramed = function ()
|
||||
{
|
||||
AttachmentModel.prototype.linkFramed = function()
|
||||
{
|
||||
return Links.attachmentFramed(this.download);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
AttachmentModel.prototype.linkPreviewAsPlain = function ()
|
||||
{
|
||||
AttachmentModel.prototype.linkPreviewAsPlain = function()
|
||||
{
|
||||
return Links.attachmentPreviewAsPlain(this.download);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
AttachmentModel.prototype.linkPreviewMain = function ()
|
||||
{
|
||||
AttachmentModel.prototype.linkPreviewMain = function()
|
||||
{
|
||||
var sResult = '';
|
||||
switch (true)
|
||||
{
|
||||
|
|
@ -271,16 +264,17 @@
|
|||
case this.isFramed():
|
||||
sResult = this.linkFramed();
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
||||
return sResult;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
AttachmentModel.prototype.generateTransferDownloadUrl = function ()
|
||||
{
|
||||
AttachmentModel.prototype.generateTransferDownloadUrl = function()
|
||||
{
|
||||
var sLink = this.linkDownload();
|
||||
if ('http' !== sLink.substr(0, 4))
|
||||
{
|
||||
|
|
@ -288,15 +282,15 @@
|
|||
}
|
||||
|
||||
return this.mimeType + ':' + this.fileName + ':' + sLink;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {AttachmentModel} oAttachment
|
||||
* @param {*} oEvent
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
AttachmentModel.prototype.eventDragStart = function (oAttachment, oEvent)
|
||||
{
|
||||
AttachmentModel.prototype.eventDragStart = function(oAttachment, oEvent)
|
||||
{
|
||||
var oLocalEvent = oEvent.originalEvent || oEvent;
|
||||
if (oAttachment && oLocalEvent && oLocalEvent.dataTransfer && oLocalEvent.dataTransfer.setData)
|
||||
{
|
||||
|
|
@ -304,22 +298,21 @@
|
|||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {string} sExt
|
||||
* @param {string} sMimeType
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
AttachmentModel.staticFileType = _.memoize(function (sExt, sMimeType)
|
||||
{
|
||||
AttachmentModel.staticFileType = _.memoize(function(sExt, sMimeType)
|
||||
{
|
||||
sExt = Utils.trim(sExt).toLowerCase();
|
||||
sMimeType = Utils.trim(sMimeType).toLowerCase();
|
||||
|
||||
var
|
||||
sResult = Enums.FileType.Unknown,
|
||||
aMimeTypeParts = sMimeType.split('/')
|
||||
;
|
||||
aMimeTypeParts = sMimeType.split('/');
|
||||
|
||||
switch (true)
|
||||
{
|
||||
|
|
@ -413,21 +406,21 @@
|
|||
]):
|
||||
sResult = Enums.FileType.Presentation;
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
||||
return sResult;
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {string} sFileType
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
AttachmentModel.staticIconClass = _.memoize(function (sFileType)
|
||||
{
|
||||
AttachmentModel.staticIconClass = _.memoize(function(sFileType)
|
||||
{
|
||||
var
|
||||
sText = '',
|
||||
sClass = 'icon-file'
|
||||
;
|
||||
sClass = 'icon-file';
|
||||
|
||||
switch (sFileType)
|
||||
{
|
||||
|
|
@ -466,27 +459,27 @@
|
|||
sText = 'pdf';
|
||||
sClass = 'icon-none';
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
||||
return [sClass, sText];
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {string} sFileType
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
AttachmentModel.staticCombinedIconClass = function (aData)
|
||||
{
|
||||
AttachmentModel.staticCombinedIconClass = function(aData)
|
||||
{
|
||||
var
|
||||
sClass = '',
|
||||
aTypes = []
|
||||
;
|
||||
aTypes = [];
|
||||
|
||||
if (Utils.isNonEmptyArray(aData))
|
||||
{
|
||||
sClass = 'icon-attachment';
|
||||
|
||||
aTypes = _.uniq(_.compact(_.map(aData, function (aItem) {
|
||||
aTypes = _.uniq(_.compact(_.map(aData, function(aItem) {
|
||||
return aItem ? AttachmentModel.staticFileType(
|
||||
Utils.getFileExtension(aItem[0]), aItem[1]) : '';
|
||||
})));
|
||||
|
|
@ -525,29 +518,28 @@
|
|||
case Enums.FileType.Presentation:
|
||||
sClass = 'icon-file-chart-graph';
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sClass;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
AttachmentModel.prototype.iconClass = function ()
|
||||
{
|
||||
AttachmentModel.prototype.iconClass = function()
|
||||
{
|
||||
return AttachmentModel.staticIconClass(this.fileType)[0];
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
AttachmentModel.prototype.iconText = function ()
|
||||
{
|
||||
AttachmentModel.prototype.iconText = function()
|
||||
{
|
||||
return AttachmentModel.staticIconClass(this.fileType)[1];
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = AttachmentModel;
|
||||
|
||||
}());
|
||||
module.exports = AttachmentModel;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
|
|
@ -11,10 +7,9 @@
|
|||
|
||||
AttachmentModel = require('Model/Attachment'),
|
||||
|
||||
AbstractModel = require('Knoin/AbstractModel')
|
||||
;
|
||||
AbstractModel = require('Knoin/AbstractModel');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
* @param {string} sId
|
||||
* @param {string} sFileName
|
||||
|
|
@ -24,8 +19,8 @@
|
|||
* @param {string=} sCID
|
||||
* @param {string=} sContentLocation
|
||||
*/
|
||||
function ComposeAttachmentModel(sId, sFileName, nSize, bInline, bLinked, sCID, sContentLocation)
|
||||
{
|
||||
function ComposeAttachmentModel(sId, sFileName, nSize, bInline, bLinked, sCID, sContentLocation)
|
||||
{
|
||||
AbstractModel.call(this, 'ComposeAttachmentModel');
|
||||
|
||||
this.id = sId;
|
||||
|
|
@ -46,53 +41,53 @@
|
|||
this.enabled = ko.observable(true);
|
||||
this.complete = ko.observable(false);
|
||||
|
||||
this.progressText = ko.computed(function () {
|
||||
this.progressText = ko.computed(function() {
|
||||
var iP = this.progress();
|
||||
return 0 === iP ? '' : '' + (98 < iP ? 100 : iP) + '%';
|
||||
}, this);
|
||||
|
||||
this.progressStyle = ko.computed(function () {
|
||||
this.progressStyle = ko.computed(function() {
|
||||
var iP = this.progress();
|
||||
return 0 === iP ? '' : 'width:' + (98 < iP ? 100 : iP) + '%';
|
||||
}, this);
|
||||
|
||||
this.title = ko.computed(function () {
|
||||
this.title = ko.computed(function() {
|
||||
var sError = this.error();
|
||||
return '' !== sError ? sError : this.fileName();
|
||||
}, this);
|
||||
|
||||
this.friendlySize = ko.computed(function () {
|
||||
this.friendlySize = ko.computed(function() {
|
||||
var mSize = this.size();
|
||||
return null === mSize ? '' : Utils.friendlySize(this.size());
|
||||
}, this);
|
||||
|
||||
this.mimeType = ko.computed(function () {
|
||||
this.mimeType = ko.computed(function() {
|
||||
return Utils.mimeContentType(this.fileName());
|
||||
}, this);
|
||||
|
||||
this.fileExt = ko.computed(function () {
|
||||
this.fileExt = ko.computed(function() {
|
||||
return Utils.getFileExtension(this.fileName());
|
||||
}, this);
|
||||
|
||||
this.regDisposables([this.progressText, this.progressStyle, this.title, this.friendlySize, this.mimeType, this.fileExt]);
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(ComposeAttachmentModel.prototype, AbstractModel.prototype);
|
||||
_.extend(ComposeAttachmentModel.prototype, AbstractModel.prototype);
|
||||
|
||||
ComposeAttachmentModel.prototype.id = '';
|
||||
ComposeAttachmentModel.prototype.isInline = false;
|
||||
ComposeAttachmentModel.prototype.isLinked = false;
|
||||
ComposeAttachmentModel.prototype.CID = '';
|
||||
ComposeAttachmentModel.prototype.contentLocation = '';
|
||||
ComposeAttachmentModel.prototype.fromMessage = false;
|
||||
ComposeAttachmentModel.prototype.cancel = Utils.noop;
|
||||
ComposeAttachmentModel.prototype.id = '';
|
||||
ComposeAttachmentModel.prototype.isInline = false;
|
||||
ComposeAttachmentModel.prototype.isLinked = false;
|
||||
ComposeAttachmentModel.prototype.CID = '';
|
||||
ComposeAttachmentModel.prototype.contentLocation = '';
|
||||
ComposeAttachmentModel.prototype.fromMessage = false;
|
||||
ComposeAttachmentModel.prototype.cancel = Utils.noop;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {AjaxJsonComposeAttachment} oJsonAttachment
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
ComposeAttachmentModel.prototype.initByUploadJson = function (oJsonAttachment)
|
||||
{
|
||||
ComposeAttachmentModel.prototype.initByUploadJson = function(oJsonAttachment)
|
||||
{
|
||||
var bResult = false;
|
||||
if (oJsonAttachment)
|
||||
{
|
||||
|
|
@ -105,26 +100,24 @@
|
|||
}
|
||||
|
||||
return bResult;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
ComposeAttachmentModel.prototype.iconClass = function ()
|
||||
{
|
||||
ComposeAttachmentModel.prototype.iconClass = function()
|
||||
{
|
||||
return AttachmentModel.staticIconClass(
|
||||
AttachmentModel.staticFileType(this.fileExt(), this.mimeType()))[0];
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
ComposeAttachmentModel.prototype.iconText = function ()
|
||||
{
|
||||
ComposeAttachmentModel.prototype.iconText = function()
|
||||
{
|
||||
return AttachmentModel.staticIconClass(
|
||||
AttachmentModel.staticFileType(this.fileExt(), this.mimeType()))[1];
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = ComposeAttachmentModel;
|
||||
|
||||
}());
|
||||
module.exports = ComposeAttachmentModel;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
|
|
@ -11,14 +7,13 @@
|
|||
Utils = require('Common/Utils'),
|
||||
Links = require('Common/Links'),
|
||||
|
||||
AbstractModel = require('Knoin/AbstractModel')
|
||||
;
|
||||
AbstractModel = require('Knoin/AbstractModel');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function ContactModel()
|
||||
{
|
||||
function ContactModel()
|
||||
{
|
||||
AbstractModel.call(this, 'ContactModel');
|
||||
|
||||
this.idContact = 0;
|
||||
|
|
@ -30,23 +25,22 @@
|
|||
this.selected = ko.observable(false);
|
||||
this.checked = ko.observable(false);
|
||||
this.deleted = ko.observable(false);
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(ContactModel.prototype, AbstractModel.prototype);
|
||||
_.extend(ContactModel.prototype, AbstractModel.prototype);
|
||||
|
||||
/**
|
||||
* @return {Array|null}
|
||||
/**
|
||||
* @returns {Array|null}
|
||||
*/
|
||||
ContactModel.prototype.getNameAndEmailHelper = function ()
|
||||
{
|
||||
ContactModel.prototype.getNameAndEmailHelper = function()
|
||||
{
|
||||
var
|
||||
sName = '',
|
||||
sEmail = ''
|
||||
;
|
||||
sEmail = '';
|
||||
|
||||
if (Utils.isNonEmptyArray(this.properties))
|
||||
{
|
||||
_.each(this.properties, function (aProperty) {
|
||||
_.each(this.properties, function(aProperty) {
|
||||
if (aProperty)
|
||||
{
|
||||
if (Enums.ContactPropertyType.FirstName === aProperty[0])
|
||||
|
|
@ -66,10 +60,10 @@
|
|||
}
|
||||
|
||||
return '' === sEmail ? null : [sEmail, sName];
|
||||
};
|
||||
};
|
||||
|
||||
ContactModel.prototype.parse = function (oItem)
|
||||
{
|
||||
ContactModel.prototype.parse = function(oItem)
|
||||
{
|
||||
var bResult = false;
|
||||
if (oItem && 'Object/Contact' === oItem['@Object'])
|
||||
{
|
||||
|
|
@ -79,7 +73,7 @@
|
|||
|
||||
if (Utils.isNonEmptyArray(oItem.Properties))
|
||||
{
|
||||
_.each(oItem.Properties, function (oProperty) {
|
||||
_.each(oItem.Properties, function(oProperty) {
|
||||
if (oProperty && oProperty.Type && Utils.isNormal(oProperty.Value) && Utils.isNormal(oProperty.TypeStr))
|
||||
{
|
||||
this.properties.push([Utils.pInt(oProperty.Type), Utils.pString(oProperty.Value), Utils.pString(oProperty.TypeStr)]);
|
||||
|
|
@ -91,29 +85,29 @@
|
|||
}
|
||||
|
||||
return bResult;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
ContactModel.prototype.srcAttr = function ()
|
||||
{
|
||||
ContactModel.prototype.srcAttr = function()
|
||||
{
|
||||
return Links.emptyContactPic();
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
ContactModel.prototype.generateUid = function ()
|
||||
{
|
||||
ContactModel.prototype.generateUid = function()
|
||||
{
|
||||
return '' + this.idContact;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
ContactModel.prototype.lineAsCss = function ()
|
||||
{
|
||||
ContactModel.prototype.lineAsCss = function()
|
||||
{
|
||||
var aResult = [];
|
||||
if (this.deleted())
|
||||
{
|
||||
|
|
@ -133,8 +127,6 @@
|
|||
}
|
||||
|
||||
return aResult.join(' ');
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = ContactModel;
|
||||
|
||||
}());
|
||||
module.exports = ContactModel;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
|
|
@ -11,10 +7,9 @@
|
|||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
AbstractModel = require('Knoin/AbstractModel')
|
||||
;
|
||||
AbstractModel = require('Knoin/AbstractModel');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
* @param {number=} iType = Enums.ContactPropertyType.Unknown
|
||||
* @param {string=} sTypeStr = ''
|
||||
|
|
@ -22,8 +17,8 @@
|
|||
* @param {boolean=} bFocused = false
|
||||
* @param {string=} sPlaceholder = ''
|
||||
*/
|
||||
function ContactPropertyModel(iType, sTypeStr, sValue, bFocused, sPlaceholder)
|
||||
{
|
||||
function ContactPropertyModel(iType, sTypeStr, sValue, bFocused, sPlaceholder)
|
||||
{
|
||||
AbstractModel.call(this, 'ContactPropertyModel');
|
||||
|
||||
this.type = ko.observable(Utils.isUnd(iType) ? Enums.ContactPropertyType.Unknown : iType);
|
||||
|
|
@ -33,20 +28,18 @@
|
|||
|
||||
this.placeholder = ko.observable(sPlaceholder || '');
|
||||
|
||||
this.placeholderValue = ko.computed(function () {
|
||||
this.placeholderValue = ko.computed(function() {
|
||||
var value = this.placeholder();
|
||||
return value ? Translator.i18n(value) : '';
|
||||
}, this);
|
||||
|
||||
this.largeValue = ko.computed(function () {
|
||||
this.largeValue = ko.computed(function() {
|
||||
return Enums.ContactPropertyType.Note === this.type();
|
||||
}, this);
|
||||
|
||||
this.regDisposables([this.placeholderValue, this.largeValue]);
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(ContactPropertyModel.prototype, AbstractModel.prototype);
|
||||
_.extend(ContactPropertyModel.prototype, AbstractModel.prototype);
|
||||
|
||||
module.exports = ContactPropertyModel;
|
||||
|
||||
}());
|
||||
module.exports = ContactPropertyModel;
|
||||
|
|
|
|||
|
|
@ -1,49 +1,42 @@
|
|||
|
||||
(function () {
|
||||
var Utils = require('Common/Utils');
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
Utils = require('Common/Utils')
|
||||
;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
* @param {string=} sEmail
|
||||
* @param {string=} sName
|
||||
* @param {string=} sDkimStatus
|
||||
* @param {string=} sDkimValue
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function EmailModel(sEmail, sName, sDkimStatus, sDkimValue)
|
||||
{
|
||||
function EmailModel(sEmail, sName, sDkimStatus, sDkimValue)
|
||||
{
|
||||
this.email = sEmail || '';
|
||||
this.name = sName || '';
|
||||
this.dkimStatus = sDkimStatus || 'none';
|
||||
this.dkimValue = sDkimValue || '';
|
||||
|
||||
this.clearDuplicateName();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @static
|
||||
* @param {AjaxJsonEmail} oJsonEmail
|
||||
* @return {?EmailModel}
|
||||
* @returns {?EmailModel}
|
||||
*/
|
||||
EmailModel.newInstanceFromJson = function (oJsonEmail)
|
||||
{
|
||||
EmailModel.newInstanceFromJson = function(oJsonEmail)
|
||||
{
|
||||
var oEmailModel = new EmailModel();
|
||||
return oEmailModel.initByJson(oJsonEmail) ? oEmailModel : null;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @static
|
||||
* @param {string} sLine
|
||||
* @param {string=} sDelimiter = ';'
|
||||
* @return {Array}
|
||||
* @returns {Array}
|
||||
*/
|
||||
EmailModel.splitHelper = function (sLine, sDelimiter)
|
||||
{
|
||||
EmailModel.splitHelper = function(sLine, sDelimiter)
|
||||
{
|
||||
sDelimiter = sDelimiter || ';';
|
||||
|
||||
sLine = sLine.replace(/[\r\n]+/g, '; ').replace(/[\s]+/g, ' ');
|
||||
|
|
@ -53,8 +46,7 @@
|
|||
iLen = sLine.length,
|
||||
bAt = false,
|
||||
sChar = '',
|
||||
sResult = ''
|
||||
;
|
||||
sResult = '';
|
||||
|
||||
for (; iIndex < iLen; iIndex++)
|
||||
{
|
||||
|
|
@ -71,90 +63,90 @@
|
|||
sResult += sDelimiter;
|
||||
}
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
||||
sResult += sChar;
|
||||
}
|
||||
|
||||
return sResult.split(sDelimiter);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
EmailModel.prototype.name = '';
|
||||
EmailModel.prototype.name = '';
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
EmailModel.prototype.email = '';
|
||||
EmailModel.prototype.email = '';
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
EmailModel.prototype.dkimStatus = 'none';
|
||||
EmailModel.prototype.dkimStatus = 'none';
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
EmailModel.prototype.dkimValue = '';
|
||||
EmailModel.prototype.dkimValue = '';
|
||||
|
||||
EmailModel.prototype.clear = function ()
|
||||
{
|
||||
EmailModel.prototype.clear = function()
|
||||
{
|
||||
this.email = '';
|
||||
this.name = '';
|
||||
|
||||
this.dkimStatus = 'none';
|
||||
this.dkimValue = '';
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
EmailModel.prototype.validate = function ()
|
||||
{
|
||||
EmailModel.prototype.validate = function()
|
||||
{
|
||||
return '' !== this.name || '' !== this.email;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {boolean} bWithoutName = false
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
EmailModel.prototype.hash = function (bWithoutName)
|
||||
{
|
||||
EmailModel.prototype.hash = function(bWithoutName)
|
||||
{
|
||||
return '#' + (bWithoutName ? '' : this.name) + '#' + this.email + '#';
|
||||
};
|
||||
};
|
||||
|
||||
EmailModel.prototype.clearDuplicateName = function ()
|
||||
{
|
||||
EmailModel.prototype.clearDuplicateName = function()
|
||||
{
|
||||
if (this.name === this.email)
|
||||
{
|
||||
this.name = '';
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {string} sQuery
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
EmailModel.prototype.search = function (sQuery)
|
||||
{
|
||||
EmailModel.prototype.search = function(sQuery)
|
||||
{
|
||||
return -1 < (this.name + ' ' + this.email).toLowerCase().indexOf(sQuery.toLowerCase());
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {string} sString
|
||||
*/
|
||||
EmailModel.prototype.parse = function (sString)
|
||||
{
|
||||
EmailModel.prototype.parse = function(sString)
|
||||
{
|
||||
this.clear();
|
||||
|
||||
sString = Utils.trim(sString);
|
||||
|
||||
var
|
||||
mRegex = /(?:"([^"]+)")? ?[<]?(.*?@[^>,]+)>?,? ?/g,
|
||||
mMatch = mRegex.exec(sString)
|
||||
;
|
||||
mMatch = mRegex.exec(sString);
|
||||
|
||||
if (mMatch)
|
||||
{
|
||||
|
|
@ -168,14 +160,14 @@
|
|||
this.name = '';
|
||||
this.email = sString;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {AjaxJsonEmail} oJsonEmail
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
EmailModel.prototype.initByJson = function (oJsonEmail)
|
||||
{
|
||||
EmailModel.prototype.initByJson = function(oJsonEmail)
|
||||
{
|
||||
var bResult = false;
|
||||
if (oJsonEmail && 'Object/Email' === oJsonEmail['@Object'])
|
||||
{
|
||||
|
|
@ -189,16 +181,16 @@
|
|||
}
|
||||
|
||||
return bResult;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {boolean} bFriendlyView
|
||||
* @param {boolean=} bWrapWithLink = false
|
||||
* @param {boolean=} bEncodeHtml = false
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
EmailModel.prototype.toLine = function (bFriendlyView, bWrapWithLink, bEncodeHtml)
|
||||
{
|
||||
EmailModel.prototype.toLine = function(bFriendlyView, bWrapWithLink, bEncodeHtml)
|
||||
{
|
||||
var sResult = '';
|
||||
if ('' !== this.email)
|
||||
{
|
||||
|
|
@ -242,14 +234,14 @@
|
|||
}
|
||||
|
||||
return sResult;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {string} $sEmailAddress
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
EmailModel.prototype.mailsoParse = function ($sEmailAddress)
|
||||
{
|
||||
EmailModel.prototype.mailsoParse = function($sEmailAddress)
|
||||
{
|
||||
$sEmailAddress = Utils.trim($sEmailAddress);
|
||||
if ('' === $sEmailAddress)
|
||||
{
|
||||
|
|
@ -257,25 +249,25 @@
|
|||
}
|
||||
|
||||
var
|
||||
substr = function (str, start, len) {
|
||||
substr = function(str, start, len) {
|
||||
str += '';
|
||||
var end = str.length;
|
||||
|
||||
if (start < 0) {
|
||||
if (0 > start) {
|
||||
start += end;
|
||||
}
|
||||
|
||||
end = typeof len === 'undefined' ? end : (len < 0 ? len + end : len + start);
|
||||
end = 'undefined' === typeof len ? end : (0 > len ? len + end : len + start);
|
||||
|
||||
return start >= str.length || start < 0 || start > end ? false : str.slice(start, end);
|
||||
return start >= str.length || 0 > start || start > end ? false : str.slice(start, end);
|
||||
},
|
||||
|
||||
substr_replace = function (str, replace, start, length) {
|
||||
if (start < 0) {
|
||||
substrReplace = function(str, replace, start, length) {
|
||||
if (0 > start) {
|
||||
start += str.length;
|
||||
}
|
||||
length = typeof length !== 'undefined' ? length : str.length;
|
||||
if (length < 0) {
|
||||
length = 'undefined' === typeof length ? length : str.length;
|
||||
if (0 > length) {
|
||||
length = length + str.length - start;
|
||||
}
|
||||
return str.slice(0, start) + replace.substr(0, length) + replace.slice(length) + str.slice(start + length);
|
||||
|
|
@ -293,8 +285,7 @@
|
|||
|
||||
$iStartIndex = 0,
|
||||
$iEndIndex = 0,
|
||||
$iCurrentIndex = 0
|
||||
;
|
||||
$iCurrentIndex = 0;
|
||||
|
||||
while ($iCurrentIndex < $sEmailAddress.length)
|
||||
{
|
||||
|
|
@ -310,7 +301,7 @@
|
|||
{
|
||||
$iEndIndex = $iCurrentIndex;
|
||||
$sName = substr($sEmailAddress, $iStartIndex + 1, $iEndIndex - $iStartIndex - 1);
|
||||
$sEmailAddress = substr_replace($sEmailAddress, '', $iStartIndex, $iEndIndex - $iStartIndex + 1);
|
||||
$sEmailAddress = substrReplace($sEmailAddress, '', $iStartIndex, $iEndIndex - $iStartIndex + 1);
|
||||
$iEndIndex = 0;
|
||||
$iCurrentIndex = 0;
|
||||
$iStartIndex = 0;
|
||||
|
|
@ -320,7 +311,7 @@
|
|||
case '<':
|
||||
if ((!$bInName) && (!$bInAddress) && (!$bInComment))
|
||||
{
|
||||
if ($iCurrentIndex > 0 && $sName.length === 0)
|
||||
if (0 < $iCurrentIndex && 0 === $sName.length)
|
||||
{
|
||||
$sName = substr($sEmailAddress, 0, $iCurrentIndex);
|
||||
}
|
||||
|
|
@ -334,7 +325,7 @@
|
|||
{
|
||||
$iEndIndex = $iCurrentIndex;
|
||||
$sEmail = substr($sEmailAddress, $iStartIndex + 1, $iEndIndex - $iStartIndex - 1);
|
||||
$sEmailAddress = substr_replace($sEmailAddress, '', $iStartIndex, $iEndIndex - $iStartIndex + 1);
|
||||
$sEmailAddress = substrReplace($sEmailAddress, '', $iStartIndex, $iEndIndex - $iStartIndex + 1);
|
||||
$iEndIndex = 0;
|
||||
$iCurrentIndex = 0;
|
||||
$iStartIndex = 0;
|
||||
|
|
@ -353,7 +344,7 @@
|
|||
{
|
||||
$iEndIndex = $iCurrentIndex;
|
||||
$sComment = substr($sEmailAddress, $iStartIndex + 1, $iEndIndex - $iStartIndex - 1);
|
||||
$sEmailAddress = substr_replace($sEmailAddress, '', $iStartIndex, $iEndIndex - $iStartIndex + 1);
|
||||
$sEmailAddress = substrReplace($sEmailAddress, '', $iStartIndex, $iEndIndex - $iStartIndex + 1);
|
||||
$iEndIndex = 0;
|
||||
$iCurrentIndex = 0;
|
||||
$iStartIndex = 0;
|
||||
|
|
@ -361,14 +352,15 @@
|
|||
}
|
||||
break;
|
||||
case '\\':
|
||||
$iCurrentIndex++;
|
||||
$iCurrentIndex += 1;
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
||||
$iCurrentIndex++;
|
||||
$iCurrentIndex += 1;
|
||||
}
|
||||
|
||||
if ($sEmail.length === 0)
|
||||
if (0 === $sEmail.length)
|
||||
{
|
||||
$aRegs = $sEmailAddress.match(/[^@\s]+@\S+/i);
|
||||
if ($aRegs && $aRegs[0])
|
||||
|
|
@ -381,7 +373,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if ($sEmail.length > 0 && $sName.length === 0 && $sComment.length === 0)
|
||||
if (0 < $sEmail.length && 0 === $sName.length && 0 === $sComment.length)
|
||||
{
|
||||
$sName = $sEmailAddress.replace($sEmail, '');
|
||||
}
|
||||
|
|
@ -399,8 +391,6 @@
|
|||
|
||||
this.clearDuplicateName();
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = EmailModel;
|
||||
|
||||
}());
|
||||
module.exports = EmailModel;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
|
|
@ -15,14 +11,13 @@
|
|||
|
||||
FilterConditionModel = require('Model/FilterCondition'),
|
||||
|
||||
AbstractModel = require('Knoin/AbstractModel')
|
||||
;
|
||||
AbstractModel = require('Knoin/AbstractModel');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function FilterModel()
|
||||
{
|
||||
function FilterModel()
|
||||
{
|
||||
AbstractModel.call(this, 'FilterModel');
|
||||
|
||||
this.enabled = ko.observable(true);
|
||||
|
|
@ -53,7 +48,7 @@
|
|||
|
||||
this.actionType = ko.observable(Enums.FiltersAction.MoveTo);
|
||||
|
||||
this.actionType.subscribe(function () {
|
||||
this.actionType.subscribe(function() {
|
||||
this.actionValue('');
|
||||
this.actionValue.error(false);
|
||||
this.actionValueSecond('');
|
||||
|
|
@ -62,18 +57,17 @@
|
|||
this.actionValueFourth.error(false);
|
||||
}, this);
|
||||
|
||||
var fGetRealFolderName = function (sFolderFullNameRaw) {
|
||||
var fGetRealFolderName = function(sFolderFullNameRaw) {
|
||||
var oFolder = Cache.getFolderFromCacheList(sFolderFullNameRaw);
|
||||
return oFolder ? oFolder.fullName.replace(
|
||||
'.' === oFolder.delimiter ? /\./ : /[\\\/]+/, ' / ') : sFolderFullNameRaw;
|
||||
};
|
||||
|
||||
this.nameSub = ko.computed(function () {
|
||||
this.nameSub = ko.computed(function() {
|
||||
|
||||
var
|
||||
sResult = '',
|
||||
sActionValue = this.actionValue()
|
||||
;
|
||||
sActionValue = this.actionValue();
|
||||
|
||||
switch (this.actionType())
|
||||
{
|
||||
|
|
@ -96,21 +90,18 @@
|
|||
case Enums.FiltersAction.Discard:
|
||||
sResult = Translator.i18n('SETTINGS_FILTERS/SUBNAME_DISCARD');
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
||||
return sResult ? '(' + sResult + ')' : '';
|
||||
|
||||
}, this);
|
||||
|
||||
this.actionTemplate = ko.computed(function () {
|
||||
this.actionTemplate = ko.computed(function() {
|
||||
|
||||
var sTemplate = '';
|
||||
switch (this.actionType())
|
||||
{
|
||||
default:
|
||||
case Enums.FiltersAction.MoveTo:
|
||||
sTemplate = 'SettingsFiltersActionMoveToFolder';
|
||||
break;
|
||||
case Enums.FiltersAction.Forward:
|
||||
sTemplate = 'SettingsFiltersActionForward';
|
||||
break;
|
||||
|
|
@ -126,6 +117,10 @@
|
|||
case Enums.FiltersAction.Discard:
|
||||
sTemplate = 'SettingsFiltersActionDiscard';
|
||||
break;
|
||||
case Enums.FiltersAction.MoveTo:
|
||||
default:
|
||||
sTemplate = 'SettingsFiltersActionMoveToFolder';
|
||||
break;
|
||||
}
|
||||
|
||||
return sTemplate;
|
||||
|
|
@ -134,11 +129,11 @@
|
|||
|
||||
this.regDisposables(this.conditions.subscribe(Utils.windowResizeCallback));
|
||||
|
||||
this.regDisposables(this.name.subscribe(function (sValue) {
|
||||
this.regDisposables(this.name.subscribe(function(sValue) {
|
||||
this.name.error('' === sValue);
|
||||
}, this));
|
||||
|
||||
this.regDisposables(this.actionValue.subscribe(function (sValue) {
|
||||
this.regDisposables(this.actionValue.subscribe(function(sValue) {
|
||||
this.actionValue.error('' === sValue);
|
||||
}, this));
|
||||
|
||||
|
|
@ -146,17 +141,17 @@
|
|||
|
||||
this.deleteAccess = ko.observable(false);
|
||||
this.canBeDeleted = ko.observable(true);
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(FilterModel.prototype, AbstractModel.prototype);
|
||||
_.extend(FilterModel.prototype, AbstractModel.prototype);
|
||||
|
||||
FilterModel.prototype.generateID = function ()
|
||||
{
|
||||
FilterModel.prototype.generateID = function()
|
||||
{
|
||||
this.id = Utils.fakeMd5();
|
||||
};
|
||||
};
|
||||
|
||||
FilterModel.prototype.verify = function ()
|
||||
{
|
||||
FilterModel.prototype.verify = function()
|
||||
{
|
||||
if ('' === this.name())
|
||||
{
|
||||
this.name.error(true);
|
||||
|
|
@ -165,7 +160,7 @@
|
|||
|
||||
if (0 < this.conditions().length)
|
||||
{
|
||||
if (_.find(this.conditions(), function (oCond) {
|
||||
if (_.find(this.conditions(), function(oCond) {
|
||||
return oCond && !oCond.verify();
|
||||
}))
|
||||
{
|
||||
|
|
@ -206,16 +201,16 @@
|
|||
this.actionValue.error(false);
|
||||
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
FilterModel.prototype.toJson = function ()
|
||||
{
|
||||
FilterModel.prototype.toJson = function()
|
||||
{
|
||||
return {
|
||||
ID: this.id,
|
||||
Enabled: this.enabled() ? '1' : '0',
|
||||
Name: this.name(),
|
||||
ConditionsType: this.conditionsType(),
|
||||
Conditions: _.map(this.conditions(), function (oItem) {
|
||||
Conditions: _.map(this.conditions(), function(oItem) {
|
||||
return oItem.toJson();
|
||||
}),
|
||||
|
||||
|
|
@ -229,26 +224,26 @@
|
|||
Keep: this.actionKeep() ? '1' : '0',
|
||||
MarkAsRead: this.actionMarkAsRead() ? '1' : '0'
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
FilterModel.prototype.addCondition = function ()
|
||||
{
|
||||
FilterModel.prototype.addCondition = function()
|
||||
{
|
||||
this.conditions.push(new FilterConditionModel());
|
||||
};
|
||||
};
|
||||
|
||||
FilterModel.prototype.removeCondition = function (oConditionToDelete)
|
||||
{
|
||||
FilterModel.prototype.removeCondition = function(oConditionToDelete)
|
||||
{
|
||||
this.conditions.remove(oConditionToDelete);
|
||||
Utils.delegateRunOnDestroy(oConditionToDelete);
|
||||
};
|
||||
};
|
||||
|
||||
FilterModel.prototype.setRecipients = function ()
|
||||
{
|
||||
FilterModel.prototype.setRecipients = function()
|
||||
{
|
||||
this.actionValueFourth(require('Stores/User/Account').accountsEmails().join(', '));
|
||||
};
|
||||
};
|
||||
|
||||
FilterModel.prototype.parse = function (oItem)
|
||||
{
|
||||
FilterModel.prototype.parse = function(oItem)
|
||||
{
|
||||
var bResult = false;
|
||||
if (oItem && 'Object/Filter' === oItem['@Object'])
|
||||
{
|
||||
|
|
@ -262,7 +257,7 @@
|
|||
|
||||
if (Utils.isNonEmptyArray(oItem.Conditions))
|
||||
{
|
||||
this.conditions(_.compact(_.map(oItem.Conditions, function (aData) {
|
||||
this.conditions(_.compact(_.map(oItem.Conditions, function(aData) {
|
||||
var oFilterCondition = new FilterConditionModel();
|
||||
return oFilterCondition && oFilterCondition.parse(aData) ?
|
||||
oFilterCondition : null;
|
||||
|
|
@ -284,10 +279,10 @@
|
|||
}
|
||||
|
||||
return bResult;
|
||||
};
|
||||
};
|
||||
|
||||
FilterModel.prototype.cloneSelf = function ()
|
||||
{
|
||||
FilterModel.prototype.cloneSelf = function()
|
||||
{
|
||||
var oClone = new FilterModel();
|
||||
|
||||
oClone.id = this.id;
|
||||
|
|
@ -313,13 +308,11 @@
|
|||
oClone.actionKeep(this.actionKeep());
|
||||
oClone.actionNoStop(this.actionNoStop());
|
||||
|
||||
oClone.conditions(_.map(this.conditions(), function (oCondition) {
|
||||
oClone.conditions(_.map(this.conditions(), function(oCondition) {
|
||||
return oCondition.cloneSelf();
|
||||
}));
|
||||
|
||||
return oClone;
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = FilterModel;
|
||||
|
||||
}());
|
||||
module.exports = FilterModel;
|
||||
|
|
|
|||
|
|
@ -1,23 +1,18 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
|
||||
AbstractModel = require('Knoin/AbstractModel')
|
||||
;
|
||||
AbstractModel = require('Knoin/AbstractModel');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function FilterConditionModel()
|
||||
{
|
||||
function FilterConditionModel()
|
||||
{
|
||||
AbstractModel.call(this, 'FilterConditionModel');
|
||||
|
||||
this.field = ko.observable(Enums.FilterConditionField.From);
|
||||
|
|
@ -28,7 +23,7 @@
|
|||
this.valueSecond = ko.observable('');
|
||||
this.valueSecond.error = ko.observable(false);
|
||||
|
||||
this.template = ko.computed(function () {
|
||||
this.template = ko.computed(function() {
|
||||
|
||||
var sTemplate = '';
|
||||
switch (this.field())
|
||||
|
|
@ -48,18 +43,18 @@
|
|||
|
||||
}, this);
|
||||
|
||||
this.field.subscribe(function () {
|
||||
this.field.subscribe(function() {
|
||||
this.value('');
|
||||
this.valueSecond('');
|
||||
}, this);
|
||||
|
||||
this.regDisposables([this.template]);
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(FilterConditionModel.prototype, AbstractModel.prototype);
|
||||
_.extend(FilterConditionModel.prototype, AbstractModel.prototype);
|
||||
|
||||
FilterConditionModel.prototype.verify = function ()
|
||||
{
|
||||
FilterConditionModel.prototype.verify = function()
|
||||
{
|
||||
if ('' === this.value())
|
||||
{
|
||||
this.value.error(true);
|
||||
|
|
@ -73,10 +68,10 @@
|
|||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
FilterConditionModel.prototype.parse = function (oItem)
|
||||
{
|
||||
FilterConditionModel.prototype.parse = function(oItem)
|
||||
{
|
||||
if (oItem && oItem.Field && oItem.Type)
|
||||
{
|
||||
this.field(Utils.pString(oItem.Field));
|
||||
|
|
@ -88,20 +83,20 @@
|
|||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
};
|
||||
|
||||
FilterConditionModel.prototype.toJson = function ()
|
||||
{
|
||||
FilterConditionModel.prototype.toJson = function()
|
||||
{
|
||||
return {
|
||||
Field: this.field(),
|
||||
Type: this.type(),
|
||||
Value: this.value(),
|
||||
ValueSecond: this.valueSecond()
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
FilterConditionModel.prototype.cloneSelf = function ()
|
||||
{
|
||||
FilterConditionModel.prototype.cloneSelf = function()
|
||||
{
|
||||
var oClone = new FilterConditionModel();
|
||||
|
||||
oClone.field(this.field());
|
||||
|
|
@ -110,8 +105,6 @@
|
|||
oClone.valueSecond(this.valueSecond());
|
||||
|
||||
return oClone;
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = FilterConditionModel;
|
||||
|
||||
}());
|
||||
module.exports = FilterConditionModel;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
|
|
@ -14,14 +10,13 @@
|
|||
|
||||
Cache = require('Common/Cache'),
|
||||
|
||||
AbstractModel = require('Knoin/AbstractModel')
|
||||
;
|
||||
AbstractModel = require('Knoin/AbstractModel');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function FolderModel()
|
||||
{
|
||||
function FolderModel()
|
||||
{
|
||||
AbstractModel.call(this, 'FolderModel');
|
||||
|
||||
this.name = ko.observable('');
|
||||
|
|
@ -54,75 +49,73 @@
|
|||
this.privateMessageCountUnread = ko.observable(0);
|
||||
|
||||
this.collapsedPrivate = ko.observable(true);
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(FolderModel.prototype, AbstractModel.prototype);
|
||||
_.extend(FolderModel.prototype, AbstractModel.prototype);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @static
|
||||
* @param {AjaxJsonFolder} oJsonFolder
|
||||
* @return {?FolderModel}
|
||||
* @returns {?FolderModel}
|
||||
*/
|
||||
FolderModel.newInstanceFromJson = function (oJsonFolder)
|
||||
{
|
||||
FolderModel.newInstanceFromJson = function(oJsonFolder)
|
||||
{
|
||||
var oFolderModel = new FolderModel();
|
||||
return oFolderModel.initByJson(oJsonFolder) ? oFolderModel.initComputed() : null;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {FolderModel}
|
||||
/**
|
||||
* @returns {FolderModel}
|
||||
*/
|
||||
FolderModel.prototype.initComputed = function ()
|
||||
{
|
||||
FolderModel.prototype.initComputed = function()
|
||||
{
|
||||
var sInboxFolderName = Cache.getFolderInboxName();
|
||||
|
||||
this.isInbox = ko.computed(function () {
|
||||
this.isInbox = ko.computed(function() {
|
||||
return Enums.FolderType.Inbox === this.type();
|
||||
}, this);
|
||||
|
||||
this.hasSubScribedSubfolders = ko.computed(function () {
|
||||
return !!_.find(this.subFolders(), function (oFolder) {
|
||||
this.hasSubScribedSubfolders = ko.computed(function() {
|
||||
return !!_.find(this.subFolders(), function(oFolder) {
|
||||
return (oFolder.subScribed() || oFolder.hasSubScribedSubfolders()) && !oFolder.isSystemFolder();
|
||||
});
|
||||
}, this);
|
||||
|
||||
this.canBeEdited = ko.computed(function () {
|
||||
this.canBeEdited = ko.computed(function() {
|
||||
return Enums.FolderType.User === this.type() && this.existen && this.selectable;
|
||||
}, this);
|
||||
|
||||
this.visible = ko.computed(function () {
|
||||
this.visible = ko.computed(function() {
|
||||
|
||||
var
|
||||
bSubScribed = this.subScribed(),
|
||||
bSubFolders = this.hasSubScribedSubfolders()
|
||||
;
|
||||
bSubFolders = this.hasSubScribedSubfolders();
|
||||
|
||||
return (bSubScribed || (bSubFolders && (!this.existen || !this.selectable)));
|
||||
|
||||
}, this);
|
||||
|
||||
this.isSystemFolder = ko.computed(function () {
|
||||
this.isSystemFolder = ko.computed(function() {
|
||||
return Enums.FolderType.User !== this.type();
|
||||
}, this);
|
||||
|
||||
this.hidden = ko.computed(function () {
|
||||
this.hidden = ko.computed(function() {
|
||||
|
||||
var
|
||||
bSystem = this.isSystemFolder(),
|
||||
bSubFolders = this.hasSubScribedSubfolders()
|
||||
;
|
||||
bSubFolders = this.hasSubScribedSubfolders();
|
||||
|
||||
return (bSystem && !bSubFolders) || (!this.selectable && !bSubFolders);
|
||||
|
||||
}, this);
|
||||
|
||||
this.selectableForFolderList = ko.computed(function () {
|
||||
this.selectableForFolderList = ko.computed(function() {
|
||||
return !this.isSystemFolder() && this.selectable;
|
||||
}, this);
|
||||
|
||||
this.messageCountAll = ko.computed({
|
||||
'read': this.privateMessageCountAll,
|
||||
'write': function (iValue) {
|
||||
'write': function(iValue) {
|
||||
if (Utils.isPosNumeric(iValue, true))
|
||||
{
|
||||
this.privateMessageCountAll(iValue);
|
||||
|
|
@ -137,7 +130,7 @@
|
|||
|
||||
this.messageCountUnread = ko.computed({
|
||||
'read': this.privateMessageCountUnread,
|
||||
'write': function (iValue) {
|
||||
'write': function(iValue) {
|
||||
if (Utils.isPosNumeric(iValue, true))
|
||||
{
|
||||
this.privateMessageCountUnread(iValue);
|
||||
|
|
@ -150,12 +143,11 @@
|
|||
'owner': this
|
||||
}).extend({'notify': 'always'});
|
||||
|
||||
this.printableUnreadCount = ko.computed(function () {
|
||||
this.printableUnreadCount = ko.computed(function() {
|
||||
var
|
||||
iCount = this.messageCountAll(),
|
||||
iUnread = this.messageCountUnread(),
|
||||
iType = this.type()
|
||||
;
|
||||
iType = this.type();
|
||||
|
||||
if (0 < iCount)
|
||||
{
|
||||
|
|
@ -173,33 +165,31 @@
|
|||
|
||||
}, this);
|
||||
|
||||
this.canBeDeleted = ko.computed(function () {
|
||||
this.canBeDeleted = ko.computed(function() {
|
||||
var
|
||||
bSystem = this.isSystemFolder()
|
||||
;
|
||||
bSystem = this.isSystemFolder();
|
||||
return !bSystem && 0 === this.subFolders().length && sInboxFolderName !== this.fullNameRaw;
|
||||
}, this);
|
||||
|
||||
this.canBeSubScribed = ko.computed(function () {
|
||||
this.canBeSubScribed = ko.computed(function() {
|
||||
return !this.isSystemFolder() && this.selectable && sInboxFolderName !== this.fullNameRaw;
|
||||
}, this);
|
||||
|
||||
this.canBeChecked = this.canBeSubScribed;
|
||||
|
||||
// this.visible.subscribe(function () {
|
||||
// Utils.timeOutAction('folder-list-folder-visibility-change', function () {
|
||||
// this.visible.subscribe(function() {
|
||||
// Utils.timeOutAction('folder-list-folder-visibility-change', function() {
|
||||
// Globals.$win.trigger('folder-list-folder-visibility-change');
|
||||
// }, 100);
|
||||
// });
|
||||
|
||||
this.localName = ko.computed(function () {
|
||||
this.localName = ko.computed(function() {
|
||||
|
||||
Translator.trigger();
|
||||
|
||||
var
|
||||
iType = this.type(),
|
||||
sName = this.name()
|
||||
;
|
||||
sName = this.name();
|
||||
|
||||
if (this.isSystemFolder())
|
||||
{
|
||||
|
|
@ -223,6 +213,7 @@
|
|||
case Enums.FolderType.Archive:
|
||||
sName = Translator.i18n('FOLDER_LIST/ARCHIVE_NAME');
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -230,15 +221,14 @@
|
|||
|
||||
}, this);
|
||||
|
||||
this.manageFolderSystemName = ko.computed(function () {
|
||||
this.manageFolderSystemName = ko.computed(function() {
|
||||
|
||||
Translator.trigger();
|
||||
|
||||
var
|
||||
sSuffix = '',
|
||||
iType = this.type(),
|
||||
sName = this.name()
|
||||
;
|
||||
sName = this.name();
|
||||
|
||||
if (this.isSystemFolder())
|
||||
{
|
||||
|
|
@ -262,6 +252,7 @@
|
|||
case Enums.FolderType.Archive:
|
||||
sSuffix = '(' + Translator.i18n('FOLDER_LIST/ARCHIVE_NAME') + ')';
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -275,38 +266,38 @@
|
|||
}, this);
|
||||
|
||||
this.collapsed = ko.computed({
|
||||
'read': function () {
|
||||
'read': function() {
|
||||
return !this.hidden() && this.collapsedPrivate();
|
||||
},
|
||||
'write': function (mValue) {
|
||||
'write': function(mValue) {
|
||||
this.collapsedPrivate(mValue);
|
||||
},
|
||||
'owner': this
|
||||
});
|
||||
|
||||
this.hasUnreadMessages = ko.computed(function () {
|
||||
this.hasUnreadMessages = ko.computed(function() {
|
||||
return 0 < this.messageCountUnread() && '' !== this.printableUnreadCount();
|
||||
}, this);
|
||||
|
||||
this.hasSubScribedUnreadMessagesSubfolders = ko.computed(function () {
|
||||
return !!_.find(this.subFolders(), function (oFolder) {
|
||||
this.hasSubScribedUnreadMessagesSubfolders = ko.computed(function() {
|
||||
return !!_.find(this.subFolders(), function(oFolder) {
|
||||
return oFolder.hasUnreadMessages() || oFolder.hasSubScribedUnreadMessagesSubfolders();
|
||||
});
|
||||
}, this);
|
||||
|
||||
// subscribe
|
||||
this.name.subscribe(function (sValue) {
|
||||
this.name.subscribe(function(sValue) {
|
||||
this.nameForEdit(sValue);
|
||||
}, this);
|
||||
|
||||
this.edited.subscribe(function (bValue) {
|
||||
this.edited.subscribe(function(bValue) {
|
||||
if (bValue)
|
||||
{
|
||||
this.nameForEdit(this.name());
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.messageCountUnread.subscribe(function (iUnread) {
|
||||
this.messageCountUnread.subscribe(function(iUnread) {
|
||||
if (Enums.FolderType.Inbox === this.type())
|
||||
{
|
||||
Events.pub('mailbox.inbox-unread-count', [iUnread]);
|
||||
|
|
@ -314,35 +305,34 @@
|
|||
}, this);
|
||||
|
||||
return this;
|
||||
};
|
||||
};
|
||||
|
||||
FolderModel.prototype.fullName = '';
|
||||
FolderModel.prototype.fullNameRaw = '';
|
||||
FolderModel.prototype.fullNameHash = '';
|
||||
FolderModel.prototype.delimiter = '';
|
||||
FolderModel.prototype.namespace = '';
|
||||
FolderModel.prototype.deep = 0;
|
||||
FolderModel.prototype.interval = 0;
|
||||
FolderModel.prototype.fullName = '';
|
||||
FolderModel.prototype.fullNameRaw = '';
|
||||
FolderModel.prototype.fullNameHash = '';
|
||||
FolderModel.prototype.delimiter = '';
|
||||
FolderModel.prototype.namespace = '';
|
||||
FolderModel.prototype.deep = 0;
|
||||
FolderModel.prototype.interval = 0;
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
FolderModel.prototype.collapsedCss = function ()
|
||||
{
|
||||
FolderModel.prototype.collapsedCss = function()
|
||||
{
|
||||
return this.hasSubScribedSubfolders() ?
|
||||
(this.collapsed() ? 'icon-right-mini e-collapsed-sign' : 'icon-down-mini e-collapsed-sign') : 'icon-none e-collapsed-sign';
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {AjaxJsonFolder} oJsonFolder
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
FolderModel.prototype.initByJson = function (oJsonFolder)
|
||||
{
|
||||
FolderModel.prototype.initByJson = function(oJsonFolder)
|
||||
{
|
||||
var
|
||||
bResult = false,
|
||||
sInboxFolderName = Cache.getFolderInboxName()
|
||||
;
|
||||
sInboxFolderName = Cache.getFolderInboxName();
|
||||
|
||||
if (oJsonFolder && 'Object/Folder' === oJsonFolder['@Object'])
|
||||
{
|
||||
|
|
@ -364,16 +354,14 @@
|
|||
}
|
||||
|
||||
return bResult;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
FolderModel.prototype.printableFullName = function ()
|
||||
{
|
||||
FolderModel.prototype.printableFullName = function()
|
||||
{
|
||||
return this.fullName.split(this.delimiter).join(' / ');
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = FolderModel;
|
||||
|
||||
}());
|
||||
module.exports = FolderModel;
|
||||
|
|
|
|||
|
|
@ -1,22 +1,17 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
AbstractModel = require('Knoin/AbstractModel')
|
||||
;
|
||||
AbstractModel = require('Knoin/AbstractModel');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
* @param {string} sId
|
||||
* @param {string} sEmail
|
||||
* @constructor
|
||||
*/
|
||||
function IdentityModel(sId, sEmail)
|
||||
{
|
||||
function IdentityModel(sId, sEmail)
|
||||
{
|
||||
AbstractModel.call(this, 'IdentityModel');
|
||||
|
||||
this.id = ko.observable(sId || '');
|
||||
|
|
@ -30,23 +25,20 @@
|
|||
this.signatureInsertBefore = ko.observable(false);
|
||||
|
||||
this.deleteAccess = ko.observable(false);
|
||||
this.canBeDeleted = ko.computed(function () {
|
||||
this.canBeDeleted = ko.computed(function() {
|
||||
return '' !== this.id();
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(IdentityModel.prototype, AbstractModel.prototype);
|
||||
_.extend(IdentityModel.prototype, AbstractModel.prototype);
|
||||
|
||||
IdentityModel.prototype.formattedName = function ()
|
||||
{
|
||||
IdentityModel.prototype.formattedName = function()
|
||||
{
|
||||
var
|
||||
sName = this.name(),
|
||||
sEmail = this.email()
|
||||
;
|
||||
sEmail = this.email();
|
||||
|
||||
return ('' !== sName) ? sName + ' (' + sEmail + ')' : sEmail;
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = IdentityModel;
|
||||
|
||||
}());
|
||||
module.exports = IdentityModel;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
$ = require('$'),
|
||||
ko = require('ko'),
|
||||
|
|
@ -17,14 +13,13 @@
|
|||
|
||||
MessageHelper = require('Helper/Message').default,
|
||||
|
||||
AbstractModel = require('Knoin/AbstractModel')
|
||||
;
|
||||
AbstractModel = require('Knoin/AbstractModel');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function MessageModel()
|
||||
{
|
||||
function MessageModel()
|
||||
{
|
||||
AbstractModel.call(this, 'MessageModel');
|
||||
|
||||
this.folderFullNameRaw = '';
|
||||
|
|
@ -73,7 +68,7 @@
|
|||
this.hasAttachments = ko.observable(false);
|
||||
this.attachmentsSpecData = ko.observableArray([]);
|
||||
|
||||
this.attachmentIconClass = ko.computed(function () {
|
||||
this.attachmentIconClass = ko.computed(function() {
|
||||
return AttachmentModel.staticCombinedIconClass(
|
||||
this.hasAttachments() ? this.attachmentsSpecData() : []);
|
||||
}, this);
|
||||
|
|
@ -102,32 +97,32 @@
|
|||
|
||||
this.threads = ko.observableArray([]);
|
||||
|
||||
this.threadsLen = ko.computed(function () {
|
||||
this.threadsLen = ko.computed(function() {
|
||||
return this.threads().length;
|
||||
}, this);
|
||||
|
||||
this.isImportant = ko.computed(function () {
|
||||
this.isImportant = ko.computed(function() {
|
||||
return Enums.MessagePriority.High === this.priority();
|
||||
}, this);
|
||||
|
||||
this.regDisposables([this.attachmentIconClass, this.threadsLen, this.isImportant]);
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(MessageModel.prototype, AbstractModel.prototype);
|
||||
_.extend(MessageModel.prototype, AbstractModel.prototype);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @static
|
||||
* @param {AjaxJsonMessage} oJsonMessage
|
||||
* @return {?MessageModel}
|
||||
* @returns {?MessageModel}
|
||||
*/
|
||||
MessageModel.newInstanceFromJson = function (oJsonMessage)
|
||||
{
|
||||
MessageModel.newInstanceFromJson = function(oJsonMessage)
|
||||
{
|
||||
var oMessageModel = new MessageModel();
|
||||
return oMessageModel.initByJson(oJsonMessage) ? oMessageModel : null;
|
||||
};
|
||||
};
|
||||
|
||||
MessageModel.prototype.clear = function ()
|
||||
{
|
||||
MessageModel.prototype.clear = function()
|
||||
{
|
||||
this.folderFullNameRaw = '';
|
||||
this.uid = '';
|
||||
this.hash = '';
|
||||
|
|
@ -193,62 +188,60 @@
|
|||
|
||||
this.hasUnseenSubMessage(false);
|
||||
this.hasFlaggedSubMessage(false);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {Array}
|
||||
/**
|
||||
* @returns {Array}
|
||||
*/
|
||||
MessageModel.prototype.getRecipientsEmails = function ()
|
||||
{
|
||||
MessageModel.prototype.getRecipientsEmails = function()
|
||||
{
|
||||
return this.getEmails(['to', 'cc']);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Array} aProperties
|
||||
* @return {Array}
|
||||
* @returns {Array}
|
||||
*/
|
||||
MessageModel.prototype.getEmails = function (aProperties)
|
||||
{
|
||||
MessageModel.prototype.getEmails = function(aProperties)
|
||||
{
|
||||
var self = this;
|
||||
return _.compact(_.uniq(_.map(_.reduce(aProperties, function (aCarry, sProperty) {
|
||||
return _.compact(_.uniq(_.map(_.reduce(aProperties, function(aCarry, sProperty) {
|
||||
return aCarry.concat(self[sProperty]);
|
||||
}, []), function (oItem) {
|
||||
}, []), function(oItem) {
|
||||
return oItem ? oItem.email : '';
|
||||
})));
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
MessageModel.prototype.friendlySize = function ()
|
||||
{
|
||||
MessageModel.prototype.friendlySize = function()
|
||||
{
|
||||
return Utils.friendlySize(this.size());
|
||||
};
|
||||
};
|
||||
|
||||
MessageModel.prototype.computeSenderEmail = function ()
|
||||
{
|
||||
MessageModel.prototype.computeSenderEmail = function()
|
||||
{
|
||||
var
|
||||
sSent = require('Stores/User/Folder').sentFolder(),
|
||||
sDraft = require('Stores/User/Folder').draftFolder()
|
||||
;
|
||||
sDraft = require('Stores/User/Folder').draftFolder();
|
||||
|
||||
this.senderEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
|
||||
this.toEmailsString() : this.fromEmailString());
|
||||
|
||||
this.senderClearEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
|
||||
this.toClearEmailsString() : this.fromClearEmailString());
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {AjaxJsonMessage} oJsonMessage
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
MessageModel.prototype.initByJson = function (oJsonMessage)
|
||||
{
|
||||
MessageModel.prototype.initByJson = function(oJsonMessage)
|
||||
{
|
||||
var
|
||||
bResult = false,
|
||||
iPriority = Enums.MessagePriority.Normal
|
||||
;
|
||||
iPriority = Enums.MessagePriority.Normal;
|
||||
|
||||
if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
|
||||
{
|
||||
|
|
@ -303,18 +296,17 @@
|
|||
}
|
||||
|
||||
return bResult;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {AjaxJsonMessage} oJsonMessage
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
|
||||
{
|
||||
MessageModel.prototype.initUpdateByMessageJson = function(oJsonMessage)
|
||||
{
|
||||
var
|
||||
bResult = false,
|
||||
iPriority = Enums.MessagePriority.Normal
|
||||
;
|
||||
iPriority = Enums.MessagePriority.Normal;
|
||||
|
||||
if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
|
||||
{
|
||||
|
|
@ -351,20 +343,19 @@
|
|||
}
|
||||
|
||||
return bResult;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {(AjaxJsonAttachment|null)} oJsonAttachments
|
||||
* @return {Array}
|
||||
* @returns {Array}
|
||||
*/
|
||||
MessageModel.prototype.initAttachmentsFromJson = function (oJsonAttachments)
|
||||
{
|
||||
MessageModel.prototype.initAttachmentsFromJson = function(oJsonAttachments)
|
||||
{
|
||||
var
|
||||
iIndex = 0,
|
||||
iLen = 0,
|
||||
oAttachmentModel = null,
|
||||
aResult = []
|
||||
;
|
||||
aResult = [];
|
||||
|
||||
if (oJsonAttachments && 'Collection/AttachmentCollection' === oJsonAttachments['@Object'] &&
|
||||
Utils.isNonEmptyArray(oJsonAttachments['@Collection']))
|
||||
|
|
@ -386,14 +377,14 @@
|
|||
}
|
||||
|
||||
return aResult;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {AjaxJsonMessage} oJsonMessage
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
MessageModel.prototype.initFlagsByJson = function (oJsonMessage)
|
||||
{
|
||||
MessageModel.prototype.initFlagsByJson = function(oJsonMessage)
|
||||
{
|
||||
var bResult = false;
|
||||
|
||||
if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
|
||||
|
|
@ -409,23 +400,23 @@
|
|||
}
|
||||
|
||||
return bResult;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {boolean} bFriendlyView
|
||||
* @param {boolean=} bWrapWithLink = false
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
MessageModel.prototype.fromToLine = function (bFriendlyView, bWrapWithLink)
|
||||
{
|
||||
MessageModel.prototype.fromToLine = function(bFriendlyView, bWrapWithLink)
|
||||
{
|
||||
return MessageHelper.emailArrayToString(this.from, bFriendlyView, bWrapWithLink);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
MessageModel.prototype.fromDkimData = function ()
|
||||
{
|
||||
MessageModel.prototype.fromDkimData = function()
|
||||
{
|
||||
var aResult = ['none', ''];
|
||||
if (Utils.isNonEmptyArray(this.from) && 1 === this.from.length &&
|
||||
this.from[0] && this.from[0].dkimStatus)
|
||||
|
|
@ -434,53 +425,53 @@
|
|||
}
|
||||
|
||||
return aResult;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {boolean} bFriendlyView
|
||||
* @param {boolean=} bWrapWithLink = false
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
MessageModel.prototype.toToLine = function (bFriendlyView, bWrapWithLink)
|
||||
{
|
||||
MessageModel.prototype.toToLine = function(bFriendlyView, bWrapWithLink)
|
||||
{
|
||||
return MessageHelper.emailArrayToString(this.to, bFriendlyView, bWrapWithLink);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {boolean} bFriendlyView
|
||||
* @param {boolean=} bWrapWithLink = false
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
MessageModel.prototype.ccToLine = function (bFriendlyView, bWrapWithLink)
|
||||
{
|
||||
MessageModel.prototype.ccToLine = function(bFriendlyView, bWrapWithLink)
|
||||
{
|
||||
return MessageHelper.emailArrayToString(this.cc, bFriendlyView, bWrapWithLink);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {boolean} bFriendlyView
|
||||
* @param {boolean=} bWrapWithLink = false
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
MessageModel.prototype.bccToLine = function (bFriendlyView, bWrapWithLink)
|
||||
{
|
||||
MessageModel.prototype.bccToLine = function(bFriendlyView, bWrapWithLink)
|
||||
{
|
||||
return MessageHelper.emailArrayToString(this.bcc, bFriendlyView, bWrapWithLink);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {boolean} bFriendlyView
|
||||
* @param {boolean=} bWrapWithLink = false
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
MessageModel.prototype.replyToToLine = function (bFriendlyView, bWrapWithLink)
|
||||
{
|
||||
MessageModel.prototype.replyToToLine = function(bFriendlyView, bWrapWithLink)
|
||||
{
|
||||
return MessageHelper.emailArrayToString(this.replyTo, bFriendlyView, bWrapWithLink);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
MessageModel.prototype.lineAsCss = function ()
|
||||
{
|
||||
MessageModel.prototype.lineAsCss = function()
|
||||
{
|
||||
var aResult = [];
|
||||
if (this.deleted())
|
||||
{
|
||||
|
|
@ -548,121 +539,118 @@
|
|||
}
|
||||
|
||||
return aResult.join(' ');
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
MessageModel.prototype.hasVisibleAttachments = function ()
|
||||
{
|
||||
return !!_.find(this.attachments(), function (oAttachment) {
|
||||
MessageModel.prototype.hasVisibleAttachments = function()
|
||||
{
|
||||
return !!_.find(this.attachments(), function(oAttachment) {
|
||||
return !oAttachment.isLinked;
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {string} sCid
|
||||
* @return {*}
|
||||
* @returns {*}
|
||||
*/
|
||||
MessageModel.prototype.findAttachmentByCid = function (sCid)
|
||||
{
|
||||
MessageModel.prototype.findAttachmentByCid = function(sCid)
|
||||
{
|
||||
var
|
||||
oResult = null,
|
||||
aAttachments = this.attachments()
|
||||
;
|
||||
aAttachments = this.attachments();
|
||||
|
||||
if (Utils.isNonEmptyArray(aAttachments))
|
||||
{
|
||||
sCid = sCid.replace(/^<+/, '').replace(/>+$/, '');
|
||||
oResult = _.find(aAttachments, function (oAttachment) {
|
||||
oResult = _.find(aAttachments, function(oAttachment) {
|
||||
return sCid === oAttachment.cidWithOutTags;
|
||||
});
|
||||
}
|
||||
|
||||
return oResult || null;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {string} sContentLocation
|
||||
* @return {*}
|
||||
* @returns {*}
|
||||
*/
|
||||
MessageModel.prototype.findAttachmentByContentLocation = function (sContentLocation)
|
||||
{
|
||||
MessageModel.prototype.findAttachmentByContentLocation = function(sContentLocation)
|
||||
{
|
||||
var
|
||||
oResult = null,
|
||||
aAttachments = this.attachments()
|
||||
;
|
||||
aAttachments = this.attachments();
|
||||
|
||||
if (Utils.isNonEmptyArray(aAttachments))
|
||||
{
|
||||
oResult = _.find(aAttachments, function (oAttachment) {
|
||||
oResult = _.find(aAttachments, function(oAttachment) {
|
||||
return sContentLocation === oAttachment.contentLocation;
|
||||
});
|
||||
}
|
||||
|
||||
return oResult || null;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
MessageModel.prototype.messageId = function ()
|
||||
{
|
||||
MessageModel.prototype.messageId = function()
|
||||
{
|
||||
return this.sMessageId;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
MessageModel.prototype.inReplyTo = function ()
|
||||
{
|
||||
MessageModel.prototype.inReplyTo = function()
|
||||
{
|
||||
return this.sInReplyTo;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
MessageModel.prototype.references = function ()
|
||||
{
|
||||
MessageModel.prototype.references = function()
|
||||
{
|
||||
return this.sReferences;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
MessageModel.prototype.fromAsSingleEmail = function ()
|
||||
{
|
||||
MessageModel.prototype.fromAsSingleEmail = function()
|
||||
{
|
||||
return Utils.isArray(this.from) && this.from[0] ? this.from[0].email : '';
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
MessageModel.prototype.viewLink = function ()
|
||||
{
|
||||
MessageModel.prototype.viewLink = function()
|
||||
{
|
||||
return Links.messageViewLink(this.requestHash);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
MessageModel.prototype.downloadLink = function ()
|
||||
{
|
||||
MessageModel.prototype.downloadLink = function()
|
||||
{
|
||||
return Links.messageDownloadLink(this.requestHash);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Object} oExcludeEmails
|
||||
* @param {boolean=} bLast = false
|
||||
* @return {Array}
|
||||
* @returns {Array}
|
||||
*/
|
||||
MessageModel.prototype.replyEmails = function (oExcludeEmails, bLast)
|
||||
{
|
||||
MessageModel.prototype.replyEmails = function(oExcludeEmails, bLast)
|
||||
{
|
||||
var
|
||||
aResult = [],
|
||||
oUnic = Utils.isUnd(oExcludeEmails) ? {} : oExcludeEmails
|
||||
;
|
||||
oUnic = Utils.isUnd(oExcludeEmails) ? {} : oExcludeEmails;
|
||||
|
||||
MessageHelper.replyHelper(this.replyTo, oUnic, aResult);
|
||||
if (0 === aResult.length)
|
||||
|
|
@ -676,21 +664,20 @@
|
|||
}
|
||||
|
||||
return aResult;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Object} oExcludeEmails
|
||||
* @param {boolean=} bLast = false
|
||||
* @return {Array.<Array>}
|
||||
* @returns {Array.<Array>}
|
||||
*/
|
||||
MessageModel.prototype.replyAllEmails = function (oExcludeEmails, bLast)
|
||||
{
|
||||
MessageModel.prototype.replyAllEmails = function(oExcludeEmails, bLast)
|
||||
{
|
||||
var
|
||||
aData = [],
|
||||
aToResult = [],
|
||||
aCcResult = [],
|
||||
oUnic = Utils.isUnd(oExcludeEmails) ? {} : oExcludeEmails
|
||||
;
|
||||
oUnic = Utils.isUnd(oExcludeEmails) ? {} : oExcludeEmails;
|
||||
|
||||
MessageHelper.replyHelper(this.replyTo, oUnic, aToResult);
|
||||
if (0 === aToResult.length)
|
||||
|
|
@ -708,33 +695,33 @@
|
|||
}
|
||||
|
||||
return [aToResult, aCcResult];
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
MessageModel.prototype.textBodyToString = function ()
|
||||
{
|
||||
MessageModel.prototype.textBodyToString = function()
|
||||
{
|
||||
return this.body ? this.body.html() : '';
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
MessageModel.prototype.attachmentsToStringLine = function ()
|
||||
{
|
||||
var aAttachLines = _.map(this.attachments(), function (oItem) {
|
||||
MessageModel.prototype.attachmentsToStringLine = function()
|
||||
{
|
||||
var aAttachLines = _.map(this.attachments(), function(oItem) {
|
||||
return oItem.fileName + ' (' + oItem.friendlySize + ')';
|
||||
});
|
||||
|
||||
return aAttachLines && 0 < aAttachLines.length ? aAttachLines.join(', ') : '';
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {Object}
|
||||
/**
|
||||
* @returns {Object}
|
||||
*/
|
||||
MessageModel.prototype.getDataForWindowPopup = function ()
|
||||
{
|
||||
MessageModel.prototype.getDataForWindowPopup = function()
|
||||
{
|
||||
return {
|
||||
'popupFrom': this.fromToLine(false),
|
||||
'popupTo': this.toToLine(false),
|
||||
|
|
@ -747,36 +734,36 @@
|
|||
'popupAttachments': this.attachmentsToStringLine(),
|
||||
'popupBody': this.textBodyToString()
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {boolean=} bPrint = false
|
||||
*/
|
||||
MessageModel.prototype.viewPopupMessage = function (bPrint)
|
||||
{
|
||||
MessageModel.prototype.viewPopupMessage = function(bPrint)
|
||||
{
|
||||
this.showLazyExternalImagesInBody();
|
||||
Utils.previewMessage(this.subject(), this.body, this.isHtml(), bPrint);
|
||||
};
|
||||
};
|
||||
|
||||
MessageModel.prototype.printMessage = function ()
|
||||
{
|
||||
MessageModel.prototype.printMessage = function()
|
||||
{
|
||||
this.viewPopupMessage(true);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
MessageModel.prototype.generateUid = function ()
|
||||
{
|
||||
MessageModel.prototype.generateUid = function()
|
||||
{
|
||||
return this.folderFullNameRaw + '/' + this.uid;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {MessageModel} oMessage
|
||||
* @return {MessageModel}
|
||||
* @returns {MessageModel}
|
||||
*/
|
||||
MessageModel.prototype.populateByMessageListItem = function (oMessage)
|
||||
{
|
||||
MessageModel.prototype.populateByMessageListItem = function(oMessage)
|
||||
{
|
||||
if (oMessage)
|
||||
{
|
||||
this.folderFullNameRaw = oMessage.folderFullNameRaw;
|
||||
|
|
@ -842,20 +829,20 @@
|
|||
this.computeSenderEmail();
|
||||
|
||||
return this;
|
||||
};
|
||||
};
|
||||
|
||||
MessageModel.prototype.showLazyExternalImagesInBody = function ()
|
||||
{
|
||||
MessageModel.prototype.showLazyExternalImagesInBody = function()
|
||||
{
|
||||
if (this.body)
|
||||
{
|
||||
$('.lazy.lazy-inited[data-original]', this.body).each(function () {
|
||||
$('.lazy.lazy-inited[data-original]', this.body).each(function() {
|
||||
$(this).attr('src', $(this).attr('data-original')).removeAttr('data-original');
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
MessageModel.prototype.showExternalImages = function (bLazy)
|
||||
{
|
||||
MessageModel.prototype.showExternalImages = function(bLazy)
|
||||
{
|
||||
if (this.body && this.body.data('rl-has-images'))
|
||||
{
|
||||
bLazy = Utils.isUnd(bLazy) ? false : bLazy;
|
||||
|
|
@ -864,14 +851,13 @@
|
|||
this.body.data('rl-has-images', false);
|
||||
|
||||
var sAttr = this.proxy ? 'data-x-additional-src' : 'data-x-src';
|
||||
$('[' + sAttr + ']', this.body).each(function () {
|
||||
$('[' + sAttr + ']', this.body).each(function() {
|
||||
if (bLazy && $(this).is('img'))
|
||||
{
|
||||
$(this)
|
||||
.addClass('lazy')
|
||||
.attr('data-original', $(this).attr(sAttr))
|
||||
.removeAttr(sAttr)
|
||||
;
|
||||
.removeAttr(sAttr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -880,7 +866,7 @@
|
|||
});
|
||||
|
||||
sAttr = this.proxy ? 'data-x-additional-style-url' : 'data-x-style-url';
|
||||
$('[' + sAttr + ']', this.body).each(function () {
|
||||
$('[' + sAttr + ']', this.body).each(function() {
|
||||
var sStyle = Utils.trim($(this).attr('style'));
|
||||
sStyle = '' === sStyle ? '' : (';' === sStyle.substr(-1) ? sStyle + ' ' : sStyle + '; ');
|
||||
$(this).attr('style', sStyle + $(this).attr(sAttr)).removeAttr(sAttr);
|
||||
|
|
@ -900,10 +886,10 @@
|
|||
|
||||
Utils.windowResize(500);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
MessageModel.prototype.showInternalImages = function (bLazy)
|
||||
{
|
||||
MessageModel.prototype.showInternalImages = function(bLazy)
|
||||
{
|
||||
if (this.body && !this.body.data('rl-init-internal-images'))
|
||||
{
|
||||
this.body.data('rl-init-internal-images', true);
|
||||
|
|
@ -912,7 +898,7 @@
|
|||
|
||||
var self = this;
|
||||
|
||||
$('[data-x-src-cid]', this.body).each(function () {
|
||||
$('[data-x-src-cid]', this.body).each(function() {
|
||||
|
||||
var oAttachment = self.findAttachmentByCid($(this).attr('data-x-src-cid'));
|
||||
if (oAttachment && oAttachment.download)
|
||||
|
|
@ -930,7 +916,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
$('[data-x-src-location]', this.body).each(function () {
|
||||
$('[data-x-src-location]', this.body).each(function() {
|
||||
|
||||
var oAttachment = self.findAttachmentByContentLocation($(this).attr('data-x-src-location'));
|
||||
if (!oAttachment)
|
||||
|
|
@ -953,13 +939,12 @@
|
|||
}
|
||||
});
|
||||
|
||||
$('[data-x-style-cid]', this.body).each(function () {
|
||||
$('[data-x-style-cid]', this.body).each(function() {
|
||||
|
||||
var
|
||||
sStyle = '',
|
||||
sName = '',
|
||||
oAttachment = self.findAttachmentByCid($(this).attr('data-x-style-cid'))
|
||||
;
|
||||
oAttachment = self.findAttachmentByCid($(this).attr('data-x-style-cid'));
|
||||
|
||||
if (oAttachment && oAttachment.linkPreview)
|
||||
{
|
||||
|
|
@ -975,8 +960,8 @@
|
|||
|
||||
if (bLazy)
|
||||
{
|
||||
(function ($oImg, oContainer) {
|
||||
_.delay(function () {
|
||||
(function($oImg, oContainer) {
|
||||
_.delay(function() {
|
||||
$oImg.addClass('lazy-inited').lazyload({
|
||||
'threshold': 400,
|
||||
'effect': 'fadeIn',
|
||||
|
|
@ -989,43 +974,41 @@
|
|||
|
||||
Utils.windowResize(500);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
MessageModel.prototype.storeDataInDom = function ()
|
||||
{
|
||||
MessageModel.prototype.storeDataInDom = function()
|
||||
{
|
||||
if (this.body)
|
||||
{
|
||||
this.body.data('rl-is-html', !!this.isHtml());
|
||||
this.body.data('rl-has-images', !!this.hasImages());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
MessageModel.prototype.fetchDataFromDom = function ()
|
||||
{
|
||||
MessageModel.prototype.fetchDataFromDom = function()
|
||||
{
|
||||
if (this.body)
|
||||
{
|
||||
this.isHtml(!!this.body.data('rl-is-html'));
|
||||
this.hasImages(!!this.body.data('rl-has-images'));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
MessageModel.prototype.replacePlaneTextBody = function (sPlain)
|
||||
{
|
||||
MessageModel.prototype.replacePlaneTextBody = function(sPlain)
|
||||
{
|
||||
if (this.body)
|
||||
{
|
||||
this.body.html(sPlain).addClass('b-text-part plain');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
MessageModel.prototype.flagHash = function ()
|
||||
{
|
||||
MessageModel.prototype.flagHash = function()
|
||||
{
|
||||
return [this.deleted(), this.deletedMark(), this.unseen(), this.flagged(), this.answered(), this.forwarded(),
|
||||
this.isReadReceipt()].join(',');
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = MessageModel;
|
||||
|
||||
}());
|
||||
module.exports = MessageModel;
|
||||
|
|
|
|||
|
|
@ -1,37 +1,30 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
|
||||
// MessageHelper = require('Helper/Message').default,
|
||||
MessageSimpleModel = require('Model/MessageSimple');
|
||||
|
||||
MessageSimpleModel = require('Model/MessageSimple')
|
||||
;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function MessageFullModel()
|
||||
{
|
||||
function MessageFullModel()
|
||||
{
|
||||
MessageSimpleModel.call(this, 'MessageFullModel');
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(MessageFullModel.prototype, MessageSimpleModel.prototype);
|
||||
_.extend(MessageFullModel.prototype, MessageSimpleModel.prototype);
|
||||
|
||||
MessageFullModel.prototype.priority = 0;
|
||||
MessageFullModel.prototype.hash = '';
|
||||
MessageFullModel.prototype.requestHash = '';
|
||||
MessageFullModel.prototype.proxy = false;
|
||||
MessageFullModel.prototype.hasAttachments = false;
|
||||
MessageFullModel.prototype.priority = 0;
|
||||
MessageFullModel.prototype.hash = '';
|
||||
MessageFullModel.prototype.requestHash = '';
|
||||
MessageFullModel.prototype.proxy = false;
|
||||
MessageFullModel.prototype.hasAttachments = false;
|
||||
|
||||
MessageFullModel.prototype.clear = function ()
|
||||
{
|
||||
MessageFullModel.prototype.clear = function()
|
||||
{
|
||||
MessageSimpleModel.prototype.clear.call(this);
|
||||
|
||||
this.priority = 0;
|
||||
|
|
@ -41,14 +34,14 @@
|
|||
this.proxy = false;
|
||||
|
||||
this.hasAttachments = false;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {AjaxJsonMessage} oJson
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
MessageFullModel.prototype.initByJson = function (oJson)
|
||||
{
|
||||
MessageFullModel.prototype.initByJson = function(oJson)
|
||||
{
|
||||
var bResult = false;
|
||||
|
||||
if (oJson && 'Object/Message' === oJson['@Object'])
|
||||
|
|
@ -71,19 +64,17 @@
|
|||
}
|
||||
|
||||
return bResult;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @static
|
||||
* @param {AjaxJsonMessage} oJson
|
||||
* @return {?MessageFullModel}
|
||||
* @returns {?MessageFullModel}
|
||||
*/
|
||||
MessageFullModel.newInstanceFromJson = function (oJson)
|
||||
{
|
||||
MessageFullModel.newInstanceFromJson = function(oJson)
|
||||
{
|
||||
var oItem = oJson ? new MessageFullModel() : null;
|
||||
return oItem && oItem.initByJson(oJson) ? oItem : null;
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = MessageFullModel;
|
||||
|
||||
}());
|
||||
module.exports = MessageFullModel;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
|
|
@ -11,50 +7,49 @@
|
|||
|
||||
MessageHelper = require('Helper/Message').default,
|
||||
|
||||
AbstractModel = require('Knoin/AbstractModel')
|
||||
;
|
||||
AbstractModel = require('Knoin/AbstractModel');
|
||||
|
||||
/**
|
||||
* @param {string=} sSuperName
|
||||
/**
|
||||
* @constructor
|
||||
* @param {string=} sSuperName
|
||||
*/
|
||||
function MessageSimpleModel(sSuperName)
|
||||
{
|
||||
function MessageSimpleModel(sSuperName)
|
||||
{
|
||||
AbstractModel.call(this, sSuperName || 'MessageSimpleModel');
|
||||
|
||||
this.flagged = ko.observable(false);
|
||||
this.selected = ko.observable(false);
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(MessageSimpleModel.prototype, AbstractModel.prototype);
|
||||
_.extend(MessageSimpleModel.prototype, AbstractModel.prototype);
|
||||
|
||||
MessageSimpleModel.prototype.__simple_message__ = true;
|
||||
MessageSimpleModel.prototype.isSimpleMessage = true;
|
||||
|
||||
MessageSimpleModel.prototype.folder = '';
|
||||
MessageSimpleModel.prototype.folderFullNameRaw = '';
|
||||
MessageSimpleModel.prototype.folder = '';
|
||||
MessageSimpleModel.prototype.folderFullNameRaw = '';
|
||||
|
||||
MessageSimpleModel.prototype.uid = '';
|
||||
MessageSimpleModel.prototype.subject = '';
|
||||
MessageSimpleModel.prototype.uid = '';
|
||||
MessageSimpleModel.prototype.subject = '';
|
||||
|
||||
MessageSimpleModel.prototype.to = [];
|
||||
MessageSimpleModel.prototype.from = [];
|
||||
MessageSimpleModel.prototype.cc = [];
|
||||
MessageSimpleModel.prototype.bcc = [];
|
||||
MessageSimpleModel.prototype.replyTo = [];
|
||||
MessageSimpleModel.prototype.deliveredTo = [];
|
||||
MessageSimpleModel.prototype.to = [];
|
||||
MessageSimpleModel.prototype.from = [];
|
||||
MessageSimpleModel.prototype.cc = [];
|
||||
MessageSimpleModel.prototype.bcc = [];
|
||||
MessageSimpleModel.prototype.replyTo = [];
|
||||
MessageSimpleModel.prototype.deliveredTo = [];
|
||||
|
||||
MessageSimpleModel.prototype.fromAsString = '';
|
||||
MessageSimpleModel.prototype.fromAsStringClear = '';
|
||||
MessageSimpleModel.prototype.toAsString = '';
|
||||
MessageSimpleModel.prototype.toAsStringClear = '';
|
||||
MessageSimpleModel.prototype.senderAsString = '';
|
||||
MessageSimpleModel.prototype.senderAsStringClear = '';
|
||||
MessageSimpleModel.prototype.fromAsString = '';
|
||||
MessageSimpleModel.prototype.fromAsStringClear = '';
|
||||
MessageSimpleModel.prototype.toAsString = '';
|
||||
MessageSimpleModel.prototype.toAsStringClear = '';
|
||||
MessageSimpleModel.prototype.senderAsString = '';
|
||||
MessageSimpleModel.prototype.senderAsStringClear = '';
|
||||
|
||||
MessageSimpleModel.prototype.size = 0;
|
||||
MessageSimpleModel.prototype.timestamp = 0;
|
||||
MessageSimpleModel.prototype.size = 0;
|
||||
MessageSimpleModel.prototype.timestamp = 0;
|
||||
|
||||
MessageSimpleModel.prototype.clear = function ()
|
||||
{
|
||||
MessageSimpleModel.prototype.clear = function()
|
||||
{
|
||||
this.folder = '';
|
||||
this.folderFullNameRaw = '';
|
||||
|
||||
|
|
@ -81,14 +76,14 @@
|
|||
|
||||
this.flagged(false);
|
||||
this.selected(false);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Object} oJson
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
MessageSimpleModel.prototype.initByJson = function (oJson)
|
||||
{
|
||||
MessageSimpleModel.prototype.initByJson = function(oJson)
|
||||
{
|
||||
var bResult = false;
|
||||
|
||||
if (oJson && 'Object/Message' === oJson['@Object'])
|
||||
|
|
@ -136,10 +131,10 @@
|
|||
}
|
||||
|
||||
return bResult;
|
||||
};
|
||||
};
|
||||
|
||||
MessageSimpleModel.prototype.populateSenderEmail = function (bDraftOrSentFolder)
|
||||
{
|
||||
MessageSimpleModel.prototype.populateSenderEmail = function(bDraftOrSentFolder)
|
||||
{
|
||||
this.senderAsString = this.fromAsString;
|
||||
this.senderAsStringClear = this.fromAsStringClear;
|
||||
|
||||
|
|
@ -148,27 +143,25 @@
|
|||
this.senderAsString = this.toAsString;
|
||||
this.senderAsStringClear = this.toAsStringClear;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {Array}
|
||||
/**
|
||||
* @returns {Array}
|
||||
*/
|
||||
MessageSimpleModel.prototype.threads = function ()
|
||||
{
|
||||
MessageSimpleModel.prototype.threads = function()
|
||||
{
|
||||
return [];
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @static
|
||||
* @param {Object} oJson
|
||||
* @return {?MessageSimpleModel}
|
||||
* @returns {?MessageSimpleModel}
|
||||
*/
|
||||
MessageSimpleModel.newInstanceFromJson = function (oJson)
|
||||
{
|
||||
MessageSimpleModel.newInstanceFromJson = function(oJson)
|
||||
{
|
||||
var oItem = oJson ? new MessageSimpleModel() : null;
|
||||
return oItem && oItem.initByJson(oJson) ? oItem : null;
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = MessageSimpleModel;
|
||||
|
||||
}());
|
||||
module.exports = MessageSimpleModel;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
|
|
@ -11,10 +7,10 @@
|
|||
|
||||
PgpStore = require('Stores/User/Pgp'),
|
||||
|
||||
AbstractModel = require('Knoin/AbstractModel')
|
||||
;
|
||||
AbstractModel = require('Knoin/AbstractModel');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
* @param {string} iIndex
|
||||
* @param {string} sGuID
|
||||
* @param {string} sID
|
||||
|
|
@ -24,10 +20,9 @@
|
|||
* @param {boolean} bIsPrivate
|
||||
* @param {string} sArmor
|
||||
* @param {string} sUserID
|
||||
* @constructor
|
||||
*/
|
||||
function OpenPgpKeyModel(iIndex, sGuID, sID, aIDs, aUserIDs, aEmails, bIsPrivate, sArmor, sUserID)
|
||||
{
|
||||
function OpenPgpKeyModel(iIndex, sGuID, sID, aIDs, aUserIDs, aEmails, bIsPrivate, sArmor, sUserID)
|
||||
{
|
||||
AbstractModel.call(this, 'OpenPgpKeyModel');
|
||||
|
||||
this.index = iIndex;
|
||||
|
|
@ -42,23 +37,23 @@
|
|||
this.selectUser(sUserID);
|
||||
|
||||
this.deleteAccess = ko.observable(false);
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(OpenPgpKeyModel.prototype, AbstractModel.prototype);
|
||||
_.extend(OpenPgpKeyModel.prototype, AbstractModel.prototype);
|
||||
|
||||
OpenPgpKeyModel.prototype.index = 0;
|
||||
OpenPgpKeyModel.prototype.id = '';
|
||||
OpenPgpKeyModel.prototype.ids = [];
|
||||
OpenPgpKeyModel.prototype.guid = '';
|
||||
OpenPgpKeyModel.prototype.user = '';
|
||||
OpenPgpKeyModel.prototype.users = [];
|
||||
OpenPgpKeyModel.prototype.email = '';
|
||||
OpenPgpKeyModel.prototype.emails = [];
|
||||
OpenPgpKeyModel.prototype.armor = '';
|
||||
OpenPgpKeyModel.prototype.isPrivate = false;
|
||||
OpenPgpKeyModel.prototype.index = 0;
|
||||
OpenPgpKeyModel.prototype.id = '';
|
||||
OpenPgpKeyModel.prototype.ids = [];
|
||||
OpenPgpKeyModel.prototype.guid = '';
|
||||
OpenPgpKeyModel.prototype.user = '';
|
||||
OpenPgpKeyModel.prototype.users = [];
|
||||
OpenPgpKeyModel.prototype.email = '';
|
||||
OpenPgpKeyModel.prototype.emails = [];
|
||||
OpenPgpKeyModel.prototype.armor = '';
|
||||
OpenPgpKeyModel.prototype.isPrivate = false;
|
||||
|
||||
OpenPgpKeyModel.prototype.getNativeKey = function ()
|
||||
{
|
||||
OpenPgpKeyModel.prototype.getNativeKey = function()
|
||||
{
|
||||
var oKey = null;
|
||||
try
|
||||
{
|
||||
|
|
@ -74,38 +69,35 @@
|
|||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
};
|
||||
|
||||
OpenPgpKeyModel.prototype.getNativeKeys = function ()
|
||||
{
|
||||
OpenPgpKeyModel.prototype.getNativeKeys = function()
|
||||
{
|
||||
var oKey = this.getNativeKey();
|
||||
return oKey && oKey.keys ? oKey.keys : null;
|
||||
};
|
||||
};
|
||||
|
||||
OpenPgpKeyModel.prototype.select = function (sPattern, sProperty)
|
||||
{
|
||||
OpenPgpKeyModel.prototype.select = function(sPattern, sProperty)
|
||||
{
|
||||
if (this[sProperty])
|
||||
{
|
||||
var index = this[sProperty].indexOf(sPattern);
|
||||
if (index !== -1)
|
||||
if (-1 !== index)
|
||||
{
|
||||
this.user = this.users[index];
|
||||
this.email = this.emails[index];
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
OpenPgpKeyModel.prototype.selectUser = function (sUser)
|
||||
{
|
||||
OpenPgpKeyModel.prototype.selectUser = function(sUser)
|
||||
{
|
||||
this.select(sUser, 'users');
|
||||
};
|
||||
};
|
||||
|
||||
OpenPgpKeyModel.prototype.selectEmail = function (sEmail)
|
||||
{
|
||||
OpenPgpKeyModel.prototype.selectEmail = function(sEmail)
|
||||
{
|
||||
this.select(sEmail, 'emails');
|
||||
};
|
||||
|
||||
module.exports = OpenPgpKeyModel;
|
||||
|
||||
}());
|
||||
};
|
||||
|
||||
module.exports = OpenPgpKeyModel;
|
||||
|
|
|
|||
|
|
@ -1,26 +1,20 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
Utils = require('Common/Utils'),
|
||||
|
||||
AbstractModel = require('Knoin/AbstractModel')
|
||||
;
|
||||
AbstractModel = require('Knoin/AbstractModel');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {string} sID
|
||||
* @param {string} sName
|
||||
* @param {string} sBody
|
||||
*/
|
||||
function TemplateModel(sID, sName, sBody)
|
||||
{
|
||||
function TemplateModel(sID, sName, sBody)
|
||||
{
|
||||
AbstractModel.call(this, 'TemplateModel');
|
||||
|
||||
this.id = sID;
|
||||
|
|
@ -29,35 +23,35 @@
|
|||
this.populated = true;
|
||||
|
||||
this.deleteAccess = ko.observable(false);
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(TemplateModel.prototype, AbstractModel.prototype);
|
||||
_.extend(TemplateModel.prototype, AbstractModel.prototype);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
TemplateModel.prototype.id = '';
|
||||
TemplateModel.prototype.id = '';
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
TemplateModel.prototype.name = '';
|
||||
TemplateModel.prototype.name = '';
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
TemplateModel.prototype.body = '';
|
||||
TemplateModel.prototype.body = '';
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
TemplateModel.prototype.populated = true;
|
||||
TemplateModel.prototype.populated = true;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
TemplateModel.prototype.parse = function (oItem)
|
||||
{
|
||||
TemplateModel.prototype.parse = function(oItem)
|
||||
{
|
||||
var bResult = false;
|
||||
if (oItem && 'Object/Template' === oItem['@Object'])
|
||||
{
|
||||
|
|
@ -70,8 +64,6 @@
|
|||
}
|
||||
|
||||
return bResult;
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = TemplateModel;
|
||||
|
||||
}());
|
||||
module.exports = TemplateModel;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
$ = require('$'),
|
||||
_ = require('_'),
|
||||
Promise = require('Promise'),
|
||||
|
|
@ -17,30 +13,29 @@
|
|||
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
AbstractBasicPromises = require('Promises/AbstractBasic')
|
||||
;
|
||||
AbstractBasicPromises = require('Promises/AbstractBasic');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AbstractAjaxPromises()
|
||||
{
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AbstractAjaxPromises()
|
||||
{
|
||||
AbstractBasicPromises.call(this);
|
||||
|
||||
this.clear();
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(AbstractAjaxPromises.prototype, AbstractBasicPromises.prototype);
|
||||
_.extend(AbstractAjaxPromises.prototype, AbstractBasicPromises.prototype);
|
||||
|
||||
AbstractAjaxPromises.prototype.oRequests = {};
|
||||
AbstractAjaxPromises.prototype.oRequests = {};
|
||||
|
||||
AbstractAjaxPromises.prototype.clear = function ()
|
||||
{
|
||||
AbstractAjaxPromises.prototype.clear = function()
|
||||
{
|
||||
this.oRequests = {};
|
||||
};
|
||||
};
|
||||
|
||||
AbstractAjaxPromises.prototype.abort = function (sAction, bClearOnly)
|
||||
{
|
||||
AbstractAjaxPromises.prototype.abort = function(sAction, bClearOnly)
|
||||
{
|
||||
if (this.oRequests[sAction])
|
||||
{
|
||||
if (!bClearOnly && this.oRequests[sAction].abort)
|
||||
|
|
@ -54,17 +49,16 @@
|
|||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
};
|
||||
|
||||
AbstractAjaxPromises.prototype.ajaxRequest = function (sAction, bPost, iTimeOut, oParameters, sAdditionalGetString, fTrigger)
|
||||
{
|
||||
AbstractAjaxPromises.prototype.ajaxRequest = function(sAction, bPost, iTimeOut, oParameters, sAdditionalGetString, fTrigger)
|
||||
{
|
||||
var self = this;
|
||||
return new Promise(function(resolve, reject) {
|
||||
|
||||
var
|
||||
oH = null,
|
||||
iStart = Utils.microtime()
|
||||
;
|
||||
iStart = Utils.microtime();
|
||||
|
||||
iTimeOut = Utils.isNormal(iTimeOut) ? iTimeOut : Consts.DEFAULT_AJAX_TIMEOUT;
|
||||
sAdditionalGetString = Utils.isUnd(sAdditionalGetString) ? '' : Utils.pString(sAdditionalGetString);
|
||||
|
|
@ -86,7 +80,7 @@
|
|||
data: bPost ? (oParameters || {}) : {},
|
||||
timeout: iTimeOut,
|
||||
global: true
|
||||
}).always(function (oData, sTextStatus) {
|
||||
}).always(function(oData, sTextStatus) {
|
||||
|
||||
var bCached = false, oErrorData = null, sType = Enums.StorageResultType.Error;
|
||||
if (oData && oData.Time)
|
||||
|
|
@ -103,6 +97,7 @@
|
|||
case 'abort' === sTextStatus && (!oData || !oData.__aborted__):
|
||||
sType = Enums.StorageResultType.Abort;
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
||||
Plugins.runHook('ajax-default-response', [sAction,
|
||||
|
|
@ -160,12 +155,12 @@
|
|||
Enums.Notification.MailServerError, Enums.Notification.UnknownNotification, Enums.Notification.UnknownError
|
||||
]))
|
||||
{
|
||||
Globals.data.iAjaxErrorCount++;
|
||||
Globals.data.iAjaxErrorCount += 1;
|
||||
}
|
||||
|
||||
if (Enums.Notification.InvalidToken === oErrorData.ErrorCode)
|
||||
{
|
||||
Globals.data.iTokenErrorCount++;
|
||||
Globals.data.iTokenErrorCount += 1;
|
||||
}
|
||||
|
||||
if (Consts.TOKEN_ERROR_LIMIT < Globals.data.iTokenErrorCount)
|
||||
|
|
@ -203,24 +198,22 @@
|
|||
self.oRequests[sAction] = oH;
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
AbstractAjaxPromises.prototype.getRequest = function (sAction, fTrigger, sAdditionalGetString, iTimeOut)
|
||||
{
|
||||
AbstractAjaxPromises.prototype.getRequest = function(sAction, fTrigger, sAdditionalGetString, iTimeOut)
|
||||
{
|
||||
sAdditionalGetString = Utils.isUnd(sAdditionalGetString) ? '' : Utils.pString(sAdditionalGetString);
|
||||
sAdditionalGetString = sAction + '/' + sAdditionalGetString;
|
||||
|
||||
return this.ajaxRequest(sAction, false, iTimeOut, null, sAdditionalGetString, fTrigger);
|
||||
};
|
||||
};
|
||||
|
||||
AbstractAjaxPromises.prototype.postRequest = function (action, fTrigger, params, timeOut)
|
||||
{
|
||||
AbstractAjaxPromises.prototype.postRequest = function(action, fTrigger, params, timeOut)
|
||||
{
|
||||
params = params || {};
|
||||
params.Action = action;
|
||||
|
||||
return this.ajaxRequest(action, true, timeOut, params, '', fTrigger);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = AbstractAjaxPromises;
|
||||
|
||||
}());
|
||||
module.exports = AbstractAjaxPromises;
|
||||
|
|
|
|||
|
|
@ -1,52 +1,45 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
Promise = require('Promise'),
|
||||
|
||||
Utils = require('Common/Utils')
|
||||
;
|
||||
Utils = require('Common/Utils');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AbstractBasicPromises()
|
||||
{
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AbstractBasicPromises()
|
||||
{
|
||||
this.oPromisesStack = {};
|
||||
}
|
||||
}
|
||||
|
||||
AbstractBasicPromises.prototype.func = function (fFunc)
|
||||
{
|
||||
AbstractBasicPromises.prototype.func = function(fFunc)
|
||||
{
|
||||
fFunc();
|
||||
return this;
|
||||
};
|
||||
};
|
||||
|
||||
AbstractBasicPromises.prototype.fastResolve = function (mData)
|
||||
{
|
||||
AbstractBasicPromises.prototype.fastResolve = function(mData)
|
||||
{
|
||||
return Promise.resolve(mData);
|
||||
};
|
||||
};
|
||||
|
||||
AbstractBasicPromises.prototype.fastReject = function (mData)
|
||||
{
|
||||
AbstractBasicPromises.prototype.fastReject = function(mData)
|
||||
{
|
||||
return Promise.reject(mData);
|
||||
};
|
||||
};
|
||||
|
||||
AbstractBasicPromises.prototype.setTrigger = function (mTrigger, bValue)
|
||||
{
|
||||
AbstractBasicPromises.prototype.setTrigger = function(mTrigger, bValue)
|
||||
{
|
||||
if (mTrigger)
|
||||
{
|
||||
_.each(Utils.isArray(mTrigger) ? mTrigger : [mTrigger], function (fTrigger) {
|
||||
_.each(Utils.isArray(mTrigger) ? mTrigger : [mTrigger], function(fTrigger) {
|
||||
if (fTrigger)
|
||||
{
|
||||
fTrigger(!!bValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = AbstractBasicPromises;
|
||||
|
||||
}());
|
||||
module.exports = AbstractBasicPromises;
|
||||
|
|
|
|||
|
|
@ -1,94 +1,78 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
window = require('window'),
|
||||
_ = require('_'),
|
||||
|
||||
// Enums = require('Common/Enums'),
|
||||
// Utils = require('Common/Utils'),
|
||||
// Base64 = require('Common/Base64'),
|
||||
// Cache = require('Common/Cache'),
|
||||
// Links = require('Common/Links'),
|
||||
//
|
||||
// AppStore = require('Stores/User/App'),
|
||||
// SettingsStore = require('Stores/User/Settings'),
|
||||
|
||||
PromisesPopulator = require('Promises/User/Populator'),
|
||||
AbstractAjaxPromises = require('Promises/AbstractAjax')
|
||||
;
|
||||
AbstractAjaxPromises = require('Promises/AbstractAjax');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractAjaxPromises
|
||||
*/
|
||||
function UserAjaxUserPromises()
|
||||
{
|
||||
function UserAjaxUserPromises()
|
||||
{
|
||||
AbstractAjaxPromises.call(this);
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(UserAjaxUserPromises.prototype, AbstractAjaxPromises.prototype);
|
||||
_.extend(UserAjaxUserPromises.prototype, AbstractAjaxPromises.prototype);
|
||||
|
||||
UserAjaxUserPromises.prototype.foldersReload = function (fTrigger)
|
||||
{
|
||||
UserAjaxUserPromises.prototype.foldersReload = function(fTrigger)
|
||||
{
|
||||
return this.abort('Folders')
|
||||
.postRequest('Folders', fTrigger).then(function (oData) {
|
||||
.postRequest('Folders', fTrigger).then(function(oData) {
|
||||
PromisesPopulator.foldersList(oData.Result);
|
||||
PromisesPopulator.foldersAdditionalParameters(oData.Result);
|
||||
return true;
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
UserAjaxUserPromises.prototype._folders_timeout_ = 0;
|
||||
UserAjaxUserPromises.prototype.foldersReloadWithTimeout = function (fTrigger)
|
||||
{
|
||||
UserAjaxUserPromises.prototype.foldersTimeout = 0;
|
||||
UserAjaxUserPromises.prototype.foldersReloadWithTimeout = function(fTrigger)
|
||||
{
|
||||
this.setTrigger(fTrigger, true);
|
||||
|
||||
var self = this;
|
||||
window.clearTimeout(this._folders_timeout_);
|
||||
this._folders_timeout_ = window.setTimeout(function () {
|
||||
window.clearTimeout(this.foldersTimeout);
|
||||
this.foldersTimeout = window.setTimeout(function() {
|
||||
self.foldersReload(fTrigger);
|
||||
}, 500);
|
||||
};
|
||||
};
|
||||
|
||||
UserAjaxUserPromises.prototype.folderDelete = function (sFolderFullNameRaw, fTrigger)
|
||||
{
|
||||
UserAjaxUserPromises.prototype.folderDelete = function(sFolderFullNameRaw, fTrigger)
|
||||
{
|
||||
return this.postRequest('FolderDelete', fTrigger, {
|
||||
'Folder': sFolderFullNameRaw
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
UserAjaxUserPromises.prototype.folderCreate = function (sNewFolderName, sParentName, fTrigger)
|
||||
{
|
||||
UserAjaxUserPromises.prototype.folderCreate = function(sNewFolderName, sParentName, fTrigger)
|
||||
{
|
||||
return this.postRequest('FolderCreate', fTrigger, {
|
||||
'Folder': sNewFolderName,
|
||||
'Parent': sParentName
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
UserAjaxUserPromises.prototype.folderRename = function (sPrevFolderFullNameRaw, sNewFolderName, fTrigger)
|
||||
{
|
||||
UserAjaxUserPromises.prototype.folderRename = function(sPrevFolderFullNameRaw, sNewFolderName, fTrigger)
|
||||
{
|
||||
return this.postRequest('FolderRename', fTrigger, {
|
||||
'Folder': sPrevFolderFullNameRaw,
|
||||
'NewFolderName': sNewFolderName
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
UserAjaxUserPromises.prototype.attachmentsActions = function (sAction, aHashes, fTrigger)
|
||||
{
|
||||
UserAjaxUserPromises.prototype.attachmentsActions = function(sAction, aHashes, fTrigger)
|
||||
{
|
||||
return this.postRequest('AttachmentsActions', fTrigger, {
|
||||
'Do': sAction,
|
||||
'Hashes': aHashes
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
UserAjaxUserPromises.prototype.welcomeClose = function ()
|
||||
{
|
||||
UserAjaxUserPromises.prototype.welcomeClose = function()
|
||||
{
|
||||
return this.postRequest('WelcomeClose');
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = new UserAjaxUserPromises();
|
||||
|
||||
}());
|
||||
module.exports = new UserAjaxUserPromises();
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
Consts = require('Common/Consts'),
|
||||
|
|
@ -19,46 +15,45 @@
|
|||
|
||||
FolderModel = require('Model/Folder'),
|
||||
|
||||
AbstractBasicPromises = require('Promises/AbstractBasic')
|
||||
;
|
||||
AbstractBasicPromises = require('Promises/AbstractBasic');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function PromisesUserPopulator()
|
||||
{
|
||||
function PromisesUserPopulator()
|
||||
{
|
||||
AbstractBasicPromises.call(this);
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(PromisesUserPopulator.prototype, AbstractBasicPromises.prototype);
|
||||
_.extend(PromisesUserPopulator.prototype, AbstractBasicPromises.prototype);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {string} sFullNameHash
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
PromisesUserPopulator.prototype.isFolderExpanded = function (sFullNameHash)
|
||||
{
|
||||
PromisesUserPopulator.prototype.isFolderExpanded = function(sFullNameHash)
|
||||
{
|
||||
var aExpandedList = Local.get(Enums.ClientSideKeyName.ExpandedFolders);
|
||||
return Utils.isArray(aExpandedList) && -1 !== _.indexOf(aExpandedList, sFullNameHash);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {string} sFolderFullNameRaw
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
PromisesUserPopulator.prototype.normalizeFolder = function (sFolderFullNameRaw)
|
||||
{
|
||||
PromisesUserPopulator.prototype.normalizeFolder = function(sFolderFullNameRaw)
|
||||
{
|
||||
return ('' === sFolderFullNameRaw || Consts.UNUSED_OPTION_VALUE === sFolderFullNameRaw ||
|
||||
null !== Cache.getFolderFromCacheList(sFolderFullNameRaw)) ? sFolderFullNameRaw : '';
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {string} sNamespace
|
||||
* @param {Array} aFolders
|
||||
* @return {Array}
|
||||
* @returns {Array}
|
||||
*/
|
||||
PromisesUserPopulator.prototype.folderResponseParseRec = function (sNamespace, aFolders)
|
||||
{
|
||||
PromisesUserPopulator.prototype.folderResponseParseRec = function(sNamespace, aFolders)
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
iIndex = 0,
|
||||
|
|
@ -67,8 +62,7 @@
|
|||
oCacheFolder = null,
|
||||
sFolderFullNameRaw = '',
|
||||
aSubFolders = [],
|
||||
aList = []
|
||||
;
|
||||
aList = [];
|
||||
|
||||
for (iIndex = 0, iLen = aFolders.length; iIndex < iLen; iIndex++)
|
||||
{
|
||||
|
|
@ -133,17 +127,16 @@
|
|||
}
|
||||
|
||||
return aList;
|
||||
};
|
||||
};
|
||||
|
||||
PromisesUserPopulator.prototype.foldersList = function (oData)
|
||||
{
|
||||
PromisesUserPopulator.prototype.foldersList = function(oData)
|
||||
{
|
||||
if (oData && 'Collection/FolderCollection' === oData['@Object'] &&
|
||||
oData['@Collection'] && Utils.isArray(oData['@Collection']))
|
||||
{
|
||||
var
|
||||
iLimit = Utils.pInt(Settings.appSettingsGet('folderSpecLimit')),
|
||||
iC = Utils.pInt(oData.CountRec)
|
||||
;
|
||||
iC = Utils.pInt(oData.CountRec);
|
||||
|
||||
iLimit = 100 < iLimit ? 100 : (10 > iLimit ? 10 : iLimit);
|
||||
|
||||
|
|
@ -151,10 +144,10 @@
|
|||
FolderStore.folderList(this.folderResponseParseRec(
|
||||
Utils.isUnd(oData.Namespace) ? '' : oData.Namespace, oData['@Collection']));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
PromisesUserPopulator.prototype.foldersAdditionalParameters = function (oData)
|
||||
{
|
||||
PromisesUserPopulator.prototype.foldersAdditionalParameters = function(oData)
|
||||
{
|
||||
if (oData && oData && 'Collection/FolderCollection' === oData['@Object'] &&
|
||||
oData['@Collection'] && Utils.isArray(oData['@Collection']))
|
||||
{
|
||||
|
|
@ -206,8 +199,6 @@
|
|||
|
||||
Local.set(Enums.ClientSideKeyName.FoldersLashHash, oData.FoldersHash);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = new PromisesUserPopulator();
|
||||
|
||||
}());
|
||||
module.exports = new PromisesUserPopulator();
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
window = require('window'),
|
||||
_ = require('_'),
|
||||
$ = require('$'),
|
||||
|
|
@ -15,20 +11,19 @@
|
|||
Plugins = require('Common/Plugins'),
|
||||
Links = require('Common/Links'),
|
||||
|
||||
Settings = require('Storage/Settings')
|
||||
;
|
||||
Settings = require('Storage/Settings');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AbstractAjaxRemote()
|
||||
{
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AbstractAjaxRemote()
|
||||
{
|
||||
this.oRequests = {};
|
||||
}
|
||||
}
|
||||
|
||||
AbstractAjaxRemote.prototype.oRequests = {};
|
||||
AbstractAjaxRemote.prototype.oRequests = {};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sRequestAction
|
||||
* @param {string} sType
|
||||
|
|
@ -36,10 +31,10 @@
|
|||
* @param {boolean} bCached
|
||||
* @param {*=} oRequestParameters
|
||||
*/
|
||||
AbstractAjaxRemote.prototype.defaultResponse = function (fCallback, sRequestAction, sType, oData, bCached, oRequestParameters)
|
||||
{
|
||||
AbstractAjaxRemote.prototype.defaultResponse = function(fCallback, sRequestAction, sType, oData, bCached, oRequestParameters)
|
||||
{
|
||||
var
|
||||
fCall = function () {
|
||||
fCall = function() {
|
||||
if (Enums.StorageResultType.Success !== sType && Globals.data.bUnload)
|
||||
{
|
||||
sType = Enums.StorageResultType.Unload;
|
||||
|
|
@ -53,12 +48,12 @@
|
|||
Enums.Notification.MailServerError, Enums.Notification.UnknownNotification, Enums.Notification.UnknownError
|
||||
]))
|
||||
{
|
||||
Globals.data.iAjaxErrorCount++;
|
||||
Globals.data.iAjaxErrorCount += 1;
|
||||
}
|
||||
|
||||
if (oData && Enums.Notification.InvalidToken === oData.ErrorCode)
|
||||
{
|
||||
Globals.data.iTokenErrorCount++;
|
||||
Globals.data.iTokenErrorCount += 1;
|
||||
}
|
||||
|
||||
if (Consts.TOKEN_ERROR_LIMIT < Globals.data.iTokenErrorCount)
|
||||
|
|
@ -100,8 +95,7 @@
|
|||
oRequestParameters
|
||||
);
|
||||
}
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
switch (sType)
|
||||
{
|
||||
|
|
@ -124,26 +118,25 @@
|
|||
{
|
||||
fCall();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fResultCallback
|
||||
* @param {Object} oParameters
|
||||
* @param {?number=} iTimeOut = 20000
|
||||
* @param {string=} sGetAdd = ''
|
||||
* @param {Array=} aAbortActions = []
|
||||
* @return {jQuery.jqXHR}
|
||||
* @returns {jQuery.jqXHR}
|
||||
*/
|
||||
AbstractAjaxRemote.prototype.ajaxRequest = function (fResultCallback, oParameters, iTimeOut, sGetAdd, aAbortActions)
|
||||
{
|
||||
AbstractAjaxRemote.prototype.ajaxRequest = function(fResultCallback, oParameters, iTimeOut, sGetAdd, aAbortActions)
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
bPost = '' === sGetAdd,
|
||||
oHeaders = {},
|
||||
iStart = (new window.Date()).getTime(),
|
||||
oDefAjax = null,
|
||||
sAction = ''
|
||||
;
|
||||
sAction = '';
|
||||
|
||||
oParameters = oParameters || {};
|
||||
iTimeOut = Utils.isNormal(iTimeOut) ? iTimeOut : 20000;
|
||||
|
|
@ -154,7 +147,7 @@
|
|||
|
||||
if (sAction && 0 < aAbortActions.length)
|
||||
{
|
||||
_.each(aAbortActions, function (sActionToAbort) {
|
||||
_.each(aAbortActions, function(sActionToAbort) {
|
||||
if (self.oRequests[sActionToAbort])
|
||||
{
|
||||
self.oRequests[sActionToAbort].__aborted = true;
|
||||
|
|
@ -183,7 +176,7 @@
|
|||
global: true
|
||||
});
|
||||
|
||||
oDefAjax.always(function (oData, sType) {
|
||||
oDefAjax.always(function(oData, sType) {
|
||||
|
||||
var bCached = false;
|
||||
if (oData && oData.Time)
|
||||
|
|
@ -220,9 +213,9 @@
|
|||
}
|
||||
|
||||
return oDefAjax;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sAction
|
||||
* @param {Object=} oParameters
|
||||
|
|
@ -230,8 +223,8 @@
|
|||
* @param {string=} sGetAdd = ''
|
||||
* @param {Array=} aAbortActions = []
|
||||
*/
|
||||
AbstractAjaxRemote.prototype.defaultRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
|
||||
{
|
||||
AbstractAjaxRemote.prototype.defaultRequest = function(fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
|
||||
{
|
||||
oParameters = oParameters || {};
|
||||
oParameters.Action = sAction;
|
||||
|
||||
|
|
@ -241,17 +234,17 @@
|
|||
|
||||
return this.ajaxRequest(fCallback, oParameters,
|
||||
Utils.isUnd(iTimeout) ? Consts.DEFAULT_AJAX_TIMEOUT : Utils.pInt(iTimeout), sGetAdd, aAbortActions);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AbstractAjaxRemote.prototype.noop = function (fCallback)
|
||||
{
|
||||
AbstractAjaxRemote.prototype.noop = function(fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'Noop');
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sMessage
|
||||
* @param {string} sFileName
|
||||
|
|
@ -260,8 +253,8 @@
|
|||
* @param {string} sHtmlCapa
|
||||
* @param {number} iTime
|
||||
*/
|
||||
AbstractAjaxRemote.prototype.jsError = function (fCallback, sMessage, sFileName, iLineNo, sLocation, sHtmlCapa, iTime)
|
||||
{
|
||||
AbstractAjaxRemote.prototype.jsError = function(fCallback, sMessage, sFileName, iLineNo, sLocation, sHtmlCapa, iTime)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'JsError', {
|
||||
'Message': sMessage,
|
||||
'FileName': sFileName,
|
||||
|
|
@ -270,42 +263,40 @@
|
|||
'HtmlCapa': sHtmlCapa,
|
||||
'TimeOnPage': iTime
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sType
|
||||
* @param {Array=} mData = null
|
||||
* @param {boolean=} bIsError = false
|
||||
*/
|
||||
AbstractAjaxRemote.prototype.jsInfo = function (fCallback, sType, mData, bIsError)
|
||||
{
|
||||
AbstractAjaxRemote.prototype.jsInfo = function(fCallback, sType, mData, bIsError)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'JsInfo', {
|
||||
'Type': sType,
|
||||
'Data': mData,
|
||||
'IsError': (Utils.isUnd(bIsError) ? false : !!bIsError) ? '1' : '0'
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AbstractAjaxRemote.prototype.getPublicKey = function (fCallback)
|
||||
{
|
||||
AbstractAjaxRemote.prototype.getPublicKey = function(fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'GetPublicKey');
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sVersion
|
||||
*/
|
||||
AbstractAjaxRemote.prototype.jsVersion = function (fCallback, sVersion)
|
||||
{
|
||||
AbstractAjaxRemote.prototype.jsVersion = function(fCallback, sVersion)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'Version', {
|
||||
'Version': sVersion
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = AbstractAjaxRemote;
|
||||
|
||||
}());
|
||||
module.exports = AbstractAjaxRemote;
|
||||
|
|
|
|||
|
|
@ -1,234 +1,229 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
Utils = require('Common/Utils'),
|
||||
|
||||
AbstractAjaxRemote = require('Remote/AbstractAjax')
|
||||
;
|
||||
AbstractAjaxRemote = require('Remote/AbstractAjax');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractAjaxRemote
|
||||
*/
|
||||
function RemoteAdminStorage()
|
||||
{
|
||||
function RemoteAdminStorage()
|
||||
{
|
||||
AbstractAjaxRemote.call(this);
|
||||
|
||||
this.oRequests = {};
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(RemoteAdminStorage.prototype, AbstractAjaxRemote.prototype);
|
||||
_.extend(RemoteAdminStorage.prototype, AbstractAjaxRemote.prototype);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sLogin
|
||||
* @param {string} sPassword
|
||||
*/
|
||||
RemoteAdminStorage.prototype.adminLogin = function (fCallback, sLogin, sPassword)
|
||||
{
|
||||
RemoteAdminStorage.prototype.adminLogin = function(fCallback, sLogin, sPassword)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminLogin', {
|
||||
'Login': sLogin,
|
||||
'Password': sPassword
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
RemoteAdminStorage.prototype.adminLogout = function (fCallback)
|
||||
{
|
||||
RemoteAdminStorage.prototype.adminLogout = function(fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminLogout');
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {?} oData
|
||||
*/
|
||||
RemoteAdminStorage.prototype.saveAdminConfig = function (fCallback, oData)
|
||||
{
|
||||
RemoteAdminStorage.prototype.saveAdminConfig = function(fCallback, oData)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminSettingsUpdate', oData);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {boolean=} bIncludeAliases = true
|
||||
*/
|
||||
RemoteAdminStorage.prototype.domainList = function (fCallback, bIncludeAliases)
|
||||
{
|
||||
RemoteAdminStorage.prototype.domainList = function(fCallback, bIncludeAliases)
|
||||
{
|
||||
bIncludeAliases = Utils.isUnd(bIncludeAliases) ? true : bIncludeAliases;
|
||||
this.defaultRequest(fCallback, 'AdminDomainList', {
|
||||
'IncludeAliases': bIncludeAliases ? '1' : '0'
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
RemoteAdminStorage.prototype.pluginList = function (fCallback)
|
||||
{
|
||||
RemoteAdminStorage.prototype.pluginList = function(fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPluginList');
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
RemoteAdminStorage.prototype.packagesList = function (fCallback)
|
||||
{
|
||||
RemoteAdminStorage.prototype.packagesList = function(fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPackagesList');
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
RemoteAdminStorage.prototype.coreData = function (fCallback)
|
||||
{
|
||||
RemoteAdminStorage.prototype.coreData = function(fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminCoreData');
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
RemoteAdminStorage.prototype.updateCoreData = function (fCallback)
|
||||
{
|
||||
RemoteAdminStorage.prototype.updateCoreData = function(fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminUpdateCoreData', {}, 90000);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {Object} oPackage
|
||||
*/
|
||||
RemoteAdminStorage.prototype.packageInstall = function (fCallback, oPackage)
|
||||
{
|
||||
RemoteAdminStorage.prototype.packageInstall = function(fCallback, oPackage)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPackageInstall', {
|
||||
'Id': oPackage.id,
|
||||
'Type': oPackage.type,
|
||||
'File': oPackage.file
|
||||
}, 60000);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {Object} oPackage
|
||||
*/
|
||||
RemoteAdminStorage.prototype.packageDelete = function (fCallback, oPackage)
|
||||
{
|
||||
RemoteAdminStorage.prototype.packageDelete = function(fCallback, oPackage)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPackageDelete', {
|
||||
'Id': oPackage.id
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
*/
|
||||
RemoteAdminStorage.prototype.domain = function (fCallback, sName)
|
||||
{
|
||||
RemoteAdminStorage.prototype.domain = function(fCallback, sName)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainLoad', {
|
||||
'Name': sName
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
*/
|
||||
RemoteAdminStorage.prototype.plugin = function (fCallback, sName)
|
||||
{
|
||||
RemoteAdminStorage.prototype.plugin = function(fCallback, sName)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPluginLoad', {
|
||||
'Name': sName
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
*/
|
||||
RemoteAdminStorage.prototype.domainDelete = function (fCallback, sName)
|
||||
{
|
||||
RemoteAdminStorage.prototype.domainDelete = function(fCallback, sName)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainDelete', {
|
||||
'Name': sName
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
* @param {boolean} bDisabled
|
||||
*/
|
||||
RemoteAdminStorage.prototype.domainDisable = function (fCallback, sName, bDisabled)
|
||||
{
|
||||
RemoteAdminStorage.prototype.domainDisable = function(fCallback, sName, bDisabled)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminDomainDisable', {
|
||||
Name: sName,
|
||||
Disabled: bDisabled ? '1' : '0'
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {Object} oConfig
|
||||
*/
|
||||
RemoteAdminStorage.prototype.pluginSettingsUpdate = function (fCallback, oConfig)
|
||||
{
|
||||
RemoteAdminStorage.prototype.pluginSettingsUpdate = function(fCallback, oConfig)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminPluginSettingsUpdate', oConfig);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {boolean} bForce
|
||||
*/
|
||||
RemoteAdminStorage.prototype.licensing = function (fCallback, bForce)
|
||||
{
|
||||
RemoteAdminStorage.prototype.licensing = function(fCallback, bForce)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminLicensing', {
|
||||
Force: bForce ? '1' : '0'
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sDomain
|
||||
* @param {string} sKey
|
||||
*/
|
||||
RemoteAdminStorage.prototype.licensingActivate = function (fCallback, sDomain, sKey)
|
||||
{
|
||||
RemoteAdminStorage.prototype.licensingActivate = function(fCallback, sDomain, sKey)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminLicensingActivate', {
|
||||
Domain: sDomain,
|
||||
Key: sKey
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
* @param {boolean} bDisabled
|
||||
*/
|
||||
RemoteAdminStorage.prototype.pluginDisable = function (fCallback, sName, bDisabled)
|
||||
{
|
||||
RemoteAdminStorage.prototype.pluginDisable = function(fCallback, sName, bDisabled)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminPluginDisable', {
|
||||
Name: sName,
|
||||
Disabled: bDisabled ? '1' : '0'
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
RemoteAdminStorage.prototype.createDomainAlias = function (fCallback, sName, sAlias)
|
||||
{
|
||||
RemoteAdminStorage.prototype.createDomainAlias = function(fCallback, sName, sAlias)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainAliasSave', {
|
||||
Name: sName,
|
||||
Alias: sAlias
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
RemoteAdminStorage.prototype.createOrUpdateDomain = function (fCallback,
|
||||
RemoteAdminStorage.prototype.createOrUpdateDomain = function(fCallback,
|
||||
bCreate, sName,
|
||||
sIncHost, iIncPort, sIncSecure, bIncShortLogin,
|
||||
bUseSieve, sSieveAllowRaw, sSieveHost, iSievePort, sSieveSecure,
|
||||
sOutHost, iOutPort, sOutSecure, bOutShortLogin, bOutAuth, bOutPhpMail,
|
||||
sWhiteList)
|
||||
{
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainSave', {
|
||||
'Create': bCreate ? '1' : '0',
|
||||
'Name': sName,
|
||||
|
|
@ -253,13 +248,13 @@
|
|||
|
||||
'WhiteList': sWhiteList
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
RemoteAdminStorage.prototype.testConnectionForDomain = function (fCallback, sName,
|
||||
RemoteAdminStorage.prototype.testConnectionForDomain = function(fCallback, sName,
|
||||
sIncHost, iIncPort, sIncSecure,
|
||||
bUseSieve, sSieveHost, iSievePort, sSieveSecure,
|
||||
sOutHost, iOutPort, sOutSecure, bOutAuth, bOutPhpMail)
|
||||
{
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainTest', {
|
||||
'Name': sName,
|
||||
'IncHost': sIncHost,
|
||||
|
|
@ -275,34 +270,32 @@
|
|||
'OutAuth': bOutAuth ? '1' : '0',
|
||||
'OutUsePhpMail': bOutPhpMail ? '1' : '0'
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {?} oData
|
||||
*/
|
||||
RemoteAdminStorage.prototype.testContacts = function (fCallback, oData)
|
||||
{
|
||||
RemoteAdminStorage.prototype.testContacts = function(fCallback, oData)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminContactsTest', oData);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {?} oData
|
||||
*/
|
||||
RemoteAdminStorage.prototype.saveNewAdminPassword = function (fCallback, oData)
|
||||
{
|
||||
RemoteAdminStorage.prototype.saveNewAdminPassword = function(fCallback, oData)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPasswordUpdate', oData);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
RemoteAdminStorage.prototype.adminPing = function (fCallback)
|
||||
{
|
||||
RemoteAdminStorage.prototype.adminPing = function(fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPing');
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = new RemoteAdminStorage();
|
||||
|
||||
}());
|
||||
module.exports = new RemoteAdminStorage();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
$ = require('$'),
|
||||
ko = require('ko'),
|
||||
|
|
@ -13,16 +9,15 @@
|
|||
Links = require('Common/Links'),
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractScreen = require('Knoin/AbstractScreen')
|
||||
;
|
||||
AbstractScreen = require('Knoin/AbstractScreen');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Array} aViewModels
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function AbstractSettingsScreen(aViewModels)
|
||||
{
|
||||
function AbstractSettingsScreen(aViewModels)
|
||||
{
|
||||
AbstractScreen.call(this, 'settings', aViewModels);
|
||||
|
||||
this.menu = ko.observableArray([]);
|
||||
|
|
@ -31,46 +26,45 @@
|
|||
this.oViewModelPlace = null;
|
||||
|
||||
this.setupSettings();
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(AbstractSettingsScreen.prototype, AbstractScreen.prototype);
|
||||
_.extend(AbstractSettingsScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Function=} fCallback
|
||||
*/
|
||||
AbstractSettingsScreen.prototype.setupSettings = function (fCallback)
|
||||
{
|
||||
AbstractSettingsScreen.prototype.setupSettings = function(fCallback)
|
||||
{
|
||||
if (fCallback)
|
||||
{
|
||||
fCallback();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
AbstractSettingsScreen.prototype.onRoute = function (sSubName)
|
||||
{
|
||||
AbstractSettingsScreen.prototype.onRoute = function(sSubName)
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
oSettingsScreen = null,
|
||||
RoutedSettingsViewModel = null,
|
||||
oViewModelPlace = null,
|
||||
oViewModelDom = null
|
||||
;
|
||||
oViewModelDom = null;
|
||||
|
||||
RoutedSettingsViewModel = _.find(Globals.aViewModels.settings, function (SettingsViewModel) {
|
||||
RoutedSettingsViewModel = _.find(Globals.aViewModels.settings, function(SettingsViewModel) {
|
||||
return SettingsViewModel && SettingsViewModel.__rlSettingsData &&
|
||||
sSubName === SettingsViewModel.__rlSettingsData.Route;
|
||||
});
|
||||
|
||||
if (RoutedSettingsViewModel)
|
||||
{
|
||||
if (_.find(Globals.aViewModels['settings-removed'], function (DisabledSettingsViewModel) {
|
||||
if (_.find(Globals.aViewModels['settings-removed'], function(DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
|
||||
}))
|
||||
{
|
||||
RoutedSettingsViewModel = null;
|
||||
}
|
||||
|
||||
if (RoutedSettingsViewModel && _.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
|
||||
if (RoutedSettingsViewModel && _.find(Globals.aViewModels['settings-disabled'], function(DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
|
||||
}))
|
||||
{
|
||||
|
|
@ -103,8 +97,12 @@
|
|||
RoutedSettingsViewModel.__vm = oSettingsScreen;
|
||||
|
||||
ko.applyBindingAccessorsToNode(oViewModelDom[0], {
|
||||
'translatorInit': true,
|
||||
'template': function () { return {'name': RoutedSettingsViewModel.__rlSettingsData.Template}; }
|
||||
translatorInit: true,
|
||||
template: function() {
|
||||
return {
|
||||
name: RoutedSettingsViewModel.__rlSettingsData.Template
|
||||
};
|
||||
}
|
||||
}, oSettingsScreen);
|
||||
|
||||
Utils.delegateRun(oSettingsScreen, 'onBuild', [oViewModelDom]);
|
||||
|
|
@ -117,7 +115,7 @@
|
|||
|
||||
if (oSettingsScreen)
|
||||
{
|
||||
_.defer(function () {
|
||||
_.defer(function() {
|
||||
// hide
|
||||
if (self.oCurrentSubScreen)
|
||||
{
|
||||
|
|
@ -136,7 +134,7 @@
|
|||
Utils.delegateRun(self.oCurrentSubScreen, 'onShow');
|
||||
Utils.delegateRun(self.oCurrentSubScreen, 'onShowWithDelay', [], 200);
|
||||
|
||||
_.each(self.menu(), function (oItem) {
|
||||
_.each(self.menu(), function(oItem) {
|
||||
oItem.selected(oSettingsScreen && oSettingsScreen.__rlSettingsData && oItem.route === oSettingsScreen.__rlSettingsData.Route);
|
||||
});
|
||||
|
||||
|
|
@ -152,22 +150,22 @@
|
|||
{
|
||||
kn.setHash(Links.settings(), false, true);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
AbstractSettingsScreen.prototype.onHide = function ()
|
||||
{
|
||||
AbstractSettingsScreen.prototype.onHide = function()
|
||||
{
|
||||
if (this.oCurrentSubScreen && this.oCurrentSubScreen.viewModelDom)
|
||||
{
|
||||
Utils.delegateRun(this.oCurrentSubScreen, 'onHide');
|
||||
this.oCurrentSubScreen.viewModelDom.hide();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
AbstractSettingsScreen.prototype.onBuild = function ()
|
||||
{
|
||||
_.each(Globals.aViewModels.settings, function (SettingsViewModel) {
|
||||
AbstractSettingsScreen.prototype.onBuild = function()
|
||||
{
|
||||
_.each(Globals.aViewModels.settings, function(SettingsViewModel) {
|
||||
if (SettingsViewModel && SettingsViewModel.__rlSettingsData &&
|
||||
!_.find(Globals.aViewModels['settings-removed'], function (RemoveSettingsViewModel) {
|
||||
!_.find(Globals.aViewModels['settings-removed'], function(RemoveSettingsViewModel) {
|
||||
return RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel;
|
||||
}))
|
||||
{
|
||||
|
|
@ -175,7 +173,7 @@
|
|||
route: SettingsViewModel.__rlSettingsData.Route,
|
||||
label: SettingsViewModel.__rlSettingsData.Label,
|
||||
selected: ko.observable(false),
|
||||
disabled: !!_.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
|
||||
disabled: !!_.find(Globals.aViewModels['settings-disabled'], function(DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel;
|
||||
})
|
||||
});
|
||||
|
|
@ -183,32 +181,29 @@
|
|||
}, this);
|
||||
|
||||
this.oViewModelPlace = $('#rl-content #rl-settings-subscreen');
|
||||
};
|
||||
};
|
||||
|
||||
AbstractSettingsScreen.prototype.routes = function ()
|
||||
{
|
||||
AbstractSettingsScreen.prototype.routes = function()
|
||||
{
|
||||
var
|
||||
DefaultViewModel = _.find(Globals.aViewModels.settings, function (SettingsViewModel) {
|
||||
DefaultViewModel = _.find(Globals.aViewModels.settings, function(SettingsViewModel) {
|
||||
return SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData.IsDefault;
|
||||
}),
|
||||
sDefaultRoute = DefaultViewModel && DefaultViewModel.__rlSettingsData ?
|
||||
DefaultViewModel.__rlSettingsData.Route : 'general',
|
||||
oRules = {
|
||||
subname: /^(.*)$/,
|
||||
normalize_: function (oRequest, oVals) {
|
||||
normalize_: function(oRequest, oVals) {
|
||||
oVals.subname = Utils.isUnd(oVals.subname) ? sDefaultRoute : Utils.pString(oVals.subname);
|
||||
return [oVals.subname];
|
||||
}
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
return [
|
||||
['{subname}/', oRules],
|
||||
['{subname}', oRules],
|
||||
['', oRules]
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = AbstractSettingsScreen;
|
||||
|
||||
}());
|
||||
module.exports = AbstractSettingsScreen;
|
||||
|
|
|
|||
|
|
@ -1,32 +1,25 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
AbstractScreen = require('Knoin/AbstractScreen')
|
||||
;
|
||||
AbstractScreen = require('Knoin/AbstractScreen');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function LoginAdminScreen()
|
||||
{
|
||||
function LoginAdminScreen()
|
||||
{
|
||||
AbstractScreen.call(this, 'login', [
|
||||
require('View/Admin/Login')
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(LoginAdminScreen.prototype, AbstractScreen.prototype);
|
||||
_.extend(LoginAdminScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
LoginAdminScreen.prototype.onShow = function ()
|
||||
{
|
||||
LoginAdminScreen.prototype.onShow = function()
|
||||
{
|
||||
require('App/Admin').default.setWindowTitle('');
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = LoginAdminScreen;
|
||||
|
||||
}());
|
||||
module.exports = LoginAdminScreen;
|
||||
|
|
|
|||
|
|
@ -1,39 +1,34 @@
|
|||
|
||||
/* global RL_COMMUNITY */
|
||||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
|
||||
Plugins = require('Common/Plugins'),
|
||||
|
||||
AbstractSettings = require('Screen/AbstractSettings')
|
||||
;
|
||||
AbstractSettings = require('Screen/AbstractSettings');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSettings
|
||||
*/
|
||||
function SettingsAdminScreen()
|
||||
{
|
||||
function SettingsAdminScreen()
|
||||
{
|
||||
AbstractSettings.call(this, [
|
||||
require('View/Admin/Settings/Menu'),
|
||||
require('View/Admin/Settings/Pane')
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(SettingsAdminScreen.prototype, AbstractSettings.prototype);
|
||||
_.extend(SettingsAdminScreen.prototype, AbstractSettings.prototype);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Function=} fCallback
|
||||
*/
|
||||
SettingsAdminScreen.prototype.setupSettings = function (fCallback)
|
||||
{
|
||||
SettingsAdminScreen.prototype.setupSettings = function(fCallback)
|
||||
{
|
||||
kn.addSettingsViewModel(require('Settings/Admin/General'),
|
||||
'AdminSettingsGeneral', 'TABS_LABELS/LABEL_GENERAL_NAME', 'general', true);
|
||||
|
||||
|
|
@ -84,13 +79,11 @@
|
|||
{
|
||||
fCallback();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
SettingsAdminScreen.prototype.onShow = function ()
|
||||
{
|
||||
SettingsAdminScreen.prototype.onShow = function()
|
||||
{
|
||||
require('App/Admin').default.setWindowTitle('');
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = SettingsAdminScreen;
|
||||
|
||||
}());
|
||||
module.exports = SettingsAdminScreen;
|
||||
|
|
|
|||
|
|
@ -1,32 +1,25 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
AbstractScreen = require('Knoin/AbstractScreen')
|
||||
;
|
||||
AbstractScreen = require('Knoin/AbstractScreen');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function AboutUserScreen()
|
||||
{
|
||||
function AboutUserScreen()
|
||||
{
|
||||
AbstractScreen.call(this, 'about', [
|
||||
require('View/User/About')
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(AboutUserScreen.prototype, AbstractScreen.prototype);
|
||||
_.extend(AboutUserScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
AboutUserScreen.prototype.onShow = function ()
|
||||
{
|
||||
AboutUserScreen.prototype.onShow = function()
|
||||
{
|
||||
require('App/User').default.setWindowTitle('RainLoop');
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = AboutUserScreen;
|
||||
|
||||
}());
|
||||
module.exports = AboutUserScreen;
|
||||
|
|
|
|||
|
|
@ -1,32 +1,25 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
AbstractScreen = require('Knoin/AbstractScreen')
|
||||
;
|
||||
AbstractScreen = require('Knoin/AbstractScreen');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function LoginUserScreen()
|
||||
{
|
||||
function LoginUserScreen()
|
||||
{
|
||||
AbstractScreen.call(this, 'login', [
|
||||
require('View/User/Login')
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(LoginUserScreen.prototype, AbstractScreen.prototype);
|
||||
_.extend(LoginUserScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
LoginUserScreen.prototype.onShow = function ()
|
||||
{
|
||||
LoginUserScreen.prototype.onShow = function()
|
||||
{
|
||||
require('App/User').default.setWindowTitle('');
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = LoginUserScreen;
|
||||
|
||||
}());
|
||||
module.exports = LoginUserScreen;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
|
|
@ -22,15 +18,14 @@
|
|||
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
AbstractScreen = require('Knoin/AbstractScreen')
|
||||
;
|
||||
AbstractScreen = require('Knoin/AbstractScreen');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractScreen
|
||||
*/
|
||||
function MailBoxUserScreen()
|
||||
{
|
||||
function MailBoxUserScreen()
|
||||
{
|
||||
AbstractScreen.call(this, 'mailbox', [
|
||||
require('View/User/MailBox/SystemDropDown'),
|
||||
require('View/User/MailBox/FolderList'),
|
||||
|
|
@ -39,21 +34,20 @@
|
|||
]);
|
||||
|
||||
this.oLastRoute = {};
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(MailBoxUserScreen.prototype, AbstractScreen.prototype);
|
||||
_.extend(MailBoxUserScreen.prototype, AbstractScreen.prototype);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
MailBoxUserScreen.prototype.oLastRoute = {};
|
||||
MailBoxUserScreen.prototype.oLastRoute = {};
|
||||
|
||||
MailBoxUserScreen.prototype.updateWindowTitle = function ()
|
||||
{
|
||||
MailBoxUserScreen.prototype.updateWindowTitle = function()
|
||||
{
|
||||
var
|
||||
sEmail = AccountStore.email(),
|
||||
nFoldersInboxUnreadCount = FolderStore.foldersInboxUnreadCount()
|
||||
;
|
||||
nFoldersInboxUnreadCount = FolderStore.foldersInboxUnreadCount();
|
||||
|
||||
if (Settings.appSettingsGet('listPermanentFiltered'))
|
||||
{
|
||||
|
|
@ -63,10 +57,10 @@
|
|||
require('App/User').default.setWindowTitle(('' === sEmail ? '' : '' +
|
||||
(0 < nFoldersInboxUnreadCount ? '(' + nFoldersInboxUnreadCount + ') ' : ' ') +
|
||||
sEmail + ' - ') + Translator.i18n('TITLES/MAILBOX'));
|
||||
};
|
||||
};
|
||||
|
||||
MailBoxUserScreen.prototype.onShow = function ()
|
||||
{
|
||||
MailBoxUserScreen.prototype.onShow = function()
|
||||
{
|
||||
this.updateWindowTitle();
|
||||
|
||||
AppStore.focusedState(Enums.Focused.None);
|
||||
|
|
@ -86,20 +80,19 @@
|
|||
{
|
||||
Globals.leftPanelType('');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {string} sFolderHash
|
||||
* @param {number} iPage
|
||||
* @param {string} sSearch
|
||||
*/
|
||||
MailBoxUserScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch)
|
||||
{
|
||||
MailBoxUserScreen.prototype.onRoute = function(sFolderHash, iPage, sSearch)
|
||||
{
|
||||
var
|
||||
sThreadUid = sFolderHash.replace(/^(.+)~([\d]+)$/, '$2'),
|
||||
oFolder = Cache.getFolderFromCacheList(Cache.getFolderFullNameRaw(
|
||||
sFolderHash.replace(/~([\d]+)$/, '')))
|
||||
;
|
||||
sFolderHash.replace(/~([\d]+)$/, '')));
|
||||
|
||||
if (oFolder)
|
||||
{
|
||||
|
|
@ -116,26 +109,26 @@
|
|||
|
||||
require('App/User').default.reloadMessageList();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
MailBoxUserScreen.prototype.onStart = function ()
|
||||
{
|
||||
MailBoxUserScreen.prototype.onStart = function()
|
||||
{
|
||||
FolderStore.folderList.subscribe(Utils.windowResizeCallback);
|
||||
|
||||
MessageStore.messageList.subscribe(Utils.windowResizeCallback);
|
||||
MessageStore.message.subscribe(Utils.windowResizeCallback);
|
||||
|
||||
_.delay(function () {
|
||||
_.delay(function() {
|
||||
SettingsStore.layout.valueHasMutated();
|
||||
}, 50);
|
||||
|
||||
Events.sub('mailbox.inbox-unread-count', _.bind(function (iCount) {
|
||||
Events.sub('mailbox.inbox-unread-count', _.bind(function(iCount) {
|
||||
|
||||
FolderStore.foldersInboxUnreadCount(iCount);
|
||||
|
||||
var sEmail = AccountStore.email();
|
||||
|
||||
_.each(AccountStore.accounts(), function (oItem) {
|
||||
_.each(AccountStore.accounts(), function(oItem) {
|
||||
if (oItem && sEmail === oItem.email)
|
||||
{
|
||||
oItem.count(iCount);
|
||||
|
|
@ -145,26 +138,26 @@
|
|||
this.updateWindowTitle();
|
||||
|
||||
}, this));
|
||||
};
|
||||
};
|
||||
|
||||
MailBoxUserScreen.prototype.onBuild = function ()
|
||||
{
|
||||
MailBoxUserScreen.prototype.onBuild = function()
|
||||
{
|
||||
if (!Globals.bMobileDevice && !Settings.appSettingsGet('mobile'))
|
||||
{
|
||||
_.defer(function () {
|
||||
_.defer(function() {
|
||||
require('App/User').default.initHorizontalLayoutResizer(Enums.ClientSideKeyName.MessageListSize);
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {Array}
|
||||
/**
|
||||
* @returns {Array}
|
||||
*/
|
||||
MailBoxUserScreen.prototype.routes = function ()
|
||||
{
|
||||
MailBoxUserScreen.prototype.routes = function()
|
||||
{
|
||||
var
|
||||
sInboxFolderName = Cache.getFolderInboxName(),
|
||||
fNormS = function (oRequest, oVals) {
|
||||
fNormS = function(oRequest, oVals) {
|
||||
oVals[0] = Utils.pString(oVals[0]);
|
||||
oVals[1] = Utils.pInt(oVals[1]);
|
||||
oVals[1] = 0 >= oVals[1] ? 1 : oVals[1];
|
||||
|
|
@ -178,7 +171,7 @@
|
|||
|
||||
return [decodeURI(oVals[0]), oVals[1], decodeURI(oVals[2])];
|
||||
},
|
||||
fNormD = function (oRequest, oVals) {
|
||||
fNormD = function(oRequest, oVals) {
|
||||
oVals[0] = Utils.pString(oVals[0]);
|
||||
oVals[1] = Utils.pString(oVals[1]);
|
||||
|
||||
|
|
@ -188,8 +181,7 @@
|
|||
}
|
||||
|
||||
return [decodeURI(oVals[0]), 1, decodeURI(oVals[1])];
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
return [
|
||||
[/^([a-zA-Z0-9~]+)\/p([1-9][0-9]*)\/(.+)\/?$/, {'normalize_': fNormS}],
|
||||
|
|
@ -197,8 +189,6 @@
|
|||
[/^([a-zA-Z0-9~]+)\/(.+)\/?$/, {'normalize_': fNormD}],
|
||||
[/^([^\/]*)$/, {'normalize_': fNormS}]
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = MailBoxUserScreen;
|
||||
|
||||
}());
|
||||
module.exports = MailBoxUserScreen;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
|
|
@ -18,35 +14,34 @@
|
|||
|
||||
kn = require('Knoin/Knoin'),
|
||||
|
||||
AbstractSettingsScreen = require('Screen/AbstractSettings')
|
||||
;
|
||||
AbstractSettingsScreen = require('Screen/AbstractSettings');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSettingsScreen
|
||||
*/
|
||||
function SettingsUserScreen()
|
||||
{
|
||||
function SettingsUserScreen()
|
||||
{
|
||||
AbstractSettingsScreen.call(this, [
|
||||
require('View/User/Settings/SystemDropDown'),
|
||||
require('View/User/Settings/Menu'),
|
||||
require('View/User/Settings/Pane')
|
||||
]);
|
||||
|
||||
Translator.initOnStartOrLangChange(function () {
|
||||
Translator.initOnStartOrLangChange(function() {
|
||||
this.sSettingsTitle = Translator.i18n('TITLES/SETTINGS');
|
||||
}, this, function () {
|
||||
}, this, function() {
|
||||
this.setSettingsTitle();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
_.extend(SettingsUserScreen.prototype, AbstractSettingsScreen.prototype);
|
||||
_.extend(SettingsUserScreen.prototype, AbstractSettingsScreen.prototype);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Function=} fCallback
|
||||
*/
|
||||
SettingsUserScreen.prototype.setupSettings = function (fCallback)
|
||||
{
|
||||
SettingsUserScreen.prototype.setupSettings = function(fCallback)
|
||||
{
|
||||
if (!Settings.capa(Enums.Capa.Settings))
|
||||
{
|
||||
if (fCallback)
|
||||
|
|
@ -132,10 +127,10 @@
|
|||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
SettingsUserScreen.prototype.onShow = function ()
|
||||
{
|
||||
SettingsUserScreen.prototype.onShow = function()
|
||||
{
|
||||
this.setSettingsTitle();
|
||||
Globals.keyScope(Enums.KeyState.Settings);
|
||||
Globals.leftPanelType('');
|
||||
|
|
@ -144,14 +139,12 @@
|
|||
{
|
||||
Globals.leftPanelDisabled(true);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
SettingsUserScreen.prototype.setSettingsTitle = function ()
|
||||
{
|
||||
SettingsUserScreen.prototype.setSettingsTitle = function()
|
||||
{
|
||||
var sEmail = AccountStore.email();
|
||||
require('App/User').default.setWindowTitle(('' === sEmail ? '' : sEmail + ' - ') + this.sSettingsTitle);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = SettingsUserScreen;
|
||||
|
||||
}());
|
||||
module.exports = SettingsUserScreen;
|
||||
|
|
|
|||
|
|
@ -1,25 +1,20 @@
|
|||
|
||||
/* global RL_COMMUNITY */
|
||||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
ko = require('ko'),
|
||||
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
CoreStore = require('Stores/Admin/Core'),
|
||||
AppStore = require('Stores/Admin/App')
|
||||
;
|
||||
AppStore = require('Stores/Admin/App');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AboutAdminSettings()
|
||||
{
|
||||
function AboutAdminSettings()
|
||||
{
|
||||
this.version = ko.observable(Settings.appSettingsGet('version'));
|
||||
this.access = ko.observable(!!Settings.settingsGet('CoreAccess'));
|
||||
this.errorDesc = ko.observable('');
|
||||
|
|
@ -39,20 +34,19 @@
|
|||
|
||||
this.community = RL_COMMUNITY || AppStore.community();
|
||||
|
||||
this.coreRemoteVersionHtmlDesc = ko.computed(function () {
|
||||
this.coreRemoteVersionHtmlDesc = ko.computed(function() {
|
||||
Translator.trigger();
|
||||
return Translator.i18n('TAB_ABOUT/HTML_NEW_VERSION', {'VERSION': this.coreRemoteVersion()});
|
||||
}, this);
|
||||
|
||||
this.statusType = ko.computed(function () {
|
||||
this.statusType = ko.computed(function() {
|
||||
|
||||
var
|
||||
sType = '',
|
||||
iVersionCompare = this.coreVersionCompare(),
|
||||
bChecking = this.coreChecking(),
|
||||
bUpdating = this.coreUpdating(),
|
||||
bReal = this.coreReal()
|
||||
;
|
||||
bReal = this.coreReal();
|
||||
|
||||
if (bChecking)
|
||||
{
|
||||
|
|
@ -79,24 +73,22 @@
|
|||
return sType;
|
||||
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
|
||||
AboutAdminSettings.prototype.onBuild = function ()
|
||||
{
|
||||
AboutAdminSettings.prototype.onBuild = function()
|
||||
{
|
||||
if (this.access() && !this.community)
|
||||
{
|
||||
require('App/Admin').default.reloadCoreData();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
AboutAdminSettings.prototype.updateCoreData = function ()
|
||||
{
|
||||
AboutAdminSettings.prototype.updateCoreData = function()
|
||||
{
|
||||
if (!this.coreUpdating() && !this.community)
|
||||
{
|
||||
require('App/Admin').default.updateCoreData();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = AboutAdminSettings;
|
||||
|
||||
}());
|
||||
module.exports = AboutAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,28 +1,22 @@
|
|||
|
||||
/* global RL_COMMUNITY */
|
||||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator')
|
||||
;
|
||||
Translator = require('Common/Translator');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function BrandingAdminSettings()
|
||||
{
|
||||
function BrandingAdminSettings()
|
||||
{
|
||||
var
|
||||
Enums = require('Common/Enums'),
|
||||
Settings = require('Storage/Settings'),
|
||||
AppStore = require('Stores/Admin/App')
|
||||
;
|
||||
AppStore = require('Stores/Admin/App');
|
||||
|
||||
this.capa = AppStore.prem;
|
||||
|
||||
|
|
@ -68,7 +62,7 @@
|
|||
this.welcomePageDisplay = ko.observable(Settings.settingsGet('WelcomePageDisplay'));
|
||||
this.welcomePageDisplay.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.welcomePageDisplay.options = ko.computed(function () {
|
||||
this.welcomePageDisplay.options = ko.computed(function() {
|
||||
Translator.trigger();
|
||||
return [
|
||||
{'optValue': 'none', 'optText': Translator.i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_NONE')},
|
||||
|
|
@ -80,44 +74,40 @@
|
|||
this.loginPowered = ko.observable(!!Settings.settingsGet('LoginPowered'));
|
||||
|
||||
this.community = RL_COMMUNITY || AppStore.community();
|
||||
}
|
||||
}
|
||||
|
||||
BrandingAdminSettings.prototype.onBuild = function ()
|
||||
{
|
||||
BrandingAdminSettings.prototype.onBuild = function()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
_.delay(function () {
|
||||
_.delay(function() {
|
||||
|
||||
var
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.title.trigger, self),
|
||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.loadingDesc.trigger, self),
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.faviconUrl.trigger, self)
|
||||
;
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.faviconUrl.trigger, self);
|
||||
|
||||
self.title.subscribe(function (sValue) {
|
||||
self.title.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'Title': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.loadingDesc.subscribe(function (sValue) {
|
||||
self.loadingDesc.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f2, {
|
||||
'LoadingDescription': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.faviconUrl.subscribe(function (sValue) {
|
||||
self.faviconUrl.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f3, {
|
||||
'FaviconUrl': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
}, 50);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = BrandingAdminSettings;
|
||||
|
||||
}());
|
||||
module.exports = BrandingAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
|
|
@ -12,17 +8,15 @@
|
|||
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
Settings = require('Storage/Settings')
|
||||
;
|
||||
Settings = require('Storage/Settings');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function ContactsAdminSettings()
|
||||
{
|
||||
function ContactsAdminSettings()
|
||||
{
|
||||
var
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
|
||||
this.enableContacts = ko.observable(!!Settings.settingsGet('ContactsEnable'));
|
||||
|
|
@ -44,11 +38,11 @@
|
|||
case 'pgsql':
|
||||
sName = 'PostgreSQL';
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
||||
return sName;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
if (Settings.settingsGet('SQLiteIsSupported'))
|
||||
{
|
||||
|
|
@ -66,7 +60,7 @@
|
|||
this.contactsSupported = 0 < aSupportedTypes.length;
|
||||
|
||||
this.contactsTypes = ko.observableArray([]);
|
||||
this.contactsTypesOptions = this.contactsTypes.map(function (sValue) {
|
||||
this.contactsTypesOptions = this.contactsTypes.map(function(sValue) {
|
||||
var bDisabled = -1 === Utils.inArray(sValue, aSupportedTypes);
|
||||
return {
|
||||
'id': sValue,
|
||||
|
|
@ -81,7 +75,7 @@
|
|||
this.mainContactsType = ko.computed({
|
||||
'owner': this,
|
||||
'read': this.contactsType,
|
||||
'write': function (sValue) {
|
||||
'write': function(sValue) {
|
||||
if (sValue !== this.contactsType())
|
||||
{
|
||||
if (-1 < Utils.inArray(sValue, aSupportedTypes))
|
||||
|
|
@ -100,7 +94,7 @@
|
|||
}
|
||||
}).extend({'notify': 'always'});
|
||||
|
||||
this.contactsType.subscribe(function () {
|
||||
this.contactsType.subscribe(function() {
|
||||
this.testContactsSuccess(false);
|
||||
this.testContactsError(false);
|
||||
this.testContactsErrorMessage('');
|
||||
|
|
@ -120,7 +114,7 @@
|
|||
this.testContactsError = ko.observable(false);
|
||||
this.testContactsErrorMessage = ko.observable('');
|
||||
|
||||
this.testContactsCommand = Utils.createCommand(this, function () {
|
||||
this.testContactsCommand = Utils.createCommand(this, function() {
|
||||
|
||||
this.testContactsSuccess(false);
|
||||
this.testContactsError(false);
|
||||
|
|
@ -134,17 +128,17 @@
|
|||
'ContactsPdoPassword': this.pdoPassword()
|
||||
});
|
||||
|
||||
}, function () {
|
||||
}, function() {
|
||||
return '' !== this.pdoDsn() && '' !== this.pdoUser();
|
||||
});
|
||||
|
||||
this.contactsType(Settings.settingsGet('ContactsPdoType'));
|
||||
|
||||
this.onTestContactsResponse = _.bind(this.onTestContactsResponse, this);
|
||||
}
|
||||
}
|
||||
|
||||
ContactsAdminSettings.prototype.onTestContactsResponse = function (sResult, oData)
|
||||
{
|
||||
ContactsAdminSettings.prototype.onTestContactsResponse = function(sResult, oData)
|
||||
{
|
||||
this.testContactsSuccess(false);
|
||||
this.testContactsError(false);
|
||||
this.testContactsErrorMessage('');
|
||||
|
|
@ -167,68 +161,66 @@
|
|||
}
|
||||
|
||||
this.testing(false);
|
||||
};
|
||||
};
|
||||
|
||||
ContactsAdminSettings.prototype.onShow = function ()
|
||||
{
|
||||
ContactsAdminSettings.prototype.onShow = function()
|
||||
{
|
||||
this.testContactsSuccess(false);
|
||||
this.testContactsError(false);
|
||||
this.testContactsErrorMessage('');
|
||||
};
|
||||
};
|
||||
|
||||
ContactsAdminSettings.prototype.onBuild = function ()
|
||||
{
|
||||
ContactsAdminSettings.prototype.onBuild = function()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
_.delay(function () {
|
||||
_.delay(function() {
|
||||
|
||||
var
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.pdoDsnTrigger, self),
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.pdoUserTrigger, self),
|
||||
f4 = Utils.settingsSaveHelperSimpleFunction(self.pdoPasswordTrigger, self),
|
||||
f5 = Utils.settingsSaveHelperSimpleFunction(self.contactsTypeTrigger, self)
|
||||
;
|
||||
f5 = Utils.settingsSaveHelperSimpleFunction(self.contactsTypeTrigger, self);
|
||||
|
||||
self.enableContacts.subscribe(function (bValue) {
|
||||
self.enableContacts.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'ContactsEnable': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.contactsSharing.subscribe(function (bValue) {
|
||||
self.contactsSharing.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'ContactsSharing': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.contactsSync.subscribe(function (bValue) {
|
||||
self.contactsSync.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'ContactsSync': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.contactsType.subscribe(function (sValue) {
|
||||
self.contactsType.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f5, {
|
||||
'ContactsPdoType': sValue
|
||||
});
|
||||
});
|
||||
|
||||
self.pdoDsn.subscribe(function (sValue) {
|
||||
self.pdoDsn.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'ContactsPdoDsn': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.pdoUser.subscribe(function (sValue) {
|
||||
self.pdoUser.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f3, {
|
||||
'ContactsPdoUser': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.pdoPassword.subscribe(function (sValue) {
|
||||
self.pdoPassword.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f4, {
|
||||
'ContactsPdoPassword': Utils.trim(sValue)
|
||||
});
|
||||
|
|
@ -237,8 +229,6 @@
|
|||
self.contactsType(Settings.settingsGet('ContactsPdoType'));
|
||||
|
||||
}, 50);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = ContactsAdminSettings;
|
||||
|
||||
}());
|
||||
module.exports = ContactsAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,26 +1,21 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
|
||||
DomainStore = require('Stores/Admin/Domain'),
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function DomainsAdminSettings()
|
||||
{
|
||||
function DomainsAdminSettings()
|
||||
{
|
||||
this.domains = DomainStore.domains;
|
||||
|
||||
this.visibility = ko.computed(function () {
|
||||
this.visibility = ko.computed(function() {
|
||||
return this.domains.loading() ? 'visible' : 'hidden';
|
||||
}, this);
|
||||
|
||||
|
|
@ -28,59 +23,56 @@
|
|||
|
||||
this.onDomainListChangeRequest = _.bind(this.onDomainListChangeRequest, this);
|
||||
this.onDomainLoadRequest = _.bind(this.onDomainLoadRequest, this);
|
||||
}
|
||||
}
|
||||
|
||||
DomainsAdminSettings.prototype.createDomain = function ()
|
||||
{
|
||||
DomainsAdminSettings.prototype.createDomain = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Domain'));
|
||||
};
|
||||
};
|
||||
|
||||
DomainsAdminSettings.prototype.createDomainAlias = function ()
|
||||
{
|
||||
DomainsAdminSettings.prototype.createDomainAlias = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/DomainAlias'));
|
||||
};
|
||||
};
|
||||
|
||||
DomainsAdminSettings.prototype.deleteDomain = function (oDomain)
|
||||
{
|
||||
DomainsAdminSettings.prototype.deleteDomain = function(oDomain)
|
||||
{
|
||||
this.domains.remove(oDomain);
|
||||
Remote.domainDelete(this.onDomainListChangeRequest, oDomain.name);
|
||||
};
|
||||
};
|
||||
|
||||
DomainsAdminSettings.prototype.disableDomain = function (oDomain)
|
||||
{
|
||||
DomainsAdminSettings.prototype.disableDomain = function(oDomain)
|
||||
{
|
||||
oDomain.disabled(!oDomain.disabled());
|
||||
Remote.domainDisable(this.onDomainListChangeRequest, oDomain.name, oDomain.disabled());
|
||||
};
|
||||
};
|
||||
|
||||
DomainsAdminSettings.prototype.onBuild = function (oDom)
|
||||
{
|
||||
DomainsAdminSettings.prototype.onBuild = function(oDom)
|
||||
{
|
||||
var self = this;
|
||||
oDom
|
||||
.on('click', '.b-admin-domains-list-table .e-item .e-action', function () {
|
||||
.on('click', '.b-admin-domains-list-table .e-item .e-action', function() {
|
||||
var oDomainItem = ko.dataFor(this);
|
||||
if (oDomainItem)
|
||||
{
|
||||
Remote.domain(self.onDomainLoadRequest, oDomainItem.name);
|
||||
}
|
||||
})
|
||||
;
|
||||
});
|
||||
|
||||
require('App/Admin').default.reloadDomainList();
|
||||
};
|
||||
};
|
||||
|
||||
DomainsAdminSettings.prototype.onDomainLoadRequest = function (sResult, oData)
|
||||
{
|
||||
DomainsAdminSettings.prototype.onDomainLoadRequest = function(sResult, oData)
|
||||
{
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Domain'), [oData.Result]);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
DomainsAdminSettings.prototype.onDomainListChangeRequest = function ()
|
||||
{
|
||||
DomainsAdminSettings.prototype.onDomainListChangeRequest = function()
|
||||
{
|
||||
require('App/Admin').default.reloadDomainList();
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = DomainsAdminSettings;
|
||||
|
||||
}());
|
||||
module.exports = DomainsAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
|
|
@ -17,14 +13,13 @@
|
|||
AppAdminStore = require('Stores/Admin/App'),
|
||||
CapaAdminStore = require('Stores/Admin/Capa'),
|
||||
|
||||
Settings = require('Storage/Settings')
|
||||
;
|
||||
Settings = require('Storage/Settings');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function GeneralAdminSettings()
|
||||
{
|
||||
function GeneralAdminSettings()
|
||||
{
|
||||
this.language = LanguageStore.language;
|
||||
this.languages = LanguageStore.languages;
|
||||
this.languageAdmin = LanguageStore.languageAdmin;
|
||||
|
|
@ -51,8 +46,8 @@
|
|||
this.uploadData.post_max_size ? 'post_max_size = ' + this.uploadData.post_max_size : ''
|
||||
].join('') : '';
|
||||
|
||||
this.themesOptions = ko.computed(function () {
|
||||
return _.map(this.themes(), function (sTheme) {
|
||||
this.themesOptions = ko.computed(function() {
|
||||
return _.map(this.themes(), function(sTheme) {
|
||||
return {
|
||||
optValue: sTheme,
|
||||
optText: Utils.convertThemeName(sTheme)
|
||||
|
|
@ -60,11 +55,11 @@
|
|||
});
|
||||
}, this);
|
||||
|
||||
this.languageFullName = ko.computed(function () {
|
||||
this.languageFullName = ko.computed(function() {
|
||||
return Utils.convertLangName(this.language());
|
||||
}, this);
|
||||
|
||||
this.languageAdminFullName = ko.computed(function () {
|
||||
this.languageAdminFullName = ko.computed(function() {
|
||||
return Utils.convertLangName(this.languageAdmin());
|
||||
}, this);
|
||||
|
||||
|
|
@ -72,44 +67,42 @@
|
|||
this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.languageAdminTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100});
|
||||
this.themeTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
}
|
||||
}
|
||||
|
||||
GeneralAdminSettings.prototype.onBuild = function ()
|
||||
{
|
||||
GeneralAdminSettings.prototype.onBuild = function()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
_.delay(function () {
|
||||
_.delay(function() {
|
||||
|
||||
var
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.attachmentLimitTrigger, self),
|
||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.languageTrigger, self),
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.themeTrigger, self),
|
||||
fReloadLanguageHelper = function (iSaveSettingsStep) {
|
||||
fReloadLanguageHelper = function(iSaveSettingsStep) {
|
||||
return function() {
|
||||
self.languageAdminTrigger(iSaveSettingsStep);
|
||||
_.delay(function () {
|
||||
_.delay(function() {
|
||||
self.languageAdminTrigger(Enums.SaveSettingsStep.Idle);
|
||||
}, 1000);
|
||||
};
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
self.mainAttachmentLimit.subscribe(function (sValue) {
|
||||
self.mainAttachmentLimit.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'AttachmentLimit': Utils.pInt(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.language.subscribe(function (sValue) {
|
||||
self.language.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f2, {
|
||||
'Language': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.languageAdmin.subscribe(function (sValue) {
|
||||
self.languageAdmin.subscribe(function(sValue) {
|
||||
|
||||
self.languageAdminTrigger(Enums.SaveSettingsStep.Animate);
|
||||
|
||||
|
|
@ -124,7 +117,7 @@
|
|||
|
||||
});
|
||||
|
||||
self.theme.subscribe(function (sValue) {
|
||||
self.theme.subscribe(function(sValue) {
|
||||
|
||||
Utils.changeTheme(sValue, self.themeTrigger);
|
||||
|
||||
|
|
@ -133,79 +126,77 @@
|
|||
});
|
||||
});
|
||||
|
||||
self.capaAdditionalAccounts.subscribe(function (bValue) {
|
||||
self.capaAdditionalAccounts.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaAdditionalAccounts': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.capaIdentities.subscribe(function (bValue) {
|
||||
self.capaIdentities.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaIdentities': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.capaTemplates.subscribe(function (bValue) {
|
||||
self.capaTemplates.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaTemplates': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.capaGravatar.subscribe(function (bValue) {
|
||||
self.capaGravatar.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaGravatar': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.capaAttachmentThumbnails.subscribe(function (bValue) {
|
||||
self.capaAttachmentThumbnails.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaAttachmentThumbnails': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.capaThemes.subscribe(function (bValue) {
|
||||
self.capaThemes.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaThemes': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.capaUserBackground.subscribe(function (bValue) {
|
||||
self.capaUserBackground.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaUserBackground': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.allowLanguagesOnSettings.subscribe(function (bValue) {
|
||||
self.allowLanguagesOnSettings.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'AllowLanguagesOnSettings': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
}, 50);
|
||||
};
|
||||
};
|
||||
|
||||
GeneralAdminSettings.prototype.selectLanguage = function ()
|
||||
{
|
||||
GeneralAdminSettings.prototype.selectLanguage = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Languages'), [
|
||||
this.language, this.languages(), LanguageStore.userLanguage()
|
||||
]);
|
||||
};
|
||||
};
|
||||
|
||||
GeneralAdminSettings.prototype.selectLanguageAdmin = function ()
|
||||
{
|
||||
GeneralAdminSettings.prototype.selectLanguageAdmin = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Languages'), [
|
||||
this.languageAdmin, this.languagesAdmin(), LanguageStore.userLanguageAdmin()
|
||||
]);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
GeneralAdminSettings.prototype.phpInfoLink = function ()
|
||||
{
|
||||
GeneralAdminSettings.prototype.phpInfoLink = function()
|
||||
{
|
||||
return Links.phpInfo();
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = GeneralAdminSettings;
|
||||
|
||||
}());
|
||||
module.exports = GeneralAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
|
|
@ -12,14 +8,13 @@
|
|||
|
||||
AppAdminStore = require('Stores/Admin/App'),
|
||||
|
||||
Settings = require('Storage/Settings')
|
||||
;
|
||||
Settings = require('Storage/Settings');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function LoginAdminSettings()
|
||||
{
|
||||
function LoginAdminSettings()
|
||||
{
|
||||
this.determineUserLanguage = AppAdminStore.determineUserLanguage;
|
||||
this.determineUserDomain = AppAdminStore.determineUserDomain;
|
||||
|
||||
|
|
@ -29,46 +24,43 @@
|
|||
this.defaultDomainTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.dummy = ko.observable(false);
|
||||
}
|
||||
}
|
||||
|
||||
LoginAdminSettings.prototype.onBuild = function ()
|
||||
{
|
||||
LoginAdminSettings.prototype.onBuild = function()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
_.delay(function () {
|
||||
_.delay(function() {
|
||||
|
||||
var f1 = Utils.settingsSaveHelperSimpleFunction(self.defaultDomainTrigger, self);
|
||||
|
||||
self.determineUserLanguage.subscribe(function (bValue) {
|
||||
self.determineUserLanguage.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'DetermineUserLanguage': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.determineUserDomain.subscribe(function (bValue) {
|
||||
self.determineUserDomain.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'DetermineUserDomain': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.allowLanguagesOnLogin.subscribe(function (bValue) {
|
||||
self.allowLanguagesOnLogin.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'AllowLanguagesOnLogin': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.defaultDomain.subscribe(function (sValue) {
|
||||
self.defaultDomain.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'LoginDefaultDomain': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
}, 50);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = LoginAdminSettings;
|
||||
|
||||
}());
|
||||
module.exports = LoginAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
window = require('window'),
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
|
@ -12,51 +8,50 @@
|
|||
Translator = require('Common/Translator'),
|
||||
|
||||
PackageStore = require('Stores/Admin/Package'),
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function PackagesAdminSettings()
|
||||
{
|
||||
function PackagesAdminSettings()
|
||||
{
|
||||
this.packagesError = ko.observable('');
|
||||
|
||||
this.packages = PackageStore.packages;
|
||||
this.packagesReal = PackageStore.packagesReal;
|
||||
this.packagesMainUpdatable = PackageStore.packagesMainUpdatable;
|
||||
|
||||
this.packagesCurrent = this.packages.filter(function (item) {
|
||||
this.packagesCurrent = this.packages.filter(function(item) {
|
||||
return item && '' !== item.installed && !item.compare;
|
||||
});
|
||||
|
||||
this.packagesAvailableForUpdate = this.packages.filter(function (item) {
|
||||
this.packagesAvailableForUpdate = this.packages.filter(function(item) {
|
||||
return item && '' !== item.installed && !!item.compare;
|
||||
});
|
||||
|
||||
this.packagesAvailableForInstallation = this.packages.filter(function (item) {
|
||||
this.packagesAvailableForInstallation = this.packages.filter(function(item) {
|
||||
return item && '' === item.installed;
|
||||
});
|
||||
|
||||
this.visibility = ko.computed(function () {
|
||||
this.visibility = ko.computed(function() {
|
||||
return PackageStore.packages.loading() ? 'visible' : 'hidden';
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
|
||||
PackagesAdminSettings.prototype.onShow = function ()
|
||||
{
|
||||
PackagesAdminSettings.prototype.onShow = function()
|
||||
{
|
||||
this.packagesError('');
|
||||
};
|
||||
};
|
||||
|
||||
PackagesAdminSettings.prototype.onBuild = function ()
|
||||
{
|
||||
PackagesAdminSettings.prototype.onBuild = function()
|
||||
{
|
||||
require('App/Admin').default.reloadPackagesList();
|
||||
};
|
||||
};
|
||||
|
||||
PackagesAdminSettings.prototype.requestHelper = function (oPackage, bInstall)
|
||||
{
|
||||
PackagesAdminSettings.prototype.requestHelper = function(oPackage, bInstall)
|
||||
{
|
||||
var self = this;
|
||||
return function (sResult, oData) {
|
||||
return function(sResult, oData) {
|
||||
|
||||
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
|
||||
{
|
||||
|
|
@ -71,7 +66,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
_.each(self.packages(), function (item) {
|
||||
_.each(self.packages(), function(item) {
|
||||
if (item && oPackage && item.loading && item.loading() && oPackage.file === item.file)
|
||||
{
|
||||
oPackage.loading(false);
|
||||
|
|
@ -88,26 +83,24 @@
|
|||
require('App/Admin').default.reloadPackagesList();
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
PackagesAdminSettings.prototype.deletePackage = function (oPackage)
|
||||
{
|
||||
PackagesAdminSettings.prototype.deletePackage = function(oPackage)
|
||||
{
|
||||
if (oPackage)
|
||||
{
|
||||
oPackage.loading(true);
|
||||
Remote.packageDelete(this.requestHelper(oPackage, false), oPackage);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
PackagesAdminSettings.prototype.installPackage = function (oPackage)
|
||||
{
|
||||
PackagesAdminSettings.prototype.installPackage = function(oPackage)
|
||||
{
|
||||
if (oPackage)
|
||||
{
|
||||
oPackage.loading(true);
|
||||
Remote.packageInstall(this.requestHelper(oPackage, true), oPackage);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PackagesAdminSettings;
|
||||
|
||||
}());
|
||||
module.exports = PackagesAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
|
||||
/* global RL_COMMUNITY */
|
||||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
|
|
@ -18,14 +14,13 @@
|
|||
AppStore = require('Stores/Admin/App'),
|
||||
PluginStore = require('Stores/Admin/Plugin'),
|
||||
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function PluginsAdminSettings()
|
||||
{
|
||||
function PluginsAdminSettings()
|
||||
{
|
||||
this.enabledPlugins = ko.observable(!!Settings.settingsGet('EnabledPlugins'));
|
||||
|
||||
this.plugins = PluginStore.plugins;
|
||||
|
|
@ -33,69 +28,68 @@
|
|||
|
||||
this.community = RL_COMMUNITY || AppStore.community();
|
||||
|
||||
this.visibility = ko.computed(function () {
|
||||
this.visibility = ko.computed(function() {
|
||||
return PluginStore.plugins.loading() ? 'visible' : 'hidden';
|
||||
}, this);
|
||||
|
||||
this.onPluginLoadRequest = _.bind(this.onPluginLoadRequest, this);
|
||||
this.onPluginDisableRequest = _.bind(this.onPluginDisableRequest, this);
|
||||
}
|
||||
}
|
||||
|
||||
PluginsAdminSettings.prototype.disablePlugin = function (oPlugin)
|
||||
{
|
||||
PluginsAdminSettings.prototype.disablePlugin = function(oPlugin)
|
||||
{
|
||||
oPlugin.disabled(!oPlugin.disabled());
|
||||
Remote.pluginDisable(this.onPluginDisableRequest, oPlugin.name, oPlugin.disabled());
|
||||
};
|
||||
};
|
||||
|
||||
PluginsAdminSettings.prototype.configurePlugin = function (oPlugin)
|
||||
{
|
||||
PluginsAdminSettings.prototype.configurePlugin = function(oPlugin)
|
||||
{
|
||||
Remote.plugin(this.onPluginLoadRequest, oPlugin.name);
|
||||
};
|
||||
};
|
||||
|
||||
PluginsAdminSettings.prototype.onBuild = function (oDom)
|
||||
{
|
||||
PluginsAdminSettings.prototype.onBuild = function(oDom)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
oDom
|
||||
.on('click', '.e-item .configure-plugin-action', function () {
|
||||
.on('click', '.e-item .configure-plugin-action', function() {
|
||||
var oPlugin = ko.dataFor(this);
|
||||
if (oPlugin)
|
||||
{
|
||||
self.configurePlugin(oPlugin);
|
||||
}
|
||||
})
|
||||
.on('click', '.e-item .disabled-plugin', function () {
|
||||
.on('click', '.e-item .disabled-plugin', function() {
|
||||
var oPlugin = ko.dataFor(this);
|
||||
if (oPlugin)
|
||||
{
|
||||
self.disablePlugin(oPlugin);
|
||||
}
|
||||
})
|
||||
;
|
||||
});
|
||||
|
||||
this.enabledPlugins.subscribe(function (bValue) {
|
||||
this.enabledPlugins.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'EnabledPlugins': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
PluginsAdminSettings.prototype.onShow = function ()
|
||||
{
|
||||
PluginsAdminSettings.prototype.onShow = function()
|
||||
{
|
||||
PluginStore.plugins.error('');
|
||||
require('App/Admin').default.reloadPluginList();
|
||||
};
|
||||
};
|
||||
|
||||
PluginsAdminSettings.prototype.onPluginLoadRequest = function (sResult, oData)
|
||||
{
|
||||
PluginsAdminSettings.prototype.onPluginLoadRequest = function(sResult, oData)
|
||||
{
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Plugin'), [oData.Result]);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
PluginsAdminSettings.prototype.onPluginDisableRequest = function (sResult, oData)
|
||||
{
|
||||
PluginsAdminSettings.prototype.onPluginDisableRequest = function(sResult, oData)
|
||||
{
|
||||
if (Enums.StorageResultType.Success === sResult && oData)
|
||||
{
|
||||
if (!oData.Result && oData.ErrorCode)
|
||||
|
|
@ -112,8 +106,6 @@
|
|||
}
|
||||
|
||||
require('App/Admin').default.reloadPluginList();
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PluginsAdminSettings;
|
||||
|
||||
}());
|
||||
module.exports = PluginsAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
|
|
@ -15,14 +11,13 @@
|
|||
CapaAdminStore = require('Stores/Admin/Capa'),
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function SecurityAdminSettings()
|
||||
{
|
||||
function SecurityAdminSettings()
|
||||
{
|
||||
this.useLocalProxyForExternalImages = AppAdminStore.useLocalProxyForExternalImages;
|
||||
|
||||
this.weakPassword = AppAdminStore.weakPassword;
|
||||
|
|
@ -32,7 +27,7 @@
|
|||
this.capaTwoFactorAuth = CapaAdminStore.twoFactorAuth;
|
||||
this.capaTwoFactorAuthForce = CapaAdminStore.twoFactorAuthForce;
|
||||
|
||||
this.capaTwoFactorAuth.subscribe(function (bValue) {
|
||||
this.capaTwoFactorAuth.subscribe(function(bValue) {
|
||||
if (!bValue)
|
||||
{
|
||||
this.capaTwoFactorAuthForce(false);
|
||||
|
|
@ -42,7 +37,7 @@
|
|||
this.verifySslCertificate = ko.observable(!!Settings.settingsGet('VerifySslCertificate'));
|
||||
this.allowSelfSigned = ko.observable(!!Settings.settingsGet('AllowSelfSigned'));
|
||||
|
||||
this.verifySslCertificate.subscribe(function (bValue) {
|
||||
this.verifySslCertificate.subscribe(function(bValue) {
|
||||
if (!bValue)
|
||||
{
|
||||
this.allowSelfSigned(true);
|
||||
|
|
@ -59,28 +54,28 @@
|
|||
this.adminPasswordUpdateError = ko.observable(false);
|
||||
this.adminPasswordUpdateSuccess = ko.observable(false);
|
||||
|
||||
this.adminPassword.subscribe(function () {
|
||||
this.adminPassword.subscribe(function() {
|
||||
this.adminPasswordUpdateError(false);
|
||||
this.adminPasswordUpdateSuccess(false);
|
||||
}, this);
|
||||
|
||||
this.adminLogin.subscribe(function () {
|
||||
this.adminLogin.subscribe(function() {
|
||||
this.adminLoginError(false);
|
||||
}, this);
|
||||
|
||||
this.adminPasswordNew.subscribe(function () {
|
||||
this.adminPasswordNew.subscribe(function() {
|
||||
this.adminPasswordUpdateError(false);
|
||||
this.adminPasswordUpdateSuccess(false);
|
||||
this.adminPasswordNewError(false);
|
||||
}, this);
|
||||
|
||||
this.adminPasswordNew2.subscribe(function () {
|
||||
this.adminPasswordNew2.subscribe(function() {
|
||||
this.adminPasswordUpdateError(false);
|
||||
this.adminPasswordUpdateSuccess(false);
|
||||
this.adminPasswordNewError(false);
|
||||
}, this);
|
||||
|
||||
this.saveNewAdminPasswordCommand = Utils.createCommand(this, function () {
|
||||
this.saveNewAdminPasswordCommand = Utils.createCommand(this, function() {
|
||||
|
||||
if ('' === Utils.trim(this.adminLogin()))
|
||||
{
|
||||
|
|
@ -103,15 +98,15 @@
|
|||
'NewPassword': this.adminPasswordNew()
|
||||
});
|
||||
|
||||
}, function () {
|
||||
}, function() {
|
||||
return '' !== Utils.trim(this.adminLogin()) && '' !== this.adminPassword();
|
||||
});
|
||||
|
||||
this.onNewAdminPasswordResponse = _.bind(this.onNewAdminPasswordResponse, this);
|
||||
}
|
||||
}
|
||||
|
||||
SecurityAdminSettings.prototype.onNewAdminPasswordResponse = function (sResult, oData)
|
||||
{
|
||||
SecurityAdminSettings.prototype.onNewAdminPasswordResponse = function(sResult, oData)
|
||||
{
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
this.adminPassword('');
|
||||
|
|
@ -126,62 +121,60 @@
|
|||
{
|
||||
this.adminPasswordUpdateError(true);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
SecurityAdminSettings.prototype.onBuild = function ()
|
||||
{
|
||||
this.capaOpenPGP.subscribe(function (bValue) {
|
||||
SecurityAdminSettings.prototype.onBuild = function()
|
||||
{
|
||||
this.capaOpenPGP.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'CapaOpenPGP': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.capaTwoFactorAuth.subscribe(function (bValue) {
|
||||
this.capaTwoFactorAuth.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'CapaTwoFactorAuth': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.capaTwoFactorAuthForce.subscribe(function (bValue) {
|
||||
this.capaTwoFactorAuthForce.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'CapaTwoFactorAuthForce': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.useLocalProxyForExternalImages.subscribe(function (bValue) {
|
||||
this.useLocalProxyForExternalImages.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'UseLocalProxyForExternalImages': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.verifySslCertificate.subscribe(function (bValue) {
|
||||
this.verifySslCertificate.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'VerifySslCertificate': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.allowSelfSigned.subscribe(function (bValue) {
|
||||
this.allowSelfSigned.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'AllowSelfSigned': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
SecurityAdminSettings.prototype.onHide = function ()
|
||||
{
|
||||
SecurityAdminSettings.prototype.onHide = function()
|
||||
{
|
||||
this.adminPassword('');
|
||||
this.adminPasswordNew('');
|
||||
this.adminPasswordNew2('');
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
SecurityAdminSettings.prototype.phpInfoLink = function ()
|
||||
{
|
||||
SecurityAdminSettings.prototype.phpInfoLink = function()
|
||||
{
|
||||
return Links.phpInfo();
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = SecurityAdminSettings;
|
||||
|
||||
}());
|
||||
module.exports = SecurityAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,21 +1,16 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils')
|
||||
;
|
||||
Utils = require('Common/Utils');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function SocialAdminSettings()
|
||||
{
|
||||
function SocialAdminSettings()
|
||||
{
|
||||
var SocialStore = require('Stores/Social');
|
||||
|
||||
this.googleEnable = SocialStore.google.enabled;
|
||||
|
|
@ -54,16 +49,15 @@
|
|||
this.dropboxApiKey = SocialStore.dropbox.apiKey;
|
||||
|
||||
this.dropboxTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
}
|
||||
}
|
||||
|
||||
SocialAdminSettings.prototype.onBuild = function ()
|
||||
{
|
||||
SocialAdminSettings.prototype.onBuild = function()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
_.delay(function () {
|
||||
_.delay(function() {
|
||||
|
||||
var
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.facebookTrigger1, self),
|
||||
|
|
@ -73,10 +67,9 @@
|
|||
f5 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger1, self),
|
||||
f6 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger2, self),
|
||||
f7 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger3, self),
|
||||
f8 = Utils.settingsSaveHelperSimpleFunction(self.dropboxTrigger1, self)
|
||||
;
|
||||
f8 = Utils.settingsSaveHelperSimpleFunction(self.dropboxTrigger1, self);
|
||||
|
||||
self.facebookEnable.subscribe(function (bValue) {
|
||||
self.facebookEnable.subscribe(function(bValue) {
|
||||
if (self.facebookSupported())
|
||||
{
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
|
|
@ -85,7 +78,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
self.facebookAppID.subscribe(function (sValue) {
|
||||
self.facebookAppID.subscribe(function(sValue) {
|
||||
if (self.facebookSupported())
|
||||
{
|
||||
Remote.saveAdminConfig(f1, {
|
||||
|
|
@ -94,7 +87,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
self.facebookAppSecret.subscribe(function (sValue) {
|
||||
self.facebookAppSecret.subscribe(function(sValue) {
|
||||
if (self.facebookSupported())
|
||||
{
|
||||
Remote.saveAdminConfig(f2, {
|
||||
|
|
@ -103,81 +96,79 @@
|
|||
}
|
||||
});
|
||||
|
||||
self.twitterEnable.subscribe(function (bValue) {
|
||||
self.twitterEnable.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'TwitterEnable': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.twitterConsumerKey.subscribe(function (sValue) {
|
||||
self.twitterConsumerKey.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f3, {
|
||||
'TwitterConsumerKey': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.twitterConsumerSecret.subscribe(function (sValue) {
|
||||
self.twitterConsumerSecret.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f4, {
|
||||
'TwitterConsumerSecret': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.googleEnable.subscribe(function (bValue) {
|
||||
self.googleEnable.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'GoogleEnable': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.googleEnableAuth.subscribe(function (bValue) {
|
||||
self.googleEnableAuth.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'GoogleEnableAuth': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.googleEnableDrive.subscribe(function (bValue) {
|
||||
self.googleEnableDrive.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'GoogleEnableDrive': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.googleEnablePreview.subscribe(function (bValue) {
|
||||
self.googleEnablePreview.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'GoogleEnablePreview': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.googleClientID.subscribe(function (sValue) {
|
||||
self.googleClientID.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f5, {
|
||||
'GoogleClientID': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.googleClientSecret.subscribe(function (sValue) {
|
||||
self.googleClientSecret.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f6, {
|
||||
'GoogleClientSecret': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.googleApiKey.subscribe(function (sValue) {
|
||||
self.googleApiKey.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f7, {
|
||||
'GoogleApiKey': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.dropboxEnable.subscribe(function (bValue) {
|
||||
self.dropboxEnable.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'DropboxEnable': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.dropboxApiKey.subscribe(function (sValue) {
|
||||
self.dropboxApiKey.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f8, {
|
||||
'DropboxApiKey': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
}, 50);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = SocialAdminSettings;
|
||||
|
||||
}());
|
||||
module.exports = SocialAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
window = require('window'),
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
|
@ -15,14 +11,13 @@
|
|||
IdentityStore = require('Stores/User/Identity'),
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
Remote = require('Remote/User/Ajax')
|
||||
;
|
||||
Remote = require('Remote/User/Ajax');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AccountsUserSettings()
|
||||
{
|
||||
function AccountsUserSettings()
|
||||
{
|
||||
this.allowAdditionalAccount = Settings.capa(Enums.Capa.AdditionalAccounts);
|
||||
this.allowIdentities = Settings.capa(Enums.Capa.Identities);
|
||||
|
||||
|
|
@ -31,61 +26,60 @@
|
|||
|
||||
this.accountForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
this.identityForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
}
|
||||
}
|
||||
|
||||
AccountsUserSettings.prototype.scrollableOptions = function (sWrapper)
|
||||
{
|
||||
AccountsUserSettings.prototype.scrollableOptions = function(sWrapper)
|
||||
{
|
||||
return {
|
||||
handle: '.drag-handle',
|
||||
containment: sWrapper || 'parent',
|
||||
axis: 'y'
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
AccountsUserSettings.prototype.addNewAccount = function ()
|
||||
{
|
||||
AccountsUserSettings.prototype.addNewAccount = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Account'));
|
||||
};
|
||||
};
|
||||
|
||||
AccountsUserSettings.prototype.editAccount = function (oAccountItem)
|
||||
{
|
||||
AccountsUserSettings.prototype.editAccount = function(oAccountItem)
|
||||
{
|
||||
if (oAccountItem && oAccountItem.canBeEdit())
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Account'), [oAccountItem]);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
AccountsUserSettings.prototype.addNewIdentity = function ()
|
||||
{
|
||||
AccountsUserSettings.prototype.addNewIdentity = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Identity'));
|
||||
};
|
||||
};
|
||||
|
||||
AccountsUserSettings.prototype.editIdentity = function (oIdentity)
|
||||
{
|
||||
AccountsUserSettings.prototype.editIdentity = function(oIdentity)
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Identity'), [oIdentity]);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {AccountModel} oAccountToRemove
|
||||
*/
|
||||
AccountsUserSettings.prototype.deleteAccount = function (oAccountToRemove)
|
||||
{
|
||||
AccountsUserSettings.prototype.deleteAccount = function(oAccountToRemove)
|
||||
{
|
||||
if (oAccountToRemove && oAccountToRemove.deleteAccess())
|
||||
{
|
||||
this.accountForDeletion(null);
|
||||
|
||||
var
|
||||
kn = require('Knoin/Knoin'),
|
||||
fRemoveAccount = function (oAccount) {
|
||||
fRemoveAccount = function(oAccount) {
|
||||
return oAccountToRemove === oAccount;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
if (oAccountToRemove)
|
||||
{
|
||||
this.accounts.remove(fRemoveAccount);
|
||||
|
||||
Remote.accountDelete(function (sResult, oData) {
|
||||
Remote.accountDelete(function(sResult, oData) {
|
||||
|
||||
if (Enums.StorageResultType.Success === sResult && oData &&
|
||||
oData.Result && oData.Reload)
|
||||
|
|
@ -94,7 +88,7 @@
|
|||
kn.setHash(Links.root(), true);
|
||||
kn.routeOff();
|
||||
|
||||
_.defer(function () {
|
||||
_.defer(function() {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
|
|
@ -106,58 +100,55 @@
|
|||
}, oAccountToRemove.email);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {IdentityModel} oIdentityToRemove
|
||||
*/
|
||||
AccountsUserSettings.prototype.deleteIdentity = function (oIdentityToRemove)
|
||||
{
|
||||
AccountsUserSettings.prototype.deleteIdentity = function(oIdentityToRemove)
|
||||
{
|
||||
if (oIdentityToRemove && oIdentityToRemove.deleteAccess())
|
||||
{
|
||||
this.identityForDeletion(null);
|
||||
|
||||
if (oIdentityToRemove)
|
||||
{
|
||||
IdentityStore.identities.remove(function (oIdentity) {
|
||||
IdentityStore.identities.remove(function(oIdentity) {
|
||||
return oIdentityToRemove === oIdentity;
|
||||
});
|
||||
|
||||
Remote.identityDelete(function () {
|
||||
Remote.identityDelete(function() {
|
||||
require('App/User').default.accountsAndIdentities();
|
||||
}, oIdentityToRemove.id);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
AccountsUserSettings.prototype.accountsAndIdentitiesAfterMove = function ()
|
||||
{
|
||||
AccountsUserSettings.prototype.accountsAndIdentitiesAfterMove = function()
|
||||
{
|
||||
Remote.accountsAndIdentitiesSortOrder(null,
|
||||
AccountStore.accountsEmails.peek(), IdentityStore.identitiesIDS.peek());
|
||||
};
|
||||
};
|
||||
|
||||
AccountsUserSettings.prototype.onBuild = function (oDom)
|
||||
{
|
||||
AccountsUserSettings.prototype.onBuild = function(oDom)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
oDom
|
||||
.on('click', '.accounts-list .account-item .e-action', function () {
|
||||
.on('click', '.accounts-list .account-item .e-action', function() {
|
||||
var oAccountItem = ko.dataFor(this);
|
||||
if (oAccountItem)
|
||||
{
|
||||
self.editAccount(oAccountItem);
|
||||
}
|
||||
})
|
||||
.on('click', '.identities-list .identity-item .e-action', function () {
|
||||
.on('click', '.identities-list .identity-item .e-action', function() {
|
||||
var oIdentityItem = ko.dataFor(this);
|
||||
if (oIdentityItem)
|
||||
{
|
||||
self.editIdentity(oIdentityItem);
|
||||
}
|
||||
})
|
||||
;
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = AccountsUserSettings;
|
||||
|
||||
}());
|
||||
module.exports = AccountsUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
|
|
@ -11,14 +7,13 @@
|
|||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
Remote = require('Remote/User/Ajax')
|
||||
;
|
||||
Remote = require('Remote/User/Ajax');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function ChangePasswordUserSettings()
|
||||
{
|
||||
function ChangePasswordUserSettings()
|
||||
{
|
||||
this.changeProcess = ko.observable(false);
|
||||
|
||||
this.errorDescription = ko.observable('');
|
||||
|
|
@ -31,25 +26,25 @@
|
|||
this.newPassword = ko.observable('');
|
||||
this.newPassword2 = ko.observable('');
|
||||
|
||||
this.currentPassword.subscribe(function () {
|
||||
this.currentPassword.subscribe(function() {
|
||||
this.passwordUpdateError(false);
|
||||
this.passwordUpdateSuccess(false);
|
||||
this.currentPassword.error(false);
|
||||
}, this);
|
||||
|
||||
this.newPassword.subscribe(function () {
|
||||
this.newPassword.subscribe(function() {
|
||||
this.passwordUpdateError(false);
|
||||
this.passwordUpdateSuccess(false);
|
||||
this.passwordMismatch(false);
|
||||
}, this);
|
||||
|
||||
this.newPassword2.subscribe(function () {
|
||||
this.newPassword2.subscribe(function() {
|
||||
this.passwordUpdateError(false);
|
||||
this.passwordUpdateSuccess(false);
|
||||
this.passwordMismatch(false);
|
||||
}, this);
|
||||
|
||||
this.saveNewPasswordCommand = Utils.createCommand(this, function () {
|
||||
this.saveNewPasswordCommand = Utils.createCommand(this, function() {
|
||||
|
||||
if (this.newPassword() !== this.newPassword2())
|
||||
{
|
||||
|
|
@ -69,16 +64,16 @@
|
|||
Remote.changePassword(this.onChangePasswordResponse, this.currentPassword(), this.newPassword());
|
||||
}
|
||||
|
||||
}, function () {
|
||||
}, function() {
|
||||
return !this.changeProcess() && '' !== this.currentPassword() &&
|
||||
'' !== this.newPassword() && '' !== this.newPassword2();
|
||||
});
|
||||
|
||||
this.onChangePasswordResponse = _.bind(this.onChangePasswordResponse, this);
|
||||
}
|
||||
}
|
||||
|
||||
ChangePasswordUserSettings.prototype.onHide = function ()
|
||||
{
|
||||
ChangePasswordUserSettings.prototype.onHide = function()
|
||||
{
|
||||
this.changeProcess(false);
|
||||
this.currentPassword('');
|
||||
this.newPassword('');
|
||||
|
|
@ -86,10 +81,10 @@
|
|||
this.errorDescription('');
|
||||
this.passwordMismatch(false);
|
||||
this.currentPassword.error(false);
|
||||
};
|
||||
};
|
||||
|
||||
ChangePasswordUserSettings.prototype.onChangePasswordResponse = function (sResult, oData)
|
||||
{
|
||||
ChangePasswordUserSettings.prototype.onChangePasswordResponse = function(sResult, oData)
|
||||
{
|
||||
this.changeProcess(false);
|
||||
this.passwordMismatch(false);
|
||||
this.errorDescription('');
|
||||
|
|
@ -117,8 +112,6 @@
|
|||
this.errorDescription(
|
||||
Translator.getNotificationFromResponse(oData, Enums.Notification.CouldNotSaveNewPassword));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = ChangePasswordUserSettings;
|
||||
|
||||
}());
|
||||
module.exports = ChangePasswordUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,22 +1,17 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
ko = require('ko'),
|
||||
|
||||
AppStore = require('Stores/User/App'),
|
||||
ContactStore = require('Stores/User/Contact'),
|
||||
|
||||
Remote = require('Remote/User/Ajax')
|
||||
;
|
||||
Remote = require('Remote/User/Ajax');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function ContactsUserSettings()
|
||||
{
|
||||
function ContactsUserSettings()
|
||||
{
|
||||
this.contactsAutosave = AppStore.contactsAutosave;
|
||||
|
||||
this.allowContactsSync = ContactStore.allowContactsSync;
|
||||
|
|
@ -25,7 +20,7 @@
|
|||
this.contactsSyncUser = ContactStore.contactsSyncUser;
|
||||
this.contactsSyncPass = ContactStore.contactsSyncPass;
|
||||
|
||||
this.saveTrigger = ko.computed(function () {
|
||||
this.saveTrigger = ko.computed(function() {
|
||||
return [
|
||||
this.enableContactsSync() ? '1' : '0',
|
||||
this.contactsSyncUrl(),
|
||||
|
|
@ -33,17 +28,17 @@
|
|||
this.contactsSyncPass()
|
||||
].join('|');
|
||||
}, this).extend({'throttle': 500});
|
||||
}
|
||||
}
|
||||
|
||||
ContactsUserSettings.prototype.onBuild = function ()
|
||||
{
|
||||
this.contactsAutosave.subscribe(function (bValue) {
|
||||
ContactsUserSettings.prototype.onBuild = function()
|
||||
{
|
||||
this.contactsAutosave.subscribe(function(bValue) {
|
||||
Remote.saveSettings(null, {
|
||||
'ContactsAutosave': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.saveTrigger.subscribe(function () {
|
||||
this.saveTrigger.subscribe(function() {
|
||||
Remote.saveContactsSyncData(null,
|
||||
this.enableContactsSync(),
|
||||
this.contactsSyncUrl(),
|
||||
|
|
@ -51,8 +46,6 @@
|
|||
this.contactsSyncPass()
|
||||
);
|
||||
}, this);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = ContactsUserSettings;
|
||||
|
||||
}());
|
||||
module.exports = ContactsUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
ko = require('ko'),
|
||||
_ = require('_'),
|
||||
|
||||
|
|
@ -13,14 +9,13 @@
|
|||
|
||||
FilterStore = require('Stores/User/Filter'),
|
||||
|
||||
Remote = require('Remote/User/Ajax')
|
||||
;
|
||||
Remote = require('Remote/User/Ajax');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function FiltersUserSettings()
|
||||
{
|
||||
function FiltersUserSettings()
|
||||
{
|
||||
var self = this;
|
||||
|
||||
this.modules = FilterStore.modules;
|
||||
|
|
@ -35,7 +30,7 @@
|
|||
|
||||
this.filters.subscribe(Utils.windowResizeCallback);
|
||||
|
||||
this.serverError.subscribe(function (bValue) {
|
||||
this.serverError.subscribe(function(bValue) {
|
||||
if (!bValue)
|
||||
{
|
||||
this.serverErrorDesc('');
|
||||
|
|
@ -51,7 +46,7 @@
|
|||
this.filterForDeletion = ko.observable(null).extend({'falseTimeout': 3000}).extend(
|
||||
{'toggleSubscribeProperty': [this, 'deleteAccess']});
|
||||
|
||||
this.saveChanges = Utils.createCommand(this, function () {
|
||||
this.saveChanges = Utils.createCommand(this, function() {
|
||||
|
||||
if (!this.filters.saving())
|
||||
{
|
||||
|
|
@ -64,7 +59,7 @@
|
|||
this.filters.saving(true);
|
||||
this.saveErrorText('');
|
||||
|
||||
Remote.filtersSave(function (sResult, oData) {
|
||||
Remote.filtersSave(function(sResult, oData) {
|
||||
|
||||
self.filters.saving(false);
|
||||
|
||||
|
|
@ -87,50 +82,49 @@
|
|||
|
||||
return true;
|
||||
|
||||
}, function () {
|
||||
}, function() {
|
||||
return this.haveChanges();
|
||||
});
|
||||
|
||||
this.filters.subscribe(function () {
|
||||
this.filters.subscribe(function() {
|
||||
this.haveChanges(true);
|
||||
}, this);
|
||||
|
||||
this.filterRaw.subscribe(function () {
|
||||
this.filterRaw.subscribe(function() {
|
||||
this.haveChanges(true);
|
||||
this.filterRaw.error(false);
|
||||
}, this);
|
||||
|
||||
this.haveChanges.subscribe(function () {
|
||||
this.haveChanges.subscribe(function() {
|
||||
this.saveErrorText('');
|
||||
}, this);
|
||||
|
||||
this.filterRaw.active.subscribe(function () {
|
||||
this.filterRaw.active.subscribe(function() {
|
||||
this.haveChanges(true);
|
||||
this.filterRaw.error(false);
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
|
||||
FiltersUserSettings.prototype.scrollableOptions = function (sWrapper)
|
||||
{
|
||||
FiltersUserSettings.prototype.scrollableOptions = function(sWrapper)
|
||||
{
|
||||
return {
|
||||
handle: '.drag-handle',
|
||||
containment: sWrapper || 'parent',
|
||||
axis: 'y'
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
FiltersUserSettings.prototype.updateList = function ()
|
||||
{
|
||||
FiltersUserSettings.prototype.updateList = function()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
FilterModel = require('Model/Filter')
|
||||
;
|
||||
FilterModel = require('Model/Filter');
|
||||
|
||||
if (!this.filters.loading())
|
||||
{
|
||||
this.filters.loading(true);
|
||||
|
||||
Remote.filtersGet(function (sResult, oData) {
|
||||
Remote.filtersGet(function(sResult, oData) {
|
||||
|
||||
self.filters.loading(false);
|
||||
self.serverError(false);
|
||||
|
|
@ -141,7 +135,7 @@
|
|||
self.inited(true);
|
||||
self.serverError(false);
|
||||
|
||||
var aResult = _.compact(_.map(oData.Result.Filters, function (aItem) {
|
||||
var aResult = _.compact(_.map(oData.Result.Filters, function(aItem) {
|
||||
var oNew = new FilterModel();
|
||||
return (oNew && oNew.parse(aItem)) ? oNew : null;
|
||||
}));
|
||||
|
|
@ -170,44 +164,41 @@
|
|||
self.haveChanges(false);
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
FiltersUserSettings.prototype.deleteFilter = function (oFilter)
|
||||
{
|
||||
FiltersUserSettings.prototype.deleteFilter = function(oFilter)
|
||||
{
|
||||
this.filters.remove(oFilter);
|
||||
Utils.delegateRunOnDestroy(oFilter);
|
||||
};
|
||||
};
|
||||
|
||||
FiltersUserSettings.prototype.addFilter = function ()
|
||||
{
|
||||
FiltersUserSettings.prototype.addFilter = function()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
FilterModel = require('Model/Filter'),
|
||||
oNew = new FilterModel()
|
||||
;
|
||||
oNew = new FilterModel();
|
||||
|
||||
oNew.generateID();
|
||||
require('Knoin/Knoin').showScreenPopup(
|
||||
require('View/Popup/Filter'), [oNew, function () {
|
||||
require('View/Popup/Filter'), [oNew, function() {
|
||||
self.filters.push(oNew);
|
||||
self.filterRaw.active(false);
|
||||
}, false]);
|
||||
};
|
||||
};
|
||||
|
||||
FiltersUserSettings.prototype.editFilter = function (oEdit)
|
||||
{
|
||||
FiltersUserSettings.prototype.editFilter = function(oEdit)
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
oCloned = oEdit.cloneSelf()
|
||||
;
|
||||
oCloned = oEdit.cloneSelf();
|
||||
|
||||
require('Knoin/Knoin').showScreenPopup(
|
||||
require('View/Popup/Filter'), [oCloned, function () {
|
||||
require('View/Popup/Filter'), [oCloned, function() {
|
||||
|
||||
var
|
||||
aFilters = self.filters(),
|
||||
iIndex = aFilters.indexOf(oEdit)
|
||||
;
|
||||
iIndex = aFilters.indexOf(oEdit);
|
||||
|
||||
if (-1 < iIndex && aFilters[iIndex])
|
||||
{
|
||||
|
|
@ -219,28 +210,25 @@
|
|||
}
|
||||
|
||||
}, true]);
|
||||
};
|
||||
};
|
||||
|
||||
FiltersUserSettings.prototype.onBuild = function (oDom)
|
||||
{
|
||||
FiltersUserSettings.prototype.onBuild = function(oDom)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
oDom
|
||||
.on('click', '.filter-item .e-action', function () {
|
||||
.on('click', '.filter-item .e-action', function() {
|
||||
var oFilterItem = ko.dataFor(this);
|
||||
if (oFilterItem)
|
||||
{
|
||||
self.editFilter(oFilterItem);
|
||||
}
|
||||
})
|
||||
;
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
FiltersUserSettings.prototype.onShow = function ()
|
||||
{
|
||||
FiltersUserSettings.prototype.onShow = function()
|
||||
{
|
||||
this.updateList();
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = FiltersUserSettings;
|
||||
|
||||
}());
|
||||
module.exports = FiltersUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
ko = require('ko'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
|
|
@ -18,27 +14,25 @@
|
|||
FolderStore = require('Stores/User/Folder'),
|
||||
|
||||
Promises = require('Promises/User/Ajax'),
|
||||
Remote = require('Remote/User/Ajax')
|
||||
;
|
||||
Remote = require('Remote/User/Ajax');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function FoldersUserSettings()
|
||||
{
|
||||
function FoldersUserSettings()
|
||||
{
|
||||
this.displaySpecSetting = FolderStore.displaySpecSetting;
|
||||
this.folderList = FolderStore.folderList;
|
||||
|
||||
this.folderListHelp = ko.observable('').extend({'throttle': 100});
|
||||
|
||||
this.loading = ko.computed(function () {
|
||||
this.loading = ko.computed(function() {
|
||||
|
||||
var
|
||||
bLoading = FolderStore.foldersLoading(),
|
||||
bCreating = FolderStore.foldersCreating(),
|
||||
bDeleting = FolderStore.foldersDeleting(),
|
||||
bRenaming = FolderStore.foldersRenaming()
|
||||
;
|
||||
bRenaming = FolderStore.foldersRenaming();
|
||||
|
||||
return bLoading || bCreating || bDeleting || bRenaming;
|
||||
|
||||
|
|
@ -47,12 +41,12 @@
|
|||
this.folderForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
|
||||
this.folderForEdit = ko.observable(null).extend({'toggleSubscribe': [this,
|
||||
function (oPrev) {
|
||||
function(oPrev) {
|
||||
if (oPrev)
|
||||
{
|
||||
oPrev.edited(false);
|
||||
}
|
||||
}, function (oNext) {
|
||||
}, function(oNext) {
|
||||
if (oNext && oNext.canBeEdited())
|
||||
{
|
||||
oNext.edited(true);
|
||||
|
|
@ -61,13 +55,12 @@
|
|||
]});
|
||||
|
||||
this.useImapSubscribe = !!Settings.appSettingsGet('useImapSubscribe');
|
||||
}
|
||||
}
|
||||
|
||||
FoldersUserSettings.prototype.folderEditOnEnter = function (oFolder)
|
||||
{
|
||||
FoldersUserSettings.prototype.folderEditOnEnter = function(oFolder)
|
||||
{
|
||||
var
|
||||
sEditName = oFolder ? Utils.trim(oFolder.nameForEdit()) : ''
|
||||
;
|
||||
sEditName = oFolder ? Utils.trim(oFolder.nameForEdit()) : '';
|
||||
|
||||
if ('' !== sEditName && oFolder.name() !== sEditName)
|
||||
{
|
||||
|
|
@ -84,59 +77,58 @@
|
|||
}
|
||||
|
||||
oFolder.edited(false);
|
||||
};
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.folderEditOnEsc = function (oFolder)
|
||||
{
|
||||
FoldersUserSettings.prototype.folderEditOnEsc = function(oFolder)
|
||||
{
|
||||
if (oFolder)
|
||||
{
|
||||
oFolder.edited(false);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.onShow = function ()
|
||||
{
|
||||
FoldersUserSettings.prototype.onShow = function()
|
||||
{
|
||||
FolderStore.folderList.error('');
|
||||
};
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.onBuild = function (oDom)
|
||||
{
|
||||
FoldersUserSettings.prototype.onBuild = function(oDom)
|
||||
{
|
||||
var self = this;
|
||||
oDom
|
||||
.on('mouseover', '.delete-folder-parent', function () {
|
||||
.on('mouseover', '.delete-folder-parent', function() {
|
||||
self.folderListHelp(Translator.i18n('SETTINGS_FOLDERS/HELP_DELETE_FOLDER'));
|
||||
})
|
||||
.on('mouseover', '.subscribe-folder-parent', function () {
|
||||
.on('mouseover', '.subscribe-folder-parent', function() {
|
||||
self.folderListHelp(Translator.i18n('SETTINGS_FOLDERS/HELP_SHOW_HIDE_FOLDER'));
|
||||
})
|
||||
.on('mouseover', '.check-folder-parent', function () {
|
||||
.on('mouseover', '.check-folder-parent', function() {
|
||||
self.folderListHelp(Translator.i18n('SETTINGS_FOLDERS/HELP_CHECK_FOR_NEW_MESSAGES'));
|
||||
})
|
||||
.on('mouseout', '.subscribe-folder-parent, .check-folder-parent, .delete-folder-parent', function () {
|
||||
.on('mouseout', '.subscribe-folder-parent, .check-folder-parent, .delete-folder-parent', function() {
|
||||
self.folderListHelp('');
|
||||
})
|
||||
;
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.createFolder = function ()
|
||||
{
|
||||
FoldersUserSettings.prototype.createFolder = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/FolderCreate'));
|
||||
};
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.systemFolder = function ()
|
||||
{
|
||||
FoldersUserSettings.prototype.systemFolder = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/FolderSystem'));
|
||||
};
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.deleteFolder = function (oFolderToRemove)
|
||||
{
|
||||
FoldersUserSettings.prototype.deleteFolder = function(oFolderToRemove)
|
||||
{
|
||||
if (oFolderToRemove && oFolderToRemove.canBeDeleted() && oFolderToRemove.deleteAccess() &&
|
||||
0 === oFolderToRemove.privateMessageCountAll())
|
||||
{
|
||||
this.folderForDeletion(null);
|
||||
|
||||
var
|
||||
fRemoveFolder = function (oFolder) {
|
||||
fRemoveFolder = function(oFolder) {
|
||||
|
||||
if (oFolderToRemove === oFolder)
|
||||
{
|
||||
|
|
@ -145,8 +137,7 @@
|
|||
|
||||
oFolder.subFolders.remove(fRemoveFolder);
|
||||
return false;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
if (oFolderToRemove)
|
||||
{
|
||||
|
|
@ -166,38 +157,36 @@
|
|||
{
|
||||
FolderStore.folderList.error(Translator.getNotification(Enums.Notification.CantDeleteNonEmptyFolder));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.subscribeFolder = function (oFolder)
|
||||
{
|
||||
FoldersUserSettings.prototype.subscribeFolder = function(oFolder)
|
||||
{
|
||||
Local.set(Enums.ClientSideKeyName.FoldersLashHash, '');
|
||||
Remote.folderSetSubscribe(Utils.noop, oFolder.fullNameRaw, true);
|
||||
|
||||
oFolder.subScribed(true);
|
||||
};
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.unSubscribeFolder = function (oFolder)
|
||||
{
|
||||
FoldersUserSettings.prototype.unSubscribeFolder = function(oFolder)
|
||||
{
|
||||
Local.set(Enums.ClientSideKeyName.FoldersLashHash, '');
|
||||
Remote.folderSetSubscribe(Utils.noop, oFolder.fullNameRaw, false);
|
||||
|
||||
oFolder.subScribed(false);
|
||||
};
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.checkableTrueFolder = function (oFolder)
|
||||
{
|
||||
FoldersUserSettings.prototype.checkableTrueFolder = function(oFolder)
|
||||
{
|
||||
Remote.folderSetCheckable(Utils.noop, oFolder.fullNameRaw, true);
|
||||
|
||||
oFolder.checkable(true);
|
||||
};
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.checkableFalseFolder = function (oFolder)
|
||||
{
|
||||
FoldersUserSettings.prototype.checkableFalseFolder = function(oFolder)
|
||||
{
|
||||
Remote.folderSetCheckable(Utils.noop, oFolder.fullNameRaw, false);
|
||||
|
||||
oFolder.checkable(false);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = FoldersUserSettings;
|
||||
|
||||
}());
|
||||
module.exports = FoldersUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
|
|
@ -20,14 +16,13 @@
|
|||
NotificationStore = require('Stores/User/Notification'),
|
||||
MessageStore = require('Stores/User/Message'),
|
||||
|
||||
Remote = require('Remote/User/Ajax')
|
||||
;
|
||||
Remote = require('Remote/User/Ajax');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function GeneralUserSettings()
|
||||
{
|
||||
function GeneralUserSettings()
|
||||
{
|
||||
this.language = LanguageStore.language;
|
||||
this.languages = LanguageStore.languages;
|
||||
this.messagesPerPage = SettingsStore.messagesPerPage;
|
||||
|
|
@ -51,7 +46,7 @@
|
|||
this.replySameFolder = SettingsStore.replySameFolder;
|
||||
this.allowLanguagesOnSettings = AppStore.allowLanguagesOnSettings;
|
||||
|
||||
this.languageFullName = ko.computed(function () {
|
||||
this.languageFullName = ko.computed(function() {
|
||||
return Utils.convertLangName(this.language());
|
||||
}, this);
|
||||
|
||||
|
|
@ -65,19 +60,19 @@
|
|||
|
||||
this.identities = IdentityStore.identities;
|
||||
|
||||
this.identityMain = ko.computed(function () {
|
||||
this.identityMain = ko.computed(function() {
|
||||
var aList = this.identities();
|
||||
return Utils.isArray(aList) ? _.find(aList, function (oItem) {
|
||||
return oItem && '' === oItem.id() ? true : false;
|
||||
return Utils.isArray(aList) ? _.find(aList, function(oItem) {
|
||||
return oItem && '' === oItem.id();
|
||||
}) : null;
|
||||
}, this);
|
||||
|
||||
this.identityMainDesc = ko.computed(function () {
|
||||
this.identityMainDesc = ko.computed(function() {
|
||||
var oIdentity = this.identityMain();
|
||||
return oIdentity ? oIdentity.formattedName() : '---';
|
||||
}, this);
|
||||
|
||||
this.editorDefaultTypes = ko.computed(function () {
|
||||
this.editorDefaultTypes = ko.computed(function() {
|
||||
Translator.trigger();
|
||||
return [
|
||||
{'id': Enums.EditorDefaultType.Html, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML')},
|
||||
|
|
@ -87,7 +82,7 @@
|
|||
];
|
||||
}, this);
|
||||
|
||||
this.layoutTypes = ko.computed(function () {
|
||||
this.layoutTypes = ko.computed(function() {
|
||||
Translator.trigger();
|
||||
return [
|
||||
{'id': Enums.Layout.NoPreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_NO_SPLIT')},
|
||||
|
|
@ -95,43 +90,42 @@
|
|||
{'id': Enums.Layout.BottomPreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_HORIZONTAL_SPLIT')}
|
||||
];
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
|
||||
GeneralUserSettings.prototype.editMainIdentity = function ()
|
||||
{
|
||||
GeneralUserSettings.prototype.editMainIdentity = function()
|
||||
{
|
||||
var oIdentity = this.identityMain();
|
||||
if (oIdentity)
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Identity'), [oIdentity]);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
GeneralUserSettings.prototype.testSoundNotification = function ()
|
||||
{
|
||||
GeneralUserSettings.prototype.testSoundNotification = function()
|
||||
{
|
||||
NotificationStore.playSoundNotification(true);
|
||||
};
|
||||
};
|
||||
|
||||
GeneralUserSettings.prototype.onBuild = function ()
|
||||
{
|
||||
GeneralUserSettings.prototype.onBuild = function()
|
||||
{
|
||||
var self = this;
|
||||
|
||||
_.delay(function () {
|
||||
_.delay(function() {
|
||||
|
||||
var
|
||||
f0 = Utils.settingsSaveHelperSimpleFunction(self.editorDefaultTypeTrigger, self),
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.mppTrigger, self),
|
||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.layoutTrigger, self),
|
||||
fReloadLanguageHelper = function (iSaveSettingsStep) {
|
||||
fReloadLanguageHelper = function(iSaveSettingsStep) {
|
||||
return function() {
|
||||
self.languageTrigger(iSaveSettingsStep);
|
||||
_.delay(function () {
|
||||
_.delay(function() {
|
||||
self.languageTrigger(Enums.SaveSettingsStep.Idle);
|
||||
}, 1000);
|
||||
};
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
self.language.subscribe(function (sValue) {
|
||||
self.language.subscribe(function(sValue) {
|
||||
|
||||
self.languageTrigger(Enums.SaveSettingsStep.Animate);
|
||||
|
||||
|
|
@ -146,49 +140,49 @@
|
|||
|
||||
});
|
||||
|
||||
self.editorDefaultType.subscribe(function (sValue) {
|
||||
self.editorDefaultType.subscribe(function(sValue) {
|
||||
Remote.saveSettings(f0, {
|
||||
'EditorDefaultType': sValue
|
||||
});
|
||||
});
|
||||
|
||||
self.messagesPerPage.subscribe(function (iValue) {
|
||||
self.messagesPerPage.subscribe(function(iValue) {
|
||||
Remote.saveSettings(f1, {
|
||||
'MPP': iValue
|
||||
});
|
||||
});
|
||||
|
||||
self.showImages.subscribe(function (bValue) {
|
||||
self.showImages.subscribe(function(bValue) {
|
||||
Remote.saveSettings(null, {
|
||||
'ShowImages': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.enableDesktopNotification.subscribe(function (bValue) {
|
||||
Utils.timeOutAction('SaveDesktopNotifications', function () {
|
||||
self.enableDesktopNotification.subscribe(function(bValue) {
|
||||
Utils.timeOutAction('SaveDesktopNotifications', function() {
|
||||
Remote.saveSettings(null, {
|
||||
'DesktopNotifications': bValue ? '1' : '0'
|
||||
});
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
self.enableSoundNotification.subscribe(function (bValue) {
|
||||
Utils.timeOutAction('SaveSoundNotification', function () {
|
||||
self.enableSoundNotification.subscribe(function(bValue) {
|
||||
Utils.timeOutAction('SaveSoundNotification', function() {
|
||||
Remote.saveSettings(null, {
|
||||
'SoundNotification': bValue ? '1' : '0'
|
||||
});
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
self.replySameFolder.subscribe(function (bValue) {
|
||||
Utils.timeOutAction('SaveReplySameFolder', function () {
|
||||
self.replySameFolder.subscribe(function(bValue) {
|
||||
Utils.timeOutAction('SaveReplySameFolder', function() {
|
||||
Remote.saveSettings(null, {
|
||||
'ReplySameFolder': bValue ? '1' : '0'
|
||||
});
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
self.useThreads.subscribe(function (bValue) {
|
||||
self.useThreads.subscribe(function(bValue) {
|
||||
|
||||
MessageStore.messageList([]);
|
||||
|
||||
|
|
@ -197,7 +191,7 @@
|
|||
});
|
||||
});
|
||||
|
||||
self.layout.subscribe(function (nValue) {
|
||||
self.layout.subscribe(function(nValue) {
|
||||
|
||||
MessageStore.messageList([]);
|
||||
|
||||
|
|
@ -206,27 +200,25 @@
|
|||
});
|
||||
});
|
||||
|
||||
self.useCheckboxesInList.subscribe(function (bValue) {
|
||||
self.useCheckboxesInList.subscribe(function(bValue) {
|
||||
Remote.saveSettings(null, {
|
||||
'UseCheckboxesInList': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
}, 50);
|
||||
};
|
||||
};
|
||||
|
||||
GeneralUserSettings.prototype.onShow = function ()
|
||||
{
|
||||
GeneralUserSettings.prototype.onShow = function()
|
||||
{
|
||||
this.enableDesktopNotification.valueHasMutated();
|
||||
};
|
||||
};
|
||||
|
||||
GeneralUserSettings.prototype.selectLanguage = function ()
|
||||
{
|
||||
GeneralUserSettings.prototype.selectLanguage = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Languages'), [
|
||||
this.language, this.languages(), LanguageStore.userLanguage()
|
||||
]);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = GeneralUserSettings;
|
||||
|
||||
}());
|
||||
module.exports = GeneralUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
window = require('window'),
|
||||
|
|
@ -12,14 +8,13 @@
|
|||
|
||||
kn = require('Knoin/Knoin'),
|
||||
|
||||
PgpStore = require('Stores/User/Pgp')
|
||||
;
|
||||
PgpStore = require('Stores/User/Pgp');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function OpenPgpUserSettings()
|
||||
{
|
||||
function OpenPgpUserSettings()
|
||||
{
|
||||
this.openpgpkeys = PgpStore.openpgpkeys;
|
||||
this.openpgpkeysPublic = PgpStore.openpgpkeysPublic;
|
||||
this.openpgpkeysPrivate = PgpStore.openpgpkeysPrivate;
|
||||
|
|
@ -27,38 +22,38 @@
|
|||
this.openPgpKeyForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
|
||||
this.isHttps = window.document && window.document.location ? 'https:' === window.document.location.protocol : false;
|
||||
}
|
||||
}
|
||||
|
||||
OpenPgpUserSettings.prototype.addOpenPgpKey = function ()
|
||||
{
|
||||
OpenPgpUserSettings.prototype.addOpenPgpKey = function()
|
||||
{
|
||||
kn.showScreenPopup(require('View/Popup/AddOpenPgpKey'));
|
||||
};
|
||||
};
|
||||
|
||||
OpenPgpUserSettings.prototype.generateOpenPgpKey = function ()
|
||||
{
|
||||
OpenPgpUserSettings.prototype.generateOpenPgpKey = function()
|
||||
{
|
||||
kn.showScreenPopup(require('View/Popup/NewOpenPgpKey'));
|
||||
};
|
||||
};
|
||||
|
||||
OpenPgpUserSettings.prototype.viewOpenPgpKey = function (oOpenPgpKey)
|
||||
{
|
||||
OpenPgpUserSettings.prototype.viewOpenPgpKey = function(oOpenPgpKey)
|
||||
{
|
||||
if (oOpenPgpKey)
|
||||
{
|
||||
kn.showScreenPopup(require('View/Popup/ViewOpenPgpKey'), [oOpenPgpKey]);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {OpenPgpKeyModel} oOpenPgpKeyToRemove
|
||||
*/
|
||||
OpenPgpUserSettings.prototype.deleteOpenPgpKey = function (oOpenPgpKeyToRemove)
|
||||
{
|
||||
OpenPgpUserSettings.prototype.deleteOpenPgpKey = function(oOpenPgpKeyToRemove)
|
||||
{
|
||||
if (oOpenPgpKeyToRemove && oOpenPgpKeyToRemove.deleteAccess())
|
||||
{
|
||||
this.openPgpKeyForDeletion(null);
|
||||
|
||||
if (oOpenPgpKeyToRemove && PgpStore.openpgpKeyring)
|
||||
{
|
||||
var oFindedItem = _.find(PgpStore.openpgpkeys(), function (oOpenPgpKey) {
|
||||
var oFindedItem = _.find(PgpStore.openpgpkeys(), function(oOpenPgpKey) {
|
||||
return oOpenPgpKeyToRemove === oOpenPgpKey;
|
||||
});
|
||||
|
||||
|
|
@ -76,8 +71,6 @@
|
|||
require('App/User').default.reloadOpenPgpKeys();
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = OpenPgpUserSettings;
|
||||
|
||||
}());
|
||||
module.exports = OpenPgpUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
|
|
@ -15,21 +11,20 @@
|
|||
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
Remote = require('Remote/User/Ajax')
|
||||
;
|
||||
Remote = require('Remote/User/Ajax');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function SecurityUserSettings()
|
||||
{
|
||||
function SecurityUserSettings()
|
||||
{
|
||||
this.capaAutoLogout = Settings.capa(Enums.Capa.AutoLogout);
|
||||
this.capaTwoFactor = Settings.capa(Enums.Capa.TwoFactor);
|
||||
|
||||
this.autoLogout = SettinsStore.autoLogout;
|
||||
this.autoLogout.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.autoLogoutOptions = ko.computed(function () {
|
||||
this.autoLogoutOptions = ko.computed(function() {
|
||||
Translator.trigger();
|
||||
return [
|
||||
{'id': 0, 'name': Translator.i18n('SETTINGS_SECURITY/AUTOLOGIN_NEVER_OPTION_NAME')},
|
||||
|
|
@ -42,26 +37,25 @@
|
|||
{'id': 60 * 10, 'name': Translator.i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', {'HOURS': 10})}
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
SecurityUserSettings.prototype.configureTwoFactor = function ()
|
||||
{
|
||||
SecurityUserSettings.prototype.configureTwoFactor = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/TwoFactorConfiguration'));
|
||||
};
|
||||
};
|
||||
|
||||
SecurityUserSettings.prototype.onBuild = function ()
|
||||
{
|
||||
SecurityUserSettings.prototype.onBuild = function()
|
||||
{
|
||||
if (this.capaAutoLogout)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
_.delay(function () {
|
||||
_.delay(function() {
|
||||
|
||||
var
|
||||
f0 = Utils.settingsSaveHelperSimpleFunction(self.autoLogout.trigger, self)
|
||||
;
|
||||
f0 = Utils.settingsSaveHelperSimpleFunction(self.autoLogout.trigger, self);
|
||||
|
||||
self.autoLogout.subscribe(function (sValue) {
|
||||
self.autoLogout.subscribe(function(sValue) {
|
||||
Remote.saveSettings(f0, {
|
||||
'AutoLogout': Utils.pInt(sValue)
|
||||
});
|
||||
|
|
@ -69,8 +63,6 @@
|
|||
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = SecurityUserSettings;
|
||||
|
||||
}());
|
||||
module.exports = SecurityUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,17 +1,12 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function SocialUserSettings()
|
||||
{
|
||||
function SocialUserSettings()
|
||||
{
|
||||
var
|
||||
Utils = require('Common/Utils'),
|
||||
SocialStore = require('Stores/Social')
|
||||
;
|
||||
SocialStore = require('Stores/Social');
|
||||
|
||||
this.googleEnable = SocialStore.google.enabled;
|
||||
this.googleEnableAuth = SocialStore.google.capa.auth;
|
||||
|
|
@ -35,46 +30,44 @@
|
|||
this.twitterLoggined = SocialStore.twitter.loggined;
|
||||
this.twitterUserName = SocialStore.twitter.userName;
|
||||
|
||||
this.connectGoogle = Utils.createCommand(this, function () {
|
||||
this.connectGoogle = Utils.createCommand(this, function() {
|
||||
if (!this.googleLoggined())
|
||||
{
|
||||
require('App/User').default.googleConnect();
|
||||
}
|
||||
}, function () {
|
||||
}, function() {
|
||||
return !this.googleLoggined() && !this.googleActions();
|
||||
});
|
||||
|
||||
this.disconnectGoogle = Utils.createCommand(this, function () {
|
||||
this.disconnectGoogle = Utils.createCommand(this, function() {
|
||||
require('App/User').default.googleDisconnect();
|
||||
});
|
||||
|
||||
this.connectFacebook = Utils.createCommand(this, function () {
|
||||
this.connectFacebook = Utils.createCommand(this, function() {
|
||||
if (!this.facebookLoggined())
|
||||
{
|
||||
require('App/User').default.facebookConnect();
|
||||
}
|
||||
}, function () {
|
||||
}, function() {
|
||||
return !this.facebookLoggined() && !this.facebookActions();
|
||||
});
|
||||
|
||||
this.disconnectFacebook = Utils.createCommand(this, function () {
|
||||
this.disconnectFacebook = Utils.createCommand(this, function() {
|
||||
require('App/User').default.facebookDisconnect();
|
||||
});
|
||||
|
||||
this.connectTwitter = Utils.createCommand(this, function () {
|
||||
this.connectTwitter = Utils.createCommand(this, function() {
|
||||
if (!this.twitterLoggined())
|
||||
{
|
||||
require('App/User').default.twitterConnect();
|
||||
}
|
||||
}, function () {
|
||||
}, function() {
|
||||
return !this.twitterLoggined() && !this.twitterActions();
|
||||
});
|
||||
|
||||
this.disconnectTwitter = Utils.createCommand(this, function () {
|
||||
this.disconnectTwitter = Utils.createCommand(this, function() {
|
||||
require('App/User').default.twitterDisconnect();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SocialUserSettings;
|
||||
|
||||
}());
|
||||
module.exports = SocialUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,107 +1,98 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
ko = require('ko'),
|
||||
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
TemplateStore = require('Stores/User/Template'),
|
||||
|
||||
Remote = require('Remote/User/Ajax')
|
||||
;
|
||||
Remote = require('Remote/User/Ajax');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function TemplatesUserSettings()
|
||||
{
|
||||
function TemplatesUserSettings()
|
||||
{
|
||||
this.templates = TemplateStore.templates;
|
||||
|
||||
this.processText = ko.computed(function () {
|
||||
this.processText = ko.computed(function() {
|
||||
return TemplateStore.templates.loading() ? Translator.i18n('SETTINGS_TEMPLETS/LOADING_PROCESS') : '';
|
||||
}, this);
|
||||
|
||||
this.visibility = ko.computed(function () {
|
||||
this.visibility = ko.computed(function() {
|
||||
return '' === this.processText() ? 'hidden' : 'visible';
|
||||
}, this);
|
||||
|
||||
this.templateForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
}
|
||||
}
|
||||
|
||||
TemplatesUserSettings.prototype.scrollableOptions = function (sWrapper)
|
||||
{
|
||||
TemplatesUserSettings.prototype.scrollableOptions = function(sWrapper)
|
||||
{
|
||||
return {
|
||||
handle: '.drag-handle',
|
||||
containment: sWrapper || 'parent',
|
||||
axis: 'y'
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
TemplatesUserSettings.prototype.addNewTemplate = function ()
|
||||
{
|
||||
TemplatesUserSettings.prototype.addNewTemplate = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Template'));
|
||||
};
|
||||
};
|
||||
|
||||
TemplatesUserSettings.prototype.editTemplate = function (oTemplateItem)
|
||||
{
|
||||
TemplatesUserSettings.prototype.editTemplate = function(oTemplateItem)
|
||||
{
|
||||
if (oTemplateItem)
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Template'), [oTemplateItem]);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {AccountModel} oTemplateToRemove
|
||||
*/
|
||||
TemplatesUserSettings.prototype.deleteTemplate = function (oTemplateToRemove)
|
||||
{
|
||||
TemplatesUserSettings.prototype.deleteTemplate = function(oTemplateToRemove)
|
||||
{
|
||||
if (oTemplateToRemove && oTemplateToRemove.deleteAccess())
|
||||
{
|
||||
this.templateForDeletion(null);
|
||||
|
||||
var
|
||||
self = this,
|
||||
fRemoveAccount = function (oAccount) {
|
||||
fRemoveAccount = function(oAccount) {
|
||||
return oTemplateToRemove === oAccount;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
if (oTemplateToRemove)
|
||||
{
|
||||
this.templates.remove(fRemoveAccount);
|
||||
|
||||
Remote.templateDelete(function () {
|
||||
Remote.templateDelete(function() {
|
||||
self.reloadTemplates();
|
||||
}, oTemplateToRemove.id);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
TemplatesUserSettings.prototype.reloadTemplates = function ()
|
||||
{
|
||||
TemplatesUserSettings.prototype.reloadTemplates = function()
|
||||
{
|
||||
require('App/User').default.templates();
|
||||
};
|
||||
};
|
||||
|
||||
TemplatesUserSettings.prototype.onBuild = function (oDom)
|
||||
{
|
||||
TemplatesUserSettings.prototype.onBuild = function(oDom)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
oDom
|
||||
.on('click', '.templates-list .template-item .e-action', function () {
|
||||
.on('click', '.templates-list .template-item .e-action', function() {
|
||||
var oTemplateItem = ko.dataFor(this);
|
||||
if (oTemplateItem)
|
||||
{
|
||||
self.editTemplate(oTemplateItem);
|
||||
}
|
||||
})
|
||||
;
|
||||
});
|
||||
|
||||
this.reloadTemplates();
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = TemplatesUserSettings;
|
||||
|
||||
}());
|
||||
module.exports = TemplatesUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
$ = require('$'),
|
||||
ko = require('ko'),
|
||||
|
|
@ -19,14 +15,13 @@
|
|||
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
Remote = require('Remote/User/Ajax')
|
||||
;
|
||||
Remote = require('Remote/User/Ajax');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function ThemesUserSettings()
|
||||
{
|
||||
function ThemesUserSettings()
|
||||
{
|
||||
this.theme = ThemeStore.theme;
|
||||
this.themes = ThemeStore.themes;
|
||||
this.themesObjects = ko.observableArray([]);
|
||||
|
|
@ -45,9 +40,9 @@
|
|||
this.iTimer = 0;
|
||||
this.oThemeAjaxRequest = null;
|
||||
|
||||
this.theme.subscribe(function (sValue) {
|
||||
this.theme.subscribe(function(sValue) {
|
||||
|
||||
_.each(this.themesObjects(), function (oTheme) {
|
||||
_.each(this.themesObjects(), function(oTheme) {
|
||||
oTheme.selected(sValue === oTheme.name);
|
||||
});
|
||||
|
||||
|
|
@ -59,7 +54,7 @@
|
|||
|
||||
}, this);
|
||||
|
||||
this.background.hash.subscribe(function (sValue) {
|
||||
this.background.hash.subscribe(function(sValue) {
|
||||
|
||||
var $oBg = $('#rl-bg');
|
||||
if (!sValue)
|
||||
|
|
@ -78,12 +73,12 @@
|
|||
}
|
||||
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
|
||||
ThemesUserSettings.prototype.onBuild = function ()
|
||||
{
|
||||
ThemesUserSettings.prototype.onBuild = function()
|
||||
{
|
||||
var sCurrentTheme = this.theme();
|
||||
this.themesObjects(_.map(this.themes(), function (sTheme) {
|
||||
this.themesObjects(_.map(this.themes(), function(sTheme) {
|
||||
return {
|
||||
'name': sTheme,
|
||||
'nameDisplay': Utils.convertThemeName(sTheme),
|
||||
|
|
@ -93,27 +88,27 @@
|
|||
}));
|
||||
|
||||
this.initUploader();
|
||||
};
|
||||
};
|
||||
|
||||
ThemesUserSettings.prototype.onShow = function ()
|
||||
{
|
||||
ThemesUserSettings.prototype.onShow = function()
|
||||
{
|
||||
this.background.error('');
|
||||
};
|
||||
};
|
||||
|
||||
ThemesUserSettings.prototype.clearBackground = function ()
|
||||
{
|
||||
ThemesUserSettings.prototype.clearBackground = function()
|
||||
{
|
||||
if (this.capaUserBackground())
|
||||
{
|
||||
var self = this;
|
||||
Remote.clearUserBackground(function () {
|
||||
Remote.clearUserBackground(function() {
|
||||
self.background.name('');
|
||||
self.background.hash('');
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
ThemesUserSettings.prototype.initUploader = function ()
|
||||
{
|
||||
ThemesUserSettings.prototype.initUploader = function()
|
||||
{
|
||||
if (this.background.uploaderButton() && this.capaUserBackground())
|
||||
{
|
||||
var
|
||||
|
|
@ -125,11 +120,10 @@
|
|||
'disableDragAndDrop': true,
|
||||
'disableMultiple': true,
|
||||
'clickElement': this.background.uploaderButton()
|
||||
})
|
||||
;
|
||||
});
|
||||
|
||||
oJua
|
||||
.on('onStart', _.bind(function () {
|
||||
.on('onStart', _.bind(function() {
|
||||
|
||||
this.background.loading(true);
|
||||
this.background.error('');
|
||||
|
|
@ -137,7 +131,7 @@
|
|||
return true;
|
||||
|
||||
}, this))
|
||||
.on('onComplete', _.bind(function (sId, bResult, oData) {
|
||||
.on('onComplete', _.bind(function(sId, bResult, oData) {
|
||||
|
||||
this.background.loading(false);
|
||||
|
||||
|
|
@ -162,6 +156,7 @@
|
|||
case Enums.UploadErrorCode.FileType:
|
||||
sError = Translator.i18n('SETTINGS_THEMES/ERROR_FILE_TYPE_ERROR');
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -175,11 +170,8 @@
|
|||
|
||||
return true;
|
||||
|
||||
}, this))
|
||||
;
|
||||
}, this));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = ThemesUserSettings;
|
||||
|
||||
}());
|
||||
module.exports = ThemesUserSettings;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ const driver = SupportedStorageDriver ? new SupportedStorageDriver() : null;
|
|||
/**
|
||||
* @param {number} key
|
||||
* @param {*} data
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function set(key, data)
|
||||
{
|
||||
|
|
@ -21,7 +21,7 @@ export function set(key, data)
|
|||
|
||||
/**
|
||||
* @param {number} key
|
||||
* @return {*}
|
||||
* @returns {*}
|
||||
*/
|
||||
export function get(key)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,35 +45,43 @@ const timestamp = () => window.Math.round((new window.Date()).getTime() / 1000);
|
|||
const setTimestamp = () => __set(TIME_KEY, timestamp());
|
||||
|
||||
const getTimestamp = () => {
|
||||
let time = __get(TIME_KEY, 0);
|
||||
const time = __get(TIME_KEY, 0);
|
||||
return time ? (window.parseInt(time, 10) || 0) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getHash()
|
||||
{
|
||||
return __get(STORAGE_KEY);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
export function setHash()
|
||||
{
|
||||
const
|
||||
key = 'AuthAccountHash',
|
||||
appData = window.__rlah_data()
|
||||
;
|
||||
appData = window.__rlah_data();
|
||||
|
||||
__set(STORAGE_KEY, appData && appData[key] ? appData[key] : '');
|
||||
setTimestamp();
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
export function clearHash()
|
||||
{
|
||||
__set(STORAGE_KEY, '');
|
||||
setTimestamp();
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function checkTimestamp()
|
||||
{
|
||||
if (timestamp() > getTimestamp() + 1000 * 60 * 60) // 60m
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ APP_SETTINGS = isNormal(APP_SETTINGS) ? APP_SETTINGS : {};
|
|||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @return {*}
|
||||
* @returns {*}
|
||||
*/
|
||||
export function settingsGet(name)
|
||||
{
|
||||
|
|
@ -28,7 +28,7 @@ export function settingsSet(name, value)
|
|||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @return {*}
|
||||
* @returns {*}
|
||||
*/
|
||||
export function appSettingsGet(name)
|
||||
{
|
||||
|
|
@ -37,7 +37,7 @@ export function appSettingsGet(name)
|
|||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function capa(name)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class AbstractAppStore
|
|||
|
||||
this.interfaceAnimation = ko.observable(true);
|
||||
|
||||
this.interfaceAnimation.subscribe(function (bValue) {
|
||||
this.interfaceAnimation.subscribe(function(bValue) {
|
||||
const bAnim = bMobileDevice || !bValue;
|
||||
$html.toggleClass('rl-anim', !bAnim).toggleClass('no-rl-anim', bAnim);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,21 +1,16 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
ko = require('ko'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
|
||||
Settings = require('Storage/Settings')
|
||||
;
|
||||
Settings = require('Storage/Settings');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function CapaAdminStore()
|
||||
{
|
||||
function CapaAdminStore()
|
||||
{
|
||||
this.additionalAccounts = ko.observable(false);
|
||||
this.identities = ko.observable(false);
|
||||
this.gravatar = ko.observable(false);
|
||||
|
|
@ -28,10 +23,10 @@
|
|||
this.twoFactorAuth = ko.observable(false);
|
||||
this.twoFactorAuthForce = ko.observable(false);
|
||||
this.templates = ko.observable(false);
|
||||
}
|
||||
}
|
||||
|
||||
CapaAdminStore.prototype.populate = function()
|
||||
{
|
||||
CapaAdminStore.prototype.populate = function()
|
||||
{
|
||||
this.additionalAccounts(Settings.capa(Enums.Capa.AdditionalAccounts));
|
||||
this.identities(Settings.capa(Enums.Capa.Identities));
|
||||
this.gravatar(Settings.capa(Enums.Capa.Gravatar));
|
||||
|
|
@ -44,8 +39,6 @@
|
|||
this.twoFactorAuth(Settings.capa(Enums.Capa.TwoFactor));
|
||||
this.twoFactorAuthForce(Settings.capa(Enums.Capa.TwoFactorForce));
|
||||
this.templates(Settings.capa(Enums.Capa.Templates));
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = new CapaAdminStore();
|
||||
|
||||
}());
|
||||
module.exports = new CapaAdminStore();
|
||||
|
|
|
|||
|
|
@ -1,17 +1,11 @@
|
|||
|
||||
(function () {
|
||||
var ko = require('ko');
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('ko')
|
||||
;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function CoreAdminStore()
|
||||
{
|
||||
function CoreAdminStore()
|
||||
{
|
||||
this.coreReal = ko.observable(true);
|
||||
this.coreChannel = ko.observable('stable');
|
||||
this.coreType = ko.observable('stable');
|
||||
|
|
@ -24,8 +18,6 @@
|
|||
this.coreRemoteVersion = ko.observable('');
|
||||
this.coreRemoteRelease = ko.observable('');
|
||||
this.coreVersionCompare = ko.observable(-2);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new CoreAdminStore();
|
||||
|
||||
}());
|
||||
module.exports = new CoreAdminStore();
|
||||
|
|
|
|||
|
|
@ -1,25 +1,17 @@
|
|||
|
||||
(function () {
|
||||
var ko = require('ko');
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('ko')
|
||||
;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function DomainAdminStore()
|
||||
{
|
||||
function DomainAdminStore()
|
||||
{
|
||||
this.domains = ko.observableArray([]);
|
||||
this.domains.loading = ko.observable(false).extend({'throttle': 100});
|
||||
|
||||
this.domainsWithoutAliases = this.domains.filter(function (oItem) {
|
||||
this.domainsWithoutAliases = this.domains.filter(function(oItem) {
|
||||
return oItem && !oItem.alias;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new DomainAdminStore();
|
||||
|
||||
}());
|
||||
module.exports = new DomainAdminStore();
|
||||
|
|
|
|||
|
|
@ -1,17 +1,11 @@
|
|||
|
||||
(function () {
|
||||
var ko = require('ko');
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('ko')
|
||||
;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function LicenseAdminStore()
|
||||
{
|
||||
function LicenseAdminStore()
|
||||
{
|
||||
this.licensing = ko.observable(false);
|
||||
this.licensingProcess = ko.observable(false);
|
||||
this.licenseValid = ko.observable(false);
|
||||
|
|
@ -19,8 +13,6 @@
|
|||
this.licenseError = ko.observable('');
|
||||
|
||||
this.licenseTrigger = ko.observable(false);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new LicenseAdminStore();
|
||||
|
||||
}());
|
||||
module.exports = new LicenseAdminStore();
|
||||
|
|
|
|||
|
|
@ -1,24 +1,16 @@
|
|||
|
||||
(function () {
|
||||
var ko = require('ko');
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('ko')
|
||||
;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function PackageAdminStore()
|
||||
{
|
||||
function PackageAdminStore()
|
||||
{
|
||||
this.packages = ko.observableArray([]);
|
||||
this.packages.loading = ko.observable(false).extend({'throttle': 100});
|
||||
|
||||
this.packagesReal = ko.observable(true);
|
||||
this.packagesMainUpdatable = ko.observable(true);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new PackageAdminStore();
|
||||
|
||||
}());
|
||||
module.exports = new PackageAdminStore();
|
||||
|
|
|
|||
|
|
@ -1,22 +1,14 @@
|
|||
|
||||
(function () {
|
||||
var ko = require('ko');
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('ko')
|
||||
;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function PluginAdminStore()
|
||||
{
|
||||
function PluginAdminStore()
|
||||
{
|
||||
this.plugins = ko.observableArray([]);
|
||||
this.plugins.loading = ko.observable(false).extend({'throttle': 100});
|
||||
this.plugins.error = ko.observable('');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new PluginAdminStore();
|
||||
|
||||
}());
|
||||
module.exports = new PluginAdminStore();
|
||||
|
|
|
|||
|
|
@ -1,44 +1,36 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
ko = require('ko'),
|
||||
|
||||
Utils = require('Common/Utils'),
|
||||
|
||||
Settings = require('Storage/Settings')
|
||||
;
|
||||
Settings = require('Storage/Settings');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function LanguageStore()
|
||||
{
|
||||
function LanguageStore()
|
||||
{
|
||||
this.languages = ko.observableArray([]);
|
||||
this.languagesAdmin = ko.observableArray([]);
|
||||
|
||||
this.language = ko.observable('')
|
||||
.extend({'limitedList': this.languages})
|
||||
.extend({'reversible': true})
|
||||
;
|
||||
.extend({'reversible': true});
|
||||
|
||||
this.languageAdmin = ko.observable('')
|
||||
.extend({'limitedList': this.languagesAdmin})
|
||||
.extend({'reversible': true})
|
||||
;
|
||||
.extend({'reversible': true});
|
||||
|
||||
this.userLanguage = ko.observable('');
|
||||
this.userLanguageAdmin = ko.observable('');
|
||||
}
|
||||
}
|
||||
|
||||
LanguageStore.prototype.populate = function ()
|
||||
{
|
||||
LanguageStore.prototype.populate = function()
|
||||
{
|
||||
var
|
||||
aLanguages = Settings.appSettingsGet('languages'),
|
||||
aLanguagesAdmin = Settings.appSettingsGet('languagesAdmin')
|
||||
;
|
||||
aLanguagesAdmin = Settings.appSettingsGet('languagesAdmin');
|
||||
|
||||
this.languages(Utils.isArray(aLanguages) ? aLanguages : []);
|
||||
this.languagesAdmin(Utils.isArray(aLanguagesAdmin) ? aLanguagesAdmin : []);
|
||||
|
|
@ -48,8 +40,6 @@
|
|||
|
||||
this.userLanguage(Settings.settingsGet('UserLanguage'));
|
||||
this.userLanguageAdmin(Settings.settingsGet('UserLanguageAdmin'));
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = new LanguageStore();
|
||||
|
||||
}());
|
||||
module.exports = new LanguageStore();
|
||||
|
|
|
|||
|
|
@ -1,17 +1,11 @@
|
|||
|
||||
(function () {
|
||||
var ko = require('ko');
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('ko')
|
||||
;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function SocialStore()
|
||||
{
|
||||
function SocialStore()
|
||||
{
|
||||
this.google = {};
|
||||
this.twitter = {};
|
||||
this.facebook = {};
|
||||
|
|
@ -27,7 +21,7 @@
|
|||
this.google.loading = ko.observable(false);
|
||||
this.google.userName = ko.observable('');
|
||||
|
||||
this.google.loggined = ko.computed(function () {
|
||||
this.google.loggined = ko.computed(function() {
|
||||
return '' !== this.google.userName();
|
||||
}, this);
|
||||
|
||||
|
|
@ -38,11 +32,11 @@
|
|||
this.google.capa.preview = ko.observable(false);
|
||||
|
||||
this.google.require = {};
|
||||
this.google.require.clientSettings = ko.computed(function () {
|
||||
this.google.require.clientSettings = ko.computed(function() {
|
||||
return this.google.enabled() && (this.google.capa.auth() || this.google.capa.drive());
|
||||
}, this);
|
||||
|
||||
this.google.require.apiKeySettings = ko.computed(function () {
|
||||
this.google.require.apiKeySettings = ko.computed(function() {
|
||||
return this.google.enabled() && this.google.capa.drive();
|
||||
}, this);
|
||||
|
||||
|
|
@ -54,7 +48,7 @@
|
|||
this.facebook.userName = ko.observable('');
|
||||
this.facebook.supported = ko.observable(false);
|
||||
|
||||
this.facebook.loggined = ko.computed(function () {
|
||||
this.facebook.loggined = ko.computed(function() {
|
||||
return '' !== this.facebook.userName();
|
||||
}, this);
|
||||
|
||||
|
|
@ -65,22 +59,22 @@
|
|||
this.twitter.loading = ko.observable(false);
|
||||
this.twitter.userName = ko.observable('');
|
||||
|
||||
this.twitter.loggined = ko.computed(function () {
|
||||
this.twitter.loggined = ko.computed(function() {
|
||||
return '' !== this.twitter.userName();
|
||||
}, this);
|
||||
|
||||
// Dropbox
|
||||
this.dropbox.enabled = ko.observable(false);
|
||||
this.dropbox.apiKey = ko.observable('');
|
||||
}
|
||||
}
|
||||
|
||||
SocialStore.prototype.google = {};
|
||||
SocialStore.prototype.twitter = {};
|
||||
SocialStore.prototype.facebook = {};
|
||||
SocialStore.prototype.dropbox = {};
|
||||
SocialStore.prototype.google = {};
|
||||
SocialStore.prototype.twitter = {};
|
||||
SocialStore.prototype.facebook = {};
|
||||
SocialStore.prototype.dropbox = {};
|
||||
|
||||
SocialStore.prototype.populate = function ()
|
||||
{
|
||||
SocialStore.prototype.populate = function()
|
||||
{
|
||||
var Settings = require('Storage/Settings');
|
||||
|
||||
this.google.enabled(!!Settings.settingsGet('AllowGoogleSocial'));
|
||||
|
|
@ -104,8 +98,6 @@
|
|||
|
||||
this.dropbox.enabled(!!Settings.settingsGet('AllowDropboxSocial'));
|
||||
this.dropbox.apiKey(Settings.settingsGet('DropboxApiKey'));
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = new SocialStore();
|
||||
|
||||
}());
|
||||
module.exports = new SocialStore();
|
||||
|
|
|
|||
|
|
@ -1,39 +1,32 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
ko = require('ko'),
|
||||
|
||||
Utils = require('Common/Utils'),
|
||||
|
||||
Settings = require('Storage/Settings')
|
||||
;
|
||||
Settings = require('Storage/Settings');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function ThemeStore()
|
||||
{
|
||||
function ThemeStore()
|
||||
{
|
||||
this.themes = ko.observableArray([]);
|
||||
this.themeBackgroundName = ko.observable('');
|
||||
this.themeBackgroundHash = ko.observable('');
|
||||
|
||||
this.theme = ko.observable('')
|
||||
.extend({'limitedList': this.themes});
|
||||
}
|
||||
}
|
||||
|
||||
ThemeStore.prototype.populate = function ()
|
||||
{
|
||||
ThemeStore.prototype.populate = function()
|
||||
{
|
||||
var aThemes = Settings.appSettingsGet('themes');
|
||||
|
||||
this.themes(Utils.isArray(aThemes) ? aThemes : []);
|
||||
this.theme(Settings.settingsGet('Theme'));
|
||||
this.themeBackgroundName(Settings.settingsGet('UserBackgroundName'));
|
||||
this.themeBackgroundHash(Settings.settingsGet('UserBackgroundHash'));
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = new ThemeStore();
|
||||
|
||||
}());
|
||||
module.exports = new ThemeStore();
|
||||
|
|
|
|||
|
|
@ -1,20 +1,15 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
Settings = require('Storage/Settings')
|
||||
;
|
||||
Settings = require('Storage/Settings');
|
||||
|
||||
/**
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AccountUserStore()
|
||||
{
|
||||
function AccountUserStore()
|
||||
{
|
||||
this.email = ko.observable('');
|
||||
this.parentEmail = ko.observable('');
|
||||
// this.incLogin = ko.observable('');
|
||||
|
|
@ -26,21 +21,21 @@
|
|||
this.accounts.loading = ko.observable(false).extend({'throttle': 100});
|
||||
|
||||
this.computers();
|
||||
}
|
||||
}
|
||||
|
||||
AccountUserStore.prototype.computers = function ()
|
||||
{
|
||||
this.accountsEmails = ko.computed(function () {
|
||||
return _.compact(_.map(this.accounts(), function (oItem) {
|
||||
AccountUserStore.prototype.computers = function()
|
||||
{
|
||||
this.accountsEmails = ko.computed(function() {
|
||||
return _.compact(_.map(this.accounts(), function(oItem) {
|
||||
return oItem ? oItem.email : null;
|
||||
}));
|
||||
}, this);
|
||||
|
||||
this.accountsUnreadCount = ko.computed(function () {
|
||||
this.accountsUnreadCount = ko.computed(function() {
|
||||
|
||||
var iResult = 0;
|
||||
|
||||
// _.each(this.accounts(), function (oItem) {
|
||||
// _.each(this.accounts(), function(oItem) {
|
||||
// if (oItem)
|
||||
// {
|
||||
// iResult += oItem.count();
|
||||
|
|
@ -50,22 +45,20 @@
|
|||
return iResult;
|
||||
|
||||
}, this);
|
||||
};
|
||||
};
|
||||
|
||||
AccountUserStore.prototype.populate = function ()
|
||||
{
|
||||
AccountUserStore.prototype.populate = function()
|
||||
{
|
||||
this.email(Settings.settingsGet('Email'));
|
||||
this.parentEmail(Settings.settingsGet('ParentEmail'));
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
AccountUserStore.prototype.isRootAccount = function ()
|
||||
{
|
||||
AccountUserStore.prototype.isRootAccount = function()
|
||||
{
|
||||
return '' === this.parentEmail();
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = new AccountUserStore();
|
||||
|
||||
}());
|
||||
module.exports = new AccountUserStore();
|
||||
|
|
|
|||
|
|
@ -17,12 +17,10 @@ class AppUserStore extends AbstractAppStore
|
|||
|
||||
this.focusedState = ko.observable(Focused.None);
|
||||
|
||||
this.focusedState.subscribe(function (value) {
|
||||
this.focusedState.subscribe(function(value) {
|
||||
|
||||
switch (value)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
case Focused.MessageList:
|
||||
keyScope(KeyState.MessageList);
|
||||
break;
|
||||
|
|
@ -32,6 +30,8 @@ class AppUserStore extends AbstractAppStore
|
|||
case Focused.FolderList:
|
||||
keyScope(KeyState.FolderList);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}, this);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue