User MyAMS generic functions
authorThierry Florac <thierry.florac@onf.fr>
Tue, 03 Mar 2015 16:43:15 +0100
changeset 21 f4c64d963935
parent 20 c4259361b1b1
child 22 485cc79beb30
User MyAMS generic functions
src/pyams_security/resources/js/security.js
src/pyams_security/resources/js/security.min.js
--- a/src/pyams_security/resources/js/security.js	Tue Mar 03 16:42:45 2015 +0100
+++ b/src/pyams_security/resources/js/security.js	Tue Mar 03 16:43:15 2015 +0100
@@ -24,76 +24,6 @@
 								});
 								authomatic.popupInit();
 							});
-		},
-
-		/**
-		 * Plug-ins callback
-		 */
-		plugins: {
-
-			/**
-			 * Plug-in delete callback
-			 */
-			deletePlugin: function(link) {
-				return function() {
-					var link = $(this);
-					MyAMS.skin.bigBox({
-						title: MyAMS.i18n.WARNING,
-						content: '<i class="text-danger fa fa-2x fa-bell shake animated"></i>&nbsp; ' + MyAMS.i18n.DELETE_WARNING,
-						buttons: MyAMS.i18n.BTN_OK_CANCEL
-					}, function(button) {
-						if (button == MyAMS.i18n.BTN_OK) {
-							var location = link.parents('table').data('ams-location');
-							var tr = link.parents('tr');
-							var plugin_name = tr.data('ams-element-name');
-							MyAMS.ajax.post(location + '/delete-plugin.json', {'plugin_name': plugin_name}, function(result, status) {
-								if (result.status == 'success') {
-									link.parents('tr').remove();
-								}
-							});
-						}
-					});
-				}
-			},
-
-			/**
-			 * Change plug-ins names order
-			 */
-			changeOrder: function(table, names) {
-				var input = $('input[name="' + $(this).data('ams-input-name') + '"]', $(this));
-				input.val(names.join(';'));
-			}
-		},
-
-		/**
-		 * Social providers callbacks
-		 */
-		social: {
-
-			/**
-			 * Social login provider delete callback
-			 */
-			deleteProvider: function(link) {
-				return function() {
-					var link = $(this);
-					MyAMS.skin.bigBox({
-						title: MyAMS.i18n.WARNING,
-						content: '<i class="text-danger fa fa-2x fa-bell shake animated"></i>&nbsp; ' + MyAMS.i18n.DELETE_WARNING,
-						buttons: MyAMS.i18n.BTN_OK_CANCEL
-					}, function(button) {
-						if (button == MyAMS.i18n.BTN_OK) {
-							var location = link.parents('table').data('ams-location');
-							var tr = link.parents('tr');
-							var provider_name = tr.data('ams-element-name');
-							MyAMS.ajax.post(location + '/delete-provider.json', {'provider_name': provider_name}, function(result, status) {
-								if (result.status == 'success') {
-									link.parents('tr').remove();
-								}
-							});
-						}
-					});
-				}
-			}
 		}
 	};
 
--- a/src/pyams_security/resources/js/security.min.js	Tue Mar 03 16:42:45 2015 +0100
+++ b/src/pyams_security/resources/js/security.min.js	Tue Mar 03 16:43:15 2015 +0100
@@ -1,1 +1,1 @@
-(function(a){window.PyAMS_security={init_social:function(b){MyAMS.ajax.check(window.authomatic,"/--static--/pyams_security/js/authomatic"+(MyAMS.devmode?".min.js":".js"),function(c){authomatic.setup({popupWidth:800,popupHeight:400,onLoginComplete:function(d){console.log(d);if(d.error){}else{if(d.user){alert(d.user)}}}});authomatic.popupInit()})},plugins:{deletePlugin:function(b){return function(){var c=a(this);MyAMS.skin.bigBox({title:MyAMS.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i>&nbsp; '+MyAMS.i18n.DELETE_WARNING,buttons:MyAMS.i18n.BTN_OK_CANCEL},function(f){if(f==MyAMS.i18n.BTN_OK){var d=c.parents("table").data("ams-location");var g=c.parents("tr");var e=g.data("ams-element-name");MyAMS.ajax.post(d+"/delete-plugin.json",{plugin_name:e},function(h,i){if(h.status=="success"){c.parents("tr").remove()}})}})}},changeOrder:function(c,d){var b=a('input[name="'+a(this).data("ams-input-name")+'"]',a(this));b.val(d.join(";"))}},social:{deleteProvider:function(b){return function(){var c=a(this);MyAMS.skin.bigBox({title:MyAMS.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i>&nbsp; '+MyAMS.i18n.DELETE_WARNING,buttons:MyAMS.i18n.BTN_OK_CANCEL},function(f){if(f==MyAMS.i18n.BTN_OK){var d=c.parents("table").data("ams-location");var g=c.parents("tr");var e=g.data("ams-element-name");MyAMS.ajax.post(d+"/delete-provider.json",{provider_name:e},function(h,i){if(h.status=="success"){c.parents("tr").remove()}})}})}}}}})(jQuery);
\ No newline at end of file
+(function(a){window.PyAMS_security={init_social:function(b){MyAMS.ajax.check(window.authomatic,"/--static--/pyams_security/js/authomatic"+(MyAMS.devmode?".min.js":".js"),function(c){authomatic.setup({popupWidth:800,popupHeight:400,onLoginComplete:function(d){console.log(d);if(d.error){}else{if(d.user){alert(d.user)}}}});authomatic.popupInit()})}}})(jQuery);
\ No newline at end of file