diff --git a/src/web/WEB-INF/contest-details2.jsp b/src/web/WEB-INF/contest-details2.jsp index 9a2f23a23..0ecd42a51 100644 --- a/src/web/WEB-INF/contest-details2.jsp +++ b/src/web/WEB-INF/contest-details2.jsp @@ -1,6 +1,6 @@ <%-- - Author: BeBetter, isv, GreatKevin, Ghost_141, Veve, TCSCODER - - Version: 1.13 + - Version: 1.11 - Copyright (C) 2010 - 2017 TopCoder Inc., All Rights Reserved. - - Description: Contest Detail page @@ -32,8 +32,6 @@ - - Add CANCEL and CLOSE button on active private challenge - Version 1.12 (TOPCODER - SUPPORT TYPEAHEAD FOR TASK ASSIGNEES IN DIRECT APP): - - Split jquery import to other file - - Version 1.13 (TOPCODER - IMPROVE USER MANAGEMENT BEHAVIOR FOR PROJECT PERMISSIONS & NOTIFICATIONS) - - - Move redundant code --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ include file="/WEB-INF/includes/taglibs.jsp" %> @@ -42,6 +40,9 @@ + + + + +
+
+
+
+
+ Add Users To Permission List + Close +
+
+
+ + + +
+
+
+ +
+

Users

+ Select All +
+ + + + + +
+
    + +
+
+ +
+
+ Add +
+
+ +
+

Existing Users

+
+ + +
+
    + +
+
+ +
+
+
+
+ SAVE + CANCEL +
+
+
+ + +
+
+
+
+
+ +
+
+ +
diff --git a/src/web/WEB-INF/launch-contest.jsp b/src/web/WEB-INF/launch-contest.jsp index 94837956e..aa3803005 100644 --- a/src/web/WEB-INF/launch-contest.jsp +++ b/src/web/WEB-INF/launch-contest.jsp @@ -1,6 +1,6 @@ <%-- - Author: bugbuka, TCSCODER - - Version: 1.5 + - Version: 1.4 - Copyright (C) 2011 - 2017 TopCoder Inc., All Rights Reserved. - - Description: This page provides function of creating project in dashboard. @@ -15,9 +15,6 @@ - - Version 1.4 (TOPCODER - SUPPORT TYPEAHEAD FOR TASK ASSIGNEES IN DIRECT APP): - - Split jquery import to other file - - - - Version 1.5 (TOPCODER - IMPROVE USER MANAGEMENT BEHAVIOR FOR PROJECT PERMISSIONS & NOTIFICATIONS) - - - Move redundant code --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ include file="/WEB-INF/includes/taglibs.jsp" %> @@ -26,6 +23,9 @@ + + + diff --git a/src/web/css/direct/editProject.css b/src/web/css/direct/editProject.css index ccbe62ea0..2dee8528d 100644 --- a/src/web/css/direct/editProject.css +++ b/src/web/css/direct/editProject.css @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 - 2017 TopCoder Inc., All Rights Reserved. + * Copyright (C) 2011 - 2014 TopCoder Inc., All Rights Reserved. * * This css used to render edit project page. * @@ -21,11 +21,8 @@ * Version 1.6 (TC Direct Rebranding Assembly Project and Contest related pages) * - Rebranding the edit direct project page * - * Version 1.7 (TOPCODER - IMPROVE USER MANAGEMENT BEHAVIOR FOR PROJECT PERMISSIONS & NOTIFICATIONS) - * - Add style for magicsuggest control - * - * Author: GreatKevin, Ghost_141, TCSASSEMBLER, TCSCODER - * Version 1.7 + * Author: GreatKevin, Ghost_141, TCSASSEMBLER + * Version 1.6 */ .editPage #header .logo { font-size: 18px; @@ -2387,21 +2384,3 @@ a.saveSetting:hover, border-bottom: 3px solid #81bc02; } -.permissionsNotifications .userInputRow{ - border: 1px solid #CCC; - border-radius: 4px; - margin-bottom: 10px; - width: 372px; -} - -.permissionsNotifications .ms-stacked{ - display: none; -} - -.permissionsNotifications td sup{ - background-color: #ff0001; - color: #fff; - border-radius: 4px; - padding: 0px 2px 1px 2px; - margin-left: 5px; -} \ No newline at end of file diff --git a/src/web/scripts/editCockpitProject.js b/src/web/scripts/editCockpitProject.js index 730f5ab83..413bf8793 100644 --- a/src/web/scripts/editCockpitProject.js +++ b/src/web/scripts/editCockpitProject.js @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 - 2017 TopCoder Inc., All Rights Reserved. + * Copyright (C) 2011 - 2015 TopCoder Inc., All Rights Reserved. * * The JS script for edit project page.. * @@ -43,11 +43,8 @@ * Version 2.9 (TC Direct - Update Edit Project Budget Controls) * - Update the slider control to allow input box to input exact value * - * Version 2.10 (TOPCODER - IMPROVE USER MANAGEMENT BEHAVIOR FOR PROJECT PERMISSIONS & NOTIFICATIONS) - * - Project permission and notiification move to use magicsuggest - * - * @author GreatKevin, Ghost_141, GreatKevin, freegod, TCSASSEMBLER, TCSCODER - * @version 2.10 + * @author GreatKevin, Ghost_141, GreatKevin, freegod, TCSASSEMBLER + * @version 2.9 */ Date.format = 'mm/dd/yyyy'; @@ -272,65 +269,60 @@ $(document).ready(function (e) { //scroll + $('#addUserModal .addUserForm .addUserLeft .addUserList').css('overflow-y','scroll'); $('#addGroupModal .addUserForm .addUserLeft .addUserList').css('overflow-y','scroll'); ///////////////// START: Add user permission modal - jQuery_1_11_1("#permissionsNotificationsInput").magicSuggest({ - placeholder: "To add new user, type user's handle here", - allowFreeEntries: false, - hideTrigger: true, - selectionStacked: true, - selectionPosition: 'bottom', - selectionRenderer: function(data){ - //add to table - var currentList = $(".permissionsNotifications tbody tr td a.useName").map(function(){return $(this).text()}).get(); - if ($.inArray(data.name, currentList) < 0) { - var oddClass = $('.permissionsNotifications table tbody tr').length % 2 == 0 ? "" : "odd"; - var item = '' + data.name - + 'new
SettingRemove' - - $('.permissionsNotifications table tbody').append(item); - } - return data.name; - }, - data: function (q) { - var members = []; - var currentList = $(".permissionsNotifications tbody tr td a.useName").map(function(){return $(this).text()}).get(); - if (typeof(q) === 'string' && q.length > 0) { - $.ajax({ - type: 'GET', - url: member_api_url, - cache: false, - dataType: 'json', - contentType: 'application/json; charset=utf-8', - data: {'handle': q}, - async: false, - success: function (result) { - $.each(result['result']['content'], function (index, member) { - if ($.inArray(member['handle'], currentList) < 0){ - members.push({'id': member['userId'].toString(), 'name': member['handle']}); - } + var currentUserPermissionModalCache = {}; + + $("#addUser").click(function(){ + modalLoad('#' + $(this).attr('name')); + var modal = $("#addUserModal"); + modal.find(".searchBox input").val(''); + var leftSide = modal.find('.addUserLeft ul'); + leftSide.find('li').remove(); + modal.find('.addUserRight .addUserList ul li').remove(); + + // pre-populate the left side of the modal + $(".permissionsNotifications td.permissionUser").each(function () { + var handle = $(this).find("a").text(); + var userId = $(this).find("input").val(); + var entry = {}; + entry.name = handle; + entry.id = userId; + currentUserPermissionModalCache[userId] = entry; + + modal.find('.addUserRight .addUserList ul').append($('
  • ' + handle + '
  • ')); + var lis = $('li:contains(' + handle + ')', leftSide); + lis.remove(); + }); + }); - }, - error: function () { - throw("Problem getting members"); - } - }) + + $("#addUserModal .saveButton").click(function () { + for (var i = 0; i < $('#addUserModal .addUserRight li').length; i++) { + var handle = $('#addUserModal .addUserRight li').eq(i).text(); + var userId = $('#addUserModal .addUserRight li').eq(i).attr('name'); + + if(currentUserPermissionModalCache[userId] == null) { + $('.permissionsNotifications table tbody').append('' + handle + + '
    SettingRemove'); } - return members.sort(function (A, B){ - var a = A.name.toLowerCase(); - var b = B.name.toLowerCase(); - return a < b ? -1 : ((a > b) ? 1 : 0); - }); + } + + $('.permissionsNotifications tbody tr').removeClass('odd'); + $('.permissionsNotifications tbody tr:odd').addClass('odd'); + modalAllClose(); }); + ///////////////// END: Add user permission modal $("#addGroup").click(function () { modalLoad('#' + $(this).attr('name')); @@ -427,8 +419,6 @@ $(document).ready(function (e) { handleJsonResult( jsonResult, function (result) { - $(".permissionsNotifications tbody tr td sup").remove(); - jQuery_1_11_1("#permissionsNotificationsInput").magicSuggest().clear(); showSuccessfulMessage("Project Permissions and Notifications are successfully updated.") }, function (errorMessage) { @@ -443,16 +433,6 @@ $(document).ready(function (e) { // remove user permission from project $(".permissionsNotifications a.remove").live('click', function(){ var row = $(this).parents("tr"); - var isNew = row.find("td sup").length > 0 ? true : false; - if (isNew){ - var removedItem = {'id': row.find("td.permissionUser input").val(), - 'name': row.find("td.permissionUser a.useName").text()} - jQuery_1_11_1("#permissionsNotificationsInput").magicSuggest().removeFromSelection(removedItem, true); - row.remove(); - $('.permissionsNotifications tbody tr').removeClass('odd'); - $('.permissionsNotifications tbody tr:odd').addClass('odd'); - return false; - } var formData = {}; formData.projectId = $("input[name='editProjectId']").val(); formData.projectPermissions = []; diff --git a/src/web/scripts/launch/entity.js b/src/web/scripts/launch/entity.js index 699eadca8..1af66e93c 100644 --- a/src/web/scripts/launch/entity.js +++ b/src/web/scripts/launch/entity.js @@ -64,11 +64,8 @@ * Version 1.9 (Module Assembly - TC Direct Studio Design First2Finish Challenge Type) * - Add new Design First2Finish contest to studio group * - * Version 1.10(TOPCODER - IMPROVE USER MANAGEMENT BEHAVIOR FOR PROJECT PERMISSIONS & NOTIFICATIONS) - * - Refactor constant for copilot posting - * - * @author duxiaoyang, bugbuka, GreatKevin, TCSCODER - * @version 1.10 + * @author duxiaoyang, bugbuka, GreatKevin + * @version 1.9 */ if(!com) { var com = {}; @@ -193,7 +190,6 @@ var STUDIO_CATEGORY_ID_DESIGN_F2F = 40; var SOFTWARE_CATEGORY_ID_BUG_HUNT = 9; var ALGORITHM_CATEGORY_ID_MARATHON = 37; var STUDIO_IDEA_GENERATION = 22; -var COPILOT_POSTING = 29; var DRAFT_STATUS = "Draft"; var ACTIVE_STATUS = "Active"; @@ -213,7 +209,7 @@ var projectCategoryArray = [ {id:SOFTWARE_CATEGORY_ID_ASSEMBLY, name:'SOFTWARE ASSEMBLY', label:'Software Assembly', typeId:2, typeName:'Application', hasMulti:true, hideInDropdown: false}, {id:13, name:'TESTSUITES', label:'Test Suites', typeId:2, typeName:'Application', hasMulti:true, hideInDropdown: false}, {id:26, name:'TESTSCENARIOS', label:'Test Scenarios', typeId:2, typeName:'Application', hasMulti:true, hideInDropdown: true}, - {id:COPILOT_POSTING, name:'Copilot Posting', label:'Copilot Posting', typeId:2, typeName:'Application', hasMulti:false, hideInDropdown: true}, + {id:29, name:'Copilot Posting', label:'Copilot Posting', typeId:2, typeName:'Application', hasMulti:false, hideInDropdown: true}, {id:SOFTWARE_CATEGORY_ID_CONTENT, name:'Content Creation', label:'Content Creation', typeId:2, typeName:'Application', hasMulti:true, hideInDropdown: true}, {id:17, name:'Web Design', label:'Web Design', typeId:3, typeName:'Studio', hasMulti:true, hideInDropdown: false}, {id:STUDIO_CATEGORY_ID_DESIGN_F2F, name:'Design First2Finish', label:'Design First2Finish', typeId:3, typeName:'Studio', hasMulti:false, hideInDropdown: false}, diff --git a/src/web/scripts/launch/main.js b/src/web/scripts/launch/main.js index ffaaf56df..72e2898ed 100644 --- a/src/web/scripts/launch/main.js +++ b/src/web/scripts/launch/main.js @@ -121,11 +121,8 @@ * Version 4.2 (TOPCODER - SUPPORT TYPEAHEAD FOR TASK ASSIGNEES IN DIRECT APP): * - Move task assign member to use magicSuggest * - * Version 4.3 (TOPCODER - IMPROVE USER MANAGEMENT BEHAVIOR FOR PROJECT PERMISSIONS & NOTIFICATIONS) - * - Exclude copilot posting on #technologyAndPlatformSelectsChanged - * * @author isv, GreatKevin, bugbuka, GreatKevin, Veve, TCSCODER, TCSASSEMBER - * @version 4.3 + * @version 4.2 */ /** @@ -3382,14 +3379,6 @@ function isDesignType(categoryId) { return (getProjectCategoryById(categoryId).typeName == 'Studio'); } -function isCopilotPosting(categoryId) { - if(mainWidget.softwareCompetition.projectHeader.projectCategory) { - categoryId = mainWidget.softwareCompetition.projectHeader.projectCategory.id; - } - - return (categoryId == COPILOT_POSTING); -} - function isDevelopmentType(categoryId) { if(mainWidget.softwareCompetition.projectHeader.projectCategory) { categoryId = mainWidget.softwareCompetition.projectHeader.projectCategory.id; @@ -3547,17 +3536,13 @@ function sortByname(A, B){ function technologyAndPlatformSelectsChanged() { var hasJavaTech = false; - var hasSalesforcePlatform = false; - if (isCopilotPosting()){ - return {hasJavaTech: hasJavaTech, hasSalesforcePlatform: hasSalesforcePlatform}; - } - var selectedTechnologies = jQuery_1_11_1("#technologies").magicSuggest().getSelection(); $(selectedTechnologies).each(function (val, i) { if (val.name == 'Java') hasJavaTech=true; }); + var hasSalesforcePlatform = false; var selectedPlatforms = jQuery_1_11_1("#platforms").magicSuggest().getSelection(); $(selectedPlatforms).each(function (val, i) { if (val.name == 'Salesforce.com')