svn_wc_tree 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/ChangeLog +4 -0
  2. data/LICENSE +165 -0
  3. data/Manifest +57 -0
  4. data/README.rdoc +333 -0
  5. data/bin/svn_wc_tree +190 -0
  6. data/cgi/svn_wc_broker.cgi +38 -0
  7. data/lib/svn_wc_broker.rb +161 -0
  8. data/lib/svn_wc_client.rb +266 -0
  9. data/svn_conf.yaml +9 -0
  10. data/svn_wc_tree/css/swt.css +4 -0
  11. data/svn_wc_tree/img/swt_spinner.gif +0 -0
  12. data/svn_wc_tree/index.html +137 -0
  13. data/svn_wc_tree/index.php +29 -0
  14. data/svn_wc_tree/js/jquery-1.3.2.js +4376 -0
  15. data/svn_wc_tree/js/jquery.blockUI-2.31.js +477 -0
  16. data/svn_wc_tree/js/jquery.cookie.js +96 -0
  17. data/svn_wc_tree/js/jquery.tree.checkbox.js +75 -0
  18. data/svn_wc_tree/js/jquery.tree.js +2058 -0
  19. data/svn_wc_tree/js/source/jquery.tree.js +2058 -0
  20. data/svn_wc_tree/js/source/jquery.tree.min.js +1 -0
  21. data/svn_wc_tree/js/source/lib/jquery.cookie.js +96 -0
  22. data/svn_wc_tree/js/source/lib/jquery.hotkeys.js +244 -0
  23. data/svn_wc_tree/js/source/lib/jquery.js +19 -0
  24. data/svn_wc_tree/js/source/lib/jquery.metadata.js +122 -0
  25. data/svn_wc_tree/js/source/lib/sarissa.js +110 -0
  26. data/svn_wc_tree/js/source/plugins/_jquery.tree.rtl.js +32 -0
  27. data/svn_wc_tree/js/source/plugins/jquery.tree.checkbox.js +75 -0
  28. data/svn_wc_tree/js/source/plugins/jquery.tree.contextmenu.js +129 -0
  29. data/svn_wc_tree/js/source/plugins/jquery.tree.cookie.js +70 -0
  30. data/svn_wc_tree/js/source/plugins/jquery.tree.hotkeys.js +78 -0
  31. data/svn_wc_tree/js/source/plugins/jquery.tree.metadata.js +17 -0
  32. data/svn_wc_tree/js/source/plugins/jquery.tree.themeroller.js +33 -0
  33. data/svn_wc_tree/js/source/plugins/jquery.tree.xml_flat.js +123 -0
  34. data/svn_wc_tree/js/source/plugins/jquery.tree.xml_nested.js +124 -0
  35. data/svn_wc_tree/js/source/themes/apple/bg.jpg +0 -0
  36. data/svn_wc_tree/js/source/themes/apple/dot_for_ie.gif +0 -0
  37. data/svn_wc_tree/js/source/themes/apple/icons.png +0 -0
  38. data/svn_wc_tree/js/source/themes/apple/style.css +34 -0
  39. data/svn_wc_tree/js/source/themes/apple/throbber.gif +0 -0
  40. data/svn_wc_tree/js/source/themes/checkbox/dot_for_ie.gif +0 -0
  41. data/svn_wc_tree/js/source/themes/checkbox/icons.png +0 -0
  42. data/svn_wc_tree/js/source/themes/checkbox/style.css +38 -0
  43. data/svn_wc_tree/js/source/themes/checkbox/throbber.gif +0 -0
  44. data/svn_wc_tree/js/source/themes/classic/dot_for_ie.gif +0 -0
  45. data/svn_wc_tree/js/source/themes/classic/icons.png +0 -0
  46. data/svn_wc_tree/js/source/themes/classic/style.css +31 -0
  47. data/svn_wc_tree/js/source/themes/classic/throbber.gif +0 -0
  48. data/svn_wc_tree/js/source/themes/default/dot_for_ie.gif +0 -0
  49. data/svn_wc_tree/js/source/themes/default/icons.png +0 -0
  50. data/svn_wc_tree/js/source/themes/default/style.css +30 -0
  51. data/svn_wc_tree/js/source/themes/default/throbber.gif +0 -0
  52. data/svn_wc_tree/js/source/themes/themeroller/dot_for_ie.gif +0 -0
  53. data/svn_wc_tree/js/source/themes/themeroller/icons.png +0 -0
  54. data/svn_wc_tree/js/source/themes/themeroller/style.css +39 -0
  55. data/svn_wc_tree/js/source/themes/themeroller/throbber.gif +0 -0
  56. data/svn_wc_tree/js/swt.js +534 -0
  57. data/svn_wc_tree.conf +9 -0
  58. metadata +122 -0
@@ -0,0 +1,129 @@
1
+ (function ($) {
2
+ $.extend($.tree.plugins, {
3
+ "contextmenu" : {
4
+ object : $("<ul id='jstree-contextmenu' class='tree-context' />"),
5
+ data : {
6
+ t : false,
7
+ a : false,
8
+ r : false
9
+ },
10
+
11
+ defaults : {
12
+ class_name : "hover",
13
+ items : {
14
+ create : {
15
+ label : "Create",
16
+ icon : "create",
17
+ visible : function (NODE, TREE_OBJ) { if(NODE.length != 1) return 0; return TREE_OBJ.check("creatable", NODE); },
18
+ action : function (NODE, TREE_OBJ) { TREE_OBJ.create(false, TREE_OBJ.get_node(NODE[0])); },
19
+ separator_after : true
20
+ },
21
+ rename : {
22
+ label : "Rename",
23
+ icon : "rename",
24
+ visible : function (NODE, TREE_OBJ) { if(NODE.length != 1) return false; return TREE_OBJ.check("renameable", NODE); },
25
+ action : function (NODE, TREE_OBJ) { TREE_OBJ.rename(NODE); }
26
+ },
27
+ remove : {
28
+ label : "Delete",
29
+ icon : "remove",
30
+ visible : function (NODE, TREE_OBJ) { var ok = true; $.each(NODE, function () { if(TREE_OBJ.check("deletable", this) == false) ok = false; return false; }); return ok; },
31
+ action : function (NODE, TREE_OBJ) { $.each(NODE, function () { TREE_OBJ.remove(this); }); }
32
+ }
33
+ }
34
+ },
35
+ show : function(obj, t) {
36
+ var opts = $.extend(true, {}, $.tree.plugins.contextmenu.defaults, t.settings.plugins.contextmenu);
37
+ obj = $(obj);
38
+ $.tree.plugins.contextmenu.object.empty();
39
+ var str = "";
40
+ var cnt = 0;
41
+ for(var i in opts.items) {
42
+ if(!opts.items.hasOwnProperty(i)) continue;
43
+ if(opts.items[i] === false) continue;
44
+ var r = 1;
45
+ if(typeof opts.items[i].visible == "function") r = opts.items[i].visible.call(null, $.tree.plugins.contextmenu.data.a, t);
46
+ if(r == -1) continue;
47
+ else cnt ++;
48
+ if(opts.items[i].separator_before === true) str += "<li class='separator'><span>&nbsp;</span></li>";
49
+ str += '<li><a href="#" rel="' + i + '" class="' + i + ' ' + (r == 0 ? 'disabled' : '') + '">';
50
+ if(opts.items[i].icon) str += "<ins " + (opts.items[i].icon.indexOf("/") == -1 ? " class='" + opts.items[i].icon + "' " : " style='background-image:url(\"" + opts.items[i].icon + "\");' " ) + ">&nbsp;</ins>";
51
+ else str += "<ins>&nbsp;</ins>";
52
+ str += "<span>" + opts.items[i].label + '</span></a></li>';
53
+ if(opts.items[i].separator_after === true) str += "<li class='separator'><span>&nbsp;</span></li>";
54
+ }
55
+ var tmp = obj.children("a:visible").offset();
56
+ $.tree.plugins.contextmenu.object.attr("class","tree-context tree-" + t.settings.ui.theme_name.toString() + "-context").html(str);
57
+ var h = $.tree.plugins.contextmenu.object.height();
58
+ var w = $.tree.plugins.contextmenu.object.width();
59
+ var x = tmp.left;
60
+ var y = tmp.top + parseInt(obj.children("a:visible").height()) + 2;
61
+ var max_y = $(window).height() + $(window).scrollTop();
62
+ var max_x = $(window).width() + $(window).scrollLeft();
63
+ if(y + h > max_y) y = Math.max( (max_y - h - 2), 0);
64
+ if(x + w > max_x) x = Math.max( (max_x - w - 2), 0);
65
+ $.tree.plugins.contextmenu.object.css({ "left" : (x), "top" : (y) }).fadeIn("fast");
66
+ },
67
+ hide : function () {
68
+ if(!$.tree.plugins.contextmenu.data.t) return;
69
+ var opts = $.extend(true, {}, $.tree.plugins.contextmenu.defaults, $.tree.plugins.contextmenu.data.t.settings.plugins.contextmenu);
70
+ if($.tree.plugins.contextmenu.data.r && $.tree.plugins.contextmenu.data.a) {
71
+ $.tree.plugins.contextmenu.data.a.children("a, span").removeClass(opts.class_name);
72
+ }
73
+ $.tree.plugins.contextmenu.data = { a : false, r : false, t : false };
74
+ $.tree.plugins.contextmenu.object.fadeOut("fast");
75
+ },
76
+ exec : function (cmd) {
77
+ if($.tree.plugins.contextmenu.data.t == false) return;
78
+ var opts = $.extend(true, {}, $.tree.plugins.contextmenu.defaults, $.tree.plugins.contextmenu.data.t.settings.plugins.contextmenu);
79
+ try { opts.items[cmd].action.apply(null, [$.tree.plugins.contextmenu.data.a, $.tree.plugins.contextmenu.data.t]); } catch(e) { };
80
+ },
81
+
82
+ callbacks : {
83
+ oninit : function () {
84
+ if(!$.tree.plugins.contextmenu.css) {
85
+ var css = '#jstree-contextmenu { display:none; position:absolute; z-index:2000; list-style-type:none; margin:0; padding:0; left:-2000px; top:-2000px; } .tree-context { margin:20px; padding:0; width:180px; border:1px solid #979797; padding:2px; background:#f5f5f5; list-style-type:none; }.tree-context li { height:22px; margin:0 0 0 27px; padding:0; background:#ffffff; border-left:1px solid #e0e0e0; }.tree-context li a { position:relative; display:block; height:22px; line-height:22px; margin:0 0 0 -28px; text-decoration:none; color:black; padding:0; }.tree-context li a ins { text-decoration:none; float:left; width:16px; height:16px; margin:0 0 0 0; background-color:#f0f0f0; border:1px solid #f0f0f0; border-width:3px 5px 3px 6px; line-height:16px; }.tree-context li a span { display:block; background:#f0f0f0; margin:0 0 0 29px; padding-left:5px; }.tree-context li.separator { background:#f0f0f0; height:2px; line-height:2px; font-size:1px; border:0; margin:0; padding:0; }.tree-context li.separator span { display:block; margin:0px 0 0px 27px; height:1px; border-top:1px solid #e0e0e0; border-left:1px solid #e0e0e0; line-height:1px; font-size:1px; background:white; }.tree-context li a:hover { border:1px solid #d8f0fa; height:20px; line-height:20px; }.tree-context li a:hover span { background:#e7f4f9; margin-left:28px; }.tree-context li a:hover ins { background-color:#e7f4f9; border-color:#e7f4f9; border-width:2px 5px 2px 5px; }.tree-context li a.disabled { color:gray; }.tree-context li a.disabled ins { }.tree-context li a.disabled:hover { border:0; height:22px; line-height:22px; }.tree-context li a.disabled:hover span { background:#f0f0f0; margin-left:29px; }.tree-context li a.disabled:hover ins { border-color:#f0f0f0; background-color:#f0f0f0; border-width:3px 5px 3px 6px; }';
86
+ $.tree.plugins.contextmenu.css = this.add_sheet({ str : css });
87
+ }
88
+ },
89
+ onrgtclk : function (n, t, e) {
90
+ var opts = $.extend(true, {}, $.tree.plugins.contextmenu.defaults, t.settings.plugins.contextmenu);
91
+ n = $(n);
92
+ if(n.size() == 0) return;
93
+ $.tree.plugins.contextmenu.data.t = t;
94
+ if(!n.children("a:eq(0)").hasClass("clicked")) {
95
+ $.tree.plugins.contextmenu.data.a = n;
96
+ $.tree.plugins.contextmenu.data.r = true;
97
+ n.children("a").addClass(opts.class_name);
98
+ e.target.blur();
99
+ }
100
+ else {
101
+ $.tree.plugins.contextmenu.data.r = false;
102
+ $.tree.plugins.contextmenu.data.a = (t.selected_arr && t.selected_arr.length > 1) ? t.selected_arr : t.selected;
103
+ }
104
+ $.tree.plugins.contextmenu.show(n, t);
105
+ e.preventDefault();
106
+ e.stopPropagation();
107
+ // return false; // commented out because you might want to do something in your own callback
108
+ },
109
+ onchange : function () { $.tree.plugins.contextmenu.hide(); },
110
+ beforedata : function () { $.tree.plugins.contextmenu.hide(); },
111
+ ondestroy : function () { $.tree.plugins.contextmenu.hide(); }
112
+ }
113
+ }
114
+ });
115
+ $(function () {
116
+ $.tree.plugins.contextmenu.object.hide().appendTo("body");
117
+ $("#jstree-contextmenu a")
118
+ .live("click", function (event) {
119
+ if(!$(this).hasClass("disabled")) {
120
+ $.tree.plugins.contextmenu.exec.apply(null, [$(this).attr("rel")]);
121
+ $.tree.plugins.contextmenu.hide();
122
+ }
123
+ event.stopPropagation();
124
+ event.preventDefault();
125
+ return false;
126
+ })
127
+ $(document).bind("mousedown", function(event) { if($(event.target).parents("#jstree-contextmenu").size() == 0) $.tree.plugins.contextmenu.hide(); });
128
+ });
129
+ })(jQuery);
@@ -0,0 +1,70 @@
1
+ (function ($) {
2
+ if(typeof $.cookie == "undefined") throw "jsTree cookie: jQuery cookie plugin not included.";
3
+
4
+ $.extend($.tree.plugins, {
5
+ "cookie" : {
6
+ defaults : {
7
+ prefix : "", // a prefix that will be used for all cookies for this tree
8
+ options : {
9
+ expires: false,
10
+ path: false,
11
+ domain: false,
12
+ secure: false
13
+ },
14
+ types : {
15
+ selected : true, // should we set the selected cookie
16
+ open : true // should we set the open cookie
17
+ },
18
+ keep_selected : false, // should we merge with the selected option or overwrite it
19
+ keep_opened : false // should we merge with the opened option or overwrite it
20
+ },
21
+ set_cookie : function (type) {
22
+ var opts = $.extend(true, {}, $.tree.plugins.cookie.defaults, this.settings.plugins.cookie);
23
+ if(opts.types[type] !== true) return false;
24
+ switch(type) {
25
+ case "selected":
26
+ if(this.settings.rules.multiple != false && this.selected_arr.length > 1) {
27
+ var val = Array();
28
+ $.each(this.selected_arr, function () {
29
+ if(this.attr("id")) { val.push(this.attr("id")); }
30
+ });
31
+ val = val.join(",");
32
+ }
33
+ else var val = this.selected ? this.selected.attr("id") : false;
34
+ $.cookie(opts.prefix + 'selected', val, opts.options);
35
+ break;
36
+ case "open":
37
+ var str = "";
38
+ this.container.find("li.open").each(function (i) { if(this.id) { str += this.id + ","; } });
39
+ $.cookie(opts.prefix + 'open', str.replace(/,$/ig,""), opts.options);
40
+ break;
41
+ }
42
+ },
43
+ callbacks : {
44
+ oninit : function (t) {
45
+ var opts = $.extend(true, {}, $.tree.plugins.cookie.defaults, this.settings.plugins.cookie);
46
+ var tmp = false;
47
+ tmp = $.cookie(opts.prefix + 'open');
48
+ if(tmp) {
49
+ tmp = tmp.split(",");
50
+ if(opts.keep_opened) this.settings.opened = $.unique($.merge(tmp, this.settings.opened));
51
+ else this.settings.opened = tmp;
52
+ }
53
+ tmp = $.cookie(opts.prefix + 'selected');
54
+ if(tmp) {
55
+ tmp = tmp.split(",");
56
+ if(opts.keep_selected) this.settings.selected = $.unique($.merge(tmp, this.settings.opened));
57
+ else this.settings.selected = tmp;
58
+ }
59
+ },
60
+ onchange : function() { $.tree.plugins.cookie.set_cookie.apply(this, ["selected"]); },
61
+ onopen : function() { $.tree.plugins.cookie.set_cookie.apply(this, ["open"]); },
62
+ onclose : function() { $.tree.plugins.cookie.set_cookie.apply(this, ["open"]); },
63
+ ondelete : function() { $.tree.plugins.cookie.set_cookie.apply(this, ["open"]); },
64
+ oncopy : function() { $.tree.plugins.cookie.set_cookie.apply(this, ["open"]); },
65
+ oncreate : function() { $.tree.plugins.cookie.set_cookie.apply(this, ["open"]); },
66
+ onmoved : function() { $.tree.plugins.cookie.set_cookie.apply(this, ["open"]); }
67
+ }
68
+ }
69
+ });
70
+ })(jQuery);
@@ -0,0 +1,78 @@
1
+ (function ($) {
2
+ if(typeof window.hotkeys == "undefined") throw "jsTree hotkeys: jQuery hotkeys plugin not included.";
3
+
4
+ $.extend($.tree.plugins, {
5
+ "hotkeys" : {
6
+ bound : [],
7
+ disabled : false,
8
+ defaults : {
9
+ hover_mode : false,
10
+ functions : {
11
+ "up" : function () { $.tree.plugins.hotkeys.get_prev.apply(this); return false; },
12
+ "down" : function () { $.tree.plugins.hotkeys.get_next.apply(this); return false; },
13
+ "left" : function () { $.tree.plugins.hotkeys.get_left.apply(this); return false; },
14
+ "right" : function () { $.tree.plugins.hotkeys.get_right.apply(this); return false; },
15
+ "f2" : function () { if(this.selected) this.rename(); return false; },
16
+ "del" : function () { if(this.selected) this.remove(); return false; },
17
+ "ctrl+c": function () { if(this.selected) this.copy(); return false; },
18
+ "ctrl+x": function () { if(this.selected) this.cut(); return false; },
19
+ "ctrl+v": function () { if(this.selected) this.paste(); return false; }
20
+ }
21
+ },
22
+ exec : function(key) {
23
+ if($.tree.plugins.hotkeys.disabled) return false;
24
+
25
+ var t = $.tree.focused();
26
+ if(typeof t.settings.plugins.hotkeys == "undefined") return;
27
+ var opts = $.extend(true, {}, $.tree.plugins.hotkeys.defaults, t.settings.plugins.hotkeys);
28
+ if(typeof opts.functions[key] == "function") return opts.functions[key].apply(t);
29
+ },
30
+ get_next : function() {
31
+ var opts = $.extend(true, {}, $.tree.plugins.hotkeys.defaults, this.settings.plugins.hotkeys);
32
+ var obj = this.hovered || this.selected;
33
+ return opts.hover_mode ? this.hover_branch(this.next(obj)) : this.select_branch(this.next(obj));
34
+ },
35
+ get_prev : function() {
36
+ var opts = $.extend(true, {}, $.tree.plugins.hotkeys.defaults, this.settings.plugins.hotkeys);
37
+ var obj = this.hovered || this.selected;
38
+ return opts.hover_mode ? this.hover_branch(this.prev(obj)) : this.select_branch(this.prev(obj));
39
+ },
40
+ get_left : function() {
41
+ var opts = $.extend(true, {}, $.tree.plugins.hotkeys.defaults, this.settings.plugins.hotkeys);
42
+ var obj = this.hovered || this.selected;
43
+ if(obj) {
44
+ if(obj.hasClass("open")) this.close_branch(obj);
45
+ else {
46
+ return opts.hover_mode ? this.hover_branch(this.parent(obj)) : this.select_branch(this.parent(obj));
47
+ }
48
+ }
49
+ },
50
+ get_right : function() {
51
+ var opts = $.extend(true, {}, $.tree.plugins.hotkeys.defaults, this.settings.plugins.hotkeys);
52
+ var obj = this.hovered || this.selected;
53
+ if(obj) {
54
+ if(obj.hasClass("closed")) this.open_branch(obj);
55
+ else {
56
+ return opts.hover_mode ? this.hover_branch(obj.find("li:eq(0)")) : this.select_branch(obj.find("li:eq(0)"));
57
+ }
58
+ }
59
+ },
60
+
61
+ callbacks : {
62
+ oninit : function (t) {
63
+ var opts = $.extend(true, {}, $.tree.plugins.hotkeys.defaults, this.settings.plugins.hotkeys);
64
+ for(var i in opts.functions) {
65
+ if(opts.functions.hasOwnProperty(i) && $.inArray(i, $.tree.plugins.hotkeys.bound) == -1) {
66
+ (function (k) {
67
+ $(document).bind("keydown", { combi : k, disableInInput: true }, function (event) {
68
+ return $.tree.plugins.hotkeys.exec(k);
69
+ });
70
+ })(i);
71
+ $.tree.plugins.hotkeys.bound.push(i);
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+ });
78
+ })(jQuery);
@@ -0,0 +1,17 @@
1
+ (function ($) {
2
+ if(typeof $.metadata == "undefined") throw "jsTree metadata: jQuery metadata plugin not included.";
3
+
4
+ $.extend($.tree.plugins, {
5
+ "metadata" : {
6
+ defaults : {
7
+ attribute : "data"
8
+ },
9
+ callbacks : {
10
+ check : function(rule, obj, value, tree) {
11
+ var opts = $.extend(true, {}, $.tree.plugins.metadata.defaults, this.settings.plugins.metadata);
12
+ if(typeof $(obj).metadata({ type : "attr", name : opts.attribute })[rule] != "undefined") return $(obj).metadata()[rule];
13
+ }
14
+ }
15
+ }
16
+ });
17
+ })(jQuery);
@@ -0,0 +1,33 @@
1
+ (function ($) {
2
+ $.extend($.tree.plugins, {
3
+ "themeroller" : {
4
+ defaults : {
5
+
6
+ },
7
+ callbacks : {
8
+ oninit : function (t) {
9
+ if(this.settings.ui.theme_name != "themeroller") return;
10
+ var opts = $.extend(true, {}, $.tree.plugins.themeroller.defaults, this.settings.plugins.themeroller);
11
+ this.container.addClass("ui-widget ui-widget-content");
12
+ $("#" + this.container.attr("id") + " li a").live("mouseover", function () { $(this).addClass("ui-state-hover"); });
13
+ $("#" + this.container.attr("id") + " li a").live("mouseout", function () { $(this).removeClass("ui-state-hover"); });
14
+ },
15
+ onparse : function (s, t) {
16
+ if(this.settings.ui.theme_name != "themeroller") return;
17
+ var opts = $.extend(true, {}, $.tree.plugins.themeroller.defaults, this.settings.plugins.themeroller);
18
+ return $(s).find("a").not(".ui-state-default").addClass("ui-state-default").children("ins").addClass("ui-icon").end().end().end();
19
+ },
20
+ onselect : function(n, t) {
21
+ if(this.settings.ui.theme_name != "themeroller") return;
22
+ var opts = $.extend(true, {}, $.tree.plugins.themeroller.defaults, this.settings.plugins.themeroller);
23
+ $(n).children("a").addClass("ui-state-active");
24
+ },
25
+ ondeselect : function(n, t) {
26
+ if(this.settings.ui.theme_name != "themeroller") return;
27
+ var opts = $.extend(true, {}, $.tree.plugins.themeroller.defaults, this.settings.plugins.themeroller);
28
+ $(n).children("a").removeClass("ui-state-active");
29
+ }
30
+ }
31
+ }
32
+ });
33
+ })(jQuery);
@@ -0,0 +1,123 @@
1
+ (function ($) {
2
+ if(typeof Sarissa == "undefined") throw "jsTree xml_flat: Sarissa is not included.";
3
+
4
+ $.extend($.tree.datastores, {
5
+ "xml_flat" : function () {
6
+ return {
7
+ get : function(obj, t, opts) {
8
+ var str = "";
9
+ if(!obj || $(obj).size() == 0) {
10
+ obj = t.container.children("ul").children("li");
11
+ }
12
+ else obj = $(obj);
13
+
14
+ if(obj.size() > 1) {
15
+ var _this = this;
16
+ var str = '<root>';
17
+ obj.each(function () {
18
+ opts.callback = true;
19
+ str += _this.get(this, t, opts);
20
+ });
21
+ str += '</root>';
22
+ return str;
23
+ }
24
+
25
+ if(!opts) var opts = {};
26
+ if(!opts.outer_attrib) opts.outer_attrib = [ "id", "rel", "class" ];
27
+ if(!opts.inner_attrib) opts.inner_attrib = [ ];
28
+ if(!opts.callback) str += '<root>';
29
+
30
+ str += '<item ';
31
+ str += ' parent_id="' + (obj.parents("li:eq(0)").size() ? obj.parents("li:eq(0)").attr("id") : 0) + '" ';
32
+ for(var i in opts.outer_attrib) {
33
+ if(!opts.outer_attrib.hasOwnProperty(i)) continue;
34
+ var val = (opts.outer_attrib[i] == "class") ? obj.attr(opts.outer_attrib[i]).toString().replace(/(^| )last( |$)/ig," ").replace(/(^| )(leaf|closed|open)( |$)/ig," ") : obj.attr(opts.outer_attrib[i]);
35
+ if(typeof val != "undefined" && val.toString().replace(" ","").length > 0) str += ' ' + opts.outer_attrib[i] + '="' + val.toString() + '" ';
36
+ delete val;
37
+ }
38
+ str += '>';
39
+
40
+ str += '<content>';
41
+ if(t.settings.languages.length) {
42
+ for(var i in t.settings.languages) {
43
+ if(!t.settings.languages.hasOwnProperty(i)) continue;
44
+ str += this.process_inner(obj.children("a." + t.settings.languages[i]), t, opts, t.settings.languages[i]);
45
+ }
46
+ }
47
+ else {
48
+ str += this.process_inner(obj.children("a"), t, opts);
49
+ }
50
+ str += '</content>';
51
+ str += '</item>';
52
+
53
+ if(obj.children("ul").size() > 0) {
54
+ var _this = this;
55
+ opts.callback = true;
56
+ obj.children("ul").children("li").each(function () {
57
+ str += _this.get(this, t, opts);
58
+ });
59
+ opts.callback = false;
60
+ }
61
+ if(!opts.callback) str += '</root>';
62
+ return str;
63
+ },
64
+ process_inner : function(obj, t, opts, lang) {
65
+ var str = '<name ';
66
+ if(lang) str += ' lang="' + lang + '" ';
67
+ if(opts.inner_attrib.length || obj.children("ins").get(0).style.backgroundImage.toString().length || obj.children("ins").get(0).className.length) {
68
+ if(obj.children("ins").get(0).style.className.length) {
69
+ str += ' icon="' + obj.children("ins").get(0).style.className + '" ';
70
+ }
71
+ if(obj.children("ins").get(0).style.backgroundImage.length) {
72
+ str += ' icon="' + obj.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","") + '" ';
73
+ }
74
+ if(opts.inner_attrib.length) {
75
+ for(var j in opts.inner_attrib) {
76
+ if(!opts.inner_attrib.hasOwnProperty(j)) continue;
77
+ var val = obj.attr(opts.inner_attrib[j]);
78
+ if(typeof val != "undefined" && val.toString().replace(" ","").length > 0) str += ' ' + opts.inner_attrib[j] + '="' + val.toString() + '" ';
79
+ delete val;
80
+ }
81
+ }
82
+ }
83
+ str += '><![CDATA[' + t.get_text(obj,lang) + ']]></name>';
84
+ return str;
85
+ },
86
+
87
+ parse : function(data, t, opts, callback) {
88
+ var processor = new XSLTProcessor();
89
+ processor.importStylesheet($.tree.datastores.xml_flat.xsl);
90
+
91
+ var result = $((new XMLSerializer()).serializeToString(processor.transformToDocument(data)));
92
+ if(result.is("ul")) result = result.html();
93
+ else result = result.find("ul").html();
94
+ if(callback) callback.call(null,result);
95
+
96
+ // Disabled because of Chrome issues
97
+ // if(callback) callback.call(null,(new XMLSerializer()).serializeToString(processor.transformToDocument(data)).replace(/^<ul[^>]*>/i,"").replace(/<\/ul>$/i,""));
98
+ },
99
+ load : function(data, t, opts, callback) {
100
+ if(opts.static) {
101
+ callback.call(null, (new DOMParser()).parseFromString(opts.static,'text/xml'));
102
+ }
103
+ else {
104
+ $.ajax({
105
+ 'type' : opts.method,
106
+ 'url' : opts.url,
107
+ 'data' : data,
108
+ 'dataType' : "xml",
109
+ 'success' : function (d, textStatus) {
110
+ callback.call(null, d);
111
+ },
112
+ 'error' : function (xhttp, textStatus, errorThrown) {
113
+ callback.call(null, false);
114
+ t.error(errorThrown + " " + textStatus);
115
+ }
116
+ });
117
+ }
118
+ }
119
+ }
120
+ }
121
+ });
122
+ $.tree.datastores.xml_flat.xsl = (new DOMParser()).parseFromString('<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/xml" /><xsl:template match="/"><ul><xsl:for-each select="//item[not(@parent_id) or @parent_id=0]"><xsl:call-template name="nodes"><xsl:with-param name="node" select="." /><xsl:with-param name="is_last" select="number(position() = last())" /></xsl:call-template></xsl:for-each></ul></xsl:template><xsl:template name="nodes"><xsl:param name="node" /><xsl:param name="theme_path" /><xsl:param name="theme_name" /><xsl:param name="is_last" /><xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) &gt; 0" /><li><xsl:attribute name="class"><xsl:if test="$is_last = true()"> last </xsl:if><xsl:choose><xsl:when test="@state = \'open\'"> open </xsl:when><xsl:when test="$children or @hasChildren or @state = \'closed\'"> closed </xsl:when><xsl:otherwise> leaf </xsl:otherwise></xsl:choose><xsl:value-of select="@class" /></xsl:attribute><xsl:for-each select="@*"><xsl:if test="name() != \'parent_id\' and name() != \'hasChildren\' and name() != \'class\' and name() != \'state\'"><xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute></xsl:if></xsl:for-each><xsl:for-each select="content/name"><a href="#"><xsl:attribute name="class"><xsl:value-of select="@lang" /><xsl:value-of select="@class" /></xsl:attribute><xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute><xsl:for-each select="@*"><xsl:if test="name() != \'style\' and name() != \'class\'"><xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute></xsl:if></xsl:for-each><ins><xsl:if test="string-length(attribute::icon) > 0"><xsl:choose><xsl:when test="not(contains(@icon,\'/\'))"><xsl:attribute name="class"><xsl:value-of select="@icon" /></xsl:attribute></xsl:when><xsl:otherwise><xsl:attribute name="style">background-image:url(<xsl:value-of select="@icon" />);</xsl:attribute></xsl:otherwise></xsl:choose></xsl:if><xsl:text>&#xa0;</xsl:text></ins><xsl:value-of select="." /></a></xsl:for-each><xsl:if test="$children or @hasChildren"><ul><xsl:for-each select="//item[@parent_id=$node/attribute::id]"><xsl:call-template name="nodes"><xsl:with-param name="node" select="." /><xsl:with-param name="is_last" select="number(position() = last())" /></xsl:call-template></xsl:for-each></ul></xsl:if></li></xsl:template></xsl:stylesheet>','text/xml');
123
+ })(jQuery);
@@ -0,0 +1,124 @@
1
+ (function ($) {
2
+ if(typeof Sarissa == "undefined") throw "jsTree xml_nested: Sarissa is not included.";
3
+
4
+ $.extend($.tree.datastores, {
5
+ "xml_nested" : function () {
6
+ return {
7
+ get : function(obj, tree, opts) {
8
+ var str = "";
9
+ if(!obj || $(obj).size() == 0) {
10
+ obj = tree.container.children("ul").children("li");
11
+ }
12
+ else obj = $(obj);
13
+
14
+ if(obj.size() > 1) {
15
+ var _this = this;
16
+ var str = '<root>';
17
+ obj.each(function () {
18
+ opts.callback = true;
19
+ str += _this.get(this, tree, opts);
20
+ });
21
+ str += '</root>';
22
+ return str;
23
+ }
24
+
25
+ if(!opts) var opts = {};
26
+ if(!opts.outer_attrib) opts.outer_attrib = [ "id", "rel", "class" ];
27
+ if(!opts.inner_attrib) opts.inner_attrib = [ ];
28
+ if(!opts.callback) str += '<root>';
29
+
30
+ str += '<item ';
31
+ for(var i in opts.outer_attrib) {
32
+ if(!opts.outer_attrib.hasOwnProperty(i)) continue;
33
+ var val = (opts.outer_attrib[i] == "class") ? obj.attr(opts.outer_attrib[i]).replace(/(^| )last( |$)/ig," ").replace(/(^| )(leaf|closed|open)( |$)/ig," ") : obj.attr(opts.outer_attrib[i]);
34
+ if(typeof val != "undefined" && val.toString().replace(" ","").length > 0) str += ' ' + opts.outer_attrib[i] + '="' + val.toString() + '" ';
35
+ delete val;
36
+ }
37
+ str += '>';
38
+
39
+ str += '<content>';
40
+ if(tree.settings.languages.length) {
41
+ for(var i in tree.settings.languages) {
42
+ if(!tree.settings.languages.hasOwnProperty(i)) continue;
43
+ str += this.process_inner(obj.children("a." + tree.settings.languages[i]), tree, opts, tree.settings.languages[i]);
44
+ }
45
+ }
46
+ else {
47
+ str += this.process_inner(obj.children("a"), tree, opts);
48
+ }
49
+ str += '</content>';
50
+
51
+ if(obj.children("ul").size() > 0) {
52
+ var _this = this;
53
+ opts.callback = true;
54
+ obj.children("ul").children("li").each(function () {
55
+ str += _this.get(this, tree, opts);
56
+ });
57
+ opts.callback = false;
58
+ }
59
+ str += '</item>';
60
+
61
+ if(!opts.callback) str += '</root>';
62
+ return str;
63
+ },
64
+ process_inner : function(obj, tree, opts, lang) {
65
+ var str = '<name ';
66
+ if(lang) str += ' lang="' + lang + '" ';
67
+ if(opts.inner_attrib.length || obj.children("ins").get(0).style.backgroundImage.toString().length || obj.children("ins").get(0).className.length) {
68
+ if(obj.children("ins").get(0).style.className.length) {
69
+ str += ' icon="' + obj.children("ins").get(0).style.className + '" ';
70
+ }
71
+ if(obj.children("ins").get(0).style.backgroundImage.length) {
72
+ str += ' icon="' + obj.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","") + '" ';
73
+ }
74
+ if(opts.inner_attrib.length) {
75
+ for(var j in opts.inner_attrib) {
76
+ if(!opts.inner_attrib.hasOwnProperty(j)) continue;
77
+ var val = obj.attr(opts.inner_attrib[j]);
78
+ if(typeof val != "undefined" && val.toString().replace(" ","").length > 0) str += ' ' + opts.inner_attrib[j] + '="' + val.toString() + '" ';
79
+ delete val;
80
+ }
81
+ }
82
+ }
83
+ str += '><![CDATA[' + tree.get_text(obj,lang) + ']]></name>';
84
+ return str;
85
+ },
86
+ parse : function(data, tree, opts, callback) {
87
+ var processor = new XSLTProcessor();
88
+ processor.importStylesheet($.tree.datastores.xml_nested.xsl);
89
+
90
+ var result = $((new XMLSerializer()).serializeToString(processor.transformToDocument(data)).replace('<?xml version="1.0"?>',''));
91
+ // Opera bug
92
+ if(result.size() > 1) result = result.eq(1);
93
+ if(result.is("ul")) result = result.html();
94
+ else result = result.find("ul:eq(0)").html();
95
+ if(callback) callback.call(null,result);
96
+
97
+ // Disabled because of Chrome issues
98
+ // if(callback) callback.call(null,(new XMLSerializer()).serializeToString(processor.transformToDocument(data)).replace(/^<ul[^>]*>/i,"").replace(/<\/ul>$/i,""));
99
+ },
100
+ load : function(data, tree, opts, callback) {
101
+ if(opts.static) {
102
+ callback.call(null, (new DOMParser()).parseFromString(opts.static,'text/xml'));
103
+ }
104
+ else {
105
+ $.ajax({
106
+ 'type' : opts.method,
107
+ 'url' : opts.url,
108
+ 'data' : data,
109
+ 'dataType' : "xml",
110
+ 'success' : function (d, textStatus) {
111
+ callback.call(null, d);
112
+ },
113
+ 'error' : function (xhttp, textStatus, errorThrown) {
114
+ callback.call(null, false);
115
+ tree.error(errorThrown + " " + textStatus);
116
+ }
117
+ });
118
+ }
119
+ }
120
+ }
121
+ }
122
+ });
123
+ $.tree.datastores.xml_nested.xsl = (new DOMParser()).parseFromString('<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/html" /><xsl:template match="/"><xsl:call-template name="nodes"><xsl:with-param name="node" select="/root" /></xsl:call-template></xsl:template><xsl:template name="nodes"><xsl:param name="node" /><ul><xsl:for-each select="$node/item"><xsl:variable name="children" select="count(./item) &gt; 0" /><li><xsl:attribute name="class"><xsl:if test="position() = last()"> last </xsl:if><xsl:choose><xsl:when test="@state = \'open\'"> open </xsl:when><xsl:when test="$children or @hasChildren"> closed </xsl:when><xsl:otherwise> leaf </xsl:otherwise></xsl:choose><xsl:value-of select="@class" /></xsl:attribute><xsl:for-each select="@*"><xsl:if test="name() != \'class\' and name() != \'state\' and name() != \'hasChildren\'"><xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute></xsl:if></xsl:for-each><xsl:for-each select="content/name"><a href=""><xsl:attribute name="class"><xsl:value-of select="@lang" /><xsl:value-of select="@class" /></xsl:attribute><xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute><xsl:for-each select="@*"><xsl:if test="name() != \'style\' and name() != \'class\'"><xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute></xsl:if></xsl:for-each><ins><xsl:if test="string-length(attribute::icon) > 0"><xsl:choose><xsl:when test="not(contains(@icon,\'/\'))"><xsl:attribute name="class"><xsl:value-of select="@icon" /></xsl:attribute></xsl:when><xsl:otherwise><xsl:attribute name="style">background-image:url(<xsl:value-of select="@icon" />);</xsl:attribute></xsl:otherwise></xsl:choose></xsl:if><xsl:text>&#xa0;</xsl:text></ins><xsl:value-of select="current()" /></a></xsl:for-each><xsl:if test="$children or @hasChildren"><xsl:call-template name="nodes"><xsl:with-param name="node" select="current()" /></xsl:call-template></xsl:if></li></xsl:for-each></ul></xsl:template></xsl:stylesheet>','text/xml');
124
+ })(jQuery);
@@ -0,0 +1,34 @@
1
+ /* BACKGROUND */
2
+ .tree-apple .ltr, .tree-apple .rtl { background:url("bg.jpg") left top repeat; min-width:100%; _width:100%; margin-left:0; margin-right:0; display:table; }
3
+ .tree-apple .ltr > li.leaf, .tree-apple .rtl > li.leaf { background-image:none; }
4
+
5
+ /* LOCKED */
6
+ .tree-apple .locked li a { color:gray; }
7
+ /* DOTS */
8
+ .tree-apple ul { background-position:6px 1px; background-repeat:repeat-y; background-image:url(data:image/gif;base64,R0lGODlhAgACAIAAAB4dGf///yH5BAEAAAEALAAAAAACAAIAAAICRF4AOw==); _background-image:url("dot_for_ie.gif"); *background-image:url("dot_for_ie.gif"); }
9
+ .tree-apple li { background-position:-64px -16px; background-repeat:no-repeat; background-image:url("icons.png"); }
10
+ /* NO DOTS */
11
+ .tree-apple .no_dots, .tree-apple .no_dots ul { background:transparent; }
12
+ .tree-apple .no_dots li.leaf { background-image:none; background-color:transparent; }
13
+ /* OPEN or CLOSED */
14
+ .tree-apple li.open { background:url("icons.png") -32px -48px no-repeat; }
15
+ .tree-apple li.closed, #jstree-dragged.tree-apple li li.open { background:url("icons.png") -48px -32px no-repeat; }
16
+ #jstree-marker { background-image:url("icons.png"); }
17
+ /* DEFAULT, HOVER, CLICKED, LOADING STATES */
18
+ .tree-apple li a, .tree-apple li span { border-radius:3px; -moz-border-radius:3px; -webkit-border-radius:3px; }
19
+ .tree-apple li a:hover, .tree-apple li a.hover, .tree-apple li span { background: #e7f4f9; border:1px solid #d8f0fa; padding:0px 3px 0px 3px; }
20
+ .tree-apple li a.clicked, .tree-apple li a.clicked:hover, .tree-apple li span.clicked { background: #beebff; border:1px solid #99defd; padding:0px 3px 0px 3px; }
21
+ /* ICONS */
22
+ .tree-apple ins { background-image:url("icons.png"); background-position:0 0; background-repeat:no-repeat; }
23
+ .tree-apple ul li a.loading ins { background-image:url("throbber.gif") !important; background-position:0 0 !important; } /* UL is added to make selector stronger */
24
+ .tree-apple li a ins.forbidden { background-position:-16px -16px; }
25
+ .tree-apple .locked li a ins { background-position:0 -48px; }
26
+ .tree-apple li span ins { background-position:-16px 0; }
27
+ #jstree-dragged.tree-apple ins { background:url("icons.png") -16px -32px no-repeat; }
28
+ #jstree-dragged.tree-apple ins.forbidden { background:url("icons.png") -16px -16px no-repeat; }
29
+
30
+ /* CONTEXT MENU */
31
+ .tree-apple-context a ins { background-image:url("icons.png"); background-repeat:no-repeat; background-position:-64px -64px; }
32
+ .tree-apple-context a ins.create { background-position:0 -16px; }
33
+ .tree-apple-context a ins.rename { background-position:-16px 0px; }
34
+ .tree-apple-context a ins.remove { background-position:0 -32px; }