1jQuery.widget('gc.gcVideoGridLog', $.gc.gcFileSelectorFolder, { 2 options: { 3 mainHash: null, 4 previewList: [] 5 }, 6 mapFrameHashToSrc: null, 7 currentPreview: null, 8 watermarkEnableInput: false, 9 list: [], 10 _create: function() { 11 var $messageEl = $('<div></div>'); 12 this.messageEl = $messageEl; 13 this.element.addClass("grid-content"); 14 this.element.css('display', 'block'); 15 this.element.append($messageEl); 16 }, 17 init: function() { 18 var that = this; 19 that.usersDictionary = []; 20 that.list = []; 21 22 fetch('/pl/fileservice/api/jwt?hash=' + this.options.mainHash) 23 .then(function(data) {return data.text();}) 24 .then(function(jwt) { 25 fetch(window.location.protocol +'//' + window.vhApiHost + '/api/grid/get_log_of_grid_change?jwt=' + jwt) 26 .then(function(data) {return data.json();}) 27 .then(function(data) { 28 that.list = data.list; 29 var userIds = []; 30 $.each(that.list, function (index, value) { 31 if (userIds.includes(value.user_id)) { 32 return; 33 } 34 userIds.push(value.user_id); 35 }); 36 37 if (!userIds.length) { 38 that.generateDatatable(); 39 return; 40 } 41 42 fetch('/pl/fileservice/video/users-info?json=' + JSON.stringify(userIds)) 43 .then(function(resp) {return resp.json();}) 44 .then(function(resp) { 45 that.usersDictionary = resp.result; 46 that.generateDatatable(); 47 }) 48 .catch(function(err) {console.error(err);}); 49 }) 50 .catch(function(err) {console.error(err);}); 51 }); 52 }, 53 generateDatatable: function () { 54 var $tables = $('<div class="stat-tables"></div>'); 55 56 this.element.addClass("grid-log-content"); 57 this.element.css({ 58 'padding' : '20px', 59 'width' : '85%', 60 'display' : 'inline-block', 61 'overflow' : 'hidden', 62 'overflow-y' : 'auto', 63 'height': '590px', 64 }); 65 66 var datatableOptions = { 67 "ordering": false, 68 "scrollY": '400px', 69 "scrollCollapse": true, 70 "paging": true, 71 "language": { 72 "search": Yii.t('common', 'ÐоиÑк:'), 73 "lengthMenu": Yii.t('common', 'ÐоказаÑÑ') + ' _MENU_ ' + Yii.t('common', 'запиÑей'), 74 "zeroRecords": Yii.t('common', 'ÐзвиниÑе, ниÑего не найдено'), 75 "info": Yii.t('common', 'ÐолиÑеÑÑво запиÑей') + ': _MAX_', 76 "infoEmpty": Yii.t('common', 'ÐапиÑей не найдено'), 77 "infoFiltered": Yii.t('common', '(оÑÑилÑÑÑовано') + ' _MAX_ ' + Yii.t('common', 'запиÑей') + ')', 78 "paginate": { 79 "first": Yii.t('common', 'ÐеÑваÑ'), 80 "last": Yii.t('common', 'ÐоÑледнÑÑ'), 81 "next": Yii.t('common', 'СледÑÑÑаÑ'), 82 "previous": Yii.t('common', 'ÐÑедÑдÑÑаÑ') 83 }, 84 } 85 }; 86 87 this.element.empty(); 88 this.element.append(this.messageEl); 89 this.element.append($tables); 90 91 this.generateHtml(); 92 $tables.append(this.mainTable); 93 94 this.mainTable.DataTable(datatableOptions); 95 this.mainTable.parent().parent().parent().css('height', '400px'); 96 }, 97 generateHtml: function() { 98 var $content = $('<table class="table">'); 99 var $tableHead = $('<thead>\n' + 100 ' <tr>\n' + 101 ' <th scope="col">' + Yii.t('common', 'ÐаÑа') + '</th>\n' + 102 ' <th scope="col">' + Yii.t('common', 'ÐейÑÑвие') + '</th>\n' + 103 ' <th scope="col">' + Yii.t('common', 'ÐолÑзоваÑелÑ') + '</th>\n' + 104 ' </tr>\n' + 105 ' </thead>'); 106 107 var $tableRows = this.generateRows(); 108 var $tableEnd = $('</table>'); 109 110 $content.append($tableHead); 111 $content.append($tableRows); 112 $content.append($tableEnd); 113 114 this.mainTable = $content; 115 116 return $content; 117 }, 118 generateRows: function() { 119 120 var convertDateTime = function(utcDate) { 121 var partsDateTime = utcDate.split(' '); 122 var partsDate = partsDateTime[0] ? partsDateTime[0].split('-') : [0,0,0]; 123 var partsTime = partsDateTime[1] ? partsDateTime[1].split(':') : [0,0,0]; 124 var date = new Date(Date.UTC(partsDate[0], partsDate[1] - 1, partsDate[2], partsTime[0], partsTime[1], partsTime[2])); 125 return date.toLocaleDateString() + ' ' + date.toLocaleTimeString(); 126 }; 127 128 var that = this; 129 var $content = $('<tbody>'); 130 $.each(this.list, function (index, value) { 131 var userFullName = ''; 132 if (that.usersDictionary[value.user_id]) { 133 var firstName = that.usersDictionary[value.user_id].first_name === null || value.deleted ? 134 '' : that.usersDictionary[value.user_id].first_name; 135 var lastName = that.usersDictionary[value.user_id].last_name === null || value.deleted ? 136 '' : that.usersDictionary[value.user_id].last_name; 137 userFullName = (firstName + ' ' + lastName).trim(); 138 } 139 140 $content.append($('<tr>' + 141 '<th scope="row">' + convertDateTime(value.date_change) + '</th>' + 142 '<td>' + (value.status === '1' ? Yii.t('common', 'ÐклÑÑение') : Yii.t('common', 'ÐÑклÑÑение') ) + '</td>' 143 + '<td>' + (userFullName ? userFullName : '#' + value.user_id) + '</td>' 144 )); 145 }); 146 147 $content.append($('</tbody>')); 148 149 return $content; 150 } 151} );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.