[mapguide-users] Automatic custom javascript loading in AjaxViewer

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Wed Jan 14 06:43:33 EST 2009


This would load all js files for every weblayout application?
Could this be tweaked to somehow take the WebLayout into consideration,
so layout1 loads some files, and layout2 loads others?

The problem with including such functionality, is that there are three 
different languages (php, jsp and aspx),
and you will need all three versions of the code before it can be 
included in an official release.

If you are considering advanced customization/expansion, the Fusion 
framework is much more flexible,
and can handle something like this already, through the use of widgets.
I would like to encourage you to try switching to this framework instead.

Regards, Kenneth Skovhede, GEOGRAF A/S



Bruno Scott skrev:
> I propose a new enhencement to the AjaxViewer, the ability to the ajaxviewer
> to automatically include javascript files at load time
>
> In mainframe.aspx
>         ...
>         //Scans the customjs directory for custom client javascript files
>         String clientJSInclude = "";
>         String strExt = "*.js";
>         String strPath = Request.PhysicalApplicationPath + "..\\customjs";
>         try
>         {
>           String[] files = Directory.GetFiles(strPath, strExt,
> SearchOption.TopDirectoryOnly);
>           foreach(String file in files)
>           {
>             clientJSInclude += "\n<script language=\"javascript\"
> src=\"../customjs/" + System.IO.Path.GetFileName(file) + "\"></script>";
>           }
>         }
>         catch(Exception e){}
>         
>         //load the HTML template and format it
>         //
>         String template = MgLocalizer.Localize(LoadTemplate(Request,
> "../viewerfiles/mainframe.templ"), locale, GetClientOS(Request));
>         String[] args = {
>                     webLayout.GetTitle(),
>                     clientJSInclude,
>                     ...
>
> In mainframe.templ
> Just add un new %s after the existing <script ...>
>
>
> The advantages of this new features
>
>   1) no need to have aspx,php (post enabled) files in any frames
>   2) it much more easy to add specific user function ( UI based ) without
> having the huge task pane displayed
>   3) possible to create <div> on the fly to create sexy ExtJS type UI
>   4) very easy to use mapguide "Invoke Script" command, it just the matter
> of typing the javascript function.
>   5) very easy for developpers to maintain, just copy the js files in the
> www\customjs directory
>
> Of course i can create a ticket for this, and Diff Patches for php and
> DotNet
>
> Bruno Scott
>
>
>   


More information about the mapguide-users mailing list