home *** CD-ROM | disk | FTP | other *** search
/ com!online 2002 June / comonline0602.iso / software / cogitum / CoTracker.exe / list.___ < prev    next >
Encoding:
Text File  |  2000-10-31  |  5.3 KB  |  283 lines

  1. <HTML>
  2. <HEAD>
  3. <TITLE></TITLE>
  4. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
  5. <STYLE>
  6. <!--
  7. .NormTxt
  8. {
  9.        color: black;        
  10.     background-color:white;
  11.     cursor:default;    
  12. }
  13.  
  14. .HltTxt
  15. {
  16.        color: red;        
  17.     background-color:white;
  18.     cursor:default;    
  19. }
  20.  
  21. .SelTxt
  22. {
  23.        color: white;        
  24.  
  25.     background-color:0000a0;
  26.     cursor:default;    
  27. }
  28. .linormal
  29.  {    
  30.     list-style-type: none;            
  31.     display: list-item;        
  32.     color: black;        
  33.     background-color: white;            
  34.   }
  35. -->
  36. </STYLE>
  37. <SCRIPT language="javascript">
  38.  
  39. var DropText;
  40. var bDrag = 0;
  41. var SelItem = null;
  42.  
  43.  
  44. function HltLE (CID, Flag)
  45.  ListElement = window.event.srcElement;
  46.  
  47.  if (ListElement.parentElement.value == 10)  
  48.   return;
  49.   
  50.  
  51.  if (Flag)  
  52.  {
  53.   ListElement.className = "HltTxt";
  54.  }
  55.  else
  56.  {
  57.   ListElement.className = "NormTxt";
  58.  }
  59. }
  60.  
  61. function MoveOverLi(CID, Flag)
  62. {
  63.  var bFirst;
  64.  
  65.  if ((window.event.srcElement.tagName == "SPAN") || (window.event.srcElement.tagName == "IMG"))
  66.   li = window.event.srcElement.parentElement; 
  67.  else
  68.   li = window.event.srcElement; 
  69.  
  70.  if ((li.value == 10) || (!bDrag) )
  71.   return;
  72.  
  73.  lis = document.all.tags("LI");
  74.  if (li == lis[0])
  75.   bFirst = 1;
  76.  else
  77.   bFirst = 0;   
  78.    
  79.  
  80.  if (Flag)  
  81.  {  
  82.    li.all.DragDiv.innerHTML = "     <img src='drop.gif'>" + DropText;
  83.    if (bFirst)
  84.    {
  85.      if (event.offsetY < (li.offsetTop + li.offsetHeight/2))  
  86.      {       
  87.        li.style.borderTopStyle = "groove"; 
  88.        li.style.borderBottomStyle = "none";        
  89.      }
  90.      else
  91.      {
  92.        li.style.borderTopStyle = "none"; 
  93.        li.style.borderBottomStyle = "groove";        
  94.      }
  95.    }
  96.    else
  97.    li.style.borderBottomStyle = "groove";
  98.    
  99.  if (li.offsetTop<= document.body.scrollTop)
  100.    document.body.doScroll ("scrollbarUp");   
  101.  if ((li.offsetTop+li.offsetHeight) >= (document.body.scrollTop+document.body.clientHeight))
  102.    document.body.doScroll ("scrollbarDown");   
  103.    
  104.    
  105.  }
  106.  else
  107.  {    
  108.    li.all.DragDiv.innerHTML = "";  
  109.    li.style.borderBottomStyle = "none";
  110.    li.style.borderTopStyle = "none";
  111.  } 
  112. }
  113.  
  114.  
  115. function ClickPoint (CID)
  116.  CurElement = window.event.srcElement; 
  117.  if (SelItem && SelItem!=CurElement)
  118.  {
  119.   SelItem.parentElement.value = 1; 
  120.   SelItem.className = "NormTxt";
  121.  }
  122.  
  123.  CurElement.className = "SelTxt";
  124.  DropText = CurElement.outerText;
  125.  CurElement.parentElement.value=10;
  126.  
  127.  SelItem = CurElement;
  128. }
  129.  
  130. function fnMoveItem (CID)
  131. {
  132.  CurElement = window.event.srcElement;
  133.  if ((window.event.button == 1) && (!bDrag))
  134.  {  
  135.   ClickPoint (CID)  
  136.   bDrag = 1;
  137.   DropText = SelItem.outerText;
  138.  }
  139.  else
  140.  {
  141.   if ((window.event.button != 1) && bDrag)
  142.    bDrag = 0;
  143.  }
  144. }
  145.  
  146. function ClearDrag(CID)
  147.  var li = null;
  148.  
  149.  //li = window.event.srcElement.parentElement;  
  150.  if (bDrag)
  151.  {
  152.     bDrag = 0;
  153.     if (CID != null)
  154.     {
  155.      lis  = document.all.tags("LI");
  156.      for (i=0; i < lis.length; i++)
  157.      {
  158.        if (lis[i].CIDVal == CID)
  159.        {
  160.          li = lis[i];
  161.          break;
  162.        }
  163.      }      
  164.      if ((!li) || (!CID))
  165.       return;
  166.      li.all.DragDiv.innerHTML = "";            
  167.      InsertRemoveLi(li);
  168.     }
  169.  }
  170. }
  171.  
  172.  
  173. function InsertRemoveLi (targetLi)
  174. {
  175.  var bAfter = 1; 
  176.  
  177.  if (targetLi == SelItem.parentElement)
  178.   return;
  179.  if (!SelItem.parentElement)
  180.   return;  
  181.    
  182.  
  183.  tmp = SelItem;   
  184.  
  185.  targetLi.all.SpanId.className="NormTxt"; 
  186.  
  187.  if (targetLi.style.borderTopStyle == "groove")
  188.  {
  189.   targetLi.style.borderTopStyle = "none";
  190.   bAfter = 0;
  191.  }
  192.    
  193.  if (targetLi.style.borderBottomStyle == "groove")
  194.   targetLi.style.borderBottomStyle = "none"; 
  195.  
  196.  if (bAfter)
  197.   targetLi.outerHTML=targetLi.outerHTML+SelItem.parentElement.outerHTML; 
  198.  else
  199.   targetLi.outerHTML=SelItem.parentElement.outerHTML + targetLi.outerHTML; 
  200.  
  201.  SelItem.parentElement.outerHTML = "";
  202.  
  203.  lis = document.all.tags("LI");
  204.  
  205.  for (i=0; i < lis.length; i++)
  206.  {
  207.   if (lis[i].value == 10)
  208.    SelItem = lis[i].all.SpanId;
  209.  } 
  210. }
  211.  
  212.  
  213. function SaveCTOrder ()
  214. {
  215.  var    CTss = Source.selectNodes("root/CTLIST/CATEGORY");
  216.  var    CTList = Source.selectSingleNode("root/CTLIST");
  217.  var    childLabel = CTList.firstChild;
  218.  var    child;
  219.  var    id;
  220.  
  221.  lis = document.all.tags("LI"); 
  222.  for (i=0; i < lis.length; i++)  
  223.  {
  224.    id = lis[i].CIDVal;
  225.    child = Source.selectSingleNode("root\/CTLIST\/CATEGORY[@CID="+id+"]");     
  226.    if (child && (child != childLabel))
  227.    {
  228.     CTList.removeChild(child);
  229.     CTList.insertBefore(child, childLabel);
  230.    }
  231.    else   
  232.     childLabel=childLabel.nextSibling;
  233.  } 
  234.  
  235. }
  236.  
  237.  
  238. function fnDragCheck ()
  239. {
  240.   if ((window.event.button != 1) && bDrag)
  241.    bDrag = 0;
  242. }
  243.  
  244. function Init (SourceXML)
  245. {
  246.     Source = SourceXML;
  247.  
  248.     Style = new ActiveXObject("Microsoft.XMLDOM");
  249.     Style.async = false;                    
  250.     bOK = Style.load("tree.xsl");
  251.     
  252.     szHTML = Source.transformNode(Style);
  253.     document.all.TreeRes.innerHTML = szHTML;    
  254. }
  255.  
  256. function RemoveEvent ()
  257. {
  258.  window.event.returnValue = false;  
  259. }
  260.  
  261. function onKeyPress  ()
  262. {
  263.   if (event.keyCode == 13)    
  264.    top.onOKey();
  265.  
  266.   if (event.keyCode == 27)
  267.    top.onCancel(); 
  268. }
  269.  
  270.  
  271. </SCRIPT>
  272. </HEAD>
  273.  
  274. <BODY style="background-color:white" onselectstart=RemoveEvent() onmouseup=ClearDrag(null) ondragstart=RemoveEvent() onkeydown=onKeyPress()>
  275. <DIV ID="TreeRes" style="margin-top:-10px; margin-left:-5px; background-color:white;">
  276. </DIV>
  277. </BODY>
  278.  
  279. </HTML>
  280.