%! from splunk.appserver.mrsparkle.lib import times %> <% timeRanges = times.getTimeRanges(namespace=APP['id']) customTimes = [] for t in timeRanges: item = {} if "is_sub_menu" in t: continue for k in ("earliest_time", "latest_time", "label", "header_label"): if k in t: if k in ('label', 'header_label'): item[k] = _(t[k]) else: item[k] = t[k] customTimes.append(item) jsonOutput = jsonify(customTimes) %> <%page args="module"/> <%namespace name="lib" file="//lib.html" import="*"/> <%call expr="lib.add_script_block()"> Splunk.Module.loadParams.${module['id']}.customTimeHeaders = ${jsonOutput}; %call>