Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature #13573 : See also: improve display order of the publications #824

Merged
merged 4 commits into from
Aug 29, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ vignetteWidth = 150

publication_defaultsorting = pubId desc
# Possible values -
# pubDescription, pubCreationDate, pubBeginDate, pubEndDate, pubCreatorId,
# pubDescription, pubName, pubCreationDate, pubBeginDate, pubEndDate, pubCreatorId,
# pubImportance, pubVersion, pubKeywords, pubStatus, pubStatus, pubUpdaterId,
# pubValidateDate, pubValidatorId

Expand Down Expand Up @@ -79,33 +79,12 @@ showNoPublisMessage = true
# in a HTML content or only the first occurrence
highlightFirstOccurence= false

# concerning the Files storage : allows displaying the publications in the list of attachments.
fileStorageShowPublication= true

#### FileStorage extraInfo ###
# shows the complete information relating to publication in the publication list
fileStorageShowExtraInfoPub = false
# shows the complete information relating to attachment in the publication list
fileStorageShowExtraInfoAttachment = false

#### Publication link manager ###
linkManagerSortByPubId = false
linkManagerShowPubId = false


# concerning the Files storage : allows displaying the publications in the list of attachments.
fileStorageShowPublication= true

#### FileStorage extraInfo ###
# shows the complete information relating to publication in the publication list
fileStorageShowExtraInfoPub = false
# shows the complete information relating to attachment in the publication list
fileStorageShowExtraInfoAttachment = false

#### Publication link manager ###
linkManagerSortByPubId = false
linkManagerShowPubId = false

templatePath=${env.SILVERPEAS_HOME}/resources/StringTemplates/components/kmelia/ (d\u00e9fini dans SilverpeasSettings.xml)
customersTemplatePath=${sys.SILVERPEAS_DATA_HOME}/StringTemplates/components/kmelia/ (d\u00e9fini dans SilverpeasSettings.xml)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private static void displayJavascriptAndFormToOperations(KmeliaSessionController
out.println("windowName = \"publicationWindow\";");
out.println("windowParams = \"directories=0,menubar=0,toolbar=0,alwaysRaised,scrollbars\";");
out.println("larg = \"900\";");
out.println("haut = \"600\";");
out.println("haut = \"800\";");
out.println(
"publicationWindow = SP_openWindow(url, windowName, larg, haut, windowParams, false);");
out.println("}");
Expand All @@ -100,8 +100,7 @@ private static void displayJavascriptAndFormToOperations(KmeliaSessionController
}

public static void displayAllOperations(String id, KmeliaSessionController kmeliaScc,
GraphicElementFactory gef, String action, MultiSilverpeasBundle resources, JspWriter out) throws
IOException {
GraphicElementFactory gef, String action, MultiSilverpeasBundle resources, JspWriter out) throws IOException {
boolean kmaxMode = false;
displayAllOperations(id, kmeliaScc, gef, action, resources, out, kmaxMode);
}
Expand Down Expand Up @@ -148,15 +147,15 @@ public static void displayAllOperations(String id, KmeliaSessionController kmeli
if (invisibleTabs.indexOf(KmeliaSessionController.TAB_CONTENT) == -1) {
tabbedPane.addTab(resources.getString("Model") + decoration,
"javaScript:onClick=goToOperation('" + routerUrl + "ToPubliContent', '" + sureId
+ "', 'ModelUpdateView')", "ModelUpdateView".equals(action) || "NewModel".equals(action)
|| "ModelChoice".equals(action), enabled);
+ "', 'ModelUpdateView')", "ModelUpdateView".equals(action) || "NewModel".equals(action)
|| "ModelChoice".equals(action), enabled);
}
if (invisibleTabs.indexOf(KmeliaSessionController.TAB_ATTACHMENTS) == -1) {
if (kmeliaScc.getComponentId().startsWith("toolbox")) {
decoration = "";
tabbedPane.addTab(resources.getString("GML.attachments") + decoration,
"javaScript:onClick=goToOperationByGet('" + routerUrl + "ViewAttachments', '" + pubId
+ "', 'ViewAttachments')", "ViewAttachments".equals(action), enabled);
+ "', 'ViewAttachments')", "ViewAttachments".equals(action), enabled);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.silverpeas.components.kmelia.KmeliaPublicationHelper;
import org.silverpeas.components.kmelia.control.KmeliaSessionController;
import org.silverpeas.components.kmelia.model.KmeliaPublication;
import org.silverpeas.components.kmelia.model.KmeliaPublicationComparator;
import org.silverpeas.components.kmelia.model.TopicDetail;
import org.silverpeas.components.kmelia.model.ValidatorsList;
import org.silverpeas.components.kmelia.service.KmeliaHelper;
Expand Down Expand Up @@ -130,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 @@ -192,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 @@ -209,27 +212,22 @@ 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 = false;
linksAllowed = false;
seeAlso = true;
// get selected publication ids from session
selectedIds = processPublicationsToLink(req);
String currentPubId = req.getParameter("PubId");
String currentPubComponentId = req.getParameter("PubComponentName");
PublicationPK publicationPK = null;
if (StringUtil.isDefined(currentPubId) && StringUtil.isDefined(currentPubComponentId)) {
publicationPK = new PublicationPK(currentPubId, currentPubComponentId);
}
publications = currentTopic.getValidPublications(publicationPK);
if (resources.getSetting("linkManagerSortByPubId", false)) {
publications.sort(new KmeliaPublicationComparator());
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) {
sortAllowed = false;
publications = kmeliaSC.getSessionPublicationsList();
Expand Down Expand Up @@ -278,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 @@ -645,7 +647,7 @@ void displayDefaultFragmentOfPublication(KmeliaPublication aPub,
if (fragmentSettings.seeAlso && resources.getSetting("linkManagerShowPubId", false)) {
ref = " [ " + pub.getPK().getId() + " ] ";
}
out.write("<div class=\"");
out.write("<div class=\"");
out.write(fragmentSettings.pubColor);
out.write("\"><span class=\"" + fragmentSettings.highlightClass + "\">");
out.write(ref);
Expand Down Expand Up @@ -812,8 +814,8 @@ void displaySortingListBox(MultiSilverpeasBundle resources, KmeliaSessionControl

out.
write(
"<select name=\"sortBy\" id=\"sortingList\" onChange=\"javascript:sortGoTo(this" +
".selectedIndex);\">");
"<select name=\"sortBy\" id=\"sortingList\" onChange=\"javascript:sortGoTo(this" +
".selectedIndex);\">");
out.write("<option>" + resources.getString("SortBy") + "</option>");
out.write("<option>-------------------------------</option>");
out.write(getSortingListBoxEntry(SORT_UPDATE_ASC, resources.getString("DateAsc"), ksc));
Expand All @@ -832,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 Expand Up @@ -1169,11 +1170,11 @@ private void displayLastPublications(KmeliaSessionController kmeliaScc,
resources.getString("kmelia.CopyPublicationLink") + "\" /></a>");
}
writer.write("<p class=\"publication-description\">"+WebEncodeHelper.convertBlanksForHtml(Encode.forHtml(pub.
getDescription(language))));
getDescription(language))));
writer.write("</p>");
writer.write("</li>");
}

writer.write("</ul>");
}

Expand Down Expand Up @@ -1231,5 +1232,5 @@ private void initSearch(QueryDescription queryDescription, PagesContext formCont
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function buildTree() {
//add child nodes for tree; our top level nodes are
try{
var mes = [];
mes =YAHOO.lang.JSON.stringify(<%=TreeHandler.ProcessMenu(request,MenuConstants.THEME_MENU_TYPE)%>);
mes =YAHOO.lang.JSON.stringify(<%=TreeHandler.processMenu(request,MenuConstants.THEME_MENU_TYPE)%>);
mes = YAHOO.lang.JSON.parse(mes);
}catch(x){
notyError("JSON Parse failed: "+x);
Expand Down