Liferay custom portlet permission label missing - permissions

I've followed the instructions from this tutorial to introduce a new portlet level permission for my custom portlet.
In the resource-action-mapping XML there is a new action-key called PARTNER_ADMIN_CONTRACTING, and I've added the following line to the Language.properties file:
action.PARTNER_ADMIN_CONTRACTING=Admin contracting
On the Define permissions tab, it still shows the label key, not the value:
What's missing?

You have to add the action.PARTNER_ADMIN_CONTRACTING=Admin contracting language key to the portal resource bundle, because the Control Panel does not look for the translation in your portlet. You can use the language hook feature do to this:
Create a liferay-hook.xml in your docroot/WEB-INF directory:
<?xml version="1.0"?>
<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd">
<hook>
<language-properties>content-portal/Language.properties</language-properties>
</hook>
Create docroot/WEB-INF/src/content-portal/Language.properties:
action.PARTNER_ADMIN_CONTRACTING=Admin contracting
This should work!

Related

How do I create a Robots.txt editor in Sitefinity mvc?

I want to create an editor for the Robots.txt file in Sitefinity. I want to give the user ability to edit this. How do I do this? I am using the latest version of Sitefinity and MVC. Any examples or related articles, etc. will be useful.
If the user has access to Administration > File Manager, then he can go there, download the file, edit it and upload it again. That's the easiest option and does not require custom code.
If that's not an option, then you can create an MVC widget which reads the file and displays it in a textarea for instance.
User can then make changes and submit them to the controller which will save them to the file.
Then you can place this widget on a custom backend page.

DNN - What control to use for images in custom module settings?

I am creating modules using the template created by Chris Hammond (TYVM Chris).
My modules have a few things that can be edited by the user in the settings area, one of them being an image.
I can use a TextBox and have the user type the root relative path to the image, but it is a little clunky because the user has to upload the image in the file management area of the website, get the path, then add it to the module settings. It would be a lot smoother if I could have a Image selector that would tie into the DNN files and allow the user to select an image that has been previously uploaded to DNN or add their own.
How would one accomplish this?
I suggest you to use the FilePickerUploader control of DNN.
You could see what it looks like in the Portal Settings (in Admin menu). It's used for the selection of the logo file, background image and favicon.
For example, it could be use like this:
<%# Register TagPrefix="dnn" TagName="FilePickerUploader" Src="~/controls/filepickeruploader.ascx" %>
<dnn:FilePickerUploader ID="ctlFavIcon" runat="server" Required="True" FileFilter="ico" />
Required and FileFilter attributes are optionnal and I think it provides other options.
Just use a DNNEditor webcontrol
<%# Register TagPrefix="dnn" Assembly="DotNetNuke.Web" Namespace="DotNetNuke.Web.UI.WebControls" %>
<dnn:DnnEditor ToolsFile="xmfile.xml"/>
Via this control you can use the default image selector. In first place you will see a lot of selectors in the toolbar, but you can change this via a xml file and add that xml file to the property ToolsFile
Just let me know if you need more help.

Sharepoint2010 custom list view, changing setuppath post production to new AllItems.aspx

I have a custom list definition in production environment with list instances created with the following definition:
<View BaseViewID="0" Type="HTML" WebPartZoneID="Main" DisplayName="All Items" DefaultView="TRUE" MobileView="True" MobileDefaultView="False" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/issues.png" Url="Forms/AllItems.aspx">
I need to changing the setup path in some way so the AllItems.aspx view of the document library displays documents from it's parent site document library by e.g. CQWP. I've attempted this by using SPView.SetViewXml() but this has no affect.
I have attempted to follow Stefan Stanev's SharePoint blog
I've successfully changed the setup path in development with Unghost a custom SPView but I really do not want to go down this path.
I have customized the viewpage.aspx by mapping to templates\pages and editting / adding the required web part and adding feature upgrading to create a new view set it as default, change the ViewXml by calling SPView.SetViewXml but this does not work.
Is there a way of updating the content database post production to change and customise AllItems.aspx of a custom document library without directly querying content database?

Using Visibility (Default) attribute in MVCSitemap to show nodes only in breadcrumbs

Anyone who has achieved a single xml file but different menu and breadcrumbs with MVCSiteMapProvider package.
I have MVC.Sitemap all working well with my menu and breadcrumbs. I have added a new node for Home - Products
This is Index Action on Products Controller
I dont want this to appear in my menu but I do want it to appear in my Breadcrumbs when someone lands on /myapp/Products/Index or Products/Index
At the moment I am using visibility="SiteMapPathHelper,!*" picked up from the example and I am assuming the latest nuget package and my web.config is setup with
attributesToIgnore="visibility"
which is confusing as i dont understand that does this mean to ignore the parameters or does it tell that nodes that need to be ignored are filled with this parameter and value should be taken as condition.
By default, any attribute MvcSiteMapProvider sees in your menu XML declaration is added to the url parameter.
So, if you have this:
<mvcSiteMapNode area="Admin" controller="User" action="Index" title="Users" someRandomAttribute=3/>
the sitemap will use
/admin/user/index?someRandomAttribute=3 for the url.
If you put attributesToIgnore="someRandomAttribute" in the config, the url it will generate will become:
/admin/user/index
The visibility provider is a plug-in system - and the default one uses a 'visibility' attribute so it can decide if the node is visible or not.

Where to place resource-action-mapping in Liferay-Portlet?

I am trying to add permissions to a Liferay-Portlet based on the documentation of Liferay. Since the Portlet will be delivered in a war-package, I want to mantain the permission definition of the portlets inside the portlet itself.
I created a file resource-actions.xml with the following content (portlet-name is identical to the name specified in portlet.xml and liferay-*.xml):
<?xml version="1.0"?>
<resource-action-mapping>
<portlet-resource>
<portlet-name>test-portlet</portlet-name>
<supports>
<action-key>SELECT</action-key>
<action-key>VIEW</action-key>
<action-key>TEST_PERM</action-key>
</supports>
<community-defaults>
<action-key>VIEW</action-key>
</community-defaults>
<guest-defaults>
<action-key>VIEW</action-key>
</guest-defaults>
</portlet-resource>
There is no model-resource defined, because first I just want to see, if Liferay loads the permissions I set in the mapping file.
I placed the file in the folders
- WEB-INF
- WEB-INF/classes
- inside the portal-impl.jar of Liferay
- ...
But the new permission TEST_PERM does not show up under Control Panel -> Roles -> Define Permissions -> Add Portlet Permissions -> test-portlet. Does anybody know, what I am doing wrong here?
I posted this question in the offical Liferay forum and got a nice reply:
I've faced this before and placed resource file in \WEB-INF\classes\resource-actions
my resource-actions.zip is attached. hope it helps
UPDATE:
Link to the Liferay-Forum: Where to place resource-action-mapping in Liferay-Portlet?