Changeset 4760 for DASISH


Ignore:
Timestamp:
03/19/14 08:57:30 (10 years ago)
Author:
stephanie.roth@snd.gu.se
Message:

Element styling and functionality for result === 401.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection/sidebarUserLogin.js

    r4717 r4760  
    22    checkUserLogin: function() {
    33        var user = annotationProxy.getLoggedInInfo(function(result) {
    4             if (result !== 401) {
    5                 value = "You are logged in as " + user.dislayName + ".";
    6                 var loginInfo = document.getElementById("loginInfo");
    7                 var newLabel = document.createElement("label");
    8                 newLabel.setAttribute("value", value);
    9                 newLabel.setAttribute("class", "loggedIn");
    10                 loginInfo.appendChild(newLabel);
    11             } else {
    12                 value = "Please sign in to the DASISH annotation server.";
    13                 var loginInfo = document.getElementById("loginInfo");
    14                 var newLabel = document.createElement("label");
    15                 newLabel.setAttribute("value", value);
    16                 newLabel.setAttribute("class", "loginLabel");
    17                 newLabel.setAttribute("onclick", "UserLogin.openPopup()");
    18                 loginInfo.appendChild(newLabel);
     4            // TODO: Do we need to refine the status code checks?
     5
     6            // user is logged in
     7            if (result === 200) {
     8
     9                /*
     10                 value = "You are logged in as " + user.dislayName + ".";
     11                 var loginInfo = document.getElementById("loginInfo");
     12                 var newLabel = document.createElement("label");
     13                 newLabel.setAttribute("value", value);
     14                 newLabel.setAttribute("id", "loggedIn");
     15                 loginInfo.appendChild(newLabel);
     16                 */
     17
     18                // user is not logged in
     19            } else if (result === 401) {
     20
     21                // Label element with status information
     22                var loginStatus = document.getElementById("loginStatus");
     23                var value = "Please sign in to the DASISH annotation server.";
     24                loginStatus.setAttribute("value", value);
     25                loginStatus.setAttribute("class", "notLoggedIn");
     26                // TODO: Flexible width style or other solution?
     27                loginStatus.setAttribute("width", "300");
     28
     29                // Button for login into backend
     30                var loginButton = document.getElementById("loginButton");
     31                loginButton.setAttribute("label", "Login");
     32                loginButton.setAttribute("class", "loginButton");
     33                loginButton.setAttribute("width", "300");
     34
     35                // Logout button hidden
     36                var logoutButton = document.getElementById("logoutButton");
     37                logoutButton.setAttribute("hidden", true);
     38
     39            } else { // server connection timeout, server error 500+, or other
     40                // TODO: Refine alert. Maybe some type of XUL window? Should the server admin mail address be given?
     41                alert("There might be some trouble with the server connection for " + annotationFramework.getBackend() + ". Please try again later or ask your server administrator for assistance.");
    1942            }
    2043        });
Note: See TracChangeset for help on using the changeset viewer.