Copied to clipboard

Flag this post as spam?

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


  • Matt Taylor 873 posts 2086 karma points
    Sep 06, 2012 @ 11:37
    Matt Taylor
    0

    Website "http://" default

    The basic install of uBlogsy V2.1.1 relies on "http://" being stored in the comment 'Website' field.
    Of course for external links "http://" needs to be at the beginning otherwise it's assumed it's a local link and it won't work.

    The problem comes if the user saves their website without "http://" at the front or indeed saves a blank string.
    The razor scripts in the package will display "website : " in comment listings if the 'Website' field is completely blank and will display a bad link if the 'Website' field is missing the "http://" prefix altogether.

    Whether you consider this a bug or not depends on how much you expect the package to work out of the box.
    I'm quite happy to and in all cases will have to do some customisation so I don't mind dealing with this kind of thing myself.

    I wouldn't think that adding business logic rules to the assembly is the answer, but maybe some changes to the razor scripts to deal with these anomalies.

    Regards,

    Matt

     

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Sep 06, 2012 @ 21:45
    Anthony Dang
    0

    I'm not sure what the issue is.

    The contact form automatically includes the http when rendering.

    Are you saying that people will remove this? In that case, perhaps some client side validation?

     

  • Matt Taylor 873 posts 2086 karma points
    Oct 24, 2012 @ 17:22
    Matt Taylor
    0

    Yes, some people might remove it or perhaps a form filling browser plugin.

    Client side scripting or handling the various cases in the Razor scripts that output this field is cool.
    The latter is what I have done.

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Nov 01, 2012 @ 00:22
    Anthony Dang
    0

    Can you show me what you've done?

     

  • Matt Taylor 873 posts 2086 karma points
    Nov 02, 2012 @ 12:32
    Matt Taylor
    0

    Sure Anthony,

    I amened uBlogsyListComments.cshtml with some code like this:

    @if ((@c.GetProperty("uBlogsyCommentWebsite").Value.Trim() != "http://") & (@c.GetProperty("uBlogsyCommentWebsite").Value.Trim() != String.Empty))    
    {   
        string website = @c.GetProperty("uBlogsyCommentWebsite").Value.Trim();   
        if ((website.Substring(0, 7) != "http://") & (website.Substring(0, 8) != "https://"))   
        {
            website = "http://" + website;
        }
        <div>
            Website : <a href="@website" rel="external nofollow" target="_blank">@website</a>
        </div>
    }

    Basically first check if there's a website entered, if not then leave it.
    If there is, make sure it's got the correct http prefixes.

    Regards,

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft