| 1 |
<script id="cp_feedback_html<?php print esc_attr($plugin_slug); ?>" type="text/template"> |
| 2 |
<div title="QUICK FEEDBACK"> |
| 3 |
<div style="padding:10px;"> |
| 4 |
<style type="text/css"> |
| 5 |
.cp-feedback-reason-block { margin-top:8px; } |
| 6 |
</style> |
| 7 |
<h3><strong>If you have a moment, please let us know why you are deactivating:</strong></h3> |
| 8 |
<form id="cp_feedback_form{{plugin_slug}}"> |
| 9 |
<?php wp_nonce_field( 'cp-google-maps-feedback', '_wpnonce' ); ?> |
| 10 |
<div class="cp-feedback-reason-block"> |
| 11 |
<label> |
| 12 |
<input type="radio" name="answer" value="cpm-no-map"> |
| 13 |
It is displayed a gray square istead the map.<br /> |
| 14 |
</label> |
| 15 |
<div id="cp_feedback_no_map" style="margin-left:25px;display:none;padding:10px;border:1px dotted gray;color:#660000"> |
| 16 |
<p>Go to the <a href="<?php print esc_attr(admin_url( 'options-general.php?page=codepeople-post-map.php' )); ?>">settings page of the plugin</a> and enter an API Key to be used with your website's domain.</p> |
| 17 |
<p> |
| 18 |
With the API Key you should activate the following APIs:<br> |
| 19 |
- Maps JavaScript API<br> |
| 20 |
- Geocoding API<br> |
| 21 |
</p> |
| 22 |
<p style="font-style:italic;"><a href="https://console.cloud.google.com/google/maps-apis" target="_blank">Google Maps APIs</a></p> |
| 23 |
</div> |
| 24 |
</div> |
| 25 |
<div class="cp-feedback-reason-block"> |
| 26 |
<label> |
| 27 |
<input type="radio" name="answer" value="cpm-api-key-but-no-map"> |
| 28 |
I've entered the API Key but the map is not shown.<br /> |
| 29 |
</label> |
| 30 |
<div id="cp_feedback_api_key_but_no_map" style="margin-left:25px;display:none;padding:10px;border:1px dotted gray;color:#660000"> |
| 31 |
<p> |
| 32 |
There are multiple possible reasons:<br> |
| 33 |
- The map's shortcode has not been inserted in the page's content: [codepeople-post-map].<br> |
| 34 |
- There are not points in the page. Open the page for edition and define at least one point in it.<br> |
| 35 |
- You have defined an API Key, and entered it into the settings page of the plugin, but you have not enabled the required APIs: Maps JavaScript AP, Geocoding API.<br> |
| 36 |
- You've reached the limit of daily or monthly access to the Google APIs for you plan. |
| 37 |
</p> |
| 38 |
|
| 39 |
</div> |
| 40 |
</div> |
| 41 |
<div class="cp-feedback-reason-block"> |
| 42 |
<label> |
| 43 |
<input type="radio" name="answer" value="temporary-deactivation"> It's a temporary deactivation. I'm just debugging an issue.<br /> |
| 44 |
</label> |
| 45 |
</div> |
| 46 |
<div class="cp-feedback-reason-block"> |
| 47 |
<label> |
| 48 |
<input type="radio" name="answer" value="better-plugin"> I found a better plugin.<br /> |
| 49 |
</label> |
| 50 |
<div id="cp_feedback_otherplugin" style="margin-left:25px;display:none;"> |
| 51 |
<input type="text" name="otherplugin" placeholder="What's the plugin name?" style="width:100%"> |
| 52 |
</div> |
| 53 |
</div> |
| 54 |
<div class="cp-feedback-reason-block"> |
| 55 |
<label> |
| 56 |
<input type="radio" name="answer" value="other"> Other.<br /> |
| 57 |
</label> |
| 58 |
<div id="cp_feedback_other" style="margin-left:25px;display:none;font-weight:bold;"> |
| 59 |
Kindly tell us the reason so we can improve.<br /> |
| 60 |
<input type="text" name="otherinfo" style="width:100%"> |
| 61 |
</div> |
| 62 |
</div> |
| 63 |
<div id="cp_feedback_anonymous" style="display:none;margin-top:30px;text-align:right"> |
| 64 |
<input type="checkbox" name="cp_feedback_anonymous" value="yes"> Anonymous feedback |
| 65 |
</div> |
| 66 |
</form> |
| 67 |
</div> |
| 68 |
</div> |
| 69 |
</script> |
| 70 |
<script type="text/javascript"> |
| 71 |
jQuery(window).on( |
| 72 |
'load', |
| 73 |
function() |
| 74 |
{ |
| 75 |
var $ = jQuery, |
| 76 |
plugin_slug = '<?php print esc_js($plugin_slug); ?>', |
| 77 |
support_link = '<?php print str_replace("&","&",esc_js($support_link)); ?>', |
| 78 |
full_support_link = '<?php print str_replace("&","&",esc_js($full_support_link)); ?>'; |
| 79 |
$('[data-slug="'+plugin_slug+'"] .deactivate a'). |
| 80 |
on( |
| 81 |
'click', |
| 82 |
function(evt) |
| 83 |
{ |
| 84 |
evt.preventDefault() |
| 85 |
evt.stopPropagation(); |
| 86 |
// Define events |
| 87 |
$(document).on( |
| 88 |
'change', |
| 89 |
'[id="cp_feedback_form'+plugin_slug+'"] [name="answer"]', |
| 90 |
function() |
| 91 |
{ |
| 92 |
var field = $(this), |
| 93 |
value = field.val(), |
| 94 |
form = field.closest('form'); |
| 95 |
$("#cp_feedback_deactivatebtn:visible").val('Submit & Deactivate'); |
| 96 |
$("#cp_feedback_deactivatebtn:visible").html('<span class="ui-button-text">Submit & Deactivate</span>'); |
| 97 |
form.find("#cp_feedback_anonymous").show(); |
| 98 |
form.find("#cp_feedback_other,#cp_feedback_otherplugin,#cp_feedback_no_map,#cp_feedback_api_key_but_no_map").hide(); |
| 99 |
switch(value) |
| 100 |
{ |
| 101 |
case 'other': |
| 102 |
form.find("#cp_feedback_other").show(); |
| 103 |
break; |
| 104 |
case 'better-plugin': |
| 105 |
form.find("#cp_feedback_otherplugin").show(); |
| 106 |
break; |
| 107 |
case 'cpm-no-map': |
| 108 |
form.find("#cp_feedback_no_map").show(); |
| 109 |
break; |
| 110 |
case 'cpm-api-key-but-no-map': |
| 111 |
form.find("#cp_feedback_api_key_but_no_map").show(); |
| 112 |
break; |
| 113 |
} |
| 114 |
} |
| 115 |
); |
| 116 |
var url_redirect = $('[data-slug="'+plugin_slug+'"] .deactivate a').attr('href'), |
| 117 |
html = $('[id="cp_feedback_html'+plugin_slug+'"]').html(); |
| 118 |
html = html.replace(/\{\{plugin_slug\}\}/g, plugin_slug) |
| 119 |
.replace(/\{\{support_link\}\}/g, full_support_link) |
| 120 |
.replace(/\{\{support_link_text\}\}/g, support_link); |
| 121 |
$(html).dialog( |
| 122 |
{ |
| 123 |
width:'600', |
| 124 |
dialogClass: 'wp-dialog', |
| 125 |
modal: true, |
| 126 |
close: function(event, ui) |
| 127 |
{ |
| 128 |
$(this).dialog("close"); |
| 129 |
$(this).remove(); |
| 130 |
}, |
| 131 |
closeOnEscape: true, |
| 132 |
buttons: [ |
| 133 |
{ |
| 134 |
id: 'cp_feedback_deactivatebtn', |
| 135 |
text: "Skip & Deactivate", |
| 136 |
click: function() |
| 137 |
{ |
| 138 |
var form = $('[id="cp_feedback_form'+plugin_slug+'"]'), |
| 139 |
answer = form.find("input[name='answer']:checked").val(); |
| 140 |
if (answer == undefined || answer == '') |
| 141 |
{ |
| 142 |
window.location.href = url_redirect; |
| 143 |
} |
| 144 |
else |
| 145 |
{ |
| 146 |
var data = { |
| 147 |
'action': 'cp_feedback', |
| 148 |
'feedback_plugin': plugin_slug |
| 149 |
}; |
| 150 |
$.each(form.serializeArray(), function(i,v){data[v['name']] = v['value'];}); |
| 151 |
if(ajaxurl) // WordPress global variable with the AJAX URL |
| 152 |
{ |
| 153 |
$.post( |
| 154 |
ajaxurl, |
| 155 |
data, |
| 156 |
function(response) |
| 157 |
{ |
| 158 |
window.location.href = url_redirect; |
| 159 |
} |
| 160 |
); |
| 161 |
} |
| 162 |
} |
| 163 |
} |
| 164 |
}, |
| 165 |
{ |
| 166 |
text: "We can help: Support Service", |
| 167 |
click: function() |
| 168 |
{ |
| 169 |
window.open(support_link); |
| 170 |
$(this).dialog("close"); |
| 171 |
} |
| 172 |
}, |
| 173 |
{ |
| 174 |
text: "Cancel", |
| 175 |
"class": 'button button-primary button-close', |
| 176 |
click: function() |
| 177 |
{ |
| 178 |
$(this).dialog("close"); |
| 179 |
} |
| 180 |
} |
| 181 |
] |
| 182 |
} |
| 183 |
); // End dialog |
| 184 |
} |
| 185 |
); // End onclick deactivate btn |
| 186 |
} |
| 187 |
); // End onload window |
| 188 |
</script> |