public override MultistepActionSettings Setup(int parentId, int templateId, bool?boundToExternal) { var site = SiteRepository.GetById(parentId); if (site == null) { throw new ApplicationException(string.Format(SiteStrings.SiteNotFound, parentId)); } var template = PageTemplateRepository.GetPageTemplatePropertiesById(templateId); if (site.IsDotNet) { templateCommand = new AssembleTemplateCommand(templateId, template.Name); pagesCommand = new AssemblePagesCommand(templateId, template.Name, false, true); pagesCommand.Setup(); notificationsCommand = new AssembleNotificationsCommand(templateId, template.Name, false); } else { pagesCommand = new AssemblePagesCommand(templateId, template.Name, false, false); pagesCommand.Setup(); } return(base.Setup(parentId, templateId, boundToExternal)); }
public PageTemplate ReadPageTemplateByObjectFormatId(int id) { var frmt = ReadNotificationTemplateFormat(id); var obj = ObjectRepository.GetObjectPropertiesById(frmt.ObjectId); return(PageTemplateRepository.GetPageTemplatePropertiesById(obj.PageTemplateId)); }
public void CancelTemplate(int id) { var template = PageTemplateRepository.GetPageTemplatePropertiesById(id); if (template == null) { throw new Exception(string.Format(TemplateStrings.TemplateNotFound, id)); } template.AutoUnlock(); }
public void CaptureLockTemplate(int id) { var template = PageTemplateRepository.GetPageTemplatePropertiesById(id); if (template == null) { throw new Exception(string.Format(TemplateStrings.TemplateNotFound, id)); } if (template.CanBeUnlocked) { EntityObjectRepository.CaptureLock(template); } }
internal static Page Create(int parentId) { var parentTemplate = PageTemplateRepository.GetPageTemplatePropertiesById(parentId); return(new Page { TemplateId = parentId, PageTemplate = parentTemplate, CacheHours = 1, EnableViewState = true, Charset = parentTemplate.Charset, Locale = parentTemplate.Locale, SendNocacheHeaders = true }); }
public PageTemplate ReadPageTemplateProperties(int id, bool withAutoLock = true) { var template = PageTemplateRepository.GetPageTemplatePropertiesById(id); if (template == null) { throw new ApplicationException(string.Format(TemplateStrings.TemplateNotFound, id)); } if (withAutoLock) { template.AutoLock(); } template.LoadLockedByUser(); return(template); }
internal static BllObject Create(int parentId, bool pageOrTemplate) //true-page false-template { var obj = new BllObject(); if (pageOrTemplate) { obj.PageId = parentId; obj.PageTemplateId = obj.page.TemplateId; obj.PageTemplate = PageTemplateRepository.GetPageTemplatePropertiesById(obj.page.TemplateId); } else { obj.PageTemplateId = parentId; obj.PageTemplate = PageTemplateRepository.GetPageTemplatePropertiesById(parentId); } obj.TypeId = ObjectType.GetGeneric().Id; return(obj); }
public MultistepActionStepResult Step(int step) { var template = PageTemplateRepository.GetPageTemplatePropertiesById(TemplateId); if (template == null) { throw new ApplicationException(string.Format(TemplateStrings.TemplateNotFound, TemplateId)); } if (!template.SiteIsDotNet) { throw new ApplicationException(string.Format(SiteStrings.ShouldBeDotNet)); } new AssembleTemplateObjectsController(TemplateId, QPContext.CurrentDbConnectionString).Assemble(); return(new MultistepActionStepResult { ProcessedItemsCount = 1 }); }
public MessageResult RemovePageTemplate(int id) { var template = PageTemplateRepository.GetPageTemplatePropertiesById(id); if (template == null) { throw new ApplicationException(string.Format(TemplateStrings.TemplateNotFound, id)); } if (template.LockedByAnyoneElse) { return(MessageResult.Error(string.Format(TemplateStrings.LockedByAnyoneElse, template.LockedByDisplayName))); } ManagePageTemplateFolders(template, FolderManagingType.DeleteFolder); PageTemplateRepository.DeletePageTemplate(id); return(null); }
private int?CreateDefaultFormat(BllObject bllObject, bool isReplayAction) { var template = PageTemplateRepository.GetPageTemplatePropertiesById(bllObject.PageTemplateId); var format = ObjectFormat.Create(bllObject.Id, bllObject.PageOrTemplate, template.SiteIsDotNet); format.Name = "default"; if (template.SiteIsDotNet) { format.NetFormatName = "default"; } else { format.NetLanguageId = template.NetLanguageId; } var netLanguagePrefix = GetLangPrefix(template.NetLanguageId); var pathToCopy = SitePathRepository.GetDirectoryPathToCopy() + "\\default\\"; if (template.NetLanguageId != null && !isReplayAction) { if (bllObject.IsGenericType) { format.CodeBehind = ReadFileAsString(string.Format("{0}generic_code_{1}.txt", pathToCopy, netLanguagePrefix)); } else if (bllObject.IsObjectContainerType) { format.CodeBehind = ReadFileAsString(string.Format("{0}container_code_{1}.txt", pathToCopy, netLanguagePrefix)); format.FormatBody = ReadFileAsString(string.Format("{0}container_presentation.txt", pathToCopy)); } } format = FormatRepository.SaveObjectFormatProperties(format); bllObject.DefaultFormatId = format.Id; ObjectRepository.UpdateDefaultFormatId(bllObject.Id, format.Id); return(format.Id); }
private static void ManageTemplateSearchItemsDescription(IEnumerable <PageTemplateSearchListItem> data, string filter) { if (string.IsNullOrWhiteSpace(filter)) { return; } foreach (var item in data) { var template = PageTemplateRepository.GetPageTemplatePropertiesById(item.Id); if (!string.IsNullOrWhiteSpace(template.CodeBehind) && template.CodeBehind.Contains(filter)) { item.Description = FoundTextMarker.GetSimpleRelevantMarkedText(WebUtility.HtmlEncode(template.CodeBehind), filter, 20, "<span class='seachResultHighlight'>", "</span>"); continue; } if (!string.IsNullOrWhiteSpace(template.TemplateBody) && template.TemplateBody.Contains(filter)) { item.Description = FoundTextMarker.GetSimpleRelevantMarkedText(WebUtility.HtmlEncode(template.TemplateBody), filter, 20, "<span class='seachResultHighlight'>", "</span>"); } } }
public PageTemplate ReadTemplateProperties(int templateId) => PageTemplateRepository.GetPageTemplatePropertiesById(templateId);
public BllObject NewObjectProperties(int parentId, bool pageOrTemplate) { var obj = BllObject.Create(parentId, pageOrTemplate); obj.PageTemplate = pageOrTemplate ? PageRepository.GetPagePropertiesById(parentId).PageTemplate : PageTemplateRepository.GetPageTemplatePropertiesById(parentId); return(obj); }