ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sneet...@apache.org
Subject [44/51] [partial] ARGUS-2 : Uploading eclipse support files and additional lib/js files
Date Thu, 14 Aug 2014 22:09:23 GMT
http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/185f7c50/security-admin/src/main/webapp/libs/bower/backbone-pageable/js/backbone-pageable.min.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/libs/bower/backbone-pageable/js/backbone-pageable.min.js
b/security-admin/src/main/webapp/libs/bower/backbone-pageable/js/backbone-pageable.min.js
new file mode 100644
index 0000000..78f32fd
--- /dev/null
+++ b/security-admin/src/main/webapp/libs/bower/backbone-pageable/js/backbone-pageable.min.js
@@ -0,0 +1,8 @@
+/*
+  backbone-pageable 1.3.2
+  http://github.com/wyuenho/backbone-pageable
+
+  Copyright (c) 2013 Jimmy Yuen Ho Wong
+  Licensed under the MIT @license.
+*/
+!function(a){if("object"==typeof exports)module.exports=a(require("underscore"),require("backbone"));else
if("function"==typeof define&&define.amd)define(["underscore","backbone"],a);else
if("undefined"!=typeof _&&"undefined"!=typeof Backbone){var b=Backbone.PageableCollection,c=a(_,Backbone);Backbone.PageableCollection.noConflict=function(){return
Backbone.PageableCollection=b,c}}}(function(a,b){"use strict";function c(b,c){if(!a.isNumber(b)||a.isNaN(b)||!a.isFinite(b)||~~b!==b)throw
new TypeError("`"+c+"` must be a finite integer");return b}function d(a){for(var b,c,d,e,f={},g=decodeURIComponent,h=a.split("&"),i=0,j=h.length;j>i;i++){var
k=h[i];b=k.split("="),c=b[0],d=b[1]||!0,c=g(c),e=f[c],n(e)?e.push(d):f[c]=e?[e,d]:d}return
f}var e=a.extend,f=a.omit,g=a.clone,h=a.each,i=a.pick,j=a.contains,k=a.isEmpty,l=a.pairs,m=a.invert,n=a.isArray,o=a.isFunction,p=a.isObject,q=a.keys,r=a.isUndefined,s=a.result,t=Math.ceil,u=Math.floor,v=Math.max,w=b.Collection.prototype,x=/[\s'"]/g,y=/[<>\s'
 "]/g,z=b.PageableCollection=b.Collection.extend({state:{firstPage:1,lastPage:null,currentPage:null,pageSize:25,totalPages:null,totalRecords:null,sortKey:null,order:-1},mode:"server",queryParams:{currentPage:"page",pageSize:"per_page",totalPages:"total_pages",totalRecords:"total_entries",sortKey:"sort_by",order:"order",directions:{"-1":"asc",1:"desc"}},constructor:function(a,c){b.Collection.apply(this,arguments),c=c||{};var
d=this.mode=c.mode||this.mode||A.mode,f=e({},A.queryParams,this.queryParams,c.queryParams||{});f.directions=e({},A.queryParams.directions,this.queryParams.directions,f.directions||{}),this.queryParams=f;var
h=this.state=e({},A.state,this.state,c.state||{});h.currentPage=null==h.currentPage?h.firstPage:h.currentPage,n(a)||(a=a?[a]:[]),"server"==d||null!=h.totalRecords||k(a)||(h.totalRecords=a.length),this.switchMode(d,e({fetch:!1,resetState:!1,models:a},c));var
i=c.comparator;if(h.sortKey&&!i&&this.setSorting(h.sortKey,h.order,c),"server"!=d){var
j=this.fullCollect
 ion;i&&c.full&&(delete this.comparator,j.comparator=i),c.full&&j.sort(),a&&!k(a)&&(this.getPage(h.currentPage),a.splice.apply(a,[0,a.length].concat(this.models)))}this._initState=g(this.state)},_makeFullCollection:function(a,c){var
d,e,f,g=["url","model","sync","comparator"],h=this.constructor.prototype,i={};for(d=0,e=g.length;e>d;d++)f=g[d],r(h[f])||(i[f]=h[f]);var
j=new(b.Collection.extend(i))(a,c);for(d=0,e=g.length;e>d;d++)f=g[d],this[f]!==h[f]&&(j[f]=this[f]);return
j},_makeCollectionEventHandler:function(a,b){return function(c,d,f,i){var j=a._handlers;h(q(j),function(c){var
d=j[c];a.off(c,d),b.off(c,d)});var k=g(a.state),l=k.firstPage,m=0===l?k.currentPage:k.currentPage-1,n=k.pageSize,o=m*n,p=o+n;if("add"==c){var
s,u,v,w,i=i||{};if(f==b)u=b.indexOf(d),u>=o&&p>u&&(w=a,s=v=u-o);else{s=a.indexOf(d),u=o+s,w=b;var
v=r(i.at)?u:i.at+o}if(++k.totalRecords,a.state=a._checkState(k),w){w.add(d,e({},i||{},{at:v}));var
x=s>=n?d:!r(i.at)&&p>v&&a.length>n?a.at(n):null;if(x){var y=f._events.a
 dd||[],z={onAdd:!0};if(y.length){var A=y[y.length-1],B=A.callback;A.callback=function(){try{B.apply(this,arguments),a.remove(x,z)}finally{A.callback=B}}}else
a.remove(x,z)}}}if("remove"==c)if(i.onAdd)delete i.onAdd;else{if(--k.totalRecords){var C=k.totalPages=t(k.totalRecords/n);k.lastPage=0===l?C-1:C,k.currentPage>C&&(k.currentPage=k.lastPage)}else
k.totalRecords=null,k.totalPages=null;a.state=a._checkState(k);var D,E=i.index;f==a?((D=b.at(p))&&a.push(D),b.remove(d)):E>=o&&p>E&&(a.remove(d),D=b.at(m*(n+E)),D&&a.push(D))}if("reset"==c)if(i=f,f=d,f===a&&null==i.from&&null==i.to){var
F=b.models.slice(0,o),G=b.models.slice(o+a.models.length);b.reset(F.concat(a.models).concat(G),i)}else
f===b&&((k.totalRecords=b.models.length)||(k.totalRecords=null,k.totalPages=null),"client"==a.mode&&(k.lastPage=k.currentPage=k.firstPage),a.state=a._checkState(k),a.reset(b.models.slice(o,p),e({},i,{parse:!1})));"sort"==c&&(i=f,f=d,f===b&&a.reset(b.models.slice(o,p),e({},i,{parse:!1}))),h(q(j),function(
 c){var d=j[c];h([a,b],function(a){a.on(c,d);var b=a._events[c]||[];b.unshift(b.pop())})})}},_checkState:function(a){var
b=this.mode,d=this.links,e=a.totalRecords,f=a.pageSize,g=a.currentPage,h=a.firstPage,i=a.totalPages;if(null!=e&&null!=f&&null!=g&&null!=h&&("infinite"==b?d:!0)){if(e=c(e,"totalRecords"),f=c(f,"pageSize"),g=c(g,"currentPage"),h=c(h,"firstPage"),1>f)throw
new RangeError("`pageSize` must be >= 1");if(i=a.totalPages=t(e/f),0>h||h>1)throw
new RangeError("`firstPage must be 0 or 1`");if(a.lastPage=0===h?v(0,i-1):i,"infinite"==b){if(!d[g+""])throw
new RangeError("No link found for page "+g)}else if(h>g||i>0&&(h?g>i:g>=i))throw
new RangeError("`currentPage` must be firstPage <= currentPage "+(h?">":">=")+" totalPages
if "+h+"-based. Got "+g+".")}return a},setPageSize:function(a,b){a=c(a,"pageSize"),b=b||{first:!1};var
d=this.state,g=t(d.totalRecords/a),h=g?v(d.firstPage,u(g*(d.firstPage?d.currentPage:d.currentPage+1)/d.totalPages)):d.firstPage;return
d=this.state=this._che
 ckState(e({},d,{pageSize:a,currentPage:b.first?d.firstPage:h,totalPages:g})),this.getPage(d.currentPage,f(b,["first"]))},switchMode:function(b,c){if(!j(["server","client","infinite"],b))throw
new TypeError('`mode` must be one of "server", "client" or "infinite"');c=c||{fetch:!0,resetState:!0};var
d=this.state=c.resetState?g(this._initState):this._checkState(e({},this.state));this.mode=b;var
i,k=this,l=this.fullCollection,m=this._handlers=this._handlers||{};if("server"==b||l)"server"==b&&l&&(h(q(m),function(a){i=m[a],k.off(a,i),l.off(a,i)}),delete
this._handlers,this._fullComparator=l.comparator,delete this.fullCollection);else{l=this._makeFullCollection(c.models||[]),l.pageableCollection=this,this.fullCollection=l;var
n=this._makeCollectionEventHandler(this,l);h(["add","remove","reset","sort"],function(b){m[b]=i=a.bind(n,{},b),k.on(b,i),l.on(b,i)}),l.comparator=this._fullComparator}if("infinite"==b)for(var
o=this.links={},p=d.firstPage,r=t(d.totalRecords/d.pageSize),s=0===p?v(0,r-1)
 :r||p,u=d.firstPage;s>=u;u++)o[u]=this.url;else this.links&&delete this.links;return
c.fetch?this.fetch(f(c,"fetch","resetState")):this},hasPrevious:function(){var a=this.state,b=a.currentPage;return"infinite"!=this.mode?b>a.firstPage:!!this.links[b-1]},hasNext:function(){var
a=this.state,b=this.state.currentPage;return"infinite"!=this.mode?b<a.lastPage:!!this.links[b+1]},getFirstPage:function(a){return
this.getPage("first",a)},getPreviousPage:function(a){return this.getPage("prev",a)},getNextPage:function(a){return
this.getPage("next",a)},getLastPage:function(a){return this.getPage("last",a)},getPage:function(a,b){var
d=this.mode,g=this.fullCollection;b=b||{fetch:!1};var h=this.state,i=h.firstPage,j=h.currentPage,l=h.lastPage,m=h.pageSize,n=a;switch(a){case"first":n=i;break;case"prev":n=j-1;break;case"next":n=j+1;break;case"last":n=l;break;default:n=c(a,"index")}this.state=this._checkState(e({},h,{currentPage:n})),b.from=j,b.to=n;var
o=(0===i?n:n-1)*m,p=g&&g.length?g.models.slice(o
 ,o+m):[];return"client"!=d&&("infinite"!=d||k(p))||b.fetch?("infinite"==d&&(b.url=this.links[n]),this.fetch(f(b,"fetch"))):this.reset(p,f(b,"fetch"))},getPageByOffset:function(a,b){if(0>a)throw
new RangeError("`offset must be > 0`");a=c(a);var d=u(a/this.state.pageSize);return 0!==this.state.firstPage&&d++,d>this.state.lastPage&&(d=this.state.lastPage),this.getPage(d,b)},sync:function(a,c,d){var
f=this;if("infinite"==f.mode){var g=d.success,h=f.state.currentPage;d.success=function(a,b,c){var
i=f.links,j=f.parseLinks(a,e({xhr:c},d));j.first&&(i[f.state.firstPage]=j.first),j.prev&&(i[h-1]=j.prev),j.next&&(i[h+1]=j.next),g&&g(a,b,c)}}return(w.sync||b.sync).call(f,a,c,d)},parseLinks:function(a,b){var
c={},e=b.xhr.getResponseHeader("Link");if(e){var f=["first","prev","previous","next","last"];h(e.split(","),function(a){var
b=a.split(";"),d=b[0].replace(y,""),e=b.slice(1);h(e,function(a){var b=a.split("="),e=b[0].replace(x,""),g=b[1].replace(x,"");"rel"==e&&j(f,g)&&("previous"==g?c.prev=d
 :c[g]=d)})});var i,k,l=c.last||"";if(k=(i=l.indexOf("?"))?l.slice(i+1):""){var m=d(k),n=g(this.state),o=this.queryParams,p=n.pageSize,q=1*m[o.totalRecords],r=1*m[o.currentPage],s=m[o.totalPages];q||(r?q=(0===n.firstPage?r+1:r)*p:s&&(q=s*p)),q&&(n.totalRecords=q),this.state=this._checkState(n)}}return
delete c.last,c},parse:function(a,b){var c=this.parseState(a,g(this.queryParams),g(this.state),b);return
c&&(this.state=this._checkState(e({},this.state,c))),this.parseRecords(a,b)},parseState:function(b,c,d){if(b&&2===b.length&&p(b[0])&&n(b[1])){var
e=g(d),i=b[0];return h(l(f(c,"directions")),function(b){var c=b[0],d=b[1],f=i[d];r(f)||a.isNull(f)||(e[c]=i[d])}),i.order&&(e.order=1*m(c.directions)[i.order]),e}},parseRecords:function(a){return
a&&2===a.length&&p(a[0])&&n(a[1])?a[1]:a},fetch:function(a){a=a||{};var
b=this._checkState(this.state),c=this.mode;"infinite"!=c||a.url||(a.url=this.links[b.currentPage]);var
h=a.data||{},j=s(a,"url")||s(this,"url")||"",k=j.indexOf("?");-1!=k&&(e(h
 ,d(j.slice(k+1))),j=j.slice(0,k)),a.url=j,a.data=h;var m,n,p,t,u="client"==this.mode?i(this.queryParams,"sortKey","order"):f(i(this.queryParams,q(A.queryParams)),"directions"),v=l(u),x=g(this);for(m=0;m<v.length;m++)n=v[m],p=n[0],t=n[1],t=o(t)?t.call(x):t,null!=b[p]&&null!=t&&(h[t]=b[p]);b.sortKey&&b.order?h[u.order]=this.queryParams.directions[b.order+""]:b.sortKey||delete
h[u.order];var y=l(f(this.queryParams,q(A.queryParams)));for(m=0;m<y.length;m++)n=y[m],t=n[1],t=o(t)?t.call(x):t,null!=t&&(h[n[0]]=t);if("server"!=c){var
z=this,B=this.fullCollection,C=a.success;return a.success=function(b,d,f){f=f||{},r(a.silent)?delete
f.silent:f.silent=a.silent;var g=b.models;"client"==c?B.reset(g,f):B.add(g,e({at:B.length},f)),C&&C(b,d,f)},w.fetch.call(z,e({},a,{silent:!0}))}return
w.fetch.call(this,a)},_makeComparator:function(a,b,c){var d=this.state;return a=a||d.sortKey,b=b||d.order,a&&b?(c||(c=function(a,b){return
a.get(b)}),function(d,e){var f,g=c(d,a),h=c(e,a);return 1===b&&(f=g,g=h,h=f
 ),g===h?0:h>g?-1:1}):void 0},setSorting:function(a,b,c){var d=this.state;d.sortKey=a,d.order=b=b||d.order;var
f=this.fullCollection,g=!1,h=!1;a||(g=h=!0);var i=this.mode;c=e({side:"client"==i?i:"server",full:!0},c);var
j=this._makeComparator(a,b,c.sortValue),k=c.full,l=c.side;return"client"==l?k?(f&&(f.comparator=j),g=!0):(this.comparator=j,h=!0):"server"!=l||k||(this.comparator=j),g&&delete
this.comparator,h&&f&&delete f.comparator,this}}),A=z.prototype;return z});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/185f7c50/security-admin/src/main/webapp/libs/bower/backbone.babysitter/js/backbone.babysitter.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/libs/bower/backbone.babysitter/js/backbone.babysitter.js
b/security-admin/src/main/webapp/libs/bower/backbone.babysitter/js/backbone.babysitter.js
new file mode 100644
index 0000000..a182eda
--- /dev/null
+++ b/security-admin/src/main/webapp/libs/bower/backbone.babysitter/js/backbone.babysitter.js
@@ -0,0 +1,178 @@
+// Backbone.BabySitter
+// -------------------
+// v0.0.6
+//
+// Copyright (c)2013 Derick Bailey, Muted Solutions, LLC.
+// Distributed under MIT license
+//
+// http://github.com/babysitterjs/backbone.babysitter
+
+(function (root, factory) {
+  if (typeof exports === 'object') {
+
+    var underscore = require('underscore');
+    var backbone = require('backbone');
+
+    module.exports = factory(underscore, backbone);
+
+  } else if (typeof define === 'function' && define.amd) {
+
+    define(['underscore', 'backbone'], factory);
+
+  } 
+}(this, function (_, Backbone) {
+  "option strict";
+
+  // Backbone.ChildViewContainer
+// ---------------------------
+//
+// Provide a container to store, retrieve and
+// shut down child views.
+
+Backbone.ChildViewContainer = (function(Backbone, _){
+  
+  // Container Constructor
+  // ---------------------
+
+  var Container = function(views){
+    this._views = {};
+    this._indexByModel = {};
+    this._indexByCustom = {};
+    this._updateLength();
+
+    _.each(views, this.add, this);
+  };
+
+  // Container Methods
+  // -----------------
+
+  _.extend(Container.prototype, {
+
+    // Add a view to this container. Stores the view
+    // by `cid` and makes it searchable by the model
+    // cid (and model itself). Optionally specify
+    // a custom key to store an retrieve the view.
+    add: function(view, customIndex){
+      var viewCid = view.cid;
+
+      // store the view
+      this._views[viewCid] = view;
+
+      // index it by model
+      if (view.model){
+        this._indexByModel[view.model.cid] = viewCid;
+      }
+
+      // index by custom
+      if (customIndex){
+        this._indexByCustom[customIndex] = viewCid;
+      }
+
+      this._updateLength();
+    },
+
+    // Find a view by the model that was attached to
+    // it. Uses the model's `cid` to find it.
+    findByModel: function(model){
+      return this.findByModelCid(model.cid);
+    },
+
+    // Find a view by the `cid` of the model that was attached to
+    // it. Uses the model's `cid` to find the view `cid` and
+    // retrieve the view using it.
+    findByModelCid: function(modelCid){
+      var viewCid = this._indexByModel[modelCid];
+      return this.findByCid(viewCid);
+    },
+
+    // Find a view by a custom indexer.
+    findByCustom: function(index){
+      var viewCid = this._indexByCustom[index];
+      return this.findByCid(viewCid);
+    },
+
+    // Find by index. This is not guaranteed to be a
+    // stable index.
+    findByIndex: function(index){
+      return _.values(this._views)[index];
+    },
+
+    // retrieve a view by it's `cid` directly
+    findByCid: function(cid){
+      return this._views[cid];
+    },
+
+    // Remove a view
+    remove: function(view){
+      var viewCid = view.cid;
+
+      // delete model index
+      if (view.model){
+        delete this._indexByModel[view.model.cid];
+      }
+
+      // delete custom index
+      _.any(this._indexByCustom, function(cid, key) {
+        if (cid === viewCid) {
+          delete this._indexByCustom[key];
+          return true;
+        }
+      }, this);
+
+      // remove the view from the container
+      delete this._views[viewCid];
+
+      // update the length
+      this._updateLength();
+    },
+
+    // Call a method on every view in the container,
+    // passing parameters to the call method one at a
+    // time, like `function.call`.
+    call: function(method){
+      this.apply(method, _.tail(arguments));
+    },
+
+    // Apply a method on every view in the container,
+    // passing parameters to the call method one at a
+    // time, like `function.apply`.
+    apply: function(method, args){
+      _.each(this._views, function(view){
+        if (_.isFunction(view[method])){
+          view[method].apply(view, args || []);
+        }
+      });
+    },
+
+    // Update the `.length` attribute on this container
+    _updateLength: function(){
+      this.length = _.size(this._views);
+    }
+  });
+
+  // Borrowing this code from Backbone.Collection:
+  // http://backbonejs.org/docs/backbone.html#section-106
+  //
+  // Mix in methods from Underscore, for iteration, and other
+  // collection related features.
+  var methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter', 
+    'select', 'reject', 'every', 'all', 'some', 'any', 'include', 
+    'contains', 'invoke', 'toArray', 'first', 'initial', 'rest', 
+    'last', 'without', 'isEmpty', 'pluck'];
+
+  _.each(methods, function(method) {
+    Container.prototype[method] = function() {
+      var views = _.values(this._views);
+      var args = [views].concat(_.toArray(arguments));
+      return _[method].apply(_, args);
+    };
+  });
+
+  // return the public API
+  return Container;
+})(Backbone, _);
+
+  return Backbone.ChildViewContainer; 
+
+}));
+

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/185f7c50/security-admin/src/main/webapp/libs/bower/backbone.babysitter/js/backbone.babysitter.min.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/libs/bower/backbone.babysitter/js/backbone.babysitter.min.js
b/security-admin/src/main/webapp/libs/bower/backbone.babysitter/js/backbone.babysitter.min.js
new file mode 100644
index 0000000..78355c8
--- /dev/null
+++ b/security-admin/src/main/webapp/libs/bower/backbone.babysitter/js/backbone.babysitter.min.js
@@ -0,0 +1,10 @@
+// Backbone.BabySitter
+// -------------------
+// v0.0.6
+//
+// Copyright (c)2013 Derick Bailey, Muted Solutions, LLC.
+// Distributed under MIT license
+//
+// http://github.com/babysitterjs/backbone.babysitter
+
+(function(i,e){if("object"==typeof exports){var t=require("underscore"),n=require("backbone");module.exports=e(t,n)}else"function"==typeof
define&&define.amd&&define(["underscore","backbone"],e)})(this,function(i,e){"option
strict";return e.ChildViewContainer=function(i,e){var t=function(i){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),e.each(i,this.add,this)};e.extend(t.prototype,{add:function(i,e){var
t=i.cid;this._views[t]=i,i.model&&(this._indexByModel[i.model.cid]=t),e&&(this._indexByCustom[e]=t),this._updateLength()},findByModel:function(i){return
this.findByModelCid(i.cid)},findByModelCid:function(i){var e=this._indexByModel[i];return
this.findByCid(e)},findByCustom:function(i){var e=this._indexByCustom[i];return this.findByCid(e)},findByIndex:function(i){return
e.values(this._views)[i]},findByCid:function(i){return this._views[i]},remove:function(i){var
t=i.cid;i.model&&delete this._indexByModel[i.model.cid],e.any(this._indexByCustom,functi
 on(i,e){return i===t?(delete this._indexByCustom[e],!0):void 0},this),delete this._views[t],this._updateLength()},call:function(i){this.apply(i,e.tail(arguments))},apply:function(i,t){e.each(this._views,function(n){e.isFunction(n[i])&&n[i].apply(n,t||[])})},_updateLength:function(){this.length=e.size(this._views)}});var
n=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return
e.each(n,function(i){t.prototype[i]=function(){var t=e.values(this._views),n=[t].concat(e.toArray(arguments));return
e[i].apply(e,n)}}),t}(e,i),e.ChildViewContainer});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/185f7c50/security-admin/src/main/webapp/libs/bower/backbone.bootstrap-modal/js/backbone.bootstrap-modal.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/libs/bower/backbone.bootstrap-modal/js/backbone.bootstrap-modal.js
b/security-admin/src/main/webapp/libs/bower/backbone.bootstrap-modal/js/backbone.bootstrap-modal.js
new file mode 100644
index 0000000..6cd05b0
--- /dev/null
+++ b/security-admin/src/main/webapp/libs/bower/backbone.bootstrap-modal/js/backbone.bootstrap-modal.js
@@ -0,0 +1,275 @@
+/**
+ * Bootstrap Modal wrapper for use with Backbone.
+ * 
+ * Takes care of instantiation, manages multiple modals,
+ * adds several options and removes the element from the DOM when closed
+ *
+ * @author Charles Davison <charlie@powmedia.co.uk>
+ *
+ * Events:
+ * shown: Fired when the modal has finished animating in
+ * hidden: Fired when the modal has finished animating out
+ * cancel: The user dismissed the modal
+ * ok: The user clicked OK
+ */
+(function($, _, Backbone) {
+
+  //Set custom template settings
+  var _interpolateBackup = _.templateSettings;
+  _.templateSettings = {
+    interpolate: /\{\{(.+?)\}\}/g,
+    evaluate: /<%([\s\S]+?)%>/g
+  }
+
+  var template = _.template('\
+    <% if (title) { %>\
+      <div class="modal-header">\
+        <% if (allowCancel) { %>\
+          <a class="close">×</a>\
+        <% } %>\
+        <h3>{{title}}</h3>\
+      </div>\
+    <% } %>\
+    <div class="modal-body">{{content}}</div>\
+    <div class="modal-footer">\
+      <% if (allowCancel) { %>\
+        <% if (cancelText) { %>\
+          <a href="#" class="btn cancel">{{cancelText}}</a>\
+        <% } %>\
+      <% } %>\
+      <a href="#" class="btn ok btn-primary">{{okText}}</a>\
+    </div>\
+  ');
+
+  //Reset to users' template settings
+  _.templateSettings = _interpolateBackup;
+  
+
+  var Modal = Backbone.View.extend({
+
+    className: 'modal',
+
+    events: {
+      'click .close': function(event) {
+        event.preventDefault();
+
+        this.trigger('cancel');
+
+        if (this.options.content && this.options.content.trigger) {
+          this.options.content.trigger('cancel', this);
+        }
+      },
+      'click .cancel': function(event) {
+        event.preventDefault();
+
+        this.trigger('cancel');
+
+        if (this.options.content && this.options.content.trigger) {
+          this.options.content.trigger('cancel', this);
+        }
+      },
+      'click .ok': function(event) {
+        event.preventDefault();
+
+        this.trigger('ok');
+
+        if (this.options.content && this.options.content.trigger) {
+          this.options.content.trigger('ok', this);
+        }
+
+        if (this.options.okCloses) {
+          this.close();
+        }
+      }
+    },
+
+    /**
+     * Creates an instance of a Bootstrap Modal
+     *
+     * @see http://twitter.github.com/bootstrap/javascript.html#modals
+     *
+     * @param {Object} options
+     * @param {String|View} [options.content] Modal content. Default: none
+     * @param {String} [options.title]        Title. Default: none
+     * @param {String} [options.okText]       Text for the OK button. Default: 'OK'
+     * @param {String} [options.cancelText]   Text for the cancel button. Default: 'Cancel'.
If passed a falsey value, the button will be removed
+     * @param {Boolean} [options.allowCancel  Whether the modal can be closed, other than
by pressing OK. Default: true
+     * @param {Boolean} [options.escape]      Whether the 'esc' key can dismiss the modal.
Default: true, but false if options.cancellable is true
+     * @param {Boolean} [options.animate]     Whether to animate in/out. Default: false
+     * @param {Function} [options.template]   Compiled underscore template to override the
default one
+     */
+    initialize: function(options) {
+      this.options = _.extend({
+        title: null,
+        okText: 'OK',
+        focusOk: true,
+        okCloses: true,
+        cancelText: 'Cancel',
+        allowCancel: true,
+        escape: true,
+        animate: false,
+        template: template
+      }, options);
+    },
+
+    /**
+     * Creates the DOM element
+     * 
+     * @api private
+     */
+    render: function() {
+      var $el = this.$el,
+          options = this.options,
+          content = options.content;
+
+      //Create the modal container
+      $el.html(options.template(options));
+
+      var $content = this.$content = $el.find('.modal-body')
+
+      //Insert the main content if it's a view
+      if (content.$el) {
+        content.render();
+        $el.find('.modal-body').html(content.$el);
+      }
+
+      if (options.animate) $el.addClass('fade');
+
+      this.isRendered = true;
+
+      return this;
+    },
+
+    /**
+     * Renders and shows the modal
+     *
+     * @param {Function} [cb]     Optional callback that runs only when OK is pressed.
+     */
+    open: function(cb) {
+      if (!this.isRendered) this.render();
+
+      var self = this,
+          $el = this.$el;
+
+      //Create it
+      $el.modal(_.extend({
+        keyboard: this.options.allowCancel,
+        backdrop: this.options.allowCancel ? true : 'static'
+      }, this.options.modalOptions));
+
+      //Focus OK button
+      $el.one('shown', function() {
+        if (self.options.focusOk) {
+          $el.find('.btn.ok').focus();
+        }
+
+        if (self.options.content && self.options.content.trigger) {
+          self.options.content.trigger('shown', self);
+        }
+
+        self.trigger('shown');
+      });
+
+      //Adjust the modal and backdrop z-index; for dealing with multiple modals
+      var numModals = Modal.count,
+          $backdrop = $('.modal-backdrop:eq('+numModals+')'),
+          backdropIndex = parseInt($backdrop.css('z-index'),10),
+          elIndex = parseInt($backdrop.css('z-index'), 10);
+
+      $backdrop.css('z-index', backdropIndex + numModals);
+      this.$el.css('z-index', elIndex + numModals);
+
+      if (this.options.allowCancel) {
+        $backdrop.one('click', function() {
+          if (self.options.content && self.options.content.trigger) {
+            self.options.content.trigger('cancel', self);
+          }
+
+          self.trigger('cancel');
+        });
+        
+        $(document).one('keyup.dismiss.modal', function (e) {
+          e.which == 27 && self.trigger('cancel');
+
+          if (self.options.content && self.options.content.trigger) {
+            e.which == 27 && self.options.content.trigger('shown', self);
+          }
+        });
+      }
+
+      this.on('cancel', function() {
+        self.close();
+      });
+
+      Modal.count++;
+
+      //Run callback on OK if provided
+      if (cb) {
+        self.on('ok', cb);
+      }
+      
+      return this;
+    },
+
+    /**
+     * Closes the modal
+     */
+    close: function() {
+      var self = this,
+          $el = this.$el;
+
+      //Check if the modal should stay open
+      if (this._preventClose) {
+        this._preventClose = false;
+        return;
+      }
+
+      $el.one('hidden', function() {
+        self.remove();
+
+        if (self.options.content && self.options.content.trigger) {
+          self.options.content.trigger('hidden', self);
+        }
+
+        self.trigger('hidden');
+      });
+
+      $el.modal('hide');
+
+      Modal.count--;
+    },
+
+    /**
+     * Stop the modal from closing.
+     * Can be called from within a 'close' or 'ok' event listener.
+     */
+    preventClose: function() {
+      this._preventClose = true;
+    }
+  }, {
+    //STATICS
+
+    //The number of modals on display
+    count: 0
+  });
+
+
+  //EXPORTS
+  //CommonJS
+  if (typeof require == 'function' && typeof module !== 'undefined' && exports)
{
+    module.exports = Modal;
+  }
+
+  //AMD / RequireJS
+  if (typeof define === 'function' && define.amd) {
+    return define(function() {
+      Backbone.BootstrapModal = Modal;
+    })
+  }
+
+  //Regular; add to Backbone.Bootstrap.Modal
+  else {
+    Backbone.BootstrapModal = Modal;
+  }
+
+})(jQuery, _, Backbone);

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/185f7c50/security-admin/src/main/webapp/libs/bower/backbone.localstorage/backbone.localStorage.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/libs/bower/backbone.localstorage/backbone.localStorage.js
b/security-admin/src/main/webapp/libs/bower/backbone.localstorage/backbone.localStorage.js
new file mode 100644
index 0000000..4446d4a
--- /dev/null
+++ b/security-admin/src/main/webapp/libs/bower/backbone.localstorage/backbone.localStorage.js
@@ -0,0 +1,222 @@
+/**
+ * Backbone localStorage Adapter
+ * Version 1.1.7
+ *
+ * https://github.com/jeromegn/Backbone.localStorage
+ */
+(function (root, factory) {
+   if (typeof exports === 'object' && typeof require === 'function') {
+     module.exports = factory(require("underscore"), require("backbone"));
+   } else if (typeof define === "function" && define.amd) {
+      // AMD. Register as an anonymous module.
+      define(["underscore","backbone"], function(_, Backbone) {
+        // Use global variables if the locals are undefined.
+        return factory(_ || root._, Backbone || root.Backbone);
+      });
+   } else {
+      // RequireJS isn't being used. Assume underscore and backbone are loaded in <script>
tags
+      factory(_, Backbone);
+   }
+}(this, function(_, Backbone) {
+// A simple module to replace `Backbone.sync` with *localStorage*-based
+// persistence. Models are given GUIDS, and saved into a JSON object. Simple
+// as that.
+
+// Hold reference to Underscore.js and Backbone.js in the closure in order
+// to make things work even if they are removed from the global namespace
+
+// Generate four random hex digits.
+function S4() {
+   return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
+};
+
+// Generate a pseudo-GUID by concatenating random hexadecimal.
+function guid() {
+   return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
+};
+
+// Our Store is represented by a single JS object in *localStorage*. Create it
+// with a meaningful name, like the name you'd give a table.
+// window.Store is deprectated, use Backbone.LocalStorage instead
+Backbone.LocalStorage = window.Store = function(name) {
+  if( !this.localStorage ) {
+    throw "Backbone.localStorage: Environment does not support localStorage."
+  }
+  this.name = name;
+  var store = this.localStorage().getItem(this.name);
+  this.records = (store && store.split(",")) || [];
+};
+
+_.extend(Backbone.LocalStorage.prototype, {
+
+  // Save the current state of the **Store** to *localStorage*.
+  save: function() {
+    this.localStorage().setItem(this.name, this.records.join(","));
+  },
+
+  // Add a model, giving it a (hopefully)-unique GUID, if it doesn't already
+  // have an id of it's own.
+  create: function(model) {
+    if (!model.id) {
+      model.id = guid();
+      model.set(model.idAttribute, model.id);
+    }
+    this.localStorage().setItem(this.name+"-"+model.id, JSON.stringify(model));
+    this.records.push(model.id.toString());
+    this.save();
+    return this.find(model);
+  },
+
+  // Update a model by replacing its copy in `this.data`.
+  update: function(model) {
+    this.localStorage().setItem(this.name+"-"+model.id, JSON.stringify(model));
+    if (!_.include(this.records, model.id.toString()))
+      this.records.push(model.id.toString()); this.save();
+    return this.find(model);
+  },
+
+  // Retrieve a model from `this.data` by id.
+  find: function(model) {
+    return this.jsonData(this.localStorage().getItem(this.name+"-"+model.id));
+  },
+
+  // Return the array of all models currently in storage.
+  findAll: function() {
+    // Lodash removed _#chain in v1.0.0-rc.1
+    return (_.chain || _)(this.records)
+      .map(function(id){
+        return this.jsonData(this.localStorage().getItem(this.name+"-"+id));
+      }, this)
+      .compact()
+      .value();
+  },
+
+  // Delete a model from `this.data`, returning it.
+  destroy: function(model) {
+    if (model.isNew())
+      return false
+    this.localStorage().removeItem(this.name+"-"+model.id);
+    this.records = _.reject(this.records, function(id){
+      return id === model.id.toString();
+    });
+    this.save();
+    return model;
+  },
+
+  localStorage: function() {
+    return localStorage;
+  },
+
+  // fix for "illegal access" error on Android when JSON.parse is passed null
+  jsonData: function (data) {
+      return data && JSON.parse(data);
+  },
+
+  // Clear localStorage for specific collection.
+  _clear: function() {
+    var local = this.localStorage(),
+      itemRe = new RegExp("^" + this.name + "-");
+
+    // Remove id-tracking item (e.g., "foo").
+    local.removeItem(this.name);
+
+    // Lodash removed _#chain in v1.0.0-rc.1
+    // Match all data items (e.g., "foo-ID") and remove.
+    (_.chain || _)(local).keys()
+      .filter(function (k) { return itemRe.test(k); })
+      .each(function (k) { local.removeItem(k); });
+
+    this.records.length = 0;
+  },
+
+  // Size of localStorage.
+  _storageSize: function() {
+    return this.localStorage().length;
+  }
+
+});
+
+// localSync delegate to the model or collection's
+// *localStorage* property, which should be an instance of `Store`.
+// window.Store.sync and Backbone.localSync is deprecated, use Backbone.LocalStorage.sync
instead
+Backbone.LocalStorage.sync = window.Store.sync = Backbone.localSync = function(method, model,
options) {
+  var store = model.localStorage || model.collection.localStorage;
+
+  var resp, errorMessage, syncDfd = Backbone.$.Deferred && Backbone.$.Deferred();
//If $ is having Deferred - use it.
+
+  try {
+
+    switch (method) {
+      case "read":
+        resp = model.id != undefined ? store.find(model) : store.findAll();
+        break;
+      case "create":
+        resp = store.create(model);
+        break;
+      case "update":
+        resp = store.update(model);
+        break;
+      case "delete":
+        resp = store.destroy(model);
+        break;
+    }
+
+  } catch(error) {
+    if (error.code === 22 && store._storageSize() === 0)
+      errorMessage = "Private browsing is unsupported";
+    else
+      errorMessage = error.message;
+  }
+
+  if (resp) {
+    if (options && options.success) {
+      if (Backbone.VERSION === "0.9.10") {
+        options.success(model, resp, options);
+      } else {
+        options.success(resp);
+      }
+    }
+    if (syncDfd) {
+      syncDfd.resolve(resp);
+    }
+
+  } else {
+    errorMessage = errorMessage ? errorMessage
+                                : "Record Not Found";
+
+    if (options && options.error)
+      if (Backbone.VERSION === "0.9.10") {
+        options.error(model, errorMessage, options);
+      } else {
+        options.error(errorMessage);
+      }
+
+    if (syncDfd)
+      syncDfd.reject(errorMessage);
+  }
+
+  // add compatibility with $.ajax
+  // always execute callback for success and error
+  if (options && options.complete) options.complete(resp);
+
+  return syncDfd && syncDfd.promise();
+};
+
+Backbone.ajaxSync = Backbone.sync;
+
+Backbone.getSyncMethod = function(model) {
+  if(model.localStorage || (model.collection && model.collection.localStorage)) {
+    return Backbone.localSync;
+  }
+
+  return Backbone.ajaxSync;
+};
+
+// Override 'Backbone.sync' to default to localSync,
+// the original 'Backbone.sync' is still available in 'Backbone.ajaxSync'
+Backbone.sync = function(method, model, options) {
+  return Backbone.getSyncMethod(model).apply(this, [method, model, options]);
+};
+
+return Backbone.LocalStorage;
+}));


Mime
View raw message