コード例 #1
0
ファイル: CmsFile.cs プロジェクト: sffogg/Xenosynth
 protected CmsFile(Guid fileTypeID)
 {
     this.fileTypeID = fileTypeID;
     this.state = CmsState.Unsaved;
     this.version = 1;
     this.id = Guid.NewGuid();
     this.fileID = id;
     dateCreated = DateTime.Now;
     dateModified = dateCreated;
     this.revisionSourceID = SqlGuid.Null;
 }
コード例 #2
0
ファイル: CmsFile.cs プロジェクト: sffogg/Xenosynth
        public void Unpublish()
        {
            if (this.State == CmsState.Unsaved) {
                throw new ApplicationException("Can not unpublish Unsaved file.");
            } else {
                this.state = CmsState.Unpublished;
                this.dateModified = DateTime.Now;

                this.Update();

                LogAuditEvent(this, "Unpublished", "Unpublished");

                if (!this.revisionSourceID.IsNull) {
                    CmsFile revisionSource = CmsFile.FindByID(this.revisionSourceID.Value);
                    if (revisionSource != null) {
                        revisionSource.Publish();
                    }
                }
            }
        }
コード例 #3
0
ファイル: CmsFile.cs プロジェクト: sffogg/Xenosynth
        public void Restore()
        {
            //TODO: reconnect revision history?

            this.state = CmsState.Unpublished;
            this.dateModified = DateTime.Now;
            this.Update();

            LogAuditEvent(this, "Restored", "Restored");
        }
コード例 #4
0
ファイル: CmsFile.cs プロジェクト: sffogg/Xenosynth
        public void Publish()
        {
            if (this.State == CmsState.Unsaved) {
                throw new ApplicationException("Can not publish Unsaved file.");
            } else {

                this.state = CmsState.Published;
                this.dateModified = DateTime.Now;

                if (this.publishStart.IsNull) {
                    this.publishStart = DateTime.Now;
                }

                UpdatePublishingSchedule();

                this.Update();

                LogAuditEvent(this, "Published", "Published");
            }
        }
コード例 #5
0
ファイル: CmsFile.cs プロジェクト: sffogg/Xenosynth
        public virtual void InsertVersion()
        {
            //TODO: sweep archive old versions?
            //this.Update();

            //Create new revision
            this.revisionSourceID = this.ID;
            this.id = Guid.NewGuid();

            this.version += 1;
            this.state = CmsState.Unpublished;
            this.dateCreated = DateTime.Now;
            this.dateModified = DateTime.Now;

            DataStore ds = DataStoreServices.GetDataStore("Xenosynth");

            ds.Insert(this);

            LogEntry.LogEvent(LogEntry.LogEventType.Audit, LogEntry.LogSource.File, this.FileID, "Versioned",
                string.Format("Versioned {0} '{1}' to {2}.", this.FileType.Name, this.FileName, this.Version));

            //copy attributes
            IList attrs = CmsFileAttribute.FindByFileID(this.revisionSourceID.Value);
            foreach (CmsFileAttribute a in attrs) {
                a.CopyTo(id);
            }
        }
コード例 #6
0
ファイル: CmsFile.cs プロジェクト: sffogg/Xenosynth
        public virtual void Insert()
        {
            DataStore ds = DataStoreServices.GetDataStore("Xenosynth");

            ds.SetContext(this);
            this.RefreshFullPath();

            this.state = CmsState.Unpublished;
            this.dateModified = DateTime.Now;

            MembershipUser user = Membership.GetUser();
            this.ownerID = (Guid)user.ProviderUserKey;

            ds.Insert(this);

            LogAuditEvent(this, "Created", "Created");
        }
コード例 #7
0
ファイル: CmsFile.cs プロジェクト: sffogg/Xenosynth
        public virtual void Delete()
        {
            this.state = CmsState.Deleted;
            this.dateModified = DateTime.Now;
            this.Update();

            LogAuditEvent(this, "Deleted", "Deleted");
        }
コード例 #8
0
ファイル: CmsFile.cs プロジェクト: sffogg/Xenosynth
        public void Archive()
        {
            if (this.state == CmsState.Published) {
                this.publishEnd = DateTime.Now;
            }

            this.state = CmsState.Archived;
            this.dateModified = DateTime.Now;
            this.Update();

            LogAuditEvent(this, "Archived", "Archived");
        }