src/main/webapp/scripts/newProject/Phagebook.js
/*When a user goes to the projects section of Phagebook, the first project will automatically be displayed.
 If the user doesn't have any projects yet, a create new project form will be displayed
 The left column of the page will have a list of all the projects associated with that user. Clicking on
 one of the tabs will display the details of that project and the user's project notebook (different function)*/
When a user goes to the projects section of Phagebook, the first project will automatically be displayed.
If the user doesn't have any projects yet, a create new project form will be displayed
The left column of the page will have a list of all the projects associated with that user. Clicking on
one of the tabs will display the details of that project and the user's project notebook (different function)
When a user goes to the projects section of Phagebook the first project will automatically be displayed . If the user doesn ' t have any projects yet a create new project form will be displayed The left column of the page will have a list of all the projects associated with that user . Clicking on one of the tabs will display the details of that project and the user ' s project notebook ( different function )
function displayProjects() {
    var personID = "clotho.developer.katielewis1";
    Clotho.get(personID).then(function (personObj) {
        var tableRef = document.getElementById("projTable");
        if (personObj.projects.length > 0) {
            var newRow = tableRef.insertRow(0);
            var newCell = newRow.insertCell(0);
            Clotho.get(personObj.projects[0]).then(function (proj) {
                newCell.innerHTML = '<a href="./Projects.html" style = "display:block"+ value =' + proj.id + ' onclick = "projectDetails.call(this)">' + proj.name + '</a>';
            });
            for (var i = 1; i < personObj.projects.length; i++) {
                Clotho.get(personObj.projects[i]).then(function (projectObj) {
                    newRow = tableRef.insertRow(tableRef.rows.length);
                    newCell = newRow.insertCell(0);
                    newCell.innerHTML = '<a href="./Projects.html" style = "display:block" value =' + projectObj.id + ' onclick = "projectDetails.call(this)">' + projectObj.name + '</a>';
                });
            }
            Clotho.get(personObj.projects[0]).then(function (projObj) {
                document.getElementById("projTitle").innerHTML = projObj.name;
                document.getElementById("currentLab").innerHTML = projObj.Lab;
                document.getElementById("currentLead").innerHTML = projObj.projectLead;
                document.getElementById("currentPI").innerHTML = projObj.PI;
                document.getElementById("currentAdvisor").innerHTML = projObj.advisor;
                document.getElementById("projectDescription").innerHTML = projObj.Description;
            });
        }
        else if(personObj.projects.length == 0){
            var id = document.getElementById("rightColumn");
            var secondID = document.getElementById("createProject");
            var thirdID = document.getElementById("notebookEntry");
            thirdID.style.display = 'none';
            id.style.display='none';
            secondID.style.display = 'block';
        }
    });
}
function displayProjects ( ) { var personID = "clotho.developer.katielewis1" ; Clotho . get ( personID ) . then ( function ( personObj ) { var tableRef = document . getElementById ( "projTable" ) ; if ( personObj . projects . length > 0 ) { var newRow = tableRef . insertRow ( 0 ) ; var newCell = newRow . insertCell ( 0 ) ; Clotho . get ( personObj . projects [ 0 ] ) . then ( function ( proj ) { newCell . innerHTML = '<a href="./Projects.html" style = "display:block"+ value =' + proj . id + ' onclick = "projectDetails.call(this)">' + proj . name + '</a>' ; } ) ; for ( var i = 1 ; i < personObj . projects . length ; i ++ ) { Clotho . get ( personObj . projects [ i ] ) . then ( function ( projectObj ) { newRow = tableRef . insertRow ( tableRef . rows . length ) ; newCell = newRow . insertCell ( 0 ) ; newCell . innerHTML = '<a href="./Projects.html" style = "display:block" value =' + projectObj . id + ' onclick = "projectDetails.call(this)">' + projectObj . name + '</a>' ; } ) ; } Clotho . get ( personObj . projects [ 0 ] ) . then ( function ( projObj ) { document . getElementById ( "projTitle" ) . innerHTML = projObj . name ; document . getElementById ( "currentLab" ) . innerHTML = projObj . Lab ; document . getElementById ( "currentLead" ) . innerHTML = projObj . projectLead ; document . getElementById ( "currentPI" ) . innerHTML = projObj . PI ; document . getElementById ( "currentAdvisor" ) . innerHTML = projObj . advisor ; document . getElementById ( "projectDescription" ) . innerHTML = projObj . Description ; } ) ; } else if ( personObj . projects . length == 0 ) { var id = document . getElementById ( "rightColumn" ) ; var secondID = document . getElementById ( "createProject" ) ; var thirdID = document . getElementById ( "notebookEntry" ) ; thirdID . style . display = 'none' ; id . style . display = 'none' ; secondID . style . display = 'block' ; } } ) ; }
When a user goes to the projects section of Phagebook, the first project will automatically be displayed.
When a user goes to the projects section of Phagebook the first project will automatically be displayed .