<% ' ---------------------------------------------------------------------- ' ' Page : LoadRicoClient.asp ' Description : Class to load Rico client-side Javascript and CSS ' Author : Matt Brown (dowdybrown@yahoo.com) ' Copyright (C) 2006-2011 Matt Brown ' ' Rico is licensed under the Apache License, Version 2.0 (the "License"); you may not use this ' file except in compliance with the License. You may obtain a copy of the License at ' http://www.apache.org/licenses/LICENSE-2.0 ' ' ---------------------------------------------------------------------- class LoadRicoClient ' Properties Public jsDir ' directory containing Rico's javascript files Public cssDir ' directory containing Rico's css files Public imgDir ' directory containing Rico's image files Public imgHeading ' background image for grid headings and window titles, used in grayedout theme Public BaseLib ' base library - prototype, jquery, etc Public ricoLogging ' enable console logging? Public HTML5 ' enable console logging? Public grid_striping ' apply row striping to LiveGrids? Public LoadBaseLib ' load base Javascript library (prototype, jQuery, etc)? Public jQuery_theme_path ' url to jqueryui themes Public SupportedLangs ' comma-separated list of 2-character codes, representing the files that can be found in jsDir directory. Defaults to ones delivered with Rico. ' Constructor Private Sub Class_Initialize BaseLib="proto_min.js" ' default base library theme="" ricoLogging=false HTML5=false grid_striping = true LoadBaseLib = true SupportedLangs = "de,es,fr,it,ja,ko,pt,ru,uk,zh" jQuery_theme_path = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/" End Sub ' jquery themes start with j-, rico themes start with r- Private theme Public Property Let ricoTheme(ThemeName) SetTheme "r-" & ThemeName End Property Public Property Let jTheme(ThemeName) SetTheme "j-" & ThemeName End Property Private Sub SetTheme(ByVal PrefixedTheme) theme = PrefixedTheme If PrefixedTheme = "r-grayedout" Then imgHeading = "grayedout.gif" End Sub Public Sub SetRicoClientPaths(ByVal jsPath, cssPath, imgPath) jsDir = jsPath cssDir= cssPath imgDir= imgPath End Sub Public Sub SetRicoClientParentPath(ByVal clientDir) if mid(clientDir,len(clientDir),1) <> "/" then clientDir=clientDir & "/" SetRicoClientPaths clientDir & "js/", clientDir & "css/", clientDir & "images/" End Sub ' Used by demo to switch libraries & themes ' Do no call in production Public Sub CheckQueryString() BaseLib=LCase(Request.QueryString("lib")) SetTheme trim(Request.QueryString("theme")) ricoLogging=CBool(trim(Request.QueryString("log")) <> "") end Sub ' This is the main method, which creates the Javscript and CSS links Public Sub CreateLinks() Dim ImgUrl,lang,lang2,i Dim prefix,themeFile Response.Write vbLf & "" if LoadBaseLib then if InStr(baseLib,"/") > 0 then Response.Write vbLf & "" else Response.Write vbLf & "" end if end if requireRicoJS "2" & left(baseLib,3) requireRicoJS "_min" lang=lcase(Request.ServerVariables("HTTP_ACCEPT_LANGUAGE")) arLang=split(lang,",") for i=0 to ubound(arLang) lang2=lcase(left(trim(arLang(i)),2)) if lang2="en" then exit for If InStr(SupportedLangs, lang2) > 0 Then requireRicoJS "Locale_" & lang2 exit for end if next requireRicoCSS "rico" if theme<>"" then prefix=left(theme,1) themeFile=mid(theme,3) select case prefix case "j": requireRicoJS "Themeroller" Response.Write vbLf & "" case "r": requireRicoCSS themeFile end select if grid_striping then Response.Write vbLf & "" end if Response.Write vbLf & "" End sub Public sub requireRicoJS(filename) Response.Write vbLf & "" end sub Public sub requireRicoCSS(filename) Response.Write vbLf & "" end sub End Class %>