Embedded G2, relativeG2Path vs. g2Path
valiant
Joined: 2003-01-04
Posts: 32509 |
Posted: Mon, 2005-05-30 14:15 |
This diff for GalleryUrlGenerator.class function getCurrentUrlDir() introduces the notion of "g2Path" which is analogous to embedPath. And it is an alternative to relativeG2Path. It solves the problem where g2 is installed in another subdomain than emApp. there's no relativeG2Path to translate one of these urls to another, because the host part of the url is involved. Another argument for g2Path and against relativeG2Path: relativeG2Path is relative and thus unintuitive and ugly. RCS file: /cvsroot/gallery/gallery2/modules/core/classes/GalleryUrlGenerator.class,v retrieving revision 1.79 diff -r1.79 GalleryUrlGenerator.class 305,309c305,330 < if ($forceG2Base && !empty($this->_relativeG2Path)) { < $relativePath = $this->_relativeG2Path; < while (strncmp($relativePath, '../', 3) == 0) { < $url = preg_replace('|/[^/]+/?$|', '/', $url); < $relativePath = substr($relativePath, 3); --- > if ($forceG2Base && (!empty($this->_relativeG2Path) || !empty($this->_g2Path))) { > if (!empty($this->_g2Path)) { > /* > * g2Path is the absolute url path to the directory main.php is in > * g2Path can but doesn't have to include the host part (use case > * is when g2 is installed in another subdomain than emApp) > * Therefore we have the convention: > * - if g2Path is only the path, it must start with a slash, e.g. /gallery2/ > * - if g2Path includes the host part, everything before the first slash is > * considered to be the host string, eg. photos.example.com/gallery2/ > * In all cases G2 and emApp must be in the same domain, else cookies don't work. > */ > if ($this->_g2Path{0} != '/') { > $protocol = (GalleryUtilities::getServerVar('HTTPS') == 'on') > ? 'https' : 'http'; > $url = sprintf('%s://%s', $protocol, $this->_g2Path); > } else { > $url = GalleryUrlGenerator::makeUrl($this->_g2Path); > } > } else { > $relativePath = $this->_relativeG2Path; > while (strncmp($relativePath, '../', 3) == 0) { > $url = preg_replace('|/[^/]+/?$|', '/', $url); > $relativePath = substr($relativePath, 3); > } > $url .= $relativePath; 311d331 < $url .= $relativePath;
Should we replace relativeG2Path completely, make it deprecated? |
|
Posts: 8601
1) if this method is better I'd rather replace the relative path than have 2 things.
2) docs/EMBEDDING specifically says embedUri should not be a path/url, just the filename.. but it looks like the code does accept full url, right? I'm not sure what case you'd want a full url here.
3) you mean which params are required for embed? sure.. they can all be omitted for standalone.
Posts: 21
Has there been any movemenet or a decision on this? I am setting up an embedded G2 from one sub-domain to another. Fortunatly they are on the same server so I can make a symbolic link from one sub-domains webroot folder to the other, but I would prefer if there was a way that didn't require me to do this.
If the main gallery site is http://photo.url.com
and the front page site that G2 is being embedded into is http://www.url.com I am planning on linking (symbolic file link) the gallery to http://www.url.com/gallery/ .
I have no problem doing this, but obviously I would prefer if people couldn't access http://www.url.com/gallery/ directly.
Should I be looking into making a similar diff for the recent release?
Posts: 32509
as i said yesterday. yes we have plans, no, not in the next few weeks, certainly after g2 2.0.
Posts: 21
valiant,
I know there are not plans for inputting this data into the official code base (yet), but is there any reason that this couldn't be implemented in an individual site using your diff or a modified version of it?
Posts: 32509
you're free to do anything you want. but don't expect me to work on it these days, i just don't have time. if the diff (still) works, why not use it.