Commit | Line | Data |
---|---|---|
19b53e5b C |
1 | <div id="bootstrap-theme" class="api4-explorer-page"> |
2 | <div crm-ui-debug="availableParams"></div> | |
3 | ||
4 | <h1 crm-page-title> | |
f9c5f498 | 5 | {{:: ts('CiviCRM APIv4') }}{{ entity ? (' (' + entity + '::' + action + ')') : '' }} |
19b53e5b C |
6 | </h1> |
7 | ||
19b53e5b C |
8 | <div class="api4-explorer-row"> |
9 | <form name="api4-explorer" class="panel panel-default explorer-params-panel"> | |
10 | <div class="panel-heading"> | |
11 | <div class="form-inline"> | |
9cea3619 | 12 | <span ng-mouseenter="help('entity', paramDoc('$entity'))" ng-mouseleave="help()"> |
4cd69277 | 13 | <input class="collapsible-optgroups form-control" ng-model="entity" ng-disabled="!entities.length" ng-class="{loading: !entities.length}" crm-ui-select="::{placeholder: ts('Entity'), data: entities}" /> |
9cea3619 CW |
14 | </span> |
15 | <span ng-mouseenter="help('action', paramDoc('$action'))" ng-mouseleave="help()"> | |
4cd69277 | 16 | <input class="collapsible-optgroups form-control" ng-model="action" ng-disabled="!entity || !actions.length" ng-class="{loading: entity && !actions.length}" crm-ui-select="::{placeholder: ts('Action'), data: actions}" /> |
9cea3619 | 17 | </span> |
f9c5f498 CW |
18 | <input class="form-control api4-index" type="search" ng-model="index" ng-mouseenter="help('index', paramDoc('$index'))" ng-mouseleave="help()" placeholder="{{:: ts('Index') }}" /> |
19 | <button class="btn btn-success pull-right" crm-icon="fa-bolt" ng-disabled="!entity || !action || loading" ng-click="execute()" ng-mouseenter="help(ts('Execute'), executeDoc())" ng-mouseleave="help()">{{:: ts('Execute') }}</button> | |
48102254 | 20 | <button class="btn btn-primary pull-right" crm-icon="fa-save" ng-show="perm.editGroups && action === 'get'" ng-click="save()" ng-mouseenter="help(ts('Save smart group'), saveDoc())" ng-mouseleave="help()">{{:: ts('Save...') }}</button> |
19b53e5b C |
21 | </div> |
22 | </div> | |
23 | <div class="panel-body"> | |
24 | <div class="api4-input form-inline"> | |
0e7a5135 CW |
25 | <div class="checkbox-inline form-control" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-repeat="(name, param) in ::getGenericParams(['bool'], false)"> |
26 | <label> | |
27 | <input type="checkbox" id="api4-param-{{:: name }}" ng-model="params[name]"/> | |
28 | <span>{{:: name }}</span><span class="crm-marker" ng-if="::param.required"> *</span> | |
29 | </label> | |
30 | </div> | |
31 | <div class="checkbox-inline form-control" ng-mouseenter="help('selectRowCount', availableParams.select)" ng-mouseleave="help()" ng-if="::availableParams.select"> | |
32 | <label> | |
33 | <input type="checkbox" id="api4-param-selectRowCount" ng-checked="isSelectRowCount()" ng-click="selectRowCount()" /> | |
34 | <span>SelectRowCount</span> | |
35 | </label> | |
36 | </div> | |
19b53e5b | 37 | </div> |
8f38d9e9 | 38 | <div class="api4-input form-inline" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-repeat="(name, param) in ::getGenericParams(['bool'], true)"> |
f28caa2c | 39 | <label>{{ name }}<span class="crm-marker" ng-if="::param.required"> *</span></label> |
19b53e5b C |
40 | <label class="radio-inline"> |
41 | <input type="radio" ng-model="params[name]" ng-value="true" />true | |
42 | </label> | |
43 | <label class="radio-inline"> | |
44 | <input type="radio" ng-model="params[name]" ng-value="false" />false | |
45 | </label> | |
13a3d214 | 46 | <a href class="crm-hover-button" title="Clear" ng-click="clearParam(name)" ng-show="params[name] !== null"><i class="crm-i fa-times" aria-hidden="true"></i></a> |
19b53e5b | 47 | </div> |
651c4c95 | 48 | <fieldset class="api4-input form-inline" ng-mouseenter="help('select', availableParams.select)" ng-mouseleave="help()" ng-if="availableParams.select"> |
4cd69277 | 49 | <legend>select<span class="crm-marker" ng-if="::availableParams.select.required"> *</span></legend> |
292c1648 | 50 | <div ng-model="params.select" ui-sortable="{axis: 'y'}"> |
651c4c95 | 51 | <div class="api4-input form-inline" ng-repeat="item in params.select track by $index" ng-show="item !== 'row_count'"> |
13a3d214 | 52 | <i class="crm-i fa-arrows" aria-hidden="true"></i> |
a26e006b | 53 | <input class="form-control huge" type="text" ng-model="params.select[$index]" /> |
13a3d214 | 54 | <a href class="crm-hover-button" title="Clear" ng-click="clearParam('select', $index)"><i class="crm-i fa-times" aria-hidden="true"></i></a> |
292c1648 CW |
55 | </div> |
56 | </div> | |
57 | <div class="api4-input form-inline"> | |
a26e006b | 58 | <input class="collapsible-optgroups form-control huge" ng-model="controls.select" crm-ui-select="{data: fieldsAndJoinsAndFunctionsAndWildcards}" placeholder="Add select" /> |
292c1648 CW |
59 | </div> |
60 | </fieldset> | |
af6f5ac8 | 61 | <fieldset id="api4-join-fieldset" class="api4-input form-inline" ng-mouseenter="help('join', availableParams.join)" ng-mouseleave="help()" ng-if="::availableParams.join"> |
c2d3af50 | 62 | <legend>join<span class="crm-marker" ng-if="::availableParams.join.required"> *</span></legend> |
af6f5ac8 CW |
63 | <div ng-model="params.join" ui-sortable="{axis: 'y', containment: '#api4-join-fieldset'}"> |
64 | <fieldset ng-repeat="item in params.join track by $index"> | |
65 | <div class="api4-input form-inline"> | |
66 | <i class="crm-i fa-arrows"></i> | |
f54beb1e | 67 | <input class="form-control twenty" type="text" ng-model="params.join[$index][0]" ng-model-options="{updateOn: 'blur'}" ng-change="$ctrl.buildFieldList()"/> |
90908aac | 68 | <label>{{:: ts('Required:') }}</label> |
af6f5ac8 | 69 | <select class="form-control" ng-model="params.join[$index][1]" ng-options="o.k as o.v for o in ::joinTypes" ></select> |
90908aac CW |
70 | <label>{{:: ts('Using:') }}</label> |
71 | <select class="form-control" ng-model="params.join[$index][2]" ng-options="e.name as e.name for e in ::bridgeEntities" ng-change="$ctrl.buildFieldList()"> | |
72 | <option value="">{{:: ts('- none -') }}</option> | |
73 | </select> | |
af6f5ac8 CW |
74 | <a href class="crm-hover-button" title="Clear" ng-click="clearParam('join', $index)"><i class="crm-i fa-times"></i></a> |
75 | </div> | |
9b057f1e CW |
76 | <fieldset class="api4-clause-fieldset"> |
77 | <crm-api4-clause clauses="params.join[$index]" format="plain" skip="3" op="AND" label="On" fields="fieldsAndJoins" ></crm-api4-clause> | |
af6f5ac8 CW |
78 | </fieldset> |
79 | </fieldset> | |
c2d3af50 CW |
80 | </div> |
81 | <div class="api4-input form-inline"> | |
82 | <input class="collapsible-optgroups form-control huge" ng-model="controls.join" crm-ui-select="{data: entities}" placeholder="Add join" /> | |
83 | </div> | |
84 | </fieldset> | |
f28caa2c | 85 | <div class="api4-input form-inline" ng-mouseenter="help('fields', availableParams.fields)" ng-mouseleave="help()" ng-if="::availableParams.fields"> |
4cd69277 CW |
86 | <label for="api4-param-fields">fields<span class="crm-marker" ng-if="::availableParams.fields.required"> *</span></label> |
87 | <input class="form-control" ng-list crm-ui-select="::{data: fields, multiple: true}" id="api4-param-fields" ng-model="params.fields" style="width: 85%;"/> | |
19b53e5b | 88 | </div> |
4cd69277 CW |
89 | <div class="api4-input form-inline" ng-mouseenter="help('action', availableParams.action)" ng-mouseleave="help()"ng-if="::availableParams.action"> |
90 | <label for="api4-param-action">action<span class="crm-marker" ng-if="::availableParams.action.required"> *</span></label> | |
19b53e5b C |
91 | <input class="form-control" crm-ui-select="{data: actions, allowClear: true, placeholder: 'None'}" id="api4-param-action" ng-model="params.action"/> |
92 | </div> | |
8f38d9e9 | 93 | <div class="api4-input form-inline" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-repeat="(name, param) in ::getGenericParams(['string', 'int'])"> |
4cd69277 CW |
94 | <label for="api4-param-{{:: name }}">{{:: name }}<span class="crm-marker" ng-if="::param.required"> *</span></label> |
95 | <input class="form-control" ng-if="::!param.options" type="{{:: param.type[0] === 'int' && param.type.length === 1 ? 'number' : 'text' }}" id="api4-param-{{:: name }}" ng-model="params[name]"/> | |
96 | <select class="form-control" ng-if="::param.options" ng-options="o for o in ::param.options" id="api4-param-{{:: name }}" ng-model="params[name]"></select> | |
13a3d214 | 97 | <a href class="crm-hover-button" title="Clear" ng-click="clearParam(name)" ng-show="!!params[name]"><i class="crm-i fa-times" aria-hidden="true"></i></a> |
19b53e5b | 98 | </div> |
8f38d9e9 | 99 | <div class="api4-input" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-repeat="(name, param) in ::getGenericParams(['array', 'mixed'])"> |
4cd69277 CW |
100 | <label for="api4-param-{{:: name }}">{{:: name }}<span class="crm-marker" ng-if="::param.required"> *</span></label> |
101 | <textarea class="form-control" type="{{:: param.type[0] === 'int' && param.type.length === 1 ? 'number' : 'text' }}" id="api4-param-{{:: name }}" ng-model="params[name]"> | |
19b53e5b C |
102 | </textarea> |
103 | </div> | |
9b057f1e CW |
104 | <fieldset ng-if="::availableParams.where" class="api4-clause-fieldset" ng-mouseenter="help('where', availableParams.where)" ng-mouseleave="help()"> |
105 | <crm-api4-clause clauses="params.where" is-required="availableParams.where.required" op="AND" label="Where" fields="fieldsAndJoins" ></crm-api4-clause> | |
19b53e5b | 106 | </fieldset> |
4cd69277 | 107 | <fieldset ng-repeat="name in ['values', 'defaults']" ng-if="::availableParams[name]" ng-mouseenter="help(name, availableParams[name])" ng-mouseleave="help()"> |
f28caa2c | 108 | <legend>{{:: name }}<span class="crm-marker" ng-if="::availableParams[name].required"> *</span></legend> |
bb3786d2 | 109 | <div class="api4-input form-inline" ng-repeat="clause in params[name]" ng-mouseenter="help('value: ' + clause[0], fieldHelp(clause[0]))" ng-mouseleave="help(name, availableParams[name])"> |
37d82abe | 110 | <input class="collapsible-optgroups form-control twenty" ng-model="clause[0]" crm-ui-select="{formatResult: formatSelect2Item, formatSelection: formatSelect2Item, data: fieldList(name), allowClear: true, placeholder: 'Field'}" /> |
c752d94b | 111 | <input class="form-control" ng-model="clause[1]" api4-exp-value="{field: clause[0], action: action === 'getFields' ? params.action || 'get' : action}" /> |
19b53e5b C |
112 | </div> |
113 | <div class="api4-input form-inline"> | |
37d82abe | 114 | <input class="collapsible-optgroups form-control twenty" ng-model="controls[name]" crm-ui-select="{formatResult: formatSelect2Item, formatSelection: formatSelect2Item, data: fieldList(name), placeholder: ts('Add %1', {1: name.slice(0, -1)})}"/> |
19b53e5b | 115 | </div> |
b578f063 | 116 | </fieldset> |
f0acec37 CW |
117 | <fieldset ng-if="::availableParams.groupBy" ng-mouseenter="help('groupBy', availableParams.groupBy)" ng-mouseleave="help()"> |
118 | <legend>groupBy<span class="crm-marker" ng-if="::availableParams.groupBy.required"> *</span></legend> | |
119 | <div ng-model="params.groupBy" ui-sortable="{axis: 'y'}"> | |
120 | <div class="api4-input form-inline" ng-repeat="item in params.groupBy track by $index"> | |
13a3d214 | 121 | <i class="crm-i fa-arrows" aria-hidden="true"></i> |
f0acec37 | 122 | <input class="form-control huge" type="text" ng-model="params.groupBy[$index]" /> |
13a3d214 | 123 | <a href class="crm-hover-button" title="Clear" ng-click="clearParam('groupBy', $index)"><i class="crm-i fa-times" aria-hidden="true"></i></a> |
f0acec37 CW |
124 | </div> |
125 | </div> | |
126 | <div class="api4-input form-inline"> | |
127 | <input class="collapsible-optgroups form-control huge" ng-model="controls.groupBy" crm-ui-select="{data: fieldsAndJoinsAndFunctions}" placeholder="Add groupBy" /> | |
128 | </div> | |
129 | </fieldset> | |
9b057f1e CW |
130 | <fieldset ng-if="::availableParams.having" class="api4-clause-fieldset" ng-mouseenter="help('having', availableParams.having)" ng-mouseleave="help()"> |
131 | <crm-api4-clause clauses="params.having" is-required="availableParams.having.required" op="AND" label="Having" fields="havingOptions" ></crm-api4-clause> | |
f0acec37 CW |
132 | </fieldset> |
133 | <fieldset ng-if="::availableParams.orderBy" ng-mouseenter="help('orderBy', availableParams.orderBy)" ng-mouseleave="help()"> | |
134 | <legend>orderBy<span class="crm-marker" ng-if="::availableParams.orderBy.required"> *</span></legend> | |
135 | <div ng-model="params.orderBy" ui-sortable="{axis: 'y'}"> | |
136 | <div class="api4-input form-inline" ng-repeat="clause in params.orderBy"> | |
13a3d214 | 137 | <i class="crm-i fa-arrows" aria-hidden="true"></i> |
f0acec37 CW |
138 | <input class="form-control huge" type="text" ng-model="clause[0]" /> |
139 | <select class="form-control" ng-model="clause[1]"> | |
140 | <option value="ASC">ASC</option> | |
141 | <option value="DESC">DESC</option> | |
142 | </select> | |
13a3d214 | 143 | <a href class="crm-hover-button" title="Clear" ng-click="clearParam('orderBy', $index)"><i class="crm-i fa-times" aria-hidden="true"></i></a> |
f0acec37 | 144 | </div> |
19b53e5b C |
145 | </div> |
146 | <div class="api4-input form-inline"> | |
a4499ec5 | 147 | <input class="collapsible-optgroups form-control huge" ng-model="controls.orderBy" crm-ui-select="{data: fieldsAndJoinsAndFunctionsWithSuffixes}" placeholder="Add orderBy" /> |
19b53e5b C |
148 | </div> |
149 | </fieldset> | |
f0acec37 CW |
150 | <fieldset ng-if="::availableParams.limit && availableParams.offset"> |
151 | <div class="api4-input form-inline"> | |
152 | <span ng-mouseenter="help('limit', availableParams.limit)" ng-mouseleave="help()"> | |
153 | <label for="api4-param-limit">limit<span class="crm-marker" ng-if="::availableParams.limit.required"> *</span></label> | |
154 | <input class="form-control" type="number" min="0" id="api4-param-limit" ng-model="params.limit"/> | |
155 | </span> | |
156 | <span ng-mouseenter="help('offset', availableParams.offset)" ng-mouseleave="help()"> | |
157 | <label for="api4-param-offset">offset<span class="crm-marker" ng-if="::availableParams.offset.required"> *</span></label> | |
158 | <input class="form-control" type="number" min="0" id="api4-param-offset" ng-model="params.offset"/> | |
159 | </span> | |
13a3d214 | 160 | <a href class="crm-hover-button" title="Clear" ng-click="clearParam('limit');clearParam('offset');" ng-show="!!params.limit || !!params.offset"><i class="crm-i fa-times" aria-hidden="true"></i></a> |
f0acec37 CW |
161 | </div> |
162 | </fieldset> | |
163 | <fieldset ng-if="::availableParams.chain" ng-mouseenter="help('chain', availableParams.chain)" ng-mouseleave="help()"> | |
19b53e5b | 164 | <legend>chain</legend> |
4cd69277 | 165 | <div class="api4-input form-inline" ng-repeat="clause in params.chain" api4-exp-chain="clause" entities="::entities" main-entity="::entity" > |
19b53e5b C |
166 | </div> |
167 | <div class="api4-input form-inline"> | |
4cd69277 | 168 | <input class="form-control" ng-model="controls.chain" crm-ui-select="::{data: entities}" placeholder="Add chain" /> |
19b53e5b C |
169 | </div> |
170 | </fieldset> | |
171 | </div> | |
172 | </form> | |
173 | <div class="panel panel-info explorer-help-panel"> | |
174 | <div class="panel-heading"> | |
175 | <h3 class="panel-title" crm-icon="fa-info-circle">{{ helpTitle }}</h3> | |
176 | </div> | |
177 | <div class="panel-body"> | |
136ca5bb CW |
178 | <h4 ng-bind-html="helpContent.description"></h4> |
179 | <div ng-bind-html="helpContent.comment"></div> | |
0493ec47 | 180 | <p ng-repeat="(key, item) in helpContent" ng-if="key !== 'description' && key !== 'comment' && key !== 'see'"> |
19b53e5b C |
181 | <strong>{{ key }}:</strong> {{ item }} |
182 | </p> | |
0493ec47 CW |
183 | <div ng-if="helpContent.see"> |
184 | <strong>See:</strong> | |
185 | <ul> | |
fc95d9a5 | 186 | <li ng-repeat="ref in helpContent.see" ng-bind-html="ref"> </li> |
0493ec47 CW |
187 | </ul> |
188 | </div> | |
19b53e5b C |
189 | </div> |
190 | </div> | |
191 | </div> | |
192 | <div class="api4-explorer-row"> | |
2aafb0fc | 193 | <div class="panel panel-info explorer-code-panel"> |
19d01932 | 194 | <ul class="panel-heading nav nav-tabs"> |
f28caa2c CW |
195 | <li role="presentation" ng-repeat="lang in ::langs" ng-class="{active: selectedTab.code === lang}"> |
196 | <a href ng-click="selectLang(lang)"> | |
197 | {{:: lang }} | |
19d01932 CW |
198 | </a> |
199 | </li> | |
200 | </ul> | |
19b53e5b | 201 | <div class="panel-body"> |
63f78a8d CW |
202 | <div ng-repeat="style in code[selectedTab.code]"> |
203 | <label>{{:: style.label }}</label> | |
204 | <div><pre class="prettyprint" ng-bind-html="style.code"></pre></div> | |
205 | </div> | |
19b53e5b C |
206 | </div> |
207 | </div> | |
208 | <div class="panel explorer-result-panel panel-{{ status }}" > | |
b65fa6dc | 209 | <ul class="panel-heading nav nav-tabs"> |
19d01932 CW |
210 | <li role="presentation" ng-class="{active: selectedTab.result === 'result'}"> |
211 | <a href ng-click="selectedTab.result = 'result'"> | |
f28caa2c CW |
212 | <span ng-switch="status"> |
213 | <i class="fa fa-fw fa-circle-o" ng-switch-when="default"></i> | |
214 | <i class="fa fa-fw fa-check-circle" ng-switch-when="success"></i> | |
2aafb0fc | 215 | <i class="fa fa-fw fa-check-circle" ng-switch-when="warning"></i> |
f28caa2c | 216 | <i class="fa fa-fw fa-minus-circle" ng-switch-when="danger"></i> |
2aafb0fc | 217 | <i class="fa fa-fw fa-spinner fa-pulse" ng-switch-when="info"></i> |
f28caa2c | 218 | </span> |
f9c5f498 | 219 | <span>{{:: ts('Result') }}</span> |
b65fa6dc CW |
220 | </a> |
221 | </li> | |
4cd69277 | 222 | <li role="presentation" ng-if="::perm.accessDebugOutput" ng-class="{active: selectedTab.result === 'debug'}"> |
19d01932 | 223 | <a href ng-click="selectedTab.result = 'debug'"> |
2aafb0fc | 224 | <i class="fa fa-fw fa-{{ debug ? (status === 'warning' || status === 'danger' ? 'warning' : 'bug') : 'circle-o' }}"></i> |
f9c5f498 | 225 | <span>{{:: ts('Debug') }}</span> |
b65fa6dc CW |
226 | </a> |
227 | </li> | |
228 | </ul> | |
19b53e5b | 229 | <div class="panel-body"> |
19d01932 | 230 | <div ng-show="selectedTab.result === 'result'"> |
b65fa6dc CW |
231 | <pre class="prettyprint" ng-repeat="code in result" ng-bind-html="code"></pre> |
232 | </div> | |
4cd69277 | 233 | <div ng-if="::perm.accessDebugOutput" ng-show="selectedTab.result === 'debug'"> |
b65fa6dc | 234 | <pre ng-if="debug" class="prettyprint" ng-bind-html="debug"></pre> |
f28caa2c CW |
235 | <div ng-if="!debug"> |
236 | <p> | |
237 | {{:: ts('To view debugging output, enable the debug param before executing.') }} | |
238 | </p> | |
239 | <p> | |
240 | {{:: ts('Enable backtrace in system settings to see error backtraces.') }} | |
241 | </p> | |
242 | </div> | |
b65fa6dc | 243 | </div> |
19b53e5b C |
244 | </div> |
245 | </div> | |
246 | </div> | |
19b53e5b | 247 | </div> |