[Home]ElMoro/GetReferersBarComments

UseModWiki | ElMoro | RecentChanges | Preferences

This is some stuff I wrote while planning the project. Upon execution things have changed a lot, so I had to review things or you'd get lost. There may still be some difference between what's written here and the actual code but after browsing it it looks ok

Basic Plan:

Every page has an additional file containing referers and referees (separated by $FS1), each containing pagenames and a number of accesses for each pagename (separated by $FS2). Loosely speeling in $RefeDir?/T/ThisPage?.rf %referer contains a list of $pagename{$value}} where $value is the namber of times $pagenames has been the referer of ThisPage?. Similarly %refereee contains the number of times ThisPage? has been the referer of $pagename.

Comments

Project

  1. Every time BrowsePage is called (more or less), call GetReferences?
  2. Call from somewhere in BrowsePage GetReferersBar, a subroutine generating links to referers and referees (this should be called only when the page is not an action page)

sub GetReferences?

  1. call GetReferer. Returns an empty string unless a valid wiki page is the referer (i.e. get rid of all external referers, all ?action=, and also $id - am I missing something else?)
  2. call ReadRefeFile?($file,'referer') which gets the referer's page referees values and updates the value of $referee{page}
  3. call ReadRefeFile?($file,'referer') which gets page's referees and updates the value of $referer{$page}
  4. To avoid duplication of calls to GetReferer, GetReferences? should also update such values by calling UpdateReferences? (twice)

sub GetReferer

Returns the current open page referer unless the referer is the same, or the page is not a valid wiki page (i.e. no referer if it is an external link or an action=* page)

sub ReadRefeFile?

Should take as input $file,and $type, where $page is the page being browsed and $type is of referer or referee. The return value of the subroutine is a hash with a list of valid page names as keys, and integers as values.

Each integers is a hit count telling the obvious info i.e how many times a page has been the referer of $page if $type is referer, or how many times $page has been the referee of a page if $type is refereee

sub UpdateReferences?

Inputs of such sub is $page, and two lists where $page is the page being browse, the two lists contain the page referer's and referee's pagenames and value name. This sub does not return any particularly useful value. Here I would have liked perl to allow hashes to be arguments of subroutines.

sub GetReferersBar

This guy simply acts like GetGotoBar and creates links to referers and referees. The max number of links is defined in config, as is the number of columns in the table. I use a nice trick to get evenly-spaced shades of gray in each cell. You should definitely use stylesheets to get best results.


UseModWiki | ElMoro | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited July 6, 2005 5:12 pm by RichardP (diff)
Search: