Statistics
| Branch: | Tag: | Revision:

root / cloudcms / cms.py @ 511913cb

History | View | Annotate | Download (5.5 kB)

1
# Copyright 2012 GRNET S.A. All rights reserved.
2
#
3
# Redistribution and use in source and binary forms, with or
4
# without modification, are permitted provided that the following
5
# conditions are met:
6
#
7
#   1. Redistributions of source code must retain the above
8
#      copyright notice, this list of conditions and the following
9
#      disclaimer.
10
#
11
#   2. Redistributions in binary form must reproduce the above
12
#      copyright notice, this list of conditions and the following
13
#      disclaimer in the documentation and/or other materials
14
#      provided with the distribution.
15
#
16
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
# POSSIBILITY OF SUCH DAMAGE.
28
#
29
# The views and conclusions contained in the software and
30
# documentation are those of the authors and should not be
31
# interpreted as representing official policies, either expressed
32
# or implied, of GRNET S.A.
33

    
34

    
35
import mptt
36

    
37
from django import forms
38
from django.db import models
39
from django.utils.text import capfirst
40
from django.utils.translation import ugettext_lazy as _
41

    
42
from feincms.module.page.models import Page
43
from feincms.content.raw.models import RawContent
44
from feincms.content.richtext.models import RichTextContent
45
from feincms.content.image.models import ImageContent
46
from feincms.content.application.models import ApplicationContent
47
from feincms.module.page.extensions.navigation import NavigationExtension, \
48
        PagePretender
49
from feincms.content.application.models import reverse
50
from feincms.content.medialibrary.v2 import MediaFileContent
51
from feincms.content.section.models import SectionContent
52
from feincms.content.table.models import TableContent
53
from feincms.content.template.models import TemplateContent
54
from feincms.content.video.models import VideoContent
55
from feincms.content.richtext.models import RichTextContent
56

    
57
from cloudcmsblog.models import Entry, LatestEntries
58
from cloudcmsresources.models import ResourcesList
59
from cloudcms.content import *
60

    
61
Page.register_extensions(
62
    'changedate',
63
    'datepublisher',
64
    'translations',
65
    'seo',
66
    'symlinks',
67
    'navigation',
68
    'sites',
69
    'titles'
70
)
71

    
72
# Feincms Page templates declaration
73
TEMPLATES = [{
74
    'key': 'basic',
75
    'title': 'Basic 2 columns template',
76
    'path': 'cms/pages/page.html',
77
    'regions': (
78
        ('main', 'Main region'),
79
        ('sidebar', 'Sidebar', 'inherited'),
80
        ('bottom', 'Bottom section', 'inherited'),
81
        ),
82
    },
83
    {
84
    'key': 'twocolwide',
85
    'title': 'Basic 2 columns template (wider)',
86
    'path': 'cms/pages/twocolwide.html',
87
    'regions': (
88
        ('main', 'Main region'),
89
        ('sidebar', 'Sidebar', 'inherited'),
90
        ),
91
    },
92
    {
93
    'key': 'intro',
94
    'title': 'Intro page Template',
95
    'path': 'cms/pages/intro.html',
96
    'regions': (
97
        ('main', 'Main region'),
98
        ('sidebar', 'Sidebar', 'inherited'),
99
        ('bottom', 'Bottom section', 'inherited'),
100
        ),
101
    },
102
    {
103
    'key': 'singlecol',
104
    'title': 'Basic 1 column template',
105
    'path': 'cms/pages/onecol.html',
106
    'regions': (
107
        ('main', 'Main region'),
108
        ('bottom', 'Bottom region'),
109
        ),
110
    },
111
    {
112
    'key': 'blog',
113
    'title': 'Blog template',
114
    'path': 'cms/pages/blog.html',
115
    'regions': (
116
        ('main', 'Main region'),
117
        ('sidebar', 'Sidebar', 'inherited'),
118
        ),
119
    },
120
    {
121
    'key': 'raw',
122
    'title': 'Empty content template',
123
    'path': 'cms/pages/empty.html',
124
    'regions': (
125
        ('main', 'Main region'),
126
        ),
127
    },
128
]
129

    
130
# register templates
131
map(Page.register_templates, TEMPLATES)
132

    
133
Page.create_content_type(RichTextContent)
134
Page.create_content_type(RawContent)
135
Page.create_content_type(SectionContent, TYPE_CHOICES=(('block', 'Block'),))
136
Page.create_content_type(TemplateContent)
137
Page.create_content_type(TwitterFeed)
138
Page.create_content_type(VideoContent)
139
Page.create_content_type(VideoSection)
140
Page.create_content_type(LatestEntries)
141
Page.create_content_type(IntroButton)
142
Page.create_content_type(ClientDownload)
143
Page.create_content_type(ImageContent, POSITION_CHOICES=(
144
    ('default', 'Default position'),
145
))
146
Page.create_content_type(MediaFileContent, TYPE_CHOICES=(
147
  ('lightbox', 'lightbox'),
148
  ('download', 'as download')
149
))
150
Page.create_content_type(ApplicationContent, APPLICATIONS=(
151
    ('cloudcmsblog', 'Cloud blog', {'urls': 'cloudcmsblog.urls'}),))
152

    
153

    
154
# cloudcms specific content registration
155
Page.create_content_type(LoginForm)
156
Page.create_content_type(AboutBlock)
157
Page.create_content_type(ResourcesList)
158

    
159

    
160
# Feincms specific registrations for our blog entry model
161
Entry.register_regions(
162
    ('main', _('Main content area')),
163
    ('sidebar', _('Right column')),
164
)
165
Entry.create_content_type(RichTextContent, cleanse=False, regions=('main',))
166
Entry.create_content_type(TemplateContent)
167
Entry.create_content_type(VideoContent)
168
Entry.create_content_type(TwitterFeed)
169
Entry.create_content_type(RawContent)
170
Entry.create_content_type(LatestEntries)
171
Entry.create_content_type(SectionContent, TYPE_CHOICES=(('block', 'Block'),))
172