Browse Source

Initial Podcast creation.

Renamed some Blog objects
pull/29/head
Teknikode 7 years ago
parent
commit
c48bfc3be9
  1. 2
      Teknik/Areas/Blog/BlogAreaRegistration.cs
  2. 50
      Teknik/Areas/Blog/Controllers/BlogController.cs
  3. 2
      Teknik/Areas/Blog/Models/Blog.cs
  4. 6
      Teknik/Areas/Blog/Models/BlogPost.cs
  5. 8
      Teknik/Areas/Blog/Models/BlogPostComment.cs
  6. 10
      Teknik/Areas/Blog/ViewModels/CommentViewModel.cs
  7. 6
      Teknik/Areas/Blog/ViewModels/PostViewModel.cs
  8. 2
      Teknik/Areas/Blog/Views/Blog/Post.cshtml
  9. 10
      Teknik/Areas/Home/Controllers/HomeController.cs
  10. 6
      Teknik/Areas/Home/ViewModels/HomeViewModel.cs
  11. 80
      Teknik/Areas/Podcast/Content/Podcast.css
  12. 276
      Teknik/Areas/Podcast/Controllers/PodcastController.cs
  13. 30
      Teknik/Areas/Podcast/Models/Podcast.cs
  14. 25
      Teknik/Areas/Podcast/Models/PodcastComment.cs
  15. 24
      Teknik/Areas/Podcast/Models/PodcastFile.cs
  16. 58
      Teknik/Areas/Podcast/PodcastAreaRegistration.cs
  17. 280
      Teknik/Areas/Podcast/Scripts/Podcast.js
  18. 29
      Teknik/Areas/Podcast/ViewModels/CommentViewModel.cs
  19. 17
      Teknik/Areas/Podcast/ViewModels/MainViewModel.cs
  20. 45
      Teknik/Areas/Podcast/ViewModels/PodcastViewModel.cs
  21. 30
      Teknik/Areas/Podcast/Views/Podcast/Comment.cshtml
  22. 6
      Teknik/Areas/Podcast/Views/Podcast/Comments.cshtml
  23. 138
      Teknik/Areas/Podcast/Views/Podcast/Main.cshtml
  24. 50
      Teknik/Areas/Podcast/Views/Podcast/Podcast.cshtml
  25. 6
      Teknik/Areas/Podcast/Views/Podcast/Podcasts.cshtml
  26. 135
      Teknik/Areas/Podcast/Views/Podcast/ViewPodcast.cshtml
  27. 3
      Teknik/Areas/Podcast/Views/_ViewStart.cshtml
  28. 36
      Teknik/Areas/Podcast/Views/web.config
  29. 29
      Teknik/Configuration/Config.cs
  30. 28
      Teknik/Configuration/PodcastConfig.cs
  31. 266
      Teknik/Content/audioplayer.css
  32. 16
      Teknik/Models/TeknikEntities.cs
  33. BIN
      Teknik/Scripts/_references.js
  34. 6
      Teknik/Scripts/audioplayer.min.js
  35. 1302
      Teknik/Scripts/bootstrap-markdown.js
  36. 1457
      Teknik/Scripts/jquery.fileupload.js
  37. 214
      Teknik/Scripts/jquery.iframe-transport.js
  38. 29
      Teknik/Teknik.csproj

2
Teknik/Areas/Blog/BlogAreaRegistration.cs

@ -43,7 +43,7 @@ namespace Teknik.Areas.Blog @@ -43,7 +43,7 @@ namespace Teknik.Areas.Blog
"~/Scripts/ocupload/1.1.2/ocupload.js",
"~/Scripts/PageDown/Markdown.Converter.js",
"~/Scripts/PageDown/Markdown.Sanitizer.js",
"~/Scripts/bootstrap/markdown/bootstrap-markdown.js",
"~/Scripts/bootstrap-markdown.js",
"~/Scripts/bootbox/bootbox.min.js",
"~/Areas/Blog/Scripts/Blog.js"));
// Register Style Bundles

50
Teknik/Areas/Blog/Controllers/BlogController.cs

@ -28,8 +28,8 @@ namespace Teknik.Areas.Blog.Controllers @@ -28,8 +28,8 @@ namespace Teknik.Areas.Blog.Controllers
if (string.IsNullOrEmpty(username))
{
ViewBag.Title = "Teknik Blog - " + Config.Title;
var foundPosts = (User.IsInRole("Admin")) ? db.Posts.Include("Blog").Include("Blog.User").Where(p => (p.System))
: db.Posts.Include("Blog").Include("Blog.User").Where(p => (p.System && p.Published));
var foundPosts = (User.IsInRole("Admin")) ? db.BlogPosts.Include("Blog").Include("Blog.User").Where(p => (p.System))
: db.BlogPosts.Include("Blog").Include("Blog.User").Where(p => (p.System && p.Published));
model = new BlogViewModel();
model.BlogId = Constants.SERVERBLOGID;
@ -54,8 +54,8 @@ namespace Teknik.Areas.Blog.Controllers @@ -54,8 +54,8 @@ namespace Teknik.Areas.Blog.Controllers
// find the blog specified
if (blog != null)
{
var foundPosts = (User.IsInRole("Admin")) ? db.Posts.Include("Blog").Include("Blog.User").Where(p => (p.BlogId == blog.BlogId && !p.System))
: db.Posts.Include("Blog").Include("Blog.User").Where(p => (p.BlogId == blog.BlogId && !p.System) &&
var foundPosts = (User.IsInRole("Admin")) ? db.BlogPosts.Include("Blog").Include("Blog.User").Where(p => (p.BlogId == blog.BlogId && !p.System))
: db.BlogPosts.Include("Blog").Include("Blog.User").Where(p => (p.BlogId == blog.BlogId && !p.System) &&
(p.Published || p.Blog.User.Username == User.Identity.Name));
model = new BlogViewModel();
model.BlogId = blog.BlogId;
@ -82,8 +82,8 @@ namespace Teknik.Areas.Blog.Controllers @@ -82,8 +82,8 @@ namespace Teknik.Areas.Blog.Controllers
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
// find the post specified
var posts = (User.IsInRole("Admin")) ? db.Posts.Include("Blog").Include("Blog.User").Where(p => (p.Blog.User.Username == username && p.PostId == id))
: db.Posts.Include("Blog").Include("Blog.User").Where(p => (p.Blog.User.Username == username && p.PostId == id) &&
var posts = (User.IsInRole("Admin")) ? db.BlogPosts.Include("Blog").Include("Blog.User").Where(p => (p.Blog.User.Username == username && p.BlogPostId == id))
: db.BlogPosts.Include("Blog").Include("Blog.User").Where(p => (p.Blog.User.Username == username && p.BlogPostId == id) &&
(p.Published || p.Blog.User.Username == User.Identity.Name));
if (posts != null && posts.Any())
{
@ -99,13 +99,13 @@ namespace Teknik.Areas.Blog.Controllers @@ -99,13 +99,13 @@ namespace Teknik.Areas.Blog.Controllers
[AllowAnonymous]
public ActionResult GetPosts(int blogID, int startPostID, int count)
{
var posts = (User.IsInRole("Admin")) ? db.Posts.Include("Blog").Include("Blog.User").Where(p => ((p.BlogId == blogID && !p.System) || (p.System && blogID == Constants.SERVERBLOGID))).OrderByDescending(p => p.DatePosted).Skip(startPostID).Take(count).ToList()
: db.Posts.Include("Blog").Include("Blog.User").Where(p => ((p.BlogId == blogID && !p.System) || (p.System && blogID == Constants.SERVERBLOGID)) && (p.Published || p.Blog.User.Username == User.Identity.Name)
var posts = (User.IsInRole("Admin")) ? db.BlogPosts.Include("Blog").Include("Blog.User").Where(p => ((p.BlogId == blogID && !p.System) || (p.System && blogID == Constants.SERVERBLOGID))).OrderByDescending(p => p.DatePosted).Skip(startPostID).Take(count).ToList()
: db.BlogPosts.Include("Blog").Include("Blog.User").Where(p => ((p.BlogId == blogID && !p.System) || (p.System && blogID == Constants.SERVERBLOGID)) && (p.Published || p.Blog.User.Username == User.Identity.Name)
).OrderByDescending(p => p.DatePosted).Skip(startPostID).Take(count).ToList();
List<PostViewModel> postViews = new List<PostViewModel>();
if (posts != null)
{
foreach (Post post in posts)
foreach (BlogPost post in posts)
{
postViews.Add(new PostViewModel(post));
}
@ -118,8 +118,8 @@ namespace Teknik.Areas.Blog.Controllers @@ -118,8 +118,8 @@ namespace Teknik.Areas.Blog.Controllers
public ActionResult GetPostTitle(int postID)
{
string title = string.Empty;
Post post = (User.IsInRole("Admin")) ? db.Posts.Find(postID)
: db.Posts.Include("Blog").Include("Blog.User").Where(p => (p.PostId == postID) && (p.Published || p.Blog.User.Username == User.Identity.Name)).First();
BlogPost post = (User.IsInRole("Admin")) ? db.BlogPosts.Find(postID)
: db.BlogPosts.Include("Blog").Include("Blog.User").Where(p => (p.BlogPostId == postID) && (p.Published || p.Blog.User.Username == User.Identity.Name)).First();
if (post != null)
{
return Json(new { result = post.Title });
@ -132,7 +132,7 @@ namespace Teknik.Areas.Blog.Controllers @@ -132,7 +132,7 @@ namespace Teknik.Areas.Blog.Controllers
public ActionResult GetPostArticle(int postID)
{
string title = string.Empty;
Post post = (User.IsInRole("Admin")) ? db.Posts.Find(postID) : db.Posts.Include("Blog").Include("Blog.User").Where(p => (p.PostId == postID) &&
BlogPost post = (User.IsInRole("Admin")) ? db.BlogPosts.Find(postID) : db.BlogPosts.Include("Blog").Include("Blog.User").Where(p => (p.BlogPostId == postID) &&
(p.Published || p.Blog.User.Username == User.Identity.Name)).First();
if (post != null)
{
@ -156,7 +156,7 @@ namespace Teknik.Areas.Blog.Controllers @@ -156,7 +156,7 @@ namespace Teknik.Areas.Blog.Controllers
blogID = user.First().BlogId;
}
}
Post post = db.Posts.Create();
BlogPost post = db.BlogPosts.Create();
post.BlogId = blogID;
post.Title = title;
post.Article = article;
@ -164,7 +164,7 @@ namespace Teknik.Areas.Blog.Controllers @@ -164,7 +164,7 @@ namespace Teknik.Areas.Blog.Controllers
post.DatePosted = DateTime.Now;
post.DatePublished = DateTime.Now;
db.Posts.Add(post);
db.BlogPosts.Add(post);
db.SaveChanges();
return Json(new { result = true });
}
@ -177,7 +177,7 @@ namespace Teknik.Areas.Blog.Controllers @@ -177,7 +177,7 @@ namespace Teknik.Areas.Blog.Controllers
{
if (ModelState.IsValid)
{
Post post = db.Posts.Find(postID);
BlogPost post = db.BlogPosts.Find(postID);
if (post != null)
{
post.Title = title;
@ -196,7 +196,7 @@ namespace Teknik.Areas.Blog.Controllers @@ -196,7 +196,7 @@ namespace Teknik.Areas.Blog.Controllers
{
if (ModelState.IsValid)
{
Post post = db.Posts.Find(postID);
BlogPost post = db.BlogPosts.Find(postID);
if (post != null)
{
post.Published = publish;
@ -216,10 +216,10 @@ namespace Teknik.Areas.Blog.Controllers @@ -216,10 +216,10 @@ namespace Teknik.Areas.Blog.Controllers
{
if (ModelState.IsValid)
{
Post post = db.Posts.Find(postID);
BlogPost post = db.BlogPosts.Find(postID);
if (post != null)
{
db.Posts.Remove(post);
db.BlogPosts.Remove(post);
db.SaveChanges();
return Json(new { result = true });
}
@ -233,11 +233,11 @@ namespace Teknik.Areas.Blog.Controllers @@ -233,11 +233,11 @@ namespace Teknik.Areas.Blog.Controllers
[AllowAnonymous]
public ActionResult GetComments(int postID, int startCommentID, int count)
{
var comments = db.BlogComments.Include("Post").Include("Post.Blog").Include("Post.Blog.User").Where(p => (p.PostId == postID)).OrderByDescending(p => p.DatePosted).Skip(startCommentID).Take(count).ToList();
var comments = db.BlogComments.Include("Post").Include("Post.Blog").Include("Post.Blog.User").Where(p => (p.BlogPostId == postID)).OrderByDescending(p => p.DatePosted).Skip(startCommentID).Take(count).ToList();
List<CommentViewModel> commentViews = new List<CommentViewModel>();
if (comments != null)
{
foreach (Comment comment in comments)
foreach (BlogPostComment comment in comments)
{
commentViews.Add(new CommentViewModel(comment));
}
@ -249,7 +249,7 @@ namespace Teknik.Areas.Blog.Controllers @@ -249,7 +249,7 @@ namespace Teknik.Areas.Blog.Controllers
[AllowAnonymous]
public ActionResult GetCommentArticle(int commentID)
{
Comment comment = db.BlogComments.Include("Post").Include("Post.Blog").Include("Post.Blog.User").Where(p => (p.CommentId == commentID)).First();
BlogPostComment comment = db.BlogComments.Include("Post").Include("Post.Blog").Include("Post.Blog.User").Where(p => (p.BlogPostCommentId == commentID)).First();
if (comment != null)
{
return Json(new { result = comment.Article });
@ -263,8 +263,8 @@ namespace Teknik.Areas.Blog.Controllers @@ -263,8 +263,8 @@ namespace Teknik.Areas.Blog.Controllers
{
if (ModelState.IsValid)
{
Comment comment = db.BlogComments.Create();
comment.PostId = postID;
BlogPostComment comment = db.BlogComments.Create();
comment.BlogPostId = postID;
comment.UserId = db.Users.Where(u => u.Username == User.Identity.Name).First().UserId;
comment.Article = article;
comment.DatePosted = DateTime.Now;
@ -282,7 +282,7 @@ namespace Teknik.Areas.Blog.Controllers @@ -282,7 +282,7 @@ namespace Teknik.Areas.Blog.Controllers
{
if (ModelState.IsValid)
{
Comment comment = db.BlogComments.Find(commentID);
BlogPostComment comment = db.BlogComments.Find(commentID);
if (comment != null)
{
comment.Article = article;
@ -300,7 +300,7 @@ namespace Teknik.Areas.Blog.Controllers @@ -300,7 +300,7 @@ namespace Teknik.Areas.Blog.Controllers
{
if (ModelState.IsValid)
{
Comment comment = db.BlogComments.Find(commentID);
BlogPostComment comment = db.BlogComments.Find(commentID);
if (comment != null)
{
db.BlogComments.Remove(comment);

2
Teknik/Areas/Blog/Models/Blog.cs

@ -16,6 +16,6 @@ namespace Teknik.Areas.Blog.Models @@ -16,6 +16,6 @@ namespace Teknik.Areas.Blog.Models
public User User { get; set; }
public List<Post> Posts { get; set; }
public List<BlogPost> BlogPosts { get; set; }
}
}

6
Teknik/Areas/Blog/Models/Post.cs → Teknik/Areas/Blog/Models/BlogPost.cs

@ -4,9 +4,9 @@ using System.ComponentModel.DataAnnotations; @@ -4,9 +4,9 @@ using System.ComponentModel.DataAnnotations;
namespace Teknik.Areas.Blog.Models
{
public class Post
public class BlogPost
{
public int PostId { get; set; }
public int BlogPostId { get; set; }
public int BlogId { get; set; }
@ -26,6 +26,6 @@ namespace Teknik.Areas.Blog.Models @@ -26,6 +26,6 @@ namespace Teknik.Areas.Blog.Models
public List<string> Tags { get; set; }
public List<Comment> Comments { get; set; }
public List<BlogPostComment> Comments { get; set; }
}
}

8
Teknik/Areas/Blog/Models/Comment.cs → Teknik/Areas/Blog/Models/BlogPostComment.cs

@ -6,13 +6,13 @@ using Teknik.Areas.Profile.Models; @@ -6,13 +6,13 @@ using Teknik.Areas.Profile.Models;
namespace Teknik.Areas.Blog.Models
{
public class Comment
public class BlogPostComment
{
public int CommentId { get; set; }
public int BlogPostCommentId { get; set; }
public int PostId { get; set; }
public int BlogPostId { get; set; }
public Post Post { get; set; }
public BlogPost BlogPost { get; set; }
public int? UserId { get; set; }

10
Teknik/Areas/Blog/ViewModels/CommentViewModel.cs

@ -12,17 +12,17 @@ namespace Teknik.Areas.Blog.ViewModels @@ -12,17 +12,17 @@ namespace Teknik.Areas.Blog.ViewModels
{
public int CommentId { get; set; }
public int PostId { get; set; }
public Post Post { get; set; }
public BlogPost Post { get; set; }
public int? UserId { get; set; }
public User User { get; set; }
public DateTime DatePosted { get; set; }
public string Article { get; set; }
public CommentViewModel(Comment comment)
public CommentViewModel(BlogPostComment comment)
{
CommentId = comment.CommentId;
PostId = comment.PostId;
Post = comment.Post;
CommentId = comment.BlogPostCommentId;
PostId = comment.BlogPostId;
Post = comment.BlogPost;
UserId = comment.UserId;
User = comment.User;
DatePosted = comment.DatePosted;

6
Teknik/Areas/Blog/ViewModels/PostViewModel.cs

@ -30,12 +30,12 @@ namespace Teknik.Areas.Blog.ViewModels @@ -30,12 +30,12 @@ namespace Teknik.Areas.Blog.ViewModels
public List<string> Tags { get; set; }
public List<Comment> Comments { get; set; }
public List<BlogPostComment> Comments { get; set; }
public PostViewModel(Post post)
public PostViewModel(BlogPost post)
{
BlogId = post.BlogId;
PostId = post.PostId;
PostId = post.BlogPostId;
Blog = post.Blog;
System = post.System;
DatePosted = post.DatePosted;

2
Teknik/Areas/Blog/Views/Blog/Post.cshtml

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
<div class="blog-post">
<h2 class="blog-post-title text-center"><a href="@Url.SubRouteUrl("blog", "Blog.Post", new { username = Model.Blog.User.Username, id = Model.PostId })" id="title_@Model.PostId">@Model.Title</a></h2>
<p class="blog-post-meta text-center text-muted">
Posted on <time datetime="@Model.DatePosted.ToString("o")">@Model.DatePublished.ToString("MMMM dd, yyyy")</time> by <a href="@Url.SubRouteUrl("profile", "Profile.Index", new { username = Model.Blog.User.Username })">@Model.Blog.User.Username</a>
Posted on <time datetime="@Model.DatePosted.ToString("o")">@Model.DatePosted.ToString("MMMM dd, yyyy")</time> by <a href="@Url.SubRouteUrl("profile", "Profile.Index", new { username = Model.Blog.User.Username })">@Model.Blog.User.Username</a>
@if (Model.Blog.User.Username == User.Identity.Name || User.IsInRole("Admin"))
{
<br />

10
Teknik/Areas/Home/Controllers/HomeController.cs

@ -21,17 +21,17 @@ namespace Teknik.Areas.Home.Controllers @@ -21,17 +21,17 @@ namespace Teknik.Areas.Home.Controllers
{
HomeViewModel model = new HomeViewModel();
// Grab the latest site blog posts
List<Post> lastSite = new List<Post>();
var foundSite = db.Posts.Include("Blog").Include("Blog.User").OrderBy(post => post.DatePosted).Where(p => p.Published && p.System).Take(10);
List<BlogPost> lastSite = new List<BlogPost>();
var foundSite = db.BlogPosts.Include("Blog").Include("Blog.User").OrderBy(post => post.DatePosted).Where(p => p.Published && p.System).Take(10);
if (foundSite != null)
lastSite = foundSite.ToList();
// Grab the latest user blog posts
List<Post> lastPosts = new List<Post>();
var foundPosts = db.Posts.Include("Blog").Include("Blog.User").OrderBy(post => post.DatePosted).Where(p => p.Published && !p.System).Take(10);
List<BlogPost> lastPosts = new List<BlogPost>();
var foundPosts = db.BlogPosts.Include("Blog").Include("Blog.User").OrderBy(post => post.DatePosted).Where(p => p.Published && !p.System).Take(10);
if (foundPosts != null)
lastPosts = foundPosts.ToList();
// Grab the latest podcasts
List<Post> lastPods = new List<Post>();
List<BlogPost> lastPods = new List<BlogPost>();
model.SitePosts = lastSite;
model.Podcasts = lastPods;

6
Teknik/Areas/Home/ViewModels/HomeViewModel.cs

@ -10,8 +10,8 @@ namespace Teknik.Areas.Home.ViewModels @@ -10,8 +10,8 @@ namespace Teknik.Areas.Home.ViewModels
{
public class HomeViewModel : ViewModelBase
{
public List<Post> SitePosts { get; set; }
public List<Post> Podcasts { get; set; }
public List<Post> BlogPosts { get; set; }
public List<BlogPost> SitePosts { get; set; }
public List<BlogPost> Podcasts { get; set; }
public List<BlogPost> BlogPosts { get; set; }
}
}

80
Teknik/Areas/Podcast/Content/Podcast.css

@ -0,0 +1,80 @@ @@ -0,0 +1,80 @@

/*
* Podcast name and description
*/
.podcast-header {
padding-top: 20px;
padding-bottom: 20px;
}
.podcast-title {
margin-top: 30px;
margin-bottom: 0;
font-size: 60px;
font-weight: normal;
}
.podcast-description {
font-size: 20px;
}
/*
* Main column and sidebar layout
*/
.podcast-main {
font-size: 18px;
line-height: 1.5;
}
/*
* Podcasts
*/
.podcast-post {
margin-bottom: 60px;
}
.podcast-post-sm {
margin-bottom: 5;
}
.podcast-post-title {
margin-bottom: 5px;
font-size: 40px;
}
.podcast-post-title-sm {
margin-bottom: 5px;
font-size: 18px;
line-height: 1;
}
.podcast-post-meta {
margin-bottom: 20px;
}
.podcast-post-meta-sm {
margin-bottom: 5;
font-size: 12px;
line-height: 1;
}
/*
* Comment Styling
*/
.post-comment {
margin-bottom: 20px;
}
.post-comment-title {
margin-bottom: 5px;
font-size: 40px;
}
.post-comment-meta {
margin-bottom: 20px;
}
/*
* Markdown Edits
*/
blockquote {
border-left: 2px dotted #888;
padding-left: 5px;
background: #d0f0ff;
}

276
Teknik/Areas/Podcast/Controllers/PodcastController.cs

@ -0,0 +1,276 @@ @@ -0,0 +1,276 @@
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Teknik.Areas.Podcast.ViewModels;
using Teknik.Controllers;
using Teknik.Models;
namespace Teknik.Areas.Podcast.Controllers
{
public class PodcastController : DefaultController
{
private TeknikEntities db = new TeknikEntities();
// GET: Blogs/Details/5
[AllowAnonymous]
public ActionResult Index()
{
MainViewModel model = new MainViewModel();
try
{
ViewBag.Title = "Teknik Blog - " + Config.Title;
var foundPodcasts = (User.IsInRole("Admin")) ? db.Podcasts.FirstOrDefault() : db.Podcasts.Where(p => (p.Published)).FirstOrDefault();
if (foundPodcasts != null)
{
model = new MainViewModel();
model.Title = Config.PodcastConfig.Title;
model.Description = Config.PodcastConfig.Description;
model.HasPodcasts = (foundPodcasts != null);
}
else
{
model.Error = true;
model.ErrorMessage = "No Podcasts Available";
}
return View("~/Areas/Podcast/Views/Podcast/Main.cshtml", model);
}
catch (Exception ex)
{
model.Error = true;
model.ErrorMessage = ex.Message;
return View("~/Areas/Podcast/Views/Podcast/Main.cshtml", model);
}
}
#region Posts
// GET: Blogs/Details/5
[AllowAnonymous]
public ActionResult View(int episode)
{
PodcastViewModel model = new PodcastViewModel();
// find the podcast specified
var foundPodcast = (User.IsInRole("Admin")) ? db.Podcasts.Where(p => p.Episode == episode).FirstOrDefault() : db.Podcasts.Where(p => (p.Published && p.Episode == episode)).FirstOrDefault();
if (foundPodcast != null)
{
model.PodcastId = foundPodcast.PodcastId;
model.Episode = foundPodcast.Episode;
model.Title = foundPodcast.Title;
model.Description = foundPodcast.Description;
model.Files = foundPodcast.Files;
ViewBag.Title = model.Title + " - Teknikast - " + Config.Title;
return View("~/Areas/Podcast/Views/Podcast/ViewPodcast.cshtml", model);
}
model.Error = true;
model.ErrorMessage = "No Podcasts Available";
return View("~/Areas/Podcast/Views/Podcast/ViewPodcast.cshtml", model);
}
[HttpPost]
[AllowAnonymous]
public ActionResult GetPodcasts(int startPodcastID, int count)
{
var podcasts = (User.IsInRole("Admin")) ? db.Podcasts.OrderByDescending(p => p.DatePosted).Skip(startPodcastID).Take(count).ToList()
: db.Podcasts.Where(p => p.Published).OrderByDescending(p => p.DatePosted).Skip(startPodcastID).Take(count).ToList();
List<PodcastViewModel> podcastViews = new List<PodcastViewModel>();
if (podcasts != null)
{
foreach (Models.Podcast podcast in podcasts)
{
podcastViews.Add(new PodcastViewModel(podcast));
}
}
return PartialView("~/Areas/Podcast/Views/Podcast/Podcasts.cshtml", podcastViews);
}
[HttpPost]
[AllowAnonymous]
public ActionResult GetPodcastTitle(int podcastId)
{
var foundPodcast = (User.IsInRole("Admin")) ? db.Podcasts.Where(p => p.PodcastId == podcastId).FirstOrDefault() : db.Podcasts.Where(p => (p.Published && p.PodcastId == podcastId)).FirstOrDefault();
if (foundPodcast != null)
{
return Json(new { result = foundPodcast.Title });
}
return Json(new { error = "No title found" });
}
[HttpPost]
[AllowAnonymous]
public ActionResult GetPodcastDescription(int podcastId)
{
var foundPodcast = (User.IsInRole("Admin")) ? db.Podcasts.Where(p => p.PodcastId == podcastId).FirstOrDefault() : db.Podcasts.Where(p => (p.Published && p.PodcastId == podcastId)).FirstOrDefault();
if (foundPodcast != null)
{
return Json(new { result = foundPodcast.Description });
}
return Json(new { error = "No article found" });
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult CreatePodcast(string title, string description, HttpPostedFileBase[] files)
{
if (ModelState.IsValid)
{
// Handle saving of files
Models.Podcast podcast = db.Podcasts.Create();
podcast.Title = title;
podcast.Description = description;
podcast.DatePosted = DateTime.Now;
podcast.DatePublished = DateTime.Now;
db.Podcasts.Add(podcast);
db.SaveChanges();
return Json(new { result = true });
}
return Json(new { error = "No podcast created" });
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult EditPodcast(int podcastId, string title, string description)
{
if (ModelState.IsValid)
{
Models.Podcast podcast = db.Podcasts.Find(podcastId);
if (podcast != null)
{
podcast.Title = title;
podcast.Description = description;
db.Entry(podcast).State = EntityState.Modified;
db.SaveChanges();
return Json(new { result = true });
}
}
return Json(new { error = "No podcast found" });
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult PublishPodcast(int podcastId, bool publish)
{
if (ModelState.IsValid)
{
Models.Podcast podcast = db.Podcasts.Find(podcastId);
if (podcast != null)
{
podcast.Published = publish;
if (publish)
podcast.DatePublished = DateTime.Now;
db.Entry(podcast).State = EntityState.Modified;
db.SaveChanges();
return Json(new { result = true });
}
}
return Json(new { error = "No podcast found" });
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult DeletePodcast(int podcastId)
{
if (ModelState.IsValid)
{
Models.Podcast podcast = db.Podcasts.Find(podcastId);
if (podcast != null)
{
db.Podcasts.Remove(podcast);
db.SaveChanges();
return Json(new { result = true });
}
}
return Json(new { error = "No post found" });
}
#endregion
#region Comments
[HttpPost]
[AllowAnonymous]
public ActionResult GetComments(int podcastId, int startCommentID, int count)
{
var comments = db.PodcastComments.Include("Podcast").Where(p => (p.PodcastId == podcastId)).OrderByDescending(p => p.DatePosted).Skip(startCommentID).Take(count).ToList();
List<CommentViewModel> commentViews = new List<CommentViewModel>();
if (comments != null)
{
foreach (Models.PodcastComment comment in comments)
{
commentViews.Add(new CommentViewModel(comment));
}
}
return PartialView("~/Areas/Podcast/Views/Podcast/Comments.cshtml", commentViews);
}
[HttpPost]
[AllowAnonymous]
public ActionResult GetCommentArticle(int commentID)
{
Models.PodcastComment comment = db.PodcastComments.Include("Podcast").Where(p => (p.PodcastCommentId == commentID)).First();
if (comment != null)
{
return Json(new { result = comment.Article });
}
return Json(new { error = "No article found" });
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult CreateComment(int podcastId, string article)
{
if (ModelState.IsValid)
{
Models.PodcastComment comment = db.PodcastComments.Create();
comment.PodcastId = podcastId;
comment.UserId = db.Users.Where(u => u.Username == User.Identity.Name).First().UserId;
comment.Article = article;
comment.DatePosted = DateTime.Now;
db.PodcastComments.Add(comment);
db.SaveChanges();
return Json(new { result = true });
}
return Json(new { error = "No comment created" });
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult EditComment(int commentID, string article)
{
if (ModelState.IsValid)
{
Models.PodcastComment comment = db.PodcastComments.Find(commentID);
if (comment != null)
{
comment.Article = article;
db.Entry(comment).State = EntityState.Modified;
db.SaveChanges();
return Json(new { result = true });
}
}
return Json(new { error = "No comment found" });
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult DeleteComment(int commentID)
{
if (ModelState.IsValid)
{
Models.PodcastComment comment = db.PodcastComments.Find(commentID);
if (comment != null)
{
db.PodcastComments.Remove(comment);
db.SaveChanges();
return Json(new { result = true });
}
}
return Json(new { error = "No comment found" });
}
#endregion
}
}

30
Teknik/Areas/Podcast/Models/Podcast.cs

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Teknik.Areas.Podcast.Models
{
public class Podcast
{
public int PodcastId { get; set; }
public int Episode { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public List<PodcastFile> Files { get; set; }
public List<string> Tags { get; set; }
public bool Published { get; set; }
public DateTime DatePosted { get; set; }
public DateTime DatePublished { get; set; }
public List<PodcastComment> Comments { get; set; }
}
}

25
Teknik/Areas/Podcast/Models/PodcastComment.cs

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Teknik.Areas.Profile.Models;
namespace Teknik.Areas.Podcast.Models
{
public class PodcastComment
{
public int PodcastCommentId { get; set; }
public int PodcastId { get; set; }
public Podcast Podcast { get; set; }
public int UserId { get; set; }
public User User { get; set; }
public DateTime DatePosted { get; set; }
public string Article { get; set; }
}
}

24
Teknik/Areas/Podcast/Models/PodcastFile.cs

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Teknik.Areas.Podcast.Models
{
public class PodcastFile
{
public int PodcastFileId { get; set; }
public int PodcastId { get; set; }
public Podcast Podcast { get; set; }
public string FileName { get; set; }
public string Path { get; set; }
public string ContentType { get; set; }
public int Size { get; set; }
}
}

58
Teknik/Areas/Podcast/PodcastAreaRegistration.cs

@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Optimization;
namespace Teknik.Areas.Podcast
{
public class PodcastAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Podcast";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapSubdomainRoute(
"Podcast.Index", // Route name
new List<string>() { "dev", "podcast" }, // Subdomains
"", // URL with parameters
new { controller = "Podcast", action = "Index" }, // Parameter defaults
new[] { typeof(Controllers.PodcastController).Namespace }
);
context.MapSubdomainRoute(
"Podcast.View", // Route name
new List<string>() { "dev", "podcast" }, // Subdomains
"{episode}", // URL with parameters
new { controller = "Podcast", action = "View" }, // Parameter defaults
new[] { typeof(Controllers.PodcastController).Namespace }
);
context.MapSubdomainRoute(
"Podcast.Action", // Route name
new List<string>() { "dev", "podcast" }, // Subdomains
"Action/{controller}/{action}", // URL with parameters
new { controller = "Podcast", action = "Index" }, // Parameter defaults
new[] { typeof(Controllers.PodcastController).Namespace }
);
// Register Script Bundles
BundleTable.Bundles.Add(new ScriptBundle("~/bundles/podcast").Include(
"~/Scripts/bootbox/bootbox.min.js",
"~/Scripts/PageDown/Markdown.Converter.js",
"~/Scripts/PageDown/Markdown.Sanitizer.js",
"~/Scripts/bootstrap-markdown.js",
"~/Scripts/jquery-ui.widgets.js",
"~/Scripts/jquery.iframe-transport.js",
"~/Scripts/audioplayer.min.js",
"~/Areas/Podcast/Scripts/Podcast.js"));
// Register Style Bundles
BundleTable.Bundles.Add(new StyleBundle("~/Content/podcast").Include(
"~/Content/audioplayer.css",
"~/Content/bootstrap-markdown.min.css",
"~/Areas/Podcast/Content/Podcast.css"));
}
}
}

280
Teknik/Areas/Podcast/Scripts/Podcast.js

@ -0,0 +1,280 @@ @@ -0,0 +1,280 @@
$(document).ready(function () {
$("#podcast_submit").click(function () {
$('#newPodcast').modal('hide');
title = $("#podcast_title").val();
post = $("#podcast_description").val();
files = $("#podcast_files").val();
$.ajax({
type: "POST",
url: addPodcastURL,
data: AddAntiForgeryToken({ title: title, description: post, files: files }),
success: function (html) {
if (html.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
}
}
});
return false;
});
$('#editPodcast').on('show.bs.modal', function (e) {
$("#edit_podcast_title").val("");
$("#edit_podcast_description").val("");
podcastId = $(e.relatedTarget).attr("id");
$("#edit_podcast_podcastid").val(podcastId);
$.ajax({
type: "POST",
url: getPodcastTitleURL,
data: { podcastID: podcastId },
success: function (html) {
if (html.result) {
$("#edit_podcast_title").val(html.result);
}
}
});
$.ajax({
type: "POST",
url: getPodcastDescriptionURL,
data: { podcastID: podcastId },
success: function (html) {
if (html.result) {
$("#edit_podcast_description").val(html.result);
}
}
});
});
$("#edit_submit").click(function () {
$('#editPodcast').modal('hide');
podcastId = $("#edit_podcast_podcastId").val();
title = $("#edit_podcast_title").val();
description = $("#edit_podcast_description").val();
$.ajax({
type: "POST",
url: editPodcastURL,
data: AddAntiForgeryToken({ podcastId: podcastId, title: title, description: description }),
success: function (html) {
if (html.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
}
}
});
return false;
});
$("#comment_submit").click(function () {
$('#newComment').modal('hide');
podcastId = $("#podcastId").val();
post = $("#comment_post").val();
$.ajax({
type: "POST",
url: addCommentURL,
data: AddAntiForgeryToken({ podcastId: postID, article: post }),
success: function (html) {
if (html.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
}
}
});
return false;
});
$('#editComment').on('show.bs.modal', function (e) {
$("#edit_comment_post").val("");
commentID = encodeURIComponent($(e.relatedTarget).attr("id"));
$("#edit_comment_id").val(commentID);
$.ajax({
type: "POST",
url: getCommentArticleURL,
data: { commentID: commentID },
success: function (html) {
if (html.result) {
$("#edit_comment_post").val(html.result);
}
}
});
});
$("#edit_comment_submit").click(function () {
$('#editComment').modal('hide');
postID = encodeURIComponent($("#edit_comment_id").val());
post = encodeURIComponent($("#edit_comment_post").val());
$.ajax({
type: "POST",
url: editCommentURL,
data: AddAntiForgeryToken({ commentID: postID, article: post }),
success: function (html) {
if (html.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
}
}
});
return false;
});
});
function loadMorePodcasts(start, count) {
podcastId = $(".podcast-main").attr("id");
$.ajax({
type: "POST",
url: getPodcastsURL,
data: { podcastId: podcastId, count: count, startPodcastID: start },
success: function (html) {
if (html) {
$(".podcast-main").append(html);
linkPostDelete('.delete_podcast');
linkPostPublish('.publish_podcast');
linkPostUnpublish('.unpublish_podcast');
linkAudioPlayer('audio');
$(window).bind('scroll', bindScrollPosts);
}
}
});
}
function loadMoreComments(start, count) {
post_id = $(".podcast-comments").attr("id");
$.ajax({
type: "POST",
url: getCommentsURL,
data: { postID: post_id, count: count, startCommentID: start },
success: function (html) {
if (html) {
$(".podcast-comments").append(html);
linkCommentDelete('.delete_comment');
$(window).bind('scroll', bindScrollComments);
}
}
});
}
function bindScrollPosts() {
if ($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
$(window).unbind('scroll');
loadMorePodcasts(startPodcast, podcasts);
startPodcast = startPodcast + podcasts;
}
}
function bindScrollComments() {
if ($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
$(window).unbind('scroll');
loadMoreComments(startComment, comments);
startComment = startComment + comments;
}
}
function linkPodcastUnpublish(selector) {
$(selector).click(function () {
var object = $(this);
podcastId = object.attr("id");
$.ajax({
type: "POST",
url: publishPodcastURL,
data: AddAntiForgeryToken({ podcastId: podcastId, publish: false }),
success: function (html) {
if (html.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
}
}
});
});
}
function linkPodcastPublish(selector) {
$(selector).click(function () {
var object = $(this);
podcastId = object.attr("id");
$.ajax({
type: "POST",
url: publishPodcastURL,
data: AddAntiForgeryToken({ podcastId: podcastId, publish: true }),
success: function (html) {
if (html.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
}
}
});
});
}
function linkPodcastDelete(selector) {
$(selector).click(function () {
var object = $(this);
podcastId = object.attr("id");
bootbox.confirm("Are you sure you want to delete the podcast?", function (result) {
if (result) {
$.ajax({
type: "POST",
url: deletePodcastURL,
data: AddAntiForgeryToken({ podcastId: podcastId }),
success: function (html) {
if (html.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
}
}
});
}
});
});
}
function linkCommentDelete(selector) {
$(selector).click(function () {
var object = $(this);
post_id = object.attr("id");
bootbox.confirm("Are you sure you want to delete your comment?", function (result) {
if (result) {
$.ajax({
type: "POST",
url: deleteCommentURL,
data: AddAntiForgeryToken({ commentID: post_id }),
success: function (html) {
if (html.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
}
}
});
}
});
});
}
function linkAudioPlayer(selector) {
$(selector).audioPlayer(
{
classPrefix: 'audioplayer'
});
}

29
Teknik/Areas/Podcast/ViewModels/CommentViewModel.cs

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Teknik.Areas.Profile.Models;
using Teknik.ViewModels;
namespace Teknik.Areas.Podcast.ViewModels
{
public class CommentViewModel : ViewModelBase
{
public int CommentId { get; set; }
public int PodcastId { get; set; }
public Models.Podcast Podcast { get; set; }
public User User { get; set; }
public DateTime DatePosted { get; set; }
public string Article { get; set; }
public CommentViewModel(Models.PodcastComment comment)
{
CommentId = comment.PodcastCommentId;
PodcastId = comment.PodcastId;
Podcast = comment.Podcast;
User = comment.User;
DatePosted = comment.DatePosted;
Article = comment.Article;
}
}
}

17
Teknik/Areas/Podcast/ViewModels/MainViewModel.cs

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Teknik.ViewModels;
namespace Teknik.Areas.Podcast.ViewModels
{
public class MainViewModel : ViewModelBase
{
public string Title { get; set; }
public string Description { get; set; }
public bool HasPodcasts { get; set; }
}
}

45
Teknik/Areas/Podcast/ViewModels/PodcastViewModel.cs

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Teknik.Areas.Podcast.Models;
using Teknik.ViewModels;
namespace Teknik.Areas.Podcast.ViewModels
{
public class PodcastViewModel : ViewModelBase
{
public int PodcastId { get; set; }
public int Episode { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public List<PodcastFile> Files { get; set; }
public List<string> Tags { get; set; }
public DateTime DatePosted { get; set; }
public bool Published { get; set; }
public DateTime DatePublished { get; set; }
public PodcastViewModel() { }
public PodcastViewModel(Models.Podcast podcast)
{
PodcastId = podcast.PodcastId;
Episode = podcast.Episode;
Title = podcast.Title;
Description = podcast.Description;
Files = podcast.Files;
Tags = podcast.Tags;
DatePosted = podcast.DatePosted;
Published = podcast.Published;
DatePublished = podcast.DatePublished;
}
}
}

30
Teknik/Areas/Podcast/Views/Podcast/Comment.cshtml

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
@model Teknik.Areas.Blog.ViewModels.CommentViewModel
<script>
var converter = new Markdown.getSanitizingConverter();
// Title Conversion
var old_post = $("#title_@Model.CommentId").text();
var new_post = converter.makeHtml(old_post);
$("#title_@Model.CommentId").html(new_post);
// Post Conversion
var old_post = $("#comment_@Model.CommentId").text();
var new_post = converter.makeHtml(old_post);
$("#comment_@Model.CommentId").html(new_post);
</script>
<hr>
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
<div class="post-comment">
<p class="post-comment-meta text-muted">
<a href="@Url.SubRouteUrl("profile", "Profile.Index", new { username = Model.User.Username })">@Model.User.Username</a> replied at <time datetime="@Model.DatePosted.ToString("o")">@Model.DatePosted.ToString("HH:mm:ss tt") on @Model.DatePosted.ToString("MMMM dd, yyyy")</time>
@if (Model.User.Username == User.Identity.Name || User.IsInRole("Admin"))
{
<br />
<button type="button" class="btn btn-info edit_comment" id="@Model.CommentId" data-toggle="modal" data-target="#editComment">Edit</button>
<button type="button" class="btn btn-danger delete_comment" id="@Model.CommentId">Delete</button>
}
</p>
<p id="comment_@Model.CommentId">@Model.Article</p>
</div>
</div>
</div>

6
Teknik/Areas/Podcast/Views/Podcast/Comments.cshtml

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
@model List<Teknik.Areas.Podcast.ViewModels.CommentViewModel>
@foreach (var comment in Model)
{
@Html.Partial("Comment", comment)
}

138
Teknik/Areas/Podcast/Views/Podcast/Main.cshtml

@ -0,0 +1,138 @@ @@ -0,0 +1,138 @@
@model Teknik.Areas.Podcast.ViewModels.MainViewModel
<script>
// We need to define the action URLs for the script
var uploadURL = '@Url.SubRouteUrl("upload", "Upload.Upload")';
var getPodcastsURL = '@Url.SubRouteUrl("podcast", "Podcast.Action", new { action = "GetPodcasts" })';
var getPodcastTitleURL = '@Url.SubRouteUrl("podcast", "Podcast.Action", new { action = "GetPodcastTitle" })';
var getPodcastArticleURL = '@Url.SubRouteUrl("podcast", "Podcast.Action", new { action = "GetPodcastArticle" })';
var publishPodcastURL = '@Url.SubRouteUrl("podcast", "Podcast.Action", new { action = "PublishPodcast" })';
var addPodcastURL = '@Url.SubRouteUrl("podcast", "Podcast.Action", new { action = "CreatePodcast" })';
var editPodcastURL = '@Url.SubRouteUrl("podcast", "Podcast.Action", new { action = "EditPodcast" })';
var deletePodcastURL = '@Url.SubRouteUrl("podcast", "Podcast.Action", new { action = "DeletePodcast" })';
var getCommentsURL = '@Url.SubRouteUrl("podcast", "Podcast.Action", new { action = "GetComments" })';
var getCommentArticleURL = '@Url.SubRouteUrl("podcast", "Podcast.Action", new { action = "GetCommentArticle" })';
var addCommentURL = '@Url.SubRouteUrl("podcast", "Podcast.Action", new { action = "CreateComment" })';
var editCommentURL = '@Url.SubRouteUrl("podcast", "Podcast.Action", new { action = "EditComment" })';
var deleteCommentURL = '@Url.SubRouteUrl("podcast", "Podcast.Action", new { action = "DeleteComment" })';
</script>
@Styles.Render("~/Content/podcast")
@Scripts.Render("~/bundles/podcast")
<div class="container">
<div class="row">
<div class="col-sm-12 podcast-heading">
<h1 class="podcast-title text-center">@Model.Title</h1>
<p class="lead podcast-description text-center text-muted">@Model.Description</p>
</div>
</div>
<div class="row">
<div class="col-sm-12 text-center">
<p>
<a href="@Url.SubRouteUrl("rss", "RSS.Podcast")"><i class="fa fa-rss fa-2x fa-border"></i></a>
</p>
</div>
</div>
@if (User.IsInRole("Admin") || User.IsInRole("Podcast"))
{
<div class="row">
<div class="col-sm-12 text-center">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#newPodcast">Create Podcast</button>
</div>
</div>
<div class="modal fade" id="newPodcast" tabindex="-1" role="dialog" aria-labelledby="newPodcastLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<form class="form" action="##" method="post" id="publishPodcast">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Cancel</span></button>
<h4 class="modal-title" id="newPodcastLabel">Create a New Podcast</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="form-group col-sm-12">
<label for="podcast_title"><h4>Title</h4></label>
<input class="form-control" name="podcast_title" id="podcast_title" placeholder="Awesome Podcast Title" title="enter a title for the podcast." type="text" />
</div>
</div>
<div class="row">
<div class="form-group col-sm-12">
<label for="podcast_description"><h4>Podcast Description</h4></label>
<textarea class="form-control wmd-input" name="podcast_description" id="podcast_description" placeholder="We talked about awesome stuff." title="enter what the podcast was about." data-provide="markdown" rows="10"></textarea>
</div>
</div>
<div class="row">
<div class="form-group col-sm-12">
<label for="files"><h4>Upload Podcast</h4></label>
<input id="files" name="files" type="file" placeholder="podcast.ogg" title="select the podcast file." multiple="multiple" />
</div>
</div>
<div class="row">
<div class="form-group col-sm-12" id="uploadedPodcasts"></div>
<input name="podcast_file" id="podcast_file" type="hidden" />
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="podcast_submit">Create</button>
</div>
</form>
</div>
</div>
</div>
<div class="modal fade" id="editPodcast" tabindex="-1" role="dialog" aria-labelledby="editPodcastLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<form class="form" action="##" method="post" id="editPodcastForm">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Cancel</span></button>
<h4 class="modal-title" id="editPodcastLabel">Edit The Podcast</h4>
</div>
<div class="modal-body">
<input name="edit_podcast_podcastId" id="edit_podcast_podcastId" type="hidden" />
<div class="row">
<div class="form-group col-sm-12">
<label for="edit_podcast_title"><h4>Title</h4></label>
<input class="form-control" name="edit_podcast_title" id="edit_podcast_title" placeholder="Awesome Podcast Title" title="enter a title for the podcast." type="text" />
</div>
</div>
<div class="row">
<div class="form-group col-sm-12">
<label for="edit_podcast_description"><h4>Podcast Description</h4></label>
<textarea class="form-control wmd-input" name="edit_podcast_description" id="edit_podcast_description" placeholder="We talked about awesome stuff." title="enter what the podcast was about." data-provide="markdown" rows="10"></textarea>
</div>
</div>