Our Forum has Moved

This site is our old forum and is only here for achive until we get proper 301 redirects setup to make Google happy.

Please use our new community site - Our Umbraco - which contains an improved forum, documentation wiki, package repository and a member locator.

Go to Our Umbraco now

Learn everything about Umbraco
Partial document types for reusing on other document types Options
nico
Posted: Sunday, December 09, 2007 1:34:51 AM

Rank: Devotee

Joined: 12/9/2007
Posts: 62
Location: the Netherlands
Compared to Umbraco, Sitecore CMS has a similar (but more complex) way of constructing document types. (the term in Sitecore is actually not document type, but I'll continue using the Umbraco terms...)

One nice feature of Sitecore CMS is the possiblity of creating "partial" document types. In umbraco terms: The possibility to create and save tabs on document types seperately with the possibility to use them in other document types. Simply by adding reference in a multiselect "based on the following partial document types". Of course after that, your own properties can be added to your new document type.

An example:
A partial document type which is named: "Metadata" would include some fields for page title and some metatags.

Each newly created document type can now be based on this metadata tab. Every page eventually has metadata. Adding 1 extra property to the "Metadata" partial document type will add it automatically to every document type.

Is this something that is also possible in umbraco?

Nico
hartvig
Posted: Sunday, December 09, 2007 3:26:02 PM

Rank: Umbracoholic

Joined: 3/17/2008
Posts: 1,192
Location: Nyborg, Denmark
Hi Nico!

No, it's not possible in umbraco. It's all comes down to simplicity versus "complex"ity, which I think is a good way to compare umbraco vs Sitecore :)

In some cases the inheritance that you'd get from the complexity would save you a couple of minutes when creating a big pile of Document Types, but the downside would be that the editing view (not to mention the understanding) of Document Types would become more complex which I'd prefer to avoid.

That said, I know it's a top request to be able to copy an existing Document Type (as a supplement to the export/import feature which we have currently). That would solve the main issue I think. I assume it's rarely that you edit the "base" Document Type as it would potentially also affect created Documents and that one - hopefully - made an existing model for storing the documents, before one starts adding Document Types.

So the lack of the inheritance feature is not ignorance, but simply an assessment which concluded that the added complexity wouldn't justify the advantages gained. If I missed some additional gains from Document Type inheritance apart from the automatically added properties, I'd be happy to know though.

Hope this helps,

/n

Jeeeez, did I really start this :-)
Founder of the Umbraco project
pkoutoul
Posted: Monday, December 10, 2007 1:30:49 PM

Rank: Fanatic

Joined: 8/9/2007
Posts: 292
Location: Kentucky, USA
With all due respect to Neils, I agree 100% with Nico. I actually posted a question about this the other day. The concept of object inheritance is not at all complicated IMHO. It greatly simplifies coding and in my opinion would make life easier for those of us who create umbraco sites.

The problem (at least in my case) is that, as I build my site I discover things that should have been added to my document types but were not. Also, requirements tend to change over time. If I have 20 or so document types, this means I have to go back and change every one. Since I am picky about keeping field names consistent within a site, this means I have to be careful about making all these changes. Adding a copy document type feature would not be all that helpful in this case. But the ability to inherit from other base document types would be.

Every day, I am amazed at the genius of this framework as I discover new hidden gems, and I am grateful to those who have worked hard to develop it and make it available as open source. But this is a major shortcoming. Again, just my opinion as a fairly new umbraco user.

Pete Koutoulas • Fayette County Public Schools • Lexington, Kentucky
hartvig
Posted: Monday, December 10, 2007 2:48:19 PM

Rank: Umbracoholic

Joined: 3/17/2008
Posts: 1,192
Location: Nyborg, Denmark
I'm not going to be a showstopper on this one if the majority of the community would find the usefulness of this feature a plus over the added complexity.

However, it is not a drop dead simple feature as modifying a base doctype would also affect all documents created with doctypes based in the base. What should happen to those if you change the base? Should they be republished? If you remove a property from the base then that property would be deleted (forever) on all documents that was based on the inherited doctype. And again, should they then be republished?

I'd really like to see some scenarios where people would use this and a diagram of the optimal way to cope with the consequences. And I'd be happy to add it to the core if someone created a good solution and submitted the code.

/n

Jeeeez, did I really start this :-)
Founder of the Umbraco project
pkoutoul
Posted: Monday, December 10, 2007 4:45:11 PM

Rank: Fanatic

Joined: 8/9/2007
Posts: 292
Location: Kentucky, USA
Fair enough, Neils. I'm not sure about the implementation details -- in fact, I don't have a clue -- but I am hoping that others with more framework knowledge will agree that this is needed and provide some detail.

As for me, all I can tell you is that I can see this as a real time saver. Here's a real-world example.

On my site, every content node which will be rendered as an HTML page needs to have a basic set of properties such as: title, author, description, keywords, etc. Defining a base document type as HTML page with those properties would greatly speed up the creation of new HTML document types. More importantly, if in the future we decide that all HTML documents should have a new property called isDeprecated, this would only have to be done in one place.

As far as I am concerned, I would rather that any fields added or deleted to a base doc type be immediately propagated to all children doc type and content nodes without the need to re-publish. That might be asking too much but that is how I would like to see it work.

(Of course, templates are another issue and if fields appear in templates then I can't see any way to have changes made automatically. That would still be a manual process.)

Thanks for listening. If not many people see this as something that is needed, then I'll shut up about it. ;)

Pete Koutoulas • Fayette County Public Schools • Lexington, Kentucky
Itamar
Posted: Monday, December 10, 2007 6:19:06 PM
Rank: Devotee

Joined: 10/30/2007
Posts: 96
Location: Israel
I agree this can come in handy, and you have my vote as long as it does not make Umbraco respond any slower to the end-user surfing the site itself (which I think is the case). The users of the Umbraco admin panel may suffer a bit as far as I'm concerned.

Comlexity is not something I'd consider in this case, as one could choose not to use this support, which is an extended feature, and use plain one-level document types. Only if you know what you're doing and think you will gain from this, only then you will use inheritance of DocTypes. It might be easier to invent a new term for this, for example Document Data, instead of creating direct inheritance, which will have its own tree node where you can add data fields and save, and then build up your document type and base it on Document Data elements. This is how I interpreted the initial request.

Itamar.
pkoutoul
Posted: Friday, July 25, 2008 3:49:17 PM

Rank: Fanatic

Joined: 8/9/2007
Posts: 292
Location: Kentucky, USA
Just bumping this topic for further discussion because there seems to be some renewed interest in it.

Pete Koutoulas • Fayette County Public Schools • Lexington, Kentucky
NeilG
Posted: Saturday, July 26, 2008 11:58:14 AM

Rank: Aficionado

Joined: 12/15/2006
Posts: 116
I think this is a great idea.
Something akin to Tridion's "schema" approach where you could make alterations to a "base" document type, but you have to manually republish any created content.

Not sure about Umbraco internals, but if you deleted a property from a "base" type, I'm assuming the content using that type would be unaffected, until you opened it and re-saved it? When you save/publish, your actually saving XML based upon the document type AT THAT POINT IN TIME?



___________________________________________________________________________________

Neil
Petr Snobelt
Posted: Monday, July 28, 2008 9:06:33 AM
Rank: Fanatic

Joined: 10/2/2007
Posts: 315
Location: Czech Republic
Hi, if only reason to create document type inheritance is creating properties, this can be solved by something like property copyer. You can select property chooce copyTo and select documentTypes to which it will be copied. Miss I something ?

Petr
NeilG
Posted: Monday, July 28, 2008 2:14:56 PM

Rank: Aficionado

Joined: 12/15/2006
Posts: 116
Petr,

I think the problem is that copying doesn't maintain a link back to the original. If you have a "base" document type that others inherit from, they'll inherit any changes.

Think of it like the master -> content template relationship, but better.


___________________________________________________________________________________

Neil
Petr Snobelt
Posted: Tuesday, July 29, 2008 12:43:31 PM
Rank: Fanatic

Joined: 10/2/2007
Posts: 315
Location: Czech Republic
Neil,

I understand that copying is not same as inheriting, but in real sites I will use inheritance only to defining properties once. Sometimes can be better if you can change property only for one document type (for example from mediapicker to upload) sometimes not.
umbracoNewb
Posted: Friday, September 05, 2008 11:53:01 PM
Rank: Enthusiast

Joined: 8/5/2008
Posts: 25
Hi,
I am still a bit new to umbraco but i really like it so far. The doc type inheritance is something that i would really like to see in the future. Through out my learning of umbraco and changing needs of what the site is and requires i have needed to go back and modify the document types. Sometimes it is only one sometimes it is almost all of the document types.

@Neil I have thought about this a little and have a real life scenario. Imagine I have a site that sells cars. All types of cars. Now i have a taxi cab and a cop car. The taxi cab and cop car both have an engine, tires, and brand or manufacture, but the cop car has some other features like the siren and lights. If i was able to create a doc type called something like "autos" and have this doc type contain the engine, tires, and brand properties. I would then be able to inherit from that doc type to create the taxi cab doc type and the cop car doc type. Then when i realize that people want to know what color the car is i can add this property to the "auto" doc type and not to both the taxi doc type and the cop car doc type.

As far a way to have this all go about i am not sure. I think NielG might have had a good idea with that though. If the doc types are created like templates where one can inherit from another than this will create an easily usable tree architecture where the inheritance can be created or ignored. As far a warning for the parent doc type being changed, If the architecture for the doc types is shown as an actual tree node like the content nodes are, then it is easy to see which nodes will be affected by the change. If a user does not want the change to take effect on a certain "doctype" or "doctype branch" then the user would need to create a new branch, and can then move nodes if needed.

Not sure if this make any sense, but i think a doc type inheritance would be great and save me a lot of time right now when i have some doctypes that are essentially the same but with a few differences, and right now as the site comes together and the specs change, so do these doc types and i am repeating the same changes in these doc types.

but anyway,.. Great product! I really do like how it works so far.

umbracoNewb.
hartvig
Posted: Sunday, September 07, 2008 8:23:21 AM

Rank: Umbracoholic

Joined: 3/17/2008
Posts: 1,192
Location: Nyborg, Denmark
Come up with a real scenario and I'll think about it. But the taxi/cop car is not an umbraco sample, it's a OO sample. Partial doctypes/doctype inheritance is only about sharing a couple of properties.

And adding partialism doesn't save you a lot of time in the example above. It saves you a couple of minutes.

Jeeeez, did I really start this :-)
Founder of the Umbraco project
Piquet
Posted: Tuesday, September 09, 2008 8:55:07 AM
Rank: Newbie

Joined: 6/6/2008
Posts: 13
Location: Australia
Real site. SuperSprint

Currently, we have document types for homepage, events, and a large number of the items underneath these events. This is provided to the customer as a completed system, but they are able to brand each of the pages within those events with their own designers.

In the course of the six weeks that have I've been involved with the project, there have been a number of changes to the "base" document type. ie - they would like to add a sponsors logo at the bottom of each branded page. They want to add their own body text to each of the sub pages that are list types.

It's an agile project, and we encourage the customer to make these changes... but the impact on us is growing. We need to maintain our own internal hierarchy of which document types belong where, and when we make a change to a "grouping" of types, then we need to apply it to every doctype in that grouping.

our candidate grouping for this site is...
Event pages
- Event Information
- Generic
- Course Information and Maps
- FAQ
- Online Entry

List Pages
- FAQ List
- Event List
- Gallery List
- Results List
- Newsletters

So for us to respond to the question "Can you add a rotating image gallery to the bottom right of all the list pages so that we can choose a gallery to display" means we need to find all our listing pages each time.

Currently we do it manually, but it is prone to error, and occassionally we miss a type. For us, it saves us about 5 minutes per doctype (Change, save, publish, test, export, import to live) - for FAQ, Event, Gallery, Results, Newsletters - thats 25 minutes. Then, there is the time spent scanning through to make sure that out grouping is up to date..... another 15 minutes.

We probably make these types of changes 2 or 3 times an iteration in the early weeks, and then less often. Unfortunately, we just made another one. One type didn't get updated.

The issue is less about time taken to update, more about risk management. This was a little embarrassing for us, and despite putting it in 8 types, missing that one type (which the customer also missed for two days) cost us about 4 hours in preparing an interim deployment and appropriate release notes.

That's my vote. Certainly not a show stopper, but a real scenario. btw - I've only just started considering this myself, so I'll put together a show and dance about ways it could work.
Adz
Posted: Tuesday, September 09, 2008 10:03:43 AM

Rank: Aficionado

Joined: 6/5/2008
Posts: 152
Location: United Kingdom
All,

I am working on a large site with a lot of different doc types. They do all share some common properties - Breadcrumb name, and menu name for example. I also need to add Metadata fields to each of these document types at some point.

Niels is probably correct - "inheritance" would save me half an hour here, half an hour there. But I do still think it would make my life easier and take some of the tedium out of website development!

I have been giving this some thought over the last few days and wondered if some of my thoughts would be of use to anybody.

Aims of DocType Inheritance
1. Ability to inherit the properties defined in a base Document Type
2. When the base document type properties change, these changes should propogate to child types.

Examples of DocType Inheritance
1. Car website - base "Auto" doctype with child "CopCar" doctype
2. Metadata - all/most documents require Keywords, Description, Title, breadcrumb name

Simple Implementation
If the purpose of DocType inheritance is to re-use common fields, this can be achieved without making any changes to Umbraco and without even adding any packages to Umbraco (although, some Action Handlers could make the experience a little nicer).

I'm not saying this is a solution that everyone will want to use, but it is a possibility, and it works without any changes to Umbraco.

Meta Data
Here is a scenario:
1. a DocType called "BaseDocType" which has the properties "MetaKeywords", "MetaDescription".
The "BaseDocType" does not have a template assigned (@template=0)

2. a DocType called "Blog" which has the properties "blogImage" and "blogText" and "author"

3. a DocType called "Homepage" which has the properties "bodyText" and "featuredBlogPosts"

If we want all of our documents to use the properties in "BaseDocType" then the simplest way is to allow "BaseDocType" to be a child node of the other two - on the "Structure" tab of the Document Type, make sure that "BaseDocType" is an allowed child node.




WEBSITE
|
|-----------Homepage
| |---------- BaseDocType
|
|-----------Blog Post 1
| |---------- BaseDocType
|
|-----------Blog Post 2
| |---------- BaseDocType



You can write some XSLT, Python, or in Umbraco v4 you can write some C# straight into the page, to retrieve the properties of the child basedoctype.

Code:

<xsl:variable name="baseDoc" select="$currentPage/node[@nodeTypeAlias='BaseDocType']" />
<meta name="keywords" content="{$baseDoc/data[@alias='MetaKeywords']}" />
<meta name="description" content="{$baseDoc/data[@alias='MetaDescription']}" />


Multiple Inheritance (BaseAuto)
Now we could add some more document types:
4. BaseAuto (With engine, transmission, topSpeed properties)
Again, no template should be selected for the base type (@template=0)

5. CopCar (With SirenColour and optional Doughnut holder)

Now you can re-use both the BaseAuto and the BaseDocType as follows:

WEBSITE
|
|-----------Homepage
| |---------- BaseDocType
|
|-----------Blog Post
| |---------- BaseDocType
|
|-----------Cop Car
| |---------- BaseDocType
| |---------- BaseAuto


@template=0
When writing menus, sitemaps, breadcrumbs etc you may already have come across 'umbracoNaviHide'. This is a flag which can be used to tell XSLT not to render links to some pages.
I also use the @template attribute for the same purpose.

So, if @template=0 - do not render that page in any navigation or sitemaps.

Some Action Handlers
This could be made more user friendly by writing some action handlers. For example, if the user attempts to create a CopCar, then an action handler could automatically create the BaseDocType and BaseAuto child nodes.

This will require a more formal way of specifying the "inheritance" - so that the action handler knows which child documents to create. I think this could be done with a simple data type / label which identifies the child document types or by using the Document type "name"

Code:

DocType Name: Blog Post extends BaseDocType
DocType Alias: blogPost

DocTypeName: Cop Car extends BaseDocType,BaseAuto
DocType Alias: copCar


Some tweaks
You could arrange your content in reverse - which would give a view which looks more like an inheritance tree.

WEBSITE
|
|-----------BaseDocType
| |---------- Homepage

This would allow you to use Umbraco's <GET_ITEM recursive=true> tag, and a little less XSLT.
However, you would need to redirect from the BaseDocType to its child node (using an Umbraco Redirect package?) which I think would make this structure unuseable.

The "real" thing
For those of you who still want "proper" doctype inheritance, this is how I think it could be done as an Umbraco Package using Action Handlers.

Naming convention: Use the DocType naming convention mentioned above (A extends B).
An ActionHandler or .NET event will fire when the DocType is saved. The action handler will check the name of the DocType - parse the "extends B" and add any properties from DocType B to DocType A.

If DocType B is modified, an ActionHandler or .NET event will modify all doctypes which extend DocType B.

I think you would also need to have a sensible naming convention for properties. For example, all properties of DocType B would be named "B.poperty" - to simulate namespaces and avoid duplicate variable names.

Special care would need to be taken to handle deep inheritance (A extends B, B extends C - so when C is modified, B would be modified, which would cause A to be modified).

Conclusion
So - thats how I think it could be done. What do you think?



Adam Perry (blog, twitter), developing Umbraco based websites and applications for ConnectDigital.
hartvig
Posted: Tuesday, September 09, 2008 11:15:13 AM

Rank: Umbracoholic

Joined: 3/17/2008
Posts: 1,192
Location: Nyborg, Denmark
This is great - superb - feedback, I'm listening, getting inspired and I'm ready to give it some thought.

Would it be acceptable if:
1) This is tabs and properties only
2) Tabs and properties can only be edited on the master doctype (they'd be greyed out on the inherited one)
3) When you make changes (ie delete or rename) properties on the master doctype you're responsible for republishing to make the changes have effect on the published content
4) When you delete from the master doc type you'd get a warning saying (this will delete all content that uses the following doctypes (list of inherited doctype). Are you sure?)

My main worries is that it can get tough to have an overview of the side-effects of changing a master doctype. But I guess that's solvable.

Jeeeez, did I really start this :-)
Founder of the Umbraco project
VirtualRichard
Posted: Tuesday, September 09, 2008 11:24:11 AM
Rank: Fanatic

Joined: 9/17/2007
Posts: 265
Location: London, UK.
While you're looking at Document Types can we please have default values that are applied if the content item doesn't supply a value (i.e. the developer can apply sitewide settings if the editor does not).

Also, can we please please please have a confirmation dialogue to confirm documenttype deletion? I'm sick of losing 100's of pages just because the content tree node reload was too slow and therefore selected the wrong documenttype for deletion (and if you delete the documenttype, say goodbye to all the pages you created using that dt!).

Richard

2 * 3 * 3 * 37 : The prime factorisation of The Beast.
Dirk
Posted: Tuesday, September 09, 2008 12:03:49 PM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,874
Location: Belgium
I'm more a fan of building property sets instead of having doc type inheritance.
You can also build a hierarchy of property sets and apply a set to a doc type.

You can even assign multiple sets to a same doc type.

Using Adam's example:

Create property set for all site wide info (metatags, and the like...)
Create property set for a Car (Type of car, ...)
Create property set for a SpecialCar (inherits all properties from the Car property set, and defines some extra ones only applicable to SpecialCar...)

Strict and clean separation between the two.

Also, keeps transparency to the end-user. I know you could limit the type of documents one can create, but it doesn't look elegant to have a Doc Type for which no documents are created.

Just thinking out loud here.

Greetz,
/Dirk


level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
Adz
Posted: Tuesday, September 09, 2008 12:17:00 PM

Rank: Aficionado

Joined: 6/5/2008
Posts: 152
Location: United Kingdom
Quote:

Would it be acceptable if:
1) This is tabs and properties only
2) Tabs and properties can only be edited on the master doctype (they'd be greyed out on the inherited one)
3) When you make changes (ie delete or rename) properties on the master doctype you're responsible for republishing to make the changes have effect on the published content
4) When you delete from the master doc type you'd get a warning saying (this will delete all content that uses the following doctypes (list of inherited doctype). Are you sure?)


Yes I would agree with all of the above.

Quote:
Also, can we please please please have a confirmation dialogue to confirm documenttype deletion


I'm pretty sure there is a confirmation box (certainly in Umbraco v4)

Quote:
I'm more a fan of building property sets instead of having doc type inheritance.

Actually I think that is a great alternative solution to the problem.
You can ALMOST do this by creating your own data type now. The problem is that data types return a single property (so you end up with <data alias="myalias">singleproperty</data>.
If data types could also return an array or Dictionary of values, navigable with XSLT, you could certainly create a data type to solve this problem.

<data alias="myalias" subproperty="MetaKeywords">keywords</data>
<data alias="myalias" subproperty="MetaDescription>description</data>

Adam Perry (blog, twitter), developing Umbraco based websites and applications for ConnectDigital.
hartvig
Posted: Tuesday, September 09, 2008 12:18:53 PM

Rank: Umbracoholic

Joined: 3/17/2008
Posts: 1,192
Location: Nyborg, Denmark
VirtualRichard wrote:

Also, can we please please please have a confirmation dialogue to confirm documenttype deletion? I'm sick of losing 100's of pages just because the content tree node reload was too slow and therefore selected the wrong documenttype for deletion (and if you delete the documenttype, say goodbye to all the pages you created using that dt!).
Richard


Like a dialog that said "Are you sure you want to delete "My Document Type"?

Jeeeez, did I really start this :-)
Founder of the Umbraco project

The forum has moved

This forum is no longer in use, so you can't reply to this message - please go to Our Umbraco

Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.