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 / DetailPage.js < prev    next >
Encoding:
JavaScript  |  2003-09-05  |  3.6 KB  |  127 lines

  1. // Copyright 2000, 2001, 2002, 2003 Macromedia, Inc. All rights reserved.
  2.  
  3. //*************** GLOBALS  *****************
  4.  
  5. var LIST_RS, LIST_COL_SHOW, LIST_KEY_COL, LIST_LINK_COL, LIST_DETAIL_COL;
  6. //var CHECK_CREATEFILE;
  7.  
  8. var MODEL_IS_CF = (dw.getDocumentDOM().serverModel.getServerName() == "Cold Fusion");
  9. var NUM_RepeatCount = 0; // this number is updated in initializeUI
  10. var TF_REPEAT_COUNT;
  11.  
  12. var detailPageObj = new Object();
  13. var m_colShowArray = new Array();
  14. var dom;
  15.  
  16. //******************* API **********************
  17.  
  18. function commandButtons()
  19. {
  20.    return "";
  21. }
  22.  
  23. function receiveArguments(obj)
  24. {
  25.   detailPageObj = obj;
  26.  
  27. }
  28.  
  29. //***************** LOCAL FUNCTIONS  ******************
  30.  
  31. function InitializeUI() {
  32.  
  33.   MM.setBusyCursor();
  34.  
  35.   var paramObj = new Object();
  36.   var sbObj = null;
  37.   var tableCol1Str, tableCol2Str, tableRowStr;
  38.   var tableObj = new Object();
  39.   var tableObj2 = new Object();
  40.   var dynObj = new Object();
  41.  
  42.   tableObj.align = "default";
  43.   tableObj.width = "50%";
  44.  
  45.   //TODO: Ensure that the recordset name is unique.
  46.  
  47.  
  48.   //Get the selected columns from the detailPageObj.
  49.   m_colShowArray = detailPageObj.columnList;
  50.   alert(m_colShowArray.length);
  51.  
  52.   //Since the columns will include the 3 Recordset stats objects, 
  53.   //remove them from the list before updating the dialog list boxes.
  54.   //var newLength = (m_colShowArray.length) - 3;
  55.   //m_colShowArray.splice(newLength, 3);
  56.  
  57.   dom = dw.getDocumentDOM();
  58.  
  59.   paramObj.rs = detailPageObj.ssRec.rsName;
  60.  
  61.   //Set the columnID and param.
  62.   paramObj.paramName = detailPageObj.paramName;
  63.   paramObj.col = detailPageObj.colId;
  64.  
  65.   //create new, empty custom group
  66.   var customGroup = new Group();
  67.  
  68.   //get the moveToSpecificRecord Group.
  69.   var moveToSpecificRecordGroup = new Group("moveToSpecificRecord");
  70.   moveToSpecificRecordGroup.getData(true,true);
  71.  
  72.   //get "directive" participants from Move To groups and add to customGroup
  73.   customGroup.addParticipants(moveToSpecificRecordGroup.getParticipants("aboveHTML"));
  74.  
  75.   var rowDataPart = new Participant("MasterDetail_TableData");
  76.   rowDataPart.getData(true, true);
  77.  
  78.   var rowPart = new Participant("MasterDetail_TableRow");
  79.   rowPart.getData(true, true);
  80.  
  81.   var tablePart = new Participant("MasterDetail_Table");
  82.   tablePart.getData(true, true);
  83.  
  84.   var dynDataPart = new Participant("dynamicData_ref");
  85.   dynDataPart.getData(true,true);
  86.  
  87.   tableCol1Str = "";
  88.   tableCol2Str = "";
  89.   tableRowStr = "";
  90.   outStr = ""
  91.  
  92.   for (var i = 0; i < m_colShowArray.length; i++) {
  93.  
  94.     //Display the column name in the first column..
  95.     tableObj.rowDataContent = m_colShowArray[i];
  96.     tableCol1Str = rowDataPart.getInsertString(tableObj, "afterSelection");
  97.     
  98.     //Display the dynamic data in the second column..
  99.     dynObj.rsName = detailPageObj.ssRec.rsName;;
  100.     dynObj.bindingName = m_colShowArray[i];
  101.     tableObj.rowDataContent = dynDataPart.getInsertString(dynObj, "replaceSelection")
  102.     tableCol2Str = rowDataPart.getInsertString(tableObj, "afterSelection")
  103.  
  104.     //Build the HTML table row
  105.     tableObj2.tableRowContent = tableCol1Str + tableCol2Str;
  106.     tableObj2.preRowData = "";
  107.     tableObj2.postRowData = "";
  108.  
  109.     tableRowStr = rowPart.getInsertString(tableObj2, "afterSelection");
  110.  
  111.     outStr += tableRowStr;
  112.   }    
  113.  
  114.   paramObj.tableContent = outStr;
  115.   paramObj.tableAlign = "center";
  116.   paramObj.border = "1";
  117.   customGroup.addParticipants(Array(tablePart))
  118.  
  119.   //Apply the custom group.
  120.   customGroup.apply(paramObj,sbObj);
  121.  
  122.   //Paste the recordset
  123.   pasteServerBehavior(detailPageObj.ssRec);
  124.  
  125.   MM.clearBusyCursor();
  126. }
  127.