-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodules.html
More file actions
246 lines (188 loc) · 8.42 KB
/
modules.html
File metadata and controls
246 lines (188 loc) · 8.42 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
244
245
246
{extends file="admin-layout.tpl"}
{block name="no-return-functions"}
{$admin_current_location = 'modules'}
{/block}
{block name="page-title"}{intl l='Modules'}{/block}
{block name="check-resource"}admin.module{/block}
{block name="check-access"}view{/block}
{block name="main-content"}
<div class="modules">
<div id="wrapper" class="container">
<div class="clearfix">
<ul class="breadcrumb pull-left">
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
<li>{intl l="Modules"}</li>
</ul>
</div>
{hook name="modules.top" location="modules_top" }
<div class="row">
{if $module_errors}
{include file="includes/module-errors.html"}
{/if}
{loop type="auth" name="can_create" role="ADMIN" resource="admin.module" access="UPDATE"}
{include file="includes/module-install.html"}
{/loop}
<div class="col-md-12">
{if $error_message}<div class="alert alert-danger">{$error_message}</div>{/if}
{include file="includes/module-block.html" module_type="2" caption_title={intl l='Delivery modules'}}
{include file="includes/module-block.html" module_type="3" caption_title={intl l='Payment modules'}}
{include file="includes/module-block.html" module_type="1" caption_title={intl l='Classic modules'}}
</div>
<div class="col-md-12">
<div class="text-right">
<a href="{url path='/admin/hooks'}" class="btn btn-primary">{intl l="Manage hooks"} <span class="glyphicon glyphicon-chevron-right"></span></a>
<a href="{url path='/admin/module-hooks'}" class="btn btn-primary">{intl l="Manage modules attachements"} <span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
</div>
</div>
{hook name="modules.bottom" location="modules_bottom" }
</div>
</div>
{* Delete module confirmation dialog *}
{capture "delete_module_dialog"}
<input type="hidden" name="module_id" id="delete_module_id" value="" />
<div class="row">
<div class="col-md-12">
<div class="form-group">
<div class="checkbox">
<label>
<input type="checkbox" name="delete-module-data" value="1">
{intl l="Delete also module data"}
</label>
</div>
</div>
</div>
</div>
{/capture}
{include
file = "includes/generic-confirm-dialog.html"
dialog_id = "delete_module_dialog"
dialog_title = {intl l="Delete a module"}
dialog_message = {intl l="Do you really want to delete this module ?"}
form_action = {token_url path='/admin/module/delete'}
form_content = {$smarty.capture.delete_module_dialog nofilter}
}
<div class="modal fade" id="module-failed" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>{intl l="An error occured"}</h3>
</div>
<div class="modal-body" id="module-failed-body">
</div>
</div>
</div>
</div>
{* Module information dialog *}
<div class="modal fade" id="module-information" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="module-information-title"></h3>
</div>
<div class="modal-body" id="module-information-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{intl l='Close'}</button>
</div>
</div>
</div>
</div>
{/block}
{block name="javascript-initialization"}
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
<script src="{$asset_url}"></script>
{/javascripts}
{javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
<script src="{$asset_url}"></script>
{/javascripts}
<script>
$(document).ready(function() {
$("#module-install").on("submit", function(event) {
var $loader = $('<div class="loader"></div>');
$('body').append($loader);
$loader.show();
});
var url_management = "{url path="/admin/module/toggle-activation/"}";
$(".module-activation").on("switch-change", function(e, data){
var checkbox = $(this);
var module_id = checkbox.data('id');
var is_checked = data.value;
$('body').append('<div class="modal-backdrop fade in" id="loading-event"><div class="loading"></div></div>');
$.ajax({
url: url_management+$(this).data('id')
}).always(function(){
$("#loading-event").remove();
}).done(function() {
if (is_checked) {
$('.config-btn-' + module_id + ', .hook-btn-' + module_id)
.removeClass('disabled')
.removeClass('no-follow-link');
} else {
$('.config-btn-' + module_id + ', .hook-btn-' + module_id)
.addClass('disabled')
.addClass('no-follow-link');
}
}).fail(function(jqXHR, textStatus, errorThrown){
checkbox.bootstrapSwitch('toggleState', true);
$('#module-failed-body').html(jqXHR.responseJSON.error);
$("#module-failed").modal("show");
});
});
$(".module-delete-action").click(function(){
$("#delete_module_id").val($(this).data("id"));
});
{* Inline editing of object position using bootstrap-editable *}
$('.modulePositionChange').editable({
type : 'text',
title : "{intl l="Enter new module position"}",
mode : 'popup',
inputclass : 'input-mini',
placement : 'left',
success : function(response, newValue) {
// The URL template
var url = "{url noamp='1' path='/admin/module/update-position' module_id='__ID__' position='__POS__'}";
// Perform subtitutions
url = url.replace('__ID__', $(this).data('id'))
.replace('__POS__', newValue);
// Reload the page
location.href = url;
}
});
{* module errors *}
$('.module-error-more').on('click', function(event){
event.preventDefault();
$(event.currentTarget).next('.more').toggleClass('hidden');
});
$('.module-information').click(function(event) {
showModuleInformation(
'{url path='/admin/module/information/__ID__'}'.replace('__ID__', $(this).data('id'))
);
event.preventDefault();
});
$('.module-documentation').click(function(event) {
showModuleInformation(
'{url path='/admin/module/documentation/__ID__'}'.replace('__ID__', $(this).data('id'))
);
event.preventDefault();
});
function showModuleInformation(url) {
$('body').append('<div class="modal-backdrop fade in" id="loading-event"><div class="loading"></div></div>');
$.ajax({
url: url
}).always(function(){
$("#loading-event").remove();
}).success(function(data) {
$('#module-information-title').html(data.title);
$('#module-information-body').html(data.body);
$("#module-information").modal("show");
});
}
});
</script>
{/block}
{block name="javascript-last-call"}
{hook name="modules.js" location="modules-js" }
{/block}