Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
819d0d41 | 3 | | CiviCRM version 4.5 | |
6a488035 | 4 | +--------------------------------------------------------------------+ |
819d0d41 | 5 | | Copyright CiviCRM LLC (c) 2004-2014 | |
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"> | |
53 | <td class="label">{ts}API call:{/ts}</td> | |
54 | <td> | |
55 | ||
56 | <div id="fname"><br/> | |
57 | </div> | |
58 | <select name="api_entity" type="text" id="api_entity" class="form-select required"> | |
59 | {crmAPI entity="Entity" action="get" var="entities" version=3} | |
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} | |
69 | function assembleName( ) { | |
70 | ||
71 | // dunno yet | |
72 | var apiName = ""; | |
73 | ||
74 | // building prefix | |
75 | if( cj('#api_action').val() == '' ) { | |
76 | cj('#fname').html( "<em>API name will start appearing here as you type in fields below.</em>" ); | |
77 | return; | |
78 | } | |
79 | ||
80 | apiPrefix = 'api' | |
81 | ||
82 | // building entity | |
83 | var apiEntity = cj('#api_entity').val().replace( /([A-Z])/g, function($1) { | |
84 | return $1.toLowerCase(); | |
85 | }); | |
86 | // building action | |
87 | var apiAction = cj('#api_action').val().replace(/(\_[a-z])/g, function($1) {return $1.toUpperCase().replace('_','');}); | |
88 | apiName = apiPrefix + '.' + apiEntity + '.' + apiAction; | |
89 | cj('#fname').text( apiName ); | |
90 | } | |
91 | ||
92 | // bind to different events to build API name live | |
93 | cj(document).ready( function() { assembleName() } ); | |
94 | cj('#api_entity').change( function() { assembleName() } ); | |
95 | cj('#api_action').keyup( function() { assembleName() } ); | |
96 | ||
97 | {/literal} | |
98 | </script> | |
99 | ||
122540f5 | 100 | </td> |
6a488035 TO |
101 | </tr> |
102 | <tr class="crm-job-form-block-parameters"> | |
122540f5 DG |
103 | <td class="label">{$form.parameters.label}<br />{docURL page="Managing Scheduled Jobs" resource="wiki"}</td> |
104 | <td>{$form.parameters.html}</td> | |
6a488035 TO |
105 | </tr> |
106 | <tr class="crm-job-form-block-is_active"> | |
122540f5 | 107 | <td></td><td>{$form.is_active.html} {$form.is_active.label}</td> |
6a488035 TO |
108 | </tr> |
109 | </table> | |
110 | {/if} | |
122540f5 | 111 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div> |
6a488035 TO |
112 | </div> |
113 |