123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- function ModifyReportAction() {
- this.m_reuseConversation = true;
- }
- ModifyReportAction.prototype = new CognosViewerAction();
- ModifyReportAction.prototype.addActionContextAdditionalParms = function() {};
- ModifyReportAction.prototype.runReport = function() { return true; };
- ModifyReportAction.prototype.updateRunReport = function() {};
- ModifyReportAction.prototype.reuseQuery = function() { return false; };
- ModifyReportAction.prototype.reuseGetParameter = function() {return true; };
- ModifyReportAction.prototype.reuseConversation = function(reuseConversation) {
- if (typeof reuseConversation != "undefined") {
- this.m_reuseConversation = reuseConversation;
- }
- return this.m_reuseConversation;
- };
- ModifyReportAction.prototype.updateInfoBar = function() { return true; };
- ModifyReportAction.prototype.getUndoHint = function() { return ""; };
- ModifyReportAction.prototype.isUndoable = function() { return true; };
- ModifyReportAction.prototype.saveSpecForUndo = function() { return false; };
- ModifyReportAction.prototype.keepFocusOnWidget = function() { return true; };
- ModifyReportAction.prototype.keepRAPCache = function() { return true; };
- ModifyReportAction.prototype.getActionKey = function() { return null; };
- ModifyReportAction.prototype.canBeQueued = function() { return false; };
- ModifyReportAction.prototype.getPromptOption = function() { return "false"; };
- ModifyReportAction.prototype.createActionDispatcherEntry = function()
- {
- var actionDispatcherEntry = new ModifyReportDispatcherEntry(this.m_oCV);
- actionDispatcherEntry.initializeAction(this);
- return actionDispatcherEntry;
- };
- ModifyReportAction.prototype.isSelectSingleMember = function(selectedObject)
- {
- var oRAPReportInfo = this.m_oCV.getRAPReportInfo();
- var dataItems = selectedObject.getDataItems();
- if (oRAPReportInfo && dataItems.length > 0) {
- var containerId = this.getContainerId(this.m_oCV.getSelectionController());
- var itemInfo = oRAPReportInfo.getItemInfo(containerId, dataItems[0][0]);
- if (itemInfo.single =="true") {
- return true;
- }
- }
- return false;
- };
- ModifyReportAction.prototype.execute = function() {
- var oCV = this.getCognosViewer();
- oCV.setKeepFocus(this.keepFocusOnWidget());
- this.updateRunReport();
- if (this.runReport() == true) {
- var actionDispatcherEntry = this.createActionDispatcherEntry();
- this.addAdditionalOptions(actionDispatcherEntry);
- oCV.dispatchRequest(actionDispatcherEntry);
- }
- else {
- var cognosViewerRequest = this.createCognosViewerDispatcherEntry( "modifyReport" );
- cognosViewerRequest.setCallbacks({"complete":{"object":this, "method":this.updateReportSpecCallback}});
- oCV.dispatchRequest(cognosViewerRequest);
- }
- this.fireModifiedReportEvent();
- };
- ModifyReportAction.prototype.updateReportSpecCallback = function(oAsynchDataResposne) {
- var state = oAsynchDataResposne.getResponseState();
- var requestHanlder = new RequestHandler(this.m_oCV);
- requestHanlder.updateViewerState(state);
-
-
- if (!this.m_bUndoAdded)
- {
- this.m_bUndoAdded = true;
- var oUndoRedoQueue = this.getUndoRedoQueue();
- if(oUndoRedoQueue) {
- oUndoRedoQueue.initUndoObj({"tooltip" : this.getUndoHint(), "saveSpec" : true});
- oUndoRedoQueue.add({"reportUpdated": true});
- }
- var oWidget = this.getCognosViewer().getViewerWidget();
- if(oWidget) {
- oWidget.updateToolbar();
- }
- }
- };
- ModifyReportAction.prototype.addActionContext = function() {
- var actionContext = "<reportActions";
- if(this.runReport() == false)
- {
- actionContext += " run=\"false\"";
- }
- actionContext += ">";
- actionContext += this.getReportActionContext();
- actionContext += "</reportActions>";
- return actionContext;
- };
- ModifyReportAction.prototype.getReportActionContext = function()
- {
- var cognosViewer = this.getCognosViewer();
- var selectionController = cognosViewer.getSelectionController();
-
- var actionContext = "<" + this.m_sAction + ">";
- var containerId = this.getContainerId(selectionController);
- if(containerId != "")
- {
- actionContext += "<id>" + xml_encode(containerId) + "</id>";
- }
-
- actionContext += this.getRTStateInfo();
- actionContext += this.getSelectionContext();
- var sAdditionalParms = this.addActionContextAdditionalParms();
- if( sAdditionalParms != null && sAdditionalParms != "undefined")
- {
- actionContext += sAdditionalParms;
- }
- actionContext += "</" + this.m_sAction + ">";
- if(this.updateInfoBar())
- {
- actionContext += this.getGetInfoActionContext();
- }
-
- return actionContext;
- };
- ModifyReportAction.prototype.getGetInfoActionContext = function()
- {
- return "<GetInfo/>";
- };
- ModifyReportAction.prototype.getRTStateInfo = function()
- {
- var oWidget = this.getCognosViewer().getViewerWidget();
- if(oWidget && oWidget.getBUXRTStateInfoMap){
- var oInfoMap = oWidget.getBUXRTStateInfoMap();
- return oInfoMap ? oInfoMap : "";
- }
- return "";
- };
- ModifyReportAction.prototype.createEmptyMenuItem = function()
- {
-
- return { name: "None", label: "(empty)", iconClass: "", action: null, items: null };
- };
- ModifyReportAction.prototype.getStateFromResponse = function(oResponse)
- {
- var oResponseState = null;
- if( oResponse && typeof oResponse != "undefined" && oResponse.responseText && typeof oResponse.responseText != "undefined" && oResponse.responseText.length > 0 )
- {
- var responseXML = XMLBuilderLoadXMLFromString(oResponse.responseText);
- var stateData = responseXML.getElementsByTagName("state");
- if (stateData != null && stateData.length > 0)
- {
- try {
- if (typeof stateData[0].text != "undefined")
- {
- oResponseState = eval("(" + stateData[0].text + ")");
- }
- else
- {
- oResponseState = eval("(" + stateData[0].textContent + ")");
- }
- }
- catch(e) {
- if (typeof console != "undefined" && console && console.log) {
- console.log(e);
- }
- }
- }
- }
- return oResponseState;
- };
- ModifyReportAction.prototype.getSelectedCellTags = function()
- {
- var params = "";
- var selectionObjects = this.getCognosViewer().getSelectionController().getSelections();
- for (var i = 0; i < selectionObjects.length; ++i)
- {
- var cellRef = selectionObjects[i].getCellRef();
- var sDataItem = selectionObjects[i].getDataItems()[0];
- if (typeof sDataItem == "undefined" || sDataItem == null)
- {
- sDataItem = "";
- }
- var tag = this.getRAPLayoutTag(cellRef);
- if (tag != null)
- {
- params += "<tag><tagValue>" + xml_encode(tag) + "</tagValue><dataItem>" + xml_encode(sDataItem) + "</dataItem></tag>";
- }
- else
- {
- params += "<tag><tagValue/><dataItem>" + xml_encode(sDataItem) + "</dataItem></tag>";
- }
- }
- if (params != "") {
- params = "<selectedCellTags>" + params + "</selectedCellTags>";
- }
- return params;
- };
- ModifyReportAction.prototype.getIsNumericFromReportInfo = function(refDataItem)
- {
- var containerInfo = this.getSelectedReportInfo();
- if (containerInfo != null && typeof containerInfo.itemInfo!="undefined")
- {
-
- for (var item = 0; item < containerInfo.itemInfo.length; ++item)
- {
- if (refDataItem == containerInfo.itemInfo[item].item &&
- typeof containerInfo.itemInfo[item].numeric != "undefined") {
- return (containerInfo.itemInfo[item].numeric == "true");
- }
- }
- }
- return false;
- };
|