Bug 204597 - In Web Viewer, changing theme by scripting does not work after first run
Summary: In Web Viewer, changing theme by scripting does not work after first run
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: 2.2.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: Future   Edit
Assignee: Wenfeng Li CLA
QA Contact: Maggie Shen CLA
URL:
Whiteboard:
Keywords: plan
Depends on:
Blocks:
 
Reported: 2007-09-25 14:59 EDT by Thibaud Raison CLA
Modified: 2009-05-26 20:35 EDT (History)
6 users (show)

See Also:


Attachments
The report (4.67 KB, application/octet-stream)
2007-09-25 14:59 EDT, Thibaud Raison CLA
no flags Details
The library (1023 bytes, application/octet-stream)
2007-09-25 15:00 EDT, Thibaud Raison CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thibaud Raison CLA 2007-09-25 14:59:15 EDT
Created attachment 79158 [details]
The report

Build ID: I20070625-1500

Steps To Reproduce:
1. Take the report and the library in attachement
The library contains two themes with the same style (red and aqua).
The report contains a parameter used to change the theme of the report at runtime (initialize script method on the report)

2. Running the report in preview mode in eclipse, change the parameter value, the script "initialize" works succesfully

3. Do the same thing in the Web Viewer, does not work. It works the first time because the default theme of the report is aqua, and the default value of the parameter is red which is successfully applied

More information:
-> After a little debug mode, it seems that the name is not resolved.
Comment 1 Thibaud Raison CLA 2007-09-25 15:00:06 EDT
Created attachment 79159 [details]
The library
Comment 2 Thibaud Raison CLA 2007-09-25 15:04:13 EDT
I try also, using the setThemeName method.
This method throw an exception.
Comment 3 Thibaud Raison CLA 2007-10-01 10:17:14 EDT
It doesn't work even in 2.2.1 ...

I really need someone to check why it does not works (it works in 2.1.1) and how I can correct this in 2.2.0.
Comment 4 Thibaud Raison CLA 2007-10-03 15:53:10 EDT
Move it to report engine to wake up someone.
Comment 5 Thibaud Raison CLA 2007-10-05 17:09:20 EDT
So thakns to Jason in the newsgroup I have a workaround.
In the plugin org.eclipse.birt.report.viewer :
 - Modify in BirtParameterDialog.js line 839 :
   else if ( true ) //this.__ifSubmit( this.__mode, action ) )
 - in the web.xml param_name BIRT_OVERWRITE_DOCUMENT to true.

I hope that someone can read it before the 3.0 to correct this bug.

It's not a normal situation to modify source code of a software just after the download to make it works like the previous version ...
Comment 6 Vincent Petry CLA 2007-10-06 02:43:16 EDT
In 2.2.1 this workaround doesn't seem to work, neither in preview mode nor in the web viewer. I can see from the timestamp that the document file is regenerated.
It must be another bug from the engine part.
Comment 7 Thibaud Raison CLA 2007-10-06 04:27:24 EDT
Works for me in 2.2.1 in preview and in web viewer.
Correction for 2.2.1 in BirtParameterDialog is at line 922.

The fact that the timestamp of the rptdocument, doesn't mean anything.
I suggest you to read the thread and Jason's explanations.
The rptdocument has to be full overwritted to make it works ...
Which is not a very good solution ...

This is only a workaround, I want someone to tell me why it was working in 2.1 and not now. Perhaps it's from the engine but I don't think so, because the preview works each time and the web viewer works at the first launch also.

So it's really during the regeneration of the rptdocument.
The preview works because it always rewrittes the rptdocument.
Comment 8 Jerry Cheng CLA 2007-10-08 01:16:15 EDT
The preview mode and web viewer are different. The preview doesn't generate document file and web viewer will generate document file first and then render it. The workaround is to force overwrite document file each time and it isnot a good solution.

Reassign to engine team to do further research.
Comment 9 Gang Liu CLA 2007-10-11 04:49:59 EDT
Model does not store all information of theme in document. so currently model can support this case.
Reassign to Model team to do further research.
Comment 10 Ivy Li CLA 2007-10-12 04:50:29 EDT
It is not very possible to save theme in document because only library can contain theme, report design schema does not contain any theme. We need further investment to see if we do need to support this user case. 
Comment 11 Rick Lu CLA 2008-05-07 01:24:50 EDT
It is a known issue since in web viewer mode, a serialized design is used, which has no theme information.
Comment 12 Wenfeng Li CLA 2008-05-22 21:31:55 EDT
Is the enh request to Render the same report document under different theme? Or Is the enh to RUN the same report design under different theme?


If the feature is to RENDER the same report document under different theme, 
can we use the new feature of referencing an external CSS file? Can the report design have a script to reference different CSS file based on report parameter values?
Comment 13 Wenfeng Li CLA 2008-05-28 04:55:37 EDT
Can we consider adding external CSS file handler to allow changing the CSS file per web app context (such as per user)?
Comment 14 Wenfeng Li CLA 2008-06-09 20:40:51 EDT
Is this bug simply because user need to put an __overwrite=true in the URL request?

Because the report document was cached hance changing the theme in script would not trigger the refresh of the doc?

This is the reason it works in preview but not in the viewer after the first time?
Comment 15 Wenfeng Li CLA 2008-06-09 20:43:49 EDT
(In reply to comment #14)
> Is this bug simply because user need to put an __overwrite=true in the URL
> request?
> Because the report document was cached hance changing the theme in script would
> not trigger the refresh of the doc?
> This is the reason it works in preview but not in the viewer after the first
> time?

Schedule to 2.5.0 to consider adding CSS reference handler.  The handler can take a CSS reference as input and return a URI to the CSS file to be put into the HTML output.