Skip to content

Commit

Permalink
Feature #13573 : See also: improve display order of the publications
Browse files Browse the repository at this point in the history
in this context :
- We don't manage manual order
- We don't persist the choosen order
  • Loading branch information
SilverDav authored and mmoqui committed Aug 29, 2023
1 parent 6903b46 commit e3ea666
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ public void doPost(HttpServletRequest request, HttpServletResponse res) throws I
String nodeId = req.getParameter("Id");
String sToLink = req.getParameter("ToLink");
String topicToLinkId = req.getParameter("TopicToLinkId");

boolean seeAlso = false;

// check if trying to link attachment
boolean attachmentToLink = req.getParameterAsBoolean("attachmentLink");

Expand Down Expand Up @@ -191,6 +194,7 @@ public void doPost(HttpServletRequest request, HttpServletResponse res) throws I
if (nbItemsPerPage != null) {
kmeliaSC.setNbPublicationsPerPage(nbItemsPerPage);
}
int previousSort = kmeliaSC.getSort().getCurrentSort();
if (sort != null) {
kmeliaSC.setSortValue(sort);
final String contentLanguage = kmeliaSC.getCurrentLanguage();
Expand All @@ -208,18 +212,20 @@ public void doPost(HttpServletRequest request, HttpServletResponse res) throws I

boolean sortAllowed = true;
boolean linksAllowed = true;
boolean seeAlso = false;
List<KmeliaPublication> publications;
TopicDetail currentTopic;
String role = kmeliaSC.getProfile();
if (toLink) {
currentTopic = kmeliaSC.getSessionTopicToLink();
sortAllowed = true;
linksAllowed = false;
seeAlso = true;
// get selected publication ids from session
selectedIds = processPublicationsToLink(req);
kmeliaSC.setCurrentFolderId(currentTopic.getNodePK().getId(), true);
if (sort != null) {
kmeliaSC.getSort().setCurrentSort(sort);
kmeliaSC.getSort().setExplicitSort(true);
}
kmeliaSC.loadPublicationsOfCurrentFolder();
publications = kmeliaSC.getSessionPublicationsList();
} else if (toPortlet) {
Expand Down Expand Up @@ -270,6 +276,10 @@ public void doPost(HttpServletRequest request, HttpServletResponse res) throws I
attachmentToLink);
}
}
//We rollback with previous sort of the topic
if (toLink) {
kmeliaSC.getSort().setCurrentSort(previousSort);
}
} catch (IOException e) {
SilverLogger.getLogger(this).error(e);
}
Expand Down Expand Up @@ -824,7 +834,6 @@ void displaySortingListBox(MultiSilverpeasBundle resources, KmeliaSessionControl
getSortingListBoxEntry(SORT_MANUAL, resources.getString("kmelia.sort.manual"), ksc));
}
out.write("</select>");

if (manualSort && SilverpeasRole.ADMIN == ksc.getHighestSilverpeasUserRole()) {
// Display link to reset manual sort
Img img = new Img();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@
displayPublications(oArgs.node.data.componentId,getCurrentNodeId());
//displays the publication localized at the root of a theme tracker
}else if (oArgs.node.data.nodeType=='COMPONENT' && oArgs.node.data.id.indexOf('kmelia')==0){
displayPublications(oArgs.node.data.id,rootTopic);
setCurrentNodeId(rootTopic);
displayPublications(oArgs.node.data.id,rootTopic);
}else{
displayHomeMessage();
}
Expand All @@ -123,14 +123,18 @@
function sortGoTo(selectedIndex) {
if (selectedIndex !== 0 && selectedIndex !== 1) {
const sort = document.publicationsForm.sortBy[selectedIndex].value;
currentSort = sort;
const ieFix = new Date().getTime();
const componentId = currentComponent;
$.get(getWebContext()+'/RAjaxPublicationsListServlet',
{PubId:pubId,TopicToLinkId:getCurrentNodeId(),ComponentId:componentId, ToLink:1, Sort: sort,IEFix:ieFix},
function(data){
$('#pubList').html(data);
},"html");
$.get(getWebContext() + '/RAjaxPublicationsListServlet', {
TopicToLinkId : getCurrentNodeId(),
ComponentId : componentId,
ToLink : 1,
Sort : sort,
IEFix : ieFix
}, function(data) {
$('#pubList').html(data);
}, "html");
return;
}
}
Expand All @@ -144,7 +148,7 @@
function doPagination(index, nbItemsPerPage){
const ieFix = new Date().getTime();
$.get(getWebContext()+'/RAjaxPublicationsListServlet', {PubId:pubId,Index:index,NbItemsPerPage:nbItemsPerPage,ComponentId:currentComponent,ToLink:1,Sort:currentSort,IEFix:ieFix},
$.get(getWebContext()+'/RAjaxPublicationsListServlet', {Index:index,NbItemsPerPage:nbItemsPerPage,ComponentId:currentComponent,ToLink:1,Sort:currentSort,IEFix:ieFix},
function(data){
$('#pubList').html(data);
},"html");
Expand All @@ -157,7 +161,7 @@
function displayPublications(CompoId,topicId){
const ieFix = new Date().getTime();
$.get(getWebContext()+'/RAjaxPublicationsListServlet', {PubId:pubId,ComponentId:CompoId,TopicToLinkId:topicId,ToLink:1,Sort:currentSort,IEFix:ieFix},
$.get(getWebContext()+'/RAjaxPublicationsListServlet', {ComponentId:CompoId,TopicToLinkId:topicId,ToLink:1,Sort:currentSort,IEFix:ieFix},
function(data){
$('#pubList').html(data);
},"html");
Expand Down

0 comments on commit e3ea666

Please sign in to comment.