showmonthcalendar.jsp

来自「开源项目CRM之OpenCustomer」· JSP 代码 · 共 148 行

JSP
148
字号
<%-- ***** BEGIN LICENSE BLOCK *****
   - Version: MPL 1.1
   -
   - The contents of this file are subject to the Mozilla Public License Version
   - 1.1 (the "License"); you may not use this file except in compliance with
   - the License. You may obtain a copy of the License at
   - http://www.mozilla.org/MPL/
   -
   - Software distributed under the License is distributed on an "AS IS" basis,
   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
   - for the specific language governing rights and limitations under the
   - License.
   -
   - The Original Code is the OpenCustomer CRM.
   -
   - The Initial Developer of the Original Code is
   - Thomas Bader (Bader & Jene Software-Ingenieurb黵o).
   - Portions created by the Initial Developer are Copyright (C) 2005
   - the Initial Developer. All Rights Reserved.
   -
   - Contributor(s):
   -   Thomas Bader <thomas.bader@bader-jene.de>
   -
   - ***** END LICENSE BLOCK ***** --%>
   
<%@ include file="/tiles/page.jsp" %>

<%@ page import="org.opencustomer.application.web.module.calendar.Constants" %>
<%@ page import="java.util.*" %>
<%@ page import="org.opencustomer.web.util.TagUtility" %>
<%@ page import="org.opencustomer.application.auth.Right" %>
<%@ page import="org.opencustomer.application.web.Globals" %>
<%@ page import="org.opencustomer.db.vo.EntityAccess" %>

<tiles:insert definition="standard">
	<tiles:put name="page.title">
		<bean:message key="domain.calendar.showCalendar.month.headLine"/> 
		- 
		<logic:equal name="<%=Constants.CALENDAR_KEY%>" property="user.id" scope="session" value="<%=TagUtility.lookupString(pageContext, Globals.USER_KEY, "id", "session")%>">
		<bean:message key="domain.calendar.navigation.private"/>
		</logic:equal>
		<logic:notEqual name="<%=Constants.CALENDAR_KEY%>" property="user.id" scope="session" value="<%=TagUtility.lookupString(pageContext, Globals.USER_KEY, "id", "session")%>">
		<bean:write name="<%=Constants.CALENDAR_KEY%>" property="user.userName" scope="session"/>
		</logic:notEqual>
	</tiles:put>
	<tiles:put name="page.content">
		
	<script type="text/javascript">
	<!--
		function edit(i) {
			document.location="<%=response.encodeURL(request.getContextPath()+"/calendar/event/edit.do?id=")%>"+i;
		}
	//-->
	</script>
	
	<html:errors/>
	
	<buj:authenticate right="<%=Right.CALENDAR_COMMON_WRITE.getLabel()%>">	
	<buj:entityAccess name="<%=Constants.CALENDAR_KEY%>" scope="session" access="<%=EntityAccess.Access.WRITE%>">
	<fieldset class="action">
		<html:link action="/calendar/event/edit" titleKey="icon.add.text">
			<html:img styleClass="action" altKey="icon.add.text" titleKey="icon.add.text" pageKey="icon.add.url"/>
		</html:link>
	</fieldset>		
	</buj:entityAccess>
	</buj:authenticate>
	<fieldset class="calendar">
	<table class="navigation"><tr>
		<td class="left">
			<html:link action="/calendar/showCalendar?doLastMonth=true" titleKey="image.calendar.lastMonth.text">
				<html:img pageKey="image.calendar.lastMonth.url" altKey="image.calendar.lastMonth.text"/>
			</html:link>
		</td><td class="center">
			<bean:write name="<%=Constants.CALENDAR_ViEW_KEY%>" property="referenceDate" scope="session" formatKey="domain.calendar.format.date.month"/>
		</td><td class="right">
			<html:link action="/calendar/showCalendar?doNextMonth=true" titleKey="image.calendar.nextMonth.text">
				<html:img pageKey="image.calendar.nextMonth.url" altKey="image.calendar.nextMonth.text"/>
			</html:link>
		</td>
	</tr></table>
		
	<table class="calendar">
		<colgroup>
			<col width="10"/>
			<col width="1*"/>
			<col width="1*"/>
			<col width="1*"/>
			<col width="1*"/>
			<col width="1*"/>
			<col width="1*"/>
			<col width="1*"/>
		</colgroup>
		<tr>
			<th class="day">&nbsp;</th>
	<logic:iterate indexId="index" length="7" name="<%=Constants.CALENDAR_ViEW_KEY%>" property="elements" id="data" scope="session">
			<th class="day">
				<bean:write name="data" property="startDate" scope="page" formatKey="domain.calendar.format.date.dayOfWeek"/><br/>
			</th>
	</logic:iterate>
		</tr>
		<%
			Calendar day   = GregorianCalendar.getInstance();
			Calendar start = GregorianCalendar.getInstance();
			Calendar end   = GregorianCalendar.getInstance();
		%>
	<logic:iterate indexId="index" name="<%=Constants.CALENDAR_ViEW_KEY%>" property="elements" id="data" scope="session"><%
    	int calculate = ((Integer)pageContext.getAttribute("index")).intValue()%7;
		if(calculate == 0) { %><tr>
			<th class="week">
				<bean:write name="data" property="startDate" scope="page" formatKey="domain.calendar.format.date.week"/><br/>
			</th>
		<% } %>
			<td<logic:equal name="data" property="inPeriod" scope="page" value="false"> class="anotherMonth"</logic:equal><logic:equal name="data" property="inSubPeriod" scope="page" value="true"> id="today"</logic:equal>>
				<bean:write name="data" property="startDate" scope="page" formatKey="domain.calendar.format.date.dayOfMonth"/><br/>
				<%
					day.setTime((Date)TagUtility.lookup(pageContext, "data", "startDate", "page"));
					day.set(Calendar.HOUR_OF_DAY, 0);
					day.set(Calendar.MINUTE, 0);
					day.set(Calendar.SECOND, 0);
					day.set(Calendar.MILLISECOND, 0);
				%>
				<logic:iterate name="data" property="events" id="bean" scope="page">
					<div class="event" onmouseover="this.className='eventActive';" onmouseout="this.className='event';" onclick="edit(<bean:write name="bean" property="event.id" scope="page"/>);">
						<div class="time">
							<logic:equal name="bean" property="event.allDay" scope="page" value="true">
							<html:img pageKey="image.calendar.allDayEvent.url" titleKey="image.calendar.allDayEvent.text"/>
							</logic:equal>
							<logic:equal name="bean" property="event.allDay" scope="page" value="false">
								<bean:write name="bean" property="startDate" scope="page" formatKey="format.date.time"/> -
								<bean:write name="bean" property="endDate" scope="page" formatKey="format.date.time"/>
							</logic:equal>
						</div>
						<div class="title">
							<bean:write name="bean" property="event.title" scope="page"/>
							<logic:present name="bean" property="recurrenceNumber" scope="page">
							[<bean:write name="bean" property="recurrenceNumber" scope="page"/>]
							</logic:present>
						</div>
					</div>
				</logic:iterate>
			</td><%
		if(calculate == 6) { %></tr><% } %>
	</logic:iterate>
	</table>
	</fieldset>
	</tiles:put>
</tiles:insert>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?