protected virtual void PackCheckboxes(VBox vbox) { string possible_location = System.IO.Path.Combine(System.IO.Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.MyMusic), "iTunes"), ItunesPlayerImportSource.LibraryFilename); if (Banshee.IO.File.Exists(new SafeUri(possible_location))) { library_uri = possible_location; } else { HBox hbox = new HBox(); hbox.Spacing = 8; Image image = new Image(IconTheme.Default.LoadIcon("gtk-open", 18, 0)); hbox.PackStart(image, false, false, 0); Label label1 = new Label(); label1.Markup = String.Format("<b>{0}</b>", GLib.Markup.EscapeText( String.Format(Catalog.GetString(@"Locate your ""{0}"" file..."), ItunesPlayerImportSource.LibraryFilename))); label1.SetAlignment(0.0f, 0.5f); hbox.PackStart(label1, false, false, 0); Button browse_button = new Button(hbox); browse_button.Clicked += OnBrowseButtonClicked; ContentArea.PackStart(browse_button, false, false, 0); ratings.Sensitive = stats.Sensitive = playlists.Sensitive = import_button.Sensitive = false; } ContentArea.PackStart(vbox, false, false, 0); }
private void Build() { var hbox = new HBox(); hbox.Spacing = 6; hbox.BorderWidth = 12; var error_icon = new Image(); error_icon.Pixbuf = PintaCore.Resources.GetIcon(Stock.DialogError, 32); error_icon.Yalign = 0; hbox.PackStart(error_icon, false, false, 0); var vbox = new VBox(); vbox.Spacing = 6; description_label = new Label(); description_label.Wrap = true; description_label.WidthRequest = 500; description_label.Xalign = 0; vbox.PackStart(description_label, false, false, 0); hbox.Add(vbox); ContentArea.Add(hbox); DefaultWidth = 600; DefaultHeight = 150; ShowAll(); }
public ContentItem(Guid musicProviderId, ContentArea location, ContentGroup group, double orderWeight) { MusicProviderId = musicProviderId; Location = location; Group = group; OrderWeight = orderWeight; }
private IEnumerable <BlockPreviewViewModel.PreviewArea> PopulateContentAreas(IContent currentContent) { var supportedDisplayOptions = _displayOptions .Select(x => new { Tag = x.Tag, Name = x.Name, Supported = SupportsTag(currentContent, x.Tag) }) .ToList(); var result = new List <BlockPreviewViewModel.PreviewArea>(); if (supportedDisplayOptions.Any(x => x.Supported)) { foreach (var displayOption in supportedDisplayOptions) { var contentArea = new ContentArea(); contentArea.Items.Add(new ContentAreaItem { ContentLink = currentContent.ContentLink }); var areaModel = new BlockPreviewViewModel.PreviewArea { Supported = displayOption.Supported, AreaTag = displayOption.Tag, AreaName = displayOption.Name, ContentArea = contentArea }; result.Add(areaModel); } } return(result); }
public ActionResult Index(IContent currentContent) { var contentArea = new ContentArea(); contentArea.Items.Add(new ContentAreaItem { ContentLink = currentContent.ContentLink }); var model = new BlockPreviewViewModel { PreviewContent = currentContent, }; model.Areas.AddRange(PopulateContentAreas(currentContent)); const string url = "Views/BlockPreview/Index.cshtml"; if (ModuleResourceResolver.Instance.TryResolvePath(typeof(BlockPreviewController).Assembly, url, out var resolvedPath)) { return(View(resolvedPath, model)); } return(new HttpNotFoundResult("Content not found")); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { StyleguideContentProvider.EnsureInstalled(); if (reader.TokenType == JsonToken.Null) { return(null); } var arrayElement = JArray.Load(reader); if (arrayElement == null) { return(null); } var area = new ContentArea(); foreach (var element in arrayElement.Children <JObject>()) { var content = this.factory.CreateContent(serializer, element); this.repository.AddOrReplace(content); area.Items.Add(new ContentAreaItem { ContentLink = content.ContentLink }); } return(area); }
public ActionResult Index(IContent currentContent) { var startPage = _contentLoader.Get <StartPage>(SiteDefinition.Current.StartPage); var model = new PreviewModel(startPage, currentContent); var supportedDisplayOptions = _displayOptions .Select(x => new { Tag = x.Tag, Name = x.Name, Supported = SupportsTag(currentContent, x.Tag) }); if (supportedDisplayOptions.Any(x => x.Supported) == false) { return(View(model)); } ContentArea contentArea; PreviewModel.PreviewArea areaModel; foreach (var option in supportedDisplayOptions) { contentArea = new ContentArea(); contentArea.Items.Add(new ContentAreaItem { ContentLink = currentContent.ContentLink }); areaModel = new PreviewModel.PreviewArea { Supported = option.Supported, AreaTag = option.Tag, AreaName = option.Name, ContentArea = contentArea }; model.Areas.Add(areaModel); } return(View(model)); }
public ActionResult Index(IContent currentContent) { //As the layout requires a page for title etc we "borrow" the start page var startPage = _contentLoader.Get <StartPage>(SiteDefinition.Current.StartPage); var model = new PreviewModel(startPage, currentContent); var supportedDisplayOptions = _displayOptions .Select(x => new { Tag = x.Tag, Name = x.Name, Supported = SupportsTag(currentContent, x.Tag) }) .ToList(); if (supportedDisplayOptions.Any(x => x.Supported)) { foreach (var displayOption in supportedDisplayOptions) { var contentArea = new ContentArea(); contentArea.Items.Add(new ContentAreaItem { ContentLink = currentContent.ContentLink }); var areaModel = new PreviewModel.PreviewArea { Supported = displayOption.Supported, AreaTag = displayOption.Tag, AreaName = displayOption.Name, ContentArea = contentArea }; model.Areas.Add(areaModel); } } return(View(model)); }
public ConfigurationDialog(LCDService plugin) { this.plugin = plugin; Title = AddinManager.CurrentLocalizer.GetString("LCD configuration"); BorderWidth = 5; Resizable = false; VBox lcdproc_box = new VBox(); HBox host_box = new HBox(); host_box.PackStart(new Label(AddinManager.CurrentLocalizer.GetString("Hostname:")), false, false, 3); host_entry = new Entry(); host_box.PackStart(host_entry, true, true, 3); host_entry.Text = this.plugin.Host; host_entry.Changed += new EventHandler(Host_Changed); HBox port_box = new HBox(); port_box.PackStart(new Label(AddinManager.CurrentLocalizer.GetString("Port:")), false, false, 3); port_spin = new SpinButton(1, 65535, 1); port_box.PackStart(port_spin, true, true, 3); port_spin.Value = this.plugin.Port; port_spin.Changed += new EventHandler(Port_Changed); Frame lcdproc_frame = new Frame(AddinManager.CurrentLocalizer.GetString("LCDProc Daemon:")); lcdproc_box.PackStart(host_box, true, true, 3); lcdproc_box.PackStart(port_box, true, true, 3); lcdproc_frame.Add(lcdproc_box); lcdproc_frame.ShowAll(); ContentArea.PackStart(lcdproc_frame, false, false, 3); AddButton(Stock.Close, ResponseType.Close); }
public override void Render(HtmlHelper htmlHelper, ContentArea contentArea) { if (contentArea == null || contentArea.IsEmpty) { return; } var viewContext = htmlHelper.ViewContext; TagBuilder tagBuilder = null; if (!IsInEditMode(htmlHelper) && ShouldRenderWrappingElement(htmlHelper)) { tagBuilder = new TagBuilder(GetContentAreaHtmlTag(htmlHelper, contentArea)); AddNonEmptyCssClass(tagBuilder, viewContext.ViewData["cssclass"] as string); if (AutoAddRow) { AddNonEmptyCssClass(tagBuilder, "row"); } viewContext.Writer.Write(tagBuilder.ToString(TagRenderMode.StartTag)); } RenderContentAreaItems(htmlHelper, contentArea.FilteredItems); if (tagBuilder == null) { return; } viewContext.Writer.Write(tagBuilder.ToString(TagRenderMode.EndTag)); }
public AboutDialog() : base(string.Empty, PintaCore.Chrome.MainWindow, DialogFlags.Modal) { Title = Translations.GetString("About Pinta"); //TransientFor = IdeApp.Workbench.RootWindow; Resizable = false; IconName = Pinta.Resources.Icons.AboutPinta; ContentArea.BorderWidth = 0; aboutPictureScrollBox = new ScrollBox(); ContentArea.PackStart(aboutPictureScrollBox, false, false, 0); imageSep = PintaCore.Resources.GetIcon("About.ImageSep.png"); ContentArea.PackStart(new Gtk.Image(imageSep), false, false, 0); Notebook notebook = new Notebook(); notebook.BorderWidth = 6; notebook.AppendPage(new AboutPintaTabPage(), new Label(Title)); notebook.AppendPage(new VersionInformationTabPage(), new Label(Translations.GetString("Version Info"))); ContentArea.PackStart(notebook, true, true, 4); AddButton(Gtk.Stock.Close, (int)ResponseType.Close); this.Resizable = true; ShowAll(); }
public ActionResult Item(SyndicationFeedPageType currentPage, int?contentId) { if (!contentId.HasValue) { return(HttpNotFound("No content Id specified")); } var contentReference = ContentReference.Parse(contentId.Value.ToString()); var referencedContent = _feedContentResolver.GetContentReferences(currentPage); if (!referencedContent.Contains(contentReference)) { return(HttpNotFound("Content Id not exposed in this feed")); } var contentArea = new ContentArea(); var item = new ContentAreaItem { ContentLink = contentReference }; contentArea.Items.Add(item); var contentItem = _contentLoader.Get <IContent>(contentReference); var model = new ContentHolderModel { Tag = currentPage.BlockRenderingTag, ContentArea = contentArea, Content = contentItem }; return(View("~/modules/Chief2moro.SyndicationFeeds/Views/Item.cshtml", model)); }
public virtual void Render(HtmlHelper helper, ContentArea contentArea, string templateTag = null) { if (contentArea != null) { var items = (PageEditing.PageIsInEditMode ? contentArea.Items : contentArea.FilteredItems).ToArray(); foreach (var item in items) { try { var content = item.ContentLink.Get<IContent>(); var templateModel = _templateResolver.Resolve(helper.ViewContext.HttpContext, content.GetOriginalType(), content, TemplateTypeCategories.MvcPartial, templateTag); using (new ContentAreaContext(helper.ViewContext.RequestContext, content.ContentLink)) { helper.RenderContentData(content, true, templateModel, _contentRenderer); } } catch (ContentNotFoundException ex) { LogManager.GetLogger(typeof(HtmlHelpers)).Error(ex.Message, ex); } } } }
private static bool WrapItems(ContentArea contentArea, ContentSerializerSettings contentSerializerSettings) { var wrapItemsAttribute = contentArea.GetType().GetCustomAttribute <ContentSerializerWrapItemsAttribute>(false); var wrapItems = wrapItemsAttribute?.WrapItems ?? contentSerializerSettings.GlobalWrapContentAreaItems; return(wrapItems); }
/// <summary> /// The container breaks the slider content, and we do not need it, /// since we won't edit the content when using this renderer /// </summary> /// <param name="htmlHelper"></param> /// <param name="contentArea"></param> public virtual void RenderWithoutContainer(HtmlHelper htmlHelper, ContentArea contentArea) { if ((contentArea != null) && !contentArea.IsEmpty) { RenderContentAreaItems(htmlHelper, contentArea.FilteredItems); } }
internal protected virtual void Disable() { Enabled = false; Visible = false; content = null; texture = null; }
protected override Grid buildContent() { currentActivePlugins = INIT.MASTER_FILES_ESM.Length; buildLO(); ScrollViewer scrolling_list = new ScrollViewer(); scrolling_list.Height = 400; scrolling_list.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; StackPanel list = getList(); scrolling_list.Content = list; StackPanel controls = getControls(); Grid content = new ContentArea(); content.RowDefinitions.Add(new RowDefinition()); content.ColumnDefinitions.Add(new ColumnDefinition()); content.ColumnDefinitions.Add(new ColumnDefinition()); content.Children.Add(scrolling_list); Grid.SetRow(scrolling_list, 0); Grid.SetColumn(scrolling_list, 0); content.Children.Add(controls); Grid.SetRow(controls, 0); Grid.SetColumn(controls, 1); return(content); }
public IEnumerable <T> GetContentsOfType <T>(ContentArea contentArea) { return(contentArea.IfNotDefault(ca => ca.Items.EmptyIfNull()) .EmptyIfNull() .Select(item => _epiServerDependencies.ContentRepository.Get <IContentData>(item.ContentLink)) .OfType <T>()); }
public override void Render(HtmlHelper htmlHelper, ContentArea contentArea) { if (contentArea == null || contentArea.IsEmpty) { return; } var viewContext = htmlHelper.ViewContext; TagBuilder contentAreaTagBuilder = null; _renderingContext = new ContentAreaRenderingContext(viewContext.ViewData, contentArea); if (!IsInEditMode(htmlHelper) && ShouldRenderWrappingElement(htmlHelper)) { contentAreaTagBuilder = new TagBuilder(GetContentAreaHtmlTag(htmlHelper, contentArea)); AddNonEmptyCssClass(contentAreaTagBuilder, viewContext.ViewData["cssclass"] as string); _composer.Compose(_renderingContext, contentAreaTagBuilder); viewContext.Writer.Write(contentAreaTagBuilder.ToString(TagRenderMode.StartTag)); } RenderContentAreaItems(htmlHelper, contentArea.FilteredItems); _renderingContext = null; if (contentAreaTagBuilder == null) { return; } viewContext.Writer.Write(contentAreaTagBuilder.ToString(TagRenderMode.EndTag)); }
private void Build() { Resizable = false; ContentArea.WidthRequest = 400; ContentArea.BorderWidth = 6; ContentArea.Spacing = 6; red_spinbox = new HScaleSpinButtonWidget(); red_spinbox.Label = Translations.GetString("Red"); InitSpinBox(red_spinbox); green_spinbox = new HScaleSpinButtonWidget(); green_spinbox.Label = Translations.GetString("Green"); InitSpinBox(green_spinbox); blue_spinbox = new HScaleSpinButtonWidget(); blue_spinbox.Label = Translations.GetString("Blue"); InitSpinBox(blue_spinbox); link_button = new CheckButton(Translations.GetString("Linked")); link_button.Active = true; ContentArea.Add(link_button); DefaultWidth = 400; DefaultHeight = 300; ShowAll(); }
public async void Refresh() { AdditionalDataExpander.IsExpanded = false; ChangeLog changeLog = await MainWindow.GetInstance().VersionController.GetChangeLog(); if (changeLog == null) { ContentArea.GetInstance().OpenPage(ContentArea.PageType.Empty); MainWindow.GetInstance().VersionController = null; return; } if (changeLog.AdditionalData == null) { changeLog.AdditionalData = JObject.Parse("{}"); } eventBlock = true; AdditionalDataField.Text = changeLog.AdditionalData.ToString(Formatting.Indented); VersionParent.Children.Clear(); foreach (VersionRef versionRef in changeLog.Versions) { VersionControl versionControl = new VersionControl(versionRef); VersionParent.Children.Add(versionControl); } }
internal protected virtual void Enable(ContentArea content) { this.content = content; DrawOrder = content?.DrawOrder + 10 ?? 99; Enabled = true; Visible = true; }
private void InitSpinBox(HScaleSpinButtonWidget spinbox) { spinbox.DefaultValue = 16; spinbox.MaximumValue = 64; spinbox.MinimumValue = 2; ContentArea.Add(spinbox); }
public void OpenButtonPressed(object sender, RoutedEventArgs args) { if (MainWindow.GetInstance().VersionController != null) { if (MessageBox.Show("Any unsaved changes will be lost.", "Are you sure?", MessageBoxButton.YesNo) == MessageBoxResult.No) { return; } } OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "ChangeLog Json File (changelog.json)|changelog.json"; openFileDialog.InitialDirectory = Environment.SpecialFolder.Personal.ToString(); if (openFileDialog.ShowDialog() == true) { if (!string.IsNullOrEmpty(openFileDialog.FileName)) { if (Path.GetFileName(openFileDialog.FileName) == "changelog.json" && File.Exists(openFileDialog.FileName)) { string dir = Path.GetDirectoryName(openFileDialog.FileName); VersionController controller = new VersionController("0", new FileSystemProvider(dir)); ChangeLog changeLog = controller.GetChangeLog().Result; if (changeLog != null) { MainWindow.GetInstance().VersionController = controller; ContentArea.GetInstance().OpenPage(ContentArea.PageType.ChangeLog); return; } } } MessageBox.Show("The selected file was not a valid 'changelog.json' file.", "Open ChangeLog Failed", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void UpdateFieldOnContent(IDictionary <string, object> properties, IContent con, string k, out string error) { error = ""; //Problem: con might only contain very few properties (not inherited) if (con.Property.Contains(k)) { if (con.Property[k] is EPiServer.SpecializedProperties.PropertyContentArea) { //Handle if property is Content Area. if (con.Property[k].Value == null) { con.Property[k].Value = new ContentArea(); } ContentArea ca = con.Property[k].Value as ContentArea; var lst = properties[k]; if (lst is List <object> ) { foreach (var s in (lst as List <object>)) { var itmref = LookupRef(s.ToString()); ca.Items.Add(new ContentAreaItem() { ContentLink = itmref }); } } } else if (properties[k] is string[]) { con.Property[k].Value = properties[k] as string[]; } else if (con.Property[k].GetType() == typeof(EPiServer.Core.PropertyDate)) { if (properties[k] is DateTime) { con.Property[k].Value = properties[k]; } else { con.Property[k].ParseToSelf((string)properties[k]); } } else { con.Property[k].Value = properties[k]; } } else if (k.ToLower() == "binarydata" && con is MediaData) { dynamic binitm = properties[k]; byte[] bytes = Convert.FromBase64String(binitm); WriteBlobToStorage(con.Name ?? (string)properties["Name"], bytes, con as MediaData); } else { error = k; return; } }
public PreviewPageViewModel(SitePageData currentPage, IContent contentToPreview) : base(currentPage) { PreviewArea = new ContentArea(); PreviewArea.Items.Add(new ContentAreaItem { ContentLink = contentToPreview.ContentLink }); }
public async void BackButtonPressed(object sender, RoutedEventArgs args) { Change change = await openChangeRef.GetChange(); VersionRef versionRef = change.ReleaseVersion; openChangeRef = null; ContentArea.GetInstance().OpenPage(ContentArea.PageType.Version, versionRef); }
public override void Render(HtmlHelper htmlHelper, ContentArea contentArea) { if (contentArea != null && contentArea.Items.Any(i => (i.AllowedRoles ?? Enumerable.Empty <string>()).Any())) { htmlHelper.ViewContext.GetTrackingContext().UsesPersonalizedProperties = true; } _defaultRenderer.Render(htmlHelper, contentArea); }
internal override void Draw(ContentArea contentArea, ColorVariation colorVariation = ColorVariation.None) { Color color = GetColor <GridTile>(colorVariation); BasicShapes.DrawLine(1, color, contentArea.WorldToScreenCoordinates(lowerLeft), contentArea.WorldToScreenCoordinates(lowerRight), contentArea.SpriteBatch); BasicShapes.DrawLine(1, color, contentArea.WorldToScreenCoordinates(lowerRight), contentArea.WorldToScreenCoordinates(upperRight), contentArea.SpriteBatch); BasicShapes.DrawLine(1, color, contentArea.WorldToScreenCoordinates(lowerLeft), contentArea.WorldToScreenCoordinates(upperLeft), contentArea.SpriteBatch); BasicShapes.DrawLine(1, color, contentArea.WorldToScreenCoordinates(upperLeft), contentArea.WorldToScreenCoordinates(upperRight), contentArea.SpriteBatch); }
public PreviewBlock(PageData currentPage, IContent previewContent) : base(currentPage) { PreviewContent = previewContent; ContentArea = new ContentArea(); ContentArea.Items.Add(new ContentAreaItem { ContentLink = PreviewContent.ContentLink }); }
private void SetupPreviewPropertyControl(Property propertyControl, IContent contents) { var contentArea = new ContentArea(); contentArea.Items.Add(new ContentAreaItem { ContentLink = (contents).ContentLink }); var previewProperty = new PropertyContentArea { Value = contentArea, Name = "PreviewPropertyData", IsLanguageSpecific = true }; propertyControl.InnerProperty = previewProperty; propertyControl.DataBind(); }
public ContentReference AddContentArea(ContentReference contentReference) { var contentArea = new ContentArea { Items = { new ContentAreaItem { ContentLink = contentReference } } }; var contentPage = _epiServerDependencies.ContentRepository.Get<ContentPage> (contentReference); contentPage.MainContentArea = contentArea; return _epiServerDependencies.ContentRepository.Save(contentPage, SaveAction.Publish, AccessLevel.NoAccess); }
private void SetupGenericPreviewPropertyControl(Property propertyControl, IEnumerable<BlockData> contents) { var contentArea = new ContentArea(); foreach (var content in contents) { contentArea.Items.Add(new ContentAreaItem { ContentLink = (content as IContent).ContentLink }); } var previewProperty = new PropertyContentArea { Value = contentArea, Name = "PreviewPropertyData", IsLanguageSpecific = true }; propertyControl.InnerProperty = previewProperty; propertyControl.DataBind(); }
public override void Render(HtmlHelper htmlHelper, ContentArea contentArea) { if(contentArea == null || contentArea.IsEmpty) { return; } // capture given CA tag (should be contentArea.Tag, but EPiServer is not filling that property) ContentAreaTag = htmlHelper.ViewData["tag"] as string; if(htmlHelper.ViewData.ModelMetadata.AdditionalValues.ContainsKey($"{nameof(DefaultDisplayOptionMetadataProvider)}__DefaultDisplayOption")) { DefaultContentAreaDisplayOption = htmlHelper.ViewData.ModelMetadata.AdditionalValues[$"{nameof(DefaultDisplayOptionMetadataProvider)}__DefaultDisplayOption"] as string; } var viewContext = htmlHelper.ViewContext; TagBuilder tagBuilder = null; if(!IsInEditMode(htmlHelper) && ShouldRenderWrappingElement(htmlHelper)) { tagBuilder = new TagBuilder(GetContentAreaHtmlTag(htmlHelper, contentArea)); AddNonEmptyCssClass(tagBuilder, viewContext.ViewData["cssclass"] as string); if(AutoAddRow) { AddNonEmptyCssClass(tagBuilder, "row"); } viewContext.Writer.Write(tagBuilder.ToString(TagRenderMode.StartTag)); } RenderContentAreaItems(htmlHelper, contentArea.FilteredItems); if(tagBuilder == null) { return; } viewContext.Writer.Write(tagBuilder.ToString(TagRenderMode.EndTag)); }
public virtual void PopulateContentArea(RawProperty contentAreaProperty, IEnumerable<ComposerContentFunction> composerFunctions) { composerFunctions = composerFunctions.Where(f => f.Guid != Guid.Empty); if (composerFunctions == null || !composerFunctions.Any()) { contentAreaProperty.IsNull = true; return; } // Populate the ContentArea property from the ContentFunction data var contentArea = new ContentArea(); foreach (var block in composerFunctions) { var mappedGuid = GetMappedGuid(block.Guid); var fragment = _contentFragmentBuilder.CreateFragment(mappedGuid, block.PersonalizationGroup, block.VisitorGroups); contentArea.Fragments.Add(fragment); } contentAreaProperty.Value = contentArea.ToInternalString(); contentAreaProperty.IsNull = false; }
public override void Render(HtmlHelper htmlHelper, ContentArea contentArea) { RenderWithoutContainer(htmlHelper, contentArea); }