').append($(obj).clone()).remove().html();
},
-
+
_debug: function(strMsg) {
if (this._isDebug) {
Sys.Debug.trace("UmbracoTree: " + strMsg);
@@ -668,8 +674,8 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
if (a.hasClass("noSpr")) {
a.attr("style", ins.attr("style"));
}
- else {
-
+ else {
+
}
a.html(txt);
ins.remove();
@@ -708,11 +714,11 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
///
jsTree won't allow you to open a node that doesn't explitly have childen, this will force it to try
///
a jquery object for the current li node
- this._debug("_loadChildNodes: " + liNode);
+ this._debug("_loadChildNodes: " + liNode.attr("id"));
liNode.removeClass("leaf");
this._tree.close_branch(liNode, true);
- liNode.children("ul:eq(0)").html("");
+ liNode.children("ul:eq(0)").remove();
this._tree.open_branch(liNode, false, callback);
},
@@ -823,7 +829,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
this._tree = $.tree.create();
this._tree.init(this._container, this._getInitOptions());
//this._tree.rename = this._umbracoRename; //replaces the jsTree rename method
-
+
//add this app to the loaded apps array
//if ($.inArray(app, this._loadedApps) == -1) {
// this._loadedApps.push(app);
@@ -833,70 +839,70 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
//this._loadChildNodes(this._container.find("li:first"), null);
},
-// _umbracoRename : function (obj) {
-// ///
A modified version of the original jsTree rename method. We need to use our own since
-// /// we've modified the rendering so much. This method replaces the tree rename method.
-// /// 'this' in this method context is jsTree.
-// ///
-// if(this.locked) return this.error("LOCKED");
-// obj = obj ? this.get_node(obj) : this.selected;
-// var _this = this;
-// if(!obj || !obj.size()) return this.error("RENAME: NO NODE SELECTED");
-// if(!this.check("renameable", obj)) return this.error("RENAME: NODE NOT RENAMABLE");
-// if(!this.settings.callback.beforerename.call(null,obj.get(0), _this.current_lang, _this)) return this.error("RENAME: STOPPED BY USER");
+ // _umbracoRename : function (obj) {
+ // ///
A modified version of the original jsTree rename method. We need to use our own since
+ // /// we've modified the rendering so much. This method replaces the tree rename method.
+ // /// 'this' in this method context is jsTree.
+ // ///
+ // if(this.locked) return this.error("LOCKED");
+ // obj = obj ? this.get_node(obj) : this.selected;
+ // var _this = this;
+ // if(!obj || !obj.size()) return this.error("RENAME: NO NODE SELECTED");
+ // if(!this.check("renameable", obj)) return this.error("RENAME: NODE NOT RENAMABLE");
+ // if(!this.settings.callback.beforerename.call(null,obj.get(0), _this.current_lang, _this)) return this.error("RENAME: STOPPED BY USER");
-// obj.parents("li.closed").each(function () { _this.open_branch(this) });
-// //if(this.current_lang) obj = obj.find("a." + this.current_lang).get(0);
-// //else obj = obj.find("a:first").get(0);
-// obj = obj.find("a:first div");
-// last_value = obj.html();
-// _this.inp = $("
");
-// _this.inp
-// .val(last_value.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<"))
-// .bind("mousedown", function (event) { event.stopPropagation(); })
-// .bind("mouseup", function (event) { event.stopPropagation(); })
-// .bind("click", function (event) { event.stopPropagation(); })
-// .bind("keyup", function (event) {
-// var key = event.keyCode || event.which;
-// if(key == 27) { this.value = last_value; this.blur(); return }
-// if(key == 13) { this.blur(); return }
-// });
-// // Rollback
-// var rb = {};
-// rb[this.container.attr("id")] = this.get_rollback();
-//
-//
-// var spn = $("
").addClass($(obj).parent().attr("class")).addClass("renaming").append(_this.inp);
-// spn.attr("style", $(obj).attr("style"));
-// obj.parent().hide();
-//
-// obj.parents("li:first").prepend(spn);
-// //_this.inp.get(0).focus();
-// //_this.inp.get(0).select();
-//
-//// _this.inp.blur(function(event) {
-//// if(this.value == "") this.value = last_value;
-//// var li = obj.parents("li:first")
-//// obj.html(li.find("input").val());
-//// obj.parent().show();
-//// li.find("div.renaming").remove();
-//// _this.settings.callback.onrename.call(null, _this.get_node(li).get(0), _this.current_lang, _this, rb);
-//// _this.inp = false;
-//// });
-// },
+ // obj.parents("li.closed").each(function () { _this.open_branch(this) });
+ // //if(this.current_lang) obj = obj.find("a." + this.current_lang).get(0);
+ // //else obj = obj.find("a:first").get(0);
+ // obj = obj.find("a:first div");
+ // last_value = obj.html();
+ // _this.inp = $("
");
+ // _this.inp
+ // .val(last_value.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<"))
+ // .bind("mousedown", function (event) { event.stopPropagation(); })
+ // .bind("mouseup", function (event) { event.stopPropagation(); })
+ // .bind("click", function (event) { event.stopPropagation(); })
+ // .bind("keyup", function (event) {
+ // var key = event.keyCode || event.which;
+ // if(key == 27) { this.value = last_value; this.blur(); return }
+ // if(key == 13) { this.blur(); return }
+ // });
+ // // Rollback
+ // var rb = {};
+ // rb[this.container.attr("id")] = this.get_rollback();
+ //
+ //
+ // var spn = $("
").addClass($(obj).parent().attr("class")).addClass("renaming").append(_this.inp);
+ // spn.attr("style", $(obj).attr("style"));
+ // obj.parent().hide();
+ //
+ // obj.parents("li:first").prepend(spn);
+ // //_this.inp.get(0).focus();
+ // //_this.inp.get(0).select();
+ //
+ //// _this.inp.blur(function(event) {
+ //// if(this.value == "") this.value = last_value;
+ //// var li = obj.parents("li:first")
+ //// obj.html(li.find("input").val());
+ //// obj.parent().show();
+ //// li.find("div.renaming").remove();
+ //// _this.settings.callback.onrename.call(null, _this.get_node(li).get(0), _this.current_lang, _this, rb);
+ //// _this.inp = false;
+ //// });
+ // },
_getUrlParams: function(nodeSource) {
///
This converts Url query string params to json
var p = {};
var sp = nodeSource.split("?")[1].split("&");
- for(var i=0;i
Returns the json service url
@@ -918,8 +924,8 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
data: {
type: "json",
async: true,
- opts : {
- static: initData == null ? null: initData,
+ opts: {
+ static: initData == null ? null : initData,
method: "POST",
url: _this._serviceUrl,
outer_attrib: ["id", "umb:type", "class", "rel"],
@@ -940,35 +946,35 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
},
callback: {
//ensures that the node id isn't appended to the async url
- beforedata: function(N, T) { return _this.onBeforeRequest(N,T); },
+ beforedata: function(N, T) { return _this.onBeforeRequest(N, T); },
//wrapped functions maintain scope in callback
- beforemove : function(N,RN,TYPE,T) { _this.onBeforeMove(N,RN,TYPE,T); },
+ beforemove: function(N, RN, TYPE, T) { _this.onBeforeMove(N, RN, TYPE, T); },
beforeopen: function(N, T) { _this.onBeforeOpen(N, T); },
onselect: function(N, T) { _this.onSelect(N, T); },
onchange: function(N, T) { _this.onChange(N, T); },
ondata: function(D, T) { return _this.onJSONData(D, T); },
onload: function(T) { if (initData == null) _this.onLoad(T); },
- onparse: function(S,T) { return _this.onParse(S,T); }
+ onparse: function(S, T) { return _this.onParse(S, T); }
},
plugins: {
//UmbracoContext comes before context menu so that the events fire first
UmbracoContext: {
fullMenu: _this._fullMenu,
- onBeforeContext: function(N,T,E) { return _this.onBeforeContext(N,T,E); }
+ onBeforeContext: function(N, T, E) { return _this.onBeforeContext(N, T, E); }
},
contextmenu: {}
}
};
if (this._treeType != "standard") {
- options.plugins.checkbox = {three_state:false}
+ options.plugins.checkbox = { three_state: false }
}
-
+
//set global ajax settings:
$.ajaxSetup({
- contentType: "application/json; charset=utf-8"
+ contentType: "application/json; charset=utf-8"
});
-
+
return options;
}