[DIBSweb] add project lock status
authordibs <dibs@samsung.com>
Tue, 26 Mar 2013 13:12:23 +0000 (22:12 +0900)
committerdibs <dibs@samsung.com>
Tue, 26 Mar 2013 13:12:23 +0000 (22:12 +0900)
dibs-web/app/controllers/admin_project_controller.rb
dibs-web/app/controllers/projects_controller.rb
dibs-web/public/javascripts/admin-distribution-modify.js
dibs-web/public/javascripts/admin-project-add.js
dibs-web/public/javascripts/admin-project-modify.js
dibs-web/public/javascripts/admin-project.js
dibs-web/public/javascripts/admin-user.js
dibs-web/public/javascripts/build.js
dibs-web/public/javascripts/dibs-api.js

index e125bc606dd9fd9bced13e554e85e5bab8dc4b91..7f7d5b4ec0c92cbd597fbebf27c2025519df23d1 100644 (file)
@@ -79,6 +79,7 @@ class AdminProjectController < ApplicationController
                                project_list = Project.find_by_sql("SELECT projects.id
                                                                                                             , projects.name 
                                                                                                             , projects.ptype
+                                                                                                            , projects.status
                                                                                                          FROM projects
                                                                                                                 , distributions
                                                                                                         WHERE distributions.name = \"#{dist_name}\"
@@ -89,6 +90,7 @@ class AdminProjectController < ApplicationController
                                        doc.Project {
                                                doc.ProjectName(project.name)
                                                doc.Type(project.ptype)
+                                               doc.ProjectStatus(project.status)
             
                                                os_list = ProjectOs.find_by_sql("SELECT supported_os.name AS name
                                                                                                                   FROM project_os
@@ -133,6 +135,7 @@ class AdminProjectController < ApplicationController
                project_type = change_item[:ProjectType].upcase
                project_dist_name = change_item[:Distribution]
                project_password = change_item[:ProjectPass]
+               project_status = change_item[:ProjectStatus].upcase
 
                if project_name.nil? or project_name.empty? then
                        errmsg = "Can't find [Name] information"
@@ -140,6 +143,12 @@ class AdminProjectController < ApplicationController
                        return
                end
 
+               if not project_status.eql? "OPEN" and not project_status.eql? "CLOSE"
+                       errmsg = "project status is invalid"
+                       render :json => { :error => errmsg }, :status => 406
+                       return
+               end
+
                distribution = Distribution.find(:first, :conditions => ["name = ?", project_dist_name])
                project = Project.find(:first, :conditions => ["name = ? and distribution_id = ? and ptype = ?", project_name, distribution.id, project_type])
 
@@ -158,6 +167,7 @@ class AdminProjectController < ApplicationController
                project = Project.new
                project.name = project_name
                project.ptype = project_type
+               project.status = project_status
                project.password = project_password
                project.distribution_id = distribution.id
                #TODO: set project user is admin. admin user id is '1'
@@ -247,6 +257,7 @@ class AdminProjectController < ApplicationController
                dist_name = change_item[:Distribution]
                old_project_name = change_item[:Name]
                project_type = change_item[:ProjectType].upcase
+               project_status = change_item[:ProjectStatus].upcase
 
                if old_project_name.nil? or old_project_name.empty? then
                        errmsg = "Can't find [#{old_project_name}] information"
@@ -260,10 +271,17 @@ class AdminProjectController < ApplicationController
                        return
                end
 
+               if not project_status.eql? "OPEN" and not project_status.eql? "CLOSE"
+                       errmsg = "project status is invalid"
+                       render :json => { :error => errmsg }, :status => 406
+                       return
+               end
+
                distribution = Distribution.find(:first, :conditions => ["name = ?", dist_name])
                project = Project.find(:first, :conditions => ["name = ? and distribution_id = ? and ptype = ?", old_project_name, distribution.id, project_type])
                project.name = change_item[:NewProjectName]
                project.password = change_item[:ProjectPass]
+               project.status = project_status
 
                # remove project os and reset project os
                ProjectOs.delete_all(["project_id = ?", project.id])
@@ -303,4 +321,24 @@ class AdminProjectController < ApplicationController
                project.save
                render :json => { :success => "OK!" }
        end
+
+       def changeAllProjectStatus
+               change_group_list = params[:ChangeInfoList]
+               change_item = change_group_list[0]
+               errmsg = ""
+               
+               dist_name = change_item[:Distribution]
+               projectStatus = change_item[:ProjectStatus]
+
+               if projectStatus.nil? or not (projectStatus.eql? "OPEN" or projectStatus.eql? "CLOSE") then
+                       errmsg = "project status must be OPEN or CLOSE"
+                       render :json => { :error => errmsg }, :status => 406
+                       return
+               end
+
+               distribution = Distribution.find(:first, :conditions => ["name = ?", dist_name])
+               Project.update_all("status=\"#{projectStatus}\"", :distribution_id => distribution.id)
+
+               render :json => { :success => "OK!" }
+       end
 end
index 947b5e0973a4d196575aa9c53b71920e00967e74..21c5cc18e853988ea91d0d737757d758f08cdd61 100644 (file)
@@ -272,6 +272,7 @@ class ProjectsController < ApplicationController
                                                doc.supportedOs(os.name)
                                        end
                                end
+                               doc.DistributionStatus(distribution.status)
                        }
     
                        projects.each do |project|
@@ -280,6 +281,7 @@ class ProjectsController < ApplicationController
                                        if checkUserAccessProject(user_id, project.id)
                                                doc.BinaryProject {
                                                        doc.ProjectName(project.name)
+                                                       doc.ProjectStatus(project.status)
                                                        if not bin.nil? then
                                                                doc.PackageName(bin.pkg_name)
                                                        end
@@ -287,6 +289,7 @@ class ProjectsController < ApplicationController
                                        else
                                                doc.OtherBinaryProject {
                                                        doc.ProjectName(project.name)
+                                                       doc.ProjectStatus(project.status)
                                                        if not bin.nil? then
                                                                doc.PackageName(bin.pkg_name)
                                                        end
@@ -304,11 +307,13 @@ class ProjectsController < ApplicationController
                                        if checkUserAccessProject(user_id, project.id)
                                                doc.Project {
                                                        doc.ProjectName(project.name)
+                                                       doc.ProjectStatus(project.status)
                                                        doc.OsList(buildOsNameList.join(","))
                                                }
                                        else
                                                doc.OtherProject {
                                                        doc.ProjectName(project.name)
+                                                       doc.ProjectStatus(project.status)
                                                        doc.OsList(buildOsNameList.join(","))
                                                }
                                        end
index 679e46ae22d0b5fd7f65ae73efc928a2cf6f5a92..21c1c92dbb43fb325dbd7631997a7406895be510 100644 (file)
@@ -73,7 +73,7 @@ function adminDistributionModifyPopupInit() {
        if(serverStatusText.toUpperCase() == "CLOSE") {
                option = '<option value="CLOSE" selected="selected">CLOSE</option>';
        } else {
-               option = '<option value="CLOSE">FALSE</option>';
+               option = '<option value="CLOSE">CLOSE</option>';
        }
        $("#adminDistributionModify-status").append(option);
        $("#adminDistributionModify-status").selectmenu("refresh");
index 8aa5ddbc5c69c077c8838027c6c4505db0c46892..4ee55da506a6c6948df20a7cfeed03352d4202b6 100644 (file)
@@ -31,6 +31,14 @@ function adminProjectAddGitInit() {
        $("#adminProjectAddGit-password").val("");
        $("#adminProjectAddGit-address").val("");
        $("#adminProjectAddGit-branch").val("");
+       $("#adminProjectAddGit-status").empty();
+
+       var option; 
+       option = '<option value="OPEN" selected="selected">OPEN</option>';
+       $("#adminProjectAddGit-status").append(option);
+       option = '<option value="CLOSE">CLOSE</option>';
+       $("#adminProjectAddGit-status").append(option);
+       $("#adminProjectAddGit-status").selectmenu("refresh");
 
        queryAllOS( function (xml) {
                var osList = $(xml).find("Data").find("OsName");
@@ -55,6 +63,14 @@ function adminProjectAddBinaryInit() {
        $("#adminProjectAddBinary-name").val("");
        $("#adminProjectAddBinary-password").val("");
        $("#adminProjectAddBinary-packagename").val("");
+       $("#adminProjectAddBinary-status").empty();
+
+       var option; 
+       option = '<option value="OPEN" selected="selected">OPEN</option>';
+       $("#adminProjectAddBinary-status").append(option);
+       option = '<option value="CLOSE">CLOSE</option>';
+       $("#adminProjectAddBinary-status").append(option);
+       $("#adminProjectAddBinary-status").selectmenu("refresh");
 
        queryAllOS( function (xml) {
                var osList = $(xml).find("Data").find("OsName");
@@ -84,6 +100,7 @@ function adminProjectAddGitProject() {
        var password = $("#adminProjectAddGit-password").val();
        var address = $("#adminProjectAddGit-address").val();
        var branch = $("#adminProjectAddGit-branch").val();
+       var projectStatus = $("#adminProjectAddGit-status option:selected").val();
        var selectOsList = [];
 
        var selectArray = $("input[name='adminProjectAddGit-os-checkbox']");
@@ -98,7 +115,7 @@ function adminProjectAddGitProject() {
                return;
        }
 
-       changeInfoItem = {"Distribution":distName, "Name":name, "ProjectType":type, "ProjectPass":password, "Address":address, "Branch":branch, "OSNameList":selectOsList.toString()};
+       changeInfoItem = {"Distribution":distName, "Name":name, "ProjectType":type, "ProjectPass":password, "Address":address, "Branch":branch, "ProjectStatus":projectStatus, "OSNameList":selectOsList.toString()};
        changeInfoList.push(changeInfoItem);
        
        addProject(changeInfoList, function () {
@@ -114,6 +131,7 @@ function adminProjectAddBinaryProject() {
        var name = $("#adminProjectAddBinary-name").val();
        var password = $("#adminProjectAddBinary-password").val();
        var pkgName = $("#adminProjectAddBinary-packagename").val();
+       var projectStatus = $("#adminProjectAddBinary-status option:selected").val();
        var selectOsList = [];
 
        var selectArray = $("input[name='adminProjectAddBinary-os-checkbox']");
@@ -128,7 +146,7 @@ function adminProjectAddBinaryProject() {
                return;
        }
 
-       changeInfoItem = {"Distribution":distName, "Name":name, "ProjectType":type, "ProjectPass":password, "PackageName":pkgName, "OSNameList":selectOsList.toString()};
+       changeInfoItem = {"Distribution":distName, "Name":name, "ProjectType":type, "ProjectPass":password, "PackageName":pkgName, "ProjectStatus":projectStatus, "OSNameList":selectOsList.toString()};
        changeInfoList.push(changeInfoItem);
        
        addProject(changeInfoList, function () {
index 16930e2ce16a83cb8a0209ee342b0db2ee5ec844..338d83d2feb0e46b667569872e00bba841b00dd2 100644 (file)
@@ -29,14 +29,33 @@ Contributors:
 function adminProjectModifyBinaryProjectInit() {
        var projectName = localStorage.projectName;
        var packageName = $("#adminProject-binary-packageName-"+projectName).html();
+       var projectStatusText = $("#adminProject-binary-"+projectName+"-status").html();
 
        $("#adminProjectModifyBinary-oldName").val(projectName);
        $("#adminProjectModifyBinary-newName").val(projectName);
        $("#adminProjectModifyBinary-password").val("");
        $("#adminProjectModifyBinary-packageName").val(packageName);
+       $("#adminProjectModifyBinary-status").empty();
        $("#adminProjectModifyBinary-os").empty();
        $("#adminProjectModifyBinary-os").append("<legend> os list </legend>");
 
+       $("#adminProjectModifyBinary-status").empty();
+       var option; 
+       if(projectStatusText.toUpperCase() == "OPEN") {
+               option = '<option value="OPEN" selected="selected">OPEN</option>';
+       } else {
+               option = '<option value="OPEN">OPEN</option>';
+       }
+       $("#adminProjectModifyBinary-status").append(option);
+       
+       if(projectStatusText.toUpperCase() == "CLOSE") {
+               option = '<option value="CLOSE" selected="selected">CLOSE</option>';
+       } else {
+               option = '<option value="CLOSE">CLOSE</option>';
+       }
+       $("#adminProjectModifyBinary-status").append(option);
+       $("#adminProjectModifyBinary-status").selectmenu("refresh");
+
        queryAllOS( function (xml) {
                var osList = $(xml).find("Data").find("OsName");
                var selectedOsList = [];
@@ -72,14 +91,31 @@ function adminProjectModifyGitProjectInit() {
        var projectName = localStorage.projectName;
        var projectAddress = $("#adminProject-git-"+projectName+"-address").html();
        var projectBranch = $("#adminProject-git-"+projectName+"-branch").html();
+       var projectStatusText = $("#adminProject-git-"+projectName+"-status").html();
 
        $("#adminProjectModifyGit-oldName").val(projectName);
        $("#adminProjectModifyGit-newName").val(projectName);
        $("#adminProjectModifyGit-password").val("");
        $("#adminProjectModifyGit-address").val(projectAddress);
        $("#adminProjectModifyGit-branch").val(projectBranch);
+       $("#adminProjectModifyGit-status").empty();
        $("#adminProjectModifyGit-os").empty();
        $("#adminProjectModifyGit-os").append("<legend> os list </legend>");
+       var option; 
+       if(projectStatusText.toUpperCase() == "OPEN") {
+               option = '<option value="OPEN" selected="selected">OPEN</option>';
+       } else {
+               option = '<option value="OPEN">OPEN</option>';
+       }
+       $("#adminProjectModifyGit-status").append(option);
+       
+       if(projectStatusText.toUpperCase() == "CLOSE") {
+               option = '<option value="CLOSE" selected="selected">CLOSE</option>';
+       } else {
+               option = '<option value="CLOSE">CLOSE</option>';
+       }
+       $("#adminProjectModifyGit-status").append(option);
+       $("#adminProjectModifyGit-status").selectmenu("refresh");
 
        queryAllOS( function (xml) {
                var osList = $(xml).find("Data").find("OsName");
@@ -119,6 +155,7 @@ function adminProjectModfyBinaryProject() {
        var oldProjectName = $("#adminProjectModifyBinary-oldName").val();
        var newProjectName = $("#adminProjectModifyBinary-newName").val();
        var projectPassword = $("#adminProjectModifyBinary-password").val();
+       var projectStatus = $("#adminProjectModifyBinary-status option:selected").val();
        var packageName = $("#adminProjectModifyBinary-packageName").val();
        var selectOsList = [];
 
@@ -134,7 +171,7 @@ function adminProjectModfyBinaryProject() {
                return;
        }
                
-       changeInfoItem = {"Distribution":distName, "Name":oldProjectName, "NewProjectName":newProjectName, "ProjectType":"BINARY", "ProjectPass":projectPassword, "PackageName":packageName, "OSNameList":selectOsList.toString()};
+       changeInfoItem = {"Distribution":distName, "Name":oldProjectName, "NewProjectName":newProjectName, "ProjectType":"BINARY", "ProjectPass":projectPassword, "ProjectStatus":projectStatus, "PackageName":packageName, "OSNameList":selectOsList.toString()};
        changeInfoList.push(changeInfoItem);
 
        modifyProject(changeInfoList, function () {
@@ -151,6 +188,7 @@ function adminProjectModfyGitProject() {
        var projectPassword = $("#adminProjectModifyGit-password").val();
        var projectAddress = $("#adminProjectModifyGit-address").val();
        var projectBranch = $("#adminProjectModifyGit-branch").val();
+       var projectStatus = $("#adminProjectModifyGit-status option:selected").val();
        var selectOsList = [];
 
        var selectArray = $("input[name='adminProjectModifyGit-os-checkbox']");
@@ -165,7 +203,7 @@ function adminProjectModfyGitProject() {
                return;
        }
                
-       changeInfoItem = {"Distribution":distName, "Name":oldProjectName, "NewProjectName":newProjectName, "ProjectType":"GIT", "ProjectPass":projectPassword, "ProjectAddress":projectAddress, "ProjectBranch":projectBranch, "OSNameList":selectOsList.toString()};
+       changeInfoItem = {"Distribution":distName, "Name":oldProjectName, "NewProjectName":newProjectName, "ProjectType":"GIT", "ProjectPass":projectPassword, "ProjectAddress":projectAddress, "ProjectBranch":projectBranch, "ProjectStatus":projectStatus, "OSNameList":selectOsList.toString()};
        changeInfoList.push(changeInfoItem);
 
        modifyProject(changeInfoList, function () {
index f28ef05145cc49d30c43c209ce181c304591c198..b09953a04808f0eed27cbc405ced0957b922f6fe 100644 (file)
@@ -94,11 +94,12 @@ function adminProjectUpdateTable(projectList) {
        $("#adminProject-binary").empty();
 
        // Project table header
-       var tableHeader = "<tr><th>Project</th><th>Git repos</th><th>Branch</th><th>OS list</th><th>Modify</th><th>Delete</th>";
+       var tableHeader = "<tr><th>Project</th><th>Git repos</th><th>Branch</th><th>OS list</th><th>Status</th><th>Modify</th><th>Delete</th>";
        $("#adminProject-git").append(tableHeader);
 
        // Binary project table header
-       var tableHeader = "<tr><th>Project</th><th>Package name</th><th>OS list</th><th>Modify</th><th>Delete</th>";
+       var tableHeader = "<tr><th>Project</th><th>Package name</th><th>OS list</th><th>Status</th><th>Modify</th><th>Delete</th>";
+
        $("#adminProject-binary").append(tableHeader);
 
        var projectIdx = 1;
@@ -107,6 +108,7 @@ function adminProjectUpdateTable(projectList) {
        projectList.each(function(){
                var name = $(this).find("ProjectName").text();
                var type = $(this).find("Type").text();
+               var project_status = $(this).find("ProjectStatus").text();
                var osList = $(this).find("OS");
 
                if(type.toUpperCase() == "GIT")
@@ -132,6 +134,10 @@ function adminProjectUpdateTable(projectList) {
                        div = adminProjectApendOsCell(osList, name, "GIT");
                        cell.appendChild(div);
 
+                       cell = row.insertCell(-1);
+                       cell.setAttribute('id',"adminProject-git-"+name+"-status");
+                       cell.innerHTML = project_status;
+
                        cell = row.insertCell(-1);
                        var button = document.createElement('a');
                        button.setAttribute('href','#adminProjectModifyGit');
@@ -146,7 +152,6 @@ function adminProjectUpdateTable(projectList) {
                        cell = row.insertCell(-1);
                        var button = document.createElement('input');
                        button.setAttribute('type','button');
-                       button.setAttribute('id','button:git:'+projectIdx+':'+name);
                        button.setAttribute('data-mini','true');
                        button.setAttribute('name',name);
                        button.setAttribute('class','binaryProjectTableButton');
@@ -173,6 +178,10 @@ function adminProjectUpdateTable(projectList) {
                        div = adminProjectApendOsCell(osList, name, "BINARY");
                        cell.appendChild(div);
 
+                       cell = row.insertCell(-1);
+                       cell.setAttribute('id',"adminProject-binary-"+name+"-status");
+                       cell.innerHTML = project_status;
+
                        cell = row.insertCell(-1);
                        var button = document.createElement('a');
                        button.setAttribute('href','#adminProjectModifyBinary');
@@ -233,4 +242,21 @@ function adminProjectApendOsCell(osList, projectName, projectType) {
        return div;
 }
 
+function adminProjectAllProjectStatusChange(projectStatus) {
+       var distName = $("#adminProject-distribution-select option:selected").val();
+       var changeInfoList = [];
+       var changeInfoItem;
+
+       var r=confirm("All project status is changed to "+projectStatus+"!!!");
+       if (r==false)
+       {
+               return;
+       }
 
+       changeInfoItem = {"Distribution":distName, "ProjectStatus":projectStatus}
+       changeInfoList.push(changeInfoItem);
+
+       changeAllProjectStatus(changeInfoList, function () {
+               $.mobile.changePage("#adminProject"); 
+       });
+}
index c41f888e52b8b0b31411242e16aa5c6ba5728530..671dc8375457c404a7f5ad51fa1d9c75fe0e350e 100644 (file)
@@ -68,6 +68,7 @@ function adminUserFillTable(userList) {
                button.setAttribute('href','#adminUserModify');
                button.setAttribute('data-role','button');
                button.setAttribute('data-rel','dialog');
+               button.setAttribute('data-mini','ture');
                button.setAttribute('class','adminUser-contentsButton');
                button.setAttribute('onClick','adminUserModifySetup('+userId+')');
                button.innerHTML = " "
@@ -77,6 +78,7 @@ function adminUserFillTable(userList) {
                var button = document.createElement('input');
                button.setAttribute('type','button');
                button.setAttribute('name',email);
+               button.setAttribute('data-mini','ture');
                button.setAttribute('class','adminUser-contentsButton');
                button.setAttribute('onClick','adminUserRemoveUser('+userId+')');
                cell.appendChild(button);
index f204833721813323af13abadc77fd58b079b0178..781f9f6e34af3ec0fab7e640681f57715ac3ac4c 100644 (file)
@@ -68,10 +68,21 @@ function buildQueryProjectList() {
                $("#build-binary-table").empty();
                
                var xmlBody = $(xml).find("Data");
+               var distributionStatus = xmlBody.find("BuildServerInfo").find("DistributionStatus").text();
+               if (distributionStatus == "CLOSE") {
+                       var distributionLock = document.getElementById("build-distribution-lock");
+                       distributionLock.innerHTML = '<p> Distribution is locked </p>';
+               } else {
+                       var distributionLock = document.getElementById("build-distribution-lock");
+                       distributionLock.innerHTML = '';
+               }
+
                buildAddTableRow( xmlBody.find("BuildServerInfo").find("supportedOs"),
+                                        distributionStatus,
                                         xmlBody.find("Project"),
                                         xmlBody.find("OtherProject"));
-               buildAddBinaryTableRow( xmlBody.find("BinaryProject"),
+               buildAddBinaryTableRow( distributionStatus,
+                                        xmlBody.find("BinaryProject"),
                                         xmlBody.find("OtherBinaryProject"));
        });
 }
@@ -117,7 +128,7 @@ function contains(a, obj) {
        return false; 
 }
 
-function buildAddTableRow(supportedOs, projectList, otherProjectList) {
+function buildAddTableRow(supportedOs, distributionStatus, projectList, otherProjectList) {
        // Table header
        var idx = 0;
        var tableHeader = "";
@@ -142,8 +153,9 @@ function buildAddTableRow(supportedOs, projectList, otherProjectList) {
 
        projectList.each(function(){
                var name = $(this).find("ProjectName").text();
-               var osLists = $(this).find("OsList").text();
-               var osList = osLists.split(",");
+               var projectOsArray = $(this).find("OsList").text().split(",");
+               var projectStatus = $(this).find("ProjectStatus").text();
+               var buildAvailable = true;
        
                var row = projectTable.insertRow(-1);
                
@@ -152,40 +164,11 @@ function buildAddTableRow(supportedOs, projectList, otherProjectList) {
                cell.setAttribute('bgcolor', '#dcddc0');
                cell.innerHTML = name;
                
-               for (i=0;i<osArray.length;i++)
-               {
-                       var cell = row.insertCell(-1);
-                       var os = osArray[i];
-       
-                       cell.setAttribute('id', "buildGitProjectTable"+":"+name+":"+os);
-                       cell.setAttribute('style', 'text-align: center');
-                       cell.setAttribute('bgcolor', '#dcddc0');
-       
-                       var buttonnode = document.createElement('input');
-                       buttonnode.setAttribute('type','checkbox');
-                       buttonnode.setAttribute('id',"table"+":"+name+':'+os);
-                       buttonnode.setAttribute('name','projectBuildCheckbox'+":"+name);
-                       buttonnode.setAttribute('class','projectTableBuildButton');
-                       cell.appendChild(buttonnode);
-
-                       if(!contains(osList, os))
-                       {
-                               buttonnode.setAttribute('disabled','disabled');
-                       }
+               if (distributionStatus == "CLOSE" || projectStatus == "CLOSE")  {
+                       buildAvailable = false;
                }
-       
-               /* append all checkbox */
-               var cell = row.insertCell(-1);
-               cell.setAttribute('style', 'text-align: center');
-               cell.setAttribute('bgcolor', '#dcddc0');
-       
-               var buttonnode = document.createElement('input');
-               buttonnode.setAttribute('type','checkbox');
-               buttonnode.setAttribute('id','projectBuildCheckbox'+":"+name);
-               buttonnode.setAttribute('name','all-checkbox');
-               buttonnode.setAttribute('class','projectTableAllButton');
-               buttonnode.setAttribute('onClick','buildSelectAll(this)');
-               cell.appendChild(buttonnode);
+
+               buildAddBinaryTableCell(name, osArray, projectOsArray, buildAvailable, row);
        });
 
        otherProjectList.each(function(){
@@ -197,25 +180,11 @@ function buildAddTableRow(supportedOs, projectList, otherProjectList) {
                cell.setAttribute('bgcolor', '#c0c0c0');
                cell.innerHTML = name;
        
-               /* add empty cell for status */
-               for (i=0;i<osArray.length;i++)
-               {
-                       cell = row.insertCell(-1);
-                       cell.setAttribute('id', "table"+":"+name+"-"+osArray[i]);
-                       cell.setAttribute('style', 'text-align: left');
-                       cell.setAttribute('bgcolor', '#c0c0c0');
-                       cell.innerHTML = ""; 
-               }
-       
-               /* add empty cell for all*/
-               cell = row.insertCell(-1);
-               cell.setAttribute('style', 'text-align: left');
-               cell.setAttribute('bgcolor', '#c0c0c0');
-               cell.innerHTML = "";
+               buildAddBinaryTableCell(name, osArray, "", false, row);
        });
 }
 
-function buildAddBinaryTableRow(binaryProjectList, otherProjectList) {
+function buildAddBinaryTableRow(distributionStatus, binaryProjectList, otherProjectList) {
        var binaryProjectTable = document.getElementById("build-binary-table");
        var row = binaryProjectTable.insertRow(-1);
        var thCell = document.createElement('th');
@@ -232,9 +201,14 @@ function buildAddBinaryTableRow(binaryProjectList, otherProjectList) {
        binaryProjectList.each(function(){
                var name =  $(this).find("ProjectName").text();
                var packageName =  $(this).find("PackageName").text();
+               var projectStatus = $(this).find("ProjectStatus").text();
                var row = '<tr><td bgcolor="#dcddc0" style="text-align:left">'+name+'</td>';
                row += '<td bgcolor="#dcddc0" style="text-align:left">' + packageName + '</td>'
-               row += '<td bgcolor="#dcddc0" style="text-align:left"><a href="upload.html" onClick="buildUploadBinaryName(\'' +name+'\')" class="binary_project_button" data-role="button" data-ajax="false" data-mini="true">REGISTER</a>';
+               if (distributionStatus == "CLOSE" || projectStatus == "CLOSE")  {
+                       row += '<td bgcolor="#c0c0c0" style="text-align:left"></td>';
+               } else {
+                       row += '<td bgcolor="#dcddc0" style="text-align:left"><a href="upload.html" onClick="buildUploadBinaryName(\'' +name+'\')" class="binary_project_button" data-role="button" data-ajax="false" data-mini="true">REGISTER</a>';
+               }
                row += '</tr>'
                
                $("#build-binary-table tr:last").after(row);
@@ -273,6 +247,58 @@ function buildAddBinaryTableRow(binaryProjectList, otherProjectList) {
        });
 }
 
+function buildAddBinaryTableCell(projectName, osArray, projectOsArray, buildAvailable, row) {
+       for (i=0;i<osArray.length;i++)
+       {
+               var cell = row.insertCell(-1);
+               var os = osArray[i];
+       
+               cell.setAttribute('id', "buildGitProjectTable"+":"+projectName+":"+os);
+               cell.setAttribute('style', 'text-align: center');
+               if (buildAvailable) {
+                       /* add cell with build checkbox */
+                       cell.setAttribute('bgcolor', '#dcddc0');
+           
+                       var buttonnode = document.createElement('input');
+                       buttonnode.setAttribute('type','checkbox');
+                       buttonnode.setAttribute('id',"table"+":"+projectName+':'+os);
+                       buttonnode.setAttribute('name','projectBuildCheckbox'+":"+projectName);
+                       buttonnode.setAttribute('class','projectTableBuildButton');
+                       cell.appendChild(buttonnode);
+            
+                       if(!contains(projectOsArray, os))
+                       {
+                               buttonnode.setAttribute('disabled','disabled');
+                       }
+               } else {
+                       /* add empty cell for status */
+                       cell.setAttribute('bgcolor', '#c0c0c0');
+                       cell.innerHTML = ""; 
+               }
+       }
+
+       if (buildAvailable) {
+               /* append all checkbox */
+               var cell = row.insertCell(-1);
+               cell.setAttribute('style', 'text-align: center');
+               cell.setAttribute('bgcolor', '#dcddc0');
+               
+               var buttonnode = document.createElement('input');
+               buttonnode.setAttribute('type','checkbox');
+               buttonnode.setAttribute('id','projectBuildCheckbox'+":"+projectName);
+               buttonnode.setAttribute('name','all-checkbox');
+               buttonnode.setAttribute('class','projectTableAllButton');
+               buttonnode.setAttribute('onClick','buildSelectAll(this)');
+               cell.appendChild(buttonnode);
+       } else {
+               /* add empty cell for all*/
+               cell = row.insertCell(-1);
+               cell.setAttribute('style', 'text-align: left');
+               cell.setAttribute('bgcolor', '#c0c0c0');
+               cell.innerHTML = "";
+       }
+}
+
 function buildBuildProject() {
        var distName = $("#build-distribution-select option:selected").val();
        var buildProjectList = [];
index 4cbee8ba3a7150b2f84c555edb6baaeb4df952be..430f0e683bd3341ff3a06b8162dc941e5bec93b5 100644 (file)
@@ -245,6 +245,11 @@ function modifyProject(changeInfoList, successFunction) {
        postForServer(url, changeInfoList, successFunction);
 }
 
+function changeAllProjectStatus(changeInfoList, successFunction) {
+       var url = 'admin_project/changeAllProjectStatus';
+       postForServer(url, changeInfoList, successFunction);
+}
+
 // controller : admin_distribution
 function queryDistributionInfo(distName, successFunction) {
        var url = 'admin_distribution/queryDistributionInfo/' + distName;