-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
27 lines (24 loc) · 980 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var timer;
function refreshWritePermission(file,organ){
getWritePermission(file,organ);
document.getElementById("publish").style.visibility = "hidden";
document.getElementById("sendmailbutton").style.visibility = "hidden";
timer = setInterval(function() { getWritePermission(file,organ) },180000);
}
function getWritePermission(file,organ) {
var myAjax = new XMLHttpRequest();
myAjax.onreadystatechange = function() {
if (myAjax.readyState == 4) {
if (myAjax.status == 200) {
Response = myAjax.responseXML.documentElement.firstChild.data;
if(Response == "Another user is editing this file") {
window.alert(Response);
}
document.getElementById("locktext").innerHTML = Response + " will refresh automatically";
document.getElementById("submitbutton").style.visibility = "visible";
}
}
}
myAjax.open("GET", "/getLock.php?organ=" + organ + "&file=" + file, true);
myAjax.send();
}