Ejemplo n.º 1
0
		public ActionResult SaveSite(EditModel.SiteModel model) {
			Piranha.Config.Site.Title = model.Title;
			Piranha.Config.Site.Description = model.Description;
			Piranha.Config.Site.ArchivePageSize = model.ArchivePageSize;

			return JsonData(true, EditModel.Get(api));
		}
Ejemplo n.º 2
0
		public ActionResult SaveComments(EditModel.CommentModel model) {
			Piranha.Config.Comments.ModerateAnonymous = model.ModerateAnonymous;
			Piranha.Config.Comments.ModerateAuthorized = model.ModerateAuthorized;
			Piranha.Config.Comments.NotifyAuthor = model.NotifyAuthor;
			Piranha.Config.Comments.NotifyModerators = model.NotifyModerators;
			Piranha.Config.Comments.Moderators = model.Moderators;

			return JsonData(true, EditModel.Get(api));
		}
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the edit model with the current configuration values.
        /// </summary>
        /// <returns>The model</returns>
        public static EditModel Get(Api api)
        {
            var m = new EditModel();

            m.Cache.Expires = Piranha.Config.Cache.Expires;
            m.Cache.MaxAge  = Piranha.Config.Cache.MaxAge;

            m.Comments.ModerateAnonymous  = Piranha.Config.Comments.ModerateAnonymous;
            m.Comments.ModerateAuthorized = Piranha.Config.Comments.ModerateAuthorized;
            m.Comments.NotifyAuthor       = Piranha.Config.Comments.NotifyAuthor;
            m.Comments.NotifyModerators   = Piranha.Config.Comments.NotifyModerators;
            m.Comments.Moderators         = Piranha.Config.Comments.Moderators;

            m.Site.Title           = Piranha.Config.Site.Title;
            m.Site.Description     = Piranha.Config.Site.Description;
            m.Site.ArchivePageSize = Piranha.Config.Site.ArchivePageSize;

            Manager.Config.Refresh(api);
            foreach (var block in Manager.Config.Blocks.OrderBy(b => b.Section).ThenBy(b => b.Name))
            {
                foreach (var row in block.Rows)
                {
                    foreach (var col in row.Columns)
                    {
                        foreach (var item in col.Items)
                        {
                            m.Params.Add(new ParamModel()
                            {
                                Name  = item.Param,
                                Value = item.Value
                            });
                        }
                    }
                }
            }
            return(m);
        }
Ejemplo n.º 4
0
		/// <summary>
		/// Gets the edit model with the current configuration values.
		/// </summary>
		/// <returns>The model</returns>
		public static EditModel Get(Api api) {
			var m = new EditModel();

			m.Cache.Expires = Piranha.Config.Cache.Expires;
			m.Cache.MaxAge = Piranha.Config.Cache.MaxAge;

			m.Comments.ModerateAnonymous = Piranha.Config.Comments.ModerateAnonymous;
			m.Comments.ModerateAuthorized = Piranha.Config.Comments.ModerateAuthorized;
			m.Comments.NotifyAuthor = Piranha.Config.Comments.NotifyAuthor;
			m.Comments.NotifyModerators = Piranha.Config.Comments.NotifyModerators;
			m.Comments.Moderators = Piranha.Config.Comments.Moderators;

			m.Site.Title = Piranha.Config.Site.Title;
			m.Site.Description = Piranha.Config.Site.Description;
			m.Site.ArchivePageSize = Piranha.Config.Site.ArchivePageSize;

			Manager.Config.Refresh(api);
			foreach (var block in Manager.Config.Blocks.OrderBy(b => b.Section).ThenBy(b => b.Name)) {
				foreach (var row in block.Rows) {
					foreach (var col in row.Columns) {
						foreach (var item in col.Items)
							m.Params.Add(new ParamModel() { 
								Name = item.Param, 
								Value = item.Value 
							});
					}
				}
			}
			return m;
		}
Ejemplo n.º 5
0
		public ActionResult SaveCache(EditModel.CacheModel model) {
			Piranha.Config.Cache.Expires = model.Expires;
			Piranha.Config.Cache.MaxAge = model.MaxAge;

			return JsonData(true, EditModel.Get(api));
		}