[%# $Id: _func.html,v 1.16 2005/11/28 10:23:10 stephens Exp $ %] [%# Import Globals %] [% SET global.js = js %] [% SET global.url = url %] [% SET global.table = table %] [% SET global.ctlr = ctlr %] [% SET global.style = style %] [% SET global.body = body %] [%# JavaScript %] [% BLOCK include_js %] [% DEFAULT global.js.$n = 0 %] [% UNLESS global.js.$n %] [% SET global.js.$n = 1 %] [% END %] [% END %] [%# Colors %] [% MACRO color(name) BLOCK %] /* color([% name %]) => */ [% tmp.color = name && global.table.style.get('name', "color.${name}") %] [% IF tmp.color %] [% IF tmp.color.value.match('^(rgb|#)') %] [% tmp.color.value %] [% ELSE %] [% color(tmp.color.value) %] [% END %] [% ELSE %] [% name %] [% END %] [% END %] [%# Images %] [% IF global.ctlr.cgi.user_agent.match('MSIE') %] [% SET default.image.suffix = 'gif' %] [% ELSE %] [% SET default.image.suffix = 'png' %] [% END %] [% MACRO get_image(name, x, y) BLOCK %] [% END %] [% MACRO image_or_blank(name, x, y) BLOCK %] [% tmp.image = name && global.table.image.get(name) %] [% IF x || y %] [% SET tmp.image = tmp.image.render('xmax', x, 'ymax', y, 'suffix', default.image.suffix) %] [% ELSE %] [% SET tmp.image = tmp.image.render('suffix', default.image.suffix) %] [% END %] [% IF tmp.image %] [% tmp.image.html %] [% END %] [% END %] [% MACRO image(name, x, y) BLOCK %] [% tmp.image = global.table.image.get(name) %] [% IF x || y %] [% SET tmp.image = tmp.image.render('xmax', x, 'ymax', y, 'suffix', default.image.suffix) %] [% ELSE %] [% SET tmp.image = tmp.image.render('suffix', default.image.suffix) %] [% END %] [% IF tmp.image %][% tmp.image.html %][% ELSE %]Unknown Image: [% name %][% END %] [% END %] [% MACRO image_url(name, x, y) BLOCK %] [% tmp.image = global.table.image.get(name) %] [% IF x || y %] [% SET tmp.image = tmp.image.render('xmax', x, 'ymax', y, 'suffix', default.image.suffix) %] [% ELSE %] [% SET tmp.image = tmp.image.render('suffix', default.image.suffix) %] [% END %] [% tmp.image.file.href %] [% END %] [% MACRO image_link_no_r(name, link, x, y) BLOCK %] [% SET tmp.image = global.table.image.get(name) %] [% IF link == '*SELF*' %] [% SET link = "/${tmp.image.file}" %] [% END %] [% IF x || y %] [% SET tmp.image = tmp.image.render('x', x, 'y', y) %] [% END %] [% IF tmp.image %][% tmp.image.html('link', link) %][% ELSE %][[% name %]][% END %] [% END %] [% MACRO image_link(name, link, x, y) BLOCK %] [% image_link_no_r(name, link, x, y) %] [% END %] [% MACRO image_link_self(name, x, y) BLOCK %] [% image_link_no_r(name, '*SELF*', x, y) %] [% END %] [% MACRO page_link(name) BLOCK %] [% SET tmp.page = global.table.page.get(name) %] [% SET tmp.link = tmp.page.file.href %] [% name.html %] [% END %] [% MACRO link_link(name,text) BLOCK %] [% SET tmp.obj = global.table.link.get(name) %] [% DEFAULT text = tmp.obj.name %] [% SET tmp.link = "${url.absolute}/page/link.html?id=${tmp.obj.id}#${name}" %] [% IF text %][% text.html %][% ELSE %]?[% name.html %]?[% END %] [% END %] [% MACRO quotation_render(q) BLOCK %] [% IF q %] "[% q.quotation.html %]"[% IF q.attribution %]
   -- [% q.attribution.html %][% END %]

[% END %] [% END %] [% MACRO obj_edit_links(obj) BLOCK %] [% SET obj_gid = global.ctlr.schema.gid_for_obj(obj) %] [% IF obj_gid %] [% image_link('EDIT', "${url.absolute}/obj/${obj_gid}?a=inspect&r=${url.absolute_path.html}", 0, 12) %]  [% image_link('DELETE', "${url.absolute}/obj/${obj_gid}?a=delete&r=${url.absolute_path.html}", 0, 12) %] [% END %] [% END %] [% MACRO obj_delete_links(obj_gid) BLOCK %] [% IF obj_gid %] [% image_link('DELETE', "${url.absolute}/obj/${obj_gid}?a=delete&r=${url.absolute_path.html}", 0, 12) %] [% END %] [% END %] [% MACRO table_edit_links(obj) BLOCK %] [% image_link('EDIT', "${url.absolute}/table/${obj.name}?a=edit&r=${url.absolute_path.html}", 0, 12) %]  [% END %] [% BLOCK input_date_popup %] [% PROCESS include_js n='AnchorPosition' %] [% PROCESS include_js n='PopupWindow' %] [% PROCESS include_js n='date' %] [% PROCESS include_js n='CalendarPopup' %] [% DEFAULT name = 'date' %] [% DEFAULT formObj = "document.getElementById('$form')" %] [% DEFAULT inputObj = "document.forms[0].$name" %] [% DEFAULT inputObj = "document.getElementById('$name')" %] [% DEFAULT anchorname = "${name}_anchor" %] [% DEFAULT format = 'yyyy/MM/dd' %] [% DEFAULT size = format.length %] [% cal = "cal_${name}" %]
[% ' ' %][% image(style.calendar.icon.name, 0, 20) %]
[% END %]