infopark_rails_connector 6.8.0.beta.200.621.4c8e1b0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +59 -0
- data/app/assets/images/admin/minus.gif +0 -0
- data/app/assets/images/bg80.png +0 -0
- data/app/assets/images/edit.png +0 -0
- data/app/assets/images/icons/mm_generic.png +0 -0
- data/app/assets/images/icons/mm_menu.png +0 -0
- data/app/assets/images/ratings/star.gif +0 -0
- data/app/assets/images/time_machine/calendar-menuarrow.gif +0 -0
- data/app/assets/images/time_machine/calendar_bg.png +0 -0
- data/app/assets/images/time_machine/icon.png +0 -0
- data/app/assets/images/time_machine/slider_bg.png +0 -0
- data/app/assets/images/time_machine/slider_handle.png +0 -0
- data/app/assets/images/time_machine/timemachine_bg.png +0 -0
- data/app/assets/javascripts/comments.js +29 -0
- data/app/assets/javascripts/editmarker.js +240 -0
- data/app/assets/javascripts/infopark_rails_connector.js.erb +3 -0
- data/app/assets/javascripts/initializer.js +9 -0
- data/app/assets/javascripts/ratings.js +26 -0
- data/app/assets/javascripts/time_machine/calendar-setup.js +200 -0
- data/app/assets/javascripts/time_machine/calendar.js +1806 -0
- data/app/assets/javascripts/time_machine/lang/calendar-de.js +127 -0
- data/app/assets/javascripts/time_machine/lang/calendar-en.js +127 -0
- data/app/assets/javascripts/time_machine/lang/calendar-es.js +129 -0
- data/app/assets/javascripts/time_machine/lang/calendar-fr.js +125 -0
- data/app/assets/javascripts/time_machine/lang/calendar-it.js +124 -0
- data/app/assets/javascripts/time_machine/slider.js +278 -0
- data/app/assets/javascripts/time_machine.js +8 -0
- data/app/assets/stylesheets/editmarker.css +70 -0
- data/app/assets/stylesheets/infopark_rails_connector.css.erb +4 -0
- data/app/assets/stylesheets/ratings.css +97 -0
- data/app/assets/stylesheets/time_machine/time_machine.css +292 -0
- data/app/assets/stylesheets/time_machine.css +6 -0
- data/app/controllers/cms_controller.rb +6 -0
- data/app/controllers/comments_controller.rb +6 -0
- data/app/controllers/crm_form_controller.rb +2 -0
- data/app/controllers/pdf_controller.rb +6 -0
- data/app/controllers/rails_connector/default_cms_controller.rb +40 -0
- data/app/controllers/rails_connector/default_comments_controller.rb +71 -0
- data/app/controllers/rails_connector/default_crm_form_controller.rb +167 -0
- data/app/controllers/rails_connector/default_pdf_controller.rb +136 -0
- data/app/controllers/rails_connector/default_ratings_controller.rb +84 -0
- data/app/controllers/rails_connector/default_rss_controller.rb +29 -0
- data/app/controllers/rails_connector/default_search_controller.rb +60 -0
- data/app/controllers/rails_connector/default_user_controller.rb +267 -0
- data/app/controllers/rails_connector/pdf_external_controller.rb +54 -0
- data/app/controllers/rails_connector/time_machine_controller.rb +48 -0
- data/app/controllers/ratings_controller.rb +6 -0
- data/app/controllers/rss_controller.rb +6 -0
- data/app/controllers/search_controller.rb +2 -0
- data/app/controllers/seo_sitemap_controller.rb +12 -0
- data/app/controllers/user_controller.rb +2 -0
- data/app/helpers/cms_helper.rb +6 -0
- data/app/helpers/cms_routing_helper.rb +6 -0
- data/app/helpers/crm_form_helper.rb +3 -0
- data/app/helpers/rails_connector/cms_asset_helper.rb +51 -0
- data/app/helpers/rails_connector/default_cms_helper.rb +27 -0
- data/app/helpers/rails_connector/default_cms_routing_helper.rb +93 -0
- data/app/helpers/rails_connector/default_crm_form_helper.rb +58 -0
- data/app/helpers/rails_connector/default_ratings_helper.rb +38 -0
- data/app/helpers/rails_connector/default_user_helper.rb +90 -0
- data/app/helpers/rails_connector/display_helper.rb +117 -0
- data/app/helpers/rails_connector/error_messages_helper.rb +23 -0
- data/app/helpers/rails_connector/layout_helper.rb +30 -0
- data/app/helpers/rails_connector/link_helper.rb +88 -0
- data/app/helpers/rails_connector/mandatory_label_helper.rb +10 -0
- data/app/helpers/rails_connector/marker_helper.rb +363 -0
- data/app/helpers/rails_connector/menu_helper.rb +72 -0
- data/app/helpers/rails_connector/micronav_helper.rb +107 -0
- data/app/helpers/rails_connector/seo_helper.rb +44 -0
- data/app/helpers/rails_connector/table_of_contents_helper.rb +20 -0
- data/app/helpers/rails_connector/time_machine_helper.rb +24 -0
- data/app/helpers/rails_connector/tracking_helper.rb +32 -0
- data/app/helpers/ratings_helper.rb +4 -0
- data/app/helpers/user_helper.rb +3 -0
- data/app/mailers/confirmation_mailer.rb +13 -0
- data/app/models/crm_form.rb +2 -0
- data/app/models/named_link.rb +2 -0
- data/app/models/obj.rb +9 -0
- data/app/models/rails_connector/default_comment.rb +28 -0
- data/app/models/rails_connector/default_rating.rb +20 -0
- data/app/models/rails_connector/link_list.rb +30 -0
- data/app/views/cms/_comments.html.erb +44 -0
- data/app/views/cms/_index.html.erb +7 -0
- data/app/views/cms/_rating.html.erb +31 -0
- data/app/views/cms/index.html.erb +3 -0
- data/app/views/comments/_comment.html.erb +28 -0
- data/app/views/confirmation_mailer/register_confirmation.erb +5 -0
- data/app/views/confirmation_mailer/reset_password.erb +5 -0
- data/app/views/crm_form/_flash_messages.html.erb +11 -0
- data/app/views/crm_form/_form.html.erb +17 -0
- data/app/views/crm_form/confirmation.html.erb +3 -0
- data/app/views/crm_form/index.html.erb +5 -0
- data/app/views/crm_form/not_logged_in.html.erb +1 -0
- data/app/views/errors/403_forbidden.html.erb +3 -0
- data/app/views/errors/410_gone.html.erb +7 -0
- data/app/views/layouts/rails_connector/time_machine.html.erb +12 -0
- data/app/views/pdf/index.html.erb +7 -0
- data/app/views/pdf/index.xsl +1240 -0
- data/app/views/rails_connector/time_machine/index.html.erb +88 -0
- data/app/views/rss/_item.rss.builder +11 -0
- data/app/views/rss/index.rss.builder +11 -0
- data/app/views/search/_hit.html.erb +12 -0
- data/app/views/search/_hits.html.erb +11 -0
- data/app/views/search/_mini_panel.html.erb +4 -0
- data/app/views/search/_pagination.html.erb +5 -0
- data/app/views/search/_panel.html.erb +4 -0
- data/app/views/search/search.html.erb +12 -0
- data/app/views/seo_sitemap/show.xml.builder +16 -0
- data/app/views/user/_flash_messages.html.erb +11 -0
- data/app/views/user/edit.html.erb +6 -0
- data/app/views/user/edit_password.html.erb +11 -0
- data/app/views/user/forgot_password.html.erb +7 -0
- data/app/views/user/login.html.erb +15 -0
- data/app/views/user/new.html.erb +11 -0
- data/app/views/user/profile.html.erb +8 -0
- data/app/views/user/register_pending.html.erb +1 -0
- data/app/views/user/set_password.html.erb +14 -0
- data/config/cms_routes.rb +13 -0
- data/config/locales/de.rails_connector.controllers.yml +30 -0
- data/config/locales/de.rails_connector.errors.yml +11 -0
- data/config/locales/de.rails_connector.helpers.yml +9 -0
- data/config/locales/de.rails_connector.lib.yml +6 -0
- data/config/locales/de.rails_connector.models.yml +8 -0
- data/config/locales/de.rails_connector.views.yml +87 -0
- data/config/locales/en.rails_connector.controllers.yml +30 -0
- data/config/locales/en.rails_connector.errors.yml +10 -0
- data/config/locales/en.rails_connector.helpers.yml +9 -0
- data/config/locales/en.rails_connector.lib.yml +6 -0
- data/config/locales/en.rails_connector.models.yml +8 -0
- data/config/locales/en.rails_connector.views.yml +87 -0
- data/config/routes.rb +37 -0
- data/lib/generators/rails_connector/comments/comments_generator.rb +21 -0
- data/lib/generators/rails_connector/comments/templates/migration.rb +17 -0
- data/lib/generators/rails_connector/install/install_generator.rb +38 -0
- data/lib/generators/rails_connector/install/templates/initializers/rails_connector.rb +58 -0
- data/lib/generators/rails_connector/install/templates/local/configuration.rb +2 -0
- data/lib/generators/rails_connector/install/templates/obj_extensions.rb +25 -0
- data/lib/generators/rails_connector/ratings/ratings_generator.rb +21 -0
- data/lib/generators/rails_connector/ratings/templates/migration.rb +15 -0
- data/lib/infopark_rails_connector.rb +31 -0
- data/lib/obj_extensions.rb +6 -0
- data/lib/rails_connector/authenticable.rb +30 -0
- data/lib/rails_connector/cms_accessible.rb +114 -0
- data/lib/rails_connector/cms_dispatch_controller.rb +47 -0
- data/lib/rails_connector/cms_env.rb +55 -0
- data/lib/rails_connector/cms_test_request.rb +23 -0
- data/lib/rails_connector/commentable.rb +23 -0
- data/lib/rails_connector/configuration/google_analytics.rb +29 -0
- data/lib/rails_connector/configuration/pdf_generator.rb +15 -0
- data/lib/rails_connector/configuration/rss.rb +46 -0
- data/lib/rails_connector/configuration.rb +235 -0
- data/lib/rails_connector/core_extensions/time.rb +18 -0
- data/lib/rails_connector/core_extensions.rb +1 -0
- data/lib/rails_connector/crm.rb +282 -0
- data/lib/rails_connector/engine.rb +78 -0
- data/lib/rails_connector/fop.rb +18 -0
- data/lib/rails_connector/fop_on_rails/document/dom_tree.rb +42 -0
- data/lib/rails_connector/fop_on_rails/document/images.rb +34 -0
- data/lib/rails_connector/fop_on_rails/document/tables.rb +67 -0
- data/lib/rails_connector/fop_on_rails/document.rb +25 -0
- data/lib/rails_connector/fop_on_rails.rb +92 -0
- data/lib/rails_connector/googlebot_checker.rb +47 -0
- data/lib/rails_connector/html_string.rb +19 -0
- data/lib/rails_connector/infopark_base.rb +2 -0
- data/lib/rails_connector/link_resolvable.rb +9 -0
- data/lib/rails_connector/liquid_support/action_marker.rb +69 -0
- data/lib/rails_connector/liquid_support/field_value_drop.rb +22 -0
- data/lib/rails_connector/liquid_support/general_helper_tag.rb +44 -0
- data/lib/rails_connector/liquid_support/link_drop.rb +22 -0
- data/lib/rails_connector/liquid_support/liquid_template_handler.rb +162 -0
- data/lib/rails_connector/liquid_support/named_object_drop.rb +14 -0
- data/lib/rails_connector/liquid_support/obj_drop.rb +43 -0
- data/lib/rails_connector/liquid_support/obj_filters.rb +77 -0
- data/lib/rails_connector/liquid_support.rb +23 -0
- data/lib/rails_connector/markdown_string.rb +19 -0
- data/lib/rails_connector/rateable.rb +57 -0
- data/lib/rails_connector/seo.rb +52 -0
- data/lib/rails_connector/ses.rb +72 -0
- data/lib/rails_connector/string_tagging.rb +29 -0
- data/lib/rails_connector/syndicateable.rb +11 -0
- data/lib/search_request.rb +2 -0
- data/lib/tasks/check.rake +25 -0
- data/lib/tasks/cms_license_check.rake +17 -0
- metadata +489 -0
data/README
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
= Infopark Rails Connector
|
2
|
+
|
3
|
+
Infopark Rails Connector allows you to integrate a number of ready-to-run features into your Rails application.
|
4
|
+
|
5
|
+
== Configuration
|
6
|
+
Here is how all available addons would be enabled in the <tt>rails_connector.rb</tt> initializer file of your application:
|
7
|
+
|
8
|
+
RailsConnector::Configuration.enable(
|
9
|
+
:comments,
|
10
|
+
:google_analytics,
|
11
|
+
:infopark_tracking,
|
12
|
+
:omc,
|
13
|
+
:pdf_generator,
|
14
|
+
:ratings,
|
15
|
+
:rss,
|
16
|
+
:search,
|
17
|
+
:seo_sitemap,
|
18
|
+
:time_machine
|
19
|
+
)
|
20
|
+
|
21
|
+
== Layout Helpers
|
22
|
+
Some of those functions depend on html or javascript code being included in the application layout.
|
23
|
+
For example, Google Analytics does only track pageviews if their javascript snippet is included
|
24
|
+
at the bottom of the html body.
|
25
|
+
|
26
|
+
Rails Connector provides two helpers which manage that kind of layout code,
|
27
|
+
switching on or off parts depending on what features are enabled or not:
|
28
|
+
|
29
|
+
rails_connector_header_tags
|
30
|
+
|
31
|
+
This helper needs to be called inside the html head tag.
|
32
|
+
|
33
|
+
rails_connector_after_content_tags
|
34
|
+
|
35
|
+
That helper is to be put right before the closing body tag.
|
36
|
+
|
37
|
+
== Generators
|
38
|
+
Infopark Rails Connector comes with three generators to help you get up and running quickly:
|
39
|
+
|
40
|
+
<tt>rails generate rails_connector:install</tt>
|
41
|
+
|
42
|
+
Adds Time machine assets, a +rails_connector.rb+ initializer and rake tasks specific to the gem to your application.
|
43
|
+
|
44
|
+
<tt>rails generate rails_connector:comments</tt>
|
45
|
+
|
46
|
+
Specific to the +comments+ feature. Adds a comments migration to your application.
|
47
|
+
|
48
|
+
<tt>rails generate rails_connector:ratings</tt>
|
49
|
+
|
50
|
+
Specific to the +ratings+ feature. Adds a ratings migration to your application as well as an example stylesheet and background image.
|
51
|
+
|
52
|
+
== Infopark Tracking
|
53
|
+
|
54
|
+
If you enable the infopark_tracking, please refer to the OMC documentation for further details,
|
55
|
+
e.g. Apache logging options.
|
56
|
+
|
57
|
+
== Seo Sitemap
|
58
|
+
|
59
|
+
The default implementation for the seo sitemap will feature all files from your CMS in the generated <tt>sitemap.xml</tt>. For a large number of files, this can slow down your server. Please refer to <tt>RailsConnector::SEO::ClassMethods#find_all_for_sitemap</tt> for advise on optimization.
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,29 @@
|
|
1
|
+
var rails_connector = (function(rails_connector, $) {
|
2
|
+
rails_connector.comments = {
|
3
|
+
initialize: function() {
|
4
|
+
var form = $("#comment_form");
|
5
|
+
if (form.length > 0) {
|
6
|
+
form.find(".submit").click(function() {
|
7
|
+
$.post(form.attr("action"), form.serialize(), function(json) {
|
8
|
+
form.find("label").removeClass("error");
|
9
|
+
if (json.comment) {
|
10
|
+
$("#no_comments").hide();
|
11
|
+
$("#comment_list_container").show();
|
12
|
+
var comment = $(json.comment).hide();
|
13
|
+
$("#comment_list_container").append(comment);
|
14
|
+
comment.slideDown(750, "swing");
|
15
|
+
$("html, body").animate({scrollTop: comment.offset().top}, 1000);
|
16
|
+
form[0].reset();
|
17
|
+
} else {
|
18
|
+
$.each(json.errors, function() {
|
19
|
+
$("#comment_form_" + this + "_label").addClass("error");
|
20
|
+
});
|
21
|
+
}
|
22
|
+
}, "json");
|
23
|
+
return false;
|
24
|
+
});
|
25
|
+
}
|
26
|
+
}
|
27
|
+
};
|
28
|
+
return rails_connector;
|
29
|
+
}(rails_connector || {}, jQuery));
|
@@ -0,0 +1,240 @@
|
|
1
|
+
var inline_editing = (function() {
|
2
|
+
|
3
|
+
/********************************************************************************************/
|
4
|
+
/* Global vars */
|
5
|
+
var prevElement = false;
|
6
|
+
var actionMarkerVisible = true;
|
7
|
+
var actionMarkerArray;
|
8
|
+
var rememberBackgroundColor;
|
9
|
+
var rememberZoom;
|
10
|
+
var editMarkerDefinitions;
|
11
|
+
var parentWindow = parent;
|
12
|
+
|
13
|
+
/********************************************************************************************/
|
14
|
+
/* Global Functions */
|
15
|
+
|
16
|
+
var findInfoFromClassName = function(element, regexp) {
|
17
|
+
var info;
|
18
|
+
var matches = (jQuery(element).attr("class") || "").match(regexp);
|
19
|
+
if (matches && matches.length > 1) {
|
20
|
+
return matches[1];
|
21
|
+
}
|
22
|
+
};
|
23
|
+
|
24
|
+
/****************************************/
|
25
|
+
/* Hilfsfunktionen für die Hervorhebung */
|
26
|
+
|
27
|
+
var stashStyle = function(element)
|
28
|
+
{
|
29
|
+
var nps_style_stash = {};
|
30
|
+
jQuery.each(['backgroundColor', 'zoom', 'color'], function(i, property) {
|
31
|
+
nps_style_stash[property] = element.css(property);
|
32
|
+
});
|
33
|
+
element.data('nps_style_stash', nps_style_stash);
|
34
|
+
};
|
35
|
+
|
36
|
+
var highlight = function(element)
|
37
|
+
{
|
38
|
+
// setting the zoom works around incomplete redraws on ie6
|
39
|
+
element.css({
|
40
|
+
backgroundColor: '#ffffaa',
|
41
|
+
zoom: 1,
|
42
|
+
color: '#000000'
|
43
|
+
});
|
44
|
+
};
|
45
|
+
|
46
|
+
var unstashStyle = function(element)
|
47
|
+
{
|
48
|
+
if (element.data('nps_style_stash')) {
|
49
|
+
element.css(element.data('nps_style_stash'));
|
50
|
+
element.removeData('nps_style_stash');
|
51
|
+
}
|
52
|
+
};
|
53
|
+
|
54
|
+
/********************************************************************************************/
|
55
|
+
/* Marker Definitions */
|
56
|
+
|
57
|
+
/********************************************************************************************/
|
58
|
+
/* Marker Permission Checking */
|
59
|
+
|
60
|
+
var that = {
|
61
|
+
setParentWindow: function(new_parent) {
|
62
|
+
parentWindow = new_parent;
|
63
|
+
},
|
64
|
+
|
65
|
+
attachMarkerMenu: function(marker_menu_target){
|
66
|
+
var id = findInfoFromClassName(marker_menu_target, /nps_marker_menu_target_([0-9]+)/);
|
67
|
+
var marker_menu = jQuery("#nps_marker_menu_"+id);
|
68
|
+
if (marker_menu.length) {
|
69
|
+
var definition = that.findMarkerDefinitionForElement(marker_menu);
|
70
|
+
var target_pos = marker_menu_target.offset();
|
71
|
+
var parent_pos = marker_menu.offsetParent().offset();
|
72
|
+
|
73
|
+
marker_menu.css({
|
74
|
+
position: 'absolute',
|
75
|
+
left: target_pos.left + definition.offset_left - parent_pos.left,
|
76
|
+
top: target_pos.top + definition.offset_top - parent_pos.top
|
77
|
+
});
|
78
|
+
|
79
|
+
jQuery(marker_menu).unbind('mouseenter');
|
80
|
+
jQuery(marker_menu).mouseenter(function(){
|
81
|
+
stashStyle(marker_menu_target);
|
82
|
+
highlight(marker_menu_target);
|
83
|
+
});
|
84
|
+
jQuery(marker_menu).unbind('mouseleave');
|
85
|
+
jQuery(marker_menu).mouseleave(function(){
|
86
|
+
unstashStyle(marker_menu_target);
|
87
|
+
});
|
88
|
+
}
|
89
|
+
},
|
90
|
+
|
91
|
+
initMarkerMenus: function() {
|
92
|
+
var visible = false;
|
93
|
+
jQuery('.nps_marker_menu_button').click(function() {
|
94
|
+
if (visible) {
|
95
|
+
jQuery(this).next().slideUp(200);
|
96
|
+
visible = false;
|
97
|
+
} else {
|
98
|
+
jQuery(this).next().slideDown(200);
|
99
|
+
visible = true;
|
100
|
+
}
|
101
|
+
return false;
|
102
|
+
});
|
103
|
+
},
|
104
|
+
|
105
|
+
attachMarkerMenus: function() {
|
106
|
+
jQuery('.nps_marker_menu_target').each(function() {
|
107
|
+
that.attachMarkerMenu(jQuery(this));
|
108
|
+
});
|
109
|
+
},
|
110
|
+
|
111
|
+
initActionMarker: function() {
|
112
|
+
jQuery('.nps_action_marker').each(function(ignore, marker_element) {
|
113
|
+
if (!that.hasRequiredPermissionsForMarkerElement(marker_element)) {
|
114
|
+
jQuery(marker_element).hide();
|
115
|
+
}
|
116
|
+
});
|
117
|
+
},
|
118
|
+
|
119
|
+
bindEditMarkerEvents: function(marker, target){
|
120
|
+
marker.unbind();
|
121
|
+
marker.mouseenter(function() {
|
122
|
+
target.find("*").each(function() { stashStyle(jQuery(this)); });
|
123
|
+
target.find("*").each(function() { highlight(jQuery(this)); });
|
124
|
+
stashStyle(target);
|
125
|
+
highlight(target);
|
126
|
+
});
|
127
|
+
marker.mouseleave(function() {
|
128
|
+
target.find("*").each(function() { unstashStyle(jQuery(this)); });
|
129
|
+
unstashStyle(target);
|
130
|
+
});
|
131
|
+
marker.click(function() { return that.startEditing(this); });
|
132
|
+
},
|
133
|
+
|
134
|
+
initEditMarker: function() {
|
135
|
+
// add functions and behaviour to all edit marker elements
|
136
|
+
jQuery(".nps_edit_marker").each(function(i, marker) {
|
137
|
+
marker = jQuery(marker);
|
138
|
+
if (that.hasRequiredPermissionsForMarkerElement(marker)) {
|
139
|
+
var id = findInfoFromClassName(marker, /nps_marker_id_([0-9]+)/);
|
140
|
+
var target = jQuery("#nps_marker_id_" + id);
|
141
|
+
if (target.length) {
|
142
|
+
var pos = target.offset();
|
143
|
+
var parent_pos = marker.offsetParent().offset();
|
144
|
+
that.bindEditMarkerEvents(marker, target);
|
145
|
+
marker.css({
|
146
|
+
left: pos.left - parent_pos.left,
|
147
|
+
top: pos.top - parent_pos.top,
|
148
|
+
position: "absolute",
|
149
|
+
display: "inline"
|
150
|
+
});
|
151
|
+
} else {
|
152
|
+
marker.hide();
|
153
|
+
}
|
154
|
+
}
|
155
|
+
else {
|
156
|
+
marker.hide();
|
157
|
+
}
|
158
|
+
});
|
159
|
+
},
|
160
|
+
|
161
|
+
openEditDialog: function(obj_id, attribute, context_id, size, target) {
|
162
|
+
// pass control to Fiona GUI
|
163
|
+
parentWindow.openEditDialog(obj_id, attribute, context_id, size, target);
|
164
|
+
},
|
165
|
+
|
166
|
+
initMarker: function() {
|
167
|
+
that.initEditMarker();
|
168
|
+
that.initActionMarker();
|
169
|
+
that.initMarkerMenus();
|
170
|
+
that.attachMarkerMenus();
|
171
|
+
},
|
172
|
+
|
173
|
+
init: function() {
|
174
|
+
jQuery(document).ready(that.initMarker);
|
175
|
+
jQuery(window).load(that.initMarker);
|
176
|
+
jQuery(window).resize(that.initMarker);
|
177
|
+
},
|
178
|
+
|
179
|
+
storeMarkerDefinitions: function(definitions) {
|
180
|
+
editMarkerDefinitions = editMarkerDefinitions || {};
|
181
|
+
jQuery.extend(editMarkerDefinitions, definitions);
|
182
|
+
},
|
183
|
+
|
184
|
+
markerDefinition: function(id) {
|
185
|
+
return editMarkerDefinitions[id];
|
186
|
+
},
|
187
|
+
|
188
|
+
findMarkerDefinitionForElement: function(element) {
|
189
|
+
return that.markerDefinition(findInfoFromClassName(element, /nps_marker_id_([0-9]+)/));
|
190
|
+
},
|
191
|
+
|
192
|
+
currentUserHasGlobalPermission: function(perm) {
|
193
|
+
if (parentWindow.currentUserIsMemberOf) {
|
194
|
+
return parentWindow.currentUserHasGlobalPermission(perm);
|
195
|
+
}
|
196
|
+
else {
|
197
|
+
return true;
|
198
|
+
}
|
199
|
+
},
|
200
|
+
|
201
|
+
currentUserIsMemberOf: function(groups) {
|
202
|
+
if (parentWindow.currentUserIsMemberOf) {
|
203
|
+
return parentWindow.currentUserIsMemberOf(groups);
|
204
|
+
}
|
205
|
+
else {
|
206
|
+
return true;
|
207
|
+
}
|
208
|
+
},
|
209
|
+
|
210
|
+
hasRequiredPermissionsForMarkerElement: function(element) {
|
211
|
+
if (that.currentUserHasGlobalPermission("permissionGlobalRoot")) { return true; }
|
212
|
+
|
213
|
+
var definition = that.findMarkerDefinitionForElement(element);
|
214
|
+
var member_in_group = 0;
|
215
|
+
jQuery.each(definition.memberships, function() {
|
216
|
+
if (that.currentUserIsMemberOf(this)) {
|
217
|
+
member_in_group += 1;
|
218
|
+
return true;
|
219
|
+
}
|
220
|
+
return false;
|
221
|
+
});
|
222
|
+
return member_in_group === definition.memberships.length;
|
223
|
+
},
|
224
|
+
|
225
|
+
startEditing: function(element) {
|
226
|
+
var definition = that.findMarkerDefinitionForElement(element);
|
227
|
+
|
228
|
+
// pass control to Fiona GUI
|
229
|
+
that.openEditDialog(
|
230
|
+
definition.obj_id, definition.attribute, definition.context_id,
|
231
|
+
definition.size, definition.target
|
232
|
+
);
|
233
|
+
return false;
|
234
|
+
}
|
235
|
+
|
236
|
+
};
|
237
|
+
|
238
|
+
return that;
|
239
|
+
|
240
|
+
}());
|
@@ -0,0 +1,9 @@
|
|
1
|
+
var rails_connector = (function(rails_connector, $) {
|
2
|
+
if (rails_connector.hasOwnProperty("comments")) {
|
3
|
+
$(document).ready(rails_connector.comments.initialize);
|
4
|
+
}
|
5
|
+
if (rails_connector.hasOwnProperty("ratings")) {
|
6
|
+
$(document).ready(rails_connector.ratings.initialize);
|
7
|
+
}
|
8
|
+
return rails_connector;
|
9
|
+
})(rails_connector || {}, jQuery);
|
@@ -0,0 +1,26 @@
|
|
1
|
+
var rails_connector = (function(rails_connector, $) {
|
2
|
+
rails_connector.ratings = {
|
3
|
+
initialize: function() {
|
4
|
+
var rating = $("#starRating");
|
5
|
+
if (rating.length > 0) {
|
6
|
+
var label = $("#starRating_label");
|
7
|
+
$.each(rating.find("ul.star-rating li a"), function(i, link_elem) {
|
8
|
+
var link = $(link_elem);
|
9
|
+
link.click(function() {
|
10
|
+
$.post(link.attr("href"), function(data) {
|
11
|
+
rating.replaceWith(data);
|
12
|
+
}, "html");
|
13
|
+
return false;
|
14
|
+
});
|
15
|
+
link.mouseover(function() {
|
16
|
+
label.text(link.attr("data-description"));
|
17
|
+
});
|
18
|
+
link.mouseout(function() {
|
19
|
+
label.text(rating.attr("data-default_description"));
|
20
|
+
});
|
21
|
+
});
|
22
|
+
}
|
23
|
+
}
|
24
|
+
};
|
25
|
+
return rails_connector;
|
26
|
+
}(rails_connector || {}, jQuery));
|
@@ -0,0 +1,200 @@
|
|
1
|
+
/* Copyright Mihai Bazon, 2002, 2003 | http://dynarch.com/mishoo/
|
2
|
+
* ---------------------------------------------------------------------------
|
3
|
+
*
|
4
|
+
* The DHTML Calendar
|
5
|
+
*
|
6
|
+
* Details and latest version at:
|
7
|
+
* http://dynarch.com/mishoo/calendar.epl
|
8
|
+
*
|
9
|
+
* This script is distributed under the GNU Lesser General Public License.
|
10
|
+
* Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
|
11
|
+
*
|
12
|
+
* This file defines helper functions for setting up the calendar. They are
|
13
|
+
* intended to help non-programmers get a working calendar on their site
|
14
|
+
* quickly. This script should not be seen as part of the calendar. It just
|
15
|
+
* shows you what one can do with the calendar, while in the same time
|
16
|
+
* providing a quick and simple method for setting it up. If you need
|
17
|
+
* exhaustive customization of the calendar creation process feel free to
|
18
|
+
* modify this code to suit your needs (this is recommended and much better
|
19
|
+
* than modifying calendar.js itself).
|
20
|
+
*/
|
21
|
+
|
22
|
+
// $Id: calendar-setup.js,v 1.25 2005/03/07 09:51:33 mishoo Exp $
|
23
|
+
|
24
|
+
/**
|
25
|
+
* This function "patches" an input field (or other element) to use a calendar
|
26
|
+
* widget for date selection.
|
27
|
+
*
|
28
|
+
* The "params" is a single object that can have the following properties:
|
29
|
+
*
|
30
|
+
* prop. name | description
|
31
|
+
* -------------------------------------------------------------------------------------------------
|
32
|
+
* inputField | the ID of an input field to store the date
|
33
|
+
* displayArea | the ID of a DIV or other element to show the date
|
34
|
+
* button | ID of a button or other element that will trigger the calendar
|
35
|
+
* eventName | event that will trigger the calendar, without the "on" prefix (default: "click")
|
36
|
+
* ifFormat | date format that will be stored in the input field
|
37
|
+
* daFormat | the date format that will be used to display the date in displayArea
|
38
|
+
* singleClick | (true/false) wether the calendar is in single click mode or not (default: true)
|
39
|
+
* firstDay | numeric: 0 to 6. "0" means display Sunday first, "1" means display Monday first, etc.
|
40
|
+
* align | alignment (default: "Br"); if you don't know what's this see the calendar documentation
|
41
|
+
* range | array with 2 elements. Default: [1900, 2999] -- the range of years available
|
42
|
+
* weekNumbers | (true/false) if it's true (default) the calendar will display week numbers
|
43
|
+
* flat | null or element ID; if not null the calendar will be a flat calendar having the parent with the given ID
|
44
|
+
* flatCallback | function that receives a JS Date object and returns an URL to point the browser to (for flat calendar)
|
45
|
+
* disableFunc | function that receives a JS Date object and should return true if that date has to be disabled in the calendar
|
46
|
+
* onSelect | function that gets called when a date is selected. You don't _have_ to supply this (the default is generally okay)
|
47
|
+
* onClose | function that gets called when the calendar is closed. [default]
|
48
|
+
* onUpdate | function that gets called after the date is updated in the input field. Receives a reference to the calendar.
|
49
|
+
* date | the date that the calendar will be initially displayed to
|
50
|
+
* showsTime | default: false; if true the calendar will include a time selector
|
51
|
+
* timeFormat | the time format; can be "12" or "24", default is "12"
|
52
|
+
* electric | if true (default) then given fields/date areas are updated for each move; otherwise they're updated only on close
|
53
|
+
* step | configures the step of the years in drop-down boxes; default: 2
|
54
|
+
* position | configures the calendar absolute position; default: null
|
55
|
+
* cache | if "true" (but default: "false") it will reuse the same calendar object, where possible
|
56
|
+
* showOthers | if "true" (but default: "false") it will show days from other months too
|
57
|
+
*
|
58
|
+
* None of them is required, they all have default values. However, if you
|
59
|
+
* pass none of "inputField", "displayArea" or "button" you'll get a warning
|
60
|
+
* saying "nothing to setup".
|
61
|
+
*/
|
62
|
+
Calendar.setup = function (params) {
|
63
|
+
function param_default(pname, def) { if (typeof params[pname] == "undefined") { params[pname] = def; } };
|
64
|
+
|
65
|
+
param_default("inputField", null);
|
66
|
+
param_default("displayArea", null);
|
67
|
+
param_default("button", null);
|
68
|
+
param_default("eventName", "click");
|
69
|
+
param_default("ifFormat", "%Y/%m/%d");
|
70
|
+
param_default("daFormat", "%Y/%m/%d");
|
71
|
+
param_default("singleClick", true);
|
72
|
+
param_default("disableFunc", null);
|
73
|
+
param_default("dateStatusFunc", params["disableFunc"]); // takes precedence if both are defined
|
74
|
+
param_default("dateText", null);
|
75
|
+
param_default("firstDay", null);
|
76
|
+
param_default("align", "Br");
|
77
|
+
param_default("range", [1900, 2999]);
|
78
|
+
param_default("weekNumbers", true);
|
79
|
+
param_default("flat", null);
|
80
|
+
param_default("flatCallback", null);
|
81
|
+
param_default("onSelect", null);
|
82
|
+
param_default("onClose", null);
|
83
|
+
param_default("onUpdate", null);
|
84
|
+
param_default("date", null);
|
85
|
+
param_default("showsTime", false);
|
86
|
+
param_default("timeFormat", "24");
|
87
|
+
param_default("electric", true);
|
88
|
+
param_default("step", 2);
|
89
|
+
param_default("position", null);
|
90
|
+
param_default("cache", false);
|
91
|
+
param_default("showOthers", false);
|
92
|
+
param_default("multiple", null);
|
93
|
+
|
94
|
+
var tmp = ["inputField", "displayArea", "button"];
|
95
|
+
for (var i in tmp) {
|
96
|
+
if (typeof params[tmp[i]] == "string") {
|
97
|
+
params[tmp[i]] = document.getElementById(params[tmp[i]]);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
if (!(params.flat || params.multiple || params.inputField || params.displayArea || params.button)) {
|
101
|
+
alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code");
|
102
|
+
return false;
|
103
|
+
}
|
104
|
+
|
105
|
+
function onSelect(cal) {
|
106
|
+
var p = cal.params;
|
107
|
+
var update = (cal.dateClicked || p.electric);
|
108
|
+
if (update && p.inputField) {
|
109
|
+
p.inputField.value = cal.date.print(p.ifFormat);
|
110
|
+
if (typeof p.inputField.onchange == "function")
|
111
|
+
p.inputField.onchange();
|
112
|
+
}
|
113
|
+
if (update && p.displayArea)
|
114
|
+
p.displayArea.innerHTML = cal.date.print(p.daFormat);
|
115
|
+
if (update && typeof p.onUpdate == "function")
|
116
|
+
p.onUpdate(cal);
|
117
|
+
if (update && p.flat) {
|
118
|
+
if (typeof p.flatCallback == "function")
|
119
|
+
p.flatCallback(cal);
|
120
|
+
}
|
121
|
+
if (update && p.singleClick && cal.dateClicked)
|
122
|
+
cal.callCloseHandler();
|
123
|
+
};
|
124
|
+
|
125
|
+
if (params.flat != null) {
|
126
|
+
if (typeof params.flat == "string")
|
127
|
+
params.flat = document.getElementById(params.flat);
|
128
|
+
if (!params.flat) {
|
129
|
+
alert("Calendar.setup:\n Flat specified but can't find parent.");
|
130
|
+
return false;
|
131
|
+
}
|
132
|
+
var cal = new Calendar(params.firstDay, params.date, params.onSelect || onSelect);
|
133
|
+
cal.showsOtherMonths = params.showOthers;
|
134
|
+
cal.showsTime = params.showsTime;
|
135
|
+
cal.time24 = (params.timeFormat == "24");
|
136
|
+
cal.params = params;
|
137
|
+
cal.weekNumbers = params.weekNumbers;
|
138
|
+
cal.setRange(params.range[0], params.range[1]);
|
139
|
+
cal.setDateStatusHandler(params.dateStatusFunc);
|
140
|
+
cal.getDateText = params.dateText;
|
141
|
+
if (params.ifFormat) {
|
142
|
+
cal.setDateFormat(params.ifFormat);
|
143
|
+
}
|
144
|
+
if (params.inputField && typeof params.inputField.value == "string") {
|
145
|
+
cal.parseDate(params.inputField.value);
|
146
|
+
}
|
147
|
+
cal.create(params.flat);
|
148
|
+
cal.show();
|
149
|
+
return cal;
|
150
|
+
}
|
151
|
+
|
152
|
+
var triggerEl = params.button || params.displayArea || params.inputField;
|
153
|
+
triggerEl["on" + params.eventName] = function() {
|
154
|
+
var dateEl = params.inputField || params.displayArea;
|
155
|
+
var dateFmt = params.inputField ? params.ifFormat : params.daFormat;
|
156
|
+
var mustCreate = false;
|
157
|
+
var cal = window.calendar;
|
158
|
+
if (dateEl)
|
159
|
+
params.date = Date.parseDate(dateEl.value || dateEl.innerHTML, dateFmt);
|
160
|
+
if (!(cal && params.cache)) {
|
161
|
+
window.calendar = cal = new Calendar(params.firstDay,
|
162
|
+
params.date,
|
163
|
+
params.onSelect || onSelect,
|
164
|
+
params.onClose || function(cal) { cal.hide(); });
|
165
|
+
cal.showsTime = params.showsTime;
|
166
|
+
cal.time24 = (params.timeFormat == "24");
|
167
|
+
cal.weekNumbers = params.weekNumbers;
|
168
|
+
mustCreate = true;
|
169
|
+
} else {
|
170
|
+
if (params.date)
|
171
|
+
cal.setDate(params.date);
|
172
|
+
cal.hide();
|
173
|
+
}
|
174
|
+
if (params.multiple) {
|
175
|
+
cal.multiple = {};
|
176
|
+
for (var i = params.multiple.length; --i >= 0;) {
|
177
|
+
var d = params.multiple[i];
|
178
|
+
var ds = d.print("%Y%m%d");
|
179
|
+
cal.multiple[ds] = d;
|
180
|
+
}
|
181
|
+
}
|
182
|
+
cal.showsOtherMonths = params.showOthers;
|
183
|
+
cal.yearStep = params.step;
|
184
|
+
cal.setRange(params.range[0], params.range[1]);
|
185
|
+
cal.params = params;
|
186
|
+
cal.setDateStatusHandler(params.dateStatusFunc);
|
187
|
+
cal.getDateText = params.dateText;
|
188
|
+
cal.setDateFormat(dateFmt);
|
189
|
+
if (mustCreate)
|
190
|
+
cal.create();
|
191
|
+
cal.refresh();
|
192
|
+
if (!params.position)
|
193
|
+
cal.showAtElement(params.button || params.displayArea || params.inputField, params.align);
|
194
|
+
else
|
195
|
+
cal.showAt(params.position[0], params.position[1]);
|
196
|
+
return cal;
|
197
|
+
};
|
198
|
+
|
199
|
+
return cal;
|
200
|
+
};
|