Skip to content

Commit

Permalink
Merge branch 'view-protection'
Browse files Browse the repository at this point in the history
  • Loading branch information
christophe-lejeune committed May 30, 2023
2 parents 1f46e52 + 4edebf6 commit 282045b
Show file tree
Hide file tree
Showing 175 changed files with 87 additions and 33 deletions.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ $('#comment_create').click(function () {
$('#header button').prop('disabled', true).tooltip('dispose');
$('#add-leaves').addClass('hidden');
$('.toast').toast('hide');
$('#comments').append($('#comments').find('textarea'));
$('#comments').find('textarea').removeClass('hidden');
$('.comment').off('click');
$('.comment_check').prop('disabled', true);
$('#commented').removeClass('hidden');
$('#reload').removeClass('hidden');
$('html, body').scrollTop($(document).height());
Expand Down Expand Up @@ -43,6 +46,7 @@ $('.comment').click(function(event) {
$('#reload').removeClass('hidden');
$('#comment_updated').removeClass('hidden');
$('.comment').off('click');
$('.comment_check').prop('disabled', true);
$('#kwic').parent().children().addClass('hidden');
$('#signout').prop('disabled', true);
$('#diary').addClass('disabled');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
15 changes: 15 additions & 0 deletions app/ddocs/cassandre/_docs/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"_id": "config",
"maintenance": {
"date": "2023-05-17T10:00:00Z",
"duration": 30
},
"sponsors": {
"ldap": [
"u182180"
],
"local": [
"u182180"
]
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 2 additions & 4 deletions app/lib/shared.js → app/ddocs/cassandre/lib/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,8 @@ function type2path(type) {
case 'graph':
case 'diagram':
return type;
break;
default:
return 'memo';
break;
}
}

Expand All @@ -342,11 +340,11 @@ function dSort(array, locale){
return replaceDiacritics(a.name).localeCompare(replaceDiacritics(b.name), locale);
});
return array;
};
}

function replaceDiacritics(str){
diacritics.forEach(function(letter){
str = str.replace(letter.base, letter.char);
});
return str;
};
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion app/rewrites.js → app/ddocs/cassandre/rewrites.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ function(req2) {
};
break;
case 3:
reply.path = '_list/kwic/kwic';
reply.path = '../search/_list/kwic/kwic';
reply.query = {
"startkey": toJSON([path[1], path[2]]),
"endkey": toJSON([path[1], path[2]+'\ufff0']),
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion app/shows/index.js → app/ddocs/cassandre/shows/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function(o, req) {
return {
body: JSON.stringify({
service: 'Cassandre',
revision: '3.22.10.07',
revision: '3.23.05.28',
update_seq: req.info.update_seq
})
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ <h1 class="editable"> <span id="size" class="badge badge-pill" title="{{i18n.i_m
async function includePublic() {
if (list.length > 0) {
from = list[list.length-1].sortkey;
if ("{{by}}" == "type" && list[list.length-1].path == 'statements') from = 'storylinez';
}
if (result !== undefined) results.push(result);
result = await getMore(from);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function(o) {
if (o.readers.length < 1) {
emit([null, diary], {'_id': diary});
} else {
for (var r of o.readers) {
if (o.contributors) for (var r of o.readers) {
if (o.contributors.indexOf(r) < 0)
emit([r, diary], {'_id': diary});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ function(o) {
}
if (!o.commented && !o.diary_name && !o.activity) {
var diary = o.diary || o.corpus;
var contributors = [].concat(o.readers, o.contributors).sort();
var contributors = [];
if (typeof o.readers !== "undefined") contributors = o.readers;
if (typeof o.readers === "undefined") contributors.push(null);
if (typeof o.contributors !== "undefined") contributors = contributors.concat(o.contributors);
contributors = contributors.sort();
var users = contributors.filter(function(item, pos, ary) {return !pos || item != ary[pos - 1];} );
for (var user of users) {
var update = o.date || o.history.slice(-1)[0].date || '';
var update = '';
if (o.date) update = o.date;
if (o.history) update = o.history.slice(-1)[0].date;
emit([diary, user, 'M', o._id, update], '1');
}
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
function(o) {
// !code lib/shared.js
var diary = o.diary || o.corpus || o._id,
type = o.type || 'transcript',
name = o.name || '...',
date = o.date,
update = o.date,
contributors = [].concat(o.readers, o.contributors).sort(),
contributors = [],
users = [];
if (typeof o.readers === "undefined" || o.readers.length == 0) contributors.push(null);
if (typeof o.readers === "undefined" || o.readers.length == 0) {
contributors.push(null);
} else {
contributors = o.readers;
}
if (typeof o.contributors !== "undefined") contributors = contributors.concat(o.contributors);
contributors = contributors.sort();
users = contributors.filter(function(item, pos, ary) {return !pos || item != ary[pos - 1];} );
if (o.history) {
date = o.history[0].date;
Expand Down Expand Up @@ -50,8 +55,7 @@ function(o) {
emit([o._id, order, null, 'D'], { diary_name: o.diary_name });
});
} else if (!o.commented) {
var type = o.type || 'transcript',
groundings = o.groundings || [],
var groundings = o.groundings || [],
preview = ' ';
if (o.statement) {
preview = o.statement;
Expand Down Expand Up @@ -82,7 +86,9 @@ function(o) {
emit([diary, 'name', user, 'M', name], obj);
emit([diary, 'date', user, 'M', date], obj);
emit([diary, 'update', user, 'M', update], obj);
var sortkey = replaceDiacritics(name.substr(0,10)).toLowerCase().replace(/\W/g, '_');
let sortkey = name.substr(0,10)
.normalize('NFD').replace(/\p{Diacritic}/gu, '')
.toLowerCase().replace(/\W/g, '_');
emit([diary, 'type', user, 'M', type+sortkey+o._id], obj);
if (o.statement) {
var ov = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ function(o) {
var diary = o.diary || o.corpus,
type = o.type || 'transcript',
name = o.name || '...',
contributors = [].concat(o.readers, o.contributors).sort(),
contributors = [],
users = [];
if (typeof o.readers === "undefined" || o.readers.length == 0) contributors.push(null);
if (typeof o.readers === "undefined" || o.readers.length == 0) {
contributors.push(null);
} else {
contributors = o.readers;
}
if (typeof o.contributors !== "undefined") contributors = contributors.concat(o.contributors);
contributors = contributors.sort();
users = contributors.filter(function(item, pos, ary) {return !pos || item != ary[pos - 1];} );
if (!o.commented && !o.diary_name) {
for (var user of users) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
function(o) {
var contributors = [].concat(o.readers, o.contributors).sort();
var contributors = [];
if (typeof o.readers !== "undefined") contributors = o.readers;
if (typeof o.contributors !== "undefined") contributors = contributors.concat(o.contributors);
contributors = contributors.sort();
var users = contributors.filter(function(item, pos, ary) {return !pos || item != ary[pos - 1];} );
if (users.indexOf(null) == -1 && o.readers && o.readers.length == 0) users.push(null);
if (o.nodes)
for (u of users) {
for (var u of users) {
emit([o.diary, u, 'L'], {'id': o._id, 'name': o.name});
}
if (o.statement && o.statement.length > 0) {
for (u of users) {
for (var u of users) {
emit([o.diary, u, 'S', o.name], {'_id': o._id});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,38 @@ function(o) {
emit([o._id, null, 'B'], {diary_name: o.diary_name});
if (o.commented && o.text && !o.checked)
emit([o.diary, null, 'C', o.date], {'id': o.commented, '_id': o.commented, 'name': o.text});
var contributors = [].concat(o.readers, o.contributors).sort();
var contributors = [];
if (typeof o.readers !== "undefined") contributors = o.readers;
if (typeof o.contributors !== "undefined") contributors = contributors.concat(o.contributors);
contributors = contributors.sort();
var users = contributors.filter(function(item, pos, ary) {return !pos || item != ary[pos - 1];} );
if (o.readers == undefined || o.readers.length == 0) users.push(null);
for (user of users) {
for (var user of users) {
var history_first = 0,
history_last = 0;
if (o.history) {
history_first = o.history[0].date;
history_last = o.history[o.history.length -1].date;
}
if (o.name == '' || o.name == '...')
emit([diary, user, 'N', o.history[o.history.length -1].date], {'id': o._id, 'name': '...'});
emit([diary, user, 'N', history_last], {'id': o._id, 'name': '...'});
if (o.editing)
emit([diary, user, 'D', o.history[o.history.length -1].date], {'id': o._id, 'name': o.name});
emit([diary, user, 'D', history_last], {'id': o._id, 'name': o.name});
if (o.type == 'operational' && o.body.match(/[*-]\s+\[\s?\]/)) {
var re = /[*-]\s+\[\s?\](.*)/g;
while ((matches = re.exec(o.body)) != null) {
var match = matches[1].replace(/[*#]/g, '');
emit([o.diary, user, 'O', o.history[o.history.length -1].date], {'id': o._id, 'name': match});
emit([o.diary, user, 'O', history_last], {'id': o._id, 'name': match});
}
}
if (o.groundings && o.groundings.length < 1)
emit([diary, user, 'G', o.history[0].date], {'id': o._id, '_id': null, 'name': o.name});
emit([diary, user, 'G', history_first], {'id': o._id, '_id': null, 'name': o.name});
if (o.groundings && o.groundings.length == 1) {
var gid = o.groundings[0];
if (typeof gid._id === 'string') gid = gid._id;
emit([diary, user, 'G', o.history[0].date], {'id': o._id, '_id': gid, 'name': o.name});
emit([diary, user, 'G', history_first], {'id': o._id, '_id': gid, 'name': o.name});
}
if (o.type == 'diagram' && o.groundings && o.groundings.length == 1)
emit([diary, user, 'A', o.history[0].date], {'id': o._id, '_id': o._id, 'name': o.name});
emit([diary, user, 'A', history_first], {'id': o._id, '_id': o._id, 'name': o.name});
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function(o) {
var corpus = o.corpus || o._id;
for (var [p, highlight] of Object.entries(o.highlights)) {
if (o.highlights) for (var [p, highlight] of Object.entries(o.highlights)) {
emit([highlight.viewpoint, highlight.topic], {
text: highlight.text,
corpus: corpus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ function(o) {
emit([o.user, o.date, 'M'], {'diary': diary, '_id': o.commented, 'text': o.text});
} else {
if (o.history) for (var [key, h] of Object.entries(o.history)) {
if (key == 0) {var operation = 'C';} else {var operation = 'E';}
var operation = 'E';
if (key == 0) operation = 'C';
if (o.diary_name) {
emit([h.user, h.date, operation], {'diary': o._id, '_id': '?by=name', 'name': o.diary_name, 'type': 'diary'});
} else {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
function(o) {
if (o.fullname){
var allowed = o.contributors,
var allowed = [],
readers = [],
sortkey = o.fullname.split(' ')[1].substr(0, 3);
if (o.contributors) allowed = o.contributors;
if (o.readers) allowed = [].concat(o.readers, o.contributors).sort();
readers = allowed.filter(function(item, pos, ary) {return !pos || item != ary[pos - 1];} );
for (var r of readers) {
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions app/ddocs/search/_id
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_design/search
1 change: 1 addition & 0 deletions app/ddocs/search/l10n
1 change: 1 addition & 0 deletions app/ddocs/search/language
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
javascript
1 change: 1 addition & 0 deletions app/ddocs/search/lib
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function (o) {
return {'text': i+' '};
}));
}
for (var [p, speech] of Object.entries(body)) {
for (var [p, speech] of Object.entries(body || {})) {
var speech_text = speech.text;
var speech_end = speech_begin + speech_text.length
+ (speech.actor? speech.actor.length : 0)
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ services:

push_app:
image: benel/couchapp
command: push .
command: pushapps ddocs/.
environment:
- URI=http://couchdb:5984/cassandre
volumes:
Expand Down

0 comments on commit 282045b

Please sign in to comment.