
![]() |
Show Changes |
![]() |
|
![]() |
Recent Changes |
![]() |
Subscriptions |
![]() |
Lost and Found |
![]() |
Find References |
![]() |
Rename |
![]() |
Administration Page |
| Search |
History
| 2/15/2005 5:17:59 AM |
| -61.11.98.124 |
![]() |
List all versions |
These changes look pretty good. I'd be happy to play with a local copy that includes these changes if you're looking for comfort before checking in . -- DavidOrnstein
I found a bug in the caching of the drop down list. It was using a key that had the version embeded in it. This caused multiple cache entries to exist for a given TopicName. I changed the code so it would cache by TopicName only. Once hoop checks in ShowTopicPage.cs I can make the rest of my changes in source control. -- MikeLinnen
Here is the code that needs to change in the ShowTopicPage.cs
Was
string changesKey = "ChangesForTopic." + topic.FullnameWithVersion;
Should be
string changesKey = "ChangesForTopic." + topic.Fullname;
Modify the 'ShowTopicPage.DoPage' method
bool diffs = Request.QueryString["diff"] == "y";
// Add the following code
bool restore = Request.QueryString["restore"] == "y";
if (restore==true)
{
Response.Redirect(lm.LinkToTopic(this.RestorePreviousVersion(topic)));
}
// Some additional code removed for clarity
// Add an else condition to the topic.Version test
if (topic.Version == null)
{
Command(lm, "Edit", lm.LinkToEditTopic(topic));
}
else
{
Command(lm, "Restore", lm.LinkToRestore(topic));
}
Modify the LinkMaker class by adding a LinkToRestore method
public string LinkToRestore(TopicName topic)
{
StringBuilder builder = new StringBuilder();
builder.Append(SiteURL());
builder.Append("default.aspx/");
builder.Append(topic.FullnameWithVersion);
string query = "";
query += "&";
query += "restore=y";
builder.Append("?");
builder.Append(query);
return builder.ToString();
}
Modify the Page class by adding a 'RestorePreviousVersion' method
protected TopicName RestorePreviousVersion(TopicName topic)
{
AbsoluteTopicName newVersionName = new AbsoluteTopicName(topic.Name, topic.Namespace);
newVersionName.Version = TopicName.NewVersionStringForUser(VisitorIdentityString);
DefaultContentBase.WriteTopicAndNewVersion(newVersionName, this.DefaultContentBase.Read(topic));
return this.DefaultContentBase.TopicNameFor(newVersionName.Name);
}
This enhancement is complete and checked into source control -- Mike Linnen