| rem
				 stringlengths 0 126k | add
				 stringlengths 0 441k | context
				 stringlengths 15 136k | 
|---|---|---|
| 
	gallery.getAlbumPicturesToUser(albumName,SECURITY_TOKEN).addCallback(gallery_getAlbumPicturesResponse); | 
	albumImageToBeLoaded = imageName; albumTags = new Array(); gallery.getAlbumPicturesToUser(albumName,SECURITY_TOKEN).addCallback(gallery_getAlbumPicturesResponse); | 
	function initializeAlbum(albumName) {    try {        this.albumName = albumName;       // gallery.getAlbumPictures(albumName).addCallback(gallery_getAlbumPicturesResponse);          gallery.getAlbumPicturesToUser(albumName,SECURITY_TOKEN).addCallback(gallery_getAlbumPicturesResponse);    } catch(exception) {        alert(e);    }} | 
| 
	gallery.getAlbumPictures(albumName).addCallback(gallery_getAlbumPicturesResponse); | 
	gallery.getAlbumPicturesToUser(albumName,SECURITY_TOKEN).addCallback(gallery_getAlbumPicturesResponse); | 
	function initializeAlbum(albumName) {    try {        this.albumName = albumName;        gallery.getAlbumPictures(albumName).addCallback(gallery_getAlbumPicturesResponse);    } catch(exception) {        alert(e);    }} | 
| 
	var html = "<a href=\"javascript:initializeAlbum('" + albumName + "')\">" + img_html + "</a>"; | 
	var html = "<a href=\"javascript:initializeAlbum('" + albumName + "', null)\">" + img_html + "</a>"; | 
	function initializeGallery() {    var table=document.getElementById('tableGallery');    var lastRow = table.rows.length;    for (i = 0; i < galleryAlbums.length; i++) {        var row = table.insertRow(lastRow++);        var column = row.insertCell(0);        if (albumCovers[i] != null) {            var albumName = galleryAlbums[i].name;            var img = document.createElement("img");            img.src = window.location.href + "gallery/"+ albumName +"/" + albumCovers[i];            var img_html = "<img src=" + img.src + " class=\"slideImage\" width=180px ondragstart=\"return false\" onselectstart=\"return false\" oncontextmenu=\"return false\" galleryimg=\"no\" usemap=\"#imagemap\" alt=\"\"/>";            var html = "<a href=\"javascript:initializeAlbum('" + albumName + "')\">" + img_html + "</a>";            column.innerHTML = html;            column = row.insertCell(1);            column.innerHTML = "<div style=\"width:500\">"+galleryAlbums[i].description+"</div>";            row = table.insertRow(lastRow++);            column = row.insertCell(0)            column.innerHTML = albumName;            row = table.insertRow(lastRow++);            column = row.insertCell(0)            column.innerHTML = "<img src=\"images/space.gif\" class=\"slideImage\" width=\"10\" height=\"10\" ondragstart=\"return false\" onselectstart=\"return false\" oncontextmenu=\"return false\" galleryimg=\"no\" usemap=\"#imagemap\" alt=\"\">";        }   }} | 
| 
	var p = new Jx.Plugin[this.pluginNamespace][plugin.name](plugin.options); | 
	var p = new Jx.Plugin[this.pluginNamespace][plugin.name.capitalize()](plugin.options); | 
	    initPlugins: function () {        //pluginNamespace must be defined in order to pass plugins to the object        if ($defined(this.pluginNamespace)) {            if ($defined(this.options.plugins)                    && Jx.type(this.options.plugins) === 'array') {                this.options.plugins.each(function (plugin) {                    if (plugin instanceof Jx.Plugin) {                        plugin.attach(this);                        this.plugins.set(plugin.name, plugin);                    } else if (Jx.type(plugin) === 'object') {                        //All plugin-enabled objects should define a pluginNamespace member variable                        //that is used for locating the plugins. The default namespace is 'Other' for                        //now until we come up with a better idea                        var p = new Jx.Plugin[this.pluginNamespace][plugin.name](plugin.options);                        p.attach(this);                        //this.plugins.set(p.name, p);                    }                }, this);            }        }    }, | 
| 
	} else if (Jx.type(plugin) === 'string') {  var p = new Jx.Plugin[this.pluginNamespace][plugin.capitalize()](); p.attach(this); | 
	    initPlugins: function () {        //pluginNamespace must be defined in order to pass plugins to the object        if ($defined(this.pluginNamespace)) {            if ($defined(this.options.plugins)                    && Jx.type(this.options.plugins) === 'array') {                this.options.plugins.each(function (plugin) {                    if (plugin instanceof Jx.Plugin) {                        plugin.attach(this);                        this.plugins.set(plugin.name, plugin);                    } else if (Jx.type(plugin) === 'object') {                        //All plugin-enabled objects should define a pluginNamespace member variable                        //that is used for locating the plugins. The default namespace is 'Other' for                        //now until we come up with a better idea                        var p = new Jx.Plugin[this.pluginNamespace][plugin.name](plugin.options);                        p.attach(this);                        //this.plugins.set(p.name, p);                    }                }, this);            }        }    }, | |
| 
	searchService = new dojo.rpc.JsonService( photark.constants.SearchServiceEndpoint ); | 
	function initServices(){    gallery = new dojo.rpc.JsonService( photark.constants.GalleryServiceEndpoint );} | |
| 
	getColumnProperties: function(colid, col, props) {} | 
	getColumnProperties: function(colid, col, props) {}, cycleHeader: function(col) {} | 
	    initView: function() {        treeFeeds = this.preferences.getFeeds();        this.treeView = {            rowCount : NUM_OF_FEEDS,            getCellText : function(row, column) {                if (row < treeFeeds.length) {                    var text = null;                    if (column.id == 'buildmonitor-prefs-feeds-name') {                        text = treeFeeds[row].getName();                    } else if (column.id == 'buildmonitor-prefs-feeds-url') {                        text = treeFeeds[row].getUrl();                    }                    return text;                }            },            isEditable: function isEditable(row, column) {                var isEditable = true;                if (column.id == 'buildmonitor-prefs-feeds-remove' || column.id == 'buildmonitor-prefs-feeds-up' || column.id == 'buildmonitor-prefs-feeds-down') {                    isEditable = false;                }                return isEditable;            },            setCellText : function(row, column, value) {                if (column.id == 'buildmonitor-prefs-feeds-name') {                    treeFeeds[row].setName(value);                } else if (column.id == 'buildmonitor-prefs-feeds-url') {                    treeFeeds[row].setUrl(value);                }            },            setTree: function(treebox) { this.treebox = treebox; },            isContainer: function(row) { return false; },            isSeparator: function(row) { return false; },            isSorted: function() { return false; },            getLevel: function(row) { return 0; },            getImageSrc: function(row, column) {                var imageSrc = null;                if (column.id == 'buildmonitor-prefs-feeds-remove' && !treeFeeds[row].isIgnored()) {                    imageSrc = 'chrome://buildmonitor/skin/menu/remove.png';                } else if (column.id == 'buildmonitor-prefs-feeds-up' && !treeFeeds[row].isIgnored() && row > 0) {                    imageSrc = 'chrome://buildmonitor/skin/menu/up.png';                } else if (column.id == 'buildmonitor-prefs-feeds-down' && !treeFeeds[row].isIgnored() && row < NUM_OF_FEEDS - 1) {                    imageSrc = 'chrome://buildmonitor/skin/menu/down.png';                }                return imageSrc;            },            getRowProperties: function(row, props) {},            getCellProperties: function(row, col, props) {},            getColumnProperties: function(colid, col, props) {}        };        document.getElementById('buildmonitor-prefs-feeds').view = this.treeView;    }, | 
| 
	this.log("inputBlur: loose input component focus"); | 
		inputBlur: function() {		this.log("inputBlur: loose input component focus");		this.input.blur();	},	  | |
| 
	this.log("inputFocus: restore input component focus"); | 
		inputFocus: function() {		this.log("inputFocus: restore input component focus");		this.input.focus();		if (this.getCurrentTextValue().length) {			this.selectAll();    			}				}, | |
| 
	input.style.color = default_color; if (input.value == placeholder) { input.value = ''; } | 
	input.style.color = default_color; if (input.getAttribute('data-placeholder-visible')) { input.setAttribute('data-placeholder-visible', ''); input.value = ''; } | 
	function inputPlaceholder (input, color) {  if (!input) return null;  // Do nothing if placeholder supported by the browser (Webkit, Firefox 3.7)  if (input.placeholder && 'placeholder' in document.createElement(input.tagName)) return input;  color = color || '#AAA';  var default_color = input.style.color;  var placeholder = input.getAttribute('placeholder');  if (input.value === '' || input.value == placeholder) {    input.value = placeholder;    input.style.color = color;  }  var add_event = /*@cc_on'attachEvent'||@*/'addEventListener';  input[add_event](/*@cc_on'on'+@*/'focus', function(){    input.style.color = default_color;    if (input.value == placeholder) {      input.value = '';    }  }, false);  input[add_event](/*@cc_on'on'+@*/'blur', function(){    if (input.value === '') {      input.value = placeholder;      input.style.color = color;    } else {      input.style.color = default_color;    }  }, false);  input.form && input.form[add_event](/*@cc_on'on'+@*/'submit', function(){    if (input.value == placeholder) {      input.value = '';    }  }, false);  return input;} | 
| 
	if (input.value == placeholder) { | 
	if (input.getAttribute('data-placeholder-visible')) { | 
	function inputPlaceholder (input, color) {  if (!input) return null;  // Do nothing if placeholder supported by the browser (Webkit, Firefox 3.7)  if (input.placeholder && 'placeholder' in document.createElement(input.tagName)) return input;  color = color || '#AAA';  var default_color = input.style.color;  var placeholder = input.getAttribute('placeholder');  if (input.value === '' || input.value == placeholder) {    input.value = placeholder;    input.style.color = color;  }  var add_event = /*@cc_on'attachEvent'||@*/'addEventListener';  input[add_event](/*@cc_on'on'+@*/'focus', function(){    input.style.color = default_color;    if (input.value == placeholder) {      input.value = '';    }  }, false);  input[add_event](/*@cc_on'on'+@*/'blur', function(){    if (input.value === '') {      input.value = placeholder;      input.style.color = color;    } else {      input.style.color = default_color;    }  }, false);  input.form && input.form[add_event](/*@cc_on'on'+@*/'submit', function(){    if (input.value == placeholder) {      input.value = '';    }  }, false);  return input;} | 
| 
	if (!this.options.rest) { | 
	if (this.options.rest) { | 
	    insert: function (record, options) {        if (!this.options.rest) {            options = $merge({url: this.options.urls.rest},options);        } else {            options = $merge({url: this.options.urls.insert},options);        }        this.options.requestOptions.method = 'POST';        return this.run(record, options, "insert");    }, | 
| 
	ss.styleSheet.cssText += text; rule = ss.sheet.rules[ss.insertRule.length]; | 
	if (declaration == '') {   declaration = '{}'; } var index = ss.styleSheet.addRule(selector,declaration); rule = ss.styleSheet.rules[index]; | 
	    insertCssRule: function (selector, declaration, styleSheetName) {        var ss = this.getDynamicStyleSheet(styleSheetName);        var rule;        var text = selector + " {" + declaration + "}";        if (Browser.Engine.name === 'trident') {            ss.styleSheet.cssText += text;            rule = ss.sheet.rules[ss.insertRule.length];        } else {            ss.sheet.insertRule(text, ss.indicies.length);            rule = ss.sheet.cssRules[ss.indicies.length];        }        ss.indicies.push(selector);        return rule;    }, | 
| 
	target.find(".tickLabels").remove(); | 
	placeholder.find(".tickLabels").remove(); | 
	        function insertLabels() {            target.find(".tickLabels").remove();                        var html = ['<div class="tickLabels" style="font-size:smaller;color:' + options.grid.color + '">'];            function addLabels(axis, labelGenerator) {                for (var i = 0; i < axis.ticks.length; ++i) {                    var tick = axis.ticks[i];                    if (!tick.label || tick.v < axis.min || tick.v > axis.max)                        continue;                    html.push(labelGenerator(tick, axis));                }            }            var margin = options.grid.labelMargin + options.grid.borderWidth;                        addLabels(axes.xaxis, function (tick, axis) {                return '<div style="position:absolute;top:' + (plotOffset.top + plotHeight + margin) + 'px;left:' + Math.round(plotOffset.left + axis.p2c(tick.v) - axis.labelWidth/2) + 'px;width:' + axis.labelWidth + 'px;text-align:center" class="tickLabel">' + tick.label + "</div>";            });                                    addLabels(axes.yaxis, function (tick, axis) {                return '<div style="position:absolute;top:' + Math.round(plotOffset.top + axis.p2c(tick.v) - axis.labelHeight/2) + 'px;right:' + (plotOffset.right + plotWidth + margin) + 'px;width:' + axis.labelWidth + 'px;text-align:right" class="tickLabel">' + tick.label + "</div>";            });                        addLabels(axes.x2axis, function (tick, axis) {                return '<div style="position:absolute;bottom:' + (plotOffset.bottom + plotHeight + margin) + 'px;left:' + Math.round(plotOffset.left + axis.p2c(tick.v) - axis.labelWidth/2) + 'px;width:' + axis.labelWidth + 'px;text-align:center" class="tickLabel">' + tick.label + "</div>";            });                        addLabels(axes.y2axis, function (tick, axis) {                return '<div style="position:absolute;top:' + Math.round(plotOffset.top + axis.p2c(tick.v) - axis.labelHeight/2) + 'px;left:' + (plotOffset.left + plotWidth + margin) +'px;width:' + axis.labelWidth + 'px;text-align:left" class="tickLabel">' + tick.label + "</div>";            });            html.push('</div>');                        target.append(html.join(""));        } | 
| 
	target.append(html.join("")); | 
	placeholder.append(html.join("")); | 
	        function insertLabels() {            target.find(".tickLabels").remove();                        var html = ['<div class="tickLabels" style="font-size:smaller;color:' + options.grid.color + '">'];            function addLabels(axis, labelGenerator) {                for (var i = 0; i < axis.ticks.length; ++i) {                    var tick = axis.ticks[i];                    if (!tick.label || tick.v < axis.min || tick.v > axis.max)                        continue;                    html.push(labelGenerator(tick, axis));                }            }            var margin = options.grid.labelMargin + options.grid.borderWidth;                        addLabels(axes.xaxis, function (tick, axis) {                return '<div style="position:absolute;top:' + (plotOffset.top + plotHeight + margin) + 'px;left:' + Math.round(plotOffset.left + axis.p2c(tick.v) - axis.labelWidth/2) + 'px;width:' + axis.labelWidth + 'px;text-align:center" class="tickLabel">' + tick.label + "</div>";            });                                    addLabels(axes.yaxis, function (tick, axis) {                return '<div style="position:absolute;top:' + Math.round(plotOffset.top + axis.p2c(tick.v) - axis.labelHeight/2) + 'px;right:' + (plotOffset.right + plotWidth + margin) + 'px;width:' + axis.labelWidth + 'px;text-align:right" class="tickLabel">' + tick.label + "</div>";            });                        addLabels(axes.x2axis, function (tick, axis) {                return '<div style="position:absolute;bottom:' + (plotOffset.bottom + plotHeight + margin) + 'px;left:' + Math.round(plotOffset.left + axis.p2c(tick.v) - axis.labelWidth/2) + 'px;width:' + axis.labelWidth + 'px;text-align:center" class="tickLabel">' + tick.label + "</div>";            });                        addLabels(axes.y2axis, function (tick, axis) {                return '<div style="position:absolute;top:' + Math.round(plotOffset.top + axis.p2c(tick.v) - axis.labelHeight/2) + 'px;left:' + (plotOffset.left + plotWidth + margin) +'px;width:' + axis.labelWidth + 'px;text-align:left" class="tickLabel">' + tick.label + "</div>";            });            html.push('</div>');                        target.append(html.join(""));        } | 
| 
	return this.button.isActive(); | 
	return this.button ? this.button.isActive() : this.options.active; | 
	    isActive: function() {        return this.button.isActive();    }, | 
| 
	var date=getDateFromFormat(val,format); | 
	var date=com_mattkruse_getDateFromFormat(val,format); | 
	function isDate(val,format) {    var date=getDateFromFormat(val,format);	if (date==0) { return false; }	return true;	} | 
| 
	return this.button.isEnabled; | 
	return this.button ? this.button.isEnabled() : this.options.enabled ; | 
	    isEnabled: function() {        return this.button.isEnabled;    }, | 
| 
	return i == len && $.isFunction(obj) ? obj : false; | 
	return obj && i == len && typeof obj != 'string' && !obj.nodeName && obj.constructor != Array && /^[\s[]?function/.test(obj + '') ? obj : false; | 
	var isFunc = function(str, scope) {  var obj = scope || appWindow;  var parts = str.split('.'), len = parts.length;  for (var i = 0; i < len && (obj = obj[parts[i]]); i++);  return i == len && $.isFunction(obj) ? obj : false;} | 
| 
	for (i=0; i < sText.length && IsNumber == true; i++) { | 
	for (var i=0; i < sText.length && IsNumber == true; i++) { | 
	function IsNumeric(sText) {  var ValidChars = "0123456789";  var IsNumber=true;  var Char;  for (i=0; i < sText.length && IsNumber == true; i++) {     Char = sText.charAt(i);     if (ValidChars.indexOf(Char) == -1) {      IsNumber = false;    }  }  return IsNumber;} | 
| 
	In2iGui.callDelegates(this,'itemWasClicked',value); In2iGui.callDelegates(this,'select',value); | 
	this.fire('itemWasClicked',value); this.fire('select',value); | 
		itemWasClicked : function(value) {		this.value = value;		In2iGui.callDelegates(this,'itemWasClicked',value);		In2iGui.callDelegates(this,'select',value);		this.hide();	}, | 
| 
	searchStr = searchStr + key + '=' + escape(params[key][i]) + '&'; | 
	searchStr = searchStr + key + '=' + encodeURIComponent(params[key][i]) + '&'; | 
	Testopia.Util.JSONToURLQuery = function(params, searchStr, drops){    searchStr = searchStr || '';    for (var key in params) {        if (drops.indexOf(key) != -1) {            continue;        }        if (typeof params[key] == 'object') {            for (i = 0; i < params[key].length; i++) {                searchStr = searchStr + key + '=' + escape(params[key][i]) + '&';            }        }        else {            searchStr = searchStr + key + '=' + escape(params[key]) + '&';        }    }    if (searchStr.lastIndexOf('&') == searchStr.length - 1) {        searchStr = searchStr.substr(0, searchStr.length - 1);    }    return searchStr;}; | 
| 
	searchStr = searchStr + key + '=' + escape(params[key]) + '&'; | 
	searchStr = searchStr + key + '=' + encodeURIComponent(params[key]) + '&'; | 
	Testopia.Util.JSONToURLQuery = function(params, searchStr, drops){    searchStr = searchStr || '';    for (var key in params) {        if (drops.indexOf(key) != -1) {            continue;        }        if (typeof params[key] == 'object') {            for (i = 0; i < params[key].length; i++) {                searchStr = searchStr + key + '=' + escape(params[key][i]) + '&';            }        }        else {            searchStr = searchStr + key + '=' + escape(params[key]) + '&';        }    }    if (searchStr.lastIndexOf('&') == searchStr.length - 1) {        searchStr = searchStr.substr(0, searchStr.length - 1);    }    return searchStr;}; | 
| 
	function key(k) { | 
	key = function(k) { | 
	  function key(k) {    unused[k] = false;    if (keys[k])      return true;  } | 
| 
	if (keys[k]) | 
	if (keyState[k]) | 
	  function key(k) {    unused[k] = false;    if (keys[k])      return true;  } | 
| 
	key.used[k] = true; | 
	key.unused[k] = false; | 
	function key(k) {  key.used[k] = true;  if (key.keys[k])    return true;} | 
| 
	}; | 
	} | 
	  function lastChildOf(node) {    return $("table.treeTable tbody tr." + options.childPrefix + node[0].id+":last");  }; | 
| 
	dbg(line); | 
	function lastNonEmptyLine(line){    while (true) {        dbg(line);        line = document.prevNonEmptyLine(line);        dbg(line);        if ( line == -1 ) {            return -1;        }        var string = document.line(line).ltrim();        dbg(string);dbg(string.startsWith('#'));dbg(string.startsWith("//"));        ///TODO: cpp multiline comments        ///TODO: multiline macros        if ( string.startsWith("//") || string.startsWith('#') ) {            --line;            continue;        }        break;    }    return line;} | |
| 
	dbg(string);dbg(string.startsWith('#'));dbg(string.startsWith(" | 
	function lastNonEmptyLine(line){    while (true) {        dbg(line);        line = document.prevNonEmptyLine(line);        dbg(line);        if ( line == -1 ) {            return -1;        }        var string = document.line(line).ltrim();        dbg(string);dbg(string.startsWith('#'));dbg(string.startsWith("//"));        ///TODO: cpp multiline comments        ///TODO: multiline macros        if ( string.startsWith("//") || string.startsWith('#') ) {            --line;            continue;        }        break;    }    return line;} | |
| 
	this.set_article_path = function () { | 
	function set_article_path(e) { | 
	function LBCodeEditor() {		this.short_forms = Array();	this.abbrev_phrases = Array();	this.acronym_phrases = Array();		this.add_acr = function (shrt, lng) {		var len = this.short_forms.push(shrt);		this.acronym_phrases[len-1] = lng;	}		this.add_abbr = function (shrt, lng) {		var len = this.short_forms.push(shrt);		this.abbrev_phrases[len-1] = lng;	}		this.get_abbr = function (shrt) {		var i=0;		for (i=0; i < this.short_forms.length; i++) 			if (this.short_forms[i] == shrt) {				if (this.abbrev_phrases[i]) return this.abbrev_phrases[i];				else return '';			}		return '';	}		this.get_acr = function (shrt) {		var i=0;		for (i=0; i < this.short_forms.length; i++) 			if (this.short_forms[i] == shrt) {				if (this.acronym_phrases[i]) return this.acronym_phrases[i];				else return '';			}		return '';	}		this.one_parm = function (type, prompt_text) {		var text_str;		if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			text_str = document.getElementById("desc_txt").value;			document.getElementById("desc_txt").value = '';		} else if (lnblog.getSelection(document.getElementById("body"))) {			text_str = lnblog.getSelection(document.getElementById("body"));		} else {			text_str = window.prompt(prompt_text);		}		if (! text_str) return false;		lnblog.insertAtCursor(			document.getElementById("body"), 			'[' + type + ']' + text_str + '[/' + type + ']');		return false;	}		this.two_parm = function (type, prompt_text, meta_text) {				var desc_str;		var meta_str;				if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			desc_str = document.getElementById("desc_txt").value;		} else if (lnblog.getSelection(document.getElementById("body"))) {			desc_str = lnblog.getSelection(document.getElementById("body"));		} else {			desc_str = window.prompt(prompt_text);		}			if (! desc_str) return false;				if (type == 'ab' || type == 'ac') {						if (type == 'ab') meta_str = this.get_abbr(desc_str);			else meta_str = this.get_acr(desc_str);				if (meta_str == '') {				if (document.getElementById("editboxes") &&					document.getElementById("editboxes").style.display == "block") {					meta_str = document.getElementById("meta_txt").value;				} else {					meta_str = window.prompt(meta_text);				}				if (! meta_str) return false;				if (type == 'ab') this.add_abbr(desc_str, meta_str);				else this.add_acr(desc_str, meta_str);			}					} else {			if (document.getElementById("editboxes") &&				document.getElementById("editboxes").style.display == "block") {				meta_str = document.getElementById("meta_txt").value;			} else {				meta_str = window.prompt(meta_text);			}		}				if (! meta_str) return false;				lnblog.insertAtCursor(			document.getElementById("body"),			'[' + type + '=' + meta_str + ']' +	desc_str + '[/' + type + ']');			return false;		}		this.opt_parm = function (type, prompt_text, meta_text) {			var desc_str;		var meta_str;		var data_str;				if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			desc_str = document.getElementById("desc_txt").value;		} else if (lnblog.getSelection(document.getElementById("body"))) {			desc_str = lnblog.getSelection(document.getElementById("body"));		} else {			desc_str = window.prompt(prompt_text);		}			if (! desc_str) return false;				if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			meta_str = document.getElementById("meta_txt").value;		} else {			meta_str = window.prompt(meta_text);		}			if (! meta_str) meta_str = '';				data_str = '[' + type;		if (meta_str == '') {			data_str = '[' + type + ']' + desc_str + '[/' + type + ']'		} else {			data_str = '[' + type + '=' + meta_str + ']' + desc_str + '[/' + type + ']'		}				lnblog.insertAtCursor(			document.getElementById("body"), data_str);		return false;		}		this.set_color = function (text_prompt, attr_prompt) {			var text_str;		var color_str;		var data_str;				if (lnblog.getSelection(document.getElementById("body"))) {			text_str = lnblog.getSelection(document.getElementById("body"));		} else {			text_str = window.prompt(text_prompt);		}				if (! text_str) return false;				var color = document.getElementById('colorselect');		if (color.value == 'custom') {			color_str = window.prompt(attr_prompt);		} else {			color_str = color.value;		}				if (color_str == undefined) return false;			data_str = '[color='+color_str+']'+text_str+'[/color]';				lnblog.insertAtCursor(document.getElementById("body"), data_str);		return false;		}		this.set_img = function (text_prompt, attr_prompt) {			var text_str;		var url_str;		var tag_str;		var data_str;				if (lnblog.getSelection(document.getElementById("body"))) {			text_str = lnblog.getSelection(document.getElementById("body"));		} else {			text_str = window.prompt(text_prompt);		}				if (! text_str) return false;				url_str = window.prompt(attr_prompt);		if (! url_str) return false;				var alignbox = document.getElementById('imgalign');		if (alignbox.value == 'center') {			tag_str = 'img';		} else {			tag_str = 'img-'+alignbox.value;		}				data_str = '['+tag_str+'='+url_str+']'+text_str+'[/'+tag_str+']';				lnblog.insertAtCursor(document.getElementById("body"), data_str);		return false;		}			this.insertChar = function (type) {		lnblog.insertAtCursor(document.getElementById("body"), type);		return true;	}		this.insertEntity = function (type) {		insertChar('&'+type+';');		return true;	}		this.toggle_show = function (ctrl, caller) {		var cnt = document.getElementById(ctrl);		var block_hidden = false;			if (! cnt.style.display && caller.innerHTML == "(+)") {			block_hidden = true;		}				if (cnt.style.display == "none" ||  block_hidden) {			cnt.style.display = "inline";			caller.innerHTML = "(-)";		} else {			cnt.style.display = "none";			caller.innerHTML = "(+)";		}	}		this.set_article_path = function () {		var subj = document.getElementById("subject").value;		var path = subj.toLowerCase();		if (document.getElementById("short_path").value) return true;		path = path.replace(/\W+/g, " ");		path = path.replace(/^ */, "");		path = path.replace(/ *$/, "");		path = path.replace(/\W+/g, "_");		document.getElementById("short_path").value = path;		return true;	}		function toggle_lbcode_editor(ev) {		var lbcode = document.getElementById('lbcode_editor');		var dropdown = document.getElementById('input_mode');		if (lbcode) {			if (dropdown.value == 1) lbcode.style.display = 'inline';			else lbcode.style.display = 'none';		}		return true;	}		function toggle_post_settings(ev) {		var settings = document.getElementById('entry_settings');		var divs = settings.getElementsByTagName('div');		var leg = settings.getElementsByTagName('legend');		var leglink = leg[0].getElementsByTagName('a');				if (leglink[0].innerHTML == '(+)') { 			leglink[0].innerHTML = '(-)';		} else { 			leglink[0].innerHTML = '(+)';		}				for (i = 0; i < divs.length; i++) {			if (divs[i].style.display == 'none') divs[i].style.display = 'block';			else divs[i].style.display = 'none';		}			return false;	}		function topic_add_tag(e) {		var tags = document.getElementById('tags');		var tagsel = document.getElementById('tag_list');		if (tags.value == '') {			tags.value = tagsel.value;		} else if (tagsel.value != '') {			tags.value = tags.value+','+tagsel.value;		}	}		function upload_add_link(e) {		var ext = this.value.replace(/^(.*)(\..+)$/, "$2");		var img_exts = new Array('.png', '.jpg', '.jpeg', '.bmp', '.gif', '.tiff', '.tif');		var is_img = false;			var check_add = document.getElementById("adduploadlink");		if (check_add && ! check_add.checked) return false;			for (i=0; i< img_exts.length; i++) {			if (img_exts[i] == ext) {				is_img = true;				break;			}		}			var components = new Array();		var splitchar = '';		if (this.value.indexOf("\\") > 0 && this.value.indexOf("/") < 0) {			splitchar = "\\";		} else {			splitchar = "/";		}		components = this.value.split(splitchar);		var fname = components[components.length - 1];			var prompt_text = false;  // Prompt user for descriptive text.		                          // The alternative is just using the filename.			if (prompt_text) {				if (is_img) {				var res = window.prompt(strings.get('editor_addImageDesc', this.value));			} else {				var res = window.prompt(strings.get('editor_addLinkDesc', this.value));			}			} else {			res = fname;		}				if (res) {			var body = document.getElementById('body');			if (is_img) {				if (document.getElementById('input_mode').value == 1) {					lnblog.insertAtCursor(body, '[img='+fname+']'+res+'[/img]');				} else {					lnblog.insertAtCursor(body, "<img src=\""+fname+"\" alt=\""+res+"\" title=\""+res+"\" />");				}			} else {				if (document.getElementById('input_mode').value == 1) {					lnblog.insertAtCursor(body, '[url='+fname+']'+res+'[/url]');				} else {					lnblog.insertAtCursor(body, "<a href=\""+fname+"\">"+res+"</a>");				}			}		}	}		function articleSet(e) {		var path = document.getElementById('articlepath');		var isart = document.getElementById('publisharticle');		if (isart.checked) path.style.display = 'block';		else path.style.display = 'none';	}		this.document_add_all_events = function (e) {			// Toggle the LBCode editor on or off depending on the markup setting.		var inputmode = document.getElementById('input_mode');		lnblog.addEvent(inputmode, 'change', toggle_lbcode_editor);		toggle_lbcode_editor();				// Toggle the extended settings fields on or off.		var setfld = document.getElementById('entry_settings');		var setleg = setfld.getElementsByTagName('legend');		lnblog.addEvent(setleg[0], 'click', toggle_post_settings);		toggle_post_settings();			// Add event handlers to file upload boxes.		var uploads = document.getElementsByTagName('input');		for (i=0; i< uploads.length; i++) {			if (uploads[i].type == 'file') {				lnblog.addEvent(uploads[i], 'change', upload_add_link);			}		}				var tagsel = document.getElementById('tag_list');		lnblog.addEvent(tagsel, 'change', topic_add_tag);				var pubart = document.getElementById('publisharticle');		if (pubart) {			lnblog.addEvent(pubart, 'change', articleSet);			articleSet();		}				var preview = document.getElementById('preview');		lnblog.addEvent(preview, 'click', 			function(e) {				var has_files = false;				var i = 1;				var max_uploads = 20;				var upld;							postform = document.getElementById('postform');								while (upld = document.getElementById('upload'+i) && i < max_uploads) {					if (upld.value) {						has_files = true;						break;					}					i++;				}								if (has_files) {					var ret = window.confirm(strings.editor_submitWithFiles);					if (ret) {											postform.action = postform.action + '&save=draft';						return true;					} else {						return false;					}				} else {					return true;				}			});				document.getElementById('subject').focus();				return true;	}		//document.onload = function (e) { window.alert("FOO"); }	lnblog.addEvent(window, 'load', this.document_add_all_events);} | 
| 
	this.document_add_all_events = function (e) { | 
	function document_add_all_events (e) { | 
	function LBCodeEditor() {		this.short_forms = Array();	this.abbrev_phrases = Array();	this.acronym_phrases = Array();		this.add_acr = function (shrt, lng) {		var len = this.short_forms.push(shrt);		this.acronym_phrases[len-1] = lng;	}		this.add_abbr = function (shrt, lng) {		var len = this.short_forms.push(shrt);		this.abbrev_phrases[len-1] = lng;	}		this.get_abbr = function (shrt) {		var i=0;		for (i=0; i < this.short_forms.length; i++) 			if (this.short_forms[i] == shrt) {				if (this.abbrev_phrases[i]) return this.abbrev_phrases[i];				else return '';			}		return '';	}		this.get_acr = function (shrt) {		var i=0;		for (i=0; i < this.short_forms.length; i++) 			if (this.short_forms[i] == shrt) {				if (this.acronym_phrases[i]) return this.acronym_phrases[i];				else return '';			}		return '';	}		this.one_parm = function (type, prompt_text) {		var text_str;		if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			text_str = document.getElementById("desc_txt").value;			document.getElementById("desc_txt").value = '';		} else if (lnblog.getSelection(document.getElementById("body"))) {			text_str = lnblog.getSelection(document.getElementById("body"));		} else {			text_str = window.prompt(prompt_text);		}		if (! text_str) return false;		lnblog.insertAtCursor(			document.getElementById("body"), 			'[' + type + ']' + text_str + '[/' + type + ']');		return false;	}		this.two_parm = function (type, prompt_text, meta_text) {				var desc_str;		var meta_str;				if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			desc_str = document.getElementById("desc_txt").value;		} else if (lnblog.getSelection(document.getElementById("body"))) {			desc_str = lnblog.getSelection(document.getElementById("body"));		} else {			desc_str = window.prompt(prompt_text);		}			if (! desc_str) return false;				if (type == 'ab' || type == 'ac') {						if (type == 'ab') meta_str = this.get_abbr(desc_str);			else meta_str = this.get_acr(desc_str);				if (meta_str == '') {				if (document.getElementById("editboxes") &&					document.getElementById("editboxes").style.display == "block") {					meta_str = document.getElementById("meta_txt").value;				} else {					meta_str = window.prompt(meta_text);				}				if (! meta_str) return false;				if (type == 'ab') this.add_abbr(desc_str, meta_str);				else this.add_acr(desc_str, meta_str);			}					} else {			if (document.getElementById("editboxes") &&				document.getElementById("editboxes").style.display == "block") {				meta_str = document.getElementById("meta_txt").value;			} else {				meta_str = window.prompt(meta_text);			}		}				if (! meta_str) return false;				lnblog.insertAtCursor(			document.getElementById("body"),			'[' + type + '=' + meta_str + ']' +	desc_str + '[/' + type + ']');			return false;		}		this.opt_parm = function (type, prompt_text, meta_text) {			var desc_str;		var meta_str;		var data_str;				if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			desc_str = document.getElementById("desc_txt").value;		} else if (lnblog.getSelection(document.getElementById("body"))) {			desc_str = lnblog.getSelection(document.getElementById("body"));		} else {			desc_str = window.prompt(prompt_text);		}			if (! desc_str) return false;				if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			meta_str = document.getElementById("meta_txt").value;		} else {			meta_str = window.prompt(meta_text);		}			if (! meta_str) meta_str = '';				data_str = '[' + type;		if (meta_str == '') {			data_str = '[' + type + ']' + desc_str + '[/' + type + ']'		} else {			data_str = '[' + type + '=' + meta_str + ']' + desc_str + '[/' + type + ']'		}				lnblog.insertAtCursor(			document.getElementById("body"), data_str);		return false;		}		this.set_color = function (text_prompt, attr_prompt) {			var text_str;		var color_str;		var data_str;				if (lnblog.getSelection(document.getElementById("body"))) {			text_str = lnblog.getSelection(document.getElementById("body"));		} else {			text_str = window.prompt(text_prompt);		}				if (! text_str) return false;				var color = document.getElementById('colorselect');		if (color.value == 'custom') {			color_str = window.prompt(attr_prompt);		} else {			color_str = color.value;		}				if (color_str == undefined) return false;			data_str = '[color='+color_str+']'+text_str+'[/color]';				lnblog.insertAtCursor(document.getElementById("body"), data_str);		return false;		}		this.set_img = function (text_prompt, attr_prompt) {			var text_str;		var url_str;		var tag_str;		var data_str;				if (lnblog.getSelection(document.getElementById("body"))) {			text_str = lnblog.getSelection(document.getElementById("body"));		} else {			text_str = window.prompt(text_prompt);		}				if (! text_str) return false;				url_str = window.prompt(attr_prompt);		if (! url_str) return false;				var alignbox = document.getElementById('imgalign');		if (alignbox.value == 'center') {			tag_str = 'img';		} else {			tag_str = 'img-'+alignbox.value;		}				data_str = '['+tag_str+'='+url_str+']'+text_str+'[/'+tag_str+']';				lnblog.insertAtCursor(document.getElementById("body"), data_str);		return false;		}			this.insertChar = function (type) {		lnblog.insertAtCursor(document.getElementById("body"), type);		return true;	}		this.insertEntity = function (type) {		insertChar('&'+type+';');		return true;	}		this.toggle_show = function (ctrl, caller) {		var cnt = document.getElementById(ctrl);		var block_hidden = false;			if (! cnt.style.display && caller.innerHTML == "(+)") {			block_hidden = true;		}				if (cnt.style.display == "none" ||  block_hidden) {			cnt.style.display = "inline";			caller.innerHTML = "(-)";		} else {			cnt.style.display = "none";			caller.innerHTML = "(+)";		}	}		this.set_article_path = function () {		var subj = document.getElementById("subject").value;		var path = subj.toLowerCase();		if (document.getElementById("short_path").value) return true;		path = path.replace(/\W+/g, " ");		path = path.replace(/^ */, "");		path = path.replace(/ *$/, "");		path = path.replace(/\W+/g, "_");		document.getElementById("short_path").value = path;		return true;	}		function toggle_lbcode_editor(ev) {		var lbcode = document.getElementById('lbcode_editor');		var dropdown = document.getElementById('input_mode');		if (lbcode) {			if (dropdown.value == 1) lbcode.style.display = 'inline';			else lbcode.style.display = 'none';		}		return true;	}		function toggle_post_settings(ev) {		var settings = document.getElementById('entry_settings');		var divs = settings.getElementsByTagName('div');		var leg = settings.getElementsByTagName('legend');		var leglink = leg[0].getElementsByTagName('a');				if (leglink[0].innerHTML == '(+)') { 			leglink[0].innerHTML = '(-)';		} else { 			leglink[0].innerHTML = '(+)';		}				for (i = 0; i < divs.length; i++) {			if (divs[i].style.display == 'none') divs[i].style.display = 'block';			else divs[i].style.display = 'none';		}			return false;	}		function topic_add_tag(e) {		var tags = document.getElementById('tags');		var tagsel = document.getElementById('tag_list');		if (tags.value == '') {			tags.value = tagsel.value;		} else if (tagsel.value != '') {			tags.value = tags.value+','+tagsel.value;		}	}		function upload_add_link(e) {		var ext = this.value.replace(/^(.*)(\..+)$/, "$2");		var img_exts = new Array('.png', '.jpg', '.jpeg', '.bmp', '.gif', '.tiff', '.tif');		var is_img = false;			var check_add = document.getElementById("adduploadlink");		if (check_add && ! check_add.checked) return false;			for (i=0; i< img_exts.length; i++) {			if (img_exts[i] == ext) {				is_img = true;				break;			}		}			var components = new Array();		var splitchar = '';		if (this.value.indexOf("\\") > 0 && this.value.indexOf("/") < 0) {			splitchar = "\\";		} else {			splitchar = "/";		}		components = this.value.split(splitchar);		var fname = components[components.length - 1];			var prompt_text = false;  // Prompt user for descriptive text.		                          // The alternative is just using the filename.			if (prompt_text) {				if (is_img) {				var res = window.prompt(strings.get('editor_addImageDesc', this.value));			} else {				var res = window.prompt(strings.get('editor_addLinkDesc', this.value));			}			} else {			res = fname;		}				if (res) {			var body = document.getElementById('body');			if (is_img) {				if (document.getElementById('input_mode').value == 1) {					lnblog.insertAtCursor(body, '[img='+fname+']'+res+'[/img]');				} else {					lnblog.insertAtCursor(body, "<img src=\""+fname+"\" alt=\""+res+"\" title=\""+res+"\" />");				}			} else {				if (document.getElementById('input_mode').value == 1) {					lnblog.insertAtCursor(body, '[url='+fname+']'+res+'[/url]');				} else {					lnblog.insertAtCursor(body, "<a href=\""+fname+"\">"+res+"</a>");				}			}		}	}		function articleSet(e) {		var path = document.getElementById('articlepath');		var isart = document.getElementById('publisharticle');		if (isart.checked) path.style.display = 'block';		else path.style.display = 'none';	}		this.document_add_all_events = function (e) {			// Toggle the LBCode editor on or off depending on the markup setting.		var inputmode = document.getElementById('input_mode');		lnblog.addEvent(inputmode, 'change', toggle_lbcode_editor);		toggle_lbcode_editor();				// Toggle the extended settings fields on or off.		var setfld = document.getElementById('entry_settings');		var setleg = setfld.getElementsByTagName('legend');		lnblog.addEvent(setleg[0], 'click', toggle_post_settings);		toggle_post_settings();			// Add event handlers to file upload boxes.		var uploads = document.getElementsByTagName('input');		for (i=0; i< uploads.length; i++) {			if (uploads[i].type == 'file') {				lnblog.addEvent(uploads[i], 'change', upload_add_link);			}		}				var tagsel = document.getElementById('tag_list');		lnblog.addEvent(tagsel, 'change', topic_add_tag);				var pubart = document.getElementById('publisharticle');		if (pubart) {			lnblog.addEvent(pubart, 'change', articleSet);			articleSet();		}				var preview = document.getElementById('preview');		lnblog.addEvent(preview, 'click', 			function(e) {				var has_files = false;				var i = 1;				var max_uploads = 20;				var upld;							postform = document.getElementById('postform');								while (upld = document.getElementById('upload'+i) && i < max_uploads) {					if (upld.value) {						has_files = true;						break;					}					i++;				}								if (has_files) {					var ret = window.confirm(strings.editor_submitWithFiles);					if (ret) {											postform.action = postform.action + '&save=draft';						return true;					} else {						return false;					}				} else {					return true;				}			});				document.getElementById('subject').focus();				return true;	}		//document.onload = function (e) { window.alert("FOO"); }	lnblog.addEvent(window, 'load', this.document_add_all_events);} | 
| 
	lnblog.addEvent(window, 'load', this.document_add_all_events); | 
	lnblog.addEvent(window, 'load', document_add_all_events); | 
	function LBCodeEditor() {		this.short_forms = Array();	this.abbrev_phrases = Array();	this.acronym_phrases = Array();		this.add_acr = function (shrt, lng) {		var len = this.short_forms.push(shrt);		this.acronym_phrases[len-1] = lng;	}		this.add_abbr = function (shrt, lng) {		var len = this.short_forms.push(shrt);		this.abbrev_phrases[len-1] = lng;	}		this.get_abbr = function (shrt) {		var i=0;		for (i=0; i < this.short_forms.length; i++) 			if (this.short_forms[i] == shrt) {				if (this.abbrev_phrases[i]) return this.abbrev_phrases[i];				else return '';			}		return '';	}		this.get_acr = function (shrt) {		var i=0;		for (i=0; i < this.short_forms.length; i++) 			if (this.short_forms[i] == shrt) {				if (this.acronym_phrases[i]) return this.acronym_phrases[i];				else return '';			}		return '';	}		this.one_parm = function (type, prompt_text) {		var text_str;		if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			text_str = document.getElementById("desc_txt").value;			document.getElementById("desc_txt").value = '';		} else if (lnblog.getSelection(document.getElementById("body"))) {			text_str = lnblog.getSelection(document.getElementById("body"));		} else {			text_str = window.prompt(prompt_text);		}		if (! text_str) return false;		lnblog.insertAtCursor(			document.getElementById("body"), 			'[' + type + ']' + text_str + '[/' + type + ']');		return false;	}		this.two_parm = function (type, prompt_text, meta_text) {				var desc_str;		var meta_str;				if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			desc_str = document.getElementById("desc_txt").value;		} else if (lnblog.getSelection(document.getElementById("body"))) {			desc_str = lnblog.getSelection(document.getElementById("body"));		} else {			desc_str = window.prompt(prompt_text);		}			if (! desc_str) return false;				if (type == 'ab' || type == 'ac') {						if (type == 'ab') meta_str = this.get_abbr(desc_str);			else meta_str = this.get_acr(desc_str);				if (meta_str == '') {				if (document.getElementById("editboxes") &&					document.getElementById("editboxes").style.display == "block") {					meta_str = document.getElementById("meta_txt").value;				} else {					meta_str = window.prompt(meta_text);				}				if (! meta_str) return false;				if (type == 'ab') this.add_abbr(desc_str, meta_str);				else this.add_acr(desc_str, meta_str);			}					} else {			if (document.getElementById("editboxes") &&				document.getElementById("editboxes").style.display == "block") {				meta_str = document.getElementById("meta_txt").value;			} else {				meta_str = window.prompt(meta_text);			}		}				if (! meta_str) return false;				lnblog.insertAtCursor(			document.getElementById("body"),			'[' + type + '=' + meta_str + ']' +	desc_str + '[/' + type + ']');			return false;		}		this.opt_parm = function (type, prompt_text, meta_text) {			var desc_str;		var meta_str;		var data_str;				if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			desc_str = document.getElementById("desc_txt").value;		} else if (lnblog.getSelection(document.getElementById("body"))) {			desc_str = lnblog.getSelection(document.getElementById("body"));		} else {			desc_str = window.prompt(prompt_text);		}			if (! desc_str) return false;				if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			meta_str = document.getElementById("meta_txt").value;		} else {			meta_str = window.prompt(meta_text);		}			if (! meta_str) meta_str = '';				data_str = '[' + type;		if (meta_str == '') {			data_str = '[' + type + ']' + desc_str + '[/' + type + ']'		} else {			data_str = '[' + type + '=' + meta_str + ']' + desc_str + '[/' + type + ']'		}				lnblog.insertAtCursor(			document.getElementById("body"), data_str);		return false;		}		this.set_color = function (text_prompt, attr_prompt) {			var text_str;		var color_str;		var data_str;				if (lnblog.getSelection(document.getElementById("body"))) {			text_str = lnblog.getSelection(document.getElementById("body"));		} else {			text_str = window.prompt(text_prompt);		}				if (! text_str) return false;				var color = document.getElementById('colorselect');		if (color.value == 'custom') {			color_str = window.prompt(attr_prompt);		} else {			color_str = color.value;		}				if (color_str == undefined) return false;			data_str = '[color='+color_str+']'+text_str+'[/color]';				lnblog.insertAtCursor(document.getElementById("body"), data_str);		return false;		}		this.set_img = function (text_prompt, attr_prompt) {			var text_str;		var url_str;		var tag_str;		var data_str;				if (lnblog.getSelection(document.getElementById("body"))) {			text_str = lnblog.getSelection(document.getElementById("body"));		} else {			text_str = window.prompt(text_prompt);		}				if (! text_str) return false;				url_str = window.prompt(attr_prompt);		if (! url_str) return false;				var alignbox = document.getElementById('imgalign');		if (alignbox.value == 'center') {			tag_str = 'img';		} else {			tag_str = 'img-'+alignbox.value;		}				data_str = '['+tag_str+'='+url_str+']'+text_str+'[/'+tag_str+']';				lnblog.insertAtCursor(document.getElementById("body"), data_str);		return false;		}			this.insertChar = function (type) {		lnblog.insertAtCursor(document.getElementById("body"), type);		return true;	}		this.insertEntity = function (type) {		insertChar('&'+type+';');		return true;	}		this.toggle_show = function (ctrl, caller) {		var cnt = document.getElementById(ctrl);		var block_hidden = false;			if (! cnt.style.display && caller.innerHTML == "(+)") {			block_hidden = true;		}				if (cnt.style.display == "none" ||  block_hidden) {			cnt.style.display = "inline";			caller.innerHTML = "(-)";		} else {			cnt.style.display = "none";			caller.innerHTML = "(+)";		}	}		this.set_article_path = function () {		var subj = document.getElementById("subject").value;		var path = subj.toLowerCase();		if (document.getElementById("short_path").value) return true;		path = path.replace(/\W+/g, " ");		path = path.replace(/^ */, "");		path = path.replace(/ *$/, "");		path = path.replace(/\W+/g, "_");		document.getElementById("short_path").value = path;		return true;	}		function toggle_lbcode_editor(ev) {		var lbcode = document.getElementById('lbcode_editor');		var dropdown = document.getElementById('input_mode');		if (lbcode) {			if (dropdown.value == 1) lbcode.style.display = 'inline';			else lbcode.style.display = 'none';		}		return true;	}		function toggle_post_settings(ev) {		var settings = document.getElementById('entry_settings');		var divs = settings.getElementsByTagName('div');		var leg = settings.getElementsByTagName('legend');		var leglink = leg[0].getElementsByTagName('a');				if (leglink[0].innerHTML == '(+)') { 			leglink[0].innerHTML = '(-)';		} else { 			leglink[0].innerHTML = '(+)';		}				for (i = 0; i < divs.length; i++) {			if (divs[i].style.display == 'none') divs[i].style.display = 'block';			else divs[i].style.display = 'none';		}			return false;	}		function topic_add_tag(e) {		var tags = document.getElementById('tags');		var tagsel = document.getElementById('tag_list');		if (tags.value == '') {			tags.value = tagsel.value;		} else if (tagsel.value != '') {			tags.value = tags.value+','+tagsel.value;		}	}		function upload_add_link(e) {		var ext = this.value.replace(/^(.*)(\..+)$/, "$2");		var img_exts = new Array('.png', '.jpg', '.jpeg', '.bmp', '.gif', '.tiff', '.tif');		var is_img = false;			var check_add = document.getElementById("adduploadlink");		if (check_add && ! check_add.checked) return false;			for (i=0; i< img_exts.length; i++) {			if (img_exts[i] == ext) {				is_img = true;				break;			}		}			var components = new Array();		var splitchar = '';		if (this.value.indexOf("\\") > 0 && this.value.indexOf("/") < 0) {			splitchar = "\\";		} else {			splitchar = "/";		}		components = this.value.split(splitchar);		var fname = components[components.length - 1];			var prompt_text = false;  // Prompt user for descriptive text.		                          // The alternative is just using the filename.			if (prompt_text) {				if (is_img) {				var res = window.prompt(strings.get('editor_addImageDesc', this.value));			} else {				var res = window.prompt(strings.get('editor_addLinkDesc', this.value));			}			} else {			res = fname;		}				if (res) {			var body = document.getElementById('body');			if (is_img) {				if (document.getElementById('input_mode').value == 1) {					lnblog.insertAtCursor(body, '[img='+fname+']'+res+'[/img]');				} else {					lnblog.insertAtCursor(body, "<img src=\""+fname+"\" alt=\""+res+"\" title=\""+res+"\" />");				}			} else {				if (document.getElementById('input_mode').value == 1) {					lnblog.insertAtCursor(body, '[url='+fname+']'+res+'[/url]');				} else {					lnblog.insertAtCursor(body, "<a href=\""+fname+"\">"+res+"</a>");				}			}		}	}		function articleSet(e) {		var path = document.getElementById('articlepath');		var isart = document.getElementById('publisharticle');		if (isart.checked) path.style.display = 'block';		else path.style.display = 'none';	}		this.document_add_all_events = function (e) {			// Toggle the LBCode editor on or off depending on the markup setting.		var inputmode = document.getElementById('input_mode');		lnblog.addEvent(inputmode, 'change', toggle_lbcode_editor);		toggle_lbcode_editor();				// Toggle the extended settings fields on or off.		var setfld = document.getElementById('entry_settings');		var setleg = setfld.getElementsByTagName('legend');		lnblog.addEvent(setleg[0], 'click', toggle_post_settings);		toggle_post_settings();			// Add event handlers to file upload boxes.		var uploads = document.getElementsByTagName('input');		for (i=0; i< uploads.length; i++) {			if (uploads[i].type == 'file') {				lnblog.addEvent(uploads[i], 'change', upload_add_link);			}		}				var tagsel = document.getElementById('tag_list');		lnblog.addEvent(tagsel, 'change', topic_add_tag);				var pubart = document.getElementById('publisharticle');		if (pubart) {			lnblog.addEvent(pubart, 'change', articleSet);			articleSet();		}				var preview = document.getElementById('preview');		lnblog.addEvent(preview, 'click', 			function(e) {				var has_files = false;				var i = 1;				var max_uploads = 20;				var upld;							postform = document.getElementById('postform');								while (upld = document.getElementById('upload'+i) && i < max_uploads) {					if (upld.value) {						has_files = true;						break;					}					i++;				}								if (has_files) {					var ret = window.confirm(strings.editor_submitWithFiles);					if (ret) {											postform.action = postform.action + '&save=draft';						return true;					} else {						return false;					}				} else {					return true;				}			});				document.getElementById('subject').focus();				return true;	}		//document.onload = function (e) { window.alert("FOO"); }	lnblog.addEvent(window, 'load', this.document_add_all_events);} | 
| 
	function upload_add_link(e) { | 
	this.upload_add_link = function (e) { | 
	function LBCodeEditor() {		this.short_forms = Array();	this.abbrev_phrases = Array();	this.acronym_phrases = Array();		this.add_acr = function (shrt, lng) {		var len = this.short_forms.push(shrt);		this.acronym_phrases[len-1] = lng;	}		this.add_abbr = function (shrt, lng) {		var len = this.short_forms.push(shrt);		this.abbrev_phrases[len-1] = lng;	}		this.get_abbr = function (shrt) {		var i=0;		for (i=0; i < this.short_forms.length; i++) 			if (this.short_forms[i] == shrt) {				if (this.abbrev_phrases[i]) return this.abbrev_phrases[i];				else return '';			}		return '';	}		this.get_acr = function (shrt) {		var i=0;		for (i=0; i < this.short_forms.length; i++) 			if (this.short_forms[i] == shrt) {				if (this.acronym_phrases[i]) return this.acronym_phrases[i];				else return '';			}		return '';	}		this.one_parm = function (type, prompt_text) {		var text_str;		if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			text_str = document.getElementById("desc_txt").value;			document.getElementById("desc_txt").value = '';		} else if (lnblog.getSelection(document.getElementById("body"))) {			text_str = lnblog.getSelection(document.getElementById("body"));		} else {			text_str = window.prompt(prompt_text);		}		if (! text_str) return false;		lnblog.insertAtCursor(			document.getElementById("body"), 			'[' + type + ']' + text_str + '[/' + type + ']');		return false;	}		this.two_parm = function (type, prompt_text, meta_text) {				var desc_str;		var meta_str;				if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			desc_str = document.getElementById("desc_txt").value;		} else if (lnblog.getSelection(document.getElementById("body"))) {			desc_str = lnblog.getSelection(document.getElementById("body"));		} else {			desc_str = window.prompt(prompt_text);		}			if (! desc_str) return false;				if (type == 'ab' || type == 'ac') {						if (type == 'ab') meta_str = this.get_abbr(desc_str);			else meta_str = this.get_acr(desc_str);				if (meta_str == '') {				if (document.getElementById("editboxes") &&					document.getElementById("editboxes").style.display == "block") {					meta_str = document.getElementById("meta_txt").value;				} else {					meta_str = window.prompt(meta_text);				}				if (! meta_str) return false;				if (type == 'ab') this.add_abbr(desc_str, meta_str);				else this.add_acr(desc_str, meta_str);			}					} else {			if (document.getElementById("editboxes") &&				document.getElementById("editboxes").style.display == "block") {				meta_str = document.getElementById("meta_txt").value;			} else {				meta_str = window.prompt(meta_text);			}		}				if (! meta_str) return false;				lnblog.insertAtCursor(			document.getElementById("body"),			'[' + type + '=' + meta_str + ']' +	desc_str + '[/' + type + ']');			return false;		}		this.opt_parm = function (type, prompt_text, meta_text) {			var desc_str;		var meta_str;		var data_str;				if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			desc_str = document.getElementById("desc_txt").value;		} else if (lnblog.getSelection(document.getElementById("body"))) {			desc_str = lnblog.getSelection(document.getElementById("body"));		} else {			desc_str = window.prompt(prompt_text);		}			if (! desc_str) return false;				if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			meta_str = document.getElementById("meta_txt").value;		} else {			meta_str = window.prompt(meta_text);		}			if (! meta_str) meta_str = '';				data_str = '[' + type;		if (meta_str == '') {			data_str = '[' + type + ']' + desc_str + '[/' + type + ']'		} else {			data_str = '[' + type + '=' + meta_str + ']' + desc_str + '[/' + type + ']'		}				lnblog.insertAtCursor(			document.getElementById("body"), data_str);		return false;		}		this.set_color = function (text_prompt, attr_prompt) {			var text_str;		var color_str;		var data_str;				if (lnblog.getSelection(document.getElementById("body"))) {			text_str = lnblog.getSelection(document.getElementById("body"));		} else {			text_str = window.prompt(text_prompt);		}				if (! text_str) return false;				var color = document.getElementById('colorselect');		if (color.value == 'custom') {			color_str = window.prompt(attr_prompt);		} else {			color_str = color.value;		}				if (color_str == undefined) return false;			data_str = '[color='+color_str+']'+text_str+'[/color]';				lnblog.insertAtCursor(document.getElementById("body"), data_str);		return false;		}		this.set_img = function (text_prompt, attr_prompt) {			var text_str;		var url_str;		var tag_str;		var data_str;				if (lnblog.getSelection(document.getElementById("body"))) {			text_str = lnblog.getSelection(document.getElementById("body"));		} else {			text_str = window.prompt(text_prompt);		}				if (! text_str) return false;				url_str = window.prompt(attr_prompt);		if (! url_str) return false;				var alignbox = document.getElementById('imgalign');		if (alignbox.value == 'center') {			tag_str = 'img';		} else {			tag_str = 'img-'+alignbox.value;		}				data_str = '['+tag_str+'='+url_str+']'+text_str+'[/'+tag_str+']';				lnblog.insertAtCursor(document.getElementById("body"), data_str);		return false;		}			this.insertChar = function (type) {		lnblog.insertAtCursor(document.getElementById("body"), type);		return true;	}		this.insertEntity = function (type) {		insertChar('&'+type+';');		return true;	}		this.toggle_show = function (ctrl, caller) {		var cnt = document.getElementById(ctrl);		var block_hidden = false;			if (! cnt.style.display && caller.innerHTML == "(+)") {			block_hidden = true;		}				if (cnt.style.display == "none" ||  block_hidden) {			cnt.style.display = "inline";			caller.innerHTML = "(-)";		} else {			cnt.style.display = "none";			caller.innerHTML = "(+)";		}	}		function set_article_path(e) {		var subj = document.getElementById("subject").value;		var path = subj.toLowerCase();		if (document.getElementById("short_path").value) return true;		path = path.replace(/\W+/g, " ");		path = path.replace(/^ */, "");		path = path.replace(/ *$/, "");		path = path.replace(/\W+/g, "_");		document.getElementById("short_path").value = path;		return true;	}		function toggle_lbcode_editor(ev) {		var lbcode = document.getElementById('lbcode_editor');		var dropdown = document.getElementById('input_mode');		if (lbcode) {			if (dropdown.value == 1) lbcode.style.display = 'inline';			else lbcode.style.display = 'none';		}		return true;	}		function toggle_post_settings(ev) {		var settings = document.getElementById('entry_settings');		var divs = settings.getElementsByTagName('div');		var leg = settings.getElementsByTagName('legend');		var leglink = leg[0].getElementsByTagName('a');				if (leglink[0].innerHTML == '(+)') { 			leglink[0].innerHTML = '(-)';		} else { 			leglink[0].innerHTML = '(+)';		}				for (i = 0; i < divs.length; i++) {			if (divs[i].style.display == 'none') divs[i].style.display = 'block';			else divs[i].style.display = 'none';		}			return false;	}		function topic_add_tag(e) {		var tags = document.getElementById('tags');		var tagsel = document.getElementById('tag_list');		if (tags.value == '') {			tags.value = tagsel.value;		} else if (tagsel.value != '') {			tags.value = tags.value+','+tagsel.value;		}	}		function upload_add_link(e) {		var ext = this.value.replace(/^(.*)(\..+)$/, "$2");		var img_exts = new Array('.png', '.jpg', '.jpeg', '.bmp', '.gif', '.tiff', '.tif');		var is_img = false;			var check_add = document.getElementById("adduploadlink");		if (check_add && ! check_add.checked) return false;			for (i=0; i< img_exts.length; i++) {			if (img_exts[i] == ext) {				is_img = true;				break;			}		}			var components = new Array();		var splitchar = '';		if (this.value.indexOf("\\") > 0 && this.value.indexOf("/") < 0) {			splitchar = "\\";		} else {			splitchar = "/";		}		components = this.value.split(splitchar);		var fname = components[components.length - 1];			var prompt_text = false;  // Prompt user for descriptive text.		                          // The alternative is just using the filename.			if (prompt_text) {				if (is_img) {				var res = window.prompt(strings.get('editor_addImageDesc', this.value));			} else {				var res = window.prompt(strings.get('editor_addLinkDesc', this.value));			}			} else {			res = fname;		}				if (res) {			var body = document.getElementById('body');			if (is_img) {				if (document.getElementById('input_mode').value == 1) {					lnblog.insertAtCursor(body, '[img='+fname+']'+res+'[/img]');				} else {					lnblog.insertAtCursor(body, "<img src=\""+fname+"\" alt=\""+res+"\" title=\""+res+"\" />");				}			} else {				if (document.getElementById('input_mode').value == 1) {					lnblog.insertAtCursor(body, '[url='+fname+']'+res+'[/url]');				} else {					lnblog.insertAtCursor(body, "<a href=\""+fname+"\">"+res+"</a>");				}			}		}	}		function articleSet(e) {		var path = document.getElementById('articlepath');		var isart = document.getElementById('publisharticle');		if (isart.checked) path.style.display = 'block';		else path.style.display = 'none';	}		 function document_add_all_events (e) {			// Toggle the LBCode editor on or off depending on the markup setting.		var inputmode = document.getElementById('input_mode');		lnblog.addEvent(inputmode, 'change', toggle_lbcode_editor);		toggle_lbcode_editor();				// Toggle the extended settings fields on or off.		var setfld = document.getElementById('entry_settings');		var setleg = setfld.getElementsByTagName('legend');		lnblog.addEvent(setleg[0], 'click', toggle_post_settings);		toggle_post_settings();			// Add event handlers to file upload boxes.		var uploads = document.getElementsByTagName('input');		for (i=0; i< uploads.length; i++) {			if (uploads[i].type == 'file') {				lnblog.addEvent(uploads[i], 'change', upload_add_link);			}		}				var tagsel = document.getElementById('tag_list');		lnblog.addEvent(tagsel, 'change', topic_add_tag);				var pubart = document.getElementById('publisharticle');		if (pubart) {			lnblog.addEvent(pubart, 'change', articleSet);			articleSet();		}				if (document.getElementById('articlepath')) {			lnblog.addEvent(document.getElementById('subject'), 'blur', set_article_path);		}				var preview = document.getElementById('preview');		lnblog.addEvent(preview, 'click', 			function(e) {				var has_files = false;				var i = 1;				var max_uploads = 20;				var upld;							postform = document.getElementById('postform');								while (upld = document.getElementById('upload'+i) && i < max_uploads) {					if (upld.value) {						has_files = true;						break;					}					i++;				}								if (has_files) {					var ret = window.confirm(strings.editor_submitWithFiles);					if (ret) {											postform.action = postform.action + '&save=draft';						return true;					} else {						return false;					}				} else {					return true;				}			});				document.getElementById('subject').focus();				return true;	}		lnblog.addEvent(window, 'load', document_add_all_events);} | 
| 
	lnblog.addEvent(uploads[i], 'change', upload_add_link); | 
	lnblog.addEvent(uploads[i], 'change', self.upload_add_link); | 
	function LBCodeEditor() {		this.short_forms = Array();	this.abbrev_phrases = Array();	this.acronym_phrases = Array();		this.add_acr = function (shrt, lng) {		var len = this.short_forms.push(shrt);		this.acronym_phrases[len-1] = lng;	}		this.add_abbr = function (shrt, lng) {		var len = this.short_forms.push(shrt);		this.abbrev_phrases[len-1] = lng;	}		this.get_abbr = function (shrt) {		var i=0;		for (i=0; i < this.short_forms.length; i++) 			if (this.short_forms[i] == shrt) {				if (this.abbrev_phrases[i]) return this.abbrev_phrases[i];				else return '';			}		return '';	}		this.get_acr = function (shrt) {		var i=0;		for (i=0; i < this.short_forms.length; i++) 			if (this.short_forms[i] == shrt) {				if (this.acronym_phrases[i]) return this.acronym_phrases[i];				else return '';			}		return '';	}		this.one_parm = function (type, prompt_text) {		var text_str;		if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			text_str = document.getElementById("desc_txt").value;			document.getElementById("desc_txt").value = '';		} else if (lnblog.getSelection(document.getElementById("body"))) {			text_str = lnblog.getSelection(document.getElementById("body"));		} else {			text_str = window.prompt(prompt_text);		}		if (! text_str) return false;		lnblog.insertAtCursor(			document.getElementById("body"), 			'[' + type + ']' + text_str + '[/' + type + ']');		return false;	}		this.two_parm = function (type, prompt_text, meta_text) {				var desc_str;		var meta_str;				if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			desc_str = document.getElementById("desc_txt").value;		} else if (lnblog.getSelection(document.getElementById("body"))) {			desc_str = lnblog.getSelection(document.getElementById("body"));		} else {			desc_str = window.prompt(prompt_text);		}			if (! desc_str) return false;				if (type == 'ab' || type == 'ac') {						if (type == 'ab') meta_str = this.get_abbr(desc_str);			else meta_str = this.get_acr(desc_str);				if (meta_str == '') {				if (document.getElementById("editboxes") &&					document.getElementById("editboxes").style.display == "block") {					meta_str = document.getElementById("meta_txt").value;				} else {					meta_str = window.prompt(meta_text);				}				if (! meta_str) return false;				if (type == 'ab') this.add_abbr(desc_str, meta_str);				else this.add_acr(desc_str, meta_str);			}					} else {			if (document.getElementById("editboxes") &&				document.getElementById("editboxes").style.display == "block") {				meta_str = document.getElementById("meta_txt").value;			} else {				meta_str = window.prompt(meta_text);			}		}				if (! meta_str) return false;				lnblog.insertAtCursor(			document.getElementById("body"),			'[' + type + '=' + meta_str + ']' +	desc_str + '[/' + type + ']');			return false;		}		this.opt_parm = function (type, prompt_text, meta_text) {			var desc_str;		var meta_str;		var data_str;				if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			desc_str = document.getElementById("desc_txt").value;		} else if (lnblog.getSelection(document.getElementById("body"))) {			desc_str = lnblog.getSelection(document.getElementById("body"));		} else {			desc_str = window.prompt(prompt_text);		}			if (! desc_str) return false;				if (document.getElementById("editboxes") &&			document.getElementById("editboxes").style.display == "block") {			meta_str = document.getElementById("meta_txt").value;		} else {			meta_str = window.prompt(meta_text);		}			if (! meta_str) meta_str = '';				data_str = '[' + type;		if (meta_str == '') {			data_str = '[' + type + ']' + desc_str + '[/' + type + ']'		} else {			data_str = '[' + type + '=' + meta_str + ']' + desc_str + '[/' + type + ']'		}				lnblog.insertAtCursor(			document.getElementById("body"), data_str);		return false;		}		this.set_color = function (text_prompt, attr_prompt) {			var text_str;		var color_str;		var data_str;				if (lnblog.getSelection(document.getElementById("body"))) {			text_str = lnblog.getSelection(document.getElementById("body"));		} else {			text_str = window.prompt(text_prompt);		}				if (! text_str) return false;				var color = document.getElementById('colorselect');		if (color.value == 'custom') {			color_str = window.prompt(attr_prompt);		} else {			color_str = color.value;		}				if (color_str == undefined) return false;			data_str = '[color='+color_str+']'+text_str+'[/color]';				lnblog.insertAtCursor(document.getElementById("body"), data_str);		return false;		}		this.set_img = function (text_prompt, attr_prompt) {			var text_str;		var url_str;		var tag_str;		var data_str;				if (lnblog.getSelection(document.getElementById("body"))) {			text_str = lnblog.getSelection(document.getElementById("body"));		} else {			text_str = window.prompt(text_prompt);		}				if (! text_str) return false;				url_str = window.prompt(attr_prompt);		if (! url_str) return false;				var alignbox = document.getElementById('imgalign');		if (alignbox.value == 'center') {			tag_str = 'img';		} else {			tag_str = 'img-'+alignbox.value;		}				data_str = '['+tag_str+'='+url_str+']'+text_str+'[/'+tag_str+']';				lnblog.insertAtCursor(document.getElementById("body"), data_str);		return false;		}			this.insertChar = function (type) {		lnblog.insertAtCursor(document.getElementById("body"), type);		return true;	}		this.insertEntity = function (type) {		insertChar('&'+type+';');		return true;	}		this.toggle_show = function (ctrl, caller) {		var cnt = document.getElementById(ctrl);		var block_hidden = false;			if (! cnt.style.display && caller.innerHTML == "(+)") {			block_hidden = true;		}				if (cnt.style.display == "none" ||  block_hidden) {			cnt.style.display = "inline";			caller.innerHTML = "(-)";		} else {			cnt.style.display = "none";			caller.innerHTML = "(+)";		}	}		function set_article_path(e) {		var subj = document.getElementById("subject").value;		var path = subj.toLowerCase();		if (document.getElementById("short_path").value) return true;		path = path.replace(/\W+/g, " ");		path = path.replace(/^ */, "");		path = path.replace(/ *$/, "");		path = path.replace(/\W+/g, "_");		document.getElementById("short_path").value = path;		return true;	}		function toggle_lbcode_editor(ev) {		var lbcode = document.getElementById('lbcode_editor');		var dropdown = document.getElementById('input_mode');		if (lbcode) {			if (dropdown.value == 1) lbcode.style.display = 'inline';			else lbcode.style.display = 'none';		}		return true;	}		function toggle_post_settings(ev) {		var settings = document.getElementById('entry_settings');		var divs = settings.getElementsByTagName('div');		var leg = settings.getElementsByTagName('legend');		var leglink = leg[0].getElementsByTagName('a');				if (leglink[0].innerHTML == '(+)') { 			leglink[0].innerHTML = '(-)';		} else { 			leglink[0].innerHTML = '(+)';		}				for (i = 0; i < divs.length; i++) {			if (divs[i].style.display == 'none') divs[i].style.display = 'block';			else divs[i].style.display = 'none';		}			return false;	}		function topic_add_tag(e) {		var tags = document.getElementById('tags');		var tagsel = document.getElementById('tag_list');		if (tags.value == '') {			tags.value = tagsel.value;		} else if (tagsel.value != '') {			tags.value = tags.value+','+tagsel.value;		}	}		function upload_add_link(e) {		var ext = this.value.replace(/^(.*)(\..+)$/, "$2");		var img_exts = new Array('.png', '.jpg', '.jpeg', '.bmp', '.gif', '.tiff', '.tif');		var is_img = false;			var check_add = document.getElementById("adduploadlink");		if (check_add && ! check_add.checked) return false;			for (i=0; i< img_exts.length; i++) {			if (img_exts[i] == ext) {				is_img = true;				break;			}		}			var components = new Array();		var splitchar = '';		if (this.value.indexOf("\\") > 0 && this.value.indexOf("/") < 0) {			splitchar = "\\";		} else {			splitchar = "/";		}		components = this.value.split(splitchar);		var fname = components[components.length - 1];			var prompt_text = false;  // Prompt user for descriptive text.		                          // The alternative is just using the filename.			if (prompt_text) {				if (is_img) {				var res = window.prompt(strings.get('editor_addImageDesc', this.value));			} else {				var res = window.prompt(strings.get('editor_addLinkDesc', this.value));			}			} else {			res = fname;		}				if (res) {			var body = document.getElementById('body');			if (is_img) {				if (document.getElementById('input_mode').value == 1) {					lnblog.insertAtCursor(body, '[img='+fname+']'+res+'[/img]');				} else {					lnblog.insertAtCursor(body, "<img src=\""+fname+"\" alt=\""+res+"\" title=\""+res+"\" />");				}			} else {				if (document.getElementById('input_mode').value == 1) {					lnblog.insertAtCursor(body, '[url='+fname+']'+res+'[/url]');				} else {					lnblog.insertAtCursor(body, "<a href=\""+fname+"\">"+res+"</a>");				}			}		}	}		function articleSet(e) {		var path = document.getElementById('articlepath');		var isart = document.getElementById('publisharticle');		if (isart.checked) path.style.display = 'block';		else path.style.display = 'none';	}		 function document_add_all_events (e) {			// Toggle the LBCode editor on or off depending on the markup setting.		var inputmode = document.getElementById('input_mode');		lnblog.addEvent(inputmode, 'change', toggle_lbcode_editor);		toggle_lbcode_editor();				// Toggle the extended settings fields on or off.		var setfld = document.getElementById('entry_settings');		var setleg = setfld.getElementsByTagName('legend');		lnblog.addEvent(setleg[0], 'click', toggle_post_settings);		toggle_post_settings();			// Add event handlers to file upload boxes.		var uploads = document.getElementsByTagName('input');		for (i=0; i< uploads.length; i++) {			if (uploads[i].type == 'file') {				lnblog.addEvent(uploads[i], 'change', upload_add_link);			}		}				var tagsel = document.getElementById('tag_list');		lnblog.addEvent(tagsel, 'change', topic_add_tag);				var pubart = document.getElementById('publisharticle');		if (pubart) {			lnblog.addEvent(pubart, 'change', articleSet);			articleSet();		}				if (document.getElementById('articlepath')) {			lnblog.addEvent(document.getElementById('subject'), 'blur', set_article_path);		}				var preview = document.getElementById('preview');		lnblog.addEvent(preview, 'click', 			function(e) {				var has_files = false;				var i = 1;				var max_uploads = 20;				var upld;							postform = document.getElementById('postform');								while (upld = document.getElementById('upload'+i) && i < max_uploads) {					if (upld.value) {						has_files = true;						break;					}					i++;				}								if (has_files) {					var ret = window.confirm(strings.editor_submitWithFiles);					if (ret) {											postform.action = postform.action + '&save=draft';						return true;					} else {						return false;					}				} else {					return true;				}			});				document.getElementById('subject').focus();				return true;	}		lnblog.addEvent(window, 'load', document_add_all_events);} | 
| 
	var runurl = '<a href="#" onClick="return Ext.getCmp(\'eemanager\').doLinks(' + id + ')"><img src="/Gemma/images/icons/control_play_blue.png" alt="link analysis" title="link analysis"/></a>'; | 
	var runurl = '<span style="cursor:pointer" onClick="return Ext.getCmp(\'eemanager\').doLinks(' + id + ')"><img src="/Gemma/images/icons/control_play_blue.png" alt="link analysis" title="link analysis"/></span>'; | 
		linkAnalysisRenderer : function(ee) {		var id = ee.id;		var runurl = '<a href="#" onClick="return Ext.getCmp(\'eemanager\').doLinks(' + id +				')"><img src="/Gemma/images/icons/control_play_blue.png" alt="link analysis" title="link analysis"/></a>';		if (ee.dateLinkAnalysis) {			var type = ee.linkAnalysisEventType;			var color = "#000";			var suggestRun = true;			var qtip = 'ext:qtip="OK"';			if (type == 'FailedLinkAnalysisEventImpl') {				color = 'red';				qtip = 'ext:qtip="Failed"';			} else if (type == 'TooSmallDatasetLinkAnalysisEventImpl') {				color = '#CCC';				qtip = 'ext:qtip="Too small"';				suggestRun = false;			}			return '<span style="color:' + color + ';" ' + qtip + '>' +					Ext.util.Format.date(ee.dateLinkAnalysis, 'y/M/d') + ' ' + (suggestRun ? runurl : '');		} else {			return '<span style="color:#3A3;">Needed</span> ' + runurl;		}	}, | 
| 
	runurl = '<a href="#" onClick="return Ext.getCmp(\'eemanager\').doLinks(' + id + ')"><img src="/Gemma/images/icons/control_play_blue.png" ext:qtip="Run coexpression analysis"  alt="link analysis" /></a>'; | 
	runurl = '<a href="#" onClick="return Ext.getCmp(\'eemanager\').doLinks(' + id + ')"><img src="/Gemma/images/icons/control_play_blue.png" ext:qtip="Run coexpression analysis"  alt="link analysis" /></a>'; }  if (record.get('bioAssayCount') < BIG_ENOUGH_FOR_LINKS) { return '<span style="color:#CCC;">Too small</span> '; | 
		var linkAnalysisRenderer = function(value, metadata, record, rowIndex, colIndex, store) {		var id = record.get('id');		var runurl = "";		if (record.get("currentUserHasWritePermission")) {			runurl = '<a href="#" onClick="return Ext.getCmp(\'eemanager\').doLinks('					+ id					+ ')"><img src="/Gemma/images/icons/control_play_blue.png" ext:qtip="Run coexpression analysis"  alt="link analysis" /></a>';		}		if (record.get('dateLinkAnalysis')) {			var type = record.get('linkAnalysisEventType');			var color = "#000";			var suggestRun = true;			var qtip = 'ext:qtip="OK"';			if (type == 'FailedLinkAnalysisEventImpl') {				color = 'red';				qtip = 'ext:qtip="Failed"';			} else if (type == 'TooSmallDatasetLinkAnalysisEventImpl') {				color = '#CCC';				qtip = 'ext:qtip="Too small to perform link analysis"';				suggestRun = false;			}			return '<span style="color:' + color + ';" ' + qtip + '>' + Ext.util.Format.date(value, 'y/M/d') + ' '					+ (suggestRun ? runurl : '');		} else {			return '<span style="color:#3A3;">Needed</span> ' + runurl;		}	}; | 
| 
	var runurl = '<a href="#" onClick="return Ext.getCmp(\'eemanager\').doLinks(' + id + ')"><img src="/Gemma/images/icons/control_play_blue.png" ext:qtip="Run coexpression analysis"  alt="link analysis" /></a>'; | 
	var runurl = ""; if (record.get("currentUserHasWritePermission")) { runurl = '<a href="#" onClick="return Ext.getCmp(\'eemanager\').doLinks(' + id + ')"><img src="/Gemma/images/icons/control_play_blue.png" ext:qtip="Run coexpression analysis"  alt="link analysis" /></a>'; } | 
		var linkAnalysisRenderer = function(value, metadata, record, rowIndex, colIndex, store) {		var id = record.get('id');		var runurl = '<a href="#" onClick="return Ext.getCmp(\'eemanager\').doLinks('				+ id				+ ')"><img src="/Gemma/images/icons/control_play_blue.png" ext:qtip="Run coexpression analysis"  alt="link analysis" /></a>';		if (record.get('dateLinkAnalysis')) {			var type = record.get('linkAnalysisEventType');			var color = "#000";			var suggestRun = true;			var qtip = 'ext:qtip="OK"';			if (type == 'FailedLinkAnalysisEventImpl') {				color = 'red';				qtip = 'ext:qtip="Failed"';			} else if (type == 'TooSmallDatasetLinkAnalysisEventImpl') {				color = '#CCC';				qtip = 'ext:qtip="Too small to perform link analysis"';				suggestRun = false;			}			return '<span style="color:' + color + ';" ' + qtip + '>' + Ext.util.Format.date(value, 'y/M/d') + ' '					+ (suggestRun ? runurl : '');		} else {			return '<span style="color:#3A3;">Needed</span> ' + runurl;		}	}; | 
| 
	this.log("is list visible?: " + isVisible); | 
		listVisible: function() {		var isVisible = !this.listWrapper.hasClass(this.css.hidden);		this.log("is list visible?: " + isVisible);		return isVisible;	}, | |
| 
	setTimeout(poll, 1); | 
	setTimeout(poll, 200); | 
		function load() {		if ((!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete') && !this.visited) {			this.visited = true;			if(--itemCount) return; /* haven't loaded all yet. */						setTimeout(poll, 1); /* straight away first time */		}	} | 
| 
	ExpressionExperimentLoadController.run.apply(this, callParams); | 
	ExpressionExperimentLoadController.load.apply(this, callParams); | 
	function load(accession) {	var dh = Ext.DomHelper;	var suppressMatching = "false";	var loadPlatformOnly = "false";	var arrayExpress = "false";	var arrayDesign = "";	var callParams = [];	var commandObj = {		accession : accession,		suppressMatching : suppressMatching,		loadPlatformOnly : loadPlatformOnly,		arrayExpress : arrayExpress,		arrayDesignName : arrayDesign	};	callParams.push(commandObj);	var delegate = handleLoadSuccess.createDelegate(this, [], true);	var errorHandler = handleFailure.createDelegate(this, [], true);	callParams.push({		callback : delegate,		errorHandler : errorHandler	});	// this should return quickly, with the task id.	Ext.DomHelper.overwrite("messages", {		tag : 'img',		src : '/Gemma/images/default/tree/loading.gif'	});	Ext.DomHelper.append("messages", " Submitting job...");	ExpressionExperimentLoadController.run.apply(this, callParams);} | 
| 
	this.setBusy(false); | 
	    loadContent: function(element) {        element = document.id(element);        if (this.options.content) {            var c;            if (this.options.content.domObj) {                c = document.id(this.options.content.domObj);            } else {                c = document.id(this.options.content);            }            if (c) {                if (this.options.content.addTo) {                    this.options.content.addTo(element);                } else {                    element.appendChild(c);                }                this.contentIsLoaded = true;            } else {                element.innerHTML = this.options.content;                this.contentIsLoaded = true;            }        } else if (this.options.contentURL) {            this.contentIsLoaded = false;            this.req = new Request({                url: this.options.contentURL,                method:'get',                evalScripts:true,                onRequest:(function() {                  if(this.options.loadOnDemand) {                      this.setBusy(true);                  }                }).bind(this),                onSuccess:(function(html) {                    element.innerHTML = html;                    this.contentIsLoaded = true;                    if (Jx.isAir){                        $clear(this.reqTimeout);                    }                    this.setBusy(false);                    this.fireEvent('contentLoaded', this);                }).bind(this),                onFailure: (function(){                    this.contentIsLoaded = true;                    this.fireEvent('contentLoadFailed', this);                }).bind(this),                headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'}            });            this.req.send();            if (Jx.isAir) {                var timeout = $defined(this.options.timeout) ? this.options.timeout : 10000;                this.reqTimeout = this.checkRequest.delay(timeout, this);            }        } else {            this.contentIsLoaded = true;        }        if (this.options.contentId) {            element.id = this.options.contentId;        }        if (this.contentIsLoaded) {            this.fireEvent('contentLoaded', this);        }    }, | |
| 
	this.data.load(uri); | 
	if (typeof this.data.onreadystatechange == "unknown") { var wrappedCallback = new ContextFixer(this._sarissaOnLoadCallback, this); this.data.onreadystatechange = wrappedCallback.execute; this.data.load(uri); } else {  var thisObject = this;   YUI().use("io-base", function(Y) { Y.on('io:complete', thisObject._YUIOnLoadCallback , thisObject, []); var request = Y.io(uri); } ); } | 
	    this.loadEntries = function(arguments) {                var uri =  this.dataURI;        if(arguments !== undefined) {            if(arguments['thatid'] != undefined && arguments['thatid'] != null && arguments['thatid'] != 0) {                uri = uri+'?thatid=' + escape(arguments['thatid']);            }        }                this.data = Sarissa.getDomDocument();            var wrappedCallback = new bx_helpers_contextfixer(this._sarissaOnLoadCallback, this);        this.data.onreadystatechange = wrappedCallback.execute;                dbforms2_log.log('loading ' + uri + '...')        this.dataLoaded = false;        this.data.load(uri);    } | 
| 
	this.loadEntriesFromXML = function() { this.data = Sarissa.fixFirefox3Permissions(this.data); | 
	this.loadEntriesFromXML = function(isYui) { if (!isYui) { this.data = Sarissa.fixFirefox3Permissions(this.data); } | 
	    this.loadEntriesFromXML = function() {       this.data = Sarissa.fixFirefox3Permissions(this.data);       var entry = this.data.documentElement.firstChild.firstChild;                this.results.removeAllEntries();        while(entry) {            idNS = entry.getElementsByTagName('_id');            titleNS = entry.getElementsByTagName('_title');                        id = 0;                        if(idNS.length > 0 && idNS.item(0).childNodes[0]) {                id = idNS.item(0).childNodes[0].data;            }            title = '#Empty Field# ('+ id +')';            			if(titleNS.length > 0 && titleNS.item(0).childNodes[0]) {                title = titleNS.item(0).childNodes[0].data            }             this.results.addEntry(id, title);                        entry = entry.nextSibling;        }                if(this.queryField.hasFocus && this.results.entries.length > 0) {            this.results.focusEntryByIndex(0);            this.results.show();        } else {            this.results.hide();        }                if(this.enablePager) {            var numPagesNS = this.data.getElementsByTagName('numpages');            var numPages = 0;            if(numPagesNS.length > 0) {                numPages = numPagesNS.item(0).childNodes[0].data;            }                        if(numPages > 1) {                if(numPages != this.numPages) {                    this.resetPager(numPages);                } else {                    this.updatePagerDisplay();                }            } else {                this.hidePagerDisplay();            }                       }            } | 
| 
	this.loadEntriesFromXML = function() { var entry = this.data.documentElement.firstChild.firstChild; | 
	this.loadEntriesFromXML = function(isYui) { if (!isYui) { this.data = Sarissa.fixFirefox3Permissions(this.data); } var entry = this.data.documentElement.firstChild.firstChild; | 
	    this.loadEntriesFromXML = function() {        var entry = this.data.documentElement.firstChild.firstChild;        this.results.removeAllEntries();        while(entry) {            idNS = entry.getElementsByTagName('_id');            titleNS = entry.getElementsByTagName('_title');                        title = 'Parse Error';            id = 0;            if(titleNS.length > 0 && titleNS.item(0).childNodes[0])                title = titleNS.item(0).childNodes[0].data            if(idNS.length > 0 && idNS.item(0).childNodes[0])                id = idNS.item(0).childNodes[0].data;                        this.results.addEntry(id, title);                        entry = entry.nextSibling;        }    } | 
| 
	title = 'Parse Error'; | 
	    this.loadEntriesFromXML = function() {        var entry = this.data.documentElement.firstChild.firstChild;        this.results.removeAllEntries();        while(entry) {            idNS = entry.getElementsByTagName('_id');            titleNS = entry.getElementsByTagName('_title');                        title = 'Parse Error';            id = 0;            if(titleNS.length > 0 && titleNS.item(0).childNodes[0])                title = titleNS.item(0).childNodes[0].data            if(idNS.length > 0 && idNS.item(0).childNodes[0])                id = idNS.item(0).childNodes[0].data;                        this.results.addEntry(id, title);                        entry = entry.nextSibling;        }    } | |
| 
	if(titleNS.length > 0 && titleNS.item(0).childNodes[0]) | 
	if(idNS.length > 0 && idNS.item(0).childNodes[0]) { id = idNS.item(0).childNodes[0].data; }  title = '#Empty Field# ('+ id +')';  if(titleNS.length > 0 && titleNS.item(0).childNodes[0]) { | 
	    this.loadEntriesFromXML = function() {        var entry = this.data.documentElement.firstChild.firstChild;        this.results.removeAllEntries();        while(entry) {            idNS = entry.getElementsByTagName('_id');            titleNS = entry.getElementsByTagName('_title');                        title = 'Parse Error';            id = 0;            if(titleNS.length > 0 && titleNS.item(0).childNodes[0])                title = titleNS.item(0).childNodes[0].data            if(idNS.length > 0 && idNS.item(0).childNodes[0])                id = idNS.item(0).childNodes[0].data;                        this.results.addEntry(id, title);                        entry = entry.nextSibling;        }    } | 
| 
	if(idNS.length > 0 && idNS.item(0).childNodes[0]) id = idNS.item(0).childNodes[0].data; | 
	    this.loadEntriesFromXML = function() {        var entry = this.data.documentElement.firstChild.firstChild;        this.results.removeAllEntries();        while(entry) {            idNS = entry.getElementsByTagName('_id');            titleNS = entry.getElementsByTagName('_title');                        title = 'Parse Error';            id = 0;            if(titleNS.length > 0 && titleNS.item(0).childNodes[0])                title = titleNS.item(0).childNodes[0].data            if(idNS.length > 0 && idNS.item(0).childNodes[0])                id = idNS.item(0).childNodes[0].data;                        this.results.addEntry(id, title);                        entry = entry.nextSibling;        }    } | |
| 
	if(this.enablePager) { var numPagesNS = this.data.getElementsByTagName('numpages'); var numPages = 0; if(numPagesNS.length > 0) { numPages = numPagesNS.item(0).childNodes[0].data; }  if(numPages > 1) { if(numPages != this.numPages) { this.resetPager(numPages); } else { this.updatePagerDisplay(); } } else { this.hidePagerDisplay(); }  } | 
	    this.loadEntriesFromXML = function() {        var entry = this.data.documentElement.firstChild.firstChild;        this.results.removeAllEntries();        while(entry) {            idNS = entry.getElementsByTagName('_id');            titleNS = entry.getElementsByTagName('_title');                        title = 'Parse Error';            id = 0;            if(titleNS.length > 0 && titleNS.item(0).childNodes[0])                title = titleNS.item(0).childNodes[0].data            if(idNS.length > 0 && idNS.item(0).childNodes[0])                id = idNS.item(0).childNodes[0].data;                        this.results.addEntry(id, title);                        entry = entry.nextSibling;        }    } | |
| 
	geneData.push([genes[i].id, genes[i].taxon.scientificName, genes[i].officialSymbol, | 
	geneData.push([genes[i].id, genes[i].taxonScientificName, genes[i].officialSymbol, | 
				loadGenes : function(geneIds, callback, args) {				if (!geneIds || geneIds.length == 0) {					return;				}				GenePickerController.getGenes(geneIds, function(genes) {							var geneData = [];							for (var i = 0; i < genes.length; ++i) {								geneData.push([genes[i].id, genes[i].taxon.scientificName, genes[i].officialSymbol,										genes[i].officialName]);							}							/*							 * FIXME this can result in the same gene listed twice. This is taken care of at the server							 * side but looks funny.							 */							this.getStore().loadData(geneData);							if (callback) {								callback(args);							}						}.createDelegate(this));			}, | 
| 
	if (!geneIds || geneIds.length == 0) { return; } | 
				loadGenes : function(geneIds, callback, args) {				GenePickerController.getGenes(geneIds, function(genes) {							var geneData = [];							for (var i = 0; i < genes.length; ++i) {								geneData.push([genes[i].id, genes[i].taxon.scientificName, genes[i].officialSymbol,										genes[i].officialName]);							}							/*							 * FIXME this can result in the same gene listed twice. This is taken care of at the server							 * side but looks funny.							 */							this.getStore().loadData(geneData);							if (callback) {								callback(args);							}						}.createDelegate(this));			}, | |
| 
	this.loadGenes(geneIds, callback, args); this.fireEvent("addgenes", geneIds); }, | 
	GenePickerController.getGenes(geneIds, function(genes) { var geneData = []; for (var i = 0; i < genes.length; ++i) { geneData .push([genes[i].id, genes[i].taxon.scientificName, genes[i].officialSymbol, genes[i].officialName]); }  this.getStore().loadData(geneData); if (callback) { callback(args); } this.fireEvent("addgenes", geneIds); }.createDelegate(this));  }, | 
				loadGenes : function(geneIds, callback, args) {				this.loadGenes(geneIds, callback, args);				this.fireEvent("addgenes", geneIds);			}, | 
| 
	input.css('display', 'none'); | 
	$('#keyword-form').css('display', 'none'); | 
	function loadIndexTerms() {    var input = $('input[name = input-keyword-prefix]');    $('#keywords-result').load("filters.xql?type=keywords&prefix=" + input.val(), function () {        if ($('#keywords-result ul').hasClass('complete'))            input.css('display', 'none');    });} | 
| 
	ExpressionExperimentController.loadStatusSummaries = function(p0, p1, p2, callback) { | 
	ExpressionExperimentController.loadStatusSummaries = function(p0, p1, p2, p3, callback) { | 
	ExpressionExperimentController.loadStatusSummaries = function(p0, p1, p2, callback) {	dwr.engine._execute(ExpressionExperimentController._path, 'ExpressionExperimentController', 'loadStatusSummaries',			p0, p1, p2, callback);} | 
| 
	p0, p1, p2, callback); | 
	p0, p1, p2, p3, callback); | 
	ExpressionExperimentController.loadStatusSummaries = function(p0, p1, p2, callback) {	dwr.engine._execute(ExpressionExperimentController._path, 'ExpressionExperimentController', 'loadStatusSummaries',			p0, p1, p2, callback);} | 
| 
	var wrappedCallback = new ContextFixer(this._sarissaOnLoadCallback, this); this.data.onreadystatechange = wrappedCallback.execute; | 
	var thisObject = this; | 
	    this.loadXML = function(dataURI) {        this.data = Sarissa.getDomDocument();            var wrappedCallback = new ContextFixer(this._sarissaOnLoadCallback, this);        this.data.onreadystatechange = wrappedCallback.execute;                dbforms2_log.log('loading ' + dataURI + '...')        this.dataLoaded = false;        this.data.load(dataURI);    } | 
| 
	this.data.load(dataURI); | 
	YUI().use("io-base", function(Y) { Y.on('io:complete', thisObject._YUIOnLoadCallback , thisObject, []); var request = Y.io(dataURI); } ); | 
	    this.loadXML = function(dataURI) {        this.data = Sarissa.getDomDocument();            var wrappedCallback = new ContextFixer(this._sarissaOnLoadCallback, this);        this.data.onreadystatechange = wrappedCallback.execute;                dbforms2_log.log('loading ' + dataURI + '...')        this.dataLoaded = false;        this.data.load(dataURI);    } | 
| 
	return args.shift(); | 
	return console._inspect(args.shift()); | 
	      console[log_methods[i]] = function logger (first_arg) {        var result = [];        var args = Array.prototype.slice.call(arguments, 0);        if (typeof first_arg === 'string' && console._interpolate.test(first_arg)) {          args.shift();          result.push(first_arg.replace(console._interpolate, function(){            return args.shift();          }));        }        for (var i=0; i<args.length; i++) {          result.push(args[i]);        }        return (_log || console._output)(result.join(console._args_separator));      }; | 
| 
	result.push(args[i]); | 
	result.push(console._inspect(args[i])); | 
	      console[log_methods[i]] = function logger (first_arg) {        var result = [];        var args = Array.prototype.slice.call(arguments, 0);        if (typeof first_arg === 'string' && console._interpolate.test(first_arg)) {          args.shift();          result.push(first_arg.replace(console._interpolate, function(){            return args.shift();          }));        }        for (var i=0; i<args.length; i++) {          result.push(args[i]);        }        return (_log || console._output)(result.join(console._args_separator));      }; | 
| 
	_sgffx.setXulObjectVisibility('showfaxmenuitem', 1); | 
		login: function() {		this.log("*** sipgateffx: login *** BEGIN ***");		var showActiveMenu = function() {			if (_sgffx.systemArea == 'team') {				_sgffx.setXulObjectVisibility('sipgateffxDND', 1);			} else {				_sgffx.setXulObjectVisibility('sipgateffxDND', 0);			}						_sgffx.setXulObjectVisibility('showcreditmenuitem', 1);			_sgffx.setXulObjectVisibility('showvoicemailmenuitem', 1);			_sgffx.setXulObjectVisibility('showphonebookmenuitem', 1);			_sgffx.setXulObjectVisibility('showhistorymenuitem', 1);			_sgffx.setXulObjectVisibility('showfaxmenuitem', 1);			_sgffx.setXulObjectVisibility('showitemizedmenuitem', 1);			_sgffx.setXulObjectVisibility('pollbalance', 1);			_sgffx.setXulObjectVisibility('showsmsformmenuitem', 1);			_sgffx.setXulObjectVisibility('showphonenumberformmenuitem', 1);			_sgffx.setXulObjectVisibility('item_logoff', 1);			_sgffx.setXulObjectVisibility('separator1', 1);			_sgffx.setXulObjectVisibility('separator2', 1);						if (!_sgffx.getPref("extensions.sipgateffx.parsenumbers", "bool")) {				_sgffx.setXulObjectVisibility('dialactivate', 1);			}									_sgffx.setXulObjectVisibility('item_logon', 0);						_sgffx.setXulObjectVisibility('sipgateffx_loggedout', 0);			_sgffx.setXulObjectVisibility('sipgateffx_loggedin', 1);					}				if (this.isLoggedIn) {			this.log("*** sipgateffx: login *** ALREADY LOGGED IN ***");			showActiveMenu();						if(this.systemArea == 'team') {				this.showEventSummary();				this.showDoNotDisturb();			}						this.getBalance();			return;		}		var result = function(ourParsedResponse, aXML) {			if (ourParsedResponse.StatusCode && ourParsedResponse.StatusCode == 200) {					showActiveMenu();								_sgffx.isLoggedIn = true;								_sgffx.log("*** NOW logged in ***");								_sgffx.curBalance = null;				_sgffx.getBalance();								_sgffx.sipgateCredentials = ourParsedResponse;								if(ourParsedResponse.HttpServer.match(/com$/)) {					_sgffx.userCountryPrefix = '1';				} else				if(ourParsedResponse.HttpServer.match(/de$/)) {					_sgffx.userCountryPrefix = '49';				} else				if(ourParsedResponse.HttpServer.match(/at$/)) {					_sgffx.userCountryPrefix = '43';				} else				if(ourParsedResponse.HttpServer.match(/co\.uk$/)) {					_sgffx.userCountryPrefix = '44';				}												if (_sgffx.systemArea == 'team') {					_sgffx.getEventSummary();					_sgffx.getDoNotDisturb();								}								_sgffx.getTosList();				_sgffx.getRecommendedIntervals();				_sgffx.getOwnUriList();				try {					_sgffx.clientIdentify();				} catch(e) {					_sgffx.log("*** clientIdentify FAILED");				}				_sgffx.getPhonebookList();											} else {				_sgffx.log("*** Login Failed with: "+ ourParsedResponse.StatusCode +" ***");			}		};				try {			// this._rpcCall("samurai.serverInfo", {}, result);			this._rpcCall("samurai.ServerdataGet", {}, result);		} catch(e) {			this.log('Exception in xmlrpc-request: ' + e);			this.log('Request sent: ' + request);		}		this.log("*** sipgateffx: login *** END ***");	}, | |
| 
	_sgffx.setXulObjectVisibility('showsmsformmenuitem', 1); | 
		login: function() {		this.log("*** sipgateffx: login *** BEGIN ***");		var showActiveMenu = function() {			if (_sgffx.systemArea == 'team') {				_sgffx.setXulObjectVisibility('sipgateffxDND', 1);			} else {				_sgffx.setXulObjectVisibility('sipgateffxDND', 0);			}						_sgffx.setXulObjectVisibility('showcreditmenuitem', 1);			_sgffx.setXulObjectVisibility('showvoicemailmenuitem', 1);			_sgffx.setXulObjectVisibility('showphonebookmenuitem', 1);			_sgffx.setXulObjectVisibility('showhistorymenuitem', 1);			_sgffx.setXulObjectVisibility('showfaxmenuitem', 1);			_sgffx.setXulObjectVisibility('showitemizedmenuitem', 1);			_sgffx.setXulObjectVisibility('pollbalance', 1);			_sgffx.setXulObjectVisibility('showsmsformmenuitem', 1);			_sgffx.setXulObjectVisibility('showphonenumberformmenuitem', 1);			_sgffx.setXulObjectVisibility('item_logoff', 1);			_sgffx.setXulObjectVisibility('separator1', 1);			_sgffx.setXulObjectVisibility('separator2', 1);						if (!_sgffx.getPref("extensions.sipgateffx.parsenumbers", "bool")) {				_sgffx.setXulObjectVisibility('dialactivate', 1);			}									_sgffx.setXulObjectVisibility('item_logon', 0);						_sgffx.setXulObjectVisibility('sipgateffx_loggedout', 0);			_sgffx.setXulObjectVisibility('sipgateffx_loggedin', 1);					}				if (this.isLoggedIn) {			this.log("*** sipgateffx: login *** ALREADY LOGGED IN ***");			showActiveMenu();						if(this.systemArea == 'team') {				this.showEventSummary();				this.showDoNotDisturb();			}						this.getBalance();			return;		}		var result = function(ourParsedResponse, aXML) {			if (ourParsedResponse.StatusCode && ourParsedResponse.StatusCode == 200) {					showActiveMenu();								_sgffx.isLoggedIn = true;								_sgffx.log("*** NOW logged in ***");								_sgffx.curBalance = null;				_sgffx.getBalance();								_sgffx.sipgateCredentials = ourParsedResponse;								if(ourParsedResponse.HttpServer.match(/com$/)) {					_sgffx.userCountryPrefix = '1';				} else				if(ourParsedResponse.HttpServer.match(/de$/)) {					_sgffx.userCountryPrefix = '49';				} else				if(ourParsedResponse.HttpServer.match(/at$/)) {					_sgffx.userCountryPrefix = '43';				} else				if(ourParsedResponse.HttpServer.match(/co\.uk$/)) {					_sgffx.userCountryPrefix = '44';				}												if (_sgffx.systemArea == 'team') {					_sgffx.getEventSummary();					_sgffx.getDoNotDisturb();								}								_sgffx.getTosList();				_sgffx.getRecommendedIntervals();				_sgffx.getOwnUriList();				try {					_sgffx.clientIdentify();				} catch(e) {					_sgffx.log("*** clientIdentify FAILED");				}				_sgffx.getPhonebookList();											} else {				_sgffx.log("*** Login Failed with: "+ ourParsedResponse.StatusCode +" ***");			}		};				try {			// this._rpcCall("samurai.serverInfo", {}, result);			this._rpcCall("samurai.ServerdataGet", {}, result);		} catch(e) {			this.log('Exception in xmlrpc-request: ' + e);			this.log('Request sent: ' + request);		}		this.log("*** sipgateffx: login *** END ***");	}, | |
| 
	data: "user=" + user.val() + "&password=" + password.val(), | 
	data: "user=" + user.val() + "&password=" + password.val(), | 
	function login() {    var user = $('#login-dialog input[name = user]');    var password = $('#login-dialog input[name = password]');    $('#login-message').text('Checking ...');    $.ajax({        url: "checkuser.xql",        data: "user=" + user.val() + "&password=" + password.val(),        type: 'POST',        success:            function(data, message) { $('#login-form').submit(); },        error: function (response, message) { $('#login-message').html('Login failed: ' + response.responseText); }    });} | 
| 
	}else{ window.open('../api/#'+a.id, "_blank"); } | 
	var makeLinksForApi = function(elements) {  elements = elements || 'a';  $$(elements).each(function(a) {     if (a.id) {         a.addEvent('click', function() {            top.main.location.href='../api/#'+a.id;         });     }  });} | |
| 
	mouseenter: this.bound.mouseenter, mouseleave: this.bound.mouseleave | 
	mouseenter: this.onMouseEnter, mouseleave: this.onMouseLeave | 
	    makeList: function (container) {        var l = new Jx.List(container, {            hover: true,            select: true        }, this.selection);        var target = this;        l.addEvents({            mouseenter: this.bound.mouseenter,            mouseleave: this.bound.mouseleave        });        this.lists.push(l);        return l;    }, | 
| 
	gRatingOptions = options || {}; | 
	gRatingOptions = options; | 
	function makeNiceRatingForm(options){	gRatingOptions = options || {};	var form = document.getElementById('rateForm');	if (!form) return; //? template changed	gRatingButtons = form.getElementsByTagName('input');	gUserRating = "";	for (var i=0; i<gRatingButtons.length; i++)	{		if ( gRatingButtons[i].type=="button" )		{			gUserRating = gRatingButtons[i].value;			break;		}	}	for (var i=0; i<gRatingButtons.length; i++)	{		var rateButton = gRatingButtons[i];		rateButton.initialRateValue = rateButton.value; // save it as a property		try { rateButton.type = "button"; } catch (e){}// avoid normal submit (use ajax); not working in IE6		if (navigator.userAgent.indexOf('AppleWebKit/')==-1 && navigator.userAgent.indexOf('MSIE 8')==-1) rateButton.value = ""; //hide the text IE<8/Opera - breaks safari		with (rateButton.style)		{			textIndent = "-50px"; //hide the text FF			marginLeft = marginRight = 0;		}		if (i!=gRatingButtons.length-1 && rateButton.nextSibling.nodeType == 3 /*TEXT_NODE*/)			rateButton.parentNode.removeChild(rateButton.nextSibling);		if (i>0 && rateButton.previousSibling.nodeType == 3 /*TEXT_NODE*/)			rateButton.parentNode.removeChild(rateButton.previousSibling);		pwgAddEventListener(rateButton, "click", updateRating);		pwgAddEventListener(rateButton, "mouseout", resetRatingStarDisplay);		pwgAddEventListener(rateButton, "mouseover", updateRatingStarDisplayEvt);	}	resetRatingStarDisplay();} | 
| 
	pwgAddEventListener(rateButton, "mouseout", resetRatingStarDisplay); pwgAddEventListener(rateButton, "mouseover", updateRatingStarDisplayEvt); | 
	pwgAddEventListener(rateButton, "mouseout", function() {updateRatingStarDisplay( gUserRating );}); pwgAddEventListener(rateButton, "mouseover", function(e) { updateRatingStarDisplay( e.target ? e.target.initialRateValue : e.srcElement.initialRateValue); }); | 
	function makeNiceRatingForm(options){	gRatingOptions = options || {};	var form = document.getElementById('rateForm');	if (!form) return; //? template changed	gRatingButtons = form.getElementsByTagName('input');	gUserRating = "";	for (var i=0; i<gRatingButtons.length; i++)	{		if ( gRatingButtons[i].type=="button" )		{			gUserRating = gRatingButtons[i].value;			break;		}	}	for (var i=0; i<gRatingButtons.length; i++)	{		var rateButton = gRatingButtons[i];		rateButton.initialRateValue = rateButton.value; // save it as a property		try { rateButton.type = "button"; } catch (e){}// avoid normal submit (use ajax); not working in IE6		if (navigator.userAgent.indexOf('AppleWebKit/')==-1 && navigator.userAgent.indexOf('MSIE 8')==-1) rateButton.value = ""; //hide the text IE<8/Opera - breaks safari		with (rateButton.style)		{			textIndent = "-50px"; //hide the text FF			marginLeft = marginRight = 0;		}		if (i!=gRatingButtons.length-1 && rateButton.nextSibling.nodeType == 3 /*TEXT_NODE*/)			rateButton.parentNode.removeChild(rateButton.nextSibling);		if (i>0 && rateButton.previousSibling.nodeType == 3 /*TEXT_NODE*/)			rateButton.parentNode.removeChild(rateButton.previousSibling);		pwgAddEventListener(rateButton, "click", updateRating);		pwgAddEventListener(rateButton, "mouseout", resetRatingStarDisplay);		pwgAddEventListener(rateButton, "mouseover", updateRatingStarDisplayEvt);	}	resetRatingStarDisplay();} | 
| 
	resetRatingStarDisplay(); | 
	updateRatingStarDisplay( gUserRating ); | 
	function makeNiceRatingForm(options){	gRatingOptions = options || {};	var form = document.getElementById('rateForm');	if (!form) return; //? template changed	gRatingButtons = form.getElementsByTagName('input');	gUserRating = "";	for (var i=0; i<gRatingButtons.length; i++)	{		if ( gRatingButtons[i].type=="button" )		{			gUserRating = gRatingButtons[i].value;			break;		}	}	for (var i=0; i<gRatingButtons.length; i++)	{		var rateButton = gRatingButtons[i];		rateButton.initialRateValue = rateButton.value; // save it as a property		try { rateButton.type = "button"; } catch (e){}// avoid normal submit (use ajax); not working in IE6		if (navigator.userAgent.indexOf('AppleWebKit/')==-1 && navigator.userAgent.indexOf('MSIE 8')==-1) rateButton.value = ""; //hide the text IE<8/Opera - breaks safari		with (rateButton.style)		{			textIndent = "-50px"; //hide the text FF			marginLeft = marginRight = 0;		}		if (i!=gRatingButtons.length-1 && rateButton.nextSibling.nodeType == 3 /*TEXT_NODE*/)			rateButton.parentNode.removeChild(rateButton.nextSibling);		if (i>0 && rateButton.previousSibling.nodeType == 3 /*TEXT_NODE*/)			rateButton.parentNode.removeChild(rateButton.previousSibling);		pwgAddEventListener(rateButton, "click", updateRating);		pwgAddEventListener(rateButton, "mouseout", resetRatingStarDisplay);		pwgAddEventListener(rateButton, "mouseover", updateRatingStarDisplayEvt);	}	resetRatingStarDisplay();} | 
| 
	dojo.byId("filesDiv").style.display = ""; dojo.byId("btnUploader").style.display = ""; dojo.byId("btnUpload").style.display = ""; | 
	function manageAlbumFields() {    var selectAlbum = dojo.byId("selectAlbum");    albumName = selectAlbum.value;    document.getElementById('adminGallery').innerHTML = "<table id='adminTableGallery' style='width:720px;' border='0' cellspacing='0' cellpadding='1'></table>";    if (selectAlbum.children[0].value == "New Album") {        albumIndex = selectAlbum.selectedIndex - 1;    } else {        albumIndex = selectAlbum.selectedIndex;    }    cancelAlbumDesc();    dojo.byId("progressBar").style.display = "none";    if (albumName == "New Album") {        document.getElementById('albumCoverDiv').innerHTML = "<table id='albumCover' style='width:200px;' border='0' cellspacing='0' cellpadding='1'></table>";        dojo.byId("newAlbumName").style.display = "";        dojo.byId("newAlbumLabel").style.display = "";        dojo.byId("btnAlbumDesc").style.display = "none";        dojo.byId("deleteAlbum").style.display = "none";        dojo.byId("albumDescriptionDiv").innerHTML = "<textarea cols='20' rows='5' class='textarea' name='albumDescription' id='albumDescription'></textarea>";    } else {        dojo.byId("newAlbumName").style.display = "none";        dojo.byId("newAlbumLabel").style.display = "none";        if (permissions.indexOf("|editAlbumDescription.others|") != -1 || (permissions.indexOf("|editAlbumDescription.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1) || permissions.indexOf("|" + albumName + ".editAlbumDescription|") != -1) {            dojo.byId("btnAlbumDesc").style.display = "";        } else {            dojo.byId("btnAlbumDesc").style.display = "none";        }        if (permissions.indexOf("|deleteAlbum.others|") != -1 || (permissions.indexOf("|deleteAlbum.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1)) {            dojo.byId("deleteAlbum").style.display = "";        } else {            dojo.byId("deleteAlbum").style.display = "none";        }        gallery.getAlbumsToUser(SECURITY_TOKEN).addCallback(function(albums, exception) {            //   gallery.getAlbums().addCallback( function(albums, exception) {            if (exception) {                alert(exception.msg);                return;            }            dojo.byId("albumDescription").value = albums[selectAlbum.selectedIndex - 1].description;            gallery.getAlbumCoverToUser(albums[albumIndex].name, SECURITY_TOKEN).addCallback(setAlbumCoverResponse);            // gallery.getAlbumCover(albums[albumIndex].name).addCallback(setAlbumCoverResponse);            initializeAdminGallery();        });        dojo.byId("albumDescription").value = "";        if (permissions.indexOf("|addImagesToAlbum.others|") != -1 || (permissions.indexOf("|addImagesToAlbum.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1) || permissions.indexOf("|" + albumName + ".addImages|") != -1) {            dojo.byId("filesDiv").style.display = "";            dojo.byId("btnUploader").style.display = "";            dojo.byId("btnUpload").style.display = "";        } else {            dojo.byId("filesDiv").style.display = "none";            dojo.byId("btnUploader").style.display = "none";            dojo.byId("btnUpload").style.display = "none";        }    }} | |
| 
	if (permissions.indexOf("|editAlbumDescription.others|") != -1 || (permissions.indexOf("|editAlbumDescription.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1) || permissions.indexOf("|" + albumName + ".editAlbumDescription|") != -1) { | 
	if (userId == "SuperAdmin" || ( (albums[albumIndex].owners + "").indexOf(userId) != -1) || permissions.indexOf("|" + albumName + ".editAlbumDescription|") != -1) { | 
	function manageAlbumFields() {    var selectAlbum = dojo.byId("selectAlbum");    albumName = selectAlbum.value;    document.getElementById('adminGallery').innerHTML = "<table id='adminTableGallery' style='width:720px;' border='0' cellspacing='0' cellpadding='1'></table>";    if (selectAlbum.children[0].value == "New Album") {        albumIndex = selectAlbum.selectedIndex - 1;    } else {        albumIndex = selectAlbum.selectedIndex;    }    cancelAlbumDesc();    dojo.byId("progressBar").style.display = "none";    if (albumName == "New Album") {        document.getElementById('albumCoverDiv').innerHTML = "<table id='albumCover' style='width:200px;' border='0' cellspacing='0' cellpadding='1'></table>";        dojo.byId("newAlbumName").style.display = "";        dojo.byId("newAlbumLabel").style.display = "";        dojo.byId("btnAlbumDesc").style.display = "none";        dojo.byId("deleteAlbum").style.display = "none";        dojo.byId("albumDescriptionDiv").innerHTML = "<textarea cols='20' rows='5' class='textarea' name='albumDescription' id='albumDescription'></textarea>";    } else {        dojo.byId("newAlbumName").style.display = "none";        dojo.byId("newAlbumLabel").style.display = "none";        if (permissions.indexOf("|editAlbumDescription.others|") != -1 || (permissions.indexOf("|editAlbumDescription.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1) || permissions.indexOf("|" + albumName + ".editAlbumDescription|") != -1) {            dojo.byId("btnAlbumDesc").style.display = "";        } else {            dojo.byId("btnAlbumDesc").style.display = "none";        }        if (permissions.indexOf("|deleteAlbum.others|") != -1 || (permissions.indexOf("|deleteAlbum.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1)) {            dojo.byId("deleteAlbum").style.display = "";        } else {            dojo.byId("deleteAlbum").style.display = "none";        }        gallery.getAlbumsToUser(SECURITY_TOKEN).addCallback(function(albums, exception) {            //   gallery.getAlbums().addCallback( function(albums, exception) {            if (exception) {                alert(exception.msg);                return;            }            dojo.byId("albumDescription").value = albums[selectAlbum.selectedIndex - 1].description;            gallery.getAlbumCoverToUser(albums[albumIndex].name, SECURITY_TOKEN).addCallback(setAlbumCoverResponse);            // gallery.getAlbumCover(albums[albumIndex].name).addCallback(setAlbumCoverResponse);            initializeAdminGallery();        });        dojo.byId("albumDescription").value = "";        if (permissions.indexOf("|addImagesToAlbum.others|") != -1 || (permissions.indexOf("|addImagesToAlbum.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1) || permissions.indexOf("|" + albumName + ".addImages|") != -1) {            dojo.byId("filesDiv").style.display = "";            dojo.byId("btnUploader").style.display = "";            dojo.byId("btnUpload").style.display = "";        } else {            dojo.byId("filesDiv").style.display = "none";            dojo.byId("btnUploader").style.display = "none";            dojo.byId("btnUpload").style.display = "none";        }    }} | 
| 
	if (permissions.indexOf("|deleteAlbum.others|") != -1 || (permissions.indexOf("|deleteAlbum.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1)) { | 
	if (userId == "SuperAdmin" || ( (albums[albumIndex].owners + "").indexOf(userId) != -1) || permissions.indexOf("|" + albumName + ".deleteAlbum|") != -1) { | 
	function manageAlbumFields() {    var selectAlbum = dojo.byId("selectAlbum");    albumName = selectAlbum.value;    document.getElementById('adminGallery').innerHTML = "<table id='adminTableGallery' style='width:720px;' border='0' cellspacing='0' cellpadding='1'></table>";    if (selectAlbum.children[0].value == "New Album") {        albumIndex = selectAlbum.selectedIndex - 1;    } else {        albumIndex = selectAlbum.selectedIndex;    }    cancelAlbumDesc();    dojo.byId("progressBar").style.display = "none";    if (albumName == "New Album") {        document.getElementById('albumCoverDiv').innerHTML = "<table id='albumCover' style='width:200px;' border='0' cellspacing='0' cellpadding='1'></table>";        dojo.byId("newAlbumName").style.display = "";        dojo.byId("newAlbumLabel").style.display = "";        dojo.byId("btnAlbumDesc").style.display = "none";        dojo.byId("deleteAlbum").style.display = "none";        dojo.byId("albumDescriptionDiv").innerHTML = "<textarea cols='20' rows='5' class='textarea' name='albumDescription' id='albumDescription'></textarea>";    } else {        dojo.byId("newAlbumName").style.display = "none";        dojo.byId("newAlbumLabel").style.display = "none";        if (permissions.indexOf("|editAlbumDescription.others|") != -1 || (permissions.indexOf("|editAlbumDescription.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1) || permissions.indexOf("|" + albumName + ".editAlbumDescription|") != -1) {            dojo.byId("btnAlbumDesc").style.display = "";        } else {            dojo.byId("btnAlbumDesc").style.display = "none";        }        if (permissions.indexOf("|deleteAlbum.others|") != -1 || (permissions.indexOf("|deleteAlbum.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1)) {            dojo.byId("deleteAlbum").style.display = "";        } else {            dojo.byId("deleteAlbum").style.display = "none";        }        gallery.getAlbumsToUser(SECURITY_TOKEN).addCallback(function(albums, exception) {            //   gallery.getAlbums().addCallback( function(albums, exception) {            if (exception) {                alert(exception.msg);                return;            }            dojo.byId("albumDescription").value = albums[selectAlbum.selectedIndex - 1].description;            gallery.getAlbumCoverToUser(albums[albumIndex].name, SECURITY_TOKEN).addCallback(setAlbumCoverResponse);            // gallery.getAlbumCover(albums[albumIndex].name).addCallback(setAlbumCoverResponse);            initializeAdminGallery();        });        dojo.byId("albumDescription").value = "";        if (permissions.indexOf("|addImagesToAlbum.others|") != -1 || (permissions.indexOf("|addImagesToAlbum.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1) || permissions.indexOf("|" + albumName + ".addImages|") != -1) {            dojo.byId("filesDiv").style.display = "";            dojo.byId("btnUploader").style.display = "";            dojo.byId("btnUpload").style.display = "";        } else {            dojo.byId("filesDiv").style.display = "none";            dojo.byId("btnUploader").style.display = "none";            dojo.byId("btnUpload").style.display = "none";        }    }} | 
| 
	alert(exception.msg); return; | 
	adminLogout(); | 
	function manageAlbumFields() {    var selectAlbum = dojo.byId("selectAlbum");    albumName = selectAlbum.value;    document.getElementById('adminGallery').innerHTML = "<table id='adminTableGallery' style='width:720px;' border='0' cellspacing='0' cellpadding='1'></table>";    if (selectAlbum.children[0].value == "New Album") {        albumIndex = selectAlbum.selectedIndex - 1;    } else {        albumIndex = selectAlbum.selectedIndex;    }    cancelAlbumDesc();    dojo.byId("progressBar").style.display = "none";    if (albumName == "New Album") {        document.getElementById('albumCoverDiv').innerHTML = "<table id='albumCover' style='width:200px;' border='0' cellspacing='0' cellpadding='1'></table>";        dojo.byId("newAlbumName").style.display = "";        dojo.byId("newAlbumLabel").style.display = "";        dojo.byId("btnAlbumDesc").style.display = "none";        dojo.byId("deleteAlbum").style.display = "none";        dojo.byId("albumDescriptionDiv").innerHTML = "<textarea cols='20' rows='5' class='textarea' name='albumDescription' id='albumDescription'></textarea>";    } else {        dojo.byId("newAlbumName").style.display = "none";        dojo.byId("newAlbumLabel").style.display = "none";        if (permissions.indexOf("|editAlbumDescription.others|") != -1 || (permissions.indexOf("|editAlbumDescription.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1) || permissions.indexOf("|" + albumName + ".editAlbumDescription|") != -1) {            dojo.byId("btnAlbumDesc").style.display = "";        } else {            dojo.byId("btnAlbumDesc").style.display = "none";        }        if (permissions.indexOf("|deleteAlbum.others|") != -1 || (permissions.indexOf("|deleteAlbum.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1)) {            dojo.byId("deleteAlbum").style.display = "";        } else {            dojo.byId("deleteAlbum").style.display = "none";        }        gallery.getAlbumsToUser(SECURITY_TOKEN).addCallback(function(albums, exception) {            //   gallery.getAlbums().addCallback( function(albums, exception) {            if (exception) {                alert(exception.msg);                return;            }            dojo.byId("albumDescription").value = albums[selectAlbum.selectedIndex - 1].description;            gallery.getAlbumCoverToUser(albums[albumIndex].name, SECURITY_TOKEN).addCallback(setAlbumCoverResponse);            // gallery.getAlbumCover(albums[albumIndex].name).addCallback(setAlbumCoverResponse);            initializeAdminGallery();        });        dojo.byId("albumDescription").value = "";        if (permissions.indexOf("|addImagesToAlbum.others|") != -1 || (permissions.indexOf("|addImagesToAlbum.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1) || permissions.indexOf("|" + albumName + ".addImages|") != -1) {            dojo.byId("filesDiv").style.display = "";            dojo.byId("btnUploader").style.display = "";            dojo.byId("btnUpload").style.display = "";        } else {            dojo.byId("filesDiv").style.display = "none";            dojo.byId("btnUploader").style.display = "none";            dojo.byId("btnUpload").style.display = "none";        }    }} | 
| 
	dojo.byId("albumDescription").value = albums[selectAlbum.selectedIndex - 1].description; | 
	dojo.byId("albumDescription").value = albums[albumIndex].description; | 
	function manageAlbumFields() {    var selectAlbum = dojo.byId("selectAlbum");    albumName = selectAlbum.value;    document.getElementById('adminGallery').innerHTML = "<table id='adminTableGallery' style='width:720px;' border='0' cellspacing='0' cellpadding='1'></table>";    if (selectAlbum.children[0].value == "New Album") {        albumIndex = selectAlbum.selectedIndex - 1;    } else {        albumIndex = selectAlbum.selectedIndex;    }    cancelAlbumDesc();    dojo.byId("progressBar").style.display = "none";    if (albumName == "New Album") {        document.getElementById('albumCoverDiv').innerHTML = "<table id='albumCover' style='width:200px;' border='0' cellspacing='0' cellpadding='1'></table>";        dojo.byId("newAlbumName").style.display = "";        dojo.byId("newAlbumLabel").style.display = "";        dojo.byId("btnAlbumDesc").style.display = "none";        dojo.byId("deleteAlbum").style.display = "none";        dojo.byId("albumDescriptionDiv").innerHTML = "<textarea cols='20' rows='5' class='textarea' name='albumDescription' id='albumDescription'></textarea>";    } else {        dojo.byId("newAlbumName").style.display = "none";        dojo.byId("newAlbumLabel").style.display = "none";        if (permissions.indexOf("|editAlbumDescription.others|") != -1 || (permissions.indexOf("|editAlbumDescription.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1) || permissions.indexOf("|" + albumName + ".editAlbumDescription|") != -1) {            dojo.byId("btnAlbumDesc").style.display = "";        } else {            dojo.byId("btnAlbumDesc").style.display = "none";        }        if (permissions.indexOf("|deleteAlbum.others|") != -1 || (permissions.indexOf("|deleteAlbum.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1)) {            dojo.byId("deleteAlbum").style.display = "";        } else {            dojo.byId("deleteAlbum").style.display = "none";        }        gallery.getAlbumsToUser(SECURITY_TOKEN).addCallback(function(albums, exception) {            //   gallery.getAlbums().addCallback( function(albums, exception) {            if (exception) {                alert(exception.msg);                return;            }            dojo.byId("albumDescription").value = albums[selectAlbum.selectedIndex - 1].description;            gallery.getAlbumCoverToUser(albums[albumIndex].name, SECURITY_TOKEN).addCallback(setAlbumCoverResponse);            // gallery.getAlbumCover(albums[albumIndex].name).addCallback(setAlbumCoverResponse);            initializeAdminGallery();        });        dojo.byId("albumDescription").value = "";        if (permissions.indexOf("|addImagesToAlbum.others|") != -1 || (permissions.indexOf("|addImagesToAlbum.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1) || permissions.indexOf("|" + albumName + ".addImages|") != -1) {            dojo.byId("filesDiv").style.display = "";            dojo.byId("btnUploader").style.display = "";            dojo.byId("btnUpload").style.display = "";        } else {            dojo.byId("filesDiv").style.display = "none";            dojo.byId("btnUploader").style.display = "none";            dojo.byId("btnUpload").style.display = "none";        }    }} | 
| 
	if (permissions.indexOf("|addImagesToAlbum.others|") != -1 || (permissions.indexOf("|addImagesToAlbum.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1) || permissions.indexOf("|" + albumName + ".addImages|") != -1) { dojo.byId("filesDiv").style.display = ""; dojo.byId("btnUploader").style.display = ""; dojo.byId("btnUpload").style.display = ""; } else { | 
	if (!(userId == "SuperAdmin" || (albums[albumIndex].owners + "").indexOf(userId) != -1 || permissions.indexOf("|" + albumName + ".addImages|") != -1)) { | 
	function manageAlbumFields() {    var selectAlbum = dojo.byId("selectAlbum");    albumName = selectAlbum.value;    document.getElementById('adminGallery').innerHTML = "<table id='adminTableGallery' style='width:720px;' border='0' cellspacing='0' cellpadding='1'></table>";    if (selectAlbum.children[0].value == "New Album") {        albumIndex = selectAlbum.selectedIndex - 1;    } else {        albumIndex = selectAlbum.selectedIndex;    }    cancelAlbumDesc();    dojo.byId("progressBar").style.display = "none";    if (albumName == "New Album") {        document.getElementById('albumCoverDiv').innerHTML = "<table id='albumCover' style='width:200px;' border='0' cellspacing='0' cellpadding='1'></table>";        dojo.byId("newAlbumName").style.display = "";        dojo.byId("newAlbumLabel").style.display = "";        dojo.byId("btnAlbumDesc").style.display = "none";        dojo.byId("deleteAlbum").style.display = "none";        dojo.byId("albumDescriptionDiv").innerHTML = "<textarea cols='20' rows='5' class='textarea' name='albumDescription' id='albumDescription'></textarea>";    } else {        dojo.byId("newAlbumName").style.display = "none";        dojo.byId("newAlbumLabel").style.display = "none";        if (permissions.indexOf("|editAlbumDescription.others|") != -1 || (permissions.indexOf("|editAlbumDescription.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1) || permissions.indexOf("|" + albumName + ".editAlbumDescription|") != -1) {            dojo.byId("btnAlbumDesc").style.display = "";        } else {            dojo.byId("btnAlbumDesc").style.display = "none";        }        if (permissions.indexOf("|deleteAlbum.others|") != -1 || (permissions.indexOf("|deleteAlbum.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1)) {            dojo.byId("deleteAlbum").style.display = "";        } else {            dojo.byId("deleteAlbum").style.display = "none";        }        gallery.getAlbumsToUser(SECURITY_TOKEN).addCallback(function(albums, exception) {            //   gallery.getAlbums().addCallback( function(albums, exception) {            if (exception) {                alert(exception.msg);                return;            }            dojo.byId("albumDescription").value = albums[selectAlbum.selectedIndex - 1].description;            gallery.getAlbumCoverToUser(albums[albumIndex].name, SECURITY_TOKEN).addCallback(setAlbumCoverResponse);            // gallery.getAlbumCover(albums[albumIndex].name).addCallback(setAlbumCoverResponse);            initializeAdminGallery();        });        dojo.byId("albumDescription").value = "";        if (permissions.indexOf("|addImagesToAlbum.others|") != -1 || (permissions.indexOf("|addImagesToAlbum.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1) || permissions.indexOf("|" + albumName + ".addImages|") != -1) {            dojo.byId("filesDiv").style.display = "";            dojo.byId("btnUploader").style.display = "";            dojo.byId("btnUpload").style.display = "";        } else {            dojo.byId("filesDiv").style.display = "none";            dojo.byId("btnUploader").style.display = "none";            dojo.byId("btnUpload").style.display = "none";        }    }} | 
| 
	albumIndex=selectAlbum.selectedIndex-1; | 
	if (selectAlbum.children[0].value == "New Album") { albumIndex = selectAlbum.selectedIndex - 1; } else { albumIndex = selectAlbum.selectedIndex; } | 
	function manageAlbumFields(){    var selectAlbum = dojo.byId("selectAlbum");    albumName = selectAlbum.value;    document.getElementById('adminGallery').innerHTML = "<table id='adminTableGallery' style='width:720px;' border='0' cellspacing='0' cellpadding='1'></table>";    albumIndex=selectAlbum.selectedIndex-1;    cancelAlbumDesc();    dojo.byId("progressBar").style.display="none";    if(albumName == "New Album") {        document.getElementById('albumCoverDiv').innerHTML = "<table id='albumCover' style='width:200px;' border='0' cellspacing='0' cellpadding='1'></table>";        dojo.byId("newAlbumName").style.display = "";        dojo.byId("newAlbumLabel").style.display = "";        dojo.byId("btnAlbumDesc").style.display = "none";        dojo.byId("deleteAlbum").style.display = "none";        dojo.byId("albumDescriptionDiv").innerHTML="<textarea cols='20' rows='5' class='textarea' name='albumDescription' id='albumDescription'></textarea>";    }else{        dojo.byId("newAlbumName").style.display = "none";        dojo.byId("newAlbumLabel").style.display = "none";        dojo.byId("btnAlbumDesc").style.display = "";        dojo.byId("deleteAlbum").style.display = "";        gallery.getAlbums().addCallback( function(albums, exception) {            if(exception) {                alert(exception.msg);                return;            }            dojo.byId("albumDescription").value=albums[selectAlbum.selectedIndex-1].description;            gallery.getAlbumCover(albums[albumIndex].name).addCallback(setAlbumCoverResponse);            initializeAdminGallery();        });        dojo.byId("albumDescription").value="";    }} | 
| 
	dojo.byId("btnAlbumDesc").style.display = ""; dojo.byId("deleteAlbum").style.display = ""; gallery.getAlbums().addCallback( function(albums, exception) { if(exception) { | 
	if (permissions.indexOf("|editAlbumDescription.others|") != -1 || (permissions.indexOf("|editAlbumDescription.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1) || permissions.indexOf("|" + albumName + ".editAlbumDescription|") != -1) { dojo.byId("btnAlbumDesc").style.display = ""; } else { dojo.byId("btnAlbumDesc").style.display = "none"; } if (permissions.indexOf("|deleteAlbum.others|") != -1 || (permissions.indexOf("|deleteAlbum.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1)) { dojo.byId("deleteAlbum").style.display = ""; } else { dojo.byId("deleteAlbum").style.display = "none"; } gallery.getAlbumsToUser(SECURITY_TOKEN).addCallback(function(albums, exception) {  if (exception) { | 
	function manageAlbumFields(){    var selectAlbum = dojo.byId("selectAlbum");    albumName = selectAlbum.value;    document.getElementById('adminGallery').innerHTML = "<table id='adminTableGallery' style='width:720px;' border='0' cellspacing='0' cellpadding='1'></table>";    albumIndex=selectAlbum.selectedIndex-1;    cancelAlbumDesc();    dojo.byId("progressBar").style.display="none";    if(albumName == "New Album") {        document.getElementById('albumCoverDiv').innerHTML = "<table id='albumCover' style='width:200px;' border='0' cellspacing='0' cellpadding='1'></table>";        dojo.byId("newAlbumName").style.display = "";        dojo.byId("newAlbumLabel").style.display = "";        dojo.byId("btnAlbumDesc").style.display = "none";        dojo.byId("deleteAlbum").style.display = "none";        dojo.byId("albumDescriptionDiv").innerHTML="<textarea cols='20' rows='5' class='textarea' name='albumDescription' id='albumDescription'></textarea>";    }else{        dojo.byId("newAlbumName").style.display = "none";        dojo.byId("newAlbumLabel").style.display = "none";        dojo.byId("btnAlbumDesc").style.display = "";        dojo.byId("deleteAlbum").style.display = "";        gallery.getAlbums().addCallback( function(albums, exception) {            if(exception) {                alert(exception.msg);                return;            }            dojo.byId("albumDescription").value=albums[selectAlbum.selectedIndex-1].description;            gallery.getAlbumCover(albums[albumIndex].name).addCallback(setAlbumCoverResponse);            initializeAdminGallery();        });        dojo.byId("albumDescription").value="";    }} | 
| 
	dojo.byId("albumDescription").value=albums[selectAlbum.selectedIndex-1].description; gallery.getAlbumCover(albums[albumIndex].name).addCallback(setAlbumCoverResponse); | 
	dojo.byId("albumDescription").value = albums[selectAlbum.selectedIndex - 1].description; gallery.getAlbumCoverToUser(albums[albumIndex].name, SECURITY_TOKEN).addCallback(setAlbumCoverResponse); | 
	function manageAlbumFields(){    var selectAlbum = dojo.byId("selectAlbum");    albumName = selectAlbum.value;    document.getElementById('adminGallery').innerHTML = "<table id='adminTableGallery' style='width:720px;' border='0' cellspacing='0' cellpadding='1'></table>";    albumIndex=selectAlbum.selectedIndex-1;    cancelAlbumDesc();    dojo.byId("progressBar").style.display="none";    if(albumName == "New Album") {        document.getElementById('albumCoverDiv').innerHTML = "<table id='albumCover' style='width:200px;' border='0' cellspacing='0' cellpadding='1'></table>";        dojo.byId("newAlbumName").style.display = "";        dojo.byId("newAlbumLabel").style.display = "";        dojo.byId("btnAlbumDesc").style.display = "none";        dojo.byId("deleteAlbum").style.display = "none";        dojo.byId("albumDescriptionDiv").innerHTML="<textarea cols='20' rows='5' class='textarea' name='albumDescription' id='albumDescription'></textarea>";    }else{        dojo.byId("newAlbumName").style.display = "none";        dojo.byId("newAlbumLabel").style.display = "none";        dojo.byId("btnAlbumDesc").style.display = "";        dojo.byId("deleteAlbum").style.display = "";        gallery.getAlbums().addCallback( function(albums, exception) {            if(exception) {                alert(exception.msg);                return;            }            dojo.byId("albumDescription").value=albums[selectAlbum.selectedIndex-1].description;            gallery.getAlbumCover(albums[albumIndex].name).addCallback(setAlbumCoverResponse);            initializeAdminGallery();        });        dojo.byId("albumDescription").value="";    }} | 
| 
	dojo.byId("albumDescription").value=""; | 
	dojo.byId("albumDescription").value = ""; if (permissions.indexOf("|addImagesToAlbum.others|") != -1 || (permissions.indexOf("|addImagesToAlbum.own|") != -1 && albums[albumIndex].owners + "".indexOf(userId) != -1) || permissions.indexOf("|" + albumName + ".addImages|") != -1) { dojo.byId("filesDiv").style.display = ""; dojo.byId("btnUploader").style.display = ""; dojo.byId("btnUpload").style.display = ""; } else { dojo.byId("filesDiv").style.display = "none"; dojo.byId("btnUploader").style.display = "none"; dojo.byId("btnUpload").style.display = "none"; } | 
	function manageAlbumFields(){    var selectAlbum = dojo.byId("selectAlbum");    albumName = selectAlbum.value;    document.getElementById('adminGallery').innerHTML = "<table id='adminTableGallery' style='width:720px;' border='0' cellspacing='0' cellpadding='1'></table>";    albumIndex=selectAlbum.selectedIndex-1;    cancelAlbumDesc();    dojo.byId("progressBar").style.display="none";    if(albumName == "New Album") {        document.getElementById('albumCoverDiv').innerHTML = "<table id='albumCover' style='width:200px;' border='0' cellspacing='0' cellpadding='1'></table>";        dojo.byId("newAlbumName").style.display = "";        dojo.byId("newAlbumLabel").style.display = "";        dojo.byId("btnAlbumDesc").style.display = "none";        dojo.byId("deleteAlbum").style.display = "none";        dojo.byId("albumDescriptionDiv").innerHTML="<textarea cols='20' rows='5' class='textarea' name='albumDescription' id='albumDescription'></textarea>";    }else{        dojo.byId("newAlbumName").style.display = "none";        dojo.byId("newAlbumLabel").style.display = "none";        dojo.byId("btnAlbumDesc").style.display = "";        dojo.byId("deleteAlbum").style.display = "";        gallery.getAlbums().addCallback( function(albums, exception) {            if(exception) {                alert(exception.msg);                return;            }            dojo.byId("albumDescription").value=albums[selectAlbum.selectedIndex-1].description;            gallery.getAlbumCover(albums[albumIndex].name).addCallback(setAlbumCoverResponse);            initializeAdminGallery();        });        dojo.byId("albumDescription").value="";    }} | 
| 
	readerChecks = []; writerChecks = []; | 
	readerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-read-chk", disabled : true })]; writerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-write-chk", disabled : true })]; | 
	Gemma.SecurityManager.managePermissions = function(elid, clazz, id) {	/*	 * Show a panel to 1) make the data set private or public 2) share the data	 * with groups the user is in an which 3) shows the current permissions.	 * There can be any number of groups. On returning, update the div.	 */	Ext.DomHelper.overwrite(elid, {				tag : 'img',				src : "/Gemma/images/loading.gif"			});	/*	 * Need to get: public status from server; group sharing; available groups.	 */	var showSecurityForm = function(securityInfo) {		var isPublic = securityInfo.publiclyReadable;		var isShared = securityInfo.shared;		var readers = securityInfo.groupsThatCanRead;		var writers = securityInfo.groupsThatCanWrite;		var availableGroups = securityInfo.availableGroups;		readerChecks = [];		writerChecks = [];		for (var i = 0, len = availableGroups.length; i < len; i++) {			var groupName = availableGroups[i];			readerChecks.push(new Ext.form.Checkbox({						checked : readers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-read-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));			writerChecks.push(new Ext.form.Checkbox({						checked : writers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-write-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));		}		/*		 * show panel...		 */		var sp = new Ext.Window({			title : "Security for: "					+ Ext.util.Format.ellipsis(securityInfo.entityName, 70,							true),			height : 300,			width : 500,			minimizable : false,			maximizable : false,			modal : true,			bodyStyle : 'padding:5px 5px 0',			stateful : false,			initComponent : function() {				Ext.Window.superclass.initComponent.call(this);				/*				 * Add checkboxes as needed...				 */				if (readerChecks.size() != 0) {					Ext.apply(Ext.getCmp('reader-checks'), {								items : readerChecks							});				}				if (writerChecks.size() != 0) {					Ext.apply(Ext.getCmp('writer-checks'), {								items : writerChecks							});				}				this.doLayout();			},			items : [{						xtype : 'form',						layout : 'column',						autoHeight : true,						autoWidth : true,						defaults : {							layout : 'form',							border : false,							bodyStyle : 'padding:4px'						},						items : [{									xtype : 'fieldset',									autoHeight : true,									autoWidth : true,									items : [{												xtype : 'checkbox',												boxLabel : "Public",												id : 'public-checkbox',												checked : isPublic											}, {												xtype : 'checkboxgroup',												width : 300,												itemCls : 'x-check-group-alt',												fieldLabel : "Readers",												id : 'reader-checks',												columns : 1											}, {												xtype : 'checkboxgroup',												width : 300,												itemCls : 'x-check-group-alt',												fieldLabel : 'Writers',												id : 'writer-checks',												columns : 1											}]								}]					}],			buttons : [{				text : "Save changes",				handler : function(b, e) {					var loadMask = new Ext.LoadMask(sp.getEl(), {								msg : "Saving changes..."							});					loadMask.show();					securityInfo.publiclyReadable = Ext							.getCmp('public-checkbox').getValue();					var updatedGroupsThatCanRead = [];					var updatedGroupsThatCanWrite = [];					var shared = false;					for (var i = 0, len = availableGroups.length; i < len; i++) {						var groupName = availableGroups[i];						if (groupName === Gemma.SecurityManager.adminGroupName) {							continue;						}						if (Ext.getCmp(groupName + "-write-chk").getValue()) {							updatedGroupsThatCanWrite.push(groupName);							shared = true;						}						if (Ext.getCmp(groupName + "-read-chk").getValue()								|| Ext.getCmp(groupName + "-write-chk")										.getValue()) {							updatedGroupsThatCanRead.push(groupName);							shared = true;						}					}					securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite;					securityInfo.groupsThatCanRead = updatedGroupsThatCanRead;					SecurityController.updatePermission(securityInfo, {								callback : function() {									sp.destroy();									Gemma.SecurityManager.updateSecurityLink(											elid,											securityInfo.publiclyReadable,											shared);								},								errorHandler : function() {									sp.destroy();									alert("There was an error saving the settings.");									Gemma.SecurityManager.updateSecurityLink(											elid,											securityInfo.publiclyReadable,											sared);								}							});				}			}, {				text : 'Cancel',				handler : function(b, e) {					sp.destroy();				}			}]		});		sp.show();		// remove the load mask from the table.		Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared);	};	/*	 * Initialization.	 */	SecurityController.getSecurityInfo({				classDelegatingFor : clazz,				id : id			}, {				callback : function(securityInfo) {					showSecurityForm(securityInfo);				},				errorHandler : function(data) {					alert("There was an error getting your group information: "							+ data);				}			});}; | 
| 
	callback : function() { | 
	callback : function(updatedInfo) { | 
	Gemma.SecurityManager.managePermissions = function(elid, clazz, id) {	/*	 * Show a panel to 1) make the data set private or public 2) share the data with groups the user is in an which 3)	 * shows the current permissions. There can be any number of groups. On returning, update the div.	 */	Ext.DomHelper.overwrite(elid, {				tag : 'img',				src : "/Gemma/images/loading.gif"			});	/*	 * Need to get: public status from server; group sharing; available groups.	 */	var showSecurityForm = function(securityInfo) {		var isPublic = securityInfo.publiclyReadable;		var isShared = securityInfo.shared;		var readers = securityInfo.groupsThatCanRead;		var writers = securityInfo.groupsThatCanWrite;		var availableGroups = securityInfo.availableGroups;		var canManage = securityInfo.currentUserCanwrite;		// FIXME:		// Server returns null if the currently logged user belongs to no		// custom groups which is bad (for following reasons) and technikally		// incorrect.		// All users belong to the user group anyway but can't edit it.		// Adding an array=null to a Component bombs. Adding a null check		// doesn't		// help because the panel has a 'field set' already declared, which at		// runtime has to have at least one checkbox in it.		// A way out of this is to apply the combo boxes and the field set at		// the same time if they are necessary.		// My kungfu no enough strong ;p		readerChecks = [new Ext.form.Checkbox({					checked : true,					boxLabel : 'Users',					id : 'user' + "-read-chk",					disabled : true				})];		writerChecks = [new Ext.form.Checkbox({					checked : true,					boxLabel : 'Users',					id : 'user' + "-write-chk",					disabled : true				})];		for (var i = 0, len = availableGroups.length; i < len; i++) {			var groupName = availableGroups[i];			readerChecks.push(new Ext.form.Checkbox({						checked : readers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-read-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));			writerChecks.push(new Ext.form.Checkbox({						checked : writers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-write-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));		}		/*		 * show panel...		 */		var sp = new Ext.Window({					title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true),					height : 300,					width : 500,					minimizable : false,					maximizable : false,					modal : true,					bodyStyle : 'padding:5px 5px 0',					stateful : false,					initComponent : function() {						Ext.Window.superclass.initComponent.call(this);						/*						 * Add checkboxes as needed...						 */						if (readerChecks.size() != 0) {							Ext.apply(Ext.getCmp('reader-checks'), {										items : readerChecks									});						}						if (writerChecks.size() != 0) {							Ext.apply(Ext.getCmp('writer-checks'), {										items : writerChecks									});						}						this.doLayout();					},					items : [{								xtype : 'form',								layout : 'column',								autoHeight : true,								autoWidth : true,								defaults : {									layout : 'form',									border : false,									bodyStyle : 'padding:4px'								},								items : [{											xtype : 'fieldset',											autoHeight : true,											autoWidth : true,											items : [{														xtype : 'checkbox',														boxLabel : "Public",														id : 'public-checkbox',														checked : isPublic,														disabled : !canManage													}, {														xtype : 'checkboxgroup',														width : 300,														itemCls : 'x-check-group-alt',														fieldLabel : "Readers",														id : 'reader-checks',														disabled : !canManage,														columns : 1													}, {														xtype : 'checkboxgroup',														width : 300,														itemCls : 'x-check-group-alt',														fieldLabel : 'Writers',														id : 'writer-checks',														disabled : !canManage,														columns : 1													}]										}]							}],					buttons : [{						text : "Save changes",						disabled : !canManage,						handler : function(b, e) {							var loadMask = new Ext.LoadMask(sp.getEl(), {										msg : "Saving changes..."									});							loadMask.show();							securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue();							var updatedGroupsThatCanRead = [];							var updatedGroupsThatCanWrite = [];							var shared = false;							for (var i = 0, len = availableGroups.length; i < len; i++) {								var groupName = availableGroups[i];								if (groupName === Gemma.SecurityManager.adminGroupName) {									continue;								}								if (Ext.getCmp(groupName + "-write-chk").getValue()) {									updatedGroupsThatCanWrite.push(groupName);									shared = true;								}								if (Ext.getCmp(groupName + "-read-chk").getValue()										|| Ext.getCmp(groupName + "-write-chk").getValue()) {									updatedGroupsThatCanRead.push(groupName);									shared = true;								}							}							securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite;							securityInfo.groupsThatCanRead = updatedGroupsThatCanRead;							SecurityController.updatePermission(securityInfo, {										callback : function() {											sp.destroy();											Gemma.SecurityManager.updateSecurityLink(elid,													securityInfo.publiclyReadable, shared);										},										errorHandler : function() {											sp.destroy();											alert("There was an error saving the settings.");											Gemma.SecurityManager.updateSecurityLink(elid,													securityInfo.publiclyReadable, sared);										}									});						}					}, {						text : 'Cancel',						handler : function(b, e) {							sp.destroy();						}					}]				});		sp.show();		// remove the load mask from the table.		Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared);	};	/*	 * Initialization.	 */	SecurityController.getSecurityInfo({				classDelegatingFor : clazz,				id : id			}, {				callback : function(securityInfo) {					showSecurityForm(securityInfo);				},				errorHandler : function(data) {					alert("There was an error getting your group information: " + data);				}			});}; | 
| 
	Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, shared); | 
	Gemma.SecurityManager.updateSecurityLink(elid, updatedInfo.entityClass, updatedInfo.entityId, updatedInfo.publiclyReadable, shared, updatedInfo.currentUserCanwrite); | 
	Gemma.SecurityManager.managePermissions = function(elid, clazz, id) {	/*	 * Show a panel to 1) make the data set private or public 2) share the data with groups the user is in an which 3)	 * shows the current permissions. There can be any number of groups. On returning, update the div.	 */	Ext.DomHelper.overwrite(elid, {				tag : 'img',				src : "/Gemma/images/loading.gif"			});	/*	 * Need to get: public status from server; group sharing; available groups.	 */	var showSecurityForm = function(securityInfo) {		var isPublic = securityInfo.publiclyReadable;		var isShared = securityInfo.shared;		var readers = securityInfo.groupsThatCanRead;		var writers = securityInfo.groupsThatCanWrite;		var availableGroups = securityInfo.availableGroups;		var canManage = securityInfo.currentUserCanwrite;		// FIXME:		// Server returns null if the currently logged user belongs to no		// custom groups which is bad (for following reasons) and technikally		// incorrect.		// All users belong to the user group anyway but can't edit it.		// Adding an array=null to a Component bombs. Adding a null check		// doesn't		// help because the panel has a 'field set' already declared, which at		// runtime has to have at least one checkbox in it.		// A way out of this is to apply the combo boxes and the field set at		// the same time if they are necessary.		// My kungfu no enough strong ;p		readerChecks = [new Ext.form.Checkbox({					checked : true,					boxLabel : 'Users',					id : 'user' + "-read-chk",					disabled : true				})];		writerChecks = [new Ext.form.Checkbox({					checked : true,					boxLabel : 'Users',					id : 'user' + "-write-chk",					disabled : true				})];		for (var i = 0, len = availableGroups.length; i < len; i++) {			var groupName = availableGroups[i];			readerChecks.push(new Ext.form.Checkbox({						checked : readers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-read-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));			writerChecks.push(new Ext.form.Checkbox({						checked : writers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-write-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));		}		/*		 * show panel...		 */		var sp = new Ext.Window({					title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true),					height : 300,					width : 500,					minimizable : false,					maximizable : false,					modal : true,					bodyStyle : 'padding:5px 5px 0',					stateful : false,					initComponent : function() {						Ext.Window.superclass.initComponent.call(this);						/*						 * Add checkboxes as needed...						 */						if (readerChecks.size() != 0) {							Ext.apply(Ext.getCmp('reader-checks'), {										items : readerChecks									});						}						if (writerChecks.size() != 0) {							Ext.apply(Ext.getCmp('writer-checks'), {										items : writerChecks									});						}						this.doLayout();					},					items : [{								xtype : 'form',								layout : 'column',								autoHeight : true,								autoWidth : true,								defaults : {									layout : 'form',									border : false,									bodyStyle : 'padding:4px'								},								items : [{											xtype : 'fieldset',											autoHeight : true,											autoWidth : true,											items : [{														xtype : 'checkbox',														boxLabel : "Public",														id : 'public-checkbox',														checked : isPublic,														disabled : !canManage													}, {														xtype : 'checkboxgroup',														width : 300,														itemCls : 'x-check-group-alt',														fieldLabel : "Readers",														id : 'reader-checks',														disabled : !canManage,														columns : 1													}, {														xtype : 'checkboxgroup',														width : 300,														itemCls : 'x-check-group-alt',														fieldLabel : 'Writers',														id : 'writer-checks',														disabled : !canManage,														columns : 1													}]										}]							}],					buttons : [{						text : "Save changes",						disabled : !canManage,						handler : function(b, e) {							var loadMask = new Ext.LoadMask(sp.getEl(), {										msg : "Saving changes..."									});							loadMask.show();							securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue();							var updatedGroupsThatCanRead = [];							var updatedGroupsThatCanWrite = [];							var shared = false;							for (var i = 0, len = availableGroups.length; i < len; i++) {								var groupName = availableGroups[i];								if (groupName === Gemma.SecurityManager.adminGroupName) {									continue;								}								if (Ext.getCmp(groupName + "-write-chk").getValue()) {									updatedGroupsThatCanWrite.push(groupName);									shared = true;								}								if (Ext.getCmp(groupName + "-read-chk").getValue()										|| Ext.getCmp(groupName + "-write-chk").getValue()) {									updatedGroupsThatCanRead.push(groupName);									shared = true;								}							}							securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite;							securityInfo.groupsThatCanRead = updatedGroupsThatCanRead;							SecurityController.updatePermission(securityInfo, {										callback : function() {											sp.destroy();											Gemma.SecurityManager.updateSecurityLink(elid,													securityInfo.publiclyReadable, shared);										},										errorHandler : function() {											sp.destroy();											alert("There was an error saving the settings.");											Gemma.SecurityManager.updateSecurityLink(elid,													securityInfo.publiclyReadable, sared);										}									});						}					}, {						text : 'Cancel',						handler : function(b, e) {							sp.destroy();						}					}]				});		sp.show();		// remove the load mask from the table.		Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared);	};	/*	 * Initialization.	 */	SecurityController.getSecurityInfo({				classDelegatingFor : clazz,				id : id			}, {				callback : function(securityInfo) {					showSecurityForm(securityInfo);				},				errorHandler : function(data) {					alert("There was an error getting your group information: " + data);				}			});}; | 
| 
	Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, sared); | 
	Gemma.SecurityManager.updateSecurityLink(elid, updatedInfo.entityClass, updatedInfo.entityId, updatedInfo.publiclyReadable, updatedInfo.shared, updatedInfo.currentUserCanwrite); | 
	Gemma.SecurityManager.managePermissions = function(elid, clazz, id) {	/*	 * Show a panel to 1) make the data set private or public 2) share the data with groups the user is in an which 3)	 * shows the current permissions. There can be any number of groups. On returning, update the div.	 */	Ext.DomHelper.overwrite(elid, {				tag : 'img',				src : "/Gemma/images/loading.gif"			});	/*	 * Need to get: public status from server; group sharing; available groups.	 */	var showSecurityForm = function(securityInfo) {		var isPublic = securityInfo.publiclyReadable;		var isShared = securityInfo.shared;		var readers = securityInfo.groupsThatCanRead;		var writers = securityInfo.groupsThatCanWrite;		var availableGroups = securityInfo.availableGroups;		var canManage = securityInfo.currentUserCanwrite;		// FIXME:		// Server returns null if the currently logged user belongs to no		// custom groups which is bad (for following reasons) and technikally		// incorrect.		// All users belong to the user group anyway but can't edit it.		// Adding an array=null to a Component bombs. Adding a null check		// doesn't		// help because the panel has a 'field set' already declared, which at		// runtime has to have at least one checkbox in it.		// A way out of this is to apply the combo boxes and the field set at		// the same time if they are necessary.		// My kungfu no enough strong ;p		readerChecks = [new Ext.form.Checkbox({					checked : true,					boxLabel : 'Users',					id : 'user' + "-read-chk",					disabled : true				})];		writerChecks = [new Ext.form.Checkbox({					checked : true,					boxLabel : 'Users',					id : 'user' + "-write-chk",					disabled : true				})];		for (var i = 0, len = availableGroups.length; i < len; i++) {			var groupName = availableGroups[i];			readerChecks.push(new Ext.form.Checkbox({						checked : readers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-read-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));			writerChecks.push(new Ext.form.Checkbox({						checked : writers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-write-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));		}		/*		 * show panel...		 */		var sp = new Ext.Window({					title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true),					height : 300,					width : 500,					minimizable : false,					maximizable : false,					modal : true,					bodyStyle : 'padding:5px 5px 0',					stateful : false,					initComponent : function() {						Ext.Window.superclass.initComponent.call(this);						/*						 * Add checkboxes as needed...						 */						if (readerChecks.size() != 0) {							Ext.apply(Ext.getCmp('reader-checks'), {										items : readerChecks									});						}						if (writerChecks.size() != 0) {							Ext.apply(Ext.getCmp('writer-checks'), {										items : writerChecks									});						}						this.doLayout();					},					items : [{								xtype : 'form',								layout : 'column',								autoHeight : true,								autoWidth : true,								defaults : {									layout : 'form',									border : false,									bodyStyle : 'padding:4px'								},								items : [{											xtype : 'fieldset',											autoHeight : true,											autoWidth : true,											items : [{														xtype : 'checkbox',														boxLabel : "Public",														id : 'public-checkbox',														checked : isPublic,														disabled : !canManage													}, {														xtype : 'checkboxgroup',														width : 300,														itemCls : 'x-check-group-alt',														fieldLabel : "Readers",														id : 'reader-checks',														disabled : !canManage,														columns : 1													}, {														xtype : 'checkboxgroup',														width : 300,														itemCls : 'x-check-group-alt',														fieldLabel : 'Writers',														id : 'writer-checks',														disabled : !canManage,														columns : 1													}]										}]							}],					buttons : [{						text : "Save changes",						disabled : !canManage,						handler : function(b, e) {							var loadMask = new Ext.LoadMask(sp.getEl(), {										msg : "Saving changes..."									});							loadMask.show();							securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue();							var updatedGroupsThatCanRead = [];							var updatedGroupsThatCanWrite = [];							var shared = false;							for (var i = 0, len = availableGroups.length; i < len; i++) {								var groupName = availableGroups[i];								if (groupName === Gemma.SecurityManager.adminGroupName) {									continue;								}								if (Ext.getCmp(groupName + "-write-chk").getValue()) {									updatedGroupsThatCanWrite.push(groupName);									shared = true;								}								if (Ext.getCmp(groupName + "-read-chk").getValue()										|| Ext.getCmp(groupName + "-write-chk").getValue()) {									updatedGroupsThatCanRead.push(groupName);									shared = true;								}							}							securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite;							securityInfo.groupsThatCanRead = updatedGroupsThatCanRead;							SecurityController.updatePermission(securityInfo, {										callback : function() {											sp.destroy();											Gemma.SecurityManager.updateSecurityLink(elid,													securityInfo.publiclyReadable, shared);										},										errorHandler : function() {											sp.destroy();											alert("There was an error saving the settings.");											Gemma.SecurityManager.updateSecurityLink(elid,													securityInfo.publiclyReadable, sared);										}									});						}					}, {						text : 'Cancel',						handler : function(b, e) {							sp.destroy();						}					}]				});		sp.show();		// remove the load mask from the table.		Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared);	};	/*	 * Initialization.	 */	SecurityController.getSecurityInfo({				classDelegatingFor : clazz,				id : id			}, {				callback : function(securityInfo) {					showSecurityForm(securityInfo);				},				errorHandler : function(data) {					alert("There was an error getting your group information: " + data);				}			});}; | 
| 
	Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); | 
	Gemma.SecurityManager.updateSecurityLink(elid, clazz, id, isPublic, isShared, canEdit); | 
	Gemma.SecurityManager.managePermissions = function(elid, clazz, id) {	/*	 * Show a panel to 1) make the data set private or public 2) share the data with groups the user is in an which 3)	 * shows the current permissions. There can be any number of groups. On returning, update the div.	 */	Ext.DomHelper.overwrite(elid, {				tag : 'img',				src : "/Gemma/images/loading.gif"			});	/*	 * Need to get: public status from server; group sharing; available groups.	 */	var showSecurityForm = function(securityInfo) {		var isPublic = securityInfo.publiclyReadable;		var isShared = securityInfo.shared;		var readers = securityInfo.groupsThatCanRead;		var writers = securityInfo.groupsThatCanWrite;		var availableGroups = securityInfo.availableGroups;		var canManage = securityInfo.currentUserCanwrite;		// FIXME:		// Server returns null if the currently logged user belongs to no		// custom groups which is bad (for following reasons) and technikally		// incorrect.		// All users belong to the user group anyway but can't edit it.		// Adding an array=null to a Component bombs. Adding a null check		// doesn't		// help because the panel has a 'field set' already declared, which at		// runtime has to have at least one checkbox in it.		// A way out of this is to apply the combo boxes and the field set at		// the same time if they are necessary.		// My kungfu no enough strong ;p		readerChecks = [new Ext.form.Checkbox({					checked : true,					boxLabel : 'Users',					id : 'user' + "-read-chk",					disabled : true				})];		writerChecks = [new Ext.form.Checkbox({					checked : true,					boxLabel : 'Users',					id : 'user' + "-write-chk",					disabled : true				})];		for (var i = 0, len = availableGroups.length; i < len; i++) {			var groupName = availableGroups[i];			readerChecks.push(new Ext.form.Checkbox({						checked : readers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-read-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));			writerChecks.push(new Ext.form.Checkbox({						checked : writers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-write-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));		}		/*		 * show panel...		 */		var sp = new Ext.Window({					title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true),					height : 300,					width : 500,					minimizable : false,					maximizable : false,					modal : true,					bodyStyle : 'padding:5px 5px 0',					stateful : false,					initComponent : function() {						Ext.Window.superclass.initComponent.call(this);						/*						 * Add checkboxes as needed...						 */						if (readerChecks.size() != 0) {							Ext.apply(Ext.getCmp('reader-checks'), {										items : readerChecks									});						}						if (writerChecks.size() != 0) {							Ext.apply(Ext.getCmp('writer-checks'), {										items : writerChecks									});						}						this.doLayout();					},					items : [{								xtype : 'form',								layout : 'column',								autoHeight : true,								autoWidth : true,								defaults : {									layout : 'form',									border : false,									bodyStyle : 'padding:4px'								},								items : [{											xtype : 'fieldset',											autoHeight : true,											autoWidth : true,											items : [{														xtype : 'checkbox',														boxLabel : "Public",														id : 'public-checkbox',														checked : isPublic,														disabled : !canManage													}, {														xtype : 'checkboxgroup',														width : 300,														itemCls : 'x-check-group-alt',														fieldLabel : "Readers",														id : 'reader-checks',														disabled : !canManage,														columns : 1													}, {														xtype : 'checkboxgroup',														width : 300,														itemCls : 'x-check-group-alt',														fieldLabel : 'Writers',														id : 'writer-checks',														disabled : !canManage,														columns : 1													}]										}]							}],					buttons : [{						text : "Save changes",						disabled : !canManage,						handler : function(b, e) {							var loadMask = new Ext.LoadMask(sp.getEl(), {										msg : "Saving changes..."									});							loadMask.show();							securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue();							var updatedGroupsThatCanRead = [];							var updatedGroupsThatCanWrite = [];							var shared = false;							for (var i = 0, len = availableGroups.length; i < len; i++) {								var groupName = availableGroups[i];								if (groupName === Gemma.SecurityManager.adminGroupName) {									continue;								}								if (Ext.getCmp(groupName + "-write-chk").getValue()) {									updatedGroupsThatCanWrite.push(groupName);									shared = true;								}								if (Ext.getCmp(groupName + "-read-chk").getValue()										|| Ext.getCmp(groupName + "-write-chk").getValue()) {									updatedGroupsThatCanRead.push(groupName);									shared = true;								}							}							securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite;							securityInfo.groupsThatCanRead = updatedGroupsThatCanRead;							SecurityController.updatePermission(securityInfo, {										callback : function() {											sp.destroy();											Gemma.SecurityManager.updateSecurityLink(elid,													securityInfo.publiclyReadable, shared);										},										errorHandler : function() {											sp.destroy();											alert("There was an error saving the settings.");											Gemma.SecurityManager.updateSecurityLink(elid,													securityInfo.publiclyReadable, sared);										}									});						}					}, {						text : 'Cancel',						handler : function(b, e) {							sp.destroy();						}					}]				});		sp.show();		// remove the load mask from the table.		Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared);	};	/*	 * Initialization.	 */	SecurityController.getSecurityInfo({				classDelegatingFor : clazz,				id : id			}, {				callback : function(securityInfo) {					showSecurityForm(securityInfo);				},				errorHandler : function(data) {					alert("There was an error getting your group information: " + data);				}			});}; | 
| 
	SecurityController.updatePermissions(securityInfo, { | 
	SecurityController.updatePermission(securityInfo, { | 
	Gemma.SecurityManager.managePermissions = function(elid, clazz, id) {	/*	 * Show a panel to 1) make the data set private or public 2) share the data with groups the user is in an which 3)	 * shows the current permissions. There can be any number of groups. On returning, update the div.	 */	Ext.DomHelper.overwrite(elid, {				tag : 'img',				src : "/Gemma/images/loading.gif"			});	/*	 * Need to get: public status from server; group sharing; available groups.	 */	var showSecurityForm = function(securityInfo) {		var isPublic = securityInfo.publiclyReadable;		var isShared = securityInfo.shared;		var readers = securityInfo.groupsThatCanRead;		var writers = securityInfo.groupsThatCanWrite;		var availableGroups = securityInfo.availableGroups;		readerChecks = [];		writerChecks = [];		for (var i = 0, len = availableGroups.length; i < len; i++) {			var groupName = availableGroups[i];			readerChecks.push(new Ext.form.Checkbox({						checked : readers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-read-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));			writerChecks.push(new Ext.form.Checkbox({						checked : writers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-write-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));		}		/*		 * show panel...		 */		var sp = new Ext.Window({					title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true),					height : 300,					width : 500,					minimizable : false,					maximizable : false,					modal : true,					bodyStyle : 'padding:5px 5px 0',					stateful : false,					initComponent : function() {						Ext.Window.superclass.initComponent.call(this);						/*						 * Add checkboxes as needed...						 */						Ext.apply(Ext.getCmp('reader-checks'), {									items : readerChecks								});						Ext.apply(Ext.getCmp('writer-checks'), {									items : writerChecks								});						this.doLayout();					},					items : [{								xtype : 'form',								layout : 'column',								autoHeight : true,								autoWidth : true,								defaults : {									layout : 'form',									border : false,									bodyStyle : 'padding:4px'								},								items : [{											xtype : 'fieldset',											autoHeight : true,											autoWidth : true,											items : [{														xtype : 'checkbox',														boxLabel : "Public",														id : 'public-checkbox',														checked : isPublic													}, {														xtype : 'checkboxgroup',														width : 300,														itemCls : 'x-check-group-alt',														fieldLabel : "Readers",														id : 'reader-checks',														columns : 1													}, {														xtype : 'checkboxgroup',														width : 300,														itemCls : 'x-check-group-alt',														fieldLabel : 'Writers',														id : 'writer-checks',														columns : 1													}]										}]							}],					buttons : [{						text : "Save changes",						handler : function(b, e) {							var loadMask = new Ext.LoadMask(sp.getEl(), {										msg : "Saving changes..."									});							loadMask.show();							securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue();							var updatedGroupsThatCanRead = [];							var updatedGroupsThatCanWrite = [];							var shared = false;							for (var i = 0, len = availableGroups.length; i < len; i++) {								var groupName = availableGroups[i];								if (groupName === Gemma.SecurityManager.adminGroupName) {									continue;								}								if (Ext.getCmp(groupName + "-write-chk").getValue()) {									updatedGroupsThatCanWrite.push(groupName);									shared = true;								}								if (Ext.getCmp(groupName + "-read-chk").getValue()										|| Ext.getCmp(groupName + "-write-chk").getValue()) {									updatedGroupsThatCanRead.push(groupName);									shared = true;								}							}							securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite;							securityInfo.groupsThatCanRead = updatedGroupsThatCanRead;							SecurityController.updatePermissions(securityInfo, {										callback : function() {											sp.destroy();											Gemma.SecurityManager.updateSecurityLink(elid,													securityInfo.publiclyReadable, shared);										},										errorHandler : function() {											sp.destroy();											alert("There was an error saving the settings.");											Gemma.SecurityManager.updateSecurityLink(elid,													securityInfo.publiclyReadable, sared);										}									});						}					}, {						text : 'Cancel',						handler : function(b, e) {							sp.destroy();						}					}]				});		sp.show();		// remove the load mask from the table.		Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared);	};	/*	 * Initialization.	 */	SecurityController.getSecurityInfo({				classDelegatingFor : clazz,				id : id			}, {				callback : function(securityInfo) {					showSecurityForm(securityInfo);				},				errorHandler : function(data) {					alert("There was an error getting your group information: " + data);				}			});}; | 
| 
	* Show a panel to 1) make the data set private or public 2) share the data with groups the user is in an which 3) * shows the current permissions. There can be any number of groups. On returning, update the div. | 
	* Show a panel to 1) make the data set private or public 2) share the data * with groups the user is in an which 3) shows the current permissions. * There can be any number of groups. On returning, update the div. | 
	Gemma.SecurityManager.managePermissions = function(elid, clazz, id) {	/*	 * Show a panel to 1) make the data set private or public 2) share the data with groups the user is in an which 3)	 * shows the current permissions. There can be any number of groups. On returning, update the div.	 */	Ext.DomHelper.overwrite(elid, {				tag : 'img',				src : "/Gemma/images/loading.gif"			});	/*	 * Need to get: public status from server; group sharing; available groups.	 */	var showSecurityForm = function(securityInfo) {		var isPublic = securityInfo.publiclyReadable;		var isShared = securityInfo.shared;		var readers = securityInfo.groupsThatCanRead;		var writers = securityInfo.groupsThatCanWrite;		var availableGroups = securityInfo.availableGroups;		readerChecks = [];		writerChecks = [];		for (var i = 0, len = availableGroups.length; i < len; i++) {			var groupName = availableGroups[i];			readerChecks.push(new Ext.form.Checkbox({						checked : readers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-read-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));			writerChecks.push(new Ext.form.Checkbox({						checked : writers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-write-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));		}		/*		 * show panel...		 */		var sp = new Ext.Window({					title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true),					height : 300,					width : 500,					minimizable : false,					maximizable : false,					modal : true,					bodyStyle : 'padding:5px 5px 0',					stateful : false,					initComponent : function() {						Ext.Window.superclass.initComponent.call(this);						/*						 * Add checkboxes as needed...						 */						Ext.apply(Ext.getCmp('reader-checks'), {									items : readerChecks								});						Ext.apply(Ext.getCmp('writer-checks'), {									items : writerChecks								});						this.doLayout();					},					items : [{								xtype : 'form',								layout : 'column',								autoHeight : true,								autoWidth : true,								defaults : {									layout : 'form',									border : false,									bodyStyle : 'padding:4px'								},								items : [{											xtype : 'fieldset',											autoHeight : true,											autoWidth : true,											items : [{														xtype : 'checkbox',														boxLabel : "Public",														id : 'public-checkbox',														checked : isPublic													}, {														xtype : 'checkboxgroup',														width : 300,														itemCls : 'x-check-group-alt',														fieldLabel : "Readers",														id : 'reader-checks',														columns : 1													}, {														xtype : 'checkboxgroup',														width : 300,														itemCls : 'x-check-group-alt',														fieldLabel : 'Writers',														id : 'writer-checks',														columns : 1													}]										}]							}],					buttons : [{						text : "Save changes",						handler : function(b, e) {							var loadMask = new Ext.LoadMask(sp.getEl(), {										msg : "Saving changes..."									});							loadMask.show();							securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue();							var updatedGroupsThatCanRead = [];							var updatedGroupsThatCanWrite = [];							var shared = false;							for (var i = 0, len = availableGroups.length; i < len; i++) {								var groupName = availableGroups[i];								if (groupName === Gemma.SecurityManager.adminGroupName) {									continue;								}								if (Ext.getCmp(groupName + "-write-chk").getValue()) {									updatedGroupsThatCanWrite.push(groupName);									shared = true;								}								if (Ext.getCmp(groupName + "-read-chk").getValue()										|| Ext.getCmp(groupName + "-write-chk").getValue()) {									updatedGroupsThatCanRead.push(groupName);									shared = true;								}							}							securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite;							securityInfo.groupsThatCanRead = updatedGroupsThatCanRead;							SecurityController.updatePermission(securityInfo, {										callback : function() {											sp.destroy();											Gemma.SecurityManager.updateSecurityLink(elid,													securityInfo.publiclyReadable, shared);										},										errorHandler : function() {											sp.destroy();											alert("There was an error saving the settings.");											Gemma.SecurityManager.updateSecurityLink(elid,													securityInfo.publiclyReadable, sared);										}									});						}					}, {						text : 'Cancel',						handler : function(b, e) {							sp.destroy();						}					}]				});		sp.show();		// remove the load mask from the table.		Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared);	};	/*	 * Initialization.	 */	SecurityController.getSecurityInfo({				classDelegatingFor : clazz,				id : id			}, {				callback : function(securityInfo) {					showSecurityForm(securityInfo);				},				errorHandler : function(data) {					alert("There was an error getting your group information: " + data);				}			});}; | 
| 
	title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false,  initComponent : function() { Ext.Window.superclass.initComponent.call(this);   Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks });  this.doLayout();  },  items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' | 
	title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false,  initComponent : function() { Ext.Window.superclass.initComponent.call(this);    if (readerChecks.size() != 0) { Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); } if (writerChecks.size() != 0) { Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); } this.doLayout();  },  items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) {  var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show();  securityInfo.publiclyReadable = Ext .getCmp('public-checkbox').getValue();  var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = [];  var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk") .getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } }  securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead;  SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy();  Gemma.SecurityManager.updateSecurityLink( elid, securityInfo.publiclyReadable, shared); | 
	Gemma.SecurityManager.managePermissions = function(elid, clazz, id) {	/*	 * Show a panel to 1) make the data set private or public 2) share the data with groups the user is in an which 3)	 * shows the current permissions. There can be any number of groups. On returning, update the div.	 */	Ext.DomHelper.overwrite(elid, {				tag : 'img',				src : "/Gemma/images/loading.gif"			});	/*	 * Need to get: public status from server; group sharing; available groups.	 */	var showSecurityForm = function(securityInfo) {		var isPublic = securityInfo.publiclyReadable;		var isShared = securityInfo.shared;		var readers = securityInfo.groupsThatCanRead;		var writers = securityInfo.groupsThatCanWrite;		var availableGroups = securityInfo.availableGroups;		readerChecks = [];		writerChecks = [];		for (var i = 0, len = availableGroups.length; i < len; i++) {			var groupName = availableGroups[i];			readerChecks.push(new Ext.form.Checkbox({						checked : readers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-read-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));			writerChecks.push(new Ext.form.Checkbox({						checked : writers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-write-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));		}		/*		 * show panel...		 */		var sp = new Ext.Window({					title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true),					height : 300,					width : 500,					minimizable : false,					maximizable : false,					modal : true,					bodyStyle : 'padding:5px 5px 0',					stateful : false,					initComponent : function() {						Ext.Window.superclass.initComponent.call(this);						/*						 * Add checkboxes as needed...						 */						Ext.apply(Ext.getCmp('reader-checks'), {									items : readerChecks								});						Ext.apply(Ext.getCmp('writer-checks'), {									items : writerChecks								});						this.doLayout();					},					items : [{								xtype : 'form',								layout : 'column',								autoHeight : true,								autoWidth : true,								defaults : {									layout : 'form',									border : false,									bodyStyle : 'padding:4px'								},								items : [{											xtype : 'fieldset',											autoHeight : true,											autoWidth : true,											items : [{														xtype : 'checkbox',														boxLabel : "Public",														id : 'public-checkbox',														checked : isPublic													}, {														xtype : 'checkboxgroup',														width : 300,														itemCls : 'x-check-group-alt',														fieldLabel : "Readers",														id : 'reader-checks',														columns : 1													}, {														xtype : 'checkboxgroup',														width : 300,														itemCls : 'x-check-group-alt',														fieldLabel : 'Writers',														id : 'writer-checks',														columns : 1													}]										}]							}],					buttons : [{						text : "Save changes",						handler : function(b, e) {							var loadMask = new Ext.LoadMask(sp.getEl(), {										msg : "Saving changes..."									});							loadMask.show();							securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue();							var updatedGroupsThatCanRead = [];							var updatedGroupsThatCanWrite = [];							var shared = false;							for (var i = 0, len = availableGroups.length; i < len; i++) {								var groupName = availableGroups[i];								if (groupName === Gemma.SecurityManager.adminGroupName) {									continue;								}								if (Ext.getCmp(groupName + "-write-chk").getValue()) {									updatedGroupsThatCanWrite.push(groupName);									shared = true;								}								if (Ext.getCmp(groupName + "-read-chk").getValue()										|| Ext.getCmp(groupName + "-write-chk").getValue()) {									updatedGroupsThatCanRead.push(groupName);									shared = true;								}							}							securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite;							securityInfo.groupsThatCanRead = updatedGroupsThatCanRead;							SecurityController.updatePermission(securityInfo, {										callback : function() {											sp.destroy();											Gemma.SecurityManager.updateSecurityLink(elid,													securityInfo.publiclyReadable, shared);										},										errorHandler : function() {											sp.destroy();											alert("There was an error saving the settings.");											Gemma.SecurityManager.updateSecurityLink(elid,													securityInfo.publiclyReadable, sared);										}									});						}					}, {						text : 'Cancel',						handler : function(b, e) {							sp.destroy();						}					}]				});		sp.show();		// remove the load mask from the table.		Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared);	};	/*	 * Initialization.	 */	SecurityController.getSecurityInfo({				classDelegatingFor : clazz,				id : id			}, {				callback : function(securityInfo) {					showSecurityForm(securityInfo);				},				errorHandler : function(data) {					alert("There was an error getting your group information: " + data);				}			});}; | 
| 
	items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) {  var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show();  securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue();  var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = [];  var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; | 
	errorHandler : function() { sp.destroy(); alert("There was an error saving the settings.");  Gemma.SecurityManager.updateSecurityLink( elid, securityInfo.publiclyReadable, sared); | 
	Gemma.SecurityManager.managePermissions = function(elid, clazz, id) {	/*	 * Show a panel to 1) make the data set private or public 2) share the data with groups the user is in an which 3)	 * shows the current permissions. There can be any number of groups. On returning, update the div.	 */	Ext.DomHelper.overwrite(elid, {				tag : 'img',				src : "/Gemma/images/loading.gif"			});	/*	 * Need to get: public status from server; group sharing; available groups.	 */	var showSecurityForm = function(securityInfo) {		var isPublic = securityInfo.publiclyReadable;		var isShared = securityInfo.shared;		var readers = securityInfo.groupsThatCanRead;		var writers = securityInfo.groupsThatCanWrite;		var availableGroups = securityInfo.availableGroups;		readerChecks = [];		writerChecks = [];		for (var i = 0, len = availableGroups.length; i < len; i++) {			var groupName = availableGroups[i];			readerChecks.push(new Ext.form.Checkbox({						checked : readers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-read-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));			writerChecks.push(new Ext.form.Checkbox({						checked : writers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-write-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));		}		/*		 * show panel...		 */		var sp = new Ext.Window({					title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true),					height : 300,					width : 500,					minimizable : false,					maximizable : false,					modal : true,					bodyStyle : 'padding:5px 5px 0',					stateful : false,					initComponent : function() {						Ext.Window.superclass.initComponent.call(this);						/*						 * Add checkboxes as needed...						 */						Ext.apply(Ext.getCmp('reader-checks'), {									items : readerChecks								});						Ext.apply(Ext.getCmp('writer-checks'), {									items : writerChecks								});						this.doLayout();					},					items : [{								xtype : 'form',								layout : 'column',								autoHeight : true,								autoWidth : true,								defaults : {									layout : 'form',									border : false,									bodyStyle : 'padding:4px'								},								items : [{											xtype : 'fieldset',											autoHeight : true,											autoWidth : true,											items : [{														xtype : 'checkbox',														boxLabel : "Public",														id : 'public-checkbox',														checked : isPublic													}, {														xtype : 'checkboxgroup',														width : 300,														itemCls : 'x-check-group-alt',														fieldLabel : "Readers",														id : 'reader-checks',														columns : 1													}, {														xtype : 'checkboxgroup',														width : 300,														itemCls : 'x-check-group-alt',														fieldLabel : 'Writers',														id : 'writer-checks',														columns : 1													}]										}]							}],					buttons : [{						text : "Save changes",						handler : function(b, e) {							var loadMask = new Ext.LoadMask(sp.getEl(), {										msg : "Saving changes..."									});							loadMask.show();							securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue();							var updatedGroupsThatCanRead = [];							var updatedGroupsThatCanWrite = [];							var shared = false;							for (var i = 0, len = availableGroups.length; i < len; i++) {								var groupName = availableGroups[i];								if (groupName === Gemma.SecurityManager.adminGroupName) {									continue;								}								if (Ext.getCmp(groupName + "-write-chk").getValue()) {									updatedGroupsThatCanWrite.push(groupName);									shared = true;								}								if (Ext.getCmp(groupName + "-read-chk").getValue()										|| Ext.getCmp(groupName + "-write-chk").getValue()) {									updatedGroupsThatCanRead.push(groupName);									shared = true;								}							}							securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite;							securityInfo.groupsThatCanRead = updatedGroupsThatCanRead;							SecurityController.updatePermission(securityInfo, {										callback : function() {											sp.destroy();											Gemma.SecurityManager.updateSecurityLink(elid,													securityInfo.publiclyReadable, shared);										},										errorHandler : function() {											sp.destroy();											alert("There was an error saving the settings.");											Gemma.SecurityManager.updateSecurityLink(elid,													securityInfo.publiclyReadable, sared);										}									});						}					}, {						text : 'Cancel',						handler : function(b, e) {							sp.destroy();						}					}]				});		sp.show();		// remove the load mask from the table.		Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared);	};	/*	 * Initialization.	 */	SecurityController.getSecurityInfo({				classDelegatingFor : clazz,				id : id			}, {				callback : function(securityInfo) {					showSecurityForm(securityInfo);				},				errorHandler : function(data) {					alert("There was an error getting your group information: " + data);				}			});}; | 
| 
	if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } }  securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead;  SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy();  Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings.");  Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, sared);  } });  } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); | 
	});  } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); | 
	Gemma.SecurityManager.managePermissions = function(elid, clazz, id) {	/*	 * Show a panel to 1) make the data set private or public 2) share the data with groups the user is in an which 3)	 * shows the current permissions. There can be any number of groups. On returning, update the div.	 */	Ext.DomHelper.overwrite(elid, {				tag : 'img',				src : "/Gemma/images/loading.gif"			});	/*	 * Need to get: public status from server; group sharing; available groups.	 */	var showSecurityForm = function(securityInfo) {		var isPublic = securityInfo.publiclyReadable;		var isShared = securityInfo.shared;		var readers = securityInfo.groupsThatCanRead;		var writers = securityInfo.groupsThatCanWrite;		var availableGroups = securityInfo.availableGroups;		readerChecks = [];		writerChecks = [];		for (var i = 0, len = availableGroups.length; i < len; i++) {			var groupName = availableGroups[i];			readerChecks.push(new Ext.form.Checkbox({						checked : readers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-read-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));			writerChecks.push(new Ext.form.Checkbox({						checked : writers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-write-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));		}		/*		 * show panel...		 */		var sp = new Ext.Window({					title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true),					height : 300,					width : 500,					minimizable : false,					maximizable : false,					modal : true,					bodyStyle : 'padding:5px 5px 0',					stateful : false,					initComponent : function() {						Ext.Window.superclass.initComponent.call(this);						/*						 * Add checkboxes as needed...						 */						Ext.apply(Ext.getCmp('reader-checks'), {									items : readerChecks								});						Ext.apply(Ext.getCmp('writer-checks'), {									items : writerChecks								});						this.doLayout();					},					items : [{								xtype : 'form',								layout : 'column',								autoHeight : true,								autoWidth : true,								defaults : {									layout : 'form',									border : false,									bodyStyle : 'padding:4px'								},								items : [{											xtype : 'fieldset',											autoHeight : true,											autoWidth : true,											items : [{														xtype : 'checkbox',														boxLabel : "Public",														id : 'public-checkbox',														checked : isPublic													}, {														xtype : 'checkboxgroup',														width : 300,														itemCls : 'x-check-group-alt',														fieldLabel : "Readers",														id : 'reader-checks',														columns : 1													}, {														xtype : 'checkboxgroup',														width : 300,														itemCls : 'x-check-group-alt',														fieldLabel : 'Writers',														id : 'writer-checks',														columns : 1													}]										}]							}],					buttons : [{						text : "Save changes",						handler : function(b, e) {							var loadMask = new Ext.LoadMask(sp.getEl(), {										msg : "Saving changes..."									});							loadMask.show();							securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue();							var updatedGroupsThatCanRead = [];							var updatedGroupsThatCanWrite = [];							var shared = false;							for (var i = 0, len = availableGroups.length; i < len; i++) {								var groupName = availableGroups[i];								if (groupName === Gemma.SecurityManager.adminGroupName) {									continue;								}								if (Ext.getCmp(groupName + "-write-chk").getValue()) {									updatedGroupsThatCanWrite.push(groupName);									shared = true;								}								if (Ext.getCmp(groupName + "-read-chk").getValue()										|| Ext.getCmp(groupName + "-write-chk").getValue()) {									updatedGroupsThatCanRead.push(groupName);									shared = true;								}							}							securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite;							securityInfo.groupsThatCanRead = updatedGroupsThatCanRead;							SecurityController.updatePermission(securityInfo, {										callback : function() {											sp.destroy();											Gemma.SecurityManager.updateSecurityLink(elid,													securityInfo.publiclyReadable, shared);										},										errorHandler : function() {											sp.destroy();											alert("There was an error saving the settings.");											Gemma.SecurityManager.updateSecurityLink(elid,													securityInfo.publiclyReadable, sared);										}									});						}					}, {						text : 'Cancel',						handler : function(b, e) {							sp.destroy();						}					}]				});		sp.show();		// remove the load mask from the table.		Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared);	};	/*	 * Initialization.	 */	SecurityController.getSecurityInfo({				classDelegatingFor : clazz,				id : id			}, {				callback : function(securityInfo) {					showSecurityForm(securityInfo);				},				errorHandler : function(data) {					alert("There was an error getting your group information: " + data);				}			});}; | 
| 
	* Show a panel to 1) make the data set private or public 2) share the data * with groups the user is in an which 3) shows the current permissions. * There can be any number of groups. On returning, update the div. | 
	* Show a panel to 1) make the data set private or public 2) share the data with groups the user is in an which 3) * shows the current permissions. There can be any number of groups. On returning, update the div. | 
	Gemma.SecurityManager.managePermissions = function(elid, clazz, id) {	/*	 * Show a panel to 1) make the data set private or public 2) share the data	 * with groups the user is in an which 3) shows the current permissions.	 * There can be any number of groups. On returning, update the div.	 */	Ext.DomHelper.overwrite(elid, {				tag : 'img',				src : "/Gemma/images/loading.gif"			});	/*	 * Need to get: public status from server; group sharing; available groups.	 */	var showSecurityForm = function(securityInfo) {		var isPublic = securityInfo.publiclyReadable;		var isShared = securityInfo.shared;		var readers = securityInfo.groupsThatCanRead;		var writers = securityInfo.groupsThatCanWrite;		var availableGroups = securityInfo.availableGroups;		// FIXME:		// Server returns null if the currently logged user belongs to no		// custom groups which is bad (for following reasons) and technikally		// incorrect.		// All users belong to the user group anyway but can't edit it.		// Adding an array=null to a Component bombs. Adding a null check		// doesn't		// help because the panel has a 'field set' already declared, which at		// runtime has to have at least one checkbox in it.		// A way out of this is to apply the combo boxes and the field set at		// the same time if they are necessary.		// My kungfu no enough strong ;p		readerChecks = [new Ext.form.Checkbox({					checked : true,					boxLabel : 'Users',					id : 'user' + "-read-chk",					disabled : true				})];		writerChecks = [new Ext.form.Checkbox({					checked : true,					boxLabel : 'Users',					id : 'user' + "-write-chk",					disabled : true				})];		for (var i = 0, len = availableGroups.length; i < len; i++) {			var groupName = availableGroups[i];			readerChecks.push(new Ext.form.Checkbox({						checked : readers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-read-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));			writerChecks.push(new Ext.form.Checkbox({						checked : writers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-write-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));		}		/*		 * show panel...		 */		var sp = new Ext.Window({			title : "Security for: "					+ Ext.util.Format.ellipsis(securityInfo.entityName, 70,							true),			height : 300,			width : 500,			minimizable : false,			maximizable : false,			modal : true,			bodyStyle : 'padding:5px 5px 0',			stateful : false,			initComponent : function() {				Ext.Window.superclass.initComponent.call(this);				/*				 * Add checkboxes as needed...				 */				if (readerChecks.size() != 0) {					Ext.apply(Ext.getCmp('reader-checks'), {								items : readerChecks							});				}				if (writerChecks.size() != 0) {					Ext.apply(Ext.getCmp('writer-checks'), {								items : writerChecks							});				}				this.doLayout();			},			items : [{						xtype : 'form',						layout : 'column',						autoHeight : true,						autoWidth : true,						defaults : {							layout : 'form',							border : false,							bodyStyle : 'padding:4px'						},						items : [{									xtype : 'fieldset',									autoHeight : true,									autoWidth : true,									items : [{												xtype : 'checkbox',												boxLabel : "Public",												id : 'public-checkbox',												checked : isPublic											}, {												xtype : 'checkboxgroup',												width : 300,												itemCls : 'x-check-group-alt',												fieldLabel : "Readers",												id : 'reader-checks',												columns : 1											}, {												xtype : 'checkboxgroup',												width : 300,												itemCls : 'x-check-group-alt',												fieldLabel : 'Writers',												id : 'writer-checks',												columns : 1											}]								}]					}],			buttons : [{				text : "Save changes",				handler : function(b, e) {					var loadMask = new Ext.LoadMask(sp.getEl(), {										msg : "Saving changes..."									});							loadMask.show();					securityInfo.publiclyReadable = Ext							.getCmp('public-checkbox').getValue();					var updatedGroupsThatCanRead = [];					var updatedGroupsThatCanWrite = [];					var shared = false;					for (var i = 0, len = availableGroups.length; i < len; i++) {						var groupName = availableGroups[i];						if (groupName === Gemma.SecurityManager.adminGroupName) {							continue;						}						if (Ext.getCmp(groupName + "-write-chk").getValue()) {							updatedGroupsThatCanWrite.push(groupName);							shared = true;						}						if (Ext.getCmp(groupName + "-read-chk").getValue()								|| Ext.getCmp(groupName + "-write-chk")										.getValue()) {							updatedGroupsThatCanRead.push(groupName);							shared = true;						}					}					securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite;					securityInfo.groupsThatCanRead = updatedGroupsThatCanRead;					SecurityController.updatePermission(securityInfo, {								callback : function() {									sp.destroy();									Gemma.SecurityManager.updateSecurityLink(											elid,											securityInfo.publiclyReadable,											shared);								},								errorHandler : function() {									sp.destroy();									alert("There was an error saving the settings.");									Gemma.SecurityManager.updateSecurityLink(											elid,											securityInfo.publiclyReadable,											sared);								}							});				}			}, {				text : 'Cancel',				handler : function(b, e) {					sp.destroy();				}			}]		});		sp.show();		// remove the load mask from the table.		Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared);	};	/*	 * Initialization.	 */	SecurityController.getSecurityInfo({				classDelegatingFor : clazz,				id : id			}, {				callback : function(securityInfo) {					showSecurityForm(securityInfo);				},				errorHandler : function(data) {					alert("There was an error getting your group information: "							+ data);				}			});}; | 
| 
	title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false,  initComponent : function() { Ext.Window.superclass.initComponent.call(this);    if (readerChecks.size() != 0) { Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); } if (writerChecks.size() != 0) { Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); } this.doLayout();  },  items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) {  var loadMask = new Ext.LoadMask(sp.getEl(), { | 
	title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false,  initComponent : function() { Ext.Window.superclass.initComponent.call(this);    if (readerChecks.size() != 0) { Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); } if (writerChecks.size() != 0) { Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); } this.doLayout();  },  items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic, disabled : !canManage }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', disabled : !canManage, columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', disabled : !canManage, columns : 1 }] }] }], buttons : [{ text : "Save changes", disabled : !canManage, handler : function(b, e) {  var loadMask = new Ext.LoadMask(sp.getEl(), { | 
	Gemma.SecurityManager.managePermissions = function(elid, clazz, id) {	/*	 * Show a panel to 1) make the data set private or public 2) share the data	 * with groups the user is in an which 3) shows the current permissions.	 * There can be any number of groups. On returning, update the div.	 */	Ext.DomHelper.overwrite(elid, {				tag : 'img',				src : "/Gemma/images/loading.gif"			});	/*	 * Need to get: public status from server; group sharing; available groups.	 */	var showSecurityForm = function(securityInfo) {		var isPublic = securityInfo.publiclyReadable;		var isShared = securityInfo.shared;		var readers = securityInfo.groupsThatCanRead;		var writers = securityInfo.groupsThatCanWrite;		var availableGroups = securityInfo.availableGroups;		// FIXME:		// Server returns null if the currently logged user belongs to no		// custom groups which is bad (for following reasons) and technikally		// incorrect.		// All users belong to the user group anyway but can't edit it.		// Adding an array=null to a Component bombs. Adding a null check		// doesn't		// help because the panel has a 'field set' already declared, which at		// runtime has to have at least one checkbox in it.		// A way out of this is to apply the combo boxes and the field set at		// the same time if they are necessary.		// My kungfu no enough strong ;p		readerChecks = [new Ext.form.Checkbox({					checked : true,					boxLabel : 'Users',					id : 'user' + "-read-chk",					disabled : true				})];		writerChecks = [new Ext.form.Checkbox({					checked : true,					boxLabel : 'Users',					id : 'user' + "-write-chk",					disabled : true				})];		for (var i = 0, len = availableGroups.length; i < len; i++) {			var groupName = availableGroups[i];			readerChecks.push(new Ext.form.Checkbox({						checked : readers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-read-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));			writerChecks.push(new Ext.form.Checkbox({						checked : writers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-write-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));		}		/*		 * show panel...		 */		var sp = new Ext.Window({			title : "Security for: "					+ Ext.util.Format.ellipsis(securityInfo.entityName, 70,							true),			height : 300,			width : 500,			minimizable : false,			maximizable : false,			modal : true,			bodyStyle : 'padding:5px 5px 0',			stateful : false,			initComponent : function() {				Ext.Window.superclass.initComponent.call(this);				/*				 * Add checkboxes as needed...				 */				if (readerChecks.size() != 0) {					Ext.apply(Ext.getCmp('reader-checks'), {								items : readerChecks							});				}				if (writerChecks.size() != 0) {					Ext.apply(Ext.getCmp('writer-checks'), {								items : writerChecks							});				}				this.doLayout();			},			items : [{						xtype : 'form',						layout : 'column',						autoHeight : true,						autoWidth : true,						defaults : {							layout : 'form',							border : false,							bodyStyle : 'padding:4px'						},						items : [{									xtype : 'fieldset',									autoHeight : true,									autoWidth : true,									items : [{												xtype : 'checkbox',												boxLabel : "Public",												id : 'public-checkbox',												checked : isPublic											}, {												xtype : 'checkboxgroup',												width : 300,												itemCls : 'x-check-group-alt',												fieldLabel : "Readers",												id : 'reader-checks',												columns : 1											}, {												xtype : 'checkboxgroup',												width : 300,												itemCls : 'x-check-group-alt',												fieldLabel : 'Writers',												id : 'writer-checks',												columns : 1											}]								}]					}],			buttons : [{				text : "Save changes",				handler : function(b, e) {					var loadMask = new Ext.LoadMask(sp.getEl(), {										msg : "Saving changes..."									});							loadMask.show();					securityInfo.publiclyReadable = Ext							.getCmp('public-checkbox').getValue();					var updatedGroupsThatCanRead = [];					var updatedGroupsThatCanWrite = [];					var shared = false;					for (var i = 0, len = availableGroups.length; i < len; i++) {						var groupName = availableGroups[i];						if (groupName === Gemma.SecurityManager.adminGroupName) {							continue;						}						if (Ext.getCmp(groupName + "-write-chk").getValue()) {							updatedGroupsThatCanWrite.push(groupName);							shared = true;						}						if (Ext.getCmp(groupName + "-read-chk").getValue()								|| Ext.getCmp(groupName + "-write-chk")										.getValue()) {							updatedGroupsThatCanRead.push(groupName);							shared = true;						}					}					securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite;					securityInfo.groupsThatCanRead = updatedGroupsThatCanRead;					SecurityController.updatePermission(securityInfo, {								callback : function() {									sp.destroy();									Gemma.SecurityManager.updateSecurityLink(											elid,											securityInfo.publiclyReadable,											shared);								},								errorHandler : function() {									sp.destroy();									alert("There was an error saving the settings.");									Gemma.SecurityManager.updateSecurityLink(											elid,											securityInfo.publiclyReadable,											sared);								}							});				}			}, {				text : 'Cancel',				handler : function(b, e) {					sp.destroy();				}			}]		});		sp.show();		// remove the load mask from the table.		Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared);	};	/*	 * Initialization.	 */	SecurityController.getSecurityInfo({				classDelegatingFor : clazz,				id : id			}, {				callback : function(securityInfo) {					showSecurityForm(securityInfo);				},				errorHandler : function(data) {					alert("There was an error getting your group information: "							+ data);				}			});}; | 
| 
	securityInfo.publiclyReadable = Ext .getCmp('public-checkbox').getValue();  var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = [];  var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk") .getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } }  securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead;  SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy();  Gemma.SecurityManager.updateSecurityLink( elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings.");  Gemma.SecurityManager.updateSecurityLink( elid, securityInfo.publiclyReadable, sared); | 
	securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue();  var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = [];  var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; | 
	Gemma.SecurityManager.managePermissions = function(elid, clazz, id) {	/*	 * Show a panel to 1) make the data set private or public 2) share the data	 * with groups the user is in an which 3) shows the current permissions.	 * There can be any number of groups. On returning, update the div.	 */	Ext.DomHelper.overwrite(elid, {				tag : 'img',				src : "/Gemma/images/loading.gif"			});	/*	 * Need to get: public status from server; group sharing; available groups.	 */	var showSecurityForm = function(securityInfo) {		var isPublic = securityInfo.publiclyReadable;		var isShared = securityInfo.shared;		var readers = securityInfo.groupsThatCanRead;		var writers = securityInfo.groupsThatCanWrite;		var availableGroups = securityInfo.availableGroups;		// FIXME:		// Server returns null if the currently logged user belongs to no		// custom groups which is bad (for following reasons) and technikally		// incorrect.		// All users belong to the user group anyway but can't edit it.		// Adding an array=null to a Component bombs. Adding a null check		// doesn't		// help because the panel has a 'field set' already declared, which at		// runtime has to have at least one checkbox in it.		// A way out of this is to apply the combo boxes and the field set at		// the same time if they are necessary.		// My kungfu no enough strong ;p		readerChecks = [new Ext.form.Checkbox({					checked : true,					boxLabel : 'Users',					id : 'user' + "-read-chk",					disabled : true				})];		writerChecks = [new Ext.form.Checkbox({					checked : true,					boxLabel : 'Users',					id : 'user' + "-write-chk",					disabled : true				})];		for (var i = 0, len = availableGroups.length; i < len; i++) {			var groupName = availableGroups[i];			readerChecks.push(new Ext.form.Checkbox({						checked : readers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-read-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));			writerChecks.push(new Ext.form.Checkbox({						checked : writers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-write-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));		}		/*		 * show panel...		 */		var sp = new Ext.Window({			title : "Security for: "					+ Ext.util.Format.ellipsis(securityInfo.entityName, 70,							true),			height : 300,			width : 500,			minimizable : false,			maximizable : false,			modal : true,			bodyStyle : 'padding:5px 5px 0',			stateful : false,			initComponent : function() {				Ext.Window.superclass.initComponent.call(this);				/*				 * Add checkboxes as needed...				 */				if (readerChecks.size() != 0) {					Ext.apply(Ext.getCmp('reader-checks'), {								items : readerChecks							});				}				if (writerChecks.size() != 0) {					Ext.apply(Ext.getCmp('writer-checks'), {								items : writerChecks							});				}				this.doLayout();			},			items : [{						xtype : 'form',						layout : 'column',						autoHeight : true,						autoWidth : true,						defaults : {							layout : 'form',							border : false,							bodyStyle : 'padding:4px'						},						items : [{									xtype : 'fieldset',									autoHeight : true,									autoWidth : true,									items : [{												xtype : 'checkbox',												boxLabel : "Public",												id : 'public-checkbox',												checked : isPublic											}, {												xtype : 'checkboxgroup',												width : 300,												itemCls : 'x-check-group-alt',												fieldLabel : "Readers",												id : 'reader-checks',												columns : 1											}, {												xtype : 'checkboxgroup',												width : 300,												itemCls : 'x-check-group-alt',												fieldLabel : 'Writers',												id : 'writer-checks',												columns : 1											}]								}]					}],			buttons : [{				text : "Save changes",				handler : function(b, e) {					var loadMask = new Ext.LoadMask(sp.getEl(), {										msg : "Saving changes..."									});							loadMask.show();					securityInfo.publiclyReadable = Ext							.getCmp('public-checkbox').getValue();					var updatedGroupsThatCanRead = [];					var updatedGroupsThatCanWrite = [];					var shared = false;					for (var i = 0, len = availableGroups.length; i < len; i++) {						var groupName = availableGroups[i];						if (groupName === Gemma.SecurityManager.adminGroupName) {							continue;						}						if (Ext.getCmp(groupName + "-write-chk").getValue()) {							updatedGroupsThatCanWrite.push(groupName);							shared = true;						}						if (Ext.getCmp(groupName + "-read-chk").getValue()								|| Ext.getCmp(groupName + "-write-chk")										.getValue()) {							updatedGroupsThatCanRead.push(groupName);							shared = true;						}					}					securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite;					securityInfo.groupsThatCanRead = updatedGroupsThatCanRead;					SecurityController.updatePermission(securityInfo, {								callback : function() {									sp.destroy();									Gemma.SecurityManager.updateSecurityLink(											elid,											securityInfo.publiclyReadable,											shared);								},								errorHandler : function() {									sp.destroy();									alert("There was an error saving the settings.");									Gemma.SecurityManager.updateSecurityLink(											elid,											securityInfo.publiclyReadable,											sared);								}							});				}			}, {				text : 'Cancel',				handler : function(b, e) {					sp.destroy();				}			}]		});		sp.show();		// remove the load mask from the table.		Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared);	};	/*	 * Initialization.	 */	SecurityController.getSecurityInfo({				classDelegatingFor : clazz,				id : id			}, {				callback : function(securityInfo) {					showSecurityForm(securityInfo);				},				errorHandler : function(data) {					alert("There was an error getting your group information: "							+ data);				}			});}; | 
| 
	});  } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); | 
	if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } }  securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead;  SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy();  Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings.");  Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, sared);  } });  } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); | 
	Gemma.SecurityManager.managePermissions = function(elid, clazz, id) {	/*	 * Show a panel to 1) make the data set private or public 2) share the data	 * with groups the user is in an which 3) shows the current permissions.	 * There can be any number of groups. On returning, update the div.	 */	Ext.DomHelper.overwrite(elid, {				tag : 'img',				src : "/Gemma/images/loading.gif"			});	/*	 * Need to get: public status from server; group sharing; available groups.	 */	var showSecurityForm = function(securityInfo) {		var isPublic = securityInfo.publiclyReadable;		var isShared = securityInfo.shared;		var readers = securityInfo.groupsThatCanRead;		var writers = securityInfo.groupsThatCanWrite;		var availableGroups = securityInfo.availableGroups;		// FIXME:		// Server returns null if the currently logged user belongs to no		// custom groups which is bad (for following reasons) and technikally		// incorrect.		// All users belong to the user group anyway but can't edit it.		// Adding an array=null to a Component bombs. Adding a null check		// doesn't		// help because the panel has a 'field set' already declared, which at		// runtime has to have at least one checkbox in it.		// A way out of this is to apply the combo boxes and the field set at		// the same time if they are necessary.		// My kungfu no enough strong ;p		readerChecks = [new Ext.form.Checkbox({					checked : true,					boxLabel : 'Users',					id : 'user' + "-read-chk",					disabled : true				})];		writerChecks = [new Ext.form.Checkbox({					checked : true,					boxLabel : 'Users',					id : 'user' + "-write-chk",					disabled : true				})];		for (var i = 0, len = availableGroups.length; i < len; i++) {			var groupName = availableGroups[i];			readerChecks.push(new Ext.form.Checkbox({						checked : readers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-read-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));			writerChecks.push(new Ext.form.Checkbox({						checked : writers.indexOf(groupName) >= 0,						boxLabel : groupName,						id : groupName + "-write-chk",						disabled : groupName === Gemma.SecurityManager.adminGroupName					}));		}		/*		 * show panel...		 */		var sp = new Ext.Window({			title : "Security for: "					+ Ext.util.Format.ellipsis(securityInfo.entityName, 70,							true),			height : 300,			width : 500,			minimizable : false,			maximizable : false,			modal : true,			bodyStyle : 'padding:5px 5px 0',			stateful : false,			initComponent : function() {				Ext.Window.superclass.initComponent.call(this);				/*				 * Add checkboxes as needed...				 */				if (readerChecks.size() != 0) {					Ext.apply(Ext.getCmp('reader-checks'), {								items : readerChecks							});				}				if (writerChecks.size() != 0) {					Ext.apply(Ext.getCmp('writer-checks'), {								items : writerChecks							});				}				this.doLayout();			},			items : [{						xtype : 'form',						layout : 'column',						autoHeight : true,						autoWidth : true,						defaults : {							layout : 'form',							border : false,							bodyStyle : 'padding:4px'						},						items : [{									xtype : 'fieldset',									autoHeight : true,									autoWidth : true,									items : [{												xtype : 'checkbox',												boxLabel : "Public",												id : 'public-checkbox',												checked : isPublic											}, {												xtype : 'checkboxgroup',												width : 300,												itemCls : 'x-check-group-alt',												fieldLabel : "Readers",												id : 'reader-checks',												columns : 1											}, {												xtype : 'checkboxgroup',												width : 300,												itemCls : 'x-check-group-alt',												fieldLabel : 'Writers',												id : 'writer-checks',												columns : 1											}]								}]					}],			buttons : [{				text : "Save changes",				handler : function(b, e) {					var loadMask = new Ext.LoadMask(sp.getEl(), {										msg : "Saving changes..."									});							loadMask.show();					securityInfo.publiclyReadable = Ext							.getCmp('public-checkbox').getValue();					var updatedGroupsThatCanRead = [];					var updatedGroupsThatCanWrite = [];					var shared = false;					for (var i = 0, len = availableGroups.length; i < len; i++) {						var groupName = availableGroups[i];						if (groupName === Gemma.SecurityManager.adminGroupName) {							continue;						}						if (Ext.getCmp(groupName + "-write-chk").getValue()) {							updatedGroupsThatCanWrite.push(groupName);							shared = true;						}						if (Ext.getCmp(groupName + "-read-chk").getValue()								|| Ext.getCmp(groupName + "-write-chk")										.getValue()) {							updatedGroupsThatCanRead.push(groupName);							shared = true;						}					}					securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite;					securityInfo.groupsThatCanRead = updatedGroupsThatCanRead;					SecurityController.updatePermission(securityInfo, {								callback : function() {									sp.destroy();									Gemma.SecurityManager.updateSecurityLink(											elid,											securityInfo.publiclyReadable,											shared);								},								errorHandler : function() {									sp.destroy();									alert("There was an error saving the settings.");									Gemma.SecurityManager.updateSecurityLink(											elid,											securityInfo.publiclyReadable,											sared);								}							});				}			}, {				text : 'Cancel',				handler : function(b, e) {					sp.destroy();				}			}]		});		sp.show();		// remove the load mask from the table.		Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared);	};	/*	 * Initialization.	 */	SecurityController.getSecurityInfo({				classDelegatingFor : clazz,				id : id			}, {				callback : function(securityInfo) {					showSecurityForm(securityInfo);				},				errorHandler : function(data) {					alert("There was an error getting your group information: "							+ data);				}			});}; | 
| 
	log.debug("adding 'spatial_ref_value.type" + "' = 'F' to ingrid document."); spatialRefValueRecord.addColumn(createColumn("spatial_ref_value", "type", "spatial_ref_value.type"), "F") | 
	function mapGeographicElements(document, refNode) {	var geographicElements = XPathUtils.getNodeList(refNode, "//gmd:identificationInfo//gmd:extent/gmd:EX_Extent/gmd:geographicElement");	if (hasValue(geographicElements)) {		var lineCounter = 1;		for (var i=0; i<geographicElements.getLength(); i++ ) {			var value = getXPathValue(geographicElements.item(i), "gmd:EX_GeographicDescription/gmd:geographicIdentifier/gmd:MD_Identifier/gmd:code/gco:CharacterString");			if (hasValue(value)) {				var spatialReferenceRecord = new Record();				log.debug("adding 'spatial_reference.line" + "' = '" + (lineCounter) + "' to ingrid document.");				spatialReferenceRecord.addColumn(createColumn("spatial_reference", "line", "spatial_reference.line"), (lineCounter))				lineCounter++;				document.addSubRecord(spatialReferenceRecord);				var spatialRefValueRecord = new Record();				log.debug("adding 'spatial_ref_value.name_value" + "' = '" + value + "' to ingrid document.");				spatialRefValueRecord.addColumn(createColumn("spatial_ref_value", "name_value", "location"), value)				log.debug("adding 'spatial_ref_value.x1" + "' = '' to ingrid document.");				spatialRefValueRecord.addColumn(createColumn("spatial_ref_value", "x1", "x1"), "")				log.debug("adding 'spatial_ref_value.x2" + "' = '' to ingrid document.");				spatialRefValueRecord.addColumn(createColumn("spatial_ref_value", "x2", "x2"), "")				log.debug("adding 'spatial_ref_value.y1" + "' = '' to ingrid document.");				spatialRefValueRecord.addColumn(createColumn("spatial_ref_value", "y1", "y1"), "")				log.debug("adding 'spatial_ref_value.y2" + "' = '' to ingrid document.");				spatialRefValueRecord.addColumn(createColumn("spatial_ref_value", "y2", "y2"), "")				spatialReferenceRecord.addSubRecord(spatialRefValueRecord);			}			var boundingBoxes = XPathUtils.getNodeList(geographicElements.item(i), "gmd:EX_GeographicBoundingBox");			for (j=0; j<boundingBoxes.getLength(); j++ ) {				if (hasValue(boundingBoxes.item(j)) && hasValue(getXPathValue(boundingBoxes.item(j), "gmd:westBoundLongitude/gco:Decimal"))) {					var spatialReferenceRecord = new Record();					log.debug("adding 'spatial_reference.line" + "' = '" + (lineCounter) + "' to ingrid document.");					spatialReferenceRecord.addColumn(createColumn("spatial_reference", "line", "spatial_reference.line"), (lineCounter))					lineCounter++;					document.addSubRecord(spatialReferenceRecord);					var spatialRefValueRecord = new Record();					log.debug("adding 'spatial_ref_value.name_value" + "' = '' to ingrid document.");					spatialRefValueRecord.addColumn(createColumn("spatial_ref_value", "name_value", "location"), "")					log.debug("adding 'spatial_ref_value.x1" + "' = '" + getXPathValue(boundingBoxes.item(j), "gmd:westBoundLongitude/gco:Decimal") + "' to ingrid document.");					spatialRefValueRecord.addColumn(createColumn("spatial_ref_value", "x1", "x1"), getXPathValue(boundingBoxes.item(j), "gmd:westBoundLongitude/gco:Decimal"))					log.debug("adding 'spatial_ref_value.x2" + "' = '" + getXPathValue(boundingBoxes.item(j), "gmd:eastBoundLongitude/gco:Decimal") + "' to ingrid document.");					spatialRefValueRecord.addColumn(createColumn("spatial_ref_value", "x2", "x2"), getXPathValue(boundingBoxes.item(j), "gmd:eastBoundLongitude/gco:Decimal"))					log.debug("adding 'spatial_ref_value.y1" + "' = '" + getXPathValue(boundingBoxes.item(j), "gmd:southBoundLatitude/gco:Decimal") + "' to ingrid document.");					spatialRefValueRecord.addColumn(createColumn("spatial_ref_value", "y1", "y1"), getXPathValue(boundingBoxes.item(j), "gmd:southBoundLatitude/gco:Decimal"))					log.debug("adding 'spatial_ref_value.y2" + "' = '" + getXPathValue(boundingBoxes.item(j), "gmd:northBoundLatitude/gco:Decimal") + "' to ingrid document.");					spatialRefValueRecord.addColumn(createColumn("spatial_ref_value", "y2", "y2"), getXPathValue(boundingBoxes.item(j), "gmd:northBoundLatitude/gco:Decimal"))					spatialReferenceRecord.addSubRecord(spatialRefValueRecord);				}			}		}	}} | |
| 
	return infixRoots[chr]; | 
	return isInfix ? infixRoots[chr] : [root[1][chr]]; | 
		var mapNewArray = function(nodeArr, chr) {				if(nodeArr[0] == root) {			//return [root[1][chr]]; //prefix			return infixRoots[chr]; //infix		}				var retArray = [];		var aLen = nodeArr.length;		var thisNodesArray;		for (var i = 0; i < aLen; i++) {			thisNodesArray = nodeArr[i][1];			if(thisNodesArray.hasOwnProperty(chr)){				retArray.push(thisNodesArray[chr]);			}		}			return retArray;	}; | 
| 
	measure : function (text, klass, rowHeader) { if ($defined(this.options.formatter) && text !== this.options.header) { text = this.options.formatter.format(text); } | 
	measure : function (text, klass, rowHeader, row) { | 
	    measure : function (text, klass, rowHeader) {        if ($defined(this.options.formatter)                && text !== this.options.header) {            text = this.options.formatter.format(text);        }        var d = new Element('span', {            'class' : klass        });        var el = new Element('span', {            'html' : text,            'class': 'jxGridCellContent'        }).inject(d);        d.setStyle('height', this.grid.row.getHeight());        d.setStyles({            'visibility' : 'hidden',            'width' : 'auto'            //'font-family' : 'Arial'  removed because CSS may impose different font(s)        });        d.inject(document.body, 'bottom');        var s = d.measure(function () {            //if nogt rowHeader, get size of innner span            if (!rowHeader) {                return this.getFirst().getContentBoxSize();            } else {                return this.getMarginBoxSize();            }        });        d.destroy();        return s;    }, | 
| 
	var el = new Element('span', { 'html' : text, 'class': 'jxGridCellContent' }).inject(d); d.setStyle('height', this.grid.row.getHeight()); | 
	text.inject(d); | 
	    measure : function (text, klass, rowHeader) {        if ($defined(this.options.formatter)                && text !== this.options.header) {            text = this.options.formatter.format(text);        }        var d = new Element('span', {            'class' : klass        });        var el = new Element('span', {            'html' : text,            'class': 'jxGridCellContent'        }).inject(d);        d.setStyle('height', this.grid.row.getHeight());        d.setStyles({            'visibility' : 'hidden',            'width' : 'auto'            //'font-family' : 'Arial'  removed because CSS may impose different font(s)        });        d.inject(document.body, 'bottom');        var s = d.measure(function () {            //if nogt rowHeader, get size of innner span            if (!rowHeader) {                return this.getFirst().getContentBoxSize();            } else {                return this.getMarginBoxSize();            }        });        d.destroy();        return s;    }, | 
| 
	return this.getFirst().getContentBoxSize(); | 
	return { content: this.getFirst().getContentBoxSize(), cell: this.getFirst().getMarginBoxSize() } | 
	    measure : function (text, klass, rowHeader, row) {        var d = new Element('span', {            'class' : klass        });        text.inject(d);        //d.setStyle('height', this.grid.row.getHeight(row));        d.setStyles({            'visibility' : 'hidden',            'width' : 'auto'        });        d.inject(document.body, 'bottom');        var s = d.measure(function () {            //if not rowHeader, get size of innner span            if (!rowHeader) {                return this.getFirst().getContentBoxSize();            } else {                return this.getMarginBoxSize();            }        });        d.destroy();        return s;    }, | 
| 
	return this.getMarginBoxSize(); | 
	return { content: this.getMarginBoxSize(), cell: this.getMarginBoxSize() } | 
	    measure : function (text, klass, rowHeader, row) {        var d = new Element('span', {            'class' : klass        });        text.inject(d);        //d.setStyle('height', this.grid.row.getHeight(row));        d.setStyles({            'visibility' : 'hidden',            'width' : 'auto'        });        d.inject(document.body, 'bottom');        var s = d.measure(function () {            //if not rowHeader, get size of innner span            if (!rowHeader) {                return this.getFirst().getContentBoxSize();            } else {                return this.getMarginBoxSize();            }        });        d.destroy();        return s;    }, | 
| 
	var runurl = '<a href="#" onClick="return Ext.getCmp(\'eemanager\').doMissingValues(' + | 
	var runurl = '<span style="cursor:pointer" onClick="return Ext.getCmp(\'eemanager\').doMissingValues(' + | 
		missingValueAnalysisRenderer : function(ee) {		var id = ee.id;		var runurl = '<a href="#" onClick="return Ext.getCmp(\'eemanager\').doMissingValues(' +				id +				')"><img src="/Gemma/images/icons/control_play_blue.png" alt="missing value computation" title="missing value computation"/></a>';		/*		 * Offer missing value analysis if it's possible (this might need tweaking).		 */		if (ee.technologyType != 'ONECOLOR' && ee.hasEitherIntensity) {			if (ee.dateMissingValueAnalysis) {				var type = ee.missingValueAnalysisEventType;				var color = "#000";				var suggestRun = true;				var qtip = 'ext:qtip="OK"';				if (type == 'FailedMissingValueAnalysisEventImpl') {					color = 'red';					qtip = 'ext:qtip="Failed"';				}				return '<span style="color:' + color + ';" ' + qtip + '>' +						Ext.util.Format.date(ee.dateMissingValueAnalysis, 'y/M/d') + ' ' +						(suggestRun ? runurl : '');			} else {				return '<span style="color:#3A3;">Needed</span> ' + runurl;			}		} else {			return '<span ext:qtip="Only relevant for two-channel microarray studies with intensity data available." style="color:#CCF;">NA</span>';		}	}, | 
| 
	')"><img src="/Gemma/images/icons/control_play_blue.png" alt="missing value computation" title="missing value computation"/></a>'; | 
	')"><img src="/Gemma/images/icons/control_play_blue.png" alt="missing value computation" title="missing value computation"/></span>'; | 
		missingValueAnalysisRenderer : function(ee) {		var id = ee.id;		var runurl = '<a href="#" onClick="return Ext.getCmp(\'eemanager\').doMissingValues(' +				id +				')"><img src="/Gemma/images/icons/control_play_blue.png" alt="missing value computation" title="missing value computation"/></a>';		/*		 * Offer missing value analysis if it's possible (this might need tweaking).		 */		if (ee.technologyType != 'ONECOLOR' && ee.hasEitherIntensity) {			if (ee.dateMissingValueAnalysis) {				var type = ee.missingValueAnalysisEventType;				var color = "#000";				var suggestRun = true;				var qtip = 'ext:qtip="OK"';				if (type == 'FailedMissingValueAnalysisEventImpl') {					color = 'red';					qtip = 'ext:qtip="Failed"';				}				return '<span style="color:' + color + ';" ' + qtip + '>' +						Ext.util.Format.date(ee.dateMissingValueAnalysis, 'y/M/d') + ' ' +						(suggestRun ? runurl : '');			} else {				return '<span style="color:#3A3;">Needed</span> ' + runurl;			}		} else {			return '<span ext:qtip="Only relevant for two-channel microarray studies with intensity data available." style="color:#CCF;">NA</span>';		}	}, | 
| 
	var runurl = '<a href="#" onClick="return Ext.getCmp(\'eemanager\').doMissingValues(' + id + ')"><img src="/Gemma/images/icons/control_play_blue.png" ext:qtip="Run missing value analysis" alt="missing value computation"  /></a>'; | 
	var runurl = ""; if (record.get("currentUserHasWritePermission")) { runurl = '<a href="#" onClick="return Ext.getCmp(\'eemanager\').doMissingValues(' + id + ')"><img src="/Gemma/images/icons/control_play_blue.png" ext:qtip="Run missing value analysis" alt="missing value computation"  /></a>'; } | 
		var missingValueAnalysisRenderer = function(value, metadata, record, rowIndex, colIndex, store) {		var id = record.get('id');		var runurl = '<a href="#" onClick="return Ext.getCmp(\'eemanager\').doMissingValues('				+ id				+ ')"><img src="/Gemma/images/icons/control_play_blue.png" ext:qtip="Run missing value analysis" alt="missing value computation"  /></a>';		/*		 * Offer missing value analysis if it's possible (this might need tweaking).		 */		if (record.get('technologyType') != 'ONECOLOR' && record.get('hasEitherIntensity')) {			if (record.get('dateMissingValueAnalysis')) {				var type = record.get('missingValueAnalysisEventType');				var color = "#000";				var suggestRun = true;				var qtip = 'ext:qtip="OK"';				if (type == 'FailedMissingValueAnalysisEventImpl') {					color = 'red';					qtip = 'ext:qtip="Failed"';				}				return '<span style="color:' + color + ';" ' + qtip + '>' + Ext.util.Format.date(value, 'y/M/d')						+ ' ' + (suggestRun ? runurl : '');			} else {				return '<span style="color:#3A3;">Needed</span> ' + runurl;			}		} else {			return '<span style="color:#CCF;" ext:qtip="Only relevant for two-channel microarray studies with intensity data available.">NA</span>';		}	}; | 
| 
	var newTD = this.columns.getColumnCell(this.columns.getByName(col)); | 
	var newTD = this.columns.getColumnCell(this.columns.getByName(col),column - 1); | 
	    modelChanged : function (row, col) {        //grab new TD        var column = this.columns.getIndexFromGrid(col);        var td = document.id(this.gridObj.childNodes[0].childNodes[0].childNodes[row].childNodes[column]);        var currentRow = this.model.getPosition();        this.model.moveTo(row);        var newTD = this.columns.getColumnCell(this.columns.getByName(col));        //get parent list        var list = td.getParent().retrieve('jxList');        list.replace(td, newTD);        this.columns.updateRule(col);        //newTD.replaces(td);        this.model.moveTo(currentRow);    }, | 
			Subsets and Splits
				
	
				
			
				
No community queries yet
The top public SQL queries from the community will appear here once available.