How can I add a custom portlet to the Portal section of the Control Panel, as shown in the following figure:
Here is how to do it:
In your portlet's liferay-portlet.xml (you can check the DTD of this xml for more information on other tags) include two tags in your <portlet> tag as shown:
<portlet>
<portlet-name>MyCustomPortlet</portlet-name>
<icon>/mycustom.png</icon>
<!--
These are the two entries which are required for the portlet
to appear in the control panel
-->
<!--
Set the control-panel-entry-category value to "my", "content",
"portal" or "server" to make this portlet available in the
Control Panel under that category.
-->
<control-panel-entry-category>portal</control-panel-entry-category>
<!--
Set the control-panel-entry-weight value to a double number
to control the position of the entry within its Control Panel
category. Higher values mean that the entry will appear lower
in the Control Panel menu.
-->
<control-panel-entry-weight>100</control-panel-entry-weight>
<instanceable>false</instanceable>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
<css-class-wrapper>mycustomportlet-portlet</css-class-wrapper>
</portlet>
Also, if you don't want your portlet to appear in the Add Menu so that it is not put on other pages, then in your liferay-display.xml you can include:
<display>
<category name="category.hidden">
<!--
Adding your portlet to the hidden category would not display
the portlet in the ADD Menu on the top-left-hand corner
-->
<portlet id="MyCustomPortlet"></portlet>
</category>
</display>
Build and deploy your portlet and you are good to go.
Apart from the Answer by Prakash K, ajaxable and instanciable should be false.
Related
I want to achieve layout simmilar to Groove application, where hamburger menu is on the left and appbar on the bottom. However, not all pages contains appbar.
I have an usercontrol called MainFrame which contains the hamburger menu and a navigation frame.
When page is loaded into the navigation frame, the AppBar overlays the HamburgerMenu. I could just offset the HamburgerMenu, but not all pages contains the AppBar, or the AppBar's height is different.
Is it possible to show the hamburger on top of appbar? Or do you have any other ideas?
Use CommandBar instead of Page.BottomAppBar. Also, it is the recommended way for UWP by Microsoft.
You should use the AppBar only when you are upgrading a Universal
Windows 8 app that uses the AppBar, and need to minimize changes. For
new apps in Windows 10, we recommend using the CommandBar control
instead.
Set the CommandBar in the content Grid of HamburgerMenu
Here is a sample code:
<controls:HamburgerMenu>
<!-- Items -->
<controls:HamburgerMenu.ItemsSource>
</controls:HamburgerMenu.ItemsSource>
<!-- Options -->
<controls:HamburgerMenu.OptionsItemsSource>
</controls:HamburgerMenu.OptionsItemsSource>
<!-- Content -->
<Grid x:Name="ContentGrid">
<Frame Name="MainFrame"/>
<CommandBar VerticalAlignment="Bottom"/>
</Grid>
</controls:HamburgerMenu>
This is SO confusing. I have an Xpage application built with the application layout control. I have 2 Title Bars which each have a navigation element in them with two views each.
I want the selected Title Bar and view to be highlighted. I understand that somehow this involves the Navigation Path and the use of the selected and/or selection properties,, but I do not understand how they work or interact.
Can these answers help you? How do you use the Selected property of the navigator?
You need to set the navigationPath property on each XPage and this must match the selection property (using regex) on the navigation control.
Updated with answer to the comment below
Here's an example XPage for the Home tab and the navigation control for Home:
<xc:layout navigationPath="/Home/XPage1">
<xp:this.facets>
<xc:layout_menu_home xp:key="facetLeft"></xc:layout_menu_home>
<xc:content_xpage1 xp:key="facetMiddle"></xc:content_xpage1>
</xp:this.facets>
</xc:layout>
The layout custom control uses the xe:applicationLayout to control the layout. In this case it has a custom property called navigationPath which is used in the example XPage above. The corresponding navigationPath property of the xe:applicationLayout must be set to this custom property:
<xe:applicationLayout id="applicationLayout">
...
<xe:this.configuration>
<xe:oneuiApplication
navigationPath="${javascript:compositeData.navigationPath}">
Here's part of xe:applicationLayout for handling the two tabs in your layout custom control:
<xe:this.titleBarTabs>
<xe:pageTreeNode page="/xpage1.xsp" label="Home" selection="/Home/.*"></xe:pageTreeNode>
<xe:pageTreeNode page="/xpage3.xsp" label="Tips" selection="/Tips/.*"></xe:pageTreeNode>
</xe:this.titleBarTabs>
Here's an example navigation control for Home:
<xe:navigator id="navigator1" >
<xe:this.treeNodes>
<xe:pageTreeNode page="/xpage1.xsp" label="XPage 1" selection="/Home/XPage1"></xe:pageTreeNode>
<xe:pageTreeNode page="/xpage2.xsp" label="XPage 2" selection="/Home/XPage2"></xe:pageTreeNode>
</xe:this.treeNodes>
</xe:navigator>
I have a Jsp that dynamically needs to get included in entire project as user opens any jsp. i.e. As a user opens a jsp my jsp should automatically gets included.
I have written this in web.xml in Tomcat
<jsp-property-group>
<url-pattern>/webapps/ROOT/html/*.jsp</url-pattern>
<url-pattern>*.jspf</url-pattern>
<el-ignored>false</el-ignored>
<scripting-invalid>false</scripting-invalid>
<is-xml>false</is-xml>
<include-prelude>/WEB-INF/jsp/tracker.jsp</include-prelude>
<!-- <include-coda>/template/coda.jspf</include-coda> -->
</jsp-property-group>
I had kept my jsp in tomcat under WEB-INF/jsp/ and i want to include it into every porject as it contains a code that tracks log for user.
Or any other way to make this happen.
Thanks.
There is one more way to include your JSP for the whole portal and i.e. the dockbar.
You can create a hook and include your jsp in the /html/portlet/dockbar/view.jsp using either <jsp:include /> or <liferay-util:include /> or simple <%# include file="" /> (this would be static).
<jsp:include page="/jsp/yourJSPPageToBeIncluded.jsp" />
OR
<liferay-util:include page="/jsp/yourJSPPageToBeIncluded.jsp" />
OR
<%# include file="/jsp/yourJSPPageToBeIncluded.jsp" />
Note: the path may differ depending on where you will be putting the JSP.
Why I am choosing dockbar is because it is present on all the portal-pages of liferay. This won't work if you are opening a pop-up like configuration pop-up or look-and-feel pop-up or other custom dialog pop-ups since dockbar is not present in the pop-up. For using in pop-ups you would have to override portal_pop_up.vm in your custom-theme and write the code as suggested by #VikasV
$theme.include($themeServletContext, "/jsp/yourJSPPageToBeIncluded.jsp")
There are two ways for this.
Simple way is to include your JSP in the Theme. When your Theme is applied to your project, and when Theme is rendered, any pages in your project will render this included JSP.
Code sample below. This has to be placed in vm file(navigation.vm).
$theme.include($themeServletContext, "/jsp/yourJSPPageToBeIncluded.jsp")
Here, JSP folder is placed directly inside Theme war.
Other way (tedious one), is to include this JSP in each and every JSP page that you want this to be included.
Use <jsp:include> element for this.
Some references,
Ref1
Ref2
I've created a feature with a content type:
<ContentType ID="0x01007C963A8770A24bbfBDBCE157B96EE769"
Name="Send" Group="Demo" Version="1">
</ContentType>
I want to create custom actions for this content type.
This works on the ECB (the popup menu of every item's title):
<CustomAction
Id="Demo.Send.PopupMenu"
Title="Send"
Location="EditControlBlock"
Description="Hold"
RegistrationType="ContentType"
RegistrationId="0x01007C963A8770A24bbfBDBCE157B96EE769">
<UrlAction Url="http://www.google.com/search?q={ItemId} Cookies"/>
</CustomAction>
However, I can't get it to work on forms' toolbars (edit or display):
<CustomAction
Id="Demo.Send.DisplayFormToolbar"
Title="Send"
Location="DisplayFormToolbar"
Description="Send"
RegistrationType="ContentType"
RegistrationId="0x01007C963A8770A24bbfBDBCE157B96EE769"
Sequence="108">
<UrlAction Url="http://www.google.com/search?q={ItemId} Cookies"/>
</CustomAction>
I don't get any error message, I just can't see the button.
It is working if I change the RegistrationId to 0x01, but then I see it on all content types (all items, really).
Any idea what's wrong with this code?
I seem to remember there being issues with content types when they didn't have all capitals in the identifier, both for the definition and when using.
Try
RegistrationId="0x01007C963A8770A24BBFBDBCE157B96EE769"
But completely remove the everything that refers to the content type. (or try a new one)
I was wondering if someone could help me out with Sharepoint 2007. What I want to do is to add a custom menu item to a context menu (the menu that opens when you click a document or another item).
Right now, the menu looks like this:
picture
I want to add an item, "Do stuff" for example, to this menu. Major problems:
I wish this item to appear only in menus for a certain file type (e.g. only for .html but not for .doc);
When I click this item ("Do stuff"), I want to call custom external code (written in C#, either an exe or a DLL), which accepts the name of the clicked file as an input parameter.
I understand the way to achieve this is by using Custom Actions (no javascript editing required in 2007, right?). But since I'm quite new to MOSS, I'm a bit lost and not sure what exactly to do and where to start, so any help is greatly appreciated.
You have to implement a CustomAction like this:
<CustomAction
Id="YourUniqueId"
Location="EditControlBlock"
RegistrationType="FileType"
RegistrationId="html"
Sequence="20"
Title="The text you want">
<UrlAction Url="~site/_layouts/company/ActionPage.aspx?List={ListId}&ID={ItemId}" />
</CustomAction>
What you put in the Url of UrlAction depends on what you want to do. It can be JavaScript or the url of a Page or Handler.
In my example it's a Page which gets the QueryParameters so that SPContext.Current.ListItem will contain the selected documents listitem.
<?xml version="1.0" encoding="utf-8"?>
<Elements Id="d0574a32-59ce-4561-9496-ccf17da37a35" xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="Test2"
Location="EditControlBlock"
RegistrationType="FileType"
//docx = documents, txt = text files, html = html files**
RegistrationId="docx" Sequence="10"
Title="View Item Properties">
<UrlAction Url="~site/_layouts/WSSHOL/ViewPageRedirect.aspx?listid={ListId}&itemid={ItemId}" />
</CustomAction>
</Elements>