[Vtigercrm-commits] [vtiger-commits] r10722 - in /vtigercrm/branches/5.0.3: include/js/dtlviewajax.js modules/Faq/DetailViewAjax.php modules/Faq/Faq.php modules/HelpDesk/DetailViewAjax.php modules/HelpDesk/HelpDesk.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Wed Apr 18 11:59:47 EDT 2007


Author: richie
Date: Wed Apr 18 09:59:35 2007
New Revision: 10722

Log:
* Modified to reload the comments when we use ajax edit in comments field, Fixed #2263

Modified:
    vtigercrm/branches/5.0.3/include/js/dtlviewajax.js
    vtigercrm/branches/5.0.3/modules/Faq/DetailViewAjax.php
    vtigercrm/branches/5.0.3/modules/Faq/Faq.php
    vtigercrm/branches/5.0.3/modules/HelpDesk/DetailViewAjax.php
    vtigercrm/branches/5.0.3/modules/HelpDesk/HelpDesk.php

Modified: vtigercrm/branches/5.0.3/include/js/dtlviewajax.js
==============================================================================
--- vtigercrm/branches/5.0.3/include/js/dtlviewajax.js (original)
+++ vtigercrm/branches/5.0.3/include/js/dtlviewajax.js Wed Apr 18 09:59:35 2007
@@ -217,9 +217,17 @@
                   					alert(alert_arr.ERROR_WHILE_EDITING);
                   				}
                   				else if(response.responseText.indexOf(":#:SUCCESS")>-1)
-                       		{
+						{
+							//For HD & FAQ - comments, we should empty the field value
+							if((module == "HelpDesk" || module == "Faq") && fieldName == "comments")
+							{
+								getObj(dtlView).innerHTML = "";
+								getObj("comments").value = "";
+								getObj("comments_div").innerHTML = response.responseText.replace(":#:SUCCESS","");
+							}
+
                   					$("vtbusy_info").style.display="none";
-                       		}
+						}
                         }
                 }
             );

Modified: vtigercrm/branches/5.0.3/modules/Faq/DetailViewAjax.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Faq/DetailViewAjax.php (original)
+++ vtigercrm/branches/5.0.3/modules/Faq/DetailViewAjax.php Wed Apr 18 09:59:35 2007
@@ -38,7 +38,13 @@
 		$modObj->save("Faq");
 		if($modObj->id != "")
 		{
-			echo ":#:SUCCESS";
+			if($fieldname == "comments")
+			{
+				$comments = $modObj->getFAQComments($modObj->id);
+				echo ":#:SUCCESS".$comments;
+			}
+			else
+				echo ":#:SUCCESS";
 		}else
 		{
 			echo ":#:FAILURE";

Modified: vtigercrm/branches/5.0.3/modules/Faq/Faq.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Faq/Faq.php (original)
+++ vtigercrm/branches/5.0.3/modules/Faq/Faq.php Wed Apr 18 09:59:35 2007
@@ -133,13 +133,13 @@
 		$result = $this->db->query($sql);
 		$noofrows = $this->db->num_rows($result);
 
-		if($noofrows == 0)
+		//In ajax save we should not add this div
+		if($_REQUEST['action'] != 'FaqAjax')
 		{
-			$log->debug("Exiting getFAQComments method ...");
-			return '';
+			$list .= '<div id="comments_div" style="overflow: auto;height:200px;width:100%;">';
+			$enddiv = '</div>';
 		}
 
-		$list .= '<div style="overflow: auto;height:200px;width:100%;">';
 		for($i=0;$i<$noofrows;$i++)
 		{
 			$comment = $this->db->query_result($result,$i,'comments');
@@ -154,7 +154,9 @@
 				$list .= ' : '.$createdtime.'</font></div>';
 			}
 		}
-		$list .= '</div>';
+
+		$list .= $enddiv;
+		
 		$log->debug("Exiting getFAQComments method ...");
 		return $list;
 	}

Modified: vtigercrm/branches/5.0.3/modules/HelpDesk/DetailViewAjax.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/HelpDesk/DetailViewAjax.php (original)
+++ vtigercrm/branches/5.0.3/modules/HelpDesk/DetailViewAjax.php Wed Apr 18 09:59:35 2007
@@ -114,7 +114,13 @@
 		
 		if($modObj->id != "")
 		{
-			echo ":#:SUCCESS";
+			if($fieldname == "comments")
+			{
+				$comments = $modObj->getCommentInformation($modObj->id);
+				echo ":#:SUCCESS".$comments;
+			}
+			else
+				echo ":#:SUCCESS";
 		}else
 		{
 			echo ":#:FAILURE";

Modified: vtigercrm/branches/5.0.3/modules/HelpDesk/HelpDesk.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/HelpDesk/HelpDesk.php (original)
+++ vtigercrm/branches/5.0.3/modules/HelpDesk/HelpDesk.php Wed Apr 18 09:59:35 2007
@@ -475,13 +475,13 @@
 		$result = $adb->query($sql);
 		$noofrows = $adb->num_rows($result);
 
-		if($noofrows == 0)
-		{
-			$log->debug("Exiting getCommentInformation method ...");
-			return '';
-		}
-
-		$list .= '<div style="overflow: auto;height:200px;width:100%;">';
+		//In ajax save we should not add this div
+		if($_REQUEST['action'] != 'HelpDeskAjax')
+		{
+			$list .= '<div id="comments_div" style="overflow: auto;height:200px;width:100%;">';
+			$enddiv = '</div>';
+		}
+
 		for($i=0;$i<$noofrows;$i++)
 		{
 			if($adb->query_result($result,$i,'comments') != '')
@@ -506,7 +506,8 @@
 				$list .= '</font></div>';
 			}
 		}
-		$list .= '</div>';
+		
+		$list .= $enddiv;
 
 		$log->debug("Exiting getCommentInformation method ...");
 		return $list;





More information about the vtigercrm-commits mailing list