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