| 1 |
// Global Killswitch
|
| 2 |
if (isJsEnabled()) {
|
| 3 |
addLoadEvent(inlineeditAutoAttach);
|
| 4 |
}
|
| 5 |
|
| 6 |
/**
|
| 7 |
* Attaches the inlineedit behaviour to all required fields
|
| 8 |
*/
|
| 9 |
function inlineeditAutoAttach() {
|
| 10 |
var acdb = [];
|
| 11 |
var divs = document.getElementsByTagName('div');
|
| 12 |
for (i = 0; div = divs[i]; i++) {
|
| 13 |
if (div && hasClass(div, 'inlineedit')) {
|
| 14 |
div.ondblclick = beginEdit;
|
| 15 |
var nid = div.id.substr(0, 11);
|
| 16 |
div.textArea = document.getElementById(div.id +'-textarea');
|
| 17 |
div.textArea.onblur = endEdit;
|
| 18 |
div.textArea.form.textArea = div.textArea;
|
| 19 |
}
|
| 20 |
}
|
| 21 |
}
|
| 22 |
|
| 23 |
function beginEdit() {
|
| 24 |
var w = this.offsetWidth;
|
| 25 |
var h = this.offsetHeight;
|
| 26 |
this.style.display = 'none';
|
| 27 |
|
| 28 |
this.textArea.style.width = w + 'px';
|
| 29 |
this.textArea.style.height = (h - 4) + 'px';
|
| 30 |
this.textArea.form.style.display = 'block';
|
| 31 |
|
| 32 |
this.textArea.focus();
|
| 33 |
}
|
| 34 |
|
| 35 |
function endEdit() {
|
| 36 |
id = this.id.substr(0, this.id.length - 9);
|
| 37 |
div = document.getElementById(id);
|
| 38 |
|
| 39 |
this.form.style.display = 'none';
|
| 40 |
div.style.display = 'block';
|
| 41 |
var h = div.offsetHeight;
|
| 42 |
div.innerHTML = 'Please wait...';
|
| 43 |
div.style.height = h + 'px';
|
| 44 |
|
| 45 |
object = new Object();
|
| 46 |
object.value = this.value;
|
| 47 |
HTTPPost(this.form.getAttribute('action'), object, updateDisplay, div.id);
|
| 48 |
}
|
| 49 |
|
| 50 |
function updateDisplay(data, xmlhttp, id) {
|
| 51 |
document.getElementById(id).parentNode.innerHTML = data;
|
| 52 |
inlineeditAutoAttach();
|
| 53 |
}
|