+2014-06-23 Carl Hetherington <cth@carlh.net>
+
+ * Add option to CC a KDM email, and add
+ $SCREENS and $CINEMA_NAME as variables
+ in the email.
+
2014-06-22 Carl Hetherington <cth@carlh.net>
* Reset-to-default button for KDM email text.
_mail_user = f.optional_string_child("MailUser").get_value_or ("");
_mail_password = f.optional_string_child("MailPassword").get_value_or ("");
_kdm_from = f.string_child ("KDMFrom");
+ _kdm_cc = f.optional_string_child ("KDMCC").get_value_or ("");
_kdm_email = f.string_child ("KDMEmail");
_check_for_updates = f.optional_bool_child("CheckForUpdates").get_value_or (false);
root->add_child("MailUser")->add_child_text (_mail_user);
root->add_child("MailPassword")->add_child_text (_mail_password);
root->add_child("KDMFrom")->add_child_text (_kdm_from);
+ root->add_child("KDMCC")->add_child_text (_kdm_cc);
root->add_child("KDMEmail")->add_child_text (_kdm_email);
root->add_child("CheckForUpdates")->add_child_text (_check_for_updates ? "1" : "0");
_kdm_email = _(
"Dear Projectionist\n\n"
"Please find attached KDMs for $CPL_NAME.\n\n"
+ "Cinema: $CINEMA_NAME\n"
+ "Screen(s): $SCREENS\n\n"
"The KDMs are valid from $START_TIME until $END_TIME.\n\n"
"Best regards,\nDCP-o-matic"
);
return _kdm_from;
}
+ std::string kdm_cc () const {
+ return _kdm_cc;
+ }
+
std::string kdm_email () const {
return _kdm_email;
}
changed ();
}
+ void set_kdm_cc (std::string f) {
+ _kdm_cc = f;
+ changed ();
+ }
+
void set_kdm_email (std::string e) {
_kdm_email = e;
changed ();
std::string _mail_user;
std::string _mail_password;
std::string _kdm_from;
+ std::string _kdm_cc;
std::string _kdm_email;
/** true to check for updates on startup */
bool _check_for_updates;
using std::list;
using std::string;
using std::stringstream;
+using std::cout;
using boost::shared_ptr;
struct ScreenKDM
quickmail_initialize ();
quickmail mail = quickmail_create (Config::instance()->kdm_from().c_str(), "KDM delivery");
quickmail_add_to (mail, i->cinema->email.c_str ());
-
+ if (!Config::instance()->kdm_cc().empty ()) {
+ quickmail_add_cc (mail, Config::instance()->kdm_cc().c_str ());
+ }
string body = Config::instance()->kdm_email().c_str();
boost::algorithm::replace_all (body, "$CPL_NAME", film->dcp_name ());
stringstream start;
stringstream end;
end << to.date() << " " << to.time_of_day();
boost::algorithm::replace_all (body, "$END_TIME", end.str ());
+ boost::algorithm::replace_all (body, "$CINEMA_NAME", i->cinema->name);
+ stringstream screens;
+ for (list<ScreenKDM>::const_iterator j = i->screen_kdms.begin(); j != i->screen_kdms.end(); ++j) {
+ screens << j->screen->name << ", ";
+ }
+ boost::algorithm::replace_all (body, "$SCREENS", screens.str().substr (0, screens.str().length() - 2));
quickmail_set_body (mail, body.c_str());
quickmail_add_attachment_file (mail, zip_file.string().c_str(), "application/zip");
add_label_to_sizer (table, panel, _("From address"), true);
_kdm_from = new wxTextCtrl (panel, wxID_ANY);
table->Add (_kdm_from, 1, wxEXPAND | wxALL);
+
+ add_label_to_sizer (table, panel, _("CC address"), true);
+ _kdm_cc = new wxTextCtrl (panel, wxID_ANY);
+ table->Add (_kdm_cc, 1, wxEXPAND | wxALL);
_kdm_email = new wxTextCtrl (panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (480, 128), wxTE_MULTILINE);
s->Add (_kdm_email, 1.5, wxEXPAND | wxALL, _border);
_mail_password->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::mail_password_changed, this));
_kdm_from->SetValue (std_to_wx (config->kdm_from ()));
_kdm_from->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::kdm_from_changed, this));
+ _kdm_cc->SetValue (std_to_wx (config->kdm_cc ()));
+ _kdm_cc->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::kdm_cc_changed, this));
_kdm_email->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::kdm_email_changed, this));
_kdm_email->SetValue (wx_to_std (Config::instance()->kdm_email ()));
_reset_kdm_email->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KDMEmailPage::reset_kdm_email, this));
Config::instance()->set_kdm_from (wx_to_std (_kdm_from->GetValue ()));
}
+ void kdm_cc_changed ()
+ {
+ Config::instance()->set_kdm_cc (wx_to_std (_kdm_cc->GetValue ()));
+ }
+
void kdm_email_changed ()
{
Config::instance()->set_kdm_email (wx_to_std (_kdm_email->GetValue ()));
wxTextCtrl* _mail_user;
wxTextCtrl* _mail_password;
wxTextCtrl* _kdm_from;
+ wxTextCtrl* _kdm_cc;
wxTextCtrl* _kdm_email;
wxButton* _reset_kdm_email;
};