// Licensed Materials - Property of IBM // // IBM Cognos Products: ps // // (C) Copyright IBM Corp. 2010, 2011 // // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. // Copyright (C) 2008 Cognos Incorporated. All rights reserved. // Cognos and the Cognos logo are trademarks of Cognos Incorporated. dojo.provide("ps.contentTask"); dojo.declare("ps.contentTask",null, { validateConsistencyOptions: function() { var isValid = true; if (!this._isValidForm()) { isValid = false; } else if (this._isSelectExternalNamespaces()) { isValid = false; // At least one namespace checkbox must be checked to be valid var namespaceNodes = dojo.query('input[name^="m_namespace_"]'); for (i=0; i < namespaceNodes.length;i++){ if (namespaceNodes[i].checked) { isValid = true; } } } return isValid; }, _isValidForm: function() { var hiddenInputNodes = dojo.query('input[name="cto_consistency_check"][type="hidden"]'); var formIsValid = hiddenInputNodes.length <= 1; return formIsValid; }, _isSelectExternalNamespaces: function() { var result = this._isExternalRef() && (this._isRadioButtonSelected("cto_externalnamespace","select")); return result; }, _isExternalRef: function() { var result = (this._isRadioButtonSelected("cto_consistency_check","externalRef") || this._hiddenInputExists("cto_consistency_check","externalRef")); return result; }, _isRadioButtonSelected: function(radioGroupName, selectedValue) { var radioGroupNodes = dojo.query('input[name="' + radioGroupName + '"][type="radio"]'); var isSelected = false; if (radioGroupNodes) { if (radioGroupNodes.length > 1) { for (i=0; i < radioGroupNodes.length; i++) { if (radioGroupNodes[i].value == selectedValue) { isSelected = radioGroupNodes[i].checked; } } } } return isSelected; }, _hiddenInputExists: function(radioGroupName, selectedValue) { var radioGroupNodes = dojo.query('input[name="' + radioGroupName + '"][type="hidden"]'); var exists = false; if (radioGroupNodes) { if (radioGroupNodes.length == 1) { if (radioGroupNodes[0].value == selectedValue) { exists = true; } } } return exists; } });