mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Change lang.hitch to javascript bind method
Also remove the dojo/_base/lang module in cases it is not needed any more. https://fedorahosted.org/freeipa/ticket/5702 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
This commit is contained in:
parent
46e3245fde
commit
b16e59bdaa
@ -20,7 +20,6 @@
|
||||
|
||||
define([
|
||||
'dojo/_base/declare',
|
||||
'dojo/_base/lang',
|
||||
'dojo/_base/array',
|
||||
'dojo/Deferred',
|
||||
'dojo/on',
|
||||
@ -39,7 +38,7 @@ define([
|
||||
'./navigation/menu_spec',
|
||||
'./plugins/load_page'
|
||||
],
|
||||
function(declare, lang, array, Deferred, on, topic, query, dom_class, auth,
|
||||
function(declare, array, Deferred, on, topic, query, dom_class, auth,
|
||||
JSON, App_widget, FacetContainer, IPA, reg, Menu, Router, routing, menu_spec) {
|
||||
|
||||
/**
|
||||
@ -107,18 +106,18 @@ define([
|
||||
}
|
||||
};
|
||||
|
||||
on(this.app_widget.menu_widget, 'item-select', lang.hitch(this, this.on_menu_click));
|
||||
on(this.app_widget, 'profile-click', lang.hitch(this, this.on_profile));
|
||||
on(this.app_widget, 'logout-click', lang.hitch(this, this.on_logout));
|
||||
on(this.app_widget, 'password-reset-click', lang.hitch(this, this.on_password_reset));
|
||||
on(this.app_widget, 'about-click', lang.hitch(this, this.on_about));
|
||||
on(this.app_widget.menu_widget, 'item-select', this.on_menu_click.bind(this));
|
||||
on(this.app_widget, 'profile-click', this.on_profile.bind(this));
|
||||
on(this.app_widget, 'logout-click', this.on_logout.bind(this));
|
||||
on(this.app_widget, 'password-reset-click', this.on_password_reset.bind(this));
|
||||
on(this.app_widget, 'about-click', this.on_about.bind(this));
|
||||
|
||||
on(this.router, 'facet-show', lang.hitch(this, this.on_facet_show));
|
||||
on(this.router, 'facet-change', lang.hitch(this, this.on_facet_change));
|
||||
on(this.router, 'facet-change-canceled', lang.hitch(this, this.on_facet_canceled));
|
||||
on(this.router, 'error', lang.hitch(this, this.on_router_error));
|
||||
topic.subscribe('phase-error', lang.hitch(this, this.on_phase_error));
|
||||
topic.subscribe('authenticate', lang.hitch(this, this.on_authenticate));
|
||||
on(this.router, 'facet-show', this.on_facet_show.bind(this));
|
||||
on(this.router, 'facet-change', this.on_facet_change.bind(this));
|
||||
on(this.router, 'facet-change-canceled', this.on_facet_canceled.bind(this));
|
||||
on(this.router, 'error', this.on_router_error.bind(this));
|
||||
topic.subscribe('phase-error', this.on_phase_error.bind(this));
|
||||
topic.subscribe('authenticate', this.on_authenticate.bind(this));
|
||||
|
||||
this.app_widget.render();
|
||||
this.app_widget.hide();
|
||||
@ -282,13 +281,13 @@ define([
|
||||
if (current_facet === new_facet) return;
|
||||
|
||||
if (current_facet && !current_facet.can_leave()) {
|
||||
var permit_clb = lang.hitch(this, function() {
|
||||
var permit_clb = function() {
|
||||
// Some facet's might not call reset before this call but after
|
||||
// so they are still dirty. Calling reset prevent's opening of
|
||||
// dirty dialog again.
|
||||
if (current_facet.is_dirty()) current_facet.reset(); //TODO change
|
||||
this.router.navigate_to_hash(event.hash, event.facet);
|
||||
});
|
||||
}.bind(this);
|
||||
|
||||
var dialog = current_facet.show_leave_dialog(permit_clb);
|
||||
this.router.canceled = true;
|
||||
@ -338,7 +337,7 @@ define([
|
||||
// show facet
|
||||
if (!facet.container_node) {
|
||||
facet.container_node = container.widget.content_node;
|
||||
on(facet, 'facet-state-change', lang.hitch(this, this.on_facet_state_changed));
|
||||
on(facet, 'facet-state-change', this.on_facet_state_changed.bind(this));
|
||||
}
|
||||
|
||||
if (this.current_facet !== facet) {
|
||||
@ -503,4 +502,4 @@ define([
|
||||
});
|
||||
|
||||
return App;
|
||||
});
|
||||
});
|
||||
|
@ -19,13 +19,12 @@
|
||||
*/
|
||||
|
||||
define(['dojo/_base/declare',
|
||||
'dojo/_base/lang',
|
||||
'dojo/on',
|
||||
'./builder',
|
||||
'./field',
|
||||
'./ordered-map'
|
||||
],
|
||||
function(declare, lang, on, builder, field_mod, ordered_map) {
|
||||
function(declare, on, builder, field_mod, ordered_map) {
|
||||
|
||||
/**
|
||||
* Form mixin
|
||||
@ -120,7 +119,7 @@ define(['dojo/_base/declare',
|
||||
*/
|
||||
register_field_listeners: function(field) {
|
||||
|
||||
on(field, 'dirty-change', lang.hitch(this, this.on_field_dirty_change));
|
||||
on(field, 'dirty-change', this.on_field_dirty_change.bind(this));
|
||||
},
|
||||
|
||||
/**
|
||||
@ -201,4 +200,4 @@ define(['dojo/_base/declare',
|
||||
});
|
||||
|
||||
return FormMixin;
|
||||
});
|
||||
});
|
||||
|
@ -19,14 +19,13 @@
|
||||
*/
|
||||
|
||||
define([
|
||||
'dojo/_base/lang',
|
||||
'dojo/_base/array',
|
||||
'dojo/_base/declare',
|
||||
'dojo/Deferred',
|
||||
'dojo/promise/all',
|
||||
'dojo/topic',
|
||||
'../ordered-map'
|
||||
], function(lang, array, declare, Deferred, all, topic, ordered_map) {
|
||||
], function(array, declare, Deferred, all, topic, ordered_map) {
|
||||
|
||||
|
||||
/**
|
||||
@ -138,13 +137,13 @@ define([
|
||||
promises.push(promise);
|
||||
});
|
||||
|
||||
all(promises).then(lang.hitch(this, function(results) {
|
||||
all(promises).then(function(results) {
|
||||
topic.publish('phase-finished',
|
||||
{ phase: phase.name, results: results });
|
||||
if (next_phase) {
|
||||
this.next_phase(next_phase);
|
||||
}
|
||||
}), function(results) {
|
||||
}.bind(this), function(results) {
|
||||
topic.publish('phase-error',
|
||||
{ phase: phase.name, results: results });
|
||||
// don't go for next phase on error, let app decide what to do
|
||||
@ -248,12 +247,12 @@ define([
|
||||
this.phases = ordered_map();
|
||||
|
||||
var phases = spec.phases || [];
|
||||
array.forEach(phases, lang.hitch(this, function(phase) {
|
||||
array.forEach(phases, function(phase) {
|
||||
this.add_phase(phase);
|
||||
}));
|
||||
}.bind(this));
|
||||
}
|
||||
});
|
||||
|
||||
return Phase_controller;
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -55,13 +55,13 @@ define([
|
||||
*/
|
||||
register_phases: function() {
|
||||
|
||||
phases.on('init', lang.hitch(this, function() {
|
||||
phases.on('init', function() {
|
||||
var app = this.app = new this.App_class();
|
||||
app.init();
|
||||
return app;
|
||||
}));
|
||||
}.bind(this));
|
||||
|
||||
phases.on('init', lang.hitch(this, function() {
|
||||
phases.on('init', function() {
|
||||
var deferred = new Deferred();
|
||||
|
||||
function reject(item) {
|
||||
@ -96,9 +96,9 @@ define([
|
||||
deferred.resolve();
|
||||
}
|
||||
return deferred.promise;
|
||||
}));
|
||||
}.bind(this));
|
||||
|
||||
phases.on('metadata', lang.hitch(this, function() {
|
||||
phases.on('metadata', function() {
|
||||
var deferred = new Deferred();
|
||||
|
||||
this.app.get_configuration(function(success) {
|
||||
@ -108,30 +108,30 @@ define([
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}));
|
||||
}.bind(this));
|
||||
|
||||
phases.on('profile', lang.hitch(this, function() {
|
||||
phases.on('profile', function() {
|
||||
this.app.choose_profile();
|
||||
}));
|
||||
}.bind(this));
|
||||
|
||||
phases.on('runtime', lang.hitch(this, function() {
|
||||
phases.on('runtime', function() {
|
||||
return this.app.start_runtime();
|
||||
}));
|
||||
}.bind(this));
|
||||
|
||||
phases.on('shutdown', lang.hitch(this, function() {
|
||||
phases.on('shutdown', function() {
|
||||
return this.app.start_logout();
|
||||
}));
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
simple_mode_phases: function() {
|
||||
|
||||
phases.on('init', lang.hitch(this, function() {
|
||||
phases.on('init', function() {
|
||||
var app = this.app = new this.App_class();
|
||||
app.init();
|
||||
return app;
|
||||
}));
|
||||
}.bind(this));
|
||||
|
||||
phases.on('runtime', lang.hitch(this, function() {
|
||||
phases.on('runtime', function() {
|
||||
var d = new Deferred();
|
||||
var facet = reg.facet.get(this.target_facet);
|
||||
if (!facet) {
|
||||
@ -140,24 +140,24 @@ define([
|
||||
this.app.show_facet(facet);
|
||||
}
|
||||
return d.promise;
|
||||
}));
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
run: function() {
|
||||
when(plugin_loader.load_plugins(), lang.hitch(this, function() {
|
||||
when(plugin_loader.load_plugins(), function() {
|
||||
this.register_phases();
|
||||
phases.controller.run();
|
||||
}));
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
run_simple: function(facet) {
|
||||
this.target_facet = facet;
|
||||
when(plugin_loader.load_plugins(), lang.hitch(this, function() {
|
||||
when(plugin_loader.load_plugins(), function() {
|
||||
this.simple_mode_phases();
|
||||
phases.controller.run();
|
||||
}));
|
||||
}.bind(this));
|
||||
}
|
||||
});
|
||||
|
||||
return app;
|
||||
});
|
||||
});
|
||||
|
@ -155,13 +155,13 @@ IPA.opened_dialogs = {
|
||||
this.app = app;
|
||||
|
||||
this.handlers.push(topic.subscribe('dialog.open',
|
||||
lang.hitch(this, this.on_dialog_open)));
|
||||
this.on_dialog_open.bind(this)));
|
||||
|
||||
this.handlers.push(topic.subscribe('dialog.opened',
|
||||
lang.hitch(this, this.on_dialog_opened)));
|
||||
this.on_dialog_opened.bind(this)));
|
||||
|
||||
this.handlers.push(topic.subscribe('dialog.closed',
|
||||
lang.hitch(this, this.on_dialog_closed)));
|
||||
this.on_dialog_closed.bind(this)));
|
||||
}
|
||||
};
|
||||
|
||||
@ -573,11 +573,11 @@ IPA.dialog = function(spec) {
|
||||
this.emit('open', { source: that });
|
||||
topic.publish('dialog.open', { source: that });
|
||||
|
||||
this.show(lang.hitch(this, function() {
|
||||
this.show(function() {
|
||||
that.focus_first_element();
|
||||
that.emit('opened', { source: that });
|
||||
topic.publish('dialog.opened', { source: that });
|
||||
}));
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
/**
|
||||
@ -673,12 +673,12 @@ IPA.dialog = function(spec) {
|
||||
if (!that.dom_node) return;
|
||||
|
||||
var dom_node = that.dom_node;
|
||||
this.hide(lang.hitch(this, function() {
|
||||
this.hide(function() {
|
||||
dom_node.remove();
|
||||
that.dom_node = null;
|
||||
that.emit('closed', { source: that });
|
||||
topic.publish('dialog.closed', { source: that });
|
||||
}));
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -349,9 +349,9 @@ define(['dojo/_base/declare',
|
||||
this.requires_auth = spec.requires_auth;
|
||||
}
|
||||
this.state = new mod_facet.FacetState();
|
||||
on(this.state, 'set', lang.hitch(this, this.on_state_set));
|
||||
on(this.state, 'set', this.on_state_set.bind(this));
|
||||
}
|
||||
});
|
||||
|
||||
return Facet;
|
||||
});
|
||||
});
|
||||
|
@ -19,11 +19,10 @@
|
||||
*/
|
||||
|
||||
define(['dojo/_base/declare',
|
||||
'dojo/_base/lang',
|
||||
'dojo/Evented',
|
||||
'dojo/router'
|
||||
],
|
||||
function(declare, lang, Evented, router) {
|
||||
function(declare, Evented, router) {
|
||||
|
||||
/**
|
||||
* Router
|
||||
@ -81,7 +80,7 @@ define(['dojo/_base/declare',
|
||||
}
|
||||
} else {
|
||||
var r = this.route_prefix + route;
|
||||
this.route_handlers.push(router.register(r, lang.hitch(this, handler)));
|
||||
this.route_handlers.push(router.register(r, handler.bind(this)));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -77,23 +77,23 @@ define([
|
||||
|
||||
var plugins_loaded = new Deferred();
|
||||
|
||||
require(['freeipa/plugins'], lang.hitch(this, function(plugins) {
|
||||
require(['freeipa/plugins'], function(plugins) {
|
||||
var loading = [];
|
||||
|
||||
this.register_plugins(plugins);
|
||||
|
||||
array.forEach(plugins, lang.hitch(this, function(plugin) {
|
||||
array.forEach(plugins, function(plugin) {
|
||||
loading.push(this.load_plugin(plugin));
|
||||
}));
|
||||
}.bind(this));
|
||||
|
||||
all(loading).then(function(results) {
|
||||
plugins_loaded.resolve(results);
|
||||
});
|
||||
}));
|
||||
}.bind(this));
|
||||
|
||||
return plugins_loaded.promise;
|
||||
}
|
||||
};
|
||||
|
||||
return plugin_loader;
|
||||
});
|
||||
});
|
||||
|
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
define(['dojo/_base/declare',
|
||||
'dojo/_base/lang',
|
||||
'dojo/on',
|
||||
'../facets/Facet',
|
||||
'../phases',
|
||||
@ -13,7 +12,7 @@ define(['dojo/_base/declare',
|
||||
'../builder'
|
||||
],
|
||||
|
||||
function(declare, lang, on, Facet, phases, reg, widget,
|
||||
function(declare, on, Facet, phases, reg, widget,
|
||||
APIBrowserWidget, builder) {
|
||||
|
||||
|
||||
@ -54,7 +53,7 @@ plugins.api_browser.APIBrowserFacet = declare([Facet], {
|
||||
this.inherited(arguments);
|
||||
var browser = this.get_widget('apibrowser');
|
||||
|
||||
on(this, 'show', lang.hitch(this, function(args) {
|
||||
on(this, 'show', function(args) {
|
||||
|
||||
var state = this.get_state();
|
||||
var t = state.type;
|
||||
@ -74,16 +73,16 @@ plugins.api_browser.APIBrowserFacet = declare([Facet], {
|
||||
}
|
||||
browser.show_default();
|
||||
return;
|
||||
}));
|
||||
}.bind(this));
|
||||
|
||||
// Reflect item change in facet state and therefore URL hash
|
||||
browser.watch('current', lang.hitch(this, function(name, old, value) {
|
||||
browser.watch('current', function(name, old, value) {
|
||||
var state = {};
|
||||
if (value.type && value.name) {
|
||||
state = { type: value.type, name: value.name };
|
||||
}
|
||||
this.set_state(state);
|
||||
}));
|
||||
}.bind(this));
|
||||
}
|
||||
});
|
||||
|
||||
@ -103,4 +102,4 @@ phases.on('registration', function() {
|
||||
|
||||
return plugins.api_browser;
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -433,16 +433,16 @@ topology.TopologyGraphFacet = declare([Facet, ActionMixin, HeaderMixin], {
|
||||
var graph = this.get_widget('topology-graph');
|
||||
var listener = this.resize_listener.bind(this, graph);
|
||||
|
||||
on(this, 'show', lang.hitch(this, function(args) {
|
||||
on(this, 'show', function(args) {
|
||||
var size = this.calculate_canvas_size();
|
||||
graph.update(size);
|
||||
|
||||
$(window).on('resize', null, listener);
|
||||
}));
|
||||
}.bind(this));
|
||||
|
||||
on(graph, 'link-selected', lang.hitch(this, function(data) {
|
||||
on(graph, 'link-selected', function(data) {
|
||||
this.set_selected_link(data.link);
|
||||
}));
|
||||
}.bind(this));
|
||||
|
||||
on(this, 'hide', function () {
|
||||
$(window).off('resize', null, listener);
|
||||
@ -662,11 +662,11 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
|
||||
sizelimit: 0
|
||||
}
|
||||
}).execute();
|
||||
when(s_promise, lang.hitch(this, function(results) {
|
||||
when(s_promise, function(results) {
|
||||
// suffixes load success
|
||||
var servers = results.data.result.result;
|
||||
deferred.resolve(servers);
|
||||
}), function(results) {
|
||||
}.bind(this), function(results) {
|
||||
deferred.reject({
|
||||
message: 'unable to load servers',
|
||||
results: results
|
||||
@ -701,7 +701,7 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
|
||||
|
||||
var suff_promise = get_suffixes();
|
||||
|
||||
when(suff_promise, lang.hitch(this, function(results) {
|
||||
when(suff_promise, function(results) {
|
||||
// suffixes load success
|
||||
var suffixes = results.data.result.result;
|
||||
var segment_promises = [];
|
||||
@ -710,26 +710,26 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
|
||||
var promise = get_segments(suffix['cn'][0]);
|
||||
segment_promises.push(promise);
|
||||
}
|
||||
all(segment_promises).then(lang.hitch(this, function(results) {
|
||||
all(segment_promises).then(function(results) {
|
||||
// segments load success
|
||||
for (var j=0,l=results.length; j<l; j++) {
|
||||
suffixes[j].segments = results[j].data.result.result;
|
||||
}
|
||||
deferred.resolve(suffixes);
|
||||
}), lang.hitch(this, function(results) {
|
||||
}.bind(this), function(results) {
|
||||
// segments load failed
|
||||
deferred.reject({
|
||||
message: 'unable to load segments',
|
||||
results: results
|
||||
});
|
||||
}));
|
||||
}), lang.hitch(this, function(results) {
|
||||
}.bind(this));
|
||||
}.bind(this), function(results) {
|
||||
// suffix load failed
|
||||
deferred.reject({
|
||||
message: 'unable to load suffixes',
|
||||
results: results
|
||||
});
|
||||
}));
|
||||
}.bind(this));
|
||||
|
||||
return deferred.promise;
|
||||
},
|
||||
@ -818,10 +818,10 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
|
||||
var segments = this._get_suffixes();
|
||||
var masters = this._get_servers();
|
||||
|
||||
all([masters, segments]).then(lang.hitch(this, function(raw) {
|
||||
all([masters, segments]).then(function(raw) {
|
||||
var data = this._transform_data(raw[0], raw[1]);
|
||||
deferred.resolve(data);
|
||||
}), function(error) {
|
||||
}.bind(this), function(error) {
|
||||
deferred.reject(error);
|
||||
});
|
||||
|
||||
@ -836,7 +836,7 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
|
||||
|
||||
if (IPA.domain_level < topology.required_domain_level) return;
|
||||
|
||||
when(this._get_data()).then(lang.hitch(this, function(data) {
|
||||
when(this._get_data()).then(function(data) {
|
||||
if (!this.graph) {
|
||||
this.graph = new topology_graph.TopoGraph({
|
||||
nodes: data.nodes,
|
||||
@ -854,7 +854,7 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
|
||||
}
|
||||
this.graph.update(data.nodes, data.links, data.suffixes);
|
||||
}
|
||||
}), function(error) {
|
||||
}.bind(this), function(error) {
|
||||
IPA.notify(error.message, 'error');
|
||||
});
|
||||
},
|
||||
|
@ -149,7 +149,7 @@ topology_graph.TopoGraph = declare([Evented], {
|
||||
l.size([this.width, this.height]);
|
||||
l.linkDistance(150);
|
||||
l.charge(-1000);
|
||||
l.on('tick', lang.hitch(this, this._tick));
|
||||
l.on('tick', this._tick.bind(this));
|
||||
|
||||
var that = this;
|
||||
|
||||
|
@ -359,18 +359,18 @@ widgets.APIBrowserWidget = declare([Stateful, Evented], {
|
||||
|
||||
_init_widgets: function() {
|
||||
this.filter_w = new browser_widgets.FilterWidget();
|
||||
this.filter_w.watch('filter', lang.hitch(this, function(name, old, value) {
|
||||
this.filter_w.watch('filter', function(name, old, value) {
|
||||
this._apply_filter(value);
|
||||
}));
|
||||
}.bind(this));
|
||||
|
||||
this.list_w = new ListViewWidget();
|
||||
this.object_detail_w = new browser_widgets.ObjectDetailWidget();
|
||||
this.command_detail_w = new browser_widgets.CommandDetailWidget();
|
||||
this.param_detail_w = new browser_widgets.ParamDetailWidget();
|
||||
|
||||
on(this.list_w, 'item-click', lang.hitch(this, function(args) {
|
||||
on(this.list_w, 'item-click', function(args) {
|
||||
this._item_selected(args.context);
|
||||
}));
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
constructor: function(spec) {
|
||||
@ -380,4 +380,4 @@ widgets.APIBrowserWidget = declare([Stateful, Evented], {
|
||||
});
|
||||
|
||||
return widgets.APIBrowserWidget;
|
||||
});
|
||||
});
|
||||
|
@ -18,10 +18,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
define(['dojo/_base/declare',
|
||||
'dojo/_base/lang',
|
||||
'dojo/on',
|
||||
'../jquery',
|
||||
'./DropdownWidget'], function(declare, lang, on, $, DropdownWidget) {
|
||||
'./DropdownWidget'], function(declare, on, $, DropdownWidget) {
|
||||
|
||||
return declare([DropdownWidget], {
|
||||
/**
|
||||
@ -95,8 +94,8 @@ define(['dojo/_base/declare',
|
||||
*/
|
||||
add_action: function(action, batch) {
|
||||
this.actions.put(action.name, action);
|
||||
action.enabled_changed.attach(lang.hitch(this, this.action_enabled_changed));
|
||||
action.visible_changed.attach(lang.hitch(this, this.action_visible_changed));
|
||||
action.enabled_changed.attach(this.action_enabled_changed.bind(this));
|
||||
action.visible_changed.attach(this.action_visible_changed.bind(this));
|
||||
|
||||
if (!batch) {
|
||||
this.recreate_options();
|
||||
@ -146,8 +145,8 @@ define(['dojo/_base/declare',
|
||||
|
||||
if (action.enabled) {
|
||||
action.execute(this.facet,
|
||||
lang.hitch(this, this.on_action_success),
|
||||
lang.hitch(this, this.on_action_error));
|
||||
this.on_action_success.bind(this),
|
||||
this.on_action_error.bind(this));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
*/
|
||||
|
||||
define(['dojo/_base/declare',
|
||||
'dojo/_base/lang',
|
||||
'dojo/_base/array',
|
||||
'dojo/dom',
|
||||
'dojo/dom-construct',
|
||||
@ -35,7 +34,7 @@ define(['dojo/_base/declare',
|
||||
'../widget',
|
||||
'dojo/NodeList-dom'
|
||||
],
|
||||
function(declare, lang, array, dom, construct, prop, dom_class,
|
||||
function(declare, array, dom, construct, prop, dom_class,
|
||||
dom_style, query, on, Menu, DropdownWidget,
|
||||
FacetContainer, text, widgets) {
|
||||
|
||||
@ -280,11 +279,11 @@ define(['dojo/_base/declare',
|
||||
}
|
||||
]
|
||||
});
|
||||
on(this.user_menu, 'item-click', lang.hitch(this, this.on_user_menu_click));
|
||||
on(this.menu_widget, 'item-select', lang.hitch(this, this.on_menu_item_click));
|
||||
on(this.user_menu, 'item-click', this.on_user_menu_click.bind(this));
|
||||
on(this.menu_widget, 'item-select', this.on_menu_item_click.bind(this));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return app;
|
||||
});
|
||||
});
|
||||
|
@ -261,10 +261,10 @@ define(['dojo/_base/declare',
|
||||
var ul = this._render_list(li, true);
|
||||
this._render_items(item.items, ul);
|
||||
} else {
|
||||
on(a, 'click', lang.hitch(this, function(event) {
|
||||
on(a, 'click', function(event) {
|
||||
this.on_item_click(event, item);
|
||||
event.preventDefault();
|
||||
}));
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
if (container) {
|
||||
|
@ -19,7 +19,6 @@
|
||||
*/
|
||||
|
||||
define(['dojo/_base/declare',
|
||||
'dojo/_base/lang',
|
||||
'dojo/dom-construct',
|
||||
'dojo/dom-style',
|
||||
'dojo/query',
|
||||
@ -32,7 +31,7 @@ define(['dojo/_base/declare',
|
||||
'../util',
|
||||
'./LoginScreenBase'
|
||||
],
|
||||
function(declare, lang, construct, dom_style, query, on,
|
||||
function(declare, construct, dom_style, query, on,
|
||||
IPA, auth, reg, FieldBinder, text, util, LoginScreenBase) {
|
||||
|
||||
|
||||
@ -91,7 +90,7 @@ define(['dojo/_base/declare',
|
||||
name: 'sync',
|
||||
label: text.get('@i18n:login.sync_otp_token', "Sync OTP Token"),
|
||||
button_class: 'btn btn-link',
|
||||
click: lang.hitch(this, this.on_sync)
|
||||
click: this.on_sync.bind(this)
|
||||
})[0];
|
||||
construct.place(this.sync_btn_node, container);
|
||||
construct.place(document.createTextNode(" "), container);
|
||||
@ -100,7 +99,7 @@ define(['dojo/_base/declare',
|
||||
name: 'login',
|
||||
label: text.get('@i18n:login.login', "Login"),
|
||||
'class': 'btn-primary btn-lg',
|
||||
click: lang.hitch(this, this.on_confirm)
|
||||
click: this.on_confirm.bind(this)
|
||||
})[0];
|
||||
construct.place(this.login_btn_node, container);
|
||||
construct.place(document.createTextNode(" "), container);
|
||||
@ -109,7 +108,7 @@ define(['dojo/_base/declare',
|
||||
name: 'cancel',
|
||||
label: text.get('@i18n:buttons.cancel', "Cancel"),
|
||||
'class': 'btn-default',
|
||||
click: lang.hitch(this, this.on_cancel)
|
||||
click: this.on_cancel.bind(this)
|
||||
})[0];
|
||||
construct.place(this.cancel_btn_node, container);
|
||||
construct.place(document.createTextNode(" "), container);
|
||||
@ -118,7 +117,7 @@ define(['dojo/_base/declare',
|
||||
name: 'reset',
|
||||
label: text.get('@i18n:buttons.reset_password', "Reset Password"),
|
||||
'class': 'btn-primary btn-lg',
|
||||
click: lang.hitch(this, this.on_confirm)
|
||||
click: this.on_confirm.bind(this)
|
||||
})[0];
|
||||
construct.place(this.reset_btn_node, container);
|
||||
construct.place(document.createTextNode(" "), container);
|
||||
@ -127,7 +126,7 @@ define(['dojo/_base/declare',
|
||||
name: 'reset_and_login',
|
||||
label: text.get('@i18n:buttons.reset_password_and_login', "Reset Password and Login"),
|
||||
'class': 'btn-primary btn-lg',
|
||||
click: lang.hitch(this, this.on_confirm)
|
||||
click: this.on_confirm.bind(this)
|
||||
})[0];
|
||||
construct.place(this.reset_and_login_btn_node, container);
|
||||
},
|
||||
@ -148,9 +147,9 @@ define(['dojo/_base/declare',
|
||||
var p_f = this.get_field('password');
|
||||
var otp_f = this.get_field('otp');
|
||||
|
||||
u_f.on('value-change', lang.hitch(this, this.on_form_change));
|
||||
p_f.on('value-change', lang.hitch(this, this.on_form_change));
|
||||
otp_f.on('value-change', lang.hitch(this, this.on_otp_change));
|
||||
u_f.on('value-change', this.on_form_change.bind(this));
|
||||
p_f.on('value-change', this.on_form_change.bind(this));
|
||||
otp_f.on('value-change', this.on_otp_change.bind(this));
|
||||
this.on_form_change();
|
||||
},
|
||||
|
||||
@ -208,14 +207,14 @@ define(['dojo/_base/declare',
|
||||
|
||||
login_with_kerberos: function() {
|
||||
|
||||
IPA.get_credentials().then(lang.hitch(this, function(status) {
|
||||
IPA.get_credentials().then(function(status) {
|
||||
if (status === 200) {
|
||||
this.emit('logged_in');
|
||||
} else {
|
||||
var val_summary = this.get_widget('validation');
|
||||
val_summary.add_error('login', this.krb_auth_failed);
|
||||
}
|
||||
}));
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
login_with_password: function() {
|
||||
@ -228,7 +227,7 @@ define(['dojo/_base/declare',
|
||||
var password = password_f.get_value()[0];
|
||||
|
||||
IPA.login_password(login, password).then(
|
||||
lang.hitch(this, function(result) {
|
||||
function(result) {
|
||||
|
||||
if (result === 'success') {
|
||||
this.emit('logged_in');
|
||||
@ -249,7 +248,7 @@ define(['dojo/_base/declare',
|
||||
password_f.set_value('');
|
||||
val_summary.add_error('login', this.form_auth_failed);
|
||||
}
|
||||
}));
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
login_and_reset: function() {
|
||||
|
@ -19,7 +19,6 @@
|
||||
*/
|
||||
|
||||
define(['dojo/_base/declare',
|
||||
'dojo/_base/lang',
|
||||
'dojo/dom-construct',
|
||||
'dojo/dom-style',
|
||||
'dojo/query',
|
||||
@ -35,7 +34,7 @@ define(['dojo/_base/declare',
|
||||
'../util',
|
||||
'./ContainerMixin'
|
||||
],
|
||||
function(declare, lang, construct, dom_style, query, on,
|
||||
function(declare, construct, dom_style, query, on,
|
||||
Evented, Stateful, IPA, auth, reg, FieldBinder, FormMixin, text,
|
||||
util, ContainerMixin) {
|
||||
|
||||
@ -239,8 +238,8 @@ define(['dojo/_base/declare',
|
||||
// input field, but we need to listen to keydown events which are
|
||||
// not exposed
|
||||
var nodes = query("input[type=text],input[type=password]", this.dom_node);
|
||||
nodes.on('keypress', lang.hitch(this, this.check_caps_lock));
|
||||
nodes.on('keydown', lang.hitch(this, this.check_caps_lock_press));
|
||||
nodes.on('keypress', this.check_caps_lock.bind(this));
|
||||
nodes.on('keydown', this.check_caps_lock_press.bind(this));
|
||||
},
|
||||
|
||||
/**
|
||||
@ -342,4 +341,4 @@ define(['dojo/_base/declare',
|
||||
}
|
||||
});
|
||||
return LoginScreenBase;
|
||||
});
|
||||
});
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
define(['dojo/_base/declare',
|
||||
'dojo/_base/array',
|
||||
'dojo/_base/lang',
|
||||
'dojo/dom',
|
||||
'dojo/dom-construct',
|
||||
'dojo/dom-prop',
|
||||
@ -31,7 +30,7 @@ define(['dojo/_base/declare',
|
||||
'dojo/Evented',
|
||||
'dojo/on',
|
||||
'../jquery',
|
||||
'../ipa'], function(declare, array, lang, dom, construct, prop, dom_class,
|
||||
'../ipa'], function(declare, array, dom, construct, prop, dom_class,
|
||||
dom_style, attr, query, Evented, on, $, IPA) {
|
||||
|
||||
return declare([Evented], {
|
||||
@ -176,9 +175,9 @@ define(['dojo/_base/declare',
|
||||
if (container) {
|
||||
construct.place(item_container, container);
|
||||
// use jQuery resize to make use of window.resize throttling
|
||||
$(window).bind('resize', lang.hitch(this, function() {
|
||||
$(window).bind('resize', function() {
|
||||
this._adjust_size(container, item_container, level);
|
||||
}));
|
||||
}.bind(this));
|
||||
}
|
||||
return item_container;
|
||||
},
|
||||
@ -284,10 +283,10 @@ define(['dojo/_base/declare',
|
||||
this.menu = menu;
|
||||
//get all items
|
||||
var q = menu.items.query();
|
||||
q.observe(lang.hitch(this, this._items_changed), true);
|
||||
on(this.menu, 'selected', lang.hitch(this, function(event) {
|
||||
q.observe(this._items_changed.bind(this), true);
|
||||
on(this.menu, 'selected', function(event) {
|
||||
this.select(event.new_selection);
|
||||
}));
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
/**
|
||||
@ -329,4 +328,4 @@ define(['dojo/_base/declare',
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -19,7 +19,6 @@
|
||||
*/
|
||||
|
||||
define(['dojo/_base/declare',
|
||||
'dojo/_base/lang',
|
||||
'dojo/Deferred',
|
||||
'dojo/dom-construct',
|
||||
'dojo/dom-style',
|
||||
@ -33,7 +32,7 @@ define(['dojo/_base/declare',
|
||||
'../util',
|
||||
'./LoginScreenBase'
|
||||
],
|
||||
function(declare, lang, Deferred, construct, dom_style, query, on,
|
||||
function(declare, Deferred, construct, dom_style, query, on,
|
||||
IPA, auth, reg, FieldBinder, text, util, LoginScreenBase) {
|
||||
|
||||
|
||||
@ -63,7 +62,7 @@ define(['dojo/_base/declare',
|
||||
name: 'cancel',
|
||||
label: 'Cancel',
|
||||
'class': 'btn-default btn-lg',
|
||||
click: lang.hitch(this, this.on_cancel)
|
||||
click: this.on_cancel.bind(this)
|
||||
})[0];
|
||||
if (this.allow_cancel) {
|
||||
construct.place(this.cancel_btn_node, container);
|
||||
@ -71,7 +70,7 @@ define(['dojo/_base/declare',
|
||||
this.sync_btn_node = IPA.button({
|
||||
label: text.get('@i18n:password.sync_otp_token', "Sync OTP Token"),
|
||||
'class': 'btn-primary btn-lg',
|
||||
click: lang.hitch(this, this.on_confirm)
|
||||
click: this.on_confirm.bind(this)
|
||||
})[0];
|
||||
construct.place(this.sync_btn_node, container);
|
||||
},
|
||||
@ -118,7 +117,7 @@ define(['dojo/_base/declare',
|
||||
var token = this.get_field('token').get_value()[0];
|
||||
|
||||
var p = this.sync_core(user, password, otp1, otp2, token);
|
||||
p.then(lang.hitch(this, function(result) {
|
||||
p.then( function(result) {
|
||||
var msg = this.sync_fail;
|
||||
var evt = 'sync-fail';
|
||||
var type = 'error';
|
||||
@ -134,7 +133,7 @@ define(['dojo/_base/declare',
|
||||
val_summary.add_error('sync', msg);
|
||||
}
|
||||
this.emit(evt, { source: this, message: msg, status: result });
|
||||
}));
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
sync_core: function(user, password, otp1, otp2, token) {
|
||||
@ -237,4 +236,4 @@ define(['dojo/_base/declare',
|
||||
];
|
||||
|
||||
return SyncOTPScreen;
|
||||
});
|
||||
});
|
||||
|
@ -490,14 +490,14 @@ widgets.browser_widgets.FilterWidget = declare([widgets.browser_widgets.Base], {
|
||||
placeholder: 'type to filter...',
|
||||
title: 'accepts case insensitive regular expression'
|
||||
});
|
||||
this._filter_el.bind('input', lang.hitch(this, function() {
|
||||
this._filter_el.bind('input', function() {
|
||||
var filter = this._filter_el.val();
|
||||
this.set('filter', filter);
|
||||
}));
|
||||
}.bind(this));
|
||||
this._filter_el.appendTo(this.el);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return widgets.browser_widgets;
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user