Wiki source for KeepHistory


Show raw source

=====Keep the browsing history=====
It could be nice to have a simple way to follow all the [[WikiPage]]s that we have been browsing over one or several sessions. It is not always obvious to retrieve quickly a WikiPage we opened a few minutes or hours ago.

I found a good idea to provide such a feature at http://www.wikini.net/wakka.php?wiki=HistoriqueNavigation. The author Jean-Marie Griess has an implementation at http://www.arkheia.com/wikini/wakka.php?wiki=PagePrincipale (even if it is in french, you can try browsing several pages and you will understand the principle).
~&Well, I tried, and could not discover anything... what exactly am I looking for? --JavaWoman
~~&Browsing the Wiki site, you should see your history trail (in the 4th line from the top "Historique > page1 > page2...").
~~~&Tried five more pages, starting at the ""PagePrincipale"" link above ... nothing. Maybe it works only for logged-in users? I did not try to set up an account. --JavaWoman
Searching a bit more, I found this feature from several WikiEngines under the nice name of BreadCrumbs.
~&See my note on ChristianBarthelemy about the difference between history and breadcrumbs. --JavaWoman
So apart Wikini, [[http://wiki.splitbrain.org/wiki:breadcrumbs DokuWiki]] and others may provide similar functionality.
~&DocuWiki has what //looks// like breadcrumbs but I could not figure out how this works: most of my browsing did not leave any trace in what is marked as "trace"... --JavaWoman
~~&I think it only works within the same namespace - I tried again and got all my trail: ""Trace: » breadcrumbs » abbreviations » compare"".
~~~&Even a lot of pages I visited within the same name space did not appear: I clicked around quite a bit - I just don't understand what's supposed to happen and what appears and what not: totally mystifying. --JavaWoman
~~~~&It worked for me. the trace function works. I browsed a few pages, and it did follow my clicks. --JeremyYip

===My solution===
The solution here above is using cookies and I would prefer something not relying on cookies so that you can keep your history using different computers or using light clients or not cookie-enabled browsers. This could as well stored in a dedicated wikka table - yet I do not think we should overload Wikka Core with things that may not be useful for all.
So in the same way I did for UserMenus or ACLsWithUserGroups I would rather rely on WikiPage:

The principle would be:
- If you are logged as a registered user and
- If a WikiPage UserLogonHistory exists then each time you open a new WikiPage:
- The system would add a line on top of the UserLogonHistory page with the name of the WikiPage and the timestamp
- The system would then remove all lines further to line X, X being the maximum number of links we want to keep in the history

===Dependancy===
None.

===The code===
To be built. Should be very simple...
Maybe a handler would do. Instead of calling WikiPage, the system would call WikiPage/KeepHistory if the conditions are fulfilled.
~&Were you suggesting a separate table? What about keeping it as a single concatanated string in the wikkausers table? Then only have to add one cell, and the user could "set" the "length" on the ""{{UserSettings}}"" page (up to a maximum) and logging in (loading the usersetting page) could reduce the list to the last set number....and if it was re-set (using update settings) then could further parse the list to that length if the set number was shorter. That would require just keeping a single string with a divider (like "+") (could then just do a count on the divider to find out how many were there and "cut" the rest in the userpage part). The "add" code could just be made part of the header/footer code....if you want a linear sequence then that would just be concatenating the new page onto the old list with the concatenation happening when the user logged in....that would reduce processing when the header/footer was loaded. You could set it so that a navigation menu of the last ?? items was at the top as a ->homepage->pageindex->userpage->keephistory menu. I think this method would have the least server load.
~~&Thank you for your comments - I realize this proposal is likely to be a better way to get it. I will think about this.

===How to use it?===
- The user has first to create an history page and setup the ACLs as wished
- he could setup the number of pages he wants to keep in the history (or this could be a system parameter for all users)

===To Do===
Needs to be coded...
~&Well, if I'd known THIS conversation was occurring....LOL. If you're interested in a wikka breadcrumb feature based on a table (the user table actually) go to WikiBreadcrumb. It works pretty well actually. I might have a minor update to post in a few days.
The user should be allowed to delete his UserLogonHistory page if he wants.

----
Hi, I used $_SESSION to store my history-array in this Quick and Dirty approach:
1) In **wikka.php** (around line 996 in "function Run", just after "$this->""LogReferrer""();") I've added
%%(php)
$_SESSION["KeepHistory"][]=$this->tag;
$_SESSION["KeepHistory"]=array_unique($_SESSION["KeepHistory"]);
if( count($_SESSION["KeepHistory"]) >7 ) array_shift( $_SESSION["KeepHistory"] );
%%
1) In **actions/footer.php** (on line 3, just after "$this->""FormOpen""(...")
%%(php)
echo $this->Format( implode(" :: ",array_reverse($_SESSION["KeepHistory"]))."---\n" );
%%
1) To clear the history, I also added **handlers/page/clearkeephistory.php**
%%(php)
<?php
$_SESSION["KeepHistory"] = array();
$this->Redirect($this->Href());
?>
%%
So just add "/clearkeephistory" at the end of an url to clear the list.
(Names still need to be changed to something a bit more sexy...)
my $0.02 -- OnegWR

----
CategoryDevelopmentHandlers
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki