]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl
Release 6.4.0
[Github/sugarcrm.git] / include / SugarFields / Fields / Datetimecombo / RangeSearchForm.tpl
1 {*
2 /*********************************************************************************
3  * SugarCRM Community Edition 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}} {{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"}
61 {{/if}}
62 {{if $displayParams.showFormats}}
63 &nbsp;(<span class="dateFormat">{$USER_DATEFORMAT}</span>)
64 {{/if}}
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",
71 singleClick : true,
72 dateStr : "{$date_value}",
73 startWeekday: {$CALENDAR_FDOW|default:'0'},
74 step : 1,
75 weekNumbers:false
76 {rdelim}
77 );
78 </script>
79 {{/if}}    
80 </div>
81
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"}
88 {{/if}}
89 {{if $displayParams.showFormats}}
90 &nbsp;(<span class="dateFormat">{$USER_DATEFORMAT}</span>)
91 {{/if}}
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",
98 singleClick : true,
99 dateStr : "{$date_value}",
100 step : 1,
101 weekNumbers:false
102 {rdelim}
103 );
104 </script>
105 {{/if}} 
106 {$APP.LBL_AND}
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"}
112 {{/if}}
113 {{if $displayParams.showFormats}}
114 &nbsp;(<span class="dateFormat">{$USER_DATEFORMAT}</span>)
115 {{/if}}
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",
122 singleClick : true,
123 dateStr : "{$date_value}",
124 step : 1,
125 weekNumbers:false
126 {rdelim}
127 );
128 </script>
129 {{/if}} 
130 </div>
131
132
133 <script type='text/javascript'>
134
135 function {$id}_range_change(val) 
136 {ldelim}
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))
143      {ldelim}
144         document.getElementById("range_{$id}").value = '';
145      {rdelim}
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';         
156   {rdelim}
157 {rdelim}
158
159 var {$id}_range_reset = function()
160 {ldelim}
161 {$id}_range_change('=');
162 {rdelim}
163
164 YAHOO.util.Event.onDOMReady(function() {ldelim}
165 if(document.getElementById('search_form_clear'))
166 {ldelim}
167 YAHOO.util.Event.addListener('search_form_clear', 'click', {$id}_range_reset);
168 {rdelim}
169
170 {rdelim});
171 </script>