GithubHelp home page GithubHelp logo

realraven2000 / smarttemplates Goto Github PK

View Code? Open in Web Editor NEW
25.0 25.0 15.0 29.46 MB

Thunderbird Add-on: SmartTemplates

Home Page: http://smarttemplates.quickfolders.org/

License: Other

Batchfile 0.04% HTML 8.14% JavaScript 86.51% CSS 5.27% Shell 0.03%

smarttemplates's People

Contributors

cai0407 avatar hauber avatar jobisoft avatar opto avatar realraven2000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

smarttemplates's Issues

Support [[optional brackets]] syntax for all extended address book data

We want to be able to make optional sections, similar to the %identity(addressbook)% functionality, so that it is possible to not display a line with label + data, if the data cannot be retrieved. This should support data from all additional strings supported since #25.

Example:

<h3>Sender Info</h3>
[[Mail: %from(mail)% <br>]]
[[First Name: %from(firstname)% <br>]]
[[Name: %from(name)% <br>]]
[[Additional mail: %from(additionalmail)% <br>]]
[[Work City: %from(work.city)%<br>]]
[[Web Page: %from(work.webpage)%<br>]]
[[Private City: %from(private.city)%<br>]]
[[Private Page: %from(private.webpage)%<br>]]

Any line that doesn't retrieve data and is wrapped in [[ double square brackets ]] should be omitted.

Thunderbird 60: Mixed Stationery / SmartTemplate menu popups do not work

In a configuration where both Stationery templates and SmartTemplate external templates are configured within a dropdown menu, the templates from SmartTemplate do not trigger the composer window.
Instead, if the debug switch for fileTemplates is active, there is a message in error console:

+======++++++======++++++======+\nNo click event fired for button id=...

Support using %file( )% to construct fragments with relative paths

In order to build portable, more complex templates the %file( )% variable should support 2 new functionalities:

  • relative addressing of image and html files: Instead of always having to enter the full path, a relative path such as %file(img/footer.png)% should be allowed.
  • support recursion: this way of addressing should also be supported with %file( )% variables contained in other files loaded via %file( )% or from the templates selection menus on the write / reply / forward buttons.

Add functions to remove text / tags from quoted parts

The functions %replaceText% and %deleteText% only work in the template and quote header, but not in the quoted email when replying. We need some functions to remove (or replace) text / html from quoted material.

I think it is also important to specify a minimum quote level starting with
0 = all quoted material
1 = work from the first email replied to and all contained quotes
2 = work from the "quoted quote" and all sub quotes
3 = work from the 3rd quote level onwards...
etc,

This way it could be used to remove images from older emails in a thread to conserve disk (and server) space.

Proposal for 4 new functions:

%deleteQuotedText(searchText,quoteLevel)%
%replaceQuotedText(searchText,replacementHTML,quoteLevel)%
%deleteQuotedTags(cssSelector,quoteLevel)%
%replaceQuotedTags(cssSelector,replacementHTML,quoteLevel)%

Examples:

1 - replace all images containing attribute moz-do-not-send=false from 2nd quote level onwards and replace with [SNIPPED]

%replaceQuotedTags("img[moz-do-not-send=false]","[SNIPPED]",2)%

2 - remove the sentence "Message received from external source." from quotes:

%deleteQuotedText("Message received from external source.",1)%

%X:=timezone()% modifier not working as expected

The time stamps in email headers always use "universal" time, e.g.

Date: Wed, 7 Aug 2019 16:58:51 +0200

The time here is the local (server) system time and the offset is the system's offset to UTC (==GMT). So in this example, the UTC time would be 14:58:51, which is what would be expected when using

%X:=timezone(UTC)%

In this case, %date_tz% should also output "0000" and %tz_name% should print "UTC".

It doesn't do that currently, though. I haven't figured out what calculation it uses, but I believe it has something to do with the client computer's time zone.

This is how it should work IMO:

  • If there is no %X:=timezone()% modifier, default to %X:=timezone(<local client time zone>)%, %date_tz% its UTC offset and %tz_name%=<local client time zone>
  • Calculate UTC from the time stamp in email header if possible. If that is not possible, assume TB got it right and substract local client time zone UTC offset to get "assumed UTC"
  • If there is a %X:=timezone()% modifier, set %date_tz% and %tz_name% accordingly. Add this time zone's UTC offset to the previously calculated UTC time.

With this, the time will always be correct no matter in which time zone the user wants to output it.

Function to remove regular patterns from Subject

We need a function to remove patterns such as "Re: Fwd: [AW:] " etc. from the subject line. the ordinary %header.set%, %header.prefix% and %header.append% functions are not suitable. Since this is generally mainly useful for subject lines a dedicated function will be in order.

Syntax:

%header.deleteFromSubject(pattern)%

The patter should be wrapped in double quotes " ".
Example

%header.deleteFromSubject("([\[\(] *)?(Re|Fwd|AW?)*([-:;)\]][ :;\])-]*)|\]+")%

this will remove unwanted prefixes from the subject line

Feature request: Insert external HTML Templates from a web page URL

We need the ability to add external Templates from an URL something like http(s)://www.mydomain.com/mytemplate.* (such as .htm, .html or .php).
This we need for all cases means write, reply and forward.
The HTML Template should have to contain the complete html Markup with complete Meta Tags, it's not same than the current template system.

No file template menus in single message window

When opening a message in a single message window, the write / reply buttons have no file template submenus. These buttons should have the same dropdowns as a message in a tab to enable using html templates for replying..

in some cases, images in signature trigger the "blocked file" warning

When using file templates while a signature is defined, an image containing a local file source:

<img src="file:/// ...">

...will trigger the warning / notification about blocked content. Since this is a local file we should not have to unblock it.

image

The problem can be worked around by using a %file( )% link in the signature instead.

Single Message window header buttons missing file template dropdowns

This happens when Thunderbird starts up without any single message window open. Once a message is double-clicked in a single message tab, the buttons in the header area are missing the dropdown menus.

Known workaround: have a single message open when shutting down / restarting Thunderbird.

Images with encoded file URLs are not loaded correctly

If an image has encoded characters in its patch, such as:

<img src="file:///C%3A%5CUsers%5CJohn%5Cimg%5Cimg3.png">

it will not be inserted properly. Instead SmartTemplate⁴ will assume that %3A% represents an unknown header variable and will do replacements leading to the image not functioning poperly.

%from(lastname)% uses first name of AB if sender address has only 1 name part

With the feature "resolve name from address book" enabled, and if a match is found, the variable switch (lastname) can falsely retrieve the display name or first name instead. It happens when the name in the email address is only a single fied, such as [email protected].

In this case if the AB matches a contact with the following card detail:

first: John
last: Smith
display: Joe
email: [email protected]

Dear Mr. %from(lastname)%

becomes:

Dear Mr. John

Headers duplicated with Virtual Identity

When using SmartTemplate4 along with Virtual Identity, the reply headers generated by SmartTemplate4 are duplicated.

I've been having this issue for many years already but could not figure out the relationship with Virtual Identity.

I also reported the issue in the Virtual Identity repo since I cannot figure out the responsability:
absorb-it/Virtual-Identity#21

Versions:
Thunderbird: 60.7.0
Virtual Identity: 0.10.3 (2018-09-28)
SmartTemplate4 2.0 (2018-12-28)

Smart-reply button: html template menus missing or not working

When using the "smart reply" button on a Thunderbird Installation (without COmpact Header installed) then the file templates menu is missing or may not work:

image

Instead, SmartTemplate4 should append 2 versions of the menu, as popups branching from the Reply and Reply All menu items.

Incorrect information (license, payment?) on addons.thunderbird.net

According to commit history, the addon license was changed from GPL3 to CC BY-ND 4.0 in version 1.5.

Currently (with version 2.2.2), the addon is still listed as licensed under GPL3. (I do not mean in the addon / version description, I mean in the addon metadata that causes the description page to include "Released under GNU General Public License, version 3.0" in the right-side column.) Please correct this.

In fact, except for 2.0, every version since (and including) 1.5 has been listed as GPL3 (again, in the addon metadata). It would be good if these past versions can be corrected as well (if possible).

Add variable for activating specific spellcheck languages

We need a way of switching the current language in a template. At the moment I have to do this manually with my German templates by right-clicking the email text and then selecting languages / German
image

A combined variable of the following format would be good:

%spellcheck(language[,toggle])%

With language being the locale (e.g. en, en-uk, de, es, fr, ru etc.) and toggle (optional parameter) being either on or off to change the automatic spellcheck option shown in the menu above.

Example:

%spellcheck(de,on)%

QF 4.16 doesn't validate if no default identity is defined

If an account has no default identity it should log this in the Javascript error console. Instead the validation fails silently and the following error is shown:

Error in QuickFolders.Options.decryptLicense():

logDebug is not defined  quickfolders-register.js:552

%identity% - add feature to load additional information from addressbook

%identity% should be extended to retrieve addressbook info for additional detail, in the same manner as the other address variables (%to%, %from%, %cc% etc). This can be useful for adding address and contact information based on current identity at the bottom of the email. The entry should be resolved via the email address of the identity. To switch on this behavior, use the parameter "addressbook", followed by the desired addressbook fields, e.g.:

%identity(addressbook,name,workphone,work.department)%

Support File Templates - to replace Stationery from Thunderbird 68 forward

SmartTemplate⁴ needs to support external HTML files in a similar fashion as is currently supported via the Stationery Add-on. This means I need to build UI for managing external file lists for write, reply and forward and integrate them with the appropriate buttons (dropdowns like in Stationery would be ideal, as they only require a single click to be activated)

SmartTemplates should switch BCC on account change in composer as configured in TB

Hi, I use several accounts in TB and in the settings of each accounts I have a special Bcc email preconfigured for backup purposes (standard accounts settings as they come with TB (in my localized version of TB this item is called "Copise and folders", it is the second subitem in the list under each account). Before I installed ST as well as now with ST disabled, it behaves as it should - in compose window when I change the account that I will be using for sending the message, the Bcc field updates to the correct address preconfigured for the particular account. With ST enabled it des not update anymore so after I change account the Bcc is wrong.

The same happens to my addon "Copy Sent to Current" that I use. Normally on account change the default folder for saving the message copy changes accordingly. With ST enabled it does not change as it should.

Thanks for helping

Replying to a replied-to email removes previously replied text

Often, I follow-up on emails that I have previously answered and if there hasn't been another reply from the contact in the meantime I use my own reply for the follow-up so that my previous answer is kept. For that, I use "Reply" or "Reply-all" on my last sent email.

With ST4 enabled, in most cases this will completely remove the text I added to my previous reply, so in the email I see the original email from the contact, my added header from my previous response but not the previous signature and also not the previous text. I can understand that the signature is removed (even that should be an option, though), but my previous text is essential and must not be silently removed (well, the removal is silent, my reaction is not! ;-)). In this example, the highlighted space marks where the previous text and signature was removed:

image

This happens often, but not always and I haven't figured out the mechanics behind it. Nothing terribly complicated or advanced in my settings for the affected accounts either, e.g.:

image

It doesn't happen if I keep the shift key pressed to generate a plain-text reply email, but this is usually not an option.

Settings dialog broken in Czech version

Apparently, this issue exists since version 2.4 but was only found today by a user who tried to license his version of SmartTemplate⁴

This is ultimately caused by a bug in babelzilla.org which replaces HTML encoded entities such as &gt; and &lt; with the actual characters on import, leading to unparseable language resources. I had addressed this by moving all strings with HTML entities to separate files settings-html.dtd, but when merging changes from Babelzilla sometimes the Czech locale gets accidentally overwritten.

Reply button loses template menu items

According to 2 users, they sometimes do not get the templates displayed that they configured for the reply menu and they have to be forced to be rebuilt by opening the SmartTemplate4 settings dialog.

So far I haven't found the reason for this or was able to reproduce it.
To gain additional messages from the JS Error console, go to ST4 advanced settings and enabled Debug mode. Also right-click and enable this additional option:

image

extensions.smartTemplate4.debug.fileTemplates = true

file Templates: <head> section is merged into <body>

When a file template is opened via the new menu, all items in the <head> section are moved to the <body> of the new email, it would be better if anything in <head> could be merged into the <head> of the mail.

Losing all text in compose window when changing identity / signature not updated

I have a secondary, non-default identity for an email account that I have defined a signature for in TB account settings. Since signatures are different, I use %sig% in ST4 template, e.g. in the "Reply" settings.
In TB, when I do a "Reply" for an email, it first comes up with the default-identity signature which is fine. In the "From" field, I now switch to the secondary identity which causes the signature to change accordingly, so at first glance it appears correct. However, any changes I do to the signature in TB account settings are not applied, not even after a restart, it always stays the same. ST4 seems to have captured this signature once for the %sig% variable, but not updated it after.

Add "Smart Snippets": smart fragments that can be inserted from Composer.

This was first suggested in a comment on #24 (changing the template from composer). The commenter @GrantHorizons references the (now defunct) quicktext Add-on, which seems to have added toolbar items with menus. I haven't used it personally so I am not to sure about this UI.

I have 248 templates in QT, and in around 21 categories - which makes for a busy toolbar row of dropdowns! MANY are only used rarely, but they're long so it's useful to have them pre-done. I use maybe 20-30 daily.
SmartTemplate with it's more advanced functionality and active support would be an ideal candidate to implement QT into.
I'd want the "shortcut keys" of QT too, as I know that saves a LOT of time. Depending on what I want to insert, a single keystroke/tab inserts any of 36 templates instantly. Nice!
From there, a drop-down menu to choose from, with sub-menus, would be great. If that menu could also be activated optionally by a %menu% for example built in to a template, that would be nice, although it's important to be able to insert a template anytime anywhere. I often use different signatures depending on who, subject, status etc of the subject.

For the moment let's only put down the requirements, without specifying the exact UI:

  • support selecting html / text snippets, these can be stored as separate files
  • make sure they are resolved (any contained SmartTemplate4 variables will be converted immediately) and inserted at the current cursor position in composer
  • somehow manage snippets so that many different ones (more than 100) can be easily added without overwhelming the user.

Note: the current file template management UI is a little lacking as you can only add single files, it would be better if that could add multiple files or support drop and drag. It may not be a good idea to use the current paradigm (account dropdown) for managing smart snippets.

%dateformat% doesn't show leading zeros

Das alte %dateshort% hatte folgendes Format:
z.B. 01.01.2019 01:01:01 (Sekunden bin ich unsicher)
auch lt. Beschreibung:
%dateshort% = Kurzformat Datum und Zeit (z.B. 01.01.2000 1:23:45)

wobei hier in der Beschreibung die führende Null bei den Stunden fehlt.

Aktuell liefert %dateshort%
für das Datum kurze Zahlen, also ohne führende Nullen und zwischen Tag und Zeit ist ein Komma, Sekunden sind entfallen
z.B. 4.7.2019, 09:03

Request: Tag und Monat wieder mit führende Nullen; der Entfall der Sekunden ist begrüßenswert

Ein Workaround wäre %d%.%m%.%Y% %H%:%M% allerdings müsste das mehrfach an einigen Rechnern geändert werden

SmartTemplate 2.1 problems with determining current language of Thunderbird

This is probably related to issue #3 - this can be seen in the error console as:
getLocale() returns: undefined

the function getLocalePref()_ used to call nsILocaleService.getAppLocaleAsLangTag() which is deprecated. It was changed to nsILocaleService.requestedLocale which is wrong and should be locale.getRequestedLocale().

Also matching the requested locale (e.g. "de-DE") may not correctly match with the identifiers of the languages supported by SmartTemplate (e.g. "de"). The matching algorithm needs to be improved.

Add Support for Cardbook

I'm using CardBook extension as the default TB Address book is very limited - but there seems to be no way to get SmartTemplate4 to use CardBook. A "Which Address book to use?" question would be useful! And which address book IN Cardbook too.
thanks!

If a file starts with UTF detection character "missing file" is wrongly displayed

In some cases, when opening a HTML template, ST4 wrongly displays the message "could not load the file template 'name' from path: ... The file may have been removed or renamed."

This is caused by a missing variable "Stationery" during charset detection and triggered by the following conditions:

if (bom.charCodeAt(0) == 239 && bom.charCodeAt(1) == 187 && bom.charCodeAt(2) == 191) bomCharset = 'UTF-8'; //UTF-8 BOM
if (bom.charCodeAt(0) == 255 && bom.charCodeAt(1) == 254) bomCharset = 'UTF-16LE';  //UTF-16 LE BOM
if (bom.charCodeAt(0) == 254 && bom.charCodeAt(1) == 255) bomCharset = 'UTF-16BE';  //UTF-16 BE BOM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.