Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Tenzing
/
Tz Tools
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
26d657cd
authored
2024-04-08 14:31:15 -0400
by
Jeff Balicki
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
upload to Notifications
Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent
58de2c30
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletions
com/Notifications/Admin.php
com/Notifications/views/create.php
com/Notifications/Admin.php
View file @
26d657c
...
...
@@ -523,6 +523,9 @@ function create_notification()
update_post_meta
(
$id
,
'style'
,
$style
);
update_post_meta
(
$id
,
'system'
,
$systemMessageData
);
update_post_meta
(
$id
,
'push'
,
$pushMessageData
);
if
(
!
empty
(
$_POST
[
'report_ids'
])){
update_post_meta
(
$id
,
'report_ids'
,
$_POST
[
'report_ids'
]);
}
$flash
=
"<strong>Notification Saved Successfully!</strong><br /><a href='/wp-admin/admin.php?page=notifications'>Click here</a> to view all notifications.</a>"
;
require_once
__DIR__
.
'/views/create.php'
;
...
...
com/Notifications/views/create.php
View file @
26d657c
...
...
@@ -121,7 +121,7 @@ $event_newsletterFr = get_post($event_newsletterFrId);
<tr
class=
"scheduled_sendto"
>
<td>
Sent To:
</td>
<td>
<select
name=
"sendto"
class=
"wide-input-field"
>
<select
id=
"sendto"
name=
"sendto"
class=
"wide-input-field"
>
<option
value=
"nousers"
<?php
echo
(
$validation
->
set_value
(
'sendto'
)
==
"nousers"
)
?
'selected="selected"'
:
""
;
?>
>
No Users
</option>
...
...
@@ -137,9 +137,17 @@ $event_newsletterFr = get_post($event_newsletterFrId);
)
==
$group
->
getID
())
?
'selected="selected"'
:
""
;
?>
>
<?php
echo
$group
->
getName
();
?>
</option>
<?php
};
?>
<option
value=
"uploadlist"
<?php
echo
(
$validation
->
set_value
(
'sendto'
)
==
"uploadlist"
)
?
'selected="selected"'
:
""
;
?>
>
Upload List by CSV
</option>
</optgroup>
</select>
<?php
echo
$validation
->
form_error
(
'sendto'
);
?>
<div
id=
"uploadcsv"
style=
"display:none;"
>
<input
type=
"file"
name=
"uploadCSVlist"
id=
"uploadCSVlist"
/>
<div
id=
"users_count"
style=
"display:none;"
>
</div>
</div>
</td>
</tr>
...
...
@@ -341,6 +349,37 @@ endforeach;
<script>
jQuery(document).ready(function($) {
$(document).on('change', '#sendto', function() {
if ($(this).val() == 'uploadlist') {
$(this).hide();
$('#uploadcsv').show();
}
});
$('#uploadCSVlist').on("change", function(){
var file = this.files[0];
var formdata = new FormData();
formdata.append("uploadCSVlist", file);
formdata.append("action", "upload_users_by_csv");
$.ajax({
url: '/wp-admin/admin-ajax.php',
type: 'POST',
data: formdata,
contentType: false,
processData: false,
success: function(data) {
const obj = JSON.parse(data);
console.log(obj.users);
$('#users_count').html(''+obj.users.length+' Users Added').css('color','green').show();
$('#users_count').append('<input type="hidden" name="report_ids" value="' + obj.users.join(',') + '">');
$('#users_count').append('<input type="hidden" name="sendto" value="report"');
}
});
});
var codeCleaned = false;
$('#submit').on('click', function() {
...
...
Please
register
or
sign in
to post a comment