123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981 |
- /********************************************************************************************************************************
- * Licensed Materials - Property of IBM *
- * *
- * IBM Cognos Products: AGS *
- * *
- * (C) Copyright IBM Corp. 2005, 2009 *
- * *
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. *
- *********************************************************************************************************************************/
- // Handles Suppression Validation
- var Filter_ongoing_changed = "Filter_changed";
- var Filter_ongoing_unchanged = "Filter_unchanged";
- var Filter_new = "Filter_new";
- var Filter_stopped = "Filter_deleted";
- var Action_topic_filter = "Action_topic_filter";
- var Task_level_filter_checkbox = "action_task_filter_checkbox";
- var RunCondition = "runCondition";
- var topicError = false;
- /**
- * validate the whole agent, the summary event key is checked and all the actions
- * if there are no actions, then the wizard is moved to the end
- */
- function validateAgent(){
- var agent = parent.getAgentDefinition();
-
- var valid = agent.summaryEventKey.size() > 0 || document.pform.Event_Key[0].checked ;
- if(!valid){
- //You must select at least one item to uniquely identify the event.
- window.alert(parent.getConfigFrame().suppEvtKeyWarn_string);
- return valid;
- }
- var items = agent.summaryEventKey.items();
- for(var i = 0; valid && i < items.length; i++){
- valid = valid & validateEventKeyTopic(items[i]);
- }
- if(topicError){
- topicError = false;
- return false;
- }
- if(valid){ //& agent.getActionCount() == 0){
- valid = validateOngoingFilterTopics();
- //we can bin out if there are no more actions
- // how?
- }else{
- return false;
- }
-
- return valid;
- }
- /**
- * A new topic is added to the current selected actions filter topics
- * check if it exists in the sumary event key and ban it if it does
- */
- function validateActionFilterTopic(newActionFilterTopic){
- var inValid = true;
- if(document.pform.Event_Key[0].checked){
- inValid = false;
- }else{
- inValid = !parent.getAgentDefinition().summaryEventKey.containsItem(newActionFilterTopic);
- }
- if(!inValid){
- var remove_newItem = window.confirm( parent.getConfigFrame().suppOngFilAddWarn_string.replace('zzxx',newActionFilterTopic) );
- if(remove_newItem){
- setTabVisible('taskExecutionRulesPane',false);
- setTabVisible('setEventKeyPane',true);
- }
- inValid = remove_newItem;
- }
- return inValid;
- }
- /**
- * A new topic is added to the summary event key. check that it doesnt exist in any of the ongoing filter topics of any
- * of the actions. if it does allow the user to remove that topic from the actions, or allow the addition to become invalid
- */
- function validateEventKeyTopic(newEventKeyTopic){
- var valid = true;
-
- var offending_task;
- //check for a containing action, till we get nothing back
- if((offending_task = parent.getAgentDefinition().validateSummaryEventKeyTopic(newEventKeyTopic)) != undefined) {
- //This query item's value is in the event key of task "taskname"
- //OK if you want to remove this query item or Cancel.
-
- // zpzp is the placeholder which gets replaced in the message with the task name
- var remove_newItem = window.confirm(parent.getConfigFrame().suppOngEvntKeyWarn_string.replace('zpzp',offending_task).replace('zzxx',newEventKeyTopic));
-
- if(remove_newItem){
- parent.getAgentDefinition().removeActionFilterItem(newEventKeyTopic);
- removeEventFilterItem(newEventKeyTopic);
- changeTaskLevelFilterState();
- }else{
- // SelectAll uses this info to check if there was any conflict,
- topicError = true;
- }
- valid = false;//remove_newItem;
- }
- return valid;
- }
- // Removes Event Filter topic
- function removeEventFilterItem(topic){
- var mylist = getActionTopicFilterElementProcessor().list ;
-
- for(var i=0; i< mylist.size(); i++){
- var node = mylist.getNodeByIndex(i);
- if(node.innerText == topic){
- mylist.remove(i);
- break;
- }
- }
- }
- /**
- * check the ongoing filter topics for all actions and warn if any are in the summary event key.
- * if they are remove them.
- */
- function validateOngoingFilterTopics(){
- //check that the items in the summary
- var valid = parent.getAgentDefinition().validateOngoingFilterTopics();
- if(!valid){
- //This query item cannot be inserted because it is used in the event key.
- window.alert(parent.getConfigFrame().suppOngFilAddWarn_string);
- parent.getAgentDefinition().removeInvalidFilterTopics();
- }
-
- return valid;
- }
- /**
- * make sure that this action has the required minimum, do the warning if necessary
- * the action must have at least one filter type and if it has ongoing changed or unchanged then
- * topics must have been specified for the filter
- */
- function validateAgentAction(action){
-
- var valid = true;
-
- var f_new = action.getParams().getParamValue(Filter_new) != undefined;
- var f_stopped = action.getParams().getParamValue(Filter_stopped) != undefined;
- var f_changed = action.getParams().getParamValue(Filter_ongoing_changed) != undefined;
- var f_unchanged = action.getParams().getParamValue(Filter_ongoing_unchanged) != undefined;
- var f_none = action.getParams().getParamValue(Filter_no_events) != undefined;
- var f_taskLevelFilter = action.getParams().getParamValue(Task_level_filter_checkbox) != undefined;
- var f_runCondition = action.runCondition == "runOnFailure";
- valid = f_new || f_stopped || f_changed || f_unchanged || f_none || f_runCondition;
- if(!valid){
- window.alert(parent.getConfigFrame().suppFilWarn_string);
- }else{
- if(valid & (f_changed || f_unchanged) & ! (f_changed & f_unchanged)){
-
- valid = action.getParams().getParamValue(Action_topic_filter);
-
- if(!valid){
- //You must select at least one query item
- //window.alert(parent.getConfigFrame().suppOngFiltWarn_string);
- window.alert(parent.getConfigFrame().suppNoItemForEventWarn_string);
- }
-
- }
- if (f_taskLevelFilter) {
- valid = action.taskLevelFilter && action.taskLevelFilter.length > 0;
- if (!valid) {
- window.alert(parent.getConfigFrame().suppTaskLvlFiltWarn_string);
- }
- }
- if (valid && (f_changed ^ f_unchanged) && parent.getAgentDefinition().summaryEventKey.size() == 0) {
- valid = false;
- alert(parent.getConfigFrame().suppnoEvtKeyWarn_string);
- }
- }
- //valid = valid & validateOngoingFilterTopics();
- return valid;
- }
- /**
- * If there are no filter parameters set... then set the defualt values for this agent
- */
- function addDefaultFilterValues(action){
-
- var f_new = action.getParams().getParamValue(Filter_new) != undefined;
- var f_stopped = action.getParams().getParamValue(Filter_stopped) != undefined;
- var f_changed = action.getParams().getParamValue(Filter_ongoing_changed) != undefined;
- var f_unchanged = action.getParams().getParamValue(Filter_ongoing_unchanged) != undefined;
- var f_none = action.getParams().getParamValue(Filter_no_events) != undefined;
-
- var none_set = !f_new & !f_stopped & !f_changed & !f_unchanged & !f_none ;
-
- if(none_set){
- //we can safely set the defaults
- action.getParams().setParam(Filter_new, 'new');
- action.getParams().setParam(Filter_ongoing_changed, 'changed');
- action.getParams().setParam(Filter_ongoing_unchanged, 'unchanged');
- }
- }
- function setIndicAllTopicsInTree(){
- var dataItemTree = parent.getDataItemsTree();
- var elements = parent.getTreeChildNodes(dataItemTree);
- for (var i=0;i < elements.length;i++) {
- var item = elements[i];
- parent.setIndicator(item);
- // Fill items in the items area
- /*var items = this.list.getAllItems();
- for (var i=0;i < items.length;i++) {
- var dropValue = items[i].nodeValue;
- parent.removeIndicator(dropValue.replace(";",''));
- }*/
- //var node = document.createTextNode(item);
- //this.list.add(node);
-
- }
- return true;
- }
-
- // ********** Initialisations *************
- // moved From suppressionDialog.xts
- var eventKeyElementProcessor;
- var actionTopicFilterElementProcessor;
- function initActionTopicFilter() {
- //call the js to display the tasks
- loadAgentsToPage();
- //register the dz and the delete listener
- var id = getSelectedAction() ? getSelectedAction().id : undefined;
- var uiStyle = new CUIStyle("CList_li", "CList_over", "CList_selected", "", null);
- var cList = new CList("myCList",false, "CList_ul",uiStyle);
- var div = document.getElementById('Action_topic_filter');
- div.className = "CList_hintText_inactive";
-
- var textNode = document.createTextNode("");
-
- //This will need to be merged with the one in start.xts
- var elementProcessor = new ElementProcessor("Action_topic_filter","",false);
- setActionTopicFilterElementProcessor(elementProcessor) ;
-
- elementProcessor.defaultNode = textNode;
- elementProcessor.list = cList;
-
- elementProcessor.element.appendChild(cList.getListElement());
- elementProcessor.element.appendChild(textNode);
-
- elementProcessor.DELIM = ';';
-
- elementProcessor.remove = function() {
- if (this.list.isDisabled()) {
- return;
- }
-
- this.list.removeSelected();
- try {this.element.focus();} catch(e) {}
- this.element.blur();
- updateActionListValues();
- }
-
- elementProcessor.doSelectAction = function() {
- //Always use getSelectedAction just incase it changes
- //the action becuase it is not a valid.
- if (onSelectAction()) {
- this.list.removeAllNodes();
- this.setElementValue(getSelectedAction().getParams().getParamValue('Action_topic_filter'));
- cList.deSelectAll();
- this.updateList();
- }
- }
-
- elementProcessor.updateList = function () {
- var disable = document.pform.Filter_ongoing_specified_value.selectedIndex == 0;
- disable = disable || document.getElementById('event_rules_table').disabled;
- disable = disable || !document.pform.Filter_ongoing_group.checked;
- this.list.setDisabled(disable);
- }
-
- elementProcessor.setElementValue = function (value) {
- var canDrop = document.pform.Filter_ongoing_specified_value.selectedIndex != 0;
- canDrop = canDrop && !document.getElementById('event_rules_table').disabled;
- canDrop = canDrop && document.pform.Filter_ongoing_group.checked;
-
- if (!value || value.localeCompare("") == 0 || !canDrop) {
- if (!this.isDefaultMode()) {
- this.list.removeAllNodes();
- this.setDefaultValue();
- }
- //This is remove is helping to avoid
- //recursive calls. This should be
- //looked at and resolved.
- return;
- }
-
- //No event key so notify.
- //Make sure we only pop the message when there is nothing in the liste already and we are trying to add a new item.
- //The other case is where an item is already there and Event key is removed.
- //&& !document.pform.Event_Key[0].checked : DIALOG_SUPPRESSION_NO_EVENT_KEY_WARNING
- if (parent.getAgentDefinition().summaryEventKey.size() == 0 && getSelectedAction().nonDuplication.size() == 0 ) {
- alert(parent.getConfigFrame().suppnoEvtKeyWarn_string);
- return;
- }
-
- var elements = value.split(this.DELIM);
- for (var i=0;i < elements.length;i++) {
- if (elements[i].localeCompare("") != 0) {
- var sItem = elements[i] + this.DELIM;
- if (validateActionFilterTopic(sItem)) {
- var node = document.createTextNode(sItem);
- this.list.add(node);
- //If we are in default mode and we have just added
- //Remove the default.
- if (this.isDefaultMode()) {
- this.removeDefaultValue();
- }
- }
- }
- }
- updateActionListValues();
- }
-
- elementProcessor.getElementValue = function () {
- var textNodes = this.list.getAllItems();
- var result = '';
-
- for (var i=0;i<textNodes.length;i++) {
- result = result + textNodes[i].nodeValue;
- }
-
- return result;
- }
-
- elementProcessor.updateElementValue = function(value) {
- if (!value && value == 'undefined') {
- return;
- }
-
- if (this.isDefaultMode()) {
- this.removeDefaultValue();
- }
-
- if (this.overwrite) {
- this.listObject.removeAllNodes();
- this.setElementValue(value);
- } else {
- this.setElementValue(value);
- }
- }
-
- elementProcessor.updateStyle = function (useDefault) {
- // check to see if we have got hint text
- if (this.defaultValue.length > 0 && useDefault) {
- this.element.className="CList_hintText_active";
- } else {
- this.element.className="CList_hintText_inactive";
- }
- }
-
- elementProcessor.isDefaultMode = function () {
- var node = this.element.firstChild;
- var result = false;
-
- if (node && node.nodeType == 3) {
- result = node.nodeValue.localeCompare(this.defaultValue) == 0;
- }
- return result;
- }
-
- elementProcessor.isEmpty = function () {
- return this.getElementValue().localeCompare("") == 0;
- }
-
- elementProcessor.setDefaultValue = function () {
- //This is just a guard. Some calls do not check
- //if we arleady are in default and mode.
- if (!this.isDefaultMode()) {
- this.element.removeChild(this.list.getListElement());
- this.element.appendChild(this.defaultNode);
- this.updateStyle(true);
- }
- }
-
- elementProcessor.removeDefaultValue = function() {
- if (this.isDefaultMode()) {
- this.element.removeChild(this.defaultNode);
- this.element.appendChild(this.list.getListElement());
- this.updateStyle(false);
- }
- }
-
- elementProcessor.setDropLocation = function(event) {
- return false;
- }
-
- /**
- * Drop text is an array of text.
- */
- elementProcessor.process = function(dropText) {
- if (dropText) {
- if (this.overwrite) {
- if (dropText.length == 1) {
- this.list.removeAllNodes();
- } else {
- alert(parent.singleItemAllowed_string);
- return;
- }
- }
-
- this.setElementValue(dropText.join(this.DELIM));
- } else {
- return;
- }
- }
-
- // cool have a built in on load handler
- droppy.registerDropZone("Action_topic_filter","","", true, '', "", false, elementProcessor);
- cList.setOnDropFunc(actionTopicFilterListOnDrop);
- cList.setEqualityFunc(listEqualityCheck);
-
- droppy.setDropZoneValue(getSelectedAction().nonDuplication.items().join(''),'Action_topic_filter');
-
- cList.deSelectAll();
- }
- //<!-- page specific init and validate functions -->
- //<!-- Page calls init upon each load
- function initEventKey() {
- //disable the pasting into this control
- //parent.setPasteEnabled("Summary_event_key",false);
-
- var uiStyle = new CUIStyle("CList_li", "CList_over", "CList_selected", "", null);
-
- var cList = new CList("myCList",false, "CList_ul",uiStyle);
-
- var div = document.getElementById('Summary_event_key');
- div.className = "CList_hintText_inactive";
- var defaultSpan = document.createElement('P');
- var textNode = document.createTextNode(parent.getConfigFrame().diaActionKeyTip_string);
- defaultSpan.appendChild(textNode);
- defaultSpan.style.border = "0px";
- defaultSpan.style.padding = '0px';
- defaultSpan.style.margin = '0px';
- defaultSpan.style.cursor = 'default';
- defaultSpan.ondragenter = function(evt) { event.cancelBubble = true;return false};
- defaultSpan.ondragleave = function(evt) { event.cancelBubble = true;return false};
- var elementProcessor = new ElementProcessor("Summary_event_key", parent.getConfigFrame().diaActionKeyTip_string, false);
- setEventKeyElementProcessor(elementProcessor) ;
-
- elementProcessor.defaultNode = textNode;
- elementProcessor.list = cList;
-
- elementProcessor.element.appendChild(cList.getListElement());
- elementProcessor.element.appendChild(textNode);
-
- elementProcessor.DELIM = ';';
-
- elementProcessor.remove = function() {
- if (this.list.isDisabled()) {
- return;
- }
- var items = this.list.getAllSelectedItems();
- for (var i=0;i < items.length;i++) {
- var dropValue = items[i].nodeValue;
- parent.removeIndicator(dropValue.replace(";",''));
- }
- this.list.removeSelected();
- this.element.focus();
- this.element.blur();
- //this.indicateAll();
- updateEventKeyListValues();
- }
- elementProcessor.selectAll = function() {
- /*if (this.list.isDisabled()) {
- return;
- }*/
- // this.list.removeAllNodes();
- this.element.focus();
- this.element.blur();
- this.indicateAll();
- //updateEventKeyListValues();
-
- showEventKeys();
- if(topicError){
- topicError = false;
- document.pform.Event_Key[1].checked = true;
- }else{
- disableEventKey();
- }
- }
- elementProcessor.indicateNone = function() {
-
- var items = parent.getTreeChildNodes(parent.getDataItemsTree());
- for (var i=0;i < items.length;i++) {
- // var dropValue = items[i].nodeValue;
- parent.removeIndicator('['+items[i].getName()+']');
- }
-
- //updateEventKeyListValues();
- return true;
- }
- elementProcessor.indicateAll = function() {
- var items = parent.getTreeChildNodes(parent.getDataItemsTree());
- for (var i=0;i < items.length;i++) {
- // var dropValue = items[i].nodeValue;
- parent.setIndicator('['+items[i].getName()+']');
- }
- }
- elementProcessor.indicateSelected = function() {
- var items = this.list.getAllSelectedItems();
- for (var i=0;i < items.length;i++) {
- var nodeValue = items[i].nodeValue;
- parent.setIndicator(nodeValue.replace(";",''));
- }
- }
-
- elementProcessor.setElementValue = function (value) {
- if (!value || value.localeCompare("") == 0) {
- if (!this.isDefaultMode()) {
- this.list.removeAllNodes();
- this.setDefaultValue();
- }
- return;
- }
-
- if(!document.pform.Event_Key[1].checked){
- getEventKeyElementProcessor().indicateNone();
- }
-
- if (this.isDefaultMode()) {
- this.removeDefaultValue();
- }
-
- var elements = value.split(this.DELIM);
-
- for (var i=0;i < elements.length;i++) {
- if (elements[i].localeCompare("") != 0) {
- var sItem = elements[i] + this.DELIM;
- if (validateEventKeyTopic(sItem)) {
- parent.setIndicator(elements[i]);
- var node = document.createTextNode(sItem);
- this.list.add(node);
- }
- }
- }
- updateEventKeyListValues();
- }
-
- elementProcessor.getElementValue = function () {
- var textNodes = this.list.getAllItems();
- var result = '';
-
- for (var i=0;i<textNodes.length;i++) {
- result = result + textNodes[i].nodeValue;
- }
-
- return result;
- }
-
- elementProcessor.updateElementValue = function(value) {
- if (!value && value == 'undefined') {
- return;
- }
-
- if (this.isDefaultMode()) {
- this.removeDefaultValue();
- }
-
- if (this.overwrite) {
- this.listObject.removeAllNodes();
- this.setElementValue(value);
- } else {
- this.setElementValue(value);
- }
- }
-
- elementProcessor.updateStyle = function (useDefault) {
- // check to see if we have got hint text
- if (this.defaultValue.length > 0 && useDefault) {
- this.element.className="CList_hintText_active";
- } else {
- this.element.className="CList_hintText_inactive";
- }
- }
-
- elementProcessor.isDefaultMode = function () {
- var node = this.element.firstChild;
- var result = false;
-
- if (node && node.nodeType == 3) {
- result = node.nodeValue.localeCompare(this.defaultValue) == 0;
- }
- return result;
- }
-
- elementProcessor.isEmpty = function () {
- return this.getElementValue().localeCompare("") == 0;
- }
-
- elementProcessor.setDefaultValue = function () {
- //This is just a guard. Some calls do not check
- //if we arleady are in default and mode.
- if (!this.isDefaultMode()) {
- this.element.removeChild(this.list.getListElement());
- this.element.appendChild(this.defaultNode);
- this.updateStyle(true);
- }
- }
-
- elementProcessor.removeDefaultValue = function() {
- if (this.isDefaultMode()) {
- this.element.removeChild(this.defaultNode);
- this.element.appendChild(this.list.getListElement());
- this.updateStyle(false);
- }
- }
-
- elementProcessor.setDropLocation = function(event) {
- return false;
- }
-
- /**
- * Drop text is an array of text.
- */
- elementProcessor.process = function(dropText) {
- if (dropText) {
- if (this.overwrite) {
- if (dropText.length == 1) {
- this.list.removeAllNodes();
- } else {
- alert(parent.singleItemAllowed_string);
- return;
- }
- }
-
- this.setElementValue(dropText.join(this.DELIM));
- } else {
- return;
- }
- }
-
- // cool have a built in on load handler
- droppy.registerDropZone("Summary_event_key","","Please enter a topic", true, "SummaryEventKey", "", false, elementProcessor);
- cList.setOnDropFunc(eventKeyListOnDrop);
- cList.setEqualityFunc(listEqualityCheck);
-
- //This is the default. setting the summary event key using setDropZone will change this default accordingly.
- disableEventKey();
- //showEventKeys();
- //crap
- var eventKeys = parent.getAgentDefinition().summaryEventKey.items().join('') ;
- // if there is no key been selected it would mean all the keys are event keys
- if(eventKeys!=''){
- droppy.setDropZoneValue(eventKeys, 'Summary_event_key');
- }else{
- getEventKeyElementProcessor().indicateAll();
- showEventKeys();
- }
- }
- function listEqualityCheck(list,node) {
- var result = false;
- var items = list.getAllItems();
- for (var i=0; items && i < items.length;i++) {
- result = result || items[i].nodeValue.localeCompare(node.nodeValue) == 0;
- }
- return result;
- }
- function getEventKeyElementProcessor() {
- return eventKeyElementProcessor;
- }
- function getActionTopicFilterElementProcessor() {
- return actionTopicFilterElementProcessor;
- }
- function setEventKeyElementProcessor(elementProcessor) {
- eventKeyElementProcessor = elementProcessor;
- }
- function setActionTopicFilterElementProcessor(elementProcessor) {
- actionTopicFilterElementProcessor = elementProcessor;
- }
- function actionTopicFilterListOnDrop() {
- //get the change or unchange value
- droppy.handleInsert('Action_topic_filter');
- }
- function eventKeyListOnDrop() {
- droppy.handleInsert('Summary_event_key');
- }
- function failTaskRadioProcess(flag) {
- //document.getElementById("filter_ongoing_div").disabled = flag;
- document.getElementById('event_rules_table').disabled=flag;
- document.getElementById('id_Action_topic_filter').disabled=flag;
- //Default action.
- getSelectedAction().runCondition = "runOnSuccess";
- if (flag) {
- document.pform.Filter_new.checked = false;
- document.pform.Filter_ongoing_group.checked = false;
- document.pform.Filter_nil.checked = false;
- document.pform.Filter_deleted.checked = false;
- droppy.setDropZoneValue('','Action_topic_filter');
- //Reset everything else.
- getSelectedAction().setParams(new parent.Params());
- getSelectedAction().taskLevelFilter = "";
- getSelectedAction().runCondition = "runOnFailure";
- updateTaskLevelFilter("");
- } else {
- document.pform.Filter_new.checked = true;
- document.pform.Filter_ongoing_group.checked = true;
- checkTheBox(document.pform.Filter_new);
- checkTheBox(document.pform.Filter_ongoing_group);
- }
- changeTaskLevelFilterState();
- if (getActionTopicFilterElementProcessor()) {
- //At init this may not have been defined yet.
- getActionTopicFilterElementProcessor().updateList();
- }
- }
- function disableEventKey() {
- document.getElementById('event_keys_div').disabled = true;
- getEventKeyElementProcessor().list.setDisabled(true);
- document.pform.Event_Key[0].checked = true;
- // droppy.setDropZoneValue('','Summary_event_key');
- // need to put all nodes in the keys
- }
- function showEventKeys(){
- var dataItemTree = parent.getDataItemsTree();
- var elements = parent.getTreeChildNodes(dataItemTree);
- var str='';
- for (var i=0;i < elements.length;i++) {
- var nodeName = elements[i].getName();
- if(nodeName.length>0 && nodeName!='undefined'){
- str += '['+elements[i].getName()+'];';
- }
- }
- droppy.setDropZoneValue(str, 'Summary_event_key');
- var b = 0;
- }
- function changeTaskLevelFilterState() {
- var checked = document.pform.Filter_new.checked || document.pform.Filter_deleted.checked || document.pform.Filter_ongoing_group.checked;
- if (checked) {
- enableFilterTask()
- } else {
- disableFilterTask();
- }
- }
- function updateTaskLevelFilter(text) {
- var element = document.getElementById('task_filter_input');
- //If the table is disabled then we should not set the task filter unless
- //reset value is used
- var shouldSet = !document.getElementById('event_rules_table').disabled;
- if (element && shouldSet || text == "") {
- element.value = text?text:"";
- getSelectedAction().taskLevelFilter = text;
- document.pform.action_task_filter_checkbox.checked = text && text.length > 0;
- }
- }
- function setActionTopicDropAreaState(flag) {
- if (!flag) {
- getSelectedAction().nonDuplication.clear();
- droppy.setDropZoneValue('','Action_topic_filter');
- }
- var ongoingChecked = document.pform.Filter_ongoing_group.checked;
- var topicAreaFlag = document.pform.Filter_ongoing_specified_value.selectedIndex == 0;
- document.getElementById("actionTopicDropArea").disabled = topicAreaFlag || !ongoingChecked;
- document.pform.Filter_ongoing_specified_value.disabled = !ongoingChecked;
- getActionTopicFilterElementProcessor().updateList();
- changeTaskLevelFilterState();
- }
- function updateActionListValues() {
- //Do the nonDuplication
- getSelectedAction().nonDuplication.clear();
- getSelectedAction().setParam('Action_topic_filter', null);
- getSelectedAction().nonDuplication.parseFromString(droppy.getDropZoneValue('Action_topic_filter'));
- getSelectedAction().setParam('Action_topic_filter', droppy.getDropZoneValue('Action_topic_filter'));
- //var selectedIndex = document.pform.Filter_ongoing_specified_value.selectedIndex;
- //selectOngoing(false, selectedIndex == 0, true);
- changeTaskLevelFilterState();
- }
- function updateEventKeyListValues() {
-
- //get the change or unchange value
- parent.getAgentDefinition().summaryEventKey.clear();
- var eventKey = droppy.getDropZoneValue('Summary_event_key');
- parent.getAgentDefinition().summaryEventKey.parseFromString(eventKey);
- if (eventKey && eventKey.length > 0 && parent.getTreeChildNodes(parent.getDataItemsTree()).length!=parent.getAgentDefinition().summaryEventKey.size()) {
-
- document.getElementById('event_keys_div').disabled = false;
- getEventKeyElementProcessor().list.setDisabled(false);
- document.pform.Event_Key[1].checked = true;
- } else {
- // disableEventKey();
- //getEventKeyElementProcessor().indicateAll();
- //showEventKeys();
- //document.pform.Event_Key[0].checked = true;
- }
- }
- function ongoingClicked(flag) {
- if (flag) {
- enableOngoing();
- } else {
- disableOngoing();
- }
- checkTheBox(document.pform.Filter_ongoing_group);
- }
- function disableOngoing() {
- getSelectedAction().nonDuplication.clear();
- droppy.setDropZoneValue('','Action_topic_filter');
- document.pform.Filter_ongoing_specified_value.selectedIndex = 0;
- document.pform.Filter_ongoing_specified_value.disabled = true;
- getSelectedAction().setParam('Filter_changed',null);
- getSelectedAction().setParam('Filter_unchanged',null);
- getActionTopicFilterElementProcessor().updateList();
- disableActionTopics();
- }
- function enableOngoing() {
- document.pform.Filter_ongoing_specified_value.disabled = false;
- document.pform.Filter_ongoing_specified_value.selectedIndex = 0;
- getActionTopicFilterElementProcessor().updateList();
- disableActionTopics();
- storeOngoingActionDetails();
- }
- function disableFilterTask() {
- var filterTableSection = document.getElementById('taskLevelFilterSection');
- if (filterTableSection) {
- //Disable or enable the task level filter input.
- filterTableSection.disabled = true;
- document.pform.action_task_filter_checkbox.disabled = true;
- document.pform.task_filter_input.disabled = true;
- updateTaskLevelFilter('');
- }
- }
- function enableFilterTask() {
- var filterTableSection = document.getElementById('taskLevelFilterSection');
- if (filterTableSection) {
- //Disable or enable the task level filter input.
- filterTableSection.disabled = false;
- document.pform.action_task_filter_checkbox.disabled = false;
- document.pform.task_filter_input.disabled = false;
- }
- }
- function processActionTopicState() {
- if (document.pform.Filter_ongoing_specified_value.selectedIndex == 0) {
- disableActionTopics();
- } else {
- enableActionTopics()
- }
- document.pform.Filter_ongoing_group.checked = true;
- getActionTopicFilterElementProcessor().updateList();
- storeOngoingActionDetails();
- }
- function disableActionTopics() {
- getSelectedAction().nonDuplication.clear();
- droppy.setDropZoneValue('','Action_topic_filter');
- document.getElementById("actionTopicDropArea").disabled = true;
- }
- function enableActionTopics() {
- document.getElementById("actionTopicDropArea").disabled = false;
- }
- function validate(){
- //updateEventKeyListValues();
- var valid = false;
- if (getSelectedAction().runCondition == "runOnFailure") {
- //It is a failed task to no need to check anything.
- valid = true;
- } else {
- valid = validateAgent();
- if(valid){
- //validate the currently visible action first
- valid = validateAgentAction(getSelectedAction());
- //then all other actions
- for(var i = 0; i < parent.getAgentDefinition().getActionCount() && valid; i++) {
- var action = parent.getAgentDefinition().getActionAt(i);
- valid = validateAgentAction(action);
- if(!valid) {
- onSelectAction(action);
- setSelectedActionDisplay(action.name_id);
- }
- }
- if (!valid) {
- setTabVisible('setEventKeyPane',false);
- setTabVisible('taskExecutionRulesPane',true);
- }
- } else {
- setTabVisible('taskExecutionRulesPane',false);
- setTabVisible('setEventKeyPane',true);
- }
- }
- return valid;
- }
- function onCancel() {
- cf.hideDialogFrame();
- //var msgFrame = cf.getMessageIFrame();
- //if (msgFrame != null) {
- //var frameElement = cf.agsFormUtils.getElementByIdOrName(msgFrame.name);
- //frameElement.style.display = '';
- //}
- }
- function setTabVisible(id,isVisible)
- {
- if (null != document.getElementById(id)) {
- if (isVisible) {
- if (cf.browserCheck.isIE5Up()) {
- document.getElementById(id).style.display="block";
- } else {
- document.getElementById(id).style.display="table";
- }
- }
- else {
- document.getElementById(id).style.display="none";
- }
- } else {
- alert('Null...');
- }
- }
|