Detect if DataEditor rendered in Umbraco administration or AutoForm
Hi All,
I'm having a go at creating a control based on reCAPTCHA that will allow a user to easily include a CAPTCHA in an AutoForm/doc2form. I have a large part of it complete, but I'm struggling to understand how I can detect the context of the control.
When a node is edited in the back-end interface, I'd like the editor to detect this and render differently. It makes no sense for an administrator to be required to fill in the CAPTCHA to save the item in the back end.
I was thinking that the ILiveEditingDataEditor interface would be the way to go, but after looking at the AutoForm and doc2form source, I don't think this is respected.
Is there a convention I should use, or is this just not supported?
I hope I've explained this well enough; let me know if any more information is required.
Detect if DataEditor rendered in Umbraco administration or AutoForm
Hi All,
I'm having a go at creating a control based on reCAPTCHA that will allow a user to easily include a CAPTCHA in an AutoForm/doc2form. I have a large part of it complete, but I'm struggling to understand how I can detect the context of the control.
When a node is edited in the back-end interface, I'd like the editor to detect this and render differently. It makes no sense for an administrator to be required to fill in the CAPTCHA to save the item in the back end.
I was thinking that the ILiveEditingDataEditor interface would be the way to go, but after looking at the AutoForm and doc2form source, I don't think this is respected.
Is there a convention I should use, or is this just not supported?
I hope I've explained this well enough; let me know if any more information is required.
Cheers,
James Telfer
Comment author was deleted
Hi James,
I recently used this to check if a datatype was currently in Canvas:
if (!GlobalSettings.RequestIsInUmbracoApplication(HttpContext.Current) && umbraco.presentation.UmbracoContext.Current.LiveEditingContext.Enabled)
{
// Canvas
}
Hi James,
A little snippet I'm always using is
if (Page is umbraco.BasePages.BasePage)
{
//Okay we are in Umbraco do your actions
}
Hope it helps you,
Richard
Brilliant, that's exactly what I needed - thanks Tim!
JT
And thanks also to you Richard, I just noticed your answer...
I was just wandering... is the code above better or worst than to check the session variable "UmbracoLiveEditingMode" with:
if (Session["UmbracoLiveEditingMode"] != null && bool.Parse(Session["UmbracoLiveEditingMode"].ToString())
{
// Canvas
}
Hi James, Did you manage to get a captcha working on autoform?
I have been asked to add one to a front end autoform control and was wondering how best to implement it.
Thanks
Rog
is working on a reply...