64 lines
2.4 KiB
JavaScript
64 lines
2.4 KiB
JavaScript
var repoindex = (function(repoindex) {
|
|
|
|
var GroupEntry = {};
|
|
GroupEntry.prototype = new repoindex.Entry();
|
|
GroupEntry.prototype.constructor = GroupEntry;
|
|
GroupEntry = function(groupName, groupInfo) {
|
|
repoindex.Entry.prototype.constructor.call(this, groupName, groupInfo);
|
|
|
|
this.initTableRow = function() {
|
|
this.rowElement.addCell(this.name);
|
|
this.rowElement.addCell(this.info.repo);
|
|
var packagesCellElement = document.createElement("td");
|
|
repoindex.setPackageNames(packagesCellElement, this.info.packages);
|
|
this.rowElement.appendChild(packagesCellElement);
|
|
};
|
|
|
|
this.initTableRow();
|
|
};
|
|
|
|
repoindex.GroupEntryManager = {};
|
|
repoindex.GroupEntryManager.prototype = new repoindex.EntryManager();
|
|
repoindex.GroupEntryManager.prototype.contstructor = repoindex.GroupEntryManager;
|
|
repoindex.GroupEntryManager = function(pagination, repoEntries) {
|
|
repoindex.EntryManager.prototype.constructor.call(this, GroupEntry, document.getElementById("groups"), pagination, repoEntries);
|
|
|
|
this.entryName = "group";
|
|
this.entryNamePlural = "groups";
|
|
this.containerName = "repository";
|
|
this.containerNamePlural = "repositories";
|
|
this.getContainerQuantity = repoindex.entryManagerGetRepoQuantity;
|
|
|
|
this.addEntry = function(repoName, groupName, packages) {
|
|
var entry = new GroupEntry(groupName, {
|
|
repo: repoName,
|
|
name: groupName,
|
|
packages: packages
|
|
});
|
|
entry.index = this.entries.length;
|
|
this.entries.push(entry);
|
|
};
|
|
|
|
// handle a page selection
|
|
this.pagination.pageSelected = function(pageElement) {
|
|
var mgr = this.entryManager;
|
|
// remove elements from previously selected page
|
|
mgr.entryContainer.wipeChildren();
|
|
// if there is no page because there are no package entries, pageElement is null
|
|
if(pageElement) {
|
|
// show elements of selected page
|
|
pageElement.forRange(function(i) {
|
|
var entry = mgr.filteredEntries[i];
|
|
entry.add(mgr.entryContainer);
|
|
}, mgr.filteredEntries.length);
|
|
}
|
|
};
|
|
|
|
this.infoBox = document.getElementById("groups_info");
|
|
|
|
};
|
|
|
|
return repoindex;
|
|
|
|
})(repoindex || {});
|