Árvore de páginas

 Este documento é material de especificação dos requisitos de inovação, trata-se de conteúdo extremamente técnico.                                                             

  

Informações Gerais

Especificação

Produto

Datasul

Módulo

Framework

Segmento Executor

Tecnologia

Projeto

PGR_LD_FRW001-81

IRM

PCREQ-3617

Requisito

PCREQ-6064

Subtarefa

Não se aplica

Release de Entrega Planejada

DTS12.1.8

Réplica

Não se aplica

País

(X) Brasil  (  ) Argentina  (  ) Mexico  (  ) Chile  (  ) Paraguai  (  ) Equador

(  ) USA  (  ) Colombia   (  ) Outro _____________.

Outros

Não se aplica

Objetivo

O objetivo desta especificação é preparar o produto Datasul para realizar a chamada da Central de Ajuda em todos os pontos onde hoje é executado o Help On-line. 

 

Definição da Regra de Negócio

Rotina

Tipo de Operação

Opção de Menu

Regras de Negócio

men/men900za.p

[Alteração]

N/A

Realiza a chamada da Central de Ajuda

HelpController.as

[Alteração]

N/A

Realiza a chamada da Central de Ajuda

Portlet.as

[Alteração]

N/A

Realiza a chamada da Central de Ajuda

LicenseManager.as[Alteração]N/ARealiza a chamada da Central de Ajuda
EIPFlexConfigurationLoader.java[Alteração]N/ARealiza a chamada da Central de Ajuda
FlexLicenseServlet.java[Alteração]N/ARealiza a chamada da Central de Ajuda
HelpController.js[Alteração]N/ARealiza a chamada da Central de Ajuda

 

PROGRESS

  • MEN/MEN900ZA.P


importante

O fonte deve ser pré processado para a versão 12.1.8 .

 No programa men/men900za.p a variável c-nome-htm armazena a informação do nome do programa, então devemos alterar o nome da variável para c-prog-help e facilitar o entendimento quanto a informação que armazena. 

men/men900za.p
/* TESTA SE ESTA CHAMANDO DO MENU DE MODULO */
IF c-nome-htm <> "men903za" THEN DO:
		IF procedimento.cod_prog_dtsul_base <> "" THEN DO:
    			FIND prog_dtsul 
						WHERE prog_dtsul.cod_prog_dtsul = procedimento.cod_prog_dtsul_base 
						NO-LOCK NO-ERROR.
		END.
		IF AVAIL prog_dtsul THEN DO:
				ASSIGN c-prog-temp = REPLACE(prog_dtsul.nom_prog_ext,"/","~\")
                               c-prog-help  = ENTRY(1,ENTRY(NUM-ENTRIES(c-prog-temp,"~\"),c-prog-temp,"~\"),".").
		END.
END.
 


Quando a versão do produto for maior ou igual a 12.1.8, caso o parâmetro de ativação da central de ajuda help.center.disable seja diferente de true, a string enviada como parâmetro na chamada da procedure openUrl deverá ser modificada, prevendo a necessidade enviar as informações de linha de produto, segmento, versão, modulo, ação/ rotina e os rests de fluig e dos parâmetros da central de ajuda.  O argumento help.center.disable, passado como parâmetro para o men/men906zb, é uma propriedade que como padrão vem ativada  = falso e não será informado no datasul_framework.properties, para manter a central de ajuda como padrão. Caso seja necessário utilizar o help offline a propriedade help.center.disable deverá ser informada no arquivo datasul_framework.properties do produto Datasul igualando ela a true, dai produto passará a chamar o help antigo. 


Exemplo
            RUN men/men906zb.p(ENTRY(10,SESSION:PARAMETER),ENTRY(9,SESSION:PARAMETER),ENTRY(11,SESSION:PARAMETER),ENTRY(12,SESSION:PARAMETER),"","getProperty","","","help.center.disable","",vExecHTML).
			ASSIGN isHelpCenterActive = LOGICAL(RETURN-VALUE) NO-ERROR.
			IF isHelpCenterActive = 'true' THEN
				RUN openUrl ("i=" + c-lang + "~&m=" + lc(procedimento.cod_modul_dtsul) + "~&p=" + c-nome-htm).
			ELSE 
				RUN openUrl ( "lineProduct=datasul~&segment=" + c-segmento + "~&version=" + c-versão + "~&module=" + procedimento.cod_modul_dtsul 
							+ "~&action=" + c-prog-help + "~&language=" + v_cod_idiom_usuar 
							+ "~&URLHELPCENTERFLUIG=http://" + ENTRY(10,SESSION:PARAMETER) + ":" + ENTRY(9,SESSION:PARAMETER) + "/help/resources/FluigCommunityHelpCenter/getFluigCommunity"
							+ "~&URLHELPCENTERPARAMS=http://" + ENTRY(10,SESSION:PARAMETER) + ":" + ENTRY(9,SESSION:PARAMETER) + "/help/resources/ParamsHelpCenter/getParams").

 

Para recuperar a versão do produto, deverá ser executado o programa btb/version.r e remover o produto ('datasul_') mantendo apenas a versão release, 12.1.8 por exemplo.

Para recuperar o segmento do produto, deverá ser verificada a propriedade ls.segment no arquivo datasul_framework.properties do produto Datasul que encontra-se no servidor de aplicação JBoss, utilizando o programa men/men906zb.p

RUN men/men906zb.p(ENTRY(10,SESSION:PARAMETER),ENTRY(9,SESSION:PARAMETER),ENTRY(11,SESSION:PARAMETER),ENTRY(12,SESSION:PARAMETER),"","getLSProperty","","","ls.segment","",vExecHTML).

 

Na procedure openUrl, quando a versão do produto for maior ou igual a 12.1.8, deverá  executar o trecho que segue somente se a variável isHelpCenterDisable for igual a no:

    IF cUrl <> ? THEN DO:
        /* utiliza a url de documentacao definida no config.xml com os devidos tratamentos no EIPFlexConfigurationLoader */
        ASSIGN cUrl = cUrl + "/scripts/open.html".
    END.
    ELSE DO:
        /* assume a url padrao do legado pois nao foi possivel ler a url do EIPFlexConfigurationLoader */
        ASSIGN cUrl = "hlp/openhelp.html".
    END.

 

Senão, passar a executar este trecho no retorno da execução do men/men906zb.p.

    IF cUrl = ? THEN DO:
		/* mensagem indicando que o help não esta configurado */ 	
		return. 
    END.

FLEX

  • HelpController.as

No metodo callHelpURL realizar alterações para receber o segmento e versão do produto conforme exemplo que segue:

		/**
		 * Realiza a abertura do help conforme a aba corrente ou o módulo desejado na tela de Ajuda do Datasul.
		 */ 
		private function callHelpURL(isGP:Boolean, moduleHelp:Boolean = false):void {
			var user:UserValue = UserManager.getInstance().user;
			var i = user.defaultLocale.languageCode;
			var url:String = Application.application.url;			
			var isHelpCentralDisable:Boolean = (PropertyUtil.getInstance().getProperty("help.center.active","false") == "true");
			var lm:LicenseManager = new LicenseManager();
			var version:String = PropertyUtil.getInstance().getProperty("framework.version");
			version = version.substr(0,version.indexOf("-"));		
			url = url.substr(0, url.indexOf("/index-flex.swf"));
			var urlRest:String = url.substr(0, url.lastIndexOf("/"));
			this.programName = "";
			//Se for para abrir o help da aba aberta
			if (currentTab != null && !moduleHelp) { 
				//Verifica se a aba atual é Metadados.
				try {
					// É Metadados.
					var currentView:IMDView = WorkspaceMediator.getView(currentTab) as IMDView;
					
					if (!currentView.helpURL) {
						var splittedXMLName:Array = currentView.xmlName.split("/");
						// A posição do primeiro parâmetro é a posição 1 pois o formato do xmlName é
						// "view/[applicationName]/[formName]" ou "view/[applicationName]/freeform/[formName]" ou ainda
						// "view/[applicationName]/crudfreeform/[formName]", onde então a primeira posição será
						// obrigatoriamente do applicationName. Já o outro parâmetro é a penúltima posição do Array, pois o
						// último valor será obrigatoriamente o formName.
						currentView.helpURL =
							StringUtil.
							substitute("{0}/{1}", splittedXMLName[1], splittedXMLName[splittedXMLName.length - 1]);
					}
					this.programName = currentView.helpURL.split("/")[1];
				} catch (e:Error) {
					this.programName = currentTab.resourceName;
				}
				
				if (this.programName.indexOf("di") < 0) {
					if (this.programName.indexOf("homepage") > 0) {
						this.programName = "f_area_trabalho";
					}
					if (this.programName.split(".").length > 1) {
						this.programName = this.programName.split(".")[1];
					}					
				} else {
					this.programName = "f_menu";
				}
			}
			
			if (isHelpCentralDisable == true) { 
				url += "/help/openhelp.html?";
				if (isGP) { // Se o grupo de aplicativo do módulo for igual à Gestão de Planos
					url += "gp=true";
				} else { // Demais grupos de aplicativo
					url += "gp=false&i=" + i + "&m=" + this.moduleName;
					if (StringUtil.trim(this.programName) != "") {
						url += "&p=all/" + this.programName;
					}
				}
				navigateToURL(new URLRequest(url));
			}
			else {
				lm.getLsInfo("segment", function(result:ResultEvent) {
					var segmentCode:String = result.result.value["segmentCode"];
					url += "help?lineProduct=datasul&segment=" + segmentCode + "&version=" + version ;
					url += "&module=" + this.moduleName + "&action=" + this.programName + "&language=" + i;
					url += "&URLHELPCENTERFLUIG=" + urlRest + "/help/resources/FluigCommunityHelpCenter/getFluigCommunity";
					url += "&URLHELPCENTERPARAMS=" + urlRest + "/help/resources/ParamsHelpCenter/getParams";
					navigateToURL(new URLRequest(url));
				}, function(fault:FaultEvent) {
					//Tratar o erro com uma msg
				});								
			}
		}
  • Portlet.as

No metodo callHelpURL realizar alterações para receber o segmento e versão do produto conforme exemplo que segue:

		/**
		 * Realiza a abertura do Help do portlet para o help online. 
		 * @param isGP
		 * 
		 */
		private function callHelpURL(isGP:Boolean):void {
			
			var functionalityName:String = this.resource.resourceName;
			var isHelpCentralDisable:Boolean = (PropertyUtil.getInstance().getProperty("help.center.disable","false")=="true");
			
			if (functionalityName.lastIndexOf(".") > 0) {
				functionalityName = functionalityName.split(".")[functionalityName.split(".").length - 1];				
			}
			
			var user:UserValue = UserManager.getInstance().user;
			var i = user.defaultLocale.languageCode;
			var url:String = Application.application.url;
			var lm:LicenseManager = new LicenseManager();
			var version:String = PropertyUtil.getInstance().getProperty("framework.version");
			version = version.substr(0,version.indexOf("-"));
			url = url.substr(0, url.indexOf("/index-flex.swf"));
			var urlRest:String = url.substr(0, url.lastIndexOf("/"));
			if (isHelpCentralDisable == true) {
				url += "/help/openhelp.html?";
				if (isGP) {
					url += "gp=true";
				} else {
					url += "gp=false&i=" + i + "&m=" + this.moduleName;
					url += "&p=all/" + functionalityName;
				}
				navigateToURL(new URLRequest(url));	
			}
			else {
				lm.getLsInfo("segment", function(result:ResultEvent) {
					var segmentCode:String = result.result.value["segmentCode"];
					url += "help?lineProduct=datasul&segment=" + segmentCode + "&version=" + version ;
					url += "&module=" + this.moduleName + "&action=" + functionalityName + "&language=" + i;
					url += "&URLHELPCENTERFLUIG=" + urlRest + "/help/resources/FluigCommunityHelpCenter/getFluigCommunity";
					url += "&URLHELPCENTERPARAMS=" + urlRest + "/help/resources/ParamsHelpCenter/getParams";
					navigateToURL(new URLRequest(url));
				}, function(fault:FaultEvent) {
					//Tratar o erro com uma msg
				});
			}
		}

  • LicenseManager.as

Definir o metodo getLsInfo na classe LicenseManager.as para que seja possível recuperar o segmento do cliente, conforme exemplo que segue: 

	/**
	 * Envia solicitação para recuperar o segmento do produto 
	 * @param result Função para tratar o retorno positivo da solicitação
	 * @param fault Função para tratar o retorno negativo da solicitação
	 * @return
	 */
	public function getLsInfo(information:String, result:Function, fault:Function):String {
		var line:String = "OP=GETLSINFO";
		line += "#PARENTTHREADID=#PSID=#CUSRNAME=#SLOT=0";
		line += "#FEDERALID=#IPADDRESS=#SESSIONID=";
		line += "#LSINFOPARAM=";
		line += information;
		this.sendData(line, result, fault);
	}		

JAVA

  • EIPFlexConfigurationLoader.java

no método String getURL() há a definição da URL para a chamada do help. Atualmente ha o valor "http://www.totvs.com/mktfiles/tdiportais/helponlinedatasul/" que deverá ser utilizado apenas se a propriedade help.center.disable for igual a true  caso contrario, deverá ser utilizada a string: "http://" + this.config.getRemoteServer ()+ ":" + this.config.getWebServerPort() + "/help".

		private String getURL() {
		String isHelpCentralDisable = PropertyUtil.getInstance().getProperty("help.central.active","false").equals("true");
		/* Se esta configurado para utilizar help offline, armazenara a docURL*/
		String docURL = null;
		if(this.config.getUseHelpOffLine()) {
		    if(this.config.getDocURL() != null) docURL = this.config.getDocURL();
		} else {
			/* Se esta configurado para utilizar help online, utilizara a docURLOnLine como docURL, 
			 * pois todos os locais utilizam docURL*/
		    if(this.config.getDocURLOnLine() != null) { 
		    	docURL = this.config.getDocURLOnLine();
		    }
		}
		/* se o conteudo da docURL continua invalido, assume a URL fixa de help */
		if(docURL == null || docURL.trim().equals("")) {
			if (isHelpCentralDisable == true) 
				docURL = "http://www.totvs.com/mktfiles/tdiportais/helponlinedatasul/";
			else 
				docURL = "http://" + this.config.getRemoteServer() + ":" + this.config.getWebServerPort() + "/help";
		}
		return docURL;
	}

JAVASCRIPT 

  • HelpController.js

Alterar o script HelpController.js semelhante ao exemplo que segue: 

define(['index', 'directive-modal'], function (index) {
    'use strict';
    index.register.controller('HelpController', ['$rootScope', '$scope','$window','$modalInstance','$filter','totvs.app-main-view.Service','MenuApplications','MenuPrograms','ModalWindow','messageHolder', function($rootScope, $scope, $window, $modalInstance, $filter, appViewService, MenuApplications, MenuPrograms, ModalWindow, messageHolder) {
	var i18n = $filter('i18n');
        var HELP_URL = "http://www.totvs.com/mktfiles/tdiportais/helponlinedatasul/";
        var prefs = Properties.getProperty(Properties.ACCESS_PREFERENCES);
        var isHelpCentralDisable = (Properties.getProperty("help.center.disable","false") === true);
        
        if (isHelpCentralDisable === true){
	        if (prefs != undefined && prefs != null) {
	            HELP_URL = prefs.docURL;
	        }
        } else {
        	HELP_URL = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '') + "/help";
        }
        
        $scope.grpApplications = MenuApplications.getApplications();
            $scope.getCurrentView = function () {
            return appViewService.getPageActive();
        }
        $scope.checkInternetAccess = function(success, fail) {
            var checkUrl = HELP_URL + "scripts/images/logo.gif";
            var img = document.createElement("img");
            img.id = "tstImg";
            img.src = checkUrl;
            document.body.appendChild(img);
            document.getElementById("tstImg").onload = function() {
                $("#tstImg").remove();
                success();
            }
            document.getElementById("tstImg").onerror = function() {
                $("#tstImg").remove();
                fail();
            }
        }
		var alerts = {type: '',
                      title:'',
                      detail: ''};
		$scope.openHelpCurrent = function () {
            var view = $scope.getCurrentView();
            var programUrl = view.url;
            if (view.name === appViewService.HOME) {
                $scope.callHelpUrl(appViewService.HOME, 'fnd');
            } else {
                if (programUrl.indexOf("external") >= 0) {
                    var programId = "";
                    if (programUrl.indexOf("datasul") >= 0) {
                        programId = programUrl.split("datasul/")[1];
                        programId = programId.replace(/\//g, ".");
                        programId = programId.replace(/\+/g, "_");
                    } else {
                        programId = programUrl.split("external/")[1];
                    }
                    MenuPrograms.findFunctionalityById(programId, function(result) {
                        MenuPrograms.getProgramById(programId, function(result) {
                            var mod = result.program.mod.replace(".swf", "").toLowerCase();
                            $scope.callHelpUrl(programId, mod);
                        });
                    });
                }
            }
        }
        $scope.callHelpUrl = function(programId, moduleId) {
        	var userProps = Properties.getProperty(Properties.USER);
            var segmentDesc = Properties.getProperty(Properties.LICENSE,'segmentDesc');
            var version = Properties.getProperty("framework.version");
            MenuApplications.getApplicationByModule(moduleId, function(result) {
                var grpApp = result.grpApplication;
				var helpUrl = HELP_URL;
				if (grpApp.toLowerCase() == "sau" && isHelpCentralDisable === true) {
                    helpUrl += "portal_gp/";
                } else {
                	if (!isHelpCentralDisable)
    	                helpUrl += "?lineProduct=datasul&segment=" + segmentDesc + "&language=" + userProps.dialect + "&version=" + version;
                	else
                		helpUrl += "scripts/open.html?i=" + userProps.dialect;
                	
                    if (programId == appViewService.HOME) {
                    	if (!isHelpCentralDisable) 
                    		helpUrl += "&module=fnd";
                    	else
                    		helpUrl += "&m=fnd";
                    } else {
                        if (programId == 'homepage') {
                            programId = "f_area_trabalho";
                        } else {
                            programId = programId.substring(programId.lastIndexOf(".") + 1, programId.length);
                        }
                    	if (!isHelpCentralDisable){
                    		helpUrl += "&module=" + moduleId + "&action=" + programId;
                    		helpUrl += "&URLHELPCENTERFLUIG=" + window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '') + "/help/resources/FluigCommunityHelpCenter/getFluigCommunity";
                    		helpUrl += "&URLHELPCENTERPARAMS=" + window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '') + "/help/resources/ParamsHelpCenter/getParams";
                    	}
                    	else
                    		helpUrl += "&m=" + moduleId + "&p=all/" + programId;
                    }
                }
				
            	if (!isHelpCentralActive) { 
                    $window.open(helpUrl);
            	} else {
	                $scope.checkInternetAccess(function() {
	                    //Success - Internet Access
	                    $window.open(helpUrl);
	                }, function() {
	                    //Fail - Internet Access
	                    if (!window.location.origin) {
	                        window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
	                    }
	                    helpUrl = window.location.origin + "/datasul/help/offline/" + userProps.dialect + "/nocon.html";
	                    $window.open(helpUrl);
	                });
            	}
            });
        }
		$scope.openUrlHelp = function (grpApplication, module) {
            var userProps = Properties.getProperty(Properties.USER);
            var segmentDesc = Properties.getProperty(Properties.LICENSE,'segmentDesc');
            var version = Properties.getProperty("framework.version");
            var helpUrl = HELP_URL;
            if (!isHelpCentralActive) {
                helpUrl += "?lineProduct=datasul&segment=" + segmentDesc + "&language=" + userProps.dialect + "&version=" + version;
                helpUrl += "&module=" + module.moduleId.toLowerCase();
        		helpUrl += "&URLHELPCENTERFLUIG=" + window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '') + "/help/resources/FluigCommunityHelpCenter/getFluigCommunity";
        		helpUrl += "&URLHELPCENTERPARAMS=" + window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '') + "/help/resources/ParamsHelpCenter/getParams";
            } else {
	            if (grpApplication.codGroupAplicat.toLowerCase() == "sau") {
	                helpUrl += "portal_gp/";
	            } else {
	                helpUrl += "scripts/open.html?i=" + userProps.dialect;
	                helpUrl += "&m=" + module.moduleId.toLowerCase();
	            }
            }
            $window.open(helpUrl);
        }
        $scope.checkURL = function (url, callBack) {
            var request = new XMLHttpRequest;
            request.open('GET', url, false);
            request.onreadystatechange = function (){
                callBack(request.status==200);
            }
            request.send();
        }
        $scope.openAbout = function () {
            $scope.close();
           ModalWindow.openLargeWindow("html/menu/about.html", {
		   controller: 'SysInfoCtrl'
		   });
		}
        $scope.openSysInfo = function () {
            $scope.close();
            ModalWindow.openLargeWindow("html/menu/sysinfo.html",{
                controller: 'SysInfoCtrl',
				size: 'lg',
        	});
		}
        $scope.openProgramEMS2 = function () {
            $rootScope.openProgramProgress("btb/btb901zg.w", "btb901");
        }
        $scope.openProgramEMS5 = function () {
            $rootScope.openProgramProgress("prgtec/btb/btb901zg.p", "btb901zg");
        }
        $scope.openProgramEMS = function () {
            $rootScope.openProgramProgress("prohelp/_msgs.p", "_msgs");
        }
        $scope.openProgramTraceDebug = function () {
            $rootScope.openProgramProgress("men/men903zi.p", "men903zi");
        }
        $scope.openProgramExtractVersion = function () {
            $rootScope.openProgramProgress("men/men903zf.p", "men903zf");
        }
        $scope.openProgramProfiler = function () {
            $rootScope.openProgramProgress("utp/ut-prof.w", "ut-prof");
        }
		$scope.close = function () {
            $modalInstance.close();
        };
    }]);
});

 Este documento é material de especificação dos requisitos de inovação, trata-se de conteúdo extremamente técnico.