[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Poco Forums • View topic - Creating a filter to show inbox by markings

Creating a filter to show inbox by markings

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Creating a filter to show inbox by markings

Postby moleboy » Wed Oct 06, 2004 9:05 pm

Hi,

I would like to be able to sort my inbox so it arranges the email by the markings I have assigned to them.

I currently have markings for "Completed but not billed" and "To Do".

I would like to have my messages displayed as follows in date order with most recent first:

At the top New unread messages
Then To Do
Then Completed but not billed
Finally anything else


Any Ideas?
Thanks
moleboy
Drop-in Visitor
 
Posts: 10
Joined: Tue Sep 28, 2004 2:44 am

Postby Michael » Thu Oct 07, 2004 2:20 am

Unfortunately custom sort orders are not supported in Barca (or Poco). The best you can do at the moment is to leave the messages sorted by date and then to use the show only bar to filter the display so only those messages with a given mark are visible. (You can also use the show only bar to isolate unread messages).

I would certainly support an enhancement request that allowed custom sort orders to be used.
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada

Postby Pete » Fri Oct 08, 2004 9:04 am

As Michael said, I don't think that Barca explicitly supports sorting by two different columns (i.e. by date AND by your other criteria). However, I was playing around with this in PocoMail (perhaps it works the same in Barca) and I noticed that if I sort the Index Pane by a non-date column, then PM sorts by the non-date column first and then by date second. I don't know if this behavior is by design or if it's just because of the fact that the messages are physically sorted by date on the disk drive. If Barca/PM doesn't purposefully sort by date in this situation, you might be able to compress the relevant mailboxes on a regular basis in order to achieve this effect.

Assuming that Barca doesn't have a built-in ability to do exactly what you want to do, you might still be able to achieve your wish if you're willing to put some time and effort into the initial setup. I've never done anything exactly like this, but I would try the following steps if I wanted this behavior myself. Again, I'm basing this on PocoMail, I don't use Barca and thus I don't know if all of this will work the same as it does in PocoMail.

  1. Go to "Tools > Options > Reading Mail" and disable Mark Messages Read After.
  2. Go to "Tools > Options > Marking Messages" and assign the markings in the order that you want to see them sorted in the Index Pane (in your case: Unread, To Do, Completed, and Other). If you don't want the Unread and Other marking to have color in the Index Pane, then make the color match the background color of your Index Pane (ditto for the To Dos and the Completed ones).
  3. Go to "Tools > Options > Index Columns > Column Visibility" and enable Custom1.
  4. Go to "Tools > Options > Index Columns > Column Setup" and add X-Mark to custom column one.
  5. For each mailbox (or for each root level if you use subfolders/submailboxes and you use the "Applies to Submailboxes" setting), right-click and select "Properties" and add the Custom1 column for those mailboxes where you've overridden the default mailbox columns.
  6. Again for each mailbox (or each root level), position the X-Mark column where you want it in the Index Pane. Note that because of a bug, when you finish this step for any given mailbox, you should click on a different mailbox and then click on this mailbox again so that PM/Barca saves your changes.
  7. Click on the X-Mark column heading in the Index Pane so that all messages in all mailboxes will be sorted as you want.
  8. Create an Incoming filter (in "Tools > Filters") that searches From for @ (case-sensitive match) then perform mark message Unread. Position this filter in the filter list so that it only affects the desired messages.
  9. Create PocoScripts (see below).
  10. Add buttons to your toolbar that call the PocoScripts.
Pete
 

Postby Pete » Fri Oct 08, 2004 9:05 am

Off the top of my head, I'm thinking that you'd want four PocoScripts (and thus four toolbar buttons). Of course, you could change this to fit your needs. You would copy and paste each of these to new files (e.g. MarkReadToggle.poc) in the Scripts folder where you installed Barca/PocoMail.

MarkReadToggle.poc (Toggles selected message(s) between Read and Unread status. Update the marking only if it's currently the Read marking or the Unread marking.):
Code: Select all
Set $OnErrorMessage ""
AddStrings $OnErrorMessage "Error in " $pocoScriptName
Set $OnErrorGoTo "POCO_ERROR"

ImportVar $READ_MARK "MarkConstants.txt"
ImportVar $UNREAD_MARK "MarkConstants.txt"

ReadHeader $status "X-Poco-Status:" %message
Char $flag 1 $status
ChopString $status 1 1
ReadHeader $currentMark "X-Mark:" %message
If $currentMark ! "" Then CONTINUE
Set $currentMark "0"

:CONTINUE
If $flag = "R" Then MARK_UNREAD
If $flag = "U" Then MARK_READ
Goto DONE

:MARK_READ
InsertString $status 1 "R"
If $currentMark ! $UNREAD_MARK Then FINISH
MarkMessage %message $READ_MARK
Goto FINISH

:MARK_UNREAD
InsertString $status 1 "U"
If $currentMark ! $READ_MARK Then FINISH
MarkMessage %message $UNREAD_MARK

:FINISH
DeleteHeader "X-Poco-Status:" %message
AddHeader %message "X-Poco-Status:" $status
If #pocoScriptMode ! 5 Then DONE
SaveMessage %message $currentMailbox
DeleteMessage %message

:DONE
Exit

:POCO_ERROR
Exit


MarkToDo.poc (marks selected message(s) as "To Do"):
Code: Select all
Set $OnErrorMessage ""
AddStrings $OnErrorMessage "Error in " $pocoScriptName
Set $OnErrorGoTo "POCO_ERROR"

ImportVar $TODO_MARK "MarkConstants.txt"

ReadHeader $currentMark "X-Mark:" %message
If $currentMark ! "" Then CONTINUE
Set $currentMark "0"

:CONTINUE
If $currentMark = $TODO_MARK Then DONE
MarkMessage %message $TODO_MARK

:DONE
Exit

:POCO_ERROR
Exit


MarkCompleted.poc (marks selected message(s) as "Completed but not Billed"):
Code: Select all
Set $OnErrorMessage ""
AddStrings $OnErrorMessage "Error in " $pocoScriptName
Set $OnErrorGoTo "POCO_ERROR"

ImportVar $COMPLETED_MARK "MarkConstants.txt"

ReadHeader $currentMark "X-Mark:" %message
If $currentMark ! "" Then CONTINUE
Set $currentMark "0"

:CONTINUE
If $currentMark = $COMPLETED_MARK Then DONE
MarkMessage %message $COMPLETED_MARK

:DONE
Exit

:POCO_ERROR
Exit


MarkOther.poc (marks selected message(s) as "Other"):
Code: Select all
Set $OnErrorMessage ""
AddStrings $OnErrorMessage "Error in " $pocoScriptName
Set $OnErrorGoTo "POCO_ERROR"

ImportVar $OTHER_MARK "MarkConstants.txt"

ReadHeader $currentMark "X-Mark:" %message
If $currentMark ! "" Then CONTINUE
Set $currentMark "0"

:CONTINUE
If $currentMark = $OTHER_MARK Then DONE
MarkMessage %message $OTHER_MARK

:DONE
Exit

:POCO_ERROR
Exit


Note that the first script (toggle Read/Unread status) is independent of the other three. That is, you can change the Read/Unread status at any time -- this will not change the marking if the marking is currently To Do, Completed, or Other. This behavior could be changed in many different ways. Examples: (1) marking a message as Unread could clear the To Do, Completed, or Other marking, or (2) marking a message as Read could automatically change the marking to Other, or (3) changing the marking to To Do, Completed, or Other could automatically change the message's status to Read (but not the message's marking). Etc., etc.

For these scripts to work, you also need to copy and paste the following into a text file in your Scripts folder (under your Barca/PocoMail installation by default). You might have to manually remove any spaces at the ends of the lines before you save the file.

MarkConstants.txt
Code: Select all
[UserVars]
str_read_mark=0
str_unread_mark=1
str_todo_mark=2
str_completed_mark=3
str_other_mark=4


The values in this file assume that the first four markings in Barca's options are: Unread, To Do, Completed but not Billed, and Other. If you ever change the order of the markings in Barca's options, then you would need to update MarkConstants.txt.

p.s. I moved this topic to the PocoScript forum.
Pete
 

Postby moleboy » Fri Oct 08, 2004 11:01 am

Hi Pete - many thanks for your comments and suggestions.

As mentioned in another thread I started on the Barca forum re. emulating GMail and Bloomba's unlimited labelling/categorisation ability (entitled "Message marking, annotating & SEARCHING"), I not familiar with PocoScript, although as a developer/programmer it shouldn't take me too long to get up to speed when I have the time to read and digest all the documentation.

If I'm being honest, it would be great to have a complete email/PIM/groupware tool that met all my needs out of the box without having to spend the time learning yet another scripting language :-)

I'll give your suggestions a shot and see what happens. You have been most helpful and your extensive notes are very much appreciated.

Thanks again for your help.
moleboy
Drop-in Visitor
 
Posts: 10
Joined: Tue Sep 28, 2004 2:44 am

Postby Pete » Sat Oct 09, 2004 7:04 am

Yeah, I read that other topic. I noticed that the main problem that Michael mentioned was the lack of an OnRead event, but if you follow the method in this topic (i.e. you only mark messages read when you click the toolbar button), then it seems like you should be able to create something that works for you temporarily, and maybe one day PSI will add some of your suggestions natively as you asked.

Also, if you add headers to the messages as Michael suggested, you could use Barca's "Search Messages" command to find all of them without first manually selecting messages and mailboxes. Of course this isn't perfect either since Barca/PM don't let you save searches -- it would be inconvenient to quickly locate matching messages.
Pete
 


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 2 guests

cron