Commit af5bc19c authored by haemmer's avatar haemmer

Added dynamic loading of logos

Updated license and copy right information
parent aad580c2
......@@ -40,7 +40,7 @@ SWITCHwayf Version History
- Replaced the term 'Home Organisation' in the language strings to more
generic terms that probably are better understood by users.
- SP names from MDUI metadata elements are now used if available
- Added JQuery library
- Added new version of JQuery library
- Some small styling changes/CSS improvements
Issues: <https://forge.switch.ch/redmine/projects/wayf/versions/???>
......@@ -162,7 +162,19 @@ The revision history of older versions, can be found on the SWITCHwayf web page:
Credits
-------
Find below the list of people who have contributed to code, either because they
The SWITCHwayf uses code from the following libraries:
* jQuery by the jQuery Foundation and other contributors,
http://jquery.com/
* Improved Dropdown by John Fuex
https://bitbucket.org/Johnfx/improveddropdown-jquery-plugin/src
* jQuery Plug-in "Basic Visibility Detection" by Digital Fusion
http://teamdf.com/
Please consult the LICENSE file for the individual licenses of these components.
Find below a list of people who have contributed to the code, either because they
found bugs, suggested improvements or contributed code. Have a look at the
version history in order to see the individual contributions. The list is sorted
alphabetically.
......
License note for the SWITCHwayf code
-----------------------------------
Copyright (c) 2013, SWITCH - Serving Swiss Universities
All rights reserved.
Copyright 2013, SWITCH - Serving Swiss Universities
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -48,7 +47,32 @@ permissions and limitations under the License.
License note for JQuery
-----------------------
Copyright (c) 2011 John Resig, http://jquery.com/
Copyright 2013 - jQuery Foundation and other contributors, http://jquery.com/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
License note JQuery Plug-in "Basic Visibility Detection"
-------------------------------------------------------
Copyright 2012 - Digital Fusion, http://teamdf.com/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
......
......@@ -304,7 +304,7 @@ function getImageElement(sourceElement,iconPath) {
// Highlight selected item
var selectElement = getSelectControlFromOtherControl(listControl);
var selectedListElement = $("[savedValue='" + selectElement.val() + "']");
var selectedListElement = $("[savedValue='" + selectElement.val() + "']").first();
selectedListElement.addClass("idd_listItem_Hover");
// Scroll to proper list entry
......@@ -329,9 +329,19 @@ function getListElement(sourceElement) {
.css('overflow-x', 'hidden')
.css('padding-right','20px')
.css('background-color','white')
.scroll(function() {
// Loop through list and check which elements are visible
$(this).children('.idd_listItem[logo]').each(function () {
if ($(this).visible()){
// Load logo
$(this).children("img").attr("src", $(this).attr("logo"));
}
});
})
.addClass('idd_list')
.mouseenter(function () { suspendTextBoxExitHandler = true; })
.mouseleave(function () { suspendTextBoxExitHandler = false; });
newListControl.keydown(function (e) {
......@@ -399,15 +409,19 @@ function getListGroupItem(label,visible) {
function populateListItem(newListControl, optionItem) {
var title = '';
var noImage = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
var loadingImage = 'data:image/gif;base64,R0lGODlhEAAQAPIAAM7a5wAAAJ2msDU4PAAAAE9UWWlvdnZ9hCH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQJCgAAACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkECQoAAAAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkECQoAAAAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkECQoAAAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQJCgAAACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQJCgAAACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAkKAAAALAAAAAAQABAAAAMyCLrc/jDKSatlQtScKdceCAjDII7HcQ4EMTCpyrCuUBjCYRgHVtqlAiB1YhiCnlsRkAAAOwAAAAAAAAAAAA==';
// Add logo if there is at least one logo
var logo = '';
if (displayLogos){
if (optionItem.attr('logo')){
logo = '<img src="' + optionItem.attr('logo') + '" width="16" height="16" class="idd_listItemLogo" />';
//logo = '<img src="' + optionItem.attr('logo') + '" width="16" height="16" class="idd_listItemLogo" />';
logo = '<img src="' + loadingImage + '" width="16" height="16" class="idd_listItemLogo" />';
} else if (optionItem.attr('data')){
// Add an invisible 1px gif inline
logo = '<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" width="16" height="16" class="idd_listItemLogo" />';
logo = '<img src="' + noImage + '" width="16" height="16" class="idd_listItemLogo" />';
}
}
......@@ -607,6 +621,12 @@ function clearFilter(textControl) {
function showList(listControl) {
if (!listControl.is(':visible')) {
listControl.show();
// Add scroll event handler to list div
listControl.children('.idd_listItem[logo]').each(function () {
if ($(this).visible()){
$(this).children("img").attr("src", $(this).attr("logo"));
}
});
positionList(listControl);
}
}
......@@ -846,4 +866,36 @@ function processDelayedCall(key, func) {
func();
}
/* end: Delayed calls methods */
\ No newline at end of file
/* end: Delayed calls methods */
(function($){
/* ------------------------------------------------------------------------- */
/**
* Copyright 2012, Digital Fusion
* Licensed under the MIT license.
* http://teamdf.com/jquery-plugins/license/
*
* @author Sam Sehnert
* @desc A small plugin that checks whether elements are within
* the user visible viewport of a web browser.
* only accounts for vertical position, not horizontal.
*/
$.fn.visible = function(partial,hidden){
var $t = $(this).eq(0),
t = $t.get(0),
$w = $(window),
viewTop = $w.scrollTop(),
viewBottom = viewTop + $w.height(),
_top = $t.offset().top,
_bottom = _top + $t.height(),
compareTop = partial === true ? _bottom : _top,
compareBottom = partial === true ? _top : _bottom,
clientSize = hidden === true ? t.offsetWidth * t.offsetHeight : true;
return !!clientSize && ((compareBottom <= viewBottom) && (compareTop >= viewTop));
};
})(jQuery);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment