AutomaticTextareaAutosave: Difference between revisions
m (2 revisions imported) |
(No difference)
|
Latest revision as of 15:03, 6 April 2016
A number of my colleagues have a 5 button mouse where the 'thumb-button' is mapped to Back. I hear the cries of despair when they accidentally click this after spending 20 minutes working on a ticket ... This adds an automatic autosave to the comment/reply textarea of RT.
You will need a) Windows b) Firefox with the Save Text Area extension - https://addons.mozilla.org/en-US/firefox/addon/1046
- Ensure you have a directory C:\temp - Open a new tab in Firefox, enter about:config in the location bar and edit the following
Name | Value | Purpose |
extensions.savetextarea.autosave-delay | 60 | autosave every 60 seconds (you don’t have to change this, but I think the default 5 minutes is too long) |
extensions.savetextarea.enable-attributes | true | make it so |
|extensions.savetextarea.allow-attributes-from|https://your.rt.com/%7CThe machines to trust. Please read the Save Text Area notes about this setting|
You also need to modify RT:
$ pwd /usr/local/share/request-tracker3.4/html/Elements $ diff -d MessageBox.pre_autosave MessageBox < <textarea class="messagebox" cols="<%$Width%>" rows="<%$Height%>" wrap="<%$Wrap%>" name="<%$Name%>"><& /Element
s/Callback, %ARGS &><% $Default %><%$message%><%$IncludeSignature ? $signature : ''%></textarea>
--- > <textarea class="messagebox" cols="<%$Width%>" rows="<%$Height%>" wrap="<%$Wrap%>" name="<%$Name%>" saveto="c:\
\temp\\RT-<%$uniq_id%>.txt" autosave="yes"><& /Elements/Callback, %ARGS &><% $Default %><%$message%><%$IncludeSig nature ? $signature : ''%></textarea>
50a51,53 > # get a unique number for save file > my $uniq_id = rand(1000000);
Restart apache and away you go.
Whatever text is in the textarea of your comment/reply will be periodically saved according to the value you gave for autosave-delay. It is saved in a file with a name something like C:\temp\RT-118630.87127836.txt. Change the saveto parameter in MessageBox to call it something else, or save it somewhere else.
If you’ve just lost your work:
- Start->Run and enter c:\temp - sort the directory display by Date Modified - find the newest RT-* file - in RT, open the ticket you were working on - click Comment or Reply - press Ctrl + Shift + L (or right-click and select Text->Load) and select the file you picked in 3 above - voila! you shouldn’t have lost more than a minute’s work.
There is no mechanism to clear out old files; depending on the number and size of comments/replies you make, you should remove old C:\temp\RT-* files periodically.