forked from SolidOS/solid-panes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpushbackPane.js
More file actions
103 lines (79 loc) · 3.37 KB
/
pushbackPane.js
File metadata and controls
103 lines (79 loc) · 3.37 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/** PushBack Pane
* This pane will "push back" changes to legacy data sources via Tabulator (right now it only supports Twitter)
* uses pushback code from http://code.google.com/p/pushback
* oshani@mit.edu
*
* -- why is this a pane? what else could it be?
*/
var UI = require('solid-ui')
//This function should handle all the UI manipulations
var pushbackForm = function(subject, doc, apps){
var pbdiv = doc.createElement("div");
pbdiv.setAttribute("id","pb");
var form = doc.createElement("form");
form.setAttribute("id","twitterform");
form.setAttribute("action","");
form.setAttribute("about","./fo1"); //@@ this is wrong!
form.setAttribute("typeof","http://ld2sd.deri.org/pb/ns#RDForm");
var fieldset = doc.createElement("fieldset");
var legend = doc.createElement("p");
legend.appendChild(doc.createTextNode("Send Updates to Twitter"));
var div1 = doc.createElement("div");
div1.setAttribute("rel","http://ld2sd.deri.org/pb/ns#field");
div1.setAttribute("style","margin:10px");
var div2 = doc.createElement("div");
div2.setAttribute("about","./fo1.f1"); //@@ this is also very wrong!
div2.setAttribute("typeof","http://ld2sd.deri.org/pb/ns#UpdateableField");
var label = doc.createElement("label");
label.setAttribute("rel","http://ld2sd.deri.org/pb/ns#key");
label.setAttribute("resource","http://ld2sd.deri.org/pushback/rdforms/rdform2.html#twitmsg");
label.setAttribute("property","http://purl.org/dc/terms/title");
label.setAttribute("for","bugactive"); //@@huh??
var div3 = doc.createElement("div");
div3.setAttribute("rel","http://ld2sd.deri.org/pb/ns#value");
var div4 = doc.createElement("div");
div4.setAttribute("about","./fo1.f1.val");
div4.setAttribute("typeof","http://ld2sd.deri.org/pb/ns#FieldValue");
var txtinput = doc.createElement("textarea");
txtinput.setAttribute("id","message");
txtinput.setAttribute("rows","2");
txtinput.setAttribute("cols","70");
txtinput.setAttribute("property","http://www.w3.org/1999/02/22-rdf-syntax-ns#value");
txtinput.setAttribute("value","");
var buttondiv = doc.createElement("div");
var btninput = doc.createElement("input");
btninput.setAttribute("type","button");
btninput.setAttribute("value","Submit");
btninput.addEventListener("click",pushback, false);
var resultdiv = doc.createElement("div");
resultdiv.setAttribute("id","result");
buttondiv.appendChild(btninput);
div4.appendChild(txtinput);
div3.appendChild(div4);
div2.appendChild(label);
div2.appendChild(div3);
div1.appendChild(div2);
fieldset.appendChild(legend);
fieldset.appendChild(div1);
fieldset.appendChild(buttondiv);
form.appendChild(fieldset);
form.appendChild(resultdiv);
pbdiv.appendChild(form);
pbdiv.appendChild(resultdiv);
pbdiv.setAttribute("style","border: 2px solid black");
return pbdiv
}
module.exports = {
icon: UI.icons.originalIconBase + 'pb-logo.png',
name: 'pushback',
label: function(subject) { return 'pushback';},
render: function(subject, myDocument) {
var div = myDocument.createElement("div");
div.setAttribute('id', 'pushbackPane');
//We can support different types of applications or any combinations of those supporting the pushback operation through a generic form
var apps = []; //to support different apps
div.appendChild(pushbackForm(subject, myDocument, apps));
return div;
}
};
// ends