Path

ez projects / paradoxpdf / forum / issues / problems when using googlep...


Problems when using GooglePath -> Javascript problem?

You need to be logged in to post messages in the forums. New users may register here.

Marco Zinn

Member since:
11 March 2003

Posts: 27

Saturday 02 May 2009 5:49:23 pm

Hi,
the extension is great and it works quite fine!

I noticed it does not work, when i use an attribute of the "GooglePath" type: http://ez.no/developer/contribs/template_plugins/googlepath_for_ez_4_0_x
I think, i stumbles upon the JS stuff, that's used to display the map.

Is this a generic issue (Javascript and Paradox), is there an easy workaround?
Something like a CSS-line that will hide all SCRIPT elements?
Up

Karnichi Mohamed

Member since:
09 October 2006

Posts: 78

Saturday 02 May 2009 9:57:40 pm

Hi Marco

Thank you for your feedback;

The XhtmlRendrer don't support JavaScript at all. So you have to manage yourself removing javascript elements and calls in your templates. You can use for this ezpublish template override mechanisms.
For example you can override content/view/pdf.tpl for the class that uses googletype datatype. Then in the overrided template dont output the content of the googlepath attribute.

However If you want to print google maps in your pdfs you can use the google maps static api http://code.google.com/apis/maps/documentation/staticmaps/ witch enables using google maps without javascripts.


Hope this helps.

http://www.amiralweb.com Certified eZPublish Expert

Up

Marco Zinn

Member since:
11 March 2003

Posts: 27

Sunday 03 May 2009 5:35:28 pm

Hello,

thanks for your reply. i tried your approach with the static google maps, but it does not work either :-(
- I am able to create a static Map using Google maps. It's displayed in the full view as expected
- I'm also able to embed an img in the template, which is loaded from some other domain (img src="http://www.ez.no/...."). This works great in HTML and pdf view
- But as soon as i try to create a PDF version of something containing a static Google map, paradoxpdf shows Error: ParadoxPDF::generatePDF .

I assume, that either there are problems with an img src using parameters (you have to pass everything to GoogleMaps in the img URL). the log says "The reference to the entity "zoom" must end with the ";" delimiter"... "zoom" is the second parameter in the google maps image URL, so it's the first after a & character:
Static Google Maps URL starts like this
http://maps.google.com/staticmap?...p;sensor=false&key=MY_GOOGLE_KEY

Or there is kind of a timeout: Generating the static image needs some time.

Besides that: I tried to pass the "viewmode" variable from the full-view template to the attribute-view-template, but i found out, that the variable is not set, when using PDF view. Can you confirm this? From http://ez.no/doc/ez_publish/techn...lates/template_basics/node_templates , i expected, that this would be set in all node-view-templates, also in the PDF view.


Up

Karnichi Mohamed

Member since:
09 October 2006

Posts: 78

Monday 04 May 2009 12:19:59 am

Hi Marco,

I am not sure that I understood the problems with static googlemaps images, or for viewmode. Can send me the temporary generated xhtml file, so i can check the error ?

I gess that you have to use "&" instead of "&" to indicate an ampersand in the url of the google maps image, the rendrer will then be able to load properly the image.

Normally there is no special treatment to make pdf templates . You create templates just like you're used to any html views.

Thanks

http://www.amiralweb.com Certified eZPublish Expert

Up

Marco Zinn

Member since:
11 March 2003

Posts: 27

Wednesday 06 May 2009 8:12:47 am

Hello Karnichi,

You wrote "I gess that you have to use "&" instead of "&" to indicate an ampersand in the url of the google maps image, the rendrer will then be able to load properly the image."

Just to let you know: this works :) I did this manually now, but i think, there is an ez operator for doing this kind of URL encoding.

"Normally there is no special treatment to make pdf templates . You create templates just like you're used to any html views."

Well, this is, what i thought, too. But, at least for &'s in Image URL, one must slighty modify the template code. But after using "&" instead of "&" , it still works fine in the the browser :)

About the nodeview issue:
I had created a new class. In the template node/view/full.tpl for that class, i have this code in order to display some metadata for debugging:



{$node}/


{$viewmode}/


{$language_code}/


{$view_parameters}/


{$collection_attributes}/


{$validation}/


{$persistent_variable ( false )}/


{$node_path}/




In the HTML view (http://HOSTNAME/content/view/full/161) , i have this output:



Object(eZContentObjectTreeNode)/ full/ / Array/ / Array/ / Array/ 



In the pdf view (http://HOSTNAME/content/view/pdf/161) , i have this output in the PDF text:



Object(eZContentObjectTreeNode)/ / / / / / / /




So, it seems to me, that several metadata variables are not available in that view or in the pdf pagelayout

I wanted to do this, because i wanted to hide the Javascript code by reading the {$viewmode} value (if {$viewmode} = pdf, then hide JS code), but that didn't work.

André comment in http://ez.no/doc/ez_publish/techn...lates/template_basics/node_templates let's me think, that these variables should be available in all "node" templates.
Up

Karnichi Mohamed

Member since:
09 October 2006

Posts: 78

Friday 08 May 2009 11:26:53 pm

Hi Marco,

If you need "metadata" informations you have to override the content/view/pdf.tpl
Why you haven't those "metadata variables" on the default templates? because the default content/view/pdf.tpl (comming with paradoxpdf) loads node/view/full.tpl through node_view_gui, this is just a facility to make it working out of the box. But the node_view_gui has it's own namespace (variable scope). So just make your own override, you will then have all variables

On the pagelayout the only way to get this informations using the $module_result variable

Enjoy

http://www.amiralweb.com Certified eZPublish Expert

Up

Karnichi Mohamed

Member since:
09 October 2006

Posts: 78

Monday 01 June 2009 8:39:49 pm

As another person asked for this : i have updated the node/view/pdf.tpl so you can get variables set by content view. It is on the trunk I will make a new release that includes this modification.




{node_view_gui view=full content_node=$node


                        viewmode=$viewmode


                        language_code=$language_code


                        view_parameters=$view_parameters


                        collection_attributes=$collection_attributes


                        validation=$validation}




On the next relase many enhancements will be added to make pdf generation and manipulation easier from php code

http://www.amiralweb.com Certified eZPublish Expert

Up

You need to be logged in to post messages in the forums. New users may register here.