diff --git a/modules/discojuice/lib/EmbedHelper.php b/modules/discojuice/lib/EmbedHelper.php index c372e376a31093f55bf167c8953b0340142a9eb1..20fd63ab5eefb38cb6fac13eb453b004cbe71f8b 100644 --- a/modules/discojuice/lib/EmbedHelper.php +++ b/modules/discojuice/lib/EmbedHelper.php @@ -7,27 +7,34 @@ class sspmod_discojuice_EmbedHelper { public static function head($includeJQuery = TRUE) { - $version = '0.1'; + $version = '0.1-' . rand(1000, 9999); $config = SimpleSAML_Configuration::getInstance(); $djconfig = SimpleSAML_Configuration::getOptionalConfig('discojuiceembed.php'); if ($includeJQuery) { - echo '<!-- JQuery -->'; - echo '<script type="text/javascript" language="javascript" src="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/jquery-1.4.3.min.js') . '"></script> - <script type="text/javascript" language="javascript" src="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/jquery-ui-1.8.5.custom.min.js') . '"></script> + echo ' +<!-- JQuery (Required for DiscoJuice) --> + <script type="text/javascript" src="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/jquery-1.4.3.min.js') . '"></script> + <script type="text/javascript" src="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/jquery-ui-1.8.5.custom.min.js') . '"></script> - <link rel="stylesheet" type="text/css" href="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/css/custom/jquery-ui-1.8.5.custom.css') . '" />'; + <link rel="stylesheet" type="text/css" href="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/css/custom/jquery-ui-1.8.5.custom.css') . '" /> + +'; + } - echo '<!-- DiscoJuice --> - <script type="text/javascript" language="javascript" src="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/discojuice.misc.js?v=' . $version) . '"></script> - <script type="text/javascript" language="javascript" src="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/discojuice.ui.js?v=' . $version) . '"></script> - <script type="text/javascript" language="javascript" src="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/discojuice.control.js?v=' . $version) . '"></script> + echo ' +<!-- DiscoJuice (version identifier: ' . $version . ' ) --> + <script type="text/javascript" src="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/discojuice.misc.js?v=' . $version) . '"></script> + <script type="text/javascript" src="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/discojuice.ui.js?v=' . $version) . '"></script> + <script type="text/javascript" src="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/discojuice.control.js?v=' . $version) . '"></script> - <link rel="stylesheet" type="text/css" href="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/css/discojuice.css?v=' . $version) . '" />'; + <link rel="stylesheet" type="text/css" href="' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/css/discojuice.css?v=' . $version) . '" /> + +'; $options = $djconfig->getValue('discojuice.options'); @@ -39,7 +46,10 @@ class sspmod_discojuice_EmbedHelper { echo 'var target = "' . $target . '";' . "\n\n"; echo 'options.countryAPI = "' . SimpleSAML_Module::getModuleURL('discojuice/country.php'). '"; ' . "\n"; - echo 'options.metadata = "' . SimpleSAML_Module::getModuleURL('discojuice/feed.php'). '"; ' . "\n"; + + if (empty($options['metadata'])) { + echo 'options.metadata = "' . SimpleSAML_Module::getModuleURL('discojuice/feed.php'). '"; ' . "\n"; + } if (!empty($options['disco'])) { echo 'options.disco.url = "' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/discojuiceDiscoveryResponse.html?'). '"; ' . "\n"; diff --git a/modules/discojuice/www/discojuice/discojuice.control.js b/modules/discojuice/www/discojuice/discojuice.control.js index d32b59b5e5930ae78cb5a91f5fe88dc6a921b210..113ae267ec860ea26a12cd45475ba258c0f90e34 100644 --- a/modules/discojuice/www/discojuice/discojuice.control.js +++ b/modules/discojuice/www/discojuice/discojuice.control.js @@ -1,11 +1,13 @@ /* * DiscoJuice - * Work is based upon mock up made by the Kantara ULX group. + * Work is based upon mock up made by the Kantara ULX group. * * Author: Andreas Ă…kre Solberg, UNINETT, andreas.solberg@uninett.no * Licence undecided. Awaiting alignment with the licence of the origin Kantara mockup. */ -if (typeof DiscoJuice == "undefined") var DiscoJuice = {}; +if (typeof DiscoJuice === "undefined") { + var DiscoJuice = {}; +} DiscoJuice.Control = { @@ -13,7 +15,7 @@ DiscoJuice.Control = { "parent" : DiscoJuice, // Reference to the UI object... - "ui": null, + "ui": null, "data": null, // Set filter values to filter the result. @@ -30,11 +32,15 @@ DiscoJuice.Control = { */ "load": function() { var that = this; - if (this.data) return; + if (this.data) { + return; + } var metadataurl = this.parent.Utils.options.get('metadata'); this.parent.Utils.log('metadataurl is ' + metadataurl); - if (!metadataurl) return; + if (!metadataurl) { + return; + } $.getJSON(metadataurl, function(data) { that.data = data; @@ -44,7 +50,9 @@ DiscoJuice.Control = { }, "postLoad": function() { - if (!this.data) return; + if (!this.data) { + return; + } // Iterate through entities, and update title from DisplayNames to support Shibboleth integration. for(i = 0; i < this.data.length; i++) { @@ -83,7 +91,7 @@ DiscoJuice.Control = { */ "setWeight": function(entityID, weight) { for(i = 0; i < this.data.length; i++) { - if (this.data[i].entityID == entityID) { + if (this.data[i].entityID === entityID) { if (isNaN(this.data[i].weight)) this.data[i].weight = 0; this.data[i].weight += weight; this.parent.Utils.log('COOKIE Setting weight to ' + this.data[i].weight); @@ -92,7 +100,7 @@ DiscoJuice.Control = { }, "discoResponse": function(entityID, sender) { - this.parent.Utils.log('DiscoResponse Received from [' + sender + ']'); + this.parent.Utils.log('DiscoResponse Received from [' + sender + ']'); this.setWeight(entityID, -100); this.prepareData(); }, @@ -107,13 +115,13 @@ DiscoJuice.Control = { this.data[i].distanceweight = (2 * Math.log(this.data[i].distance + 1)) - 10; } } -// for(i = 0; i < this.data.length; i++) { -// if (this.data[i].distance) { -// console.log('Distance for [' + this.data[i].title + '] ' + this.data[i].distance); -// } else { -// console.log('Distance for [' + this.data[i].title + '] NA'); -// } -// } +// for(i = 0; i < this.data.length; i++) { +// if (this.data[i].distance) { +// console.log('Distance for [' + this.data[i].title + '] ' + this.data[i].distance); +// } else { +// console.log('Distance for [' + this.data[i].title + '] NA'); +// } +// } this.showdistance = true; this.prepareData(); }, @@ -174,17 +182,19 @@ DiscoJuice.Control = { "prepareData": function(showall) { - var showall = (showall ? true : false); + showall = (showall ? true : false); this.parent.Utils.log('DiscoJuice.Control prepareData()'); var hits, i, current, search; var someleft = false; - var term = this.getTerm(); - var categories = this.getCategories(); + var term = this.getTerm(); + var categories = this.getCategories(); - if (!this.data) return; + if (!this.data) { + return; + } /* * Sort data by weight... @@ -217,35 +227,41 @@ DiscoJuice.Control = { if (term) { search = this.parent.Utils.searchMatch(current,term); - if (search === false && current.weight > -50) continue; + if (search === false && current.weight > -50) { + continue; + } } else { search = null; } if (categories && categories.country) { - if (!current.country) continue; - if (current.country !== '_all_' && categories.country !== current.country && current.weight > -50) continue; + if (!current.country) { + continue; + } + if (current.country !== '_all_' && categories.country !== current.country && current.weight > -50) { + continue; + } } -// if (categories && categories.type) { -// if (!current.ctype && current.weight > -50) { -// // DiscoJuice.log(current); -// continue; -// } -// // DiscoJuice.log(current.title + ' category ' + current.ctype); -// if (categories.type !== current.ctype && current.weight > -50) continue; -// } +// if (categories && categories.type) { +// if (!current.ctype && current.weight > -50) { +// // DiscoJuice.log(current); +// continue; +// } +// // DiscoJuice.log(current.title + ' category ' + current.ctype); +// if (categories.type !== current.ctype && current.weight > -50) continue; +// } - if (++hits > this.maxhits) {Â + if (++hits > this.maxhits) { someleft = true; break; } - // DiscoJuice.log('Accept: ' + current.title); + // DiscoJuice.log('Accept: ' + current.title); var countrydef = null; if (current.country) { var cname = (this.parent.Constants.Countries[current.country] ? this.parent.Constants.Countries[current.country] : current.country); - if (cname !== '_all_') { + if (cname !== '_all_') { var cflag = (this.parent.Constants.Flags[current.country] ? this.parent.Constants.Flags[current.country] : undefined); countrydef = {'country': cname, 'flag': cflag}; } @@ -265,7 +281,7 @@ DiscoJuice.Control = { "selectProvider": function(entityID) { - // console.log('entityid: ' + entityID); + // console.log('entityid: ' + entityID); var callback; var that = this; @@ -278,7 +294,7 @@ DiscoJuice.Control = { var entity = null; for(i = 0; i < this.data.length; i++) { - if (this.data[i].entityID == entityID) { + if (this.data[i].entityID === entityID) { entity = this.data[i]; } } @@ -305,7 +321,9 @@ DiscoJuice.Control = { "discoReadSetup": function() { var settings = this.parent.Utils.options.get('disco'); - if (!settings) return; + if (!settings) { + return; + } var html = ''; var returnurl = settings.url; @@ -314,7 +332,9 @@ DiscoJuice.Control = { var i; var currentStore; - if (!stores) return; + if (!stores) { + return; + } for(i = 0; i < stores.length; i++) { currentStore = stores[i]; @@ -332,8 +352,12 @@ DiscoJuice.Control = { "discoWrite": function(e) { var settings = this.parent.Utils.options.get('disco'); - if (!settings) return false; - if (!settings.writableStore) return false; + if (!settings) { + return false; + } + if (!settings.writableStore) { + return false; + } var html = ''; var returnurl = settings.url; @@ -362,7 +386,9 @@ DiscoJuice.Control = { minLength: 0, source: function( request, response ) { var term = request.term; - if (term.length === 1) return; + if (term.length === 1) { + return; + } // that.resetCategories(); that.prepareData(); } @@ -455,7 +481,7 @@ DiscoJuice.Control = { $.getJSON(countryapi, function(data) { // DiscoJuice.log(data); - if (data.status == 'ok' && data.country) { + if (data.status === 'ok' && data.country) { that.parent.Utils.createCookie(data.country, 'Country2'); that.setCountry(data.country); that.parent.Utils.log('DiscoJuice getCountry() : Country lookup succeeded: ' + data.country); @@ -480,8 +506,7 @@ DiscoJuice.Control = { //this.ui.popup.find("select.discojuice_filterTypeSelect").val() this.ui.popup.find("select.discojuice_filterCountrySelect").val('all'); }, - - + "getCategories": function () { var filters = {}; var type, country; @@ -507,7 +532,8 @@ DiscoJuice.Control = { "resetTerm": function() { //this.ui.popup.find("select.discojuice_filterTypeSelect").val() this.ui.popup.find("input.discojuice_search").val(''); - }, + } + +}; -}; \ No newline at end of file diff --git a/modules/discojuice/www/discojuice/discojuice.misc.js b/modules/discojuice/www/discojuice/discojuice.misc.js index da89a947e564ea46fa441638073fb4bf140a3882..f85eacad3849a594a51920d7a1448e1936a96e3d 100644 --- a/modules/discojuice/www/discojuice/discojuice.misc.js +++ b/modules/discojuice/www/discojuice/discojuice.misc.js @@ -66,7 +66,7 @@ DiscoJuice.Constants = { 'CH': 'ch.png', 'TR': 'tr.png', 'GB': 'gb.png', - 'US': 'us.png', + 'US': 'us.png' } }; diff --git a/modules/discojuice/www/discojuice/discojuice.ui.js b/modules/discojuice/www/discojuice/discojuice.ui.js index 4b97b49c6606cb4ade77789ebdd5e7c8e0cf0f80..f092a3c0d9731136edbf506b4c91172672e2fe9e 100644 --- a/modules/discojuice/www/discojuice/discojuice.ui.js +++ b/modules/discojuice/www/discojuice/discojuice.ui.js @@ -191,7 +191,7 @@ DiscoJuice.UI = { '</div>' + '</div>' + - '<div id="locatemediv">' + + '<div id="discojuice_locatemediv" style="display: none">' + '<div class="locatemebefore">' + '<p style="margin-top: 10px"><a id="locateme" href="">' + '<img style="float: left; margin-right: 5px; margin-top: -10px" src="' + imgpath + 'target.png" alt="locate me..." />' + @@ -242,7 +242,9 @@ DiscoJuice.UI = { }); - if (this.parent.Utils.options.get('location', false) && navigator.geolocation) { + if (this.parent.Utils.options.get('location', false) && !!navigator.geolocation) { + this.popup.find("div#discojuice_locatemediv").show(); + var that = this; $("#locateme").click(function(event) { var imgpath = that.parent.Utils.options.get('discoPath', '') + 'images/'; diff --git a/modules/discojuice/www/discojuice/discojuiceDiscoveryResponse.html b/modules/discojuice/www/discojuice/discojuiceDiscoveryResponse.html index 65554976598517efa09ab4eeab8d500d9d4b9e48..561b9bb7aa79b2a75a49cac49bf69f88ff878a58 100644 --- a/modules/discojuice/www/discojuice/discojuiceDiscoveryResponse.html +++ b/modules/discojuice/www/discojuice/discojuiceDiscoveryResponse.html @@ -29,10 +29,9 @@ function receive() { })(); var sender = parseURL(document.referrer); - if (urlParams.entityID) { - window.parent.DiscoJuice.Utils.log('ResponseLocation: Response from discovery service [' + sender + ']: ' + urlParams.entityID); - window.parent.DiscoJuice.Control.discoResponse(urlParams.entityID, sender); + window.parent.DiscoJuice.Utils.log('ResponseLocation: Response from discovery service [' + sender + ']: ' + urlParams.entityID + ' subID: ' + urlParams.subID); + window.parent.DiscoJuice.Control.discoResponse(sender, urlParams.entityID, urlParams.subID); } else { window.parent.DiscoJuice.Utils.log('ResponseLocation: Response from discovery service [' + sender + ']: No valid response parameters'); } diff --git a/modules/discojuice/www/discojuice/idpdiscovery.js b/modules/discojuice/www/discojuice/idpdiscovery.js index fee97ffa311e7ffb220fb31d89827e2283e399fa..b851ece536286cefd58cdfb1e0bd38e6715d167d 100644 --- a/modules/discojuice/www/discojuice/idpdiscovery.js +++ b/modules/discojuice/www/discojuice/idpdiscovery.js @@ -107,7 +107,7 @@ var IdPDiscovery = function() { var entityID = this.getSP(); if(!entityID) { - DiscoJuice.Utils.log('Missing required parameter [entityID]'); + // DiscoJuice.Utils.log('Missing required parameter [entityID]'); return; } diff --git a/modules/discojuice/www/discojuice/logos/ntnu.png b/modules/discojuice/www/discojuice/logos/ntnu.png index 65f732ed88767825a5fbfbbf9347232689e38196..0836fcc5430d799585e4922ea85404d8022c921b 100644 Binary files a/modules/discojuice/www/discojuice/logos/ntnu.png and b/modules/discojuice/www/discojuice/logos/ntnu.png differ diff --git a/modules/discojuice/www/discojuice/logos/uio.png b/modules/discojuice/www/discojuice/logos/uio.png index 557c0bf53c97f0fd5784982d891d65adb4b28aad..7b96a476a6203c13bdf228b6f62aa3e47c2d387b 100644 Binary files a/modules/discojuice/www/discojuice/logos/uio.png and b/modules/discojuice/www/discojuice/logos/uio.png differ diff --git a/modules/discojuice/www/discojuice/logos/uninett.png b/modules/discojuice/www/discojuice/logos/uninett.png index 8fa1901569a70026a9bbff75920dc2d0377e25aa..6f69b8a09bb318a22844f0330e1c724c9437855d 100644 Binary files a/modules/discojuice/www/discojuice/logos/uninett.png and b/modules/discojuice/www/discojuice/logos/uninett.png differ