]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Schedulers/EditView.html
Release 6.5.0
[Github/sugarcrm.git] / modules / Schedulers / EditView.html
1 <!--
2 /*********************************************************************************
3  * SugarCRM Community Edition is a customer relationship management program developed by
4  * SugarCRM, Inc. Copyright (C) 2004-2012 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
39  * Description:
40  ********************************************************************************/
41 -->
42
43 <!-- BEGIN: main -->
44 {ERROR_STRING}
45 {ROLLOVER}
46 <form name="EditView" id="EditView" method="GET" action="index.php">
47         <input type="hidden" name="module" value="Schedulers">
48         <input type="hidden" name="record" value="{ID}">
49         <input type="hidden" name="action">
50         <input type="hidden" name="return_module" value="{RETURN_MODULE}">
51         <input type="hidden" name="return_id" value="{RETURN_ID}">
52         <input type="hidden" name="return_action" value="{RETURN_ACTION}">
53         <input type="hidden" name="use_adv" id="use_adv" value="{USE_ADV_BOOL}">
54
55 <table width="100%" cellpadding="0" cellspacing="0" border="0">
56         <tr>
57                 <td>
58                         <input title="{APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="this.form.action.value='Save'; return checkFormPre('EditView')" type="submit" name="button" value="  {APP.LBL_SAVE_BUTTON_LABEL}  " >
59                         <input title="{APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='index'; this.form.module.value='{RETURN_MODULE}'; this.form.record.value='{RETURN_ID}'" type="submit" name="button" value="  {APP.LBL_CANCEL_BUTTON_LABEL}  ">
60                 </td>
61                 <td align="right" nowrap><span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> {APP.NTC_REQUIRED}</td>
62                 <td align='right'>{ADMIN_EDIT}</td>
63         </tr>
64 </table>
65
66 <table cellspacing="1" cellpadding="0" border="0" class="edit view" width="100%">
67         <tr>
68                 <th align="left" scope="row" colspan="4">
69                         <h4>{MOD.LBL_BASIC_OPTIONS}</h4>
70                 </th>
71         </tr>
72                 <tr>
73                         <td width="15%" scope="row"><slot>{MOD.LBL_NAME} <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
74                         <td width="35%"><slot><input name='name' tabindex='1' size='35' maxlength='50' type="text" value="{NAME}"></slot></td>
75                         <td width="15%" scope="row"><slot>{MOD.LBL_STATUS} <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
76                         <td width="35%"><slot><select name='status' tabindex='8'>{STATUS_OPTIONS}</select></slot></td>
77                 </tr><tr>
78                         <td scope="row">&nbsp;</td>
79                         <td>&nbsp;</td>
80                         <td scope="row">&nbsp;</td>
81                         <td>&nbsp;</td>
82                 </tr><tr>
83                         <td scope="row"><slot>{MOD.LBL_JOB} <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
84                         <td><slot><select name='job_function' tabindex='2' size='1'>{JOB_FUNCTION}</select></slot></td>
85                         <td colspan="2"><slot> OR <input name='job_url' tabindex='2' size='30' maxlength='255' type="text" value="{JOB_URL}"></td>
86
87                 </tr><tr>
88                         <td scope="row"><slot>{MOD.LBL_INTERVAL} <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
89                         <td colspan="3"><slot>
90                                 <div id="crontab" style="display:none;">
91                                 <table cellpadding="0" cellspacing="0">
92                                         <tr>
93                                                 <td colspan="5"><slot>
94                                                         <a href="javascript:void(0);" onClick="toggleAdv('false');">{MOD.LBL_TOGGLE_BASIC}</a>
95                                                 </slot></td>
96                                         </tr>
97                                         <tr>
98                                                 <td><slot>{MOD.LBL_MINS}</slot></td>
99                                                 <td><slot>{MOD.LBL_HOURS}</slot></td>
100                                                 <td><slot>{MOD.LBL_DAY_OF_MONTH}</slot></td>
101                                                 <td><slot>{MOD.LBL_MONTHS}</slot></td>
102                                                 <td><slot>{MOD.LBL_DAY_OF_WEEK}</slot></td>
103                                         </tr><tr>
104                                                 <td><slot><input name="mins" tabindex="3" maxlength="25" type="text" size="3" value="{MINS}"></slot></td>
105                                                 <td><slot><input name="hours" tabindex="4" maxlength="25" type="text" size="3" value="{HOURS}"></slot></td>
106                                                 <td><slot><input name="day_of_month" tabindex="5" maxlength="25" type="text" size="3" value="{DAY_OF_MONTH}"></slot></td>
107                                                 <td><slot><input name="months" tabindex="6" maxlength="25" type="text" size="3" value="{MONTHS}"></slot></td>
108                                                 <td><slot><input name="day_of_week" tabindex="7" maxlength="25" type="text" size="3" value="{DAY_OF_WEEK}"></slot></td>
109                                         </tr><tr>
110                         <td colspan="5"><slot>
111                             <i>{MOD.LBL_CRONTAB_EXAMPLES}</i>
112                         </slot></td>
113                                         </tr>
114                                 </table>
115                                 </div>
116
117                                 <div id="simple">
118                                 <table cellpadding="0" cellspacing="0" border="0">
119                                         <tr>
120                                                 <td colspan=5><slot>
121                                                         <a href="javascript:void(0);" onClick="toggleAdv('false');">{MOD.LBL_TOGGLE_ADV}</a>
122                                                 </slot></td>
123                                         </tr>
124
125                                         <tr>
126                                                 <td valign="top" width="25%">
127                                                         &nbsp;{MOD.LBL_EVERY}&nbsp;
128                                                         <select name="basic_interval" {ONLY_ADV}>{BASIC_INTERVAL}</select>&nbsp;
129                                                         <select name="basic_period" {ONLY_ADV}>{BASIC_PERIOD}</select>
130                                                 </td>
131
132
133                                                 <td valign="top" width="25%">
134                                                 <table cellpadding="0" cellspacing="0" border="0">
135                                                         <tr>
136                                                                 <td><slot><input type="checkbox" name="all" value="true" id="all" {ONLY_ADV} {ALL} onClick="allDays();">&nbsp;<i>{MOD.LBL_ALL}</i></slot></td>
137                                                         </tr>
138                                                         <tr>
139                                                                 <td><slot><input type="checkbox" name="mon" value="true" id="mon" {ONLY_ADV} {MON}>&nbsp;{MOD.LBL_MON}</slot></td>
140                                                         </tr>
141                                                         <tr>
142                                                                 <td><slot><input type="checkbox" name="tue" value="true" id="tue" {ONLY_ADV} {TUE}>&nbsp;{MOD.LBL_TUE}</slot></td>
143                                                         </tr>
144                                                         <tr>
145                                                                 <td><slot><input type="checkbox" name="wed" value="true" id="wed" {ONLY_ADV} {WED}>&nbsp;{MOD.LBL_WED}</slot></td>
146                                                         </tr>
147                                                 </table>
148                                                 </td>
149
150                                                 <td valign="top" width="25%">
151                                                 <table cellpadding="0" cellspacing="0" border="0">
152                                                         <tr>
153                                                                 <td><slot><input type="checkbox" name="thu" value="true" id="thu" {ONLY_ADV} {THU}>&nbsp;{MOD.LBL_THU}</slot></td>
154                                                         </tr>
155                                                         <tr>
156                                                                 <td><slot><input type="checkbox" name="fri" value="true" id="fri" {ONLY_ADV} {FRI}>&nbsp;{MOD.LBL_FRI}</slot></td>
157                                                         </tr>
158                                                         <tr>
159                                                                 <td><slot><input type="checkbox" name="sat" value="true" id="sat" {ONLY_ADV} {SAT}>&nbsp;{MOD.LBL_SAT}</slot></td>
160                                                         </tr>
161                                                         <tr>
162                                                                 <td><slot><input type="checkbox" name="sun" value="true" id="sun" {ONLY_ADV} {SUN}>&nbsp;{MOD.LBL_SUN}</slot></td>
163                                                         </tr>
164                                                 </table>
165                                                 </td>
166
167
168                                         </tr>
169                                 </table>
170                                 </div>
171
172                         </slot></td>
173                 </tr>
174         </td>
175 </tr>
176 </table>
177
178 <div id="advTable" style="display:none;">
179 <br>
180 <table width="100%" border="0" cellspacing="1" cellpadding="0" class="edit view">
181         <tr>
182                 <th align="left" scope="row" colspan="4">
183                         <h4>{MOD.LBL_ADV_OPTIONS}</h4>
184                 </th>
185         </tr>
186         <tr>
187                 <td scope="row" width="15%"><slot>{MOD.LBL_CATCH_UP}</slot></td>
188                 <td width="35%"><slot>
189                         <div id="rollover"><a href="#" class="rollover"><span>{MOD.LBL_CATCH_UP_WARNING}</span><img border="0" src="index.php?entryPoint=getImage&themeName={THEME}&imageName=helpInline.gif"></a></div>
190                         <input name='catch_up' tabindex='16' type='checkbox' value='1' {CATCH_UP_CHECKED}>
191
192                 </slot></td>
193                 <td scope="row" width="15%">&nbsp;</td>
194                 <td width="35%">&nbsp;</td>
195         </tr>
196
197         <tr>
198                 <td scope="row"><slot>{MOD.LBL_DATE_TIME_START} <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
199                 <td><slot>
200                 <table  cellpadding="0" cellspacing="0">
201                         <tr>
202                                 <td nowrap><input name='date_start' id='jscal_start_date' onblur="parseDate(this, '{CALENDAR_DATEFORMAT}');" tabindex='8' size='11' maxlength='10' type="text" value="{DATE_START}"> <img src="index.php?entryPoint=getImage&themeName={THEME}&imageName=jscalendar.gif" alt="{CALENDAR_DATEFORMAT}"  id="start_date_jscal_trigger" align="absmiddle">&nbsp;</td>
203                                 <td nowrap><select name='time_hour_start' tabindex="9">{TIME_START_HOUR_OPTIONS}</select>{TIME_SEPARATOR}<select name='time_minute_start' tabindex="10">{TIME_START_MINUTE_OPTIONS}</select>{TIME_MERIDIEM_START}</td>
204                         </tr><tr>
205                                 <td nowrap><span class="dateFormat">{USER_DATEFORMAT}</span></td>
206                                 <td nowrap><span class="dateFormat">{TIME_FORMAT}</span></td>
207                         </tr>
208                 </table>
209                 </slot></td>
210
211                 <td scope="row"><slot>{MOD.LBL_TIME_FROM}</slot></td>
212                 <td><slot>
213                 <table  cellpadding="0" cellspacing="0">
214                         <tr>
215                                 <td nowrap><select name='time_hour_from' tabindex="15">{TIME_FROM_HOUR_OPTIONS}</select>{TIME_SEPARATOR}<select name='time_minute_from' tabindex="16">{TIME_FROM_MIN_OPTIONS}</select>{TIME_MERIDIEM_FROM}</td>
216                         </tr><tr>
217                                 <td nowrap><span class="dateFormat">{TIME_FORMAT}</span></td>
218                         </tr>
219                 </table>
220                 </slot></td>
221
222         </tr>
223         <tr>
224                 <td scope="row"><slot>{MOD.LBL_DATE_TIME_END}</slot></td>
225                 <td><slot>
226                 <table  cellpadding="0" cellspacing="0">
227                         <tr>
228                                 <td nowrap><input name='date_end' id='jscal_end_date' onblur="parseDate(this, '{CALENDAR_DATEFORMAT}');" tabindex='12' size='11' maxlength='10' type="text" value="{DATE_END}"> <img src="index.php?entryPoint=getImage&themeName={THEME}&imageName=jscalendar.gif" alt="{CALENDAR_DATEFORMAT}"  id="end_date_jscal_trigger" align="absmiddle">&nbsp;</td>
229                                 <td nowrap><select name='time_hour_end' tabindex="13">{TIME_END_HOUR_OPTIONS}</select>{TIME_SEPARATOR}<select name='time_minute_end' tabindex="14">{TIME_END_MINUTE_OPTIONS}</select>{TIME_MERIDIEM_END}</td>
230                         </tr><tr>
231                                 <td nowrap><span class="dateFormat">{USER_DATEFORMAT}</span></td>
232                                 <td nowrap><span class="dateFormat">{TIME_FORMAT}</span></td>
233                         </tr>
234                 </table>
235                 </slot></td>
236
237                 <td scope="row"><slot>{MOD.LBL_TIME_TO}</slot></td>
238                 <td><slot>
239                         <table  cellpadding="0" cellspacing="0">
240                                 <tr>
241                                         <td nowrap><select name='time_hour_to' tabindex="17">{TIME_TO_HOUR_OPTIONS}</select>{TIME_SEPARATOR}<select name='time_minute_to' tabindex="18">{TIME_TO_MIN_OPTIONS}</select>{TIME_MERIDIEM_TO}</td>
242                                 </tr><tr>
243                                         <td nowrap><span class="dateFormat">{TIME_FORMAT}</span></td>
244                                 </tr>
245                         </table>
246                 </slot></td>
247
248         </tr>
249 </table>
250 </div>
251 <div style="padding-top:2px;">
252                         <input title="{APP.LBL_SAVE_BUTTON_TITLE}" class="button" onclick="this.form.action.value='Save'; return checkFormPre('EditView')" type="submit" name="button" value="  {APP.LBL_SAVE_BUTTON_LABEL}  " />
253                         <input title="{APP.LBL_CANCEL_BUTTON_TITLE}" class="button" onclick="this.form.action.value='index'; this.form.module.value='{RETURN_MODULE}'; this.form.record.value='{RETURN_ID}'" type="submit" name="button" value="  {APP.LBL_CANCEL_BUTTON_LABEL}  " />
254 </div>
255
256
257
258
259 </form>
260 <script type="text/javascript">
261         Calendar.setup ({
262                 inputField : "jscal_start_date", ifFormat : "{CALENDAR_DATEFORMAT}", showsTime : false, button : "start_date_jscal_trigger", singleClick : true, step : 1
263         });
264
265         Calendar.setup ({
266                 inputField : "jscal_end_date", ifFormat : "{CALENDAR_DATEFORMAT}", showsTime : false, button : "end_date_jscal_trigger", singleClick : true, step : 1
267         });
268
269
270 // this will pop open the Advanced settings if the DATE_START field (required) is empty
271 function checkFormPre(formId) {
272         validateCronInterval(formId);
273         var noError = check_form(formId);
274
275         if(noError) {
276                 return true;
277         } else {
278                 toggleAdv('true');
279                 return false;
280         }
281 }
282
283 function validateCronInterval(formId) {
284         var fieldIsValid = function(value, min, max) {
285                 var inRange = function(value, min, max) {
286                         return (value >= min && value <= max);
287                 }
288                 //Check for *
289                 if (value == "*") {
290                         return true;
291                 }
292                 //Check for interval syntax
293                 var result = /^\*\/(\d+)$/.exec(value);
294                 if (result && result[0] && inRange(result[1], min, max)) {
295                         return true;
296                 }
297                 //Check for ranges/lists
298                 var sets = value.split(',');
299                 var valid = true;
300                 for (var i = 0; i < sets.length; i++) {
301                         result = /^(\d+)(-(\d+))?$/.exec(sets[i])
302                         if (!result || !result[0] || !inRange(result[1], min, max) || (result[3] && !inRange(result[3], min, max))) {
303                                 return false;
304                         }
305                 }
306                 return true;
307         }
308         var cronFields = {
309                 mins:             {min:0, max:59},
310                 hours:            {min:0, max:23},
311                 day_of_month: {min:1, max:31},
312                 months:           {min:1, max:12},
313                 day_of_week:  {min:0, max:7}
314         }
315         var valid = true;
316         for (field in cronFields) {
317                 removeFromValidate(formId, field);
318                 if (document[formId][field] && !fieldIsValid(document[formId][field].value, cronFields[field].min, cronFields[field].max)) {
319                         valid = false;
320                         addToValidate(formId, field, 'error', true, "{MOD.ERR_CRON_SYNTAX}");
321                 } else {
322                         addToValidate(formId, field, 'verified', true, "{MOD.ERR_CRON_SYNTAX}");
323                 }
324         }
325         return valid;
326 }
327
328 function toggleAdv(onlyAdv) {
329         var thisForm = document.getElementById("EditView");
330         var crontab = document.getElementById("crontab");
331         var simple = document.getElementById("simple");
332         var adv = document.getElementById("advTable");
333         var use = document.getElementById("use_adv");
334
335         if(crontab.style.display == "none" || onlyAdv == 'true') { // show advanced
336                 crontab.style.display = "";
337                 adv.style.display = "";
338                 simple.style.display = "none";
339                 use.value = "true";
340         } else {
341                 crontab.style.display = "none";
342                 adv.style.display = "none";
343                 simple.style.display = "";
344                 use.value = "false";
345         }
346
347         for(i=0; i<thisForm.elements.length; i++) {
348                 if(thisForm.elements[i].disabled) {
349                         thisForm.elements[i].disabled = false;
350                 }
351         }
352 }
353
354 function allDays() {
355         var toggle = document.getElementById("all");
356         var m = document.getElementById("mon");
357         var t = document.getElementById("tue");
358         var w = document.getElementById("wed");
359         var h = document.getElementById("thu");
360         var f = document.getElementById("fri");
361         var s = document.getElementById("sat");
362         var u = document.getElementById("sun");
363
364         if(toggle.checked) {
365                 m.checked = true;
366                 t.checked = true;
367                 w.checked = true;
368                 h.checked = true;
369                 f.checked = true;
370                 s.checked = true;
371                 u.checked = true;
372         } else {
373                 m.checked = false;
374                 t.checked = false;
375                 w.checked = false;
376                 h.checked = false;
377                 f.checked = false;
378                 s.checked = false;
379                 u.checked = false;
380         }
381
382 }
383
384 </script>
385 {JAVASCRIPT}
386 <!-- END: main -->