Skip to content
Snippets Groups Projects
Commit a4279ed5 authored by echicken's avatar echicken
Browse files

Default sidebar widgets for ecWeb v3.

parent 2e0dd141
No related branches found
No related tags found
No related merge requests found
var e = directory(webIni.RootDirectory + "/pages/*");
for(var g in e) {
var ext = e[g].toUpperCase().split(".").slice(1).join(".");
var h = new File(e[g]);
h.open("r");
var i = h.readAll();
h.close();
if(file_isdir(e[g]) || ext == "XJS.SSJS")
continue;
if(ext == "JS" || ext == "SSJS") {
var title = i[0].replace(/\/\//g, "");
if(title == "HIDDEN")
continue;
print("<a class='link' href=./index.xjs?page=" + file_getname(e[g]) + ">" + title + "</a><br />");
}
if(ext == "HTML" || ext == "XJS") {
// Seek first comment line in an HTML document
for(j = 0; j < i.length; j++) {
var k = i[j].match(/^\<\!\-\-.*\-\-\>$/);
if(k === null)
continue;
var title = k[0].replace(/[\<\!\-+|\-+\>]/g, "");
if(title.match("HIDDEN") != null)
break;
print("<a class='link' href=./index.xjs?page=" + file_getname(e[g]) + ">" + title + "</a><br />");
}
}
if(ext == "TXT") {
if(i[0] == "HIDDEN")
continue;
print("<a class='link' href=./index.xjs?page=" + file_getname(e[g]) + ">" + i[0] + "</a><br />");
}
}
\ No newline at end of file
if(user.alias.toUpperCase() != webIni.WebGuest.toUpperCase()) {
print("You are logged in as <b>" + user.alias + "</b><br />");
print("<script language='javascript' type='text/javascript'>");
print("document.write('<a class=link href=./?logout=true&callback=' + location.pathname + location.search + '>Log out</a>');");
print("</script><br />");
} else {
print("<form action=./ method=post>");
print("Username:<br /><input class='border' type='text' name='username' /><br /><br />");
print("Password:<br /><input class='border' type='password' name='password' /><br /><br />");
print("<script language='javascript' type='text/javascript'>");
print("document.write('<input type=hidden name=callback value=' + window.location + ' />');");
print("</script>");
print("<input class='border' type='submit' value='Log in' />");
print("</form>");
print("<a class='link' href='./index.xjs?page=999-newUser.ssjs'>Register</a>");
if(http_request.query.hasOwnProperty('loginfail'))
print("<br /><i>Invalid username or password</i>");
}
\ No newline at end of file
var update = 30000; // Milliseconds between updates
load("nodedefs.js");
if(http_request.query.hasOwnProperty("action") && http_request.query.action.toString() == "show") {
print("<b>Who's online</b><br><br>");
print("<table border=0 cellpadding=0 cellspacing=0 class='font'>");
for(n = 0; n < 6; n++) {
print("<tr><td>Node " + (n + 1) + ":&nbsp;</td>");
if(system.node_list[n].status == 3)
print("<td>" + system.username(system.node_list[n].useron) + "</td></tr><tr><td>&nbsp;</td><td style=font-style:italic;>" + NodeAction[system.node_list[n].action] + "</td></tr>");
else if(system.node_list[n].status == 4)
print("<td style=font-style:italic;>" + NodeStatus[0] + "</td></tr>"); // Pretend to be WFC if in use but quiet
else
print("<td style=font-style:italic;>" + NodeStatus[system.node_list[n].status] + "</td></tr>");
}
print("</table>");
} else {
print("<div id='whosonline'></div>");
print("<script type='text/javascript'>");
print("function xhrwo() {");
print("\tvar XMLReq = new XMLHttpRequest();");
print("\tXMLReq.open('GET', './sidebar/002-whosOnline.ssjs?action=show', true);");
print("\tXMLReq.send(null);");
print("\tXMLReq.onreadystatechange = function() { if(XMLReq.readyState == 4) { document.getElementById('whosonline').innerHTML = XMLReq.responseText; } }");
print("}");
print("setInterval('xhrwo()', " + update + ");");
print("xhrwo();");
print("</script>");
}
\ No newline at end of file
<?xjs load('webInit.ssjs'); ?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="../style/style.css">
</head>
<body class="background">
<table border=0 cellpadding=0 cellspacing=0 class="font">
<tr>
<td>Sysop:</td>
<td>&nbsp;<?xjs write(system.operator); ?></td>
</tr>
<tr>
<td>Location:</td>
<td>&nbsp;<?xjs write(system.location); ?></td>
</tr>
<tr>
<td>Users:</td>
<td>&nbsp;<?xjs write(system.stats.total_users); ?></td>
</tr>
<tr>
<td>Nodes:</td>
<td>&nbsp;<?xjs write(system.nodes); ?></td>
</tr>
<tr>
<td>Uptime:</td>
<td>&nbsp;<?xjs write(system.secondstr(time() - system.uptime)); ?></td>
</tr>
<tr>
<td>Calls:</td>
<td>&nbsp;<?xjs write(system.stats.total_logons); ?></td>
</tr>
<tr>
<td>Calls today:</td>
<td>&nbsp;<?xjs write(system.stats.logons_today); ?></td>
</tr>
<tr>
<td>Files:</td>
<td>&nbsp;<?xjs write(system.stats.total_files); ?></td>
</tr>
<tr>
<td>U/L today:</td>
<td>&nbsp;
<?xjs write(system.stats.files_uploaded_today); ?> files
(<?xjs write(system.stats.bytes_uploaded_today); ?> bytes)
</td>
</tr>
<tr>
<td>D/L today:</td>
<td>&nbsp;
<?xjs write(system.stats.files_downloaded_today); ?> files
(<?xjs write(system.stats.bytes_downloaded_today); ?> bytes)
</td>
</tr>
<tr>
<td>Messages:</td>
<td>&nbsp;<?xjs write(system.stats.total_messages); ?></td>
</tr>
<tr>
<td>Posts today:</td>
<td>&nbsp;<?xjs write(system.stats.messages_posted_today); ?></td>
</tr>
</table>
</body>
</html>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment