Liferay Custom fields on User object - liferay

I have created three custom fields on user object. Those fields are listed on "Custom Fields" under "Miscellaneous" section.
I need those fields on "Details" under "User Information" section.
Some one can help me how fix that issue I need those fields in "Details" section.

You need to create a both a jsp hook to add the field, and a BaseStrutsPortlet for that portlet. your liferay hook will resemble this
<hook>
<language-properties>
content/Language_es.properties
</language-properties>
<custom-jsp-dir>/custom_jsps</custom-jsp-dir>
<struts-action>
<struts-action-path>/my_account/edit_user</struts-action-path>
<struts-action-impl>
org.yourpackage.hook.UpdateUserInfoHook
</struts-action-impl>
</struts-action>
</hook>
then on your custom_jsps you should replace the original with
/custom_jsps/html/portlet/users_admin/user/details.jsp
I recomend you get the original file from liferay source code.
Once you got your field in your jsp inside your UpdateUserInfoHook you have to extend BaseStrutsPortletAction
public class UpdateUserInfoHook extends BaseStrutsPortletAction {
Hope this helps.

Related

I can't get the launch function to work on the Related Entity control

This relates to and extends an existing StackOverflow case that has been answered -
How to place a 'Related Entity' lookup on a field (many thanks to Acumatica support on this as well)
I have a custom screen that adds a 'Related Link' control, like this:
And this works as expected. I've also included several custom screens as entities to link to by adding the NoteID, RefNoteID, RelatedEntity fields to their DACs and the PXRefNoteSelector attribute to their view declarations. Everything works as expected, except that the pencil icon doesn't launch to the entity / screen that's been selected.
Is there something (an attribute, perhaps) that I'm missing in the DACs that needs to be added in order to launch to the selected entity?
You need to decorate the custom entity DAC with PXPrimaryGraph attribute and pass the maintenance page graph type in parameter:
[PXPrimaryGraph(typeof(CustomEntityMaint))]
[Serializable]
public class CustomEntityDAC : PX.Data.IBqlTable
{
}

Access content field from views in Orchard CMS 1.10.1

I would like to display certain first level menuitem in bold.
This setting should be done by a checkbox when the user create / edit a menu item. (I have a workaround using the Model.Href, but it is not nice).
So I created a boolean field in Content definition / Menuitem URL (I don't know the name of the corresponding content definition in English Orchard).
How to access a custom field (Content Field) from a view?
(There already is a view which is used to customize the menu)
The examples I found use custom shapes, where the fields are accessed as built in fields (e.g. Model.ContentItem.FieldName ). But this is a different case.
With the help of "Piedone", the solution:
Model.Content.ContentItem.MenuItem.FieldTechnicalName.Value
Explanation
Examining the Model object in Visual Studio, the Model is a dynamic shape that have eg. Href property and a Content.
Content is a MenuPart, that is a content part that have a ContentItem property with the content item itself. Technically only content parts have Fields. When you (seemingly) add a field to a type it will be a part corresponding the type's name, that is MenuItem in this case (It's confusing that the display name of 'MenuItem' content type is Custom Link...)
The field's technical name is as you name it. When you add to a type, the Value will be a property of the BooleanField class. (By the way, it is nullable, so if you dont't save after adding the field, it will be null else the value you set).

How can I add extra properties to document metadata field types in Liferay 6.1?

I'm new to Liferay and I have the following situation:
I would like to add extra properties to document metadata field types in Liferay 6.1.20.
For example, I would like to add property 'readonly' to select boxes (see image), as it is a user requirement to show some controls disabled.
Should I use the Expando functionality, a jsp override hook or another approach?
I think Expando functionality, a jsp override hook are a good approach.But using Expando you cannot create it as mandatory field.

How to access custom fields of a page in the theme template

I'd like to use custom fields to display some page specific strings in the theme.
I have created a custom field "intro" of type Textbox.
How do I access the data in the theme template (velocity)?
As there is no "introspection" which variables are declared, I find it very difficult to figure out how to access them. The documentation is far from usable on the topic of custom fields :-/
If you definde custom attribute in a page than you can use
$layout.getExpandoBridge().getAttribute("intro")
Also see javadoc or source for com.liferay.portlet.expando.model.ExpandoBridge
if you need use in template FTL, in my case for menu navigation template
<#assign prop = navItem.getLayout().getExpandoBridge().getAttribute("prop_name") >
Work for me in Liferay 7+:
Create a custom field type "site", fill data into site settings, and use into theme template for call this data into liferay theme:
If a VM file:
#set ($site_custom_field = $layout.getGroup().getExpandoBridge().getAttribute("site_custom_field_key"))
<h1>$site_custom_field</h1>
If a FTL file:
<#assign site_custom_field = layout.getGroup().getExpandoBridge().getAttribute("site_custom_field_key")>
<h1>${site_custom_field}</h1>
Have a nice day!

how to apply custom action in ECB only for document item

I have added a menu item in edit control block(ECB) in document library(using following msdn article http://msdn.microsoft.com/en-us/library/ms473643.aspx)
Now i found that the custom action(menu Item) in ECB is displayed for both document item and document folder. So how to apply custom action only for document item?
Are you using list as your RegistrationType?
Try using ContentType as your RegistrationTypeand specify the guid of the Document Content Type (I think its 0x0101) in your RegistrationID.
You will need to create a class which inherits from WebControl. This class will need to render out your menu item as you want it displayed.
You then need to use the ControlAssembly and ControlClass parameters from your CustomAction definition to specify this class.
Your class will need to detect the if the current item is a document or folder and render/not render itself accordingly.
I would get the control working first just displaying a link, then add the logic in later.
This is a good blog posting on the technique, its not for the ECB but the principals are the same.
Enjoy!
In your customAction use RegistrationType="FileType" to determine FILE and use a RegistrationId="doc" to determine a extension, my exemple use word document. ;-)

Resources