Beispiel #1
0
 new Promise((resolve) => {
     scriptjs.ready('gMaps', () => {
         const geocoder = new google.maps.Geocoder();
         el_btn_validate.classList.add('geocode-btn-disabled');
         el_success.setVisibility(0);
         el_error.setVisibility(0);
         el_loader.setVisibility(1);
         geocoder.geocode({
             address,
             // Restrict Geolocation to client's country of residence and state
             componentRestrictions: {
                 country           : Client.get('residence').toUpperCase(),
                 administrativeArea: is_states_el_select ? getStateText('#address_state') : getValue('#address_state'),
             },
         }, (result, status) => {
             // Geocoding status reference:
             // https://developers.google.com/maps/documentation/javascript/geocoding#GeocodingStatusCodes
             const data = { result, status };
             handleResponse(data);
             resolve(data);
         });
     });
 })
Beispiel #2
0
(function(context) {
  "use strict";

  var $script = require('scriptjs'), prepareDependencies;

  prepareDependencies = function() {
    $script.path('/bundlr/public/javascripts/');
    $script('vendor/jquery.min', 'jquery');
    $script('vendor/synapse/synapse', 'synapse');
    $script('vendor/synapse/hooks/object', 'synapse-object');
    $script([ 'vendor/synapse/hooks/backbone-model',
        'vendor/synapse/hooks/backbone-view' ], 'synapse-backbone');
    $script('vendor/bootstrap.min', 'bootstrap');
    $script('vendor/hogan-2.0.0', 'hogan');
  };

  prepareDependencies();
  
  $script.ready([ 'jquery', 'bootstrap', 'hogan' ], function() {
    provide('hogan', Hogan);
  });

}(this));
Beispiel #3
0
(function(context) {
	"use strict";

	var _ = require('underscore'), $script = require('scriptjs'), jQuery, install, showMessage, loadConfiguration, checkLogback, updateConfiguration;

	showMessage = function(header, title, message) {
		jQuery("#modalMessage > .modal-header > h3").html(header);

		if (message) {
			message = "<strong>" + title + "</strong>"
					+ "<pre class='prettyprint'>" + message + "</pre>";
		} else {
			message = "Action successful";
		}

		jQuery("#modalMessage > .modal-body > p").html(message);
		jQuery("#modalMessage").modal('show');
	};

	checkLogback = function(callback) {
		jQuery.ajax({
			url : '/osgifier/service/list',
			type : 'GET',
			dataType : 'json',
			success : function(data) {
				if (data.outcome == 'error' || data.indexOf("Logback") == -1) {
					jQuery("#configuration").css('display', 'none');
					jQuery(".form-actions").css('display', 'none');
					jQuery("#error").css('display', 'block');
				} else {
					if (callback) {
						callback();
					}
				}
			}
		});
	};

	updateConfiguration = function(configuration, callback) {
		var data = {
			configuration : configuration
		};
		jQuery.ajax({
			url : '/osgifier/service/extras/logback/configuration',
			type : 'POST',
			dataType : 'json',
			data : JSON.stringify(data),
			success : function(data) {
				if (data.outcome == 'error') {
					showMessage('Error', data.message, data.stacktrace);
				} else {
					showMessage("Success!");
				}
				if (callback) {
					callback();
				}
			}
		});
	};

	loadConfiguration = function() {
		jQuery.ajax({
			url : '/osgifier/service/extras/logback/configuration',
			type : 'GET',
			dataType : 'json',
			success : function(data) {
				if (data.outcome == 'error') {
					showMessage('Error', data.message, data.stacktrace);
				} else {
					jQuery("#configuration").val(data);
				}
			}
		});
	};

	$script.ready([ 'jquery', 'bootstrap' ], function() {
		jQuery = require('jquery');

		checkLogback(function() {
			loadConfiguration();

			jQuery("#updateConfiguration").click(function() {
				jQuery('#updateConfiguration').button('loading');

				updateConfiguration(jQuery("#configuration").val(), function() {
					jQuery('#updateConfiguration').button('reset');
				});

			});
		});

	});

}());
Beispiel #4
0
 componentDidMount: function () {
     // Login / logout actions must be deferred until persona is ready.
     this.extractSessionCookie();
     $script.ready('persona', this.configurePersona);
 },
Beispiel #5
0
(function (context) {
	"use strict";
	
	var _        = require('underscore'),
	    $script  = require('scriptjs'),
	    jQuery,
	    install;
	
	$script('app/package/package', 'package');
	
	$script.ready(['jquery', 'bootstrap', 'package'], function () {
		jQuery  = require('jquery');
		
		jQuery("#installCamel").click(function () {
			install = require('PackageInstall');
			jQuery('#installCamel').button('loading');
			install('camel', function () {
				jQuery('#installCamel').button('reset');
			});
			
		});
		
		jQuery("#installCxf").click(function () {
			install = require('PackageInstall');
			jQuery('#installCxf').button('loading');
			install('camel-cxf', function () {
				jQuery('#installCxf').button('reset');
			});
		});
		
		jQuery("#installServices").click(function () {
			install = require('PackageInstall');
			jQuery('#installServices').button('loading');
			install('services', function () {
				jQuery('#installServices').button('reset');
			});
			
		});

		jQuery("#installFreemarker").click(function () {
			install = require('PackageInstall');
			jQuery('#installFreemarker').button('loading');
			install('camel-freemarker', function () {
				jQuery('#installFreemarker').button('reset');
			});
		});

		jQuery("#installJcr").click(function () {
			install = require('PackageInstall');
			jQuery('#installJcr').button('loading');
			install('camel-jcr', function () {
				jQuery('#installJcr').button('reset');
			});
		});

		jQuery("#installJms").click(function () {
			install = require('PackageInstall');
			jQuery('#installJms').button('loading');
			install('camel-jms', function () {
				jQuery('#installJms').button('reset');
			});
		});

		jQuery("#installJmx").click(function () {
			install = require('PackageInstall');
			jQuery('#installJmx').button('loading');
			install('camel-jmx', function () {
				jQuery('#installJmx').button('reset');
			});
		});

		jQuery("#installJpa").click(function () {
			install = require('PackageInstall');
			jQuery('#installJpa').button('loading');
			install('camel-jpa', function () {
				jQuery('#installJpa').button('reset');
			});
		});

		jQuery("#installMail").click(function () {
			install = require('PackageInstall');
			jQuery('#installMail').button('loading');
			install('camel-mail', function () {
				jQuery('#installMail').button('reset');
			});
		});

		jQuery("#installQuartz").click(function () {
			install = require('PackageInstall');
			jQuery('#installQuartz').button('loading');
			install('camel-quartz', function () {
				jQuery('#installQuartz').button('reset');
			});
		});

		jQuery("#installTwitter").click(function () {
			install = require('PackageInstall');
			jQuery('#installTwitter').button('loading');
			install('camel-twitter', function () {
				jQuery('#installTwitter').button('reset');
			});
		});
		
	});
	
}());
Beispiel #6
0
(function (context) {
	"use strict";

	var _        = require('underscore'),
	    Backbone = require('backbone'),
	    $script  = require('scriptjs'),
	    Session,
	    jQuery,
	    request,
	    MD5,
	    showMessage,
	    getGravatar;	

	$script('app/session', 'OsgifierSession');
	
	request = function() {
		console.log("Request is not yet ready");
	};
	
	showMessage = function(header, title, message) {
		jQuery("#modalMessage > .modal-header > h3").html(header);
		
		if(message) {
			message = "<strong>" + title + "</strong>" +
				"<pre class='prettyprint'>" + message + "</pre>";
		} else {
			message = "Action successful";
		}

		jQuery("#modalMessage > .modal-body > p").html(message);
		jQuery("#modalMessage").modal('show');
	};
	
	$script.ready(['jquery', 'bootstrap', 'OsgifierSession'], function() {
		
		jQuery  = require('jquery');
		Session = require('OsgifierSession');
		
		Session.current(function(data) {
			var user     = JSON.parse(data.result) || {};
			
			var email    = user.email || '';
			var username = user.username || 'N/A';
			
			var gravatar = getGravatar(email, 210);
			
			jQuery("#form-gravatar").attr('src', gravatar);
			
			jQuery("#form-gravatar").css('display', 'block');
			
			jQuery("#form-username").html(username);
			
			jQuery("#form-email").val(email);
			
			jQuery("#form-submit").click(function() {
				var requestUrl = "/osgifier/service/users/update",
				    password   = jQuery("#form-password").val(),
				    data       = {};
				
				data.user = user;
				
				user.email = jQuery("#form-email").val();
				
				if(password.trim().length > 0) {
					requestUrl = "/osgifier/service/users/updateWithPassword";
					data.password = password;
				}
				
				request(requestUrl, data, function (data) {
					if(data.outcome == 'error') {
						showMessage('Error', data.message, data.stacktrace);
					} else {
						showMessage("Success!");
					}
				});
				
			});
			
		});
		
		request = function (url, data, callback) {
			jQuery.ajax({
				url : url,
				type : 'POST',
				dataType : 'json',
				data : JSON.stringify(data),
				success : callback
			});
		};
		
	});
	
	MD5=function(s){function L(k,d){return(k<<d)|(k>>>(32-d))}function K(G,k){var I,d,F,H,x;F=(G&2147483648);H=(k&2147483648);I=(G&1073741824);d=(k&1073741824);x=(G&1073741823)+(k&1073741823);if(I&d){return(x^2147483648^F^H)}if(I|d){if(x&1073741824){return(x^3221225472^F^H)}else{return(x^1073741824^F^H)}}else{return(x^F^H)}}function r(d,F,k){return(d&F)|((~d)&k)}function q(d,F,k){return(d&k)|(F&(~k))}function p(d,F,k){return(d^F^k)}function n(d,F,k){return(F^(d|(~k)))}function u(G,F,aa,Z,k,H,I){G=K(G,K(K(r(F,aa,Z),k),I));return K(L(G,H),F)}function f(G,F,aa,Z,k,H,I){G=K(G,K(K(q(F,aa,Z),k),I));return K(L(G,H),F)}function D(G,F,aa,Z,k,H,I){G=K(G,K(K(p(F,aa,Z),k),I));return K(L(G,H),F)}function t(G,F,aa,Z,k,H,I){G=K(G,K(K(n(F,aa,Z),k),I));return K(L(G,H),F)}function e(G){var Z;var F=G.length;var x=F+8;var k=(x-(x%64))/64;var I=(k+1)*16;var aa=Array(I-1);var d=0;var H=0;while(H<F){Z=(H-(H%4))/4;d=(H%4)*8;aa[Z]=(aa[Z]|(G.charCodeAt(H)<<d));H++}Z=(H-(H%4))/4;d=(H%4)*8;aa[Z]=aa[Z]|(128<<d);aa[I-2]=F<<3;aa[I-1]=F>>>29;return aa}function B(x){var k="",F="",G,d;for(d=0;d<=3;d++){G=(x>>>(d*8))&255;F="0"+G.toString(16);k=k+F.substr(F.length-2,2)}return k}function J(k){k=k.replace(/rn/g,"n");var d="";for(var F=0;F<k.length;F++){var x=k.charCodeAt(F);if(x<128){d+=String.fromCharCode(x)}else{if((x>127)&&(x<2048)){d+=String.fromCharCode((x>>6)|192);d+=String.fromCharCode((x&63)|128)}else{d+=String.fromCharCode((x>>12)|224);d+=String.fromCharCode(((x>>6)&63)|128);d+=String.fromCharCode((x&63)|128)}}}return d}var C=Array();var P,h,E,v,g,Y,X,W,V;var S=7,Q=12,N=17,M=22;var A=5,z=9,y=14,w=20;var o=4,m=11,l=16,j=23;var U=6,T=10,R=15,O=21;s=J(s);C=e(s);Y=1732584193;X=4023233417;W=2562383102;V=271733878;for(P=0;P<C.length;P+=16){h=Y;E=X;v=W;g=V;Y=u(Y,X,W,V,C[P+0],S,3614090360);V=u(V,Y,X,W,C[P+1],Q,3905402710);W=u(W,V,Y,X,C[P+2],N,606105819);X=u(X,W,V,Y,C[P+3],M,3250441966);Y=u(Y,X,W,V,C[P+4],S,4118548399);V=u(V,Y,X,W,C[P+5],Q,1200080426);W=u(W,V,Y,X,C[P+6],N,2821735955);X=u(X,W,V,Y,C[P+7],M,4249261313);Y=u(Y,X,W,V,C[P+8],S,1770035416);V=u(V,Y,X,W,C[P+9],Q,2336552879);W=u(W,V,Y,X,C[P+10],N,4294925233);X=u(X,W,V,Y,C[P+11],M,2304563134);Y=u(Y,X,W,V,C[P+12],S,1804603682);V=u(V,Y,X,W,C[P+13],Q,4254626195);W=u(W,V,Y,X,C[P+14],N,2792965006);X=u(X,W,V,Y,C[P+15],M,1236535329);Y=f(Y,X,W,V,C[P+1],A,4129170786);V=f(V,Y,X,W,C[P+6],z,3225465664);W=f(W,V,Y,X,C[P+11],y,643717713);X=f(X,W,V,Y,C[P+0],w,3921069994);Y=f(Y,X,W,V,C[P+5],A,3593408605);V=f(V,Y,X,W,C[P+10],z,38016083);W=f(W,V,Y,X,C[P+15],y,3634488961);X=f(X,W,V,Y,C[P+4],w,3889429448);Y=f(Y,X,W,V,C[P+9],A,568446438);V=f(V,Y,X,W,C[P+14],z,3275163606);W=f(W,V,Y,X,C[P+3],y,4107603335);X=f(X,W,V,Y,C[P+8],w,1163531501);Y=f(Y,X,W,V,C[P+13],A,2850285829);V=f(V,Y,X,W,C[P+2],z,4243563512);W=f(W,V,Y,X,C[P+7],y,1735328473);X=f(X,W,V,Y,C[P+12],w,2368359562);Y=D(Y,X,W,V,C[P+5],o,4294588738);V=D(V,Y,X,W,C[P+8],m,2272392833);W=D(W,V,Y,X,C[P+11],l,1839030562);X=D(X,W,V,Y,C[P+14],j,4259657740);Y=D(Y,X,W,V,C[P+1],o,2763975236);V=D(V,Y,X,W,C[P+4],m,1272893353);W=D(W,V,Y,X,C[P+7],l,4139469664);X=D(X,W,V,Y,C[P+10],j,3200236656);Y=D(Y,X,W,V,C[P+13],o,681279174);V=D(V,Y,X,W,C[P+0],m,3936430074);W=D(W,V,Y,X,C[P+3],l,3572445317);X=D(X,W,V,Y,C[P+6],j,76029189);Y=D(Y,X,W,V,C[P+9],o,3654602809);V=D(V,Y,X,W,C[P+12],m,3873151461);W=D(W,V,Y,X,C[P+15],l,530742520);X=D(X,W,V,Y,C[P+2],j,3299628645);Y=t(Y,X,W,V,C[P+0],U,4096336452);V=t(V,Y,X,W,C[P+7],T,1126891415);W=t(W,V,Y,X,C[P+14],R,2878612391);X=t(X,W,V,Y,C[P+5],O,4237533241);Y=t(Y,X,W,V,C[P+12],U,1700485571);V=t(V,Y,X,W,C[P+3],T,2399980690);W=t(W,V,Y,X,C[P+10],R,4293915773);X=t(X,W,V,Y,C[P+1],O,2240044497);Y=t(Y,X,W,V,C[P+8],U,1873313359);V=t(V,Y,X,W,C[P+15],T,4264355552);W=t(W,V,Y,X,C[P+6],R,2734768916);X=t(X,W,V,Y,C[P+13],O,1309151649);Y=t(Y,X,W,V,C[P+4],U,4149444226);V=t(V,Y,X,W,C[P+11],T,3174756917);W=t(W,V,Y,X,C[P+2],R,718787259);X=t(X,W,V,Y,C[P+9],O,3951481745);Y=K(Y,h);X=K(X,E);W=K(W,v);V=K(V,g)}var i=B(Y)+B(X)+B(W)+B(V);return i.toLowerCase()};
	
	getGravatar = function(email, size) {
		return 'http://www.gravatar.com/avatar/' + MD5(email) + '.jpg?s=' + size;
	};
	
}(this));
Beispiel #7
0
(function(context) {
	"use strict";

	// Ready libs
	var $script = require('scriptjs'),
	    _ = require('underscore'), Backbone = require('backbone'),
    	// Async Libs
	    jQuery, hogan,
    	// Domain
	    domain,
    	// Repositories
	    bundleLibrary,
    	// Views
    	bundleLibraryView,
    	// Funcs
    	prepareModel,
    	prepareUi,
    	fetch,
    	ready;

	// Load custom scripts
	$script('app/bundles/domain', 'BundleDomain');
	$script('vendor/google-code-prettify/prettify', 'prettify');

	prepareModel = function () {
		bundleLibrary = new domain.BundleLibrary();
	};

	prepareUi = function () {
		var bundleTemplate = hogan.compile(jQuery("#bundleTemplate").html()), BundleView, BundleLibraryView,
		    fullTable;

		BundleView = Backbone.View.extend({
			tagName : 'tr',
			render : function() {
				var element = jQuery(this.el),
				    model   = this.model;
				
				model.on('statusChange', fetch);

				element.html(bundleTemplate.render(model.toJSON()));

				jQuery(".bundle-start", element).click(function() {
					model.start();
				});

				jQuery(".bundle-stop", element).click(function() {
					model.stop();
				});

				jQuery(".bundle-restart", element).click(function() {
					model.restart();
				});

				jQuery(".bundle-update", element).click(function() {
					model.update();
				});

				jQuery(".bundle-uninstall", element).click(function() {
					model.uninstall();
				});

				return this;
			}
		});

		BundleLibraryView = Backbone.View.extend({
			buildChildren : function() {
				var that = this;
				this._bundleViews = [];

				this.collection.each(function(bundle) {
					that._bundleViews.push(new BundleView({
						model : bundle
					}));
				});
			},
			render : function() {
				var that = this, 
				    filter;
				if(fullTable) {
					filter = fullTable.fnSettings().oPreviousSearch.sSearch;
					fullTable.fnDestroy();
				}
				jQuery(this.el).empty();
				this.buildChildren();
				_(this._bundleViews).each(function(bv) {
					jQuery(that.el).append(bv.render().el);
					return this;
				});
				fullTable = jQuery("#fullTable").dataTable({
					sDom: "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
					sPaginationType: "bootstrap"
				});
				if(filter && filter != '') {
					fullTable.fnFilter(filter);
				}
			}
		});

		bundleLibraryView = new BundleLibraryView({
			collection : bundleLibrary,
			el : jQuery('.bundles')[0]
		});
		
	};

	ready = function() {
		jQuery("#modalMessage").modal({
			show: false
		});
		
		jQuery("#modalInstall").modal({
			show: false
		});
		
		jQuery("#install").click(function () {
			jQuery('#install').button('loading');
			jQuery('#installUrl').attr('disabled', 'disabled');
			bundleLibrary.installModule(jQuery("#installUrl").val(), function () {
				jQuery('#installUrl').removeAttr('disabled');
				jQuery('#install').button('reset');
				fetch();
			});
		});
		
		jQuery("#showModalInstall").click(function () {
			jQuery("#modalInstall").modal('show');
		});
		
		jQuery("#executeModalInstall").click(function () {
			var installs = jQuery("#installBody").val().replace(/\r\n/g, '\n').split('\n');
			jQuery('#executeModalInstall').button('loading');
			jQuery("#installBody").attr('disabled', 'disabled');
			var installPart = function installPart(i) {
				bundleLibrary.installModule(installs[i], function () {
					if(i + 1 < installs.length) {
						installPart(i + 1);
					} else {
						jQuery('#installBody').removeAttr('disabled');
						jQuery('#executeModalInstall').button('reset');
						fetch();
					}
				});
			};
			installPart(0);
		});

		fetch = function () {
			bundleLibrary.fetch({
				success : function () {
					bundleLibraryView.render();
				}
			});	
		};
		
		fetch();
		
	};

	// Ready to rumble
	$script.ready([ 'jquery', 'bootstrap', 'dataTables', 'hogan', 'BundleDomain' ], function() {
		jQuery = require('jquery');
		hogan = require('hogan');
		domain = require('BundleDomain');

		prepareModel();
		prepareUi();

		jQuery(document).ready(ready);

	});

}());