Proyectos de Subversion LeadersLinked - Backend

Rev

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