private boolean disabled;
@Override
public int doStartTag() throws JspException
{
UserConfiguration conf = (UserConfiguration)pageContext.getSession().getAttribute(Globals.CONFIGURATION_KEY);
boolean isDisabled = disabled;
if(pageContext.getAttribute("i_panel_editable") != null) {
if(pageContext.getAttribute("i_panel_editable").equals(Boolean.FALSE))
isDisabled = true;
}
if(!isDisabled) {
StringBuilder builder = new StringBuilder();
builder.append("<script type=\"text/javascript\">");
if(pageContext.getAttribute("jsCalendar_isLocaleInitialized") == null) {
initLocale(builder);
pageContext.setAttribute("jsCalendar_isLocaleInitialized", Boolean.TRUE);
}
builder.append("Calendar.setup(");
builder.append("{");
builder.append("inputField : \""+input+"\",");
builder.append("button : \""+button+"\",");
if(formatKey != null) {
String jsFormat = getJsFormat(formatKey);
builder.append("ifFormat : \""+jsFormat+"\",");
if(jsFormat.contains("%M")
||jsFormat.contains("%H")
|| jsFormat.contains("%k")
|| jsFormat.contains("%I")
|| jsFormat.contains("%l")) {
builder.append("showsTime : true,");
builder.append("singleClick : false,");
}
if(jsFormat.contains("%I")
|| jsFormat.contains("%l")) {
builder.append("timeFormat : \"12\",");
} else {
builder.append("timeFormat : \"24\",");
}
}
builder.append("step : 5,");
builder.append("firstDay : "+getJsFirstDayOfWeek(conf.getIntValue(UserConfiguration.Key.CALENDAR_FIRST_DAY_OF_WEEK)));
builder.append("}");
builder.append(");");
builder.append("</script>");
TagUtils.getInstance().write(pageContext, builder.toString());