{"action":"created","comment":{"url":"https://api.github.com/repos/TEAMMATES/repo/pulls/comments/52266568","id":52266568,"diff_hunk":"@@ -0,0 +1,119 @@\n+function createRowForResultTable(shortName, name, email, institution, isSuccess, status) {\n+    var result = \"<td>\" + shortName + \"</td>\";\n+    result += \"<td>\" + name + \"</td>\";\n+    result += \"<td>\" + email + \"</td>\";\n+    result += \"<td>\" + institution + \"</td>\";\n+    if (isSuccess) {\n+        result += \"<td>Success</td>\";\n+    } else {\n+        result += \"<td>Fail</td>\";\n+    }\n+    result += \"<td>\" + status + \"</td>\";\n+    if (isSuccess) {\n+        result = \"<tr class=\\\"success\\\">\" + result + \"</tr>\";\n+    } else {\n+        result = \"<tr class=\\\"danger\\\">\" + result + \"</tr>\";\n+    }\n+    return result;\n+}\n+\n+var paramsCounter = 0;\n+var paramsList = [];    // list of parameter strings that will be sent via ajax\n+var instructorDetailsList = [];\n+var isInputFromFirstPanel = false;\n+\n+function disableAddInstructorForm() {\n+    $(\".addInstructorBtn\").each(function() {\n+        $(this).html(\"<img src='/images/ajax-loader.gif'/>\");\n+    });\n+    $(\".addInstructorFormControl\").each(function() {\n+        $(this).prop('disabled', true);\n+    });\n+    \n+}\n+\n+function enableAddInstructorForm() {\n+    $(\".addInstructorBtn\").each(function() {\n+        $(this).html(\"Add Instructor\");\n+    });\n+    $(\".addInstructorFormControl\").each(function() {\n+        $(this).prop('disabled', false);\n+    });\n+}\n+\n+function addInstructorByAjaxRecursively() {\n+    $.ajax({\n+        type : 'POST',\n+        url :   \"/admin/adminInstructorAccountAdd?\" + paramsList[paramsCounter],\n+        beforeSend : function() {\n+            disableAddInstructorForm();\n+        },\n+        error : function() {\n+            var rowText = createRowForResultTable(\"\", \"\", \"\", \"\", false, \"Cannot send Ajax Request!\");\n+            $(\"#addInstructorResultTable tbody\").append(rowText);\n+            if (isInputFromFirstPanel) {\n+                var errorInstructorsText = $(\"#addInstructorDetailsSingleLine\").val() + instructorDetailsList[paramsCounter] + \"\\n\";\n+                $(\"#addInstructorDetailsSingleLine\").val(errorInstructorsText);\n+            }\n+            paramsCounter++;\n+            var panelHeader = \"<strong>Result (\" + paramsCounter + \"/\" + paramsList.length + \")</strong>\";\n+            $(\"#addInstructorResultPanel div.panel-heading\").html(panelHeader);\n+            if (paramsCounter < paramsList.length) {\n+                addInstructorByAjaxRecursively();\n+            } else {\n+                enableAddInstructorForm();\n+            }\n+        },\n+        success : function(data) {\n+            var rowText = createRowForResultTable(data.instructorShortName, data.instructorName, \n+                                                  data.instructorEmail,data.instructorInstitution,\n+                                                  data.instructorAddingResultForAjax, data.statusForAjax);\n+            $(\"#addInstructorResultTable tbody\").append(rowText);\n+            if ((!data.instructorAddingResultForAjax) && (isInputFromFirstPanel)) {\n+                var errorInstructorsText = $(\"#addInstructorDetailsSingleLine\").val() + instructorDetailsList[paramsCounter] + \"\\n\";\n+                $(\"#addInstructorDetailsSingleLine\").val(errorInstructorsText);\n+            }\n+            paramsCounter++;\n+            var panelHeader = \"<strong>Result (\" + paramsCounter + \"/\" + paramsList.length + \")</strong>\";\n+            $(\"#addInstructorResultPanel div.panel-heading\").html(panelHeader);\n+            if (paramsCounter < paramsList.length) {\n+                addInstructorByAjaxRecursively();\n+            } else {\n+                enableAddInstructorForm();\n+            }\n+        }\n+    });\n+}\n+\n+function addInstructorByAjax() {\n+    $(\"#addInstructorResultPanel\").show();    // show the hidden panel\n+    \n+    var multipleLineText = $(\"#addInstructorDetailsSingleLine\").val();    // get input from the first panel\n+    multipleLineText = multipleLineText.trim();\n+    \n+    if (multipleLineText.length == 0) {\n+        var instructorDetails = $(\"#instructorName\").val() + \"|\" + $(\"#instructorEmail\").val() + \"|\" + $(\"#instructorInstitution\").val();\n+        instructorDetailsList = [instructorDetails];\n+        var params = \"instructorshortname=\" + $(\"#instructorShortName\").val() +\n+                     \"&instructorname=\" + $(\"#instructorName\").val() +\n+                     \"&instructoremail=\" + $(\"#instructorEmail\").val() +\n+                     \"&instructorinstitution=\" + $(\"#instructorInstitution\").val();\n+        paramsList = [params];\n+        isInputFromFirstPanel = false;\n+    } else {\n+        instructorDetailsList = multipleLineText.split(\"\\n\");\n+        paramsList = [];\n+        for(var i = 0; i < instructorDetailsList.length; i++) {\n+            instructorDetailsList[i] = instructorDetailsList[i].replace(/\\t/g,\"|\");\n+            paramsList[i] = \"instructordetailssingleline=\" + instructorDetailsList[i];\n+        }\n+        isInputFromFirstPanel = true;\n+    }\n+    paramsCounter = 0;\n+    $(\"#addInstructorResultTable tbody\").html(\"\");    // clear table","path":"src/main/webapp/js/adminHome.js","position":113,"original_position":113,"commit_id":"a83794cd5a320a9084fcc1f4989532cb3fcba141","original_commit_id":"2bbb0966cae0d99e024d8c66fc24763d602931e3","user":{"login":"thyageshm","id":5160137,"avatar_url":"https://avatars.githubusercontent.com/u/5160137?v=3","gravatar_id":"","url":"https://api.github.com/users/thyageshm","html_url":"https://github.com/thyageshm","followers_url":"https://api.github.com/users/thyageshm/followers","following_url":"https://api.github.com/users/thyageshm/following{/other_user}","gists_url":"https://api.github.com/users/thyageshm/gists{/gist_id}","starred_url":"https://api.github.com/users/thyageshm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thyageshm/subscriptions","organizations_url":"https://api.github.com/users/thyageshm/orgs","repos_url":"https://api.github.com/users/thyageshm/repos","events_url":"https://api.github.com/users/thyageshm/events{/privacy}","received_events_url":"https://api.github.com/users/thyageshm/received_events","type":"User","site_admin":false},"body":"@damithc sir what is your preference?","created_at":"2016-02-09T04:27:59Z","updated_at":"2016-02-09T04:27:59Z","html_url":"https://github.com/TEAMMATES/repo/pull/4654#discussion_r52266568","pull_request_url":"https://api.github.com/repos/TEAMMATES/repo/pulls/4654","_links":{"self":{"href":"https://api.github.com/repos/TEAMMATES/repo/pulls/comments/52266568"},"html":{"href":"https://github.com/TEAMMATES/repo/pull/4654#discussion_r52266568"},"pull_request":{"href":"https://api.github.com/repos/TEAMMATES/repo/pulls/4654"}}},"pull_request":{"url":"https://api.github.com/repos/TEAMMATES/repo/pulls/4654","id":56807438,"html_url":"https://github.com/TEAMMATES/repo/pull/4654","diff_url":"https://github.com/TEAMMATES/repo/pull/4654.diff","patch_url":"https://github.com/TEAMMATES/repo/pull/4654.patch","issue_url":"https://api.github.com/repos/TEAMMATES/repo/issues/4654","number":4654,"state":"open","locked":false,"title":"Admin create instructor page: the form allows adding multiple instructors #4641","user":{"login":"bamboo3250","id":8078323,"avatar_url":"https://avatars.githubusercontent.com/u/8078323?v=3","gravatar_id":"","url":"https://api.github.com/users/bamboo3250","html_url":"https://github.com/bamboo3250","followers_url":"https://api.github.com/users/bamboo3250/followers","following_url":"https://api.github.com/users/bamboo3250/following{/other_user}","gists_url":"https://api.github.com/users/bamboo3250/gists{/gist_id}","starred_url":"https://api.github.com/users/bamboo3250/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bamboo3250/subscriptions","organizations_url":"https://api.github.com/users/bamboo3250/orgs","repos_url":"https://api.github.com/users/bamboo3250/repos","events_url":"https://api.github.com/users/bamboo3250/events{/privacy}","received_events_url":"https://api.github.com/users/bamboo3250/received_events","type":"User","site_admin":false},"body":"Fix #4641 ","created_at":"2016-01-21T20:52:39Z","updated_at":"2016-02-09T04:27:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9367ee337d052164ad7b94cbe0645c5cb26450ce","assignee":{"login":"thyageshm","id":5160137,"avatar_url":"https://avatars.githubusercontent.com/u/5160137?v=3","gravatar_id":"","url":"https://api.github.com/users/thyageshm","html_url":"https://github.com/thyageshm","followers_url":"https://api.github.com/users/thyageshm/followers","following_url":"https://api.github.com/users/thyageshm/following{/other_user}","gists_url":"https://api.github.com/users/thyageshm/gists{/gist_id}","starred_url":"https://api.github.com/users/thyageshm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thyageshm/subscriptions","organizations_url":"https://api.github.com/users/thyageshm/orgs","repos_url":"https://api.github.com/users/thyageshm/repos","events_url":"https://api.github.com/users/thyageshm/events{/privacy}","received_events_url":"https://api.github.com/users/thyageshm/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/TEAMMATES/repo/pulls/4654/commits","review_comments_url":"https://api.github.com/repos/TEAMMATES/repo/pulls/4654/comments","review_comment_url":"https://api.github.com/repos/TEAMMATES/repo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TEAMMATES/repo/issues/4654/comments","statuses_url":"https://api.github.com/repos/TEAMMATES/repo/statuses/a83794cd5a320a9084fcc1f4989532cb3fcba141","head":{"label":"TEAMMATES:4641-Admin-create-instructor-page-allows-adding-multiple-instructors","ref":"4641-Admin-create-instructor-page-allows-adding-multiple-instructors","sha":"a83794cd5a320a9084fcc1f4989532cb3fcba141","user":{"login":"TEAMMATES","id":7374810,"avatar_url":"https://avatars.githubusercontent.com/u/7374810?v=3","gravatar_id":"","url":"https://api.github.com/users/TEAMMATES","html_url":"https://github.com/TEAMMATES","followers_url":"https://api.github.com/users/TEAMMATES/followers","following_url":"https://api.github.com/users/TEAMMATES/following{/other_user}","gists_url":"https://api.github.com/users/TEAMMATES/gists{/gist_id}","starred_url":"https://api.github.com/users/TEAMMATES/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TEAMMATES/subscriptions","organizations_url":"https://api.github.com/users/TEAMMATES/orgs","repos_url":"https://api.github.com/users/TEAMMATES/repos","events_url":"https://api.github.com/users/TEAMMATES/events{/privacy}","received_events_url":"https://api.github.com/users/TEAMMATES/received_events","type":"Organization","site_admin":false},"repo":{"id":19369035,"name":"repo","full_name":"TEAMMATES/repo","owner":{"login":"TEAMMATES","id":7374810,"avatar_url":"https://avatars.githubusercontent.com/u/7374810?v=3","gravatar_id":"","url":"https://api.github.com/users/TEAMMATES","html_url":"https://github.com/TEAMMATES","followers_url":"https://api.github.com/users/TEAMMATES/followers","following_url":"https://api.github.com/users/TEAMMATES/following{/other_user}","gists_url":"https://api.github.com/users/TEAMMATES/gists{/gist_id}","starred_url":"https://api.github.com/users/TEAMMATES/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TEAMMATES/subscriptions","organizations_url":"https://api.github.com/users/TEAMMATES/orgs","repos_url":"https://api.github.com/users/TEAMMATES/repos","events_url":"https://api.github.com/users/TEAMMATES/events{/privacy}","received_events_url":"https://api.github.com/users/TEAMMATES/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TEAMMATES/repo","description":"This is the project website for the TEAMMATES feedback management tool for education","fork":false,"url":"https://api.github.com/repos/TEAMMATES/repo","forks_url":"https://api.github.com/repos/TEAMMATES/repo/forks","keys_url":"https://api.github.com/repos/TEAMMATES/repo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TEAMMATES/repo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TEAMMATES/repo/teams","hooks_url":"https://api.github.com/repos/TEAMMATES/repo/hooks","issue_events_url":"https://api.github.com/repos/TEAMMATES/repo/issues/events{/number}","events_url":"https://api.github.com/repos/TEAMMATES/repo/events","assignees_url":"https://api.github.com/repos/TEAMMATES/repo/assignees{/user}","branches_url":"https://api.github.com/repos/TEAMMATES/repo/branches{/branch}","tags_url":"https://api.github.com/repos/TEAMMATES/repo/tags","blobs_url":"https://api.github.com/repos/TEAMMATES/repo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TEAMMATES/repo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TEAMMATES/repo/git/refs{/sha}","trees_url":"https://api.github.com/repos/TEAMMATES/repo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TEAMMATES/repo/statuses/{sha}","languages_url":"https://api.github.com/repos/TEAMMATES/repo/languages","stargazers_url":"https://api.github.com/repos/TEAMMATES/repo/stargazers","contributors_url":"https://api.github.com/repos/TEAMMATES/repo/contributors","subscribers_url":"https://api.github.com/repos/TEAMMATES/repo/subscribers","subscription_url":"https://api.github.com/repos/TEAMMATES/repo/subscription","commits_url":"https://api.github.com/repos/TEAMMATES/repo/commits{/sha}","git_commits_url":"https://api.github.com/repos/TEAMMATES/repo/git/commits{/sha}","comments_url":"https://api.github.com/repos/TEAMMATES/repo/comments{/number}","issue_comment_url":"https://api.github.com/repos/TEAMMATES/repo/issues/comments{/number}","contents_url":"https://api.github.com/repos/TEAMMATES/repo/contents/{+path}","compare_url":"https://api.github.com/repos/TEAMMATES/repo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TEAMMATES/repo/merges","archive_url":"https://api.github.com/repos/TEAMMATES/repo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TEAMMATES/repo/downloads","issues_url":"https://api.github.com/repos/TEAMMATES/repo/issues{/number}","pulls_url":"https://api.github.com/repos/TEAMMATES/repo/pulls{/number}","milestones_url":"https://api.github.com/repos/TEAMMATES/repo/milestones{/number}","notifications_url":"https://api.github.com/repos/TEAMMATES/repo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TEAMMATES/repo/labels{/name}","releases_url":"https://api.github.com/repos/TEAMMATES/repo/releases{/id}","deployments_url":"https://api.github.com/repos/TEAMMATES/repo/deployments","created_at":"2014-05-02T07:43:00Z","updated_at":"2016-02-05T12:19:23Z","pushed_at":"2016-02-09T04:22:07Z","git_url":"git://github.com/TEAMMATES/repo.git","ssh_url":"git@github.com:TEAMMATES/repo.git","clone_url":"https://github.com/TEAMMATES/repo.git","svn_url":"https://github.com/TEAMMATES/repo","homepage":"http://teammatesv4.appspot.com/","size":139339,"stargazers_count":62,"watchers_count":62,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":153,"mirror_url":null,"open_issues_count":503,"forks":153,"open_issues":503,"watchers":62,"default_branch":"master"}},"base":{"label":"TEAMMATES:master","ref":"master","sha":"b9f156a5a784d78603cb17ce140b3893dba7e40e","user":{"login":"TEAMMATES","id":7374810,"avatar_url":"https://avatars.githubusercontent.com/u/7374810?v=3","gravatar_id":"","url":"https://api.github.com/users/TEAMMATES","html_url":"https://github.com/TEAMMATES","followers_url":"https://api.github.com/users/TEAMMATES/followers","following_url":"https://api.github.com/users/TEAMMATES/following{/other_user}","gists_url":"https://api.github.com/users/TEAMMATES/gists{/gist_id}","starred_url":"https://api.github.com/users/TEAMMATES/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TEAMMATES/subscriptions","organizations_url":"https://api.github.com/users/TEAMMATES/orgs","repos_url":"https://api.github.com/users/TEAMMATES/repos","events_url":"https://api.github.com/users/TEAMMATES/events{/privacy}","received_events_url":"https://api.github.com/users/TEAMMATES/received_events","type":"Organization","site_admin":false},"repo":{"id":19369035,"name":"repo","full_name":"TEAMMATES/repo","owner":{"login":"TEAMMATES","id":7374810,"avatar_url":"https://avatars.githubusercontent.com/u/7374810?v=3","gravatar_id":"","url":"https://api.github.com/users/TEAMMATES","html_url":"https://github.com/TEAMMATES","followers_url":"https://api.github.com/users/TEAMMATES/followers","following_url":"https://api.github.com/users/TEAMMATES/following{/other_user}","gists_url":"https://api.github.com/users/TEAMMATES/gists{/gist_id}","starred_url":"https://api.github.com/users/TEAMMATES/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TEAMMATES/subscriptions","organizations_url":"https://api.github.com/users/TEAMMATES/orgs","repos_url":"https://api.github.com/users/TEAMMATES/repos","events_url":"https://api.github.com/users/TEAMMATES/events{/privacy}","received_events_url":"https://api.github.com/users/TEAMMATES/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TEAMMATES/repo","description":"This is the project website for the TEAMMATES feedback management tool for education","fork":false,"url":"https://api.github.com/repos/TEAMMATES/repo","forks_url":"https://api.github.com/repos/TEAMMATES/repo/forks","keys_url":"https://api.github.com/repos/TEAMMATES/repo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TEAMMATES/repo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TEAMMATES/repo/teams","hooks_url":"https://api.github.com/repos/TEAMMATES/repo/hooks","issue_events_url":"https://api.github.com/repos/TEAMMATES/repo/issues/events{/number}","events_url":"https://api.github.com/repos/TEAMMATES/repo/events","assignees_url":"https://api.github.com/repos/TEAMMATES/repo/assignees{/user}","branches_url":"https://api.github.com/repos/TEAMMATES/repo/branches{/branch}","tags_url":"https://api.github.com/repos/TEAMMATES/repo/tags","blobs_url":"https://api.github.com/repos/TEAMMATES/repo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TEAMMATES/repo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TEAMMATES/repo/git/refs{/sha}","trees_url":"https://api.github.com/repos/TEAMMATES/repo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TEAMMATES/repo/statuses/{sha}","languages_url":"https://api.github.com/repos/TEAMMATES/repo/languages","stargazers_url":"https://api.github.com/repos/TEAMMATES/repo/stargazers","contributors_url":"https://api.github.com/repos/TEAMMATES/repo/contributors","subscribers_url":"https://api.github.com/repos/TEAMMATES/repo/subscribers","subscription_url":"https://api.github.com/repos/TEAMMATES/repo/subscription","commits_url":"https://api.github.com/repos/TEAMMATES/repo/commits{/sha}","git_commits_url":"https://api.github.com/repos/TEAMMATES/repo/git/commits{/sha}","comments_url":"https://api.github.com/repos/TEAMMATES/repo/comments{/number}","issue_comment_url":"https://api.github.com/repos/TEAMMATES/repo/issues/comments{/number}","contents_url":"https://api.github.com/repos/TEAMMATES/repo/contents/{+path}","compare_url":"https://api.github.com/repos/TEAMMATES/repo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TEAMMATES/repo/merges","archive_url":"https://api.github.com/repos/TEAMMATES/repo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TEAMMATES/repo/downloads","issues_url":"https://api.github.com/repos/TEAMMATES/repo/issues{/number}","pulls_url":"https://api.github.com/repos/TEAMMATES/repo/pulls{/number}","milestones_url":"https://api.github.com/repos/TEAMMATES/repo/milestones{/number}","notifications_url":"https://api.github.com/repos/TEAMMATES/repo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TEAMMATES/repo/labels{/name}","releases_url":"https://api.github.com/repos/TEAMMATES/repo/releases{/id}","deployments_url":"https://api.github.com/repos/TEAMMATES/repo/deployments","created_at":"2014-05-02T07:43:00Z","updated_at":"2016-02-05T12:19:23Z","pushed_at":"2016-02-09T04:22:07Z","git_url":"git://github.com/TEAMMATES/repo.git","ssh_url":"git@github.com:TEAMMATES/repo.git","clone_url":"https://github.com/TEAMMATES/repo.git","svn_url":"https://github.com/TEAMMATES/repo","homepage":"http://teammatesv4.appspot.com/","size":139339,"stargazers_count":62,"watchers_count":62,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":153,"mirror_url":null,"open_issues_count":503,"forks":153,"open_issues":503,"watchers":62,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TEAMMATES/repo/pulls/4654"},"html":{"href":"https://github.com/TEAMMATES/repo/pull/4654"},"issue":{"href":"https://api.github.com/repos/TEAMMATES/repo/issues/4654"},"comments":{"href":"https://api.github.com/repos/TEAMMATES/repo/issues/4654/comments"},"review_comments":{"href":"https://api.github.com/repos/TEAMMATES/repo/pulls/4654/comments"},"review_comment":{"href":"https://api.github.com/repos/TEAMMATES/repo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TEAMMATES/repo/pulls/4654/commits"},"statuses":{"href":"https://api.github.com/repos/TEAMMATES/repo/statuses/a83794cd5a320a9084fcc1f4989532cb3fcba141"}}}}