Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
fee14197 | 3 | | CiviCRM version 5 | |
6a488035 | 4 | +--------------------------------------------------------------------+ |
6b83d5bd | 5 | | Copyright CiviCRM LLC (c) 2004-2019 | |
6a488035 TO |
6 | +--------------------------------------------------------------------+ |
7 | | This file is a part of CiviCRM. | | |
8 | | | | |
9 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
10 | | under the terms of the GNU Affero General Public License | | |
11 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
12 | | | | |
13 | | CiviCRM is distributed in the hope that it will be useful, but | | |
14 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
16 | | See the GNU Affero General Public License for more details. | | |
17 | | | | |
18 | | You should have received a copy of the GNU Affero General Public | | |
19 | | License and the CiviCRM Licensing Exception along | | |
20 | | with this program; if not, contact CiviCRM LLC | | |
21 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
22 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
23 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
24 | +--------------------------------------------------------------------+ | |
25 | *} | |
26 | {* This template is used for adding/configuring Scheduled Jobs. *} | |
27 | <h3>{if $action eq 1}{ts}New Scheduled Job{/ts}{elseif $action eq 2}{ts}Edit Scheduled Job{/ts}{elseif $action eq 128}{ts}Execute Scheduled Job{/ts}{else}{ts}Delete Scheduled Job{/ts}{/if}</h3> | |
28 | <div class="crm-block crm-form-block crm-job-form-block"> | |
29 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> | |
30 | ||
31 | {if $action eq 8} | |
32 | <div class="messages status no-popup"> | |
33 | <div class="icon inform-icon"></div> | |
34 | {ts}WARNING: Deleting this Scheduled Job will cause some important site functionality to stop working.{/ts} {ts}Do you want to continue?{/ts} | |
35 | </div> | |
36 | {elseif $action eq 128} | |
37 | <div class="messages status no-popup"> | |
38 | <div class="icon inform-icon"></div> | |
39 | {ts}Are you sure you would like to execute this job?{/ts} | |
40 | </div> | |
41 | {else} | |
42 | <table class="form-layout-compressed"> | |
43 | <tr class="crm-job-form-block-name"> | |
44 | <td class="label">{$form.name.label}</td><td>{$form.name.html}</td> | |
45 | </tr> | |
46 | <tr class="crm-job-form-block-description"> | |
47 | <td class="label">{$form.description.label}</td><td>{$form.description.html}</td> | |
48 | </tr> | |
49 | <tr class="crm-job-form-block-run_frequency"> | |
50 | <td class="label">{$form.run_frequency.label}</td><td>{$form.run_frequency.html}</td> | |
51 | </tr> | |
52 | <tr class="crm-job-form-block-api_action"> | |
036aa39d | 53 | <td class="label"><label>{ts}API call:{/ts}</label></td> |
6a488035 TO |
54 | <td> |
55 | ||
56 | <div id="fname"><br/> | |
57 | </div> | |
bb6f7117 CW |
58 | <select name="api_entity" type="text" id="api_entity" class="crm-form-select required"> |
59 | {crmAPI entity="Entity" var="entities"} | |
6a488035 TO |
60 | {foreach from=$entities.values item=entity} |
61 | <option value="{$entity}"{if $entity eq $form.api_entity.value} selected="selected"{/if}>{$entity}</option> | |
62 | {/foreach} | |
63 | </select> | |
64 | {$form.api_action.html} | |
65 | ||
66 | <div class="description">{ts}Put in the API method name. You need to enter pieces of full API function name as described in the documentation.{/ts}</div> | |
67 | <script> | |
68 | {literal} | |
32678ccb | 69 | CRM.$(function($) { |
6a488035 TO |
70 | function assembleName( ) { |
71 | ||
72 | // dunno yet | |
73 | var apiName = ""; | |
74 | ||
75 | // building prefix | |
32678ccb CW |
76 | if( $('#api_action').val() == '' ) { |
77 | $('#fname').html( "<em>API name will start appearing here as you type in fields below.</em>" ); | |
6a488035 TO |
78 | return; |
79 | } | |
80 | ||
32678ccb | 81 | var apiPrefix = 'api' |
6a488035 TO |
82 | |
83 | // building entity | |
32678ccb CW |
84 | var apiEntity = $('#api_entity').val().replace( /([A-Z])/g, function($1) { |
85 | return $1.toLowerCase(); | |
86 | }); | |
6a488035 | 87 | // building action |
32678ccb | 88 | var apiAction = $('#api_action').val().replace(/(\_[a-z])/g, function($1) {return $1.toUpperCase().replace('_','');}); |
6a488035 | 89 | apiName = apiPrefix + '.' + apiEntity + '.' + apiAction; |
32678ccb | 90 | $('#fname').text( apiName ); |
6a488035 TO |
91 | } |
92 | ||
93 | // bind to different events to build API name live | |
32678ccb CW |
94 | $('#api_entity').change(assembleName) |
95 | $('#api_action').change(assembleName).keyup(assembleName); | |
96 | assembleName(); | |
97 | }); | |
6a488035 TO |
98 | |
99 | {/literal} | |
100 | </script> | |
101 | ||
7f7fa13a | 102 | </td> |
6a488035 TO |
103 | </tr> |
104 | <tr class="crm-job-form-block-parameters"> | |
122540f5 | 105 | <td class="label">{$form.parameters.label}<br />{docURL page="Managing Scheduled Jobs" resource="wiki"}</td> |
7f7fa13a | 106 | <td>{$form.parameters.html}</td> |
6a488035 | 107 | </tr> |
d7bace22 DRJ |
108 | <tr class="crm-job-form-block-scheduled-run-date"> |
109 | <td class="label">{$form.scheduled_run_date.label}</td> | |
9ee4786b DRJ |
110 | <td>{$form.scheduled_run_date.html}<br /> |
111 | <div dlass="description">{ts}Do not run this job before this date / time. The run frequency selected above will apply thereafter.{/ts}<br /> | |
d357221c | 112 | {if $action eq 1}{ts}Leave blank to run as soon as possible.{/ts}{else}{ts}Leave blank to run at next run frequency.{/ts}{/if} |
e8f61813 DRJ |
113 | </div> |
114 | </td> | |
115 | </tr> | |
6a488035 | 116 | <tr class="crm-job-form-block-is_active"> |
122540f5 | 117 | <td></td><td>{$form.is_active.html} {$form.is_active.label}</td> |
6a488035 TO |
118 | </tr> |
119 | </table> | |
120 | {/if} | |
122540f5 | 121 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div> |
6a488035 TO |
122 | </div> |
123 |