Author Topic: Display logged account  (Read 37606 times)

Offline darkcoder

  • Jr. Member
  • **
  • Posts: 14
Display logged account
« on: July 13, 2006, 11:12:30 PM »
This mod was published in the old forum by another user, I do not have his name, but thanks anyway (If you are still here somewhere) for your contribution.

I made some modifications to the original code to adapt it better IMHO to RC style.
When the plugin is installed, the upper part of RC will look like this:


1. Open program/include/main.inc and search for // GENERAL.
Code: [Select]
    // GENERAL
     'loginform' => 'rcmail_login_form',
     'username' => 'rcmail_current_username',

  and change it to this:

Code: [Select]
    // GENERAL
     'loginform' => 'rcmail_login_form',
     'username' => 'rcmail_current_username',
     'userdisplay' => 'rcmail_user_display',

 Also search on the same file for
Code: [Select]
/****** debugging function ********/
 and add above it the following code

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 tag
 $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id'));

 $out = '';
 $out = $_SESSION['username'];
 $out .= '
';
 return $out;
}

 /****** debugging function ********/

2. Open program/js/app.js and after this code
Code: [Select]
  if (this.gui_objects.quotadisplay)
    this.gui_objects.quotadisplay.innerHTML = text;
   };

add this

Code: [Select]
// replace content of user display
  this.set_userd = function(text)
   {
   if (this.gui_objects.userdisplay)
    this.gui_objects.userdisplay.innerHTML = text;
   };

3. Edit skins/default/common.css, search for
Code: [Select]
#taskbar
and add above it the following

Code: [Select]
#myname
{
 position: absolute;
 top: 12px;
 left: 200px;
 height: 8px;
 width: 120px;
 color: #333333;
 text-decoration: none;
 font-size: 8pt;
 font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
 z-index: 10;
}

4. Open skins/default/includes/taskbar.html, and add at the top of the file
Code: [Select]




Changes from the original posted version
  • Text format used by the address is defined now in common.css
  • Since it is visually placed close to the taskbar, I think it was wiser to actually put the code there.

Issues so far
  • In a 800x600 screen the email address will overlap part of the E-Mail icon on the toolbar. If the z-index is changed, then the toolbar will practically cut completely the email at that resolution.

Offline simoesp

  • Jr. Member
  • **
  • Posts: 46
Re: Display logged account
« Reply #1 on: July 14, 2006, 05:46:15 AM »
very nice tweak

instead of taskbar.html ive used head.html



--------------------------------------------------------
 **                       S.I.M.O.E.S.P.                       **
--------------------------------------------------------

Offline flosoft

  • Sr. Member
  • ****
  • Posts: 349
    • http://flosoft.biz
Re: Display logged account
« Reply #2 on: July 14, 2006, 01:31:45 PM »
nice :)

Offline xoqez

  • Jr. Member
  • **
  • Posts: 84
Re: Display logged account
« Reply #3 on: July 16, 2006, 09:02:20 AM »
if you wanted to put this next to disk usage you would not use taskbar or head, what would you use?
--
Venond; using roundcube since June 2006
www.venond.com

Offline digitalslave

  • Jr. Member
  • **
  • Posts: 37
Re: Display logged account
« Reply #4 on: July 16, 2006, 11:17:34 AM »
instead of header or taskbar you would modify templates/mail.html of whatever skin you are using (default)

change the listcontrols to read as follows - i have added NOBR tags to skip editing the size of the div layer in another file.

Code: [Select]
<div id=&quot;listcontrols&quot;>
<nobr><roundcube:label name=&quot;select&quot; />:&nbsp;
<roundcube:button command=&quot;select-all&quot; label=&quot;all&quot; classAct=&quot;active&quot; />&nbsp;
<roundcube:button command=&quot;select-all&quot; prop=&quot;unread&quot; label=&quot;unread&quot; classAct=&quot;active&quot; />&nbsp;
<roundcube:button command=&quot;select-none&quot; label=&quot;none&quot; classAct=&quot;active&quot; /> &nbsp;&nbsp;&nbsp;
<roundcube:label name=&quot;quota&quot; />: <roundcube:object name=&quot;quotaDisplay&quot; /> &nbsp;&nbsp;&nbsp;
User: <roundcube:object name=&quot;userdisplay&quot; class=&quot;myname&quot; /></nobr>
</div>

Offline xoqez

  • Jr. Member
  • **
  • Posts: 84
Re: Display logged account
« Reply #5 on: July 16, 2006, 08:20:51 PM »
I am going to try this on my new implementation
--
Venond; using roundcube since June 2006
www.venond.com

Offline darkcoder

  • Jr. Member
  • **
  • Posts: 14
Re: Display logged account
« Reply #6 on: July 19, 2006, 03:22:11 AM »
Quote from: xoqez
if you wanted to put this next to disk usage you would not use taskbar or head, what would you use?
But that requires a big display (1024x768 or higher). Since still like 65% users use 800x600 I'm trying that as a target. The only place available is below the RC logo, but even if the email address is long, it will be overlapped (or overlap depending on z value) the folder list.

And also I have a clock mod in that place already.

Offline darkcoder

  • Jr. Member
  • **
  • Posts: 14
Re: Display logged account
« Reply #7 on: July 19, 2006, 03:32:02 AM »
Quote from: xoqez
if you wanted to put this next to disk usage you would not use taskbar or head, what would you use?


it should be near the botton of skins/default/templates/mail.html

Code: [Select]
<div id=&quot;listcontrols&quot;>
<roundcube:label name=&quot;select&quot; />:&nbsp;
<roundcube:button command=&quot;select-all&quot; label=&quot;all&quot; classAct=&quot;active&quot; />&nbsp;
<roundcube:button command=&quot;select-all&quot; prop=&quot;unread&quot; label=&quot;unread&quot; classAct=&quot;active&quot; />&nbsp;
<roundcube:button command=&quot;select-none&quot; label=&quot;none&quot; classAct=&quot;active&quot; /> &nbsp;&nbsp;&nbsp;
<roundcube:label name=&quot;quota&quot; />: <roundcube:object name=&quot;quotaDisplay&quot; />
</div>

</body>
</html>

But the advantage of header.html or taskbar.html is that those are loaded on every screen, so it will always be visible. Placing it where you want will only make it visible in the Inbox screen, and maybe other folders too.

Offline digitalslave

  • Jr. Member
  • **
  • Posts: 37
Re: Display logged account
« Reply #8 on: July 19, 2006, 06:27:47 PM »
darkcoder why not get rid of the logo all together...

oh and thanks for the answer that wasnt even an answer to a question that was already answered? heh are you confused yet

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Display logged account
« Reply #9 on: August 04, 2006, 04:58:56 AM »
This is a cool thing to put up there! Thank! O0

Offline Scubes13

  • Jr. Member
  • **
  • Posts: 48
Re: Display logged account
« Reply #10 on: August 07, 2006, 01:57:55 AM »
I like this bit of code. I modified it so that it displays right under the logo. I also added a bit of text to it, including the domain based on the host


I modified the following code in program/include/main.inc to display "User: username@host.ext".

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(&quot;%s.gui_object('userdisplay', '%s');&quot;, $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;
}

I also modified the CSS code (roundcube/skins/default/common.css) so that it would push the content to the correct place under the logo:

Code: [Select]
#myname
{
 position: absolute;
 top: 62px; /* 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: 8pt;
 font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
 z-index: 10;
}


I then editted the header.html file rather than the taskbar.html file.

In roundcube/skins/default/includes/header.html I ended up with the following:

Code: [Select]





My only fear with the result is how it will look with really long email addresses. By default, once the first line is full, the email address will be moved down below "User:". Meaning it would look like this:

User:
reallylongusername@reallylongdomain.com

The css gives us 130 pixels of width to work with.

Anywho, I like it so far.

Kevin L.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Display logged account
« Reply #11 on: August 08, 2006, 04:47:33 PM »
Thanks for the 2 way it looks nice to, but I have a clock there :(

Offline darkcoder

  • Jr. Member
  • **
  • Posts: 14
Re: Display logged account
« Reply #12 on: September 10, 2006, 02:39:39 AM »
First, found an issue where the font size is not correctly selected on all browsers. Changing the pt to px fix that. Example: font-size: 8pt; to font-size: 8px;

Second, found a place with enought space to display the email. While space is not an issue, maybe usability is.  The place, right over the search field. I made it right justify and aligned in the same position as the search field. Instead of making changes to header.html or toolbar.html, the correct file for this mod is mail.html.

skins/default/common.css or skins/default/mail.css
Code: [Select]
#emailaddress
{
 position: absolute;
 top: 40px;
 right: 40px;
 height: 11px;
 width: 200px;
 color: #333333;
 text-decoration: none;
 font-size: 10px;
 font-family: &quot;Lucida Grande&quot;, Verdana, Arial, Helvetica, sans-serif;
 text-align: right;
}
BTW, I increase the size to 10px, and change the name to emailaddress.

skins/default/includes/emailaddress.html ** New file **
Code: [Select]




Now edit skins/default/templates/mail.html, and add above the line

Code: [Select]






Offline xoqez

  • Jr. Member
  • **
  • Posts: 84
Re: Display logged account
« Reply #13 on: September 16, 2006, 12:16:57 AM »
This clock that you are talking about do you have a screenshot / mod instructions as a clock sounds good?
--
Venond; using roundcube since June 2006
www.venond.com

Offline jolan

  • Newbie
  • *
  • Posts: 1
Re: Display logged account
« Reply #14 on: October 20, 2006, 02:18:29 PM »
nice nice ;D