Skip to content

Commit

Permalink
Small improvements:
Browse files Browse the repository at this point in the history
- Add projects from user page
- Improved speed of projects page (less calls)
- Several style fixes
  • Loading branch information
rubendel committed Feb 18, 2014
1 parent 00ce354 commit c6079ec
Show file tree
Hide file tree
Showing 17 changed files with 179 additions and 105 deletions.
4 changes: 2 additions & 2 deletions addproject.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@

this.addProject = function() {
if (parentProject != null) {
Global.bimServerApi.call("Bimsie1ServiceInterface", "addProjectAsSubProject", {parentPoid: parentProject.oid, projectName: $(".addproject .inputName").val()}, function(data){
Global.bimServerApi.callWithFullIndication("Bimsie1ServiceInterface", "addProjectAsSubProject", {parentPoid: parentProject.oid, projectName: $(".addproject .inputName").val()}, function(data){
othis.updateProject(data);
});
} else {
Global.bimServerApi.call("Bimsie1ServiceInterface", "addProject", {projectName: $(".addproject .inputName").val()}, function(data){
Global.bimServerApi.callWithFullIndication("Bimsie1ServiceInterface", "addProject", {projectName: $(".addproject .inputName").val()}, function(data){
othis.updateProject(data);
});
}
Expand Down
2 changes: 1 addition & 1 deletion basicusersettings.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h3>Basic User Settings</h3>

this.showDeletedItemsChange = function(){
$.cookie(main.user.oid + "showdeleteditems", $(this).is(":checked"));
Global.notifier.setStatus("Show deleted items settings successfully changed");
Global.notifier.setSuccess("Show deleted items settings successfully changed");
};

this.show = function(){
Expand Down
4 changes: 4 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,8 @@ div.sidespan > div > ul {

.indexStatus {
margin: 10px;
}

.downloadpopup form {
margin: 14px;
}
8 changes: 4 additions & 4 deletions download.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h3>Download / Checkout</h3>
</div>
<div class="modal-body">
<div class="checkoutMessage initialhide"></div>
<div class="downloadStatus"></div>
<div class="downloadStatus initialhide alert alert-info"></div>
<div class="progressBarHolder"></div>

<div class="downloadProgressBar progress initialhide">
Expand Down Expand Up @@ -107,7 +107,7 @@ <h3>Download / Checkout</h3>
if (topicId == othis.laid) {
var oldStage = othis.stage;
othis.stage = state.stage;
containerDiv.find(".downloadStatus").html(state.title);
containerDiv.find(".downloadStatus").html(state.title).show();
if (oldStage != state.stage) {
containerDiv.find(".progressBarHolder .downloadProgressBar").remove();
containerDiv.find(".progressBarHolder").append("<div class=\"downloadProgressBar progress\"><div class=\"progress-bar\"></div></div>");
Expand Down Expand Up @@ -151,15 +151,15 @@ <h3>Download / Checkout</h3>
window.location = url;
}
containerDiv.find(".checkoutMessage").html("");
containerDiv.find(".downloadStatus").html("Prepare complete, initiating download.");
containerDiv.find(".downloadStatus").removeClass("alert-info").addClass("alert-success").html("Prepare complete, initiating download.");
containerDiv.find(".fields, .downloadpopup .checkoutMessage").show();
});
}
}
};

this.start = function(data) {
containerDiv.find(".downloadStatus").html("Preparing download...");
containerDiv.find(".downloadStatus").addClass("alert-info").show().html("Preparing download...");

containerDiv.find(".progressBarHolder .downloadProgressBar").remove();
containerDiv.find(".progressBarHolder").append("<div class=\"downloadProgressBar progress\"><div class=\"progress-bar\"></div></div>");
Expand Down
10 changes: 5 additions & 5 deletions genericpluginsettings.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,21 @@ <h3>Settings</h3>
var primitiveDefinition = parameter.type;
var input = null;
if (primitiveDefinition.type == "LONG") {
input = $("<input parameter=\"" + parameter.name + "\" dtype=\"" + primitiveDefinition.type + "\" type=\"text\"/>");
input = $("<input class=\"form-control\" parameter=\"" + parameter.name + "\" dtype=\"" + primitiveDefinition.type + "\" type=\"text\"/>");
input.numeric({ decimal: false, negative: false });
td.append(input);
} else if (primitiveDefinition.type == "DOUBLE") {
input = $("<input parameter=\"" + parameter.name + "\" dtype=\"" + primitiveDefinition.type + "\" type=\"text\"/>");
input = $("<input class=\"form-control\" parameter=\"" + parameter.name + "\" dtype=\"" + primitiveDefinition.type + "\" type=\"text\"/>");
input.numeric({ decimal: ".", negative: false });
td.append(input);
} else if (primitiveDefinition.type == "STRING") {
input = $("<input parameter=\"" + parameter.name + "\" dtype=\"" + primitiveDefinition.type + "\" type=\"text\"/>");
input = $("<input class=\"form-control\" parameter=\"" + parameter.name + "\" dtype=\"" + primitiveDefinition.type + "\" type=\"text\"/>");
td.append(input);
} else if (primitiveDefinition.type == "BYTE_ARRAY") {
input = $("<input parameter=\"" + parameter.name + "\" dtype=\"" + primitiveDefinition.type + "\" type=\"file\"/>");
input = $("<input class=\"form-control\" parameter=\"" + parameter.name + "\" dtype=\"" + primitiveDefinition.type + "\" type=\"file\"/>");
td.append(input);
} else if (primitiveDefinition.type == "BOOLEAN") {
input = $("<input parameter=\"" + parameter.name + "\" dtype=\"" + primitiveDefinition.type + "\" type=\"checkbox\"/>");
input = $("<input class=\"form-control\" parameter=\"" + parameter.name + "\" dtype=\"" + primitiveDefinition.type + "\" type=\"checkbox\"/>");
td.append(input);
}
}
Expand Down
2 changes: 1 addition & 1 deletion header.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div class="header">
<h1>BIM Views (beta)</h1>
<h1>BIM Views</h1>
</div>
57 changes: 32 additions & 25 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -208,36 +208,25 @@
var othis = this;

this.setSelector = function(selector) {
othis.selector = selector;
var currentmessage = $(othis.selector).find(".message").html();
$(othis.selector).hide();
$(othis.selector).find(".close").click(othis.closeClick);
};

this.closeClick = function(){
othis.clear();
};

this.error = function(message){
if (othis.lastTimeOut != null) {
clearTimeout(othis.lastTimeOut);
othis.lastTimeOut = null;
}
$(othis.selector).find(".message").html(message).parent().show();
};

this.info = function(message) {
if (othis.lastTimeOut != null) {
clearTimeout(othis.lastTimeOut);
othis.lastTimeOut = null;
othis.selector = selector;
if (currentmessage != "" && currentmessage != undefined) {
console.log(currentmessage);
$(selector).show();
$(selector).find(".message").html(currentmessage).parent().addClass("alert-success");
} else {
$(othis.selector).hide();
}
$(othis.selector).find(".message").html(message).parent().show();
$(othis.selector).find(".close").click(othis.clear);
};

this.clear = function() {
$(othis.selector).find(".message").html("").parent().hide();
};

this.resetStatus = function(){
console.log("resetstatus");
if (othis.lastTimeOut != null) {
clearTimeout(othis.lastTimeOut);
othis.lastTimeOut = null;
Expand All @@ -254,7 +243,25 @@
$(othis.selector).hide();
};

this.setStatus = function(status, timeToShow) {
this.setSuccess = function(status, timeToShow) {
if (timeToShow == null) {
timeToShow = 5000;
}
$(othis.selector).stop(true, true);
if (othis.lastTimeOut != null) {
clearTimeout(othis.lastTimeOut);
othis.lastTimeOut = null;
}
$(othis.selector).find(".message").html(status).parent().show().removeClass("alert-danger").removeClass("alert-info").addClass("alert-success");
var notifier = this;
if (timeToShow != -1) {
othis.lastTimeOut = setTimeout(function(){
notifier.resetStatus();
}, timeToShow);
}
};

this.setInfo = function(status, timeToShow) {
if (timeToShow == null) {
timeToShow = 5000;
}
Expand All @@ -263,11 +270,11 @@
clearTimeout(othis.lastTimeOut);
othis.lastTimeOut = null;
}
$(othis.selector).find(".message").html(status).parent().removeClass("alert-danger").addClass("alert-info").show();
$(othis.selector).find(".message").html(status).parent().show().removeClass("alert-danger").removeClass("alert-success").addClass("alert-info");
var notifier = this;
if (timeToShow != -1) {
othis.lastTimeOut = setTimeout(function(){
othis.resetStatus();
notifier.resetStatus();
}, timeToShow);
}
};
Expand All @@ -277,7 +284,7 @@
clearTimeout(othis.lastTimeOut);
othis.lastTimeOut = null;
}
$(othis.selector).find(".message").html(error).parent().removeClass("alert-info").addClass("alert-danger").show();
$(othis.selector).find(".message").html(error).parent().removeClass("alert-info").removeClass("alert-success").addClass("alert-danger").show();
};

othis.setSelector(".indexStatus .status");
Expand Down
1 change: 0 additions & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ function pushHistoryAppend(obj, title) {
str = str.substring(0, str.length - 1);
}
if (!current.cleanUrl.endsWith(str)) {
console.log("pha ", obj);
History.pushState(obj, "BIM Views" + (title == null ? "" : " - " + title), str);
}
pushing = false;
Expand Down
17 changes: 1 addition & 16 deletions login.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,16 @@
<button type="button" class="btn loginButton btn-primary">Sign in</button>
<button type="button" class="btn btn-default resetPasswordButton">Reset password</button>
<button type="button" class="btn btn-default registerButton initialhide">Register</button>
<!-- <button type="button" class="btn openIdButton">OpenID (beta)</button> -->
</div>
</div>
</form>
</div>
<div class="openidDiv initialhide">
<a class="googleLink"><img src="images.large/google.gif"/></a>
</div>
</div>
</div>
<script>
function Login(address, username) {
var othis = this;

console.log(address);

if (address != null && address.startsWith("http://")) {
address = address.substring(7);
}
Expand All @@ -61,7 +55,7 @@
Global.bimServerApi.call("AdminInterface", "getVersion", {}, function(version){
if (!Settings.usableBimServerVersion(version)) {
var versionString = version.major + "." + version.minor + "." + version.revision;
Global.notifier.setStatus("This version of BIMserver (" + versionString + ") has not been tested with this version of BIMvie.ws");
Global.notifier.setInfo("This version of BIMserver (" + versionString + ") has not been tested with this version of BIMvie.ws");
}
});

Expand Down Expand Up @@ -139,14 +133,5 @@
new SelectServer();
});
});

$(".googleLink").click(function(){
$.cookie("address" + window.document.location.port, Global.bimServerApi.baseUrl);
Global.bimServerApi.call("Bimsie1AuthInterface", "loginOpenId", {op: "https://www.google.com/accounts/o8/id", returnUrl: Global.baseDir + "openid.html"}, function(url){
document.location = url;
});
});

$(".openIdButton").click(othis.openIdClick);
}
</script>
15 changes: 4 additions & 11 deletions main.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,10 @@
this.logout = function() {
$(".sidespan").empty();
Global.bimServerApi.logout(function(){
if (Settings.allowBimServerAddress()) {
$(".indexcontainer").load(Global.baseDir + "selectserver.html", function(){
$(".indexStatus").show();
new SelectServer(Global.bimServerApi.baseUrl);
});
} else {
$(".indexcontainer").load(Global.baseDir + "login.html", function(){
$(".indexStatus").show();
new Login(Global.bimServerApi.baseUrl);
});
}
$(".indexcontainer").load(Global.baseDir + "login.html", function(){
Global.notifier.setSelector(".indexStatus .status");
new Login(Global.bimServerApi.baseUrl);
});
});
};

Expand Down
10 changes: 6 additions & 4 deletions project.html
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ <h1></h1>

this.revokeUser = function() {
var user = $(this).parents("tr").data("user");
Global.bimServerApi.call("ServiceInterface", "removeUserFromProject", {
Global.bimServerApi.callWithFullIndication("ServiceInterface", "removeUserFromProject", {
uoid: user.oid,
poid: othis.project.oid
}, function(data){
Expand Down Expand Up @@ -740,10 +740,12 @@ <h1></h1>
}
};

this.loadBrowser = function(callback) {
this.loadBrowser = function(callback, pushhistory) {
$(".browser .message").html("Showing data for revision " + othis.lastRevision.id);
othis.tabChanger.changeTab($(".browserLink"), "browser.html", $(".browsercontainer"), function(){
pushHistory({page: "Project", poid: othis.project.oid, tab: "browser"}, "Project");
if (pushhistory) {
pushHistory({page: "Project", poid: othis.project.oid, tab: "browser"}, "Project");
}
$(".browser").show();
return new Browser($(this), othis.lastRevision);
}, callback);
Expand Down Expand Up @@ -808,7 +810,7 @@ <h1></h1>

this.addUserToProject = function(event){
event.preventDefault();
Global.bimServerApi.call("ServiceInterface", "addUserToProject", {
Global.bimServerApi.callWithFullIndication("ServiceInterface", "addUserToProject", {
uoid: containerDiv.find(".addUserToProjectDiv select option:selected").val(),
poid: othis.project.oid
}, function(data){
Expand Down
Loading

0 comments on commit c6079ec

Please sign in to comment.