mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 11:50:30 +02:00
More Admin->Mail GUI and functionality fixes.
This commit is contained in:
@@ -146,7 +146,9 @@ class mailout_admin extends e_admin_dispatcher
|
||||
// 'makemail/makemail' => array('caption'=> LAN_MAILOUT_190, 'perm' => 'W', 'url'=>e_SELF),
|
||||
'main/list' => array('caption'=> LAN_MANAGE, 'perm'=> 'W'),
|
||||
'main/create' => array('caption'=> LAN_MAILOUT_190, 'perm' => 'W'),
|
||||
|
||||
'recipients/list' => array('caption'=> "Recipients", 'perm' => 'W'),
|
||||
// 'main/send' => array('caption'=> "Send", 'perm' => 'W'),
|
||||
'other' => array('divider'=> true),
|
||||
'saved/list' => array('caption'=> LAN_MAILOUT_191, 'perm' => 'W'),
|
||||
'pending/list' => array('caption'=> LAN_MAILOUT_193, 'perm' => 'W'),
|
||||
@@ -161,7 +163,7 @@ class mailout_admin extends e_admin_dispatcher
|
||||
|
||||
|
||||
protected $adminMenuAliases = array(
|
||||
// 'main/edit' => 'main/list',
|
||||
'main/send' => 'main/create',
|
||||
);
|
||||
|
||||
protected $menuTitle = LAN_MAILOUT_15;
|
||||
@@ -207,9 +209,9 @@ class mailout_main_ui extends e_admin_ui
|
||||
'mail_bounce_count' => array('title' => LAN_MAILOUT_144, 'noedit'=>true, 'type'=>'number'),
|
||||
'mail_start_send' => array('title' => LAN_MAILOUT_131,'noedit'=>true, 'type'=>'number', 'proc' => 'sdatetime'),
|
||||
'mail_end_send' => array('title' => LAN_MAILOUT_132, 'noedit'=>true, 'type'=>'number', 'proc' => 'sdatetime'),
|
||||
'mail_create_date' => array('title' => LAN_MAILOUT_130, 'noedit'=>true, 'type'=>'datestamp', 'proc' => 'sdatetime'),
|
||||
'mail_creator' => array('title' => LAN_MAILOUT_85, 'noedit'=>true, 'type'=>'user', 'proc' => 'username'),
|
||||
'mail_create_app' => array('title' => LAN_MAILOUT_133, 'noedit'=>true),
|
||||
'mail_create_date' => array('title' => LAN_MAILOUT_130, 'type'=>null, 'noedit'=>true, 'data'=>'int', 'type'=>'number'),
|
||||
'mail_creator' => array('title' => LAN_MAILOUT_85, 'type'=>null, 'noedit'=>true, 'data'=>'int'),
|
||||
'mail_create_app' => array('title' => LAN_MAILOUT_133, 'type'=>null, 'noedit'=>true,'data'=>'str'),
|
||||
'mail_e107_priority' => array('title' => LAN_MAILOUT_134, 'noedit'=>true),
|
||||
'mail_notify_complete' => array('title' => LAN_MAILOUT_243, 'noedit'=>true, 'nolist' => true),
|
||||
'mail_last_date' => array('title' => LAN_MAILOUT_129, 'noedit'=>true, 'type'=>'int', 'proc' => 'sdatetime'),
|
||||
@@ -302,11 +304,14 @@ class mailout_main_ui extends e_admin_ui
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->fields['options']['type'] = '';
|
||||
// $this->fields['options']['type'] = '';
|
||||
}
|
||||
|
||||
$this->fields['mail_content_status']['writeParms'] = $types;
|
||||
|
||||
$this->processSendActions();
|
||||
|
||||
|
||||
|
||||
if (getperms('0'))
|
||||
{
|
||||
@@ -351,6 +356,7 @@ class mailout_main_ui extends e_admin_ui
|
||||
|
||||
$ret['mail_create_date'] = time();
|
||||
$ret['mail_creator'] = USERID;
|
||||
$ret['mail_create_app'] = 'core';
|
||||
$ret['mail_content_status'] = 20; // Default status is 'Saved';
|
||||
|
||||
return $ret;
|
||||
@@ -360,10 +366,122 @@ class mailout_main_ui extends e_admin_ui
|
||||
|
||||
public function beforeUpdate($new_data, $old_data, $id)
|
||||
{
|
||||
return $this->processData($new_data);
|
||||
$ret = $this->processData($new_data);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private function processSendActions()
|
||||
{
|
||||
|
||||
if((vartrue($_POST['email_sendnow']) || vartrue($_POST['email_send']) || vartrue($_POST['email_hold']) || vartrue($_POST['email_cancel'])) && !vartrue($_POST['email_id']))
|
||||
{
|
||||
e107::getMessage()->addError("No Message ID submitted");
|
||||
return;
|
||||
}
|
||||
|
||||
$id = intval($_POST['email_id']);
|
||||
|
||||
if(vartrue($_POST['email_sendnow']))
|
||||
{
|
||||
$this->emailSendNow($id);
|
||||
}
|
||||
|
||||
if(vartrue($_POST['email_send']))
|
||||
{
|
||||
$this->emailSend($id);
|
||||
}
|
||||
|
||||
if(vartrue($_POST['email_hold']))
|
||||
{
|
||||
$this->emailHold($id);
|
||||
}
|
||||
|
||||
if(vartrue($_POST['email_cancel']))
|
||||
{
|
||||
$this->emailCancel($id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function checkForId()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
private function emailSendNow($mailId)
|
||||
{
|
||||
e107::getMessage()->addInfo("'Send Now' is Under Construction");
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function emailSend($mailId)
|
||||
{
|
||||
$log = e107::getAdminLog();
|
||||
|
||||
$notify = isset($_POST['mail_notify_complete']) ? 3 : 2;
|
||||
$first = 0;
|
||||
$last = 0; // Set defaults for earliest and latest send times.
|
||||
// TODO: Save these fields
|
||||
if (isset($_POST['mail_earliest_time']))
|
||||
{
|
||||
$first = e107::getDateConvert()->decodeDateTime($_POST['mail_earliest_time'], 'datetime', CORE_DATE_ORDER, FALSE);
|
||||
}
|
||||
if (isset($_POST['mail_latest_time']))
|
||||
{
|
||||
$last = e107::getDateConvert()->decodeDateTime($_POST['mail_earliest_time'], 'datetime', CORE_DATE_ORDER, TRUE);
|
||||
}
|
||||
if ($this->mailAdmin->activateEmail($mailId, FALSE, $notify, $first, $last))
|
||||
{
|
||||
e107::getMessage()->addSuccess(LAN_MAILOUT_185);
|
||||
$log->log_event('MAIL_06','ID: '.$mailId,E_LOG_INFORMATIVE,'');
|
||||
}
|
||||
else
|
||||
{
|
||||
$errors[] = str_replace('--ID--', $mailId, LAN_MAILOUT_188);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function emailHold($mailId)
|
||||
{
|
||||
if ($this->mailAdmin->activateEmail($mailId, TRUE))
|
||||
{
|
||||
e107::getMessage()->addSuccess(str_replace('--ID--', $mailId, LAN_MAILOUT_187));
|
||||
}
|
||||
else
|
||||
{
|
||||
$errors[] = str_replace('--ID--', $mailId, LAN_MAILOUT_166);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function emailCancel($mailId)
|
||||
{
|
||||
if ($this->mailAdmin->cancelEmail($mailId))
|
||||
{
|
||||
e107::getMessage()->addSuccess(str_replace('--ID--', $mailId, LAN_MAILOUT_220));
|
||||
}
|
||||
else
|
||||
{
|
||||
$errors[] = str_replace('--ID--', $mailId, LAN_MAILOUT_221);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Process Posted Data
|
||||
*/
|
||||
@@ -413,7 +531,23 @@ class mailout_main_ui extends e_admin_ui
|
||||
}
|
||||
*/
|
||||
|
||||
function sendPage()
|
||||
{
|
||||
|
||||
$id = $this->getId();
|
||||
|
||||
$mailData = e107::getDb()->retrieve('mail_content','*','mail_source_id='.intval($id));
|
||||
|
||||
if(empty($mailData))
|
||||
{
|
||||
e107::getMessage()->addError("Couldn't retrieve mail data for id: ".$id);
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->mailAdmin->sendEmailCircular($mailData, $fromHold);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function maintPage()
|
||||
{
|
||||
@@ -978,10 +1112,26 @@ class mailout_admin_form_ui extends e_admin_form_ui
|
||||
}
|
||||
|
||||
|
||||
function options()
|
||||
function options($parms, $value, $id, $attributes)
|
||||
{
|
||||
$controller = $this->getController();
|
||||
|
||||
|
||||
|
||||
$mode = $this->getController()->getMode();
|
||||
|
||||
if($mode == 'main')
|
||||
{
|
||||
$text = "";
|
||||
|
||||
|
||||
$link = e_SELF."?mode=main&action=send&id=".$id;
|
||||
$text .= "<a href='".$link."' class='btn' title='Send Mail'>".E_32_MAIL."</a>";
|
||||
$text .= $this->renderValue('options',$value,$att,$id);
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
$mode = $controller->getMode();
|
||||
$mailData = $controller->getListModel()->getData();
|
||||
|
||||
@@ -1022,7 +1172,7 @@ class mailout_recipients_ui extends e_admin_ui
|
||||
'mail_recipient_id' => array('title' => LAN_MAILOUT_142, 'thclass' => 'center'),
|
||||
'mail_recipient_name' => array('title' => LAN_MAILOUT_141, 'forced' => TRUE),
|
||||
'mail_recipient_email' => array('title' => LAN_MAILOUT_140, 'thclass' => 'left', 'forced' => TRUE),
|
||||
'mail_status' => array('title' => LAN_MAILOUT_138, 'thclass' => 'center', 'proc' => 'contentstatus'),
|
||||
'mail_status' => array('title' => LAN_MAILOUT_138, 'thclass' => 'left', 'class'=>'left', 'proc' => 'contentstatus'),
|
||||
'mail_detail_id' => array('title' => LAN_MAILOUT_137, 'type'=>'dropdown', 'filter'=>true),
|
||||
'mail_send_date' => array('title' => LAN_MAILOUT_139, 'proc' => 'sdatetime'),
|
||||
'mail_target_info' => array('title' => LAN_MAILOUT_148, 'proc' => 'array'),
|
||||
@@ -1240,6 +1390,7 @@ switch ($action)
|
||||
}
|
||||
break;
|
||||
*/
|
||||
/*
|
||||
case 'mailedit' : // Edit existing mail
|
||||
if (isset($_POST['mailaction']))
|
||||
{
|
||||
@@ -1252,7 +1403,8 @@ switch ($action)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
*/
|
||||
|
||||
case 'makemail' :
|
||||
$newMail = TRUE;
|
||||
|
||||
|
@@ -1944,6 +1944,7 @@ class e_form
|
||||
case 'create':
|
||||
case 'import':
|
||||
case 'submit':
|
||||
case 'success':
|
||||
$options['class'] .= 'btn-success';
|
||||
break;
|
||||
|
||||
@@ -1956,6 +1957,7 @@ class e_form
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
case 'danger':
|
||||
$options['class'] .= 'btn-danger';
|
||||
$options['other'] = 'data-confirm="'.LAN_JSCONFIRM.'"';
|
||||
break;
|
||||
@@ -1966,6 +1968,7 @@ class e_form
|
||||
|
||||
case 'other':
|
||||
case 'login':
|
||||
case 'primary':
|
||||
$options['class'] .= 'btn-primary';
|
||||
break;
|
||||
|
||||
|
@@ -123,7 +123,7 @@ class e107MailManager
|
||||
const E107_EMAIL_MAX_TRIES = 3; // Maximum number of tries by us (mail server may do more)
|
||||
// - max allowable value is MAIL_STATUS_MAX_ACTIVE - MAIL_STATUS_PENDING
|
||||
|
||||
private $debugMode = 0;
|
||||
private $debugMode = 1;
|
||||
protected $e107;
|
||||
protected $db = NULL; // Use our own database object - this one for reading data
|
||||
protected $db2 = NULL; // Use our own database object - this one for updates
|
||||
|
@@ -297,6 +297,7 @@ class mailoutAdminClass extends e107MailManager
|
||||
* @param $target - display mode
|
||||
* @return none
|
||||
*/
|
||||
/*
|
||||
public function mailbodySaveColumnPref($target)
|
||||
{
|
||||
global $user_pref;
|
||||
@@ -313,7 +314,7 @@ class mailoutAdminClass extends e107MailManager
|
||||
$this->fieldPref = $user_pref['admin_mailout_columns'][$target];
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Get the user name associated with a user ID.
|
||||
* The result is cached in case required again
|
||||
@@ -819,6 +820,7 @@ class mailoutAdminClass extends e107MailManager
|
||||
* @param $mailSource - array of mail information
|
||||
* @return text for display
|
||||
*/
|
||||
/*
|
||||
function show_mailform(&$mailSource)
|
||||
{
|
||||
global $HANDLERS_DIRECTORY;
|
||||
@@ -882,14 +884,14 @@ class mailoutAdminClass extends e107MailManager
|
||||
|
||||
|
||||
// Add in the core and any plugin selectors here
|
||||
|
||||
*/
|
||||
/*$text .= "
|
||||
|
||||
<tr>
|
||||
<td>".LAN_MAILOUT_03.": </td>
|
||||
<td>".$this->emailSelector('all', varset($mailSource['mail_selectors'], FALSE))."</td>
|
||||
</tr>";*/
|
||||
|
||||
/*
|
||||
$text .= "
|
||||
<tr>
|
||||
<td>".LAN_MAILOUT_04.": </td>
|
||||
@@ -1005,7 +1007,7 @@ class mailoutAdminClass extends e107MailManager
|
||||
|
||||
// $ns->tablerender(ADLAN_136.SEP.LAN_MAILOUT_15, $mes->render(). $text); // Render the complete form
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* Helper function manages the shortcodes which can be inserted
|
||||
@@ -1115,6 +1117,7 @@ class mailoutAdminClass extends e107MailManager
|
||||
* @param $nextPage - 'mode' specification for page to return to following delete
|
||||
* @return text for display
|
||||
*/
|
||||
/*
|
||||
public function showDeleteConfirm($mailID, $nextPage = 'saved')
|
||||
{
|
||||
$mailData = $this->retrieveEmail($mailID);
|
||||
@@ -1157,7 +1160,8 @@ class mailoutAdminClass extends e107MailManager
|
||||
|
||||
$ns->tablerender(ADLAN_136.SEP.LAN_MAILOUT_171, $text);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -1168,6 +1172,7 @@ class mailoutAdminClass extends e107MailManager
|
||||
* @param $amount - number to return
|
||||
* @return text for display
|
||||
*/
|
||||
/*
|
||||
public function showEmailList($type, $from = 0, $amount = 10)
|
||||
{
|
||||
// Need to select main email entries; count number of addresses attached to each
|
||||
@@ -1269,8 +1274,18 @@ class mailoutAdminClass extends e107MailManager
|
||||
$text .= '</fieldset></form>';
|
||||
$ns->tablerender(ADLAN_136.SEP.$this->tasks[$type]['title'], $text);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generate a list of emails to send
|
||||
* Returns various information to display in a confirmation screen
|
||||
@@ -1345,12 +1360,12 @@ class mailoutAdminClass extends e107MailManager
|
||||
// $this->e107->admin_log->log_event('MAIL_02','ID: '.$mailMainID.' '.$counters['add'].'[!br!]'.$_POST['email_from_name']." <".$_POST['email_from_email'],E_LOG_INFORMATIVE,'');
|
||||
}
|
||||
|
||||
|
||||
// We've got all the email addresses here - display a confirmation form
|
||||
// Include start/end dates for send
|
||||
|
||||
// $text = "<form action='".e_SELF.'?mode=marksend&m='.$mailMainID."' id='email_send' method='post'>";
|
||||
|
||||
$text = "
|
||||
<form action='".e_SELF.'?mode=marksend&m='.$mailMainID."' id='email_send' method='post'>
|
||||
<form action='".e_SELF."' id='email_send' method='post'>
|
||||
<fieldset id='email-send'>
|
||||
<table class='table adminlist'>
|
||||
<colgroup>
|
||||
@@ -1387,23 +1402,27 @@ class mailoutAdminClass extends e107MailManager
|
||||
|
||||
$text .= "<div class='buttons-bar center'>";
|
||||
|
||||
$text .= $frm->admin_button('email_sendnow',"Send Now");
|
||||
$text .= $frm->admin_button('email_sendnow',"Send Now", 'primary');
|
||||
$text .= $frm->admin_button('email_send',"Send Later");
|
||||
|
||||
// $text .= "<input type='submit' name='email_send' value=\"".LAN_SEND."\" />";
|
||||
|
||||
if (!$fromHold)
|
||||
{
|
||||
$text .= $frm->admin_button('email_hold',LAN_HOLD);
|
||||
$text .= $frm->admin_button('email_cancel',LAN_CANCEL);
|
||||
$text .= $frm->admin_button('email_hold',LAN_HOLD, 'warning');
|
||||
$text .= $frm->admin_button('email_cancel',LAN_CANCEL, 'delete');
|
||||
// $text .= " <input type='submit' name='email_hold' value=\"".LAN_HOLD."\" />";
|
||||
// $text .= " <input type='submit' name='email_cancel' value=\"".LAN_CANCEL."\" />";
|
||||
}
|
||||
|
||||
$text .= $frm->hidden('email_id',$mailMainID);
|
||||
|
||||
$text .= "</div>
|
||||
</form>
|
||||
</div>";
|
||||
|
||||
e107::getRender()->tablerender(ADLAN_136.SEP.LAN_MAILOUT_179, $mes->render(). $text);
|
||||
return $text;
|
||||
// e107::getRender()->tablerender(ADLAN_136.SEP.LAN_MAILOUT_179, $mes->render(). $text);
|
||||
} // End of previewed email
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user