mongo3 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/.bnignore +3 -0
  2. data/.bnsignore +16 -0
  3. data/.gitignore +1 -0
  4. data/HISTORY +11 -1
  5. data/README.rdoc +2 -0
  6. data/bin/mongo3 +7 -6
  7. data/config/mongo3.yml +33 -0
  8. data/data/populate +37 -0
  9. data/lib/controllers/collections.rb +2 -10
  10. data/lib/controllers/databases.rb +12 -1
  11. data/lib/controllers/explore.rb +20 -6
  12. data/lib/helpers/collection_helper.rb +34 -2
  13. data/lib/helpers/explore_helper.rb +0 -5
  14. data/lib/helpers/main_helper.rb +5 -0
  15. data/lib/helpers/paths_helper.rb +15 -0
  16. data/lib/mongo3/connection.rb +39 -24
  17. data/lib/mongo3/user.rb +10 -4
  18. data/lib/mongo3/zone.rb +24 -8
  19. data/lib/mongo3.rb +4 -7
  20. data/lib/public/.DS_Store +0 -0
  21. data/lib/public/images/favicon.png +0 -0
  22. data/lib/public/images/information.png +0 -0
  23. data/lib/public/images/tree/Thumbs.db +0 -0
  24. data/lib/public/images/tree/array.png +0 -0
  25. data/lib/public/images/tree/arrow_refresh.png +0 -0
  26. data/lib/public/images/tree/collapsable-last.gif +0 -0
  27. data/lib/public/images/tree/collapsable.gif +0 -0
  28. data/lib/public/images/tree/collection.png +0 -0
  29. data/lib/public/images/tree/cross.png +0 -0
  30. data/lib/public/images/tree/disk.png +0 -0
  31. data/lib/public/images/tree/expandable-last.gif +0 -0
  32. data/lib/public/images/tree/expandable-last.png +0 -0
  33. data/lib/public/images/tree/expandable.gif +0 -0
  34. data/lib/public/images/tree/expandable.png +0 -0
  35. data/lib/public/images/tree/folder_add.png +0 -0
  36. data/lib/public/images/tree/folder_delete.png +0 -0
  37. data/lib/public/images/tree/folder_edit.png +0 -0
  38. data/lib/public/images/tree/icons.png +0 -0
  39. data/lib/public/images/tree/leaf-last.gif +0 -0
  40. data/lib/public/images/tree/leaf-last.png +0 -0
  41. data/lib/public/images/tree/leaf.gif +0 -0
  42. data/lib/public/images/tree/leaf.png +0 -0
  43. data/lib/public/images/tree/line_bg.gif +0 -0
  44. data/lib/public/images/tree/line_bg_over.gif +0 -0
  45. data/lib/public/images/tree/line_bg_over_last.gif +0 -0
  46. data/lib/public/images/tree/minus.gif +0 -0
  47. data/lib/public/images/tree/page_add.png +0 -0
  48. data/lib/public/images/tree/page_delete.png +0 -0
  49. data/lib/public/images/tree/page_edit.png +0 -0
  50. data/lib/public/images/tree/plus.gif +0 -0
  51. data/lib/public/images/tree/root.gif +0 -0
  52. data/lib/public/images/tree/spacer.gif +0 -0
  53. data/lib/public/images/tree/spinner.gif +0 -0
  54. data/lib/public/images/tree/tree_line.gif +0 -0
  55. data/lib/public/javascripts/.DS_Store +0 -0
  56. data/lib/public/javascripts/jquery.simple.tree.js +451 -0
  57. data/lib/public/javascripts/jquery.tiptip.min.js +6 -0
  58. data/lib/public/javascripts/jquery.tree.min.js +1 -0
  59. data/lib/public/javascripts/jstree/jquery.tree.js +2058 -0
  60. data/lib/public/javascripts/themes/mongo3/bg.jpg +0 -0
  61. data/lib/public/javascripts/themes/mongo3/dot_for_ie.gif +0 -0
  62. data/lib/public/javascripts/themes/mongo3/icons.png +0 -0
  63. data/lib/public/javascripts/themes/mongo3/style.css +39 -0
  64. data/lib/public/javascripts/themes/mongo3/throbber.gif +0 -0
  65. data/lib/public/stylesheets/mongo3.css +201 -65
  66. data/lib/views/collections/_fields_form.erb +1 -1
  67. data/lib/views/collections/_index_form.erb +1 -1
  68. data/lib/views/collections/_index_rows.erb +40 -15
  69. data/lib/views/collections/_nodes.erb +0 -0
  70. data/lib/views/collections/_results.erb +4 -4
  71. data/lib/views/collections/{_rows.erb → _rows_table.erb} +11 -9
  72. data/lib/views/collections/_rows_tree.erb +81 -0
  73. data/lib/views/collections/_search_form.erb +1 -1
  74. data/lib/views/collections/blee.erb +20 -0
  75. data/lib/views/collections/list.erb +1 -1
  76. data/lib/views/collections/update.js.erb +1 -1
  77. data/lib/views/databases/_results.erb +9 -7
  78. data/lib/views/explore/_node_info.erb +21 -4
  79. data/lib/views/explore/explore.erb +11 -1
  80. data/lib/views/explore/load_collection.js.erb +1 -0
  81. data/lib/views/explore/load_database.js.erb +1 -0
  82. data/lib/views/layout.erb +13 -7
  83. data/lib/views/users/_results.erb +2 -2
  84. data/spec/configs/crap.yml +20 -0
  85. data/spec/configs/hosed.yml +4 -0
  86. data/spec/configs/landscape.yml +9 -0
  87. data/spec/mongo3/connection_spec.rb +105 -12
  88. data/spec/mongo3/node_spec.rb +38 -0
  89. data/spec/mongo3/user_spec.rb +72 -0
  90. data/spec/mongo3/zone_spec.rb +69 -0
  91. data/spec/mongo3_spec.rb +20 -0
  92. data/spec/spec_helper.rb +13 -0
  93. data/tasks/setup.rb +1 -1
  94. metadata +71 -6
  95. data/spec/landscape.yml +0 -3
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,451 @@
1
+ /*
2
+ * jQuery SimpleTree Drag&Drop plugin
3
+ * Update on 22th May 2008
4
+ * Version 0.3
5
+ *
6
+ * Licensed under BSD <http://en.wikipedia.org/wiki/BSD_License>
7
+ * Copyright (c) 2008, Peter Panov <panov@elcat.kg>, IKEEN Group http://www.ikeen.com
8
+ * All rights reserved.
9
+ *
10
+ * Redistribution and use in source and binary forms, with or without
11
+ * modification, are permitted provided that the following conditions are met:
12
+ * * Redistributions of source code must retain the above copyright
13
+ * notice, this list of conditions and the following disclaimer.
14
+ * * Redistributions in binary form must reproduce the above copyright
15
+ * notice, this list of conditions and the following disclaimer in the
16
+ * documentation and/or other materials provided with the distribution.
17
+ * * Neither the name of the Peter Panov, IKEEN Group nor the
18
+ * names of its contributors may be used to endorse or promote products
19
+ * derived from this software without specific prior written permission.
20
+ *
21
+ * THIS SOFTWARE IS PROVIDED BY Peter Panov, IKEEN Group ``AS IS'' AND ANY
22
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24
+ * DISCLAIMED. IN NO EVENT SHALL Peter Panov, IKEEN Group BE LIABLE FOR ANY
25
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+
34
+ $.fn.simpleTree = function(opt){
35
+ return this.each(function(){
36
+ var TREE = this;
37
+ var ROOT = $('.root',this);
38
+ var mousePressed = false;
39
+ var mouseMoved = false;
40
+ var dragMoveType = false;
41
+ var dragNode_destination = false;
42
+ var dragNode_source = false;
43
+ var dragDropTimer = false;
44
+ var ajaxCache = Array();
45
+
46
+ TREE.option = {
47
+ drag: true,
48
+ animate: false,
49
+ autoclose: false,
50
+ speed: 'fast',
51
+ afterAjax: false,
52
+ afterMove: false,
53
+ afterClick: false,
54
+ afterDblClick: false,
55
+ // added by Erik Dohmen (2BinBusiness.nl) to make context menu cliks available
56
+ afterContextMenu: false,
57
+ docToFolderConvert:false
58
+ };
59
+ TREE.option = $.extend(TREE.option,opt);
60
+ $.extend(this, {getSelected: function(){
61
+ return $('span.active', this).parent();
62
+ }});
63
+ TREE.closeNearby = function(obj)
64
+ {
65
+ $(obj).siblings().filter('.folder-open, .folder-open-last').each(function(){
66
+ var childUl = $('>ul',this);
67
+ var className = this.className;
68
+ this.className = className.replace('open','close');
69
+ if(TREE.option.animate)
70
+ {
71
+ childUl.animate({height:"toggle"},TREE.option.speed);
72
+ }else{
73
+ childUl.hide();
74
+ }
75
+ });
76
+ };
77
+ TREE.nodeToggle = function(obj)
78
+ {
79
+ var childUl = $('>ul',obj);
80
+ if(childUl.is(':visible')){
81
+ obj.className = obj.className.replace('open','close');
82
+
83
+ if(TREE.option.animate)
84
+ {
85
+ childUl.animate({height:"toggle"},TREE.option.speed);
86
+ }else{
87
+ childUl.hide();
88
+ }
89
+ }else{
90
+ obj.className = obj.className.replace('close','open');
91
+ if(TREE.option.animate)
92
+ {
93
+ childUl.animate({height:"toggle"},TREE.option.speed, function(){
94
+ if(TREE.option.autoclose)TREE.closeNearby(obj);
95
+ if(childUl.is('.ajax'))TREE.setAjaxNodes(childUl, obj.id);
96
+ });
97
+ }else{
98
+ childUl.show();
99
+ if(TREE.option.autoclose)TREE.closeNearby(obj);
100
+ if(childUl.is('.ajax'))TREE.setAjaxNodes(childUl, obj.id);
101
+ }
102
+ }
103
+ };
104
+ TREE.setAjaxNodes = function(node, parentId, callback)
105
+ {
106
+ if($.inArray(parentId,ajaxCache) == -1){
107
+ ajaxCache[ajaxCache.length]=parentId;
108
+ var url = $.trim($('>li', node).text());
109
+ if(url && url.indexOf('url:'))
110
+ {
111
+ url=$.trim(url.replace(/.*\{url:(.*)\}/i ,'$1'));
112
+ $.ajax({
113
+ type: "GET",
114
+ url: url,
115
+ contentType:'html',
116
+ cache:false,
117
+ success: function(responce){
118
+ node.removeAttr('class');
119
+ node.html(responce);
120
+ $.extend(node,{url:url});
121
+ TREE.setTreeNodes(node, true);
122
+ if(typeof TREE.option.afterAjax == 'function')
123
+ {
124
+ TREE.option.afterAjax(node);
125
+ }
126
+ if(typeof callback == 'function')
127
+ {
128
+ callback(node);
129
+ }
130
+ }
131
+ });
132
+ }
133
+
134
+ }
135
+ };
136
+ TREE.setTreeNodes = function(obj, useParent){
137
+ obj = useParent? obj.parent():obj;
138
+ $('li>span', obj).addClass('text')
139
+ .bind('selectstart', function() {
140
+ return false;
141
+ }).click(function(){
142
+ $('.active',TREE).attr('class','text');
143
+ if(this.className=='text')
144
+ {
145
+ this.className='active';
146
+ }
147
+ if(typeof TREE.option.afterClick == 'function')
148
+ {
149
+ TREE.option.afterClick($(this).parent());
150
+ }
151
+ return false;
152
+ }).dblclick(function(){
153
+ mousePressed = false;
154
+ TREE.nodeToggle($(this).parent().get(0));
155
+ if(typeof TREE.option.afterDblClick == 'function')
156
+ {
157
+ TREE.option.afterDblClick($(this).parent());
158
+ }
159
+ return false;
160
+ // added by Erik Dohmen (2BinBusiness.nl) to make context menu actions
161
+ // available
162
+ }).bind("contextmenu",function(){
163
+ $('.active',TREE).attr('class','text');
164
+ if(this.className=='text')
165
+ {
166
+ this.className='active';
167
+ }
168
+ if(typeof TREE.option.afterContextMenu == 'function')
169
+ {
170
+ TREE.option.afterContextMenu($(this).parent());
171
+ }
172
+ return false;
173
+ }).mousedown(function(event){
174
+ mousePressed = true;
175
+ cloneNode = $(this).parent().clone();
176
+ var LI = $(this).parent();
177
+ if(TREE.option.drag)
178
+ {
179
+ $('>ul', cloneNode).hide();
180
+ $('body').append('<div id="drag_container"><ul></ul></div>');
181
+ $('#drag_container').hide().css({opacity:'0.8'});
182
+ $('#drag_container >ul').append(cloneNode);
183
+ $("<img>").attr({id : "tree_plus",src : "images/plus.gif"}).css({width: "7px",display: "block",position: "absolute",left : "5px",top: "5px", display:'none'}).appendTo("body");
184
+ $(document).bind("mousemove", {LI:LI}, TREE.dragStart).bind("mouseup",TREE.dragEnd);
185
+ }
186
+ return false;
187
+ }).mouseup(function(){
188
+ if(mousePressed && mouseMoved && dragNode_source)
189
+ {
190
+ TREE.moveNodeToFolder($(this).parent());
191
+ }
192
+ TREE.eventDestroy();
193
+ });
194
+ $('li', obj).each(function(i){
195
+ var className = this.className;
196
+ var open = false;
197
+ var cloneNode=false;
198
+ var LI = this;
199
+ var childNode = $('>ul',this);
200
+ if(childNode.size()>0){
201
+ var setClassName = 'folder-';
202
+ if(className && className.indexOf('open')>=0){
203
+ setClassName=setClassName+'open';
204
+ open=true;
205
+ }else{
206
+ setClassName=setClassName+'close';
207
+ }
208
+ this.className = setClassName + ($(this).is(':last-child')? '-last':'');
209
+
210
+ if(!open || className.indexOf('ajax')>=0)childNode.hide();
211
+
212
+ TREE.setTrigger(this);
213
+ }else{
214
+ var setClassName = 'doc';
215
+ this.className = setClassName + ($(this).is(':last-child')? '-last':'');
216
+ }
217
+ }).before('<li class="line">&nbsp;</li>')
218
+ .filter(':last-child').after('<li class="line-last"></li>');
219
+ TREE.setEventLine($('.line, .line-last', obj));
220
+ };
221
+ TREE.setTrigger = function(node){
222
+ $('>span',node).before('<img class="trigger" src="images/spacer.gif" border=0>');
223
+ var trigger = $('>.trigger', node);
224
+ trigger.click(function(event){
225
+ TREE.nodeToggle(node);
226
+ });
227
+ if(!$.browser.msie)
228
+ {
229
+ trigger.css('float','left');
230
+ }
231
+ };
232
+ TREE.dragStart = function(event){
233
+ var LI = $(event.data.LI);
234
+ if(mousePressed)
235
+ {
236
+ mouseMoved = true;
237
+ if(dragDropTimer) clearTimeout(dragDropTimer);
238
+ if($('#drag_container:not(:visible)')){
239
+ $('#drag_container').show();
240
+ LI.prev('.line').hide();
241
+ dragNode_source = LI;
242
+ }
243
+ $('#drag_container').css({position:'absolute', "left" : (event.pageX + 5), "top": (event.pageY + 15) });
244
+ if(LI.is(':visible'))LI.hide();
245
+ var temp_move = false;
246
+ if(event.target.tagName.toLowerCase()=='span' && $.inArray(event.target.className, Array('text','active','trigger'))!= -1)
247
+ {
248
+ var parent = event.target.parentNode;
249
+ var offs = $(parent).offset({scroll:false});
250
+ var screenScroll = {x : (offs.left - 3),y : event.pageY - offs.top};
251
+ var isrc = $("#tree_plus").attr('src');
252
+ var ajaxChildSize = $('>ul.ajax',parent).size();
253
+ var ajaxChild = $('>ul.ajax',parent);
254
+ screenScroll.x += 19;
255
+ screenScroll.y = event.pageY - screenScroll.y + 5;
256
+
257
+ if(parent.className.indexOf('folder-close')>=0 && ajaxChildSize==0)
258
+ {
259
+ if(isrc.indexOf('minus')!=-1)$("#tree_plus").attr('src','images/plus.gif');
260
+ $("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
261
+ dragDropTimer = setTimeout(function(){
262
+ parent.className = parent.className.replace('close','open');
263
+ $('>ul',parent).show();
264
+ }, 700);
265
+ }else if(parent.className.indexOf('folder')>=0 && ajaxChildSize==0){
266
+ if(isrc.indexOf('minus')!=-1)$("#tree_plus").attr('src','images/plus.gif');
267
+ $("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
268
+ }else if(parent.className.indexOf('folder-close')>=0 && ajaxChildSize>0)
269
+ {
270
+ mouseMoved = false;
271
+ $("#tree_plus").attr('src','images/minus.gif');
272
+ $("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
273
+
274
+ $('>ul',parent).show();
275
+ /*
276
+ Thanks for the idea of Erik Dohmen
277
+ */
278
+ TREE.setAjaxNodes(ajaxChild,parent.id, function(){
279
+ parent.className = parent.className.replace('close','open');
280
+ mouseMoved = true;
281
+ $("#tree_plus").attr('src','images/plus.gif');
282
+ $("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
283
+ });
284
+
285
+ }else{
286
+ if(TREE.option.docToFolderConvert)
287
+ {
288
+ $("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
289
+ }else{
290
+ $("#tree_plus").hide();
291
+ }
292
+ }
293
+ }else{
294
+ $("#tree_plus").hide();
295
+ }
296
+ return false;
297
+ }
298
+ return true;
299
+ };
300
+ TREE.dragEnd = function(){
301
+ if(dragDropTimer) clearTimeout(dragDropTimer);
302
+ TREE.eventDestroy();
303
+ };
304
+ TREE.setEventLine = function(obj){
305
+ obj.mouseover(function(){
306
+ if(this.className.indexOf('over')<0 && mousePressed && mouseMoved)
307
+ {
308
+ this.className = this.className.replace('line','line-over');
309
+ }
310
+ }).mouseout(function(){
311
+ if(this.className.indexOf('over')>=0)
312
+ {
313
+ this.className = this.className.replace('-over','');
314
+ }
315
+ }).mouseup(function(){
316
+ if(mousePressed && dragNode_source && mouseMoved)
317
+ {
318
+ dragNode_destination = $(this).parents('li:first');
319
+ TREE.moveNodeToLine(this);
320
+ TREE.eventDestroy();
321
+ }
322
+ });
323
+ };
324
+ TREE.checkNodeIsLast = function(node)
325
+ {
326
+ if(node.className.indexOf('last')>=0)
327
+ {
328
+ var prev_source = dragNode_source.prev().prev();
329
+ if(prev_source.size()>0)
330
+ {
331
+ prev_source[0].className+='-last';
332
+ }
333
+ node.className = node.className.replace('-last','');
334
+ }
335
+ };
336
+ TREE.checkLineIsLast = function(line)
337
+ {
338
+ if(line.className.indexOf('last')>=0)
339
+ {
340
+ var prev = $(line).prev();
341
+ if(prev.size()>0)
342
+ {
343
+ prev[0].className = prev[0].className.replace('-last','');
344
+ }
345
+ dragNode_source[0].className+='-last';
346
+ }
347
+ };
348
+ TREE.eventDestroy = function()
349
+ {
350
+ // added by Erik Dohmen (2BinBusiness.nl), the unbind mousemove TREE.dragStart action
351
+ // like this other mousemove actions binded through other actions ain't removed (use it myself
352
+ // to determine location for context menu)
353
+ $(document).unbind('mousemove',TREE.dragStart).unbind('mouseup').unbind('mousedown');
354
+ $('#drag_container, #tree_plus').remove();
355
+ if(dragNode_source)
356
+ {
357
+ $(dragNode_source).show().prev('.line').show();
358
+ }
359
+ dragNode_destination = dragNode_source = mousePressed = mouseMoved = false;
360
+ //ajaxCache = Array();
361
+ };
362
+ TREE.convertToFolder = function(node){
363
+ node[0].className = node[0].className.replace('doc','folder-open');
364
+ node.append('<ul><li class="line-last"></li></ul>');
365
+ TREE.setTrigger(node[0]);
366
+ TREE.setEventLine($('.line, .line-last', node));
367
+ };
368
+ TREE.convertToDoc = function(node){
369
+ $('>ul', node).remove();
370
+ $('img', node).remove();
371
+ node[0].className = node[0].className.replace(/folder-(open|close)/gi , 'doc');
372
+ };
373
+ TREE.moveNodeToFolder = function(node)
374
+ {
375
+ if(!TREE.option.docToFolderConvert && node[0].className.indexOf('doc')!=-1)
376
+ {
377
+ return true;
378
+ }else if(TREE.option.docToFolderConvert && node[0].className.indexOf('doc')!=-1){
379
+ TREE.convertToFolder(node);
380
+ }
381
+ TREE.checkNodeIsLast(dragNode_source[0]);
382
+ var lastLine = $('>ul >.line-last', node);
383
+ if(lastLine.size()>0)
384
+ {
385
+ TREE.moveNodeToLine(lastLine[0]);
386
+ }
387
+ };
388
+ TREE.moveNodeToLine = function(node){
389
+ TREE.checkNodeIsLast(dragNode_source[0]);
390
+ TREE.checkLineIsLast(node);
391
+ var parent = $(dragNode_source).parents('li:first');
392
+ var line = $(dragNode_source).prev('.line');
393
+ $(node).before(dragNode_source);
394
+ $(dragNode_source).before(line);
395
+ node.className = node.className.replace('-over','');
396
+ var nodeSize = $('>ul >li', parent).not('.line, .line-last').filter(':visible').size();
397
+ if(TREE.option.docToFolderConvert && nodeSize==0)
398
+ {
399
+ TREE.convertToDoc(parent);
400
+ }else if(nodeSize==0)
401
+ {
402
+ parent[0].className=parent[0].className.replace('open','close');
403
+ $('>ul',parent).hide();
404
+ }
405
+
406
+ // added by Erik Dohmen (2BinBusiness.nl) select node
407
+ if($('span:first',dragNode_source).attr('class')=='text')
408
+ {
409
+ $('.active',TREE).attr('class','text');
410
+ $('span:first',dragNode_source).attr('class','active');
411
+ }
412
+
413
+ if(typeof(TREE.option.afterMove) == 'function')
414
+ {
415
+ var pos = $(dragNode_source).prevAll(':not(.line)').size();
416
+ TREE.option.afterMove($(node).parents('li:first'), $(dragNode_source), pos);
417
+ }
418
+ };
419
+
420
+ TREE.addNode = function(id, text, callback)
421
+ {
422
+ var temp_node = $('<li><ul><li id="'+id+'"><span>'+text+'</span></li></ul></li>');
423
+ TREE.setTreeNodes(temp_node);
424
+ dragNode_destination = TREE.getSelected();
425
+ dragNode_source = $('.doc-last',temp_node);
426
+ TREE.moveNodeToFolder(dragNode_destination);
427
+ temp_node.remove();
428
+ if(typeof(callback) == 'function')
429
+ {
430
+ callback(dragNode_destination, dragNode_source);
431
+ }
432
+ };
433
+ TREE.delNode = function(callback)
434
+ {
435
+ dragNode_source = TREE.getSelected();
436
+ TREE.checkNodeIsLast(dragNode_source[0]);
437
+ dragNode_source.prev().remove();
438
+ dragNode_source.remove();
439
+ if(typeof(callback) == 'function')
440
+ {
441
+ callback(dragNode_destination);
442
+ }
443
+ };
444
+
445
+ TREE.init = function(obj)
446
+ {
447
+ TREE.setTreeNodes(obj, false);
448
+ };
449
+ TREE.init(ROOT);
450
+ });
451
+ }
@@ -0,0 +1,6 @@
1
+ (function($){$.fn.tipTip=function(options){var defaults={maxWidth:"200px",edgeOffset:3,delay:400,fadeIn:200,fadeOut:200,enter:function(){},exit:function(){}};var opts=$.extend(defaults,options);if($("#tiptip_holder").length<=0){var tiptip_holder=$('<div id="tiptip_holder" style="max-width:'+opts.maxWidth+';"></div>');var tiptip_content=$('<div id="tiptip_content"></div>');var tiptip_arrow=$('<div id="tiptip_arrow"></div>');$("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')));}else{var tiptip_holder=$("#tiptip_holder");var tiptip_content=$("#tiptip_content");var tiptip_arrow=$("#tiptip_arrow");}
2
+ return this.each(function(){var org_elem=$(this);var org_title=org_elem.attr("title");if(org_title!=""){org_elem.removeAttr("title");var timeout=false;org_elem.hover(function(){opts.enter.call(this);tiptip_content.text(org_title);tiptip_holder.hide().removeAttr("class").css("margin","0");tiptip_arrow.removeAttr("style");var top=parseInt(org_elem.offset()['top']);var left=parseInt(org_elem.offset()['left']);var org_width=parseInt(org_elem.outerWidth());var org_height=parseInt(org_elem.outerHeight());var tip_w=tiptip_holder.outerWidth();var tip_h=tiptip_holder.outerHeight();var w_compare=Math.round((org_width-tip_w)/2);var h_compare=Math.round((org_height-tip_h)/2);var marg_left=Math.round(left+w_compare);var marg_top=Math.round(top+org_height+opts.edgeOffset);var t_class="";var arrow_top="";var arrow_left=Math.round(tip_w-12)/2;if(w_compare<0){if((w_compare+left)<parseInt($(window).scrollLeft())){t_class="_right";arrow_top=Math.round(tip_h-13)/2;arrow_left=-12;marg_left=Math.round(left+org_width+opts.edgeOffset);marg_top=Math.round(top+h_compare);}else if((tip_w+left)>parseInt($(window).width())){t_class="_left";arrow_top=Math.round(tip_h-13)/2;arrow_left=Math.round(tip_w-5);marg_left=Math.round(left-(tip_w+opts.edgeOffset));marg_top=Math.round(top+h_compare);}}
3
+ if((top+org_height+opts.edgeOffset+tip_h+8)>parseInt($(window).height()+$(window).scrollTop())){t_class=t_class+"_top";arrow_top=tip_h;marg_top=Math.round(top-(tip_h+5+opts.edgeOffset));}else if(((top+org_height)-(opts.edgeOffset+tip_h))<0||t_class==""){t_class=t_class+"_bottom";arrow_top=-12;marg_top=Math.round(top+org_height+opts.edgeOffset);}
4
+ if(t_class=="_right_top"||t_class=="_left_top"){marg_top=marg_top+5;}else if(t_class=="_right_bottom"||t_class=="_left_bottom"){marg_top=marg_top-5;}
5
+ tiptip_arrow.css({"margin-left":arrow_left+"px","margin-top":arrow_top+"px"});tiptip_holder.css({"margin-left":marg_left+"px","margin-top":marg_top+"px"}).attr("class","tip"+t_class);if(timeout){clearTimeout(timeout);}
6
+ timeout=setTimeout(function(){tiptip_holder.stop(true,true).fadeIn(opts.fadeIn);},opts.delay);},function(){opts.exit.call(this);if(timeout){clearTimeout(timeout);}tiptip_holder.fadeOut(opts.fadeOut);});}});}})(jQuery);