Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • James Telfer 65 posts 165 karma points
    Sep 16, 2009 @ 14:04
    James Telfer
    0

    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

    Sep 16, 2009 @ 14:11

    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

    }

  • Richard Soeteman 4045 posts 12898 karma points MVP 2x
    Sep 16, 2009 @ 15:18
    Richard Soeteman
    0

    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

  • James Telfer 65 posts 165 karma points
    Sep 16, 2009 @ 15:31
    James Telfer
    0

    Brilliant, that's exactly what I needed - thanks Tim!

    JT

  • James Telfer 65 posts 165 karma points
    Sep 16, 2009 @ 15:32
    James Telfer
    0

    And thanks also to you Richard, I just noticed your answer...

  • Manthos 19 posts 35 karma points
    Oct 05, 2009 @ 14:12
    Manthos
    0

    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
    }

  • Roger Hughes 55 posts 88 karma points
    Oct 14, 2009 @ 15:16
    Roger Hughes
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft