Roundcube Community Forum

 

Display logged account

Started by darkcoder, July 13, 2006, 11:12:30 PM

Previous topic - Next topic

darkcoder

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.
    // GENERAL
     'loginform' => 'rcmail_login_form',
     'username' => 'rcmail_current_username',

  and change it to this:

    // GENERAL
     'loginform' => 'rcmail_login_form',
     'username' => 'rcmail_current_username',
     'userdisplay' => 'rcmail_user_display',

 Also search on the same file for
/****** debugging function ********/
 and add above it the following code

/***** 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
  if (this.gui_objects.quotadisplay)
    this.gui_objects.quotadisplay.innerHTML = text;
   };

add this

// 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
#taskbar
and add above it the following

#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




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.

simoesp

very nice tweak

instead of taskbar.html ive used head.html



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


xoqez

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

digitalslave

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.

<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>

xoqez

I am going to try this on my new implementation
--
Venond; using roundcube since June 2006
www.venond.com

darkcoder

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.

darkcoder

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

<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.

digitalslave

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

SKaero

This is a cool thing to put up there! Thank! O0

Scubes13

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".

/***** 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:

#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:






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.

SKaero

Thanks for the 2 way it looks nice to, but I have a clock there :(

darkcoder

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 #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 **




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





xoqez

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

jolan