Mercurial > hg > soundsoftware-site
comparison app/controllers/calendars_controller.rb @ 0:513646585e45
* Import Redmine trunk SVN rev 3859
author | Chris Cannam |
---|---|
date | Fri, 23 Jul 2010 15:52:44 +0100 |
parents | |
children | 1d32c0a0efbf |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:513646585e45 |
---|---|
1 class CalendarsController < ApplicationController | |
2 before_filter :find_optional_project | |
3 | |
4 rescue_from Query::StatementInvalid, :with => :query_statement_invalid | |
5 | |
6 helper :issues | |
7 helper :projects | |
8 helper :queries | |
9 include QueriesHelper | |
10 | |
11 def show | |
12 if params[:year] and params[:year].to_i > 1900 | |
13 @year = params[:year].to_i | |
14 if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 | |
15 @month = params[:month].to_i | |
16 end | |
17 end | |
18 @year ||= Date.today.year | |
19 @month ||= Date.today.month | |
20 | |
21 @calendar = Redmine::Helpers::Calendar.new(Date.civil(@year, @month, 1), current_language, :month) | |
22 retrieve_query | |
23 @query.group_by = nil | |
24 if @query.valid? | |
25 events = [] | |
26 events += @query.issues(:include => [:tracker, :assigned_to, :priority], | |
27 :conditions => ["((start_date BETWEEN ? AND ?) OR (due_date BETWEEN ? AND ?))", @calendar.startdt, @calendar.enddt, @calendar.startdt, @calendar.enddt] | |
28 ) | |
29 events += @query.versions(:conditions => ["effective_date BETWEEN ? AND ?", @calendar.startdt, @calendar.enddt]) | |
30 | |
31 @calendar.events = events | |
32 end | |
33 | |
34 render :layout => false if request.xhr? | |
35 end | |
36 | |
37 | |
38 end |