MicroID: how to do it idiomatically?

View: New views
3 Messages — Rating Filter:   Alert me  

MicroID: how to do it idiomatically?

by Adam Lindsay-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

The more I learn within Flux, the more I'm impressed, but the more I
confused I get as to the "right" way of doing things.

I'm trying to insert a MicroID into my CMS (oh look--you've written a
function already) and was wondering how to do it the "right" way.

For now, I've inserted it as a couple of lines within the <head> portion
of master.xsl:


<meta name="microid">
  <xsl:attribute name="content">
   <xsl:choose>
    <xsl:when test="contains($requestUri,'/index.html')">
<xsl:value-of select="php:functionString('bx_helpers_openid::microid',
          'me@...',
          concat(substring($webrootLang,0,string-length($webrootLang)),
            substring-before($requestUri,'/index.html')))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="php:functionString('bx_helpers_openid::microid',
          'me@...',
          concat(substring($webrootLang,0,string-length($webrootLang)),
            $requestUri))"/>
</xsl:otherwise>
</xsl:choose>
  </xsl:attribute>
</meta>

(Pardon the tortured syntax to work around my failings in XPath. I'm out
of shape with it.)

The real question I have is: how do I programmatically get the email
address (of user #1 by default, I would presume)?

I guess the next question is, how does this get generalised for other
installations? Would it be worth a plugin? Should the computed path be
pre-charged (precomputed as a variable)? Is there an internal variable
that I'm not aware of that will give the appropriate URL for MicroID
purposes (no trailing slash or index.html)?

Thanks,
adam

--
bitflux-cms mailing list
bitflux-cms@...
http://lists.bitflux.ch/cgi-bin/listinfo/bitflux-cms

Re: MicroID: how to do it idiomatically?

by Christian Stocker-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

Sorry for not answering sooner, we're very busy currently.
On 7.11.2006 23:39 Uhr, Adam Lindsay wrote:

> Hi,
>
> The more I learn within Flux, the more I'm impressed, but the more I
> confused I get as to the "right" way of doing things.
>
> I'm trying to insert a MicroID into my CMS (oh look--you've written a
> function already) and was wondering how to do it the "right" way.
>
> For now, I've inserted it as a couple of lines within the <head> portion
> of master.xsl:

you could also use

bx_helpers_uri::getRequestUri() instead of $requestUri, as that more or
less just returns
http(s)://$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], so you can
forget about the xsl:choose block

>
> The real question I have is: how do I programmatically get the email
> address (of user #1 by default, I would presume)?

There's no real way, IIRC. You have to write a helper function for that.

> I guess the next question is, how does this get generalised for other
> installations? Would it be worth a plugin?

I'm not sure, if it's worth a plugin, there's not much more that 3
helper calls for that. AFAICS at least.

> Should the computed path be
> pre-charged (precomputed as a variable)? Is there an internal variable
> that I'm not aware of that will give the appropriate URL for MicroID
> purposes (no trailing slash or index.html)?

See above :)

chregu



>
> Thanks,
> adam
>

--
christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
phone +41 44 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71
http://www.bitflux.ch | christian.stocker@... |  GPG 0x5CE1DECB
--
bitflux-cms mailing list
bitflux-cms@...
http://lists.bitflux.ch/cgi-bin/listinfo/bitflux-cms

Re: MicroID: how to do it idiomatically?

by Adam Lindsay-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, Chregu.

Blogged a slightly better solution at:
  http://lindsay.at/blog/archive/2006/11/12/openid-and-microid.html

(The tricky concat/translate is to delete any trailing slashes, which is
part of the MicroID spec.)

Adam

Christian Stocker wrote:

> Hi
>
> Sorry for not answering sooner, we're very busy currently.
> On 7.11.2006 23:39 Uhr, Adam Lindsay wrote:
>> Hi,
>>
>> The more I learn within Flux, the more I'm impressed, but the more I
>> confused I get as to the "right" way of doing things.
>>
>> I'm trying to insert a MicroID into my CMS (oh look--you've written a
>> function already) and was wondering how to do it the "right" way.
>>
>> For now, I've inserted it as a couple of lines within the <head> portion
>> of master.xsl:
>
> you could also use
>
> bx_helpers_uri::getRequestUri() instead of $requestUri, as that more or
> less just returns
> http(s)://$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], so you can
> forget about the xsl:choose block
>
>> The real question I have is: how do I programmatically get the email
>> address (of user #1 by default, I would presume)?
>
> There's no real way, IIRC. You have to write a helper function for that.
>
>> I guess the next question is, how does this get generalised for other
>> installations? Would it be worth a plugin?
>
> I'm not sure, if it's worth a plugin, there's not much more that 3
> helper calls for that. AFAICS at least.
>
>> Should the computed path be
>> pre-charged (precomputed as a variable)? Is there an internal variable
>> that I'm not aware of that will give the appropriate URL for MicroID
>> purposes (no trailing slash or index.html)?
>
> See above :)
>
> chregu
>
>
>
>> Thanks,
>> adam
>>
>
--
bitflux-cms mailing list
bitflux-cms@...
http://lists.bitflux.ch/cgi-bin/listinfo/bitflux-cms