Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 12343 | Rev 14933 | 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
 
5
$roleName = $currentUser->getUserTypeId();
6
 
7
 
8
$routeAdd       = $this->url('microlearning/content/topics/add');
9
$routeDatatable = $this->url('microlearning/content/topics');
10
 
11
$allowAdd               = $acl->isAllowed($roleName, 'microlearning/content/topics/add') ? 1 : 0;
12
$allowEdit              = $acl->isAllowed($roleName, 'microlearning/content/topics/edit') ? 1 : 0;
13
$allowDelete            = $acl->isAllowed($roleName, 'microlearning/content/topics/delete') ? 1 : 0;
14
 
15
 
16
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
17
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
18
 
19
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
20
 
21
 
22
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/css/fileinput.min.css'));
23
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.css'));
24
 
25
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/piexif.js'));
26
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/sortable.js'));
27
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/fileinput.js'));
28
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/locales/es.js'));
29
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/fas/theme.js'));
30
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.js'));
31
 
32
 
33
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
34
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
35
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
36
 
37
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
38
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
4797 nelberth 39
$this->headLink()->appendStylesheet($this->basePath('plugins/nelberth-editor/style.css'));
1 www 40
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
41
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
42
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
43
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
44
 
45
 
46
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
47
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
48
 
49
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
50
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
51
 
52
 
53
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-input-number/input-number-format.jquery.js'));
54
 
55
 
56
$status_active = \LeadersLinked\Model\Degree::STATUS_ACTIVE;
57
 
4697 nelberth 58
 
59
 
4737 nelberth 60
 
1 www 61
$this->inlineScript()->captureStart();
62
echo <<<JS
63
    jQuery( document ).ready(function( $ ) {
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) {
76
                if(element.parent('.btn-file').length) {
77
                    error.insertAfter(element.parent().parent());
78
                } else if(element.parent('.toggle').length) {
79
                    error.insertAfter(element.parent().parent());
80
                } else {
81
                    error.insertAfter(element.parent());
82
                }
83
            }
84
        });
85
 
86
 
87
        $.fn.showFormErrorValidator = function(fieldname, errors) {
88
            var field = $(fieldname);
89
            if(field) {
90
                $(field).addClass('is-invalid');
91
 
92
 
93
                var error = $('<span id="' + fieldname +'-error" class="error invalid-feedback">' + errors + '</div>');
5541 nelberth 94
              /*  if(element.parent('.btn-file').length) {
5539 nelberth 95
                    error.insertAfter(element.parent().parent());
96
                } else if(element.parent('.toggle').length) {
97
                    error.insertAfter(element.parent().parent());
98
                } else {
99
                    error.insertAfter(element.parent());
5541 nelberth 100
                }*/
1 www 101
            }
102
        };
103
 
104
 
105
 
106
 
107
        var allowEdit   = $allowEdit;
108
        var allowDelete = $allowDelete;
109
 
110
        var gridTable = $('#gridTable').dataTable( {
111
            'processing': true,
112
            'serverSide': true,
113
            'searching': true,
114
            'order': [[ 0, 'asc' ]],
115
            'ordering':  true,
116
            'ordenable' : true,
117
            'responsive': true,
118
            'select' : false,
119
        	'paging': true,
120
            'pagingType': 'simple_numbers',
121
    		'ajax': {
122
    			'url' : '$routeDatatable',
123
    			'type' : 'get',
124
                'beforeSend': function (request) {
125
                  NProgress.start();
126
                },
127
                'dataFilter': function(response) {
128
                    var response = jQuery.parseJSON( response );
129
 
130
                    var json                = {};
131
                    json.recordsTotal       = 0;
132
                    json.recordsFiltered    = 0;
133
                    json.data               = [];
134
 
135
 
136
                    if(response.success) {
137
                        json.recordsTotal       = response.data.total;
138
                        json.recordsFiltered    = response.data.total;
139
                        json.data               = response.data.items;
140
                    } else {
141
                        $.fn.showError(response.data)
142
                    }
143
 
144
                    return JSON.stringify( json );
145
                }
146
    		},
147
            'language' : {
148
                'sProcessing':     'LABEL_DATATABLE_SPROCESSING',
149
                'sLengthMenu':     'LABEL_DATATABLE_SLENGTHMENU',
150
                'sZeroRecords':    'LABEL_DATATABLE_SZERORECORDS',
151
                'sEmptyTable':     'LABEL_DATATABLE_SEMPTYTABLE',
152
                'sInfo':           'LABEL_DATATABLE_SINFO',
153
                'sInfoEmpty':      'LABEL_DATATABLE_SINFOEMPTY',
154
                'sInfoFiltered':   'LABEL_DATATABLE_SINFOFILTERED',
155
                'sInfoPostFix':    '',
156
                'sSearch':         'LABEL_DATATABLE_SSEARCH',
157
                'sUrl':            '',
158
                'sInfoThousands':  ',',
159
                'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
160
                'oPaginate': {
161
                    'sFirst':    'LABEL_DATATABLE_SFIRST',
162
                    'sLast':     'LABEL_DATATABLE_SLAST',
163
                    'sNext':     'LABEL_DATATABLE_SNEXT',
164
                    'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
165
                },
166
                'oAria': {
167
                    'sSortAscending':  ': LABEL_DATATABLE_SSORTASCENDING',
168
                    'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
169
                },
170
            },
171
            'drawCallback': function( settings ) {
172
                NProgress.done();
173
                $('button.btn-delete').confirmation({
174
                    rootSelector: 'button.btn-delete',
175
                    title : 'LABEL_ARE_YOU_SURE',
176
                    singleton : true,
177
                    btnOkLabel: 'LABEL_YES',
178
                    btnCancelLabel: 'LABEL_NO',
179
                    onConfirm: function(value) {
180
                        action = $(this).data('href');
181
                        NProgress.start();
182
                        $.ajax({
183
                            'dataType'  : 'json',
184
                            'accept'    : 'application/json',
185
                            'method'    : 'post',
186
                            'url'       :  action,
187
                        }).done(function(response) {
188
                            if(response['success']) {
189
                                $.fn.showSuccess(response['data']);
190
                                gridTable.api().ajax.reload(null, false);
191
                            } else {
192
                                $.fn.showError(response['data']);
193
                            }
194
                        }).fail(function( jqXHR, textStatus, errorThrown) {
195
                            $.fn.showError(textStatus);
196
                        }).always(function() {
197
                            NProgress.done();
198
                        });
199
                    },
200
                });
201
            },
202
            'aoColumns': [
203
                { 'mDataProp': 'name' },
204
                { 'mDataProp': 'status' },
205
                { 'mDataProp': 'image' },
206
                { 'mDataProp': 'actions' },
207
    	    ],
208
            'columnDefs': [
209
                {
210
                    'targets': 0,
211
                    'className' : 'text-vertical-middle',
212
                },
213
                {
214
                    'targets': -2,
215
                    'orderable': false,
216
                    'render' : function ( data, type, row ) {
217
                        s = '&nbsp;';
218
 
219
                        if( data )  {
220
                            s = s + '&nbsp;<img class="btn-view-image-app" data-href="' + data + '" data-toggle="tooltip" src="'+data+'" title="LABEL_VIEW" style="width: 40px; object-fit: cover; height: 40px;" /> '
221
                        }  else {
222
                            s = s + '&nbsp;LABEL_IMAGE: <br>';
223
                        }
224
 
225
 
226
                        return s;
227
                    }
228
                },
229
 
230
 
231
                {
232
                    'targets': -1,
233
                    'orderable': false,
234
                    'render' : function ( data, type, row ) {
235
                        s = '';
236
 
237
                        if(allowEdit && data['link_edit']  ) {
238
                            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> LABEL_EDIT </button>&nbsp;';
239
                        }
240
                        if(allowDelete && data['link_delete']  ) {
241
                            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> LABEL_DELETE </button>&nbsp;';
242
                        }
243
                        return s;
244
                    }
245
                }
246
              ],
247
        });
248
 
249
 
250
    var validatorAdd = $('#form-topic-add').validate({
251
        debug: true,
252
        onclick: false,
253
        onkeyup: false,
254
        ignore: [],
255
        rules: {
256
            'name': {
257
                required: true,
258
                maxlength: 128,
259
            },
260
            'description': {
261
                updateCkeditor:function() {
262
                        CKEDITOR.instances.description_add.updateElement();
263
                },
264
                required: true
265
            },
266
           'file': {
267
                required: true,
268
            },
269
            'order' : {
270
                required: true,
271
                digits: true,
272
                min: 1,
273
                max: 250
274
            },
275
            'status' : {
276
                required: true,
277
            },
278
        },
279
        submitHandler: function(form)
280
        {
281
            var formdata = false;
282
            if (window.FormData){
283
                formdata = new FormData(form); //form[0]);
284
            }
5709 nelberth 285
 
286
 
287
			$('.info_noticia').prop('disabled', true);
5703 nelberth 288
			NProgress.start();
1 www 289
            $.ajax({
290
                'dataType'  : 'json',
291
                'accept'    : 'application/json',
292
                'method'    : 'post',
293
                'url'       :  $('#form-topic-add').attr('action'),
294
                'data'      :  formdata,
295
                'processData': false,
296
                'contentType': false,
297
            }).done(function(response) {
5542 nelberth 298
				console.log(response)
299
				if(response['success']) {
1 www 300
                    $.fn.showSuccess(response['data']);
5708 nelberth 301
                    $('body, html').animate({scrollTop: '0px'}, 300);
5703 nelberth 302
					$('#content1').css('display','block');
303
            		$('#addImage').css('display','none');
1 www 304
                    gridTable.api().ajax.reload(null, false);
305
                } else {
306
                    validatorAdd.resetForm();
307
                    if(jQuery.type(response['data']) == 'string') {
308
                        $.fn.showError(response['data']);
309
                    } else  {
310
                        $.each(response['data'], function( fieldname, errors ) {
311
                            $.fn.showFormErrorValidator('#form-topic-add #' + fieldname, errors);
312
                        });
313
                    }
314
                }
315
            }).fail(function( jqXHR, textStatus, errorThrown) {
5709 nelberth 316
 
5575 nelberth 317
				console.log(jqXHR)
1 www 318
                $.fn.showError(textStatus);
319
            }).always(function() {
5709 nelberth 320
				$('.info_noticia').prop('disabled', false);
1 www 321
                NProgress.done();
322
            });
323
            return false;
324
        },
325
        invalidHandler: function(form, validator) {
326
 
327
        }
328
    });
329
 
330
    var validatorEdit  = $('#form-topic-edit').validate({
331
        debug: true,
332
        onclick: false,
333
        onkeyup: false,
334
        ignore: [],
335
        rules: {
336
            'name': {
337
                required: true,
338
                maxlength: 128,
339
            },
340
            'description': {
341
                updateCkeditor:function() {
342
                        CKEDITOR.instances.description_edit.updateElement();
343
                },
344
                required: true
345
            },
346
           'file': {
5982 nelberth 347
                required: true,
1 www 348
            },
349
            'order' : {
350
                required: true,
351
                digits: true,
352
                min: 1,
353
                max: 250
354
            },
355
            'status' : {
356
                required: true,
357
            },
358
 
359
        },
360
        submitHandler: function(form)
361
        {
362
            var formdata = false;
363
            if (window.FormData){
364
                formdata = new FormData(form); //form[0]);
365
            }
366
 
7060 nelberth 367
            $('.info_noticia').prop('disabled', true);
5982 nelberth 368
			NProgress.start();
1 www 369
            $.ajax({
370
                'dataType'  : 'json',
371
                'accept'    : 'application/json',
372
                'method'    : 'post',
373
                'url'       :  $('#form-topic-edit').attr('action'),
374
                'data'      :  formdata,
375
                'processData': false,
376
                'contentType': false,
377
            }).done(function(response) {
378
                if(response['success']) {
379
                    $.fn.showSuccess(response['data']);
380
 
5994 nelberth 381
                    $('body, html').animate({scrollTop: '0px'}, 300);
5898 nelberth 382
					$('#content1').css('display','block');
383
            		$('#topicEdit').css('display','none');
1 www 384
                    gridTable.api().ajax.reload(null, false);
385
                } else {
386
                    validatorAdd.resetForm();
387
                    if(jQuery.type(response['data']) == 'string') {
388
                        $.fn.showError(response['data']);
389
                    } else  {
390
                        $.each(response['data'], function( fieldname, errors ) {
391
                            $.fn.showFormErrorValidator('#form-topic-edit #' + fieldname, errors);
392
                        });
393
                    }
394
                }
395
            }).fail(function( jqXHR, textStatus, errorThrown) {
396
                $.fn.showError(textStatus);
397
            }).always(function() {
7060 nelberth 398
 
399
				$('.info_noticia').prop('disabled', false);
1 www 400
                NProgress.done();
401
            });
402
            return false;
403
        },
404
        invalidHandler: function(form, validator) {
405
 
406
        }
407
    });
408
 
409
 
410
 
411
        $('body').on('click', '.btn-view-image-app', function(e) {
412
            e.preventDefault();
413
 
414
            $('#image-app').attr('src', $(this).data('href'));
415
            $('#modalImageApp').modal('show');
416
            return false;
417
        });
418
 
419
        $('#form-topic-add #order').inputNumberFormat({decimal: 0});
5741 nelberth 420
 
1 www 421
 
422
 
423
        $('body').on('click', 'button.btn-add', function(e) {
424
            e.preventDefault();
6015 nelberth 425
 
1 www 426
            $('#form-topic-add #name').val('');
427
            $('#form-topic-add #order').val('1');
5536 nelberth 428
            $('#form-topic-add #name').val('');
1 www 429
 
430
            $('#form-topic-add #status').val('');
431
 
432
 
433
            CKEDITOR.instances.description_add.setData('');
434
            validatorAdd.resetForm();
4693 nelberth 435
            $('#content1').css('display','none');
436
            $('#addImage').css('display','block');
4829 nelberth 437
			iniciarEditor()
4693 nelberth 438
 
1 www 439
            return false;
440
        });
5646 nelberth 441
		$('body').on('click', '#ir_atras', function(e) {
442
            e.preventDefault();
443
 
444
 
5710 nelberth 445
			$('body, html').animate({scrollTop: '0px'}, 300);
5646 nelberth 446
            $('#content1').css('display','block');
447
            $('#addImage').css('display','none');
5910 nelberth 448
			$('#topicEdit').css('display','none');
1 www 449
 
5646 nelberth 450
 
451
            return false;
452
        });
453
 
1 www 454
 
455
        $('#form-topic-edit #order').inputNumberFormat({decimal: 0});
456
 
5902 nelberth 457
       /* $('#form-topic-edit #file').fileinput({
1 www 458
            theme: 'fas',
459
            language: 'es',
460
            showUpload: false,
461
            dropZoneEnabled: false,
462
            maxFileCount: 1,
463
            allowedFileExtensions: ['jpeg', 'jpg', 'png'],
464
            msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $image_size',
5902 nelberth 465
        });*/
1 www 466
 
8591 nelberth 467
 
1 www 468
        $('body').on('click', 'button.btn-edit', function(e) {
469
            e.preventDefault();
6015 nelberth 470
 
1 www 471
            var url = $(this).data('href');
5900 nelberth 472
			NProgress.start();
1 www 473
            $.ajax({
474
                'dataType'  : 'json',
475
                'accept'    : 'application/json',
476
                'method'    : 'get',
477
                'url'       :  url,
478
            }).done(function(response) {
479
                if(response['success']) {
5913 nelberth 480
					console.log(response['data'])
1 www 481
                    $('#form-topic-edit')[0].reset();
482
 
483
                    $('#form-topic-edit').attr('action',url);
6078 nelberth 484
                    $('#form-topic-edit #name').val(response['data']['name']);
1 www 485
                    $('#form-topic-edit #order').val(response['data']['order']);
486
 
5919 nelberth 487
					 $('#form-topic-edit #status').val(response['data']['status']);
1 www 488
 
489
                    CKEDITOR.instances.description_edit.setData(response['data']['description']);
490
                    validatorEdit.resetForm();
5898 nelberth 491
					$('#content1').css('display','none');
492
            		$('#topicEdit').css('display','block');
6015 nelberth 493
					iniciarEditor(false,response['data']['image']);
1 www 494
                } else {
495
                    validatorEdit.resetForm();
496
                    if(jQuery.type(response['data']) == 'string') {
497
                        $.fn.showError(response['data']);
498
                    } else  {
499
                        $.each(response['data'], function( fieldname, errors ) {
500
                            $.fn.showFormErrorValidator('#form-topic-edit #' + fieldname, errors);
501
                        });
502
                    }
503
                }
504
            }).fail(function( jqXHR, textStatus, errorThrown) {
505
                $.fn.showError(textStatus);
506
            }).always(function() {
507
                NProgress.done();
508
            });
509
        });
510
 
511
        $('body').on('click', 'button.btn-cancel', function(e) {
512
            e.preventDefault();
513
            $('#modalTopicAdd').modal('hide');
5895 nelberth 514
            $('#topicEdit').modal('hide');
1 www 515
        });
516
 
517
        $('body').on('click', 'button.btn-refresh', function(e) {
518
            e.preventDefault();
519
            gridTable.api().ajax.reload(null, false);
520
        });
521
 
8290 stevensc 522
        CKEDITOR.replace('description_add', {
523
			toolbar: [
524
                    { name: 'editing', items: ['Scayt'] },
525
                    { name: 'links', items: ['Link', 'Unlink'] },
526
                    { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
527
                    { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
528
                    '/',
529
                    { name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
530
                    { name: 'styles', items: ['Styles', 'Format'] },
531
                    { name: 'tools', items: ['Maximize'] }
532
                ],
533
                removePlugins: 'elementspath,Anchor',
534
                heigth: 100
535
		});
536
        CKEDITOR.replace('description_edit', {
537
			toolbar: [
538
                    { name: 'editing', items: ['Scayt'] },
539
                    { name: 'links', items: ['Link', 'Unlink'] },
540
                    { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
541
                    { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
542
                    '/',
543
                    { name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
544
                    { name: 'styles', items: ['Styles', 'Format'] },
545
                    { name: 'tools', items: ['Maximize'] }
546
                ],
547
                removePlugins: 'elementspath,Anchor',
548
                heigth: 100
549
		});
1 www 550
 
4798 nelberth 551
 
552
 
553
		/*Script del editor (Aqui comienza el cielo y la tierra) */
4803 nelberth 554
		var imagenServidorNoticia;
555
		var scroll_altura,viente;
556
		var nombre_user = $(".perfil_u_nombre").text();
557
		var primer_nombre = nombre_user.split(" ")[0];
11026 nelberth 558
		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 class="recortar_texto">LABEL_CUT</div><div id="blockCelda"><span class="fa fa-unlock"></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_TEXT</div><div class="fa fa-times" id="cerrar_text_modal"></div></div><div class="fonts mb-20"><select name="fuentes" id="selectFuente" class="select-custom mr-2"><option value="arial" selected>LABEL_FONT_ARIAL</option><option value="calibri">LABEL_FONT_CALIBRI</option><option value="forte">LABEL_FONT_FORTE</option><option value="impact">LABEL_FONT_IMPACT</option><option value="jokerman">LABEL_FONT_JOKERMAN</option><option value="mv boli">LABEL_FONT_MV_BOLI</option><option value="times new roman">LABEL_FONT_TIMES_NEW_ROMAN</option><option value="verdana">LABEL_FONT_VERDANA</option><option value="vivaldi">LABEL_FONT_VIVALDI</option></select><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 mb-20"> <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><div class="color_letra font"><label>A</label><input type="color" class="" data-tooltip="Color de la letra" name="" id="color" value="#ffffff"/></div><div class="font fa" data-tooltip="Sombra de la letra" id="shadow">S</div><div class="font" id="rectangulo" data-tooltip="Fondo de la letra"> <div class="rectangulo">F</div></div></div><div class="color_fondo_cuadro mb-20 flex-column" style="display:none"> <div class="w-100 d-flex justify-content-between border-bottom"><label for="colorrect" class="font-weight-normal d-flex align-items-center" style="margin:0 !important">LABEL_COLOR_BACKGROUND: </label><input type="color" name="" id="colorrect" value="#000000" style="width:30px" data-tooltip="Color del fondo" class="mr-2"/></div><div class="d-flex flex-column"><label for="opacidad" class="font-weight-normal mt-2">LABEL_BACKGROUND_TRANSPARENCY</label><input type="range" id="opacidad" max="100" min="1" step="1" value="100" ></div></div><input id="texto_input" type="text" name="texto" placeholder="LABEL_ADD_TEXT_HERE"/> </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 mb-20"> <div>LABEL_FILTERS</div><div class="fa fa-times" id="cerrar_filter_modal"></div></div><div class="fonts mb-20"> <select name="filtros" id="selectFiltro" class="select-custom"><option class="opcion_editor" value="normal">LABEL_FILTER_NORMAL</option><option class="opcion_editor" value=".5,1.3,1.31,1.33,1.38">LABEL_FILTER_NIGHT</option><option class="opcion_editor" value=".7,1.1,1.64,1.66,1.50">LABEL_FILTER_SAINT_ANA</option><option class="opcion_editor" value=".75,1,1.66,1.60,1.51">LABEL_FILTER_CREAM</option><option class="opcion_editor" value=".7,1.2,1.49,1.49,1.6">LABEL_FILTER_MAGIC</option><option class="opcion_editor" value=".7,1.2,1.60,1.66,1.58">LABEL_FILTER_RELIEF</option><option class="opcion_editor" value=".9,.9,1.45,1.54,1.54">LABEL_FILTER_LIGHT</option><option class="opcion_editor" value="1,1.5,1,1,1">LABEL_FILTER_SATURATION</option><option class="opcion_editor" value=".9,1.3,1,1,1">LABEL_FILTER_RETOUCH</option><option class="opcion_editor" value=".8,1,1.6,1.45,1.49">LABEL_FILTER_ORANGE</option><option class="opcion_editor" value=".8,.75,1.60,1.66,1.58">LABEL_FILTER_WIND</option><option class="opcion_editor" value=".8,.9,1.66,1.43,1.28">LABEL_FILTER_DESERT</option><option class="opcion_editor" value=".85,.75,1.47,1.66,1.54">LABEL_FILTER_FOREST</option><option class="opcion_editor" value=".8,.8,1.71,1.64,1.58">LABEL_FILTER_TOWN</option><option class="opcion_editor" value=".8,1.2,1.24,.99,1">LABEL_FILTER_PINK</option><option class="opcion_editor" value=".9,1.1,1.33,1.19,.91">LABEL_FILTER_HISTORY</option><option class="opcion_editor" value="1,1,gris">LABEL_FILTER_GRAY</option><option class="opcion_editor" value=".8,1.5,gris">LABEL_FILTER_OLD_PICTURE</option><option class="opcion_editor" value=".9,1.2,26,-12,0,2">LABEL_FILTER_CHARMING</option><option class="opcion_editor" value="1.1,1.4,40,12,-6,2">LABEL_FILTER_EMOTION</option><option class="opcion_editor" value=".9,1.32,56,47,17,2">LABEL_FILTER_BEIGE</option><option class="opcion_editor" value=".87,1.19,55,37,23,2">LABEL_FILTER_FINE</option><option class="opcion_editor" value="1.2,.9,67,13,-23,2">LABEL_FILTER_LORD</option><option class="opcion_editor" value="1.2,1.2,35,7,18,2">LABEL_FILTER_70S</option><option class="opcion_editor" value=".92,1.23,-11,11,11,2">LABEL_FILTER_TREE</option><option class="opcion_editor" value=" 1,1.4,-3,-1,-12,2">LABEL_FILTER_SUMMER</option><option class="opcion_editor" value=".85,1.26,-15,2,-1,2">LABEL_FILTER_COLD_WEATHER</option><option class="opcion_editor" value="1,1.4,5,12,1,2">LABEL_FILTER_ANGELS</option><option class="opcion_editor" value=".9,1.2,43,-17,-55,2">LABEL_FILTER_HOT</option><option class="opcion_editor" value="1,1.29,29,26,17,2">LABEL_FILTER_FALL</option><option class="opcion_editor" value=".85,1.3,43,25,-11,2">LABEL_FILTER_MARCH</option><option class="opcion_editor" value=".8,1.25,31,41,12,2">LABEL_FILTER_PEAR</option><option class="opcion_editor" value="1,1.36,4,5,1,2">LABEL_FILTER_COMMON</option><option class="opcion_editor" value=".9,1.3,37,-25,1,2">LABEL_FILTER_GOLD</option><option class="opcion_editor" value="1.1,1.3,-47,-42,-30,2">LABEL_FILTER_GOTHIC</option><option class="opcion_editor" value="1,1.4,-5,42,11,2">LABEL_FILTER_FORESTRY</option><option class="opcion_editor" value=".9,1.2,-5,-7,4,2">LABEL_FILTER_MOON</option><option class="opcion_editor" value="1.1,1.3,-1,-1,26,2">LABEL_FILTER_PARTY</option> </select> </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> <div class="canvas_imagen"> <div class="canvas recortar"> <div class="canvas_subir d-flex flex-column" id="imagen_noticia"><div>LABEL_DRAG_IMAGE_HERE_OR </div><label class="font-weight-normal mt-2" style="font-size:0.6em"for="imagen_noticia_file"> LABEL_UPLOAD_FILE_IMAGE <div class="ml-2 btn btn-primary btn-sm">LABEL_SELECT_IMAGE</div></label> <input style="display:none" type="file" id="imagen_noticia_file" accept="image/x-png,image/jpeg"></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 class="modificar animated fadeInRight delay-04 fast escalar"> <div> <div class="titulo_recortar"><span class="icon-ungroup fa fa-scissors mb-20"></span>LABEL_CUT</div><div class="opcion_editor recortar10"> <div class="recortar_texto">LABEL_CUT</div><div id="blockCelda"><span class="fa fa-unlock"></span></div></div></div><div class="texto"> <div class="mb-20"> <div class="titulo_texto "><span class="icon-plus fa fa-text-width"></span>LABEL_TEXT</div></div><div class="fonts mb-20"> <select name="fuentes" id="selectFuente" class="select-custom mr-2"> <option value="arial" selected>LABEL_FONT_ARIAL</option> <option value="calibri">LABEL_FONT_CALIBRI</option> <option value="forte">LABEL_FONT_FORTE</option> <option value="impact">LABEL_FONT_IMPACT</option> <option value="jokerman">LABEL_FONT_JOKERMAN</option> <option value="mv boli">LABEL_FONT_MV_BOLI</option> <option value="times new roman">LABEL_FONT_TIMES_NEW_ROMAN</option> <option value="verdana">LABEL_FONT_VERDANA</option> <option value="vivaldi">LABEL_FONT_VIVALDI</option> </select> <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 mb-20"> <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><div class="color_letra font"><label>A</label><input type="color" class="" data-tooltip="Color de la letra" name="" id="color" value="#ffffff"/></div><div class="font fa" data-tooltip="Sombra de la letra" id="shadow">S</div><div class="font" id="rectangulo" data-tooltip="Fondo de la letra"> <div class="rectangulo">F</div></div></div><div class="color_fondo_cuadro mb-20 flex-column" style="display:none"> <div class="w-100 d-flex justify-content-between border-bottom"><label for="colorrect" class="font-weight-normal d-flex align-items-center" style="margin:0 !important">LABEL_COLOR_BACKGROUND: </label><input type="color" name="" id="colorrect" value="#000000" style="width:30px" data-tooltip="Color del fondo" class="mr-2"/></div><div class="d-flex flex-column"><label for="opacidad" class="font-weight-normal mt-2">LABEL_BACKGROUND_TRANSPARENCY</label><input type="range" id="opacidad" max="100" min="1" step="1" value="100" ></div></div><input id="texto_input" type="text" name="texto" placeholder="LABEL_ADD_TEXT_HERE"/> <div class="mb-20"> <div class="titulo_filtro"><span class="icon-eyedropper fa fa-eyedropper"></span>LABEL_FILTERS</div></div><div class="fonts mb-20"> <select name="filtros" id="selectFiltro" class="select-custom selectFiltro"><option class="opcion_editor" value="normal" >LABEL_FILTER_NORMAL</option><option class="opcion_editor" value=".5,1.3,1.31,1.33,1.38">LABEL_FILTER_NIGHT</option><option class="opcion_editor" value=".7,1.1,1.64,1.66,1.50">LABEL_FILTER_SAINT_ANA</option><option class="opcion_editor" value=".75,1,1.66,1.60,1.51">LABEL_FILTER_CREAM</option><option class="opcion_editor" value=".7,1.2,1.49,1.49,1.6">LABEL_FILTER_MAGIC</option><option class="opcion_editor" value=".7,1.2,1.60,1.66,1.58">LABEL_FILTER_RELIEF</option><option class="opcion_editor" value=".9,.9,1.45,1.54,1.54">LABEL_FILTER_LIGHT</option><option class="opcion_editor" value="1,1.5,1,1,1">LABEL_FILTER_SATURATION</option><option class="opcion_editor" value=".9,1.3,1,1,1">LABEL_FILTER_RETOUCH</option><option class="opcion_editor" value=".8,1,1.6,1.45,1.49">LABEL_FILTER_ORANGE</option><option class="opcion_editor" value=".8,.75,1.60,1.66,1.58">LABEL_FILTER_WIND</option><option class="opcion_editor" value=".8,.9,1.66,1.43,1.28">LABEL_FILTER_DESERT</option><option class="opcion_editor" value=".85,.75,1.47,1.66,1.54">LABEL_FILTER_FOREST</option><option class="opcion_editor" value=".8,.8,1.71,1.64,1.58">LABEL_FILTER_TOWN</option><option class="opcion_editor" value=".8,1.2,1.24,.99,1">LABEL_FILTER_PINK</option><option class="opcion_editor" value=".9,1.1,1.33,1.19,.91">LABEL_FILTER_HISTORY</option><option class="opcion_editor" value="1,1,gris">LABEL_FILTER_GRAY</option><option class="opcion_editor" value=".8,1.5,gris">LABEL_FILTER_OLD_PICTURE</option><option class="opcion_editor" value=".9,1.2,26,-12,0,2">LABEL_FILTER_CHARMING</option><option class="opcion_editor" value="1.1,1.4,40,12,-6,2">LABEL_FILTER_EMOTION</option><option class="opcion_editor" value=".9,1.32,56,47,17,2">LABEL_FILTER_BEIGE</option><option class="opcion_editor" value=".87,1.19,55,37,23,2">LABEL_FILTER_FINE</option><option class="opcion_editor" value="1.2,.9,67,13,-23,2">LABEL_FILTER_LORD</option><option class="opcion_editor" value="1.2,1.2,35,7,18,2">LABEL_FILTER_70S</option><option class="opcion_editor" value=".92,1.23,-11,11,11,2">LABEL_FILTER_TREE</option><option class="opcion_editor" value=" 1,1.4,-3,-1,-12,2">LABEL_FILTER_SUMMER</option><option class="opcion_editor" value=".85,1.26,-15,2,-1,2">LABEL_FILTER_COLD_WEATHER</option><option class="opcion_editor" value="1,1.4,5,12,1,2">LABEL_FILTER_ANGELS</option><option class="opcion_editor" value=".9,1.2,43,-17,-55,2">LABEL_FILTER_HOT</option><option class="opcion_editor" value="1,1.29,29,26,17,2">LABEL_FILTER_FALL</option><option class="opcion_editor" value=".85,1.3,43,25,-11,2">LABEL_FILTER_MARCH</option><option class="opcion_editor" value=".8,1.25,31,41,12,2">LABEL_FILTER_PEAR</option><option class="opcion_editor" value="1,1.36,4,5,1,2">LABEL_FILTER_COMMON</option><option class="opcion_editor" value=".9,1.3,37,-25,1,2">LABEL_FILTER_GOLD</option><option class="opcion_editor" value="1.1,1.3,-47,-42,-30,2">LABEL_FILTER_GOTHIC</option><option class="opcion_editor" value="1,1.4,-5,42,11,2">LABEL_FILTER_FORESTRY</option><option class="opcion_editor" value=".9,1.2,-5,-7,4,2">LABEL_FILTER_MOON</option><option class="opcion_editor" value="1.1,1.3,-1,-1,26,2">LABEL_FILTER_PARTY</option> </select> </div></div></div></div></div></div><dav class="fixed_noticia"></dav><dav class="cuadro_noticias animated bounceInUp delay-04" id="cuadro_noticias"> <dav class="relative"> <div class="titulo_topico">LABEL_TITLE_TOPIC</div><canvas class="imagen_noticias" id="imagen_noticias" width="320" height="480"></canvas> </dav> <div class="progreso d-flex align-items-center justify-content-between"><progress value="0" max="100"></progress><span class="ml-2">0.0%</span></div></dav>'
5207 nelberth 559
		$(document).on("click", ".info_noticia", function(e){
5709 nelberth 560
			imagenServidorNoticia = elemento.toDataURL("image/jpeg", 1.0);
5989 nelberth 561
			$('.file').val(imagenServidorNoticia.split(',')[1]);
5709 nelberth 562
			$(".c1").addClass("paso");
563
		})
6045 nelberth 564
		var edit;
6015 nelberth 565
		function iniciarEditor(add=true, image=''){
5864 nelberth 566
		 cortar=false;
4803 nelberth 567
		recorte_listo=false;
568
		texto="";
569
		seis=true;
570
		color="#ffffff";
571
		texto_listo=false,siete=false;
572
		uno=true;
573
		size=48;
10804 nelberth 574
		blockCelda=false;
4803 nelberth 575
		cinco=true;
4944 nelberth 576
		xf=320,yf =480;
4803 nelberth 577
		negritas=false, bold="";
578
		shadow = true, nueve=true;
579
		italic=false, ita="";
580
		rectangulo=false, diez=false;
581
     	fontfamily="Arial";
582
     	r=0,g=0,b=0,a=1;
6049 nelberth 583
		 edit=add;
4806 nelberth 584
		window.clearInterval(editorNoticia);
5202 nelberth 585
		setTimeout(function(){
586
			scroll_altura=$(".articulo_noticia").offset().top-110;
4821 nelberth 587
			anchoFondoOscuro = $(".articulo_noticia").width();
4823 nelberth 588
			altoFondoOscuro = $(".editor_imagenes").height();
4821 nelberth 589
			$(".fondo_oscuro").css("width",""+anchoFondoOscuro+"px");
4825 nelberth 590
			$(".fondo_oscuro").css("height",""+altoFondoOscuro+"px");
5202 nelberth 591
 
6022 nelberth 592
		},navegacion(nuevoHtmlImagen,edit,image));
5202 nelberth 593
 
4829 nelberth 594
		}
4798 nelberth 595
 
4801 nelberth 596
		$(document).on("click", ".volver", function(){
597
		var nombre_user = $(".perfil_u_nombre").text();
598
		var primer_nombre = nombre_user.split(" ")[0];
5864 nelberth 599
		 cortar=false;
4801 nelberth 600
		cinco=true;
601
		recorte_listo=false;
602
		texto="";
603
		seis=true;
604
		color="#ffffff";
605
		texto_listo=false,siete=false;
606
		uno=true;
10803 nelberth 607
		blockCelda=false;
4801 nelberth 608
		size=48;
8591 nelberth 609
 
8593 nelberth 610
 
4944 nelberth 611
		xf=320,yf =480;
4801 nelberth 612
		negritas=false, bold="";
613
		shadow = true, nueve=true;
614
		italic=false, ita="";
615
		rectangulo=false, diez=false;
616
     	fontfamily="Arial";
617
     	r=0,g=0,b=0,a=1;
4804 nelberth 618
		 var imagenServidorNoticia;
6048 nelberth 619
		 console.log(edit)
4801 nelberth 620
		window.clearInterval(editorNoticia);
621
		setTimeout(function(){
622
			scroll_altura=$(".articulo_noticia").offset().top-110;
623
			anchoFondoOscuro = $(".articulo_noticia").width();
4823 nelberth 624
			altoFondoOscuro = $(".editor_imagenes").height();
4801 nelberth 625
			$(".fondo_oscuro").css("width",""+anchoFondoOscuro+"px");
4825 nelberth 626
			$(".fondo_oscuro").css("height",""+altoFondoOscuro+"px");
4801 nelberth 627
 
6022 nelberth 628
		},navegacion(nuevoHtmlImagen,edit,'',false));
4815 nelberth 629
 
4816 nelberth 630
		})
4801 nelberth 631
 
6018 nelberth 632
		function navegacion(nuevoHtmlImagen,add,image,reload=true){
5908 nelberth 633
			if(add){
8594 nelberth 634
				edit=true;
11026 nelberth 635
				$('#contenido2').html('')
636
				$('#contenido').html(nuevoHtmlImagen)
6001 nelberth 637
 
5908 nelberth 638
			}else{
6017 nelberth 639
				if(reload){
640
					$('#contenido').html('')
641
					const getBase64FromUrl = async (url) => {
642
						const data = await fetch(url);
643
						const blob = await data.blob();
644
						return new Promise((resolve) => {
645
							const reader = new FileReader();
646
							reader.readAsDataURL(blob);
647
							reader.onloadend = function() {
648
							const base64data = reader.result;
649
							resolve(base64data);
650
							}
651
						});
652
					}
653
 
654
					getBase64FromUrl(image).then(function(e){
6080 nelberth 655
						$('#form-topic-edit #name').trigger('change');
6017 nelberth 656
						$(".volver").css("display","block")
657
						$(".a1").addClass("paso");
658
						$(".titulo_pasos").html("LABEL_STEP_2");
659
						setTimeout(function(){
660
							recorte_listo=true;
661
							$(".fondo_oscuro").css("display","none");
662
							$("#boton_recortar").removeClass("recortar").text("LABEL_SEND").addClass("info_noticia").attr('type','submit');
663
							$(".recortar10").removeClass("recortar");
664
							$(".canvas").removeClass("recortar");
665
							$(".b1").addClass("paso");
666
							$(".titulo_pasos").html("LABEL_STEP_3");
667
							if(texto!=""){
668
								seis=true;
669
								siete=true;
670
							}
671
							cinco=true;
672
							dos=true;
673
							cuatro=true;
674
							actualizar();
5979 nelberth 675
 
6017 nelberth 676
						},editorNoticia(e));
677
 
678
 
679
					})
6021 nelberth 680
 
681
					setTimeout(function(){
6017 nelberth 682
						$(".canvas_subir").html('<span class="icon-plus fa fa-spinner"></span> Cargando...')
6081 nelberth 683
						$('#form-topic-edit #name').trigger('change');
6017 nelberth 684
					},$('#contenido2').html(nuevoHtmlImagen));
685
				}else{
8595 nelberth 686
 
8596 nelberth 687
					edit=true;
6017 nelberth 688
					$('#contenido').html('')
6082 nelberth 689
					setTimeout(function(){
690
						$('#form-topic-edit #name').trigger('change');
691
					},$('#contenido2').html(nuevoHtmlImagen));
6017 nelberth 692
				}
5978 nelberth 693
			}
694
		}
4816 nelberth 695
 
4798 nelberth 696
		$(window).on("scroll", function(){
5132 nelberth 697
			console.log(scroll_altura)
4798 nelberth 698
		if($(window).scrollTop()>scroll_altura){
699
			$("#cuadro_noticias").addClass("fixed");
700
		}else{
701
			$("#cuadro_noticias").removeClass("fixed");
702
		}
703
	})
10792 nelberth 704
	$(window).resize(function() {
705
		anchoFondoOscuro = $(".articulo_noticia").width();
706
		altoFondoOscuro = $(".editor_imagenes").height();
707
		$(".fondo_oscuro").css("width",""+anchoFondoOscuro+"px");
708
		$(".fondo_oscuro").css("height",""+altoFondoOscuro+"px");
10810 nelberth 709
		setTimeout(function(){
710
			anchoFondoOscuro = $(".articulo_noticia").width();
711
			altoFondoOscuro = $(".editor_imagenes").height();
712
			$(".fondo_oscuro").css("width",""+anchoFondoOscuro+"px");
713
			$(".fondo_oscuro").css("height",""+altoFondoOscuro+"px");
10814 nelberth 714
		},300)
10810 nelberth 715
 
10792 nelberth 716
	});
5129 nelberth 717
 
4798 nelberth 718
	$(document).on("dragover", "#imagen_noticia", function(e){
719
		e.preventDefault();
720
		e.stopPropagation();
721
		$(this).css({"background":"rgba(0,0,0,.2)"})
722
	})
723
	$(document).on("drop", "#imagen_noticia", function(e){
724
		e.preventDefault();
725
		e.stopPropagation();
726
		$(this).css("background", "none");
727
		var archivo = e.originalEvent.dataTransfer.files;
728
		var img=archivo[0];
5926 nelberth 729
		if(img.type =="image/jpeg"||img.type =="image/png"){
4798 nelberth 730
			$(".modificar").removeClass("animated");
731
			var render = new FileReader();
732
			render.readAsDataURL(img);
733
			render.onload = function(e){
8345 nelberth 734
				imagen2=new Image();
735
				imagen2.src=e.target.result;
8349 nelberth 736
 
737
				$(imagen2).ready(function(e){
8517 nelberth 738
					if(imagen2.width<200||imagen2.height<200){
8360 nelberth 739
						$.fn.showError('LABEL_MINIMUM_IMAGE_SIZE');
8349 nelberth 740
					}else{
741
						$(".volver").css("display","block")
742
						$(".a1").addClass("paso");
743
						$(".titulo_pasos").html("LABEL_STEP_2");
8351 nelberth 744
						editorNoticia(imagen2.src)
8349 nelberth 745
					}
8350 nelberth 746
				})
8349 nelberth 747
			}
8344 nelberth 748
		}else{
8360 nelberth 749
			$.fn.showError('LABEL_SUPPORTED_FORMATS');
5926 nelberth 750
		}
8346 nelberth 751
	})
10866 nelberth 752
	$(document).on("change", "#imagen_noticia_file", function(e){
753
		file = $(this)[0].files[0];
10867 nelberth 754
		e.preventDefault();
10866 nelberth 755
		$(this).css("background", "none");
10867 nelberth 756
		var archivo = file;
10869 nelberth 757
		var img=file;
10866 nelberth 758
		if(img.type =="image/jpeg"||img.type =="image/png"){
759
			$(".modificar").removeClass("animated");
760
			var render = new FileReader();
761
			render.readAsDataURL(img);
762
			render.onload = function(e){
763
				imagen2=new Image();
764
				imagen2.src=e.target.result;
765
 
766
				$(imagen2).ready(function(e){
10914 nelberth 767
					if(imagen2.width<320||imagen2.height<480){
10866 nelberth 768
						$.fn.showError('LABEL_MINIMUM_IMAGE_SIZE');
769
					}else{
770
						$(".volver").css("display","block")
771
						$(".a1").addClass("paso");
772
						$(".titulo_pasos").html("LABEL_STEP_2");
773
						editorNoticia(imagen2.src)
774
					}
775
				})
776
			}
777
		}else{
778
			$.fn.showError('LABEL_SUPPORTED_FORMATS');
10868 nelberth 779
		}
10866 nelberth 780
	})
4798 nelberth 781
	$(document).on("dragover", "body", function(e){
782
		e.preventDefault();
783
		e.stopPropagation();
784
	})
785
	$(document).on("drop", "body", function(e){
786
		e.preventDefault();
787
		e.stopPropagation();
788
	})
789
 
5741 nelberth 790
	var canvas='<div class="editorNoticia"><canvas id="editorNoticia">LABEL_NOT_SUPPORTED</canvas></div>';
4798 nelberth 791
	$(document).on("mouseover", ".editorNoticia", function(){
12337 nelberth 792
		const getScrollBarWidth = () => window.innerWidth - document.documentElement.getBoundingClientRect().width
12339 nelberth 793
		let anchoScroll= getScrollBarWidth()+"px";
4798 nelberth 794
		$("body").css({"overflow": "hidden"});
12343 nelberth 795
		$(".cuadro_noticias, .fixed_noticia,.tituloEditor,.grid-padre,.subpanel").css("margin-right",anchoScroll )
796
		$(".barra,.footer").css("padding-right",anchoScroll)
4798 nelberth 797
 
798
 
799
	})
800
	$(document).on("mouseover", "#editorNoticia", function(){
801
		if(recorte_listo){
802
			ocho=true;
803
		}
804
	})
805
	$(document).on("mouseout", "#editorNoticia", function(){
806
		if(recorte_listo){
807
			ocho=false;
808
			actualizar2()
809
		}
810
	})
811
	$(document).on("mouseout", ".editorNoticia",function(){
812
		$("body").css({"overflow": "auto"})
12343 nelberth 813
		$(".cuadro_noticias, .fixed_noticia,.tituloEditor,.grid-padre,.subpanel").css("margin-right", "0px")
814
		$(".barra,.footer").css("padding-right","0px")
4798 nelberth 815
 
816
	})
817
	$(document).on('mousewheel', ".editorNoticia",function(e){
818
		var ruedita = e.originalEvent.wheelDelta
819
		if(ruedita>0){
820
			scale = scale+(scale/10);
821
			$("#porciento_scale").html((scale*100).toFixed(2)+"%")
822
		}else{
823
			scale = scale-(scale/10);
824
			$("#porciento_scale").html((scale*100).toFixed(2)+"%")
825
		}
826
		$("#editorNoticia").css({"transform": "scale("+scale+")"});
827
	})
828
	$(document).on("click", ".as", function(e){
829
		e.preventDefault();
830
		 scale = $(this).data("scale");
831
		 $("#porciento_scale").html((scale*100).toFixed(2)+"%")
832
		 $("#editorNoticia").css({"transform": "scale("+scale+")"});
833
 
834
	})
835
	$(document).on("click", ".ps", function(e){
836
		e.preventDefault();
837
		$(".cantidades_scale").slideToggle(200).css("display", "block");
838
	})
5789 nelberth 839
	$(document).on("click", "#cerrar_filter_modal, .icon_filter", function(e){
840
		e.preventDefault();
5854 nelberth 841
		if(recorte_listo){
5789 nelberth 842
		$(".contenido_filter").slideToggle(200).css("display", "block");
5854 nelberth 843
		}
5789 nelberth 844
	})
5805 nelberth 845
	$(document).on("click", "#cerrar_text_modal, .icon_text", function(e){
846
		e.preventDefault();
5854 nelberth 847
		if(recorte_listo){
5855 nelberth 848
			$(".contenido_text").slideToggle(200).css("display", "block");
5854 nelberth 849
		}
5805 nelberth 850
	})
5865 nelberth 851
 
5816 nelberth 852
	$(document).on("click", "#cerrar_cut_modal, .icon_cut", function(e){
853
		e.preventDefault();
5861 nelberth 854
		if(cortar){
5854 nelberth 855
			$(".contenido_cut").slideToggle(200).css("display", "block");
5861 nelberth 856
		}
5854 nelberth 857
 
5816 nelberth 858
	})
4798 nelberth 859
	$(document).on("click", "#menos_scale", function(e){
860
		e.preventDefault();
861
		scale = scale-(scale/10);
862
		 $("#porciento_scale").html((scale*100).toFixed(2)+"%")
863
		 $("#editorNoticia").css({"transform": "scale("+scale+")"});
864
	})
865
 
866
	$(document).on("click", "#mas_scale", function(e){
867
		e.preventDefault();
868
		scale = scale+(scale/10);
869
		 $("#porciento_scale").html((scale*100).toFixed(2)+"%")
870
		 $("#editorNoticia").css({"transform": "scale("+scale+")"});
871
	})
10747 nelberth 872
	$(document).on('change', '#selectFiltro', function(e){
10770 nelberth 873
 
10747 nelberth 874
		data=$(this).val()
10786 nelberth 875
		if(data=="normal"){
876
			filter();
10788 nelberth 877
		}else{
878
			data=data.split(',');
10805 nelberth 879
			if(data[2]=='gris'){
10788 nelberth 880
				filtergris(data[0],data[1]);
10805 nelberth 881
			}else{
10788 nelberth 882
				filter(Number(data[0]),Number(data[1]),Number(data[2]),Number(data[3]),Number(data[4]),Number(data[5]));
883
			}
10770 nelberth 884
		}
885
 
10783 nelberth 886
 
10788 nelberth 887
 
10747 nelberth 888
	})
10764 nelberth 889
 
10789 nelberth 890
 
4798 nelberth 891
	var texto_listo=false,siete=false;
892
	var texto;
893
	$(document).on("keyup", "#texto_input", function(e){
894
		e.preventDefault();
895
		texto = $(this).val();
896
		if(texto_actualizar){
897
			siete=true;
898
		}
899
		if(texto!=""){
900
			texto_actualizar=true;
901
			actualizar2();
902
		}else{
903
			actualizar2();
904
		}
905
 
906
	})
907
	var color="#ffffff";
10734 nelberth 908
 
10943 nelberth 909
	$(document).on("change input", "#color", function(){
4798 nelberth 910
    	color=$(this).val();
911
    	seis=true;
912
    	actualizar2();
913
    })
914
    var size=48;
10858 nelberth 915
	$(document).on("keypress", "#font-size, #texto_input", function(e){
10857 nelberth 916
    	if(e.which == 13){
917
      		return false;
918
    	}
919
  	});
920
    $(document).on("keyup change", "#font-size", function(e){
10855 nelberth 921
		e.preventDefault();
4798 nelberth 922
    	size=$(this).val();
923
    	size = parseInt(size);
924
    	seis=true;
925
    	siete=true;
926
    	actualizar2();
927
    })
928
    var negritas=false, bold="";
929
    $(document).on("click", "#negritas", function(e){
930
    	e.preventDefault();
931
    	if(!negritas){
932
    		bold="bold";
933
    		$(this).addClass("fa");
934
    		seis=true;
935
    		siete=true;
936
    		actualizar2();
937
    		negritas=true;
938
    	}else{
939
    		bold="";
940
    		$(this).removeClass("fa");
941
    		seis=true;
942
    		siete=true;
943
    		actualizar2();
944
    		negritas=false;
945
    	}
946
    })
947
    var italic=false, ita="";
948
     $(document).on("click", "#italic", function(e){
949
    	e.preventDefault();
950
    	if(!italic){
951
    		ita="italic";
952
    		$(this).addClass("fa");
953
    		seis=true;
954
    		siete=true;
955
    		actualizar2();
956
    		italic=true;
957
    	}else{
958
    		ita="";
959
    		$(this).removeClass("fa");
960
    		seis=true;
961
    		siete=true;
962
    		actualizar2();
963
    		italic=false;
964
    	}
965
    })
966
     var fontfamily="Arial";
10616 nelberth 967
     $(document).on("change", "#selectFuente", function(e){
4798 nelberth 968
    	e.preventDefault();
10618 nelberth 969
    	fontfamily= $(this).val();
4798 nelberth 970
    	seis=true;
971
    	siete=true;
972
    	actualizar2();
973
 
5149 nelberth 974
    })
4798 nelberth 975
     var shadow = true, nueve=true;
5149 nelberth 976
     $(document).on("click","#shadow", function(e){
4798 nelberth 977
     	e.preventDefault();
978
     	if(shadow){
979
     		$(this).removeClass("fa");
980
     		seis=true;
981
     		nueve=false;
982
     		actualizar2();
983
     		shadow=false;
984
     	}else{
985
     		$(this).addClass("fa");
986
     		seis=true;
987
     		nueve=true;
988
     		actualizar2();
989
     		shadow=true;
990
     	}
991
 
5149 nelberth 992
     })
4798 nelberth 993
     var rectangulo=false, diez=false, colorrect="#000000";
5149 nelberth 994
     $(document).on("click", "#rectangulo", function(e){
4798 nelberth 995
     	e.preventDefault();
996
     	if(!rectangulo){
997
     		$(this).addClass("fa");
10691 nelberth 998
			$('.color_fondo_cuadro').css('display','flex')
4798 nelberth 999
     		diez=true;
1000
     		actualizar2();
1001
     		rectangulo=true;
1002
     	}else{
1003
     		$(this).removeClass("fa");
10689 nelberth 1004
			 $('.color_fondo_cuadro').css('display','none')
4798 nelberth 1005
     		diez=false;
1006
     		actualizar2();
1007
     		rectangulo=false;
1008
     	}
1009
 
5149 nelberth 1010
     })
4798 nelberth 1011
     var r=0,g=0,b=0;
10943 nelberth 1012
    $(document).on("change input", "#colorrect", function(){
4798 nelberth 1013
    	colorrect=$(this).val();
8315 nelberth 1014
    	r=parseInt(colorrect.slice(1,3),16);
1015
    	g=parseInt(colorrect.slice(3,5),16);
1016
    	b=parseInt(colorrect.slice(5,7),16);
4798 nelberth 1017
    	seis=true;
1018
    	actualizar2();
1019
    })
1020
    var a=1;
5149 nelberth 1021
 
10942 nelberth 1022
    $(document).on("mousemove change ", "#opacidad", function(){
4798 nelberth 1023
    	a=$(this).val();
1024
    	a=a/100;
1025
    	seis=true;
1026
    	actualizar2();
5149 nelberth 1027
    })
4798 nelberth 1028
	var imaNoti = new Image();
1029
	function filter(brillo=1, contraste=1, rojo=1, verde=1, azul=1, valor=1){
5073 nelberth 1030
		cuatro=false;
5414 nelberth 1031
		restaurar(brillo, contraste);
4798 nelberth 1032
		datos=imagenOriginal.data;
10783 nelberth 1033
		if(valor==2){
4798 nelberth 1034
			for (var i =  0; i <datos.length; i+=4) {
1035
				datos[i]=datos[i]+rojo;
1036
				datos[i+1]=datos[i+1]+verde;
1037
				datos[i+2]=datos[i+2]+azul;
1038
			}
1039
		}else{
1040
			for (var i =  0; i <datos.length; i+=4) {
1041
				datos[i]=datos[i]*rojo;
1042
				datos[i+1]=datos[i+1]*verde;
1043
				datos[i+2]=datos[i+2]*azul
1044
			}
1045
		}
1046
		editor.putImageData(imagenOriginal,0,0)
1047
		var imagenNoticia = elemento.toDataURL("image/jpeg", 1.0);
1048
	    imaNoti.src = imagenNoticia;
1049
		actualizar2();
1050
	}
1051
	function filtergris(brillo=1, contraste=1){
1052
		cuatro=false;
1053
		restaurar(brillo, contraste);
1054
		datos=imagenOriginal.data;
1055
		var auxiliar;
1056
		for (var i =  0; i <datos.length; i+=4) {
8315 nelberth 1057
			auxiliar = 0.34 * datos[i] + 0.5 *datos[i+1] + 0.16 * datos[i+2];
4798 nelberth 1058
			datos[i]=auxiliar;
1059
			datos[i+1]=auxiliar;
1060
			datos[i+2]=auxiliar;
1061
		}
5429 nelberth 1062
 
4798 nelberth 1063
		editor.putImageData(imagenOriginal,0,0)
1064
		var imagenNoticia = elemento.toDataURL("image/jpeg", 1.0);
1065
	    imaNoti.src = imagenNoticia;
1066
		actualizar2();
1067
	}
1068
	function restaurar(brillo = 1, contraste=1){
1069
		editor.filter = "none"
1070
		editor.filter = 'contrast('+contraste+') brightness('+brillo+') saturate(1) sepia(0)';
5429 nelberth 1071
		editor.fillStyle="rgba(255,255,255,1)"
1072
		editor.fillRect(0,0,ancho,alto);
5458 nelberth 1073
		editor.fillStyle=""+color+"";
5414 nelberth 1074
		var pxf=0,pyf=0;
1075
			if(xf>=(yf/recorte)){
5459 nelberth 1076
				pxf=xf/ancho;
1077
				pyf=yf/pxf;
1078
				py=(alto/2)-(pyf/2);
1079
				editor.drawImage(imagen,x,y,xf,yf,0,py,ancho,pyf);
1080
			}else{
1081
				pyf=yf/alto;
5461 nelberth 1082
				pxf=xf/pyf;
5459 nelberth 1083
				px=(ancho/2)-(pxf/2);
1084
				editor.drawImage(imagen,x,y,xf,yf,px,0,pxf,alto);
1085
			}
4798 nelberth 1086
		imagenOriginal = editor.getImageData(0,0,ancho,alto)
1087
	}
1088
	var ocho=false;
1089
	function actualizar2(){
1090
		if(recorte_listo){
1091
		if(cuatro){
1092
			imagenOriginal = editor.getImageData(0,0,ancho,alto)
1093
			var imagenNoticia = elemento.toDataURL("image/jpeg", 1.0);
1094
	    	imaNoti.src = imagenNoticia;
1095
	    	cuatro=false;
1096
		}
1097
		editor.filter = "none"
5428 nelberth 1098
		$(imaNoti).ready(function(e){
5433 nelberth 1099
			noticia.drawImage(imaNoti,0,0,320,480);
5394 nelberth 1100
			editor.drawImage(imaNoti,0,0,ancho,alto)
4798 nelberth 1101
			if(texto_actualizar){
1102
				if(texto!=""){
1103
					if(seis){
1104
						ancho_imaNoti = imaNoti.width;
5439 nelberth 1105
 
1106
						scale_noticia = -(((ancho_imaNoti-320)/ancho_imaNoti)-1);
4798 nelberth 1107
						editor.fillStyle=""+color+"";
1108
						editor.strokeStyle="rgb(255,255,255)";
1109
						if(nueve){
1110
							editor.shadowColor="rgba(0,0,0,.5)";
1111
							editor.shadowOffsetX=6;
1112
							editor.shadowOffsetY=6;
1113
							editor.shadowBlur=6;
1114
							noticia.shadowColor="rgba(0,0,0,.5)";
1115
							noticia.shadowOffsetX=6*scale_noticia;
1116
							noticia.shadowOffsetY=6*scale_noticia;
1117
							noticia.shadowBlur=6*scale_noticia;
1118
						}else{
1119
							editor.shadowColor="rgba(0,0,0,0)";
1120
							noticia.shadowColor="rgba(0,0,0,0)";
1121
						}
1122
						editor.font=""+ita+" "+bold+" "+size+"px "+fontfamily+"";
1123
						editor.textAlign="start";
1124
						editor.textBaseline="top";
1125
 
1126
						var sizeNoticia = size*scale_noticia;
1127
						noticia.fillStyle=""+color+"";
1128
						noticia.font=""+ita+" "+bold+" "+sizeNoticia+"px "+fontfamily+"";
1129
						noticia.textAlign="start";
1130
						noticia.textBaseline="top";
1131
						seis=false;
1132
					}
1133
					if(siete){
1134
						dimencionesTexto = editor.measureText(texto);
1135
						txf=dimencionesTexto.width+20;
1136
						tyf= (20+size);
1137
						siete=false;
1138
					}
5443 nelberth 1139
					if(cinco){
4798 nelberth 1140
						dimencionesTexto = editor.measureText(texto);
5441 nelberth 1141
						if(xf>=(yf/recorte)){
1142
							tx=(xf/2)-(dimencionesTexto.width/2);
1143
							ty=(xf*recorte/2)-(size/2);
1144
						}else{
1145
							tx=(yf/recorte/2)-(dimencionesTexto.width/2);
1146
							ty=(yf/2)-(size/2);
1147
						}
1148
 
4798 nelberth 1149
						txf=dimencionesTexto.width+20;
1150
						tyf= size+20;
1151
						cinco=false;
5443 nelberth 1152
					}
4798 nelberth 1153
					if(diez){
1154
						editor.fillStyle="rgba("+r+","+g+","+b+","+a+")";
1155
						noticia.fillStyle="rgba("+r+","+g+","+b+","+a+")";
1156
						editor.fillRect(tx-10,ty-10,txf,tyf);
5387 nelberth 1157
						noticia.fillRect(((tx-10)*scale_noticia),((ty-10)*scale_noticia),txf*scale_noticia,tyf*scale_noticia);
4798 nelberth 1158
						editor.fillStyle=""+color+"";
1159
						noticia.fillStyle=""+color+"";
1160
 
1161
					}
1162
					editor.fillText(texto,tx,ty);
5440 nelberth 1163
					noticia.fillText(texto,(tx*scale_noticia),ty*scale_noticia);
4798 nelberth 1164
					if(ocho){
1165
						editor.strokeRect(tx-10,ty-10,txf,tyf)
1166
						editor.arc(tx+txf,ty+tyf,10,0,Math.PI*2,false);
1167
						editor.fill();
1168
						editor.beginPath();
1169
					}
1170
					texto_listo=true;
1171
				}
1172
			}
1173
		})
1174
 
1175
	}
1176
	}
1177
	function actualizar(){
1178
			$(imagen).ready(function(e){
1179
				if(uno){
1180
					ancho=imagen.width, alto = imagen.height;
5388 nelberth 1181
					elemento.width = ancho;
1182
					elemento.height = alto;
4798 nelberth 1183
					$(".scale").css("display","flex");
1184
					if(ancho<=alto){
1185
					 scale = -(((alto-450)/alto)-1);
8329 nelberth 1186
 
8339 nelberth 1187
 
8329 nelberth 1188
					}else{
1189
					 scale = -(((ancho-500)/ancho)-1);
8339 nelberth 1190
 
4798 nelberth 1191
					}
10907 nelberth 1192
					scale=scale*0.80;
8578 nelberth 1193
					if(edit){
8577 nelberth 1194
						if((ancho*recorte)<=alto){
1195
							xf=ancho*.70;
1196
							yf=xf*recorte;
1197
						}else{
1198
							yf=alto*.70;
1199
							xf=yf/recorte;
1200
						}
1201
					}
10597 nelberth 1202
 
8343 nelberth 1203
					cuadro_dimencion=Math.round(12/scale);
8328 nelberth 1204
 
8308 nelberth 1205
					if(xf<50||yf<50){
1206
						xf=50;
1207
						yf=xf*recorte;
1208
					}
8304 nelberth 1209
					console.log(xf+' '+yf)
8301 nelberth 1210
					mitadX=ancho/2;
1211
					mitadY=alto/2;
1212
					x=mitadX-xf/2;
1213
					y=mitadY-yf/2;
1214
 
4798 nelberth 1215
					$("#porciento_scale").html((scale*100).toFixed(2)+"%")
1216
					$("#ancho").html(ancho+"px");
1217
					$("#alto").html(alto+"px");
1218
					uno=false;
1219
				}
1220
				if(dos){
5402 nelberth 1221
 
1222
					if(xf>=(yf/recorte)){
5405 nelberth 1223
						alto=xf*recorte;
5404 nelberth 1224
						ancho=xf;
5402 nelberth 1225
					}else{
5435 nelberth 1226
						ancho=yf/recorte;
5404 nelberth 1227
						alto=yf;
1228
 
5402 nelberth 1229
					}
1230
					elemento.width = ancho;
1231
					elemento.height = alto;
5451 nelberth 1232
					if(xf<=yf){
5411 nelberth 1233
					 scale = -(((yf-450)/yf)-1);
5433 nelberth 1234
 
4798 nelberth 1235
					}else{
5411 nelberth 1236
					 scale = -(((xf-500)/xf)-1);
4798 nelberth 1237
					}
1238
 
1239
					$("#porciento_scale").html((scale*100).toFixed(2)+"%")
5411 nelberth 1240
					$("#ancho").html(Math.round(xf)+"px");
1241
					$("#alto").html(Math.round(yf)+"px");
4798 nelberth 1242
					dos=false;
1243
				}
5235 nelberth 1244
 
5408 nelberth 1245
					var pxf=0,pyf=0;
1246
					noticia.fillStyle="rgba(255,255,255,1)"
1247
					noticia.fillRect(0,0,320,480);
1248
				if(xf>=(yf/recorte)){
1249
					pxf=xf/320;
1250
					pyf=yf/pxf;
1251
					py=(480/2)-(pyf/2);
1252
					noticia.drawImage(imagen,x,y,xf,yf,0,py,320,pyf);
5409 nelberth 1253
				}else{
5408 nelberth 1254
					pyf=yf/480;
1255
					pxf=xf/pyf;
1256
					px=(320/2)-(pxf/2);
1257
					noticia.drawImage(imagen,x,y,xf,yf,px,0,pxf,480);
5409 nelberth 1258
				}
5407 nelberth 1259
 
10907 nelberth 1260
				$("#editorNoticia").css({"transform": "scale("+scale+")"});
4798 nelberth 1261
				if(!recorte_listo){
1262
					editor.drawImage(imagen,0,0,ancho,alto);
8320 nelberth 1263
					editor.fillStyle="rgba(0,0,0,.2)"
4798 nelberth 1264
					editor.fillRect(0,0,ancho,alto);
8320 nelberth 1265
					editor.fillStyle="rgba(255,255,255,.2)"
4798 nelberth 1266
					editor.fillRect(x,y,xf,yf);
8324 nelberth 1267
					editor.fillStyle="rgba(255,255,255,0.8)"
8315 nelberth 1268
					editor.fillRect(x,y,cuadro_dimencion,cuadro_dimencion);
1269
					editor.fillRect((x+xf)-cuadro_dimencion,y,cuadro_dimencion,cuadro_dimencion);
1270
					editor.fillRect(x,y+yf-cuadro_dimencion,cuadro_dimencion,cuadro_dimencion);
1271
					editor.fillRect(x+xf-cuadro_dimencion,yf+y-cuadro_dimencion,cuadro_dimencion,cuadro_dimencion);
4798 nelberth 1272
					esta=true;
1273
				}else{
5406 nelberth 1274
					var pxf=0,pyf=0;
5427 nelberth 1275
 
5428 nelberth 1276
					editor.fillStyle="rgba(255,255,255,1)"
1277
					editor.fillRect(0,0,ancho,alto);
5406 nelberth 1278
					if(xf>=(yf/recorte)){
1279
						pxf=xf/ancho;
1280
						pyf=yf/pxf;
1281
						py=(alto/2)-(pyf/2);
1282
						editor.drawImage(imagen,x,y,xf,yf,0,py,ancho,pyf);
1283
					}else{
1284
						pyf=yf/alto;
1285
						pxf=xf/pyf;
1286
						px=(ancho/2)-(pxf/2);
1287
						editor.drawImage(imagen,x,y,xf,yf,px,0,pxf,alto);
4798 nelberth 1288
				}
5406 nelberth 1289
 
1290
				}
4798 nelberth 1291
			})
1292
		}
1293
	var imagenOriginal;
8356 nelberth 1294
	var x,y,xf=320,yf =480, elemento,editor,centro, total,scale,dimencionesTexto,ancho_imaNoti,
4798 nelberth 1295
	recorte_listo=false,alto,ancho,tx,ty,txf,tyf,cuatro=true,texto_actualizar=false,cinco=true,seis=true,cuatro;
5865 nelberth 1296
	var  mitadY,mitadX, uno=true,dos=false, recorte=480/320, imagen_noticias, scale_noticia, tres=true,rotar=false, cortar=false;;
8317 nelberth 1297
	var translateX, cuadro_dimencion;
4798 nelberth 1298
 
5822 nelberth 1299
	$(document).on("click", ".recortar10", function(e){
10994 nelberth 1300
 
4798 nelberth 1301
		e.preventDefault();
1302
		recorte_listo=false;
1303
		uno=true;
1304
		$(".fondo_oscuro").css("display","block");
1305
		$("#boton_recortar").addClass("recortar").text("Recortar").removeClass("info_noticia");
1306
		$("#boton_recortar3").addClass("recortar").text("Recortar").removeClass("info_noticia3");
5855 nelberth 1307
		$(".contenido_text").css("display", "none");
1308
		$(".contenido_filter").css("display", "none");
5822 nelberth 1309
		$(".recortar10").addClass("recortar");
4798 nelberth 1310
		$(".canvas").addClass("recortar")
1311
		$(".oa").removeClass("oa");
1312
		$("#normal").addClass("oa");
1313
		$(".b1").removeClass("paso");
5741 nelberth 1314
		$(".titulo_pasos").html("LABEL_STEP_2");
11010 nelberth 1315
		$('.selectFiltro').prop('selectedIndex','normal');
4798 nelberth 1316
		window.clearInterval(actualizar2);
1317
		actualizar();
1318
 
1319
	})
5789 nelberth 1320
 
1321
 
10803 nelberth 1322
	blockCelda=false;
10994 nelberth 1323
	$(document).on("click", "#blockCelda", function(e){
5488 nelberth 1324
		e.preventDefault();
5490 nelberth 1325
		if(blockCelda){
1326
			$(this).html('<span class="fa fa-unlock"></span>')
5495 nelberth 1327
 
5490 nelberth 1328
			blockCelda=false;
1329
		}else{
1330
			$(this).html('<span class="fa fa-lock"></span>')
1331
			blockCelda=true;
1332
		}
5495 nelberth 1333
		t4=true;
10994 nelberth 1334
 
5488 nelberth 1335
	})
4798 nelberth 1336
	var imagen
1337
	function editorNoticia(img){
5865 nelberth 1338
		 cortar=true;
4798 nelberth 1339
		imagen= new Image();
1340
		$(".canvas").html(canvas);
1341
		elemento = document.getElementById("editorNoticia");
1342
		editor = elemento.getContext("2d");
1343
		elemento2 = document.getElementById("imagen_noticias");
1344
		noticia = elemento2.getContext("2d");
1345
 
1346
		$(document).on("click", ".boton_marino.recortar",function(e){
1347
			e.preventDefault();
1348
			recorte_listo=true;
1349
			$(".fondo_oscuro").css("display","none");
5741 nelberth 1350
			$("#boton_recortar").removeClass("recortar").text("LABEL_SEND").addClass("info_noticia").attr('type','submit');
5822 nelberth 1351
			$(".recortar10").removeClass("recortar");
4798 nelberth 1352
			$(".canvas").removeClass("recortar");
1353
			$(".b1").addClass("paso");
5741 nelberth 1354
			$(".titulo_pasos").html("LABEL_STEP_3");
11007 nelberth 1355
 
4798 nelberth 1356
			if(texto!=""){
1357
				seis=true;
1358
				siete=true;
1359
			}
1360
			cinco=true;
1361
			dos=true;
1362
			cuatro=true;
11253 nelberth 1363
			setTimeout(() => {
1364
				actualizar2();
1365
			}, actualizar());
4798 nelberth 1366
		})
1367
 
1368
		var cli = false, t1= false, t2=false,t3=false,t4=false,tcli=false;
1369
		var mouse =[];
1370
 
1371
 
1372
		function raton(elemento, e){
1373
			return {
1374
				x:((e.pageX - elemento.offsetLeft - ((ancho/2)-((ancho*scale)/2)))/scale),
1375
				y:((e.pageY - elemento.offsetTop - ((alto/2)-((alto*scale)/2)))/scale)
1376
			}
1377
		}
1378
 
1379
		imagen.src=img;
5822 nelberth 1380
		$(".recortar10").addClass("recortar");
5741 nelberth 1381
		$("#boton_recortar").removeClass("boton_normal").addClass("recortar boton_marino").text("LABEL_CUT")
4798 nelberth 1382
		actualizar();
1383
 
1384
		$(elemento).mousemove(function(e){
1385
			mouse = raton(this, e);
10535 nelberth 1386
 
4798 nelberth 1387
			if(!recorte_listo){
8335 nelberth 1388
				if(x<mouse.x &&(xf+x)>mouse.x && y<mouse.y && (y+yf)>mouse.y){
1389
					if((xf+x-cuadro_dimencion)<mouse.x &&(xf+x)>mouse.x && (y+yf-cuadro_dimencion)<mouse.y && (y+yf)>mouse.y){
1390
			 			$(elemento).css("cursor","nw-resize");
1391
			 		}else if((xf+x-cuadro_dimencion)<mouse.x &&(xf+x)>mouse.x && y<mouse.y && (y+cuadro_dimencion)>mouse.y){
1392
			 			$(elemento).css("cursor","ne-resize");
1393
			 		}else if(x<mouse.x &&(cuadro_dimencion+x)>mouse.x && y<mouse.y && (y+cuadro_dimencion)>mouse.y){
1394
			 			$(elemento).css("cursor","se-resize");
1395
			 		}else if(x<mouse.x &&(cuadro_dimencion+x)>mouse.x && (y+yf-cuadro_dimencion)<mouse.y &&(y+yf)>mouse.y){
1396
			 			$(elemento).css("cursor","sw-resize");
1397
			 		}else{
1398
						$(elemento).css("cursor","move");
1399
					}
4798 nelberth 1400
			 	}else{
1401
			 		$(elemento).css("cursor","default");
1402
			 	}
1403
			}else if(texto_listo){
1404
				if(tx-10<mouse.x && tx-10+txf>mouse.x && ty-10<mouse.y && ty-10+tyf>mouse.y){
1405
			 		$(elemento).css("cursor","move");
1406
			 	}else if((txf+tx-10)<mouse.x &&(txf+tx-10+20)>mouse.x && (ty-10+tyf)<mouse.y && (ty-10+tyf+20)>mouse.y){
1407
			 		$(elemento).css("cursor","pointer");
1408
			 	}else{
1409
			 		$(elemento).css("cursor","default");
1410
			 	}
1411
			}
1412
			else{
1413
				$(elemento).css("cursor","default");
1414
			}
1415
		})
1416
		$(elemento).mousedown(function(e){
1417
			mouse = raton(this, e);
1418
			if(!recorte_listo){
8334 nelberth 1419
				if(x<mouse.x &&(xf+x)>mouse.x && y<mouse.y && (y+yf)>mouse.y){
8333 nelberth 1420
 
1421
					if((xf+x-cuadro_dimencion)<mouse.x &&(xf+x)>mouse.x && (y+yf-cuadro_dimencion)<mouse.y && (y+yf)>mouse.y){
1422
						t4 = true;
1423
					}else if((xf+x-cuadro_dimencion)<mouse.x &&(xf+x)>mouse.x && y<mouse.y && (y+cuadro_dimencion)>mouse.y){
1424
						t3 = true;
1425
					}else if(x<mouse.x &&(cuadro_dimencion+x)>mouse.x && y<mouse.y && (y+cuadro_dimencion)>mouse.y){
1426
						t1 = true;
1427
					}else if(x<mouse.x &&(cuadro_dimencion+x)>mouse.x && (y+yf-cuadro_dimencion)<mouse.y &&(y+yf)>mouse.y){
1428
						t2 = true;
1429
					}else{
1430
						cli = true;
1431
					}
4798 nelberth 1432
			 	}
8333 nelberth 1433
 
4798 nelberth 1434
			}else if(texto_listo){
1435
				if(tx-10<mouse.x && tx-10+txf>mouse.x && ty-10<mouse.y && ty-10+tyf>mouse.y){
1436
			 		tcli=true;
1437
			 	}else if((txf+tx-10)<mouse.x &&(txf+tx-10+20)>mouse.x && (ty-10+tyf)<mouse.y && (ty-10+tyf+20)>mouse.y){
1438
			 		rotar=true;
1439
			 	}
1440
			}
1441
 
1442
		 })
1443
 
10515 nelberth 1444
		 $('.editorNoticia').mousemove(function(e){
4798 nelberth 1445
		 	mouse = raton(this, e);
10594 nelberth 1446
			//console.log("raton x: "+mouse.x+ " raton Y: " +mouse.y+ " xf: "+xf+" yf: "+yf)
10597 nelberth 1447
			//console.log('t1: '+t1+' t2: '+t2+' t3: '+t3+' t4: '+t4)
4798 nelberth 1448
		 	if(!recorte_listo){
1449
			 	if(cli){
1450
			 		if((mouse.y-(yf/2))>=0&&(mouse.y+(yf/2))<=alto){
1451
				 		y = (mouse.y-(yf/2));
1452
			 		}else{
1453
			 			if((mouse.y-(yf/2))<0){
1454
			 				y=0;
1455
			 			}
1456
			 			if((mouse.y+(yf/2))>alto){
1457
			 				y=alto-yf;
1458
			 			}
1459
			 		}
1460
			 		if((mouse.x-(xf/2))>=0&&(mouse.x+(xf/2))<=ancho){
1461
			 			x = (mouse.x-(xf/2));
1462
			 		}else{
1463
			 			if((mouse.x-(xf/2))<0){
1464
			 				x=0;
1465
			 			}
1466
			 			if((mouse.x+(xf/2))>ancho){
1467
			 				x=(ancho)-xf;
1468
			 			}
1469
			 		}
1470
			 	}
5492 nelberth 1471
				if(blockCelda){
1472
			 	if(t4){
10494 nelberth 1473
					cal1=mouse.y-y;
1474
			 		cal2=cal1/recorte;
10571 nelberth 1475
					cal3=x+cal2;
10564 nelberth 1476
					if(cal2>50){
10571 nelberth 1477
						if(cal3<=ancho&&mouse.y<=alto){
10568 nelberth 1478
							yf=cal1;
1479
				 			xf=cal2;
10572 nelberth 1480
						}else if(cal3<=ancho&&mouse.y>alto){
1481
							yf=alto-y;
1482
							xf=yf/recorte
10571 nelberth 1483
						}else if(cal3>=ancho&&mouse.y<=alto){
10570 nelberth 1484
							xf=ancho-x;
10571 nelberth 1485
							yf=xf*recorte;
10568 nelberth 1486
						}
10489 nelberth 1487
				 	}
4798 nelberth 1488
			 	}
1489
			 	if(t3){
10495 nelberth 1490
					cal1=yf+(y-mouse.y);
1491
			 		cal2=cal1/recorte;
10572 nelberth 1492
					cal3=x+cal2;
10579 nelberth 1493
					if(cal2>50){
10572 nelberth 1494
						if(cal3<=ancho&&mouse.y>=0){
1495
							yf=cal1;
1496
				 			xf=cal2;
1497
							y=mouse.y;
1498
						}else if(cal3<=ancho&&mouse.y<0){
1499
							yf=yf+y;
1500
							xf=yf/recorte
1501
							y=0;
11037 nelberth 1502
						}else if(cal3>=ancho&&mouse.y>=0){
10575 nelberth 1503
							xf=ancho-x;
10578 nelberth 1504
							y=y+(yf-xf*recorte);
10580 nelberth 1505
							yf=xf*recorte;
10572 nelberth 1506
						}
1507
 
10496 nelberth 1508
				 	}
1509
 
4798 nelberth 1510
			 	}
1511
			 	if(t2){
10580 nelberth 1512
 
10498 nelberth 1513
					cal1=mouse.y-y;
1514
			 		cal2=cal1/recorte;
10580 nelberth 1515
					cal3=x+(yf-cal1)/recorte;cal2;
1516
					if(cal2>50){
1517
						if(cal3>=0&&mouse.y<=alto){
1518
							x=cal3;
1519
							yf=cal1;
1520
				 			xf=cal2;
11241 nelberth 1521
						}else if(cal3>0&&mouse.y>alto){
10580 nelberth 1522
							yf=alto-y;
10583 nelberth 1523
							x=x+(xf-yf/recorte);
10580 nelberth 1524
							xf=yf/recorte
11241 nelberth 1525
						}else if(cal3<0&&mouse.y<=alto){
10584 nelberth 1526
							xf=xf+x;
1527
							yf=xf*recorte;
1528
							x=0;
10580 nelberth 1529
						}
10586 nelberth 1530
				 	}
10499 nelberth 1531
 
5215 nelberth 1532
			 	}
1533
			 	if(t1){
10506 nelberth 1534
					cal0=y-mouse.y;
1535
					cal1=yf+cal0;
10500 nelberth 1536
			 		cal2=cal1/recorte;
10506 nelberth 1537
					cal3=x-cal0/recorte;
10586 nelberth 1538
					if(cal2>50){
1539
						if(cal3>=0&&mouse.y>=0){
1540
							yf=cal1;
1541
					 		xf=cal2;
1542
					 		x=cal3;
1543
					 		y=mouse.y;
11243 nelberth 1544
						}else if(cal3>0&&mouse.y<0){
10590 nelberth 1545
							yf=yf+y;
1546
							x=x+(xf-yf/recorte);
10586 nelberth 1547
							xf=yf/recorte
10590 nelberth 1548
							y=0;
11038 nelberth 1549
						}else if(cal3<0&&mouse.y>=0){
10589 nelberth 1550
							xf=xf+x;
10588 nelberth 1551
							y=y+(yf-xf*recorte);
10586 nelberth 1552
							yf=xf*recorte;
1553
							x=0;
1554
						}
1555
				 	}
1556
 
10504 nelberth 1557
				}
5492 nelberth 1558
				}else{
10586 nelberth 1559
				if(t4){
10537 nelberth 1560
 
10541 nelberth 1561
					cal1=mouse.y-y;
1562
					cal2=mouse.x-x;
1563
					if(cal1>50){
1564
						yf=mouse.y<=alto?cal1:alto-y;
1565
				 	}
1566
					if(cal2>50){
1567
						xf=mouse.x<=ancho?cal2:ancho-x;
1568
					}
5215 nelberth 1569
			 	}
10543 nelberth 1570
 
5215 nelberth 1571
			 	if(t3){
10542 nelberth 1572
					cal1=yf-(mouse.y-y);
1573
					cal2=mouse.x-x;
1574
					if(cal1>50){
10553 nelberth 1575
 
10551 nelberth 1576
						if(mouse.y>=0){
1577
							yf=cal1;
1578
							y=mouse.y;
1579
						}else{
10552 nelberth 1580
							yf=yf+y;
10551 nelberth 1581
							y=0;
1582
						}
10542 nelberth 1583
				 	}
1584
					if(cal2>50){
10547 nelberth 1585
						xf=mouse.x<=ancho?cal2:ancho-x;
10542 nelberth 1586
					}
10543 nelberth 1587
			 	}
5332 nelberth 1588
				/* Izquierda abajo */
5215 nelberth 1589
			 	if(t2){
10555 nelberth 1590
					cal1=mouse.y-y;
1591
					cal2=xf-(mouse.x-x);
1592
					if(cal1>50){
1593
						yf=yf=mouse.y<=alto?cal1:alto-y;
1594
					}
1595
					if(cal2>50){
10556 nelberth 1596
						if(mouse.x>=0){
10555 nelberth 1597
							xf=cal2;
10559 nelberth 1598
							x=mouse.x;
10555 nelberth 1599
						}else{
1600
							xf=xf+x;
1601
							x=0;
1602
						}
1603
					}
4798 nelberth 1604
			 	}
5332 nelberth 1605
				/* izquierda arriba */
4798 nelberth 1606
			 	if(t1){
10560 nelberth 1607
 
1608
					cal1=yf-(mouse.y-y);
1609
					cal2=xf-(mouse.x-x);
1610
					if(cal1>50){
1611
 
1612
						if(mouse.y>=0){
1613
							yf=cal1;
1614
							y=mouse.y;
1615
						}else{
1616
							yf=yf+y;
1617
							y=0;
1618
						}
1619
				 	}
1620
					if(cal2>50){
1621
						if(mouse.x>=0){
1622
							xf=cal2;
1623
							x=mouse.x;
1624
						}else{
1625
							xf=xf+x;
1626
							x=0;
1627
						}
1628
					}
10562 nelberth 1629
 
4798 nelberth 1630
			 	}
11032 nelberth 1631
				}
4798 nelberth 1632
 
1633
		 	actualizar();
1634
		 	}else if(texto_listo){
1635
		 		if(tcli){
1636
		 			tx=mouse.x-(txf/2)
1637
		 			ty=mouse.y-(tyf/2)
1638
		 		}else if(rotar){
1639
 
1640
		 		}
1641
 
1642
		 		actualizar2();
1643
		 	}
1644
		 })
10446 nelberth 1645
		 $('body').mouseup(function(e){
10599 nelberth 1646
			console.log('levanto el mouse')
4798 nelberth 1647
		 	if(!recorte_listo){
1648
			 	cli=false;
1649
			 	t1=false;
1650
			 	t2=false;
1651
			 	t3=false;
1652
			 	t4=false;
1653
		 	}else if (texto_listo) {
1654
		 		tcli=false;
1655
		 	}
1656
		 })
1657
 
5129 nelberth 1658
 
4798 nelberth 1659
	}
5500 nelberth 1660
	/* Titulo */
5501 nelberth 1661
 
6073 nelberth 1662
var titulo_noticia, censor_titulo = true, numero_titulo=0;
5500 nelberth 1663
	$(document).on("keyup change", "#name", function(e){
5501 nelberth 1664
	console.log(numero_titulo)
5500 nelberth 1665
	titulo_noticia = $(this).val();
1666
	titulo_elemento= $(".titulo_topico");
1667
	if(titulo_noticia!=""){
5505 nelberth 1668
		if(censor_titulo){
5500 nelberth 1669
			titulo_elemento.html(titulo_noticia);
1670
			if(titulo_elemento.height()>38){
5508 nelberth 1671
				var titulo_noticia2 = "";
5500 nelberth 1672
				for(var i =0; i <titulo_noticia.length;i++){
1673
					titulo_noticia2 = titulo_noticia2 + titulo_noticia.split("")[i];
1674
					titulo_elemento.html(titulo_noticia2);
1675
					if(titulo_elemento.height()>38){
1676
						titulo_noticia2 = titulo_noticia2.slice(0,-5) + "...";
1677
						titulo_elemento.html(titulo_noticia2);
1678
						numero_titulo = titulo_noticia2.length;
1679
						censor_titulo=false;
1680
						break;
1681
					}
4798 nelberth 1682
 
5500 nelberth 1683
				}
1684
			}else{
1685
				numero_titulo=0;
1686
			}
1687
		}else{
1688
			if(numero_titulo+1>=titulo_noticia.length){
1689
				titulo_elemento.html(titulo_noticia);
1690
				censor_titulo=true;
1691
			}
5505 nelberth 1692
		}
5500 nelberth 1693
	}else{
5741 nelberth 1694
		titulo_elemento.html("LABEL_TITLE_TOPIC");
5500 nelberth 1695
		censor_titulo = true;
1696
	}
1697
})
1 www 1698
    });
1699
JS;
1700
$this->inlineScript()->captureEnd();
1701
?>
1702
 
1703
 
1704
 
1705
<!-- Content Header (Page header) -->
1706
<section class="content-header">
1707
	<div class="container-fluid">
1708
    	<div class="row mb-2">
1709
        	<div class="col-sm-12">
1710
            	<h1>LABEL_TOPICS</h1>
1711
			</div>
1712
		</div>
1713
	</div><!-- /.container-fluid -->
1714
</section>
1715
 
4693 nelberth 1716
<section class="content" id='content1'>
1 www 1717
	<div class="container-fluid">
1718
    	<div class="row">
1719
        	<div class="col-12">
1720
				<div class="card">
1721
					<div class="card-body">
20 steven 1722
        	    		<table id="gridTable" class="table   table-hover">
1 www 1723
                      		<thead>
1724
        						<tr>
1725
                                	<th>LABEL_NAME</th>
1726
                                  	<th>LABEL_STATUS</th>
1727
                                  	<th>LABEL_DETAILS</th>
1728
                                  	<th>LABEL_ACTIONS</th>
1729
                                </tr>
1730
                       		</thead>
1731
                         	<tbody>
1732
                         	</tbody>
1733
                    	</table>
1734
                   	</div>
1735
                   	<div class="card-footer clearfix">
1736
                   		<div style="float:right;">
1737
							<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
1738
							<?php if($allowAdd) : ?>
1739
							<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
1740
							<?php endif; ?>
1741
						</div>
1742
                 	</div>
1743
          		</div>
1744
           	</div>
1745
        </div>
1746
 	</div>
1747
</section>
5467 nelberth 1748
<section id="addImage" style='display:none' class="">
5463 nelberth 1749
<div class="d-flex justify-content-center tituloEditor">
5701 nelberth 1750
        <h4>LABEL_ADD_TOPIC</h4>
5463 nelberth 1751
 
1752
    </div>
5687 nelberth 1753
	<div class="grid-padre" >
5487 nelberth 1754
				<?php
5462 nelberth 1755
       			 $form = $this->formAdd;
1756
            		$form->setAttributes([
1757
                        'method'  => 'post',
1758
            		    'action'  => $routeAdd,
1759
                        'name'    => 'form-topic-add',
1760
                        'id'      => 'form-topic-add',
1761
                    ]);
1762
 
1763
                    $form->prepare();
1764
                    echo $this->form()->openTag($form);
1765
                    ?>
5684 nelberth 1766
    			<div class="form-group grid-1-2">
5462 nelberth 1767
    				<?php
1768
                        $element = $form->get('name');
1769
 
1770
                        $element->setAttributes(['class' => 'form-control']);
1771
                        $element->setOptions(['label' => 'LABEL_NAME']);
1772
                        echo $this->formLabel($element);
1773
                        echo $this->formText($element);
1774
                    ?>
1775
				</div>
5487 nelberth 1776
 
5684 nelberth 1777
                <div class="form-group grid-1-2">
5462 nelberth 1778
                	<?php
1779
                    $element = $form->get('description');
1780
                    $element->setAttributes(['id' => 'description_add', 'class' => 'form-control', 'rows' => '2','class' => 'form-control']);
1781
                    $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
1782
                    echo $this->formLabel($element);
1783
                    echo $this->formTextArea($element);
1784
                    ?>
1785
   				</div>
5684 nelberth 1786
				<div class="form-group grid-1-2">
5462 nelberth 1787
    				<?php
1788
                        $element = $form->get('order');
1789
                        $element->setAttributes(['class' => 'form-control']);
1790
                        $element->setOptions(['label' => 'LABEL_ORDER']);
1791
                        echo $this->formLabel($element);
1792
                        echo $this->formText($element);
1793
                    ?>
1794
				</div>
5678 nelberth 1795
 
5462 nelberth 1796
               		<?php
5531 nelberth 1797
                    $element = $form->get('file');
5991 nelberth 1798
					$element->setAttributes([ 'class' => 'file']);
5653 nelberth 1799
                    echo $this->formHidden($element); ?>
5678 nelberth 1800
 
5684 nelberth 1801
          		<div class="form-group grid-1-2">
5462 nelberth 1802
    				<?php
1803
                        $element = $form->get('status');
1804
                        $element->setAttributes(['class' => 'form-control']);
1805
                        $element->setOptions(['label' => 'LABEL_STATUS']);
1806
                        echo $this->formLabel($element);
1807
                        echo $this->formSelect($element);
1808
                    ?>
1809
				</div>
10864 nelberth 1810
 
5747 nelberth 1811
				<div class="contenido form-group" id="contenido">
11026 nelberth 1812
 
10917 nelberth 1813
 
5747 nelberth 1814
				</div>
5916 nelberth 1815
 
5549 nelberth 1816
 
5462 nelberth 1817
     	      		<?php echo $this->form()->closeTag($form); ?>
1818
      		</div>
1819
 
5463 nelberth 1820
 
4691 nelberth 1821
</section>
1 www 1822
 
5895 nelberth 1823
<section id="topicEdit" style='display:none' class="">
1824
<div class="d-flex justify-content-center tituloEditor">
5912 nelberth 1825
        <h4>LABEL_EDIT_TOPIC</h4>
1 www 1826
 
5895 nelberth 1827
    </div>
1828
	<div class="grid-padre" >
5899 nelberth 1829
					<?php
1830
       			  $form = $this->formEdit;
1 www 1831
            		$form->setAttributes([
5899 nelberth 1832
                        'method'    => 'post',
1833
                        'name'      => 'form-topic-edit',
1834
                        'id'        => 'form-topic-edit'
1 www 1835
                    ]);
1836
 
1837
                    $form->prepare();
1838
                    echo $this->form()->openTag($form);
1839
                    ?>
5895 nelberth 1840
    			<div class="form-group grid-1-2">
1 www 1841
    				<?php
1842
                        $element = $form->get('name');
1843
 
1844
                        $element->setAttributes(['class' => 'form-control']);
1845
                        $element->setOptions(['label' => 'LABEL_NAME']);
1846
                        echo $this->formLabel($element);
1847
                        echo $this->formText($element);
1848
                    ?>
1849
				</div>
5904 nelberth 1850
				<div class="form-group grid-1-2">
1 www 1851
                	<?php
1852
                    $element = $form->get('description');
5904 nelberth 1853
                    $element->setAttributes(['id' => 'description_edit', 'rows' => '2', 'class' => 'form-control',   'class' => 'form-control']);
1 www 1854
                    $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
1855
                    echo $this->formLabel($element);
1856
                    echo $this->formTextArea($element);
1857
                    ?>
1858
   				</div>
5895 nelberth 1859
				<div class="form-group grid-1-2">
1 www 1860
    				<?php
1861
                        $element = $form->get('order');
1862
                        $element->setAttributes(['class' => 'form-control']);
1863
                        $element->setOptions(['label' => 'LABEL_ORDER']);
1864
                        echo $this->formLabel($element);
1865
                        echo $this->formText($element);
1866
                    ?>
1867
				</div>
5895 nelberth 1868
 
1 www 1869
               		<?php
1870
                    $element = $form->get('file');
5990 nelberth 1871
					$element->setAttributes([ 'class' => 'file']);
1872
                    echo $this->formHidden($element);
1873
					?>
5895 nelberth 1874
 
1875
          		<div class="form-group grid-1-2">
1 www 1876
    				<?php
1877
                        $element = $form->get('status');
1878
                        $element->setAttributes(['class' => 'form-control']);
1879
                        $element->setOptions(['label' => 'LABEL_STATUS']);
1880
                        echo $this->formLabel($element);
1881
                        echo $this->formSelect($element);
1882
                    ?>
1883
				</div>
1884
 
5908 nelberth 1885
				<div class="contenido form-group" id="contenido2">
5895 nelberth 1886
				</div>
5981 nelberth 1887
 
1 www 1888
     	      		<?php echo $this->form()->closeTag($form); ?>
1889
      		</div>
1890
 
5895 nelberth 1891
 
1892
</section>
1 www 1893
 
1894
 
1895
 
1896
<!-- The Modal -->
1897
<div class="modal" id="modalImageApp">
1898
	<div class="modal-dialog ">
1899
    	<div class="modal-content">
1900
 
1901
            <!-- Modal Header -->
1902
      		<div class="modal-header">
1903
        		<h4 class="modal-title">LABEL_IMAGE</h4>
1904
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
1905
      		</div>
1906
 
1907
            <!-- Modal body -->
1908
            <div class="modal-body text-center">
1909
				<img src="" class="img img-responsive" style="width: 300px; height: auto" id="image-app" />
1910
      		</div>
1911
 
1912
            <!-- Modal footer -->
1913
      		<div class="modal-footer">
1914
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
1915
          	</div>
1916
         </div>
1917
	</div>
1918
</div>
1919
 
1920
 
1921
 
1922
 
1923
 
1924
 
1925
 
1926
 
1927
 
1928