Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Components separated, interactive object method overhauled, and networked Objects #207

Merged
merged 130 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
7a7dc69
fixing bug with wrong eveng name
PlumCantaloupe Mar 16, 2023
c052a5d
WIP - changing holding system
PlumCantaloupe Mar 16, 2023
76c9d89
adding some util functions and fixing bug finding avatar
PlumCantaloupe Mar 16, 2023
e1d282b
WIP - changing to a simpler pickup release method
PlumCantaloupe Mar 16, 2023
cb220e6
getting artefact zoom and rotation working in new system
PlumCantaloupe Mar 16, 2023
4dceb9d
cleanup and add back object select when holding
PlumCantaloupe Mar 16, 2023
4102550
clean up and getting artefact release to work
PlumCantaloupe Mar 17, 2023
cdfb347
updating rotation error sin worldSync addition
PlumCantaloupe Mar 17, 2023
5ab4b2b
spelling
PlumCantaloupe Mar 17, 2023
fc7b754
rebuilding to remove console logs
PlumCantaloupe Mar 17, 2023
6036876
Merge branch 'main' into dev
PlumCantaloupe Mar 18, 2023
ce6a9ad
cleaning up listener
PlumCantaloupe Mar 18, 2023
e08e2d6
fixing isses with artefact animations
PlumCantaloupe Mar 19, 2023
5ddb1ea
getting rid of unused func
PlumCantaloupe Mar 19, 2023
e9aca86
Starting process to control networking of artefacts
PlumCantaloupe Mar 20, 2023
c684f73
clean-up and preparing for networking
PlumCantaloupe Mar 20, 2023
3ff4b7c
extending to also include id
PlumCantaloupe Mar 20, 2023
d615a07
adding networked templates as vars
PlumCantaloupe Mar 20, 2023
deaf4d6
using circles' template consts
PlumCantaloupe Mar 20, 2023
a4d5a9c
attaching avatar networking later
PlumCantaloupe Mar 20, 2023
ad0bea7
Adding check and useing new API
PlumCantaloupe Mar 20, 2023
48d724a
cleaning up logs
PlumCantaloupe Mar 20, 2023
4062510
Fixing API to return rig
PlumCantaloupe Mar 20, 2023
62d5e15
Adding networked user afterwards
PlumCantaloupe Mar 20, 2023
5a60ebe
reverting back to older design and adding ability to change template
PlumCantaloupe Mar 20, 2023
6a1cdf9
fixing billboard
PlumCantaloupe Mar 20, 2023
2f41ab0
removing usused properties
PlumCantaloupe Mar 20, 2023
23bed66
reworking artefact to make more modular
PlumCantaloupe Mar 21, 2023
e286b0a
fixing deprecation warning
PlumCantaloupe Mar 21, 2023
d023a19
descriptions now working in new system
PlumCantaloupe Mar 21, 2023
22ef5d2
added back in visiblity on click
PlumCantaloupe Mar 21, 2023
c3f8fc4
Adding component to allow for lookAt functionality
PlumCantaloupe Mar 21, 2023
ee4ad84
Changing name of lebl component
PlumCantaloupe Mar 21, 2023
cfab045
adding in new/changed components
PlumCantaloupe Mar 21, 2023
042e354
remove logs
PlumCantaloupe Mar 21, 2023
5d89364
Adjusting Circles API calls
PlumCantaloupe Mar 21, 2023
b6d4fa6
Adjusting to new circles-label API
PlumCantaloupe Mar 21, 2023
69fcf2b
fixing deprecation warning
PlumCantaloupe Mar 21, 2023
49841d7
fixing deprecation warning
PlumCantaloupe Mar 21, 2023
53e8d7a
fixed constrain ability
PlumCantaloupe Mar 21, 2023
7e2863d
Making a holder for better control of held objects
PlumCantaloupe Mar 21, 2023
fb40935
Adding fudge factor to help animate zero rotations
PlumCantaloupe Mar 21, 2023
e6940c5
Now zooming/rotating holder
PlumCantaloupe Mar 21, 2023
137a674
Adding in lookat feature for dec
PlumCantaloupe Mar 21, 2023
1eb3f5a
Adding functionality and networking to artefact
PlumCantaloupe Mar 21, 2023
5d77b7b
removing networking from inspect comp
PlumCantaloupe Mar 21, 2023
b978da2
Adding dumb checks for new comps in highlight.
PlumCantaloupe Mar 21, 2023
64987b5
Just adjusting to new label name
PlumCantaloupe Mar 21, 2023
4514205
If no target selected, avatar cam used
PlumCantaloupe Mar 21, 2023
d611897
formattig
PlumCantaloupe Mar 21, 2023
b9d7b3c
removed problematic default inspect pos
PlumCantaloupe Mar 21, 2023
4ca9d80
Updating most used worlds to newer Circles API
PlumCantaloupe Mar 21, 2023
4e68943
Updating readme with new components and features
PlumCantaloupe Mar 21, 2023
109a24e
now have explore worlds list autogenerated from worlds folder
PlumCantaloupe Mar 23, 2023
8e22a60
Adding in magic link for user requesting
PlumCantaloupe Mar 23, 2023
d06abc7
changing world names and removing worlds not finished
PlumCantaloupe Mar 23, 2023
27e67ee
fixing var bug
PlumCantaloupe Mar 23, 2023
7a1c2dd
adjusting group name bits
PlumCantaloupe Mar 23, 2023
dd1047f
removing inspect component as not needed
PlumCantaloupe Mar 23, 2023
b603c83
removing networking if animation is done
PlumCantaloupe Mar 23, 2023
2e3fc58
noting extra details
PlumCantaloupe Mar 23, 2023
9d070b7
cleaning
PlumCantaloupe Mar 24, 2023
8f6ad80
remove usused files
PlumCantaloupe Mar 24, 2023
a065805
Adding check for empty obj
PlumCantaloupe Mar 24, 2023
016d2ea
Using circles sphere env map so we can err-check
PlumCantaloupe Mar 24, 2023
dedb426
Adding check to make sure we can send sync data
PlumCantaloupe Mar 24, 2023
8c1fc56
fixing bug
PlumCantaloupe Mar 24, 2023
abe8c6f
Start adding in neworking bits for sharing artefacts
PlumCantaloupe Mar 24, 2023
63d9ddd
justa console log
PlumCantaloupe Mar 24, 2023
185fd50
remove hiding (use visible component instead)
PlumCantaloupe Mar 24, 2023
8f546ca
adding events for artefact networking
PlumCantaloupe Mar 24, 2023
1010fbc
formatting
PlumCantaloupe Mar 24, 2023
8878eaf
Have description follow
PlumCantaloupe Mar 24, 2023
ea6a076
adjusting a bit
PlumCantaloupe Mar 25, 2023
137076e
reducing interval for now
PlumCantaloupe Mar 25, 2023
3ef1305
WIP moving object networking to component
PlumCantaloupe Mar 25, 2023
6f3802f
Adding a temp world to test with
PlumCantaloupe Mar 25, 2023
947b581
Adding a Basic world to start from
PlumCantaloupe Mar 25, 2023
9d435e9
Making generateStr func global
PlumCantaloupe Mar 25, 2023
f44ed58
simplifying manager pickup code
PlumCantaloupe Mar 25, 2023
1dd61c5
cleanup
PlumCantaloupe Mar 25, 2023
dc9c34b
fixing some issues with releasing
PlumCantaloupe Mar 25, 2023
cf667e4
continuing work on networked
PlumCantaloupe Mar 25, 2023
4aab74b
adding and changing names to be general
PlumCantaloupe Mar 25, 2023
97449f4
adding conmvnience func
PlumCantaloupe Mar 25, 2023
21179c9
want to not have visibility synched
PlumCantaloupe Mar 25, 2023
0d12d1a
adjusting position/scale
PlumCantaloupe Mar 25, 2023
c7334bc
will add this object-networked comp
PlumCantaloupe Mar 26, 2023
0fa1d93
not worry about picked up here, for now..
PlumCantaloupe Mar 26, 2023
11ec265
fixed ws bug
PlumCantaloupe Mar 26, 2023
91228be
need to network pickup-networked comp
PlumCantaloupe Mar 26, 2023
8a854ee
cleanup and formatting
PlumCantaloupe Mar 26, 2023
5874fef
new direction in not having duplicate objects.
PlumCantaloupe Mar 26, 2023
f9c76b5
Fixing up networking between objects
PlumCantaloupe Mar 27, 2023
2f951de
removing as doesn't work anyhow
PlumCantaloupe Mar 27, 2023
6e7a08c
adding NAF with fix for remote synchWorldTransforms
PlumCantaloupe Mar 27, 2023
0c1a8ec
Adding networked ability to artefact
PlumCantaloupe Mar 27, 2023
f8b964c
fixing bug where trying to access a null elem
PlumCantaloupe Mar 27, 2023
0c6eef5
removing logs
PlumCantaloupe Mar 27, 2023
7f48b4f
reoving logs from NAF
PlumCantaloupe Mar 27, 2023
b15231e
removing logs
PlumCantaloupe Mar 27, 2023
79e09ca
getting mosty of NAF networked objects together
PlumCantaloupe Mar 28, 2023
02afab3
adding in hack for making sure rotation passes to remote
PlumCantaloupe Mar 28, 2023
9e758e5
keep networking optional, as experimental
PlumCantaloupe Mar 28, 2023
347d695
Adding label click to networked objects
PlumCantaloupe Mar 28, 2023
b89a267
adding artefact for difference
PlumCantaloupe Mar 28, 2023
a66074b
fixing label click and multi-object release
PlumCantaloupe Mar 28, 2023
1a2cf3a
need to update raycasters for interactive elements
PlumCantaloupe Mar 28, 2023
3a8680c
removing logs
PlumCantaloupe Mar 28, 2023
5e8727b
fixing narration stop/play issues
PlumCantaloupe Mar 28, 2023
c943306
fixing object rotation reset bug
PlumCantaloupe Mar 28, 2023
2ee356f
fixingnull error
PlumCantaloupe Mar 28, 2023
c234a84
removing logs
PlumCantaloupe Mar 28, 2023
c71cb92
cleaning up events
PlumCantaloupe Mar 28, 2023
319adb6
renaming
PlumCantaloupe Mar 28, 2023
066100c
adding reset to init, and some logs
PlumCantaloupe Mar 28, 2023
462fa9f
reducing event listeners on unrelated objects
PlumCantaloupe Mar 28, 2023
4d71e92
cleaning up who sends messages
PlumCantaloupe Mar 29, 2023
84bdb31
removing network for now, as still broken :)
PlumCantaloupe Mar 29, 2023
590fe1f
cleanup and removing gone network events (redundant)
PlumCantaloupe Mar 29, 2023
ad543bb
cleaning up unused code
PlumCantaloupe Mar 29, 2023
c217863
testing and removing redundant code
PlumCantaloupe Mar 29, 2023
9d435d0
adding in owner synch by using time created
PlumCantaloupe Mar 30, 2023
06ccbf7
have networking working when client disconnects now
PlumCantaloupe Mar 30, 2023
e4507ed
cleanup and adding back both objects
PlumCantaloupe Mar 30, 2023
d950d70
cleaning up logs
PlumCantaloupe Mar 30, 2023
a1c4d27
have synching working from local component and log removal
PlumCantaloupe Mar 30, 2023
b54279f
making artefact networked
PlumCantaloupe Mar 30, 2023
ada918c
appending label and description to the same parent of teh artefact
PlumCantaloupe Mar 31, 2023
4e018e9
updating readme with new components
PlumCantaloupe Mar 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 133 additions & 42 deletions README.md

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions node_server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ app.use(
"media-src": ["*"],
"frame-src": ["*"],
"style-src": ["*", "'unsafe-inline'"],
"script-src": ["'self'", "'unsafe-inline'", "'unsafe-eval'", "unpkg.com", "aframe.io", "blob:"],
"script-src-attr": ["'unsafe-inline'"],
"script-src": ["*", "'self'", "'unsafe-inline'", "'unsafe-eval'", "unpkg.com", "aframe.io", "blob:"],
"script-src-attr": ["*", "'unsafe-inline'"],
"object-src": ["'none'"],
},
})
Expand Down Expand Up @@ -303,6 +303,8 @@ io.on("connection", socket => {

//listen for all events and forward to all other clients
socket.on("*", function(event, data) {
//console.log('socket event fired: ' + event);

//ignore reserved event names
if ( event === CIRCLES.EVENTS.REQUEST_DATA_SYNC ||
event === CIRCLES.EVENTS.REQUEST_DATA_SYNC ||
Expand Down
56 changes: 52 additions & 4 deletions node_server/controllers/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,10 @@ const generateAuthLink = (email, baseURL, route, expiryTimeMin) => {

const getMagicLinks = (req, res, next) => {
const route = req.query.route;
const userTypeAsking = req.query.userTypeAsking;
const expiryTimeMin = req.query.expiryTimeMin;
const usernameAsking = req.query.usernameAsking;
const emailAsking = req.query.emailAsking;
const userTypeAsking = req.query.userTypeAsking;
const expiryTimeMin = req.query.expiryTimeMin;
let allAccounts = [];

//ignore req.protocol as it will try and re-direct to https anyhow.
Expand All @@ -574,7 +576,7 @@ const getMagicLinks = (req, res, next) => {
let error = null;
async function getItems() {
try {
users = await User.find({usertype: (req.query.userTypeAsking === CIRCLES.USER_TYPE.TEACHER) ? CIRCLES.USER_TYPE.STUDENT : CIRCLES.USER_TYPE.PARTICIPANT }).exec();
users = await User.find({usertype: (userTypeAsking === CIRCLES.USER_TYPE.TEACHER) ? CIRCLES.USER_TYPE.STUDENT : CIRCLES.USER_TYPE.PARTICIPANT }).exec();
} catch(err) {
error = err;
}
Expand All @@ -584,6 +586,10 @@ const getMagicLinks = (req, res, next) => {
if (error) {
res.send(error);
}

//add "self" first
allAccounts.push({username:usernameAsking, email:emailAsking, magicLink:generateAuthLink(emailAsking, baseURL, route, expiryTimeMin)});

for (let i = 0; i < users.length; i++) {
allAccounts.push({username:users[i].username, email:users[i].email, magicLink:generateAuthLink(users[i].email, baseURL, route, expiryTimeMin)});

Expand All @@ -594,6 +600,47 @@ const getMagicLinks = (req, res, next) => {
});
};

const loopAndGetFolderNames = async (folderPath) => {
let allSubFolderNames = [];
// Get the files as an array
let files = null;
try{
files = await fs.promises.readdir(folderPath);
}
catch(e) {
console.log(e.message);
return allSubFolderNames;
}

// Loop them all with the new for...of
let worldName = "";
for( const file of files ) {
// Get the full paths
const fullPath = path.join( folderPath, file );

// Stat the file to see if we have a file or dir
const stat = await fs.promises.stat( fullPath );

if( stat.isDirectory() ) {
//console.log( fullPath + " is a directory.");
worldName = file;
worldName.replace(folderPath, "");
allSubFolderNames.push(file);
}
}
allSubFolderNames.sort();

return allSubFolderNames;
};

const getWorldsList = async (req, res, next) => {
const folderPath = __dirname + '/../../src/worlds';
loopAndGetFolderNames(folderPath).then(function(data) {
res.json(data);
});
}


const addTestUsers = () => {
let usersToAdd = [];
let tenColors = [ CIRCLES.COLOR_PALETTE.PEARL, CIRCLES.COLOR_PALETTE.TURQUOISE, CIRCLES.COLOR_PALETTE.EMERALD, CIRCLES.COLOR_PALETTE.RIVER, CIRCLES.COLOR_PALETTE.AMETHYST,
Expand Down Expand Up @@ -894,5 +941,6 @@ module.exports = {
addAllTestData,
serveExplore,
generateAuthLink,
getMagicLinks
getMagicLinks,
getWorldsList,
};
2 changes: 1 addition & 1 deletion node_server/public/global/js/components/aframe-mirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ let Reflector = function ( mesh, renderer, options, cameraEl ) {
var parameters = {
minFilter: THREE.LinearFilter,
magFilter: THREE.LinearFilter,
format: THREE.RGBFormat
format: THREE.RGBAFormat
};

var renderTarget = new THREE.WebGLRenderTarget( textureWidth, textureHeight, parameters );
Expand Down
2 changes: 1 addition & 1 deletion node_server/public/global/js/libs/networked-aframe.min.js

Large diffs are not rendered by default.

92 changes: 62 additions & 30 deletions node_server/public/web/js/app.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
window.onload = function () {
//have something in the group field when opening page
if (typeof MagicLinkGroup !== 'undefined') {
autogenerateGroupName(MagicLinkGroup, 4);
}
//let's not as "explore" will be used if field is blank
// if (typeof MagicLinkGroup !== 'undefined') {
// autogenerateGroupName(MagicLinkGroup, 4);
// }

//get worlds available from server
getWorldsList();

let popover = new Popover();
const cps = document.querySelectorAll('.colorPicker'); //from here - https://github.com/tovic/color-picker
Expand Down Expand Up @@ -93,17 +97,19 @@ function startCoundown(numMS, textId) {


//*********** magic links button functionality */
//function createMagicLinks(url, userTypeAsking, expiryTimeMin = CIRCLES.CONSTANTS.AUTH_TOKEN_EXPIRATION_MINUTES) {
function createMagicLinks(userTypeAsking) {
function createMagicLinks(username, email, userTypeAsking) {
const magic_world = document.querySelector("#MagicLinkWorld").value;
const magic_group = document.querySelector("#MagicLinkGroup").value;
const url = 'w/' + magic_world + '?group=' + ((magic_group === '') ? 'explore' : magic_group);

//const userTypeAsking = userInfo.userType;
const expiryTimeMin = document.querySelector("#MagicLinkExpiry").value * 24 * 60; //convert days to mins

let request = new XMLHttpRequest();
request.open('GET', '/get-magic-links?route=' + url + '&userTypeAsking=' + userTypeAsking + '&expiryTimeMin=' + expiryTimeMin);
request.open('GET', '/get-magic-links?route=' + url
+ '&usernameAsking=' + username
+ '&emailAsking=' + email
+ '&userTypeAsking=' + userTypeAsking
+ '&expiryTimeMin=' + expiryTimeMin);
request.responseType = 'text';

request.onload = function() {
Expand All @@ -124,33 +130,16 @@ function copyText(copyTextElem, username) {
});
}

const YEATS_WORD_LIST = [ 'had', 'i', 'the', 'heavens', 'embroidered', 'cloths',
'enwrought', 'with', 'golden', 'and', 'silver', 'light',
'the', 'blue', 'and', 'the', 'dim', 'and', 'the', 'dark', 'cloths',
'of', 'night', 'and', 'light', 'and', 'the', 'half', 'light',
'i', 'would', 'spread', 'the', 'cloths', 'under', 'your', 'feet'];
function autogenerateGroupName(inputElem, numWords = 1) {
//const textInput = document.querySelector("#" + inputID);
const arrLength = YEATS_WORD_LIST.length;

const getRandomWord = () => {
return YEATS_WORD_LIST[Math.floor(Math.random() * arrLength)];
};

let autoStr = getRandomWord();
for (let i = 0; i < numWords; i++) {
autoStr += '-' + getRandomWord();
}

inputElem.value = autoStr;
inputElem.value = CIRCLES.UTILS.generateRandomString(numWords);
}

function showMagicLinks(data, expiryTimeMin) {
startCoundown(expiryTimeMin * 60000, 'countdownElem'); //start visual timer

const jsonData = JSON.parse(data);
const menuElem = document.querySelector('#MagicLinksContent');
let tableStr = '<table class=\'pure-table\'>'
let tableStr = '<table class=\'pure-table\'>'
menuElem.setAttribute('class', 'pure-menu gutter-bottom');

tableStr += '<thead>';
Expand All @@ -163,15 +152,58 @@ function showMagicLinks(data, expiryTimeMin) {
tableStr += '<tbody>';

for (let i = 0; i < jsonData.length; i++) {
let isYou = (i === 0);
let username = ((isYou) ? ' <strong>' : '') + jsonData[i].username + ((isYou) ? ' (you) </strong>' : '');
let email = ((isYou) ? ' <strong>' : '') + jsonData[i].email + ((isYou) ? '</strong>' : '');
let magicLink = jsonData[i].magicLink ;

tableStr += '<tr>';
tableStr += '<td>' + jsonData[i].username + '</td>';
tableStr += '<td>' + jsonData[i].email + '</td>';
tableStr += '<td><input type=\'button\' class=\'pure-button pure-button-primary\' value=\'copy\' onclick=\'copyText(linkCopy' + i + ',"' + jsonData[i].username + '")\'>';
tableStr += '<input id=linkCopy' + i + ' type=\'text\' class=\'\' value=\'' + jsonData[i].magicLink + '\' size=\'50\' readonly></td>';
tableStr += '<td>' + username + '</td>';
tableStr += '<td>' + email + '</td>';
tableStr += '<td><input type=\'button\' class=\'pure-button pure-button-primary\' value=\'copy\' onclick=\'copyText(linkCopy' + i + ',"' + username + '")\'>';
tableStr += '<input id=linkCopy' + i + ' type=\'text\' class=\'\' value=\'' + magicLink + '\' size=\'50\' readonly></td>';
tableStr += '</tr>';
}

tableStr += '</tbody>';
tableStr += '</table>';
menuElem.innerHTML = tableStr;
}

function getWorldsList() {
let request = new XMLHttpRequest();
request.open('GET', '/get-worlds-list');
request.responseType = 'text';
request.onload = function() {
showWorldList(request.response); //show copy button
};
request.send();
}

function showWorldList(data) {
const jsonData = JSON.parse(data);

let htmlStr_list = '<ul class="pure-menu-list">';
let htmlStr_select = '';
let urlLink = '';
let worldName = ';'
for (let i = 0; i < jsonData.length; i++) {
worldName = jsonData[i];
urlLink = '/w/' + worldName;

htmlStr_list += '<li><a class="pure-button" href="' + urlLink + '">';
htmlStr_list += worldName;
htmlStr_list += '</a></li>';

htmlStr_select += '<option value="' + worldName + '">' + worldName + '</option>';
}
htmlStr_list += '</ul>';

const worldsWrapperElem = document.querySelector('#worlds_list_wrapper');
worldsWrapperElem.innerHTML = htmlStr_list;

const worldsSelectElem = document.querySelector('#MagicLinkWorld');
if(worldsSelectElem) {
worldsSelectElem.innerHTML = htmlStr_select;
}
}
67 changes: 9 additions & 58 deletions node_server/public/web/views/explore.pug
Original file line number Diff line number Diff line change
Expand Up @@ -8,60 +8,10 @@ block content
- var targetUsersText = (userInfo.userType === CIRCLES.USER_TYPE.TEACHER) ? CIRCLES.USER_TYPE.STUDENT : CIRCLES.USER_TYPE.PARTICIPANT;
- var buttonText = 'Create ' + targetUsersText + ' Links';

//this should be dynamically created one day from 'worlds' folders ...
- const wit_worlds = [ 'hub', 'WIT_1_Kitchen', 'WIT_2_Lab', 'WIT_3_Work'];
- const wit_worlds_txt = [ 'Campfire Hub', 'Growing Up', 'In The Classroom', 'On The Job'];

- const desmond_worlds = [ 'VD_1_Salon', 'VD_2_Theatre', 'VD_3_ProvinceHouse'];
- const desmond_worlds_txt = [ 'The Salon', 'The Roseland Theatre', 'The Province House'];

- const kin_worlds = [ 'KIN_Hub', 'KIN_FreeFall', 'KIN_ShootAndDrop', 'KIN_ShootTheMonkey' ];
- const kin_worlds_txt = [ 'Kinematics Hub', 'Freefall', 'Shoot and Drop', 'Shoot the Monkey' ];

- const cog_worlds = [ 'COG_MemoryPalace', 'COG_MemoryPalace_WIP' ];
- const cog_worlds_txt = [ 'Memory Palace', 'Memory Palace (WIP)' ];

- const test_worlds = [ 'explore', 'ExampleWorld', 'Wardrobe', 'Carleton_University', 'Testbed' ];
- const test_worlds_txt = [ 'This "Circles\' Worlds" Page (explore)', 'Circles\' Example', 'Wardrobe', 'Carleton University WIP', 'Research Room' ];

- const all_circles_worlds = [].concat(wit_worlds, desmond_worlds, kin_worlds, cog_worlds, test_worlds);
- const all_circles_worlds_txt = [].concat(wit_worlds_txt, desmond_worlds_txt, kin_worlds_txt, cog_worlds_txt, test_worlds_txt);

h2 Circles' Worlds
div(class="gutter-bottom-doubled")

div(class="pure-menu gutter-bottom")
<span class="pure-menu-heading">Challenges Surrounding Women in the Trades</span>
ul(class="pure-menu-list")
each val, index in wit_worlds
li!= '<a class="pure-button" href="' + '/w/' + wit_worlds[index] + '">' + wit_worlds_txt[index] + '</a>'

div(class="pure-menu gutter-bottom")
<span class="pure-menu-heading">Viola Desmond, Canadian Civil Rights Pioneer</span>
ul(class="pure-menu-list")
each val, index in desmond_worlds
li!= '<a class="pure-button" href="' + '/w/' + desmond_worlds[index] + '">' + desmond_worlds_txt[index] + '</a>'

div(class="pure-menu gutter-bottom")
<span class="pure-menu-heading">Education - Kinematics</span>
ul(class="pure-menu-list")
each val, index in kin_worlds
li
a(class= 'pure-button', href!= '/w/' + kin_worlds[index])!= kin_worlds_txt[index]

div(class="pure-menu gutter-bottom")
<span class="pure-menu-heading">Education - CogSci</span>
ul(class="pure-menu-list")
each val, index in cog_worlds
li
a(class= 'pure-button', href!= '/w/' + cog_worlds[index])!= cog_worlds_txt[index]

div(class="pure-menu gutter-bottom")
<span class="pure-menu-heading">For Testing</span>
ul(class="pure-menu-list")
each val, index in test_worlds
li
a(class= 'pure-button', href!= '/w/' + test_worlds[index])!= test_worlds_txt[index]
div(id="worlds_list_wrapper" class="pure-menu gutter-bottom")
//will ask for worlds list from server and populate here

if userCanGenMagicLinks

Expand All @@ -79,20 +29,21 @@ block content
select(name='MagicLinkExpiry', id='MagicLinkExpiry', class="pure-input-1-3")
while n < 365
- val = n++;
- selected = (val === 30)
- selected = (val === 7)
option(value!= val, selected!= selected)!= val
- selected = false
div(class='pure-control-group')
label(for='MagicLinkGroup') Create Group Name
input(name='MagicLinkGroup', id='MagicLinkGroup', type="text", placeholder="type group name", class="pure-input-1-3")
button(type="button", class="pure-button pure-button", onclick='autogenerateGroupName(MagicLinkGroup, 4)') autogenerate
input(name='MagicLinkGroup', id='MagicLinkGroup', type="text", placeholder="explore", class="pure-input-1-3")
button(type="button", class="pure-button pure-button", onclick='autogenerateGroupName(MagicLinkGroup, 4)') create new group
div(class='pure-control-group')
label(for='MagicLinkWorld') Select Entry World
select(name='MagicLinkWorld', id='MagicLinkWorld', , class="pure-input-1-3")
each val, index in all_circles_worlds
option=val
//will populate this select element when we load in worlds
//- each val, index in window.all_circles_worlds
//- option=val
div(class='pure-controls')
input(type='button', class="pure-button pure-button-primary", value=buttonText, onclick='createMagicLinks("' + userInfo.userType + '")')
input(type='button', class="pure-button pure-button-primary", value=buttonText, onclick='createMagicLinks("' + userInfo.userName + '","' + userInfo.email + '","' + userInfo.userType + '")')

p Selection the expiry and world, then click on the blue <span style='color:#0078e7; font-weight:bold;'>[#{buttonText}]</span> button above to generate "magic links" to the selected world for each #{targetUsersText}. Just copy and send each link to each #{targetUsersText} to automatically log them in. Ask them to save the link so they can login repeatedly.
p <em>Note these links expire in <span id='countdownElem' style='color:#0078e7; font-weight:bold;'>15 minutes</span></em>.
Expand Down
3 changes: 3 additions & 0 deletions node_server/routes/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ router.post('/login', passport.authenticate('local', {
//magic links for students
router.get('/get-magic-links', authenticated, controller.getMagicLinks);

//get list of worlds
router.get('/get-worlds-list', authenticated, controller.getWorldsList);

router.get('/magic-login', function(req, res, next) {
passport.authenticate('jwt', function(err, user, info) {
if (err) { return next(err); }
Expand Down
Loading