Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 177077

Summary: HyperLink UI for Ajax
Product: z_Archived Reporter: Scott Rosenbaum <scottr>
Component: BIRTAssignee: Wenfeng Li <wenfeng.fwd>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: ptessier
Version: 2.2.0Keywords: plan
Target Milestone: Future   
Hardware: PC   
OS: All   
Whiteboard:

Description Scott Rosenbaum CLA 2007-03-12 18:33:26 EDT
Currently the Hyperlink builder creates an link to a new report using the anchor tag.  In a true Ajax application, where the report is embedded as a single div within a larger page, it is likely the web developer will not want to refresh the entire page when a user follows a report link.  

Under this situation, the more likely way the web developer would want to follow the new link is to call JavaScript which would re-load the reporting div only, leaving the rest of the page intact.

At the current time, this can be done by generating script for the control, but this forces the report developer to have to create that script.  A better approach would be to have an alternate UI page for the Hyperlink where the report developer specifies the name of a JavaScript function in a text field.  

The Report developer can specify parameters for the custom JavaScript function by adding name value pairs.  The value pair should have an expression builder associated with it, so that the report developer can make the link dynamic and driven by data properties.
Comment 1 Roshan CLA 2007-03-12 18:53:21 EDT
My recommendation for implementing this is to use json syntax as defined at www.json.org.
This makes it pretty extensible and easy to navigate as you would navigate a dom.

So the UI would need to ask the user for a call back function.
Lets say the call back function was called 'loadMyReport'. Now when the output is generated by the Report engine it would generate something similar to the sample in this html syntax. Note the a href reference.

<html>
	<head>
		<script>
			function loadMyReport(reportIdentifier)
			{
				alert(reportIdentifier.name);
				alert(reportIdentifier.params[0].name);
			}
		</script>
	</head>
	<body>
		<a href="javascript:loadMyReport({'name': 'targetReport', 'params':[{'name': 'test', 'displayName': 'test params'}] })">load the report</a>
	</body
</html>


Doing it this way ensures that the birt engine doesn't need to hardcode the function name.
In addition since the syntax is json additional properties can be added without having users modify the function since the function only takes one single argument always irrespective of how may properties the object may contain.
Comment 2 Wang Qiangsheng CLA 2007-03-29 18:12:41 EDT
Does this duplicate with 176838?
Comment 3 Hongchang Lin CLA 2007-04-09 03:44:01 EDT
*** Bug 176838 has been marked as a duplicate of this bug. ***
Comment 4 Hongchang Lin CLA 2007-04-09 04:38:14 EDT
The anchor tag("<a href=...") represents hyperlink isn't specify by UI. It's specify by html emitter in report output.

I think the case actually requires a customize HTMLActionHandler, in which the hyperlink URL is generated based on the BaseURL. In customize action handler, user can generates the URL as: javascript:HyperlinkHandler( param1, ... ). Then html emitter will output as: <a href="javascript:HyperlinkHandler( param1, ... )">. I let the js function named "HyperlinkHandler" here. 

User has to define its own js function, including function name and its parameters. Whithin the function, user implements how to process without refreshing whole page. I think the JS function probably needs to take the BaseURL as parameter. As I understand, Ajax needs the BaseURL to tell him where to fetch content to replace current div. 
In the user's web-app, the customize action handler can be specified in user own render option and pass to report engine. 
   

Scott, please review if I understand the case correctly.
Comment 5 Hongchang Lin CLA 2007-04-09 04:51:36 EDT
One more point:
Since user develops own Ajax viewer framework, it directly calls report engine to generate Web-based report output. So I see the report engine caller in this case is user's own viewer, but not Report Designer. 

Report Designer calls model to represent hyperlink as action properties of report item, and then calls Report Viewer to present report. In this case, Report Viewer decides how to handle the hyperlink passed by report engine in its framework.
Comment 6 Wang Qiangsheng CLA 2007-04-13 01:36:25 EDT
Well I'm considering this requirements. I think this is part of the goal of new preview framework which is used by new preview prototype.
I'm going to study this case and try to know if the new preview framework can fit this.
But in general, I don't think we can have a simple GUI  to do this. For the really generated url depending on the runtime container (web server for this case), so we can't assume the url inputed on the GUI is the same as the generated one by the runtime container. 
I think the user need provide it's own logic to generate the url as they wish. Maybe they need write it's own action handler or maybe a simple wrapper plug-in.
Comment 7 Wenfeng Li CLA 2007-05-30 20:17:19 EDT
Add plan keyword to consider support of Ajax based report item.  The action would be a link to another report or could be an action that trigger some other presentation or transactions.

Also consider a browser side Ajax event API on a report items.
Comment 8 Scott Rosenbaum CLA 2010-08-18 15:33:13 EDT
no real interest.  Going to close.