code_before
stringlengths
4
2.58M
code_after
stringlengths
75
2.59M
from ..expression import getEngine from . import testHTMLTests class ChameleonAqPageTemplate(testHTMLTests.AqPageTemplate): def pt_getEngine(self): return getEngine() class ChameleonTalesExpressionTests(testHTMLTests.HTMLTests): def setUp(self): super().setUp() # override with templates using chameleon TALES expressions self.folder.laf = ChameleonAqPageTemplate() self.folder.t = ChameleonAqPageTemplate() # override ``PREFIX`` to be able to account for # small differences between ``zope.tales`` and ``chameleon.tales`` # expressions (e.g. the ``zope.tales`` ``not`` expression # returns ``int``, that of ``chameleon.tales`` ``bool`` PREFIX = "CH_"
import unittest from ..expression import getEngine from . import testHTMLTests class ChameleonAqPageTemplate(testHTMLTests.AqPageTemplate): def pt_getEngine(self): return getEngine() class ChameleonTalesExpressionTests(testHTMLTests.HTMLTests): def setUp(self): super().setUp() # override with templates using chameleon TALES expressions self.folder.laf = ChameleonAqPageTemplate() self.folder.t = ChameleonAqPageTemplate() # override ``PREFIX`` to be able to account for # small differences between ``zope.tales`` and ``chameleon.tales`` # expressions (e.g. the ``zope.tales`` ``not`` expression # returns ``int``, that of ``chameleon.tales`` ``bool`` PREFIX = "CH_" @unittest.skip('The test in the base class relies on a Zope context with' ' the "random" module available in expressions') def test_underscore_traversal(self): pass
define( [ "qunit", "jquery", "lib/helper", "ui/widgets/checkboxradio" ], function( QUnit, $, helper ) { "use strict"; QUnit.module( "Checkboxradio: methods", { afterEach: helper.moduleAfterEach } ); $.each( [ "checkbox", "radio" ], function( index, value ) { QUnit.test( value + ": refresh", function( assert ) { var widget, icon, checkbox = value === "checkbox", input = $( "#" + value + "-method-refresh" ); assert.expect( checkbox ? 11 : 8 ); input.checkboxradio(); widget = input.checkboxradio( "widget" ); icon = widget.find( ".ui-icon" ); assert.strictEqual( icon.length, 1, "There is initally one icon" ); icon.remove(); input.checkboxradio( "refresh" ); icon = widget.find( ".ui-icon" ); assert.strictEqual( icon.length, 1, "Icon is recreated on refresh if absent" ); assert.hasClasses( icon, "ui-icon-blank" ); if ( checkbox ) { assert.lacksClasses( icon, "ui-icon-check" ); } assert.lacksClasses( widget, "ui-checkboxradio-checked" ); input.prop( "checked", true ); input.checkboxradio( "refresh" ); if ( checkbox ) { assert.hasClasses( icon, "ui-icon-check" ); } assert[ !checkbox ? "hasClasses" : "lacksClasses" ]( icon, "ui-icon-blank" ); assert.hasClasses( widget, "ui-checkboxradio-checked" ); input.prop( "checked", false ); input.checkboxradio( "refresh" ); assert.hasClasses( icon, "ui-icon-blank" ); if ( checkbox ) { assert.lacksClasses( icon, "ui-icon-check" ); } assert.lacksClasses( widget, "ui-checkboxradio-checked" ); } ); QUnit.test( value + ": destroy", function( assert ) { assert.expect( 1 ); assert.domEqual( "#" + value + "-method-destroy", function() { $( "#" + value + "-method-destroy" ).checkboxradio().checkboxradio( "destroy" ); } ); } ); QUnit.test( value + ": disable / enable", function( assert ) { assert.expect( 4 ); var input = $( "#" + value + "-method-disable" ), widget = input.checkboxradio().checkboxradio( "widget" ); input.checkboxradio( "disable" ); assert.hasClasses( widget, "ui-state-disabled" ); assert.strictEqual( input.is( ":disabled" ), true, value + " is disabled when disable is called" ); input.checkboxradio( "enable" ); assert.lacksClasses( widget, "ui-state-disabled" ); assert.strictEqual( input.is( ":disabled" ), false, value + " has disabled prop removed when enable is called" ); } ); QUnit.test( value + ": widget returns the label", function( assert ) { assert.expect( 1 ); var input = $( "#" + value + "-method-refresh" ), label = $( "#" + value + "-method-refresh-label" ); input.checkboxradio(); assert.strictEqual( input.checkboxradio( "widget" )[ 0 ], label[ 0 ], "widget method returns label" ); } ); } ); QUnit.test( "Input wrapped in a label preserved on refresh", function( assert ) { var input = $( "#label-with-no-for" ).checkboxradio(), element = input.checkboxradio( "widget" ); assert.expect( 1 ); input.checkboxradio( "refresh" ); assert.strictEqual( input.parent()[ 0 ], element[ 0 ], "Input preserved" ); } ); } );
define( [ "qunit", "jquery", "lib/helper", "ui/widgets/checkboxradio" ], function( QUnit, $, helper ) { "use strict"; QUnit.module( "Checkboxradio: methods", { afterEach: helper.moduleAfterEach } ); $.each( [ "checkbox", "radio" ], function( index, value ) { QUnit.test( value + ": refresh", function( assert ) { var widget, icon, checkbox = value === "checkbox", input = $( "#" + value + "-method-refresh" ); assert.expect( checkbox ? 11 : 8 ); input.checkboxradio(); widget = input.checkboxradio( "widget" ); icon = widget.find( ".ui-icon" ); assert.strictEqual( icon.length, 1, "There is initally one icon" ); icon.remove(); input.checkboxradio( "refresh" ); icon = widget.find( ".ui-icon" ); assert.strictEqual( icon.length, 1, "Icon is recreated on refresh if absent" ); assert.hasClasses( icon, "ui-icon-blank" ); if ( checkbox ) { assert.lacksClasses( icon, "ui-icon-check" ); } assert.lacksClasses( widget, "ui-checkboxradio-checked" ); input.prop( "checked", true ); input.checkboxradio( "refresh" ); if ( checkbox ) { assert.hasClasses( icon, "ui-icon-check" ); } assert[ !checkbox ? "hasClasses" : "lacksClasses" ]( icon, "ui-icon-blank" ); assert.hasClasses( widget, "ui-checkboxradio-checked" ); input.prop( "checked", false ); input.checkboxradio( "refresh" ); assert.hasClasses( icon, "ui-icon-blank" ); if ( checkbox ) { assert.lacksClasses( icon, "ui-icon-check" ); } assert.lacksClasses( widget, "ui-checkboxradio-checked" ); } ); QUnit.test( value + ": destroy", function( assert ) { assert.expect( 1 ); assert.domEqual( "#" + value + "-method-destroy", function() { $( "#" + value + "-method-destroy" ).checkboxradio().checkboxradio( "destroy" ); } ); } ); QUnit.test( value + ": disable / enable", function( assert ) { assert.expect( 4 ); var input = $( "#" + value + "-method-disable" ), widget = input.checkboxradio().checkboxradio( "widget" ); input.checkboxradio( "disable" ); assert.hasClasses( widget, "ui-state-disabled" ); assert.strictEqual( input.is( ":disabled" ), true, value + " is disabled when disable is called" ); input.checkboxradio( "enable" ); assert.lacksClasses( widget, "ui-state-disabled" ); assert.strictEqual( input.is( ":disabled" ), false, value + " has disabled prop removed when enable is called" ); } ); QUnit.test( value + ": widget returns the label", function( assert ) { assert.expect( 1 ); var input = $( "#" + value + "-method-refresh" ), label = $( "#" + value + "-method-refresh-label" ); input.checkboxradio(); assert.strictEqual( input.checkboxradio( "widget" )[ 0 ], label[ 0 ], "widget method returns label" ); } ); } ); QUnit.test( "Input wrapped in a label preserved on refresh", function( assert ) { var input = $( "#label-with-no-for" ).checkboxradio(), element = input.checkboxradio( "widget" ); assert.expect( 1 ); input.checkboxradio( "refresh" ); assert.strictEqual( input.parent()[ 0 ], element[ 0 ], "Input preserved" ); } ); QUnit.test( "Initial text label not turned to HTML on refresh", function( assert ) { var tests = [ { id: "label-with-no-for-with-html", expectedLabel: "<strong>Hi</strong>, <em>I'm a label</em>" }, { id: "label-with-no-for-with-text", expectedLabel: "Hi, I'm a label" }, { id: "label-with-no-for-with-html-like-text", expectedLabel: "&lt;em&gt;Hi, I'm a label&lt;/em&gt;" } ]; assert.expect( tests.length ); tests.forEach( function( testData ) { var id = testData.id; var expectedLabel = testData.expectedLabel; var inputElem = $( "#" + id ); var labelElem = inputElem.parent(); inputElem.checkboxradio( { icon: false } ); inputElem.checkboxradio( "refresh" ); var labelWithoutInput = labelElem.clone(); labelWithoutInput.find( "input" ).remove(); assert.strictEqual( labelWithoutInput.html().trim(), expectedLabel.trim(), "Label correct [" + id + "]" ); } ); } ); } );
from django.contrib.postgres.fields import ArrayField, JSONField from django.db.models.aggregates import Aggregate from .mixins import OrderableAggMixin __all__ = [ 'ArrayAgg', 'BitAnd', 'BitOr', 'BoolAnd', 'BoolOr', 'JSONBAgg', 'StringAgg', ] class ArrayAgg(OrderableAggMixin, Aggregate): function = 'ARRAY_AGG' template = '%(function)s(%(distinct)s%(expressions)s %(ordering)s)' allow_distinct = True @property def output_field(self): return ArrayField(self.source_expressions[0].output_field) def convert_value(self, value, expression, connection): if not value: return [] return value class BitAnd(Aggregate): function = 'BIT_AND' class BitOr(Aggregate): function = 'BIT_OR' class BoolAnd(Aggregate): function = 'BOOL_AND' class BoolOr(Aggregate): function = 'BOOL_OR' class JSONBAgg(Aggregate): function = 'JSONB_AGG' output_field = JSONField() def convert_value(self, value, expression, connection): if not value: return [] return value class StringAgg(OrderableAggMixin, Aggregate): function = 'STRING_AGG' template = "%(function)s(%(distinct)s%(expressions)s, '%(delimiter)s'%(ordering)s)" allow_distinct = True def __init__(self, expression, delimiter, **extra): super().__init__(expression, delimiter=delimiter, **extra) def convert_value(self, value, expression, connection): if not value: return '' return value
from django.contrib.postgres.fields import ArrayField, JSONField from django.db.models import Value from django.db.models.aggregates import Aggregate from .mixins import OrderableAggMixin __all__ = [ 'ArrayAgg', 'BitAnd', 'BitOr', 'BoolAnd', 'BoolOr', 'JSONBAgg', 'StringAgg', ] class ArrayAgg(OrderableAggMixin, Aggregate): function = 'ARRAY_AGG' template = '%(function)s(%(distinct)s%(expressions)s %(ordering)s)' allow_distinct = True @property def output_field(self): return ArrayField(self.source_expressions[0].output_field) def convert_value(self, value, expression, connection): if not value: return [] return value class BitAnd(Aggregate): function = 'BIT_AND' class BitOr(Aggregate): function = 'BIT_OR' class BoolAnd(Aggregate): function = 'BOOL_AND' class BoolOr(Aggregate): function = 'BOOL_OR' class JSONBAgg(Aggregate): function = 'JSONB_AGG' output_field = JSONField() def convert_value(self, value, expression, connection): if not value: return [] return value class StringAgg(OrderableAggMixin, Aggregate): function = 'STRING_AGG' template = '%(function)s(%(distinct)s%(expressions)s %(ordering)s)' allow_distinct = True def __init__(self, expression, delimiter, **extra): delimiter_expr = Value(str(delimiter)) super().__init__(expression, delimiter_expr, **extra) def convert_value(self, value, expression, connection): if not value: return '' return value
from django.db.models.expressions import F, OrderBy class OrderableAggMixin: def __init__(self, expression, ordering=(), **extra): if not isinstance(ordering, (list, tuple)): ordering = [ordering] ordering = ordering or [] # Transform minus sign prefixed strings into an OrderBy() expression. ordering = ( (OrderBy(F(o[1:]), descending=True) if isinstance(o, str) and o[0] == '-' else o) for o in ordering ) super().__init__(expression, **extra) self.ordering = self._parse_expressions(*ordering) def resolve_expression(self, *args, **kwargs): self.ordering = [expr.resolve_expression(*args, **kwargs) for expr in self.ordering] return super().resolve_expression(*args, **kwargs) def as_sql(self, compiler, connection): if self.ordering: ordering_params = [] ordering_expr_sql = [] for expr in self.ordering: expr_sql, expr_params = expr.as_sql(compiler, connection) ordering_expr_sql.append(expr_sql) ordering_params.extend(expr_params) sql, sql_params = super().as_sql(compiler, connection, ordering=( 'ORDER BY ' + ', '.join(ordering_expr_sql) )) return sql, sql_params + ordering_params return super().as_sql(compiler, connection, ordering='') def set_source_expressions(self, exprs): # Extract the ordering expressions because ORDER BY clause is handled # in a custom way. self.ordering = exprs[self._get_ordering_expressions_index():] return super().set_source_expressions(exprs[:self._get_ordering_expressions_index()]) def get_source_expressions(self): return super().get_source_expressions() + self.ordering def _get_ordering_expressions_index(self): """Return the index at which the ordering expressions start.""" source_expressions = self.get_source_expressions() return len(source_expressions) - len(self.ordering)
from django.db.models.expressions import F, OrderBy class OrderableAggMixin: def __init__(self, *expressions, ordering=(), **extra): if not isinstance(ordering, (list, tuple)): ordering = [ordering] ordering = ordering or [] # Transform minus sign prefixed strings into an OrderBy() expression. ordering = ( (OrderBy(F(o[1:]), descending=True) if isinstance(o, str) and o[0] == '-' else o) for o in ordering ) super().__init__(*expressions, **extra) self.ordering = self._parse_expressions(*ordering) def resolve_expression(self, *args, **kwargs): self.ordering = [expr.resolve_expression(*args, **kwargs) for expr in self.ordering] return super().resolve_expression(*args, **kwargs) def as_sql(self, compiler, connection): if self.ordering: ordering_params = [] ordering_expr_sql = [] for expr in self.ordering: expr_sql, expr_params = expr.as_sql(compiler, connection) ordering_expr_sql.append(expr_sql) ordering_params.extend(expr_params) sql, sql_params = super().as_sql(compiler, connection, ordering=( 'ORDER BY ' + ', '.join(ordering_expr_sql) )) return sql, sql_params + ordering_params return super().as_sql(compiler, connection, ordering='') def set_source_expressions(self, exprs): # Extract the ordering expressions because ORDER BY clause is handled # in a custom way. self.ordering = exprs[self._get_ordering_expressions_index():] return super().set_source_expressions(exprs[:self._get_ordering_expressions_index()]) def get_source_expressions(self): return super().get_source_expressions() + self.ordering def _get_ordering_expressions_index(self): """Return the index at which the ordering expressions start.""" source_expressions = self.get_source_expressions() return len(source_expressions) - len(self.ordering)
'use strict'; var util = require('util'), path = require('path'), shell = require('shelljs'), debug = require('debug')('dns-sync'); //source - http://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address var ValidHostnameRegex = new RegExp("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$"); function isValidHostName(hostname) { return ValidHostnameRegex.test(hostname); } /** * Resolve hostname to IP address, * returns null in case of error */ module.exports = { lookup: function lookup(hostname) { return module.exports.resolve(hostname); }, resolve: function resolve(hostname, type) { var nodeBinary = process.execPath; if (!isValidHostName(hostname)) { console.error('Invalid hostname:', hostname); return null; } var scriptPath = path.join(__dirname, "../scripts/dns-lookup-script"), response, cmd = util.format('"%s" "%s" %s %s', nodeBinary, scriptPath, hostname, type || ''); response = shell.exec(cmd, {silent: true}); if (response && response.code === 0) { return JSON.parse(response.stdout); } debug('hostname', "fail to resolve hostname " + hostname); return null; } };
'use strict'; var util = require('util'), path = require('path'), shell = require('shelljs'), debug = require('debug')('dns-sync'); //source - http://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address var ValidHostnameRegex = new RegExp("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$"); // https://nodejs.org/api/dns.html#dns_dns_resolve_hostname_rrtype_callback var RRecordTypes = [ 'A', 'AAAA', 'NS', 'NAPTR', 'CNAME', 'SOA', 'SRV', 'PTR', 'MX', 'TXT', 'ANY']; function isValidHostName(hostname) { return ValidHostnameRegex.test(hostname); } /** * Resolve hostname to IP address, * returns null in case of error */ module.exports = { lookup: function lookup(hostname) { return module.exports.resolve(hostname); }, resolve: function resolve(hostname, type) { var nodeBinary = process.execPath; if (!isValidHostName(hostname)) { console.error('Invalid hostname:', hostname); return null; } if (typeof type !== 'undefined' && RRecordTypes.indexOf(type) === -1) { console.error('Invalid rrtype:', type); return null; } var scriptPath = path.join(__dirname, "../scripts/dns-lookup-script"), response, cmd = util.format('"%s" "%s" %s %s', nodeBinary, scriptPath, hostname, type || ''); response = shell.exec(cmd, {silent: true}); if (response && response.code === 0) { return JSON.parse(response.stdout); } debug('hostname', "fail to resolve hostname " + hostname); return null; } };
{ "name": "dns-sync", "version": "0.2.0", "description": "dns-sync", "main": "index.js", "scripts": { "test": "mocha", "lint": "eslint ." }, "homepage": "https://github.com/skoranga/node-dns-sync", "repository": { "type": "git", "url": "git@github.com:skoranga/node-dns-sync.git" }, "keywords": [ "dns sync", "server startup", "nodejs" ], "author": "Sanjeev Koranga", "license": "MIT", "readmeFilename": "README.md", "dependencies": { "debug": "^4", "shelljs": "~0.8" }, "devDependencies": { "mocha": "^6", "eslint": "^6", "eslint-plugin-standard": "^4" } }
{ "name": "dns-sync", "version": "0.2.1", "description": "dns-sync", "main": "index.js", "scripts": { "test": "mocha", "lint": "eslint ." }, "homepage": "https://github.com/skoranga/node-dns-sync", "repository": { "type": "git", "url": "git@github.com:skoranga/node-dns-sync.git" }, "keywords": [ "dns sync", "server startup", "nodejs" ], "author": "Sanjeev Koranga", "license": "MIT", "readmeFilename": "README.md", "dependencies": { "debug": "^4", "shelljs": "~0.8" }, "devDependencies": { "mocha": "^6", "eslint": "^6", "eslint-plugin-standard": "^4" } }
'use strict'; var assert = require('assert'), dnsSync = require('../index'); describe('dns sync', function () { it('should resolve dns', function () { assert.ok(dnsSync.resolve('www.example.com')); assert.ok(dnsSync.resolve('www.paypal.com')); assert.ok(dnsSync.resolve('www.google.com')); assert.ok(dnsSync.resolve('www.yahoo.com')); }); it('should fail to resolve dns', function () { assert.ok(!dnsSync.resolve('www.example.con')); assert.ok(!dnsSync.resolve('www.paypal.con')); assert.ok(!dnsSync.resolve('www.not-google.first')); assert.ok(!dnsSync.resolve('www.hello-yahoo.next')); }); it('should fail to resolve invalid dns', function () { assert.ok(!dnsSync.resolve("$(id > /tmp/foo)'")); assert.ok(!dnsSync.resolve("cd /tmp; rm -f /tmp/echo; env 'x=() { (a)=>' bash -c \"echo date\"; cat /tmp/echo")); assert.ok(!dnsSync.resolve("$(grep -l -z '[^)]=() {' /proc/[1-9]*/environ | cut -d/ -f3)'")); }); it('should resolve AAAA records if asked', function () { var aaaa = dnsSync.resolve('www.google.com', 'AAAA'); assert.ok(aaaa); assert.ok(aaaa[0].match(/^([0-9a-f]{2,4}(:|$))+/)); assert.ok(dnsSync.resolve('www.google.com') !== aaaa); }); it('should resolve NS records if asked', function () { var ns = dnsSync.resolve('google.com', 'NS'); assert.ok(ns); assert.ok(ns.length >= 1); assert.ok(ns[0].match(/^ns[0-9]+\.google\.com$/)); }); });
'use strict'; var assert = require('assert'), fs = require('fs'), dnsSync = require('../index'); describe('dns sync', function () { it('should resolve dns', function () { assert.ok(dnsSync.resolve('www.example.com')); assert.ok(dnsSync.resolve('www.paypal.com')); assert.ok(dnsSync.resolve('www.google.com')); assert.ok(dnsSync.resolve('www.yahoo.com')); }); it('should fail to resolve dns', function () { assert.ok(!dnsSync.resolve('www.example.con')); assert.ok(!dnsSync.resolve('www.paypal.con')); assert.ok(!dnsSync.resolve('www.not-google.first')); assert.ok(!dnsSync.resolve('www.hello-yahoo.next')); }); it('should fail to resolve invalid dns', function () { assert.ok(!dnsSync.resolve("$(id > /tmp/foo)'")); assert.ok(!dnsSync.resolve("cd /tmp; rm -f /tmp/echo; env 'x=() { (a)=>' bash -c \"echo date\"; cat /tmp/echo")); assert.ok(!dnsSync.resolve("$(grep -l -z '[^)]=() {' /proc/[1-9]*/environ | cut -d/ -f3)'")); }); it('should resolve AAAA records if asked', function () { var aaaa = dnsSync.resolve('www.google.com', 'AAAA'); assert.ok(aaaa); assert.ok(aaaa[0].match(/^([0-9a-f]{2,4}(:|$))+/)); assert.ok(dnsSync.resolve('www.google.com') !== aaaa); }); it('should resolve NS records if asked', function () { var ns = dnsSync.resolve('google.com', 'NS'); assert.ok(ns); assert.ok(ns.length >= 1); assert.ok(ns[0].match(/^ns[0-9]+\.google\.com$/)); }); it('should fail to resolve if invalid record is asked', function () { var rs1 = dnsSync.resolve('www.google.com', 'Test'); var rs2 = dnsSync.resolve('www.google.com', ' && touch test.txt'); assert.ok(!rs1); assert.ok(!rs2); assert.ok(!fs.existsSync('test.txt')); }); });
{ "name": "jupyter-notebook-deps", "version": "0.0.1", "dependencies": { "backbone": "components/backbone#~1.2", "bootstrap": "bootstrap#~3.4", "bootstrap-tour": "0.9.0", "codemirror": "components/codemirror#5.56.0+components1", "create-react-class": "https://cdn.jsdelivr.net/npm/create-react-class@15.6.3/create-react-class.min.js", "es6-promise": "~1.0", "font-awesome": "components/font-awesome#~4.7.0", "google-caja": "5669", "jed": "~1.1.1", "jquery": "components/jquery#~3.5.0", "jquery-typeahead": "~2.10.6", "jquery-ui": "components/jqueryui#~1.12", "marked": "~0.7", "MathJax": "^2.7.4", "moment": "~2.19.3", "react": "~16.0.0", "requirejs": "~2.2", "requirejs-text": "~2.0.15", "requirejs-plugins": "~1.0.3", "text-encoding": "~0.1", "underscore": "components/underscore#~1.8.3", "xterm.js": "https://unpkg.com/xterm@~3.1.0/dist/xterm.js", "xterm.js-css": "https://unpkg.com/xterm@~3.1.0/dist/xterm.css", "xterm.js-fit": "https://unpkg.com/xterm@~3.1.0/dist/addons/fit/fit.js" } }
{ "name": "jupyter-notebook-deps", "version": "0.0.1", "dependencies": { "backbone": "components/backbone#~1.2", "bootstrap": "bootstrap#~3.4", "bootstrap-tour": "0.9.0", "codemirror": "components/codemirror#5.56.0+components1", "create-react-class": "https://cdn.jsdelivr.net/npm/create-react-class@15.6.3/create-react-class.min.js", "es6-promise": "~1.0", "font-awesome": "components/font-awesome#~4.7.0", "jed": "~1.1.1", "jquery": "components/jquery#~3.5.0", "jquery-typeahead": "~2.10.6", "jquery-ui": "components/jqueryui#~1.12", "marked": "~0.7", "MathJax": "^2.7.4", "moment": "~2.19.3", "react": "~16.0.0", "requirejs": "~2.2", "requirejs-text": "~2.0.15", "requirejs-plugins": "~1.0.3", "text-encoding": "~0.1", "underscore": "components/underscore#~1.8.3", "xterm.js": "https://unpkg.com/xterm@~3.1.0/dist/xterm.js", "xterm.js-css": "https://unpkg.com/xterm@~3.1.0/dist/xterm.css", "xterm.js-fit": "https://unpkg.com/xterm@~3.1.0/dist/addons/fit/fit.js" } }
{ "name": "jupyter-notebook-deps", "private": true, "version": "4.0.0", "description": "Jupyter Notebook nodejs dependencies", "author": "Jupyter Developers", "license": "BSD-3-Clause", "repository": { "type": "git", "url": "https://github.com/jupyter/notebook.git" }, "scripts": { "bower": "bower install", "build": "python setup.py js css", "build:watch": "npm run watch", "watch": "onchange 'notebook/static/**/!(*.min).js' 'notebook/static/**/*.less' 'bower.json' -- npm run build" }, "devDependencies": { "bower": "^1.8.8", "less": "~2", "onchange": "^6.0.0", "po2json": "^0.4.5", "requirejs": "^2.3.6" } }
{ "name": "jupyter-notebook-deps", "private": true, "version": "4.0.0", "description": "Jupyter Notebook nodejs dependencies", "author": "Jupyter Developers", "license": "BSD-3-Clause", "repository": { "type": "git", "url": "https://github.com/jupyter/notebook.git" }, "scripts": { "bower": "bower install", "build": "python setup.py js css", "build:webpack": "webpack --mode development", "build:watch": "npm run watch", "watch": "onchange 'notebook/static/**/!(*.min).js' 'notebook/static/**/*.less' 'bower.json' -- npm run build" }, "devDependencies": { "@jupyterlab/apputils": "^3.1.3", "bower": "^1.8.8", "less": "~2", "onchange": "^6.0.0", "po2json": "^0.4.5", "requirejs": "^2.3.6", "webpack": "^5.46.0", "webpack-cli": "^4.7.2" } }
None
const path = require('path'); module.exports = { entry: '@jupyterlab/apputils/lib/sanitizer', output: { filename: 'index.js', path: path.resolve(__dirname, 'notebook/static/components/sanitizer'), libraryTarget: "amd" } }
(function($) { $(document).ready(function() { return window.nestedFormEvents.insertFields = function(content, assoc, link) { var tab_content; tab_content = $(link).closest(".controls").siblings(".tab-content"); tab_content.append(content); return tab_content.children().last(); }; }); $(document).on('nested:fieldAdded', 'form', function(content) { var controls, field, nav, new_tab, one_to_one, parent_group, toggler; field = content.field.addClass('tab-pane').attr('id', 'unique-id-' + (new Date().getTime())); new_tab = $('<li><a data-toggle="tab" href="#' + field.attr('id') + '">' + field.children('.object-infos').data('object-label') + '</a></li>'); parent_group = field.closest('.control-group'); controls = parent_group.children('.controls'); one_to_one = controls.data('nestedone') !== void 0; nav = controls.children('.nav'); content = parent_group.children('.tab-content'); toggler = controls.find('.toggler'); nav.append(new_tab); $(window.document).trigger('rails_admin.dom_ready', [field, parent_group]); new_tab.children('a').tab('show'); if (!one_to_one) { nav.select(':hidden').show('slow'); } content.select(':hidden').show('slow'); toggler.addClass('active').removeClass('disabled').children('i').addClass('icon-chevron-down').removeClass('icon-chevron-right'); if (one_to_one) { controls.find('.add_nested_fields').removeClass('add_nested_fields').html(field.children('.object-infos').data('object-label')); } }); $(document).on('nested:fieldRemoved', 'form', function(content) { var add_button, controls, current_li, field, nav, one_to_one, parent_group, toggler; field = content.field; nav = field.closest(".control-group").children('.controls').children('.nav'); current_li = nav.children('li').has('a[href="#' + field.attr('id') + '"]'); parent_group = field.closest(".control-group"); controls = parent_group.children('.controls'); one_to_one = controls.data('nestedone') !== void 0; toggler = controls.find('.toggler'); (current_li.next().length ? current_li.next() : current_li.prev()).children('a:first').tab('show'); current_li.remove(); if (nav.children().length === 0) { nav.select(':visible').hide('slow'); toggler.removeClass('active').addClass('disabled').children('i').removeClass('icon-chevron-down').addClass('icon-chevron-right'); } if (one_to_one) { add_button = toggler.next(); add_button.addClass('add_nested_fields').html(add_button.data('add-label')); } field.find('[required]').each(function() { $(this).removeAttr('required'); }); }); }(jQuery));
(function($) { $(document).ready(function() { return window.nestedFormEvents.insertFields = function(content, assoc, link) { var tab_content; tab_content = $(link).closest(".controls").siblings(".tab-content"); tab_content.append(content); return tab_content.children().last(); }; }); $(document).on('nested:fieldAdded', 'form', function(content) { var controls, field, nav, new_tab, one_to_one, parent_group, toggler; field = content.field.addClass('tab-pane').attr('id', 'unique-id-' + (new Date().getTime())); new_tab = $('<li></li>').append( $('<a></a>').attr('data-toggle', 'tab').attr('href', '#' + field.attr('id')).text(field.children('.object-infos').data('object-label')) ) parent_group = field.closest('.control-group'); controls = parent_group.children('.controls'); one_to_one = controls.data('nestedone') !== void 0; nav = controls.children('.nav'); content = parent_group.children('.tab-content'); toggler = controls.find('.toggler'); nav.append(new_tab); $(window.document).trigger('rails_admin.dom_ready', [field, parent_group]); new_tab.children('a').tab('show'); if (!one_to_one) { nav.select(':hidden').show('slow'); } content.select(':hidden').show('slow'); toggler.addClass('active').removeClass('disabled').children('i').addClass('icon-chevron-down').removeClass('icon-chevron-right'); if (one_to_one) { controls.find('.add_nested_fields').removeClass('add_nested_fields').text(field.children('.object-infos').data('object-label')); } }); $(document).on('nested:fieldRemoved', 'form', function(content) { var add_button, controls, current_li, field, nav, one_to_one, parent_group, toggler; field = content.field; nav = field.closest(".control-group").children('.controls').children('.nav'); current_li = nav.children('li').has('a[href="#' + field.attr('id') + '"]'); parent_group = field.closest(".control-group"); controls = parent_group.children('.controls'); one_to_one = controls.data('nestedone') !== void 0; toggler = controls.find('.toggler'); (current_li.next().length ? current_li.next() : current_li.prev()).children('a:first').tab('show'); current_li.remove(); if (nav.children().length === 0) { nav.select(':visible').hide('slow'); toggler.removeClass('active').addClass('disabled').children('i').removeClass('icon-chevron-down').addClass('icon-chevron-right'); } if (one_to_one) { add_button = toggler.next(); add_button.addClass('add_nested_fields').html(add_button.data('add-label')); } field.find('[required]').each(function() { $(this).removeAttr('required'); }); }); }(jQuery));
{ "name": "shiba", "productName": "Shiba", "version": "1.1.0", "description": "Live markdown previewer with linter", "main": "./build/src/browser/mainu.js", "bin": { "shiba": "./bin/cli.js" }, "author": "rhysd <lin90162@yahoo.co.jp>", "homepage": "https://github.com/rhysd/Shiba#readme", "repository": { "type": "git", "url": "https://github.com/rhysd/Shiba.git" }, "bugs": { "url": "https://github.com/rhysd/Shiba/issues" }, "license": "MIT", "keywords": [ "markdown", "viewer", "preview", "electron" ], "dependencies": { "about-window": "^1.8.0", "animate.css": "^3.5.2", "chokidar": "^1.7.0", "electron": "^1.7.9", "electron-window-state": "^4.1.1", "encoding-japanese": "^1.0.26", "font-awesome": "^4.7.0", "github-markdown-css": "^2.9.0", "he": "^1.1.1", "highlight.js": "^9.12.0", "js-yaml": "^3.10.0", "katex": "^0.8.3", "markdownlint": "^0.6.2", "marked": "github:rhysd/marked#emoji", "mermaid": "7.0.17", "mousetrap": "^1.6.1", "remark": "^8.0.0", "remark-lint": "^6.0.1", "remark-preset-lint-consistent": "^2.0.1", "remark-preset-lint-markdown-style-guide": "^2.1.1", "remark-preset-lint-recommended": "^3.0.1" }, "devDependencies": { "@types/chokidar": "^1.7.3", "@types/empower": "^1.2.30", "@types/es6-promise": "0.0.33", "@types/he": "^0.5.29", "@types/highlight.js": "^9.12.1", "@types/js-yaml": "^3.9.1", "@types/katex": "0.5.0", "@types/mocha": "^2.2.44", "@types/mousetrap": "^1.5.34", "@types/node": "8.0.53", "@types/polymer": "^1.2.1", "@types/power-assert": "^1.4.29", "@types/power-assert-formatter": "^1.4.28", "@types/webcomponents.js": "^0.6.32", "@types/webdriverio": "^4.8.6", "asar": "^0.14.0", "bower": "^1.8.2", "electron-packager": "^10.1.0", "electron-rebuild": "^1.6.0", "intelli-espower-loader": "^1.0.1", "mocha": "^4.0.1", "nsp": "^3.1.0", "power-assert": "^1.4.4", "spectron": "^3.7.2", "touch": "^3.1.0", "tslint": "^5.8.0", "typescript": "^2.6.1" }, "scripts": { "dep": "rake dep", "build": "rake build", "watch": "rake watch", "update-emoji": "rake update_emoji", "show-readme": "./bin/cli.js README.md", "app": "./bin/cli.js", "debug": "NODE_ENV=development ./bin/cli.js", "test": "rake test", "e2e": "rake e2e", "start": "npm run dep && npm run build && npm run show-readme" } }
{ "name": "shiba", "productName": "Shiba", "version": "1.1.0", "description": "Live markdown previewer with linter", "main": "./build/src/browser/mainu.js", "bin": { "shiba": "./bin/cli.js" }, "author": "rhysd <lin90162@yahoo.co.jp>", "homepage": "https://github.com/rhysd/Shiba#readme", "repository": { "type": "git", "url": "https://github.com/rhysd/Shiba.git" }, "bugs": { "url": "https://github.com/rhysd/Shiba/issues" }, "license": "MIT", "keywords": [ "markdown", "viewer", "preview", "electron" ], "dependencies": { "about-window": "^1.8.0", "animate.css": "^3.5.2", "chokidar": "^1.7.0", "electron": "^1.7.9", "electron-window-state": "^4.1.1", "encoding-japanese": "^1.0.26", "font-awesome": "^4.7.0", "github-markdown-css": "^2.9.0", "he": "^1.1.1", "highlight.js": "^9.12.0", "js-yaml": "^3.10.0", "katex": "^0.8.3", "markdownlint": "^0.6.2", "marked": "github:rhysd/marked#emoji", "mermaid": "7.0.17", "mousetrap": "^1.6.1", "remark": "^8.0.0", "remark-lint": "^6.0.1", "remark-preset-lint-consistent": "^2.0.1", "remark-preset-lint-markdown-style-guide": "^2.1.1", "remark-preset-lint-recommended": "^3.0.1" }, "devDependencies": { "@types/chokidar": "^1.7.3", "@types/empower": "^1.2.30", "@types/es6-promise": "0.0.33", "@types/he": "^0.5.29", "@types/highlight.js": "^9.12.2", "@types/js-yaml": "^3.9.1", "@types/katex": "0.5.0", "@types/marked": "^0.3.0", "@types/mocha": "^2.2.44", "@types/mousetrap": "^1.5.34", "@types/node": "8.0.53", "@types/polymer": "^1.2.1", "@types/power-assert": "^1.4.29", "@types/power-assert-formatter": "^1.4.28", "@types/webcomponents.js": "^0.6.32", "@types/webdriverio": "^4.8.6", "asar": "^0.14.0", "bower": "^1.8.2", "electron-packager": "^10.1.0", "electron-rebuild": "^1.6.0", "intelli-espower-loader": "^1.0.1", "mocha": "^4.0.1", "nsp": "^3.1.0", "power-assert": "^1.4.4", "spectron": "^3.7.2", "touch": "^3.1.0", "tslint": "^5.8.0", "typescript": "^2.6.1" }, "scripts": { "dep": "rake dep", "build": "rake build", "watch": "rake watch", "update-emoji": "rake update_emoji", "show-readme": "./bin/cli.js README.md", "app": "./bin/cli.js", "debug": "NODE_ENV=development ./bin/cli.js", "test": "rake test", "e2e": "rake e2e", "start": "npm run dep && npm run build && npm run show-readme" } }
{ "root": true, "extends": "@ljharb", "rules": { "callback-return": [0], "camelcase": [0], "complexity": [2, 11], "dot-notation": [2, { "allowKeywords": false }], "eqeqeq": [2, "allow-null"], "id-length": [2, { "min": 1, "max": 30 }], "indent": [2, 4], "max-lines": 0, "max-nested-callbacks": [2, 5], "max-params": [2, 3], "max-statements": [2, 20], "max-statements-per-line": [2, { "max": 2 }], "new-cap": [2, { "capIsNewExceptions": ["Template"] }], "no-extra-parens": [0], "no-magic-numbers": [0], "no-negated-condition": [0], "operator-linebreak": [2, "after"], "sort-keys": 0 } }
{ "root": true, "extends": "@ljharb", "rules": { "callback-return": [0], "camelcase": [0], "complexity": [2, 11], "dot-notation": [2, { "allowKeywords": false }], "eqeqeq": [2, "allow-null"], "id-length": [2, { "min": 1, "max": 30 }], "indent": [2, 4], "max-lines": 0, "max-nested-callbacks": [2, 5], "max-params": [2, 4], "max-statements": [2, 20], "max-statements-per-line": [2, { "max": 2 }], "new-cap": [2, { "capIsNewExceptions": ["Template"] }], "no-extra-parens": [0], "no-magic-numbers": [0], "no-negated-condition": [0], "operator-linebreak": [2, "after"], "sort-keys": 0 } }
'use strict'; var tag = require('./tag'); var wrapWith = function (tagName) { return function (name, field, options) { var opt = options || {}; var wrappedContent = []; var errorHTML = opt.hideError ? '' : field.errorHTML(); if (field.widget.type === 'multipleCheckbox' || field.widget.type === 'multipleRadio') { var fieldsetAttrs = { classes: [] }; if (opt.fieldsetClasses) { fieldsetAttrs.classes = fieldsetAttrs.classes.concat(opt.fieldsetClasses); } var legendAttrs = { classes: [] }; if (opt.legendClasses) { legendAttrs.classes = legendAttrs.classes.concat(opt.legendClasses); } var fieldset = tag('fieldset', fieldsetAttrs, [ tag('legend', legendAttrs, field.labelText(name)), opt.errorAfterField ? '' : errorHTML, field.widget.toHTML(name, field), opt.errorAfterField ? errorHTML : '' ].join('')); wrappedContent.push(fieldset); } else { var fieldHTMLs = [field.labelHTML(name, field.id), field.widget.toHTML(name, field)]; if (opt.labelAfterField) { fieldHTMLs.reverse(); } if (opt.errorAfterField) { fieldHTMLs.push(errorHTML); } else { fieldHTMLs.unshift(errorHTML); } wrappedContent = wrappedContent.concat(fieldHTMLs); } return tag(tagName, { classes: field.classes() }, wrappedContent.join('')); }; }; exports.div = wrapWith('div'); exports.p = wrapWith('p'); exports.li = wrapWith('li'); exports.table = function (name, field, options) { var opt = options || {}; var th = tag('th', {}, field.labelHTML(name, field.id)); var tdContent = field.widget.toHTML(name, field); if (!opt.hideError) { var errorHTML = field.errorHTML(); if (opt.errorAfterField) { tdContent += errorHTML; } else { tdContent = errorHTML + tdContent; } } var td = tag('td', {}, tdContent); return tag('tr', { classes: field.classes() }, th + td); };
'use strict'; var tag = require('./tag'); var wrapWith = function (tagName) { return function (name, field, options) { var opt = options || {}; var wrappedContent = []; var errorHTML = opt.hideError ? '' : field.errorHTML(); if (field.widget.type === 'multipleCheckbox' || field.widget.type === 'multipleRadio') { var fieldsetAttrs = { classes: [] }; if (opt.fieldsetClasses) { fieldsetAttrs.classes = fieldsetAttrs.classes.concat(opt.fieldsetClasses); } var legendAttrs = { classes: [] }; if (opt.legendClasses) { legendAttrs.classes = legendAttrs.classes.concat(opt.legendClasses); } var fieldset = tag('fieldset', fieldsetAttrs, [ tag('legend', legendAttrs, field.labelText(name)), opt.errorAfterField ? '' : errorHTML, field.widget.toHTML(name, field), opt.errorAfterField ? errorHTML : '' ].join(''), true); wrappedContent.push(fieldset); } else { var fieldHTMLs = [field.labelHTML(name, field.id), field.widget.toHTML(name, field)]; if (opt.labelAfterField) { fieldHTMLs.reverse(); } if (opt.errorAfterField) { fieldHTMLs.push(errorHTML); } else { fieldHTMLs.unshift(errorHTML); } wrappedContent = wrappedContent.concat(fieldHTMLs); } return tag(tagName, { classes: field.classes() }, wrappedContent.join(''), true); }; }; exports.div = wrapWith('div'); exports.p = wrapWith('p'); exports.li = wrapWith('li'); exports.table = function (name, field, options) { var opt = options || {}; var th = tag('th', {}, field.labelHTML(name, field.id), true); var tdContent = field.widget.toHTML(name, field); if (!opt.hideError) { var errorHTML = field.errorHTML(); if (opt.errorAfterField) { tdContent += errorHTML; } else { tdContent = errorHTML + tdContent; } } var td = tag('td', {}, tdContent, true); return tag('tr', { classes: field.classes() }, th + td, true); };
'use strict'; var htmlEscape = require('./htmlEscape'); var is = require('is'); var keys = require('object-keys'); // generates a string for common HTML tag attributes var attrs = function attrs(a) { if (typeof a.id === 'boolean') { a.id = a.id ? 'id_' + a.name : null; } if (is.array(a.classes) && a.classes.length > 0) { a['class'] = htmlEscape(a.classes.join(' ')); } a.classes = null; var pairs = []; keys(a).forEach(function (field) { var value = a[field]; if (typeof value === 'boolean') { value = value ? field : null; } else if (typeof value === 'number' && isNaN(value)) { value = null; } if (typeof value !== 'undefined' && value !== null) { pairs.push(htmlEscape(field) + '="' + htmlEscape(value) + '"'); } }); return pairs.length > 0 ? ' ' + pairs.join(' ') : ''; }; var selfClosingTags = { area: true, base: true, br: true, col: true, command: true, embed: true, hr: true, img: true, input: true, keygen: true, link: true, meta: true, param: true, source: true, track: true, wbr: true }; var isSelfClosing = function (tagName) { return Object.prototype.hasOwnProperty.call(selfClosingTags, tagName); }; var tag = function tag(tagName, attrsMap, content) { var safeTagName = htmlEscape(tagName); var attrsHTML = !is.array(attrsMap) ? attrs(attrsMap) : attrsMap.reduce(function (html, map) { return html + attrs(map); }, ''); return '<' + safeTagName + attrsHTML + (isSelfClosing(safeTagName) ? ' />' : '>' + content + '</' + safeTagName + '>'); }; tag.attrs = attrs; module.exports = tag;
'use strict'; var htmlEscape = require('./htmlEscape'); var is = require('is'); var keys = require('object-keys'); // generates a string for common HTML tag attributes var attrs = function attrs(a) { if (typeof a.id === 'boolean') { a.id = a.id ? 'id_' + a.name : null; } if (is.array(a.classes) && a.classes.length > 0) { a['class'] = htmlEscape(a.classes.join(' ')); } a.classes = null; var pairs = []; keys(a).forEach(function (field) { var value = a[field]; if (typeof value === 'boolean') { value = value ? field : null; } else if (typeof value === 'number' && isNaN(value)) { value = null; } if (typeof value !== 'undefined' && value !== null) { pairs.push(htmlEscape(field) + '="' + htmlEscape(value) + '"'); } }); return pairs.length > 0 ? ' ' + pairs.join(' ') : ''; }; var selfClosingTags = { area: true, base: true, br: true, col: true, command: true, embed: true, hr: true, img: true, input: true, keygen: true, link: true, meta: true, param: true, source: true, track: true, wbr: true }; var isSelfClosing = function (tagName) { return Object.prototype.hasOwnProperty.call(selfClosingTags, tagName); }; var tag = function tag(tagName, attrsMap, content, contentIsEscaped) { var safeTagName = htmlEscape(tagName); var attrsHTML = !is.array(attrsMap) ? attrs(attrsMap) : attrsMap.reduce(function (html, map) { return html + attrs(map); }, ''); var safeContent = contentIsEscaped ? content : htmlEscape(content); return '<' + safeTagName + attrsHTML + (isSelfClosing(safeTagName) ? ' />' : '>' + safeContent + '</' + safeTagName + '>'); }; tag.attrs = attrs; module.exports = tag;
window.onload = function() { var element = document.createElement('div'); element.textContent = 'injected' + 'Element'; document.body.appendChild(element); }
/* * Copyright 2017 Google Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ window.onload = function() { var element = document.createElement('div'); element.textContent = 'injected' + 'Element'; document.body.appendChild(element); }
window.onload = function() { var element = document.createElement('div'); element.textContent = 'injected' + 'Element'; document.body.appendChild(element); }
/* * Copyright 2017 Google Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ window.onload = function() { var element = document.createElement('div'); element.textContent = 'injected' + 'Element'; document.body.appendChild(element); }
const bootbox = require('bootbox'); require('./Requisitions'); /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ (function() { 'use strict'; angular.module('onms-requisitions') /** * @ngdoc service * @name SynchronizeService * @module onms-requisitions * * @requires RequisitionsService The requisitions service * @requires growl The growl plugin for instant notifications * * @description The SynchronizeService provides a way to request a requisition synchronization asking the user how the scan process will be processed. */ .factory('SynchronizeService', ['RequisitionsService', 'growl', function(RequisitionsService, growl) { return { /** * @description Requests the synchronization/import of a requisition on the server * * A dialog box is displayed to request to the user if the scan phase should be triggered or not. * * @name SynchronizeService:synchronize * @ngdoc method * @methodOf SynchronizeService * @param {object} requisition The requisition object * @param {function} successHandler The function to call after a successful synchronization * @param {function} errorHandler The function to call when something went wrong. */ synchronize: function(requisition, errorHandler) { /** * @param {object} requisition The requisition object * @param {string} rescanExisting true to perform a full scan, false to only add/remove nodes without scan, dbonly for all DB operations without scan */ var doSynchronize = function(requisition, rescanExisting) { RequisitionsService.startTiming(); RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then( function() { // success growl.success('The import operation has been started for ' + requisition.foreignSource + ' (rescanExisting? ' + rescanExisting + ')<br/>Use <b>refresh</b> to update the deployed statistics'); requisition.setDeployed(true); }, errorHandler ); }; bootbox.prompt({ title: 'Synchronize Requisition ' + requisition.foreignSource, message: '<p><b>Choose a scan option: </b></p>', inputType: 'radio', inputOptions: [ { text: 'Scan all nodes', value: 'true', }, { text: 'Scan added nodes only', value: 'false', }, { text: 'No scanning', value: 'dbonly', } ], buttons: { confirm: { label: 'Synchronize', }, cancel: { label: 'Cancel', } }, swapButtonOrder: 'true', callback: function (result) { if (result !== null) { doSynchronize(requisition, result); } } }); } }; }]); }());
const bootbox = require('bootbox'); require('./Requisitions'); /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ (function() { 'use strict'; angular.module('onms-requisitions') /** * @ngdoc service * @name SynchronizeService * @module onms-requisitions * * @requires RequisitionsService The requisitions service * @requires growl The growl plugin for instant notifications * * @description The SynchronizeService provides a way to request a requisition synchronization asking the user how the scan process will be processed. */ .factory('SynchronizeService', ['RequisitionsService', 'growl', function(RequisitionsService, growl) { return { /** * @description Requests the synchronization/import of a requisition on the server * * A dialog box is displayed to request to the user if the scan phase should be triggered or not. * * @name SynchronizeService:synchronize * @ngdoc method * @methodOf SynchronizeService * @param {object} requisition The requisition object * @param {function} successHandler The function to call after a successful synchronization * @param {function} errorHandler The function to call when something went wrong. */ synchronize: function(requisition, errorHandler) { /** * @param {object} requisition The requisition object * @param {string} rescanExisting true to perform a full scan, false to only add/remove nodes without scan, dbonly for all DB operations without scan */ var doSynchronize = function(requisition, rescanExisting) { RequisitionsService.startTiming(); RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then( function() { // success growl.success('The import operation has been started for ' + _.escape(requisition.foreignSource) + ' (rescanExisting? ' + rescanExisting + ')<br/>Use <b>refresh</b> to update the deployed statistics'); requisition.setDeployed(true); }, errorHandler ); }; bootbox.prompt({ title: 'Synchronize Requisition ' + _.escape(requisition.foreignSource), message: '<p><b>Choose a scan option: </b></p>', inputType: 'radio', inputOptions: [ { text: 'Scan all nodes', value: 'true', }, { text: 'Scan added nodes only', value: 'false', }, { text: 'No scanning', value: 'dbonly', } ], buttons: { confirm: { label: 'Synchronize', }, cancel: { label: 'Cancel', } }, swapButtonOrder: 'true', callback: function (result) { if (result !== null) { doSynchronize(requisition, result); } } }); } }; }]); }());
const bootbox = require('bootbox'); require('./Requisitions'); /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ (function() { 'use strict'; angular.module('onms-requisitions') /** * @ngdoc service * @name SynchronizeService * @module onms-requisitions * * @requires RequisitionsService The requisitions service * @requires growl The growl plugin for instant notifications * * @description The SynchronizeService provides a way to request a requisition synchronization asking the user how the scan process will be processed. */ .factory('SynchronizeService', ['RequisitionsService', 'growl', function(RequisitionsService, growl) { return { /** * @description Requests the synchronization/import of a requisition on the server * * A dialog box is displayed to request to the user if the scan phase should be triggered or not. * * @name SynchronizeService:synchronize * @ngdoc method * @methodOf SynchronizeService * @param {object} requisition The requisition object * @param {function} successHandler The function to call after a successful synchronization * @param {function} errorHandler The function to call when something went wrong. */ synchronize: function(requisition, errorHandler) { /** * @param {object} requisition The requisition object * @param {string} rescanExisting true to perform a full scan, false to only add/remove nodes without scan, dbonly for all DB operations without scan */ var doSynchronize = function(requisition, rescanExisting) { RequisitionsService.startTiming(); RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then( function() { // success growl.success('The import operation has been started for ' + requisition.foreignSource + ' (rescanExisting? ' + rescanExisting + ')<br/>Use <b>refresh</b> to update the deployed statistics'); requisition.setDeployed(true); }, errorHandler ); }; bootbox.prompt({ title: 'Synchronize Requisition ' + requisition.foreignSource, message: '<p><b>Choose a scan option: </b></p>', inputType: 'radio', inputOptions: [ { text: 'Scan all nodes', value: 'true', }, { text: 'Scan added nodes only', value: 'false', }, { text: 'No scanning', value: 'dbonly', } ], buttons: { confirm: { label: 'Synchronize', }, cancel: { label: 'Cancel', } }, swapButtonOrder: 'true', callback: function (result) { if (result !== null) { doSynchronize(requisition, result); } } }); } }; }]); }());
const bootbox = require('bootbox'); require('./Requisitions'); /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ (function() { 'use strict'; angular.module('onms-requisitions') /** * @ngdoc service * @name SynchronizeService * @module onms-requisitions * * @requires RequisitionsService The requisitions service * @requires growl The growl plugin for instant notifications * * @description The SynchronizeService provides a way to request a requisition synchronization asking the user how the scan process will be processed. */ .factory('SynchronizeService', ['RequisitionsService', 'growl', function(RequisitionsService, growl) { return { /** * @description Requests the synchronization/import of a requisition on the server * * A dialog box is displayed to request to the user if the scan phase should be triggered or not. * * @name SynchronizeService:synchronize * @ngdoc method * @methodOf SynchronizeService * @param {object} requisition The requisition object * @param {function} successHandler The function to call after a successful synchronization * @param {function} errorHandler The function to call when something went wrong. */ synchronize: function(requisition, errorHandler) { /** * @param {object} requisition The requisition object * @param {string} rescanExisting true to perform a full scan, false to only add/remove nodes without scan, dbonly for all DB operations without scan */ var doSynchronize = function(requisition, rescanExisting) { RequisitionsService.startTiming(); RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then( function() { // success growl.success('The import operation has been started for ' + _.escape(requisition.foreignSource) + ' (rescanExisting? ' + rescanExisting + ')<br/>Use <b>refresh</b> to update the deployed statistics'); requisition.setDeployed(true); }, errorHandler ); }; bootbox.prompt({ title: 'Synchronize Requisition ' + _.escape(requisition.foreignSource), message: '<p><b>Choose a scan option: </b></p>', inputType: 'radio', inputOptions: [ { text: 'Scan all nodes', value: 'true', }, { text: 'Scan added nodes only', value: 'false', }, { text: 'No scanning', value: 'dbonly', } ], buttons: { confirm: { label: 'Synchronize', }, cancel: { label: 'Cancel', } }, swapButtonOrder: 'true', callback: function (result) { if (result !== null) { doSynchronize(requisition, result); } } }); } }; }]); }());
/** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition'; function createController() { return controllerFactory('ForeignSourceController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); $q = _$q_; controllerFactory = $controller; })); beforeEach(function() { mockModal = {}; mockRequisitionsService.getForeignSourceDefinition = jasmine.createSpy('getForeignSourceDefinition'); mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); var requisitionDefer = $q.defer(); requisitionDefer.resolve({ detectors: [{'name':'ICMP'},{'name':'SNMP'}], policies: [{'name':'Foo'},{'name':'Bar'}] }); mockRequisitionsService.getForeignSourceDefinition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: ForeignSourceController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getForeignSourceDefinition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); expect(scope.indexOfDetector({name:'ICMP'})).toBe(0); expect(scope.indexOfPolicy({name:'Foo'})).toBe(0); expect(scope.indexOfDetector({name:'HTTP'})).toBe(-1); expect(scope.indexOfPolicy({name:'Test'})).toBe(-1); });
/** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition'; function createController() { return controllerFactory('ForeignSourceController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); $q = _$q_; controllerFactory = $controller; })); beforeEach(function() { mockModal = {}; mockRequisitionsService.getForeignSourceDefinition = jasmine.createSpy('getForeignSourceDefinition'); mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); var requisitionDefer = $q.defer(); requisitionDefer.resolve({ detectors: [{'name':'ICMP'},{'name':'SNMP'}], policies: [{'name':'Foo'},{'name':'Bar'}] }); mockRequisitionsService.getForeignSourceDefinition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: ForeignSourceController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getForeignSourceDefinition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); expect(scope.indexOfDetector({name:'ICMP'})).toBe(0); expect(scope.indexOfPolicy({name:'Foo'})).toBe(0); expect(scope.indexOfDetector({name:'HTTP'})).toBe(-1); expect(scope.indexOfPolicy({name:'Test'})).toBe(-1); });
/** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition'; function createController() { return controllerFactory('ForeignSourceController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); $q = _$q_; controllerFactory = $controller; })); beforeEach(function() { mockModal = {}; mockRequisitionsService.getForeignSourceDefinition = jasmine.createSpy('getForeignSourceDefinition'); mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); var requisitionDefer = $q.defer(); requisitionDefer.resolve({ detectors: [{'name':'ICMP'},{'name':'SNMP'}], policies: [{'name':'Foo'},{'name':'Bar'}] }); mockRequisitionsService.getForeignSourceDefinition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: ForeignSourceController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getForeignSourceDefinition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); expect(scope.indexOfDetector({name:'ICMP'})).toBe(0); expect(scope.indexOfPolicy({name:'Foo'})).toBe(0); expect(scope.indexOfDetector({name:'HTTP'})).toBe(-1); expect(scope.indexOfPolicy({name:'Test'})).toBe(-1); });
/** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition'; function createController() { return controllerFactory('ForeignSourceController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); $q = _$q_; controllerFactory = $controller; })); beforeEach(function() { mockModal = {}; mockRequisitionsService.getForeignSourceDefinition = jasmine.createSpy('getForeignSourceDefinition'); mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); var requisitionDefer = $q.defer(); requisitionDefer.resolve({ detectors: [{'name':'ICMP'},{'name':'SNMP'}], policies: [{'name':'Foo'},{'name':'Bar'}] }); mockRequisitionsService.getForeignSourceDefinition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: ForeignSourceController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getForeignSourceDefinition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); expect(scope.indexOfDetector({name:'ICMP'})).toBe(0); expect(scope.indexOfPolicy({name:'Foo'})).toBe(0); expect(scope.indexOfDetector({name:'HTTP'})).toBe(-1); expect(scope.indexOfPolicy({name:'Test'})).toBe(-1); });
/*global RequisitionNode:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const RequisitionNode = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionNode'); // Initialize testing environment var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}; var foreignSource = 'test-requisition'; var foreignId = '1001'; var categories = ['Production', 'Testing', 'Server', 'Storage']; var locations = ['Default']; var node = new RequisitionNode(foreignSource, { 'foreign-id': foreignId }); var requisition = { foreignSource: foreignSource, nodes: [{foreignId: '01'},{foreignId: '02'}] }; function createController() { return controllerFactory('NodeController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource, 'foreignId': foreignId }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getNode = jasmine.createSpy('getNode'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); mockRequisitionsService.getAvailableCategories = jasmine.createSpy('getAvailableCategories'); mockRequisitionsService.getAvailableLocations = jasmine.createSpy('getAvailableLocations'); var nodeDefer = $q.defer(); nodeDefer.resolve(node); mockRequisitionsService.getNode.and.returnValue(nodeDefer.promise); var categoriesDefer = $q.defer(); categoriesDefer.resolve(categories); mockRequisitionsService.getAvailableCategories.and.returnValue(categoriesDefer.promise); var locationsDefer = $q.defer(); locationsDefer.resolve(locations); mockRequisitionsService.getAvailableLocations.and.returnValue(locationsDefer.promise); var reqDefer = $q.defer(); reqDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(reqDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: NodeController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getAvailableCategories).toHaveBeenCalled(); expect(mockRequisitionsService.getNode).toHaveBeenCalledWith(foreignSource, foreignId); expect(scope.foreignSource).toBe(foreignSource); expect(scope.foreignId).toBe(foreignId); expect(scope.availableCategories.length).toBe(4); expect(scope.foreignIdBlackList).toEqual(['01', '02']); expect(scope.getAvailableCategories()).toEqual(categories); scope.node.categories.push({name: 'Production'}); expect(scope.getAvailableCategories()).toEqual(['Testing', 'Server', 'Storage']); expect(scope.availableLocations).toEqual(locations); });
/*global RequisitionNode:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const RequisitionNode = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionNode'); // Initialize testing environment var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}; var foreignSource = 'test-requisition'; var foreignId = '1001'; var categories = ['Production', 'Testing', 'Server', 'Storage']; var locations = ['Default']; var node = new RequisitionNode(foreignSource, { 'foreign-id': foreignId }); var requisition = { foreignSource: foreignSource, nodes: [{foreignId: '01'},{foreignId: '02'}] }; function createController() { return controllerFactory('NodeController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource, 'foreignId': foreignId }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getNode = jasmine.createSpy('getNode'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); mockRequisitionsService.getAvailableCategories = jasmine.createSpy('getAvailableCategories'); mockRequisitionsService.getAvailableLocations = jasmine.createSpy('getAvailableLocations'); var nodeDefer = $q.defer(); nodeDefer.resolve(node); mockRequisitionsService.getNode.and.returnValue(nodeDefer.promise); var categoriesDefer = $q.defer(); categoriesDefer.resolve(categories); mockRequisitionsService.getAvailableCategories.and.returnValue(categoriesDefer.promise); var locationsDefer = $q.defer(); locationsDefer.resolve(locations); mockRequisitionsService.getAvailableLocations.and.returnValue(locationsDefer.promise); var reqDefer = $q.defer(); reqDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(reqDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: NodeController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getAvailableCategories).toHaveBeenCalled(); expect(mockRequisitionsService.getNode).toHaveBeenCalledWith(foreignSource, foreignId); expect(scope.foreignSource).toBe(foreignSource); expect(scope.foreignId).toBe(foreignId); expect(scope.availableCategories.length).toBe(4); expect(scope.foreignIdBlackList).toEqual(['01', '02']); expect(scope.getAvailableCategories()).toEqual(categories); scope.node.categories.push({name: 'Production'}); expect(scope.getAvailableCategories()).toEqual(['Testing', 'Server', 'Storage']); expect(scope.availableLocations).toEqual(locations); });
/*global RequisitionNode:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const RequisitionNode = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionNode'); // Initialize testing environment var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}; var foreignSource = 'test-requisition'; var foreignId = '1001'; var categories = ['Production', 'Testing', 'Server', 'Storage']; var locations = ['Default']; var node = new RequisitionNode(foreignSource, { 'foreign-id': foreignId }); var requisition = { foreignSource: foreignSource, nodes: [{foreignId: '01'},{foreignId: '02'}] }; function createController() { return controllerFactory('NodeController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource, 'foreignId': foreignId }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getNode = jasmine.createSpy('getNode'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); mockRequisitionsService.getAvailableCategories = jasmine.createSpy('getAvailableCategories'); mockRequisitionsService.getAvailableLocations = jasmine.createSpy('getAvailableLocations'); var nodeDefer = $q.defer(); nodeDefer.resolve(node); mockRequisitionsService.getNode.and.returnValue(nodeDefer.promise); var categoriesDefer = $q.defer(); categoriesDefer.resolve(categories); mockRequisitionsService.getAvailableCategories.and.returnValue(categoriesDefer.promise); var locationsDefer = $q.defer(); locationsDefer.resolve(locations); mockRequisitionsService.getAvailableLocations.and.returnValue(locationsDefer.promise); var reqDefer = $q.defer(); reqDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(reqDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: NodeController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getAvailableCategories).toHaveBeenCalled(); expect(mockRequisitionsService.getNode).toHaveBeenCalledWith(foreignSource, foreignId); expect(scope.foreignSource).toBe(foreignSource); expect(scope.foreignId).toBe(foreignId); expect(scope.availableCategories.length).toBe(4); expect(scope.foreignIdBlackList).toEqual(['01', '02']); expect(scope.getAvailableCategories()).toEqual(categories); scope.node.categories.push({name: 'Production'}); expect(scope.getAvailableCategories()).toEqual(['Testing', 'Server', 'Storage']); expect(scope.availableLocations).toEqual(locations); });
/*global RequisitionNode:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const RequisitionNode = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionNode'); // Initialize testing environment var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}; var foreignSource = 'test-requisition'; var foreignId = '1001'; var categories = ['Production', 'Testing', 'Server', 'Storage']; var locations = ['Default']; var node = new RequisitionNode(foreignSource, { 'foreign-id': foreignId }); var requisition = { foreignSource: foreignSource, nodes: [{foreignId: '01'},{foreignId: '02'}] }; function createController() { return controllerFactory('NodeController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource, 'foreignId': foreignId }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getNode = jasmine.createSpy('getNode'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); mockRequisitionsService.getAvailableCategories = jasmine.createSpy('getAvailableCategories'); mockRequisitionsService.getAvailableLocations = jasmine.createSpy('getAvailableLocations'); var nodeDefer = $q.defer(); nodeDefer.resolve(node); mockRequisitionsService.getNode.and.returnValue(nodeDefer.promise); var categoriesDefer = $q.defer(); categoriesDefer.resolve(categories); mockRequisitionsService.getAvailableCategories.and.returnValue(categoriesDefer.promise); var locationsDefer = $q.defer(); locationsDefer.resolve(locations); mockRequisitionsService.getAvailableLocations.and.returnValue(locationsDefer.promise); var reqDefer = $q.defer(); reqDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(reqDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: NodeController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getAvailableCategories).toHaveBeenCalled(); expect(mockRequisitionsService.getNode).toHaveBeenCalledWith(foreignSource, foreignId); expect(scope.foreignSource).toBe(foreignSource); expect(scope.foreignId).toBe(foreignId); expect(scope.availableCategories.length).toBe(4); expect(scope.foreignIdBlackList).toEqual(['01', '02']); expect(scope.getAvailableCategories()).toEqual(categories); scope.node.categories.push({name: 'Production'}); expect(scope.getAvailableCategories()).toEqual(['Testing', 'Server', 'Storage']); expect(scope.availableLocations).toEqual(locations); });
/*global Requisition:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const Requisition = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/Requisition'); // Initialize testing environment var controllerFactory, scope, $q, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition', requisition = new Requisition(foreignSource); function createController() { return controllerFactory('RequisitionController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); var requisitionDefer = $q.defer(); requisitionDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); });
/*global Requisition:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const Requisition = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/Requisition'); // Initialize testing environment var controllerFactory, scope, $q, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition', requisition = new Requisition(foreignSource); function createController() { return controllerFactory('RequisitionController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); var requisitionDefer = $q.defer(); requisitionDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); });
/*global Requisition:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const Requisition = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/Requisition'); // Initialize testing environment var controllerFactory, scope, $q, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition', requisition = new Requisition(foreignSource); function createController() { return controllerFactory('RequisitionController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); var requisitionDefer = $q.defer(); requisitionDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); });
/*global Requisition:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const Requisition = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/Requisition'); // Initialize testing environment var controllerFactory, scope, $q, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition', requisition = new Requisition(foreignSource); function createController() { return controllerFactory('RequisitionController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); var requisitionDefer = $q.defer(); requisitionDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); });
/*global RequisitionsData:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const OnmsDateFormatter = require('../../../../../src/main/assets/js/apps/onms-date-formatter'); const RequisitionsData = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionsData'); // Initialize testing environment var controllerFactory, scope, $q, dateFormatterService, mockGrowl = {}, mockRequisitionsService = {}, requisitionsData = new RequisitionsData(); function createController() { return controllerFactory('RequisitionsController', { $scope: scope, DateFormatterService: dateFormatterService, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(function() { window._onmsDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssxxx"; window._onmsZoneId = 'America/New_York'; window._onmsFormatter = new OnmsDateFormatter(); }); beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, $interval, _$q_, DateFormatterService) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; dateFormatterService = DateFormatterService; $interval.flush(200); })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisitions = jasmine.createSpy('getRequisitions'); var requisitionsDefer = $q.defer(); requisitionsDefer.resolve(requisitionsData); mockRequisitionsService.getRequisitions.and.returnValue(requisitionsDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionsController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisitions).toHaveBeenCalled(); expect(scope.requisitionsData.requisitions.length).toBe(0); });
/*global RequisitionsData:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const OnmsDateFormatter = require('../../../../../src/main/assets/js/apps/onms-date-formatter'); const RequisitionsData = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionsData'); // Initialize testing environment var controllerFactory, scope, $q, dateFormatterService, mockGrowl = {}, mockRequisitionsService = {}, requisitionsData = new RequisitionsData(); function createController() { return controllerFactory('RequisitionsController', { $scope: scope, DateFormatterService: dateFormatterService, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(function() { window._onmsDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssxxx"; window._onmsZoneId = 'America/New_York'; window._onmsFormatter = new OnmsDateFormatter(); }); beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, $interval, _$q_, DateFormatterService) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; dateFormatterService = DateFormatterService; $interval.flush(200); })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisitions = jasmine.createSpy('getRequisitions'); var requisitionsDefer = $q.defer(); requisitionsDefer.resolve(requisitionsData); mockRequisitionsService.getRequisitions.and.returnValue(requisitionsDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionsController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisitions).toHaveBeenCalled(); expect(scope.requisitionsData.requisitions.length).toBe(0); });
/*global RequisitionsData:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const OnmsDateFormatter = require('../../../../../src/main/assets/js/apps/onms-date-formatter'); const RequisitionsData = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionsData'); // Initialize testing environment var controllerFactory, scope, $q, dateFormatterService, mockGrowl = {}, mockRequisitionsService = {}, requisitionsData = new RequisitionsData(); function createController() { return controllerFactory('RequisitionsController', { $scope: scope, DateFormatterService: dateFormatterService, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(function() { window._onmsDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssxxx"; window._onmsZoneId = 'America/New_York'; window._onmsFormatter = new OnmsDateFormatter(); }); beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, $interval, _$q_, DateFormatterService) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; dateFormatterService = DateFormatterService; $interval.flush(200); })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisitions = jasmine.createSpy('getRequisitions'); var requisitionsDefer = $q.defer(); requisitionsDefer.resolve(requisitionsData); mockRequisitionsService.getRequisitions.and.returnValue(requisitionsDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionsController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisitions).toHaveBeenCalled(); expect(scope.requisitionsData.requisitions.length).toBe(0); });
/*global RequisitionsData:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const OnmsDateFormatter = require('../../../../../src/main/assets/js/apps/onms-date-formatter'); const RequisitionsData = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionsData'); // Initialize testing environment var controllerFactory, scope, $q, dateFormatterService, mockGrowl = {}, mockRequisitionsService = {}, requisitionsData = new RequisitionsData(); function createController() { return controllerFactory('RequisitionsController', { $scope: scope, DateFormatterService: dateFormatterService, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(function() { window._onmsDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssxxx"; window._onmsZoneId = 'America/New_York'; window._onmsFormatter = new OnmsDateFormatter(); }); beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, $interval, _$q_, DateFormatterService) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; dateFormatterService = DateFormatterService; $interval.flush(200); })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisitions = jasmine.createSpy('getRequisitions'); var requisitionsDefer = $q.defer(); requisitionsDefer.resolve(requisitionsData); mockRequisitionsService.getRequisitions.and.returnValue(requisitionsDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionsController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisitions).toHaveBeenCalled(); expect(scope.requisitionsData.requisitions.length).toBe(0); });
const bootbox = require('bootbox'); require('./Requisitions'); /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ (function() { 'use strict'; angular.module('onms-requisitions') /** * @ngdoc service * @name SynchronizeService * @module onms-requisitions * * @requires RequisitionsService The requisitions service * @requires growl The growl plugin for instant notifications * * @description The SynchronizeService provides a way to request a requisition synchronization asking the user how the scan process will be processed. */ .factory('SynchronizeService', ['RequisitionsService', 'growl', function(RequisitionsService, growl) { return { /** * @description Requests the synchronization/import of a requisition on the server * * A dialog box is displayed to request to the user if the scan phase should be triggered or not. * * @name SynchronizeService:synchronize * @ngdoc method * @methodOf SynchronizeService * @param {object} requisition The requisition object * @param {function} successHandler The function to call after a successful synchronization * @param {function} errorHandler The function to call when something went wrong. */ synchronize: function(requisition, errorHandler) { /** * @param {object} requisition The requisition object * @param {string} rescanExisting true to perform a full scan, false to only add/remove nodes without scan, dbonly for all DB operations without scan */ var doSynchronize = function(requisition, rescanExisting) { RequisitionsService.startTiming(); RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then( function() { // success growl.success('The import operation has been started for ' + requisition.foreignSource + ' (rescanExisting? ' + rescanExisting + ')<br/>Use <b>refresh</b> to update the deployed statistics'); requisition.setDeployed(true); }, errorHandler ); }; bootbox.dialog({ message: 'Do you want to rescan existing nodes ?<br/><hr/>' + 'Choose <b>yes</b> to synchronize all the nodes with the database executing the scan phase.<br/>' + 'Choose <b>no</b> to synchronize only the new and deleted nodes with the database executing the scan phase only for new nodes.<br/>' + 'Choose <b>dbonly</b> to synchronize all the nodes with the database skipping the scan phase.<br/>' + 'Choose <b>cancel</b> to abort the request.', title: 'Synchronize Requisition ' + requisition.foreignSource, buttons: { fullSync: { label: 'Yes', className: 'btn-primary', callback: function() { doSynchronize(requisition, 'true'); } }, dbOnlySync: { label: 'DB Only', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'dbonly'); } }, ignoreExistingSync: { label: 'No', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'false'); } }, main: { label: 'Cancel', className: 'btn-secondary' } } }); } }; }]); }());
const bootbox = require('bootbox'); require('./Requisitions'); /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ (function() { 'use strict'; angular.module('onms-requisitions') /** * @ngdoc service * @name SynchronizeService * @module onms-requisitions * * @requires RequisitionsService The requisitions service * @requires growl The growl plugin for instant notifications * * @description The SynchronizeService provides a way to request a requisition synchronization asking the user how the scan process will be processed. */ .factory('SynchronizeService', ['RequisitionsService', 'growl', function(RequisitionsService, growl) { return { /** * @description Requests the synchronization/import of a requisition on the server * * A dialog box is displayed to request to the user if the scan phase should be triggered or not. * * @name SynchronizeService:synchronize * @ngdoc method * @methodOf SynchronizeService * @param {object} requisition The requisition object * @param {function} successHandler The function to call after a successful synchronization * @param {function} errorHandler The function to call when something went wrong. */ synchronize: function(requisition, errorHandler) { /** * @param {object} requisition The requisition object * @param {string} rescanExisting true to perform a full scan, false to only add/remove nodes without scan, dbonly for all DB operations without scan */ var doSynchronize = function(requisition, rescanExisting) { RequisitionsService.startTiming(); RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then( function() { // success growl.success('The import operation has been started for ' + _.escape(requisition.foreignSource) + ' (rescanExisting? ' + rescanExisting + ')<br/>Use <b>refresh</b> to update the deployed statistics'); requisition.setDeployed(true); }, errorHandler ); }; bootbox.dialog({ message: 'Do you want to rescan existing nodes ?<br/><hr/>' + 'Choose <b>yes</b> to synchronize all the nodes with the database executing the scan phase.<br/>' + 'Choose <b>no</b> to synchronize only the new and deleted nodes with the database executing the scan phase only for new nodes.<br/>' + 'Choose <b>dbonly</b> to synchronize all the nodes with the database skipping the scan phase.<br/>' + 'Choose <b>cancel</b> to abort the request.', title: 'Synchronize Requisition ' + _.escape(requisition.foreignSource), buttons: { fullSync: { label: 'Yes', className: 'btn-primary', callback: function() { doSynchronize(requisition, 'true'); } }, dbOnlySync: { label: 'DB Only', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'dbonly'); } }, ignoreExistingSync: { label: 'No', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'false'); } }, main: { label: 'Cancel', className: 'btn-secondary' } } }); } }; }]); }());
const bootbox = require('bootbox'); require('./Requisitions'); /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ (function() { 'use strict'; angular.module('onms-requisitions') /** * @ngdoc service * @name SynchronizeService * @module onms-requisitions * * @requires RequisitionsService The requisitions service * @requires growl The growl plugin for instant notifications * * @description The SynchronizeService provides a way to request a requisition synchronization asking the user how the scan process will be processed. */ .factory('SynchronizeService', ['RequisitionsService', 'growl', function(RequisitionsService, growl) { return { /** * @description Requests the synchronization/import of a requisition on the server * * A dialog box is displayed to request to the user if the scan phase should be triggered or not. * * @name SynchronizeService:synchronize * @ngdoc method * @methodOf SynchronizeService * @param {object} requisition The requisition object * @param {function} successHandler The function to call after a successful synchronization * @param {function} errorHandler The function to call when something went wrong. */ synchronize: function(requisition, errorHandler) { /** * @param {object} requisition The requisition object * @param {string} rescanExisting true to perform a full scan, false to only add/remove nodes without scan, dbonly for all DB operations without scan */ var doSynchronize = function(requisition, rescanExisting) { RequisitionsService.startTiming(); RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then( function() { // success growl.success('The import operation has been started for ' + requisition.foreignSource + ' (rescanExisting? ' + rescanExisting + ')<br/>Use <b>refresh</b> to update the deployed statistics'); requisition.setDeployed(true); }, errorHandler ); }; bootbox.dialog({ message: 'Do you want to rescan existing nodes ?<br/><hr/>' + 'Choose <b>yes</b> to synchronize all the nodes with the database executing the scan phase.<br/>' + 'Choose <b>no</b> to synchronize only the new and deleted nodes with the database executing the scan phase only for new nodes.<br/>' + 'Choose <b>dbonly</b> to synchronize all the nodes with the database skipping the scan phase.<br/>' + 'Choose <b>cancel</b> to abort the request.', title: 'Synchronize Requisition ' + requisition.foreignSource, buttons: { fullSync: { label: 'Yes', className: 'btn-primary', callback: function() { doSynchronize(requisition, 'true'); } }, dbOnlySync: { label: 'DB Only', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'dbonly'); } }, ignoreExistingSync: { label: 'No', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'false'); } }, main: { label: 'Cancel', className: 'btn-secondary' } } }); } }; }]); }());
const bootbox = require('bootbox'); require('./Requisitions'); /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ (function() { 'use strict'; angular.module('onms-requisitions') /** * @ngdoc service * @name SynchronizeService * @module onms-requisitions * * @requires RequisitionsService The requisitions service * @requires growl The growl plugin for instant notifications * * @description The SynchronizeService provides a way to request a requisition synchronization asking the user how the scan process will be processed. */ .factory('SynchronizeService', ['RequisitionsService', 'growl', function(RequisitionsService, growl) { return { /** * @description Requests the synchronization/import of a requisition on the server * * A dialog box is displayed to request to the user if the scan phase should be triggered or not. * * @name SynchronizeService:synchronize * @ngdoc method * @methodOf SynchronizeService * @param {object} requisition The requisition object * @param {function} successHandler The function to call after a successful synchronization * @param {function} errorHandler The function to call when something went wrong. */ synchronize: function(requisition, errorHandler) { /** * @param {object} requisition The requisition object * @param {string} rescanExisting true to perform a full scan, false to only add/remove nodes without scan, dbonly for all DB operations without scan */ var doSynchronize = function(requisition, rescanExisting) { RequisitionsService.startTiming(); RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then( function() { // success growl.success('The import operation has been started for ' + _.escape(requisition.foreignSource) + ' (rescanExisting? ' + rescanExisting + ')<br/>Use <b>refresh</b> to update the deployed statistics'); requisition.setDeployed(true); }, errorHandler ); }; bootbox.dialog({ message: 'Do you want to rescan existing nodes ?<br/><hr/>' + 'Choose <b>yes</b> to synchronize all the nodes with the database executing the scan phase.<br/>' + 'Choose <b>no</b> to synchronize only the new and deleted nodes with the database executing the scan phase only for new nodes.<br/>' + 'Choose <b>dbonly</b> to synchronize all the nodes with the database skipping the scan phase.<br/>' + 'Choose <b>cancel</b> to abort the request.', title: 'Synchronize Requisition ' + _.escape(requisition.foreignSource), buttons: { fullSync: { label: 'Yes', className: 'btn-primary', callback: function() { doSynchronize(requisition, 'true'); } }, dbOnlySync: { label: 'DB Only', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'dbonly'); } }, ignoreExistingSync: { label: 'No', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'false'); } }, main: { label: 'Cancel', className: 'btn-secondary' } } }); } }; }]); }());
const bootbox = require('bootbox'); require('./Requisitions'); /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ (function() { 'use strict'; angular.module('onms-requisitions') /** * @ngdoc service * @name SynchronizeService * @module onms-requisitions * * @requires RequisitionsService The requisitions service * @requires growl The growl plugin for instant notifications * * @description The SynchronizeService provides a way to request a requisition synchronization asking the user how the scan process will be processed. */ .factory('SynchronizeService', ['RequisitionsService', 'growl', function(RequisitionsService, growl) { return { /** * @description Requests the synchronization/import of a requisition on the server * * A dialog box is displayed to request to the user if the scan phase should be triggered or not. * * @name SynchronizeService:synchronize * @ngdoc method * @methodOf SynchronizeService * @param {object} requisition The requisition object * @param {function} successHandler The function to call after a successful synchronization * @param {function} errorHandler The function to call when something went wrong. */ synchronize: function(requisition, errorHandler) { /** * @param {object} requisition The requisition object * @param {string} rescanExisting true to perform a full scan, false to only add/remove nodes without scan, dbonly for all DB operations without scan */ var doSynchronize = function(requisition, rescanExisting) { RequisitionsService.startTiming(); RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then( function() { // success growl.success('The import operation has been started for ' + requisition.foreignSource + ' (rescanExisting? ' + rescanExisting + ')<br/>Use <b>refresh</b> to update the deployed statistics'); requisition.setDeployed(true); }, errorHandler ); }; bootbox.dialog({ message: 'Do you want to rescan existing nodes ?<br/><hr/>' + 'Choose <b>yes</b> to synchronize all the nodes with the database executing the scan phase.<br/>' + 'Choose <b>no</b> to synchronize only the new and deleted nodes with the database executing the scan phase only for new nodes.<br/>' + 'Choose <b>dbonly</b> to synchronize all the nodes with the database skipping the scan phase.<br/>' + 'Choose <b>cancel</b> to abort the request.', title: 'Synchronize Requisition ' + requisition.foreignSource, buttons: { fullSync: { label: 'Yes', className: 'btn-primary', callback: function() { doSynchronize(requisition, 'true'); } }, dbOnlySync: { label: 'DB Only', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'dbonly'); } }, ignoreExistingSync: { label: 'No', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'false'); } }, main: { label: 'Cancel', className: 'btn-secondary' } } }); } }; }]); }());
const bootbox = require('bootbox'); require('./Requisitions'); /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ (function() { 'use strict'; angular.module('onms-requisitions') /** * @ngdoc service * @name SynchronizeService * @module onms-requisitions * * @requires RequisitionsService The requisitions service * @requires growl The growl plugin for instant notifications * * @description The SynchronizeService provides a way to request a requisition synchronization asking the user how the scan process will be processed. */ .factory('SynchronizeService', ['RequisitionsService', 'growl', function(RequisitionsService, growl) { return { /** * @description Requests the synchronization/import of a requisition on the server * * A dialog box is displayed to request to the user if the scan phase should be triggered or not. * * @name SynchronizeService:synchronize * @ngdoc method * @methodOf SynchronizeService * @param {object} requisition The requisition object * @param {function} successHandler The function to call after a successful synchronization * @param {function} errorHandler The function to call when something went wrong. */ synchronize: function(requisition, errorHandler) { /** * @param {object} requisition The requisition object * @param {string} rescanExisting true to perform a full scan, false to only add/remove nodes without scan, dbonly for all DB operations without scan */ var doSynchronize = function(requisition, rescanExisting) { RequisitionsService.startTiming(); RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then( function() { // success growl.success('The import operation has been started for ' + _.escape(requisition.foreignSource) + ' (rescanExisting? ' + rescanExisting + ')<br/>Use <b>refresh</b> to update the deployed statistics'); requisition.setDeployed(true); }, errorHandler ); }; bootbox.dialog({ message: 'Do you want to rescan existing nodes ?<br/><hr/>' + 'Choose <b>yes</b> to synchronize all the nodes with the database executing the scan phase.<br/>' + 'Choose <b>no</b> to synchronize only the new and deleted nodes with the database executing the scan phase only for new nodes.<br/>' + 'Choose <b>dbonly</b> to synchronize all the nodes with the database skipping the scan phase.<br/>' + 'Choose <b>cancel</b> to abort the request.', title: 'Synchronize Requisition ' + _.escape(requisition.foreignSource), buttons: { fullSync: { label: 'Yes', className: 'btn-primary', callback: function() { doSynchronize(requisition, 'true'); } }, dbOnlySync: { label: 'DB Only', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'dbonly'); } }, ignoreExistingSync: { label: 'No', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'false'); } }, main: { label: 'Cancel', className: 'btn-secondary' } } }); } }; }]); }());
const bootbox = require('bootbox'); require('./Requisitions'); /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ (function() { 'use strict'; angular.module('onms-requisitions') /** * @ngdoc service * @name SynchronizeService * @module onms-requisitions * * @requires RequisitionsService The requisitions service * @requires growl The growl plugin for instant notifications * * @description The SynchronizeService provides a way to request a requisition synchronization asking the user how the scan process will be processed. */ .factory('SynchronizeService', ['RequisitionsService', 'growl', function(RequisitionsService, growl) { return { /** * @description Requests the synchronization/import of a requisition on the server * * A dialog box is displayed to request to the user if the scan phase should be triggered or not. * * @name SynchronizeService:synchronize * @ngdoc method * @methodOf SynchronizeService * @param {object} requisition The requisition object * @param {function} successHandler The function to call after a successful synchronization * @param {function} errorHandler The function to call when something went wrong. */ synchronize: function(requisition, errorHandler) { /** * @param {object} requisition The requisition object * @param {string} rescanExisting true to perform a full scan, false to only add/remove nodes without scan, dbonly for all DB operations without scan */ var doSynchronize = function(requisition, rescanExisting) { RequisitionsService.startTiming(); RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then( function() { // success growl.success('The import operation has been started for ' + requisition.foreignSource + ' (rescanExisting? ' + rescanExisting + ')<br/>Use <b>refresh</b> to update the deployed statistics'); requisition.setDeployed(true); }, errorHandler ); }; bootbox.dialog({ message: 'Do you want to rescan existing nodes ?<br/><hr/>' + 'Choose <b>yes</b> to synchronize all the nodes with the database executing the scan phase.<br/>' + 'Choose <b>no</b> to synchronize only the new and deleted nodes with the database executing the scan phase only for new nodes.<br/>' + 'Choose <b>dbonly</b> to synchronize all the nodes with the database skipping the scan phase.<br/>' + 'Choose <b>cancel</b> to abort the request.', title: 'Synchronize Requisition ' + requisition.foreignSource, buttons: { fullSync: { label: 'Yes', className: 'btn-primary', callback: function() { doSynchronize(requisition, 'true'); } }, dbOnlySync: { label: 'DB Only', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'dbonly'); } }, ignoreExistingSync: { label: 'No', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'false'); } }, main: { label: 'Cancel', className: 'btn-secondary' } } }); } }; }]); }());
const bootbox = require('bootbox'); require('./Requisitions'); /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ (function() { 'use strict'; angular.module('onms-requisitions') /** * @ngdoc service * @name SynchronizeService * @module onms-requisitions * * @requires RequisitionsService The requisitions service * @requires growl The growl plugin for instant notifications * * @description The SynchronizeService provides a way to request a requisition synchronization asking the user how the scan process will be processed. */ .factory('SynchronizeService', ['RequisitionsService', 'growl', function(RequisitionsService, growl) { return { /** * @description Requests the synchronization/import of a requisition on the server * * A dialog box is displayed to request to the user if the scan phase should be triggered or not. * * @name SynchronizeService:synchronize * @ngdoc method * @methodOf SynchronizeService * @param {object} requisition The requisition object * @param {function} successHandler The function to call after a successful synchronization * @param {function} errorHandler The function to call when something went wrong. */ synchronize: function(requisition, errorHandler) { /** * @param {object} requisition The requisition object * @param {string} rescanExisting true to perform a full scan, false to only add/remove nodes without scan, dbonly for all DB operations without scan */ var doSynchronize = function(requisition, rescanExisting) { RequisitionsService.startTiming(); RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then( function() { // success growl.success('The import operation has been started for ' + _.escape(requisition.foreignSource) + ' (rescanExisting? ' + rescanExisting + ')<br/>Use <b>refresh</b> to update the deployed statistics'); requisition.setDeployed(true); }, errorHandler ); }; bootbox.dialog({ message: 'Do you want to rescan existing nodes ?<br/><hr/>' + 'Choose <b>yes</b> to synchronize all the nodes with the database executing the scan phase.<br/>' + 'Choose <b>no</b> to synchronize only the new and deleted nodes with the database executing the scan phase only for new nodes.<br/>' + 'Choose <b>dbonly</b> to synchronize all the nodes with the database skipping the scan phase.<br/>' + 'Choose <b>cancel</b> to abort the request.', title: 'Synchronize Requisition ' + _.escape(requisition.foreignSource), buttons: { fullSync: { label: 'Yes', className: 'btn-primary', callback: function() { doSynchronize(requisition, 'true'); } }, dbOnlySync: { label: 'DB Only', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'dbonly'); } }, ignoreExistingSync: { label: 'No', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'false'); } }, main: { label: 'Cancel', className: 'btn-secondary' } } }); } }; }]); }());
const bootbox = require('bootbox'); require('./Requisitions'); /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ (function() { 'use strict'; angular.module('onms-requisitions') /** * @ngdoc service * @name SynchronizeService * @module onms-requisitions * * @requires RequisitionsService The requisitions service * @requires growl The growl plugin for instant notifications * * @description The SynchronizeService provides a way to request a requisition synchronization asking the user how the scan process will be processed. */ .factory('SynchronizeService', ['RequisitionsService', 'growl', function(RequisitionsService, growl) { return { /** * @description Requests the synchronization/import of a requisition on the server * * A dialog box is displayed to request to the user if the scan phase should be triggered or not. * * @name SynchronizeService:synchronize * @ngdoc method * @methodOf SynchronizeService * @param {object} requisition The requisition object * @param {function} successHandler The function to call after a successful synchronization * @param {function} errorHandler The function to call when something went wrong. */ synchronize: function(requisition, errorHandler) { /** * @param {object} requisition The requisition object * @param {string} rescanExisting true to perform a full scan, false to only add/remove nodes without scan, dbonly for all DB operations without scan */ var doSynchronize = function(requisition, rescanExisting) { RequisitionsService.startTiming(); RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then( function() { // success growl.success('The import operation has been started for ' + requisition.foreignSource + ' (rescanExisting? ' + rescanExisting + ')<br/>Use <b>refresh</b> to update the deployed statistics'); requisition.setDeployed(true); }, errorHandler ); }; bootbox.dialog({ message: 'Do you want to rescan existing nodes ?<br/><hr/>' + 'Choose <b>yes</b> to synchronize all the nodes with the database executing the scan phase.<br/>' + 'Choose <b>no</b> to synchronize only the new and deleted nodes with the database executing the scan phase only for new nodes.<br/>' + 'Choose <b>dbonly</b> to synchronize all the nodes with the database skipping the scan phase.<br/>' + 'Choose <b>cancel</b> to abort the request.', title: 'Synchronize Requisition ' + requisition.foreignSource, buttons: { fullSync: { label: 'Yes', className: 'btn-primary', callback: function() { doSynchronize(requisition, 'true'); } }, dbOnlySync: { label: 'DB Only', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'dbonly'); } }, ignoreExistingSync: { label: 'No', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'false'); } }, main: { label: 'Cancel', className: 'btn-secondary' } } }); } }; }]); }());
const bootbox = require('bootbox'); require('./Requisitions'); /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ (function() { 'use strict'; angular.module('onms-requisitions') /** * @ngdoc service * @name SynchronizeService * @module onms-requisitions * * @requires RequisitionsService The requisitions service * @requires growl The growl plugin for instant notifications * * @description The SynchronizeService provides a way to request a requisition synchronization asking the user how the scan process will be processed. */ .factory('SynchronizeService', ['RequisitionsService', 'growl', function(RequisitionsService, growl) { return { /** * @description Requests the synchronization/import of a requisition on the server * * A dialog box is displayed to request to the user if the scan phase should be triggered or not. * * @name SynchronizeService:synchronize * @ngdoc method * @methodOf SynchronizeService * @param {object} requisition The requisition object * @param {function} successHandler The function to call after a successful synchronization * @param {function} errorHandler The function to call when something went wrong. */ synchronize: function(requisition, errorHandler) { /** * @param {object} requisition The requisition object * @param {string} rescanExisting true to perform a full scan, false to only add/remove nodes without scan, dbonly for all DB operations without scan */ var doSynchronize = function(requisition, rescanExisting) { RequisitionsService.startTiming(); RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then( function() { // success growl.success('The import operation has been started for ' + _.escape(requisition.foreignSource) + ' (rescanExisting? ' + rescanExisting + ')<br/>Use <b>refresh</b> to update the deployed statistics'); requisition.setDeployed(true); }, errorHandler ); }; bootbox.dialog({ message: 'Do you want to rescan existing nodes ?<br/><hr/>' + 'Choose <b>yes</b> to synchronize all the nodes with the database executing the scan phase.<br/>' + 'Choose <b>no</b> to synchronize only the new and deleted nodes with the database executing the scan phase only for new nodes.<br/>' + 'Choose <b>dbonly</b> to synchronize all the nodes with the database skipping the scan phase.<br/>' + 'Choose <b>cancel</b> to abort the request.', title: 'Synchronize Requisition ' + _.escape(requisition.foreignSource), buttons: { fullSync: { label: 'Yes', className: 'btn-primary', callback: function() { doSynchronize(requisition, 'true'); } }, dbOnlySync: { label: 'DB Only', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'dbonly'); } }, ignoreExistingSync: { label: 'No', className: 'btn-secondary', callback: function() { doSynchronize(requisition, 'false'); } }, main: { label: 'Cancel', className: 'btn-secondary' } } }); } }; }]); }());
/** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition'; function createController() { return controllerFactory('ForeignSourceController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); $q = _$q_; controllerFactory = $controller; })); beforeEach(function() { mockModal = {}; mockRequisitionsService.getForeignSourceDefinition = jasmine.createSpy('getForeignSourceDefinition'); mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); var requisitionDefer = $q.defer(); requisitionDefer.resolve({ detectors: [{'name':'ICMP'},{'name':'SNMP'}], policies: [{'name':'Foo'},{'name':'Bar'}] }); mockRequisitionsService.getForeignSourceDefinition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: ForeignSourceController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getForeignSourceDefinition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); expect(scope.indexOfDetector({name:'ICMP'})).toBe(0); expect(scope.indexOfPolicy({name:'Foo'})).toBe(0); expect(scope.indexOfDetector({name:'HTTP'})).toBe(-1); expect(scope.indexOfPolicy({name:'Test'})).toBe(-1); });
/** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition'; function createController() { return controllerFactory('ForeignSourceController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); $q = _$q_; controllerFactory = $controller; })); beforeEach(function() { mockModal = {}; mockRequisitionsService.getForeignSourceDefinition = jasmine.createSpy('getForeignSourceDefinition'); mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); var requisitionDefer = $q.defer(); requisitionDefer.resolve({ detectors: [{'name':'ICMP'},{'name':'SNMP'}], policies: [{'name':'Foo'},{'name':'Bar'}] }); mockRequisitionsService.getForeignSourceDefinition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: ForeignSourceController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getForeignSourceDefinition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); expect(scope.indexOfDetector({name:'ICMP'})).toBe(0); expect(scope.indexOfPolicy({name:'Foo'})).toBe(0); expect(scope.indexOfDetector({name:'HTTP'})).toBe(-1); expect(scope.indexOfPolicy({name:'Test'})).toBe(-1); });
/** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition'; function createController() { return controllerFactory('ForeignSourceController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); $q = _$q_; controllerFactory = $controller; })); beforeEach(function() { mockModal = {}; mockRequisitionsService.getForeignSourceDefinition = jasmine.createSpy('getForeignSourceDefinition'); mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); var requisitionDefer = $q.defer(); requisitionDefer.resolve({ detectors: [{'name':'ICMP'},{'name':'SNMP'}], policies: [{'name':'Foo'},{'name':'Bar'}] }); mockRequisitionsService.getForeignSourceDefinition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: ForeignSourceController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getForeignSourceDefinition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); expect(scope.indexOfDetector({name:'ICMP'})).toBe(0); expect(scope.indexOfPolicy({name:'Foo'})).toBe(0); expect(scope.indexOfDetector({name:'HTTP'})).toBe(-1); expect(scope.indexOfPolicy({name:'Test'})).toBe(-1); });
/** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition'; function createController() { return controllerFactory('ForeignSourceController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); $q = _$q_; controllerFactory = $controller; })); beforeEach(function() { mockModal = {}; mockRequisitionsService.getForeignSourceDefinition = jasmine.createSpy('getForeignSourceDefinition'); mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); var requisitionDefer = $q.defer(); requisitionDefer.resolve({ detectors: [{'name':'ICMP'},{'name':'SNMP'}], policies: [{'name':'Foo'},{'name':'Bar'}] }); mockRequisitionsService.getForeignSourceDefinition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: ForeignSourceController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getForeignSourceDefinition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); expect(scope.indexOfDetector({name:'ICMP'})).toBe(0); expect(scope.indexOfPolicy({name:'Foo'})).toBe(0); expect(scope.indexOfDetector({name:'HTTP'})).toBe(-1); expect(scope.indexOfPolicy({name:'Test'})).toBe(-1); });
/** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition'; function createController() { return controllerFactory('ForeignSourceController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); $q = _$q_; controllerFactory = $controller; })); beforeEach(function() { mockModal = {}; mockRequisitionsService.getForeignSourceDefinition = jasmine.createSpy('getForeignSourceDefinition'); mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); var requisitionDefer = $q.defer(); requisitionDefer.resolve({ detectors: [{'name':'ICMP'},{'name':'SNMP'}], policies: [{'name':'Foo'},{'name':'Bar'}] }); mockRequisitionsService.getForeignSourceDefinition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: ForeignSourceController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getForeignSourceDefinition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); expect(scope.indexOfDetector({name:'ICMP'})).toBe(0); expect(scope.indexOfPolicy({name:'Foo'})).toBe(0); expect(scope.indexOfDetector({name:'HTTP'})).toBe(-1); expect(scope.indexOfPolicy({name:'Test'})).toBe(-1); });
/** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition'; function createController() { return controllerFactory('ForeignSourceController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); $q = _$q_; controllerFactory = $controller; })); beforeEach(function() { mockModal = {}; mockRequisitionsService.getForeignSourceDefinition = jasmine.createSpy('getForeignSourceDefinition'); mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); var requisitionDefer = $q.defer(); requisitionDefer.resolve({ detectors: [{'name':'ICMP'},{'name':'SNMP'}], policies: [{'name':'Foo'},{'name':'Bar'}] }); mockRequisitionsService.getForeignSourceDefinition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: ForeignSourceController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getForeignSourceDefinition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); expect(scope.indexOfDetector({name:'ICMP'})).toBe(0); expect(scope.indexOfPolicy({name:'Foo'})).toBe(0); expect(scope.indexOfDetector({name:'HTTP'})).toBe(-1); expect(scope.indexOfPolicy({name:'Test'})).toBe(-1); });
/** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition'; function createController() { return controllerFactory('ForeignSourceController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); $q = _$q_; controllerFactory = $controller; })); beforeEach(function() { mockModal = {}; mockRequisitionsService.getForeignSourceDefinition = jasmine.createSpy('getForeignSourceDefinition'); mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); var requisitionDefer = $q.defer(); requisitionDefer.resolve({ detectors: [{'name':'ICMP'},{'name':'SNMP'}], policies: [{'name':'Foo'},{'name':'Bar'}] }); mockRequisitionsService.getForeignSourceDefinition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: ForeignSourceController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getForeignSourceDefinition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); expect(scope.indexOfDetector({name:'ICMP'})).toBe(0); expect(scope.indexOfPolicy({name:'Foo'})).toBe(0); expect(scope.indexOfDetector({name:'HTTP'})).toBe(-1); expect(scope.indexOfPolicy({name:'Test'})).toBe(-1); });
/** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition'; function createController() { return controllerFactory('ForeignSourceController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); $q = _$q_; controllerFactory = $controller; })); beforeEach(function() { mockModal = {}; mockRequisitionsService.getForeignSourceDefinition = jasmine.createSpy('getForeignSourceDefinition'); mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); var requisitionDefer = $q.defer(); requisitionDefer.resolve({ detectors: [{'name':'ICMP'},{'name':'SNMP'}], policies: [{'name':'Foo'},{'name':'Bar'}] }); mockRequisitionsService.getForeignSourceDefinition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: ForeignSourceController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getForeignSourceDefinition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); expect(scope.indexOfDetector({name:'ICMP'})).toBe(0); expect(scope.indexOfPolicy({name:'Foo'})).toBe(0); expect(scope.indexOfDetector({name:'HTTP'})).toBe(-1); expect(scope.indexOfPolicy({name:'Test'})).toBe(-1); });
/** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition'; function createController() { return controllerFactory('ForeignSourceController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); $q = _$q_; controllerFactory = $controller; })); beforeEach(function() { mockModal = {}; mockRequisitionsService.getForeignSourceDefinition = jasmine.createSpy('getForeignSourceDefinition'); mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); var requisitionDefer = $q.defer(); requisitionDefer.resolve({ detectors: [{'name':'ICMP'},{'name':'SNMP'}], policies: [{'name':'Foo'},{'name':'Bar'}] }); mockRequisitionsService.getForeignSourceDefinition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: ForeignSourceController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getForeignSourceDefinition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); expect(scope.indexOfDetector({name:'ICMP'})).toBe(0); expect(scope.indexOfPolicy({name:'Foo'})).toBe(0); expect(scope.indexOfDetector({name:'HTTP'})).toBe(-1); expect(scope.indexOfPolicy({name:'Test'})).toBe(-1); });
/** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition'; function createController() { return controllerFactory('ForeignSourceController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); $q = _$q_; controllerFactory = $controller; })); beforeEach(function() { mockModal = {}; mockRequisitionsService.getForeignSourceDefinition = jasmine.createSpy('getForeignSourceDefinition'); mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); var requisitionDefer = $q.defer(); requisitionDefer.resolve({ detectors: [{'name':'ICMP'},{'name':'SNMP'}], policies: [{'name':'Foo'},{'name':'Bar'}] }); mockRequisitionsService.getForeignSourceDefinition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: ForeignSourceController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getForeignSourceDefinition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); expect(scope.indexOfDetector({name:'ICMP'})).toBe(0); expect(scope.indexOfPolicy({name:'Foo'})).toBe(0); expect(scope.indexOfDetector({name:'HTTP'})).toBe(-1); expect(scope.indexOfPolicy({name:'Test'})).toBe(-1); });
/*global RequisitionNode:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const RequisitionNode = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionNode'); // Initialize testing environment var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}; var foreignSource = 'test-requisition'; var foreignId = '1001'; var categories = ['Production', 'Testing', 'Server', 'Storage']; var locations = ['Default']; var node = new RequisitionNode(foreignSource, { 'foreign-id': foreignId }); var requisition = { foreignSource: foreignSource, nodes: [{foreignId: '01'},{foreignId: '02'}] }; function createController() { return controllerFactory('NodeController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource, 'foreignId': foreignId }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getNode = jasmine.createSpy('getNode'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); mockRequisitionsService.getAvailableCategories = jasmine.createSpy('getAvailableCategories'); mockRequisitionsService.getAvailableLocations = jasmine.createSpy('getAvailableLocations'); var nodeDefer = $q.defer(); nodeDefer.resolve(node); mockRequisitionsService.getNode.and.returnValue(nodeDefer.promise); var categoriesDefer = $q.defer(); categoriesDefer.resolve(categories); mockRequisitionsService.getAvailableCategories.and.returnValue(categoriesDefer.promise); var locationsDefer = $q.defer(); locationsDefer.resolve(locations); mockRequisitionsService.getAvailableLocations.and.returnValue(locationsDefer.promise); var reqDefer = $q.defer(); reqDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(reqDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: NodeController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getAvailableCategories).toHaveBeenCalled(); expect(mockRequisitionsService.getNode).toHaveBeenCalledWith(foreignSource, foreignId); expect(scope.foreignSource).toBe(foreignSource); expect(scope.foreignId).toBe(foreignId); expect(scope.availableCategories.length).toBe(4); expect(scope.foreignIdBlackList).toEqual(['01', '02']); expect(scope.getAvailableCategories()).toEqual(categories); scope.node.categories.push({name: 'Production'}); expect(scope.getAvailableCategories()).toEqual(['Testing', 'Server', 'Storage']); expect(scope.availableLocations).toEqual(locations); });
/*global RequisitionNode:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const RequisitionNode = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionNode'); // Initialize testing environment var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}; var foreignSource = 'test-requisition'; var foreignId = '1001'; var categories = ['Production', 'Testing', 'Server', 'Storage']; var locations = ['Default']; var node = new RequisitionNode(foreignSource, { 'foreign-id': foreignId }); var requisition = { foreignSource: foreignSource, nodes: [{foreignId: '01'},{foreignId: '02'}] }; function createController() { return controllerFactory('NodeController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource, 'foreignId': foreignId }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getNode = jasmine.createSpy('getNode'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); mockRequisitionsService.getAvailableCategories = jasmine.createSpy('getAvailableCategories'); mockRequisitionsService.getAvailableLocations = jasmine.createSpy('getAvailableLocations'); var nodeDefer = $q.defer(); nodeDefer.resolve(node); mockRequisitionsService.getNode.and.returnValue(nodeDefer.promise); var categoriesDefer = $q.defer(); categoriesDefer.resolve(categories); mockRequisitionsService.getAvailableCategories.and.returnValue(categoriesDefer.promise); var locationsDefer = $q.defer(); locationsDefer.resolve(locations); mockRequisitionsService.getAvailableLocations.and.returnValue(locationsDefer.promise); var reqDefer = $q.defer(); reqDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(reqDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: NodeController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getAvailableCategories).toHaveBeenCalled(); expect(mockRequisitionsService.getNode).toHaveBeenCalledWith(foreignSource, foreignId); expect(scope.foreignSource).toBe(foreignSource); expect(scope.foreignId).toBe(foreignId); expect(scope.availableCategories.length).toBe(4); expect(scope.foreignIdBlackList).toEqual(['01', '02']); expect(scope.getAvailableCategories()).toEqual(categories); scope.node.categories.push({name: 'Production'}); expect(scope.getAvailableCategories()).toEqual(['Testing', 'Server', 'Storage']); expect(scope.availableLocations).toEqual(locations); });
/*global RequisitionNode:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const RequisitionNode = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionNode'); // Initialize testing environment var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}; var foreignSource = 'test-requisition'; var foreignId = '1001'; var categories = ['Production', 'Testing', 'Server', 'Storage']; var locations = ['Default']; var node = new RequisitionNode(foreignSource, { 'foreign-id': foreignId }); var requisition = { foreignSource: foreignSource, nodes: [{foreignId: '01'},{foreignId: '02'}] }; function createController() { return controllerFactory('NodeController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource, 'foreignId': foreignId }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getNode = jasmine.createSpy('getNode'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); mockRequisitionsService.getAvailableCategories = jasmine.createSpy('getAvailableCategories'); mockRequisitionsService.getAvailableLocations = jasmine.createSpy('getAvailableLocations'); var nodeDefer = $q.defer(); nodeDefer.resolve(node); mockRequisitionsService.getNode.and.returnValue(nodeDefer.promise); var categoriesDefer = $q.defer(); categoriesDefer.resolve(categories); mockRequisitionsService.getAvailableCategories.and.returnValue(categoriesDefer.promise); var locationsDefer = $q.defer(); locationsDefer.resolve(locations); mockRequisitionsService.getAvailableLocations.and.returnValue(locationsDefer.promise); var reqDefer = $q.defer(); reqDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(reqDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: NodeController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getAvailableCategories).toHaveBeenCalled(); expect(mockRequisitionsService.getNode).toHaveBeenCalledWith(foreignSource, foreignId); expect(scope.foreignSource).toBe(foreignSource); expect(scope.foreignId).toBe(foreignId); expect(scope.availableCategories.length).toBe(4); expect(scope.foreignIdBlackList).toEqual(['01', '02']); expect(scope.getAvailableCategories()).toEqual(categories); scope.node.categories.push({name: 'Production'}); expect(scope.getAvailableCategories()).toEqual(['Testing', 'Server', 'Storage']); expect(scope.availableLocations).toEqual(locations); });
/*global RequisitionNode:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const RequisitionNode = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionNode'); // Initialize testing environment var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}; var foreignSource = 'test-requisition'; var foreignId = '1001'; var categories = ['Production', 'Testing', 'Server', 'Storage']; var locations = ['Default']; var node = new RequisitionNode(foreignSource, { 'foreign-id': foreignId }); var requisition = { foreignSource: foreignSource, nodes: [{foreignId: '01'},{foreignId: '02'}] }; function createController() { return controllerFactory('NodeController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource, 'foreignId': foreignId }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getNode = jasmine.createSpy('getNode'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); mockRequisitionsService.getAvailableCategories = jasmine.createSpy('getAvailableCategories'); mockRequisitionsService.getAvailableLocations = jasmine.createSpy('getAvailableLocations'); var nodeDefer = $q.defer(); nodeDefer.resolve(node); mockRequisitionsService.getNode.and.returnValue(nodeDefer.promise); var categoriesDefer = $q.defer(); categoriesDefer.resolve(categories); mockRequisitionsService.getAvailableCategories.and.returnValue(categoriesDefer.promise); var locationsDefer = $q.defer(); locationsDefer.resolve(locations); mockRequisitionsService.getAvailableLocations.and.returnValue(locationsDefer.promise); var reqDefer = $q.defer(); reqDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(reqDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: NodeController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getAvailableCategories).toHaveBeenCalled(); expect(mockRequisitionsService.getNode).toHaveBeenCalledWith(foreignSource, foreignId); expect(scope.foreignSource).toBe(foreignSource); expect(scope.foreignId).toBe(foreignId); expect(scope.availableCategories.length).toBe(4); expect(scope.foreignIdBlackList).toEqual(['01', '02']); expect(scope.getAvailableCategories()).toEqual(categories); scope.node.categories.push({name: 'Production'}); expect(scope.getAvailableCategories()).toEqual(['Testing', 'Server', 'Storage']); expect(scope.availableLocations).toEqual(locations); });
/*global RequisitionNode:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const RequisitionNode = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionNode'); // Initialize testing environment var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}; var foreignSource = 'test-requisition'; var foreignId = '1001'; var categories = ['Production', 'Testing', 'Server', 'Storage']; var locations = ['Default']; var node = new RequisitionNode(foreignSource, { 'foreign-id': foreignId }); var requisition = { foreignSource: foreignSource, nodes: [{foreignId: '01'},{foreignId: '02'}] }; function createController() { return controllerFactory('NodeController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource, 'foreignId': foreignId }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getNode = jasmine.createSpy('getNode'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); mockRequisitionsService.getAvailableCategories = jasmine.createSpy('getAvailableCategories'); mockRequisitionsService.getAvailableLocations = jasmine.createSpy('getAvailableLocations'); var nodeDefer = $q.defer(); nodeDefer.resolve(node); mockRequisitionsService.getNode.and.returnValue(nodeDefer.promise); var categoriesDefer = $q.defer(); categoriesDefer.resolve(categories); mockRequisitionsService.getAvailableCategories.and.returnValue(categoriesDefer.promise); var locationsDefer = $q.defer(); locationsDefer.resolve(locations); mockRequisitionsService.getAvailableLocations.and.returnValue(locationsDefer.promise); var reqDefer = $q.defer(); reqDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(reqDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: NodeController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getAvailableCategories).toHaveBeenCalled(); expect(mockRequisitionsService.getNode).toHaveBeenCalledWith(foreignSource, foreignId); expect(scope.foreignSource).toBe(foreignSource); expect(scope.foreignId).toBe(foreignId); expect(scope.availableCategories.length).toBe(4); expect(scope.foreignIdBlackList).toEqual(['01', '02']); expect(scope.getAvailableCategories()).toEqual(categories); scope.node.categories.push({name: 'Production'}); expect(scope.getAvailableCategories()).toEqual(['Testing', 'Server', 'Storage']); expect(scope.availableLocations).toEqual(locations); });
/*global RequisitionNode:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const RequisitionNode = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionNode'); // Initialize testing environment var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}; var foreignSource = 'test-requisition'; var foreignId = '1001'; var categories = ['Production', 'Testing', 'Server', 'Storage']; var locations = ['Default']; var node = new RequisitionNode(foreignSource, { 'foreign-id': foreignId }); var requisition = { foreignSource: foreignSource, nodes: [{foreignId: '01'},{foreignId: '02'}] }; function createController() { return controllerFactory('NodeController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource, 'foreignId': foreignId }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getNode = jasmine.createSpy('getNode'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); mockRequisitionsService.getAvailableCategories = jasmine.createSpy('getAvailableCategories'); mockRequisitionsService.getAvailableLocations = jasmine.createSpy('getAvailableLocations'); var nodeDefer = $q.defer(); nodeDefer.resolve(node); mockRequisitionsService.getNode.and.returnValue(nodeDefer.promise); var categoriesDefer = $q.defer(); categoriesDefer.resolve(categories); mockRequisitionsService.getAvailableCategories.and.returnValue(categoriesDefer.promise); var locationsDefer = $q.defer(); locationsDefer.resolve(locations); mockRequisitionsService.getAvailableLocations.and.returnValue(locationsDefer.promise); var reqDefer = $q.defer(); reqDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(reqDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: NodeController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getAvailableCategories).toHaveBeenCalled(); expect(mockRequisitionsService.getNode).toHaveBeenCalledWith(foreignSource, foreignId); expect(scope.foreignSource).toBe(foreignSource); expect(scope.foreignId).toBe(foreignId); expect(scope.availableCategories.length).toBe(4); expect(scope.foreignIdBlackList).toEqual(['01', '02']); expect(scope.getAvailableCategories()).toEqual(categories); scope.node.categories.push({name: 'Production'}); expect(scope.getAvailableCategories()).toEqual(['Testing', 'Server', 'Storage']); expect(scope.availableLocations).toEqual(locations); });
/*global RequisitionNode:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const RequisitionNode = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionNode'); // Initialize testing environment var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}; var foreignSource = 'test-requisition'; var foreignId = '1001'; var categories = ['Production', 'Testing', 'Server', 'Storage']; var locations = ['Default']; var node = new RequisitionNode(foreignSource, { 'foreign-id': foreignId }); var requisition = { foreignSource: foreignSource, nodes: [{foreignId: '01'},{foreignId: '02'}] }; function createController() { return controllerFactory('NodeController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource, 'foreignId': foreignId }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getNode = jasmine.createSpy('getNode'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); mockRequisitionsService.getAvailableCategories = jasmine.createSpy('getAvailableCategories'); mockRequisitionsService.getAvailableLocations = jasmine.createSpy('getAvailableLocations'); var nodeDefer = $q.defer(); nodeDefer.resolve(node); mockRequisitionsService.getNode.and.returnValue(nodeDefer.promise); var categoriesDefer = $q.defer(); categoriesDefer.resolve(categories); mockRequisitionsService.getAvailableCategories.and.returnValue(categoriesDefer.promise); var locationsDefer = $q.defer(); locationsDefer.resolve(locations); mockRequisitionsService.getAvailableLocations.and.returnValue(locationsDefer.promise); var reqDefer = $q.defer(); reqDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(reqDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: NodeController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getAvailableCategories).toHaveBeenCalled(); expect(mockRequisitionsService.getNode).toHaveBeenCalledWith(foreignSource, foreignId); expect(scope.foreignSource).toBe(foreignSource); expect(scope.foreignId).toBe(foreignId); expect(scope.availableCategories.length).toBe(4); expect(scope.foreignIdBlackList).toEqual(['01', '02']); expect(scope.getAvailableCategories()).toEqual(categories); scope.node.categories.push({name: 'Production'}); expect(scope.getAvailableCategories()).toEqual(['Testing', 'Server', 'Storage']); expect(scope.availableLocations).toEqual(locations); });
/*global RequisitionNode:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const RequisitionNode = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionNode'); // Initialize testing environment var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}; var foreignSource = 'test-requisition'; var foreignId = '1001'; var categories = ['Production', 'Testing', 'Server', 'Storage']; var locations = ['Default']; var node = new RequisitionNode(foreignSource, { 'foreign-id': foreignId }); var requisition = { foreignSource: foreignSource, nodes: [{foreignId: '01'},{foreignId: '02'}] }; function createController() { return controllerFactory('NodeController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource, 'foreignId': foreignId }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getNode = jasmine.createSpy('getNode'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); mockRequisitionsService.getAvailableCategories = jasmine.createSpy('getAvailableCategories'); mockRequisitionsService.getAvailableLocations = jasmine.createSpy('getAvailableLocations'); var nodeDefer = $q.defer(); nodeDefer.resolve(node); mockRequisitionsService.getNode.and.returnValue(nodeDefer.promise); var categoriesDefer = $q.defer(); categoriesDefer.resolve(categories); mockRequisitionsService.getAvailableCategories.and.returnValue(categoriesDefer.promise); var locationsDefer = $q.defer(); locationsDefer.resolve(locations); mockRequisitionsService.getAvailableLocations.and.returnValue(locationsDefer.promise); var reqDefer = $q.defer(); reqDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(reqDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: NodeController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getAvailableCategories).toHaveBeenCalled(); expect(mockRequisitionsService.getNode).toHaveBeenCalledWith(foreignSource, foreignId); expect(scope.foreignSource).toBe(foreignSource); expect(scope.foreignId).toBe(foreignId); expect(scope.availableCategories.length).toBe(4); expect(scope.foreignIdBlackList).toEqual(['01', '02']); expect(scope.getAvailableCategories()).toEqual(categories); scope.node.categories.push({name: 'Production'}); expect(scope.getAvailableCategories()).toEqual(['Testing', 'Server', 'Storage']); expect(scope.availableLocations).toEqual(locations); });
/*global RequisitionNode:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const RequisitionNode = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionNode'); // Initialize testing environment var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}; var foreignSource = 'test-requisition'; var foreignId = '1001'; var categories = ['Production', 'Testing', 'Server', 'Storage']; var locations = ['Default']; var node = new RequisitionNode(foreignSource, { 'foreign-id': foreignId }); var requisition = { foreignSource: foreignSource, nodes: [{foreignId: '01'},{foreignId: '02'}] }; function createController() { return controllerFactory('NodeController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource, 'foreignId': foreignId }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getNode = jasmine.createSpy('getNode'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); mockRequisitionsService.getAvailableCategories = jasmine.createSpy('getAvailableCategories'); mockRequisitionsService.getAvailableLocations = jasmine.createSpy('getAvailableLocations'); var nodeDefer = $q.defer(); nodeDefer.resolve(node); mockRequisitionsService.getNode.and.returnValue(nodeDefer.promise); var categoriesDefer = $q.defer(); categoriesDefer.resolve(categories); mockRequisitionsService.getAvailableCategories.and.returnValue(categoriesDefer.promise); var locationsDefer = $q.defer(); locationsDefer.resolve(locations); mockRequisitionsService.getAvailableLocations.and.returnValue(locationsDefer.promise); var reqDefer = $q.defer(); reqDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(reqDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: NodeController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getAvailableCategories).toHaveBeenCalled(); expect(mockRequisitionsService.getNode).toHaveBeenCalledWith(foreignSource, foreignId); expect(scope.foreignSource).toBe(foreignSource); expect(scope.foreignId).toBe(foreignId); expect(scope.availableCategories.length).toBe(4); expect(scope.foreignIdBlackList).toEqual(['01', '02']); expect(scope.getAvailableCategories()).toEqual(categories); scope.node.categories.push({name: 'Production'}); expect(scope.getAvailableCategories()).toEqual(['Testing', 'Server', 'Storage']); expect(scope.availableLocations).toEqual(locations); });
/*global RequisitionNode:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const RequisitionNode = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionNode'); // Initialize testing environment var controllerFactory, scope, $q, mockModal = {}, mockGrowl = {}, mockRequisitionsService = {}; var foreignSource = 'test-requisition'; var foreignId = '1001'; var categories = ['Production', 'Testing', 'Server', 'Storage']; var locations = ['Default']; var node = new RequisitionNode(foreignSource, { 'foreign-id': foreignId }); var requisition = { foreignSource: foreignSource, nodes: [{foreignId: '01'},{foreignId: '02'}] }; function createController() { return controllerFactory('NodeController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource, 'foreignId': foreignId }, $modal: mockModal, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getNode = jasmine.createSpy('getNode'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); mockRequisitionsService.getAvailableCategories = jasmine.createSpy('getAvailableCategories'); mockRequisitionsService.getAvailableLocations = jasmine.createSpy('getAvailableLocations'); var nodeDefer = $q.defer(); nodeDefer.resolve(node); mockRequisitionsService.getNode.and.returnValue(nodeDefer.promise); var categoriesDefer = $q.defer(); categoriesDefer.resolve(categories); mockRequisitionsService.getAvailableCategories.and.returnValue(categoriesDefer.promise); var locationsDefer = $q.defer(); locationsDefer.resolve(locations); mockRequisitionsService.getAvailableLocations.and.returnValue(locationsDefer.promise); var reqDefer = $q.defer(); reqDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(reqDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: NodeController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getAvailableCategories).toHaveBeenCalled(); expect(mockRequisitionsService.getNode).toHaveBeenCalledWith(foreignSource, foreignId); expect(scope.foreignSource).toBe(foreignSource); expect(scope.foreignId).toBe(foreignId); expect(scope.availableCategories.length).toBe(4); expect(scope.foreignIdBlackList).toEqual(['01', '02']); expect(scope.getAvailableCategories()).toEqual(categories); scope.node.categories.push({name: 'Production'}); expect(scope.getAvailableCategories()).toEqual(['Testing', 'Server', 'Storage']); expect(scope.availableLocations).toEqual(locations); });
/*global Requisition:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const Requisition = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/Requisition'); // Initialize testing environment var controllerFactory, scope, $q, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition', requisition = new Requisition(foreignSource); function createController() { return controllerFactory('RequisitionController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); var requisitionDefer = $q.defer(); requisitionDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); });
/*global Requisition:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const Requisition = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/Requisition'); // Initialize testing environment var controllerFactory, scope, $q, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition', requisition = new Requisition(foreignSource); function createController() { return controllerFactory('RequisitionController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); var requisitionDefer = $q.defer(); requisitionDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); });
/*global Requisition:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const Requisition = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/Requisition'); // Initialize testing environment var controllerFactory, scope, $q, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition', requisition = new Requisition(foreignSource); function createController() { return controllerFactory('RequisitionController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); var requisitionDefer = $q.defer(); requisitionDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); });
/*global Requisition:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const Requisition = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/Requisition'); // Initialize testing environment var controllerFactory, scope, $q, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition', requisition = new Requisition(foreignSource); function createController() { return controllerFactory('RequisitionController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); var requisitionDefer = $q.defer(); requisitionDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); });
/*global Requisition:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const Requisition = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/Requisition'); // Initialize testing environment var controllerFactory, scope, $q, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition', requisition = new Requisition(foreignSource); function createController() { return controllerFactory('RequisitionController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); var requisitionDefer = $q.defer(); requisitionDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); });
/*global Requisition:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const Requisition = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/Requisition'); // Initialize testing environment var controllerFactory, scope, $q, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition', requisition = new Requisition(foreignSource); function createController() { return controllerFactory('RequisitionController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); var requisitionDefer = $q.defer(); requisitionDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); });
/*global Requisition:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const Requisition = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/Requisition'); // Initialize testing environment var controllerFactory, scope, $q, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition', requisition = new Requisition(foreignSource); function createController() { return controllerFactory('RequisitionController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); var requisitionDefer = $q.defer(); requisitionDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); });
/*global Requisition:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const Requisition = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/Requisition'); // Initialize testing environment var controllerFactory, scope, $q, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition', requisition = new Requisition(foreignSource); function createController() { return controllerFactory('RequisitionController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); var requisitionDefer = $q.defer(); requisitionDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); });
/*global Requisition:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const Requisition = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/Requisition'); // Initialize testing environment var controllerFactory, scope, $q, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition', requisition = new Requisition(foreignSource); function createController() { return controllerFactory('RequisitionController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); var requisitionDefer = $q.defer(); requisitionDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); });
/*global Requisition:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const Requisition = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/Requisition'); // Initialize testing environment var controllerFactory, scope, $q, mockGrowl = {}, mockRequisitionsService = {}, foreignSource = 'test-requisition', requisition = new Requisition(foreignSource); function createController() { return controllerFactory('RequisitionController', { $scope: scope, $routeParams: { 'foreignSource': foreignSource }, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, _$q_) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisition = jasmine.createSpy('getRequisition'); var requisitionDefer = $q.defer(); requisitionDefer.resolve(requisition); mockRequisitionsService.getRequisition.and.returnValue(requisitionDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisition).toHaveBeenCalledWith(foreignSource); expect(scope.foreignSource).toBe(foreignSource); });
/*global RequisitionsData:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const OnmsDateFormatter = require('../../../../../src/main/assets/js/apps/onms-date-formatter'); const RequisitionsData = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionsData'); // Initialize testing environment var controllerFactory, scope, $q, dateFormatterService, mockGrowl = {}, mockRequisitionsService = {}, requisitionsData = new RequisitionsData(); function createController() { return controllerFactory('RequisitionsController', { $scope: scope, DateFormatterService: dateFormatterService, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(function() { window._onmsDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssxxx"; window._onmsZoneId = 'America/New_York'; window._onmsFormatter = new OnmsDateFormatter(); }); beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, $interval, _$q_, DateFormatterService) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; dateFormatterService = DateFormatterService; $interval.flush(200); })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisitions = jasmine.createSpy('getRequisitions'); var requisitionsDefer = $q.defer(); requisitionsDefer.resolve(requisitionsData); mockRequisitionsService.getRequisitions.and.returnValue(requisitionsDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionsController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisitions).toHaveBeenCalled(); expect(scope.requisitionsData.requisitions.length).toBe(0); });
/*global RequisitionsData:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const OnmsDateFormatter = require('../../../../../src/main/assets/js/apps/onms-date-formatter'); const RequisitionsData = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionsData'); // Initialize testing environment var controllerFactory, scope, $q, dateFormatterService, mockGrowl = {}, mockRequisitionsService = {}, requisitionsData = new RequisitionsData(); function createController() { return controllerFactory('RequisitionsController', { $scope: scope, DateFormatterService: dateFormatterService, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(function() { window._onmsDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssxxx"; window._onmsZoneId = 'America/New_York'; window._onmsFormatter = new OnmsDateFormatter(); }); beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, $interval, _$q_, DateFormatterService) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; dateFormatterService = DateFormatterService; $interval.flush(200); })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisitions = jasmine.createSpy('getRequisitions'); var requisitionsDefer = $q.defer(); requisitionsDefer.resolve(requisitionsData); mockRequisitionsService.getRequisitions.and.returnValue(requisitionsDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionsController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisitions).toHaveBeenCalled(); expect(scope.requisitionsData.requisitions.length).toBe(0); });
/*global RequisitionsData:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const OnmsDateFormatter = require('../../../../../src/main/assets/js/apps/onms-date-formatter'); const RequisitionsData = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionsData'); // Initialize testing environment var controllerFactory, scope, $q, dateFormatterService, mockGrowl = {}, mockRequisitionsService = {}, requisitionsData = new RequisitionsData(); function createController() { return controllerFactory('RequisitionsController', { $scope: scope, DateFormatterService: dateFormatterService, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(function() { window._onmsDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssxxx"; window._onmsZoneId = 'America/New_York'; window._onmsFormatter = new OnmsDateFormatter(); }); beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, $interval, _$q_, DateFormatterService) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; dateFormatterService = DateFormatterService; $interval.flush(200); })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisitions = jasmine.createSpy('getRequisitions'); var requisitionsDefer = $q.defer(); requisitionsDefer.resolve(requisitionsData); mockRequisitionsService.getRequisitions.and.returnValue(requisitionsDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionsController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisitions).toHaveBeenCalled(); expect(scope.requisitionsData.requisitions.length).toBe(0); });
/*global RequisitionsData:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const OnmsDateFormatter = require('../../../../../src/main/assets/js/apps/onms-date-formatter'); const RequisitionsData = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionsData'); // Initialize testing environment var controllerFactory, scope, $q, dateFormatterService, mockGrowl = {}, mockRequisitionsService = {}, requisitionsData = new RequisitionsData(); function createController() { return controllerFactory('RequisitionsController', { $scope: scope, DateFormatterService: dateFormatterService, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(function() { window._onmsDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssxxx"; window._onmsZoneId = 'America/New_York'; window._onmsFormatter = new OnmsDateFormatter(); }); beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, $interval, _$q_, DateFormatterService) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; dateFormatterService = DateFormatterService; $interval.flush(200); })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisitions = jasmine.createSpy('getRequisitions'); var requisitionsDefer = $q.defer(); requisitionsDefer.resolve(requisitionsData); mockRequisitionsService.getRequisitions.and.returnValue(requisitionsDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionsController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisitions).toHaveBeenCalled(); expect(scope.requisitionsData.requisitions.length).toBe(0); });
/*global RequisitionsData:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const OnmsDateFormatter = require('../../../../../src/main/assets/js/apps/onms-date-formatter'); const RequisitionsData = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionsData'); // Initialize testing environment var controllerFactory, scope, $q, dateFormatterService, mockGrowl = {}, mockRequisitionsService = {}, requisitionsData = new RequisitionsData(); function createController() { return controllerFactory('RequisitionsController', { $scope: scope, DateFormatterService: dateFormatterService, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(function() { window._onmsDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssxxx"; window._onmsZoneId = 'America/New_York'; window._onmsFormatter = new OnmsDateFormatter(); }); beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, $interval, _$q_, DateFormatterService) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; dateFormatterService = DateFormatterService; $interval.flush(200); })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisitions = jasmine.createSpy('getRequisitions'); var requisitionsDefer = $q.defer(); requisitionsDefer.resolve(requisitionsData); mockRequisitionsService.getRequisitions.and.returnValue(requisitionsDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionsController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisitions).toHaveBeenCalled(); expect(scope.requisitionsData.requisitions.length).toBe(0); });
/*global RequisitionsData:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const OnmsDateFormatter = require('../../../../../src/main/assets/js/apps/onms-date-formatter'); const RequisitionsData = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionsData'); // Initialize testing environment var controllerFactory, scope, $q, dateFormatterService, mockGrowl = {}, mockRequisitionsService = {}, requisitionsData = new RequisitionsData(); function createController() { return controllerFactory('RequisitionsController', { $scope: scope, DateFormatterService: dateFormatterService, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(function() { window._onmsDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssxxx"; window._onmsZoneId = 'America/New_York'; window._onmsFormatter = new OnmsDateFormatter(); }); beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, $interval, _$q_, DateFormatterService) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; dateFormatterService = DateFormatterService; $interval.flush(200); })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisitions = jasmine.createSpy('getRequisitions'); var requisitionsDefer = $q.defer(); requisitionsDefer.resolve(requisitionsData); mockRequisitionsService.getRequisitions.and.returnValue(requisitionsDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionsController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisitions).toHaveBeenCalled(); expect(scope.requisitionsData.requisitions.length).toBe(0); });
/*global RequisitionsData:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const OnmsDateFormatter = require('../../../../../src/main/assets/js/apps/onms-date-formatter'); const RequisitionsData = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionsData'); // Initialize testing environment var controllerFactory, scope, $q, dateFormatterService, mockGrowl = {}, mockRequisitionsService = {}, requisitionsData = new RequisitionsData(); function createController() { return controllerFactory('RequisitionsController', { $scope: scope, DateFormatterService: dateFormatterService, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(function() { window._onmsDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssxxx"; window._onmsZoneId = 'America/New_York'; window._onmsFormatter = new OnmsDateFormatter(); }); beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, $interval, _$q_, DateFormatterService) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; dateFormatterService = DateFormatterService; $interval.flush(200); })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisitions = jasmine.createSpy('getRequisitions'); var requisitionsDefer = $q.defer(); requisitionsDefer.resolve(requisitionsData); mockRequisitionsService.getRequisitions.and.returnValue(requisitionsDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionsController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisitions).toHaveBeenCalled(); expect(scope.requisitionsData.requisitions.length).toBe(0); });
/*global RequisitionsData:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const OnmsDateFormatter = require('../../../../../src/main/assets/js/apps/onms-date-formatter'); const RequisitionsData = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionsData'); // Initialize testing environment var controllerFactory, scope, $q, dateFormatterService, mockGrowl = {}, mockRequisitionsService = {}, requisitionsData = new RequisitionsData(); function createController() { return controllerFactory('RequisitionsController', { $scope: scope, DateFormatterService: dateFormatterService, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(function() { window._onmsDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssxxx"; window._onmsZoneId = 'America/New_York'; window._onmsFormatter = new OnmsDateFormatter(); }); beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, $interval, _$q_, DateFormatterService) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; dateFormatterService = DateFormatterService; $interval.flush(200); })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisitions = jasmine.createSpy('getRequisitions'); var requisitionsDefer = $q.defer(); requisitionsDefer.resolve(requisitionsData); mockRequisitionsService.getRequisitions.and.returnValue(requisitionsDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionsController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisitions).toHaveBeenCalled(); expect(scope.requisitionsData.requisitions.length).toBe(0); });
/*global RequisitionsData:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const OnmsDateFormatter = require('../../../../../src/main/assets/js/apps/onms-date-formatter'); const RequisitionsData = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionsData'); // Initialize testing environment var controllerFactory, scope, $q, dateFormatterService, mockGrowl = {}, mockRequisitionsService = {}, requisitionsData = new RequisitionsData(); function createController() { return controllerFactory('RequisitionsController', { $scope: scope, DateFormatterService: dateFormatterService, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(function() { window._onmsDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssxxx"; window._onmsZoneId = 'America/New_York'; window._onmsFormatter = new OnmsDateFormatter(); }); beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, $interval, _$q_, DateFormatterService) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; dateFormatterService = DateFormatterService; $interval.flush(200); })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisitions = jasmine.createSpy('getRequisitions'); var requisitionsDefer = $q.defer(); requisitionsDefer.resolve(requisitionsData); mockRequisitionsService.getRequisitions.and.returnValue(requisitionsDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionsController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisitions).toHaveBeenCalled(); expect(scope.requisitionsData.requisitions.length).toBe(0); });
/*global RequisitionsData:true */ /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ 'use strict'; const angular = require('angular-js'); const _ = require('underscore-js'); require('angular-mocks'); require('../../../../../src/main/assets/js/apps/onms-requisitions/requisitions'); const OnmsDateFormatter = require('../../../../../src/main/assets/js/apps/onms-date-formatter'); const RequisitionsData = require('../../../../../src/main/assets/js/apps/onms-requisitions/lib/scripts/model/RequisitionsData'); // Initialize testing environment var controllerFactory, scope, $q, dateFormatterService, mockGrowl = {}, mockRequisitionsService = {}, requisitionsData = new RequisitionsData(); function createController() { return controllerFactory('RequisitionsController', { $scope: scope, DateFormatterService: dateFormatterService, RequisitionsService: mockRequisitionsService, growl: mockGrowl }); } beforeEach(function() { window._onmsDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssxxx"; window._onmsZoneId = 'America/New_York'; window._onmsFormatter = new OnmsDateFormatter(); }); beforeEach(angular.mock.module('onms-requisitions', function($provide) { console.debug = console.log; $provide.value('$log', console); })); beforeEach(angular.mock.inject(function($rootScope, $controller, $interval, _$q_, DateFormatterService) { scope = $rootScope.$new(); controllerFactory = $controller; $q = _$q_; dateFormatterService = DateFormatterService; $interval.flush(200); })); beforeEach(function() { mockRequisitionsService.getTiming = jasmine.createSpy('getTiming'); mockRequisitionsService.getRequisitions = jasmine.createSpy('getRequisitions'); var requisitionsDefer = $q.defer(); requisitionsDefer.resolve(requisitionsData); mockRequisitionsService.getRequisitions.and.returnValue(requisitionsDefer.promise); mockRequisitionsService.getTiming.and.returnValue({ isRunning: false }); mockGrowl = { warning: function(msg) { console.warn(msg); }, error: function(msg) { console.error(msg); }, info: function(msg) { console.info(msg); }, success: function(msg) { console.info(msg); } }; }); test('Controller: RequisitionsController: test controller', function() { createController(); scope.$digest(); expect(mockRequisitionsService.getRequisitions).toHaveBeenCalled(); expect(scope.requisitionsData.requisitions.length).toBe(0); });
from importlib import import_module from os import path, listdir from string import lower from debug import logger import paths class MsgBase(object): def encode(self): self.data = {"": lower(type(self).__name__)} def constructObject(data): try: classBase = eval(data[""] + "." + data[""].title()) except NameError: logger.error("Don't know how to handle message type: \"%s\"", data[""]) return None try: returnObj = classBase() returnObj.decode(data) except KeyError as e: logger.error("Missing mandatory key %s", e) return None except: logger.error("classBase fail", exc_info=True) return None else: return returnObj if paths.frozen is not None: import messagetypes.message import messagetypes.vote else: for mod in listdir(path.dirname(__file__)): if mod == "__init__.py": continue splitted = path.splitext(mod) if splitted[1] != ".py": continue try: import_module("." + splitted[0], "messagetypes") except ImportError: logger.error("Error importing %s", mod, exc_info=True) else: logger.debug("Imported message type module %s", mod)
from importlib import import_module from os import path, listdir from string import lower from debug import logger import paths class MsgBase(object): def encode(self): self.data = {"": lower(type(self).__name__)} def constructObject(data): try: m = import_module("messagetypes." + data[""]) classBase = getattr(m, data[""].title()) except (NameError, ImportError): logger.error("Don't know how to handle message type: \"%s\"", data[""], exc_info=True) return None try: returnObj = classBase() returnObj.decode(data) except KeyError as e: logger.error("Missing mandatory key %s", e) return None except: logger.error("classBase fail", exc_info=True) return None else: return returnObj if paths.frozen is not None: import messagetypes.message import messagetypes.vote else: for mod in listdir(path.dirname(__file__)): if mod == "__init__.py": continue splitted = path.splitext(mod) if splitted[1] != ".py": continue try: import_module("." + splitted[0], "messagetypes") except ImportError: logger.error("Error importing %s", mod, exc_info=True) else: logger.debug("Imported message type module %s", mod)
None
/* eslint-disable no-unused-vars */ require('app-module-path').addPath(__dirname); const os = require('os'); const { time } = require('lib/time-utils.js'); const { filename } = require('lib/path-utils.js'); const { asyncTest, fileContentEqual, setupDatabase, setupDatabaseAndSynchronizer, db, synchronizer, fileApi, sleep, clearDatabase, switchClient, syncTargetId, objectsEqual, checkThrowAsync } = require('test-utils.js'); const Folder = require('lib/models/Folder.js'); const Note = require('lib/models/Note.js'); const BaseModel = require('lib/BaseModel.js'); const { shim } = require('lib/shim'); const HtmlToHtml = require('lib/joplin-renderer/HtmlToHtml'); const { enexXmlToMd } = require('lib/import-enex-md-gen.js'); jasmine.DEFAULT_TIMEOUT_INTERVAL = 60 * 60 * 1000; // Can run for a while since everything is in the same test unit process.on('unhandledRejection', (reason, p) => { console.log('Unhandled Rejection at: Promise', p, 'reason:', reason); }); describe('HtmlToHtml', function() { beforeEach(async (done) => { await setupDatabaseAndSynchronizer(1); await switchClient(1); done(); }); it('should convert from Html to Html', asyncTest(async () => { const basePath = `${__dirname}/html_to_html`; const files = await shim.fsDriver().readDirStats(basePath); const htmlToHtml = new HtmlToHtml(); for (let i = 0; i < files.length; i++) { const htmlSourceFilename = files[i].path; if (htmlSourceFilename.indexOf('.src.html') < 0) continue; const htmlSourceFilePath = `${basePath}/${htmlSourceFilename}`; const htmlDestPath = `${basePath}/${filename(filename(htmlSourceFilePath))}.dest.html`; // if (htmlSourceFilename !== 'table_with_header.html') continue; const htmlToHtmlOptions = { bodyOnly: true, }; const sourceHtml = await shim.fsDriver().readFile(htmlSourceFilePath); let expectedHtml = await shim.fsDriver().readFile(htmlDestPath); const result = await htmlToHtml.render(sourceHtml, null, htmlToHtmlOptions); let actualHtml = result.html; if (os.EOL === '\r\n') { expectedHtml = expectedHtml.replace(/\r\n/g, '\n'); actualHtml = actualHtml.replace(/\r\n/g, '\n'); } if (actualHtml !== expectedHtml) { console.info(''); console.info(`Error converting file: ${htmlSourceFilename}`); console.info('--------------------------------- Got:'); console.info(actualHtml); console.info('--------------------------------- Raw:'); console.info(actualHtml.split('\n')); console.info('--------------------------------- Expected:'); console.info(expectedHtml.split('\n')); console.info('--------------------------------------------'); console.info(''); expect(false).toBe(true); // return; } else { expect(true).toBe(true); } } })); });
None
/* eslint-disable no-unused-vars */ require('app-module-path').addPath(__dirname); const os = require('os'); const { time } = require('lib/time-utils.js'); const { filename } = require('lib/path-utils.js'); const { asyncTest, fileContentEqual, setupDatabase, setupDatabaseAndSynchronizer, db, synchronizer, fileApi, sleep, clearDatabase, switchClient, syncTargetId, objectsEqual, checkThrowAsync } = require('test-utils.js'); const Folder = require('lib/models/Folder.js'); const Note = require('lib/models/Note.js'); const BaseModel = require('lib/BaseModel.js'); const { shim } = require('lib/shim'); const MdToHtml = require('lib/joplin-renderer/MdToHtml'); const { enexXmlToMd } = require('lib/import-enex-md-gen.js'); jasmine.DEFAULT_TIMEOUT_INTERVAL = 60 * 60 * 1000; // Can run for a while since everything is in the same test unit process.on('unhandledRejection', (reason, p) => { console.log('Unhandled Rejection at: Promise', p, 'reason:', reason); }); describe('MdToHtml', function() { beforeEach(async (done) => { await setupDatabaseAndSynchronizer(1); await switchClient(1); done(); }); it('should convert from Markdown to Html', asyncTest(async () => { const basePath = `${__dirname}/md_to_html`; const files = await shim.fsDriver().readDirStats(basePath); const mdToHtml = new MdToHtml(); for (let i = 0; i < files.length; i++) { const mdFilename = files[i].path; if (mdFilename.indexOf('.md') < 0) continue; const mdFilePath = `${basePath}/${mdFilename}`; const htmlPath = `${basePath}/${filename(mdFilePath)}.html`; // if (mdFilename !== 'table_with_header.html') continue; const mdToHtmlOptions = { bodyOnly: true, }; const markdown = await shim.fsDriver().readFile(mdFilePath); let expectedHtml = await shim.fsDriver().readFile(htmlPath); const result = await mdToHtml.render(markdown, null, mdToHtmlOptions); let actualHtml = result.html; if (os.EOL === '\r\n') { expectedHtml = expectedHtml.replace(/\r\n/g, '\n'); actualHtml = actualHtml.replace(/\r\n/g, '\n'); } if (actualHtml !== expectedHtml) { console.info(''); console.info(`Error converting file: ${mdFilename}`); console.info('--------------------------------- Got:'); console.info(actualHtml); console.info('--------------------------------- Raw:'); console.info(actualHtml.split('\n')); console.info('--------------------------------- Expected:'); console.info(expectedHtml.split('\n')); console.info('--------------------------------------------'); console.info(''); expect(false).toBe(true); // return; } else { expect(true).toBe(true); } } })); });
const htmlUtils = require('./htmlUtils'); const utils = require('./utils'); const noteStyle = require('./noteStyle'); class HtmlToHtml { constructor(options) { if (!options) options = {}; this.resourceBaseUrl_ = 'resourceBaseUrl' in options ? options.resourceBaseUrl : null; this.ResourceModel_ = options.ResourceModel; } render(markup, theme, options) { const html = htmlUtils.processImageTags(markup, data => { if (!data.src) return null; const r = utils.imageReplacement(this.ResourceModel_, data.src, options.resources, this.resourceBaseUrl_); if (!r) return null; if (typeof r === 'string') { return { type: 'replaceElement', html: r, }; } else { return { type: 'setAttributes', attrs: r, }; } }); const cssStrings = noteStyle(theme, options); const styleHtml = `<style>${cssStrings.join('\n')}</style>`; return { html: styleHtml + html, pluginAssets: [], }; } } module.exports = HtmlToHtml;
const htmlUtils = require('./htmlUtils'); const utils = require('./utils'); const noteStyle = require('./noteStyle'); const memoryCache = require('memory-cache'); const md5 = require('md5'); class HtmlToHtml { constructor(options) { if (!options) options = {}; this.resourceBaseUrl_ = 'resourceBaseUrl' in options ? options.resourceBaseUrl : null; this.ResourceModel_ = options.ResourceModel; this.cache_ = new memoryCache.Cache(); } async render(markup, theme, options) { const cacheKey = md5(escape(markup)); let html = this.cache_.get(cacheKey); if (!html) { html = htmlUtils.sanitizeHtml(markup); html = htmlUtils.processImageTags(html, data => { if (!data.src) return null; const r = utils.imageReplacement(this.ResourceModel_, data.src, options.resources, this.resourceBaseUrl_); if (!r) return null; if (typeof r === 'string') { return { type: 'replaceElement', html: r, }; } else { return { type: 'setAttributes', attrs: r, }; } }); } if (options.bodyOnly) return { html: html, pluginAssets: [], }; this.cache_.put(cacheKey, html, 1000 * 60 * 10); const cssStrings = noteStyle(theme, options); const styleHtml = `<style>${cssStrings.join('\n')}</style>`; return { html: styleHtml + html, pluginAssets: [], }; } } module.exports = HtmlToHtml;
const MdToHtml = require('./MdToHtml'); const HtmlToHtml = require('./HtmlToHtml'); class MarkupToHtml { constructor(options) { this.options_ = Object.assign({}, { ResourceModel: { isResourceUrl: () => false, }, }, options); this.renderers_ = {}; } renderer(markupLanguage) { if (this.renderers_[markupLanguage]) return this.renderers_[markupLanguage]; let RendererClass = null; if (markupLanguage === MarkupToHtml.MARKUP_LANGUAGE_MARKDOWN) { RendererClass = MdToHtml; } else if (markupLanguage === MarkupToHtml.MARKUP_LANGUAGE_HTML) { RendererClass = HtmlToHtml; } else { throw new Error(`Invalid markup language: ${markupLanguage}`); } this.renderers_[markupLanguage] = new RendererClass(this.options_); return this.renderers_[markupLanguage]; } injectedJavaScript() { return ''; } render(markupLanguage, markup, theme, options) { return this.renderer(markupLanguage).render(markup, theme, options); } } MarkupToHtml.MARKUP_LANGUAGE_MARKDOWN = 1; MarkupToHtml.MARKUP_LANGUAGE_HTML = 2; module.exports = MarkupToHtml;
const MdToHtml = require('./MdToHtml'); const HtmlToHtml = require('./HtmlToHtml'); class MarkupToHtml { constructor(options) { this.options_ = Object.assign({}, { ResourceModel: { isResourceUrl: () => false, }, }, options); this.renderers_ = {}; } renderer(markupLanguage) { if (this.renderers_[markupLanguage]) return this.renderers_[markupLanguage]; let RendererClass = null; if (markupLanguage === MarkupToHtml.MARKUP_LANGUAGE_MARKDOWN) { RendererClass = MdToHtml; } else if (markupLanguage === MarkupToHtml.MARKUP_LANGUAGE_HTML) { RendererClass = HtmlToHtml; } else { throw new Error(`Invalid markup language: ${markupLanguage}`); } this.renderers_[markupLanguage] = new RendererClass(this.options_); return this.renderers_[markupLanguage]; } injectedJavaScript() { return ''; } async render(markupLanguage, markup, theme, options) { return this.renderer(markupLanguage).render(markup, theme, options); } } MarkupToHtml.MARKUP_LANGUAGE_MARKDOWN = 1; MarkupToHtml.MARKUP_LANGUAGE_HTML = 2; module.exports = MarkupToHtml;
const Entities = require('html-entities').AllHtmlEntities; const htmlentities = new Entities().encode; // [\s\S] instead of . for multiline matching // https://stackoverflow.com/a/16119722/561309 const imageRegex = /<img([\s\S]*?)src=["']([\s\S]*?)["']([\s\S]*?)>/gi; class HtmlUtils { attributesHtml(attr) { const output = []; for (const n in attr) { if (!attr.hasOwnProperty(n)) continue; output.push(`${n}="${htmlentities(attr[n])}"`); } return output.join(' '); } processImageTags(html, callback) { if (!html) return ''; return html.replace(imageRegex, (v, before, src, after) => { const action = callback({ src: src }); if (!action) return `<img${before}src="${src}"${after}>`; if (action.type === 'replaceElement') { return action.html; } if (action.type === 'replaceSource') { return `<img${before}src="${action.src}"${after}>`; } if (action.type === 'setAttributes') { const attrHtml = this.attributesHtml(action.attrs); return `<img${before}${attrHtml}${after}>`; } throw new Error(`Invalid action: ${action.type}`); }); } } const htmlUtils = new HtmlUtils(); module.exports = htmlUtils;
const Entities = require('html-entities').AllHtmlEntities; const htmlentities = new Entities().encode; // [\s\S] instead of . for multiline matching const NodeHtmlParser = require('node-html-parser'); // https://stackoverflow.com/a/16119722/561309 const imageRegex = /<img([\s\S]*?)src=["']([\s\S]*?)["']([\s\S]*?)>/gi; const JS_EVENT_NAMES = ['onabort', 'onafterprint', 'onbeforeprint', 'onbeforeunload', 'onblur', 'oncanplay', 'oncanplaythrough', 'onchange', 'onclick', 'oncontextmenu', 'oncopy', 'oncuechange', 'oncut', 'ondblclick', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'ondurationchange', 'onemptied', 'onended', 'onerror', 'onfocus', 'onhashchange', 'oninput', 'oninvalid', 'onkeydown', 'onkeypress', 'onkeyup', 'onload', 'onloadeddata', 'onloadedmetadata', 'onloadstart', 'onmessage', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onoffline', 'ononline', 'onpagehide', 'onpageshow', 'onpaste', 'onpause', 'onplay', 'onplaying', 'onpopstate', 'onprogress', 'onratechange', 'onreset', 'onresize', 'onscroll', 'onsearch', 'onseeked', 'onseeking', 'onselect', 'onstalled', 'onstorage', 'onsubmit', 'onsuspend', 'ontimeupdate', 'ontoggle', 'onunload', 'onvolumechange', 'onwaiting', 'onwheel']; class HtmlUtils { attributesHtml(attr) { const output = []; for (const n in attr) { if (!attr.hasOwnProperty(n)) continue; output.push(`${n}="${htmlentities(attr[n])}"`); } return output.join(' '); } processImageTags(html, callback) { if (!html) return ''; return html.replace(imageRegex, (v, before, src, after) => { const action = callback({ src: src }); if (!action) return `<img${before}src="${src}"${after}>`; if (action.type === 'replaceElement') { return action.html; } if (action.type === 'replaceSource') { return `<img${before}src="${action.src}"${after}>`; } if (action.type === 'setAttributes') { const attrHtml = this.attributesHtml(action.attrs); return `<img${before}${attrHtml}${after}>`; } throw new Error(`Invalid action: ${action.type}`); }); } sanitizeHtml(html) { const walkHtmlNodes = (nodes) => { if (!nodes || !nodes.length) return; for (const node of nodes) { for (const attr in node.attributes) { if (!node.attributes.hasOwnProperty(attr)) continue; if (JS_EVENT_NAMES.includes(attr)) node.setAttribute(attr, ''); } walkHtmlNodes(node.childNodes); } }; // Need to wrap in div, otherwise elements at the root will be skipped // The DIV tags are removed below const dom = NodeHtmlParser.parse(`<div>${html}</div>`, { script: false, style: true, pre: true, comment: false, }); walkHtmlNodes([dom]); const output = dom.toString(); return output.substr(5, output.length - 11); } } const htmlUtils = new HtmlUtils(); module.exports = htmlUtils;
{ "name": "joplin-renderer", "version": "1.0.8", "description": "The Joplin note renderer, used the mobile and desktop application", "repository": "https://github.com/laurent22/joplin/tree/master/ReactNativeClient/lib/joplin-renderer", "main": "index.js", "scripts": { "test": "jasmine --config=tests/support/jasmine.json", "buildAssets": "node Tools/buildAssets.js", "postinstall": "npm run buildAssets" }, "author": "", "license": "MIT", "devDependencies": { "jasmine": "^3.5.0" }, "dependencies": { "base-64": "^0.1.0", "font-awesome-filetypes": "^2.1.0", "fs-extra": "^8.1.0", "highlight.js": "^9.17.1", "html-entities": "^1.2.1", "json-stringify-safe": "^5.0.1", "katex": "^0.11.1", "markdown-it": "^10.0.0", "markdown-it-abbr": "^1.0.4", "markdown-it-anchor": "^5.2.5", "markdown-it-deflist": "^2.0.3", "markdown-it-emoji": "^1.4.0", "markdown-it-expand-tabs": "^1.0.13", "markdown-it-footnote": "^3.0.2", "markdown-it-ins": "^3.0.0", "markdown-it-mark": "^3.0.0", "markdown-it-multimd-table": "^4.0.1", "markdown-it-sub": "^1.0.0", "markdown-it-sup": "^1.0.0", "markdown-it-toc-done-right": "^4.1.0", "md5": "^2.2.1", "mermaid": "^8.4.6", "uslug": "^1.0.4" } }
{ "name": "joplin-renderer", "version": "1.0.8", "description": "The Joplin note renderer, used the mobile and desktop application", "repository": "https://github.com/laurent22/joplin/tree/master/ReactNativeClient/lib/joplin-renderer", "main": "index.js", "scripts": { "test": "jasmine --config=tests/support/jasmine.json", "buildAssets": "node Tools/buildAssets.js", "postinstall": "npm run buildAssets" }, "author": "", "license": "MIT", "devDependencies": { "jasmine": "^3.5.0" }, "dependencies": { "base-64": "^0.1.0", "font-awesome-filetypes": "^2.1.0", "fs-extra": "^8.1.0", "highlight.js": "^9.17.1", "html-entities": "^1.2.1", "json-stringify-safe": "^5.0.1", "katex": "^0.11.1", "markdown-it": "^10.0.0", "markdown-it-abbr": "^1.0.4", "markdown-it-anchor": "^5.2.5", "markdown-it-deflist": "^2.0.3", "markdown-it-emoji": "^1.4.0", "markdown-it-expand-tabs": "^1.0.13", "markdown-it-footnote": "^3.0.2", "markdown-it-ins": "^3.0.0", "markdown-it-mark": "^3.0.0", "markdown-it-multimd-table": "^4.0.1", "markdown-it-sub": "^1.0.0", "markdown-it-sup": "^1.0.0", "markdown-it-toc-done-right": "^4.1.0", "md5": "^2.2.1", "mermaid": "^8.4.6", "memory-cache": "^0.2.0", "node-html-parser": "^1.2.4", "uslug": "^1.0.4" } }
{ "name": "Joplin", "description": "Joplin for Mobile", "license": "MIT", "version": "0.8.0", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "postinstall": "node ../Tools/buildReactNativeInjectedJs.js && npx jetify && npm run encodeAssets", "encodeAssets": "node encodeAssets.js", "log-ios": "react-native-log-ios \"Joplin\"", "log-android": "adb logcat *:S ReactNative:V ReactNativeJS:V" }, "dependencies": { "@react-native-community/push-notification-ios": "^1.0.5", "@react-native-community/slider": "^2.0.8", "async-mutex": "^0.1.3", "base-64": "^0.1.0", "buffer": "^5.0.8", "diacritics": "^1.3.0", "diff-match-patch": "^1.0.4", "events": "^1.1.1", "font-awesome-filetypes": "^2.1.0", "form-data": "^2.1.4", "highlight.js": "^9.17.1", "html-entities": "^1.2.1", "jsc-android": "241213.1.0", "json-stringify-safe": "^5.0.1", "katex": "^0.11.1", "markdown-it": "^10.0.0", "markdown-it-abbr": "^1.0.4", "markdown-it-anchor": "^5.2.5", "markdown-it-deflist": "^2.0.3", "markdown-it-emoji": "^1.4.0", "markdown-it-expand-tabs": "^1.0.13", "markdown-it-footnote": "^3.0.2", "markdown-it-ins": "^3.0.0", "markdown-it-mark": "^3.0.0", "markdown-it-multimd-table": "^4.0.1", "markdown-it-sub": "^1.0.0", "markdown-it-sup": "^1.0.0", "markdown-it-toc-done-right": "^4.1.0", "md5": "^2.2.1", "mermaid": "^8.4.6", "moment": "^2.24.0", "prop-types": "^15.6.0", "punycode": "^2.1.1", "query-string": "4.3.4", "react": "16.9.0", "react-async": "^10.0.0", "react-native": "0.61.5", "react-native-action-button": "^2.6.9", "react-native-camera": "^2.10.2", "react-native-datepicker": "^1.6.0", "react-native-device-info": "^5.5.1", "react-native-dialogbox": "^0.6.10", "react-native-document-picker": "^2.3.0", "react-native-dropdownalert": "^3.1.2", "react-native-file-viewer": "^1.0.15", "react-native-fs": "^2.11.17", "react-native-image-picker": "^0.26.7", "react-native-image-resizer": "^1.0.0", "react-native-log-ios": "^1.5.0", "react-native-material-dropdown": "^0.5.2", "react-native-popup-dialog": "^0.9.35", "react-native-popup-menu": "^0.10.0", "react-native-push-notification": "git+https://github.com/laurent22/react-native-push-notification.git", "react-native-securerandom": "^1.0.0-rc.0", "react-native-side-menu": "^1.1.3", "react-native-sqlite-storage": "^4.1.0", "react-native-vector-icons": "^6.6.0", "react-native-version-info": "^0.5.1", "react-native-webview": "^5.12.0", "react-redux": "5.0.7", "redux": "4.0.0", "reselect": "^4.0.0", "rn-fetch-blob": "^0.12.0", "stream": "0.0.2", "string-natural-compare": "^2.0.2", "string-padding": "^1.0.2", "timers": "^0.1.1", "url": "^0.11.0", "url-parse": "^1.4.7", "uslug": "^1.0.4", "uuid": "^3.0.1", "valid-url": "^1.0.9", "word-wrap": "^1.2.3", "xml2js": "^0.4.19" }, "devDependencies": { "@babel/core": "^7.6.2", "@babel/runtime": "^7.6.2", "app-module-path": "^2.2.0", "fs-extra": "^8.1.0", "jetifier": "^1.6.4", "metro-react-native-babel-preset": "^0.54.1", "react-test-renderer": "^16.8.3" } }
{ "name": "Joplin", "description": "Joplin for Mobile", "license": "MIT", "version": "0.8.0", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "postinstall": "node ../Tools/buildReactNativeInjectedJs.js && npx jetify && npm run encodeAssets", "encodeAssets": "node encodeAssets.js", "log-ios": "react-native-log-ios \"Joplin\"", "log-android": "adb logcat *:S ReactNative:V ReactNativeJS:V" }, "dependencies": { "@react-native-community/push-notification-ios": "^1.0.5", "@react-native-community/slider": "^2.0.8", "async-mutex": "^0.1.3", "base-64": "^0.1.0", "buffer": "^5.0.8", "diacritics": "^1.3.0", "diff-match-patch": "^1.0.4", "events": "^1.1.1", "font-awesome-filetypes": "^2.1.0", "form-data": "^2.1.4", "highlight.js": "^9.17.1", "html-entities": "^1.2.1", "jsc-android": "241213.1.0", "json-stringify-safe": "^5.0.1", "katex": "^0.11.1", "markdown-it": "^10.0.0", "markdown-it-abbr": "^1.0.4", "markdown-it-anchor": "^5.2.5", "markdown-it-deflist": "^2.0.3", "markdown-it-emoji": "^1.4.0", "markdown-it-expand-tabs": "^1.0.13", "markdown-it-footnote": "^3.0.2", "markdown-it-ins": "^3.0.0", "markdown-it-mark": "^3.0.0", "markdown-it-multimd-table": "^4.0.1", "markdown-it-sub": "^1.0.0", "markdown-it-sup": "^1.0.0", "markdown-it-toc-done-right": "^4.1.0", "md5": "^2.2.1", "mermaid": "^8.4.6", "moment": "^2.24.0", "prop-types": "^15.6.0", "punycode": "^2.1.1", "query-string": "4.3.4", "react": "16.9.0", "react-async": "^10.0.0", "react-native": "0.61.5", "react-native-action-button": "^2.6.9", "react-native-camera": "^2.10.2", "react-native-datepicker": "^1.6.0", "react-native-device-info": "^5.5.1", "react-native-dialogbox": "^0.6.10", "react-native-document-picker": "^2.3.0", "react-native-dropdownalert": "^3.1.2", "react-native-file-viewer": "^1.0.15", "react-native-fs": "^2.11.17", "react-native-image-picker": "^0.26.7", "react-native-image-resizer": "^1.0.0", "react-native-log-ios": "^1.5.0", "react-native-material-dropdown": "^0.5.2", "react-native-popup-dialog": "^0.9.35", "react-native-popup-menu": "^0.10.0", "react-native-push-notification": "git+https://github.com/laurent22/react-native-push-notification.git", "react-native-securerandom": "^1.0.0-rc.0", "react-native-side-menu": "^1.1.3", "react-native-sqlite-storage": "^4.1.0", "react-native-vector-icons": "^6.6.0", "react-native-version-info": "^0.5.1", "react-native-webview": "^5.12.0", "react-redux": "5.0.7", "memory-cache": "^0.2.0", "node-html-parser": "^1.2.4", "redux": "4.0.0", "reselect": "^4.0.0", "rn-fetch-blob": "^0.12.0", "stream": "0.0.2", "string-natural-compare": "^2.0.2", "string-padding": "^1.0.2", "timers": "^0.1.1", "url": "^0.11.0", "url-parse": "^1.4.7", "uslug": "^1.0.4", "uuid": "^3.0.1", "valid-url": "^1.0.9", "word-wrap": "^1.2.3", "xml2js": "^0.4.19" }, "devDependencies": { "@babel/core": "^7.6.2", "@babel/runtime": "^7.6.2", "app-module-path": "^2.2.0", "fs-extra": "^8.1.0", "jetifier": "^1.6.4", "metro-react-native-babel-preset": "^0.54.1", "react-test-renderer": "^16.8.3" } }
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # Copyright 2020-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # # qutebrowser is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # qutebrowser is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see <https://www.gnu.org/licenses/>. """Tests for qutebrowser.qutebrowser. (Mainly commandline flag parsing) """ import pytest from qutebrowser import qutebrowser @pytest.fixture def parser(): return qutebrowser.get_argparser() class TestDebugFlag: def test_valid(self, parser): args = parser.parse_args(['--debug-flag', 'chromium', '--debug-flag', 'stack']) assert args.debug_flags == ['chromium', 'stack'] def test_invalid(self, parser, capsys): with pytest.raises(SystemExit): parser.parse_args(['--debug-flag', 'invalid']) _out, err = capsys.readouterr() assert 'Invalid debug flag - valid flags:' in err class TestLogFilter: def test_valid(self, parser): args = parser.parse_args(['--logfilter', 'misc']) assert args.logfilter == 'misc' def test_invalid(self, parser, capsys): with pytest.raises(SystemExit): parser.parse_args(['--logfilter', 'invalid']) _out, err = capsys.readouterr() print(err) assert 'Invalid log category invalid - valid categories' in err class TestJsonArgs: def test_partial(self, parser): """Make sure we can provide a subset of all arguments. This ensures that it's possible to restart into an older version of qutebrowser when a new argument was added. """ args = parser.parse_args(['--json-args', '{"debug": true}']) args = qutebrowser._unpack_json_args(args) # pylint: disable=no-member assert args.debug assert not args.temp_basedir
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # Copyright 2020-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # # qutebrowser is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # qutebrowser is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see <https://www.gnu.org/licenses/>. """Tests for qutebrowser.qutebrowser. (Mainly commandline flag parsing) """ import re import pytest from qutebrowser import qutebrowser @pytest.fixture def parser(): return qutebrowser.get_argparser() class TestDebugFlag: def test_valid(self, parser): args = parser.parse_args(['--debug-flag', 'chromium', '--debug-flag', 'stack']) assert args.debug_flags == ['chromium', 'stack'] def test_invalid(self, parser, capsys): with pytest.raises(SystemExit): parser.parse_args(['--debug-flag', 'invalid']) _out, err = capsys.readouterr() assert 'Invalid debug flag - valid flags:' in err class TestLogFilter: def test_valid(self, parser): args = parser.parse_args(['--logfilter', 'misc']) assert args.logfilter == 'misc' def test_invalid(self, parser, capsys): with pytest.raises(SystemExit): parser.parse_args(['--logfilter', 'invalid']) _out, err = capsys.readouterr() print(err) assert 'Invalid log category invalid - valid categories' in err class TestJsonArgs: def test_partial(self, parser): """Make sure we can provide a subset of all arguments. This ensures that it's possible to restart into an older version of qutebrowser when a new argument was added. """ args = parser.parse_args(['--json-args', '{"debug": true}']) args = qutebrowser._unpack_json_args(args) # pylint: disable=no-member assert args.debug assert not args.temp_basedir class TestValidateUntrustedArgs: @pytest.mark.parametrize('args', [ [], [':nop'], [':nop', '--untrusted-args'], [':nop', '--debug', '--untrusted-args'], [':nop', '--untrusted-args', 'foo'], ['--debug', '--untrusted-args', 'foo'], ['foo', '--untrusted-args', 'bar'], ]) def test_valid(self, args): qutebrowser._validate_untrusted_args(args) @pytest.mark.parametrize('args, message', [ ( ['--untrusted-args', '--debug'], "Found --debug after --untrusted-args, aborting.", ), ( ['--untrusted-args', ':nop'], "Found :nop after --untrusted-args, aborting.", ), ( ['--debug', '--untrusted-args', '--debug'], "Found --debug after --untrusted-args, aborting.", ), ( [':nop', '--untrusted-args', '--debug'], "Found --debug after --untrusted-args, aborting.", ), ( [':nop', '--untrusted-args', ':nop'], "Found :nop after --untrusted-args, aborting.", ), ( [ ':nop', '--untrusted-args', ':nop', '--untrusted-args', 'https://www.example.org', ], ( "Found multiple arguments (:nop --untrusted-args " "https://www.example.org) after --untrusted-args, aborting." ) ), ( ['--untrusted-args', 'okay1', 'okay2'], "Found multiple arguments (okay1 okay2) after --untrusted-args, aborting.", ), ]) def test_invalid(self, args, message): with pytest.raises(SystemExit, match=re.escape(message)): qutebrowser._validate_untrusted_args(args)
function ifempty(value) { if(value!="") { retvalue=value; } else { retvalue="&nbsp; "; } return retvalue; } function rhtmlspecialchars(str) { if (typeof(str)=="string") { str=str.replace(/&gt;/ig, ">"); str=str.replace(/&lt;/ig, "<"); str=str.replace(/&#039;/g, "'"); str=str.replace(/&quot;/ig, '"'); str=str.replace(/&amp;/ig, '&'); } return str; } function onlynumbers(e) { if(window.event) var keyCode=window.event.keyCode; else var keyCode=e.which; if(keyCode > 31 && (keyCode < 48 || keyCode > 57)) return false; return true; } checked=false; function checkedallprof(value) { var aa=document.getElementById(value); if (checked==false) { checked=true } else { checked=false } for (var i=0; i < aa.elements.length; i++) { aa.elements[i].checked = checked; } } function checksearch(e) { if(window.event) var keyCode=window.event.keyCode; else var keyCode=e.which; if(keyCode==13) { var searchfor=$('#newsearch input[name=searchfor]').val(); if(searchfor=="") { newsearch.searchfor.focus(); } else { $('#newsearch').trigger('submit', true); } } }
function ifempty(value) { if(value!="") { retvalue=value; } else { retvalue="&nbsp; "; } return retvalue; } function rhtmlspecialchars(str) { if (typeof(str)=="string") { str=str.replace(/&gt;/ig, ">"); str=str.replace(/&lt;/ig, "<"); str=str.replace(/&#039;/g, "'"); str=str.replace(/&quot;/ig, '"'); str=str.replace(/&amp;/ig, '&'); } return str; } function onlynumbers(e) { if(window.event) var keyCode=window.event.keyCode; else var keyCode=e.which; if(keyCode > 31 && (keyCode < 48 || keyCode > 57)) return false; return true; } checked=false; function checkedallprof(value) { var aa=document.getElementById(value); if (checked==false) { checked=true } else { checked=false } for (var i=0; i < aa.elements.length; i++) { aa.elements[i].checked = checked; } } function checksearch(e) { if(window.event) var keyCode=window.event.keyCode; else var keyCode=e.which; if(keyCode==13) { var searchfor=$('#newsearch input[name=searchfor]').val(); if(searchfor=="") { newsearch.searchfor.focus(); } else { $('#newsearch').trigger('submit', true); } } } function alphanumeric(inputtxt) { var letters = /^[0-9a-zA-Z]+$/; if (letters.test(inputtxt)) { return true; } else { return false; } }
/* 2014, Black Cat Development @link http://blackcat-cms.org @license http://www.gnu.org/licenses/gpl.html @category CAT_Core @package freshcat */ function getMethods(a){var b=[],c;for(c in a)try{"function"==typeof a[c]&&b.push(c+": "+a[c].toString())}catch(e){b.push(c+": inaccessible")}return b}function dump(a,b){var c="";b||(b=0);for(var e="",d=0;d<b+1;d++)e+=" ";if("object"==typeof a)for(var f in a)d=a[f],"object"==typeof d?(c+=e+"'"+f+"' ...\n",c+=dump(d,b+1)):c+=e+"'"+f+"' => \""+d+'"\n';else c="===>"+a+"<===("+typeof a+")";return c};(function(a){a.fn.fc_set_tab_list=function(b){var c={toggle_speed:300,fc_list_forms:a(".fc_list_forms"),fc_list_add:a("#fc_list_add")};b=a.extend(c,b);return this.each(function(){var c=a(this),d=c.closest("ul").children("li"),f="fc_list_"+c.children("input").val(),g=a("#"+f),h=a("#fc_install_new");b.fc_list_forms.not(":first").slideUp(0);0===b.fc_list_add.size()?d.filter(":first").addClass("fc_active"):b.fc_list_add.unbind().click(function(){d.removeClass("fc_active");b.fc_list_forms.not(h).slideUp(0); h.slideDown(0);h.find("ul.fc_groups_tabs a:first").click();h.find("input[type=text]:first").focus();jQuery("#addon_details").html("")});c.not(".fc_type_heading").click(function(){d.removeClass("fc_active");c.addClass("fc_active");b.fc_list_forms.not("#"+f).slideUp(0);g.slideDown(0);g.find("ul.fc_groups_tabs a:first").click();jQuery("#fc_add_new_module").hide()})})}})(jQuery);(function(a){a.fn.fc_toggle_element=function(b){b=a.extend({show_on_start:!1,toggle_speed:300},b);return this.each(function(){var c=a(this),e="show";if(c.is("select")){var d=c.children("option:selected"),f=match_class_prefix("show___",d),e="show";if("undefined"==typeof f||0===f.length)f=match_class_prefix("hide___",d),e="hide";"undefined"!=typeof f&&(g=a("#"+f));!1===b.show_on_start?g.slideUp(0).addClass("fc_inactive_element hidden").removeClass("fc_active_element"):g.slideDown(0).addClass("fc_active_element").removeClass("fc_inactive_element hidden"); c.change(function(){var d=c.children("option:selected"),e=match_class_prefix("show___",d),f="show";if("undefined"==typeof e||0===e.length)e=match_class_prefix("hide___",d),f="hide";"undefined"!=typeof e&&(g=a("#"+e));"show"==f?g.removeClass("hidden").slideUp(0).slideDown(b.toggle_speed,function(){g.addClass("fc_active_element").removeClass("fc_inactive_element")}):g.slideUp(b.toggle_speed,function(){g.addClass("fc_inactive_element hidden").removeClass("fc_active_element")})}).change()}else if(c.is("input:checkbox")|| c.is("input:radio")){var g=a("#"+c.prop("rel")),f=match_class_prefix("show___",c),e="show";if("undefined"==typeof f||0===f.length)f=match_class_prefix("hide___",c),e="hide";"undefined"!=typeof f&&(g=a("#"+f));"undefined"!=typeof g&&0<g.length&&(console.log(f+": "+e+" - "+c.prop("checked")),"show"==e&&c.prop("checked")?b.show_on_start=!0:"hide"==e&&c.prop("checked")?b.show_on_start=!1:"show"!=e||c.prop("checked")||(b.show_on_start=!1));!1===b.show_on_start?(console.log(f+" "+e+" - "+b.show_on_start), g.addClass("fc_inactive_element hidden").slideUp(0).removeClass("fc_active_element")):g.slideDown(0).addClass("fc_active_element").removeClass("hidden fc_inactive_element");c.click(function(){c.prop("checked")&&"show"==e?g.removeClass("hidden").slideUp(0).slideDown(b.toggle_speed,function(){g.addClass("fc_active_element").removeClass("fc_inactive_element")}):g.slideUp(b.toggle_speed,function(){g.addClass("fc_inactive_element hidden").removeClass("fc_active_element")})})}})}})(jQuery);(function(a){a.fn.resize_elements=function(b){var c={sidebar:a("#fc_sidebar"),sidebar_content:a("#fc_sidebar_content"),main_content:a("#fc_main_content"),leftside:a("#fc_sidebar, #fc_content_container"),rightside:a("#fc_content_container, #fc_content_footer"),rightcontent:a("#fc_content_container"),overview_list:a("#fc_list_overview"),side_add:a("#fc_add_page"),media:a("#fc_media_browser"),bottomright:130,bottomleft:79};b=a.extend(c,b);return this.each(function(){var c=a(this);c.resize(function(){var d= parseInt(c.height(),10),f=parseInt(c.width(),10),g=parseInt(b.sidebar.width(),10);b.main_content.css({maxHeight:d-b.bottomright+"px"});b.media.css({maxHeight:d-b.bottomright+"px"});b.leftside.height(d-b.bottomright+30);b.sidebar.height(d-b.bottomright+48);b.rightcontent.height(d-b.bottomleft);b.rightside.width(f-g);b.sidebar_content.height(d-b.bottomright+26);f=0<a("#fc_list_add").size()?58:30;b.overview_list.css({maxHeight:d-b.bottomright-f+"px"});b.side_add.css({left:g+"px",height:d-b.bottomright+ 51+"px"})}).resize()})}})(jQuery);(function(a){a.fn.fc_show_popup=function(b){b=a.extend({functionOpen:!1},b);return this.each(function(){var b=a(this),e=match_class_prefix("form_",b),d=a("#"+e);b.unbind().click(function(){d.find(".fc_valid, .fc_invalid").removeClass("fc_invalid fc_valid");var b=d.find('input[name="form_title"]').val();buttonsOpts=[];0<d.find(".fc_confirm_bar").size()&&(d.find(".fc_confirm_bar input").each(function(){var b=a(this);if(b.hasClass("hidden"))var c=function(){},e="hidden";else"reset"==b.prop("type")?(c= function(){d.find('input[type="reset"]').click();d.dialog("close")},e="reset"):(c=function(){d.submit()},e="submit");buttonsOpts.push({text:b.val(),click:c,"class":e})}),d.find(".fc_confirm_bar").hide());d.dialog({create:function(b,c){a(".ui-widget-header").removeClass("ui-corner-all").addClass("ui-corner-top")},open:function(a,b){"undefined"!=typeof functionOpen&&!1!==functionOpen&&functionOpen.call(this)},modal:!0,closeOnEscape:!0,title:b,minWidth:600,minHeight:400,buttons:buttonsOpts})})})}})(jQuery);function toTimeString(a){return(new Date(1E3*a)).toUTCString().match(/(\d\d:\d\d:\d\d)/)[0]}function TimeStringToSecs(a){a=a.split(":");return 3600*+a[0]+60*+a[1]+ +a[2]} "undefined"!=typeof jQuery&&($.ajaxPrefilter(function(a,b,c){c.originalRequestOptions=b}),jQuery.ajaxSetup({error:function(a,b,c){0===a.status?alert("Not connected.\n Verify Network."):404==a.status?alert("Requested page not found. [404]"):500==a.status?alert("Internal Server Error [500]."):"parsererror"===c?alert("JSON parse failed."):"timeout"===c?alert("Time out error."):"abort"===c?alert("Ajax request aborted."):-1!=a.responseText.indexOf("fc_login_form")?location.href=CAT_ADMIN_URL+"/login/index.php": a.responseText.match(/CSRF check failed/ig)?(alert(cattranslate("CSRF check failed. Maybe a token timeout. Trying to reload page.")),location.reload(!0)):a.responseText.match(/ACCESS DENIED!/ig)?(alert(cattranslate("Access denied! Maybe a missing entry in database table class_secure.")),location.reload(!0)):alert("Uncaught AJAX Error.\n"+a.responseText)}})); (function(){for(var a,b=function(){},c="assert clear count debug dir dirxml error exception group groupCollapsed groupEnd info log markTimeline profile profileEnd table time timeEnd timeStamp trace warn".split(" "),e=c.length,d=window.console=window.console||{};e--;)a=c[e],d[a]||(d[a]=b)})();$.expr[":"].containsi=$.expr.createPseudo(function(a,b,c){return function(b){return-1<(b.textContent||b.innerText||$.text(b)).toLowerCase().indexOf(a.toLowerCase())}}); function isValidEmailAddress(a){return(new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i)).test(a)}function getThemeName(){return"freshcat"} function getDatesFromQuerystring(a){var b=[],c;if(void 0!=a){a=a.split("&");for(var e=0;e<a.length;e++)c=a[e].split("="),b.push(c[1]),b[c[0]]=c[1]}return b}function match_class_prefix(a,b){for(var c=b.prop("class").split(" "),e=new RegExp("^"+a+"(.+)","g"),d=0;d<c.length;d++){var f=e.exec(c[d]);if(null!==f)return f[1]}} function togglePageTree(){if($("#fc_sidebar").is(":visible"))$("#fc_sidebar, #fc_sidebar_footer").css({width:0}).hide();else{var a="undefined"!=typeof $.cookie("sidebar")?$.cookie("sidebar"):200;$("#fc_sidebar, #fc_sidebar_footer").css({width:a}).show()}$(window).resize()} function return_error(a,b){"undefined"!=typeof a&&a.slideUp(1200,function(){a.remove()});0===$(".fc_popup").size()&&$("#fc_admin_header").prepend('<div class="fc_popup" />');if("undefined"==typeof b||""==b)b="Unknown error";$(".fc_popup").html(b);var c=set_popup_title();$(".fc_popup").dialog({modal:!0,show:"fade",closeOnEscape:!0,title:c,buttons:[{text:"Ok",click:function(){$(".fc_popup").dialog("destroy")},"class":"submit"}]})} function return_success(a,b){"undefined"!=typeof b?(a.html(b).addClass("fc_active"),setTimeout(function(){a.slideUp(1200,function(){a.remove()})},5E3)):a.slideUp(1200,function(){a.remove()})}function set_activity(a){"undefined"==typeof a&&(a="Loading");var b=$('<div class="fc_process fc_gradient1 fc_border" />').appendTo("#fc_activity");b.slideUp(0,function(){b.html('<div class="fc_process_title">'+cattranslate(a)+'</div><div class="loader" />').slideDown(300)});return b} function set_popup_title(){var a="undefined"!=typeof cattranslate?cattranslate("Notification"):"Notification";0<$(".fc_popup .fc_popup_header").size()&&(a=$(".fc_popup .fc_popup_header").text(),$(".fc_popup .fc_popup_header").remove());return a} function dialog_confirm(a,b,c,e,d,f,g,h,k){0===$(".fc_popup").size()&&$("#fc_admin_header").prepend('<div class="fc_popup" />');"undefined"!=typeof cattranslate&&(a=cattranslate(a),b=cattranslate(b));$(".fc_popup").html(a);c="undefined"==typeof c||!1===c?alert("You sent an invalid url"):c;d="undefined"==typeof d||!1===d?"POST":d;f="undefined"==typeof f||!1===f?"JSON":f;k="undefined"==typeof k||!1===k?$("document.body"):k;b="undefined"==typeof b||!1===b?set_popup_title():b;buttonsOpts=[];e._cat_ajax= 1;buttonsOpts.push({text:cattranslate("Yes"),click:function(){$.ajax({type:d,context:k,url:c,dataType:f,data:e,cache:!1,beforeSend:function(a){a.process=set_activity(b);$(".fc_popup").dialog("destroy").remove();"undefined"!=typeof g&&!1!==g&&g.call(this,a)},success:function(a,b,c){!0===a.success||0<$(a).find(".fc_success_box").size()?return_success(c.process,a.message):return_error(c.process,a.message);"undefined"!=typeof h&&!1!==h&&h.call(this,a)}})},"class":"submit"});buttonsOpts.push({text:cattranslate("No"), click:function(){$(".fc_popup").dialog("destroy")},"class":"reset"});$(".fc_popup").dialog({modal:!0,show:"fade",closeOnEscape:!0,title:b,buttons:buttonsOpts})} function dialog_ajax(a,b,c,e,d,f,g,h){b="undefined"==typeof b||!1===b?alert("You send an invalid url"):b;e="undefined"==typeof e||!1===e?"POST":e;d="undefined"==typeof d||!1===d?"JSON":d;h="undefined"==typeof h||!1===h?$("document.body"):h;a="undefined"==typeof a||!1===a?set_popup_title():a;c._cat_ajax=1;$.ajax({type:e,url:b,dataType:d,context:h,data:c,beforeSend:function(b){$(".fc_popup").remove();b.process=set_activity(a);"undefined"!=typeof f&&!1!==f&&f.call(this)},success:function(a,b,c){return_success(c.process, a.message);!0===a.success?"undefined"!=typeof g&&!1!==g&&g.call(this,a):return_error(c.process,a.message)}})} function dialog_form(a,b,c,e,d){"undefined"==typeof e&&(e="json");a.submit(function(f){f.preventDefault();a.ajaxSubmit({context:a,dataType:e,beforeSerialize:function(a,b){"undefined"!=typeof d&&!1!==d&&d.call(this,a,b)},beforeSend:function(c,d,e){var f=0<a.find("input[name=fc_form_title]").size()?a.find("input[name=fc_form_title]").val():"Loading";c.process=set_activity(f);a.is(":data(dialog)")&&a.dialog("destroy");"undefined"!=typeof b&&!1!==b&&b.call(this,c,d,e)},success:function(a,b,d){!0===a.success? (return_success(d.process,a.message),"undefined"!=typeof c&&!1!==c&&c.call(this,a,b,d)):return_error(d.process,a.message)},error:function(a,b,c){a.process.remove();console.log(a);console.log(b);console.log(c);alert(b+": "+c)}})})}function set_buttons(a){a.find(".fc_toggle_element").fc_toggle_element()} function searchUsers(a){$("#fc_list_overview li").removeClass("fc_activeSearch").slideDown(0);0<a.length?($("#fc_list_overview li:containsi("+a+")").not(".fc_no_search").addClass("fc_activeSearch"),$("#fc_list_overview").hasClass("fc_settings_list")&&$(".fc_list_forms:containsi("+a+")").each(function(){var a=$(this).prop("id");$("input[value*="+a.substr(8)+"]").closest("li").addClass("fc_activeSearch")}),$("#fc_list_overview li").not(".fc_activeSearch").slideUp(300),1==$("#fc_list_overview li.fc_activeSearch").size()&& $("#fc_list_overview li.fc_activeSearch").click()):$("#fc_list_overview li").not("fc_no_search").slideDown(300)}function confirm_link(a,b,c){var e="HTML";"undefined"!=typeof c&&(e="JSON");dialog_confirm(a,"Confirmation",b,!1,"GET",e,!1,function(){location.reload(!0)})} jQuery(document).ready(function(){if("undefined"!==typeof $.cookie("sidebar")){var a=parseInt($(window).width(),10),b=$.cookie("sidebar");$("#fc_content_container, #fc_content_footer").css({width:a-b+"px"});$("#fc_sidebar_footer, #fc_sidebar, #fc_activity, #fc_sidebar_content").css({width:b+"px"})}$(window).resize_elements();set_buttons($("body"));b="undefined"!=typeof cattranslate?cattranslate("Search"):"Search";$("#fc_list_search input").livesearch({searchCallback:searchUsers,queryDelay:250,innerText:b, minimumSearchLength:2});$(".fc_input_fake label").click(function(){var a=$(this).prop("for");$("#"+a).val("");searchUsers("")});$(".ajaxForm").each(function(){dialog_form($(this))});$("a.ajaxLink").click(function(a){a.preventDefault();a=$(this).prop("href");dialog_ajax("Saving",a,getDatesFromQuerystring(document.URL.split("?")[1]))});$("#fc_sidebar_footer, #fc_sidebar").resizable({handles:"e",minWidth:100,start:function(b,e){a=parseInt($(window).width(),10)},resize:function(b,e){$("#fc_content_container, #fc_content_footer").css({width:a- e.size.width+"px"});$("#fc_sidebar_footer, #fc_sidebar, #fc_activity, #fc_sidebar_content").css({width:e.size.width+"px"});$("#fc_add_page").css({left:e.size.width+"px"})},stop:function(a,b){$.cookie("sidebar",b.size.width,{path:"/"})}});$("#fc_add_page_nav").find("a").click(function(){var a=$(this);a.hasClass("fc_active")||($("#fc_add_page").find(".fc_active").removeClass("fc_active"),a.addClass("fc_active"),a=a.attr("href"),$(a).addClass("fc_active"));return!1});$("#fc_footer_info").on("click", "#fc_showFooter_info",function(){$(this).toggleClass("fc_active").parent("#fc_footer_info").children("ul").slideToggle(300)});void 0!==typeof window.qtip&&$('[title!=""]').qtip({content:{attr:"title"},style:{classes:"qtip-light qtip-shadow qtip-rounded"}})});(function(a){a.fn.page_tree=function(b){b=a.extend({beforeSend:function(){},afterSend:function(){}},b);return this.each(function(){var b=a(this);1<b.find("li").size()&&b.find("ul").sortable({cancel:".ui-state-disabled",helper:"clone",handle:"div.fc_page_link",axis:"y",update:function(e,d){var f={page_id:a(this).sortable("toArray"),table:"pages",_cat_ajax:1};a.ajax({type:"POST",url:CAT_ADMIN_URL+"/pages/ajax_reorder.php",dataType:"json",data:f,cache:!1,beforeSend:function(a){a.process=set_activity("Reorder pages")}, success:function(d,e,f){var l=a(this);a(".popup").dialog("destroy").remove();b.children("span").removeClass("fc_page_loader");!0===d.success?(return_success(f.process,d.message),l.slideUp(300,function(){l.remove()})):return_error(f.process,d.message)},error:function(b,c,d){a(".popup").dialog("destroy").remove();alert(c+": "+d)}})}});b.find(".fc_page_tree_options_open").add("#fc_add_page button:reset").on("click",function(b){b.preventDefault();var c=a(this);b=a("#fc_add_page");a(".page_tree_open_options").removeClass("page_tree_open_options"); if(c.is("input")||c.hasClass("fc_side_add")){var f={_cat_ajax:1,parent_id:a("#fc_addPage_parent_page_id").val()},g=CAT_ADMIN_URL+"/pages/ajax_get_dropdown.php";a("#fc_addPage_keywords").val("");b.find(".fc_restorePageOnly, .fc_changePageOnly").hide();b.find("nav, ul, .fc_addPageOnly").show()}else c.is("button:reset")?(f={_cat_ajax:1},g=CAT_ADMIN_URL+"/pages/ajax_get_dropdown.php",a("#fc_addPage_keywords").val(""),b.find(".fc_restorePageOnly, .fc_changePageOnly").hide(),b.find("nav, ul, .fc_addPageOnly").show()): (f={page_id:c.closest("li").find("input").val(),_cat_ajax:1},g=CAT_ADMIN_URL+"/pages/ajax_page_settings.php",c.closest("li").addClass("page_tree_open_options"),b.find(".fc_restorePageOnly, .fc_addPageOnly").hide(),b.find("nav, ul, .fc_changePageOnly").show());a.ajax({type:"POST",url:g,dataType:"json",data:f,cache:!1,beforeSend:function(b){a("#fc_addPage_keywords_ul").remove();a("#fc_add_page").is(":visible")&&a("#fc_add_page").stop().animate({width:"toggle"},200)},success:function(b,e,f){e=a("#fc_add_page"); var g='<option value="">['+cattranslate("None")+"]</option>";"deleted"==b.visibility?(e.find("nav, ul, .fc_changePageOnly, .fc_addPageOnly").hide(),e.find(".fc_restorePageOnly").show()):(null!==b.parent_list&&a.each(b.parent_list,function(a,b){g=g+'<option value="'+b.page_id+'"';g=!1===b.is_editable||!0===b.is_current||!0===b.is_direct_parent?g+' disabled="disabled">':g+">";for(var c=0;c<b.level;c++)g+="|-- ";g=g+b.menu_title+"</option>"}),f=a("#fc_addPage_parent").html(g),"undefined"!==typeof b.parent_id&& ""!==b.parent_id?f.children("option").prop("selected",!1).filter('option[value="'+b.parent_id+'"]').prop("selected",!0):a("#fc_addPage_parent option").prop("selected",!1).filter('option[value="'+b.parent+'"]').prop("selected",!0),a("#fc_addPage_title").val(b.menu_title),a("#fc_addPage_page_title").val(b.page_title),a("#fc_addPage_description").val(b.description),a("#fc_addPage_keywords").val(b.keywords),a("#fc_addPage_page_link").val(b.short_link),a("#fc_addPage_menu option").prop("selected",!1).filter('option[value="'+ b.menu+'"]').prop("selected",!0),a("#fc_addPage_target option").prop("selected",!1).filter('option[value="'+b.target+'"]').prop("selected",!0),a("#fc_default_template_variant").empty(),0<a(b.variants).size()?(a.each(b.variants,function(b,c){a("<option/>").val(c).text(c).appendTo("#fc_default_template_variant")}),"object"!==typeof b.template_variant&&0<b.template_variant.length&&(a('#fc_default_template_variant option[value="'+b.template_variant+'"]').prop("selected",!0),a("#fc_default_template_variant").val(b.template_variant)), a("#fc_div_template_variants").show()):a("#fc_div_template_variants").hide(),!0===b.auto_add_modules?a("#fc_div_template_autoadd").show():a("#fc_div_template_autoadd").hide(),""===b.template?a("#fc_addPage_template option").prop("selected",!1).filter("option:first").prop("selected",!0):a("#fc_addPage_template option").prop("selected",!1).filter('option[value="'+b.template+'"]').prop("selected",!0),a("#fc_addPage_language option").prop("selected",!1).filter('option[value="'+b.language+'"]').prop("selected", !0),a("#fc_addPage_visibility option").prop("selected",!1).filter('option[value="'+b.visibility+'"]').prop("selected",!0),a("#fc_addPage_Searching").prop("checked",b.searching),a("#fc_addPage_admin_groups input").each(function(){var c=a(this),d=c.val();-1==a.inArray(d,b.admin_groups)?c.prop("checked",!1):c.prop("checked",!0)}),a("#fc_addPage_allowed_viewers input").each(function(){var c=a(this),d=c.val();-1==a.inArray(d,b.viewing_groups)?c.prop("checked",!1):c.prop("checked",!0)}),a("#fc_addPage_keywords_ul").remove(), a('<ul id="fc_addPage_keywords_ul" />').insertBefore(a("#fc_addPage_keywords")).tagit({allowSpaces:!0,singleField:!0,singleFieldDelimiter:",",singleFieldNode:a("#fc_addPage_keywords"),beforeTagAdded:function(a,b){b.tag.addClass("icon-tag")}}));c.is("button:reset")?e.animate({width:"hide"},300):e.animate({width:"toggle"},300)}})});b.find(".fc_toggle_tree").on("click",function(){var b=a(this).closest("li"),c=SESSION+b.prop("id");b.hasClass("fc_tree_open")?(b.removeClass("fc_tree_open").addClass("fc_tree_close"), a.removeCookie(c,{path:"/"})):(b.addClass("fc_tree_open").removeClass("fc_tree_close"),a.cookie(c,"open",{path:"/"}))});b.find("li > a").mouseenter(function(){a(this).parent("li").addClass("fc_tree_hover")}).mouseleave(function(){a(this).parent("li").removeClass("fc_tree_hover")})})}})(jQuery); (function(a){a.fn.page_treeSearch=function(b){var c={options_ul:a("#fc_search_page_options"),page_tree:a("#fc_page_tree_top"),defaultValue:a("#fc_search_page_tree_default")};b=a.extend(c,b);return this.each(function(){function c(d){var f=b.page_tree.find("li");f.removeClass("fc_activeSearch fc_inactiveSearch fc_matchedSearch");b.page_tree.removeHighlight();if(0<d.length)switch(f.addClass("fc_inactiveSearch"),f=a(".fc_activeSearchOption").index(),b.options_ul.slideDown(300),b.options_ul.find("li").each(function(){var b= a(this);b.text(b.prop("title")+" "+d)}),b.options_ul.find("li").smartTruncation(),parseInt(f,10)){case 0:a("dd:containsi("+d+")").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch");b.page_tree.highlight(d);b.page_tree.find(".highlight").closest("li").addClass("fc_matchedSearch");break;case 1:a("dd.fc_search_MenuTitle:containsi("+d+")").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch");b.page_tree.highlight(d);b.page_tree.find(".highlight").closest("li").addClass("fc_matchedSearch"); break;case 2:a("dd.fc_search_PageTitle:containsi("+d+")").closest("li").addClass("fc_activeSearch fc_matchedSearch").removeClass("fc_inactiveSearch").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch");break;case 3:a("dd.fc_search_SectionName:containsi("+d+")").closest("li").addClass("fc_activeSearch fc_matchedSearch").removeClass("fc_inactiveSearch").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch");break;case 4:a("dd.fc_search_PageID").each(function(){current_search_item= a(this);current_search_item.text()==d&&current_search_item.closest("li").addClass("fc_activeSearch fc_matchedSearch").removeClass("fc_inactiveSearch").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch")});break;case 5:a("dd.fc_search_SectionID").each(function(){current_search_item=a(this);current_search_item.text()==d&&current_search_item.closest("li").addClass("fc_activeSearch fc_matchedSearch").removeClass("fc_inactiveSearch").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch")})}else a(".fc_activeSearchOption").removeClass("fc_activeSearchOption"), b.options_ul.find("li:first").addClass("fc_activeSearchOption"),b.options_ul.slideUp(300),a("#fc_searchOption").remove()}function d(){var d=b.options_ul.find(".fc_activeSearchOption").prop("id"),h=f.val();c(h);a('<div id="fc_searchOption" class="fc_br_all fc_border fc_gradient1 fc_gradient_hover"><span class="fc_br_left fc_gradient_blue">'+d+"</span><strong>"+h+"</strong></div>").prependTo("#fc_search_tree");a("#fc_searchOption").click(function(){c("");f.show().val("").focus()})}var f=a(this);f.val("").hide(); f.keyup(function(g){switch(g.keyCode){case 40:b.options_ul.find("li:last").hasClass("fc_activeSearchOption")||a(".fc_activeSearchOption").removeClass("fc_activeSearchOption").next("li").addClass("fc_activeSearchOption");c(f.val());break;case 38:b.options_ul.find("li:first").hasClass("fc_activeSearchOption")||a(".fc_activeSearchOption").removeClass("fc_activeSearchOption").prev("li").addClass("fc_activeSearchOption");c(f.val());break;case 13:d();f.val("").hide().blur();break;default:g=f.val(),""!== g&&c(g)}});b.defaultValue.click(function(){b.defaultValue.hide();c("");f.show().val("").focus()});f.blur(function(){setTimeout(function(){var c=f.val();0===a("#fc_searchOption").size()&&""===c?b.defaultValue.show():0===a("#fc_searchOption").size()&&(d(),f.val("").hide());b.options_ul.slideUp(300)},300)});a("#fc_search_tree .fc_close").click(function(){c("");f.show().val("").focus()});b.options_ul.find("li").click(function(){a(".fc_activeSearchOption").removeClass("fc_activeSearchOption");a(this).addClass("fc_activeSearchOption"); d();b.options_ul.slideUp(300);f.hide().val("")})})}})(jQuery); jQuery(document).ready(function(){$("#fc_sidebar, #fc_add_page").page_tree();$("#fc_search_page_tree").page_treeSearch();$("fc_page_tree_not_editable > a").click(function(a){a.preventDefault()});$("#fc_add_page").slideUp(0);$(".fc_side_home").click(function(a){a.preventDefault();window.open(CAT_URL)});$("#fc_addPageSubmit").click(function(a){a.preventDefault();$(this).closest("form");a=$(".page_tree_open_options");var b=[],c=[];$("#fc_addPage_admin_groups").children("input:checked").each(function(){b.push($(this).val())});$("#fc_addPage_viewers_groups").children("input:checked").each(function(){c.push($(this).val())}); var e={page_id:a.children("input[name=page_id]").val(),page_title:$("#fc_addPage_page_title").val(),menu_title:$("#fc_addPage_title").val(),page_link:$("#fc_addPage_page_link").val(),type:$("#fc_addPage_type option:selected").val(),parent:$("#fc_addPage_parent option:selected").val(),menu:$("#fc_addPage_menu option:selected").val(),target:$("#fc_addPage_target option:selected").val(),template:$("#fc_addPage_template option:selected").val(),variant:$("#fc_default_template_variant option:selected").val(), language:$("#fc_addPage_language option:selected").val(),description:$("#fc_addPage_description").val(),keywords:$("#fc_addPage_keywords").val(),searching:$("#fc_addPage_Searching").is(":checked")?1:0,visibility:$("#fc_addPage_visibility option:selected").val(),page_groups:$("#fc_addPage_page_groups").val(),visibility:$("#fc_addPage_visibility option:selected").val(),auto_add_modules:$("#fc_template_autoadd").is(":checked")?1:0,admin_groups:b,viewing_groups:c,_cat_ajax:1};$.ajax({context:a,type:"POST", url:CAT_ADMIN_URL+"/pages/ajax_add_page.php",dataType:"json",data:e,cache:!1,beforeSend:function(a){a.process=set_activity("Save page")},success:function(a,b,c){!0===a.success?(return_success(c.process,a.message),$(this),window.location.replace(a.url)):return_error(c.process,a.message)}})});$("#fc_savePageSubmit").click(function(a){a.preventDefault();$(this).closest("form");a=$(".page_tree_open_options");var b=[],c=[];$("#fc_addPage_admin_groups").children("input:checked").each(function(){b.push($(this).val())}); $("#fc_addPage_viewers_groups").children("input:checked").each(function(){c.push($(this).val())});var e={page_id:a.children("input[name=page_id]").val(),page_title:$("#fc_addPage_page_title").val(),menu_title:$("#fc_addPage_title").val(),parent:$("#fc_addPage_parent option:selected").val(),menu:$("#fc_addPage_menu option:selected").val(),target:$("#fc_addPage_target option:selected").val(),template:$("#fc_addPage_template option:selected").val(),template_variant:$("#fc_default_template_variant option:selected").val(), language:$("#fc_addPage_language option:selected").val(),page_link:$("#fc_addPage_page_link").val(),description:$("#fc_addPage_description").val(),keywords:$("#fc_addPage_keywords").val(),searching:$("#fc_addPage_Searching").is(":checked")?1:0,visibility:$("#fc_addPage_visibility option:selected").val(),page_groups:$("#fc_addPage_page_groups").val(),visibility:$("#fc_addPage_visibility option:selected").val(),admin_groups:b,viewing_groups:c,_cat_ajax:1};$.ajax({context:a,type:"POST",url:CAT_ADMIN_URL+ "/pages/ajax_settings_save.php",dataType:"json",data:e,cache:!1,beforeSend:function(a){a.process=set_activity(cattranslate("Saving page"))},success:function(a,b,c){if(!0===a.success){return_success(c.process,a.message);b=$(this);c=$("#pageid_"+a.parent);var h=b.parent().closest("li");$("#fc_add_page button:reset").click();switch(a.visibility){case "public":var k="icon-screen";break;case "private":k="icon-key";break;case "registered":k="icon-users";break;case "hidden":k="icon-eye-2";break;case "deleted":k= "icon-remove";break;default:k="icon-eye-blocked"}e.parent!=h.children("input[name=page_id]").val()&&(0===e.parent?$("#fc_page_tree_top").children("ul").append(b):0<c.children("ul").size()?(0===b.siblings("li").size()&&(h.removeClass("fc_tree_open"),h.find("ul").remove(),h.find(".fc_toggle_tree").remove()),b.appendTo(c.children("ul"))):(c.children(".fc_page_link").prepend('<span class="fc_toggle_tree" />'),$('<ul class="ui-sortable" />').appendTo(c).append(b)),c.parentsUntil("#fc_page_tree_top","li").andSelf().addClass("fc_expandable fc_tree_open").removeClass("fc_tree_close")); b.children("dl").children(".fc_search_MenuTitle").text(a.menu_title);b.children("dl").children(".fc_search_PageTitle").text(a.page_title);b.children(".fc_page_link").children("a").children(".fc_page_tree_menu_title").removeClass().addClass("fc_page_tree_menu_title "+k).text(" "+a.menu_title);b.children(".fc_page_link > a:first").prop("title","Page title: "+a.page_title)}else return_error(c.process,a.message)}})});$("#fc_removePageSubmit").click(function(a){a.preventDefault();$(this).closest("form"); a=$(".page_tree_open_options");var b=a.find("input[name=page_id]").val(),c=$("div#fc_add_module").find('input[name="page_id"]').val(),e={page_id:b,_cat_ajax:1};dialog_confirm(cattranslate("Do you really want to delete this page?"),cattranslate("Remove page"),CAT_ADMIN_URL+"/pages/ajax_delete_page.php",e,"POST","JSON",!1,function(a,e,g){$("#fc_add_page input[type=reset]").click();e=$(this);g=e.prev();if(!0===a.success&&0===a.status){a=e.parent().parent().find(".fc_page_link").find(".fc_toggle_tree"); var h=e.parent().parent();e.remove();0===h.find("ul.ui-sortable").children("li").length&&a.remove()}else e.find(".fc_page_link").find(".fc_page_tree_menu_title").removeClass().addClass("fc_page_tree_menu_title icon-remove");$("#fc_add_page button:reset").click();c==b&&(location.href="undefined"!=typeof g?CAT_ADMIN_URL+"/pages/modify.php?page_id="+g.prop("id").replace("pageid_",""):CAT_ADMIN_URL+"/start/index.php")},a)});$("#fc_restorePageSubmit").click(function(a){a.preventDefault();$(this).closest("form"); a=$(".page_tree_open_options");var b={page_id:a.children("input[name=page_id]").val(),_cat_ajax:1};dialog_ajax("Restoring page",CAT_ADMIN_URL+"/pages/ajax_restore_page.php",b,"POST","JSON",!1,function(a,b,d){$("#fc_add_page input[type=reset]").click();b=$(this);!0===a.success?b.find(".fc_page_link").find(".fc_page_tree_menu_title").removeClass().addClass("fc_page_tree_menu_title icon-screen"):return_error(d.process,a.message)},a)});$("#fc_addPageChildSubmit").click(function(a){a.preventDefault(); $("#fc_addPage_parent_page_id").val($(".page_tree_open_options").children("input[name=page_id]").val());$(".fc_side_add").click()});$("select[id=fc_addPage_template]").change(function(){var a={_cat_ajax:1,template:$("#fc_addPage_template").val()};$.ajax({type:"POST",url:CAT_ADMIN_URL+"/settings/ajax_get_template_variants.php",dataType:"json",data:a,cache:!1,success:function(a,c,e){!0===a.success?($(this),$("#fc_default_template_variant").empty(),0<$(a.variants).size()?($.each(a.variants,function(a, b){$("<option/>").val(b).text(b).appendTo("#fc_default_template_variant")}),$("#fc_div_template_variants").show()):$("#fc_div_template_variants").hide(),!0===a.auto_add_modules?($("#fc_template_autoadd").prop("checked","checked"),$("#fc_div_template_autoadd").show()):$("#fc_div_template_autoadd").hide()):return_error(e.process,a.message)}})});$("#fc_add_page_close").click(function(a){a.preventDefault();$("button#fc_addPageReset").click()})});var dlg_title=cattranslate("Your session has expired!"),dlg_text=cattranslate("Please enter your login details to log in again."),txt_username=cattranslate("Username"),txt_password=cattranslate("Password"),txt_login=cattranslate("Login"),txt_details=cattranslate("Please enter your login details!"),sessionTimeoutDialog=!1; function sessionTimedOutDialog(){$("#sessionTimeoutDialog").dialog("close").dialog("destroy");$.ajax({type:"POST",url:CAT_ADMIN_URL+"/logout/index.php",dataType:"json",cache:!1,data:{_cat_ajax:1},success:function(a,b,c){}});var a=Math.random().toString(36).slice(2),b=Math.random().toString(36).slice(2),c={username_fieldname:"username_"+a,password_fieldname:"password_"+b,_cat_ajax:1,redirect:!1};$('<div id="sessionTimedOutDialog"></div>').html('<span class="icon icon-warning" style="color:#c00;"></span> '+ dlg_text+'<br /><br /><div id="login_error_field" style="display:none;color:#c00;padding:5px;"></div><br /><br /><form><label for="username" class="fc_label_200">'+txt_username+':</label><input type="text" name="username_'+a+'" id="username_'+a+'" /><br /><label for="pass" class="fc_label_200">'+txt_password+':</label><input type="password" name="password_'+b+'" id="password_'+b+'" /><br /><br />').dialog({modal:!0,closeOnEscape:!1,open:function(a,b){$(".ui-dialog-titlebar-close").hide()},title:dlg_title, width:600,height:300,buttons:[{text:txt_login,icons:{primary:"ui-icon-check"},open:function(){$(this).keypress(function(a){a.keyCode==$.ui.keyCode.ENTER&&$(this).find(".ui-dialog-buttonset button").eq(0).trigger("click")})},click:function(){var e=$(this);""==$("#username_"+a).val()||""==$("#password_"+b).val()?(""==$("#username_"+a).val()&&$("#username_"+a).css("border","1px solid #c00"),""==$("#password_"+b).val()&&$("#password_"+b).css("border","1px solid #c00"),$("#login_error_field").text(txt_details).show()): (c["username_"+a]=$("#username_"+a).val(),c["password_"+b]=$("#password_"+b).val(),$.ajax({type:"POST",url:CAT_ADMIN_URL+"/login/ajax_index.php",dataType:"json",data:c,cache:!1,success:function(a,b,c){!0===a.success?($(e).dialog("close").dialog("destroy"),sessionSetTimer(a.timer)):$("#login_error_field").text(a.message).show()}}))}}]}).on("keyup",function(a){13==a.keyCode&&$(".ui-button-text-icon-primary").click()});$(".ui-widget-overlay").css("background-image","none").css("background-color","#000").css("opacity", "0.9")}function sessionSetTimer(a){var b=$("#fc_session_counter");"undefined"!=typeof a&&b.text(toTimeString(a));timerId=setInterval(function(){var a=TimeStringToSecs(b.text())-1;300>a&&b.parent().addClass("fc_gradient_red");5==a&&$("#fc_dlg_timer").css("color","#c00");0==a&&(clearInterval(timerId),sessionTimedOutDialog());b.text(toTimeString(a));$("span#fc_dlg_timer").text(a)},1E3)}jQuery(document).ready(function(a){sessionSetTimer()});
/* 2014, Black Cat Development @link http://blackcat-cms.org @license http://www.gnu.org/licenses/gpl.html @category CAT_Core @package freshcat */ var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,b,c){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e<d;e++){var f=a[e];if(b.call(c,f,e,a))return{i:e,v:f}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)}; $jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,b,c,d){if(b){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})}}; $jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6","es3");function getMethods(a){var b=[],c;for(c in a)try{"function"==typeof a[c]&&b.push(c+": "+a[c].toString())}catch(d){b.push(c+": inaccessible")}return b} function dump(a,b){var c="";b||(b=0);for(var d="",e=0;e<b+1;e++)d+=" ";if("object"==typeof a)for(var f in a)e=a[f],"object"==typeof e?(c+=d+"'"+f+"' ...\n",c+=dump(e,b+1)):c+=d+"'"+f+"' => \""+e+'"\n';else c="===>"+a+"<===("+typeof a+")";return c};(function(a){a.fn.fc_set_tab_list=function(b){var c={toggle_speed:300,fc_list_forms:a(".fc_list_forms"),fc_list_add:a("#fc_list_add")};b=a.extend(c,b);return this.each(function(){var c=a(this),e=c.closest("ul").children("li"),f="fc_list_"+c.children("input").val(),g=a("#"+f),h=a("#fc_install_new");b.fc_list_forms.not(":first").slideUp(0);0===b.fc_list_add.size()?e.filter(":first").addClass("fc_active"):b.fc_list_add.unbind().click(function(){e.removeClass("fc_active");b.fc_list_forms.not(h).slideUp(0); h.slideDown(0);h.find("ul.fc_groups_tabs a:first").click();h.find("input[type=text]:first").focus();jQuery("#addon_details").html("")});c.not(".fc_type_heading").click(function(){e.removeClass("fc_active");c.addClass("fc_active");b.fc_list_forms.not("#"+f).slideUp(0);g.slideDown(0);g.find("ul.fc_groups_tabs a:first").click();jQuery("#fc_add_new_module").hide()})})}})(jQuery);(function(a){a.fn.fc_toggle_element=function(b){b=a.extend({show_on_start:!1,toggle_speed:300},b);return this.each(function(){var c=a(this),d="show";if(c.is("select")){var e=c.children("option:selected"),f=match_class_prefix("show___",e);d="show";if("undefined"==typeof f||0===f.length)f=match_class_prefix("hide___",e),d="hide";"undefined"!=typeof f&&(g=a("#"+f));!1===b.show_on_start?g.slideUp(0).addClass("fc_inactive_element hidden").removeClass("fc_active_element"):g.slideDown(0).addClass("fc_active_element").removeClass("fc_inactive_element hidden"); c.change(function(){var d=c.children("option:selected"),e=match_class_prefix("show___",d),f="show";if("undefined"==typeof e||0===e.length)e=match_class_prefix("hide___",d),f="hide";"undefined"!=typeof e&&(g=a("#"+e));"show"==f?g.removeClass("hidden").slideUp(0).slideDown(b.toggle_speed,function(){g.addClass("fc_active_element").removeClass("fc_inactive_element")}):g.slideUp(b.toggle_speed,function(){g.addClass("fc_inactive_element hidden").removeClass("fc_active_element")})}).change()}else if(c.is("input:checkbox")|| c.is("input:radio")){var g=a("#"+c.prop("rel"));f=match_class_prefix("show___",c);d="show";if("undefined"==typeof f||0===f.length)f=match_class_prefix("hide___",c),d="hide";"undefined"!=typeof f&&(g=a("#"+f));"undefined"!=typeof g&&0<g.length&&(console.log(f+": "+d+" - "+c.prop("checked")),"show"==d&&c.prop("checked")?b.show_on_start=!0:"hide"==d&&c.prop("checked")?b.show_on_start=!1:"show"!=d||c.prop("checked")||(b.show_on_start=!1));!1===b.show_on_start?(console.log(f+" "+d+" - "+b.show_on_start), g.addClass("fc_inactive_element hidden").slideUp(0).removeClass("fc_active_element")):g.slideDown(0).addClass("fc_active_element").removeClass("hidden fc_inactive_element");c.click(function(){c.prop("checked")&&"show"==d?g.removeClass("hidden").slideUp(0).slideDown(b.toggle_speed,function(){g.addClass("fc_active_element").removeClass("fc_inactive_element")}):g.slideUp(b.toggle_speed,function(){g.addClass("fc_inactive_element hidden").removeClass("fc_active_element")})})}})}})(jQuery);(function(a){a.fn.resize_elements=function(b){var c={sidebar:a("#fc_sidebar"),sidebar_content:a("#fc_sidebar_content"),main_content:a("#fc_main_content"),leftside:a("#fc_sidebar, #fc_content_container"),rightside:a("#fc_content_container, #fc_content_footer"),rightcontent:a("#fc_content_container"),overview_list:a("#fc_list_overview"),side_add:a("#fc_add_page"),media:a("#fc_media_browser"),bottomright:130,bottomleft:79};b=a.extend(c,b);return this.each(function(){var c=a(this);c.resize(function(){var e= parseInt(c.height(),10),d=parseInt(c.width(),10),g=parseInt(b.sidebar.width(),10);b.main_content.css({maxHeight:e-b.bottomright+"px"});b.media.css({maxHeight:e-b.bottomright+"px"});b.leftside.height(e-b.bottomright+30);b.sidebar.height(e-b.bottomright+48);b.rightcontent.height(e-b.bottomleft);b.rightside.width(d-g);b.sidebar_content.height(e-b.bottomright+26);d=0<a("#fc_list_add").size()?58:30;b.overview_list.css({maxHeight:e-b.bottomright-d+"px"});b.side_add.css({left:g+"px",height:e-b.bottomright+ 51+"px"})}).resize()})}})(jQuery);(function(a){a.fn.fc_show_popup=function(b){b=a.extend({functionOpen:!1},b);return this.each(function(){var b=a(this),d=match_class_prefix("form_",b),e=a("#"+d);b.unbind().click(function(){e.find(".fc_valid, .fc_invalid").removeClass("fc_invalid fc_valid");var b=e.find('input[name="form_title"]').val();buttonsOpts=[];0<e.find(".fc_confirm_bar").size()&&(e.find(".fc_confirm_bar input").each(function(){var b=a(this);if(b.hasClass("hidden"))var c=function(){},d="hidden";else"reset"==b.prop("type")?(c= function(){e.find('input[type="reset"]').click();e.dialog("close")},d="reset"):(c=function(){e.submit()},d="submit");buttonsOpts.push({text:b.val(),click:c,"class":d})}),e.find(".fc_confirm_bar").hide());e.dialog({create:function(b,c){a(".ui-widget-header").removeClass("ui-corner-all").addClass("ui-corner-top")},open:function(a,b){"undefined"!=typeof functionOpen&&!1!==functionOpen&&functionOpen.call(this)},modal:!0,closeOnEscape:!0,title:b,minWidth:600,minHeight:400,buttons:buttonsOpts})})})}})(jQuery);function toTimeString(a){return(new Date(1E3*a)).toUTCString().match(/(\d\d:\d\d:\d\d)/)[0]}function TimeStringToSecs(a){a=a.split(":");return 3600*+a[0]+60*+a[1]+ +a[2]} "undefined"!=typeof jQuery&&($.ajaxPrefilter(function(a,b,c){c.originalRequestOptions=b}),jQuery.ajaxSetup({error:function(a,b,c){0===a.status?alert("Not connected.\n Verify Network."):404==a.status?alert("Requested page not found. [404]"):500==a.status?alert("Internal Server Error [500]."):"parsererror"===c?alert("JSON parse failed."):"timeout"===c?alert("Time out error."):"abort"===c?alert("Ajax request aborted."):-1!=a.responseText.indexOf("fc_login_form")?location.href=CAT_ADMIN_URL+"/login/index.php": a.responseText.match(/CSRF check failed/ig)?(alert(cattranslate("CSRF check failed. Maybe a token timeout. Trying to reload page.")),location.reload(!0)):a.responseText.match(/ACCESS DENIED!/ig)?(alert(cattranslate("Access denied! Maybe a missing entry in database table class_secure.")),location.reload(!0)):alert("Uncaught AJAX Error.\n"+a.responseText)}})); (function(){for(var a,b=function(){},c="assert clear count debug dir dirxml error exception group groupCollapsed groupEnd info log markTimeline profile profileEnd table time timeEnd timeStamp trace warn".split(" "),d=c.length,e=window.console=window.console||{};d--;)a=c[d],e[a]||(e[a]=b)})();$.expr[":"].containsi=$.expr.createPseudo(function(a,b,c){return function(b){return-1<(b.textContent||b.innerText||$.text(b)).toLowerCase().indexOf(a.toLowerCase())}}); function isValidEmailAddress(a){return(new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i)).test(a)}function getThemeName(){return"freshcat"} function getDatesFromQuerystring(a){var b=[];if(void 0!=a){a=a.split("&");for(var c=0;c<a.length;c++){var d=a[c].split("=");b.push(d[1]);b[d[0]]=d[1]}}return b}function match_class_prefix(a,b){b=b.prop("class").split(" ");a=new RegExp("^"+a+"(.+)","g");for(var c=0;c<b.length;c++){var d=a.exec(b[c]);if(null!==d)return d[1]}} function togglePageTree(){if($("#fc_sidebar").is(":visible"))$("#fc_sidebar, #fc_sidebar_footer").css({width:0}).hide();else{var a="undefined"!=typeof $.cookie("sidebar")?$.cookie("sidebar"):200;$("#fc_sidebar, #fc_sidebar_footer").css({width:a}).show()}$(window).resize()} function return_error(a,b){"undefined"!=typeof a&&a.slideUp(1200,function(){a.remove()});0===$(".fc_popup").size()&&$("#fc_admin_header").prepend('<div class="fc_popup" />');if("undefined"==typeof b||""==b)b="Unknown error";$(".fc_popup").html(b);b=set_popup_title();$(".fc_popup").dialog({modal:!0,show:"fade",closeOnEscape:!0,title:b,buttons:[{text:"Ok",click:function(){$(".fc_popup").dialog("destroy")},"class":"submit"}]})} function return_success(a,b){"undefined"!=typeof b?(a.html(b).addClass("fc_active"),setTimeout(function(){a.slideUp(1200,function(){a.remove()})},5E3)):a.slideUp(1200,function(){a.remove()})}function set_activity(a){"undefined"==typeof a&&(a="Loading");var b=$('<div class="fc_process fc_gradient1 fc_border" />').appendTo("#fc_activity");b.slideUp(0,function(){b.html('<div class="fc_process_title">'+cattranslate(a)+'</div><div class="loader" />').slideDown(300)});return b} function set_popup_title(){var a="undefined"!=typeof cattranslate?cattranslate("Notification"):"Notification";0<$(".fc_popup .fc_popup_header").size()&&(a=$(".fc_popup .fc_popup_header").text(),$(".fc_popup .fc_popup_header").remove());return a} function dialog_confirm(a,b,c,d,e,f,g,h,k){0===$(".fc_popup").size()&&$("#fc_admin_header").prepend('<div class="fc_popup" />');"undefined"!=typeof cattranslate&&(a=cattranslate(a),b=cattranslate(b));$(".fc_popup").html(a);c="undefined"==typeof c||!1===c?alert("You sent an invalid url"):c;e="undefined"==typeof e||!1===e?"POST":e;f="undefined"==typeof f||!1===f?"JSON":f;k="undefined"==typeof k||!1===k?$("document.body"):k;b="undefined"==typeof b||!1===b?set_popup_title():b;buttonsOpts=[];d._cat_ajax= 1;buttonsOpts.push({text:cattranslate("Yes"),click:function(){$.ajax({type:e,context:k,url:c,dataType:f,data:d,cache:!1,beforeSend:function(a){a.process=set_activity(b);$(".fc_popup").dialog("destroy").remove();"undefined"!=typeof g&&!1!==g&&g.call(this,a)},success:function(a,b,c){!0===a.success||0<$(a).find(".fc_success_box").size()?return_success(c.process,a.message):return_error(c.process,a.message);"undefined"!=typeof h&&!1!==h&&h.call(this,a)}})},"class":"submit"});buttonsOpts.push({text:cattranslate("No"), click:function(){$(".fc_popup").dialog("destroy")},"class":"reset"});$(".fc_popup").dialog({modal:!0,show:"fade",closeOnEscape:!0,title:b,buttons:buttonsOpts})} function dialog_ajax(a,b,c,d,e,f,g,h){b="undefined"==typeof b||!1===b?alert("You send an invalid url"):b;d="undefined"==typeof d||!1===d?"POST":d;e="undefined"==typeof e||!1===e?"JSON":e;h="undefined"==typeof h||!1===h?$("document.body"):h;a="undefined"==typeof a||!1===a?set_popup_title():a;c._cat_ajax=1;$.ajax({type:d,url:b,dataType:e,context:h,data:c,beforeSend:function(b){$(".fc_popup").remove();b.process=set_activity(a);"undefined"!=typeof f&&!1!==f&&f.call(this)},success:function(a,b,c){return_success(c.process, a.message);!0===a.success?"undefined"!=typeof g&&!1!==g&&g.call(this,a):return_error(c.process,a.message)}})} function dialog_form(a,b,c,d,e){"undefined"==typeof d&&(d="json");a.submit(function(f){f.preventDefault();a.ajaxSubmit({context:a,dataType:d,beforeSerialize:function(a,b){"undefined"!=typeof e&&!1!==e&&e.call(this,a,b)},beforeSend:function(c,d,e){var f=0<a.find("input[name=fc_form_title]").size()?a.find("input[name=fc_form_title]").val():"Loading";c.process=set_activity(f);a.is(":data(dialog)")&&a.dialog("destroy");"undefined"!=typeof b&&!1!==b&&b.call(this,c,d,e)},success:function(a,b,d){!0===a.success? (return_success(d.process,a.message),"undefined"!=typeof c&&!1!==c&&c.call(this,a,b,d)):return_error(d.process,a.message)},error:function(a,b,c){a.process.remove();console.log(a);console.log(b);console.log(c);alert(b+": "+c)}})})}function set_buttons(a){a.find(".fc_toggle_element").fc_toggle_element()} function searchUsers(a){$("#fc_list_overview li").removeClass("fc_activeSearch").slideDown(0);0<a.length?($("#fc_list_overview li:containsi("+a+")").not(".fc_no_search").addClass("fc_activeSearch"),$("#fc_list_overview").hasClass("fc_settings_list")&&$(".fc_list_forms:containsi("+a+")").each(function(){var a=$(this).prop("id");$("input[value*="+a.substr(8)+"]").closest("li").addClass("fc_activeSearch")}),$("#fc_list_overview li").not(".fc_activeSearch").slideUp(300),1==$("#fc_list_overview li.fc_activeSearch").size()&& $("#fc_list_overview li.fc_activeSearch").click()):$("#fc_list_overview li").not("fc_no_search").slideDown(300)}function confirm_link(a,b,c){var d="HTML";"undefined"!=typeof c&&(d="JSON");dialog_confirm(a,"Confirmation",b,!1,"GET",d,!1,function(){location.reload(!0)})} jQuery(document).ready(function(){if("undefined"!==typeof $.cookie("sidebar")){var a=parseInt($(window).width(),10),b=$.cookie("sidebar");$("#fc_content_container, #fc_content_footer").css({width:a-b+"px"});$("#fc_sidebar_footer, #fc_sidebar, #fc_activity, #fc_sidebar_content").css({width:b+"px"})}$(window).resize_elements();set_buttons($("body"));b="undefined"!=typeof cattranslate?cattranslate("Search"):"Search";$("#fc_list_search input").livesearch({searchCallback:searchUsers,queryDelay:250,innerText:b, minimumSearchLength:2});$(".fc_input_fake label").click(function(){var a=$(this).prop("for");$("#"+a).val("");searchUsers("")});$(".ajaxForm").each(function(){dialog_form($(this))});$("a.ajaxLink").click(function(a){a.preventDefault();a=$(this).prop("href");dialog_ajax("Saving",a,getDatesFromQuerystring(document.URL.split("?")[1]))});$("#fc_sidebar_footer, #fc_sidebar").resizable({handles:"e",minWidth:100,start:function(b,d){a=parseInt($(window).width(),10)},resize:function(b,d){$("#fc_content_container, #fc_content_footer").css({width:a- d.size.width+"px"});$("#fc_sidebar_footer, #fc_sidebar, #fc_activity, #fc_sidebar_content").css({width:d.size.width+"px"});$("#fc_add_page").css({left:d.size.width+"px"})},stop:function(a,b){$.cookie("sidebar",b.size.width,{path:"/"})}});$("#fc_add_page_nav").find("a").click(function(){var a=$(this);a.hasClass("fc_active")||($("#fc_add_page").find(".fc_active").removeClass("fc_active"),a.addClass("fc_active"),a=a.attr("href"),$(a).addClass("fc_active"));return!1});$("#fc_footer_info").on("click", "#fc_showFooter_info",function(){$(this).toggleClass("fc_active").parent("#fc_footer_info").children("ul").slideToggle(300)});$('[title!=""]').qtip({content:{attr:"title"},style:{classes:"qtip-light qtip-shadow qtip-rounded"}})});(function(a){a.fn.page_tree=function(b){b=a.extend({beforeSend:function(){},afterSend:function(){}},b);return this.each(function(){var b=a(this);1<b.find("li").size()&&b.find("ul").sortable({cancel:".ui-state-disabled",helper:"clone",handle:"div.fc_page_link",axis:"y",update:function(c,e){c={page_id:a(this).sortable("toArray"),table:"pages",_cat_ajax:1};a.ajax({type:"POST",url:CAT_ADMIN_URL+"/pages/ajax_reorder.php",dataType:"json",data:c,cache:!1,beforeSend:function(a){a.process=set_activity("Reorder pages")}, success:function(c,d,e){var f=a(this);a(".popup").dialog("destroy").remove();b.children("span").removeClass("fc_page_loader");!0===c.success?(return_success(e.process,c.message),f.slideUp(300,function(){f.remove()})):return_error(e.process,c.message)},error:function(b,c,e){a(".popup").dialog("destroy").remove();alert(c+": "+e)}})}});b.find(".fc_page_tree_options_open").add("#fc_add_page button:reset").on("click",function(b){b.preventDefault();var c=a(this);b=a("#fc_add_page");a(".page_tree_open_options").removeClass("page_tree_open_options"); if(c.is("input")||c.hasClass("fc_side_add")){var d={_cat_ajax:1,parent_id:a("#fc_addPage_parent_page_id").val()},g=CAT_ADMIN_URL+"/pages/ajax_get_dropdown.php";a("#fc_addPage_keywords").val("");b.find(".fc_restorePageOnly, .fc_changePageOnly").hide();b.find("nav, ul, .fc_addPageOnly").show()}else c.is("button:reset")?(d={_cat_ajax:1},g=CAT_ADMIN_URL+"/pages/ajax_get_dropdown.php",a("#fc_addPage_keywords").val(""),b.find(".fc_restorePageOnly, .fc_changePageOnly").hide(),b.find("nav, ul, .fc_addPageOnly").show()): (d={page_id:c.closest("li").find("input").val(),_cat_ajax:1},g=CAT_ADMIN_URL+"/pages/ajax_page_settings.php",c.closest("li").addClass("page_tree_open_options"),b.find(".fc_restorePageOnly, .fc_addPageOnly").hide(),b.find("nav, ul, .fc_changePageOnly").show());a.ajax({type:"POST",url:g,dataType:"json",data:d,cache:!1,beforeSend:function(b){a("#fc_addPage_keywords_ul").remove();a("#fc_add_page").is(":visible")&&a("#fc_add_page").stop().animate({width:"toggle"},200)},success:function(b,e,d){e=a("#fc_add_page"); var f='<option value="">['+cattranslate("None")+"]</option>";"deleted"==b.visibility?(e.find("nav, ul, .fc_changePageOnly, .fc_addPageOnly").hide(),e.find(".fc_restorePageOnly").show()):(null!==b.parent_list&&a.each(b.parent_list,function(a,b){f=f+'<option value="'+b.page_id+'"';f=!1===b.is_editable||!0===b.is_current||!0===b.is_direct_parent?f+' disabled="disabled">':f+">";for(a=0;a<b.level;a++)f+="|-- ";f=f+b.menu_title+"</option>"}),d=a("#fc_addPage_parent").html(f),"undefined"!==typeof b.parent_id&& ""!==b.parent_id?d.children("option").prop("selected",!1).filter('option[value="'+b.parent_id+'"]').prop("selected",!0):a("#fc_addPage_parent option").prop("selected",!1).filter('option[value="'+b.parent+'"]').prop("selected",!0),a("#fc_addPage_title").val(b.menu_title),a("#fc_addPage_page_title").val(b.page_title),a("#fc_addPage_description").val(b.description),a("#fc_addPage_keywords").val(b.keywords),a("#fc_addPage_page_link").val(b.short_link),a("#fc_addPage_menu option").prop("selected",!1).filter('option[value="'+ b.menu+'"]').prop("selected",!0),a("#fc_addPage_target option").prop("selected",!1).filter('option[value="'+b.target+'"]').prop("selected",!0),a("#fc_default_template_variant").empty(),0<a(b.variants).size()?(a.each(b.variants,function(b,c){a("<option/>").val(c).text(c).appendTo("#fc_default_template_variant")}),"object"!==typeof b.template_variant&&0<b.template_variant.length&&(a('#fc_default_template_variant option[value="'+b.template_variant+'"]').prop("selected",!0),a("#fc_default_template_variant").val(b.template_variant)), a("#fc_div_template_variants").show()):a("#fc_div_template_variants").hide(),!0===b.auto_add_modules?a("#fc_div_template_autoadd").show():a("#fc_div_template_autoadd").hide(),""===b.template?a("#fc_addPage_template option").prop("selected",!1).filter("option:first").prop("selected",!0):a("#fc_addPage_template option").prop("selected",!1).filter('option[value="'+b.template+'"]').prop("selected",!0),a("#fc_addPage_language option").prop("selected",!1).filter('option[value="'+b.language+'"]').prop("selected", !0),a("#fc_addPage_visibility option").prop("selected",!1).filter('option[value="'+b.visibility+'"]').prop("selected",!0),a("#fc_addPage_Searching").prop("checked",b.searching),a("#fc_addPage_admin_groups input").each(function(){var c=a(this),e=c.val();-1==a.inArray(e,b.admin_groups)?c.prop("checked",!1):c.prop("checked",!0)}),a("#fc_addPage_allowed_viewers input").each(function(){var c=a(this),e=c.val();-1==a.inArray(e,b.viewing_groups)?c.prop("checked",!1):c.prop("checked",!0)}),a("#fc_addPage_keywords_ul").remove(), a('<ul id="fc_addPage_keywords_ul" />').insertBefore(a("#fc_addPage_keywords")).tagit({allowSpaces:!0,singleField:!0,singleFieldDelimiter:",",singleFieldNode:a("#fc_addPage_keywords"),beforeTagAdded:function(a,b){b.tag.addClass("icon-tag")}}));c.is("button:reset")?e.animate({width:"hide"},300):e.animate({width:"toggle"},300)}})});b.find(".fc_toggle_tree").on("click",function(){var b=a(this).closest("li"),c=SESSION+b.prop("id");b.hasClass("fc_tree_open")?(b.removeClass("fc_tree_open").addClass("fc_tree_close"), a.removeCookie(c,{path:"/"})):(b.addClass("fc_tree_open").removeClass("fc_tree_close"),a.cookie(c,"open",{path:"/"}))});b.find("li > a").mouseenter(function(){a(this).parent("li").addClass("fc_tree_hover")}).mouseleave(function(){a(this).parent("li").removeClass("fc_tree_hover")})})}})(jQuery); (function(a){a.fn.page_treeSearch=function(b){var c={options_ul:a("#fc_search_page_options"),page_tree:a("#fc_page_tree_top"),defaultValue:a("#fc_search_page_tree_default")};b=a.extend(c,b);return this.each(function(){function c(c){c=c.replace(/(<([^>]+)>)/ig,"");var e=b.page_tree.find("li");e.removeClass("fc_activeSearch fc_inactiveSearch fc_matchedSearch");b.page_tree.removeHighlight();if(0<c.length)switch(e.addClass("fc_inactiveSearch"),e=a(".fc_activeSearchOption").index(),b.options_ul.slideDown(300), b.options_ul.find("li").each(function(){var b=a(this);b.text(b.prop("title")+" "+c)}),b.options_ul.find("li").smartTruncation(),parseInt(e,10)){case 0:a("dd:containsi("+c+")").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch");b.page_tree.highlight(c);b.page_tree.find(".highlight").closest("li").addClass("fc_matchedSearch");break;case 1:a("dd.fc_search_MenuTitle:containsi("+c+")").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch");b.page_tree.highlight(c); b.page_tree.find(".highlight").closest("li").addClass("fc_matchedSearch");break;case 2:a("dd.fc_search_PageTitle:containsi("+c+")").closest("li").addClass("fc_activeSearch fc_matchedSearch").removeClass("fc_inactiveSearch").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch");break;case 3:a("dd.fc_search_SectionName:containsi("+c+")").closest("li").addClass("fc_activeSearch fc_matchedSearch").removeClass("fc_inactiveSearch").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch"); break;case 4:a("dd.fc_search_PageID").each(function(){current_search_item=a(this);current_search_item.text()==c&&current_search_item.closest("li").addClass("fc_activeSearch fc_matchedSearch").removeClass("fc_inactiveSearch").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch")});break;case 5:a("dd.fc_search_SectionID").each(function(){current_search_item=a(this);current_search_item.text()==c&&current_search_item.closest("li").addClass("fc_activeSearch fc_matchedSearch").removeClass("fc_inactiveSearch").parents("li").addClass("fc_activeSearch").removeClass("fc_inactiveSearch")})}else a(".fc_activeSearchOption").removeClass("fc_activeSearchOption"), b.options_ul.find("li:first").addClass("fc_activeSearchOption"),b.options_ul.slideUp(300),a("#fc_searchOption").remove()}function e(){var e=b.options_ul.find(".fc_activeSearchOption").prop("id"),d=f.val();c(d);d=d.replace(/(<([^>]+)>)/ig,"");a('<div id="fc_searchOption" class="fc_br_all fc_border fc_gradient1 fc_gradient_hover"><span class="fc_br_left fc_gradient_blue">'+e+"</span><strong>"+d+"</strong></div>").prependTo("#fc_search_tree");a("#fc_searchOption").click(function(){c("");f.show().val("").focus()})} var f=a(this);f.val("").hide();f.keyup(function(d){switch(d.keyCode){case 40:b.options_ul.find("li:last").hasClass("fc_activeSearchOption")||a(".fc_activeSearchOption").removeClass("fc_activeSearchOption").next("li").addClass("fc_activeSearchOption");c(f.val());break;case 38:b.options_ul.find("li:first").hasClass("fc_activeSearchOption")||a(".fc_activeSearchOption").removeClass("fc_activeSearchOption").prev("li").addClass("fc_activeSearchOption");c(f.val());break;case 13:e();f.val("").hide().blur(); break;default:d=f.val(),""!==d&&c(d)}});b.defaultValue.click(function(){b.defaultValue.hide();c("");f.show().val("").focus()});f.blur(function(){setTimeout(function(){var c=f.val();0===a("#fc_searchOption").size()&&""===c?b.defaultValue.show():0===a("#fc_searchOption").size()&&(e(),f.val("").hide());b.options_ul.slideUp(300)},300)});a("#fc_search_tree .fc_close").click(function(){c("");f.show().val("").focus()});b.options_ul.find("li").click(function(){a(".fc_activeSearchOption").removeClass("fc_activeSearchOption"); a(this).addClass("fc_activeSearchOption");e();b.options_ul.slideUp(300);f.hide().val("")})})}})(jQuery); jQuery(document).ready(function(){$("#fc_sidebar, #fc_add_page").page_tree();$("#fc_search_page_tree").page_treeSearch();$("fc_page_tree_not_editable > a").click(function(a){a.preventDefault()});$("#fc_add_page").slideUp(0);$(".fc_side_home").click(function(a){a.preventDefault();window.open(CAT_URL)});$("#fc_addPageSubmit").click(function(a){a.preventDefault();$(this).closest("form");a=$(".page_tree_open_options");var b=[],c=[];$("#fc_addPage_admin_groups").children("input:checked").each(function(){b.push($(this).val())}); $("#fc_addPage_viewers_groups").children("input:checked").each(function(){c.push($(this).val())});var d={page_id:a.children("input[name=page_id]").val(),page_title:$("#fc_addPage_page_title").val(),menu_title:$("#fc_addPage_title").val(),page_link:$("#fc_addPage_page_link").val(),type:$("#fc_addPage_type option:selected").val(),parent:$("#fc_addPage_parent option:selected").val(),menu:$("#fc_addPage_menu option:selected").val(),target:$("#fc_addPage_target option:selected").val(),template:$("#fc_addPage_template option:selected").val(), variant:$("#fc_default_template_variant option:selected").val(),language:$("#fc_addPage_language option:selected").val(),description:$("#fc_addPage_description").val(),keywords:$("#fc_addPage_keywords").val(),searching:$("#fc_addPage_Searching").is(":checked")?1:0,visibility:$("#fc_addPage_visibility option:selected").val(),page_groups:$("#fc_addPage_page_groups").val(),visibility:$("#fc_addPage_visibility option:selected").val(),auto_add_modules:$("#fc_template_autoadd").is(":checked")?1:0,admin_groups:b, viewing_groups:c,_cat_ajax:1};$.ajax({context:a,type:"POST",url:CAT_ADMIN_URL+"/pages/ajax_add_page.php",dataType:"json",data:d,cache:!1,beforeSend:function(a){a.process=set_activity("Save page")},success:function(a,b,c){!0===a.success?(return_success(c.process,a.message),$(this),window.location.replace(a.url)):return_error(c.process,a.message)}})});$("#fc_savePageSubmit").click(function(a){a.preventDefault();$(this).closest("form");a=$(".page_tree_open_options");var b=[],c=[];$("#fc_addPage_admin_groups").children("input:checked").each(function(){b.push($(this).val())}); $("#fc_addPage_viewers_groups").children("input:checked").each(function(){c.push($(this).val())});var d={page_id:a.children("input[name=page_id]").val(),page_title:$("#fc_addPage_page_title").val(),menu_title:$("#fc_addPage_title").val(),parent:$("#fc_addPage_parent option:selected").val(),menu:$("#fc_addPage_menu option:selected").val(),target:$("#fc_addPage_target option:selected").val(),template:$("#fc_addPage_template option:selected").val(),template_variant:$("#fc_default_template_variant option:selected").val(), language:$("#fc_addPage_language option:selected").val(),page_link:$("#fc_addPage_page_link").val(),description:$("#fc_addPage_description").val(),keywords:$("#fc_addPage_keywords").val(),searching:$("#fc_addPage_Searching").is(":checked")?1:0,visibility:$("#fc_addPage_visibility option:selected").val(),page_groups:$("#fc_addPage_page_groups").val(),visibility:$("#fc_addPage_visibility option:selected").val(),admin_groups:b,viewing_groups:c,_cat_ajax:1};$.ajax({context:a,type:"POST",url:CAT_ADMIN_URL+ "/pages/ajax_settings_save.php",dataType:"json",data:d,cache:!1,beforeSend:function(a){a.process=set_activity(cattranslate("Saving page"))},success:function(a,b,c){if(!0===a.success){return_success(c.process,a.message);b=$(this);c=$("#pageid_"+a.parent);var e=b.parent().closest("li");$("#fc_add_page button:reset").click();switch(a.visibility){case "public":var f="icon-screen";break;case "private":f="icon-key";break;case "registered":f="icon-users";break;case "hidden":f="icon-eye-2";break;case "deleted":f= "icon-remove";break;default:f="icon-eye-blocked"}d.parent!=e.children("input[name=page_id]").val()&&(0===d.parent?$("#fc_page_tree_top").children("ul").append(b):0<c.children("ul").size()?(0===b.siblings("li").size()&&(e.removeClass("fc_tree_open"),e.find("ul").remove(),e.find(".fc_toggle_tree").remove()),b.appendTo(c.children("ul"))):(c.children(".fc_page_link").prepend('<span class="fc_toggle_tree" />'),$('<ul class="ui-sortable" />').appendTo(c).append(b)),c.parentsUntil("#fc_page_tree_top","li").andSelf().addClass("fc_expandable fc_tree_open").removeClass("fc_tree_close")); b.children("dl").children(".fc_search_MenuTitle").text(a.menu_title);b.children("dl").children(".fc_search_PageTitle").text(a.page_title);b.children(".fc_page_link").children("a").children(".fc_page_tree_menu_title").removeClass().addClass("fc_page_tree_menu_title "+f).text(" "+a.menu_title);b.children(".fc_page_link > a:first").prop("title","Page title: "+a.page_title)}else return_error(c.process,a.message)}})});$("#fc_removePageSubmit").click(function(a){a.preventDefault();$(this).closest("form"); a=$(".page_tree_open_options");var b=a.find("input[name=page_id]").val(),c=$("div#fc_add_module").find('input[name="page_id"]').val(),d={page_id:b,_cat_ajax:1};dialog_confirm(cattranslate("Do you really want to delete this page?"),cattranslate("Remove page"),CAT_ADMIN_URL+"/pages/ajax_delete_page.php",d,"POST","JSON",!1,function(a,d,g){$("#fc_add_page input[type=reset]").click();d=$(this);g=d.prev();if(!0===a.success&&0===a.status){a=d.parent().parent().find(".fc_page_link").find(".fc_toggle_tree"); var e=d.parent().parent();d.remove();0===e.find("ul.ui-sortable").children("li").length&&a.remove()}else d.find(".fc_page_link").find(".fc_page_tree_menu_title").removeClass().addClass("fc_page_tree_menu_title icon-remove");$("#fc_add_page button:reset").click();c==b&&(location.href="undefined"!=typeof g?CAT_ADMIN_URL+"/pages/modify.php?page_id="+g.prop("id").replace("pageid_",""):CAT_ADMIN_URL+"/start/index.php")},a)});$("#fc_restorePageSubmit").click(function(a){a.preventDefault();$(this).closest("form"); a=$(".page_tree_open_options");var b={page_id:a.children("input[name=page_id]").val(),_cat_ajax:1};dialog_ajax("Restoring page",CAT_ADMIN_URL+"/pages/ajax_restore_page.php",b,"POST","JSON",!1,function(a,b,e){$("#fc_add_page input[type=reset]").click();b=$(this);!0===a.success?b.find(".fc_page_link").find(".fc_page_tree_menu_title").removeClass().addClass("fc_page_tree_menu_title icon-screen"):return_error(e.process,a.message)},a)});$("#fc_addPageChildSubmit").click(function(a){a.preventDefault(); $("#fc_addPage_parent_page_id").val($(".page_tree_open_options").children("input[name=page_id]").val());$(".fc_side_add").click()});$("select[id=fc_addPage_template]").change(function(){var a={_cat_ajax:1,template:$("#fc_addPage_template").val()};$.ajax({type:"POST",url:CAT_ADMIN_URL+"/settings/ajax_get_template_variants.php",dataType:"json",data:a,cache:!1,success:function(a,c,d){!0===a.success?($(this),$("#fc_default_template_variant").empty(),0<$(a.variants).size()?($.each(a.variants,function(a, b){$("<option/>").val(b).text(b).appendTo("#fc_default_template_variant")}),$("#fc_div_template_variants").show()):$("#fc_div_template_variants").hide(),!0===a.auto_add_modules?($("#fc_template_autoadd").prop("checked","checked"),$("#fc_div_template_autoadd").show()):$("#fc_div_template_autoadd").hide()):return_error(d.process,a.message)}})});$("#fc_add_page_close").click(function(a){a.preventDefault();$("button#fc_addPageReset").click()})});var dlg_title=cattranslate("Your session has expired!"),dlg_text=cattranslate("Please enter your login details to log in again."),txt_username=cattranslate("Username"),txt_password=cattranslate("Password"),txt_login=cattranslate("Login"),txt_details=cattranslate("Please enter your login details!"),sessionTimeoutDialog=!1; function sessionTimedOutDialog(){$("#sessionTimeoutDialog").dialog("close").dialog("destroy");$.ajax({type:"POST",url:CAT_ADMIN_URL+"/logout/index.php",dataType:"json",cache:!1,data:{_cat_ajax:1},success:function(a,b,c){}});var a=Math.random().toString(36).slice(2),b=Math.random().toString(36).slice(2),c={username_fieldname:"username_"+a,password_fieldname:"password_"+b,_cat_ajax:1,redirect:!1};$('<div id="sessionTimedOutDialog"></div>').html('<span class="icon icon-warning" style="color:#c00;"></span> '+ dlg_text+'<br /><br /><div id="login_error_field" style="display:none;color:#c00;padding:5px;"></div><br /><br /><form><label for="username" class="fc_label_200">'+txt_username+':</label><input type="text" name="username_'+a+'" id="username_'+a+'" /><br /><label for="pass" class="fc_label_200">'+txt_password+':</label><input type="password" name="password_'+b+'" id="password_'+b+'" /><br /><br />').dialog({modal:!0,closeOnEscape:!1,open:function(a,b){$(".ui-dialog-titlebar-close").hide()},title:dlg_title, width:600,height:300,buttons:[{text:txt_login,icons:{primary:"ui-icon-check"},open:function(){$(this).keypress(function(a){a.keyCode==$.ui.keyCode.ENTER&&$(this).find(".ui-dialog-buttonset button").eq(0).trigger("click")})},click:function(){var d=$(this);""==$("#username_"+a).val()||""==$("#password_"+b).val()?(""==$("#username_"+a).val()&&$("#username_"+a).css("border","1px solid #c00"),""==$("#password_"+b).val()&&$("#password_"+b).css("border","1px solid #c00"),$("#login_error_field").text(txt_details).show()): (c["username_"+a]=$("#username_"+a).val(),c["password_"+b]=$("#password_"+b).val(),$.ajax({type:"POST",url:CAT_ADMIN_URL+"/login/ajax_index.php",dataType:"json",data:c,cache:!1,success:function(a,b,c){!0===a.success?($(d).dialog("close").dialog("destroy"),sessionSetTimer(a.timer)):$("#login_error_field").text(a.message).show()}}))}}]}).on("keyup",function(a){13==a.keyCode&&$(".ui-button-text-icon-primary").click()});$(".ui-widget-overlay").css("background-image","none").css("background-color","#000").css("opacity", "0.9")}function sessionSetTimer(a){var b=$("#fc_session_counter");"undefined"!=typeof a&&b.text(toTimeString(a));timerId=setInterval(function(){var a=TimeStringToSecs(b.text())-1;300>a&&b.parent().addClass("fc_gradient_red");5==a&&$("#fc_dlg_timer").css("color","#c00");0==a&&(clearInterval(timerId),sessionTimedOutDialog());b.text(toTimeString(a));$("span#fc_dlg_timer").text(a)},1E3)}jQuery(document).ready(function(a){sessionSetTimer()});
"============================================================================ "File: avrgcc.vim "Description: Syntax checking plugin for syntastic "Maintainer: Karel <karelishere at gmail dot com> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ if exists('g:loaded_syntastic_c_avrgcc_checker') finish endif let g:loaded_syntastic_c_avrgcc_checker = 1 if !exists('g:syntastic_avrgcc_config_file') let g:syntastic_avrgcc_config_file = '.syntastic_avrgcc_config' endif let s:save_cpo = &cpo set cpo&vim let s:opt_x = { 'c': 'c', 'cpp': 'c++' } function! SyntaxCheckers_c_avrgcc_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'args_before': syntastic#c#ReadConfig(g:syntastic_avrgcc_config_file), \ 'args_after': '-x ' . get(s:opt_x, self.getFiletype(), '') . ' -fsyntax-only' }) let errorformat = \ '%-G%f:%s:,' . \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' . \ '%-GIn file included%.%#,' . \ '%-G %#from %f:%l\,,' . \ '%f:%l:%c: %trror: %m,' . \ '%f:%l:%c: %tarning: %m,' . \ '%f:%l:%c: %m,' . \ '%f:%l: %trror: %m,' . \ '%f:%l: %tarning: %m,'. \ '%f:%l: %m' return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'postprocess': ['compressWhitespace'] }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'avrgcc', \ 'exec': 'avr-gcc'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: avrgcc.vim "Description: Syntax checking plugin for syntastic "Maintainer: Karel <karelishere at gmail dot com> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ if exists('g:loaded_syntastic_c_avrgcc_checker') finish endif let g:loaded_syntastic_c_avrgcc_checker = 1 let s:save_cpo = &cpo set cpo&vim let s:opt_x = { 'c': 'c', 'cpp': 'c++' } function! SyntaxCheckers_c_avrgcc_GetLocList() dict let buf = bufnr('') let makeprg = self.makeprgBuild({ \ 'args_before': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'avrgcc_config_file')), \ 'args_after': '-x ' . get(s:opt_x, self.getFiletype(), '') . ' -fsyntax-only' }) let errorformat = \ '%-G%f:%s:,' . \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' . \ '%-GIn file included%.%#,' . \ '%-G %#from %f:%l\,,' . \ '%f:%l:%c: %trror: %m,' . \ '%f:%l:%c: %tarning: %m,' . \ '%f:%l:%c: %m,' . \ '%f:%l: %trror: %m,' . \ '%f:%l: %tarning: %m,'. \ '%f:%l: %m' return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'postprocess': ['compressWhitespace'] }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'avrgcc', \ 'exec': 'avr-gcc'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: clang_check.vim "Description: Syntax checking plugin for syntastic "Maintainer: Benjamin Bannier <bbannier at gmail dot com> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ if exists('g:loaded_syntastic_c_clang_check_checker') finish endif let g:loaded_syntastic_c_clang_check_checker = 1 if !exists('g:syntastic_clang_check_config_file') let g:syntastic_clang_check_config_file = '.syntastic_clang_check_config' endif if !exists('g:syntastic_c_clang_check_sort') let g:syntastic_c_clang_check_sort = 1 endif let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_clang_check_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'post_args': \ '-- ' . \ syntastic#c#ReadConfig(g:syntastic_clang_check_config_file) . ' ' . \ '-fshow-column ' . \ '-fshow-source-location ' . \ '-fno-caret-diagnostics ' . \ '-fno-color-diagnostics ' . \ '-fdiagnostics-format=clang' }) let errorformat = \ '%E%f:%l:%c: fatal error: %m,' . \ '%E%f:%l:%c: error: %m,' . \ '%W%f:%l:%c: warning: %m,' . \ '%-G%\m%\%%(LLVM ERROR:%\|No compilation database found%\)%\@!%.%#,' . \ '%E%m' let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' } return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'env': env, \ 'defaults': {'bufnr': bufnr('')}, \ 'returns': [0, 1] }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'clang_check', \ 'exec': 'clang-check'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: clang_check.vim "Description: Syntax checking plugin for syntastic "Maintainer: Benjamin Bannier <bbannier at gmail dot com> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ if exists('g:loaded_syntastic_c_clang_check_checker') finish endif let g:loaded_syntastic_c_clang_check_checker = 1 if !exists('g:syntastic_c_clang_check_sort') let g:syntastic_c_clang_check_sort = 1 endif let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_clang_check_GetLocList() dict let buf = bufnr('') let makeprg = self.makeprgBuild({ \ 'post_args': \ '-- ' . \ syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'clang_check_config_file')) . ' ' . \ '-fshow-column ' . \ '-fshow-source-location ' . \ '-fno-caret-diagnostics ' . \ '-fno-color-diagnostics ' . \ '-fdiagnostics-format=clang' }) let errorformat = \ '%E%f:%l:%c: fatal error: %m,' . \ '%E%f:%l:%c: error: %m,' . \ '%W%f:%l:%c: warning: %m,' . \ '%-G%\m%\%%(LLVM ERROR:%\|No compilation database found%\)%\@!%.%#,' . \ '%E%m' let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' } return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'env': env, \ 'defaults': {'bufnr': bufnr('')}, \ 'returns': [0, 1] }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'clang_check', \ 'exec': 'clang-check'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: clang_tidy.vim "Description: Syntax checking plugin for syntastic "Maintainer: Benjamin Bannier <bbannier at gmail dot com> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ if exists('g:loaded_syntastic_c_clang_tidy_checker') finish endif let g:loaded_syntastic_c_clang_tidy_checker = 1 if !exists('g:syntastic_clang_tidy_config_file') let g:syntastic_clang_tidy_config_file = '.syntastic_clang_tidy_config' endif if !exists('g:syntastic_c_clang_tidy_sort') let g:syntastic_c_clang_tidy_sort = 1 endif let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_clang_tidy_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'post_args': \ '-- ' . \ syntastic#c#ReadConfig(g:syntastic_clang_tidy_config_file) . ' ' . \ '-fshow-column ' . \ '-fshow-source-location ' . \ '-fno-caret-diagnostics ' . \ '-fno-color-diagnostics ' . \ '-fdiagnostics-format=clang' }) let errorformat = \ '%E%f:%l:%c: fatal error: %m,' . \ '%E%f:%l:%c: error: %m,' . \ '%W%f:%l:%c: warning: %m,' . \ '%-G%\m%\%%(LLVM ERROR:%\|No compilation database found%\)%\@!%.%#,' . \ '%E%m' let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' } return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'env': env, \ 'defaults': {'bufnr': bufnr('')}, \ 'returns': [0, 1] }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'clang_tidy', \ 'exec': 'clang-tidy'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: clang_tidy.vim "Description: Syntax checking plugin for syntastic "Maintainer: Benjamin Bannier <bbannier at gmail dot com> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ if exists('g:loaded_syntastic_c_clang_tidy_checker') finish endif let g:loaded_syntastic_c_clang_tidy_checker = 1 if !exists('g:syntastic_c_clang_tidy_sort') let g:syntastic_c_clang_tidy_sort = 1 endif let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_clang_tidy_GetLocList() dict let buf = bufnr('') let makeprg = self.makeprgBuild({ \ 'post_args': \ '-- ' . \ syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'clang_tidy_config_file')) . ' ' . \ '-fshow-column ' . \ '-fshow-source-location ' . \ '-fno-caret-diagnostics ' . \ '-fno-color-diagnostics ' . \ '-fdiagnostics-format=clang' }) let errorformat = \ '%E%f:%l:%c: fatal error: %m,' . \ '%E%f:%l:%c: error: %m,' . \ '%W%f:%l:%c: warning: %m,' . \ '%-G%\m%\%%(LLVM ERROR:%\|No compilation database found%\)%\@!%.%#,' . \ '%E%m' let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' } return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'env': env, \ 'defaults': {'bufnr': bufnr('')}, \ 'returns': [0, 1] }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'clang_tidy', \ 'exec': 'clang-tidy'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: cppcheck.vim "Description: Syntax checking plugin for syntastic using cppcheck.pl "Maintainer: LCD 47 <lcd047 at gmail dot com> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ if exists('g:loaded_syntastic_c_cppcheck_checker') finish endif let g:loaded_syntastic_c_cppcheck_checker = 1 if !exists('g:syntastic_cppcheck_config_file') let g:syntastic_cppcheck_config_file = '.syntastic_cppcheck_config' endif let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_cppcheck_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'args': syntastic#c#ReadConfig(g:syntastic_cppcheck_config_file), \ 'args_after': '-q --enable=style' }) let errorformat = \ '[%f:%l]: (%trror) %m,' . \ '[%f:%l]: (%tarning) %m,' . \ '[%f:%l]: (%ttyle) %m,' . \ '[%f:%l]: (%terformance) %m,' . \ '[%f:%l]: (%tortability) %m,' . \ '[%f:%l]: (%tnformation) %m,' . \ '[%f:%l]: (%tnconclusive) %m,' . \ '%-G%.%#' let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'preprocess': 'cppcheck', \ 'returns': [0] }) for e in loclist if e['type'] =~? '\m^[SPI]' let e['type'] = 'w' let e['subtype'] = 'Style' endif endfor return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'cppcheck'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: cppcheck.vim "Description: Syntax checking plugin for syntastic using cppcheck.pl "Maintainer: LCD 47 <lcd047 at gmail dot com> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ if exists('g:loaded_syntastic_c_cppcheck_checker') finish endif let g:loaded_syntastic_c_cppcheck_checker = 1 let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_cppcheck_GetLocList() dict let buf = bufnr('') let makeprg = self.makeprgBuild({ \ 'args': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'cppcheck_config_file')), \ 'args_after': '-q --enable=style' }) let errorformat = \ '[%f:%l]: (%trror) %m,' . \ '[%f:%l]: (%tarning) %m,' . \ '[%f:%l]: (%ttyle) %m,' . \ '[%f:%l]: (%terformance) %m,' . \ '[%f:%l]: (%tortability) %m,' . \ '[%f:%l]: (%tnformation) %m,' . \ '[%f:%l]: (%tnconclusive) %m,' . \ '%-G%.%#' let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'preprocess': 'cppcheck', \ 'returns': [0] }) for e in loclist if e['type'] =~? '\m^[SPI]' let e['type'] = 'w' let e['subtype'] = 'Style' endif endfor return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'cppcheck'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: oclint.vim "Description: Syntax checking plugin for syntastic "Maintainer: "UnCO" Lin <undercooled aT lavabit com> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ if exists('g:loaded_syntastic_c_oclint_checker') finish endif let g:loaded_syntastic_c_oclint_checker = 1 if !exists('g:syntastic_oclint_config_file') let g:syntastic_oclint_config_file = '.syntastic_oclint_config' endif if !exists('g:syntastic_c_oclint_sort') let g:syntastic_c_oclint_sort = 1 endif let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_oclint_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'post_args': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file) }) let errorformat = \ '%E%f:%l:%c: fatal error: %m,' . \ '%E%f:%l:%c: error: %m,' . \ '%W%f:%l:%c: warning: %m,' . \ '%E%f:%l:%c: %m,' . \ '%-G%.%#' let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'subtype': 'Style', \ 'postprocess': ['compressWhitespace'], \ 'returns': [0, 3, 5] }) for e in loclist if e['text'] =~# '\v P3( |$)' let e['type'] = 'W' endif let e['text'] = substitute(e['text'], '\m\C P[1-3]$', '', '') let e['text'] = substitute(e['text'], '\m\C P[1-3] ', ': ', '') endfor return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'oclint'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: oclint.vim "Description: Syntax checking plugin for syntastic "Maintainer: "UnCO" Lin <undercooled aT lavabit com> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ if exists('g:loaded_syntastic_c_oclint_checker') finish endif let g:loaded_syntastic_c_oclint_checker = 1 if !exists('g:syntastic_c_oclint_sort') let g:syntastic_c_oclint_sort = 1 endif let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_oclint_GetLocList() dict let buf = bufnr('') let makeprg = self.makeprgBuild({ \ 'post_args': '-- -c ' . syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'oclint_config_file') }) let errorformat = \ '%E%f:%l:%c: fatal error: %m,' . \ '%E%f:%l:%c: error: %m,' . \ '%W%f:%l:%c: warning: %m,' . \ '%E%f:%l:%c: %m,' . \ '%-G%.%#' let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'subtype': 'Style', \ 'postprocess': ['compressWhitespace'], \ 'returns': [0, 3, 5] }) for e in loclist if e['text'] =~# '\v P3( |$)' let e['type'] = 'W' endif let e['text'] = substitute(e['text'], '\m\C P[1-3]$', '', '') let e['text'] = substitute(e['text'], '\m\C P[1-3] ', ': ', '') endfor return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'oclint'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: pc_lint.vim "Description: Syntax checking plugin for syntastic "Maintainer: Steve Bragg <steve at empresseffects dot com> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ if exists('g:loaded_syntastic_c_pc_lint_checker') finish endif let g:loaded_syntastic_c_pc_lint_checker = 1 let s:save_cpo = &cpo set cpo&vim if !exists('g:syntastic_pc_lint_config_file') let g:syntastic_pc_lint_config_file = 'options.lnt' endif function! SyntaxCheckers_c_pc_lint_GetLocList() dict let buf = bufnr('') let config = syntastic#util#findFileInParent(g:syntastic_pc_lint_config_file, fnamemodify(bufname(buf), ':p:h')) call self.log('config =', config) " -hFs1 - show filename, add space after messages, try to make message 1 line " -width(0,0) - make sure there are no line breaks " -t - set tab size " -v - turn off verbosity let makeprg = self.makeprgBuild({ \ 'args': (filereadable(config) ? syntastic#util#shescape(fnamemodify(config, ':p')) : ''), \ 'args_after': ['-hFs1', '-width(0,0)', '-t' . &tabstop, '-format=%f:%l:%C:%t:%n:%m'] }) let errorformat = \ '%E%f:%l:%v:Error:%n:%m,' . \ '%W%f:%l:%v:Warning:%n:%m,' . \ '%I%f:%l:%v:Info:%n:%m,' . \ '%-G%.%#' let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'postprocess': ['cygwinRemoveCR'] }) for e in loclist if e['type'] ==? 'I' let e['type'] = 'W' let e['subtype'] = 'Style' endif endfor return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'pc_lint', \ 'exec': 'lint-nt'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: pc_lint.vim "Description: Syntax checking plugin for syntastic "Maintainer: Steve Bragg <steve at empresseffects dot com> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ if exists('g:loaded_syntastic_c_pc_lint_checker') finish endif let g:loaded_syntastic_c_pc_lint_checker = 1 let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_pc_lint_GetLocList() dict let buf = bufnr('') let config = syntastic#util#findFileInParent(syntastic#util#bufVar(buf, 'pc_lint_config_file'), fnamemodify(bufname(buf), ':p:h')) call self.log('config =', config) " -hFs1 - show filename, add space after messages, try to make message 1 line " -width(0,0) - make sure there are no line breaks " -t - set tab size " -v - turn off verbosity let makeprg = self.makeprgBuild({ \ 'args': (filereadable(config) ? syntastic#util#shescape(fnamemodify(config, ':p')) : ''), \ 'args_after': ['-hFs1', '-width(0,0)', '-t' . &tabstop, '-format=%f:%l:%C:%t:%n:%m'] }) let errorformat = \ '%E%f:%l:%v:Error:%n:%m,' . \ '%W%f:%l:%v:Warning:%n:%m,' . \ '%I%f:%l:%v:Info:%n:%m,' . \ '%-G%.%#' let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'postprocess': ['cygwinRemoveCR'] }) for e in loclist if e['type'] ==? 'I' let e['type'] = 'W' let e['subtype'] = 'Style' endif endfor return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'pc_lint', \ 'exec': 'lint-nt'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: sparse.vim "Description: Syntax checking plugin for syntastic using sparse.pl "Maintainer: Daniel Walker <dwalker at fifo99 dot com> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ if exists('g:loaded_syntastic_c_sparse_checker') finish endif let g:loaded_syntastic_c_sparse_checker = 1 if !exists('g:syntastic_sparse_config_file') let g:syntastic_sparse_config_file = '.syntastic_sparse_config' endif let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_sparse_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'args': syntastic#c#ReadConfig(g:syntastic_sparse_config_file), \ 'args_after': '-ftabstop=' . &ts }) let errorformat = \ '%f:%l:%v: %trror: %m,' . \ '%f:%l:%v: %tarning: %m,' let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'defaults': {'bufnr': bufnr('')}, \ 'returns': [0, 1] }) return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'sparse'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: sparse.vim "Description: Syntax checking plugin for syntastic using sparse.pl "Maintainer: Daniel Walker <dwalker at fifo99 dot com> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ if exists('g:loaded_syntastic_c_sparse_checker') finish endif let g:loaded_syntastic_c_sparse_checker = 1 let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_sparse_GetLocList() dict let buf = bufnr('') let makeprg = self.makeprgBuild({ \ 'args': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'sparse_config_file')), \ 'args_after': '-ftabstop=' . &ts }) let errorformat = \ '%f:%l:%v: %trror: %m,' . \ '%f:%l:%v: %tarning: %m,' let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'defaults': {'bufnr': bufnr('')}, \ 'returns': [0, 1] }) return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'sparse'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: splint.vim "Description: Syntax checking plugin for syntastic "Maintainer: LCD 47 <lcd047 at gmail dot com> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ if exists('g:loaded_syntastic_c_splint_checker') finish endif let g:loaded_syntastic_c_splint_checker = 1 if !exists('g:syntastic_splint_config_file') let g:syntastic_splint_config_file = '.syntastic_splint_config' endif let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_splint_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'args': syntastic#c#ReadConfig(g:syntastic_splint_config_file), \ 'args_after': '-showfunc -hints +quiet' }) let errorformat = \ '%-G%f:%l:%v: %[%#]%[%#]%[%#] Internal Bug %.%#,' . \ '%-G%f(%l\,%v): %[%#]%[%#]%[%#] Internal Bug %.%#,' . \ '%W%f:%l:%v: %m,' . \ '%W%f(%l\,%v): %m,' . \ '%W%f:%l: %m,' . \ '%W%f(%l): %m,' . \ '%-C %\+In file included from %.%#,' . \ '%-C %\+from %.%#,' . \ '%+C %.%#' return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'subtype': 'Style', \ 'postprocess': ['compressWhitespace'], \ 'defaults': {'type': 'W'} }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'splint'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: splint.vim "Description: Syntax checking plugin for syntastic "Maintainer: LCD 47 <lcd047 at gmail dot com> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ if exists('g:loaded_syntastic_c_splint_checker') finish endif let g:loaded_syntastic_c_splint_checker = 1 let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_splint_GetLocList() dict let buf = bufnr('') let makeprg = self.makeprgBuild({ \ 'args': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'splint_config_file')), \ 'args_after': '-showfunc -hints +quiet' }) let errorformat = \ '%-G%f:%l:%v: %[%#]%[%#]%[%#] Internal Bug %.%#,' . \ '%-G%f(%l\,%v): %[%#]%[%#]%[%#] Internal Bug %.%#,' . \ '%W%f:%l:%v: %m,' . \ '%W%f(%l\,%v): %m,' . \ '%W%f:%l: %m,' . \ '%W%f(%l): %m,' . \ '%-C %\+In file included from %.%#,' . \ '%-C %\+from %.%#,' . \ '%+C %.%#' return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'subtype': 'Style', \ 'postprocess': ['compressWhitespace'], \ 'defaults': {'type': 'W'} }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'splint'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: verapp.vim "Description: Syntax checking plugin for syntastic "Maintainer: Lucas Verney <phyks@phyks.me> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. " " Tested with Vera++ 1.3.0 "============================================================================ if exists('g:loaded_syntastic_cpp_verapp_checker') finish endif let g:loaded_syntastic_cpp_verapp_checker = 1 if !exists('g:syntastic_verapp_config_file') let g:syntastic_verapp_config_file = '.syntastic_verapp_config' endif let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_cpp_verapp_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'args': syntastic#c#ReadConfig(g:syntastic_verapp_config_file), \ 'args_after': '--show-rule --no-duplicate -S -c -' }) let errorformat = '%f:%t:%l:%c:%m' return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'preprocess': 'checkstyle', \ 'subtype': 'Style' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'cpp', \ 'name': 'verapp', \ 'exec': 'vera++'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: verapp.vim "Description: Syntax checking plugin for syntastic "Maintainer: Lucas Verney <phyks@phyks.me> "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. " " Tested with Vera++ 1.3.0 "============================================================================ if exists('g:loaded_syntastic_cpp_verapp_checker') finish endif let g:loaded_syntastic_cpp_verapp_checker = 1 let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_cpp_verapp_GetLocList() dict let buf = bufnr('') let makeprg = self.makeprgBuild({ \ 'args': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'verapp_config_file')), \ 'args_after': '--show-rule --no-duplicate -S -c -' }) let errorformat = '%f:%t:%l:%c:%m' return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'preprocess': 'checkstyle', \ 'subtype': 'Style' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'cpp', \ 'name': 'verapp', \ 'exec': 'vera++'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: cuda.vim "Description: Syntax checking plugin for syntastic "Author: Hannes Schulz <schulz at ais dot uni-bonn dot de> " "============================================================================ if exists('g:loaded_syntastic_cuda_nvcc_checker') finish endif let g:loaded_syntastic_cuda_nvcc_checker = 1 if !exists('g:syntastic_cuda_config_file') let g:syntastic_cuda_config_file = '.syntastic_cuda_config' endif let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_cuda_nvcc_GetLocList() dict let buf = bufnr('') let arch_flag = syntastic#util#bufVar(buf, 'cuda_arch') if arch_flag !=# '' let arch_flag = '-arch=' . arch_flag call syntastic#log#oneTimeWarn('variable g:syntastic_cuda_arch is deprecated, ' . \ 'please add ' . string(arch_flag) . ' to g:syntastic_cuda_nvcc_args instead') endif let build_opts = {} let dummy = '' if index(['h', 'hpp', 'cuh'], fnamemodify(bufname(buf), ':e'), 0, 1) >= 0 if syntastic#util#bufVar(buf, 'cuda_check_header', 0) let dummy = fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash() . '.syntastic_dummy.cu' let build_opts = { \ 'exe_before': 'echo > ' . syntastic#util#shescape(dummy) . ' ;', \ 'fname_before': '.syntastic_dummy.cu -include' } else return [] endif endif call extend(build_opts, { \ 'args_before': arch_flag . ' --cuda -O0 -I .', \ 'args': syntastic#c#ReadConfig(g:syntastic_cuda_config_file), \ 'args_after': '-Xcompiler -fsyntax-only', \ 'tail_after': syntastic#c#NullOutput() }) let makeprg = self.makeprgBuild(build_opts) let errorformat = \ '%*[^"]"%f"%*\D%l: %m,'. \ '"%f"%*\D%l: %m,'. \ '%-G%f:%l: (Each undeclared identifier is reported only once,'. \ '%-G%f:%l: for each function it appears in.),'. \ '%f:%l:%c:%m,'. \ '%f(%l):%m,'. \ '%f:%l:%m,'. \ '"%f"\, line %l%*\D%c%*[^ ] %m,'. \ '%D%*\a[%*\d]: Entering directory `%f'','. \ '%X%*\a[%*\d]: Leaving directory `%f'','. \ '%D%*\a: Entering directory `%f'','. \ '%X%*\a: Leaving directory `%f'','. \ '%DMaking %*\a in %f,'. \ '%f|%l| %m' let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'defaults': {'type': 'E'} }) for e in loclist let pat = matchstr(e['text'], '\m\c^\s*warning:\s*\zs.*') if pat !=# '' let e['text'] = pat let e['type'] = 'W' endif endfor if dummy !=# '' call delete(dummy) endif return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'cuda', \ 'name': 'nvcc'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
"============================================================================ "File: cuda.vim "Description: Syntax checking plugin for syntastic "Author: Hannes Schulz <schulz at ais dot uni-bonn dot de> " "============================================================================ if exists('g:loaded_syntastic_cuda_nvcc_checker') finish endif let g:loaded_syntastic_cuda_nvcc_checker = 1 let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_cuda_nvcc_GetLocList() dict let buf = bufnr('') let arch_flag = syntastic#util#bufVar(buf, 'cuda_arch') if arch_flag !=# '' let arch_flag = '-arch=' . arch_flag call syntastic#log#oneTimeWarn('variable g:syntastic_cuda_arch is deprecated, ' . \ 'please add ' . string(arch_flag) . ' to g:syntastic_cuda_nvcc_args instead') endif let build_opts = {} let dummy = '' if index(['h', 'hpp', 'cuh'], fnamemodify(bufname(buf), ':e'), 0, 1) >= 0 if syntastic#util#bufVar(buf, 'cuda_check_header', 0) let dummy = fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash() . '.syntastic_dummy.cu' let build_opts = { \ 'exe_before': 'echo > ' . syntastic#util#shescape(dummy) . ' ;', \ 'fname_before': '.syntastic_dummy.cu -include' } else return [] endif endif call extend(build_opts, { \ 'args_before': arch_flag . ' --cuda -O0 -I .', \ 'args': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'cuda_config_file'), \ 'args_after': '-Xcompiler -fsyntax-only', \ 'tail_after': syntastic#c#NullOutput() }) let makeprg = self.makeprgBuild(build_opts) let errorformat = \ '%*[^"]"%f"%*\D%l: %m,'. \ '"%f"%*\D%l: %m,'. \ '%-G%f:%l: (Each undeclared identifier is reported only once,'. \ '%-G%f:%l: for each function it appears in.),'. \ '%f:%l:%c:%m,'. \ '%f(%l):%m,'. \ '%f:%l:%m,'. \ '"%f"\, line %l%*\D%c%*[^ ] %m,'. \ '%D%*\a[%*\d]: Entering directory `%f'','. \ '%X%*\a[%*\d]: Leaving directory `%f'','. \ '%D%*\a: Entering directory `%f'','. \ '%X%*\a: Leaving directory `%f'','. \ '%DMaking %*\a in %f,'. \ '%f|%l| %m' let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'defaults': {'type': 'E'} }) for e in loclist let pat = matchstr(e['text'], '\m\c^\s*warning:\s*\zs.*') if pat !=# '' let e['text'] = pat let e['type'] = 'W' endif endfor if dummy !=# '' call delete(dummy) endif return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'cuda', \ 'name': 'nvcc'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set sw=4 sts=4 et fdm=marker:
None
Attr.ClassUseCDATA TYPE: bool/null DEFAULT: null VERSION: 4.0.0 --DESCRIPTION-- If null, class will auto-detect the doctype and, if matching XHTML 1.1 or XHTML 2.0, will use the restrictive NMTOKENS specification of class. Otherwise, it will use a relaxed CDATA definition. If true, the relaxed CDATA definition is forced; if false, the NMTOKENS definition is forced. To get behavior of HTML Purifier prior to 4.0.0, set this directive to false. Some rational behind the auto-detection: in previous versions of HTML Purifier, it was assumed that the form of class was NMTOKENS, as specified by the XHTML Modularization (representing XHTML 1.1 and XHTML 2.0). The DTDs for HTML 4.01 and XHTML 1.0, however specify class as CDATA. HTML 5 effectively defines it as CDATA, but with the additional constraint that each name should be unique (this is not explicitly outlined in previous specifications). --# vim: et sw=4 sts=4
None
URI.Base TYPE: string/null VERSION: 2.1.0 DEFAULT: NULL --DESCRIPTION-- <p> The base URI is the URI of the document this purified HTML will be inserted into. This information is important if HTML Purifier needs to calculate absolute URIs from relative URIs, such as when %URI.MakeAbsolute is on. You may use a non-absolute URI for this value, but behavior may vary (%URI.MakeAbsolute deals nicely with both absolute and relative paths, but forwards-compatibility is not guaranteed). <strong>Warning:</strong> If set, the scheme on this URI overrides the one specified by %URI.DefaultScheme. </p> --# vim: et sw=4 sts=4
None
a:253:{s:4:"fnof";s:2:"ƒ";s:5:"Alpha";s:2:"Α";s:4:"Beta";s:2:"Β";s:5:"Gamma";s:2:"Γ";s:5:"Delta";s:2:"Δ";s:7:"Epsilon";s:2:"Ε";s:4:"Zeta";s:2:"Ζ";s:3:"Eta";s:2:"Η";s:5:"Theta";s:2:"Θ";s:4:"Iota";s:2:"Ι";s:5:"Kappa";s:2:"Κ";s:6:"Lambda";s:2:"Λ";s:2:"Mu";s:2:"Μ";s:2:"Nu";s:2:"Ν";s:2:"Xi";s:2:"Ξ";s:7:"Omicron";s:2:"Ο";s:2:"Pi";s:2:"Π";s:3:"Rho";s:2:"Ρ";s:5:"Sigma";s:2:"Σ";s:3:"Tau";s:2:"Τ";s:7:"Upsilon";s:2:"Υ";s:3:"Phi";s:2:"Φ";s:3:"Chi";s:2:"Χ";s:3:"Psi";s:2:"Ψ";s:5:"Omega";s:2:"Ω";s:5:"alpha";s:2:"α";s:4:"beta";s:2:"β";s:5:"gamma";s:2:"γ";s:5:"delta";s:2:"δ";s:7:"epsilon";s:2:"ε";s:4:"zeta";s:2:"ζ";s:3:"eta";s:2:"η";s:5:"theta";s:2:"θ";s:4:"iota";s:2:"ι";s:5:"kappa";s:2:"κ";s:6:"lambda";s:2:"λ";s:2:"mu";s:2:"μ";s:2:"nu";s:2:"ν";s:2:"xi";s:2:"ξ";s:7:"omicron";s:2:"ο";s:2:"pi";s:2:"π";s:3:"rho";s:2:"ρ";s:6:"sigmaf";s:2:"ς";s:5:"sigma";s:2:"σ";s:3:"tau";s:2:"τ";s:7:"upsilon";s:2:"υ";s:3:"phi";s:2:"φ";s:3:"chi";s:2:"χ";s:3:"psi";s:2:"ψ";s:5:"omega";s:2:"ω";s:8:"thetasym";s:2:"ϑ";s:5:"upsih";s:2:"ϒ";s:3:"piv";s:2:"ϖ";s:4:"bull";s:3:"•";s:6:"hellip";s:3:"…";s:5:"prime";s:3:"′";s:5:"Prime";s:3:"″";s:5:"oline";s:3:"‾";s:5:"frasl";s:3:"⁄";s:6:"weierp";s:3:"℘";s:5:"image";s:3:"ℑ";s:4:"real";s:3:"ℜ";s:5:"trade";s:3:"™";s:7:"alefsym";s:3:"ℵ";s:4:"larr";s:3:"←";s:4:"uarr";s:3:"↑";s:4:"rarr";s:3:"→";s:4:"darr";s:3:"↓";s:4:"harr";s:3:"↔";s:5:"crarr";s:3:"↵";s:4:"lArr";s:3:"⇐";s:4:"uArr";s:3:"⇑";s:4:"rArr";s:3:"⇒";s:4:"dArr";s:3:"⇓";s:4:"hArr";s:3:"⇔";s:6:"forall";s:3:"∀";s:4:"part";s:3:"∂";s:5:"exist";s:3:"∃";s:5:"empty";s:3:"∅";s:5:"nabla";s:3:"∇";s:4:"isin";s:3:"∈";s:5:"notin";s:3:"∉";s:2:"ni";s:3:"∋";s:4:"prod";s:3:"∏";s:3:"sum";s:3:"∑";s:5:"minus";s:3:"−";s:6:"lowast";s:3:"∗";s:5:"radic";s:3:"√";s:4:"prop";s:3:"∝";s:5:"infin";s:3:"∞";s:3:"ang";s:3:"∠";s:3:"and";s:3:"∧";s:2:"or";s:3:"∨";s:3:"cap";s:3:"∩";s:3:"cup";s:3:"∪";s:3:"int";s:3:"∫";s:6:"there4";s:3:"∴";s:3:"sim";s:3:"∼";s:4:"cong";s:3:"≅";s:5:"asymp";s:3:"≈";s:2:"ne";s:3:"≠";s:5:"equiv";s:3:"≡";s:2:"le";s:3:"≤";s:2:"ge";s:3:"≥";s:3:"sub";s:3:"⊂";s:3:"sup";s:3:"⊃";s:4:"nsub";s:3:"⊄";s:4:"sube";s:3:"⊆";s:4:"supe";s:3:"⊇";s:5:"oplus";s:3:"⊕";s:6:"otimes";s:3:"⊗";s:4:"perp";s:3:"⊥";s:4:"sdot";s:3:"⋅";s:5:"lceil";s:3:"⌈";s:5:"rceil";s:3:"⌉";s:6:"lfloor";s:3:"⌊";s:6:"rfloor";s:3:"⌋";s:4:"lang";s:3:"〈";s:4:"rang";s:3:"〉";s:3:"loz";s:3:"◊";s:6:"spades";s:3:"♠";s:5:"clubs";s:3:"♣";s:6:"hearts";s:3:"♥";s:5:"diams";s:3:"♦";s:4:"quot";s:1:""";s:3:"amp";s:1:"&";s:2:"lt";s:1:"<";s:2:"gt";s:1:">";s:4:"apos";s:1:"'";s:5:"OElig";s:2:"Œ";s:5:"oelig";s:2:"œ";s:6:"Scaron";s:2:"Š";s:6:"scaron";s:2:"š";s:4:"Yuml";s:2:"Ÿ";s:4:"circ";s:2:"ˆ";s:5:"tilde";s:2:"˜";s:4:"ensp";s:3:" ";s:4:"emsp";s:3:" ";s:6:"thinsp";s:3:" ";s:4:"zwnj";s:3:"‌";s:3:"zwj";s:3:"‍";s:3:"lrm";s:3:"‎";s:3:"rlm";s:3:"‏";s:5:"ndash";s:3:"–";s:5:"mdash";s:3:"—";s:5:"lsquo";s:3:"‘";s:5:"rsquo";s:3:"’";s:5:"sbquo";s:3:"‚";s:5:"ldquo";s:3:"“";s:5:"rdquo";s:3:"”";s:5:"bdquo";s:3:"„";s:6:"dagger";s:3:"†";s:6:"Dagger";s:3:"‡";s:6:"permil";s:3:"‰";s:6:"lsaquo";s:3:"‹";s:6:"rsaquo";s:3:"›";s:4:"euro";s:3:"€";s:4:"nbsp";s:2:" ";s:5:"iexcl";s:2:"¡";s:4:"cent";s:2:"¢";s:5:"pound";s:2:"£";s:6:"curren";s:2:"¤";s:3:"yen";s:2:"¥";s:6:"brvbar";s:2:"¦";s:4:"sect";s:2:"§";s:3:"uml";s:2:"¨";s:4:"copy";s:2:"©";s:4:"ordf";s:2:"ª";s:5:"laquo";s:2:"«";s:3:"not";s:2:"¬";s:3:"shy";s:2:"­";s:3:"reg";s:2:"®";s:4:"macr";s:2:"¯";s:3:"deg";s:2:"°";s:6:"plusmn";s:2:"±";s:4:"sup2";s:2:"²";s:4:"sup3";s:2:"³";s:5:"acute";s:2:"´";s:5:"micro";s:2:"µ";s:4:"para";s:2:"¶";s:6:"middot";s:2:"·";s:5:"cedil";s:2:"¸";s:4:"sup1";s:2:"¹";s:4:"ordm";s:2:"º";s:5:"raquo";s:2:"»";s:6:"frac14";s:2:"¼";s:6:"frac12";s:2:"½";s:6:"frac34";s:2:"¾";s:6:"iquest";s:2:"¿";s:6:"Agrave";s:2:"À";s:6:"Aacute";s:2:"Á";s:5:"Acirc";s:2:"Â";s:6:"Atilde";s:2:"Ã";s:4:"Auml";s:2:"Ä";s:5:"Aring";s:2:"Å";s:5:"AElig";s:2:"Æ";s:6:"Ccedil";s:2:"Ç";s:6:"Egrave";s:2:"È";s:6:"Eacute";s:2:"É";s:5:"Ecirc";s:2:"Ê";s:4:"Euml";s:2:"Ë";s:6:"Igrave";s:2:"Ì";s:6:"Iacute";s:2:"Í";s:5:"Icirc";s:2:"Î";s:4:"Iuml";s:2:"Ï";s:3:"ETH";s:2:"Ð";s:6:"Ntilde";s:2:"Ñ";s:6:"Ograve";s:2:"Ò";s:6:"Oacute";s:2:"Ó";s:5:"Ocirc";s:2:"Ô";s:6:"Otilde";s:2:"Õ";s:4:"Ouml";s:2:"Ö";s:5:"times";s:2:"×";s:6:"Oslash";s:2:"Ø";s:6:"Ugrave";s:2:"Ù";s:6:"Uacute";s:2:"Ú";s:5:"Ucirc";s:2:"Û";s:4:"Uuml";s:2:"Ü";s:6:"Yacute";s:2:"Ý";s:5:"THORN";s:2:"Þ";s:5:"szlig";s:2:"ß";s:6:"agrave";s:2:"à";s:6:"aacute";s:2:"á";s:5:"acirc";s:2:"â";s:6:"atilde";s:2:"ã";s:4:"auml";s:2:"ä";s:5:"aring";s:2:"å";s:5:"aelig";s:2:"æ";s:6:"ccedil";s:2:"ç";s:6:"egrave";s:2:"è";s:6:"eacute";s:2:"é";s:5:"ecirc";s:2:"ê";s:4:"euml";s:2:"ë";s:6:"igrave";s:2:"ì";s:6:"iacute";s:2:"í";s:5:"icirc";s:2:"î";s:4:"iuml";s:2:"ï";s:3:"eth";s:2:"ð";s:6:"ntilde";s:2:"ñ";s:6:"ograve";s:2:"ò";s:6:"oacute";s:2:"ó";s:5:"ocirc";s:2:"ô";s:6:"otilde";s:2:"õ";s:4:"ouml";s:2:"ö";s:6:"divide";s:2:"÷";s:6:"oslash";s:2:"ø";s:6:"ugrave";s:2:"ù";s:6:"uacute";s:2:"ú";s:5:"ucirc";s:2:"û";s:4:"uuml";s:2:"ü";s:6:"yacute";s:2:"ý";s:5:"thorn";s:2:"þ";s:4:"yuml";s:2:"ÿ";}
None
function toggleWriteability(id_of_patient, checked) { document.getElementById(id_of_patient).disabled = checked; } // vim: et sw=4 sts=4
None
{ "file": "HTMLPurifier.includes.php", "class": "HTMLPurifier", "params": [] }
from __future__ import unicode_literals from django.apps import apps from django.utils.html import format_html_join from .permissions import permission_cabinet_view def jstree_data(node, selected_node): result = [] result.append('{') result.append('"text": "{}",'.format(node.label)) result.append( '"state": {{ "opened": true, "selected": {} }},'.format( 'true' if node == selected_node else 'false' ) ) result.append( '"data": {{ "href": "{}" }},'.format(node.get_absolute_url()) ) children = node.get_children().order_by('label',) if children: result.append('"children" : [') for child in children: result.extend(jstree_data(node=child, selected_node=selected_node)) result.append(']') result.append('},') return result def widget_document_cabinets(document, user): """ A cabinet widget that displays the cabinets for the given document """ AccessControlList = apps.get_model( app_label='acls', model_name='AccessControlList' ) cabinets = AccessControlList.objects.filter_by_access( permission_cabinet_view, user, queryset=document.document_cabinets().all() ) return format_html_join( '\n', '<div class="cabinet-display">{}</div>', ( (cabinet.get_full_path(),) for cabinet in cabinets ) )
from __future__ import unicode_literals from django.apps import apps from django.utils.html import format_html, format_html_join from .permissions import permission_cabinet_view def jstree_data(node, selected_node): result = [] result.append('{') result.append(format_html('"text": "{}",', node.label)) result.append( '"state": {{ "opened": true, "selected": {} }},'.format( 'true' if node == selected_node else 'false' ) ) result.append( '"data": {{ "href": "{}" }},'.format(node.get_absolute_url()) ) children = node.get_children().order_by('label',) if children: result.append('"children" : [') for child in children: result.extend(jstree_data(node=child, selected_node=selected_node)) result.append(']') result.append('},') return result def widget_document_cabinets(document, user): """ A cabinet widget that displays the cabinets for the given document """ AccessControlList = apps.get_model( app_label='acls', model_name='AccessControlList' ) cabinets = AccessControlList.objects.filter_by_access( permission_cabinet_view, user, queryset=document.document_cabinets().all() ) return format_html_join( '\n', '<div class="cabinet-display">{}</div>', ( (cabinet.get_full_path(),) for cabinet in cabinets ) )
from __future__ import absolute_import, unicode_literals from django import forms from django.apps import apps from django.template.loader import render_to_string from django.utils.safestring import mark_safe from .permissions import permission_tag_view class TagFormWidget(forms.SelectMultiple): option_template_name = 'tags/forms/widgets/tag_select_option.html' def __init__(self, *args, **kwargs): self.queryset = kwargs.pop('queryset') return super(TagFormWidget, self).__init__(*args, **kwargs) def create_option(self, name, value, label, selected, index, subindex=None, attrs=None): result = super(TagFormWidget, self).create_option( name=name, value=value, label=label, selected=selected, index=index, subindex=subindex, attrs=attrs ) result['attrs']['data-color'] = self.queryset.get(pk=value).color return result def widget_document_tags(document, user): """ A tag widget that displays the tags for the given document """ AccessControlList = apps.get_model( app_label='acls', model_name='AccessControlList' ) result = ['<div class="tag-container">'] tags = AccessControlList.objects.filter_by_access( permission_tag_view, user, queryset=document.attached_tags().all() ) for tag in tags: result.append(widget_single_tag(tag)) result.append('</div>') return mark_safe(''.join(result)) def widget_single_tag(tag): return render_to_string('tags/tag_widget.html', {'tag': tag})
from __future__ import absolute_import, unicode_literals from django import forms from django.apps import apps from django.template.loader import render_to_string from django.utils.html import conditional_escape from django.utils.safestring import mark_safe from .permissions import permission_tag_view class TagFormWidget(forms.SelectMultiple): option_template_name = 'tags/forms/widgets/tag_select_option.html' def __init__(self, *args, **kwargs): self.queryset = kwargs.pop('queryset') return super(TagFormWidget, self).__init__(*args, **kwargs) def create_option(self, name, value, label, selected, index, subindex=None, attrs=None): result = super(TagFormWidget, self).create_option( name=name, value=value, label='{}'.format(conditional_escape(label)), selected=selected, index=index, subindex=subindex, attrs=attrs ) result['attrs']['data-color'] = self.queryset.get(pk=value).color return result def widget_document_tags(document, user): """ A tag widget that displays the tags for the given document """ AccessControlList = apps.get_model( app_label='acls', model_name='AccessControlList' ) result = ['<div class="tag-container">'] tags = AccessControlList.objects.filter_by_access( permission_tag_view, user, queryset=document.attached_tags().all() ) for tag in tags: result.append(widget_single_tag(tag)) result.append('</div>') return mark_safe(''.join(result)) def widget_single_tag(tag): return render_to_string('tags/tag_widget.html', {'tag': tag})
buildscript { repositories { mavenLocal() jcenter() } dependencies { } } subprojects { version = '3.0.3' } apply plugin: 'groovy' apply plugin: 'idea' group = 'com.bertramlabs.plugins' repositories { jcenter() mavenCentral() } // groovydoc { // groovyClasspath = configurations.doc // } dependencies { compile 'org.codehaus.groovy:groovy:2.0.7' compile 'org.codehaus.groovy:groovy-templates:2.0.7' compile 'org.mozilla:rhino:1.7R4' // compile 'com.google.javascript:closure-compiler-unshaded:v20170124' compile 'com.google.javascript:closure-compiler-unshaded:v20160713' // compile 'com.google.javascript:closure-compiler-unshaded:v20171112' compile 'commons-logging:commons-logging:1.1.1' testCompile 'org.spockframework:spock-core:0.7-groovy-2.0' } test { testLogging { exceptionFormat = 'full' showStandardStreams = true } } task wrapper(type: Wrapper) { gradleVersion = '3.3' }
buildscript { repositories { mavenLocal() jcenter() } dependencies { } } subprojects { version = '3.0.4' } apply plugin: 'groovy' apply plugin: 'idea' group = 'com.bertramlabs.plugins' repositories { jcenter() mavenCentral() } // groovydoc { // groovyClasspath = configurations.doc // } dependencies { compile 'org.codehaus.groovy:groovy:2.0.7' compile 'org.codehaus.groovy:groovy-templates:2.0.7' compile 'org.mozilla:rhino:1.7R4' // compile 'com.google.javascript:closure-compiler-unshaded:v20170124' compile 'com.google.javascript:closure-compiler-unshaded:v20160713' // compile 'com.google.javascript:closure-compiler-unshaded:v20171112' compile 'commons-logging:commons-logging:1.1.1' testCompile 'org.spockframework:spock-core:0.7-groovy-2.0' } test { testLogging { exceptionFormat = 'full' showStandardStreams = true } } task wrapper(type: Wrapper) { gradleVersion = '3.3' }
{ "name": "simditor", "version": "2.3.21", "description": "A simple online editor", "keywords": "editor simditor", "repository": { "type": "git", "url": "git@github.com:mycolorway/simditor.git" }, "author": "farthinker <farthinker@gmail.com>", "license": "MIT", "bugs": { "url": "https://github.com/mycolorway/simditor/issues" }, "scripts": { "test": "grunt test --verbose" }, "main": "lib/simditor.js", "files": [ "lib", "src", "styles" ], "homepage": "http://simditor.tower.im", "dependencies": { "jquery": "~2.1.4", "simple-hotkeys": "~1.0.3", "simple-uploader": "~2.0.7", "simple-module": "~2.0.6" }, "devDependencies": { "grunt": "0.x", "grunt-contrib-sass": "0.x", "grunt-contrib-watch": "0.x", "grunt-contrib-coffee": "0.x", "grunt-contrib-copy": "0.x", "grunt-contrib-uglify": "0.x", "grunt-contrib-compress": "0.x", "grunt-contrib-clean": "0.x", "grunt-contrib-jasmine": "0.x", "grunt-jekyll": "0.x", "grunt-umd": "2.3.x", "grunt-express": "1.4.0", "grunt-banner": "0.3.x", "grunt-curl": "2.1.x", "express": "~3.3.4" } }
{ "name": "simditor", "version": "2.3.22", "description": "A simple online editor", "keywords": "editor simditor", "repository": { "type": "git", "url": "git@github.com:mycolorway/simditor.git" }, "author": "farthinker <farthinker@gmail.com>", "license": "MIT", "bugs": { "url": "https://github.com/mycolorway/simditor/issues" }, "scripts": { "test": "grunt test --verbose" }, "main": "lib/simditor.js", "files": [ "lib", "src", "styles" ], "homepage": "http://simditor.tower.im", "dependencies": { "dompurify": "^1.0.8", "jquery": "~2.1.4", "simple-hotkeys": "~1.0.3", "simple-module": "~2.0.6", "simple-uploader": "~2.0.7" }, "devDependencies": { "express": "~3.3.4", "grunt": "0.x", "grunt-banner": "0.3.x", "grunt-contrib-clean": "0.x", "grunt-contrib-coffee": "0.x", "grunt-contrib-compress": "0.x", "grunt-contrib-copy": "0.x", "grunt-contrib-jasmine": "0.x", "grunt-contrib-sass": "0.x", "grunt-contrib-uglify": "0.x", "grunt-contrib-watch": "0.x", "grunt-curl": "2.1.x", "grunt-express": "1.4.0", "grunt-jekyll": "0.x", "grunt-parallel": "^0.5.1", "grunt-umd": "2.3.x" } }
None
webpackJsonp([1],{"+NZg":function(t,e){},"/BJT":function(t,e){},"/Ph2":function(t,e){},"0G7g":function(t,e){},"0mvO":function(t,e){},"1nff":function(t,e){},"2eZB":function(t,e){},"5Fpp":function(t,e){},"6Gtl":function(t,e){},"8YgU":function(t,e){},"8gQg":function(t,e){},"9p//":function(t,e){},"9vwn":function(t,e){},AQny:function(t,e){e.__esModule=!0,e.default={help:"Help",demo:"Demo",index_login_or_register:"Login / Register",my_item:"My items",section_title1:"ShowDoc",section_description1:" A tool greatly applicable for an IT team",section_description1_1:"A tool greatly applicable",section_description1_2:"for an IT team",section_title2:"API Document",section_description2_1:"ShowDoc can compile exquisite API documents",section_description2_2:"in a very fast and convenient way",section_title3:"Data Dictionary",section_description3_1:"A good Data Dictionary can easily exhibit database structure to other people",section_description3_2:"ShowDoc can compile exquisite Data Dictionary",section_title4:"Explanation Document",section_description4_1:"You can absolutely use ShowDoc to compile the explanation documents for some tools",section_description4_2:"You can absolutely use ShowDoc to compile the explanation documents for some tools",section_title5:"Team Work",section_description5:"Your team will work with ShowDoc together very well ",section_title6:"Document Automation",section_description6_1:"Documents can be generated automatically from code comments",section_description6_2:"With the runapi client, you can debug the interface and automatically generate documents",section_title7:"Open Source",section_description7_1:"ShowDoc is a free, open source tool",section_description7_2:"You can deploy it to your own server",section_title8:"Hosted online",section_description8_1:"www.showdoc.com.cn provide security and stability of the document hosting service",section_description8_2:"You can safely choose to host your document data in the cloud",section_title9:"Try it now",section_description9:"Over 100000+ IT team is using ShowDoc",login:"Login",username:"Username",password:"Password",register_new_account:"Register",forget_password:"Forget password?",username_description:"Username/Email",password_again:"Input password again",verification_code:"Verification code",register:"Register",update_personal_info:"Update personal info",submit:"Submit",goback:"Back",my_email:"My email",input_email:"Input email",input_login_password:"Please enter your login password to verify",status:"Status",status_1:"Verified",status_2:"Unverified",status_3:"Unbound",binding:"Binding",modify:"Modify",modify_password:"Modify password",old_password:"Old password",new_password:"New password",modify_success:"Modify success!",update_email_success:"Update your mailbox successfully! Please log in to check the email to check the email.",personal_setting:"Personal settings",web_home:"Home",logout:"Logout",add_an_item:"Add an item",new_item:"New item",feedback:"Feedback",more:"More",my_notice:"My notice",item_setting:"Item settings",item_top:"Make item top",cancel_item_top:"Cancel top",item_type1:"Regular item",item_type2:"Single item",item_name:"Item name",item_description:"Description",item_domain:"Personalized domain name (optional)",item_domain_illegal:"Personalized domain names can only be a combination of letters or numbers",domain_already_exists:"Personal domain name already exists",visit_password_placeholder:"Password",copy_exists_item:"Copy existing item",please_choose:"Please select",auto_db:"Auto data dictionary",input_visit_password:"Input visit password",export_all:"Export all",export_cat:"export catalog/page",select_cat_2:"Select catalog level2",select_cat_3:"Select catalog level3",begin_export:"Begin to export",base_info:"Base info",member_manage:"Manage member",advance_setting:"Advanced setting",open_api:"open api",info_item_domain:"Personal domain name",visit_password:"Password",visit_password_description:"(Optional: private item required)",add_member:"Add member",authority:"Authority",add_time:"Add time",operation:"Operation",delete:"Delete",input_target_member:"Input member's username",readonly:"Read-only",member_authority_tips:"Permission Description: The default member can create/edit the project page, and only delete the newly created/edited page when deleting. After checking the read-only attribute, the member can only view all pages, and cannot add/edit/delete",cancel:"Cancel",confirm:"Confirm",confirm_delete:"Confirm to delete",attorn:"Attorn",archive:"Archive",attorn_tips:"You can attorn item(s) to other user(s)",archive_tips:"After archiving, the item will become read-only, and no more changes / additions can be made. If you want to edit it again, copy it to the new project and then edit it",delete_tips:"After deleting it, it can not be restored!",attorn_username:"Username of receiver",archive_tips2:"Note: After archiving a project, the project will no longer be able to add and modify content and will not be able to unarchive. If you want to modify the content again, you can copy the project and modify it on the basis of the new project. The way to copy a project is to choose to copy from an existing project when you create the project.",success_jump:"The operation is successful! Skipping...",reset_token:"Reset token",open_api_tips1:"Showdoc opens the API for document editing, making it easier for users to manipulate document data. <br>With the open API, you can do a lot of things automatically",open_api_tips2:'If you want to automate the generation of API documentation, you can refer to<a target="_bank" href="https://www.showdoc.cc/page/741656402509783">API documentation</a>',open_api_tips3:'If you want to automate the generation of a data dictionary, you can refer to<a target="_bank" href="https://www.showdoc.cc/page/312209902620725">Data dictionary</a>',open_api_tips4:'If you are more free to generate the format you need, you can refer to<a target="_bank" href="https://www.showdoc.cc/page/102098">Open API</a>',item:"Item",share:"Share",export:"Export",update_info:"Update info",manage_members:"Manage members",more_item:"More item(s)",login_or_register:"Login/Register",about_showdoc:"About ShowDoc",new_page:"New page",edit_page:"Edit page",new_catalog:"New/Manage catalog ",share_address_to_your_friends:"Share the interface address to your friends",copy_interface_to_new:"Copy this page to a new page",copy:"Copy",edit:"Edit",detail:"Detail",delete_interface:"Delete page",comfirm_delete:"Comfirm to delete",item_address:"Item address",copy_address_to_your_friends:"You can copy the address to your friend",share_page:"Share page",page_address:"Page address",input_keyword:"Press Enter to search",item_page_address:"Item page address",single_page_address:"Single page address",page_diff_tips:"What is the difference between the project page address and the single page address?",title:"Title",catalog:"Catalog",level_2_directory:"Level 2 catalog",level_3_directory:"Level 3 catalog",s_number:"Order",s_number_explain:"The default is 99, the smaller the number, the earlier it is set.(optional)",optional:"Optional",history_version:"History version",save:"Save",insert_apidoc_template:"ApiDoc template",insert_database_doc_template:"DatabaseDoc template",json_tools:"Json tools",format_tools:"Format tools",json_to_table:"JSON to table",beautify_json:"JSON beautify",beautify_json_description:"Please paste a JSON script, the program will automatically format the display in an elegant way.",http_test_api:"Test API online",json_to_table_description:"Please paste a JSON script, the program will automatically parse the code and generate a parameter table. This feature is suitable for quickly writing back parameter tables for API documents.",update_time:"Update time",update_by_who:"Update by ",recover_to_this_version:"Recover",close:"Close",finish:"Finish",params:"params",clear:"Clear",result:"Result",save_to_templ:"Save to template",more_templ:"More templates",saved_templ_list:"Template list",page_comments:"Page comment",cur_page_content:"Current newest version",overview:"Overview",save_templ_title:"Input template title",save_templ_text:'The template has been saved. When you create or edit an edit page later, click the "More Templates" button to use your saved template.',welcome_use_showdoc:"Welcome to ShowDoc!",templ_list:"Template list",templ_title:"Template title",no_templ_text:'You have not saved any templates yet. You can click on the right side of the "Save" button while editing the page, and select "Save as template" from the drop-down menu. After saving the page content as a template, you can use your previously saved template the next time you create or edit a page.',save_time:"Save time",insert_templ:"Insert",delete_templ:"Delete",save_success:"Save success",paste_insert_table:"Insert table from paste",paste_insert_table_tips:"Paste (Ctrl + V) below an existing table data copied (Ctrl + C) from a spreadsheet (e.g. Microsoft Excel), a text document, a Markdown code, or even a website.",add_cat:"Add catalog",cat_name:"Catalog name",input_cat_name:"Input catalog name",parent_cat_name:"Parent catalog",none:"none",back_to_top:"Back to top",draft_tips:"Your last draft is automatically saved. Do you want automatically fill this document in with the last draft?",management_backstage:"Backstage",user_management:"User(s)",item_management:"Items",add_user:"Add user",search:"Search",team_mamage:"Manage Team(s)",background:"Background",distribution_to_team:"Distribution item",back_to_team:"Back to team",check_item:"Check item",unassign:"Unassign",go_to_new_an_item:"New item",confirm_unassign:"Confirm unassign?",Join_time:"Join time",add_team:"Add team",member_authority:"Member authority",go_to_new_an_team:"New team",adjust_member_authority:"Adjust member authority",team_member_empty_tips:"The team does not have any members yet.",team_member_authority_tips:"Permission description: The editing permission means that members can create/edit project pages, and when deleted, they can only delete their own newly created/edited pages. The read-only permission means that the member can only view all pages of this project and can not add/edit/delete them.",member:"Member",team_item:"Item",member_username:"Member username",team_name:"Team name",memberCount:"Member count",itemCount:"Item count",empty_team_tips:"Welcome to the team management function. This function is well suited for collaborative management of team leader for multi person and cross team projects. Please click the top left button to add the team(s). After adding team(s), team members can be added or deleted at any time, allocated to different projects in batches, and member rights can be set in different projects. Compared with simple membership management mode, team management function can add and delete personnel in batches, which is more convenient for complex team cooperation.",copy_link:"Copy link",copy_success:"Copy success",user_manage:"User manage",item_manage:"Item manage",web_setting:"Web setting",register_open_label:"Register open",ldap_open_label:"LDAP login",name:"Name",name_tips:"Your real name",attachment:"Attachment",upload:"Upload",upload_file:"Upload file",file_name:"File name",download:"Download",file_size_tips:"Less than 4MB",confirm_cat_delete:"Are you sure you want to delete the directory? This action will delete all the pages in this directory. Please be careful.",userrole:"User role",reg_time:"Registration time",last_login_time:"Last login time",administrator:"Administrator",ordinary_users:"Ordinary users",owner:"Owner",privacy:"Privacy",link:"link",private:"private",public:"public",register_open:"Open registration",long_page_tips:"The content of this page was detected to be more, and showdoc temporarily shut down the HTML real-time preview function to prevent the page from getting stuck due to too much content. You can find the preview button in the edit bar and open it manually.",item_exit:"Exit item",confirm_exit_item:"Are you sure to exit this item?",insert:"Insert",Open_item:"public item",private_item:"private item",private_item_passwrod:"Please set a password for private item",create_sigle_page:"I want to create a single page address",create_sigle_page_tips:"When you just want to share a page and not the whole project, you can choose to share a single page address. After sharing, your friends will only see a single page, can not browse the catalog menu, and can not switch to other pages to view.",home_page:"Website home page",full_page:"Full page",login_page:"jump to login page",jump_to_an_item:"jump to an item",jump_to_item:"choose item",recycle:"recycle",recycle_tips:"The deleted page will go to the recycle bin. The content in the recycle bin for more than 30 days will be automatically selected by the system and cleaned up when appropriate",page_title:"Page title",deleter:"Delete Account",del_time:"Delete time",recover:"recover",recover_tips:"Are you sure to recover? The recovered page will appear in the item root",sort_pages:"Sort Pages",sort_pages_tips:"After selecting a specific catalog, you can drag and sort the pages in that catalog",cat_tips:"Drag to sort",cat_limite_tips:"Only up to three levels of directories are supported",regular_item:"Regular Item",single_item:"Single Item",copy_item:"Copy Item",import_file:"Import File",auto_item:"Auto Create",single_item_tips:"Single item refers to the item with no catalog structure and only one page",copy_item_tips1:"Select and copy from your existing items",copy_item_tips2:"After copying, rename the new item to:",import_file_tips1:"The imported file can be the JSON file of postman, the JSON file of swagger3, and the markdown zip of showdoc. The system will automatically identify the file type",import_file_tips2:"Drag the file here, or click to upload",export_format_word:"Word format",export_format_markdown:"Markdown zip",export_markdown_tips:"The exported compressed package can be re imported into showdoc. Select 'Import File' when creating a new item",private_tips:"It's a private item",oss_open:"Image/attachment saved to cloud",oss_server:"cloud server",aliyun:"aliyun",qiniu:"qiniu",oss_domain:"domain(optional)",attornTeamTips:"All items owned by the team will also be transferred to he/her",lock_edit:"Lock edit",lock_edit_tips:"When locked, other people will not be able to edit this page. Until you unlock or exit editing",cacel_lock:"Unlock",locking:"The current page is being locked and edited by other members. Editor:",all_cat:"All catalogs",cat_success:"Catalogs saved successfully",auth_success:"saved successfully",all_cat2:"Catalogs permissions: all",c_team:"Select team",Logged:"Logged",update_pwd_tips:"Password, leave blank if not changed",import_excel:"You can choose to import excel file",table:"table",attachment_manage:"Attachment",op_success:"success",display_name:"display name",all_attachment_type:"all type",image:"image",general_attachment:"general attachment",uploader:"uploader",file_id:"file id",file_type:"type",file_size_m:"size/mb",visit:"visit",visit_times:"visit times",my_attachment:"My attachment",accumulated_used_sapce:"Accumulated used space",month_flow:"Traffic has been used this month",all_pages:"All pages",cancelSingle:"Are you sure you want to cancel the single page link? After cancellation, the original link will be invalid immediately",cancelSingleYes:"Unlink single page",cancelSingleNo:"Keep single page",from_file_gub:"From FileHub",file_gub:"FileHub",select:"select",copy_or_mv_cat:"Copy or move catalog",copy_to:"Copy To",move_to:"Move To",remark:"remark",used_space:"Used pace",qcloud:"qcloud",binding_item:"Binding item",addtime:"addtime",system_update:"System update",group_name:"group name",add_group:"New group",all_items:"All items",manage_item_group:"Manage group",draggable_tips:"Press and hold to drag sort",item_group_empty_tips:"There is no grouping data. You can click the top right corner to create a new group",select_item:"Select item",ext_login:"Ext login",enable_oauth:"OAuth Login",your_showdoc_server:"[your-showdoc-server]",callback_eg:" callback url example",entrance_tips_label:"Entrance text prompt",entrance_tips_content:"When OAuth2 login is enabled, this entry will appear below the input box on the login interface. You can fill in a prompt such as 'Log in with company OA'",userinfo_path_content:"Interface to obtain user information after successful login. You can write a full URL or a path. When only the path is filled in, the OAuth host above will be used to supplement the full address automatically. The interface should return a JSON string with a username field",reset:"reset",history_version_count:"History versions",history_version_count_content:"Each time you edit a page, a historical version of the page is generated. Here is the number of historical versions kept. Only the latest 20 versions are reserved by default",refresh_cat:"Refresh directory list",go_add_cat:"To create a new directory ",all_member_read:"Set all to read-only",watermark:"watermark",watermark_tips:"The watermark is displayed when the logged in user views the item",site_url:"Site url",site_url_tips:"Site url",about_site:"About site",s3_storage:"S3 Storage(Amazon S3/Minio and so on)",import:"import",import_into_cur_item:"Import into current item",import_into_cur_item_tips:"When you choose to import to the current item, the pages with the same title in the same directory will be overwritten",import_into_new_item:"Import as a new item",item_change_log:"Item change log",item_change_log_dialog_title:"Item change log(only the first 300 are retained)",optime:"Operation time",oper:"Operator",op_action_type_desc:"Operation action type description",op_object_type_desc:"Operation object type description",op_object_name:"Operation object name",from_name:"Sender",send_time:"Sending time",content:"content",system_announcement:"Announcement",save_and_notify:"Save and notify",refresh_member_list:"Refresh member list",click_to_edit_member:"Click here to edit the list of notifiers for this page",cur_setting_notify:"currently set",people:"person",notify_tips1:"People on the notification list will receive a reminder that the current page has been modified and will attach a modification note",input_update_remark:"Please enter modification remarks",update_remark:"Modification remark",add_single_member:"Add personnel separately",add_all_member:"Add all project members with one click",notify_add_member_tips1:"You can only select people from project members. If the person you want to add is not in the drop-down option, please contact the project administrator first to add members to the project or the corresponding bound team.",quick_entrance:"Quick entrance",to_item_setting:"Go to item settings",to_team:"Go to team management",system_reminder:"System reminder",update_the_page:"update the page",click_to_view:"click to view",my_template:"My template",item_template:"Templates shared to this item",no_my_template_text:"You haven't saved any templates yet. When editing the page, click on the right side of the 'save' button and select 'save as template' in the drop-down menu. After saving the page content as a template, you can use the template you saved before the next time you create or edit a page. If you want to use the template shared by others, you can switch to the 'template shared to this item' tab",no_item_template_text:"There are currently no templates shared to this project. You and other members can choose to share their own templates with this project. You can set it in my template. After sharing, all members can see the shared templates under this item",sharer:"sharer",share_to_these_items:"share to these items",share_items_tips:"When you choose to share to these items, members of these items can use this sharing template",ordinary_member:"Ordinary member",team_admin:"Team administrator",edit_member:"Edit member",readonly_member:"Readonly member",item_admin:"Item administrator"}},CUTH:function(t,e){},DIaJ:function(t,e){},DSDa:function(t,e){},EGF7:function(t,e){},ET5U:function(t,e){},EtgL:function(t,e){},FbtG:function(t,e){},GEii:function(t,e){},GFba:function(t,e){},GtfQ:function(t,e){},HUa0:function(t,e){},I7H1:function(t,e){},IugC:function(t,e){},J71k:function(t,e){e.__esModule=!0,e.default={help:"帮助",demo:"示例",index_login_or_register:"登录 / 注册",my_item:"我的项目",section_title1:"ShowDoc",section_description1_1:"一个非常适合IT团队的",section_description1_2:"在线API文档、技术文档工具",section_title2:"API文档",section_description2_1:"APP、web前端与服务器常用API来进行交互",section_description2_2:"ShowDoc可以非常方便快速地编写出美观的API文档",section_title3:"数据字典",section_description3_1:"好的数据字典可以方便地向别人描述你的数据库结构",section_description3_2:"用ShowDoc可以编辑出美观的数据字典",section_title4:"说明文档",section_description4_1:"你完全可以使用 ShowDoc来编写一些工具的说明书",section_description4_2:"也可以编写一些技术规范说明文档以供团队查阅",section_title5:"团队协作",section_description5:"团队权限管理机制让团队良好地协同编写文档",section_title6:"文档自动化",section_description6_1:"可从代码注释中自动生成文档",section_description6_2:"搭配的RunApi客户端,可调试接口和自动生成文档",section_title7:"免费开源",section_description7_1:"ShowDoc提供免费开源的版本",section_description7_2:"你可以选择将ShowDoc部署到你的服务器",section_title8:"在线托管",section_description8_1:"www.showdoc.com.cn 安全稳定的在线文档托管服务",section_description8_2:"你可以放心地选择托管你的文档数据在云端",section_title9:"立即体验",section_description9:"超过100000+互联网团队正在使用ShowDoc",login:"登录",username:"用户名",password:"密码",register_new_account:"注册新账号",forget_password:"忘记密码",username_description:"用户名/邮箱",password_again:"再次输入密码",verification_code:"验证码",register:"注册",update_personal_info:"修改个人信息",submit:"提交",goback:"返回",my_email:"我的邮箱",input_email:"请输入要绑定的邮箱",input_login_password:"请输入你的登录密码以验证",status:"状态",status_1:"已验证",status_2:"未验证",status_3:"未绑定",binding:"绑定",modify:"修改",modify_password:"修改密码",old_password:"原密码",new_password:"新密码",modify_success:"修改成功",update_email_success:"更新邮箱成功!请登录邮箱查收验证邮件",personal_setting:"个人设置",web_home:"网站首页",logout:"退出登录",add_an_item:"添加一个新项目",new_item:"新建项目",feedback:"反馈",more:"更多",my_notice:"我的消息",item_setting:"项目设置",item_top:"置顶项目",cancel_item_top:"取消置顶",item_type1:"常规项目",item_type2:"单页项目",item_name:"项目名",item_description:"项目描述",item_domain:"(可选)个性域名",item_domain_illegal:"个性域名只能是字母或数字的组合",domain_already_exists:"个性域名已经存在",visit_password_placeholder:"访问密码",copy_exists_item:"复制已存在项目",please_choose:"请选择",auto_db:"我要自动生成数据字典",input_visit_password:"请输入访问密码",export_all:"导出全部",export_cat:"按目录/页面",select_cat_2:"选择二级目录:",select_cat_3:"选择三级目录:",begin_export:"开始导出",base_info:"基础信息",member_manage:"成员管理",advance_setting:"高级设置",open_api:"开放API",info_item_domain:"个性域名",visit_password:"访问密码",visit_password_description:"(可选)私有项目请设置访问密码",add_member:"添加成员",authority:"权限",add_time:"添加时间",operation:"操作",delete:"删除",input_target_member:"请输入目标成员的用户名",readonly:"只读",member_authority_tips:"权限说明:编辑权限指的是成员可以新建/编辑/删除项目页面。 只读权限指的是,该成员对本项目所有页面都只能查看,无法新增/编辑/删除。可以按项目目录给用户授权,该用户将只能查看和操作自己有权限的目录。目前只支持选择一级目录。",cancel:"取消",confirm:"确定",confirm_delete:"确认删除吗?",attorn:"转让",archive:"归档",attorn_tips:"你可以将项目转让给他人",archive_tips:"归档后,项目将变为只读,无法再修改/新增内容。如果要重新编辑,请复制到新项目后编辑",delete_tips:"删除后将不可恢复!",attorn_username:"接受者用户名",archive_tips2:"说明: 归档项目后,项目将无法再新增和修改内容,并且无法取消归档状态。 如想再次修改内容,可复制本项目,在新的项目基础上修改。复制项目的方法是,在创建项目的时候,选择从已有项目里复制。",success_jump:"操作成功!正在跳转...",reset_token:"重新生成api_token",open_api_tips1:"showdoc开放文档编辑的API,供使用者更加方便地操作文档数据。<br>利用开放API,你可以自动化地完成很多事",open_api_tips2:'如果你想自动化生成API文档,则可参考<a target="_bank" href="https://www.showdoc.cc/page/741656402509783">API文档</a>',open_api_tips3:'如果你想自动化生成数据字典,则可参考<a target="_bank" href="https://www.showdoc.cc/page/312209902620725">数据字典</a>',open_api_tips4:'如果你更自由地生成自己所需要的格式,则可参考<a target="_bank" href="https://www.showdoc.cc/page/102098">开放API</a>',item:"项目",share:"分享",export:"导出",update_info:"修改信息",manage_members:"成员管理",more_item:"更多项目",login_or_register:"登录/注册",about_showdoc:"关于ShowDoc",new_page:"新建页面",edit_page:"编辑页面",new_catalog:"新建/管理目录",share_address_to_your_friends:"分享该接口地址给你的好友",copy_interface_to_new:"复制该页面到新页面",copy:"复制",edit:"编辑",detail:"详情",delete_interface:"删除页面",comfirm_delete:"确认删除吗?",item_address:"项目地址",copy_address_to_your_friends:"你可以复制地址给你的好友",share_page:"分享页面",page_address:"页面地址",input_keyword:"输入关键字后按回车以搜索",item_page_address:"项目页面地址",single_page_address:"单页面地址",page_diff_tips:"项目页面地址和单页面地址有什么区别?",title:"标题",catalog:"目录",level_2_directory:"二级目录",level_3_directory:"三级目录",s_number:"序号",s_number_explain:"(可选)默认是99,数字越小越靠前",optional:"可选",history_version:"历史版本",save:"保存",insert_apidoc_template:"API接口模板",insert_database_doc_template:"数据字典模板",json_tools:"JSON工具",format_tools:"格式工具",json_to_table:"JSON转参数表格",beautify_json:"JSON格式化",beautify_json_description:"请粘贴一段json,程序将自动以美观的方式格式化显示",http_test_api:"在线测试API",json_to_table_description:"请粘贴一段json,程序将自动将json解析并生成参数表格。此功能适合用于快速编写API文档的返回参数表格",update_time:"修改时间",update_by_who:"修改人",recover_to_this_version:"恢复到此版本",close:"关闭",finish:"完成",params:"参数",clear:"清除",result:"返回结果",save_to_templ:"另存为模板",more_templ:"更多模板",saved_templ_list:"保存的模板列表",page_comments:"页面注释",cur_page_content:"当前最新版本",overview:"预览",save_templ_title:"请为要保存的模板设置标题",save_templ_text:"已经保存好模板。你以后新建或者编辑编辑页面时,点击“更多模板”按钮,便可以使用你保存的模板",welcome_use_showdoc:"欢迎使用ShowDoc!",templ_list:"模板列表",templ_title:"模板标题",no_templ_text:"你尚未保存过任何模板。你可以在编辑页面时,在“保存”按钮右边点击,在下拉菜单中选择“另存为模板”。把页面内容保存为模板后,你下次新建或者编辑页面时便可以使用你之前保存的模板",save_time:"保存时间",insert_templ:"插入此模板",delete_templ:"删除模板",save_success:"保存成功",paste_insert_table:"粘贴插入表格",paste_insert_table_tips:"你可以从网页或者excel中复制表格,然后粘贴在此处。粘贴并确定后,程序将自动把源表格转为markdown格式的表格。注:复制excel后,请鼠标右击,粘贴为纯文本。否则会当做图片上传。",add_cat:"添加目录",cat_name:"目录名",input_cat_name:"请输入目录名",parent_cat_name:"上级目录",none:"无",back_to_top:"回到顶部",draft_tips:"检测到有上次编辑时自动保存的草稿。是否自动填充上次的草稿内容?",management_backstage:"管理后台",user_management:"用户管理",item_management:"项目管理",add_user:"新增用户",search:"查询",team_mamage:"团队管理",background:"管理后台",distribution_to_team:"分配项目给团队",back_to_team:"返回团队管理",check_item:"查看项目",unassign:"取消分配",go_to_new_an_item:"去新建项目",confirm_unassign:"确认取消分配吗?此操作会取消项目和团队之间的关联",Join_time:"加入时间",add_team:"添加团队",member_authority:"成员权限",go_to_new_an_team:"去新建团队",adjust_member_authority:"调整每一个成员的项目权限",team_member_empty_tips:"该团队尚未有任何成员",team_member_authority_tips:"权限说明:默认成员可以新建/编辑/删除项目页面, 勾选只读属性后,该成员对所有页面都只能查看,无法新增/编辑/删除。可以按项目目录给用户授权,该用户将只能查看和操作自己有权限的目录。目前只支持选择一级目录。",member:"成员",team_item:"项目",member_username:"成员用户名",team_name:"团队名",memberCount:"成员数",itemCount:"分配项目数",empty_team_tips:"欢迎使用团队管理功能。此功能非常适合Team leader对多人员、跨团队项目的协作管理。请先点击左上方按钮添加团队。添加团队后,可以随时增加/删除团队成员、批量分配到不同项目,并且可以设置不同项目里的成员权限。相比简单成员管理模式,团队管理功能可以批量地进行人员的增删,更方便复杂团队的协作。",copy_link:"复制链接",copy_success:"复制成功",user_manage:"用户管理",item_manage:"项目管理",web_setting:"站点设置",register_open_label:"开放用户注册",ldap_open_label:"启用ldap登录",name:"姓名",name_tips:"推荐使用真实姓名",attachment:"附件",upload:"上传",upload_file:"上传文件",file_name:"文件名",download:"下载",file_size_tips:"文件大小在4M内",confirm_cat_delete:"确认删除目录吗?此操作会把该目录下的所有页面一并删除,请谨慎操作。",userrole:"用户角色",reg_time:"注册时间",last_login_time:"最后登录时间",administrator:"管理员",ordinary_users:"普通用户",owner:"所有者",privacy:"私密性",link:"链接",private:"密码访问",public:"公开访问",register_open:"开放用户注册",long_page_tips:"检测到本页面内容比较多,showdoc暂时关闭了html实时预览功能,以防止过多内容造成页面卡顿。你可以在编辑栏中找到预览按钮进行手动打开。",item_exit:"退出项目",confirm_exit_item:"你确定要退出该项目吗?",insert:"插入",Open_item:"公开项目",private_item:"私密项目",private_item_passwrod:"私密项目请设置访问密码",create_sigle_page:"我要创建单页面地址",create_sigle_page_tips:"当仅仅想分享某个页面、而不想分享整个项目的时候,你可以选择分享单页面地址。分享出去后,你的好友将仅仅只看到单个页面,无法浏览目录菜单,也无法切换到其他页面查看。",home_page:"网站首页",full_page:"全屏介绍页面",login_page:"跳转到登录页面",jump_to_an_item:"跳转到某个项目",jump_to_item:"跳转到项目",recycle:"回收站",recycle_tips:"被删除的页面会进入回收站。在回收站超过30天的内容将被系统自动选择合适时候清理掉",page_title:"页面标题",deleter:"删除账号",del_time:"删除时间",recover:"恢复",recover_tips:"确认恢复吗?恢复的页面将出现在项目根目录",cat_tips:"可拖动以排序",cat_limite_tips:"showdoc只支持最多三层目录,请优化目录结构",sort_pages:"页面排序",sort_pages_tips:"选择特定的目录后,你可以对该目录下的页面进行拖动排序",regular_item:"常规项目",single_item:"单页项目",copy_item:"复制项目",import_file:"导入文件",auto_item:"自动生成",single_item_tips:"单页项目指的是指没有目录结构,只有一个页面的项目",copy_item_tips1:"从你已有的项目中选择并复制",copy_item_tips2:"复制后将新项目重命名为:",import_file_tips1:"导入的文件可以是<b>postman</b>的json文件、<b>swagger3</b>的json文件、showdoc的<b>markdown压缩包</b>。系统会自动识别文件类型。",import_file_tips2:"将文件拖到此处,或<em>点击上传</em>",export_format_word:"word格式",export_format_markdown:"markdown压缩包",export_markdown_tips:"导出的压缩包可以重新导入showdoc,在新建项目的时候选择“文件导入”即可",private_tips:"这是一个私密项目",oss_open:"图片附件储存到云",oss_server:"云服务商",aliyun:"阿里云",qiniu:"七牛云",oss_domain:"oss绑定域名(选填)",attornTeamTips:"转让团队后,该团队下拥有的所有项目也会一并转让给对方",lock_edit:"锁定编辑",lock_edit_tips:"当锁定后,其他人将无法编辑本页面。直到你取消锁定或者退出编辑",cacel_lock:"解除锁定",locking:"当前页面正在被其他成员锁定编辑中,编辑者:",all_cat:"所有目录",cat_success:"目录保存成功",auth_success:"权限保存成功",all_cat2:"目录权限:所有目录",c_team:"选择团队",Logged:"已登录",update_pwd_tips:"密码,不修改则留空",import_excel:"你可以选择Excel文件导入",table:"电子表格",attachment_manage:"附件管理",op_success:"操作成功",display_name:"展示名字",all_attachment_type:"全部文件类型",image:"图片",general_attachment:"其它文件",uploader:"上传者",file_id:"文件id",file_type:"文件类型",file_size_m:"文件大小/mb",visit:"查看",visit_times:"访问次数",my_attachment:"文件库",accumulated_used_sapce:"累计已使用空间",month_flow:"本月已使用流量",all_pages:"全部页面",cancelSingle:"是否确定取消单页链接?取消后,原链接会立马失效",cancelSingleYes:"取消单页链接",cancelSingleNo:"保留单页链接",from_file_gub:"从文件库选择",file_gub:"文件库",select:"选择",copy_or_mv_cat:"复制或移动目录",copy_to:"复制到",move_to:"移动到",remark:"备注",used_space:"已使用空间",qcloud:"腾讯云",binding_item:"绑定项目",addtime:"添加时间",system_update:"系统更新",group_name:"组名",add_group:"新建分组",all_items:"所有项目",manage_item_group:"项目分组管理",draggable_tips:"按住可拖动排序",item_group_empty_tips:"暂无分组数据。可点击右上角新建分组",select_item:"选择项目",ext_login:"集成登录",enable_oauth:"启动OAuth2登录",your_showdoc_server:"【你的showdoc地址】",callback_eg:" callback url填写示例",entrance_tips_label:"入口文字提示",entrance_tips_content:"当启用OAuth2登录时候,登录界面将在输入框的下方出现此入口。你可以填上如'使用公司OA登录'这样的提示",userinfo_path_content:"登录成功后获取用户信息的接口。可以写完整网址也可以写路径。当只填写路径的时候,将自动使用上面的Oauth host补充完整地址。该接口应当返回json字符串且包含username字段",reset:"重新生成",history_version_count:"历史版本数量",history_version_count_content:"每次编辑页面都会生成一个页面的历史版本。这里是保留的历史版本数量。默认只保留最新的20个版本",refresh_cat:"刷新目录列表",go_add_cat:"去新建目录",all_member_read:"全部设置为只读",watermark:"水印",watermark_tips:"登录用户查看项目时候显示水印",site_url:"网站外部访问url",site_url_tips:'你上传图片/附件等资源时,其生成的url自动由程序判断填充。如果程序判断错误,你可以在这里手动填上访问url,当你填写后,上传资源后的访问url将使用这里填写的值作为访问前缀。填写示例值"https://www.showdoc.com.cn"。如果你不理解此值含义,请默认留空,不要填写',about_site:"关于本站",s3_storage:"通用S3存储(亚马逊s3/minio等)",import:"导入",import_into_cur_item:"导入到当前项目中",import_into_cur_item_tips:"当你选择导入到当前项目时,同一个目录下相同标题的页面会被覆盖",import_into_new_item:"导入为一个新项目",item_change_log:"项目变更日志",item_change_log_dialog_title:"项目变更日志(只保留前300条)",optime:"操作时间",oper:"操作人",op_action_type_desc:"操作动作类型描述",op_object_type_desc:"操作对象类型描述",op_object_name:"操作对象名称",from_name:"发送人",send_time:"发送时间",content:"内容",system_announcement:"系统公告",save_and_notify:"保存并通知",refresh_member_list:"刷新人员列表",click_to_edit_member:"点此编辑本页面的通知人员名单",cur_setting_notify:"当前已设置通知",people:"人",notify_tips1:"处于通知名单里的人会收到当前页面被修改了的提醒,同时会附上修改备注",input_update_remark:"请输入修改备注",update_remark:"修改备注",add_single_member:"单独添加人员",add_all_member:"一键添加全部项目成员",notify_add_member_tips1:"你只能从项目成员中选择人员。如果你想添加的人不在下拉选项内,请先联系项目管理员添加成员到项目或者相应绑定的团队中。",quick_entrance:"快捷入口",to_item_setting:"去项目设置",to_team:"去团队管理",system_reminder:"系统提醒",update_the_page:"修改了页面",click_to_view:"点此查看",my_template:"我的模板",item_template:"共享到本项目的模板",no_my_template_text:"你尚未保存过任何模板。你可以在编辑页面时,在“保存”按钮右边点击,在下拉菜单中选择“另存为模板”。把页面内容保存为模板后,你下次新建或者编辑页面时便可以使用你之前保存的模板。如果你想使用别人共享的模板,可以切换到‘共享到本项目的模板’标签页去看",no_item_template_text:"当前没有任何共享到本项目的模板。你以及其他成员都可以选择把自己的模板共享到本项目。在‘我的模板’处便可以设置。共享后,所有成员都能看到本项目下共享的模板",sharer:"共享人",share_to_these_items:"共享到这些项目",share_items_tips:"当你选择共享到这些项目后,这些项目的成员都能使用到此共享模板",ordinary_member:"普通成员",team_admin:"团队管理员",edit_member:"编辑成员",readonly_member:"只读成员",item_admin:"项目管理员"}},KTx2:function(t,e){},Kp5Y:function(t,e){},Lf0y:function(t,e){},Lo8Q:function(t,e){},"Lw/u":function(t,e){},Lw6k:function(t,e){},MITx:function(t,e){},NHnr:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=a("woOf"),o=a.n(i),n=a("7+uW"),s={render:function(){var t=this.$createElement,e=this._self._c||t;return e("div",{attrs:{id:"app"}},[e("router-view")],1)},staticRenderFns:[]};var r=a("VU/8")({name:"app"},s,!1,function(t){a("9p//")},null,null).exports,l=a("/ocq"),c={name:"Index",data:function(){return{height:"",link:"",link_text:"",lang:"",beian:""}},methods:{getHeight:function(){var t;window.innerHeight?t=window.innerHeight:document.body&&document.body.clientHeight&&(t=document.body.clientHeight),this.height=t+"px"},homePageSetting:function(){var t=this,e=DocConfig.server+"/api/common/homePageSetting";this.axios.post(e,this.form).then(function(e){0===e.data.error_code&&(t.beian=e.data.data.beian,2==e.data.data.home_page&&t.$router.replace({path:"/user/login"}),3==e.data.data.home_page&&e.data.data.home_item&&t.$router.replace({path:"/"+e.data.data.home_item}))})}},mounted:function(){var t=this;this.lang=DocConfig.lang,this.getHeight(),this.homePageSetting(),t.link="/user/login",t.link_text=t.$t("index_login_or_register"),this.get_user_info(function(e){0===e.data.error_code&&(t.link="/item/index",t.link_text=t.$t("my_item"))})}},m={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"body"},[a("div",{staticClass:"header"},[a("div",{staticClass:"header-wrap"},[t._m(0),t._v(" "),a("input",{attrs:{type:"checkbox",name:"",id:"mobile-menu-toggle",value:""}}),t._v(" "),t._m(1),t._v(" "),a("div",{staticClass:"nav"},[a("ul",[a("li",[a("router-link",{attrs:{to:t.link}},[t._v(t._s(t.link_text))])],1),t._v(" "),a("li",["zh-cn"==t.lang?a("a",{attrs:{target:"_blank",href:"https://www.showdoc.cc/clients"}},[t._v("客户端")]):t._e()])])])])]),t._v(" "),a("div",{staticClass:"hbanner"},[a("div",{staticClass:"wrapper"},[a("div",{staticClass:"hbanner-txt"},[a("h2",[t._v("\n "+t._s(t.$t("section_description1_1"))+"\n "),a("br"),t._v(" "),a("font",{staticClass:"f-blue"},[t._v(t._s(t.$t("section_description1_2")))])],1),t._v(" "),a("div",{staticClass:"btns"},[a("a",{staticClass:"btn on",attrs:{href:"https://www.showdoc.cc/demo",target:"_blank"}},[t._v(t._s(t.$t("demo")))]),t._v(" "),a("a",{staticClass:"btn",attrs:{href:"https://www.showdoc.cc/help",target:"_blank"}},[t._v(t._s(t.$t("more")))])])]),t._v(" "),a("div",{staticClass:"hbanner-imgs"})])]),t._v(" "),a("div",{staticClass:"hrow hrow1"},[a("div",{staticClass:"wrapper"},[t._m(2),t._v(" "),a("div",{staticClass:"txt fr"},[a("h2",[t._v(t._s(t.$t("section_title2")))]),t._v(" "),a("div",{staticClass:"desc"},[a("p",[a("img",{attrs:{src:"static/imgs/Vector.png"}}),t._v("\n "+t._s(t.$t("section_description2_1"))+"\n ")]),t._v(" "),a("p",[a("img",{attrs:{src:"static/imgs/Vector.png"}}),t._v("\n "+t._s(t.$t("section_description2_2"))+"\n ")])])])])]),t._v(" "),a("div",{staticClass:"hrow hrow2"},[a("div",{staticClass:"wrapper"},[t._m(3),t._v(" "),a("div",{staticClass:"txt fl"},[a("h2",[t._v(t._s(t.$t("section_title3")))]),t._v(" "),a("div",{staticClass:"desc"},[a("p",[a("img",{attrs:{src:"static/imgs/Vector1.png"}}),t._v("\n "+t._s(t.$t("section_description3_1"))+"\n ")]),t._v(" "),a("p",[a("img",{attrs:{src:"static/imgs/Vector1.png"}}),t._v("\n "+t._s(t.$t("section_description3_2"))+"\n ")])])])])]),t._v(" "),a("div",{staticClass:"hrow hrow3"},[a("div",{staticClass:"wrapper"},[t._m(4),t._v(" "),a("div",{staticClass:"txt fr"},[a("h2",[t._v(t._s(t.$t("section_title4")))]),t._v(" "),a("div",{staticClass:"desc"},[a("p",[a("img",{attrs:{src:"static/imgs/Vector.png"}}),t._v("\n "+t._s(t.$t("section_description4_1"))+"\n ")]),t._v(" "),a("p",[a("img",{attrs:{src:"static/imgs/Vector.png"}}),t._v("\n "+t._s(t.$t("section_description4_2"))+"\n ")])])])])]),t._v(" "),a("div",{staticClass:"hrow hrow4"},[a("div",{staticClass:"wrapper"},[t._m(5),t._v(" "),a("div",{staticClass:"txt fl"},[a("h2",[t._v(t._s(t.$t("section_title5")))]),t._v(" "),a("div",{staticClass:"desc"},[a("p",[t._v(t._s(t.$t("section_description5")))])])])])]),t._v(" "),a("div",{staticClass:"hrow hrow5"},[a("div",{staticClass:"wrapper"},[t._m(6),t._v(" "),a("div",{staticClass:"txt fr"},[a("h2",[t._v(t._s(t.$t("section_title6")))]),t._v(" "),a("div",{staticClass:"desc"},[a("p",[a("img",{attrs:{src:"static/imgs/Vector1.png"}}),t._v("\n "+t._s(t.$t("section_description6_1"))+"\n ")]),t._v(" "),a("p",[a("img",{attrs:{src:"static/imgs/Vector1.png"}}),t._v("\n "+t._s(t.$t("section_description6_2"))+"\n ")])])])])]),t._v(" "),a("div",{staticClass:"hrow hrow6"},[a("div",{staticClass:"wrapper"},[t._m(7),t._v(" "),a("div",{staticClass:"txt fl"},[a("h2",[t._v(t._s(t.$t("section_title7")))]),t._v(" "),a("div",{staticClass:"desc"},[a("p",[t._v(t._s(t.$t("section_description7_1")))]),t._v(" "),a("p",[t._v(t._s(t.$t("section_description7_2")))])])])])]),t._v(" "),a("div",{staticClass:"hrow hrow7"},[a("div",{staticClass:"wrapper"},[t._m(8),t._v(" "),a("div",{staticClass:"txt fr"},[a("h2",[t._v(t._s(t.$t("section_title8")))]),t._v(" "),a("div",{staticClass:"desc"},[a("p",[t._v(t._s(t.$t("section_description8_1")))]),t._v(" "),a("p",[t._v(t._s(t.$t("section_description8_2")))])])])])]),t._v(" "),a("div",{staticClass:"hfoot"},[a("div",{staticClass:"wrapper"},[a("h2",[t._v(t._s(t.$t("section_description9")))]),t._v(" "),a("router-link",{staticClass:"btn",attrs:{to:"/user/login"}},[t._v(t._s(t.$t("section_title9")))])],1),t._v(" "),a("div",{staticClass:"copyright"},[a("a",{attrs:{href:"https://beian.miit.gov.cn/"}},[t._v(t._s(t.beian))])])])])},staticRenderFns:[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"logo"},[e("a",{attrs:{href:"/"}},[e("img",{attrs:{src:"static/imgs/Logo.png"}})])])},function(){var t=this.$createElement,e=this._self._c||t;return e("label",{staticClass:"gh",attrs:{for:"mobile-menu-toggle"}},[e("span")])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"img fl"},[e("img",{attrs:{src:"static/imgs/home2.png"}}),this._v(" "),e("div",{staticClass:"box"},[e("img",{attrs:{src:"static/imgs/home2-img.png"}})])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"img fr"},[e("img",{attrs:{src:"static/imgs/home3.png"}})])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"img fl"},[e("img",{attrs:{src:"static/imgs/home4.png"}})])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"img fr"},[e("img",{attrs:{src:"static/imgs/home5.png"}})])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"img fl"},[e("img",{attrs:{src:"static/imgs/home6.png"}})])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"img fr"},[e("img",{attrs:{src:"static/imgs/home7.png"}})])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"img fl"},[e("img",{attrs:{src:"static/imgs/home8.png"}})])}]};var d=a("VU/8")(c,m,!1,function(t){a("nzBk"),a("Lw/u"),a("tfpE")},"data-v-2ad7b462",null).exports,_=a("mvHQ"),p=a.n(_),u={name:"Login",components:{},data:function(){return{username:"",password:"",v_code:"",v_code_img:DocConfig.server+"/api/common/verify",show_v_code:!1,is_show_alert:!1,oauth2_entrance_tips:"",oauth2_url:DocConfig.server+"/api/ExtLogin/oauth2"}},methods:{onSubmit:function(){if(!this.is_show_alert){if(this.$route.query.redirect){var t=decodeURIComponent(this.$route.query.redirect);if(t.search(/[^A-Za-z0-9/:\?\._\*\+\-]+.*/i)>-1||t.indexOf(".")>-1||t.indexOf("//")>-1)return this.$alert("illegal redirect"),!1}var e=this,a=DocConfig.server+"/api/user/login",i=new URLSearchParams;i.append("username",this.username),i.append("password",this.password),i.append("v_code",this.v_code),e.axios.post(a,i).then(function(t){if(0===t.data.error_code){localStorage.setItem("userinfo",p()(t.data.data));var a=decodeURIComponent(e.$route.query.redirect||"/item/index");e.$router.replace({path:a})}else 10206!==t.data.error_code&&10210!==t.data.error_code||(e.show_v_code=!0,e.change_v_code_img()),e.is_show_alert=!0,e.$alert(t.data.error_message,{callback:function(){setTimeout(function(){e.is_show_alert=!1},500)}})})}},change_v_code_img:function(){var t="&rand="+Math.random();this.v_code_img+=t},script_cron:function(){var t=DocConfig.server+"/api/ScriptCron/run";this.axios.get(t)},getOauth:function(){var t=this,e=DocConfig.server+"/api/user/oauthInfo";this.axios.get(e).then(function(e){0===e.data.error_code&&e.data.data.oauth2_open>0&&(t.oauth2_entrance_tips=e.data.data.oauth2_entrance_tips)})}},mounted:function(){var t=this;if(this.$route.query.redirect){var e=decodeURIComponent(this.$route.query.redirect);if(e.search(/[^A-Za-z0-9/:\?\._\*\+\-]+.*/i)>-1||e.indexOf(".")>-1||e.indexOf("//")>-1)return this.$alert("illegal redirect"),!1}this.get_user_info(function(e){if(0===e.data.error_code){var a=decodeURIComponent(t.$route.query.redirect||"/item/index");t.$router.replace({path:a})}}),this.script_cron(),this.getOauth()},watch:{$route:function(t,e){this.$router.go(0)}},beforeDestroy:function(){}},f={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",[a("el-card",{staticClass:"center-card"},[a("el-form",{staticClass:"demo-ruleForm",attrs:{"status-icon":"","label-width":"0px"},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.onSubmit(e)}}},[a("h2",[t._v(t._s(t.$t("login")))]),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"text","auto-complete":"off",placeholder:t.$t("username_description")},model:{value:t.username,callback:function(e){t.username=e},expression:"username"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"password","auto-complete":"off",placeholder:t.$t("password")},model:{value:t.password,callback:function(e){t.password=e},expression:"password"}})],1),t._v(" "),t.show_v_code?a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"text","auto-complete":"off",placeholder:t.$t("verification_code")},model:{value:t.v_code,callback:function(e){t.v_code=e},expression:"v_code"}}),t._v(" "),a("img",{staticClass:"v_code_img",attrs:{src:t.v_code_img},on:{click:t.change_v_code_img}})],1):t._e(),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-button",{staticStyle:{width:"100%"},attrs:{type:"primary"},on:{click:t.onSubmit}},[t._v(t._s(t.$t("login")))])],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("router-link",{attrs:{to:"/user/register"}},[t._v(t._s(t.$t("register_new_account")))]),t._v("   \n "),a("a",{attrs:{href:t.oauth2_url}},[t._v(t._s(t.oauth2_entrance_tips))])],1)],1)],1)],1),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var h=a("VU/8")(u,f,!1,function(t){a("aMUC")},"data-v-67c7728c",null).exports,g={name:"Login",components:{},data:function(){return{infoForm:{username:"",name:""},userInfo:{},emailForm:{email:"",status:""},passwordForm:{password:"",new_password:""},dialogEmailFormVisible:!1,dialogPasswordFormVisible:!1}},methods:{get_user_info:function(){var t=this,e=DocConfig.server+"/api/user/info",a=new URLSearchParams;t.axios.post(e,a).then(function(e){if(0===e.data.error_code){var a,i=e.data.data;t.userInfo=i,t.passwordForm.username=i.username,t.emailForm.email=i.email,t.infoForm.username=i.username,t.infoForm.name=i.name,i.email.length>0?(t.emailForm.submit_text=t.$t("modify"),a=i.email_verify>0?t.$t("status_1"):t.$t("status_2")):(a=t.$t("status_3"),t.emailForm.submit_text=t.$t("binding")),t.emailForm.status=a}else t.$alert(e.data.error_message)}).catch(function(t){console.log(t)})},passwordFormSubmit:function(){var t=this,e=DocConfig.server+"/api/user/resetPassword",a=new URLSearchParams;a.append("new_password",this.passwordForm.new_password),a.append("password",this.passwordForm.password),t.axios.post(e,a).then(function(e){0===e.data.error_code?t.dialogPasswordFormVisible=!1:t.$alert(e.data.error_message)})},emailFormSubmit:function(){var t=this,e=DocConfig.server+"/api/user/updateEmail",a=new URLSearchParams;a.append("email",this.emailForm.email),a.append("password",this.emailForm.password),t.axios.post(e,a).then(function(e){0===e.data.error_code?(t.dialogEmailFormVisible=!1,this.get_user_info()):t.$alert(e.data.error_message)})},formSubmit:function(){var t=this,e=DocConfig.server+"/api/user/updateInfo",a=new URLSearchParams;a.append("name",this.infoForm.name),t.axios.post(e,a).then(function(e){0===e.data.error_code?(t.$message.success(t.$t("modify_success")),this.get_user_info()):t.$alert(e.data.error_message)})},goback:function(){this.$router.push({path:"/item/index"})}},mounted:function(){this.get_user_info()},beforeDestroy:function(){}},v={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",[a("el-card",{staticClass:"center-card"},[a("el-button",{staticClass:"goback-btn",attrs:{type:"text"},on:{click:t.goback}},[a("i",{staticClass:"el-icon-back"})]),t._v(" "),a("el-form",{staticClass:"infoForm",attrs:{"status-icon":"","label-width":"75px"},model:{value:t.infoForm,callback:function(e){t.infoForm=e},expression:"infoForm"}},[a("el-form-item",{attrs:{label:t.$t("username")+":"}},[a("el-input",{attrs:{type:"text","auto-complete":"off",disabled:!0,placeholder:""},model:{value:t.infoForm.username,callback:function(e){t.$set(t.infoForm,"username",e)},expression:"infoForm.username"}})],1),t._v(" "),a("el-form-item",{attrs:{label:t.$t("name")+":"}},[a("el-input",{attrs:{type:"text","auto-complete":"off",placeholder:t.$t("name_tips")},model:{value:t.infoForm.name,callback:function(e){t.$set(t.infoForm,"name",e)},expression:"infoForm.name"}})],1),t._v(" "),a("el-form-item",{attrs:{label:t.$t("password")+":"}},[a("a",{attrs:{href:"javascript:;"},on:{click:function(e){t.dialogPasswordFormVisible=!0}}},[t._v(t._s(t.$t("modify")))])]),t._v(" "),a("el-button",{staticStyle:{width:"100%"},attrs:{type:"primary"},on:{click:t.formSubmit}},[t._v(t._s(t.$t("submit")))])],1)],1)],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogEmailFormVisible,top:"10vh",width:"300px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogEmailFormVisible=e}}},[a("el-form",{staticClass:"emailForm"},[a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"text","auto-complete":"off",placeholder:t.$t("input_email")},model:{value:t.emailForm.email,callback:function(e){t.$set(t.emailForm,"email",e)},expression:"emailForm.email"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"password","auto-complete":"off",placeholder:t.$t("input_login_password")},model:{value:t.emailForm.password,callback:function(e){t.$set(t.emailForm,"password",e)},expression:"emailForm.password"}})],1)],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogEmailFormVisible=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.emailFormSubmit}},[t._v(t._s(t.$t("confirm")))])],1)],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogPasswordFormVisible,top:"10vh",width:"300px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogPasswordFormVisible=e}}},[a("el-form",{staticClass:"emailForm"},[a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"password","auto-complete":"off",placeholder:t.$t("old_password")},model:{value:t.passwordForm.password,callback:function(e){t.$set(t.passwordForm,"password",e)},expression:"passwordForm.password"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"password","auto-complete":"off",placeholder:t.$t("new_password")},model:{value:t.passwordForm.new_password,callback:function(e){t.$set(t.passwordForm,"new_password",e)},expression:"passwordForm.new_password"}})],1)],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogPasswordFormVisible=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.passwordFormSubmit}},[t._v(t._s(t.$t("confirm")))])],1)],1),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var b=a("VU/8")(g,v,!1,function(t){a("sRF7")},"data-v-ff8d1704",null).exports,w={name:"Register",components:{},data:function(){return{username:"",password:"",confirm_password:"",v_code:"",v_code_img:DocConfig.server+"/api/common/verify"}},methods:{onSubmit:function(){var t=this,e=DocConfig.server+"/api/user/register",a=new URLSearchParams;a.append("username",this.username),a.append("password",this.password),a.append("confirm_password",this.confirm_password),a.append("v_code",this.v_code),t.axios.post(e,a).then(function(e){0===e.data.error_code?(localStorage.setItem("userinfo",p()(e.data.data)),t.$router.push({path:"/item/index"})):(t.change_v_code_img(),t.$alert(e.data.error_message))})},change_v_code_img:function(){var t="&rand="+Math.random();this.v_code_img+=t}},mounted:function(){},beforeDestroy:function(){}},y={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",[a("el-card",{staticClass:"center-card"},[a("el-form",{staticClass:"demo-ruleForm",attrs:{"status-icon":"","label-width":"0px"},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.onSubmit(e)}}},[a("h2",[t._v(t._s(t.$t("register")))]),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"text","auto-complete":"off",placeholder:t.$t("username_description")},model:{value:t.username,callback:function(e){t.username=e},expression:"username"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"password","auto-complete":"off",placeholder:t.$t("password")},model:{value:t.password,callback:function(e){t.password=e},expression:"password"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"password","auto-complete":"off",placeholder:t.$t("password_again")},model:{value:t.confirm_password,callback:function(e){t.confirm_password=e},expression:"confirm_password"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"text","auto-complete":"off",placeholder:t.$t("verification_code")},model:{value:t.v_code,callback:function(e){t.v_code=e},expression:"v_code"}}),t._v(" "),a("img",{staticClass:"v_code_img",attrs:{src:t.v_code_img},on:{click:t.change_v_code_img}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-button",{staticStyle:{width:"100%"},attrs:{type:"primary"},on:{click:t.onSubmit}},[t._v(t._s(t.$t("register")))])],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("router-link",{attrs:{to:"/user/login"}},[t._v(t._s(t.$t("login")))]),t._v("\n    \n ")],1)],1)],1)],1),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var k=a("VU/8")(w,y,!1,function(t){a("1nff")},"data-v-d6b353e4",null).exports,x={name:"",components:{},data:function(){return{email:"",v_code:"",v_code_img:DocConfig.server+"/api/common/verify"}},methods:{onSubmit:function(){var t=this,e=DocConfig.server+"/api/user/resetPasswordEmail",a=new URLSearchParams;a.append("email",this.email),a.append("v_code",this.v_code),t.axios.post(e,a).then(function(e){0===e.data.error_code?t.$alert("已成功发送重置密码邮件到你的邮箱中。请登录并查看邮件"):t.$alert(e.data.error_message)})},change_v_code_img:function(){var t="&rand="+Math.random();this.v_code_img+=t}},mounted:function(){},beforeDestroy:function(){}},C={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",[a("el-card",{staticClass:"center-card"},[a("el-form",{staticClass:"demo-ruleForm",attrs:{"status-icon":"","label-width":"0px"},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.onSubmit(e)}}},[a("h2",[t._v("重置密码")]),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"text","auto-complete":"off",placeholder:"绑定的邮箱"},model:{value:t.email,callback:function(e){t.email=e},expression:"email"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"text","auto-complete":"off",placeholder:"验证码"},model:{value:t.v_code,callback:function(e){t.v_code=e},expression:"v_code"}}),t._v(" "),a("img",{staticClass:"v_code_img",attrs:{src:t.v_code_img},on:{click:t.change_v_code_img}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-button",{staticStyle:{width:"100%"},attrs:{type:"primary"},on:{click:t.onSubmit}},[t._v("提交")])],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("router-link",{attrs:{to:"/user/login"}},[t._v("想起密码了?去登录")]),t._v("   \n ")],1)],1)],1)],1),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var F=a("VU/8")(x,C,!1,function(t){a("DSDa")},"data-v-4b1f564c",null).exports,S={name:"",components:{},data:function(){return{new_password:""}},methods:{onSubmit:function(){var t=this,e=DocConfig.server+"/api/user/resetPasswordByUrl",a=new URLSearchParams;a.append("new_password",this.new_password),a.append("uid",this.$route.query.uid),a.append("email",this.$route.query.email),a.append("token",this.$route.query.token),t.axios.post(e,a).then(function(e){if(0===e.data.error_code){var a=decodeURIComponent(t.$route.query.redirect||"/item/index");t.$router.replace({path:a})}else t.$alert(e.data.error_message)})}},mounted:function(){},beforeDestroy:function(){}},L={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",[a("el-card",{staticClass:"center-card"},[a("el-form",{staticClass:"demo-ruleForm",attrs:{"status-icon":"","label-width":"0px"},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.onSubmit(e)}}},[a("h2",[t._v("重置密码")]),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"password","auto-complete":"off",placeholder:"请输入新密码"},model:{value:t.new_password,callback:function(e){t.new_password=e},expression:"new_password"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-button",{staticStyle:{width:"100%"},attrs:{type:"primary"},on:{click:t.onSubmit}},[t._v("提交")])],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("router-link",{attrs:{to:"/user/login"}},[t._v("去登录")]),t._v("   \n ")],1)],1)],1)],1),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var I=a("VU/8")(S,L,!1,function(t){a("U/K7")},"data-v-064e0dac",null).exports,T={name:"",components:{TextHighlight:a("CyOM").a},props:{keyword:"",itemList:[]},data:function(){return{searchItemIds:[],resultList:[],showLoading:!1,queries:[],itemResultList:[]}},watch:{keyword:function(t){var e=this;this.searchItemIds=[],this.resultList=[],this.queries=[],this.queries.push(this.keyword),this.itemList.forEach(function(t){e.searchItemIds.push(t.item_id)}),this.searchItems(),this.searchPages()}},methods:{searchPages:function(){var t=this;this.showLoading=!0;var e=this.searchItemIds.shift();if(!e)return this.showLoading=!1,!1;this.request("/api/item/search",{keyword:this.keyword,item_id:e}).then(function(e){var a=e.data;a&&a.pages&&a.pages.length>0&&t.resultList.push(a),t.searchPages()})},searchItems:function(){var t=this;this.itemResultList=[],this.itemList.map(function(e,a){e&&e.item_name&&e.item_name.indexOf(t.keyword)>-1&&t.itemResultList.push(e)})}},mounted:function(){var t=this;this.queries=[],this.queries.push(this.keyword),this.itemList.forEach(function(e){t.searchItemIds.push(e.item_id)}),this.searchItems(),this.searchPages()},beforeDestroy:function(){this.searchItemIds=[]}},V={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"page"},[t._l(t.itemResultList,function(e){return a("div",{key:e.item_id,staticClass:"itemResultList"},[a("hr"),t._v(" "),a("p",{staticClass:"title"},[a("router-link",{attrs:{to:"/"+e.item_id,tag:"a",target:"_blank"}},[a("text-highlight",{attrs:{queries:t.queries}},[t._v(t._s(e.item_name))])],1)],1),t._v(" "),a("p",{staticClass:"content"},[t._v("\n "+t._s(e.item_description)+"\n ")])])}),t._v(" "),t._l(t.resultList,function(e){return a("div",{key:e.item_id,staticClass:"resultList"},t._l(e.pages,function(e){return a("div",{key:e.page_id},[a("hr"),t._v(" "),a("p",{staticClass:"title"},[a("router-link",{attrs:{to:"/"+e.item_id+"?page_id="+e.page_id,tag:"a",target:"_blank"}},[a("text-highlight",{attrs:{queries:t.queries}},[t._v(t._s(e.item_name)+" - "+t._s(e.page_title))])],1)],1),t._v(" "),a("p",{staticClass:"content"},[a("text-highlight",{attrs:{queries:t.queries}},[t._v(t._s(e.search_content))])],1)])}),0)}),t._v(" "),t.showLoading?a("div",{staticClass:"loading"},[a("i",{staticClass:"el-icon-loading"})]):t._e()],2)},staticRenderFns:[]};var P=a("VU/8")(T,V,!1,function(t){a("0G7g")},"data-v-39594b83",null).exports,M=a("w/TU"),U=a.n(M);if("undefined"!=typeof window)var D=a("zhAq");var j={components:{draggable:U.a,Search:P},data:function(){return{currentDate:new Date,itemList:{},isAdmin:!1,keyword:"",lang:"",username:"",showSearch:!1,itemGroupId:"0",itemGroupList:[],loading:!1}},watch:{keyword:function(t){t?t&&1==t.length?new RegExp("[一-龥]+").test(t)&&(this.showSearch=!0):this.showSearch=!0:this.showSearch=!1}},methods:{get_item_list:function(){var t=this;this.loading=!0;var e=this.itemGroupId;this.request("/api/item/myList",{item_group_id:e}).then(function(e){t.loading=!1,t.itemList=e.data})},feedback:function(){if("en"==DocConfig.lang)window.open("https://github.com/star7th/showdoc/issues");else{var t="你正在使用免费开源版showdoc,如有问题或者建议,请到github提issue:";t+="<a href='https://github.com/star7th/showdoc/issues' target='_blank'>https://github.com/star7th/showdoc/issues</a><br>",t+="如果你觉得showdoc好用,不妨给开源项目点一个star。良好的关注度和参与度有助于开源项目的长远发展。",this.$alert(t,{dangerouslyUseHTMLString:!0})}},item_top_class:function(t){return t?"el-icon-arrow-down":"el-icon-arrow-up"},bind_item_even:function(){D(["static/jquery.min.js"],function(){$(".item-thumbnail").mouseover(function(){$(this).find(".item-setting").show()}),$(".item-thumbnail").mouseout(function(){$(this).find(".item-setting").hide(),$(this).find(".item-top").hide(),$(this).find(".item-down").hide()})})},click_item_setting:function(t){this.$router.push({path:"/item/setting/"+t})},click_item_exit:function(t){var e=this;this.$confirm(e.$t("confirm_exit_item")," ",{confirmButtonText:e.$t("confirm"),cancelButtonText:e.$t("cancel"),type:"warning"}).then(function(){var a=DocConfig.server+"/api/item/exitItem",i=new URLSearchParams;i.append("item_id",t),e.axios.post(a,i).then(function(t){0===t.data.error_code?window.location.reload():e.$alert(t.data.error_message)})})},logout:function(){var t=this,e=DocConfig.server+"/api/user/logout",a=document.cookie.match(/[^ =;]+(?=\=)/g);if(a)for(var i=a.length;i--;)document.cookie=a[i]+"=0;expires="+new Date(0).toUTCString();localStorage.clear();var o=new URLSearchParams;o.append("confirm","1"),t.axios.post(e,o).then(function(e){0===e.data.error_code?t.$router.push({path:"/"}):t.$alert(e.data.error_message)})},user_info:function(){var t=this;this.get_user_info(function(e){0===e.data.error_code&&1==e.data.data.groupid&&(t.isAdmin=!0)})},dropdown_callback:function(t){t&&t()},sort_item:function(t){var e=this,a=DocConfig.server+"/api/item/sort",i=new URLSearchParams;i.append("data",p()(t)),i.append("item_group_id",this.itemGroupId),e.axios.post(a,i).then(function(t){0===t.data.error_code?e.get_item_list():e.$alert(t.data.error_message,"",{callback:function(){window.location.reload()}})})},endMove:function(t){for(var e={},a=0;a<this.itemList.length;a++){e[this.itemList[a].item_id]=a+1}this.sort_item(e)},script_cron:function(){var t=DocConfig.server+"/api/ScriptCron/run";this.axios.get(t)},getItemGroupList:function(){var t=this;this.request("/api/itemGroup/getList",{}).then(function(e){t.itemGroupList=e.data;var a=localStorage.getItem("deaultItemGroupId");t.itemGroupList.map(function(e){e.id==a&&(t.itemGroupId=a)}),t.get_item_list()})},changeGroup:function(){localStorage.setItem("deaultItemGroupId",this.itemGroupId),this.get_item_list()},toUserSettingLink:function(){this.$router.push({path:"/user/setting"})},toAttachmentLink:function(){this.$router.push({path:"/attachment/index"})},toMessageLink:function(){this.$router.push({path:"/message/index"})}},mounted:function(){var t=this;this.user_info(),this.lang=DocConfig.lang,this.script_cron();var e=localStorage.getItem("deaultItemGroupId");null===e?(this.get_item_list(),this.itemGroupId="0"):this.itemGroupId=e,this.getItemGroupList(),this.get_user_info(function(e){0===e.data.error_code&&(t.username=e.data.data.username)})},beforeDestroy:function(){this.$message.closeAll()}},R={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",{staticClass:"container-narrow"},[a("el-row",{staticClass:"masthead"},[a("div",{staticClass:"logo-title"},[a("h2",{staticClass:"muted"},[a("img",{staticStyle:{width:"50px",height:"50px","margin-bottom":"-10px"},attrs:{src:"static/logo/b_64.png",alt:""}}),t._v("ShowDoc\n ")])]),t._v(" "),a("div",{staticClass:"header-btn-group pull-right"},[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("feedback"),placement:"top"}},[a("router-link",{attrs:{to:""}},[a("i",{staticClass:"el-icon-phone-outline",on:{click:t.feedback}})])],1),t._v(" "),"zh-cn"==t.lang?a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"客户端",placement:"top"}},[a("a",{attrs:{target:"_blank",href:"https://www.showdoc.cc/clients"}},[a("i",{staticClass:"el-icon-mobile-phone"})])]):t._e(),t._v(" "),"zh-cn"==t.lang?a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"接口开发调试工具RunApi",placement:"top"}},[a("a",{attrs:{target:"_blank",href:"https://www.showdoc.cc/runapi"}},[a("i",{staticClass:"el-icon-connection"})])]):t._e(),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("team_mamage"),placement:"top"}},[a("router-link",{attrs:{to:"/team/index"}},[a("i",{staticClass:"el-icon-s-flag"})])],1),t._v(" "),t.isAdmin?a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("background"),placement:"top"}},[a("router-link",{attrs:{to:"/admin/index"}},[a("i",{staticClass:"el-icon-s-tools"})])],1):t._e(),t._v("  \n "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("more"),placement:"top"}},[a("el-dropdown",{attrs:{trigger:"click"},on:{command:t.dropdown_callback}},[a("span",{staticClass:"el-dropdown-link"},[a("i",{staticClass:"el-icon-caret-bottom el-icon--right"})]),t._v(" "),a("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[a("el-dropdown-item",{attrs:{command:t.toUserSettingLink}},[t._v("\n "+t._s(t.$t("Logged"))+":"+t._s(t.username)+"\n ")]),t._v(" "),a("el-dropdown-item",{attrs:{divided:"",command:t.toMessageLink}},[t._v("\n "+t._s(t.$t("my_notice"))+"\n ")]),t._v(" "),a("el-dropdown-item",{attrs:{command:t.toAttachmentLink}},[t._v("\n "+t._s(t.$t("my_attachment"))+"\n ")]),t._v(" "),a("el-dropdown-item",{attrs:{command:t.logout}},[t._v(t._s(t.$t("logout")))])],1)],1)],1)],1)])],1),t._v(" "),a("el-container",{staticClass:"container-narrow"},[a("div",{staticClass:"container-thumbnails"},[t.itemList.length>1?a("div",{staticClass:"search-box-div"},[a("div",{staticClass:"search-box el-input el-input--prefix"},[a("el-input",{attrs:{autocomplete:"off",type:"text",validateevent:"true",clearable:!0},model:{value:t.keyword,callback:function(e){t.keyword=e},expression:"keyword"}}),t._v(" "),a("span",{staticClass:"el-input__prefix"},[a("i",{staticClass:"el-input__icon el-icon-search"})])],1)]):t._e(),t._v(" "),t.showSearch?a("Search",{attrs:{keyword:t.keyword,itemList:t.itemList}}):t._e(),t._v(" "),a("div",{directives:[{name:"show",rawName:"v-show",value:!t.showSearch&&(t.itemGroupId>0||t.itemList.length>5),expression:"!showSearch && (itemGroupId > 0 || itemList.length > 5)"}],staticClass:"group-bar"},[a("el-radio-group",{attrs:{size:"small"},on:{change:t.changeGroup},model:{value:t.itemGroupId,callback:function(e){t.itemGroupId=e},expression:"itemGroupId"}},[a("el-radio-button",{staticClass:"radio-button",attrs:{label:"0"}},[t._v(t._s(t.$t("all_items")))]),t._v(" "),t._l(t.itemGroupList,function(e){return a("el-radio-button",{key:e.id,staticClass:"radio-button",attrs:{label:e.id}},[t._v(t._s(e.group_name))])})],2),t._v(" "),a("router-link",{staticClass:"group-link",attrs:{to:"/item/group/index"}},[t._v("\n "+t._s(t.$t("manage_item_group"))+"\n ")]),t._v(" "),a("router-link",{staticClass:"group-link",attrs:{to:"/item/add"}},[t._v("\n "+t._s(t.$t("new_item"))+"\n ")])],1),t._v(" "),t.showSearch?t._e():a("ul",{staticClass:"thumbnails",attrs:{id:"item-list"}},[a("draggable",{attrs:{tag:"span",group:"item",ghostClass:"sortable-chosen"},on:{end:t.endMove},model:{value:t.itemList,callback:function(e){t.itemList=e},expression:"itemList"}},t._l(t.itemList,function(e){return a("li",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],key:e.item_id,staticClass:"text-center"},[a("router-link",{staticClass:"thumbnail item-thumbnail",attrs:{to:"/"+(e.item_domain?e.item_domain:e.item_id),title:e.item_description}},[e.creator?a("span",{staticClass:"item-setting",attrs:{title:t.$t("item_setting")},on:{click:function(a){return a.preventDefault(),t.click_item_setting(e.item_id)}}},[a("i",{staticClass:"el-icon-setting"})]):t._e(),t._v(" "),e.creator?t._e():a("span",{staticClass:"item-exit",attrs:{title:t.$t("item_exit")},on:{click:function(a){return a.preventDefault(),t.click_item_exit(e.item_id)}}},[a("i",{staticClass:"el-icon-close"})]),t._v(" "),a("p",{staticClass:"my-item"},[t._v(t._s(e.item_name))]),t._v(" "),e.is_private?a("span",{staticClass:"item-private"},[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("private_tips"),placement:"right"}},[a("i",{staticClass:"el-icon-lock"})])],1):t._e()])],1)}),0),t._v(" "),t.itemGroupId<=0?a("li",{staticClass:"text-center"},[a("router-link",{staticClass:"thumbnail item-thumbnail",attrs:{to:"/item/add",title:""}},[a("p",{staticClass:"my-item"},[t._v("\n "+t._s(t.$t("new_item"))+"\n "),a("i",{staticClass:"el-icon-plus"})])])],1):t._e()],1)],1)]),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var q=a("VU/8")(j,R,!1,function(t){a("ZFgX"),a("oS9z")},"data-v-753d1169",null).exports,E={name:"Login",components:{},data:function(){return{infoForm:{item_name:"",item_description:"",item_domain:"",password:"",item_type:"1"},isOpenItem:!0}},methods:{FormSubmit:function(){var t=this,e=DocConfig.server+"/api/item/add";if(!this.isOpenItem&&!this.infoForm.password)return t.$alert(t.$t("private_item_passwrod")),!1;this.isOpenItem&&(this.infoForm.password="");var a=new URLSearchParams;a.append("item_type",this.infoForm.item_type),a.append("item_name",this.infoForm.item_name),a.append("item_description",this.infoForm.item_description),a.append("item_domain",this.infoForm.item_domain),a.append("password",this.infoForm.password),t.axios.post(e,a).then(function(e){0===e.data.error_code?t.$router.push({path:"/item/index"}):t.$alert(e.data.error_message)})}},mounted:function(){}},A={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("el-form",{staticClass:"infoForm",attrs:{"status-icon":"","label-width":"10px"},model:{value:t.infoForm,callback:function(e){t.infoForm=e},expression:"infoForm"}},[a("el-form-item",[a("el-radio-group",{model:{value:t.infoForm.item_type,callback:function(e){t.$set(t.infoForm,"item_type",e)},expression:"infoForm.item_type"}},[a("el-radio",{attrs:{label:"1"}},[t._v(t._s(t.$t("regular_item")))]),t._v(" "),a("el-radio",{attrs:{label:"4"}},[t._v(t._s(t.$t("table")))]),t._v(" "),a("el-radio",{attrs:{label:"2"}},[t._v("\n "+t._s(t.$t("single_item"))+"\n "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("single_item_tips"),placement:"top"}},[a("i",{staticClass:"el-icon-question"})])],1)],1)],1),t._v(" "),a("el-form-item",[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("item_name"),placement:"right"}},[a("el-input",{attrs:{type:"text","auto-complete":"off",placeholder:t.$t("item_name")},model:{value:t.infoForm.item_name,callback:function(e){t.$set(t.infoForm,"item_name",e)},expression:"infoForm.item_name"}})],1)],1),t._v(" "),a("el-form-item",[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("item_description"),placement:"right"}},[a("el-input",{attrs:{type:"text","auto-complete":"off",placeholder:t.$t("item_description")},model:{value:t.infoForm.item_description,callback:function(e){t.$set(t.infoForm,"item_description",e)},expression:"infoForm.item_description"}})],1)],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-radio",{attrs:{label:!0},model:{value:t.isOpenItem,callback:function(e){t.isOpenItem=e},expression:"isOpenItem"}},[t._v(t._s(t.$t("Open_item")))]),t._v(" "),a("el-radio",{attrs:{label:!1},model:{value:t.isOpenItem,callback:function(e){t.isOpenItem=e},expression:"isOpenItem"}},[t._v(t._s(t.$t("private_item")))])],1),t._v(" "),a("el-form-item",{directives:[{name:"show",rawName:"v-show",value:!t.isOpenItem,expression:"!isOpenItem"}]},[a("el-input",{attrs:{type:"password","auto-complete":"off",placeholder:t.$t("visit_password")},model:{value:t.infoForm.password,callback:function(e){t.$set(t.infoForm,"password",e)},expression:"infoForm.password"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-button",{staticStyle:{width:"100%"},attrs:{type:"primary"},on:{click:t.FormSubmit}},[t._v(t._s(t.$t("submit")))])],1)],1)],1)},staticRenderFns:[]};var O={name:"Login",components:{},data:function(){return{infoForm:{},isOpenItem:!0,itemList:{},copy_item_id:"",item_name:"",item_description:"",password:""}},methods:{get_item_list:function(){var t=this,e=DocConfig.server+"/api/item/myList",a=new URLSearchParams;t.axios.get(e,a).then(function(e){if(0===e.data.error_code){var a=e.data.data;t.itemList=a}else t.$alert(e.data.error_message)})},choose_copy_item:function(t){for(var e=0;e<this.itemList.length;e++)t==this.itemList[e].item_id&&(this.item_name=this.itemList[e].item_name+"--copy",this.item_description=this.itemList[e].item_description)},FormSubmit:function(){var t=this;if(!this.isOpenItem&&!this.password)return t.$alert(t.$t("private_item_passwrod")),!1;this.isOpenItem&&(this.password=""),this.request("/api/item/add",{copy_item_id:this.copy_item_id,item_name:this.item_name,password:this.password,item_description:this.item_description}).then(function(){t.$router.push({path:"/item/index"})})}},mounted:function(){this.get_item_list()}},z={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("p",{staticClass:"tips"},[t._v(t._s(t.$t("copy_item_tips1")))]),t._v(" "),a("el-form",{staticClass:"infoForm",attrs:{"status-icon":"","label-width":"10px"},model:{value:t.infoForm,callback:function(e){t.infoForm=e},expression:"infoForm"}},[a("el-form-item",{staticClass:"text-left",attrs:{label:""}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:t.$t("please_choose")},on:{change:t.choose_copy_item},model:{value:t.copy_item_id,callback:function(e){t.copy_item_id=e},expression:"copy_item_id"}},t._l(t.itemList,function(t){return a("el-option",{key:t.item_id,attrs:{label:t.item_name,value:t.item_id}})}),1)],1),t._v(" "),a("el-form-item",[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("copy_item_tips2"),placement:"right"}},[a("el-input",{attrs:{type:"text","auto-complete":"off",placeholder:t.$t("copy_item_tips2")},model:{value:t.item_name,callback:function(e){t.item_name=e},expression:"item_name"}})],1)],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-radio",{attrs:{label:!0},model:{value:t.isOpenItem,callback:function(e){t.isOpenItem=e},expression:"isOpenItem"}},[t._v(t._s(t.$t("Open_item")))]),t._v(" "),a("el-radio",{attrs:{label:!1},model:{value:t.isOpenItem,callback:function(e){t.isOpenItem=e},expression:"isOpenItem"}},[t._v(t._s(t.$t("private_item")))])],1),t._v(" "),a("el-form-item",{directives:[{name:"show",rawName:"v-show",value:!t.isOpenItem,expression:"!isOpenItem"}]},[a("el-input",{attrs:{type:"text","auto-complete":"off",placeholder:t.$t("visit_password")},model:{value:t.password,callback:function(e){t.password=e},expression:"password"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-button",{staticStyle:{width:"100%"},attrs:{type:"primary"},on:{click:t.FormSubmit}},[t._v(t._s(t.$t("submit")))])],1)],1)],1)},staticRenderFns:[]};var B={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("p",[a("span",{domProps:{innerHTML:t._s(t.$t("open_api_tips1"))}})]),t._v(" "),a("p",[a("span",{domProps:{innerHTML:t._s(t.$t("open_api_tips2"))}})]),t._v(" "),a("p",[a("span",{domProps:{innerHTML:t._s(t.$t("open_api_tips3"))}})]),t._v(" "),a("p",[a("span",{domProps:{innerHTML:t._s(t.$t("open_api_tips4"))}})])])},staticRenderFns:[]};var H={name:"Login",components:{},data:function(){return{api_key:"",api_token:"",loading:"",upload_url:DocConfig.server+"/api/import/auto"}},methods:{success:function(t){this.loading.close(),0===t.error_code?this.$router.push({path:"/item/index"}):this.$alert(t.error_message)},beforeUpload:function(){this.loading=this.$loading()}},mounted:function(){}},N={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("p",{staticClass:"tips"},[a("span",{domProps:{innerHTML:t._s(t.$t("import_file_tips1"))}})]),t._v(" "),a("p",[a("el-upload",{staticClass:"upload-demo",attrs:{drag:"",name:"file",action:t.upload_url,"on-success":t.success,"before-upload":t.beforeUpload,"show-file-list":!1}},[a("i",{staticClass:"el-icon-upload"}),t._v(" "),a("div",{staticClass:"el-upload__text"},[a("span",{domProps:{innerHTML:t._s(t.$t("import_file_tips2"))}})])])],1),t._v(" "),a("p"),t._v(" "),a("p")])},staticRenderFns:[]};var G={name:"Login",components:{Regular:a("VU/8")(E,A,!1,function(t){a("Lf0y")},"data-v-4842bd4a",null).exports,Copy:a("VU/8")(O,z,!1,function(t){a("pOoL")},"data-v-4d35f1b0",null).exports,OpenApi:a("VU/8")({name:"Login",components:{},data:function(){return{api_key:"",api_token:""}},methods:{},mounted:function(){}},B,!1,function(t){a("bv2D")},"data-v-ad064460",null).exports,Import:a("VU/8")(H,N,!1,function(t){a("qHHh")},"data-v-11eb7760",null).exports},data:function(){return{userInfo:{}}},methods:{get_item_info:function(){var t=this,e=DocConfig.server+"/api/item/detail",a=new URLSearchParams;a.append("item_id",t.$route.params.item_id),t.axios.post(e,a).then(function(e){if(0===e.data.error_code){var a=e.data.data;t.infoForm=a}else t.$alert(e.data.error_message)}).catch(function(t){console.log(t)})},goback:function(){this.$router.go(-1)}},mounted:function(){},beforeDestroy:function(){}},J={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",[a("el-card",{staticClass:"center-card"},[[a("el-button",{staticClass:"goback-btn",attrs:{type:"text"},on:{click:t.goback}},[a("i",{staticClass:"el-icon-back"})]),t._v(" "),a("el-tabs",{attrs:{value:"first",type:"card"}},[a("el-tab-pane",{attrs:{label:t.$t("new_item"),name:"first"}},[a("Regular")],1),t._v(" "),a("el-tab-pane",{attrs:{label:t.$t("copy_item"),name:"third"}},[a("Copy")],1),t._v(" "),a("el-tab-pane",{attrs:{label:t.$t("import_file"),name:"four"}},[a("Import")],1),t._v(" "),a("el-tab-pane",{attrs:{label:t.$t("auto_item"),name:"five"}},[a("OpenApi")],1)],1)]],2)],1),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var W=a("VU/8")(G,J,!1,function(t){a("6Gtl")},"data-v-42d40eb4",null).exports,K={name:"Login",components:{},data:function(){return{password:"",v_code:"",v_code_img:DocConfig.server+"/api/common/verify",show_v_code:!1}},methods:{onSubmit:function(){var t=this.$route.params.item_id?this.$route.params.item_id:0,e=this.$route.query.page_id?this.$route.query.page_id:0,a=this,i=DocConfig.server+"/api/item/pwd",o=new URLSearchParams;o.append("item_id",t),o.append("page_id",e),o.append("password",this.password),o.append("v_code",this.v_code),a.axios.post(i,o).then(function(e){if(0===e.data.error_code){var i=decodeURIComponent(a.$route.query.redirect||"/"+t);a.$router.replace({path:i})}else 10206!==e.data.error_code&&10308!==e.data.error_code||(a.show_v_code=!0,a.change_v_code_img()),a.$alert(e.data.error_message)})},change_v_code_img:function(){var t="&rand="+Math.random();this.v_code_img+=t}},mounted:function(){},beforeDestroy:function(){}},Y={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",[a("el-card",{staticClass:"center-card",attrs:{onkeydown:"if(event.keyCode==13)return false;"}},[a("el-form",{staticClass:"demo-ruleForm",attrs:{"status-icon":"","label-width":"0px"},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.onSubmit(e)}}},[a("h2",[t._v(t._s(t.$t("input_visit_password")))]),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"password","auto-complete":"off",placeholder:t.$t("password")},model:{value:t.password,callback:function(e){t.password=e},expression:"password"}})],1),t._v(" "),t.show_v_code?a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"text","auto-complete":"off",placeholder:t.$t("verification_code")},model:{value:t.v_code,callback:function(e){t.v_code=e},expression:"v_code"}}),t._v(" "),a("img",{staticClass:"v_code_img",attrs:{src:t.v_code_img},on:{click:t.change_v_code_img}})],1):t._e(),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-button",{staticStyle:{width:"100%"},attrs:{type:"primary"},on:{click:t.onSubmit}},[t._v(t._s(t.$t("submit")))])],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("router-link",{attrs:{to:"/user/login"}},[t._v(t._s(t.$t("login")))]),t._v("\n    \n ")],1)],1)],1)],1),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var X=a("VU/8")(K,Y,!1,function(t){a("ghpK")},"data-v-224e0262",null).exports,Z={render:function(){var t=this.$createElement,e=this._self._c||t;return e("transition",{attrs:{name:"fade"}},[e("div",{staticClass:"img-view",on:{click:this.bigImg}},[e("div",{staticClass:"img-layer"}),this._v(" "),e("div",{staticClass:"img"},[e("img",{attrs:{src:this.imgSrc}})])])])},staticRenderFns:[]};var Q=a("VU/8")({props:["imgSrc"],methods:{bigImg:function(){this.$emit("clickit")}}},Z,!1,function(t){a("/BJT")},"data-v-8b8ced44",null).exports;if("undefined"!=typeof window)var tt=a("zhAq");var et={name:"Editor",props:{width:"",content:{type:String,default:"###初始化成功"},type:{type:String,default:"editor"},keyword:{type:String,default:""},id:{type:String,default:"editor-md"},editorPath:{type:String,default:"static/editor.md"},editorConfig:{type:Object,default:function(){var t=this;return{path:"static/editor.md/lib/",height:750,taskList:!0,atLink:!1,emailLink:!1,tex:!0,flowChart:!0,sequenceDiagram:!0,syncScrolling:"single",htmlDecode:"style,script,iframe|filterXSS",imageUpload:!0,imageFormats:["jpg","jpeg","gif","png","bmp","webp","JPG","JPEG","GIF","PNG","BMP","WEBP"],imageUploadURL:DocConfig.server+"/api/page/uploadImg",onload:function(){console.log("onload")},toolbarIcons:function(){return["undo","redo","|","bold","del","italic","quote","|","toc","mindmap","h1","h2","h3","h4","h5","h6","|","list-ul","list-ol","hr","center","|","link","reference-link","image","video","code","code-block","table","datetime","html-entities","pagebreak","|","watch","preview","fullscreen","clear","search","|","help","info"]},toolbarIconsClass:{toc:"fa-bars ",mindmap:"fa-sitemap ",video:"fa-file-video-o",center:"fa-align-center"},toolbarHandlers:{toc:function(t,e,a,i){t.setCursor(0,0),t.replaceSelection("[TOC]\r\n\r\n")},video:function(t,e,a,i){t.replaceSelection('\r\n<video src="http://your-site.com/your.mp4" style="width: 100%; height: 100%;" controls="controls"></video>\r\n'),""===i&&t.setCursor(a.line,a.ch+1)},mindmap:function(t,e,a,i){t.replaceSelection("\n```mindmap\n# 一级\n## 二级分支1\n### 三级分支1\n### 三级分支2\n## 二级分支2\n### 三级分支3\n### 三级分支4\n```\n"),""===i&&t.setCursor(a.line,a.ch+1)},center:function(t,e,a,i){t.replaceSelection("<center>"+i+"</center>"),""===i&&t.setCursor(a.line,a.ch+1)}},lang:{toolbar:{toc:"在最开头插入TOC,自动生成标题目录",mindmap:"插入思维导图",video:"插入视频",center:"居中"}},onchange:function(){t.deal_with_content()},previewCodeHighlight:!1}}}},components:{BigImg:Q},data:function(){return{instance:null,showImg:!1,imgSrc:""}},computed:{},mounted:function(){var t=this;tt([this.editorPath+"/../jquery.min.js",this.editorPath+"/lib/raphael.min.js",this.editorPath+"/lib/flowchart.min.js",this.editorPath+"/lib/d3@5.min.js"],function(){tt([t.editorPath+"/../xss.min.js",t.editorPath+"/lib/marked.min.js",t.editorPath+"/lib/underscore.min.js",t.editorPath+"/lib/sequence-diagram.min.js",t.editorPath+"/lib/jquery.flowchart.min.js",t.editorPath+"/lib/jquery.mark.min.js",t.editorPath+"/lib/plantuml.js?v=2",t.editorPath+"/lib/view.min.js",t.editorPath+"/lib/transform.min.js"],function(){tt(t.editorPath+"/editormd.js",function(){t.initEditor()})})})},beforeDestroy:function(){for(var t=1;t<999;t++)window.clearInterval(t)},methods:{initEditor:function(){var t=this;this.$nextTick(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.editormd;e&&("editor"==t.type?t.instance=e(t.id,t.editorConfig):t.instance=e.markdownToHTML(t.id,t.editorConfig),t.deal_with_content())})},insertValue:function(t){this.instance.insertValue(this.html_decode(t))},getMarkdown:function(){return this.instance.getMarkdown()},editor_unwatch:function(){return this.instance.unwatch()},editor_watch:function(){return this.instance.watch()},setCursorToTop:function(){return this.instance.setCursor({line:0,ch:0})},clear:function(){return this.instance.clear()},draft:function(){var t=this;setInterval(function(){localStorage.page_content=t.getMarkdown()},6e4);var e=localStorage.page_content;e&&e.length>0&&(localStorage.removeItem("page_content"),t.$confirm(t.$t("draft_tips"),"",{showClose:!1}).then(function(){t.clear(),t.insertValue(e),localStorage.removeItem("page_content")}).catch(function(){localStorage.removeItem("page_content")}))},beforeunloadHandler:function(t){return(t=t||window.event)&&(t.returnValue="提示"),"提示"},deal_with_content:function(){var t=this;tt(this.editorPath+"/../highlight/highlight.min.js",function(){hljs.highlightAll()}),$.each($("#"+this.id+" table"),function(){$(this).prop("outerHTML",'<div style="width: 100%;overflow-x: auto;">'+$(this).prop("outerHTML")+"</div>")}),$("#"+this.id+' a[href^="http"]').click(function(){var e=$(this).attr("href"),a=t.parseURL(e);return window.location.hostname==a.hostname&&window.location.pathname==a.pathname?(window.location.href=e,a.hash&&window.location.reload()):window.open(e),!1}),$("#"+this.id+" table tbody tr").each(function(){var t=$(this),e=t.find("td").eq(1).html(),a=t.find("td").eq(2).html();"object"==e||"array[object]"==e||"object"==a||"array[object]"==a?t.css({"background-color":"#F8F8F8"}):t.css("background-color","#fff"),t.hover(function(){t.css("background-color","#F8F8F8")},function(){"object"==e||"array[object]"==e||"object"==a||"array[object]"==a?t.css({"background-color":"#F8F8F8"}):t.css("background-color","#fff")})});var e=$("#"+this.id+" p").width();e=e||722,$("#"+this.id+" table").each(function(t){var a=$(this).get(0).rows.item(0).cells.length,i=Math.floor(e/a)-2;a<=5&&$(this).find("th").css("width",i.toString()+"px")}),$("#"+this.id+" img").click(function(){var e=$(this).attr("src");t.showImg=!0,t.imgSrc=e}),$("#"+this.id+" table thead tr").css("background-color","#409eff"),$("#"+this.id+" table thead tr").css("color","#fff"),$(".markdown-body pre").css("background-color","#fcfcfc"),$(".markdown-body pre").css("border","1px solid #e1e1e8"),this.keyword&&$("#"+this.id).mark(this.keyword)},html_decode:function(t){return 0==t.length?"":t.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&nbsp;/g," ").replace(/&#39;/g,"'").replace(/&quot;/g,'"')},parseURL:function(t){var e=document.createElement("a");return e.href=t,{source:t,protocol:e.protocol.replace(":",""),host:e.hostname,hostname:e.hostname,port:e.port,query:e.search,params:function(){for(var t,a={},i=e.search.replace(/^\?/,"").split("&"),o=i.length,n=0;n<o;n++)i[n]&&(a[(t=i[n].split("="))[0]]=t[1]);return a}(),hash:e.hash.replace("#",""),path:e.pathname.replace(/^([^\/])/,"/$1"),pathname:e.pathname.replace(/^([^\/])/,"/$1")}}}},at={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"main-editor",attrs:{id:t.id}},[a("textarea",{staticStyle:{display:"none"},domProps:{innerHTML:t._s(t.content)}}),t._v(" "),t.showImg?a("BigImg",{attrs:{imgSrc:t.imgSrc},on:{clickit:function(e){t.showImg=!1}}}):t._e()],1)},staticRenderFns:[]};var it=a("VU/8")(et,at,!1,function(t){a("bZFw"),a("Lw6k"),a("+NZg")},null,null).exports,ot={data:function(){return{status:!1,scrollTop:0,timer:null,speed:50}},mounted:function(){var t=this;window.onscroll=function(){t.scrollTop=document.body.scrollTop?document.body.scrollTop:document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:null,t.status=t.scrollTop&&t.scrollTop>0}},methods:{gototop:function(){var t=this;t.timer=setInterval(function(){t.scrollTop-=2e3,t.scrollTop<100&&(t.scrollTop=0,t.status=!1,clearInterval(t.timer)),scrollTo(0,t.scrollTop)},this.speed)}},destroyed:function(){clearInterval(this.timer)}},nt={render:function(){var t=this.$createElement,e=this._self._c||t;return e("div",{directives:[{name:"show",rawName:"v-show",value:this.status,expression:"status"}],staticClass:"gotop-box",on:{click:this.gototop}},[e("i",{staticClass:"el-icon-caret-top",attrs:{title:this.$t("back_to_top")}})])},staticRenderFns:[]};var st=a("VU/8")(ot,nt,!1,function(t){a("OYGk")},"data-v-7f2d3aab",null).exports,rt={data:function(){return{}},mounted:function(){var t=this,e=setInterval(function(){try{void 0!=$&&(clearInterval(e),t.toc_main_script())}catch(t){}},200)},methods:{toc_main_script:function(){$(document).on("click",".markdown-toc-list a[href]",function(t){t.preventDefault(),t.stopPropagation();var e=$(this).attr("href").substring(1),a=$('[name="'+e+'"]').offset().top;$("html, body").animate({scrollTop:a},300)}),$(document).on("click",".markdown-toc",function(t){$(t.target).is("a")||$(".markdown-toc").toggleClass("open-list")}),$(window).scroll(function(t){var e="";$(".markdown-toc-list a[href]").each(function(t,a){var i=$(a).attr("href").substring(1);if(!($('[name="'+i+'"]').offset().top-$(window).scrollTop()<1))return!1;e=i}),$(".markdown-toc-list a").removeClass("current"),$('.markdown-toc-list a[href="#'+e+'"]').addClass("current")}),!this.isMobile()&&window.screen.width>1e3&&this.$nextTick(function(){setTimeout(function(){$(".markdown-toc").click()},200)})}},destroyed:function(){$(document).off("click",".markdown-toc-list a[href]"),$(document).off("click",".markdown-toc"),$(".markdown-toc").remove()}},lt={render:function(){var t=this.$createElement;return(this._self._c||t)("div")},staticRenderFns:[]};var ct=a("VU/8")(rt,lt,!1,function(t){a("CUTH")},null,null).exports,mt={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[t.catalog.length?t._l(t.catalog,function(e){return a("el-submenu",{key:e.cat_id,attrs:{index:e.cat_id}},[a("template",{slot:"title"},[a("img",{attrs:{src:"static/images/folder.png"}}),t._v("\n "+t._s(e.cat_name)+"\n ")]),t._v(" "),e.pages?t._l(e.pages,function(e){return a("el-menu-item",{key:e.page_id,attrs:{index:e.page_id}},[a("i",{staticClass:"el-icon-document"}),t._v(" "),a("a",{attrs:{href:t.randerUrl(e.page_id),title:e.page_title,id:"left_page_"+e.page_id},on:{click:function(t){t.preventDefault()}}},[t._v(t._s(e.page_title))])])}):t._e(),t._v(" "),e.catalogs.length?a("LeftMenuSub",{attrs:{catalog:e.catalogs,item_info:t.item_info}}):t._e()],2)}):t._e()],2)},staticRenderFns:[]};var dt={props:{get_page_content:"",item_info:"",search_item:"",keyword:""},data:function(){return{openeds:[],menu:"",show_menu_btn:!1,hideScrollbar:!0,asideWidth:"250px",menuMarginLeft:"menu-margin-left1"}},components:{LeftMenuSub:a("VU/8")({name:"LeftMenuSub",props:{catalog:[],item_info:{}},data:function(){return{}},components:{},methods:{randerUrl:function(t){if(this.item_info)return"#/"+(this.item_info.item_domain?this.item_info.item_domain:this.item_info.item_id)+"/"+t}},mounted:function(){}},mt,!1,function(t){a("p6bL")},"data-v-c9561e08",null).exports},methods:{select_menu:function(t,e){this.change_url(t),this.get_page_content(t)},new_page:function(){var t="/page/edit/"+this.item_info.item_id+"/0";this.$router.push({path:t})},mamage_catalog:function(){var t="/catalog/"+this.item_info.item_id;this.$router.push({path:t})},change_url:function(t){if(!(t>0)||t!=this.$route.query.page_id&&t!=this.$route.params.page_id){var e=this.item_info.item_domain?this.item_info.item_domain:this.item_info.item_id;this.$router.replace({path:"/"+e+"/"+t})}},input_keyword:function(){this.search_item(this.keyword)},show_menu:function(){this.show_menu_btn=!1;var t=document.getElementById("left-side-menu");t.style.display="block",t.style.marginLeft="0px",t.style.marginTop="0px",t.style.position="static",(t=document.getElementById("p-content")).style.display="none"},hide_menu:function(){this.show_menu_btn=!0;var t=document.getElementById("left-side-menu");t.style.display="none",(t=document.getElementById("p-content")).style.marginLeft="0px",t.style.display="block",(t=document.getElementById("page_md_content")).style.width="95%"},randerUrl:function(t){return"#/"+(this.item_info.item_domain?this.item_info.item_domain:this.item_info.item_id)+"/"+t}},mounted:function(){this.menu=this.item_info.menu;var t=this.item_info;t.default_page_id>0&&(this.select_menu(t.default_page_id),t.default_cat_id4?this.openeds=[t.default_cat_id4,t.default_cat_id3,t.default_cat_id2,t.default_page_id]:t.default_cat_id3?this.openeds=[t.default_cat_id3,t.default_cat_id2,t.default_page_id]:t.default_cat_id2&&(this.openeds=[t.default_cat_id2,t.default_page_id]),setTimeout(function(){document.querySelector("#left_page_"+t.default_page_id).scrollIntoView()},1e3)),window.screen.width>=1600&&this.menu.catalogs&&this.menu.catalogs.length>0&&(this.asideWidth="300px",this.menuMarginLeft="menu-margin-left2")}},_t={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{class:t.hideScrollbar?"hide-scrollbar":"normal-scrollbar"},[t.show_menu_btn?a("i",{staticClass:"el-icon-menu header-left-btn",attrs:{id:"header-left-btn"},on:{click:t.show_menu}}):t._e(),t._v(" "),t.show_menu_btn?a("i",{staticClass:"el-icon-menu header-left-btn",attrs:{id:"header-left-btn"},on:{click:t.show_menu}}):t._e(),t._v(" "),a("el-aside",{class:t.menuMarginLeft,attrs:{id:"left-side-menu",width:t.asideWidth},nativeOn:{mouseenter:function(e){t.hideScrollbar=!1},mouseleave:function(e){t.hideScrollbar=!0}}},[a("el-menu",{attrs:{"background-color":"#fafafa","text-color":"","active-text-color":"#008cff","default-active":t.item_info.default_page_id,"default-openeds":t.openeds},on:{select:t.select_menu}},[a("el-input",{staticClass:"search-box",attrs:{placeholder:t.$t("input_keyword"),clearable:!0,size:"medium"},on:{clear:function(e){return t.search_item()}},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.input_keyword(e)}},model:{value:t.keyword,callback:function(e){t.keyword=e},expression:"keyword"}}),t._v(" "),t.menu.pages&&t.menu.pages.length?t._l(t.menu.pages,function(e){return a("el-menu-item",{key:e.page_id,attrs:{index:e.page_id}},[a("i",{staticClass:"el-icon-document"}),t._v(" "),a("a",{attrs:{href:t.randerUrl(e.page_id),title:e.page_title,id:"left_page_"+e.page_id},on:{click:function(t){t.preventDefault()}}},[t._v(t._s(e.page_title))])])}):t._e(),t._v(" "),t.menu.catalogs&&t.menu.catalogs.length?a("LeftMenuSub",{attrs:{catalog:t.menu.catalogs,item_info:t.item_info}}):t._e()],2)],1)],1)},staticRenderFns:[]};var pt=a("VU/8")(dt,_t,!1,function(t){a("GEii"),a("GtfQ")},"data-v-25900914",null).exports,ut={props:{callback:"",page_id:"",is_modal:!0,is_show_recover_btn:!0},data:function(){return{currentDate:new Date,content:[],dialogTableVisible:!1}},components:{},methods:{get_content:function(){var t=this,e=DocConfig.server+"/api/page/history",a=new URLSearchParams,i=this.page_id?this.page_id:t.$route.params.page_id;a.append("page_id",i),t.axios.post(e,a).then(function(e){0===e.data.error_code?e.data.data.length>0?(t.content=e.data.data,t.dialogTableVisible=!0):(t.dialogTableVisible=!1,t.$alert("no data")):(t.dialogTableVisible=!1,t.$alert(e.data.error_message))}).catch(function(t){console.log(t)})},show:function(){this.get_content()},recover:function(t){this.callback(t.page_content,!0),this.dialogTableVisible=!1},preview_diff:function(t){var e=t.page_history_id,a="#/page/diff/"+(this.page_id?this.page_id:this.$route.params.page_id)+"/"+e;window.open(a)},editComments:function(t){var e=this,a=this.page_id?this.page_id:this.$route.params.page_id;this.$prompt(""," ",{}).then(function(i){e.request("/api/page/updateHistoryComments",{page_id:a,page_history_id:t.page_history_id,page_comments:i.value}).then(function(){e.get_content()})})}},mounted:function(){}},ft={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",{staticClass:"container-narrow"},[a("el-dialog",{attrs:{title:t.$t("history_version"),modal:t.is_modal,visible:t.dialogTableVisible,"close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogTableVisible=e}}},[a("el-table",{attrs:{data:t.content}},[a("el-table-column",{attrs:{property:"addtime",label:t.$t("update_time"),width:"170"}}),t._v(" "),a("el-table-column",{attrs:{property:"author_username",label:t.$t("update_by_who")}}),t._v(" "),a("el-table-column",{attrs:{property:"page_comments",label:t.$t("remark")},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v("\n "+t._s(e.row.page_comments)+"\n "),t.is_show_recover_btn?a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.editComments(e.row)}}},[t._v(t._s(t.$t("edit")))]):t._e()]}}])}),t._v(" "),a("el-table-column",{attrs:{label:"操作",width:"150"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.preview_diff(e.row)}}},[t._v(t._s(t.$t("overview")))]),t._v(" "),t.is_show_recover_btn?a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.recover(e.row)}}},[t._v(t._s(t.$t("recover_to_this_version")))]):t._e()]}}])})],1)],1)],1),t._v(" "),a("Footer"),t._v(" "),a("div",{})],1)},staticRenderFns:[]};var ht=a("VU/8")(ut,ft,!1,function(t){a("okHl")},null,null).exports,gt={props:{callback:function(){},page_id:"",item_id:"",is_modal:!0,cat_id:""},data:function(){return{currentDate:new Date,dialogTableVisible:!0,pages:[],belong_to_catalogs:[]}},components:{draggable:U.a},methods:{show:function(){this.dialogTableVisible=!0},get_pages:function(){var t=this,e=DocConfig.server+"/api/catalog/getPagesBycat",a=new URLSearchParams;a.append("item_id",this.item_id),a.append("cat_id",this.cat_id),t.axios.post(e,a).then(function(e){0===e.data.error_code?t.pages=e.data.data:t.$alert(e.data.error_message)}).catch(function(t){console.log(t)})},endMove:function(t){for(var e={},a=0;a<this.pages.length;a++){e[this.pages[a].page_id]=a+1}this.sort_page(e)},sort_page:function(t){var e=this,a=DocConfig.server+"/api/page/sort",i=new URLSearchParams;i.append("pages",p()(t)),i.append("item_id",this.item_id),e.axios.post(a,i).then(function(t){0===t.data.error_code?e.get_pages():e.$alert(t.data.error_message,"",{callback:function(){window.location.reload()}})})},getCatListName:function(){var t=this;this.request("/api/catalog/catListName",{item_id:this.item_id}).then(function(e){t.belong_to_catalogs=e.data})}},watch:{cat_id:function(){this.get_pages()}},mounted:function(){this.get_pages(),this.getCatListName()}},vt={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",{staticClass:"container-narrow"},[a("el-dialog",{attrs:{title:t.$t("sort_pages"),modal:t.is_modal,visible:t.dialogTableVisible,"close-on-click-modal":!1,"before-close":t.callback},on:{"update:visible":function(e){t.dialogTableVisible=e}}},[a("div",{staticClass:"dialog-body"},[a("p",{staticClass:"tips"},[t._v(t._s(t.$t("sort_pages_tips")))]),t._v(" "),t.belong_to_catalogs?a("el-select",{staticClass:"select-cat",attrs:{placeholder:t.$t("optional")},model:{value:t.cat_id,callback:function(e){t.cat_id=e},expression:"cat_id"}},t._l(t.belong_to_catalogs,function(t){return a("el-option",{key:t.cat_name,attrs:{label:t.cat_name,value:t.cat_id}})}),1):t._e(),t._v(" "),a("draggable",{attrs:{tag:"div",group:"page"},on:{end:t.endMove},model:{value:t.pages,callback:function(e){t.pages=e},expression:"pages"}},t._l(t.pages,function(e){return a("div",{key:e.page_id,staticClass:"page-box"},[a("span",{staticClass:"page-name"},[t._v(t._s(e.page_title))])])}),0)],1)])],1),t._v(" "),a("Footer"),t._v(" "),a("div",{})],1)},staticRenderFns:[]};var bt=a("VU/8")(gt,vt,!1,function(t){a("wgGe")},"data-v-19e9dfb0",null).exports,wt={props:{callback:function(){},page_id:"",item_id:""},data:function(){return{page:1,count:10,dataList:[],total:0,dialogTableVisible:!0,lang:""}},components:{},computed:{},methods:{getList:function(){var t=this;this.request("/api/item/getChangeLog",{page:this.page,count:this.count,item_id:this.item_id}).then(function(e){var a=e.data;t.dialogTableVisible=!0,t.dataList=a.list,t.total=parseInt(a.total)})},handleCurrentChange:function(t){this.page=t,this.getList()},visitPage:function(t){var e=this.$router.resolve({path:"/"+this.item_id+"/"+t});window.open(e.href,"_blank")}},mounted:function(){this.getList(),this.lang=DocConfig.lang}},yt={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-dialog",{attrs:{title:t.$t("item_change_log_dialog_title"),visible:t.dialogTableVisible,"close-on-click-modal":!1,"before-close":t.callback,width:"70%"},on:{"update:visible":function(e){t.dialogTableVisible=e}}},[a("el-table",{attrs:{data:t.dataList}},[a("el-table-column",{attrs:{property:"optime",label:t.$t("optime"),width:"170"}}),t._v(" "),a("el-table-column",{attrs:{property:"oper",label:t.$t("oper")}}),t._v(" "),"zh-cn"==t.lang?a("el-table-column",{attrs:{property:"op_action_type_desc",label:t.$t("op_action_type_desc")}}):t._e(),t._v(" "),"zh-cn"==t.lang?a("el-table-column",{attrs:{property:"op_object_type_desc",label:t.$t("op_object_type_desc")}}):t._e(),t._v(" "),"en"==t.lang?a("el-table-column",{attrs:{property:"op_action_type",label:t.$t("op_action_type_desc")}}):t._e(),t._v(" "),"en"==t.lang?a("el-table-column",{attrs:{property:"op_object_type",label:t.$t("op_object_type_desc")}}):t._e(),t._v(" "),a("el-table-column",{attrs:{property:"op_object_name",label:t.$t("op_object_name")},scopedSlots:t._u([{key:"default",fn:function(e){return["create"!=e.row.op_action_type&&"update"!=e.row.op_action_type||"page"!=e.row.op_object_type?a("span",[t._v(t._s(e.row.op_object_name))]):a("el-button",{attrs:{type:"text"},on:{click:function(a){return t.visitPage(e.row.op_object_id)}}},[t._v(t._s(e.row.op_object_name))])]}}])})],1),t._v(" "),a("div",{staticClass:"block"},[a("span",{staticClass:"demonstration"}),t._v(" "),a("el-pagination",{attrs:{"page-size":t.count,layout:"total, prev, pager, next",total:t.total},on:{"current-change":t.handleCurrentChange}})],1)],1)],1)},staticRenderFns:[]};var kt={props:{item_id:"",item_domain:"",page_id:"",item_info:"",page_info:{}},data:function(){return{menu:[],dialogVisible:!1,qr_page_link:"#",qr_single_link:"#",share_page_link:"",share_single_link:"",copyText1:"",copyText2:"",isCreateSiglePage:!1,showMore:!1,lang:"",show_menu_btn:!1,show_op_bar:!0,sortPageVisiable:!1,dialogUploadVisible:!1,importToItemId:"",uploadUrl:DocConfig.server+"/api/import/auto",dialogChangeLogVisible:!1}},components:{HistoryVersion:ht,SortPage:bt,ChangeLog:a("VU/8")(wt,yt,!1,function(t){a("wFeN")},null,null).exports},methods:{edit_page:function(){var t=this.page_id>0?this.page_id:0,e="/page/edit/"+this.item_id+"/"+t;this.$router.push({path:e})},share_page:function(){var t=this.page_id>0?this.page_id:0,e=this.item_domain?this.item_domain:this.item_id;this.share_page_link=this.getRootPath()+"#/"+e+"/"+t,this.qr_page_link=DocConfig.server+"/api/common/qrcode&size=3&url="+encodeURIComponent(this.share_page_link),this.dialogVisible=!0,this.copyText1=this.item_info.item_name+" - "+this.page_info.page_title+"\r\n"+this.share_page_link,this.copyText2=this.page_info.page_title+"\r\n"+this.share_single_link},dropdown_callback:function(t){t&&t()},show_page_info:function(){var t="本页面由 "+this.page_info.author_username+" 于 "+this.page_info.addtime+" 更新";this.$alert(t)},ShowHistoryVersion:function(){this.$refs.HistoryVersion.show()},delete_page:function(){var t=this.page_id>0?this.page_id:0,e=this,a=DocConfig.server+"/api/page/delete";this.$confirm(e.$t("comfirm_delete")," ",{confirmButtonText:e.$t("confirm"),cancelButtonText:e.$t("cancel"),type:"warning"}).then(function(){var i=new URLSearchParams;i.append("page_id",t),e.axios.post(a,i).then(function(t){0===t.data.error_code?window.location.reload():e.$alert(t.data.error_message)})})},onCopy:function(){this.$message(this.$t("copy_success"))},checkCreateSiglePage:function(t){var e=this;t?this.CreateSiglePage():this.$confirm(this.$t("cancelSingle")," ",{confirmButtonText:this.$t("cancelSingleYes"),cancelButtonText:this.$t("cancelSingleNo"),type:"warning"}).then(function(){e.CreateSiglePage()},function(){e.isCreateSiglePage=!0})},CreateSiglePage:function(){var t=this.page_id>0?this.page_id:0,e=this,a=DocConfig.server+"/api/page/createSinglePage",i=new URLSearchParams;i.append("page_id",t),i.append("isCreateSiglePage",this.isCreateSiglePage),e.axios.post(a,i).then(function(t){if(0===t.data.error_code){var a=t.data.data.unique_key;e.share_single_link=a?e.getRootPath()+"#/p/"+a:""}else e.$alert(t.data.error_message)})},new_page:function(){var t="/page/edit/"+this.item_info.item_id+"/0";this.$router.push({path:t})},mamage_catalog:function(){var t="/catalog/"+this.item_info.item_id;this.$router.push({path:t})},showMoreAction:function(){this.showMore=!0,setTimeout(function(){var t=document.getElementById("page_md_content").getElementsByClassName("open-list");t&&t[0]&&(t[0].style.top="380px")},700),sessionStorage.setItem("show_more_"+this.item_id,1)},hideMoreAction:function(){this.showMore=!1;var t=document.getElementById("page_md_content").getElementsByClassName("open-list");t&&t[0]&&(t[0].style.top="230px"),sessionStorage.removeItem("show_more_"+this.item_id)},handleCommand:function(t){switch(t){case"goback":this.$router.push({path:"/item/index"});break;case"share":this.share_page();break;case"new_page":this.new_page();break;case"new_catalog":this.mamage_catalog();break;case"edit_page":this.edit_page();break;case"ShowHistoryVersion":this.ShowHistoryVersion();break;case"copy":this.$router.push({path:"/page/edit/"+this.item_info.item_id+"/0?copy_page_id="+this.page_id});break;case"export":this.$router.push({path:"/item/export/"+this.item_info.item_id});break;case"delete_page":this.delete_page()}},reload:function(){window.location.reload()},beforeUpload:function(){this.loading=this.$loading()},uploadCallback:function(t){this.importToItemId>0?window.location.reload():(this.loading.close(),this.$router.push({path:"/item/index"}))}},mounted:function(){var t=this;this.lang=DocConfig.lang,this.page_info.unique_key&&(this.isCreateSiglePage=!0,this.share_single_link=this.getRootPath()+"#/p/"+this.page_info.unique_key),document.onkeydown=function(e){69==(window.event?e.keyCode:e.which)&&e.ctrlKey&&(t.edit_page(),e.preventDefault())},(this.isMobile()||window.innerWidth<1300&&!this.item_info.is_login)&&(this.show_menu_btn=!1,this.show_op_bar=!1),(this.isMobile()||window.innerWidth<1300&&this.item_info.is_login)&&(this.show_menu_btn=!0,this.show_op_bar=!1),sessionStorage.getItem("show_more_"+this.item_id)&&this.showMoreAction(),this.importToItemId=this.item_id},watch:{page_info:function(){this.page_info.unique_key?(this.isCreateSiglePage=!0,this.share_single_link=this.getRootPath()+"#/p/"+this.page_info.unique_key):(this.isCreateSiglePage=!1,this.share_single_link=""),sessionStorage.getItem("show_more_"+this.item_id)&&this.showMoreAction()}},destroyed:function(){document.onkeydown=void 0}},$t={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[t.show_menu_btn?a("div",{attrs:{id:"header-right-btn"}},[a("el-dropdown",{attrs:{trigger:"click"},on:{command:t.handleCommand}},[a("span",{staticClass:"el-dropdown-link"},[a("i",{staticClass:"el-icon-caret-bottom el-icon--right"})]),t._v(" "),a("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[a("el-dropdown-item",{attrs:{command:"goback"}},[t._v(t._s(t.$t("goback")))]),t._v(" "),a("el-dropdown-item",{attrs:{command:"share"}},[t._v(t._s(t.$t("share")))]),t._v(" "),t.item_info.item_edit?a("el-dropdown-item",{attrs:{command:"new_page"}},[t._v(t._s(t.$t("new_page")))]):t._e(),t._v(" "),t.item_info.item_edit?a("el-dropdown-item",{attrs:{command:"new_catalog"}},[t._v(t._s(t.$t("new_catalog")))]):t._e(),t._v(" "),t.item_info.item_edit?a("el-dropdown-item",{attrs:{command:"edit_page"}},[t._v(t._s(t.$t("edit_page")))]):t._e(),t._v(" "),t.item_info.item_edit?a("el-dropdown-item",{attrs:{command:"copy"}},[t._v(t._s(t.$t("copy")))]):t._e(),t._v(" "),t.item_info.item_edit?a("el-dropdown-item",{attrs:{command:"ShowHistoryVersion"}},[t._v(t._s(t.$t("history_version")))]):t._e(),t._v(" "),t.item_info.item_edit?a("el-dropdown-item",{attrs:{command:"export"}},[t._v(t._s(t.$t("export")))]):t._e(),t._v(" "),t.item_info.item_edit?a("el-dropdown-item",{attrs:{command:"delete_page"}},[t._v(t._s(t.$t("delete_interface")))]):t._e()],1)],1)],1):t._e(),t._v(" "),t.show_op_bar?a("div",{staticClass:"op-bar"},[t.item_info.is_login?t._e():a("span",[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("index_login_or_register"),placement:"top"}},[a("router-link",{attrs:{to:"/user/login"}},[a("i",{staticClass:"el-icon-user"})])],1),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("history_version"),placement:"top"}},[a("i",{staticClass:"el-icon-goods",on:{click:t.ShowHistoryVersion}})]),t._v(" "),"zh-cn"==t.lang?a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("about_showdoc"),placement:"top"}},[a("a",{attrs:{href:"https://www.showdoc.cc/help",target:"_blank"}},[a("i",{staticClass:"el-icon-arrow-right"})])]):t._e()],1),t._v(" "),t.item_info.is_login?a("span",[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("goback"),placement:"left"}},[a("router-link",{attrs:{to:"/item/index"}},[a("i",{staticClass:"el-icon-back"})])],1),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("share"),placement:"top"}},[a("i",{staticClass:"el-icon-share",on:{click:t.share_page}})]),t._v(" "),t.item_info.item_edit?t._e():a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("detail"),placement:"top"}},[a("i",{staticClass:"el-icon-info",on:{click:t.show_page_info}})]),t._v(" "),"3"==t.item_info.item_type?a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"runapi项目请在runapi客户端编辑",placement:"top"}},[a("i",{staticClass:"el-icon-edit",staticStyle:{color:"#666",cursor:"not-allowed"}})]):t._e()],1):t._e(),t._v(" "),t.item_info.item_edit?a("span",[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("new_page"),placement:"top"}},[a("i",{staticClass:"el-icon-plus",on:{click:t.new_page}})]),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("new_catalog"),placement:"left"}},[a("i",{staticClass:"el-icon-folder",on:{click:t.mamage_catalog}})]),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("edit_page"),placement:"top"}},[a("i",{staticClass:"el-icon-edit",on:{click:t.edit_page}})]),t._v(" "),a("el-tooltip",{directives:[{name:"show",rawName:"v-show",value:!t.showMore,expression:"!showMore"}],staticClass:"item",attrs:{effect:"dark",content:t.$t("more"),placement:"top"}},[a("i",{staticClass:"el-icon-caret-top",on:{click:t.showMoreAction}})]),t._v(" "),a("el-tooltip",{directives:[{name:"show",rawName:"v-show",value:t.showMore,expression:"showMore"}],staticClass:"item",attrs:{effect:"dark",content:t.$t("more"),placement:"top"}},[a("i",{staticClass:"el-icon-caret-bottom",on:{click:t.hideMoreAction}})]),t._v(" "),a("span",{directives:[{name:"show",rawName:"v-show",value:t.showMore,expression:"showMore"}]},[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("copy"),placement:"left"}},[a("router-link",{attrs:{to:"/page/edit/"+t.item_id+"/0?copy_page_id="+t.page_id}},[a("i",{staticClass:"el-icon-document"})])],1),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("history_version"),placement:"top"}},[a("i",{staticClass:"el-icon-goods",on:{click:t.ShowHistoryVersion}})]),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("sort_pages"),placement:"top"}},[a("i",{staticClass:"el-icon-sort",on:{click:function(e){t.sortPageVisiable=!0}}})]),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("detail"),placement:"top"}},[a("i",{staticClass:"el-icon-info",on:{click:t.show_page_info}})]),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("export"),placement:"left"}},[t.item_info.item_edit?a("router-link",{attrs:{to:"/item/export/"+t.item_info.item_id}},[a("i",{staticClass:"el-icon-download"})]):t._e()],1),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("import"),placement:"left"}},[t.item_info.item_edit?a("i",{staticClass:"el-icon-upload2",on:{click:function(e){t.dialogUploadVisible=!0}}}):t._e()]),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("delete_interface"),placement:"top"}},[a("i",{staticClass:"el-icon-delete",on:{click:t.delete_page}})]),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("item_change_log"),placement:"top"}},[a("i",{staticClass:"el-icon-toilet-paper",on:{click:function(e){t.dialogChangeLogVisible=!0}}})]),t._v(" "),t.item_info.item_manage?a("span",[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("item_setting"),placement:"left"}},[t.item_info.item_manage?a("router-link",{attrs:{to:"/item/setting/"+t.item_info.item_id}},[a("i",{staticClass:"el-icon-setting"})]):t._e()],1)],1):t._e()],1)],1):t._e()]):t._e(),t._v(" "),a("el-dialog",{attrs:{title:t.$t("share_page"),visible:t.dialogVisible,width:"600px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogVisible=e}}},[a("p",[t._v("\n "+t._s(t.$t("item_page_address"))+" :\n "),a("code",[t._v(t._s(t.share_page_link))]),t._v(" "),a("i",{directives:[{name:"clipboard",rawName:"v-clipboard:copy",value:t.share_page_link,expression:"share_page_link",arg:"copy"},{name:"clipboard",rawName:"v-clipboard:success",value:t.onCopy,expression:"onCopy",arg:"success"}],staticClass:"el-icon-document-copy"})]),t._v(" "),t._e(),t._v(" "),a("div",{directives:[{name:"show",rawName:"v-show",value:t.item_info.item_edit,expression:"item_info.item_edit"}]},[a("el-checkbox",{on:{change:t.checkCreateSiglePage},model:{value:t.isCreateSiglePage,callback:function(e){t.isCreateSiglePage=e},expression:"isCreateSiglePage"}},[t._v(t._s(t.$t("create_sigle_page")))]),t._v(" "),t.isCreateSiglePage?a("p",[t._v("\n "+t._s(t.$t("single_page_address"))+" :\n "),a("code",[t._v(t._s(t.share_single_link))]),t._v(" "),a("i",{directives:[{name:"clipboard",rawName:"v-clipboard:copy",value:t.share_single_link,expression:"share_single_link",arg:"copy"},{name:"clipboard",rawName:"v-clipboard:success",value:t.onCopy,expression:"onCopy",arg:"success"}],staticClass:"el-icon-document-copy"})]):t._e(),t._v(" "),a("p"),t._v(" "),a("p",[t._v(t._s(t.$t("create_sigle_page_tips")))])],1),t._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{type:"primary"},on:{click:function(e){t.dialogVisible=!1}}},[t._v(t._s(t.$t("confirm")))])],1)]),t._v(" "),a("HistoryVersion",{ref:"HistoryVersion",attrs:{page_id:t.page_id,is_show_recover_btn:!1,is_modal:!1,callback:"insertValue"}}),t._v(" "),t.sortPageVisiable?a("SortPage",{ref:"SortPage",attrs:{callback:t.reload,item_id:t.item_id,page_id:t.page_id,cat_id:t.page_info.cat_id}}):t._e(),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogUploadVisible,"close-on-click-modal":!1,width:"400px"},on:{"update:visible":function(e){t.dialogUploadVisible=e}}},[a("div",[a("div",[a("el-radio",{attrs:{label:t.item_id},model:{value:t.importToItemId,callback:function(e){t.importToItemId=e},expression:"importToItemId"}},[t._v(t._s(t.$t("import_into_cur_item")))]),t._v(" "),a("el-radio",{attrs:{label:"0"},model:{value:t.importToItemId,callback:function(e){t.importToItemId=e},expression:"importToItemId"}},[t._v(t._s(t.$t("import_into_new_item")))])],1),t._v(" "),a("br"),t._v(" "),a("div",[a("el-upload",{attrs:{drag:"",name:"file",action:t.uploadUrl,data:{item_id:this.importToItemId},"before-upload":t.beforeUpload,"on-success":t.uploadCallback,"show-file-list":!1}},[a("i",{staticClass:"el-icon-upload"}),t._v(" "),a("div",{staticClass:"el-upload__text"},[a("span",{domProps:{innerHTML:t._s(t.$t("import_file_tips2"))}})])])],1),t._v(" "),a("br"),t._v(" "),a("div",[a("span",{domProps:{innerHTML:t._s(t.$t("import_file_tips1"))}})]),t._v(" "),a("br"),t._v(" "),a("div",[t._v(t._s(t.$t("import_into_cur_item_tips")))])])]),t._v(" "),t.dialogChangeLogVisible?a("ChangeLog",{ref:"ChangeLog",attrs:{callback:function(){t.dialogChangeLogVisible=!1},item_id:t.item_id,page_id:t.page_id,cat_id:t.page_info.cat_id}}):t._e()],1)},staticRenderFns:[]};var xt=a("VU/8")(kt,$t,!1,function(t){a("oR8w")},"data-v-3a17ad8f",null).exports,Ct={props:{callback:"",page_id:"",item_id:"",manage:!0},data:function(){return{dialogTableVisible:!1,page:1,count:5,display_name:"",username:"",dataList:[],total:0,positive_type:"1",attachment_type:"-1",used:0,used_flow:0,uploadUrl:DocConfig.server+"/api/page/upload",loading:""}},components:{},computed:{uploadData:function(){return{page_id:this.page_id,item_id:this.item_id}}},methods:{getList:function(){var t=this;this.request("/api/attachment/getMyList",{page:this.page,count:this.count,attachment_type:this.attachment_type,display_name:this.display_name,username:this.username}).then(function(e){var a=e.data;t.dataList=a.list,t.total=parseInt(a.total),t.used=a.used_m,t.used_flow=a.used_flow_m})},show:function(){this.dialogTableVisible=!0,this.getList()},handleCurrentChange:function(t){this.page=t,this.getList()},onSubmit:function(){this.page=1,this.getList()},visit:function(t){window.open(t.url)},delete_row:function(t){var e=this;this.$confirm(this.$t("confirm_delete")," ",{confirmButtonText:this.$t("confirm"),cancelButtonText:this.$t("cancel"),type:"warning"}).then(function(){e.request("/api/attachment/deleteMyAttachment",{file_id:t.file_id}).then(function(t){e.$message.success(e.$t("op_success")),e.getList()})})},uploadCallback:function(t){this.loading.close(),t.error_message&&this.$alert(t.error_message),this.$refs.uploadFile.clearFiles(),this.getList()},select:function(t){var e=this;this.request("/api/attachment/bindingPage",{file_id:t.file_id,page_id:this.page_id}).then(function(t){e.dialogTableVisible=!1,e.callback()})},beforeUpload:function(){this.loading=this.$loading()}},mounted:function(){}},Ft={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",{staticClass:"container-narrow"},[a("el-dialog",{attrs:{title:t.$t("file_gub"),visible:t.dialogTableVisible,"close-on-click-modal":!1,width:"65%"},on:{"update:visible":function(e){t.dialogTableVisible=e}}},[a("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0}},[a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{placeholder:t.$t("display_name")},model:{value:t.display_name,callback:function(e){t.display_name=e},expression:"display_name"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-select",{attrs:{placeholder:""},model:{value:t.attachment_type,callback:function(e){t.attachment_type=e},expression:"attachment_type"}},[a("el-option",{attrs:{label:t.$t("all_attachment_type"),value:"-1"}}),t._v(" "),a("el-option",{attrs:{label:t.$t("image"),value:"1"}}),t._v(" "),a("el-option",{attrs:{label:t.$t("general_attachment"),value:"2"}})],1)],1),t._v(" "),a("el-form-item",[a("el-button",{on:{click:t.onSubmit}},[t._v(t._s(t.$t("search")))])],1),t._v(" "),a("el-form-item",[a("el-upload",{ref:"uploadFile",staticClass:"upload-file",attrs:{action:t.uploadUrl,"before-upload":t.beforeUpload,"on-success":t.uploadCallback,"on-error":t.uploadCallback}},[a("el-button",[t._v(t._s(t.$t("upload")))])],1)],1)],1),t._v(" "),a("P",[t._v(t._s(t.$t("accumulated_used_sapce"))+" "+t._s(t.used)+"M ,\n "+t._s(t.$t("month_flow"))+" "+t._s(t.used_flow)+"M")]),t._v(" "),a("el-table",{staticStyle:{width:"100%"},attrs:{data:t.dataList}},[a("el-table-column",{attrs:{prop:"file_id",label:t.$t("file_id")}}),t._v(" "),a("el-table-column",{attrs:{prop:"display_name",label:t.$t("display_name")}}),t._v(" "),a("el-table-column",{attrs:{prop:"file_type",label:t.$t("file_type"),width:"160"}}),t._v(" "),a("el-table-column",{attrs:{prop:"file_size_m",label:t.$t("file_size_m"),width:"160"}}),t._v(" "),a("el-table-column",{attrs:{prop:"visit_times",label:t.$t("visit_times")}}),t._v(" "),a("el-table-column",{attrs:{prop:"addtime",label:t.$t("add_time"),width:"160"}}),t._v(" "),a("el-table-column",{attrs:{prop:"",label:t.$t("operation")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.select(e.row)}}},[t._v(t._s(t.$t("select")))]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.visit(e.row)}}},[t._v(t._s(t.$t("visit")))]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.delete_row(e.row)}}},[t._v(t._s(t.$t("delete")))])]}}])})],1),t._v(" "),a("div",{staticClass:"block"},[a("span",{staticClass:"demonstration"}),t._v(" "),a("el-pagination",{attrs:{"page-size":t.count,layout:"total, prev, pager, next",total:t.total},on:{"current-change":t.handleCurrentChange}})],1)],1)],1),t._v(" "),a("Footer"),t._v(" "),a("div",{})],1)},staticRenderFns:[]};var St={props:{callback:"",page_id:"",item_id:"",manage:!0},data:function(){return{currentDate:new Date,content:[],dialogTableVisible:!1,uploadUrl:DocConfig.server+"/api/page/upload",dialogUploadVisible:!1,loading:""}},components:{filehub:a("VU/8")(Ct,Ft,!1,function(t){a("MITx")},null,null).exports},computed:{uploadData:function(){return{page_id:this.page_id,item_id:this.item_id}}},methods:{get_content:function(){var t=this,e=DocConfig.server+"/api/page/uploadList",a=new URLSearchParams;a.append("page_id",this.page_id),t.axios.post(e,a).then(function(e){0===e.data.error_code?(t.dialogTableVisible=!0,t.content=e.data.data):(t.dialogTableVisible=!1,t.$alert(e.data.error_message))})},show:function(){this.get_content()},downloadFile:function(t){var e=t.url;window.open(e)},deleteFile:function(t){var e=this;this.$confirm(this.$t("comfirm_delete")," ",{confirmButtonText:this.$t("confirm"),cancelButtonText:this.$t("cancel"),type:"warning"}).then(function(){var a=t.file_id,i=e,o=DocConfig.server+"/api/page/deleteUploadFile",n=new URLSearchParams;n.append("file_id",a),n.append("page_id",i.page_id),i.axios.post(o,n).then(function(t){0===t.data.error_code?i.get_content():i.$alert(t.data.error_message)})})},clearFiles:function(){this.$refs.uploadFile.clearFiles(),this.get_content()},insertFile:function(t){var e="["+t.display_name+"]("+t.url+' "['+t.display_name+'")';this.callback(e),this.dialogTableVisible=!1},uploadCallback:function(t){this.loading.close(),t.error_message&&this.$alert(t.error_message),this.$refs.uploadFile.clearFiles(),this.get_content(),this.dialogUploadVisible=!1},showFilehub:function(){this.$refs.filehub.show()},beforeUpload:function(){this.loading=this.$loading()}},mounted:function(){}},Lt={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",{staticClass:"container-narrow"},[a("el-dialog",{attrs:{title:t.$t("attachment"),visible:t.dialogTableVisible,"close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogTableVisible=e}}},[a("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0}},[a("el-form-item",[a("el-button",{on:{click:t.showFilehub}},[t._v(t._s(t.$t("from_file_gub")))])],1),t._v(" "),a("el-form-item",[a("el-button",{on:{click:function(e){t.dialogUploadVisible=!0}}},[t._v(t._s(t.$t("upload")))])],1)],1),t._v(" "),a("el-table",{attrs:{data:t.content}},[a("el-table-column",{attrs:{property:"addtime",label:t.$t("add_time"),width:"170"}}),t._v(" "),a("el-table-column",{attrs:{property:"display_name",label:t.$t("file_name")}}),t._v(" "),a("el-table-column",{attrs:{label:t.$t("operation"),width:"150"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.downloadFile(e.row)}}},[t._v(t._s(t.$t("download")))]),t._v(" "),t.manage?a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.insertFile(e.row)}}},[t._v(t._s(t.$t("insert")))]):t._e(),t._v(" "),t.manage?a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.deleteFile(e.row)}}},[t._v(t._s(t.$t("delete")))]):t._e()]}}])})],1)],1)],1),t._v(" "),a("filehub",{ref:"filehub",attrs:{callback:t.get_content,item_id:t.item_id,page_id:t.page_id}}),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogUploadVisible,"close-on-click-modal":!1,width:"400px"},on:{"update:visible":function(e){t.dialogUploadVisible=e}}},[a("p",[a("el-upload",{ref:"uploadFile",staticClass:"upload-file",attrs:{drag:"",name:"file",action:t.uploadUrl,"before-upload":t.beforeUpload,"on-success":t.uploadCallback,"on-error":t.uploadCallback,data:t.uploadData,"show-file-list":!1}},[a("i",{staticClass:"el-icon-upload"}),t._v(" "),a("div",{staticClass:"el-upload__text"},[a("span",{domProps:{innerHTML:t._s(t.$t("import_file_tips2"))}})])])],1)]),t._v(" "),a("Footer"),t._v(" "),a("div",{})],1)},staticRenderFns:[]};var It=a("VU/8")(St,Lt,!1,function(t){a("xEUY")},null,null).exports,Tt=function(t){return t.replace(/&amp;|&lt;|&gt;|&#39;|&quot;/g,function(t){return{"&amp;":"&","&lt;":"<","&gt;":">","&#39;":"'","&quot;":'"'}[t]||t})},Vt=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=void 0;t=Tt(t);try{a=JSON.parse(t)}catch(t){}if(!a||!a.info||!a.info.url)return t;e&&("get"==a.info.method&&e.query&&e.query[0]&&e.query[0].name&&e.query.map(function(t){a.request.params[a.request.params.mode].unshift(t)}),"get"!=a.info.method&&"json"!=a.request.params.mode&&e.body&&e.body[0]&&e.body[0].name&&e.body.map(function(t){a.request.params[a.request.params.mode].unshift(t)}),e.header&&e.header[0]&&e.header[0].name&&e.header.map(function(t){a.request.headers.unshift(t)})),"get"==a.info.method&&(a.request.query||(a.request.query=a.request.params[a.request.params.mode]),a.request.params[a.request.params.mode]=[]);var i="\n[TOC]\n\n##### 简要描述\n - "+(a.info.description?a.info.description:"无");if(a.info.apiStatus>0){var o="";switch(a.info.apiStatus){case"1":o="开发中";break;case"2":o="测试中";break;case"3":o="已完成";break;case"4":o="需修改";break;case"5":o="已废弃"}i+="\n\n##### 接口状态\n - "+o}if(a.request.query&&a.request.query[0]&&a.request.query[0].name){var n=a.info.url.split("?");a.info.url=n[0]}i+="\n\n##### 请求URL\n\n - ` "+a.info.url+" `\n\n##### 请求方式\n - "+a.info.method+"\n ";var s=a.request.pathVariable;(s&&s[0]&&s[0].name&&(i+="\n##### 路径变量\n\n|变量名|示例值|必选|类型|说明|\n|:----- |:-----|-----|\n",s.map(function(t){!t.name||t.disable&&t.disable>=1||(i+="|"+t.name+"|"+t.value+" |"+(t.require>0?"是":"否")+" |"+t.type+" |"+(t.remark?t.remark:"无")+" |\n")})),a.request.headers&&a.request.headers[0]&&a.request.headers[0].name)&&(i+="\n##### Header\n\n|header|示例值|必选|类型|说明|\n|:----- |:-----|-----|\n",a.request.headers.map(function(t){!t.name||t.disable&&t.disable>=1||(i+="|"+t.name+"|"+t.value+" |"+(t.require>0?"是":"否")+" |"+t.type+" | "+(t.remark?t.remark:"无")+" |\n")}));var r=a.request.query;r&&r[0]&&r[0].name&&(i+="\n##### 请求Query参数\n\n|参数名|示例值|必选|类型|说明|\n|:----- |:-----|-----|\n",r.map(function(t){!t.name||t.disable&&t.disable>=1||(i+="|"+t.name+"|"+t.value+" |"+(t.require>0?"是":"否")+" |"+t.type+" |"+(t.remark?t.remark:"无")+" |\n")}));var l=a.request.params[a.request.params.mode];l&&l[0]&&l[0].name&&(i+="\n##### 请求Body参数\n\n|参数名|示例值|必选|类型|说明|\n|:----- |:-----|-----|\n",l.map(function(t){!t.name||t.disable&&t.disable>=1||(i+="|"+t.name+"|"+t.value+" |"+(t.require>0?"是":"否")+" |"+t.type+" |"+(t.remark?t.remark:"无")+" |\n")})),"json"==a.request.params.mode&&l&&(i+="\n##### 请求参数示例\n```\n"+l+"\n```\n\n");var c=a.request.params.jsonDesc;("json"==a.request.params.mode&&c&&c[0]&&c[0].name&&(i+="\n##### 请求json字段说明\n\n|字段名|必选|类型|说明|\n|:----- |:-----|-----|\n",c.map(function(t){t.name&&(i+="|"+t.name+" |"+(t.require>0?"是":"否")+" |"+t.type+" |"+(t.remark?t.remark:"无")+" |\n")})),a.response.responseExample&&(i+="\n##### 成功返回示例\n```\n"+a.response.responseExample+"\n ```\n "),a.response.responseParamsDesc&&a.response.responseParamsDesc[0]&&a.response.responseParamsDesc[0].name)&&(i+="\n##### 成功返回示例的参数说明\n\n|参数名|类型|说明|\n|:----- |:-----|-----|\n",a.response.responseParamsDesc.map(function(t){t.name&&(i+="|"+t.name+" |"+t.type+" |"+(t.remark?t.remark:"无")+" |\n")}));(a.response.responseFailExample&&(i+="\n##### 失败返回示例\n```\n"+a.response.responseFailExample+"\n ```\n "),a.response.responseFailParamsDesc&&a.response.responseFailParamsDesc[0]&&a.response.responseFailParamsDesc[0].name)&&(i+="\n##### 失败返回示例的参数说明\n\n|参数名|类型|说明|\n|:----- |:-----|-----|\n",a.response.responseFailParamsDesc.map(function(t){t.name&&(i+="|"+t.name+" |"+t.type+" |"+(t.remark?t.remark:"无")+" |\n")}));return i+="\n##### 备注\n\n "+a.info.remark+"\n\n"},Pt={props:{item_info:"",search_item:"",keyword:""},data:function(){return{content:"###正在加载...",page_id:"",page_title:"",dialogVisible:!1,share_item_link:"",qr_item_link:"",page_info:"",copyText:"",attachment_count:"",fullPage:!1,showfullPageBtn:!1,showToc:!0,showComp:!0,emptyItem:!1,lang:""}},components:{Editormd:it,LeftMenu:pt,OpBar:xt,BackToTop:st,Toc:ct,AttachmentList:It},methods:{get_page_content:function(t){if(!(t<=0)){this.adaptScreen();var e=this;this.request("/api/page/info",{page_id:t},"post",!1).then(function(a){0===a.error_code&&(e.content=Vt(a.data.page_content,e.$store.state.item_info.global_param),e.$store.dispatch("changeOpenCatId",a.data.cat_id),e.page_title=a.data.page_title,e.page_info=a.data,e.attachment_count=a.data.attachment_count>0?a.data.attachment_count:"",e.page_id=0,e.item_info.default_page_id=t,e.$nextTick(function(){e.page_id=t,document.body.scrollTop=document.documentElement.scrollTop=0,document.title=e.page_title+"--ShowDoc"}))})}},adaptToMobile:function(){this.$refs.leftMenu.hide_menu(),this.show_page_bar=!1;var t=document.getElementById("doc-container");t.style.width="95%",t.style.padding="5px",document.getElementById("header").style.height="10px",document.getElementById("doc-title-box").style.marginTop="40px",this.showToc=!1},adaptToSmallpc:function(){var t=document.getElementById("doc-container");t.style.width="calc( 95% - 300px )",t.style.marginLeft="300px",t.style.padding="20px",document.getElementById("header").style.height="20px",document.getElementById("doc-title-box").style.marginTop="30px"},adaptScreen:function(){var t=this;this.$nextTick(function(){(t.isMobile()||window.innerWidth<1300)&&(window.innerWidth<1300&&window.innerWidth>1100?t.adaptToSmallpc():t.adaptToMobile())})},onCopy:function(){this.$message(this.$t("copy_success"))},ShowAttachment:function(){this.$refs.AttachmentList.show()},clickFullPage:function(){var t=this;if(this.fullPage)this.showComp=!1,this.$nextTick(function(){t.showComp=!0,t.showToc=!0});else{this.adaptToMobile();var e=this.page_id;this.page_id=0,this.$nextTick(function(){t.page_id=e,setTimeout(function(){$(".editormd-html-preview").css("font-size","16px")},200)}),$("#left-side").hide(),$(".op-bar").hide()}this.fullPage=!this.fullPage}},mounted:function(){this.adaptScreen(),this.set_bg_grey(),this.lang=DocConfig.lang,this.item_info&&this.item_info.menu&&0===this.item_info.menu.catalogs.length&&0===this.item_info.menu.pages.length&&(this.emptyItem=!0)}},Mt={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return t.showComp?a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("div",{attrs:{id:"header"}}),t._v(" "),a("div",{staticClass:"container doc-container",attrs:{id:"doc-container"}},[a("div",{attrs:{id:"left-side"}},[t.item_info?a("LeftMenu",{ref:"leftMenu",attrs:{get_page_content:t.get_page_content,keyword:t.keyword,item_info:t.item_info,search_item:t.search_item}}):t._e()],1),t._v(" "),a("div",{attrs:{id:"right-side"}},[a("div",{attrs:{id:"p-content"},on:{mouseenter:function(e){t.showfullPageBtn=!0},mouseleave:function(e){t.showfullPageBtn=!1}}},[a("div",{staticClass:"doc-title-box",attrs:{id:"doc-title-box"}},[a("span",{staticClass:"dn",attrs:{id:"doc-title-span"}}),t._v(" "),a("h2",{attrs:{id:"doc-title"}},[t._v(t._s(t.page_title))]),t._v(" "),a("i",{directives:[{name:"show",rawName:"v-show",value:t.showfullPageBtn&&t.page_id,expression:"showfullPageBtn && page_id"}],staticClass:"el-icon-full-screen",attrs:{id:"full-page"},on:{click:t.clickFullPage}}),t._v(" "),t.attachment_count?a("i",{staticClass:"el-icon-upload item",attrs:{id:"attachment"},on:{click:t.ShowAttachment}}):t._e()]),t._v(" "),a("div",{attrs:{id:"doc-body"}},[a("div",{staticClass:"page_content_main",attrs:{id:"page_md_content"}},[t.page_id?a("Editormd",{attrs:{content:t.content,type:"html",keyword:t.keyword}}):t._e()],1),t._v(" "),t.emptyItem&&"zh-cn"==t.lang?a("div",{staticClass:"empty-tips"},[t._m(0),t._v(" "),t._m(1)]):t._e()])]),t._v(" "),a("OpBar",{attrs:{page_id:t.page_id,item_id:t.item_info.item_id,item_info:t.item_info,page_info:t.page_info}})],1)]),t._v(" "),a("BackToTop"),t._v(" "),t.page_id&&t.showToc?a("Toc"):t._e(),t._v(" "),a("AttachmentList",{ref:"AttachmentList",attrs:{callback:"",item_id:t.page_info.item_id,manage:!1,page_id:t.page_info.page_id}}),t._v(" "),a("Footer")],1):t._e()},staticRenderFns:[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"icon"},[e("i",{staticClass:"el-icon-shopping-cart-2"})])},function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"text"},[a("p",[t._v("\n 当前项目是空的,你可以点击右上方的 + 以手动添加页面。\n ")]),t._v(" "),a("div",[t._v("\n 除了手动添加外,你还可以通过以下三种方式自动化生成文档:\n "),a("p",{staticClass:"links"},[a("a",{attrs:{href:"https://www.showdoc.com.cn/runapi",target:"_blank"}},[t._v("使用runapi工具自动生成(推荐)")]),a("br"),t._v(" "),a("a",{attrs:{href:"https://www.showdoc.com.cn/page/741656402509783",target:"_blank"}},[t._v("\n 使用程序注释自动生成")]),a("br"),t._v(" "),a("a",{attrs:{href:"https://www.showdoc.com.cn/page/102098",target:"_blank"}},[t._v("自己写程序调用接口来生成")])])])])}]};var Ut=a("VU/8")(Pt,Mt,!1,function(t){a("bX00")},"data-v-21194fa9",null).exports,Dt={data:function(){return{}},mounted:function(){var t=this,e=setInterval(function(){try{void 0!=$&&(clearInterval(e),t.toc_main_script())}catch(t){}},200)},methods:{toc_main_script:function(){$(document).on("click",".markdown-toc-list a[href]",function(t){t.preventDefault(),t.stopPropagation();var e=$(this).attr("href").substring(1),a=$('[name="'+e+'"]').offset().top;$("html, body").animate({scrollTop:a},300)}),$(document).on("click",".markdown-toc",function(t){$(t.target).is("a")||$(".markdown-toc").toggleClass("open-list")}),$(window).scroll(function(t){var e="";$(".markdown-toc-list a[href]").each(function(t,a){var i=$(a).attr("href").substring(1);if(!($('[name="'+i+'"]').offset().top-$(window).scrollTop()<1))return!1;e=i}),$(".markdown-toc-list a").removeClass("current"),$('.markdown-toc-list a[href="#'+e+'"]').addClass("current")}),!this.isMobile()&&window.screen.width>1e3&&this.$nextTick(function(){setTimeout(function(){$(".markdown-toc").click()},500)})}},destroyed:function(){$(document).off("click",".markdown-toc-list a[href]"),$(document).off("click",".markdown-toc"),$(".markdown-toc").remove()}},jt={render:function(){var t=this.$createElement;return(this._self._c||t)("div")},staticRenderFns:[]};var Rt=a("VU/8")(Dt,jt,!1,function(t){a("Kp5Y")},null,null).exports,qt={props:{item_info:""},data:function(){return{menu:"",content:"",page_title:"",page_id:"",dialogVisible:!1,share_item_link:"",qr_item_link:"",copyText:""}},components:{Editormd:it,BackToTop:st,Toc:Rt},methods:{get_page_content:function(t){var e=this,a=DocConfig.server+"/api/page/info";t||(t=e.page_id);var i=new URLSearchParams;i.append("page_id",t),e.axios.post(a,i).then(function(t){0===t.data.error_code?(e.content=t.data.data.page_content,e.page_title=t.data.data.page_title):e.$alert(t.data.error_message)}).catch(function(t){console.log(t)})},edit_page:function(){var t=this.page_id>0?this.page_id:0,e="/page/edit/"+this.item_info.item_id+"/"+t;this.$router.push({path:e})},share_item:function(){this.share_item_link=this.getRootPath()+"#/"+this.item_info.item_id,this.qr_item_link=DocConfig.server+"/api/common/qrcode&size=3&url="+encodeURIComponent(this.share_item_link),this.dialogVisible=!0,this.copyText=this.item_info.item_name+" -- ShowDoc \r\n"+this.share_item_link},AdaptToMobile:function(){var t=document.getElementById("doc-container");t.style.width="95%",t.style.padding="5px",document.getElementById("header").style.height="10px"},onCopy:function(){this.$message(this.$t("copy_success"))}},mounted:function(){var t=this;this.menu=this.item_info.menu,this.page_id=this.menu.pages[0].page_id,this.get_page_content(),(this.isMobile()||window.screen.width<1e3)&&this.$nextTick(function(){t.AdaptToMobile()})}},Et={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello grey-bg"},[a("Header"),t._v(" "),a("div",{attrs:{id:"header"}}),t._v(" "),a("div",{staticClass:"container doc-container",attrs:{id:"doc-container"}},[a("div",{staticClass:"doc-title-box"},[a("span",{staticClass:"dn",attrs:{id:"doc-title-span"}}),t._v(" "),a("h2",{attrs:{id:"doc-title"}},[t._v(t._s(t.page_title))]),t._v(" "),a("div",{staticClass:"tool-bar pull-right"},[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("goback"),placement:"left"}},[a("router-link",{attrs:{to:"/item/index"}},[a("i",{staticClass:"el-icon-back"})])],1),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("share"),placement:"top"}},[a("i",{staticClass:"el-icon-share",on:{click:t.share_item}})]),t._v(" "),t.item_info.item_edit&&t.item_info.is_archived<1?a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("edit_page"),placement:"top"}},[a("i",{staticClass:"el-icon-edit",on:{click:t.edit_page}})]):t._e(),t._v(" "),t.item_info.item_edit?a("el-dropdown",[a("span",{staticClass:"el-dropdown-link"},[a("i",{staticClass:"el-icon-caret-bottom el-icon--right"})]),t._v(" "),a("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[a("router-link",{attrs:{to:"/item/export/"+t.item_info.item_id}},[a("el-dropdown-item",[t._v(t._s(t.$t("export")))])],1),t._v(" "),a("router-link",{attrs:{to:"/item/setting/"+t.item_info.item_id}},[a("el-dropdown-item",[t._v(t._s(t.$t("item_setting")))])],1)],1)],1):t._e()],1)]),t._v(" "),a("div",{attrs:{id:"doc-body"}},[a("div",{staticClass:"page_content_main",attrs:{id:"page_md_content"}},[t.content?a("Editormd",{attrs:{content:t.content,type:"html"}}):t._e()],1)])]),t._v(" "),a("el-dialog",{staticClass:"text-center",attrs:{title:t.$t("share"),visible:t.dialogVisible,width:"600px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogVisible=e}}},[a("p",[t._v("\n "+t._s(t.$t("item_address"))+" :\n "),a("code",[t._v(t._s(t.share_item_link))])]),t._v(" "),a("p",[a("a",{directives:[{name:"clipboard",rawName:"v-clipboard:copyhttplist",value:t.copyText,expression:"copyText",arg:"copyhttplist"},{name:"clipboard",rawName:"v-clipboard:success",value:t.onCopy,expression:"onCopy",arg:"success"}],staticClass:"home-phone-butt",attrs:{href:"javascript:;"}},[t._v(t._s(t.$t("copy_link")))])]),t._v(" "),a("p",{staticStyle:{"border-bottom":"1px solid #eee"}},[a("img",{staticStyle:{width:"114px",height:"114px"},attrs:{id:"",src:t.qr_item_link}})]),t._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{type:"primary"},on:{click:function(e){t.dialogVisible=!1}}},[t._v(t._s(t.$t("confirm")))])],1)]),t._v(" "),a("BackToTop"),t._v(" "),a("Footer"),t._v(" "),a("div",{})],1)},staticRenderFns:[]};var At=a("VU/8")(qt,Et,!1,function(t){a("OJrs")},"data-v-22cea098",null).exports,Ot=a("fZjL"),zt=a.n(Ot);if("undefined"!=typeof window)var Bt=a("zhAq");var Ht={props:{item_info:""},data:function(){return{menu:"",content:"",page_title:"",page_id:"",dialogVisible:!1,share_item_link:"",qr_item_link:"",copyText:"",spreadsheetObj:{},spreadsheetData:{},isLock:0,isEditable:0,intervalId:0,importDialogVisible:!1}},components:{},methods:{getPageContent:function(t){var e=this;t||(t=this.page_id),this.request("/api/page/info",{page_id:t}).then(function(t){if(t.data.page_content){var a=void 0;try{a=JSON.parse(t.data.page_content.replace(/&amp;|&lt;|&gt;|&#39;|&quot;/g,function(t){return{"&amp;":"&","&lt;":"<","&gt;":">","&#39;":"'","&quot;":'"'}[t]||t}))}catch(t){a={}}e.spreadsheetData=a,e.initSheet(),e.item_info.item_edit&&e.draft()}})},initSheet:function(){if(!x_spreadsheet)return!1;var t=this.isEditable?"edit":"read";document.getElementById("table-item").innerHTML="",this.spreadsheetObj=null,this.spreadsheetObj=x_spreadsheet("#table-item",{mode:t,showToolbar:!0,row:{len:500,height:25}}).loadData(this.spreadsheetData)},shareItem:function(){var t=this.item_info.item_domain?this.item_info.item_domain:this.item_info.item_id;this.share_item_link=this.getRootPath()+"#/"+t,this.qr_item_link=DocConfig.server+"/api/common/qrcode&size=3&url="+encodeURIComponent(this.share_item_link),this.dialogVisible=!0,this.copyText=this.item_info.item_name+" -- ShowDoc \r\n"+this.share_item_link},onCopy:function(){this.$message(this.$t("copy_success"))},save:function(){var t=this;this.request("/api/page/save",{page_id:this.page_id,page_title:this.item_info.item_name,item_id:this.item_info.item_id,is_urlencode:1,page_content:encodeURIComponent(p()(this.spreadsheetObj.getData()))}).then(function(e){t.$message({showClose:!0,message:"保存成功",type:"success"}),t.deleteDraft()})},goback:function(){this.$router.push({path:"/item/index"}),setTimeout(function(){window.location.reload()},200)},dropdownCallback:function(t){t&&t()},draft:function(){var t=this,e="page_content_"+this.page_id;setInterval(function(){var a=p()(t.spreadsheetObj.getData());localStorage.setItem(e,a)},3e4);var a=JSON.parse(localStorage.getItem(e));a&&a.length>0&&localStorage.getItem(e)!=p()(this.spreadsheetObj.getData())&&(localStorage.removeItem(e),this.$confirm(this.$t("draft_tips"),"",{showClose:!1}).then(function(){t.spreadsheetData=a,t.initSheet(),localStorage.removeItem(e)}).catch(function(){localStorage.removeItem(e)}))},deleteDraft:function(){for(var t=0;t<localStorage.length;t++){var e=localStorage.key(t);e.indexOf("page_content_")>-1&&localStorage.removeItem(e)}},setLock:function(){var t=this;this.page_id>0&&this.request("/api/page/setLock",{page_id:this.page_id,item_id:this.item_info.item_id}).then(function(){t.isLock=1})},unlock:function(){var t=this;this.isLock&&this.request("/api/page/setLock",{page_id:this.page_id,item_id:this.item_info.item_id,lock_to:1e3}).then(function(){t.isLock=0})},heartBeatLock:function(){var t=this;this.intervalId=setInterval(function(){t.isLock&&t.setLock()},18e4)},remoteIsLock:function(){var t=this;this.request("/api/page/isLock",{page_id:this.page_id}).then(function(e){e.data.lock>0?e.data.is_cur_user>0?(t.isLock=1,t.isEditable=1,t.initSheet(),t.heartBeatLock()):(t.$alert(t.$t("locking")+e.data.lock_username),t.item_info.item_edit=!1,clearInterval(t.intervalId),t.deleteDraft()):(t.setLock(),t.isEditable=1,t.initSheet(),t.heartBeatLock())})},exportFile:function(){var t,e,a=(t=this.spreadsheetObj.getData(),e=XLSX.utils.book_new(),t.forEach(function(t){for(var a=[[]],i=t.rows,o=0;o<i.len;++o){var n=i[o];n&&(a[o]=[],zt()(n.cells).forEach(function(t){var e=+t;isNaN(e)||(a[o][e]=n.cells[t].text)}))}var s=XLSX.utils.aoa_to_sheet(a);XLSX.utils.book_append_sheet(e,s,t.name)}),e);XLSX.writeFile(a,"showdoc.xlsx")},improtFile:function(t){var e=this,a=t[0],i=new FileReader;i.onload=function(t){var a,i,o=t.target.result,n=(a=XLSX.read(o,{type:"array"}),i=[],a.SheetNames.forEach(function(t){var e={name:t,rows:{}},o=a.Sheets[t];XLSX.utils.sheet_to_json(o,{raw:!1,header:1}).forEach(function(t,a){var i={};t.forEach(function(t,e){i[e]={text:t}}),e.rows[a]={cells:i}}),i.push(e)}),i);n&&(e.spreadsheetObj.loadData(n),e.importDialogVisible=!1)},i.readAsArrayBuffer(a)},unLockOnClose:function(){var t="",e=localStorage.getItem("userinfo");if(e){var a=JSON.parse(e);a&&a.user_token&&(t=a.user_token)}var i=new URLSearchParams({page_id:this.page_id,item_id:this.item_info.item_id,lock_to:1e3,user_token:t}),o=DocConfig.server+"/api/page/setLock";if("sendBeacon"in navigator)navigator.sendBeacon(o,i);else{var n=new XMLHttpRequest;n.open("POST",o,!1),n.send(i)}}},mounted:function(){var t=this;this.menu=this.item_info.menu,this.page_id=this.menu.pages[0].page_id,Bt(["static/xspreadsheet/xspreadsheet.js"],function(){Bt(["static/xspreadsheet/locale/zh-cn.js","static/xspreadsheet/locale/en.js"],function(){"en"==DocConfig.lang?x_spreadsheet.locale("en"):x_spreadsheet.locale("zh-cn"),t.getPageContent(),t.item_info.item_edit&&t.remoteIsLock()}),Bt(["static/xspreadsheet/xlsx.full.min.js"])}),window.addEventListener("beforeunload",this.unLockOnClose)},beforeDestroy:function(){this.$message.closeAll(),clearInterval(this.intervalId),this.unlock(),window.removeEventListener("beforeunload",this.unLockOnClose)}},Nt={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello",on:{keydown:[function(e){return(e.type.indexOf("key")||83===e.keyCode)&&e.ctrlKey?(e.preventDefault(),t.save(e)):null},function(e){return(e.type.indexOf("key")||83===e.keyCode)&&e.metaKey?(e.preventDefault(),t.save(e)):null}]}},[a("link",{attrs:{href:"static/xspreadsheet/xspreadsheet.css",rel:"stylesheet"}}),t._v(" "),a("div",{attrs:{id:"header"}}),t._v(" "),t.item_info.item_edit?a("div",{staticClass:"edit-bar"},[a("el-button",{attrs:{type:"primary",size:"mini"},on:{click:t.save}},[t._v(t._s(t.$t("save")))]),t._v(" "),a("el-dropdown",{on:{command:t.dropdownCallback}},[a("el-button",{attrs:{size:"mini"}},[t._v("\n "+t._s(t.$t("more"))+"\n "),a("i",{staticClass:"el-icon-arrow-down el-icon--right"})]),t._v(" "),a("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[a("el-dropdown-item",{attrs:{command:t.shareItem}},[t._v(t._s(t.$t("share")))]),t._v(" "),t.item_info.item_manage?a("router-link",{attrs:{to:"/item/setting/"+t.item_info.item_id}},[a("el-dropdown-item",[t._v(t._s(t.$t("item_setting")))])],1):t._e(),t._v(" "),a("el-dropdown-item",{attrs:{command:function(){t.importDialogVisible=!0}}},[t._v(t._s(t.$t("import_file")))]),t._v(" "),a("el-dropdown-item",{attrs:{command:t.exportFile}},[t._v(t._s(t.$t("export")))]),t._v(" "),a("el-dropdown-item",{attrs:{command:t.goback}},[t._v(t._s(t.$t("goback")))])],1)],1)],1):t._e(),t._v(" "),t.item_info.item_edit?t._e():a("div",{staticClass:"edit-bar"},[a("el-button",{attrs:{size:"mini"},on:{click:t.goback}},[t._v(t._s(t.$t("goback")))])],1),t._v(" "),a("div",{attrs:{id:"table-item"}}),t._v(" "),a("el-dialog",{staticClass:"text-center",attrs:{title:t.$t("share"),visible:t.dialogVisible,width:"600px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogVisible=e}}},[a("p",[t._v("\n "+t._s(t.$t("item_address"))+" :\n "),a("code",[t._v(t._s(t.share_item_link))])]),t._v(" "),a("p",[a("a",{directives:[{name:"clipboard",rawName:"v-clipboard:copyhttplist",value:t.copyText,expression:"copyText",arg:"copyhttplist"},{name:"clipboard",rawName:"v-clipboard:success",value:t.onCopy,expression:"onCopy",arg:"success"}],staticClass:"home-phone-butt",attrs:{href:"javascript:;"}},[t._v(t._s(t.$t("copy_link")))])]),t._v(" "),a("p",{staticStyle:{"border-bottom":"1px solid #eee"}},[a("img",{staticStyle:{width:"114px",height:"114px"},attrs:{id:"",src:t.qr_item_link}})]),t._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{type:"primary"},on:{click:function(e){t.dialogVisible=!1}}},[t._v(t._s(t.$t("confirm")))])],1)]),t._v(" "),a("el-dialog",{staticClass:"text-center",attrs:{title:t.$t("import_excel"),visible:t.importDialogVisible,width:"600px","close-on-click-modal":!1},on:{"update:visible":function(e){t.importDialogVisible=e}}},[a("p",[a("input",{attrs:{type:"file",name:"xlfile",id:"xlf"},on:{change:function(e){t.improtFile(e.target.files)}}})]),t._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{type:"primary"},on:{click:function(e){t.importDialogVisible=!1}}},[t._v(t._s(t.$t("confirm")))])],1)])],1)},staticRenderFns:[]};var Gt=a("VU/8")(Ht,Nt,!1,function(t){a("KTx2")},"data-v-102f2e85",null).exports,Jt=a("0rW9"),Wt=a.n(Jt),Kt=a("PJh5"),Yt=a.n(Kt),Xt={props:{},data:function(){return{intervalId:0,nObj:""}},methods:{getUnread:function(){var t=this;this.request("/api/message/getUnread",{},"post",!1).then(function(e){var a=e.data;if(a.remind&&a.remind.id&&"page"==a.remind.object_type){var i=a.remind.from_name+" "+t.$t("update_the_page")+" "+a.remind.page_data.page_title+" , "+t.$t("click_to_view"),o=t.$router.resolve({path:"/message/index",query:{dtab:"remindList"}}).href;t.brownNotify(i,a.remind.from_uid,a.remind.message_content_id,o)}})},brownNotify:function(t,e,a,i){var o=this,n={dir:"auto",body:t,requireInteraction:!0};if(window.Notification){var s={};"granted"===Notification.permission?(s=new Notification("showdoc通知",n)).onclick=function(t){window.open(i,"_blank"),o.setRead(e,a),window.focus(),s.close()}:"default"===Notification.permission?(this.webNotify(t,e,a,i),Notification.requestPermission().then(function(t){"granted"===t?(console.log("用户同意授权"),o.nObj&&o.nObj.close&&o.nObj.close(),(s=new Notification("showdoc通知",n)).onclick=function(t){window.open(i,"_blank"),o.setRead(e,a),window.focus(),s.close()}):"default"===t?console.warn("用户关闭授权 未刷新页面之前 可以再次请求授权"):console.log("用户拒绝授权 不能显示通知")})):(console.log("用户曾经拒绝显示通知"),this.webNotify(t,e,a,i))}else console.log("浏览器不支持通知"),this.webNotify(t,e,a,i)},webNotify:function(t,e,a,i){var o=this;this.nObj=this.$notify({message:t,duration:3e4,type:"info",customClass:"cursor-click",onClick:function(t){window.open(i,"_blank"),o.nObj.close()},onClose:function(){o.setRead(e,a)}})},setRead:function(t,e){var a=this;setTimeout(function(){a.request("/api/message/setRead",{from_uid:t,message_content_id:e})},2e3)}},mounted:function(){var t=this;setTimeout(function(){t.getUnread()},2e3),this.intervalId=setInterval(function(){t.getUnread()},3e5)},destroyed:function(){clearInterval(this.intervalId)}},Zt={render:function(){var t=this.$createElement;return(this._self._c||t)("div")},staticRenderFns:[]};var Qt={data:function(){return{item_info:"",keyword:"",watermark_txt:"测试水印,1021002301,测试水印,100101010111101"}},components:{ShowRegularItem:Ut,ShowSinglePageItem:At,ShowTableItem:Gt,Notify:a("VU/8")(Xt,Zt,!1,function(t){a("HUa0")},"data-v-bf41182a",null).exports},methods:{get_item_menu:function(t){var e=this;t||(t="");var a=this,i=a.$loading(),o=this.$route.params.item_id?this.$route.params.item_id:0,n=this.$route.query.page_id?this.$route.query.page_id:0;n=this.$route.params.page_id?this.$route.params.page_id:n;var s={item_id:o,keyword:t};t||(s.default_page_id=n),this.request("/api/item/info",s,"post",!1).then(function(t){if(i.close(),0===t.error_code){var s=t.data;s.default_page_id<=0&&s.menu.pages[0]&&(s.default_page_id=s.menu.pages[0].page_id),3==s.item_type&&(s.item_manage=s.item_edit=!1),a.item_info=s,a.$store.dispatch("changeItemInfo",s),document.title=a.item_info.item_name+"--ShowDoc",s.unread_count>0&&a.$message({showClose:!0,duration:1e4,dangerouslyUseHTMLString:!0,message:'<a href="#/notice/index">你有新的未读消息,点击查看</a>'}),s.show_watermark>0&&e.renderWatermark()}else 10307===t.error_code||10303===t.error_code?a.$router.replace({path:"/item/password/"+o,query:{page_id:n,redirect:a.$router.currentRoute.fullPath}}):a.$alert(t.error_message)}),setTimeout(function(){i.close()},2e4)},search_item:function(t){this.item_info="",this.$store.dispatch("changeItemInfo",""),this.keyword=t,this.get_item_menu(t)},renderWatermark:function(){var t=this;if(this.$store.state.user_info&&this.$store.state.user_info.username){var e=this.$store.state.user_info;e&&e.username&&(this.watermark_txt=e.username+","+Yt()().format("L"),e.name&&(this.watermark_txt+=","+e.name),setTimeout(function(){Wt.a.load({monitor:!1,watermark_txt:t.watermark_txt})},700))}else this.get_user_info(function(e){if(0===e.data.error_code){var a=e.data.data;t.$store.dispatch("changeUserInfo",a).then(function(){t.renderWatermark()})}})}},mounted:function(){this.get_item_menu(),this.$store.dispatch("changeOpenCatId",0)},beforeDestroy:function(){this.$message.closeAll(),document.title="ShowDoc",Wt.a.remove()}},te={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),!t.item_info||1!=t.item_info.item_type&&3!=t.item_info.item_type&&"0"!==t.item_info.item_type&&0!==t.item_info.item_type?t._e():a("ShowRegularItem",{attrs:{item_info:t.item_info,search_item:t.search_item,keyword:t.keyword}}),t._v(" "),t.item_info&&2==t.item_info.item_type?a("ShowSinglePageItem",{attrs:{item_info:t.item_info}}):t._e(),t._v(" "),t.item_info&&4==t.item_info.item_type?a("ShowTableItem",{attrs:{item_info:t.item_info}}):t._e(),t._v(" "),t.item_info.is_login?a("Notify"):t._e(),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var ee=a("VU/8")(Qt,te,!1,function(t){a("fB2E")},"data-v-4e364548",null).exports,ae={name:"Login",components:{},data:function(){return{catalogs:[],cat_id:"",export_type:"1",item_id:0,export_format:"word",pages:[{page_id:"0",page_title:this.$t("all_pages")}],page_id:"0"}},computed:{computed_catalogs:function(){for(var t=this.catalogs.slice(0),e=[],a=0;a<t.length;a++){e.push(t[a]);var i=t[a].sub;if(i.length>0)for(var o=0;o<i.length;o++){e.push({cat_id:i[o].cat_id,cat_name:t[a].cat_name+" / "+i[o].cat_name});var n=i[o].sub;if(n.length>0)for(var s=0;s<n.length;s++)e.push({cat_id:n[s].cat_id,cat_name:t[a].cat_name+" / "+i[o].cat_name+" / "+n[s].cat_name})}}var r={cat_id:"",cat_name:this.$t("none")};return e.unshift(r),e}},methods:{get_catalog:function(t){var e=this,a=DocConfig.server+"/api/catalog/catListGroup",i=new URLSearchParams;i.append("item_id",t),e.axios.post(a,i).then(function(t){if(0===t.data.error_code){var a=t.data.data;e.catalogs=a}else e.$alert(t.data.error_message)}).catch(function(t){console.log(t)})},onSubmit:function(){1==this.export_type&&(this.cat_id="");var t=DocConfig.server+"/api/export/word&item_id="+this.item_id+"&cat_id="+this.cat_id+"&page_id="+this.page_id;"markdown"==this.export_format&&(t=DocConfig.server+"/api/export/markdown&item_id="+this.item_id),window.location.href=t},goback:function(){this.$router.go(-1)},get_pages:function(t){var e=this,a=DocConfig.server+"/api/catalog/getPagesBycat",i=new URLSearchParams;i.append("item_id",this.item_id),i.append("cat_id",t),e.axios.post(a,i).then(function(t){if(0===t.data.error_code){var a=t.data.data;a.unshift({page_id:"0",page_title:e.$t("all_pages")}),e.pages=a,e.page_id="0"}else e.$alert(t.data.error_message)})}},mounted:function(){this.get_catalog(this.$route.params.item_id),this.item_id=this.$route.params.item_id},beforeDestroy:function(){}},ie={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",[a("el-card",{staticClass:"center-card"},[a("el-form",{staticClass:"demo-ruleForm",attrs:{"status-icon":"","label-width":"0px"}},[a("h2"),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-radio-group",{model:{value:t.export_format,callback:function(e){t.export_format=e},expression:"export_format"}},[a("el-radio-button",{attrs:{label:"word"}},[t._v(t._s(t.$t("export_format_word")))]),t._v(" "),a("el-radio-button",{attrs:{label:"markdown"}},[t._v(t._s(t.$t("export_format_markdown")))])],1)],1),t._v(" "),"word"==t.export_format?a("el-form-item",{attrs:{label:""}},[a("el-radio",{attrs:{label:"1"},model:{value:t.export_type,callback:function(e){t.export_type=e},expression:"export_type"}},[t._v(t._s(t.$t("export_all")))]),t._v(" "),a("el-radio",{attrs:{label:"2"},model:{value:t.export_type,callback:function(e){t.export_type=e},expression:"export_type"}},[t._v(t._s(t.$t("export_cat")))])],1):t._e(),t._v(" "),"markdown"==t.export_format?a("el-form-item",{attrs:{label:""}},[a("p",{staticClass:"markdown-tips"},[t._v(t._s(t.$t("export_markdown_tips")))])]):t._e(),t._v(" "),"word"==t.export_format&&2==t.export_type?a("el-form-item",{attrs:{label:""}},[t.computed_catalogs?a("el-select",{staticClass:"cat",attrs:{placeholder:t.$t("catalog")},on:{change:t.get_pages},model:{value:t.cat_id,callback:function(e){t.cat_id=e},expression:"cat_id"}},t._l(t.computed_catalogs,function(t){return a("el-option",{key:t.cat_name,attrs:{label:t.cat_name,value:t.cat_id}})}),1):t._e()],1):t._e(),t._v(" "),"word"==t.export_format&&2==t.export_type?a("el-form-item",{attrs:{label:""}},[t.pages?a("el-select",{staticClass:"cat",model:{value:t.page_id,callback:function(e){t.page_id=e},expression:"page_id"}},t._l(t.pages,function(t){return a("el-option",{key:t.page_title,attrs:{label:t.page_title,value:t.page_id}})}),1):t._e()],1):t._e(),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-button",{staticStyle:{width:"100%"},attrs:{type:"primary"},on:{click:t.onSubmit}},[t._v(t._s(t.$t("begin_export")))])],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-button",{staticClass:"goback-btn",attrs:{type:"text"},on:{click:t.goback}},[t._v(t._s(t.$t("goback")))])],1)],1)],1)],1),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var oe=a("VU/8")(ae,ie,!1,function(t){a("tSnk")},"data-v-59df98f1",null).exports,ne={name:"Login",components:{},data:function(){return{infoForm:{},isOpenItem:!0}},methods:{get_item_info:function(){var t=this,e=DocConfig.server+"/api/item/detail",a=new URLSearchParams;a.append("item_id",t.$route.params.item_id),t.axios.post(e,a).then(function(e){if(0===e.data.error_code){var a=e.data.data;a.password&&(t.isOpenItem=!1),t.infoForm=a}else t.$alert(e.data.error_message)}).catch(function(t){console.log(t)})},FormSubmit:function(){var t=this,e=DocConfig.server+"/api/item/update";if(!this.isOpenItem&&!this.infoForm.password)return t.$alert(t.$t("private_item_passwrod")),!1;this.isOpenItem&&(this.infoForm.password="");var a=new URLSearchParams;a.append("item_id",t.$route.params.item_id),a.append("item_name",this.infoForm.item_name),a.append("item_description",this.infoForm.item_description),a.append("item_domain",this.infoForm.item_domain),a.append("password",this.infoForm.password),t.axios.post(e,a).then(function(e){0===e.data.error_code?t.$message.success(t.$t("modify_success")):t.$alert(e.data.error_message)}).catch(function(t){console.log(t)})}},mounted:function(){this.get_item_info()}},se={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("el-form",{staticClass:"infoForm",attrs:{"status-icon":"","label-width":"100px"},model:{value:t.infoForm,callback:function(e){t.infoForm=e},expression:"infoForm"}},[a("el-form-item",[a("el-input",{attrs:{type:"text","auto-complete":"off",placeholder:""},model:{value:t.infoForm.item_name,callback:function(e){t.$set(t.infoForm,"item_name",e)},expression:"infoForm.item_name"}})],1),t._v(" "),a("el-form-item",[a("el-input",{attrs:{type:"text","auto-complete":"off",placeholder:t.$t("item_description")},model:{value:t.infoForm.item_description,callback:function(e){t.$set(t.infoForm,"item_description",e)},expression:"infoForm.item_description"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-radio",{attrs:{label:!0},model:{value:t.isOpenItem,callback:function(e){t.isOpenItem=e},expression:"isOpenItem"}},[t._v(t._s(t.$t("Open_item")))]),t._v(" "),a("el-radio",{attrs:{label:!1},model:{value:t.isOpenItem,callback:function(e){t.isOpenItem=e},expression:"isOpenItem"}},[t._v(t._s(t.$t("private_item")))])],1),t._v(" "),a("el-form-item",{directives:[{name:"show",rawName:"v-show",value:!t.isOpenItem,expression:"!isOpenItem"}]},[a("el-input",{attrs:{type:"password","auto-complete":"off",placeholder:t.$t("visit_password")},model:{value:t.infoForm.password,callback:function(e){t.$set(t.infoForm,"password",e)},expression:"infoForm.password"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-button",{staticStyle:{width:"100%"},attrs:{type:"primary"},on:{click:t.FormSubmit}},[t._v(t._s(t.$t("submit")))])],1)],1)],1)},staticRenderFns:[]};var re={name:"Login",components:{},data:function(){return{MyForm:{username:"",cat_id:"",member_group_id:"1"},MyForm2:{team_id:""},members:[],dialogFormVisible:!1,dialogFormTeamVisible:!1,dialogFormTeamMemberVisible:!1,teams:[],teamItems:[],teamItemMembers:[],authorityOptions:[{label:this.$t("edit_member"),value:"1"},{label:this.$t("readonly_member"),value:"0"},{label:this.$t("item_admin"),value:"2"}],memberOptions:[]}},methods:{get_members:function(){var t=this,e=DocConfig.server+"/api/member/getList",a=new URLSearchParams;a.append("item_id",t.$route.params.item_id),t.axios.post(e,a).then(function(e){if(0===e.data.error_code){var a=e.data.data;t.members=a,t.getAllUser()}else t.$alert(e.data.error_message)})},get_teams:function(){var t=this,e=DocConfig.server+"/api/team/getList",a=new URLSearchParams;t.axios.post(e,a).then(function(e){if(0===e.data.error_code){var a=e.data.data;t.teams=a}else t.$alert(e.data.error_message)})},getTeamItem:function(){var t=this,e=DocConfig.server+"/api/teamItem/getList",a=new URLSearchParams;a.append("item_id",t.$route.params.item_id),t.axios.post(e,a).then(function(e){if(0===e.data.error_code){var a=e.data.data;t.teamItems=a}else t.$alert(e.data.error_message)})},getTeamItemMember:function(t){var e=this;this.dialogFormTeamMemberVisible=!0;var a=DocConfig.server+"/api/teamItemMember/getList",i=new URLSearchParams;i.append("item_id",e.$route.params.item_id),i.append("team_id",t),e.axios.post(a,i).then(function(t){if(0===t.data.error_code){var a=t.data.data;e.teamItemMembers=a}else e.$alert(t.data.error_message)})},MyFormSubmit:function(){var t=this,e=DocConfig.server+"/api/member/save",a=new URLSearchParams;a.append("item_id",t.$route.params.item_id),a.append("username",this.MyForm.username),a.append("cat_id",this.MyForm.cat_id),a.append("member_group_id",this.MyForm.member_group_id),t.axios.post(e,a).then(function(e){0===e.data.error_code?(t.dialogFormVisible=!1,t.get_members(),t.MyForm.username=""):t.$alert(e.data.error_message)}).catch(function(t){console.log(t)})},addTeam:function(){var t=this,e=DocConfig.server+"/api/teamItem/save",a=new URLSearchParams;a.append("item_id",t.$route.params.item_id),a.append("team_id",this.MyForm2.team_id),t.axios.post(e,a).then(function(e){0===e.data.error_code?(t.dialogFormTeamVisible=!1,t.getTeamItem(),t.MyForm.team_id=""):t.$alert(e.data.error_message)})},delete_member:function(t){var e=this,a=DocConfig.server+"/api/member/delete";this.$confirm(e.$t("confirm_delete")," ",{confirmButtonText:e.$t("confirm"),cancelButtonText:e.$t("cancel"),type:"warning"}).then(function(){var i=new URLSearchParams;i.append("item_id",e.$route.params.item_id),i.append("item_member_id",t),e.axios.post(a,i).then(function(t){0===t.data.error_code?e.get_members():e.$alert(t.data.error_message)})})},deleteTeam:function(t){var e=this,a=DocConfig.server+"/api/teamItem/delete";this.$confirm(e.$t("confirm_delete")," ",{confirmButtonText:e.$t("confirm"),cancelButtonText:e.$t("cancel"),type:"warning"}).then(function(){var i=new URLSearchParams;i.append("id",t),e.axios.post(a,i).then(function(t){0===t.data.error_code?e.getTeamItem():e.$alert(t.data.error_message)})})},changeTeamItemMemberGroup:function(t,e){var a=this,i=DocConfig.server+"/api/teamItemMember/save",o=new URLSearchParams;o.append("member_group_id",t),o.append("id",e),a.axios.post(i,o).then(function(t){0===t.data.error_code?a.$message(a.$t("auth_success")):a.$alert(t.data.error_message)})},getAllUser:function(t,e){var a=this,i=DocConfig.server+"/api/user/allUser",o=new URLSearchParams;t||(t=""),o.append("username",t),a.axios.post(i,o).then(function(t){if(0===t.data.error_code){for(var i=t.data.data,o=[],n=0;n<i.length;n++){a.isMember(i[n].value)||o.push(i[n])}a.memberOptions=[];for(var s=0;s<o.length;s++)a.memberOptions.push({value:o[s].username,label:o[s].name?o[s].username+"("+o[s].name+")":o[s].username,key:o[s].username});e(i)}else a.$alert(t.data.error_message)})},isMember:function(t){for(var e=this.members,a=0;a<e.length;a++)if(e[a].username==t)return!0;return!1},get_catalog:function(){var t=this,e=DocConfig.server+"/api/catalog/catListGroup",a=new URLSearchParams;a.append("item_id",t.$route.params.item_id),t.axios.post(e,a).then(function(e){if(0===e.data.error_code){var a=e.data.data;a.unshift({cat_id:"0",cat_name:t.$t("all_cat")}),t.catalogs=a}else t.$alert(e.data.error_message)})},changeTeamItemMemberCat:function(t,e){var a=this,i=DocConfig.server+"/api/teamItemMember/save",o=new URLSearchParams;o.append("cat_id",t),o.append("id",e),a.axios.post(i,o).then(function(t){0===t.data.error_code?a.$message(a.$t("cat_success")):a.$alert(t.data.error_message)})},memberGroupText:function(t,e){return"2"==t?this.$t("item_admin"):"1"==t?this.$t("edit")+"/"+this.$t("catalog")+":"+e:this.$t("readonly")+"/"+this.$t("catalog")+":"+e}},mounted:function(){this.get_members(),this.get_teams(),this.getTeamItem(),this.getAllUser(),this.get_catalog()}},le={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("el-button",{staticClass:"add-member",attrs:{type:"text"},on:{click:function(e){t.dialogFormVisible=!0}}},[t._v(t._s(t.$t("add_member")))]),t._v(" "),a("el-button",{staticClass:"add-member",attrs:{type:"text"},on:{click:function(e){t.dialogFormTeamVisible=!0}}},[t._v(t._s(t.$t("add_team")))]),t._v(" "),t.members.length>0?a("el-table",{staticStyle:{width:"100%"},attrs:{align:"left",data:t.members,height:"200"}},[a("el-table-column",{attrs:{prop:"username",label:t.$t("member_username"),width:"100"}}),t._v(" "),a("el-table-column",{attrs:{prop:"name",label:t.$t("name")}}),t._v(" "),a("el-table-column",{attrs:{prop:"addtime",label:t.$t("add_time"),width:"100"}}),t._v(" "),a("el-table-column",{attrs:{prop:"member_group_id",label:t.$t("authority"),width:"120"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(t._s(t.memberGroupText(e.row.member_group_id,e.row.cat_name))+"\n ")]}}],null,!1,2554385463)}),t._v(" "),a("el-table-column",{attrs:{prop:"",label:t.$t("operation")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.delete_member(e.row.item_member_id)}}},[t._v(t._s(t.$t("delete")))])]}}],null,!1,1670770248)})],1):t._e(),t._v(" "),t.teamItems.length>0?a("el-table",{staticStyle:{width:"100%"},attrs:{align:"left",data:t.teamItems,height:"200"}},[a("el-table-column",{attrs:{prop:"team_name",label:t.$t("team_name")}}),t._v(" "),a("el-table-column",{attrs:{prop:"addtime",label:t.$t("add_time")}}),t._v(" "),a("el-table-column",{attrs:{prop:"",label:t.$t("operation")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.getTeamItemMember(e.row.team_id)}}},[t._v(t._s(t.$t("member_authority")))]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.deleteTeam(e.row.id)}}},[t._v(t._s(t.$t("delete")))])]}}],null,!1,2799852319)})],1):t._e(),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogFormVisible,modal:!1,top:"10vh",width:"400px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[a("el-form",[a("el-form-item",{attrs:{label:""}},[a("el-select",{attrs:{multiple:"",filterable:"","reserve-keyword":"",placeholder:"",loading:t.loading},model:{value:t.MyForm.username,callback:function(e){t.$set(t.MyForm,"username",e)},expression:"MyForm.username"}},t._l(t.memberOptions,function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}),1)],1),t._v(" "),a("el-form-item",[a("el-radio",{attrs:{label:"1"},model:{value:t.MyForm.member_group_id,callback:function(e){t.$set(t.MyForm,"member_group_id",e)},expression:"MyForm.member_group_id"}},[t._v(t._s(t.$t("edit_member")))]),t._v(" "),a("el-radio",{attrs:{label:"0"},model:{value:t.MyForm.member_group_id,callback:function(e){t.$set(t.MyForm,"member_group_id",e)},expression:"MyForm.member_group_id"}},[t._v(t._s(t.$t("readonly_member")))]),t._v(" "),a("el-radio",{attrs:{label:"2"},model:{value:t.MyForm.member_group_id,callback:function(e){t.$set(t.MyForm,"member_group_id",e)},expression:"MyForm.member_group_id"}},[t._v(t._s(t.$t("item_admin")))])],1),t._v(" "),a("el-form-item",{directives:[{name:"show",rawName:"v-show",value:t.MyForm.member_group_id<2,expression:"MyForm.member_group_id < 2"}],attrs:{label:""}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:t.$t("all_cat2")},model:{value:t.MyForm.cat_id,callback:function(e){t.$set(t.MyForm,"cat_id",e)},expression:"MyForm.cat_id"}},t._l(t.catalogs,function(t){return a("el-option",{key:t.cat_id,attrs:{label:t.cat_name,value:t.cat_id}})}),1)],1)],1),t._v(" "),a("p",{staticClass:"tips"},[t._v(t._s(t.$t("member_authority_tips")))]),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogFormVisible=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.MyFormSubmit}},[t._v(t._s(t.$t("confirm")))])],1)],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogFormTeamVisible,modal:!1,top:"10vh","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogFormTeamVisible=e}}},[a("el-form",[a("el-form-item",{attrs:{label:"选择团队"}},[a("el-select",{model:{value:t.MyForm2.team_id,callback:function(e){t.$set(t.MyForm2,"team_id",e)},expression:"MyForm2.team_id"}},t._l(t.teams,function(t){return a("el-option",{key:t.team_name,attrs:{label:t.team_name,value:t.id}})}),1)],1),t._v(" "),a("router-link",{attrs:{to:"/team/index",target:"_blank"}},[t._v(t._s(t.$t("go_to_new_an_team")))])],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogFormTeamVisible=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.addTeam}},[t._v(t._s(t.$t("confirm")))])],1)],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogFormTeamMemberVisible,modal:!1,top:"10vh",title:t.$t("adjust_member_authority"),width:"90%","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogFormTeamMemberVisible=e}}},[a("el-table",{staticStyle:{width:"100%"},attrs:{align:"left","empty-text":t.$t("team_member_empty_tips"),data:t.teamItemMembers}},[a("el-table-column",{attrs:{prop:"member_username",label:t.$t("username")}}),t._v(" "),a("el-table-column",{attrs:{prop:"member_group_id",label:t.$t("authority"),width:"130"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-select",{attrs:{size:"mini",placeholder:t.$t("please_choose")},on:{change:function(a){return t.changeTeamItemMemberGroup(a,e.row.id)}},model:{value:e.row.member_group_id,callback:function(a){t.$set(e.row,"member_group_id",a)},expression:"scope.row.member_group_id"}},t._l(t.authorityOptions,function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}),1)]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"cat_id",label:t.$t("catalog"),width:"130"},scopedSlots:t._u([{key:"default",fn:function(e){return[e.row.member_group_id<=1?a("el-select",{attrs:{size:"mini",placeholder:t.$t("please_choose")},on:{change:function(a){return t.changeTeamItemMemberCat(a,e.row.id)}},model:{value:e.row.cat_id,callback:function(a){t.$set(e.row,"cat_id",a)},expression:"scope.row.cat_id"}},t._l(t.catalogs,function(t){return a("el-option",{key:t.cat_id,attrs:{label:t.cat_name,value:t.cat_id}})}),1):t._e()]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"addtime",label:t.$t("add_time")}})],1),t._v(" "),a("br"),t._v(" "),a("p",{staticClass:"tips"},[t._v(t._s(t.$t("team_member_authority_tips")))]),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogFormTeamMemberVisible=!1}}},[t._v(t._s(t.$t("close")))])],1)],1)],1)},staticRenderFns:[]};var ce={name:"Login",components:{},data:function(){return{dialogAttornVisible:!1,dialogArchiveVisible:!1,dialogDeleteVisible:!1,attornForm:{username:"",password:""},archiveForm:{password:""},deleteForm:{password:""}}},methods:{deleteItem:function(){var t=this,e=DocConfig.server+"/api/item/delete",a=new URLSearchParams;a.append("item_id",t.$route.params.item_id),a.append("password",this.deleteForm.password),t.axios.post(e,a).then(function(e){0===e.data.error_code?(t.dialogDeleteVisible=!1,t.$message.success(t.$t("success_jump")),setTimeout(function(){t.$router.push({path:"/item/index"})},2e3)):t.$alert(e.data.error_message)}).catch(function(t){console.log(t)})},archive:function(){var t=this,e=DocConfig.server+"/api/item/archive",a=new URLSearchParams;a.append("item_id",t.$route.params.item_id),a.append("password",this.archiveForm.password),t.axios.post(e,a).then(function(e){0===e.data.error_code?(t.dialogArchiveVisible=!1,t.$message.success(t.$t("success_jump")),setTimeout(function(){t.$router.push({path:"/item/index"})},2e3)):t.$alert(e.data.error_message)}).catch(function(t){console.log(t)})},attorn:function(){var t=this,e=DocConfig.server+"/api/item/attorn",a=new URLSearchParams;a.append("item_id",t.$route.params.item_id),a.append("username",this.attornForm.username),a.append("password",this.attornForm.password),t.axios.post(e,a).then(function(e){0===e.data.error_code?(t.dialogAttornVisible=!1,t.$message.success(t.$t("success_jump")),setTimeout(function(){t.$router.push({path:"/item/index"})},2e3)):t.$alert(e.data.error_message)}).catch(function(t){console.log(t)})}},mounted:function(){}},me={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("p",{staticStyle:{height:"40px"}}),t._v(" "),a("p",[a("el-tooltip",{attrs:{content:t.$t("attorn_tips"),placement:"top-start"}},[a("el-button",{staticClass:"a_button",on:{click:function(e){t.dialogAttornVisible=!0}}},[t._v(t._s(t.$t("attorn")))])],1)],1),t._v(" "),a("p",[a("el-tooltip",{attrs:{content:t.$t("archive_tips"),placement:"top-start"}},[a("el-button",{staticClass:"a_button",on:{click:function(e){t.dialogArchiveVisible=!0}}},[t._v(t._s(t.$t("archive")))])],1)],1),t._v(" "),a("p",[a("el-tooltip",{attrs:{content:t.$t("delete_tips"),placement:"top-start"}},[a("el-button",{staticClass:"a_button",on:{click:function(e){t.dialogDeleteVisible=!0}}},[t._v(t._s(t.$t("delete")))])],1)],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogAttornVisible,modal:!1,width:"300px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogAttornVisible=e}}},[a("el-form",[a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{placeholder:t.$t("attorn_username")},model:{value:t.attornForm.username,callback:function(e){t.$set(t.attornForm,"username",e)},expression:"attornForm.username"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"password",placeholder:t.$t("input_login_password")},model:{value:t.attornForm.password,callback:function(e){t.$set(t.attornForm,"password",e)},expression:"attornForm.password"}})],1)],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogAttornVisible=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.attorn}},[t._v(t._s(t.$t("attorn")))])],1)],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogArchiveVisible,modal:!1,width:"300px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogArchiveVisible=e}}},[a("el-form",[a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"password",placeholder:t.$t("input_login_password")},model:{value:t.archiveForm.password,callback:function(e){t.$set(t.archiveForm,"password",e)},expression:"archiveForm.password"}})],1)],1),t._v(" "),a("p",{staticClass:"tips"},[t._v(t._s(t.$t("archive_tips2")))]),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogArchiveVisible=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.archive}},[t._v(t._s(t.$t("archive")))])],1)],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogDeleteVisible,modal:!1,width:"300px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogDeleteVisible=e}}},[a("el-form",[a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"password",placeholder:t.$t("input_login_password")},model:{value:t.deleteForm.password,callback:function(e){t.$set(t.deleteForm,"password",e)},expression:"deleteForm.password"}},[t._v(">")])],1)],1),t._v(" "),a("p",{staticClass:"tips"},[a("el-tag",{attrs:{type:"danger"}},[t._v(t._s(t.$t("delete_tips")))])],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogDeleteVisible=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.deleteItem}},[t._v(t._s(t.$t("delete")))])],1)],1)],1)},staticRenderFns:[]};var de={name:"Login",components:{},data:function(){return{api_key:"",api_token:""}},methods:{get_key_info:function(){var t=this,e=DocConfig.server+"/api/item/getKey",a=new URLSearchParams;a.append("item_id",t.$route.params.item_id),t.axios.post(e,a).then(function(e){if(0===e.data.error_code){var a=e.data.data;t.api_key=a.api_key,t.api_token=a.api_token}else t.$alert(e.data.error_message)}).catch(function(t){console.log(t)})},resetKey:function(){var t=this,e=DocConfig.server+"/api/item/resetKey",a=new URLSearchParams;a.append("item_id",t.$route.params.item_id),t.axios.post(e,a).then(function(e){0===e.data.error_code?t.get_key_info():t.$alert(e.data.error_message)}).catch(function(t){console.log(t)})}},mounted:function(){this.get_key_info()}},_e={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("el-form",{staticClass:"infoForm",attrs:{"status-icon":"","label-width":"100px"}},[a("el-form-item",{attrs:{label:"api_key:"}},[a("el-input",{attrs:{type:"text","auto-complete":"off",readonly:!0,placeholder:""},model:{value:t.api_key,callback:function(e){t.api_key=e},expression:"api_key"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"api_token"}},[a("el-input",{attrs:{type:"text","auto-complete":"off",readonly:!0,placeholder:""},model:{value:t.api_token,callback:function(e){t.api_token=e},expression:"api_token"}})],1),t._v(" "),a("el-button",{staticStyle:{width:"100%"},attrs:{type:"primary"},on:{click:t.resetKey}},[t._v(t._s(t.$t("reset_token")))])],1),t._v(" "),a("p",[a("span",{domProps:{innerHTML:t._s(t.$t("open_api_tips1"))}})]),t._v(" "),a("p",[a("span",{domProps:{innerHTML:t._s(t.$t("open_api_tips2"))}})]),t._v(" "),a("p",[a("span",{domProps:{innerHTML:t._s(t.$t("open_api_tips3"))}})]),t._v(" "),a("p",[a("span",{domProps:{innerHTML:t._s(t.$t("open_api_tips4"))}})])],1)},staticRenderFns:[]};var pe={name:"Login",components:{},data:function(){return{MyForm:{username:"",is_readonly:!1},MyForm2:{team_id:""},lists:[]}},methods:{get_list:function(){var t=this,e=DocConfig.server+"/api/recycle/getList",a=new URLSearchParams;a.append("item_id",t.$route.params.item_id),t.axios.post(e,a).then(function(e){if(0===e.data.error_code){var a=e.data.data;t.lists=a}else t.$alert(e.data.error_message)})},recover:function(t){var e=this,a=DocConfig.server+"/api/recycle/recover";this.$confirm(this.$t("recover_tips")," ",{confirmButtonText:e.$t("confirm"),cancelButtonText:e.$t("cancel"),type:"warning"}).then(function(){var i=new URLSearchParams;i.append("item_id",e.$route.params.item_id),i.append("page_id",t),e.axios.post(a,i).then(function(t){0===t.data.error_code?e.get_list():e.$alert(t.data.error_message)})})}},mounted:function(){this.get_list()}},ue={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("p",{staticClass:"tips"},[t._v(t._s(t.$t("recycle_tips")))]),t._v(" "),t.lists.length>0?a("el-table",{staticClass:"recycle-table",staticStyle:{width:"100%"},attrs:{align:"left",data:t.lists}},[a("el-table-column",{attrs:{prop:"page_title",label:t.$t("page_title")}}),t._v(" "),a("el-table-column",{attrs:{prop:"del_by_username",label:t.$t("deleter")}}),t._v(" "),a("el-table-column",{attrs:{prop:"del_time",label:t.$t("del_time")}}),t._v(" "),a("el-table-column",{attrs:{prop:"",label:t.$t("operation")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.recover(e.row.page_id)}}},[t._v(t._s(t.$t("recover")))])]}}],null,!1,3035403278)})],1):t._e()],1)},staticRenderFns:[]};var fe={name:"Login",components:{Info:a("VU/8")(ne,se,!1,function(t){a("IugC")},"data-v-c7f1822e",null).exports,Member:a("VU/8")(re,le,!1,function(t){a("pxj0")},"data-v-43e90dab",null).exports,Advanced:a("VU/8")(ce,me,!1,function(t){a("FbtG")},"data-v-701809b3",null).exports,OpenApi:a("VU/8")(de,_e,!1,function(t){a("hbTw")},"data-v-68207845",null).exports,Recycle:a("VU/8")(pe,ue,!1,function(t){a("EtgL")},"data-v-984b05ae",null).exports},data:function(){return{userInfo:{}}},methods:{get_item_info:function(){var t=this,e=DocConfig.server+"/api/item/detail",a=new URLSearchParams;a.append("item_id",t.$route.params.item_id),t.axios.post(e,a).then(function(e){if(0===e.data.error_code){var a=e.data.data;t.infoForm=a}else t.$alert(e.data.error_message)}).catch(function(t){console.log(t)})},goback:function(){this.$router.go(-1)}},mounted:function(){},beforeDestroy:function(){}},he={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",[a("el-card",{staticClass:"center-card"},[[a("el-button",{staticClass:"goback-btn",attrs:{type:"text"},on:{click:t.goback}},[a("i",{staticClass:"el-icon-back"})]),t._v(" "),a("el-tabs",{attrs:{value:"first",type:"card"}},[a("el-tab-pane",{attrs:{label:t.$t("base_info"),name:"first"}},[a("Info")],1),t._v(" "),a("el-tab-pane",{attrs:{label:t.$t("member_manage"),name:"second"}},[a("Member")],1),t._v(" "),a("el-tab-pane",{attrs:{label:t.$t("advance_setting"),name:"third"}},[a("Advanced")],1),t._v(" "),a("el-tab-pane",{attrs:{label:t.$t("open_api"),name:"four"}},[a("OpenApi")],1),t._v(" "),a("el-tab-pane",{attrs:{label:t.$t("recycle"),name:"five"}},[a("Recycle")],1)],1)]],2)],1),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var ge=a("VU/8")(fe,he,!1,function(t){a("sAIR")},"data-v-4f7e248f",null).exports,ve={data:function(){return{currentDate:new Date,itemList:{},content:"",page_title:"",page_id:0,fullPage:!1,showComp:!0,showfullPageBtn:!0,showToc:!0}},components:{Editormd:it,BackToTop:st,Toc:Rt},methods:{get_page_content:function(){var t,e=this,a=e.$route.params.page_id,i=e.$route.params.unique_key;t=i?DocConfig.server+"/api/page/infoByKey":DocConfig.server+"/api/page/info";var o=new URLSearchParams;o.append("page_id",a),o.append("unique_key",i),e.axios.post(t,o).then(function(t){0===t.data.error_code?(e.content=t.data.data.page_content,e.page_title=t.data.data.page_title,e.page_id=t.data.data.page_id):10307===t.data.error_code||10303===t.data.error_code?e.$router.replace({path:"/item/password/0",query:{page_id:a,redirect:e.$router.currentRoute.fullPath}}):e.$alert(t.data.error_message)})},adaptToMobile:function(){var t=document.getElementById("doc-container");t.style.width="95%",t.style.padding="5px",document.getElementById("header").style.height="10px",this.showToc=!1},clickFullPage:function(){var t=this;if(this.fullPage)this.showComp=!1,this.$nextTick(function(){t.showComp=!0,t.showToc=!0});else{this.adaptToMobile();var e=this.page_id;this.page_id=0,this.$nextTick(function(){t.page_id=e,setTimeout(function(){$(".editormd-html-preview").css("font-size","16px")},200)})}this.fullPage=!this.fullPage}},mounted:function(){var t=this;this.get_page_content(),(this.isMobile()||window.screen.width<1e3)&&this.$nextTick(function(){t.showfullPageBtn=!1,t.adaptToMobile()})},beforeDestroy:function(){}},be={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return t.showComp?a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("div",{attrs:{id:"header"}}),t._v(" "),a("div",{staticClass:"container doc-container",attrs:{id:"doc-container"}},[a("div",{staticClass:"doc-title-box"},[a("span",{staticClass:"dn",attrs:{id:"doc-title-span"}}),t._v(" "),a("h2",{attrs:{id:"doc-title"}},[t._v(t._s(t.page_title))]),t._v(" "),a("i",{directives:[{name:"show",rawName:"v-show",value:t.showfullPageBtn,expression:"showfullPageBtn"}],staticClass:"el-icon-full-screen",attrs:{id:"full-page"},on:{click:t.clickFullPage}})]),t._v(" "),a("div",{attrs:{id:"doc-body"}},[a("div",{staticClass:"page_content_main",attrs:{id:"page_md_content"}},[t.page_id&&t.content?a("Editormd",{attrs:{content:t.content,type:"html"}}):t._e()],1)])]),t._v(" "),a("BackToTop"),t._v(" "),t.page_id&&t.showToc?a("Toc"):t._e(),t._v(" "),a("Footer"),t._v(" "),a("div",{})],1):t._e()},staticRenderFns:[]};var we=a("VU/8")(ve,be,!1,function(t){a("EGF7")},"data-v-433e5482",null).exports,ye=a("pFYg"),ke=a.n(ye),$e={name:"JsonToTable",props:{formLabelWidth:"120px",callback:""},data:function(){return{content:"",json_table_data:"",dialogFormVisible:!1}},methods:{transform:function(){try{var t=JSON.parse(this.content);this.json_table_data="|参数|类型|描述|\n|:-------|:-------|:-------|\n",this.Change(t),this.callback(this.json_table_data)}catch(t){this.$alert("Json解析失败")}this.dialogFormVisible=!1},Change:function(t){var e="- ";if(arguments.length>1){var a;a=arguments[1]>0?arguments[1]:1;for(var i=0;i<a;i++)e+="- "}for(var o in t){var n=t[o],s=void 0===n?"undefined":ke()(n);if("object"==s){if(this.json_table_data+="| "+e+o+" |"+s+" | 无 |\n",n instanceof Array){var r=a+1;this.Change(n[0],r);continue}this.Change(n,a)}else this.json_table_data+="| "+o+" | "+s+"| 无 |\n"}}}},xe={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("el-dialog",{attrs:{title:t.$t("json_to_table"),visible:t.dialogFormVisible,"close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[a("el-form",[a("el-input",{staticClass:"dialoContent",attrs:{type:"textarea",placeholder:t.$t("json_to_table_description"),rows:10},model:{value:t.content,callback:function(e){t.content=e},expression:"content"}})],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogFormVisible=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.transform}},[t._v(t._s(t.$t("confirm")))])],1)],1)],1)},staticRenderFns:[]};var Ce=a("VU/8")($e,xe,!1,function(t){a("q1Fm")},"data-v-11c44983",null).exports,Fe={name:"JsonBeautify",props:{formLabelWidth:"120px",callback:""},data:function(){return{content:"",json_table_data:"",dialogFormVisible:!1}},methods:{transform:function(){var t=this.content;try{var e="\n ``` \n "+p()(JSON.parse(t),null,2)+" \n\n ```\n\n";this.callback(e)}catch(e){this.callback(t)}this.dialogFormVisible=!1}}},Se={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("el-dialog",{attrs:{title:t.$t("beautify_json"),visible:t.dialogFormVisible,"close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[a("el-form",[a("el-input",{staticClass:"dialoContent",attrs:{type:"textarea",placeholder:t.$t("beautify_json_description"),rows:10},model:{value:t.content,callback:function(e){t.content=e},expression:"content"}})],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogFormVisible=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.transform}},[t._v(t._s(t.$t("confirm")))])],1)],1)],1)},staticRenderFns:[]};var Le=a("VU/8")(Fe,Se,!1,function(t){a("g9xf")},"data-v-3192ec2f",null).exports,Ie={name:"Mock",props:{formLabelWidth:"120px",callback:"",page_id:"",item_id:""},data:function(){return{content:"",mock_url:"",mockUrlPre:"",path:"/"}},methods:{add:function(){var t=this;this.request("/api/mock/add",{page_id:this.page_id,template:this.content,path:this.path}).then(function(e){t.$message({showClose:!0,message:"保存成功",type:"success"}),t.infoByPageId()})},infoByPageId:function(){var t=this;if(this.page_id<=0)return this.$alert("请先保存页面"),void this.callback();this.request("/api/mock/infoByPageId",{page_id:this.page_id}).then(function(e){e.data&&e.data.unique_key&&e.data.template&&(t.mock_url=t.mockUrlPre+e.data.path,t.content=Tt(e.data.template),t.path=e.data.path)})},handleClick:function(){this.add()},beautifyJson:function(){this.content=this.formatJson(this.content)},onCopy:function(){this.$message(this.$t("copy_success"))}},mounted:function(){this.infoByPageId(),this.mockUrlPre=DocConfig.server+"/mock-path/"+this.item_id+"&path="}},Te={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("el-dialog",{attrs:{width:"1000px",title:"Mock",visible:!0,"close-on-click-modal":!1},on:{close:function(e){return t.callback()}}},[a("el-form",[a("el-input",{staticClass:"dialoContent",attrs:{type:"textarea",placeholder:"这里填写的是Mock接口的返回结果。你可以直接编辑/粘贴一段json字符串,支持使用MockJs语法(关于MockJs语法,可以查看下方的帮助说明按钮)。输入完毕后,点击保存,就会自动生成Mock地址",rows:20},model:{value:t.content,callback:function(e){t.content=e},expression:"content"}}),t._v(" "),a("p",[a("el-row",[a("span",[t._v("Mock Url和路径  :   "+t._s(t.mockUrlPre))]),t._v(" "),a("el-input",{staticClass:"path-input",model:{value:t.path,callback:function(e){t.path=e},expression:"path"}}),t._v(" "),a("i",{directives:[{name:"clipboard",rawName:"v-clipboard:copy",value:t.mock_url,expression:"mock_url",arg:"copy"},{name:"clipboard",rawName:"v-clipboard:success",value:t.onCopy,expression:"onCopy",arg:"success"}],staticClass:"el-icon-document-copy"})],1)],1),t._v(" "),a("p",[a("el-button",{attrs:{type:"primary"},on:{click:t.handleClick}},[t._v(t._s(t.$t("save")))]),t._v(" \n "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"假如上面填写的是一段符合json语法的字符串,点此按钮可以对json字符串进行快速格式化(美化)",placement:"top"}},[a("el-button",{on:{click:t.beautifyJson}},[t._v("json快速美化")])],1),t._v("   \n "),a("a",{attrs:{href:"https://www.showdoc.com.cn/p/d952ed6b7b5fb454df13dce74d1b41f8",target:"_blank"}},[t._v("帮助说明")])],1)],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){return t.callback()}}},[t._v(t._s(t.$t("goback")))])],1)],1)],1)},staticRenderFns:[]};var Ve=a("VU/8")(Ie,Te,!1,function(t){a("2eZB")},"data-v-b765ba24",null).exports,Pe={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",{staticClass:"container-narrow"},[a("el-dialog",{attrs:{title:t.$t("templ_list"),visible:t.dialogTableVisible,"close-on-click-modal":!1,"before-close":t.callback},on:{"update:visible":function(e){t.dialogTableVisible=e}}},[a("el-tabs",{attrs:{value:"myList",type:"card"}},[a("el-tab-pane",{attrs:{label:t.$t("my_template"),name:"myList"}},[a("el-table",{attrs:{data:t.myList,"empty-text":t.$t("no_my_template_text")}},[a("el-table-column",{attrs:{property:"addtime",label:t.$t("save_time"),width:"170"}}),t._v(" "),a("el-table-column",{attrs:{property:"template_title",label:t.$t("templ_title")}}),t._v(" "),a("el-table-column",{attrs:{label:t.$t("operation"),width:"300"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.insertTemplate(e.row)}}},[t._v(t._s(t.$t("insert_templ")))]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.shareToClick(e.row)}}},[t._v(t._s(t.$t("share_to_these_items"))+"("+t._s(e.row.share_item_count)+")")]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.deleteTemplate(e.row)}}},[t._v(t._s(t.$t("delete_templ")))])]}}])})],1)],1),t._v(" "),a("el-tab-pane",{attrs:{label:t.$t("item_template"),name:"itemList"}},[a("el-table",{attrs:{data:t.itemList,"empty-text":t.$t("no_item_template_text")}},[a("el-table-column",{attrs:{property:"created_at",label:t.$t("save_time"),width:"170"}}),t._v(" "),a("el-table-column",{attrs:{property:"username",label:t.$t("sharer")}}),t._v(" "),a("el-table-column",{attrs:{property:"template_title",label:t.$t("templ_title")}}),t._v(" "),a("el-table-column",{attrs:{label:t.$t("operation"),width:"150"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.insertTemplate(e.row)}}},[t._v(t._s(t.$t("insert_templ")))])]}}])})],1)],1)],1)],1)],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogItemVisible,width:"300px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogItemVisible=e}}},[a("el-form",[a("el-select",{attrs:{multiple:"",placeholder:t.$t("please_choose")},model:{value:t.shareItemId,callback:function(e){t.shareItemId=e},expression:"shareItemId"}},t._l(t.myItemList,function(t){return a("el-option",{key:t.item_id,attrs:{label:t.item_name,value:t.item_id}})}),1)],1),t._v(" "),a("p",[t._v(t._s(t.$t("share_items_tips")))]),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogItemVisible=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.shareToItem}},[t._v(t._s(t.$t("confirm")))])],1)],1),t._v(" "),a("Footer"),t._v(" "),a("div",{})],1)},staticRenderFns:[]};var Me=a("VU/8")({props:{callback:function(){},item_id:0,opRow:{}},data:function(){return{myList:[],itemList:[],dialogTableVisible:!0,dialogItemVisible:!1,myItemList:[],shareItemId:[]}},components:{},methods:{getMyList:function(){var t=this;this.request("/api/template/getMyList",{}).then(function(e){var a=e.data;t.myList=a})},getItemList:function(){var t=this;this.request("/api/template/getItemList",{item_id:this.item_id}).then(function(e){var a=e.data;t.itemList=a})},getMyItemList:function(){var t=this;this.request("/api/item/myList",{}).then(function(e){t.myItemList=e.data})},insertTemplate:function(t){this.callback(t.template_content)},deleteTemplate:function(t){var e=this,a=t.id;this.request("/api/template/delete",{id:a}).then(function(t){e.getMyList(),e.getItemList()})},shareToClick:function(t){if(this.getMyItemList(),this.opRow=t,this.dialogItemVisible=!0,this.shareItemId=[],t.share_item_count>0){var e=[];t.share_item.map(function(t){e.push(t.item_id)}),this.shareItemId=e}},shareToItem:function(){var t=this;this.request("/api/template/shareToItem",{template_id:this.opRow.id,item_id:this.shareItemId.join(",")}).then(function(e){t.dialogItemVisible=!1,t.getMyList(),t.getItemList()})}},mounted:function(){this.getMyList(),this.getItemList()}},Pe,!1,function(t){a("ET5U"),a("5Fpp")},null,null).exports,Ue=a("BO1k"),De=a.n(Ue),je=a("d7EF"),Re=a.n(je),qe={props:{callback:"",page_id:"",is_modal:!0,is_show_recover_btn:!0},data:function(){return{currentDate:new Date,content:"",dialogFormVisible:!1}},components:{},methods:{transform:function(){var t=this.content,e="\n\n",a=!0,i=!1,o=void 0;try{for(var n,s=De()(t.split("\n").entries());!(a=(n=s.next()).done);a=!0){var r=n.value,l=Re()(r,2),c=l[0],m=l[1].split("\t");if(e+="| "+m.join(" | ")+" |\n",0==c){for(var d=0;d<m.length;d++)e+="|:--- ";e+=" |\n"}}}catch(t){i=!0,o=t}finally{try{!a&&s.return&&s.return()}finally{if(i)throw o}}this.callback(e+"\n\n"),this.dialogFormVisible=!1}},mounted:function(){}},Ee={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",{staticClass:"container-narrow"},[a("el-dialog",{attrs:{title:t.$t("paste_insert_table"),modal:t.is_modal,visible:t.dialogFormVisible,"close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[a("el-form",[a("el-input",{staticClass:"dialoContent",attrs:{type:"textarea",placeholder:t.$t("paste_insert_table_tips"),rows:10},model:{value:t.content,callback:function(e){t.content=e},expression:"content"}})],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogFormVisible=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.transform}},[t._v(t._s(t.$t("confirm")))])],1)],1)],1),t._v(" "),a("Footer"),t._v(" "),a("div",{})],1)},staticRenderFns:[]};var Ae=a("VU/8")(qe,Ee,!1,function(t){a("Zt4p")},null,null).exports,Oe={props:{callback:function(){},page_id:"",item_id:""},data:function(){return{list:[],textarea:"",lang:"",dialogVisible:!0,dialogVisible2:!1,dialogVisible3:!1,allItemMemberList:[],to_add_member_uid:[]}},components:{},computed:{},methods:{getList:function(){var t=this;this.request("/api/subscription/getPageList",{page_id:this.page_id}).then(function(e){var a=e.data;t.list=a})},handleCurrentChange:function(t){this.page=t,this.getList()},toItemSetting:function(){var t=this.$router.resolve({path:"/item/setting/"+this.item_id});window.open(t.href,"_blank")},toTeam:function(){var t=this.$router.resolve({path:"/team/index"});window.open(t.href,"_blank")},getAllItemMemberList:function(){var t=this;this.request("/api/member/getAllList",{item_id:this.item_id}).then(function(e){var a=e.data;t.allItemMemberList=a})},addMember:function(){var t=this;this.request("/api/subscription/savePage",{page_id:this.page_id,uids:this.to_add_member_uid.join(",")}).then(function(e){t.dialogVisible3=!1,t.getList(),t.to_add_member_uid=[]})},addAllMember:function(){var t=this;if(this.allItemMemberList&&this.allItemMemberList.length>0){var e=[];this.allItemMemberList.map(function(t){e.push(t.uid)}),this.request("/api/subscription/savePage",{page_id:this.page_id,uids:e.join(",")}).then(function(e){t.getList()})}},delete_one:function(t){var e=this;this.request("/api/subscription/deletePage",{uids:t.uid,page_id:this.page_id}).then(function(t){e.getList()})}},mounted:function(){this.getAllItemMemberList(),this.getList(),this.lang=DocConfig.lang}},ze={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-dialog",{attrs:{title:t.$t("save_and_notify"),visible:t.dialogVisible,"close-on-click-modal":!1,"before-close":t.callback},on:{"update:visible":function(e){t.dialogVisible=e}}},[a("div",[a("el-input",{attrs:{type:"textarea",rows:4,placeholder:t.$t("input_update_remark")},model:{value:t.textarea,callback:function(e){t.textarea=e},expression:"textarea"}})],1),t._v(" "),a("p",[a("el-button",{attrs:{type:"text"},on:{click:function(e){t.dialogVisible2=!0}}},[t._v(t._s(t.$t("click_to_edit_member")))]),t._v("\n ( "+t._s(t.$t("cur_setting_notify"))+" "+t._s(t.list.length)+" "+t._s(t.$t("people"))+" )\n ")],1),t._v(" "),a("p",[t._v("\n "+t._s(t.$t("notify_tips1"))+"\n ")]),t._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){return t.callback("")}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.callback(t.textarea)}}},[t._v(t._s(t.$t("confirm")))])],1)]),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogVisible2,"close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogVisible2=e}}},[a("el-button",{on:{click:function(e){t.dialogVisible3=!0}}},[t._v(t._s(t.$t("add_single_member")))]),t._v(" "),a("el-button",{on:{click:t.addAllMember}},[t._v(t._s(t.$t("add_all_member")))]),t._v(" "),a("el-table",{attrs:{data:t.list}},[a("el-table-column",{attrs:{property:"username",label:t.$t("username")}}),t._v(" "),a("el-table-column",{attrs:{property:"name",label:t.$t("name")}}),t._v(" "),a("el-table-column",{attrs:{property:"sub_time",label:t.$t("addtime")}}),t._v(" "),a("el-table-column",{attrs:{prop:"",label:t.$t("operation")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text"},on:{click:function(a){return t.delete_one(e.row)}}},[t._v(t._s(t.$t("delete")))])]}}])})],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogVisible2=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:function(e){t.dialogVisible2=!1}}},[t._v(t._s(t.$t("confirm")))])],1)],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogVisible3,width:"350px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogVisible3=e}}},[a("el-form",[a("el-form-item",{attrs:{label:t.$t("username")+":"}},[a("el-select",{attrs:{multiple:"",filterable:"","reserve-keyword":"",placeholder:"请选择或搜索"},model:{value:t.to_add_member_uid,callback:function(e){t.to_add_member_uid=e},expression:"to_add_member_uid"}},t._l(t.allItemMemberList,function(t){return a("el-option",{key:t.uid,attrs:{label:t.username_name,value:t.uid}})}),1),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("refresh_member_list")}},[a("i",{staticClass:"el-icon-refresh-right icon-btn",on:{click:t.getAllItemMemberList}})]),t._v(" "),a("div",[t._v("\n "+t._s(t.$t("notify_add_member_tips1"))+"\n ")]),t._v(" "),a("div",[t._v("\n "+t._s(t.$t("quick_entrance"))+":\n "),a("el-button",{attrs:{type:"text"},on:{click:function(e){return t.toItemSetting()}}},[t._v(t._s(t.$t("to_item_setting")))]),t._v(" "),a("el-button",{attrs:{type:"text"},on:{click:function(e){return t.toTeam()}}},[t._v(t._s(t.$t("to_team")))])],1)],1)],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogVisible3=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.addMember}},[t._v(t._s(t.$t("confirm")))])],1)],1)],1)},staticRenderFns:[]};var Be=a("VU/8")(Oe,ze,!1,function(t){a("9vwn")},"data-v-07212280",null).exports,He=(a("xrTZ"),{data:function(){return{currentDate:new Date,itemList:{},content:"",title:"",item_id:0,cat_id:"",s_number:"",page_id:"",copy_page_id:"",attachment_count:"",catalogs:[],isLock:0,intervalId:0,saving:!1,showMockDialog:!1,lang:"",sortPageVisiable:!1,notifyVisiable:!1,is_notify:0,notify_content:"",templateVisiable:!1}},computed:{belong_to_catalogs:function(){if(!this.catalogs||this.catalogs.length<=0)return[];for(var t=this.catalogs.slice(0),e=[],a=function t(a,i){if(a.length>0)for(var o=0;o<a.length;o++){var n=i+" / "+a[o].cat_name;e.push({cat_id:a[o].cat_id,cat_name:n}),a[o].sub&&a[o].sub.length>0&&t(a[o].sub,n)}},i=0;i<t.length;i++)e.push(t[i]),a(t[i].sub,t[i].cat_name);var o={cat_id:0,cat_name:this.$t("none")};return e.push(o),e}},components:{Editormd:it,JsonToTable:Ce,JsonBeautify:Le,TemplateList:Me,HistoryVersion:ht,AttachmentList:It,PasteTable:Ae,SortPage:bt,Mock:Ve,Notify:Be},methods:{get_page_content:function(t){t||(t=this.page_id);var e=this,a=DocConfig.server+"/api/page/info",i=new URLSearchParams;i.append("page_id",t),e.axios.post(a,i).then(function(t){0===t.data.error_code?(e.content=Vt(t.data.data.page_content),setTimeout(function(){e.insertValue(e.content,1),document.body.scrollTop=document.documentElement.scrollTop=0},500),setTimeout(function(){e.content.length>3e3?e.editor_unwatch():e.editor_watch(),e.draft()},1e3),e.title=t.data.data.page_title,e.item_id=t.data.data.item_id,e.cat_id=t.data.data.cat_id,e.s_number=t.data.data.s_number,e.attachment_count=t.data.data.attachment_count>0?"...":""):e.$alert(t.data.error_message)}).catch(function(t){console.log(t)})},get_catalog:function(t){var e=this,a=DocConfig.server+"/api/catalog/catListGroup",i=new URLSearchParams;i.append("item_id",t),e.axios.post(a,i).then(function(t){if(0===t.data.error_code){var a=t.data.data;e.catalogs=a}else e.$alert(t.data.error_message)}).catch(function(t){console.log(t)})},insertValue:function(t,e){if(t){var a=this.$refs.Editormd;e?(a.clear(),a.insertValue(t),a.setCursorToTop()):a.insertValue(t)}},insert_api_template:function(){var t;t="zh-cn"==DocConfig.lang?'\n\n[TOC]\n \n##### 简要描述\n\n- 用户注册接口\n\n##### 请求URL\n- ` http://xx.com/api/user/register `\n \n##### 请求方式\n- POST \n\n##### 参数\n\n|参数名|必选|类型|说明|\n|:---- |:---|:----- |----- |\n|username |是 |string |用户名 |\n|password |是 |string | 密码 |\n|name |否 |string | 昵称 |\n\n##### 返回示例 \n\n``` \n {\n "error_code": 0,\n "data": {\n "uid": "1",\n "username": "12154545",\n "name": "吴系挂",\n "groupid": 2 ,\n "reg_time": "1436864169",\n "last_login_time": "0",\n }\n }\n```\n\n##### 返回参数说明 \n\n|参数名|类型|说明|\n|:----- |:-----|----- |\n|groupid |int |用户组id,1:超级管理员;2:普通用户 |\n\n##### 备注 \n\n- 更多返回错误代码请看首页的错误代码描述\n\n\n\n':'\n\n[TOC]\n\n##### Brief description\n\n- User Registration Interface\n\n\n##### Request URL\n- ` http://xx.com/api/user/register `\n \n##### Method\n- POST \n\n##### Parameter\n\n|Parameter name|Required|Type|Explain|\n|:---- |:---|:----- |----- |\n|username |Yes |string |Your username |\n|password |Yes |string | Your password |\n|name |No |string | Your name |\n\n##### Return example \n\n``` \n {\n "error_code": 0,\n "data": {\n "uid": "1",\n "username": "12154545",\n "name": "harry",\n "groupid": 2 ,\n "reg_time": "1436864169",\n "last_login_time": "0",\n }\n }\n```\n\n##### Return parameter description \n\n|Parameter name|Type|Explain|\n|:----- |:-----|----- |\n|groupid |int | .|\n\n##### Remark \n\n- For more error code returns, see the error code description on the home page\n\n\n',this.insertValue(t)},insert_database_template:function(){var t;t="zh-cn"==DocConfig.lang?"\n\n \n- 用户表,储存用户信息\n\n|字段|类型|空|默认|注释|\n|:---- |:------- |:--- |---|------ |\n|uid |int(10) |否 | | |\n|username |varchar(20) |否 | | 用户名 |\n|password |varchar(50) |否 | | 密码 |\n|name |varchar(15) |是 | | 昵称 |\n|reg_time |int(11) |否 | 0 | 注册时间 |\n\n- 备注:无\n\n":"\n \n- User table , to store user information\n\n\n|Field|Type|Empty|Default|Explain|\n|:---- |:------- |:--- |-- -|------ |\n|uid |int(10) |No | | |\n|username |varchar(20) |No | | |\n|password |varchar(50) |No | | |\n|name |varchar(15) |No | | |\n|reg_time |int(11) |No | 0 | . |\n\n- Remark : none\n\n\n",this.insertValue(t)},editor_unwatch:function(){this.$refs.Editormd.editor_unwatch(),localStorage.getItem("page_id_unwatch_"+this.page_id)||(this.$message(this.$t("long_page_tips")),localStorage.setItem("page_id_unwatch_"+this.page_id,1))},editor_watch:function(){this.$refs.Editormd.editor_watch()},ShowJsonToTable:function(){this.$refs.JsonToTable.dialogFormVisible=!0},ShowJsonBeautify:function(){this.$refs.JsonBeautify.dialogFormVisible=!0},ShowRunApi:function(){window.open("http://runapi.showdoc.cc/")},ShowPasteTable:function(){this.$refs.PasteTable.dialogFormVisible=!0},ShowHistoryVersion:function(){this.$refs.HistoryVersion.show()},showSortPage:function(){var t=this;this.save(function(){t.sortPageVisiable=!0})},showNotify:function(){var t=this;this.page_id>0?this.notifyVisiable=!0:this.save(function(){t.notifyVisiable=!0})},save:function(t){var e=this;if(this.saving)return!1;this.saving=!0;var a=e.$loading(),i=this.$refs.Editormd.getMarkdown(),o=this.cat_id,n=e.$route.params.item_id,s=e.$route.params.page_id,r=DocConfig.server+"/api/page/save",l=new URLSearchParams;l.append("page_id",s),l.append("item_id",n),l.append("page_title",e.title),l.append("is_notify",e.is_notify),l.append("notify_content",e.notify_content),l.append("page_content",encodeURIComponent(i)),l.append("is_urlencode",1),l.append("cat_id",o),e.axios.post(r,l).then(function(i){a.close(),e.saving=!1,0===i.data.error_code?("function"==typeof t?t():e.$message({showClose:!0,message:e.$t("save_success"),type:"success"}),e.deleteDraft(),s<=0&&(e.$router.push({path:"/page/edit/"+n+"/"+i.data.data.page_id}),e.page_id=i.data.data.page_id)):e.$alert(i.data.error_message)}),setTimeout(function(){a.close(),e.saving=!1},2e4)},goback:function(){var t="/"+this.$route.params.item_id+"/"+this.$route.params.page_id;this.$router.push({path:t})},dropdown_callback:function(t){t&&t()},save_to_template:function(){var t=this,e=this.$refs.Editormd.getMarkdown();this.$prompt(t.$t("save_templ_title")," ",{}).then(function(a){var i=DocConfig.server+"/api/template/save",o=new URLSearchParams;o.append("template_title",a.value),o.append("template_content",e),t.axios.post(i,o).then(function(e){0===e.data.error_code?t.$alert(t.$t("save_templ_text")):t.$alert(e.data.error_message)})})},ShowAttachment:function(){this.$refs.AttachmentList.show()},upload_paste_img:function(t){for(var e=this,a=DocConfig.server+"/api/page/uploadImg",i=t.clipboardData,o=0,n=i.items.length;o<n;o++)if("file"==i.items[o].kind||i.items[o].type.indexOf("image")>-1){var s=i.items[o].getAsFile(),r=new FormData;r.append("t","ajax-uploadpic"),r.append("editormd-image-file",s);var l="",c=function(t,a){switch(t=t||"before"){case"before":l=e.$loading();break;case"error":l.close(),e.$alert("图片上传失败");break;case"success":if(l.close(),1==a.success){var i="![]("+a.url+")";e.insertValue(i)}else e.$alert(a.message)}};$.ajax({url:a,type:"POST",dataType:"json",data:r,processData:!1,contentType:!1,beforeSend:function(){c("before")},error:function(){c("error")},success:function(t){c("success",t)}}),t.preventDefault()}},draft:function(){var t=this,e="page_content_"+this.page_id,a=this.$refs.Editormd;setInterval(function(){var t=a.getMarkdown();localStorage.setItem(e,t)},3e4);var i=localStorage.getItem(e);i&&i.length>0&&i!=a.getMarkdown()&&a.getMarkdown()&&a.getMarkdown().length>10&&(localStorage.removeItem(e),t.$confirm(t.$t("draft_tips"),"",{showClose:!1}).then(function(){t.insertValue(i,!0),localStorage.removeItem(e)}).catch(function(){localStorage.removeItem(e)}))},deleteDraft:function(){for(var t=0;t<localStorage.length;t++){var e=localStorage.key(t);e.indexOf("page_content_")>-1&&localStorage.removeItem(e)}},setLock:function(){var t=this;this.page_id>0&&this.request("/api/page/setLock",{page_id:this.page_id,item_id:this.item_id}).then(function(){t.isLock=1})},unlock:function(){var t=this;this.isLock&&this.request("/api/page/setLock",{page_id:this.page_id,item_id:this.item_id,lock_to:1e3}).then(function(){t.isLock=0})},heartBeatLock:function(){var t=this;this.intervalId=setInterval(function(){t.isLock&&t.setLock()},18e4)},remoteIsLock:function(){var t=this;this.request("/api/page/isLock",{page_id:this.page_id}).then(function(e){e.data.lock>0?e.data.is_cur_user>0?t.isLock=1:(t.$alert(t.$t("locking")+e.data.lock_username),t.goback()):t.setLock()})},unLockOnClose:function(){var t="",e=localStorage.getItem("userinfo");if(e){var a=JSON.parse(e);a&&a.user_token&&(t=a.user_token)}var i=new URLSearchParams({page_id:this.page_id,item_id:this.item_id,lock_to:1e3,user_token:t}),o=DocConfig.server+"/api/page/setLock";if("sendBeacon"in navigator)navigator.sendBeacon(o,i);else{var n=new XMLHttpRequest;n.open("POST",o,!1),n.send(i)}},refreshCat:function(){this.get_catalog(this.item_id)},goToCat:function(){var t=this.$router.resolve({path:"/catalog/"+this.item_id});window.open(t.href,"_blank")}},mounted:function(){this.page_id=this.$route.params.page_id,this.item_id=this.$route.params.item_id,this.copy_page_id=this.$route.query.copy_page_id?this.$route.query.copy_page_id:"",this.copy_page_id>0?this.get_page_content(this.copy_page_id):this.page_id>0?this.get_page_content(this.page_id):this.content="\n",this.get_catalog(this.$route.params.item_id),this.heartBeatLock(),this.remoteIsLock(),document.addEventListener("paste",this.upload_paste_img),this.lang=DocConfig.lang,window.addEventListener("beforeunload",this.unLockOnClose);var t=this.$store.state.open_cat_id;this.page_id<=0&&t>0&&(this.cat_id=t)},beforeDestroy:function(){document.removeEventListener("paste",this.upload_paste_img),this.$message.closeAll(),clearInterval(this.intervalId),this.unlock(),window.removeEventListener("beforeunload",this.unLockOnClose)}}),Ne={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello",on:{keydown:[function(e){return(e.type.indexOf("key")||83===e.keyCode)&&e.ctrlKey?(e.preventDefault(),t.save(e)):null},function(e){return(e.type.indexOf("key")||83===e.keyCode)&&e.metaKey?(e.preventDefault(),t.save(e)):null}]}},[a("Header"),t._v(" "),a("el-container",{staticClass:"container-narrow"},[a("el-row",{staticClass:"masthead"},[a("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0,size:"small"}},[a("el-form-item",{attrs:{label:t.$t("title")+" : "}},[a("el-input",{attrs:{placeholder:""},model:{value:t.title,callback:function(e){t.title=e},expression:"title"}})],1),t._v(" "),a("el-form-item",{attrs:{label:t.$t("catalog")+" : "}},[t.belong_to_catalogs?a("el-select",{staticClass:"cat",attrs:{placeholder:t.$t("optional"),filterable:""},model:{value:t.cat_id,callback:function(e){t.cat_id=e},expression:"cat_id"}},t._l(t.belong_to_catalogs,function(t){return a("el-option",{key:t.cat_name,attrs:{label:t.cat_name,value:t.cat_id}})}),1):t._e()],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("refresh_cat")}},[a("i",{staticClass:"el-icon-refresh-right icon-btn",on:{click:t.refreshCat}})])],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("go_add_cat")}},[a("i",{staticClass:"el-icon-plus icon-btn",on:{click:t.goToCat}})])],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("sort_pages")}},[a("i",{staticClass:"el-icon-sort icon-btn",on:{click:t.showSortPage}})])],1),t._v(" "),a("el-form-item",{staticClass:"pull-right"},[a("el-dropdown",{attrs:{"split-button":"",type:"primary",size:"medium",title:"Ctrl + S",trigger:"click"},on:{command:t.dropdown_callback,click:t.save}},[a("span",{attrs:{id:"save-page"}},[t._v(t._s(t.$t("save")))]),t._v(" "),a("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[a("el-dropdown-item",{attrs:{command:t.save_to_template}},[t._v(t._s(t.$t("save_to_templ")))]),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("lock_edit_tips"),placement:"left"}},[t.isLock?t._e():a("el-dropdown-item",{attrs:{command:t.setLock}},[t._v(t._s(t.$t("lock_edit")))])],1),t._v(" "),t.isLock?a("el-dropdown-item",{attrs:{command:t.unlock}},[t._v(t._s(t.$t("cacel_lock")))]):t._e()],1)],1),t._v(" "),a("el-button",{attrs:{type:"",size:"medium"},on:{click:t.showNotify}},[t._v(t._s(t.$t("save_and_notify")))]),t._v(" "),a("el-button",{attrs:{type:"",size:"medium"},on:{click:t.goback}},[t._v(t._s(t.$t("goback")))])],1)],1),t._v(" "),a("el-row",{staticClass:"fun-btn-group"},[a("el-button",{attrs:{type:"",size:"medium"},on:{click:t.insert_api_template}},[t._v(t._s(t.$t("insert_apidoc_template")))]),t._v(" "),a("el-button",{attrs:{type:"",size:"medium"},on:{click:t.insert_database_template}},[t._v(t._s(t.$t("insert_database_doc_template")))]),t._v(" "),a("el-button",{attrs:{type:"",size:"medium"},nativeOn:{click:function(e){t.templateVisiable=!0}}},[t._v(t._s(t.$t("more_templ")))]),t._v(" "),a("el-dropdown",{staticStyle:{"margin-left":"100px"},attrs:{"split-button":"",type:"",size:"medium",trigger:"hover"}},[t._v("\n "+t._s(t.$t("format_tools"))+"\n "),a("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[a("el-dropdown-item",{nativeOn:{click:function(e){return t.ShowJsonToTable(e)}}},[t._v(t._s(t.$t("json_to_table")))]),t._v(" "),a("el-dropdown-item",{nativeOn:{click:function(e){return t.ShowJsonBeautify(e)}}},[t._v(t._s(t.$t("beautify_json")))]),t._v(" "),a("el-dropdown-item",{nativeOn:{click:function(e){return t.ShowPasteTable(e)}}},[t._v(t._s(t.$t("paste_insert_table")))])],1)],1),t._v(" "),"zh-cn"==t.lang?a("el-button",{attrs:{type:"",size:"medium"},on:{click:function(e){t.showMockDialog=!0}}},[t._v("Mock")]):t._e(),t._v(" "),"zh-cn"==t.lang?a("el-button",{attrs:{type:"",size:"medium"},on:{click:t.ShowRunApi}},[t._v(t._s(t.$t("http_test_api")))]):t._e(),t._v(" "),a("el-badge",{staticClass:"item",attrs:{value:t.attachment_count}},[a("el-button",{attrs:{type:"",size:"medium"},on:{click:t.ShowAttachment}},[t._v(t._s(t.$t("attachment")))])],1),t._v(" "),a("el-button",{attrs:{size:"medium"},on:{click:t.ShowHistoryVersion}},[t._v(t._s(t.$t("history_version")))])],1),t._v(" "),t.content?a("Editormd",{ref:"Editormd",attrs:{content:t.content,type:"editor"}}):t._e()],1),t._v(" "),t.templateVisiable?a("TemplateList",{ref:"TemplateList",attrs:{item_id:t.item_id,callback:function(e){e&&"string"==typeof e&&t.insertValue(e),t.templateVisiable=!1}}}):t._e(),t._v(" "),a("HistoryVersion",{ref:"HistoryVersion",attrs:{callback:t.insertValue,is_show_recover_btn:!0}}),t._v(" "),a("JsonToTable",{ref:"JsonToTable",attrs:{callback:t.insertValue}}),t._v(" "),a("JsonBeautify",{ref:"JsonBeautify",attrs:{callback:t.insertValue}}),t._v(" "),a("AttachmentList",{ref:"AttachmentList",attrs:{callback:t.insertValue,item_id:t.item_id,manage:!0,page_id:t.page_id}}),t._v(" "),a("PasteTable",{ref:"PasteTable",attrs:{callback:t.insertValue,item_id:t.item_id,manage:!0,page_id:t.page_id}}),t._v(" "),t.sortPageVisiable?a("SortPage",{ref:"SortPage",attrs:{callback:function(){t.sortPageVisiable=!1},item_id:t.item_id,page_id:t.page_id,cat_id:t.cat_id}}):t._e(),t._v(" "),t.showMockDialog?a("Mock",{ref:"Mock",attrs:{page_id:t.page_id,item_id:t.item_id,callback:function(e){e&&t.insertValue(e),t.showMockDialog=!1}}}):t._e(),t._v(" "),t.notifyVisiable?a("Notify",{ref:"Notify",attrs:{page_id:t.page_id,item_id:t.item_id,callback:function(e){t.notifyVisiable=!1,e&&"string"==typeof e&&(t.is_notify=1,t.notify_content=e,t.save(function(){t.goback()}))}}}):t._e()],1),t._v(" "),a("Footer"),t._v(" "),a("div",{})],1)},staticRenderFns:[]};var Ge=a("VU/8")(He,Ne,!1,function(t){a("z0tW")},"data-v-945adf58",null).exports;if("undefined"!=typeof window)var Je=a("zhAq");var We={props:{callback:""},data:function(){return{content:"",historyContent:""}},components:{},methods:{get_content:function(){var t=this,e=DocConfig.server+"/api/page/diff",a=new URLSearchParams;a.append("page_id",t.$route.params.page_id),a.append("page_history_id",t.$route.params.page_history_id),t.axios.post(e,a).then(function(e){if(0===e.data.error_code){var a=e.data.data;t.content=a.page.page_content,t.historyContent=a.history_page.page_content,t.$nextTick(function(){t.diffUsingJS(0)})}else t.$alert(e.data.error_message)}).catch(function(t){console.log(t)})},diffUsingJS:function(t){var e=function(t){return document.getElementById(t)},a=difflib.stringAsLines(e("baseText").value),i=difflib.stringAsLines(e("newText").value),o=new difflib.SequenceMatcher(a,i).get_opcodes(),n=e("diffoutput");n.innerHTML="",n.appendChild(diffview.buildView({baseTextLines:a,newTextLines:i,opcodes:o,baseTextName:this.$t("cur_page_content"),newTextName:this.$t("history_version"),viewType:t}))}},mounted:function(){var t=this;Je(["static/diff/difflib.js","static/diff/diffview.js"],function(){t.get_content()})},beforeDestroy:function(){}},Ke={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("link",{attrs:{href:"static/diff/diffview.css",rel:"stylesheet"}}),t._v(" "),a("el-container",{staticClass:"container-narrow"},[a("div",{staticClass:"textInput"},[a("textarea",{staticStyle:{display:"none"},attrs:{id:"baseText"},domProps:{innerHTML:t._s(t.content)}})]),t._v(" "),a("div",{staticClass:"textInput spacer"},[a("textarea",{staticStyle:{display:"none"},attrs:{id:"newText"},domProps:{innerHTML:t._s(t.historyContent)}})]),t._v(" "),a("div",{attrs:{id:"diffoutput"}})]),t._v(" "),a("Footer"),t._v(" "),a("div",{})],1)},staticRenderFns:[]};var Ye=a("VU/8")(We,Ke,!1,function(t){a("I7H1")},"data-v-3b8850e9",null).exports,Xe={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-dialog",{attrs:{visible:!0,"close-on-click-modal":!1,width:"350px"}},[a("el-form",[a("el-form-item",{staticClass:"text-left",attrs:{label:""}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:t.$t("please_choose")},on:{change:t.selectItem},model:{value:t.is_del,callback:function(e){t.is_del=e},expression:"is_del"}},[a("el-option",{key:"0",attrs:{label:t.$t("copy_to"),value:"0"}}),t._v(" "),a("el-option",{key:"1",attrs:{label:t.$t("move_to"),value:"1"}})],1)],1),t._v(" "),a("el-form-item",{staticClass:"text-left",attrs:{label:""}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:t.$t("please_choose")},on:{change:t.selectItem},model:{value:t.to_item_id,callback:function(e){t.to_item_id=e},expression:"to_item_id"}},t._l(t.itemList,function(t){return a("el-option",{key:t.item_id,attrs:{label:t.item_name,value:t.item_id}})}),1)],1),t._v(" "),a("el-form-item",{staticClass:"text-left",attrs:{label:""}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:t.$t("please_choose")},model:{value:t.new_p_cat_id,callback:function(e){t.new_p_cat_id=e},expression:"new_p_cat_id"}},t._l(t.catalogs,function(t){return a("el-option",{key:t.cat_id,attrs:{label:t.cat_name,value:t.cat_id}})}),1)],1)],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:t.closeDialog}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.copy}},[t._v(t._s(t.$t("confirm")))])],1)],1)},staticRenderFns:[]};var Ze={name:"Login",components:{SortPage:bt,Copy:a("VU/8")({props:["cat_id","item_id","callback"],data:function(){return{itemList:[],to_item_id:"0",is_del:"0",catalogs:[{cat_id:"0",cat_name:"/"}],new_p_cat_id:"0"}},methods:{getItemList:function(){var t=this;this.request("/api/item/myList",{}).then(function(e){t.itemList=e.data,t.to_item_id=t.item_id})},selectItem:function(t){this.get_catalog(t)},get_catalog:function(t){var e=this,a=this;a.request("/api/catalog/catListName",{item_id:t}).then(function(t){e.new_p_cat_id="0";var i=t.data;i.unshift({cat_id:"0",cat_name:"/"}),a.catalogs=i})},copy:function(){var t=this;this.request("/api/catalog/copy",{cat_id:this.cat_id,new_p_cat_id:this.new_p_cat_id,to_item_id:this.to_item_id,is_del:this.is_del}).then(function(e){t.closeDialog()})},closeDialog:function(){this.callback&&this.callback()}},mounted:function(){this.getItemList(),this.get_catalog(this.item_id)}},Xe,!1,function(t){a("Lo8Q")},"data-v-468b7d9b",null).exports},data:function(){return{MyForm:{cat_id:0,parent_cat_id:"",cat_name:"",s_number:""},catalogs:[],dialogFormVisible:!1,copyFormVisible:!1,treeData:[],defaultProps:{children:"children",label:"label"},item_id:"",curl_cat_id:"",sortPageVisiable:!1}},computed:{belong_to_catalogs:function(){if(!this.catalogs||this.catalogs.length<=0)return[];for(var t=this.catalogs.slice(0),e=[],a=function t(a,i){if(a.length>0)for(var o=0;o<a.length;o++){var n=i+" / "+a[o].cat_name;e.push({cat_id:a[o].cat_id,cat_name:n}),a[o].sub&&a[o].sub.length>0&&t(a[o].sub,n)}},i=0;i<t.length;i++)e.push(t[i]),a(t[i].sub,t[i].cat_name);var o={cat_id:0,cat_name:this.$t("none")};return e.push(o),e}},methods:{get_catalog:function(){var t=this;this.request("/api/catalog/catListGroup",{item_id:this.$route.params.item_id}).then(function(e){var a=e.data;t.catalogs=a,t.treeData=[];t.treeData=function t(e){for(var a=[],i=0;i<e.length;i++){var o={children:[]};o.id=e[i].cat_id,o.label=e[i].cat_name,e[i].sub.length>0&&(o.children=t(e[i].sub)),a.push(o)}return a}(a)})},MyFormSubmit:function(){var t=this;this.request("/api/catalog/save",{item_id:this.$route.params.item_id,cat_id:this.MyForm.cat_id,parent_cat_id:this.MyForm.parent_cat_id,cat_name:this.MyForm.cat_name}).then(function(e){t.dialogFormVisible=!1,t.get_catalog(),t.MyForm=[]})},edit:function(t,e){this.MyForm={cat_id:e.id,parent_cat_id:t.parent.data.id,cat_name:e.label},this.dialogFormVisible=!0},delete_cat:function(t,e){var a=this,i=e.id;this.$confirm(this.$t("confirm_cat_delete")," ",{confirmButtonText:this.$t("confirm"),cancelButtonText:this.$t("cancel"),type:"warning"}).then(function(){a.request("/api/catalog/delete",{item_id:a.$route.params.item_id,cat_id:i}).then(function(t){a.get_catalog()})})},resetForm:function(){this.MyForm={cat_id:0,parent_cat_id:"",cat_name:"",s_number:""}},add_cat:function(t,e){t&&e.id?this.MyForm={cat_id:"",parent_cat_id:e.id,cat_name:""}:this.resetForm(),this.dialogFormVisible=!0},goback:function(){var t="/"+this.$route.params.item_id;this.$router.push({path:t})},handleDragEnd:function(t,e,a,i){var o=this.dimensionReduction(this.treeData);this.request("/api/catalog/batUpdate",{item_id:this.$route.params.item_id,cats:p()(o)})},dimensionReduction:function(t){for(var e=[],a=function t(a,i,o,n){if(e.push({cat_id:a.id,cat_name:a.label,parent_cat_id:i,level:o,s_number:n+1}),a.hasOwnProperty("children"))for(var s=0;s<a.children.length;s++)t(a.children[s],a.id,o+1,s)},i=0;i<t.length;i++)a(t[i],0,2,i);return e},showSortPage:function(t,e){this.curl_cat_id=e.id,this.sortPageVisiable=!0},copyCat:function(t,e){this.curl_cat_id=e.id,this.copyFormVisible=!0},copyCallback:function(){this.copyFormVisible=!1,this.get_catalog()}},mounted:function(){this.get_catalog(),this.item_id=this.$route.params.item_id},beforeDestroy:function(){}},Qe={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",[a("el-card",{staticClass:"center-card"},[a("el-row",[a("el-button",{staticClass:"add-cat",attrs:{type:"text"},on:{click:function(e){return t.add_cat()}}},[t._v(t._s(t.$t("add_cat")))]),t._v(" "),a("el-button",{staticClass:"goback-btn",attrs:{type:"text"},on:{click:t.goback}},[t._v(t._s(t.$t("goback")))])],1),t._v(" "),t.treeData.length>1?a("p",{staticClass:"tips"},[t._v(t._s(t.$t("cat_tips")))]):t._e(),t._v(" "),a("el-tree",{staticClass:"tree-node",attrs:{data:t.treeData,"node-key":"id","default-expand-all":"",draggable:""},on:{"node-drag-end":t.handleDragEnd},scopedSlots:t._u([{key:"default",fn:function(e){var i=e.node,o=e.data;return a("span",{staticClass:"custom-tree-node"},[a("span",[t._v(t._s(i.label))]),t._v(" "),a("span",{staticClass:"right-bar"},[a("el-button",{staticClass:"el-icon-edit",attrs:{type:"text",size:"mini",title:t.$t("edit")},on:{click:function(e){return e.stopPropagation(),t.edit(i,o)}}}),t._v(" "),a("el-button",{staticClass:"el-icon-plus",attrs:{type:"text",size:"mini",title:t.$t("add_cat")},on:{click:function(e){return e.stopPropagation(),t.add_cat(i,o)}}}),t._v(" "),a("el-button",{staticClass:"el-icon-document",attrs:{type:"text",size:"mini",title:t.$t("sort_pages")},on:{click:function(e){return e.stopPropagation(),t.showSortPage(i,o)}}}),t._v(" "),a("el-button",{staticClass:"el-icon-copy-document",attrs:{type:"text",size:"mini",title:t.$t("copy_or_mv_cat")},on:{click:function(e){return e.stopPropagation(),t.copyCat(i,o)}}}),t._v(" "),a("el-button",{staticClass:"el-icon-delete",attrs:{type:"text",size:"mini"},on:{click:function(e){return e.stopPropagation(),t.delete_cat(i,o)}}})],1)])}}])})],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogFormVisible,width:"300px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[a("el-form",[a("el-form-item",{attrs:{label:t.$t("cat_name")+" : "}},[a("el-input",{attrs:{placeholder:t.$t("input_cat_name")},model:{value:t.MyForm.cat_name,callback:function(e){t.$set(t.MyForm,"cat_name",e)},expression:"MyForm.cat_name"}})],1),t._v(" "),a("el-form-item",{attrs:{label:t.$t("parent_cat_name")+" : "}},[a("el-select",{attrs:{placeholder:t.$t("none")},model:{value:t.MyForm.parent_cat_id,callback:function(e){t.$set(t.MyForm,"parent_cat_id",e)},expression:"MyForm.parent_cat_id"}},t._l(t.belong_to_catalogs,function(t){return a("el-option",{key:t.cat_id,attrs:{label:t.cat_name,value:t.cat_id}})}),1)],1)],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogFormVisible=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.MyFormSubmit}},[t._v(t._s(t.$t("confirm")))])],1)],1)],1),t._v(" "),t.sortPageVisiable?a("SortPage",{ref:"SortPage",attrs:{callback:function(){t.sortPageVisiable=!1},item_id:t.item_id,cat_id:t.curl_cat_id}}):t._e(),t._v(" "),t.copyFormVisible?a("Copy",{attrs:{item_id:t.item_id,cat_id:t.curl_cat_id,callback:t.copyCallback}}):t._e(),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var ta=a("VU/8")(Ze,Qe,!1,function(t){a("lX1S")},"data-v-7d76cb93",null).exports,ea={name:"Login",components:{},data:function(){return{unreadList:[],allList:[]}},methods:{getList:function(t){t||(t="all");var e=this,a=DocConfig.server+"/api/notice/getList",i=new URLSearchParams;i.append("notice_type",t),e.axios.post(a,i).then(function(a){if(0===a.data.error_code){var i=a.data.data;"unread"==t?e.unreadList=i:e.allList=i}else e.$alert(a.data.error_message)})},show_notice:function(t){var e=t.notice_id;t.is_read=1;var a=this;a.$alert(t.notice_content,"",{dangerouslyUseHTMLString:!0});var i=DocConfig.server+"/api/notice/setRead",o=new URLSearchParams;o.append("notice_id",e),a.axios.post(i,o).then(function(t){0===t.data.error_code||a.$alert(t.data.error_message)})},delete_notice:function(t){var e=t.notice_id,a=this,i=DocConfig.server+"/api/notice/delete";this.$confirm("确认删除吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){var t=new URLSearchParams;t.append("notice_id",e),a.axios.post(i,t).then(function(t){0===t.data.error_code?a.getList():a.$alert(t.data.error_message)})})},feedback:function(){this.$alert("对showdoc.cc的任何疑问、建议都可以反馈到 xing7th@gmail.com")}},mounted:function(){this.getList()},beforeCreate:function(){},beforeDestroy:function(){}},aa={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",[a("el-card",{staticClass:"center-card"},[[a("el-button",{staticClass:"goback-btn",attrs:{type:"text"},on:{click:t.feedback}},[a("span",{staticClass:"feedback"},[t._v("反馈")])]),t._v(" "),a("router-link",{attrs:{to:"/item/index"}},[t._v("返回")]),t._v(" "),a("el-tabs",{attrs:{value:"first",type:"card"}},[a("el-tab-pane",{attrs:{label:"我的消息",name:"first"}},[a("el-table",{staticStyle:{width:"100%"},attrs:{align:"left",data:t.allList,height:"350","default-expand-all":!1}},[a("el-table-column",{attrs:{prop:"notice_title",label:"标题"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",{domProps:{innerHTML:t._s(e.row.notice_title)}}),t._v(" "),0==e.row.is_read?a("el-badge",{staticClass:"mark",attrs:{value:"未读"}}):t._e()]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"from_name",label:"发送人"}}),t._v(" "),a("el-table-column",{attrs:{prop:"notice_time",label:"时间",width:"100"}}),t._v(" "),a("el-table-column",{attrs:{prop:"",label:"操作"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.show_notice(e.row)}}},[t._v("查看")]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.delete_notice(e.row)}}},[t._v("删除")])]}}])})],1)],1)],1)]],2)],1),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var ia=a("VU/8")(ea,aa,!1,function(t){a("hFwC")},"data-v-72029cac",null).exports,oa={data:function(){return{page:1,count:7,item_name:"",username:"",itemList:[],total:0,dialogAttornVisible:!1,attornForm:{username:""},attorn_item_id:""}},methods:{get_item_list:function(){var t=this,e=DocConfig.server+"/api/adminItem/getList",a=new URLSearchParams;a.append("item_name",this.item_name),a.append("username",this.username),a.append("page",this.page),a.append("count",this.count),t.axios.post(e,a).then(function(e){if(0===e.data.error_code){var a=e.data.data;t.itemList=a.items,t.total=a.total}else t.$alert(e.data.error_message)})},formatPrivacy:function(t,e){if(t)return t.password.length>0?this.$t("private"):this.$t("public")},jump_to_item:function(t){var e="#/"+t.item_id;window.open(e)},handleCurrentChange:function(t){this.page=t,this.get_item_list()},onSubmit:function(){this.page=1,this.get_item_list()},delete_item:function(t){var e=this,a=DocConfig.server+"/api/adminItem/deleteItem";this.$confirm(e.$t("confirm_delete")," ",{confirmButtonText:e.$t("confirm"),cancelButtonText:e.$t("cancel"),type:"warning"}).then(function(){var i=new URLSearchParams;i.append("item_id",t.item_id),e.axios.post(a,i).then(function(t){0===t.data.error_code?(e.$message.success("删除成功"),e.get_item_list()):e.$alert(t.data.error_message)})})},click_attorn_item:function(t){this.dialogAttornVisible=!0,this.attorn_item_id=t.item_id},attorn:function(){var t=this,e=DocConfig.server+"/api/adminItem/attorn",a=new URLSearchParams;a.append("item_id",t.attorn_item_id),a.append("username",this.attornForm.username),t.axios.post(e,a).then(function(e){0===e.data.error_code?(t.dialogAttornVisible=!1,t.$message.success(t.$t("success")),t.get_item_list()):t.$alert(e.data.error_message)}).catch(function(t){console.log(t)})}},mounted:function(){this.get_item_list()},beforeDestroy:function(){this.$message.closeAll()}},na={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0}},[a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{placeholder:t.$t("item_name")},model:{value:t.item_name,callback:function(e){t.item_name=e},expression:"item_name"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{placeholder:t.$t("owner")},model:{value:t.username,callback:function(e){t.username=e},expression:"username"}})],1),t._v(" "),a("el-form-item",[a("el-button",{on:{click:t.onSubmit}},[t._v(t._s(t.$t("search")))])],1)],1),t._v(" "),a("el-table",{staticStyle:{width:"100%"},attrs:{data:t.itemList}},[a("el-table-column",{attrs:{prop:"item_name",label:t.$t("item_name"),width:"140"}}),t._v(" "),a("el-table-column",{attrs:{prop:"item_description",label:t.$t("item_description"),width:"140"}}),t._v(" "),a("el-table-column",{attrs:{prop:"password",label:t.$t("privacy"),formatter:t.formatPrivacy,width:"80"}}),t._v(" "),a("el-table-column",{attrs:{prop:"item_id",label:t.$t("link"),width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.jump_to_item(e.row)}}},[t._v(t._s(t.$t("link")))])]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"username",label:t.$t("owner"),width:"160"}}),t._v(" "),a("el-table-column",{attrs:{label:t.$t("memberCount"),width:"80"}}),t._v(" "),a("el-table-column",{attrs:{prop:"addtime",label:t.$t("add_time"),width:"160"}}),t._v(" "),a("el-table-column",{attrs:{prop:"item_domain",label:t.$t("operation")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.click_attorn_item(e.row)}}},[t._v(t._s(t.$t("attorn")))]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.delete_item(e.row)}}},[t._v(t._s(t.$t("delete")))])]}}])})],1),t._v(" "),a("div",{staticClass:"block"},[a("span",{staticClass:"demonstration"}),t._v(" "),a("el-pagination",{attrs:{"page-size":t.count,layout:"total, prev, pager, next",total:t.total},on:{"current-change":t.handleCurrentChange}})],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogAttornVisible,"close-on-click-modal":!1,width:"300px"},on:{"update:visible":function(e){t.dialogAttornVisible=e}}},[a("el-form",[a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{placeholder:t.$t("attorn_username")},model:{value:t.attornForm.username,callback:function(e){t.$set(t.attornForm,"username",e)},expression:"attornForm.username"}})],1)],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogAttornVisible=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.attorn}},[t._v(t._s(t.$t("attorn")))])],1)],1)],1)},staticRenderFns:[]};var sa={data:function(){return{itemList:[],username:"",page:1,count:7,total:0,addForm:{username:"",password:"",uid:0,name:""},dialogAddVisible:!1}},methods:{get_user_list:function(){var t=this,e=DocConfig.server+"/api/adminUser/getList",a=new URLSearchParams;a.append("username",this.username),a.append("page",this.page),a.append("count",this.count),t.axios.post(e,a).then(function(e){if(0===e.data.error_code){var a=e.data.data;t.itemList=a.users,t.total=a.total}else t.$alert(e.data.error_message)})},formatGroup:function(t,e){if(t)return 1==t.groupid?this.$t("administrator"):2==t.groupid?this.$t("ordinary_users"):""},jump_to_item:function(t){var e="#/"+t.item_id;window.open(e)},handleCurrentChange:function(t){this.page=t,this.get_user_list()},onSubmit:function(){this.page=1,this.get_user_list()},delete_user:function(t){var e=this,a=DocConfig.server+"/api/adminUser/deleteUser";this.$confirm(e.$t("confirm_delete")," ",{confirmButtonText:e.$t("confirm"),cancelButtonText:e.$t("cancel"),type:"warning"}).then(function(){var i=new URLSearchParams;i.append("uid",t.uid),e.axios.post(a,i).then(function(t){0===t.data.error_code?(e.$message.success("success"),e.get_user_list(),e.username=""):e.$alert(t.data.error_message)})})},click_edit:function(t){this.dialogAddVisible=!0,this.addForm={uid:t.uid,name:t.name,username:t.username,password:""}},add_user:function(){var t=this,e=DocConfig.server+"/api/adminUser/addUser",a=new URLSearchParams;a.append("username",t.addForm.username),a.append("password",this.addForm.password),a.append("uid",this.addForm.uid),a.append("name",this.addForm.name),t.axios.post(e,a).then(function(e){0===e.data.error_code?(t.dialogAddVisible=!1,t.addForm.password="",t.addForm.username="",t.addForm.uid=0,t.addForm.name="",t.$message.success(t.$t("success")),t.get_user_list()):t.$alert(e.data.error_message)}).catch(function(t){console.log(t)})},resetForm:function(){this.addForm={uid:0,name:"",username:"",password:""},this.dialogAddVisible=!1}},mounted:function(){this.get_user_list()},beforeDestroy:function(){this.$message.closeAll()}},ra={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0}},[a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{placeholder:t.$t("username")},model:{value:t.username,callback:function(e){t.username=e},expression:"username"}})],1),t._v(" "),a("el-form-item",[a("el-button",{on:{click:t.onSubmit}},[t._v(t._s(t.$t("search")))])],1)],1),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:function(e){t.dialogAddVisible=!0}}},[t._v(t._s(t.$t("add_user")))]),t._v(" "),a("el-table",{staticStyle:{width:"100%"},attrs:{data:t.itemList}},[a("el-table-column",{attrs:{prop:"username",label:t.$t("username"),width:"200"}}),t._v(" "),a("el-table-column",{attrs:{prop:"name",label:t.$t("name")}}),t._v(" "),a("el-table-column",{attrs:{prop:"groupid",label:t.$t("userrole"),formatter:t.formatGroup,width:"150"}}),t._v(" "),a("el-table-column",{attrs:{prop:"reg_time",label:t.$t("reg_time"),width:"160"}}),t._v(" "),a("el-table-column",{attrs:{prop:"last_login_time",label:t.$t("last_login_time"),width:"160"}}),t._v(" "),a("el-table-column",{attrs:{prop:"item_domain",label:t.$t("operation")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.click_edit(e.row)}}},[t._v(t._s(t.$t("edit")))]),t._v(" "),1!=e.row.groupid?a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.delete_user(e.row)}}},[t._v(t._s(t.$t("delete")))]):t._e()]}}])})],1),t._v(" "),a("div",{staticClass:"block"},[a("span",{staticClass:"demonstration"}),t._v(" "),a("el-pagination",{attrs:{"page-size":t.count,layout:"total, prev, pager, next",total:t.total},on:{"current-change":t.handleCurrentChange}})],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogAddVisible,"before-close":t.resetForm,"close-on-click-modal":!1,width:"300px"},on:{"update:visible":function(e){t.dialogAddVisible=e}}},[a("el-form",[a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"text",placeholder:t.$t("username"),readonly:t.addForm.uid>0},model:{value:t.addForm.username,callback:function(e){t.$set(t.addForm,"username",e)},expression:"addForm.username"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"text",placeholder:t.$t("name")},model:{value:t.addForm.name,callback:function(e){t.$set(t.addForm,"name",e)},expression:"addForm.name"}})],1),t._v(" "),t.addForm.uid<=0?a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"password",placeholder:t.$t("password")},model:{value:t.addForm.password,callback:function(e){t.$set(t.addForm,"password",e)},expression:"addForm.password"}})],1):t._e(),t._v(" "),t.addForm.uid>0?a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"password",placeholder:t.$t("update_pwd_tips")},model:{value:t.addForm.password,callback:function(e){t.$set(t.addForm,"password",e)},expression:"addForm.password"}})],1):t._e()],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:t.resetForm}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.add_user}},[t._v(t._s(t.$t("confirm")))])],1)],1)],1)},staticRenderFns:[]};var la={data:function(){return{form:{register_open:!0,home_page:"1",home_item:"",oss_open:!1,oss_setting:{oss_type:"aliyun",key:"",secret:"",endpoint:"",bucket:"",protocol:"http",domain:"",region:"",secretId:"",secretKey:""},history_version_count:20,beian:"",show_watermark:!1,site_url:""},itemList:[]}},methods:{onSubmit:function(){var t=this,e=DocConfig.server+"/api/adminSetting/saveConfig";this.axios.post(e,this.form).then(function(e){0===e.data.error_code?t.$alert(t.$t("success")):t.$alert(e.data.error_message)})},loadConfig:function(){var t=this,e=DocConfig.server+"/api/adminSetting/loadConfig";this.axios.post(e,this.form).then(function(e){if(0===e.data.error_code){if(0===e.data.data.length)return;t.form.register_open=e.data.data.register_open>0,t.form.history_version_count=e.data.data.history_version_count?e.data.data.history_version_count:t.form.history_version_count,t.form.oss_open=e.data.data.oss_open>0,t.form.home_page=e.data.data.home_page>0?e.data.data.home_page:1,t.form.home_item=e.data.data.home_item>0?e.data.data.home_item:"",t.form.oss_setting=e.data.data.oss_setting?e.data.data.oss_setting:t.form.oss_setting,t.form.oss_setting.region=t.form.oss_setting.region?t.form.oss_setting.region:"",t.form.oss_setting.secretId=t.form.oss_setting.secretId?t.form.oss_setting.secretId:"",t.form.oss_setting.secretKey=t.form.oss_setting.secretKey?t.form.oss_setting.secretKey:"",t.form.beian=e.data.data.beian?e.data.data.beian:"",t.form.show_watermark=e.data.data.show_watermark>0,t.form.site_url=e.data.data.site_url?e.data.data.site_url:""}else t.$alert(e.data.error_message)})},get_item_list:function(){var t=this,e=DocConfig.server+"/api/adminItem/getList",a=new URLSearchParams;a.append("page",1),a.append("count",1e3),t.axios.post(e,a).then(function(e){if(0===e.data.error_code){var a=e.data.data;t.itemList=a.items}else t.$alert(e.data.error_message)})}},mounted:function(){this.get_item_list(),this.loadConfig()},beforeDestroy:function(){this.$message.closeAll()}},ca={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("el-form",{ref:"form",attrs:{model:t.form,"label-width":"150px"}},[a("el-form-item",{attrs:{label:t.$t("register_open")}},[a("el-switch",{model:{value:t.form.register_open,callback:function(e){t.$set(t.form,"register_open",e)},expression:"form.register_open"}})],1),t._v(" "),a("el-form-item",{attrs:{label:t.$t("home_page")}},[a("el-select",{attrs:{placeholder:t.$t("please_choose")},model:{value:t.form.home_page,callback:function(e){t.$set(t.form,"home_page",e)},expression:"form.home_page"}},[a("el-option",{attrs:{label:t.$t("full_page"),value:"1"}}),t._v(" "),a("el-option",{attrs:{label:t.$t("login_page"),value:"2"}}),t._v(" "),a("el-option",{attrs:{label:t.$t("jump_to_an_item"),value:"3"}})],1)],1),t._v(" "),a("el-form-item",{directives:[{name:"show",rawName:"v-show",value:3==t.form.home_page,expression:"form.home_page == 3"}],attrs:{label:t.$t("jump_to_item")}},[a("el-select",{attrs:{placeholder:t.$t("please_choose")},model:{value:t.form.home_item,callback:function(e){t.$set(t.form,"home_item",e)},expression:"form.home_item"}},t._l(t.itemList,function(t){return a("el-option",{key:t.item_id,attrs:{label:t.item_name,value:t.item_id}})}),1)],1),t._v(" "),a("el-form-item",{directives:[{name:"show",rawName:"v-show",value:"zh-cn"==t.$lang,expression:"$lang == 'zh-cn'"}],attrs:{label:"备案号"}},[a("el-input",{staticClass:"form-el",model:{value:t.form.beian,callback:function(e){t.$set(t.form,"beian",e)},expression:"form.beian"}}),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"设置后会展示在网站首页最下方",placement:"top"}},[a("i",{staticClass:"el-icon-question"})])],1),t._v(" "),a("el-form-item",{attrs:{label:t.$t("history_version_count")}},[a("el-input",{staticClass:"form-el",model:{value:t.form.history_version_count,callback:function(e){t.$set(t.form,"history_version_count",e)},expression:"form.history_version_count"}}),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("history_version_count_content"),placement:"top"}},[a("i",{staticClass:"el-icon-question"})])],1),t._v(" "),a("el-form-item",{attrs:{label:t.$t("watermark")}},[a("el-switch",{model:{value:t.form.show_watermark,callback:function(e){t.$set(t.form,"show_watermark",e)},expression:"form.show_watermark"}}),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("watermark_tips"),placement:"top"}},[a("i",{staticClass:"el-icon-question"})])],1),t._v(" "),a("el-form-item",{attrs:{label:t.$t("site_url")}},[a("el-input",{staticClass:"form-el",attrs:{placeholder:"https://www.your-site.com"},model:{value:t.form.site_url,callback:function(e){t.$set(t.form,"site_url",e)},expression:"form.site_url"}}),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("site_url_tips"),placement:"top"}},[a("i",{staticClass:"el-icon-question"})])],1),t._v(" "),a("el-form-item",{attrs:{label:t.$t("oss_open")}},[a("el-switch",{model:{value:t.form.oss_open,callback:function(e){t.$set(t.form,"oss_open",e)},expression:"form.oss_open"}})],1),t._v(" "),t.form.oss_open?a("div",{staticStyle:{"margin-left":"50px"}},[a("el-form-item",{attrs:{label:t.$t("oss_server")}},[a("el-select",{model:{value:t.form.oss_setting.oss_type,callback:function(e){t.$set(t.form.oss_setting,"oss_type",e)},expression:"form.oss_setting.oss_type"}},[a("el-option",{attrs:{label:t.$t("aliyun"),value:"aliyun"}}),t._v(" "),a("el-option",{attrs:{label:t.$t("qiniu"),value:"qiniu"}}),t._v(" "),a("el-option",{attrs:{label:t.$t("qcloud"),value:"qcloud"}}),t._v(" "),a("el-option",{attrs:{label:t.$t("s3_storage"),value:"s3_storage"}})],1)],1),t._v(" "),"qcloud"!=t.form.oss_setting.oss_type?a("el-form-item",{attrs:{label:"key"}},[a("el-input",{staticClass:"form-el",model:{value:t.form.oss_setting.key,callback:function(e){t.$set(t.form.oss_setting,"key",e)},expression:"form.oss_setting.key"}})],1):t._e(),t._v(" "),"qcloud"!=t.form.oss_setting.oss_type?a("el-form-item",{attrs:{label:"secret"}},[a("el-input",{staticClass:"form-el",model:{value:t.form.oss_setting.secret,callback:function(e){t.$set(t.form.oss_setting,"secret",e)},expression:"form.oss_setting.secret"}})],1):t._e(),t._v(" "),"aliyun"==t.form.oss_setting.oss_type||"s3_storage"==t.form.oss_setting.oss_type?a("el-form-item",{attrs:{label:"endpoint"}},[a("el-input",{staticClass:"form-el",model:{value:t.form.oss_setting.endpoint,callback:function(e){t.$set(t.form.oss_setting,"endpoint",e)},expression:"form.oss_setting.endpoint"}})],1):t._e(),t._v(" "),"qcloud"==t.form.oss_setting.oss_type?a("el-form-item",{attrs:{label:"region"}},[a("el-input",{staticClass:"form-el",model:{value:t.form.oss_setting.region,callback:function(e){t.$set(t.form.oss_setting,"region",e)},expression:"form.oss_setting.region"}})],1):t._e(),t._v(" "),"qcloud"==t.form.oss_setting.oss_type?a("el-form-item",{attrs:{label:"secretId"}},[a("el-input",{staticClass:"form-el",model:{value:t.form.oss_setting.secretId,callback:function(e){t.$set(t.form.oss_setting,"secretId",e)},expression:"form.oss_setting.secretId"}})],1):t._e(),t._v(" "),"qcloud"==t.form.oss_setting.oss_type?a("el-form-item",{attrs:{label:"secretKey"}},[a("el-input",{staticClass:"form-el",model:{value:t.form.oss_setting.secretKey,callback:function(e){t.$set(t.form.oss_setting,"secretKey",e)},expression:"form.oss_setting.secretKey"}})],1):t._e(),t._v(" "),a("el-form-item",{attrs:{label:"bucket"}},[a("el-input",{staticClass:"form-el",model:{value:t.form.oss_setting.bucket,callback:function(e){t.$set(t.form.oss_setting,"bucket",e)},expression:"form.oss_setting.bucket"}})],1),t._v(" "),a("el-form-item",{attrs:{label:t.$t("oss_domain")}},[a("el-select",{staticStyle:{width:"100px"},model:{value:t.form.oss_setting.protocol,callback:function(e){t.$set(t.form.oss_setting,"protocol",e)},expression:"form.oss_setting.protocol"}},[a("el-option",{attrs:{label:"http://",value:"http"}}),t._v(" "),a("el-option",{attrs:{label:"https://",value:"https"}})],1),t._v(" "),a("el-input",{staticClass:"form-el",model:{value:t.form.oss_setting.domain,callback:function(e){t.$set(t.form.oss_setting,"domain",e)},expression:"form.oss_setting.domain"}})],1)],1):t._e(),t._v(" "),a("br"),t._v(" "),a("el-form-item",[a("el-button",{attrs:{type:"primary"},on:{click:t.onSubmit}},[t._v(t._s(t.$t("save")))]),t._v(" "),a("el-button",{on:{click:t.loadConfig}},[t._v(t._s(t.$t("cancel")))])],1)],1)],1)},staticRenderFns:[]};var ma={data:function(){return{page:1,count:7,display_name:"",username:"",dataList:[],total:0,positive_type:"1",attachment_type:"-1",used:0}},methods:{getList:function(){var t=this;this.request("/api/attachment/getAllList",{page:this.page,count:this.count,attachment_type:this.attachment_type,display_name:this.display_name,username:this.username}).then(function(e){var a=e.data;t.dataList=a.list,t.total=parseInt(a.total),t.used=a.used_m})},jump_to_item:function(t){var e="/"+t.item_id;window.open(e)},handleCurrentChange:function(t){this.page=t,this.getList()},onSubmit:function(){this.page=1,this.getList()},visit:function(t){window.open(t.url)},delete_row:function(t){var e=this;this.$confirm(this.$t("confirm_delete")," ",{confirmButtonText:this.$t("confirm"),cancelButtonText:this.$t("cancel"),type:"warning"}).then(function(){e.request("/api/attachment/deleteAttachment",{file_id:t.file_id}).then(function(t){e.$message.success(e.$t("op_success")),e.getList()})})}},mounted:function(){this.getList()},beforeDestroy:function(){this.$message.closeAll()}},da={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0}},[a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{placeholder:t.$t("display_name")},model:{value:t.display_name,callback:function(e){t.display_name=e},expression:"display_name"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-select",{attrs:{placeholder:""},model:{value:t.attachment_type,callback:function(e){t.attachment_type=e},expression:"attachment_type"}},[a("el-option",{attrs:{label:t.$t("all_attachment_type"),value:"-1"}}),t._v(" "),a("el-option",{attrs:{label:t.$t("image"),value:"1"}}),t._v(" "),a("el-option",{attrs:{label:t.$t("general_attachment"),value:"2"}})],1)],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{placeholder:t.$t("uploader")},model:{value:t.username,callback:function(e){t.username=e},expression:"username"}})],1),t._v(" "),a("el-form-item",[a("el-button",{on:{click:t.onSubmit}},[t._v(t._s(t.$t("search")))])],1)],1),t._v(" "),a("P",[t._v(t._s(t.$t("used_space"))+" "+t._s(t.used)+"M")]),t._v(" "),a("el-table",{staticStyle:{width:"100%"},attrs:{data:t.dataList}},[a("el-table-column",{attrs:{prop:"file_id",label:t.$t("file_id")}}),t._v(" "),a("el-table-column",{attrs:{prop:"display_name",label:t.$t("display_name")}}),t._v(" "),a("el-table-column",{attrs:{prop:"file_type",label:t.$t("file_type"),width:"140"}}),t._v(" "),a("el-table-column",{attrs:{prop:"file_size_m",label:t.$t("file_size_m"),width:"140"}}),t._v(" "),a("el-table-column",{attrs:{prop:"visit_times",label:t.$t("visit_times")}}),t._v(" "),a("el-table-column",{attrs:{prop:"username",label:t.$t("uploader")}}),t._v(" "),a("el-table-column",{attrs:{prop:"addtime",label:t.$t("add_time"),width:"160"}}),t._v(" "),a("el-table-column",{attrs:{prop:"",label:t.$t("operation")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.visit(e.row)}}},[t._v(t._s(t.$t("visit")))]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.delete_row(e.row)}}},[t._v(t._s(t.$t("delete")))])]}}])})],1),t._v(" "),a("div",{staticClass:"block"},[a("span",{staticClass:"demonstration"}),t._v(" "),a("el-pagination",{attrs:{"page-size":t.count,layout:"total, prev, pager, next",total:t.total},on:{"current-change":t.handleCurrentChange}})],1)],1)},staticRenderFns:[]};var _a={data:function(){return{form:{ldap_open:!1,ldap_form:{host:"",port:"389",version:"3",base_dn:"",bind_dn:"",bind_password:"",user_field:"",search_filter:"(cn=*)"},oauth2_open:!1,oauth2_form:{redirectUri:"",entrance_tips:"",client_id:"",client_secret:"",protocol:"https",host:"",authorize_path:"",token_path:"",resource_path:"",userinfo_path:""}},login_secret_key:"",itemList:[],lang:""}},methods:{saveLdapConfig:function(){var t=this,e=this.$loading();setTimeout(function(){e.close(),t.saving=!1},3e4);var a=DocConfig.server+"/api/adminSetting/saveLdapConfig";this.axios.post(a,this.form).then(function(a){0===a.data.error_code?t.$alert(t.$t("success")):t.$alert(a.data.error_message),e.close()})},loadLdapConfig:function(){var t=this,e=DocConfig.server+"/api/adminSetting/loadLdapConfig";this.axios.post(e,this.form).then(function(e){if(0===e.data.error_code){if(0===e.data.data.length)return;t.form.ldap_open=e.data.data.ldap_open>0,t.form.ldap_form=e.data.data.ldap_form?e.data.data.ldap_form:t.form.ldap_form}else t.$alert(e.data.error_message)})},saveOauth2Config:function(){var t=this,e=DocConfig.server+"/api/adminSetting/saveOauth2Config";this.axios.post(e,this.form).then(function(e){0===e.data.error_code?t.$alert(t.$t("success")):t.$alert(e.data.error_message)})},loadOauth2Config:function(){var t=this,e=DocConfig.server+"/api/adminSetting/loadOauth2Config";this.axios.post(e,this.form).then(function(e){if(0===e.data.error_code){if(0===e.data.data.length)return;t.form.oauth2_open=e.data.data.oauth2_open>0,t.form.oauth2_form=e.data.data.oauth2_form?e.data.data.oauth2_form:t.form.oauth2_form}else t.$alert(e.data.error_message)})},getLoginSecretKey:function(){var t=this;this.request("/api/adminSetting/getLoginSecretKey",{}).then(function(e){t.login_secret_key=e.data.login_secret_key})},resetLoginSecretKey:function(){var t=this;this.$confirm(this.$t("confirm")+"?"," ",{confirmButtonText:this.$t("confirm"),cancelButtonText:this.$t("cancel"),type:"warning"}).then(function(){t.request("/api/adminSetting/resetLoginSecretKey",{}).then(function(e){t.login_secret_key=e.data.login_secret_key})})}},mounted:function(){this.loadLdapConfig(),this.loadOauth2Config(),this.getLoginSecretKey(),this.lang=DocConfig.lang},beforeDestroy:function(){this.$message.closeAll()}},pa={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("el-tabs",{attrs:{type:"border-card"}},[a("el-tab-pane",{attrs:{label:"LDAP"}},[a("el-form",{ref:"form",attrs:{"label-width":"150px"}},[a("el-form-item",{attrs:{label:t.$t("ldap_open_label")}},[a("el-switch",{model:{value:t.form.ldap_open,callback:function(e){t.$set(t.form,"ldap_open",e)},expression:"form.ldap_open"}})],1),t._v(" "),a("div",[a("el-form-item",{attrs:{label:"ldap host"}},[a("el-input",{staticClass:"form-el",model:{value:t.form.ldap_form.host,callback:function(e){t.$set(t.form.ldap_form,"host",e)},expression:"form.ldap_form.host"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"ldap port"}},[a("el-input",{staticStyle:{width:"90px"},model:{value:t.form.ldap_form.port,callback:function(e){t.$set(t.form.ldap_form,"port",e)},expression:"form.ldap_form.port"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"ldap base dn "}},[a("el-input",{staticClass:"form-el",attrs:{placeholder:"例如 dc=showdoc,dc=com"},model:{value:t.form.ldap_form.base_dn,callback:function(e){t.$set(t.form.ldap_form,"base_dn",e)},expression:"form.ldap_form.base_dn"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"ldap bind dn "}},[a("el-input",{staticClass:"form-el",attrs:{placeholder:"cn=admin,dc=showdoc,dc=com"},model:{value:t.form.ldap_form.bind_dn,callback:function(e){t.$set(t.form.ldap_form,"bind_dn",e)},expression:"form.ldap_form.bind_dn"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"ldap bind password "}},[a("el-input",{staticClass:"form-el",attrs:{placeholder:"例如 123456"},model:{value:t.form.ldap_form.bind_password,callback:function(e){t.$set(t.form.ldap_form,"bind_password",e)},expression:"form.ldap_form.bind_password"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"ldap version"}},[a("el-select",{staticClass:"form-el",model:{value:t.form.ldap_form.version,callback:function(e){t.$set(t.form.ldap_form,"version",e)},expression:"form.ldap_form.version"}},[a("el-option",{attrs:{label:"3",value:"3"}}),t._v(" "),a("el-option",{attrs:{label:"2",value:"2"}})],1)],1),t._v(" "),a("el-form-item",{attrs:{label:"ldap user filed"}},[a("el-input",{staticClass:"form-el",attrs:{placeholder:"例如 cn 或者 sAMAccountName"},model:{value:t.form.ldap_form.user_field,callback:function(e){t.$set(t.form.ldap_form,"user_field",e)},expression:"form.ldap_form.user_field"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"search filter"}},[a("el-input",{staticClass:"form-el",attrs:{placeholder:"(cn=*)"},model:{value:t.form.ldap_form.search_filter,callback:function(e){t.$set(t.form.ldap_form,"search_filter",e)},expression:"form.ldap_form.search_filter"}})],1)],1),t._v(" "),a("br"),t._v(" "),a("el-form-item",[a("el-button",{attrs:{type:"primary"},on:{click:t.saveLdapConfig}},[t._v(t._s(t.$t("save")))]),t._v(" "),a("el-button",[t._v(t._s(t.$t("cancel")))])],1)],1)],1),t._v(" "),a("el-tab-pane",{attrs:{label:"OAuth2"}},[a("el-form",{ref:"form",attrs:{"label-width":"150px"}},[a("el-form-item",{attrs:{label:t.$t("enable_oauth")}},[a("el-switch",{model:{value:t.form.oauth2_open,callback:function(e){t.$set(t.form,"oauth2_open",e)},expression:"form.oauth2_open"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"callback url"}},[a("el-input",{staticClass:"form-el",model:{value:t.form.oauth2_form.redirectUri,callback:function(e){t.$set(t.form.oauth2_form,"redirectUri",e)},expression:"form.oauth2_form.redirectUri"}})],1),t._v(" "),a("el-form-item",{attrs:{label:t.$t("callback_eg")}},[t._v("\n http://"+t._s(t.$t("your_showdoc_server"))+"/server/?s=/api/extLogin/oauth2\n ")]),t._v(" "),a("div",[a("el-form-item",{attrs:{label:t.$t("入口文字提示")}},[a("el-input",{staticClass:"form-el",attrs:{placeholder:""},model:{value:t.form.oauth2_form.entrance_tips,callback:function(e){t.$set(t.form.oauth2_form,"entrance_tips",e)},expression:"form.oauth2_form.entrance_tips"}}),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("entrance_tips_content"),placement:"top"}},[a("i",{staticClass:"el-icon-question"})])],1),t._v(" "),a("el-form-item",{attrs:{label:"Client id"}},[a("el-input",{staticClass:"form-el",model:{value:t.form.oauth2_form.client_id,callback:function(e){t.$set(t.form.oauth2_form,"client_id",e)},expression:"form.oauth2_form.client_id"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"Client secret"}},[a("el-input",{staticClass:"form-el",model:{value:t.form.oauth2_form.client_secret,callback:function(e){t.$set(t.form.oauth2_form,"client_secret",e)},expression:"form.oauth2_form.client_secret"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"Oauth host"}},[a("el-select",{staticStyle:{width:"100px"},model:{value:t.form.oauth2_form.protocol,callback:function(e){t.$set(t.form.oauth2_form,"protocol",e)},expression:"form.oauth2_form.protocol"}},[a("el-option",{attrs:{label:"http://",value:"http"}}),t._v(" "),a("el-option",{attrs:{label:"https://",value:"https"}})],1),t._v(" "),a("el-input",{staticClass:"form-el",attrs:{placeholder:"eg: sso.your-site.com"},model:{value:t.form.oauth2_form.host,callback:function(e){t.$set(t.form.oauth2_form,"host",e)},expression:"form.oauth2_form.host"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"Authorize path"}},[a("el-input",{staticClass:"form-el",attrs:{placeholder:"eg: /oauth/v2/authorize"},model:{value:t.form.oauth2_form.authorize_path,callback:function(e){t.$set(t.form.oauth2_form,"authorize_path",e)},expression:"form.oauth2_form.authorize_path"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"AccessToken path"}},[a("el-input",{staticClass:"form-el",attrs:{placeholder:"eg: /oauth/v2/token"},model:{value:t.form.oauth2_form.token_path,callback:function(e){t.$set(t.form.oauth2_form,"token_path",e)},expression:"form.oauth2_form.token_path"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"Resource path"}},[a("el-input",{staticClass:"form-el",attrs:{placeholder:"eg: /oauth/v2/resource"},model:{value:t.form.oauth2_form.resource_path,callback:function(e){t.$set(t.form.oauth2_form,"resource_path",e)},expression:"form.oauth2_form.resource_path"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"User info path"}},[a("el-input",{staticClass:"form-el",attrs:{placeholder:"eg: /oauth/v2/me"},model:{value:t.form.oauth2_form.userinfo_path,callback:function(e){t.$set(t.form.oauth2_form,"userinfo_path",e)},expression:"form.oauth2_form.userinfo_path"}}),t._v(" "),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:t.$t("userinfo_path_content"),placement:"top"}},[a("i",{staticClass:"el-icon-question"})])],1)],1),t._v(" "),a("br"),t._v(" "),a("el-form-item",[a("el-button",{attrs:{type:"primary"},on:{click:t.saveOauth2Config}},[t._v(t._s(t.$t("save")))]),t._v(" "),a("el-button",[t._v(t._s(t.$t("cancel")))])],1)],1)],1),t._v(" "),"zh-cn"==t.lang?a("el-tab-pane",{attrs:{label:"通用接入"}},[a("div",{staticStyle:{"min-height":"600px","margin-top":"50px","margin-left":"30px"}},[a("p",[t._v("\n LoginSecretKey: \n "),a("el-input",{staticClass:"form-el",attrs:{readonly:""},model:{value:t.login_secret_key,callback:function(e){t.login_secret_key=e},expression:"login_secret_key"}}),t._v(" "),a("el-button",{on:{click:t.resetLoginSecretKey}},[t._v(t._s(t.$t("reset")))])],1),t._v(" "),a("p",[t._v("\n 通用接入提供的是一种自动登录showdoc的能力,需要自己根据文档开发集成。"),a("a",{attrs:{href:"https://www.showdoc.com.cn/p/0fb2753c5a48acc7c3fbbb00f9504e6b",target:"_blank"}},[t._v("点击这里查看文档")])])])]):t._e()],1)],1)},staticRenderFns:[]};var ua={data:function(){return{isUpdate:!1,cur_version:"",new_version:"",url:"",file_url:""}},methods:{getCurVersion:function(){var t=this;this.request("/api/common/version",{}).then(function(e){e&&e.data&&e.data.version&&(t.cur_version=e.data.version)})},checkUpadte:function(){var t=this;this.request("/api/adminUpdate/checkUpdate",{}).then(function(e){e&&e.data&&e.data.url&&(t.url=e.data.url,t.file_url=e.data.file_url,t.new_version=e.data.new_version,t.cur_version=e.data.version,t.isUpdate=!0)})},clickToUpdate:function(){var t=this,e=this.$loading({text:"正在下载更新包..."});this.request("/api/adminUpdate/download",{new_version:this.new_version,file_url:this.file_url}).then(function(a){e.close(),e=t.$loading({text:"正在更新文件..."}),t.request("/api/adminUpdate/updateFiles",{}).then(function(){e.close(),e=t.$loading({text:"升级文件成功,准备刷新页面...如果页面缓存迟迟不能自动更新,请手动刷新页面以更新浏览器缓存"}),t.request("/api/update/checkDb"),setTimeout(function(){window.location.reload()},7e3)},function(){e.close()})},function(){e.close()})}},mounted:function(){this.checkUpadte(),this.getCurVersion()},beforeDestroy:function(){}},fa={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{},[a("div",[a("br"),t._v(" "),a("p",[t._v("\n 本站基于开源版"),a("b",[t._v("showdoc "+t._s(t.cur_version))]),t._v("搭建\n ")]),t._v(" "),t._m(0),t._v(" "),t._m(1)]),t._v(" "),t.isUpdate?a("div",[a("hr"),t._v(" "),a("p",[t._v("\n 检测到showdoc有新版更新("+t._s(t.new_version)+"),点击下方按钮将自动升级到最新稳定版。"),a("a",{attrs:{href:"https://www.showdoc.com.cn/help/13733",target:"_blank"}},[t._v("更新日志")])]),t._v(" "),a("p",[t._v("\n 升级到最新版有助于及时得到官方的安全修复和功能更新,以获得更安全更稳定的使用体验。\n ")]),t._v(" "),a("el-badge",{attrs:{value:"new"}},[a("el-button",{attrs:{type:"primary"},on:{click:t.clickToUpdate}},[t._v("点此更新")])],1),t._v(" "),a("br"),t._v(" "),a("br"),t._v(" "),t._m(2)],1):t._e()])},staticRenderFns:[function(){var t=this.$createElement,e=this._self._c||t;return e("p",[this._v("\n 如有问题或者建议,请到github提issue:"),e("a",{attrs:{href:"https://github.com/star7th/showdoc/issues",target:"_blank"}},[this._v("https://github.com/star7th/showdoc/issues")]),this._v(" "),e("br"),this._v("如果你觉得showdoc好用,不妨去"),e("a",{attrs:{href:"https://github.com/star7th/showdoc",target:"_blank"}},[this._v("github")]),this._v("给开源项目点一个star。良好的关注度和参与度有助于开源项目的长远发展。\n ")])},function(){var t=this.$createElement,e=this._self._c||t;return e("p",[e("a",{attrs:{href:"https://www.showdoc.com.cn/",target:"_blank"}},[this._v("showdoc官方")]),this._v("\n 拥有程序的版权和相应权利,在保留版权信息和链接的前提下可免费使用或者二次开发\n ")])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",[this._v("\n 如点击上面按钮更新失败,"),e("a",{attrs:{href:"https://www.showdoc.com.cn/help?page_id=13732",target:"_blank"}},[this._v("点击这里")]),this._v("参考文档进行手动升级\n ")])}]};var ha={data:function(){return{open_menu_index:1,isUpdate:!1,lang:""}},components:{Item:a("VU/8")(oa,na,!1,function(t){a("U8fK")},"data-v-50c9c8d3",null).exports,User:a("VU/8")(sa,ra,!1,function(t){a("/Ph2")},"data-v-d83ffe18",null).exports,Setting:a("VU/8")(la,ca,!1,function(t){a("XiU4")},"data-v-2a2756f9",null).exports,Attachment:a("VU/8")(ma,da,!1,function(t){a("SwXf")},"data-v-cf86e436",null).exports,ExtLogin:a("VU/8")(_a,pa,!1,function(t){a("8YgU")},"data-v-ad47eeea",null).exports,About:a("VU/8")(ua,fa,!1,function(t){a("0mvO")},"data-v-e814a972",null).exports},methods:{select_menu:function(t,e){var a=this;this.open_menu_index=0,this.$nextTick(function(){a.open_menu_index=t})},checkUpadte:function(){var t=this;this.request("/api/adminUpdate/checkUpdate",{}).then(function(e){e&&e.data&&e.data.url&&(t.isUpdate=!0)})}},mounted:function(){this.lang=DocConfig.lang,this.checkUpadte(),this.unset_bg_grey()},beforeDestroy:function(){this.$message.closeAll(),this.set_bg_grey()}},ga={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("el-container",[a("el-header",[a("div",{staticClass:"header_title"},[t._v("ShowDoc")]),t._v(" "),a("router-link",{staticClass:"goback",attrs:{to:"/item/index"}},[t._v(t._s(t.$t("goback")))])],1),t._v(" "),a("el-container",[a("el-aside",{attrs:{width:"150px"}},[a("el-menu",{staticClass:"el-menu-vertical-demo",attrs:{"default-active":"1","background-color":"#545c64","text-color":"#fff","active-text-color":"#ffd04b"},on:{select:t.select_menu}},[a("el-menu-item",{attrs:{index:"1"}},[a("i",{staticClass:"el-icon-info"}),t._v(" "),a("span",{attrs:{slot:"title"},slot:"title"},[t._v(t._s(t.$t("user_manage")))])]),t._v(" "),a("el-menu-item",{attrs:{index:"2"}},[a("i",{staticClass:"el-icon-tickets"}),t._v(" "),a("span",{attrs:{slot:"title"},slot:"title"},[t._v(t._s(t.$t("item_manage")))])]),t._v(" "),a("el-menu-item",{attrs:{index:"5"}},[a("i",{staticClass:"el-icon-tickets"}),t._v(" "),a("span",{attrs:{slot:"title"},slot:"title"},[t._v(t._s(t.$t("attachment_manage")))])]),t._v(" "),a("el-menu-item",{attrs:{index:"7"}},[a("i",{staticClass:"el-icon-tickets"}),t._v(" "),a("span",{attrs:{slot:"title"},slot:"title"},[t._v(t._s(t.$t("ext_login")))])]),t._v(" "),a("el-menu-item",{attrs:{index:"3"}},[a("i",{staticClass:"el-icon-tickets"}),t._v(" "),a("span",{attrs:{slot:"title"},slot:"title"},[t._v(t._s(t.$t("web_setting")))])]),t._v(" "),a("el-menu-item",{directives:[{name:"show",rawName:"v-show",value:"zh-cn"==t.lang,expression:"lang == 'zh-cn'"}],attrs:{index:"6"}},[a("i",{staticClass:"el-icon-tickets"}),t._v(" "),a("span",{attrs:{slot:"title"},slot:"title"},[a("el-badge",{attrs:{value:t.isUpdate?"new":""}},[t._v(t._s(t.$t("about_site"))+"\n ")])],1)])],1)],1),t._v(" "),a("el-container",[a("el-main",[1==t.open_menu_index?a("User"):t._e(),t._v(" "),2==t.open_menu_index?a("Item"):t._e(),t._v(" "),3==t.open_menu_index?a("Setting"):t._e(),t._v(" "),5==t.open_menu_index?a("Attachment"):t._e(),t._v(" "),6==t.open_menu_index?a("About"):t._e(),t._v(" "),7==t.open_menu_index?a("ExtLogin"):t._e()],1),t._v(" "),a("el-footer")],1)],1)],1)],1)},staticRenderFns:[]};var va=a("VU/8")(ha,ga,!1,function(t){a("Uu/S")},"data-v-7d74d9c0",null).exports,ba={components:{},data:function(){return{MyForm:{id:"",team_name:""},list:[],dialogFormVisible:!1,dialogMemberVisible:!1,dialogAttornVisible:!1,attornForm:{team_id:"",username:"",password:""}}},methods:{geList:function(){var t=this,e=DocConfig.server+"/api/team/getList",a=new URLSearchParams;t.axios.post(e,a).then(function(e){if(0===e.data.error_code){var a=e.data.data;t.list=a}else t.$alert(e.data.error_message)})},MyFormSubmit:function(){var t=this,e=DocConfig.server+"/api/team/save",a=new URLSearchParams;a.append("id",this.MyForm.id),a.append("team_name",this.MyForm.team_name),t.axios.post(e,a).then(function(e){0===e.data.error_code?(t.dialogFormVisible=!1,t.geList(),t.MyForm={id:"",team_name:""}):t.$alert(e.data.error_message)})},edit:function(t){this.MyForm.id=t.id,this.MyForm.team_name=t.team_name,this.dialogFormVisible=!0},deleteTeam:function(t){var e=this,a=DocConfig.server+"/api/team/delete";this.$confirm(e.$t("confirm_delete")," ",{confirmButtonText:e.$t("confirm"),cancelButtonText:e.$t("cancel"),type:"warning"}).then(function(){var i=new URLSearchParams;i.append("id",t),e.axios.post(a,i).then(function(t){0===t.data.error_code?e.geList():e.$alert(t.data.error_message)})})},addTeam:function(){this.MyForm={id:"",team_name:""},this.dialogFormVisible=!0},goback:function(){this.$router.push({path:"/item/index"})},attornDialog:function(t){this.attornForm.team_id=t.id,this.dialogAttornVisible=!0},attorn:function(){var t=this,e=DocConfig.server+"/api/team/attorn",a=new URLSearchParams;a.append("team_id",this.attornForm.team_id),a.append("username",this.attornForm.username),a.append("password",this.attornForm.password),t.axios.post(e,a).then(function(e){0===e.data.error_code?(t.dialogAttornVisible=!1,t.geList()):t.$alert(e.data.error_message)})}},mounted:function(){this.geList()},beforeDestroy:function(){}},wa={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",[a("el-card",{staticClass:"center-card"},[a("el-button",{staticClass:"goback-btn",attrs:{type:"text"},on:{click:t.goback}},[a("i",{staticClass:"el-icon-back"}),t._v(" "+t._s(t.$t("goback")))]),t._v(" "),a("el-button",{staticClass:"add-cat",attrs:{type:"text"},on:{click:t.addTeam}},[a("i",{staticClass:"el-icon-plus"}),t._v(" "+t._s(t.$t("add_team")))]),t._v(" "),a("el-table",{staticStyle:{width:"100%"},attrs:{align:"left","empty-text":t.$t("empty_team_tips"),data:t.list,height:"400"}},[a("el-table-column",{attrs:{prop:"team_name",label:t.$t("team_name")}}),t._v(" "),a("el-table-column",{attrs:{prop:"memberCount",width:"100",label:t.$t("memberCount")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("router-link",{attrs:{to:"/team/member/"+e.row.id}},[t._v(t._s(e.row.memberCount))])]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"itemCount",width:"100",label:t.$t("itemCount")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("router-link",{attrs:{to:"/team/item/"+e.row.id}},[t._v(t._s(e.row.itemCount))])]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"",label:t.$t("operation")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.$router.push({path:"/team/member/"+e.row.id})}}},[t._v(t._s(t.$t("member")))]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.$router.push({path:"/team/item/"+e.row.id})}}},[t._v(t._s(t.$t("team_item")))]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.edit(e.row)}}},[t._v(t._s(t.$t("edit")))]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.attornDialog(e.row)}}},[t._v(t._s(t.$t("attorn")))]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.deleteTeam(e.row.id)}}},[t._v(t._s(t.$t("delete")))])]}}])})],1)],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogFormVisible,width:"300px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[a("el-form",[a("el-form-item",{attrs:{label:t.$t("team_name")+":"}},[a("el-input",{model:{value:t.MyForm.team_name,callback:function(e){t.$set(t.MyForm,"team_name",e)},expression:"MyForm.team_name"}})],1)],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogFormVisible=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.MyFormSubmit}},[t._v(t._s(t.$t("confirm")))])],1)],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogAttornVisible,modal:!1,width:"300px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogAttornVisible=e}}},[a("el-form",[a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{placeholder:t.$t("attorn_username"),"auto-complete":"new-password"},model:{value:t.attornForm.username,callback:function(e){t.$set(t.attornForm,"username",e)},expression:"attornForm.username"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{type:"password","auto-complete":"new-password",placeholder:t.$t("input_login_password")},model:{value:t.attornForm.password,callback:function(e){t.$set(t.attornForm,"password",e)},expression:"attornForm.password"}})],1)],1),t._v(" "),a("p",{staticClass:"tips"},[a("small",[t._v(t._s(t.$t("attornTeamTips")))])]),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogAttornVisible=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.attorn}},[t._v(t._s(t.$t("attorn")))])],1)],1)],1),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var ya=a("VU/8")(ba,wa,!1,function(t){a("zJzz"),a("yAY5")},"data-v-1b6b9a88",null).exports,ka={components:{},data:function(){return{MyForm:{},list:[],dialogFormVisible:!1,team_id:"",memberOptions:[]}},methods:{geList:function(){var t=this,e=DocConfig.server+"/api/teamMember/getList",a=new URLSearchParams;a.append("team_id",this.team_id),t.axios.post(e,a).then(function(e){if(0===e.data.error_code){var a=e.data.data;t.list=a,t.getAllUser()}else t.$alert(e.data.error_message)})},reSetMyForm:function(){this.MyForm={id:"",member_username:"",team_member_group_id:"1"}},MyFormSubmit:function(){var t=this,e=DocConfig.server+"/api/teamMember/save",a=new URLSearchParams;a.append("team_id",this.team_id),a.append("member_username",this.MyForm.member_username),a.append("team_member_group_id",this.MyForm.team_member_group_id),t.axios.post(e,a).then(function(e){0===e.data.error_code?(t.dialogFormVisible=!1,t.geList(),t.reSetMyForm()):t.$alert(e.data.error_message)})},deleteTeamMember:function(t){var e=this,a=DocConfig.server+"/api/teamMember/delete";this.$confirm(e.$t("confirm_delete")," ",{confirmButtonText:e.$t("confirm"),cancelButtonText:e.$t("cancel"),type:"warning"}).then(function(){var i=new URLSearchParams;i.append("id",t),e.axios.post(a,i).then(function(t){0===t.data.error_code?e.geList():e.$alert(t.data.error_message)})})},addTeamMember:function(){this.reSetMyForm(),this.dialogFormVisible=!0},goback:function(){this.$router.push({path:"/team/index"})},getAllUser:function(){var t=this,e=DocConfig.server+"/api/user/allUser",a=new URLSearchParams;a.append("username",""),t.axios.post(e,a).then(function(e){if(0===e.data.error_code){for(var a=e.data.data,i=[],o=0;o<a.length;o++){t.isMember(a[o].value)||i.push(a[o])}t.memberOptions=[];for(var n=0;n<i.length;n++)t.memberOptions.push({value:i[n].username,label:i[n].name?i[n].username+"("+i[n].name+")":i[n].username,key:i[n].username})}else t.$alert(e.data.error_message)})},isMember:function(t){for(var e=this.list,a=0;a<e.length;a++)if(e[a].member_username==t)return!0;return!1}},mounted:function(){this.team_id=this.$route.params.team_id,this.geList(),this.getAllUser(),this.reSetMyForm()}},$a={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",[a("el-card",{staticClass:"center-card"},[a("el-button",{staticClass:"goback-btn",attrs:{type:"text"},on:{click:t.goback}},[a("i",{staticClass:"el-icon-back"}),t._v(" "+t._s(t.$t("goback")))]),t._v(" "),a("el-button",{staticClass:"add-cat",attrs:{type:"text"},on:{click:t.addTeamMember}},[a("i",{staticClass:"el-icon-plus"}),t._v(" "+t._s(t.$t("add_member")))]),t._v(" "),a("el-table",{staticStyle:{width:"100%"},attrs:{align:"left",data:t.list,height:"400"}},[a("el-table-column",{attrs:{prop:"member_username",label:t.$t("member_username")}}),t._v(" "),a("el-table-column",{attrs:{prop:"team_member_group_id",label:t.$t("member_authority")},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v("\n "+t._s(2==e.row.team_member_group_id?t.$t("team_admin"):t.$t("ordinary_member"))+"\n ")]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"name",label:t.$t("name")}}),t._v(" "),a("el-table-column",{attrs:{prop:"addtime",width:"160",label:t.$t("addtime")}}),t._v(" "),a("el-table-column",{attrs:{prop:"",label:t.$t("operation")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.deleteTeamMember(e.row.id)}}},[t._v(t._s(t.$t("delete")))])]}}])})],1)],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogFormVisible,width:"300px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[a("el-form",[a("el-form-item",{attrs:{label:t.$t("member_username")+":"}},[a("el-select",{attrs:{multiple:"",filterable:"","reserve-keyword":"",placeholder:"",loading:t.loading},model:{value:t.MyForm.member_username,callback:function(e){t.$set(t.MyForm,"member_username",e)},expression:"MyForm.member_username"}},t._l(t.memberOptions,function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}),1)],1),t._v(" "),a("el-form-item",[a("el-radio",{attrs:{label:"1"},model:{value:t.MyForm.team_member_group_id,callback:function(e){t.$set(t.MyForm,"team_member_group_id",e)},expression:"MyForm.team_member_group_id"}},[t._v(t._s(t.$t("ordinary_member")))]),t._v(" "),a("el-radio",{attrs:{label:"2"},model:{value:t.MyForm.team_member_group_id,callback:function(e){t.$set(t.MyForm,"team_member_group_id",e)},expression:"MyForm.team_member_group_id"}},[t._v(t._s(t.$t("team_admin")))])],1)],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogFormVisible=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.MyFormSubmit}},[t._v(t._s(t.$t("confirm")))])],1)],1)],1),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var xa=a("VU/8")(ka,$a,!1,function(t){a("cR38"),a("ZILu")},"data-v-3d78fe1e",null).exports,Ca={components:{},data:function(){return{MyForm:{item_id:""},list:[],dialogFormVisible:!1,team_id:"",itemList:[],teamItemMembers:[],dialogFormTeamMemberVisible:!1,authorityOptions:[{label:this.$t("edit_member"),value:"1"},{label:this.$t("readonly_member"),value:"0"},{label:this.$t("item_admin"),value:"2"}],catalogs:[]}},methods:{geList:function(){var t=this,e=DocConfig.server+"/api/teamItem/getListByTeam",a=new URLSearchParams;a.append("team_id",this.team_id),t.axios.post(e,a).then(function(e){if(0===e.data.error_code){var a=e.data.data;t.list=a}else t.$alert(e.data.error_message)})},getItemList:function(){var t=this;this.request("/api/item/myList",{original:1}).then(function(e){t.itemList=e.data})},MyFormSubmit:function(){var t=this,e=DocConfig.server+"/api/teamItem/save",a=new URLSearchParams;a.append("team_id",this.team_id),a.append("item_id",this.MyForm.item_id),t.axios.post(e,a).then(function(e){0===e.data.error_code?(t.dialogFormVisible=!1,t.geList(),t.MyForm={}):t.$alert(e.data.error_message)})},deleteTeamItem:function(t){var e=this,a=DocConfig.server+"/api/teamItem/delete";this.$confirm(e.$t("confirm_unassign")," ",{confirmButtonText:e.$t("confirm"),cancelButtonText:e.$t("cancel"),type:"warning"}).then(function(){var i=new URLSearchParams;i.append("id",t),e.axios.post(a,i).then(function(t){0===t.data.error_code?e.geList():e.$alert(t.data.error_message)})})},addTeamItem:function(){this.MyForm=[],this.dialogFormVisible=!0},goback:function(){this.$router.push({path:"/team/index"})},getTeamItemMember:function(t){var e=this;this.dialogFormTeamMemberVisible=!0,this.get_catalog(t);var a=DocConfig.server+"/api/teamItemMember/getList",i=new URLSearchParams;i.append("item_id",t),i.append("team_id",this.team_id),e.axios.post(a,i).then(function(t){if(0===t.data.error_code){var a=t.data.data;e.teamItemMembers=a}else e.$alert(t.data.error_message)})},changeTeamItemMemberGroup:function(t,e){var a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=this,o=DocConfig.server+"/api/teamItemMember/save",n=new URLSearchParams;n.append("member_group_id",t),n.append("id",e),i.axios.post(o,n).then(function(t){0===t.data.error_code?a&&i.$message(i.$t("auth_success")):i.$alert(t.data.error_message)})},changeTeamItemMemberCat:function(t,e){var a=this,i=DocConfig.server+"/api/teamItemMember/save",o=new URLSearchParams;o.append("cat_id",t),o.append("id",e),a.axios.post(i,o).then(function(t){0===t.data.error_code?a.$message(a.$t("cat_success")):a.$alert(t.data.error_message)})},get_catalog:function(t){var e=this,a=DocConfig.server+"/api/catalog/catListGroup",i=new URLSearchParams;i.append("item_id",t),e.axios.post(a,i).then(function(t){if(0===t.data.error_code){var a=t.data.data;a.unshift({cat_id:"0",cat_name:e.$t("all_cat")}),e.catalogs=a}else e.$alert(t.data.error_message)})},setAllMemberRead:function(){var t=this;this.teamItemMembers.forEach(function(e){t.changeTeamItemMemberGroup(0,e.id,!1),setTimeout(function(){t.getTeamItemMember(e.item_id)},500)})}},mounted:function(){this.team_id=this.$route.params.team_id,this.geList(),this.getItemList()}},Fa={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",[a("el-card",{staticClass:"center-card"},[a("el-button",{staticClass:"goback-btn",attrs:{type:"text"},on:{click:t.goback}},[a("i",{staticClass:"el-icon-back"}),t._v(" "+t._s(t.$t("goback")))]),t._v(" "),a("el-button",{staticClass:"add-cat",attrs:{type:"text"},on:{click:t.addTeamItem}},[a("i",{staticClass:"el-icon-plus"}),t._v(" "+t._s(t.$t("binding_item")))]),t._v(" "),a("el-table",{staticStyle:{width:"100%"},attrs:{align:"left",data:t.list,height:"400"}},[a("el-table-column",{attrs:{prop:"item_name",label:t.$t("item_name")}}),t._v(" "),a("el-table-column",{attrs:{prop:"addtime",label:t.$t("Join_time")}}),t._v(" "),a("el-table-column",{attrs:{prop:"",width:"210",label:t.$t("operation")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("router-link",{attrs:{to:"/"+e.row.item_id,target:"_blank"}},[t._v(t._s(t.$t("check_item")))]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.getTeamItemMember(e.row.item_id)}}},[t._v(t._s(t.$t("member_authority")))]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.deleteTeamItem(e.row.id)}}},[t._v(t._s(t.$t("unassign")))])]}}])})],1)],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogFormVisible,width:"300px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[a("el-form",[a("el-select",{attrs:{multiple:"",placeholder:t.$t("please_choose")},model:{value:t.MyForm.item_id,callback:function(e){t.$set(t.MyForm,"item_id",e)},expression:"MyForm.item_id"}},t._l(t.itemList,function(t){return a("el-option",{key:t.item_id,attrs:{label:t.item_name,value:t.item_id}})}),1)],1),t._v(" "),a("br"),t._v(" "),a("router-link",{attrs:{to:"/item/index",target:"_blank"}},[t._v(t._s(t.$t("go_to_new_an_item")))]),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogFormVisible=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.MyFormSubmit}},[t._v(t._s(t.$t("confirm")))])],1)],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogFormTeamMemberVisible,top:"10vh",title:t.$t("adjust_member_authority"),"close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogFormTeamMemberVisible=e}}},[a("p",[a("el-button",{attrs:{type:"text"},on:{click:t.setAllMemberRead}},[t._v(" "+t._s(t.$t("all_member_read")))])],1),t._v(" "),a("el-table",{staticStyle:{width:"100%"},attrs:{align:"left","empty-text":t.$t("team_member_empty_tips"),data:t.teamItemMembers}},[a("el-table-column",{attrs:{prop:"member_username",label:t.$t("username")}}),t._v(" "),a("el-table-column",{attrs:{prop:"member_group_id",label:t.$t("authority"),width:"120"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-select",{attrs:{size:"mini",placeholder:t.$t("please_choose")},on:{change:function(a){return t.changeTeamItemMemberGroup(a,e.row.id)}},model:{value:e.row.member_group_id,callback:function(a){t.$set(e.row,"member_group_id",a)},expression:"scope.row.member_group_id"}},t._l(t.authorityOptions,function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}),1)]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"cat_id",label:t.$t("catalog"),width:"130"},scopedSlots:t._u([{key:"default",fn:function(e){return[e.row.member_group_id<=1?a("el-select",{attrs:{size:"mini",placeholder:t.$t("please_choose")},on:{change:function(a){return t.changeTeamItemMemberCat(a,e.row.id)}},model:{value:e.row.cat_id,callback:function(a){t.$set(e.row,"cat_id",a)},expression:"scope.row.cat_id"}},t._l(t.catalogs,function(t){return a("el-option",{key:t.cat_id,attrs:{label:t.cat_name,value:t.cat_id}})}),1):t._e()]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"addtime",label:t.$t("add_time")}})],1),t._v(" "),a("br"),t._v(" "),a("p",{staticClass:"tips"},[t._v(t._s(t.$t("team_member_authority_tips")))]),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogFormTeamMemberVisible=!1}}},[t._v(t._s(t.$t("close")))])],1)],1)],1),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var Sa=a("VU/8")(Ca,Fa,!1,function(t){a("qZaU"),a("zB9H")},"data-v-6407d6d1",null).exports,La={name:"",components:{},data:function(){return{page:1,count:6,display_name:"",username:"",dataList:[],total:0,positive_type:"1",attachment_type:"-1",used:0,used_flow:0,uploadUrl:DocConfig.server+"/api/page/upload",dialogFormVisible:!1,loading:""}},methods:{getList:function(){var t=this;this.request("/api/attachment/getMyList",{page:this.page,count:this.count,attachment_type:this.attachment_type,display_name:this.display_name,username:this.username}).then(function(e){var a=e.data;t.dataList=a.list,t.total=parseInt(a.total),t.used=a.used_m,t.used_flow=a.used_flow_m})},jump_to_item:function(t){var e="/"+t.item_id;window.open(e)},handleCurrentChange:function(t){this.page=t,this.getList()},onSubmit:function(){this.page=1,this.getList()},visit:function(t){window.open(t.url)},delete_row:function(t){var e=this;this.$confirm(this.$t("confirm_delete")," ",{confirmButtonText:this.$t("confirm"),cancelButtonText:this.$t("cancel"),type:"warning"}).then(function(){e.request("/api/attachment/deleteMyAttachment",{file_id:t.file_id}).then(function(t){e.$message.success(e.$t("op_success")),e.getList()})})},goback:function(){this.$router.push({path:"/item/index"})},uploadCallback:function(t){this.loading.close(),t.error_message&&this.$alert(t.error_message),this.dialogFormVisible=!1,this.getList()},copy:function(t){var e=this;this.$copyText(t.url).then(function(t){e.$message.success(e.$t("copy_success"))})},beforeUpload:function(){this.loading=this.$loading()}},mounted:function(){this.getList()},beforeDestroy:function(){}},Ia={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",[a("el-card",{staticClass:"hor-center-card"},[a("el-button",{staticClass:"goback-btn",attrs:{type:"text"},on:{click:t.goback}},[a("i",{staticClass:"el-icon-back"})]),t._v(" "),a("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0}},[a("el-form-item",{attrs:{label:""}},[a("el-input",{attrs:{placeholder:t.$t("display_name")},model:{value:t.display_name,callback:function(e){t.display_name=e},expression:"display_name"}})],1),t._v(" "),a("el-form-item",{attrs:{label:""}},[a("el-select",{attrs:{placeholder:""},model:{value:t.attachment_type,callback:function(e){t.attachment_type=e},expression:"attachment_type"}},[a("el-option",{attrs:{label:t.$t("all_attachment_type"),value:"-1"}}),t._v(" "),a("el-option",{attrs:{label:t.$t("image"),value:"1"}}),t._v(" "),a("el-option",{attrs:{label:t.$t("general_attachment"),value:"2"}})],1)],1),t._v(" "),a("el-form-item",[a("el-button",{on:{click:t.onSubmit}},[t._v(t._s(t.$t("search")))])],1),t._v(" "),a("el-form-item",[a("el-button",{on:{click:function(e){t.dialogFormVisible=!0}}},[t._v(t._s(t.$t("upload")))])],1)],1),t._v(" "),a("P",[t._v(t._s(t.$t("accumulated_used_sapce"))+" "+t._s(t.used)+"M ,\n "+t._s(t.$t("month_flow"))+" "+t._s(t.used_flow)+"M")]),t._v(" "),a("el-table",{staticStyle:{width:"100%"},attrs:{data:t.dataList}},[a("el-table-column",{attrs:{prop:"file_id",label:t.$t("file_id")}}),t._v(" "),a("el-table-column",{attrs:{prop:"display_name",label:t.$t("display_name")}}),t._v(" "),a("el-table-column",{attrs:{prop:"file_type",label:t.$t("file_type"),width:"140"}}),t._v(" "),a("el-table-column",{attrs:{prop:"file_size_m",label:t.$t("file_size_m"),width:"80"}}),t._v(" "),a("el-table-column",{attrs:{prop:"visit_times",label:t.$t("visit_times")}}),t._v(" "),a("el-table-column",{attrs:{prop:"addtime",label:t.$t("add_time"),width:"100"}}),t._v(" "),a("el-table-column",{attrs:{prop:"",label:t.$t("operation")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.visit(e.row)}}},[t._v(t._s(t.$t("visit")))]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.copy(e.row)}}},[t._v(t._s(t.$t("copy_link")))]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.delete_row(e.row)}}},[t._v(t._s(t.$t("delete")))])]}}])})],1),t._v(" "),a("div",{staticClass:"block"},[a("span",{staticClass:"demonstration"}),t._v(" "),a("el-pagination",{attrs:{"page-size":t.count,layout:"total, prev, pager, next",total:t.total},on:{"current-change":t.handleCurrentChange}})],1)],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogFormVisible,"close-on-click-modal":!1,width:"400px"},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[a("p",[a("el-upload",{attrs:{drag:"",name:"file",action:t.uploadUrl,"before-upload":t.beforeUpload,"on-success":t.uploadCallback,"show-file-list":!1}},[a("i",{staticClass:"el-icon-upload"}),t._v(" "),a("div",{staticClass:"el-upload__text"},[a("span",{domProps:{innerHTML:t._s(t.$t("import_file_tips2"))}})])])],1)])],1),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var Ta=a("VU/8")(La,Ia,!1,function(t){a("RQJA")},"data-v-5774a5e3",null).exports,Va=a("/dO2"),Pa={name:"ElementUiElTableDraggable",props:{handle:{type:String,default:""},animate:{type:Number,default:100}},data:function(){return{tableKey:0}},methods:{makeTableSortAble:function(){var t=this,e=this.$children[0].$el.querySelector(".el-table__body-wrapper tbody");Va.default.create(e,{handle:this.handle,animation:this.animate,onStart:function(){t.$emit("drag")},onEnd:function(e){var a=e.newIndex,i=e.oldIndex;t.keepWrapperHeight(!0),t.tableKey=Math.random();var o=t.$children[0].data,n=o.splice(i,1)[0];o.splice(a,0,n),t.$emit("drop",{targetObject:n,list:o})}})},keepWrapperHeight:function(t){var e=this.$refs.wrapper;e.style.minHeight=t?e.clientHeight+"px":"auto"}},mounted:function(){this.makeTableSortAble()},watch:{tableKey:function(){var t=this;this.$nextTick(function(){t.makeTableSortAble(),t.keepWrapperHeight(!1)})}}},Ma={render:function(){var t=this.$createElement,e=this._self._c||t;return e("div",{ref:"wrapper"},[e("div",{key:this.tableKey},[this._t("default")],2)])},staticRenderFns:[]},Ua={components:{ElTableDraggable:a("VU/8")(Pa,Ma,!1,null,null,null).exports},data:function(){return{MyForm:{id:"",group_name:""},list:[],dialogFormVisible:!1,itemList:[],multipleSelection:[]}},methods:{geList:function(){var t=this;this.request("/api/itemGroup/getList",{}).then(function(e){t.list=e.data})},MyFormSubmit:function(){var t=this,e=this.MyForm.group_name?this.MyForm.group_name:"default",a=this.MyForm.id,i=[];this.multipleSelection.map(function(t){i.push(t.item_id)});var o=i.join(",");this.request("/api/itemGroup/save",{group_name:e,id:a,item_ids:o}).then(function(e){t.geList(),t.dialogFormVisible=!1,t.multipleSelection=[],t.$nextTick(function(){t.toggleSelection(t.multipleSelection)}),t.MyForm.id="",t.MyForm.group_name=""})},edit:function(t){var e=this;this.MyForm.id=t.id,this.MyForm.group_name=t.group_name,this.multipleSelection=[],t.item_ids.split(",").map(function(t){e.itemList.map(function(a){t==a.item_id&&e.multipleSelection.push(a)})}),this.dialogFormVisible=!0,this.$nextTick(function(){e.toggleSelection(e.multipleSelection)})},del:function(t){var e=this;this.$confirm(this.$t("confirm_delete")," ",{confirmButtonText:this.$t("confirm"),cancelButtonText:this.$t("cancel"),type:"warning"}).then(function(){e.request("/api/itemGroup/delete",{id:t}).then(function(t){e.geList()})})},addDialog:function(){this.MyForm={id:"",group_name:""},this.dialogFormVisible=!0},goback:function(){this.$router.push({path:"/item/index"})},get_item_list:function(){var t=this;this.request("/api/item/myList",{}).then(function(e){t.itemList=e.data})},handleSelectionChange:function(t){this.multipleSelection=t},toggleSelection:function(t){var e=this;t?t.forEach(function(t){e.$refs.multipleTable.toggleRowSelection(t)}):this.$refs.multipleTable.clearSelection()},onDropEnd:function(){var t=this,e=[];this.list.map(function(t,a){e.push({id:t.id,s_number:a+1})}),this.request("/api/itemGroup/saveSort",{groups:p()(e)}).then(function(e){t.itemList=e.data})}},mounted:function(){this.geList(),this.get_item_list()},beforeDestroy:function(){}},Da={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",[a("el-card",{staticClass:"center-card"},[a("el-button",{staticClass:"goback-btn",attrs:{type:"text"},on:{click:t.goback}},[a("i",{staticClass:"el-icon-back"}),t._v(" "+t._s(t.$t("goback")))]),t._v(" "),a("el-button",{staticClass:"add-cat",attrs:{type:"text"},on:{click:t.addDialog}},[a("i",{staticClass:"el-icon-plus"}),t._v(" "+t._s(t.$t("add_group")))]),t._v(" "),a("p",{directives:[{name:"show",rawName:"v-show",value:t.list&&t.list.length>1,expression:"list && list.length > 1"}],staticClass:"tips"},[t._v("\n "+t._s(t.$t("draggable_tips"))+"\n ")]),t._v(" "),a("el-table-draggable",{attrs:{animate:"200"},on:{drop:t.onDropEnd}},[a("el-table",{staticStyle:{width:"100%"},attrs:{"show-header":!1,align:"left","empty-text":t.$t("item_group_empty_tips"),data:t.list,height:"400"}},[a("el-table-column",{attrs:{prop:"group_name",label:t.$t("group_name")}}),t._v(" "),a("el-table-column",{attrs:{width:"120",prop:"",label:t.$t("operation")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.edit(e.row)}}},[t._v(t._s(t.$t("edit")))]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.del(e.row.id)}}},[t._v(t._s(t.$t("delete")))])]}}])})],1)],1)],1),t._v(" "),t.dialogFormVisible?a("el-dialog",{attrs:{visible:t.dialogFormVisible,width:"500px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[a("el-form",[a("el-form-item",[a("el-input",{attrs:{placeholder:"组名"},model:{value:t.MyForm.group_name,callback:function(e){t.$set(t.MyForm,"group_name",e)},expression:"MyForm.group_name"}})],1)],1),t._v(" "),a("div",[a("p",[t._v(t._s(t.$t("select_item")))]),t._v(" "),a("el-table",{ref:"multipleTable",staticStyle:{width:"100%"},attrs:{"show-header":!1,data:t.itemList,"tooltip-effect":"dark"},on:{"selection-change":t.handleSelectionChange}},[a("el-table-column",{attrs:{type:"selection",width:"55"}}),t._v(" "),a("el-table-column",{attrs:{prop:"item_name",label:t.$t("item_name")}})],1)],1),t._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogFormVisible=!1}}},[t._v(t._s(t.$t("cancel")))]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.MyFormSubmit}},[t._v(t._s(t.$t("confirm")))])],1)],1):t._e()],1),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var ja=a("VU/8")(Ua,Da,!1,function(t){a("rD7s"),a("DIaJ")},"data-v-560f761e",null).exports,Ra={name:"",components:{},data:function(){return{page:1,count:8,total:0,announcementList:[],remindList:[],dtab:"remindList"}},methods:{getAnnouncementList:function(){var t=this;this.request("/api/message/getAnnouncementList",{}).then(function(e){var a=e.data;t.announcementList=a,a.map(function(e){t.setRead(e.from_uid,e.message_content_id)})})},getRemindList:function(){var t=this;this.request("/api/message/getRemindList",{page:this.page,count:this.count}).then(function(e){var a=e.data.list;t.total=e.data.total,t.remindList=[],a.map(function(e){t.remindList.push(e),t.setRead(e.from_uid,e.message_content_id)})})},setRead:function(t,e){e&&this.request("/api/message/setRead",{message_content_id:e,from_uid:t}).then(function(t){})},goback:function(){this.$router.push({path:"/item/index"})},visit:function(t){window.open(t)},tabClick:function(t){t.name},visitPage:function(t,e){var a=this.$router.resolve({path:"/"+t+"/"+e});window.open(a.href,"_blank")},handleCurrentChange:function(t){this.page=t,this.getRemindList()}},mounted:function(){this.getRemindList(),this.$route.query.dtab&&(this.dtab=this.$route.query.dtab)},beforeDestroy:function(){}},qa={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello"},[a("Header"),t._v(" "),a("el-container",[a("el-card",{staticClass:"hor-center-card"},[a("el-button",{staticClass:"goback-btn",attrs:{type:"text"},on:{click:t.goback}},[a("i",{staticClass:"el-icon-back"})]),t._v(" "),a("el-tabs",{attrs:{type:"card"},on:{"tab-click":t.tabClick},model:{value:t.dtab,callback:function(e){t.dtab=e},expression:"dtab"}},[a("el-tab-pane",{attrs:{label:t.$t("system_reminder"),name:"remindList"}},[a("el-table",{attrs:{data:t.remindList}},[a("el-table-column",{attrs:{prop:"addtime",label:t.$t("send_time")}}),t._v(" "),a("el-table-column",{attrs:{prop:"message_content",label:t.$t("content")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",["create"!=e.row.action_type&&"update"!=e.row.action_type||"page"!=e.row.object_type?t._e():a("div",[a("div",[t._v("\n "+t._s(e.row.from_name)+" "+t._s(t.$t("update_the_page"))+"\n "),a("el-button",{attrs:{type:"text"},on:{click:function(a){return t.visitPage(e.row.page_data.item_id,e.row.page_data.page_id)}}},[t._v(t._s(e.row.page_data.page_title))]),t._v(" "),0==e.row.status?a("el-badge",{staticClass:"mark",attrs:{value:"new"}}):t._e()],1),t._v(" "),e.row.message_content?a("div",[t._v("\n "+t._s(t.$t("update_remark"))+":\n "),a("span",[t._v(t._s(e.row.message_content))])]):t._e()])])]}}])})],1),t._v(" "),a("div",{staticClass:"block"},[a("span",{staticClass:"demonstration"}),t._v(" "),a("el-pagination",{attrs:{"page-size":t.count,layout:"total, prev, pager, next",total:t.total},on:{"current-change":t.handleCurrentChange}})],1)],1)],1)],1)],1),t._v(" "),a("Footer")],1)},staticRenderFns:[]};var Ea=a("VU/8")(Ra,qa,!1,function(t){a("gdxq")},"data-v-2b1a47c2",null).exports;n.default.use(l.a);var Aa=new l.a({routes:[{path:"/",name:"Index",component:d},{path:"/user/login",name:"UserLogin",component:h},{path:"/user/setting",name:"UserSetting",component:b},{path:"/user/register",name:"UserRegister",component:k},{path:"/user/resetPassword",name:"UserResetPassword",component:F},{path:"/user/ResetPasswordByUrl",name:"ResetPasswordByUrl",component:I},{path:"/item/index",name:"ItemIndex",component:q},{path:"/item/add",name:"ItemAdd",component:W},{path:"/item/password/:item_id",name:"ItemPassword",component:X},{path:"/item/export/:item_id",name:"ItemExport",component:oe},{path:"/item/setting/:item_id",name:"ItemSetting",component:ge},{path:"/page/:page_id",name:"PageIndex",component:we},{path:"/p/:unique_key",name:"PageIndex",component:we},{path:"/page/edit/:item_id/:page_id",name:"PageEdit",component:Ge},{path:"/page/diff/:page_id/:page_history_id",name:"PageDiff",component:Ye},{path:"/catalog/:item_id",name:"Catalog",component:ta},{path:"/notice/index",name:"Notice",component:ia},{path:"/admin/index",name:"Admin",component:va},{path:"/team/index",name:"Team",component:ya},{path:"/team/member/:team_id",name:"TeamMember",component:xa},{path:"/team/item/:team_id",name:"TeamItem",component:Sa},{path:"/attachment/index",name:"Attachment",component:Ta},{path:"/item/group/index",name:"ItemGroup",component:ja},{path:"/message/index",name:"Message",component:Ea},{path:"/:item_id",name:"ItemShow",component:ee},{path:"/:item_id/:page_id(\\d+)",name:"ItemShow",component:ee}]}),Oa=a("zL8q"),za=a.n(Oa),Ba=(a("tvR6"),{render:function(){var t=this.$createElement;return(this._self._c||t)("div")},staticRenderFns:[]});var Ha=a("VU/8")({name:"Header",data:function(){return{msg:"头部"}}},Ba,!1,function(t){a("8gQg")},"data-v-168051ae",null).exports,Na={render:function(){var t=this.$createElement;return(this._self._c||t)("div")},staticRenderFns:[]};var Ga=a("VU/8")({name:"Footer",data:function(){return{msg:"尾部"}}},Na,!1,function(t){a("GFba")},"data-v-065ddbfc",null).exports,Ja={install:function(t,e){t.prototype.getData=function(){console.log("我是插件中的方法")},t.prototype.request=function(){},t.prototype.getRootPath=function(){return window.location.protocol+"//"+window.location.host+window.location.pathname},t.prototype.isMobile=function(){return!!navigator.userAgent.match(/iPhone|iPad|iPod|Android|android|BlackBerry|IEMobile/i)},t.prototype.get_user_info=function(t){var e=DocConfig.server+"/api/user/info",a=new URLSearchParams;a.append("redirect_login",!1),this.axios.post(e,a).then(function(e){t&&t(e)})},t.prototype.get_notice=function(t){var e=DocConfig.server+"/api/notice/getList",a=new URLSearchParams;a.append("notice_type","unread"),a.append("count","1"),this.axios.post(e,a).then(function(e){t&&t(e)})},t.prototype.set_bg_grey=function(){document.getElementsByTagName("body")[0].className="grey-bg"},t.prototype.unset_bg_grey=function(){document.body.removeAttribute("class","grey-bg")},t.prototype.formatJson=function(t){if(!1===(arguments.length>1&&void 0!==arguments[1]&&arguments[1]))try{return"string"==typeof t&&(t=JSON.parse(t)),p()(t,null,2)}catch(e){return t}try{var e=JSON.parse(t);return p()(e)}catch(e){return t}}}},Wa=a("//Fk"),Ka=a.n(Wa),Ya=a("mtWM"),Xa=a.n(Ya);Xa.a.defaults.timeout=2e4,Xa.a.defaults.baseURL=DocConfig.server,Xa.a.interceptors.request.use(function(t){return t},function(t){return Ka.a.reject(t)}),Xa.a.interceptors.response.use(function(t){if(t.config.data&&t.config.data.indexOf("redirect_login=false")>-1);else if(10102===t.data.error_code){var e=Aa.currentRoute.fullPath.repeat(1);if(e.indexOf("redirect=")>-1)return!1;Aa.replace({path:"/user/login",query:{redirect:e}})}return t},function(t){return Ka.a.reject(t.response)});var Za=Xa.a,Qa=function(t,e){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"post",i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=new URLSearchParams(e),n=DocConfig.server+t;return new Ka.a(function(t,e){Za({url:n,method:a,data:o,headers:{"Content-Type":"application/x-www-form-urlencoded"}}).then(function(a){if(10102===a.data.error_code&&-1===a.config.data.indexOf("redirect_login=false")){var o=Aa.currentRoute.fullPath.repeat(1);if(o.indexOf("redirect=")>-1)return!1;Aa.replace({path:"/user/login",query:{redirect:o}}),e(new Error("登录态无效"))}if(i&&a.data&&0!==a.data.error_code)return Oa.MessageBox.alert(a.data.error_message),e(new Error("业务级别的错误"));t(a.data)},function(t){t.Cancel?console.log(t):e(t)}).catch(function(t){e(t)})})},ti=a("xO72"),ei=a.n(ti),ai=a("wUZ8"),ii=a.n(ai),oi=a("Vi3T"),ni=a.n(oi),si=a("J71k"),ri=a.n(si),li=a("AQny"),ci=a.n(li),mi=(a("9Z4o"),a("j1ja"),a("wvfG")),di=a.n(mi),_i=a("NYxO"),pi=a("bOdI"),ui=a.n(pi)()({increment:function(t,e){t.count++},changeItemInfo:function(t,e){t.item_info=e},changeOpenCatId:function(t,e){t.open_cat_id=e},changeUserInfo:function(t,e){t.user_info=e}},"SOME_MUTATION",function(t){}),fi={incrementAsync:function(t){var e=t.commit;setTimeout(function(){e("increment")},1e3)},changeItemInfo:function(t,e){t.commit("changeItemInfo",e)},changeOpenCatId:function(t,e){t.commit("changeOpenCatId",e)},changeUserInfo:function(t,e){t.commit("changeUserInfo",e)}},hi={count:"1",item_info:{},open_cat_id:0,user_info:{}};n.default.use(_i.a);var gi=new _i.a.Store({state:hi,actions:fi,mutations:ui});n.default.use(Ja),n.default.config.productionTip=!1,n.default.component("Header",Ha),n.default.component("Footer",Ga),n.default.use(za.a),n.default.use(ei.a),n.default.use(di.a);var vi=o()(ni.a,ri.a),bi=o()(ii.a,ci.a);n.default.config.lang=DocConfig.lang,n.default.locale("zh-cn",vi),n.default.locale("en",bi),n.default.prototype.axios=Za,n.default.prototype.request=Qa,n.default.prototype.$lang=DocConfig.lang,new n.default({el:"#app",router:Aa,store:gi,template:"<App/>",components:{App:r}})},OJrs:function(t,e){},OYGk:function(t,e){},RQJA:function(t,e){},SwXf:function(t,e){},"U/K7":function(t,e){},U8fK:function(t,e){},"Uu/S":function(t,e){},XiU4:function(t,e){},ZFgX:function(t,e){},ZILu:function(t,e){},Zt4p:function(t,e){},aMUC:function(t,e){},bX00:function(t,e){},bZFw:function(t,e){},bv2D:function(t,e){},cR38:function(t,e){},fB2E:function(t,e){},g9xf:function(t,e){},gdxq:function(t,e){},ghpK:function(t,e){},hFwC:function(t,e){},hbTw:function(t,e){},lX1S:function(t,e){},nzBk:function(t,e){},oR8w:function(t,e){},oS9z:function(t,e){},okHl:function(t,e){},p6bL:function(t,e){},pOoL:function(t,e){},pxj0:function(t,e){},q1Fm:function(t,e){},qHHh:function(t,e){},qZaU:function(t,e){},rD7s:function(t,e){},sAIR:function(t,e){},sRF7:function(t,e){},tSnk:function(t,e){},tfpE:function(t,e){},tvR6:function(t,e){},uslO:function(t,e,a){var i={"./af":"3CJN","./af.js":"3CJN","./ar":"3MVc","./ar-dz":"tkWw","./ar-dz.js":"tkWw","./ar-kw":"j8cJ","./ar-kw.js":"j8cJ","./ar-ly":"wPpW","./ar-ly.js":"wPpW","./ar-ma":"dURR","./ar-ma.js":"dURR","./ar-sa":"7OnE","./ar-sa.js":"7OnE","./ar-tn":"BEem","./ar-tn.js":"BEem","./ar.js":"3MVc","./az":"eHwN","./az.js":"eHwN","./be":"3hfc","./be.js":"3hfc","./bg":"lOED","./bg.js":"lOED","./bm":"hng5","./bm.js":"hng5","./bn":"aM0x","./bn-bd":"1C9R","./bn-bd.js":"1C9R","./bn.js":"aM0x","./bo":"w2Hs","./bo.js":"w2Hs","./br":"OSsP","./br.js":"OSsP","./bs":"aqvp","./bs.js":"aqvp","./ca":"wIgY","./ca.js":"wIgY","./cs":"ssxj","./cs.js":"ssxj","./cv":"N3vo","./cv.js":"N3vo","./cy":"ZFGz","./cy.js":"ZFGz","./da":"YBA/","./da.js":"YBA/","./de":"DOkx","./de-at":"8v14","./de-at.js":"8v14","./de-ch":"Frex","./de-ch.js":"Frex","./de.js":"DOkx","./dv":"rIuo","./dv.js":"rIuo","./el":"CFqe","./el.js":"CFqe","./en-au":"Sjoy","./en-au.js":"Sjoy","./en-ca":"Tqun","./en-ca.js":"Tqun","./en-gb":"hPuz","./en-gb.js":"hPuz","./en-ie":"ALEw","./en-ie.js":"ALEw","./en-il":"QZk1","./en-il.js":"QZk1","./en-in":"yJfC","./en-in.js":"yJfC","./en-nz":"dyB6","./en-nz.js":"dyB6","./en-sg":"NYST","./en-sg.js":"NYST","./eo":"Nd3h","./eo.js":"Nd3h","./es":"LT9G","./es-do":"7MHZ","./es-do.js":"7MHZ","./es-mx":"USNP","./es-mx.js":"USNP","./es-us":"INcR","./es-us.js":"INcR","./es.js":"LT9G","./et":"XlWM","./et.js":"XlWM","./eu":"sqLM","./eu.js":"sqLM","./fa":"2pmY","./fa.js":"2pmY","./fi":"nS2h","./fi.js":"nS2h","./fil":"rMbQ","./fil.js":"rMbQ","./fo":"OVPi","./fo.js":"OVPi","./fr":"tzHd","./fr-ca":"bXQP","./fr-ca.js":"bXQP","./fr-ch":"VK9h","./fr-ch.js":"VK9h","./fr.js":"tzHd","./fy":"g7KF","./fy.js":"g7KF","./ga":"U5Iz","./ga.js":"U5Iz","./gd":"nLOz","./gd.js":"nLOz","./gl":"FuaP","./gl.js":"FuaP","./gom-deva":"VGQH","./gom-deva.js":"VGQH","./gom-latn":"+27R","./gom-latn.js":"+27R","./gu":"rtsW","./gu.js":"rtsW","./he":"Nzt2","./he.js":"Nzt2","./hi":"ETHv","./hi.js":"ETHv","./hr":"V4qH","./hr.js":"V4qH","./hu":"xne+","./hu.js":"xne+","./hy-am":"GrS7","./hy-am.js":"GrS7","./id":"yRTJ","./id.js":"yRTJ","./is":"upln","./is.js":"upln","./it":"FKXc","./it-ch":"/E8D","./it-ch.js":"/E8D","./it.js":"FKXc","./ja":"ORgI","./ja.js":"ORgI","./jv":"JwiF","./jv.js":"JwiF","./ka":"RnJI","./ka.js":"RnJI","./kk":"j+vx","./kk.js":"j+vx","./km":"5j66","./km.js":"5j66","./kn":"gEQe","./kn.js":"gEQe","./ko":"eBB/","./ko.js":"eBB/","./ku":"kI9l","./ku.js":"kI9l","./ky":"6cf8","./ky.js":"6cf8","./lb":"z3hR","./lb.js":"z3hR","./lo":"nE8X","./lo.js":"nE8X","./lt":"/6P1","./lt.js":"/6P1","./lv":"jxEH","./lv.js":"jxEH","./me":"svD2","./me.js":"svD2","./mi":"gEU3","./mi.js":"gEU3","./mk":"Ab7C","./mk.js":"Ab7C","./ml":"oo1B","./ml.js":"oo1B","./mn":"CqHt","./mn.js":"CqHt","./mr":"5vPg","./mr.js":"5vPg","./ms":"ooba","./ms-my":"G++c","./ms-my.js":"G++c","./ms.js":"ooba","./mt":"oCzW","./mt.js":"oCzW","./my":"F+2e","./my.js":"F+2e","./nb":"FlzV","./nb.js":"FlzV","./ne":"/mhn","./ne.js":"/mhn","./nl":"3K28","./nl-be":"Bp2f","./nl-be.js":"Bp2f","./nl.js":"3K28","./nn":"C7av","./nn.js":"C7av","./oc-lnc":"KOFO","./oc-lnc.js":"KOFO","./pa-in":"pfs9","./pa-in.js":"pfs9","./pl":"7LV+","./pl.js":"7LV+","./pt":"ZoSI","./pt-br":"AoDM","./pt-br.js":"AoDM","./pt.js":"ZoSI","./ro":"wT5f","./ro.js":"wT5f","./ru":"ulq9","./ru.js":"ulq9","./sd":"fW1y","./sd.js":"fW1y","./se":"5Omq","./se.js":"5Omq","./si":"Lgqo","./si.js":"Lgqo","./sk":"OUMt","./sk.js":"OUMt","./sl":"2s1U","./sl.js":"2s1U","./sq":"V0td","./sq.js":"V0td","./sr":"f4W3","./sr-cyrl":"c1x4","./sr-cyrl.js":"c1x4","./sr.js":"f4W3","./ss":"7Q8x","./ss.js":"7Q8x","./sv":"Fpqq","./sv.js":"Fpqq","./sw":"DSXN","./sw.js":"DSXN","./ta":"+7/x","./ta.js":"+7/x","./te":"Nlnz","./te.js":"Nlnz","./tet":"gUgh","./tet.js":"gUgh","./tg":"5SNd","./tg.js":"5SNd","./th":"XzD+","./th.js":"XzD+","./tk":"+WRH","./tk.js":"+WRH","./tl-ph":"3LKG","./tl-ph.js":"3LKG","./tlh":"m7yE","./tlh.js":"m7yE","./tr":"k+5o","./tr.js":"k+5o","./tzl":"iNtv","./tzl.js":"iNtv","./tzm":"FRPF","./tzm-latn":"krPU","./tzm-latn.js":"krPU","./tzm.js":"FRPF","./ug-cn":"To0v","./ug-cn.js":"To0v","./uk":"ntHu","./uk.js":"ntHu","./ur":"uSe8","./ur.js":"uSe8","./uz":"XU1s","./uz-latn":"/bsm","./uz-latn.js":"/bsm","./uz.js":"XU1s","./vi":"0X8Q","./vi.js":"0X8Q","./x-pseudo":"e/KL","./x-pseudo.js":"e/KL","./yo":"YXlc","./yo.js":"YXlc","./zh-cn":"Vz2w","./zh-cn.js":"Vz2w","./zh-hk":"ZUyn","./zh-hk.js":"ZUyn","./zh-mo":"+WA1","./zh-mo.js":"+WA1","./zh-tw":"BbgG","./zh-tw.js":"BbgG"};function o(t){return a(n(t))}function n(t){var e=i[t];if(!(e+1))throw new Error("Cannot find module '"+t+"'.");return e}o.keys=function(){return Object.keys(i)},o.resolve=n,t.exports=o,o.id="uslO"},wFeN:function(t,e){},wgGe:function(t,e){},xEUY:function(t,e){},yAY5:function(t,e){},z0tW:function(t,e){},zB9H:function(t,e){},zJzz:function(t,e){}},["NHnr"]);
# this is a package __version__ = "4.6.2" def get_include(): """ Returns a list of header include paths (for lxml itself, libxml2 and libxslt) needed to compile C code against lxml if it was built with statically linked libraries. """ import os lxml_path = __path__[0] include_path = os.path.join(lxml_path, 'includes') includes = [include_path, lxml_path] for name in os.listdir(include_path): path = os.path.join(include_path, name) if os.path.isdir(path): includes.append(path) return includes
# this is a package __version__ = "4.6.3" def get_include(): """ Returns a list of header include paths (for lxml itself, libxml2 and libxslt) needed to compile C code against lxml if it was built with statically linked libraries. """ import os lxml_path = __path__[0] include_path = os.path.join(lxml_path, 'includes') includes = [include_path, lxml_path] for name in os.listdir(include_path): path = os.path.join(include_path, name) if os.path.isdir(path): includes.append(path) return includes
# this is a package __version__ = "4.6.4" def get_include(): """ Returns a list of header include paths (for lxml itself, libxml2 and libxslt) needed to compile C code against lxml if it was built with statically linked libraries. """ import os lxml_path = __path__[0] include_path = os.path.join(lxml_path, 'includes') includes = [include_path, lxml_path] for name in os.listdir(include_path): path = os.path.join(include_path, name) if os.path.isdir(path): includes.append(path) return includes
# this is a package __version__ = "4.6.5" def get_include(): """ Returns a list of header include paths (for lxml itself, libxml2 and libxslt) needed to compile C code against lxml if it was built with statically linked libraries. """ import os lxml_path = __path__[0] include_path = os.path.join(lxml_path, 'includes') includes = [include_path, lxml_path] for name in os.listdir(include_path): path = os.path.join(include_path, name) if os.path.isdir(path): includes.append(path) return includes
# -*- coding: utf-8 -*- ############################################################################## # 2011 E2OpenPlugins # # # # This file is open source software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License version 2 as # # published by the Free Software Foundation. # # # ############################################################################## import os import re import glob from urllib import quote import json from twisted.web import static, resource, http from Components.config import config from Tools.Directories import fileExists def new_getRequestHostname(self): host = self.getHeader(b'host') if host: if host[0]=='[': return host.split(']',1)[0] + "]" return host.split(':', 1)[0].encode('ascii') return self.getHost().host.encode('ascii') http.Request.getRequestHostname = new_getRequestHostname class FileController(resource.Resource): def render(self, request): action = "download" if "action" in request.args: action = request.args["action"][0] if "file" in request.args: filename = request.args["file"][0].decode('utf-8', 'ignore').encode('utf-8') filename = re.sub("^/+", "/", os.path.realpath(filename)) if not os.path.exists(filename): return "File '%s' not found" % (filename) if action == "stream": name = "stream" if "name" in request.args: name = request.args["name"][0] port = config.OpenWebif.port.value proto = 'http' if request.isSecure(): port = config.OpenWebif.https_port.value proto = 'https' ourhost = request.getHeader('host') m = re.match('.+\:(\d+)$', ourhost) if m is not None: port = m.group(1) response = "#EXTM3U\n#EXTVLCOPT--http-reconnect=true\n#EXTINF:-1,%s\n%s://%s:%s/file?action=download&file=%s" % (name, proto, request.getRequestHostname(), port, quote(filename)) request.setHeader("Content-Disposition", 'attachment;filename="%s.m3u"' % name) request.setHeader("Content-Type", "application/x-mpegurl") return response elif action == "delete": request.setResponseCode(http.OK) return "TODO: DELETE FILE: %s" % (filename) elif action == "download": request.setHeader("Content-Disposition", "attachment;filename=\"%s\"" % (filename.split('/')[-1])) rfile = static.File(filename, defaultType = "application/octet-stream") return rfile.render(request) else: return "wrong action parameter" if "dir" in request.args: path = request.args["dir"][0] pattern = '*' data = [] if "pattern" in request.args: pattern = request.args["pattern"][0] directories = [] files = [] if fileExists(path): try: files = glob.glob(path+'/'+pattern) except: files = [] files.sort() tmpfiles = files[:] for x in tmpfiles: if os.path.isdir(x): directories.append(x + '/') files.remove(x) data.append({"result": True,"dirs": directories,"files": files}) else: data.append({"result": False,"message": "path %s not exits" % (path)}) request.setHeader("content-type", "application/json; charset=utf-8") return json.dumps(data, indent=2)
# -*- coding: utf-8 -*- ############################################################################## # 2011 E2OpenPlugins # # # # This file is open source software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License version 2 as # # published by the Free Software Foundation. # # # ############################################################################## import os import re import glob from urllib import quote import json from twisted.web import static, resource, http from Components.config import config from Tools.Directories import fileExists from utilities import lenient_force_utf_8, sanitise_filename_slashes def new_getRequestHostname(self): host = self.getHeader(b'host') if host: if host[0]=='[': return host.split(']',1)[0] + "]" return host.split(':', 1)[0].encode('ascii') return self.getHost().host.encode('ascii') http.Request.getRequestHostname = new_getRequestHostname class FileController(resource.Resource): def render(self, request): action = "download" if "action" in request.args: action = request.args["action"][0] if "file" in request.args: filename = lenient_force_utf_8(request.args["file"][0]) filename = sanitise_filename_slashes(os.path.realpath(filename)) if not os.path.exists(filename): return "File '%s' not found" % (filename) if action == "stream": name = "stream" if "name" in request.args: name = request.args["name"][0] port = config.OpenWebif.port.value proto = 'http' if request.isSecure(): port = config.OpenWebif.https_port.value proto = 'https' ourhost = request.getHeader('host') m = re.match('.+\:(\d+)$', ourhost) if m is not None: port = m.group(1) response = "#EXTM3U\n#EXTVLCOPT--http-reconnect=true\n#EXTINF:-1,%s\n%s://%s:%s/file?action=download&file=%s" % (name, proto, request.getRequestHostname(), port, quote(filename)) request.setHeader("Content-Disposition", 'attachment;filename="%s.m3u"' % name) request.setHeader("Content-Type", "application/x-mpegurl") return response elif action == "delete": request.setResponseCode(http.OK) return "TODO: DELETE FILE: %s" % (filename) elif action == "download": request.setHeader("Content-Disposition", "attachment;filename=\"%s\"" % (filename.split('/')[-1])) rfile = static.File(filename, defaultType = "application/octet-stream") return rfile.render(request) else: return "wrong action parameter" if "dir" in request.args: path = request.args["dir"][0] pattern = '*' data = [] if "pattern" in request.args: pattern = request.args["pattern"][0] directories = [] files = [] if fileExists(path): try: files = glob.glob(path+'/'+pattern) except: files = [] files.sort() tmpfiles = files[:] for x in tmpfiles: if os.path.isdir(x): directories.append(x + '/') files.remove(x) data.append({"result": True,"dirs": directories,"files": files}) else: data.append({"result": False,"message": "path %s not exits" % (path)}) request.setHeader("content-type", "application/json; charset=utf-8") return json.dumps(data, indent=2)
{ "name": "glance", "version": "3.0.3", "description": "disposable fileserver", "main": "index.js", "bin": { "glance": "./bin/glance.js" }, "scripts": { "lint": "standard index.js test/index.js bin/glance.js", "test": "node test/index.js && npm run lint" }, "repository": { "type": "git", "url": "git://github.com/jarofghosts/glance.git" }, "keywords": [ "file", "server", "utility", "util", "fileserver" ], "author": "jesse keane", "license": "MIT", "bugs": { "url": "https://github.com/jarofghosts/glance/issues" }, "preferGlobal": true, "dependencies": { "bash-color": "0.0.3", "filed": "0.1.0", "html-ls": "1.0.0", "nopt": "3.0.4", "utils-fs-exists": "1.0.1", "xtend": "4.0.0" }, "devDependencies": { "eslint": "1.5.1", "eslint-config-standard": "4.4.0", "eslint-config-standard-react": "^1.1.0", "eslint-plugin-react": "^3.4.2", "eslint-plugin-standard": "1.3.1", "standard": "5.3.1", "tape": "4.2.0" } }
{ "name": "glance", "version": "3.0.3", "description": "disposable fileserver", "main": "index.js", "bin": { "glance": "./bin/glance.js" }, "scripts": { "lint": "standard index.js test/index.js bin/glance.js", "test": "node test/index.js && npm run lint" }, "repository": { "type": "git", "url": "git://github.com/jarofghosts/glance.git" }, "keywords": [ "file", "server", "utility", "util", "fileserver" ], "author": "jesse keane", "license": "MIT", "bugs": { "url": "https://github.com/jarofghosts/glance/issues" }, "preferGlobal": true, "dependencies": { "bash-color": "0.0.3", "filed": "0.1.0", "html-ls": "1.0.0", "mime": "1.2.6", "nopt": "3.0.4", "utils-fs-exists": "1.0.1", "xtend": "4.0.0" }, "devDependencies": { "eslint": "1.5.1", "eslint-config-standard": "4.4.0", "eslint-config-standard-react": "^1.1.0", "eslint-plugin-react": "^3.4.2", "eslint-plugin-standard": "1.3.1", "standard": "5.3.1", "tape": "4.2.0" } }
{ "name": "connect", "version": "2.13.1", "description": "High performance middleware framework", "keywords": [ "framework", "web", "middleware", "connect", "rack" ], "repository": "git://github.com/senchalabs/connect.git", "author": "TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com)", "dependencies": { "basic-auth-connect": "1.0.0", "batch": "0.5.0", "cookie-parser": "1.0.1", "cookie-signature": "1.0.3", "compression": "1.0.0", "connect-timeout": "1.0.0", "csurf": "1.0.0", "errorhandler": "1.0.0", "express-session": "1.0.2", "method-override": "1.0.0", "morgan": "1.0.0", "qs": "0.6.6", "response-time": "1.0.0", "static-favicon": "1.0.0", "vhost": "1.0.0", "send": "0.1.4", "bytes": "0.2.1", "fresh": "0.2.0", "pause": "0.0.1", "debug": ">= 0.7.3 < 1", "raw-body": "1.1.3", "negotiator": "0.3.0", "multiparty": "2.2.0" }, "devDependencies": { "should": ">= 2.0.2 < 3", "mocha": ">= 1.13.0 < 2", "jade": ">= 0.35.0 < 1", "dox": ">= 0.4.4 < 1" }, "licenses": [ { "type": "MIT", "url": "https://raw.github.com/senchalabs/connect/master/LICENSE" } ], "main": "index", "engines": { "node": ">= 0.8.0" }, "scripts": { "test": "make" } }
{ "name": "connect", "version": "2.13.1", "description": "High performance middleware framework", "keywords": [ "framework", "web", "middleware", "connect", "rack" ], "repository": "git://github.com/senchalabs/connect.git", "author": "TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com)", "dependencies": { "basic-auth-connect": "1.0.0", "cookie-parser": "1.0.1", "cookie-signature": "1.0.3", "compression": "1.0.0", "connect-timeout": "1.0.0", "csurf": "1.0.0", "errorhandler": "1.0.0", "express-session": "1.0.2", "method-override": "1.0.0", "morgan": "1.0.0", "qs": "0.6.6", "response-time": "1.0.0", "serve-index": "1.0.0", "static-favicon": "1.0.0", "vhost": "1.0.0", "send": "0.1.4", "bytes": "0.2.1", "fresh": "0.2.0", "pause": "0.0.1", "debug": ">= 0.7.3 < 1", "raw-body": "1.1.3", "multiparty": "2.2.0" }, "devDependencies": { "should": ">= 2.0.2 < 3", "mocha": ">= 1.13.0 < 2", "jade": ">= 0.35.0 < 1", "dox": ">= 0.4.4 < 1" }, "licenses": [ { "type": "MIT", "url": "https://raw.github.com/senchalabs/connect/master/LICENSE" } ], "main": "index", "engines": { "node": ">= 0.8.0" }, "scripts": { "test": "make" } }
{ "name": "crud-file-server", "version": "0.8.0", "description": "file server supporting basic create, read, update, & delete for any kind of file", "bin": { "crud-file-server": "./bin/crud-file-server" }, "main": "./crud-file-server.js", "repository": { "type": "git", "url": "https://github.com/omphalos/crud-file-server.git" }, "keywords": [ "static", "file", "fs", "http" ], "dependencies": { "optimist": "0.3.4", "mime": "1.2.7" }, "license": "unlicense", "engine": { "node": ">=0.8.1" }, "author": "omphalos" }
{ "name": "crud-file-server", "version": "0.9.0", "description": "file server supporting basic create, read, update, & delete for any kind of file", "bin": { "crud-file-server": "./bin/crud-file-server" }, "main": "./crud-file-server.js", "repository": { "type": "git", "url": "https://github.com/omphalos/crud-file-server.git" }, "keywords": [ "static", "file", "fs", "http" ], "dependencies": { "optimist": "0.3.4", "mime": "1.2.7" }, "license": "unlicense", "engine": { "node": ">=0.8.1" }, "author": "omphalos" }
/*! * resolve-path * Copyright(c) 2014 Jonathan Ong * Copyright(c) 2015 Douglas Christopher Wilson * MIT Licensed */ 'use strict' /** * Module dependencies. * @private */ var createError = require('http-errors') var normalize = require('path').normalize var pathIsAbsolute = require('path-is-absolute') var resolve = require('path').resolve var sep = require('path').sep /** * Module exports. * @public */ module.exports = resolvePath /** * Module variables. * @private */ var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/ /** * Resolve relative path against a root path * * @param {string} rootPath * @param {string} relativePath * @return {string} * @public */ function resolvePath (rootPath, relativePath) { var path = relativePath var root = rootPath // root is optional, similar to root.resolve if (arguments.length === 1) { path = rootPath root = process.cwd() } if (root == null) { throw new TypeError('argument rootPath is required') } if (typeof root !== 'string') { throw new TypeError('argument rootPath must be a string') } if (path == null) { throw new TypeError('argument relativePath is required') } if (typeof path !== 'string') { throw new TypeError('argument relativePath must be a string') } // containing NULL bytes is malicious if (path.indexOf('\0') !== -1) { throw createError(400, 'Malicious Path') } // path should never be absolute if (pathIsAbsolute.posix(path) || pathIsAbsolute.win32(path)) { throw createError(400, 'Malicious Path') } // path outside root if (UP_PATH_REGEXP.test(normalize('.' + sep + path))) { throw createError(403) } // resolve & normalize the root path root = normalize(resolve(root) + sep) // resolve the path return resolve(root, path) }
/*! * resolve-path * Copyright(c) 2014 Jonathan Ong * Copyright(c) 2015 Douglas Christopher Wilson * MIT Licensed */ 'use strict' /** * Module dependencies. * @private */ var createError = require('http-errors') var join = require('path').join var normalize = require('path').normalize var pathIsAbsolute = require('path-is-absolute') var resolve = require('path').resolve var sep = require('path').sep /** * Module exports. * @public */ module.exports = resolvePath /** * Module variables. * @private */ var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/ /** * Resolve relative path against a root path * * @param {string} rootPath * @param {string} relativePath * @return {string} * @public */ function resolvePath (rootPath, relativePath) { var path = relativePath var root = rootPath // root is optional, similar to root.resolve if (arguments.length === 1) { path = rootPath root = process.cwd() } if (root == null) { throw new TypeError('argument rootPath is required') } if (typeof root !== 'string') { throw new TypeError('argument rootPath must be a string') } if (path == null) { throw new TypeError('argument relativePath is required') } if (typeof path !== 'string') { throw new TypeError('argument relativePath must be a string') } // containing NULL bytes is malicious if (path.indexOf('\0') !== -1) { throw createError(400, 'Malicious Path') } // path should never be absolute if (pathIsAbsolute.posix(path) || pathIsAbsolute.win32(path)) { throw createError(400, 'Malicious Path') } // path outside root if (UP_PATH_REGEXP.test(normalize('.' + sep + path))) { throw createError(403) } // join the relative path return normalize(join(resolve(root), path)) }
None
(function(){ var message = 'Ya been pwned by an XSS from an unsanitized script tag injection.'; if(alertify){ alertify.error(message); } else { alert(message); }; })();
{ "name": "WebMicrobeTrace", "version": "0.3.0", "main": "index.js", "author": "Tony Boyles <Anthony@Boyles.cc>", "license": "MIT", "repository": "https://github.com/AABoyles/WebMicrobeTrace.git", "engines": { "node": "9.8.0", "yarn": "1.5.1" }, "scripts": { "appcache": "./appcache.sh", "start": "node index.js", "build": "yarn start && nativifier http://localhost:8080" }, "devDependencies": { "express": "^4.16.3", "nativefier": "^7.5.4", "yarn": "^1.5.0" }, "dependencies": { "3d-force-graph": "^1.25.0", "alertifyjs": "^1.11.0", "bettermath": "^0.2.4", "bioseq": "^0.1.2", "bootstrap": "^4.0.0", "chosen-js": "^1.8.3", "clipboard": "^1.7.1", "d3": "^5.0.0", "d3-force-attract": "^0.1.1", "d3-sankey": "^0.7.1", "d3-symbol-extra": "^0.1.0", "datatables.net-bs4": "^1.10.16", "datatables.net-scroller-bs4": "^1.4.4", "datatables.net-select": "^1.2.5", "datatables.net-select-bs4": "^1.2.5", "golden-layout": "^1.5.9", "html2canvas": "^1.0.0-alpha.10", "jquery": "^3.3.1", "lodash": "^4.17.5", "msa": "^1.0.3", "open-iconic": "^1.1.1", "papaparse": "^4.3.6", "plotly.js": "^1.34.0", "popper.js": "^1.12.9", "screenfull": "^3.3.2", "tn93": "^0.1.1", "vis": "^4.21.0", "vue": "^2.5.16" } }
{ "name": "WebMicrobeTrace", "version": "0.3.0", "main": "index.js", "author": "Tony Boyles <Anthony@Boyles.cc>", "license": "MIT", "repository": "https://github.com/AABoyles/WebMicrobeTrace.git", "engines": { "node": "9.8.0", "yarn": "1.5.1" }, "scripts": { "appcache": "sh appcache.sh", "start": "node index.js", "build": "yarn start && nativifier http://localhost:8080" }, "devDependencies": { "nativefier": "^7.5.4", "yarn": "^1.5.0" }, "dependencies": { "3d-force-graph": "^1.25.0", "alertifyjs": "^1.11.0", "bettermath": "^0.2.4", "bioseq": "^0.1.2", "bootstrap": "^4.0.0", "chosen-js": "^1.8.3", "clipboard": "^1.7.1", "d3": "^5.0.0", "d3-force-attract": "^0.1.1", "d3-sankey": "^0.7.1", "d3-symbol-extra": "^0.1.0", "datatables.net-bs4": "^1.10.16", "datatables.net-scroller-bs4": "^1.4.4", "datatables.net-select": "^1.2.5", "datatables.net-select-bs4": "^1.2.5", "express": "^4.16.3", "golden-layout": "^1.5.9", "html2canvas": "^1.0.0-alpha.10", "jquery": "^3.3.1", "lodash": "^4.17.5", "msa": "^1.0.3", "open-iconic": "^1.1.1", "papaparse": "^4.3.6", "plotly.js": "^1.34.0", "popper.js": "^1.12.9", "screenfull": "^3.3.2", "tn93": "^0.1.1", "vis": "^4.21.0", "vue": "^2.5.16", "xss": "^0.3.7" } }
# -*- coding: utf-8 -*- # Copyright 2019 The Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import from twisted.web.resource import Resource from twisted.internet import defer import logging import json from six.moves import urllib from sydent.http.servlets import get_args, jsonwrap, deferjsonwrap, send_cors from sydent.http.httpclient import FederationHttpClient from sydent.users.tokens import issueToken logger = logging.getLogger(__name__) class RegisterServlet(Resource): isLeaf = True def __init__(self, syd): self.sydent = syd self.client = FederationHttpClient(self.sydent) @deferjsonwrap @defer.inlineCallbacks def render_POST(self, request): """ Register with the Identity Server """ send_cors(request) args = get_args(request, ('matrix_server_name', 'access_token')) result = yield self.client.get_json( "matrix://%s/_matrix/federation/v1/openid/userinfo?access_token=%s" % ( args['matrix_server_name'], urllib.parse.quote(args['access_token']), ), 1024 * 5, ) if 'sub' not in result: raise Exception("Invalid response from homeserver") user_id = result['sub'] tok = yield issueToken(self.sydent, user_id) # XXX: `token` is correct for the spec, but we released with `access_token` # for a substantial amount of time. Serve both to make spec-compliant clients # happy. defer.returnValue({ "access_token": tok, "token": tok, }) def render_OPTIONS(self, request): send_cors(request) return b''
# -*- coding: utf-8 -*- # Copyright 2019 The Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import from twisted.web.resource import Resource from twisted.internet import defer import logging import json from six.moves import urllib from sydent.http.servlets import get_args, jsonwrap, deferjsonwrap, send_cors from sydent.http.httpclient import FederationHttpClient from sydent.users.tokens import issueToken from sydent.util.stringutils import is_valid_hostname logger = logging.getLogger(__name__) class RegisterServlet(Resource): isLeaf = True def __init__(self, syd): self.sydent = syd self.client = FederationHttpClient(self.sydent) @deferjsonwrap @defer.inlineCallbacks def render_POST(self, request): """ Register with the Identity Server """ send_cors(request) args = get_args(request, ('matrix_server_name', 'access_token')) hostname = args['matrix_server_name'].lower() if not is_valid_hostname(hostname): request.setResponseCode(400) return { 'errcode': 'M_INVALID_PARAM', 'error': 'matrix_server_name must be a valid hostname' } result = yield self.client.get_json( "matrix://%s/_matrix/federation/v1/openid/userinfo?access_token=%s" % ( hostname, urllib.parse.quote(args['access_token']), ), 1024 * 5, ) if 'sub' not in result: raise Exception("Invalid response from homeserver") user_id = result['sub'] tok = yield issueToken(self.sydent, user_id) # XXX: `token` is correct for the spec, but we released with `access_token` # for a substantial amount of time. Serve both to make spec-compliant clients # happy. defer.returnValue({ "access_token": tok, "token": tok, }) def render_OPTIONS(self, request): send_cors(request) return b''
# -*- coding: utf-8 -*- # Copyright 2020 The Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import re # https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-register-email-requesttoken client_secret_regex = re.compile(r"^[0-9a-zA-Z\.\=\_\-]+$") def is_valid_client_secret(client_secret): """Validate that a given string matches the client_secret regex defined by the spec :param client_secret: The client_secret to validate :type client_secret: unicode :return: Whether the client_secret is valid :rtype: bool """ return client_secret_regex.match(client_secret) is not None
# -*- coding: utf-8 -*- # Copyright 2020 The Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import re # https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-register-email-requesttoken client_secret_regex = re.compile(r"^[0-9a-zA-Z\.\=\_\-]+$") # hostname/domain name + optional port # https://regex101.com/r/OyN1lg/2 hostname_regex = re.compile( r"^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$", flags=re.IGNORECASE) def is_valid_client_secret(client_secret): """Validate that a given string matches the client_secret regex defined by the spec :param client_secret: The client_secret to validate :type client_secret: str :return: Whether the client_secret is valid :rtype: bool """ return client_secret_regex.match(client_secret) is not None def is_valid_hostname(string: str) -> bool: """Validate that a given string is a valid hostname or domain name, with an optional port number. For domain names, this only validates that the form is right (for instance, it doesn't check that the TLD is valid). If a port is specified, it has to be a valid port number. :param string: The string to validate :type string: str :return: Whether the input is a valid hostname :rtype: bool """ host_parts = string.split(":", 1) if len(host_parts) == 1: return hostname_regex.match(string) is not None else: host, port = host_parts valid_hostname = hostname_regex.match(host) is not None try: port_num = int(port) valid_port = ( port == str(port_num) # exclude things like '08090' or ' 8090' and 1 <= port_num < 65536 except ValueError: valid_port = False return valid_hostname and valid_port
# -*- coding: utf-8 -*- # Copyright 2020 The Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from twisted.trial import unittest from sydent.http.auth import tokenFromRequest from tests.utils import make_request, make_sydent class AuthTestCase(unittest.TestCase): """Tests Sydent's auth code""" def setUp(self): # Create a new sydent self.sydent = make_sydent() self.test_token = "testingtoken" # Inject a fake OpenID token into the database cur = self.sydent.db.cursor() cur.execute( "INSERT INTO accounts (user_id, created_ts, consent_version)" "VALUES (?, ?, ?)", ("@bob:localhost", 101010101, "asd") ) cur.execute( "INSERT INTO tokens (user_id, token)" "VALUES (?, ?)", ("@bob:localhost", self.test_token) ) self.sydent.db.commit() def test_can_read_token_from_headers(self): """Tests that Sydent correct extracts an auth token from request headers""" self.sydent.run() request, _ = make_request( self.sydent.reactor, "GET", "/_matrix/identity/v2/hash_details" ) request.requestHeaders.addRawHeader( b"Authorization", b"Bearer " + self.test_token.encode("ascii") ) token = tokenFromRequest(request) self.assertEqual(token, self.test_token) def test_can_read_token_from_query_parameters(self): """Tests that Sydent correct extracts an auth token from query parameters""" self.sydent.run() request, _ = make_request( self.sydent.reactor, "GET", "/_matrix/identity/v2/hash_details?access_token=" + self.test_token ) token = tokenFromRequest(request) self.assertEqual(token, self.test_token)
# -*- coding: utf-8 -*- # Copyright 2020 The Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from twisted.trial import unittest from sydent.http.auth import tokenFromRequest from tests.utils import make_request, make_sydent class AuthTestCase(unittest.TestCase): """Tests Sydent's auth code""" def setUp(self): # Create a new sydent self.sydent = make_sydent() self.test_token = "testingtoken" # Inject a fake OpenID token into the database cur = self.sydent.db.cursor() cur.execute( "INSERT INTO accounts (user_id, created_ts, consent_version)" "VALUES (?, ?, ?)", ("@bob:localhost", 101010101, "asd") ) cur.execute( "INSERT INTO tokens (user_id, token)" "VALUES (?, ?)", ("@bob:localhost", self.test_token) ) self.sydent.db.commit() def test_can_read_token_from_headers(self): """Tests that Sydent correctly extracts an auth token from request headers""" self.sydent.run() request, _ = make_request( self.sydent.reactor, "GET", "/_matrix/identity/v2/hash_details" ) request.requestHeaders.addRawHeader( b"Authorization", b"Bearer " + self.test_token.encode("ascii") ) token = tokenFromRequest(request) self.assertEqual(token, self.test_token) def test_can_read_token_from_query_parameters(self): """Tests that Sydent correctly extracts an auth token from query parameters""" self.sydent.run() request, _ = make_request( self.sydent.reactor, "GET", "/_matrix/identity/v2/hash_details?access_token=" + self.test_token ) token = tokenFromRequest(request) self.assertEqual(token, self.test_token)
None
# -*- coding: utf-8 -*- # Copyright 2021 The Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from twisted.trial import unittest from tests.utils import make_request, make_sydent class RegisterTestCase(unittest.TestCase): """Tests Sydent's register servlet""" def setUp(self): # Create a new sydent self.sydent = make_sydent() def test_sydent_rejects_invalid_hostname(self): """Tests that the /register endpoint rejects an invalid hostname passed as matrix_server_name""" self.sydent.run() bad_hostname = "example.com#" request, channel = make_request( self.sydent.reactor, "POST", "/_matrix/identity/v2/account/register", content={ "matrix_server_name": bad_hostname, "access_token": "foo" }) request.render(self.sydent.servlets.registerServlet) self.assertEqual(channel.code, 400)
None
from twisted.trial import unittest from sydent.util.stringutils import is_valid_hostname class UtilTests(unittest.TestCase): """Tests Sydent utility functions.""" def test_is_valid_hostname(self): """Tests that the is_valid_hostname function accepts only valid hostnames (or domain names), with optional port number. """ self.assertTrue(is_valid_hostname("example.com")) self.assertTrue(is_valid_hostname("EXAMPLE.COM")) self.assertTrue(is_valid_hostname("ExAmPlE.CoM")) self.assertTrue(is_valid_hostname("example.com:4242")) self.assertTrue(is_valid_hostname("localhost")) self.assertTrue(is_valid_hostname("localhost:9000")) self.assertTrue(is_valid_hostname("a.b:1234")) self.assertFalse(is_valid_hostname("example.com:65536")) self.assertFalse(is_valid_hostname("example.com:0")) self.assertFalse(is_valid_hostname("example.com:a")) self.assertFalse(is_valid_hostname("example.com:04242")) self.assertFalse(is_valid_hostname("example.com: 4242")) self.assertFalse(is_valid_hostname("example.com/example.com")) self.assertFalse(is_valid_hostname("example.com#example.com"))
# -*- coding: utf-8 -*- # Copyright 2020 The Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import re # https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-register-email-requesttoken client_secret_regex = re.compile(r"^[0-9a-zA-Z\.\=\_\-]+$") # hostname/domain name + optional port # https://regex101.com/r/OyN1lg/2 hostname_regex = re.compile( r"^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$", flags=re.IGNORECASE) def is_valid_client_secret(client_secret): """Validate that a given string matches the client_secret regex defined by the spec :param client_secret: The client_secret to validate :type client_secret: str :return: Whether the client_secret is valid :rtype: bool """ return client_secret_regex.match(client_secret) is not None def is_valid_hostname(string: str) -> bool: """Validate that a given string is a valid hostname or domain name, with an optional port number. For domain names, this only validates that the form is right (for instance, it doesn't check that the TLD is valid). If a port is specified, it has to be a valid port number. :param string: The string to validate :type string: str :return: Whether the input is a valid hostname :rtype: bool """ host_parts = string.split(":", 1) if len(host_parts) == 1: return hostname_regex.match(string) is not None else: host, port = host_parts valid_hostname = hostname_regex.match(host) is not None try: port_num = int(port) valid_port = ( port == str(port_num) # exclude things like '08090' or ' 8090' and 1 <= port_num < 65536) except ValueError: valid_port = False return valid_hostname and valid_port
# -*- coding: utf-8 -*- # Copyright 2020 The Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import re from typing import Optional, Tuple from twisted.internet.abstract import isIPAddress, isIPv6Address # https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-register-email-requesttoken client_secret_regex = re.compile(r"^[0-9a-zA-Z\.\=\_\-]+$") # hostname/domain name # https://regex101.com/r/OyN1lg/2 hostname_regex = re.compile( r"^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$", flags=re.IGNORECASE) def is_valid_client_secret(client_secret): """Validate that a given string matches the client_secret regex defined by the spec :param client_secret: The client_secret to validate :type client_secret: str :return: Whether the client_secret is valid :rtype: bool """ return client_secret_regex.match(client_secret) is not None def is_valid_hostname(string: str) -> bool: """Validate that a given string is a valid hostname or domain name. For domain names, this only validates that the form is right (for instance, it doesn't check that the TLD is valid). :param string: The string to validate :type string: str :return: Whether the input is a valid hostname :rtype: bool """ return hostname_regex.match(string) is not None def parse_server_name(server_name: str) -> Tuple[str, Optional[int]]: """Split a server name into host/port parts. No validation is done on the host part. The port part is validated to be a valid port number. Args: server_name: server name to parse Returns: host/port parts. Raises: ValueError if the server name could not be parsed. """ try: if server_name[-1] == "]": # ipv6 literal, hopefully return server_name, None host_port = server_name.rsplit(":", 1) host = host_port[0] port = host_port[1] if host_port[1:] else None if port: port_num = int(port) # exclude things like '08090' or ' 8090' if port != str(port_num) or not (1 <= port_num < 65536): raise ValueError("Invalid port") return host, port except Exception: raise ValueError("Invalid server name '%s'" % server_name) def is_valid_matrix_server_name(string: str) -> bool: """Validate that the given string is a valid Matrix server name. A string is a valid Matrix server name if it is one of the following, plus an optional port: a. IPv4 address b. IPv6 literal (`[IPV6_ADDRESS]`) c. A valid hostname :param string: The string to validate :type string: str :return: Whether the input is a valid Matrix server name :rtype: bool """ try: host, port = parse_server_name(string) except ValueError: return False valid_ipv4_addr = isIPAddress(host) valid_ipv6_literal = host[0] == "[" and host[-1] == "]" and isIPv6Address(host[1:-1]) return valid_ipv4_addr or valid_ipv6_literal or is_valid_hostname(host)
# -*- coding: utf-8 -*- # Copyright 2021 The Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from twisted.trial import unittest from tests.utils import make_request, make_sydent class RegisterTestCase(unittest.TestCase): """Tests Sydent's register servlet""" def setUp(self): # Create a new sydent self.sydent = make_sydent() def test_sydent_rejects_invalid_hostname(self): """Tests that the /register endpoint rejects an invalid hostname passed as matrix_server_name""" self.sydent.run() bad_hostname = "example.com#" request, channel = make_request( self.sydent.reactor, "POST", "/_matrix/identity/v2/account/register", content={ "matrix_server_name": bad_hostname, "access_token": "foo" }) request.render(self.sydent.servlets.registerServlet) self.assertEqual(channel.code, 400)
# -*- coding: utf-8 -*- # Copyright 2021 The Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from twisted.trial import unittest from tests.utils import make_request, make_sydent class RegisterTestCase(unittest.TestCase): """Tests Sydent's register servlet""" def setUp(self): # Create a new sydent self.sydent = make_sydent() def test_sydent_rejects_invalid_hostname(self): """Tests that the /register endpoint rejects an invalid hostname passed as matrix_server_name""" self.sydent.run() bad_hostname = "example.com#" request, channel = make_request( self.sydent.reactor, "POST", "/_matrix/identity/v2/account/register", content={ "matrix_server_name": bad_hostname, "access_token": "foo" }) request.render(self.sydent.servlets.registerServlet) self.assertEqual(channel.code, 400)
from twisted.trial import unittest from sydent.util.stringutils import is_valid_hostname class UtilTests(unittest.TestCase): """Tests Sydent utility functions.""" def test_is_valid_hostname(self): """Tests that the is_valid_hostname function accepts only valid hostnames (or domain names), with optional port number. """ self.assertTrue(is_valid_hostname("example.com")) self.assertTrue(is_valid_hostname("EXAMPLE.COM")) self.assertTrue(is_valid_hostname("ExAmPlE.CoM")) self.assertTrue(is_valid_hostname("example.com:4242")) self.assertTrue(is_valid_hostname("localhost")) self.assertTrue(is_valid_hostname("localhost:9000")) self.assertTrue(is_valid_hostname("a.b:1234")) self.assertFalse(is_valid_hostname("example.com:65536")) self.assertFalse(is_valid_hostname("example.com:0")) self.assertFalse(is_valid_hostname("example.com:a")) self.assertFalse(is_valid_hostname("example.com:04242")) self.assertFalse(is_valid_hostname("example.com: 4242")) self.assertFalse(is_valid_hostname("example.com/example.com")) self.assertFalse(is_valid_hostname("example.com#example.com"))
from twisted.trial import unittest from sydent.util.stringutils import is_valid_matrix_server_name class UtilTests(unittest.TestCase): """Tests Sydent utility functions.""" def test_is_valid_matrix_server_name(self): """Tests that the is_valid_matrix_server_name function accepts only valid hostnames (or domain names), with optional port number. """ self.assertTrue(is_valid_matrix_server_name("9.9.9.9")) self.assertTrue(is_valid_matrix_server_name("9.9.9.9:4242")) self.assertTrue(is_valid_matrix_server_name("[::]")) self.assertTrue(is_valid_matrix_server_name("[::]:4242")) self.assertTrue(is_valid_matrix_server_name("[a:b:c::]:4242")) self.assertTrue(is_valid_matrix_server_name("example.com")) self.assertTrue(is_valid_matrix_server_name("EXAMPLE.COM")) self.assertTrue(is_valid_matrix_server_name("ExAmPlE.CoM")) self.assertTrue(is_valid_matrix_server_name("example.com:4242")) self.assertTrue(is_valid_matrix_server_name("localhost")) self.assertTrue(is_valid_matrix_server_name("localhost:9000")) self.assertTrue(is_valid_matrix_server_name("a.b.c.d:1234")) self.assertFalse(is_valid_matrix_server_name("[:::]")) self.assertFalse(is_valid_matrix_server_name("a:b:c::")) self.assertFalse(is_valid_matrix_server_name("example.com:65536")) self.assertFalse(is_valid_matrix_server_name("example.com:0")) self.assertFalse(is_valid_matrix_server_name("example.com:-1")) self.assertFalse(is_valid_matrix_server_name("example.com:a")) self.assertFalse(is_valid_matrix_server_name("example.com: ")) self.assertFalse(is_valid_matrix_server_name("example.com:04242")) self.assertFalse(is_valid_matrix_server_name("example.com: 4242")) self.assertFalse(is_valid_matrix_server_name("example.com/example.com")) self.assertFalse(is_valid_matrix_server_name("example.com#example.com"))