Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ COPY ./admin/rdm_announcement/requirements.txt ./admin/rdm_announcement/
COPY ./admin/rdm_statistics/requirements.txt ./admin/rdm_statistics/
COPY ./addons/metadata/requirements.txt ./addons/metadata/
COPY ./addons/onlyoffice/requirements.txt ./addons/onlyoffice/
COPY ./addons/workflow/requirements.txt ./addons/workflow/

RUN pip3 install pip==21.0

Expand Down Expand Up @@ -179,6 +180,7 @@ COPY ./addons/iqbrims/static/ ./addons/iqbrims/static/
COPY ./addons/binderhub/static/ ./addons/binderhub/static/
COPY ./addons/metadata/static/ ./addons/metadata/static/
COPY ./addons/onlyoffice/static/ ./addons/onlyoffice/static/
COPY ./addons/workflow/static/ ./addons/workflow/static/
RUN \
# OSF
yarn install --frozen-lockfile \
Expand Down
15 changes: 10 additions & 5 deletions addons.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"onedrivebusiness",
"metadata",
"datasteward",
"onlyoffice"
"onlyoffice",
"workflow"
],
"addons_default": [
"osfstorage",
Expand Down Expand Up @@ -68,7 +69,8 @@
"nextcloudinstitutions": "partial",
"iqbrims": "partial",
"dropboxbusiness": "partial",
"onedrivebusiness": "partial"
"onedrivebusiness": "partial",
"workflow": "partial"
},
"addons_commentable": [
"osfstorage",
Expand All @@ -95,7 +97,8 @@
"nextcloudinstitutions",
"iqbrims",
"dropboxbusiness",
"onedrivebusiness"
"onedrivebusiness",
"workflow"
],
"addons_based_on_ids": [
"osfstorage",
Expand Down Expand Up @@ -138,7 +141,8 @@
"binderhub": "GakuNin Federated Computing Services (Jupyter) is a web-based interactive computational environment. Files on a GakuNin RDM project can be imported to/exported from GakuNin Federated Computing Services (Jupyter)",
"onedrivebusiness": "OneDrive for Office365 is a file storage add-on. Connect your Microsoft OneDrive account to a GakuNin RDM project to interact with files hosted on Microsoft OneDrive via the GakuNin RDM.",
"metadata": "The Metadata addon provides the functionality to register metadata to files and generate reports.",
"onlyoffice": "ONLYOFFICE document server."
"onlyoffice": "ONLYOFFICE document server.",
"workflow": "Work Flow Addon is ..."
},
"addons_url": {
"box": "http://www.box.com",
Expand Down Expand Up @@ -166,7 +170,8 @@
"binderhub": "https://binder.cs.rcos.nii.ac.jp",
"onedrivebusiness": "https://onedrive.live.com",
"metadata": "https://rcos.nii.ac.jp/service/rdm/",
"onlyoffice": "https://onlyoffice.com/"
"onlyoffice": "https://onlyoffice.com/",
"workflow": "https://dummy.nii.ac.jp/workflow"
},
"institutional_storage_add_on_method": [
"nextcloudinstitutions",
Expand Down
1 change: 1 addition & 0 deletions addons/base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,7 @@ def addon_view_file(auth, node, file_node, version):
'file_id': file_node._id,
'allow_comments': file_node.provider in settings.ADDONS_COMMENTABLE,
'checkout_user': file_node.checkout._id if file_node.checkout else None,
'locked_user': file_node.locked._id if file_node.locked else None,
'version_names': list(version_names),
'wopi_onlyoffice': onlyoffice_settings.WOPI_CLIENT_ONLYOFFICE,
})
Expand Down
8 changes: 4 additions & 4 deletions addons/metadata/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ class AddonAppConfig(BaseAddonAppConfig):

node_settings_template = os.path.join(TEMPLATE_PATH, 'metadata_node_settings.mako')

excel_maximun_file_size = 10485760
text_maximun_file_size = 10485760
image_maximun_file_size = 10485760
other_maximun_file_size = 10485760
excel_file_maximum_size = 10485760
text_file_maximum_size = 10485760
image_file_maximum_size = 10485760
any_file_maximum_size = 10485760

text_file_extension = ['txt', 'csv', 'tsv']
excel_file_extension = ['xlsx', 'xls']
Expand Down
24 changes: 0 additions & 24 deletions addons/metadata/static/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,30 +474,6 @@ function MetadataButtons() {
* Start editing metadata.
*/
self.editMetadata = function(context, filepath, item) {
window.context = context;
window.item = item;

var file_total_size = 0;
var file_total_number_of_files = 0;
var file_total_number_of_folders = 0;
var file_maximum_number_of_layers = 0;
var root = '';
getFile(filepath);

function getFile(filepath) {
context.wbcache.searchFile(filepath, function (file) {
if (file.hasOwnProperty('links')) {
window.filepath = file.links.download;
root = file.attributes.materialized;
window.filesize = file.attributes.size;
}
else {
window.filepath = '';
root = '/'+ file.data.provider;
}
});
}

var dialog = null;
const extraMetadata = self.getExtraMetadata(item);
if ((context.projectMetadata || {}).editable && !extraMetadata) {
Expand Down
53 changes: 26 additions & 27 deletions addons/metadata/static/metadata-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ const sizeofFormat = require("./util").sizeofFormat;
const getLocalizedText = util.getLocalizedText;
const normalizeText = util.normalizeText;

const logPrefix = '[metadata] ';
var filteredPages = [];

const logPrefix = '[metadata] ';

const QuestionPage = oop.defclass({
constructor: function(schema, fileItem, options) {
const self = this;
Expand All @@ -54,7 +55,7 @@ const QuestionPage = oop.defclass({
filteredPages = [];
filteredPages = (self.schema.pages || []).filter(function(page) {
return (page.questions || []).some(function(question){
return question.hide === true;
return question.concealment_page === "buttonHide";
})
}).map(function(page){
return page;
Expand Down Expand Up @@ -190,6 +191,7 @@ const QuestionField = oop.extend(Emitter, {

create: function() {
const self = this;
self.element = $('<div></div>').addClass('form-group');
if(filteredPages.length > 0 && filteredPages.length != 1){
const currentPage = filteredPages.filter(function(page) {
return (page.questions || []).some(function (question) {
Expand All @@ -199,26 +201,26 @@ const QuestionField = oop.extend(Emitter, {

const filteredPageIds = currentPage.flatMap(function(page) {
return (page.questions || []).filter(function (question) {
return question.hide === true;
return question.concealment_page === "buttonHide";
})
.map(function (question) {
return question.qid.split(':')[1];
});
});

const isHide = currentPage.some(function(page) {
const isConcealmentPage = currentPage.some(function(page) {
return (page.questions || []).some(function (question) {
return question.qid === self.question.qid && self.question.qid.split(':')[1] != filteredPageIds && self.question.required != true;
})
});

if (isHide && filteredPageIds.length == 1) {
self.element = $('<div></div>').addClass('form-group-'+filteredPageIds).css('height','0').css('overflow', 'hidden').css('margin','0px');
if (isConcealmentPage && filteredPageIds.length == 1) {
self.element = $('<div></div>').addClass('concealment-page-'+filteredPageIds).css('height','0').css('overflow', 'scroll');
}else{
self.element = $('<div></div>').addClass('form-group').css('margin','0px');
self.element = $('<div></div>').addClass('form-group');
}
}else{
self.element = $('<div></div>').addClass('form-group').css('margin','0px');
self.element = $('<div></div>').addClass('form-group');
}

// construct header
Expand All @@ -228,10 +230,6 @@ const QuestionField = oop.extend(Emitter, {
// construct label
const label = $('<label></label>')
.text(self.question.title ? getLocalizedText(self.question.title) : self.question.label);

if(self.question.auto_value){
label.append($(' <span>&nbsp; &#10227</span> '));
}
if (self.question.required) {
label.append($('<span></span>')
.css('color', 'red')
Expand All @@ -240,19 +238,19 @@ const QuestionField = oop.extend(Emitter, {
}
header.append(label);

if(self.question.hasOwnProperty('hide') && self.question.hide){
if(self.question.hasOwnProperty('concealment_page') && self.question.concealment_page == "buttonHide"){
const p = $('<p></p>');
const a = $('<a></a>').text(' '+_('Show Items'));
const a = $('<a></a>').text('�� '+_('Show Items'));
p.on('click', function(){
$('.form-group-'+self.question.qid.split(':')[1]).each(function() {
$('.concealment-page-'+self.question.qid.split(':')[1]).each(function() {
if($(this).height() === 0){
$(this).animate({height: $(this).get(0).scrollHeight}, 'fast', function() {
$(this).css('height', '');
$(this).css('height', '').addClass('form-group');
});
a.text(' '+_('Hide Items'));
a.text('�� '+_('Hide Items'));
}else {
$(this).animate({height: 0}, 'fast');
a.text(' '+_('Show Items'));
$(this).animate({height: 0}, 'fast').removeClass('form-group');
a.text('�� '+_('Show Items'));
}
});
});
Expand Down Expand Up @@ -384,7 +382,7 @@ function createFormField(question, options, value) {
formField = new TextFormField(question, options);
}
formField.create();
if (value != null && value !== '') {
if (value != null && value !== '' || (question.hasOwnProperty('initial_row_addition') && question.initial_row_addition)) {
try {
formField.setValue(value);
} catch (error) {
Expand Down Expand Up @@ -729,11 +727,7 @@ const ArrayFormField = oop.extend(FormFieldInterface, {
const headRow = $('<tr>');
const thead = $('<thead>').append(headRow);
self.question.properties.forEach(function(prop) {
if(prop.auto_value){
headRow.append($('<th>' + getLocalizedText(prop.title) + '<span>&nbsp; &#10227</span></th>'));
}else{
headRow.append($('<th>' + getLocalizedText(prop.title) + '</th>'));
}
headRow.append($('<th>' + getLocalizedText(prop.title) + '</th>'));
});
headRow.append($('<th>')); // remove button header

Expand Down Expand Up @@ -846,6 +840,11 @@ const ArrayFormField = oop.extend(FormFieldInterface, {
} else {
rows = value || [];
}

if(self.question.hasOwnProperty('initial_row_addition') && self.question.initial_row_addition ){
self.addRow();
}

rows.forEach(function(row) {
self.addRow(row);
});
Expand Down Expand Up @@ -1145,8 +1144,8 @@ function createSuggestionButton(container, question, buttonSuggestions, options,
.then(function (value) {
if(value == 'error'){
return;
}else if( value == 'auto-value-filesize-over-error'){
var name = question.qid.split(':')[1];
}else if( value == 'get-filesize-over-error'){
var name = question.qid.split(':')[1].replace('/', '-');
$('.'+name).remove();
container.after(
'<div class="'+name+'" style="color: red;">'+ _("File size exceeds the maximum allowed size.")+'</div>'
Expand Down
Loading