Roundcube Community Forum

Third Party Contributions => API Based Plugins => Topic started by: ABerglund on August 13, 2009, 05:50:48 PM

Title: Plugin for sig-above-reply option?
Post by: ABerglund on August 13, 2009, 05:50:48 PM
I'm hoping not to get into the top-post/bottom-post debate here. But I was wondering if anyone was working on an API plugin for 0.3 to allow a user to select signatures above or below the reply? Like it or not, many people do top post, and having this as a user-selectable option is probably the last barrier for our organization to use Roundcube to replace squirrelmail.
Title: Plugin for sig-above-reply option?
Post by: techdude on August 13, 2009, 07:43:34 PM
I would definately be interested in seeing this.
Title: Plugin for sig-above-reply option?
Post by: ABerglund on September 04, 2009, 11:15:04 PM
Now that 0.3 has gone Stable, I'm hoping that someone looks into this, as I don't think I have the PHP or js skills to pull it off myself.
Title: Plugin for sig-above-reply option?
Post by: ABerglund on September 10, 2009, 01:33:57 PM
A perhaps simpler option might be to develop a plugin to add a button that inserts the signature where the cursor is at that time. People could post at the top or the bottom and then insert the signature as appropriate.
Title: Plugin for sig-above-reply option?
Post by: xrxca on September 17, 2009, 07:04:36 PM
This may be possible but not easy with the existing hooks, I did a few trials with the message_compose hook, but it becomes overly complicated because the message body hasn't been created at this point so the plugin would have to duplicate all that other work...

It's pretty easy to override some of the options, but not all, for instance with
the current hook you can't seem change the subject on a reply, only on a new message...
Title: Plugin for sig-above-reply option?
Post by: ABerglund on September 17, 2009, 07:56:04 PM
Yeah, after I thought about it some, the button solution looks to be much harder to pull off than simply adding a choice of where the signature is placed when the compose window is first populated.
Title: Plugin for sig-above-reply option?
Post by: Julius Caesar on September 18, 2009, 03:04:22 AM
Just a note for the one who is gonna develop it.

Make sure that the separator
Code: [Select]
[B]-- [/B] is not included when adding the signature is another place than bottom. Well configured mail programs will snip the separator and everything below it.
Title: Plugin for sig-above-reply option?
Post by: ABerglund on September 18, 2009, 11:30:33 AM
Quote from: Julius Caesar;21439
Just a note for the one who is gonna develop it.

Make sure that the separator
Code: [Select]
[B]-- [/B] is not included when adding the signature is another place than bottom. Well configured mail programs will snip the separator and everything below it.
Good reminder. That was one of the things that people forgot in the v0.2 hacks for moving the signature.

Another thing to consider is that if the signature is inserted above the reply, there needs to be a empty line in HTML messages that is before the
Code: [Select]
 tag so that word wrap and other formatting works properly.

Sad fact is I know exactly what our organization needs on this, but I doubt I have the skills do pull it off myself.
Title: Plugin for sig-above-reply option?
Post by: JohnDoh on October 10, 2009, 11:49:10 AM
would some one who uses this feature mind testing the patch in this mailing list post? I had a quick look but I dont belive it is possible to do this via a plugin, it requries changes in places not controled by hooks.

RoundCube Mailing Lists (http://lists.roundcube.net/mail-archive/dev/2009-10/0000053.html)

It requires the lastest SVN version of RoundCube (patch built against rev 3030) It will not work with 0.3 stable.
Title: Plugin for sig-above-reply option?
Post by: ABerglund on October 10, 2009, 12:34:37 PM
Quote from: JohnDoh;22008
would some one who uses this feature mind testing the patch in this mailing list post? I had a quick look but I dont belive it is possible to do this via a plugin, it requries changes in places not controled by hooks.

RoundCube Mailing Lists (http://lists.roundcube.net/mail-archive/dev/2009-10/0000053.html)

It requires the lastest SVN version of RoundCube (patch built against rev 3030) It will not work with 0.3 stable.
Phil, I'll be happy to test it, but I just left for a week of vacation and won't be able to look into this until I get back. Edit: I was wrong, see next post.
Title: Plugin for sig-above-reply option?
Post by: ABerglund on October 10, 2009, 08:30:15 PM
Well, didn't make it out of town today after all, so I took a few minutes to pull down and set up a fresh copy of SVN 3031 and patched it.

Obviously, I'll want to do more testing over a longer period, but at first glance it looks like a really good start. In fact, the actual top posting part looks to be pretty solid. Much better than any of the hacks people did to v.0.2.

The "insert signature" part works, but looking at it as if I was one of my non-technical users, I see a couple of glitches.

One is that the "Insert" button looks available even when it's not. For example, if the signature is set to auto-insert (set to always, for example), the "insert" button correctly does nothing. But it is still visible, and is not grayed out. Ideally, the button would only be visible if the option was available, or at least grayed out.

But the larger issue is that if the users' pref is set to top post, clicking the "Insert" button inserts the sig at the very beginning of the message. This would be fine if the user clicked the button before beginning to compose. But if the user types in their message, and then clicks the button, the sig is inserted at the top, above the message the user just typed.

I strongly suspect that your average email user is going to expect that the "insert" button would insert the sig at the cursor position within the text editor box. And in hind sight, that probably isn't possible, as the insert routine needs to grab the contents of the text editor, add the sig and then reload it. (Or so it would seem to me.) If that truly is the case, I fear the "insert" button will cause confusion and frustration for normal users, and might be best abandoned.
Title: Plugin for sig-above-reply option?
Post by: ABerglund on October 19, 2009, 10:29:49 PM
Used this patched version all day today, with nothing new to add from the previous comment. Other than the above noted behavior of the "Insert sig" button, I'm pretty pleased with how it works. And the rest of the options work well enough that the "Insert Sig" probably isn't needed anyway. Nice job!
Title: Plugin for sig-above-reply option?
Post by: epinter on October 22, 2009, 08:10:07 AM
Look my patch, is available at:
#1484272 (Signature above original message on reply) ? Roundcube Webmail (http://trac.roundcube.net/ticket/1484272)
Title: Plugin for sig-above-reply option?
Post by: ABerglund on October 27, 2009, 07:16:13 PM
Well, a few of my team and myself have been using the first patch (the one that includes the Insert Sig button) in 3031 extensively since my original post. I do now believe that the Insert Sig button is not needed and probably confusing to average users. But we're very happy with how the top-post/bottom-post choices work in this patch.

From a backend perspective, I prefer solutions that do not require DB schema changes from the default, so I have not tested the other patch listed. That said, if it was incorporated into the release and the DB update became part of the default schema, that's OK too. I just don't want any patches or plugins that require my DB to be non-standard.
Title: Plugin for sig-above-reply option?
Post by: epinter on October 29, 2009, 06:26:33 AM
I agree.

I'm testing internally before publish for my users (I'm a ISP). I'm waiting this patch or any other that provide the top-posting option to become official ... Many users are asking me.

I sent an email to Thomas, asking the possibility to become official. I don't have an answer yet.

If you want to test, the database change it's just 1 field added in identities table.

Quote from: ABerglund;22568
Well, a few of my team and myself have been using the first patch (the one that includes the Insert Sig button) in 3031 extensively since my original post. I do now believe that the Insert Sig button is not needed and probably confusing to average users. But we're very happy with how the top-post/bottom-post choices work in this patch.

From a backend perspective, I prefer solutions that do not require DB schema changes from the default, so I have not tested the other patch listed. That said, if it was incorporated into the release and the DB update became part of the default schema, that's OK too. I just don't want any patches or plugins that require my DB to be non-standard.
Title: Plugin for sig-above-reply option?
Post by: epinter on October 29, 2009, 01:52:42 PM
Another version of my patch, this without database change, option per user, not per identity.

#1484272 (Signature above original message on reply) ? Roundcube Webmail (http://trac.roundcube.net/ticket/1484272#comment:27)
Title: Plugin for sig-above-reply option?
Post by: ABerglund on October 29, 2009, 04:21:08 PM
Quote from: epinter;22605
Another version of my patch, this without database change, option per user, not per identity.

#1484272 (Signature above original message on reply) ? Roundcube Webmail (http://trac.roundcube.net/ticket/1484272#comment:27)
This patch failed to install on 3078, failed on the last file. User Prefs are then broken.
Title: Plugin for sig-above-reply option?
Post by: epinter on October 29, 2009, 06:52:20 PM
#1484272 (Signature above original message on reply) ? Roundcube Webmail (http://trac.roundcube.net/ticket/1484272#comment:31)

Quote from: ABerglund;22608
This patch failed to install on 3078, failed on the last file. User Prefs are then broken.
Title: Plugin for sig-above-reply option?
Post by: ABerglund on October 30, 2009, 11:28:18 AM
Still no joy with the later patch and a fresh copy of 3078. I may need to build a separate box to test this.
Title: Plugin for sig-above-reply option?
Post by: epinter on October 30, 2009, 01:13:13 PM
I made the r3078 just after a svn checkout... Look at .rej files to see the rejected lines ...

Quote from: ABerglund;22624
Still no joy with the later patch and a fresh copy of 3078. I may need to build a separate box to test this.
Title: Plugin for sig-above-reply option?
Post by: ABerglund on October 30, 2009, 01:16:54 PM
There were no rejected lines the second time, all loaded fine. But it the Preferences were still all blank after patching.

I was building this as a second instance on my main RC box, may have something to do with it. When I get some time I'll throw a new VM together and try it there.
Title: Plugin for sig-above-reply option?
Post by: epinter on October 30, 2009, 07:19:07 PM
The option is added in Composition options ... Only en_US and pt_BR translations ...
I will test de patch one more time ...
Quote from: ABerglund;22630
There were no rejected lines the second time, all loaded fine. But it the Preferences were still all blank after patching.

I was building this as a second instance on my main RC box, may have something to do with it. When I get some time I'll throw a new VM together and try it there.
Title: Plugin for sig-above-reply option?
Post by: ABerglund on October 30, 2009, 07:43:21 PM
OK, I built a new virtual machine and installed a totally new DB and installed 3079 on it. This one I was able to patch, and it appears to work fine. The only bug I see on this one is that the signature uses the '--' separator which will cause problems with replies to top-post replies. The patch should not insert the separator when top-posting.
Title: Plugin for sig-above-reply option?
Post by: ABerglund on October 31, 2009, 06:25:49 PM
Do we think that either of the non-db changing patches will work on 0.3.1-Stable, now that it has been released?
Title: Plugin for sig-above-reply option?
Post by: ABerglund on October 31, 2009, 11:55:55 PM
Quote from: epinter;22611
#1484272 (Signature above original message on reply) ? Roundcube Webmail (http://trac.roundcube.net/ticket/1484272#comment:31)
This patch works on 0.3.1-Stable if you use the uncompressed app.js.src in place of the compresses app.js prior to patching.

One last change needed is to remove the '--' signature separator. I did that manually on mine. If possible, perhaps the '--' could be used when bottom-posting, but not when top-posting?
Title: Plugin for sig-above-reply option?
Post by: JohnDoh on November 08, 2009, 05:28:19 AM
the patch has now been applied to the svn trunk. please try it.
Title: Plugin for sig-above-reply option?
Post by: axelsj on November 08, 2009, 06:12:57 PM
Tested from latest trunk and seems to work great!

I prefer to bottom-post/quote correct on my personal mail, but have been waiting for this feature so we can switch to Roundcube at work... An option to remove the "-- " separator would be great. Maybe as a per-identity setting?
Title: Plugin for sig-above-reply option?
Post by: ABerglund on November 08, 2009, 08:49:59 PM
I'd recommend that the "-- " continue when bottom-posting, but be removed when top-posting.

But that's actually very niggly to me, I can hunt down the "-- " and remove it if necessary.
Title: Plugin for sig-above-reply option?
Post by: atjensen11 on November 13, 2009, 09:34:11 PM
I had just posted a topic in the forum for 0.3 prior to finding this thread.  I was asking if it was possible to configure an option to top/bottom post through the existing setup.

I have a stable version of 0.3.1 installed.  Can someone document for me  the steps required in order to apply this patch?

I have a lot of experience with plugins and patches on Squirrelmail.  But I am looking at moving to Roundcube in the very near future and this is one feature my users are going to demand.
Title: Plugin for sig-above-reply option?
Post by: ABerglund on November 13, 2009, 09:59:02 PM
The second patch found here (http://trac.roundcube.net/ticket/1484272#comment:31) can be applied to 0.3.1-stable, if you use the non-optimized app.js. In Linux, do the following:

1.) Backup the optimized program/js/app.js file.
Code: [Select]
$ mv app.js app.js-dist
$ cp -p app.js.src app.js

2.) Then apply the patch. I found that the file paths in the patch are goofy, so you'll need to manually enter the correct path as the files are patched.
Code: [Select]
$ patch -bi
3.) Last, edit the app.js to either remove the '-- ' signature separator or change it to something else. Leaving that separator in place will cause your top-posting users no end of grief.

Or you can take the simpler way - the patch has been incorporated into SVN release r3087 and later, and will be included in the next stable release. Although when I looked at the current SVN (3107) I noticed the '-- ' separator was still in place and will need fixing. I think I'll try to submit a bug report on that. That needs to be handled before it reaches general release.
Title: Plugin for sig-above-reply option?
Post by: atjensen11 on November 13, 2009, 10:41:50 PM
There are two patches listed at the link you provided.  They are:

top_posting_per_user.patch
top_posting_per_user_r3078.patch

Which patch is the one you state as being compatible with my 0.3.1 stable release?
Title: Plugin for sig-above-reply option?
Post by: ABerglund on November 13, 2009, 11:19:54 PM
The second one - the r3078.patch