--- cosign.module.a	2010-01-26 13:15:19.156250000 -0500
+++ cosign.module.b	2010-01-26 12:53:56.343750000 -0500
@@ -1,5 +1,5 @@
 <?php
-// $Id: cosign.module,v 1.9.2.2 2008/12/18 17:23:23 ksteinhoff Exp $
+// $Id: cosign.module,v 1.9.2.3 2008/12/18 17:24:41 ksteinhoff Exp $
 
 /**
  * @file
@@ -152,25 +152,66 @@
   return TRUE;
 }
 
-function cosign_block($op='list', $delta=0) {
+function cosign_theme() {
+  $path = drupal_get_path('module', 'cosign');
+
+  return array(
+    'cosign_logout_link' => array(
+      'arguments' => array(),
+    ),
+    'cosign_login_link' => array(
+      'arguments' => array(),
+    ),
+    'cosign_status' => array(
+      'arguments' => array(),
+    ),
+  );
+}
+
+function cosign_block($op='list', $delta='logout') {
   global $user;
 
   switch ($op) {
     case 'list':
-      $blocks[0]["info"] = t("Cosign status and logout");
+      $blocks['cosign_login_logout']["info"] = t("Cosign status and login/logout");
       return $blocks;
     case 'save':
       return;
     case 'configure':
-      return;
+	  return;
     case 'view': default:
-      $block['content'] = 'logout <a href="' . base_path() . '?q=logout">' .
-        $user->name . '</a>';
+      switch ($delta) {
+        case 'cosign_login_logout':
+          $block['content'] = theme('cosign_status');
+          break;
+      }
   }
 
   return $block;
 }
 
+function theme_cosign_status() {
+  global $user;
+  if (in_array('authenticated user', $user->roles)) {
+    $content = theme('cosign_logout_link');
+  } else {
+    $content = theme('cosign_login_link');
+  }
+
+  return $content;
+}
+
+function theme_cosign_logout_link() {
+  global $user;
+  $content = t("logout ").l($user->name, "logout");
+  return $content;
+}
+
+function theme_cosign_login_link() {
+  $content = l("Login", "https://".$_SERVER['HTTP_HOST'].request_uri());
+  return $content;
+}
+
 function cosign_disable() {
   $module = 'cosign';
 
