Forums

adding javascript functions

  • hello,

    I wonder if it is possible to add javascript functions to a post. If anybody knows how to do could you give me the clue.

    Thank's to all 

    Eric Vantroeyen Montpellier - France
  • In the MarkUp HTML section of your communityserver.config file (located in the site root directory)  add

    <script src="true" type="true" />

    Works (both in FTB in CS 2.0 and TinyMCE in CS 2.1)

    -Dave

     

  • But won't this allow javascript to run in Weblog Posts AND Forum posts AND Blog comments AND.... really just about everywhere...??

    I have resisted this approach becuase I was afraid it would enable javascript for the discussion posts by my users, which isn't really desirable. I would like to enable Javascript in only the Weblog Posts on my site, but not anywhere else. Is this possible, or would I need to find a different solution?

    Or maybe is there a security/role way of allowing/disallowing the markup for various users?

    -Thanks
    Max

  • Max,

    No, you're right.  This is site-wide.  I should have mentioned that.  Typically you would enable <script /> for personal single-blog sites only.

    Thanks for mentioning that.

    Dave

     

  • daveburke:

    Max,

    No, you're right.  This is site-wide.  I should have mentioned that.  Typically you would enable <script /> for personal single-blog sites only.

    Thanks for mentioning that.

    Dave

     

    It seems like you can do one of the following to enable script tags for weblog posts only:

    1. Edit the CommunityServer.Blogs.Components.PostandArticleHtmlScrubbing Module and comment out the line that Html Scrubs FormattedBody 
    2. Remove the CS Module "PostandArticleHtmlScrubbing". This will eliminate scrubbing of both the Excerpt and the FormattedBody, but if it is your own site (and your own blog), it seems you should be pretty safe.
    3. Or merge 1 and 2 here. Remove the PostandArticleHtmlScrubbing module, create your own similar Module that comments out the line for formattedbody but leaves the line in for scrubbing the Excerpt and add that into the Modules section.

    As far as I can tell this will work and ONLY affect Weblog Posts (or Articles). It IS eliminating all <tag> checking on these so everythign will make it through, but since its just for Blog posts, it seems like a decent solution as long as you can trust yourself not to hijack your own site ;-)

    -Max

  • And so after doing these modifications,

    Do I simply add a bloc <script> ... </script> in the HTML part of the post ?

     

    Eric Vantroeyen Montpellier - France
  • First, what version are you looking at.  In Telligent Community 5.0, inside the communityserver.config, there's a CSModule called "WeblogPostandArticleHtmlScrubbing" - you can comment out or remove that module and you can then add <script> tags to blog posts (using the HTML view).  Please note, however, that in Telligent Community 5.0, blogs are a little less controlled than in other versions because blogs are contained within groups and it's easier to have regular system users as bloggers.  

    I thought there was another module that handled blog comment scrubbing and this may be handled by the ForumHtmlScrubbing module but there are no rich text editors in blog comments that allow a user to go into HTML to create script tags so all text is encoded to text (you can't create a script tag, it becomes <script>, etc).

    I ran into a problem playing with this, however - when I commented out the module, I added <script>alert('Hi!');</script> but it got rendered in a way that was visible in source but wouldn't execute.  That might be something caused by the editor or nesting correction or something - I'm not sure.

    Hopefully this took care of your questions, though!  Let me know if you could use clarification on any of this!