Grails show url content in template (like frame src) - spring

I hava a Grails app and I want to make use of the Spring Security User Admin Screen. The screen can be accessed via the url
localhost:8080/user
Since I am not working with urls, but with templates (url always remains localhost:8080), but users can navigate via navbar und templates are loaded, I want to render the url localhost:8080/user into a template. I tried to render a template that contains
<frame src="localhost:8080/user">
but Grails didn't really like this.
What's the best way to do this?

You can try using an iframe instead of a frame.
I would also use the Grails createLink tag (see http://www.grails.org/doc/2.3.x/ref/Tags/createLink.html) to generate the src attribute value. This would ensure the src has the correct context root, port number, etc...
<iframe src="${createLink(controller: 'user', absolute: true)}" />

Related

Reference ParseFiles stored in Parse via URL

I'm working on an iOS and Android that app sends an email that contains 2 images. It doesn't attach the images to the email, rather it links to them via URL using the src property of the img tag in the email's HTML content. I would like to know if I can use Parse to store those images and reference the URLs for the ParseFiles in the email.
My questions are:
Do you just add the image to the database in a new class, or is there a separate location for public assets? (If not I can get the URL by clicking on the file which opens in a new tab in the browser.)
Is that URL guaranteed to never change so long as the image never changes? (If not I'd need to use a query to fetch the images from parse then get its url.)
Does visiting that URL for example in a web browser count as a request Parse keeps track for pricing purposes?
Piece of the email that will render the image:
<img width="186px" border="0" style="display: block; width: 186px;" src=\"http://url_to_photo_needs_to_go_here.png" alt=\"logo\">
You sure can. Every PFFile object includes a url property that you can use to directly access the file.
Simply grab this url property and insert it into the html for your email.
For reference: PFFile Class Reference for iOS (available for other SDK flavors too)

How do I use a publicly hosted image as the background for a visualforce page?

I'm trying to use this image as the background for a visualforce page without repeats. This is the code I have so far, but it's not working. Do I have to save the image in Salesforce first. If so, could you walk me through that? Thanks.
<body style="background-image: url('{http://www.jpl.nasa.gov/spaceimages/images/mediumsize/PIA17011_ip.jpg}')no-repeat top fixed;">
Visualforce will provide the body tag for you. Instead you should use a style element or <apex:stylesheet/> to define the body style.
See Using Custom Styles
The image you want to use for body tag is pointing to outside salesforce, hence it might be blocked.
Solution could be:
Either download the image in static resource and use tag as mentioned by Daniel, which is always a good practice.
Add the URL in the remote site setting from setup.

unable to display external host image

I'm unable to display image of external host on JSF page. In my case it is Apache file server. I'm creating image URL in #RequestScoped bean and then trying to pass it as String in #ViewScoped bean to frontend.
I've tried to display image in two ways:
First by loading it with JSF:
<h:graphicImage name="#{myViewScopedBean.myObject.mainImageUrl}" />
And then with html <img> tag as referenced in this answer.
Afterwards I've tried to print all attributes of myObject.
All String attributes are displayed well, except mainImageUrl. and I'm 100% sure that I'm setting mainImageUrl on backend.
What can provoke this problem? Is there any security JSF configuration?
The name attribute of <h:graphicImage> should represent a JSF resource name, not an URL. JSF resources are explained in among others How to reference CSS / JS / image resource in Facelets template? If you intend to specify a real URL, then you should be using value attribtue instead, or just plain HTML <img>.
So, either
<h:graphicImage value="#{myViewScopedBean.myObject.mainImageUrl}" />
Or
<img src="#{myViewScopedBean.myObject.mainImageUrl}" />
If that still doesn't work, then apparently the URL is plain wrong. Verify the generated HTML output and the browser's builtin HTTP traffic monitor (press F12). You should be able to open the image independently by copypasting exactly that URL straight into browser's address bar.

Joomla module or component to be render on a blank page

I have developed a Joomla module that does provides a form, processes its post data, does some calculations and displays the results.
The module includes a button to print the results. I'm currently using JavaScript to open a new window, paste the relevant HTML and open the print dialog.
Instead of JavaScript I would prefer to provide a separate URL for the print view and simply open that in a _blank target. This would make the application work better for people using screen readers or not having JavaScript available.
Is there any way that I can tell Joomla to not render the template along with my module? I was thinking that creating a component fixes that issue, but had to find that components are rendered into the template, too...
BTW: I have Joomla 1.5.22
To achieve what you want you have to add additional tmpl=component query string parameter to the request URL. This will disable template and module rendering.
Your URL will look something like this: index.php?option=com_xxx&view=xxx&tmpl=component
Since you are using Joomla 1.5 you can request index2.php?option=com_xxx&view=xxx and it will only render the component. Joomla 2.5 does not have index2.php so if you plan to migrate in future, don't use this option.
If you are using SEF then adding ?tmpl=component at the end on URL does the trick.
To go a step deeper... in your template directory you have component.php file, that is the file that's being loaded by tmpl param. You can copy component.php to my_component.php, do necessary changes and load your custom component template with index.php?option=com_xxx&view=xxx&tmpl=my_component
The joomla way of doing it would be to set your output to "raw", see this tut:
http://www.katcode.com/displaying-raw-output-in-joomla-by-setting-format-in-the-component/

Joomla Ajax Menu- refreshless content

I am trying to convert a flash site into a non-flash site. The site is already powered by Joomla CMS but it outputs XML into flash. You can see the site here www.alexandraandthesunflowers.com.
As you can see (and hear) there is a music player that persists across all pages in the site (i.e. the page does not refresh when you go to different sections)
To achieve this without flash I think what I need to do is frame the home page with the main Joomla menu and a media playing component. Then what I need is for the main menu to load Joomla content into the content area using ajax and use some equivalent of SwfAddress to enable the back and forwards buttons to work and for the pages to be directly linkable.
Things like edcwid seem to work like this (ie www.carpaholixx.com/estore) but I cannot find any information anywhere on how to go about getting Joomla to work this way...
Has anyone got any ideas?
D
I agree that the frame solution could be interesting.
I suggest making a frameset like this:
<frameset>
<frame id="mediaplayer" src="mediaplayer.htm" />
<frame id="main" src="{Joomla main page}" />
</frameset>
And then use css to hide the #mediaplayer, and custom javascript inserted on the joomlapage to send commands to the #mediaplayer frame where you run any kind of mediaplayer with a JS interface.
So keep the transport controls on your Joomla page and keep the mediaplayer over several changes of the #main frame.
Hope this makes sense :)
You could also consider using a javascript API to take care of the AJAX fetching of a page, to insert it in a content container on the page. This however require that you disable the header/footer of any Joomla page you request via this method. I however don't know if this is possible using Joomla.

Resources