First Last Prev Next    No search results available
Details
: Variable for attaching [pdf] files
Bug#: 26552
: smarttemplate4
: General
Status: RESOLVED
Resolution: FIXED
: PC
: Windows 7
: unspecified
: P3
: enhancement
: ---

:
:
:
:
:
  Show dependency tree - Show dependency graph
People
Reporter: Scary Goose <bt7411@gmail.com>
Assigned To: Axel Grude <axel.grude@gmail.com>
:

Attachments
1.6 prerelease 73 (500.72 KB, application/x-xpinstall)
2018-06-15 06:18, Axel Grude
no flags Details
1.6 prerelease 75 (477.29 KB, application/x-xpinstall)
2018-06-18 05:54, Axel Grude
no flags Details


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2018-06-04 05:12
Would like to be able to create templates with pdf's attached...like the add-on
QuickText can do.
------- Comment #1 From Axel Grude 2018-06-04 05:39:56 -------
For starters , I guess you want to add the absolute, fixed path to the file
[similar to the %file(...)% function]. 

But I can imagine you might also have a more demanding use case, such as if a
user requests a particular document (name) e.g. via a web request form, it
might be good to have additional functionality (regex matching) extracting the
pdf name from the replied email... Let's leave that for stage 2 but I am
definitely interested in your current use case. 

Can you elaborate a bit more why you would attach the same pdf file to
different people?
------- Comment #2 From Scary Goose 2018-06-04 05:45:25 -------
(In reply to comment #1)
> For starters , I guess you want to add the absolute, fixed path to the file
> [similar to the %file(...)% function]. 
> 
> But I can imagine you might also have a more demanding use case, such as if a
> user requests a particular document (name) e.g. via a web request form, it
> might be good to have additional functionality (regex matching) extracting the
> pdf name from the replied email... Let's leave that for stage 2 but I am
> definitely interested in your current use case. 
> 
> Can you elaborate a bit more why you would attach the same pdf file to
> different people?
> 

Each time someone signs up for a specific course they will be sent a standard
email with relevant attachments.
------- Comment #3 From Axel Grude 2018-06-15 06:16:00 -------
Working on it right now - turns out a lot more difficult than I expected. This
needs to be programmed asynchronously using Task.jsm and OS.File, the file
needs to be checked for existence and queried for filename; content type may
also need to be determined. 

IIn Composer, there is a built in function window.AddAttachments but it expects
and array of nsIMsgAttachment entities, and to make up these we need to do all
the heavy lifting of finding the file and what kind of content; this stuff
needs to be done asynchronously so it is much harder than just plugging in a
location on a hard drive...

expect this implementation to take a while.

Relevant snippets from Thunderbird code base
============================================

https://dxr.mozilla.org/comm-central/source/mail/components/compose/content/MsgComposeCommands.js#2721

https://dxr.mozilla.org/comm-central/source/mailnews/compose/test/unit/head_compose.js#115

File handling from drag&drop:
https://dxr.mozilla.org/comm-central/source/mail/components/compose/content/MsgComposeCommands.js#2508
------- Comment #4 From Axel Grude 2018-06-15 06:18:36 -------
Created an attachment (id=8489) [details]
1.6 prerelease 73

My previous comment was sitting in the browser unsubmitted for one or 2 hours
while I was coding away. Turns out I do not need async for this. Attached is a
first test version.

While I was testing (with a txt file no less) I also found that the %file()%
function does not expand new line characters of text into the much needed <br>
so I fixed this as well quickly.
------- Comment #5 From Axel Grude 2018-06-15 06:26:45 -------
Syntax (at the moment):

%attach(filePath)%

Example:

%attach(D:\Music\John\Long Story\lyrics.txt)%


Notes:
I am using nsIMIMEService for determining the file type, not sure how it will
react to different types of files.
To do: add this to the variable window so the filePath can be more eeasily
added by clicking on the %attach% example there (like %file%).
------- Comment #6 From Scary Goose 2018-06-17 22:17:11 -------
Hi, I just tested 1.6pre73 adding 2 pdf's and it worked.
Well done and thanks.
------- Comment #7 From Óvári 2018-06-18 05:05:57 -------
(In reply to comment #5)
> %attach(D:\Music\John\Long Story\lyrics.txt)%
Does this work for GNU+Linux computers?
------- Comment #8 From Axel Grude 2018-06-18 05:45:58 -------
(In reply to comment #7)
> (In reply to comment #5)
> > %attach(D:\Music\John\Long Story\lyrics.txt)%
> Does this work for GNU+Linux computers?
> 

It should work, I am retrieving the path from a file picker when you click the
%attach% variable on the right hand side of ST⁴ options (variables tab), so
obviously the URL will look different.

Note: The variables tab sure could use a search function.
------- Comment #9 From Axel Grude 2018-06-18 05:54:40 -------
Created an attachment (id=8491) [details]
1.6 prerelease 75

Added the file picker mechanism. Note this test version only has English and
German locales complete. If you need your local language please contribute the
string:

<!ENTITY attach.label "Add file as attachment">

for smartTemplate-settings.dtd

on this bug, or here:
http://adofex.clear.com.ua/projects/p/smarttemplate4/

We can use contributions for the locales:
French
Italian
Japanese
Portuguese (Brazil)
Russian
Slovenian
Spanish (Spain)
Ukrainian
Polish
Serbian
Finnish
Chinese (China)
Dutch
Czech
Swedish (Sweden)
Occitan (post 1500) 
Chinese (Taiwan) 
Turkish
------- Comment #10 From Axel Grude 2019-07-28 07:15:31 -------
Resolved Fixed: Version 2.0 - 23/12/2018

First Last Prev Next    No search results available