From: Timothy M. A. <ti...@ad...> - 2004-05-27 16:38:57
|
Hello, list! First off, thanks to Andreas and Teemu for the replies. They gave me a good brain-kick. I'm still a bit overwhelmed with the volume of stuff there is to OI, but I'll figure it out eventually. Yesterday, I started playing with the administration site for the project I'm working on and immediately ran into something I can't quite figure out. The design specs have my project broken into two distinct pieces: 1) the general user's site, where they can fiddle with the different settings of their account and other actions; and 2) the administration site, where my company can go in and fiddle with the users. :-) The default site has these actions combined into one site. The main reason for this is financial; we're going to have most of the credit card chargeback processing and the like on an internal web-server, firewalled off from the rest of the world. Getting down to work, I tried to remove all of the "boxes" and such from the /index.html document and create just a login box. The thing is, I can't seem to figure out how to get the user information to display anywhere other than in the user info box. I know there's something I'm just not grokking here. So, I wanted the template to do something like this pseudo-code: [%- IF user.authenticated -%] ( Display boxes ) ( Display default welcome page ) [%- ELSE -%] ( Display Login Form ) [%- END -%] The entire admin app should be locked down, requiring the user to be logged in before any page to be displayed. Any hints? Thanks! /tma |
From: Chris W. <ch...@cw...> - 2004-05-27 17:56:04
|
> ... > Getting down to work, I tried to remove all of the "boxes" and such from > the /index.html document and create just a login box. The thing is, I > can't seem to figure out how to get the user information to display > anywhere other than in the user info box. I know there's something I'm > just not grokking here. So, I wanted the template to do something like > this pseudo-code: > > [%- IF user.authenticated -%] > ( Display boxes ) > ( Display default welcome page ) > [%- ELSE -%] > ( Display Login Form ) > [%- END -%] > > The entire admin app should be locked down, requiring the user to be > logged in before any page to be displayed. Check out the template toolkit plugin at: OI1: OpenInteract::Template::Plugin OI2: OpenInteract2::TT2::Plugin The plugin allows you to do something like this in your main template ('base_main'), using the plugin through the reserved 'OI' name: [% IF OI.logged_in %] Hello [% OI.login.full_name %], nice to see you! [% ELSE %] Login now! <form ...> </form> [% END %] You also don't have to use the login box for logging. in. For instance, on my website (http://www.cwinters.com/) I have a separate component called 'my_login_bar', which displays a thin fullscreen bar with your username and a link to edit your info if you're logged in, or a 'login' link if you're not. (It also displays a 'Printable' link for everything...) The template looks like this (apologies for wrapping issues): -------------------- <table width="100%" cellpadding="1" cellspacing="0" border="0"> [% IF OI.logged_in -%] [%- logout_url = OI.make_url( base = '/NoTmpl/Logout/', return = OI.return.url ) -%] [%- edit_url = OI.make_url( base = '/User/show/', user_id = OI.login.id ) -%] <tr valign="middle" bgcolor="#eeeeee"> <td align="left" width="50%"><font size="-1"> You are logged in as <b>[% OI.login.login_name %]</b> (<a href="[% edit_url %]">Edit my info</a>) </font></td> <td align="right" width="40%"><font size="-1"> <a href="[% logout_url %]">Logout</a> </font></td> <td align="right" width="10%"><font size="-1"> <a href="/NoTmpl[% path %]">Printable</a> </font></td> </tr> [% ELSE -%] <tr valign="middle" bgcolor="#cccccc"> <td align="right"><font size="-1"> <b><a href="/login.html">Login</a></b> </font></td> <td align="right"><font size="-1"> <a href="/NoTmpl[% path %]">Printable</a> </font></td> </tr> [% END -%] </table> -------------------- Hope this helps! Chris |
From: Timothy M. A. <ti...@ad...> - 2004-05-27 22:30:09
|
On Thu, 2004-05-27 at 11:52, Chris Winters wrote: > > ... > > Getting down to work, I tried to remove all of the "boxes" and such from > > the /index.html document and create just a login box. The thing is, I > > can't seem to figure out how to get the user information to display > > anywhere other than in the user info box. I know there's something I'm > > just not grokking here. So, I wanted the template to do something like > > this pseudo-code: > > > > [%- IF user.authenticated -%] > > ( Display boxes ) > > ( Display default welcome page ) > > [%- ELSE -%] > > ( Display Login Form ) > > [%- END -%] > > > > The entire admin app should be locked down, requiring the user to be > > logged in before any page to be displayed. > > Check out the template toolkit plugin at: > > OI1: OpenInteract::Template::Plugin > OI2: OpenInteract2::TT2::Plugin > > The plugin allows you to do something like this in your main template > ('base_main'), using the plugin through the reserved 'OI' name: [SNIP] Ahh, OK! This is just the brain-kick I needed. Thanks! I did notice the OI "object" being used in the templates, but I couldn't find it mentioned in any of the docs. I had started going through all of the modules created as part of the new website, but I hadn't reached the Template module yet. Now that I know where the OI template variable gets plugged in, I can get a better grasp on how the system flows. I'm sure I'll run into other things as I go along, but this will give me a great start. [SNIP] > Hope this helps! Absolutely! Thanks! /tma |
From: Teemu A. <te...@io...> - 2004-05-28 08:09:59
|
> Ahh, OK! This is just the brain-kick I needed. Thanks! > > I did notice the OI "object" being used in the templates, but I couldn't > find it mentioned in any of the docs. I had started going through all of > the modules created as part of the new website, but I hadn't reached the > Template module yet. Now that I know where the OI template variable gets > plugged in, I can get a better grasp on how the system flows. Check this out for documentation about OI object: http://search.cpan.org/~cwinters/OpenInteract-1.60/OpenInteract/Template/Plugin.pm -- -------------- Teemu Arina Ionstream Oy / Dicole Komeetankuja 4 A 02210 Espoo FINLAND Tel: +358-(0)50 - 555 7636 http://www.dicole.fi "Discover, collaborate, learn." |
From: Teemu A. <te...@io...> - 2004-05-28 08:07:54
|
> The entire admin app should be locked down, requiring the user to be > logged in before any page to be displayed. > > Any hints? I remember the login box thing was discussed on the list last year for OI1: http://sourceforge.net/mailarchive/forum.php?thread_id=2939624&forum_id=3223 -- -------------- Teemu Arina Ionstream Oy / Dicole Komeetankuja 4 A 02210 Espoo FINLAND Tel: +358-(0)50 - 555 7636 http://www.dicole.fi "Discover, collaborate, learn." |