infopark_rails_connector 6.9.1.3.22208381 → 6.9.2.1.125136549

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. data/README +2 -14
  2. data/app/assets/javascripts/infopark_rails_connector.js.erb +0 -3
  3. data/app/assets/stylesheets/infopark_rails_connector.css.erb +0 -4
  4. data/app/controllers/rails_connector/default_cms_controller.rb +0 -1
  5. data/app/helpers/rails_connector/default_cms_helper.rb +0 -6
  6. data/app/helpers/rails_connector/layout_helper.rb +2 -7
  7. data/app/views/cms/index.html.erb +0 -2
  8. data/app/views/errors/410_gone.html.erb +2 -2
  9. data/config/ca-bundle.crt +1 -1
  10. data/config/cms_routes.rb +2 -1
  11. data/config/locales/de.rails_connector.views.yml +0 -78
  12. data/config/locales/en.rails_connector.views.yml +0 -78
  13. data/lib/generators/rails_connector/install/install_generator.rb +0 -1
  14. data/lib/generators/rails_connector/install/templates/initializers/rails_connector.rb +0 -27
  15. data/lib/rails_connector/cms_accessible.rb +0 -4
  16. data/lib/rails_connector/configuration.rb +9 -72
  17. data/lib/rails_connector/engine.rb +0 -18
  18. metadata +3 -181
  19. data/app/assets/images/ratings/star.gif +0 -0
  20. data/app/assets/images/time_machine/calendar-menuarrow.gif +0 -0
  21. data/app/assets/images/time_machine/calendar_bg.png +0 -0
  22. data/app/assets/images/time_machine/icon.png +0 -0
  23. data/app/assets/images/time_machine/slider_bg.png +0 -0
  24. data/app/assets/images/time_machine/slider_handle.png +0 -0
  25. data/app/assets/images/time_machine/timemachine_bg.png +0 -0
  26. data/app/assets/javascripts/comments.js +0 -29
  27. data/app/assets/javascripts/initializer.js +0 -9
  28. data/app/assets/javascripts/ratings.js +0 -26
  29. data/app/assets/javascripts/time_machine.js +0 -8
  30. data/app/assets/javascripts/time_machine/calendar-setup.js +0 -200
  31. data/app/assets/javascripts/time_machine/calendar.js +0 -1806
  32. data/app/assets/javascripts/time_machine/lang/calendar-de.js +0 -127
  33. data/app/assets/javascripts/time_machine/lang/calendar-en.js +0 -127
  34. data/app/assets/javascripts/time_machine/lang/calendar-es.js +0 -129
  35. data/app/assets/javascripts/time_machine/lang/calendar-fr.js +0 -125
  36. data/app/assets/javascripts/time_machine/lang/calendar-it.js +0 -124
  37. data/app/assets/javascripts/time_machine/slider.js +0 -278
  38. data/app/assets/stylesheets/ratings.css +0 -97
  39. data/app/assets/stylesheets/time_machine.css +0 -6
  40. data/app/assets/stylesheets/time_machine/time_machine.css +0 -292
  41. data/app/controllers/comments_controller.rb +0 -6
  42. data/app/controllers/crm_form_controller.rb +0 -6
  43. data/app/controllers/rails_connector/default_comments_controller.rb +0 -70
  44. data/app/controllers/rails_connector/default_crm_form_controller.rb +0 -167
  45. data/app/controllers/rails_connector/default_ratings_controller.rb +0 -84
  46. data/app/controllers/rails_connector/default_rss_controller.rb +0 -30
  47. data/app/controllers/rails_connector/default_search_controller.rb +0 -60
  48. data/app/controllers/rails_connector/default_user_controller.rb +0 -269
  49. data/app/controllers/rails_connector/time_machine_controller.rb +0 -48
  50. data/app/controllers/ratings_controller.rb +0 -6
  51. data/app/controllers/rss_controller.rb +0 -6
  52. data/app/controllers/search_controller.rb +0 -6
  53. data/app/controllers/seo_sitemap_controller.rb +0 -12
  54. data/app/controllers/user_controller.rb +0 -6
  55. data/app/helpers/crm_form_helper.rb +0 -6
  56. data/app/helpers/rails_connector/default_crm_form_helper.rb +0 -58
  57. data/app/helpers/rails_connector/default_ratings_helper.rb +0 -38
  58. data/app/helpers/rails_connector/default_user_helper.rb +0 -90
  59. data/app/helpers/rails_connector/error_messages_helper.rb +0 -23
  60. data/app/helpers/rails_connector/link_helper.rb +0 -93
  61. data/app/helpers/rails_connector/mandatory_label_helper.rb +0 -10
  62. data/app/helpers/rails_connector/menu_helper.rb +0 -73
  63. data/app/helpers/rails_connector/micronav_helper.rb +0 -109
  64. data/app/helpers/rails_connector/seo_helper.rb +0 -44
  65. data/app/helpers/rails_connector/time_machine_helper.rb +0 -26
  66. data/app/helpers/rails_connector/tracking_helper.rb +0 -32
  67. data/app/helpers/ratings_helper.rb +0 -4
  68. data/app/helpers/user_helper.rb +0 -6
  69. data/app/mailers/confirmation_mailer.rb +0 -15
  70. data/app/models/crm_form.rb +0 -2
  71. data/app/models/rails_connector/default_comment.rb +0 -30
  72. data/app/models/rails_connector/default_rating.rb +0 -22
  73. data/app/views/cms/_comments.html.erb +0 -44
  74. data/app/views/cms/_rating.html.erb +0 -31
  75. data/app/views/comments/_comment.html.erb +0 -28
  76. data/app/views/confirmation_mailer/register_confirmation.erb +0 -5
  77. data/app/views/confirmation_mailer/reset_password.erb +0 -5
  78. data/app/views/crm_form/_flash_messages.html.erb +0 -11
  79. data/app/views/crm_form/_form.html.erb +0 -17
  80. data/app/views/crm_form/confirmation.html.erb +0 -3
  81. data/app/views/crm_form/index.html.erb +0 -5
  82. data/app/views/crm_form/not_logged_in.html.erb +0 -1
  83. data/app/views/layouts/rails_connector/time_machine.html.erb +0 -12
  84. data/app/views/rails_connector/time_machine/index.html.erb +0 -88
  85. data/app/views/rss/_item.rss.builder +0 -11
  86. data/app/views/rss/index.rss.builder +0 -11
  87. data/app/views/search/_hit.html.erb +0 -11
  88. data/app/views/search/_hits.html.erb +0 -11
  89. data/app/views/search/_mini_panel.html.erb +0 -4
  90. data/app/views/search/_pagination.html.erb +0 -5
  91. data/app/views/search/_panel.html.erb +0 -4
  92. data/app/views/search/search.html.erb +0 -12
  93. data/app/views/seo_sitemap/show.xml.builder +0 -16
  94. data/app/views/user/_flash_messages.html.erb +0 -11
  95. data/app/views/user/edit.html.erb +0 -6
  96. data/app/views/user/edit_password.html.erb +0 -11
  97. data/app/views/user/forgot_password.html.erb +0 -7
  98. data/app/views/user/login.html.erb +0 -15
  99. data/app/views/user/new.html.erb +0 -13
  100. data/app/views/user/profile.html.erb +0 -8
  101. data/app/views/user/register_pending.html.erb +0 -1
  102. data/app/views/user/set_password.html.erb +0 -14
  103. data/config/locales/de.rails_connector.controllers.yml +0 -28
  104. data/config/locales/de.rails_connector.helpers.yml +0 -9
  105. data/config/locales/de.rails_connector.models.yml +0 -8
  106. data/config/locales/en.rails_connector.controllers.yml +0 -28
  107. data/config/locales/en.rails_connector.helpers.yml +0 -9
  108. data/config/locales/en.rails_connector.models.yml +0 -8
  109. data/config/routes.rb +0 -31
  110. data/lib/generators/rails_connector/comments/comments_generator.rb +0 -20
  111. data/lib/generators/rails_connector/comments/templates/migration.rb +0 -16
  112. data/lib/generators/rails_connector/install/templates/initializers/crm_connector.rb +0 -22
  113. data/lib/generators/rails_connector/ratings/ratings_generator.rb +0 -20
  114. data/lib/generators/rails_connector/ratings/templates/migration.rb +0 -14
  115. data/lib/rails_connector/commentable.rb +0 -23
  116. data/lib/rails_connector/configuration/google_analytics.rb +0 -29
  117. data/lib/rails_connector/configuration/rss.rb +0 -46
  118. data/lib/rails_connector/crm.rb +0 -282
  119. data/lib/rails_connector/googlebot_checker.rb +0 -46
  120. data/lib/rails_connector/liquid_support.rb +0 -25
  121. data/lib/rails_connector/liquid_support/field_value_drop.rb +0 -22
  122. data/lib/rails_connector/liquid_support/general_helper_tag.rb +0 -44
  123. data/lib/rails_connector/liquid_support/link_drop.rb +0 -22
  124. data/lib/rails_connector/liquid_support/liquid_template_handler.rb +0 -162
  125. data/lib/rails_connector/liquid_support/named_object_drop.rb +0 -14
  126. data/lib/rails_connector/liquid_support/obj_drop.rb +0 -43
  127. data/lib/rails_connector/liquid_support/obj_filters.rb +0 -77
  128. data/lib/rails_connector/rateable.rb +0 -57
  129. data/lib/rails_connector/seo.rb +0 -52
  130. data/lib/rails_connector/ses.rb +0 -81
  131. data/lib/rails_connector/syndicateable.rb +0 -11
  132. data/lib/search_request.rb +0 -2
@@ -1,44 +0,0 @@
1
- module RailsConnector
2
-
3
- # This helper provides methods for Search Engine Optimization.
4
- module SeoHelper
5
-
6
- # Generate search engine optimized meta tags for the html head.
7
- #
8
- # Example:
9
- #
10
- # seo_header_tags(
11
- # :company_name => 'Infopark AG',
12
- # :default_keywords => 'default, key, words',
13
- # :default_description => 'one description for all views using this layout'
14
- # )
15
- #
16
- # # =>
17
- #
18
- # <title>Dialog im Web. | Infopark AG</title>
19
- # <meta name="description" content="SEO description of the current page" />
20
- # <meta content="default, key, words" name="keywords" />
21
- # <meta content="Rails Connector for Infopark CMS Fiona by Infopark AG (www.infopark.de); Version 6.7.1" name="generator" />
22
- # <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
23
- # <link href="http://test.host/2001/basisordner" rel="canonical" />
24
- def seo_header_tags(options = {})
25
- html = content_tag('title', [@obj && @obj.display_title, options[:company_name]].compact.join(' | '))
26
- html += tag('meta', :name => 'description', :content => @obj && @obj.seo_description || options[:default_description])
27
- html += tag('meta', :name => 'keywords', :content => seo_keywords(options))
28
- html += tag('meta', 'http-equiv' => "Content-Type", :content => "text/html; charset=utf-8")
29
- html += tag('link', :rel => 'canonical', :href => canonical_url) if @obj
30
- html
31
- end
32
-
33
- private
34
-
35
- def seo_keywords(options)
36
- (@obj && @obj.seo_keywords.to_s.strip).blank? ? options[:default_keywords] : @obj.seo_keywords.strip
37
- end
38
-
39
- def canonical_url
40
- cms_path_or_url_for_objs(@obj, :url, :protocol => request.ssl? ? 'https' : 'http')
41
- end
42
- end
43
-
44
- end
@@ -1,26 +0,0 @@
1
- module RailsConnector
2
-
3
- # A helper to access the preview time machine.
4
- # @api public
5
- module TimeMachineHelper
6
-
7
- # Renders a link to open the time machine.
8
- # @api public
9
- def time_machine_link(content)
10
- if Configuration.enabled?(:time_machine) && Configuration.editor_interface_enabled?
11
- (<<-EOF).html_safe
12
- #{link_to_function content, "window.open('#{time_machine_url :action => 'index'}', 'time_machine', 'height=350,location=no,menubar=no,status=no,toolbar=no,width=500')"}
13
- <script type="text/javascript">
14
- // <!--
15
- function sendRequest(url)
16
- {
17
- jQuery.getScript(url);
18
- }
19
- // -->
20
- </script>
21
- EOF
22
- end
23
- end
24
- end
25
-
26
- end
@@ -1,32 +0,0 @@
1
- module RailsConnector
2
-
3
- # This module contains helpers for Google Analytics and Infopark Tracking.
4
- module TrackingHelper
5
-
6
- # This helper renders the Google Analytics snippet using the domain code
7
- # for the current domain as configured via <tt>Configuration::GoogleAnalytics.domain_code</tt>.
8
- # The helper is automatically run when using the +rails_connector_after_content_tags+,
9
- # if the feature <tt>:google_analytics</tt> is enabled.
10
- def google_analytics
11
- if domain_code = Configuration::GoogleAnalytics.domain_code(request.host)
12
- raw %Q{
13
- <script type="text/javascript" src='#{ga_prefix}google-analytics.com/ga.js'></script>
14
- <script type="text/javascript">
15
- try {
16
- var pageTracker = _gat._getTracker("#{domain_code}");
17
- pageTracker._setAllowAnchor(true);
18
- pageTracker._addIgnoredOrganic("#{request.host}");
19
- pageTracker._trackPageview();
20
- } catch(err) {}
21
- </script>
22
- }
23
- end
24
- end
25
-
26
- private
27
-
28
- def ga_prefix
29
- request.ssl? ? 'https://ssl.' : 'http://www.'
30
- end
31
- end
32
- end
@@ -1,4 +0,0 @@
1
- # This helper includes {RailsConnector::DefaultRatingsHelper}
2
- module RatingsHelper
3
- include RailsConnector::DefaultRatingsHelper
4
- end
@@ -1,6 +0,0 @@
1
- # {UserHelper} is a wrapper around {RailsConnector::DefaultUserHelper}.
2
- # It can be replaced in your application in order to add or
3
- # modify helpers.
4
- module UserHelper
5
- include RailsConnector::DefaultUserHelper
6
- end
@@ -1,15 +0,0 @@
1
- class ConfirmationMailer < ActionMailer::Base
2
- # @return [void]
3
- def reset_password(recipient, confirmation_url)
4
- @confirmation_url = confirmation_url
5
- mail(:to => recipient, :subject =>
6
- I18n.t("rails_connector.views.user.forgot_password_subject"))
7
- end
8
-
9
- # @return [void]
10
- def register_confirmation(recipient, confirmation_url)
11
- @confirmation_url = confirmation_url
12
- mail(:to => recipient, :subject =>
13
- I18n.t("rails_connector.views.user.register_password_confirmation_mail_subject"))
14
- end
15
- end
@@ -1,2 +0,0 @@
1
- class CrmForm < Obj
2
- end
@@ -1,30 +0,0 @@
1
- require "active_record"
2
-
3
- module RailsConnector
4
-
5
- # Abstract base class for Comment.
6
- #
7
- # Objects do only have comments if the addon <tt>:comments</tt> is enabled
8
- # and the module {Commentable} is thereby included.
9
- #
10
- # A comment must have a name, email, subject, and body.
11
- class DefaultComment < ActiveRecord::Base
12
- self.abstract_class = true
13
-
14
- belongs_to :obj
15
-
16
- validates_presence_of :name, :message => I18n.t(:"rails_connector.models.comment.name_missing")
17
- validates_presence_of :body, :message => I18n.t(:"rails_connector.models.comment.body_missing")
18
- validates_presence_of :subject, :message => I18n.t(:"rails_connector.models.comment.subject_missing")
19
-
20
- EMAIL_FORMAT = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
21
-
22
- validates_format_of(
23
- :email,
24
- :with => EMAIL_FORMAT,
25
- :message => I18n.t(:"rails_connector.models.comment.email_format_invalid")
26
- )
27
-
28
- attr_accessible :name, :body, :subject, :email
29
- end
30
- end
@@ -1,22 +0,0 @@
1
- require "active_record"
2
-
3
- module RailsConnector
4
- #
5
- # This model is responsible for rating CMS objects.
6
- class DefaultRating < ActiveRecord::Base
7
- self.abstract_class = true
8
-
9
- MINIMUM = 1
10
- MAXIMUM = 5
11
-
12
- belongs_to :obj
13
-
14
- validates_uniqueness_of :score, :scope => :obj_id
15
- validates_numericality_of :score, :count
16
- validates_presence_of :obj_id, :score, :count
17
- validates_inclusion_of :score, :in => MINIMUM..MAXIMUM
18
-
19
- attr_accessible :obj_id, :score, :count
20
- end
21
-
22
- end
@@ -1,44 +0,0 @@
1
- <% if RailsConnector::Configuration.enabled?(:comments) and @obj.allow_comments? -%>
2
- <div id="comments_container">
3
- <span id="comments_header">
4
- <%=t :"rails_connector.views.cms.comments.title" %>
5
- </span>
6
- <% if @obj.allow_anonymous_comments? or (not @obj.allow_anonymous_comments? and logged_in?) -%>
7
- <div id="comment_form_container">
8
- <%= form_for(@comment, :as => :comment,
9
- :url => {:controller => "comments", :action => "create", :obj_id => @obj},
10
- :html => {:id => "comment_form"}) do |f| %>
11
- <div class="fieldset">
12
- <fieldset>
13
- <%= content_tag :legend, t(:"rails_connector.views.cms.comments.add_comment") %>
14
- <% unless logged_in? -%>
15
- <%= f.label :name, t(:"rails_connector.views.cms.comments.name"), :id => 'comment_form_name_label' %>
16
- <%= f.text_field :name %><br />
17
- <%= f.label :email, t(:"rails_connector.views.cms.comments.email"), :id => 'comment_form_email_label' %>
18
- <%= f.text_field :email %><br />
19
- <% end -%>
20
- <%= f.label :subject, t(:"rails_connector.views.cms.comments.subject"), :id => 'comment_form_subject_label' %>
21
- <%= f.text_field :subject, :size => 40 %><br />
22
- <%= f.label :body, t(:"rails_connector.views.cms.comments.body"), :id => 'comment_form_body_label' %>
23
- <%= f.text_area :body, :rows => 5, :cols => 50 %><br />
24
- <%= submit_tag(t(:"rails_connector.views.cms.comments.submit"), :class => 'submit', :name => 'submit') %>
25
- </fieldset>
26
- </div>
27
- <% end %>
28
- </div>
29
- <% else -%>
30
- <div class="login_required">
31
- <%=t :"rails_connector.views.cms.comments.login_required" %>
32
- </div>
33
- <% end -%>
34
- <div id="comment_list_container">
35
- <% if @obj.comments.empty? -%>
36
- <span id="no_comments">
37
- <%=t :"rails_connector.views.cms.comments.no_comments" %>
38
- </span>
39
- <% else -%>
40
- <%= render(:partial => 'comments/comment', :collection => @obj.comments, :as => :comment) %>
41
- <% end -%>
42
- </div>
43
- </div>
44
- <% end -%>
@@ -1,31 +0,0 @@
1
- <% if RailsConnector::Configuration.enabled?(:ratings) and @obj.allow_rating? %>
2
- <% if @obj.allow_anonymous_rating? || logged_in? %>
3
- <div id="starRating" data-default_description="<%= t "rails_connector.views.cms.rating.rate_here" %>">
4
- <h4><%= t(:"rails_connector.views.cms.rating.title") %></h4>
5
- <ul class="star-rating">
6
- <li class="current-rating" style="width:<%= @obj.average_rating_in_percent %>%; margin:0; padding:0;"></li>
7
- <%= stars_for_rating(@obj) unless rated_by_current_user?(@obj) %>
8
- </ul>
9
- <div id="starRating_label">
10
- <% if rated_by_current_user?(@obj) %>
11
- <%= t(:"rails_connector.views.cms.rating.thanks") %>
12
- <% else %>
13
- <%= t(:"rails_connector.views.cms.rating.rate_here") %>
14
- <% end %>
15
- </div>
16
- <% if admin? %>
17
- <div class="admin">
18
- <%= link_to(ratings_url(:action => :reset, :id => @obj.id),
19
- :confirm => t("rails_connector.views.cms.rating.are_you_sure")) do %>
20
- <%= t("rails_connector.views.cms.rating.reset") %>
21
- <%= image_tag("admin/minus.gif") %>
22
- <% end %>
23
- </div>
24
- <% end %>
25
- </div>
26
- <% else %>
27
- <div class="rating_login_required">
28
- <%=t :"rails_connector.views.cms.rating.login_required" %>
29
- </div>
30
- <% end %>
31
- <% end %>
@@ -1,28 +0,0 @@
1
- <div class="comment" id="comment_<%= comment.id %>">
2
- <% if admin? %>
3
- <div class="admin">
4
- <%= link_to(comment_path(:action => :delete, :id => comment),
5
- :confirm => t("rails_connector.views.cms.comments.are_you_sure")) do %>
6
- <%= image_tag("admin/minus.gif") %>
7
- <% end %>
8
- </div>
9
- <% end %>
10
-
11
- <div class="info">
12
- <span class="name">
13
- <%= comment.name %>
14
- </span>
15
- &nbsp;
16
- <%=t :"rails_connector.views.cms.comments.wrote_on" %>
17
- &nbsp;
18
- <span class="created_at">
19
- <%=l comment.created_at %>
20
- </span>
21
- </div>
22
- <span class="subject">
23
- <%= comment.subject %>
24
- </span>
25
- <div class="body">
26
- <%= simple_format(strip_tags(comment.body)) %>
27
- </div>
28
- </div>
@@ -1,5 +0,0 @@
1
- <%= t('rails_connector.views.user.register_heading') %>
2
-
3
- <%= t('rails_connector.views.user.confirm_request', :url => @confirmation_url) %>
4
-
5
- <%= t('rails_connector.views.user.no_request') %>
@@ -1,5 +0,0 @@
1
- <%= t('rails_connector.views.user.forgot_password_heading') %>
2
-
3
- <%= t('rails_connector.views.user.confirm_request', :url => @confirmation_url) %>
4
-
5
- <%= t('rails_connector.views.user.no_request') %>
@@ -1,11 +0,0 @@
1
- <% if flash[:error] %>
2
- <div class="error crm_form">
3
- <p><%= flash[:error] %></p>
4
- <%= error_messages(@user, @activity) %>
5
- </div>
6
- <% end %>
7
- <% if flash[:notice] %>
8
- <div class="notice crm_form">
9
- <p><%= flash[:notice] %></p>
10
- </div>
11
- <% end %>
@@ -1,17 +0,0 @@
1
- <%= form_tag cms_path(@obj) do -%>
2
- <% unless logged_in? -%>
3
- <%= fields_for :user, @user do |registration| -%>
4
- <%= profile_fields_for(registration, editable_attributes_on_register) %>
5
- <% end -%>
6
- <% else -%>
7
- <p>
8
- <%= logged_in_as(current_user.login) %>
9
- — <%= link_to('Logout', user_path(:action => 'logout', :return_to => request.fullpath)) %>
10
- </p>
11
- <% end -%>
12
- <%= fields_for :activity do |f| -%>
13
- <%= title_field_for(f) %>
14
- <%= custom_fields_for(f) %>
15
- <% end -%>
16
- <%= submit_tag t('rails_connector.views.crm_form.submit') %>
17
- <% end -%>
@@ -1,3 +0,0 @@
1
- <%= t('rails_connector.views.crm_form.confirmation') %>
2
-
3
- <%= t('rails_connector.views.crm_form.reference_further_questions', :case_id => @activity.id) %>
@@ -1,5 +0,0 @@
1
- <%= render :partial => 'cms/index' %>
2
-
3
- <%= render :partial => 'flash_messages' %>
4
-
5
- <%= render :partial => 'form' %>
@@ -1 +0,0 @@
1
- <div><%= t(:'rails_connector.views.crm_form.must_be_logged_in') %></div>
@@ -1,12 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html>
3
- <head>
4
- <title></title>
5
- <%= yield :head %>
6
- </head>
7
-
8
- <body>
9
- <%= yield %>
10
- </body>
11
- </html>
12
-
@@ -1,88 +0,0 @@
1
- <% content_for :head do %>
2
- <%= stylesheet_link_tag :time_machine %>
3
- <%= javascript_include_tag :time_machine %>
4
- <%= javascript_tag "
5
- var guiWindow = opener.parent;
6
- var myCalendar;
7
- var mySlider;
8
- var today = new Date();
9
- today.setMilliseconds(0);
10
- today.setSeconds(0);
11
- today.setMinutes(0);
12
- today.setHours(0);" %>
13
- </head>
14
-
15
- <% end %>
16
-
17
- <div id='time-machine'>
18
- <div id='calendar'></div>
19
- <%= javascript_tag %Q@
20
- function updatePreview(cal) {
21
- var y = cal.date.getFullYear();
22
- var m = cal.date.getMonth() + 1;
23
- var d = cal.date.getDate();
24
- if (m < 10) {
25
- m = "0" + m;
26
- }
27
- if (d < 10) {
28
- d = "0" + d;
29
- }
30
- url = "#{time_machine_url(:action => 'set_preview_time')}?preview_time=" + y + m + d + "000000";
31
- guiWindow.nps_browser_frame.sendRequest(url);
32
- }
33
-
34
- function daysFromToday(date) {
35
- return Number((date.getTime() - today.getTime()) / 86400000).toFixed(0);
36
- }
37
-
38
- function dateChanged(cal) {
39
- updatePreview(cal);
40
- mySlider.setValue(daysFromToday(cal.date));
41
- };
42
-
43
- myCalendar = Calendar.setup({
44
- flat: "calendar",
45
- flatCallback: dateChanged,
46
- date: new Date(#{@preview_time.year}, #{@preview_time.month - 1}, #{@preview_time.day}),
47
- dateStatusFunc: function(date) {
48
- return (date.getTime() < today.getTime() || daysFromToday(date) > 60);
49
- }
50
- });@ %>
51
-
52
- <div id="slider">
53
- <div id="track">
54
- <div id="handle"></div>
55
- </div>
56
- <div id="display"></div>
57
- </div>
58
-
59
- <p>
60
- <%= javascript_tag %Q|
61
- function displayValue(v)
62
- {
63
- if (v == 0) {
64
- return 'Heute';
65
- } else if (v == 1) {
66
- return 'Morgen';
67
- } else {
68
- return v + ' Tage in der Zukunft';
69
- }
70
- }
71
-
72
- mySlider = new Control.Slider('handle','track', {
73
- range: $R(0,60),
74
- values: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
75
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
76
- 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60],
77
- onSlide: function(v) {
78
- $('display').innerHTML = displayValue(v);
79
- },
80
- onChange: function(v) {
81
- $('display').innerHTML = displayValue(v);
82
- myCalendar.setDate(new Date(today.getTime() + v * 86400000));
83
- updatePreview(myCalendar);
84
- }
85
- });
86
- mySlider.setValue(daysFromToday(myCalendar.date));| %>
87
- </p>
88
- </div>