Added the ability to identify and present the defined forms to the

adminstrator. The forms are presented as a checklist, I would have
preferred a selection list, but Forge doesn't have one.  The generated
html to contain the recaptcha challenge is defined as <ul> as that was
the only way to force itto line up.
This commit is contained in:
Tim Almdal
2009-01-25 16:35:25 +00:00
parent 1633001d7f
commit 4bb2c53c8f
3 changed files with 52 additions and 15 deletions

View File

@@ -2,10 +2,10 @@
<script type="text/javascript" src="http://api.recaptcha.net/js/recaptcha_ajax.js"></script>
<script>
var site = (document.location.protocol == "http:") ? "<?= $form->recaptcha_site ?>" : "<?= $form->recaptcha_ssl_site ?>";
var RecaptchaOptions = {lang: 'en'};
var RecaptchaOptions = {lang: 'en', theme: "white"};
$("#gAdminRecaptcha form").ready(function() {
$("#gAdminRecaptcha form ul li:last-child").before("<li id=recaptcha_div />");
$("#gConfigureRecaptchaForm").ready(function() {
$("#gConfigureRecaptchaForm :submit").before("<ul><li id=recaptcha_div /></ul>");
$("#public_key").change(function() {
showRecaptcha($(this).val());
});
@@ -22,15 +22,15 @@ function showRecaptcha(public_key) {
dataType: "json",
cache: false,
error: function(request, textStatus, errorThrown) {
var public_key = $("#gAdminRecaptcha form ul li:first-child");
var public_key = $("#gConfigureRecaptchaForm ul li:first-child");
public_key.addClass("gError");
$("#gAdminRecaptcha form ul li:first-child p").replaceWith("");
$("#gConfigureRecaptchaForm ul li:first-child p").replaceWith("");
public_key.append('<p class="gError">' + request.responseText + "</p>");
},
success: function(data, textStatus) {
var public_key = $("#gAdminRecaptcha form ul li:first-child");
var public_key = $("#gConfigureRecaptchaForm ul li:first-child");
public_key.removeClass("gError");
$("#gAdminRecaptcha form ul li:first-child p").replaceWith("");
$("#gConfigureRecaptchaForm ul li:first-child p").replaceWith("");
$("#recaptcha_div").html("<script type='text/javascript'>" + data.script + "</script" + ">");
}
});