示例#1
0
        public override void Save()
        {
            if (IsNew && WebSessionHelper.CurrentLicense != null && WebSessionHelper.CurrentLicense.HasMaxNumberExceeded("PageFolder"))
            {
                throw new Exception("Kan niet opslaan: licentie heeft maximale aantal folders (" + WebSessionHelper.CurrentLicense.MaxNumberOfPageFolders + ") overschreden.");
            }
            Validate();
            RelativePath = GetCompletePath();
            //unique check
            //workaraound voor mysql: uniek is combi van naam, site en folder
            //als folder leeg is (NULL), gaat uniqueconstraint niet af in mySql
            //hierom in c# checken
            if (this.ParentFolder == null && ID != Guid.Empty)
            {
                string        sql         = String.Format("FK_Site='{0}' AND FK_Parent_Folder IS NULL AND name = '{1}' AND ID != '{2}'", Site.ID, this.Name, this.ID);
                CmsPageFolder checkFolder = BaseObject.GetFirst <CmsPageFolder>(sql);
                if (checkFolder != null)
                {
                    throw new Exception("Naam is niet uniek.");
                }
            }
            CmsPageFolder currentFolder = BaseObject.GetById <CmsPageFolder>(this.ID);

            if (currentFolder != null)
            {
                currentFolder.DeleteCurrentFolderLocation();
            }
            base.Save();

            //bij naamswijziging, moeten alle paden in subfolders en pagina's worden geupdate
            UpdateRelativePathAndUnpublishedItemsInSubFoldersAndPages();
            UnpublishedItem.Set(this, "Folder");
        }
示例#2
0
        public override void Delete()
        {
            //template modules verwijderen
            BaseCollection <BaseModule> Modules = this.GetTemplateModules();

            foreach (BaseModule module in Modules)
            {
                module.Delete();
            }
            base.Delete();
            UnpublishedItem.Set(this, "Template", ChangeStatusEnum.Deleted);
        }
示例#3
0
        public override void Delete()
        {
            if (this.IsSystemValue)
            {
                throw new Exception("Systeem scripts mogen niet worden verwijderd.");
            }
            base.Delete();
            string filename = this.Site.Path + Url.Replace("/", "\\");

            //FileHelper.DeleteFile(filename);


            UnpublishedItem.Set(this, "Script", ChangeStatusEnum.Deleted);
        }
示例#4
0
        /// <summary>
        /// Try Delete
        /// Als die bestaat: weggooien
        /// </summary>
        /// <param name="fk_object"></param>
        public static void DeleteByFK_Object(Guid fk_object)
        {
            UnpublishedItem item = null;

            //try to find
            string where = String.Format("FK_Object = '{0}'", fk_object);
            BaseCollection <UnpublishedItem> items = BaseCollection <UnpublishedItem> .Get(where);

            if (items.Count > 0)
            {
                item = items[0];
                item.Delete();
            }
        }
示例#5
0
 internal static void WriteError(Guid fk_object, Exception ex)
 {
     try
     {
         string where = String.Format("FK_Object = '{0}'", fk_object);
         UnpublishedItem item = BaseObject.GetFirst <UnpublishedItem>(where);
         if (item != null)
         {
             item.ChangeStatus = ChangeStatusEnum.PublishError;
             item.Actions     += "Fout tijdens publiceren: " + ex.Message + "; ";
             item.Save();
         }
     }
     catch (Exception e)
     {
     }
 }
示例#6
0
        public void UpdateRelativePathAndUnpublishedItemsInSubFoldersAndPages()
        {
            BaseCollection <CmsPageFolder> subFolders = GetSubFolders();

            foreach (CmsPageFolder subfolder in subFolders)
            {
                subfolder.Save();
                UnpublishedItem.Set(subfolder, "Folder");
                subfolder.UpdateRelativePathAndUnpublishedItemsInSubFoldersAndPages();
            }
            BaseCollection <CmsPage> pages = GetPages();

            foreach (CmsPage page in pages)
            {
                page.Save();
                UnpublishedItem.Set(page, "Page");
            }
        }
示例#7
0
        public override void Delete()
        {
            foreach (BaseModule module in this.Modules)
            {
                //Modules zichtbaar op alle pagina's
                if (module.CrossPagesMode == CrossPagesModeEnum.VisibleOnOnePage ||
                    module.Pages.Count == 1 && module.CrossPagesMode == CrossPagesModeEnum.VisibleOnAllSelectedPages)
                {
                    module.Delete();
                }

                //if (module.CrossPagesMode == CrossPagesModeEnum.VisibleOnAllPages && (module.CrossPagesMode != CrossPagesModeEnum.VisibleOnAllPagesInTemplate || module.Template == null) && module.Pages.Count == 1)
                //{
                //    module.Delete();
                //}
                //else if (module.CrossPagesMode != CrossPagesModeEnum.VisibleOnAllPages && module.CrossPagesMode != CrossPagesModeEnum.VisibleOnAllPagesInTemplate)
                //{
                //    module.Delete();
                //}
            }
            base.Delete();
            UnpublishedItem.Set(this, "Page", ChangeStatusEnum.Deleted);
        }
示例#8
0
        public static void Set(BaseDomainPublishableObject baseObj, string Type, ChangeStatusEnum ChangeStatus, bool alsoUpdateObject)
        {
            //even uitgezet
            return;

            if (!(Type == "Folder" || Type == "Page" || Type == "Module" || Type == "Template" || Type == "Script" || Type == "DataCollection" || Type == "DataGroup" || Type == "DataItem"))
            {
                throw new Exception("Geen geldige type voor UnpublishedItem");
            }


            UnpublishedItem item = new UnpublishedItem();

            //try to find
            string where = String.Format("FK_Object = '{0}'", baseObj.ID);
            BaseCollection <UnpublishedItem> items = BaseCollection <UnpublishedItem> .Get(where);

            if (items.Count > 0)
            {
                item = items[0];
            }
            else
            {
                //nieuwe
            }
            if (baseObj.LastPublishedDate == null && ChangeStatus == ChangeStatusEnum.Deleted)
            {
                item.Delete();
            }
            else
            {
                item.LastPublishedDate = baseObj.LastPublishedDate;
                item.ChangeStatus      = ChangeStatus;
                item.Site         = baseObj.Site;
                item.Name         = baseObj.Name;
                item.FK_Object    = baseObj.ID;
                item.Type         = Type;
                item.ModifiedDate = DateTime.Now;
                if (Utils.WebSessionHelper.CurrentBitplateUser != null)
                {
                    item.UserName = Utils.WebSessionHelper.CurrentBitplateUser.Email;
                    item.FK_User  = Utils.WebSessionHelper.CurrentBitplateUser.ID;
                }
                if (ChangeStatus == ChangeStatusEnum.Deleted)
                {
                    item.Actions += String.Format("Verwijderd door {0} op {1:dd-MM-yyyy HH:mm}; ", item.UserName, DateTime.Now);
                }
                else
                {
                    item.Actions += String.Format("Bewaard door {0} op {1:dd-MM-yyyy HH:mm}; ", item.UserName, DateTime.Now);
                }
                item.Save();
            }
            if (alsoUpdateObject && ChangeStatus == ChangeStatusEnum.Modified)
            {
                //in de objecten wordt change-status ook bewaard (redundant (omwilen van minder db-calls)
                //hier wordt die gezet
                //dit wordt aangeroepen bij wijziging van een module op een pagina.
                string sql = String.Format("UPDATE {0} SET ChangeStatus={1}, ModifiedDate=NOW() WHERE ID='{2}'", Type, (int)ChangeStatusEnum.Modified, baseObj.ID);
                DataBase.Get().Execute(sql);
            }
        }
示例#9
0
 public override void Delete()
 {
     base.Delete();
     UnpublishedItem.Set(this, "Folder", ChangeStatusEnum.Deleted);
 }