Skip to content
Snippets Groups Projects
Commit bc2bffce authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

Fix that prevents an item to be listed twice...

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2938 44740490-163a-0410-bde0-09ae8108e29a
parent 3c12a733
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,24 @@ DiscoJuice.Control = {
if (this.wncr[i] && typeof this.wncr[i] === 'function') this.wncr[i]();
},
// "mergeData": function (data) {
// var i, item, relID;
// for (i = 0; i < data.length; i++) {
// item = data[i];
// relID = item.entityID;
// if (item.subID) {
// relID += '#' + item.subID;
// }
// item['relID'] = relID;
//
// if (!this.alreadyLoaded[relID]) {
// this.data.push(item);
// this.alreadyLoaded[relID] = true;
// }
// }
// },
/*
* Fetching JSON Metadata using AJAX.
* Callback postLoad is called when data is returned.
......@@ -99,6 +117,7 @@ DiscoJuice.Control = {
data: parameters,
success: function(data) {
that.data = $.merge(that.data, data);
//that.mergeData(data);
that.parent.Utils.log('Successfully loaded metadata (' + data.length + ') (' + j + ' of ' + metadataurls.length + ')');
notifyCompleted();
}
......
......@@ -16,6 +16,7 @@ DiscoJuice.UI = {
// Reference to the
"popup": null,
"alreadyLoaded": {},
// Entities / items
"resulthtml": 'Loading data…',
......@@ -39,6 +40,7 @@ DiscoJuice.UI = {
"clearItems": function() {
this.resulthtml = '';
this.alreadyLoaded = {};
},
"addItem": function(item, countrydef, search, distance, quickentry, enabled) {
......@@ -52,6 +54,13 @@ DiscoJuice.UI = {
var debugweight = this.parent.Utils.options.get('debug.weight', false);
var relID = item.entityID;
if (item.subID) {
relID += '#' + item.subID;
}
if (this.alreadyLoaded[relID]) return;
this.alreadyLoaded[relID] = true;
// Add icon element first
if (item.icon && this.parent.Utils.options.get('showIcon', true)) {
......@@ -134,10 +143,7 @@ DiscoJuice.UI = {
}
var relID = item.entityID;
if (item.subID) {
relID += '#' + item.subID;
}
......
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