aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMichel Etienne2012-11-06 18:53:29 +0100
committerMichel Etienne2012-11-06 18:53:29 +0100
commit48842ac1197560b1b7f597e3e1be7c4d93f8d098 (patch)
treedfeee03bf8ae1fb2b4a665b61c95bfe33056105f /app
parentc1c4d3fbc9231fe6b1bdd325faced49f33cdf1b2 (diff)
downloadchouette-core-48842ac1197560b1b7f597e3e1be7c4d93f8d098.tar.bz2
add access_points and access_links managment
Diffstat (limited to 'app')
-rw-r--r--app/assets/images/icons/disabled_left_arrow.pngbin0 -> 823 bytes
-rw-r--r--app/assets/images/icons/disabled_right_arrow.pngbin0 -> 815 bytes
-rw-r--r--app/assets/images/icons/gray_left_arrow.pngbin0 -> 567 bytes
-rw-r--r--app/assets/images/icons/gray_right_arrow.pngbin0 -> 556 bytes
-rw-r--r--app/assets/images/icons/green_left_arrow.pngbin0 -> 422 bytes
-rw-r--r--app/assets/images/icons/green_right_arrow.pngbin0 -> 423 bytes
-rw-r--r--app/assets/images/map/access_in.pngbin0 -> 666 bytes
-rw-r--r--app/assets/images/map/access_in_out.pngbin0 -> 666 bytes
-rw-r--r--app/assets/images/map/access_out.pngbin0 -> 666 bytes
-rw-r--r--app/assets/javascripts/access_points.js.coffee30
-rw-r--r--app/assets/stylesheets/access_links.css.scss21
-rw-r--r--app/assets/stylesheets/access_points.css.scss104
-rw-r--r--app/assets/stylesheets/stop_areas.css.scss58
-rw-r--r--app/controllers/access_links_controller.rb73
-rw-r--r--app/controllers/access_points_controller.rb54
-rw-r--r--app/controllers/stop_areas_controller.rb6
-rw-r--r--app/helpers/access_points_helper.rb28
-rw-r--r--app/helpers/stop_areas_helper.rb47
-rw-r--r--app/maps/access_point_map.rb62
-rw-r--r--app/maps/style_map/access_points_style_map.rb39
-rw-r--r--app/maps/style_map/edit_access_point_style_map.rb46
-rw-r--r--app/models/access_link_pair.rb45
-rw-r--r--app/models/referential.rb35
-rw-r--r--app/views/access_link_pairs/_access_link_pair.html.erb57
-rw-r--r--app/views/access_links/_form.html.erb35
-rw-r--r--app/views/access_links/edit.html.erb4
-rw-r--r--app/views/access_links/new.html.erb3
-rw-r--r--app/views/access_links/show.html.erb90
-rw-r--r--app/views/access_points/_access_point.html.erb20
-rw-r--r--app/views/access_points/_form.html.erb44
-rw-r--r--app/views/access_points/edit.html.erb5
-rw-r--r--app/views/access_points/index.html.erb26
-rw-r--r--app/views/access_points/index.kml.erb12
-rw-r--r--app/views/access_points/new.html.erb3
-rw-r--r--app/views/access_points/show.html.erb123
-rw-r--r--app/views/access_points/show.kml.erb10
-rw-r--r--app/views/referentials/_counts.html.erb5
-rw-r--r--app/views/stop_areas/access_links.html.erb12
-rw-r--r--app/views/stop_areas/show.html.erb49
39 files changed, 1135 insertions, 11 deletions
diff --git a/app/assets/images/icons/disabled_left_arrow.png b/app/assets/images/icons/disabled_left_arrow.png
new file mode 100644
index 000000000..d919ca52e
--- /dev/null
+++ b/app/assets/images/icons/disabled_left_arrow.png
Binary files differ
diff --git a/app/assets/images/icons/disabled_right_arrow.png b/app/assets/images/icons/disabled_right_arrow.png
new file mode 100644
index 000000000..57793256b
--- /dev/null
+++ b/app/assets/images/icons/disabled_right_arrow.png
Binary files differ
diff --git a/app/assets/images/icons/gray_left_arrow.png b/app/assets/images/icons/gray_left_arrow.png
new file mode 100644
index 000000000..7dc80a93e
--- /dev/null
+++ b/app/assets/images/icons/gray_left_arrow.png
Binary files differ
diff --git a/app/assets/images/icons/gray_right_arrow.png b/app/assets/images/icons/gray_right_arrow.png
new file mode 100644
index 000000000..a2fa02a7c
--- /dev/null
+++ b/app/assets/images/icons/gray_right_arrow.png
Binary files differ
diff --git a/app/assets/images/icons/green_left_arrow.png b/app/assets/images/icons/green_left_arrow.png
new file mode 100644
index 000000000..26149186d
--- /dev/null
+++ b/app/assets/images/icons/green_left_arrow.png
Binary files differ
diff --git a/app/assets/images/icons/green_right_arrow.png b/app/assets/images/icons/green_right_arrow.png
new file mode 100644
index 000000000..09ac3eec9
--- /dev/null
+++ b/app/assets/images/icons/green_right_arrow.png
Binary files differ
diff --git a/app/assets/images/map/access_in.png b/app/assets/images/map/access_in.png
new file mode 100644
index 000000000..82ea29382
--- /dev/null
+++ b/app/assets/images/map/access_in.png
Binary files differ
diff --git a/app/assets/images/map/access_in_out.png b/app/assets/images/map/access_in_out.png
new file mode 100644
index 000000000..82ea29382
--- /dev/null
+++ b/app/assets/images/map/access_in_out.png
Binary files differ
diff --git a/app/assets/images/map/access_out.png b/app/assets/images/map/access_out.png
new file mode 100644
index 000000000..82ea29382
--- /dev/null
+++ b/app/assets/images/map/access_out.png
Binary files differ
diff --git a/app/assets/javascripts/access_points.js.coffee b/app/assets/javascripts/access_points.js.coffee
new file mode 100644
index 000000000..c0f49ebd5
--- /dev/null
+++ b/app/assets/javascripts/access_points.js.coffee
@@ -0,0 +1,30 @@
+jQuery ->
+ x_y_change = (event) ->
+ if referential_projection != undefined
+ referential_point = new OpenLayers.Geometry.Point($('input#access_point_longitude').val(), $('input#access_point_latitude').val()).transform(new OpenLayers.Projection("EPSG:4326"), referential_projection )
+
+ $('input#access_point_x').val(referential_point.x)
+ $('input#access_point_y').val(referential_point.y)
+
+ feature = map.getLayersByName("access_point")[0].getFeatureByFid($('input#access_point_id').val())
+ google_point = new OpenLayers.LonLat($('input#access_point_longitude').val(), $('input#access_point_latitude').val()).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())
+ feature.move(google_point)
+ map.setCenter(google_point, 16, false, true)
+
+ $('input#access_point_longitude').change(x_y_change)
+ $('input#access_point_latitude').change(x_y_change)
+
+ lon_lat_change = (event) ->
+ if referential_projection != undefined
+ wgs84_point = new OpenLayers.Geometry.Point($('input#access_point_x').val(), $('input#access_point_y').val()).transform(referential_projection, new OpenLayers.Projection("EPSG:4326"))
+
+ $('input#access_point_longitude').val( wgs84_point.x)
+ $('input#access_point_latitude').val( wgs84_point.y)
+
+ feature = map.getLayersByName("stop_area")[0].getFeatureByFid($('input#access_point_id').val())
+ google_point = new OpenLayers.LonLat(wgs84_point.x, wgs84_point.y).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())
+ feature.move(google_point)
+ map.setCenter(google_point, 16, false, true)
+
+ $('input#access_point_x').change(lon_lat_change)
+ $('input#access_point_y').change(lon_lat_change)
diff --git a/app/assets/stylesheets/access_links.css.scss b/app/assets/stylesheets/access_links.css.scss
new file mode 100644
index 000000000..63a55e021
--- /dev/null
+++ b/app/assets/stylesheets/access_links.css.scss
@@ -0,0 +1,21 @@
+// Place all the styles related to the lines controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+@import "common";
+
+
+#workspace.access_links.show
+{
+
+ .summary p label {
+ font-weight: bold;
+ }
+ .duration {
+ padding-left: 10px;
+ }
+
+}
+
+
+
+
diff --git a/app/assets/stylesheets/access_points.css.scss b/app/assets/stylesheets/access_points.css.scss
new file mode 100644
index 000000000..7a27050fa
--- /dev/null
+++ b/app/assets/stylesheets/access_points.css.scss
@@ -0,0 +1,104 @@
+// Place all the styles related to the lines controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+@import "common";
+
+#workspace.access_points.index
+{
+ .access_point:after {
+ @include after_div_for_object;
+ }
+
+ .access_points:after {
+ @include content_to_clear;
+ }
+
+ .access_point {
+ @include div_for_object;
+ /* to create multi-column index */
+ width: 250px;
+ float: left;
+ padding-right: 10px;
+
+ .access_type {
+ width: 25px;
+ height: 64px;
+ float: left;
+ margin-right: 10px;
+
+
+ a {
+ text-decoration: none;
+ }
+ }
+
+ }
+}
+
+#workspace.access_points.edit {
+ legend { padding-bottom: 20px; }
+}
+
+#workspace.access_points.show
+{
+ .geo_data {
+ padding-left:15px;
+ }
+
+ .summary{
+ height: 400px;
+
+ p label {
+ font-weight: bold;
+ }
+ }
+
+ .access_link_pairs {
+
+ .link {
+ border: 2px solid black;
+ }
+ .access_point{
+ float: left;
+ padding: 3px 15px 0px 3px;
+ height: 25px;
+ * { vertical-align:middle; }
+ span { margin-left: 7px; }
+ img { margin: 0px 5px 0px 5px;}
+ }
+ .stop_area{
+ float: left;
+ padding: 3px 15px 0px 3px;
+ height: 25px;
+ * { vertical-align:middle; }
+ span { margin-left: 7px; }
+ img { margin: 0px 5px 0px 5px;}
+ }
+
+ .info {
+ font-size: 10px;
+ color: #777;
+ font-weight: normal;
+ padding-top: 0px;
+ padding-left: 45px;
+ padding-right: 3px;
+ padding-bottom: 3px;
+ }
+ }
+
+}
+
+
+#sidebar ul.selection li {
+ a {
+ line-height: 27px;
+
+ img{
+ height: 25px;
+ width: 25px;
+ vertical-align: middle;
+ }
+ }
+}
+
+
diff --git a/app/assets/stylesheets/stop_areas.css.scss b/app/assets/stylesheets/stop_areas.css.scss
index cd1623a05..fcfeb9fcf 100644
--- a/app/assets/stylesheets/stop_areas.css.scss
+++ b/app/assets/stylesheets/stop_areas.css.scss
@@ -118,6 +118,26 @@
height: 25px;
}
}
+ .access_point {
+ @include div_for_object;
+ /* to create multi-column index */
+ width: 250px;
+ float: left;
+ padding-right: 10px;
+
+ .access_type {
+ width: 25px;
+ height: 64px;
+ float: left;
+ margin-right: 10px;
+
+
+ a {
+ text-decoration: none;
+ }
+ }
+
+ }
}
#workspace.stop_areas.select_parent
@@ -135,6 +155,44 @@
}
}
+
+#workspace.stop_areas.access_links
+{
+ .access_link_pairs {
+ .link {
+ border: 2px solid black;
+ }
+ .access_point{
+ float: left;
+ padding: 3px 15px 0px 3px;
+ height: 25px;
+ * { vertical-align:middle; }
+ span { margin-left: 7px; }
+ img { margin: 0px 5px 0px 5px;}
+ }
+ .stop_area{
+ float: left;
+ padding: 3px 15px 0px 3px;
+ height: 25px;
+ * { vertical-align:middle; }
+ span { margin-left: 7px; }
+ img { margin: 0px 5px 0px 5px;}
+ }
+
+ .info {
+ font-size: 10px;
+ color: #777;
+ font-weight: normal;
+ padding-top: 0px;
+ padding-left: 45px;
+ padding-right: 3px;
+ padding-bottom: 3px;
+ }
+
+ }
+
+}
+
#sidebar ul.selection li {
a {
line-height: 27px;
diff --git a/app/controllers/access_links_controller.rb b/app/controllers/access_links_controller.rb
new file mode 100644
index 000000000..4c0173d4c
--- /dev/null
+++ b/app/controllers/access_links_controller.rb
@@ -0,0 +1,73 @@
+class AccessLinksController < ChouetteController
+ defaults :resource_class => Chouette::AccessLink
+
+ belongs_to :referential do
+ belongs_to :access_point, :parent_class => Chouette::AccessPoint, :optional => true, :polymorphic => true
+ belongs_to :stop_area, :parent_class => Chouette::StopArea, :optional => true, :polymorphic => true
+ end
+
+ respond_to :html, :kml, :xml, :json
+
+
+ def index
+ request.format.kml? ? @per_page = nil : @per_page = 12
+ index!
+ end
+
+ def show
+ #@map = AccessLinkMap.new(resource).with_helpers(self)
+ show!
+ end
+
+ def new
+ @access_point = Chouette::AccessPoint.find(params[:access_point_id])
+ data=params[:access_link]
+ @stop_area = Chouette::StopArea.find(data[:stop_area_id])
+ @orientation = data[:link_orientation_type]
+ name=data[:name]
+ if name.nil? || name.empty?
+ if @orientation == "access_point_to_stop_area"
+ name = "#{@access_point.name} -> #{@stop_area.name}"
+ else
+ name = "#{@stop_area.name} -> #{@access_point.name}"
+ end
+ data[:name] = name
+ end
+ @access_link = Chouette::AccessLink.new(data)
+ new!
+ end
+
+ def create
+ @access_point = Chouette::AccessPoint.find(params[:access_point_id])
+ data=params[:access_link]
+ @stop_area = Chouette::StopArea.find(data[:stop_area_id])
+ @orientation = data[:link_orientation_type]
+ create!
+ end
+
+ def edit
+ @access_point = Chouette::AccessPoint.find(params[:access_point_id])
+ @access_link = Chouette::AccessLink.find(params[:id])
+ @stop_area = @access_link.stop_area
+ @orientation = @access_link.link_orientation_type
+ edit!
+ end
+ protected
+
+ alias_method :access_link, :resource
+
+# def map
+# @map = AccessLinkMap.new(access_link).with_helpers(self)
+# end
+
+ def collection
+ @q = parent.access_links.search(params[:q])
+ @access_links ||=
+ begin
+ access_links = @q.result(:distinct => true).order(:name)
+ access_links = access_links.paginate(:page => params[:page]) if @per_page.present?
+ access_links
+ end
+ end
+
+end
diff --git a/app/controllers/access_points_controller.rb b/app/controllers/access_points_controller.rb
new file mode 100644
index 000000000..4f3c0d717
--- /dev/null
+++ b/app/controllers/access_points_controller.rb
@@ -0,0 +1,54 @@
+class AccessPointsController < ChouetteController
+ defaults :resource_class => Chouette::AccessPoint
+
+ belongs_to :referential do
+ belongs_to :stop_area, :parent_class => Chouette::StopArea, :optional => true, :polymorphic => true
+ end
+
+ respond_to :html, :kml, :xml, :json
+
+
+ def index
+ request.format.kml? ? @per_page = nil : @per_page = 12
+ index!
+ end
+
+ def show
+ map.editable = false
+ @access_links = @access_point.access_link_matrix
+ show! do |format|
+ unless access_point.position or params[:default]
+ format.kml {
+ render :nothing => true, :status => :not_found
+ }
+
+ end
+ end
+ end
+
+ def edit
+ access_point.position ||= access_point.default_position
+ map.editable = true
+ edit!
+ end
+
+
+ protected
+
+ alias_method :access_point, :resource
+
+ def map
+ @map = AccessPointMap.new(access_point).with_helpers(self)
+ end
+
+ def collection
+ @q = parent.access_points.search(params[:q])
+ @access_points ||=
+ begin
+ access_points = @q.result(:distinct => true).order(:name)
+ access_points = access_points.paginate(:page => params[:page]) if @per_page.present?
+ access_points
+ end
+ end
+
+end
diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb
index 08cf86853..dfd756d9b 100644
--- a/app/controllers/stop_areas_controller.rb
+++ b/app/controllers/stop_areas_controller.rb
@@ -34,6 +34,11 @@ class StopAreasController < ChouetteController
@stops = stop_area.routing_stops
end
+ def access_links
+ @stop_area = stop_area
+ @access_links = stop_area.access_link_matrix
+ end
+
def index
request.format.kml? ? @per_page = nil : @per_page = 12
index!
@@ -41,6 +46,7 @@ class StopAreasController < ChouetteController
def show
map.editable = false
+ @access_points = @stop_area.access_points
show! do |format|
unless stop_area.position or params[:default]
format.kml {
diff --git a/app/helpers/access_points_helper.rb b/app/helpers/access_points_helper.rb
new file mode 100644
index 000000000..c5e9f672e
--- /dev/null
+++ b/app/helpers/access_points_helper.rb
@@ -0,0 +1,28 @@
+module AccessPointsHelper
+ def access_links_pairs(access_links)
+ hpairs = Hash.new
+ pairs = Array.new
+ access_links.each do |link|
+ key = pair_key(link)
+ pair = nil
+ if (hpairs.has_key? key)
+ pair = hpairs[key]
+ else
+ pair = AccessLinkPair.new
+ pairs << pair
+ hpairs[key] = pair
+ end
+ if (link.link_orientation_type == "access_point_to_stop_area")
+ pair.from_access_point = link
+ else
+ pair.to_access_point = link
+ end
+ end
+ pairs
+ end
+
+ def pair_key(access_link)
+ "#{access_link.access_point.id}-#{access_link.stop_area.id}"
+ end
+
+end
diff --git a/app/helpers/stop_areas_helper.rb b/app/helpers/stop_areas_helper.rb
new file mode 100644
index 000000000..df598b83f
--- /dev/null
+++ b/app/helpers/stop_areas_helper.rb
@@ -0,0 +1,47 @@
+module StopAreasHelper
+ def genealogical_title
+ return t(".genealogical_routing") if @stop_area.stop_area_type == 'itl'
+ t(".genealogical")
+ end
+
+ def manage_access_points
+ @stop_area.stop_area_type == 'stop_place' || @stop_area.stop_area_type == 'commercial_stop_point'
+ end
+ def manage_itl
+ @stop_area.stop_area_type == 'itl'
+ end
+ def manage_parent
+ @stop_area.stop_area_type != 'itl'
+ end
+ def manage_children
+ @stop_area.stop_area_type == 'stop_place' || @stop_area.stop_area_type == 'commercial_stop_point'
+ end
+
+ def access_links_pairs(access_links)
+ hpairs = Hash.new
+ pairs = Array.new
+ access_links.each do |link|
+ key = pair_key(link)
+ pair = nil
+ if (hpairs.has_key? key)
+ pair = hpairs[key]
+ else
+ pair = AccessLinkPair.new
+ pairs << pair
+ hpairs[key] = pair
+ end
+ if (link.link_orientation_type == "access_point_to_stop_area")
+ pair.from_access_point = link
+ else
+ pair.to_access_point = link
+ end
+ end
+ pairs
+ end
+
+ def pair_key(access_link)
+ "#{access_link.access_point.id}-#{access_link.stop_area.id}"
+ end
+
+
+end
diff --git a/app/maps/access_point_map.rb b/app/maps/access_point_map.rb
new file mode 100644
index 000000000..ebb513ab0
--- /dev/null
+++ b/app/maps/access_point_map.rb
@@ -0,0 +1,62 @@
+class AccessPointMap < ApplicationMap
+
+ attr_reader :access_point
+
+ attr_accessor :editable
+ alias_method :editable?, :editable
+
+ def initialize(access_point)
+ @access_point = access_point
+ end
+
+ def map
+ @map ||= MapLayers::Map.new(id, :projection => projection("EPSG:900913"), :controls => controls) do |map, page|
+ page << map.add_layer(MapLayers::OSM_MAPNIK)
+ page << map.add_layer(google_physical)
+ page << map.add_layer(google_streets)
+ page << map.add_layer(google_hybrid)
+ page << map.add_layer(google_satellite)
+
+ page.assign "edit_access_point_layer", kml_layer(access_point, { :default => editable? }, :style_map => StyleMap::EditAccessPointStyleMap.new(helpers).style_map)
+ page << map.add_layer(:edit_access_point_layer)
+
+
+ if editable?
+ page.assign "referential_projection", projection_type.present? ? projection("EPSG:" + projection_type) : JsVar.new("undefined")
+ # TODO virer ce code inline
+ page << <<EOF
+ edit_access_point_layer.events.on({
+ 'afterfeaturemodified': function(event) {
+ geometry = event.feature.geometry.clone().transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326"));
+ $('#access_point_longitude').val(geometry.x);
+ $('#access_point_latitude').val(geometry.y);
+
+ if(referential_projection != undefined)
+ {
+ projection_geometry = event.feature.geometry.clone().transform(new OpenLayers.Projection("EPSG:900913"), referential_projection );
+ $('#access_point_x').val(projection_geometry.x);
+ $('#access_point_y').val(projection_geometry.y); }
+ }
+ });
+EOF
+ page << map.add_control(OpenLayers::Control::ModifyFeature.new(:edit_access_point_layer, :mode => 8, :autoActivate => true))
+
+ end
+
+ page << map.set_center(center.to_google.to_openlayers, 16, false, true)
+ end
+ end
+
+ def projection_type
+ access_point.referential.projection_type
+ end
+
+ def ready?
+ center.present?
+ end
+
+ def center
+ access_point.geometry or access_point.default_position
+ end
+
+end
diff --git a/app/maps/style_map/access_points_style_map.rb b/app/maps/style_map/access_points_style_map.rb
new file mode 100644
index 000000000..c3bf2586f
--- /dev/null
+++ b/app/maps/style_map/access_points_style_map.rb
@@ -0,0 +1,39 @@
+class StyleMap::AccessPointsStyleMap < StyleMap::GenericStyleMap
+ attr_accessor :style, :context
+
+ def default_style
+ raise "Helpers nil" if @helpers.nil?
+ {:label => "${label}",
+ :fontColor => "black",
+ :fontSize => "11px",
+ :fontWeight => "bold",
+ :labelAlign => "ct",
+ :labelXOffset => 0,
+ :labelYOffset => -40,
+ :pointRadius => 1,
+ :externalGraphic => @helpers.assets_path_patch( "map/access_${accessType}.png"),
+ :graphicWidth => 25,
+ :graphicHeight => 25,
+ :graphicOpacity => 1,
+ :graphicXOffset => -12.5,
+ :graphicYOffset => -12.5 }
+ end
+
+ def initialize(helpers,options = {})
+ @helpers= helpers
+ @style = options[:style].present? ? default_style.merge(options[:style]) : default_style
+ end
+
+
+ def context
+ {
+ :label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} ",
+ :accessType => :" function(feature) { return feature.attributes.access_type.toLowerCase();} "
+ }
+ end
+
+ def style_map
+ OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}) )
+ end
+
+end
diff --git a/app/maps/style_map/edit_access_point_style_map.rb b/app/maps/style_map/edit_access_point_style_map.rb
new file mode 100644
index 000000000..83f9298e8
--- /dev/null
+++ b/app/maps/style_map/edit_access_point_style_map.rb
@@ -0,0 +1,46 @@
+class StyleMap::EditAccessPointStyleMap < StyleMap::GenericStyleMap
+ attr_accessor :style
+
+ def default_style
+ { :fontColor => "black",
+ :fontSize => "11px",
+ :fontWeight => "bold",
+ :labelAlign => "ct",
+ :labelXOffset => 0,
+ :labelYOffset => -15,
+ :pointRadius => 4,
+ :fillColor => "white",
+ :fillOpacity => 1,
+ :strokeColor => "black",
+ :strokeOpacity => 1,
+ :strokeWidth => 2 }
+ end
+
+ def select_style
+ { :fontColor => "black",
+ :fontSize => "11px",
+ :fontWeight => "bold",
+ :pointRadius => 4,
+ :fillColor => "#86b41d",
+ :fillOpacity => 1,
+ :strokeColor => "black",
+ :strokeOpacity => 1,
+ :strokeWidth => 2 }
+ end
+
+ def initialize(helpers, options = {})
+ @helpers= helpers
+ @style = options[:style].present? ? default_style.merge(options[:style]) : default_style
+ end
+
+ def context
+ {
+ :label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} "
+ }
+ end
+
+ def style_map
+ OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}), :select => OpenLayers::Style.new(style.merge( select_style), { :context => context}))
+ end
+
+end
diff --git a/app/models/access_link_pair.rb b/app/models/access_link_pair.rb
new file mode 100644
index 000000000..16df48fd5
--- /dev/null
+++ b/app/models/access_link_pair.rb
@@ -0,0 +1,45 @@
+class AccessLinkPair
+ include ActiveModel::Validations
+ include ActiveModel::Conversion
+ extend ActiveModel::Naming
+
+
+ attr_accessor :from_access_point, :to_access_point
+
+ validates_presence_of :from_access_point, :to_access_point
+
+ def initialize(attributes = {})
+ attributes.each do |name, value|
+ send("#{name}=", value)
+ end
+ end
+
+ def persisted?
+ false
+ end
+
+ def access_point
+ return nil if from_access_point.nil?
+ from_access_point.access_point
+ end
+
+ def stop_area
+ return nil if from_access_point.nil?
+ from_access_point.stop_area
+ end
+
+ def in_valid?
+ access_point.access_point_type != "out"
+ end
+
+ def out_valid?
+ access_point.access_point_type != "in"
+ end
+
+ def in_exists?
+ !from_access_point.id.nil?
+ end
+ def out_exists?
+ !to_access_point.id.nil?
+ end
+end
diff --git a/app/models/referential.rb b/app/models/referential.rb
index b4601caee..70035a32b 100644
--- a/app/models/referential.rb
+++ b/app/models/referential.rb
@@ -59,6 +59,14 @@ class Referential < ActiveRecord::Base
Chouette::StopArea.scoped
end
+ def access_points
+ Chouette::AccessPoint.scoped
+ end
+
+ def access_links
+ Chouette::AccessLink.scoped
+ end
+
def time_tables
Chouette::TimeTable.scoped
end
@@ -210,4 +218,31 @@ Rails.application.config.after_initialize do
end
end
end
+
+ Chouette::AccessPoint
+
+ class Chouette::AccessPoint
+
+ # add projection_type set on pre-insert and pre_update action
+ before_validation :set_projections
+ def set_projections
+ if ! self.latitude.nil? && ! self.longitude.nil?
+ self.long_lat_type = 'WGS84'
+ else
+ self.long_lat_type = nil
+ end
+ if ! self.referential.projection_type.nil? && !self.referential.projection_type.empty?
+ if ! self.x.nil? && ! self.y.nil?
+ self.projection_type = referential.projection_type_label
+ else
+ self.projection_type = nil
+ end
+ else
+ self.projection_type = nil
+ self.x = nil
+ self.y = nil
+ end
+ end
+ end
+
end
diff --git a/app/views/access_link_pairs/_access_link_pair.html.erb b/app/views/access_link_pairs/_access_link_pair.html.erb
new file mode 100644
index 000000000..066411e1c
--- /dev/null
+++ b/app/views/access_link_pairs/_access_link_pair.html.erb
@@ -0,0 +1,57 @@
+<%= div_for(access_link_pair) do %>
+ <tr>
+ <td class="link">
+ <div class="access_point">
+ <%= link_to([@referential, @stop_area, access_link_pair.access_point]) do %>
+ <%= image_tag "map/access_" + access_link_pair.access_point.access_point_type + ".png" %><span><%= access_link_pair.access_point.name %></span>
+ <% end %>
+ </div>
+ <br/><br/>
+ <div class="info">
+ <%= t("access_types.label.#{access_link_pair.access_point.access_point_type}") %>
+ </div>
+ </td>
+ <td>
+ <% if access_link_pair.out_valid? %>
+ <% if access_link_pair.out_exists? %>
+ <%= link_to(referential_access_point_access_link_path(@referential, access_link_pair.access_point,access_link_pair.stop_area,access_link_pair.to_access_point)) do %>
+ <%= image_tag "icons/green_left_arrow.png" %>
+ <% end %>
+ <% else %>
+ <%= link_to(new_referential_access_point_access_link_path(@referential, access_link_pair.access_point, :access_link => {:stop_area_id => access_link_pair.stop_area.id, :link_orientation_type => 'stop_area_to_access_point'})) do %>
+ <%= image_tag "icons/gray_left_arrow.png" %>
+ <% end %>
+ <% end %>
+ <% else %>
+ <%= image_tag "icons/disabled_left_arrow.png" %>
+ <% end %>
+ </td>
+ <td>
+ <% if access_link_pair.in_valid? %>
+ <% if access_link_pair.in_exists? %>
+ <%= link_to(referential_access_point_access_link_path(@referential, access_link_pair.access_point, access_link_pair.from_access_point)) do %>
+ <%= image_tag "icons/green_right_arrow.png" %>
+ <% end %>
+ <% else %>
+ <%= link_to(new_referential_access_point_access_link_path(@referential, access_link_pair.access_point, :access_link => {:stop_area_id => access_link_pair.stop_area.id, :link_orientation_type => 'access_point_to_stop_area'})) do %>
+ <%= image_tag "icons/gray_right_arrow.png" %>
+ <% end %>
+ <% end %>
+ <% else %>
+ <%= image_tag "icons/disabled_right_arrow.png" %>
+ <% end %>
+ </td>
+ <td class="link">
+ <div class="stop_area">
+ <%= link_to([@referential, access_link_pair.stop_area]) do %>
+ <%= image_tag "map/" + access_link_pair.stop_area.stop_area_type + ".png" %><span><%= access_link_pair.stop_area.name %></span>
+ <% end %>
+ </div>
+ <br/><br/>
+ <div class="info">
+ <%= t("area_types.label.#{access_link_pair.stop_area.stop_area_type}") %>
+ </div>
+ </td>
+ </tr>
+ <tr><td colspan=4>&nbsp;</td></tr>
+<% end %>
diff --git a/app/views/access_links/_form.html.erb b/app/views/access_links/_form.html.erb
new file mode 100644
index 000000000..e07de415f
--- /dev/null
+++ b/app/views/access_links/_form.html.erb
@@ -0,0 +1,35 @@
+<%= semantic_form_for [@referential,@access_point,@access_link] do |form| %>
+ <%= form.inputs do %>
+ <%= form.input :access_point_id , :as => :hidden %>
+ <%= form.input :stop_area_id , :as => :hidden %>
+ <%= form.input :link_orientation_type , :as => :hidden%>
+ <%= form.input :name %>
+ <%= form.input :access_link_type, :as => :select, :collection => Chouette::AccessLink.access_link_types, :include_blank => false, :member_label => Proc.new { |type| t("connection_link_types.label.#{type}") } %>
+ <%= form.inputs :name => t('access_links.show.durations') do %>
+ <%= form.input "default_duration(1i)", :as => :hidden ,:input_html => { :value => "2000" } %>
+ <%= form.input "default_duration(2i)", :as => :hidden ,:input_html => { :value => "1" } %>
+ <%= form.input "default_duration(3i)", :as => :hidden ,:input_html => { :value => "1" } %>
+ <%= form.input :default_duration, :ignore_date=>true,:include_seconds=>true, :label => @access_link.human_attribute_name("default_duration")%>
+ <%= form.input "frequent_traveller_duration(1i)", :as => :hidden ,:input_html => { :value => "2000" } %>
+ <%= form.input "frequent_traveller_duration(2i)", :as => :hidden ,:input_html => { :value => "1" } %>
+ <%= form.input "frequent_traveller_duration(3i)", :as => :hidden ,:input_html => { :value => "1" } %>
+ <%= form.input :frequent_traveller_duration, :ignore_date=>true,:include_seconds=>true, :label => @access_link.human_attribute_name("frequent_traveller_duration")%>
+ <%= form.input "occasional_traveller_duration(1i)", :as => :hidden ,:input_html => { :value => "2000" } %>
+ <%= form.input "occasional_traveller_duration(2i)", :as => :hidden ,:input_html => { :value => "1" } %>
+ <%= form.input "occasional_traveller_duration(3i)", :as => :hidden ,:input_html => { :value => "1" } %>
+ <%= form.input :occasional_traveller_duration, :ignore_date=>true,:include_seconds=>true, :label => @access_link.human_attribute_name("occasional_traveller_duration")%>
+ <%= form.input "mobility_restricted_traveller_duration(1i)", :as => :hidden ,:input_html => { :value => "2000" } %>
+ <%= form.input "mobility_restricted_traveller_duration(2i)", :as => :hidden ,:input_html => { :value => "1" } %>
+ <%= form.input "mobility_restricted_traveller_duration(3i)", :as => :hidden ,:input_html => { :value => "1" } %>
+ <%= form.input :mobility_restricted_traveller_duration, :ignore_date=>true,:include_seconds=>true, :label => @access_link.human_attribute_name("mobility_restricted_traveller_duration")%>
+ <% end %>
+ <%= form.input :mobility_restricted_suitability,:as => :boolean %>
+ <%= form.input :stairs_availability,:as => :boolean %>
+ <%= form.input :lift_availability,:as => :boolean %>
+ <%= form.input :objectid, :required => !@access_link.new_record?, :input_html => { :disabled => !@access_link.new_record? } %>
+ <% end %>
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
+<% end %>
diff --git a/app/views/access_links/edit.html.erb b/app/views/access_links/edit.html.erb
new file mode 100644
index 000000000..c954989f1
--- /dev/null
+++ b/app/views/access_links/edit.html.erb
@@ -0,0 +1,4 @@
+<%= title_tag t("access_links.edit.title_#{@orientation}", :access_point => @access_point.name, :stop_area => @stop_area.name ) %>
+
+
+<%= render "form" %>
diff --git a/app/views/access_links/new.html.erb b/app/views/access_links/new.html.erb
new file mode 100644
index 000000000..db9a611a5
--- /dev/null
+++ b/app/views/access_links/new.html.erb
@@ -0,0 +1,3 @@
+<%= title_tag t("access_links.new.title_#{@orientation}", :access_point => @access_point.name, :stop_area => @stop_area.name ) %>
+
+<%= render "form" %>
diff --git a/app/views/access_links/show.html.erb b/app/views/access_links/show.html.erb
new file mode 100644
index 000000000..27e2e9bbf
--- /dev/null
+++ b/app/views/access_links/show.html.erb
@@ -0,0 +1,90 @@
+<%= title_tag t('access_links.show.title', :access_link => @access_link.name ) %>
+
+<div class="access_link_show">
+
+ <div class="summary">
+ <p>
+ <label><%= @access_link.human_attribute_name(:access_point) %>: </label>
+ <%= link_to @access_link.access_point.name, [@referential, @access_link.access_point.stop_area, @access_link.access_point] %>
+ </p>
+ <p>
+ <label><%= @access_link.human_attribute_name(:stop_area) %>: </label>
+ <%= link_to @access_link.stop_area.name, [@referential, @access_link.stop_area] %>
+ </p>
+ <p>
+ <label><%= @access_link.human_attribute_name("name") %>: </label>
+ <%= @access_link.name %>
+ </p>
+ <p>
+ <label><%= @access_link.human_attribute_name("access_link_type") %>: </label>
+ <%= t("connection_link_types.label.#{@access_link.access_link_type}") %>
+ </p>
+ <p>
+ <label><%= @access_link.human_attribute_name("comment") %>: </label>
+ <%= @access_link.comment %>
+ </p>
+ <p>
+ <label><%= @access_link.human_attribute_name("link_distance") %>: </label>
+ <%= @access_link.link_distance %>
+ </p>
+ <p>
+ <label><%= t('access_links.show.durations') %> </label>
+ </p>
+ <p>
+ <label class='duration'><%= @access_link.human_attribute_name("default_duration") %>: </label>
+ <% if (@access_link.default_duration.present?) %>
+ <%= @access_link.default_duration.strftime('%Hh %Mm %Ss') %>
+ <% end %>
+ </p>
+ <p>
+ <label class='duration'><%= @access_link.human_attribute_name("frequent_traveller_duration") %>: </label>
+ <% if (@access_link.frequent_traveller_duration.present?) %>
+ <%= @access_link.frequent_traveller_duration.strftime('%Hh %Mm %Ss') %>
+ <% end %>
+ </p>
+ <p>
+ <label class='duration'><%= @access_link.human_attribute_name("occasional_traveller_duration") %>: </label>
+ <% if (@access_link.occasional_traveller_duration.present?) %>
+ <%= @access_link.occasional_traveller_duration.strftime('%Hh %Mm %Ss') %>
+ <% end %>
+ </p>
+ <p>
+ <label class='duration'><%= @access_link.human_attribute_name("mobility_restricted_traveller_duration") %>: </label>
+ <% if (@access_link.mobility_restricted_traveller_duration.present?) %>
+ <%= @access_link.mobility_restricted_traveller_duration.strftime('%Hh %Mm %Ss') %>
+ <% end %>
+ </p>
+ <p>
+ <label><%= @access_link.human_attribute_name("mobility_restricted_suitability") %>: </label>
+ <%= t((@access_link.mobility_restricted_suitability == true).to_s) %>
+ </p>
+ <p>
+ <label><%= @access_link.human_attribute_name("stairs_availability") %>: </label>
+ <%= t((@access_link.stairs_availability == true).to_s) %>
+ </p>
+ <p>
+ <label><%= @access_link.human_attribute_name("lift_availability") %>: </label>
+ <%= t((@access_link.lift_availability == true).to_s) %>
+ </p>
+ <p>
+ <label><%= @access_link.human_attribute_name("objectid") %>: </label>
+ <%= @access_link.objectid %>
+ </p>
+ <p>
+ <label><%= @access_link.human_attribute_name("creation_time") %>: </label>
+ <%= l(@access_link.creation_time) %>
+ </p>
+ <p>
+ <label><%= @access_link.human_attribute_name("creator_id") %>: </label>
+ <%= @access_link.creator_id %>
+ </p>
+ </div>
+</div>
+
+<% content_for :sidebar do %>
+<ul class="actions">
+ <li><%= link_to t('access_links.actions.edit'), edit_referential_access_point_access_link_path(@referential, @access_link.access_point, @access_link), :class => "edit" %></li>
+ <li><%= link_to t('access_links.actions.destroy'), referential_access_point_access_link_path(@referential, @access_link.access_point, @access_link), :method => :delete, :data => {:confirm => t('access_links.actions.destroy_confirm')}, :class => "remove" %></li>
+ <br>
+</ul>
+<% end %>
diff --git a/app/views/access_points/_access_point.html.erb b/app/views/access_points/_access_point.html.erb
new file mode 100644
index 000000000..2890cc124
--- /dev/null
+++ b/app/views/access_points/_access_point.html.erb
@@ -0,0 +1,20 @@
+<%= div_for(access_point) do %>
+ <%= link_to([@referential, @stop_area, access_point], :class => "preview") do %>
+ <div class="access_point_type">
+ <%= image_tag "map/access_" + access_point.access_point_type + ".png" %>
+ </div>
+ <% end %>
+ <%= link_to access_point.name, [@referential, @stop_area, access_point] %>
+ <div class="info">
+ <p>
+ <% unless access_point.geometry %>
+ <span class="warning"><%= t('.no_position') %></span> -
+ <% end %>
+ </p>
+ <p><%= t("access_types.label.#{access_point.access_point_type}") %></p>
+ <div class="actions">
+ <%= link_to t("actions.edit"), edit_referential_stop_area_access_point_path(@referential, @stop_area, access_point), :class => "edit" %> |
+ <%= link_to t("actions.destroy"), referential_stop_area_access_point_path(@referential, @stop_area, access_point), :method => :delete, :data => {:confirm => t('access_points.actions.destroy_confirm')}, :class => "remove" %>
+ </div>
+ </div>
+<% end %>
diff --git a/app/views/access_points/_form.html.erb b/app/views/access_points/_form.html.erb
new file mode 100644
index 000000000..cd728f0d6
--- /dev/null
+++ b/app/views/access_points/_form.html.erb
@@ -0,0 +1,44 @@
+<%= semantic_form_for [@referential, @stop_area, @access_point] do |form| %>
+ <%= form.inputs do %>
+ <%= form.input :id, :as => :hidden %>
+ <%= form.input :name %>
+ <%= form.input :access_point_type, :as => :select, :input_html => { :disabled => !@access_point.new_record? },
+ :collection => Chouette::AccessPoint.access_point_types, :include_blank => false, :member_label => Proc.new { |access_point_type| t("access_types.label.#{access_point_type}") } %>
+ <%= form.input :street_name %>
+ <%= form.input :country_code %>
+ <%= form.input :comment %>
+ <%= form.inputs do %>
+ <%= form.input "openning_time(1i)", :as => :hidden ,:input_html => { :value => "2000" } %>
+ <%= form.input "openning_time(2i)", :as => :hidden ,:input_html => { :value => "1" } %>
+ <%= form.input "openning_time(3i)", :as => :hidden ,:input_html => { :value => "1" } %>
+ <%= form.input "openning_time(6i)", :as => :hidden ,:input_html => { :value => "0" } %>
+ <%= form.input :openning_time, :ignore_date=>true, :label => @access_point.human_attribute_name("openning_time")%>
+ <%= form.input "closing_time(1i)", :as => :hidden ,:input_html => { :value => "2000" } %>
+ <%= form.input "closing_time(2i)", :as => :hidden ,:input_html => { :value => "1" } %>
+ <%= form.input "closing_time(3i)", :as => :hidden ,:input_html => { :value => "1" } %>
+ <%= form.input "closing_time(6i)", :as => :hidden ,:input_html => { :value => "0" } %>
+ <%= form.input :closing_time, :ignore_date=>true, :label => @access_point.human_attribute_name("closing_time")%>
+ <% end %>
+ <%= form.input :mobility_restricted_suitability,:as => :boolean %>
+ <%= form.input :stairs_availability,:as => :boolean %>
+ <%= form.input :lift_availability,:as => :boolean %>
+ <%= form.input :objectid, :required => !@access_point.new_record?, :input_html => { :disabled => !@access_point.new_record? } %>
+ <%= form.inputs :name => t('access_points.show.geographic_data') do %>
+ <% if ! @referential.projection_type_label.empty? %>
+ <%= form.inputs :name => @referential.projection_type_label do %>
+ <%= form.input :x %>
+ <%= form.input :y %>
+ <% end %>
+ <% end %>
+ <%= form.inputs :name => "WGS84" do %>
+ <%= form.input :longitude %>
+ <%= form.input :latitude %>
+ <% end %>
+ <% end %>
+ <% end %>
+
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
+<% end %>
diff --git a/app/views/access_points/edit.html.erb b/app/views/access_points/edit.html.erb
new file mode 100644
index 000000000..e2e8636b3
--- /dev/null
+++ b/app/views/access_points/edit.html.erb
@@ -0,0 +1,5 @@
+<%= title_tag t('access_points.edit.title', :access_point => @access_point.name ) %>
+
+<%= @map.to_html %>
+
+<%= render "form" %>
diff --git a/app/views/access_points/index.html.erb b/app/views/access_points/index.html.erb
new file mode 100644
index 000000000..164169205
--- /dev/null
+++ b/app/views/access_points/index.html.erb
@@ -0,0 +1,26 @@
+<%= title_tag t('access_points.index.title', :stop_area => @stop_area.name) %>
+
+<%= search_form_for @q, :url => referential_stop_area_access_points_path(@referential,@stop_area), :html => {:method => :get} do |f| %>
+ <%= f.label :name_or_country_code_cont, "#{t('.name_or_country_code')} :" %>
+ <%= f.text_field :name_or_country_code_cont %>
+
+ <%= f.submit t('actions.search') %> <%= t("or") %>
+ <%= link_to t("cancel"), referential_stop_area_access_points_path(@referential,@stop_area) %>
+<% end %>
+
+<div class="page_info">
+ <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @access_points %>
+</div>
+<div class="access_points paginated_content">
+ <%= render :partial => "access_point", :collection => @access_points %>
+</div>
+<div class="pagination">
+ <%= will_paginate @access_points, :container => false %>
+</div>
+
+<% content_for :sidebar do %>
+<ul class="actions">
+ <li><%= link_to t('access_points.actions.new'), new_referential_stop_area_access_point_path(@referential,@stop_area), :class => "add" %></li>
+</ul>
+
+<% end %>
diff --git a/app/views/access_points/index.kml.erb b/app/views/access_points/index.kml.erb
new file mode 100644
index 000000000..bbcf19d23
--- /dev/null
+++ b/app/views/access_points/index.kml.erb
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kml xmlns="http://www.opengis.net/kml/2.2">
+ <Document>
+ <% @access_points.where("latitude is not null and longitude is not null").each do |access_point| %>
+ <Placemark id="<%= access_point.id %>" >
+ <name><%= access_point.name %></name>
+ <access_point_type><%= access_pointaccess_point_type %></access_point_type>
+ <%= access_point.geometry.kml_representation.html_safe %>
+ </Placemark>
+ <% end %>
+ </Document>
+</kml>
diff --git a/app/views/access_points/new.html.erb b/app/views/access_points/new.html.erb
new file mode 100644
index 000000000..3b9c8a397
--- /dev/null
+++ b/app/views/access_points/new.html.erb
@@ -0,0 +1,3 @@
+<%= title_tag t('access_points.new.title') %>
+
+<%= render "form" %>
diff --git a/app/views/access_points/show.html.erb b/app/views/access_points/show.html.erb
new file mode 100644
index 000000000..fb46c27c8
--- /dev/null
+++ b/app/views/access_points/show.html.erb
@@ -0,0 +1,123 @@
+<%= title_tag t('access_points.show.title', :access_point => @access_point.name) %>
+<div class="access_point_show">
+ <% if @access_point.projection_type != nil || @access_point.long_lat_type != nil %>
+ <%= @map.to_html %>
+ <% end %>
+ <div class="summary">
+ <p>
+ <label><%= @access_point.human_attribute_name(:stop_area) %>: </label>
+ <%= link_to @stop_area.name, [@referential, @stop_area] %>
+ </p>
+ <p>
+ <label><%= @access_point.human_attribute_name("name") %>: </label>
+ <%= @access_point.name %>
+ </p>
+ <p>
+ <label><%= @access_point.human_attribute_name("comment") %>: </label>
+ <%= @access_point.comment %>
+ </p>
+ <p>
+ <label><%= @access_point.human_attribute_name("street_name") %>: </label>
+ <%= @access_point.street_name %>
+ </p>
+ <p>
+ <label><%= @access_point.human_attribute_name("country_code") %>: </label>
+ <%= @access_point.country_code %>
+ </p>
+ <p>
+ <label><%= @access_point.human_attribute_name("access_point_type") %>: </label>
+ <%= t("access_types.label.#{@access_point.access_point_type}") %>
+ </p>
+ <p>
+ <label><%= @access_point.human_attribute_name("openning_time") %>: </label>
+ <% if (@access_point.openning_time.present?) %>
+ <%= @access_point.openning_time.strftime('%Hh %Mm') %>
+ <% end %>
+ </p>
+ <p>
+ <label><%= @access_point.human_attribute_name("closing_time") %>: </label>
+ <% if (@access_point.closing_time.present?) %>
+ <%= @access_point.closing_time.strftime('%Hh %Mm') %>
+ <% end %>
+ </p>
+ <p>
+ <label><%= @access_point.human_attribute_name("mobility_restricted_suitability") %>: </label>
+ <%= t((@access_point.mobility_restricted_suitability == true).to_s) %>
+ </p>
+ <p>
+ <label><%= @access_point.human_attribute_name("stairs_availability") %>: </label>
+ <%= t((@access_point.stairs_availability == true).to_s) %>
+ </p>
+ <p>
+ <label><%= @access_point.human_attribute_name("lift_availability") %>: </label>
+ <%= t((@access_point.lift_availability == true).to_s) %>
+ </p>
+ <p> <label><%= t('access_points.show.geographic_data') %> </label></p>
+ <% if @access_point.projection_type == nil && @access_point.long_lat_type == nil %>
+ <span class='geo_data'><%= t('access_points.show.no_geographic_data') %></span>
+ <% else %>
+ <% if !@access_point.projection_type.nil? %>
+ <p>
+ <span class='geo_data'><%= @access_point.human_attribute_name("projection_type") %>: </span>
+ <%= @access_point.projection_type %>
+ </p>
+ <p>
+ <span class='geo_data'><%= @access_point.human_attribute_name("x") %>: </span>
+ <%= @access_point.x %>
+ </p>
+ <p>
+ <span class='geo_data'><%= @access_point.human_attribute_name("y") %>: </span>
+ <%= @access_point.y %>
+ </p>
+ <% end %>
+ <% if !@access_point.long_lat_type.nil? %>
+ <p>
+ <span class='geo_data'><%= @access_point.human_attribute_name("long_lat_type") %>: </span>
+ <%= @access_point.long_lat_type %>
+ </p>
+ <p>
+ <span class='geo_data'><%= @access_point.human_attribute_name("longitude") %>: </span>
+ <%= @access_point.longitude %>
+ </p>
+ <p>
+ <span class='geo_data'><%= @access_point.human_attribute_name("latitude") %>: </span>
+ <%= @access_point.latitude %>
+ </p>
+ <% end %>
+ <% end %>
+ <p>
+ <label><%= @access_point.human_attribute_name("objectid") %>: </label>
+ <%= @access_point.objectid %>
+ </p>
+ <p>
+ <label><%= @access_point.human_attribute_name("creation_time") %>: </label>
+ <%= l(@access_point.creation_time) %>
+ </p>
+ <p>
+ <label><%= @access_point.human_attribute_name("creator_id") %>: </label>
+ <%= @access_point.creator_id %>
+ </p>
+ </div>
+
+</div>
+
+<p class="after_map" />
+<div>
+ <h3><%= t('.access_links') %></h3>
+ <div class="access_link_pairs">
+ <table>
+ <%= render :partial => "access_link_pairs/access_link_pair", :collection => access_links_pairs(@access_links) %>
+ </table>
+ </div>
+ <p><%= t('.access_link_legend_1') %></p>
+ <p><%= t('.access_link_legend_2') %></p>
+</div>
+
+
+<% content_for :sidebar do %>
+<ul class="actions">
+ <li><%= link_to t('access_points.actions.edit'), edit_referential_stop_area_access_point_path(@referential, @stop_area, @access_point), :class => "edit" %></li>
+ <li><%= link_to t('access_points.actions.destroy'), referential_stop_area_access_point_path(@referential, @stop_area, @access_point), :method => :delete, :data => {:confirm => t('access_points.actions.destroy_confirm')}, :class => "remove" %></li>
+</ul>
+ <br>
+<% end %>
diff --git a/app/views/access_points/show.kml.erb b/app/views/access_points/show.kml.erb
new file mode 100644
index 000000000..f54e6340e
--- /dev/null
+++ b/app/views/access_points/show.kml.erb
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kml xmlns="http://www.opengis.net/kml/2.2">
+ <Document>
+ <Placemark id="<%= @access_point.id %>" >
+ <name><%= @access_point.name %></name>
+ <access_point_type><%= @access_point.access_point_type %></access_point_type>
+ <%= (@access_point.position or @access_point.default_position).kml_representation.html_safe %>
+ </Placemark>
+ </Document>
+</kml>
diff --git a/app/views/referentials/_counts.html.erb b/app/views/referentials/_counts.html.erb
index f6296f52e..35841b271 100644
--- a/app/views/referentials/_counts.html.erb
+++ b/app/views/referentials/_counts.html.erb
@@ -63,5 +63,10 @@
<td class="object"><%= Referential.human_attribute_name("itls") %></td>
<td class="value"> <%= @referential.stop_areas.where("area_type = ?","ITL").size %></td>
</tr>
+ <tr>
+ <td class="image"><%= image_tag "map/access_in_out.png"%></td>
+ <td class="object"><%= Referential.human_attribute_name("access_points") %></td>
+ <td class="value"> <%= @referential.access_points.size %></td>
+ </tr>
</tbody>
</table>
diff --git a/app/views/stop_areas/access_links.html.erb b/app/views/stop_areas/access_links.html.erb
new file mode 100644
index 000000000..7d2ff7928
--- /dev/null
+++ b/app/views/stop_areas/access_links.html.erb
@@ -0,0 +1,12 @@
+<%= title_tag t('stop_areas.access_links.title', :stop_area => @stop_area.name ) %>
+
+<div class="stop_area_show">
+ <div class="access_link_pairs">
+ <table>
+ <%= render :partial => "access_link_pairs/access_link_pair", :collection => access_links_pairs(@access_links) %>
+ </table>
+ </div>
+ <p><%= t('.access_link_legend_1') %></p>
+ <p><%= t('.access_link_legend_2') %></p>
+</div>
+
diff --git a/app/views/stop_areas/show.html.erb b/app/views/stop_areas/show.html.erb
index 17f74d905..44755d020 100644
--- a/app/views/stop_areas/show.html.erb
+++ b/app/views/stop_areas/show.html.erb
@@ -84,13 +84,10 @@
</p>
</div>
+ <p class="after_map" />
<div class="genealogical">
- <% if @stop_area.stop_area_type == 'itl' %>
- <h3><%= t(".genealogical_routing") %></h3>
- <% else %>
- <h3><%= t(".genealogical") %></h3>
- <% end %>
+ <h3><%= genealogical_title %></h3>
<% if @stop_area.parent.present? %>
<div class="parent">
@@ -159,26 +156,56 @@
</div>
</div>
+
+<% if manage_access_points %>
+ <p class="after_map" />
+<div>
+ <h3><%= t('.access_points') %></h3>
+
+ <div class="access_points paginated_content">
+ <%= render :partial => "access_points/access_point", :collection => @access_points %>
+ </div>
+</div>
+<% end %>
<% content_for :sidebar do %>
-<ul class="actions">
- <li><%= link_to t('stop_areas.actions.edit'), edit_referential_stop_area_path(@referential, @stop_area), :class => "edit" %></li>
- <li><%= link_to t('stop_areas.actions.destroy'), referential_stop_area_path(@referential, @stop_area), :method => :delete, :data => {:confirm => t('stop_areas.actions.destroy_confirm')}, :class => "remove" %></li>
-</ul>
- <% if @stop_area.stop_area_type == 'itl' %>
+ <table>
+ <tr><td>
+ <ul class="actions">
+ <li><%= link_to t('stop_areas.actions.edit'), edit_referential_stop_area_path(@referential, @stop_area), :class => "edit" %></li>
+ <li><%= link_to t('stop_areas.actions.destroy'), referential_stop_area_path(@referential, @stop_area), :method => :delete, :data => {:confirm => t('stop_areas.actions.destroy_confirm')}, :class => "remove" %></li>
+ </ul>
+ </td></tr>
+ <% if manage_itl %>
+ <tr><td>
<h3><%= t(".itl_managment") %></h3>
<ul class="actions">
<li><%= link_to t('stop_areas.actions.add_routing_lines'), add_routing_lines_referential_stop_area_path(@referential, @stop_area), :class => "add_routing_lines" %></li>
<li><%= link_to t('stop_areas.actions.add_routing_stops'), add_routing_stops_referential_stop_area_path(@referential, @stop_area), :class => "add_routing_stops" %></li>
</ul>
+ </td></tr>
<% else %>
+ <tr><td>
<h3><%= t(".stop_managment") %></h3>
<ul class="actions">
<li><%= link_to t('stop_areas.actions.select_parent'), select_parent_referential_stop_area_path(@referential, @stop_area), :class => "select_parent" %></li>
- <% if @stop_area.stop_area_type != 'boarding_position' && @stop_area.stop_area_type != 'quay' %>
+ <% if manage_children %>
<li><%= link_to t('stop_areas.actions.add_children'), add_children_referential_stop_area_path(@referential, @stop_area), :class => "add_children" %></li>
<% end %>
</ul>
+ </td></tr>
+
+ <% if manage_access_points %>
+ <tr><td>
+ <h3><%= t(".access_managment") %></h3>
+ <ul class="actions">
+ <li><%= link_to t('access_points.actions.new'), new_referential_stop_area_access_point_path(@referential,@stop_area), :class => "add" %></li>
+ <li><%= link_to t('stop_areas.actions.manage_access_links'), access_links_referential_stop_area_path(@referential,@stop_area), :class => "select_parent" %></li>
+ </ul>
+ </td></tr>
+ <% end %>
+
<% end %>
+ </table>
<br>
<% end %>