home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 October / Chip Ekim 2003.iso / prog / code / contr / setup.exe / Disk1 / data1.cab / Configuration_En / Commands / InsertRepeatEntry.js < prev    next >
Encoding:
JavaScript  |  2003-07-18  |  2.1 KB  |  85 lines

  1. // Copyright 2001, 2002, 2003 Macromedia, Inc. All rights reserved.
  2.  
  3. //---------------   GLOBAL VARIABLES   ---------------
  4.  
  5. var targetDom = null;
  6. var insertLocation = ""; 
  7. var insertNode=null;
  8.  
  9. //---------------     API FUNCTIONS    ---------------
  10.  
  11. function isDomRequired() {
  12.     return true;
  13. }
  14.  
  15.  
  16. function getInsertLocation(menuArguments)
  17.     {    
  18.     insertLocation = window.event.altKey ? "beforeEntry" : "afterEntry"; 
  19.     
  20.     if (window.event.ctrlKey)
  21.         insertLocation = window.event.altKey ? "listBegin" : "listEnd"; 
  22.  
  23.     if (menuArguments.length > 2) 
  24.         insertLocation = menuArguments[2]; 
  25.         
  26.     return insertLocation; 
  27.     } //getInsertLocation
  28.     
  29.     
  30. function canAcceptCommand()
  31.     {            
  32.     targetDom = arguments[0]; 
  33.     if (targetDom == null)
  34.         targetDom = dw.getDocumentDOM(); 
  35.  
  36.     if (targetDom == null)
  37.         return false; 
  38.             
  39.     return (dw.getFocus() != 'browser' && dw.getDocumentDOM() != null && dw.getDocumentDOM().getParseMode() == 'html');
  40.     } //canAcceptCommand
  41.  
  42.  
  43. //Pass the target DOM, or null here. If you wish, you can also
  44. //pass a string as the second param, to determine whether to 
  45. //insert before or after the current entry, or beginning or end of the list. 
  46. //If no param is passed we will look at the altKey. Note that if there is no 
  47. //entry selected, this controls whether the entry appears 
  48. //at the beginning or end of the list. 
  49. //legal values for this string are: "listBegin", "listEnd", "beforeEntry", "afterEntry"
  50. function receiveArguments()
  51.     {
  52.     targetDom = arguments[0];
  53.     if (targetDom == null)
  54.         targetDom = dw.getDocumentDOM();
  55.                 
  56.     insertNode = arguments[1]; 
  57.     getInsertLocation(arguments); 
  58.     }
  59.  
  60. function DoCommand()
  61.     {    
  62.     if (!canInsertRepeatEntry(targetDom, insertLocation, insertNode))
  63.         {
  64.         dw.beep();
  65.         alert(MM.MSG_CantInsertRepeatEntry); 
  66.         return; 
  67.         }
  68.  
  69.     
  70.     if (insertLocation == "")
  71.         {
  72.         alert(MSG_MissingParams); 
  73.         return;
  74.         }
  75.         
  76.     doInsertRepeatEntry(targetDom, insertNode, insertLocation);
  77.     insertNode = null; 
  78.     targetDom = null; 
  79.     insertLocation = ""; 
  80.     }
  81.     
  82.     
  83. //---------------    LOCAL FUNCTIONS   ---------------
  84.  
  85.