Author Topic: folderbuttons plugin  (Read 6894 times)

Offline mmaraghy

  • Jr. Member
  • **
  • Posts: 28
folderbuttons plugin
« on: January 10, 2010, 03:45:14 PM »
I got stuck trying to write this plugin, but I finally got it figured out on my own. The plugin adds expand-all and collapse-all buttons to the folder mailbox controls in mail view (see image). The button images come from the mail_footer.png image included with the default skin so this plugin really only works with that theme.

To use the plugin just upload to the plugins directory and then add 'folderbuttons' to the plugin array in main.inc.php.

English language localization file only - translations welcome.

This is my first plugin, so let me know what you think.
« Last Edit: January 15, 2010, 09:48:23 AM by mmaraghy »

Offline mmaraghy

  • Jr. Member
  • **
  • Posts: 28
need help to add delete folder feature
« Reply #1 on: January 15, 2010, 11:12:12 AM »
I'm trying to add a delete folder button to the folderbuttons plugin that will delete the select folder from the tree. I am having trouble getting the java script to work. Here's what I have now which does not work.

Code: [Select]
function deletefolder (){
$("#mailboxlist li.selected").each( function() {
var el = $(this);
var matches = String($(el).attr('onclick')).match(/.*rcmail.command\(["']delete-folder["'],\s*["']([^"']*)["']\).*/i);
rcmail.delete_folder(matches[1]);
});
}


Any ideas?

Offline ABerglund

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 673
New Plugin Help
« Reply #2 on: January 15, 2010, 03:06:05 PM »
Quote from: mmaraghy;24505
I got stuck trying to write this plugin, but I finally got it figured out on my own. The plugin adds expand-all and collapse-all buttons to the folder mailbox controls in mail view (see image). The button images come from the mail_footer.png image included with the default skin so this plugin really only works with that theme.

To use the plugin just upload to the plugins directory and then add 'folderbuttons' to the plugin array in main.inc.php.

English language localization file only - translations welcome.

This is my first plugin, so let me know what you think.
Just installed this on the latest SVN (3207) and it works and looks great.
Arne Berglund
SysAdmin, Internet Services
Lane Education Service District
Eugene, OR, USA

Offline mmaraghy

  • Jr. Member
  • **
  • Posts: 28
new button images
« Reply #3 on: January 15, 2010, 06:22:22 PM »
Glad you like the plugin.

I created a couple new button images to use with the plugin that follow the default theme a bit better (they have the same rounded corner box as in the default theme). Upload these icons and overwrite the existing ones to switch.

Which button images do you prefer?

Offline ABerglund

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 673
New Plugin Help
« Reply #4 on: January 15, 2010, 07:57:29 PM »
Quote from: mmaraghy;24630
Glad you like the plugin.

I created a couple new button images to use with the plugin that follow the default theme a bit better (they have the same rounded corner box as in the default theme). Upload these icons and overwrite the existing ones to switch.

Which button images do you prefer?
While the new ones are nice looking, I think the original are a bit more intuitive.
Arne Berglund
SysAdmin, Internet Services
Lane Education Service District
Eugene, OR, USA

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Fixes/Enhancements
« Reply #5 on: January 21, 2010, 09:08:24 AM »
#1- Fixed html output (closing img tags were missing -> breaks IE)
#2- Added German localization
#3- Made plugin skinable
#4- I plan to host the plugin along with MyRoundcube plugins bundle

Enjoy
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline mmaraghy

  • Jr. Member
  • **
  • Posts: 28
New Plugin Help
« Reply #6 on: January 21, 2010, 09:47:55 AM »
Quote
#1- Fixed html output (closing img tags were missing -> breaks IE)
#2- Added German localization
#3- Made plugin skinable
#4- I plan to host the plugin along with MyRoundcube plugins bundle


Rosali - Thanks for the fixes and enhancements. I am definitely a newbie and I know my code needed polishing.

Any thoughts on how the java script could work for a delete folder button? I made an image for the button (attached) and its easy enough to add that with the php, but I don't know how to make roundcube check which folder is selected, confirm delete with a message box, and then delete it. See my previous post for where I started with this.

Thanks for including the plugin with your MyRoundcube bundle.

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
New Plugin Help
« Reply #7 on: January 21, 2010, 09:57:33 AM »
Not tested, just an approach:

      rcmail.set_busy(true, 'folderdeleting');
      rcmail.http_post('delete-folder', '_mboxes='+urlencode(rcmail.env.mailbox), true);
      rcmail.set_env('folder', null);
      ... Ajax stuff to renew folder list or a document.location.href / .reload
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline ABerglund

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 673
New Plugin Help
« Reply #8 on: April 16, 2010, 01:27:55 PM »
Sorry, I was going to report an issue with this plugin, but I was using an outdated version. The current version is fine.
« Last Edit: April 16, 2010, 01:37:22 PM by ABerglund »
Arne Berglund
SysAdmin, Internet Services
Lane Education Service District
Eugene, OR, USA