home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2 (Special) / PCPro-2b.iso / Demos / Macromedia / CourseBuilder / CourseBuilderInstaller.exe / Disk1 / data1.cab / Dreamweaver-unInstalled / Configuration / Commands / Segment Editor.js < prev   
Encoding:
JavaScript  |  1999-12-06  |  1.7 KB  |  80 lines

  1. // Copyright 1999 Macromedia, Inc. All rights reserved.
  2.  
  3. //*************** GLOBALS VARS *****************
  4.  
  5. var HELP_DOC = HELP_cmdSegmentEditor;
  6.  
  7. var SEG_NAME = '';
  8. var SEG_TYPE = '';
  9. var IS_SET = false;
  10.  
  11. var name = '';
  12. var type = '';
  13.  
  14.  
  15. //******************* API **********************
  16.  
  17. function commandButtons() {
  18.   return new Array(BTN_OK,"cmdOK()",
  19.                    BTN_Cancel,"cmdCancel()",
  20.                    BTN_Help,"displayHelp()");
  21. }
  22.  
  23. function cmdOK() {
  24.   if (applyCommand()) {
  25.     garbageCollect(true);
  26.     window.close();
  27.   }
  28. }
  29.  
  30. function cmdCancel() {
  31.   garbageCollect(true);
  32.   window.close();
  33. }
  34.  
  35. function applyCommand() {
  36.   SEG_NAME = (name) ? name : LABEL_defaultSegName;
  37.   SEG_TYPE = type;
  38.   IS_SET = true;
  39.   return IS_SET;
  40. }
  41.  
  42. function inspectCommand(theName, theSegType) {
  43.   name = theName;
  44.   type = theSegType;
  45.   IS_SET = false;
  46. }
  47.  
  48. //***************** LOCAL FUNCTIONS  ******************
  49.  
  50. function initializeUI(){
  51.   var theObj,segKind;
  52.   
  53.   theObj=findObject('segName');
  54.   if (theObj) theObj.value = removeExt(name);
  55.  
  56.   theObj=findObject('segType');
  57.   segKind = (type) ? eval(type) : true;
  58.   if (theObj) theObj[(segKind)?0:1].checked = true;
  59.  
  60.   document.theForm.segName.focus(); //set focus on textbox
  61.   document.theForm.segName.select(); //set insertion point into textbox
  62. }
  63.  
  64. function updateUI(theItemName) {
  65.   var theObj;
  66.   
  67.   theObj = findObject(theItemName);
  68.   if (theObj) {
  69.     if (theItemName == 'segName' && removeExt(name) != theObj.value) {
  70.       name = theObj.value;
  71.       name = replaceSub(name, '"', '');
  72.       name = replaceSub(name, "'", '');
  73.       theObj.value = name;
  74.     } else if (theItemName == 'segType') {
  75.       type = (theObj[0].checked) ? "1" : "0";
  76.     }
  77.   }
  78. }
  79.  
  80.