Roundcube Community Forum

Third Party Contributions => Old Style Plug-Ins => Topic started by: darkcoder on July 13, 2006, 11:12:30 PM

Title: Display logged account
Post by: darkcoder 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:

(http://www.mundolink.net/rc-logname.png)

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

Issues so far
Title: Re: Display logged account
Post by: simoesp on July 14, 2006, 05:46:15 AM
very nice tweak

instead of taskbar.html ive used head.html



Title: Re: Display logged account
Post by: flosoft on July 14, 2006, 01:31:45 PM
nice :)
Title: Re: Display logged account
Post by: xoqez 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?
Title: Re: Display logged account
Post by: digitalslave 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>
Title: Re: Display logged account
Post by: xoqez on July 16, 2006, 08:20:51 PM
I am going to try this on my new implementation
Title: Re: Display logged account
Post by: darkcoder 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.
Title: Re: Display logged account
Post by: darkcoder 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.
Title: Re: Display logged account
Post by: digitalslave 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
Title: Re: Display logged account
Post by: SKaero on August 04, 2006, 04:58:56 AM
This is a cool thing to put up there! Thank! O0
Title: Re: Display logged account
Post by: Scubes13 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.
Title: Re: Display logged account
Post by: SKaero on August 08, 2006, 04:47:33 PM
Thanks for the 2 way it looks nice to, but I have a clock there :(
Title: Re: Display logged account
Post by: darkcoder 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]





(http://)
Title: Re: Display logged account
Post by: xoqez 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?
Title: Re: Display logged account
Post by: jolan on October 20, 2006, 02:18:29 PM
nice nice ;D
Title: Re: Display logged account
Post by: rantdepot on November 06, 2006, 04:28:03 PM
Quote from: 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

...

This line:
Code: [Select]
$_SERVER['HTTP_HOST']);ends up appending the server on which RoundCube is hosted as opposed to the actual IMAP server being connected to.

For example:
RoundCube is hosted on website.com where as the IMAP server is mail.com; when logged in the text shows:
Code: [Select]
User: [email]username@website.com[/email] instead of
Code: [Select]
User: [email]username@mail.com[/email]
Any idea on how to change this so the correct server is reflected?
Title: Re: Display logged account
Post by: ashleyfox on August 22, 2007, 05:08:46 PM
Anyone know how to get this to work with the latest roundcube release: 0.1-RC1.

I've added everything it says but it doesnt work. I've narrowed down the problem (I think anyway) to the additions made in main.inc.

Specifically:

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 = $_SESSION['username'];
 $out .= '</span>';
 return $out;
}

Any help would be appreciated.
Title: Re: Display logged account
Post by: ashleyfox on August 22, 2007, 05:19:24 PM
I think I've fixed it. Just changed the code in main.inc. It works now in roundcube release: 0.1-RC1. Changes are shown below:

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;rcmail.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 = $_SESSION['username'];
 $out .= '</span>';
 return $out;
}
Title: Re: Display logged account
Post by: timelord on September 27, 2007, 02:12:27 AM
Quote from: SKaero
Thanks for the 2 way it looks nice to, but I have a clock there :(

Any code for that clock? ;)
Title: Re: Display logged account
Post by: SKaero on September 27, 2007, 05:20:26 AM
Yes I think I have it in a old back-up I will see if I can dig it up and get it to work in rc1
Title: Re: Display logged account
Post by: seansan on October 20, 2007, 12:00:49 PM
Has this been added to SVN - or logged as a patch in trac?

Could by nice to set as an option (to not dustrub users who dont want it)
Title: Re: Display logged account
Post by: rsw686 on October 31, 2007, 01:47:25 PM
Quote from: seansan
Has this been added to SVN - or logged as a patch in trac?

Could by nice to set as an option (to not dustrub users who dont want it)

I would like to see this added as well. I have multiple accounts I open at the same time and I can never remember which window is what. I have a feeling most would users would appreciate this feature.
Title: Re: Display logged account
Post by: njohal on November 11, 2007, 09:30:05 PM
Say you want to display their name rather then the email address that they have typed in the identity.. how can one pursue that??
Title: Re: Display logged account
Post by: ricardobond on December 05, 2007, 05:57:23 PM
This code is for rc1 right?
I'm using rc2

Anybody help me?

Sorry, but my english is very poor!

Thx.
Title: Re: Display logged account
Post by: luxerama on December 13, 2007, 07:56:01 AM
Quote from: njohal
Say you want to display their name rather then the email address that they have typed in the identity.. how can one pursue that??

Depends what their name is or where it comes from. I have a virtual setup where finding the users name is very easy as its just the string before the @. Which means I can just do:
Code: [Select]
$username = explode('@', $_SESSION['username']);
 $out .= $username[0];
Instead of:
Code: [Select]
$out .= $_SESSION['username'];
Title: Re: Display logged account
Post by: luxerama on December 15, 2007, 06:03:59 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.

Still interested? If so let me know and Ill post the information.
Title: Re: Display logged account
Post by: dunccs on January 15, 2008, 08:31:36 AM
Quote from: luxerama
Quote from: ricardobond
This code is for rc1 right?
I'm using rc2

Anybody help me?

Sorry, but my english is very poor!

Thx.

Still interested? If so let me know and Ill post the information.

He has gone but i sure am intrested int he code. Hope to hear from you Soon, God bless!!
Title: Re: Display logged account
Post by: dunccs on January 15, 2008, 08:33:14 AM
Quote from: luxerama
Quote from: ricardobond
This code is for rc1 right?
I'm using rc2

Anybody help me?

Sorry, but my english is very poor!

Thx.

Still interested? If so let me know and Ill post the information.

i sure am intrested , please Post !!
Title: Re: Display logged account
Post by: jasonar on January 20, 2008, 05:41:35 PM
I'm also using RC2 and would like to know how to use it with my version.
Title: Re: Display logged account
Post by: bswinnerton on January 31, 2008, 09:24:37 AM
For some reason when I do this it greys out all of my icons for checking mail, replying etc. =(. It has something to do with the app.js because once i went back to the old one it worked fine.
Title: Re: Display logged account
Post by: amorino on February 16, 2008, 05:29:26 PM
Hello guys,
This hack works fine with RC2?

Thank you a lot
Title: Re: Display logged account
Post by: amorino on February 16, 2008, 08:39:45 PM
I try it with RC2 but it does'nt work :(

Any help please?

Thank you
Title: Re: Display logged account
Post by: amorino on February 19, 2008, 12:57:13 PM
Please any idea my freinds?
Title: Display logged account
Post by: Scubes13 on March 02, 2009, 01:54:34 AM
Anyone have any idea how to make this work in roundcube 0.2-stable?

Thanks.
Title: Display logged account
Post by: Julius Caesar on March 02, 2009, 03:42:58 AM
In the 0.2-stable version you can use the following by default:

email of selected identity
loginname
imap server
Title: Display logged account
Post by: zamri on March 11, 2009, 07:40:27 AM
Julius,

where to put that codes?
Title: Display logged account
Post by: Julius Caesar on March 11, 2009, 07:48:02 AM
Quote from: zamri;17604
where to put that codes?


Depends on where you want to show it.

In theme Groupvice, I show it on top of the mailbox list:

From the mail.html
Code: [Select]
<div id=&quot;mailboxlist-container&quot;>
   <ul id=&quot;mailboxlistgw&quot;>
      <li id=&quot;rcmliID&quot; class=&quot;home even&quot;>
         <roundcube:object name=&quot;username&quot; />
      </li>
   </ul>
   <roundcube:object name=&quot;mailboxlist&quot; id=&quot;mailboxlist&quot; maxlength=&quot;30&quot; />
</div>


But you can add it also to the header.html

These files are located in the ../skins/ directory.
Title: Display logged account
Post by: zamri on March 11, 2009, 10:37:59 AM
I want to put username (mail address) alongside taksbar. What file(s) to edit?
Title: Display logged account
Post by: Julius Caesar on March 11, 2009, 11:06:03 AM
Quote from: zamri;17637
I want to put username (mail address) alongside taksbar. What file(s) to edit?

If you use the default skin it should be the file ./skins/default/includes/taskbar.html:

I.E.:

Code: [Select]
<div id=&quot;taskbar&quot;>
  [B]<roundcube:object name=&quot;username&quot; />&nbsp;[/B]
  <roundcube:button command=&quot;mail&quot; label=&quot;mail&quot; class=&quot;button-mail&quot; />
  <roundcube:button command=&quot;addressbook&quot; label=&quot;addressbook&quot; class=&quot;button-addressbook&quot; />
  <roundcube:button command=&quot;settings&quot; label=&quot;settings&quot; class=&quot;button-settings&quot; />
  <roundcube:button command=&quot;logout&quot; label=&quot;logout&quot; class=&quot;button-logout&quot; />
</div>
Title: Display logged account
Post by: rcubefan on August 11, 2011, 10:46:47 PM
Quote from: Julius Caesar;17409
In the 0.2-stable version you can use the following by default:

email of selected identity

This object is displaying the loginname, not the email of the (default) identity. Is there a variable to snag the email address in the identity? So, for example, the loginname is johnh@logindomain, but the email in the identity is johnh@id-domain. How can I display johnh@id-domain?
Title: Display logged account
Post by: Julius Caesar on August 12, 2011, 04:22:22 AM
The available list can be found here (http://trac.roundcube.net/wiki/Doc_SkinML), but it does not include a loginname.
Title: Display logged account
Post by: rcubefan on August 12, 2011, 08:50:31 AM
Thanks for that link, very useful. But there seem to be no variables to pull the email address or name from the primary identity.

The loginname gives you the email address with which the user is logged in, not the email address stored with the identity.