예제 #1
0
 public GroupEditViewModel(Translator translator, IDatabase db, Session session, Feed feed)
     : this(translator)
 {
     Method           = "add";
     Id               = feed.Id.Value.ToString();
     Name             = translator.CreateLanguagesMultiItem("Group.Edit.Field.Name", "Name field in the group edit dialog", "Name ({0})", new MultiLanguageString());
     MailName         = translator.CreateLanguagesMultiItem("Group.Edit.Field.MailName", "MailName field in the group edit dialog", "Name in E-Mail ({0})", new MultiLanguageString());
     MailAddress      = translator.CreateLanguagesMultiItem("Group.Edit.Field.MailAddress", "MailAddress field in the group edit dialog", "E-Mail address ({0})", new MultiLanguageString());
     CryptoAccess     = session.HasAccess(feed, PartAccess.Crypto, AccessRight.Write);
     GpgKeyId         = string.Empty;
     GpgKeyPassphrase = string.Empty;
 }
예제 #2
0
 public RoleEditViewModel(Translator translator, IDatabase db, Role role)
     : this(translator)
 {
     Method = "edit";
     Id     = role.Id.ToString();
     Name   = translator.CreateLanguagesMultiItem("Role.Edit.Field.Name", "Name field in the role edit dialog", "Name ({0})", role.Name.Value);
 }
예제 #3
0
 public RoleEditViewModel(Translator translator, IDatabase db, Group group)
     : this(translator)
 {
     Method = "add";
     Id     = group.Id.Value.ToString();
     Name   = translator.CreateLanguagesMultiItem("Role.Edit.Field.Name", "Name field in the role edit dialog", "Name ({0})", new MultiLanguageString());
 }
예제 #4
0
 public StateEditViewModel(Translator translator, IDatabase db, State state)
     : this(translator)
 {
     Method = "edit";
     Id     = state.Id.ToString();
     Name   = translator.CreateLanguagesMultiItem("State.Edit.Field.Name", "Field 'Name' in the edit state dialog", "Name ({0})", state.Name.Value);
 }
예제 #5
0
 public StateEditViewModel(Translator translator, IDatabase db)
     : this(translator)
 {
     Method = "add";
     Id     = "new";
     Name   = translator.CreateLanguagesMultiItem("State.Edit.Field.Name", "Field 'Name' in the edit state dialog", "Name ({0})", new MultiLanguageString());
 }
예제 #6
0
 public CountryEditViewModel(Translator translator, IDatabase db, Country country)
     : this(translator)
 {
     Method = "edit";
     Id     = country.Id.ToString();
     Name   = translator.CreateLanguagesMultiItem("Country.Edit.Field.Name", "Name field in the country edit dialog", "Name ({0})", country.Name.Value);
 }
예제 #7
0
 public CountryEditViewModel(Translator translator, IDatabase db)
     : this(translator)
 {
     Method = "add";
     Id     = "new";
     Name   = translator.CreateLanguagesMultiItem("Country.Edit.Field.Name", "Name field in the country edit dialog", "Name ({0})", new MultiLanguageString());
 }
예제 #8
0
 public GroupEditViewModel(Translator translator, IDatabase db, Session session, Group group)
     : this(translator)
 {
     Method       = "edit";
     Id           = group.Id.ToString();
     Name         = translator.CreateLanguagesMultiItem("Group.Edit.Field.Name", "Name field in the group edit dialog", "Name ({0})", group.Name.Value);
     MailName     = translator.CreateLanguagesMultiItem("Group.Edit.Field.MailName", "MailName field in the group edit dialog", "Name in E-Mail ({0})", group.MailName.Value);
     MailAddress  = translator.CreateLanguagesMultiItem("Group.Edit.Field.MailAddress", "MailAddress field in the group edit dialog", "E-Mail address ({0})", group.MailAddress.Value);
     CryptoAccess = session.HasAccess(group, PartAccess.Crypto, AccessRight.Write);
     if (CryptoAccess)
     {
         GpgKeyId         = group.GpgKeyId.Value;
         GpgKeyPassphrase = group.GpgKeyPassphrase.Value;
     }
     else
     {
         GpgKeyId         = string.Empty;
         GpgKeyPassphrase = string.Empty;
     }
 }
예제 #9
0
 public TagEditViewModel(Translator translator, IDatabase db, Tag tag)
     : this(translator)
 {
     Method = "edit";
     Id     = tag.Id.ToString();
     Name   = translator.CreateLanguagesMultiItem("Tag.Edit.Field.Name", "Name field in the tag edit dialog", "Name ({0})", tag.Name.Value);
     Usages = new List <NamedIntViewModel>();
     Usages.Add(new NamedIntViewModel(translator, TagUsage.Mailing, tag.Usage.Value.HasFlag(TagUsage.Mailing)));
     Modes = new List <NamedIntViewModel>();
     Modes.Add(new NamedIntViewModel(translator, TagMode.Default, tag.Mode.Value.HasFlag(TagMode.Default)));
     Modes.Add(new NamedIntViewModel(translator, TagMode.Manual, tag.Mode.Value.HasFlag(TagMode.Manual)));
     Modes.Add(new NamedIntViewModel(translator, TagMode.Self, tag.Mode.Value.HasFlag(TagMode.Self)));
 }
예제 #10
0
 public TagEditViewModel(Translator translator, IDatabase db)
     : this(translator)
 {
     Method = "add";
     Id     = "new";
     Name   = translator.CreateLanguagesMultiItem("Tag.Edit.Field.Name", "Name field in the tag edit dialog", "Name ({0})", new MultiLanguageString());
     Usages = new List <NamedIntViewModel>();
     Usages.Add(new NamedIntViewModel(translator, TagUsage.Mailing, false));
     Modes = new List <NamedIntViewModel>();
     Modes.Add(new NamedIntViewModel(translator, TagMode.Default, false));
     Modes.Add(new NamedIntViewModel(translator, TagMode.Manual, false));
     Modes.Add(new NamedIntViewModel(translator, TagMode.Self, false));
 }
예제 #11
0
 public FeedEditViewModel(Translator translator, IDatabase db)
     : this(translator)
 {
     Method  = "add";
     Id      = "new";
     Name    = translator.CreateLanguagesMultiItem("Feed.Edit.Field.Name", "Name field in the feed edit dialog", "Name ({0})", new MultiLanguageString());
     Parent  = string.Empty;
     Parents = new List <NamedIdViewModel>(
         db.Query <Feed>()
         .Select(o => new NamedIdViewModel(translator, o, false))
         .OrderBy(o => o.Name));
     Parents.Add(new NamedIdViewModel(
                     translator.Get("Feed.Edit.Field.Parent.None", "No value in the field 'Parent' in the feed edit dialog", "<None>"),
                     false, true));
 }
예제 #12
0
        public FeedEditViewModel(Translator translator, IDatabase db, Feed feed)
            : this(translator)
        {
            Method = "edit";
            Id     = feed.Id.ToString();
            Name   = translator.CreateLanguagesMultiItem("Feed.Edit.Field.Name", "Name field in the feed edit dialog", "Name ({0})", feed.Name.Value);
            Parent =
                feed.Parent.Value != null?
                feed.Parent.Value.Id.Value.ToString() :
                    string.Empty;

            Parents = new List <NamedIdViewModel>(
                db.Query <Feed>()
                .Where(o => !feed.Subordinates.Contains(o))
                .Where(o => feed != o)
                .Select(o => new NamedIdViewModel(translator, o, o == feed.Parent.Value))
                .OrderBy(o => o.Name));
            Parents.Add(new NamedIdViewModel(
                            translator.Get("Feed.Edit.Field.Parent.None", "No value in the field 'Parent' in the feed edit dialog", "<None>"),
                            false, feed.Parent.Value == null));
        }