From f10f4f9cd2a3cc4608254abe4ec0034b062e0426 Mon Sep 17 00:00:00 2001 From: Bram van der Veen <96aa48@gmail.com> Date: Tue, 16 Jun 2015 15:44:52 +0200 Subject: [PATCH] Added support for different tabs of schedules --- lookup.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lookup.js b/lookup.js index 6ff827e..32a4519 100644 --- a/lookup.js +++ b/lookup.js @@ -12,7 +12,7 @@ function lookup(req, res, next, search) { if (err) console.warn(err); if (database_entry.length == 1) { - database_entry[0].url = make_url(database_entry[0]); + database_entry[0].url = make_url(req, database_entry[0]); req.match = database_entry[0]; next(); } @@ -26,7 +26,7 @@ function lookup(req, res, next, search) { } //Function for making a link out of the given database_entry. -function make_url(database_entry) { +function make_url(req, database_entry) { var url = 'http://roosters5.gepro-osi.nl/roosters/rooster.php?school=' + school_id + '&type=' + database_entry.type.charAt(0).toUpperCase() + database_entry.type.slice(1) + 'rooster'; switch (database_entry.type) { @@ -47,6 +47,8 @@ function make_url(database_entry) { break; } + if (req.query.tab) url += '&tabblad=' + req.query.tab + return url; }