Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 6844 | Rev 7060 | 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;
6849 nelberth 1721
        blockCelda=true;
6113 nelberth 1722
		cinco=true;
1723
		xf=320,yf =480;
1724
		negritas=false, bold="";
1725
		shadow = true, nueve=true;
1726
		italic=false, ita="";
1727
		rectangulo=false, diez=false;
1728
     	fontfamily="Arial";
1729
     	r=0,g=0,b=0,a=1;
1730
		window.clearInterval(editorNoticia);
1731
		setTimeout(function(){
1732
			scroll_altura=$(".articulo_noticia").offset().top-110;
1733
			anchoFondoOscuro = $(".articulo_noticia").width();
1734
			altoFondoOscuro = $(".editor_imagenes").height();
1735
			$(".fondo_oscuro").css("width",""+anchoFondoOscuro+"px");
1736
			$(".fondo_oscuro").css("height",""+altoFondoOscuro+"px");
1737
 
6556 nelberth 1738
		},navegacion(nuevoHtmlImagen,campo,image));
6113 nelberth 1739
 
1740
		}
1741
 
1742
		$(document).on("click", ".volver", function(){
1743
		var nombre_user = $(".perfil_u_nombre").text();
1744
		var primer_nombre = nombre_user.split(" ")[0];
1745
		 cortar=false;
6849 nelberth 1746
         blockCelda=true;
6113 nelberth 1747
		cinco=true;
1748
		recorte_listo=false;
1749
		texto="";
1750
		seis=true;
1751
		color="#ffffff";
1752
		texto_listo=false,siete=false;
1753
		uno=true;
1754
		size=48;
1755
		xf=320,yf =480;
1756
		negritas=false, bold="";
1757
		shadow = true, nueve=true;
1758
		italic=false, ita="";
1759
		rectangulo=false, diez=false;
1760
     	fontfamily="Arial";
1761
     	r=0,g=0,b=0,a=1;
1762
		 var imagenServidorNoticia;
6585 nelberth 1763
         console.log(seleccionarCampo)
6113 nelberth 1764
		window.clearInterval(editorNoticia);
1765
		setTimeout(function(){
1766
			scroll_altura=$(".articulo_noticia").offset().top-110;
1767
			anchoFondoOscuro = $(".articulo_noticia").width();
1768
			altoFondoOscuro = $(".editor_imagenes").height();
1769
			$(".fondo_oscuro").css("width",""+anchoFondoOscuro+"px");
1770
			$(".fondo_oscuro").css("height",""+altoFondoOscuro+"px");
1771
 
6584 nelberth 1772
		},navegacion(nuevoHtmlImagen,seleccionarCampo));
6113 nelberth 1773
 
1774
		})
1775
 
6574 nelberth 1776
		function navegacion(nuevoHtmlImagen,campo,image='',reload=true){
6581 nelberth 1777
                selectorElementoName=campo.find('#name')
6577 nelberth 1778
 
1779
                selectorElementoEditor=campo.find('#contenido');
6113 nelberth 1780
 
6574 nelberth 1781
				if(image!=''){
6113 nelberth 1782
					const getBase64FromUrl = async (url) => {
1783
						const data = await fetch(url);
1784
						const blob = await data.blob();
1785
						return new Promise((resolve) => {
1786
							const reader = new FileReader();
1787
							reader.readAsDataURL(blob);
1788
							reader.onloadend = function() {
1789
							const base64data = reader.result;
1790
							resolve(base64data);
1791
							}
1792
						});
1793
					}
1794
 
1795
					getBase64FromUrl(image).then(function(e){
6581 nelberth 1796
						selectorElementoName.trigger('change');
6113 nelberth 1797
						$(".volver").css("display","block")
1798
						$(".a1").addClass("paso");
1799
						$(".titulo_pasos").html("LABEL_STEP_2");
1800
						setTimeout(function(){
1801
							recorte_listo=true;
1802
							$(".fondo_oscuro").css("display","none");
1803
							$("#boton_recortar").removeClass("recortar").text("LABEL_SEND").addClass("info_noticia").attr('type','submit');
1804
							$(".recortar10").removeClass("recortar");
1805
							$(".canvas").removeClass("recortar");
1806
							$(".b1").addClass("paso");
1807
							$(".titulo_pasos").html("LABEL_STEP_3");
1808
							if(texto!=""){
1809
								seis=true;
1810
								siete=true;
1811
							}
1812
							cinco=true;
1813
							dos=true;
1814
							cuatro=true;
1815
							actualizar();
1816
 
1817
						},editorNoticia(e));
1818
 
1819
 
1820
					})
1821
 
1822
					setTimeout(function(){
1823
						$(".canvas_subir").html('<span class="icon-plus fa fa-spinner"></span> Cargando...')
6581 nelberth 1824
						selectorElementoName.trigger('change');
6577 nelberth 1825
					},selectorElementoEditor.html(nuevoHtmlImagen));
6113 nelberth 1826
				}else{
1827
					setTimeout(function(){
6581 nelberth 1828
					    selectorElementoName.trigger('change');
6577 nelberth 1829
					},selectorElementoEditor.html(nuevoHtmlImagen));
6113 nelberth 1830
				}
6574 nelberth 1831
 
6113 nelberth 1832
		}
1833
 
1834
		$(window).on("scroll", function(){
1835
			console.log(scroll_altura)
1836
		if($(window).scrollTop()>scroll_altura){
1837
			$("#cuadro_noticias").addClass("fixed");
1838
		}else{
1839
			$("#cuadro_noticias").removeClass("fixed");
1840
		}
1841
	})
1842
 
1843
	$(document).on("dragover", "#imagen_noticia", function(e){
1844
		e.preventDefault();
1845
		e.stopPropagation();
1846
		$(this).css({"background":"rgba(0,0,0,.2)"})
1847
	})
1848
	$(document).on("drop", "#imagen_noticia", function(e){
1849
		e.preventDefault();
1850
		e.stopPropagation();
1851
		$(this).css("background", "none");
1852
		var archivo = e.originalEvent.dataTransfer.files;
1853
		var img=archivo[0];
1854
		if(img.type =="image/jpeg"||img.type =="image/png"){
1855
			$(".modificar").removeClass("animated");
1856
			var render = new FileReader();
1857
			render.readAsDataURL(img);
1858
			render.onload = function(e){
1859
				$(".volver").css("display","block")
1860
				$(".a1").addClass("paso");
1861
				$(".titulo_pasos").html("LABEL_STEP_2");
1862
				console.log(e.target.result)
1863
				editorNoticia(e.target.result)
1864
			}
1865
		}
1866
	})
1867
	$(document).on("dragover", "body", function(e){
1868
		e.preventDefault();
1869
		e.stopPropagation();
1870
	})
1871
	$(document).on("drop", "body", function(e){
1872
		e.preventDefault();
1873
		e.stopPropagation();
1874
	})
1875
 
1876
	var canvas='<div class="editorNoticia"><canvas id="editorNoticia">LABEL_NOT_SUPPORTED</canvas></div>';
1877
	$(document).on("mouseover", ".editorNoticia", function(){
1878
		$("body").css({"overflow": "hidden"});
1879
		$(".cuadro_noticias, .fixed_noticia,.tituloEditor,.grid-padre").css("margin-right", "17px")
1880
		$(".barra,.footer").css("padding-right","17px")
1881
 
1882
 
1883
	})
1884
	$(document).on("mouseover", "#editorNoticia", function(){
1885
		if(recorte_listo){
1886
			ocho=true;
1887
		}
1888
	})
1889
	$(document).on("mouseout", "#editorNoticia", function(){
1890
		if(recorte_listo){
1891
			ocho=false;
1892
			actualizar2()
1893
		}
1894
	})
1895
	$(document).on("mouseout", ".editorNoticia",function(){
1896
		$("body").css({"overflow": "auto"})
1897
		$(".cuadro_noticias, .fixed_noticia,.tituloEditor,.grid-padre").css("margin-right", "0px")
1898
		$(".barra,.footer").css("padding-right","0px")
1899
 
1900
	})
1901
	$(document).on('mousewheel', ".editorNoticia",function(e){
1902
		var ruedita = e.originalEvent.wheelDelta
1903
		if(ruedita>0){
1904
			scale = scale+(scale/10);
1905
			$("#porciento_scale").html((scale*100).toFixed(2)+"%")
1906
		}else{
1907
			scale = scale-(scale/10);
1908
			$("#porciento_scale").html((scale*100).toFixed(2)+"%")
1909
		}
1910
		$("#editorNoticia").css({"transform": "scale("+scale+")"});
1911
	})
1912
	$(document).on("click", ".as", function(e){
1913
		e.preventDefault();
1914
		 scale = $(this).data("scale");
1915
		 $("#porciento_scale").html((scale*100).toFixed(2)+"%")
1916
		 $("#editorNoticia").css({"transform": "scale("+scale+")"});
1917
 
1918
	})
1919
	$(document).on("click", ".ps", function(e){
1920
		e.preventDefault();
1921
		$(".cantidades_scale").slideToggle(200).css("display", "block");
1922
	})
1923
	$(document).on("click", "#cerrar_filter_modal, .icon_filter", function(e){
1924
		e.preventDefault();
1925
		if(recorte_listo){
1926
		$(".contenido_filter").slideToggle(200).css("display", "block");
1927
		}
1928
	})
1929
	$(document).on("click", "#cerrar_text_modal, .icon_text", function(e){
1930
		e.preventDefault();
1931
		if(recorte_listo){
1932
			$(".contenido_text").slideToggle(200).css("display", "block");
1933
		}
1934
	})
1935
 
1936
	$(document).on("click", "#cerrar_cut_modal, .icon_cut", function(e){
1937
		e.preventDefault();
1938
		if(cortar){
1939
			$(".contenido_cut").slideToggle(200).css("display", "block");
1940
		}
1941
 
1942
	})
1943
	$(document).on("click", "#menos_scale", function(e){
1944
		e.preventDefault();
1945
		scale = scale-(scale/10);
1946
		 $("#porciento_scale").html((scale*100).toFixed(2)+"%")
1947
		 $("#editorNoticia").css({"transform": "scale("+scale+")"});
1948
	})
1949
 
1950
	$(document).on("click", "#mas_scale", function(e){
1951
		e.preventDefault();
1952
		scale = scale+(scale/10);
1953
		 $("#porciento_scale").html((scale*100).toFixed(2)+"%")
1954
		 $("#editorNoticia").css({"transform": "scale("+scale+")"});
1955
	})
1956
	$(document).on("click", "#noche", function(){
1957
		$(".oa").removeClass("oa")
1958
		filter( .5,1.3,1.31,1.33,1.38);
1959
		$(this).addClass("oa")
1960
	})
1961
	$(document).on("click", "#sa", function(){
1962
		$(".oa").removeClass("oa")
1963
		filter( .7,1.1,1.64,1.66,1.50);
1964
		$(this).addClass("oa")
1965
	})
1966
	$(document).on("click", "#crema", function(){
1967
		$(".oa").removeClass("oa")
1968
		filter( .75,1,1.66,1.60,1.51);
1969
		$(this).addClass("oa")
1970
	})
1971
	$(document).on("click", "#setenta", function(){
1972
		$(".oa").removeClass("oa")
1973
		filter( .8,.75,1.60,1.66,1.58);
1974
		$(this).addClass("oa")
1975
	})
1976
	$(document).on("click", "#orange", function(){
1977
		$(".oa").removeClass("oa")
1978
		filter( .8,1,1.6,1.45,1.49);
1979
		$(this).addClass("oa")
1980
	})
1981
	$(document).on("click", "#relieve", function(){
1982
		$(".oa").removeClass("oa")
1983
		filter( .7,1.2,1.60,1.66,1.58);
1984
		$(this).addClass("oa")
1985
	})
1986
	$(document).on("click", "#bosque", function(){
1987
		$(".oa").removeClass("oa")
1988
		filter( .85,.75,1.47,1.66,1.54);
1989
		$(this).addClass("oa")
1990
	})
1991
	$(document).on("click", "#desierto", function(){
1992
		$(".oa").removeClass("oa")
1993
		filter( .8,.9,1.66,1.43,1.28);
1994
		$(this).addClass("oa")
1995
	})
1996
	$(document).on("click", "#villa", function(){
1997
		$(".oa").removeClass("oa")
1998
		filter( .8,.8,1.71,1.64,1.58);
1999
		$(this).addClass("oa")
2000
	})
2001
	$(document).on("click", "#magia", function(){
2002
		$(".oa").removeClass("oa")
2003
		filter( .7,1.2,1.49,1.49,1.6);
2004
		$(this).addClass("oa")
2005
	})
2006
	$(document).on("click", "#luz", function(){
2007
		$(".oa").removeClass("oa")
2008
		filter( .9,.9,1.45,1.54,1.54);
2009
		$(this).addClass("oa")
2010
	})
2011
	$(document).on("click", "#retoque", function(){
2012
		$(".oa").removeClass("oa")
2013
		filter( .9,1.3,1,1,1);
2014
		$(this).addClass("oa")
2015
	})
2016
	$(document).on("click", "#saturacion", function(){
2017
		$(".oa").removeClass("oa")
2018
		filter( 1,1.5,1,1,1);
2019
		$(this).addClass("oa")
2020
	})
2021
	$(document).on("click", "#rosa", function(){
2022
		$(".oa").removeClass("oa")
2023
		filter( .8,1.2,1.24,.99,1);
2024
		$(this).addClass("oa")
2025
	})
2026
	$(document).on("click", "#historia", function(){
2027
		$(".oa").removeClass("oa")
2028
		filter( .9,1.1,1.33,1.19,.91);
2029
		$(this).addClass("oa")
2030
	})
2031
	$(document).on("click", "#encantador", function(){
2032
		$(".oa").removeClass("oa")
2033
		filter( .9,1.2,26,-12,0,2);
2034
		$(this).addClass("oa")
2035
	})
2036
	$(document).on("click", "#emocion", function(){
2037
		$(".oa").removeClass("oa")
2038
		filter( 1.1,1.4,40,12,-6,2);
2039
		$(this).addClass("oa")
2040
	})
2041
	$(document).on("click", "#beige", function(){
2042
		$(".oa").removeClass("oa")
2043
		filter( .9,1.32,56,47,17,2);
2044
		$(this).addClass("oa")
2045
	})
2046
	$(document).on("click", "#fine", function(){
2047
		$(".oa").removeClass("oa")
2048
		filter( .87,1.19,55,37,23,2);
2049
		$(this).addClass("oa")
2050
	})
2051
	$(document).on("click", "#lord", function(){
2052
		$(".oa").removeClass("oa")
2053
		filter( 1.2,.9,67,13,-23,2);
2054
		$(this).addClass("oa")
2055
	})
2056
	$(document).on("click", "#70", function(){
2057
		$(".oa").removeClass("oa")
2058
		filter( 1.2,1.2,35,7,18,2);
2059
		$(this).addClass("oa")
2060
	})
2061
	$(document).on("click", "#arbol", function(){
2062
		$(".oa").removeClass("oa")
2063
		filter(.92,1.23,-11,11,11,2);
2064
		$(this).addClass("oa")
2065
	})
2066
	$(document).on("click", "#verano", function(){
2067
		$(".oa").removeClass("oa")
2068
		filter( 1,1.4,-3,-1,-12,2);
2069
		$(this).addClass("oa")
2070
	})
2071
	$(document).on("click", "#cf", function(){
2072
		$(".oa").removeClass("oa")
2073
		filter( .85,1.26,-15,2,-1,2);
2074
		$(this).addClass("oa")
2075
	})
2076
	$(document).on("click", "#angeles", function(){
2077
		$(".oa").removeClass("oa")
2078
		filter( 1,1.4,5,12,1,2);
2079
		$(this).addClass("oa")
2080
	})
2081
	$(document).on("click", "#caliente", function(){
2082
		$(".oa").removeClass("oa")
2083
		filter( .9,1.2,43,-17,-55,2);
2084
		$(this).addClass("oa")
2085
	})
2086
	$(document).on("click", "#otono", function(){
2087
		$(".oa").removeClass("oa")
2088
		filter( 1,1.29,29,26,17,2);
2089
		$(this).addClass("oa")
2090
	})
2091
	$(document).on("click", "#marzo", function(){
2092
		$(".oa").removeClass("oa")
2093
		filter( .85,1.3,43,25,-11,2);
2094
		$(this).addClass("oa")
2095
	})
2096
	$(document).on("click", "#pera", function(){
2097
		$(".oa").removeClass("oa")
2098
		filter( .8,1.25,31,41,12,2);
2099
		$(this).addClass("oa")
2100
	})
2101
	$(document).on("click", "#comun", function(){
2102
		$(".oa").removeClass("oa")
2103
		filter( 1,1.36,4,5,1,2);
2104
		$(this).addClass("oa")
2105
	})
2106
	$(document).on("click", "#oro", function(){
2107
		$(".oa").removeClass("oa")
2108
		filter( .9,1.3,37,-25,1,2);
2109
		$(this).addClass("oa")
2110
	})
2111
	$(document).on("click", "#gotico", function(){
2112
		$(".oa").removeClass("oa")
2113
		filter( 1.1,1.3,-47,-42,-30,2);
2114
		$(this).addClass("oa")
2115
	})
2116
	$(document).on("click", "#forestal", function(){
2117
		$(".oa").removeClass("oa")
2118
		filter( 1,1.4,-5,42,11,2);
2119
		$(this).addClass("oa")
2120
	})
2121
	$(document).on("click", "#luna", function(){
2122
		$(".oa").removeClass("oa")
2123
		filter( .9,1.2,-5,-7,4,2);
2124
		$(this).addClass("oa")
2125
	})
2126
	$(document).on("click", "#fiesta", function(){
2127
		$(".oa").removeClass("oa")
2128
		filter( 1.1,1.3,-1,-1,26,2);
2129
		$(this).addClass("oa")
2130
	})
2131
	$(document).on("click", "#gris", function(){
2132
		$(".oa").removeClass("oa")
2133
		filtergris(1,1)
2134
		$(this).addClass("oa")
2135
	})
2136
	$(document).on("click", "#lhs", function(){
2137
		$(".oa").removeClass("oa")
2138
		filtergris(.8,1.5);
2139
		$(this).addClass("oa")
2140
	})
2141
	$(document).on("click", "#normal", function(){
2142
		$(".oa").removeClass("oa")
2143
		$(this).addClass("oa")
2144
		filter();
2145
	})
2146
	var texto_listo=false,siete=false;
2147
	var texto;
2148
	$(document).on("keyup", "#texto_input", function(e){
2149
		e.preventDefault();
2150
		texto = $(this).val();
2151
		if(texto_actualizar){
2152
			siete=true;
2153
		}
2154
		if(texto!=""){
2155
			texto_actualizar=true;
2156
			actualizar2();
2157
		}else{
2158
			actualizar2();
2159
		}
2160
 
2161
	})
2162
	var color="#ffffff";
2163
	$(document).on("change", "#color", function(){
2164
    	color=$(this).val();
2165
    	seis=true;
2166
    	actualizar2();
2167
    })
2168
    var size=48;
2169
    $(document).on("keyup change", "#font-size", function(){
2170
    	size=$(this).val();
2171
    	size = parseInt(size);
2172
    	seis=true;
2173
    	siete=true;
2174
    	actualizar2();
2175
    })
2176
    var negritas=false, bold="";
2177
    $(document).on("click", "#negritas", function(e){
2178
    	e.preventDefault();
2179
    	if(!negritas){
2180
    		bold="bold";
2181
    		$(this).addClass("fa");
2182
    		seis=true;
2183
    		siete=true;
2184
    		actualizar2();
2185
    		negritas=true;
2186
    	}else{
2187
    		bold="";
2188
    		$(this).removeClass("fa");
2189
    		seis=true;
2190
    		siete=true;
2191
    		actualizar2();
2192
    		negritas=false;
2193
    	}
2194
    })
2195
    var italic=false, ita="";
2196
     $(document).on("click", "#italic", function(e){
2197
    	e.preventDefault();
2198
    	if(!italic){
2199
    		ita="italic";
2200
    		$(this).addClass("fa");
2201
    		seis=true;
2202
    		siete=true;
2203
    		actualizar2();
2204
    		italic=true;
2205
    	}else{
2206
    		ita="";
2207
    		$(this).removeClass("fa");
2208
    		seis=true;
2209
    		siete=true;
2210
    		actualizar2();
2211
    		italic=false;
2212
    	}
2213
    })
2214
     var fontfamily="Arial";
2215
     $(document).on("click", ".fs", function(e){
2216
    	e.preventDefault();
2217
    	$(".at").removeClass("at");
2218
    	$(this).addClass("at");
2219
    	fontfamily= $(this).text();
2220
    	seis=true;
2221
    	siete=true;
2222
    	actualizar2();
2223
 
2224
    })
2225
     var shadow = true, nueve=true;
2226
     $(document).on("click","#shadow", function(e){
2227
     	e.preventDefault();
2228
     	if(shadow){
2229
     		$(this).removeClass("fa");
2230
     		seis=true;
2231
     		nueve=false;
2232
     		actualizar2();
2233
     		shadow=false;
2234
     	}else{
2235
     		$(this).addClass("fa");
2236
     		seis=true;
2237
     		nueve=true;
2238
     		actualizar2();
2239
     		shadow=true;
2240
     	}
2241
 
2242
     })
2243
     var rectangulo=false, diez=false, colorrect="#000000";
2244
     $(document).on("click", "#rectangulo", function(e){
2245
     	e.preventDefault();
2246
     	if(!rectangulo){
2247
     		$(this).addClass("fa");
2248
     		diez=true;
2249
     		actualizar2();
2250
     		rectangulo=true;
2251
     	}else{
2252
     		$(this).removeClass("fa");
2253
     		diez=false;
2254
     		actualizar2();
2255
     		rectangulo=false;
2256
     	}
2257
 
2258
     })
2259
     var r=0,g=0,b=0;
2260
    $(document).on("change", "#colorrect", function(){
2261
    	colorrect=$(this).val();
2262
    	r=parseInt(colorrect.slice(1,3),16);
2263
    	g=parseInt(colorrect.slice(3,5),16);
2264
    	b=parseInt(colorrect.slice(5,7),16);
2265
    	seis=true;
2266
    	actualizar2();
2267
    })
2268
    var a=1;
2269
 
2270
    $(document).on("keyup change", "#opacidad", function(){
2271
    	a=$(this).val();
2272
    	a=a/100;
2273
    	seis=true;
2274
    	actualizar2();
2275
    })
2276
	var imaNoti = new Image();
2277
	function filter(brillo=1, contraste=1, rojo=1, verde=1, azul=1, valor=1){
2278
		cuatro=false;
2279
		restaurar(brillo, contraste);
2280
		datos=imagenOriginal.data;
2281
		if(valor==2){
2282
			for (var i =  0; i <datos.length; i+=4) {
2283
				datos[i]=datos[i]+rojo;
2284
				datos[i+1]=datos[i+1]+verde;
2285
				datos[i+2]=datos[i+2]+azul;
2286
			}
2287
		}else{
2288
			for (var i =  0; i <datos.length; i+=4) {
2289
				datos[i]=datos[i]*rojo;
2290
				datos[i+1]=datos[i+1]*verde;
2291
				datos[i+2]=datos[i+2]*azul
2292
			}
2293
		}
2294
		editor.putImageData(imagenOriginal,0,0)
2295
		var imagenNoticia = elemento.toDataURL("image/jpeg", 1.0);
2296
	    imaNoti.src = imagenNoticia;
2297
		actualizar2();
2298
	}
2299
	function filtergris(brillo=1, contraste=1){
2300
		cuatro=false;
2301
		restaurar(brillo, contraste);
2302
		datos=imagenOriginal.data;
2303
		var auxiliar;
2304
		for (var i =  0; i <datos.length; i+=4) {
2305
			auxiliar = 0.34 * datos[i] + 0.5 *datos[i+1] + 0.16 * datos[i+2];
2306
			datos[i]=auxiliar;
2307
			datos[i+1]=auxiliar;
2308
			datos[i+2]=auxiliar;
2309
		}
2310
 
2311
		editor.putImageData(imagenOriginal,0,0)
2312
		var imagenNoticia = elemento.toDataURL("image/jpeg", 1.0);
2313
	    imaNoti.src = imagenNoticia;
2314
		actualizar2();
2315
	}
2316
	function restaurar(brillo = 1, contraste=1){
2317
		editor.filter = "none"
2318
		editor.filter = 'contrast('+contraste+') brightness('+brillo+') saturate(1) sepia(0)';
2319
		editor.fillStyle="rgba(255,255,255,1)"
2320
		editor.fillRect(0,0,ancho,alto);
2321
		editor.fillStyle=""+color+"";
2322
		var pxf=0,pyf=0;
2323
			if(xf>=(yf/recorte)){
2324
				pxf=xf/ancho;
2325
				pyf=yf/pxf;
2326
				py=(alto/2)-(pyf/2);
2327
				editor.drawImage(imagen,x,y,xf,yf,0,py,ancho,pyf);
2328
			}else{
2329
				pyf=yf/alto;
2330
				pxf=xf/pyf;
2331
				px=(ancho/2)-(pxf/2);
2332
				editor.drawImage(imagen,x,y,xf,yf,px,0,pxf,alto);
2333
			}
2334
		imagenOriginal = editor.getImageData(0,0,ancho,alto)
2335
	}
2336
	var ocho=false;
2337
	function actualizar2(){
2338
		if(recorte_listo){
2339
		if(cuatro){
2340
			imagenOriginal = editor.getImageData(0,0,ancho,alto)
2341
			var imagenNoticia = elemento.toDataURL("image/jpeg", 1.0);
2342
	    	imaNoti.src = imagenNoticia;
2343
	    	cuatro=false;
2344
		}
2345
		editor.filter = "none"
2346
		$(imaNoti).ready(function(e){
2347
			noticia.drawImage(imaNoti,0,0,320,480);
2348
			editor.drawImage(imaNoti,0,0,ancho,alto)
2349
			if(texto_actualizar){
2350
				if(texto!=""){
2351
					if(seis){
2352
						ancho_imaNoti = imaNoti.width;
2353
 
2354
						scale_noticia = -(((ancho_imaNoti-320)/ancho_imaNoti)-1);
2355
						editor.fillStyle=""+color+"";
2356
						editor.strokeStyle="rgb(255,255,255)";
2357
						if(nueve){
2358
							editor.shadowColor="rgba(0,0,0,.5)";
2359
							editor.shadowOffsetX=6;
2360
							editor.shadowOffsetY=6;
2361
							editor.shadowBlur=6;
2362
							noticia.shadowColor="rgba(0,0,0,.5)";
2363
							noticia.shadowOffsetX=6*scale_noticia;
2364
							noticia.shadowOffsetY=6*scale_noticia;
2365
							noticia.shadowBlur=6*scale_noticia;
2366
						}else{
2367
							editor.shadowColor="rgba(0,0,0,0)";
2368
							noticia.shadowColor="rgba(0,0,0,0)";
2369
						}
2370
						editor.font=""+ita+" "+bold+" "+size+"px "+fontfamily+"";
2371
						editor.textAlign="start";
2372
						editor.textBaseline="top";
2373
 
2374
						var sizeNoticia = size*scale_noticia;
2375
						noticia.fillStyle=""+color+"";
2376
						noticia.font=""+ita+" "+bold+" "+sizeNoticia+"px "+fontfamily+"";
2377
						noticia.textAlign="start";
2378
						noticia.textBaseline="top";
2379
						seis=false;
2380
					}
2381
					if(siete){
2382
						dimencionesTexto = editor.measureText(texto);
2383
						txf=dimencionesTexto.width+20;
2384
						tyf= (20+size);
2385
						siete=false;
2386
					}
2387
					if(cinco){
2388
						dimencionesTexto = editor.measureText(texto);
2389
						if(xf>=(yf/recorte)){
2390
							tx=(xf/2)-(dimencionesTexto.width/2);
2391
							ty=(xf*recorte/2)-(size/2);
2392
						}else{
2393
							tx=(yf/recorte/2)-(dimencionesTexto.width/2);
2394
							ty=(yf/2)-(size/2);
2395
						}
2396
 
2397
						txf=dimencionesTexto.width+20;
2398
						tyf= size+20;
2399
						cinco=false;
2400
					}
2401
					if(diez){
2402
						editor.fillStyle="rgba("+r+","+g+","+b+","+a+")";
2403
						noticia.fillStyle="rgba("+r+","+g+","+b+","+a+")";
2404
						editor.fillRect(tx-10,ty-10,txf,tyf);
2405
						noticia.fillRect(((tx-10)*scale_noticia),((ty-10)*scale_noticia),txf*scale_noticia,tyf*scale_noticia);
2406
						editor.fillStyle=""+color+"";
2407
						noticia.fillStyle=""+color+"";
2408
 
2409
					}
2410
					editor.fillText(texto,tx,ty);
2411
					noticia.fillText(texto,(tx*scale_noticia),ty*scale_noticia);
2412
					if(ocho){
2413
						editor.strokeRect(tx-10,ty-10,txf,tyf)
2414
						editor.arc(tx+txf,ty+tyf,10,0,Math.PI*2,false);
2415
						editor.fill();
2416
						editor.beginPath();
2417
					}
2418
					texto_listo=true;
2419
				}
2420
			}
2421
		})
2422
 
2423
	}
2424
	}
2425
	function actualizar(){
2426
			$(imagen).ready(function(e){
2427
				if(uno){
2428
					ancho=imagen.width, alto = imagen.height;
2429
					elemento.width = ancho;
2430
					elemento.height = alto;
2431
					$(".scale").css("display","flex");
2432
					mitadX=ancho/2;
2433
					mitadY=alto/2;
2434
					x=mitadX-xf/2;
2435
					y=mitadY-yf/2;
2436
					if(ancho<=alto){
2437
					 scale = -(((alto-450)/alto)-1);
2438
 
2439
					}else{
2440
					 scale = -(((ancho-500)/ancho)-1);
2441
					}
2442
					$("#porciento_scale").html((scale*100).toFixed(2)+"%")
2443
					$("#ancho").html(ancho+"px");
2444
					$("#alto").html(alto+"px");
2445
					uno=false;
2446
				}
2447
				if(dos){
2448
 
2449
					if(xf>=(yf/recorte)){
2450
						alto=xf*recorte;
2451
						ancho=xf;
2452
					}else{
2453
						ancho=yf/recorte;
2454
						alto=yf;
2455
 
2456
					}
2457
					elemento.width = ancho;
2458
					elemento.height = alto;
2459
					if(xf<=yf){
2460
					 scale = -(((yf-450)/yf)-1);
2461
 
2462
					}else{
2463
					 scale = -(((xf-500)/xf)-1);
2464
					}
2465
 
2466
					$("#porciento_scale").html((scale*100).toFixed(2)+"%")
2467
					$("#ancho").html(Math.round(xf)+"px");
2468
					$("#alto").html(Math.round(yf)+"px");
2469
					dos=false;
2470
				}
2471
 
2472
					var pxf=0,pyf=0;
2473
					noticia.fillStyle="rgba(255,255,255,1)"
2474
					noticia.fillRect(0,0,320,480);
2475
				if(xf>=(yf/recorte)){
2476
					pxf=xf/320;
2477
					pyf=yf/pxf;
2478
					py=(480/2)-(pyf/2);
2479
					noticia.drawImage(imagen,x,y,xf,yf,0,py,320,pyf);
2480
				}else{
2481
					pyf=yf/480;
2482
					pxf=xf/pyf;
2483
					px=(320/2)-(pxf/2);
2484
					noticia.drawImage(imagen,x,y,xf,yf,px,0,pxf,480);
2485
				}
2486
 
2487
				$("#editorNoticia").css({"transform": "scale("+scale+")"});
2488
				if(!recorte_listo){
2489
					editor.drawImage(imagen,0,0,ancho,alto);
2490
					editor.fillStyle="rgba(0,0,0,.2)"
2491
					editor.fillRect(0,0,ancho,alto);
2492
					editor.fillStyle="rgba(255,255,255,.1)"
2493
					editor.fillRect(x,y,xf,yf);
2494
					editor.fillStyle="rgba(255,255,255,.5)"
2495
					editor.fillRect(x,y,16,16);
2496
					editor.fillRect((x+xf)-16,y,16,16);
2497
					editor.fillRect(x,y+yf-16,16,16);
2498
					editor.fillRect(x+xf-16,yf+y-16,16,16);
2499
					esta=true;
2500
				}else{
2501
					var pxf=0,pyf=0;
2502
 
2503
					editor.fillStyle="rgba(255,255,255,1)"
2504
					editor.fillRect(0,0,ancho,alto);
2505
					if(xf>=(yf/recorte)){
2506
						pxf=xf/ancho;
2507
						pyf=yf/pxf;
2508
						py=(alto/2)-(pyf/2);
2509
						editor.drawImage(imagen,x,y,xf,yf,0,py,ancho,pyf);
2510
					}else{
2511
						pyf=yf/alto;
2512
						pxf=xf/pyf;
2513
						px=(ancho/2)-(pxf/2);
2514
						editor.drawImage(imagen,x,y,xf,yf,px,0,pxf,alto);
2515
				}
2516
 
2517
				}
2518
			})
2519
		}
2520
	var imagenOriginal;
2521
	var x,y,xf=320,yf =480, elemento,editor,centro, total,scale,dimencionesTexto,ancho_imaNoti,
2522
	recorte_listo=false,alto,ancho,tx,ty,txf,tyf,cuatro=true,texto_actualizar=false,cinco=true,seis=true,cuatro;
2523
	var  mitadY,mitadX, uno=true,dos=false, recorte=480/320, imagen_noticias, scale_noticia, tres=true,rotar=false, cortar=false;;
2524
	var translateX;
2525
 
2526
	$(document).on("click", ".recortar10", function(e){
2527
 
2528
		e.preventDefault();
2529
		recorte_listo=false;
2530
		uno=true;
2531
		$(".fondo_oscuro").css("display","block");
2532
		$("#boton_recortar").addClass("recortar").text("Recortar").removeClass("info_noticia");
2533
		$("#boton_recortar3").addClass("recortar").text("Recortar").removeClass("info_noticia3");
2534
		$(".contenido_text").css("display", "none");
2535
		$(".contenido_filter").css("display", "none");
2536
		$(".recortar10").addClass("recortar");
2537
		$(".canvas").addClass("recortar")
2538
		$(".oa").removeClass("oa");
2539
		$("#normal").addClass("oa");
2540
		$(".b1").removeClass("paso");
2541
		$(".titulo_pasos").html("LABEL_STEP_2");
2542
		window.clearInterval(actualizar2);
2543
		actualizar();
2544
 
2545
	})
2546
 
2547
 
2548
	blockCelda=true;
2549
	$(document).on("click", "#blockCelda", function(e){
2550
		e.preventDefault();
2551
		if(blockCelda){
2552
			$(this).html('<span class="fa fa-unlock"></span>')
2553
 
2554
			blockCelda=false;
2555
		}else{
2556
			$(this).html('<span class="fa fa-lock"></span>')
2557
			blockCelda=true;
2558
		}
2559
		t4=true;
2560
 
2561
	})
2562
	var imagen
2563
	function editorNoticia(img){
2564
		 cortar=true;
2565
		imagen= new Image();
2566
		$(".canvas").html(canvas);
2567
		elemento = document.getElementById("editorNoticia");
2568
		editor = elemento.getContext("2d");
2569
		elemento2 = document.getElementById("imagen_noticias");
2570
		noticia = elemento2.getContext("2d");
2571
 
2572
		$(document).on("click", ".boton_marino.recortar",function(e){
2573
			e.preventDefault();
2574
			recorte_listo=true;
2575
			$(".fondo_oscuro").css("display","none");
2576
			$("#boton_recortar").removeClass("recortar").text("LABEL_SEND").addClass("info_noticia").attr('type','submit');
2577
			$(".recortar10").removeClass("recortar");
2578
			$(".canvas").removeClass("recortar");
2579
			$(".b1").addClass("paso");
2580
			$(".titulo_pasos").html("LABEL_STEP_3");
2581
			if(texto!=""){
2582
				seis=true;
2583
				siete=true;
2584
			}
2585
			cinco=true;
2586
			dos=true;
2587
			cuatro=true;
2588
			actualizar();
2589
		})
2590
 
2591
		var cli = false, t1= false, t2=false,t3=false,t4=false,tcli=false;
2592
		var mouse =[];
2593
 
2594
 
2595
		function raton(elemento, e){
2596
			return {
2597
				x:((e.pageX - elemento.offsetLeft - ((ancho/2)-((ancho*scale)/2)))/scale),
2598
				y:((e.pageY - elemento.offsetTop - ((alto/2)-((alto*scale)/2)))/scale)
2599
			}
2600
		}
2601
 
2602
		imagen.src=img;
2603
		$(".recortar10").addClass("recortar");
2604
		$("#boton_recortar").removeClass("boton_normal").addClass("recortar boton_marino").text("LABEL_CUT")
2605
		actualizar();
2606
 
2607
		$(elemento).mousemove(function(e){
2608
			mouse = raton(this, e);
2609
			//console.log("raton x: "+mouse.x+ " raton Y: " +mouse.y+ " tx: "+tx+" ty: "+ty+" txf:"+(txf+tx)+" tyf:"+(tyf+ty) )
2610
			if(!recorte_listo){
2611
				if(x+16<mouse.x &&(xf+x-16)>mouse.x && y+16<mouse.y && (y+yf-16)>mouse.y){
2612
			 		$(elemento).css("cursor","move");
2613
			 	}else if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && (y+yf-16)<mouse.y && (y+yf)>mouse.y){
2614
			 		$(elemento).css("cursor","nw-resize");
2615
			 	}else if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
2616
			 		$(elemento).css("cursor","ne-resize");
2617
			 	}else if(x<mouse.x &&(16+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
2618
			 		$(elemento).css("cursor","se-resize");
2619
			 	}else if(x<mouse.x &&(16+x)>mouse.x && (y+yf-16)<mouse.y &&(y+yf)>mouse.y){
2620
			 		$(elemento).css("cursor","sw-resize");
2621
			 	}else{
2622
			 		$(elemento).css("cursor","default");
2623
			 	}
2624
			}else if(texto_listo){
2625
				if(tx-10<mouse.x && tx-10+txf>mouse.x && ty-10<mouse.y && ty-10+tyf>mouse.y){
2626
			 		$(elemento).css("cursor","move");
2627
			 	}else if((txf+tx-10)<mouse.x &&(txf+tx-10+20)>mouse.x && (ty-10+tyf)<mouse.y && (ty-10+tyf+20)>mouse.y){
2628
			 		$(elemento).css("cursor","pointer");
2629
			 	}else{
2630
			 		$(elemento).css("cursor","default");
2631
			 	}
2632
			}
2633
			else{
2634
				$(elemento).css("cursor","default");
2635
			}
2636
		})
2637
		$(elemento).mousedown(function(e){
2638
			mouse = raton(this, e);
2639
			if(!recorte_listo){
2640
				if(x+16<mouse.x &&(xf+x-16)>mouse.x && y+16<mouse.y && (y+yf-16)>mouse.y){
2641
			 		cli = true;
2642
			 	}
2643
			 	if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && (y+yf-16)<mouse.y && (y+yf)>mouse.y){
2644
			 		t4 = true;
2645
			 	}
2646
				if((xf+x-16)<mouse.x &&(xf+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
2647
			 		t3 = true;
2648
			 	}
2649
			 	if(x<mouse.x &&(16+x)>mouse.x && y<mouse.y && (y+16)>mouse.y){
2650
			 		t1 = true;
2651
			 	}
2652
			 	if(x<mouse.x &&(16+x)>mouse.x && (y+yf-16)<mouse.y &&(y+yf)>mouse.y){
2653
			 		t2 = true;
2654
			 	}
2655
			}else if(texto_listo){
2656
				if(tx-10<mouse.x && tx-10+txf>mouse.x && ty-10<mouse.y && ty-10+tyf>mouse.y){
2657
			 		tcli=true;
2658
			 	}else if((txf+tx-10)<mouse.x &&(txf+tx-10+20)>mouse.x && (ty-10+tyf)<mouse.y && (ty-10+tyf+20)>mouse.y){
2659
			 		rotar=true;
2660
			 	}
2661
			}
2662
 
2663
		 })
2664
 
2665
		 $(elemento).mousemove(function(e){
2666
		 	mouse = raton(this, e);
2667
		 	if(!recorte_listo){
2668
			 	if(cli){
2669
			 		if((mouse.y-(yf/2))>=0&&(mouse.y+(yf/2))<=alto){
2670
				 		y = (mouse.y-(yf/2));
2671
			 		}else{
2672
			 			if((mouse.y-(yf/2))<0){
2673
			 				y=0;
2674
			 			}
2675
			 			if((mouse.y+(yf/2))>alto){
2676
			 				y=alto-yf;
2677
			 			}
2678
			 		}
2679
			 		if((mouse.x-(xf/2))>=0&&(mouse.x+(xf/2))<=ancho){
2680
			 			x = (mouse.x-(xf/2));
2681
			 		}else{
2682
			 			if((mouse.x-(xf/2))<0){
2683
			 				x=0;
2684
			 			}
2685
			 			if((mouse.x+(xf/2))>ancho){
2686
			 				x=(ancho)-xf;
2687
			 			}
2688
			 		}
2689
			 	}
2690
				if(blockCelda){
2691
			 	if(t4){
2692
			 		if(mouse.y<(alto-10)&&(x+xf)<=(ancho)){
2693
				 		if(Math.round(xf)>=50){
2694
							if(((mouse.y-y)/recorte)>50){
2695
				 				yf=mouse.y-y;
2696
				 				xf=(yf/recorte);
2697
				 			}
2698
						}
2699
			 		}else{
2700
			 			if(mouse.y>=(alto-10)){
2701
			 				yf=alto-y;
2702
				 			xf=(yf/recorte);
2703
				 			t4=false;
2704
			 			}
2705
			 			if(x+xf>(ancho)){
2706
			 				xf=(ancho)-x;
2707
				 			yf=(xf*recorte);
2708
				 			t4=false;
2709
			 			}
2710
			 		}
2711
			 	}
2712
			 	if(t3){
2713
			 		if(mouse.y>0&&(x+xf)<=(ancho)){
2714
				 		if(Math.round(xf)>=50){
2715
							if(((yf+(y-mouse.y))/recorte)>50){
2716
					 			yf=yf+(y-mouse.y);
2717
					 			xf=(yf/recorte);
2718
					 			y=mouse.y;
2719
				 			}
2720
				 		}
2721
 
2722
			 		}else{
2723
			 			if(mouse.y<=0) {
2724
			 				yf=yf+(y-mouse.y);
2725
				 			xf=(yf/recorte);
2726
			 				y=0;
2727
			 				t3=false;
2728
			 			}
2729
			 			if(x+xf>(ancho)){
2730
			 				xf=(ancho)-x;
2731
				 			yf=xf*recorte;
2732
				 			t3=false;
2733
			 			}
2734
			 		}
2735
			 	}
2736
			 	if(t2){
2737
			 		if(mouse.y<(alto-10)&&x>=0){
2738
				 		if(Math.round(xf)>=50){
2739
							if(((mouse.y-y)/recorte)>50){
2740
					 			x=(x+(yf-(mouse.y-y))/recorte);
2741
					 			yf=mouse.y-y;
2742
					 			xf=(yf/recorte);
2743
				 			}
2744
					 	}
2745
 
2746
			 		}else{
2747
			 			if(mouse.y>=(alto-10)) {
2748
			 				yf=alto-y;
2749
				 			xf=(yf/recorte);
2750
				 			t2=false;
2751
			 			}
2752
			 			if(0>x){
2753
			 				x=0;
2754
			 				xf=mouse.y-y;
2755
				 			yf=(xf*recorte);
2756
				 			t2=false;
2757
			 			}
2758
			 		}
2759
			 	}
2760
			 	if(t1){
2761
			 		if(mouse.y>0&&x>=0){
2762
				 		if(Math.round(xf)>=50){
2763
							if(((yf+(y-mouse.y))/recorte)>50){
2764
								yf=yf+(y-mouse.y);
2765
					 			xf=(yf/recorte);
2766
					 			x=(x-(y-mouse.y)/recorte);
2767
					 			y=mouse.y;
2768
							}
2769
				 		}
2770
			 		}else{
2771
			 			if(mouse.y<=0) {
2772
			 				yf=yf+(y-mouse.y);
2773
				 			xf=(yf/recorte);
2774
			 				y=0;
2775
			 				t1=false;
2776
			 			}
2777
			 			if(0>x){
2778
			 				x=0;
2779
			 				xf=yf+(y-mouse.y);
2780
				 			yf=(xf*recorte);
2781
				 			t1=false;
2782
			 			}
2783
			 		}
2784
			 	}
2785
				}else{
2786
				 if(t4){
2787
			 		if(mouse.y<(alto-10-(2/scale))&&mouse.x<=(ancho-(2/scale))){
2788
 
2789
							if((mouse.y-y)>50){
2790
				 				yf=mouse.y-y;
2791
				 			}
2792
							if((mouse.x-x)>50){
2793
								xf=mouse.x-x;
2794
							}
2795
 
2796
			 		}else{
2797
			 			if(mouse.y>=(alto-10-(2/scale))){
2798
			 				yf=alto-y;
2799
			 			}
2800
			 			if(mouse.x>(ancho-(2/scale))){
2801
			 				xf=(ancho)-x;
2802
			 			}
2803
						 t4=false;
2804
			 		}
2805
			 	}
2806
			 	if(t3){
2807
			 		if(mouse.y>(2/scale)&&mouse.x<=(ancho-(2/scale))){
2808
 
2809
							if((yf-(mouse.y-y))>50){
2810
				 				yf=yf-(mouse.y-y);
2811
								y=mouse.y;
2812
				 			}
2813
							if((mouse.x-x)>50){
2814
								xf=mouse.x-x;
2815
							}
2816
 
2817
 
2818
			 		}else{
2819
						if(mouse.x>(ancho-(2/scale))){
2820
							xf=ancho-x;
2821
						}
2822
						if(mouse.y<=(2/scale)){
2823
							yf=yf-(mouse.y-y);
2824
							y=0;
2825
						}
2826
			 			t3=false;
2827
			 		}
2828
			 	}
2829
				/* Izquierda abajo */
2830
			 	if(t2){
2831
			 		if(mouse.y<(alto-10-(2/scale))&&mouse.x>=(2/scale)){
2832
							 if((mouse.y-y)>50){
2833
								yf=mouse.y-y;
2834
				 			}
2835
							if((xf-(mouse.x-x))>50){
2836
								xf=xf-(mouse.x-x);
2837
								x=mouse.x
2838
							}
2839
 
2840
			 		}else{
2841
			 			if(mouse.y>=(alto-10-(2/scale))) {
2842
							yf=alto-y;
2843
			 			}
2844
 
2845
			 			if(mouse.x<(2/scale)){
2846
							xf=xf-(mouse.x-x);
2847
			 				x=0;
2848
			 			}
2849
						 t2=false;
2850
			 		}
2851
			 	}
2852
				/* izquierda arriba */
2853
			 	if(t1){
2854
			 		if(mouse.y>(2/scale)&&mouse.x>=(2/scale)){
2855
 
2856
							if((yf-(mouse.y-y))>50){
2857
				 				yf=yf-(mouse.y-y);
2858
								y=mouse.y;
2859
				 			}
2860
							if((xf-(mouse.x-x))>50){
2861
								xf=xf-(mouse.x-x);
2862
								x=mouse.x
2863
							}
2864
 
2865
			 		}else{
2866
						if(mouse.y<=(2/scale)){
2867
							yf=yf-(mouse.y-y);
2868
							y=0;
2869
						}
2870
						 if(mouse.x<(2/scale)){
2871
							xf=xf-(mouse.x-x);
2872
			 				x=0;
2873
 
2874
			 			}
2875
						 t1=false;
2876
			 		}
2877
			 	}
2878
			}
2879
 
2880
		 	actualizar();
2881
		 	}else if(texto_listo){
2882
		 		if(tcli){
2883
		 			tx=mouse.x-(txf/2)
2884
		 			ty=mouse.y-(tyf/2)
2885
		 		}else if(rotar){
2886
 
2887
		 		}
2888
 
2889
		 		actualizar2();
2890
		 	}
2891
		 })
2892
		 $(elemento).mouseup(function(e){
2893
		 	if(!recorte_listo){
2894
			 	cli=false;
2895
			 	t1=false;
2896
			 	t2=false;
2897
			 	t3=false;
2898
			 	t4=false;
2899
		 	}else if (texto_listo) {
2900
		 		tcli=false;
2901
		 	}
2902
		 })
2903
 
2904
 
2905
	}
2906
	/* Titulo */
2907
 
2908
var titulo_noticia, censor_titulo = true, numero_titulo=0;
2909
	$(document).on("keyup change", "#name", function(e){
2910
	console.log(numero_titulo)
2911
	titulo_noticia = $(this).val();
2912
	titulo_elemento= $(".titulo_topico");
2913
	if(titulo_noticia!=""){
2914
		if(censor_titulo){
2915
			titulo_elemento.html(titulo_noticia);
2916
			if(titulo_elemento.height()>38){
2917
				var titulo_noticia2 = "";
2918
				for(var i =0; i <titulo_noticia.length;i++){
2919
					titulo_noticia2 = titulo_noticia2 + titulo_noticia.split("")[i];
2920
					titulo_elemento.html(titulo_noticia2);
2921
					if(titulo_elemento.height()>38){
2922
						titulo_noticia2 = titulo_noticia2.slice(0,-5) + "...";
2923
						titulo_elemento.html(titulo_noticia2);
2924
						numero_titulo = titulo_noticia2.length;
2925
						censor_titulo=false;
2926
						break;
2927
					}
2928
 
2929
				}
2930
			}else{
2931
				numero_titulo=0;
2932
			}
2933
		}else{
2934
			if(numero_titulo+1>=titulo_noticia.length){
2935
				titulo_elemento.html(titulo_noticia);
2936
				censor_titulo=true;
2937
			}
2938
		}
2939
	}else{
6675 nelberth 2940
		titulo_elemento.html("LABEL_TITLE");
6113 nelberth 2941
		censor_titulo = true;
2942
	}
2943
})
2944
 
1 www 2945
});
2946
JS;
2947
$this->inlineScript()->captureEnd();
2948
?>
2949
 
2950
 
2951
<!-- Content Header (Page header) -->
2952
<section class="content-header">
2953
	<div class="container-fluid">
2954
    	<div class="row mb-2">
2955
        	<div class="col-sm-12">
2956
            	<h1>LABEL_SLIDES</h1>
2957
			</div>
2958
		</div>
2959
	</div><!-- /.container-fluid -->
2960
</section>
2961
 
6122 nelberth 2962
<section class="content" id='content1'>
1 www 2963
	<div class="container-fluid">
2964
    	<div class="row">
2965
        	<div class="col-12">
2966
				<div class="card">
2967
					<div class="card-header">
2968
						<?php
2969
                        $form = $this->form;
2970
            	        $form->setAttributes([
2971
                            'name'    => 'form-filter',
2972
                            'id'      => 'form-filter',
2973
                        ]);
2974
 
2975
                        $form->prepare();
2976
                        echo $this->form()->openTag($form);
2977
                        ?>
2978
                        <div class="row">
2979
                            <div class="col-md-6 col-sm-12">
2980
                                <div class="form-group">
2981
                                    <?php
2982
                                        $element = $form->get('topic_uuid');
2983
 
2984
                                        $element->setOptions(['label' => 'LABEL_TOPIC']);
2985
 
2986
                                        $element->setAttributes(['class' => 'form-control']);
2987
                                        echo $this->formLabel($element);
2988
                                        echo $this->formSelect($element);
2989
                                    ?>
2990
                                </div>
2991
                            </div>
2992
                            <div class="col-md-6 col-sm-12">
2993
                                <div class="form-group">
2994
                                    <?php
2995
                                        $element = $form->get('capsule_uuid');
2996
                                        $element->setOptions(['label' => 'LABEL_CAPSULE']);
2997
                                        $element->setAttributes(['class' => 'form-control']);
2998
                                        echo $this->formLabel($element);
2999
                                        echo $this->formSelect($element);
3000
                                    ?>
3001
                                </div>
3002
                            </div>
3003
                        </div>
3004
						<?php echo $this->form()->closeTag($form); ?>
3005
					</div>
3006
					<div class="card-body">
20 steven 3007
        	    		<table id="gridTable" class="table   table-hover">
1 www 3008
                      		<thead>
3009
        						<tr>
3010
                                	<th>LABEL_NAME</th>
3011
                                  	<th>LABEL_DETAILS</th>
3012
                                  	<th>LABEL_MEDIA</th>
3013
                                  	<th>LABEL_ACTIONS</th>
3014
                                </tr>
3015
                       		</thead>
3016
                         	<tbody>
3017
                         	</tbody>
3018
                    	</table>
3019
                   	</div>
3020
                   	<div class="card-footer clearfix">
3021
                   		<div style="float:right;">
3022
							<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
3023
							<?php if($allowAdd) : ?>
3024
							<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
3025
							<?php endif; ?>
3026
						</div>
3027
                 	</div>
3028
          		</div>
3029
           	</div>
3030
        </div>
3031
 	</div>
3032
</section>
3033
 
3034
 
3035
 
3036
<!-- The Modal -->
6531 nelberth 3037
<div  id="company-microlearning-slide-text-add-box" style='display:none'>
6528 nelberth 3038
 
1 www 3039
    		<?php
3040
    	    $form = $this->formTextAdd;
3041
    	    $form->setAttributes([
3042
    	       'method'    => 'post',
3043
    	       'name'      => 'form-slide-text-add',
3044
    	       'id'        => 'form-slide-text-add'
3045
    	    ]);
3046
    	    $form->prepare();
3047
    	    echo $this->form()->openTag($form);
3048
 
3049
    	    $element = $form->get('type');
3050
    	    echo $this->formHidden($element);
3051
 
3052
    	    ?>
3053
 
6528 nelberth 3054
            <div class="d-flex justify-content-center tituloEditor">
6590 nelberth 3055
              <h4>LABEL_ADD_TEXT_SLIDE</h4>
6528 nelberth 3056
 
3057
             </div>
3058
 
3059
 
3060
            <div class="grid-padre">
3061
				<div class="form-group grid-1-2">
1 www 3062
    				<?php
3063
                        $element = $form->get('name');
3064
                        $element->setAttributes(['class' => 'form-control']);
3065
                        $element->setOptions(['label' => 'LABEL_NAME']);
3066
                        echo $this->formLabel($element);
3067
                        echo $this->formText($element);
3068
                    ?>
3069
				</div>
6528 nelberth 3070
                <div class="form-group grid-1-2">
1 www 3071
                	<?php
3072
                    $element = $form->get('description');
3073
                    $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
6600 nelberth 3074
                    $element->setAttributes(['id' => 'description_add', 'rows' => '2',  'class' => 'form-control']);
1 www 3075
                    echo $this->formLabel($element);
3076
                    echo $this->formTextArea($element);
3077
                    ?>
3078
   				</div>
6528 nelberth 3079
				<div class="form-group grid-1-2">
1 www 3080
    				<?php
3081
                        $element = $form->get('order');
3082
                        $element->setAttributes(['class' => 'form-control']);
3083
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3084
                        echo $this->formLabel($element);
3085
                        echo $this->formText($element);
3086
                    ?>
3087
				</div>
6529 nelberth 3088
                <?php
3089
                    $element = $form->get('background');
3090
					$element->setAttributes([ 'class' => 'background']);
3091
                    echo $this->formHidden($element);
3092
                ?>
6543 nelberth 3093
				<div class="contenido form-group " id="contenido"></div>
6529 nelberth 3094
 
1 www 3095
      		</div>
3096
 
3097
          	<?php echo $this->form()->closeTag($form); ?>
6528 nelberth 3098
 
1 www 3099
</div>
3100
 
3101
 
3102
 
3103
 
3104
<!-- The Modal -->
6596 nelberth 3105
<div id="company-microlearning-slide-text-edit-box" style='display:none'>
6595 nelberth 3106
            <?php
1 www 3107
    	    $form = $this->formTextEdit;
3108
    	    $form->setAttributes([
3109
    	       'method'    => 'post',
3110
    	       'name'      => 'form-slide-text-edit',
3111
    	       'id'        => 'form-slide-text-edit'
3112
    	    ]);
3113
    	    $form->prepare();
3114
    	    echo $this->form()->openTag($form);
3115
 
3116
    	    $element = $form->get('type');
3117
    	    echo $this->formHidden($element);
3118
 
6595 nelberth 3119
    	    ?>
3120
            <div class="d-flex justify-content-center tituloEditor">
3121
              <h4>LABEL_EDIT_TEXT_SLIDE</h4>
1 www 3122
 
6595 nelberth 3123
             </div>
3124
 
3125
 
3126
            <div class="grid-padre">
3127
				<div class="form-group grid-1-2">
1 www 3128
    				<?php
3129
                        $element = $form->get('name');
3130
                        $element->setAttributes(['class' => 'form-control']);
3131
                        $element->setOptions(['label' => 'LABEL_NAME']);
3132
                        echo $this->formLabel($element);
3133
                        echo $this->formText($element);
3134
                    ?>
3135
				</div>
6595 nelberth 3136
                <div class="form-group grid-1-2">
1 www 3137
                	<?php
3138
                    $element = $form->get('description');
3139
                    $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
6600 nelberth 3140
                    $element->setAttributes(['id' => 'description_edit', 'rows' => '2',  'class' => 'form-control']);
1 www 3141
                    echo $this->formLabel($element);
3142
                    echo $this->formTextArea($element);
3143
                    ?>
3144
   				</div>
6595 nelberth 3145
				<div class="form-group grid-1-2">
1 www 3146
    				<?php
3147
                        $element = $form->get('order');
3148
                        $element->setAttributes(['class' => 'form-control']);
3149
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3150
                        echo $this->formLabel($element);
3151
                        echo $this->formText($element);
3152
                    ?>
3153
				</div>
6595 nelberth 3154
                <?php
3155
                    $element = $form->get('background');
3156
					$element->setAttributes([ 'class' => 'background']);
3157
                    echo $this->formHidden($element);
3158
                ?>
3159
				<div class="contenido form-group " id="contenido"></div>
3160
 
1 www 3161
      		</div>
3162
 
3163
          	<?php echo $this->form()->closeTag($form); ?>
6595 nelberth 3164
 
1 www 3165
</div>
3166
 
3167
 
3168
 
3169
<!-- The Modal -->
6523 nelberth 3170
<div class='imageType'  id="company-microlearning-slide-image-add-box" style='display:none' >
1 www 3171
    		<?php
3172
    	    $form = $this->formImageAdd;
3173
    	    $form->setAttributes([
3174
    	       'method'    => 'post',
3175
    	        'name'      => 'form-slide-image-add',
3176
    	        'id'        => 'form-slide-image-add'
3177
    	    ]);
3178
    	    $form->prepare();
3179
    	    echo $this->form()->openTag($form);
3180
 
3181
    	    $element = $form->get('type');
3182
    	    echo $this->formHidden($element);
3183
 
3184
    	    ?>
3185
            <!-- Modal Header -->
6126 nelberth 3186
            <div class="d-flex justify-content-center tituloEditor">
6131 nelberth 3187
              <h4>LABEL_ADD_IMAGE_SLIDE</h4>
1 www 3188
 
6126 nelberth 3189
             </div>
3190
 
1 www 3191
            <!-- Modal body -->
6126 nelberth 3192
            <div class="grid-padre">
6140 nelberth 3193
                 <div class="form-group grid-1-2">
1 www 3194
    				<?php
3195
                        $element = $form->get('name');
3196
                        $element->setAttributes(['class' => 'form-control']);
3197
                        $element->setOptions(['label' => 'LABEL_NAME']);
3198
                        echo $this->formLabel($element);
3199
                        echo $this->formText($element);
3200
                    ?>
3201
				</div>
6142 nelberth 3202
 
6137 nelberth 3203
 
6134 nelberth 3204
                <?php
3205
                    $element = $form->get('file');
3206
					$element->setAttributes([ 'class' => 'file']);
3207
                    echo $this->formHidden($element);
3208
                ?>
6129 nelberth 3209
				<div class="form-group grid-1-2">
1 www 3210
    				<?php
3211
                        $element = $form->get('order');
3212
                        $element->setAttributes(['class' => 'form-control']);
3213
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3214
                        echo $this->formLabel($element);
3215
                        echo $this->formText($element);
3216
                    ?>
3217
				</div>
6544 nelberth 3218
                <div class="contenido form-group " id="contenido"></div>
1 www 3219
      		</div>
3220
 
6125 nelberth 3221
 
1 www 3222
          	<?php echo $this->form()->closeTag($form); ?>
3223
</div>
3224
 
6523 nelberth 3225
<div class='imageType' id="company-microlearning-slide-image-edit-box" style='display:none' >
6505 nelberth 3226
            <?php
3227
    	    $form = $this->formImageEdit;
3228
    	    $form->setAttributes([
3229
    	       'method'    => 'post',
3230
    	       'name'      => 'form-slide-image-edit',
3231
    	       'id'        => 'form-slide-image-edit'
3232
    	    ]);
3233
    	    $form->prepare();
3234
    	    echo $this->form()->openTag($form);
3235
 
3236
    	    $element = $form->get('type');
3237
    	    echo $this->formHidden($element);
3238
 
3239
    	    ?>
3240
            <!-- Modal Header -->
3241
            <div class="d-flex justify-content-center tituloEditor">
3242
              <h4>LABEL_EDIT_IMAGE_SLIDE</h4>
3243
 
3244
             </div>
3245
 
3246
            <!-- Modal body -->
3247
            <div class="grid-padre">
3248
                 <div class="form-group grid-1-2">
3249
    				<?php
3250
                        $element = $form->get('name');
3251
                        $element->setAttributes(['class' => 'form-control']);
3252
                        $element->setOptions(['label' => 'LABEL_NAME']);
3253
                        echo $this->formLabel($element);
3254
                        echo $this->formText($element);
3255
                    ?>
3256
				</div>
3257
 
3258
 
3259
                <?php
3260
                    $element = $form->get('file');
3261
					$element->setAttributes([ 'class' => 'file']);
3262
                    echo $this->formHidden($element);
3263
                ?>
3264
				<div class="form-group grid-1-2">
3265
    				<?php
3266
                        $element = $form->get('order');
3267
                        $element->setAttributes(['class' => 'form-control']);
3268
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3269
                        echo $this->formLabel($element);
3270
                        echo $this->formText($element);
3271
                    ?>
3272
				</div>
6625 nelberth 3273
 
6569 nelberth 3274
                <div class="contenido form-group " id="contenido"></div>
6505 nelberth 3275
      		</div>
1 www 3276
 
6505 nelberth 3277
 
3278
          	<?php echo $this->form()->closeTag($form); ?>
3279
</div>
1 www 3280
 
3281
 
3282
<!-- The Modal -->
6523 nelberth 3283
 
1 www 3284
 
3285
 
3286
 
3287
<!-- The Modal -->
6618 nelberth 3288
<div  id="company-microlearning-slide-video-add-box"  style='display:none'>
3289
 
1 www 3290
    		<?php
3291
    	    $form = $this->formVideoAdd;
3292
    	    $form->setAttributes([
3293
    	       'method'    => 'post',
3294
    	        'name'      => 'form-slide-video-add',
3295
    	        'id'        => 'form-slide-video-add'
3296
    	    ]);
3297
    	    $form->prepare();
3298
    	    echo $this->form()->openTag($form);
3299
 
3300
    	    $element = $form->get('type');
3301
    	    echo $this->formHidden($element);
3302
 
3303
    	    ?>
6618 nelberth 3304
 
3305
              <div class="d-flex justify-content-center tituloEditor">
3306
              <h4>LABEL_ADD_VIDEO_SLIDE</h4>
1 www 3307
 
6618 nelberth 3308
             </div>
3309
            <div class="grid-padre">
3310
				<div class="form-group  grid-1-2">
1 www 3311
    				<?php
3312
                        $element = $form->get('name');
3313
                        $element->setAttributes(['class' => 'form-control']);
3314
                        $element->setOptions(['label' => 'LABEL_NAME']);
3315
                        echo $this->formLabel($element);
3316
                        echo $this->formText($element);
3317
                    ?>
3318
				</div>
6618 nelberth 3319
				<div class="form-group  grid-1-2">
1 www 3320
    				<?php
3321
                        $element = $form->get('order');
3322
                        $element->setAttributes(['class' => 'form-control']);
3323
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3324
                        echo $this->formLabel($element);
3325
                        echo $this->formText($element);
3326
                    ?>
3327
				</div>
6618 nelberth 3328
				<div class="form-group  grid-1-2">
1 www 3329
 
3330
                 		<?php
3331
                        $element = $form->get('file');
3332
                        $element->setAttributes(['class' => 'form-control']);
3333
                        $element->setOptions(['label' => 'LABEL_VIDEO']);
3334
                        $element->setAttributes(['accept' => 'video/webm,video/mpeg,video/mp4']);
3335
                        echo $this->formLabel($element);
3336
                        ?>
3337
                        <div class="file-loading">
3338
                        <?php echo $this->formFile($element);?>
3339
                        </div>
3340
 
3341
          		</div>
6625 nelberth 3342
                  <?php
3343
                    $element = $form->get('background');
3344
					$element->setAttributes([ 'class' => 'background']);
6844 nelberth 3345
                    echo $this->formHidden($element);
6625 nelberth 3346
                ?>
6618 nelberth 3347
          		<div class="contenido form-group " id="contenido"></div>
1 www 3348
      		</div>
3349
 
3350
            <!-- Modal footer -->
6618 nelberth 3351
 
1 www 3352
          	<?php echo $this->form()->closeTag($form); ?>
6618 nelberth 3353
 
1 www 3354
</div>
3355
 
3356
 
3357
 
3358
 
3359
<!-- The Modal -->
6646 nelberth 3360
<div  id="company-microlearning-slide-video-edit-box"  style='display:none'>
6644 nelberth 3361
 
1 www 3362
        	<?php
3363
    	    $form = $this->formVideoEdit;
3364
    	    $form->setAttributes([
3365
    	       'method'    => 'post',
3366
    	       'name'      => 'form-slide-video-edit',
3367
    	       'id'        => 'form-slide-video-edit'
3368
    	    ]);
3369
    	    $form->prepare();
3370
    	    echo $this->form()->openTag($form);
3371
 
3372
    	    $element = $form->get('type');
3373
    	    echo $this->formHidden($element);
3374
 
3375
    	    ?>
3376
 
6654 nelberth 3377
 
3378
              <div class="d-flex justify-content-center tituloEditor">
3379
              <h4>LABEL_EDIT_VIDEO_SLIDE</h4>
1 www 3380
 
6654 nelberth 3381
             </div>
3382
 
6643 nelberth 3383
            <!-- Modal body -->
6644 nelberth 3384
            <div class="grid-padre">
6645 nelberth 3385
				<div class="form-group grid-1-2">
1 www 3386
    				<?php
3387
                        $element = $form->get('name');
3388
                        $element->setAttributes(['class' => 'form-control']);
3389
                        $element->setOptions(['label' => 'LABEL_NAME']);
3390
                        echo $this->formLabel($element);
3391
                        echo $this->formText($element);
3392
                    ?>
3393
				</div>
6645 nelberth 3394
				<div class="form-group grid-1-2">
1 www 3395
    				<?php
3396
                        $element = $form->get('order');
3397
                        $element->setAttributes(['class' => 'form-control']);
3398
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3399
                        echo $this->formLabel($element);
3400
                        echo $this->formText($element);
3401
                    ?>
3402
				</div>
6645 nelberth 3403
				<div class="form-group grid-1-2">
6643 nelberth 3404
 
1 www 3405
                 		<?php
3406
                        $element = $form->get('file');
3407
                        $element->setAttributes(['class' => 'form-control']);
3408
                        $element->setOptions(['label' => 'LABEL_VIDEO']);
3409
                        $element->setAttributes(['accept' => 'video/webm,video/mpeg,video/mp4']);
3410
                        echo $this->formLabel($element);
3411
                        ?>
3412
                        <div class="file-loading">
3413
                        <?php echo $this->formFile($element);?>
3414
                        </div>
6643 nelberth 3415
 
1 www 3416
          		</div>
6645 nelberth 3417
          		<?php
3418
                    $element = $form->get('background');
3419
					$element->setAttributes([ 'class' => 'background']);
3420
                    echo $this->formHidden($element);
3421
                ?>
3422
          		<div class="contenido form-group " id="contenido"></div>
1 www 3423
      		</div>
6643 nelberth 3424
 
6644 nelberth 3425
 
6643 nelberth 3426
          	<?php echo $this->form()->closeTag($form); ?>
6644 nelberth 3427
 
1 www 3428
</div>
3429
 
3430
 
3431
 
3432
 
3433
<!-- The Modal -->
6655 nelberth 3434
<div id="company-microlearning-slide-document-add-box" style='display:none'>
6654 nelberth 3435
 
1 www 3436
    		<?php
3437
    	    $form = $this->formDocumentAdd;
3438
    	    $form->setAttributes([
3439
    	       'method'    => 'post',
3440
    	        'name'      => 'form-slide-document-add',
3441
    	        'id'        => 'form-slide-document-add'
3442
    	    ]);
3443
    	    $form->prepare();
3444
    	    echo $this->form()->openTag($form);
3445
 
3446
    	    $element = $form->get('type');
3447
    	    echo $this->formHidden($element);
3448
 
3449
    	    ?>
6654 nelberth 3450
 
3451
              <div class="d-flex justify-content-center tituloEditor">
3452
              <h4>LABEL_ADD_DOCUMENT_SLIDE</h4>
1 www 3453
 
6654 nelberth 3454
             </div>
1 www 3455
            <!-- Modal body -->
6654 nelberth 3456
            <div class="grid-padre">
3457
				<div class="form-group  grid-1-2">
1 www 3458
    				<?php
3459
                        $element = $form->get('name');
3460
                        $element->setAttributes(['class' => 'form-control']);
3461
                        $element->setOptions(['label' => 'LABEL_NAME']);
3462
                        echo $this->formLabel($element);
3463
                        echo $this->formText($element);
3464
                    ?>
3465
				</div>
6654 nelberth 3466
				<div class="form-group  grid-1-2">
1 www 3467
    				<?php
3468
                        $element = $form->get('order');
3469
                        $element->setAttributes(['class' => 'form-control']);
3470
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3471
                        echo $this->formLabel($element);
3472
                        echo $this->formText($element);
3473
                    ?>
3474
				</div>
6654 nelberth 3475
				<div class="form-group  grid-1-2">
1 www 3476
 
3477
                 		<?php
3478
                        $element = $form->get('file');
3479
                        $element->setAttributes(['class' => 'form-control']);
3480
                        $element->setOptions(['label' => 'LABEL_DOCUMENT']);
3481
                        $element->setAttributes(['accept' => 'application/pdf']);
3482
                        echo $this->formLabel($element);
3483
                        ?>
3484
                        <div class="file-loading">
3485
                        <?php echo $this->formFile($element);?>
3486
                        </div>
3487
 
3488
          		</div>
6654 nelberth 3489
                  <?php
3490
                    $element = $form->get('background');
3491
					$element->setAttributes([ 'class' => 'background']);
3492
                    echo $this->formHidden($element);
3493
                ?>
3494
          		<div class="contenido form-group " id="contenido"></div>
1 www 3495
      		</div>
3496
 
3497
            <!-- Modal footer -->
6654 nelberth 3498
 
1 www 3499
          	<?php echo $this->form()->closeTag($form); ?>
6656 nelberth 3500
 
1 www 3501
</div>
3502
 
3503
 
3504
 
3505
 
3506
<!-- The Modal -->
6655 nelberth 3507
<div id="company-microlearning-slide-document-edit-box" style='display:none'>
6654 nelberth 3508
 
1 www 3509
    		<?php
3510
    	    $form = $this->formDocumentEdit;
3511
    	    $form->setAttributes([
3512
    	       'method'    => 'post',
3513
    	       'name'      => 'form-slide-document-edit',
3514
    	       'id'        => 'form-slide-document-edit'
3515
    	    ]);
3516
    	    $form->prepare();
3517
    	    echo $this->form()->openTag($form);
3518
 
3519
    	    $element = $form->get('type');
3520
    	    echo $this->formHidden($element);
3521
 
3522
    	    ?>
3523
            <!-- Modal Header -->
6654 nelberth 3524
 
3525
              <div class="d-flex justify-content-center tituloEditor">
3526
              <h4>LABEL_EDIT_DOCUMENT_SLIDE</h4>
1 www 3527
 
6654 nelberth 3528
             </div>
1 www 3529
            <!-- Modal body -->
6654 nelberth 3530
            <div class="grid-padre">
3531
				<div class="form-group  grid-1-2">
1 www 3532
    				<?php
3533
                        $element = $form->get('name');
3534
                        $element->setAttributes(['class' => 'form-control']);
3535
                        $element->setOptions(['label' => 'LABEL_NAME']);
3536
                        echo $this->formLabel($element);
3537
                        echo $this->formText($element);
3538
                    ?>
3539
				</div>
6654 nelberth 3540
				<div class="form-group  grid-1-2">
1 www 3541
    				<?php
3542
                        $element = $form->get('order');
3543
                        $element->setAttributes(['class' => 'form-control']);
3544
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3545
                        echo $this->formLabel($element);
3546
                        echo $this->formText($element);
3547
                    ?>
3548
				</div>
6654 nelberth 3549
				<div class="form-group  grid-1-2">
1 www 3550
 
3551
                 		<?php
3552
                        $element = $form->get('file');
3553
                        $element->setAttributes(['class' => 'form-control']);
3554
                        $element->setOptions(['label' => 'LABEL_DOCUMENT']);
3555
                        $element->setAttributes(['accept' => 'application/pdf']);
3556
                        echo $this->formLabel($element);
3557
                        ?>
3558
                        <div class="file-loading">
3559
                        <?php echo $this->formFile($element);?>
3560
                        </div>
3561
 
3562
          		</div>
6654 nelberth 3563
 
3564
          		<?php
3565
                    $element = $form->get('background');
3566
					$element->setAttributes([ 'class' => 'background']);
3567
                    echo $this->formHidden($element);
3568
                ?>
3569
          		<div class="contenido form-group " id="contenido"></div>
1 www 3570
      		</div>
3571
 
3572
            <!-- Modal footer -->
6654 nelberth 3573
 
1 www 3574
          	<?php echo $this->form()->closeTag($form); ?>
6656 nelberth 3575
 
1 www 3576
</div>
3577
 
3578
 
3579
 
3580
<!-- The Modal -->
6655 nelberth 3581
<div  id="company-microlearning-slide-audio-add-box" style='display:none'>
6654 nelberth 3582
 
1 www 3583
    		<?php
3584
    	    $form = $this->formAudioAdd;
3585
    	    $form->setAttributes([
3586
    	       'method'    => 'post',
3587
    	        'name'      => 'form-slide-audio-add',
3588
    	        'id'        => 'form-slide-audio-add'
3589
    	    ]);
3590
    	    $form->prepare();
3591
    	    echo $this->form()->openTag($form);
3592
 
3593
    	    $element = $form->get('type');
3594
    	    echo $this->formHidden($element);
3595
 
3596
    	    ?>
3597
            <!-- Modal Header -->
6654 nelberth 3598
 
3599
              <div class="d-flex justify-content-center tituloEditor">
3600
              <h4>LABEL_ADD_AUDIO_SLIDE</h4>
1 www 3601
 
6654 nelberth 3602
             </div>
3603
 
1 www 3604
            <!-- Modal body -->
6654 nelberth 3605
            <div class="grid-padre">
3606
				<div class="form-group  grid-1-2">
1 www 3607
    				<?php
3608
                        $element = $form->get('name');
3609
                        $element->setAttributes(['class' => 'form-control']);
3610
                        $element->setOptions(['label' => 'LABEL_NAME']);
3611
                        echo $this->formLabel($element);
3612
                        echo $this->formText($element);
3613
                    ?>
3614
				</div>
6654 nelberth 3615
				<div class="form-group  grid-1-2">
1 www 3616
    				<?php
3617
                        $element = $form->get('order');
3618
                        $element->setAttributes(['class' => 'form-control']);
3619
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3620
                        echo $this->formLabel($element);
3621
                        echo $this->formText($element);
3622
                    ?>
3623
				</div>
6658 nelberth 3624
				<div class="form-group  grid-1-2">
1 www 3625
 
3626
                 		<?php
3627
                        $element = $form->get('file');
3628
                        $element->setAttributes(['class' => 'form-control']);
3629
                        $element->setOptions(['label' => 'LABEL_AUDIO']);
3630
                        $element->setAttributes(['accept' => 'audio/x-wav, audio/mpeg']);
3631
                        echo $this->formLabel($element);
3632
                        ?>
3633
                        <div class="file-loading">
3634
                        <?php echo $this->formFile($element);?>
3635
                        </div>
3636
 
3637
          		</div>
6657 nelberth 3638
          		<?php
3639
                    $element = $form->get('background');
3640
					$element->setAttributes([ 'class' => 'background']);
3641
                    echo $this->formHidden($element);
3642
                ?>
3643
          		<div class="contenido form-group " id="contenido"></div>
1 www 3644
      		</div>
3645
 
3646
            <!-- Modal footer -->
6654 nelberth 3647
 
1 www 3648
          	<?php echo $this->form()->closeTag($form); ?>
6656 nelberth 3649
 
1 www 3650
</div>
3651
 
3652
 
3653
 
3654
<!-- The Modal -->
6655 nelberth 3655
<div  id="company-microlearning-slide-audio-edit-box" style='display:none'>
6654 nelberth 3656
 
1 www 3657
        	<?php
3658
    	    $form = $this->formAudioEdit;
3659
    	    $form->setAttributes([
3660
    	       'method'    => 'post',
3661
    	       'name'      => 'form-slide-audio-edit',
3662
    	       'id'        => 'form-slide-audio-edit'
3663
    	    ]);
3664
    	    $form->prepare();
3665
    	    echo $this->form()->openTag($form);
3666
 
3667
    	    $element = $form->get('type');
3668
    	    echo $this->formHidden($element);
3669
 
3670
    	    ?>
3671
 
3672
            <!-- Modal Header -->
6654 nelberth 3673
 
3674
              <div class="d-flex justify-content-center tituloEditor">
3675
              <h4>LABEL_EDIT_AUDIO_SLIDE</h4>
1 www 3676
 
6654 nelberth 3677
             </div>
1 www 3678
            <!-- Modal body -->
6654 nelberth 3679
            <div class="grid-padre">
1 www 3680
				<div class="form-group">
3681
    				<?php
3682
                        $element = $form->get('name');
3683
                        $element->setAttributes(['class' => 'form-control']);
3684
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3685
                        echo $this->formLabel($element);
3686
                        echo $this->formText($element);
3687
                    ?>
3688
				</div>
6654 nelberth 3689
				<div class="form-group  grid-1-2">
1 www 3690
    				<?php
3691
                        $element = $form->get('order');
3692
                        $element->setAttributes(['class' => 'form-control']);
3693
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3694
                        echo $this->formLabel($element);
3695
                        echo $this->formText($element);
3696
                    ?>
3697
				</div>
6658 nelberth 3698
				<div class="form-group  grid-1-2">
1 www 3699
 
3700
                 		<?php
3701
                        $element = $form->get('file');
3702
                        $element->setAttributes(['class' => 'form-control']);
3703
                        $element->setOptions(['label' => 'LABEL_AUDIO']);
3704
                        $element->setAttributes(['accept' => 'audio/x-wav, audio/mpeg']);
3705
                        echo $this->formLabel($element);
3706
                        ?>
3707
                        <div class="file-loading">
3708
                        <?php echo $this->formFile($element);?>
3709
                        </div>
3710
 
3711
          		</div>
6654 nelberth 3712
 
3713
          		<?php
3714
                    $element = $form->get('background');
3715
					$element->setAttributes([ 'class' => 'background']);
3716
                    echo $this->formHidden($element);
3717
                ?>
3718
          		<div class="contenido form-group " id="contenido"></div>
1 www 3719
      		</div>
3720
 
3721
            <!-- Modal footer -->
6654 nelberth 3722
 
1 www 3723
          	<?php echo $this->form()->closeTag($form); ?>
6656 nelberth 3724
 
1 www 3725
</div>
3726
 
3727
 
3728
 
3729
<!-- The Modal -->
6655 nelberth 3730
<div  id="company-microlearning-slide-quizz-add-box" style='display:none'>
6654 nelberth 3731
 
1 www 3732
    		<?php
3733
    	    $form = $this->formQuizzAdd;
3734
    	    $form->setAttributes([
3735
    	       'method'    => 'post',
3736
    	        'name'      => 'form-slide-quizz-add',
3737
    	        'id'        => 'form-slide-quizz-add'
3738
    	    ]);
3739
    	    $form->prepare();
3740
    	    echo $this->form()->openTag($form);
3741
 
3742
    	    $element = $form->get('type');
3743
    	    echo $this->formHidden($element);
3744
 
3745
    	    ?>
3746
            <!-- Modal Header -->
6654 nelberth 3747
 
3748
              <div class="d-flex justify-content-center tituloEditor">
3749
              <h4>LABEL_ADD_QUIZ_SLIDE</h4>
1 www 3750
 
6654 nelberth 3751
             </div>
1 www 3752
            <!-- Modal body -->
6654 nelberth 3753
            <div class="grid-padre">
3754
				<div class="form-group  grid-1-2">
1 www 3755
    				<?php
3756
                        $element = $form->get('name');
3757
                        $element->setAttributes(['class' => 'form-control']);
3758
                        $element->setOptions(['label' => 'LABEL_NAME']);
3759
                        echo $this->formLabel($element);
3760
                        echo $this->formText($element);
3761
                    ?>
3762
				</div>
6654 nelberth 3763
				<div class="form-group  grid-1-2">
1 www 3764
    				<?php
3765
                        $element = $form->get('order');
3766
                        $element->setAttributes(['class' => 'form-control']);
3767
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3768
                        echo $this->formLabel($element);
3769
                        echo $this->formText($element);
3770
                    ?>
3771
				</div>
6657 nelberth 3772
 
6658 nelberth 3773
				<div class="form-group  grid-1-2">
1 www 3774
    				<?php
3775
                        $element = $form->get('quiz_id');
3776
                        $element->setAttributes(['class' => 'form-control']);
3777
                        $element->setOptions(['label' => 'LABEL_QUIZ']);
3778
                        echo $this->formLabel($element);
3779
                        echo $this->formSelect($element);
3780
                    ?>
3781
				</div>
6657 nelberth 3782
                <?php
3783
                    $element = $form->get('background');
3784
					$element->setAttributes([ 'class' => 'background']);
3785
                    echo $this->formHidden($element);
3786
                ?>
3787
          		<div class="contenido form-group " id="contenido"></div>
1 www 3788
      		</div>
3789
 
3790
            <!-- Modal footer -->
6654 nelberth 3791
 
1 www 3792
          	<?php echo $this->form()->closeTag($form); ?>
6656 nelberth 3793
 
1 www 3794
</div>
3795
 
3796
 
3797
 
3798
<!-- The Modal -->
6655 nelberth 3799
<div  id="company-microlearning-slide-quizz-edit-box" style='display:none'>
6654 nelberth 3800
 
1 www 3801
        	<?php
3802
    	    $form = $this->formQuizzEdit;
3803
    	    $form->setAttributes([
3804
    	       'method'    => 'post',
3805
    	       'name'      => 'form-slide-quizz-edit',
3806
    	       'id'        => 'form-slide-quizz-edit'
3807
    	    ]);
3808
    	    $form->prepare();
3809
    	    echo $this->form()->openTag($form);
3810
 
3811
    	    $element = $form->get('type');
3812
    	    echo $this->formHidden($element);
3813
 
3814
    	    ?>
3815
 
3816
            <!-- Modal Header -->
6654 nelberth 3817
 
3818
              <div class="d-flex justify-content-center tituloEditor">
3819
              <h4>LABEL_EDIT_QUIZ_SLIDE</h4>
1 www 3820
 
6654 nelberth 3821
             </div>
1 www 3822
            <!-- Modal body -->
6654 nelberth 3823
            <div class="grid-padre">
3824
				<div class="form-group  grid-1-2">
1 www 3825
    				<?php
3826
                        $element = $form->get('name');
3827
                        $element->setAttributes(['class' => 'form-control']);
3828
                        $element->setOptions(['label' => 'LABEL_NAME']);
3829
                        echo $this->formLabel($element);
3830
                        echo $this->formText($element);
3831
                    ?>
3832
				</div>
6654 nelberth 3833
				<div class="form-group  grid-1-2">
1 www 3834
    				<?php
3835
                        $element = $form->get('order');
3836
                        $element->setAttributes(['class' => 'form-control']);
3837
                        $element->setOptions(['label' => 'LABEL_ORDER']);
3838
                        echo $this->formLabel($element);
3839
                        echo $this->formText($element);
3840
                    ?>
3841
				</div>
6657 nelberth 3842
 
6658 nelberth 3843
				<div class="form-group  grid-1-2">
1 www 3844
    				<?php
3845
                        $element = $form->get('quiz_id');
3846
                        $element->setAttributes(['class' => 'form-control']);
3847
                        $element->setOptions(['label' => 'LABEL_QUIZ']);
3848
                        echo $this->formLabel($element);
3849
                        echo $this->formSelect($element);
3850
                    ?>
3851
				</div>
6657 nelberth 3852
				<?php
3853
                    $element = $form->get('background');
3854
					$element->setAttributes([ 'class' => 'background']);
3855
                    echo $this->formHidden($element);
3856
                ?>
3857
          		<div class="contenido form-group " id="contenido"></div>
1 www 3858
 
3859
      		</div>
3860
 
3861
            <!-- Modal footer -->
6657 nelberth 3862
      		<
1 www 3863
 
3864
          	<?php echo $this->form()->closeTag($form); ?>
6656 nelberth 3865
 
1 www 3866
</div>
3867
 
3868
 
3869
 
3870
<!-- The Modal -->
6652 nelberth 3871
<div class="modal" id="company-microlearning-play-video-box" >
1 www 3872
	<div class="modal-dialog ">
3873
    	<div class="modal-content">
3874
 
3875
            <!-- Modal Header -->
3876
      		<div class="modal-header">
3877
        		<h4 class="modal-title">LABEL_PLAY_VIDEO</h4>
3878
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
3879
      		</div>
3880
 
3881
            <!-- Modal body -->
3882
            <div class="modal-body">
3883
				<video src=""  style="width: 300px; height: auto" controls preload="false" autoplay="false"  poster="" id="microlearning-play-video"></video>
3884
      		</div>
3885
 
3886
            <!-- Modal footer -->
3887
      		<div class="modal-footer">
3888
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
3889
          	</div>
3890
         </div>
3891
	</div>
3892
</div>
3893
 
3894
 
3895
 
3896
 
3897
 
3898
<!-- The Modal -->
6652 nelberth 3899
<div class="modal" id="company-microlearning-play-audio-box" >
1 www 3900
	<div class="modal-dialog ">
3901
    	<div class="modal-content">
3902
 
3903
            <!-- Modal Header -->
3904
      		<div class="modal-header">
3905
        		<h4 class="modal-title">LABEL_PLAY_AUDIO</h4>
3906
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
3907
      		</div>
3908
 
3909
            <!-- Modal body -->
3910
            <div class="modal-body">
3911
				<audio src="" controls autoplay="false"  id="microlearning-play-audio" >
3912
                  Your browser does not support the <code>audio</code> element.
3913
                </audio>
3914
      		</div>
3915
 
3916
            <!-- Modal footer -->
3917
      		<div class="modal-footer">
3918
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
3919
          	</div>
3920
         </div>
3921
	</div>
3922
</div>
3923
 
3924
 
3925
<!-- The Modal -->
3926
<div class="modal" id="company-microlearning-view-image-box">
3927
	<div class="modal-dialog ">
3928
    	<div class="modal-content">
3929
 
3930
            <!-- Modal Header -->
3931
      		<div class="modal-header">
6108 nelberth 3932
        		<h4 class="modal-title">LABEL_IMAGE</h4>
1 www 3933
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
3934
      		</div>
3935
 
3936
            <!-- Modal body -->
3937
            <div class="modal-body text-center">
3938
				<img src="" class="img img-responsive" style="width: 300px; height: auto" id="image-view" />
3939
      		</div>
3940
 
3941
            <!-- Modal footer -->
3942
      		<div class="modal-footer">
3943
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
3944
          	</div>
3945
         </div>
3946
	</div>
3947
</div>
3948
 
3949
 
3950
<!-- The Modal -->
3951
<div class="modal" id="company-microlearning-view-document-box">
3952
	<div class="modal-dialog ">
3953
    	<div class="modal-content">
3954
 
3955
            <!-- Modal Header -->
3956
      		<div class="modal-header">
3957
        		<h4 class="modal-title">LABEL_DOCUMENT</h4>
3958
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
3959
      		</div>
3960
 
3961
            <!-- Modal body -->
3962
            <div class="modal-body text-center">
3963
            	<iframe id="document-view" style="width: 450px; height: 300px; scroll: auto">
3964
 
3965
            	</iframe>
3966
       	</div>
3967
 
3968
            <!-- Modal footer -->
3969
      		<div class="modal-footer">
3970
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
3971
          	</div>
3972
         </div>
3973
	</div>
3974
</div>
3975
 
3976
 
3977
<!-- The Modal -->
3978
<div class="modal" id="company-microlearning-view-text-box">
3979
	<div class="modal-dialog modal-xl">
3980
    	<div class="modal-content">
3981
 
3982
            <!-- Modal Header -->
3983
      		<div class="modal-header">
3984
        		<h4 class="modal-title">LABEL_TEXT</h4>
3985
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
3986
      		</div>
3987
 
3988
            <!-- Modal body -->
3989
            <div class="modal-body" >
3990
            	<div id="document-text" style="width: 100%; height: 300px; scroll: auto; overflow: auto;">
3991
 
3992
 
3993
            	</div>
3994
 
3995
       	</div>
3996
 
3997
            <!-- Modal footer -->
3998
      		<div class="modal-footer">
3999
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
4000
          	</div>
4001
         </div>
4002
	</div>
4003
</div>
4004
 
4005
 
4006
<!-- The Modal -->
4007
<div class="modal" id="company-microlearning-add-capsule-type-box">
4008
	<div class="modal-dialog ">
4009
    	<div class="modal-content">
4010
 
4011
            <!-- Modal Header -->
4012
      		<div class="modal-header">
6092 nelberth 4013
        		<h4 class="modal-title">LABEL_ADD_CAPSULE_SELECT_TYPE</h4>
1 www 4014
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
4015
      		</div>
4016
 
4017
            <!-- Modal body -->
4018
            <div class="modal-body">
4019
				<table style="width: 100%">
4020
					<tr>
4021
      					<td class="text-left" ><button type="button" class="btn btn-primary btn-add-text"> Texto </button></td>
4022
      					<td class="text-left" ><button type="button" class="btn btn-primary btn-add-image"> Imagén </button></td>
4023
      				</tr>
4024
      				<tr>
4025
						<td class="text-left" ><button type="button" class="btn btn-primary btn-add-video"> Video </button></td>
4026
						<td class="text-left" ><button type="button" class="btn btn-primary btn-add-audio"> Audio </button></td>
4027
					</tr>
4028
					<tr>
4029
						<td class="text-left" ><button type="button" class="btn btn-primary btn-add-document"> Documento </button></td>
4030
        				<td class="text-left" ><button type="button" class="btn btn-primary btn-add-quizz"> Cuestionario </button></td>
4031
        			</tr>
4032
                </table>
4033
      		</div>
4034
 
4035
            <!-- Modal footer -->
4036
      		<div class="modal-footer">
4037
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
4038
          	</div>
4039
         </div>
4040
	</div>
4041
</div>
4042
 
4043
 
4044
 
4045
 
4046