Merge pull request #12669 from eileenmcnaughton/dedupe_zero
[civicrm-core.git] / templates / CRM / Admin / Page / APIExplorer.tpl
CommitLineData
e4176358
CW
1{*
2 +--------------------------------------------------------------------+
fee14197 3 | CiviCRM version 5 |
e4176358 4 +--------------------------------------------------------------------+
6b83d5bd 5 | Copyright CiviCRM LLC (c) 2004-2019 |
e4176358
CW
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*}
0c3a6e64 26<style>
f78ce9c3 27 {literal}
89ee60d5 28 #mainTabContainer pre {
c8297314 29 line-height: 14px;
2b6e1174
CW
30 font-size: 11px;
31 margin: 0;
32 border: 0 none;
33 }
89ee60d5
CW
34 #mainTabContainer ul.ui-tabs-nav {
35 font-size: 1.1em;
36 margin-bottom: .6em;
37 }
65f22b4b
CW
38 pre#api-result {
39 max-height: 50em;
40 }
89ee60d5 41 pre#api-result,
bc4aa590 42 div#doc-result,
89ee60d5 43 pre#example-result {
e4176358 44 padding:1em;
2b6e1174 45 border: 1px solid lightgrey;
89ee60d5
CW
46 margin-top: 1em;
47 overflow: auto;
e4176358 48 }
f87f9c74
CW
49 #api-params tr td {
50 padding-top: 13px;
51 }
e4176358
CW
52 #api-params-table th:first-child,
53 #api-params-table td:first-child {
54 width: 35%;
67a63bd3
CW
55 min-width: 190px;
56 }
57 #api-params-table td[colspan] {
58 width: 100%;
e4176358
CW
59 }
60 #api-params-table td:first-child + td,
67a63bd3
CW
61 #api-params-table th:first-child + th {
62 width: 140px;
63 }
64 #api-params-table td:first-child + td select {
65 width: 132px;
66 }
67 #api-params-table td:first-child + td + td,
68 #api-params-table th:first-child + th + th {
69 width: 65%
70 }
f87f9c74
CW
71 #api-params .api-sort-handle {
72 margin-right: 10px;
73 cursor: move;
74 }
75 #api-params tr td > .crm-i,
76 #api-params tr td > a .crm-i {
77 color: lightgrey;
78 }
79 #api-params tr:hover td > .crm-i,
80 #api-params tr:hover td > a .crm-i {
81 color: grey;
82 }
83 #api-params .api-and-or {
84 margin-left: 1.2em;
85 font-size: .8em;
86 position: relative;
87 top: 5px;
88 width: 10em;
89 margin-bottom: -9px;
90 }
91 #api-params .api-and-or > span {
92 padding: 0 1em;
93 background: white;
94 cursor: pointer;
95 }
96 #api-params .api-or,
97 #api-params tr.or .api-and {
98 color: lightgrey;
99 }
100 #api-params tr.or .api-or {
101 color: inherit;
102 }
103 #api-params .api-and-or .crm-i {
104 transform: rotate(180deg);
105 }
106 #api-params tr.or .api-and-or .crm-i {
107 transform: initial;
108 }
109 #api-params .api-and-or:hover .crm-i {
110 color: #2786c2;
111 }
112 #api-params tr.or {
113 border-top: 3px solid lightgrey;
114 border-left: 3px solid lightgrey;
115 border-right: 3px solid lightgrey;
116 }
117 #api-params tr.or + tr {
118 border-left: 3px solid lightgrey;
119 border-right: 3px solid lightgrey;
120 border-bottom: 3px solid lightgrey;
121 }
122 #api-params tr.or + tr.or {
123 border-top: none;
124 border-bottom: none;
125 }
126a565b 126 #api-generated td:first-child {
67a63bd3 127 width: 60px;
e4176358
CW
128 }
129 #api-params {
130 min-height: 1em;
131 }
132 #api-params .red-icon {
133 margin-top: .5em;
134 }
67a63bd3
CW
135 .api-param-remove {
136 float: right;
137 }
89ee60d5 138 #mainTabContainer label {
c275764e 139 display: inline;
e4176358
CW
140 font-weight: bold;
141 }
5b46e216
CW
142 #mainTabContainer label.api-checkbox-label {
143 font-weight: normal;
144 }
145 #mainTabContainer h4 {
146 font-weight: bold;
147 font-size: 1.2em;
148 margin: .2em .2em 0.5em;
149 }
150 #api-join {
151 margin-top: 1em;
152 font-size: .8em;
153 }
154 #api-join ul {
155 margin: 0;
156 padding: 0 0 0.25em 2.5em;
157 }
2fa03859
CW
158 #api-join li > i {
159 opacity: .5;
160 }
161 #api-join li.join-enabled > i {
162 opacity: 1;
163 }
466fce54
CW
164 #api-join li.join-not-available {
165 font-style: italic;
166 }
e4176358
CW
167 #api-generated-wraper,
168 #api-result {
169 overflow: auto;
170 }
c275764e
CW
171 #api-explorer .api-options-row + .api-options-row label {
172 display: none;
173 }
174 .api-options-row td:first-child {
175 text-align: right;
176 }
8ffa1387
CW
177 .select2-choice .icon {
178 margin-top: .2em;
179 background-image: url("{/literal}{$config->resourceBase}{literal}/i/icons/jquery-ui-2786C2.png");
180 }
2b6e1174
CW
181 .select2-default .icon {
182 background-image: url("{/literal}{$config->resourceBase}{literal}/i/icons/jquery-ui-52534D.png");
183 opacity: .8;
184 }
5c7169eb
CW
185 .api-field-desc {
186 font-size: .8em;
187 color: #828282;
188 line-height: 1.3em;
189 }
29956c59
CW
190 .select2-highlighted .api-field-desc,
191 .select2-highlighted .crm-marker {
5c7169eb
CW
192 color: #fcfcfc;
193 }
194 .api-param-op[readonly] {
195 width: 4em;
196 }
2b6e1174
CW
197 pre ol.linenums li {
198 list-style-type: decimal;
199 color: #CFCFCF;
200 }
201 pre ol.linenums li:hover {
c8297314
CW
202 color: #828282;
203 background-color: #f2f2f2;
204 }
205 pre li.L1, pre li.L3, pre li.L5, pre li.L7, pre li.L9,
206 #api-generated td + td,
207 #mainTabContainer pre {
208 background-color: #f9f9f9;
2b6e1174 209 }
bc4aa590
CW
210 .api-doc-code {
211 margin-top: 1em;
212 border-top: 1px solid #d3d3d3;
213 }
214 .api-doc-code .collapsible-title {
215 font-weight: bold;
216 margin-top: .5em;
217 }
cf3a4f07
CW
218 .doc-filename {
219 text-align: right;
220 font-style: italic;
221 }
f78ce9c3 222 {/literal}
0c3a6e64
CW
223</style>
224
5cb39410 225<div class="crm-block crm-content-block">
89ee60d5
CW
226<div id="mainTabContainer">
227 <ul>
bc4aa590 228 <li class="ui-corner-all" title="GUI to build and execute API calls">
bcb052ae 229 <a href="#explorer-tab"><i class="crm-i fa-search"></i> {ts}Explorer{/ts}</a>
bc4aa590
CW
230 </li>
231 <li class="ui-corner-all" title="Auto-generated examples from the test suite">
bcb052ae 232 <a href="#examples-tab"><i class="crm-i fa-book"></i> {ts}Examples{/ts}</a>
bc4aa590
CW
233 </li>
234 <li class="ui-corner-all" title="API source-code and code-level documentation">
bcb052ae 235 <a href="#docs-tab"><i class="crm-i fa-code"></i> {ts}Code Docs{/ts}</a>
bc4aa590 236 </li>
89ee60d5 237 </ul>
0c3a6e64 238
89ee60d5 239 <div id="explorer-tab">
5cb39410 240 <div class="crm-block crm-form-block">
89ee60d5
CW
241 <form id="api-explorer">
242 <label for="api-entity">{ts}Entity{/ts}:</label>
243 <select class="crm-form-select big required" id="api-entity" name="entity">
244 <option value="" selected="selected">{ts}Choose{/ts}...</option>
bb6f7117 245 {crmAPI entity="Entity" var="entities"}
89ee60d5
CW
246 {foreach from=$entities.values item=entity}
247 <option value="{$entity}" {if !empty($entities.deprecated) && in_array($entity, $entities.deprecated)}class="strikethrough"{/if}>
248 {$entity}
249 </option>
250 {/foreach}
251 </select>
252 &nbsp;&nbsp;
253 <label for="api-action">{ts}Action{/ts}:</label>
254 <input class="crm-form-text" id="api-action" name="action" value="get">
255 &nbsp;&nbsp;
0c3a6e64 256
5b46e216 257 <label for="debug-checkbox" class="api-checkbox-label" title="{ts}Display debug output with results.{/ts}">
89ee60d5
CW
258 <input type="checkbox" class="crm-form-checkbox api-param-checkbox api-input" id="debug-checkbox" name="debug" value="1" >debug
259 </label>
260 &nbsp;|&nbsp;
261
5b46e216 262 <label for="sequential-checkbox" class="api-checkbox-label" title="{ts}Sequential is more compact format, well-suited for json and smarty.{/ts}">
89ee60d5
CW
263 <input type="checkbox" class="crm-form-checkbox api-param-checkbox api-input" id="sequential-checkbox" name="sequential" checked="checked" value="1">sequential
264 </label>
265
25ce04ec
CW
266 <div id="api-join" class="crm-form-block crm-collapsible collapsed" style="display:none;">
267 <h4 class="collapsible-title">{ts}Join on:{/ts} {help id='api-join'}</h4>
5b46e216
CW
268 <div></div>
269 </div>
270
89ee60d5
CW
271 <table id="api-params-table">
272 <thead style="display: none;">
273 <tr>
274 <th>{ts}Name{/ts} {help id='param-name'}</th>
275 <th>{ts}Operator{/ts} {help id='param-op'}</th>
276 <th>{ts}Value{/ts} {help id='param-value'}</th>
277 </tr>
278 </thead>
279 <tbody id="api-params"></tbody>
280 </table>
281 <div id="api-param-buttons" style="display: none;">
44f15f74
AH
282 <a href="#" class="crm-hover-button" id="api-params-add"><i class="crm-i fa-plus"></i> {ts}Add Parameter{/ts}</a>
283 <a href="#" class="crm-hover-button" id="api-option-add"><i class="crm-i fa-cog"></i> {ts}Add Option{/ts}</a>
284 <a href="#" class="crm-hover-button" id="api-chain-add"><i class="crm-i fa-link"></i> {ts}Chain API Call{/ts}</a>
5b46e216 285 {help id="api-chain"}
89ee60d5
CW
286 </div>
287 <div id="api-generated-wraper">
288 <table id="api-generated" border=1>
289 <caption>{ts}Code{/ts}</caption>
c8297314
CW
290 <tr><td>Rest</td><td><pre id="api-rest"></pre></td></tr>
291 <tr><td>Smarty</td><td><pre class="linenums" id="api-smarty" title='smarty syntax (for get actions)'></pre></td></tr>
292 <tr><td>Php</td><td><pre class="linenums" id="api-php" title='php syntax'></pre></td></tr>
293 <tr><td>Javascript</td><td><pre class="linenums" id="api-json" title='javascript syntax'></pre></td></tr>
c6691c94 294 <tr><td><a href="https://github.com/civicrm/cv" target="_blank">cv</a></td><td><pre id="api-cv" title='cv cli syntax'></pre></td></tr>
89ee60d5 295 {if $config->userSystem->is_drupal}
c6691c94 296 <tr><td><a href="http://www.drush.org/" target="_blank">drush</a></td><td><pre id="api-drush" title='drush syntax'></pre></td></tr>
89ee60d5
CW
297 {/if}
298 {if $config->userSystem->is_wordpress}
c6691c94 299 <tr><td><a href="http://wp-cli.org/" target="_blank">wp-cli</a></td><td><pre id="api-wpcli" title='wp-cli syntax'></pre></td></tr>
89ee60d5
CW
300 {/if}
301 </table>
302 </div>
303 <div class="crm-submit-buttons">
b84efe30
CW
304 <span class="crm-button crm-i-button">
305 <i class="crm-i fa-bolt"></i><input type="submit" value="{ts}Execute{/ts}" class="crm-form-submit" accesskey="S" title="{ts}Execute API call and display results{/ts}"/>
89ee60d5
CW
306 </span>
307 </div>
5cb39410 308
2b6e1174 309<pre id="api-result" class="linenums">
89ee60d5 310{ts}Results are displayed here.{/ts}
0c3a6e64 311</pre>
89ee60d5
CW
312 </form>
313 </div>
5cb39410 314 </div>
89ee60d5
CW
315
316 <div id="examples-tab">
5cb39410 317 <div class="crm-block crm-form-block">
89ee60d5
CW
318 <form id="api-examples">
319 <label for="example-entity">{ts}Entity{/ts}:</label>
320 <select class="crm-form-select big required" id="example-entity" name="entity">
321 <option value="" selected="selected">{ts}Choose{/ts}...</option>
322 {foreach from=$examples item=entity}
323 <option value="{$entity}" {if !empty($entities.deprecated) && in_array($entity, $entities.deprecated)}class="strikethrough"{/if}>
324 {$entity}
325 </option>
326 {/foreach}
327 </select>
328 &nbsp;&nbsp;
329 <label for="example-action">{ts}Example{/ts}:</label>
330 <select class="crm-form-select big crm-select2" id="example-action" name="action">
331 <option value="" selected="selected">{ts}Choose{/ts}...</option>
332 </select>
65f22b4b 333<pre id="example-result" class="linenums lang-php" placeholder="{ts escape='html'}Results are displayed here.{/ts}">
89ee60d5
CW
334{ts}Results are displayed here.{/ts}
335</pre>
336 </form>
337 </div>
5cb39410 338 </div>
bc4aa590
CW
339
340 <div id="docs-tab">
5cb39410 341 <div class="crm-block crm-form-block">
bc4aa590
CW
342 <form id="api-docs">
343 <label for="doc-entity">{ts}Entity{/ts}:</label>
344 <select class="crm-form-select big required" id="doc-entity" name="entity">
345 <option value="" selected="selected">{ts}Choose{/ts}...</option>
346 {foreach from=$entities.values item=entity}
347 <option value="{$entity}" {if !empty($entities.deprecated) && in_array($entity, $entities.deprecated)}class="strikethrough"{/if}>
348 {$entity}
349 </option>
350 {/foreach}
351 </select>
352 &nbsp;&nbsp;
353 <label for="doc-action">{ts}Action{/ts}:</label>
354 <select class="crm-form-select big crm-select2" id="doc-action" name="action">
355 <option value="" selected="selected">{ts}Choose{/ts}...</option>
356 </select>
65f22b4b 357 <div id="doc-result">
bc4aa590
CW
358 {ts}Results are displayed here.{/ts}
359 </div>
360 </form>
5cb39410 361 </div>
bc4aa590 362 </div>
89ee60d5 363</div>
5cb39410 364</div>
e4176358
CW
365{strip}
366<script type="text/template" id="api-param-tpl">
367 <tr class="api-param-row">
f87f9c74
CW
368 <td>
369 <i class="crm-i api-sort-handle fa-arrows"></i>
370 <input style="width: 90%;" class="crm-form-text api-param-name api-input" value="<%= name %>" placeholder="{ts}Parameter{/ts}" />
371 <div class="api-and-or"><span><span class="api-and">{ts}AND{/ts}</span> <i class="crm-i fa-toggle-on"></i> <span class="api-or">{ts}OR{/ts}</span></span></div>
372 </td>
e4176358 373 <td>
65b8c1db
CW
374 {literal}
375 <% if (noOps) { %>
376 <input class="crm-form-text api-param-op" value="=" readonly="true" title="{/literal}{ts}Other operators not available for this action.{/ts}{literal}" />
377 <% } else { %>
378 {/literal}
379 <select class="crm-form-select api-param-op">
380 {foreach from=$operators item='op'}
381 <option value="{$op|htmlspecialchars}">{$op|htmlspecialchars}</option>
382 {/foreach}
383 </select>
384 {literal}
385 <% } %>
386 {/literal}
e4176358
CW
387 </td>
388 <td>
2b6e1174 389 <input style="width: 85%;" class="crm-form-text api-param-value api-input" placeholder="{ts}Value{/ts}"/>
44f15f74 390 <a class="crm-hover-button api-param-remove" href="#"><i class="crm-i fa-times"></i></a>
e4176358
CW
391 </td>
392 </tr>
393</script>
8ffa1387 394
b07af612
CW
395<script type="text/template" id="api-return-tpl">
396 <tr class="api-return-row">
397 <td colspan="3">
29956c59
CW
398 <label for="api-return-value">
399 <%- title %>:
400 <% if(required) {ldelim} %> <span class="crm-marker">*</span> <% {rdelim} %>
401 </label> &nbsp;
b07af612 402 <input type="hidden" class="api-param-name" value="return" />
3a721dfc 403 <input style="width: 50%;" id="api-return-value" class="crm-form-text api-param-value api-input"/>
b07af612
CW
404 </td>
405 </tr>
406</script>
407
c275764e
CW
408<script type="text/template" id="api-options-tpl">
409 <tr class="api-options-row">
410 <td>
411 <label>{ts}Options{/ts}: &nbsp;</label>
412 </td>
413 <td>
1614ef7a 414 <input class="crm-form-text api-option-name api-input" style="width: 12em;" placeholder="{ts}Option{/ts}"/>
c275764e
CW
415 </td>
416 <td>
417 <input style="width: 85%;" class="crm-form-text api-option-value api-input" placeholder="{ts}Value{/ts}"/>
44f15f74 418 <a class="crm-hover-button api-param-remove" href="#"><i class="crm-i fa-times"></i></a>
c275764e
CW
419 </td>
420 </tr>
421</script>
422
8ffa1387
CW
423<script type="text/template" id="api-chain-tpl">
424 <tr class="api-chain-row">
425 <td>
f87f9c74
CW
426 <i class="crm-i api-sort-handle fa-arrows"></i>
427 <select style="width: 90%;" class="crm-form-select api-chain-entity">
8ffa1387
CW
428 <option value=""></option>
429 {foreach from=$entities.values item=entity}
3d9f5b7f
CW
430 <option value="{$entity}" {if !empty($entities.deprecated) && in_array($entity, $entities.deprecated)}class="strikethrough"{/if}>
431 {$entity}
432 </option>
8ffa1387
CW
433 {/foreach}
434 </select>
435 </td>
436 <td>
437 <select class="crm-form-select api-chain-action">
2b6e1174 438 <option value="get">get</option>
3d9f5b7f 439 </select>
8ffa1387
CW
440 </td>
441 <td>
d5be719d 442 <input style="width: 85%;" class="crm-form-text api-param-value api-input" value="{ldelim}{rdelim}" placeholder="{ts}API Params{/ts}"/>
44f15f74 443 <a class="crm-hover-button api-param-remove" href="#"><i class="crm-i fa-times"></i></a>
8ffa1387
CW
444 </td>
445 </tr>
446</script>
bc4aa590
CW
447
448<script type="text/template" id="doc-code-tpl">
449 <div class="crm-collapsible collapsed api-doc-code">
450 <div class="collapsible-title">{ts}Source Code{/ts}</div>
cf3a4f07
CW
451 <div>
452 <div class="doc-filename"><%- file %></div>
1080dff4 453 <pre class="lang-php linenums"><%- code %></pre>
cf3a4f07 454 </div>
bc4aa590
CW
455 </div>
456</script>
5b46e216
CW
457
458<script type="text/template" id="join-tpl">
459 {literal}
460 <ul class="fa-ul">
461 <% _.forEach(joins, function(join, name) { %>
466fce54 462 <li <% if(join.checked) { %>class="join-enabled"<% } if(join.disabled) { %>class="join-not-available"<% }%>>
5b46e216
CW
463 <i class="fa-li crm-i fa-reply fa-rotate-180"></i>
464 <label for="select-join-<%= name %>" class="api-checkbox-label">
466fce54 465 <input type="checkbox" id="select-join-<%= name %>" value="<%= name %>" data-entity="<%= join.entity %>" <% if(join.checked) { %>checked<% } if(join.disabled) { %>disabled<% } %>/>
5b46e216
CW
466 <%- join.title %>
467 </label>
468 </li>
469 <% if(join.children) print(tpl({joins: join.children, tpl: tpl})); %>
470 <% }); %>
471 </ul>
472 {/literal}
473</script>
e4176358 474{/strip}