-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.html
More file actions
243 lines (188 loc) · 9.44 KB
/
api.html
File metadata and controls
243 lines (188 loc) · 9.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
{extends file="admin-layout.tpl"}
{block name="page-title"}{intl l='API list access'}{/block}
{block name="check-resource"}admin.configuration.api{/block}
{block name="check-access"}view{/block}
{block name="main-content"}
<div>
<div id="wrapper" class="container">
<div class="clearfix">
<ul class="breadcrumb">
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
<li>{intl l="API users"}</li>
</ul>
</div>
{hook name="api.top" location='api_top'}
<div class="row">
<div class="col-md-12">
<div class="general-block-decorator">
<div class="table-responsive">
<table class="table table-striped table-condensed table-left-aligned">
<caption class="clearfix">
{intl l="Api"}
{loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.api" access="CREATE"}
<a class="btn btn-default btn-primary pull-right" title="{intl l='Create a new API access'}" href="#api_create_dialog" data-toggle="modal">
<span class="glyphicon glyphicon-plus"></span>
</a>
{/loop}
</caption>
<thead>
<tr>
<th>{intl l="Label"}</th>
<th>{intl l="Api key"}</th>
<th>{intl l="Secure key"}</th>
<th>{intl l="profile"}</th>
<th class="col-md-1">{intl l="Actions"}</th>
</tr>
</thead>
<tbody>
{foreach $api_list as $api}
<tr>
<td >{$api.Label}</td>
<td >{$api.ApiKey}</td>
<td >
<a href="{url path="/admin/configuration/api/secure_key/{$api.Id}"}">{intl l="download"}</a>
</td>
<td >
{if $api.ProfileId}
{loop type="profile" name="admin-profile" id={$api.ProfileId}}
<a title="{intl l='Afficher ce profil'}" href="{url path="/admin/configuration/profiles/update/%id" id=$ID}">{$TITLE}</a>
{/loop}
{else}
{intl l='Superadministrator'}
{/if}
</td>
<td class="actions">
<div class="btn-toolbar btn toolbar-primary">
<span class="glyphicon glyphicon-cog"></span>
</div>
<div class="toolbar-options hidden">
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.configuration.api" access="UPDATE"}
<a title="{intl l='Change this api access'}" href="{url path="/admin/configuration/api/update/%id" id={$api.Id}}"><span class="glyphicon glyphicon-edit"></span></a>
{/loop}
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.configuration.api" access="DELETE"}
<a class="js-delete-api" title="{intl l='Delete this api access'}" href="#api_delete_dialog" data-id="{$api.Id}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
{/loop}
</div>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
</div>
</div>
{hook name="api.bottom" location='api_bottom'}
</div>
</div>
{form name="thelia_api_create"}
{capture name="api_create_dialog"}
{form_hidden_fields}
{form_field field="success_url"}
<input type="hidden" name="{$name}" value="{url path="/admin/configuration/api"}">
{/form_field}
{form_field field="label"}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Login'}" placeholder="{intl l='Login'}" class="form-control" value="{if $form_error}{$value}{/if}">
</div>
{/form_field}
{form_field field='profile'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<select id="{$label_attr.for}" name="{$name}" required="required" data-toggle="selectpicker">
{foreach $choices as $choice}
{if $choice->value == 0}
<option value="0">{intl l='Superadministrator'}</option>
{else}
{loop name='profile' type="profile" id=$choice->value}
<option value="{$ID}">{$TITLE}</option>
{/loop}
{/if}
{/foreach}
</select>
</div>
{/form_field}
{/capture}
{include
file = "includes/generic-create-dialog.html"
dialog_id = "api_create_dialog"
dialog_title = {intl l="Create a new API access"}
dialog_body = {$smarty.capture.api_create_dialog nofilter}
dialog_ok_label = {intl l="Create"}
dialog_cancel_label = {intl l="Cancel"}
form_action = {url path="/admin/configuration/api"}
form_enctype = {form_enctype}
form_error_message = $form_error_message
}
{/form}
{capture "api_delete_dialog"}
<input type="hidden" name="api_id" id="api_delete_id" value="" />
{hook name="api.delete-form" location='api_delete_form'}
{/capture}
{include
file = "includes/generic-confirm-dialog.html"
dialog_id = "api_delete_dialog"
dialog_title = {intl l="Delete api access"}
dialog_message = {intl l="Do you really want to delete this api access ?"}
form_action = {url path='/admin/configuration/api/delete'}
form_content = {$smarty.capture.api_delete_dialog nofilter}
}
{if $api_id > 0}
{form name="thelia_api_update"}
{* Capture the dialog body, to pass it to the generic dialog *}
{capture "api_update_dialog"}
{form_field field='profile'}
{form_hidden_fields}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} :</label>
<select id="{$label_attr.for}" name="{$name}" required="required" data-toggle="selectpicker">
{foreach $choices as $choice}
{if $choice->value == 0}
<option value="0" {if $value == null}selected{/if}>{intl l='Superadministrator'}</option>
{else}
{loop name='profile' type="profile" id=$choice->value}
<option value="{$ID}" {if $value == $ID}selected{/if}>{$TITLE}</option>
{/loop}
{/if}
{/foreach}
</select>
</div>
{/form_field}
{/capture}
{include
file = "includes/generic-create-dialog.html"
dialog_id = "api_update_dialog"
dialog_title = {intl l="Edit api access"}
dialog_body = {$smarty.capture.api_update_dialog nofilter}
dialog_ok_label = {intl l="Save"}
dialog_cancel_label = {intl l="Cancel"}
form_action = {url path="/admin/configuration/api/update/%id" id={$api_id}}
form_enctype = {form_enctype}
form_error_message = $form_error_message
}
{/form}
{/if}
{/block}
{block name="javascript-initialization"}
{javascripts file='assets/js/bootstrap-select/bootstrap-select.js'}
<script src='{$asset_url}'></script>
{/javascripts}
<script type="text/javascript">
$(document).ready(function(){
$(".js-delete-api").click(function(e){
$('#api_delete_id').val($(this).data('id'))
});
{if $api_id > 0}
// JS stuff for update form
{include
file = "includes/generic-js-dialog.html"
dialog_id = "api_update_dialog"
form_name = "thelia_api_update"
}
$('#api_update_dialog').modal();
{/if}
});
</script>
{/block}