home *** CD-ROM | disk | FTP | other *** search
/ Practical Internet Web Designer 86 / PIWD86.iso / pc / contents / dreamweaver / software / dwmx2004.exe / Disk1 / data1.cab / Configuration_En / Commands / MoveRepeatEntry.js < prev    next >
Encoding:
JavaScript  |  2003-09-05  |  1.8 KB  |  76 lines

  1. // Copyright 2001, 2002, 2003 Macromedia, Inc. All rights reserved.
  2. //---------------   GLOBAL VARIABLES   ---------------
  3. var targetDom = null;
  4. var targetRegion = null;
  5. var moveLocation = ""; 
  6. //---------------     API FUNCTIONS    ---------------
  7. function isDOMRequired() {
  8.     return true;
  9. }
  10.  
  11. function getMoveLocation(direction)
  12.     {
  13.     moveLocation = window.event.altKey ? "up" : "down";
  14.     
  15.     if (direction != null)
  16.         moveLocation = direction; 
  17.         
  18.     if (window.event.ctrlKey)
  19.         moveLocation = (moveLocation == "up") ? "listBegin" : "listEnd";
  20.     
  21.     return moveLocation;
  22.     } //getMoveLocation
  23.     
  24.     
  25. function canAcceptCommand()
  26.     {            
  27.     return (dw.getDocumentDOM() != null && dw.getFocus() != 'browser' && dw.getDocumentDOM().getParseMode() == 'html');
  28.     } //canAcceptCommand
  29.  
  30. //Move the selected entry up or down, to the beginning or end of the list.
  31. //param 2 is a string telling where to move - it's optional. Possible values are
  32. //"up", "down", "listBegin", "listEnd". Pass nothing and the modifier keys will be read
  33. function receiveArguments()
  34.     {
  35.     targetDom = arguments[0];
  36.     if (targetDom == null)
  37.         targetDom = dw.getDocumentDOM();
  38.             
  39.     targetRegion = arguments[2];     
  40.         
  41.     var passedDirection = null; 
  42.     if (arguments.length > 1) 
  43.         passedDirection = arguments[1]; 
  44.         
  45.     getMoveLocation(passedDirection);
  46.     }
  47.     
  48. function DoCommand()
  49.     {    
  50.     if (!canMoveRepeatEntry(targetDom, moveLocation, targetRegion))
  51.         {
  52.         dw.beep();
  53.         
  54.         if (getSelectedRepeatEntry(targetDom, targetRegion) == null)
  55.             alert(MM.MSG_NoRepeatEntries);
  56.         
  57.         return;
  58.         }
  59.         
  60.     if (moveLocation == "" )
  61.         {
  62.         alert(MSG_MissingParamMove);
  63.         return;
  64.         }
  65.         
  66.     if (!moveSelectedRepeatEntry(targetDom,  moveLocation, targetRegion))
  67.         dw.beep();
  68.         
  69.     targetDom = null;
  70.     moveLocation  = "";
  71.     targetRegion = null;
  72.     }
  73.     
  74.     
  75. //---------------    LOCAL FUNCTIONS   ---------------
  76.