public ViewResult ThemeUpload() { var m = new AdminModel(); if (TempData["success"] != null) m.Notifications.Add("Success", string.Format("The theme '{0}' was uploaded and installed successfully.", TempData["success"])); return View("AdminThemeUpload", "Admin", m); }
public ViewResult Tools(string workspace, string collection) { var m = new AdminModel(); //m.Notifications.Add("Already have a blog?", "Help build an import tool to convert other blog formats into Atom format."); if (TempData["error"] != null) m.Errors.Add((string)TempData["error"]); if (TempData["notify"] != null) m.Notifications.Add(((KeyValuePair<string, string>)TempData["notify"]).Key, ((KeyValuePair<string, string>)TempData["notify"]).Value); return View("AdminTools", "Admin", m); }
public ViewResult Settings(string workspace, string collection) { string view = "AdminSettings"; AdminModel m = null; if (Scope.IsEntireSite) { var esm = TempData["model"] as AdminSettingsEntireSiteModel; if (esm == null) { esm = new AdminSettingsEntireSiteModel(); esm.SiteAddress = AppService.Base; esm.DefaultSubdomain = AppService.DefaultSubdomain; esm.ServiceType = AppService.ServiceType.ToString(); esm.Secure = AppService.Secure; } view = "AdminSettingsEntireSite"; m = esm; } else if (Scope.IsWorkspace) { var wm = TempData["model"] as AdminSettingsWorkspaceModel; if (wm == null) { wm = new AdminSettingsWorkspaceModel(); //wm.Workspace = workspace; wm.Title = Workspace.Title.Text; wm.Subtitle = Workspace.Subtitle != null ? Workspace.Subtitle.Text : null; wm.Name = Workspace.Name; } view = "AdminSettingsWorkspace"; m = wm; } else { var cm = TempData["model"] as AdminSettingsCollectionModel; if (cm == null) { cm = new AdminSettingsCollectionModel(); cm.CollectionId = Collection.Id; cm.Title = Collection.Title.Text; cm.Subtitle = Collection.Subtitle != null ? Collection.Subtitle.Text : null; cm.Owner = Collection.Id.Owner; cm.Name = Collection.Id.Collection; cm.Dated = Collection.Dated; cm.Visible = Collection.Visible; cm.AnnotationsOn = Collection.AnnotationsOn; cm.SyndicationOn = Collection.SyndicationOn; } view = "AdminSettingsCollection"; m = cm; } if (m == null) m = new AdminModel(); if (TempData["new"] != null) m.Notifications.Add((string)TempData["new"], "was created successfully! Changes may take some time before they appear."); else if (TempData["saved"] != null) m.Notifications.Add("Saved", "settings successfully! Changes may take some time before they appear."); return View(view, "Admin", m); }
public ActionResult ThemeUpload(HttpPostedFileBase uptheme) { AdminModel model = new AdminModel(); try { if (uptheme.ContentLength == 0) throw new Exception("Empty file uploaded"); LogService.Info("Theme uploaded filename={0} contentType={1} contentLength={2}", uptheme.FileName, uptheme.ContentType, uptheme.ContentLength); string theme = ThemeService.InstallTheme(uptheme.InputStream, Path.GetFileName(uptheme.FileName), uptheme.ContentType); TempData["success"] = theme; return RedirectToAction("ThemeUpload"); } catch (Exception ex) { LogService.Error(ex); model.Errors.Add(ex.Message); } return View("AdminThemeUpload", "Admin", model); }