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