From 7bb454199961bcae216ebc9c47dd9707347d56b5 Mon Sep 17 00:00:00 2001 From: SilverDav Date: Mon, 15 May 2023 17:26:29 +0200 Subject: [PATCH] Bug #13588 : fixing browseBar display in locations choice --- .../webapp/kmelia/jsp/publicationPaths.jsp | 457 +++++++++--------- 1 file changed, 229 insertions(+), 228 deletions(-) diff --git a/kmelia/kmelia-war/src/main/webapp/kmelia/jsp/publicationPaths.jsp b/kmelia/kmelia-war/src/main/webapp/kmelia/jsp/publicationPaths.jsp index b0d7117eae..dc2b9acfcb 100644 --- a/kmelia/kmelia-war/src/main/webapp/kmelia/jsp/publicationPaths.jsp +++ b/kmelia/kmelia-war/src/main/webapp/kmelia/jsp/publicationPaths.jsp @@ -23,272 +23,273 @@ along with this program. If not, see . --%> -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@ taglib uri="http://www.silverpeas.com/tld/viewGenerator" prefix="view"%> +<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> +<%@ taglib uri="http://www.silverpeas.com/tld/viewGenerator" prefix="view" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="p" uri="http://www.silverpeas.com/tld/viewGenerator" %> +<%@ taglib prefix="sp" uri="http://www.silverpeas.com/tld/viewGenerator" %> <%@ page import="org.silverpeas.components.kmelia.model.KmeliaPublication" %> <% -response.setHeader("Cache-Control","no-store"); //HTTP 1.1 -response.setHeader("Pragma","no-cache"); //HTTP 1.0 -response.setDateHeader ("Expires",-1); //prevents caching at the proxy server + response.setHeader("Cache-Control", "no-store"); //HTTP 1.1 + response.setHeader("Pragma", "no-cache"); //HTTP 1.0 + response.setDateHeader("Expires", -1); //prevents caching at the proxy server %> <%@ include file="checkKmelia.jsp" %> <% -KmeliaPublication publication = (KmeliaPublication) request.getAttribute("Publication"); -String linkedPathString = (String) request.getAttribute("LinkedPathString"); -String currentLang = (String) request.getAttribute("Language"); + KmeliaPublication publication = (KmeliaPublication) request.getAttribute("Publication"); + String linkedPathString = (String) request.getAttribute("LinkedPathString"); + String currentLang = (String) request.getAttribute("Language"); -String pubName = publication.getDetail().getName(currentLang); -String id = publication.getDetail().getPK().getId(); + String pubName = publication.getDetail().getName(currentLang); + String id = publication.getDetail().getPK().getId(); -boolean toolbox = componentId.startsWith("toolbox"); + boolean toolbox = componentId.startsWith("toolbox"); %> - - - - - - - - - - - - <% - Window window = gef.getWindow(); - Frame frame = gef.getFrame(); - - BrowseBar browseBar = window.getBrowseBar(); - - browseBar.setDomainName(spaceLabel); - browseBar.setComponentName(componentLabel, "javascript:onClick=topicGoTo('0')"); - browseBar.setPath(linkedPathString); - browseBar.setExtraInformation(pubName); - - out.println(window.printBefore()); - - KmeliaDisplayHelper.displayAllOperations(id, kmeliaScc, gef, "ViewPath", resources, out); + currentPath.set(KMELIA, componentLabel); + displayCurrentPath(); + emptyComponentTreeview(); + $.post("<%=routerUrl%>ShowAliasTree?ComponentId=" + componentId, function(data) { + $("#treeviewFolders").html(data); + }); + } - out.println(frame.printBefore()); + function displayCurrentPath() { + let path = ""; + for (const key of currentPath.keys()) { + if (key !== '0') { + path += " > "; + } + let a = ""; + if (key === KMELIA) { + a = currentPath.get(KMELIA); + } else { + a = "" + + currentPath.get(key) + ""; + } + path += a; + } + $("#currentPath").html(path); + } - Board board = gef.getBoard(); - - out.println(board.printBefore()); + function viewLocalComponent() { + $.post("<%=routerUrl%>ShowAliasTree?ComponentId=<%=componentId%>", function(data) { + $("#localTreeview").html(data); + }); + } - //regarder si la publication est dans la corbeille - if (publication.getLocation().isTrash()) { - //la publi est dans la corbeille - out.println("
"+kmeliaScc.getString("kmelia.PubInBasket")+"
"); - } + function emptyComponentTreeview() { + $("#treeviewFolders").empty(); + } - %> -
-
-

-
-
    -
    + function deleteAlias(aliasURI, locationId) { + var ajaxRequest = sp.ajaxRequest(aliasURI).byDeleteMethod(); + ajaxRequest.send().then(function() { + $("#currentLocations #" + locationId).remove(); + $("#localTreeview #" + locationId).prop("checked", false); + $("#treeviewFolders #" + locationId).prop("checked", false); + }); + } -
    -
    -

    -
    -
    -
    + function addAlias(aliasURI) { + let ajaxRequest = sp.ajaxRequest(aliasURI).byPutMethod(); + ajaxRequest.send().then(function() { + displayLocations(); + }); + } -
    - -
    -

    -
    -
    -
    + function displayLocations() { + let ajaxRequest = sp.ajaxRequest( + webContext + "/services/private/publications/<%=componentId%>/<%=id%>/locations?lang=" + + getUserLanguage()); + ajaxRequest.send().then(function(response) { + let lis = ""; + response.responseAsJson().forEach(function(location) { + let locationId = location.id + "-" + location.componentId; + let li = "
  • " + + location.path + ""; + if (location.alias) { + li += "" + location.user.fullName + ""; + li += "" + sp.moment.displayAsDateTime(location.date) + + ""; + li += "Supprimer"; + } + li += "
  • "; + lis += li; + }); + $("#currentLocations ul").html(lis); + }); + } - <% - out.println(board.printAfter()); + function topicGoTo(id) { + location.href = "GoToTopic?Id=" + id; + } + + + + + + <% + KmeliaDisplayHelper.displayAllOperations(id, kmeliaScc, gef, "ViewPath", resources, out); + if (publication.getLocation().isTrash()) { + out.println("
    " + kmeliaScc.getString("kmelia.PubInBasket") + + "
    "); + } - out.println(frame.printAfter()); - out.println(window.printAfter()); -%> - - + %> + + +
    +
    +

    +
    +
      +
      + +
      +
      +

      +
      +
      +
      + +
      + +
      +

      +
      +
      +
      +
      +
      +
      +
      + \ No newline at end of file