-
Notifications
You must be signed in to change notification settings - Fork 87
/
revision.html
183 lines (171 loc) · 6.04 KB
/
revision.html
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<div class="revision">
<h1></h1>
<div class="btn-group well well-sm">
<button class="btn btn-default branchButton">Branch</button>
<button class="btn btn-default addExtendedDataButton">Add extended data</button>
</div>
<ul class="nav nav-tabs">
<li class="detailsLink"><a>Details</a></li>
<li class="queryLink"><a>Query</a></li>
<li class="extendedDataLink"><a>Extended Data</a></li>
<li class="browserLink"><a>Browser</a></li>
</ul>
<div class="tab-content content">
<div class="tab-pane details">
Not implemented
</div>
<div class="tab-pane query">
Not implemented
</div>
<div class="tab-pane extendeddata">
Not implemented
</div>
<div class="tab-pane browser">
Not implemented
</div>
<div class="tab-pane log">
Not implemented
</div>
</div>
</div>
<script>
function Revision(main, revision) {
var othis = this;
othis.current = null;
this.show = function() {
if (typeof revision == "object") {
othis.revision = revision;
othis.updateRevision();
} else {
othis.reloadRevision(revision);
}
Global.bimServerApi.register("NotificationInterface", "newLogAction", othis.newLogAction);
};
this.updateRevision = function() {
$(".revision h1").html("Revision " + othis.revision.id);
$(".revision .extendedDataLink a").html("Extended Data" + (othis.revision.extendedData.length == 0 ? "" : (" (" + othis.revision.extendedData.length + ")")));
if (History.getState().data.page != "Revision") {
pushHistory({page: "Revision", "roid": typeof revision == "object" ? revision.oid : revision}, "Revision");
}
var history = History.getState().data;
if (history.tab == "details") {
othis.showDetails();
} else if (history.tab == "query") {
othis.showQuery();
} else if (history.tab == "extendeddata") {
othis.showExtendedData();
} else if (history.tab == "browser") {
othis.loadBrowser();
} else {
othis.showDetails();
}
var settings = {
getTopicsMethod: "getProgressTopicsOnRevision",
getTopicsArguments: {poid: othis.revision.projectId, roid: othis.revision.oid},
registerFunction: function(newChangeProgressHandler, closedChangeProgressHandler){
Global.bimServerApi.registerChangeProgressRevisionHandler(othis.revision.projectId, othis.revision.oid, function(roid, topicId){
newChangeProgressHandler(topicId);
}, function(roid, topicId){
closedChangeProgressHandler(topicId);
})
},
unregisterFunction: function(newChangeProgressHandler, closedChangeProgressHandler){
Global.bimServerApi.unregisterChangeProgressRevisionHandler(othis.revision.projectId, othis.revision.oid, newChangeProgressHandler, closedChangeProgressHandler)
}
};
$(".revision .log").load(Global.baseDir + "log.html", function(){
new Log($(this), settings, main);
});
};
this.reloadRevision = function(roid) {
if (roid == null) {
roid = othis.revision.oid;
}
Global.bimServerApi.call("ServiceInterface", "getRevision", {roid: roid}, function(revision){
othis.revision = revision;
othis.updateRevision();
});
};
this.close = function(){
Global.bimServerApi.unregister(othis.newLogAction);
};
this.showDetails = function(){
//pushHistoryAppend({tab: "details"}, "Revision");
$(".revision .nav li").removeClass("active");
$(".revision .detailsLink").addClass("active");
$(".revision .content > div").hide();
$(".revision .details").show();
};
this.showQuery = function(){
pushHistoryAppend({tab: "query"}, "Revision");
$(".revision .nav li").removeClass("active");
$(".revision .queryLink").addClass("active");
$(".revision .content > div").hide();
$(".revision .query").show();
$(".revision .query").load(Global.baseDir + "query.html", function(){
new Query($(this), main, othis.revision.projectId, othis.revision.oid);
});
};
this.newLogAction = function(uuid, logAction, serviceIdentifier, profileIdentifier, token, apiUrl){
if (logAction.__type == "SExtendedDataAddedToRevision") {
Global.bimServerApi.call("ServiceInterface", "getExtendedData", {oid: logAction.extendedDataId}, function(data){
//othis.addExtendedData(data);
});
}
};
this.showExtendedData = function(){
pushHistoryAppend({tab: "extendeddata"}, "Revision");
$(".revision .nav li").removeClass("active");
$(".revision .extendedDataLink").addClass("active");
$(".revision .content > div").hide();
$(".revision .extendeddata").show();
if (othis.current != null) {
othis.current.close();
}
$(".revision .extendeddata").load(Global.baseDir + "extendeddatalist.html", function(){
othis.current = new ExtendedDataList(main, othis.revision, othis);
});
};
this.loadBrowser = function(callback){
pushHistoryAppend({tab: "browser"}, "Revision");
$(".revision .nav li").removeClass("active");
$(".revision .browserLink").addClass("active");
$(".revision .content > div").hide();
$(".revision .browser").show();
if (othis.current != null) {
othis.current.close();
}
$(".revision .browser").load(Global.baseDir + "browser.html", function(){
othis.current = new Browser($(this), othis.project, othis.revision);
if (callback != null) {
callback.call(othis.current);
} else {
othis.current.loadFromHistory();
}
});
};
this.showBranch = function(){
var div = $("<div>");
$(document.body).append(div);
div.load(Global.baseDir + "branch.html", function(){
new Branch($(this), main, othis.revision.oid);
}).modal({keyboard:true});
};
this.addExtendedDataButtonClick = function(){
var div = $("<div>");
$(document.body).append(div);
div.load(Global.baseDir + "addextendeddata.html", function(){
new AddExtendedData($(this), othis.revision, function(){
othis.showExtendedData();
});
div.find(".modal").modal("show");
});
};
$(".revision .detailsLink").click(othis.showDetails);
$(".revision .queryLink").click(othis.showQuery);
$(".revision .extendedDataLink").click(othis.showExtendedData);
$(".revision .browserLink").click(function(){othis.loadBrowser()});
$(".revision .branchButton").click(othis.showBranch);
$(".revision .addExtendedDataButton").click(othis.addExtendedDataButtonClick);
};
</script>