Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add: CustomFields for Spent time;

add: ActivitiesController;



git-svn-id: file:///home/sven/rmc_backup/svn_neu/trunk@288 738a3cfe-f54d-0410-852a-ebac1faf349d
  • Loading branch information...
commit 0477d7c4750267c961f579a3d8123735919f3d6f 1 parent 7267db3
sven-k authored
View
20 app/controllers/mylyn_connector/activities_controller.rb
@@ -0,0 +1,20 @@
+require File.dirname(__FILE__) + '/../../../lib/mylyn_connector'
+
+class MylynConnector::ActivitiesController < ApplicationController
+ unloadable
+ include MylynConnector::Rescue::ClassMethods
+
+ def all
+ begin
+ #since 0.9 IssuePriority exists
+ @activities = TimeEntryActivity.all
+ rescue
+ @activities = Enumeration::get_values('ACTI');
+ end
+
+ respond_to do |format|
+ format.xml {render :xml => @activities, :template => 'mylyn_connector/activities/all.rxml'}
+ end
+ end
+
+end
View
10 app/views/mylyn_connector/activities/all.rxml
@@ -0,0 +1,10 @@
+xml.instruct! :xml, :encoding => "UTF-8"
+xml.activities :xmlns => 'http://redmin-mylyncon.sf.net/schemas/WS-API-2.6' do
+ @activities.each do |activity|
+ xml.activity :id => activity.id do
+ xml.name activity.name
+ xml.position activity.position
+ xml.default activity.is_default
+ end
+ end
+end
View
6 app/views/mylyn_connector/issues/_issue.rxml
@@ -82,7 +82,11 @@ xml.issue(:xmlns => 'http://redmin-mylyncon.sf.net/schemas/WS-API-2.6', :id => i
xml.userId entry.user_id
xml.spentOn entry.spent_on
xml.comments entry.comments
- xml.customValues
+ xml.customValues {
+ entry.custom_values.each {|value|
+ xml.customValue value.value, :customFieldId => value.custom_field_id
+ }
+ }
end
}
end
View
3  app/views/mylyn_connector/projects/_issue_custom_field.rxml
@@ -1,5 +1,6 @@
xml.issueCustomField(:id => issue_custom_field.id) do
xml.name issue_custom_field.name
+ xml.type issue_custom_field.type
xml.fieldFormat issue_custom_field.field_format
xml.minLength issue_custom_field.min_length
xml.maxLength issue_custom_field.max_length
@@ -11,8 +12,8 @@ xml.issueCustomField(:id => issue_custom_field.id) do
else
xml.possibleValues
end
- xml.trackers integer_list(issue_custom_field.trackers)
xml.defaultValue issue_custom_field.default_value
xml.required issue_custom_field.is_required
xml.filter issue_custom_field.is_filter
+ xml.trackers integer_list(issue_custom_field.trackers)
end
View
1  config/routes.rb
@@ -2,6 +2,7 @@
map.connect "mylyn/issue/:id", :controller => "MylynConnector::Issues", :action => "show", :conditions => {:method => :get}
map.connect "mylyn/projects", :controller => "MylynConnector::Projects", :action => "all", :conditions => {:method => :get}
map.connect "mylyn/priorities", :controller => "MylynConnector::Priorities", :action => "all", :conditions => {:method => :get}
+ map.connect "mylyn/activities", :controller => "MylynConnector::Activities", :action => "all", :conditions => {:method => :get}
map.connect "mylyn/issuestatus", :controller => "MylynConnector::IssueStatus", :action => "all", :conditions => {:method => :get}
map.connect "mylyn/customfields", :controller => "MylynConnector::CustomFields", :action => "all", :conditions => {:method => :get}
map.connect "mylyn/version", :controller => "MylynConnector::Information", :action => "version", :conditions => {:method => :get}
View
1  routes.rb
@@ -1,6 +1,7 @@
connect "mylyn/issue/:id", :controller => "MylynConnector::Issues", :action => "show", :conditions => {:method => :get}
connect "mylyn/projects", :controller => "MylynConnector::Projects", :action => "all", :conditions => {:method => :get}
connect "mylyn/priorities", :controller => "MylynConnector::Priorities", :action => "all", :conditions => {:method => :get}
+connect "mylyn/activities", :controller => "MylynConnector::Activities", :action => "all", :conditions => {:method => :get}
connect "mylyn/issuestatus", :controller => "MylynConnector::IssueStatus", :action => "all", :conditions => {:method => :get}
connect "mylyn/customfields", :controller => "MylynConnector::CustomFields", :action => "all", :conditions => {:method => :get}
connect "mylyn/version", :controller => "MylynConnector::Information", :action => "version", :conditions => {:method => :get}
View
23 test/functional/activities_controller_test.rb
@@ -0,0 +1,23 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class MylynConnector::ActivitiesControllerTest < MylynConnector::ControllerTest
+ fixtures :enumerations
+
+ def setup
+ super
+ @controller = MylynConnector::ActivitiesController.new
+ end
+
+ def test_all
+ get :all
+ assert_response :success
+ assert_template 'all.rxml'
+
+ xmldoc = XML::Document.string @response.body
+ schema = read_schema 'activities'
+ valid = xmldoc.validate_schema schema
+ assert valid , 'Ergenis passt nicht zum Schema ' + 'activities'
+
+ assert_tag :tag => 'activities', :children => {:count => 3}
+ end
+end
View
19 test/schema/activities.xsd
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://redmin-mylyncon.sf.net/schemas/WS-API-2.6"
+ targetNamespace="http://redmin-mylyncon.sf.net/schemas/WS-API-2.6"
+ elementFormDefault="qualified" >
+
+ <xsd:include schemaLocation="types/activity.xsd" />
+
+ <xsd:element name="activities"
+ xmlns="http://redmine-mylyn.sf.net/schemas/WS-API-2.6/activities">
+
+ <xsd:complexType>
+ <xsd:sequence >
+ <xsd:element name="activity" type="tns:activity" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>
View
20 test/schema/types/activity.xsd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://redmin-mylyncon.sf.net/schemas/WS-API-2.6"
+ targetNamespace="http://redmin-mylyncon.sf.net/schemas/WS-API-2.6"
+ elementFormDefault="qualified" >
+
+ <xsd:include schemaLocation="property.xsd" />
+
+ <xsd:complexType name="activity">
+ <xsd:complexContent>
+ <xsd:extension base="tns:sortedProperty">
+ <xsd:sequence>
+ <xsd:element name="default" type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+</xsd:schema>
View
30 test/schema/types/issueCustomField.xsd
@@ -5,35 +5,12 @@
targetNamespace="http://redmin-mylyncon.sf.net/schemas/WS-API-2.6"
elementFormDefault="qualified" >
- <xsd:include schemaLocation="property.xsd" />
+ <xsd:include schemaLocation="customField.xsd" />
<xsd:complexType name="issueCustomField">
<xsd:complexContent>
- <xsd:extension base="tns:property">
+ <xsd:extension base="tns:customField">
<xsd:sequence>
- <xsd:element name="fieldFormat" >
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="string" />
- <xsd:enumeration value="text" />
- <xsd:enumeration value="int" />
- <xsd:enumeration value="float" />
- <xsd:enumeration value="list" />
- <xsd:enumeration value="date" />
- <xsd:enumeration value="bool" />
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:element>
- <xsd:element name="minLength" type="xsd:integer" />
- <xsd:element name="maxLength" type="xsd:integer" />
- <xsd:element name="regexp" type="xsd:string" />
- <xsd:element name="possibleValues" >
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="possibleValue" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
<xsd:element name="trackers">
<xsd:simpleType>
<xsd:restriction>
@@ -44,9 +21,6 @@
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="defaultValue" type="xsd:string" />
- <xsd:element name="required" type="xsd:boolean" />
- <xsd:element name="filter" type="xsd:boolean" />
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
Please sign in to comment.
Something went wrong with that request. Please try again.