Fórum

Tagging with dates

Tomasz Grysztar, modificado 14 Anos atrás.

Tagging with dates

Junior Member Postagens: 29 Data de Entrada: 06/05/09 Postagens Recentes
Is it conceivable to use tags system in order to associate some date with each article? I'm thinking about it because I need each article of some certaint type to have some date displayed, which should be entered by the user who writes the content, and should not be related to the display properties of the content (like display date or expiration date). And the same time I need to be able to quickly get a list of articles for each date - just like if I was searching by some tag.
The problems I see with this are that the amount of tags would quickly grow, as the amount of different dates would gradually increase over time. Is a bad idea, and are there any other mechanism that would help me with this problem?
thumbnail
Lisa Simpson, modificado 14 Anos atrás.

RE: Tagging with dates

Liferay Legend Postagens: 2034 Data de Entrada: 05/03/09 Postagens Recentes
Have you considered using the Blog portlet for that... It dates everything.
Tomasz Grysztar, modificado 14 Anos atrás.

RE: Tagging with dates

Junior Member Postagens: 29 Data de Entrada: 06/05/09 Postagens Recentes
But these dates are used as display dates. I'd like to make an independent date field, because sometimes the articles applying to future dates (even months or years in the future) would need to be displayed at present time.
Tomasz Grysztar, modificado 14 Anos atrás.

RE: Tagging with dates

Junior Member Postagens: 29 Data de Entrada: 06/05/09 Postagens Recentes
I have just noticed, that TagsAsset has some attributes called StartDate and EndDate. Maybe this is something I could use for this purpose?
However I don't know how to set the up from the Liferay UI for a given journal article, and also TagsAssetLocalServiceUtil has no option to search for assets having those two dates in a given frame (it only has variants with PublishDate and ExpirationDate).
Does anybody have an experience with this?
Tomasz Grysztar, modificado 14 Anos atrás.

RE: Tagging with dates

Junior Member Postagens: 29 Data de Entrada: 06/05/09 Postagens Recentes
I'm pretty sure that using those fields my solve my problem - I should be able to make a custom SQL query that would search for articles both based on tags and on the range of dates for the events that the articles apply to. The problem I'm stuck with, however, is that I still don't know if it's possible to extend the journal article portlet in such a way, that user would be able to enter those two dates (startDate and endDate) aswell. I'm able to modify the edit_article.jsp with a hook, but that's obviously not enough, since I have to put somewhere the code that will update the TagsAsset with the entered values.
I'd be grateful for any advice on how to do it.
Tomasz Grysztar, modificado 14 Anos atrás.

RE: Tagging with dates

Junior Member Postagens: 29 Data de Entrada: 06/05/09 Postagens Recentes
I'm sorry I'm making some kind of blog out of this thread, but I just want to finish with letting know how I solved the problem.
I created a TagsAsset ModelListener, which before update of the TagsAsset check out whether the asset is related to journal article with some specific fields inside the structure, those fields define the start date and end date of event, which article is related to. Then the listener modifies the startDate and endDate fields in asset to contain the same dates, as entered into journal structure.
I am now able to read the list of articles related to events in a given date range with custom SQL query - I made a servlet that serves such articles in a way similar to get_articles action, so that it's possible to get such list from XSL or VM template.