FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
change-license-view.js
1 /*
2  Copyright (C) 2014-2018, Siemens AG
3  Author: Daniele Fognini, Johannes Najjar
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License
7  version 2 as published by the Free Software Foundation.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 var defaultScope;
20 var defaultType;
21 
22 
23 function clearingSuccess(data) {
24  $('#recentLicenseClearing').html(data.recentLicenseClearing);
25 }
26 
27 function openBulkModal() {
28  $('#userModal').hide();
29  $('#ClearingHistoryDataModal').hide();
30  $('#bulkModal').toggle();
31 }
32 
33 function closeBulkModal() {
34  $('#bulkModal').hide();
35 }
36 
37 function openUserModal() {
38  $('#bulkModal').hide();
39  $('#ClearingHistoryDataModal').hide();
40  $('#userModal').toggle();
41  $("#globalDecision").prop("checked", false);
42  if ($('#userModal').is(":visible")) {
43  $('#licenseSelectionTable_filter label input').focus();
44  }
45 }
46 
47 function closeUserModal() {
48  $('#userModal').hide();
49 }
50 
51 function openClearingHistoryDataModal() {
52  $('#bulkModal').hide();
53  $('#userModal').hide();
54  $('#ClearingHistoryDataModal').toggle();
55  createClearingHistoryDataTable();
56 }
57 
58 function closeClearingHistoryDataModal() {
59  $('#ClearingHistoryDataModal').hide();
60 }
61 
62 function reloadClearingTable() {
63  // TODO reload also highlights
64  var table = createClearingTable();
65  table.fnDraw(false);
66  $('#bulkIdResult').hide();
67  refreshBulkHistory(function (data) {
68  $('#bulkHistory').show();
69  });
70 }
71 
72 function scheduleBulkScan() {
73  scheduleBulkScanCommon($('#bulkIdResult'), reloadClearingTable);
74 }
75 
76 function cleanText() {
77  var $textField = $('#bulkRefText');
78  var text = $textField.val();
79 
80  text = text.replace(/ [ ]*/gi, ' ')
81  .replace(/(^|\n)[ \t]*/gi,'$1')
82  .replace(/(^|\n) ?\/[\*\/]+/gi, '$1')
83  .replace(/[\*]+\//gi, '')
84  .replace(/(^|\n) ?#+/gi,'$1')
85  ;
86  $textField.val(text);
87 }
88 
89 
90 function calculateDivHeight() {
91  var viewportWidth = $(window).width();
92  var viewportHeight = $(window).height();
93 
94  var usedPixels = $('#leftrightalignment').offset();
95  var availablePixels = viewportHeight - usedPixels.top;
96  var fixedPixelsLeft = 40;
97  var availablePixelsLeft = availablePixels - fixedPixelsLeft;
98  var availableWidth = viewportWidth / 2 - 20;
99 
100  $('.headerBox').css({height: availablePixelsLeft + 'px', width: availableWidth + 'px'});
101  $('.boxnew').css({height: availablePixelsLeft + 'px', width: availableWidth + 'px'});
102 }
103 
104 $(document).ready(function () {
105  calculateDivHeight();
106 });
107 
108 $(window).resize(calculateDivHeight);