CommunityServer 1.1 , admin add links script error…

 


crosspost from http://rex.la/blogs/work/


It’s a minor but annoying problem for CommunityServer 1.1 . solved couple weeks ago.


When adding links in administration page, there will always have client javascript error saying that it must have a “)” exist. the count of the same error had a pattern related to the link category added, means if there were 5 categories there, everytime entering the link admin page, there will be 5 script error poped up.


After a dig into the source code, found the problem is caused by resource file. when the link page is rendering , there will be a block of javascript using a resource file error message inside a string variable. this variable using ” ‘ ” to embrace the string and happened that the resource string also got ” ‘ ” inside it, thus caused that whole javascript statement incorrect and cause the error.


the recourse file used is English resource file, located in /communityserver-website/Languages/en-US/Resources.xml , there is a resource at line 2482 like this:


<resource name = “ManageLinks_ConfirmDeleteCategory”>Are you sure you want to delete this category? All of it’s child links will be deleted as well.</resource>


the code that cause error is at the category delete button onclick event. which is like this:


onclick=”return confirm(‘Are you sure you want to delete this category? All of it’s child links will be deleted as well.‘);”


as obviously, that is the “it’s” inside the ” ‘ ” string that caused the error, which is the resource string above.


to solve this, just remove the ” ‘ ” of that “it’s” to “its” or some other things that don’t have a ” ‘ ” inside, then it’s done, no source code modification is needed.


A better way to solve this should be modify the source code checking the output string to see if it conflict the string formation in javascript layout.


A mirror post to CommunityServer Forum about this issue is posted at http://communityserver.org/forums/508956/ShowThread.aspx#508956 . hope this helps…


Technorati Tags: communityserver , asp.net , programming


 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>