protected virtual bool IsEnabled(AtomEntry entry)
    {
      BlogAppCollection coll = new BlogAppCollection(AppService.GetCollection(entry.Id));

      if (!coll.AnnotationsOn) return false; //in case they got turned off
      if (!coll.TrackbacksOn) return false;
      if (!entry.AllowAnnotate) return false;
      //TODO: check expired
      return true;
    }
 public override bool IsEnabled(BaseModel baseModel, Include include)
 {
   BlogAppCollection c = new BlogAppCollection(baseModel.Collection);
   return (c.AnnotationsOn && c.BloggingOn &&
     baseModel.AuthorizeService.IsAuthorized(baseModel.User, baseModel.Scope, AuthAction.Annotate));
 }
 public override bool IsEnabled(BaseModel baseModel, Include include)
 {
   BlogAppCollection c = new BlogAppCollection(baseModel.Collection);
   return (c.AnnotationsOn && c.BloggingOn);
 }
    //[ActionOutputCache(120 * SEC, true)]
    public virtual ActionResult Entry(string workspace, string collection, int? year, int? month, int? day, string path)
    {
      if (!Collection.Visible) throw new ResourceNotFoundException("entry", EntryId.ToString());

      AtomEntry entry = AtomPubService.GetEntry(EntryId);
      BlogAppCollection coll = new BlogAppCollection(Collection);
      if (coll.SyndicationOn && coll.TrackbacksOn)
      {
        Response.AddHeader("X-Pingback", Url.RouteIdUrl("Pingback", entry.Id, AbsoluteMode.Force).ToString());
      }
      string view = "BlogEntry";
      if (!string.IsNullOrEmpty(Collection.DefaultEntryView)) view = Collection.DefaultEntryView;
      return View(view, new BlogEntryModel() { Entry = entry });
    }
 public PartialViewResult BlogSettings(string workspace, string collection)
 {
   BlogSettingsModel m = new BlogSettingsModel();
   BlogAppCollection c = new BlogAppCollection(Collection);
   m.BloggingOn = c.BloggingOn;
   m.TrackbacksOn = c.TrackbacksOn;
   return PartialView("BlogSettingsWidget", m);
 }
 public ActionResult UpdateSettings(string workspace, string collection, BlogSettingsModel m)
 {
   try
   {
     BlogAppCollection c = new BlogAppCollection(AppService.GetCollection(workspace, collection));
     c.BloggingOn = m.BloggingOn ?? false;
     c.TrackbacksOn = m.TrackbacksOn ?? false;
     AtomPubService.UpdateService(AppService);
     ServerApp.Restart();
     TempData["saved"] = true;
   }
   catch (Exception ex)
   {
     LogService.Error(ex);
     m.Errors.Add(ex.Message);
   }
   return RedirectToAction("Settings", "Admin", new { workspace = workspace, collection = collection });
 }
 private void ResetTrackbacks(Id collId, AppService appSvc)
 {
   if (collId == null) return;
   var bcoll = new BlogAppCollection(appSvc.GetCollection(collId));
   //get old value
   bool? on = bcoll.GetBooleanProperty(Atom.SvcNs + "tracbacksWereOn");
   bcoll.TrackbacksOn = on.HasValue ? on.Value : true;
   bcoll.SetBooleanProperty(Atom.SvcNs + "tracbacksWereOn", null);
 }
 private void TurnOffTrackbacks(Id collId, AppService appSvc)
 {
   if (collId == null) return;
   var bcoll = new BlogAppCollection(appSvc.GetCollection(collId));
   //store old value
   bcoll.SetBooleanProperty(Atom.SvcNs + "tracbacksWereOn", bcoll.TrackbacksOn);
   bcoll.TrackbacksOn = false;
 }