FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
change-license-browse.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 function clearingSuccess(data) {
20  location.reload();
21 }
22 
23 var bulkModal;
24 var userModal;
25 var removed = false;
26 
27 $(document).ready(function () {
28  bulkModal = $('#bulkModal').plainModal({child: textModal});
29  userModal = $('#userModal').plainModal();
30  clearingHistoryDataModal = $('#ClearingHistoryDataModal').plainModal();
31 });
32 
33 function openBulkModal(uploadTreeId) {
34  $('#uploadTreeId').val(uploadTreeId);
35  bulkModal.plainModal('open');
36 }
37 
38 function closeBulkModal() {
39  bulkModal.plainModal('close');
40 }
41 
42 function loadBulkHistoryModal() {
43  refreshBulkHistory(function(data) {
44  $('#bulkHistoryModal').plainModal('open');
45  });
46 }
47 
48 function openUserModal(uploadTreeId) {
49  $('#uploadTreeId').val(uploadTreeId);
50  userModal.plainModal('open');
51 }
52 
53 function closeUserModal() {
54  userModal.plainModal('close');
55 }
56 
57 function openClearingHistoryDataModal(uploadTreeId) {
58  $('#uploadTreeId').val(uploadTreeId);
59  clearingHistoryDataModal.plainModal('open');
60 }
61 
62 function closeClearingHistoryDataModal() {
63  clearingHistoryDataModal.plainModal('close');
64 }
65 
66 function scheduleBulkScan() {
67  scheduleBulkScanCommon($('#bulkIdResult'), function () {
68  location.reload();
69  });
70 }
71 
72 function performPostRequest(doRemove) {
73  removed = doRemove;
74  performPostRequestCommon($('#bulkIdResult'), function () {
75  location.reload();
76  });
77 }
78 
79 function markDecisions(uploadTreeIdForMultiple) {
80  if(Array.isArray(uploadTreeIdForMultiple)){
81  var data = {
82  "uploadTreeId": uploadTreeIdForMultiple,
83  "decisionMark": 'irrelevant'
84  };
85  }else{
86  var data = {
87  "uploadTreeId": $('#uploadTreeId').val(),
88  "decisionMark": uploadTreeIdForMultiple
89  };
90  }
91  resultEntity = $('bulkIdResult');
92  $.ajax({
93  type: "POST",
94  url: "?mod=change-license-processPost",
95  data: data,
96  success: function (data) { location.reload(); },
97  error: function(responseobject) { scheduledDeciderError(responseobject, resultEntity); }
98  });
99 
100 }
101 
102 function deleteMarkedDecisions(decisionToBeRemoved) {
103  var data = {
104  "uploadTreeId": $('#uploadTreeId').val(),
105  "decisionMark": decisionToBeRemoved
106  };
107  resultEntity = $('bulkIdResult');
108  var txt;
109  var pleaseConfirm = confirm("You are about to delete recent decisions. Please confirm!");
110  if (pleaseConfirm == true) {
111  $.ajax({
112  type: "POST",
113  url: "?mod=change-license-processPost",
114  data: data,
115  success: function (data) { location.reload(); },
116  error: function(responseobject) { scheduledDeciderError(responseobject, resultEntity); }
117  });
118  }
119 }
120 
121 function cleanText() {
122  var $textField = $('#bulkRefText');
123  var text = $textField.val();
124 
125  text = text.replace(/ [ ]*/gi, ' ')
126  .replace(/(^|\n)[ \t]*/gi,'$1')
127  .replace(/(^|\n) ?\/[\*\/]+/gi, '$1')
128  .replace(/[\*]+\//gi, '')
129  .replace(/(^|\n) ?#+/gi,'$1')
130  ;
131  $textField.val(text);
132 }