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

Featured tags

IIS
API
SMS
SEO
All tags >

Build Version Display module, prevent Users feature from breaking when Roles feature is disabled - This week in Orchard (27/01/2023)

Add permission check for the content type filter, prevent the Users feature from breaking when the Roles feature is disabled, add new database options, and a demo about the new Build Version Display module! Check out our post for the details! Orchard Core updates Add permission check for content type filter The content type filter should only show accessible content types. The user should only see content types that they can view. Before this fix, all of the content types were listed, even if you don't have permission to see it. Let's say that I am an editor user who has no access to view the Blog content type. In this case, when this user navigates to Content -> Content Items and clicks on the content type filter, the predefined Blog content item will not appear in the list. Prevent the Users feature from breaking when the Roles feature is disabled This was an old issue in Orchard Core if you disable the Roles module, the site crashes because the Users module needs the following services to work: IRoleService RoleManager IRoleStore This issue is now fixed, and you can disable the Roles module from the UI without facing an error. You can find the implementation details in this pull request, thanks to Mike Alhayek! Add database options like TablePrefixSeparator, Schema, IdentityColumnType, and DocumentTable Here is a summary of the changes: both TableNameConvention and TablePrefixSeparator were removed from YesSqlOptions. The following properties were added to the ShellSettings of each tenant: TablePrefixSeparator when this value does not exist, we assume _, however, if an empty string is found, we use no prefix for the tables. Schema was added to allow you to provide a specific schema to use. IdentityColumnSize when this value is empty or invalid, we assume Int64. DocumentTable when this value is empty, we assume Document. If adding a new tenant failed due to missing Encrypt=false or TrustServerCertificate=True, we add the error to the log file to provide the admin with more about the issue. The following means that now you can find a new section in the configuration called OrchardCore_Data_TableOptions. Now you can define the name of the Document table if you want to change it, change the table name separator (changing the _ in tenant1_tablename), and the default identity column size, which is Int64 by default. Every existing tenant will work with Int32, but the new tenants will use Int64. It can happen because YesSql now supports Int64 as well. You can find some new lines about these settings in the documentation as well. If you want to migrate the existing tenants, you have to do your own migration. You can also define the schema of the tenant (DatabaseSchema) which is also configurable from the UI. This way all the table names are the same, just the schema that could be changed for each tenant. Demos Lombiq Hosting - Build Version Display The goal of the Lombiq Hosting - Build Version Display for Orchard Core module is to display the build version (i.e., .NET assembly version or other) on the admin of the Default tenant. By using this module, you can see at a glance which version of the app is deployed. But of course, there are various ways to know what's currently deployed into a specific environment (like staging or production), but the goal of this module is to cover the following use case: when you are looking at the app, you will know what's there. The only thing you have to do is to install the module, and navigate to Configuration -> Features, and enable the Lombiq Hosting - Build Version Display feature. After you navigate to the homepage of the admin UI, you will see the following on the dashboard. You can find the Orchard Core version, the version of the .NET assembly is currently being executed, which means the web application. If you have a CI build, usually that will generate a version number for you. And finally, during the build, you can also add a link to the build. This is just a dummy link for examples, but you can link to a GitHub action. You can read more about it in the Readme file of the module. Do you want to quickly try out this project and see it in action? Check it out in our Open-Source Orchard Core Extensions full Orchard Core solution, and also see our other useful Orchard Core-related open-source projects! And as always, if you want to know more about this feature, head to YouTube for a recording! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 396 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 would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news about Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

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!

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!

Prevent Trumbowyg from converting <div> to <p> element, Elasticsearch feature - This week in Orchard (26/08/2022)

Prevent Trumbowyg from converting <div> to <p> element, reduce memory when reloading settings of a given tenant from the database, and a demo about the upcoming Elasticsearch feature! Let's get started! Orchard Core updates Prevent Trumbowyg from converting <div> to <p> element When using HtmlBodyPart or HTMLField with either WYSIWYG or Trumbowyg, the editor converts <div> elements to <p>. Also, when the user switches into code insert mode, the text area does not take up the full size of the editor. Steps to reproduce the behavior: Add HtmlBodyPart or HtmlField to a content type, and use either WYSIWYG or Trumbowyg editors. Create new or edit an existing content item. Click on <> of the editor to switch into code insert mode and insert the following. The issue is that the Semantic option is enabled by default. By enabling Semantic, it generates a better, more semantic-oriented HTML (i.e. <em> instead of <i>, <strong> instead of <b>, etc.), meaning: $('.trumbowyg').trumbowyg({ semantic: { 'b': 'strong', 'i': 'em', 's': 'del', 'strike': 'del', 'div': 'p' }}); The idea is that the "Wysiwyg" editor option should not alter the "Tryumbowyg" editor default behavior. This is why we have the "Trumbowyg" editor option that allows changing its behavior for your own needs. So, the fix was to set the semantic: false on the Wysiwyg templates and don't change anything on the Trumbowyg templates. Reduce memory when reloading settings of a given tenant from the database There appears to be a memory leak caused by the usage of IConfiguration as the backing for ShellSettings. Memory used by each ShellSettings instance is not being freed for garbage collection due to some fairly crazy gcroots even if you intentionally release the ShellSetting. Most of the memory is being used by Strings related to the DatabaseShellsSettingsSources with the VersionId field being the largest consumer of memory. The problem is that the DatabaseShellsSettingSources contains data for ALL tenants (which can be 2000+ in some cases) even if you're only loading/reloading a single tenant. So, among our tenant config/settings sources, one of them is by default the tenants.json file. In fact, when we reload a given tenant, we don't need all data from this source but only those related to this tenant. When we add this source to the config stack of a given tenant, if we still use builder.AddJsonFile() we have no choice, we can't split this file into smaller parts per tenant. But when this source comes from the database, we do a builder.AddJsonStream() on a MemoryStream that holds all data of this source, so here the idea is to only hold in memory the data related to this tenant. To do so Jean-Thierry Kéchichian added a method to the interface of this source allowing to pass a tenant name. So that when the source comes from the database, each time we reload a specified tenant we still create a MemoryStream but that only holds the data related to this tenant (not all tenants). When calling this new method on the other implementations of this source, they just ignore the provided tenant name by calling the existing method without this parameter. Demos Elasticsearch feature Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents. This time we will see how you can use Elasticsearch in Orchard Core using the Elasticsearch feature, which can be found in this pull request and will be released soon. The Readme.md file of the module describes how you can use this feature for development and testing purposes by using Docker. We won't go into the details of how to install Docker and use the Docker Compose file, the Readme.md file mentioned has a nice step-by-step tutorial about that part. So, let's say we have a Docker container running the Elasticsearch image on port 9200 (the default one). The Elasticsearch module connection configuration can be set globally in the appsettings.json file or per tenant. The connection types documentation and examples can be found at this URL. To try out this feature, you need to enable the Elasticsearch feature under Configuration -> Features. You can also see a Content Picker for Elasticsearch, just like we have for Lucene, and a Worker. And of course, don't forget to enable the Search module as well, which adds front-end search capabilities. We will use this feature to try out the new Elasticsearch feature. The Elasticsearch module has some settings in the admin, where you can configure the search settings for the module (Search -> Settings -> Elasticsearch), and you can decide which fields you want to use for the search pages. It's quite the same as Lucene's settings, but it's a separate page because you can index different fields for Elasticsearch and Lucene. And for the search form, we can decide which provider we want and it will work at runtime. This means you can seamlessly switch from one indexing provider to another one. You can set this up under Search -> Settings -> Search. If you navigate to the default URL of the search form (/search) you can use this form as you would use it in the case of Lucene. But of course, you need to have an Elasticsearch index that you can use while doing a search and the indices can be set up under Search -> Indexing -> Elasticsearch Indices. As you can see, here we created a new index called default_search and indexed some content types. And now, you can use the search form to return results based on your query. The default_search index contains the Article and the Blog Post content types, so if we use the "man OR about" query, the site will return us two results, the default blog post, and the default article content items. And we are just scratching the surface here. The Readme.md file contains a lot more: how to create an Elasticsearch index during recipe execution, how to create an Elasticsearch query from a Queries recipe step, how to use Web APIs to execute a query, and a lot more! Check out this recording on YouTube if you would like to know more about this upcoming feature! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 341 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!

Allow case-insensitive tenant names in ShellHost, Lombiq PowerShell Analyzers - This week in Orchard (19/08/2022)

A new HttpBackgroundJob helper component, allow case-insensitive tenant names in ShellHost, and a demo about the Lombiq PowerShell Analyzers! Let's get started! Orchard Core updates HttpBackgroundJob helper component The HttpBackgroundJob component allows executing a background job in an isolated ShellScope after the current HTTP request is completed. It allows a controller (or a Razor Page) action to return without waiting for a job to complete, and then, if the job updates some state data, also allows to render the job state. Allow case-insensitive tenant names in ShellHost Let's say you created a page where a user can log in to a specific tenant by providing the tenant's name, username, and password. To identify which tenant the user is trying to access you can use _shellHost.TryGetSettings(tenantName, out settings), which looks up the tenant by name. The issue here is if the user does not provide a case-sensitive tenant name, the ShellHost does not find anything. The solution here is to define case-insensitive dictionaries. Then we would not need any more in some places to do an explicit case insensitive lookup. Check out the _shellContexts and the _shellSettings ConcurrentDictionaries on the screen below. Demos Lombiq PowerShell Analyzers The Lombiq PowerShell Analyzers provide PowerShell static code analysis via PSScriptAnalyzer and Lombiq's recommended configuration for it. Use it from the CLI, in GitHub Actions, or integrated into MSBuild builds. To use the PowerShell Analyzers: You must have PowerShell 7 or greater installed. The PSScriptAnalyzer module must be installed. The script will attempt to auto-install it, however, if this fails (e.g., on Windows PowerShell, you have to be an admin to install modules), follow the steps here. If you have the PSScriptAnalyzer module installed, you can use Lombiq PowerShell Analyzers to have a static analysis of your PowerShell scripts. As you may know, Lombiq's Open-Source Orchard Core Extensions is an Orchard Core CMS Visual Studio solution that contains most of Lombiq's open-source Orchard modules and themes, as well as related utilities and libraries. Please keep in mind that only those extensions included that use the latest released version of Orchard (i.e., the very cutting-edge ones depending on a nightly build are not yet here). This solution contains the Lombiq PowerShell Analyzers as well, so we will use this one for the demo. If the Lombiq PowerShell Analyzers project is included via a submodule, edit the csproj file of your primary project(s) and add the following: <Import Project="path\to\Lombiq.Analyzers.PowerShell\Lombiq.Analyzers.PowerShell.targets" /> This way you associate the analyzer with a .NET project, and MSBuild automatically invokes analysis before building. If the analysis passes, it creates a timestamp and won't perform the analysis again until a new script file has been added or an existing one modified. As you can see, the Lombiq.OSOCE.Web.csproj contains this line by default. You don't need to <ProjectReference> Lombiq.Analyzers.PowerShell.csproj. If you include the project as a NuGet package, it will work as-is. Just clone this repository and try to add some bad PowerShell scripts to it. Our goal here is to have some build errors when building our solution using Visual Studio. Now, it's time to write some bad code! Here we added a Violate-Analyzers.ps1 file to the Lombiq.OSOCE.Web project and built the solution. As you can see, the build failed with errors that say we have some issues in the Violate-Analyzers.ps1 file. And that's just a quick demonstration about how to use the PowerShell Analyzers with MSBuild. You can use it with Visual Studio Code, PowerShell CI, and GitHub Actions as well. If you are interested in how to do that, check out the Readme file of the project or head to YouTube for a recording! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 331 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!

Categorized tenants, Automated monkey testing in the Lombiq UI Testing Toolbox - This week in Orchard (20/02/2022)

Categorized tenants, change the Script Task to use Monaco Editor, update logos to NuGet packages, and automated monkey testing in the Lombiq UI Testing Toolbox for Orchard Core are the topics of this week. Interested in the details? Check out this post for the details! Orchard Core updates Categorized tenants Now you can have a Category on the Tenants page and filter tenants by category. If you want to try this out, just set up your site and make sure you have the Tenants feature enabled. Now head to Configuration -> Tenants on the admin UI and add some tenants by clicking on the Add Tenant button. Here you can see we added three additional tenants and used Category A and Category B as the category for these tenants. You can filter the list by the available categories just by clicking on the Category dropdown near the State one. Change the Script Task to use Monaco Editor If you enabled the Workflows feature, you have the option to use Workflows. You can add a Script task to your workflow that executes a script and continues execution based on the returned outcome. And the Script Task now uses the Monaco Editor instead of the CodeMirror one. New branding icons for Orchard Core projects templates and new logo to NuGet packages Now the branding icons are updated for project templates. And now we use the new logo for the NuGet packages because the packages had the default logos. Demos Lombiq UI Testing Toolbox for Orchard Core - Automated monkey testing When you are developing your software, you are always in the mindset that you actually know what your software is doing, how it works, what are the limitations. And with experience, you learn to anticipate different user behavior. Let's say that you are in the Orchard admin, and when you want to edit a content item, you know that you have to click on the Content option, and after a tiny delay, you will see a list that contains an element called Content Items. If you click on the Content Items, you will see a list of the content items. You know that you can edit a given content item by doing a single left click on the display text of the content item by default. Because it looks like a link, and you just have to click once. And if you want to save a content item, you still need to click once on the Publish button, for example. But a lot of people actually will do a double click on the Publish button. Long story short, there is a difference between what the developer can think of how users will use a piece of software and what users in the real world will actually end up doing. What you can see in this demo is about introducing monkey testing in the Lombiq UI Testing Toolbox for Orchard Core. It was done mostly by Yevgeniy Shunevych, who is a developer working a lot on automation and automated testing, including his UI testing framework called Atata. What we have done is that we used gremlins.js for automated monkey testing. Monkey testing is about random interactions. The library unleashes random interactions onto the software, and it will try to break it. If it can, then we found a bug, we can fix it. Now it's time to check it out quickly! Lombiq's Open-Source Orchard Core Extensions is an Orchard Core CMS Visual Studio solution that contains most of Lombiq's open-source Orchard modules and themes, as well as related utilities and libraries. Please keep in mind that only those extensions are included that use the latest released version of Orchard (i.e., the very cutting-edge ones depending on a nightly build are not yet here). This solution contains the Lombiq UI Testing Toolbox as well, so we will use this one for the demo. Here we have an example for monkey tests as well, just find the MonkeyTests.cs file in the Lombiq.Tests.UI.Samples project. It's supposed to be very easy to use because the point is that you use this for features that you really want to break. The easiest way is to just test one particular page, that will do these random interactions on just that page. If it leaves the page, it will stop. And since it's random, every time it might be different, and to be able to produce deterministic repeatable results, it's also possible to provide a random seed which we have done here. But you can do the same just by using the MonkeyTestingOptions configuration class. You can find a method called TestCurrentPageAsMonkeyRecursivelyAsync. This means it won't stop if it leaves a certain page or if it leaves the page it starts with and will continue to test every page until it either finds a bug or if it runs out of time because you can also specify how much time it will spend on a single page. And if it leaves that page and comes back to the same page, it's still from that same time. Now let's see what will happen if you actually run a given test. You can easily run a monkey test by using the Test Explorer window of Visual Studio and finding a test under Lombiq.Tests.UI.Samples/Lombiq.Tests.UI.Samples.Tests/MonkeyTests. How it starts is like a standard UI test. First, it runs the setup, and if you have multiple tests just as before, it can reuse the same snapshot from the site that you have run the setup for. After, it will open the page and log in to the admin. And then you see it clicks everywhere, typing different kinds of keys and so on. This goes on until the time runs out. And that's not all of it! Do you want to know more about this new addition to the Lombiq UI Testing Toolbox for Orchard Core? Then check out this recording on YouTube! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 238 subscribers! We have started this newsletter to inform the community around Orchard with 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 week's Orchard meeting!

Lombiq UI Testing Toolbox - Orchard Core Features tests, disable File Content Definition feature by default - This week in Orchard (10/12/2021)

The HTTP Response Task now supports the text/html content type, disables the File Content Definition feature by default, prevents confusing usage of IRunningShellTable.Match(HttpContext) and demo about the Orchard Core Features tests in the Lombiq UI Testing Toolbox. Do you want to know more? Then don't forget to check out our current post! Orchard Core updates HTTP Response Task supports "text/html" content type If you are using Workflows in your solution, you have the option to use the HTTP Response task, which writes an HTTP response (to use that task, you need to enable the HTTP Workflows Activities feature). If you are in the editor of your Workflow, you just need to click on the Add Task button and select the HTTP Response from the HTTP category. From now, you will see a new text/html content-type option of the response body, which allows workflow submissions to return web content directly. Don't enable the File Content Definition feature by default in the built-in themes From now the File Content Definition feature will not be enabled by default. This feature is replacing the default behavior to store content type definitions in the database with one that stores the content type definitions in a file in the App_Data folder. Most users prefer to store the content type definitions in the database by default. You can still enable this feature if you prefer your content definitions to be file-based, for instance, if you want them in your source control management. But by default, they will be in the database from now. If you have a distributed theme or site, then you might want it to be in the database by default. And the change is just to remove the feature from the recipes. The corresponding page on the Orchard Core documentation is also updated to inform everybody about the changes. Prevent confusing usage of IRunningShellTable.Match(HttpContext) You could use this extension method with an HttpContext, but it didn't actually work anywhere where you can do it from a module. So, from now this RunningShellTableExtensions is an internal class, because as you can see from the comment there: not public because it wouldn't match tenants with an URL prefix later in the request pipeline. Mostly to be used from ModularTenantContainerMiddleware. Demos Lombiq UI Testing Toolbox - Orchard Core Features tests The Lombiq UI Testing Toolbox is a web UI testing toolbox mostly for Orchard Core applications. Everything you need to do UI testing with Selenium for an Orchard app is here. UI Testing here is an automation that clicks through the web application in a browser. One of the most popular frameworks for that is Selenium, which does exactly that. You get an API to instruct a browser, and every major browser is supported. This UI Testing Toolbox provides a lot of features on top of Selenium for Orchard Core. Basically, allowing you to UI test an Orchard Core application in a safe and parallelized way providing a lot of helpers, a lot of higher-level APIs allowing you to test your application with SQLite, with SQL Server with local media storage, or with Azure Blob Storage. And you can have a test e-mail sending with a local SMTP server too. Everything just works. Check out the highlights of the Readme.md file of this repository to see all of the features and this older This week in Orchard post where you could see a demo about the Toolbox. This time we will focus on the Orchard Core Features tests. The idea here is that you have an Orchard Core application, and you want to do some basic smoke testing, like trial the application whether it works at its very basics. Now, for that, we have created a TestBasicOrchardFeatures extension method, which will run through a couple of tests that you can run individually. For example, testing whether the setup works, testing whether the registration works, testing whether the login works, and so on. All of these are features of Orchard Core itself, so not your custom application, but these are also all things that you can break from your custom code. So, we figured that it's useful to check whether these basic Orchard features work all the time. And for example, if you manage to break set up with your recipe or if you manage to break the login or the registration features from your code like even implementing an event handler that throws an exception, well then these tests should catch them. Do you want to see these tests in action? Well, in that case, you just have to click on the following recording on YouTube! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 235 subscribers! We have started this newsletter to inform the community around Orchard with 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 week's Orchard meeting!

JSON Recipe Deployment Step, Tenant Feature Profiles - This week in Orchard (14/10/2021)

A new extension method to encode redirect URLs, documentation for the image Shortcode, a new JSON Recipe deployment step, and a nice demo about the Tenant Feature Profiles feature! Don't forget to check out our current post to know more! Orchard Core updates JSON Recipe Deployment Step The only way before being able to execute a custom JSON recipe step was to create a file with the recipe inside and execute the recipe. Now it's much easier, you can just paste JSON, and then you have the Monaco IntelliSense inside the editor. To try this out, set up your site using any recipe and make sure you have the Deployment feature enabled (Configuration -> Features). Now head to Configuration -> Import/Export -> Deployment Plans and add a new deployment plan. Hit the Add Step button to add a new step to it and find the one called JSON Recipe that exports a JSON Recipe. Here we would like to disable the OrchardCore.Templates feature when someone imports this deployment package. If you execute your deployment plan, you will see that the recipe contains one step with the JSON content that we have just provided in the JSON Recipe deployment plan. Document Encode redirect URLs If you publish a content item (a blog post for example) with a permalink that contains non-English characters, the redirect goes to a URL where the non-English characters are encoded. Like /Admin/Contents/ContentItems/Ελληνας-ϰαὶ-δὴ-ϰαὶ-γράμματα and of course we are getting a page not found message. The fix was for that to encode the redirect URLs. It has been merged but after a while, it had to be changed because the EscapeUriString method has been deprecated in .NET 6. and it was not building anymore. It was removed because it was not used correctly by users, and it was apparently buggy. The solution is there is a new custom method in Orchard Core called EscapeLocationHeader because it's a custom escape for the location headers. It's using GetComponents with custom parameters to do that. The idea is that anytime you do a redirect, the server will not accept custom characters because it contains non escaped characters, and it needs to be escaped. But not all of them need to be escaped, just the query strings, the parts that are not like slashes and equals. So, if you are using the this.LocalRedirect(returnUrl, true) or the this.Redirect(returnUrl, true) extension methods, it will use the EscapeLocationHeader method to correctly escape the URL. Demos Tenant Feature Profiles We had a demo a few weeks ago about a feature that is about through app settings/configuration adds the ability to restrict the features and/or themes that are available to either a tenant and/or all tenants or a mix of both. This time we will see the final, merged version of this feature that you can check out any time if you clone the main branch of Orchard Core! First of all, set up your site and enable the Tenants and the Tenant Feature Profiles features, which provides a way to manage available features for each tenant. Now head to the new option under Configuration called Tenant Feature Profiles where you can add feature profiles. Here you can set the rules that you want to use. By default, you can have an Include and an Exclude rule. By using these you can easily say that I don't want to allow the given feature for the assigned tenants or I want to allow my custom feature to the given tenants. The Expression contains the name of the feature but it can include stars like OrchardCore.*Templates that will match the OrchardCore.Templates, OrchardCore.AdminTemplates and OrchardCore.ShortCodes.Templates feature as well. Let's say that we don't want to allow the TheAgencyTheme and the features with names to start with OrchardCore. and end with .Templates. Now let's create a tenant with these rules. To do that, navigate to Configuration -> Tenants and hit the Add Tenant button. The first thing that you may notice here is the new Feature Profile dropdown where you can optionally specify which feature profile should be applied to this tenant (as you can read the hint). We have one, called restricted profile, let's select that one. And it's time to set up our tenant to see what are the available features there. If you search for the text templates, you will see that the search returned no results. If you navigate to Design -> Themes and try to find the TheAgency theme, you will see that the theme is not there in the list. Note that the Tenant Feature Profiles feature is only available for the default tenant naturally. And that's not all of that! If you would like to see more, don't forget to check out this recording on YouTube! News from the community .NET Community Standup - What's new in Orchard Core The .NET Community Standups are weekly live shows, hosted by the .NET team, are casual sessions full of community content, demos, Q&A, and discussions around what's happening in .NET. Last week you could see Sébastien Ros showing you the latest improvements and features of Orchard Core. If you are new to Orchard Core or you if are a developer who hasn't worked with Orchard Core in a long time or just wants to see a nice overview about what Orchard Core can provides you with version 1.0, head to YouTube now for the recording! Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 228 subscribers! We have started this newsletter to inform the community around Orchard with 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 week's Orchard meeting!

Migrate INotifier to support async implementations, Lombiq Hosting - Tenants - This week in Orchard (28/09/2021)

Migrate INotifier to support async implementations, messaging when getting Part InvalidCastException, Lombiq Hosting - Tenants demo, and many more coming this week! Do you want to know more? Then don't forget to check out our current post! Orchard Core updates Migrate INotifier to support async implementations This new feature is about replacing the INotifier on the front end with a SignalR version, which works asynchronously. INotifier has been updated to use ValueTask when adding notifications. Prefer not to do a custom implementation, as using INotifier allows the front end to also receive messaging notifications from code in the Orchard Core codebase, which is very convenient for us. If you check out the INotifier interface, you will notice that the Add method is now marked as obsolete, and the new one that you can use from now is the AddAsync one. And of course the Information, Warning, Error, Success extension methods are also marked as obsolete and have their async methods, which are used across the whole solution of Orchard Core. Messaging when getting Part InvalidCastException Sometimes if you forget to register your part, you might have some cast errors, and you don't know why. This addition is just about displaying an error message saying you are trying to cast to this part, but please do a double check to make sure you registered this part. So, don't forget: every time you create a new content part from your module, you have to register it in the ConfigureServices method of your Startup class by using the AddContentPart extension method. You can find several examples about how to do that like, here you can find the registration of the FlowPart and the BagPart. DisplayText value of a cloned item is set before calling CreateAsync When cloning a content item, two audit log events are recorded: An initial create event for the newly cloned item. A subsequent save event updating the new item with the cloned content data. The create event in the audit log does not show the DisplayText of the original item but instead repeats the content type. The save event in the audit log displays correctly. Steps to reproduce the behavior: Set up a Blog site. Ensure the Audit Trail feature is enabled and configured to log all content items. Go to the Manage Content page and clone the About article. View the Audit Trail and see that the Create event states that Version 1 of the Article Article was created. The audit log for the created event should state that Version 1 of Article About was created. The fix was pretty straightforward for this one. As you can see here, the solution was to set the DisplayText of the cloned content item before calling the CreateAsync method of the DefaultContentManager, because the CreateAsync invokes the event handlers used by the Audit Trail module. Demos Lombiq Hosting - Tenants The Lombiq Hosting - Tenants repository contains various features that help you build a multi-tenant web application in Orchard Core. With the help of the Tenants Management module, you can set restrictions on tenant creation, while using the Tenants Admin Login module you can log in from the Default tenant's admin dashboard to any other tenants as an administrator user. In this demo, we will go with the quicker way and use our Open-Source Orchard Core Extensions full Orchard Core solution that contains both of these modules. If you clone that repository and set up your site using any setup recipe, let's just navigate to the admin UI of Orchard Core, and under Configuration -> Features, enable the Lombiq Hosting - Tenants Admin Login module that adds the ability to log in as a tenant's admin user. Make sure that you have also enabled the Tenants module to be able to test the tenant management. :) Now create a new tenant and enable the Lombiq Hosting - Tenants Admin Login - Sub-tenant feature there that adds the ability to log in to the tenant from the Default tenant. That will mean that admin users from the Default tenant can log in to this tenant as an admin user. In our example, we have created a tenant called Blog, and if you Edit that tenant, you will see a new Login as an admin user button, which can be used to login to this tenant as an admin user. Now let's see what you can do by using the other module of the Lombiq Hosting - Tenants repository, called Lombiq Hosting - Tenants Management which manages restrictions on tenant creation. The Readme.md file of the Tenants Management module shows how you can specify a list of hostnames that cannot be used to create a tenant. You can write the list of forbidden hostnames as a JSON array in the appsettings.json as follows. Now let's go back to the Tenants page of the admin UI and try to create a tenant with a forbidden hostname like forbidden.hostname1.net. If you hit Create, you will get a validation error: forbidden.hostname1.net is a forbidden hostname. And of course, changing the hostname of an already running tenant to a forbidden one will also cause a validation error. And as always, if you would like to see more, don't forget to check out this recording on YouTube! News from the community A new website using Orchard Core: ICAgile ICAgile envision a world in which organizations enable and inspire everyone in them to create a better future for those around them. Check out this brand new Orchard Core site here! If you are interested in more websites using Orchard and Orchard Core, don't forget to visit Show Orchard. Show Orchard is a website for showing representative Orchard CMS (and now Orchard Core) websites all around the internet. It was started by Ryan Drew Burnett, but since he doesn't work with Orchard anymore, as announced earlier it is now maintained by our team at Lombiq Technologies. Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 226 subscribers! We have started this newsletter to inform the community around Orchard with 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 week's Orchard meeting!

Parlot, Make deployment steps orderable - This week in Orchard (07/03/2021)

This week you can meet with Parlot, which is a fast, lightweight, and simple to use .NET parser combinator! Check out our post for the orderable deployment steps, the improvements of the Kast platform, and many more! Orchard Core updates Make deployment steps orderable This is about making deployment steps orderable in the UI, to allow drag and drop to get steps where you want them to be. UI only, as the choice to when steps run should be up to the user. Let's say you have plenty of plans where features don't want to be first - more common when deploying to existing sites, rather than building up recipes, but steps are for both. And now you can also find hints to the important steps that suggest they should go first, like "Content Definitions should be placed before any content steps." Update from node-sass to dart-sass This is about replacing gulp-sass with its newer gulp-dart-sass because node-saas is now deprecated and the latest node-sass doesn't compile on the latest NodeJS anymore. So, it's recommended on the gulp-sass repository be upgraded to gulp-dart-sass as node-sass is deprecated. You can read more about it in this article. Fix WorkflowBlockingActivitiesIndex table indices name length for PostgreSQL This is an interesting one, so we think this should deserve a few lines. Check out the Migrations file in the OrchardCore.Workflows module where you can see the creation of two different indices: IDX_WorkflowBlockingActivitiesIndex_DocumentId_ActivityId and IDX_WorkflowBlockingActivitiesIndex_DocumentId_ActivityName. Because of the PostgreSQL name length limit, it uses only IDX_WorkflowBlockingActivitiesIndex_DocumentId_Activity for both which causes an exception. The fix is just to reduce the length of these indices. Add Properties to SetupContext There is a SetupContext class that had some properties like SiteName, AdminUserName, AdminUserId, etc. This SetupContext class will be prepopulated by the setup screen and then passed to ISetupHandler. But now the ISetupHandler accepts an IDictionary to work with these properties. But why is it useful? When setting up a tenant or site sometimes you need to pass in some custom data and use it in your setup recipes. Like when a user registers on a site and he submits a form with firstname, lastname, etc. We then call a workflow that creates the tenant and executes a setup recipe. In this setup recipe, we could create a landing page and we want to assign the firstname, lastname to be set as the displaytext of the landing page content item. Or another use case would be to populate the custom user profile settings during setup. So, from now, the developers can populate the Properties bag from his workflow task or a custom setup screen if they would like to. You can see a good example in the ExecuteAsync method of the SetupTenantTask. Demos Parlot The Shortcodes repository by Sébastien Ros contains a Shortcodes processor for .NET with a focus on performance and simplicity. And now that Shortcodes processor is updated to use a new parser called Parlot. Parlot is a French pronunciation of the word like chat or someone who talks a lot. In French, you write it parlotte. Parlot is a hand-written parser for Shortcodes and that parser is now extracted to make it reusable. You can find adding and using Parlot in the Shortcodes module in this PR. If you check out that pull request, you will see that before this PR we had the Character.cs, Cursor.cs classes. Now they aren't here anymore, they are in the package. The code is almost the same. Now we have a ShortcodesParser.cs that is using Parlot. And in this file, you can find the grammar of Shortcodes. A text is based on shortcode and TEXT nodes. A Shortcode can have an identifier and arguments. An argument is like identifier equals value. It's actually could be just a value if you want. And a value is either a string or a number. This class contains a bunch of first-level methods like ParseNode, ParseRawText, and so on. If you check out the JSON benchmarks of Parlot, you will see a nice table about the performance of Parlot. And in that table, you can see the performance of parsing JSON documents. As you can see, it is ten times faster than something like Sprache, which is a famous parser. Pidgin has been created to be faster than Sprache and now Parlot is faster than Pidgins. If you take a look at the allocations, you can see that they are equal because it's just about allocating JSON. This benchmark creates an expression tree (AST) representing mathematical expressions with operator precedence and grouping. Same thing here. This table is about comparing the low level, the fluent API, and Piding. Even the Fluent API is five times faster than Pidgin. And in terms of allocation, it's a little bit better than Pidgin. Here you can see a demo video about Parlot and a lot more than that! Like stories about the NCalc library that is created by Sébastien Ros 10 years ago. NCalc is a mathematical expressions evaluator in .NET. NCalc can parse any expression and evaluate the result, including static or dynamic parameters and custom functions. And that library is used by the Sprache.Calc library. Sprache.Calc provides easy to use extensible expression evaluator based on the LinqyCalculator sample. The evaluator supports arithmetic operations, custom functions, and parameters. It takes a string representation of an expression and converts it to a structured LINQ expression instance which can easily be compiled to an executable delegate. In contrast with interpreted expression evaluators such as NCalc, compiled expressions perform just as fast as native C# methods. We can fill up the whole This week in Orchard post just by these libraries and the story behind Parlot. Or we can start to describe how the parser works and how you can extend it with your own implementations, but this may no longer be closely related to the topic of this series. So, as we just mentioned before: if you are interested in these topics, this will be your presentation! Resource Zones, Resource Layers, Resource Widgets Kast is an Australian company and one of their primary goals is to implement the Kast platform with the Kast Group Finder component. We worked together with Seth Cleaver (Co-founder and Director of Kast) on this tool to be able to create an intuitive self-service process that enables people within a church to easily find a suitable group to attend, simplify the administrative processes required for getting people into groups, and provide information to the group co-ordinators that might assist in planning and measuring effectiveness. Check out this case study about how we've developed this multi-tenant social group management platform for churches! The Kast platform is growing from time to time and this time you could see an improvement from Dean Marcussen which is about providing ways to edit static resources (like JavaScript and CSS) using the admin UI. The exact issue in GitHub is opened by Dody Gunawinata a while ago about the downside of the current theme system is that to change anything will require deployment. The way around is to include the JS/CSS in a template and include them in every other template. Check out the following recording for a possible solution! It didn't seem like the design was wanted for Orchard Core itself, so it will probably remain private at this stage. But if the people wanted it, it might be possible to make it available at some point as a contribution module. News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 190 subscribers! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post 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 week's Orchard meeting!