2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
6 * This program is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Affero General Public License version 3 as published by the
8 * Free Software Foundation with the addition of the following permission added
9 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
18 * You should have received a copy of the GNU Affero General Public License along with
19 * this program; if not, see http://www.gnu.org/licenses or write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26 * The interactive user interfaces in modified source and object code versions
27 * of this program must display Appropriate Legal Notices, as required under
28 * Section 5 of the GNU Affero General Public License version 3.
30 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31 * these Appropriate Legal Notices must retain the display of the "Powered by
32 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
33 * technical reasons, the Appropriate Legal Notices must display the words
34 * "Powered by SugarCRM".
35 ********************************************************************************/
38 {{if empty($displayParams.idName)}}
39 {assign var="id" value={{sugarvar key='name' string=true}} }
41 {assign var="id" value={{$displayParams.idName}} }
44 {if isset($smarty.request.{{$id_range_choice}})}
45 {assign var="starting_choice" value=$smarty.request.{{$id_range_choice}}}
47 {assign var="starting_choice" value="="}
50 <div style="white-space:nowrap !important;">
51 <select id="{$id}_range_choice" name="{$id}_range_choice" style="width:125px !important;" onchange="{$id}_range_change(this.value);">
52 {html_options options={{sugarvar key='options' string=true}} selected=$starting_choice}
56 <div id="{$id}_range_div" style="{if preg_match('/^\[/', $smarty.request.{{$id_range}}) || $starting_choice == 'between'}display:none{else}display:''{/if};">
57 <input autocomplete="off" type="text" name="range_{$id}" id="range_{$id}" value='{if empty($smarty.request.{{$id_range}}) && !empty($smarty.request.{{$original_id}})}{$smarty.request.{{$original_id}}}{else}{$smarty.request.{{$id_range}}}{/if}' title='{{$vardef.help}}' {{$displayParams.field}} {{if !empty($tabindex)}} tabindex='{{$tabindex}}' {{/if}} size="11" style="width:100px !important;">
58 {{if !$displayParams.hiddeCalendar}}
59 {capture assign="other_attributes"}align="absmiddle" border="0" id="{$id}_trigger"{/capture}
60 {sugar_getimage name="jscalendar" ext=".gif" alt="$APP.LBL_ENTER_DATE other_attributes=$other_attributes"}
62 {{if $displayParams.showFormats}}
63 (<span class="dateFormat">{$USER_DATEFORMAT}</span>)
65 {{if !$displayParams.hiddeCalendar}}
66 <script type="text/javascript">
67 Calendar.setup ({ldelim}
68 inputField : "range_{$id}",
69 daFormat : "{$CALENDAR_FORMAT}",
70 button : "{$id}_trigger",
72 dateStr : "{$date_value}",
73 startWeekday: {$CALENDAR_FDOW|default:'0'},
82 <div id="{$id}_between_range_div" style="{if $starting_choice=='between'}display:'';{else}display:none;{/if}">
83 {assign var=date_value value={{sugarvar key='value' string=true}} }
84 <input autocomplete="off" type="text" name="start_range_{$id}" id="start_range_{$id}" value='{$smarty.request.{{$id_range_start}} }' title='{{$vardef.help}}' {{$displayParams.field}} tabindex='{{$tabindex}}' size="11" style="width:100px !important;">
85 {{if !$displayParams.hiddeCalendar}}
86 {capture assign="other_attributes"}align="absmiddle" border="0" id="start_range_{$id}_trigger"{/capture}
87 {sugar_getimage name="jscalendar" ext=".gif" alt="$APP.LBL_ENTER_DATE other_attributes=$other_attributes"}
89 {{if $displayParams.showFormats}}
90 (<span class="dateFormat">{$USER_DATEFORMAT}</span>)
92 {{if !$displayParams.hiddeCalendar}}
93 <script type="text/javascript">
94 Calendar.setup ({ldelim}
95 inputField : "start_range_{$id}",
96 daFormat : "{$CALENDAR_FORMAT}",
97 button : "start_range_{$id}_trigger",
99 dateStr : "{$date_value}",
107 {assign var=date_value value={{sugarvar key='value' string=true}} }
108 <input autocomplete="off" type="text" name="end_range_{$id}" id="end_range_{$id}" value='{$smarty.request.{{$id_range_end}} }' title='{{$vardef.help}}' {{$displayParams.field}} tabindex='{{$tabindex}}' size="11" style="width:100px !important;" maxlength="10">
109 {{if !$displayParams.hiddeCalendar}}
110 {capture assign="other_attributes"}align="absmiddle" border="0" id="end_range_{$id}_trigger"{/capture}
111 {sugar_getimage name="jscalendar" ext=".gif" alt="$APP.LBL_ENTER_DATE other_attributes=$other_attributes"}
113 {{if $displayParams.showFormats}}
114 (<span class="dateFormat">{$USER_DATEFORMAT}</span>)
116 {{if !$displayParams.hiddeCalendar}}
117 <script type="text/javascript">
118 Calendar.setup ({ldelim}
119 inputField : "end_range_{$id}",
120 daFormat : "{$CALENDAR_FORMAT}",
121 button : "end_range_{$id}_trigger",
123 dateStr : "{$date_value}",
133 <script type='text/javascript'>
135 function {$id}_range_change(val)
137 if(val == 'between') {ldelim}
138 document.getElementById("range_{$id}").value = '';
139 document.getElementById("{$id}_range_div").style.display = 'none';
140 document.getElementById("{$id}_between_range_div").style.display = '';
141 {rdelim} else if (val == '=' || val == 'not_equal' || val == 'greater_than' || val == 'less_than') {ldelim}
142 if((/^\[.*\]$/).test(document.getElementById("range_{$id}").value))
144 document.getElementById("range_{$id}").value = '';
146 document.getElementById("start_range_{$id}").value = '';
147 document.getElementById("end_range_{$id}").value = '';
148 document.getElementById("{$id}_range_div").style.display = '';
149 document.getElementById("{$id}_between_range_div").style.display = 'none';
150 {rdelim} else {ldelim}
151 document.getElementById("range_{$id}").value = '[' + val + ']';
152 document.getElementById("start_range_{$id}").value = '';
153 document.getElementById("end_range_{$id}").value = '';
154 document.getElementById("{$id}_range_div").style.display = 'none';
155 document.getElementById("{$id}_between_range_div").style.display = 'none';
159 var {$id}_range_reset = function()
161 {$id}_range_change('=');
164 YAHOO.util.Event.onDOMReady(function() {ldelim}
165 if(document.getElementById('search_form_clear'))
167 YAHOO.util.Event.addListener('search_form_clear', 'click', {$id}_range_reset);