diff --git a/.gitignore b/.gitignore index 6eb629f..1346928 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -playground/ \ No newline at end of file +playground/ +combo.html \ No newline at end of file diff --git a/blockchainCloud_client.html b/blockchainCloud_client.html index 28f020a..656df7b 100644 --- a/blockchainCloud_client.html +++ b/blockchainCloud_client.html @@ -169,7 +169,8 @@ FLO: ['https://explorer.mediciland.com/', 'https://livenet.flocha.in/', 'https://flosight.duckdns.org/', 'http://livenet-explorer.floexperiments.com/'], FLO_TEST: ['https://testnet-flosight.duckdns.org/', 'https://testnet.flocha.in/'] }, - adminID: "FMeiptdJNtYQEtzyYAVNP8fjsDJ1i4EPfE", + adminID: "F9Cs1wF7BS8fDj1gmCsuQ3kpBWRwQj7B2o", + //adminID: "FMeiptdJNtYQEtzyYAVNP8fjsDJ1i4EPfE", //sendAmt: 0.001, //fee: 0.0005, @@ -179,7 +180,7 @@ //for cloud apps subAdmins: ['FTMMBXhn3K8UnVA3s6AiXhatwiaMUHffUo'], - application: "RIBC", + application: "ContentCollaboration", // ContentCollaboration vectorClock: {}, appObjects: {}, generalData: {}, @@ -232,15 +233,9 @@
Reset

- - -
- -
- - -
+ +
@@ -7216,7 +7211,7 @@ if(!Array.isArray(floGlobals.generalData[event.filterStr])) floGlobals.generalData[event.filterStr] = [] for(vc in dataSet){ - floGlobals.generalData[event.filterStr].push({sender: dataSet[vc].senderID, message: dataSet[vc].message}) + floGlobals.generalData[event.filterStr].push({sender: dataSet[vc].senderID, vectorClock: vc, message: dataSet[vc].message}) compactIDB.writeData("generalData", floGlobals.generalData[event.filterStr], event.filterStr) floGlobals.generalVC[event.filterStr] = vc compactIDB.writeData("generalVC", vc, event.filterStr) @@ -7425,6 +7420,20 @@ localStorage.removeItem("privKey") return `privKey credentials deleted!` } + + function getNextGeneralData(type, vectorClock, options = {}){ + var filter = getFilterString(type, options) + var filteredResult = [] + for(var i = 0; i vectorClock) + filteredResult.push(floGlobals.generalData[filter][i]) + return filteredResult + } + + function getFilterString(type, options = {}){ + var filterStr = JSON.stringify({application: options.application || floGlobals.application, type: type, comment: options.comment}) + return filterStr + } @@ -7435,10 +7444,12 @@ const cloudArticleApp = { - SUBJECT: "testArticle", + SUBJECT: "testArticle2", numberOfSections: 5, + CONTENT_TYPE: "typeContentCollab", + delay: (t, v) => { return new Promise(function(resolve) { setTimeout(resolve.bind(null, v), t); @@ -7456,6 +7467,22 @@ let full_data_div = document.getElementById('current_data'); let full_article_div = document.getElementById('full_article_div'); const articleSubject = floGlobals.appObjects[this.SUBJECT]; + + new_entries_array = []; + + for(new_data of Object.values(floGlobals.generalData)[0]) { + new_obj = { + content:new_data.message.content, + content_creator: new_data.message.content_creator, + score: 0 + } + if(typeof new_data.message.section == "string") { + if(typeof new_entries_array[new_data.message.section] !== "object") + new_entries_array[new_data.message.section] = []; + new_entries_array[new_data.message.section].push(new_obj); + } + } + let t = ``; for(key in obj) { @@ -7463,10 +7490,21 @@ t += `

${key}

`; } - for(secKey in articleSubject[key]) { - const secObject = articleSubject[key][secKey]; - // Sort by score + for(secKey in articleSubject[key].data) { + const secObject = articleSubject[key].data[secKey]; + + // Add non scored new entries from users + if(typeof new_entries_array[secKey]==="object") { + let temp_iter_count = 0; + for(new_conts of new_entries_array[secKey]) { + secObject[`temp_iter_${temp_iter_count}`]= new_conts; + temp_iter_count++; + } + } + + // Sort by score let secObj = Object.values(secObject).sort((a,b)=>b.score-a.score); + console.log(secObj); t += `