Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Mk Sin
Edit structure while add new webcontent ?
July 13, 2012 4:07 AM
Answer

Mk Sin

Rank: Junior Member

Posts: 74

Join Date: May 25, 2012

Recent Posts

Can anybody show me how to turn off that feature (on permission) please !

That is a lot of trouble with this feature emoticon
Jignesh Vachhani
RE: Edit structure while add new webcontent ?
July 13, 2012 4:20 AM
Answer

Jignesh Vachhani

Rank: Liferay Master

Posts: 785

Join Date: March 10, 2008

Recent Posts

could you please provide your details in descriptive more ?
DarshanKumar N Bhatia
RE: Edit structure while add new webcontent ?
July 13, 2012 4:21 AM
Answer

DarshanKumar N Bhatia

Rank: Junior Member

Posts: 85

Join Date: March 2, 2010

Recent Posts

Mk Sin:
Can anybody show me how to turn off that feature (on permission) please !

That is a lot of trouble with this feature emoticon


U mean to turn off "edit Structure" while adding new web content.

U want to hide it ?? Or U want to remove it permanently ??

So No user can view this feature / and even not able to use it ???
Mk Sin
RE: Edit structure while add new webcontent ?
July 15, 2012 5:41 PM
Answer

Mk Sin

Rank: Junior Member

Posts: 74

Join Date: May 25, 2012

Recent Posts

I mean I want to hide it for normal user (if it can be, I want check whether it feature hide or show base on user role)
Jignesh Vachhani
RE: Edit structure while add new webcontent ?
July 15, 2012 11:19 PM
Answer

Jignesh Vachhani

Rank: Liferay Master

Posts: 785

Join Date: March 10, 2008

Recent Posts

You can provide role based permission from control panel.

Follow below steps :
1) Go to control panel >> portal >> Roles
2) Go to user role and click on Action button >> Define Permissions
3) Now select the Web contetn section in Add Permissions section and you will see below screen, and from there you can set permission for structure and template
Attachment

Attachments: web-content.jpg (207.7k)
Mk Sin
RE: Edit structure while add new webcontent ?
July 17, 2012 1:11 AM
Answer

Mk Sin

Rank: Junior Member

Posts: 74

Join Date: May 25, 2012

Recent Posts

It doesnt work. Or I missing somthing emoticon

Attachment

Attachment

Attachments: edit.png (34.2k), roles.png (18.3k)
Tejas Kanani
RE: Edit structure while add new webcontent ?
July 17, 2012 9:37 AM
Answer

Tejas Kanani

Rank: Liferay Master

Posts: 655

Join Date: January 6, 2009

Recent Posts

Hi Mk,

If you just want to remove Edit Structure icon from Edit Web Content page as displayed in screen shot.
You need to make changes in OOTB web content jsp by removing/comment out Edit Structure option using Hook.
JSP file to change :- \html\portlet\journal\article\content.jsp

And just comment out below line. (Line : 235)
1<!-- <liferay-ui:icon id="editStructureLink" image="edit" url="javascript:;" /> -->


Hope you are looking for the same.

Regards,
Tejas
Jignesh Vachhani
RE: Edit structure while add new webcontent ?
July 17, 2012 10:44 PM
Answer

Jignesh Vachhani

Rank: Liferay Master

Posts: 785

Join Date: March 10, 2008

Recent Posts

Yes as pointed by Tejas,
You can hide it from code itself but in that case it could also not shown to administrator as well.
So you can make it conditional base like :
 1
 2<%
 3ThemeDisplay themeDisplay = (ThemeDisplay) req.getAttribute(WebKeys.THEME_DISPLAY);
 4long userId = themeDisplay.getUserId();
 5if(OmniadminUtil.isOmniadmin)
 6{
 7%>
 8<liferay-ui:icon id="editStructureLink" image="edit" url="javascript:;" />
 9<%
10}
11%


To Override this code you can create create jsp hook and get it work.
Mk Sin
RE: Edit structure while add new webcontent ?
July 17, 2012 11:58 PM
Answer

Mk Sin

Rank: Junior Member

Posts: 74

Join Date: May 25, 2012

Recent Posts

Thanks for reply.

I have another question about webcontent structure and template, I think I can post it here:

1. How to display image ( image field structure) with template, I had tried with $img.getData() but it give me C:/fakePath/imgName.png and can not display with img tag
2. Same question with document and media field
3. Is there no file upload field, is'nt it ? how can i attach my file (not image) in my structure / webcontent and show user link to download it
Jignesh Vachhani
RE: Edit structure while add new webcontent ?
July 18, 2012 12:16 AM
Answer

Jignesh Vachhani

Rank: Liferay Master

Posts: 785

Join Date: March 10, 2008

Recent Posts

Use below code in your template :

<a href="http://localhost:8080$image.getData()" target="_blank">Download Image</a>

And for structure use:

<?xml version="1.0"?>

<root>
<dynamic-element name="image" type="image" index-type="" repeatable="false">
<meta-data>
<entry name="displayAsTooltip"><![CDATA]></entry>
<entry name="required"><![CDATA]></entry>
<entry name="instructions"><![CDATA[]]></entry>
<entry name="label"><![CDATA]></entry>
<entry name="predefinedValue"><![CDATA[]]></entry>
</meta-data>
</dynamic-element>
</root>
Tejas Kanani
RE: Edit structure while add new webcontent ?
July 18, 2012 1:03 AM
Answer

Tejas Kanani

Rank: Liferay Master

Posts: 655

Join Date: January 6, 2009

Recent Posts

Hi Mk Sin,

1. How to display image ( image field structure) with template, I had tried with $img.getData() but it give me C:/fakePath/imgName.png and can not display with img tag

You can use the code which Jignesh has mentioned. By which you can make Image downloadable. I guess it should also work without using localhost:8080 in href. That way it will be dynamic and can be use on any machine with any host.

2. Same question with document and media field

Same thing you can do with Document and Media. But in that OOTB structure, you can't upload Document or Media while creating web content. There must be some Document Or Media already added in your Liferay to select from Web Content. Check below simple structure and template for the same.
Structure :
1<?xml version="1.0"?>
2<root>
3    <dynamic-element name="DocumentAndMedia" type="document_library" index-type="" repeatable="false"/>
4</root>


Template:
1<a href="$DocumentAndMedia.Data">Download Docuemnt/Media</a>


3. Is there no file upload field, is'nt it ? how can i attach my file (not image) in my structure / webcontent and show user link to download it

If you want to use Document And Media Tool available in Structure, you'll have to upload your document first in Document & Media portlet and then using above code you can make a link to download that content.
But If you are using Text Area(HTML) then while using Hyperlink option from editor, there is option to upload new document as well as you can select existing document from document and media folder.

HTH

Regards,
Tejas
Mk Sin
RE: Edit structure while add new webcontent ?
July 18, 2012 7:49 PM
Answer

Mk Sin

Rank: Junior Member

Posts: 74

Join Date: May 25, 2012

Recent Posts

Thank you emoticon

In velocity template it seem be easy to get webcontent value, but i dont know how to do it from jsp page :-? is there any localserviceutil to do this. I think I can use AssetEntryLocalServiceUtil get entry and somehow to get content of it but not able to clearly understand
Mk Sin
RE: Edit structure while add new webcontent ?
July 18, 2012 9:44 PM
Answer

Mk Sin

Rank: Junior Member

Posts: 74

Join Date: May 25, 2012

Recent Posts

ah, i find out myself emoticon thank everyone