/// <summary>
        /// Configures the note editor.
        /// </summary>
        /// <param name="personId">The person identifier.</param>
        private void ConfigureNoteEditor()
        {
            var noteTypes = NoteTypeCache.GetByEntity(EntityTypeCache.GetId <Rock.Model.Person>(), string.Empty, string.Empty, true);

            // If block is configured to only allow certain note types, limit notes to those types.
            var configuredNoteTypes = GetAttributeValue(AttributeKey.NoteTypes).SplitDelimitedValues().AsGuidList();

            if (configuredNoteTypes.Any())
            {
                noteTypes = noteTypes.Where(n => configuredNoteTypes.Contains(n.Guid)).ToList();
            }

            NoteOptions noteOptions = new NoteOptions(this.ViewState)
            {
                NoteTypes           = noteTypes.ToArray(),
                AddAlwaysVisible    = true,
                DisplayType         = NoteDisplayType.Full,
                ShowAlertCheckBox   = true,
                ShowPrivateCheckBox = true,
                UsePersonIcon       = true,
                ShowSecurityButton  = false,
                ShowCreateDateInput = false,
            };

            noteEditor.SetNoteOptions(noteOptions);
            noteEditor.NoteTypeId = noteTypes.FirstOrDefault()?.Id;
        }
        /// <summary>
        /// Renders the notes.
        /// </summary>
        private void ShowNotes()
        {
            IEntity contextEntity;

            if (ContextTypesRequired.Count == 1)
            {
                contextEntity = this.ContextEntity(ContextTypesRequired.First().Name);
            }
            else
            {
                contextEntity = this.ContextEntity();
            }

            if (contextEntity != null)
            {
                upNotes.Visible = true;

                string noteTypeName = GetAttributeValue("NoteType");

                using (var rockContext = new RockContext())
                {
                    var noteTypes = NoteTypeCache.GetByEntity(contextEntity.TypeId, string.Empty, string.Empty, true);

                    // If block is configured to only allow certain note types, limit notes to those types.
                    var configuredNoteTypes = GetAttributeValue("NoteTypes").SplitDelimitedValues().AsGuidList();
                    if (configuredNoteTypes.Any())
                    {
                        noteTypes = noteTypes.Where(n => configuredNoteTypes.Contains(n.Guid)).ToList();
                    }

                    NoteOptions noteOptions = new NoteOptions(notesTimeline)
                    {
                        EntityId               = contextEntity.Id,
                        NoteTypes              = noteTypes.ToArray(),
                        NoteLabel              = GetAttributeValue("NoteTerm"),
                        DisplayType            = GetAttributeValue("DisplayType") == "Light" ? NoteDisplayType.Light : NoteDisplayType.Full,
                        ShowAlertCheckBox      = GetAttributeValue("ShowAlertCheckbox").AsBoolean(),
                        ShowPrivateCheckBox    = GetAttributeValue("ShowPrivateCheckbox").AsBoolean(),
                        ShowSecurityButton     = GetAttributeValue("ShowSecurityButton").AsBoolean(),
                        AddAlwaysVisible       = GetAttributeValue("AddAlwaysVisible").AsBoolean(),
                        ShowCreateDateInput    = GetAttributeValue("AllowBackdatedNotes").AsBoolean(),
                        NoteViewLavaTemplate   = GetAttributeValue("NoteViewLavaTemplate"),
                        DisplayNoteTypeHeading = GetAttributeValue("DisplayNoteTypeHeading").AsBoolean(),
                        UsePersonIcon          = GetAttributeValue("UsePersonIcon").AsBoolean(),
                        ExpandReplies          = GetAttributeValue("ExpandReplies").AsBoolean()
                    };

                    notesTimeline.NoteOptions         = noteOptions;
                    notesTimeline.Title               = GetAttributeValue("Heading");
                    notesTimeline.TitleIconCssClass   = GetAttributeValue("HeadingIcon");
                    notesTimeline.AllowAnonymousEntry = GetAttributeValue("Allow Anonymous").AsBoolean();
                    notesTimeline.SortDirection       = GetAttributeValue("DisplayOrder") == "Ascending" ? ListSortDirection.Ascending : ListSortDirection.Descending;
                }
            }
            else
            {
                upNotes.Visible = false;
            }
        }
        /// <summary>
        /// Renders the notes.
        /// </summary>
        private void ShowNotes()
        {
            if (gmpGroupMember.SelectedValueAsId().HasValue)
            {
                _entityId = gmpGroupMember.SelectedValueAsId();
            }
            if (ppPerson.SelectedValue.HasValue)
            {
                _entityId = ppPerson.SelectedValue;
            }

            if (_entityTypeId.HasValue && _entityId.HasValue)
            {
                notesTimeline.Visible = true;

                using (var rockContext = new RockContext())
                {
                    List <NoteTypeCache> noteTypes = getNoteTypes();

                    NoteOptions noteOptions = new NoteOptions(new NoteContainer())
                    {
                        EntityId               = _entityId,
                        NoteTypes              = noteTypes.ToArray(),
                        NoteLabel              = GetAttributeValue("NoteTerm"),
                        DisplayType            = GetAttributeValue("DisplayType") == "Light" ? NoteDisplayType.Light : NoteDisplayType.Full,
                        ShowAlertCheckBox      = GetAttributeValue("ShowAlertCheckbox").AsBoolean(),
                        ShowPrivateCheckBox    = GetAttributeValue("ShowPrivateCheckbox").AsBoolean(),
                        ShowSecurityButton     = GetAttributeValue("ShowSecurityButton").AsBoolean(),
                        AddAlwaysVisible       = true,
                        ShowCreateDateInput    = GetAttributeValue("AllowBackdatedNotes").AsBoolean(),
                        NoteViewLavaTemplate   = GetAttributeValue("NoteViewLavaTemplate"),
                        DisplayNoteTypeHeading = GetAttributeValue("DisplayNoteTypeHeading").AsBoolean(),
                        UsePersonIcon          = false,
                        ExpandReplies          = GetAttributeValue("ExpandReplies").AsBoolean()
                    };

                    notesTimeline.NoteOptions         = noteOptions;
                    notesTimeline.Title               = string.Format("Add a {0}", GetAttributeValue("NoteTerm"));
                    notesTimeline.TitleIconCssClass   = "fa fa-sticky-note";
                    notesTimeline.AllowAnonymousEntry = false;
                    notesTimeline.SortDirection       = ListSortDirection.Descending;

                    var noteEditor = ( NoteEditor )notesTimeline.Controls[0];
                    noteEditor.Text             = GetAttributeValue("DefaultNoteText");
                    noteEditor.CssClass         = "note-new-kfs";
                    noteEditor.SaveButtonClick += note_SaveButtonClick;
                }
            }
            else
            {
                notesTimeline.Visible = false;
            }
        }
示例#4
0
    public async Task <Guid> CreateDefaultNoteAsync(NoteOptions options)
    {
        var spaceId = await GetOrCreateDefaultSpaceAsync();

        var command = new CreateNoteCommand
        {
            SpaceId = spaceId,
            Title   = ".Net 6",
            Content = ".Net 6 new feature",
            Status  = options.Status
        };

        return(await GetService <IMediator>().Send(command));
    }
示例#5
0
    public static Note CreateNote(NoteOptions options)
    {
        var authorId = options.UserId ?? new FakeCurrentUser().Id;

        var mockSpaceChecker = new Mock <ISpaceChecker>();

        mockSpaceChecker.Setup(s => s.IsUniqueNameInUserSpace(It.IsAny <Guid>(), It.IsAny <string>()))
        .Returns(true);

        var space = Space.Initialize(mockSpaceChecker.Object, authorId, "microsoft", "https://image.microsoft.com",
                                     Visibility.Public);

        return(space.CreateNote(options.Title ?? "microsoft", options.Content ?? ".Net 6 new feature", options.Status));
    }
示例#6
0
 public Note(NoteOptions noteOptionse)
 {
 }