Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 6645 | Rev 6649 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 1
<?php
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser    = $this->currentUserHelper();
4
$roleName       = $currentUser->getUserTypeId();
5
 
6
$routeDatatable = $this->url('microlearning/content/slides');
7
 
8
$allowAdd = $acl->isAllowed($roleName, 'microlearning/content/slides/add') ? 1 : 0;
9
$allowEdit = $acl->isAllowed($roleName, 'microlearning/content/slides/edit') ? 1 : 0;
10
$allowDelete = $acl->isAllowed($roleName, 'microlearning/content/slides/delete') ? 1 : 0;
11
 
12
 
13
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
14
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
15
 
16
 
17
$this->inlineScript()->appendFile($this->basePath('plugins/bootbox/bootbox.min.js'));
18
 
19
 
20
 
21
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/css/fileinput.min.css'));
22
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.css'));
23
 
24
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/piexif.js'));
25
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/sortable.js'));
26
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/fileinput.js'));
27
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/locales/es.js'));
28
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/fas/theme.js'));
29
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.js'));
30
 
31
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
32
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
33
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
34
 
6115 nelberth 35
$this->headLink()->appendStylesheet($this->basePath('plugins/nelberth-editor/style.css'));
1 www 36
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
37
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-input-number/input-number-format.jquery.js'));
38
 
39
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
40
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
41
 
42
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
43
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
44
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
45
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
46
 
47
 
48
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
49
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
50
 
51
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
52
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
53
 
54
 
55
 
56
 
57
$this->inlineScript()->captureStart();
58
echo <<<JS
59
 
60
 
61
jQuery( document ).ready(function( $ ) {
62
 
63
        var routeAdd = '';
64
 
65
        $.validator.setDefaults({
66
            debug: true,
67
            highlight: function(element) {
68
                $(element).addClass('is-invalid');
69
            },
70
            unhighlight: function(element) {
71
                $(element).removeClass('is-invalid');
72
            },
73
            errorElement: 'span',
74
            errorClass: 'error invalid-feedback',
75
            errorPlacement: function(error, element) {
6192 nelberth 76
 
1 www 77
            }
78
        });
79
 
80
 
81
        $.fn.showFormErrorValidator = function(fieldname, errors) {
82
            var field = $(fieldname);
83
            if(field) {
84
                $(field).addClass('is-invalid');
85
 
86
 
87
                var error = $('<span id="' + fieldname +'-error" class="error invalid-feedback">' + errors + '</div>');
6622 nelberth 88
                if(element.parent('.btn-file').length) {
1 www 89
                    error.insertAfter(element.parent().parent());
90
                } else if(element.parent('.toggle').length) {
91
                    error.insertAfter(element.parent().parent());
92
                } else {
93
                    error.insertAfter(element.parent());
6622 nelberth 94
                }
1 www 95
            }
96
        };
97
 
98
    var allowEdit   = $allowEdit;
99
        var allowDelete = $allowDelete;
100
 
101
        var gridTable = $('#gridTable').dataTable( {
102
            'processing': true,
103
            'serverSide': true,
104
            'searching': true,
105
            'order': [[ 0, 'asc' ]],
106
            'ordering':  true,
107
            'ordenable' : true,
108
            'responsive': true,
109
            'select' : false,
110
        	'paging': true,
111
            'pagingType': 'simple_numbers',
112
 
113
    		'ajax': {
114
    			'url' : '$routeDatatable',
115
    			'type' : 'get',
116
                'data': function ( d ) {
117
                    d.topic_uuid = $('#form-filter #topic_uuid').val();
118
                    d.capsule_uuid = $('#form-filter #capsule_uuid').val();
119
 
120
                },
121
                'beforeSend': function (request) {
122
                  NProgress.start();
123
                },
124
                'dataFilter': function(response) {
125
                    var response = jQuery.parseJSON( response );
126
 
127
                    var json                = {};
128
                    json.recordsTotal       = 0;
129
                    json.recordsFiltered    = 0;
130
                    json.data               = [];
131
 
132
                    if(response.success) {
133
                        $('#form-capsule-add').attr('action', response.data.link_add );
134
 
135
                        if(response.data.capsules) {
136
                            $('#form-filter #capsule_uuid').empty();
137
                            $.each(response.data.capsules, function(index, value) {
138
                                  $('#form-filter #capsule_uuid').append('<option value="' + index + '">' + value + '</option>')
139
                            });
140
                        }
141
 
142
                        routeAdd = response.data.link_add;
143
                        if(response.data.link_add) {
144
 
145
                            $('button.btn-add').removeAttr('disabled');
146
                        } else {
147
                            $('button.btn-add').attr('disabled', 'disabled');
148
                        }
149
 
150
                        json.recordsTotal       = response.data.total;
151
                        json.recordsFiltered    = response.data.total;
152
                        json.data               = response.data.items;
153
                    } else {
154
                        $.fn.showError(response.data)
155
                    }
156
 
157
                    return JSON.stringify( json );
158
                }
159
    		},
160
            'language' : {
161
                'sProcessing':     'LABEL_DATATABLE_SPROCESSING',
162
                'sLengthMenu':     'LABEL_DATATABLE_SLENGTHMENU',
163
                'sZeroRecords':    'LABEL_DATATABLE_SZERORECORDS',
164
                'sEmptyTable':     'LABEL_DATATABLE_SEMPTYTABLE',
165
                'sInfo':           'LABEL_DATATABLE_SINFO',
166
                'sInfoEmpty':      'LABEL_DATATABLE_SINFOEMPTY',
167
                'sInfoFiltered':   'LABEL_DATATABLE_SINFOFILTERED',
168
                'sInfoPostFix':    '',
169
                'sSearch':         'LABEL_DATATABLE_SSEARCH',
170
                'sUrl':            '',
171
                'sInfoThousands':  ',',
172
                'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
173
                'oPaginate': {
174
                    'sFirst':    'LABEL_DATATABLE_SFIRST',
175
                    'sLast':     'LABEL_DATATABLE_SLAST',
176
                    'sNext':     'LABEL_DATATABLE_SNEXT',
177
                    'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
178
                },
179
                'oAria': {
180
                    'sSortAscending':  ': LABEL_DATATABLE_SSORTASCENDING',
181
                    'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
182
                },
183
            },
184
            'drawCallback': function( settings ) {
185
                NProgress.done();
186
                $('button.btn-delete').confirmation({
187
                    rootSelector: 'button.btn-delete',
188
                    title : 'LABEL_ARE_YOU_SURE',
189
                    singleton : true,
190
                    btnOkLabel: 'LABEL_YES',
191
                    btnCancelLabel: 'LABEL_NO',
192
                    onConfirm: function(value) {
193
                        action = $(this).data('href');
194
                        NProgress.start();
195
                        $.ajax({
196
                            'dataType'  : 'json',
197
                            'accept'    : 'application/json',
198
                            'method'    : 'post',
199
                            'url'       :  action,
200
                        }).done(function(response) {
201
                            if(response['success']) {
202
                                $.fn.showSuccess(response['data']);
203
                                gridTable.api().ajax.reload(null, false);
204
                            } else {
205
                                $.fn.showError(response['data']);
206
                            }
207
                        }).fail(function( jqXHR, textStatus, errorThrown) {
208
                            $.fn.showError(textStatus);
209
                        }).always(function() {
210
                            NProgress.done();
211
                        });
212
                    },
213
                });
214
            },
215
            'aoColumns': [
216
                { 'mDataProp': 'name' },
217
                { 'mDataProp': 'details' },
218
                { 'mDataProp': 'media' },
219
                { 'mDataProp': 'actions' },
220
    	    ],
221
            'columnDefs': [
222
                {
223
                    'targets': 0,
224
                    'className' : 'text-vertical-middle',
225
                },
226
                {
227
                    'targets': -3,
228
                    'orderable': false,
229
                    'render' : function ( data, type, row ) {
230
                        var s = '';
231
                        s += 'LABEL_TYPE: ' + data['type']  + '<br/>';
232
                        return s;
233
                    }
234
                },
235
                {
236
                    'targets': -2,
237
                    'orderable': false,
238
                    'render' : function ( data, type, row ) {
239
                        s = '';
240
                        if( data['image'] )  {
241
                            s = s + '&nbsp; <img class="btn-view-image"" data-href="' + data['image'] + '" data-toggle="tooltip" src="'+data['image']+'" title="LABEL_VIEW" style="width: 40px; object-fit: cover; height: 40px;" /> ';
242
                        }
243
 
244
                        if( data['audio'] )  {
245
                            s = s + '&nbsp;<button class="btn btn-play-audio" data-href="' + data['audio'] + '" data-toggle="tooltip" title="LABEL_PLAY_AUDIO"><i class="fa fa-play"></i></button> <br>';
246
                        }
247
 
248
                        if( data['video'] )  {
249
                            s = s + '&nbsp;<button class="btn btn-play-video" data-href="' + data['video'] + '" data-toggle="tooltip" title="LABEL_PLAY_VIDEO"><i class="fa fa-video-camera"></i></button> <br>';
250
                        }
251
 
252
 
253
                        if( data['document'] )  {
254
                            s = s + '&nbsp;<button class="btn btn-view-document" data-href="' + data['document'] + '" data-toggle="tooltip" title="LABEL_VIEW_DOCUMENT"><i class="fa fa-file"></i></button> <br>';
255
                        }
256
 
257
                        if( data['text'] )  {
258
                            s = s + '&nbsp;<button class="btn btn-view-text" data-href="' + data['text'] + '" data-toggle="tooltip" title="LABEL_VIEW_TEXT"><i class="fa fa-text-width"></i></button> <br>';
259
                        }
260
 
261
                        return s;
262
                    }
263
                },
264
 
265
 
266
                {
267
                    'targets': -1,
268
                    'orderable': false,
269
                    'render' : function ( data, type, row ) {
270
                        s = '';
271
 
272
                        if(allowEdit && data['link_edit']  ) {
273
                            s = s + '<button class="btn btn-info btn-sm btn-edit" data-href="' + data['link_edit']+ '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> Editar </button>&nbsp;';
274
                        }
275
                        if(allowDelete && data['link_delete']  ) {
276
                            s = s + '<button class="btn btn-danger btn-sm btn-delete" data-href="' + data['link_delete']+ '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> Eliminar</button>&nbsp;';
277
                        }
278
                        return s;
279
                    }
280
                }
281
              ],
282
        });
6591 nelberth 283
        var seleccionarCampo;
1 www 284
    var validatorTextAdd  = $('#form-slide-text-add').validate({
285
        debug: true,
286
        onclick: false,
287
        onkeyup: false,
288
        ignore: [],
289
        rules: {
290
            'name': {
291
                required: true,
292
                maxlength: 128,
293
            },
294
            'description': {
295
                updateCkeditor:function() {
296
                        CKEDITOR.instances.description_add.updateElement();
297
                },
298
                required: true
299
            },
300
           'background': {
301
                required: true,
302
            },
303
            'order' : {
304
                required: true,
305
                digits: true,
306
                min: 1,
307
                max: 250
308
            }
309
        },
310
        submitHandler: function(form)
311
        {
312
 
313
            var formdata = false;
314
            if (window.FormData){
315
                formdata = new FormData(form); //form[0]);
316
            }
317
 
318
            $('input[type="submit"]').prop('disabled', true);
6591 nelberth 319
            NProgress.start();
1 www 320
            $.ajax({
321
                'dataType'  : 'json',
322
                'accept'    : 'application/json',
323
                'method'    : 'post',
324
                'url'       :  routeAdd,
325
                'data'      :  formdata,
326
                'processData': false,
327
                'contentType': false,
328
            }).done(function(response) {
329
                if(response['success']) {
330
                    $.fn.showSuccess(response['data']);
6591 nelberth 331
                    $('body, html').animate({scrollTop: '0px'}, 300);
332
					$('#content1').css('display','block');
333
                    $('.contenido').html('');
334
            		seleccionarCampo.css('display','none');
1 www 335
 
336
                    gridTable.api().ajax.reload(null, false);
337
                } else {
338
                    validatorTextAdd.resetForm();
339
                    if(jQuery.type(response['data']) == 'string') {
340
                        $.fn.showError(response['data']);
341
                    } else  {
342
                        $.each(response['data'], function( fieldname, errors ) {
343
                            $.fn.showFormErrorValidator('#form-slide-text-add #' + fieldname, errors);
344
                        });
345
                    }
346
                }
347
            }).fail(function( jqXHR, textStatus, errorThrown) {
348
                $.fn.showError(textStatus);
349
            }).always(function() {
350
                NProgress.done();
351
            });
352
            return false;
353
        },
354
        invalidHandler: function(form, validator) {
355
 
356
        }
357
    });
358
 
359
    var validatorTextEdit = $('#form-slide-text-edit').validate({
360
        debug: true,
361
        onclick: false,
362
        onkeyup: false,
363
        ignore: [],
364
        rules: {
365
            'name': {
366
                required: true,
367
                maxlength: 128,
368
            },
369
            'description': {
370
                updateCkeditor:function() {
371
                        CKEDITOR.instances.description_edit.updateElement();
372
                },
373
                required: true
374
            },
375
           'background': {
6598 nelberth 376
                required: true,
1 www 377
            },
378
            'order' : {
379
                required: true,
380
                digits: true,
381
                min: 1,
382
                max: 250
383
            }
384
        },
385
        submitHandler: function(form)
386
        {
387
            var formdata = false;
388
            if (window.FormData){
389
                formdata = new FormData(form); //form[0]);
390
            }
391
 
392
            $('input[type="submit"]').prop('disabled', true);
6595 nelberth 393
            NProgress.start();
1 www 394
            $.ajax({
395
                'dataType'  : 'json',
396
                'accept'    : 'application/json',
397
                'method'    : 'post',
398
                'url'       :  $('#form-slide-text-edit').attr('action'),
399
                'data'      :  formdata,
400
                'processData': false,
401
                'contentType': false,
402
            }).done(function(response) {
403
                if(response['success']) {
404
                    $.fn.showSuccess(response['data']);
405
 
6595 nelberth 406
                    $('body, html').animate({scrollTop: '0px'}, 300);
407
					$('#content1').css('display','block');
408
                    $('.contenido').html('');
409
            		seleccionarCampo.css('display','none');
410
 
1 www 411
                    gridTable.api().ajax.reload(null, false);
412
                } else {
413
                    validatorTextEdit.resetForm();
414
                    if(jQuery.type(response['data']) == 'string') {
415
                        $.fn.showError(response['data']);
416
                    } else  {
417
                        $.each(response['data'], function( fieldname, errors ) {
418
                            $.fn.showFormErrorValidator('#form-slide-text-edit #' + fieldname, errors);
419
                        });
420
                    }
421
                }
422
            }).fail(function( jqXHR, textStatus, errorThrown) {
423
                $.fn.showError(textStatus);
424
            }).always(function() {
425
                NProgress.done();
426
            });
427
            return false;
428
        },
429
        invalidHandler: function(form, validator) {
430
 
431
        }
432
    });
433
 
434
    var validatorImageAdd  = $('#form-slide-image-add').validate({
435
        debug: true,
436
        onclick: false,
437
        onkeyup: false,
438
        ignore: [],
439
        rules: {
440
            'name': {
441
                required: true,
442
                maxlength: 128,
443
            },
444
           'file': {
445
                required: true,
446
            },
447
            'order' : {
448
                required: true,
449
                digits: true,
450
                min: 1,
451
                max: 250
452
            }
453
        },
454
        submitHandler: function(form)
455
        {
456
            var formdata = false;
457
            if (window.FormData){
458
                formdata = new FormData(form); //form[0]);
459
            }
460
 
461
            $('input[type="submit"]').prop('disabled', true);
6499 nelberth 462
            NProgress.start();
1 www 463
            $.ajax({
464
                'dataType'  : 'json',
465
                'accept'    : 'application/json',
466
                'method'    : 'post',
467
                'url'       :  routeAdd,
468
                'data'      :  formdata,
469
                'processData': false,
470
                'contentType': false,
471
            }).done(function(response) {
6192 nelberth 472
                console.log(response)
1 www 473
                if(response['success']) {
474
                    $.fn.showSuccess(response['data']);
6499 nelberth 475
                    $('body, html').animate({scrollTop: '0px'}, 300);
476
					$('#content1').css('display','block');
6576 nelberth 477
                    $('.contenido').html('');
6591 nelberth 478
 
479
            		seleccionarCampo.css('display','none');
1 www 480
 
481
                    gridTable.api().ajax.reload(null, false);
482
                } else {
483
                    validatorImageAdd.resetForm();
484
                    if(jQuery.type(response['data']) == 'string') {
485
                        $.fn.showError(response['data']);
486
                    } else  {
487
                        $.each(response['data'], function( fieldname, errors ) {
488
                            $.fn.showFormErrorValidator('#form-slide-image-add #' + fieldname, errors);
489
                        });
490
                    }
491
                }
492
            }).fail(function( jqXHR, textStatus, errorThrown) {
493
                $.fn.showError(textStatus);
494
            }).always(function() {
495
                NProgress.done();
496
            });
497
            return false;
498
        },
499
        invalidHandler: function(form, validator) {
500
 
501
        }
502
    });
503
 
504
    var validatorImageEdit = $('#form-slide-image-edit').validate({
505
        debug: true,
506
        onclick: false,
507
        onkeyup: false,
508
        ignore: [],
509
        rules: {
510
            'name': {
511
                required: true,
512
                maxlength: 128,
513
            },
514
            'file': {
6500 nelberth 515
                required: true,
1 www 516
            },
517
            'order' : {
518
                required: true,
519
                digits: true,
520
                min: 1,
521
                max: 250
522
            }
523
        },
524
        submitHandler: function(form)
525
        {
526
            var formdata = false;
527
            if (window.FormData){
528
                formdata = new FormData(form); //form[0]);
529
            }
530
            $('input[type="submit"]').prop('disabled', true);
6500 nelberth 531
            NProgress.start();
1 www 532
            $.ajax({
533
                'dataType'  : 'json',
534
                'accept'    : 'application/json',
535
                'method'    : 'post',
536
                'url'       :  $('#form-slide-image-edit').attr('action'),
537
                'data'      :  formdata,
538
                'processData': false,
539
                'contentType': false,
540
            }).done(function(response) {
541
                if(response['success']) {
542
                    $.fn.showSuccess(response['data']);
543
 
6500 nelberth 544
                    $('body, html').animate({scrollTop: '0px'}, 300);
545
					$('#content1').css('display','block');
6576 nelberth 546
                    $('.contenido').html('');
6591 nelberth 547
 
548
            		seleccionarCampo.css('display','none');
1 www 549
 
550
                    gridTable.api().ajax.reload(null, false);
551
                } else {
552
                    validatorImageEdit.resetForm();
553
                    if(jQuery.type(response['data']) == 'string') {
554
                        $.fn.showError(response['data']);
555
                    } else  {
556
                        $.each(response['data'], function( fieldname, errors ) {
557
                            $.fn.showFormErrorValidator('#form-slide-image-edit #' + fieldname, errors);
558
                        });
559
                    }
560
                }
561
            }).fail(function( jqXHR, textStatus, errorThrown) {
562
                $.fn.showError(textStatus);
563
            }).always(function() {
564
                NProgress.done();
565
            });
566
            return false;
567
        },
568
        invalidHandler: function(form, validator) {
569
 
570
        }
571
    });
572
 
573
    var validatorVideoAdd  = $('#form-slide-video-add').validate({
574
        debug: true,
575
        onclick: false,
576
        onkeyup: false,
577
        ignore: [],
578
        rules: {
579
            'name': {
580
                required: true,
581
                maxlength: 128,
582
            },
583
           'file': {
584
                required: true,
585
                extension: 'webm,mp4,webm',
586
                accept: 'video/webm,video/mpeg,video/mp4'
587
            },
588
            'background': {
6620 nelberth 589
                required: true,
1 www 590
            },
591
            'order' : {
592
                required: true,
593
                digits: true,
594
                min: 1,
595
                max: 250
596
            }
597
        },
598
        submitHandler: function(form)
599
        {
600
            var formdata = false;
601
            if (window.FormData){
602
                formdata = new FormData(form); //form[0]);
603
            }
604
 
605
            $('input[type="submit"]').prop('disabled', true);
6620 nelberth 606
            NProgress.start();
1 www 607
            $.ajax({
608
                'dataType'  : 'json',
609
                'accept'    : 'application/json',
610
                'method'    : 'post',
611
                'url'       :  routeAdd,
612
                'data'      :  formdata,
613
                'processData': false,
614
                'contentType': false,
615
            }).done(function(response) {
616
                if(response['success']) {
617
                    $.fn.showSuccess(response['data']);
6620 nelberth 618
 
619
                    $('body, html').animate({scrollTop: '0px'}, 300);
620
					$('#content1').css('display','block');
621
                    $('.contenido').html('');
622
            		seleccionarCampo.css('display','none');
1 www 623
                    gridTable.api().ajax.reload(null, false);
624
                } else {
625
                    validatorVideoAdd.resetForm();
626
                    if(jQuery.type(response['data']) == 'string') {
627
                        $.fn.showError(response['data']);
628
                    } else  {
629
                        $.each(response['data'], function( fieldname, errors ) {
630
                            $.fn.showFormErrorValidator('#form-slide-video-add #' + fieldname, errors);
631
                        });
632
                    }
633
                }
634
            }).fail(function( jqXHR, textStatus, errorThrown) {
635
                $.fn.showError(textStatus);
636
            }).always(function() {
637
                NProgress.done();
638
            });
639
            return false;
640
        },
641
        invalidHandler: function(form, validator) {
642
 
643
        }
644
    });
645
 
646
    var validatorVideoEdit = $('#form-slide-video-edit').validate({
647
        debug: true,
648
        onclick: false,
649
        onkeyup: false,
650
        ignore: [],
651
        rules: {
652
            'name': {
653
                required: true,
654
                maxlength: 128,
655
            },
656
            'file': {
657
                required: false,
658
                extension: 'webm,mp4,webm',
659
                accept: 'video/webm,video/mpeg,video/mp4'
660
            },
661
            'background': {
6643 nelberth 662
                required: false,
663
                extension: 'jpg|jpeg|png',
664
                accept: 'image/jpg,image/jpeg,image/png'
1 www 665
            },
666
            'order' : {
667
                required: true,
668
                digits: true,
669
                min: 1,
670
                max: 250
671
            }
672
        },
673
        submitHandler: function(form)
674
        {
675
            var formdata = false;
676
            if (window.FormData){
677
                formdata = new FormData(form); //form[0]);
678
            }
679
 
680
            $('input[type="submit"]').prop('disabled', true);
681
 
682
            $.ajax({
683
                'dataType'  : 'json',
684
                'accept'    : 'application/json',
685
                'method'    : 'post',
686
                'url'       :  $('#form-slide-video-edit').attr('action'),
687
                'data'      :  formdata,
688
                'processData': false,
689
                'contentType': false,
690
            }).done(function(response) {
691
                if(response['success']) {
692
                    $.fn.showSuccess(response['data']);
693
 
6643 nelberth 694
                    $('#company-microlearning-slide-video-edit-box').modal('hide');
695
 
1 www 696
                    gridTable.api().ajax.reload(null, false);
697
                } else {
698
                    validatorVideoEdit.resetForm();
699
                    if(jQuery.type(response['data']) == 'string') {
700
                        $.fn.showError(response['data']);
701
                    } else  {
702
                        $.each(response['data'], function( fieldname, errors ) {
703
                            $.fn.showFormErrorValidator('#form-slide-video-edit #' + fieldname, errors);
704
                        });
705
                    }
706
                }
707
            }).fail(function( jqXHR, textStatus, errorThrown) {
708
                $.fn.showError(textStatus);
709
            }).always(function() {
710
                NProgress.done();
711
            });
712
            return false;
713
        },
714
        invalidHandler: function(form, validator) {
715
 
716
        }
717
    });
718
 
719
 
720
    var validatorDocumentAdd  = $('#form-slide-document-add').validate({
721
        debug: true,
722
        onclick: false,
723
        onkeyup: false,
724
        ignore: [],
725
        rules: {
726
            'name': {
727
                required: true,
728
                maxlength: 128,
729
            },
730
           'file': {
731
                required: true,
732
                extension: 'pdf',
733
                accept: 'application/pdf'
734
            },
735
           'background': {
736
                required: true,
737
                extension: 'jpg|jpeg|png',
738
                accept: 'image/jpg,image/jpeg,image/png'
739
            },
740
            'order' : {
741
                required: true,
742
                digits: true,
743
                min: 1,
744
                max: 250
745
            }
746
        },
747
        submitHandler: function(form)
748
        {
749
            var formdata = false;
750
            if (window.FormData){
751
                formdata = new FormData(form); //form[0]);
752
            }
753
 
754
            $('input[type="submit"]').prop('disabled', true);
755
 
756
            $.ajax({
757
                'dataType'  : 'json',
758
                'accept'    : 'application/json',
759
                'method'    : 'post',
760
                'url'       :  routeAdd,
761
                'data'      :  formdata,
762
                'processData': false,
763
                'contentType': false,
764
            }).done(function(response) {
765
                if(response['success']) {
766
                    $.fn.showSuccess(response['data']);
767
 
768
                    $('#company-microlearning-slide-document-add-box').modal('hide');
769
 
770
                    gridTable.api().ajax.reload(null, false);
771
                } else {
772
                    validatorDocumentAdd.resetForm();
773
                    if(jQuery.type(response['data']) == 'string') {
774
                        $.fn.showError(response['data']);
775
                    } else  {
776
                        $.each(response['data'], function( fieldname, errors ) {
777
                            $.fn.showFormErrorValidator('#form-slide-document-add #' + fieldname, errors);
778
                        });
779
                    }
780
                }
781
            }).fail(function( jqXHR, textStatus, errorThrown) {
782
                $.fn.showError(textStatus);
783
            }).always(function() {
784
                NProgress.done();
785
            });
786
            return false;
787
        },
788
        invalidHandler: function(form, validator) {
789
 
790
        }
791
    });
792
 
793
    var validatorDocumentEdit = $('#form-slide-document-edit').validate({
794
        debug: true,
795
        onclick: false,
796
        onkeyup: false,
797
        ignore: [],
798
        rules: {
799
            'name': {
800
                required: true,
801
                maxlength: 128,
802
            },
803
           'file': {
804
                required: true,
805
                extension: 'pdf',
806
                accept: 'application/pdf'
807
            },
808
           'background': {
809
                required: true,
810
                extension: 'jpg|jpeg|png',
811
                accept: 'image/jpg,image/jpeg,image/png'
812
            },
813
            'order' : {
814
                required: true,
815
                digits: true,
816
                min: 1,
817
                max: 250
818
            }
819
        },
820
        submitHandler: function(form)
821
        {
822
            var formdata = false;
823
            if (window.FormData){
824
                formdata = new FormData(form); //form[0]);
825
            }
826
 
827
            $('input[type="submit"]').prop('disabled', true);
828
 
829
            $.ajax({
830
                'dataType'  : 'json',
831
                'accept'    : 'application/json',
832
                'method'    : 'post',
833
                'url'       :  $('#form-slide-document-edit').attr('action'),
834
                'data'      :  formdata,
835
                'processData': false,
836
                'contentType': false,
837
            }).done(function(response) {
838
                if(response['success']) {
839
                    $.fn.showSuccess(response['data']);
840
 
841
                    $('#company-microlearning-slide-document-edit-box').modal('hide');
842
 
843
                    gridTable.api().ajax.reload(null, false);
844
                } else {
845
                    validatorDocumentEdit.resetForm();
846
                    if(jQuery.type(response['data']) == 'string') {
847
                        $.fn.showError(response['data']);
848
                    } else  {
849
                        $.each(response['data'], function( fieldname, errors ) {
850
                            $.fn.showFormErrorValidator('#form-slide-document-edit #' + fieldname, errors);
851
                        });
852
                    }
853
                }
854
            }).fail(function( jqXHR, textStatus, errorThrown) {
855
                $.fn.showError(textStatus);
856
            }).always(function() {
857
                NProgress.done();
858
            });
859
            return false;
860
        },
861
        invalidHandler: function(form, validator) {
862
 
863
        }
864
    });
865
 
866
    var validatorAudioAdd  = $('#form-slide-audio-add').validate({
867
        debug: true,
868
        onclick: false,
869
        onkeyup: false,
870
        ignore: [],
871
        rules: {
872
            'name': {
873
                required: true,
874
                maxlength: 128,
875
            },
876
           'file': {
877
                required: true,
878
                extension: 'wav|mp3',
879
                accept: 'audio/wav, audio/mpeg'
880
            },
881
 
882
           'background': {
883
                required: true,
884
                extension: 'jpg|jpeg|png',
885
                accept: 'image/jpg,image/jpeg,image/png'
886
            },
887
            'order' : {
888
                required: true,
889
                digits: true,
890
                min: 1,
891
                max: 250
892
            }
893
        },
894
        submitHandler: function(form)
895
        {
896
            var formdata = false;
897
            if (window.FormData){
898
                formdata = new FormData(form); //form[0]);
899
            }
900
 
901
            $('input[type="submit"]').prop('disabled', true);
902
 
903
            $.ajax({
904
                'dataType'  : 'json',
905
                'accept'    : 'application/json',
906
                'method'    : 'post',
907
                'url'       :  routeAdd,
908
                'data'      :  formdata,
909
                'processData': false,
910
                'contentType': false,
911
            }).done(function(response) {
912
                if(response['success']) {
913
                    $.fn.showSuccess(response['data']);
914
 
915
                    $('#company-microlearning-slide-audio-add-box').modal('hide');
916
 
917
                    gridTable.api().ajax.reload(null, false);
918
                } else {
919
                    validatorAudioAdd.resetForm();
920
                    if(jQuery.type(response['data']) == 'string') {
921
                        $.fn.showError(response['data']);
922
                    } else  {
923
                        $.each(response['data'], function( fieldname, errors ) {
924
                            $.fn.showFormErrorValidator('#form-slide-audio-add #' + fieldname, errors);
925
                        });
926
                    }
927
                }
928
            }).fail(function( jqXHR, textStatus, errorThrown) {
929
                $.fn.showError(textStatus);
930
            }).always(function() {
931
                NProgress.done();
932
            });
933
            return false;
934
        },
935
        invalidHandler: function(form, validator) {
936
 
937
        }
938
    });
939
 
940
    var validatorAudioEdit = $('#form-slide-audio-edit').validate({
941
        debug: true,
942
        onclick: false,
943
        onkeyup: false,
944
        ignore: [],
945
        rules: {
946
            'name': {
947
                required: true,
948
                maxlength: 128,
949
            },
950
           'file': {
951
                required: true,
952
                extension: 'wav|mp3',
953
                accept: 'audio/wav, audio/mpeg'
954
            },
955
 
956
           'background': {
957
                required: true,
958
                extension: 'jpg|jpeg|png',
959
                accept: 'image/jpg,image/jpeg,image/png'
960
            },
961
            'order' : {
962
                required: true,
963
                digits: true,
964
                min: 1,
965
                max: 250
966
            }
967
        },
968
        submitHandler: function(form)
969
        {
970
            var formdata = false;
971
            if (window.FormData){
972
                formdata = new FormData(form); //form[0]);
973
            }
974
 
975
            $('input[type="submit"]').prop('disabled', true);
976
 
977
            $.ajax({
978
                'dataType'  : 'json',
979
                'accept'    : 'application/json',
980
                'method'    : 'post',
981
                'url'       :  $('#form-slide-audio-edit').attr('action'),
982
                'data'      :  formdata,
983
                'processData': false,
984
                'contentType': false,
985
            }).done(function(response) {
986
                if(response['success']) {
987
                    $.fn.showSuccess(response['data']);
988
 
989
                    $('#company-microlearning-slide-audio-edit-box').modal('hide');
990
 
991
                    gridTable.api().ajax.reload(null, false);
992
                } else {
993
                    validatorAudioEdit.resetForm();
994
                    if(jQuery.type(response['data']) == 'string') {
995
                        $.fn.showError(response['data']);
996
                    } else  {
997
                        $.each(response['data'], function( fieldname, errors ) {
998
                            $.fn.showFormErrorValidator('#form-slide-audio-edit #' + fieldname, errors);
999
                        });
1000
                    }
1001
                }
1002
            }).fail(function( jqXHR, textStatus, errorThrown) {
1003
                $.fn.showError(textStatus);
1004
            }).always(function() {
1005
                NProgress.done();
1006
            });
1007
            return false;
1008
        },
1009
        invalidHandler: function(form, validator) {
1010
 
1011
        }
1012
    });
1013
 
1014
    var validatorQuizzAdd  = $('#form-slide-quizz-add').validate({
1015
        debug: true,
1016
        onclick: false,
1017
        onkeyup: false,
1018
        ignore: [],
1019
        rules: {
1020
            'name': {
1021
                required: true,
1022
                maxlength: 128,
1023
            },
1024
           'file': {
1025
                required: true,
1026
                extension: 'wav|mp3',
1027
                accept: 'quizz/wav, quizz/mpeg'
1028
            },
1029
            'quiz_id': {
1030
                required: true,
1031
            },
1032
            'order' : {
1033
                required: true,
1034
                digits: true,
1035
                min: 1,
1036
                max: 250
1037
            }
1038
        },
1039
        submitHandler: function(form)
1040
        {
1041
 
1042
            $('input[type="submit"]').prop('disabled', true);
1043
 
1044
            var formdata = false;
1045
            if (window.FormData){
1046
                formdata = new FormData(form); //form[0]);
1047
            }
1048
 
1049
            $.ajax({
1050
                'dataType'  : 'json',
1051
                'accept'    : 'application/json',
1052
                'method'    : 'post',
1053
                'url'       :  routeAdd,
1054
                'data'      :  formdata,
1055
                'processData': false,
1056
                'contentType': false,
1057
            }).done(function(response) {
1058
                if(response['success']) {
1059
                    $.fn.showSuccess(response['data']);
1060
 
1061
                    $('#company-microlearning-slide-quizz-add-box').modal('hide');
1062
 
1063
                    gridTable.api().ajax.reload(null, false);
1064
                } else {
1065
                    validatorQuizzAdd.resetForm();
1066
                    if(jQuery.type(response['data']) == 'string') {
1067
                        $.fn.showError(response['data']);
1068
                    } else  {
1069
                        $.each(response['data'], function( fieldname, errors ) {
1070
                            $.fn.showFormErrorValidator('#form-slide-quizz-add #' + fieldname, errors);
1071
                        });
1072
                    }
1073
                }
1074
            }).fail(function( jqXHR, textStatus, errorThrown) {
1075
                $.fn.showError(textStatus);
1076
            }).always(function() {
1077
                NProgress.done();
1078
            });
1079
            return false;
1080
        },
1081
        invalidHandler: function(form, validator) {
1082
 
1083
        }
1084
    });
1085
 
1086
    var validatorQuizzEdit = $('#form-slide-quizz-edit').validate({
1087
        debug: true,
1088
        onclick: false,
1089
        onkeyup: false,
1090
        ignore: [],
1091
        rules: {
1092
            'name': {
1093
                required: true,
1094
                maxlength: 128,
1095
            },
1096
           'background': {
1097
                required: false,
1098
                extension: 'jpg|jpeg|png',
1099
                accept: 'image/jpg,image/jpeg,image/png'
1100
            },
1101
            'quiz_id': {
1102
                required: true,
1103
            },
1104
            'order' : {
1105
                required: true,
1106
                digits: true,
1107
                min: 1,
1108
                max: 250
1109
            }
1110
        },
1111
        submitHandler: function(form)
1112
        {
1113
 
1114
            $('input[type="submit"]').prop('disabled', true);
1115
 
1116
            var formdata = false;
1117
            if (window.FormData){
1118
                formdata = new FormData(form); //form[0]);
1119
            }
1120
            $.ajax({
1121
                'dataType'  : 'json',
1122
                'accept'    : 'application/json',
1123
                'method'    : 'post',
1124
                'url'       :  routeAdd,
1125
                'data'      :  formdata,
1126
                'processData': false,
1127
                'contentType': false,
1128
            }).done(function(response) {
1129
                if(response['success']) {
1130
                    $.fn.showSuccess(response['data']);
1131
 
1132
                    $('#company-microlearning-slide-quizz-edit-box').modal('hide');
1133
 
1134
                    gridTable.api().ajax.reload(null, false);
1135
                } else {
1136
                    validatorQuizzEdit.resetForm();
1137
                    if(jQuery.type(response['data']) == 'string') {
1138
                        $.fn.showError(response['data']);
1139
                    } else  {
1140
                        $.each(response['data'], function( fieldname, errors ) {
1141
                            $.fn.showFormErrorValidator('#form-slide-quizz-edit #' + fieldname, errors);
1142
                        });
1143
                    }
1144
                }
1145
            }).fail(function( jqXHR, textStatus, errorThrown) {
1146
                $.fn.showError(textStatus);
1147
            }).always(function() {
1148
                NProgress.done();
1149
            });
1150
            return false;
1151
        },
1152
        invalidHandler: function(form, validator) {
1153
 
1154
        }
1155
    });
6591 nelberth 1156
 
1 www 1157
    $('body').on('click', 'button.btn-edit', function(e) {
1158
        e.preventDefault();
1159
 
1160
        var url = $(this).data('href');
1161
        $.ajax({
1162
            'dataType'  : 'json',
1163
            'accept'    : 'application/json',
1164
            'method'    : 'get',
1165
            'url'       :  url,
1166
        }).done(function(response) {
1167
            if(response['success']) {
1168
 
1169
                if(response['data']['type'] == 'text') {
1170
                    $('#form-slide-text-edit').attr('action',url);
1171
                    $('#form-slide-text-edit #name').val(response['data']['name']);
1172
                    $('#form-slide-text-edit #order').val(response['data']['order']);
1173
 
1174
                    CKEDITOR.instances.description_edit.setData(response['data']['description']);
1175
                    validatorTextEdit.resetForm();
1176
 
1177
 
6595 nelberth 1178
                    $('body, html').animate({scrollTop: '0px'}, 300);
1179
					$('#content1').css('display','none');
6601 nelberth 1180
                    seleccionarCampo= $('#company-microlearning-slide-text-edit-box');
1181
                    seleccionarCampo.css('display','block')
6595 nelberth 1182
		            iniciarEditor(seleccionarCampo,response['data']['background'])
1183
 
1 www 1184
                }
1185
                if(response['data']['type'] == 'image') {
6510 nelberth 1186
                    console.log(response['data']['file'])
1 www 1187
                    $('#form-slide-image-edit').attr('action',url);
1188
                    $('#form-slide-image-edit #name').val(response['data']['name']);
1189
                    $('#form-slide-image-edit #order').val(response['data']['order']);
1190
                    validatorImageEdit.resetForm();
1191
 
6501 nelberth 1192
                    $('body, html').animate({scrollTop: '0px'}, 300);
1193
					$('#content1').css('display','none');
6586 nelberth 1194
                    seleccionarCampo=  $('#company-microlearning-slide-image-edit-box ');
6601 nelberth 1195
                    seleccionarCampo.css('display','block')
6568 nelberth 1196
		            iniciarEditor(seleccionarCampo,response['data']['file'])
1 www 1197
 
1198
                }
1199
                if(response['data']['type'] == 'video') {
1200
                    $('#form-slide-video-edit').attr('action',url);
1201
                    $('#form-slide-video-edit #name').val(response['data']['name']);
1202
                    $('#form-slide-video-edit #order').val(response['data']['order']);
1203
                    $('#form-slide-video-edit #file').fileinput('reset');
1204
                    $('#form-slide-video-edit #file').val('');
1205
                    validatorVideoEdit.resetForm();
1206
 
6613 nelberth 1207
 
1208
 
1209
                    $('body, html').animate({scrollTop: '0px'}, 300);
1210
					$('#content1').css('display','none');
1211
                    seleccionarCampo= $('#company-microlearning-slide-video-edit-box');
1212
                    seleccionarCampo.css('display','block')
1213
		            iniciarEditor(seleccionarCampo,response['data']['background'])
1 www 1214
 
1215
                }
1216
                if(response['data']['type'] == 'document') {
1217
                    $('#form-slide-document-edit').attr('action',url);
1218
                    $('#form-slide-document-edit #name').val(response['data']['name']);
1219
                    $('#form-slide-document-edit #order').val(response['data']['order']);
1220
                    $('#form-slide-document-edit #file').fileinput('reset');
1221
                    $('#form-slide-document-edit #file').val('');
1222
                    validatorDocumentEdit.resetForm();
1223
 
6613 nelberth 1224
                    $('body, html').animate({scrollTop: '0px'}, 300);
1225
					$('#content1').css('display','none');
1226
                    seleccionarCampo= $('#company-microlearning-slide-document-edit-box');
1227
                    seleccionarCampo.css('display','block')
1228
		            iniciarEditor(seleccionarCampo,response['data']['background'])
1 www 1229
 
1230
                }
1231
                if(response['data']['type'] == 'audio') {
1232
                    $('#form-slide-audio-edit').attr('action',url);
1233
                    $('#form-slide-audio-edit #name').val(response['data']['name']);
1234
                    $('#form-slide-audio-edit #order').val(response['data']['order']);
1235
                    $('#form-slide-audio-edit #file').fileinput('reset');
1236
                    $('#form-slide-audio-edit #file').val('');
1237
                    validatorAudioEdit.resetForm();
1238
 
6613 nelberth 1239
                    $('body, html').animate({scrollTop: '0px'}, 300);
1240
					$('#content1').css('display','none');
1241
                    seleccionarCampo= $('#company-microlearning-slide-audio-edit-box');
1242
                    seleccionarCampo.css('display','block')
1243
		            iniciarEditor(seleccionarCampo,response['data']['background'])
1 www 1244
 
6613 nelberth 1245
 
1 www 1246
                }
1247
                if(response['data']['type'] == 'quiz') {
1248
                    $('#form-slide-quizz-edit').attr('action',url);
1249
                    $('#form-slide-quizz-edit #name').val(response['data']['name']);
1250
                    $('#form-slide-quizz-edit #order').val(response['data']['order']);
1251
                    $('#form-slide-quizz-edit #quiz_id').val(response['data']['quiz_id']);
1252
                    validatorQuizzEdit.resetForm();
1253
 
6613 nelberth 1254
                    $('body, html').animate({scrollTop: '0px'}, 300);
1255
					$('#content1').css('display','none');
1256
                    seleccionarCampo= $('#company-microlearning-slide-quizz-edit-box');
1257
                    seleccionarCampo.css('display','block')
1258
		            iniciarEditor(seleccionarCampo,response['data']['background'])
1 www 1259
 
1260
                }
1261
 
1262
            } else {
1263
                validatorTextEdit.resetForm();
1264
                if(jQuery.type(response['data']) == 'string') {
1265
                    $.fn.showError(response['data']);
1266
                } else  {
1267
                    $.each(response['data'], function( fieldname, errors ) {
1268
                        $.fn.showFormErrorValidator('#form-slide-image-edit #' + fieldname, errors);
1269
                    });
1270
                }
1271
            }
1272
        }).fail(function( jqXHR, textStatus, errorThrown) {
1273
            $.fn.showError(textStatus);
1274
        }).always(function() {
1275
            NProgress.done();
1276
        });
1277
    });
6503 nelberth 1278
	$('body').on('click', '#ir_atras', function(e) {
1279
            e.preventDefault();
1280
            $('body, html').animate({scrollTop: '0px'}, 300);
6504 nelberth 1281
			$('#content1').css('display','block');
6592 nelberth 1282
            seleccionarCampo.css('display','none');
6575 nelberth 1283
            $('.contenido').html('');
6503 nelberth 1284
            return false;
1285
        });
1 www 1286
    $(".btn-cover-close").on("click", function(e){
1287
        e.preventDefault();
1288
 
1289
 
1290
        $('#company-microlearning-slide-text-add-box').modal('hide');
1291
        $('#company-microlearning-slide-text-edit-box').modal('hide');
1292
        $('#company-microlearning-slide-image-add-box').modal('hide');
1293
        $('#company-microlearning-slide-image-edit-box').modal('hide');
1294
        $('#company-microlearning-slide-video-add-box').modal('hide');
1295
        $('#company-microlearning-slide-video-edit-box').modal('hide');
1296
        $('#company-microlearning-slide-document-add-box').modal('hide');
1297
        $('#company-microlearning-slide-document-edit-box').modal('hide');
1298
        $('#company-microlearning-slide-audio-add-box').modal('hide');
1299
        $('#company-microlearning-slide-audio-edit-box').modal('hide');
1300
        $('#company-microlearning-slide-quizz-add-box').modal('hide');
1301
        $('#company-microlearning-slide-quizz-edit-box').modal('hide');
1302
        $('#company-microlearning-play-video-box').modal('hide');
1303
        $('#company-microlearning-play-audio-box').modal('hide');
1304
        $('#company-microlearning-add-capsule-type-box').modal('hide');
1305
 
1306
 
1307
 
1308
         document.getElementById('microlearning-play-video').pause();
1309
         document.getElementById('microlearning-play-audio').pause();
1310
 
1311
        return false;
1312
    });
1313
 
1314
    $('body').on('click', 'button.btn-add-quizz', function(e) {
1315
        e.preventDefault();
1316
        $('#company-microlearning-add-capsule-type-box').modal('hide');
1317
 
1318
 
1319
        $('#form-slide-quizz-add #name').val('');
1320
        $('#form-slide-quizz-add #order').val('1');
1321
        $('#form-slide-quizz-add #quiz_id').val('');
1322
        CKEDITOR.instances.description_add.setData('');
1323
        validatorQuizzAdd.resetForm();
1324
 
1325
 
6616 nelberth 1326
        $('body, html').animate({scrollTop: '0px'}, 300);
1327
		$('#content1').css('display','none');
1328
        seleccionarCampo= $('#company-microlearning-slide-quizz-add-box');
1329
        seleccionarCampo.css('display','block')
1330
		iniciarEditor(seleccionarCampo)
1 www 1331
 
1332
        return false;
1333
    });
1334
 
1335
    $('body').on('click', 'button.btn-add-text', function(e) {
1336
        e.preventDefault();
1337
 
1338
        $('#company-microlearning-add-capsule-type-box').modal('hide');
1339
 
1340
        $('#form-slide-text-add #name').val('');
1341
        $('#form-slide-text-add #order').val('1');
1342
        CKEDITOR.instances.description_add.setData('');
1343
        validatorTextAdd.resetForm();
1344
 
6616 nelberth 1345
        $('body, html').animate({scrollTop: '0px'}, 300);
1346
		$('#content1').css('display','none');
6590 nelberth 1347
        seleccionarCampo =  $('#company-microlearning-slide-text-add-box');
6616 nelberth 1348
        seleccionarCampo.css('display','block')
6556 nelberth 1349
		iniciarEditor(seleccionarCampo)
1 www 1350
        return false;
1351
    });
1352
 
1353
 
1354
    $('body').on('click', 'button.btn-add-image', function(e) {
1355
        e.preventDefault();
1356
 
1357
        $('#company-microlearning-add-capsule-type-box').modal('hide');
1358
        $('#form-slide-image-add #name').val('');
1359
        $('#form-slide-image-add #order').val('1');
6112 nelberth 1360
 
1 www 1361
        validatorImageAdd.resetForm();
1362
 
6616 nelberth 1363
        $('body, html').animate({scrollTop: '0px'}, 300);
1364
		$('#content1').css('display','none');
1365
        seleccionarCampo =  $('#company-microlearning-slide-image-add-box');
1366
        seleccionarCampo.css('display','block')
6565 nelberth 1367
		iniciarEditor(seleccionarCampo)
6122 nelberth 1368
 
1 www 1369
        return false;
1370
    });
1371
 
1372
    $('body').on('click', 'button.btn-add-video', function(e) {
1373
        e.preventDefault();
1374
 
1375
        $('#company-microlearning-add-capsule-type-box').modal('hide');
1376
        $('#form-slide-video-add #name').val('');
1377
        $('#form-slide-video-add #order').val('1');
1378
        $('#form-slide-video-add #file').fileinput('reset');
1379
        $('#form-slide-video-add #file').val('');
1380
        $('#form-slide-video-add #file').fileinput('reset');
1381
        $('#form-slide-video-add #file').val('');
1382
        validatorVideoAdd.resetForm();
1383
 
6616 nelberth 1384
 
1385
        $('body, html').animate({scrollTop: '0px'}, 300);
1386
		$('#content1').css('display','none');
1387
        seleccionarCampo =  $('#company-microlearning-slide-video-add-box');
1388
        seleccionarCampo.css('display','block')
1389
		iniciarEditor(seleccionarCampo)
1 www 1390
 
1391
        return false;
1392
    });
1393
 
1394
    $('body').on('click', 'button.btn-add-document', function(e) {
1395
        e.preventDefault();
1396
 
1397
 
1398
        $('#company-microlearning-add-capsule-type-box').modal('hide');
1399
        $('#form-slide-document-add #name').val('');
1400
        $('#form-slide-document-add #order').val('1');
1401
        $('#form-slide-document-add #file').fileinput('reset');
1402
        $('#form-slide-document-add #file').val('');
1403
        validatorDocumentAdd.resetForm();
1404
 
6616 nelberth 1405
        $('body, html').animate({scrollTop: '0px'}, 300);
1406
		$('#content1').css('display','none');
1407
        seleccionarCampo =  $('#company-microlearning-slide-document-add-box');
1408
        seleccionarCampo.css('display','block')
1409
		iniciarEditor(seleccionarCampo)
1 www 1410
 
1411
        return false;
1412
    });
1413
 
1414
    $('body').on('click', 'button.btn-add-audio', function(e) {
1415
        e.preventDefault();
1416
 
1417
        $('#company-microlearning-add-capsule-type-box').modal('hide');
1418
        $('#form-slide-audio-add #name').val('');
1419
        $('#form-slide-audio-add #order').val('1');
1420
        $('#form-slide-audio-add #file').fileinput('reset');
1421
        $('#form-slide-audio-add #file').val('');
1422
        validatorAudioAdd.resetForm();
1423
 
6616 nelberth 1424
        $('body, html').animate({scrollTop: '0px'}, 300);
1425
		$('#content1').css('display','none');
1426
        seleccionarCampo =  $('#company-microlearning-slide-audio-add-box');
1427
        seleccionarCampo.css('display','block')
1428
		iniciarEditor(seleccionarCampo)
1 www 1429
 
1430
        return false;
1431
    });
1432
 
1433
    $('#company-microlearning-slide-text-add-box, #company-microlearning-slide-text-edit-box').on("hide.bs.modal", function() {
1434
 
1435
    })
1436
 
1437
    $('#company-microlearning-slide-image-add-box, #company-microlearning-slide-image-edit-box').on("hide.bs.modal", function() {
1438
 
1439
    })
1440
 
1441
    $('#company-microlearning-slide-video-add-box, #company-microlearning-slide-video-edit-box').on("hide.bs.modal", function() {
1442
 
1443
    })
1444
 
1445
    $('#company-microlearning-slide-document-add-box, #company-microlearning-slide-document-edit-box').on("hide.bs.modal", function() {
1446
 
1447
    })
1448
 
1449
    $('#company-microlearning-slide-quizz-add-box, #company-microlearning-slide-quizz-edit-box').on("hide.bs.modal", function() {
1450
 
1451
    })
1452
 
1453
    $('#company-microlearning-play-video-box, #company-microlearning-play-audio-box').on("hide.bs.modal", function() {
1454
 
1455
 
1456
        document.getElementById('microlearning-play-video').pause();
1457
        document.getElementById('microlearning-play-audio').pause();
1458
    })
1459
 
1460
 
1461
    $('#form-slide-text-add #order').inputNumberFormat({decimal: 0});
1462
 
6591 nelberth 1463
 
1 www 1464
 
1465
    $('#form-slide-text-edit #order').inputNumberFormat({decimal: 0});
1466
 
1467
 
6591 nelberth 1468
 
1 www 1469
    $('#form-slide-image-add #order').inputNumberFormat({decimal: 0});
1470
 
6522 nelberth 1471
 
1 www 1472
 
1473
    $('#form-slide-image-edit #order').inputNumberFormat({decimal: 0});
1474
 
6522 nelberth 1475
 
1 www 1476
 
1477
    $('#form-slide-video-add #order').inputNumberFormat({decimal: 0});
1478
 
1479
    $('#form-slide-video-add #file').fileinput({
1480
        theme: 'fas',
1481
        language: 'es',
1482
        showUpload: false,
1483
        dropZoneEnabled: false,
1484
        maxFileCount: 1,
1485
        allowedFileExtensions: ['mp4', 'mpeg','webm'],
1486
        msgPlaceholder: 'Video de extensión mp4, mpeg, webm',
1487
    });
1488
 
1489
 
6591 nelberth 1490
 
1 www 1491
    $('#form-slide-video-edit #order').inputNumberFormat({decimal: 0});
1492
 
1493
    $('#form-slide-video-edit #file').fileinput({
1494
        theme: 'fas',
1495
        language: 'es',
1496
        showUpload: false,
1497
        dropZoneEnabled: false,
1498
        maxFileCount: 1,
1499
        allowedFileExtensions: ['mp4', 'mpeg','webm'],
1500
        msgPlaceholder: 'Video de extensión mp4, mpeg, webm',
1501
    });
1502
 
1503
 
6591 nelberth 1504
 
1 www 1505
 
1506
 
1507
    $('#form-slide-document-add #order').inputNumberFormat({decimal: 0});
1508
 
1509
    $('#form-slide-document-add #file').fileinput({
1510
        theme: 'fas',
1511
        language: 'es',
1512
        showUpload: false,
1513
        dropZoneEnabled: false,
1514
        maxFileCount: 1,
1515
        allowedFileExtensions: ['pdf'],
1516
        msgPlaceholder: 'Documentos de extensión pdf',
1517
    });
1518
 
1519
 
1520
 
6591 nelberth 1521
 
1 www 1522
    $('#form-slide-document-edit #order').inputNumberFormat({decimal: 0});
1523
 
1524
    $('#form-slide-document-edit #file').fileinput({
1525
        theme: 'fas',
1526
        language: 'es',
1527
        showUpload: false,
1528
        dropZoneEnabled: false,
1529
        maxFileCount: 1,
1530
        allowedFileExtensions: ['pdf'],
1531
        msgPlaceholder: 'Documentos de extensión pdf',
1532
    });
1533
 
1534
 
1535
 
6591 nelberth 1536
 
1 www 1537
    $('#form-slide-audio-add #order').inputNumberFormat({decimal: 0});
1538
 
1539
    $('#form-slide-audio-add #file').fileinput({
1540
        theme: 'fas',
1541
        language: 'es',
1542
        showUpload: false,
1543
        dropZoneEnabled: false,
1544
        maxFileCount: 1,
1545
        allowedFileExtensions: ['wav', 'mp3'],
1546
        msgPlaceholder: 'Audios de extensión wav y mp3',
1547
    });
1548
 
1549
 
1550
 
6591 nelberth 1551
 
1 www 1552
    $('#form-slide-audio-edit #order').inputNumberFormat({decimal: 0});
1553
 
1554
    $('#form-slide-audio-edit #file').fileinput({
1555
        theme: 'fas',
1556
        language: 'es',
1557
        showUpload: false,
1558
        dropZoneEnabled: false,
1559
        maxFileCount: 1,
1560
        allowedFileExtensions: ['wav', 'mp3'],
1561
        msgPlaceholder: 'Audios de extensión wav y mp3',
1562
    });
1563
 
1564
 
1565
 
6591 nelberth 1566
 
1 www 1567
    $('#form-slide-quizz-add #order').inputNumberFormat({decimal: 0});
1568
 
1569
 
1570
 
6591 nelberth 1571
 
1 www 1572
    $('#form-slide-quizz-edit #order').inputNumberFormat({decimal: 0});
1573
 
6591 nelberth 1574
 
1 www 1575
 
1576
 
1577
 
1578
 
1579
 
1580
 
1581
 
1582
    CKEDITOR.replace('description_add');
1583
    CKEDITOR.replace('description_edit');
1584
 
1585
 
1586
   $('body').on('click', '.btn-view-image', function(e) {
1587
        e.preventDefault();
1588
 
1589
        $('#company-microlearning-view-image-box').modal('show');
1590
 
1591
        $('#image-view').attr('src', $(this).data('href'));
1592
 
1593
        return false;
1594
    });
1595
 
1596
 
1597
    $('body').on('click', '.btn-play-video', function(e) {
1598
        e.preventDefault();
1599
 
1600
        $('#microlearning-play-video').attr('src', $(this).data('href'));
1601
        $('#company-microlearning-play-video-box').modal('show');
1602
 
1603
        return false;
1604
    });
1605
 
1606
    $('body').on('click', '.btn-play-audio', function(e) {
1607
        e.preventDefault();
1608
 
1609
 
1610
        $('#microlearning-play-audio').attr('src', $(this).data('href'));
1611
        $('#company-microlearning-play-audio-box').modal('show');
1612
 
1613
        return false;
1614
    });
1615
 
1616
    $('body').on('click', '.btn-view-document', function(e) {
1617
        e.preventDefault();
1618
 
1619
 
1620
        $('#document-view').attr('src', $(this).data('href'));
1621
        $('#company-microlearning-view-document-box').modal('show');
1622
 
1623
        return false;
1624
    });
1625
 
1626
    $('body').on('click', '.btn-view-text', function(e) {
1627
        e.preventDefault();
1628
 
1629
        var url = $(this).data('href');
1630
        $.ajax({
1631
            'dataType'  : 'json',
1632
            'accept'    : 'application/json',
1633
            'method'    : 'get',
1634
            'url'       :  url,
1635
        }).done(function(response) {
1636
            if(response['success']) {
1637
                $('#document-text').html( response['data']  );
1638
            }
1639
 
1640
        }).fail(function( jqXHR, textStatus, errorThrown) {
1641
            $.fn.showError(textStatus);
1642
        }).always(function() {
1643
            NProgress.done();
1644
        });
1645
 
1646
 
1647
        $('#company-microlearning-view-text-box').modal('show');
1648
 
1649
        return false;
1650
    });
1651
 
1652
 
1653
 
1654
    $('#form-filter #topic_uuid').change(function(e) {
1655
        e.preventDefault();
1656
 
1657
        $('#form-filter #capsule_uuid').empty();
1658
        gridTable.api().ajax.reload(null, false);
1659
    })
1660
 
1661
 
1662
    $('#form-filter #capsule_uuid').change(function(e) {
1663
        e.preventDefault();
1664
 
1665
        gridTable.api().ajax.reload(null, false);
1666
    })
1667
 
1668
    $('button.btn-add').click(function(e) {
1669
        e.preventDefault()
1670
 
1671
        $('#company-microlearning-add-capsule-type-box').modal('show');
1672
 
1673
    } );
1674
 
1675
 
1676
 
1677
    $('body').on('click', 'button.btn-refresh', function(e) {
1678
        e.preventDefault();
1679
        gridTable.api().ajax.reload(null, false);
1680
    });
1681
 
6113 nelberth 1682
    	/*Script del editor (Aqui comienza el cielo y la tierra) */
1683
		var imagenServidorNoticia;
1684
		var scroll_altura,viente;
1685
		var nombre_user = $(".perfil_u_nombre").text();
1686
		var primer_nombre = nombre_user.split(" ")[0];
6543 nelberth 1687
		var nuevoHtmlImagen='<div class="articulo_noticia animated fadeIn"><div class="pasos"><div class="titulo_pasos animated fadeInDown delay-04 fast">LABEL_STEP_1</div><div class="paso_opcion"><div class="responsing_cut"><div class="icon_cut"><span class="fa fa-scissors"></span></div><div class="contenido_cut"><div class="animated fadeInRight delay-04 fast"><div><div class="titulo_cut"><div>LABEL_CUT</div><div class="fa fa-times" id="cerrar_cut_modal"></div></div><div class="opcion_editor recortar10"><div>LABEL_CUT</div><div id="blockCelda"><span class="fa fa-lock"></span></div></div></div></div></div></div><div class="responsing_text"><div class="icon_text"><span class="fa fa-text-width"></span></div><div class="contenido_text"><div class="animated fadeInRight delay-04 fast"><div class="texto"><div class="titulo_text"><div>LABEL_ADD_TEXT</div><div class="fa fa-times" id="cerrar_text_modal"></div></div><input id="texto_input" type="text" name="texto" placeholder="LABEL_ADD_TEXT_HERE"><div class="fonts"><div class="font" id="negritas" data-tooltip="Negritas"><i class="fa fa-bold" aria-hidden="true"></i></div><div class="font" id="italic" data-tooltip="Letra Cursiva"><i class="fa fa-italic" aria-hidden="true"></i></div><input type="color" class="" data-tooltip="Color de la letra" name="" id="color" value="#ffffff"> <input type="number" class="" data-tooltip="Tamaño de la letra" name="" id="font-size" max="500" min="1" step="1" value="48"></div><div class="fonts"><div class="font fa" data-tooltip="Sombra de la letra" id="shadow">A</div><div class="font" id="rectangulo" data-tooltip="Fondo de la letra"><div class="rectangulo">C</div></div><input type="color" name="" id="colorrect" value="#000000" class="" data-tooltip="Color del fondo"> <input type="number" name="" id="opacidad" max="100" min="1" step="1" value="100" class="" data-tooltip="Transparensia del fondo"></div><div class="fonts_style"><div class="fs at" id="arial">LABEL_FONT_ARIAL</div><div class="fs" id="calibri">LABEL_FONT_CALIBRI</div><div class="fs" id="forte">LABEL_FONT_FORTE</div><div class="fs" id="impact">LABEL_FONT_IMPACT</div><div class="fs" id="jokerman">LABEL_FONT_JOKERMAN</div><div class="fs" id="mb">LABEL_FONT_MV_BOLI</div><div class="fs" id="tnr">LABEL_FONT_TIMES_NEW_ROMAN</div><div class="fs" id="verdana">LABEL_FONT_VERDANA</div><div class="fs" id="vivaldi">LABEL_FONT_VIVALDI</div></div></div></div></div></div><div class="responsing_filtros"><div class="icon_filter"><span class="fa fa-eyedropper"></span></div><div class="contenido_filter"><div class="titulo_filtro"><div>LABEL_FILTERS</div><div class="fa fa-times" id="cerrar_filter_modal"></div></div><div class="opciones_imagen"><div class="opcion_editor oa" id="normal">LABEL_FILTER_NORMAL</div><div class="opcion_editor" id="noche">LABEL_FILTER_NIGHT</div><div class="opcion_editor" id="sa">LABEL_FILTER_SAINT_ANA</div><div class="opcion_editor" id="crema">LABEL_FILTER_CREAM</div><div class="opcion_editor" id="magia">LABEL_FILTER_MAGIC</div><div class="opcion_editor" id="relieve">LABEL_FILTER_RELIEF</div><div class="opcion_editor" id="luz">LABEL_FILTER_LIGHT</div><div class="opcion_editor" id="saturacion">LABEL_FILTER_SATURATION</div><div class="opcion_editor" id="retoque">LABEL_FILTER_RETOUCH</div><div class="opcion_editor" id="orange">LABEL_FILTER_ORANGE</div><div class="opcion_editor" id="setenta">LABEL_FILTER_WIND</div><div class="opcion_editor" id="desierto">LABEL_FILTER_DESERT</div><div class="opcion_editor" id="bosque">LABEL_FILTER_FOREST</div><div class="opcion_editor" id="villa">LABEL_FILTER_TOWN</div><div class="opcion_editor" id="rosa">LABEL_FILTER_PINK</div><div class="opcion_editor" id="historia">LABEL_FILTER_HISTORY</div><div class="opcion_editor" id="gris">LABEL_FILTER_GRAY</div><div class="opcion_editor" id="lhs">LABEL_FILTER_OLD_PICTURE</div><div class="opcion_editor" id="encantador">LABEL_FILTER_CHARMING</div><div class="opcion_editor" id="emocion">LABEL_FILTER_EMOTION</div><div class="opcion_editor" id="beige">LABEL_FILTER_BEIGE</div><div class="opcion_editor" id="fine">LABEL_FILTER_FINE</div><div class="opcion_editor" id="lord">LABEL_FILTER_LORD</div><div class="opcion_editor" id="70">LABEL_FILTER_70S</div><div class="opcion_editor" id="arbol">LABEL_FILTER_TREE</div><div class="opcion_editor" id="verano">LABEL_FILTER_SUMMER</div><div class="opcion_editor" id="cf">LABEL_FILTER_COLD_WEATHER</div><div class="opcion_editor" id="angeles">LABEL_FILTER_ANGELS</div><div class="opcion_editor" id="caliente">LABEL_FILTER_HOT</div><div class="opcion_editor" id="otono">LABEL_FILTER_FALL</div><div class="opcion_editor" id="marzo">LABEL_FILTER_MARCH</div><div class="opcion_editor" id="pera">LABEL_FILTER_PEAR</div><div class="opcion_editor" id="comun">LABEL_FILTER_COMMON</div><div class="opcion_editor" id="oro">LABEL_FILTER_GOLD</div><div class="opcion_editor" id="gotico">LABEL_FILTER_GOTHIC</div><div class="opcion_editor" id="forestal">LABEL_FILTER_FORESTRY</div><div class="opcion_editor" id="luna">LABEL_FILTER_MOON</div><div class="opcion_editor" id="fiesta">LABEL_FILTER_PARTY</div></div></div></div><div class="volver"><span class="icon-undo"></span>LABEL_START_OVER</div><div class="paso_1 paso animated bounceInDown delay-04 fast">1</div><div class="paso_2 a1 animated bounceInDown delay-06 fast">2</div><div class="paso_2 b1 animated bounceInDown delay-08 fast">3</div></div></div><div class="editor_imagenes"><div class="fondo_oscuro"></div><div class="editor_imagenes2"><div class="filtros animated fadeInLeft delay-04 fast"><div class="titulo_filtro"><span class="icon-eyedropper fa fa-eyedropper"></span>LABEL_FILTERS</div><div class="opciones_imagen"><div class="opcion_editor oa" id="normal">LABEL_FILTER_NORMAL</div><div class="opcion_editor" id="noche">LABEL_FILTER_NIGHT</div><div class="opcion_editor" id="sa">LABEL_FILTER_SAINT_ANA</div><div class="opcion_editor" id="crema">LABEL_FILTER_CREAM</div><div class="opcion_editor" id="magia">LABEL_FILTER_MAGIC</div><div class="opcion_editor" id="relieve">LABEL_FILTER_RELIEF</div><div class="opcion_editor" id="luz">LABEL_FILTER_LIGHT</div><div class="opcion_editor" id="saturacion">LABEL_FILTER_SATURATION</div><div class="opcion_editor" id="retoque">LABEL_FILTER_RETOUCH</div><div class="opcion_editor" id="orange">LABEL_FILTER_ORANGE</div><div class="opcion_editor" id="setenta">LABEL_FILTER_WIND</div><div class="opcion_editor" id="desierto">LABEL_FILTER_DESERT</div><div class="opcion_editor" id="bosque">LABEL_FILTER_FOREST</div><div class="opcion_editor" id="villa">LABEL_FILTER_TOWN</div><div class="opcion_editor" id="rosa">LABEL_FILTER_PINK</div><div class="opcion_editor" id="historia">LABEL_FILTER_HISTORY</div><div class="opcion_editor" id="gris">LABEL_FILTER_GRAY</div><div class="opcion_editor" id="lhs">LABEL_FILTER_OLD_PICTURE</div><div class="opcion_editor" id="encantador">LABEL_FILTER_CHARMING</div><div class="opcion_editor" id="emocion">LABEL_FILTER_EMOTION</div><div class="opcion_editor" id="beige">LABEL_FILTER_BEIGE</div><div class="opcion_editor" id="fine">LABEL_FILTER_FINE</div><div class="opcion_editor" id="lord">LABEL_FILTER_LORD</div><div class="opcion_editor" id="70">LABEL_FILTER_70S</div><div class="opcion_editor" id="arbol">LABEL_FILTER_TREE</div><div class="opcion_editor" id="verano">LABEL_FILTER_SUMMER</div><div class="opcion_editor" id="cf">LABEL_FILTER_COLD_WEATHER</div><div class="opcion_editor" id="angeles">LABEL_FILTER_ANGELS</div><div class="opcion_editor" id="caliente">LABEL_FILTER_HOT</div><div class="opcion_editor" id="otono">LABEL_FILTER_FALL</div><div class="opcion_editor" id="marzo">LABEL_FILTER_MARCH</div><div class="opcion_editor" id="pera">LABEL_FILTER_PEAR</div><div class="opcion_editor" id="comun">LABEL_FILTER_COMMON</div><div class="opcion_editor" id="oro">LABEL_FILTER_GOLD</div><div class="opcion_editor" id="gotico">LABEL_FILTER_GOTHIC</div><div class="opcion_editor" id="forestal">LABEL_FILTER_FORESTRY</div><div class="opcion_editor" id="luna">LABEL_FILTER_MOON</div><div class="opcion_editor" id="fiesta">LABEL_FILTER_PARTY</div></div></div><div class="canvas_imagen"><div class="canvas recortar"><div class="canvas_subir" id="imagen_noticia"><span class="icon-plus fa fa-plus"></span>LABEL_DRAG_IMAGE_HERE</div></div></div><div class="modificar animated fadeInRight delay-04 fast"><div><div class="titulo_recortar"><span class="icon-ungroup fa fa-scissors"></span>LABEL_CUT</div><div class="opcion_editor recortar10"><div>LABEL_CUT</div><div id="blockCelda"><span class="fa fa-lock"></span></div></div></div><div class="texto"><div class="titulo_texto"><span class="icon-plus fa fa-text-width"></span>LABEL_ADD_TEXT</div><input id="texto_input" type="text" name="texto" placeholder="LABEL_ADD_TEXT_HERE"><div class="fonts"><div class="font" id="negritas" data-tooltip="Negritas"><i class="fa fa-bold" aria-hidden="true"></i></div><div class="font" id="italic" data-tooltip="Letra Cursiva"><i class="fa fa-italic" aria-hidden="true"></i></div><input type="color" class="" data-tooltip="Color de la letra" name="" id="color" value="#ffffff"> <input type="number" class="" data-tooltip="Tamaño de la letra" name="" id="font-size" max="500" min="1" step="1" value="48"></div><div class="fonts"><div class="font fa" data-tooltip="Sombra de la letra" id="shadow">A</div><div class="font" id="rectangulo" data-tooltip="Fondo de la letra"><div class="rectangulo">C</div></div><input type="color" name="" id="colorrect" value="#000000" class="" data-tooltip="Color del fondo"> <input type="number" name="" id="opacidad" max="100" min="1" step="1" value="100" class="" data-tooltip="Transparensia del fondo"></div><div class="fonts_style"><div class="fs at" id="arial">LABEL_FONT_ARIAL</div><div class="fs" id="calibri">LABEL_FONT_CALIBRI</div><div class="fs" id="forte">LABEL_FONT_FORTE</div><div class="fs" id="impact">LABEL_FONT_IMPACT</div><div class="fs" id="jokerman">LABEL_FONT_JOKERMAN</div><div class="fs" id="mb">LABEL_FONT_MV_BOLI</div><div class="fs" id="tnr">LABEL_FONT_TIMES_NEW_ROMAN</div><div class="fs" id="verdana">LABEL_FONT_VERDANA</div><div class="fs" id="vivaldi">LABEL_FONT_VIVALDI</div></div></div></div></div><div class="botones_dimenciones"><div class="scale"><div class="dimenciones"><div id="ancho">1240px</div><div>x</div><div id="alto">720px</div></div><div class="porciento"><div id="menos_scale"><span class="icon-minus fa fa-minus"></span></div><div class="ps"><ul class="cantidades_scale"><li data-scale="2" class="as">200%</li><li data-scale="1" class="as">100%</li><li data-scale="0.75" class="as">75%</li><li data-scale="0.5" class="as">50%</li><li data-scale="0.25" class="as">25%</li></ul><div id="porciento_scale">50%</div></div><div id="mas_scale"><span class="icon-plus fa fa-plus"></span></div></div></div><div class="botones"><button class="boton_normal" id="ir_atras">LABEL_GO_BACK</button><button class="boton_normal" id="boton_recortar">LABEL_DATATABLE_SNEXT</button></div></div></div></div><dav class="fixed_noticia"></dav><dav class="cuadro_noticias animated bounceInUp delay-04" id="cuadro_noticias"><dav class="relative"><div class="titulo_topico">LABEL_TITLE_TOPIC</div><canvas class="imagen_noticias" id="imagen_noticias" width="320" height="480"></canvas></dav><div class="progreso d-flex align-items-center justify-content-between"><progress value="0" max="100"></progress><span class="ml-2">0.0%</span></div></dav>'
6113 nelberth 1688
 
1689
		$(document).on("click", ".info_noticia", function(e){
1690
			imagenServidorNoticia = elemento.toDataURL("image/jpeg", 1.0);
1691
			console.log(imagenServidorNoticia.split(','))
6523 nelberth 1692
			$('.background').val(imagenServidorNoticia.split(',')[1]);
1693
            $('.imageType .file').val(imagenServidorNoticia.split(',')[1]);
6113 nelberth 1694
			console.log($('.file').val())
1695
			$(".c1").addClass("paso");
1696
 
1697
 
1698
		})
6582 nelberth 1699
 
6556 nelberth 1700
		function iniciarEditor(campo, image=''){
6113 nelberth 1701
		 cortar=false;
1702
		recorte_listo=false;
1703
		texto="";
1704
		seis=true;
1705
		color="#ffffff";
1706
		texto_listo=false,siete=false;
1707
		uno=true;
1708
		size=48;
1709
		cinco=true;
1710
		xf=320,yf =480;
1711
		negritas=false, bold="";
1712
		shadow = true, nueve=true;
1713
		italic=false, ita="";
1714
		rectangulo=false, diez=false;
1715
     	fontfamily="Arial";
1716
     	r=0,g=0,b=0,a=1;
1717
		window.clearInterval(editorNoticia);
1718
		setTimeout(function(){
1719
			scroll_altura=$(".articulo_noticia").offset().top-110;
1720
			anchoFondoOscuro = $(".articulo_noticia").width();
1721
			altoFondoOscuro = $(".editor_imagenes").height();
1722
			$(".fondo_oscuro").css("width",""+anchoFondoOscuro+"px");
1723
			$(".fondo_oscuro").css("height",""+altoFondoOscuro+"px");
1724
 
6556 nelberth 1725
		},navegacion(nuevoHtmlImagen,campo,image));
6113 nelberth 1726
 
1727
		}
1728
 
1729
		$(document).on("click", ".volver", function(){
1730
		var nombre_user = $(".perfil_u_nombre").text();
1731
		var primer_nombre = nombre_user.split(" ")[0];
1732
		 cortar=false;
1733
		cinco=true;
1734
		recorte_listo=false;
1735
		texto="";
1736
		seis=true;
1737
		color="#ffffff";
1738
		texto_listo=false,siete=false;
1739
		uno=true;
1740
		size=48;
1741
		xf=320,yf =480;
1742
		negritas=false, bold="";
1743
		shadow = true, nueve=true;
1744
		italic=false, ita="";
1745
		rectangulo=false, diez=false;
1746
     	fontfamily="Arial";
1747
     	r=0,g=0,b=0,a=1;
1748
		 var imagenServidorNoticia;
6585 nelberth 1749
         console.log(seleccionarCampo)
6113 nelberth 1750
		window.clearInterval(editorNoticia);
1751
		setTimeout(function(){
1752
			scroll_altura=$(".articulo_noticia").offset().top-110;
1753
			anchoFondoOscuro = $(".articulo_noticia").width();
1754
			altoFondoOscuro = $(".editor_imagenes").height();
1755
			$(".fondo_oscuro").css("width",""+anchoFondoOscuro+"px");
1756
			$(".fondo_oscuro").css("height",""+altoFondoOscuro+"px");
1757
 
6584 nelberth 1758
		},navegacion(nuevoHtmlImagen,seleccionarCampo));
6113 nelberth 1759
 
1760
		})
1761
 
6574 nelberth 1762
		function navegacion(nuevoHtmlImagen,campo,image='',reload=true){
6581 nelberth 1763
                selectorElementoName=campo.find('#name')
6577 nelberth 1764
 
1765
                selectorElementoEditor=campo.find('#contenido');
6113 nelberth 1766
 
6574 nelberth 1767
				if(image!=''){
6113 nelberth 1768
					const getBase64FromUrl = async (url) => {
1769
						const data = await fetch(url);
1770
						const blob = await data.blob();
1771
						return new Promise((resolve) => {
1772
							const reader = new FileReader();
1773
							reader.readAsDataURL(blob);
1774
							reader.onloadend = function() {
1775
							const base64data = reader.result;
1776
							resolve(base64data);
1777
							}
1778
						});
1779
					}
1780
 
1781
					getBase64FromUrl(image).then(function(e){
6581 nelberth 1782
						selectorElementoName.trigger('change');
6113 nelberth 1783
						$(".volver").css("display","block")
1784
						$(".a1").addClass("paso");
1785
						$(".titulo_pasos").html("LABEL_STEP_2");
1786
						setTimeout(function(){
1787
							recorte_listo=true;
1788
							$(".fondo_oscuro").css("display","none");
1789
							$("#boton_recortar").removeClass("recortar").text("LABEL_SEND").addClass("info_noticia").attr('type','submit');
1790
							$(".recortar10").removeClass("recortar");
1791
							$(".canvas").removeClass("recortar");
1792
							$(".b1").addClass("paso");
1793
							$(".titulo_pasos").html("LABEL_STEP_3");
1794
							if(texto!=""){
1795
								seis=true;
1796
								siete=true;
1797
							}
1798
							cinco=true;
1799
							dos=true;
1800
							cuatro=true;
1801
							actualizar();
1802
 
1803
						},editorNoticia(e));
1804
 
1805
 
1806
					})
1807
 
1808
					setTimeout(function(){
1809
						$(".canvas_subir").html('<span class="icon-plus fa fa-spinner"></span> Cargando...')
6581 nelberth 1810
						selectorElementoName.trigger('change');
6577 nelberth 1811
					},selectorElementoEditor.html(nuevoHtmlImagen));
6113 nelberth 1812
				}else{
1813
					setTimeout(function(){
6581 nelberth 1814
					    selectorElementoName.trigger('change');
6577 nelberth 1815
					},selectorElementoEditor.html(nuevoHtmlImagen));
6113 nelberth 1816
				}
6574 nelberth 1817
 
6113 nelberth 1818
		}
1819
 
1820
		$(window).on("scroll", function(){
1821
			console.log(scroll_altura)
1822
		if($(window).scrollTop()>scroll_altura){
1823
			$("#cuadro_noticias").addClass("fixed");
1824
		}else{
1825
			$("#cuadro_noticias").removeClass("fixed");
1826
		}
1827
	})
1828
 
1829
	$(document).on("dragover", "#imagen_noticia", function(e){
1830
		e.preventDefault();
1831
		e.stopPropagation();
1832
		$(this).css({"background":"rgba(0,0,0,.2)"})
1833
	})
1834
	$(document).on("drop", "#imagen_noticia", function(e){
1835
		e.preventDefault();
1836
		e.stopPropagation();
1837
		$(this).css("background", "none");
1838
		var archivo = e.originalEvent.dataTransfer.files;
1839
		var img=archivo[0];
1840
		if(img.type =="image/jpeg"||img.type =="image/png"){
1841
			$(".modificar").removeClass("animated");
1842
			var render = new FileReader();
1843
			render.readAsDataURL(img);
1844
			render.onload = function(e){
1845
				$(".volver").css("display","block")
1846
				$(".a1").addClass("paso");
1847
				$(".titulo_pasos").html("LABEL_STEP_2");
1848
				console.log(e.target.result)
1849
				editorNoticia(e.target.result)
1850
			}
1851
		}
1852
	})
1853
	$(document).on("dragover", "body", function(e){
1854
		e.preventDefault();
1855
		e.stopPropagation();
1856
	})
1857
	$(document).on("drop", "body", function(e){
1858
		e.preventDefault();
1859
		e.stopPropagation();
1860
	})
1861
 
1862
	var canvas='<div class="editorNoticia"><canvas id="editorNoticia">LABEL_NOT_SUPPORTED</canvas></div>';
1863
	$(document).on("mouseover", ".editorNoticia", function(){
1864
		$("body").css({"overflow": "hidden"});
1865
		$(".cuadro_noticias, .fixed_noticia,.tituloEditor,.grid-padre").css("margin-right", "17px")
1866
		$(".barra,.footer").css("padding-right","17px")
1867
 
1868
 
1869
	})
1870
	$(document).on("mouseover", "#editorNoticia", function(){
1871
		if(recorte_listo){
1872
			ocho=true;
1873
		}
1874
	})
1875
	$(document).on("mouseout", "#editorNoticia", function(){
1876
		if(recorte_listo){
1877
			ocho=false;
1878
			actualizar2()
1879
		}
1880
	})
1881
	$(document).on("mouseout", ".editorNoticia",function(){
1882
		$("body").css({"overflow": "auto"})
1883
		$(".cuadro_noticias, .fixed_noticia,.tituloEditor,.grid-padre").css("margin-right", "0px")
1884
		$(".barra,.footer").css("padding-right","0px")
1885
 
1886
	})
1887
	$(document).on('mousewheel', ".editorNoticia",function(e){
1888
		var ruedita = e.originalEvent.wheelDelta
1889
		if(ruedita>0){
1890
			scale = scale+(scale/10);
1891
			$("#porciento_scale").html((scale*100).toFixed(2)+"%")
1892
		}else{
1893
			scale = scale-(scale/10);
1894
			$("#porciento_scale").html((scale*100).toFixed(2)+"%")
1895
		}
1896
		$("#editorNoticia").css({"transform": "scale("+scale+")"});
1897
	})
1898
	$(document).on("click", ".as", function(e){
1899
		e.preventDefault();
1900
		 scale = $(this).data("scale");
1901
		 $("#porciento_scale").html((scale*100).toFixed(2)+"%")
1902
		 $("#editorNoticia").css({"transform": "scale("+scale+")"});
1903
 
1904
	})
1905
	$(document).on("click", ".ps", function(e){
1906
		e.preventDefault();
1907
		$(".cantidades_scale").slideToggle(200).css("display", "block");
1908
	})
1909
	$(document).on("click", "#cerrar_filter_modal, .icon_filter", function(e){
1910
		e.preventDefault();
1911
		if(recorte_listo){
1912
		$(".contenido_filter").slideToggle(200).css("display", "block");
1913
		}
1914
	})
1915
	$(document).on("click", "#cerrar_text_modal, .icon_text", function(e){
1916
		e.preventDefault();
1917
		if(recorte_listo){
1918
			$(".contenido_text").slideToggle(200).css("display", "block");
1919
		}
1920
	})
1921
 
1922
	$(document).on("click", "#cerrar_cut_modal, .icon_cut", function(e){
1923
		e.preventDefault();
1924
		if(cortar){
1925
			$(".contenido_cut").slideToggle(200).css("display", "block");
1926
		}
1927
 
1928
	})
1929
	$(document).on("click", "#menos_scale", function(e){
1930
		e.preventDefault();
1931
		scale = scale-(scale/10);
1932
		 $("#porciento_scale").html((scale*100).toFixed(2)+"%")
1933
		 $("#editorNoticia").css({"transform": "scale("+scale+")"});
1934
	})
1935
 
1936
	$(document).on("click", "#mas_scale", function(e){
1937
		e.preventDefault();
1938
		scale = scale+(scale/10);
1939
		 $("#porciento_scale").html((scale*100).toFixed(2)+"%")
1940
		 $("#editorNoticia").css({"transform": "scale("+scale+")"});
1941
	})
1942
	$(document).on("click", "#noche", function(){
1943
		$(".oa").removeClass("oa")
1944
		filter( .5,1.3,1.31,1.33,1.38);
1945
		$(this).addClass("oa")
1946
	})
1947
	$(document).on("click", "#sa", function(){
1948
		$(".oa").removeClass("oa")
1949
		filter( .7,1.1,1.64,1.66,1.50);
1950
		$(this).addClass("oa")
1951
	})
1952
	$(document).on("click", "#crema", function(){
1953
		$(".oa").removeClass("oa")
1954
		filter( .75,1,1.66,1.60,1.51);
1955
		$(this).addClass("oa")
1956
	})
1957
	$(document).on("click", "#setenta", function(){
1958
		$(".oa").removeClass("oa")
1959
		filter( .8,.75,1.60,1.66,1.58);
1960
		$(this).addClass("oa")
1961
	})
1962
	$(document).on("click", "#orange", function(){
1963
		$(".oa").removeClass("oa")
1964
		filter( .8,1,1.6,1.45,1.49);
1965
		$(this).addClass("oa")
1966
	})
1967
	$(document).on("click", "#relieve", function(){
1968
		$(".oa").removeClass("oa")
1969
		filter( .7,1.2,1.60,1.66,1.58);
1970
		$(this).addClass("oa")
1971
	})
1972
	$(document).on("click", "#bosque", function(){
1973
		$(".oa").removeClass("oa")
1974
		filter( .85,.75,1.47,1.66,1.54);
1975
		$(this).addClass("oa")
1976
	})
1977
	$(document).on("click", "#desierto", function(){
1978
		$(".oa").removeClass("oa")
1979
		filter( .8,.9,1.66,1.43,1.28);
1980
		$(this).addClass("oa")
1981
	})
1982
	$(document).on("click", "#villa", function(){
1983
		$(".oa").removeClass("oa")
1984
		filter( .8,.8,1.71,1.64,1.58);
1985
		$(this).addClass("oa")
1986
	})
1987
	$(document).on("click", "#magia", function(){
1988
		$(".oa").removeClass("oa")
1989
		filter( .7,1.2,1.49,1.49,1.6);
1990
		$(this).addClass("oa")
1991
	})
1992
	$(document).on("click", "#luz", function(){
1993
		$(".oa").removeClass("oa")
1994
		filter( .9,.9,1.45,1.54,1.54);
1995
		$(this).addClass("oa")
1996
	})
1997
	$(document).on("click", "#retoque", function(){
1998
		$(".oa").removeClass("oa")
1999
		filter( .9,1.3,1,1,1);
2000
		$(this).addClass("oa")
2001
	})
2002
	$(document).on("click", "#saturacion", function(){
2003
		$(".oa").removeClass("oa")
2004
		filter( 1,1.5,1,1,1);
2005
		$(this).addClass("oa")
2006
	})
2007
	$(document).on("click", "#rosa", function(){
2008
		$(".oa").removeClass("oa")
2009
		filter( .8,1.2,1.24,.99,1);
2010
		$(this).addClass("oa")
2011
	})
2012
	$(document).on("click", "#historia", function(){
2013
		$(".oa").removeClass("oa")
2014
		filter( .9,1.1,1.33,1.19,.91);
2015
		$(this).addClass("oa")
2016
	})
2017
	$(document).on("click", "#encantador", function(){
2018
		$(".oa").removeClass("oa")
2019
		filter( .9,1.2,26,-12,0,2);
2020
		$(this).addClass("oa")
2021
	})
2022
	$(document).on("click", "#emocion", function(){
2023
		$(".oa").removeClass("oa")
2024
		filter( 1.1,1.4,40,12,-6,2);
2025
		$(this).addClass("oa")
2026
	})
2027
	$(document).on("click", "#beige", function(){
2028
		$(".oa").removeClass("oa")
2029
		filter( .9,1.32,56,47,17,2);
2030
		$(this).addClass("oa")
2031
	})
2032
	$(document).on("click", "#fine", function(){
2033
		$(".oa").removeClass("oa")
2034
		filter( .87,1.19,55,37,23,2);
2035
		$(this).addClass("oa")
2036
	})
2037
	$(document).on("click", "#lord", function(){
2038
		$(".oa").removeClass("oa")
2039
		filter( 1.2,.9,67,13,-23,2);
2040
		$(this).addClass("oa")
2041
	})
2042
	$(document).on("click", "#70", function(){
2043
		$(".oa").removeClass("oa")
2044
		filter( 1.2,1.2,35,7,18,2);
2045
		$(this).addClass("oa")
2046
	})
2047
	$(document).on("click", "#arbol", function(){
2048
		$(".oa").removeClass("oa")
2049
		filter(.92,1.23,-11,11,11,2);
2050
		$(this).addClass("oa")
2051
	})
2052
	$(document).on("click", "#verano", function(){
2053
		$(".oa").removeClass("oa")
2054
		filter( 1,1.4,-3,-1,-12,2);
2055
		$(this).addClass("oa")
2056
	})
2057
	$(document).on("click", "#cf", function(){
2058
		$(".oa").removeClass("oa")
2059
		filter( .85,1.26,-15,2,-1,2);
2060
		$(this).addClass("oa")
2061
	})
2062
	$(document).on("click", "#angeles", function(){
2063
		$(".oa").removeClass("oa")
2064
		filter( 1,1.4,5,12,1,2);
2065
		$(this).addClass("oa")
2066
	})
2067
	$(document).on("click", "#caliente", function(){
2068
		$(".oa").removeClass("oa")
2069
		filter( .9,1.2,43,-17,-55,2);
2070
		$(this).addClass("oa")
2071
	})
2072
	$(document).on("click", "#otono", function(){
2073
		$(".oa").removeClass("oa")
2074
		filter( 1,1.29,29,26,17,2);
2075
		$(this).addClass("oa")
2076
	})
2077
	$(document).on("click", "#marzo", function(){
2078
		$(".oa").removeClass("oa")
2079
		filter( .85,1.3,43,25,-11,2);
2080
		$(this).addClass("oa")
2081
	})
2082
	$(document).on("click", "#pera", function(){
2083
		$(".oa").removeClass("oa")
2084
		filter( .8,1.25,31,41,12,2);
2085
		$(this).addClass("oa")
2086
	})
2087
	$(document).on("click", "#comun", function(){
2088
		$(".oa").removeClass("oa")
2089
		filter( 1,1.36,4,5,1,2);
2090
		$(this).addClass("oa")
2091
	})
2092
	$(document).on("click", "#oro", function(){
2093
		$(".oa").removeClass("oa")
2094
		filter( .9,1.3,37,-25,1,2);
2095
		$(this).addClass("oa")
2096
	})
2097
	$(document).on("click", "#gotico", function(){
2098
		$(".oa").removeClass("oa")
2099
		filter( 1.1,1.3,-47,-42,-30,2);
2100
		$(this).addClass("oa")
2101
	})
2102
	$(document).on("click", "#forestal", function(){
2103
		$(".oa").removeClass("oa")
2104
		filter( 1,1.4,-5,42,11,2);
2105
		$(this).addClass("oa")
2106
	})
2107
	$(document).on("click", "#luna", function(){
2108
		$(".oa").removeClass("oa")
2109
		filter( .9,1.2,-5,-7,4,2);
2110
		$(this).addClass("oa")
2111
	})
2112
	$(document).on("click", "#fiesta", function(){
2113
		$(".oa").removeClass("oa")
2114
		filter( 1.1,1.3,-1,-1,26,2);
2115
		$(this).addClass("oa")
2116
	})
2117
	$(document).on("click", "#gris", function(){
2118
		$(".oa").removeClass("oa")
2119
		filtergris(1,1)
2120
		$(this).addClass("oa")
2121
	})
2122
	$(document).on("click", "#lhs", function(){
2123
		$(".oa").removeClass("oa")
2124
		filtergris(.8,1.5);
2125
		$(this).addClass("oa")
2126
	})
2127
	$(document).on("click", "#normal", function(){
2128
		$(".oa").removeClass("oa")
2129
		$(this).addClass("oa")
2130
		filter();
2131
	})
2132
	var texto_listo=false,siete=false;
2133
	var texto;
2134
	$(document).on("keyup", "#texto_input", function(e){
2135
		e.preventDefault();
2136
		texto = $(this).val();
2137
		if(texto_actualizar){
2138
			siete=true;
2139
		}
2140
		if(texto!=""){
2141
			texto_actualizar=true;
2142
			actualizar2();
2143
		}else{
2144
			actualizar2();
2145
		}
2146
 
2147
	})
2148
	var color="#ffffff";
2149
	$(document).on("change", "#color", function(){
2150
    	color=$(this).val();
2151
    	seis=true;
2152
    	actualizar2();
2153
    })
2154
    var size=48;
2155
    $(document).on("keyup change", "#font-size", function(){
2156
    	size=$(this).val();
2157
    	size = parseInt(size);
2158
    	seis=true;
2159
    	siete=true;
2160
    	actualizar2();
2161
    })
2162
    var negritas=false, bold="";
2163
    $(document).on("click", "#negritas", function(e){
2164
    	e.preventDefault();
2165
    	if(!negritas){
2166
    		bold="bold";
2167
    		$(this).addClass("fa");
2168
    		seis=true;
2169
    		siete=true;
2170
    		actualizar2();
2171
    		negritas=true;
2172
    	}else{
2173
    		bold="";
2174
    		$(this).removeClass("fa");
2175
    		seis=true;
2176
    		siete=true;
2177
    		actualizar2();
2178
    		negritas=false;
2179
    	}
2180
    })
2181
    var italic=false, ita="";
2182
     $(document).on("click", "#italic", function(e){
2183
    	e.preventDefault();
2184
    	if(!italic){
2185
    		ita="italic";
2186
    		$(this).addClass("fa");
2187
    		seis=true;
2188
    		siete=true;
2189
    		actualizar2();
2190
    		italic=true;
2191
    	}else{
2192
    		ita="";
2193
    		$(this).removeClass("fa");
2194
    		seis=true;
2195
    		siete=true;
2196
    		actualizar2();
2197
    		italic=false;
2198
    	}
2199
    })
2200
     var fontfamily="Arial";
2201
     $(document).on("click", ".fs", function(e){
2202
    	e.preventDefault();
2203
    	$(".at").removeClass("at");
2204
    	$(this).addClass("at");
2205
    	fontfamily= $(this).text();
2206
    	seis=true;
2207
    	siete=true;
2208
    	actualizar2();
2209
 
2210
    })
2211
     var shadow = true, nueve=true;
2212
     $(document).on("click","#shadow", function(e){
2213
     	e.preventDefault();
2214
     	if(shadow){
2215
     		$(this).removeClass("fa");
2216
     		seis=true;
2217
     		nueve=false;
2218
     		actualizar2();
2219
     		shadow=false;
2220
     	}else{
2221
     		$(this).addClass("fa");
2222
     		seis=true;
2223
     		nueve=true;
2224
     		actualizar2();
2225
     		shadow=true;
2226
     	}
2227
 
2228
     })
2229
     var rectangulo=false, diez=false, colorrect="#000000";
2230
     $(document).on("click", "#rectangulo", function(e){
2231
     	e.preventDefault();
2232
     	if(!rectangulo){
2233
     		$(this).addClass("fa");
2234
     		diez=true;
2235
     		actualizar2();
2236
     		rectangulo=true;
2237
     	}else{
2238
     		$(this).removeClass("fa");
2239
     		diez=false;
2240
     		actualizar2();
2241
     		rectangulo=false;
2242
     	}
2243
 
2244
     })
2245
     var r=0,g=0,b=0;
2246
    $(document).on("change", "#colorrect", function(){
2247
    	colorrect=$(this).val();
2248
    	r=parseInt(colorrect.slice(1,3),16);
2249
    	g=parseInt(colorrect.slice(3,5),16);
2250
    	b=parseInt(colorrect.slice(5,7),16);
2251
    	seis=true;
2252
    	actualizar2();
2253
    })
2254
    var a=1;
2255
 
2256
    $(document).on("keyup change", "#opacidad", function(){
2257
    	a=$(this).val();
2258
    	a=a/100;
2259
    	seis=true;
2260
    	actualizar2();
2261
    })
2262
	var imaNoti = new Image();
2263
	function filter(brillo=1, contraste=1, rojo=1, verde=1, azul=1, valor=1){
2264
		cuatro=false;
2265
		restaurar(brillo, contraste);
2266
		datos=imagenOriginal.data;
2267
		if(valor==2){
2268
			for (var i =  0; i <datos.length; i+=4) {
2269
				datos[i]=datos[i]+rojo;
2270
				datos[i+1]=datos[i+1]+verde;
2271
				datos[i+2]=datos[i+2]+azul;
2272
			}
2273
		}else{
2274
			for (var i =  0; i <datos.length; i+=4) {
2275
				datos[i]=datos[i]*rojo;
2276
				datos[i+1]=datos[i+1]*verde;
2277
				datos[i+2]=datos[i+2]*azul
2278
			}
2279
		}
2280
		editor.putImageData(imagenOriginal,0,0)
2281
		var imagenNoticia = elemento.toDataURL("image/jpeg", 1.0);
2282
	    imaNoti.src = imagenNoticia;
2283
		actualizar2();
2284
	}
2285
	function filtergris(brillo=1, contraste=1){
2286
		cuatro=false;
2287
		restaurar(brillo, contraste);
2288
		datos=imagenOriginal.data;
2289
		var auxiliar;
2290
		for (var i =  0; i <datos.length; i+=4) {
2291
			auxiliar = 0.34 * datos[i] + 0.5 *datos[i+1] + 0.16 * datos[i+2];
2292
			datos[i]=auxiliar;
2293
			datos[i+1]=auxiliar;
2294
			datos[i+2]=auxiliar;
2295
		}
2296
 
2297
		editor.putImageData(imagenOriginal,0,0)
2298
		var imagenNoticia = elemento.toDataURL("image/jpeg", 1.0);
2299
	    imaNoti.src = imagenNoticia;
2300
		actualizar2();
2301
	}
2302
	function restaurar(brillo = 1, contraste=1){
2303
		editor.filter = "none"
2304
		editor.filter = 'contrast('+contraste+') brightness('+brillo+') saturate(1) sepia(0)';
2305
		editor.fillStyle="rgba(255,255,255,1)"
2306
		editor.fillRect(0,0,ancho,alto);
2307
		editor.fillStyle=""+color+"";
2308
		var pxf=0,pyf=0;
2309
			if(xf>=(yf/recorte)){
2310
				pxf=xf/ancho;
2311
				pyf=yf/pxf;
2312
				py=(alto/2)-(pyf/2);
2313
				editor.drawImage(imagen,x,y,xf,yf,0,py,ancho,pyf);
2314
			}else{
2315
				pyf=yf/alto;
2316
				pxf=xf/pyf;
2317
				px=(ancho/2)-(pxf/2);
2318
				editor.drawImage(imagen,x,y,xf,yf,px,0,pxf,alto);
2319
			}
2320
		imagenOriginal = editor.getImageData(0,0,ancho,alto)
2321
	}
2322
	var ocho=false;
2323
	function actualizar2(){
2324
		if(recorte_listo){
2325
		if(cuatro){
2326
			imagenOriginal = editor.getImageData(0,0,ancho,alto)
2327
			var imagenNoticia = elemento.toDataURL("image/jpeg", 1.0);
2328
	    	imaNoti.src = imagenNoticia;
2329
	    	cuatro=false;
2330
		}
2331
		editor.filter = "none"
2332
		$(imaNoti).ready(function(e){
2333
			noticia.drawImage(imaNoti,0,0,320,480);
2334
			editor.drawImage(imaNoti,0,0,ancho,alto)
2335
			if(texto_actualizar){
2336
				if(texto!=""){
2337
					if(seis){
2338
						ancho_imaNoti = imaNoti.width;
2339
 
2340
						scale_noticia = -(((ancho_imaNoti-320)/ancho_imaNoti)-1);
2341
						editor.fillStyle=""+color+"";
2342
						editor.strokeStyle="rgb(255,255,255)";
2343
						if(nueve){
2344
							editor.shadowColor="rgba(0,0,0,.5)";
2345
							editor.shadowOffsetX=6;
2346
							editor.shadowOffsetY=6;
2347
							editor.shadowBlur=6;
2348
							noticia.shadowColor="rgba(0,0,0,.5)";
2349
							noticia.shadowOffsetX=6*scale_noticia;
2350
							noticia.shadowOffsetY=6*scale_noticia;
2351
							noticia.shadowBlur=6*scale_noticia;
2352
						}else{
2353
							editor.shadowColor="rgba(0,0,0,0)";
2354
							noticia.shadowColor="rgba(0,0,0,0)";
2355
						}
2356
						editor.font=""+ita+" "+bold+" "+size+"px "+fontfamily+"";
2357
						editor.textAlign="start";
2358
						editor.textBaseline="top";
2359
 
2360
						var sizeNoticia = size*scale_noticia;
2361
						noticia.fillStyle=""+color+"";
2362
						noticia.font=""+ita+" "+bold+" "+sizeNoticia+"px "+fontfamily+"";
2363
						noticia.textAlign="start";
2364
						noticia.textBaseline="top";
2365
						seis=false;
2366
					}
2367
					if(siete){
2368
						dimencionesTexto = editor.measureText(texto);
2369
						txf=dimencionesTexto.width+20;
2370
						tyf= (20+size);
2371
						siete=false;
2372
					}
2373
					if(cinco){
2374
						dimencionesTexto = editor.measureText(texto);
2375
						if(xf>=(yf/recorte)){
2376
							tx=(xf/2)-(dimencionesTexto.width/2);
2377
							ty=(xf*recorte/2)-(size/2);
2378
						}else{
2379
							tx=(yf/recorte/2)-(dimencionesTexto.width/2);
2380
							ty=(yf/2)-(size/2);
2381
						}
2382
 
2383
						txf=dimencionesTexto.width+20;
2384
						tyf= size+20;
2385
						cinco=false;
2386
					}
2387
					if(diez){
2388
						editor.fillStyle="rgba("+r+","+g+","+b+","+a+")";
2389
						noticia.fillStyle="rgba("+r+","+g+","+b+","+a+")";
2390
						editor.fillRect(tx-10,ty-10,txf,tyf);
2391
						noticia.fillRect(((tx-10)*scale_noticia),((ty-10)*scale_noticia),txf*scale_noticia,tyf*scale_noticia);
2392
						editor.fillStyle=""+color+"";
2393
						noticia.fillStyle=""+color+"";
2394
 
2395
					}
2396
					editor.fillText(texto,tx,ty);
2397
					noticia.fillText(texto,(tx*scale_noticia),ty*scale_noticia);
2398
					if(ocho){
2399
						editor.strokeRect(tx-10,ty-10,txf,tyf)
2400
						editor.arc(tx+txf,ty+tyf,10,0,Math.PI*2,false);
2401
						editor.fill();
2402
						editor.beginPath();
2403
					}
2404
					texto_listo=true;
2405
				}
2406
			}
2407
		})
2408
 
2409
	}
2410
	}
2411
	function actualizar(){
2412
			$(imagen).ready(function(e){
2413
				if(uno){
2414
					ancho=imagen.width, alto = imagen.height;
2415
					elemento.width = ancho;
2416
					elemento.height = alto;
2417
					$(".scale").css("display","flex");
2418
					mitadX=ancho/2;
2419
					mitadY=alto/2;
2420
					x=mitadX-xf/2;
2421
					y=mitadY-yf/2;
2422
					if(ancho<=alto){
2423
					 scale = -(((alto-450)/alto)-1);
2424
 
2425
					}else{
2426
					 scale = -(((ancho-500)/ancho)-1);
2427
					}
2428
					$("#porciento_scale").html((scale*100).toFixed(2)+"%")
2429
					$("#ancho").html(ancho+"px");
2430
					$("#alto").html(alto+"px");
2431
					uno=false;
2432
				}
2433
				if(dos){
2434
 
2435
					if(xf>=(yf/recorte)){
2436
						alto=xf*recorte;
2437
						ancho=xf;
2438
					}else{
2439
						ancho=yf/recorte;
2440
						alto=yf;
2441
 
2442
					}
2443
					elemento.width = ancho;
2444
					elemento.height = alto;
2445
					if(xf<=yf){
2446
					 scale = -(((yf-450)/yf)-1);
2447
 
2448
					}else{
2449
					 scale = -(((xf-500)/xf)-1);
2450
					}
2451
 
2452
					$("#porciento_scale").html((scale*100).toFixed(2)+"%")
2453
					$("#ancho").html(Math.round(xf)+"px");
2454
					$("#alto").html(Math.round(yf)+"px");
2455
					dos=false;
2456
				}
2457
 
2458
					var pxf=0,pyf=0;
2459
					noticia.fillStyle="rgba(255,255,255,1)"
2460
					noticia.fillRect(0,0,320,480);
2461
				if(xf>=(yf/recorte)){
2462
					pxf=xf/320;
2463
					pyf=yf/pxf;
2464
					py=(480/2)-(pyf/2);
2465
					noticia.drawImage(imagen,x,y,xf,yf,0,py,320,pyf);
2466
				}else{
2467
					pyf=yf/480;
2468
					pxf=xf/pyf;
2469
					px=(320/2)-(pxf/2);
2470
					noticia.drawImage(imagen,x,y,xf,yf,px,0,pxf,480);
2471
				}
2472
 
2473
				$("#editorNoticia").css({"transform": "scale("+scale+")"});
2474
				if(!recorte_listo){
2475
					editor.drawImage(imagen,0,0,ancho,alto);
2476
					editor.fillStyle="rgba(0,0,0,.2)"
2477
					editor.fillRect(0,0,ancho,alto);
2478
					editor.fillStyle="rgba(255,255,255,.1)"
2479
					editor.fillRect(x,y,xf,yf);
2480
					editor.fillStyle="rgba(255,255,255,.5)"
2481
					editor.fillRect(x,y,16,16);
2482
					editor.fillRect((x+xf)-16,y,16,16);
2483
					editor.fillRect(x,y+yf-16,16,16);
2484
					editor.fillRect(x+xf-16,yf+y-16,16,16);
2485
					esta=true;
2486
				}else{
2487
					var pxf=0,pyf=0;
2488
 
2489
					editor.fillStyle="rgba(255,255,255,1)"
2490
					editor.fillRect(0,0,ancho,alto);
2491
					if(xf>=(yf/recorte)){
2492
						pxf=xf/ancho;
2493
						pyf=yf/pxf;
2494
						py=(alto/2)-(pyf/2);
2495
						editor.drawImage(imagen,x,y,xf,yf,0,py,ancho,pyf);
2496
					}else{
2497
						pyf=yf/alto;
2498
						pxf=xf/pyf;
2499
						px=(ancho/2)-(pxf/2);
2500
						editor.drawImage(imagen,x,y,xf,yf,px,0,pxf,alto);
2501
				}
2502
 
2503
				}
2504
			})
2505
		}
2506
	var imagenOriginal;
2507
	var x,y,xf=320,yf =480, elemento,editor,centro, total,scale,dimencionesTexto,ancho_imaNoti,
2508
	recorte_listo=false,alto,ancho,tx,ty,txf,tyf,cuatro=true,texto_actualizar=false,cinco=true,seis=true,cuatro;
2509
	var  mitadY,mitadX, uno=true,dos=false, recorte=480/320, imagen_noticias, scale_noticia, tres=true,rotar=false, cortar=false;;
2510
	var translateX;
2511
 
2512
	$(document).on("click", ".recortar10", function(e){
2513
 
2514
		e.preventDefault();
2515
		recorte_listo=false;
2516
		uno=true;
2517
		$(".fondo_oscuro").css("display","block");
2518
		$("#boton_recortar").addClass("recortar").text("Recortar").removeClass("info_noticia");
2519
		$("#boton_recortar3").addClass("recortar").text("Recortar").removeClass("info_noticia3");
2520
		$(".contenido_text").css("display", "none");
2521
		$(".contenido_filter").css("display", "none");
2522
		$(".recortar10").addClass("recortar");
2523
		$(".canvas").addClass("recortar")
2524
		$(".oa").removeClass("oa");
2525
		$("#normal").addClass("oa");
2526
		$(".b1").removeClass("paso");
2527
		$(".titulo_pasos").html("LABEL_STEP_2");
2528
		window.clearInterval(actualizar2);
2529
		actualizar();
2530
 
2531
	})
2532
 
2533
 
2534
	blockCelda=true;
2535
	$(document).on("click", "#blockCelda", function(e){
2536
		e.preventDefault();
2537
		if(blockCelda){
2538
			$(this).html('<span class="fa fa-unlock"></span>')
2539
 
2540
			blockCelda=false;
2541
		}else{
2542
			$(this).html('<span class="fa fa-lock"></span>')
2543
			blockCelda=true;
2544
		}
2545
		t4=true;
2546
 
2547
	})
2548
	var imagen
2549
	function editorNoticia(img){
2550
		 cortar=true;
2551
		imagen= new Image();
2552
		$(".canvas").html(canvas);
2553
		elemento = document.getElementById("editorNoticia");
2554
		editor = elemento.getContext("2d");
2555
		elemento2 = document.getElementById("imagen_noticias");
2556
		noticia = elemento2.getContext("2d");
2557
 
2558
		$(document).on("click", ".boton_marino.recortar",function(e){
2559
			e.preventDefault();
2560
			recorte_listo=true;
2561
			$(".fondo_oscuro").css("display","none");
2562
			$("#boton_recortar").removeClass("recortar").text("LABEL_SEND").addClass("info_noticia").attr('type','submit');
2563
			$(".recortar10").removeClass("recortar");
2564
			$(".canvas").removeClass("recortar");
2565
			$(".b1").addClass("paso");
2566
			$(".titulo_pasos").html("LABEL_STEP_3");
2567
			if(texto!=""){
2568
				seis=true;
2569
				siete=true;
2570
			}
2571
			cinco=true;
2572
			dos=true;
2573
			cuatro=true;
2574
			actualizar();
2575
		})
2576
 
2577
		var cli = false, t1= false, t2=false,t3=false,t4=false,tcli=false;
2578
		var mouse =[];
2579
 
2580
 
2581
		function raton(elemento, e){
2582
			return {
2583
				x:((e.pageX - elemento.offsetLeft - ((ancho/2)-((ancho*scale)/2)))/scale),
2584
				y:((e.pageY - elemento.offsetTop - ((alto/2)-((alto*scale)/2)))/scale)
2585
			}
2586
		}
2587
 
2588
		imagen.src=img;
2589
		$(".recortar10").addClass("recortar");
2590
		$("#boton_recortar").removeClass("boton_normal").addClass("recortar boton_marino").text("LABEL_CUT")
2591
		actualizar();
2592
 
2593
		$(elemento).mousemove(function(e){
2594
			mouse = raton(this, e);
2595
			//console.log("raton x: "+mouse.x+ " raton Y: " +mouse.y+ " tx: "+tx+" ty: "+ty+" txf:"+(txf+tx)+" tyf:"+(tyf+ty) )
2596
			if(!recorte_listo){
2597
				if(x+16<mouse.x &&(xf+x-16)>mouse.x && y+16<mouse.y && (y+yf-16)>mouse.y){
2598
			 		$(elemento).css("cursor","move");
2599
			 	}else if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && (y+yf-16)<mouse.y && (y+yf)>mouse.y){
2600
			 		$(elemento).css("cursor","nw-resize");
2601
			 	}else if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
2602
			 		$(elemento).css("cursor","ne-resize");
2603
			 	}else if(x<mouse.x &&(16+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
2604
			 		$(elemento).css("cursor","se-resize");
2605
			 	}else if(x<mouse.x &&(16+x)>mouse.x && (y+yf-16)<mouse.y &&(y+yf)>mouse.y){
2606
			 		$(elemento).css("cursor","sw-resize");
2607
			 	}else{
2608
			 		$(elemento).css("cursor","default");
2609
			 	}
2610
			}else if(texto_listo){
2611
				if(tx-10<mouse.x && tx-10+txf>mouse.x && ty-10<mouse.y && ty-10+tyf>mouse.y){
2612
			 		$(elemento).css("cursor","move");
2613
			 	}else if((txf+tx-10)<mouse.x &&(txf+tx-10+20)>mouse.x && (ty-10+tyf)<mouse.y && (ty-10+tyf+20)>mouse.y){
2614
			 		$(elemento).css("cursor","pointer");
2615
			 	}else{
2616
			 		$(elemento).css("cursor","default");
2617
			 	}
2618
			}
2619
			else{
2620
				$(elemento).css("cursor","default");
2621
			}
2622
		})
2623
		$(elemento).mousedown(function(e){
2624
			mouse = raton(this, e);
2625
			if(!recorte_listo){
2626
				if(x+16<mouse.x &&(xf+x-16)>mouse.x && y+16<mouse.y && (y+yf-16)>mouse.y){
2627
			 		cli = true;
2628
			 	}
2629
			 	if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && (y+yf-16)<mouse.y && (y+yf)>mouse.y){
2630
			 		t4 = true;
2631
			 	}
2632
				if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
2633
			 		t3 = true;
2634
			 	}
2635
			 	if(x<mouse.x &&(16+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
2636
			 		t1 = true;
2637
			 	}
2638
			 	if(x<mouse.x &&(16+x)>mouse.x && (y+yf-16)<mouse.y &&(y+yf)>mouse.y){
2639
			 		t2 = true;
2640
			 	}
2641
			}else if(texto_listo){
2642
				if(tx-10<mouse.x && tx-10+txf>mouse.x && ty-10<mouse.y && ty-10+tyf>mouse.y){
2643
			 		tcli=true;
2644
			 	}else if((txf+tx-10)<mouse.x &&(txf+tx-10+20)>mouse.x && (ty-10+tyf)<mouse.y && (ty-10+tyf+20)>mouse.y){
2645
			 		rotar=true;
2646
			 	}
2647
			}
2648
 
2649
		 })
2650
 
2651
		 $(elemento).mousemove(function(e){
2652
		 	mouse = raton(this, e);
2653
		 	if(!recorte_listo){
2654
			 	if(cli){
2655
			 		if((mouse.y-(yf/2))>=0&&(mouse.y+(yf/2))<=alto){
2656
				 		y = (mouse.y-(yf/2));
2657
			 		}else{
2658
			 			if((mouse.y-(yf/2))<0){
2659
			 				y=0;
2660
			 			}
2661
			 			if((mouse.y+(yf/2))>alto){
2662
			 				y=alto-yf;
2663
			 			}
2664
			 		}
2665
			 		if((mouse.x-(xf/2))>=0&&(mouse.x+(xf/2))<=ancho){
2666
			 			x = (mouse.x-(xf/2));
2667
			 		}else{
2668
			 			if((mouse.x-(xf/2))<0){
2669
			 				x=0;
2670
			 			}
2671
			 			if((mouse.x+(xf/2))>ancho){
2672
			 				x=(ancho)-xf;
2673
			 			}
2674
			 		}
2675
			 	}
2676
				if(blockCelda){
2677
			 	if(t4){
2678
			 		if(mouse.y<(alto-10)&&(x+xf)<=(ancho)){
2679
				 		if(Math.round(xf)>=50){
2680
							if(((mouse.y-y)/recorte)>50){
2681
				 				yf=mouse.y-y;
2682
				 				xf=(yf/recorte);
2683
				 			}
2684
						}
2685
			 		}else{
2686
			 			if(mouse.y>=(alto-10)){
2687
			 				yf=alto-y;
2688
				 			xf=(yf/recorte);
2689
				 			t4=false;
2690
			 			}
2691
			 			if(x+xf>(ancho)){
2692
			 				xf=(ancho)-x;
2693
				 			yf=(xf*recorte);
2694
				 			t4=false;
2695
			 			}
2696
			 		}
2697
			 	}
2698
			 	if(t3){
2699
			 		if(mouse.y>0&&(x+xf)<=(ancho)){
2700
				 		if(Math.round(xf)>=50){
2701
							if(((yf+(y-mouse.y))/recorte)>50){
2702
					 			yf=yf+(y-mouse.y);
2703
					 			xf=(yf/recorte);
2704
					 			y=mouse.y;
2705
				 			}
2706
				 		}
2707
 
2708
			 		}else{
2709
			 			if(mouse.y<=0) {
2710
			 				yf=yf+(y-mouse.y);
2711
				 			xf=(yf/recorte);
2712
			 				y=0;
2713
			 				t3=false;
2714
			 			}
2715
			 			if(x+xf>(ancho)){
2716
			 				xf=(ancho)-x;
2717
				 			yf=xf*recorte;
2718
				 			t3=false;
2719
			 			}
2720
			 		}
2721
			 	}
2722
			 	if(t2){
2723
			 		if(mouse.y<(alto-10)&&x>=0){
2724
				 		if(Math.round(xf)>=50){
2725
							if(((mouse.y-y)/recorte)>50){
2726
					 			x=(x+(yf-(mouse.y-y))/recorte);
2727
					 			yf=mouse.y-y;
2728
					 			xf=(yf/recorte);
2729
				 			}
2730
					 	}
2731
 
2732
			 		}else{
2733
			 			if(mouse.y>=(alto-10)) {
2734
			 				yf=alto-y;
2735
				 			xf=(yf/recorte);
2736
				 			t2=false;
2737
			 			}
2738
			 			if(0>x){
2739
			 				x=0;
2740
			 				xf=mouse.y-y;
2741
				 			yf=(xf*recorte);
2742
				 			t2=false;
2743
			 			}
2744
			 		}
2745
			 	}
2746
			 	if(t1){
2747
			 		if(mouse.y>0&&x>=0){
2748
				 		if(Math.round(xf)>=50){
2749
							if(((yf+(y-mouse.y))/recorte)>50){
2750
								yf=yf+(y-mouse.y);
2751
					 			xf=(yf/recorte);
2752
					 			x=(x-(y-mouse.y)/recorte);
2753
					 			y=mouse.y;
2754
							}
2755
				 		}
2756
			 		}else{
2757
			 			if(mouse.y<=0) {
2758
			 				yf=yf+(y-mouse.y);
2759
				 			xf=(yf/recorte);
2760
			 				y=0;
2761
			 				t1=false;
2762
			 			}
2763
			 			if(0>x){
2764
			 				x=0;
2765
			 				xf=yf+(y-mouse.y);
2766
				 			yf=(xf*recorte);
2767
				 			t1=false;
2768
			 			}
2769
			 		}
2770
			 	}
2771
				}else{
2772
				 if(t4){
2773
			 		if(mouse.y<(alto-10-(2/scale))&&mouse.x<=(ancho-(2/scale))){
2774
 
2775
							if((mouse.y-y)>50){
2776
				 				yf=mouse.y-y;
2777
				 			}
2778
							if((mouse.x-x)>50){
2779
								xf=mouse.x-x;
2780
							}
2781
 
2782
			 		}else{
2783
			 			if(mouse.y>=(alto-10-(2/scale))){
2784
			 				yf=alto-y;
2785
			 			}
2786
			 			if(mouse.x>(ancho-(2/scale))){
2787
			 				xf=(ancho)-x;
2788
			 			}
2789
						 t4=false;
2790
			 		}
2791
			 	}
2792
			 	if(t3){
2793
			 		if(mouse.y>(2/scale)&&mouse.x<=(ancho-(2/scale))){
2794
 
2795
							if((yf-(mouse.y-y))>50){
2796
				 				yf=yf-(mouse.y-y);
2797
								y=mouse.y;
2798
				 			}
2799
							if((mouse.x-x)>50){
2800
								xf=mouse.x-x;
2801
							}
2802
 
2803
 
2804
			 		}else{
2805
						if(mouse.x>(ancho-(2/scale))){
2806
							xf=ancho-x;
2807
						}
2808
						if(mouse.y<=(2/scale)){
2809
							yf=yf-(mouse.y-y);
2810
							y=0;
2811
						}
2812
			 			t3=false;
2813
			 		}
2814
			 	}
2815
				/* Izquierda abajo */
2816
			 	if(t2){
2817
			 		if(mouse.y<(alto-10-(2/scale))&&mouse.x>=(2/scale)){
2818
							 if((mouse.y-y)>50){
2819
								yf=mouse.y-y;
2820
				 			}
2821
							if((xf-(mouse.x-x))>50){
2822
								xf=xf-(mouse.x-x);
2823
								x=mouse.x
2824
							}
2825
 
2826
			 		}else{
2827
			 			if(mouse.y>=(alto-10-(2/scale))) {
2828
							yf=alto-y;
2829
			 			}
2830
 
2831
			 			if(mouse.x<(2/scale)){
2832
							xf=xf-(mouse.x-x);
2833
			 				x=0;
2834
			 			}
2835
						 t2=false;
2836
			 		}
2837
			 	}
2838
				/* izquierda arriba */
2839
			 	if(t1){
2840
			 		if(mouse.y>(2/scale)&&mouse.x>=(2/scale)){
2841
 
2842
							if((yf-(mouse.y-y))>50){
2843
				 				yf=yf-(mouse.y-y);
2844
								y=mouse.y;
2845
				 			}
2846
							if((xf-(mouse.x-x))>50){
2847
								xf=xf-(mouse.x-x);
2848
								x=mouse.x
2849
							}
2850
 
2851
			 		}else{
2852
						if(mouse.y<=(2/scale)){
2853
							yf=yf-(mouse.y-y);
2854
							y=0;
2855
						}
2856
						 if(mouse.x<(2/scale)){
2857
							xf=xf-(mouse.x-x);
2858
			 				x=0;
2859
 
2860
			 			}
2861
						 t1=false;
2862
			 		}
2863
			 	}
2864
			}
2865
 
2866
		 	actualizar();
2867
		 	}else if(texto_listo){
2868
		 		if(tcli){
2869
		 			tx=mouse.x-(txf/2)
2870
		 			ty=mouse.y-(tyf/2)
2871
		 		}else if(rotar){
2872
 
2873
		 		}
2874
 
2875
		 		actualizar2();
2876
		 	}
2877
		 })
2878
		 $(elemento).mouseup(function(e){
2879
		 	if(!recorte_listo){
2880
			 	cli=false;
2881
			 	t1=false;
2882
			 	t2=false;
2883
			 	t3=false;
2884
			 	t4=false;
2885
		 	}else if (texto_listo) {
2886
		 		tcli=false;
2887
		 	}
2888
		 })
2889
 
2890
 
2891
	}
2892
	/* Titulo */
2893
 
2894
var titulo_noticia, censor_titulo = true, numero_titulo=0;
2895
	$(document).on("keyup change", "#name", function(e){
2896
	console.log(numero_titulo)
2897
	titulo_noticia = $(this).val();
2898
	titulo_elemento= $(".titulo_topico");
2899
	if(titulo_noticia!=""){
2900
		if(censor_titulo){
2901
			titulo_elemento.html(titulo_noticia);
2902
			if(titulo_elemento.height()>38){
2903
				var titulo_noticia2 = "";
2904
				for(var i =0; i <titulo_noticia.length;i++){
2905
					titulo_noticia2 = titulo_noticia2 + titulo_noticia.split("")[i];
2906
					titulo_elemento.html(titulo_noticia2);
2907
					if(titulo_elemento.height()>38){
2908
						titulo_noticia2 = titulo_noticia2.slice(0,-5) + "...";
2909
						titulo_elemento.html(titulo_noticia2);
2910
						numero_titulo = titulo_noticia2.length;
2911
						censor_titulo=false;
2912
						break;
2913
					}
2914
 
2915
				}
2916
			}else{
2917
				numero_titulo=0;
2918
			}
2919
		}else{
2920
			if(numero_titulo+1>=titulo_noticia.length){
2921
				titulo_elemento.html(titulo_noticia);
2922
				censor_titulo=true;
2923
			}
2924
		}
2925
	}else{
6543 nelberth 2926
		titulo_elemento.html("LABEL_TITLE_TOPIC");
6113 nelberth 2927
		censor_titulo = true;
2928
	}
2929
})
2930
 
1 www 2931
});
2932
JS;
2933
$this->inlineScript()->captureEnd();
2934
?>
2935
 
2936
 
2937
<!-- Content Header (Page header) -->
2938
<section class="content-header">
2939
	<div class="container-fluid">
2940
    	<div class="row mb-2">
2941
        	<div class="col-sm-12">
2942
            	<h1>LABEL_SLIDES</h1>
2943
			</div>
2944
		</div>
2945
	</div><!-- /.container-fluid -->
2946
</section>
2947
 
6122 nelberth 2948
<section class="content" id='content1'>
1 www 2949
	<div class="container-fluid">
2950
    	<div class="row">
2951
        	<div class="col-12">
2952
				<div class="card">
2953
					<div class="card-header">
2954
						<?php
2955
                        $form = $this->form;
2956
            	        $form->setAttributes([
2957
                            'name'    => 'form-filter',
2958
                            'id'      => 'form-filter',
2959
                        ]);
2960
 
2961
                        $form->prepare();
2962
                        echo $this->form()->openTag($form);
2963
                        ?>
2964
                        <div class="row">
2965
                            <div class="col-md-6 col-sm-12">
2966
                                <div class="form-group">
2967
                                    <?php
2968
                                        $element = $form->get('topic_uuid');
2969
 
2970
                                        $element->setOptions(['label' => 'LABEL_TOPIC']);
2971
 
2972
                                        $element->setAttributes(['class' => 'form-control']);
2973
                                        echo $this->formLabel($element);
2974
                                        echo $this->formSelect($element);
2975
                                    ?>
2976
                                </div>
2977
                            </div>
2978
                            <div class="col-md-6 col-sm-12">
2979
                                <div class="form-group">
2980
                                    <?php
2981
                                        $element = $form->get('capsule_uuid');
2982
                                        $element->setOptions(['label' => 'LABEL_CAPSULE']);
2983
                                        $element->setAttributes(['class' => 'form-control']);
2984
                                        echo $this->formLabel($element);
2985
                                        echo $this->formSelect($element);
2986
                                    ?>
2987
                                </div>
2988
                            </div>
2989
                        </div>
2990
						<?php echo $this->form()->closeTag($form); ?>
2991
					</div>
2992
					<div class="card-body">
20 steven 2993
        	    		<table id="gridTable" class="table   table-hover">
1 www 2994
                      		<thead>
2995
        						<tr>
2996
                                	<th>LABEL_NAME</th>
2997
                                  	<th>LABEL_DETAILS</th>
2998
                                  	<th>LABEL_MEDIA</th>
2999
                                  	<th>LABEL_ACTIONS</th>
3000
                                </tr>
3001
                       		</thead>
3002
                         	<tbody>
3003
                         	</tbody>
3004
                    	</table>
3005
                   	</div>
3006
                   	<div class="card-footer clearfix">
3007
                   		<div style="float:right;">
3008
							<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
3009
							<?php if($allowAdd) : ?>
3010
							<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
3011
							<?php endif; ?>
3012
						</div>
3013
                 	</div>
3014
          		</div>
3015
           	</div>
3016
        </div>
3017
 	</div>
3018
</section>
3019
 
3020
 
3021
 
3022
<!-- The Modal -->
6531 nelberth 3023
<div  id="company-microlearning-slide-text-add-box" style='display:none'>
6528 nelberth 3024
 
1 www 3025
    		<?php
3026
    	    $form = $this->formTextAdd;
3027
    	    $form->setAttributes([
3028
    	       'method'    => 'post',
3029
    	       'name'      => 'form-slide-text-add',
3030
    	       'id'        => 'form-slide-text-add'
3031
    	    ]);
3032
    	    $form->prepare();
3033
    	    echo $this->form()->openTag($form);
3034
 
3035
    	    $element = $form->get('type');
3036
    	    echo $this->formHidden($element);
3037
 
3038
    	    ?>
3039
 
6528 nelberth 3040
            <div class="d-flex justify-content-center tituloEditor">
6590 nelberth 3041
              <h4>LABEL_ADD_TEXT_SLIDE</h4>
6528 nelberth 3042
 
3043
             </div>
3044
 
3045
 
3046
            <div class="grid-padre">
3047
				<div class="form-group grid-1-2">
1 www 3048
    				<?php
3049
                        $element = $form->get('name');
3050
                        $element->setAttributes(['class' => 'form-control']);
3051
                        $element->setOptions(['label' => 'LABEL_NAME']);
3052
                        echo $this->formLabel($element);
3053
                        echo $this->formText($element);
3054
                    ?>
3055
				</div>
6528 nelberth 3056
                <div class="form-group grid-1-2">
1 www 3057
                	<?php
3058
                    $element = $form->get('description');
3059
                    $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
6600 nelberth 3060
                    $element->setAttributes(['id' => 'description_add', 'rows' => '2',  'class' => 'form-control']);
1 www 3061
                    echo $this->formLabel($element);
3062
                    echo $this->formTextArea($element);
3063
                    ?>
3064
   				</div>
6528 nelberth 3065
				<div class="form-group grid-1-2">
1 www 3066
    				<?php
3067
                        $element = $form->get('order');
3068
                        $element->setAttributes(['class' => 'form-control']);
3069
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3070
                        echo $this->formLabel($element);
3071
                        echo $this->formText($element);
3072
                    ?>
3073
				</div>
6529 nelberth 3074
                <?php
3075
                    $element = $form->get('background');
3076
					$element->setAttributes([ 'class' => 'background']);
3077
                    echo $this->formHidden($element);
3078
                ?>
6543 nelberth 3079
				<div class="contenido form-group " id="contenido"></div>
6529 nelberth 3080
 
1 www 3081
      		</div>
3082
 
3083
          	<?php echo $this->form()->closeTag($form); ?>
6528 nelberth 3084
 
1 www 3085
</div>
3086
 
3087
 
3088
 
3089
 
3090
<!-- The Modal -->
6596 nelberth 3091
<div id="company-microlearning-slide-text-edit-box" style='display:none'>
6595 nelberth 3092
            <?php
1 www 3093
    	    $form = $this->formTextEdit;
3094
    	    $form->setAttributes([
3095
    	       'method'    => 'post',
3096
    	       'name'      => 'form-slide-text-edit',
3097
    	       'id'        => 'form-slide-text-edit'
3098
    	    ]);
3099
    	    $form->prepare();
3100
    	    echo $this->form()->openTag($form);
3101
 
3102
    	    $element = $form->get('type');
3103
    	    echo $this->formHidden($element);
3104
 
6595 nelberth 3105
    	    ?>
3106
            <div class="d-flex justify-content-center tituloEditor">
3107
              <h4>LABEL_EDIT_TEXT_SLIDE</h4>
1 www 3108
 
6595 nelberth 3109
             </div>
3110
 
3111
 
3112
            <div class="grid-padre">
3113
				<div class="form-group grid-1-2">
1 www 3114
    				<?php
3115
                        $element = $form->get('name');
3116
                        $element->setAttributes(['class' => 'form-control']);
3117
                        $element->setOptions(['label' => 'LABEL_NAME']);
3118
                        echo $this->formLabel($element);
3119
                        echo $this->formText($element);
3120
                    ?>
3121
				</div>
6595 nelberth 3122
                <div class="form-group grid-1-2">
1 www 3123
                	<?php
3124
                    $element = $form->get('description');
3125
                    $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
6600 nelberth 3126
                    $element->setAttributes(['id' => 'description_edit', 'rows' => '2',  'class' => 'form-control']);
1 www 3127
                    echo $this->formLabel($element);
3128
                    echo $this->formTextArea($element);
3129
                    ?>
3130
   				</div>
6595 nelberth 3131
				<div class="form-group grid-1-2">
1 www 3132
    				<?php
3133
                        $element = $form->get('order');
3134
                        $element->setAttributes(['class' => 'form-control']);
3135
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3136
                        echo $this->formLabel($element);
3137
                        echo $this->formText($element);
3138
                    ?>
3139
				</div>
6595 nelberth 3140
                <?php
3141
                    $element = $form->get('background');
3142
					$element->setAttributes([ 'class' => 'background']);
3143
                    echo $this->formHidden($element);
3144
                ?>
3145
				<div class="contenido form-group " id="contenido"></div>
3146
 
1 www 3147
      		</div>
3148
 
3149
          	<?php echo $this->form()->closeTag($form); ?>
6595 nelberth 3150
 
1 www 3151
</div>
3152
 
3153
 
3154
 
3155
<!-- The Modal -->
6523 nelberth 3156
<div class='imageType'  id="company-microlearning-slide-image-add-box" style='display:none' >
1 www 3157
    		<?php
3158
    	    $form = $this->formImageAdd;
3159
    	    $form->setAttributes([
3160
    	       'method'    => 'post',
3161
    	        'name'      => 'form-slide-image-add',
3162
    	        'id'        => 'form-slide-image-add'
3163
    	    ]);
3164
    	    $form->prepare();
3165
    	    echo $this->form()->openTag($form);
3166
 
3167
    	    $element = $form->get('type');
3168
    	    echo $this->formHidden($element);
3169
 
3170
    	    ?>
3171
            <!-- Modal Header -->
6126 nelberth 3172
            <div class="d-flex justify-content-center tituloEditor">
6131 nelberth 3173
              <h4>LABEL_ADD_IMAGE_SLIDE</h4>
1 www 3174
 
6126 nelberth 3175
             </div>
3176
 
1 www 3177
            <!-- Modal body -->
6126 nelberth 3178
            <div class="grid-padre">
6140 nelberth 3179
                 <div class="form-group grid-1-2">
1 www 3180
    				<?php
3181
                        $element = $form->get('name');
3182
                        $element->setAttributes(['class' => 'form-control']);
3183
                        $element->setOptions(['label' => 'LABEL_NAME']);
3184
                        echo $this->formLabel($element);
3185
                        echo $this->formText($element);
3186
                    ?>
3187
				</div>
6142 nelberth 3188
 
6137 nelberth 3189
 
6134 nelberth 3190
                <?php
3191
                    $element = $form->get('file');
3192
					$element->setAttributes([ 'class' => 'file']);
3193
                    echo $this->formHidden($element);
3194
                ?>
6129 nelberth 3195
				<div class="form-group grid-1-2">
1 www 3196
    				<?php
3197
                        $element = $form->get('order');
3198
                        $element->setAttributes(['class' => 'form-control']);
3199
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3200
                        echo $this->formLabel($element);
3201
                        echo $this->formText($element);
3202
                    ?>
3203
				</div>
6544 nelberth 3204
                <div class="contenido form-group " id="contenido"></div>
1 www 3205
      		</div>
3206
 
6125 nelberth 3207
 
1 www 3208
          	<?php echo $this->form()->closeTag($form); ?>
3209
</div>
3210
 
6523 nelberth 3211
<div class='imageType' id="company-microlearning-slide-image-edit-box" style='display:none' >
6505 nelberth 3212
            <?php
3213
    	    $form = $this->formImageEdit;
3214
    	    $form->setAttributes([
3215
    	       'method'    => 'post',
3216
    	       'name'      => 'form-slide-image-edit',
3217
    	       'id'        => 'form-slide-image-edit'
3218
    	    ]);
3219
    	    $form->prepare();
3220
    	    echo $this->form()->openTag($form);
3221
 
3222
    	    $element = $form->get('type');
3223
    	    echo $this->formHidden($element);
3224
 
3225
    	    ?>
3226
            <!-- Modal Header -->
3227
            <div class="d-flex justify-content-center tituloEditor">
3228
              <h4>LABEL_EDIT_IMAGE_SLIDE</h4>
3229
 
3230
             </div>
3231
 
3232
            <!-- Modal body -->
3233
            <div class="grid-padre">
3234
                 <div class="form-group grid-1-2">
3235
    				<?php
3236
                        $element = $form->get('name');
3237
                        $element->setAttributes(['class' => 'form-control']);
3238
                        $element->setOptions(['label' => 'LABEL_NAME']);
3239
                        echo $this->formLabel($element);
3240
                        echo $this->formText($element);
3241
                    ?>
3242
				</div>
3243
 
3244
 
3245
                <?php
3246
                    $element = $form->get('file');
3247
					$element->setAttributes([ 'class' => 'file']);
3248
                    echo $this->formHidden($element);
3249
                ?>
3250
				<div class="form-group grid-1-2">
3251
    				<?php
3252
                        $element = $form->get('order');
3253
                        $element->setAttributes(['class' => 'form-control']);
3254
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3255
                        echo $this->formLabel($element);
3256
                        echo $this->formText($element);
3257
                    ?>
3258
				</div>
6625 nelberth 3259
 
6569 nelberth 3260
                <div class="contenido form-group " id="contenido"></div>
6505 nelberth 3261
      		</div>
1 www 3262
 
6505 nelberth 3263
 
3264
          	<?php echo $this->form()->closeTag($form); ?>
3265
</div>
1 www 3266
 
3267
 
3268
<!-- The Modal -->
6523 nelberth 3269
 
1 www 3270
 
3271
 
3272
 
3273
<!-- The Modal -->
6618 nelberth 3274
<div  id="company-microlearning-slide-video-add-box"  style='display:none'>
3275
 
1 www 3276
    		<?php
3277
    	    $form = $this->formVideoAdd;
3278
    	    $form->setAttributes([
3279
    	       'method'    => 'post',
3280
    	        'name'      => 'form-slide-video-add',
3281
    	        'id'        => 'form-slide-video-add'
3282
    	    ]);
3283
    	    $form->prepare();
3284
    	    echo $this->form()->openTag($form);
3285
 
3286
    	    $element = $form->get('type');
3287
    	    echo $this->formHidden($element);
3288
 
3289
    	    ?>
6618 nelberth 3290
 
3291
              <div class="d-flex justify-content-center tituloEditor">
3292
              <h4>LABEL_ADD_VIDEO_SLIDE</h4>
1 www 3293
 
6618 nelberth 3294
             </div>
3295
            <div class="grid-padre">
3296
				<div class="form-group  grid-1-2">
1 www 3297
    				<?php
3298
                        $element = $form->get('name');
3299
                        $element->setAttributes(['class' => 'form-control']);
3300
                        $element->setOptions(['label' => 'LABEL_NAME']);
3301
                        echo $this->formLabel($element);
3302
                        echo $this->formText($element);
3303
                    ?>
3304
				</div>
6618 nelberth 3305
				<div class="form-group  grid-1-2">
1 www 3306
    				<?php
3307
                        $element = $form->get('order');
3308
                        $element->setAttributes(['class' => 'form-control']);
3309
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3310
                        echo $this->formLabel($element);
3311
                        echo $this->formText($element);
3312
                    ?>
3313
				</div>
6618 nelberth 3314
				<div class="form-group  grid-1-2">
1 www 3315
 
3316
                 		<?php
3317
                        $element = $form->get('file');
3318
                        $element->setAttributes(['class' => 'form-control']);
3319
                        $element->setOptions(['label' => 'LABEL_VIDEO']);
3320
                        $element->setAttributes(['accept' => 'video/webm,video/mpeg,video/mp4']);
3321
                        echo $this->formLabel($element);
3322
                        ?>
3323
                        <div class="file-loading">
3324
                        <?php echo $this->formFile($element);?>
3325
                        </div>
3326
 
3327
          		</div>
6625 nelberth 3328
                  <?php
3329
                    $element = $form->get('background');
3330
					$element->setAttributes([ 'class' => 'background']);
3331
                    echo $this->formHidden($element);
3332
                ?>
6618 nelberth 3333
          		<div class="contenido form-group " id="contenido"></div>
1 www 3334
      		</div>
3335
 
3336
            <!-- Modal footer -->
6618 nelberth 3337
 
1 www 3338
          	<?php echo $this->form()->closeTag($form); ?>
6618 nelberth 3339
 
1 www 3340
</div>
3341
 
3342
 
3343
 
3344
 
3345
<!-- The Modal -->
6646 nelberth 3346
<div  id="company-microlearning-slide-video-edit-box"  style='display:none'>
6644 nelberth 3347
 
1 www 3348
        	<?php
3349
    	    $form = $this->formVideoEdit;
3350
    	    $form->setAttributes([
3351
    	       'method'    => 'post',
3352
    	       'name'      => 'form-slide-video-edit',
3353
    	       'id'        => 'form-slide-video-edit'
3354
    	    ]);
3355
    	    $form->prepare();
3356
    	    echo $this->form()->openTag($form);
3357
 
3358
    	    $element = $form->get('type');
3359
    	    echo $this->formHidden($element);
3360
 
3361
    	    ?>
3362
 
6643 nelberth 3363
            <!-- Modal Header -->
3364
      		<div class="modal-header">
3365
        		<h4 class="modal-title">LABEL_EDIT_VIDEO_SLIDE</h4>
3366
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
3367
      		</div>
1 www 3368
 
6643 nelberth 3369
            <!-- Modal body -->
6644 nelberth 3370
            <div class="grid-padre">
6645 nelberth 3371
				<div class="form-group grid-1-2">
1 www 3372
    				<?php
3373
                        $element = $form->get('name');
3374
                        $element->setAttributes(['class' => 'form-control']);
3375
                        $element->setOptions(['label' => 'LABEL_NAME']);
3376
                        echo $this->formLabel($element);
3377
                        echo $this->formText($element);
3378
                    ?>
3379
				</div>
6645 nelberth 3380
				<div class="form-group grid-1-2">
1 www 3381
    				<?php
3382
                        $element = $form->get('order');
3383
                        $element->setAttributes(['class' => 'form-control']);
3384
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3385
                        echo $this->formLabel($element);
3386
                        echo $this->formText($element);
3387
                    ?>
3388
				</div>
6645 nelberth 3389
				<div class="form-group grid-1-2">
6643 nelberth 3390
 
1 www 3391
                 		<?php
3392
                        $element = $form->get('file');
3393
                        $element->setAttributes(['class' => 'form-control']);
3394
                        $element->setOptions(['label' => 'LABEL_VIDEO']);
3395
                        $element->setAttributes(['accept' => 'video/webm,video/mpeg,video/mp4']);
3396
                        echo $this->formLabel($element);
3397
                        ?>
3398
                        <div class="file-loading">
3399
                        <?php echo $this->formFile($element);?>
3400
                        </div>
6643 nelberth 3401
 
1 www 3402
          		</div>
6645 nelberth 3403
          		<?php
3404
                    $element = $form->get('background');
3405
					$element->setAttributes([ 'class' => 'background']);
3406
                    echo $this->formHidden($element);
3407
                ?>
3408
          		<div class="contenido form-group " id="contenido"></div>
1 www 3409
      		</div>
6643 nelberth 3410
 
6644 nelberth 3411
 
6643 nelberth 3412
          	<?php echo $this->form()->closeTag($form); ?>
6644 nelberth 3413
 
1 www 3414
</div>
3415
 
3416
 
3417
 
3418
 
3419
<!-- The Modal -->
3420
<div class="modal" id="company-microlearning-slide-document-add-box">
3421
	<div class="modal-dialog   modal-xl">
3422
    	<div class="modal-content">
3423
    		<?php
3424
    	    $form = $this->formDocumentAdd;
3425
    	    $form->setAttributes([
3426
    	       'method'    => 'post',
3427
    	        'name'      => 'form-slide-document-add',
3428
    	        'id'        => 'form-slide-document-add'
3429
    	    ]);
3430
    	    $form->prepare();
3431
    	    echo $this->form()->openTag($form);
3432
 
3433
    	    $element = $form->get('type');
3434
    	    echo $this->formHidden($element);
3435
 
3436
    	    ?>
3437
            <!-- Modal Header -->
3438
      		<div class="modal-header">
3439
        		<h4 class="modal-title">LABEL_ADD_DOCUMENT_SLIDE</h4>
3440
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
3441
      		</div>
3442
 
3443
            <!-- Modal body -->
3444
            <div class="modal-body">
3445
				<div class="form-group">
3446
    				<?php
3447
                        $element = $form->get('name');
3448
                        $element->setAttributes(['class' => 'form-control']);
3449
                        $element->setOptions(['label' => 'LABEL_NAME']);
3450
                        echo $this->formLabel($element);
3451
                        echo $this->formText($element);
3452
                    ?>
3453
				</div>
3454
				<div class="form-group">
3455
    				<?php
3456
                        $element = $form->get('order');
3457
                        $element->setAttributes(['class' => 'form-control']);
3458
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3459
                        echo $this->formLabel($element);
3460
                        echo $this->formText($element);
3461
                    ?>
3462
				</div>
3463
				<div class="form-group">
3464
 
3465
                 		<?php
3466
                        $element = $form->get('file');
3467
                        $element->setAttributes(['class' => 'form-control']);
3468
                        $element->setOptions(['label' => 'LABEL_DOCUMENT']);
3469
                        $element->setAttributes(['accept' => 'application/pdf']);
3470
                        echo $this->formLabel($element);
3471
                        ?>
3472
                        <div class="file-loading">
3473
                        <?php echo $this->formFile($element);?>
3474
                        </div>
3475
 
3476
          		</div>
3477
         		<div class="form-group">
3478
 
3479
                 		<?php
3480
                        $element = $form->get('background');
3481
                        $element->setAttributes(['class' => 'form-control']);
3482
                        $element->setOptions(['label' => 'LABEL_IMAGE_BACKGROUND']);
3483
                        $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
3484
                        echo $this->formLabel($element);
3485
                        ?>
3486
                        <div class="file-loading">
3487
                        <?php echo $this->formFile($element);?>
3488
                        </div>
3489
 
3490
          		</div>
3491
      		</div>
3492
 
3493
            <!-- Modal footer -->
3494
      		<div class="modal-footer">
3495
      			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
3496
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
3497
          	</div>
3498
          	<?php echo $this->form()->closeTag($form); ?>
3499
         </div>
3500
	</div>
3501
</div>
3502
 
3503
 
3504
 
3505
 
3506
<!-- The Modal -->
3507
<div class="modal" id="company-microlearning-slide-document-edit-box">
3508
	<div class="modal-dialog   modal-xl">
3509
    	<div class="modal-content">
3510
    		<?php
3511
    	    $form = $this->formDocumentEdit;
3512
    	    $form->setAttributes([
3513
    	       'method'    => 'post',
3514
    	       'name'      => 'form-slide-document-edit',
3515
    	       'id'        => 'form-slide-document-edit'
3516
    	    ]);
3517
    	    $form->prepare();
3518
    	    echo $this->form()->openTag($form);
3519
 
3520
    	    $element = $form->get('type');
3521
    	    echo $this->formHidden($element);
3522
 
3523
    	    ?>
3524
            <!-- Modal Header -->
3525
      		<div class="modal-header">
3526
        		<h4 class="modal-title">LABEL_EDIT_DOCUMENT_SLIDE</h4>
3527
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
3528
      		</div>
3529
 
3530
            <!-- Modal body -->
3531
            <div class="modal-body">
3532
				<div class="form-group">
3533
    				<?php
3534
                        $element = $form->get('name');
3535
                        $element->setAttributes(['class' => 'form-control']);
3536
                        $element->setOptions(['label' => 'LABEL_NAME']);
3537
                        echo $this->formLabel($element);
3538
                        echo $this->formText($element);
3539
                    ?>
3540
				</div>
3541
				<div class="form-group">
3542
    				<?php
3543
                        $element = $form->get('order');
3544
                        $element->setAttributes(['class' => 'form-control']);
3545
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3546
                        echo $this->formLabel($element);
3547
                        echo $this->formText($element);
3548
                    ?>
3549
				</div>
3550
				<div class="form-group">
3551
 
3552
                 		<?php
3553
                        $element = $form->get('file');
3554
                        $element->setAttributes(['class' => 'form-control']);
3555
                        $element->setOptions(['label' => 'LABEL_DOCUMENT']);
3556
                        $element->setAttributes(['accept' => 'application/pdf']);
3557
                        echo $this->formLabel($element);
3558
                        ?>
3559
                        <div class="file-loading">
3560
                        <?php echo $this->formFile($element);?>
3561
                        </div>
3562
 
3563
          		</div>
3564
         		<div class="form-group">
3565
 
3566
                 		<?php
3567
                        $element = $form->get('background');
3568
                        $element->setAttributes(['class' => 'form-control']);
3569
                        $element->setOptions(['label' => 'LABEL_IMAGE_BACKGROUND']);
3570
                        $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
3571
                        echo $this->formLabel($element);
3572
                        ?>
3573
                        <div class="file-loading">
3574
                        <?php echo $this->formFile($element);?>
3575
                        </div>
3576
 
3577
          		</div>
3578
      		</div>
3579
 
3580
            <!-- Modal footer -->
3581
      		<div class="modal-footer">
3582
      			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
3583
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
3584
          	</div>
3585
          	<?php echo $this->form()->closeTag($form); ?>
3586
         </div>
3587
	</div>
3588
</div>
3589
 
3590
 
3591
 
3592
<!-- The Modal -->
3593
<div class="modal" id="company-microlearning-slide-audio-add-box">
3594
	<div class="modal-dialog   modal-xl">
3595
    	<div class="modal-content">
3596
    		<?php
3597
    	    $form = $this->formAudioAdd;
3598
    	    $form->setAttributes([
3599
    	       'method'    => 'post',
3600
    	        'name'      => 'form-slide-audio-add',
3601
    	        'id'        => 'form-slide-audio-add'
3602
    	    ]);
3603
    	    $form->prepare();
3604
    	    echo $this->form()->openTag($form);
3605
 
3606
    	    $element = $form->get('type');
3607
    	    echo $this->formHidden($element);
3608
 
3609
    	    ?>
3610
            <!-- Modal Header -->
3611
      		<div class="modal-header">
3612
        		<h4 class="modal-title">LABEL_ADD_AUDIO_SLIDE</h4>
3613
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
3614
      		</div>
3615
 
3616
            <!-- Modal body -->
3617
            <div class="modal-body">
3618
				<div class="form-group">
3619
    				<?php
3620
                        $element = $form->get('name');
3621
                        $element->setAttributes(['class' => 'form-control']);
3622
                        $element->setOptions(['label' => 'LABEL_NAME']);
3623
                        echo $this->formLabel($element);
3624
                        echo $this->formText($element);
3625
                    ?>
3626
				</div>
3627
				<div class="form-group">
3628
    				<?php
3629
                        $element = $form->get('order');
3630
                        $element->setAttributes(['class' => 'form-control']);
3631
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3632
                        echo $this->formLabel($element);
3633
                        echo $this->formText($element);
3634
                    ?>
3635
				</div>
3636
				<div class="form-group">
3637
 
3638
                 		<?php
3639
                        $element = $form->get('file');
3640
                        $element->setAttributes(['class' => 'form-control']);
3641
                        $element->setOptions(['label' => 'LABEL_AUDIO']);
3642
                        $element->setAttributes(['accept' => 'audio/x-wav, audio/mpeg']);
3643
                        echo $this->formLabel($element);
3644
                        ?>
3645
                        <div class="file-loading">
3646
                        <?php echo $this->formFile($element);?>
3647
                        </div>
3648
 
3649
          		</div>
3650
          		<div class="form-group">
3651
 
3652
                 		<?php
3653
                        $element = $form->get('background');
3654
                        $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
3655
                        $element->setAttributes(['class' => 'form-control']);
3656
                        $element->setOptions(['label' => 'LABEL_IMAGE_BACKGROUND']);
3657
                        echo $this->formLabel($element);
3658
                        ?>
3659
                        <div class="file-loading">
3660
                        <?php echo $this->formFile($element);?>
3661
                        </div>
3662
 
3663
          		</div>
3664
      		</div>
3665
 
3666
            <!-- Modal footer -->
3667
      		<div class="modal-footer">
3668
      			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
3669
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
3670
          	</div>
3671
          	<?php echo $this->form()->closeTag($form); ?>
3672
         </div>
3673
	</div>
3674
</div>
3675
 
3676
 
3677
 
3678
 
3679
 
3680
<!-- The Modal -->
3681
<div class="modal" id="company-microlearning-slide-audio-edit-box">
3682
	<div class="modal-dialog   modal-xl">
3683
    	<div class="modal-content">
3684
        	<?php
3685
    	    $form = $this->formAudioEdit;
3686
    	    $form->setAttributes([
3687
    	       'method'    => 'post',
3688
    	       'name'      => 'form-slide-audio-edit',
3689
    	       'id'        => 'form-slide-audio-edit'
3690
    	    ]);
3691
    	    $form->prepare();
3692
    	    echo $this->form()->openTag($form);
3693
 
3694
    	    $element = $form->get('type');
3695
    	    echo $this->formHidden($element);
3696
 
3697
    	    ?>
3698
 
3699
            <!-- Modal Header -->
3700
      		<div class="modal-header">
3701
        		<h4 class="modal-title">LABEL_EDIT_AUDIO_SLIDE</h4>
3702
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
3703
      		</div>
3704
 
3705
            <!-- Modal body -->
3706
            <div class="modal-body">
3707
				<div class="form-group">
3708
    				<?php
3709
                        $element = $form->get('name');
3710
                        $element->setAttributes(['class' => 'form-control']);
3711
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3712
                        echo $this->formLabel($element);
3713
                        echo $this->formText($element);
3714
                    ?>
3715
				</div>
3716
				<div class="form-group">
3717
    				<?php
3718
                        $element = $form->get('order');
3719
                        $element->setAttributes(['class' => 'form-control']);
3720
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3721
                        echo $this->formLabel($element);
3722
                        echo $this->formText($element);
3723
                    ?>
3724
				</div>
3725
				<div class="form-group">
3726
 
3727
                 		<?php
3728
                        $element = $form->get('file');
3729
                        $element->setAttributes(['class' => 'form-control']);
3730
                        $element->setOptions(['label' => 'LABEL_AUDIO']);
3731
                        $element->setAttributes(['accept' => 'audio/x-wav, audio/mpeg']);
3732
                        echo $this->formLabel($element);
3733
                        ?>
3734
                        <div class="file-loading">
3735
                        <?php echo $this->formFile($element);?>
3736
                        </div>
3737
 
3738
          		</div>
3739
          		<div class="form-group">
3740
 
3741
                 		<?php
3742
                        $element = $form->get('background');
3743
                        $element->setAttributes(['class' => 'form-control']);
3744
                        $element->setOptions(['label' => 'LABEL_IMAGE_BACKGROUND']);
3745
                        $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
3746
                        echo $this->formLabel($element);
3747
                        ?>
3748
                        <div class="file-loading">
3749
                        <?php echo $this->formFile($element);?>
3750
                        </div>
3751
 
3752
          		</div>
3753
      		</div>
3754
 
3755
            <!-- Modal footer -->
3756
      		<div class="modal-footer">
3757
      			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
3758
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
3759
          	</div>
3760
          	<?php echo $this->form()->closeTag($form); ?>
3761
         </div>
3762
	</div>
3763
</div>
3764
 
3765
 
3766
 
3767
<!-- The Modal -->
3768
<div class="modal" id="company-microlearning-slide-quizz-add-box">
3769
	<div class="modal-dialog   modal-xl">
3770
    	<div class="modal-content">
3771
    		<?php
3772
    	    $form = $this->formQuizzAdd;
3773
    	    $form->setAttributes([
3774
    	       'method'    => 'post',
3775
    	        'name'      => 'form-slide-quizz-add',
3776
    	        'id'        => 'form-slide-quizz-add'
3777
    	    ]);
3778
    	    $form->prepare();
3779
    	    echo $this->form()->openTag($form);
3780
 
3781
    	    $element = $form->get('type');
3782
    	    echo $this->formHidden($element);
3783
 
3784
    	    ?>
3785
            <!-- Modal Header -->
3786
      		<div class="modal-header">
3787
        		<h4 class="modal-title">LABEL_ADD_QUIZ_SLIDE</h4>
3788
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
3789
      		</div>
3790
 
3791
            <!-- Modal body -->
3792
            <div class="modal-body">
3793
				<div class="form-group">
3794
    				<?php
3795
                        $element = $form->get('name');
3796
                        $element->setAttributes(['class' => 'form-control']);
3797
                        $element->setOptions(['label' => 'LABEL_NAME']);
3798
                        echo $this->formLabel($element);
3799
                        echo $this->formText($element);
3800
                    ?>
3801
				</div>
3802
				<div class="form-group">
3803
    				<?php
3804
                        $element = $form->get('order');
3805
                        $element->setAttributes(['class' => 'form-control']);
3806
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3807
                        echo $this->formLabel($element);
3808
                        echo $this->formText($element);
3809
                    ?>
3810
				</div>
3811
          		<div class="form-group">
3812
 
3813
                 		<?php
3814
                        $element = $form->get('background');
3815
                        $element->setAttributes(['class' => 'form-control']);
3816
                        $element->setOptions(['label' => 'LABEL_IMAGE_BACKGROUND']);
3817
                        $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
3818
                        echo $this->formLabel($element);
3819
                        ?>
3820
                        <div class="file-loading">
3821
                        <?php echo $this->formFile($element);?>
3822
                        </div>
3823
 
3824
          		</div>
3825
				<div class="form-group">
3826
    				<?php
3827
                        $element = $form->get('quiz_id');
3828
                        $element->setAttributes(['class' => 'form-control']);
3829
                        $element->setOptions(['label' => 'LABEL_QUIZ']);
3830
                        echo $this->formLabel($element);
3831
                        echo $this->formSelect($element);
3832
                    ?>
3833
				</div>
3834
      		</div>
3835
 
3836
            <!-- Modal footer -->
3837
      		<div class="modal-footer">
3838
      			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
3839
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
3840
          	</div>
3841
          	<?php echo $this->form()->closeTag($form); ?>
3842
         </div>
3843
	</div>
3844
</div>
3845
 
3846
 
3847
 
3848
<!-- The Modal -->
3849
<div class="modal" id="company-microlearning-slide-quizz-edit-box">
3850
	<div class="modal-dialog   modal-xl">
3851
    	<div class="modal-content">
3852
        	<?php
3853
    	    $form = $this->formQuizzEdit;
3854
    	    $form->setAttributes([
3855
    	       'method'    => 'post',
3856
    	       'name'      => 'form-slide-quizz-edit',
3857
    	       'id'        => 'form-slide-quizz-edit'
3858
    	    ]);
3859
    	    $form->prepare();
3860
    	    echo $this->form()->openTag($form);
3861
 
3862
    	    $element = $form->get('type');
3863
    	    echo $this->formHidden($element);
3864
 
3865
    	    ?>
3866
 
3867
            <!-- Modal Header -->
3868
      		<div class="modal-header">
3869
        		<h4 class="modal-title">LABEL_EDIT_QUIZ_SLIDE</h4>
3870
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
3871
      		</div>
3872
 
3873
            <!-- Modal body -->
3874
            <div class="modal-body">
3875
				<div class="form-group">
3876
    				<?php
3877
                        $element = $form->get('name');
3878
                        $element->setAttributes(['class' => 'form-control']);
3879
                        $element->setOptions(['label' => 'LABEL_NAME']);
3880
                        echo $this->formLabel($element);
3881
                        echo $this->formText($element);
3882
                    ?>
3883
				</div>
3884
				<div class="form-group">
3885
    				<?php
3886
                        $element = $form->get('order');
3887
                        $element->setAttributes(['class' => 'form-control']);
3888
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3889
                        echo $this->formLabel($element);
3890
                        echo $this->formText($element);
3891
                    ?>
3892
				</div>
3893
          		<div class="form-group">
3894
 
3895
                 		<?php
3896
                        $element = $form->get('background');
3897
                        $element->setAttributes(['class' => 'form-control']);
3898
                        $element->setOptions(['label' => 'LABEL_IMAGE_BACKGROUND']);
3899
                        $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
3900
                        echo $this->formLabel($element);
3901
                        ?>
3902
                        <div class="file-loading">
3903
                        <?php echo $this->formFile($element);?>
3904
                        </div>
3905
 
3906
          		</div>
3907
				<div class="form-group">
3908
    				<?php
3909
                        $element = $form->get('quiz_id');
3910
                        $element->setAttributes(['class' => 'form-control']);
3911
                        $element->setOptions(['label' => 'LABEL_QUIZ']);
3912
                        echo $this->formLabel($element);
3913
                        echo $this->formSelect($element);
3914
                    ?>
3915
				</div>
3916
 
3917
 
3918
      		</div>
3919
 
3920
            <!-- Modal footer -->
3921
      		<div class="modal-footer">
3922
      			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
3923
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
3924
          	</div>
3925
 
3926
          	<?php echo $this->form()->closeTag($form); ?>
3927
         </div>
3928
	</div>
3929
</div>
3930
 
3931
 
3932
 
3933
<!-- The Modal -->
3934
<div class="modal" id="company-microlearning-play-video-box">
3935
	<div class="modal-dialog ">
3936
    	<div class="modal-content">
3937
 
3938
            <!-- Modal Header -->
3939
      		<div class="modal-header">
3940
        		<h4 class="modal-title">LABEL_PLAY_VIDEO</h4>
3941
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
3942
      		</div>
3943
 
3944
            <!-- Modal body -->
3945
            <div class="modal-body">
3946
				<video src=""  style="width: 300px; height: auto" controls preload="false" autoplay="false"  poster="" id="microlearning-play-video"></video>
3947
      		</div>
3948
 
3949
            <!-- Modal footer -->
3950
      		<div class="modal-footer">
3951
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
3952
          	</div>
3953
         </div>
3954
	</div>
3955
</div>
3956
 
3957
 
3958
 
3959
 
3960
 
3961
<!-- The Modal -->
3962
<div class="modal" id="company-microlearning-play-audio-box">
3963
	<div class="modal-dialog ">
3964
    	<div class="modal-content">
3965
 
3966
            <!-- Modal Header -->
3967
      		<div class="modal-header">
3968
        		<h4 class="modal-title">LABEL_PLAY_AUDIO</h4>
3969
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
3970
      		</div>
3971
 
3972
            <!-- Modal body -->
3973
            <div class="modal-body">
3974
				<audio src="" controls autoplay="false"  id="microlearning-play-audio" >
3975
                  Your browser does not support the <code>audio</code> element.
3976
                </audio>
3977
      		</div>
3978
 
3979
            <!-- Modal footer -->
3980
      		<div class="modal-footer">
3981
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
3982
          	</div>
3983
         </div>
3984
	</div>
3985
</div>
3986
 
3987
 
3988
<!-- The Modal -->
3989
<div class="modal" id="company-microlearning-view-image-box">
3990
	<div class="modal-dialog ">
3991
    	<div class="modal-content">
3992
 
3993
            <!-- Modal Header -->
3994
      		<div class="modal-header">
6108 nelberth 3995
        		<h4 class="modal-title">LABEL_IMAGE</h4>
1 www 3996
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
3997
      		</div>
3998
 
3999
            <!-- Modal body -->
4000
            <div class="modal-body text-center">
4001
				<img src="" class="img img-responsive" style="width: 300px; height: auto" id="image-view" />
4002
      		</div>
4003
 
4004
            <!-- Modal footer -->
4005
      		<div class="modal-footer">
4006
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
4007
          	</div>
4008
         </div>
4009
	</div>
4010
</div>
4011
 
4012
 
4013
<!-- The Modal -->
4014
<div class="modal" id="company-microlearning-view-document-box">
4015
	<div class="modal-dialog ">
4016
    	<div class="modal-content">
4017
 
4018
            <!-- Modal Header -->
4019
      		<div class="modal-header">
4020
        		<h4 class="modal-title">LABEL_DOCUMENT</h4>
4021
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
4022
      		</div>
4023
 
4024
            <!-- Modal body -->
4025
            <div class="modal-body text-center">
4026
            	<iframe id="document-view" style="width: 450px; height: 300px; scroll: auto">
4027
 
4028
            	</iframe>
4029
       	</div>
4030
 
4031
            <!-- Modal footer -->
4032
      		<div class="modal-footer">
4033
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
4034
          	</div>
4035
         </div>
4036
	</div>
4037
</div>
4038
 
4039
 
4040
<!-- The Modal -->
4041
<div class="modal" id="company-microlearning-view-text-box">
4042
	<div class="modal-dialog modal-xl">
4043
    	<div class="modal-content">
4044
 
4045
            <!-- Modal Header -->
4046
      		<div class="modal-header">
4047
        		<h4 class="modal-title">LABEL_TEXT</h4>
4048
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
4049
      		</div>
4050
 
4051
            <!-- Modal body -->
4052
            <div class="modal-body" >
4053
            	<div id="document-text" style="width: 100%; height: 300px; scroll: auto; overflow: auto;">
4054
 
4055
 
4056
            	</div>
4057
 
4058
       	</div>
4059
 
4060
            <!-- Modal footer -->
4061
      		<div class="modal-footer">
4062
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
4063
          	</div>
4064
         </div>
4065
	</div>
4066
</div>
4067
 
4068
 
4069
<!-- The Modal -->
4070
<div class="modal" id="company-microlearning-add-capsule-type-box">
4071
	<div class="modal-dialog ">
4072
    	<div class="modal-content">
4073
 
4074
            <!-- Modal Header -->
4075
      		<div class="modal-header">
6092 nelberth 4076
        		<h4 class="modal-title">LABEL_ADD_CAPSULE_SELECT_TYPE</h4>
1 www 4077
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
4078
      		</div>
4079
 
4080
            <!-- Modal body -->
4081
            <div class="modal-body">
4082
				<table style="width: 100%">
4083
					<tr>
4084
      					<td class="text-left" ><button type="button" class="btn btn-primary btn-add-text"> Texto </button></td>
4085
      					<td class="text-left" ><button type="button" class="btn btn-primary btn-add-image"> Imagén </button></td>
4086
      				</tr>
4087
      				<tr>
4088
						<td class="text-left" ><button type="button" class="btn btn-primary btn-add-video"> Video </button></td>
4089
						<td class="text-left" ><button type="button" class="btn btn-primary btn-add-audio"> Audio </button></td>
4090
					</tr>
4091
					<tr>
4092
						<td class="text-left" ><button type="button" class="btn btn-primary btn-add-document"> Documento </button></td>
4093
        				<td class="text-left" ><button type="button" class="btn btn-primary btn-add-quizz"> Cuestionario </button></td>
4094
        			</tr>
4095
                </table>
4096
      		</div>
4097
 
4098
            <!-- Modal footer -->
4099
      		<div class="modal-footer">
4100
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
4101
          	</div>
4102
         </div>
4103
	</div>
4104
</div>
4105
 
4106
 
4107
 
4108
 
4109