Source de js/list_utils.js
oldLn=0
sEmpty=false
function selectLine(obj)
{
if(oldLn && oldLn!=obj) oldLn.className=""
obj.className="ln-selected"
inp=getT(getT(obj,"td"),"input")
inp.checked=true
oldLn=obj
return true
}
function lineUp()
{
if(sEmpty) return false
sl=getT(getE("select-list"),"tbody")
sList=sl.getElementsByTagName('tr')
prev=0
for(i=0;i<sList.length;i++) {
obj=sList[i]
inp=getT(getT(obj,"td"),"input")
if ((inp.checked)&&(prev!=0)) {
sl.insertBefore(obj,prev)
inp.checked=true
break
}
prev=obj
}
}
function lineDown()
{
if(sEmpty) return false
sl=getT(getE("select-list"),"tbody")
sList=sl.getElementsByTagName('tr')
for(i=0;i<sList.length;i++) {
obj=sList[i]
inp=getT(getT(obj,"td"),"input")
if ((inp.checked)&&(i+1<sList.length)) {
sl.insertBefore(sList[i+1],obj)
inp.checked=true
break
}
}
}
function lineDel(eT)
{
if(sEmpty) return false
sl=getT(getE("select-list"),"tbody")
sList=sl.getElementsByTagName('tr')
for(i=0;i<sList.length;i++) {
obj=sList[i]
inp=getT(getT(obj,"td"),"input")
if (inp.checked) {
if(i+1<sList.length) selectLine(sList[i+1])
sl.removeChild(obj)
break
}
}
if(sl.getElementsByTagName('tr').length==0) {
sEmpty=true
newTr=sl.appendChild(document.createElement('tr'))
newTd=newTr.appendChild(document.createElement('td'))
newTd.colSpan="3"
newTd.appendChild(document.createTextNode(eT))
}
}
function clearAll(eT)
{
if(sEmpty) return false
sl=getT(getE("select-list"),"tbody")
sList=sl.getElementsByTagName('tr')
for(i=(sList.length-1);i>=0;i--) sl.removeChild(sList[i])
sEmpty=true
newTr=sl.appendChild(document.createElement('tr'))
newTd=newTr.appendChild(document.createElement('td'))
newTd.colSpan="3"
newTd.appendChild(document.createTextNode(eT))
}
function initList()
{
sl=getT(getE("select-list"),"tbody")
sList=sl.getElementsByTagName('tr')
if(sList.length) {
for(i=0;i<sList.length;i++) {
obj=sList[i]
obj.onclick=function(event) {return selectLine(this)}
obj.onfocus=function(event) {return selectLine(this)}
cells=obj.getElementsByTagName("td")
}
} else {
sEmpty=true
}
}
sEmpty=false
function selectLine(obj)
{
if(oldLn && oldLn!=obj) oldLn.className=""
obj.className="ln-selected"
inp=getT(getT(obj,"td"),"input")
inp.checked=true
oldLn=obj
return true
}
function lineUp()
{
if(sEmpty) return false
sl=getT(getE("select-list"),"tbody")
sList=sl.getElementsByTagName('tr')
prev=0
for(i=0;i<sList.length;i++) {
obj=sList[i]
inp=getT(getT(obj,"td"),"input")
if ((inp.checked)&&(prev!=0)) {
sl.insertBefore(obj,prev)
inp.checked=true
break
}
prev=obj
}
}
function lineDown()
{
if(sEmpty) return false
sl=getT(getE("select-list"),"tbody")
sList=sl.getElementsByTagName('tr')
for(i=0;i<sList.length;i++) {
obj=sList[i]
inp=getT(getT(obj,"td"),"input")
if ((inp.checked)&&(i+1<sList.length)) {
sl.insertBefore(sList[i+1],obj)
inp.checked=true
break
}
}
}
function lineDel(eT)
{
if(sEmpty) return false
sl=getT(getE("select-list"),"tbody")
sList=sl.getElementsByTagName('tr')
for(i=0;i<sList.length;i++) {
obj=sList[i]
inp=getT(getT(obj,"td"),"input")
if (inp.checked) {
if(i+1<sList.length) selectLine(sList[i+1])
sl.removeChild(obj)
break
}
}
if(sl.getElementsByTagName('tr').length==0) {
sEmpty=true
newTr=sl.appendChild(document.createElement('tr'))
newTd=newTr.appendChild(document.createElement('td'))
newTd.colSpan="3"
newTd.appendChild(document.createTextNode(eT))
}
}
function clearAll(eT)
{
if(sEmpty) return false
sl=getT(getE("select-list"),"tbody")
sList=sl.getElementsByTagName('tr')
for(i=(sList.length-1);i>=0;i--) sl.removeChild(sList[i])
sEmpty=true
newTr=sl.appendChild(document.createElement('tr'))
newTd=newTr.appendChild(document.createElement('td'))
newTd.colSpan="3"
newTd.appendChild(document.createTextNode(eT))
}
function initList()
{
sl=getT(getE("select-list"),"tbody")
sList=sl.getElementsByTagName('tr')
if(sList.length) {
for(i=0;i<sList.length;i++) {
obj=sList[i]
obj.onclick=function(event) {return selectLine(this)}
obj.onfocus=function(event) {return selectLine(this)}
cells=obj.getElementsByTagName("td")
}
} else {
sEmpty=true
}
}
Si avez des problèmes ou des questions concernant ce fichier source, vous pouvez utiliser le Forum Sources du site