<div id="main-content" class="wiki-content group">
	<h3
		id="id-6.InvocaçãodeAplicaçõeseFormuláriosnoDatasulatravésdoFluig-6.1.Objetivo">
		<strong>6.1. Objective</strong>
	</h3>
	<p align="LEFT" class="western">
		<span>Allow the possibility of opening Flex , Metadata or
			Progress screens in Datasul through a link or button on the form, in
			HTML forms associated to processes in Fluig. These screens will be
			opened through a URL to be called in a Javascript function in the
			form.</span>
	</p>
	<h3
		id="id-6.InvocaçãodeAplicaçõeseFormuláriosnoDatasulatravésdoFluig-6.2.GuiadeProgramação">
		<strong>6.2. Programming Guide</strong>
	</h3>
	<p align="LEFT" class="western">
		<span>In an HTML form in Fluig, with a link or button to open a
			screen in Datasul, an HTTP call must be used to open a new browser
			window containing the form to be opened. </span>
	</p>
	<p align="LEFT" class="western">
		<span>For Flex or Metadata forms, the "External User
			Authentication" technique is used. For Progress programs, use the
			"ABL External Call". Below are a few examples of URLs that allow the
			opening of each of the types.</span>
	</p>
	<ul>
		<li><p align="LEFT">
				URL for direct access to a <strong>Flex Portlet</strong>:
			</p></li>
	</ul>
	<p align="LEFT" class="western" style="margin-left: 24.0px;">
		<span><a rel="nofollow">http://server:port/josso/signon/externalUserAuthentication.do?josso_cmd=external-login&amp;type=frwk&amp;module=fnd&amp;program=datasul-calculatorportlet-flex&amp;viewtype=portlet&amp;userid=super&amp;password=c3N6a0AxMjM</a>=</span>
	</p>
	<p align="LEFT" class="western" style="margin-left: 24.0px;">
		<span><br /></span>
	</p>
	<ul>
		<li><p align="LEFT">
				URL to access <strong>Metadata</strong> form:
			</p></li>
	</ul>
	<p align="LEFT" class="western" style="margin-left: 24.0px;">
		<a
			href="http://cassino:8180/josso/signon/externalUserAuthentication.do?josso_cmd=external-login&amp;type=md&amp;program=ems5.emsuni.CRUDUnidOrgan&amp;viewtype=view&amp;userid=super&amp;password=c3N6a0AxMjM"
			class="external-link" rel="nofollow"><span>http://</span><span>&#160;</span><span>server:port
				/josso/signon/externalUserAuthentication.do?josso_cmd=external-login&amp;type=md&amp;program=ems5.emsuni.CRUDUnidOrgan&amp;viewtype=view&amp;userid=super&amp;password=c3N6a0AxMjM</span></a><span>=</span>
	</p>
	<p align="LEFT" class="western">&#160;</p>
	<ul>
		<li><p align="LEFT">
				URL to access <strong>Progress</strong> programs:
			</p></li>
	</ul>
	<p align="LEFT" class="western" style="margin-left: 24.0px;">
		<a
			href="http://cassino:8180/abl-external-call/execute?program=cd0704.w&amp;module=cdp&amp;user=super&amp;password=c3N6a0AxMjM"
			class="external-link" rel="nofollow">http:// server:port
			/abl-external-call/execute?program=cd0704.w&amp;module=cdp&amp;user=super&amp;password=c3N6a0AxMjM</a>=
	</p>
	<p align="LEFT" class="western" style="margin-left: 24.0px;">&#160;</p>
	<p align="LEFT" class="western" style="margin-left: 24.0px;">
		<span><strong>Base URL for Flex and Metadata:</strong></span><span>
			<a rel="nofollow">http://server:port/josso/signon/externalUserAuthentication.do</a>?
		</span>
	</p>
	<p align="LEFT" class="western" style="margin-left: 24.0px;">
		<span><strong>Base URL for Progress:</strong></span><span>
			http:// <a href="http://serverport" class="external-link"
			rel="nofollow">server: port</a> /abl-external-call/execute?
		</span>
	</p>
	<p align="LEFT" class="western" style="margin-left: 24.0px;">&#160;</p>
	<p align="LEFT" class="western" style="margin-left: 24.0px;">
		<span><strong>Flex and Metadata parameters:</strong></span>
	</p>
	<ul>
		<ul>
			<li><p align="LEFT">
					<strong>josso_cmd:</strong> Command to be executed by JOSSO, in
					case of external login.
				</p></li>
		</ul>
	</ul>
	<ul>
		<ul>
			<li><p align="LEFT">
					<strong>userid:</strong> Username.
				</p></li>
		</ul>
	</ul>
	<ul>
		<ul>
			<li><p align="LEFT">
					<strong>password:</strong> User password. It must be sent using
					Base64 encode.
				</p></li>
		</ul>
	</ul>
	<ul>
		<ul>
			<li><p align="LEFT">
					<strong>type:</strong> Program type to be opened, <strong>frwk</strong>
					or <strong>md</strong>; md is for metadata type and frwk is for
					framework. It is necessary to inform so that josso knows if you are
					going to use the MODULE parameter or the PROGRAM parameter.
				</p></li>
		</ul>
	</ul>
	<ul>
		<ul>
			<li><p align="LEFT">
					<strong>program:</strong> Program to be accessed, put the full
					metadata program path, such as: ems5.emsuni.CRUDUnidOrgan.
				</p></li>
		</ul>
	</ul>
	<ul>
		<ul>
			<li><p align="LEFT">
					<strong>module: </strong> Module to be accessed, only for flex
					programs.
				</p></li>
		</ul>
	</ul>
	<ul>
		<ul>
			<li><p align="LEFT">
					<strong>viewtype:</strong> Type of window that will open, which may
					be:
				</p>
				<ul>
					<li><p align="LEFT">
							<span>view</span>
						</p></li>
					<li><p align="LEFT">
							<span>portlet</span>
						</p></li>
					<li><p align="LEFT">
							<span>window</span>
						</p></li>
				</ul></li>
		</ul>
	</ul>
	<p align="LEFT" class="western" style="margin-left: 38.4px;">&#160;</p>
	<p align="LEFT" class="western" style="margin-left: 38.4px;">
		<strong>Progress parameter:</strong>
	</p>
	<ul>
		<ul>
			<li><p align="LEFT">
					<strong>program:</strong> Name of Progress program.
				</p></li>
		</ul>
	</ul>
	<ul>
		<ul>
			<li><p align="LEFT">
					<strong>Module:</strong> name of the module.
				</p></li>
		</ul>
	</ul>
	<ul>
		<ul>
			<li><p align="LEFT">
					<strong>userid:</strong> Username.
				</p></li>
		</ul>
	</ul>
	<ul>
		<ul>
			<li><p align="LEFT">
					<strong>password:</strong> User password. It must be sent using
					Base64 encode.
				</p></li>
		</ul>
	</ul>
	<p align="LEFT" class="western" style="margin-left: 48.0px;">&#160;</p>
	<p align="LEFT" class="western" style="margin-left: 38.4px;">
		<span>In Fluig side, in order for a form to call to a screen on
			Datasul, we can use the following example:</span>
	</p>
	<p>&#160;</p>
	<ul>
		<li style="list-style-type: none;"><ul>
				<li><p align="LEFT" class="western">
						<span>Assuming that in a Fluig form there is a button to
							call the Progress program as follows:</span>
					</p></li>
			</ul></li>
	</ul>
	<pre class="western">            &lt;input value="Programa" onClick="callProgress()" type="button"></pre>
	<p align="LEFT" class="western" style="margin-left: 92.0px;">
		<span>When the button is clicked, the callProgress() function
			will be called, and it can have the following code:</span>
	</p>
	<pre class="western">
						<br />           function callProgress () {</pre>
	<pre class="western">               var url = “<a rel="nofollow">http://cassino:8180/abl-external-call/”</a> +</pre>
	<pre class="western">                         “execute?program=cd0704.w&amp;module=cdp&amp;” +</pre>
	<pre class="western">                         “user=super&amp;password=c3N6a0AxMjM=";</pre>
	<pre class="western">               window.open(url);</pre>
	<pre class="western">           } </pre>
	<p align="LEFT" class="western">&#160;</p>
	<ul>
		<li class="western" style="margin-left: 32.0px;"><span>A
				similar function to call a metadata form:</span></li>
	</ul>
	<p align="LEFT" class="western" style="margin-left: 37.4333px;">&#160;</p>
	<pre class="western">           function callMetadados () {</pre>
	<pre class="western">               var url = “<a
			href="http://tdn.totvs.comport" rel="nofollow">http://:port/josso/signon/</a>" +</pre>
	<pre class="western">                         "externalUserAuthentication.do?josso_cmd=external-login&amp;" + </pre>
	<pre class="western">                         "type=md&amp;program=ems5.emsuni.CRUDUnidOrgan&amp;viewtype=view&amp;" +</pre>
	<pre class="western">                         "userid=super&amp;password=c3N6a0AxMjM=";</pre>
	<pre class="western">               window.open(url, “Unidade Organizacional”, 800, "width=800,height=600");</pre>
	<pre class="western">           }</pre>
	<p align="LEFT" class="western" style="margin-left: 62.4px;">
		<span>In the case of Metadata form, optionally, it can be
			customized to return information to the Fluig form, using the command
		</span>CALL-BACK-WINDOW-OPENER()<span>. Refer to:&#160;<span> </span></span><a
			href="81789187.html"><strong>Calls to Datasul Zooms
				through Forms in Fluig:</strong><span>&#160;</span></a><strong><a
			href="81789187.html">ABLScript function for FreeForm Forms</a></strong><span><strong><a
				href="81789187.html">4</a>.</strong></span>
	</p>
	<p align="LEFT" class="western" style="margin-left: 62.4px;">&#160;</p>
	<p>
		<strong><br /></strong>
	</p>
</div>