This forum is in permanent archive mode. Our new active community can be found here.

Let's Learn Forum HTML

12346»

Comments

  • Blockquote tag makes ugly indentation if there's no "rel" attribute. Perhaps related to how it flips out when a name has a space.
    Conclusion: New implementation of the blockquote tag in the Vanilla software has regressed. Don't fix it if it ain't broke.
  • I miss Rym, all of a sudden.
  • What you chose to do instead in that other post was definitely annoying, and more importantly, Scott didn't like it and he has all the authority around here.
    Which other post? There's more than 2.

  • I know about the problem with the quoting. I must fix it.
  • As much as I am enjoying double simultaneous trolling of Scott, it is sort of killing the point of the thread. :/
    However, I toughly endorse said Scott-trolling. This leaves me feeling somewhat split.
  • edited November 2011
    Okay, I looked into the Vanilla code, and it would appear that all you need to do is set the values of
    Garden.User.ValidationRegex
    and
    Garden.User.ValidationLength
    to whatever you want them to be.

    Apparently this should be done in
    conf/config.php

    With that in mind, it should be pretty easy to fix the issues with quoting and usernames.
    Post edited by lackofcheese on
  • Okay, I looked into the Vanilla code, and it would appear that all you need to do is set the values of
    Garden.User.ValidationRegex
    and
    Garden.User.ValidationLength
    to whatever you want them to be.

    Apparently this should be done in
    conf/config.php

    With that in mind, it should be pretty easy to fix the issues with quoting and usernames.
    If only it were so simple. I tried that already, and it caused every single post in the entire forum to be blank.
  • edited November 2011
    So, in your current installation, those configuration values aren't even defined, right?

    Perhaps it's only being handled this way in the latest version of Vanilla, or maybe you made a mistake in the configuration?

    Here's what I've found out:
    The quoting plugin uses the ValidateUsernameRegex function, defined in functions.validation.php, to retrieve the regex it's supposed to use to validate usernames.

    Note: the C() function just retrieves the value of a configuration setting, with the second argument being the default value.

    Consequently, it would seem that the default values for these parameters are effectively defined by this code (within the ValidateUsernameRegex function):

    if (is_null($ValidateUsernameRegex)) {
    $ValidateUsernameRegex = sprintf("[%s]%s",
    C("Garden.User.ValidationRegex","\d\w_"),
    C("Garden.User.ValidationLength","{3,20}"));
    }


    So, judging by the configuration file, if you were to manually add the lines:

    $Configuration['Garden']['User']['ValidationRegex'] = '\d\w_'
    $Configuration['Garden']['User']['ValidationLength'] = '{3,20}'

    to config.php, the forum ought to behave exactly the way it does normally (assuming that your Vanilla code is the same version as the Github code I'm linking).

    On the other hand, you could change it to be something else. Judging by the syntax there, it looks like ValidationRegex represents the valid values for a single character, while ValidationLength is the number of such characters allowed.

    If you don't like this approach, you can also define your own ValidateUsername or ValidateUsernameRegex function.
    Post edited by lackofcheese on
  • It would also be nice to make it so that the preview actually renders blockquotes correctly, but I'm not sure exactly how the preview is set up at the moment.
  • I knew everything you said about the username regex. I tried putting in a fancy regex, and it didn't work. I might have to try a less fancy regex, but not sure if it will cause issues with being too permissive.

    The preview I think is some fancy js thing. See, when Vanilla renders a post, it sends it through a reformatter. That's how a youtube url can become a youtube embed. The js preview seems to just take your post and render it directly. To have the preview show the exact same thing as the final result you would need to post the comments via AJAX to the forum so it could rewrite them and return to you the rendered post in JSON. Then the exact same code that usually does the rewriting of real posts would be used on previews. Maybe the new version of the forum does this? This is not something a plugin can do. It has to be a patch to Vanilla itself.
  • edited November 2011
    I knew everything you said about the username regex. I tried putting in a fancy regex, and it didn't work. I might have to try a less fancy regex, but not sure if it will cause issues with being too permissive.
    If you manually add the effective default values of '\d\w_' and '{3,20}', does it still work as normal?

    Also, what do you mean by 'fancy regex' in this case?
    The preview I think is some fancy js thing. See, when Vanilla renders a post, it sends it through a reformatter. That's how a youtube url can become a youtube embed. The js preview seems to just take your post and render it directly. To have the preview show the exact same thing as the final result you would need to post the comments via AJAX to the forum so it could rewrite them and return to you the rendered post in JSON. Then the exact same code that usually does the rewriting of real posts would be used on previews. Maybe the new version of the forum does this? This is not something a plugin can do. It has to be a patch to Vanilla itself.
    I looked into it; it doesn't seem all that bad.
    As far as I can tell, the preview seems to be this:
    https://github.com/vanillaforums/Garden/blob/master/applications/vanilla/views/post/preview.php
    while the usual comments are done by the WriteComment function:
    https://github.com/vanillaforums/Garden/blob/master/applications/vanilla/views/discussion/helper_functions.php

    Basically, the quoting plugin hooks into two different controllers, the PostController and the DiscussionController; the former of the two being responsible for the preview and so forth, while the latter is responsible for the comments as displayed within the forum itself.

    It shouldn't be hard to fix, though I don't have the time at the moment, nor an easy way to do any testing.
    Post edited by lackofcheese on
  • edited November 2011
    From what I can tell, you would basically just have to add a new event handler into the quoting plugin, which would be called:
    PostController_BeforeCommentPreviewFormat_Handler
    and would use the RenderQuote function from the quoting plugin to render quotes properly. There may be further complications, but the framework does offer you the ability to use those event handlers.

    In fact, if we're lucky, you may only need to add 3 lines to the quoting plugin:


    public function PostController_BeforeCommentPreviewFormat_Handler($Sender) {
    $this->RenderQuotes($Sender);
    }

    There may be a need for some minor adaptation to the approach used, but it should be something very basic along these lines.
    Post edited by lackofcheese on
  • edited November 2011
    Okay, I suspect that isn't quite right, because I think there's a very minor issue - the RenderQuotes function is looking for $Sender->EventArguments['Object']
    while in the case of the preview (managed by the PostController) I think it's only defining EventArguments['Comment'] instead.

    In that case, either RenderQuotes should always use Comment instead of Object (this makes more sense to me), or you may need to give it an additional argument so that it can use Comment in the case of the preview handler, but Object otherwise.

    Still pretty easy, on the whole.
    Post edited by lackofcheese on
  • edited November 2011
    The preview I think is some fancy js thing. See, when Vanilla renders a post, it sends it through a reformatter. That's how a youtube url can become a youtube embed. The js preview seems to just take your post and render it directly.
    Actually, if you try using the preview function, you'll note that it does in fact render youtube videos the same way that they are rendered in the actual posts. The only difference is that the additional quote rendering is not being done, which is the fault of the quoting plugin - this should be fixed by adding an additional event handler and a minor fix to the quoting plugin.
    Post edited by lackofcheese on
  • Bumping to make sure that Scott sees this stuff I posted w.r.t. the preview function.
  • edited November 2011
    is this working?

    ah so yes it is.
    Post edited by KapitänTim on
Sign In or Register to comment.