Changeset 2270
- Timestamp:
- 05/30/07 06:53:48 (1 year ago)
- Files:
-
- peerreviewplugin/0.10/codereview/htdocs/js (added)
- peerreviewplugin/0.10/codereview/htdocs/js/peerReviewCommentCallback.js (added)
- peerreviewplugin/0.10/codereview/htdocs/js/peerReviewNew.js (added)
- peerreviewplugin/0.10/codereview/htdocs/js/peerReviewPerform.js (added)
- peerreviewplugin/0.10/codereview/peerReviewBrowser.py (modified) (1 diff)
- peerreviewplugin/0.10/codereview/peerReviewPerform.py (modified) (1 diff)
- peerreviewplugin/0.10/codereview/templates/peerReviewCommentCallback.cs (modified) (1 diff)
- peerreviewplugin/0.10/codereview/templates/peerReviewNew.cs (modified) (1 diff)
- peerreviewplugin/0.10/codereview/templates/peerReviewPerform.cs (modified) (2 diffs)
- peerreviewplugin/0.10/setup.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
peerreviewplugin/0.10/codereview/peerReviewBrowser.py
r1243 r2270 225 225 add_link(req, 'alternate', plain_href, 'Plain Text', 226 226 'text/plain') 227 req.hdf['file'] = mimeview.preview_to_hdf(req, mime_type, charset,228 content,229 node.name, node.rev,230 annotations=['addFileNums'])231 227 232 228 raw_href = self.env.href.peerReviewBrowser(node.path, rev=rev and node.rev, 233 229 format='raw') 234 req.hdf['file.raw_href'] = util.escape(raw_href) 230 req.hdf['file'] = mimeview.preview_to_hdf(req, content, len(content), 231 mime_type, node.created_path, 232 raw_href, annotations=['addFileNums']) 233 235 234 add_link(req, 'alternate', raw_href, 'Original Format', mime_type) 236 235 peerreviewplugin/0.10/codereview/peerReviewPerform.py
r2266 r2270 171 171 172 172 #assign the preview to a variable for clearsilver 173 req.hdf['file'] = mimeview.preview_to_hdf(req, mime_type, charset, content, node.name, node.rev, annotations=['performCodeReview'])173 req.hdf['file'] = mimeview.preview_to_hdf(req, content, len(content), mime_type, node.created_path, None, annotations=['performCodeReview']) 174 174 175 175 add_stylesheet(req, 'common/css/code.css') peerreviewplugin/0.10/codereview/templates/peerReviewCommentCallback.cs
r717 r2270 6 6 <html> 7 7 <head> 8 <script type="text/javascript"> 9 <!-- 10 11 function showHideAttachFile() 12 { 13 var area = document.getElementById('FileUp'); 14 var area2 = document.getElementById('FileUpCompanion'); 15 if(area == null) 16 return; 17 18 if(area.style.display == "") 19 { 20 area.style.display = "none"; 21 area2.style.display = "none"; 22 23 area = document.getElementById('addCommentText'); 24 area.focus(); 25 } 26 else 27 { 28 area.style.display = "" 29 area2.style.display = ""; 30 } 31 32 top.resetAddCommentBoxSize(); 33 } 34 35 function submitComment(LineNum, fileID, parentID) 36 { 37 var textField = document.getElementById('addCommentText'); 38 39 if(textField == null) 40 return; 41 42 if(textField.value == "") 43 { 44 alert("Please fill in the comment field."); 45 return; 46 } 47 48 var fEle = document.getElementById('IDFile'); 49 var lEle = document.getElementById('LineNum'); 50 var tEle = document.getElementById('Text'); 51 var pEle = document.getElementById('IDParent'); 52 53 fEle.value = fileID; 54 lEle.value = LineNum; 55 tEle.value = textField.value; 56 pEle.value = parentID; 57 58 GLOBAL_line = LineNum; 59 GLOBAL_parent = parentID; 60 GLOBAL_file = fileID; 61 62 textField.value = ""; 63 64 var formEle = document.getElementById('HiddenCommentForm'); 65 formEle.submit(); 66 } 67 68 var GLOBAL_line = -1; 69 var GLOBAL_parent = -1; 70 var GLOBAL_file = -1; 71 72 //--> 73 </script> 8 <script type="text/javascript" src="<?cs 9 var:chrome.href ?>/hw/js/peerReviewCommentCallback.js"></script> 74 10 </head> 75 11 <body onload="top.timeToGetTree();" onunload="top.timeToHide(GLOBAL_line, GLOBAL_file, GLOBAL_parent);" style="background: #F7F7F7;" bottomMargin=0 topMargin=0 leftMargin=0 rightMargin=0> peerreviewplugin/0.10/codereview/templates/peerReviewNew.cs
r717 r2270 156 156 <script type="text/javascript"> 157 157 <!-- 158 159 158 var browserCallback = "<?cs var:trac.href.peerReviewBrowser ?>"; 160 var GLOBAL_lineStart = -1;161 var GLOBAL_lineEnd = -1;162 163 //Forces Internet Explorer to display a scrollbar164 function resetInnerDivSize()165 {166 var innerDiv = document.getElementById('preview');167 if(innerDiv != null)168 {169 innerDiv.style.height = "";170 if(innerDiv.clientHeight >= 400)171 {172 innerDiv.style.height = "400px";173 }174 else if(innerDiv.clientHeight > 0)175 {176 innerDiv.style.height = innerDiv.offsetHeight + "px";177 }178 }179 }180 181 //Colorizes the tables according to Trac standards182 function colorTable(txt){183 var table = document.getElementById(txt);184 var loop = 0;185 for (; loop < table.rows.length; loop++) {186 var row = table.rows[loop];187 if (loop % 2 == 0) {188 row.className = 'odd';189 } else {190 row.className = 'even';191 }192 }193 }194 195 // adds a row to the table with txt as the text in the row196 function addrow(txt)197 {198 var tbl = document.getElementById('myuserbody');199 var lastRow = tbl.rows.length;200 var row = tbl.insertRow(lastRow);201 202 // We will append the new username to the ReviewersSelected hidden input203 var users = document.getElementById('ReviewersSelected');204 //document.setElementByName('ReviewersSelected', users + "#" + txt);205 users.setAttribute('value', users.value + txt + "#");206 207 row.id = txt + 'id';208 var cellLeft = row.insertCell(0);209 cellLeft.setAttribute('value', txt);210 cellLeft.innerHTML = "<a href=\"javascript:removeuser('" + txt + "')\">" + txt + "</a>";211 row.appendChild(cellLeft);212 }213 214 // takes a user from the dropdown, adds them to the table, and deletes from the dropdown215 function adduser()216 {217 var dropdown = document.getElementById('Reviewers');218 var tbl = document.getElementById('myuserbody');219 220 if((tbl.rows.length == 1) && (tbl.rows[0].getAttribute("id") == "No Users"))221 checkEmpty(1, 'myuserbody');222 223 addrow(dropdown.options[dropdown.selectedIndex].text);224 dropdown.options[dropdown.selectedIndex] = null;225 226 if (dropdown.options.length == 0) {227 // No users left228 dropdown.options[0] = new Option('--All users exhausted--','-1');229 document.getElementById("adduserbutton").disabled = true;230 document.getElementById("adduserbutton").style.color = "";231 }232 233 colorTable('myuserbody');234 }235 236 // takes a user from the table, adds them to the dropbox, and deletes from the table237 function removeuser(txt) {238 var dropdown = document.getElementById('Reviewers');239 240 if (dropdown.options[0].value == '-1') {241 dropdown.options[0] = new Option(txt, '0');242 document.getElementById("adduserbutton").disabled = false;243 document.getElementById("adduserbutton").style.color = "#000000";244 } else {245 dropdown.options[dropdown.options.length] = new Option(txt, '0');246 }247 248 //remove the user from the post value249 var users = document.getElementById('ReviewersSelected');250 var tokens = users.value.split("#");251 var newusers = "";252 for (var i=0; i<tokens.length-1; i++) {253 if (tokens[i] == txt)254 continue;255 newusers += tokens[i] + "#";256 }257 258 users.setAttribute('value', newusers);259 260 // delete the row containing the txt from the table261 var table = document.getElementById('myuserbody');262 263 // remove row264 var loop = 0;265 for (loop = 0; loop < table.rows.length; loop++) {266 267 var row = table.rows[loop];268 var cell = row.cells[0];269 if (row.id == txt + 'id') {270 table.deleteRow(loop);271 loop--;272 break;273 }274 }275 276 colorTable('myuserbody');277 278 if (table.rows.length == 0)279 checkEmpty(0, 'myuserbody');280 }281 282 // Checks for an empty table to label it as such283 function checkEmpty(num, itemID) {284 var table = document.getElementById(itemID);285 286 switch (num) {287 case 0:288 //Table is now empty289 table.insertRow(0);290 table.rows[0].setAttribute('id', "No Users");291 table.rows[0].className = 'even';292 var cellLeft = table.rows[0].insertCell(0);293 cellLeft.innerHTML = "No users have been added to the code review.";294 table.rows[0].appendChild(cellLeft);295 break;296 case 1:297 //Need to add things to the table, get rid of No Users row298 table.deleteRow(0);299 break;300 default :301 alert("Error in CheckEmpty function");302 }303 }304 305 function validateInput(form) {306 if (form.Name.value == "") {307 alert("You must specify a code review name.");308 return false;309 }310 311 if (form.FilesSelected.value == "") {312 alert("You must select at least one file.");313 return false;314 }315 316 if (form.ReviewersSelected.value == "") {317 alert("You must select at least one user.");318 return false;319 }320 321 return true;322 }323 324 //Define XML object in terms of IE or Gecko engine325 function createXMLObject(){326 var xmlObj = null;327 if(window.XMLHttpRequest){328 xmlObj = new XMLHttpRequest();329 } else if(window.ActiveXObject){330 xmlObj = new ActiveXObject("Microsoft.XMLHTTP");331 }332 333 return xmlObj;334 }335 336 //Prepares place for browser in HTML337 function placeBrowser(contents)338 {339 var place = document.getElementById('browserArea');340 place.innerHTML = contents;341 processBrowser(place);342 resetInnerDivSize();343 GLOBAL_lineStart = -1;344 GLOBAL_lineEnd = -1;345 }346 347 348 //Controls the file browser's click-throughs to ensure the file browser does not close349 function processBrowser(parent)350 {351 for(var i=0; i< parent.childNodes.length; i++)352 {353 processBrowser(parent.childNodes[i]);354 }355 356 if(parent.tagName == "A")357 {358 if(parent.href.indexOf("peerReviewBrowser") >= 0)359 {360 parent.href = "javascript:getBrowser('" + parent.href + "')";361 }362 }363 }364 365 //Changes the revision displayed in the file browser366 function switchRev(e)367 {368 if(e.keyCode == 13 || e.keyCode == 3)369 {370 getBrowser(browserCallback + '?rev=' + document.getElementById('rev').value);371 if(e.stopPropagation)372 e.stopPropagation();373 e.cancelBubble = true;374 if(e.preventDefault)375 e.preventDefault();376 event.returnValue = false;377 event.cancel = true;378 }379 }380 381 //Performs the callback to the server with the clicked links in the browser382 function getBrowser(url){383 var place = document.getElementById('browserArea');384 place.innerHTML = "Loading....";385 resetInnerDivSize()386 387 var xmlObj = createXMLObject();388 if(xmlObj != null){389 xmlObj.onreadystatechange = function(){390 if(xmlObj.readyState == 4){391 placeBrowser(xmlObj.responseText);392 }393 }394 xmlObj.open ('GET', url, true);395 xmlObj.send ('');396 }397 lastPick = null;398 }399 400 function lineEnter(e)401 {402 if(e.keyCode == 13 || e.keyCode == 3)403 {404 addButtonEnable();405 if(e.stopPropagation)406 e.stopPropagation();407 if(e.preventDefault)408 e.preventDefault();409 e.cancelBubble = true;410 event.returnValue = false;411 event.cancel = true;412 }413 }414 415 // Sets the line number ranges in the file browser416 function setLineNum(num)417 {418 var box1 = document.getElementById('lineBox1');419 var box2 = document.getElementById('lineBox2');420 if(box1 == null || box2 == null)421 return;422 if(lastPick == null)423 {424 box1.value = num;425 }426 else if(lastPick >= num)427 {428 box1.value = num;429 box2.value = lastPick;430 }431 else if(lastPick < num)432 {433 box1.value = lastPick;434 box2.value = num;435 }436 lastPick = num;437 addButtonEnable();438 }439 440 //Add a file to the file structure in the database441 function addFile(filepath)442 {443 var tbl = document.getElementById('myfilebody');444 445 if ((tbl.rows.length == 1) && (tbl.rows[0].getAttribute("id") == "nofile")) {446 tbl.deleteRow(0);447 }448 449 var lastRow = tbl.rows.length;450 451 var box1 = document.getElementById('lineBox1');452 var box2 = document.getElementById('lineBox2');453 var revBox = document.getElementById('fileRevVal');454 455 var saveLine = filepath + "," + revBox.value + "," + box1.value + "," + box2.value;456 457 if(document.getElementById(saveLine + 'id') != null) {458 alert("Specified combination of filename, revision, and line numbers is already included in the file list.");459 return;460 }461 462 var row = tbl.insertRow(lastRow);463 464 var files = document.getElementById('FilesSelected');465 files.setAttribute('value', files.value + saveLine + "#");466 467 //Create the entry in the actual table in the page468 469 row.id = saveLine + 'id';470 var cellLeft = row.insertCell(0);471 cellLeft.innerHTML = "<a href=\"javascript:removefile('" + saveLine + "')\">" + filepath + "</a>";472 cellLeft.setAttribute('value', saveLine);473 row.appendChild(cellLeft);474 cellLeft = row.insertCell(1);475 cellLeft.innerHTML = box1.value;476 row.appendChild(cellLeft);477 cellLeft = row.insertCell(2);478 cellLeft.innerHTML = box2.value;479 row.appendChild(cellLeft);480 cellLeft = row.insertCell(3);481 cellLeft.innerHTML = revBox.value;482 row.appendChild(cellLeft);483 484 colorTable('myfilebody');485 }486 487 //Remove the file from the struct488 489 function removefile(txt) {490 //remove the file from the post value491 var files = document.getElementById('FilesSelected');492 var tokens = files.value.split("#");493 var newfiles = "";494 for (var i=0; i<tokens.length-1; i++) {495 if (tokens[i] == txt)496 continue;497 newfiles += tokens[i] + "#";498 }499 500 files.setAttribute('value', newfiles);501 502 // delete the row containing the txt from the table503 var filetable = document.getElementById('myfilelist');504 505 var loop = 0;506 for (loop = 0; loop < filetable.rows.length; loop++) {507 var row = filetable.rows[loop];508 var cell = row.cells[0];509 if (row.id == txt + 'id') {510 filetable.deleteRow(loop);511 loop--;512 break;513 }514 }515 516 colorTable('myfilebody');517 518 //Remove the entry from the table in the HTML519 520 var tbl = document.getElementById('myfilebody');521 if (tbl.rows.length == 0){522 tbl.insertRow(0);523 tbl.rows[0].setAttribute('id', "nofile");524 var cellLeft = tbl.rows[0].insertCell(0);525 cellLeft.innerHTML = "No files have been added to the code review.";526 tbl.rows[0].appendChild(cellLeft);527 cellLeft = tbl.rows[0].insertCell(1);528 cellLeft.innerHTML ="";529 tbl.rows[0].appendChild(cellLeft);530 cellLeft = tbl.rows[0].insertCell(2);531 cellLeft.innerHTML ="";532 tbl.rows[0].appendChild(cellLeft);533 cellLeft = tbl.rows[0].insertCell(3);534 cellLeft.innerHTML ="";535 tbl.rows[0].appendChild(cellLeft);536 }537 }538 539 //Enable the Add File button when a correct file, revision, and line number range is chosen540 541 function addButtonEnable()542 {543 var i = 1;544 var temp = null;545 var box1 = document.getElementById('lineBox1');546 var box2 = document.getElementById('lineBox2');547 var addButton = document.getElementById('addFileButton');548 549 if(box1 == null || box2 == null || addButton == null)550 return;551 552 addButton.disabled = true;553 addButton.style.color = "";554 555 if(GLOBAL_lineStart != -1 && GLOBAL_lineEnd != -1)556 {557 for(i = GLOBAL_lineStart; i<= GLOBAL_lineEnd; i++)558 {559 temp = document.getElementById('L' + i);560 if(temp != null)561 temp.innerHTML = "<a href=\"javascript:setLineNum(" + i + ")\">" + i + "</a>";562 }563 }564 565 GLOBAL_lineStart = -1;566 GLOBAL_lineEnd = -1;567 568 if(box1.value == "" || box2.value == "" || isNaN(box1.value) || isNaN(box2.value))569 return;570 571 var start = parseInt(box1.value);572 var end = parseInt(box2.value);573 if(start < 1)574 start = 1;575 if(end < 1)576 end = 1;577 if(start > end)578 {579 i = start;580 start = end;581 end = i;582 }583 584 if(document.getElementById('L' + start) == null)585 return;586 587 for(i=start; i<=end; i++)588 {589 temp = document.getElementById('L' + i);590 if(temp != null)591 {592 temp.innerHTML = "<a href=\"javascript:setLineNum(" + i + ")\"><font color=red><b>" + i + "</b></font></a>"593 }594 else595 {596 end = i-1;597 }598 }599 600 GLOBAL_lineStart = start;601 GLOBAL_lineEnd = end;602 603 box1.value = start;604 box2.value = end;605 606 addButton.disabled = false;607 addButton.style.color = "#000000";608 }609 610 getBrowser(browserCallback);611 612 159 //--> 613 160 </script> 161 <script type="text/javascript" src="<?cs 162 var:chrome.href ?>/hw/js/peerReviewNew.js"></script> 614 163 615 164 <?cs include "footer.cs" ?> peerreviewplugin/0.10/codereview/templates/peerReviewPerform.cs
r717 r2270 129 129 <script type="text/javascript"> 130 130 <!-- 131 132 var GLOBAL_fileID = -1;133 var GLOBAL_lineNum = -1;134 var GLOBAL_parentID = -1;135 var GLOBAL_gettingComment = false;136 var GLOBAL_yPosAdd = 0;137 var GLOBAL_yPosView = 0;138 139 function DOMWindowGetInnerWidth() {140 if (self.innerWidth)141 return self.innerWidth;142 else if(document.documentElement && document.documentElement.clientWidth)143 return document.documentElement.clientWidth;144 else if(document.body)145 return document.body.clientWidth;146 }147 148 function DOMWindowGetInnerHeight() {149 if (self.innerHeight)150 return self.innerHeight;151 else if(document.documentElement && document.documentElement.clientHeight)152 return document.documentElement.clientHeight;153 else if(document.body)154 return document.body.clientHeight;155 }156 157 function DOMWindowGetYOffset() {158 if (self.pageYOffset)159 return self.pageYOffset;160 else if (document.documentElement && document.documentElement.scrollTop)161 return document.documentElement.scrollTop;162 else if (document.body)163 return document.body.scrollTop;164 }165 166 function hideLines()167 {168 var i = 1;169 var row = null;170 while((row = document.getElementById('L' + i)) != null)171 {172 if((i >= (lineStart - lineRange)) && (i <= (lineEnd + lineRange)))173 {174 (row.parentNode).style.display = '';175 }176 else177 {178 (row.parentNode).style.display = 'none';179 }180 i++;181 }182 }183 184 function init()185 {186 var area = document.getElementById('ViewCommentArea');187 area.style.left = ((DOMWindowGetInnerWidth() / 2) - 225) + "px";188 GLOBAL_yPosView = ((DOMWindowGetInnerHeight() /2) - 100);189 area.style.top = GLOBAL_yPosView + "px";190 area = document.getElementById('AddCommentArea');191 area.style.left = ((DOMWindowGetInnerWidth() / 2) - 150) + "px";192 GLOBAL_yPosAdd = ((DOMWindowGetInnerHeight() /2) - 150);193 area.style.top = GLOBAL_yPosAdd + "px";194 }195 196 function resetLines()197 {198 var textBox = document.getElementById('SelectRangeTextBox');199 var range = parseInt(textBox.value);200 if(isNaN(range))201 {202 textBox.value = lineRange;203 return;204 }205 if(range < 0)206 {207 range = 0;208 }209 lineRange = range;210 hideLines();211 textBox.value = lineRange;212 return;213 }214 215 function createXMLObject(){216 var xmlObj = null;217 if(window.XMLHttpRequest){218 xmlObj = new XMLHttpRequest();219 } else if(window.ActiveXObject){220 xmlObj = new ActiveXObject("Microsoft.XMLHTTP");221 }222 return xmlObj;223 }224 225 function commentCallback(url){226 var xmlObj = createXMLObject();227 if(xmlObj != null){228 xmlObj.onreadystatechange = function(){229 if(xmlObj.readyState == 4){230 placeComment(xmlObj.responseText);231 }232 }233 xmlObj.open ('GET', url, true);234 xmlObj.send ('');235 }236 lastPick = null;237 }238 239 function placeComment(html)240 {241 var area = document.getElementById('innerCommentDiv');242 area.innerHTML = html;243 244 resetInnerDivSize();245 }246 247 function resetInnerDivSize()248 {249 var innerDiv = document.getElementById('innerCommentDiv');250 innerDiv.style.height = "";251 252 if(innerDiv.clientHeight >= 400)253 {254 innerDiv.style.height = 400;255 }256 else257 {258 innerDiv.style.height = (innerDiv.clientHeight + 5) + "px";259 }260 261 innerDiv = document.getElementById('ViewCommentArea');262 innerDiv.style.height = "";263 innerDiv.style.height = (innerDiv.clientHeight + 5) + "px";264 }265 266 function collapseComments(parentID)267 {268 var area = document.getElementById('innerCommentDiv');269 for(var i =0; i<area.childNodes.length; i++)270 {271 if(area.childNodes[i].id != null)272 {273 var ids = area.childNodes[i].id.split(':');274 if(ids.length == 2 && ids[0] == parentID)275 {276 area.childNodes[i].style.display = "none";277 collapseComments(ids[1]);278 }279 }280 }281 282 var imgCell = document.getElementById(parentID + 'TreeButton');283 if(imgCell.innerHTML != "")284 imgCell.innerHTML = "<img src=\"" + plusUrl + "\" onclick=\"expandComments('" + parentID + "')\">";285 286 resetInnerDivSize();287 }288 289 function expandComments(parentID)290 {291 var area = document.getElementById('innerCommentDiv');292 for(var i =0; i<area.childNodes.length; i++)293 {294 if(area.childNodes[i].id != null)295 {296 var ids = area.childNodes[i].id.split(':');297 if(ids.length == 2 && ids[0] == parentID)298 {299 area.childNodes[i].style.display = "";300 }301 }302 }303 304 var imgCell = document.getElementById(parentID + 'TreeButton');305 if(imgCell.innerHTML != "")306 imgCell.innerHTML = "<img src=\"" + minusUrl + "\" onclick=\"collapseComments('" + parentID + "')\">";307 308 resetInnerDivSize();309 }310 311 function getComments(LineNum, fileID)312 {313 getCommentsFull(LineNum, fileID, false);314 }315 316 function getCommentsFull(LineNum, fileID, wait)317 {318 var area = document.getElementById('innerCommentDiv');319 area.innerHTML = "Loading...";320 area = document.getElementById('ViewCommentArea');321 area.style.display = "";322 var offset = DOMWindowGetYOffset();323 if(GLOBAL_yPosView < 0)324 GLOBAL_yPosView = 0;325 area.style.top = (offset + GLOBAL_yPosView) + "px";326 resetInnerDivSize();327 328 area = document.getElementById('ViewCommentTitle');329 area.innerHTML = "<table cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse;\" width=\"100%\"><tr><td align=\"left\">Comments On Line " + LineNum + "</td><td align=\"right\" valign=\"middle\"><a href=\"javascript:getComments(" + LineNum + "," + fileID + ")\"><font size=\"1\">Refresh</font></a> </td></tr></table>";330 331 area = document.getElementById('ViewAddCommentButtonArea');332 area.innerHTML = "<input type=button value=\"Add New Comment\" style=\"font-size: 10;\" onclick=\"addComment('" + LineNum + "', '" + fileID + "', '-1');\"> ";333 334 if(!wait)335 getCommentsPart2(LineNum, fileID);336 337 }338 339 function getCommentsPart2(LineNum, fileID)340 {341 commentCallback(baseUrl + '?actionType=getCommentTree&IDFile=' + fileID + '&LineNum=' + LineNum);342 }343 344 function addComment(LineNum, fileID, parentID)345 {346 var area = document.getElementById('AddCommentArea');347 var titlePlace = document.getElementById('AddCommentTitleArea');348 if(parentID < 0)349 {350 titlePlace.innerHTML = "Add Comment For Line " + LineNum;351 }352 else353 {354 titlePlace.innerHTML = "Reply To Comment On Line " + LineNum;355 }356 357 GLOBAL_fileID = fileID;358 GLOBAL_parentID = parentID;359 GLOBAL_LineNum = LineNum;360 361 var offset = DOMWindowGetYOffset();362 if(GLOBAL_yPosAdd < 0)363 GLOBAL_yPosAdd = 0;364 area.style.top = (offset + GLOBAL_yPosAdd) + "px";365 366 area.style.display = "";367 area.style.zIndex = ++dragObj.zIndex;368 369 if(window.frames['internalAddComment'])370 {371 var iDoc = window.frames['internalAddComment'].document;372 var button = iDoc.getElementById('AddCommentButtonArea');373 if(button != null)374 {375 button.innerHTML = "<input style=\"font-size: 10;\" type=button onclick=\"submitComment(" + LineNum + ", " + fileID + ", " + parentID + ")\" value=\"Add Comment\"> ";376 GLOBAL_fileID = -1;377 GLOBAL_LineNum = -1;378 window.setTimeout('resetAddCommentBoxSize()', 5);379 }380 }381 }382 383 function resetAddCommentBoxSize()384 {385 if(window.frames['internalAddComment'])386 {387 var iDoc = window.frames['internalAddComment'].document;388 var acT = iDoc.getElementById('addCommentTable');389 var iFr = document.getElementById('internalAddComment');390 iFr.style.height = "";391 iFr.style.height = (acT.clientHeight + 15) + "px";392 }393 394 innerDiv = document.getElementById('AddCommentArea');395 innerDiv.style.height = "";396 innerDiv.style.height = (innerDiv.clientHeight + 3) + "px";397 }398 399 function submitComment(LineNum, fileID, parentID)400 {401 var area = document.getElementById('L' + LineNum);402 area.innerHTML = "<a href=\"javascript:getComments(" + LineNum + ", " + fileID + ")\"><img src=\"" + tacUrl + "\"> " + LineNum + "</a>";403 404 GLOBAL_fileID = fileID;405 GLOBAL_LineNum = LineNum;406 GLOBAL_gettingComment = true;407 408 getCommentsFull(LineNum, fileID, true);409 }410 411 function timeToHide(line, fileID, parentID)412 {413 area = document.getElementById('AddCommentArea');414 area.style.top = "-10000px"415 416 if(line != -1)417 submitComment(line, fileID, parentID);418 }419 420 function timeToGetTree()421 {422 area = document.getElementById('AddCommentArea');423 424 if(GLOBAL_fileID != -1 && GLOBAL_LineNum != -1 && GLOBAL_gettingComment)425 {426 area.style.display = "none";427 window.setTimeout('getCommentsPart2('+GLOBAL_LineNum+', '+GLOBAL_fileID+')', 5);428 GLOBAL_fileID = -1;429 GLOBAL_LineNum = -1;430 GLOBAL_gettingComment = false;431 }432 else if(GLOBAL_fileID != -1 && GLOBAL_LineNum != -1)433 {434 var iDoc = window.frames['internalAddComment'].document;435 var button = iDoc.getElementById('AddCommentButtonArea');436 button.innerHTML = "<input style=\"font-size: 10;\" type=button onclick=\"submitComment(" + GLOBAL_LineNum + ", " + GLOBAL_fileID + ", " + GLOBAL_parentID + ")\" value=\"Add Comment\"> ";437 GLOBAL_fileID = -1;438 GLOBAL_LineNum = -1;439 resetAddCommentBoxSize();440 }441 else442 {443 area.style.display = "none";444 }445 }446 447 function closeCommentWindow(area)448 {449 var area = document.getElementById(area);450 area.style.display = "none";451 }452 453 function Browser() {454 455 var ua, s, i;456 457 this.isIE = false;458 this.isNS = false;459 this.version = null;460 461 ua = navigator.userAgent;462 463 s = "MSIE";464 if ((i = ua.indexOf(s)) >= 0) {465 this.isIE = true;466 this.version = parseFloat(ua.substr(i + s.length));467 return;468 }469 470 s = "Netscape6/";471 if ((i = ua.indexOf(s)) >= 0) {472 this.isNS = true;473 this.version = parseFloat(ua.substr(i + s.length));474 return;475 }476 477 // Treat any other "Gecko" browser as NS 6.1.478 479 s = "Gecko";480 if ((i = ua.indexOf(s)) >= 0) {481 this.isNS = true;482 this.version = 6.1;483 return;484 }485 }486 487 function dragStart(event, id)488 {489 490 var el;491 var x, y;492 493 // If an element id was given, find it. Otherwise use the element being494 // clicked on.495 496 if (id)497 {498 dragObj.elNode = document.getElementById(id);499 }500 else501 {502 if (browser.isIE)503 dragObj.elNode = window.event.srcElement;504 if (browser.isNS)505 dragObj.elNode = event.target;506 507 // If this is a text node, use its parent element.508 509 if (dragObj.elNode.nodeType == 3)510 dragObj.elNode = dragObj.elNode.parentNode;511 }512 513 if (browser.isIE) {514 x = window.event.clientX + document.documentElement.scrollLeft515 + document.body.scrollLeft;516 y = window.event.clientY + document.documentElement.scrollTop517 + document.body.scrollTop;518 }519 if (browser.isNS) {520 x = event.clientX + window.scrollX;521 y = event.clientY + window.scrollY;522 }523 524 dragObj.cursorStartX = x;525 dragObj.cursorStartY = y;526 dragObj.elStartLeft = parseInt(dragObj.elNode.style.left, 10);527 dragObj.elStartTop = parseInt(dragObj.elNode.style.top, 10);528 529 if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;530 if (isNaN(dragObj.elStartTop)) dragObj.elStartTop = 0;531 if(id != 'ViewCommentArea')532 {533 dragObj.elNode.style.zIndex = ++dragObj.zIndex;534 }535 536 if (browser.isIE) {537 document.attachEvent("onmousemove", dragGo);538 document.attachEvent("onmouseup", dragStop);539 window.event.cancelBubble = true;540 window.event.returnValue = false;541 }542 if (browser.isNS) {543 document.addEventListener("mousemove", dragGo, true);544 document.addEventListener("mouseup", dragStop, true);545 event.preventDefault();&nbs
