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

Featured tags

IIS
API
SMS
All tags >

This week in Orchard - 11/30/2018

Interested in the updated roadmap of Orchard Core or the beta 3 release? Or every other new features of Orchard Core? Then don't forget to read our current post! On Orchard Core Liquid rendering issue on Hungarian computers In Liquid, we have a tag helper called zone to get the inner content of the tag, until we find a tag that starts with "end" and finishes with "zone", something like that: tag.Name.StartsWith("end" + tag.Name); The tag.name in this case would be "zone". When you are running on a Hungarian computer if you type: "endt".StartsWith("end"); the result will be true of course. But if you type "endz".StartsWith("end"); the result will be false, which means it never found the end of the zone, so it was never rendering anything, because the script was invalid: "endz" doesn't starts with "end". The issue is that the "dz" is taken in Unicode as one char, which is not "d" or "z" it's a "dz" char, but in .NET it's only one. The solution is to pass the comparison, so it will be culture-insensitive: "endz".StartsWith("end", StringComparison.Ordinal); Updated Roadmap The community can ship beta 3 as the .NET Core 2.2. will be done. Let's see the fully or partially implemented features of beta 3: Background tasks management GraphQL Decoupled CMS Taxonomies Custom navigation Facebook authentication ReCaptcha Mini Profiler Recipe migrations File based Content Definition The Coming Soon theme Edit and Display modes The backlog of the RC is also updated and the features are ordered by priority: Content Localization RTL admin theme Localization packages (Chinese, Spanish, Arabic, French are the most requested) Distributed hosting Jobs queue Output caching Entities API CDN support The ContentLocalization is the most important feature for RC. You can check the updated roadmap by clicking here. Demos Content Picker editor improvements If you add a Content Picker Field with a standard editor to your content, you can type to search the referenced content when you editing the content item. If you allow to select multiple elements of the content types, you can move them around, reorder them by a simple drag and drop. Resource Management configuration If you view the source code of the home page, for example the Blog theme, you can see that it's using the min files. <!-- Custom styles for this template --><link rel="stylesheet" href="/TheBlogTheme/css/bootstrap-grid-ext.min.css"><link rel="stylesheet" href="/TheBlogTheme/css/clean-blog.min.css"> If you go to admin and head to Configuration -> Settings -> General, you will find two new things: Use CDN (Content Delivery Network) — Whether the defined CDN value is used for scripts and stylesheets, or their local version Resource Debug Mode Let's see a style tag helper in a liquid file: {% style name:"bootstrap", use_cdn:"true", version:"4" %} The value of the use_cdn is true. So, the bootstrap is forced to use CDN and you will see the following when you inspect the code: <link crossorigin="anonymous" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.css" integrity="sha384-2QMA5oZ3MEXJddkHyZE/e/C1bd30ZUPdzqHrsaHMP3aGDbPA9yh77XDHXC9Imxw&#x2B;" rel="stylesheet" type="text/css"></link> If we set the use_cdn value to false, it will take this source from the local resource we have. If we do not set the use_cdn in the tag helper it still used the local, but now if we check the Use CDN checkbox in the admin, it will use the CDN. So, with this new setting, you can decide which assets should use CDN if you do not specify that value using the tag helper. On top of the CDN, you can decide if you want to use the minified or the non-minified version of your scripts and stylesheets. By default, it will use the environment. For instance, if you are in development, it will use the debug version. If you are in production, it will use the minified version. But you can force it to use debugable version to select Enabled. Then your code will be like: <script crossorigin="anonymous" integrity="sha384-DWBJ4L0qV7ffH95jHsoooM04DWR2qtntWspYadu41Wx5kw6d0Cs7W&#x2B;7C2v2bh7vX" src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.bundle.js" type="text/javascript"></script> If we say we want to disable the resource debug mode by setting the value to Disabled, our code will be like the following: <script crossorigin="anonymous" integrity="sha384-pjaaA8dDz/5BgdFUPX6M/9SUZv4d12SUPF0axWc&#x2B;VRZkx5xU3daN&#x2B;lYb49&#x2B;Ax&#x2B;Tl" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.bundle.min.js" type="text/javascript"></script> Taxonomies module The Taxonomies module now merged to the dev branch. To use it, you need to enable the module. After that, you can create a new Taxonomy under the New -> Taxonomy option. We have previously created a new Color content type, that has a TitlePart attached. Let it be the Term Content Type. After creating the Taxonomy, you can create new term content types here by clicking the Add Color button (because Color is our term content type here). You can simply reorder the Colors using drag and drop. Taxonomy is one content item and all of the Colors (sub-content items) are composed in the Taxonomy content item. So, if you load a Taxonomy content item, you have access to all its terms directly, so they are parts of the taxonomy document for performance reasons. Let's say that we want to categorize the Blog posts using this taxonomy. To do that, add a new Taxonomy Field to the BlogPost content type. Now when you create or edit a new Blog post, you can select the terms. To how to display terms in the front end and many more head to the Orchard Core Documentation about taxonomies! Headless CMS with Orchard Core Sebastien gave a nice demo about how to use Orchard Core as a Headless CMS on the ASP.NET Community Standup this week. You can watch the recording of the demo in YouTube! If you are interested in more news around Orchard, don't forget to check out the recording of this week's Orchard meeting!

This week in Orchard - 11/23/2018

Read our post to know the new The Coming Soon Theme, the new Reverse Proxy and CORS module for Orchard Core! On Orchard Core Interface for prevent the roundtrip to cast the dynamic JObject to a part and back When we have a content item, the item has a Content property. This property is a dynamic. We can get the value of the TitlePart's Title by saying: dynamic content = ContentItem.Content;content.TitlePart.Title; This is a dynamic object. What we return from .Content is actually a JObject, a Json.NET type that contains the JSON representation of the data. To lose the dynamicity and be strongly typed, we do .As. With that will instantiate a new TitlePart object, which will be the deserialization of the JObject property. So, we deserialized the JObject into an instance of TitlePart: content.As<TitlePart>().Title; What happens if we want to change the Title of the TitlePart? We could say something like: content.As<TitlePart>().Title = "Foo"; But what we are doing is we have a new object (TitlePart) and change the property Title, but we didn't change the JObject property that is attached to the content item. So, we changed a clone of the TitlePart. It's a new object we change. In Orchard Core what we need to do is something like: var titlePart = content.As<TitlePart>().Title;titlePart.Title = "Foo";content.Apply(typeof(TitlePart), titlePart); The Apply will bind back the TitlePart instance we have to the property named TitlePart of the content item we have. So, we extract the JObject into a TitlePart instance. We change the instance and we map back the TitlePart instance into the JObject structure of the content item. This is what every driver, every part driver, every field driver is doing when we want to update some data. You don't see the Apply, because what we do in the driver, we get a part. This part is something that the coordinator (the drivers) will give you from the part definitions. So, it says let me extract the JObject property named for example MenuPart. Let me give you an instance of this class and this is what you have to update. What the coordinator does, it will reapply back the change you did to the JObject. This is the roundtrip between a JObject and a class. It would be nice if we could just say the following without needing the Apply. var titlePart = content.As<TitlePart>().Title;titlePart.Title = "Foo"; It would be great if we can just simply assing the Title to the JString represented in our content here. And it would be technically doable. When we do .As, we return a class inheriting from TitlePart, with all its properties that are proxies to the actual JTokens that are represented in the content item. So, this is doable by using dynamic proxies. The only issue is that you can only create a dynamic proxy on an interface. Because TitlePart is a class, we can't do that. One of the biggest advantages of this approach is the performance, because we don't have to convert back and forth the items. We don't have to create new strings and everything. If we want to do that we will need to change the parts (that are classes) into interfaces which should be fine, because all the parts we have only contains properties, without any logic inside. All of them are mostly just data. The logic is extracted into handlers and drivers. So, if we had all the parts being interfaces then we could have this logic automated using dynamic proxy. When we do .As, we actually have a proxy that modifies the inner JObjects or JTokens that correspond to the content item directly without passing an actual instance of the TitlePart that we have to bind back. That would be a breaking change, but that could be good on a long run. It will change the way we write content parts like we did it in the following example: Demos Reverse Proxy module Reverse Proxy is about when you host your Orchard Core web app or CMS behind a proxy. There will be a new module to Orchard Core called Reverse Proxy Configuration module. To set up Reverse Proxy, navigate to Configuration -> Settings -> ReverseProxy. The Coming Soon recipe and The Coming Soon Theme The new theme, called The Coming Soon Theme is built for SPA sites that are under construction, but the site owner would like to show something instead of a 404 or a static HTML page. Here users can enter their email address and when the site is ready, we can send them an email about the launch of our new site. In the admin, we could see the only content item is called Coming Soon. It is a Form and also has the FlowPart to contain widgets. The goal of this form on this homepage is that if the user types an email (and have the ReCaptcha validation) then they will receive a mail to verify their address. After they will be registered to the site. We have one workflow here, called User Registration. This workflow is responsible to validate ReCaptcha, register the user and send an email to them. The comingsoon.recipe.json is the recipe that contains the User Registration workflow and it's activities. The form also comes from the recipe which will trigger the workflow. So, this recipe is a great example of how to set up a form to call an action using the recipe. Cross-Origin Requests (CORS) with Cors Configuration module The standard behavior of a standard ASP.NET Core website is that to allow single-origin request and reject things that come out from the origin. It could be a problem when you for example host a solution for an OpenID in a different server. To solve issues like that, a new module will be available for Orchard Core called Cors Configuration. After enabling the module, navigate to Configuration -> Settings -> Cors, where you can add new policies. Don't forget to watch the whole recording of this week's Orchard meeting!

This week in Orchard - 11/16/2018

The Admin Trees module is merged to dev and we give you a status about the Orchard Core Beta 3! Check out our post for the latest news around Orchard Core! On Orchard Core Making a dismissible Alert Widget Few weeks ago David Hayden developed a custom Alert Widget that allows one to easily create a Bootstrap Alert Component in an Orchard Core CMS Website with no knowledge of HTML In his newest post he shows how to make this widget dismissible without any need for Visual Studio or any other IDE or editor. GraphQL documentation In the last weeks we had several posts about GraphQL and we tried to present you the newest improvements of this module. Search for the word graphql for the relevant posts. If you visit the Orchard Core Documentation provided by Read the Docs, you could see the official documentation about how to work with the GraphQL under the Contents -> GraphQL section. This other documentation is about how the provided HTTP endpoints work to send client queries. Admin Trees module merged to dev The Admin Trees module from Matias Molleja has been merged to dev and a documentation is available here. Orchard CLI We have an issue about we should have a dotnet global tool as the CLI that should work only using REST APIs. In Orchard 1 we load every tenant to memory. The new CLI will use only REST APIs so that we can talk to an existing running instance and affect that. James Restall looked at it and he wants to use only GraphQL. He did a simple test with a working CLI using node for that. The reason for that is there are so many nodes available to manipulate GraphQL. Each module provides some description in a GraphQL for mutations and this tool is able to invoke the schema of GraphQL and map all the mutations into command lines. This will show up based on the GraphQL endpoint, so it's completely dynamic. When you connect to the machine, it will tell you what you have access to and what you can do with the CLI. Recipe Migrations This pull request will allow for running a recipe as part of migration called Recipe Migrations. Take the example of the Menu module which is creating a content type from the migration using C#. Now the idea is that is just to run a recipe file from the migration as part of the standard migration step. It might be easier to maintain the content type definitions or contents from data migration. Status of Orchard Core Beta 3 The community would love to ship by the end of the month or the beginning of December. We have everything that has been booking for Beta 3 and taxonomies is almost ready, just need to create a PR and merge it. We have the GraphQL and other brand-new features like the Admin Trees module. The community will fix the issues marked with P1 or P0 labels. We will wait the ASP.NET Core 2.2 release to ship Beta 3 and can upgrade directly to that. Don't forget to watch the whole recording of this week's Orchard meeting!

This week in Orchard - 11/09/2018

The GraphQL for Orchard Core is merged to dev and a new reCaptcha module will come to prevent abuse! Check out our post for the latest news around Orchard Core! On Orchard Core Added deployment plan and recipe support for media Let's introduce a new deployment step called Media where you can export all or specified media items. You can select folders or media items and they will be added automatically to the deployment plan. If you add new media items later on, they would be also included in the next deployments. In the recipes there was a Base64 property before, that loads a file in memory converted to Base64 and put it in the JSON document. Now the new SourcePath property actually streaming the file to the destination. So, we are not copying the file to the memory anymore. When we have a media step, you say which media you need from the file system(SourcePath) and where to put it in the media provider(TargetPath). Demos Media Layout improvements The look of the media layout improved a lot for a better usability. To check the new layout, navigate to the Content -> Assets menu.There is a new plus icon to create a folder near the Media Library.You can move the images between folders using drag and drop.You can switch between list view and grid view. In the grid view you can have large thumbs or small thumbs as well. You can filter by file names and have a breadcrumb to navigate between folders. GraphQL improvements The GraphQL module is merged to dev now! In the latest post we mentioned the improvements of the GraphQL module, let's have a quick look about what new features have been added to it since last week. Now status accepts ALL, that lists both published and draft content items. Logical expressions: you can combine more than one predicates inside the where, that will work like an AND. In this case you don't need to type the AND keyword. But you could say you want an OR, that you can also do of course. You can also mix the logical expressions like we did in the last query called mixedLogicalExpressions. ReCaptcha module You will have three new different modules for reCaptcha: ReCaptcha ReCaptcha User Login ReCaptcha Register New Account The ReCaptcha module provides the base functionality for ReCaptcha. The ReCaptcha User Login will put a captcha to the Login screen after the user tried to login six times in a row with invalid login attempts. If you enable the ReCaptcha Register New Account module, you will get a Captcha on the registration page as you can see here. To work with reCaptcha you need to provide the Site Key and the Secret Key (that you can get from here) under the Settings -> ReCaptcha menu. The ReCaptcha support for Orchard Core is in still under development thanks to Matthijs Krempel. The next feature from him is to include reCaptcha on the Forgot password page too. For the full demos and other topics around Orchard don't forget to check out the recording of this week's Orchard Podcast!

This week in Orchard - 11/05/2018

Interested in the new features of the GraphQL Explorer or the GraphQL API? Or the announcement of the Orchard Core Commerce: The commerce module for Orchard Core? On Orchard Core First let us to mention you some of the newest posts from David Hayden's blog! Overriding Theme Shapes with Templates in Orchard Core CMS The Blog Theme in Orchard Core has a Content-Article.liquid file. This is the shape responsible for displaying an article. In this post he shows how to change the hardcoded background image of the article by adding a Media Field to the Article content type to be able the users to select any image. Adding a New Zone to The Blog Theme Layout in Orchard Core CMS In this tutorial, he shows how to add a new Zone, called Messages to the Blog Theme. Now can add any widgets to the Zone in the Orchard Core CMS website. Develop a Custom Widget In Orchard Core CMS In this tutorial you can read about how to create a new widget, called Alert Widget, that will allow one to easily display a Bootstrap alert on the website using the previously crated Messages Zone. If you would like to read more exciting blog posts about Orchard and Orchard Core, don't forget to check out Orchard Blogs: the heartbeat of the Orchard CMS community: blog posts from Orchard-related blogs, scraped automatically. Created by Lombiq. Orchard Core Commerce: The commerce module for Orchard Core Orchard Core Commerce will be an Orchard port and partial rewrite of the open source Nwazet Commerce module that was built for Orchard CMS 1.x. Nwazet Commerce was initially built in 2012 by Bertrand Le Roy, loosely based on a commerce sample by Sipke Shoorstra. The initial goal of Nwazet Commerce was to power the web site of the hardware startup Nwazet. While Nwazet is no longer operating, the Nwazet Commerce project went on, and was further developed by a group of passionate contributors who are using the platform for their own, and their customer's web sites. Like Orchard, Nwazet Commerce was built with extensibility in mind, and as such it has its own extensions (typical examples include local tax and shipping modules). It's also pure, idiomatic Orchard. Orchard Core represents a major evolution of the Orchard design principles, and is sufficiently different that running Nwazet Commerce on it will necessitate significant work. As such, the team decided that starting from a blank slate was the best way to go, so they will port Nwazet Commerce piece by piece, being careful to accurately apply Orchard Core's new design principles. They also decided to adopt a new name, that gets rid of the now obsolete origins, and establishes their ambition for the module to become the go-to commerce module for Orchard Core. This work is in its initial design phases. There's a lot of work to do, and yes, the team do welcome participation in any shape or form. If you would like to help to improve the Orchard Core Commerce module head to GitHub and check the available Issues! Demos GraphQL Explorer and GraphQL API We mentioned the GraphQL feature earlier in this post and last week we saw how to Test the new tenant APIs using GraphQL. Now let's see the newest improvements of the GraphQL and the GraphQL API! For the following demo we set up the site using the Blog recipe. We added several fields to the Article content type to demonstrate the capabilities of the GraphQL Explorer: a Link Field called Link, a Markdown Field called Description, a Media Field called Images, and a Content Picker Field called Posts. When you enable the GraphQL module, you can go to admin/graphql, where you can find the GraphQL Explorer. You can use CTRL+Space to have an intellisense. You don't need to click the play button every time you want to run your query, you can hit CTRL+Enter to do the same. In the Explorer you also have access to fields not just the parts. The Subtitle is a Text Field, that you can reach by simply type the name of the field. The Link Field called Link has two properties: text and url. You can get the HTML content of the HtmlBodyPart as well. The field called Description is a Markdown Field. By accessing the html property of that field you can get the value of the markdown transformed to HTML. The Images here is a Media Field. It's provide the URLs of the images that stored in the database and represents the media in the assets. But if you want to render these elements you need the public URL to point to this media. So instead of paths you can call urls. When accessing a Content Picker Field (Posts in this case) you can get the contentItemIds or the content item itself. But let's say you have many related content items and you just need the first one. By typing contentitems(first: 1) you will get only the wanted item. You can skip the first one by typing contentItems(skip: 1). You can also do that with the collection of urls of the Media Field. You have the ability to write if statements here. If the content item is a BlogPost, then give me the MarkdownBodyPart, but the HTML of the markdown. To do that on a collection of content items, you need to type ... on BlogPost {} and in the bracket you can define what would you like to query on. You can write more complex queries like give me the blog posts and order them by their displayText or by the createdUtc. So you can order by properties. You can also combine this query by using the first or skip keyword here. You can use the where keyword with several filters. For example, by using the displayText_contains, you can filter for a post that display text starts with a given query. Hit CTLR+SPACE to see what options are available. With parameterized queries you can say that list me that blog posts where the display text starts with the value of the parameter. Now this query is parameterized by something, so you can reuse it or separate the query from the values. In the previous post we mentioned how to use Orchard Core's authentication server to authenticate yourself when making a call to Orchard Core APIs. Now you can use the GraphQL API to make those requests. On Lombiq Mega Millions on Show Orchard Show Orchard is an Orchard CMS showcase, displaying only the best Orchard CMS powered sites from around the web. The Mega Millions Jackpot website runs on Orchard too! So, added it to Show Orchard! We just scratched the surface of the topics that the community had this week. If you are interested in the whole conversation, don't forget to head to YouTube for the recording of the current podcast!

This week in Orchard - 10/26/2018

Interested in what will be the Orchard Core Cluster feature? Or the improvements of the Orchard Core APIs? If yes, you will love this post! On Orchard Core New Bootstrap checkboxes Orchard Core will have a new Bootstrap checkboxes soon. Orchard Core Cluster feature Why don't we do a feature that will support clustering in a better way? Today what we have is a Redis Cluster. Redis Cluster works as a fail over/replica or a shard/partition. When you have multiple nodes of Redis you can define which nodes are slaves or masters, which are actually fail overs. But you can also define Redis nodes as partitions. The idea with the fail over is that all the data replicated on two different nodes, so if one node go down, the other one will take over.The shard/partition strategy is to be able to scale out the memory, so if you have too much data to put once on a server then you create another one to share the data across the servers. Each node will be responsible for a partition of data. How it works is for each key that you store in Redis, the key will be hashed using the CRC(16) and it does a modulo of this hash 16384 and then you get a number which will be obviously between 0 and 16383. Any key will be mapped to a number like this randomly because it's using a hash code. This key will be like the slot that you want to put your key on. Each node in a Redis cluster is responsible for n slots. When you configure your Redis cluster you say my Redis instance A will be responsible from the slots 0-4000. Than the node B will be responsible for the slots 4001-9000. So, you define n nodes, each node you need to configure which slot it should use and when a key sent to Redis, it will compute the slot that should go in based on a hash code. Then it knows that which instance has to handle this slot, so the key will be deterministically sent to a specific node. So, when you look for a key you know where to look for, because you know which slot it should be in, which Redis instance is to ask for. That's how Redis works. Why not do the same thing for Orchard? Why not have Orchard to natively support the sharding/partitioning of nodes? Every Orchard instance could be configured to use the same Redis database with to able to send "Hi" message and everyone will get it using the message bus. When everyone gets the "Hi" message from a new instance joining the node then they can send the "Meet" message. Then everyone will know about every other instance on a cluster. By doing that we can decide (once a tenant is created or activated) which node will handle that using the same logic as the hash. They can communicate directly using REST APIs to say: "Please enable this tenant" and the other node will enable the tenant. So, each node is an Orchard Core application with the Orchard Cluster module enabled. It works like the Tenants module and allows to communicate with other nodes. When a new node is created, it can join to a cluster by connecting to a common Redis database (no need for custom cluster name for simplification). When a node joins a cluster, it sends a "HI" message for all other nodes to be informed of the newly added node (including the address it can be contacted at). They then respond with a "MEET" message (including the address they can be contacted at). About the Proxying: Each default tenant is able to forward the request to the correct node (relay mode). Generate a routing table each time a new tenant is added. Use a deterministic distribution. Use alphabetical distribution (from domain, or tenant name). Be able to configure the hashing logic on the proxy. Build a custom proxy module that is used as the reverse proxy. Should be able to download the routing file for any node, every minute. If the map is out of date, the relay will be used until the routing table is refreshed (HAProxy can do that https://www.haproxy.com/blog/web-application-name-to-backend-mapping-in-haproxy/) The default tenants need to be able to provide the routing table from an HTTP request. Custom modules can implement the routing table in custom formats (HAProxy). Test the new tenant APIs using GraphQL The ShouldListAllBlogs() method in BlogPostTests.cs calles BlogContext.InitializeBlogAsync(). The BlogContext is inheriting from SiteContext and calling some GraphQL APIs to build something, like add a field to the blog. In the SiteContext.cs you can find a line: Site = new OrchardTestFixture<SiteStartup>(); By doing that it's creating a new instance of Orchard running this SiteStartup. We have the OrchardCore.Cms.Web.csproj that contains one startup, that just says app.UseOrchardCore() and app.AddOrchardCore(). This Startup is a same thing, but instead of being a csproj, it's hosted dynamically by this code. The Unit Test will start the site represented by this startup. This SiteStartup.cs says AddOrchardCms() and UseOrchardCore(), like in any other Orchard app. But this one will use the lambda that we provide to configure the Orchard Core instance and add custom features. This Orchard Core instance will enable the OrchardCore.Tenants and OrchardCore.Apis.GraphQL features, because the goal of this test is to check that GraphQL works. For that we need to get some APIs which are in the OrchardCore.Tenants feature. Here we also registering a custom authorization handler, which will just say anyone who needs some permission, we will grant it. It's not testing the permission pipeline, just testing the GraphQL feature itself. The Unit Test will launch the main Orchard app host and then create a tenant dynamically by calling into an HTTP REST API to create a tenant (api/tenants/create) and to set up a tenant (api/tenants/setup). Demos API endpoints to create/setup tenants and manipulate contents and using Orchard Core's authentication server Set up a site with the Software as a Service recipe that allows you to setup your site with additional preconfigured options, features and settings out of the box. By making a POST request to the api/tenants/create endpoint you can create a tenant. Let's see the following URL: https://localhost:44300/api/tenants/create?Name=Blog2&RequestUrlPrefix=blog2 Here you can pass the Name and the RequestUrlPrefix in the query string. To setup a tenant you will need more parameters. The Name, the SiteName, the DatabaseProvider, the UserName, the Email, the Password and the RecipeName. By using for example Postman you can create a tenant by making a POST request to a HTTP endpoint. You can also get, create or delete content. You can pass draft=true that creates or replaces an existing draft. Without passing the draft, it will create a published version of the content item. If we don't have the OpenID Token Validation and the OpenID Authorization Server features enabled we will not able to call APIs even the ones that allow anonymous users. After you need to set up the authorization server by navigating to OpenID Connect -> Settings -> Authorization server. Here you need to put a tick to the Enable Authorization Endpoint and Allow Implicit Flow checkboxes. Don't forget to select an authorization server tenant under the Token validation menu. Then under the Management -> Applications you need to add a new application. Let it be Postman with a public client type. We also need to tick the Allow Implicit Flow checkbox here and don't forget to set up Redirect Uris and the type of the consent. After that you can get a new access token using Postman. Here we need an OAuth 2.0 typed token which we will send in the request header. When we get a new access token, we should provide the values of our Authorization server here. Now you will have an access token that you can use to validate yourself when using the APIs. Display modes The general idea is to add a Display Mode in fields settings and to be able to add settings on them that you can see in this issue. With the help of the Display Mode we can define which way we should render a content. Let say we could have a display mode for text field like the field editor views. If we go to the content definition of a text field the new is the 'What type of display mode should be used?'. For example, if I want a header display mode, it asks the header type. Let's select one and check the display of this field on the front end. It will allow a lot of new possible options: For most display modes Liquid : Templates to display the field, may be allow to access to other field values. Summary/Details: Depend of the kind of shape. Zone/Position: Send the display to a specific zone and position. Text Field Truncate: Number of characters/words. Meta: Add it to the Head resources. Syntax Highlight: Select in which language. Translate Date, Time Fields Format Time ago Markup Timezone Numeric Field Money format Currency Boolean Field Labels depending on boolean value Media Field Carousel LightBox We just scratched the surface of the topics that the community had this week. If you are interested in the whole conversation, don't forget to head to YouTube for the recording of the current podcast!

This week in Orchard - 10/19/2018

In the current post we would like to summarize you the latest amazing demos around Orchard Core! On Orchard Core Demos File Content Definition Feature How to handle content type definitions when you have multiple people working on the same project? The fact that when you create a content type and when you are on the deployment, you have to copy the database on all the dev machines. Or even if one dev adds a content type you have to share the database or create new recipes and rerun the recipe. A good solution could be to use a file to store the content type definitions. The nice thing with a file is that you can put it in a repository and then when you update it just update all the content definitions that in the file. For that there is a new notion in the OrchardCore.ContentManagement module: IContentDefinitionStore. The IContentDefinitionManager lets you list types/parts and updates them. The new IContentDefinitionStore interface actually stores the content definition with the LoadContentDefinitionAsync and SaveContentDefinitionAsync methods. The default implementation called DatabaseContentDefinitionStore that uses YesSql to store the document. Now there is a new one called FileContentDefinitionStore, which will read and store a JSON file. So instead of using a database, this JSON document will put in a file. This is defined as a new default feature in the OrchardCore.Contents module and the FileContentDefinition is also in a separated feature. You can find the ContentDefinition.json file in the App_Data/Sites/Default folder with the following content: Here we added a new content type, for example MyContentType and adding a new TextField to it, we will see the ContentDefinition.json updated with the definition of this content type. It's because in the modules we enabled the module called File Content Definition that stores content definition in a local file. You can test this new feature in the dev branch of Orchard Core. Taxonomies leaf support First don't forget to enable the Taxonomies module. Then let's create a new content type, called Color. The Color only just has a Title. Now create new Taxonomy under the New menu. Let's add a name Colors and select Color as the Term Content Type. Now here we can add new Colors. Now add a Taxonomy Field to a content type. In our example we added a new Taxonomy Field called Colors to the Article content type. Here you can see a checkbox with label: Check if only the leaves of the taxonomy can be selected. Let's put a tick here. Now let's create a new Article with some selected colors. For example, select the Dark Blue and Light Red values. Now open the YesSql database of our site. In the TaxonomyIndex table you can see two new rows. These two records are for the two selected terms. What we have here is the TaxonomyContentItemId, that is the ID of the Colors taxonomy. The ContentItemId is the Article content item ID. The TermContentItemId is the ID of the term that is selected. Now we can query taxonomy elements and this schema could make it very easy to do that: you can query and filter by specific content parts, content types, content fields and so on. There are some Razor extensions in the TaxonomyOrchardHelperExtensions.cs file: get the taxonomy term by its ID, get inherited terms by their ID and to query the taxonomy index directly. You could find the improvement in the branch called taxonomies. Using a workflow to make the Contact Us form of the Agency theme dynamic The Contact Us form of the Agency theme doesn't do anything, it's just had a frontend to show how to design a form like this. Antoine Griffard decided to make it dynamic by using a workflow. He used an Http Request event with a HTTP POST method as the starting activity of the workflow called Contact Form Submitted. Here you can see the full workflow. Don't forget to watch the recording of the latest Orchard Podcast for the full demos!

This week in Orchard - 10/12/2018

In the current post we would like to summarize you the latest amazing demos about the brand new Orchard Core features! On Orchard Core Demos The Admin Trees module Matias Molleja has been working on the content tree feature. Now it's the admin menu for everything that can be configured, including content of course. With the Admin Trees module, you can build custom admin menus. After enable the module you can reach the Admin Trees by going to Configuration -> Admin Trees. You can add a new Admin Tree, call it like Content Items and lists. After that you can add nodes to it. Now we only have three types of nodes (Link Tree Node, Content Types, Lists), but any module can subscribe and add its own nodes. If you add a Link Tree Node, you can define the Link Text as it will be shown in the tree (let it be My Content Items), the URL of the link and CSS classes, if needed. Now you will have a new menu item, with text My Content Items. You can add different nodes to this menu, like a Content Types node. After that you will see that every content type that you have selected will be shown in the menu. If you want to place the list of the content types under the My Content Items menu, you can just simply pull the Content Types node to the right and without reloading the page, the list will be placed under the My Content Items menu. You also have the ability to put submenus under the Content menu. To do that, add a new Link Tree Node, called Content. By having the same name as an existing menu (in our case Content) you can simply put your tree under the Content menu. This module is under development, so you can find the Admin Trees module in this branch. New Workflow Events to manipulate tenants Thanks to Antoine Griffard now you can select between more activities when you are creating a workflow. If you add a new task to your workflow, you will see a new category in the list of available tasks, called Tenant. Here you can select between four difference types of tasks: Create Tenant, Enable Tenant, Disable Tenant, Setup Tenant. By choosing the Create Tenant Task you can provide every important property that needed to create a new tenant, like the Host name, the type of the database etc. You can specify these values by Liquid, so the Name of the tenant to create could be: {{ Request.Form.SiteName }} In the following workflow, we will create a new tenant when posting to a URL provided by a HTTP Request Event. To call the starting Http Request Event of the workflow, we need to post to a given URL. To do that, you can just create a new page and add a new Form to that. Here you can specify the URL to submit the form to, that will be our URL copied from the Http Request Event. By adding input widgets to our form, we can provide an interface to the user to set the values of the new tenant. Here you can add an Input with a SiteName name that we used previously in our Create Tenant Task. This module is under development, so you can find the new activities in this branch. One of the goals of this module is to be able to do a workflow, where users can create and set up a tenant. Don't forget to check out the recording of this week's Orchard Podcast for the full demos! There you can also watch short presentations about the improvements of the Taxonomies module (Sébastien redid the module, but for now by not using the BagParts.) and the impored queries using a full Query DSL.

This week in Orchard - 10/5/2018

In the current post we would like to suggest you some nice posts about Orchard Core and show you the improvements of the Predefined list editor of Orchard Core! On Orchard Core I think we don't need to introduce David Hayden to the Orchard community. David Hayden is primarily a C#, .NET and Orchard CMS Developer with 20 years experience developing ASP.NET Websites and related technologies. David is passionate about Orchard CMS. He's been developing Orchard Themes, Modules, and Websites since it was first released. He has contributed bug fixes and enhancement to several versions of Orchard and has published modules in the Orchard Gallery. He attended the first Harvest Orchard Developer Conference and has created over 100 Orchard Themes and 300+ Orchard Modules. David is currently primarily focusing on .NET Core, Orchard Core, and Orchard Core CMS for building modular, multi-tenant web applications and websites. He also published several articles about Orchard Core to his blog. Let's see some of the newest ones! Using the Content Picker in Liquid Templates in Orchard Core CMS The Content Picker was recently released for Orchard Core. In this post David shares a tip on how to use the content picker in a Liquid template. Bootstrap 4 Carousel Widget for Orchard Core CMS A nice post about developing a Carousel Widget using a BagPart and Liquid templates. Dynamic Theme Selection in Orchard Core CMS In Orchard Core you have the ability to preview the website using a different theme during the active session without changing the current theme on the site. This post is about creating a module that allows an administrator to change the current theme for they session by passing in the name of the theme using a query string parameter. If you would like to read more exciting blog posts about Orchard and Orchard Core, don't forget to check out Orchard Blogs: the heartbeat of the Orchard CMS community: blog posts from Orchard-related blogs, scraped automatically. Created by Lombiq. Demos Predefined list editor improvements Last week you could see a demo about the Predefined list, a new editor for the Text Field. There we mentioned that the Options textarea of the editor, you can predefine the allowed values using JSON. Setting the options by using JSON is not the best solution, so in the future we could define the available options as you can do it in Craft CMS. The future is here, now you will have a nice Vue.js editor to provide the values thanks to Jasmin Savard! Let's say we have a Project content type with a Text Field called Category and this Category has a Predefined List editor type. Here you can also select between drop down list and radio buttons. In the left screen you could see the editor of the Category Text Field when you have predefined the drop down list and in the right screen you could see the Category when you selected the radion buttons option. This feature is still under development, so you need the skypt/options-editor branch to have these changes. You can watch the whole demo in the recording of this week's Orchard meeting! On Lombiq Orchard Dojo Newsletter Now we have 25 subscribers of the Lombiq's Orchard Dojo Newsletter! 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 every time when a new post published to Orchard Dojo, including 'This week in Orchard' of course. Do you know of other Orchard enthusiast who you think would like to read our weekly articles? Tell them to subscribe here!

This week in Orchard - 9/28/2018

Check out our current post for a 2-hour long demo about how to add a new SaaS module for Orchard Core! On Orchard 1.x Styling the Orchard Tag Cloud so it looks like a cloud, not a list Robert Wray published a new post to his site about styling the Orchard Tag Cloud so it looks like a cloud, not a list. On Orchard Core Demos Predefined list, a new editor for the Text Field Now if you add a new Text Field to a content type, you have the option to choose the Predefined List type for the editor. In the Options textarea, you can predefine the allowed values using JSON. In this example we added a new Text Field to Article that has a Predefined List-typed editor. On the editor page of the Article content type you could see the Category Text Field that has the predefined options. It's a radio, but you can also choose the display to use a dropdown. See that we have one option with no value. We also haven't provided anything for the Default value. Setting the options by using JSON is not the best solution, so in the future we could define the available options as you can do it in Craft CMS. You can watch this demo and many other improvements in the recording of the latest Orchard Podcast! Implementing a SaaS module in Orchard Core Last Friday Sébastien showed us how to implement a SaaS module in Orchard Core. In the next few lines we would like to give you a short recap based on the 2-hour long video, that you can also find on YouTube! The concept The goal is to create a simple vertical application with a dedicated recipe. Take a look at Fabrik.io! Here the users can register and after a simple registration they can create their own sites (like in the case of DotNest as well). So the first step is to design the process how users can manage their profiles. This workflow could be a good one: User goes on the front page. User enters his/her information. User receives an email, and clicks the link to confirm the email address. User is registered in the default tenant. The site is created, and an email is sent with the URL of the site. We could also add other options for the users, like they could manage their information, profile and payments in the main tenant, on the front-end. In our demo users can enter an email address, the name of the site and a handle. After that they will get an email with a link that will create the site. If they click on the link, Orchard will create the new tenant and redirect the user to there. Create a new module in Orchard Core called OrchardCore.SaaS An easy way to add new module to Orchard Core is just to take an existing one from the OrchardCore.Modules folder and copy all of its content with a folder name that you want to add to your module. Then change the name of the csproj file. After fire up Visual Studio and Add an existing project to the OrchardCore.Modules folder which will be our new renamed project file. But you can also create a new module by adding a new Class Library (.NET Standard)-typed project to the solution. Before building the module don't forget to delete the App_Data folder from the OrchardCore.Cms.Web folder. You also need to reference the new module to the OrchardCore.Cms.Web project. Add a custom recipe to the module Pick an existing recipe and copy it to our module's Recipes folder. In our case the saas.recipe.json would be perfect, because we would like to do something similar. We need to change the name of the recipe (to do not have two recipes with the same name) and enable our module in the line 27 of this recipe. We also set the home page of our new site by setting the HomeRoute option and providing the route of the selected action. Implementation The heart and soul of our module is the HomeController. Here we have the RegisterUserViewModel to get the SiteName, the Handle and the Email from the user. If the ModelState is valid, we need to create a new instance of the ShellSettings. Here you have to provide the name, the connection string, the database provider and many other options. As you can see here we set a new tenant with the SQLite database and with the Blog recipe. The confirmation link in the email will contain every data that the user provided in the home page. For this don't forget to set up the SMTP settings. When the user clicks on the link in the email the Confirm action will take in place. Here we have to create a new SetupContext based on the information from the email, get the ShellSettings and pass this SetupContext to the SetupService to set up the site. You can see that for the sake of simplicity we are using hard-coded values for the username and password of the admin user. If everything go fine here, we redirect the user to the newly created site by using the value of the handle. We implemented this module based on Sébastien's demo and uploaded it to a GitHub repository, so feel free to explore the whole codebase of this project!