beta delete + contact, invite type, email clone, email count
This commit is contained in:
parent
e112dc3704
commit
57c124a1f0
@ -268,6 +268,34 @@ function init_saimod_mail_emails() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#btn-mail-email-clone').click(function(){
|
||||||
|
var emails = [];
|
||||||
|
$('.mail-email-check:checked').each(function() {
|
||||||
|
emails.push($(this).attr('email'));
|
||||||
|
});
|
||||||
|
$.ajax({
|
||||||
|
async: true,
|
||||||
|
url: this.endpoint,
|
||||||
|
type: 'POST',
|
||||||
|
dataType: 'JSON',
|
||||||
|
data: {
|
||||||
|
sai_mod: '.SAI.saimod_mail',
|
||||||
|
action: 'clone_email',
|
||||||
|
data: emails
|
||||||
|
},
|
||||||
|
success: function(data){
|
||||||
|
if(data.status){
|
||||||
|
system.reload();
|
||||||
|
} else {
|
||||||
|
alert('Something happend - try again!');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(){
|
||||||
|
alert('Something happend - try again!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function init_saimod_mail_email() {
|
function init_saimod_mail_email() {
|
||||||
|
|||||||
@ -136,7 +136,7 @@ class saimod_mail extends \SYSTEM\SAI\sai_module{
|
|||||||
while($row = $list_handle->next()){
|
while($row = $list_handle->next()){
|
||||||
\set_time_limit(30);
|
\set_time_limit(30);
|
||||||
self::send_mail($row['email'], $email_id, $list) ? 1 : 0;
|
self::send_mail($row['email'], $email_id, $list) ? 1 : 0;
|
||||||
\sleep(3);
|
\sleep(1);
|
||||||
}
|
}
|
||||||
return \SYSTEM\LOG\JsonResult::ok();
|
return \SYSTEM\LOG\JsonResult::ok();
|
||||||
}
|
}
|
||||||
@ -372,7 +372,7 @@ class saimod_mail extends \SYSTEM\SAI\sai_module{
|
|||||||
$vars['images'] .= \SYSTEM\PAGE\replace::replaceFile((new \PSAI('saimod_mail/tpl/saimod_mail_email_image.tpl'))->SERVERPATH(),$new_image);
|
$vars['images'] .= \SYSTEM\PAGE\replace::replaceFile((new \PSAI('saimod_mail/tpl/saimod_mail_email_image.tpl'))->SERVERPATH(),$new_image);
|
||||||
//send
|
//send
|
||||||
$vars['send'] = '';
|
$vars['send'] = '';
|
||||||
$res = \SQL\EMAIL_LISTS_SELECT::QQ();
|
$res = \SQL\EMAIL_LISTS_SELECT_AND_SENT_COUNT::QQ(array($id));
|
||||||
while($row = $res->next()){
|
while($row = $res->next()){
|
||||||
$row['disabled'] = $row['id'] == self::EMAIL_LIST_TEST ? '' : 'disabled';
|
$row['disabled'] = $row['id'] == self::EMAIL_LIST_TEST ? '' : 'disabled';
|
||||||
$row['btn-color'] = $row['id'] == self::EMAIL_LIST_TEST ? 'success' : 'danger';
|
$row['btn-color'] = $row['id'] == self::EMAIL_LIST_TEST ? 'success' : 'danger';
|
||||||
@ -462,6 +462,15 @@ class saimod_mail extends \SYSTEM\SAI\sai_module{
|
|||||||
return \JsonResult::ok();
|
return \JsonResult::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function sai_mod__SAI_saimod_mail_action_clone_email($data){
|
||||||
|
foreach($data as $id){
|
||||||
|
$new_id = \SQL\EMAIL_CLONE::QI(array($id),true);
|
||||||
|
\SQL\EMAIL_PLACEHOLDER_CLONE::QI(array($new_id,$id));
|
||||||
|
\SQL\EMAIL_IMAGE_CLONE::QI(array($new_id,$id));
|
||||||
|
}
|
||||||
|
return \JsonResult::ok();
|
||||||
|
}
|
||||||
|
|
||||||
public static function sai_mod__SAI_saimod_mail_action_templates($type=0){
|
public static function sai_mod__SAI_saimod_mail_action_templates($type=0){
|
||||||
$vars = array();
|
$vars = array();
|
||||||
$vars['active_text'] = $type == 0 ? 'active' : '';
|
$vars['active_text'] = $type == 0 ? 'active' : '';
|
||||||
|
|||||||
10
sql/EMAIL_CLONE.php
Normal file
10
sql/EMAIL_CLONE.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
namespace SQL;
|
||||||
|
|
||||||
|
class EMAIL_CLONE extends \SYSTEM\DB\QP {
|
||||||
|
public static function get_class(){return \get_class();}
|
||||||
|
public static function mysql(){return
|
||||||
|
'INSERT INTO email (name,account,sender,subject,template_text,template_html)
|
||||||
|
(SELECT CONCAT("Clone:",name) as name,account,sender,subject,template_text,template_html FROM email WHERE id = ?);';
|
||||||
|
}
|
||||||
|
}
|
||||||
10
sql/EMAIL_IMAGE_CLONE.php
Normal file
10
sql/EMAIL_IMAGE_CLONE.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
namespace SQL;
|
||||||
|
|
||||||
|
class EMAIL_IMAGE_CLONE extends \SYSTEM\DB\QP {
|
||||||
|
public static function get_class(){return \get_class();}
|
||||||
|
public static function mysql(){return
|
||||||
|
'INSERT INTO email_image (`email`,`name`,`file`,`mime`)
|
||||||
|
(SELECT ? as email, name, file, mime FROM email_image WHERE email = ?);';
|
||||||
|
}
|
||||||
|
}
|
||||||
16
sql/EMAIL_LISTS_SELECT_AND_SENT_COUNT.php
Normal file
16
sql/EMAIL_LISTS_SELECT_AND_SENT_COUNT.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
namespace SQL;
|
||||||
|
|
||||||
|
class EMAIL_LISTS_SELECT_AND_SENT_COUNT extends \SYSTEM\DB\QP {
|
||||||
|
public static function get_class(){return \get_class();}
|
||||||
|
public static function mysql(){return
|
||||||
|
'SELECT email_list.*,
|
||||||
|
COUNT(contact_email_list.email) as count_all,
|
||||||
|
COUNT(email_sent.email) as count_sent
|
||||||
|
FROM email_list
|
||||||
|
LEFT JOIN contact_email_list ON email_list.id = contact_email_list.list
|
||||||
|
LEFT JOIN email_sent ON contact_email_list.email = email_sent.email AND email_sent.id = ?
|
||||||
|
GROUP BY email_list.id
|
||||||
|
;';
|
||||||
|
}
|
||||||
|
}
|
||||||
10
sql/EMAIL_PLACEHOLDER_CLONE.php
Normal file
10
sql/EMAIL_PLACEHOLDER_CLONE.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
namespace SQL;
|
||||||
|
|
||||||
|
class EMAIL_PLACEHOLDER_CLONE extends \SYSTEM\DB\QP {
|
||||||
|
public static function get_class(){return \get_class();}
|
||||||
|
public static function mysql(){return
|
||||||
|
'INSERT INTO email_placeholder (`email`,`name`,`type`,`data`)
|
||||||
|
(SELECT ? as email, name, type, data FROM email_placeholder WHERE email = ?);';
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -12,6 +12,7 @@ REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `na
|
|||||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9043, 42, 2, 9000, 'send_email', 'data', 'JSON');
|
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9043, 42, 2, 9000, 'send_email', 'data', 'JSON');
|
||||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9045, 42, 2, 9000, 'update_email', 'data', 'JSON');
|
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9045, 42, 2, 9000, 'update_email', 'data', 'JSON');
|
||||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9047, 42, 2, 9000, 'insert_email', 'data', 'JSON');
|
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9047, 42, 2, 9000, 'insert_email', 'data', 'JSON');
|
||||||
|
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9048, 42, 2, 9000, 'clone_email', 'data', 'JSON');
|
||||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9049, 42, 2, 9000, 'delete_email', 'data', 'JSON');
|
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9049, 42, 2, 9000, 'delete_email', 'data', 'JSON');
|
||||||
|
|
||||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9050, 42, 3, 9000, 'list', 'id', 'UINT0');
|
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (9050, 42, 3, 9000, 'list', 'id', 'UINT0');
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><a href="#!mail(list);id.${id}">${name}</a></td>
|
<td>
|
||||||
|
<a href="#!mail(list);id.${id}">${name}</a><br>
|
||||||
|
${count_sent}/${count_all} Sent
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-sm btn-${btn-color} btn-email-send" ${disabled} list="${id}" email="${email}"><i class="fa fa-send"></i> Send</button>
|
<button class="btn btn-sm btn-${btn-color} btn-email-send" ${disabled} list="${id}" email="${email}"><i class="fa fa-send"></i> Send</button>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -6,10 +6,11 @@
|
|||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>From</th>
|
<th>From</th>
|
||||||
<th>Subject</th>
|
<th>Subject</th>
|
||||||
<th>System Lock</th>
|
<th>Lock</th>
|
||||||
<th>UpdatedAt</th>
|
<th>UpdatedAt</th>
|
||||||
<th>
|
<th>
|
||||||
<button type="button" id="btn-mail-email-del" class="btn btn-sm btn-danger pull-right"><i class="fa fa-trash"></i></button>
|
<button type="button" id="btn-mail-email-del" class="btn btn-sm btn-danger pull-right"><i class="fa fa-trash"></i></button>
|
||||||
|
<button type="button" id="btn-mail-email-clone" class="btn btn-sm btn-warning pull-right" style="margin-right: 5px;"><i class="fa fa-copy"></i></button>
|
||||||
<button type="button" id="btn-mail-email-new" class="btn btn-sm btn-success pull-right" onclick="system.load('mail(email_new)')" style="margin-right: 10px;"><i class="fa fa-plus"></i></button>
|
<button type="button" id="btn-mail-email-new" class="btn btn-sm btn-success pull-right" onclick="system.load('mail(email_new)')" style="margin-right: 10px;"><i class="fa fa-plus"></i></button>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user