PageRenderTime 86ms CodeModel.GetById 80ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/src/main/resources/template/simple/default-anchor-listener.ftl

http://struts2yuiplugin.googlecode.com/
Freemarker Template | 35 lines | 23 code | 1 blank | 11 comment | 5 complexity | 1cb221c4d99f206f672bf880e739ab4a MD5 | raw file
 1<#--
 2Default listener for the click event for anchors.
 3Note the implementation is slightly different than buttons because the event's target is not a form.
 4 Parameters:
 5    clickListener  name of the listener function
 6    href           URL (if not specified the action URL for the referenced form is used)
 7    method         http method to use
 8    callback       name of the callback function (see YUI Connection Manager)
 9    customCallback if false, the default callback will be included
10    formId         id of the form to use
11-->
12function ${parameters.clickListener}(e, formId) {
13  YAHOO.util.Event.preventDefault(e);
14  <#if parameters.href?exists>
15  var href='${parameters.href}';
16  <#else>
17  var href = null;
18  </#if>
19  if (formId) {
20     var formObject = document.getElementById(formId);
21     if (formObject != null) {
22       YAHOO.util.Connect.setForm(formObject);
23       <#if !parameters.href?exists>
24       href=formObject.action;
25       </#if>
26     }
27  }
28
29  if (href) {
30    YAHOO.util.Connect.asyncRequest('${parameters.method}', href, ${parameters.callback});
31  }
32}
33<#if !parameters.customCallback>
34<#include "/${parameters.templateDir}/simple/default-callback.ftl" />
35</#if>