Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
IGC SA
Drowning in Liferay's code: where are the action URLs?
September 29, 2011 1:19 AM
Answer

IGC SA

Rank: Junior Member

Posts: 80

Join Date: June 8, 2011

Recent Posts

In the Document library portlet, once you have added a folder you have several options when clicking on the folder's "Action" button:
Actions -> Edit
Actions -> Permissions
Actions -> Delete

The delete option is not working from outside our network and I'm trying to see what URL the delete folder button refers to and the difference with other actions that seem to work fine.
I've been looking at Liferay's code and found:

liferay-portal-src-5.2.3\portal-web\docroot\html\portlet\document_library\folder_action.jsp
 1
 2<liferay-ui:icon-menu>
 3    <c:if test="<%= DLFolderPermission.contains(permissionChecker, folder, ActionKeys.UPDATE) %>">
 4        <portlet:renderURL windowState="<%= WindowState.MAXIMIZED.toString() %>" var="editURL">
 5            <portlet:param name="struts_action" value="/document_library/edit_folder" />
 6            <portlet:param name="redirect" value="<%= redirect %>" />
 7            <portlet:param name="folderId" value="<%= String.valueOf(folder.getFolderId()) %>" />
 8        </portlet:renderURL>
 9
10        <liferay-ui:icon image="edit" url="<%= editURL %>" />
11    </c:if>
12
13    <c:if test="<%= DLFolderPermission.contains(permissionChecker, folder, ActionKeys.PERMISSIONS) %>">
14        <liferay-security:permissionsURL
15            modelResource="<%= DLFolder.class.getName() %>"
16            modelResourceDescription="<%= folder.getName() %>"
17            resourcePrimKey="<%= String.valueOf(folder.getFolderId()) %>"
18            var="permissionsURL"
19        />
20
21        <liferay-ui:icon image="permissions" url="<%= permissionsURL %>" />
22    </c:if>
23
24    [b]<c:if test="<%= DLFolderPermission.contains(permissionChecker, folder, ActionKeys.DELETE) %>">
25        <portlet:actionURL windowState="<%= WindowState.MAXIMIZED.toString() %>" var="deleteURL">
26            <portlet:param name="struts_action" value="/document_library/edit_folder" />
27            <portlet:param name="<%= Constants.CMD %>" value="<%= Constants.DELETE %>" />
28            <portlet:param name="redirect" value="<%= redirect %>" />
29            <portlet:param name="folderId" value="<%= String.valueOf(folder.getFolderId()) %>" />
30        </portlet:actionURL>
31
32        <liferay-ui:icon-delete url="<%= deleteURL %>" />[/b]
33    </c:if>
34</liferay-ui:icon-menu>


I think that the part in bold is the one action I refer to. The others, as I said, seem to be working fine.
But I can't even find the javascript confirm message!! (I think it is contained in a generic javascript file)
As you can see the struts_action refers to /document_library/edit_folder, but when I check that file all I find is:

liferay-portal-src-5.2.3\portal-web\docroot\html\portlet\document_library\edit_folder.jsp
 1
 2<script type="text/javascript">
 3    [b]function <portlet:namespace />removeFolder() {
 4        document.<portlet:namespace />fm.<portlet:namespace />parentFolderId.value = "<%= DLFolderConstants.DEFAULT_PARENT_FOLDER_ID %>";
 5
 6        var nameEl = document.getElementById("<portlet:namespace />parentFolderName");
 7
 8        nameEl.href = "";
 9        nameEl.innerHTML = "";
10    }[/b]
11....
12<c:if test="<%= folder != null %>">
13    <tr>
14        <td class="lfr-label">
15            <liferay-ui:message key="parent-folder" />
16        </td>
17        <td>
18
19            <%
20            String parentFolderName = "";
21
22            try {
23                DLFolder parentFolder = DLFolderLocalServiceUtil.getFolder(parentFolderId);
24
25                parentFolderName = parentFolder.getName();
26            }
27            catch (NoSuchFolderException nscce) {
28            }
29            %>
30
31            <a href="<portlet:renderURL windowState="<%= WindowState.MAXIMIZED.toString() %>"><portlet:param name="struts_action" value="/document_library/view" /><portlet:param name="folderId" value="<%= String.valueOf(parentFolderId) %>" /></portlet:renderURL>" id="<portlet:namespace />parentFolderName">
32            <%= parentFolderName %></a>
33
34            <input type="button" value="<liferay-ui:message key="select" />" onClick="var folderWindow = window.open('<portlet:renderURL windowState="<%= LiferayWindowState.POP_UP.toString() %>"><portlet:param name="struts_action" value="/document_library/select_folder" /><portlet:param name="folderId" value="<%= String.valueOf(parentFolderId) %>" /></portlet:renderURL>', 'folder', 'directories=no,height=640,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,width=680'); void(''); folderWindow.focus();" />
35
36[b]            <input id="<portlet:namespace />removeFolderButton" type="button" value="<liferay-ui:message key="remove" />" onClick="<portlet:namespace />removeFolder();" />[/b]
37        </td>
38    </tr>
39    <tr>
40        <td colspan="2">
41            <br />
42        </td>
43    </tr>
44</c:if>


And I'm not even sure the part in bold is what the action refers to.

Where can I find the action URL of the option "remove" on the folder's "Action" context menu? I don't understand how Liferay's code is structured.
IGC SA
RE: Drowning in Liferay's code: where are the action URLs?
September 29, 2011 5:21 AM
Answer

IGC SA

Rank: Junior Member

Posts: 80

Join Date: June 8, 2011

Recent Posts

I found struts-config.xml and the java Action class related to the page, now I've got a better perception of the way it works (yeah, I have very little experience in struts), but still don't know if there's any way to find the URL generated when pressing that button.
Somehow, that "delete" action is not working when accessing the server from outside a private network but the rest keep doing all right, why? Please help
amy c
RE: Drowning in Liferay's code: where are the action URLs?
October 10, 2012 1:41 PM
Answer

amy c

Rank: New Member

Posts: 14

Join Date: August 29, 2012

Recent Posts

try page 113 of here.. http://manning.com/sezov/LiA_SampleChapter-04.pdf