2 lines
38 KiB
JavaScript
2 lines
38 KiB
JavaScript
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/js/",n(n.s=33)}([function(e,t,n){"use strict";t.__esModule=!0,t.extend=l,t.indexOf=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},t.escapeExpression=function(e){if("string"!=typeof e){if(e&&e.toHTML)return e.toHTML();if(null==e)return"";if(!e)return e+"";e=""+e}if(!a.test(e))return e;return e.replace(o,i)},t.isEmpty=function(e){return!e&&0!==e||!(!c(e)||0!==e.length)},t.createFrame=function(e){var t=l({},e);return t._parent=e,t},t.blockParams=function(e,t){return e.path=t,e},t.appendContextPath=function(e,t){return(e?e+".":"")+t};var r={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},o=/[&<>"'`=]/g,a=/[&<>"'`=]/;function i(e){return r[e]}function l(e){for(var t=1;t<arguments.length;t++)for(var n in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],n)&&(e[n]=arguments[t][n]);return e}var s=Object.prototype.toString;t.toString=s;var u=function(e){return"function"==typeof e};u(/x/)&&(t.isFunction=u=function(e){return"function"==typeof e&&"[object Function]"===s.call(e)}),t.isFunction=u;var c=Array.isArray||function(e){return!(!e||"object"!=typeof e)&&"[object Array]"===s.call(e)};t.isArray=c},function(e,t,n){"use strict";t.__esModule=!0;var r=["description","fileName","lineNumber","message","name","number","stack"];function o(e,t){var n=t&&t.loc,a=void 0,i=void 0;n&&(e+=" - "+(a=n.start.line)+":"+(i=n.start.column));for(var l=Error.prototype.constructor.call(this,e),s=0;s<r.length;s++)this[r[s]]=l[r[s]];Error.captureStackTrace&&Error.captureStackTrace(this,o);try{n&&(this.lineNumber=a,Object.defineProperty?Object.defineProperty(this,"column",{value:i,enumerable:!0}):this.column=i)}catch(e){}}o.prototype=new Error,t.default=o,e.exports=t.default},function(e,t,n){e.exports=n(7).default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.HandlebarsEnvironment=u;var o=n(0),a=r(n(1)),i=n(8),l=n(16),s=r(n(18));t.VERSION="4.1.2";t.COMPILER_REVISION=7;t.REVISION_CHANGES={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0"};function u(e,t,n){this.helpers=e||{},this.partials=t||{},this.decorators=n||{},i.registerDefaultHelpers(this),l.registerDefaultDecorators(this)}u.prototype={constructor:u,logger:s.default,log:s.default.log,registerHelper:function(e,t){if("[object Object]"===o.toString.call(e)){if(t)throw new a.default("Arg not supported with multiple helpers");o.extend(this.helpers,e)}else this.helpers[e]=t},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if("[object Object]"===o.toString.call(e))o.extend(this.partials,e);else{if(void 0===t)throw new a.default('Attempting to register a partial called "'+e+'" as undefined');this.partials[e]=t}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,t){if("[object Object]"===o.toString.call(e)){if(t)throw new a.default("Arg not supported with multiple decorators");o.extend(this.decorators,e)}else this.decorators[e]=t},unregisterDecorator:function(e){delete this.decorators[e]}};var c=s.default.log;t.log=c,t.createFrame=o.createFrame,t.logger=s.default},function(e,t){e.exports=function(e,t){return e===t?'selected="selected"':""}},function(e,t,n){var r=n(2);function o(e){return e&&(e.__esModule?e.default:e)}e.exports=(r.default||r).template({1:function(e,t,n,r,o){return" modified"},3:function(e,t,n,r,o){return'\t\t\t<span class="button-delete icon-delete"></span>\n'},5:function(e,t,r,a,i,l,s){var u,c=e.lambda,f=e.escapeExpression,d=null!=t?t:e.nullContext||{};return'\t\t\t<div class="check" data-id="'+f(c(i&&i.index,t))+'">\n\t\t\t\t<select class="check-class">\n'+(null!=(u=r.each.call(d,null!=s[1]?s[1].classes:s[1],{name:"each",hash:{},fn:e.program(6,i,0,l,s),inverse:e.noop,data:i}))?u:"")+'\t\t\t\t</select>\n\t\t\t\t<select class="check-operator">\n'+(null!=(u=r.each.call(d,o(n(23)).call(d,null!=t?t.class:t,{name:"getOperators",hash:{},data:i}),{name:"each",hash:{},fn:e.program(8,i,0,l,s),inverse:e.noop,data:i}))?u:"")+'\t\t\t\t</select>\n\t\t\t\t<input type="text" class="check-value" value="'+f(c(null!=t?t.value:t,t))+'">\n\t\t\t\t<span class="button-delete-check icon-delete"></span>\n\t\t\t</div>\n'},6:function(e,t,r,a,i,l,s){var u,c=e.lambda,f=e.escapeExpression;return'\t\t\t\t\t\t<option value="'+f(c(null!=t?t.class:t,t))+'" '+(null!=(u=o(n(4)).call(null!=t?t:e.nullContext||{},null!=t?t.class:t,null!=s[1]?s[1].class:s[1],{name:"selectItem",hash:{},data:i}))?u:"")+">"+f(c(null!=t?t.name:t,t))+"</option>\n"},8:function(e,t,r,a,i,l,s){var u,c=e.lambda,f=e.escapeExpression;return'\t\t\t\t\t\t<option value="'+f(c(null!=t?t.operator:t,t))+'" '+(null!=(u=o(n(4)).call(null!=t?t:e.nullContext||{},null!=t?t.operator:t,null!=s[1]?s[1].operator:s[1],{name:"selectItem",hash:{},data:i}))?u:"")+">"+f(c(null!=t?t.name:t,t))+"</option>\n"},10:function(e,t,n,r,o){var a;return(null!=(a=n.if.call(null!=t?t:e.nullContext||{},null!=(a=null!=t?t.operation:t)?a.id:a,{name:"if",hash:{},fn:e.program(11,o,0),inverse:e.noop,data:o}))?a:"")+'\t\t<button class="button-save pull-right">'+e.escapeExpression(e.lambda(null!=t?t.saveTXT:t,t))+"</button>\n"},11:function(e,t,n,r,o){return'\t\t\t<button class="button-reset pull-right">'+e.escapeExpression(e.lambda(null!=t?t.resetTXT:t,t))+"</button>\n"},13:function(e,t,n,r,o){return'\t\t<span class="icon-loading-small pull-right"></span>\n\t\t<span class="pull-right">'+e.escapeExpression(e.lambda(null!=t?t.savingTXT:t,t))+"</span>\n\t"},15:function(e,t,n,r,o){var a;return null!=(a=n.if.call(null!=t?t:e.nullContext||{},null!=t?t.message:t,{name:"if",hash:{},fn:e.program(16,o,0),inverse:e.noop,data:o}))?a:""},16:function(e,t,n,r,o){var a,i=null!=t?t:e.nullContext||{};return'\n\t\t<span class="msg pull-right '+(null!=(a=n.if.call(i,null!=t?t.errorMessage:t,{name:"if",hash:{},fn:e.program(17,o,0),inverse:e.program(19,o,0),data:o}))?a:"")+'">\n\t\t\t\t\t'+e.escapeExpression(e.lambda(null!=t?t.message:t,t))+(null!=(a=n.if.call(i,null!=t?t.errorMessage:t,{name:"if",hash:{},fn:e.program(21,o,0),inverse:e.noop,data:o}))?a:"")+"\n\t\t\t\t</span>\n\t"},17:function(e,t,n,r,o){return"error"},19:function(e,t,n,r,o){return"success"},21:function(e,t,n,r,o){return" "+e.escapeExpression(e.lambda(null!=t?t.errorMessage:t,t))},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,o,a,i){var l,s=null!=t?t:e.nullContext||{},u=e.lambda,c=e.escapeExpression;return'<div class="operation'+(null!=(l=n.if.call(s,null!=t?t.hasChanged:t,{name:"if",hash:{},fn:e.program(1,o,0,a,i),inverse:e.noop,data:o}))?l:"")+'">\n\t<div class="operation-header">\n\t\t<input type="text" class="operation-name" placeholder="'+c(u(null!=t?t.shortRuleDescTXT:t,t))+'" value="'+c(u(null!=(l=null!=t?t.operation:t)?l.name:l,t))+'" />\n\t\t<input type="text" class="operation-operation" value="'+c(u(null!=(l=null!=t?t.operation:t)?l.operation:l,t))+'" />\n'+(null!=(l=n.if.call(s,null!=(l=null!=t?t.operation:t)?l.id:l,{name:"if",hash:{},fn:e.program(3,o,0,a,i),inverse:e.noop,data:o}))?l:"")+'\t</div>\n\n\t<div class="checks">\n'+(null!=(l=n.each.call(s,null!=(l=null!=t?t.operation:t)?l.checks:l,{name:"each",hash:{},fn:e.program(5,o,0,a,i),inverse:e.noop,data:o}))?l:"")+'\t</div>\n\t<button class="button-add">'+c(u(null!=t?t.addRuleTXT:t,t))+"</button>\n"+(null!=(l=n.if.call(s,null!=t?t.hasChanged:t,{name:"if",hash:{},fn:e.program(10,o,0,a,i),inverse:e.noop,data:o}))?l:"")+(null!=(l=n.if.call(s,null!=t?t.saving:t,{name:"if",hash:{},fn:e.program(13,o,0,a,i),inverse:e.program(15,o,0,a,i),data:o}))?l:"")+"\n</div>\n"},useData:!0,useDepths:!0})},function(e,t,n){var r=n(2);e.exports=(r.default||r).template({compiler:[7,">= 4.0.0"],main:function(e,t,n,r,o){var a;return'<div class="operations"></div>\n<button class="button-add-operation">'+e.escapeExpression("function"==typeof(a=null!=(a=n.addRuleGroupTXT||(null!=t?t.addRuleGroupTXT:t))?a:n.helperMissing)?a.call(null!=t?t:e.nullContext||{},{name:"addRuleGroupTXT",hash:{},data:o}):a)+"</button>\n"},useData:!0})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}t.__esModule=!0;var a=o(n(3)),i=r(n(19)),l=r(n(1)),s=o(n(0)),u=o(n(20)),c=r(n(21));function f(){var e=new a.HandlebarsEnvironment;return s.extend(e,a),e.SafeString=i.default,e.Exception=l.default,e.Utils=s,e.escapeExpression=s.escapeExpression,e.VM=u,e.template=function(t){return u.template(t,e)},e}var d=f();d.create=f,c.default(d),d.default=d,t.default=d,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.registerDefaultHelpers=function(e){o.default(e),a.default(e),i.default(e),l.default(e),s.default(e),u.default(e),c.default(e)};var o=r(n(9)),a=r(n(10)),i=r(n(11)),l=r(n(12)),s=r(n(13)),u=r(n(14)),c=r(n(15))},function(e,t,n){"use strict";t.__esModule=!0;var r=n(0);t.default=function(e){e.registerHelper("blockHelperMissing",function(t,n){var o=n.inverse,a=n.fn;if(!0===t)return a(this);if(!1===t||null==t)return o(this);if(r.isArray(t))return t.length>0?(n.ids&&(n.ids=[n.name]),e.helpers.each(t,n)):o(this);if(n.data&&n.ids){var i=r.createFrame(n.data);i.contextPath=r.appendContextPath(n.data.contextPath,n.name),n={data:i}}return a(t,n)})},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var r,o=n(0),a=n(1),i=(r=a)&&r.__esModule?r:{default:r};t.default=function(e){e.registerHelper("each",function(e,t){if(!t)throw new i.default("Must pass iterator to #each");var n=t.fn,r=t.inverse,a=0,l="",s=void 0,u=void 0;function c(t,r,a){s&&(s.key=t,s.index=r,s.first=0===r,s.last=!!a,u&&(s.contextPath=u+t)),l+=n(e[t],{data:s,blockParams:o.blockParams([e[t],t],[u+t,null])})}if(t.data&&t.ids&&(u=o.appendContextPath(t.data.contextPath,t.ids[0])+"."),o.isFunction(e)&&(e=e.call(this)),t.data&&(s=o.createFrame(t.data)),e&&"object"==typeof e)if(o.isArray(e))for(var f=e.length;a<f;a++)a in e&&c(a,a,a===e.length-1);else{var d=void 0;for(var p in e)e.hasOwnProperty(p)&&(void 0!==d&&c(d,a-1),d=p,a++);void 0!==d&&c(d,a-1,!0)}return 0===a&&(l=r(this)),l})},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var r,o=n(1),a=(r=o)&&r.__esModule?r:{default:r};t.default=function(e){e.registerHelper("helperMissing",function(){if(1!==arguments.length)throw new a.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var r=n(0);t.default=function(e){e.registerHelper("if",function(e,t){return r.isFunction(e)&&(e=e.call(this)),!t.hash.includeZero&&!e||r.isEmpty(e)?t.inverse(this):t.fn(this)}),e.registerHelper("unless",function(t,n){return e.helpers.if.call(this,t,{fn:n.inverse,inverse:n.fn,hash:n.hash})})},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e){e.registerHelper("log",function(){for(var t=[void 0],n=arguments[arguments.length-1],r=0;r<arguments.length-1;r++)t.push(arguments[r]);var o=1;null!=n.hash.level?o=n.hash.level:n.data&&null!=n.data.level&&(o=n.data.level),t[0]=o,e.log.apply(e,t)})},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e){e.registerHelper("lookup",function(e,t){return e?"constructor"!==t||e.propertyIsEnumerable(t)?e[t]:void 0:e})},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var r=n(0);t.default=function(e){e.registerHelper("with",function(e,t){r.isFunction(e)&&(e=e.call(this));var n=t.fn;if(r.isEmpty(e))return t.inverse(this);var o=t.data;return t.data&&t.ids&&((o=r.createFrame(t.data)).contextPath=r.appendContextPath(t.data.contextPath,t.ids[0])),n(e,{data:o,blockParams:r.blockParams([e],[o&&o.contextPath])})})},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.registerDefaultDecorators=function(e){a.default(e)};var r,o=n(17),a=(r=o)&&r.__esModule?r:{default:r}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(0);t.default=function(e){e.registerDecorator("inline",function(e,t,n,o){var a=e;return t.partials||(t.partials={},a=function(o,a){var i=n.partials;n.partials=r.extend({},i,t.partials);var l=e(o,a);return n.partials=i,l}),t.partials[o.args[0]]=o.fn,a})},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var r=n(0),o={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(e){if("string"==typeof e){var t=r.indexOf(o.methodMap,e.toLowerCase());e=t>=0?t:parseInt(e,10)}return e},log:function(e){if(e=o.lookupLevel(e),"undefined"!=typeof console&&o.lookupLevel(o.level)<=e){var t=o.methodMap[e];console[t]||(t="log");for(var n=arguments.length,r=Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];console[t].apply(console,r)}}};t.default=o,e.exports=t.default},function(e,t,n){"use strict";function r(e){this.string=e}t.__esModule=!0,r.prototype.toString=r.prototype.toHTML=function(){return""+this.string},t.default=r,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.checkRevision=function(e){var t=e&&e[0]||1,n=l.COMPILER_REVISION;if(t!==n){if(t<n){var r=l.REVISION_CHANGES[n],o=l.REVISION_CHANGES[t];throw new i.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+r+") or downgrade your runtime to an older version ("+o+").")}throw new i.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+e[1]+").")}},t.template=function(e,t){if(!t)throw new i.default("No environment passed to template");if(!e||!e.main)throw new i.default("Unknown template object: "+typeof e);e.main.decorator=e.main_d,t.VM.checkRevision(e.compiler);var n={strict:function(e,t){if(!(t in e))throw new i.default('"'+t+'" not defined in '+e);return e[t]},lookup:function(e,t){for(var n=e.length,r=0;r<n;r++)if(e[r]&&null!=e[r][t])return e[r][t]},lambda:function(e,t){return"function"==typeof e?e.call(t):e},escapeExpression:o.escapeExpression,invokePartial:function(n,r,a){a.hash&&(r=o.extend({},r,a.hash),a.ids&&(a.ids[0]=!0)),n=t.VM.resolvePartial.call(this,n,r,a);var l=t.VM.invokePartial.call(this,n,r,a);if(null==l&&t.compile&&(a.partials[a.name]=t.compile(n,e.compilerOptions,t),l=a.partials[a.name](r,a)),null!=l){if(a.indent){for(var s=l.split("\n"),u=0,c=s.length;u<c&&(s[u]||u+1!==c);u++)s[u]=a.indent+s[u];l=s.join("\n")}return l}throw new i.default("The partial "+a.name+" could not be compiled when running in runtime-only mode")},fn:function(t){var n=e[t];return n.decorator=e[t+"_d"],n},programs:[],program:function(e,t,n,r,o){var a=this.programs[e],i=this.fn(e);return t||o||r||n?a=s(this,e,i,t,n,r,o):a||(a=this.programs[e]=s(this,e,i)),a},data:function(e,t){for(;e&&t--;)e=e._parent;return e},merge:function(e,t){var n=e||t;return e&&t&&e!==t&&(n=o.extend({},t,e)),n},nullContext:Object.seal({}),noop:t.VM.noop,compilerInfo:e.compiler};function r(t){var o=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],a=o.data;r._setup(o),!o.partial&&e.useData&&(a=function(e,t){t&&"root"in t||((t=t?l.createFrame(t):{}).root=e);return t}(t,a));var i=void 0,s=e.useBlockParams?[]:void 0;function u(t){return""+e.main(n,t,n.helpers,n.partials,a,s,i)}return e.useDepths&&(i=o.depths?t!=o.depths[0]?[t].concat(o.depths):o.depths:[t]),(u=c(e.main,u,n,o.depths||[],a,s))(t,o)}return r.isTop=!0,r._setup=function(r){r.partial?(n.helpers=r.helpers,n.partials=r.partials,n.decorators=r.decorators):(n.helpers=n.merge(r.helpers,t.helpers),e.usePartial&&(n.partials=n.merge(r.partials,t.partials)),(e.usePartial||e.useDecorators)&&(n.decorators=n.merge(r.decorators,t.decorators)))},r._child=function(t,r,o,a){if(e.useBlockParams&&!o)throw new i.default("must pass block params");if(e.useDepths&&!a)throw new i.default("must pass parent depths");return s(n,t,e[t],r,0,o,a)},r},t.wrapProgram=s,t.resolvePartial=function(e,t,n){e?e.call||n.name||(n.name=e,e=n.partials[e]):e="@partial-block"===n.name?n.data["partial-block"]:n.partials[n.name];return e},t.invokePartial=function(e,t,n){var r=n.data&&n.data["partial-block"];n.partial=!0,n.ids&&(n.data.contextPath=n.ids[0]||n.data.contextPath);var a=void 0;n.fn&&n.fn!==u&&function(){n.data=l.createFrame(n.data);var e=n.fn;a=n.data["partial-block"]=function(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return n.data=l.createFrame(n.data),n.data["partial-block"]=r,e(t,n)},e.partials&&(n.partials=o.extend({},n.partials,e.partials))}();void 0===e&&a&&(e=a);if(void 0===e)throw new i.default("The partial "+n.name+" could not be found");if(e instanceof Function)return e(t,n)},t.noop=u;var r,o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),a=n(1),i=(r=a)&&r.__esModule?r:{default:r},l=n(3);function s(e,t,n,r,o,a,i){function l(t){var o=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],l=i;return!i||t==i[0]||t===e.nullContext&&null===i[0]||(l=[t].concat(i)),n(e,t,e.helpers,e.partials,o.data||r,a&&[o.blockParams].concat(a),l)}return(l=c(n,l,e,i,r,a)).program=t,l.depth=i?i.length:0,l.blockParams=o||0,l}function u(){return""}function c(e,t,n,r,a,i){if(e.decorator){var l={};t=e.decorator(t,l,n,r&&r[0],a,i,r),o.extend(t,l)}return t}},function(e,t,n){"use strict";(function(n){t.__esModule=!0,t.default=function(e){var t=void 0!==n?n:window,r=t.Handlebars;e.noConflict=function(){return t.Handlebars===e&&(t.Handlebars=r),e}},e.exports=t.default}).call(this,n(22))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){e.exports=function(e){var t=OCA.WorkflowEngine.getCheckByClass(e);return _.isUndefined(t)?[]:t.operators}},function(e,n){OCA.WorkflowEngine=OCA.WorkflowEngine||{},OCA.WorkflowEngine.Plugins=OCA.WorkflowEngine.Plugins||{},OCA.WorkflowEngine.Plugins.FileMimeTypePlugin={getCheck:function(){return{class:"OCA\\WorkflowEngine\\Check\\FileMimeType",name:t("workflowengine","File MIME type"),operators:[{operator:"is",name:t("workflowengine","is")},{operator:"!is",name:t("workflowengine","is not")},{operator:"matches",name:t("workflowengine","matches")},{operator:"!matches",name:t("workflowengine","does not match")}]}},render:function(e,n){if("OCA\\WorkflowEngine\\Check\\FileMimeType"===n.class){var r="text/plain";"matches"!==n.operator&&"!matches"!==n.operator||(r="/^text\\/(plain|html)$/i",this._validateRegex(n.value)?$(e).removeClass("invalid-input"):$(e).addClass("invalid-input")),$(e).css("width","250px").attr("placeholder",r).attr("title",t("workflowengine","Example: {placeholder}",{placeholder:r})).addClass("has-tooltip").tooltip({placement:"bottom"})}},_validateRegex:function(e){return null!==/^\/(.*)\/([gui]{0,3})$/.exec(e)}},OC.Plugins.register("OCA.WorkflowEngine.CheckPlugins",OCA.WorkflowEngine.Plugins.FileMimeTypePlugin)},function(e,n){OCA.WorkflowEngine=OCA.WorkflowEngine||{},OCA.WorkflowEngine.Plugins=OCA.WorkflowEngine.Plugins||{},OCA.WorkflowEngine.Plugins.FileNamePlugin={getCheck:function(){return{class:"OCA\\WorkflowEngine\\Check\\FileName",name:t("workflowengine","File name"),operators:[{operator:"is",name:t("workflowengine","is")},{operator:"!is",name:t("workflowengine","is not")},{operator:"matches",name:t("workflowengine","matches")},{operator:"!matches",name:t("workflowengine","does not match")}]}},render:function(e,n){if("OCA\\WorkflowEngine\\Check\\FileName"===n.class){var r="dummy.jpg";"matches"!==n.operator&&"!matches"!==n.operator||(r="/^dummy-.+$/i",this._validateRegex(n.value)?$(e).removeClass("invalid-input"):$(e).addClass("invalid-input")),$(e).css("width","250px").attr("placeholder",r).attr("title",t("workflowengine","Example: {placeholder}",{placeholder:r})).addClass("has-tooltip").tooltip({placement:"bottom"})}},_validateRegex:function(e){return null!==/^\/(.*)\/([gui]{0,3})$/.exec(e)}},OC.Plugins.register("OCA.WorkflowEngine.CheckPlugins",OCA.WorkflowEngine.Plugins.FileNamePlugin)},function(e,n){OCA.WorkflowEngine=OCA.WorkflowEngine||{},OCA.WorkflowEngine.Plugins=OCA.WorkflowEngine.Plugins||{},OCA.WorkflowEngine.Plugins.FileSizePlugin={getCheck:function(){return{class:"OCA\\WorkflowEngine\\Check\\FileSize",name:t("workflowengine","File size (upload)"),operators:[{operator:"less",name:t("workflowengine","less")},{operator:"!greater",name:t("workflowengine","less or equals")},{operator:"!less",name:t("workflowengine","greater or equals")},{operator:"greater",name:t("workflowengine","greater")}]}},render:function(e,n){"OCA\\WorkflowEngine\\Check\\FileSize"===n.class&&$(e).css("width","250px").attr("placeholder","12 MB").attr("title",t("workflowengine","Example: {placeholder}",{placeholder:"12 MB"})).addClass("has-tooltip").tooltip({placement:"bottom"})}},OC.Plugins.register("OCA.WorkflowEngine.CheckPlugins",OCA.WorkflowEngine.Plugins.FileSizePlugin)},function(e,n){OCA.WorkflowEngine=OCA.WorkflowEngine||{},OCA.WorkflowEngine.Plugins=OCA.WorkflowEngine.Plugins||{},OCA.WorkflowEngine.Plugins.FileSystemTagsPlugin={getCheck:function(){return this.collection=OC.SystemTags.collection,{class:"OCA\\WorkflowEngine\\Check\\FileSystemTags",name:t("workflowengine","File system tag"),operators:[{operator:"is",name:t("workflowengine","is tagged with")},{operator:"!is",name:t("workflowengine","is not tagged with")}]}},render:function(e,n){"OCA\\WorkflowEngine\\Check\\FileSystemTags"===n.class&&($(e).css("width","400px"),$(e).select2({allowClear:!1,multiple:!1,placeholder:t("workflowengine","Select tag…"),query:_.debounce(function(e){e.callback({results:OC.SystemTags.collection.filterByName(e.term)})},100,!0),id:function(e){return e.get("id")},initSelection:function(e,t){t($(e).val())},formatResult:function(e){return OC.SystemTags.getDescriptiveTag(e)},formatSelection:function(e){var t=OC.SystemTags.collection.get(e);if(!_.isUndefined(t))return OC.SystemTags.getDescriptiveTag(t)},escapeMarkup:function(e){return e}}))}},OC.Plugins.register("OCA.WorkflowEngine.CheckPlugins",OCA.WorkflowEngine.Plugins.FileSystemTagsPlugin)},function(e,n){OCA.WorkflowEngine=OCA.WorkflowEngine||{},OCA.WorkflowEngine.Plugins=OCA.WorkflowEngine.Plugins||{},OCA.WorkflowEngine.Plugins.RequestRemoteAddressPlugin={getCheck:function(){return{class:"OCA\\WorkflowEngine\\Check\\RequestRemoteAddress",name:t("workflowengine","Request remote address"),operators:[{operator:"matchesIPv4",name:t("workflowengine","matches IPv4")},{operator:"!matchesIPv4",name:t("workflowengine","does not match IPv4")},{operator:"matchesIPv6",name:t("workflowengine","matches IPv6")},{operator:"!matchesIPv6",name:t("workflowengine","does not match IPv6")}]}},render:function(e,n){if("OCA\\WorkflowEngine\\Check\\RequestRemoteAddress"===n.class){var r="127.0.0.1/32";"matchesIPv6"===n.operator||"!matchesIPv6"===n.operator?(r="::1/128",this._validateIPv6(n.value)?$(e).removeClass("invalid-input"):$(e).addClass("invalid-input")):this._validateIPv4(n.value)?$(e).removeClass("invalid-input"):$(e).addClass("invalid-input"),$(e).css("width","300px").attr("placeholder",r).attr("title",t("workflowengine","Example: {placeholder}",{placeholder:r})).addClass("has-tooltip").tooltip({placement:"bottom"})}},_validateIPv4:function(e){return null!==/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/(3[0-2]|[1-2][0-9]|[1-9])$/.exec(e)},_validateIPv6:function(e){return null!==/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(1([01][0-9]|2[0-8])|[1-9][0-9]|[0-9])$/.exec(e)}},OC.Plugins.register("OCA.WorkflowEngine.CheckPlugins",OCA.WorkflowEngine.Plugins.RequestRemoteAddressPlugin)},function(e,n){OCA.WorkflowEngine=OCA.WorkflowEngine||{},OCA.WorkflowEngine.Plugins=OCA.WorkflowEngine.Plugins||{},OCA.WorkflowEngine.Plugins.RequestTimePlugin={timezones:["Europe/Berlin","Europe/London"],_$element:null,getCheck:function(){return{class:"OCA\\WorkflowEngine\\Check\\RequestTime",name:t("workflowengine","Request time"),operators:[{operator:"in",name:t("workflowengine","between")},{operator:"!in",name:t("workflowengine","not between")}]}},render:function(e,n){if("OCA\\WorkflowEngine\\Check\\RequestTime"===n.class){var r="09:00",o="18:00",a=jstz.determine().name(),i=$(e);if(_.isString(n.value)&&""!==n.value){var l=JSON.parse(n.value),s=l[0].split(" ",2),u=l[1].split(" ",2);r=s[0],o=u[0],a=s[1]}var c=JSON.stringify([r+" "+a,o+" "+a]);n.value!==c&&(n.value=c,i.val(c)),i.css("display","none"),$("<input>").attr("type","text").attr("placeholder",t("workflowengine","Start")).attr("title",t("workflowengine","Example: {placeholder}",{placeholder:"16:00"})).addClass("has-tooltip").tooltip({placement:"bottom"}).addClass("start").val(r).insertBefore(i),$("<input>").attr("type","text").attr("placeholder",t("workflowengine","End")).attr("title",t("workflowengine","Example: {placeholder}",{placeholder:"16:00"})).addClass("has-tooltip").tooltip({placement:"bottom"}).addClass("end").val(o).insertBefore(i);var f=$("<input>").attr("type","hidden").css("width","250px").insertBefore(i).val(a);f.select2({allowClear:!1,multiple:!1,placeholder:t("workflowengine","Select timezone…"),ajax:{url:OC.generateUrl("apps/workflowengine/timezones"),dataType:"json",quietMillis:100,data:function(e){return""===e&&(e=(e=jstz.determine().name().split("/"))[0]),{search:e}},results:function(e){var t=[];return $.each(e,function(e){t.push({id:e})}),{results:t,more:!1}}},initSelection:function(e,t){t(e.val())},formatResult:function(e){return"<span>"+e.id+"</span>"},formatSelection:function(e){return _.isUndefined(e.id)||(e=e.id),"<span>"+e+"</span>"}}),f.addClass("timezone"),i.parent().on("change",".start",_.bind(this.update,this)).on("change",".end",_.bind(this.update,this)).on("change",".timezone",_.bind(this.update,this)),this._$element=i}},update:function(e){for(var t=e.target.value,n=null,r=0;r<e.target.classList.length;r++)n=e.target.classList[r];if(null!==n){var o=JSON.parse(this._$element.val()),a=moment(o[0].split(" ",2)[0],"H:m Z"),i=moment(o[1].split(" ",2)[0],"H:m Z"),l=o[0].split(" ",2)[1];if("start"===n||"end"===n){var s=moment(t,["H:m","h:m a"],!0).format("HH:mm");if("Invalid date"===s)return;var u=0;"end"===n&&(u=1),o[u]=s+" "+l}"timezone"===n&&(o[0]=a.format("HH:mm")+" "+t,o[1]=i.format("HH:mm")+" "+t),this._$element.val(JSON.stringify(o)),this._$element.trigger("change")}else console.warn("update triggered but element doesn't have any class")}},OC.Plugins.register("OCA.WorkflowEngine.CheckPlugins",OCA.WorkflowEngine.Plugins.RequestTimePlugin)},function(e,n){OCA.WorkflowEngine=OCA.WorkflowEngine||{},OCA.WorkflowEngine.Plugins=OCA.WorkflowEngine.Plugins||{},OCA.WorkflowEngine.Plugins.RequestURLPlugin={predefinedValues:["webdav"],getCheck:function(){return{class:"OCA\\WorkflowEngine\\Check\\RequestURL",name:t("workflowengine","Request URL"),operators:[{operator:"is",name:t("workflowengine","is")},{operator:"!is",name:t("workflowengine","is not")},{operator:"matches",name:t("workflowengine","matches")},{operator:"!matches",name:t("workflowengine","does not match")}]}},render:function(e,n){if("OCA\\WorkflowEngine\\Check\\RequestURL"===n.class){var r="https://localhost/index.php";if("matches"!==n.operator&&"!matches"!==n.operator||(r="/^https\\:\\/\\/localhost\\/index\\.php$/i"),$(e).css("width","250px").attr("placeholder",r).attr("title",t("workflowengine","Example: {placeholder}",{placeholder:r})).addClass("has-tooltip").tooltip({placement:"bottom"}),"matches"===n.operator||"!matches"===n.operator)this._validateRegex(n.value)?$(e).removeClass("invalid-input"):$(e).addClass("invalid-input");else{var o=this,a=[{text:t("workflowengine","Predefined URLs"),children:[{id:"webdav",text:t("workflowengine","Files WebDAV")}]}];-1===this.predefinedValues.indexOf(n.value)&&a.unshift({id:n.value,text:n.value}),$(e).select2({data:a,createSearchChoice:function(e){if(-1===o.predefinedValues.indexOf(n.value))return{id:e,text:e}},id:function(e){return e.id},formatResult:function(e){return e.text},formatSelection:function(e){return e.text},escapeMarkup:function(e){return e}})}}},_validateRegex:function(e){return null!==/^\/(.*)\/([gui]{0,3})$/.exec(e)}},OC.Plugins.register("OCA.WorkflowEngine.CheckPlugins",OCA.WorkflowEngine.Plugins.RequestURLPlugin)},function(e,n){OCA.WorkflowEngine=OCA.WorkflowEngine||{},OCA.WorkflowEngine.Plugins=OCA.WorkflowEngine.Plugins||{},OCA.WorkflowEngine.Plugins.RequestUserAgentPlugin={predefinedValues:["android","ios","desktop"],getCheck:function(){return{class:"OCA\\WorkflowEngine\\Check\\RequestUserAgent",name:t("workflowengine","Request user agent"),operators:[{operator:"is",name:t("workflowengine","is")},{operator:"!is",name:t("workflowengine","is not")},{operator:"matches",name:t("workflowengine","matches")},{operator:"!matches",name:t("workflowengine","does not match")}]}},render:function(e,n){if("OCA\\WorkflowEngine\\Check\\RequestUserAgent"===n.class){var r="Mozilla/5.0 User Agent";if("matches"!==n.operator&&"!matches"!==n.operator||(r="/^Mozilla\\/5\\.0 (.*)$/i"),$(e).css("width","250px").attr("placeholder",r).attr("title",t("workflowengine","Example: {placeholder}",{placeholder:r})).addClass("has-tooltip").tooltip({placement:"bottom"}),"matches"===n.operator||"!matches"===n.operator)this._validateRegex(n.value)?$(e).removeClass("invalid-input"):$(e).addClass("invalid-input");else{var o=this,a=[{text:t("workflowengine","Sync clients"),children:[{id:"android",text:t("workflowengine","Android client")},{id:"ios",text:t("workflowengine","iOS client")},{id:"desktop",text:t("workflowengine","Desktop client")},{id:"mail",text:t("workflowengine","Thunderbird & Outlook addons")}]}];-1===this.predefinedValues.indexOf(n.value)&&a.unshift({id:n.value,text:n.value}),$(e).select2({data:a,createSearchChoice:function(e){if(-1===o.predefinedValues.indexOf(n.value))return{id:e,text:e}},id:function(e){return e.id},formatResult:function(e){return e.text},formatSelection:function(e){return e.text},escapeMarkup:function(e){return e}})}}},_validateRegex:function(e){return null!==/^\/(.*)\/([gui]{0,3})$/.exec(e)}},OC.Plugins.register("OCA.WorkflowEngine.CheckPlugins",OCA.WorkflowEngine.Plugins.RequestUserAgentPlugin)},function(e,n){OCA.WorkflowEngine=OCA.WorkflowEngine||{},OCA.WorkflowEngine.Plugins=OCA.WorkflowEngine.Plugins||{},OCA.WorkflowEngine.Plugins.UserGroupMembershipPlugin={getCheck:function(){return{class:"OCA\\WorkflowEngine\\Check\\UserGroupMembership",name:t("workflowengine","User group membership"),operators:[{operator:"is",name:t("workflowengine","is member of")},{operator:"!is",name:t("workflowengine","is not member of")}]}},render:function(e,t,n){"OCA\\WorkflowEngine\\Check\\UserGroupMembership"===t.class&&($(e).css("width","400px"),$(e).select2({data:{results:n,text:"displayname"},initSelection:function(e,t){var r=e.val();r&&n.length>0?t({id:r,displayname:n.find(function(e){return e.id===r}).displayname}):r?t({id:r,displayname:r}):t()},formatResult:function(e){return"<span>"+escapeHTML(e.displayname)+"</span>"},formatSelection:function(e){return'<span title="'+escapeHTML(e.id)+'">'+escapeHTML(e.displayname)+"</span>"}}))}},OC.Plugins.register("OCA.WorkflowEngine.CheckPlugins",OCA.WorkflowEngine.Plugins.UserGroupMembershipPlugin)},function(e,n,r){"use strict";r.r(n);var o=r(5),a=r.n(o),i=r(6),l=r.n(i);OCA.WorkflowEngine=_.extend(OCA.WorkflowEngine||{},{availablePlugins:[],availableChecks:[],getCheckByClass:function(e){for(var t=OCA.WorkflowEngine.availableChecks.length,n=0;n<t;n++)if(OCA.WorkflowEngine.availableChecks[n].class===e)return OCA.WorkflowEngine.availableChecks[n]}}),OCA.WorkflowEngine.Operation=OC.Backbone.Model.extend({defaults:{class:"OCA\\WorkflowEngine\\Operation",name:"",checks:[],operation:""}}),OCA.WorkflowEngine.OperationsCollection=OC.Backbone.Collection.extend({model:OCA.WorkflowEngine.Operation,url:OC.generateUrl("apps/workflowengine/operations")}),OCA.WorkflowEngine.OperationView=OC.Backbone.View.extend({templateId:"#operation-template",events:{"change .check-class":"checkChanged","change .check-operator":"checkChanged","change .check-value":"checkChanged","change .operation-name":"operationChanged","change .operation-operation":"operationChanged","click .button-reset":"reset","click .button-save":"save","click .button-add":"add","click .button-delete":"delete","click .button-delete-check":"deleteCheck"},originalModel:null,hasChanged:!1,message:"",errorMessage:"",saving:!1,groups:[],template:function(e){return a()(_.extend({shortRuleDescTXT:t("workflowengine","Short rule description"),addRuleTXT:t("workflowengine","Add rule"),resetTXT:t("workflowengine","Reset"),saveTXT:t("workflowengine","Save"),savingTXT:t("workflowengine","Saving…")},e))},initialize:function(){this.originalModel=JSON.parse(JSON.stringify(this.model)),this.model.on("change",function(){console.log("model changed"),this.hasChanged=!0,this.render()},this),void 0===this.model.get("id")&&(this.hasChanged=!0);var e=this;$.ajax({url:OC.linkToOCS("cloud/groups",2)+"details",dataType:"json",quietMillis:100}).success(function(n){n.ocs.data.groups&&n.ocs.data.groups.length>0?(n.ocs.data.groups.forEach(function(t){e.groups.push({id:t.id,displayname:t.displayname})}),e.render()):(OC.Notification.error(t("workflowengine","Group list is empty"),{type:"error"}),console.log(n))}).error(function(e){OC.Notification.error(t("workflowengine","Unable to retrieve the group list"),{type:"error"}),console.log(e)})},delete:function(){OC.PasswordConfirmation.requiresPasswordConfirmation()?OC.PasswordConfirmation.requirePasswordConfirmation(_.bind(this.delete,this)):(this.model.destroy(),this.remove())},reset:function(){this.hasChanged=!1,this.model.set(this.originalModel,{silent:!0}),this.render()},save:function(){OC.PasswordConfirmation.requiresPasswordConfirmation()?OC.PasswordConfirmation.requirePasswordConfirmation(_.bind(this.save,this)):(this.hasChanged=!1,this.saving=!0,this.render(),this.model.save(null,{success:function(e,n,r){this.saving=!1,this.originalModel=JSON.parse(JSON.stringify(this.model)),this.message=t("workflowengine","Saved"),this.errorMessage="",this.render()},error:function(e,n,r){this.saving=!1,this.hasChanged=!0,this.message=t("workflowengine","Saving failed:"),this.errorMessage=n.responseText,this.render()},context:this}))},add:function(){var e=_.clone(this.model.get("checks")),t=OCA.WorkflowEngine.availableChecks[0].class,n=OCA.WorkflowEngine.availableChecks[0].operators;e.push({class:t,operator:n[0].operator,value:""}),this.model.set({checks:e})},checkChanged:function(e){for(var t=e.target.value,n=$(e.target.parentElement).data("id"),r=JSON.parse(JSON.stringify(this.model.get("checks"))),o=null,a=0;a<e.target.classList.length;a++){var i=e.target.classList[a];if("check-"===i.substr(0,"check-".length)){o=i.substr("check-".length);break}}if(null!==o)if(_.has(r[n],o)){if(r[n][o]=t,"class"===o){var l=OCA.WorkflowEngine.getCheckByClass(t);_.isUndefined(l)||(r[n].operator=l.operators[0].operator,r[n].value="")}this.model.set({checks:r})}else console.warn('key "'+o+'" is not available in check',l);else console.warn('checkChanged triggered but element doesn\'t have any "check-" class')},deleteCheck:function(e){console.log(arguments);var t=$(e.target.parentElement).data("id"),n=JSON.parse(JSON.stringify(this.model.get("checks")));n.splice(t,1),this.model.set({checks:n})},operationChanged:function(e){for(var t=e.target.value,n=null,r=0;r<e.target.classList.length;r++){var o=e.target.classList[r];if("operation-"===o.substr(0,"operation-".length)){n=o.substr("operation-".length);break}}null!==n?"name"===n||"operation"===n?this.model.set(n,t):console.warn('key "'+n+'" is no valid attribute'):console.warn('operationChanged triggered but element doesn\'t have any "operation-" class')},render:function(){this.$el.html(this.template({operation:this.model.toJSON(),classes:OCA.WorkflowEngine.availableChecks,hasChanged:this.hasChanged,message:this.message,errorMessage:this.errorMessage,saving:this.saving}));var e=this.model.get("checks");return _.each(this.$el.find(".check"),function(t){var n=$(t),r=n.data("id"),o=e[r],a=n.find(".check-value").first(),i=this;_.each(OCA.WorkflowEngine.availablePlugins,function(e){_.isFunction(e.render)&&e.render(a,o,i.groups)})},this),""!==this.message&&(_.delay(function(e){$(e).css("opacity",0)},7e3,this.$el.find(".msg.success")),this.message=""),this.$el}}),OCA.WorkflowEngine.OperationsView=OC.Backbone.View.extend({templateId:"#operations-template",collection:null,$el:null,events:{"click .button-add-operation":"add"},template:function(e){return l()(_.extend({addRuleGroupTXT:t("workflowengine","Add rule group")},e))},initialize:function(e){OCA.WorkflowEngine.availablePlugins.length||(OCA.WorkflowEngine.availablePlugins=OC.Plugins.getPlugins("OCA.WorkflowEngine.CheckPlugins"),_.each(OCA.WorkflowEngine.availablePlugins,function(t){_.isFunction(t.getCheck)&&OCA.WorkflowEngine.availableChecks.push(t.getCheck(e))})),this.collection.fetch({data:{class:e}}),this.collection.once("sync",this.render,this)},add:function(){var e=this.collection.create();this.renderOperation(e)},renderOperation:function(e){this.$el.find(".operations").append(e.$el),e.render()},render:function(){this.$el.html(this.template()),this.collection.each(this.renderOperation,this)}});r(24),r(25),r(26),r(27),r(28),r(29),r(30),r(31),r(32);window.OCA.WorkflowEngine=OCA.WorkflowEngine}]);
|
|
//# sourceMappingURL=workflowengine.js.map
|