But from a look and feel I’d rather not have the buttons leading to them showing at all. To me, when a site does this, it is like saying “Nya, nya, you can’t come here!”
You’ve got a chicken-and-egg problem here. You could use Cookies to identify the people who are allowed to see these menus, but how to get them in there the first time? Perhaps you could give each person an e-mail to the login page, then set the cookie that means “canSeeAdmin” to some known value, then test for that value when the page loads.
I would test for the Cookie value using PHP, then use PHP to rewrite the menu or to inject a bit of JavaScript that would rewrite it.
To figure out what to add, simply publish a scratch page containing all of the options, and another showing only the public options. If you have BBEdit, it can do a ‘diff’ between these files and show you just the parts you need to inject.
To get them in there, you could use Prototype.js and Element.insert(), or you could use Source Code Snooper to plop a bit of PHP into your menu code that would do the same thing.
<?php
if(isset($_COOKIE['rt'])){
if($session = ActiveRecord::FindFirst('people','session = "' . $_COOKIE['rt'] . '"')){
$script = ($session->can_edit(ActiveRecord::Create('meetings'))) ? ' <script type="text/javascript" charset="utf-8">
Event.observe(window,"load",function(){$("member_bar").insert(" | <a href=\"meetings/create\">Add Meeting</a>")});
</script>
' : '';
$script .= ($session->can_admin(ActiveRecord::Create('people'))) ? ' <script type="text/javascript" charset="utf-8">
Event.observe(window,"load",function(){$("member_bar").insert(" | <a href=\"people/create\">Add Moderator</a>")});
</script>
' : '';
}else{
$session = ActiveRecord::Create('people');
}
}else{
$session = ActiveRecord::Create('people');
}
?>
That’s out of some running code here. (Requires Prototype.js) Note that Freeway won’t let you simply ID a P tag the way a hand-coded page will, so you’ll have to get creative in your JavaScript selector:
$$('#item4 p').first().insert(...);
//rather than
$('member_bar').insert(...);
Walter
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options