RoundCube autoresponder plugin
lipiec 6th, 2007Poproszono mnie o “pochwalenie” się pluginem autorespondera. Cóż kiedyś obiecałem więc poniżej i on
Ponieważ RC nie posiada jeszcze zaimplementowanego systemu pluginów wieć nie jest to rozwiazanie docelowe ani ładne ale działa
Najpierw plik index.php
// include task specific files
if ($_task=='settings')
{
include_once('program/steps/settings/func.inc');
+ if ($_action=='autoreply' || $_action=='save-autoreply')
+ include('program/steps/settings/autoreply.inc');
Następny plik to program/steps/settings/func.inc
// register UI objects
$OUTPUT->add_handlers(array(
'userprefs' => 'rcmail_user_prefs_form',
'itentitieslist' => 'rcmail_identities_list',
+ 'autoreply' => 'rcmail_autoreply_form',
Czas na plik program/js/app.js
case 'settings':
- this.enable_command('preferences', 'identities', 'save', 'folders', true);
+ this.enable_command('preferences', 'identities', 'save', 'folders', 'autoreply', true);
+
+ if ( this.env.action=='autoreply' || this.env.action=='save-autoreply' ) {
+ var input_active = rcube_find_object('_active_autoreply');
+ var input_tekst = rcube_find_object('_tekst_autoreply');
+ this.enable_command('save-autoreply', true);
+ }
I w tym samym pliku poniżej:
case 'delete-folder':
if (confirm(this.get_label('deletefolderconfirm')))
this.delete_folder(props);
break;
+
+ case 'autoreply':
+ this.goto_url('autoreply');
+ break;
+
+ case 'save-autoreply':
+ var input_active = rcube_find_object('_active_autoreply');
+ var input_tekst = rcube_find_object('_tekst_autoreply');
+ this.gui_objects.editform.submit();
+ break;
Kolejno należy utworzyć plik program/steps/settings/autoreply.inc
Tutaj mała uwaga ponieważ pojawiła się tajemnicza zmienna $_SESSION['adnet_id']. Jest to zmienna sesyjna przypisywana w funkcji function rcmail_login($user, $pass, $host=NULL) w pliku program/include/main.inc, przechowuje ona unikalny id użytkownika w tableli mail_accounts z wszystkimi ustawieniami, w tym autoodpowiedzi (kolumny autoreplay_set oraz autoreplay_value).
Konieczne jest oczywiscie dodanie wymaganych labeli i komunikatów.
Najpierw plik program/localization/en_US/labels.inc
+$labels['autoreply'] = 'Autoreply';
+$labels['titleautoreply'] = 'Autoreply settings';
+$labels['activeautoreply'] = 'Autoresponder active';
+$labels['textautoreply'] = 'Autoresponder text';
oraz program/localization/en_US/messages.inc
+$messages['autoreplymodified'] = 'Autoresponder settings saved.';
+$messages['noautoreply'] = 'Autoreponder active but no text provided.';
Oczywiscie analogiczne zmiany należy dokonać w innych plikach językowych. Przypominam tylko, że kodowanie tych plików to UTF-8 więc niewskazane jest beztroskie modyfikowanie z poziomu konsoli
Przedostatnim etapem jest stworzenie pliku skins/default/templates/autoreply.html
P.S. Dlaczego nie umieściłem informacji o bazie bezpośrednio w pliku config/db.inc.php? Ponieważ jest to rozwiazanie tymczasowe i jak tylko powstanie API pluginów, moj “plugin” będzie outdated
P.S. 2 Nie biorę odpowiedzialności za ewentualne błędy lub niepoprawe zaimplementowanie
P.S. 3 Wzorowałem się na 72-modification-du-password-email-dans-roundcube i pozdrowienia dla autora
lipiec 13th, 2007 at 12:28 am
Miło, że się podzieliłeś
Sam lada chwila będę musiał się z tym mordować.
Miałem już jedno podejście, ambitnie chciałem
minimalnie ingerując w istniejący kod zbudować
taką podstawę do podpinania wtyczek (API to za
dużo powiedziane), tak żeby przy kolejnych
wersjach z SVN dało się to przy minimalnym
bólu przenieść, ale odpuściłem.
Teraz będę musiał tak czy inaczej dodać parę
funkcji - z tego co masz i ty, z tym że robię
to pod Postfixa.
Co do oficjalnego API to jest to chyba wciąż
cholernie odległa perspektywa, wymaga przepisania
całego podstawowego kodu na nowo, a z tego
co ostatnio widziałem, to jedyne co tam jest,
to draft
Pozdrawiam
lipiec 13th, 2007 at 8:00 am
Wlasnie brak API pluginow jest glowna bolaczka projektu RC i przyczyna stagnacji w rozwoju tegoz.
Wykorzystujac powyzszy “mechanizm” dodalem jeszcze modyfikacje ustawien antyspamowych i obslugi zdalnych kont pop3
P.S. mysle nad zjednoczeniem wszystkich modyfikujacych na wlasne potrzebny w portalu/forum/cos_innego roundcube.pl
Sa chetni ?
lipiec 20th, 2007 at 2:07 pm
Hi guys,
I don’t understand polish but i want to now what i have to change in roundcube database.
Thks Anyway,
Bruno Bandeira
lipiec 21st, 2007 at 11:12 am
Bruno in roundcube database there is nothing to be changed. All changes are made in MTA database (in my case exim). In this database is table with fields such as autoreplay_set and autoreplay_value.
lipiec 21st, 2007 at 5:50 pm
Daniel,
Could you post here your exim database structure sql( no data needed =P), i read your plugin and there is references about roundcube database in autoreply.inc.
Thks
Bruno Bandeira
lipiec 22nd, 2007 at 1:46 pm
Have You read description http://roundcubeforum.net/forum/index.php?topic=1548.0
?
whole mta database is no needed, most important is
UPDATE mail_accounts SET autoreplay_set =\'’ . $active . ‘\’, autoreplay_value =\'’ . $tekst . ‘\’, mod_date=NOW() WHERE id = \'’ . $adnet_id . ‘\'’);
sierpień 26th, 2007 at 7:26 pm
A są jeszcze jakieś pluginy dla roundcuba?
Ja osobiści szukałbym takiego, gdzie to roundcube przenosiłby maile np. z textem w temacie ” Dupa “. Do katalogu ” bla “.
sierpień 27th, 2007 at 7:24 am
filtry mają być w “którejś” z wersji svn
wrzesień 6th, 2007 at 8:43 pm
Excelent information. Best wishes.2
czerwiec 5th, 2008 at 3:41 pm
I know this is an old thread, but can anyone confirm this to work with the current stable roundcube (v 0.1.1)? I am a looking to implement this myself, but I’m having some problems locating all of the files. Specifically, I can’t find:
Thanks in advance for everyone’s help.
http://daniel.blogs.jebiemnieto.org/files/2007/07/rc_autoreplyhowto.txt
and
http://daniel.blogs.jebiemnieto.org/files/2007/07/autoreplyhtml.txt
which seem to be needed to complete the install. The only other thread I could find on this was at:
http://hostmonsterforum.com/archive/index.php/t-3027.html
and they seemed more confused than me. If anyone could help me out, I could write a more complete how-to for the English speaking crowd
czerwiec 5th, 2008 at 3:54 pm
I know this is an old thread, but can anyone confirm this to work with the current stable roundcube (v 0.1.1)? I am a looking to implement this myself, but I’m having some problems locating all of the files. Specifically, I can’t find:
Thanks in advance for everyone’s help.
http://daniel.blogs.jebiemnieto.org/files/2007/07/rc_autoreplyhowto.txt
and
http://daniel.blogs.jebiemnieto.org/files/2007/07/autoreplyhtml.txt
which seem to be needed to complete the install (the links direct me to a blank page). The only other thread I could find on this was at:
http://hostmonsterforum.com/archive/index.php/t-3027.html
and they seemed more confused than me. If anyone could help me out, I would write a more complete how-to for the English speaking crowd
czerwiec 16th, 2008 at 3:11 pm
Kurt,
I have the same issue. Kind of. Have you got this working? I have a no text supplied issue when trying to save the responder???
lipiec 24th, 2008 at 1:53 pm
Witam, próbuje uruchomic tego autorespondera na RC, jednak coś jest nie tak
Niby w ustawieniach pokazuje mi się opcja autoreapy, jednak po kliknięciu na nią pojawia mi się okno preferencje (ta sama zawartość co w oknie preferencje)
Co mogłem zrobić źle ?
Lopez
lipiec 24th, 2008 at 2:16 pm
obstawiałbym na pominiecie bądź literówkę w punktcie 3 lub 4
3. edit file program/js/app.js, search for “case ’settings’:”
change line
this.enable_command(’preferences’, ‘identities’, ’save’, ‘folders’, true);
to
this.enable_command(’preferences’, ‘identities’, ’save’, ‘folders’, ‘autoreply’, true);
and just below add the following:
if ( this.env.action==’autoreply’ || this.env.action==’save-autoreply’ ) {
var input_active = rcube_find_object(’_active_autoreply’);
var input_tekst = rcube_find_object(’_tekst_autoreply’);
this.enable_command(’save-autoreply’, true);
}
result like below
(̷
case ’settings’:
this.enable_command(’preferences’, ‘identities’, ’save’, ‘folders’, ‘autoreply’, true);
if ( this.env.action==’autoreply’ || this.env.action==’save-autoreply’ ) {
var input_active = rcube_find_object(’_active_autoreply’);
var input_tekst = rcube_find_object(’_tekst_autoreply’);
this.enable_command(’save-autoreply’, true);
}
w pliku http://daniel.blogs.jebiemnieto.org/files/2007/07/rc_autoreplyhowto.txt
lipiec 24th, 2008 at 3:56 pm
No właśnie już 5 razy wszysko po kolei kopiowłem i sprawdzałem wiec jes ok
lipiec 25th, 2008 at 9:45 am
a plik index.php oraz program/steps/settings/func.inc ?
szczegolnie func.inc ?