Subversion-Projekte lars-tiefland.webanos.marine-sales.de

Revision

Revision 383 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
{extends file="index.tpl"}
2
{block name="maincontent"}
3
    <script type="text/javascript">
4
        $(function () {
370 lars 5
            $('#dataTableBackendUsers').dataTable({
6
                "lengthMenu": [[100, -1], [100, "Alle"]],
7
                "language": {
8
                    "url": "/js/DataTables-1.10.19/German.json"
9
                }
10
            });
2 lars 11
            $('button,input:submit,input:button,input:reset,#getnewPWD,#shownewPWD ').button();
12
            $('.locked').uibutton({
13
                "icons": {
14
                    "primary": "ui-icon-locked"
15
                }
16
            }).click(deactivate2fa);
17
            $('.unlocked').uibutton({
18
                "icons": {
19
                    "primary": "ui-icon-unlocked"
20
                }
21
            });
22
 
23
            $('#en2fa').click(activate2fa)
372 lars 24
            $('#editDlg').dialog({
25
                autoOpen:false,
26
                modal:true,
27
                resizable:false,
28
                width:900,
29
                height:400,
30
                buttons:[
31
                    {
32
                        text:"Speichern",
33
                        icon:"ui-icon-check",
34
                        click:function (){
380 lars 35
                            let url="/backend_users";
372 lars 36
                            if($("#ID").val())
37
                            {
38
                                url+="/"+$("#ID").val()
39
                            }
40
                            /*$.post(url,$('#supplierForm').serializeArray(),function(){
41
                                $('#editDlg').dialog("close")
42
                                location.reload()
43
                            });*/
44
                            $.ajax({
45
                                type:"post",
46
                                url:url,
383 lars 47
                                data:$('#userForm').serializeArray(),
372 lars 48
                                dataType: 'json',
49
                                success:function ()
50
                                {
51
                                    $('#editDlg').dialog("close");
52
                                    location.reload();
53
                                },
54
                                error:function (response)
55
                                {
383 lars 56
                                    $('#userError').html(response.responseJSON.message);
372 lars 57
                                    let errors = response.responseJSON.errors
383 lars 58
                                    if(errors.email)
372 lars 59
                                    {
383 lars 60
                                        $('#userEmailError').html(errors.email)
372 lars 61
                                    }
62
                                    if(errors.rank)
63
                                    {
383 lars 64
                                        $('#userRankError').html(errors.rank)
372 lars 65
                                    }
383 lars 66
                                    if(errors.password)
67
                                    {
68
                                        $('#userPasswordError').html(errors.password)
69
                                    }
70
                                    if(errors.password_confirmation)
71
                                    {
385 lars 72
                                        $('#userPasswordConfirmationError').html(errors.password_confirmation)
383 lars 73
                                    }
372 lars 74
                                }
75
                            })
76
                        }
77
                    },
78
                    {
79
                        text:"Abbrechen",
80
                        icon:"ui-icon-cancel",
81
                        click:function (){
82
                            $('#editDlg').dialog("close");
83
                        }
84
                    }
85
                ]
86
            })
87
            $('#delDlg').dialog({
88
                autoOpen:false,
89
                modal:true,
90
                resizable:false,
91
                width:800,
92
                buttons:[
93
                    {
94
                        text:"Löschen",
95
                        icon:"ui-icon-trash",
96
                        click:function (){
373 lars 97
                            let url="/backend_users/"+$("#mId").html();
98
                            $.post(url,$('#userDelForm').serializeArray(),function(){
372 lars 99
                                $('#delDlg').dialog("close")
100
                                location.reload()
101
                            });
102
                        }
103
                    },
104
                    {
105
                        text:"Abbrechen",
106
                        icon:"ui-icon-cancel",
107
                        click:function (){
108
                            $('#delDlg').dialog("close");
109
                        }
110
                    }
111
                ]
112
            })
113
            $("#new").uibutton({
114
                icons:{
115
                    primary:"ui-icon-plus"
116
                }
117
            }).click(function()
118
            {
373 lars 119
                let url="/backend_users/create/";
372 lars 120
                $('#editDlg').load(url).dialog("open");
121
            });
122
            $(".edit").uibutton({
123
                icons:{
124
                    primary:"ui-icon-pencil"
125
                }
126
            }).click(function() {
373 lars 127
                let url="/backend_users/"+$(this).attr("data-id")+"/edit/";
372 lars 128
                $('#editDlg').load(url).dialog("open");
129
            });
130
            $(".del").uibutton({
131
                icons:{
132
                    primary:"ui-icon-trash"
133
                }
134
            }).click(function() {
135
                let mId=$(this).attr("data-id");
373 lars 136
                $.get("/backend_users/"+mId,function(name) {
137
                    $('#userName').html(name);
138
                    $('#uId').html(mId);
372 lars 139
                    $('#delDlg').dialog("open");
140
                })
141
            })
142
 
2 lars 143
        })
144
 
145
        function deactivate2fa() {
146
            let uId = $(this).attr("data-id");
147
            $.get("/toolbox/ga.php?mode=disable&id=" + uId, function () {
148
                document.location.reload();
149
            });
150
        }
151
 
152
        function activate2fa() {
153
            let uId = $(this).attr("data-id");
154
            document.location.href = "/toolbox/ga.php";
155
        }
156
 
157
        function randomPassword() {
158
            //$('#pwd').load("/generate_pwd.php");
159
            $.get("/generate_pwd.php", function (pwd) {
160
                $('#pwd').val(pwd);
161
                $('#pwdcheck').val($('#pwd').val());
162
            })
163
        }
164
 
165
        function deleteusersession() {
166
            $.get("../admin_user.php?action=delete_user_session&ID={$smarty.get.ID}", function (deletesessionuser) {
167
                alert(deletesessionuser);
168
            })
169
        }
170
 
171
        function showpass() {
172
            var x = document.getElementById("pwd");
173
            if (x.type === "password") {
174
                x.type = "text";
175
            } else {
176
                x.type = "password";
177
            }
178
        }
179
 
180
        function MM_swapImgRestore() { //v3.0
181
            var i, x, a = document.MM_sr;
182
            for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
183
        }
184
 
185
        function MM_preloadImages() { //v3.0
186
            var d = document;
187
            if (d.images) {
188
                if (!d.MM_p) d.MM_p = new Array();
189
                var i, j = d.MM_p.length, a = MM_preloadImages.arguments;
190
                for (i = 0; i < a.length; i++) {
191
                    if (a[i].indexOf("#") != 0) {
192
                        d.MM_p[j] = new Image;
193
                        d.MM_p[j++].src = a[i];
194
                    }
195
                }
196
            }
197
        }
198
 
199
        function MM_swapImage() { //v3.0
200
            var i, j = 0, x, a = MM_swapImage.arguments;
201
            document.MM_sr = new Array;
202
            for (i = 0; i < (a.length - 2); i += 3) {
203
                if ((x = MM_findObj(a[i])) != null) {
204
                    document.MM_sr[j++] = x;
205
                    if (!x.oSrc) {
206
                        x.oSrc = x.src;
207
                    }
208
                    x.src = a[i + 2];
209
                }
210
            }
211
        }
212
 
213
        function MM_findObj(n, d) { //v4.01
214
            var p, i, x;
215
            if (!d) {
216
                d = document;
217
            }
218
            if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
219
                d = parent.frames[n.substring(p + 1)].document;
220
                n = n.substring(0, p);
221
            }
222
            if (!(x = d[n]) && d.all) {
223
                x = d.all[n];
224
            }
225
            for (i = 0; !x && i < d.forms.length; i++) {
226
                x = d.forms[i][n];
227
            }
228
            for (i = 0; !x && d.layers && i < d.layers.length; i++) {
229
                x = MM_findObj(n, d.layers[i].document);
230
            }
231
            if (!x && d.getElementById) {
232
                x = d.getElementById(n);
233
            }
234
            return x;
235
        }
236
    </script>
237
    <style type="text/css">
238
        #pwd {
239
            margin: auto;
240
        }
241
 
242
        i#hovereffekt {
243
            position: relative;
244
            z-index: 1;
245
        }
246
 
247
        i#hovereffekt:hover {
248
            z-index: 2;
249
        }
250
 
251
        i#hovereffekt p {
252
            display: none;
253
        }
254
 
255
        i#hovereffekt:hover p {
256
            display: block;
257
            position: absolute;
258
            top: 3em;
259
            left: 3em;
260
            width: 300px;
261
            border-style: solid;
262
            border-width: 1px;
263
            padding: 5px;
264
            font-size: 15px;
265
        }
266
 
267
        a:link {
268
            color: #000 !important;
269
        }
270
 
271
        span {
272
            text-decoration: none !important;
273
            color: unset;
274
        }
275
 
276
        .error {
277
            font-size: 50px;
278
            color: red;
279
            text-align: center;
280
        }
281
 
282
        .zuweisungTable {
283
            width: 100%;
284
            text-align: center;
285
            border-collapse: collapse;
286
            margin-bottom: 20px;
287
        }
288
 
289
        .zuweisungTable tr td:first-child {
290
            border-right: 1px solid #ccc;
291
        }
292
 
293
        .zuweisungTable tr:first-child td {
294
            border-bottom: 1px solid #ccc;
295
        }
296
 
297
        .zuweisungTable tr td label {
298
            clear: both;
299
            float: left;
300
 
301
        }
302
    </style>
372 lars 303
    <button id="new"></button>
304
    <br><br>
370 lars 305
    <table class="keinRand" width="100%" cellspacing="0" cellpadding="3" id="dataTableBackendUsers">
371 lars 306
        <thead>
2 lars 307
        <tr>
374 lars 308
            <td class="headline">Login</td>
309
            <td class="headline">2FA</td>
310
            <td class="headline">Letztes Login</td>
311
            <td class="headline">Aktionen</td>
2 lars 312
        </tr>
371 lars 313
        </thead>
314
        <tbody>
2 lars 315
        {foreach $users as $user}
316
            {cycle values=' ,gerade' assign='class'}
317
            <tr class="rechts {$class}">
318
                <td>
372 lars 319
                    {$user.email}
2 lars 320
                </td>
321
                <td>
322
                    {if $user["2fa"] == true}
323
                        <div class="locked" title="Zwei-Faktor-Authentifizierung aktiv"
324
                             data-id="{$users.id}"></div>
325
                    {else}
326
                        <div class="unlocked" title="Zwei-Faktor-Authentifizierung inaktiv"
327
                             {if $users.id==$smarty.session.admin.uid}data-id="{$user.id}"
328
                             id="en2fa"{/if}></div>
329
                    {/if}
330
                </td>
331
                <td>
332
                    {if !is_null($user.last_login)}
333
                        {$user.last_login|date_format:"%d.%m.%Y %H:%M"} |
334
                        <a href="#" id="ip_{$smarty.section.u_ind.index}_{$user.ip}"
320 lars 335
                           class="ipAddress">{$user.ip}</a>
2 lars 336
                    {/if}
337
                </td>
372 lars 338
                <td  style="text-align:left !important;">
339
                    <button class="edit" data-id="{$user.id}"></button>
340
                    <button class="del" data-id="{$user.id}"></button>
341
                </td>
2 lars 342
 
343
            </tr>
344
        {/foreach}
371 lars 345
        </tbody>
2 lars 346
    </table>
372 lars 347
    <div id="editDlg"></div>
373 lars 348
    <div id="delDlg" title="Benutzer löschen">
349
        Wollen Sie den Benutzer <span id="userName"></span> wirklich löschen?
372 lars 350
        <span id="mId" style="display: none"></span>
373 lars 351
        <form id="userDelForm">
372 lars 352
            <input type="hidden" name="_method" value="DELETE">
353
            <input type="hidden" name="_token" value="{csrf_token()}">
354
        </form>
355
    </div>
2 lars 356
{/block}