Author Topic: Re: Display logged account  (Read 2498 times)

Offline luxerama

  • Newbie
  • *
  • Posts: 8
Re: Display logged account
« on: December 13, 2007, 08:19:35 AM »
Quote from: ricardobond
This code is for rc1 right?
I'm using rc2

Anybody help me?

Sorry, but my english is very poor!

Thx.

Well it also works for rc2 the only thing is that the references to the lines where you should insert the new stuff are wrong.

1. insert this at the end of program/include/main.inc:
Code: [Select]
/**
 * Display user information
 **/
function rcmail_user_display($attrib)
 {
 global $OUTPUT, $JS_OBJECT_NAME;

 if (!$attrib['id'])
  $attrib['id'] = 'rcmuserdisplay';

 $OUTPUT->add_script(sprintf("%s.gui_object('userdisplay', '%s');", $JS_OBJECT_NAME, $attrib['id']));

 // allow the following attributes to be added to the <span> tag
 $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id'));
 $out = '<span' . $attrib_str . '>';
 $out = '<b>User:</b>&nbsp;';
 $out .= $_SESSION['username'];
 $out .= '@' . '' . str_replace(&quot;[url]www.&quot;[/url], &quot;&quot;, $_SERVER['HTTP_HOST']);
 $out .= '</span>';
 return $out;
}

2. Search (in main.inc) for // register common UI objects which looks like:
Code: [Select]
// register common UI objects
 $OUTPUT->add_handlers(array(
  'loginform' => 'rcmail_login_form',
  'username' => 'rcmail_current_username',
  'message' => 'rcmail_message_container',
  'charsetselector' => 'rcmail_charset_selector',
 ));

3. Add 'userdisplay' => 'rcmail_user_display', to make it look like this:
Code: [Select]
// register common UI objects
 $OUTPUT->add_handlers(array(
  'loginform' => 'rcmail_login_form',
  'username' => 'rcmail_current_username',
  'message' => 'rcmail_message_container',
  'charsetselector' => 'rcmail_charset_selector',
  'userdisplay' => 'rcmail_user_display',
 ));

4. insert this at the end of skins/default/common.css (if you have your own skin you obviously have to replace default):
Code: [Select]
#user
{
 position: absolute;
 top: 67px; /* Below the Main Logo */
 left: 20px; /* Aligned with the left edge of logo */
 height: 8px;
 width: 130px; /* Made the width a lil bit bigger. */
 color: #333333;
 text-decoration: none;
 font-size: 8.5px;
 font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
 z-index: 10;
}

5. In skins/default/include/header.html (if you have your own skin you obviously have to replace default) after:
Code: [Select]
insert:
Code: [Select]

6. In /program/js/app.js search for // replace content of quota display after
Code: [Select]
// replace content of quota display
 this.set_quota = function()
  {
  if (this.gui_objects.quotadisplay &&
    this.gui_objects.quotadisplay.attributes.getNamedItem('display') &&
    this.gui_objects.quotadisplay.attributes.getNamedItem('id'))
   this.http_request('quotadisplay', '_display='+
   this.gui_objects.quotadisplay.attributes.getNamedItem('display').nodeValue+
   '&_id='+this.gui_objects.quotadisplay.attributes.getNamedItem('id').nodeValue, false);
   };
insert:
Code: [Select]
// replace content of user display
  this.set_userd = function(text)
   {
   if (this.gui_objects.userdisplay)
    this.gui_objects.userdisplay.innerHTML = text;
   };