Where does Orchard CMS stored content definition? - orchardcms

I am fairly new to Orchard CMS.
I am going through how a module is created an got a question.
According to the documentation, content definition could be created in two ways:
use admin content definition page
create module project in visual studio
is there any difference?
I created a test content definition and try to find it in the SQL compact database. I can't seem to find it.
Anyone know where that info is stored?
Thanks

You can find the content definition in the following tables in the Orchard database:
Settings_ContentFieldDefinitionRecord
Settings_ContentPartDefinitionRecord
Settings_ContentPartFieldDefinitionRecord
Settings_ContentTypeDefinitionRecord
Settings_ContentTypePartDefinitionRecord
The admin interface uses the same APIs that are used when defining content definition from code, so it's basically the same thing. I tend to define content definition in migrations, as that's the best way to ensure that content definition changes are properly applied on all instances of the application (the migrations automatically run during application startup). The admin interface is intended for users who do not have access to the source code (ex. administrators, not developers).

Related

What is the Recommended Approach for Hosting Transformations when creating a Custom Module?

In Kentico 11, in a custom module you are developing, when using a custom Page Template (portal mode) for the UI Element, where is the appropriate place to host Transformations used by web parts of that template? "Appropriate" meaning the transformations can be bundled with the module for import/export operations or at least grouped with it logically in Kentico admin?
The Kentico Custom Module app doesn't contain a Transformations tab for its Classes.
Repeater web parts used on the UI page template only list Custom Tables and Page Types when looking for transformations. Transformation doesn't seem to be supported for a Custom Class.
I could create a standalone container Page Type to host all transformations for the module, however this would be outside the module. These transformations would use data from Classes in the module (through repeater web parts and query data sources for example). It seems odd to put them outside so I am suspicious of doing this.
Up until now I've only used the out-of-box tab and listing web parts to create custom modules. Now I need to get into more customization, and prefer the portal mode to easily build templates using web parts. Transformations seem to be the missing consideration in this development flow.
Neither can I find Transformations mentioned in the Custom Module documentation. Kentico Documentation I'm referencing is:
Creating custom modules
Manually creating the interface for custom modules
Martin Hejtmanek's Module development articles like this one
I can find a place to put my transformations. I'm looking for thoughts about where to best put them and bundle them with my custom module work.
Your findings are a shortcoming in the module documentation. The documentation talks in great detail on how to build the module and display it within the Kentico UI but talks little to none on how to display that content outside of Kentico on the public facing website.
What you mentioned, using a custom Page Type as a container is a simple easy approach and I believe you can bundle this with your module. Yes it doesn't make sense but using this approach will allow you to have your custom queries to access the module data and display options (transformations).
You have another option to create custom webparts for this and package them with your module but I'd recommend against this because it takes away from the basic usage of Kentico and will require code maintenance and modifications for simple changes.
If you look at page types you will see that Kentico does the custom page types to hold transformations. They have ones like RSS Transformations, E-Commerce Transformations, etc.
That is the way I have always done it also.
I suggest you to take a look at the custom table module as example, i.e. user interface part of it: there is transformation menu item under edit custom table in the interface. Take a look on how it is done and try to clone/modify it for your own custom module. If you check the DB: cms_transformation table has TransformationClassID field. So transformation is attachable to a class - so you custom classes can have transformations attached. Honestly i've never done it, but this is the way how I would approach. I would keep apples with apples, oranges with oranges... yeah sure you can always create "container page type" and it will work, but i would play around with the custom module. You might need to create and extender in this case.
#John,
As per Brenden post, you can achieve this using custom web part with your custom logic.
Refer below URL:
https://docs.kentico.com/k10/developing-websites/defining-website-content-structure

Automatic way of export / import pages from liferay

I have created portlets for liferay and prepare couple of pages. Now I want to create installation script, which create pages definition in customer liferay server. I know that pages export/import is possible using LAR file, but this could be done only manualy, or using remote publishing which i am not able to do.
I was searching on net and found ddm tool. Which should be able to do that. Unfortunately i'm not able to get it work as it export only web content, blogs, wikis, etc, but not pages with portlets. It is probably because one of the condition is "Every Template must be assigned to a Structure. Don't create any templates on the Liferay server which does not have a structure connected to it.
". But how can I assign page to structure ? Cant find anything.
Or is there any other option for automatic page creation, which could be used ?
In case you created a custom theme, you can easily use the "resources importer" to create an entire site via the "sitemap.json" file (define pages: choose layout, assign portlets to the columns, ...). You can also export existing content as xml from the current instance and import them via the theme. Same thing for web content structures and templates.
for more details: https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-1/importing-resources-with-your-themes
Unfortunately theme is produced by another supplier, so this solution isn't suitable for me.
at the end i find working solution which consist of following steps:
create plugin hook
in hook setup upgrade process
in the upgrade process create pages with appropriate layout, friendlyUrl, etc. All these is possible to do using liferay api
Don't have enough reputation, so at least two links
https://www.liferay.com/de/web/james.falkner/blog/-/blogs/7cogs-is-dead-long-live-7cogs-
https://github.com/azzazzel/liferay-official-plugins/tree/master/hooks/sevencogs-hook/docroot/WEB-INF/src/com/liferay/sevencogs/hook/upgrade

Liferay create site / page programmatically

I have been using Liferay for work for 2 weeks. I noticed that it's a bit difficult to find good documentation and tutorials.
Until now I created pages from the web portal. After I create them, I drag and drop portlets. I don't really like this approach, I would prefer to use a coding approach. Is there a way to create a website or page programmatically by defining a project as I do to create portlets?
Moreover, I am using Liferay with WebLogic 10.3.6. I want to know where liferay puts pages I created via web-portal on the file system. I suppose that a file, or something similar, is created when I declare a new site on the Liferay web-portal.
Thank you all,
Marco
Yes Liferay has it's Database, all data of any Liferay object is stored in the database and / or on the file system depending on your configuration.
However, one of the functionality of Liferay is to let you create pages / sites through the UI. As documented in the Java Portal Specification and Liferay Server Documents your approach to create pages in an alternative way is possible but it is part of Liferay's Portal Services. You can use Liferay's Service (HTTP REST) API to call the related service. To access those APIs you need to configure your Liferay Server.
In case you want to do programmatically you still need to configure, enable and call those external HTTP services from your code. You should not create Liferay Objects from your own code hosted as an extension inside your Liferay Instance as that will result inconsistency in your Liferay Database / filesystem. (As in case of page creation Liferay creates a set of other related objects in it's database / filesystem.)
In your liferay bundle you will find two plugins of interest.
First is resources-importer-web for which description says
The Resources Importer app allows front-end developers to package web
content, portlet configurations, and layouts together in a theme
without saving it as a compiled .LAR file thereby allowing for greater
flexibility in its usage between Liferay Portal versions.This app will automatically create associated content when other
plugins are deployed that are configured to make use of the Resource
Importer app.This app installs as a Liferay service.
Second is welcome-theme which declares resources to be created by resources-importer-web. This on should be example how to create your own. Take a look at
welcome-theme\WEB-INF\src\resources-importer\*
welcome-theme\WEB-INF\liferay-plugin-package.properties
This feature is described at importing-resources-with-themes
As mentioned by gabor_the_kid, Liferay stores all objects in its tables. For example, User related objects would be in user table. Liferay exposed services or API's to change the default/to add new behaviors by program but not easier than achieving it through UI. Also maintenance should be considered for going program way of creating pages or layouts etc.
You can describe your changes using xml and use the Liferay Portal DB Setup core to create the changes in DB.
The library defines the list of available xml configurations.

Which is the better approach in custom pages?

I want to create a custom new item page for sharepoint but there are two approached that I
can use and I want to share your experience in determining which is better.
The first: is to create a page in a library then create a C# library project to handle
the events of the controls on the page.
The second: is to define a feature of the content type of my list and specify the new
item form to be my custom form, then create a website containing the custom form and put
this site at the layouts folder.
for me the first approach is fine but the problem is that a user may access the default
sharepoint new item form which I don't want to happen.
but I don't like the idea of placing the form in a library on the site.
so which is better in your opinion ?
thanks
i suggest you to go with your second approach ...
Create a completely new feature that allows you add your functionalty of page creation and any customization realted to that and deploy this one to the 12 hive features folder as a new feature and every time you want have such a page created you can you this template and create the page...
Well, frankly, I'm confused by both of your suggestions.
I don't see how the first one would ever work.
And the second one; you don't "put sites in the layouts folder".
Here's what I would suggest you to do:
Download and install the WSS Extensions for Visual Studio.
Create a List Definition using these new templates.
Copy the NewForm.aspx from the 12 hive and Customize it.
Download and install the WSP Builder from Codeplex.com
Add your custom list definitions and files to a new Feature project in WSP Builder.
Package the Feature up to a .wsp using WSP Builder and you are good to go.
Your custom page(s) should be placed in your custom folders in my opinion.
Hope this helps.
Your concern in the first approach is that people will still be able to access the default form. If you are not opposed to using a custom control template for a content type definition, I recommend creating a very simple redirect control template and assigning it to the content type's "New Form". Such a control template need only contain one custom control, which has an OnInit or OnLoad method that contains little more than a Page.Response.Redirect call. Make that redirect point to the page you create in your first approach, and now whenever anyone tries to access the default new form for that content type, they will instead be directed to your custom page with all of your custom code. It is perhaps a bit of a hack, but it's definitely functional.

SharePoint 2007 Site Template Content Types

I am new to SharePoint development. We have created a base site template and have used that template to start new sites in other locations on the same server. This works fine but the newly created site seems to "flatten" the custom content types created in the original site. I would think there would be a way to keep the original content type inheritance intact to help support any necessary modifications on the new site. They can still make the modifications but they take longer because you have to visit each list individually. Does anyone know how to fix this or know a better way to approach this?
The problem you are having is the move from your original site collection to another. The site template does not store the complete definition of a site - only the differences from the underlying site definition. Move from one site collection to another and you lose the underlying site definition and run into problems such as the loss of your content types.
Site templates and site definitions are two separate customizations you can undertake. You need to make a decision based on your requirements as to which is best.
Site templates
Pro's:
Easy to create and reuse through the SharePoint interface
Ideal for end users
A site template is a customization of the underlying default site definition
Con's:
Dependency on underlying site definition means SharePoint updates could break your site templates
Poor performance since the modifications are held in the database and are read from the DB and compiled on each request
Limited customization options
Site definitions
Pro's:
Harder to create: involves coding XML
Made by developers and site administrators
Independent of SharePoint default site definitions so not affected by SharePoint updates
Limitless customization options
Con's:
Difficult to modify when deployed
Can be cached on the file system so is fast to load
Check out Google for info on creating custom site definitions.
Hope this helps!
Jonny
The best way to do this is to create a site definition where the content types are within features whose scope is to the farm.
Tim

Resources