Our blog contains the activity stream of Orchard Dojo: general news, new resources or tutorials are announced here.

Add Recipe Roles permission behavior, how to add media management to an ASP.NET Core app? - This week in Orchard (24/01/2025)

This week's topics are migrating the OpenID module to OpenIddict 6, adding Recipe Roles permission behavior, and we will mention our latest Orchard Nuggets post, where you can learn how to add media management to an ASP.NET Core app. Without further ado, let's dive in!

Featured tags

IIS
API
SMS
SEO
All tags >

Add a feature to allow the user to manage tenants, integrating UI testing into Orchard Core - This week in Orchard (18/11/2022)

Let's continue checking out the newest features and editions of the 1.5.0 release of Orchard Core and see a demo about integrating UI testing into Orchard Core! Oh, and did you know that Orchard Core was presented at this year's .NET Conf too? Orchard Core updates Add a feature to allow the user to manage tenants Let's say you have an Orchard Core site set up with the Software as a Service recipe. This recipe allows you to easily create multiple tenants by enabling the necessary features. Here you can see that we have already created two additional tenants called Agency and Blog. We still need to set up the Agency one, but the Blog tenant is ready to go. And here you may notice a new button near the Blog tenant, called Features. By clicking on this button, you will be redirected to a page that allows you to manage the feature of the tenant called Blog. So, if you have a SaaS environment now, you can manage the tenant's features from the host by allowing to accept {tenant?} in the route. This tenant value is only evaluated if the request is running on the host. When a tenant value is present, we'll execute the code in the scope of the given tenant. SqlParser & SqlGrammar subquery support The issue was that the SQL parser did not allow subqueries in the FROM clause. Try to run the following SQL Query, which can be done via Search -> Queries -> Run SQL Query on the admin page of Orchard Core. SELECT Id FROM ( SELECT Id FROM Document) AS Temp The query should run, but instead of that, you encountered an error: Syntax error, expected: id_simple at line:0, col:15. And this has been fixed in Orchard Core 1.5. So, if you run the query with the latest release, you will see that the query was executed successfully. Update YesSql to 3.2.0 A new version of YesSql comes with the latest release of Orchard Core. YesSql now has version number 3.2.0, which provides several improvements and fixes since the latest version shipped with Orchard Core 1.4. Don't forget to take a look at the changes! Demos Integrating UI testing into Orchard Core We would like to show some updates related to integrating UI testing into Orchard Core. This was not the first time, we already talked about this a while ago in this post. And now it's taking shape, so we would like to have some feedback and finish it up together! In this demo, we will talk about this pull request which introduces UI testing to Orchard Core in .NET with Selenium with our library called UI Testing Toolbox. There's already UI testing in Orchard Core with Cypress, this is a bit different, these are not written in JavaScript but in .NET. They use other underlying libraries for browser automation and what will be tested here is a little bit different as well. We implemented everything that was in Cypress before, and there's a lot more now. If you are interested in the progress, you can find it in the PR as well. Now let's see the current progress of the integration! There's a new folder in the Orchard Core solution called OrchardCore.Tests.UI and also an OrchardCore.Tests.UI.Mvc. The Mvc one is just testing an MVC launch, there is no CMS functionality or anything like that and the Tests.UI tests the whole of the Orchard Core feature set. The main goal was to have some decent coverage. So, we are not waiting for an hour to wait for all the UI tests to finish but still, we can be fairly confident that if these pass, then we haven't messed up anything too badly. For example, we have tests for all the built-in recipes (AgencyRecipeTests.cs, BlogRecipeTests.cs, HeadlessRecipeTests.cs, etc.). The most complete one is under the BlogRecipeTests, which runs the whole setup and checks out the basic features of Orchard Core, like login, logout, registration, basic content operations, turning features on and off, etc. If you are interested in how to run these tests or what these tests actually do in action, check out this recording on YouTube! News from the community Orchard Core at .NET Conf 2022 .NET Conf is the biggest .NET virtual event and this year we were celebrating the release of .NET 7. And there was a talk called Build websites with a modern ASP.NET Core CMS – Orchard Core by Zoltán Lehóczky from Lombiq Technologies. In this session, we'll do a quick dive into working with the modern ASP.NET Core framework and web content management system (CMS) Orchard Core. We'll see what Orchard can provide you, how it goes beyond simple content management, and why you'd want to join such a cutting-edge open-source community. You can check out the recording of this session on YouTube! Orchard Harvest 2023 For those who are too young to remember, we had Orchard conferences, called Orchard Harvest. And the conference website was available under orchardharvest.org, but unfortunately, it's not anymore. The last one was in 2017 in New York. So, having another get-together is very much overdue. If you would like to see or get a feeling of how this looked like before, we have a couple of mood videos on the Orchard YouTube channel, like this one from the first conference. The point is that we should really think about organizing the next one, and we at Lombiq can take part in that or provide an organizing role with anybody who wants to take part. If you have any feedback or you are looking forward to having a Harvest again, please share your opinion with us by filling out this survey about the upcoming Orchard Harvest! Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 381 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Orchard Core 1.5.0, adding Feature Profiles support to Auto Setup - This week in Orchard (11/11/2022)

We are thrilled to announce that Orchard Core 1.5.0 is now available! Check out this post to know everything about the latest release of Orchard Core! Now let's see the newest features and editions of the current release that we will continue the whole month! Let's get started! Orchard Core updates CultureInfo should not depend on local computer settings When the library sets the culture using the new CultureInfo(culture), you can get unexpected results if this is also the system's culture and data formats were customized. This could be a problem if the server wants one data format for internal administrative use that's different from the culture's canonical format. For example, you have an en-US server with a date format set to ISO 8601. Then if you want to display a date in Orchard Core with the site set to American locale, it will display it using ISO 8601, which is not what you'd expect. The site's internationalization should not depend on the local format settings. This repro assumes you have Windows 10 with en-US region settings: Steps to reproduce the behavior on Windows: Go to /Admin/Settings/Localization and make sure your site is en-US. Create a new view that contains @T["Date: {0:d}", new DateTime(2022, 02, 21, 12, 0)]. Navigate to it, you will see Date: 2/21/2022. Go to Start Menu > Settings > Time & Language > Region > Change data formats. Change the Short date to "2017-04-05". Restart the server. Visit the same page again, you will see Date: 2022-02-21. And as you may guess, the expected behavior is that you should still see: 2/21/2022. This means that from now on, you can use a new option coming from appsettings.json (IgnoreSystemSettings under the OrchardCore_Localization_CultureOptions section), which is about setting whether to ignore the system culture settings or not. Adding Feature Profiles support to Auto Setup The issue here was that the Auto Setup doesn't support Feature Profiles. The Feature Profiles feature allows the Default tenant to create Feature Profiles which can restrict the features available to a tenant with Feature Rules. Let's say you want to use Auto Setup to set up tenants automatically. You set the FeatureProfile property (like for ShellName, SiteName... "FeatureProfile": "standard-tenant") for a tenant as, it is used by Feature Profiles in Shell Settings. The feature profile is not used for tenant settings, only if you manually configure it from the Default tenant's admin, but the Auto Setup should apply the configuration. If you check out the documentation of the Auto Setup feature, you can see that now you can optionally pass the name of the feature profile used by default. Note, it's only applicable if the Feature Profiles feature is used. Add styles for common ASP.NET validation classes Currently, when we are using common HTML for validation the styles are not applied correctly. Here is an example of code: <div class="mb-3" asp-validation-class-for="DisplayName"> <label asp-for="DisplayName">@T["Display Name"]</label> <input asp-for="DisplayName" class="form-control w-md-25" autofocus /> <span class="hint">@T["Name of the type as it will be displayed on screens."]</span> <span asp-validation-for="DisplayName"></span></div> The <span asp-validation-for="DisplayName"></span> text should be displayed in red. This is because we are missing class styles for field-validation-error. Also, the <div class="mb-3" asp-validation-class-for="DisplayName"> doesn't have any visual distinction. This is maybe because we don't have any class styles for has-validation-error. We should at least provide default styling for these even though it might look "different". Also, at the same time, we should probably make sure that we are consistent in the way that we are implementing these validations throughout the entire Orchard Core admin forms at least. And here, you can see a screen with the updated styles: News from the community Orchard Core 1.5.0 Orchard Core 1.5.0 is now available! If you open up nuget.org and search for the OrchardCore.Application.Cms.Targets package, you will find the updated version of Orchard Core! There is a new page in the documentation with the breaking changes. Upgrade your solution to 1.5.0 now! Feel free to drop on the dedicated Gitter chat and ask questions or use GitHub Discussions! Orchard Harvest 2023 For those who are too young to remember, we had Orchard conferences, called Orchard Harvest. And the conference website was available under orchardharvest.org, but unfortunately, it's not anymore. The last one was in 2017 in New York. So, having another get-together is very much overdue. If you would like to see or get a feeling of how this looked like before, we have a couple of mood videos on the Orchard YouTube channel, like this one from the first conference. The point is that we should really think about organizing the next one, and we at Lombiq can take part in that or provide an organizing role with anybody who wants to take part. If you have any feedback or you are looking forward to having a Harvest again, please share your opinion with us by filling out this survey about the upcoming Orchard Harvest! Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 383 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Add a way to retrieve a UTC now DateTime in Liquid, Responsive Admin Theme - This week in Orchard (04/11/2022)

Add a way to retrieve a UTC now DateTime in Liquid, change the Query Schema editor to Monaco Editor, allowing multiple INavigationManager, and a demo about the responsive Admin Theme! Let's get started! Orchard Core updates Add a way to retrieve a UTC now DateTime in Liquid Orchard Core has a new Liquid helper called utc, which converts a local date and time to the UTC date and time based on the site settings. Let's say we type in the following expressions: utc: {{ "utc" | local | date: "%c" }}local : {{ "now" | local | date: "%c" }}local is the default : {{ "now" | date: "%c" }} This will appear as follows. You can see the current date time in UTC and in the site time zone as well. This new helper is also added to the documentation of Orchard Core. Change the Query Schema editor to Monaco Editor If you have a site set up with the Blog recipe, you have one predefined query, called RecentBlogPosts. You can edit this query under Search -> Queries -> All queries. And as you may notice, the schema editor now uses the Monaco Editor that powers VS Code too. Allowing multiple INavigationManager In the past, if you were trying to have multiple INavigationManagers, you could not do that because the TryAddScoped is replacing the existing implementations. So, to be able to have multiple INavigationManager implementations, you have to use TryAddEnumerable, which adds a ServiceDescriptor if an existing descriptor with the same ServiceType and an implementation that does not already exist in services. And here, you can see that the NavigationShapes class can now handle multiple INavigationManager implementations. Demos Responsive Admin Theme This demo is about a feature that you can see in this pull request to make the Admin Theme responsive. First of all, you can see that fields are listed with the title being at the start point, in this case on the left. So, if you have an RTL text direction, it will be on the right. The cool thing about this is that you utilize more of the width of the screen when the screen is large and you reduce the scrolling if unnecessary. But if you have a smaller screen, the labels go back to the top as what you used to see. We have the same thing for content parts as well. Here you can see how everything appears if you have a wide or a narrow screen. But not everybody may like to see the labels on the left like this, it means this is optional, and by default, nothing will change unless you explicitly change it. This one was done by adding a new StyeSettings section under the TheAdminTheme section to the appseetings.json where you can define classes. If you chose to utilize this, you can add a setting per tenant, and you can customize the look and feel of the Admin Theme for every tenant. And how does this work is the classes are placed by helpers. Let's check out the TitlePart.Edit.cshtml for example. As you can see, the GetLabelCssClasses() and GetEndCssClasses() Orchard helpers read the settings and apply the class names that you have provided in the appsettings.json file. This means that if you want to use this feature, your custom views have to be updated to utilize these helpers. And all the new built-in views of the source code of Orchard Core have to use these helpers in the future. If you would like to know more about this feature, don't forget to check out this recording on YouTube! News from the community Orchard Harvest 2023 For those who are too young to remember, we had Orchard conferences, called Orchard Harvest. And the conference website was available under orchardharvest.org, but unfortunately, it's not anymore. The last one was in 2017 in New York. So, having another get-together is very much overdue. If you would like to see or get a feeling of how this looked like before, we have a couple of mood videos on the Orchard YouTube channel, like this one from the first conference. The point is that we should really think about organizing the next one, and we at Lombiq can take part in that or provide an organizing role with anybody who wants to take part. If you have any feedback or you are looking forward to having a Harvest again, please share your opinion with us by filling out this survey about the upcoming Orchard Harvest! Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 386 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Orchard Harvest 2023, User Notifications - This week in Orchard (28/10/2022)

Adding default form templates for the Default Theme, adding wrapper element for all content fields, demo about the User Notifications module and don't forget to fill out a survey about the next Orchard Harvest conference! Orchard Core updates Adding default form templates for the Default Theme Currently, all of the form widgets are rendered using Widget.cshtml which renders too much HTML without any added value. The goal here is to create default Widget-Form, Widget-Input, Widget-Label, Widget-Select, Widget-TextArea, Widget-Validation, and Widget-ValidationSummary templates. It means that now, you will find these default form templates if you open up the Default Theme. Adding a wrapper element for all content fields There is no easy way to hide/show content fields "label and input as a group" using JavaScript event because there is no wrapper element to select. The goal here is to add a wrapper element to all of the content fields to allow the user to easily hide/show the entire field block using JavaScript. Here you can see the editor of the Text Field where the wrapper has now new classes with ones that you can easily use to distinguish the same kinds of Text Fields from each other. For example, the Text Field called Subtitle of the built-in Blog Post content type has the following HTML structure. Here you can see that the third class and the ID contain the technical name of the Text Field, which makes targeting the given field easier. Adding GetPageSize method to account for MaxPageSize throughout the code Now we have a new GetPageSize method in the PagerOptions class that returns the maximum number of the allowed page size based on the values of the default and maximum page size numbers. And we are using the value coming from this method for every occurrence, where we are constructing the Pager by passing it as the second parameter. Which is the default page size in this case. Demos User Notifications The goal of the User Notifications module is to push notifications to the user, meaning notify the user somehow. There are many ways you can notify a user, one of them being a web notification, you can do SMS, you can do push to a mobile application, etc. In Orchard Core right now, there is no way to send notifications, but there is a way to send emails. Let's navigate to Configuration -> Features and enable the Notifications module. This will provide a way to notify users. After you enable this module, you will see a new bell icon near the Dark mode icon at the top right. If you click on that icon, you will see a list that shows you all of the notifications that you have right now. You can click on them to mark them as read, or you can click on All Notifications at the bottom, which will redirect you to the page where you can see all of your notifications. Here you can see a list of all of the notifications available. You can use the search here, and filter them only to see the read or the unread notifications. You can sort by recently created, or by previously created. You can also mark the unread notifications as read, mark the read notifications as unread or you can delete the notifications as well. You can also hit the Mark All As Read button to mark everything as read. Now let's see how you can generate notifications! Notifications can be generated via code by injecting INotificationManager. But you can also generate notifications via Workflows. Here you can see we have a workflow called Notify Content Owner, which contains the custom activities provided by the Notifications module. Here we put two events, one for when the Blog Post content item is published and one for when the Article is deleted. And here, you can also see the two new Notify content's owner activities as well. Let's check out the content of the first Notify content's owner activity! Here you can see we have proper Liquid support to customize the summary, and the body of our notification. If we open up the editor of the second Notify content's owner activity, you can see here we have some HTML code in the body as well. To be able to render the HTML properly, don't forget to put a tick in the "The body contains HTML" checkbox. And that's not everything! If you would like to know don't forget to check out this recording on YouTube! And if you want to try out this feature for yourself, you can find the code in this PR! News from the community Orchard Harvest 2023 For those who are too young to remember, we had Orchard conferences, called Orchard Harvest. And the conference website was available under orchardharvest.org, but unfortunately, it's not anymore. The last one was in 2017 in New York. So, having another get-together is very much overdue. If you would like to see or get a feeling of how this looked like before, we have a couple of mood videos on the Orchard YouTube channel, like this one from the first conference. The point is that we should really think about organizing the next one, and we at Lombiq can take part in that or provide an organizing role with anybody who wants to take part. If you have any feedback or are you looking forward to having a Harvest again, please share your opinion with us by filling out this survey about the upcoming Orchard Harvest! Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 381 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Lucene index rebuild and reset steps, Lombiq GitHub Actions - This week in Orchard (21/10/2022)

Lucene index rebuild and reset steps, update all action bars, utilize ContentTypeExtensions, and a demo about the Lombiq GitHub Actions project! Do we need to tell more about the content of our current post? Let's jump into the recent news of Orchard Core! Orchard Core updates Lucene index rebuild and reset steps Currently, when we are creating a search index from a recipe it doesn't build the index. This causes issues with Lucene and Elasticsearch where the Queries won't return any results, and also Elasticsearch will log an issue about "all shards failed" if nothing has been indexed yet in its indexes. It would be nice to be able to trigger an index to be rebuilt or reset from a scheduled background task as a one-time-only task. And from now on, you will find two new recipe steps that will help you with that: The Reset Lucene Search Index Step resets a Lucene index. The Rebuild Lucene Search Index Step rebuilds a Lucene index. You can find more information about how you can use these new recipe steps in the Orchard Core documentation. Update all action bars We have some improvements regarding the action bars on the admin UI of Orchard Core. As you can see on the screen below, there was a lot of wasted space between the search box and the New button. There was an extra round space between the filter icon and the search box and we also had uneven spaces, as you can see. The other thing is when using a mobile phone to manage contents (or any view with an action bar), the search input on the top shows up very small because of the wasted space between the search box and the New button. And here you can see the updated action bar. You can see that all of the mentioned issues are resolved like the search box is now longer, and we have equal spaces. Utilize ContentTypeExtensions We have had a static class called ContentTypeExtensions for a while now in the source, which contains several useful extensions. Like shortcuts to tell that the given content type is creatable, versionable, has stereotypes, and so on. Here the goal was to use the newly added extensions ContentTypeExtensions across the solution. Demos Lombiq GitHub Actions The Lombiq GitHub Actions project contains extensions that make a lot of things very easy in an Orchard Core or an Orchard Core-based project. If you don't know GitHub Actions or aren't entirely clear with the terminology, GitHub actions are GitHub's automation platform or CI/CD platform. Orchard Core of course also uses it to run various builds. And how you define a pipeline there is by creating workflows and/or composite actions. Workflows are what actually run, and actions are something that you can add on your own as well, these are things that workflows can call. Workflow is kind of like a program, and action is like a library that your program calls into. And of course, actions can be third-party as well. The point here is that you can use GitHub actions to automate a lot of things, like .NET builds, running tests, and doing various verifications on a pull request, and you can also do all kinds of modularization between these builds. And what we have under this project are workflows and actions. Workflows that you can call from your own workflows. Pretty much like one-liners, for example, to run the .NET build and execute a test. Actions are the building blocks that you can also use if you just want to have something specific. And we have quite a lot of actions and workflows here. Let's check out the workflow called Build and Test Orchard Core solution workflow! Here you can see how you use it. The example above is not even a minimal usage actually, it can be even shorter. This can be your GitHub Actions workflow in your own repository with an Orchard Core application, where you execute the workflow that we provide here. This is actually used in Orchard Core Commerce as well. If you check out the build-and-test.yml file inside the repository, you will find all the code that is necessary to run such builds. If you check out the details of a pull request inside the Commerce repository, you will see there are builds for Ubuntu and Windows as well. These are all the automated checks that we run. This is quite a long build because it's not just a .NET build, it also runs all kinds of static code analysis. It verifies that .NET packages are consolidated, and it also runs unit and UI tests with SQL Server and Azure Storage actually. And the Lombiq GitHub Actions projects contain a lot more than that! Are you interested in the details of what you can achieve if you use this project in yours too? If your answer is yes, or you want to know more about this automation platform check out this recording on YouTube for more! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 365 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

New AddDataMigration extension, show the container's header for List Part - This week in Orchard (13/10/2022)

Add notes in the documents on how to configure YesSql, and show Bag Part content when the post request generates errors in the Bag Part. New AddDataMigration extension method, demo about showing the container's header for List Part, and many more are waiting for you in our current post! Orchard Core updates Add notes in the documents on how to configure YesSql We have a page in the Orchard Core documentation that describes how you can run SQL queries by creating a DbConnection instance and obtaining a custom ISqlDialect from IStore from the YesSql namespace in the YesSql.Abstractions package. Or how you can handle prefixed tables. Now this page has been updated with a new section that describes how you can configure YesSql by configuring YesSqlOptions. Show Bag Part content when the post request generates errors in the Bag Part Assume we have a content type (ex., Product) with a Bag Part attached. The user creates new or edits existing products and provides invalid data for items within the Bag Part. The post request fails validation which is great! However, the Bag Part will be rendered in a collapsed state. So, the user is left wondering where the error is until the user uncollapses the Bag Part and sees the highlighted error. The solution here is when rendering the Bag Part, we should uncollapse the Bag Part if there is an error in any of its contents. We can try this one out easily. Let's say we have a site set up with the Agency recipe (that recipe contains the Landing Page content type which has several Bag Parts attached) and edit the content definition of the Service content type. Here we edit the Icon Class Text Field and make it required. Now it's time to edit the predefined Landing Page content item and remove the value of the Icon Class from one of the attached Services. And as you can see here, the Service content type is uncollapsed, making it easier to identify where the error comes from. New AddDataMigration extension The goal of the new AddDataMigration extension is to shorten code like services.AddScoped<IDataMigration, CustomMigrations>(); to services.AddDataMigration<CustomMigrations>();. And if you open up a given Startup.cs file (in our case the one that sits in the AdminDashboard module), you will see the usage of this new extension. Demos Show the container's header for List Part There is a need to extend the look of the default List Part. This would mean that the buttons that allow you to edit the container content item itself and to add contained content items now will be placed in a new line on the top to make the search text box wider. These navigation buttons now appear on every page where List Part or Contained Part are used for easier navigation. Here you can see the updated page of the predefined Blog content item. And if you would like to edit the given Blog content item or create a new Blog Post, you will see these new buttons there as well on the top. But now let's edit the content definition of the Blog content type and hit edit near the attached List Part to edit the List Part itself. Here you can find a new checkbox with a hint "Check this option to show a header for the owning content." Let's put a tick in this checkbox and see what will happen when we navigate back to the list item's view. As you can see, now we have a new line here that shows the header for the owning content, meaning the header of the Blog content item, which just shows "Blog" in this case. This new line is also available on the page where you edit the blog content item itself and on the page where you create a new blog post. But let's do some tricks now! Let's say that we edit the definition of the Blog content type and add a new Media Field to it, called Logo. After we can edit our predefined blog content item and upload an image using our new Media Field. The header is simple by default, but we can override it easily using shapes! Let's say that we want to display that logo in this new line! To do that, we needed to create a new shape template called Content-Blog.Header.cshtml (we are using Razor and the technical name of this content type is Blog). Here you can see that this row contains two columns, and we would like to display the image that is selected by our Media Field called Logo in the first column. And now, the only thing to do is to navigate back to the admin UI of Orchard Core and check out the brand-new look of our Blog! If you want to try this out right now, you will find the code in this pull request. And as always, if you want to see a recording about this feature, this will be your video on YouTube! News from the community Orchard Core Commerce is now available on all DotNest sites Orchard Core Commerce is now available on all DotNest sites! A few weeks ago, we mentioned the current state of the Orchard Core Commerce module and one of the hugest improvements of adding Stripe Payment to the solution. And now you can start building your e-commerce site on DotNest! Check out our announcement for details here. Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 355 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Smithsonian Folkways Recordings now upgraded to Orchard Core - This week in Orchard (06/10/2022)

Provide IConfiguration extensions to configure certain modules, replace StatusCode() when possible, demo about migrating Smithsonian Folkways Recordings to Orchard Core, and many more are waiting for you in our current post! Orchard Core updates GraphQL 4 Now Orchard Core uses GraphQL 4 instead of 2.4.0. The next step would be to update to GraphQL to 7.1.1, which is the latest release currently. Provide IConfiguration extensions to configure certain modules Several modules expose their configuration via IOptions<T> but only include site settings IConfigureOptions<T> for it: Email, Facebook, GitHub, Google, and Reverse Proxy Configuration. These could also provide extension methods like OrchardCore.Shells.Azure does with AddAzureShellsConfiguration() so the configuration can be easily provided by e.g., the appsettings.json file. And now we have these extension methods. If you check out the ConfigureEmailSettings extension method, you can see a sample for that which reads the settings from the appsettings.json file. This means the OrchardCore.Email module allows the user to use configuration values to override the settings configured from the admin area by calling the ConfigureEmailSettings extension method on OrchardCoreBuilder when initializing the app. Replace StatusCode() when possible We have some helper methods that can be used instead of returning StatusCode(). And there is also a new extension method called InternalServerError that produces an InternalServerError response. Demos Smithsonian Folkways Recordings Orchard Core migration For those who are unfamiliar with the Smithsonian Folkways Recordings site, the primary purpose is to showcase music and its cultural impact, as well as to provide related educational content. The news from the world of music is also available in the form of articles, and users can digitally purchase albums and other content as well. Additionally, users can also request licenses to use music for their purposes. The site was recently migrated from Orchard 1.x to Orchard Core and its process includes recreating and reimplementing everything present in the previous application as well as adding some important new features like UI tests. The home page serves navigation purposes for the most part. It shows the latest available content on the site, including new releases, artists, vinyl reissues, news, etc. You can also browse the site by filtering by genre, location, artists, or record labels. Users can use the License request form to request licensed music for their personal uses. You can navigate between the editor groups using the top navigation bar or you can also use the Back and Continue buttons. The data that the user enters is always saved when you click the Continue button, which is by design. There is a song search feature too that can be used to find the song which they would like to license. The registered users of the site can use the LDAP server and NetSuite login options as well for authentication so they don't necessarily need an Orchard Core user account to log in. One of the largest parts of the migration process is data migration which was handled by Jean-Thierry Kéchichian. If you are interested in how he did that or some other technical details, check out this recording on YouTube for more! News from the community Smithsonian Folkways Recordings now upgraded to Orchard Core As you can read, the Smithsonian Folkways Recordings now upgraded to Orchard Core, migrated from Orchard 1.x, and we worked a lot on it too! Here you can check out the case study about the migration process. Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 356 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Extend user permissions, add Contained Stereotypes Bag Part Settings - This week in Orchard (30/09/2022)

Add Contained Stereotypes Bag Part Settings to allow a user to include content types by stereotype, add Displayed Stereotypes property to Content Picker Field Settings, demo about extending the user permissions, and many more waiting for you in our current post! Orchard Core updates Add Contained Stereotypes Bag Part Settings to allow a user to include content types by stereotype When attaching Bag Part to a content type, the user must explicitly set Contained Content Types with an array of content types to be included in the Bag Part. This is good for most cases; however, it would be great to allow for setting the contained content types using Stereotype. The stereotype would be in addition to not in place of Contained Content Types. For example, we want to group all Contact Methods (phone number, address, email address, etc.) by a stereotype type called ContactMethod. All of these content types share a similar functionality which is a way to contact a person. Now we created a Person content type and attached a Bag Part to it. In this case, we had to explicitly specify each content type in the Contained Content Types. But if a new content type was added later from other feature/module, the user would have manually to edit the Bag Part settings every time/everywhere ContactMethods are used to add the new content type which isn't efficient. So now the Bag Part is more flexible. And as you can see here, now we have two radio buttons under the Contained Content Types option where the user can select Content Types or Stereotype. Add Displayed Stereotypes property to Content Picker Field Settings And this one is quite the same as the previous feature but for the Content Picker Field. For example, we want to group all to-do items (appointments, meetings) by a stereotype type called ToDoTask. All of these content types share similar functionality which is a to-do task. Now we want to use Content Picker Field in a different content type to allow the user to select a to-do-task of any kind. In this case, we have to explicitly specify each content type in the DisplayedContentTypes. But if a new content type was added later from another feature/module, the user would have to manually edit the Content Picker Field settings all time. Everywhere to-do tasks are used to add the new content type which isn't efficient. So, let's say we navigate to the editor of a Content Picker Field. And here you can say that you can select the Contained Content Types to: Display All Content Types Content Types Stereotype Add settings to form widgets There was a bug in OC. The option editor wasn't loaded when trying to add Select Input while creating a form. Also, the edit button did not open the modal that would allow you to populate the options using JSON. If the content is saved, and the page is loaded again then the modal and the options editor work just fine. Another form-related improvement is validation. When creating a form using the Form input widgets like (Input, Select, and Text Area) there is no easy way to add a label and validation elements to the input. The current approach is to add a label widget and then a validation widget which is not always ideal. We can make this process much simpler by adding settings to the Input, Select, and Text Area widgets with the following properties: LabelOption an enum value with the following values (None, Standard, ScreenReaders). By default, None is selected to keep it backward compatible. ValidationOptions an enum value with the following values (None, Standard). By default, None is selected to keep it backward compatible. Now, if the user selects an option other than None in the settings, we’ll create the label in the same widget block. The same applies to ValidationOptions. This will make things like dragging/dropping widgets during edit and controlling the size much easier. At the same time, we output less HTML code. And if we add the validation rules, we’ll have more validation logic which makes the widgets more useful. And now, the editor of the Select Input looks like the following with the additional options. And of course, the same applies to all of the built-in form inputs. Demos Extend user permissions A couple of months back there was a need reported to have some roles to be able to edit a user and some not. And there is a conclusion that the user interface is not very flexible at the moment with the permissions. So, it kind of makes it hard if you have a unique case where you need some specific users to be able to do stuff. And also, to set up who can see what users, when you are listing the users. To be able to test out this feature with us, you have to check out this PR on GitHub. The first thing that you will notice is the new permissions regarding Users. In this case, we navigated to Security -> Roles and edited the Moderator role. There are new permissions, for example, Assign any role, Delete any user or Delete users in role - Administrator, List all users, etc. So, you can say you can list all the users, but it doesn't mean you will be able to edit all the users. If you try to edit a given user, you will notice something new here. As you can see, the user name of the user is not editable, but you can edit the email address of the given user. This is controlled by settings that you can reach under Configuration -> Settings -> User Profile Settings. As you can see, here you can allow or deny changing the user names or email addresses of the users. But now back to the users' list. Let's say we have some predefined users and made some changes regarding the permissions of the Moderator role. Now, we logged in with a user who has the Moderator role. After that, the user with the Moderator role will see something like this. First of all, you can notice that there is a little badge under every user that shows the roles the user has. You can also see that this user has permission to see users in the Editor role, but they can't edit or delete the editor user. Now let's edit the author user! Here you can see that this user can edit the settings of this user but can't fully manage the roles of the author user. They have the option to add or remove the Author role but that's it, nothing more. And we are just showing you some simple scenarios about what you can achieve and how you can customize the user permissions. If you want to see more complex scenarios, head to YouTube for a recording! News from the community Helping Global Health build an Advanced Form Builder using Form.io When Global Health from Australia approached us with the request to build an advanced form builder using Form.io, it promised to be an interesting project. They were looking to integrate this new form builder deeply into MasterCare+, their Multi-Tenanted SaaS-based platform for Health Care which is built on Orchard CMS. It would allow creating custom forms for a wide range of scenarios in the health care domain, using the advanced editing capabilities of Form.io. The solution built by Lombiq was an important step in bridging the gap between paper forms and electronic health care management. Check out the full post here! Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 354 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Archive Later Feature, Notifications Feature - This week in Orchard (23/09/2022)

Archive Later Feature, extract GetLanguageDirection() and IsRightToLeft() to CultureInfoExtensions, introduce EnabledByDependencyOnly flag for features to allow the feature's state to be auto, and a demo about a feature called Notifications! Check out our post for the details! Orchard Core updates Archive Later Feature Back in 2020, we mentioned the Publish Later Feature which adds the ability to schedule content items to be published at a given future date and time. Now here comes the Archive Later Feature, which provides a way to unpublish content items at a given time. Let's see a simple example of the usage! Open up the admin UI of Orchard Core and head to Configuration -> Features and enable the Archive Later module. If you would like to use this feature with your content type you have to edit its definition by attaching the Archive Later Part to it. Let's attach the Archive Later Part to the Blog Post content type! Now let's edit our predefined blog post! At the bottom of the editor, you will see a new input Tag Helper with the datetime-local input type. If you set the date and the time here and hit the Archive Later button, the status of the current version will automatically change to draft when the time goes by using a background task. We also have a Cancel Archive Later button, so we can cancel the archiving process. And in the SummaryAdmin list, you also had a little message that shows you the date and time when the content item will be archived. Extract GetLanguageDirection() and IsRightToLeft() to CultureInfoExtensions We have some extension methods for CultureInfo to deal with language direction. These extension methods were placed in the LanguageDirection class and now they have their own class called CultureInfoExtensions. So, from now on you can find these extensions here. Small change but nice to have extension methods in a separate class. Introduce EnabledByDependencyOnly flag for features to allow the feature's state to be auto To represent this new change, we will use the features that you can check out in detail in the demo down below regarding the Notifications Feature. So, let's say you are on the Features page and search for the "notifications" word. Here you can find the Notifications module, which is only enabled if you enable one of its dependencies. So, you can't enable it right away. But the Email Notifications module requires it, meaning if you enable the Email Notifications module, the Notifications module will be enabled as well. And if you disable the Email Notification module, the Notifications module will be disabled as well because none of its dependencies are enabled. And it's a flag that is very easy to use! If you open up the Manifest.cs file of the OrchardCore.Notifications module (can be found in this branch), you will see the feature with ID OrchardCore.Nofitications has this property set to true. It means that if we enable one of the dependencies of this feature, this module will be automatically enabled. And if none of the dependencies of this feature are enabled, then this module will be automatically disabled. Demos Notifications Feature The Notifications Feature provides a way to be able to send notifications to notify users. You could implement a push notification to a mobile phone, you could implement a web notification, you can have an email notification, etc. For right now you can see the implementation of the email notification, and the Email Notifications module is the one that provides you with this feature. Let's enable it! After that, we can edit one of the existing users on the site and say that we want to send email notifications to this user. And if you implement a push notification or a web notification, then you will see a flag for those as well and we can set up what kind of notifications we want to send to the given user. But this might feel incomplete without the Notification Templates feature which provides a way to create notification templates. Let's enable this one as well! And this will mean that now we can create new Notification Template content items. Let's create a new one and call it "Welcome email for new users template". We will send this email any time a new user is created. Here you can select the provider that you want to utilize, let's select the New user notification here. And as you can see, you have a subject and a body. There are also username, password, and email arguments, that we automatically create because this provider is aware of them. It means you can inject these into the subject and the body of the email that you want to send. The idea here is if you create a new user as an admin you might want to send their temporary password in an email. Here you can use Shortcodes and Liquid templates as you can see. So, we mentioned that we have a New user notification provider. If you enable the third notifications-related feature, called Notification Templates for Contents, it will give you more providers to use. So, if we create another Notification Template, now we can select the Content based notification provider too. It provides you with more templates (DisplayText, ContentItemId, ContentType, etc.) because it has more awareness. At the bottom, you can control who should be the person who receives this. But here right now you don't have the way to select that I want to send out this notification when someone publishes the Article content type. So, selecting the content type and the event is not here. To do that, you have to edit the content definition of a given content type. If we select the Blog Post one, for example, you can see a new setting, called Notifications. If you select to send a notification, you can define which event you want to use and the given notification template. This feature is a PoC and if you want to check out the implementation or try it out in your solution, you can find the code in this branch. And if you prefer videos, check out this recording on YouTube to see more about this feature! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 350 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Add fallback alternate when a custom stereotype is used, tenant removing - This week in Orchard (16/09/2022)

Add fallback alternate when a custom stereotype is used, validate database connection before allowing a tenant to be added or set up, remove localization workaround in Data Annotation Attributes, and a demo about the upcoming tenant removing feature! Check out our post for the details! Orchard Core updates Add fallback alternate when a custom stereotype is used The idea here is that when you create a stereotype, before this change, you had to create templates for this stereotype if you intended to display or edit items of this stereotype. And now, there is a fallback shape for stereotypes such that if you don't create custom templates, it will use a standard, default template that is valid for any stereotype. How it works is just to let's use the Content shapes for anything when we don't have a custom template. It prevents showing error messages when you create a stereotype and try to create a content item from this stereotype. And you can test this one easily. Just navigate to the admin UI of Orchard Core and head to Content -> Content Definition -> Content Types, where you can find the Create new type button to define your new content type. Add a name to it and hit Create. We will not add any Parts to it right now. Set the Stereotype to Cat and hit Save. Now we can create a new Animal content item by clicking on the New button and selecting Animal under Content -> Content Items. And as you can see, Orchard Core now renders the default Content_Edit template as a fallback instead of throwing an exception. Validate database connection before allowing a tenant to be added or setup When adding a new tenant, we allow the user to set a prefix to the tables to enable reusing the same database for multiple tenets. However, we don't validate that the prefix isn't already used first. The problem with this is that it throws an exception. Let's say we have a tenant with a URL prefix test and we selected the SQLite database. Now let's create another tenant using the same URL Prefix and database preset. As you can see, now we have a validation error. But we also have validation for connection strings as well. Let's say we would like to use SQL Server and provide a connection string that is invalid. In this case, you will face an error like "The provided connection string is invalid or server is unreachable". Remove localization workaround in Data Annotation Attributes Two years ago, when Hisham Bin Ateya started the support data annotations PO localization PR, there was a long discussion to support localization in data annotations. Back in the day, Antoine Griffard did a workaround to achieve the goal by using IValidatableObject, and now it's time to remove this workaround and use the new way of doing this. This means we can remove the need of implementing the IValidatableObject from several ViewModel. And from now, on you can use some attributes which help you print localized error messages. And now there is an attribute for email validation and URL validation as well. Let's see an example quickly! As you can see here, the RegisterViewModel implemented the IValidatableObject to be able to validate the properties inside the class. Now, instead of using the IValidatableObject, we can add attributes to these properties, and here comes the new EmailAddress attribute as well. As you can see from the screen, the new implementation of the ValidationAttribute can be used to validate your model by returning a localizable error message. Demos Tenant Removing The option to be able to remove tenants is a long-requested feature, and for now, we are very close to shipping this feature, thanks to Jean-Thierry Kéchichian. Let's see how it will work! For this demo, we will navigate to GitHub and checkout this branch. Now, let's add some tenants to be able to try out this feature. As you can see, we have added 3 tenants. The Agency and the Blog ones are tenants that we have already set up, but the tenant called test is waiting for setup. Here you can see that we have the Sites folder under App_Data where each of the tenants has its own folder containing the Media files for example. And now we also have a wwwroot folder under OrchardCore.Cms.Web, which contains a folder per tenant like in the previous case. This means now each tenant can manage their own cached files under wwwroot. When we remove a tenant, the logic will also remove the folder of the tenant under the wwwroot and the Sites folders. And now it's time to delete a tenant! To be able to delete a tenant, we should disable it first, which means it will be not served, and we will be able to compose an internal ShellContext with all the features that the tenant has, even if it is installed or not. You can also remove multiple tenants by using bulk actions. And this is just the surface, there are still some things to do. If you would like to see the current state of this feature and do a deep dive under the hood, check out this recording on YouTube! This feature is sponsored by Lombiq. News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 347 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!