Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-08-09 15:09:10

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

textpattern dashboard

i’m not really making a plugin but a friend wanted a ‘summary’ type page so i played around with sencer’s preliminary asy_dashboard plugin and added some very basic things:

  • ‘dashboard’ admin tab
  • read from a style named ‘dashboard’ by adding modified code from hpw_admincss.
  • displays current logged in username / logout link
  • post and comment counts from snippets of defunct counting plugins (gbl_blog_stats)
  • current and ‘last modified’ time display

i have this installed on my own site for now, threw in some basic styling (the admin theme is smallTransports take on the interface) and have this so far:

need help on the following:

1) what i cant seem to figure out is when a user first logs in, how do i get the “write” tab to identity itself as being NOT the current page? as you can see in the image above, the “write” tab is highlighted. i’m using this to add the dashboard tab:

function dashboardTab($buffer)
{
    $find = '<td valign="middle" style="width:368px">&nbsp;</td>';
    $class = ($_SERVER['REQUEST_URI'] == '/textpattern/index.php') ? 'tabup' : 'tabdown';
    $replace = $find.'<td class="'.$class.'" onclick="window.location.href=\'?event=my_event\'"><a href="index.php" class="plain">Dashboard</a></td>';
    return str_replace($find, $replace, $buffer);
}

2) how do i tie this properly to an event? (ie ?event=dashboard). right now when someone clicks on the dashboard tab, all it does is link them back to /textpattern/index.php which in turn shows them the dashboard again.

as you can see in the code, in order to get the dashboard to recognize its current or non-current tab state, i compare the current url to see if it matches ‘/textpattern/index.php’ (because the dashboard always shows up at this url/when you first log in). i’m assuming tying it to an event would make things a bit more consistent.

any help/suggestions would be great.

Last edited by iblastoff (2007-08-23 16:33:10)

Offline

Board footer

Powered by FluxBB