compass-jquery-plugin 0.3.2.pre.2 → 0.3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. data/LICENSE.md +20 -20
  2. data/README.md +7 -2
  3. data/VERSION.yml +2 -2
  4. data/lib/jquery/gridify/grid.rb +1 -1
  5. data/lib/jquery/gridify/grid_column.rb +1 -1
  6. data/lib/jquery/gridify/grid_finder.rb +16 -1
  7. data/lib/jquery/gridify/grid_view.rb +1 -1
  8. data/lib/jquery/jqgrid.rb +4 -4
  9. data/lib/jquery/jqtouch.rb +3 -3
  10. data/lib/jquery/jquery.rb +431 -431
  11. data/lib/jquery/jquery_json_response.rb +28 -0
  12. data/lib/jquery/secret_sauce.rb +8 -8
  13. data/lib/jquery/secret_sauce/controller/ui_dialog_controls.rb +13 -13
  14. data/lib/jquery/secret_sauce/controller/ui_grid_controls.rb +18 -18
  15. data/lib/jquery/secret_sauce/helpers/ui_dialog_helper.rb +5 -5
  16. data/lib/jquery/secret_sauce/model/find_for_grid.rb +41 -41
  17. data/templates/dynatree/jquery.dynatree.js +111 -110
  18. data/templates/dynatree/jquery.dynatree.min.js +75 -77
  19. data/templates/dynatree/jquery/dynatree/aero.scss +1 -3
  20. data/templates/dynatree/jquery/dynatree/aqua.scss +1 -3
  21. data/templates/dynatree/jquery/dynatree/crystal.scss +1 -3
  22. data/templates/dynatree/jquery/dynatree/xp.scss +1 -3
  23. data/templates/emulators/emulators/iphone.landscape.png +0 -0
  24. data/templates/emulators/emulators/iphone.landscape.scss +4 -4
  25. data/templates/emulators/emulators/palm.landscape.scss +6 -6
  26. data/templates/emulators/emulators/palm.pre.landscape.png +0 -0
  27. data/templates/ical/jquery.ical.js +3202 -3197
  28. data/templates/ical/jquery.ical.min.js +185 -184
  29. data/templates/ical/jquery/ical.scss +3 -3
  30. data/templates/jqgrid/i18n/jqgrid/locale-ar.js +126 -0
  31. data/templates/jqgrid/i18n/jqgrid/locale-ar.min.js +6 -0
  32. data/templates/jqgrid/i18n/jqgrid/locale-fi.js +45 -47
  33. data/templates/jqgrid/i18n/jqgrid/locale-fi.min.js +6 -6
  34. data/templates/jqgrid/jquery.jqGrid.js +2047 -2036
  35. data/templates/jqgrid/jquery.jqGrid.min.js +48 -48
  36. data/templates/jqgrid/manifest.rb +2 -0
  37. data/templates/jqtouch/jquery.jqtouch.js +122 -113
  38. data/templates/jqtouch/jquery.jqtouch.min.js +1 -1
  39. data/templates/jquery/config/initializers/jquery.rb +4 -2
  40. data/templates/jquery/i18n/jquery.ui/datepicker-ar-DZ.js +23 -0
  41. data/templates/jquery/i18n/jquery.ui/datepicker-ar-DZ.min.js +2 -0
  42. data/templates/jquery/i18n/jquery.ui/datepicker-en-AU.js +23 -0
  43. data/templates/jquery/i18n/jquery.ui/datepicker-en-AU.min.js +2 -0
  44. data/templates/jquery/i18n/jquery.ui/datepicker-en-NZ.js +23 -0
  45. data/templates/jquery/i18n/jquery.ui/datepicker-en-NZ.min.js +2 -0
  46. data/templates/jquery/i18n/jquery.ui/datepicker-ml.js +23 -0
  47. data/templates/jquery/i18n/jquery.ui/datepicker-ml.min.js +2 -0
  48. data/templates/jquery/jquery-ui.js +354 -316
  49. data/templates/jquery/jquery-ui.min.js +544 -544
  50. data/templates/jquery/jquery.cookie.js +3 -3
  51. data/templates/jquery/jquery.form.js +271 -140
  52. data/templates/jquery/jquery.form.min.js +19 -17
  53. data/templates/jquery/jquery.layout.js +2435 -2437
  54. data/templates/jquery/jquery.layout.min.js +4 -3
  55. data/templates/jquery/jquery.mousewheel.js +78 -0
  56. data/templates/jquery/jquery.mousewheel.min.js +2 -0
  57. data/templates/jquery/jquery.offline.js +212 -0
  58. data/templates/jquery/jquery.offline.min.js +4 -0
  59. data/templates/jquery/jquery.tmpl.js +15 -22
  60. data/templates/jquery/jquery.tmpl.min.js +12 -12
  61. data/templates/jquery/jquery.tmplPlus.js +1 -0
  62. data/templates/jquery/jquery/ui/_theme.scss +27 -27
  63. data/templates/jquery/json.js +7 -0
  64. data/templates/jquery/json.min.js +7 -0
  65. data/templates/jquery/manifest.rb +14 -2
  66. data/templates/mobile/glyphish/{Read me first - license.txt → License.txt} +0 -0
  67. data/templates/mobile/jquery.mobile.js +1583 -1408
  68. data/templates/mobile/jquery.mobile.min.js +5 -5
  69. data/templates/mobile/jquery/mobile/_base.scss +938 -1038
  70. data/templates/mobile/jquery/mobile/default.scss +25 -26
  71. data/templates/mobile/jquery/mobile/valencia.scss +0 -1
  72. data/templates/mobile/manifest.rb +1 -1
  73. data/templates/tools/config/initializers/tools.rb +2 -0
  74. data/templates/tools/flowplayer.js +24 -0
  75. data/templates/tools/flowplayer.min.js +30 -0
  76. data/templates/tools/jquery.tools.js +4 -3
  77. data/templates/tools/jquery.tools.min.js +1 -1
  78. data/templates/tools/manifest.rb +4 -0
  79. data/templates/tools/swfobject.js +777 -0
  80. data/templates/tools/swfobject.min.js +19 -0
  81. metadata +31 -15
  82. data/templates/jquery/jquery.metadata.js +0 -122
  83. data/templates/jquery/jquery.metadata.min.js +0 -2
@@ -0,0 +1,28 @@
1
+ module ActionController
2
+ class Base
3
+
4
+ # From http://paydrotalks.com/posts/45-standard-json-response-for-rails-and-jquery
5
+
6
+ def render_json_response(type, hash)
7
+ unless [ :ok, :redirect, :error ].include?(type)
8
+ raise "Invalid json response type: #{type}"
9
+ end
10
+
11
+ # To keep the structure consistent, we'll build the json
12
+ # structure with the default properties.
13
+ #
14
+ # This will also help other developers understand what
15
+ # is returned by the server by looking at this method.
16
+ default_json_structure = {
17
+ :status => type,
18
+ :html => nil,
19
+ :message => nil,
20
+ :to => nil }.merge(hash)
21
+
22
+ render_options = {:json => default_json_structure}
23
+ render_options[:status] = 400 if type == :error
24
+
25
+ render(render_options)
26
+ end
27
+ end
28
+ end
@@ -1,9 +1,9 @@
1
- module SecretSauce#:nodoc:
2
- end
3
-
4
- require 'jquery/secret_sauce/controller/ui_dialog_controls'
5
- require 'jquery/secret_sauce/controller/ui_grid_controls'
6
- require 'jquery/secret_sauce/helpers/ui_dialog_helper'
7
- require 'jquery/secret_sauce/helpers/ui_form_helper'
8
- require 'jquery/secret_sauce/helpers/ui_grid_helper'
1
+ module SecretSauce#:nodoc:
2
+ end
3
+
4
+ require 'jquery/secret_sauce/controller/ui_dialog_controls'
5
+ require 'jquery/secret_sauce/controller/ui_grid_controls'
6
+ require 'jquery/secret_sauce/helpers/ui_dialog_helper'
7
+ require 'jquery/secret_sauce/helpers/ui_form_helper'
8
+ require 'jquery/secret_sauce/helpers/ui_grid_helper'
9
9
  require 'jquery/secret_sauce/model/find_for_grid'
@@ -1,14 +1,14 @@
1
- module ActionController
2
- class Base
3
-
4
- def render_close_dialog(dialog_id)
5
- render :js => close_dialog
6
- end
7
-
8
- private
9
-
10
- def close_dialog(dialog_id)
11
- "jQuery('##{dialog_id}').dialog('close');"
12
- end
13
- end
1
+ module ActionController
2
+ class Base
3
+
4
+ def render_close_dialog(dialog_id)
5
+ render :js => close_dialog
6
+ end
7
+
8
+ private
9
+
10
+ def close_dialog(dialog_id)
11
+ "jQuery('##{dialog_id}').dialog('close');"
12
+ end
13
+ end
14
14
  end
@@ -1,18 +1,18 @@
1
- module ActionController
2
- class Base
3
-
4
- def render_refresh_grid
5
- render :js => refresh_grid("#{params[:controller]}_table")
6
- end
7
-
8
- def render_close_dialog_and_refresh_grid
9
- render :js => close_dialog("#{params["controller"]}_#{params["action"]}_dialog")+refresh_grid("#{params[:controller]}_table")
10
- end
11
-
12
- private
13
-
14
- def refresh_grid(grid_id)
15
- "jQuery('##{grid_id}').trigger('reloadGrid');"
16
- end
17
- end
18
- end
1
+ module ActionController
2
+ class Base
3
+
4
+ def render_refresh_grid
5
+ render :js => refresh_grid("#{params[:controller]}_table")
6
+ end
7
+
8
+ def render_close_dialog_and_refresh_grid
9
+ render :js => close_dialog("#{params["controller"]}_#{params["action"]}_dialog")+refresh_grid("#{params[:controller]}_table")
10
+ end
11
+
12
+ private
13
+
14
+ def refresh_grid(grid_id)
15
+ "jQuery('##{grid_id}').trigger('reloadGrid');"
16
+ end
17
+ end
18
+ end
@@ -1,6 +1,6 @@
1
- module SecretSauce
2
- module Helpers
3
- module UiDialogHelper
4
- end
5
- end
1
+ module SecretSauce
2
+ module Helpers
3
+ module UiDialogHelper
4
+ end
5
+ end
6
6
  end
@@ -1,42 +1,42 @@
1
- module ActiveRecord
2
- class Base
3
- # takes params from request and returns records serialized to json. handles the majority of the functionality
4
- # for searching, sorting, and serializing records to be consumed by jqGrid.
5
- def self.find_for_grid_2(params)
6
- search_options = {:limit => params["rows"]}
7
- search_options[:offset] = (params["page"].to_i * params["rows"].to_i) - params["rows"].to_i
8
- search_options[:order] = "#{params['sidx']} #{params['sord']}" if params["sidx"] != ""
9
- if params["_search"] == "true"
10
- string_search_operations = {
11
- "eq" => "=",
12
- "ne" => "<>",
13
- "bw" => "LIKE",
14
- "bn" => "NOT LIKE",
15
- "ew" => "LIKE",
16
- "en" => "NOT LIKE",
17
- "cn" => "LIKE",
18
- "nc" => "NOT LIKE"
19
- }
20
- integer_search_operations = {
21
- "eq" => "=",
22
- "ne" => "<>",
23
- "lt" => "<",
24
- "le" => "<=",
25
- "gt" => ">",
26
- "ge" => ">="
27
- }
28
- if [:text, :string].include?(self.columns.select {|c| c.name == params["searchField"]}.first.type) && string_search_operations.keys.include?(params["searchOper"])
29
- search_options[:conditions] = "#{params["searchField"]} "
30
- search_options[:conditions] << "#{string_search_operations[params["searchOper"]]}"
31
- search_options[:conditions] << "'#{"%" if ["ew", "en", "cn", "nc"].include?(params["searchOper"])}#{params["searchString"]}#{"%" if ["nc", "cn", "bn", "bw"].include?(params["searchOper"])}'"
32
- elsif [:integer].include?(self.columns.select {|c| c.name == params["searchField"]}.first.type) && integer_search_operations.keys.include?(params["searchOper"])
33
- search_options[:conditions] = "#{params["searchField"]} #{integer_search_operations[params["searchOper"]]} #{params["searchString"]}"
34
- end
35
- end
36
- count = self.count(:all, :conditions => search_options[:conditions]).to_f
37
- # raise count.inspect
38
- array = self.find(:all, search_options).collect {|r| r.attributes }
39
- {:total => (count / params["rows"].to_f).ceil, :page => params["page"], :records => count, :rows => array }.to_json
40
- end
41
- end
1
+ module ActiveRecord
2
+ class Base
3
+ # takes params from request and returns records serialized to json. handles the majority of the functionality
4
+ # for searching, sorting, and serializing records to be consumed by jqGrid.
5
+ def self.find_for_grid_2(params)
6
+ search_options = {:limit => params["rows"]}
7
+ search_options[:offset] = (params["page"].to_i * params["rows"].to_i) - params["rows"].to_i
8
+ search_options[:order] = "#{params['sidx']} #{params['sord']}" if params["sidx"] != ""
9
+ if params["_search"] == "true"
10
+ string_search_operations = {
11
+ "eq" => "=",
12
+ "ne" => "<>",
13
+ "bw" => "LIKE",
14
+ "bn" => "NOT LIKE",
15
+ "ew" => "LIKE",
16
+ "en" => "NOT LIKE",
17
+ "cn" => "LIKE",
18
+ "nc" => "NOT LIKE"
19
+ }
20
+ integer_search_operations = {
21
+ "eq" => "=",
22
+ "ne" => "<>",
23
+ "lt" => "<",
24
+ "le" => "<=",
25
+ "gt" => ">",
26
+ "ge" => ">="
27
+ }
28
+ if [:text, :string].include?(self.columns.select {|c| c.name == params["searchField"]}.first.type) && string_search_operations.keys.include?(params["searchOper"])
29
+ search_options[:conditions] = "#{params["searchField"]} "
30
+ search_options[:conditions] << "#{string_search_operations[params["searchOper"]]}"
31
+ search_options[:conditions] << "'#{"%" if ["ew", "en", "cn", "nc"].include?(params["searchOper"])}#{params["searchString"]}#{"%" if ["nc", "cn", "bn", "bw"].include?(params["searchOper"])}'"
32
+ elsif [:integer].include?(self.columns.select {|c| c.name == params["searchField"]}.first.type) && integer_search_operations.keys.include?(params["searchOper"])
33
+ search_options[:conditions] = "#{params["searchField"]} #{integer_search_operations[params["searchOper"]]} #{params["searchString"]}"
34
+ end
35
+ end
36
+ count = self.count(:all, :conditions => search_options[:conditions]).to_f
37
+ # raise count.inspect
38
+ array = self.find(:all, search_options).collect {|r| r.attributes }
39
+ {:total => (count / params["rows"].to_f).ceil, :page => params["page"], :records => count, :rows => array }.to_json
40
+ end
41
+ end
42
42
  end
@@ -2,7 +2,7 @@
2
2
  jquery.dynatree.js
3
3
  Dynamic tree view control, with support for lazy loading of branches.
4
4
 
5
- Copyright (c) 2008-2010, Martin Wendt (http://wwWendt.de)
5
+ Copyright (c) 2008-2011, Martin Wendt (http://wwWendt.de)
6
6
  Dual licensed under the MIT or GPL Version 2 licenses.
7
7
  http://code.google.com/p/dynatree/wiki/LicenseInfo
8
8
 
@@ -18,7 +18,7 @@
18
18
  *************************************************************************/
19
19
 
20
20
  // Note: We currently allow eval() to parse the 'data' attribtes, when initializing from HTML.
21
- /*jslint laxbreak: true, browser: true, evil: true */
21
+ /*jslint laxbreak: true, browser: true, evil: true, indent: 0, white: false, onevar: false */
22
22
 
23
23
  /*************************************************************************
24
24
  * Debug functions
@@ -179,10 +179,12 @@ DynaTreeNode.prototype = {
179
179
  },
180
180
 
181
181
  _getInnerHtml: function() {
182
- var opts = this.tree.options;
183
- var cache = this.tree.cache;
184
- var level = this.getLevel();
185
- var res = "";
182
+ var tree = this.tree,
183
+ opts = tree.options,
184
+ cache = tree.cache,
185
+ level = this.getLevel(),
186
+ data = this.data,
187
+ res = "";
186
188
  // connector (expanded, expandable or simple)
187
189
  if( level < opts.minExpandLevel ) {
188
190
  if(level > 1){
@@ -195,26 +197,33 @@ DynaTreeNode.prototype = {
195
197
  res += cache.tagConnector;
196
198
  }
197
199
  // Checkbox mode
198
- if( opts.checkbox && this.data.hideCheckbox !== true && !this.data.isStatusNode ) {
200
+ if( opts.checkbox && data.hideCheckbox !== true && !data.isStatusNode ) {
199
201
  res += cache.tagCheckbox;
200
202
  }
201
203
  // folder or doctype icon
202
- if ( this.data.icon ) {
203
- res += "<img src='" + opts.imagePath + this.data.icon + "' alt='' />";
204
- } else if ( this.data.icon === false ) {
204
+ if ( data.icon ) {
205
+ res += "<img src='" + opts.imagePath + data.icon + "' alt='' />";
206
+ } else if ( data.icon === false ) {
205
207
  // icon == false means 'no icon'
206
208
  noop(); // keep JSLint happy
207
209
  } else {
208
210
  // icon == null means 'default icon'
209
211
  res += cache.tagNodeIcon;
210
212
  }
211
- // node name
212
- var tooltip = this.data.tooltip ? " title='" + this.data.tooltip + "'" : "";
213
- if( opts.noLink || this.data.noLink ) {
214
- res += "<span style='display: inline-block;' class='" + opts.classNames.title + "'" + tooltip + ">" + this.data.title + "</span>";
215
- }else{
216
- res += "<a href='#' class='" + opts.classNames.title + "'" + tooltip + ">" + this.data.title + "</a>";
213
+ // node title
214
+ var nodeTitle = "";
215
+ if ( opts.onCustomRender ){
216
+ nodeTitle = opts.onCustomRender.call(tree, this) || "";
217
+ }
218
+ if(!nodeTitle){
219
+ var tooltip = data.tooltip ? " title='" + data.tooltip + "'" : "";
220
+ if( opts.noLink || data.noLink ) {
221
+ nodeTitle = "<span style='display: inline-block;' class='" + opts.classNames.title + "'" + tooltip + ">" + data.title + "</span>";
222
+ }else{
223
+ nodeTitle = "<a href='#' class='" + opts.classNames.title + "'" + tooltip + ">" + data.title + "</a>";
224
+ }
217
225
  }
226
+ res += nodeTitle;
218
227
  return res;
219
228
  },
220
229
 
@@ -224,7 +233,7 @@ DynaTreeNode.prototype = {
224
233
  * Make sure, that <li> order matches childList order.
225
234
  */
226
235
  var cl = this.childList;
227
- if( !cl ){
236
+ if( !cl || !this.ul ){
228
237
  return;
229
238
  }
230
239
  var childLI = this.ul.firstChild;
@@ -241,9 +250,9 @@ DynaTreeNode.prototype = {
241
250
  },
242
251
 
243
252
 
244
- render: function(useEffects) {
253
+ render: function(useEffects, includeInvisible) {
245
254
  /**
246
- * create <li><span>..</span> .. </li> tags for this node.
255
+ * Create <li><span>..</span> .. </li> tags for this node.
247
256
  *
248
257
  * <li id='key'> // This div contains the node's span and list of child div's.
249
258
  * <span class='title'>S S S A</span> // Span contains graphic spans and title <a> tag
@@ -255,11 +264,14 @@ DynaTreeNode.prototype = {
255
264
  */
256
265
  // this.tree.logDebug("%s.render(%s)", this, useEffects);
257
266
  // ---
258
- var opts = this.tree.options;
259
- var cn = opts.classNames;
260
- var isLastSib = this.isLastSibling();
261
-
262
- if( !this.parent && !this.ul ) {
267
+ var tree = this.tree,
268
+ parent = this.parent,
269
+ data = this.data,
270
+ opts = tree.options,
271
+ cn = opts.classNames,
272
+ isLastSib = this.isLastSibling();
273
+
274
+ if( !parent && !this.ul ) {
263
275
  // Root node has only a <ul>
264
276
  this.li = this.span = null;
265
277
  this.ul = document.createElement("ul");
@@ -268,37 +280,36 @@ DynaTreeNode.prototype = {
268
280
  }else{
269
281
  this.ul.className = cn.container;
270
282
  }
271
- } else if( this.parent ) {
283
+ } else if( parent ) {
272
284
  // Create <li><span /> </li>
273
285
  if( ! this.li ) {
274
286
  this.li = document.createElement("li");
275
287
  this.li.dtnode = this;
276
- if( this.data.key && opts.generateIds ){
277
- this.li.id = opts.idPrefix + this.data.key;
288
+ if( data.key && opts.generateIds ){
289
+ this.li.id = opts.idPrefix + data.key;
278
290
  }
279
291
  this.span = document.createElement("span");
280
292
  this.span.className = cn.title;
281
293
  this.li.appendChild(this.span);
282
294
 
283
- if( !this.parent.ul ) {
295
+ if( !parent.ul ) {
284
296
  // This is the parent's first child: create UL tag
285
297
  // (Hidden, because it will be
286
- this.parent.ul = document.createElement("ul");
287
- this.parent.ul.style.display = "none";
288
- this.parent.li.appendChild(this.parent.ul);
298
+ parent.ul = document.createElement("ul");
299
+ parent.ul.style.display = "none";
300
+ parent.li.appendChild(parent.ul);
289
301
  // if( opts.minExpandLevel > this.getLevel() ){
290
- // this.parent.ul.className = cn.noConnector;
302
+ // parent.ul.className = cn.noConnector;
291
303
  // }
292
304
  }
293
- this.parent.ul.appendChild(this.li);
305
+ parent.ul.appendChild(this.li);
294
306
  }
295
307
  // set node connector images, links and text
296
308
  this.span.innerHTML = this._getInnerHtml();
297
-
298
309
  // Set classes for current status
299
310
  var cnList = [];
300
311
  cnList.push(cn.node);
301
- if( this.data.isFolder ){
312
+ if( data.isFolder ){
302
313
  cnList.push(cn.folder);
303
314
  }
304
315
  if( this.bExpanded ){
@@ -307,7 +318,7 @@ DynaTreeNode.prototype = {
307
318
  if( this.hasChildren() !== false ){
308
319
  cnList.push(cn.hasChildren);
309
320
  }
310
- if( this.data.isLazy && this.childList === null ){
321
+ if( data.isLazy && this.childList === null ){
311
322
  cnList.push(cn.lazy);
312
323
  }
313
324
  if( isLastSib ){
@@ -319,22 +330,22 @@ DynaTreeNode.prototype = {
319
330
  if( this.hasSubSel ){
320
331
  cnList.push(cn.partsel);
321
332
  }
322
- if( this.tree.activeNode === this ){
333
+ if( tree.activeNode === this ){
323
334
  cnList.push(cn.active);
324
335
  }
325
- if( this.data.addClass ){
326
- cnList.push(this.data.addClass);
336
+ if( data.addClass ){
337
+ cnList.push(data.addClass);
327
338
  }
328
339
  // IE6 doesn't correctly evaluate multiple class names,
329
340
  // so we create combined class names that can be used in the CSS
330
341
  cnList.push(cn.combinedExpanderPrefix
331
342
  + (this.bExpanded ? "e" : "c")
332
- + (this.data.isLazy && this.childList === null ? "d" : "")
343
+ + (data.isLazy && this.childList === null ? "d" : "")
333
344
  + (isLastSib ? "l" : "")
334
345
  );
335
346
  cnList.push(cn.combinedIconPrefix
336
347
  + (this.bExpanded ? "e" : "c")
337
- + (this.data.isFolder ? "f" : "")
348
+ + (data.isFolder ? "f" : "")
338
349
  );
339
350
  this.span.className = cnList.join(" ");
340
351
 
@@ -342,13 +353,18 @@ DynaTreeNode.prototype = {
342
353
  this.li.className = isLastSib ? cn.lastsib : "";
343
354
 
344
355
  // Hide children, if node is collapsed
345
- // this.ul.style.display = ( this.bExpanded || !this.parent ) ? "" : "none";
356
+ // this.ul.style.display = ( this.bExpanded || !parent ) ? "" : "none";
357
+ // Allow tweaking, binding, ...
358
+ if(opts.onRender){
359
+ opts.onRender.call(tree, this, this.span);
360
+ }
346
361
  }
347
-
348
- if( this.bExpanded && this.childList ) {
362
+ // Visit child nodes
363
+ if( (this.bExpanded || includeInvisible === true) && this.childList ) {
349
364
  for(var i=0, l=this.childList.length; i<l; i++) {
350
- this.childList[i].render();
365
+ this.childList[i].render(false, includeInvisible);
351
366
  }
367
+ // Make sure the tag order matches the child array
352
368
  this._fixOrder();
353
369
  }
354
370
  // Hide children, if node is collapsed
@@ -360,7 +376,7 @@ DynaTreeNode.prototype = {
360
376
  var duration = opts.fx.duration || 200;
361
377
  $(this.ul).animate(opts.fx, duration);
362
378
  } else {
363
- this.ul.style.display = ( this.bExpanded || !this.parent ) ? "" : "none";
379
+ this.ul.style.display = ( this.bExpanded || !parent ) ? "" : "none";
364
380
  }
365
381
  }
366
382
  },
@@ -459,6 +475,19 @@ DynaTreeNode.prototype = {
459
475
  return false;
460
476
  },
461
477
 
478
+ countChildren: function() {
479
+ var cl = this.childList;
480
+ if( !cl ){
481
+ return 0;
482
+ }
483
+ var n = cl.length;
484
+ for(var i=0, l=n; i<l; i++){
485
+ var child = cl[i];
486
+ n += child.countChildren();
487
+ }
488
+ return n;
489
+ },
490
+
462
491
  /**Sort child list by title.
463
492
  * cmd: optional compare function.
464
493
  * deep: optional: pass true to sort all descendant nodes.
@@ -568,7 +597,6 @@ DynaTreeNode.prototype = {
568
597
  }
569
598
  return l;
570
599
  },
571
-
572
600
  getLevel: function() {
573
601
  /**
574
602
  * Return node depth. 0: System root node, 1: visible top-level node.
@@ -683,7 +711,6 @@ DynaTreeNode.prototype = {
683
711
  if ( fireEvents && opts.onQueryActivate && opts.onQueryActivate.call(this.tree, flag, this) === false ){
684
712
  return; // Callback returned false
685
713
  }
686
-
687
714
  if( flag ) {
688
715
  // Activate
689
716
  if( this.tree.activeNode ) {
@@ -1961,9 +1988,9 @@ DynaTree.prototype = {
1961
1988
  if( opts.rootVisible !== undefined ){
1962
1989
  _log("warn", "Option 'rootVisible' is no longer supported.");
1963
1990
  }
1964
- if( opts.title !== undefined ){
1965
- _log("warn", "Option 'title' is no longer supported.");
1966
- }
1991
+ // if( opts.title !== undefined ){
1992
+ // _log("warn", "Option 'title' is no longer supported.");
1993
+ // }
1967
1994
  if( opts.minExpandLevel < 1 ) {
1968
1995
  _log("warn", "Option 'minExpandLevel' must be >= 1.");
1969
1996
  opts.minExpandLevel = 1;
@@ -2222,11 +2249,13 @@ DynaTree.prototype = {
2222
2249
  },
2223
2250
 
2224
2251
  redraw: function() {
2225
- this.logDebug("dynatree.redraw()...");
2226
- this.tnRoot.render(false);
2227
- this.logDebug("dynatree.redraw() done.");
2252
+ // this.logDebug("dynatree.redraw()...");
2253
+ this.tnRoot.render(false, false);
2254
+ // this.logDebug("dynatree.redraw() done.");
2255
+ },
2256
+ renderInvisibleNodes: function() {
2257
+ this.tnRoot.render(false, true);
2228
2258
  },
2229
-
2230
2259
  reload: function(callback) {
2231
2260
  this._load(callback);
2232
2261
  },
@@ -2341,6 +2370,10 @@ DynaTree.prototype = {
2341
2370
  return !bEnable; // return previous value
2342
2371
  },
2343
2372
 
2373
+ count: function() {
2374
+ return this.tnRoot.countChildren();
2375
+ },
2376
+
2344
2377
  visit: function(fn, includeRoot) {
2345
2378
  return this.tnRoot.visit(fn, includeRoot);
2346
2379
  },
@@ -2424,7 +2457,7 @@ TODO: better?
2424
2457
  .hide()
2425
2458
  .prependTo($(this.divTree).parent());
2426
2459
  // .prependTo("body");
2427
- logMsg("Creating marker: %o", this.$dndMarker);
2460
+ // logMsg("Creating marker: %o", this.$dndMarker);
2428
2461
  }
2429
2462
  /*
2430
2463
  if(hitMode === "start"){
@@ -2520,9 +2553,9 @@ TODO: better?
2520
2553
  * _onDragEvent("leave", targetNode, sourceNode, event, ui, draggable);
2521
2554
  * _onDragEvent("stop", sourceNode, null, event, ui, draggable);
2522
2555
  */
2523
- if(eventName !== "over"){
2524
- this.logDebug("tree._onDragEvent(%s, %o, %o) - %o", eventName, node, otherNode, this);
2525
- }
2556
+ // if(eventName !== "over"){
2557
+ // this.logDebug("tree._onDragEvent(%s, %o, %o) - %o", eventName, node, otherNode, this);
2558
+ // }
2526
2559
  var opts = this.options;
2527
2560
  var dnd = this.options.dnd;
2528
2561
  var res = null;
@@ -2536,7 +2569,7 @@ TODO: better?
2536
2569
  .append($(event.target).closest('a').clone());
2537
2570
  // Attach node reference to helper object
2538
2571
  helper.data("dtSourceNode", node);
2539
- this.logDebug("helper.sourceNode=%o", helper.data("dtSourceNode"));
2572
+ // this.logDebug("helper.sourceNode=%o", helper.data("dtSourceNode"));
2540
2573
  res = helper;
2541
2574
  break;
2542
2575
  case "start":
@@ -2563,7 +2596,7 @@ TODO: better?
2563
2596
  after: (res !== false) && ((res === true) || (res === "after") || $.inArray("after", res) >= 0)
2564
2597
  };
2565
2598
  ui.helper.data("enterResponse", res);
2566
- this.logDebug("helper.enterResponse: %o", res);
2599
+ // this.logDebug("helper.enterResponse: %o", res);
2567
2600
  break;
2568
2601
  case "over":
2569
2602
  var enterResponse = ui.helper.data("enterResponse");
@@ -2606,40 +2639,23 @@ TODO: better?
2606
2639
  // TODO: these are no-ops when moving nodes, but not in copy mode
2607
2640
  if( dnd.preventVoidMoves ){
2608
2641
  if(node === otherNode){
2609
- this.logDebug(" drop over source node prevented");
2642
+ // this.logDebug(" drop over source node prevented");
2610
2643
  hitMode = null;
2611
2644
  }else if(hitMode === "before" && otherNode && node === otherNode.getNextSibling()){
2612
- this.logDebug(" drop after source node prevented");
2645
+ // this.logDebug(" drop after source node prevented");
2613
2646
  hitMode = null;
2614
2647
  }else if(hitMode === "after" && otherNode && node === otherNode.getPrevSibling()){
2615
- this.logDebug(" drop before source node prevented");
2648
+ // this.logDebug(" drop before source node prevented");
2616
2649
  hitMode = null;
2617
2650
  }else if(hitMode === "over" && otherNode
2618
2651
  && otherNode.parent === node && otherNode.isLastSibling() ){
2619
- this.logDebug(" drop last child over own parent prevented");
2652
+ // this.logDebug(" drop last child over own parent prevented");
2620
2653
  hitMode = null;
2621
2654
  }
2622
2655
  }
2623
- this.logDebug("hitMode: %s - %s - %s", hitMode, (node.parent === otherNode), node.isLastSibling());
2656
+ // this.logDebug("hitMode: %s - %s - %s", hitMode, (node.parent === otherNode), node.isLastSibling());
2624
2657
  ui.helper.data("hitMode", hitMode);
2625
- /*
2626
- logMsg(" clientPos: %s/%s", event.clientX, event.clientY);
2627
- logMsg(" clientPos: %s/%s", event.pageX, event.pageY);
2628
- logMsg(" nodeOfs: %s/%s", nodeOfs.left, nodeOfs.top);
2629
- logMsg(" relPos: %s/%s", relPos.x, relPos.y);
2630
- logMsg(" relPos2: %s/%s: %s", relPos2.x, relPos2.y, hitMode);
2631
- logMsg(" e:%o", event);
2632
- */
2633
2658
  }
2634
- /* var checkPos = function(node, pos) {
2635
- var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
2636
- var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
2637
- var itemHeight = o.height, itemWidth = o.width;
2638
- var itemTop = o.top, itemLeft = o.left;
2639
-
2640
- return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
2641
- };
2642
- var relPos = event.()*/
2643
2659
  // Auto-expand node (only when 'over' the node, not 'before', or 'after')
2644
2660
  if(hitMode === "over"
2645
2661
  && dnd.autoExpandMS && node.hasChildren() !== false && !node.bExpanded) {
@@ -2651,10 +2667,7 @@ TODO: better?
2651
2667
  this._setDndStatus(otherNode, node, ui.helper, hitMode, res!==false);
2652
2668
  break;
2653
2669
  case "drop":
2654
- // var enterResponse = ui.helper.data("enterResponse");
2655
2670
  hitMode = ui.helper.data("hitMode");
2656
- // if(dnd.onDrop && enterResponse !== false)
2657
- // dnd.onDrop(node, otherNode, hitMode)
2658
2671
  if(hitMode && dnd.onDrop){
2659
2672
  dnd.onDrop(node, otherNode, hitMode, ui, draggable);
2660
2673
  }
@@ -2664,7 +2677,6 @@ TODO: better?
2664
2677
  node.scheduleAction("cancel");
2665
2678
  ui.helper.data("enterResponse", null);
2666
2679
  ui.helper.data("hitMode", null);
2667
- // nodeTag.removeClass("dynatree-drop-hover dynatree-drop-accept dynatree-drop-reject");
2668
2680
  this._setDndStatus(otherNode, node, ui.helper, "out", undefined);
2669
2681
  if(dnd.onDragLeave){
2670
2682
  dnd.onDragLeave(node, otherNode);
@@ -2890,6 +2902,8 @@ $.ui.dynatree.prototype.options = {
2890
2902
  onSelect: null, // Callback(flag, dtnode) when a node is (de)selected.
2891
2903
  onExpand: null, // Callback(dtnode) when a node is expanded/collapsed.
2892
2904
  onLazyRead: null, // Callback(dtnode) when a lazy node is expanded for the first time.
2905
+ onCustomRender: null, // Callback(dtnode) before a node is rendered. Return a HTML string to override.
2906
+ onRender: null, // Callback(dtnode, nodeSpan) after a node was rendered.
2893
2907
 
2894
2908
  // Drag'n'drop support
2895
2909
  dnd: {
@@ -3044,22 +3058,12 @@ var _registerDnd = function() {
3044
3058
  start: function(event, ui) {
3045
3059
  var draggable = $(this).data("draggable");
3046
3060
  var sourceNode = ui.helper.data("dtSourceNode") || null;
3047
- logMsg("draggable-connectToDynatree.start, %s", sourceNode);
3048
- logMsg(" this: %o", this);
3049
- logMsg(" event: %o", event);
3050
- logMsg(" draggable: %o", draggable);
3051
- logMsg(" ui: %o", ui);
3061
+ // logMsg("draggable-connectToDynatree.start, %s", sourceNode);
3062
+ // logMsg(" this: %o", this);
3063
+ // logMsg(" event: %o", event);
3064
+ // logMsg(" draggable: %o", draggable);
3065
+ // logMsg(" ui: %o", ui);
3052
3066
  if(sourceNode) {
3053
- // Adjust helper offset for tree nodes
3054
- /*
3055
- var sourcePosition = $(sourceNode.span).position();
3056
- var cssPosition = $(ui.helper).position();
3057
- logMsg(" draggable.offset.click: %s/%s", draggable.offset.click.left, draggable.offset.click.top);
3058
- logMsg(" sourceNode.position: %s/%s", sourcePosition.left, sourcePosition.top);
3059
- logMsg(" helper.position: %s/%s", cssPosition.left, cssPosition.top);
3060
- logMsg(" event.target.offset: %s/%s, %sx%s", event.target.offsetLeft, event.target.offsetTop, event.target.offsetWidth, event.target.offsetHeight);
3061
- logMsg(" draggable.positionAbs: %s/%s", draggable.positionAbs.left, draggable.positionAbs.top);
3062
- */
3063
3067
  // Adjust helper offset, so cursor is slightly outside top/left corner
3064
3068
  // draggable.offset.click.top -= event.target.offsetTop;
3065
3069
  // draggable.offset.click.left -= event.target.offsetLeft;
@@ -3083,7 +3087,7 @@ var _registerDnd = function() {
3083
3087
  // jumped over the drag helper, in which case we ignore it:
3084
3088
  var isHelper = $(event.target).closest("div.dynatree-drag-helper,#dynatree-drop-marker").length > 0;
3085
3089
  if(isHelper){
3086
- logMsg("Drag event over helper: ignored.");
3090
+ // logMsg("Drag event over helper: ignored.");
3087
3091
  return;
3088
3092
  }
3089
3093
  }
@@ -3110,16 +3114,13 @@ var _registerDnd = function() {
3110
3114
  stop: function(event, ui) {
3111
3115
  var draggable = $(this).data("draggable");
3112
3116
  var sourceNode = ui.helper.data("dtSourceNode") || null;
3113
- // var targetNode = getDtNodeFromElement(event.target);
3114
3117
  var targetNode = ui.helper.data("dtTargetNode") || null;
3115
- logMsg("draggable-connectToDynatree.stop: targetNode(from event): %s, dtTargetNode: %s", targetNode, ui.helper.data("dtTargetNode"));
3116
- // var targetTree = targetNode ? targetNode.tree : null;
3117
- // if(dtnode && dtnode.tree.
3118
- logMsg("draggable-connectToDynatree.stop, %s", sourceNode);
3118
+ // logMsg("draggable-connectToDynatree.stop: targetNode(from event): %s, dtTargetNode: %s", targetNode, ui.helper.data("dtTargetNode"));
3119
+ // logMsg("draggable-connectToDynatree.stop, %s", sourceNode);
3119
3120
  var mouseDownEvent = draggable._mouseDownEvent;
3120
3121
  var eventType = event.type;
3121
- logMsg(" type: %o, downEvent: %o, upEvent: %o", eventType, mouseDownEvent, event);
3122
- logMsg(" targetNode: %o", targetNode);
3122
+ // logMsg(" type: %o, downEvent: %o, upEvent: %o", eventType, mouseDownEvent, event);
3123
+ // logMsg(" targetNode: %o", targetNode);
3123
3124
  var dropped = (eventType == "mouseup" && event.which == 1);
3124
3125
  if(!dropped){
3125
3126
  logMsg("Drag was cancelled");