Skip to content

Commit a5647f0

Browse files
authored
Merge pull request #3 from jmanzo/master
solved - show message and take the user to the jobs page
2 parents 2c8b49a + 5c321be commit a5647f0

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

admin/jobs.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ function scripted_create_current_jobs_callback()
88
$ID = get_option( '_scripted_ID' );
99
$accessToken = get_option( '_scripted_auccess_tokent' );
1010
$paged = (isset($_GET['paged']) and $_GET['paged'] !='') ? sanitize_text_field($_GET['paged']) : '';
11-
$per_page = 15;
12-
$validate = validateApiKey($ID,$accessToken);
13-
$out = '<div class="wrap">
14-
<div class="icon32" style="width:100px;padding-top:5px;" id="icon-scripted"><img src="'.SCRIPTED_LOGO.'"></div><h2>Jobs</h2>';
11+
$per_page = 15;
12+
$validate = validateApiKey($ID,$accessToken);
13+
$out = '<div class="wrap">';
14+
15+
if ( $_GET['auth'] )
16+
$out .= '<div class="notice notice-success" id="message"><p>Great! Your code validation is correct. Thanks, enjoy...</p></div>';
17+
18+
$out .= '<div class="icon32" style="width:100px;padding-top:5px;" id="icon-scripted"><img src="'.SCRIPTED_LOGO.'"></div><h2>Jobs</h2>';
1519

1620
$filter = (!isset($_GET['filter'])) ? 'all' : sanitize_text_field($_GET['filter']);
1721
$jobUrl = ($filter !='all') ? 'jobs/'.$filter : 'jobs/';
18-
22+
1923
if($validate) {
2024
$url = ($paged != '') ? $jobUrl.'?next_cursor='.$paged : $jobUrl;
2125
$result = curlRequest($url);
@@ -57,7 +61,7 @@ function scripted_create_current_jobs_callback()
5761

5862
$paggination .='<span class="pagination-links">
5963
<span class="displaying-num">'.$totalProjects.' items</span>
60-
<a href="admin.php?page=scripted_current_jobs&paged='.$next.'&filter='.$filter.'" title="Go to the next page" class="next-page '.$nextPage.'">&rsaquo;</a>';
64+
<a href="admin.php?page=scripted_jobs&paged='.$next.'&filter='.$filter.'" title="Go to the next page" class="next-page '.$nextPage.'">&rsaquo;</a>';
6165

6266
$paggination .='</span>
6367
</div>
@@ -165,7 +169,7 @@ function finishedProjectActions(proId,actions) {
165169
type: 'POST',
166170
url: '<?php echo wp_nonce_url( admin_url('admin-ajax.php'), 'create_reject_accept' );?>&do='+actions+'&project_id='+proId+'&action=scripted_poject_finished',
167171
data: '',
168-
success: function(data) {
172+
success: function(data) { console.log(data);
169173
if(actions == 'Accept')
170174
jQuery("#accept_"+proId).html(data);
171175
else if(actions == 'Reject')

admin/settings.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,13 @@ function scripted_settings_menu_function() {
5858
$validate = validateApiKey($_POST['ID_text'],$_POST['success_tokent_text']);
5959
if($validate) {
6060
update_option( '_scripted_ID', sanitize_text_field($_POST['ID_text']) );
61-
update_option( '_scripted_auccess_tokent', sanitize_text_field($_POST['success_tokent_text'] ));
62-
echo '<div class="notice notice-success" id="message"><p>Great! Your code validation is correct. Thanks, enjoy...</p></div>';
63-
} else {
61+
update_option( '_scripted_auccess_tokent', sanitize_text_field($_POST['success_tokent_text'] )); ?>
62+
63+
<script type="text/javascript">
64+
window.location = '<?php echo admin_url('/admin.php?page=scripted_jobs&auth=true') ?>';
65+
</script>
66+
67+
<?php } else {
6468
echo '<div class="notice notice-error" id="message"><p>Sorry, we found an error. Please confirm your Organization Key and Access Token are correct and try again.</p></div>';
6569
}
6670
}

0 commit comments

Comments
 (0)