"Publish Version" Hook Plugin

Publish Version Hook  Plugin

Thiss article is described about the Custom Publish Version hook which is available in Community plugins. Using this hook, we can revert back old version of journal aticle easily.

Journal Portlet:

The Journal portlet provides a user interface to the admin or content owner to add , edit , delete ,expire  the articles and displaying all the versions of  article.

All versions will be displayed in the list of available Journal Articles as shown below:

(Edit Article --> View History)

A new version will be generated automatically if article is modified

Version Handling

Managing version is having  some limitations in Liferay that users cannot publish the old version of the article. If user s want to publish the old version, they should expire all the versions of the article which we cannot revert back once done. 

eg.,  a  article has more than 100  versions since  it has been modified for 100 times, but  user wants to re-publish   1.1 version which is initial version of the article. Then, they have to expire all  99 versions [ 1.2  to  1.100 ]  which is hectic and not safe for expiring all the articles  in a huge content management portal as anytime we may need to revert back  some version of the article.

Publish Version Hook

 I have developed  struts action Hook plugin by customizing jsp(s)  and action files of the  journal article  for publishing any version of the article.

This  PublishVersion-Hook  plugin helps  article’s admin or content owner to re-publish the article without expiring the old versions.  User cannot publish the Multi Articles or Expired article  and Latest version.

 

 

Use Cases :

 

  1. Update the Article through web content display portlet  or control panel.

     2.   A new version will be generated automatically if article is modified each time.

     3.   Click  View History section where all the version of the articles will be displayed as shown below

 

 

4.    Select old version of the article and click Publish.

 

 

5.  You cannot publish Latest / Expired / Multiple articles at a time .

 

 

Technical Explanation:

I have developed this plug-in in Struts Action Hook.   Reason for developing Struts Action Hook is, I was planning to learn Struts Action Hook for long time since this new feature introduced. So, finally done it. J

I have overridden the existing Struts Action /journal/edit_article which extends BaseStrutsPortletAction and    In View History Page [view_article_history.jsp &   article_version_action.jsp], new Publish buttons are added to publish the selected version.   

When publishing  the  selected version, it is redirecting to Custom Struts Action class where I have written my logic to change the selected version’s count  as latest version by increasing 1 with latest version.   So automatically latest version will be displayed.

 

JournalArticle selectedVersionObject = JournalArticleLocalServiceUtil.getArticle(selectedId);

selectedVersionObject.setVersion(MathUtil.format(lVersion + 0.1, 1, 1));   //increasing 1 with latest version

JournalArticleLocalServiceUtil.updateJournalArticle(selectedVersionObject);

Download URL

 

/for 6.2.0 GA2 release :

Publish-Version-hook-6.2.0.1.war/download

 

If any queries / suggestion about this hook, Please feel free to reach me : gnaniyar@gmail.com

 

-  Gnaniyar Zubair

gnaniyar@gmail.com

 

0 Allegati
13860 Visualizzazioni
Media (5 Voti)
La media del punteggio è 4.6 stelle su 5.