How do I add custom entities to Typo3 CMS? - customization

In my project I need to add a lot of custom entities to Typo3 CMS.
Eg. I need to have Buildings, Building Companies, Architects, Certifications, and so on.
What is the common approach for doing this?
Should I develop a new extension?
How can I then have a custom backend for managing these entities? Eg. in the Buildings admin page I want to be able to add a new Building also associating one or more Architects to it. Is it feasible? How?
Can I create a custom backend field for looking up Architects in the Buildings admin page? (eg. something like StackOverflow tags system, a token input field which looks up for items in Architects table in real-time while editing a Building)

To map a business model into Typo3 I prefer to build an extension for that.
On the one hand you have the maximum flexibility by programming in PHP with the help of the Typo3 framework and on the other hand most of the backend management pages come in easy when using the standard MVC + TCA structure of Typo3 Extbase extensions (if it is your first try with Extbase you might want to have an Extbase book at hand).
You can have a look at the Typo3 TCA page to see which standard backend field types are available - there are shown a lot of example configurations. As in your case you might want to use a select field with property "size" > 1 and property "maxitems" > 1 to describe the relation between buildings and architects. As for the architects filter feature you might also want to add the property "enableMultiSelectFilterTextfield" as shown in this example.

Related

Ruby on rails - Add multiple record from new action

In my application I have Domain model that have these columns: name, link, description.
Currently my application works as I can only add one domain at a time (from new action). What I am looking for is to be able to add as many domains as I want from the same form/page.
I have used nested_forms before but usually its nested_attributes for another model.
How am I able to have nested_forms for same model or if there is any other way?
This can be done, but not in a RESTful way. There are some hacks to do it, But I don't recommend and best way would be to do associations and adding nested_attributes to it.

Best practice for migrating MVC web to Sitecore

We have a couple of MVC 3.0 web application some of them combination of Web Form and MVC3.0 within on project/solution.
I'm quiet new to sitecore, could someone please help me understand following in regards to migrating the existing application to Sitecore?
On what type of scenarios should we move MVC3.0 razor views to sitecore?
What are the key gotchas migrating MVC3.0 to sitecore?
Do I need to inject anything on sitecore pipeline?
Do I need to change any of the navigation links to work under sitecore?
Any link to sitecore best practice for migrating existing web app will be good.
I followed the blog below and still unclear why and when should we convert web control and razor views to Sitecore Rendering.
Thank you.
When migrating MVC applications into a Sitecore solution you have a few options available - depending on the nature of the component you are migrating you would have to choose the most appropriate option.
I'll try and address your 5 specific questions:
1. When to use Razor views
I'm not sure if the question is "when to use a Razor view" or if the questions is "when to use Sitecore View Rendering" - I'll assume the latter.
A View Rendering is great if your are writing presentation components that do not require any business logic and only deals with rendering items. If you are contemplating adding code in your Razor view you should probably consider if a Controller Rendering would be more appropriate or perhaps customising the mvc.getModel pipeline.
2. Migration gotchas
Some of the things that may catch you out when migrating a MVC application to Sitecore.
Component based controllers - in MVC you have one controller per page. Sitecore supports the concept of ControllerRenderings that allows you to have multiple controllers on a page (note: there will always be one route controller that can be perceived as the primary).
Item routing - Sitecore has a catch all route that is effective for all paths that map to an item path. Standard MVC routes and "item routes" can happily coexist. Item routes do not currently support route parameters (e.g. you cannot specify {action} or other parameters on the item route).
MVC4 - Currently no official support for MVC4 (this won't hold true for long - but in the meantime have a look at http://herskind.co.uk/blog/2012/10/sitecore-66-mvc4)
Areas - Currently areas are not fully supported.
Not knowing what rendering types to use and when to convert existing functionality into components.
3. Pipeline customisation
You are not compelled to customise the Sitecore pipelines. I can see a few examples where it would be useful to modify pipelines in the context of a migration story. One example I recently talked about at a Sitecore User Group involved adding a ActionFilter globally (through mvc.resultExecuting pipeline) that would inject a ASP.Net MVC application into a Sitecore place holder. In my example I injected the MVC Music Store into a placeholder and had Sitecore control window dressing (headers/footers/menus). This way I could bring my existing MVC application into Sitecore without having to change it much.
4. Navigation links
If your navigation endpoints are Sitecore item routes (e.i. the path to an item on the website) you should use Sitecore's LinkManager to generate the appropriate links. If the endpoints are standard MVC routes RouteLink and ActionLink should work just fine.
I guess without a concrete example the answer will be "maybe".
5. Best practice migration blog post
I'm not aware of any blog posts or articles dealing with Sitecore MVC migration best practice. Keep in mind that full MVC support is a recent addition to Sitecore and not many seen this journey from start to end yet.
Why and when to convert to Sitecore Rendering
You end your question stating that you are still confused about when and why you would convert controls and Razor views to Sitecore renderings. Here are some indicators that something is a candidate for being a Sitecore rendering:
It is a component that can be reused on many pages.
You want to enable Sitecore users to add the component to pages. (think Page Editor)
You want to leverage Sitecore's component level caching.
You want to leverage Sitecore security to restrict who can use/see the component.
You want to control the component with personalisation, rules or run MVT on it.
In the context of MVC here are some indicators that it may not be right to convert something to a Sitecore rendering:
It relies heavily on routing and route parameters.
I'm sure many of the points in this answer could be expanded on and I know that there are no clear cut rules for this - but I hope this answer helps clear up some of the confusion...

Redmine custom fields on Projects page

I have recently setup Redmine and really like it. However, a feature which I really want is to set up Project completion in a percentage type facility (such as 5% 10% etc.) which is editable simply by the developer, not automated.
I know that you can create custom fields but something that I really want is that the column can show up on the "Homepage" / "Projects Page" to give a more detailed overview rather than going into each individual project.
Is there a way to do this with any plugins?
I am running Redmine 2.2.0
Any help with this would be greatly appreciated
You can't put custom fields on the project list page (or need to search for third-party solution), but you do can customize custom fields to look as gauge bar using Extended Fields plugin.

django subdomains a la craigslist.com

I am interested in setting up my application so that I can serve location specific content.
Something like craigslist, where miami.craigslist.org only shows posts in miami.
Assuming that I have a model that has a City field, what would be the best way to achieve this?
Banjer suggested the Sites framework, but I feel like it might not be a 100% perfect fit for your situation. The sites framework works well for different sites sharing the same database. But in your case, its all the same site and you are basically just wanting to pass an argument to your views for the city.
You could probably do something even simpler by just pointing wildcard *.domain.com to your django site, and then using request.get_host() in the view to parse out the subdomain:
https://docs.djangoproject.com/en/1.4/ref/request-response/#django.http.HttpRequest.get_host
So if the domain were: "losangeles.domain.com", and you parsed out "losangeles", you could use that as your city "tag" in your query. And when you create new content, you can just tag it with a city.
Post.objects.filter(city_tag="losangeles")
I suppose it depends on how robust of a "location" structure you need in your site. It very well might be a City model with various meta data fields, including the tag field. Then you would associate it with the content as a foreign key. It kind of approaches the same general idea as the Sites framework, but in this case you aren't really creating different sites.
You should check out the "sites" framework. If you've ever used the built-in Django admin, then you've probably seen the sites section where example.com is the only site listed by default.
Real world example, from the link I provided:
Associating content with multiple sites
The Django-powered sites LJWorld.com and Lawrence.com are operated by
the same news organization – the Lawrence Journal-World newspaper in
Lawrence, Kansas. LJWorld.com focuses on news, while Lawrence.com
focuses on local entertainment. But sometimes editors want to publish
an article on both sites.
The brain-dead way of solving the problem would be to require site
producers to publish the same story twice: once for LJWorld.com and
again for Lawrence.com. But that’s inefficient for site producers, and
it’s redundant to store multiple copies of the same story in the
database.
The better solution is simple: Both sites use the same article
database, and an article is associated with one or more sites.
So instead of a City field, you'd add a field to your model for Site, e.g.:
sites = models.ManyToManyField(Site)
You basically have one database that all of your cities use. Convenient, but I'm wondering how it would scale down the road. I'm starting a similar project myself and will use the Django sites framework to get the project off the ground. I'm interested in hearing about a more scalable solution from a database person though.

Implementing filters in django for e-commerce website

I am implementing an e-commerce website using django. The product catalog will be big (hundreds of products). I would like to know how I should implement product filters in search.
E.g. let's say I put up about 30 products initially. The user might want to filter the search based on some product attributes like color, size, category, etc.
Is there any feature in django that enables building such features? If not, how should I go about it? Is querying the database everytime the user picks an attribute, the only approach?
Thanks.
I think you are looking for a faceted search.
Haystack should be the django app you are looking for.
Furthermore you could take a look at django-filter