19 function addArsGo(formid, selectid)
21 var selectobj = document.getElementById(selectid);
22 var agentId = selectobj.options[selectobj.selectedIndex].value;
23 document.getElementById(formid).action =
'$action' +
'&agent=' + agentId;
24 document.getElementById(formid).submit();
28 jQuery.extend(jQuery.fn.dataTableExt.oSort, {
29 "num-html-pre": function (a) {
30 var x = String(a).replace(/<[\s\S]*?>/g,
"");
33 "num-html-asc": function (a, b) {
34 return ((a < b) ? -1 : ((a > b) ? 1 : 0));
36 "num-html-desc":
function (a, b) {
37 return ((a < b) ? 1 : ((a > b) ? -1 : 0));
41 $(document).ready(
function () {
42 if (typeof createLicHistTable ===
'function') {
46 searchField = $(
'#dirlist_filter input');
47 var dirListFilter = getCookie(
'dirListFilter');
48 filterLicense(dirListFilter);
49 searchField.keyup(
function () {
50 setCookie(
'dirListFilter', $(
this).val());
53 var scanFilter = getCookie(
'scanFilter');
57 $(
'#scanFilter option[value='+scanFilter+
']').parent().val(scanFilter);
58 $(
'#scanFilter').change(
function (){ filterScan($(
this).val(),
'scan'); });
60 var conFilter = getCookie(
'conFilter');
64 $(
'#conFilter option[value='+conFilter+
']').parent().val(conFilter);
65 $(
'#conFilter').change(
function (){ filterScan($(
this).val(),
'con'); });
67 var openFilter = getCookie(
'openFilter');
68 if(openFilter===
'true' || openFilter===
'checked') {
69 $(
'#openCBoxFilter').prop(
'checked',openFilter);
71 $(
'#openCBoxFilter').click(
function (){
72 setCookie(
'openFilter', $(
this).prop(
'checked'));
76 if (typeof createDirlistTable ===
'function') {
79 $(
"form[data-autosubmit] select").change(
function () {
80 $(
this).closest(
'form').submit();
85 function filterLicense(licenseShortName) {
86 var searchField = $(
'#dirlist_filter input');
87 searchField.val(licenseShortName);
89 searchField.trigger(
'keyup');
92 function clearSearchLicense() {
93 var searchField = $(
'#lichistogram_filter input');
96 searchField.trigger(
'keyup.DT');
99 function clearSearchFiles() {
100 $(
'#dirlist_filter_license').val(
'');
101 var searchField = $(
'#dirlist_filter input');
104 searchField.trigger(
'keyup');
108 function scheduleScan(upload, agentName, resultEntityKey) {
110 "agentName": agentName,
114 var resultEntity = $(resultEntityKey);
119 url:
"?mod=scheduleAgentAjax",
121 success:
function (data) {
122 var jqPk = data.jqid;
124 resultEntity.html(
"scan scheduled as " + linkToJob(jqPk) +
"<br/>");
125 $(
'#' + agentName.replace(
"agent_",
"") +
"_span").hide();
126 queueUpdateCheck(jqPk,
function () {
127 resultEntity.html(agentName.replace(
"agent_",
"") +
" done.<br/>");
129 resultEntity.html(agentName.replace(
"agent_",
"") +
" failed!<br/>");
134 resultEntity.html(
"Bad response from server. <br/>");
138 error:
function (responseobject) {
139 var error = responseobject.responseJSON.error;
140 resultEntity.html((error ?
"error: " + error :
"error") +
"<br/>");
146 function dressContents(data, type, full) {
147 if (type ===
'display') {
148 return '<a href=\'#\' onclick=\'filterScan(' + data[1] +
',\"scan\")\'>' + data[0] +
'</a>';
153 function filterScan(
id,keyword) {
154 if(keyword===
'scan'){
155 $(
'#scanFilter').val(
id);
156 setCookie(
'scanFilter',
id);
158 else if(keyword===
'con')
160 $(
'#conFilter').val(
id);
161 setCookie(
'conFilter',
id);
166 function resetFilters()
168 $(
'#scanFilter').val(0);
169 $(
'#conFilter').val(0);
170 $(
'#openCBoxFilter').attr(
'checked',
false);