Friday, 26 April 2013

Practical Example of using Web CSharpREPL in TeamMentor’s development/customizations

Kofi asked me a couple days ago for practical examples of using the CSharpRepl that is included in TeamMentor’s Admin pages.

Well here is one.

I am currently writing a couple customizations for a TeamMentor client which are deployed/applied via the (new to 3.3.) UserData WebRoot_Files folder.
This means that, for example, to change the top banner shown in the main TM GUI, we can create custom versions of the main TM files in this folder (included as part of the UserData repo):

image 

These files will be ‘copied in place’ of the original versions in the main TM web root.

Here is the code that does this ‘copy’:

image

The only problem is that the copy_FilesIntoWebRoot method is called from this SetUp method (which yes, needs some refactoring :) )

image

This SetUp  method  is the one responsible for loading all data (plush a bunch of git syncs) and is not really needed here, since all we want is to copy the new versions of the files in the WebRoot_Files folder into TM's web root.

In practice this means that either we make the customization changes directly on the ‘files-to-be-over-written’ location (not a good idea) or we trigger the SetUp method after editing the files in the UserData repo (which can take some time if there are lots of libraries configured)

The other way to do it, is to invoke the copy_FilesIntoWebRoot  method directly :)

Which can’t be done via any existing GUI action, but can be easily done via the CSharpREPL GUI, like this:

image

So, not only I use the TM CSharpRepl editor for advanced debugging sessions, I also very regularly use it to perform actions currently not supported by the existing API’s or GUIs :)
Post a Comment