1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 04:40:44 +02:00

Mail and progressBar fixes.

This commit is contained in:
Cameron
2014-10-12 18:01:19 -07:00
parent 5e867b378e
commit 01f0751c04
8 changed files with 190 additions and 79 deletions

View File

@@ -91,8 +91,13 @@ require_once(e_HANDLER.'mail_manager_class.php'); // Mail DB API
*/ */
function sendProgress($id) function sendProgress($id)
{ {
// return rand(92,100);
$pref = e107::getPref(); $pref = e107::getPref();
ob_start();
$mailManager = new e107MailManager(); $mailManager = new e107MailManager();
$mailManager->doEmailTask(varset($pref['mail_workpertick'],5)); $mailManager->doEmailTask(varset($pref['mail_workpertick'],5));
@@ -104,10 +109,14 @@ function sendProgress($id)
$rand = ($row['mail_sent_count'] + $row['mail_fail_count']); $rand = ($row['mail_sent_count'] + $row['mail_fail_count']);
$total = ($row['mail_togo_count'] + $row['mail_sent_count'] + $row['mail_fail_count']); $total = ($row['mail_togo_count'] + $row['mail_sent_count'] + $row['mail_fail_count']);
// $rand = rand(90,100); $errors = ob_get_clean();
// return $rand;
e107::getMessage()->addDebug($errors);
// file_put_contents(e_LOG.'send-mail-progress.txt',$errors);
$inc = round(($rand / $total) * 100); $inc = round(($rand / $total) * 100);
e107::getMessage()->addDebug("Returned: ".$inc);
return $inc; return $inc;
@@ -117,7 +126,6 @@ function sendProgress($id)
if(e_AJAX_REQUEST) if(e_AJAX_REQUEST)
{ {
$id = intval($_GET['mode']); $id = intval($_GET['mode']);
// echo rand(92,100);
echo sendProgress($id); echo sendProgress($id);
exit; exit;
@@ -212,12 +220,12 @@ class mailout_admin extends e_admin_dispatcher
protected $adminMenu = array( protected $adminMenu = array(
// 'makemail/makemail' => array('caption'=> LAN_MAILOUT_190, 'perm' => 'W', 'url'=>e_SELF), // 'makemail/makemail' => array('caption'=> LAN_MAILOUT_190, 'perm' => 'W', 'url'=>e_SELF),
'main/list' => array('caption'=> LAN_MANAGE, 'perm'=> 'W'), 'main/list' => array('caption'=> LAN_MANAGE, 'perm'=> 'W'),
'main/create' => array('caption'=> LAN_MAILOUT_190, 'perm' => 'W'), 'main/create' => array('caption'=> LAN_CREATE, 'perm' => 'W'),
'recipients/list' => array('caption'=> "Recipients", 'perm' => 'W'), 'recipients/list' => array('caption'=> "Recipients", 'perm' => 'W'),
// 'main/send' => array('caption'=> "Send", 'perm' => 'W'), // 'main/send' => array('caption'=> "Send", 'perm' => 'W'),
'other' => array('divider'=> true), 'other' => array('divider'=> true),
'saved/list' => array('caption'=> LAN_MAILOUT_191, 'perm' => 'W'), // 'saved/list' => array('caption'=> LAN_MAILOUT_191, 'perm' => 'W'),
'pending/list' => array('caption'=> LAN_MAILOUT_193, 'perm' => 'W'), 'pending/list' => array('caption'=> LAN_MAILOUT_193, 'perm' => 'W'),
'held/list' => array('caption'=> LAN_MAILOUT_194, 'perm' => 'W'), 'held/list' => array('caption'=> LAN_MAILOUT_194, 'perm' => 'W'),
'sent/list' => array('caption'=> LAN_MAILOUT_192, 'perm' => 'W'), 'sent/list' => array('caption'=> LAN_MAILOUT_192, 'perm' => 'W'),
@@ -244,7 +252,7 @@ class mailout_main_ui extends e_admin_ui
protected $pluginName = LAN_MAILOUT_15; protected $pluginName = LAN_MAILOUT_15;
protected $table = "mail_content"; protected $table = "mail_content";
// protected $listQry = "SELECT * FROM #mail_content WHERE mail_content_status = 20 "; // protected $listQry = null;
// protected $editQry = "SELECT * FROM #mail_content WHERE cust_id = {ID}"; // protected $editQry = "SELECT * FROM #mail_content WHERE cust_id = {ID}";
@@ -269,9 +277,11 @@ class mailout_main_ui extends e_admin_ui
'mail_copy_to' => array('title' => LAN_MAILOUT_151,'tab'=>1, 'type'=>'method','data'=>false), 'mail_copy_to' => array('title' => LAN_MAILOUT_151,'tab'=>1, 'type'=>'method','data'=>false),
'mail_bcopy_to' => array('title' => LAN_MAILOUT_152,'tab'=>1, 'type'=>'method','data'=>false), 'mail_bcopy_to' => array('title' => LAN_MAILOUT_152,'tab'=>1, 'type'=>'method','data'=>false),
'mail_subject' => array('title' => LAN_MAILOUT_06, 'type'=>'text', 'forced' => TRUE,'data'=>'str', 'inline'=>true, 'writeParms'=>'size=xxlarge&required=1'), 'mail_subject' => array('title' => LAN_MAILOUT_06, 'type'=>'text', 'forced' => TRUE,'data'=>'str', 'inline'=>true, 'writeParms'=>'size=xxlarge&required=1'),
'mail_content_status' => array('title' => LAN_MAILOUT_136, 'tab'=>1, 'type'=> 'dropdown', 'data'=>'int', 'filter'=>false, 'inline'=>true, 'thclass' => 'left', 'class'=>'left'), 'mail_content_status' => array('title' => LAN_MAILOUT_136, 'tab'=>1, 'type'=> 'dropdown', 'data'=>'int', 'filter'=>false, 'inline'=>false, 'thclass' => 'left', 'class'=>'left'),
'mail_togo_count' => array('title' => LAN_MAILOUT_83, 'noedit'=>true, 'type'=>'number'), 'mail_total_count' => array('title' => "Total Recipients", 'noedit'=>true, 'type'=>'number'),
'mail_sent_count' => array('title' => LAN_MAILOUT_82, 'noedit'=>true, 'type'=>'number'), 'mail_sent_count' => array('title' => LAN_MAILOUT_82, 'noedit'=>true, 'type'=>'number'),
'mail_togo_count' => array('title' => LAN_MAILOUT_83, 'noedit'=>true, 'type'=>'number'),
'mail_fail_count' => array('title' => LAN_MAILOUT_128, 'noedit'=>true, 'type'=>'number'), 'mail_fail_count' => array('title' => LAN_MAILOUT_128, 'noedit'=>true, 'type'=>'number'),
'mail_bounce_count' => array('title' => LAN_MAILOUT_144, 'noedit'=>true, 'type'=>'number'), '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_start_send' => array('title' => LAN_MAILOUT_131,'noedit'=>true, 'type'=>'number', 'proc' => 'sdatetime'),
@@ -371,7 +381,13 @@ class mailout_main_ui extends e_admin_ui
} }
else else
{ {
// $this->fields['options']['type'] = ''; $this->listQry = "SELECT * FROM #mail_content WHERE (mail_content_status = ".MAIL_STATUS_TEMP ." OR mail_content_status = ".MAIL_STATUS_SAVED.")";
}
if($action == 'sent' || $action == 'pending' || $action == 'held')
{
$this->fieldpref = array('checkboxes', 'mail_source_id', 'mail_title', 'mail_subject','mail_total_count', 'mail_togo_count', 'mail_sent_count', 'mail_fail_count', 'mail_bounce_count', 'options');
} }
$this->fields['mail_content_status']['writeParms'] = $types; $this->fields['mail_content_status']['writeParms'] = $types;
@@ -445,7 +461,7 @@ class mailout_main_ui extends e_admin_ui
private function processSendActions() private function processSendActions()
{ {
if((vartrue($_POST['email_sendnow']) || vartrue($_POST['email_send']) || vartrue($_POST['email_hold']) || vartrue($_POST['email_cancel'])) && !vartrue($_POST['email_id'])) if((vartrue($_POST['email_send']) || vartrue($_POST['email_hold']) || vartrue($_POST['email_cancel'])) && !vartrue($_POST['email_id']))
{ {
e107::getMessage()->addError("No Message ID submitted"); e107::getMessage()->addError("No Message ID submitted");
return; return;
@@ -453,11 +469,6 @@ class mailout_main_ui extends e_admin_ui
$id = intval($_POST['email_id']); $id = intval($_POST['email_id']);
if(vartrue($_POST['email_sendnow']))
{
$this->emailSendNow($id);
}
if(vartrue($_POST['email_send'])) if(vartrue($_POST['email_send']))
{ {
$this->emailSend($id); $this->emailSend($id);
@@ -478,13 +489,7 @@ class mailout_main_ui extends e_admin_ui
private function emailSendNow($id) private function emailSendNow($id)
{ {
$mes = e107::getMessage();
$text = e107::getForm()->progressBar('mail-progress',1, array('btn-label'=>'Start', 'url'=> e_SELF));
$mes->setTitle('Ready to Process Mail Queue', E_MESSAGE_INFO)->addInfo($text);
return '';
//; e107::getRender()->tablerender("Sending...", $mes->render());
} }
@@ -602,6 +607,28 @@ class mailout_main_ui extends e_admin_ui
} }
*/ */
function sendnowPage()
{
$id = $this->getId();
e107::getDb()->update('mail_content', 'mail_content_status='.MAIL_STATUS_PENDING.' WHERE mail_source_id = '.intval($id));
e107::getDb()->update('mail_recipients', 'mail_status='.MAIL_STATUS_PENDING.' WHERE mail_detail_id = '.intval($id));
if(E107_DEBUG_LEVEL > 0)
{
echo "<h4>Debug Mode : Mail is sent and data displayed below. </h4>";
sendProgress($id);
}
else
{
$text = "<h4>Ready to Process Mail Queue</h4>";
$text .= e107::getForm()->progressBar('mail-progress',1, array('btn-label'=>'Start', 'url'=> e_SELF));
}
return $text;
}
function sendPage() function sendPage()
{ {
@@ -619,6 +646,10 @@ class mailout_main_ui extends e_admin_ui
$mailData = $this->mailAdmin->dbToMail($mailData); $mailData = $this->mailAdmin->dbToMail($mailData);
e107::getMessage()->addDebug("Regenerating recipient list");
e107::getDb()->delete('mail_recipients','mail_detail_id='.intval($id));
return $this->mailAdmin->sendEmailCircular($mailData, $fromHold); return $this->mailAdmin->sendEmailCircular($mailData, $fromHold);
@@ -1207,6 +1238,15 @@ class mailout_admin_form_ui extends e_admin_form_ui
return $text; return $text;
} }
if($mode == 'sent' || $mode == 'pending' || $mode == 'held')
{
$link = e_SELF."?searchquery=&filter_options=mail_detail_id__".$id."&mode=recipients&action=list";
$text .= "<a href='".$link."' class='btn' title='Recipients'>".E_32_USER."</a>";
$att['readParms']['editClass'] = e_UC_NOBODY;
$text .= $this->renderValue('options',$value,$att,$id);
return $text;
}
$mode = $controller->getMode(); $mode = $controller->getMode();
$mailData = $controller->getListModel()->getData(); $mailData = $controller->getListModel()->getData();
@@ -1272,7 +1312,7 @@ class mailout_recipients_ui extends e_admin_ui
while($row = $sql->fetch()) while($row = $sql->fetch())
{ {
$id = $row['mail_detail_id']; $id = $row['mail_detail_id'];
$array[$id] = varset($row['mail_title'], "(No Name)"); $array[$id] = vartrue($row['mail_title'], "(No Name)");
} }
$this->fields['mail_detail_id']['writeParms'] = $array; $this->fields['mail_detail_id']['writeParms'] = $array;
@@ -1729,7 +1769,7 @@ switch ($midAction)
if(isset($_POST['email_sendnow'])) if(isset($_POST['email_sendnow']))
{ {
sendImmediately($mailId); // sendImmediately($mailId);
} }
// --------------------- Display errors and results ------------------------ // --------------------- Display errors and results ------------------------
@@ -1805,7 +1845,7 @@ switch ($action)
{ {
$mailData = array(); // Empty array just in case $mailData = array(); // Empty array just in case
} }
$mailAdmin->show_mailform($mailData); // $mailAdmin->show_mailform($mailData);
break; break;
} }

View File

@@ -255,6 +255,7 @@ CREATE TABLE mail_recipients (
CREATE TABLE mail_content ( CREATE TABLE mail_content (
mail_source_id int(10) unsigned NOT NULL auto_increment, mail_source_id int(10) unsigned NOT NULL auto_increment,
mail_content_status tinyint(1) unsigned NOT NULL default '0', mail_content_status tinyint(1) unsigned NOT NULL default '0',
mail_total_count int(10) unsigned NOT NULL default '0',
mail_togo_count int(10) unsigned NOT NULL default '0', mail_togo_count int(10) unsigned NOT NULL default '0',
mail_sent_count int(10) unsigned NOT NULL default '0', mail_sent_count int(10) unsigned NOT NULL default '0',
mail_fail_count int(10) unsigned NOT NULL default '0', mail_fail_count int(10) unsigned NOT NULL default '0',

View File

@@ -1095,6 +1095,7 @@ class e_form
* @param string $name * @param string $name
* @param number $value * @param number $value
* @param array $options * @param array $options
* @example Use
*/ */
public function progressBar($name,$value,$options=array()) public function progressBar($name,$value,$options=array())
{ {
@@ -1114,9 +1115,13 @@ class e_form
$loading = vartrue($options['loading'],'Please wait...'); $loading = vartrue($options['loading'],'Please wait...');
$buttonId = $target.'-start';
if(vartrue($options['btn-label'])) if(vartrue($options['btn-label']))
{ {
$text .= '<a id="mail-progress-start" data-loading-text="'.$loading.'" data-progress-target="'.$target.'" data-progress="' . $options['url'] . '" data-progress-mode="'.$id.'" data-progress-show="'.$nextStep.'" data-progress-hide="'.$thisStep.'" class="btn btn-primary e-progress" >'.$options['btn-label'].'</a>'; $text .= '<a id="'.$buttonId.'" data-loading-text="'.$loading.'" data-progress-target="'.$target.'" data-progress="' . $options['url'] . '" data-progress-mode="'.varset($options['mode'],0).'" data-progress-show="'.$nextStep.'" data-progress-hide="'.$buttonId.'" class="btn btn-primary e-progress" >'.$options['btn-label'].'</a>';
$text .= ' <a data-progress-target="'.$target.'" class="btn btn-danger e-progress-cancel" >'.LAN_CANCEL.'</a>';
} }

View File

@@ -138,7 +138,7 @@ define('MAIL_LOG_PATH',e_LOG);
class e107Email extends PHPMailer class e107Email extends PHPMailer
{ {
private $general_opts = array(); private $general_opts = array();
private $logEnable = 1; // 0 = log disabled, 1 = 'dry run' (debug and log, no send). 2 = 'log all' (send, and log result) private $logEnable = 2; // 0 = log disabled, 1 = 'dry run' (debug and log, no send). 2 = 'log all' (send, and log result)
private $logHandle = FALSE; // Save handle of log file if opened private $logHandle = FALSE; // Save handle of log file if opened
private $localUseVerp = FALSE; // Use our own variable - PHPMailer one doesn't work with all mailers private $localUseVerp = FALSE; // Use our own variable - PHPMailer one doesn't work with all mailers
@@ -154,7 +154,7 @@ class e107Email extends PHPMailer
private $pause_time = 1; // Time to pause after sending a block of emails private $pause_time = 1; // Time to pause after sending a block of emails
public $legacyBody = false; // TRUE enables legacy conversion of plain text body to HTML in HTML emails public $legacyBody = false; // TRUE enables legacy conversion of plain text body to HTML in HTML emails
private $debug = false; // echos various debug info when set to true. private $debug = true; // echos various debug info when set to true.
private $pref = array(); // Store code prefs. private $pref = array(); // Store code prefs.
/** /**
@@ -196,7 +196,12 @@ class e107Email extends PHPMailer
$this->allow_html = varset($pref['mail_sendstyle'],'textonly') == 'texthtml' ? true : 1; $this->allow_html = varset($pref['mail_sendstyle'],'textonly') == 'texthtml' ? true : 1;
if (varsettrue($pref['mail_options'])) $this->general_opts = explode(',',$pref['mail_options'],''); if (varsettrue($pref['mail_options'])) $this->general_opts = explode(',',$pref['mail_options'],'');
if ($this->debug) echo 'Mail_options: '.$pref['mail_options'].' Count: '.count($this->general_opts).'<br />';
if ($this->debug)
{
echo 'Mail_options: '.$pref['mail_options'].' Count: '.count($this->general_opts).'<br />';
}
foreach ($this->general_opts as $k => $v) foreach ($this->general_opts as $k => $v)
{ {
$v = trim($v); $v = trim($v);
@@ -609,7 +614,7 @@ class e107Email extends PHPMailer
if($tmpl = e107::getCoreTemplate('email', $eml['template'], 'front', true)) //FIXME - Core template is failing with template 'notify'. Works with theme template. Issue with core template registry? if($tmpl = e107::getCoreTemplate('email', $eml['template'], 'front', true)) //FIXME - Core template is failing with template 'notify'. Works with theme template. Issue with core template registry?
{ {
$eml['shortcodes']['BODY'] = $eml['email_body']; $eml['shortcodes']['BODY'] = $tp->toEmail($eml['email_body']);
$eml['shortcodes']['SUBJECT'] = $eml['email_subject']; $eml['shortcodes']['SUBJECT'] = $eml['email_subject'];
$eml['shortcodes']['THEME'] = e_THEME.$this->pref['sitetheme'].'/'; // Always use front-end theme path. $eml['shortcodes']['THEME'] = e_THEME.$this->pref['sitetheme'].'/'; // Always use front-end theme path.
@@ -732,6 +737,7 @@ class e107Email extends PHPMailer
$eml['wordwrap'] - Set wordwrap value $eml['wordwrap'] - Set wordwrap value
$eml['split'] - If true, sends an individual email to each recipient $eml['split'] - If true, sends an individual email to each recipient
$eml['template'] - template to use. 'default' $eml['template'] - template to use. 'default'
$eml['shortcodes'] - array of shortcode values. eg. array('MY_SHORTCODE'=>'12345');
* @param string $send_to - recipient email address * @param string $send_to - recipient email address
* @param string $to_name - recipient name * @param string $to_name - recipient name
@@ -743,9 +749,12 @@ class e107Email extends PHPMailer
public function sendEmail($send_to, $to_name, $eml = '', $bulkmail = FALSE) public function sendEmail($send_to, $to_name, $eml = '', $bulkmail = FALSE)
{ {
if (count($eml)) if (count($eml))
{ // Set parameters from list {
$ret = $this->arraySet($eml); // returns error on fail and nothing if all is okay. if($error = $this->arraySet($eml)) // Set parameters from list
if ($ret) return $ret; {
return $error;
}
} }
if ($bulkmail && $this->localUseVerp && $this->save_bouncepath && (strpos($this->save_bouncepath,'@') !== FALSE)) if ($bulkmail && $this->localUseVerp && $this->save_bouncepath && (strpos($this->save_bouncepath,'@') !== FALSE))

View File

@@ -797,8 +797,8 @@ class e107MailManager
//'extra_header' - additional headers (format is name: value //'extra_header' - additional headers (format is name: value
//'wordwrap' - Set wordwrap value //'wordwrap' - Set wordwrap value
//'split' - If true, sends an individual email to each recipient //'split' - If true, sends an individual email to each recipient
'template' => 'template', // required 'template' => 'mail_send_style', // required
'shortcodes' => 'shortcodes' // required 'shortcodes' => 'mail_target_info' // required
); );
$result = array(); $result = array();
if (!isset($email['mail_source_id'])) $email['mail_source_id'] = 0; if (!isset($email['mail_source_id'])) $email['mail_source_id'] = 0;
@@ -853,8 +853,14 @@ class e107MailManager
} }
if (isset($email['mail_overrides']) && is_array($email['mail_overrides'])) $result = array_merge($result, $email['mail_overrides']); if (isset($email['mail_overrides']) && is_array($email['mail_overrides'])) $result = array_merge($result, $email['mail_overrides']);
e107::getAdminLog()->addDebug(print_a($email,true),false); e107::getAdminLog()->addDebug(print_a($email,true),true);
print_a($email);
// $result['template'] = $email['mail_send_style'];
echo "<h4>".__METHOD__." Line: ".__LINE__."</h4>";
print_a($result);
return $result; return $result;
} }
@@ -882,7 +888,7 @@ class e107MailManager
} }
else else
{ {
e107::getAdminLog()->addDebug("Couldn't select emails", false); e107::getAdminLog()->addDebug("Couldn't select emails", true);
} }
} }
@@ -1046,6 +1052,11 @@ class e107MailManager
if (($handle <= 0) || !is_numeric($handle)) return FALSE; if (($handle <= 0) || !is_numeric($handle)) return FALSE;
if (!isset($this->mailCounters[$handle])) return 'nocounter'; if (!isset($this->mailCounters[$handle])) return 'nocounter';
$this->checkDB(2); // Make sure DB object created $this->checkDB(2); // Make sure DB object created
$query = '`mail_togo_count`='.intval($this->mailCounters[$handle]['add']).' WHERE `mail_source_id`='.$handle; $query = '`mail_togo_count`='.intval($this->mailCounters[$handle]['add']).' WHERE `mail_source_id`='.$handle;
if ($this->db2->db_Update('mail_content', $query)) if ($this->db2->db_Update('mail_content', $query))
{ {
@@ -1055,6 +1066,22 @@ class e107MailManager
} }
public function updateCounter($id, $type, $count)
{
if(empty($id) || empty($type))
{
return false;
}
$update = array(
'mail_'.$type.'_count' => intval($count),
'WHERE' => "mail_source_id=".intval($id)
);
return e107::getDb('mail')->update('mail_content', $update) ? $count : false;
}
/** /**
* Retrieve the counters for a mail record * Retrieve the counters for a mail record
@@ -1489,8 +1516,8 @@ class e107MailManager
public function sendEmails($templateName, $emailData, $recipientData, $extra = FALSE) public function sendEmails($templateName, $emailData, $recipientData, $extra = FALSE)
{ {
$log = e107::getAdminLog(); $log = e107::getAdminLog();
$log->addDebug(print_a($emailData, true),false); $log->addDebug(print_a($emailData, true),true);
$log->addDebug(print_a($recipientData, true),false); $log->addDebug(print_a($recipientData, true),true);
$log->toFile('mail_manager','Main Manager Log',true); $log->toFile('mail_manager','Main Manager Log',true);
@@ -1559,6 +1586,8 @@ class e107MailManager
if($this->debugMode) if($this->debugMode)
{ {
echo "<h4>".__CLASS__." :: ".__METHOD__." - Line ".__LINE__."</h4>";
print_a($emailData); print_a($emailData);
print_a($recipientData); print_a($recipientData);

View File

@@ -886,6 +886,13 @@ class mailoutAdminClass extends e107MailManager
{ {
$text .= '<tr><td>' . $this->fields['mail_content'][$k]['title'] . '</td><td>'; $text .= '<tr><td>' . $this->fields['mail_content'][$k]['title'] . '</td><td>';
$val = $mailSource[$k]; $val = $mailSource[$k];
if($k == 'mail_body')
{
$text .= $tp->toHtml($val,true);
continue;
}
if(is_numeric($v)) if(is_numeric($v))
{ {
$text .= ($v > 1)? $tp->text_truncate($val, $v, '...'): $val; $text .= ($v > 1)? $tp->text_truncate($val, $v, '...'): $val;
@@ -901,6 +908,7 @@ class mailoutAdminClass extends e107MailManager
$text .= $gen->convert_date($val, 'short'); $text .= $gen->convert_date($val, 'short');
break; break;
case 'trunc200': case 'trunc200':
$text .= e107::getParser()->text_truncate($val, 200, '...'); $text .= e107::getParser()->text_truncate($val, 200, '...');
break; break;
case 'chars': case 'chars':
@@ -1541,33 +1549,40 @@ class mailoutAdminClass extends e107MailManager
$text .= $this->showMailDetail($mailData, 'send'); $text .= $this->showMailDetail($mailData, 'send');
$text .= '<tr><td>' . LAN_MAILOUT_03 . '</td><td>'; // TO
// Add in core and any plugin selectors here // Add in core and any plugin selectors here
foreach($this->mailHandlers as $key => $m) foreach($this->mailHandlers as $key => $m)
{ {
if($m->mailerEnabled && ($contentArray = $m->showSelect(FALSE, $mailData['mail_selectors'][$key]))) if($m->mailerEnabled && ($contentArray = $m->showSelect(FALSE, $mailData['mail_selectors'][$key])))
{ {
$text .= '<tr><td>' . LAN_MAILOUT_180 . '<br />' . $m->mailerName . '</td>';
$text .= '<td><ul>'; $text .= $m->mailerName.':<ul>';
foreach($contentArray as $val) foreach($contentArray as $val)
{ {
$text .= "<li>" . $val['caption'] . " : " . $val['html'] . "</li>"; $text .= "<li>" . $val['caption'] . " : " . $val['html'] . "</li>";
} }
$text .= '</ul></td></tr>'; $text .= '</ul>';
} }
} }
$text .= '</td></tr>';
// Figures - number of emails to send, number of duplicates stripped // Figures - number of emails to send, number of duplicates stripped
$text .= '<tr><td>' . LAN_MAILOUT_173 . '</td><td>' . ($mailData['mail_togo_count']) . "<input type='hidden' name='mailIDConf' value='{$mailMainID}' /></td></tr>"; $text .= '<tr><td>' . LAN_MAILOUT_173 . '</td><td>' . ($mailData['mail_togo_count']) . "<input type='hidden' name='mailIDConf' value='{$mailMainID}' /></td></tr>";
$text .= '<tr><td>' . LAN_MAILOUT_71 . '</td><td> ' . $counters['add'] . ' ' . LAN_MAILOUT_69 . $counters['dups'] . LAN_MAILOUT_70 . '</td></tr>'; $text .= '<tr><td>' . LAN_MAILOUT_71 . '</td><td> ' . $counters['add'] . ' ' . LAN_MAILOUT_69 . $counters['dups'] . LAN_MAILOUT_70 . '</td></tr>';
$text .= "</tbody></table>\n</fieldset>"; $text .= "</tbody></table>\n</fieldset>";
$this->updateCounter($mailMainID,'total',$counters['add']);
$text .= $this->makeAdvancedOptions(TRUE); $text .= $this->makeAdvancedOptions(TRUE);
// Show the table of advanced options // Show the table of advanced options
$text .= "<div class='buttons-bar center'>"; $text .= "<div class='buttons-bar center'>";
$text .= "<a href='".e_SELF."?mode=main&action=sendnow&id=".$mailMainID."' class='btn btn-primary'>Send Now</a>";
$text .= $frm->admin_button('email_sendnow', "Send Now", 'primary'); // $text .= $frm->admin_button('email_sendnow', "Send Now", 'primary');
$text .= $frm->admin_button('email_send', "Send Later"); $text .= $frm->admin_button('email_send', "Send Later");
// $text .= "<input type='submit' name='email_send' value=\"".LAN_SEND."\" />"; // $text .= "<input type='submit' name='email_send' value=\"".LAN_SEND."\" />";

View File

@@ -197,7 +197,7 @@ class newsletter_mailout
$selects = array_flip(explode(',', $selectVals)); $selects = array_flip(explode(',', $selectVals));
if ($sql->db_Select('newsletter', 'newsletter_id, newsletter_title', '`newsletter_parent`=0')) if ($sql->select('newsletter', 'newsletter_id, newsletter_title', '`newsletter_parent`=0'))
{ {
$c=0; $c=0;
while ($row = $sql->db_Fetch(MYSQL_ASSOC)) while ($row = $sql->db_Fetch(MYSQL_ASSOC))
@@ -219,8 +219,9 @@ class newsletter_mailout
} }
else else
{ {
$var[$c]['caption'] = NLLAN_50; return false; // Return Nothing to avoid confusion.
$var[$c]['html'] = ''; // $var[$c]['caption'] = NLLAN_50;
// $var[$c]['html'] = '';
} }
return $var; return $var;

View File

@@ -12,24 +12,25 @@ $(document).ready(function()
// tabs hash // tabs hash
if(/^#\/\w+/.test(window.location.hash)) { if(/^#\/\w+/.test(window.location.hash)) {
var hash = window.location.hash.substr(2); var hash = window.location.hash.substr(2);
if(hash.match('^tab')) $('.nav-tabs a[href=#' + hash + ']').tab('show'); if(hash.match('^tab')){ $('.nav-tabs a[href=#' + hash + ']').tab('show'); }
} }
$('.e-typeahead').each(function() { $('.e-typeahead').each( function(){
var id = $(this).attr("id"); var id = $(this).attr("id");
var name = '#' + id.replace('-usersearch', ''); var name = '#' + id.replace('-usersearch', '');
var newval = $(this).attr("data-value"); var newval = $(this).attr("data-value");
$(this).typeahead({ $(this).typeahead({
source: $(this).attr("data-source"), source: $(this).attr("data-source"),
updater: function(text, type){ updater: function(text, type){
if(type == 'value') if(type === 'value')
{ {
$(name).val(text); $(name).val(text);
} }
return text; return text;
} }
}) });
}); });
/* Switch to Tab containing invalid form field. */ /* Switch to Tab containing invalid form field. */
@@ -49,7 +50,7 @@ $(document).ready(function()
//alert(node.id+' : '+tab); //alert(node.id+' : '+tab);
} }
// var label = $('label[for=' + node.id + ']'); // var label = $('label[for=' + node.id + ']');
}) });
return true; return true;
}); });
@@ -125,6 +126,7 @@ $(document).ready(function()
{ {
var caption = $(this).attr('data-loading-text'); var caption = $(this).attr('data-loading-text');
$(this).removeClass('btn-success'); $(this).removeClass('btn-success');
$(this).removeClass('btn-primary');
$(this).html(caption); $(this).html(caption);
if($(this).attr('data-disable') == 'true') if($(this).attr('data-disable') == 'true')
{ {
@@ -139,6 +141,7 @@ $(document).ready(function()
var caption = $(this).attr('data-loading-text'); var caption = $(this).attr('data-loading-text');
$(this).val(caption); $(this).val(caption);
$(this).removeClass('btn-success'); $(this).removeClass('btn-success');
$(this).removeClass('btn-primary');
//$(this).attr('disabled', 'disabled').val(caption); //$(this).attr('disabled', 'disabled').val(caption);
return true; return true;
} }
@@ -203,8 +206,16 @@ $(document).ready(function()
var progresspump = null;
$('.e-progress-cancel').on('click', function(e)
{
clearInterval(progresspump);
var target = $(this).attr('data-progress-target');
$("#"+target).closest('.progress').removeClass("active");
progresspump = null;
alert('stopped');
});
$('.e-progress').on('click', function(e) $('.e-progress').on('click', function(e)
{ {
@@ -224,12 +235,12 @@ $(document).ready(function()
$("#"+target).css('width','1%'); // so we know it's running. $("#"+target).css('width','1%'); // so we know it's running.
var progresspump = setInterval(function(){ progresspump = setInterval(function(){
$.get(script, { mode: mode }).done( function(data){ $.get(script, { mode: mode }).done( function(data){
// alert(data); // alert(data);
$("#"+target).css('width',data+'%'); // update the progress bar width */ $("#"+target).css('width', data+'%'); // update the progress bar width */
$("#"+target).html(data+'%'); // display the numeric value */ $("#"+target).html(data+'%'); // display the numeric value */
if(data > 99.999) { if(data > 99.999) {
@@ -695,7 +706,7 @@ $(document).ready(function()
// Text-area AutoGrow // Text-area AutoGrow
// $("textarea.e-autoheight").elastic(); // $("textarea.e-autoheight").elastic();
}) });