{"action":"created","comment":{"url":"https://api.github.com/repos/RUGSoftEng/Team-5/pulls/comments/62977618","id":62977618,"diff_hunk":"@@ -1,54 +1,109 @@\n-define(['app/database', 'jquery', 'bootstrap', 'xlsx', 'parsley', 'bootstrap-select', 'app/selectLanguage', 'app/selectSubject', 'app/forms'], function (db, $, bootstrap, XLSX, parsley, select, selectLanguage, selectSubject, forms) {\n+define(['app/database', 'jquery', 'bootstrap', 'xlsx', 'parsley', 'app/select', 'app/forms', 'app/ready', 'async', 'app/lang', 'app/string', 'app/user'], function (db, $, bootstrap, XLSX, parsley, select, forms, ready, async, lang, string, user) {\n \tvar X = XLSX;\n \tvar saveData;\n \tvar correctUpload = false;\n \n-\t// Check in the database if the name of the dataset already exists\n-\twindow.Parsley.addValidator('datasetName', {\n-\t\tvalidateString: function(value, requirement) {\n-\t\t\tvar result = db.getQuery(\"getDatasetByName\", [value]);\n-\t\t\treturn (result.length==0);\n-\t\t},\n-\t\tmessages: {\n-\t\t\ten: 'This name is already used for another dataset.'\n-\t\t}\n-\t});\n-\t// Check if the file uploaded file is correct (see xw_xfer)\n-\twindow.Parsley.addValidator('fileXlsx', {\n-\t\tvalidateString: function(_value, maxSize, parsleyInstance) {\n-\t\t\treturn correctUpload;\n-\t\t},\n-\t\trequirementType: 'integer',\n-\t\tmessages: {\n-\t\t\ten: 'This file is not supported.'\n-\t\t}\n-\t});\n-\n-\t// Script for evaluating the input of the upload form\n-\t$(function () {\n-    forms.initializeForm('#uploadForm')\n-\t\t.on('form:success', function() {\n-      forms.saveIntoDatabase('#uploadForm');\n-\t\t\t// Save all items in the dataset\n-      var id = db.lastInsertRowId(\"tbldatasets\", \"dataset_id\");\n-\t\t\tsaveDatasetItemsIntoDatabase(JSON.parse(saveData), id);\n-\t\t\tdb.close();\n-\t\t\twindow.location = 'index.html';\n-\t\t});\n-\t});\n-\n \t// Function for saving all items in the dataset\n-\tfunction saveDatasetItemsIntoDatabase(data,name) {\n+\tfunction saveDatasetItemsIntoDatabase(data,id) {\n \t\tvar output = to_json(data);\n \t\tvar sheetName = Object.keys(output)[0];\n \n \t\t$.each(output[sheetName], function (i, item) {\n \t\t\tvar question = output[sheetName][i].question;\n \t\t\tvar answer = output[sheetName][i].answer;\n-\t\t\tvar hint = (output[sheetName][i].hint == null) ? \"\" : output[sheetName][i].hint;\n-\t\t\tdb.executeQuery('addDatasetItem' , [name, question, answer, hint]);\n+\t\t\tvar hint = (output[sheetName][i].hint === null) ? \"\" : output[sheetName][i].hint;\n+\t\t\tdb.executeQuery('addDatasetItem' , [id, question, answer, hint]);\n \t\t});\n \t}\n+\t// Function for showing the user the system is loading\n+\tfunction showLoading(onSuccess) {\n+\t\t$(\"#loadFrame\").children(\"h1\").html(lang(\"open_busysaving\"));\n+\t\t$(\"#loadFrame\").fadeIn(300, onSuccess);\n+\t}\n+\t\n+\t// Write localisable text to the page\n+\tstring.fillinTextClasses();\n+\t$(\"#datasetname\").prop(\"placeholder\", lang(\"placeholder_datasetname\"));\n+\t$(\"#datasetsubject\").prop(\"title\", lang(\"placeholder_subject\"));\n+\t$(\"#buttonsave\").prop(\"value\", lang(\"open_buttonsave\"));\n+\t\n+\t// Replace user data in view from database\n+\t$(\"span[data-replace]\").each(function() {\n+\t\tvar user_info = $(this).data(\"replace\");\n+\t\tvar text = user.get(user_info);\n+\t\t$(this).html(text);\n+\t});\n+\t$(\"span[data-username]\").html(user.get(\"user_firstname\")+\" \"+user.get(\"user_lastname\"));\n+\n+\tready.on(function() {\n+\t\t// Check in the database if the name of the dataset already exists\n+\t\twindow.Parsley.addValidator('datasetName', {\n+\t\t\tvalidateString: function(value, requirement) {\n+\t\t\t\tvar result = db.getQuery(\"getDatasetByName\", [value]);\n+\t\t\t\treturn (result.length===0);\n+\t\t\t},\n+\t\t\tmessages: {\n+\t\t\t\ten: lang(\"error_datasetnamenotunique\")\n+\t\t\t}\n+\t\t});\n+\t\t// Check if the file uploaded file is correct (see xw_xfer)\n+\t\twindow.Parsley.addValidator('fileXlsx', {","path":"app/open.js","position":88,"original_position":88,"commit_id":"c9cabca0dbe9f186dfa240368fd62a7d8a45a339","original_commit_id":"c9cabca0dbe9f186dfa240368fd62a7d8a45a339","user":{"login":"lauraBaakman","id":4301624,"avatar_url":"https://avatars.githubusercontent.com/u/4301624?v=3","gravatar_id":"","url":"https://api.github.com/users/lauraBaakman","html_url":"https://github.com/lauraBaakman","followers_url":"https://api.github.com/users/lauraBaakman/followers","following_url":"https://api.github.com/users/lauraBaakman/following{/other_user}","gists_url":"https://api.github.com/users/lauraBaakman/gists{/gist_id}","starred_url":"https://api.github.com/users/lauraBaakman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lauraBaakman/subscriptions","organizations_url":"https://api.github.com/users/lauraBaakman/orgs","repos_url":"https://api.github.com/users/lauraBaakman/repos","events_url":"https://api.github.com/users/lauraBaakman/events{/privacy}","received_events_url":"https://api.github.com/users/lauraBaakman/received_events","type":"User","site_admin":false},"body":"....comment tells....function.","created_at":"2016-05-12T07:50:34Z","updated_at":"2016-05-12T07:50:34Z","html_url":"https://github.com/RUGSoftEng/Team-5/pull/7#discussion_r62977618","pull_request_url":"https://api.github.com/repos/RUGSoftEng/Team-5/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/RUGSoftEng/Team-5/pulls/comments/62977618"},"html":{"href":"https://github.com/RUGSoftEng/Team-5/pull/7#discussion_r62977618"},"pull_request":{"href":"https://api.github.com/repos/RUGSoftEng/Team-5/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/RUGSoftEng/Team-5/pulls/7","id":69659446,"html_url":"https://github.com/RUGSoftEng/Team-5/pull/7","diff_url":"https://github.com/RUGSoftEng/Team-5/pull/7.diff","patch_url":"https://github.com/RUGSoftEng/Team-5/pull/7.patch","issue_url":"https://api.github.com/repos/RUGSoftEng/Team-5/issues/7","number":7,"state":"open","locked":false,"title":"Sprint8","user":{"login":"ewerkema","id":16745495,"avatar_url":"https://avatars.githubusercontent.com/u/16745495?v=3","gravatar_id":"","url":"https://api.github.com/users/ewerkema","html_url":"https://github.com/ewerkema","followers_url":"https://api.github.com/users/ewerkema/followers","following_url":"https://api.github.com/users/ewerkema/following{/other_user}","gists_url":"https://api.github.com/users/ewerkema/gists{/gist_id}","starred_url":"https://api.github.com/users/ewerkema/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewerkema/subscriptions","organizations_url":"https://api.github.com/users/ewerkema/orgs","repos_url":"https://api.github.com/users/ewerkema/repos","events_url":"https://api.github.com/users/ewerkema/events{/privacy}","received_events_url":"https://api.github.com/users/ewerkema/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-11T11:58:26Z","updated_at":"2016-05-12T07:50:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"517273649b7add6254d1420b4cfa9eae0b80b14a","assignee":{"login":"lauraBaakman","id":4301624,"avatar_url":"https://avatars.githubusercontent.com/u/4301624?v=3","gravatar_id":"","url":"https://api.github.com/users/lauraBaakman","html_url":"https://github.com/lauraBaakman","followers_url":"https://api.github.com/users/lauraBaakman/followers","following_url":"https://api.github.com/users/lauraBaakman/following{/other_user}","gists_url":"https://api.github.com/users/lauraBaakman/gists{/gist_id}","starred_url":"https://api.github.com/users/lauraBaakman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lauraBaakman/subscriptions","organizations_url":"https://api.github.com/users/lauraBaakman/orgs","repos_url":"https://api.github.com/users/lauraBaakman/repos","events_url":"https://api.github.com/users/lauraBaakman/events{/privacy}","received_events_url":"https://api.github.com/users/lauraBaakman/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/RUGSoftEng/Team-5/pulls/7/commits","review_comments_url":"https://api.github.com/repos/RUGSoftEng/Team-5/pulls/7/comments","review_comment_url":"https://api.github.com/repos/RUGSoftEng/Team-5/pulls/comments{/number}","comments_url":"https://api.github.com/repos/RUGSoftEng/Team-5/issues/7/comments","statuses_url":"https://api.github.com/repos/RUGSoftEng/Team-5/statuses/c9cabca0dbe9f186dfa240368fd62a7d8a45a339","head":{"label":"RUGSoftEng:sprint8","ref":"sprint8","sha":"c9cabca0dbe9f186dfa240368fd62a7d8a45a339","user":{"login":"RUGSoftEng","id":17049951,"avatar_url":"https://avatars.githubusercontent.com/u/17049951?v=3","gravatar_id":"","url":"https://api.github.com/users/RUGSoftEng","html_url":"https://github.com/RUGSoftEng","followers_url":"https://api.github.com/users/RUGSoftEng/followers","following_url":"https://api.github.com/users/RUGSoftEng/following{/other_user}","gists_url":"https://api.github.com/users/RUGSoftEng/gists{/gist_id}","starred_url":"https://api.github.com/users/RUGSoftEng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RUGSoftEng/subscriptions","organizations_url":"https://api.github.com/users/RUGSoftEng/orgs","repos_url":"https://api.github.com/users/RUGSoftEng/repos","events_url":"https://api.github.com/users/RUGSoftEng/events{/privacy}","received_events_url":"https://api.github.com/users/RUGSoftEng/received_events","type":"Organization","site_admin":false},"repo":{"id":51758491,"name":"Team-5","full_name":"RUGSoftEng/Team-5","owner":{"login":"RUGSoftEng","id":17049951,"avatar_url":"https://avatars.githubusercontent.com/u/17049951?v=3","gravatar_id":"","url":"https://api.github.com/users/RUGSoftEng","html_url":"https://github.com/RUGSoftEng","followers_url":"https://api.github.com/users/RUGSoftEng/followers","following_url":"https://api.github.com/users/RUGSoftEng/following{/other_user}","gists_url":"https://api.github.com/users/RUGSoftEng/gists{/gist_id}","starred_url":"https://api.github.com/users/RUGSoftEng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RUGSoftEng/subscriptions","organizations_url":"https://api.github.com/users/RUGSoftEng/orgs","repos_url":"https://api.github.com/users/RUGSoftEng/repos","events_url":"https://api.github.com/users/RUGSoftEng/events{/privacy}","received_events_url":"https://api.github.com/users/RUGSoftEng/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/RUGSoftEng/Team-5","description":"SlimStampen learning app","fork":false,"url":"https://api.github.com/repos/RUGSoftEng/Team-5","forks_url":"https://api.github.com/repos/RUGSoftEng/Team-5/forks","keys_url":"https://api.github.com/repos/RUGSoftEng/Team-5/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RUGSoftEng/Team-5/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RUGSoftEng/Team-5/teams","hooks_url":"https://api.github.com/repos/RUGSoftEng/Team-5/hooks","issue_events_url":"https://api.github.com/repos/RUGSoftEng/Team-5/issues/events{/number}","events_url":"https://api.github.com/repos/RUGSoftEng/Team-5/events","assignees_url":"https://api.github.com/repos/RUGSoftEng/Team-5/assignees{/user}","branches_url":"https://api.github.com/repos/RUGSoftEng/Team-5/branches{/branch}","tags_url":"https://api.github.com/repos/RUGSoftEng/Team-5/tags","blobs_url":"https://api.github.com/repos/RUGSoftEng/Team-5/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RUGSoftEng/Team-5/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RUGSoftEng/Team-5/git/refs{/sha}","trees_url":"https://api.github.com/repos/RUGSoftEng/Team-5/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RUGSoftEng/Team-5/statuses/{sha}","languages_url":"https://api.github.com/repos/RUGSoftEng/Team-5/languages","stargazers_url":"https://api.github.com/repos/RUGSoftEng/Team-5/stargazers","contributors_url":"https://api.github.com/repos/RUGSoftEng/Team-5/contributors","subscribers_url":"https://api.github.com/repos/RUGSoftEng/Team-5/subscribers","subscription_url":"https://api.github.com/repos/RUGSoftEng/Team-5/subscription","commits_url":"https://api.github.com/repos/RUGSoftEng/Team-5/commits{/sha}","git_commits_url":"https://api.github.com/repos/RUGSoftEng/Team-5/git/commits{/sha}","comments_url":"https://api.github.com/repos/RUGSoftEng/Team-5/comments{/number}","issue_comment_url":"https://api.github.com/repos/RUGSoftEng/Team-5/issues/comments{/number}","contents_url":"https://api.github.com/repos/RUGSoftEng/Team-5/contents/{+path}","compare_url":"https://api.github.com/repos/RUGSoftEng/Team-5/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RUGSoftEng/Team-5/merges","archive_url":"https://api.github.com/repos/RUGSoftEng/Team-5/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RUGSoftEng/Team-5/downloads","issues_url":"https://api.github.com/repos/RUGSoftEng/Team-5/issues{/number}","pulls_url":"https://api.github.com/repos/RUGSoftEng/Team-5/pulls{/number}","milestones_url":"https://api.github.com/repos/RUGSoftEng/Team-5/milestones{/number}","notifications_url":"https://api.github.com/repos/RUGSoftEng/Team-5/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RUGSoftEng/Team-5/labels{/name}","releases_url":"https://api.github.com/repos/RUGSoftEng/Team-5/releases{/id}","deployments_url":"https://api.github.com/repos/RUGSoftEng/Team-5/deployments","created_at":"2016-02-15T13:47:26Z","updated_at":"2016-03-05T09:47:22Z","pushed_at":"2016-05-11T13:36:20Z","git_url":"git://github.com/RUGSoftEng/Team-5.git","ssh_url":"git@github.com:RUGSoftEng/Team-5.git","clone_url":"https://github.com/RUGSoftEng/Team-5.git","svn_url":"https://github.com/RUGSoftEng/Team-5","homepage":"","size":147345,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"RUGSoftEng:master","ref":"master","sha":"ec9f43e94f790e6dad71f1effbeb29040e230f06","user":{"login":"RUGSoftEng","id":17049951,"avatar_url":"https://avatars.githubusercontent.com/u/17049951?v=3","gravatar_id":"","url":"https://api.github.com/users/RUGSoftEng","html_url":"https://github.com/RUGSoftEng","followers_url":"https://api.github.com/users/RUGSoftEng/followers","following_url":"https://api.github.com/users/RUGSoftEng/following{/other_user}","gists_url":"https://api.github.com/users/RUGSoftEng/gists{/gist_id}","starred_url":"https://api.github.com/users/RUGSoftEng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RUGSoftEng/subscriptions","organizations_url":"https://api.github.com/users/RUGSoftEng/orgs","repos_url":"https://api.github.com/users/RUGSoftEng/repos","events_url":"https://api.github.com/users/RUGSoftEng/events{/privacy}","received_events_url":"https://api.github.com/users/RUGSoftEng/received_events","type":"Organization","site_admin":false},"repo":{"id":51758491,"name":"Team-5","full_name":"RUGSoftEng/Team-5","owner":{"login":"RUGSoftEng","id":17049951,"avatar_url":"https://avatars.githubusercontent.com/u/17049951?v=3","gravatar_id":"","url":"https://api.github.com/users/RUGSoftEng","html_url":"https://github.com/RUGSoftEng","followers_url":"https://api.github.com/users/RUGSoftEng/followers","following_url":"https://api.github.com/users/RUGSoftEng/following{/other_user}","gists_url":"https://api.github.com/users/RUGSoftEng/gists{/gist_id}","starred_url":"https://api.github.com/users/RUGSoftEng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RUGSoftEng/subscriptions","organizations_url":"https://api.github.com/users/RUGSoftEng/orgs","repos_url":"https://api.github.com/users/RUGSoftEng/repos","events_url":"https://api.github.com/users/RUGSoftEng/events{/privacy}","received_events_url":"https://api.github.com/users/RUGSoftEng/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/RUGSoftEng/Team-5","description":"SlimStampen learning app","fork":false,"url":"https://api.github.com/repos/RUGSoftEng/Team-5","forks_url":"https://api.github.com/repos/RUGSoftEng/Team-5/forks","keys_url":"https://api.github.com/repos/RUGSoftEng/Team-5/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RUGSoftEng/Team-5/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RUGSoftEng/Team-5/teams","hooks_url":"https://api.github.com/repos/RUGSoftEng/Team-5/hooks","issue_events_url":"https://api.github.com/repos/RUGSoftEng/Team-5/issues/events{/number}","events_url":"https://api.github.com/repos/RUGSoftEng/Team-5/events","assignees_url":"https://api.github.com/repos/RUGSoftEng/Team-5/assignees{/user}","branches_url":"https://api.github.com/repos/RUGSoftEng/Team-5/branches{/branch}","tags_url":"https://api.github.com/repos/RUGSoftEng/Team-5/tags","blobs_url":"https://api.github.com/repos/RUGSoftEng/Team-5/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RUGSoftEng/Team-5/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RUGSoftEng/Team-5/git/refs{/sha}","trees_url":"https://api.github.com/repos/RUGSoftEng/Team-5/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RUGSoftEng/Team-5/statuses/{sha}","languages_url":"https://api.github.com/repos/RUGSoftEng/Team-5/languages","stargazers_url":"https://api.github.com/repos/RUGSoftEng/Team-5/stargazers","contributors_url":"https://api.github.com/repos/RUGSoftEng/Team-5/contributors","subscribers_url":"https://api.github.com/repos/RUGSoftEng/Team-5/subscribers","subscription_url":"https://api.github.com/repos/RUGSoftEng/Team-5/subscription","commits_url":"https://api.github.com/repos/RUGSoftEng/Team-5/commits{/sha}","git_commits_url":"https://api.github.com/repos/RUGSoftEng/Team-5/git/commits{/sha}","comments_url":"https://api.github.com/repos/RUGSoftEng/Team-5/comments{/number}","issue_comment_url":"https://api.github.com/repos/RUGSoftEng/Team-5/issues/comments{/number}","contents_url":"https://api.github.com/repos/RUGSoftEng/Team-5/contents/{+path}","compare_url":"https://api.github.com/repos/RUGSoftEng/Team-5/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RUGSoftEng/Team-5/merges","archive_url":"https://api.github.com/repos/RUGSoftEng/Team-5/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RUGSoftEng/Team-5/downloads","issues_url":"https://api.github.com/repos/RUGSoftEng/Team-5/issues{/number}","pulls_url":"https://api.github.com/repos/RUGSoftEng/Team-5/pulls{/number}","milestones_url":"https://api.github.com/repos/RUGSoftEng/Team-5/milestones{/number}","notifications_url":"https://api.github.com/repos/RUGSoftEng/Team-5/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RUGSoftEng/Team-5/labels{/name}","releases_url":"https://api.github.com/repos/RUGSoftEng/Team-5/releases{/id}","deployments_url":"https://api.github.com/repos/RUGSoftEng/Team-5/deployments","created_at":"2016-02-15T13:47:26Z","updated_at":"2016-03-05T09:47:22Z","pushed_at":"2016-05-11T13:36:20Z","git_url":"git://github.com/RUGSoftEng/Team-5.git","ssh_url":"git@github.com:RUGSoftEng/Team-5.git","clone_url":"https://github.com/RUGSoftEng/Team-5.git","svn_url":"https://github.com/RUGSoftEng/Team-5","homepage":"","size":147345,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/RUGSoftEng/Team-5/pulls/7"},"html":{"href":"https://github.com/RUGSoftEng/Team-5/pull/7"},"issue":{"href":"https://api.github.com/repos/RUGSoftEng/Team-5/issues/7"},"comments":{"href":"https://api.github.com/repos/RUGSoftEng/Team-5/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/RUGSoftEng/Team-5/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/RUGSoftEng/Team-5/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/RUGSoftEng/Team-5/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/RUGSoftEng/Team-5/statuses/c9cabca0dbe9f186dfa240368fd62a7d8a45a339"}}}}