├── README.rdoc ├── app └── views │ └── my │ └── blocks │ ├── _issues_custom_query_1.rhtml │ ├── _issues_custom_query_2.rhtml │ ├── _issues_custom_query_3.rhtml │ ├── _issues_custom_query_4.rhtml │ └── _issues_custom_query_5.rhtml └── init.rb /README.rdoc: -------------------------------------------------------------------------------- 1 | = Redmine My Page Queries 2 | 3 | Adds custom queries onto My Page screen 4 | 5 | = Install 6 | 7 | script/plugin install git://github.com/alvila/redmine_my_page_queries.git 8 | -------------------------------------------------------------------------------- /app/views/my/blocks/_issues_custom_query_1.rhtml: -------------------------------------------------------------------------------- 1 | <% 2 | unless @sidebar_queries 3 | # User can see public queries and his own queries 4 | visible = ARCondition.new(["is_public = ? OR user_id = ?", true, (@user.logged? ? @user.id : 0)]) 5 | # Project specific queries and global queries 6 | projects=Project.visible.find(:all) 7 | project_ids=Array.new 8 | projects.each do |project| 9 | project_ids+=[project[:id].to_i] 10 | end 11 | visible << ["project_id IS NULL OR project_id IN ( " + project_ids.join(', ') + ")"] 12 | @sidebar_queries = Query.find(:all, 13 | :select => 'id, name, project_id', 14 | :order => "project_id DESC, name ASC", 15 | :conditions => visible.conditions) 16 | end 17 | if @user.pref[:others][:custom_query1] == nil then 18 | @user.pref[:others][:custom_query1]=Hash.new 19 | @user.pref.save 20 | @user.pref[:others][:custom_query1][:id]=5 21 | @user.pref[:others][:custom_query1][:limit]=10 22 | @user.pref.save 23 | end 24 | if params[:custom_query1]=="true" then 25 | @user.pref[:others][:custom_query1][:id]=params[:query].to_i 26 | @user.pref[:others][:custom_query1][:limit]=params[:limit].to_i 27 | @user.pref.save 28 | end 29 | begin 30 | @query = Query.find(@user.pref[:others][:custom_query1][:id].to_i) 31 | rescue ActiveRecord::RecordNotFound 32 | @user.pref[:others][:custom_query1][:id]=5 33 | @user.pref.save 34 | @query = Query.find(@user.pref[:others][:custom_query1][:id].to_i) 35 | end 36 | custom_issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], 37 | :limit => @user.pref[:others][:custom_query1][:limit] ) 38 | %> 39 |

<% if(@query.project_id!=nil) -%><%= Project.visible.find(@query.project_id.to_i).name + " > " %><% end -%><%=h(@query.name)%> (<%= @query.issue_count%>)

40 |
modify 41 | 68 | <%= render :partial => 'issues/list_simple', :locals => { :issues => custom_issues } %> 69 | <% if custom_issues.length > 0 70 | if @query.project == nil then 71 | %> 72 |

'issues',:action => 'index', :query_id => @query.id) %>

73 | <% else %> 74 |

'issues',:project_id =>@query.project.id ,:action => 'index', :query_id => @query.id) %>

75 | <% end %> 76 | <% end %> 77 | 78 | <% content_for :header_tags do %> 79 | <%= auto_discovery_link_tag(:atom, 80 | {:controller => 'issues', :action => 'index', :set_filter => 1, 81 | :query_id => @query.id, :format => 'atom', :key => User.current.rss_key}, 82 | {:title => l(:label_assigned_to_me_issues)}) %> 83 | <% end %> 84 | -------------------------------------------------------------------------------- /app/views/my/blocks/_issues_custom_query_2.rhtml: -------------------------------------------------------------------------------- 1 | <% 2 | unless @sidebar_queries 3 | # User can see public queries and his own queries 4 | visible = ARCondition.new(["is_public = ? OR user_id = ?", true, (@user.logged? ? @user.id : 0)]) 5 | # Project specific queries and global queries 6 | projects=Project.visible.find(:all) 7 | project_ids=Array.new 8 | projects.each do |project| 9 | project_ids+=[project[:id].to_i] 10 | end 11 | visible << ["project_id IS NULL OR project_id IN ( " + project_ids.join(', ') + ")"] 12 | @sidebar_queries = Query.find(:all, 13 | :select => 'id, name, project_id', 14 | :order => "project_id DESC, name ASC", 15 | :conditions => visible.conditions) 16 | end 17 | if @user.pref[:others][:custom_query2] == nil then 18 | @user.pref[:others][:custom_query2]=Hash.new 19 | @user.pref.save 20 | @user.pref[:others][:custom_query2][:id]=5 21 | @user.pref[:others][:custom_query2][:limit]=10 22 | @user.pref.save 23 | end 24 | if params[:custom_query2]=="true" then 25 | @user.pref[:others][:custom_query2][:id]=params[:query].to_i 26 | @user.pref[:others][:custom_query2][:limit]=params[:limit].to_i 27 | @user.pref.save 28 | end 29 | begin 30 | @query = Query.find(@user.pref[:others][:custom_query2][:id].to_i) 31 | rescue ActiveRecord::RecordNotFound 32 | @user.pref[:others][:custom_query2][:id]=5 33 | @user.pref.save 34 | @query = Query.find(@user.pref[:others][:custom_query2][:id].to_i) 35 | end 36 | custom_issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], 37 | :limit => @user.pref[:others][:custom_query2][:limit] ) 38 | %> 39 |

<% if(@query.project_id!=nil) -%><%= Project.visible.find(@query.project_id.to_i).name + " > " %><% end -%><%=h(@query.name)%> (<%= @query.issue_count%>)

40 |
modify 41 | 68 | 69 | <%= render :partial => 'issues/list_simple', :locals => { :issues => custom_issues } %> 70 | <% if custom_issues.length > 0 71 | if @query.project == nil then 72 | %> 73 |

'issues',:action => 'index', :query_id => @query.id) %>

74 | <% else %> 75 |

'issues',:project_id =>@query.project.id ,:action => 'index', :query_id => @query.id) %>

76 | <% end %> 77 | <% end %> 78 | 79 | <% content_for :header_tags do %> 80 | <%= auto_discovery_link_tag(:atom, 81 | {:controller => 'issues', :action => 'index', :set_filter => 1, 82 | :query_id => @query.id, :format => 'atom', :key => User.current.rss_key}, 83 | {:title => l(:label_assigned_to_me_issues)}) %> 84 | <% end %> 85 | -------------------------------------------------------------------------------- /app/views/my/blocks/_issues_custom_query_3.rhtml: -------------------------------------------------------------------------------- 1 | <% 2 | unless @sidebar_queries 3 | # User can see public queries and his own queries 4 | visible = ARCondition.new(["is_public = ? OR user_id = ?", true, (@user.logged? ? @user.id : 0)]) 5 | # Project specific queries and global queries 6 | projects=Project.visible.find(:all) 7 | project_ids=Array.new 8 | projects.each do |project| 9 | project_ids+=[project[:id].to_i] 10 | end 11 | visible << ["project_id IS NULL OR project_id IN ( " + project_ids.join(', ') + ")"] 12 | @sidebar_queries = Query.find(:all, 13 | :select => 'id, name, project_id', 14 | :order => "project_id DESC, name ASC", 15 | :conditions => visible.conditions) 16 | end 17 | if @user.pref[:others][:custom_query3] == nil then 18 | @user.pref[:others][:custom_query3]=Hash.new 19 | @user.pref.save 20 | @user.pref[:others][:custom_query3][:id]=5 21 | @user.pref[:others][:custom_query3][:limit]=10 22 | @user.pref.save 23 | end 24 | if params[:custom_query3]=="true" then 25 | @user.pref[:others][:custom_query3][:id]=params[:query].to_i 26 | @user.pref[:others][:custom_query3][:limit]=params[:limit].to_i 27 | @user.pref.save 28 | end 29 | begin 30 | @query = Query.find(@user.pref[:others][:custom_query3][:id].to_i) 31 | rescue ActiveRecord::RecordNotFound 32 | @user.pref[:others][:custom_query3][:id]=5 33 | @user.pref.save 34 | @query = Query.find(@user.pref[:others][:custom_query3][:id].to_i) 35 | end 36 | custom_issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], 37 | :limit => @user.pref[:others][:custom_query3][:limit] ) 38 | %> 39 |

<% if(@query.project_id!=nil) -%><%= Project.visible.find(@query.project_id.to_i).name + " > " %><% end -%><%=h(@query.name)%> (<%= @query.issue_count%>)

40 |
modify 41 | 68 | 69 | <%= render :partial => 'issues/list_simple', :locals => { :issues => custom_issues } %> 70 | <% if custom_issues.length > 0 71 | if @query.project == nil then 72 | %> 73 |

'issues',:action => 'index', :query_id => @query.id) %>

74 | <% else %> 75 |

'issues',:project_id =>@query.project.id ,:action => 'index', :query_id => @query.id) %>

76 | <% end %> 77 | <% end %> 78 | 79 | <% content_for :header_tags do %> 80 | <%= auto_discovery_link_tag(:atom, 81 | {:controller => 'issues', :action => 'index', :set_filter => 1, 82 | :query_id => @query.id, :format => 'atom', :key => User.current.rss_key}, 83 | {:title => l(:label_assigned_to_me_issues)}) %> 84 | <% end %> 85 | -------------------------------------------------------------------------------- /app/views/my/blocks/_issues_custom_query_4.rhtml: -------------------------------------------------------------------------------- 1 | <% 2 | unless @sidebar_queries 3 | # User can see public queries and his own queries 4 | visible = ARCondition.new(["is_public = ? OR user_id = ?", true, (@user.logged? ? @user.id : 0)]) 5 | # Project specific queries and global queries 6 | projects=Project.visible.find(:all) 7 | project_ids=Array.new 8 | projects.each do |project| 9 | project_ids+=[project[:id].to_i] 10 | end 11 | visible << ["project_id IS NULL OR project_id IN ( " + project_ids.join(', ') + ")"] 12 | @sidebar_queries = Query.find(:all, 13 | :select => 'id, name, project_id', 14 | :order => "project_id DESC, name ASC", 15 | :conditions => visible.conditions) 16 | end 17 | if @user.pref[:others][:custom_query4] == nil then 18 | @user.pref[:others][:custom_query4]=Hash.new 19 | @user.pref.save 20 | @user.pref[:others][:custom_query4][:id]=5 21 | @user.pref[:others][:custom_query4][:limit]=10 22 | @user.pref.save 23 | end 24 | if params[:custom_query4]=="true" then 25 | @user.pref[:others][:custom_query4][:id]=params[:query].to_i 26 | @user.pref[:others][:custom_query4][:limit]=params[:limit].to_i 27 | @user.pref.save 28 | end 29 | begin 30 | @query = Query.find(@user.pref[:others][:custom_query4][:id].to_i) 31 | rescue ActiveRecord::RecordNotFound 32 | @user.pref[:others][:custom_query4][:id]=5 33 | @user.pref.save 34 | @query = Query.find(@user.pref[:others][:custom_query4][:id].to_i) 35 | end 36 | custom_issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], 37 | :limit => @user.pref[:others][:custom_query4][:limit] ) 38 | %> 39 |

<% if(@query.project_id!=nil) -%><%= Project.visible.find(@query.project_id.to_i).name + " > " %><% end -%><%=h(@query.name)%> (<%= @query.issue_count%>)

40 |
modify 41 | 68 | 69 | <%= render :partial => 'issues/list_simple', :locals => { :issues => custom_issues } %> 70 | <% if custom_issues.length > 0 71 | if @query.project == nil then 72 | %> 73 |

'issues',:action => 'index', :query_id => @query.id) %>

74 | <% else %> 75 |

'issues',:project_id =>@query.project.id ,:action => 'index', :query_id => @query.id) %>

76 | <% end %> 77 | <% end %> 78 | 79 | <% content_for :header_tags do %> 80 | <%= auto_discovery_link_tag(:atom, 81 | {:controller => 'issues', :action => 'index', :set_filter => 1, 82 | :query_id => @query.id, :format => 'atom', :key => User.current.rss_key}, 83 | {:title => l(:label_assigned_to_me_issues)}) %> 84 | <% end %> 85 | -------------------------------------------------------------------------------- /app/views/my/blocks/_issues_custom_query_5.rhtml: -------------------------------------------------------------------------------- 1 | <% 2 | unless @sidebar_queries 3 | # User can see public queries and his own queries 4 | visible = ARCondition.new(["is_public = ? OR user_id = ?", true, (@user.logged? ? @user.id : 0)]) 5 | # Project specific queries and global queries 6 | projects=Project.visible.find(:all) 7 | project_ids=Array.new 8 | projects.each do |project| 9 | project_ids+=[project[:id].to_i] 10 | end 11 | visible << ["project_id IS NULL OR project_id IN ( " + project_ids.join(', ') + ")"] 12 | @sidebar_queries = Query.find(:all, 13 | :select => 'id, name, project_id', 14 | :order => "project_id DESC, name ASC", 15 | :conditions => visible.conditions) 16 | end 17 | if @user.pref[:others][:custom_query5] == nil then 18 | @user.pref[:others][:custom_query5]=Hash.new 19 | @user.pref.save 20 | @user.pref[:others][:custom_query5][:id]=5 21 | @user.pref[:others][:custom_query5][:limit]=10 22 | @user.pref.save 23 | end 24 | if params[:custom_query5]=="true" then 25 | @user.pref[:others][:custom_query5][:id]=params[:query].to_i 26 | @user.pref[:others][:custom_query5][:limit]=params[:limit].to_i 27 | @user.pref.save 28 | end 29 | begin 30 | @query = Query.find(@user.pref[:others][:custom_query5][:id].to_i) 31 | rescue ActiveRecord::RecordNotFound 32 | @user.pref[:others][:custom_query5][:id]=5 33 | @user.pref.save 34 | @query = Query.find(@user.pref[:others][:custom_query5][:id].to_i) 35 | end 36 | custom_issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], 37 | :limit => @user.pref[:others][:custom_query5][:limit] ) 38 | %> 39 |

<% if(@query.project_id!=nil) -%><%= Project.visible.find(@query.project_id.to_i).name + " > " %><% end -%><%=h(@query.name)%> (<%= @query.issue_count%>)

40 |
modify 41 | 68 | 69 | <%= render :partial => 'issues/list_simple', :locals => { :issues => custom_issues } %> 70 | <% if custom_issues.length > 0 71 | if @query.project == nil then 72 | %> 73 |

'issues',:action => 'index', :query_id => @query.id) %>

74 | <% else %> 75 |

'issues',:project_id =>@query.project.id ,:action => 'index', :query_id => @query.id) %>

76 | <% end %> 77 | <% end %> 78 | 79 | <% content_for :header_tags do %> 80 | <%= auto_discovery_link_tag(:atom, 81 | {:controller => 'issues', :action => 'index', :set_filter => 1, 82 | :query_id => @query.id, :format => 'atom', :key => User.current.rss_key}, 83 | {:title => l(:label_assigned_to_me_issues)}) %> 84 | <% end %> 85 | -------------------------------------------------------------------------------- /init.rb: -------------------------------------------------------------------------------- 1 | require 'redmine' 2 | 3 | Redmine::Plugin.register :redmine_my_page_queries do 4 | name 'MyPage custom queries' 5 | author 'Milan Stastny of ALVILA SYSTEMS' 6 | description 'Adds custom queries onto My Page screen' 7 | version '0.0.1' 8 | author_url 'http://www.alvila.com' 9 | end 10 | 11 | --------------------------------------------------------------------------------