parlement 0.14 → 0.17
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +41 -1
- data/MEMORY +66 -5
- data/README +10 -5
- data/Rakefile +15 -23
- data/app/controllers/account_controller.rb +48 -43
- data/app/controllers/{application.rb → application_controller.rb} +15 -12
- data/app/controllers/elt_controller.rb +77 -32
- data/app/controllers/subscriber_controller.rb +11 -10
- data/app/helpers/application_helper.rb +14 -1
- data/app/helpers/elt_helper.rb +9 -7
- data/app/models/elt.rb +25 -24
- data/app/models/mail.rb +44 -47
- data/app/models/person_notify.rb +2 -2
- data/app/models/user.rb +128 -2
- data/app/models/user_notify.rb +15 -15
- data/app/views/account/_login.rhtml +39 -39
- data/app/views/account/_show.rhtml +22 -30
- data/app/views/account/signup.rhtml +2 -2
- data/app/views/elt/_choice.rhtml +6 -6
- data/app/views/elt/_elt.rhtml +27 -32
- data/app/views/elt/choices.rhtml +16 -18
- data/app/views/elt/list/_byDate.rhtml +14 -14
- data/app/views/elt/list/_byVote.rhtml +15 -15
- data/app/views/elt/list/_children.rhtml +48 -40
- data/app/views/elt/list/_subscribers.rhtml +1 -1
- data/app/views/elt/new.rhtml +22 -21
- data/app/views/elt/rss.rxml +4 -11
- data/app/views/elt/show.rhtml +65 -61
- data/app/views/elt/vote_rss.rxml +4 -11
- data/app/views/layouts/top.rhtml +39 -50
- data/app/views/person/_listElts.rhtml +1 -1
- data/app/views/person/show.rhtml +1 -1
- data/{vendor/plugins/login_engine/app → app}/views/user_notify/change_password.rhtml +0 -0
- data/{vendor/plugins/login_engine/app → app}/views/user_notify/delete.rhtml +0 -0
- data/{vendor/plugins/login_engine/app → app}/views/user_notify/forgot_password.rhtml +0 -0
- data/{vendor/plugins/login_engine/app → app}/views/user_notify/pending_delete.rhtml +0 -0
- data/{vendor/plugins/login_engine/app → app}/views/user_notify/signup.rhtml +0 -0
- data/config/boot.rb +97 -32
- data/config/environment.rb +37 -35
- data/config/environments/development.rb +2 -3
- data/config/environments/production.rb +3 -0
- data/config/initializers/string_ruby_1.8.rb +10 -0
- data/config/routes.rb +17 -22
- data/db/schema.rb +102 -74
- data/lib/tasks/rspec.rake +167 -0
- data/public/404.html +25 -7
- data/public/500.html +26 -7
- data/public/dispatch.cgi +0 -0
- data/public/dispatch.fcgi +0 -0
- data/public/dispatch.rb +0 -0
- data/public/images/live_tree_branch_collapsed_icon.gif +0 -0
- data/public/images/live_tree_branch_expanded_icon.gif +0 -0
- data/public/images/live_tree_leaf_icon.gif +0 -0
- data/public/javascripts/application.js +258 -0
- data/public/javascripts/controls.js +544 -414
- data/public/javascripts/dragdrop.js +229 -198
- data/public/javascripts/effects.js +499 -459
- data/public/javascripts/prototype.js +2926 -1121
- data/public/javascripts/shadedborder.js +68 -50
- data/public/stylesheets/default.css +34 -34
- data/public/stylesheets/live_tree.css +0 -0
- data/public/stylesheets/scaffold.css +6 -6
- data/script/about +0 -0
- data/script/autospec +6 -0
- data/script/benchmarker +0 -0
- data/script/breakpointer +0 -0
- data/script/console +0 -0
- data/script/dbconsole +3 -0
- data/script/destroy +0 -0
- data/script/generate +0 -0
- data/script/plugin +0 -0
- data/script/profiler +0 -0
- data/script/runner +0 -0
- data/script/server +0 -0
- data/script/spec +10 -0
- data/script/spec_server +9 -0
- data/test/unit/attachment_test.rb +4 -4
- data/test/unit/choice_test.rb +1 -1
- data/test/unit/elt_test.rb +9 -9
- data/test/unit/mail_notify_test.rb +2 -2
- data/test/unit/mail_test.rb +18 -11
- data/test/unit/person_notify_test.rb +1 -1
- data/test/unit/person_test.rb +1 -1
- data/test/unit/subscriber_test.rb +1 -1
- data/test/unit/user_test.rb +81 -0
- data/test/unit/visit_test.rb +6 -6
- data/vendor/plugins/activerecord_foreign_key_extensions/init.rb +2 -0
- data/vendor/plugins/activerecord_foreign_key_extensions/lib/active_record_extensions.rb +182 -0
- data/vendor/plugins/activerecord_text_id_extensions/init.rb +2 -0
- data/vendor/plugins/activerecord_text_id_extensions/lib/active_record_extensions.rb +24 -0
- data/vendor/plugins/acts_as_nested_set/README +15 -0
- data/vendor/plugins/acts_as_nested_set/init.rb +1 -0
- data/vendor/plugins/acts_as_nested_set/lib/active_record/acts/nested_set.rb +210 -0
- data/vendor/plugins/acts_as_nested_set/test/nested_set_test.rb +269 -0
- data/vendor/plugins/acts_as_tree/README +26 -0
- data/vendor/plugins/acts_as_tree/Rakefile +22 -0
- data/vendor/plugins/acts_as_tree/init.rb +1 -0
- data/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb +96 -0
- data/vendor/plugins/{output_compression/CHANGELOG → acts_as_tree/test/abstract_unit.rb} +0 -0
- data/vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb +219 -0
- data/vendor/plugins/acts_as_tree/test/database.yml +0 -0
- data/vendor/plugins/acts_as_tree/test/fixtures/mixin.rb +0 -0
- data/vendor/plugins/acts_as_tree/test/fixtures/mixins.yml +0 -0
- data/vendor/plugins/acts_as_tree/test/schema.rb +0 -0
- data/vendor/plugins/classic_pagination/CHANGELOG +152 -0
- data/vendor/plugins/classic_pagination/README +18 -0
- data/vendor/plugins/{output_compression/rakefile → classic_pagination/Rakefile} +22 -22
- data/vendor/plugins/classic_pagination/init.rb +33 -0
- data/vendor/plugins/classic_pagination/install.rb +1 -0
- data/vendor/plugins/classic_pagination/lib/pagination.rb +405 -0
- data/vendor/plugins/classic_pagination/lib/pagination_helper.rb +135 -0
- data/vendor/plugins/classic_pagination/test/fixtures/companies.yml +24 -0
- data/vendor/plugins/classic_pagination/test/fixtures/company.rb +9 -0
- data/vendor/plugins/classic_pagination/test/fixtures/developer.rb +7 -0
- data/vendor/plugins/classic_pagination/test/fixtures/developers.yml +21 -0
- data/vendor/plugins/classic_pagination/test/fixtures/developers_projects.yml +13 -0
- data/vendor/plugins/classic_pagination/test/fixtures/project.rb +3 -0
- data/vendor/plugins/classic_pagination/test/fixtures/projects.yml +7 -0
- data/vendor/plugins/classic_pagination/test/fixtures/replies.yml +13 -0
- data/vendor/plugins/classic_pagination/test/fixtures/reply.rb +5 -0
- data/vendor/plugins/classic_pagination/test/fixtures/schema.sql +42 -0
- data/vendor/plugins/classic_pagination/test/fixtures/topic.rb +3 -0
- data/vendor/plugins/classic_pagination/test/fixtures/topics.yml +22 -0
- data/vendor/plugins/classic_pagination/test/helper.rb +117 -0
- data/vendor/plugins/classic_pagination/test/pagination_helper_test.rb +38 -0
- data/vendor/plugins/classic_pagination/test/pagination_test.rb +177 -0
- data/vendor/plugins/file_column/lib/file_column.rb +1 -1
- data/vendor/plugins/file_column/test/file_column_test.rb +0 -0
- metadata +151 -197
- data/app/helpers/live_tree.rb +0 -238
- data/app/views/elt/_form.rhtml +0 -31
- data/app/views/elt/show_tree.rhtml +0 -8
- data/config/environments/user_environment.rb +0 -1
- data/db/ROOT/Titemagli.txt +0 -3
- data/db/ROOT/titemagli.txt +0 -9
- data/public/javascripts/behaviour.js +0 -254
- data/public/javascripts/ie7-load.htc +0 -1
- data/public/javascripts/ie7.js +0 -6
- data/public/javascripts/live_tree.js +0 -749
- data/public/javascripts/mybehaviour.js +0 -225
- data/public/javascripts/scriptaculous.js +0 -47
- data/public/javascripts/slider.js +0 -283
- data/public/stylesheets/blue.css +0 -471
- data/vendor/plugins/engines/CHANGELOG +0 -241
- data/vendor/plugins/engines/MIT-LICENSE +0 -21
- data/vendor/plugins/engines/README +0 -64
- data/vendor/plugins/engines/Rakefile +0 -32
- data/vendor/plugins/engines/UPGRADING +0 -93
- data/vendor/plugins/engines/about.yml +0 -7
- data/vendor/plugins/engines/generators/plugin_migration/USAGE +0 -45
- data/vendor/plugins/engines/generators/plugin_migration/plugin_migration_generator.rb +0 -79
- data/vendor/plugins/engines/generators/plugin_migration/templates/plugin_migration.erb +0 -13
- data/vendor/plugins/engines/init.rb +0 -40
- data/vendor/plugins/engines/install.rb +0 -32
- data/vendor/plugins/engines/lib/engines.rb +0 -323
- data/vendor/plugins/engines/lib/engines/deprecated_config_support.rb +0 -135
- data/vendor/plugins/engines/lib/engines/plugin.rb +0 -214
- data/vendor/plugins/engines/lib/engines/plugin_list.rb +0 -31
- data/vendor/plugins/engines/lib/engines/plugin_migrator.rb +0 -60
- data/vendor/plugins/engines/lib/engines/rails_extensions.rb +0 -6
- data/vendor/plugins/engines/lib/engines/rails_extensions/active_record.rb +0 -19
- data/vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb +0 -143
- data/vendor/plugins/engines/lib/engines/rails_extensions/migrations.rb +0 -155
- data/vendor/plugins/engines/lib/engines/rails_extensions/public_asset_helpers.rb +0 -116
- data/vendor/plugins/engines/lib/engines/rails_extensions/rails.rb +0 -20
- data/vendor/plugins/engines/lib/engines/rails_extensions/rails_initializer.rb +0 -86
- data/vendor/plugins/engines/lib/engines/rails_extensions/routing.rb +0 -77
- data/vendor/plugins/engines/lib/engines/rails_extensions/templates.rb +0 -140
- data/vendor/plugins/engines/lib/engines/testing.rb +0 -87
- data/vendor/plugins/engines/tasks/engines.rake +0 -149
- data/vendor/plugins/login_engine/CHANGELOG +0 -22
- data/vendor/plugins/login_engine/README +0 -344
- data/vendor/plugins/login_engine/app/controllers/user_controller.rb +0 -262
- data/vendor/plugins/login_engine/app/helpers/user_helper.rb +0 -88
- data/vendor/plugins/login_engine/app/models/user.rb +0 -7
- data/vendor/plugins/login_engine/app/models/user_notify.rb +0 -75
- data/vendor/plugins/login_engine/app/views/user/_edit.rhtml +0 -11
- data/vendor/plugins/login_engine/app/views/user/_password.rhtml +0 -9
- data/vendor/plugins/login_engine/app/views/user/change_password.rhtml +0 -17
- data/vendor/plugins/login_engine/app/views/user/edit.rhtml +0 -23
- data/vendor/plugins/login_engine/app/views/user/forgot_password.rhtml +0 -18
- data/vendor/plugins/login_engine/app/views/user/home.rhtml +0 -7
- data/vendor/plugins/login_engine/app/views/user/login.rhtml +0 -17
- data/vendor/plugins/login_engine/app/views/user/logout.rhtml +0 -8
- data/vendor/plugins/login_engine/app/views/user/signup.rhtml +0 -17
- data/vendor/plugins/login_engine/db/migrate/001_initial_schema.rb +0 -25
- data/vendor/plugins/login_engine/init_engine.rb +0 -11
- data/vendor/plugins/login_engine/install.rb +0 -4
- data/vendor/plugins/login_engine/lib/login_engine.rb +0 -62
- data/vendor/plugins/login_engine/lib/login_engine/authenticated_system.rb +0 -113
- data/vendor/plugins/login_engine/lib/login_engine/authenticated_user.rb +0 -155
- data/vendor/plugins/login_engine/public/stylesheets/login_engine.css +0 -81
- data/vendor/plugins/login_engine/test/fixtures/users.yml +0 -41
- data/vendor/plugins/login_engine/test/functional/user_controller_test.rb +0 -536
- data/vendor/plugins/login_engine/test/mocks/mail.rb +0 -14
- data/vendor/plugins/login_engine/test/mocks/time.rb +0 -19
- data/vendor/plugins/login_engine/test/test_helper.rb +0 -11
- data/vendor/plugins/login_engine/test/unit/user_test.rb +0 -114
- data/vendor/plugins/output_compression/MIT-LICENSE +0 -20
- data/vendor/plugins/output_compression/README +0 -4
- data/vendor/plugins/output_compression/init.rb +0 -1
- data/vendor/plugins/output_compression/lib/output_compression.rb +0 -84
- data/vendor/plugins/output_compression/test/output_test.rb +0 -11
- data/vendor/plugins/output_compression/test/test_controller.rb +0 -3
- data/vendor/plugins/output_compression/test/test_helper.rb +0 -14
data/app/helpers/live_tree.rb
DELETED
@@ -1,238 +0,0 @@
|
|
1
|
-
# Version:: 0.1
|
2
|
-
# Author:: Emanuel Borsboom (http://www.epiphyte.ca/)
|
3
|
-
# Copyright:: Copyright (c) 2005 Emanuel Borsboom
|
4
|
-
# License:: MIT (see LICENSE[link:files/LICENSE.html])
|
5
|
-
#
|
6
|
-
# See README[link:files/README.html] for general information about LiveTree.
|
7
|
-
|
8
|
-
module LiveTree
|
9
|
-
|
10
|
-
def self.included(base) #:nodoc:
|
11
|
-
super
|
12
|
-
base.extend(ClassMethods)
|
13
|
-
end
|
14
|
-
|
15
|
-
module ClassMethods
|
16
|
-
|
17
|
-
# Sets up this controller to serve data for a LiveTree.
|
18
|
-
#
|
19
|
-
# Arguments:
|
20
|
-
# * +name+ - the tree's name.
|
21
|
-
# * <tt>options</tt> - may contain:
|
22
|
-
# * <tt>:model</tt> - name of the model to use for retrieving data (symbol).
|
23
|
-
# * <tt>:model_class</tt> - name of the model's class, incase it can't be inferred (string)
|
24
|
-
# * <tt>:get_item_name_proc</tt> - proc object which, when called with an item, returns the name of the item to display.
|
25
|
-
#
|
26
|
-
# Either one of <tt>:model</tt> or <tt>:model_class</tt> must be specified.
|
27
|
-
#
|
28
|
-
# If <tt>:get_item_name_proc</tt> is not specified, the item's <tt>name</tt> attribute is used.
|
29
|
-
#
|
30
|
-
# This example sets up this controller to serve data for a tree with name +family_tree+, that uses the +person+ model to get data:
|
31
|
-
#
|
32
|
-
# class FamilyController < ApplicationController
|
33
|
-
# live_tree :family_tree, :model => :person
|
34
|
-
# end
|
35
|
-
#
|
36
|
-
# A data retrieval method is created that is named <em><tt><name></tt></em><tt>_live_tree_data</tt> (e.g. +family_tree_live_tree_data+)
|
37
|
-
def live_tree(name, options = {})
|
38
|
-
raise ":model or :model_class_name option is required" if options[:model] == nil && options[:model_class_name] == nil
|
39
|
-
if options[:model_class_name] != nil
|
40
|
-
model = options[:model_class_name]
|
41
|
-
else
|
42
|
-
model = Inflector.camelize(options[:model])
|
43
|
-
end
|
44
|
-
self.const_set("LIVE_TREE_OPTIONS_" + name.to_s.upcase, options);
|
45
|
-
code = "" +
|
46
|
-
"def #{name}_live_tree_options\n" +
|
47
|
-
" LIVE_TREE_OPTIONS_" + name.to_s.upcase + "\n" +
|
48
|
-
"end\n" +
|
49
|
-
"def #{name}_live_tree_data\n" +
|
50
|
-
" get_live_tree_data(" + model + ".find(live_tree_item_id), #{name}_live_tree_options)\n" +
|
51
|
-
"end\n"
|
52
|
-
#STDERR.write("\n\n#{code}\n\n")
|
53
|
-
class_eval code
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
module LiveTreeHelper
|
59
|
-
|
60
|
-
def _recurse_live_tree_data(item, depth, get_item_name_proc, special_child_id = nil, special_child_data = nil) #:nodoc:
|
61
|
-
result = "{id:" + item.id.to_s + ",name:'" + escape_javascript(get_item_name_proc.call(item).to_s) + "'"
|
62
|
-
if item.children.size == 0
|
63
|
-
result += ",children:[]"
|
64
|
-
elsif depth == nil || depth > 1
|
65
|
-
result += ",children:[\n"
|
66
|
-
first = true
|
67
|
-
for child in item.children
|
68
|
-
result += ",\n" unless first
|
69
|
-
first = false
|
70
|
-
if child.id == special_child_id
|
71
|
-
result += special_child_data
|
72
|
-
else
|
73
|
-
result += _recurse_live_tree_data(child, depth == nil ? nil : depth - 1, get_item_name_proc, special_child_id, special_child_data)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
result += "]"
|
77
|
-
end
|
78
|
-
result += "}"
|
79
|
-
result
|
80
|
-
end
|
81
|
-
|
82
|
-
def _get_live_tree_data(item, options, params) #:nodoc:
|
83
|
-
options ||= {}
|
84
|
-
get_item_name_proc = Proc.new { |x| x.name }
|
85
|
-
if options[:get_item_name_proc] != nil
|
86
|
-
get_item_name_proc = options[:get_item_name_proc]
|
87
|
-
end
|
88
|
-
depth = params[:depth] == nil ? nil : params[:depth].to_i
|
89
|
-
include_parents = params[:include_parents]
|
90
|
-
root_item_id = params[:root_item_id] == nil ? nil : params[:root_item_id].to_i
|
91
|
-
|
92
|
-
result = _recurse_live_tree_data(item, depth, get_item_name_proc)
|
93
|
-
if include_parents
|
94
|
-
while item.parent != nil && (root_item_id == nil || item.id != root_item_id)
|
95
|
-
result = _recurse_live_tree_data(item.parent, 2, get_item_name_proc, item.id, result)
|
96
|
-
item = item.parent
|
97
|
-
end
|
98
|
-
end
|
99
|
-
return result;
|
100
|
-
end
|
101
|
-
|
102
|
-
def LiveTreeHelper.live_tree_js_name(name) #:nodoc:
|
103
|
-
Inflector.camelize(name).sub(/^(.)/) { |s| $1.downcase }
|
104
|
-
end
|
105
|
-
|
106
|
-
# Embeds a LiveTree at the current location in the document.
|
107
|
-
#
|
108
|
-
# Arguments:
|
109
|
-
# * +name+ - name of the tree
|
110
|
-
# * +options+ - may contain any of the options documented in #construct_live_tree_function, as well as:
|
111
|
-
# * <tt>:js_variable_name</tt> - JavaScript variable name to assign the JavaScript LiveTree object to (optional).
|
112
|
-
#
|
113
|
-
# If <tt>:js_variable_name</tt> is not specified, the tree is assigned to a variable with the name of the tree converted to camelcase
|
114
|
-
# with a lowercase first letter (e.g. if the tree is named +family_tree+, it will be assigned to +familyTree+).
|
115
|
-
def live_tree(name, options = {})
|
116
|
-
options = options.dup;
|
117
|
-
if options[:js_variable_name] != nil
|
118
|
-
var_name = options[:js_variable_name]
|
119
|
-
else
|
120
|
-
var_name = LiveTreeHelper.live_tree_js_name(name)
|
121
|
-
end
|
122
|
-
options.delete :js_variable_name
|
123
|
-
js = "var " + var_name + "=" + construct_live_tree_function(name, options) + ";"
|
124
|
-
js += var_name + ".render();"
|
125
|
-
return javascript_tag(js);
|
126
|
-
end
|
127
|
-
|
128
|
-
# Returns JavaScript code that constructs a JavaScript LiveTree object.
|
129
|
-
#
|
130
|
-
# Arguments:
|
131
|
-
#
|
132
|
-
# * +name+ - name of the tree
|
133
|
-
#
|
134
|
-
# * +options+ - most of these options are passed to the JavaScript LiveTree object as-is, but their
|
135
|
-
# names are converted to camelcase-with-lowercase-first-letter (e.g. <tt>:on_click_item</tt> becomes <tt>onClickItem</tt>).
|
136
|
-
# See LiveTreeClient[link:files/LiveTreeClient.html] for details details about those options. In addition, the following may be
|
137
|
-
# specified:
|
138
|
-
#
|
139
|
-
# * <tt>:id</tt> - HTML ID to give the tree's top HTML element (default is the tree's name).
|
140
|
-
# * <tt>:data_action</tt> - Action used by the tree to read data (default is "#{name}_live_tree_data").
|
141
|
-
# * <tt>:data_controller</tt> - Controller used by the tree to read data (default is the current controller).
|
142
|
-
# * <tt>:initial_data_root</tt> - Root item to construct initial tree data (optional, but you almost certainly want to include this).
|
143
|
-
# * <tt>:initial_data_whole_tree</tt> - Specifies whether the entire tree should be sent in the initial data, in which case the client will never have to contact the server for more data (default +false+, only used if <tt>:initial_data_root</tt> is specified).
|
144
|
-
# * <tt>:initial_data_options</tt> - Specifies options for constructing the initial data. See #construct_live_tree_data for details. If you used LiveTree::ClassMethods.live_tree to setup your controller, you don't need to specify this (the same values passed to live_tree are used). (default <tt>{}</tt>, only used if <tt>:initial_data_root</tt>).
|
145
|
-
def construct_live_tree_function(name, options = {})
|
146
|
-
options = options.dup;
|
147
|
-
if options[:id] != nil
|
148
|
-
tree_id = options[:id]
|
149
|
-
else
|
150
|
-
tree_id = name
|
151
|
-
end
|
152
|
-
for k in [:on_click_item, :on_expand_item, :on_collapse_item, :on_load_item]
|
153
|
-
if options[k] != nil
|
154
|
-
options[k] = "function(item){" + options[k] + "}"
|
155
|
-
end
|
156
|
-
end
|
157
|
-
if options[:data_url] == nil
|
158
|
-
if options[:data_action] == nil
|
159
|
-
act = name.to_s + "_live_tree_data"
|
160
|
-
else
|
161
|
-
act = options[:data_action]
|
162
|
-
end
|
163
|
-
if options[:data_controller] == nil
|
164
|
-
options[:data_url] = { :action => act }
|
165
|
-
else
|
166
|
-
options[:data_url] = { :controller => options[:data_controller], :action => act }
|
167
|
-
end
|
168
|
-
end
|
169
|
-
options[:data_url] = '"' + escape_javascript(url_for(options[:data_url])) + '"'
|
170
|
-
for k in [:css_class, :css_style]
|
171
|
-
if options[k] != nil
|
172
|
-
options[k] = '"' + escape_javascript(options[k]) + '"'
|
173
|
-
end
|
174
|
-
end
|
175
|
-
if options[:initial_data_root] != nil
|
176
|
-
item = options[:initial_data_root]
|
177
|
-
if (options[:initial_data_whole_tree])
|
178
|
-
depth = nil
|
179
|
-
elsif (options[:expand_root_item] == nil || options[:expand_root_item] || options[:hide_root_item])
|
180
|
-
depth = 2
|
181
|
-
else
|
182
|
-
depth = 1
|
183
|
-
end
|
184
|
-
|
185
|
-
if options[:initial_data_options] == nil
|
186
|
-
data_options_method = controller.method("#{name}_live_tree_options")
|
187
|
-
if data_options_method
|
188
|
-
data_options = data_options_method.call
|
189
|
-
else
|
190
|
-
data_options = {}
|
191
|
-
end
|
192
|
-
else
|
193
|
-
data_options = options[:initial_data_options]
|
194
|
-
end
|
195
|
-
data_options = data_options.dup
|
196
|
-
data_options[:depth] = depth;
|
197
|
-
options[:initial_data] = construct_live_tree_data(item, data_options)
|
198
|
-
end
|
199
|
-
options.delete :id
|
200
|
-
options.delete :data_action
|
201
|
-
options.delete :data_controller
|
202
|
-
options.delete :initial_data_root
|
203
|
-
options.delete :initial_data_options
|
204
|
-
options.delete :initial_data_whole_tree
|
205
|
-
options_js = "{\n" + options.map {|k, v| LiveTreeHelper.live_tree_js_name(k) + ":#{v}"}.join(",\n") + "\n}"
|
206
|
-
"new LiveTree(\"" + tree_id.to_s + "\"," + options_js + ")"
|
207
|
-
end
|
208
|
-
|
209
|
-
# Returns data in format appropriate for use with the <tt>:initial_data</tt> parameter of #construct_live_tree_function .
|
210
|
-
#
|
211
|
-
# Arguments:
|
212
|
-
# * +item+ - Root item of the data.
|
213
|
-
# * +options+ - Same options as LiveTree.get_live_tree_data, as well as:
|
214
|
-
# * <tt>:depth</tt> - How many level deep to recurse (default is +nil+, which means to recurse to the ends of all branches).
|
215
|
-
def construct_live_tree_data(item, options = {})
|
216
|
-
return _get_live_tree_data(item, options, options)
|
217
|
-
end
|
218
|
-
|
219
|
-
end
|
220
|
-
|
221
|
-
# Renders data to return to a LiveTree data request.
|
222
|
-
#
|
223
|
-
# Arguments:
|
224
|
-
# * +item+ - Item to return.
|
225
|
-
# * +options+ - May contain the following:
|
226
|
-
# * <tt>:get_item_name_proc</tt> - Proc object which, when called with an item, returns the name of the item to display. (by default, the item's name is retrieved using the object's +name+ attribute).
|
227
|
-
def get_live_tree_data(item, options = {})
|
228
|
-
#data = LiveTreeHelper.get_live_tree_data(item, options, params)
|
229
|
-
#render :text => data
|
230
|
-
render :inline => '<%= _get_live_tree_data(item, options, params) %>', :locals => { :item => item, :options => options }
|
231
|
-
end
|
232
|
-
|
233
|
-
# Returns the value of the item ID from the request's params.
|
234
|
-
def live_tree_item_id
|
235
|
-
params[:item_id]
|
236
|
-
end
|
237
|
-
|
238
|
-
end
|
data/app/views/elt/_form.rhtml
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
<%= error_messages_for 'elt' %>
|
2
|
-
|
3
|
-
<div class="eltInfo">
|
4
|
-
<%= link_to_remote('<<',
|
5
|
-
:empty => 'new_link_'+@elt.parent.id.to_s,
|
6
|
-
:url => {
|
7
|
-
:controller => 'elt',
|
8
|
-
:action => 'new',
|
9
|
-
:id => @elt.parent.id },
|
10
|
-
:loading => visual_effect(:BlindUp,
|
11
|
-
'new_link_'+@elt.parent.id.to_s)) %>
|
12
|
-
</div>
|
13
|
-
|
14
|
-
<!--[form:elt]-->
|
15
|
-
<%= hidden_field 'elt', 'parent_id' %></p>
|
16
|
-
|
17
|
-
<p style="display:<%= 'none' if @person.name != nil %>">
|
18
|
-
<label for="person_name"><%= _('Proposed by') %></label>
|
19
|
-
<%= text_field 'person', 'name' %>
|
20
|
-
</p>
|
21
|
-
|
22
|
-
<!-- <p><label for="elt_subject">Title</label><br/> -->
|
23
|
-
<%= text_field 'elt', 'subject' %>
|
24
|
-
|
25
|
-
<label for="elt_position"><%= _('Position') %></label>
|
26
|
-
<%= text_field 'elt', 'position', 'size' => 1, 'align' => 'right' %>
|
27
|
-
|
28
|
-
<label for="elt_body"></label><br/>
|
29
|
-
<%= text_area 'elt', 'body' %>
|
30
|
-
<!--[eoform:elt]-->
|
31
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
|
data/db/ROOT/Titemagli.txt
DELETED
data/db/ROOT/titemagli.txt
DELETED
@@ -1,254 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Behaviour v1.1 by Ben Nolan, June 2005. Based largely on the work
|
3
|
-
of Simon Willison (see comments by Simon below).
|
4
|
-
|
5
|
-
Description:
|
6
|
-
|
7
|
-
Uses css selectors to apply javascript behaviours to enable
|
8
|
-
unobtrusive javascript in html documents.
|
9
|
-
|
10
|
-
Usage:
|
11
|
-
|
12
|
-
var myrules = {
|
13
|
-
'b.someclass' : function(element){
|
14
|
-
element.onclick = function(){
|
15
|
-
alert(this.innerHTML);
|
16
|
-
}
|
17
|
-
},
|
18
|
-
'#someid u' : function(element){
|
19
|
-
element.onmouseover = function(){
|
20
|
-
this.innerHTML = "BLAH!";
|
21
|
-
}
|
22
|
-
}
|
23
|
-
};
|
24
|
-
|
25
|
-
Behaviour.register(myrules);
|
26
|
-
|
27
|
-
// Call Behaviour.apply() to re-apply the rules (if you
|
28
|
-
// update the dom, etc).
|
29
|
-
|
30
|
-
License:
|
31
|
-
|
32
|
-
This file is entirely BSD licensed.
|
33
|
-
|
34
|
-
More information:
|
35
|
-
|
36
|
-
http:/ipcord.co.nz/behaviour/
|
37
|
-
|
38
|
-
*/
|
39
|
-
|
40
|
-
var Behaviour = {
|
41
|
-
list : new Array,
|
42
|
-
|
43
|
-
register : function(sheet){
|
44
|
-
Behaviour.list.push(sheet);
|
45
|
-
},
|
46
|
-
|
47
|
-
start : function(){
|
48
|
-
Behaviour.addLoadEvent(function(){
|
49
|
-
Behaviour.apply();
|
50
|
-
});
|
51
|
-
},
|
52
|
-
|
53
|
-
apply : function(){
|
54
|
-
for (h=0;sheet=Behaviour.list[h];h++){
|
55
|
-
for (selector in sheet){
|
56
|
-
list = document.getElementsBySelector(selector);
|
57
|
-
|
58
|
-
if (!list){
|
59
|
-
continue;
|
60
|
-
}
|
61
|
-
|
62
|
-
for (i=0;element=list[i];i++){
|
63
|
-
sheet[selector](element);
|
64
|
-
}
|
65
|
-
}
|
66
|
-
}
|
67
|
-
},
|
68
|
-
|
69
|
-
addLoadEvent : function(func){
|
70
|
-
var oldonload = window.onload;
|
71
|
-
|
72
|
-
if (typeof window.onload != 'function') {
|
73
|
-
window.onload = func;
|
74
|
-
} else {
|
75
|
-
window.onload = function() {
|
76
|
-
oldonload();
|
77
|
-
func();
|
78
|
-
}
|
79
|
-
}
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
|
-
Behaviour.start();
|
84
|
-
|
85
|
-
/*
|
86
|
-
The following code is Copyright (C) Simon Willison 2004.
|
87
|
-
|
88
|
-
document.getElementsBySelector(selector)
|
89
|
-
- returns an array of element objects from the current document
|
90
|
-
matching the CSS selector. Selectors can contain element names,
|
91
|
-
class names and ids and can be nested. For example:
|
92
|
-
|
93
|
-
elements = document.getElementsBySelect('div#main p a.external')
|
94
|
-
|
95
|
-
Will return an array of all 'a' elements with 'external' in their
|
96
|
-
class attribute that are contained inside 'p' elements that are
|
97
|
-
contained inside the 'div' element which has id="main"
|
98
|
-
|
99
|
-
New in version 0.4: Support for CSS2 and CSS3 attribute selectors:
|
100
|
-
See http://www.w3.org/TR/css3-selectors/#attribute-selectors
|
101
|
-
|
102
|
-
Version 0.4 - Simon Willison, March 25th 2003
|
103
|
-
-- Works in Phoenix 0.5, Mozilla 1.3, Opera 7, Internet Explorer 6, Internet Explorer 5 on Windows
|
104
|
-
-- Opera 7 fails
|
105
|
-
*/
|
106
|
-
|
107
|
-
function getAllChildren(e) {
|
108
|
-
// Returns all children of element. Workaround required for IE5/Windows. Ugh.
|
109
|
-
return e.all ? e.all : e.getElementsByTagName('*');
|
110
|
-
}
|
111
|
-
|
112
|
-
document.getElementsBySelector = function(selector) {
|
113
|
-
// Attempt to fail gracefully in lesser browsers
|
114
|
-
if (!document.getElementsByTagName) {
|
115
|
-
return new Array();
|
116
|
-
}
|
117
|
-
// Split selector in to tokens
|
118
|
-
var tokens = selector.split(' ');
|
119
|
-
var currentContext = new Array(document);
|
120
|
-
for (var i = 0; i < tokens.length; i++) {
|
121
|
-
token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');;
|
122
|
-
if (token.indexOf('#') > -1) {
|
123
|
-
// Token is an ID selector
|
124
|
-
var bits = token.split('#');
|
125
|
-
var tagName = bits[0];
|
126
|
-
var id = bits[1];
|
127
|
-
var element = document.getElementById(id);
|
128
|
-
if (tagName && element.nodeName.toLowerCase() != tagName) {
|
129
|
-
// tag with that ID not found, return false
|
130
|
-
return new Array();
|
131
|
-
}
|
132
|
-
// Set currentContext to contain just this element
|
133
|
-
currentContext = new Array(element);
|
134
|
-
continue; // Skip to next token
|
135
|
-
}
|
136
|
-
if (token.indexOf('.') > -1) {
|
137
|
-
// Token contains a class selector
|
138
|
-
var bits = token.split('.');
|
139
|
-
var tagName = bits[0];
|
140
|
-
var className = bits[1];
|
141
|
-
if (!tagName) {
|
142
|
-
tagName = '*';
|
143
|
-
}
|
144
|
-
// Get elements matching tag, filter them for class selector
|
145
|
-
var found = new Array;
|
146
|
-
var foundCount = 0;
|
147
|
-
for (var h = 0; h < currentContext.length; h++) {
|
148
|
-
var elements;
|
149
|
-
if (tagName == '*') {
|
150
|
-
elements = getAllChildren(currentContext[h]);
|
151
|
-
} else {
|
152
|
-
elements = currentContext[h].getElementsByTagName(tagName);
|
153
|
-
}
|
154
|
-
for (var j = 0; j < elements.length; j++) {
|
155
|
-
found[foundCount++] = elements[j];
|
156
|
-
}
|
157
|
-
}
|
158
|
-
currentContext = new Array;
|
159
|
-
var currentContextIndex = 0;
|
160
|
-
for (var k = 0; k < found.length; k++) {
|
161
|
-
if (found[k].className && found[k].className.match(new RegExp('\\b'+className+'\\b'))) {
|
162
|
-
currentContext[currentContextIndex++] = found[k];
|
163
|
-
}
|
164
|
-
}
|
165
|
-
continue; // Skip to next token
|
166
|
-
}
|
167
|
-
// Code to deal with attribute selectors
|
168
|
-
if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {
|
169
|
-
var tagName = RegExp.$1;
|
170
|
-
var attrName = RegExp.$2;
|
171
|
-
var attrOperator = RegExp.$3;
|
172
|
-
var attrValue = RegExp.$4;
|
173
|
-
if (!tagName) {
|
174
|
-
tagName = '*';
|
175
|
-
}
|
176
|
-
// Grab all of the tagName elements within current context
|
177
|
-
var found = new Array;
|
178
|
-
var foundCount = 0;
|
179
|
-
for (var h = 0; h < currentContext.length; h++) {
|
180
|
-
var elements;
|
181
|
-
if (tagName == '*') {
|
182
|
-
elements = getAllChildren(currentContext[h]);
|
183
|
-
} else {
|
184
|
-
elements = currentContext[h].getElementsByTagName(tagName);
|
185
|
-
}
|
186
|
-
for (var j = 0; j < elements.length; j++) {
|
187
|
-
found[foundCount++] = elements[j];
|
188
|
-
}
|
189
|
-
}
|
190
|
-
currentContext = new Array;
|
191
|
-
var currentContextIndex = 0;
|
192
|
-
var checkFunction; // This function will be used to filter the elements
|
193
|
-
switch (attrOperator) {
|
194
|
-
case '=': // Equality
|
195
|
-
checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); };
|
196
|
-
break;
|
197
|
-
case '~': // Match one of space seperated words
|
198
|
-
checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); };
|
199
|
-
break;
|
200
|
-
case '|': // Match start with value followed by optional hyphen
|
201
|
-
checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); };
|
202
|
-
break;
|
203
|
-
case '^': // Match starts with value
|
204
|
-
checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); };
|
205
|
-
break;
|
206
|
-
case '$': // Match ends with value - fails with "Warning" in Opera 7
|
207
|
-
checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); };
|
208
|
-
break;
|
209
|
-
case '*': // Match ends with value
|
210
|
-
checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); };
|
211
|
-
break;
|
212
|
-
default :
|
213
|
-
// Just test for existence of attribute
|
214
|
-
checkFunction = function(e) { return e.getAttribute(attrName); };
|
215
|
-
}
|
216
|
-
currentContext = new Array;
|
217
|
-
var currentContextIndex = 0;
|
218
|
-
for (var k = 0; k < found.length; k++) {
|
219
|
-
if (checkFunction(found[k])) {
|
220
|
-
currentContext[currentContextIndex++] = found[k];
|
221
|
-
}
|
222
|
-
}
|
223
|
-
// alert('Attribute Selector: '+tagName+' '+attrName+' '+attrOperator+' '+attrValue);
|
224
|
-
continue; // Skip to next token
|
225
|
-
}
|
226
|
-
|
227
|
-
if (!currentContext[0]){
|
228
|
-
return;
|
229
|
-
}
|
230
|
-
|
231
|
-
// If we get here, token is JUST an element (not a class or ID selector)
|
232
|
-
tagName = token;
|
233
|
-
var found = new Array;
|
234
|
-
var foundCount = 0;
|
235
|
-
for (var h = 0; h < currentContext.length; h++) {
|
236
|
-
var elements = currentContext[h].getElementsByTagName(tagName);
|
237
|
-
for (var j = 0; j < elements.length; j++) {
|
238
|
-
found[foundCount++] = elements[j];
|
239
|
-
}
|
240
|
-
}
|
241
|
-
currentContext = found;
|
242
|
-
}
|
243
|
-
return currentContext;
|
244
|
-
}
|
245
|
-
|
246
|
-
/* That revolting regular expression explained
|
247
|
-
/^(\w+)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/
|
248
|
-
\---/ \---/\-------------/ \-------/
|
249
|
-
| | | |
|
250
|
-
| | | The value
|
251
|
-
| | ~,|,^,$,* or =
|
252
|
-
| Attribute
|
253
|
-
Tag
|
254
|
-
*/
|