[ Index ] |
PHP Cross Reference of Eventum |
[Summary view] [Print] [Text view]
1 var expanding = false; 2 3 // expands the cell specified by ecID and msgID. This will initiate the call to the remote script to get the 4 // content using our HTTPClient. Since this call can take time, a "loading.." message will be displayed 5 // temporarily in the cell. 6 function expand(baseURL, ecID, listID) 7 { 8 var row = getRow(ecID, listID); 9 var cell = getCell(ecID, listID); 10 11 if ((cell.innerHTML == "") || (cell.innerHTML == 'loading...')) { 12 cell.innerHTML = "loading..."; 13 var httpClient = new HTTPClient(); 14 httpClient.loadRemoteContent(baseURL + 'get_remote_data.php?action=' + getRemoteFunction(ecID) + '&ec_id=' + ecID + '&list_id=' + listID, 'handleCallback'); 15 } 16 row.style.display = getDisplayStyle(); 17 } 18 19 // hides the current cell. The data is not lost so if the cell is expanded in the future, the content will not be reloaded. 20 function collapse(ecID, listID) 21 { 22 getRow(ecID, listID).style.display = "none"; 23 } 24 25 function handleCallback(response) 26 { 27 var message = response.responseText; 28 // parse listID and ecID out of text. 29 var ecID = message.substr(0, message.indexOf(":")); 30 message = message.substr(message.indexOf(":") + 1, message.length); 31 var listID = message.substr(0, message.indexOf(":")); 32 message = message.substr(message.indexOf(":") + 1, message.length); 33 expandCell(ecID, listID, message); 34 } 35 36 function expandCell(ecID, listID, txt) 37 { 38 var currentDiv = getCell(ecID, listID); 39 currentDiv.innerHTML = txt; 40 currentDiv.style.display = getDisplayStyle(); 41 } 42 43 function expandAll(baseURL, ecID) 44 { 45 var cells = getAllCells(ecID); 46 for (i = 0; i < cells.length; i++) { 47 id = cells[i].id; 48 chunks = id.split("_"); 49 expand(baseURL, ecID, chunks[3]); 50 } 51 } 52 53 function collapseAll(ecID) 54 { 55 var cells = getAllCells(ecID); 56 for (i = 0; i < cells.length; i++) { 57 id = cells[i].id; 58 chunks = id.split("_"); 59 collapse(ecID, chunks[3]); 60 } 61 } 62 63 function setRemoteFunction(ecID, url) 64 { 65 self['ec_remote_func_' + ecID] = url; 66 } 67 68 function getRemoteFunction(ecID) 69 { 70 return self['ec_remote_func_' + ecID]; 71 } 72 73 // returns the row for the specified ecID and listID 74 function getRow(ecID, listID) 75 { 76 return document.getElementById("ec_" + ecID + "_item_" + listID + "_row"); 77 } 78 79 // returns the cell for the specified ecID and listID 80 function getCell(ecID, listID) 81 { 82 return document.getElementById("ec_" + ecID + "_item_" + listID + "_cell"); 83 } 84 85 // returns an array of all cells that are part of the specified expandable table. 86 function getAllCells(ecID) 87 { 88 var cells = document.body.getElementsByTagName("TD"); 89 var newCells = new Array(); 90 for (i = 0; i < cells.length; i++) { 91 if ((cells[i].id != '') && (cells[i].id.substring(0,("ec_" + ecID).length) == ('ec_' + ecID))) { 92 newCells.length++; 93 newCells[newCells.length-1] = cells[i]; 94 } 95 } 96 return newCells; 97 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Dec 19 21:21:33 2007 | Cross-referenced by PHPXref 0.7 |