mirror of
https://github.com/xcat2/xcat-dep.git
synced 2024-11-21 17:11:45 +00:00
233 lines
10 KiB
Diff
233 lines
10 KiB
Diff
diff -urN jsTree/tree_component.css jsTree-custom/tree_component.css
|
|
--- jsTree/tree_component.css 2008-09-28 15:31:30.000000000 -0400
|
|
+++ jsTree-custom/tree_component.css 2008-10-13 09:50:29.000000000 -0400
|
|
@@ -22,7 +22,7 @@
|
|
float:left;
|
|
line-height:16px;
|
|
height:16px;
|
|
- padding:1px 4px 1px 23px !important;
|
|
+ padding:1px 4px 1px 3px !important;
|
|
color:black;
|
|
white-space:nowrap;
|
|
text-decoration:none;
|
|
@@ -37,7 +37,7 @@
|
|
.tree li a.hover {
|
|
background-color: #e7f4f9;
|
|
border:1px solid #d8f0fa;
|
|
- padding:0px 3px 0px 22px !important;
|
|
+ padding:0px 3px 0px 2px !important;
|
|
background-position:3px 0px;
|
|
}
|
|
.tree li a.clicked,
|
|
@@ -45,11 +45,11 @@
|
|
.tree li span.clicked {
|
|
background-color: #beebff;
|
|
border:1px solid #99defd;
|
|
- padding:0px 3px 0px 22px !important;
|
|
+ padding:0px 3px 0px 2px !important;
|
|
background-position:3px 0px;
|
|
}
|
|
.tree li span.clicked {
|
|
- padding:0px 3px 0px 20px !important;
|
|
+ padding:0px 3px 0px 0px !important;
|
|
}
|
|
|
|
.tree li a input,
|
|
@@ -190,14 +190,14 @@
|
|
.rtl li a,
|
|
.rtl li span {
|
|
float:right;
|
|
- padding:1px 23px 1px 4px !important;
|
|
+ padding:1px 3px 1px 4px !important;
|
|
background-position:right 1px;
|
|
margin-right:1px;
|
|
}
|
|
.rtl li a:hover {
|
|
background-color: #e7f4f9;
|
|
border:1px solid #d8f0fa;
|
|
- padding:0px 23px 0px 3px !important;
|
|
+ padding:0px 3px 0px 3px !important;
|
|
background-position:right 0px;
|
|
margin-right:0px;
|
|
}
|
|
@@ -206,12 +206,12 @@
|
|
.rtl li span.clicked {
|
|
background-color: #beebff;
|
|
border:1px solid #99defd;
|
|
- padding:0px 23px 0px 3px !important;
|
|
+ padding:0px 3px 0px 3px !important;
|
|
background-position:right 0px;
|
|
margin-right:0px;
|
|
}
|
|
.rtl li span.clicked {
|
|
- padding:0px 21px 0px 3px !important;
|
|
+ padding:0px 1px 0px 3px !important;
|
|
}
|
|
.rtl ul ul {
|
|
background:url("images/dot.gif") right 1px repeat-y;
|
|
@@ -221,4 +221,4 @@
|
|
}
|
|
.rtl #dragged li.open {
|
|
background-position: right 5px;
|
|
-}
|
|
\ No newline at end of file
|
|
+}
|
|
diff -urN jsTree/tree_component.js jsTree-custom/tree_component.js
|
|
--- jsTree/tree_component.js 2008-09-21 17:00:41.000000000 -0400
|
|
+++ jsTree-custom/tree_component.js 2008-10-13 09:51:48.000000000 -0400
|
|
@@ -136,6 +136,7 @@
|
|
this.container.addClass("tree").css({ position: "relative" });
|
|
if(this.settings.ui.rtl) this.container.addClass("rtl");
|
|
if(this.settings.rules.multiple) this.selected_arr = [];
|
|
+ this.recent_range = [];
|
|
this.offset = this.container.offset();
|
|
this.container.css({ position : "" });
|
|
if(this.settings.ui.dots == false) this.container.addClass("no_dots");
|
|
@@ -236,14 +237,14 @@
|
|
str += ">";
|
|
if(this.settings.languages.length) {
|
|
for(var i = 0; i < this.settings.languages.length; i++) {
|
|
- str += "<a href='#' class='" + this.settings.languages[i] + "' ";
|
|
+ str += "<a class='" + this.settings.languages[i] + "' ";
|
|
if(data.icons && data.icons[this.settings.languages[i]])
|
|
str += " style='background-image:url(\"" + data.icons[this.settings.languages[i]] + "\");' ";
|
|
str += ">" + data.data[this.settings.languages[i]] + "</a>";
|
|
}
|
|
}
|
|
else {
|
|
- str += "<a href='#' ";
|
|
+ str += "<a ";
|
|
if(data.icons)
|
|
str += " style='background-image:url(\"" + data.icons + "\");' ";
|
|
str += ">" + data.data + "</a>";
|
|
@@ -314,7 +315,7 @@
|
|
event.target.blur();
|
|
return _this.error("LOCKED");
|
|
}
|
|
- _this.select_branch.apply(_this, [event.target, event.ctrlKey || _this.settings.rules.multiple == "on"]);
|
|
+ _this.select_branch.apply(_this, [event.target, event.ctrlKey || _this.settings.rules.multiple == "on", event.shiftKey]);
|
|
if(_this.inp) { _this.inp.blur(); }
|
|
event.preventDefault();
|
|
event.target.blur();
|
|
@@ -704,10 +705,11 @@
|
|
if(off_t + 5 < beg_t) this.container.scrollTop(this.container.scrollTop() - (beg_t - off_t + 5) );
|
|
if(off_t + h_cor > end_t) this.container.scrollTop(this.container.scrollTop() + (off_t + h_cor - end_t) );
|
|
},
|
|
- select_branch : function (obj, multiple) {
|
|
+ select_branch : function (obj, multiple, ranged,rangechild) {
|
|
if(this.locked) return this.error("LOCKED");
|
|
if(!obj && this.hovered !== false) obj = this.hovered;
|
|
var _this = this;
|
|
+ var _obj = obj;
|
|
obj = _this.get_node(obj);
|
|
if(!obj.size()) return this.error("SELECT: NOT A VALID NODE");
|
|
obj.children("a").removeClass("hover");
|
|
@@ -716,12 +718,47 @@
|
|
if(_this.settings.callback.beforechange.call(null,obj.get(0),_this) === false) return this.error("SELECT: STOPPED BY USER");
|
|
// IF multiple AND obj IS ALREADY SELECTED - DESELECT IT
|
|
if(this.settings.rules.multiple != false && multiple && obj.children("a.clicked").size() > 0) {
|
|
+ if ($(obj).parent().children().index(obj) == $(obj).parent().children().index(this.shiftanchor)) {
|
|
+ this.shiftanchor=null;
|
|
+ }
|
|
return this.deselect_branch(obj);
|
|
}
|
|
- if(this.settings.rules.multiple != false && multiple) {
|
|
+ if(this.settings.rules.multiple != false && multiple) { //Add obj to selected items due to multiple
|
|
this.selected_arr.push(obj);
|
|
}
|
|
- if(this.settings.rules.multiple != false && !multiple) {
|
|
+ if (ranged && this.shiftanchor != null) {
|
|
+ for (var old_obj in this.recent_range) {
|
|
+ this.deselect_branch(this.recent_range[old_obj],1);
|
|
+ }
|
|
+ this.recent_range=[];
|
|
+ var curidx = $(obj).parent().children().index(obj);
|
|
+ var previdx = $(obj).parent().children().index(this.shiftanchor);
|
|
+ if (curidx >= 0 && previdx >=0) {
|
|
+ var firstidx=Math.min(curidx,previdx);
|
|
+ var lastidx=Math.max(curidx,previdx);
|
|
+ var siblings=$(obj).parent().children();
|
|
+ for (var idx = firstidx+1;idx < lastidx; idx++) {
|
|
+ if (this.get_node($(siblings[idx])).children("a.clicked").size() == 0) {
|
|
+ this.select_branch($(siblings[idx]),1,false,true);
|
|
+ }
|
|
+ this.recent_range.push(_this.get_node($(siblings[idx])));
|
|
+// $(siblings[idx]).children("A").addClass("clicked");
|
|
+ }
|
|
+ this.selected_arr.push(obj);
|
|
+ this.recent_range.push(obj);
|
|
+ } /* else { What to do when shift click tries to go somewhere totally different? too hard for now..
|
|
+ $("#rangedisplay").text(curidx);
|
|
+ } */
|
|
+ var sel = window.getSelection();
|
|
+ sel.removeAllRanges();
|
|
+ } else {
|
|
+ if (!rangechild) {
|
|
+ this.shiftanchor = obj;
|
|
+ this.recent_range=[];
|
|
+ this.selected_arr.push(obj);
|
|
+ }
|
|
+ }
|
|
+ if(this.settings.rules.multiple != false && !multiple && !ranged) { //click without ctrl or shift
|
|
for(i in this.selected_arr) {
|
|
this.selected_arr[i].children("A").removeClass("clicked");
|
|
}
|
|
@@ -767,11 +804,13 @@
|
|
this.selected = this.selected_arr[0];
|
|
this.set_cookie("selected");
|
|
}
|
|
+ this.settings.callback.onchange.call(null, this.selected.get(0), _this);
|
|
}
|
|
else {
|
|
if(this.settings.rules.multiple != false) this.selected_arr = [];
|
|
this.selected = false;
|
|
this.set_cookie("selected");
|
|
+ this.settings.callback.onchange.call(null, null, _this);
|
|
}
|
|
},
|
|
toggle_branch : function (obj) {
|
|
@@ -787,7 +826,7 @@
|
|
|
|
if(this.settings.data.async && obj.find("li").size() == 0) {
|
|
var _this = this;
|
|
- obj.children("ul:eq(0)").remove().end().append("<ul><li class='last'><a style='background-image:url(" + _this.path + "images/throbber.gif)' href='#'>" + (_this.settings.lang.loading || "Loading ...") + "</a></li></ul>");
|
|
+ obj.children("ul:eq(0)").remove().end().append("<ul><li class='last'><a>" + (_this.settings.lang.loading || "Loading ...") + "<img src=\""+_this.path+"images/throbber.gif\"></a></li></ul>");
|
|
obj.removeClass("closed").addClass("open");
|
|
if(this.settings.data.type == "xml_flat" || this.settings.data.type == "xml_nested") {
|
|
var xsl = (this.settings.data.type == "xml_flat") ? "flat.xsl" : "nested.xsl";
|
|
@@ -857,9 +896,12 @@
|
|
}
|
|
if(this.selected && obj.children("ul:eq(0)").find("a.clicked").size() > 0) {
|
|
obj.find("li:has(a.clicked)").each(function() {
|
|
- _this.deselect_branch(this);
|
|
+ _this.deselect_branch(this); //Commenting this out could preserve selection on close
|
|
+ //I could see this as extremely useful, however it could be easy for someone to trip up
|
|
+ //with lack of visual cue... perhaps a semi-shaded style for collapsed if wanting to preserve selection
|
|
});
|
|
- if(obj.children("a.clicked").size() == 0) this.select_branch(obj, (this.settings.rules.multiple != false && this.selected_arr.length > 0) );
|
|
+ //I disagree with the following scheme, that an entire group would be selected just for collapsing a selected child..
|
|
+ //if(obj.children("a.clicked").size() == 0) this.select_branch(obj, (this.settings.rules.multiple != false && this.selected_arr.length > 0) );
|
|
}
|
|
this.settings.callback.onclose.call(null, obj.get(0), this);
|
|
},
|
|
@@ -939,10 +981,10 @@
|
|
if((typeof this.settings.lang.new_node).toLowerCase() != "string" && this.settings.lang.new_node[i]) val = this.settings.lang.new_node[i];
|
|
else val = this.settings.lang.new_node;
|
|
}
|
|
- $li.append("<a href='#' class='" + this.settings.languages[i] + "'>" + val + "</a>");
|
|
+ $li.append("<a class='" + this.settings.languages[i] + "'>" + val + "</a>");
|
|
}
|
|
}
|
|
- else { $li.append("<a href='#'>" + (this.settings.lang.new_node || "New folder") + "</a>"); }
|
|
+ else { $li.append("<a>" + (this.settings.lang.new_node || "New folder") + "</a>"); }
|
|
$li.addClass("leaf");
|
|
if(this.settings.rules.createat == "top" || this.selected.children("ul").size() == 0) {
|
|
this.moved($li,this.selected.children("a:eq(0)"),"inside", true);
|
|
@@ -1203,4 +1245,4 @@
|
|
}
|
|
}
|
|
}
|
|
-}
|
|
\ No newline at end of file
|
|
+}
|