Skip to content

Commit

Permalink
New feature: Added menu for commissions
Browse files Browse the repository at this point in the history
  • Loading branch information
mspasiano committed Dec 9, 2022
1 parent 935d695 commit 23de79a
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public List<Map<String, Serializable>> getCommissionCalls(String userId, Session
calls.add(Stream.of(
new AbstractMap.SimpleEntry<>("id", folder.getId()),
new AbstractMap.SimpleEntry<>("display", Boolean.TRUE),
new AbstractMap.SimpleEntry<>("disabled", !folder.getAllowableActions().getAllowableActions().contains(Action.CAN_CREATE_DOCUMENT)),
new AbstractMap.SimpleEntry<>("disabled", Boolean.FALSE),
new AbstractMap.SimpleEntry<>("title", folder.<String>getPropertyValue(JCONONPropertyIds.CALL_CODICE.value()))
).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)));
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package it.cnr.si.cool.jconon.service;

import it.cnr.cool.cmis.service.CMISService;
import it.cnr.cool.security.service.impl.alfresco.CMISUser;
import it.cnr.cool.service.I18nService;
import it.cnr.cool.service.PageModel;
import it.cnr.cool.service.PageService;
import it.cnr.cool.util.CMISUtil;
import it.cnr.si.cool.jconon.cmis.model.JCONONPropertyIds;
import it.cnr.si.cool.jconon.repository.CacheRepository;
import it.cnr.si.cool.jconon.repository.dto.ObjectTypeCache;
import it.cnr.si.cool.jconon.service.call.CallService;
import it.cnr.si.cool.jconon.util.Utility;
import org.apache.chemistry.opencmis.client.api.Document;
Expand Down Expand Up @@ -52,7 +54,7 @@ public Map<String, Object> addToModel(Map<String, String[]> paramz, HttpServletR
final Optional<Folder> call = Optional.ofNullable(cmisService.getCurrentCMISSession(req).getObject(callId.get()))
.filter(Folder.class::isInstance)
.map(Folder.class::cast);

final CMISUser cmisUser = cmisService.getCMISUserFromSession(req);
if (call.isPresent()) {
return Stream.of(
new AbstractMap.SimpleEntry<>("page_title",
Expand All @@ -62,6 +64,11 @@ public Map<String, Object> addToModel(Map<String, String[]> paramz, HttpServletR
),
new AbstractMap.SimpleEntry<>("contextURL", Utility.getContextURL(req)),
new AbstractMap.SimpleEntry<>("call", CMISUtil.convertToProperties(call.get())),
new AbstractMap.SimpleEntry<>("canWiewApplications",
callService.isMemberOfCommissioneGroup(cmisUser, call.get()) ||
callService.isMemberOfConcorsiGroup(cmisUser) ||
cmisUser.isAdmin()
),
new AbstractMap.SimpleEntry<>("isMacroCall", callService.isMacroCall(call.get())),
new AbstractMap.SimpleEntry<>("isActive", callService.isBandoInCorso(call.get())),
new AbstractMap.SimpleEntry<>("attachments",
Expand All @@ -74,7 +81,22 @@ public Map<String, Object> addToModel(Map<String, String[]> paramz, HttpServletR
})
.filter(Document.class::isInstance)
.map(Document.class::cast)
.map(document -> CMISUtil.convertToProperties(document))
.map(document -> {
final Map<String, Object> stringObjectMap = CMISUtil.convertToProperties(document);
String label = "";
final Optional<ObjectTypeCache> optObjectTypeCache = cacheRepository.getCallAttachments()
.stream()
.filter(objectTypeCache -> document.getType().getId().equals(objectTypeCache.getId()))
.findAny();
if (optObjectTypeCache.isPresent()) {
label = i18nService.getLabel(optObjectTypeCache.get().getId(), Locale.ITALIAN);
if (label == null) {
label = optObjectTypeCache.get().getDefaultLabel();
}
}
stringObjectMap.put("typeLabel", label);
return stringObjectMap;
})
.collect(Collectors.toList())
))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,11 @@ define(['jquery', 'cnr/cnr', 'i18n', 'cnr/cnr.actionbutton', 'json!common', 'han
}

function displayAttachments(id) {

var content = $('<div></div>').addClass('modal-inner-fix');
jconon.findAllegati(id, content, 'jconon_attachment:document', null, function (el, refreshFn, permission) {
return jconon.defaultDisplayDocument(el, refreshFn, permission, false);
}, true);

UI.modal(i18n['actions.attachments'], content);

}

function scaricaSchedeValutazione(el, idMessage, format) {
Expand Down Expand Up @@ -312,6 +309,53 @@ define(['jquery', 'cnr/cnr', 'i18n', 'cnr/cnr.actionbutton', 'json!common', 'han
});
}

function modalEstraiDomande(el) {
var fieldSelect,
itemField,
onlyPrint = $('<button class="btn btn-primary" data-dismiss="modal" title="Scarica un file zip con solo le domande senza allegati"><i class="icon-print"></i> Domande</button>').
off('click').on('click', function () {
estraiDomande(el.id, false, false);
}),
allApplication = $('<button class="btn btn-success" data-dismiss="modal" title="Scarica un file zip delle domande confermate comprese di allegati"><i class="icon-download-alt"></i> Confermate con allegati</button>').
off('click').on('click', function () {
estraiDomande(el.id, true, false, fieldSelect.data('value'));
}),
activeApplication = $('<button class="btn btn-info" data-dismiss="modal" title="Scarica un file zip delle domande attive comprese di allegati"><i class="icon-download-alt"></i> Attive con allegati</button>').
off('click').on('click', function () {
estraiDomande(el.id, true, true, fieldSelect.data('value'));
}),
btnClose,
modalField = $('<div class="control-group">'),
m,
itemField = {
property : 'select2FieldType',
multiple : true,
class : 'input-xxlarge',
ghostName : 'typeFieldTitle',
jsonlist : [
{key : 'D:jconon_attachment:application',label : 'Domanda'},
{key : 'D:jconon_attachment:integration',label : 'Integrazioni alla Domanda'}
].concat(
Application.completeList(el['jconon_call:elenco_association'],cache.jsonlistApplicationAttachments),
Application.completeList(el['jconon_call:elenco_sezioni_curriculum'],cache.jsonlistApplicationCurriculums),
Application.completeList(el['jconon_call:elenco_sezioni_curriculum_ulteriore'],cache.jsonlistApplicationCurriculums),
Application.completeList(el['jconon_call:elenco_prodotti'],$.extend(cache.jsonlistApplicationProdotti, cache.jsonlistApplicationAttachments))
)
};
fieldSelect = select.Widget('select2FieldType', 'Estrai solo file con tipologia: [lasciare vuoto per tutte le tipologie]', itemField);
modalField.append('<input type="hidden" id="typeFieldTitle">');
fieldSelect.find('.controls').parent().attr('style','min-width:100%');
modalField.append(fieldSelect);

m = UI.modal('<i class="icon-print"></i> Estrazione domande relative al bando ' +el['jconon_call:codice'], modalField);
btnClose = m.find(".modal-footer").find(".btn");
btnClose.before(onlyPrint).before(allApplication).before(activeApplication);
$('button', m.find(".modal-footer")).tooltip({
placement: 'top',
container: m.find(".modal-footer")
});
}

function callbackModalCommission(modal, content) {
var username = content.find('#username'),
controls = username.parents('.control-group'),
Expand Down Expand Up @@ -739,50 +783,7 @@ define(['jquery', 'cnr/cnr', 'i18n', 'cnr/cnr.actionbutton', 'json!common', 'han
UI.modal('Modifica RdP', content);
};
customButtons.exportApplications = function () {
var fieldSelect,
itemField,
onlyPrint = $('<button class="btn btn-primary" data-dismiss="modal" title="Scarica un file zip con solo le domande senza allegati"><i class="icon-print"></i> Domande</button>').
off('click').on('click', function () {
estraiDomande(el.id, false, false);
}),
allApplication = $('<button class="btn btn-success" data-dismiss="modal" title="Scarica un file zip delle domande confermate comprese di allegati"><i class="icon-download-alt"></i> Confermate con allegati</button>').
off('click').on('click', function () {
estraiDomande(el.id, true, false, fieldSelect.data('value'));
}),
activeApplication = $('<button class="btn btn-info" data-dismiss="modal" title="Scarica un file zip delle domande attive comprese di allegati"><i class="icon-download-alt"></i> Attive con allegati</button>').
off('click').on('click', function () {
estraiDomande(el.id, true, true, fieldSelect.data('value'));
}),
btnClose,
modalField = $('<div class="control-group">'),
m,
itemField = {
property : 'select2FieldType',
multiple : true,
class : 'input-xxlarge',
ghostName : 'typeFieldTitle',
jsonlist : [
{key : 'D:jconon_attachment:application',label : 'Domanda'},
{key : 'D:jconon_attachment:integration',label : 'Integrazioni alla Domanda'}
].concat(
Application.completeList(el['jconon_call:elenco_association'],cache.jsonlistApplicationAttachments),
Application.completeList(el['jconon_call:elenco_sezioni_curriculum'],cache.jsonlistApplicationCurriculums),
Application.completeList(el['jconon_call:elenco_sezioni_curriculum_ulteriore'],cache.jsonlistApplicationCurriculums),
Application.completeList(el['jconon_call:elenco_prodotti'],$.extend(cache.jsonlistApplicationProdotti, cache.jsonlistApplicationAttachments))
)
};
fieldSelect = select.Widget('select2FieldType', 'Estrai solo file con tipologia: [lasciare vuoto per tutte le tipologie]', itemField);
modalField.append('<input type="hidden" id="typeFieldTitle">');
fieldSelect.find('.controls').parent().attr('style','min-width:100%');
modalField.append(fieldSelect);

m = UI.modal('<i class="icon-print"></i> Estrazione domande relative al bando ' +el['jconon_call:codice'], modalField);
btnClose = m.find(".modal-footer").find(".btn");
btnClose.before(onlyPrint).before(allApplication).before(activeApplication);
$('button', m.find(".modal-footer")).tooltip({
placement: 'top',
container: m.find(".modal-footer")
});
modalEstraiDomande(el);
};
if (el['jconon_call:scheda_valutazione'] === true && !isActive(el.data_inizio_invio_domande, el.data_fine_invio_domande) &&
(common.User.admin || isCommissario(el['jconon_call:commissione']) || isRdP(el['jconon_call:rdp']) || isConcorsi())) {
Expand Down Expand Up @@ -991,6 +992,7 @@ define(['jquery', 'cnr/cnr', 'i18n', 'cnr/cnr.actionbutton', 'json!common', 'han
isCommissario : isCommissario,
isRdP : isRdP,
isConcorsi : isConcorsi,
modalEstraiDomande : modalEstraiDomande,
filterApplicationByUsername : function(applicationElement, applicationSelectedEl, applicationTotalEl) {
var btnFilter = $('<button class="btn" id="filterApplication" type="button" title="Filtra domande"><i class="icon-filter"></i></button>').click(function (eventObject) {
var content = $('<div></div>').addClass('modal-inner-fix'),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require(['jquery', 'header', 'cnr/cnr', 'cnr/cnr.url', 'cnr/cnr.ui', 'json!cache', 'i18n', 'cnr/cnr.ui.select', 'cnr/cnr.application', 'cnr/cnr.jconon', 'cnr/cnr.call'], function ($, header, CNR, URL, UI, cache, i18n, select, Application, jconon, Call) {
"use strict";
var callId = params['callId'], metadata;
URL.Data.node.node({
data: {
nodeRef : callId
},
type: 'GET',
success: function (data) {
metadata = data;
},
error: function (jqXHR, textStatus, errorThrown) {
CNR.log(jqXHR, textStatus, errorThrown);
}
});
$('#exportApplications').off('click').on('click', function () {
metadata.id = metadata['cmis:objectId'];
return Call.modalEstraiDomande(metadata);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ define(['jquery', 'json!common', 'i18n', 'ws/header.common', 'cnr/cnr.url', 'cnr
$("#manage-call").addClass('hide');
}
if (common.commissionCalls && common.commissionCalls.length > 0) {
addMenu($("#commissions"), 'applications?cmis:objectId=', common.commissionCalls, true);
addMenu($("#commissions"), 'call-detail?callId=', common.commissionCalls, true);
$("#commissions").removeClass('hide');
} else {
$("#commissions").addClass('hide');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -704,4 +704,7 @@ message.content.type.blacklist=File type is unsupported, unsupported files are:
message.change.password=Enter the e-mail address with which you registered to receive the link to change your password.
label.button.presenta.domanda=Submit application
label.alert.call.notfound=The Call does not exist!
label.firmaAutomatica=Automatic Signature
label.firmaAutomatica=Automatic Signature

label.button.applications=Show all applications
label.button.exportApplications=Export finalized applications
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ F\:jconon_call_aric\:folder=Assegni di Ricerca
F\:jconon_call_mobility\:folder=Mobilità
F\:jconon_call_mobility_open\:folder=Mobilità aperta
F\:jconon_call_director\:folder=Direttori
F\:jconon_call_tind\:folder_tirocini_categorie_protette=Tirocini - Categorie Protette
D\:prodotti\:prodotto=Prodotto
D\:jconon_attachment\:integration=Integrazioni alla Domanda

Expand Down Expand Up @@ -768,6 +769,7 @@ D\:jconon_comunicazione\:attachment=Comunicazioni al candidato
D\:jconon_convocazione\:attachment=Convocazione
F\:jconon_call_employees\:folder=Selezioni per dipendenti CNR/Candidature


label.istruzioni.convocazione=Compilare tutti i dati per generare le convocazioni, saranno generate le convocazioni per tutte le domande attive relative al Bando <b>{0}</b>
label.istruzioni.esclusione=Compilare tutti i dati per generare le esclusioni, saranno generate le esclusioni per tutte le domande attive e con almeno una "non ammissione" relative al Bando <b>{0}</b>
label.istruzioni.comunicazione=Compilare tutti i dati per generare le comunicazioni, saranno generate le comunicazioni per tutte le domande attive relative al Bando <b>{0}</b>
Expand Down Expand Up @@ -870,4 +872,7 @@ message.content.type.blacklist=Il tipo di file non è supportato, i file non sup
message.change.password=Inserire l'indirizzo e-mail con il quale ci si è registrati per ricevere il link per modificare la password.
label.button.presenta.domanda=Presenta domanda
label.alert.call.notfound=Il bando cercato non esiste!
label.firmaAutomatica=Firma Automatica
label.firmaAutomatica=Firma Automatica

label.button.applications=Visualizza domande presentate
label.button.exportApplications=Esporta domande definitive
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
<meta name="twitter:domain" content="${contextURL}"/>
<meta name="twitter:title" property="og:title" itemprop="name" content="${message(call['cmis:objectTypeId'])} - ${call['jconon_call:codice']}" />
<meta name="twitter:description" property="og:description" itemprop="${message('label.jconon_call_descrizione')}" />
<script src="${url.context}/res/js/thirdparty/require.js" data-main="header"></script>
<script src="${url.context}/res/js/thirdparty/require.js" data-main="ws/call/call-detail.js"></script>
<link href="${url.context}/res/css/select2.css" rel="stylesheet">
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,19 @@
<hr>
<ul>
<#list attachments as attachment>
<li><a href="${contextURL}/rest/content?nodeRef=${attachment['cmis:objectId']}&guest=true">${attachment['cmis:name']}</a></li>
<li>${attachment.typeLabel} <a href="${contextURL}/rest/content?nodeRef=${attachment['cmis:objectId']}&guest=true">${attachment['cmis:name']}</a></li>
</#list>
</ul>
</div>
<#if isActive && !isMacroCall>
<a class="btn btn-primary btn-block" href="${contextURL}/manage-application?callId=${call['cmis:objectId']}"><h4><i class="icon-edit"></i> ${message('label.button.presenta.domanda')}</h4></a>
</#if>
<#if !isActive && canWiewApplications>
<div class="form-row mt-1">
<a class="btn btn-primary span6" href="${contextURL}/applications?cmis:objectId=${call['cmis:objectId']}"><h4><i class="icon-folder-open-alt"></i> ${message('label.button.applications')}</h4></a>
<a class="btn btn-info span6" href="#" id="exportApplications"><h4><i class="icon-download"></i> ${message('label.button.exportApplications')}</h4></a>
</div>
</#if>
</div>
</div>
</div>
Expand Down

0 comments on commit 23de79a

Please sign in to comment.