>> At least on our proxied modperl installation, VHOST_SERVER_NAME is set
>> to *, so using that doesn't work. I can't use javascript to get it,
>> since I can't get around the cross domain issues of going the other
>> direction of passing bric app domain => preview domain (we would need
>> to put a static file on the preview server to be used as a proxy for
>> the data).
>
> Bric::Util::ApacheReq->instance->hostname
Yeah, that's what I'm using, but it gets a little ugly:
if (not PREVIEW_LOCAL and $ar) {
$url .= (index($url, '?') == -1 ? '?' : '&') . 'bric_app_uri=';
my ($proto, $port);
if (SSL_ENABLE && ALWAYS_USE_SSL) {
$proto = 'https://';
$port = (SSL_PORT eq '*' or SSL_PORT == 443) ? '' : ':' . SSL_PORT;
}
else {
$proto = 'http://';
$port = (LISTEN_PORT eq '*' or LISTEN_PORT == 80) ? '' : ':' .
LISTEN_PORT;
}
$url .= $proto . $ar->hostname . $port;
}
Even then, this doesn't quite work on our proxied modperl installation,
since Bricolage runs internally http, but is running https on the
outside (SSL_ENABLE = false).
>> - First, create an empty iframe on the preview page. Change the
>> contents of that empty iframe to be a form that submits all the data
>> needed to modify the field. This is where we use the Bricolage
>> server's uri that was passed along with the redirected preview page.
>>
>> - After submitting the form, the preview frame beings polling its own
>> url for changes (more on this in a bit). It times out after around 30
>> seconds.
>
> Hrm. Why wouldn't the iFrame just wait for the response from its submit
> to Bricolage?
The iframe does wait for the response, but the iframe is now on the
bricolage app domain and it now can't communicate with the preview frame
directly. After the iframe loads (now on the app domain), it can grab
the redirected preview uri and update the preview frame's url to change
the fragment identifier. That's what the preview frame is polling
itself for.
>> - The previous form was posted to the inline_edit.html page. It does
>> its thing, and returns the status. However, because this page is
>> loaded inside an iframe on the preview page, it loses the ability to
>> communicate directly with the preview page (cross-domain). We can do
>> stuff with the frameset/top window (and any other page on the same
>> domain).
>
> Can the preview page poll the iFrame?
Nope. After the iframe posts to the bricolage domain, the preview page
loses its permission to access the iframe.
>> I hope this all explains the weirdness in case someone else needs to
>> do something with this code in the future.
>
> Be sure to add comments about all this to the code, as no one editing
> this stuff in the future will look for explanations on the mail list! :-)
Yup, I'll try get that done when I get a chance. Ideally, I'd like to
have a central location for this overview. Not sure which file would be
the best place.
Adrian
>> to *, so using that doesn't work. I can't use javascript to get it,
>> since I can't get around the cross domain issues of going the other
>> direction of passing bric app domain => preview domain (we would need
>> to put a static file on the preview server to be used as a proxy for
>> the data).
>
> Bric::Util::ApacheReq->instance->hostname
Yeah, that's what I'm using, but it gets a little ugly:
if (not PREVIEW_LOCAL and $ar) {
$url .= (index($url, '?') == -1 ? '?' : '&') . 'bric_app_uri=';
my ($proto, $port);
if (SSL_ENABLE && ALWAYS_USE_SSL) {
$proto = 'https://';
$port = (SSL_PORT eq '*' or SSL_PORT == 443) ? '' : ':' . SSL_PORT;
}
else {
$proto = 'http://';
$port = (LISTEN_PORT eq '*' or LISTEN_PORT == 80) ? '' : ':' .
LISTEN_PORT;
}
$url .= $proto . $ar->hostname . $port;
}
Even then, this doesn't quite work on our proxied modperl installation,
since Bricolage runs internally http, but is running https on the
outside (SSL_ENABLE = false).
>> - First, create an empty iframe on the preview page. Change the
>> contents of that empty iframe to be a form that submits all the data
>> needed to modify the field. This is where we use the Bricolage
>> server's uri that was passed along with the redirected preview page.
>>
>> - After submitting the form, the preview frame beings polling its own
>> url for changes (more on this in a bit). It times out after around 30
>> seconds.
>
> Hrm. Why wouldn't the iFrame just wait for the response from its submit
> to Bricolage?
The iframe does wait for the response, but the iframe is now on the
bricolage app domain and it now can't communicate with the preview frame
directly. After the iframe loads (now on the app domain), it can grab
the redirected preview uri and update the preview frame's url to change
the fragment identifier. That's what the preview frame is polling
itself for.
>> - The previous form was posted to the inline_edit.html page. It does
>> its thing, and returns the status. However, because this page is
>> loaded inside an iframe on the preview page, it loses the ability to
>> communicate directly with the preview page (cross-domain). We can do
>> stuff with the frameset/top window (and any other page on the same
>> domain).
>
> Can the preview page poll the iFrame?
Nope. After the iframe posts to the bricolage domain, the preview page
loses its permission to access the iframe.
>> I hope this all explains the weirdness in case someone else needs to
>> do something with this code in the future.
>
> Be sure to add comments about all this to the code, as no one editing
> this stuff in the future will look for explanations on the mail list! :-)
Yup, I'll try get that done when I get a chance. Ideally, I'd like to
have a central location for this overview. Not sure which file would be
the best place.
Adrian