Basic working application
This commit is contained in:
parent
5e51139252
commit
40ddfb39fd
9
assets/css/other.css
Normal file
9
assets/css/other.css
Normal file
@ -0,0 +1,9 @@
|
||||
/*
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#card-box .col {
|
||||
padding: 15px;
|
||||
}
|
39
cards/js/qwikclock_punchinout.js
Normal file
39
cards/js/qwikclock_punchinout.js
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
$(".card_qwikclock_punchinout").on("click", ".start_btn", function () {
|
||||
var parent = $(this).parents(".card_app");
|
||||
var url = parent.data("apiurl");
|
||||
console.log(url + " " + getuser());
|
||||
$.post(url, {
|
||||
username: getuser(),
|
||||
password: getAPIKey(),
|
||||
action: "punchin"
|
||||
}, function (resp) {
|
||||
if (resp.status == "OK") {
|
||||
showmsg(resp.msg, "success");
|
||||
} else {
|
||||
showmsg(resp.msg, "danger");
|
||||
}
|
||||
}, "json");
|
||||
});
|
||||
|
||||
$(".card_qwikclock_punchinout").on("click", ".stop_btn", function () {
|
||||
var parent = $(this).parents(".card_app");
|
||||
var url = parent.data("apiurl");
|
||||
console.log(url + " " + getuser());
|
||||
$.post(url, {
|
||||
username: getuser(),
|
||||
password: getAPIKey(),
|
||||
action: "punchout"
|
||||
}, function (resp) {
|
||||
if (resp.status == "OK") {
|
||||
showmsg(resp.msg, "success");
|
||||
} else {
|
||||
showmsg(resp.msg, "danger");
|
||||
}
|
||||
}, "json");
|
||||
});
|
31
cards/js/taskfloor_viewmessages.js
Normal file
31
cards/js/taskfloor_viewmessages.js
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
|
||||
$(".card_taskfloor_viewmessages").each(function () {
|
||||
$(this).find(".card_title").append(" Messages");
|
||||
var msglist = $(this).find(".message-list");
|
||||
var url = $(this).data("apiurl");
|
||||
$.post(url, {
|
||||
username: getuser(),
|
||||
password: getAPIKey(),
|
||||
action: "getmsgs"
|
||||
}, function (resp) {
|
||||
if (resp.status == "OK") {
|
||||
var msgs = resp.messages;
|
||||
for (var msg in msgs) {
|
||||
msglist.append(
|
||||
'<div class="list-group-item">'
|
||||
+ '<small>' + msgs[msg]['from']['name'] + ' <i class="fas fa-caret-right"></i> ' + msgs[msg]['to']['name'] + '</small>'
|
||||
+ '<p class="mb-1">' + msgs[msg]['text'] + '</p>'
|
||||
+ '<small>' + msgs[msg]['sent'] + '</small>'
|
||||
+ '</div>');
|
||||
}
|
||||
} else {
|
||||
showmsg(resp.msg, "danger");
|
||||
}
|
||||
}, "json");
|
||||
});
|
32
cards/js/taskfloor_viewtasks.js
Normal file
32
cards/js/taskfloor_viewtasks.js
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
|
||||
$(".card_taskfloor_viewtasks").each(function () {
|
||||
$(this).find(".card_title").append(" Tasks");
|
||||
var tasklist = $(this).find(".task-list");
|
||||
var url = $(this).data("apiurl");
|
||||
$.post(url, {
|
||||
username: getuser(),
|
||||
password: getAPIKey(),
|
||||
action: "gettasks"
|
||||
}, function (resp) {
|
||||
if (resp.status == "OK") {
|
||||
var tasks = resp.tasks;
|
||||
for (var i = 0; i < tasks.length; i++) {
|
||||
tasklist.append(
|
||||
'<div class="list-group-item">'
|
||||
+ '<div class="d-flex w-100 justify-content-between">'
|
||||
+ '<h5 class="mb-1"><i class="fas fa-' + tasks[i]['icon'] + ' fa-fw"></i> ' + tasks[i]['title'] + '</h5>'
|
||||
+ '</div>'
|
||||
+ '<p>' + tasks[i]['description'] + '</p>'
|
||||
+ '</div>');
|
||||
}
|
||||
} else {
|
||||
showmsg(resp.msg, "danger");
|
||||
}
|
||||
}, "json");
|
||||
});
|
10
cards/qwikclock_punchinout.html
Normal file
10
cards/qwikclock_punchinout.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!--
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
-->
|
||||
<h3 class="card-header" style="background-color: #2196F3; color: white;"><i class="far fa-clock"></i> <span class="card_title">QwikClock</span></h3>
|
||||
<div class="card-body">
|
||||
<button class="btn btn-success btn-lg btn-block start_btn"><i class="fas fa-play"></i> Punch In</button>
|
||||
<button class="btn btn-danger btn-lg btn-block stop_btn"><i class="fas fa-stop"></i> Punch Out</button>
|
||||
</div>
|
10
cards/taskfloor_viewmessages.html
Normal file
10
cards/taskfloor_viewmessages.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!--
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
-->
|
||||
<h3 class="card-header"><i class="far fa-comments"></i> <span class="card_title">TaskFloor Messages</span></h3>
|
||||
<div class="card-body">
|
||||
<div class="list-group message-list">
|
||||
</div>
|
||||
</div>
|
10
cards/taskfloor_viewtasks.html
Normal file
10
cards/taskfloor_viewtasks.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!--
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
-->
|
||||
<h3 class="card-header"><i class="fas fa-tasks"></i> <span class="card_title">TaskFloor Tasks</span></h3>
|
||||
<div class="card-body">
|
||||
<div class="list-group task-list">
|
||||
</div>
|
||||
</div>
|
17
index.html
17
index.html
@ -9,9 +9,22 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel="icon" href="assets/img/logo_64.png">
|
||||
<link href="assets/css/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="assets/css/other.css" rel="stylesheet" />
|
||||
|
||||
<div id="content-frame" style="position: absolute; top: 0; left: 0; height: 100%; width: 100%;">
|
||||
|
||||
<div style="position: absolute; top: 0; left: 0; width: 99%; z-index: 9999999; padding: 10px;">
|
||||
<div class="btn btn-outline-primary btn-sm" id="sign-out-btn" style="display: none; position: fixed; top: 10px; right: 10px;" onclick="document.location.href = 'index.html'"><i class="fas fa-sign-out-alt"></i> Log out</div>
|
||||
<div class="row justify-content-center" id="alert-box">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="content-frame" style="position: absolute; top: 0; left: 0; height: 100%; width: 100%; padding-top: 30px;">
|
||||
|
||||
</div>
|
||||
|
||||
<div style="position: absolute; bottom: 0; left: 0; width: 100%; height: 3px; z-index: 9999999;" id="timeout-bar-box">
|
||||
<div id="timeout-bar" style="width: 0%; background-color: #2196F3; height: 100%;"></div>
|
||||
</div>
|
||||
|
||||
<script src="assets/js/jquery-3.2.1.min.js"></script>
|
||||
@ -22,5 +35,5 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
<script src="js/settings.js"></script>
|
||||
<script src="js/session.js"></script>
|
||||
<script>
|
||||
openScreen("login");
|
||||
openScreen("login");
|
||||
</script>
|
@ -7,10 +7,49 @@
|
||||
|
||||
function openScreen(id) {
|
||||
$('#content-frame').fadeOut('fast', function () {
|
||||
$('#content-frame').load("pages/" + id + ".html", function () {
|
||||
$('#content-frame').fadeIn('fast', function () {
|
||||
|
||||
});
|
||||
});
|
||||
$('#content-frame').load("pages/" + id + ".html", function () {
|
||||
$('#content-frame').fadeIn('fast', function () {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getApps(callback) {
|
||||
$.post(accounthubapi, {
|
||||
key: apikey,
|
||||
action: "listapps"
|
||||
}, function (resp) {
|
||||
if (resp.status == "OK") {
|
||||
callback(resp.apps);
|
||||
} else {
|
||||
alert(resp.msg);
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
|
||||
var msgtimeout = null;
|
||||
|
||||
function showmsg(text, style, details, timeout) {
|
||||
if (timeout == null) {
|
||||
timeout = 5 * 1000;
|
||||
}
|
||||
if (details == null) {
|
||||
details = "";
|
||||
} else {
|
||||
details = "<p>" + details + "</p>";
|
||||
}
|
||||
if (style == null) {
|
||||
style = "info";
|
||||
}
|
||||
$("#alert-box")
|
||||
.hide()
|
||||
.html('<div class="alert alert-' + style + ' alert-dismissible fade show" role="alert"><h5 class="alert-heading">' + text + '</h5>' + details + '<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span></button></div>')
|
||||
.fadeIn("fast");
|
||||
clearTimeout(msgtimeout);
|
||||
if (timeout !== false) {
|
||||
msgtimeout = setTimeout(function () {
|
||||
$("#alert-box").fadeOut("fast");
|
||||
}, timeout);
|
||||
}
|
||||
}
|
72
js/home.js
Normal file
72
js/home.js
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
var loadedCardTypes = [];
|
||||
|
||||
var totalCardTypes = [];
|
||||
|
||||
function loadCard(type, apiurl, title) {
|
||||
$.get("cards/" + type + ".html", {}, function (html) {
|
||||
console.log(type + " " + apiurl + " " + title);
|
||||
var box = $('<div class="col col-sm-12 col-md-6 col-lg-6 col-xl-4" id=""></div>');
|
||||
var card = $('<div class="card card_app card_' + type + '" style="width: 100%;" data-title="' + title + '" data-apiurl="' + apiurl + '"></div>');
|
||||
$(card).html(html);
|
||||
$(box).html(card);
|
||||
$("#card-box").append(box);
|
||||
if (loadedCardTypes.indexOf(type) == -1) {
|
||||
loadedCardTypes.push(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function applyCardTitles() {
|
||||
$(".card_app").each(function () {
|
||||
var title = $(this).data("title");
|
||||
$(this).find(".card_title").text(title);
|
||||
});
|
||||
}
|
||||
|
||||
function waitForCardsToLoadThenInjectScripts() {
|
||||
// How's *that* for self-documenting code?
|
||||
for (var i = 0; i < totalCardTypes.length; i++) {
|
||||
if (loadedCardTypes.indexOf(totalCardTypes[i]) == -1) {
|
||||
setTimeout(waitForCardsToLoadThenInjectScripts, 50);
|
||||
return;
|
||||
}
|
||||
}
|
||||
applyCardTitles();
|
||||
for (var i = 0; i < loadedCardTypes.length; i++) {
|
||||
$.getScript('cards/js/' + loadedCardTypes[i] + '.js');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getApps(function (apps) {
|
||||
console.log(apps);
|
||||
for (var appname in apps) {
|
||||
if (!apps.hasOwnProperty(appname)) {
|
||||
continue;
|
||||
}
|
||||
var app = apps[appname];
|
||||
console.log(app);
|
||||
console.log(" " + app.url);
|
||||
console.log(" " + app.title);
|
||||
if (typeof app.station_features !== "undefined" && app.station_features.length > 0) {
|
||||
for (var type in app.station_features) {
|
||||
if (!app.station_features.hasOwnProperty(type)) {
|
||||
continue;
|
||||
}
|
||||
totalCardTypes.push(app.station_features[type]);
|
||||
loadCard(app.station_features[type], app.url + "/api.php", app.title);
|
||||
}
|
||||
}
|
||||
}
|
||||
waitForCardsToLoadThenInjectScripts();
|
||||
});
|
||||
|
||||
startSessionTimeout();
|
||||
|
||||
$("#sign-out-btn").css("display", "inline-block");
|
@ -24,11 +24,11 @@ function userpasslogin(username, password) {
|
||||
setuid(resp.data.uid);
|
||||
openScreen("home");
|
||||
} else {
|
||||
alert(resp.msg);
|
||||
showmsg(resp.msg, "danger");
|
||||
}
|
||||
}, "json");
|
||||
} else {
|
||||
alert(resp.msg);
|
||||
showmsg(resp.msg, "danger");
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
@ -45,7 +45,7 @@ function codelogin(code) {
|
||||
setuid(resp.user.uid);
|
||||
openScreen("home");
|
||||
} else {
|
||||
alert(resp.msg);
|
||||
showmsg(resp.msg, "danger");
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
|
@ -7,14 +7,43 @@
|
||||
|
||||
var userdata = [];
|
||||
|
||||
var timeout = 120;
|
||||
|
||||
function setuser(username) {
|
||||
userdata["username"] = username;
|
||||
}
|
||||
|
||||
function getuser() {
|
||||
return userdata["username"];
|
||||
}
|
||||
|
||||
function setname(realname) {
|
||||
userdata["name"] = realname;
|
||||
}
|
||||
|
||||
function setuid(uid) {
|
||||
userdata["uid"] = uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a timer to reset the application when the user is idle.
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function startSessionTimeout() {
|
||||
var maxtime = 120;
|
||||
timeout = maxtime;
|
||||
$('*').bind('mousemove keydown scroll', function () {
|
||||
timeout = maxtime;
|
||||
});
|
||||
setInterval(function () {
|
||||
timeout--;
|
||||
if (timeout <= 100) {
|
||||
$("#timeout-bar").animate({width: Math.round((timeout / 100) * 100) + "%"}, 1000, "linear");
|
||||
} else {
|
||||
$("#timeout-bar").css("width", "100%");
|
||||
}
|
||||
if (timeout == 0) {
|
||||
document.location.href = "index.html";
|
||||
}
|
||||
}, 1000);
|
||||
}
|
@ -6,4 +6,8 @@
|
||||
|
||||
|
||||
var accounthubapi = "http://localhost/accounthub/api.php";
|
||||
var apikey = "123";
|
||||
var apikey = "123";
|
||||
|
||||
function getAPIKey() {
|
||||
return apikey;
|
||||
}
|
@ -1,6 +1,20 @@
|
||||
auxiliary.org-netbeans-modules-css-prep.less_2e_compiler_2e_options=
|
||||
auxiliary.org-netbeans-modules-css-prep.less_2e_enabled=false
|
||||
auxiliary.org-netbeans-modules-css-prep.less_2e_mappings=/less:/css
|
||||
auxiliary.org-netbeans-modules-css-prep.sass_2e_compiler_2e_options=
|
||||
auxiliary.org-netbeans-modules-css-prep.sass_2e_enabled=false
|
||||
auxiliary.org-netbeans-modules-css-prep.sass_2e_mappings=/scss:/css
|
||||
auxiliary.org-netbeans-modules-html-editor-lib.default-html-public-id=HTML5
|
||||
auxiliary.org-netbeans-modules-javascript-nodejs.enabled=false
|
||||
auxiliary.org-netbeans-modules-javascript-nodejs.node_2e_default=true
|
||||
auxiliary.org-netbeans-modules-javascript-nodejs.run_2e_enabled=false
|
||||
auxiliary.org-netbeans-modules-javascript-nodejs.sync_2e_enabled=true
|
||||
browser.run=true
|
||||
file.reference.BizApps-Station=.
|
||||
file.reference.Station-public_html=public_html
|
||||
file.reference.Station-test=test
|
||||
files.encoding=UTF-8
|
||||
project.licensePath=./nbproject/mplheader.txt
|
||||
site.root.folder=${file.reference.BizApps-Station}
|
||||
start.file=index.html
|
||||
web.context.root=/Station
|
||||
|
11
pages/home.html
Normal file
11
pages/home.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!--
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
-->
|
||||
<div class="container">
|
||||
<div class="row justify-content-center" id="card-box">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script src="js/home.js"></script>
|
Loading…
x
Reference in New Issue
Block a user