Proyectos de Subversion LeadersLinked - Backend

Rev

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