掲示板

Cannot preview a web content without publishing it

9年前 に Julien Colin によって更新されました。

Cannot preview a web content without publishing it

New Member 投稿: 6 参加年月日: 14/05/15 最新の投稿
Hi everyone and thanks to anyone willing to help me !

My use case is the following : I want to be able to preview (within a page) a webcontent that's in "draft" (not yet approved) mode, i.e only logged-in administrators can preview this new content and not guest users. I'm on Liferay 6.1.1 GA2.

-> The native preview feature from Liferay doesnt allow me to do that, because only the content is previewed, not the entire page with the new the draft content.
-> I tried to use an empty asset publisher, and then use the 'Display Page' feature in the web content editing menu. It works well, but only when my content is published... I can't see the content inside the asset publisher if it is in "draft" mode..
-> I'd better not use the 'Staging' feature of Liferay, because it is too much heavy for my current need.

After trying these features, I realized that it's really ok if the content is published, as long as guest users can't see it , and only admin can. So I tried to publish my content and then play with the permissions related to this content, trying to remove the "View" permissions for Guest users, but it doesnt seems to do the trick.

Does anyone know if there is a way to achieve what i'm trying to do with this version of Liferay ?

Thank you for any bit of help !

Best regards,
Julien.
9年前 に Oliver Bayer によって更新されました。

RE: Cannot preview a web content without publishing it

Liferay Master 投稿: 894 参加年月日: 09/02/18 最新の投稿
Hi Julien,

the bad news is you can't do it without coding a custom solution for it. The good news is I'm working on a solution (simple Liferay hook) for this emoticon. I've started this work years ago (see the following ticket) but a few months ago I've found a much more simpler and better solution for this without having to use the impersonation functionality as stated in the mentioned ticket. I've not completely finished it yet but if you're interested let me now.

Regards Oli
9年前 に Julien Colin によって更新されました。

RE: Cannot preview a web content without publishing it

New Member 投稿: 6 参加年月日: 14/05/15 最新の投稿
Hi Oliver,
and thanks for quick answer. I actually came across the ticket you're talking about before , I was interested but didnt know if it was still up-to-date (considering the date of latest comment).
Of course I'm really interested If you found a quicker solution (to be honest , I just went through the ticket quickly, and I can't say I understood it all). Please let me know about it (I don't know if there is a PM feature on this forum , otherwise I can let you know my mail).

Julien.
9年前 に Oliver Bayer によって更新されました。

RE: Cannot preview a web content without publishing it

Liferay Master 投稿: 894 参加年月日: 09/02/18 最新の投稿
Hi Julien,

yeah you're right. It's been a while since I last contributed to this ticket emoticon. I've started this ticket back in the beginning days of my use of Liferay (5.2.x). That's one reason why my first approach was way to complicated emoticon. The idea behind was that an omniadmin has the permission to impersonate users in the control panel (e.g. for debugging reasons) and I extend this for all webcontent editors. The not-so-good "solution" was to impersonate the guest user and show the expired and not approved articles too. The drawback was that this workaround would not work on private pages because the guest user is not allowed to access these.

The new approach use a simple url parameter to check if the webcontent editor is in "page preview" mode or not. If you're using Liferay v6.2 I can try to finish the hook until next week. Ok emoticon?

Greets Oli
9年前 に Julien Colin によって更新されました。

RE: Cannot preview a web content without publishing it

New Member 投稿: 6 参加年月日: 14/05/15 最新の投稿
Alright, that would be very nice ! emoticon
'The new approach use a simple url parameter to check if the webcontent editor is in "page preview" mode or not'
What do you mean by 'webcontent editor' ? Are you talking about the page to create a new content in the Control Panel ?

Are you developing in open-source mode ? Is there a way to access to your code ?

Thanks a lot !

Julien
9年前 に Oliver Bayer によって更新されました。

RE: Cannot preview a web content without publishing it

Liferay Master 投稿: 894 参加年月日: 09/02/18 最新の投稿
I should have been more clear, sorry emoticon. With "webcontent editor" I've meant the person in charge of the contents of websites (someone with the role "Editor").

Internally my hook checks for the journalArticle model if the update permission is set (or not) for the role of the current user. So if some unauthenticated guest user is trying to use this parameter he wouldn't see any of those expired/ not-approved articles. The url parameter "page preview" on the other hand is responsible for switching between the default mode and the preview mode. It will be clearer -hopefully emoticon- if I manage to release this hook next week accompanied by some more detailed info in my first blog entry (assuming that the daily work doesn't keep me from doing this).

Of course I'm planning to release it as an opensource / freeware Liferay hook. I'll maybe try to release it as a Liferay app later so it can be downloaded from the marketplace. Inofficially I'm preferring the following licence or some modified ones like pizza or books emoticon.

Oli
9年前 に Oliver Bayer によって更新されました。

RE: Cannot preview a web content without publishing it

Liferay Master 投稿: 894 参加年月日: 09/02/18 最新の投稿
Hi Julien,

I've attached the first version of my webcontent preview hook. Give it a try. do some testing and if you like it and no errors occur (hopefully) I will attach this to my jira ticket too and I will try to release it as a marketplace app emoticon. Please give me some feedback on how it's working in your usecase.

Oli
9年前 に Julien Colin によって更新されました。

RE: Cannot preview a web content without publishing it

New Member 投稿: 6 参加年月日: 14/05/15 最新の投稿
Hi Oliver,

Awesome emoticon, I hope I can give it a try very soon and provide you some feedbacks...
Unfortunately, the version of Liferay I'm currently working on is 6.1.1 GA2 , so I have no idea wether your module will be compatible with it or not. Anyway I will try very soon and I will keep you informed.

Thanks again,

Julien
9年前 に Oliver Bayer によって更新されました。

RE: Cannot preview a web content without publishing it

Liferay Master 投稿: 894 参加年月日: 09/02/18 最新の投稿
As I've checked the attached war file I found out that it's not the right one sorry. I've attached a better one emoticon.

I don't think it will work ootb in Liferay v6.1.1. But it shouldn't be too hard to migrate it for your Liferay version. Maybe you can first check it with the newest release and if you like it I can help you in the migration process.

Oli
9年前 に Julien Colin によって更新されました。

RE: Cannot preview a web content without publishing it

New Member 投稿: 6 参加年月日: 14/05/15 最新の投稿
Ok good idea,
I've just installed a 6.2 version and deployed your hook on it, but I can't figure how is this suppose to work. Could you describe me the basic workflow of what you would do in order to test the new feature ?
I Created a new web-content and saved it as draft... I realized I have a new preview button in the control panel dockbar, but clicking on it only makes Liferay refreshing the page and nothing really happens.

Thank you for any hint,

Julien!
9年前 に Oliver Bayer によって更新されました。

RE: Cannot preview a web content without publishing it

Liferay Master 投稿: 894 参加年月日: 09/02/18 最新の投稿
No problem emoticon. If you've created the article in the control panel section my hook doesn't apply.

Here is a small test case on how to use it:
  • add a new web content display portlet to a page
  • add a new web content/ article by clicking the edit icon in the web content display portlet added in the first step
  • add some content, save the article but don't approve it
  • as a first change you should notice that you not only see a message "xy is not approved" BUT you will also see the content right away (semitransparent)
  • now if you click the page preview mode button the page gets reloaded and you will see the article as it would look if it would have been approved
  • if you combine this with a click on the icon below to hide the edit icons you will see the page like an unauthenticated guest user if the article would have been approved.

Greets Oli
9年前 に Oliver Bayer によって更新されました。

RE: Cannot preview a web content without publishing it

Liferay Master 投稿: 894 参加年月日: 09/02/18 最新の投稿
Any updates/ feedback on your testing progress emoticon?
9年前 に Julien Colin によって更新されました。

RE: Cannot preview a web content without publishing it

New Member 投稿: 6 参加年月日: 14/05/15 最新の投稿
Hi Oliver,
yes I did test your program ... It's good in the sens that it answers my need , but I realized I cannot use it as it is right now in my current context.
On my Liferay (customized one) , users are not able to create/edit web contents using WYSIWYG mode (directly on the page) , they absolutely need to do that from the control panel. So I think there is a lot of adaptation to do to your hook if I want to use (port it on Liferay 6.1 + adapt it so it can be used through control panel) ...
Nevertheless, I suggest you to push your feature to Liferay Team, because I think this requirement is pretty obvious for many Liferay users who dont want to dive into this "Staging" feature.
On my side; I started to look for another solution using web content persmissions. In the future, I may look forward to "fork" your hook, and make it something slightly different.

Thank you for all your help !

Julien.
9年前 に Oliver Bayer によって更新されました。

RE: Cannot preview a web content without publishing it

Liferay Master 投稿: 894 参加年月日: 09/02/18 最新の投稿
Hi Julien,

thanks for your answer and your kind words emoticon.

The migration process for 6.1 should be relatively easy and even for your usecase/ context it should be doable. Maybe you can implement it like this:
  • for the control panel add a new link/ button "select preview page"
  • add a new jsp "select preview page" where the user sees a list of pages where the current article is used
  • create a link to each of these pages and adding the parameter "pagePreview=true" so the initial hook is getting used/ placed at

Not sure if it's that easy this is just the first idea that came into my mind thinking about your requirements emoticon. Maybe you can incorporate it in my hook. If you need help let my know.

Oli
9年前 に Gauthier JACQUES によって更新されました。

RE: Cannot preview a web content without publishing it

New Member 投稿: 1 参加年月日: 15/03/20 最新の投稿
Hi Oliver,

I'm also interested in such feature, but with some adaptation. Is there anywhere we can find your source code (gitthub, bitbucket, ...) ?

Thanks, best regards,

Gauthier
9年前 に Oliver Bayer によって更新されました。

RE: Cannot preview a web content without publishing it

Liferay Master 投稿: 894 参加年月日: 09/02/18 最新の投稿
Hi Gauthier,

first of all sorry for the late reply. The last few weeks have been busy and then there were the easter holidays emoticon.

You can find the code directly inside the hook emoticon. It only relies on one url parameter and some permission checking in jsps (more or less). So it shouldn't be too hard to take this hook as a starting point for further customizations. I've exported all modifications into *_ext_hrw.jsp.

May I ask you: what do you want to modify? If you need more info or any help feel free to ask again.

I've proposed this feature for Liferay 7 as you can see in this community expedition post so maybe .... emoticon.

Regards Oli