Api Explorer - rewrite for 4.5
[civicrm-core.git] / templates / CRM / Admin / Page / APIExplorer.tpl
CommitLineData
e4176358
CW
1{*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
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}
e4176358
CW
28 #api-result {
29 background: #d9d9d9;
30 padding:1em;
31 max-height: 50em;
32 }
33 #api-params-table th:first-child,
34 #api-params-table td:first-child {
35 width: 35%;
36 }
37 #api-params-table td:first-child + td,
38 #api-params-table th:first-child + th {
39 width: 10em;
40 }
41 #api-params {
42 min-height: 1em;
43 }
44 #api-params .red-icon {
45 margin-top: .5em;
46 }
47 #api-generated td:first-child {
48 width: 10em;
49 }
50 #api-explorer label {
51 display:inline;
52 font-weight: bold;
53 }
54 #api-explorer pre {
55 line-height: 1.3em;
56 font-size: 11px;
57 margin: 0;
58 }
59 #api-generated-wraper,
60 #api-result {
61 overflow: auto;
62 }
f78ce9c3 63 {/literal}
0c3a6e64
CW
64</style>
65
f78ce9c3 66<form id="api-explorer">
e4176358
CW
67 <label for="api-entity">{ts}Entity{/ts}:</label>
68 <select class="crm-form-select crm-select2" id="api-entity" name="entity">
69 <option value="" selected="selected">{ts}Choose{/ts}...</option>
f78ce9c3
CW
70 {crmAPI entity="Entity" action="get" var="entities" version=3}
71 {foreach from=$entities.values item=entity}
72 <option value="{$entity}">{$entity}</option>
73 {/foreach}
74 </select>
e4176358
CW
75 &nbsp;&nbsp;
76 <label for="api-action">{ts}Action{/ts}:</label>
77 <select class="crm-form-select crm-select2" id="api-action" name="action">
78 <option value="get" selected="selected">get</option>
f78ce9c3
CW
79 <option value="create" title="used to update as well, if id is set">create</option>
80 <option value="delete">delete</option>
81 <option value="getfields">getfields</option>
82 <option value="getactions">getactions</option>
83 <option value="getcount">getcount</option>
84 <option value="getsingle">getsingle</option>
85 <option value="getvalue">getvalue</option>
86 <option value="getoptions">getoptions</option>
87 <option value="getlist">getlist</option>
88 </select>
e4176358 89 &nbsp;&nbsp;
0c3a6e64 90
e4176358
CW
91 <label for="debug-checkbox" title="{ts}Display debug output with results.{/ts}">
92 <input type="checkbox" class="crm-form-checkbox api-param-checkbox" id="debug-checkbox" name="debug" checked="checked" value="1" >debug
f78ce9c3
CW
93 </label>
94 &nbsp;|&nbsp;
0c3a6e64 95
e4176358
CW
96 <label for="sequential-checkbox" title="{ts}Sequential is more compact format, well-suited for json and smarty.{/ts}">
97 <input type="checkbox" class="crm-form-checkbox api-param-checkbox" id="sequential-checkbox" name="sequential" checked="checked" value="1">sequential
f78ce9c3 98 </label>
0c3a6e64 99
e4176358
CW
100 <table id="api-params-table">
101 <thead style="display: none;">
102 <tr>
103 <th>{ts}Name{/ts} {help id='param-name'}</th>
104 <th>{ts}Operator{/ts} {help id='param-op'}</th>
105 <th>{ts}Value{/ts} {help id='param-value'}</th>
106 </tr>
107 </thead>
108 <tbody id="api-params"></tbody>
f78ce9c3 109 </table>
e4176358
CW
110 <div>
111 <a href="#" class="crm-hover-button" id="api-params-add" style="display: none;"><span class="icon ui-icon-plus"></span>{ts}Add Parameter{/ts}</a>
112 </div>
113 <div id="api-generated-wraper">
114 <table id="api-generated" border=1>
115 <caption>{ts}Code{/ts}</caption>
116 <tr><td>Rest</td><td><pre id="api-rest"></pre></td></tr>
117 <tr><td>Smarty</td><td><pre id="api-smarty" title='smarty syntax (for get actions)'></pre></td></tr>
118 <tr><td>Php</td><td><pre id="api-php" title='php syntax'></pre></td></tr>
119 <tr><td>Javascript</td><td><pre id="api-json" title='javascript syntax'></pre></td></tr>
120 </table>
121 </div>
122 <input type="submit" value="{ts}Execute{/ts}" class="form-submit"/>
123<pre id="api-result">
124{ts}The result of api calls are displayed in this area.{/ts}
0c3a6e64 125</pre>
f78ce9c3 126</form>
e4176358
CW
127{strip}
128<script type="text/template" id="api-param-tpl">
129 <tr class="api-param-row">
130 <td><input style="width: 100%;" class="crm-form-text api-param-name" value="<%= name %>" placeholder="{ts}Parameter{/ts}" /></td>
131 <td>
132 <select class="crm-form-select api-param-op">
133 {foreach from=$operators item='op'}
134 <option value="{$op|htmlspecialchars}">{$op|htmlspecialchars}</option>
135 {/foreach}
136 </select>
137 </td>
138 <td>
139 <input style="width: 85%;" class="crm-form-text api-param-value" placeholder="{ts}Value{/ts}"/>
140 <a class="crm-hover-button api-param-remove" href="#"><span class="icon ui-icon-close"></span></a>
141 </td>
142 </tr>
143</script>
144{/strip}