[Vtigercrm-commits] [vtiger-commits] r3895 - in /vtigercrm/trunk: Smarty/templates/ListView.tpl include/js/general.js include/utils/SearchUtils.php modules/Leads/ListView.php themes/blue/style.css

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Thu Feb 23 05:48:37 EST 2006


Author: saraj
Date: Thu Feb 23 03:48:26 2006
New Revision: 3895

Log:
Dyanamic search fields for advance search added

Modified:
    vtigercrm/trunk/Smarty/templates/ListView.tpl
    vtigercrm/trunk/include/js/general.js
    vtigercrm/trunk/include/utils/SearchUtils.php
    vtigercrm/trunk/modules/Leads/ListView.php
    vtigercrm/trunk/themes/blue/style.css

Modified: vtigercrm/trunk/Smarty/templates/ListView.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/ListView.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/ListView.tpl Thu Feb 23 03:48:26 2006
@@ -187,35 +187,42 @@
                                         <div align=center>
                                         <div class="advSearch" align=left>
 
-                                                        <table border=0 cellspacing=0 cellpadding=0 width=100%>
-                                                        <tr >
-                                                                <td colspan=4 class="detailedViewHeader"><b>General Details </b></td>
-							 </tr>
-                                                        <tr style="height:25px">
-
-                                                                <td width=20%  align=right>Account name</td>
-                                                                <td width=30% align=left class="dvtCellInfo"><input type="text" value="" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'"></td>
-                                                                <td width=20% align=right>Phone</td>
-                                                                <td width=30% align=left class="dvtCellInfo"><input type="text" value="" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'"></td>
-                                                        </tr>
-                                                        <tr style="height:25px">
-                                                                <td align=right>Website URL</td>
-
-                                                                <td align=left class="dvtCellInfo"><input type="text" value="" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'"></td>
-                                                                <td align=right>Fax</td>
-                                                                <td align=left class="dvtCellInfo"><input type="text" value="" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'"></td>
-                                                        </tr>
-                                                        <tr style="height:25px">
-                                                                <td align=right>Ticket Symbol</td>
-                                                                <td align=left class="dvtCellInfo"><input type="text" value="" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'"></td>
-                                                                <td align=right>Other Phone</td>
-
-                                                                <td align=left class="dvtCellInfo"><input type="text" value="" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'"></td>
-                                                        </tr>
-							
-                                                        </table>
-
-                                                        </div>
+					<table class="searchHd rBox" border="0" cellpadding="2" cellspacing="0" width="100%">
+					<tr>
+					<td nowrap class="small"><input name="radiobutton" type="radio" value="">&nbsp;Match All of the Following</td>
+					<td class="small"><input name="radiobutton" type="radio" value="radiobutton">&nbsp;Match Any of the Following</td>
+
+					<td>&nbsp;</td>
+					</tr>
+					<tr>
+					<td colspan="3" bgcolor="#FFFFFF" style="border:1px solid #CCCCCC;">
+					<div id="fixed" style="position:relative;top:0px;left:0px;width:95%;height:95px;overflow:auto;" class="padTab">
+					<table width="95%"  border="0" cellpadding="5" cellspacing="0" id="adSrc" align="left">
+					<tr  class="dvtCellInfo">
+					<td width="31%"><select name="Fields" class="detailedViewTextBox">
+					{$FIELDNAMES}
+					</select>
+					</td>
+					<td width="32%"><select name="Condition" class="detailedViewTextBox">
+					{$CRITERIA}
+					</select>
+					</td>
+					<td width="32%"><input type="text" name="srch" class="detailedViewTextBox"></td>
+					</tr>
+					</table>
+					</div>	
+					</td>
+					</tr>
+					<tr>
+
+					<td><input type="button" name="more" value="More" onClick="fnAddSrch('{$FIELDNAMES}')">
+					&nbsp;&nbsp;
+					<input name="button" type="button" value="Fewer" onclick="delRow()"></td>
+					<td>&nbsp;</td>
+					<td>&nbsp;</td>
+					</tr>
+					</table>
+                                        </div>
                                         </div>
                                         <table border=0 cellspacing=0 cellpadding=5 width=100%>
                                         <tr><td align=center><input type="submit" class=small value="Search now" onClick="callSearch('Basic');"></td></tr></table>

Modified: vtigercrm/trunk/include/js/general.js
==============================================================================
--- vtigercrm/trunk/include/js/general.js (original)
+++ vtigercrm/trunk/include/js/general.js Thu Feb 23 03:48:26 2006
@@ -1206,3 +1206,57 @@
         }
 }
 
+/*
+* javascript function to add field rows
+* @param option_values :: List of Field names
+*/
+function fnAddSrch(option_values){
+
+    var tableName = document.getElementById('adSrc');
+
+    var prev = tableName.rows.length;
+
+    var count = prev;
+
+    var row = tableName.insertRow(prev);
+
+    if(count%2)
+
+        row.className = "dvtCellLabel";
+
+    else
+
+        row.className = "dvtCellInfo";
+
+    var colone = row.insertCell(0);
+
+    var coltwo = row.insertCell(1);
+
+    var colthree = row.insertCell(2);
+
+    //colone.innerHTML="<select name='Fields'+count class='detailedViewTextBox'><option>First Name</option><option>Last Name</option><option>Department</option><option>Role</option><option>E-Mild Id</option></select>";
+    colone.innerHTML="<select name='Fields'+count class='detailedViewTextBox'>"+option_values+"</select>";
+
+    coltwo.innerHTML="<select name='Condition'+count class='detailedViewTextBox'><option>Contains</option><option>doesn't Contains</option><option>is</option><option>isn't</option><option>Begins With</option><option>Ends With</option></select> ";
+
+    colthree.innerHTML="<input type='text' name='srch'+count class='detailedViewTextBox'>";
+
+}
+
+/*
+* javascript function to delete field rows in advance search
+* @param void :: void
+*/
+function delRow()
+{
+
+    var tableName = document.getElementById('adSrc');
+
+    var prev = tableName.rows.length;
+
+    if(prev > 1)
+
+    document.getElementById('adSrc').deleteRow(prev-1);
+
+}
+

Modified: vtigercrm/trunk/include/utils/SearchUtils.php
==============================================================================
--- vtigercrm/trunk/include/utils/SearchUtils.php (original)
+++ vtigercrm/trunk/include/utils/SearchUtils.php Thu Feb 23 03:48:26 2006
@@ -302,8 +302,77 @@
 	}
 	return $where;
 }
-
-
-								
+function getAdvSearchfields($module)
+        {
+                global $adb;
+                $tabid = getTabid($module);
+                global $profile_id;
+
+                $sql = "select * from field inner join profile2field on profile2field.fieldid=field.fieldid";
+		$sql.= " where field.tabid=".$tabid." and";
+		$sql.= " field.displaytype in (1,2) and profile2field.visible=0";
+		$sql.= " and profile2field.profileid=".$profile_id." order by block,sequence";
+
+		$result = $adb->query($sql);
+                $noofrows = $adb->num_rows($result);
+		$block = '';
+		//Added on 14-10-2005 -- added ticket id in list
+                if($module == 'HelpDesk' && $block == 25)
+                {
+                        $module_columnlist['crmentity:crmid::HelpDesk_Ticket ID:I'] = 'Ticket ID';
+                }
+		//Added to include activity type in activity customview list
+                if($module == 'Activities' && $block == 19)
+                {
+                        $module_columnlist['activity:activitytype::Activities_Activity Type:C'] = 'Activity Type';
+                }
+
+                for($i=0; $i<$noofrows; $i++)
+                {
+                        $fieldtablename = $adb->query_result($result,$i,"tablename");
+                        $fieldcolname = $adb->query_result($result,$i,"columnname");
+			$fieldtype = explode("~",$fieldtype);
+			$fieldtypeofdata = $fieldtype[0];
+                        /*if($fieldcolname == "crmid" || $fieldcolname == "parent_id")
+                        {
+                           $fieldtablename = "crmentity";
+			   $fieldcolname = "setype";
+                        }*/
+                        $fieldlabel = $adb->query_result($result,$i,"fieldlabel");
+				if($fieldlabel == "Related To")
+				{
+					$fieldlabel = "Related to";
+				}
+				if($fieldlabel == "Start Date & Time")
+                                {
+                                        $fieldlabel = "Start Date";
+					  if($module == 'Activities' && $block == 19)
+				               $module_columnlist['activity:time_start::Activities_Start Time:I'] = 'Start Time';
+
+                                }
+                        $fieldlabel1 = str_replace(" ","_",$fieldlabel);
+                        //$module_columnlist[$optionvalue] = $fieldlabel;
+			if ($i==0)
+			$OPTION_SET .= "<option value=\'".$fieldtablename.".".$fieldcolname."\' selected>".$fieldlabel."</option>";
+			else
+			$OPTION_SET .= "<option value=\'".$fieldtablename.".".$fieldcolname."\'>".$fieldlabel."</option>";
+                }
+                return $OPTION_SET;
+        }
+
+function getcriteria_options()
+{
+	$CRIT_OPT = "<option value=\"cts\">Contains</option>
+	            <option value=\"dcts\">doesn't Contains</option>
+		    <option value=\"is\">is</option>
+		    <option value=\"isn\">isn't</option>
+		    <option value=\"bwt\">Begins With</option>
+		    <option value=\"ewt\">Ends With</option>";
+	return $CRIT_OPT;
+}
+function getSearch_criteria()
+{
+	$condition_array = Array(''=>'',''=>'',''=>'',''=>'',''=>'',''=>'');
+}								
 
 ?>

Modified: vtigercrm/trunk/modules/Leads/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Leads/ListView.php (original)
+++ vtigercrm/trunk/modules/Leads/ListView.php Thu Feb 23 03:48:26 2006
@@ -256,6 +256,10 @@
 
 $navigationOutput = getTableHeaderNavigation($navigation_array, $url_string,"Leads","index",$viewid);
 $alphabetical = AlphabeticalSearch($currentModule,'index','lastname','true','basic',"","","","",$viewid);
+$fieldnames = getAdvSearchfields($module);
+$criteria = getcriteria_options();
+$smarty->assign("CRITERIA", $criteria);
+$smarty->assign("FIELDNAMES", $fieldnames);
 $smarty->assign("ALPHABETICAL", $alphabetical);
 $smarty->assign("NAVIGATION", $navigationOutput);
 $smarty->assign("RECORD_COUNTS", $record_string);

Modified: vtigercrm/trunk/themes/blue/style.css
==============================================================================
--- vtigercrm/trunk/themes/blue/style.css (original)
+++ vtigercrm/trunk/themes/blue/style.css Thu Feb 23 03:48:26 2006
@@ -809,3 +809,30 @@
 	display:none;
 }
 
+/*Added for Advance Seearch*/
+#scrollTab{
+	position:relative;
+	width:100%;
+	height:350px;
+	overflow:auto;
+	border:0px solid #CCCCCC;
+	display:block;
+}
+
+.dock{
+	vertical-align:middle;
+	text-align:left;
+	padding-left:0px;
+}
+
+.imgDoc{
+	cursor:pointer;
+	border:0px;
+}
+
+#one{
+	position:relative;
+	display:block;
+	width:245px;
+}
+





More information about the vtigercrm-commits mailing list