netzke-core 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  *.log
2
2
  pkg
3
3
  doc
4
+ Manifest
4
5
  .DS_Store
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v0.4.3
2
+ Fix: reworking loadAggregatee()-related code, closing a security flaw when a malicious browser could send any configuration options to instantiate the widget being loaded.
3
+
1
4
  v0.4.2
2
5
  2009-09-11
3
6
  Fix: the API call (at the JavaScript side) was ignoring the callback parameter.
data/README.rdoc CHANGED
@@ -1,12 +1,30 @@
1
1
  = netzke-core
2
2
  Create Ext JS + Rails reusable components (widgets) with minimum effort.
3
3
 
4
+ This is the bare bones of the Netzke framework. Use it to build your own widgets from scratch. For pre-built widgets (like panels, grids, forms, trees, applications), see the netzke-basepack project.
5
+
6
+ The idea behind the Netzke framework is that it allows you write reusable client/server code. Create a widget, and then embed it (or load it dynamically) into your Ext-based applications or HTML pages. For more info, see the links below.
7
+
8
+ == Instalation
9
+ From RubyForge:
10
+
11
+ sudo gem install netzke-core
12
+
13
+ From github:
14
+
15
+ sudo gem install skozlov-netzke-core
16
+
17
+ If you want the most recent changes, install this as a plugin:
18
+
19
+ script/plugin install git://github.com/skozlov/netzke-core.git
20
+
21
+ == Usage
4
22
  Introduction to Netzke framework: http://github.com/skozlov/netzke/tree/master
5
23
 
6
24
  Tutorials: http://blog.writelesscode.com
7
25
 
8
26
  Live-demo: http://netzke-demo.writelesscode.com
9
27
 
10
- Also see netzke-basepack (pre-programmed widgets) project: http://github.com/skozlov/netzke-basepack/tree/master
28
+ The netzke-basepack project (pre-built full-featured widgets): http://github.com/skozlov/netzke-basepack/tree/master
11
29
 
12
30
  Copyright (c) 2009 Sergei Kozlov, released under the MIT license
data/Rakefile CHANGED
@@ -12,7 +12,28 @@ begin
12
12
  Jeweler::RubyforgeTasks.new do |rubyforge|
13
13
  rubyforge.doc_task = "rdoc"
14
14
  end
15
-
15
+
16
16
  rescue LoadError
17
17
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
18
- end
18
+ end
19
+
20
+ require 'rake/rdoctask'
21
+ Rake::RDocTask.new do |rdoc|
22
+ if File.exist?('VERSION')
23
+ version = File.read('VERSION')
24
+ else
25
+ version = ""
26
+ end
27
+
28
+ rdoc.rdoc_dir = 'rdoc'
29
+ rdoc.title = "netzke-core #{version}"
30
+ rdoc.rdoc_files.include('README*')
31
+ rdoc.rdoc_files.include('lib/**/*.rb')
32
+ end
33
+
34
+ require 'rake/testtask'
35
+ Rake::TestTask.new(:test) do |test|
36
+ test.libs << 'lib' << 'test'
37
+ test.pattern = 'test/**/*_test.rb'
38
+ test.verbose = true
39
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.2
1
+ 0.4.3
data/javascripts/core.js CHANGED
@@ -91,30 +91,31 @@ Ext.widgetMixIn = {
91
91
  is_netzke: true, // to distinguish Netzke components from regular Ext components
92
92
 
93
93
  /*
94
- Loads aggregatee into a container. Sends the widgets cache info to the server.
94
+ Loads aggregatee into a container.
95
95
  */
96
96
  loadAggregatee: function(params){
97
- // build the cached widget list
97
+ // params that will be provided for the server API call (load_aggregatee_with_cache); all what's passed in params.params is merged in
98
+ var apiParams = Ext.apply({id: params.id, container: params.container}, params.params);
99
+
100
+ // build the cached widgets list to send it to the server
98
101
  var cachedWidgetNames = [];
99
102
  for (name in Ext.netzke.cache) {
100
103
  cachedWidgetNames.push(name);
101
104
  }
105
+ apiParams.cache = Ext.encode(cachedWidgetNames);
102
106
 
103
- params.cache = Ext.encode(cachedWidgetNames);
104
-
105
- // remember the passed callback
107
+ // remember the passed callback for the future
106
108
  if (params.callback) {
107
- this.callbackHash[params.id] = params.callback;
108
- delete params.callback;
109
- delete params.scope;
109
+ this.callbackHash[params.id] = params.callback; // per loaded widget, as there may be simultaneous calls
110
110
  }
111
111
 
112
112
  // visually disable the container while the widget is being loaded
113
113
  // Ext.getCmp(params.container).disable();
114
- Ext.getCmp(params.container).removeChild(); // simply cleanup the area, which speaks for itself
114
+
115
+ Ext.getCmp(params.container).removeChild(); // remove the old widget
115
116
 
116
- // remote api call
117
- this.loadAggregateeWithCache(params);
117
+ // do the remote API call
118
+ this.loadAggregateeWithCache(apiParams);
118
119
  },
119
120
 
120
121
  /*
data/lib/netzke/base.rb CHANGED
@@ -429,35 +429,6 @@ module Netzke
429
429
  "#{@id_name}__#{action_name}"
430
430
  end
431
431
 
432
- # permissions
433
- # def available_permissions
434
- # []
435
- # end
436
-
437
- # def process_permissions_config
438
- # if !available_permissions.empty?
439
- # # First, process permissions from the config
440
- # @permissions = available_permissions.inject({}){|h,p| h.merge(p.to_sym => true)} # by default anything is allowed
441
- #
442
- # config[:prohibit] = available_permissions if config[:prohibit] == :all # short-cut for all permissions
443
- # config[:prohibit] = [config[:prohibit]] if config[:prohibit].is_a?(Symbol) # so that config[:prohibit] => :write works
444
- # config[:prohibit] && config[:prohibit].each{|p| @permissions.merge!(p.to_sym => false)} # prohibit
445
- #
446
- # config[:allow] = [config[:allow]] if config[:allow].is_a?(Symbol) # so that config[:allow] => :write works
447
- # config[:allow] && config[:allow].each{|p| @permissions.merge!(p.to_sym => true)} # allow
448
- #
449
- # # ... and then merge it with NetzkePreferences
450
- # available_permissions.each do |p|
451
- # # if nothing is stored in persistent_config, store the permission from the config; otherwise leave what's there
452
- # persistent_config["permissions/#{p}"].nil? && persistent_config["permissions/#{p}"] = @permissions[p.to_sym]
453
- #
454
- # # what's stored in persistent_config has higher priority, so, if there's something there, use that
455
- # persistent_permisson = persistent_config["permissions/#{p}"]
456
- # @permissions[p.to_sym] = persistent_permisson unless persistent_permisson.nil?
457
- # end
458
- # end
459
- # end
460
-
461
432
  # called when the method_missing tries to processes a non-existing aggregatee
462
433
  def aggregatee_missing(aggr)
463
434
  flash :error => "Unknown aggregatee #{aggr} for widget #{name}"
@@ -486,9 +457,7 @@ module Netzke
486
457
  def load_aggregatee_with_cache(params)
487
458
  cache = ActiveSupport::JSON.decode(params.delete(:cache))
488
459
  relative_widget_id = params.delete(:id).underscore
489
- passed_config = params[:config] && ActiveSupport::JSON.decode(params[:config]) || {}
490
- passed_config = passed_config.symbolize_keys
491
- widget = aggregatee_instance(relative_widget_id, passed_config)
460
+ widget = aggregatee_instance(relative_widget_id)
492
461
 
493
462
  # inform the widget that it's being loaded
494
463
  widget.before_load
data/netzke-core.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{netzke-core}
8
- s.version = "0.4.2"
8
+ s.version = "0.4.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Sergei Kozlov"]
12
- s.date = %q{2009-09-11}
12
+ s.date = %q{2009-09-24}
13
13
  s.description = %q{Build ExtJS/Rails widgets with minimum effort}
14
14
  s.email = %q{sergei@playcode.nl}
15
15
  s.extra_rdoc_files = [
@@ -75,7 +75,7 @@ Gem::Specification.new do |s|
75
75
  s.rdoc_options = ["--charset=UTF-8"]
76
76
  s.require_paths = ["lib"]
77
77
  s.rubyforge_project = %q{netzke-core}
78
- s.rubygems_version = %q{1.3.4}
78
+ s.rubygems_version = %q{1.3.5}
79
79
  s.summary = %q{Build ExtJS/Rails widgets with minimum effort}
80
80
  s.test_files = [
81
81
  "test/app_root/app/controllers/application_controller.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netzke-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergei Kozlov
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-11 00:00:00 -05:00
12
+ date: 2009-09-24 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  requirements: []
101
101
 
102
102
  rubyforge_project: netzke-core
103
- rubygems_version: 1.3.4
103
+ rubygems_version: 1.3.5
104
104
  signing_key:
105
105
  specification_version: 3
106
106
  summary: Build ExtJS/Rails widgets with minimum effort