Hi Experts,
i had taken script from obiee 12c dashboard--text object that script copied into obiee 11g dashboard--text object but it not working in obiee 12c its working fine can any one help me on this
below is the script which i used
Thanks In Advance
<script>
// store found Agents objects here
var agentsList = [];
/*
*
*/
function isAgentAlreadyEnabled(path){
var agentXml = obide.ServerRequests.retrieveIBotInfo(path, true);
var k = obips.XMLDOM.selectSingleNode(agentXml, "//saw:ibot", saw.delivers.namespaceMap);
var i = XUIGetElementText(obips.XMLDOM.selectSingleNode(agentXml, "IBotInfo/SchedulerRegistered")) == "1";
return saw.delivers.isIBotScheduleEnabled(k, i);
}
function addLog(msg, type = 0){
console.log('# addLog: '+msg);
switch(type){
case -1:
color = '#ff0000';
break;
case 1:
color = '#00ff00';
break;
default:
color = '#999999';
}
var output = '<span style="color: '+color+'; font-style: italic;">'+msg+'</span>';
$('#agentsEnablerLog').append(output+'<br/>');
}
function listAgents(){
$.post('/analytics/saw.dll?CatalogTreeModel', {action: "search", path: "/", mask: "*", recurse: "t", sig: "coibot1", _scid: obips_scid}, function(data){
addLog('loading list of agents...');
var resultJson = data.substr(data.indexOf('{', data.indexOf('{')+1));
var resultObj = jQuery.parseJSON(resultJson);
//console.log(resultObj);
addLog(resultObj.itemsinfos.length+' agents found (truncated='+resultObj.truncated+')');
// make sure the <div> is empty
$('#agentsEnablerList').html('');
if(resultObj.itemsinfos.length == 0){
$('#agentsEnablerList').append( 'no agent found' );
}
// save items on global variable
agentsList = resultObj.itemsinfos;
// loop over items
$.each(resultObj.itemsinfos, function(i, e){
//console.log(e.path);
// is agent already enabled ?
var agentEnabled = isAgentAlreadyEnabled(e.path);
$('#agentsEnablerList').append( '<input type="checkbox" name="agentsToEnable[]" value="'+i+'"'+(agentEnabled ? ' disabled="disabled"' : '')+'/> '+e.path+(agentEnabled ? ' <i style="color:#00ff00;">(enabled)</i>':'')+'<br/>' );
});
});
}
function enableEnablingButton(){
// if at least one checked => enable button
if($('#agentsEnablerList input:checked').length > 0){
$('#agentsEnablerCtrl #enableAgents').prop('disabled', false);
} else {
$('#agentsEnablerCtrl #enableAgents').prop('disabled', true);
}
}
$( document ).ready(function() {
// load required files (and more)
$.post('/analytics/saw.dll?loadFunctionInTemplate', {funcMessageName: "kuiDeliversFiles", _scid: obips_scid}, function(data){
// load a bunch of JS and CSS, they remove errors when loading the other files later
$('head').append(data.substr(data.indexOf('<')));
// find the path to be used to load OBI javascript files
jqueryPath = $("script[src*='jquery']").first().attr('src');
var loadPath = jqueryPath.substring(0, jqueryPath.split('/', 3).join('/').length);
// load the required scripts (because few things must be overridden)
$.when(
$.getScript(loadPath+'/delivers/obide.ServerRequests.js'),
$.getScript(loadPath+'/deliversShared/obids.AjaxRequest.js'),
$.getScript(loadPath+'/delivers/deliverscommon.js')
).done(function(){
/*
* ### override functions which can't work here because of context (not in catalog) ###
*/
// result handler function can't work without proper catalog UI
if (!saw.deliverscommon) {
if (!saw.delivers) {
saw.delivers = function() {}
}
}
saw.delivers.handleSaveResult = function(b){
console.log('[saw.delivers.handleSaveResult]');
output = $('<span>').text(new XMLSerializer().serializeToString(b)).html();
if(output.indexOf("Success") >= 0){
addLog(output, 1);
} else {
addLog(output, -1);
}
}
// nothing to see here, just removing an error as it can't be called
saw.catalogaction.IbotsActionHandler.prototype.updateDetails = function(a){
console.log('[saw.catalogaction.IbotsActionHandler.prototype.updateDetails]');
}
/*
* ### get list of agents ###
*/
// display list of agents
listAgents();
}).fail(function(a1, a2, a3){
console.log(a1);
console.log(a2);
console.log(a3);
console.log('something went wrong ...');
});
});
/*
* ### events handlers ###
*/
// enable button if at least one agent is selected
$('#agentsEnablerList').on('click', ':checkbox', function(){
// if at least one checked => enable button
enableEnablingButton();
});
// enable selected agents
$('#agentsEnablerCtrl #enableAgents').click(function(){
addLog('Enabling agents...');
// loop over list of selected items
addLog($('#agentsEnablerList input:checked').length+' agents selected');
addLog('The enabling is async, so the status can be delayed');
var r = confirm("You are about to enable the selected Agents, are you sure?");
if (r == true){
$('#agentsEnablerList input:checked').each(function(i){
var catalogObject = agentsList[$(this).val()];
addLog('- '+catalogObject.path);
var a = saw.catalogaction;
var ibotHandler = new a.IbotsActionHandler();
ibotHandler.tItemInfo = catalogObject;
ibotHandler.enableIBotSchedule(ibotHandler.tItemInfo.path);
});
// reload list of agents
$('#agentsEnablerList').html('loading ...');
window.setTimeout(listAgents, 2000);
} else {
addLog('aborted!', -1);
}
});
// check all link
$('#agentsEnablerCtrl #checkAll').click(function(){
$(':checkbox:enabled').prop('checked', true);
enableEnablingButton();
});
// uncheck all link
$('#agentsEnablerCtrl #uncheckAll').click(function(){
$(':checkbox:enabled').prop('checked', false);
enableEnablingButton();
});
});
</script>