-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheditor.patch
More file actions
72 lines (71 loc) · 1.78 KB
/
Copy patheditor.patch
File metadata and controls
72 lines (71 loc) · 1.78 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
diff --git a/apps/files_texteditor/js/editor.js b/apps/files_texteditor/js/editor.js
index eedc28c..a38691c 100644
--- a/apps/files_texteditor/js/editor.js
+++ b/apps/files_texteditor/js/editor.js
@@ -1,3 +1,5 @@
+completeFilePath = "";
+
function setEditorSize(){
// Sets the size of the text editor window.
fillWindow($('#editor'));
@@ -181,6 +183,7 @@ function giveEditorFocus(){
// Loads the file editor. Accepts two parameters, dir and filename.
function showFileEditor(dir,filename){
// Delete any old editors
+ setFilePath(dir, filename);
$('#editor').remove();
if(!editorIsShown()){
// Loads the file editor and display it.
@@ -276,7 +279,34 @@ function showFileEditor(dir,filename){
}
// End ajax
);
+ console.log(data);
is_editor_shown = true;
+
+ var hostIP = window.location.host;
+ var host = "http://" + hostIP + ":3000/";
+ var sockURL = host + "socket.io/socket.io.js";
+
+ $.getScript(sockURL, function() {
+ var socket = io.connect(host);
+
+ socket.emit('identity', { userid : getUserid()} );
+ socket.emit('whoareonline', { filepath : getFilePath()} );
+
+ socket.on('theseareonline', function(data) {
+ console.log("Online user :" + data);
+ data = $.unique(data);
+ var str = "";
+ str += "<div id='online_users'>Online users : <br/>";
+ for (var i in data) {
+ str += "<ul>" + data[i] + "</ul>";
+ }
+ str += "</div>";
+ console.log(str);
+ $('#content').append(str);
+ });
+ });
+
+
}
}
@@ -429,5 +459,17 @@ $(document).ready(function(){
saveComment();
}
});
-
+
});
+
+function setFilePath(dir, filename) {
+ completeFilePath = "/" + getUserid() + "/files" + dir + "/" + filename;
+}
+
+function getFilePath() {
+ return completeFilePath;
+}
+
+function getUserid() {
+ return getCookie("userid");
+}