Improvements in revision feature
According "4566forum52post_id=41108* forumpost41108 this forum post":http://community.impresscms.org/modules/newbb/viewtopic.php?topic_ih1.
1.- Now the revision is paragraph based; if there only one different character all paragraph is highlighted and is impossible find the difference.
2.- Possibility for previous revisions comparative and not only for the last and one previous
1.- Now the revision is paragraph based; if there only one different character all paragraph is highlighted and is impossible find the difference.
2.- Possibility for previous revisions comparative and not only for the last and one previous
Leave a comment
@debianus I started testing tonight. Testing with update of existing install. No changes have been made to the default page.
- When I click on the "History" button, the Original, Changed, Differences cells show at the top of the page and the page content shows below, without any comparisons. Would it be best to only show the column headers when a compare is actually being done?
- When I click on the "Compare" link for the only revision for that page, the content is loaded into all 3 columns. There shouldn't be any differences, but the 'Differences' column has content that is different than Original and Changed. It does this for a brand new page, too
- After making changes to a page and comparing, the new revision differences does appear to be working correctly, even when there are more than 2 revisions you could compare - nice work!
Thanks for testing @Steve Kenow
- It was my fault. <{$swiki.body}> remains in wiwimod_history.html although it was deleted in index.php file.
- Right. In trunk only body text is in the page. However History button only must to be when there are two or more revisions of a page. No sense when only there is one revision (history when there is no "history"). But I have no idea about how case diff in index.php works only in that case. And for me there is no differences between Original and changed if the body is the same, look (screenshot). However the matter is: history only when there is history screenshot
- Thanks. I believe with these changes check revisions working fine (old diff code was from 2003). Only remains get a solution about History matter when only one revision is available.
To only show the History button when there is more than 1 revision available, we'll need another query to count them. The revisions property is just a counter to show how many times the page was updated, not how many active revisions there are for a page. The actual number and IDs of the revisions are not needed on a normal page load, so the list of revisions is not retrieved until then.
We could check when the history page loads and adjust the output based on having more than 1 revision to compare, since the query already runs for that page. This is the easiest and has no impact on current performance.
What do you think?
We could check when the history page loads and adjust the output based on having more than 1 revision to compare, since the query already runs for that page. This is the easiest and has no impact on current performance.
What do you think?
1.- I did not understand your point rightly. Yes, doing click in History button table for show changes must not be in the page; only when clicking in Compare link. I have solved the issue .
2.- I have got block Compare button when only revision is available.
and only when rev >1 History button is in the page.
Is it ok for performance and page load?
2.- I have got block Compare button when only revision is available.
$hist = $pageObj->history();
$revisiones = count($hist);
$xoopsTpl->assign('rev', $revisiones);
and only when rev >1 History button is in the page.
Is it ok for performance and page load?
I looked at your commit - you added the count for history in the default view, which does add an extra query for every page view. If you put in the history/diff section of index.php - the lines I mentioned above - no extra queries on any page, but the history button would always appear.
Maybe we take another approach - after a page has more than 1 revision, we always leave at least 2 revisions. The cleanPagesHistory() and fix() need to be improved, anyway. Then, we can just check the value of the page revisions property without any extra queries and only show the History button when there are at least 2 revisions to compare.
So, in index.php. add something similar to my suggested changes. Then, you can use the smarty var $swiki.revisions in the template to test for more than 1 revision.
Maybe we take another approach - after a page has more than 1 revision, we always leave at least 2 revisions. The cleanPagesHistory() and fix() need to be improved, anyway. Then, we can just check the value of the page revisions property without any extra queries and only show the History button when there are at least 2 revisions to compare.
So, in index.php. add something similar to my suggested changes. Then, you can use the smarty var $swiki.revisions in the template to test for more than 1 revision.
In impresscmsaddons:25348 Changing the condition to show the history button to use the revision property of the page to save a query on every page load. See #242.
Also made some slight template modfications.
There still will be times when there is only 1 revision of the page and the history button will display. For example, if after the page is created and saved, it is edited and saved again (not as a new revision). That increments the revision count (because it was revised), but does not create another entry in the revisions table. Or, when the admin uses the 'fix' or 'clean up the database' functions - those can remove all other revisions, leaving only one.
These conditions will be addressed in other tickets