Skip to content
Permalink
Browse files

Mail: Add PC message template, change name of selector.

  • Loading branch information...
kohler committed Sep 26, 2019
1 parent d0e4e10 commit 93c7810fb58bde352af3690c2fb7312b3635cec0
Showing with 33 additions and 14 deletions.
  1. +13 −0 etc/mailtemplates.json
  2. +18 −12 mail.php
  3. +1 −1 src/listactions/la_mail.php
  4. +1 −1 src/mailclasses.php
@@ -441,6 +441,19 @@
"%SIGNATURE%\n"
]
},
{
"name": "pc",
"title": "Message to PC",
"allow_pc": true,
"position": 1,
"default_recipients": "pc",
"subject": "[%CONFSHORTNAME%] Message",
"body": [
"Dear program committee,\n\n",
"Your message here.\n\n",
"%SIGNATURE%\n"
]
},

{
"name": "newpcrev",
@@ -8,16 +8,22 @@
if (!$Me->is_manager() && !$Me->isPC) {
$Me->escape();
}
if (isset($Qreq->recipients) && !isset($Qreq->to)) {
$Qreq->to = $Qreq->recipients;
}
// load mail from log
if (isset($Qreq->fromlog) && ctype_digit($Qreq->fromlog)
if (isset($Qreq->fromlog)
&& ctype_digit($Qreq->fromlog)
&& $Me->privChair) {
$result = $Conf->qe_raw("select * from MailLog where mailId=" . $Qreq->fromlog);
if (($row = edb_orow($result))) {
foreach (["recipients", "q", "t", "cc", "replyto", "subject", "emailBody"] as $field) {
if (isset($row->$field) && !isset($Qreq[$field]))
$Qreq[$field] = $row->$field;
}
if (isset($row->recipients) && !isset($Qreq->to))
$Qreq->to = $row->recipients;
if ($row->q)
$Qreq["plimit"] = 1;
}
@@ -115,8 +121,8 @@
&& !isset($template["allow_template"]))
|| (isset($template["allow_template"]) && $template["allow_template"] === false))
$template = (array) $Conf->mail_template("generic");
if (!isset($Qreq->recipients) || $Qreq->loadtmpl != -1)
$Qreq->recipients = get($template, "default_recipients", "s");
if (!isset($Qreq->to) || $Qreq->loadtmpl != -1)
$Qreq->to = get($template, "default_recipients", "s");
if (isset($template["default_search_type"]))
$Qreq->t = $template["default_search_type"];
$Qreq->subject = $null_mailer->expand($template["subject"]);
@@ -139,8 +145,7 @@
// Set recipients list, now that template is loaded
$recip = new MailRecipients($Me, $Qreq->recipients, $papersel,
$Qreq->newrev_since);
$recip = new MailRecipients($Me, $Qreq->to, $papersel, $Qreq->newrev_since);
// warn if no papers match
if (isset($papersel)
@@ -181,7 +186,7 @@ function __construct(Contact $user, $recip, $phase, Qrequest $qreq) {
$this->sending = $phase === 2;
$this->qreq = $qreq;
$this->group = $qreq->group || !$qreq->ungroup;
$this->recipients = (string) $qreq->recipients;
$this->recipients = (string) $qreq->to;
}
static function check($user, $recip, $qreq) {
@@ -194,7 +199,7 @@ static function send1($user, $recip, $qreq) {
$result = $user->conf->qe("insert into MailLog set
recipients=?, cc=?, replyto=?, subject=?, emailBody=?, q=?, t=?,
fromNonChair=?, status=-1",
(string) $qreq->recipients, $qreq->cc, $qreq->replyto,
(string) $qreq->to, $qreq->cc, $qreq->replyto,
$qreq->subject, $qreq->emailBody, $qreq->q, $qreq->t,
$user->privChair ? 0 : 1);
$ms->echo_request_form(true);
@@ -232,7 +237,7 @@ private function echo_actions($extra_class = "") {
private function echo_request_form($include_cb) {
echo Ht::form($this->conf->hoturl_post("mail"), ["id" => "mailform"]);
foreach (["recipients", "subject", "emailBody", "cc", "replyto", "q", "t", "plimit", "newrev_since"] as $x)
foreach (["to", "subject", "emailBody", "cc", "replyto", "q", "t", "plimit", "newrev_since"] as $x)
if (isset($this->qreq[$x]))
echo Ht::hidden($x, $this->qreq[$x]);
if (!$this->group)
@@ -255,7 +260,7 @@ private function echo_prologue() {
'<div class="fx"><div class="confirm">Sent to:&nbsp;', $this->recip->unparse(),
'<span id="mailinfo"></span></div>',
'<div class="aa">',
Ht::submit("go", "Prepare more mail"),
Ht::submit("again", "Prepare more mail"),
"</div></div>",
// This next is only displayed when Javascript is off
'<div class="fn2 warning">Sending mail. <strong>Do not leave this page until it finishes rendering!</strong></div>',
@@ -528,6 +533,7 @@ private function run() {
if (!$Qreq->loadtmpl
&& !$Qreq->cancel
&& !$Qreq->psearch
&& !$Qreq->again
&& !$recip->error
&& $Qreq->post_ok()) {
if ($Qreq->send && $Qreq->mailid)
@@ -588,7 +594,7 @@ private function run() {
<div class="mail" style="float:left;margin:4px 1em 12px 0"><table id="foldpsel" class="fold8c fold9o fold10c">', "\n";
// ** TO
echo '<tr><td class="mhnp nw"><label for="recipients">To:</label></td><td class="mhdd">',
echo '<tr><td class="mhnp nw"><label for="to">To:</label></td><td class="mhdd">',
$recip->selectors(),
"<div class=\"g\"></div>\n";
@@ -644,8 +650,8 @@ private function run() {
foldup.call(this, null, {f: sopt.hasClass("mail-want-no-papers"), n: 9});
foldup.call(this, null, {f: !sopt.hasClass("mail-want-since"), n: 10});
}
$("#recipients, #plimit").on("change", mail_recipients_fold);
$(function () { $("#recipients").trigger("change"); })');
$("#to, #plimit").on("change", mail_recipients_fold);
$(function () { $("#to").trigger("change"); })');
echo "</td></tr>\n";
@@ -16,6 +16,6 @@ function run(Contact $user, $qreq, $ssel) {
$x = "q=" . urlencode($qreq->q) . "&plimit=1";
else
$x = "p=" . join("+", $ssel->selection());
go(hoturl("mail", $x . "&t=" . urlencode($qreq->t) . "&recipients=$r"));
go($user->conf->hoturl("mail", $x . "&t=" . urlencode($qreq->t) . "&to=$r"));
}
}
@@ -181,7 +181,7 @@ function selectors() {
continue;
$last = $n;
}
return Ht::select("recipients", $sel, $this->type, ["id" => "recipients"]);
return Ht::select("to", $sel, $this->type, ["id" => "to"]);
}
function unparse() {

0 comments on commit 93c7810

Please sign in to comment.
You can’t perform that action at this time.