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

Blazor guide for decoupled CMS, Workflow Trimming Task - This week in Orchard (06/09/2024)

Blazor guide for decoupled CMS, a new Workflow Trimming Task, and our renewed Orchard Dojo website are the topics for this week. You can still cast your votes for the Jean-Thierry Kéchichian Community Award! Only one week left until the Orchard Harvest conference! Let's see the news for this week!

Featured tags

IIS
API
All tags >

Lombiq .NET Analyzers, Shortcodes feature merged - This week in Orchard (04/09/2020)

We have mentioned the Shortcodes feature several times and now it's available in the preview packages of Orchard Core. We will also show a demo about how you can use our .NET Analyzers in your Orchard Core solution. Check out our post for more! Orchard Core updates Tabs syntax changed in the documentation Orchard Core documentation contains code samples both in Liquid and Razor languages. You can see the given code samples in tabs near each other. If you want to change between them you just need to click on the Razor or the Liquid tab to see the snippets. Now, if you would like to improve the documentation and put some snippet there too, you have to use a new syntax in Markdown. In the screen below you can see the old one in red, and the new one in green. Thank you for making the documentation better and better! Media root folder selected by default If you navigated to the dashboard of Orchard Core and opened the Media Library (Content -> Media Library) you may found that the images in the root folder were not available on the list on the right. The workaround was to create a new folder to see the files in the root. Now, this issue is fixed, the media root folder is selected by default and you are able to see the content in the media library without any workarounds. New icons for User Disabled and Enabled events A small UI change here. When you add a new User Disabled or User Enabled event to your workflow you will find new icons here. These icons are also used when you are working on your events on the kanban board of your workflows. Shortcodes feature merged Shortcodes are small pieces of code wrapped into [brackets] that can add some behavior to content editors, like embedding media files. The Image Shortcode can be used to display an image from the media library in your WYSIWYG editors. The simplest way to use that Shortcode is the following: . And the good news is that now you can find the Shortcodes and the Shortcode Template features in the preview packages of Orchard Core! In case if you missed you can find two videos on YouTube about Shortcodes: check out this one first, then watch this video for the second part of the demo! We also mentioned these features in This week in Orchard too several times. Check out this for an introduction, then this one for the first demo, finally don't forget to read this post to see the improvements of the Shortcodes! And the documentation is available in this URL! Update configuration documentation The documentation now contains more lines to explain how to read a configuration from an external config file, that you can use in your Startup class. Click here to see the updated page! New workflow task to validate user There is a new Validate User Task to check if the user exists for the current request and has the specified role(s). This task has three outcomes: InRole: if the user in the current request has at least one of the selected roles. Anonymous: if the user in the current request is anonymous. Authenticated: if the user in the current request is authenticated If you check the Set the 'UserName' workflow property if the user is authenticated checkbox, the username of the current user will be added to the Properties dictionary of the WorkflowExecutionContext that you can use in the upcoming tasks. Demos Lombiq .NET Analyzers Our Lombiq .NET Analyzers repository contains .NET code analyzers and code convention settings for Lombiq projects. We use these to enforce common standards across all our .NET projects, including e.g. in all of our open-source Orchard Core extensions. If you contribute to our open-source projects while using that solution you'll be guided by these rules too. There is a built-in code analyzer in Visual Studio, but there is a lot of other analyzer projects out there. These analyzers can find issues in your code, but this is about to extend that and try to find even more issues. The Readme.md file in the repository tells you how you can add these files to your solution in just two quick steps! Now let's see a simple example of this! Let's imagine that you have an interface with a method that represents an asynchronous operation. After we created our great interface with the method you will notice that the IDE complains about some stuff. First of all, we have an interface and a method in it with no documentation. The DoSomethingGreat method is an async method, so the correct name of the method would be DoSomethingGreatAsync. Pretty cool, right? But that's not all! Head to YouTube to see the full demo about Lombiq .NET Analyzers! News from the community Extending event handlers sample in the Lombiq Training Demo for Orchard Core Orchard Core Training Demo module is a demo Orchard Core module for training purposes guiding you to become an Orchard developer. You can use this module as part of a vanilla Orchard Core source that including the full source code - which is the recommended way. You can use it as part of a solution the uses Orchard Core NuGet packages, however, it's harder to look under the hood of Orchard Core features. The latest update of the module is about to show you how you can extend Orchard Core with event handlers. The LoginGreeting class is about to implement the ILoginFormEvent interface and shows a notification to the user after a successful login. Check out the code here! Orchard Core workshops The contributors of Orchard Core will hold some unique online workshops in September 2020. So even with Orchard Harvest postponed due to the coronavirus pandemic we'll get some new learning events. Are you looking to get up to speed with Orchard? Check out the workshops' details on the Orchard Core homepage! Orchard Dojo Newsletter Now we have 160 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 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!

Shortcodes, Audit Trail - This week in Orchard (31/07/2020)

This week we show you two demos of the brand new upcoming features of Orchard Core! The first one is the Shortcodes feature, that allows text content editors to inject specialized content blocks using custom arguments, like images, twitter embeds, youtube videos, only with simple blocks like [video 123]. The Audit Trail module provides log records for creation, deletion of any Content Type, and events like user events, as you may see it Orchard 1.x. Heads up for a post full of demos! Orchard Core updates Add user deleted event In the OrchardCore.Users.Handlers.IUserEventHandler there was no contract for the user deleted event. From now there is the new DeletedAsync method that is invoked if a user has been deleted. Check out the code in the UserStore.cs file, where you can see the invoking of the new method. This new event is also accessible from your workflow type. If you create a new workflow type and click on the Add Event button, you will find the User Deleted event in the User category. Admin CSS/Bootstrap regressions Back in Bootstrap 3, col-lg means nothing, so we had some special CSS in the admin theme to make it mean something. In Bootstrap 4, the col-* now means something, because here you have auto-sizing columns. It's still not exactly ideal because there is a lot of variation for the sizes. You can see the new names here to make them more meaningful. These are the new classes in the TheAdmin.scss file. Demos Shortcodes Sébastien Ros created a new open-source project called Shortcodes. This is a .NET library to parse and evaluate shortcodes. It allows text content editors to inject specialized content blocks using custom arguments, like images, twitter embeds, youtube videos, only with simple blocks like [video 123]. Shortcodes are essential to WordPress, and for the Orchard Core, we wanted a similar feature. The parser was written by hand as the syntax is simple and it needs to be efficient. Thanks to Dean Marcussen, this library will be integrated into Orchard Core soon. In this demo, we will see what we can do in Orchard Core using that library! Let's say you installed your site using the Blog recipe. Make sure that the Shortcodes feature is enabled. When you are editing a content item with a WYSIWYG HTML editor (for example the HtmlBody Part of the Article content type or a content type with a MarkdownBody Part) you can get a little pop-up if you are clicking on the Insert Shortcode button near the Link button by default. The pop-up will contain a list of the available shortcodes. Let's try the one called bold now. As you may guess, this shortcode is about to make your text bold. Select it from the list and provide the text that you would like to appear as bold. Note that here we used the [bold "bold text"] syntax when made the text bold. That works, because if you check the definition of the bold shortcode, you could see that we get the value of the text using the args.NamedOrDefault method. If we don't use the text named argument to pass the value of the content that we want to make bold, then it will just simply use the default one, meaning that it will use the content without any argument. So, if you are using the syntax [bold text="bold text"] you will get the same result. But the bold shortcode is also supporting content arguments. It means shortcodes using opening and closing tags can access their inner content. If you would like to use content arguments you can do something like [bold]bold text[/bold]. It will work because if the value of the text is null we will just use the value of the content variable that is the text between the opening and closing tags. Now let's see something else! If you navigate to Design in the admin UI, you will find a new option called Shortcode Templates! Let's see what a Shortcode Template is! Here you have the ability to actually write shortcodes in Liquid. Create a new one and call it Primary! This is about checking if your shortcode has something in the argument called text. If yes, we use the value of the text argument, if not, we are about to work with the content argument. The shortcode wraps the text in a span and adds the text-primary class to it. In this case, you can use this shortcode as you could see in the case of the shortcode called bold. But you also have the option to override the shortcodes that are implemented from code. In that case, you just need to call your shortcode template bold, and that will replace the existing one that has been written in code. If you would like to know more about shortcodes, don't forget to check out the demo on YouTube! Audit Trail Let's install your site using the Blog recipe. Then head to Configuration -> Features and enable the Audit Trail module. After you will see a new option in the menu of the admin UI called Audit Trail. The Audit Trail module provides log records for creation, deletion of any content type, and events like user events. So, let's do some content modification to see how you can use the Audit Trail feature! Navigate to New -> Article and publish a new Article content item with some data. Now edit some data in your newly created article and hit Publish again! Now navigate to the Audit Trail option on the menu and see the new records in the table. The audit trail table provides you with filtering and with pagination to be able to easily find the audit trail event that you are looking for. You can filter by a given date range, categories (All categories, Content Item, User), the user name of the user who caused the event to occur. Every record of the table can have a view in the Summary column. A record with the Content Item category shows you the version of the content item at the moment of recording. If you click on the Version X link you can see the read-only editor of the content item filled with the values that the content item has at that version. If you click on the display text of the content item you can edit the content item. Here you will see four recorded events regarding the changes that we have just made in the case of our article. The first one is about showing you the fact that we created the first version of the Article content type with the display text My new article. The second is about telling you that you clicked on the Publish button, that means you published that article. After you will see a Saved event. If you publish a new version of the article, Orchard Core first saves a new version of it (it also creates a new draft version), then publishes it. You can also see that now we have two different kinds of versions of this article. Now let's see what we have just changed in that article. To do that, click on the Details link of the Saved event. Here you can get more information about the given event. When you are checking the Detail view of a Content Item event you can see a table that contains the differences between the current version of the content item and the previous version of the content item in the Diff column. The values of the current content item will be shown in green, and the values of the previous content item will be shown here in red. You can show/hide this column using the Show diff switch. If you turn the Show before/after switch on, you will see two new columns: Before and After. These are about to show you the values of the properties of the previous version of the content item and the values of the properties of the current version of the content item. Here you can see we changed the Subtitle Text Field and the Html value of the HtmlBody Part of the article. If you navigate back to the audit trail table and check out the first Published event of the article content item, you will also see a new link here called Restore. If you click on this link, Orchard Core will create a new draft instance of the selected content item version. You can also restore the removed content items too. You can attach the AuditTrailPart content part to your content type that allows content editors to enter a comment to be saved into the audit trail event when saving a content item. This comment will be shown in the Comment column of the audit trail table. If you navigate to Configuration -> Settings -> Audit Trail you will find a list that contains every event that can you record using the Audit Trail module. Here you can enable or disable the recording of the given events. You can also enable client IP address logging. When you enable that, the client IP address will be recorded in audit trail event records. If you click on the Set blacklisted content types button you will see a new modal window with all of the defined content types in your system. Here you can select the content types that you don't want to log using the Audit Trail. For example, if you don't want to log the changes of the Article content items, then you may put a tick of the checkbox of the Article content type. The Trimming Settings is about to say how long you would like to keep the audit trail logs in the database. You can disable trimming if you would like to keep the records. And that's not the whole demo! If you are interested in the upcoming Audit Trail feature of Orchard Core, head to YouTube and check out the recording! News from the community A new website using Orchard Core Singapore is the third international country outside North America to introduce Starbucks to its discerning customers who readily embrace the Starbucks Experience. And they used Orchard Core to build the website for Starbucks Singapore! 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 Core workshops The contributors of Orchard Core will hold some unique online workshops in September 2020. So even with Orchard Harvest postponed due to the coronavirus pandemic we'll get some new learning events. Are you looking to get up to speed with Orchard? Check out the workshops' details on the Orchard Core homepage! Orchard Dojo Newsletter Now we have 154 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 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!

User disabled/enabled events, filter admin menu - This week in Orchard (07/02/2020)

Orchard Core has got several new features and fixes this week! With many others, we will see the new user disabled/enabled events, the new IAreaControllerRouteMapper implementation, the way how you can filter the admin menu then show you a demo about how to integrate stripe.js in your Orchard Core application with workflows. And finally, say some words about a new tentative date and location for the upcoming Harvest! Orchard Core updates Reduce the length of indexes for Content Fields Indexing Let's focus on the LinkFieldIndex and check these two columns: the Url and the BigUrl. The Url is the one that is trimmed and indexed, and the BigUrl is the original data that is not indexed. If you are using MySQL, the maximum length that this provider can support in an index under UTF8 collection is 768. Now we set the maximum length of the indexed columns is to not be longer than the supported length. Do not check "Include all content types" in deployment step by default When you create a content type deployment step, the default is to export all types. Now, this is unchecked by default. Adding User Disabled/Enabled Events The IUserCreatedEventHandler is changed to IUserEventHandler and there are two new events: DisabledAsync and EnabledAsync events. These two new events now triggered in the UserDisplayDriver that will trigger the two newly created workflow events to make it work in your workflows. Adding IAreaControllerRouteMapper Now there is an updated way how the admin prefix is applied by using custom convention and constraint that will ensure that the admin URLs start with the admin prefix. And also ensure that it is done correctly for the controllers that are named AdminController, not the ones that start with admin. Before every controller that starts with admin could be an admin controller, but now with this new convention, it has been decided that only controllers named AdminController can be an admin controller. For example, a controller named AdminItemController doesn't fall into this category, so it can't be an admin controller. A concrete implementation being AdminAreaControllerRouteMapper that uses AdminOptions to provide a default route pattern that is used in the OrchardCore.MVC startup. Just as a reminder, if you have admin controllers you have to name them AdminController or have the Admin attribute on that. This will ensure that the URL is strictly using the admin prefix (or whatever you set it), and the user has the admin permission and this will also apply the admin theme to the views from this controller. Filter admin menu Head to Configuration -> Settings -> Admin and put a tick near the Enable Admin Menu filter checkbox. Now you will have a new textbox at the top of the admin menu with a Filter placeholder text inside it. If you type something here you can filter the menu items and could find easier the option you want. And if you hit CTRL+SHIFT+F, this textbox will get the focus and you can type the menu option that you are looking for without needing to click into this textbox. Add menus content listing and create option If you navigate to the Content option of the admin menu you will find a new one, called Menus. This feature is listing all the menus of the system, and if you can see, there is a new button, called New Menu. By clicking on this button you can create a new Menu without needed the Menu content type to be creatable. Make lists sortable with ordering setting A few weeks ago we write about a way how you can make sortable lists using the Enable Ordering setting of the ListPart and you can also find a demo on YouTube about this feature. The good news is this feature is now merged to the dev branch of Orchard Core! Checkout to the latest changeset of the dev branch and try this feature now. Then don't forget to tell your opinion about it in the comments section! Razor Helpers documentation Now there is a new page in the Orchard Core documentation that contains the extension methods that are available in Razor using @Orchard. This documentation also contains the way how to use an extension method in a view and in a controller too. Demos Stripe.js and Workflows You can use Stripe.js’ APIs to tokenize customer information, collect sensitive card data using customizable Stripe Elements, and accept payments with browser payment APIs like Apple Pay and the Payment Request API. And of course, you can add Stripe.js to your Orchard Core site too! Let's create a registration form where users can register and after successful registration, they can pay the fee for a ticket. After the user submits the form, here comes a huge workflow, that will validate all the fields of the form. Here you can see the several validations, and when there is no error, the workflow will send an email, create an Enrollment in Orchard Core and redirect the user to stripe using a Fork. And there will be another workflow that will validate the payment using the response that Orchard Core will get from stripe.js. Now let's take a closer look at the Create Content Task that creates a new Enrollment content type. When you are creating a new content type using this task, you have to write the properties of the content. This is the JSON that is used to construct the given content item. As you can see, here you can use different Liquid expressions as well, for example, we could use the data coming from the form. You can see the website using this registration form under this URL. Here just click on the Register at the top right and select from the listed options. If you would like to see the whole demo just head to YouTube and watch the recording! News from the community A new tentative date and location for the next Harvest We have another tentative date for the next Harvest: the last week of June. In this date, we could do it in Europe and in a location that is easier to go from the USA too. London and Amsterdam have airports that can be reached easily from several other countries as well. What do you think about the new date and locations? Orchard Dojo Newsletter Now we have 114 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 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!

Useful and interesting services to enhance your features - Dojo Course

UPDATE (2017-11-22): Dojo Course 2 is released with new, updated videos! Dojo Course is almost over, so we move on to the spicy parts of the Orchard API that enable you to do really interesting things! An in-depth recap on what we did so far in our PersonList feature. Content querying: using Orchard's LINQ-like API, the IContentManager service to retreive content pieces (including usage and optimization points). How to integrate your features into the administration menu? Running code periodically using background tasks. Running code at a specified time using scheduled tasks. Creating system-wide event handlers to be able to communicate with other pieces of logic in an even more loosely tied way. And a little addition to migrations: you can implement an Uninstall method in your Migrations class to add some logic which will run when your feature is being removed from a system (hopefully nobody will use it ;) ). Stay tuned for the (really) last part of the Dojo Course before Christmas! Remember: if you have any questions don't hesitate to ask them by creating a new issue in the Orchard issue tracker with the "discussion" label. Make sure to prefix your thread's title with "Dojo Course - "! We keep an eye on these issues. Also follow us on Twitter to get notified about the latest Dojo Course news, including when a new tutorial is posted. Do you have some feedback about the course? Please send it in.