kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
3.4 KiB
95 lines
3.4 KiB
12 years ago
|
#-- copyright
|
||
|
# OpenProject is a project management system.
|
||
11 years ago
|
# Copyright (C) 2012-2013 the OpenProject Foundation (OPF)
|
||
12 years ago
|
#
|
||
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License version 3.
|
||
|
#
|
||
11 years ago
|
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||
|
# Copyright (C) 2010-2013 the ChiliProject Team
|
||
|
#
|
||
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License
|
||
|
# as published by the Free Software Foundation; either version 2
|
||
|
# of the License, or (at your option) any later version.
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
#
|
||
12 years ago
|
# See doc/COPYRIGHT.rdoc for more details.
|
||
|
#++
|
||
|
|
||
12 years ago
|
api.project do
|
||
|
api.id(project.id)
|
||
|
api.name(project.name)
|
||
|
api.identifier(project.identifier)
|
||
|
|
||
|
api.permissions(
|
||
11 years ago
|
:view_planning_elements => User.current.allowed_to?(:view_work_packages, project),
|
||
11 years ago
|
:edit_planning_elements => User.current.allowed_to?(:edit_work_packages, project),
|
||
11 years ago
|
:delete_planning_elements => User.current.allowed_to?(:delete_work_packages, project)
|
||
12 years ago
|
)
|
||
|
|
||
|
# TODO: Evaluate html formatting of description instead of passing the raw
|
||
|
# textile code - although this is also not done in the official API
|
||
|
api.description(project.description)
|
||
|
|
||
|
parent = visible_parent_project(project)
|
||
|
if parent
|
||
|
api.parent(:id => parent.id,
|
||
|
:name => parent.name,
|
||
|
:identifier => parent.identifier)
|
||
|
end
|
||
|
|
||
12 years ago
|
if project.responsible
|
||
|
api.responsible(:id => project.responsible.id, :name => project.responsible.name)
|
||
12 years ago
|
end
|
||
|
|
||
12 years ago
|
if project.project_type
|
||
|
api.project_type(:id => project.project_type.id,
|
||
|
:name => project.project_type.name)
|
||
12 years ago
|
end
|
||
|
|
||
11 years ago
|
planning_element_types = project.types
|
||
12 years ago
|
if planning_element_types.present?
|
||
|
api.array :planning_element_types, :size => planning_element_types.size do
|
||
|
planning_element_types.each do |planning_element_type|
|
||
|
api.planning_element_type do
|
||
|
api.id planning_element_type.id
|
||
|
api.name planning_element_type.name
|
||
|
|
||
|
color = planning_element_type.color
|
||
|
if color.present?
|
||
|
api.color(:id => color.id, :name => color.name, :hexcode => color.hexcode)
|
||
|
end
|
||
|
api.is_milestone planning_element_type.is_milestone?
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
12 years ago
|
project_associations = project.project_associations.visible
|
||
12 years ago
|
if project_associations.present?
|
||
|
api.array :project_associations, :size => project_associations.size do
|
||
|
project_associations.each do |project_association|
|
||
|
api.project_association(:id => project_association.id) do
|
||
|
other = project_association.project(project)
|
||
|
api.project(:id => other.id,
|
||
|
:identifier => other.identifier,
|
||
|
:name => other.name)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
11 years ago
|
api.created_on(project.created_on.utc.iso8601) if project.created_on
|
||
|
api.updated_on(project.updated_on.utc.iso8601) if project.updated_on
|
||
12 years ago
|
end
|