|
|
|
This is the new version of the Summary Plugin.
Please unzip it, name it to SummaryPlugin and put the SummaryPlugin .java file in plugins\src\org\blojsom\plugin\common, and the admin-summary.vm in \plugins\src\org\blojsom\plugin\common\templates * Please paste quicktags.js in your Web Application directory. Can you create a source bundle and a JAR version of the plugin? Then I can add it to the SourceForge download page for the blojsom 3 plugins.
I'd suggest summary-plugin-<version>.jar for the JAR name and summary-plugin-<version>-src.zip for the source bundle. Hi,
For convenience, i have made this into a separate package called 'summary' and not put it in 'common'. So the entry for this in blojsom-plugins.xml is now this: <bean id="entry-summary" class="org.blojsom.plugin.summary.SummaryPlugin" init-method="init" destroy-method="destroy"> <property name="servletConfig"> <ref bean="servletConfigFactoryBean"/> </property> <property name="eventBroadcaster"> <ref bean="eventBroadcaster"/> </property> <property name="blojsomProperties"> <ref bean="defaultProperties"/> </property> <property name="minWords"> <value>30</value> </property> <property name="maxWords"> <value>50</value> </property> </bean> I am attaching the .jar and the source file -Shalini I have attached the files at at http://jira.blojsom.com/jira/browse/BLOJSOM-227
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
1. Description
Summary Plugin helps one to display a snippet of the entry and add a hyperlink "Read More ..." to the description. This Plugin allows the user to enter a summary while posting the entry. If user chooses to leave this summary field blank, the Plugin generates a summary based on the entry's content.
2.Usage and Installation
* To use this Plugin, add the following to blojsom-plugins.xml
<bean id="entry-summary" class="org.blojsom.plugin.common.SummaryPlugin" init-method="init" destroy-method="destroy">
<property name="servletConfig">
<ref bean="servletConfigFactoryBean"/>
</property>
<property name="eventBroadcaster">
<ref bean="eventBroadcaster"/>
</property>
<property name="blojsomProperties">
<ref bean="defaultProperties"/>
</property>
<property name="minWords">
<value>30</value>
</property>
<property name="maxWords">
<value>50</value>
</property>
</bean>
Note, please do specify the values for minWords and maxWords.
* Please do activate the Plugin through Admin Console as explained above.
* To use this to provide a 'Read More' options for the posts, please add the following in ocean-entry.vm (or whatever equivalent in your choice of template)
#if(!$BLOJSOM_PERMALINK)
#if($entry.getMetaData() && $entry.getMetaData().get("summary"))
$entry.getMetaData().get("summary")
#end
#end
#if($BLOJSOM_PERMALINK)
<div class="post">
$entry.getDescription()
#TechnoratiTags($entry)
</div>
#end
#if(!$BLOJSOM_PERMALINK)
<strong><a href="$permalink" title="Permalink of "$nqTitle"">Read More ...</a></strong>
#end
3.Algorithm Details
* The post content (entry description) is split first on a '.' , a '!' or a .?. This gives us all the sentences of the post.
* Summary = ""
* while (more sentences)
o append next sentence to Summary
o split Summary on 'space' to get words
o if(number of words within range) return Summary
o else if(number of words exceed range) truncate Summary so that number of words = maxWords and return Summary
4.Other Similar Plugins
* Show Me More Plugin
5.Important Details
* The summary is generated from the first few sentences of the post. If incase these are not plain text, but images, or links, to keep these intact and prevent them from getting lost or truncated, I have preprocessed the post content using an HTML parser. Note, this will not, at all, disturb the post content. It simply extracts the text from within the <> </> tags in order to generate the summary.
* A small change has been made in quicktags.js in the edInsertLink(myField, i, defaultValue) function. This prompts the user to enter a description for his LINKS so that they do not get truncated as in the Show Me More Plugin. This description, is what is used by the HTML Parser. If not entered, it defaults to the Link itself. This was already present for IMAGES. This is needed so that if links/images are present in the beginning of the post (i.e. the part of the post that is used to generate the Summary) they stay intact and do not break or get truncated. The Summary then will display the Text thats between the tags (done by the HTML preprocessor) and when one clicks 'Read More', the image/link will be displayed properly in the Post.
I am attaching the new archive SummaryPlugin(new) here. Please unzip it, name it to SummaryPlugin and put the SummaryPlugin .java file in plugins\src\org\blojsom\plugin\common, and the admin-summary.vm in \plugins\src\org\blojsom\plugin\common\templates
* Please paste quicktags.js in your Web Application directory.