« Wand
Edit History

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Edit History
« on February 22nd, 2012, 12:22 AM »
Been thinking about this one for a while, and finally started working on it today. So far I've got it able to store the edits as they're made (which is by far the easiest bit of the code) and added an item to the menu to view the edits.

It's also, interestingly, exposing a weakness in the post display, in that there's no way to alter the items (other than those in the menu) by way of a hook - nor is it possible to do what Niko's mod did and have the 'last edited' text be a suitable link. Not yet sure how I want to deal with that.

As far as the menu goes, the real struggle - such as it was a 'struggle', depending on your definition - was making the text be different between menu instances, to include the number.[1]

But here's what I have so far. It's not very exciting, because I haven't gotten onto the real meat of the display yet, but that's OK, I haven't spent that long on it yet.
 1. Nao wrote that code and it is very, very efficient, but doing something like this is atypical - and as a result, a little bit tricky, but nothing that can't be solved relatively easily, all that happens is we create placeholders for each of the counts and use those, e.g. if a post has 1 edit and another has 2 edits, we create dynamic $txt entries to cope with it so they each get a 'unique' identifier. If you're not planning on touching that menu it really doesn't matter to you, other than the fact it works.

📎 edithistory_1.png - 9.38 kB, 640x107, viewed 267 times.

When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Edit History
« Reply #1, on February 22nd, 2012, 12:36 AM »
Isn't it a usercentric menu rather than post centric?

Yeah it's only semantics....

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Edit History
« Reply #2, on February 22nd, 2012, 12:44 AM »
The history of a post is pretty post centric?
Re: Edit History
« Reply #3, on February 22nd, 2012, 03:15 AM »
Anyway, I got quite a bit sidetracked this evening on other matters, but I've got the next stage implemented.

📎 edithistory_2.png - 31.29 kB, 640x434, viewed 251 times.


live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
A confident man keeps quiet.whereas a frightened man keeps talking, hiding his fear.

Nao

  • Dadman with a boy
  • Posts: 16,082

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Edit History
« Reply #7, on February 22nd, 2012, 10:18 AM »
Oh I get it now! IPod -> no visible right side of the pic. So I missed that.

Dr. Deejay

  • Happy new year all!
  • Posts: 118
Re: Edit History
« Reply #8, on February 22nd, 2012, 12:49 PM »
Nice work! :)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Edit History
« Reply #9, on February 22nd, 2012, 01:49 PM »
Thanks :)

Haven't yet decided what I want to do with permissions on it yet, though, and I'm currently trying to decide how thorough to make it handle comparisons between versions and stuff like that but it's coming along nicely enough :)

Farjo

  • "a valuable asset to the community"
  • Posts: 492
Re: Edit History
« Reply #10, on February 23rd, 2012, 11:01 AM »
Excellent - don't really understand the codey bits but really glad this will be available. Looking good so far :)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Edit History
« Reply #11, on February 23rd, 2012, 11:02 AM »
Yeah, don't worry too much about the code stuff, that was more a passing comment for anyone who is interested in extending that menu in a specific way ;)

I did start, briefly, on making it able to show two edits side by side and show the changes, but I got sidetracked with personal stuff and haven't gotten that far with it. (Sadly, MediaWiki has a rather nice piece of code derived from GNU diff, but it's GPL and thus not suitable licence-wise)

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Edit History
« Reply #12, on February 23rd, 2012, 11:21 AM »
Pete, do you think I should give up on the 'optimizations' of the action/user menus and instead use full URLs and full strings for all occurrences...? These would tend to gzip well, so it wouldn't eat too much bandwidth. Originally the optimization was meant to make Wedge load faster and better (on mobile or desktop), but maybe you think it's not worth the trade-off in terms of extensibility?
Posted: February 23rd, 2012, 11:20 AM

As for MediaWiki, the code is GPL but the concept/implementation algorithm isn't. Surely you can get inspired by it?

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Edit History
« Reply #13, on February 23rd, 2012, 11:24 AM »
I really wouldn't worry about changing it. I don't see many people changing it, and those that do... they're going to change it in a less dramatic way than I have (i.e. the same string each time)

Honestly, I'm more bothered by the fact that quote/modify aren't directly extensible than I am about trying to extend the menus.
Quote
As for MediaWiki, the code is GPL but the concept/implementation algorithm isn't. Surely you can get inspired by it?
The algorithm is extremely complex. I narrowed down the segment of code I want, but it's about 20K of code that's complicated to unravel, especially when one loop, for example is set up as such:

Code: [Select]
for ($endskip = 0; --$xi > $skip && --$yi > $skip; $endskip++) {

Don't worry about what all the variables are, just consider how complex that piece of code is for what it's actually doing. (It's used to go from the end of the before/after pages, from whichever's shortest and traverse back up towards the $skip point, which is the location of the earliest line of difference)

MultiformeIngegno

  • Posts: 1,337
Re: Edit History
« Reply #14, on February 23rd, 2012, 11:35 AM »
Yeah! Brilliant! :)