I'm developing an application display template (freemarker) for the sitemap portlet to render in my layout in the pages footer. So far everything works. I can iterate through my pages and render the correct result. Checks on whether a page is hidden work as well.
Now I need one more feature. I want to check whether a page is accessible by logged users only (= don't show a link to a guest user when the page permissions forbid guests to see the page).
Here is my ADT code.
<#if entries?has_content>
<#list entries as entry>
<#assign layoutURL = portalUtil.getLayoutURL(entry, themeDisplay)>
<div class="grid3">
<ul>
<#if entry.isHidden() == false>
<li>${entry.getName(locale)}</li>
</#if>
</ul>
</div>
</#list>
</#if>
Maybe ${themeDisplay.getPermissionChecker()} can do the trick but I don't really have a clue on how to check for a users permissions on page. In a perfect world I can distinguish between different user groups but I'd settle for show when logged in, hide when anonymous (=guest).
I'm using Liferay 6.2. Anyone got an idea?
What you want to do is to check the view permission for a given page (Layout).
Freemarker snippet:
layoutPermission.contains(permissionChecker, entry.getPlid(), 'VIEW')
layoutPermission is available for all ADT templates and references LayoutPermission interface. entry means the current Layout instance.
I took the advice from this post on Liferay Forums.
To simply find out, if the user logged in you can call ThemeDisplay#isSignedIn.
Freemarker snippet:
<#if themeDisplay.isSignedIn()>
<#-- user is logged in -->
<#else>
<#-- user is guest -->
</#if>
Related
I'm building a freemarker theme for my liferay 6.2 and I'm struggeling with getting the window state of the login portlet when I'm trying to access a page without the needed permissions. In this case liferay "intercepts" the requests and renders a login portlet on top of my home layout template in maximized window state (which is a good behavior).
My problem is that my home layout looks different from my other layout templates. So the portlet is rendered with the wrong look and feel.
Is there a way to check if the login portlet is rendered or not and if it is get the viewmode to check if I want to render my home layout or not?
This is my code for home layout checks so far. The Todo-Comment is where I'm struggeling.
<#-- Check whether layout template of current page is home layout. -->
<#assign isHomeLayout = false />
<#if themeDisplay.getLayout().getTypeSettingsProperty("layout-template-id") == "novofleet-home-layout">
<#-- TODO: CHECK FOR LOGIN PORTLET AND WINDOW STATE AND RETURN FALSE IF PORTLET IS RENDERED AS MAXIMIZED -->
<#assign isHomeLayout = true />
</#if>
(Answer extracted from the question)
I just checked whether there is any portlet in maximized window state via Liferay's url params. New code:
<#-- Check whether layout template of current page is home layout. -->
<#assign isHomeLayout = false />
<#if themeDisplay.getLayout().getTypeSettingsProperty("layout-template-id") == "novofleet-home-layout">
<#assign isHomeLayout = true />
<#-- Check for existence of url parameter which forces portlets to maximezed window state and revoke home layout -->
<#assign maximized = request.getParameter("p_p_state")!"defaultValue" />
<#if maximized == "maximized">
<#assign isHomeLayout = false />
</#if>
</#if>
I have created a main site and I have created many subsite under the main site.
When I am in any main page and click on the logo icon, the page redirects to the home page.
But, when I am in any subsite and click on the logo icon, the page redirects to the subsite homepage rather than the main hompage.
I would like to change the navigation URL to the root site. Let me know if I have to edit any masterpage, or is there any common page that will inherit to all the child application.
Thanks
We have 2 ways to do this.
Method 1:
From the Snippet Gallery, copy and paste the default SiteLogo code snippet into your master page into the appropriate place you want it to be displayed.
In the SiteLogo code, search for SharePoint:SPSimpleSiteLink to find the relevant opening and closing tags. Now simply change the tag names to SharePoint:SPLinkButton instead.
Then simply add the attribute NavigateUrl to this tag and set it’s value to “~sitecollection/”.
Example:
Default snippet code:
<!--MS:<SharePoint:SPSimpleSiteLink runat="server" CssClass="ms-siteicon-a" ID="x7917ecc8c38d4bd69f58e338eab54c8c">-->
...
<!--ME:</SharePoint:SPSimpleSiteLink>-->
Should become this:
<!--MS:<SharePoint:SPLinkButton runat="server" NavigateUrl="~sitecollection/" CssClass="ms-siteicon-a" ID="x7917ecc8c38d4bd69f58e338eab54c8c">-->
...
<!--ME:</SharePoint:SPLinkButton>-->
Ref link
Method 2:
We are going to add custom js in the master page => our site is a publishing site
We find the site logo in the below hierarchy(in a rendered page).
<div id='DeltaSiteLogo'>
<a href='site url'>
<img src='siteIconPath.png/whatever extension'/>
</a>
</div>
So we may try the following for redirecting to the site collection/root web url on click of the logo.
// Add the following js in the '.html' design file that associates with the corresponding masterpage.
<script type="text/javascript">//<![CDATA[
$(document).ready(function(){
$("div#DeltaSiteLogo a").attr("href",_spPageContextInfo.siteAbsoluteUrl);
});
//]]>
</script>
It works.
Edit on the SharePoint Designer Master Pages > seattle.master .
Crtl F - Search for DeltaSiteLogo
DEFAULT:
<SharePoint:SPSimpleSiteLink CssClass="ms-siteicon-a" runat="server" id="onetidProjectPropertyTitleGraphic" >
<SharePoint:SiteLogoImage CssClass="ms-siteicon-img" name="onetidHeadbnnr0" id="onetidHeadbnnr2" LogoImageUrl="/_layouts/15/images/siteIcon.png?rev=47" runat="server"/>
</SharePoint:SPSimpleSiteLink>
Change To This (copy & paste the script):
<SharePoint:SPLinkButton runat="server" NavigateUrl="~sitecollection/" CssClass="ms-siteicon-a" ID="x7917ecc8c38d4bd69f58e338eab54c8c">
<SharePoint:SiteLogoImage CssClass="ms-siteicon-img" name="onetidHeadbnnr0" id="onetidHeadbnnr2" LogoImageUrl="/_layouts/15/images/siteIcon.png?rev=47" runat="server"/>
</SharePoint:SPLinkButton>
In Calendar portlet "Add Event", we can set view permissions. But by default it is showing three options namely in "Viewable by" drop down, "Any One(Guest Role), Site Members and Owner".
With these options i want to list name of all site members also....And when adding new event, if I selected a user, the event should be viewable by that particular user only...and if i selected "Site Members" it should be visible for all....
One solution i am thinking is by editing "edit_event.jsp". Created a hook for that...
The following code is giving the drop down of "Viewable by".... Here how can i add all site members name also? And will it check automatically hile showing events? Please help.....
<c:if test="<%= event == null %>">
<aui:field-wrapper label="permissions">
<liferay-ui:input-permissions
modelName="<%= CalEvent.class.getName() %>"
/>
</aui:field-wrapper>
</c:if>
I have a calendar web part in my SharePoint site which works fine in Firefox and IE but does not work in chrome browser.
This is the same situation i am facing.
http://answers.flyppdevportal.com/categories/sharepoint2010/sharepoint2010programming.aspx?ID=9dde800d-7ce0-4069-93d7-2adf2c53d94b
Any suggestions ?
One more thing to add here is that , I have a content Query web part which will rotate the Promotions using JQuery cycle plug in. It is on the same page where I have put the list and library web part with calendar Month view as a default view.
If I remove that CQWP with Promotions everything works fine but if it there it wont work
Any suggestions? I have checked for the Jquery conflicts but could not find any of them .
Thanks
I think that I have find the root cause of my problem
There is one CQWP placed on the same page with this Calendar view list.
This CQWP ha call to jquery cycle plugin which will cycle the content after some interval , due to this JQuery conflicts my calendar control is not working in chrome.
Whem I Remove this CQWP everything works like a charm!!!
1st, try to revert back to the OOB v4.master to see if the problem disappears. If it works as expected, this mean that your masterpage have some issue.
One of the most ridiculous bug in SP is that if you don't have the SiteAction control declared before the ribbon control, some javascript codes will fails.
In one of my custom master page, I have to create a second siteactions control, just before the ribbon control. I've put it into a invisible DIV to completely hide it from the user.
It ends with something like this :
<SharePoint:SPRibbon ID="SPRibbon1" runat="server" PlaceholderElementId="RibbonContainer"
CssFile="">
<SharePoint:SPRibbonPeripheralContent ID="SPRibbonPeripheralContent1" runat="server"
Location="TabRowLeft" CssClass="ms-siteactionscontainer s4-notdlg">
<!-- Here is the hidden site actions control -->
<div style="display: none">
<SharePoint:SiteActions runat="server" AccessKey="<%$Resources:wss,tb_SiteActions_AK%>"
ID="SiteActionsMenuMain" PrefixHtml="" SuffixHtml="" MenuNotVisibleHtml=" ">
<CustomTemplate>
</CustomTemplate>
</SharePoint:SiteActions>
</div>
<asp:ContentPlaceHolder ID="PlaceHolderGlobalNavigation" runat="server" Visible="false">
<SharePoint:PopoutMenu
runat="server"
>
.... Removed for readability ....
</SharePoint:PopoutMenu>
<div class="s4-die">
<asp:ContentPlaceHolder ID="PlaceHolderGlobalNavigationSiteMap" runat="server" Visible="false">
</asp:ContentPlaceHolder>
</div>
</asp:ContentPlaceHolder>
</SharePoint:SPRibbonPeripheralContent>
<SharePoint:SPRibbonPeripheralContent runat="server" Location="TabRowRight" ID="RibbonTabRowRight"
CssClass="s4-trc-container s4-notdlg">
.... Removed for readability ....
</SharePoint:SPRibbonPeripheralContent>
</SharePoint:SPRibbon>
For your information, this behavior is due to one the inner control of the site action (PublishingConsole if I'm right). This inner control will produces some javascript global variable declaration (language and one another). This global variables are required by the ribbon control to works as expected.
We are in the process of implementing (i.e. adding) WAI-ARIA support to the main navigation menu of a web portal. Menu is the one shown here:
Menu is implemented by means of classic <ul> / <li> / <a> DOM tree, styled with CSS to look like horizontal tabs.
What is a WAI-ARIA compliant implementation for such a widget?
I've read many parts of most recent WAI-ARIA specs from w3org for a general understanding, taxonomy, and so on.
Then I've read about several examples of UI widget implementations. I could not find any example specifically targetd at such a CSS navigation menu. The closest widgets I've always found around are the Menu, the MenuBar, and the TabPanel. Of course I also looked in Free ARIA Community group (where this question was originally posted).
I'd say that none of those widgets exactly match a (CSS) navigation menu. As an example, TabPanel may control some content in the page (--> aria-controls), maybe MenuBar too; but I'm not at all sure that a navigation menu controls content in the page (it controls the next page to show). Without going further, there are some other differences as well.
References are at the end of the post. If anyone as better (or more fit) examples of navigation menu, we'd be glad to know about them.
References
https://developer.mozilla.org/en-US/docs/Accessibility/ARIA/ARIA_Test_Cases#Menubar_and_Menu
http://wiki.jqueryui.com/w/page/38666403/Menubar
http://www.oaa-accessibility.org/examplep/menubar2/
http://test.cita.illinois.edu/aria/menubar/
http://dev.aol.com/dhtml_style_guide#menu
http://whatsock.com/modules/aria_tabs_menu_modules/demo.htm
http://www.w3.org/TR/wai-aria-practices/#menu
http://www.w3.org/TR/wai-aria/roles
http://www-03.ibm.com/able/resources/wai_aria_intro.html
A possible implementation would be:
HTML structure:
<div> <!-- Outer wrapper -->
<ul> <!-- Main navigation bar container -->
<li> <!-- First-level item without submenu -->
<a> <!-- Destination URL -->
</a>
</li>
<li> <!-- First-level item with submenu -->
<a> <!-- Destination URL -->
</a>
<ul> <!-- Second-level menu container -->
<li> <!-- Second-level item -->
<a>
</a> <!-- Destination URL -->
</li>
</ul>
</li>
</ul>
</div>
Roles:
role=”navigation” for outer wrapper <div>
role="menubar" for <ul> navigation bar container
role="menu" for second-level <ul> containers
role="presentation" for first- and second-level <li> menu items (they are not needed in the exposed accessible menubar structure)
role="menuitem" for first- and second-level <a> menu items
Properties:
aria-haspopup="true" for first-level <a> menu items having a submenu
aria-labelledby="ID of previous <a> menu item" for second-level <ul> containers
States:
aria-selected="true" on currently visited first- or second-level <a> item; aria-selected="false" on the other <a> items. That is to enforce the concept “selected <==> current page”
aria-expanded="true/false" for second-level <ul> containers
aria-hidden="true/false" for second-level <ul> containers
aria-activedescendant="" for main <ul> navigation bar container. This is an alternative to working with tabindex
tabindex=0 on currently visited <a> item; tabindex=-1 on the other <a> items. That is in order to first focus on the current page when tabbing to the navigation bar. It is an alternative to working with aria-activedescendant
Keyboard:
Tab: Move focus in/out of the menu from other points in the web application.
Shift+Tab: Move focus in/out of the menu from other points in the web application, in the reversed order.
Right arrow: Next navigation bar item
Left arrow: Previous navigation bar item
Enter: Activate currently focused item (i.e. navigate to corresponding URL)
Space: Activate currently focused item (i.e. navigate to corresponding URL)
Aug/2014: aria-selected Vs menuitem
In reply to #Joshua Muheim comment: now I can see from here, as well as from his reference, that aria-selected attribute is not allowed for menuitem role.
As I read from this recent SO answer there are some solutions given the current state of things, and there is a new proposed attribute too.
The ARIA design patterns provide expected UI behaviour for a range of custom controls http://www.w3.org/TR/wai-aria-practices/#aria_ex use of esc key to close and return to triggering element upon close is standard UI across desktop and web. Try it on any Google docs app (for example).
You can get a menu to announce 'X of Y' information by adding the aria-posinset and aria-setsize attributes to the elements with role=menuitem.
+Escape key should close an open menu and return focus to the element that opens it.
Escape to close is a standard going way back, it is expected behavior by many users.