7604 |
25 Feb 19 |
nicklas |
/* $Id $ |
7604 |
25 Feb 19 |
nicklas |
2 |
------------------------------------------------------------------ |
7604 |
25 Feb 19 |
nicklas |
Copyright (C) 2012 Nicklas Nordborg |
7604 |
25 Feb 19 |
nicklas |
4 |
|
7604 |
25 Feb 19 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
7604 |
25 Feb 19 |
nicklas |
Available at http://base.thep.lu.se/ |
7604 |
25 Feb 19 |
nicklas |
7 |
|
7604 |
25 Feb 19 |
nicklas |
BASE is free software; you can redistribute it and/or |
7604 |
25 Feb 19 |
nicklas |
modify it under the terms of the GNU General Public License |
7604 |
25 Feb 19 |
nicklas |
as published by the Free Software Foundation; either version 3 |
7604 |
25 Feb 19 |
nicklas |
of the License, or (at your option) any later version. |
7604 |
25 Feb 19 |
nicklas |
12 |
|
7604 |
25 Feb 19 |
nicklas |
BASE is distributed in the hope that it will be useful, |
7604 |
25 Feb 19 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
7604 |
25 Feb 19 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7604 |
25 Feb 19 |
nicklas |
GNU General Public License for more details. |
7604 |
25 Feb 19 |
nicklas |
17 |
|
7604 |
25 Feb 19 |
nicklas |
You should have received a copy of the GNU General Public License |
7604 |
25 Feb 19 |
nicklas |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
7604 |
25 Feb 19 |
nicklas |
20 |
------------------------------------------------------------------ |
7604 |
25 Feb 19 |
nicklas |
21 |
|
7604 |
25 Feb 19 |
nicklas |
@author Nicklas |
7604 |
25 Feb 19 |
nicklas |
23 |
*/ |
7604 |
25 Feb 19 |
nicklas |
'use strict'; |
7604 |
25 Feb 19 |
nicklas |
25 |
|
7604 |
25 Feb 19 |
nicklas |
var JobAgents = function() |
7604 |
25 Feb 19 |
nicklas |
27 |
{ |
7604 |
25 Feb 19 |
nicklas |
var agents = {}; |
7604 |
25 Feb 19 |
nicklas |
29 |
|
7604 |
25 Feb 19 |
nicklas |
30 |
/** |
7604 |
25 Feb 19 |
nicklas |
Initialize the page. |
7604 |
25 Feb 19 |
nicklas |
32 |
*/ |
7604 |
25 Feb 19 |
nicklas |
agents.initPage = function() |
7604 |
25 Feb 19 |
nicklas |
34 |
{ |
7604 |
25 Feb 19 |
nicklas |
var pageId = Doc.getPageId(); |
7604 |
25 Feb 19 |
nicklas |
if (pageId == 'edit-page') |
7604 |
25 Feb 19 |
nicklas |
37 |
{ |
7604 |
25 Feb 19 |
nicklas |
// Save + Close buttons |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnSave', agents.save); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('close', App.closeWindow); |
7604 |
25 Feb 19 |
nicklas |
41 |
|
7604 |
25 Feb 19 |
nicklas |
// Tab validation |
7604 |
25 Feb 19 |
nicklas |
TabControl.addTabValidator('settings.info', agents.validateJobAgent); |
7604 |
25 Feb 19 |
nicklas |
44 |
|
7604 |
25 Feb 19 |
nicklas |
// Port number |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('port', 'keypress', Events.integerOnly); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('useDefaultPort', agents.setPortNumber); |
7604 |
25 Feb 19 |
nicklas |
48 |
|
7604 |
25 Feb 19 |
nicklas |
// Plugin settings |
7604 |
25 Feb 19 |
nicklas |
agents.pluginSettings = Data.json('page-data', 'plugin-settings'); |
7604 |
25 Feb 19 |
nicklas |
51 |
|
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('plugins', 'click', agents.pluginsOnClick); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('plugins', 'base-selected', agents.pluginsOnClick); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('btnRemovePlugins', 'click', agents.hidePluginSettings); |
7604 |
25 Feb 19 |
nicklas |
55 |
|
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('maxMemory', 'blur', agents.maxMemoryOnBlur); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('useDefaultMaxMemory', 'click', agents.useDefaultMaxMemoryOnClick) |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('trustedDefault', 'click', agents.trustedOnClick); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('trustedYes', 'click', agents.trustedOnClick); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('trustedNo', 'click', agents.trustedOnClick); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('priorityBoost', 'keypress', Events.integerOnly); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('priorityBoost', 'blur', agents.priorityBoostOnBlur); |
7604 |
25 Feb 19 |
nicklas |
63 |
|
7604 |
25 Feb 19 |
nicklas |
var selectedPlugin = Data.get('page-data', 'select-plugin'); |
7604 |
25 Feb 19 |
nicklas |
if (selectedPlugin) agents.selectPlugin(selectedPlugin); |
7604 |
25 Feb 19 |
nicklas |
66 |
|
7604 |
25 Feb 19 |
nicklas |
67 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (pageId == 'view-page') |
7604 |
25 Feb 19 |
nicklas |
69 |
{ |
7604 |
25 Feb 19 |
nicklas |
var itemId = Data.get('page-data', 'item-id'); |
7604 |
25 Feb 19 |
nicklas |
var attributes = {'item-type': 'JOBAGENT', 'item-id': itemId}; |
7604 |
25 Feb 19 |
nicklas |
72 |
|
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnEdit', Buttons.editItem, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnDelete', Buttons.deleteItem, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnRestore', Buttons.restoreItem, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnUsingItems', Buttons.showUsingItems, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnDeletePermanently', Buttons.deleteItemPermanently, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnShare', Buttons.shareItem, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnSetOwner', Buttons.setOwner, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnExport', Buttons.runPlugin, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnImport', Buttons.runPlugin, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnRunPlugin', Buttons.runPlugin, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnPause', agents.controlJobAgent, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnStart', agents.controlJobAgent, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
85 |
|
7604 |
25 Feb 19 |
nicklas |
86 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (pageId == 'list-page') |
7604 |
25 Feb 19 |
nicklas |
88 |
{ |
7604 |
25 Feb 19 |
nicklas |
var attributes = {'item-type': 'JOBAGENT'}; |
7604 |
25 Feb 19 |
nicklas |
var tableAttributes = {'table-id': 'agents'}; |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnNewItem', Buttons.newItem, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnDeleteItems', Buttons.deleteItems, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnRestoreItems', Buttons.restoreItems, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnShareItems', Buttons.shareItems, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnSetOwner', Buttons.setOwnerOfItems, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnColumns', Buttons.configureColumns, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnExport', Buttons.runListPlugin, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnImport', Buttons.runListPlugin, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnRunPlugin', Buttons.runListPlugin, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnPause', agents.controlJobAgents, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnStart', agents.controlJobAgents, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('close', App.closeWindow); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnOk', Buttons.returnSelected, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
104 |
} |
7604 |
25 Feb 19 |
nicklas |
105 |
} |
7604 |
25 Feb 19 |
nicklas |
106 |
|
7604 |
25 Feb 19 |
nicklas |
// Add event handlers to the 'configure plugin settings' icons |
7604 |
25 Feb 19 |
nicklas |
agents.initElements = function(element, autoInit) |
7604 |
25 Feb 19 |
nicklas |
109 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (autoInit == 'configure-plugin') |
7604 |
25 Feb 19 |
nicklas |
111 |
{ |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler(element, agents.configurePlugin); |
7604 |
25 Feb 19 |
nicklas |
113 |
} |
7604 |
25 Feb 19 |
nicklas |
114 |
} |
7604 |
25 Feb 19 |
nicklas |
115 |
|
7604 |
25 Feb 19 |
nicklas |
agents.controlJobAgent = function(event) |
7604 |
25 Feb 19 |
nicklas |
117 |
{ |
7604 |
25 Feb 19 |
nicklas |
var cmd = Data.get(event.currentTarget, 'action'); |
7604 |
25 Feb 19 |
nicklas |
var itemId = Data.get(event.currentTarget, 'item-id'); |
7604 |
25 Feb 19 |
nicklas |
var url = 'index.jsp?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&cmd='+cmd+'&item_id='+itemId; |
7604 |
25 Feb 19 |
nicklas |
location.replace(url); |
7604 |
25 Feb 19 |
nicklas |
Table.submitSelected('agents', cmd); |
7604 |
25 Feb 19 |
nicklas |
124 |
} |
7604 |
25 Feb 19 |
nicklas |
125 |
|
7604 |
25 Feb 19 |
nicklas |
agents.controlJobAgents = function(event) |
7604 |
25 Feb 19 |
nicklas |
127 |
{ |
7604 |
25 Feb 19 |
nicklas |
var cmd = Data.get(event.currentTarget, 'action'); |
7604 |
25 Feb 19 |
nicklas |
Table.submitSelected('agents', cmd); |
7604 |
25 Feb 19 |
nicklas |
130 |
} |
7604 |
25 Feb 19 |
nicklas |
131 |
|
7604 |
25 Feb 19 |
nicklas |
agents.configurePlugin = function(event) |
7604 |
25 Feb 19 |
nicklas |
133 |
{ |
7604 |
25 Feb 19 |
nicklas |
var itemId = Data.get('page-data', 'item-id'); |
7604 |
25 Feb 19 |
nicklas |
var pluginId = Data.get(event.currentTarget, 'plugin-id'); |
7604 |
25 Feb 19 |
nicklas |
Items.editItem('JOBAGENT', itemId, '&plugin_id='+pluginId); |
7604 |
25 Feb 19 |
nicklas |
137 |
} |
7604 |
25 Feb 19 |
nicklas |
138 |
|
7604 |
25 Feb 19 |
nicklas |
agents.validateJobAgent = function() |
7604 |
25 Feb 19 |
nicklas |
140 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['agent']; |
7604 |
25 Feb 19 |
nicklas |
if (Strings.trim(frm.name.value) == '') |
7604 |
25 Feb 19 |
nicklas |
143 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.name, 'You must enter a name'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
146 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (Strings.trim(frm.external_id.value) == '') |
7604 |
25 Feb 19 |
nicklas |
148 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.external_id, 'You must enter an external ID'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
151 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (Strings.trim(frm.port.value) != '') |
7604 |
25 Feb 19 |
nicklas |
153 |
{ |
7604 |
25 Feb 19 |
nicklas |
var port = parseInt(frm.port.value); |
7604 |
25 Feb 19 |
nicklas |
if (port < 1 || port > 65535) |
7604 |
25 Feb 19 |
nicklas |
156 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.port, 'The port value must be between 1 and 65535'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
159 |
} |
7604 |
25 Feb 19 |
nicklas |
160 |
} |
7604 |
25 Feb 19 |
nicklas |
return true; |
7604 |
25 Feb 19 |
nicklas |
162 |
} |
7604 |
25 Feb 19 |
nicklas |
163 |
|
7604 |
25 Feb 19 |
nicklas |
agents.save = function() |
7604 |
25 Feb 19 |
nicklas |
165 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['agent']; |
7604 |
25 Feb 19 |
nicklas |
if (TabControl.validateActiveTab('settings')) |
7604 |
25 Feb 19 |
nicklas |
168 |
{ |
7604 |
25 Feb 19 |
nicklas |
Link.exportActions('plugins'); |
7604 |
25 Feb 19 |
nicklas |
var plugins = Link.getIdsInList(frm.plugins, 'PLUGINDEFINITION'); |
7604 |
25 Feb 19 |
nicklas |
for (var i = 0; i < plugins.length; i++) |
7604 |
25 Feb 19 |
nicklas |
172 |
{ |
7604 |
25 Feb 19 |
nicklas |
var pluginId = plugins[i]; |
7604 |
25 Feb 19 |
nicklas |
var settings = agents.getPluginSettings(pluginId); |
7604 |
25 Feb 19 |
nicklas |
if (settings) |
7604 |
25 Feb 19 |
nicklas |
176 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (settings.maxMemory) |
7604 |
25 Feb 19 |
nicklas |
178 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.addHidden(frm, 'maxMemory.'+pluginId, settings.maxMemory); |
7604 |
25 Feb 19 |
nicklas |
180 |
} |
7604 |
25 Feb 19 |
nicklas |
Forms.addHidden(frm, 'trusted.'+pluginId, settings.trusted); |
7604 |
25 Feb 19 |
nicklas |
Forms.addHidden(frm, 'priorityBoost.'+pluginId, settings.priorityBoost); |
7604 |
25 Feb 19 |
nicklas |
183 |
} |
7604 |
25 Feb 19 |
nicklas |
184 |
} |
7604 |
25 Feb 19 |
nicklas |
Forms.addHidden(frm, 'allPlugins', plugins.join(',')); |
7604 |
25 Feb 19 |
nicklas |
frm.submit(); |
7604 |
25 Feb 19 |
nicklas |
187 |
} |
7604 |
25 Feb 19 |
nicklas |
188 |
} |
7604 |
25 Feb 19 |
nicklas |
189 |
|
7604 |
25 Feb 19 |
nicklas |
agents.setPortNumber = function(event) |
7604 |
25 Feb 19 |
nicklas |
191 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['agent']; |
7604 |
25 Feb 19 |
nicklas |
frm.port.value = Data.get(event.currentTarget, 'port'); |
7604 |
25 Feb 19 |
nicklas |
194 |
} |
7604 |
25 Feb 19 |
nicklas |
195 |
|
7604 |
25 Feb 19 |
nicklas |
agents.getPluginSettings = function(pluginId) |
7604 |
25 Feb 19 |
nicklas |
197 |
{ |
7604 |
25 Feb 19 |
nicklas |
for (var i = 0; i < agents.pluginSettings.length; i++) |
7604 |
25 Feb 19 |
nicklas |
199 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (agents.pluginSettings[i].pluginId == pluginId) |
7604 |
25 Feb 19 |
nicklas |
201 |
{ |
7604 |
25 Feb 19 |
nicklas |
return agents.pluginSettings[i]; |
7604 |
25 Feb 19 |
nicklas |
203 |
} |
7604 |
25 Feb 19 |
nicklas |
204 |
} |
7604 |
25 Feb 19 |
nicklas |
return null; |
7604 |
25 Feb 19 |
nicklas |
206 |
} |
7604 |
25 Feb 19 |
nicklas |
207 |
|
7604 |
25 Feb 19 |
nicklas |
agents.selectPlugin = function(pluginId) |
7604 |
25 Feb 19 |
nicklas |
209 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['agent']; |
7604 |
25 Feb 19 |
nicklas |
for (var i = 0; i < frm.plugins.length; i++) |
7604 |
25 Feb 19 |
nicklas |
212 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (frm.plugins[i].item.id == pluginId) |
7604 |
25 Feb 19 |
nicklas |
214 |
{ |
7604 |
25 Feb 19 |
nicklas |
frm.plugins.selectedIndex = i; |
7604 |
25 Feb 19 |
nicklas |
agents.pluginsOnClick(); |
7604 |
25 Feb 19 |
nicklas |
return; |
7604 |
25 Feb 19 |
nicklas |
218 |
} |
7604 |
25 Feb 19 |
nicklas |
219 |
} |
7604 |
25 Feb 19 |
nicklas |
220 |
} |
7604 |
25 Feb 19 |
nicklas |
221 |
|
7604 |
25 Feb 19 |
nicklas |
222 |
|
7604 |
25 Feb 19 |
nicklas |
223 |
/** |
7604 |
25 Feb 19 |
nicklas |
When selecting a plugin in the list, the |
7604 |
25 Feb 19 |
nicklas |
settings for it should be displayed. |
7604 |
25 Feb 19 |
nicklas |
226 |
*/ |
7604 |
25 Feb 19 |
nicklas |
agents.pluginsOnClick = function() |
7604 |
25 Feb 19 |
nicklas |
228 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['agent']; |
7604 |
25 Feb 19 |
nicklas |
var settings; |
7604 |
25 Feb 19 |
nicklas |
if (frm.plugins.selectedIndex >= 0) |
7604 |
25 Feb 19 |
nicklas |
232 |
{ |
7604 |
25 Feb 19 |
nicklas |
var item = frm.plugins[frm.plugins.selectedIndex].item; |
7604 |
25 Feb 19 |
nicklas |
var pluginId = item ? item.id : null; |
7604 |
25 Feb 19 |
nicklas |
settings = agents.getPluginSettings(pluginId); |
7604 |
25 Feb 19 |
nicklas |
236 |
} |
7604 |
25 Feb 19 |
nicklas |
237 |
|
7604 |
25 Feb 19 |
nicklas |
if (settings) |
7604 |
25 Feb 19 |
nicklas |
239 |
{ |
7604 |
25 Feb 19 |
nicklas |
Doc.show('pluginsettings'); |
7604 |
25 Feb 19 |
nicklas |
// Set max memory |
7604 |
25 Feb 19 |
nicklas |
frm.useDefaultMaxMemory.checked = !settings.maxMemory; |
7604 |
25 Feb 19 |
nicklas |
frm.maxMemory.value = settings.maxMemory || ''; |
7604 |
25 Feb 19 |
nicklas |
frm.maxMemory.disabled = frm.useDefaultMaxMemory.checked; |
7604 |
25 Feb 19 |
nicklas |
245 |
|
7604 |
25 Feb 19 |
nicklas |
var defaultMaxMemory = Doc.element('defaultMaxMemory'); |
7604 |
25 Feb 19 |
nicklas |
defaultMaxMemory.innerHTML = settings.defaultMaxMemory || '<i>not specified</i>'; |
7604 |
25 Feb 19 |
nicklas |
248 |
|
7604 |
25 Feb 19 |
nicklas |
// Set trusted |
7604 |
25 Feb 19 |
nicklas |
Forms.checkRadio(frm.trusted, settings.trusted); |
7604 |
25 Feb 19 |
nicklas |
var defaultTrusted = Doc.element('defaultTrusted'); |
7604 |
25 Feb 19 |
nicklas |
defaultTrusted.innerHTML = settings.defaultTrusted ? 'yes' : 'no'; |
7604 |
25 Feb 19 |
nicklas |
253 |
|
7604 |
25 Feb 19 |
nicklas |
// Set priority boost |
7604 |
25 Feb 19 |
nicklas |
frm.priorityBoost.value = settings.priorityBoost; |
7604 |
25 Feb 19 |
nicklas |
256 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
258 |
{ |
7604 |
25 Feb 19 |
nicklas |
Doc.hide('pluginsettings'); |
7604 |
25 Feb 19 |
nicklas |
260 |
} |
7604 |
25 Feb 19 |
nicklas |
261 |
} |
7604 |
25 Feb 19 |
nicklas |
262 |
|
7604 |
25 Feb 19 |
nicklas |
agents.hidePluginSettings = function() |
7604 |
25 Feb 19 |
nicklas |
264 |
{ |
7604 |
25 Feb 19 |
nicklas |
Doc.hide('pluginsettings'); |
7604 |
25 Feb 19 |
nicklas |
266 |
} |
7604 |
25 Feb 19 |
nicklas |
267 |
|
7604 |
25 Feb 19 |
nicklas |
agents.maxMemoryOnBlur = function() |
7604 |
25 Feb 19 |
nicklas |
269 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['agent']; |
7604 |
25 Feb 19 |
nicklas |
var pluginId = frm.plugins[frm.plugins.selectedIndex].item.id; |
7604 |
25 Feb 19 |
nicklas |
var settings = agents.getPluginSettings(pluginId); |
7604 |
25 Feb 19 |
nicklas |
if (settings) |
7604 |
25 Feb 19 |
nicklas |
274 |
{ |
7604 |
25 Feb 19 |
nicklas |
settings.maxMemory = frm.maxMemory.value; |
7604 |
25 Feb 19 |
nicklas |
276 |
} |
7604 |
25 Feb 19 |
nicklas |
277 |
} |
7604 |
25 Feb 19 |
nicklas |
278 |
|
7604 |
25 Feb 19 |
nicklas |
agents.useDefaultMaxMemoryOnClick = function() |
7604 |
25 Feb 19 |
nicklas |
280 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['agent']; |
7604 |
25 Feb 19 |
nicklas |
var pluginId = frm.plugins[frm.plugins.selectedIndex].item.id; |
7604 |
25 Feb 19 |
nicklas |
var settings = agents.getPluginSettings(pluginId); |
7604 |
25 Feb 19 |
nicklas |
if (settings) |
7604 |
25 Feb 19 |
nicklas |
285 |
{ |
7604 |
25 Feb 19 |
nicklas |
var useDefault = frm.useDefaultMaxMemory.checked; |
7604 |
25 Feb 19 |
nicklas |
287 |
|
7604 |
25 Feb 19 |
nicklas |
settings.maxMemory = useDefault ? null : frm.maxMemory.value; |
7604 |
25 Feb 19 |
nicklas |
frm.maxMemory.disabled = useDefault; |
7604 |
25 Feb 19 |
nicklas |
if (!frm.maxMemory.disabled) frm.maxMemory.focus(); |
7604 |
25 Feb 19 |
nicklas |
291 |
} |
7604 |
25 Feb 19 |
nicklas |
292 |
} |
7604 |
25 Feb 19 |
nicklas |
293 |
|
7604 |
25 Feb 19 |
nicklas |
294 |
|
7604 |
25 Feb 19 |
nicklas |
agents.trustedOnClick = function() |
7604 |
25 Feb 19 |
nicklas |
296 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['agent']; |
7604 |
25 Feb 19 |
nicklas |
var pluginId = frm.plugins[frm.plugins.selectedIndex].item.id; |
7604 |
25 Feb 19 |
nicklas |
var settings = agents.getPluginSettings(pluginId); |
7604 |
25 Feb 19 |
nicklas |
300 |
|
7604 |
25 Feb 19 |
nicklas |
if (settings) |
7604 |
25 Feb 19 |
nicklas |
302 |
{ |
7604 |
25 Feb 19 |
nicklas |
var selected = Forms.getCheckedRadio(frm.trusted); |
7604 |
25 Feb 19 |
nicklas |
if (selected != null) |
7604 |
25 Feb 19 |
nicklas |
305 |
{ |
7604 |
25 Feb 19 |
nicklas |
settings.trusted = selected.value; |
7604 |
25 Feb 19 |
nicklas |
307 |
} |
7604 |
25 Feb 19 |
nicklas |
308 |
} |
7604 |
25 Feb 19 |
nicklas |
309 |
} |
7604 |
25 Feb 19 |
nicklas |
310 |
|
7604 |
25 Feb 19 |
nicklas |
agents.priorityBoostOnBlur = function() |
7604 |
25 Feb 19 |
nicklas |
312 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['agent']; |
7604 |
25 Feb 19 |
nicklas |
var pluginId = frm.plugins[frm.plugins.selectedIndex].item.id; |
7604 |
25 Feb 19 |
nicklas |
var settings = agents.getPluginSettings(pluginId); |
7604 |
25 Feb 19 |
nicklas |
316 |
|
7604 |
25 Feb 19 |
nicklas |
if (settings) |
7604 |
25 Feb 19 |
nicklas |
318 |
{ |
7604 |
25 Feb 19 |
nicklas |
var priorityBoost = parseInt(frm.priorityBoost.value); |
7604 |
25 Feb 19 |
nicklas |
if (priorityBoost < 0 || priorityBoost > 10) |
7604 |
25 Feb 19 |
nicklas |
321 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.priorityBoost, 'The priority boost must be between 0 and 10'); |
7604 |
25 Feb 19 |
nicklas |
return; |
7604 |
25 Feb 19 |
nicklas |
324 |
} |
7604 |
25 Feb 19 |
nicklas |
settings.priorityBoost = priorityBoost; |
7604 |
25 Feb 19 |
nicklas |
326 |
} |
7604 |
25 Feb 19 |
nicklas |
327 |
} |
7604 |
25 Feb 19 |
nicklas |
328 |
|
7604 |
25 Feb 19 |
nicklas |
return agents; |
7604 |
25 Feb 19 |
nicklas |
330 |
}(); |
7604 |
25 Feb 19 |
nicklas |
331 |
|
7604 |
25 Feb 19 |
nicklas |
Doc.addElementInitializer(JobAgents.initElements); |
7604 |
25 Feb 19 |
nicklas |
Doc.onLoad(JobAgents.initPage); |