Skip to content

Commit

Permalink
2sxc 14 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
getBlup committed Jul 1, 2022
1 parent 2353cba commit 6f35912
Show file tree
Hide file tree
Showing 19 changed files with 2,760 additions and 1,435 deletions.
6 changes: 3 additions & 3 deletions .data/app.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<SexyContent FileVersion="07.00.00" MinimumRequiredVersion="07.04.02" ModuleVersion="13.10.02" ExportDate="2022-05-10T14:08:24.9719566+02:00">
<SexyContent FileVersion="07.00.00" MinimumRequiredVersion="07.04.02" ModuleVersion="14.07.00" ExportDate="2022-06-30T12:51:11.7263766+02:00">
<Header>
<App Guid="8258619d-a5d7-4f9a-9ef5-af9caac8dbaa" />
<Language Default="en-us" />
Expand Down Expand Up @@ -1255,13 +1255,13 @@
<Value Key="RequiredOqtaneVersion" Value="03.01.00" Type="String">
<Dimension DimensionID="146" ReadOnly="false" />
</Value>
<Value Key="RequiredVersion" Value="13.10.00" Type="String">
<Value Key="RequiredVersion" Value="14.07.00" Type="String">
<Dimension DimensionID="146" ReadOnly="false" />
</Value>
<Value Key="SupportsAjaxReload" Value="True" Type="Boolean">
<Dimension DimensionID="146" ReadOnly="false" />
</Value>
<Value Key="Version" Value="02.02.00" Type="String">
<Value Key="Version" Value="02.03.00" Type="String">
<Dimension DimensionID="146" ReadOnly="false" />
</Value>
</Entity>
Expand Down
Binary file added .temp_cache/default-production/0.pack.gz
Binary file not shown.
Binary file added .temp_cache/default-production/index.pack.gz
Binary file not shown.
Binary file added .temp_cache/default-production/index.pack.gz.old
Binary file not shown.
18 changes: 8 additions & 10 deletions api/PodCastController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
using System.IO;
using System;
using ToSic.Razor.Blade;
using ToSic.Sxc.Services;

var scrubSvc = GetService<IScrub>();

[AllowAnonymous] // define that all commands can be accessed without a login
public class PodCastController : Custom.Hybrid.Api12
public class PodCastController : Custom.Hybrid.Api14
{
// Atom XML Namespace for RSS
public const string AtomNsCode = "atom";
Expand Down Expand Up @@ -83,8 +81,8 @@ public dynamic Rss()
AddTag(channel, "generator", "2sxc PodCast App");
AddTag(channel, "title", Content.Title);
AddTag(channel, "link", Link.To(pageId: detailsPageId, type: "full") ?? linkErrMessage);
AddTag(channel, "description", scrubSvc.All(Content.Description));
AddTag(channel, "language", scrubSvc.All(Content.Language));
AddTag(channel, "description", Kit.Scrub.All(Content.Description));
AddTag(channel, "language", Kit.Scrub.All(Content.Language));
AddTag(channel, "copyright", copyrightNotice);
AddTag(channel, "managingEditor", Content.Owner.Email + " (" + Content.Owner.FullName + ")");
var image = AddTag(channel, "image");
Expand Down Expand Up @@ -132,7 +130,7 @@ private void AddChannelItunes(XmlElement channel) {
var episodes = AsList(Content.Parents("Episode") as object).OrderByDescending(e => e.Date);
var imageUrl = Link.Image(Content.Image, type: "full");

AddNamespaceTag(channel, ItunesNsCode, "summary", ItunesNamespace, scrubSvc.All(Content.Description));
AddNamespaceTag(channel, ItunesNsCode, "summary", ItunesNamespace, Kit.Scrub.All(Content.Description));
AddNamespaceTag(channel, ItunesNsCode, "author", ItunesNamespace, Content.Owner.FullName);
AddNamespaceTag(channel, ItunesNsCode, "explicit", ItunesNamespace, episodes.Any(e => e.Explicit == true) ? "yes" : "no");
var itunesImage = AddNamespaceTag(channel, ItunesNsCode, "image", ItunesNamespace);
Expand Down Expand Up @@ -170,7 +168,7 @@ private void AddEpisode(string websiteRoot, XmlElement channel, dynamic episode)

var itemNode = AddTag(channel, "item");
AddTag(itemNode, "title", episode.Title);
AddTag(itemNode, "description", scrubSvc.All(episode.Description));
AddTag(itemNode, "description", Kit.Scrub.All(episode.Description));

var itemGuid = AddTag(itemNode, "guid", episode.EntityGuid.ToString());
AddAttribute(itemGuid, "isPermaLink", "false");
Expand All @@ -190,9 +188,9 @@ private void AddEpisode(string websiteRoot, XmlElement channel, dynamic episode)

// Adds required <itunes:xy> tags to itemNode
private void AddItemItunes(XmlElement itemNode, dynamic episode, string authorFullName) {
var duration = TimeSpan.FromMinutes(Convert.ToFloat(episode.Duration ?? 0)).ToString("hh\\:mm") + ":00";
AddNamespaceTag(itemNode, ItunesNsCode, "subtitle", ItunesNamespace, Text.Crop(scrubSvc.All(episode.Description), 255));
AddNamespaceTag(itemNode, ItunesNsCode, "summary", ItunesNamespace, scrubSvc.All(episode.Description));
var duration = TimeSpan.FromMinutes(Kit.Convert.ToFloat(episode.Duration ?? 0)).ToString("hh\\:mm") + ":00";
AddNamespaceTag(itemNode, ItunesNsCode, "subtitle", ItunesNamespace, Text.Crop(Kit.Scrub.All(episode.Description), 255));
AddNamespaceTag(itemNode, ItunesNsCode, "summary", ItunesNamespace, Kit.Scrub.All(episode.Description));
AddNamespaceTag(itemNode, ItunesNsCode, "author", ItunesNamespace, authorFullName);
AddNamespaceTag(itemNode, ItunesNsCode, "duration", ItunesNamespace, duration);
AddNamespaceTag(itemNode, ItunesNsCode, "explicit", ItunesNamespace, episode.Explicit ? "yes" : "no");
Expand Down
13 changes: 4 additions & 9 deletions bs4/_Channel.PartAssets.cshtml
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
@inherits Custom.Hybrid.Razor12
@using ToSic.Sxc.Services;
@inherits Custom.Hybrid.Razor14
@{
// 1. Get Services for Css and Page
var pageCss = GetService<Connect.Koi.ICss>(); // Service to get CSS information about the current Theme
var pageSvc = GetService<IPageService>(); // Service to set titles etc. on the pageSvc
// 2. Include Bootstrap4 if the framework isn't known
if (pageCss.IsUnknown) {
pageSvc.Activate("Bootstrap4");
if (Kit.Css.IsUnknown) {
Kit.Page.Activate("Bootstrap4");
}
}
<link rel="stylesheet" href="@App.Path/bs4/dist/styles.min.css" @pageSvc.AssetAttributes()>
<link rel="stylesheet" href="@App.Path/bs4/dist/styles.min.css" @Kit.Page.AssetAttributes()>
5 changes: 3 additions & 2 deletions bs4/_Channel.PartEpisode.cshtml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
@inherits Custom.Hybrid.Razor12
@inherits Custom.Hybrid.Razor14
@using ToSic.Razor.Blade;
@{
var episode = DynamicModel.Episode;
var toolbar = Content.IsDemoItem ? "" : Edit.TagToolbar(episode, toolbar: new [] { "-layout", "%delete&show=true"});
var episodeToolbar = Kit.Toolbar.Default().Layout("-").Delete();
var toolbar = Content.IsDemoItem ? "" : episodeToolbar.For(episode);
}
@* Episode information *@
<li class="app-podcast2 list-group-item border-right-0 border-left-0 p-0 pb-3 pt-3" @toolbar>
Expand Down
39 changes: 20 additions & 19 deletions bs4/_Channel.cshtml
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
@inherits Custom.Hybrid.Razor12
@inherits Custom.Hybrid.Razor14
@using ToSic.Razor.Blade;
@using ToSic.Sxc.Services;
@{
var channel = Content; // give it a nicer name so the code is easier to read
// Get all the Episode items which point to this channel
var episodes = AsList(Content.Parents("Episode") as object);
// Image Service used to generate optimal images
var imgSvc = GetService<IImageService>();

var imgSettings = AsDynamic(Settings.Images.Podcast, "Content");

var channelToolbar = Kit.Toolbar.Default().Settings(hover:"left", autoAddMore:"start");

var episodeToolbar = Kit.Toolbar.Empty()
.Settings(hover: "left")
.New("Episode", prefill:"Date=" + @DateTime.Now.ToString("yyyy-MM-dd")
+ "&prefill:Channels=" + channel.EntityGuid.ToString()
+ "&prefill:Author=" + channel.Owner.EntityGuid.ToString());

var channelIsDemoItem = channel.IsDemoItem;
}

<div class="app-podcast2 container mb-4" @Edit.TagToolbar(channel, toolbar: new [] { "settings&hover=left&autoAddMore=start" })>
<div class="app-podcast2 container mb-4" @channelToolbar.For(channel)>
<div class="row">
@* Left column with image, episode counter and channel description *@
<div class="col-12 col-md-4">
<div class="card border-0">
@imgSvc.Picture(channel.Field("Image"), settings: imgSettings, width: "1000", imgClass:"w-100 rounded-sm")
@Kit.Image.Picture(channel.Field("Image"), settings: imgSettings, width: "1000", imgClass:"w-100 rounded-sm")
<div class="card-body p-0">
<p class="card-text">
<p class="text-muted">@episodes.Count() @Resources.Episodes</p>
Expand Down Expand Up @@ -56,19 +63,13 @@
</div>

@* Listing of episodes *@
@if(!channel.IsDemoItem) {
@Edit.Toolbar(toolbar: new [] {
"toolbar=empty",
"new?contentType=Episode&prefill:Date=" + @DateTime.Now.ToString("yyyy-MM-dd")
+ "&prefill:Channels=" + channel.EntityGuid.ToString()
+ "&prefill:Author=" + channel.Owner.EntityGuid.ToString()
})
}
<ul class="list-group">
@foreach(var episode in episodes.OrderByDescending(e => e.Date)) {
@Html.Partial("./_Channel.PartEpisode.cshtml", new { Episode = episode })
}
</ul>
<div @(channelIsDemoItem ? "" : episodeToolbar)></div>
<ul class="list-group">
@foreach(var episode in episodes.OrderByDescending(e => e.Date)) {
@Html.Partial("./_Channel.PartEpisode.cshtml", new { Episode = episode })
}
</ul>
</div>
</div>
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions bs4/dist/styles.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bs4/dist/styles.min.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 4 additions & 9 deletions bs5/_Channel.PartAssets.cshtml
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
@inherits Custom.Hybrid.Razor12
@using ToSic.Sxc.Services;
@inherits Custom.Hybrid.Razor14
@{
// 1. Get Services for Css and Page
var pageCss = GetService<Connect.Koi.ICss>(); // Service to get CSS information about the current Theme
var pageSvc = GetService<IPageService>(); // Service to set titles etc. on the pageSvc
// 2. Include Bootstrap4 if the framework isn't known
if (pageCss.IsUnknown) {
pageSvc.Activate("Bootstrap4");
if (Kit.Css.IsUnknown) {
Kit.Page.Activate("Bootstrap4");
}
}
<link rel="stylesheet" href="@App.Path/bs5/dist/styles.min.css" @pageSvc.AssetAttributes()>
<link rel="stylesheet" href="@App.Path/bs5/dist/styles.min.css" @Kit.Page.AssetAttributes()>
5 changes: 3 additions & 2 deletions bs5/_Channel.PartEpisode.cshtml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
@inherits Custom.Hybrid.Razor12
@inherits Custom.Hybrid.Razor14
@using ToSic.Razor.Blade;
@{
var episode = DynamicModel.Episode;
var toolbar = Content.IsDemoItem ? "" : Edit.TagToolbar(episode, toolbar: new [] { "-layout", "%delete&show=true"});
var episodeToolbar = Kit.Toolbar.Default().Layout("-").Delete();
var toolbar = Content.IsDemoItem ? "" : episodeToolbar.For(episode);
}
@* Episode information *@
<li class="app-podcast2 list-group-item border-end-0 border-start-0 p-0 pb-3 pt-3" @toolbar>
Expand Down
39 changes: 20 additions & 19 deletions bs5/_Channel.cshtml
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
@inherits Custom.Hybrid.Razor12
@inherits Custom.Hybrid.Razor14
@using ToSic.Razor.Blade;
@using ToSic.Sxc.Services;
@{
var channel = Content; // give it a nicer name so the code is easier to read
// Get all the Episode items which point to this channel
var episodes = AsList(Content.Parents("Episode") as object);
// Image Service used to generate optimal images
var imgSvc = GetService<IImageService>();

var imgSettings = AsDynamic(Settings.Images.Podcast, "Content");

var channelToolbar = Kit.Toolbar.Default().Settings(hover:"left", autoAddMore:"start");

var episodeToolbar = Kit.Toolbar.Empty()
.Settings(hover: "left")
.New("Episode", prefill:"Date=" + @DateTime.Now.ToString("yyyy-MM-dd")
+ "&prefill:Channels=" + channel.EntityGuid.ToString()
+ "&prefill:Author=" + channel.Owner.EntityGuid.ToString());

var channelIsDemoItem = channel.IsDemoItem;
}

<div class="app-podcast2 container mb-4" @Edit.TagToolbar(channel, toolbar: new [] { "settings&hover=left&autoAddMore=start" })>
<div class="app-podcast2 container mb-4" @channelToolbar.For(channel)>
<div class="row">
@* Left column with image, episode counter and channel description *@
<div class="col-12 col-md-4">
<div class="card border-0">
@imgSvc.Picture(channel.Field("Image"), settings: imgSettings, width: "1000", imgClass:"w-100 rounded-sm")
@Kit.Image.Picture(channel.Field("Image"), settings: imgSettings, width: "1000", imgClass:"w-100 rounded-sm")
<div class="card-body p-0">
<p class="card-text">
<p class="text-muted">@episodes.Count() @Resources.Episodes</p>
Expand Down Expand Up @@ -56,19 +63,13 @@
</div>

@* Listing of episodes *@
@if(!channel.IsDemoItem) {
@Edit.Toolbar(toolbar: new [] {
"toolbar=empty",
"new?contentType=Episode&prefill:Date=" + @DateTime.Now.ToString("yyyy-MM-dd")
+ "&prefill:Channels=" + channel.EntityGuid.ToString()
+ "&prefill:Author=" + channel.Owner.EntityGuid.ToString()
})
}
<ul class="list-group">
@foreach(var episode in episodes.OrderByDescending(e => e.Date)) {
@Html.Partial("./_Channel.PartEpisode.cshtml", new { Episode = episode })
}
</ul>
<div @(channelIsDemoItem ? "" : episodeToolbar)>
<ul class="list-group">
@foreach(var episode in episodes.OrderByDescending(e => e.Date)) {
@Html.Partial("./_Channel.PartEpisode.cshtml", new { Episode = episode })
}
</ul>
</div>
</div>
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions bs5/dist/styles.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6f35912

Please sign in to comment.