/*
 * Copyright 2005-2007 WSO2, Inc. (http://wso2.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
This file is soulely dedicated to hold breadcrums.
Most of the methods linked with xslts.
*/

////////////// Services ////////////////

function showWizardUpdate(updateDiv){
  var _text="<h4><a href='#' onClick='javascript:showServiceInitializer(); return false;'>Services</a>&nbsp;&gt;&nbsp;Service Archive Generation </h4>";
  updateDiv.innerHTML=_text;
}

function showlistFaultyServices(_updateDiv) {
    var _text = "<h4><a href='#' onClick='javascript:showServiceInitializer(); return false;'>Services</a>&nbsp;&gt;&nbsp;Faulty Services</h4>";
    _updateDiv.innerHTML = _text;
}

///////////// Modules //////////////////

function showconfigureModuleHeader(_updateDiv) {
    var _text = "<h4><a href=\"#\" onClick=\"javascript:listModules(); return false;\">Modules</a>&nbsp;&gt;&nbsp;" +
                "<a href=\"#\" onClick=\"javascript:getModuleInfo('"+ getLastUsedModuleId() +"','"+getLastUsedModuleVersion()+"'); return false;\">"+ getLastUsedModuleId() + "</a>&nbsp;&gt;&nbsp;"+
                                           "Parameters</h4>";
    _updateDiv.innerHTML = _text;
}

function showgetModuleParameterHeader(_updateDiv) {
    var _text = "<h4 id='pageHeader'><a href=\"#\" onClick=\"javascript:listModules(); return false;\">Modules</a>&nbsp;&gt;&nbsp;" +
                                           "Module Information for "+ getLastUsedModuleId() + "</h4>";
    _updateDiv.innerHTML = _text;
}

function showSandeshaModuleHeader(_updateDiv) {
    var _text = "<h4><a href=\"#\" onClick=\"javascript:listModules(); return false;\">Modules</a>&nbsp;&gt;&nbsp;" +
                "<a href=\"#\" onClick=\"javascript:getModuleInfo('"+ getLastUsedModuleId() +"','"+getLastUsedModuleVersion()+"'); return false;\">"+ getLastUsedModuleId() + "</a>&nbsp;&gt;&nbsp;"+
                                           "Sandesha2 Runtime Information</h4>";
    _updateDiv.innerHTML = _text;

}

/////////// Dynamic Client /////////////

function showdynamicClientMetaInfo(_updateDiv) {
    var _text = "<h4><a href=\"#\" onClick=\"javascript:showServiceInitializer(); return false;\">Services</a>&nbsp;&gt;&nbsp;" +
                                   "<a href=\"#\" onClick=\"javascript:listServiceData('"+ getServiceSpecificName() +"'); return false;\">"+ getServiceSpecificName() + "</a>&nbsp;&gt;&nbsp;" + "Select Port" +"</h4>";
    _updateDiv.innerHTML = _text;
}

///////// Operations //////////////////

function showlistOperationParamEditHeader(_updateDiv) {
    var _text = "<h4><a href=\"#\" onClick=\"javascript:showServiceInitializer(); return false;\">Services</a>&nbsp;&gt;&nbsp;" +
                                   "<a href=\"#\" onClick=\"javascript:listServiceData('"+ getServiceSpecificName() +"'); return false;\">"+ getServiceSpecificName() + "</a>&nbsp;&gt;&nbsp;" +
                                   "<a href=\"#\" onClick=\"javascript:listAllOperations('"+ getServiceSpecificName() +"'); return false;\">Operation&nbsp;["+ getServiceOperationParameters() +"]&nbsp;</a>&nbsp;&gt;&nbsp;" + "Parameters" +"</h4>";
    _updateDiv.innerHTML = _text;
}

function showlistOperationParamAndStatisticsEditHeader(_updateDiv) {
    var _text = "<h4><a href=\"#\" onClick=\"javascript:showServiceInitializer(); return false;\">Services</a>&nbsp;&gt;&nbsp;" +
                                   "<a href=\"#\" onClick=\"javascript:listServiceData('"+ getServiceSpecificName() +"'); return false;\">"+ getServiceSpecificName() + "</a>&nbsp;&gt;&nbsp;" +
                                   "<a href=\"#\" onClick=\"javascript:listAllOperations('"+ getServiceSpecificName() +"'); return false;\">Operation&nbsp;["+ getServiceOperationParameters() +"]&nbsp;</a>&nbsp;&gt;&nbsp;" + "Operation Statistics &amp; Parameters  " +"</h4><p>&nbsp;</p>";
    _updateDiv.innerHTML = _text;
}

function showlistOperationsHeader(_updateDiv) {
    var _text = "<h4><a href=\"#\" onClick=\"javascript:showServiceInitializer(); return false;\">Services</a>&nbsp;&gt;&nbsp;" +
                                           "<a href=\"#\" onClick=\"javascript:listServiceData('"+ getServiceSpecificName() +"'); return false;\">"+ getServiceSpecificName() + "</a>&nbsp;&gt;&nbsp;" +"Operations" +"</h4>";
    _updateDiv.innerHTML = _text;
}

/////////// Parameters ////////////////

function showlistServiceGroupParamHeader(_updateDiv) {
    var _text = "<h4><a href=\"#\" onClick=\"javascript:showServiceInitializer(); return false;\">Services</a>&nbsp;&gt;&nbsp;" +"<a href=\"#\" onClick=\"javascript:showServiceGroupInfo('"+moduleServiceGroupName+"'); return false;\">ServiceGroup["+moduleServiceGroupName+"]</a>&nbsp;&gt;&nbsp;" +"Parameters</h4>";
    _updateDiv.innerHTML = _text;
}

function showlistServiceLevelParamHeader(_updateDiv) {
    var _text = "<h4><a href=\"#\" onClick=\"javascript:showServiceInitializer(); return false;\">Services</a>&nbsp;&gt;&nbsp;" +
								   "<a href=\"#\" onClick=\"javascript:listServiceData('"+ getServiceSpecificName() +"'); return false;\">"+ getServiceSpecificName() + "</a>&nbsp;&gt;&nbsp;" +
								   "Parameters" +"</h4>";
    _updateDiv.innerHTML = _text;
}

function showlistServiceParamHeader(_updateDiv) {
    var _text = "<h4><a href='#' onClick='javascript:showServiceInitializer(); return false;'>Services</a>&nbsp;&gt;&nbsp;" +
								   "<a href='#' onClick='javascript:listServiceData(\"" + getServiceSpecificName() +"\"); return false;'>" + getServiceSpecificName() + "</a>&nbsp;&gt;&nbsp;" +
								   "<a href='#' onClick='javascript:listAllOperations(\""+ getServiceSpecificName() +"\"); return false;'>Operation&nbsp;["+ getServiceOperationParameters() +"]&nbsp;</a>&nbsp;&gt;&nbsp;Parameters</h4>";
    _updateDiv.innerHTML = _text;
}

function showlistServiceParamEditHeader(_updateDiv) {
    var _text = "<h4><a href=\"#\" onClick=\"javascript:showServiceInitializer(); return false;\">Services</a>&nbsp;&gt;&nbsp;" +
                                   "<a href=\"#\" onClick=\"javascript:listServiceData('"+ getServiceSpecificName() +"'); return false;\">"+ getServiceSpecificName() + "</a>&nbsp;&gt;&nbsp;" + "Parameters" +"</h4>";
    _updateDiv.innerHTML = _text;
}

function showSTSHeader(_updateDiv) {
    var _text = "<h4><a href=\"#\" onClick=\"javascript:showServiceInitializer(); return false;\">Services</a>&nbsp;&gt;&nbsp;" +
                                   "<a href=\"#\" onClick=\"javascript:listServiceData('"+ getServiceSpecificName() +"'); return false;\">"+ getServiceSpecificName() + "</a>&nbsp;&gt;&nbsp;" + "STS Configuration" +"</h4>";
    _updateDiv.innerHTML = _text;
}

//////////// Policy Information ////////////

function showlistPolicyInfoEditHeader(_updateDiv) {
    var _text = "<h4><a href=\"#\" onClick=\"javascript:showServiceInitializer(); return false;\">Services</a>&nbsp;&gt;&nbsp;" +
                                   "<a href=\"#\" onClick=\"javascript:listServiceData('"+ getServiceSpecificName() +"'); return false;\">"+ getServiceSpecificName() + "</a>&nbsp;&gt;&nbsp;" + "Policy Info" +"</h4>";
    _updateDiv.innerHTML = _text;
}

function showlistPolicyModuleHeader(_updateDiv) {
    
    var _text = "<h4><a href=\"#\" onClick=\"javascript:listModules(); return false;\">Modules</a>&nbsp;&gt;&nbsp;" +
                "<a href=\"#\" onClick=\"javascript:getModuleInfo('"+ getLastUsedModuleId() +"','"+getLastUsedModuleVersion()+"'); return false;\">"+ getLastUsedModuleId() + "</a>&nbsp;&gt;&nbsp;"+
                                            "Module Policy</h4>";
    _updateDiv.innerHTML = _text;
}

/////////// Users and Roles ////////////////

function showlistServiceUsersHeader(_updateDiv) {
    var _text = "<h4><a href='#' onClick='javascript:showServiceInitializer(); return false;'>Services</a>&nbsp;&gt;&nbsp;" +
								   "<a href='#' onClick='javascript:listServiceData(\"" + getServiceSpecificName() +"\"); return false;'>"+ getServiceSpecificName() + "</a>&nbsp;&gt;&nbsp;" +
								   "<a href='#' onClick='javascript:showSecurityConfigurationInfo(); return false;'>Security Configuration</a>&nbsp;&gt;&nbsp;"+getScenarioId()+"</h4>";
    _updateDiv.innerHTML = _text;
}

/////////// Stubs /////////////

function showstubGenMetaInfo(_updateDiv) {
    var _text = "<h4><a href=\"#\" onClick=\"javascript:showServiceInitializer(); return false;\">Services</a>&nbsp;&gt;&nbsp;" +
                                   "<a href=\"#\" onClick=\"javascript:listServiceData('"+ getServiceSpecificName() +"'); return false;\">"+ getServiceSpecificName() + "</a>&nbsp;&gt;&nbsp;" + "Stub Generation" +"</h4>";
    _updateDiv.innerHTML = _text;
}

function showtryItDiv(_updateDiv) {
    var _text = "<h4><a href=\"#\" onClick=\"javascript:showServiceInitializer(); return false;\">Services</a>&nbsp;&gt;&nbsp;" +
                                           "<a href=\"#\" onClick=\"javascript:listServiceData('"+ getServiceSpecificName() +"'); return false;\">"+ getServiceSpecificName() + "</a>&nbsp;&gt;&nbsp;" +"Try Web Service" +"</h4>";
    _updateDiv.innerHTML = _text;
}

function showListTransportDiv(_updateDiv) {
    var _text = "<h4><a href='#' onClick='javascript:showServiceInitializer(); return false;'>Services</a>&nbsp;&gt;&nbsp;<a href='#' onClick='javascript:listServiceData(\"" + getServiceSpecificName() + "\"); return false;'>" + getServiceSpecificName() + "</a>" + "&nbsp;&gt;&nbsp;Transport Configuration" + "</h4>";
    _updateDiv.innerHTML = _text;

}

/////////// Timestamp /////////

function showTimeStampDiv(_updateDiv) {
    var _text = "<h4><a href='#' onClick='javascript:showServiceInitializer(); return false;'>Services</a>&nbsp;&gt;&nbsp;" +
                "<a href='#' onClick='javascript:listServiceData(\""+getServiceSpecificName()+"\"); return false;'>"+getServiceSpecificName()+"</a>" + "&nbsp;&gt;&nbsp;"+
                "<a href='#' onClick='javascript:showSecurityConfigurationInfo(); return false;'>Security Configuration</a>&nbsp;&gt;&nbsp;Timestamp</h4>";
    _updateDiv.innerHTML = _text;
}

///////// Rampart ////////////

function showConfigurationSecenarios(_updateDiv) {
    var _text = "<h4><a href='#' onClick='javascript:showServiceInitializer(); return false;'>Services</a>&nbsp;&gt;&nbsp;" +
                "<a href='#' onClick='javascript:listServiceData(\""+getServiceSpecificName()+"\"); return false;'>"+getServiceSpecificName()+"</a>" + "&nbsp;&gt;&nbsp;Security Configuration</h4>" +
                "<h2>Security Configuration&nbsp;</h2>";
    _updateDiv.innerHTML = _text;
}



///// Data Service //////

var newDataServiceMenuMessage = "This service is still not saved, hense this menu item is not available.";
function showDataServiceHeader(_updateDiv, stepIndex) {

    var step = "";
    if(stepIndex != null) {
        step = " - Step " + (parseInt(stepIndex) + 1) + ":";
    }
    
    var _text = "<h4><a href=\"#\" onClick=\"javascript:showServiceInitializer(); return false;\">Services</a>&nbsp;&gt;&nbsp;" +
                                           "<a href=\"#\" onClick=\"javascript:";
                                           if (!newDataService) {
                                           		_text += "listServiceData('"+ getServiceSpecificName() +"')";
                                           } else {
                                           		_text += "wso2.wsf.Util.alertInternal('" + newDataServiceMenuMessage + "', INFORMATION_MESSAGE)";
                                           }
                                           _text += "; return false;\">"+ getServiceSpecificName() + "</a>&nbsp;&gt;&nbsp;" + step + " Configure Data Service </h4>";

    _updateDiv.innerHTML = _text;
}

function showNewDataServiceHeader(_updateDiv, stepIndex) {
    var step = "";
    if(stepIndex != null) {
        step = " - Step " + (parseInt(stepIndex) + 1) + ":";
    }
    _updateDiv.innerHTML = "<h4><a href=\"#\" onClick=\"javascript:showServiceInitializer(); " +
                           "return false;\">Services</a>&nbsp;&gt;&nbsp;"+ step +" New Data Service";
}

function showDataServiceOperationsHeader(_updateDiv) {
    var _text = "<h4><a href=\"#\" onClick=\"javascript:showServiceInitializer(); return false;\">Services</a>&nbsp;&gt;&nbsp;" +
                                           "<a href=\"#\" onClick=\"javascript:";
                                           if (!newDataService) {
                                           		_text += "listServiceData('"+ getServiceSpecificName() +"')";
                                           } else {
                                           		_text += "wso2.wsf.Util.alertInternal('" + newDataServiceMenuMessage + "', INFORMATION_MESSAGE)";
                                           }
                                           _text += " return false;\">"+ getServiceSpecificName() + "</a>&nbsp;&gt;&nbsp;" +
                                           
                                           "<a href=\"#\" onClick=\"javascript:refreshDataServiceScreen(); return false;\">Configure Data Service</a>&nbsp;&gt;&nbsp;" +"Add Operation" +"</h4>";
    _updateDiv.innerHTML = _text;
}

function showDataServiceQueryHeader(_updateDiv) {
    var _text = "<h4><a href=\"#\" onClick=\"javascript:showServiceInitializer(); return false;\">Services</a>&nbsp;&gt;&nbsp;" +
                                           "<a href=\"#\" onClick=\"javascript:";
                                           if (!newDataService) {
                                           		_text += "listServiceData('"+ getServiceSpecificName() +"')";
                                           } else {
                                           		_text += "wso2.wsf.Util.alertInternal('" + newDataServiceMenuMessage + "', INFORMATION_MESSAGE)";
                                           }
                                           _text += "; return false;\">"+ getServiceSpecificName() + "</a>&nbsp;&gt;&nbsp;" +
                                           "<a href=\"#\" onClick=\"javascript:refreshDataServiceScreen(); return false;\">Configure Data Service</a>&nbsp;&gt;&nbsp;" +"Service Query" +"</h4>";
    _updateDiv.innerHTML = _text;
}

function showGeneratedConfigHeader(_updateDiv) {
    var _text = "<h4><a href=\"#\" onClick=\"javascript:showServiceInitializer(); return false;\">Services</a>&nbsp;&gt;&nbsp;" +
                                           "<a href=\"#\" onClick=\"javascript:";
                                           if (!newDataService) {
                                           		_text += "listServiceData('"+ getServiceSpecificName() +"')";
                                           } else {
                                           		_text += "wso2.wsf.Util.alertInternal('" + newDataServiceMenuMessage + "', INFORMATION_MESSAGE)";
                                           }
                                           _text +="; return false;\">"+ getServiceSpecificName() + "</a>&nbsp;&gt;&nbsp;" +
                                           "<a href=\"#\" onClick=\"javascript:refreshDataServiceScreen(); return false;\">Configure Data Service</a>&nbsp;&gt;&nbsp;" +"Review and Save" +"</h4>";
    _updateDiv.innerHTML = _text;
}

function showDataServiceOutputMappingHeader(_updateDiv) {
    var _text = "<h4><a href=\"#\" onClick=\"javascript:showServiceInitializer(); return false;\">Services</a>&nbsp;&gt;&nbsp;" +
                                           "<a href=\"#\" onClick=\"javascript:";
										   if (!newDataService) {
                                           		_text += "listServiceData('"+ getServiceSpecificName() +"')";
                                           } else {
                                           		_text += "wso2.wsf.Util.alertInternal('" + newDataServiceMenuMessage + "', INFORMATION_MESSAGE)";
                                           }
                                           _text += "; return false;\">"+ getServiceSpecificName() + "</a>&nbsp;&gt;&nbsp;" +
                                           "<a href=\"#\" onClick=\"javascript:refreshDataServiceScreen(); return false;\">Configure Data Service</a>&nbsp;&gt;&nbsp;" +"Add Output Mapping" +"</h4>";
    _updateDiv.innerHTML = _text;
}
