Ian province abbreviation patch - issue 724
[civicrm-core.git] / templates / CRM / Admin / Page / APIExplorer.tpl
CommitLineData
e4176358
CW
1{*
2 +--------------------------------------------------------------------+
2c4c49ca 3 | CiviCRM version 4.7 |
e4176358 4 +--------------------------------------------------------------------+
e7112fa7 5 | Copyright CiviCRM LLC (c) 2004-2015 |
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
CW
28 #mainTabContainer {
29 background: transparent;
30 border: 0 none;
31 }
32 #mainTabContainer pre {
c8297314 33 line-height: 14px;
2b6e1174
CW
34 font-size: 11px;
35 margin: 0;
36 border: 0 none;
37 }
89ee60d5
CW
38 #mainTabContainer ul.ui-tabs-nav {
39 font-size: 1.1em;
40 margin-bottom: .6em;
41 }
65f22b4b
CW
42 pre#api-result {
43 max-height: 50em;
44 }
89ee60d5 45 pre#api-result,
bc4aa590 46 div#doc-result,
89ee60d5 47 pre#example-result {
e4176358 48 padding:1em;
2b6e1174 49 border: 1px solid lightgrey;
89ee60d5
CW
50 margin-top: 1em;
51 overflow: auto;
e4176358
CW
52 }
53 #api-params-table th:first-child,
54 #api-params-table td:first-child {
55 width: 35%;
67a63bd3
CW
56 min-width: 190px;
57 }
58 #api-params-table td[colspan] {
59 width: 100%;
e4176358
CW
60 }
61 #api-params-table td:first-child + td,
67a63bd3
CW
62 #api-params-table th:first-child + th {
63 width: 140px;
64 }
65 #api-params-table td:first-child + td select {
66 width: 132px;
67 }
68 #api-params-table td:first-child + td + td,
69 #api-params-table th:first-child + th + th {
70 width: 65%
71 }
126a565b 72 #api-generated td:first-child {
67a63bd3 73 width: 60px;
e4176358
CW
74 }
75 #api-params {
76 min-height: 1em;
77 }
78 #api-params .red-icon {
79 margin-top: .5em;
80 }
67a63bd3
CW
81 .api-param-remove {
82 float: right;
83 }
89ee60d5 84 #mainTabContainer label {
c275764e 85 display: inline;
e4176358
CW
86 font-weight: bold;
87 }
e4176358
CW
88 #api-generated-wraper,
89 #api-result {
90 overflow: auto;
91 }
c275764e
CW
92 #api-explorer .api-options-row + .api-options-row label {
93 display: none;
94 }
95 .api-options-row td:first-child {
96 text-align: right;
97 }
8ffa1387
CW
98 .select2-choice .icon {
99 margin-top: .2em;
100 background-image: url("{/literal}{$config->resourceBase}{literal}/i/icons/jquery-ui-2786C2.png");
101 }
2b6e1174
CW
102 .select2-default .icon {
103 background-image: url("{/literal}{$config->resourceBase}{literal}/i/icons/jquery-ui-52534D.png");
104 opacity: .8;
105 }
5c7169eb
CW
106 .api-field-desc {
107 font-size: .8em;
108 color: #828282;
109 line-height: 1.3em;
110 }
29956c59
CW
111 .select2-highlighted .api-field-desc,
112 .select2-highlighted .crm-marker {
5c7169eb
CW
113 color: #fcfcfc;
114 }
115 .api-param-op[readonly] {
116 width: 4em;
117 }
2b6e1174
CW
118 pre ol.linenums li {
119 list-style-type: decimal;
120 color: #CFCFCF;
121 }
122 pre ol.linenums li:hover {
c8297314
CW
123 color: #828282;
124 background-color: #f2f2f2;
125 }
126 pre li.L1, pre li.L3, pre li.L5, pre li.L7, pre li.L9,
127 #api-generated td + td,
128 #mainTabContainer pre {
129 background-color: #f9f9f9;
2b6e1174 130 }
bc4aa590
CW
131 .api-doc-code {
132 margin-top: 1em;
133 border-top: 1px solid #d3d3d3;
134 }
135 .api-doc-code .collapsible-title {
136 font-weight: bold;
137 margin-top: .5em;
138 }
cf3a4f07
CW
139 .doc-filename {
140 text-align: right;
141 font-style: italic;
142 }
f78ce9c3 143 {/literal}
0c3a6e64
CW
144</style>
145
89ee60d5
CW
146<div id="mainTabContainer">
147 <ul>
bc4aa590
CW
148 <li class="ui-corner-all" title="GUI to build and execute API calls">
149 <a href="#explorer-tab">{ts}Explorer{/ts}</a>
150 </li>
151 <li class="ui-corner-all" title="Auto-generated examples from the test suite">
152 <a href="#examples-tab">{ts}Examples{/ts}</a>
153 </li>
154 <li class="ui-corner-all" title="API source-code and code-level documentation">
155 <a href="#docs-tab">{ts}Code Docs{/ts}</a>
156 </li>
89ee60d5 157 </ul>
0c3a6e64 158
89ee60d5 159 <div id="explorer-tab">
0c3a6e64 160
89ee60d5
CW
161 <form id="api-explorer">
162 <label for="api-entity">{ts}Entity{/ts}:</label>
163 <select class="crm-form-select big required" id="api-entity" name="entity">
164 <option value="" selected="selected">{ts}Choose{/ts}...</option>
bb6f7117 165 {crmAPI entity="Entity" var="entities"}
89ee60d5
CW
166 {foreach from=$entities.values item=entity}
167 <option value="{$entity}" {if !empty($entities.deprecated) && in_array($entity, $entities.deprecated)}class="strikethrough"{/if}>
168 {$entity}
169 </option>
170 {/foreach}
171 </select>
172 &nbsp;&nbsp;
173 <label for="api-action">{ts}Action{/ts}:</label>
174 <input class="crm-form-text" id="api-action" name="action" value="get">
175 &nbsp;&nbsp;
0c3a6e64 176
89ee60d5
CW
177 <label for="debug-checkbox" title="{ts}Display debug output with results.{/ts}">
178 <input type="checkbox" class="crm-form-checkbox api-param-checkbox api-input" id="debug-checkbox" name="debug" value="1" >debug
179 </label>
180 &nbsp;|&nbsp;
181
182 <label for="sequential-checkbox" title="{ts}Sequential is more compact format, well-suited for json and smarty.{/ts}">
183 <input type="checkbox" class="crm-form-checkbox api-param-checkbox api-input" id="sequential-checkbox" name="sequential" checked="checked" value="1">sequential
184 </label>
185
186 <table id="api-params-table">
187 <thead style="display: none;">
188 <tr>
189 <th>{ts}Name{/ts} {help id='param-name'}</th>
190 <th>{ts}Operator{/ts} {help id='param-op'}</th>
191 <th>{ts}Value{/ts} {help id='param-value'}</th>
192 </tr>
193 </thead>
194 <tbody id="api-params"></tbody>
195 </table>
196 <div id="api-param-buttons" style="display: none;">
197 <a href="#" class="crm-hover-button" id="api-params-add"><span class="icon ui-icon-plus"></span>{ts}Add Parameter{/ts}</a>
198 <a href="#" class="crm-hover-button" id="api-option-add"><span class="icon ui-icon-gear"></span>{ts}Add Option{/ts}</a>
199 <a href="#" class="crm-hover-button" id="api-chain-add"><span class="icon ui-icon-link"></span>{ts}Chain API Call{/ts}</a>
200 </div>
201 <div id="api-generated-wraper">
202 <table id="api-generated" border=1>
203 <caption>{ts}Code{/ts}</caption>
c8297314
CW
204 <tr><td>Rest</td><td><pre id="api-rest"></pre></td></tr>
205 <tr><td>Smarty</td><td><pre class="linenums" id="api-smarty" title='smarty syntax (for get actions)'></pre></td></tr>
206 <tr><td>Php</td><td><pre class="linenums" id="api-php" title='php syntax'></pre></td></tr>
207 <tr><td>Javascript</td><td><pre class="linenums" id="api-json" title='javascript syntax'></pre></td></tr>
89ee60d5 208 {if $config->userSystem->is_drupal}
c8297314 209 <tr><td>Drush</td><td><pre id="api-drush" title='drush syntax'></pre></td></tr>
89ee60d5
CW
210 {/if}
211 {if $config->userSystem->is_wordpress}
c8297314 212 <tr><td>WP-CLI</td><td><pre id="api-wpcli" title='wp-cli syntax'></pre></td></tr>
89ee60d5
CW
213 {/if}
214 </table>
215 </div>
216 <div class="crm-submit-buttons">
217 <span class="crm-button crm-icon-button">
218 <span class="crm-button-icon ui-icon-check"> </span> <input type="submit" value="{ts}Execute{/ts}" class="crm-form-submit" accesskey="S" title="{ts}Execute API call and display results{/ts}"/>
219 </span>
220 </div>
2b6e1174 221<pre id="api-result" class="linenums">
89ee60d5 222{ts}Results are displayed here.{/ts}
0c3a6e64 223</pre>
89ee60d5
CW
224 </form>
225 </div>
226
227 <div id="examples-tab">
228 <form id="api-examples">
229 <label for="example-entity">{ts}Entity{/ts}:</label>
230 <select class="crm-form-select big required" id="example-entity" name="entity">
231 <option value="" selected="selected">{ts}Choose{/ts}...</option>
232 {foreach from=$examples item=entity}
233 <option value="{$entity}" {if !empty($entities.deprecated) && in_array($entity, $entities.deprecated)}class="strikethrough"{/if}>
234 {$entity}
235 </option>
236 {/foreach}
237 </select>
238 &nbsp;&nbsp;
239 <label for="example-action">{ts}Example{/ts}:</label>
240 <select class="crm-form-select big crm-select2" id="example-action" name="action">
241 <option value="" selected="selected">{ts}Choose{/ts}...</option>
242 </select>
65f22b4b 243<pre id="example-result" class="linenums lang-php" placeholder="{ts escape='html'}Results are displayed here.{/ts}">
89ee60d5
CW
244{ts}Results are displayed here.{/ts}
245</pre>
246 </form>
247 </div>
bc4aa590
CW
248
249 <div id="docs-tab">
250 <form id="api-docs">
251 <label for="doc-entity">{ts}Entity{/ts}:</label>
252 <select class="crm-form-select big required" id="doc-entity" name="entity">
253 <option value="" selected="selected">{ts}Choose{/ts}...</option>
254 {foreach from=$entities.values item=entity}
255 <option value="{$entity}" {if !empty($entities.deprecated) && in_array($entity, $entities.deprecated)}class="strikethrough"{/if}>
256 {$entity}
257 </option>
258 {/foreach}
259 </select>
260 &nbsp;&nbsp;
261 <label for="doc-action">{ts}Action{/ts}:</label>
262 <select class="crm-form-select big crm-select2" id="doc-action" name="action">
263 <option value="" selected="selected">{ts}Choose{/ts}...</option>
264 </select>
65f22b4b 265 <div id="doc-result">
bc4aa590
CW
266 {ts}Results are displayed here.{/ts}
267 </div>
268 </form>
269 </div>
89ee60d5 270</div>
2b6e1174 271
e4176358
CW
272{strip}
273<script type="text/template" id="api-param-tpl">
274 <tr class="api-param-row">
2b6e1174 275 <td><input style="width: 100%;" class="crm-form-text api-param-name api-input" value="<%= name %>" placeholder="{ts}Parameter{/ts}" /></td>
e4176358 276 <td>
65b8c1db
CW
277 {literal}
278 <% if (noOps) { %>
279 <input class="crm-form-text api-param-op" value="=" readonly="true" title="{/literal}{ts}Other operators not available for this action.{/ts}{literal}" />
280 <% } else { %>
281 {/literal}
282 <select class="crm-form-select api-param-op">
283 {foreach from=$operators item='op'}
284 <option value="{$op|htmlspecialchars}">{$op|htmlspecialchars}</option>
285 {/foreach}
286 </select>
287 {literal}
288 <% } %>
289 {/literal}
e4176358
CW
290 </td>
291 <td>
2b6e1174 292 <input style="width: 85%;" class="crm-form-text api-param-value api-input" placeholder="{ts}Value{/ts}"/>
e4176358
CW
293 <a class="crm-hover-button api-param-remove" href="#"><span class="icon ui-icon-close"></span></a>
294 </td>
295 </tr>
296</script>
8ffa1387 297
b07af612
CW
298<script type="text/template" id="api-return-tpl">
299 <tr class="api-return-row">
300 <td colspan="3">
29956c59
CW
301 <label for="api-return-value">
302 <%- title %>:
303 <% if(required) {ldelim} %> <span class="crm-marker">*</span> <% {rdelim} %>
304 </label> &nbsp;
b07af612 305 <input type="hidden" class="api-param-name" value="return" />
3a721dfc 306 <input style="width: 50%;" id="api-return-value" class="crm-form-text api-param-value api-input"/>
b07af612
CW
307 </td>
308 </tr>
309</script>
310
c275764e
CW
311<script type="text/template" id="api-options-tpl">
312 <tr class="api-options-row">
313 <td>
314 <label>{ts}Options{/ts}: &nbsp;</label>
315 </td>
316 <td>
1614ef7a 317 <input class="crm-form-text api-option-name api-input" style="width: 12em;" placeholder="{ts}Option{/ts}"/>
c275764e
CW
318 </td>
319 <td>
320 <input style="width: 85%;" class="crm-form-text api-option-value api-input" placeholder="{ts}Value{/ts}"/>
321 <a class="crm-hover-button api-param-remove" href="#"><span class="icon ui-icon-close"></span></a>
322 </td>
323 </tr>
324</script>
325
8ffa1387
CW
326<script type="text/template" id="api-chain-tpl">
327 <tr class="api-chain-row">
328 <td>
2b6e1174 329 <select style="width: 100%;" class="crm-form-select api-chain-entity">
8ffa1387
CW
330 <option value=""></option>
331 {foreach from=$entities.values item=entity}
3d9f5b7f
CW
332 <option value="{$entity}" {if !empty($entities.deprecated) && in_array($entity, $entities.deprecated)}class="strikethrough"{/if}>
333 {$entity}
334 </option>
8ffa1387
CW
335 {/foreach}
336 </select>
337 </td>
338 <td>
339 <select class="crm-form-select api-chain-action">
2b6e1174 340 <option value="get">get</option>
3d9f5b7f 341 </select>
8ffa1387
CW
342 </td>
343 <td>
d5be719d 344 <input style="width: 85%;" class="crm-form-text api-param-value api-input" value="{ldelim}{rdelim}" placeholder="{ts}API Params{/ts}"/>
8ffa1387
CW
345 <a class="crm-hover-button api-param-remove" href="#"><span class="icon ui-icon-close"></span></a>
346 </td>
347 </tr>
348</script>
bc4aa590
CW
349
350<script type="text/template" id="doc-code-tpl">
351 <div class="crm-collapsible collapsed api-doc-code">
352 <div class="collapsible-title">{ts}Source Code{/ts}</div>
cf3a4f07
CW
353 <div>
354 <div class="doc-filename"><%- file %></div>
1080dff4 355 <pre class="lang-php linenums"><%- code %></pre>
cf3a4f07 356 </div>
bc4aa590
CW
357 </div>
358</script>
e4176358 359{/strip}