import org.codehaus.groovy.grails.plugins.PluginManagerHolder /** * A taglib to ease the loading of Simile libraries */ class SimileTagLib { static namespace = 'simile' def ajax = { attrs -> out.println pluginJS(request?.contextPath, 'ajax/simile-ajax', attrs?.bundle); } def timeline = { attrs -> out.println pluginJS(request?.contextPath, 'timeline/timeline', attrs?.bundle); } def timelineExt = { attrs -> out.println pluginJS(request?.contextPath, "timeline/ext/${attrs?.name}/${attrs?.name}", attrs?.bundle); } def pluginJS(contextPath, lib, bundle) { def p = PluginManagerHolder?.pluginManager.getGrailsPlugin('simile') return "" } def renderTimeline = { attrs -> // get our timeline def timeline = attrs.timeline // figure out our unit type def unitType = Timeline.TYPE_UNITS[timeline.type] def eventSource = "0" if (unitType) { eventSource = "new SimileAjax.EventIndex(${unitType})" } def unitObject = "" switch (timeline.type) { case Timeline.DEPTH_TYPE: unitObject = ".Depth"; break; case Timeline.GEOCHRONO_TYPE: unitObject = ".Geochrono"; break; } out.println """\ """ } }