To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / app / controllers / calendars_controller.rb @ 438:34214e593c67
History | View | Annotate | Download (1.36 KB)
| 1 |
class CalendarsController < ApplicationController |
|---|---|
| 2 |
menu_item :calendar
|
| 3 |
before_filter :find_optional_project
|
| 4 |
|
| 5 |
rescue_from Query::StatementInvalid, :with => :query_statement_invalid |
| 6 |
|
| 7 |
helper :issues
|
| 8 |
helper :projects
|
| 9 |
helper :queries
|
| 10 |
include QueriesHelper
|
| 11 |
helper :sort
|
| 12 |
include SortHelper
|
| 13 |
|
| 14 |
def show |
| 15 |
if params[:year] and params[:year].to_i > 1900 |
| 16 |
@year = params[:year].to_i |
| 17 |
if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 |
| 18 |
@month = params[:month].to_i |
| 19 |
end
|
| 20 |
end
|
| 21 |
@year ||= Date.today.year |
| 22 |
@month ||= Date.today.month |
| 23 |
|
| 24 |
@calendar = Redmine::Helpers::Calendar.new(Date.civil(@year, @month, 1), current_language, :month) |
| 25 |
retrieve_query |
| 26 |
@query.group_by = nil |
| 27 |
if @query.valid? |
| 28 |
events = [] |
| 29 |
events += @query.issues(:include => [:tracker, :assigned_to, :priority], |
| 30 |
:conditions => ["((start_date BETWEEN ? AND ?) OR (due_date BETWEEN ? AND ?))", @calendar.startdt, @calendar.enddt, @calendar.startdt, @calendar.enddt] |
| 31 |
) |
| 32 |
events += @query.versions(:conditions => ["effective_date BETWEEN ? AND ?", @calendar.startdt, @calendar.enddt]) |
| 33 |
|
| 34 |
@calendar.events = events
|
| 35 |
end
|
| 36 |
|
| 37 |
render :action => 'show', :layout => false if request.xhr? |
| 38 |
end
|
| 39 |
|
| 40 |
def update |
| 41 |
show |
| 42 |
end
|
| 43 |
|
| 44 |
end
|