Repository navigation
Expand file tree
/
Copy patharticle-mail.php
More file actions
executable file
·141 lines (125 loc) · 6.47 KB
/
Copy patharticle-mail.php
File metadata and controls
executable file
·141 lines (125 loc) · 6.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
get_header('common');
$errors = '';
?>
<script type="text/javascript" >
function ajax_submit_email_article(invoker) {
var ajaxurl = '<?php echo admin_url( 'admin-ajax.php' ); ?>';
var caller = jQuery(invoker);
var form = caller.closest('form');
if (form.find('.alert').length) {
form.find('.alert').remove();
}
var data = {
'to': jQuery('#to').val(),
'cc': jQuery('#cc').val(),
'bcc': jQuery('#bcc').val(),
'article_id': <?php echo get_the_ID(); ?>,
'action': 'mail_article'
};
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
jQuery.post(ajaxurl, data, function(response) {
if (response == '1') {
form.prepend("<div class='alert alert-success'>Mail sent</div>");
}
else {
form.prepend("<div class='alert alert-danger'>"+response+"</div>");
}
jQuery("html, body").animate({ scrollTop: 0 }, "slow");
});
return false;
}
jQuery(document).ready(function($) {
});
</script>
<div id="content">
<div id="rtEmail">
<?php
if(!empty($_GET['to']) && $_GET['to'] == 'author')
$mail_author = true;
else
$mail_author = false;
?>
<h2 id="section-title">
<?php if($mail_author) { ?>
Email the author
<?php } else { ?>
Notify colleague
<?php } ?>
</h2>
<form method="post" id="emailForm">
<table class="data" width="100%">
<?php if(!$mail_author) {
?>
<tr valign="top">
<td class="label" width="20%">To</td>
<td width="80%" class="value">
<input type="text" name="to" id="to" size="40" maxlength="120" class="textField" />
</td>
</tr>
<tr valign="top">
<td class="label">CC</td>
<td class="value">
<input type="text" name="cc" id="cc" size="40" maxlength="120" class="textField" />
</td>
</tr>
<tr valign="top">
<td class="label">BCC</td>
<td class="value">
<input type="text" name="bcc" id="bcc" size="40" maxlength="120" class="textField" />
</td>
</tr>
<?php } ?>
<!--<tr valign="top">-->
<!-- <td colspan="2"> </td>-->
<!--</tr>-->
<tr valign="top">
<td colspan="2"> </td>
</tr>
<tr valign="top">
<td class="label">From</td>
<td class="value">admin@ijme.in</td>
</tr>
<tr valign="top">
<td width="20%" class="label">Subject</td>
<td width="80%" class="value">
<input type="text" id="subject" name="subject" value="[IJME] <?php echo htmlentities(get_the_title()); ?>" size="50" maxlength="120" class="textField" />
</td>
</tr>
<tr valign="top">
<td class="label">Body</td>
<?php
$issue_id = get_post_meta(get_the_ID(),'issue_post_id',true);
$authors = get_post_meta(get_the_ID(), 'authors', true);
if(!empty($authors)) {
$authors_array = array();
foreach ($authors as $author) $authors_array[] = $author['last_name'] . ' ' . $author['first_name'];
$message = 'Thought you might be interested in seeing "'.get_the_title().'" by '.implode(',',$authors_array).' published in Vol '.get_post_meta($issue_id,'volume',true).', No '.get_post_meta($issue_id,'number',true).' ('.get_post_meta($issue_id,'year',true).') of '.get_bloginfo('name').' at "'.get_permalink().'".';
}else{
$message = 'Thought you might be interested in seeing "'.get_the_title().'published in Vol '.get_post_meta($issue_id,'volume',true).', No '.get_post_meta($issue_id,'number',true).' ('.get_post_meta($issue_id,'year',true).') of '.get_bloginfo('name').' at "'.get_permalink().'".';
}
?>
<td class="value"><textarea name="body" cols="50" rows="15" class="textArea"><?php echo htmlentities($message); ?></textarea></td>
</tr>
</table>
<!--<p><input name="send" type="submit" value="Send" class="button defaultButton" onclick="ajax_submit_email_article(this);" /></p>-->
<p><a class="button defaultButton" href="javascript:void(0);" onclick="ajax_submit_email_article(this);" >Send</a></p>
</form>
</div>
</div>
<?php
}
}
else {
?>
Unknown article
<?php
}
?>
<div class="separator"></div>
<input type="button" onclick="window.close()" value="Close" class="button defaultButton">
<div class="separator"></div>
<?php get_footer('common'); ?>