Skip to content
Permalink
Browse files

ready to merge

  • Loading branch information
esokullu committed Aug 20, 2019
1 parent 14908d7 commit 8591d154313b7571296dc6159770e3457a862f9d
@@ -1,4 +1,9 @@
SALT=
BACKUP_SCRIPT=/usr/local/bin/groups-backup.sh
REDIRECT=
PUBLIC_ID=

PUBLIC_ID=
HOST="https://accounts.graphjs.com"

MODULE_FORUM="on"
MODULE_GROUPS="on"
@@ -24,11 +24,11 @@ module.exports = async function (req, res) {
const primaryColor = '#6f879f';
const textColor = '#3f5f7f';
const backgroundColor = '#ffffff';
const host = "https://accounts.groups2.com";
const host = process.env.HOST || "https://accounts.groups2.com";
const streamHost = "";
const theme = "light";
const moduleForum = query.module_forum || "off";
const moduleGroups = query.module_groups ||"off";
const moduleForum = process.env.MODULE_FORUM ||query.module_forum || "off";
const moduleGroups = process.env.MODULE_GROUPS ||query.module_groups ||"off";
const extraHead = "";

let page = query.page;
@@ -9,9 +9,11 @@
<td>
{% if member.username !== 'admin' %}
{% if member.is_editor === 1 %}
<button type="button" class="btn btn-secondary" onClick="setEditor('{{member.id}}', 0)">Revoke Editor Privileges</button>
<button id="revoke-{{member.id}}" type="button" class="btn btn-secondary" onClick="setEditor('{{member.id}}', 0)">Revoke Editor Privileges</button>
<button id="grant-{{member.id}}" type="button" class="btn btn-secondary d-none" onClick="setEditor('{{member.id}}', 1)">Grant Editor Privileges</button>
{% else %}
<button type="button" class="btn btn-secondary" onClick="setEditor('{{member.id}}', 1)">Grant Editor Privileges</button>
<button id="revoke-{{member.id}}" type="button" class="btn btn-secondary d-none" onClick="setEditor('{{member.id}}', 0)">Revoke Editor Privileges</button>
<button id="grant-{{member.id}}" type="button" class="btn btn-secondary" onClick="setEditor('{{member.id}}', 1)">Grant Editor Privileges</button>
{% endif %}
{% endif %}

@@ -2,13 +2,24 @@
This script file contains functions that work product-wide.
*/

var showAdministrationOptions = function() {
if (localStorage.getItem("username")=="admin") {
document.body.classList.add("admin");
}
else {
document.body.classList.remove("admin");
}
};

var checkLogin = function() {
window.GraphJS.getSession(function(response) {
if(response.success) {
document.body.classList.add('logged');
showAdministrationOptions();
}
else {
document.body.classList.remove('logged');
document.body.classList.remove("admin");
}
});
}
@@ -97,6 +97,18 @@ function setEditor(id, mode)
data = JSON.parse(data);
if(data.success)
{
switch(mode)
{
case 1:
$("#grant-"+id).addClass('d-none');
$("#revoke-"+id).removeClass('d-none');

break;
default:
$("#grant-"+id).removeClass('d-none');
$("#revoke-"+id).addClass('d-none');
break;
}
// do something in the UI
alert("Success");
return;
@@ -286,4 +286,12 @@ body.logged .private-feature {

body.logged .public-feature {
display: none;
}

.admin-feature {
display: none;
}

body.admin .admin-feature {
display: block;
}
@@ -81,8 +81,11 @@
<!--<a class="dropdown-item" href="{% if (goal==="show") %}/?page=settings{% else %}/{{ name }}/account{% endif %}">General Settings</a>-->
<a class="dropdown-item" href="{% if (goal==="show") %}/?page=account{% else %}/{{ name }}/account{% endif %}">Account Settings</a>
{% if (module_groups==="on") %}
<a class="dropdown-item" href="{% if (goal==="show") %}/?page=create-group{% else %}/{{ name }}/create-group{% endif %}">Create Group</a>
<a class="dropdown-item" href="{% if (goal==="show") %}/?page=create-group{% else %}/{{ name }}/create-group{% endif %}">Create Group...</a>
{% endif %}
<a class="dropdown-item admin-feature" href="{% if (goal==="show") %}/?page=network-administration{% else %}/{{ name }}/network-administration{% endif %}">Network Administration</a>
<a class="dropdown-item admin-feature" href="{% if (goal==="show") %}/?page=member-administration{% else %}/{{ name }}/member-administration{% endif %}">Member Administration</a>
<a class="dropdown-item admin-feature" href="{% if (goal==="show") %}/?page=pending-members{% else %}/{{ name }}/pending-members{% endif %}">Pending Members</a>
</div>
</li>
</ul>
@@ -122,24 +125,31 @@
<script type="text/javascript" src="/site/vendor/dialog-polyfill/dialog-polyfill.js"></script>
<script>
var just_registered = false;
window.onload = function() {
// Login
checkLogin();
window.GraphJS.on("afterLogin", function() {
window.GraphJS.on("afterLogin", function(params, response) {
localStorage.setItem("username", params[0]);
checkLogin();
showAdministrationOptions();
if(just_registered)
window.location.href = "{% if (goal==="show") %}/?page=account&{% else %}/{{ name }}/account{% endif %}";
});
window.GraphJS.on("afterLogout", function() {
checkLogin();
localStorage.setItem("username", "");
document.body.classList.remove("admin");
});
window.GraphJS.on("afterRegister", function() {
just_registered = true;
})
dialogPolyfill.registerDialog(document.getElementsByTagName("dialog")[0]);
showAdministrationOptions();
// Settings
//if(initiateSettings) initiateSettings();
}
@@ -0,0 +1,18 @@
{% set title = 'Logout' %}
{% extends 'layout/template_' + goal + '.njk' %}

{% block content %}

<script>
document.addEventListener("DOMContentLoaded", function(event) {
GraphJS.logout(function(res) {
console.log(res);
window.location.href =
{% if (goal === "show") %}"/?page=home"{% else %}"/"{% endif %}
;
});
});
</script>


{% endblock %}

Large diffs are not rendered by default.

BIN +19.8 KB (110%) site/vendor/graphjs/graph.js.gz
Binary file not shown.

0 comments on commit 8591d15

Please sign in to comment.
You can’t perform that action at this time.