Merge pull request #2924 from colemanw/explorer
[civicrm-core.git] / templates / CRM / Admin / Page / APIExplorer.tpl
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 *}
26 <style>
27 {literal}
28 #api-explorer pre {
29 line-height: 1.3em;
30 font-size: 11px;
31 margin: 0;
32 border: 0 none;
33 }
34 pre#api-result {
35 padding:1em;
36 max-height: 50em;
37 border: 1px solid lightgrey;
38 }
39 #api-params-table th:first-child,
40 #api-params-table td:first-child {
41 width: 35%;
42 }
43 #api-params-table td:first-child + td,
44 #api-params-table th:first-child + th {
45 width: 10em;
46 }
47 #api-params {
48 min-height: 1em;
49 }
50 #api-params .red-icon {
51 margin-top: .5em;
52 }
53 #api-generated td:first-child {
54 width: 10em;
55 }
56 #api-explorer label {
57 display:inline;
58 font-weight: bold;
59 }
60 #api-generated-wraper,
61 #api-result {
62 overflow: auto;
63 }
64 .select2-choice .icon {
65 margin-top: .2em;
66 background-image: url("{/literal}{$config->resourceBase}{literal}/i/icons/jquery-ui-2786C2.png");
67 }
68 .select2-default .icon {
69 background-image: url("{/literal}{$config->resourceBase}{literal}/i/icons/jquery-ui-52534D.png");
70 opacity: .8;
71 }
72 pre ol.linenums li {
73 list-style-type: decimal;
74 color: #CFCFCF;
75 }
76 pre ol.linenums li:hover {
77 color: #9c9c9c;
78 }
79 {/literal}
80 </style>
81
82 <form id="api-explorer">
83 <label for="api-entity">{ts}Entity{/ts}:</label>
84 <select class="crm-form-select crm-select2" id="api-entity" name="entity">
85 <option value="" selected="selected">{ts}Choose{/ts}...</option>
86 {crmAPI entity="Entity" action="get" var="entities" version=3}
87 {foreach from=$entities.values item=entity}
88 <option value="{$entity}">{$entity}</option>
89 {/foreach}
90 </select>
91 &nbsp;&nbsp;
92 <label for="api-action">{ts}Action{/ts}:</label>
93 <input class="crm-form-text" id="api-action" name="action" value="get">
94 &nbsp;&nbsp;
95
96 <label for="debug-checkbox" title="{ts}Display debug output with results.{/ts}">
97 <input type="checkbox" class="crm-form-checkbox api-param-checkbox api-input" id="debug-checkbox" name="debug" checked="checked" value="1" >debug
98 </label>
99 &nbsp;|&nbsp;
100
101 <label for="sequential-checkbox" title="{ts}Sequential is more compact format, well-suited for json and smarty.{/ts}">
102 <input type="checkbox" class="crm-form-checkbox api-param-checkbox api-input" id="sequential-checkbox" name="sequential" checked="checked" value="1">sequential
103 </label>
104
105 <table id="api-params-table">
106 <thead style="display: none;">
107 <tr>
108 <th>{ts}Name{/ts} {help id='param-name'}</th>
109 <th>{ts}Operator{/ts} {help id='param-op'}</th>
110 <th>{ts}Value{/ts} {help id='param-value'}</th>
111 </tr>
112 </thead>
113 <tbody id="api-params"></tbody>
114 </table>
115 <div id="api-param-buttons" style="display: none;">
116 <a href="#" class="crm-hover-button" id="api-params-add"><span class="icon ui-icon-plus"></span>{ts}Add Parameter{/ts}</a>
117 <a href="#" class="crm-hover-button" id="api-chain-add"><span class="icon ui-icon-link"></span>{ts}Chain API Call{/ts}</a>
118 </div>
119 <div id="api-generated-wraper">
120 <table id="api-generated" border=1>
121 <caption>{ts}Code{/ts}</caption>
122 <tr><td>Rest</td><td><pre class="prettyprint linenums" id="api-rest"></pre></td></tr>
123 <tr><td>Smarty</td><td><pre class="prettyprint linenums" id="api-smarty" title='smarty syntax (for get actions)'></pre></td></tr>
124 <tr><td>Php</td><td><pre class="prettyprint linenums" id="api-php" title='php syntax'></pre></td></tr>
125 <tr><td>Javascript</td><td><pre class="prettyprint linenums" id="api-json" title='javascript syntax'></pre></td></tr>
126 </table>
127 </div>
128 <input type="submit" value="{ts}Execute{/ts}" class="form-submit"/>
129 <pre id="api-result" class="linenums">
130 {ts}The result of api calls are displayed in this area.{/ts}
131 </pre>
132 </form>
133
134 {strip}
135 <script type="text/template" id="api-param-tpl">
136 <tr class="api-param-row">
137 <td><input style="width: 100%;" class="crm-form-text api-param-name api-input" value="<%= name %>" placeholder="{ts}Parameter{/ts}" /></td>
138 <td>
139 <select class="crm-form-select api-param-op">
140 {foreach from=$operators item='op'}
141 <option value="{$op|htmlspecialchars}">{$op|htmlspecialchars}</option>
142 {/foreach}
143 </select>
144 </td>
145 <td>
146 <input style="width: 85%;" class="crm-form-text api-param-value api-input" placeholder="{ts}Value{/ts}"/>
147 <a class="crm-hover-button api-param-remove" href="#"><span class="icon ui-icon-close"></span></a>
148 </td>
149 </tr>
150 </script>
151
152 <script type="text/template" id="api-chain-tpl">
153 <tr class="api-chain-row">
154 <td>
155 <select style="width: 100%;" class="crm-form-select api-chain-entity">
156 <option value=""></option>
157 {foreach from=$entities.values item=entity}
158 <option value="{$entity}">{$entity}</option>
159 {/foreach}
160 </select>
161 </td>
162 <td>
163 <select class="crm-form-select api-chain-action">
164 <option value="get">get</option>
165 <option value="getsingle">getsingle</option>
166 <option value="getcount">getcount</option>
167 <option value="create">create</option>
168 <option value="delete">delete</option>
169 </select>
170 </td>
171 <td>
172 <input style="width: 85%;" class="crm-form-text api-param-value api-input" value="{ldelim}{rdelim}" placeholder="{ts}Api Params{/ts}"/>
173 <a class="crm-hover-button api-param-remove" href="#"><span class="icon ui-icon-close"></span></a>
174 </td>
175 </tr>
176 </script>
177 {/strip}