]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl
Release 6.2.0beta4
[Github/sugarcrm.git] / include / SugarFields / Fields / Datetimecombo / RangeSearchForm.tpl
1 {*
2 /*********************************************************************************
3  * SugarCRM is a customer relationship management program developed by
4  * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
5  * 
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.
12  * 
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
16  * details.
17  * 
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
21  * 02110-1301 USA.
22  * 
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.
25  * 
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.
29  * 
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  ********************************************************************************/
36
37 *}
38 {{if empty($displayParams.idName)}}
39 {assign var="id" value={{sugarvar key='name' string=true}} }
40 {{else}}
41 {assign var="id" value={{$displayParams.idName}} }
42 {{/if}}
43
44 {if isset($smarty.request.{{$id_range_choice}})}
45 {assign var="starting_choice" value=$smarty.request.{{$id_range_choice}}}
46 {else}
47 {assign var="starting_choice" value="="}
48 {/if}
49
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}
53 </select>
54 </div>
55
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}} tabindex='{{$tabindex}}' size="11" maxlength="10" style="width:100px !important;">
58 {{if !$displayParams.hiddeCalendar}}
59 <img border="0" src="{sugar_getimagepath file='jscalendar.gif'}" alt="{$APP.LBL_ENTER_DATE}" id="{$id}_trigger" align="absmiddle"/>
60 {{/if}}
61 {{if $displayParams.showFormats}}
62 &nbsp;(<span class="dateFormat">{$USER_DATEFORMAT}</span>)
63 {{/if}}
64 {{if !$displayParams.hiddeCalendar}}
65 <script type="text/javascript">
66 Calendar.setup ({ldelim}
67 inputField : "range_{$id}",
68 daFormat : "{$CALENDAR_FORMAT}",
69 button : "{$id}_trigger",
70 singleClick : true,
71 dateStr : "{$date_value}",
72 step : 1,
73 weekNumbers:false
74 {rdelim}
75 );
76 </script>
77 {{/if}}    
78 </div>
79
80 <div id="{$id}_between_range_div" style="{if $starting_choice=='between'}display:'';{else}display:none;{/if}">
81 {assign var=date_value value={{sugarvar key='value' string=true}} }
82 <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;" maxlength="10">
83 {{if !$displayParams.hiddeCalendar}}
84 <img border="0" src="{sugar_getimagepath file='jscalendar.gif'}" alt="{$APP.LBL_ENTER_DATE}" id="start_range_{$id}_trigger" align="absmiddle" />
85 {{/if}}
86 {{if $displayParams.showFormats}}
87 &nbsp;(<span class="dateFormat">{$USER_DATEFORMAT}</span>)
88 {{/if}}
89 {{if !$displayParams.hiddeCalendar}}
90 <script type="text/javascript">
91 Calendar.setup ({ldelim}
92 inputField : "start_range_{$id}",
93 daFormat : "{$CALENDAR_FORMAT}",
94 button : "start_range_{$id}_trigger",
95 singleClick : true,
96 dateStr : "{$date_value}",
97 step : 1,
98 weekNumbers:false
99 {rdelim}
100 );
101 </script>
102 {{/if}} 
103 {$APP.LBL_AND}
104 {assign var=date_value value={{sugarvar key='value' string=true}} }
105 <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">
106 {{if !$displayParams.hiddeCalendar}}
107 <img border="0" src="{sugar_getimagepath file='jscalendar.gif'}" alt="{$APP.LBL_ENTER_DATE}" id="end_range_{$id}_trigger" align="absmiddle" />
108 {{/if}}
109 {{if $displayParams.showFormats}}
110 &nbsp;(<span class="dateFormat">{$USER_DATEFORMAT}</span>)
111 {{/if}}
112 {{if !$displayParams.hiddeCalendar}}
113 <script type="text/javascript">
114 Calendar.setup ({ldelim}
115 inputField : "end_range_{$id}",
116 daFormat : "{$CALENDAR_FORMAT}",
117 button : "end_range_{$id}_trigger",
118 singleClick : true,
119 dateStr : "{$date_value}",
120 step : 1,
121 weekNumbers:false
122 {rdelim}
123 );
124 </script>
125 {{/if}} 
126 </div>
127
128
129 <script type='text/javascript'>
130
131 function {$id}_range_change(val) 
132 {ldelim}
133   if(val == 'between') {ldelim}
134      document.getElementById("range_{$id}").value = '';  
135      document.getElementById("{$id}_range_div").style.display = 'none';
136      document.getElementById("{$id}_between_range_div").style.display = ''; 
137   {rdelim} else if (val == '=' || val == 'not_equal' || val == 'greater_than' || val == 'less_than') {ldelim}
138      if((/^\[.*\]$/).test(document.getElementById("range_{$id}").value))
139      {ldelim}
140         document.getElementById("range_{$id}").value = '';
141      {rdelim}
142      document.getElementById("start_range_{$id}").value = '';
143      document.getElementById("end_range_{$id}").value = '';
144      document.getElementById("{$id}_range_div").style.display = '';
145      document.getElementById("{$id}_between_range_div").style.display = 'none';
146   {rdelim} else {ldelim}
147      document.getElementById("range_{$id}").value = '[' + val + ']';    
148      document.getElementById("start_range_{$id}").value = '';
149      document.getElementById("end_range_{$id}").value = ''; 
150      document.getElementById("{$id}_range_div").style.display = 'none';
151      document.getElementById("{$id}_between_range_div").style.display = 'none';         
152   {rdelim}
153 {rdelim}
154
155 var {$id}_range_reset = function()
156 {ldelim}
157 {$id}_range_change('=');
158 {rdelim}
159
160 YAHOO.util.Event.onDOMReady(function() {ldelim}
161 if(document.getElementById('search_form_clear'))
162 {ldelim}
163 YAHOO.util.Event.addListener('search_form_clear', 'click', {$id}_range_reset);
164 {rdelim}
165
166 {rdelim});
167 </script>