|
|
|
@ -8,9 +8,10 @@
|
|
|
|
|
// Filename: app.js
|
|
|
|
|
define([
|
|
|
|
|
"underscore"
|
|
|
|
|
, "jquery"
|
|
|
|
|
, "backbone"
|
|
|
|
|
, "async"
|
|
|
|
|
, "backbone"
|
|
|
|
|
, "jquery"
|
|
|
|
|
, "bootstrap"
|
|
|
|
|
|
|
|
|
|
, "config"
|
|
|
|
|
|
|
|
|
@ -35,9 +36,10 @@ define([
|
|
|
|
|
],
|
|
|
|
|
function(
|
|
|
|
|
_
|
|
|
|
|
, $
|
|
|
|
|
, Backbone
|
|
|
|
|
, async
|
|
|
|
|
, Backbone
|
|
|
|
|
, $
|
|
|
|
|
, Bootstrap
|
|
|
|
|
|
|
|
|
|
, Config
|
|
|
|
|
|
|
|
|
@ -176,7 +178,7 @@ _
|
|
|
|
|
pushState: true
|
|
|
|
|
, root: Config.docRoot
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
console.log(Bootstrap);
|
|
|
|
|
// For now let's reset the state when we start up
|
|
|
|
|
//that.navigate("", false);
|
|
|
|
|
|
|
|
|
@ -283,20 +285,21 @@ _
|
|
|
|
|
|
|
|
|
|
if (that.loadingStates === 0) {
|
|
|
|
|
clearTimeout(that.loadingTimeout);
|
|
|
|
|
that.loadingModal.modal("hide");
|
|
|
|
|
if (that.loadingModal.modal) {
|
|
|
|
|
that.loadingModal.modal("hide");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
server.client.on("unauthorized", function __fnAppEventClientUnauthorized(client, xhr) {
|
|
|
|
|
var tmplHtml = _.template(tmplModalLogin)({ dmap_itemname: client.url() })
|
|
|
|
|
, $tmpl = $(tmplHtml)
|
|
|
|
|
var tmplHtml = _.template(tmplModalLogin)({ dmap_itemname: client.url() })
|
|
|
|
|
, serverModel = that.servers.get(client.attributes.hostname)
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
$tmpl.modal();
|
|
|
|
|
that._modalLogin = $(tmplHtml);
|
|
|
|
|
|
|
|
|
|
$tmpl.find("form").on("submit", function __fnAppEventModalLogin(event) {
|
|
|
|
|
that._modalLogin.find("form").on("submit", function __fnAppEventModalLogin(event) {
|
|
|
|
|
var username = $(event.target).find("input[type='text']").val()
|
|
|
|
|
, password = $(event.target).find("input[type='password']").val()
|
|
|
|
|
, saveCredentials = $(event.target).find("input[type='checkbox']").is(':checked')
|
|
|
|
@ -313,14 +316,14 @@ _
|
|
|
|
|
serverModel.save(newModel, {silence: true});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$tmpl.modal("hide");
|
|
|
|
|
that._modalLogin.modal("hide");
|
|
|
|
|
|
|
|
|
|
setTimeout(client.init, 250);
|
|
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$tmpl.delegate("input[type='checkbox']", "click", function __fnEventModalRemember(event) {
|
|
|
|
|
that._modalLogin.delegate("input[type='checkbox']", "click", function __fnEventModalRemember(event) {
|
|
|
|
|
if (event.target.checked === true) {
|
|
|
|
|
if (!confirm("Using this feature will save the login and password locally in clear text, are you sure?")) {
|
|
|
|
|
event.target.checked = false;
|
|
|
|
@ -328,6 +331,10 @@ _
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setTimeout(function __fnEventAppUnauthorizedDisplayModal() {
|
|
|
|
|
that._modalLogin.modal();
|
|
|
|
|
}, 50);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
server.client.init();
|
|
|
|
@ -335,15 +342,11 @@ _
|
|
|
|
|
|
|
|
|
|
, __showModalAbout: function () {
|
|
|
|
|
var that = this
|
|
|
|
|
, $modal = $(tmplModalAbout)
|
|
|
|
|
, previousPush = window.location.pathname
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
if (previousPush.indexOf("/about") >= 0) {
|
|
|
|
|
previousPush = "";
|
|
|
|
|
}
|
|
|
|
|
that._modalAbout = $(tmplModalAbout);
|
|
|
|
|
|
|
|
|
|
$modal.on("hidden", function __fnEventAppModalAboutClosed(event) {
|
|
|
|
|
that._modalAbout.on("hidden", function __fnEventAppModalAboutClosed(event) {
|
|
|
|
|
if (window.history.length === that.historyStart) {
|
|
|
|
|
that.navigate("", false);
|
|
|
|
|
} else {
|
|
|
|
@ -351,9 +354,7 @@ _
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
$modal.modal();
|
|
|
|
|
}, 50);
|
|
|
|
|
that._modalAbout.modal();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|