var IDC_Listview = function (documentObject, parentObject, width, height){ this.isIE = document.all?true:false; this.Core = new IDC_Core(documentObject, parentObject); this.LastUrl; this.LastArguments; this.Document = documentObject || document; this.ParentObject = parentObject || document.body; this.CurrentURL = this.Document.location.toString().substring(0,this.Document.location.toString().lastIndexOf('/')) + '/'; this.Control = this.Document.createElement('TABLE'); var tb = this.Document.createElement('TBODY'); var tr1 = this.Document.createElement('TR'); var tr2 = this.Document.createElement('TR'); var td1 = this.Document.createElement('TD'); var td2 = this.Document.createElement('TD'); this.OwnerColumnHeaderContainer = this.Document.createElement('DIV'); this.OwnerColumnHeaderContainer.className='columnHeaderBack'; this.Container = this.Document.createElement('DIV'); this.Container.className='listviewBack'; td2.vAlign='top'; this.Control.cellPadding=0; this.Control.cellSpacing=0; this.Control.border=0; this.Control.style.width=(width || 300) + (this.isIE ? '' : 'px'); this.Control.style.height=(height || 100) + (this.isIE ? '' : 'px'); this.Control.appendChild(tb); tb.appendChild(tr1); tb.appendChild(tr2); tr1.appendChild(td1); tr2.appendChild(td2); td1.appendChild(this.OwnerColumnHeaderContainer); td2.appendChild(this.Container); this.ParentObject.appendChild(this.Control); this.Container.style.width=this.Control.style.width; this.Container.style.height=((height || 100) - this.OwnerColumnHeaderContainer.offsetHeight) + (this.isIE ? '' : 'px'); this.HeaderScroller = this.Document.createElement('DIV'); this.ShowLoading = true; this.EnsureNoScriptTimeout=true; var pn = this.OwnerColumnHeaderContainer.parentNode; var cn = pn.removeChild(this.OwnerColumnHeaderContainer); this.HeaderScroller.appendChild(cn); pn.appendChild(this.HeaderScroller); this.ColumnHeaderContainer = cn; this.Statusbar = null; this.EnableColumnFilters = false; this.ResizeableColumnHeaders=true; this.OnDoubleClickAsString =''; this.Container.Listview = this; this.ColumnHeaderContainer.style.position='relative'; this.ColumnHeaderContainer.parentNode.style.overflow='hidden'; this.ColumnHeaderContainer.parentNode.noWrap=true; this.ColumnHeaderContainer.style.left=0; this.ColumnHeaderContainer.style.top=0; this.ColumnHeaderContainer.parentNode.parentNode.className='columnHeaderOverflowedBack'; this.viewStyle=0; this.lastViewstyle=0; this.ViewStyles = []; this.ViewStyles.push(IDC_ListviewItemDetailed); this.ViewStyles.push(IDC_ListviewItemSmallIcon); this.ViewStyles.push(IDC_ListviewItemMediumIcon); this.ViewStyles.push(IDC_ListviewItemLargeIcon); this.ViewStyles.push(IDC_ListviewItemGalleryIcon); this.Container.onscroll=function(){ this.Listview.ColumnHeaderContainer.style.left=-this.scrollLeft; this.Listview.ColumnHeaderContainer.parentNode.style.width = this.offsetWidth; if(this.Listview.EnableColumnFilters){ for(var i=0;i<this.Listview.ColumnHeaders.length;i++){ this.Listview.ColumnHeaders[i].HideFilters(); } } }; this.SelectedItems = []; this.Items = []; this.ColumnHeaders = []; this.__TransparentOverlay = this.Document.createElement('DIV'); this.__TransparentOverlay.style.position='absolute'; this.__TransparentOverlay.style.zIndex=250000; this.__TransparentOverlay.style.width='100%'; this.__TransparentOverlay.style.height='100%'; this.__TransparentOverlay.style.left=0; this.__TransparentOverlay.style.top=0; this.__TransparentOverlay.style.display='none'; this.__TransparentOverlay.oncontextmenu = function(e){ return false; }; this.__TransparentOverlay.style.cursor='e-resize'; this.__TransparentOverlay.onclick = function(){ }; this.__TransparentOverlay.onmouseup = function(){ this.style.display='none'; }; this.__TransparentOverlay.onmousemove = null; this.__TransparentOverlay.Listview =this; if(this.isIE){ this.__TransparentOverlay.style.backgroundImage='url(images/spacer.gif)'; } this.Document.body.appendChild(this.__TransparentOverlay); this.__InlineBlock = (this.isIE ? 'inline' : 'inline-block'); this.DragDrop_ItemDrop = null; this.DropType = null; this.Dropable = null; this.MultiSelect = true; this.OnDoubleClick = null; this.OnSelect = null; this.OnLoad = null; this.OnLoadFailed = null; this.OnParseComplete = null; this.Keyboard = null; this.Sortable = true; this.SortingColumn=null; this.SortDirectionAsc=true; this.AjaxObject = null; this.ColumnHeaderContainer.parentNode.style.width = this.Container.offsetWidth; }; IDC_Listview.prototype.SelectItemFromKeyboard = function(keys){ for(var i=0;i<this.Items.length;i++){ var n = this.Items[i]; if(n.Items[0].toLowerCase().indexOf(keys) == 0){ this.Items[i].Select(); var x = this.Items[i].Control.offsetLeft; var y = this.Items[i].Control.offsetTop; this.Container.scrollLeft = x; this.Container.scrollTop = y; break; } } }; IDC_Listview.prototype.GetItemById = function(Id){ for(var i=0;i<this.Items.length;i++){ if(this.Items[i].Uniqueidentifier == Id) return this.Items[i]; } return null; }; IDC_Listview.prototype.ClearSelected = function(){ for(var i=0;i<this.SelectedItems.length;i++){ var n = this.SelectedItems[i]; n.IsSelected = false; n.EventHandler.SelectionChanged(n); } this.SelectedItems.length=0; }; IDC_Listview.prototype.ChangeView = function (newView){ if(this.viewStyle == newView) return; this.lastViewstyle = this.viewStyle; this.viewStyle = newView; for(var i=0;i<this.Items.length;i++){ this.Items[i].Create(this); } }; IDC_Listview.prototype.SetSize = function (width, height){ if(width<0) width=0; if(height<0) height=0; this.Container.style.width = width; this.Container.style.height = height; this.ColumnHeaderContainer.style.left=-this.Container.scrollLeft; this.ColumnHeaderContainer.parentNode.style.width = this.Container.offsetWidth; }; IDC_Listview.prototype.AddItem = function (Uniqueidentifier, Value, Icons, SubItems){ var values = []; values.push(Value); if(SubItems){ values = values.concat(SubItems); } var l = new IDC_ListviewItem(this.Document, this.Container, values); l.Uniqueidentifier = Uniqueidentifier; if(Icons){ l.Icon16 = Icons.length>0 ? Icons[0] : null; l.Icon32 = Icons.length>1 ? Icons[1] : null; l.Icon48 = Icons.length>2 ? Icons[2] : null; l.Icon64 = Icons.length>3 ? Icons[3] : null; l.Icon96 = Icons.length>4 ? Icons[4] : null; l.Icon128 = Icons.length>5 ? Icons[5] : null; } var i = this.Items.push(l); l.Create(this); if(this.Statusbar) this.Statusbar.innerHTML = this.Items.length + ' Items...'; return l; }; IDC_Listview.prototype.AddItemObject = function (lwItem){ var i = this.Items.push(lwItem); lwItem.Create(this); if(this.Statusbar) this.Statusbar.innerHTML = this.Items.length + ' Items...'; }; IDC_Listview.prototype.AddItemsFromHTMLObject = function(sender, what){ while(what.hasChildNodes()){ var src = what.firstChild; src = what.removeChild(src); if(src.tagName){ var v = []; while(src.hasChildNodes()){ var ss = src.firstChild; ss = src.removeChild(ss); if(ss.tagName) v.push(this.isIE ? ss.innerText : ss.textContent); } var l = new IDC_ListviewItem(sender.Document, sender.Container, v); l.Icon16 = src.getAttribute('icon16'); l.Icon32 = src.getAttribute('icon32'); l.Icon48 = src.getAttribute('icon48'); l.Icon64 = src.getAttribute('icon64'); l.Icon96 = src.getAttribute('icon96'); l.Icon128 = src.getAttribute('icon128'); l.Dragable = src.getAttribute('drag') == '1'; l.DragType = src.getAttribute('dragtype'); l.Dropable = src.getAttribute('drop') == '1'; l.DropType = src.getAttribute('droptype'); l.Uniqueidentifier = src.getAttribute('uid'); sender.AddItemObject(l); } } }; IDC_Listview.prototype.PrintItems = function(){ var html=this.ItemsToPrintableHTML(); var w = window.open('',''); w.document.write('<html><head><style type="text/css" rel="stylesheet">\ntd { font-family:arial;font-size:12px;}\n</style></head><body onload="window.print();window.close();">' + html + '</body></html>'); w.document.close(); }; IDC_Listview.prototype.PrintSelectedItems = function(){ var html=this.SelectedItemsToPrintableHTML(); var w = window.open('',''); w.document.write('<html><head><style type="text/css" rel="stylesheet">\ntd { font-family:arial;font-size:12px;}\n</style></head><body onload="window.print();window.close();">' + html + '</body></html>'); w.document.close(); }; IDC_Listview.prototype.ItemsToPrintableHTML = function (){ var html ='<table border="0" cellpadding="2" cellspacing="1">'; html+='<tr style="background-color:#4f81bd;color:white;">'; for(var i=0;i<this.ColumnHeaders.length;i++){ html+=this.ColumnHeaders[i].ToPrintableHTML(); } html+='</tr>'; for(var i=0;i<this.Items.length;i++){ html+=this.Items[i].ToPrintableHTML(i % 2 == 0 ? '#d3dfee' : '#ffffff'); } html +='</table>'; return html; }; IDC_Listview.prototype.SelectedItemsToPrintableHTML = function (){ var html ='<table border="0" cellpadding="2" cellspacing="1">'; html+='<tr style="background-color:#4f81bd;color:white;">'; for(var i=0;i<this.ColumnHeaders.length;i++){ html+=this.ColumnHeaders[i].ToPrintableHTML(); } html+='</tr>'; for(var i=0;i<this.SelectedItems.length;i++){ html+=this.SelectedItems[i].ToPrintableHTML(); } html +='</table>'; return html; }; IDC_Listview.prototype.ItemsToHTML = function (){ var html =''; for(var i=0;i<this.Items.length;i++){ html+=this.Items[i].ToHTML(); } return html; }; var IDC_ListviewItem = function(OwnerDocument, OwnerContainer, Values){ this.SelectedCSS=''; this.Document = OwnerDocument; this.Container = OwnerContainer; this.Items = Values; this.Icon16 = null; this.Icon32 = null; this.Icon48 = null; this.Icon64 = null; this.Icon96 = null; this.Icon128 = null; this.Control = null; this.Dragable=false; this.Dropable=false; this.DragType=null; this.DropType=null; this.Uniqueidentifier=null; this.Listview = null; this.IsSelected = false; return this; }; IDC_ListviewItem.prototype.ToPrintableHTML = function(bgColor){ var html = '<tr>'; for(var i=0;i<this.Items.length && i<this.Listview.ColumnHeaders.length;i++){ html+='<td align="' + this.Listview.ColumnHeaders[i].TextAlign + '"' + (bgColor ? ' style="background-color:' + bgColor + '"' : '') + '>' + (this.Items[i] || '&nbsp;') + '</td>'; } html+='</tr>'; return html; }; IDC_ListviewItem.prototype.ToHTML = function(){ var div=document.createElement('DIV'); var u = document.createElement('u'); div.appendChild(u); for(var i=0;i<this.Items.length;i++){ var b = document.createElement('b'); if(this.isIE) b.innerText = this.Items[i]; else b.textContent = this.Items[i]; u.appendChild(b); } if(this.Icon16) u.setAttribute('icon16',this.Icon16); if(this.Icon32) u.setAttribute('icon32',this.Icon32); if(this.Icon48) u.setAttribute('icon48',this.icon48); if(this.Icon64) u.setAttribute('icon64',this.icon64); if(this.Icon96) u.setAttribute('icon96',this.icon96); if(this.Icon128) u.setAttribute('ico128',this.ico128); if(this.Dragable) u.setAttribute('drag',this.drag ? '1' : ''); if(this.DragType) u.setAttribute('dragtype',this.dragtype); if(this.Dropable) u.setAttribute('drop',this.drop ? '1' : ''); if(this.DropType) u.setAttribute('droptype',this.droptype); if(this.Uniqueidentifier) u.setAttribute('uid',this.uid); var html = div.innerHTML; div.innerHTML=null; div = null; return html; }; IDC_ListviewItem.prototype.SetColumnName = function(name, index){ this.Items[index] = name; this.EventHandler.OnTextChanged(this); }; IDC_ListviewItem.prototype.SetCurrentIcon = function(icon){ this.Control.childNodes[0].style.backgroundImage='url(' + this.CurrentURL + icon + ')'; this.EventHandler.OnIconChanged(this); }; IDC_ListviewItem.prototype.SetIcons = function(Icons){ if(Icons){ this.Icon16 = Icons.length>0 ? Icons[0] : null; this.Icon32 = Icons.length>1 ? Icons[1] : null; this.Icon48 = Icons.length>2 ? Icons[2] : null; this.Icon64 = Icons.length>3 ? Icons[3] : null; this.Icon96 = Icons.length>4 ? Icons[4] : null; this.Icon128 = Icons.length>5 ? Icons[5] : null; } this.EventHandler.OnIconChanged(this); }; IDC_ListviewItem.prototype.SetName = function(name, index){ this.SetColumnName(name,index || 0); }; IDC_ListviewItem.prototype.SetNames = function(names){ this.Items = names; this.EventHandler.OnTextChanged(this); }; IDC_ListviewItem.prototype.getFirstSelectedIndex = function(){ for(var i=0;i<this.Listview.Items.length;i++){ if(this.Listview.Items[i].IsSelected) return i; } return 0; }; IDC_ListviewItem.prototype.getLastSelectedIndex = function(){ for(var i=this.Listview.Items.length-1;i>=0;i--){ if(this.Listview.Items[i].IsSelected) return i; } return this.Listview.Items.length-1; }; IDC_ListviewItem.prototype.getMyIndex = function(){ for(var i=this.Listview.Items.length-1;i>=0;i--){ if(this.Listview.Items[i] == this) return i; } return null; }; IDC_ListviewItem.prototype.Select = function(){ var ctrl = (this.Listview.Core.Keyboard ? this.Listview.Core.Keyboard.KeyControlPressed == true : false); var shift =(this.Listview.Core.Keyboard ? this.Listview.Core.Keyboard.KeyShiftPressed == true : false); if(ctrl && this.Listview.MultiSelect){ var isInArray = false; var InArrayIndex=0; for(var i=0;i<this.Listview.SelectedItems.length;i++){ var n = this.Listview.SelectedItems[i]; if(n == this){ InArrayIndex = i; isInArray = true; } } if(isInArray){ this.Listview.SelectedItems.splice(InArrayIndex,1); this.IsSelected = false; this.EventHandler.SelectionChanged(this); } else { this.IsSelected = true; this.Listview.SelectedItems.push(this); this.EventHandler.SelectionChanged(this); } } else if(shift && this.Listview.MultiSelect && this.Listview.SelectedItems.length>0){ var a = this.getFirstSelectedIndex(); var b = this.getMyIndex(); this.Listview.ClearSelected(); var shift = a < b ? 1 : -1; for(var i=a;i!=b;i+=shift){ this.Listview.Items[i].IsSelected = true; this.Listview.SelectedItems.push(this.Listview.Items[i]); this.EventHandler.SelectionChanged(this.Listview.Items[i]); if(this.Listview.OnSelect) this.Listview.OnSelect(this.Listview.Items[i]); } this.Listview.SelectedItems.push(this); this.IsSelected = true; this.EventHandler.SelectionChanged(this); } else { for(var i=0;i<this.Listview.SelectedItems.length;i++){ var n = this.Listview.SelectedItems[i]; n.IsSelected = false; n.EventHandler.SelectionChanged(n); } this.Listview.SelectedItems.length=0; this.Listview.SelectedItems.push(this); this.IsSelected = true; this.EventHandler.SelectionChanged(this); } if(this.Listview.OnSelect) this.Listview.OnSelect(this); }; IDC_ListviewItem.prototype.Create = function(listview){ this.Listview = listview; var me = this; if(this.Control){ this.Control.parentNode.removeChild(this.Control); } else { if(listview.EnableColumnFilters){ for(var i=0;i<listview.ColumnHeaders.length && i<this.Items.length;i++){ listview.ColumnHeaders[i].AddUniqueValue(this.Items[i]); } } } this.EventHandler = new listview.ViewStyles[listview.viewStyle](listview, me); this.Control = this.EventHandler.Control; this.Container.appendChild(this.Control); this.Control.onclick=function(){ me.Select(); }; this.Control.onmouseover=function(){ if(me.EventHandler.OnMouseOver) me.EventHandler.OnMouseOver(me); }; this.Control.onmouseout=function(){ if(me.EventHandler.OnMouseOut) me.EventHandler.OnMouseOut(me); }; if(listview.OnDoubleClick){ this.Control.ondblclick = function (){ listview.OnDoubleClick(me); }; } if(listview.EnableColumnFilters){ for(var i=0;i<this.Items.length && i<listview.ColumnHeaders.length;i++){ if(listview.ColumnHeaders[i].HiddenValues.indexOf(this.Items[i])>-1){ this.Control.style.display='none'; break; } } } }; IDC_Listview.prototype.ReloadURLItems = function(){ this.ReadURLItems(this.LastUrl, this.LastArguments); }; IDC_Listview.prototype.AddItemsFromAJAX = function(url, formPostArguments){ if(this.ShowLoading && this.EnsureNoScriptTimeout){ this.Container.scrollTop = 0; this.BusyControl = this.Document.createElement('DIV'); this.BusyControl.style.position='absolute'; this.BusyControl.style.zIndex=250000; this.BusyControl.style.width=this.Container.offsetWidth; this.BusyControl.style.height=this.Container.offsetHeight; this.BusyControl.style.backgroundColor='#ffffff'; if(this.isIE) this.BusyControl.style.filter = 'alpha(opacity=50)'; else this.BusyControl.style.MozOpacity = '.50'; this.BusyControl.innerHTML='<center><br><br><br><br>Loading...</center>'; if(this.Container.firstChild) this.Container.insertBefore(this.BusyControl,this.Container.firstChild); else this.Container.appendChild(this.BusyControl); } if(this.Statusbar) this.Statusbar.innerHTML = '<img src="images/windowBusy.gif" alt="" border="0">'; this.LastUrl = url; this.LastArguments = formPostArguments; if(this.AjaxObject){ this.AjaxObject.Reset(); } else this.AjaxObject = new this.Core.Ajax(); this.AjaxObject.requestFile = url; if(formPostArguments){ for(var i=0;i<formPostArguments.length;i++){ var arg = formPostArguments[i]; if(arg.length==2) AjaxObject.encVar(arg[0],arg[1]); } } var me = this; this.AjaxObject.OnCompletion = function(){ me.__AddItemsFromAJAX(); }; this.AjaxObject.OnError = function(){ me.__ListviewAjaxFailure();}; this.AjaxObject.OnFail = function(){ me.__ListviewAjaxFailure();}; this.AjaxObject.RunAJAX(); }; IDC_Listview.prototype.AddItemsFromHTML = function(html){ var startTicks = parseInt(new Date().getTime()); var tmp = this.Document.createElement('DIV'); tmp.innerHTML = html; var okay = this.__ToItems(tmp); if(this.OnLoad && okay){ this.OnLoad(); } }; IDC_Listview.prototype.__AddItemsFromAJAX = function(){ var result=this.AjaxObject.Response; this.AjaxObject.Reset(); this.AjaxObject.Dispose(); this.AjaxObject=null; var startTicks = parseInt(new Date().getTime()); var tmp = this.Document.createElement('DIV'); tmp.innerHTML = result; var okay = this.__ToItems(tmp); if(this.OnLoad && okay){ this.OnLoad(); } }; IDC_Listview.prototype.__ToItems = function(what, keepingJSAlive){ if(!keepingJSAlive){ this.Clear(); this.ExpectedItems = what.childNodes.length; var isParsingHeaders = true; } var startTicks = parseInt(new Date().getTime()); while(what.hasChildNodes()){ var src = what.firstChild; src = what.removeChild(src); if(src.tagName){ if(this.Items.length==0 && src.tagName=='I'){ if(isParsingHeaders){ this.ClearColumnHeaders(); isParsingHeaders=false; } this.AddColumnHeader(this.isIE ? src.innerText : src.textContent,src.getAttribute('width'), src.getAttribute('align'), src.getAttribute('datatype')); } else { var v = []; while(src.hasChildNodes()){ var ss = src.firstChild; ss = src.removeChild(ss); if(ss.tagName) v.push(this.isIE ? ss.innerText : ss.textContent); } var l = new IDC_ListviewItem(this.Document, this.Container, v); l.Icon16 = src.getAttribute('icon16'); l.Icon32 = src.getAttribute('icon32'); l.Icon48 = src.getAttribute('icon48'); l.Icon64 = src.getAttribute('icon64'); l.Icon96 = src.getAttribute('icon96'); l.Icon128 = src.getAttribute('icon128'); l.Dragable = src.getAttribute('drag') == '1'; l.DragType = src.getAttribute('dragtype'); l.Dropable = src.getAttribute('drop') == '1'; l.DropType = src.getAttribute('droptype'); l.Uniqueidentifier = src.getAttribute('uid'); this.AddItemObject(l); } } src = null; var ticks = parseInt(new Date().getTime()); if(ticks - startTicks > 750 && this.EnsureNoScriptTimeout){ if(this.ShowLoading && !keepingJSAlive){ this.Container.scrollTop = 0; this.BusyControl = this.Document.createElement('DIV'); this.BusyControl.style.position='absolute'; this.BusyControl.style.zIndex=250000; this.BusyControl.style.width=this.Container.offsetWidth; this.BusyControl.style.height=this.Container.offsetHeight; this.BusyControl.style.backgroundColor='#ffffff'; if(this.isIE) this.BusyControl.style.filter = 'alpha(opacity=75)'; else this.BusyControl.style.MozOpacity = '.75'; this.BusyControl.innerHTML='<center><br><br><br><br>The listview is containing a large amount of data, and the load is performing slower than normal.<br><br>Please be patient.<br><br><b>' + what.childNodes.length + ' of ' + this.ExpectedItems + ' remaining</b></center>'; if(this.Container.firstChild) this.Container.insertBefore(this.BusyControl,this.Container.firstChild); else this.Container.appendChild(this.BusyControl); } else if(this.ShowLoading && keepingJSAlive){ this.BusyControl.innerHTML='<center><br><br><br><br>The listview is containing a large amount of data, and the load is performing slower than normal.<br><br>Please be patient.<br><br><b>' + what.childNodes.length + ' of ' + this.ExpectedItems + ' remaining</b></center>'; } var me = this; setTimeout(function(){me.__ToItems(what, true);},1); return; } } if(this.OnParseComplete && !what.hasChildNodes()){ this.OnParseComplete(this.Items.length); } if(keepingJSAlive && !what.hasChildNodes()){ if(this.ShowLoading && this.BusyControl != null){ this.BusyControl.parentNode.removeChild(this.BusyControl); this.BusyControl = null; } if(this.OnLoad) this.OnLoad(); } return true; }; IDC_Listview.prototype.SelectItem = function(item){ item.Select(this); }; IDC_Listview.prototype.Clear = function(){ this.Items.length=0; this.SelectedItems.length=0; while(this.Container.hasChildNodes()){ var o = this.Container.removeChild(this.Container.lastChild); o=null; } this.ColumnHeaderContainer.style.left=-this.Container.scrollLeft; this.ColumnHeaderContainer.parentNode.style.width = this.Container.offsetWidth; if(this.Statusbar) this.Statusbar.innerHTML = this.Items.length + ' Items...'; if(this.EnableColumnFilters){ for(var i=0;i<this.ColumnHeaders.length;i++){ this.ColumnHeaders[i].UniqueValues.length=0; this.ColumnHeaders[i].HiddenValues.length=0; this.ColumnHeaders[i].FiltersControl = null; this.ColumnHeaders[i].FiltersVisisble=false; this.ColumnHeaders[i].HideFilterButton(); } } }; IDC_ListviewItem.prototype.Remove = function(){ if(this.EnableColumnFilters){ for(var i=0;i<this.Listview.ColumnHeaders.length && i<this.Items.length;i++){ var inx = this.Listview.ColumnHeaders[i].UniqueValues.indexOf(this.Items[i]); this.Listview.ColumnHeaders[i].UniqueValues.splice(inx,1); } } for(var i = this.Listview.SelectedItems.length-1;i>=0;i--){ if(this.Listview.SelectedItems[i] == this){ this.Listview.SelectedItems.splice(i,1); } } for(var i = this.Listview.Items.length-1;i>=0;i--){ if(this.Listview.Items[i] == this){ this.Listview.Items.splice(i,1); } } var n = this.Control.parentNode.removeChild(this.Control); n = null; if(this.Statusbar) this.Statusbar.innerHTML = this.Items.length + ' Items...'; }; IDC_Listview.prototype.AddColumnHeader = function (name, width, textAlign, dataType){ var c = new IDC_ListviewColumnHeader(this, name, width, textAlign, dataType); c.__Width = c.Width - 4; c.Index = this.ColumnHeaders.push(c) -1; c.Create(); if(this.viewStyle == 3){ for(var i=0;i<this.Items.length;i++){ this.Items[i].Create(this); } } return c; }; IDC_Listview.prototype.ClearColumnHeaders = function (){ if(this.ColumnHeaders.length==0) return; for(var i=this.ColumnHeaders.length-1;i>=0;i--){ this.ColumnHeaders[i].Remove(); } if(this.viewStyle == 3){ for(var i=0;i<this.Items.length;i++){ this.Items[i].Create(this); } } }; IDC_ListviewColumnHeader = function (listview, name, width, textAlign, dataType){ this.Listview = listview; this.isIE = this.Listview.isIE; this.Document = listview.Document; this.Container = listview.ColumnHeaderContainer; this.Control=null; this.Name = name; this.Width = width; this.Index=0; this.IsSortingColumn=false; this.SortAsc=true; this.DataType=dataType || 'string'; this.__Width = null; this.FilterControl = null; this.FiltersControl = null; this.FiltersVisisble=false; this.AbortSortClick=false; this.UniqueValues = null; this.HiddenValues = null; this.TextAlign = textAlign || 'left'; }; IDC_ListviewColumnHeader.prototype.Remove = function(refreshView){ this.Container.removeChild(this.Control); this.Listview.ColumnHeaders.splice(this.Index,1); if(refreshView && this.Listview.viewStyle == 3){ for(var i=0;i<this.Items.length;i++){ this.Items[i].Create(this); } } }; IDC_ListviewColumnHeader.prototype.ToPrintableHTML = function(){ return '<td><div style="width:' + this.Width + 'px;overflow:hidden;">' + this.Name + '</div></td>'; }; IDC_ListviewColumnHeader.prototype.Create = function(){ this.Control = this.Document.createElement('DIV'); this.Control.style.display=(this.isIE ? 'inline' : 'inline-block'); this.Control.style.width=(this.Width - 4) + (this.isIE ? '' : 'px'); this.Control.className='columnHeaderItem'; this.Control.Column = this; this.Container.appendChild(this.Control); this.Control.Text = this.Document.createElement('DIV'); this.Control.Text.innerHTML=this.Name; this.Control.Text.style.width='100%'; this.Control.Text.style.overflow='hidden'; this.Control.appendChild(this.Control.Text); if(!this.isIE){ var ow = 0; if(this.Container.childNodes.length>1) ow = parseInt(this.Container.style.width); if(this.Control.offsetWidth>0) this.Container.style.width = ow + this.Control.offsetWidth; } if(this.Container.childNodes.length==1 && this.Listview.Sortable){ this.Listview.SortingColumn = this; this.Control.className='columnHeaderItemAsc'; this.SortAsc = true; this.IsSortingColumn=true; } if(this.Listview.Sortable){ if(this.Listview.EnableColumnFilters){ this.UniqueValues = []; this.HiddenValues = []; } this.Control.style.cursor='pointer'; this.Control.onmouseover=function(){ if(this.Column.Listview.EnableColumnFilters && this.Column.Listview.Items.length>0){ this.Column.ShowFilterButton(); }; if(!this.Column.IsSortingColumn) this.className='columnHeaderItemHover'; }; this.Control.onmouseout=function(){ if(this.Column.HiddenValues){ if(this.Column.HiddenValues.length==0){ this.Column.HideFilterButton(); }} this.className=(this.Column.IsSortingColumn ? ( this.Column.SortAsc ? 'columnHeaderItemAsc' : 'columnHeaderItemDesc' ) : 'columnHeaderItem'); }; this.Control.onclick=function(){ if(this.Column.AbortSortClick) return; if(!this.Column.FiltersVisisble) this.Column.Listview.SortItemsBy(this.Column); else this.Column.HideFilters(); }; } if(this.Listview.ResizeableColumnHeaders){ this.Control.ResizeBox = this.Document.createElement('DIV'); this.Control.ResizeBox.className='listviewColumnResize'; this.Control.appendChild(this.Control.ResizeBox); this.Control.ResizeBox.style.top=0; this.Control.ResizeBox.style.left = this.Control.offsetLeft + parseInt(this.Control.style.width) - 1; this.Control.ResizeBox.Column = this; this.Control.ResizeBox.onmousedown=function(e){ this.Column.HideFilters(); this.Column.Listview.__TransparentOverlay.ResizeColumn = this.Column; this.Column.Listview.__TransparentOverlay.onmousemove = function(e){ this.Listview.Core.Mouse.RefreshMousePosition(e); this.ResizeColumn.ColumnResizing(); }; this.Column.Listview.__TransparentOverlay.onmouseup = function(e){ this.style.display='none'; if(this.ResizeColumn) this.ResizeColumn.ColumnResized(); }; this.Column.BasePos = this.Column.Listview.Core.Mouse.X; this.Column.Listview.__TransparentOverlay.style.display=''; }; this.Control.ResizeBox.onmouseup=function(){ this.Column.Listview.__TransparentOverlay.style.display='none'; }; } }; IDC_ListviewColumnHeader.prototype.ColumnResizing = function(){ var nw = parseInt(this.Width) + this.Listview.Core.Mouse.X - this.BasePos; if(nw<(this.Index==0 ? 30 : 14)) nw = (this.Index==0 ? 30 : 14); this.Control.style.width = nw - 4; for(var i=0;i<this.Listview.ColumnHeaders.length;i++){ var col = this.Listview.ColumnHeaders[i]; col.Control.ResizeBox.style.left = col.Control.offsetLeft + parseInt(col.Control.style.width) - 1; if(col.FilterControl){ if(col.FilterControl.style.display=='') col.ShowFilterButton(); } } }; IDC_ListviewColumnHeader.prototype.ColumnResized = function(){ this.Width = parseInt(this.Width) + this.Listview.Core.Mouse.X - this.BasePos; if(this.Width<(this.Index==0 ? 30 : 14)) this.Width = (this.Index==0 ? 30 : 14); this.__Width = this.Width - 4; this.Control.style.width = this.Width - 4; for(var i=0;i<this.Listview.ColumnHeaders.length;i++){ var col = this.Listview.ColumnHeaders[i]; col.Control.ResizeBox.style.left = col.Control.offsetLeft + parseInt(col.Control.style.width) - 1; if(col.FilterControl){ if(col.FilterControl.style.display=='') col.ShowFilterButton(); } } for(var i=0;i<this.Listview.Items.length;i++){ this.Listview.Items[i].Create(this.Listview); } this.Listview.ColumnHeaderContainer.style.left=-this.Listview.Container.scrollLeft; this.Listview.ColumnHeaderContainer.parentNode.style.width = this.Listview.Container.offsetWidth; if(!this.isIE){ var ow = 0; if(this.Container.childNodes.length>1) ow = parseInt(this.Container.style.width); if(this.Control.offsetWidth>0) this.Container.style.width = ow + this.Control.offsetWidth; } }; IDC_ListviewColumnHeader.prototype.AddUniqueValue = function(value){ if(!Array.indexOf){ Array.prototype.indexOf = function(obj){ for(var i=0; i<this.length; i++){ if(this[i]==obj){ return i; } } return -1; } } if(this.UniqueValues.indexOf(value)<0) this.UniqueValues.push(value); }; IDC_ListviewColumnHeader.prototype.ShowFilterButton = function(){ if(!this.FilterControl){ this.FilterControl = this.Document.createElement('IMG'); this.FilterControl.src='images/spacer.gif'; this.FilterControl.className='listviewColumnFilter'; this.FilterControl.title='Filtrer efter "' + this.Name + '"'; this.FilterControl.alt=this.FilterControl.title; this.FilterControl.Column = this; this.FilterControl.onclick=function(){ this.Column.AbortSortClick=true; var me = this.Column; setTimeout( function(){ me.AbortSortClick=false; } ,50); if(!this.Column.FiltersVisisble) this.Column.ShowFilters(); else this.Column.HideFilters(); }; this.Control.appendChild(this.FilterControl); } this.FilterControl.style.left = this.Control.offsetLeft + parseInt(this.Control.style.width) - 18; this.FilterControl.style.display=''; }; IDC_ListviewColumnHeader.prototype.ShowFilters = function(){ if(!this.FiltersControl){ this.FiltersControl = this.Document.createElement('DIV'); this.FiltersControl.Scroller = this.Document.createElement('DIV'); this.FiltersControl.Buttons = this.Document.createElement('DIV'); this.FiltersControl.appendChild(this.FiltersControl.Scroller); this.FiltersControl.appendChild(this.FiltersControl.Buttons); this.FiltersControl.className='listviewFilterFrame'; this.FiltersControl.Scroller.className='listviewFilterScroller'; this.FiltersControl.Scroller.style.width=parseInt(this.Width)+15; if(parseInt(this.FiltersControl.Scroller.style.width)<130) this.FiltersControl.Scroller.style.width = 130; this.Listview.Container.appendChild(this.FiltersControl); this.FiltersControl.Buttons.style.textAlign='right'; this.FiltersControl.Buttons.style.whiteSpace='nowrap'; var btnOK = this.Document.createElement('INPUT'); btnOK.type='button'; var btnCancel = this.Document.createElement('INPUT'); btnCancel.type='button'; btnOK.value='Filtrer'; btnCancel.value='Annuller'; btnOK.Column = this; btnCancel.Column = this; btnCancel.onclick=function(){ this.Column.HideFilters(); }; btnOK.onclick=function(){ this.Column.HiddenValues = []; for(var i=0;i<this.Column.FiltersControl.Scroller.childNodes.length;i++){ if(this.Column.FiltersControl.Scroller.childNodes[i].className=='listviewFilterItemHidden'){ this.Column.HiddenValues.push(this.Column.FiltersControl.Scroller.childNodes[i].title); } } if(this.Column.HiddenValues.length>0) this.Column.ShowFilterButton(); else this.Column.HideFilterButton(); this.Column.HideFilters(); for(var i=0;i<this.Column.Listview.Items.length;i++){ this.Column.Listview.Items[i].Create(this.Column.Listview); } }; this.FiltersControl.Buttons.appendChild(btnOK); this.FiltersControl.Buttons.appendChild(btnCancel); } for(var i=0;i<this.Listview.ColumnHeaders.length;i++){ if(this.Listview.ColumnHeaders[i] != this) this.Listview.ColumnHeaders[i].HideFilters(); } this.FiltersVisisble=true; if(this.DataType == 'numeric') this.UniqueValues.sort(this.__listviewFilterSortedByNumeric); else if(this.DataType == 'date') this.UniqueValues.sort(this.__listviewFilterSortedByDate); else this.UniqueValues.sort(this.__listviewFilterSortedBy); while(this.FiltersControl.Scroller.hasChildNodes()){ var o = this.FiltersControl.Scroller.removeChild(this.FiltersControl.Scroller.lastChild); o=null; } var fsel = this.Document.createElement('DIV'); fsel.className='listviewFilterItemChosen'; fsel.innerHTML='(Alle)'; fsel.style.whiteSpace='nowrap'; fsel.title='(Alle)'; fsel.onclick=function(){ var newCls = ''; if(this.className=='listviewFilterItemChosen'){ newCls='listviewFilterItemHidden'; } else { newCls='listviewFilterItemChosen'; } for(var i=1;i<fsel.parentNode.childNodes.length;i++){ if(fsel.parentNode.childNodes[i].className != newCls){ fsel.parentNode.childNodes[i].onclick(); } } this.className = newCls; }; this.FiltersControl.Scroller.appendChild(fsel); fsel.HiddenCount=0; for(var i=0;i<this.UniqueValues.length;i++){ var div = this.Document.createElement('DIV'); div.className=this.HiddenValues.indexOf(this.UniqueValues[i]) >-1 ? 'listviewFilterItemHidden' : 'listviewFilterItemChosen'; if(div.className=='listviewFilterItemHidden') fsel.HiddenCount++; div.UniqueValuesCount = this.UniqueValues.length; div.innerHTML=this.UniqueValues[i]; div.style.whiteSpace='nowrap'; div.title=this.UniqueValues[i]; div.onclick=function(){ if(this.className=='listviewFilterItemChosen'){ fsel.HiddenCount++; this.className='listviewFilterItemHidden'; } else { fsel.HiddenCount--; this.className='listviewFilterItemChosen'; } if(fsel.HiddenCount==0) fsel.className='listviewFilterItemChosen'; else if(fsel.HiddenCount == this.UniqueValuesCount) fsel.className='listviewFilterItemHidden'; else fsel.className='listviewFilterItemMixed'; }; this.FiltersControl.Scroller.appendChild(div); } if(fsel.HiddenCount==0) fsel.className='listviewFilterItemChosen'; else if(fsel.HiddenCount == this.UniqueValues.length) fsel.className='listviewFilterItemHidden'; else fsel.className='listviewFilterItemMixed'; var h = this.Listview.Container.offsetHeight/2; if(h>(this.UniqueValues.length+1.5)*18) h = (this.UniqueValues.length+1.5)*18; this.FiltersControl.Scroller.style.height=h; var xPos = this.Control.offsetLeft - (this.isIE ? 0 : this.Listview.Container.scrollLeft); if(this.Index == this.Listview.ColumnHeaders.length-1 && this.Index>0){ xPos -= (parseInt(this.FiltersControl.Scroller.style.width)-this.Width + 9); } if(!this.isIE) xPos += getRealPosition(this.Listview.Container)[0]; this.FiltersControl.style.left = xPos; this.FiltersControl.style.top = (this.isIE ? this.Listview.Container.scrollTop : getRealPosition(this.Listview.Container)[1]); this.FiltersControl.style.display=''; }; IDC_ListviewColumnHeader.prototype.HideFilters = function(){ this.FiltersVisisble=false; if(this.FiltersControl){ this.FiltersControl.style.display='none'; } }; IDC_ListviewColumnHeader.prototype.HideFilterButton = function(){ if(this.FilterControl){ this.FilterControl.style.display='none'; } }; IDC_Listview.prototype.__ListviewAjaxFailure = function(){ var result=this.AjaxObject.Response; this.AjaxObject.Reset(); this.AjaxObject.Dispose(); this.AjaxObject=null; if(this.OnLoadFailed) this.OnLoadFailed(result); }; IDC_Listview.prototype.SortItemsBy = function(column){ if(this.SortingColumn == column){ this.SortDirectionAsc=!this.SortDirectionAsc; this.SortingColumn.IsSortingColumn = true; this.SortingColumn.SortAsc = this.SortDirectionAsc; this.SortingColumn.Control.className = this.SortDirectionAsc ? 'columnHeaderItemAsc' : 'columnHeaderItemDesc'; } else { if(this.SortingColumn){ this.SortingColumn.Control.className='columnHeaderItem'; this.SortingColumn.IsSortingColumn = false; this.SortingColumn.SortAsc = true; } column.IsSortingColumn = true; column.SortAsc = this.SortDirectionAsc; column.Control.className = this.SortDirectionAsc ? 'columnHeaderItemAsc' : 'columnHeaderItemDesc'; this.SortDirectionAsc=true; this.SortingColumn = column; } var me = this; if(this.SortingColumn.DataType == 'numeric'){ if(this.SortDirectionAsc) this.Items.sort(function(a,b){ var aa = parseInt(a.Items[me.SortingColumn.Index].replace(/(\.|,)/g,'')) || 0; var bb = parseInt(b.Items[me.SortingColumn.Index].replace(/(\.|,)/g,'')) || 0; return aa-bb; } ); else this.Items.sort(function(a,b){ var aa = parseInt(a.Items[me.SortingColumn.Index].replace(/(\.|,)/g,'')) || 0; var bb = parseInt(b.Items[me.SortingColumn.Index].replace(/(\.|,)/g,'')) || 0; return bb-aa; } ); } if(this.SortingColumn.DataType == 'date'){ if(this.SortDirectionAsc) this.Items.sort(function(a,b){ var aa = Date.parse(a.Items[me.SortingColumn.Index]); var bb = Date.parse(b.Items[me.SortingColumn.Index]); return aa-bb; } ); else this.Items.sort(function(a,b){ var aa = Date.parse(a.Items[me.SortingColumn.Index]); var bb = Date.parse(b.Items[me.SortingColumn.Index]); return bb-aa; } ); } else { if(this.SortDirectionAsc) this.Items.sort(function(a,b){ if(a.Items[me.SortingColumn.Index].toLowerCase() == b.Items[me.SortingColumn.Index].toLowerCase()) return 0; return a.Items[me.SortingColumn.Index].toLowerCase() > b.Items[me.SortingColumn.Index].toLowerCase() ? 1 : -1; } ); else this.Items.sort(function(a,b){ if(a.Items[me.SortingColumn.Index].toLowerCase() == b.Items[me.SortingColumn.Index].toLowerCase()) return 0; return a.Items[me.SortingColumn.Index].toLowerCase() > b.Items[me.SortingColumn.Index].toLowerCase() ? -1 : 1; } ); } for(var i=0;i<this.Items.length;i++){ this.Items[i].Create(this); } }; IDC_ListviewColumnHeader.prototype.__listviewFilterSortedBy = function(a,b){ if(a == b) return 0; return a.toLowerCase() > b.toLowerCase() ? 1 : -1; }; IDC_ListviewColumnHeader.prototype.__listviewFilterSortedByNumeric = function(a,b){ var aa = parseInt(a.replace(/(\.|,)/g,'')) || 0; var bb = parseInt(b.replace(/(\.|,)/g,'')) || 0; return aa-bb; }; IDC_ListviewColumnHeader.prototype.__listviewFilterSortedByDate = function(a,b){ var aa = Date.parse(a); var bb = Date.parse(b); return aa-bb; }; IDC_Listview.prototype.MoveSelectionUp = function (){ this.MoveSelection('up'); }; IDC_Listview.prototype.MoveSelectionDown = function (){ this.MoveSelection('down'); }; IDC_Listview.prototype.MoveSelection = function (Direction){ if(this.SelectedItems.length==0) return; if(Direction == 'down'){ for(var i = this.SelectedItems.length-1;i>=0;i--){ var s = this.SelectedItems[i]; var after = s.GetNextItem(); if(after){ after = after.nextSibling; if(after){ var tmp = s.Container.removeChild(s.Control); s.Container.insertBefore(tmp, after); } else { var tmp = s.Container.removeChild(s.Control); s.Container.appendChild(tmp); } } } } else { for(var i = 0;i<this.SelectedItems.length;i++){ var s = this.SelectedItems[i]; var before = s.GetPreviousItem(); if(before){ var tmp = s.Container.removeChild(s.Control); s.Container.insertBefore(tmp, before); } } } var objects = this.Container.childNodes; this.Items.length=0; this.SelectedItems.length=0; for(var i=0;i<objects.length;i++){ var obj = objects[i]; this.Items.push(obj.IDC_ListviewItem); if(obj.IDC_ListviewItem.IsSelected){ this.SelectedItems.push(obj.IDC_ListviewItem); } } }; IDC_ListviewItem.prototype.GetNextItem = function (){ return this.Control.nextSibling; }; IDC_ListviewItem.prototype.GetPreviousItem = function (){ return this.Control.previousSibling; }; var IDC_ListviewItemDetailed = function(listview, item){ this.ViewName='Detailed view'; if(!listview || !item) return this; this.Control = listview.Document.createElement('DIV'); this.Control.style.display='block'; this.Control.className='listviewDTLine' + (item.IsSelected ? '_s' : ''); var ww = 0; for(var i=0;i<listview.ColumnHeaders.length;i++){ var di = listview.Document.createElement('DIV'); di.style.display=listview.__InlineBlock; if(i==0){ di.className='listviewDTIcon'; di.style.width=listview.ColumnHeaders[i].__Width + (listview.isIE ? '' : 'px'); di.style.backgroundImage='url(' + item.Icon16 + ')'; } else { di.className='listviewDTItem'; di.style.width=listview.ColumnHeaders[i].__Width + (listview.isIE ? '' : 'px'); } di.style.textAlign=listview.ColumnHeaders[i].TextAlign; if(item.Items.length>i){ di.innerHTML = item.Items[i]; if(di.innerHTML == '') di.innerHTML = '&nbsp;'; di.title = item.Items[i]; } else { di.innerHTML = '&nbsp;'; } this.Control.appendChild(di); ww += listview.ColumnHeaders[i].Control.offsetWidth; } if(!listview.isIE){ this.Control.style.width=ww; } this.SelectionChanged = function(item){ item.Control.className='listviewDTLine' + (item.IsSelected ? '_s' : ''); }; this.OnMouseOver = function(item){ if(!item.IsSelected) item.Control.className='listviewDTLine_h'; }; this.OnMouseOut = function(item){ if(!item.IsSelected) item.Control.className='listviewDTLine'; }; this.OnTextChanged = function(item){ for(var i=0;i<item.Items.length && i<item.Control.childNodes.length;i++){ item.Control.childNodes[i].innerHTML=item.Items[i]; } }; this.OnIconChanged = function(item){ item.Control.childNodes[0].style.backgroundImage = 'url(' + item.Icon16 + ')'; }; return this; }; var IDC_ListviewItemSmallIcon = function(listview, item){ this.ViewName='Small icons'; if(!listview || !item) return this; this.Control = listview.Document.createElement('DIV'); var span = listview.Document.createElement('SPAN'); this.Control.style.display=listview.__InlineBlock; this.Control.style.width=listview.ColumnHeaders[0].__Width + (listview.isIE ? '' : 'px'); if(listview.isIE) span.style.width=this.Control.style.width; this.Control.appendChild(span); span.innerHTML=item.Items[0]; span.className='listviewSMIconText'; if(item.Icon16!=null &&item.Icon16!=''){ span.style.backgroundImage='url(' + item.Icon16 + ')'; } this.Control.className='listviewSMIcon' + (item.IsSelected ? '_s' : ''); this.Control.title = item.Items[0]; this.SelectionChanged = function(item){ item.Control.className='listviewSMIcon' + (item.IsSelected ? '_s' : ''); }; this.OnMouseOver = function(item){ if(!item.IsSelected) item.Control.className='listviewSMIcon_h'; }; this.OnMouseOut = function(item){ if(!item.IsSelected) item.Control.className='listviewSMIcon'; }; this.OnTextChanged = function(item){ item.Control.childNodes[0].innerHTML = item.Items[0]; }; this.OnIconChanged = function(item){ item.Control.childNodes[0].style.backgroundImage = 'url(' + item.Icon16 + ')'; }; return this; }; var IDC_ListviewItemMediumIcon = function(listview, item){ this.ViewName='Medium icons'; if(!listview || !item) return this; this.Control = listview.Document.createElement('DIV'); this.Control.style.display=listview.__InlineBlock; this.Icon = listview.Document.createElement('IMG'); this.Icon.className='listviewMDIconImage'; this.Text = listview.Document.createElement('SPAN'); this.Text.className='listviewMDIconText'; if(listview.isIE) this.Text.innerText = item.Items[0]; else this.Text.textContent = item.Items[0]; this.Text.style.display=listview.__InlineBlock; if(item.Icon32!=null && item.Icon32!=''){ this.Icon.src = listview.CurrentURL + item.Icon32; } else this.Icon.style.visibility='hidden'; this.Control.className='listviewMDIcon' + (item.IsSelected ? '_s' : ''); this.Control.title = item.Items[0]; this.Control.appendChild(this.Icon); this.Control.appendChild(this.Text); this.SelectionChanged = function(item){ item.Control.className='listviewMDIcon' + (item.IsSelected ? '_s' : ''); }; this.OnMouseOver = function(item){ if(!item.IsSelected) item.Control.className='listviewMDIcon_h'; }; this.OnMouseOut = function(item){ if(!item.IsSelected) item.Control.className='listviewMDIcon'; }; this.OnTextChanged = function(item){ item.Control.childNodes[1].innerHTML = item.Items[0]; }; this.OnIconChanged = function(item){ item.Control.childNodes[0].src = item.Icon32; }; return this; }; var IDC_ListviewItemLargeIcon = function(listview, item){ this.ViewName='Large icons'; if(!listview || !item) return this; this.Control = listview.Document.createElement('DIV'); this.Control.style.display=listview.__InlineBlock; this.Icon = listview.Document.createElement('IMG'); this.Icon.className='listviewLGIconImage'; this.Text = listview.Document.createElement('SPAN'); this.Text.className='listviewLGIconText'; if(listview.isIE) this.Text.innerText = item.Items[0]; else this.Text.textContent = item.Items[0]; this.Text.style.display=listview.__InlineBlock; if(item.Icon48!=null && item.Icon48!=''){ this.Icon.src = listview.CurrentURL + item.Icon48; } else this.Icon.style.visibility='hidden'; this.Control.className='listviewMDIcon' + (item.IsSelected ? '_s' : ''); this.Control.title = item.Items[0]; this.Control.appendChild(this.Icon); this.Control.appendChild(this.Text); this.SelectionChanged = function(item){ item.Control.className='listviewMDIcon' + (item.IsSelected ? '_s' : ''); }; this.OnMouseOver = function(item){ if(!item.IsSelected) item.Control.className='listviewMDIcon_h'; }; this.OnMouseOut = function(item){ if(!item.IsSelected) item.Control.className='listviewMDIcon'; }; this.OnTextChanged = function(item){ item.Control.childNodes[1].innerHTML = item.Items[0]; }; this.OnIconChanged = function(item){ item.Control.childNodes[0].src = item.Icon48; }; return this; }; var IDC_ListviewItemGalleryIcon = function(listview, item){ this.ViewName='Gallery view'; if(!listview || !item) return this; this.Control = listview.Document.createElement('DIV'); this.Control.style.display=listview.__InlineBlock; this.Icon = listview.Document.createElement('SPAN'); this.Icon.className='listviewGalleryImage'; this.Text = listview.Document.createElement('SPAN'); this.Text.className='listviewGalleryText'; if(listview.isIE) this.Text.innerText = item.Items[0]; else this.Text.textContent = item.Items[0]; this.Text.style.display=listview.__InlineBlock; if(item.Icon96!=null && item.Icon96!=''){ this.Icon.style.backgroundImage = 'url(' + item.Icon96 + ')'; } else if(item.Icon96!=null && item.Icon96!=''){ this.Icon.style.backgroundImage = 'url(' + item.Icon96 + ')'; } else if(item.Icon64!=null && item.Icon64!=''){ this.Icon.style.backgroundImage = 'url(' + item.Icon64 + ')'; } else if(item.Icon48!=null && item.Icon48!=''){ this.Icon.style.backgroundImage = 'url(' + item.Icon48 + ')'; } else if(item.Icon32!=null && item.Icon32!=''){ this.Icon.style.backgroundImage = 'url(' + item.Icon32 + ')'; } else if(item.Icon16!=null && item.Icon16!=''){ this.Icon.style.backgroundImage = 'url(' + item.Icon16 + ')'; } this.Control.className='listviewIconGallery' + (item.IsSelected ? '_s' : ''); this.Control.title = item.Items[0]; this.Control.appendChild(this.Icon); this.Control.appendChild(this.Text); this.SelectionChanged = function(item){ item.Control.className='listviewIconGallery' + (item.IsSelected ? '_s' : ''); }; this.OnMouseOver = function(item){ if(!item.IsSelected) item.Control.className='listviewIconGallery_h'; }; this.OnMouseOut = function(item){ if(!item.IsSelected) item.Control.className='listviewIconGallery'; }; this.OnTextChanged = function(item){ item.Control.childNodes[1].innerHTML = item.Items[0]; }; this.OnIconChanged = function(item){ if(item.Icon96!=null && item.Icon96!=''){ item.Control.childNodes[0].style.backgroundImage = 'url(' + item.Icon96 + ')'; } else if(item.Icon96!=null && item.Icon96!=''){ item.Control.childNodes[0].style.backgroundImage = 'url(' + item.Icon96 + ')'; } else if(item.Icon64!=null && item.Icon64!=''){ item.Control.childNodes[0].style.backgroundImage = 'url(' + item.Icon64 + ')'; } else if(item.Icon48!=null && item.Icon48!=''){ item.Control.childNodes[0].style.backgroundImage = 'url(' + item.Icon48 + ')'; } else if(item.Icon32!=null && item.Icon32!=''){ item.Control.childNodes[0].style.backgroundImage = 'url(' + item.Icon32 + ')'; } else if(item.Icon16!=null && item.Icon16!=''){ item.Control.childNodes[0].style.backgroundImage = 'url(' + item.Icon16 + ')'; } }; return this; }; 