File: /home/imensosw/public_html/imenso.co/timesheet/js/app.js
if(!_.isObject(app)) {
alert("Object not found");
}
if(app.dev){
app.log("DEV MODE ON");
}
app.files = [{
name:"login",
file:'login.inc.html'
},
];
$(document).ready(function(){
app.setListeners();
app.init(function(){
app.startApp();
});
});
app.setListeners = function() {
app.setLibListeners();
}
/*app.launchUser = function() {
app.log("Launching with user ",app.user);
$.ajax({
method: "POST",
url: "api/imensoapi.php",
dataType: "json",
data: {
action: "launchload",
user: app.user
}
})
.fail(function() {
alert("There was an error connecting to the server SR[01]")
})
.done(function(resp) {
if (resp.resp == 'OK') {
if (resp.error) {
alert("Transaction error. " + resp.error);
} else {
app.log("User launched");
app.user = Cookies.getJSON('usertoken');
$('#userlogout').show();
$('#userlogin').hide();
if(app.user.acces_level=="admin")
{
window.location.href="timesheet";
}
// app.getUser();
$('#maincontainer').html("");
}
} else {
alert("There was an error connecting to the server SR[02]")
}
}); //- ajax
} //- launchUser
*/
app.startApp = function() {
app.log("Starting");
/*app.user = Cookies.getJSON('usertoken');
if (app.user && app.user.token && app.user.token.length > 20) {
//app.enableAdmin();
// alert('already login');
// window.location.href = app.location;
//app.launchUser();
} else {
*/
$("#maincontainer").html(app.templates.login());
// }
}
app.loadTemplates = function() {
app.templates.modal = _.template("<div class='modal fade' tabindex='-1' role='dialog' id='modal'><div class='modal-dialog' role='document'><div class='modal-content'><div class='modal-header'><h5 class='modal-title'><%=title%></h5><button type='button' class='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>×</span></button></div><div class='modal-body'><%=content%></div><div style='display:none' class='modal-footer'><button type='button' class='btn btn-default' data-dismiss='modal'>Close</button></div></div></div></div>");
}
;