|
From: Jon O. <jon...@us...> - 2007-07-12 22:44:51
|
Update of /cvsroot/mxbb/mx_bugsbt/bugsbt/includes/js In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28218 Modified Files: management.js.php Log Message: O yea, finally commenting is activated Also, a bunch of general updates/fixes Index: management.js.php =================================================================== RCS file: /cvsroot/mxbb/mx_bugsbt/bugsbt/includes/js/management.js.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** management.js.php 28 Apr 2007 19:45:17 -0000 1.2 --- management.js.php 12 Jul 2007 22:44:47 -0000 1.3 *************** *** 146,149 **** --- 146,201 ---- } + function editComment(bug_id, cid) { + + if ( !bug_id && (typeof current_bug_id == "undefined") ) { + alert("You have to select a Bug to perform this action."); + return; + } + + bug_id = (bug_id > 0) ? bug_id : current_bug_id; + current_bug_id = bug_id; + + checkContentSaved(); + + AjaxRequest.get( + { + 'url':'modules/mx_bugsbt/bugsbt/modules/tabs/bugsbt__tab-index.php' + ,'parameters':{ 'cid': cid, 'item_id': bug_id, 'mode':'post_comment', 'cat_id':escape(treeGetId().substr(treeGetId().lastIndexOf("/")+1)), 'block_id':mxBlock.block_id, 'page_id':mxBlock.page_id } + ,'onLoading':function() { clearTabs(); tabsLoadingOn(); } + ,'onComplete':function() { tabsLoadingOff(); } + ,'onSuccess':function(req){ el('tabs-data-comment-'+cid).innerHTML = req.responseText; updateTabs('tab_edit'); dhtmlHistory.add( treeGetId(), el(tree.active+"-text").innerHTML );} + ,'onError':function(req){ el('tabs-data-comment-'+cid).innerHTML = 'Error!\nStatusText='+req.statusText+'\nContents='+req.responseText;} + ,'timeout':5000 + ,'onTimeout':function(){ clearTabs(); tabsLoadingOff(); el('tabs-data-comment-'+cid).innerHTML = 'Timed out. Try again!'; } + } + ); + } + + function commentBug(bug_id) { + + if ( !bug_id && (typeof current_bug_id == "undefined") ) { + alert("You have to select a Bug to perform this action."); + return; + } + + bug_id = (bug_id > 0) ? bug_id : current_bug_id; + current_bug_id = bug_id; + + checkContentSaved(); + + AjaxRequest.get( + { + 'url':'modules/mx_bugsbt/bugsbt/modules/tabs/bugsbt__tab-index.php' + ,'parameters':{ 'item_id': bug_id, 'mode':'post_comment', 'cat_id':escape(treeGetId().substr(treeGetId().lastIndexOf("/")+1)), 'block_id':mxBlock.block_id, 'page_id':mxBlock.page_id } + ,'onLoading':function() { tabsLoadingOn(); } + ,'onComplete':function() { tabsLoadingOff(); } + ,'onSuccess':function(req){ el('tabs-data-comment').innerHTML = req.responseText;} + ,'onError':function(req){ el('tabs-data-comment').innerHTML = 'Error!\nStatusText='+req.statusText+'\nContents='+req.responseText;} + ,'timeout':5000 + ,'onTimeout':function(){ tabsLoadingOff(); el('tabs-data-comment').innerHTML = 'Timed out. Try again!'; } + } + ); + } + function viewBug(bug_id) { *************** *** 236,239 **** --- 288,334 ---- } + function saveComment(theform) { + + if (!checkCommentForm(theform)) + { + return; + } + + var return_data = ''; + var status = AjaxRequest.submit( + theform + ,{ + 'onLoading':function() { clearTabs(); el('tabs-data-comment').innerHTML = ''; tabsSavingOn(); el('submit').disabled = true; } + ,'onComplete':function() { tabsSavingOff(); el('submit').disabled = false; } + ,'onSuccess':function(req){ return_data = stripBodyHtml(req.responseText); } + ,'onError':function(req){ el('tabs-data-comment').innerHTML = 'Error!\nStatusText='+req.statusText+'\nContents='+req.responseText;} + ,'timeout':5000 + ,'onTimeout':function(){ tabsSavingOff(); el('tabs-data-comment').innerHTML = 'Timed out. Try again!'; } + } + ); + + //el('body-tmp').value = el('body').value; + + if ((typeof status == "boolean" && !status) || typeof status == "string") { + alert("Unknown error, cannot save document."); + } + else { + el('saved').innerHTML = "Saved successfuly on "+(new Date()+"<br>(this message will disappear in 1 second)"); + + if (return_data != "") + { + el('saved').innerHTML = return_data; + return; + } + + product_update = true; + + if (savedTimerID) clearTimeout(savedTimerID); + savedTimerID = setTimeout(function(){ clearTabs(); viewBug(); updateTabs('tab_bugs');}, 1000); + } + + return status; + } + function deleteBug(do_delete) { if ( typeof current_bug_id == "undefined" ) { *************** *** 274,278 **** if (savedTimerID) clearTimeout(savedTimerID); ! savedTimerID = setTimeout(function(){ clearTabs(); viewBugs(); updateTabs('tab_bugs');}, 1000); } --- 369,414 ---- if (savedTimerID) clearTimeout(savedTimerID); ! savedTimerID = setTimeout(function(){ clearTabs(); viewBugs(); updateTabs('tab_bugs');}, 500); ! } ! ! function deleteComment(cid) { ! if ( typeof current_bug_id == "undefined" ) { ! alert("You have to select a Bug to perform this action."); ! return; ! } ! ! bug_id = current_bug_id; ! current_bug_id = bug_id; ! ! if (!confirm("Really Delete this Comment?")) { ! return; ! } ! ! var return_data = ''; ! AjaxRequest.get( ! { ! 'url':'modules/mx_bugsbt/bugsbt/modules/tabs/bugsbt__tab-index.php' ! ,'parameters':{ 'cid': cid, 'item_id': bug_id, 'mode':'post_comment', 'delete':'do','cat_id':escape(treeGetId().substr(treeGetId().lastIndexOf("/")+1)), 'block_id':mxBlock.block_id, 'page_id':mxBlock.page_id } ! ,'onLoading':function() { tabsLoadingOn(); } ! ,'onComplete':function() { tabsLoadingOff(); } ! ,'onSuccess':function(req){ return_data = stripBodyHtml(req.responseText);} ! ,'onError':function(req){ el('tabs-data').innerHTML = 'Error!\nStatusText='+req.statusText+'\nContents='+req.responseText;} ! ,'timeout':5000 ! ,'onTimeout':function(){ clearTabs(); tabsLoadingOff(); el('tabs-data').innerHTML = 'Timed out. Try again!'; } ! } ! ); ! ! el('tabs-data-comment-'+cid).innerHTML = "Deleted successfuly on "+(new Date()+"<br>(this message will disappear in 1 second)"); ! ! if (return_data != "") ! { ! el('saved').innerHTML = return_data; ! return; ! } ! ! //product_update = true; ! ! if (savedTimerID) clearTimeout(savedTimerID); ! savedTimerID = setTimeout(function(){ clearTabs(); viewBug(); updateTabs('tab_bugs');}, 500); } |