Christophe,
first you say "Hi JSPWiki Developpers" , but you sent the mail to the
jspwiki-user list, instead of the jspwiki-dev list.....
Then about your requirements, the first one seems valid to me.
The second one, I'm not sure if I read it correctly, but isn't this already
available in a patch for JSPWiki-100 ?
regards,
Harry
2008/1/30, Christophe Dupriez <[EMAIL PROTECTED]>:
>
> Hi JSPWiki Developpers!
>
> As I am preparing upgrade from 2.4 to 2.6, I list hereby the changes made
> to two JSPWiki plugins:
> 1) RecentChangesPlugin where a new attribute "referring" allows to
> list only changes to pages referring to a given page
> 2) ReferringPagesPlugin where I propose the same functionalities
> than the one recently discussed (count, last modification date) but without
> adding attributes to the existing Plugin.
>
> If the specifications / examples below are appealing for the community, I
> will forward the modifications made for 2.6 (after testing!)
>
> Christophe
>
> *** MODIFICATIONS TO ADD a referring='PageName' attribute to the
> RecentChanges plugin ***
> *** PageName can be {$username}: the pageName is Wikified.
> *** List only pages recently changed that contains a link referring to a
> given page (User page, category, etc.)
> *** Allows a user to know the pages (s)he signed recently modified.
> *** Example: !Changes to pages signed by [{$username}]:
> *** [{INSERT
> com.ecyrd.jspwiki.plugin.RecentChangesPluginreferring='{$username}'}]
>
>
> Within src\com\ecyrd\jspwiki\plugin\RecentChangesPlugin.java, we add:
> import java.security.Principal;
> import com.ecyrd.jspwiki.ReferenceManager;
> import com.ecyrd.jspwiki.parser.MarkupParser;
> ...
> private static final String PARAM_REFERRING = "referring";
> ...
> (((Within function execute, after:)))
> //
> // Which format we want to see?
> //
> if( "compact".equals( params.get(PARAM_FORMAT) ) )
> {
> spacing = 0;
> showAuthor = false;
> showChangenote = false;
> }
> (((Please Insert:)))
> ReferenceManager mgr = engine.getReferenceManager();
> Collection filterRef = null;
> Object ptr = params.get(PARAM_REFERRING);
> if (ptr != null) {
> String pageName = (String) ptr;
> if ("".equals(filterRef)||"{$username}".equals(pageName)) {
> Principal currUser = context.getCurrentUser();
> if (currUser != null) pageName = currUser.getName();
> else pageName = null;
> }
> if (pageName != null) {
> pageName = MarkupParser.cleanLink( pageName );
> filterRef = mgr.findReferrers( pageName );
> log.debug("Pages referring to "+pageName+" = "+filterRef);
> }
> }
>
> (((BEFORE :if( !isSameDay( lastmod, olddate ) ) INSERT:)))
> boolean accepted = true;
> if (filterRef != null) accepted = filterRef.contains(
> pageref.getName());
> if (accepted) {
> (((ADD A CLOSING } JUST AFTER THE COMMENT AFTER // Revert note )))
>
> **** MODIFICATIONS TO ALLOW DISPLAY OF THE NUMBER OF REFERRING PAGES
> WITHOUT THE LIST
> **** AND TO ALLOW DISPLAY OF THE LAST MODIFICATION DATE.
> **** max=0 : no list of pages
> **** extras='... %d = number of pages ... %m = last modification date ...'
> **** EXAMPLE: [{INSERT ReferringPagesPlugin max=0 extras='%d pages, last
> modification: %m'}]:
> (((WITHIN src\com\ecyrd\jspwiki\plugin\ReferringPagesPlugin.java, REPLACE
> the following block of instructions: )))
> if( links != null && (links.size() > 0) )
> {
> if (extras.indexOf("%m") >= 0) m_lastModified = true;
>
> links = filterCollection( links );
> wikitext = wikitizeCollection( links, m_separator, items
> );
>
> if( (links.size() > 0) && (items < links.size()) && (items
> >= 0) )
> {
> extras = TextUtil.replaceString( extras, "%d",
> ""+(links.size()-items)
> );
> extras = TextUtil.replaceString( extras, "%m",
>
> ""+(df.format(m_dateLastModified))
> );
> wikitext += extras;
> }
> }
>
> //
> // If nothing was left after filtering or during search
> //
> if( links == null || links.size() == 0 )
> {
> wikitext = "(no referring pages)\\\\";
> }
>
> *** MODIFICATION TO KNOW THE LAST MODIFICATION DATE WITHIN
> ReferringPagesPlugin ***
> In src\com\ecyrd\jspwiki\plugin\AbstractReferralPlugin.java, we add:
>
> import java.util.Date;
> import java.text.SimpleDateFormat;
> ...
> protected boolean m_lastModified=false;
> // the last modified date of the page that has been last modified:
> protected Date m_dateLastModified = new Date(0);
> protected SimpleDateFormat df = new
> SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
> (((before: protected WikiEngine m_engine;)))
> ...
> (((ALSO CHANGE: )))
> if( includeThis )
> {
> if (result.add( pageName )) {
> // if we want to show the last modified date of the most
> recently change page, we keep a "high watermark" here:
> if (m_lastModified) {
> WikiPage page = m_engine.getPage(pageName);
> if (page!= null)
> {
> Date lastModPage = page.getLastModified();
> if (lastModPage.after(m_dateLastModified)){
> m_dateLastModified=lastModPage;
> }
> }
> }
> }
> }
> (((in place of:)))
> if( includeThis )
> {
> result.add( pageName );
> }
--
met vriendelijke groet,
Harry Metske
Telnr. +31-548-512395
Mobile +31-6-51898081