public WikiHistoryProxy GetWikiRevision(int historyID)
        {
            WikiHistory article = WikiHistoryCollection.GetWikiHistory(TSAuthentication.GetLoginUser(), historyID);

            if (article != null)
            {
                return(article.GetProxy());
            }
            return(null);
        }
        public static string GetWikiHistory(RestCommand command, int historyID)
        {
            WikiHistory wikiHistory = WikiHistoryCollection.GetWikiHistory(command.LoginUser, historyID);

            if (wikiHistory.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            return(wikiHistory.GetXml("WikiHistory", true));
        }
        public void LogHistory(LoginUser loggedInUser, WikiArticle wiki, string comment)
        {
            WikiHistoryCollection history        = new WikiHistoryCollection(loggedInUser);
            WikiHistory           newWikiHistory = history.AddNewWikiHistory();

            newWikiHistory.ModifiedBy     = loggedInUser.UserID;
            newWikiHistory.CreatedBy      = loggedInUser.UserID;
            newWikiHistory.Version        = wiki.Version;
            newWikiHistory.Body           = wiki.Body;
            newWikiHistory.ArticleName    = wiki.ArticleName;
            newWikiHistory.OrganizationID = wiki.OrganizationID;
            newWikiHistory.ArticleID      = wiki.ArticleID;
            newWikiHistory.ModifiedDate   = DateTime.UtcNow;
            newWikiHistory.CreatedDate    = DateTime.UtcNow;
            newWikiHistory.Comment        = comment;

            newWikiHistory.Collection.Save();
        }
Esempio n. 4
0
        public override IWorkWikiItem SelectWikiHistory(Guid id)
        {
            WikiHistory wiki = null;

            WikiDataContext db = new WikiDataContext(
                ConfigurationManager.ConnectionStrings[this.ConnectionStringName].ConnectionString);

            Table<LinqWikiHistory> wikis = db.GetTable<LinqWikiHistory>();

            LinqWikiHistory row = wikis.SingleOrDefault<LinqWikiHistory>(
                w => w.ApplicationName == this.ApplicationName && w.TrackingNumber == id);

            if (row == null)
                return null;

            wiki = new WikiHistory(new Wiki(row.ID)
            {
                Author = row.Author,
                Category = row.Category,
                Content = row.Content,
                DateCreated = row.DateCreated,
                DepartmentArea = row.DepartmentArea,
                Description = row.Description,
                Editable = row.Editable,
                Editor = row.Editor,
                IsVisible = row.IsVisible,
                Keywords = row.Keywords,
                LastUpdated = row.LastUpdated,
                LastUpdatedBy = row.LastUpdatedBy,
                ReachLevel = (ReachLevel)row.ReachLevel,
                Slug = row.Slug,
                Title = row.Title
            })
            {
                Action = (SaveAction)row.Action,
                Authorizer = row.Authorizer,
                ExpirationDate = row.ExpirationDate,
                IPAddress = row.IpAddress,
                Messages = row.Messages,
                Status = (WikiStatus)row.Status,
                TrackingNumber = row.TrackingNumber
            };

            return wiki;
        }