using System;
using System.Collections.Generic;
using ScrewTurn.Wiki.PluginFramework;
namespace ScrewTurn.Wiki {
///
/// Manages Page Editing collisions.
///
public static class Collisions {
///
/// The refresh interval used for renewing the sessions.
///
public const int EditingSessionTimeout = 20;
///
/// Adds or updates an editing session.
///
/// The edited Page.
/// The User who is editing the Page.
public static void RenewEditingSession(PageInfo page, string user) {
Cache.Provider.RenewEditingSession(page.FullName, user);
}
///
/// Cancels an editing session.
///
/// The Page.
/// The User.
public static void CancelEditingSession(PageInfo page, string user) {
Cache.Provider.CancelEditingSession(page.FullName, user);
}
///
/// Finds whether a Page is being edited by a different user.
///
/// The Page.
/// The User who is requesting the status of the Page.
/// True if the Page is being edited by another User.
public static bool IsPageBeingEdited(PageInfo page, string currentUser) {
return Cache.Provider.IsPageBeingEdited(page.FullName, currentUser);
}
///
/// Gets the username of the user who's editing a page.
///
/// The page.
/// The username.
public static string WhosEditing(PageInfo page) {
return Cache.Provider.WhosEditing(page.FullName);
}
}
}