Revision ff30ee3a

b/cloudcms/cms.py
57 57
from cloudcmsresources.models import ResourcesList
58 58
from cloudcms.content import *
59 59

  
60

  
60 61
Page.register_extensions(
61 62
    'changedate',
62 63
    'datepublisher',
......
65 66
    'symlinks',
66 67
    'navigation',
67 68
    'sites',
68
    'titles'
69
    'titles',
70
    'featured',
69 71
)
70 72

  
71 73

  
......
137 139
        ('main', 'Main region'),
138 140
        ),
139 141
    },
142
    {
143
    'key': 'topwidetwocol',
144
    'title': 'Basic (Top 1 col, Middle 2 cols, Bottom 2 cols)',
145
    'path': 'cms/pages/topwidetwocol.html',
146
    'regions': (
147
        ('top', 'Top region'), 
148
        ('middle_left', 'Middle left region'),
149
        ('middle_right', 'Middle right region'),
150
        ('bottom_left', 'Bottom left region'),
151
        ('bottom_right', 'Bottom right region'),
152
        ),
153
    },
140 154
]
141 155

  
142 156
# register templates
......
202 216
        ('default', 'Default position'),
203 217
    ))
204 218

  
219

  
220
Page.create_content_type(StatsBlock)
221
Page.create_content_type(IntroVideo)
b/cloudcms/content.py
249 249
    def render(self, **kwrags):
250 250
        return render_to_string(['content/client_downloads.html'], {'content': self})
251 251

  
252

  
253
class StatsBlock(models.Model):
254
    
255
    @property
256
    def media(self):
257
        return forms.Media(js=(
258
            settings.MEDIA_URL + 'cloudcms/' + 'js/' + 'service-stats.js',))
259

  
260
    title = models.CharField(_('title'), max_length=200, blank=True)    
261
    color = models.CharField(max_length=200, blank=True, null=True)
262
    running_vms = models.BooleanField(default=False, help_text = "ACTIVE VMs")
263
    spawned_vms = models.BooleanField(default=True, help_text= "All VMs")
264
    active_vms = models.BooleanField(default=True, help_text ="All VMs - \
265
        DELETED VMs")
266
    running_networks = models.BooleanField(default=False, help_text = "ACTIVE \
267
        networks")
268
    spawned_networks = models.BooleanField(default=True,help_text= "All \
269
        Networks")
270
    active_networks = models.BooleanField(default=False, help_text ="All \
271
        Networks - DELETED Networks")
272
    title_running_vms = models.CharField(max_length=255,blank=True, null=True)
273
    title_spawned_vms = models.CharField(max_length=255,blank=True, null=True)
274
    title_active_vms = models.CharField(max_length=255,blank=True, null=True)
275
    title_running_networks = models.CharField(max_length=255,blank=True, null=True)
276
    title_spawned_networks = models.CharField(max_length=255,blank=True, null=True)
277
    title_active_networks = models.CharField(max_length=255,blank=True, null=True)
278
    compute_url = models.CharField(max_length=255,blank=True, null=True)
279
    
280
    class Meta:
281
        abstract = True
282

  
283
    def render(self, **kwargs):
284
        return render_to_string(['content/stats_block.html'], {'content': self})
285

  
286
class IntroVideo(models.Model):
287

  
288
    @property
289
    def media(self):
290
        return forms.Media(js=(
291
            settings.MEDIA_URL + 'cloudcms/' + 'js/' + 'youtube.js',))
292

  
293
    image = MediaFileForeignKey(MediaFile, blank=True, null=True)
294
    youtube_id = models.CharField(max_length=255,blank=True, null=True)
295
    
296
    class Meta:
297
        abstract = True
298

  
299
    def render(self, **kwargs):
300
        return render_to_string(['content/intro_video.html'], {'content': self})        
b/cloudcms/migrate/page/0023_auto__add_introvideo__add_statsblock__add_field_page_featured.py
1
# encoding: utf-8
2
import datetime
3
from south.db import db
4
from south.v2 import SchemaMigration
5
from django.db import models
6

  
7
class Migration(SchemaMigration):
8

  
9
    def forwards(self, orm):
10
        
11
        # Adding model 'IntroVideo'
12
        db.create_table('page_page_introvideo', (
13
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
14
            ('image', self.gf('feincms.module.medialibrary.fields.MediaFileForeignKey')(to=orm['medialibrary.MediaFile'], null=True, blank=True)),
15
            ('youtube_id', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
16
            ('parent', self.gf('django.db.models.fields.related.ForeignKey')(related_name='introvideo_set', to=orm['page.Page'])),
17
            ('region', self.gf('django.db.models.fields.CharField')(max_length=255)),
18
            ('ordering', self.gf('django.db.models.fields.IntegerField')(default=0)),
19
        ))
20
        db.send_create_signal('page', ['IntroVideo'])
21

  
22
        # Adding model 'StatsBlock'
23
        db.create_table('page_page_statsblock', (
24
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
25
            ('title', self.gf('django.db.models.fields.CharField')(max_length=200, blank=True)),
26
            ('color', self.gf('django.db.models.fields.CharField')(max_length=200, null=True, blank=True)),
27
            ('running_vms', self.gf('django.db.models.fields.BooleanField')(default=False)),
28
            ('spawned_vms', self.gf('django.db.models.fields.BooleanField')(default=True)),
29
            ('active_vms', self.gf('django.db.models.fields.BooleanField')(default=True)),
30
            ('running_networks', self.gf('django.db.models.fields.BooleanField')(default=False)),
31
            ('spawned_networks', self.gf('django.db.models.fields.BooleanField')(default=True)),
32
            ('active_networks', self.gf('django.db.models.fields.BooleanField')(default=False)),
33
            ('title_running_vms', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
34
            ('title_spawned_vms', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
35
            ('title_active_vms', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
36
            ('title_running_networks', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
37
            ('title_spawned_networks', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
38
            ('title_active_networks', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
39
            ('compute_url', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
40
            ('parent', self.gf('django.db.models.fields.related.ForeignKey')(related_name='statsblock_set', to=orm['page.Page'])),
41
            ('region', self.gf('django.db.models.fields.CharField')(max_length=255)),
42
            ('ordering', self.gf('django.db.models.fields.IntegerField')(default=0)),
43
        ))
44
        db.send_create_signal('page', ['StatsBlock'])
45

  
46
        # Adding field 'Page.featured'
47
        db.add_column('page_page', 'featured', self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False)
48

  
49

  
50
    def backwards(self, orm):
51
        
52
        # Deleting model 'IntroVideo'
53
        db.delete_table('page_page_introvideo')
54

  
55
        # Deleting model 'StatsBlock'
56
        db.delete_table('page_page_statsblock')
57

  
58
        # Deleting field 'Page.featured'
59
        db.delete_column('page_page', 'featured')
60

  
61

  
62
    models = {
63
        'cloudcms.client': {
64
            'Meta': {'object_name': 'Client'},
65
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
66
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
67
            'uid': ('django.db.models.fields.CharField', [], {'max_length': '255'})
68
        },
69
        'medialibrary.category': {
70
            'Meta': {'ordering': "['parent__title', 'title']", 'object_name': 'Category'},
71
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
72
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['medialibrary.Category']"}),
73
            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '150', 'db_index': 'True'}),
74
            'title': ('django.db.models.fields.CharField', [], {'max_length': '200'})
75
        },
76
        'medialibrary.mediafile': {
77
            'Meta': {'object_name': 'MediaFile'},
78
            'categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['medialibrary.Category']", 'null': 'True', 'blank': 'True'}),
79
            'copyright': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
80
            'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
81
            'file': ('django.db.models.fields.files.FileField', [], {'max_length': '255'}),
82
            'file_size': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
83
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
84
            'type': ('django.db.models.fields.CharField', [], {'max_length': '12'})
85
        },
86
        'page.aboutblock': {
87
            'Meta': {'ordering': "['ordering']", 'object_name': 'AboutBlock', 'db_table': "'page_page_aboutblock'"},
88
            'color': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
89
            'content': ('django.db.models.fields.TextField', [], {}),
90
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
91
            'image': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'to': "orm['medialibrary.MediaFile']", 'null': 'True', 'blank': 'True'}),
92
            'image_position': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
93
            'offset_left': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
94
            'offset_top': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
95
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
96
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'aboutblock_set'", 'to': "orm['page.Page']"}),
97
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
98
            'title': ('django.db.models.fields.CharField', [], {'max_length': '200'})
99
        },
100
        'page.applicationcontent': {
101
            'Meta': {'ordering': "['ordering']", 'object_name': 'ApplicationContent', 'db_table': "'page_page_applicationcontent'"},
102
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
103
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
104
            'parameters': ('feincms.contrib.fields.JSONField', [], {'null': 'True'}),
105
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'applicationcontent_set'", 'to': "orm['page.Page']"}),
106
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
107
            'urlconf_path': ('django.db.models.fields.CharField', [], {'max_length': '100'})
108
        },
109
        'page.blockcolor': {
110
            'Meta': {'ordering': "['ordering']", 'object_name': 'BlockColor', 'db_table': "'page_page_blockcolor'"},
111
            'color': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
112
            'content': ('django.db.models.fields.TextField', [], {}),
113
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
114
            'image': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'to': "orm['medialibrary.MediaFile']", 'null': 'True', 'blank': 'True'}),
115
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
116
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'blockcolor_set'", 'to': "orm['page.Page']"}),
117
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
118
            'title': ('django.db.models.fields.CharField', [], {'max_length': '200'})
119
        },
120
        'page.clientdownload': {
121
            'Meta': {'ordering': "['ordering']", 'object_name': 'ClientDownload', 'db_table': "'page_page_clientdownload'"},
122
            'client': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cloudcms.Client']"}),
123
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
124
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
125
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'clientdownload_set'", 'to': "orm['page.Page']"}),
126
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'})
127
        },
128
        'page.imagecontent': {
129
            'Meta': {'ordering': "['ordering']", 'object_name': 'ImageContent', 'db_table': "'page_page_imagecontent'"},
130
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
131
            'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}),
132
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
133
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'imagecontent_set'", 'to': "orm['page.Page']"}),
134
            'position': ('django.db.models.fields.CharField', [], {'default': "'default'", 'max_length': '10'}),
135
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'})
136
        },
137
        'page.introblock': {
138
            'Meta': {'ordering': "['ordering']", 'object_name': 'IntroBlock', 'db_table': "'page_page_introblock'"},
139
            'class_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
140
            'content': ('django.db.models.fields.TextField', [], {}),
141
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
142
            'image': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'to': "orm['medialibrary.MediaFile']", 'null': 'True', 'blank': 'True'}),
143
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
144
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'introblock_set'", 'to': "orm['page.Page']"}),
145
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
146
            'title': ('django.db.models.fields.CharField', [], {'max_length': '200'})
147
        },
148
        'page.introbutton': {
149
            'Meta': {'ordering': "['ordering']", 'object_name': 'IntroButton', 'db_table': "'page_page_introbutton'"},
150
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
151
            'image_1': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'blank': 'True', 'related_name': "'as_image1'", 'null': 'True', 'to': "orm['medialibrary.MediaFile']"}),
152
            'image_2': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'blank': 'True', 'related_name': "'as_image2'", 'null': 'True', 'to': "orm['medialibrary.MediaFile']"}),
153
            'image_3': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'blank': 'True', 'related_name': "'as_image3'", 'null': 'True', 'to': "orm['medialibrary.MediaFile']"}),
154
            'link': ('django.db.models.fields.CharField', [], {'default': "'/welcome'", 'max_length': '255'}),
155
            'link_title': ('django.db.models.fields.CharField', [], {'default': "'~okeanos'", 'max_length': '255'}),
156
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
157
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'introbutton_set'", 'to': "orm['page.Page']"}),
158
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'})
159
        },
160
        'page.introvideo': {
161
            'Meta': {'ordering': "['ordering']", 'object_name': 'IntroVideo', 'db_table': "'page_page_introvideo'"},
162
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
163
            'image': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'to': "orm['medialibrary.MediaFile']", 'null': 'True', 'blank': 'True'}),
164
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
165
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'introvideo_set'", 'to': "orm['page.Page']"}),
166
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
167
            'youtube_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})
168
        },
169
        'page.latestentries': {
170
            'Meta': {'ordering': "['ordering']", 'object_name': 'LatestEntries', 'db_table': "'page_page_latestentries'"},
171
            'display_text': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
172
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
173
            'limit': ('django.db.models.fields.PositiveIntegerField', [], {'default': '3'}),
174
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
175
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'latestentries_set'", 'to': "orm['page.Page']"}),
176
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
177
            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
178
        },
179
        'page.loginform': {
180
            'Meta': {'ordering': "['ordering']", 'object_name': 'LoginForm', 'db_table': "'page_page_loginform'"},
181
            'action_url': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
182
            'bottom_content': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
183
            'display_forgot_password': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
184
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
185
            'logged_in_content': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
186
            'next_url': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
187
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
188
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'loginform_set'", 'to': "orm['page.Page']"}),
189
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
190
            'title': ('django.db.models.fields.CharField', [], {'max_length': '200'})
191
        },
192
        'page.mediafilecontent': {
193
            'Meta': {'ordering': "['ordering']", 'object_name': 'MediaFileContent', 'db_table': "'page_page_mediafilecontent'"},
194
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
195
            'mediafile': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'related_name': "'+'", 'to': "orm['medialibrary.MediaFile']"}),
196
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
197
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'mediafilecontent_set'", 'to': "orm['page.Page']"}),
198
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
199
            'type': ('django.db.models.fields.CharField', [], {'default': "'lightbox'", 'max_length': '20'})
200
        },
201
        'page.page': {
202
            'Meta': {'ordering': "['tree_id', 'lft']", 'object_name': 'Page'},
203
            '_cached_url': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '300', 'db_index': 'True', 'blank': 'True'}),
204
            '_content_title': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
205
            '_page_title': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
206
            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
207
            'creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
208
            'featured': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
209
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
210
            'in_navigation': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
211
            'language': ('django.db.models.fields.CharField', [], {'default': "'en'", 'max_length': '10'}),
212
            'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
213
            'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
214
            'meta_description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
215
            'meta_keywords': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
216
            'modification_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
217
            'navigation_extension': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
218
            'override_url': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}),
219
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['page.Page']"}),
220
            'publication_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 6, 18, 14, 15)'}),
221
            'publication_end_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
222
            'redirect_to': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}),
223
            'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
224
            'site': ('django.db.models.fields.related.ForeignKey', [], {'default': '1', 'to': "orm['sites.Site']"}),
225
            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '150', 'db_index': 'True'}),
226
            'symlinked_page': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'page_page_symlinks'", 'null': 'True', 'to': "orm['page.Page']"}),
227
            'template_key': ('django.db.models.fields.CharField', [], {'default': "'twocolwide'", 'max_length': '255'}),
228
            'title': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
229
            'translation_of': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'translations'", 'null': 'True', 'to': "orm['page.Page']"}),
230
            'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})
231
        },
232
        'page.rawcontent': {
233
            'Meta': {'ordering': "['ordering']", 'object_name': 'RawContent', 'db_table': "'page_page_rawcontent'"},
234
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
235
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
236
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'rawcontent_set'", 'to': "orm['page.Page']"}),
237
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
238
            'text': ('django.db.models.fields.TextField', [], {'blank': 'True'})
239
        },
240
        'page.resourceslist': {
241
            'Meta': {'ordering': "['ordering']", 'object_name': 'ResourcesList', 'db_table': "'page_page_resourceslist'"},
242
            'filter_title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
243
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
244
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
245
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'resourceslist_set'", 'to': "orm['page.Page']"}),
246
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'})
247
        },
248
        'page.richtextcontent': {
249
            'Meta': {'ordering': "['ordering']", 'object_name': 'RichTextContent', 'db_table': "'page_page_richtextcontent'"},
250
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
251
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
252
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'richtextcontent_set'", 'to': "orm['page.Page']"}),
253
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
254
            'text': ('django.db.models.fields.TextField', [], {'blank': 'True'})
255
        },
256
        'page.sectioncontent': {
257
            'Meta': {'ordering': "['ordering']", 'object_name': 'SectionContent', 'db_table': "'page_page_sectioncontent'"},
258
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
259
            'mediafile': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'page_sectioncontent_set'", 'null': 'True', 'to': "orm['medialibrary.MediaFile']"}),
260
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
261
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'sectioncontent_set'", 'to': "orm['page.Page']"}),
262
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
263
            'richtext': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
264
            'title': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
265
            'type': ('django.db.models.fields.CharField', [], {'default': "'block'", 'max_length': '10'})
266
        },
267
        'page.statsblock': {
268
            'Meta': {'ordering': "['ordering']", 'object_name': 'StatsBlock', 'db_table': "'page_page_statsblock'"},
269
            'active_networks': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
270
            'active_vms': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
271
            'color': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
272
            'compute_url': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
273
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
274
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
275
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'statsblock_set'", 'to': "orm['page.Page']"}),
276
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
277
            'running_networks': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
278
            'running_vms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
279
            'spawned_networks': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
280
            'spawned_vms': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
281
            'title': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
282
            'title_active_networks': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
283
            'title_active_vms': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
284
            'title_running_networks': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
285
            'title_running_vms': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
286
            'title_spawned_networks': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
287
            'title_spawned_vms': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})
288
        },
289
        'page.templatecontent': {
290
            'Meta': {'ordering': "['ordering']", 'object_name': 'TemplateContent', 'db_table': "'page_page_templatecontent'"},
291
            'filename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
292
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
293
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
294
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'templatecontent_set'", 'to': "orm['page.Page']"}),
295
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'})
296
        },
297
        'page.textilecontent': {
298
            'Meta': {'ordering': "['ordering']", 'object_name': 'TextileContent', 'db_table': "'page_page_textilecontent'"},
299
            'content': ('django.db.models.fields.TextField', [], {}),
300
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
301
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
302
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'textilecontent_set'", 'to': "orm['page.Page']"}),
303
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'})
304
        },
305
        'page.twitterfeed': {
306
            'Meta': {'ordering': "['ordering']", 'object_name': 'TwitterFeed', 'db_table': "'page_page_twitterfeed'"},
307
            'account': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
308
            'avatar': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
309
            'extra_params': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
310
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
311
            'limit': ('django.db.models.fields.PositiveIntegerField', [], {'default': '10'}),
312
            'nots': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
313
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
314
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'twitterfeed_set'", 'to': "orm['page.Page']"}),
315
            'query': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
316
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
317
            'replies': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
318
            'retweets': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
319
            'tag': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
320
            'title': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'})
321
        },
322
        'page.videocontent': {
323
            'Meta': {'ordering': "['ordering']", 'object_name': 'VideoContent', 'db_table': "'page_page_videocontent'"},
324
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
325
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
326
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'videocontent_set'", 'to': "orm['page.Page']"}),
327
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
328
            'video': ('django.db.models.fields.URLField', [], {'max_length': '200'})
329
        },
330
        'page.videosection': {
331
            'Meta': {'ordering': "['ordering']", 'object_name': 'VideoSection', 'db_table': "'page_page_videosection'"},
332
            'alt_text': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
333
            'extra_url_params': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
334
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
335
            'image': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'blank': 'True', 'related_name': "'as_image_for_video_section'", 'null': 'True', 'to': "orm['medialibrary.MediaFile']"}),
336
            'image_hover': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'blank': 'True', 'related_name': "'as_hover_for_video_section'", 'null': 'True', 'to': "orm['medialibrary.MediaFile']"}),
337
            'ordering': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
338
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'videosection_set'", 'to': "orm['page.Page']"}),
339
            'region': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
340
            'section_title': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
341
            'video_height': ('django.db.models.fields.PositiveIntegerField', [], {'default': '550'}),
342
            'video_link': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
343
            'video_title': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
344
            'video_width': ('django.db.models.fields.PositiveIntegerField', [], {'default': '700'})
345
        },
346
        'sites.site': {
347
            'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
348
            'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
349
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
350
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
351
        }
352
    }
353

  
354
    complete_apps = ['page']
b/cloudcms/migrations/0016_auto__add_field_application_accounts_url.py
1
# encoding: utf-8
2
import datetime
3
from south.db import db
4
from south.v2 import SchemaMigration
5
from django.db import models
6

  
7
class Migration(SchemaMigration):
8

  
9
    def forwards(self, orm):
10
        
11
        # Adding field 'Application.accounts_url'
12
        db.add_column('cloudcms_application', 'accounts_url', self.gf('django.db.models.fields.URLField')(max_length=200, null=True, blank=True), keep_default=False)
13

  
14

  
15
    def backwards(self, orm):
16
        
17
        # Deleting field 'Application.accounts_url'
18
        db.delete_column('cloudcms_application', 'accounts_url')
19

  
20

  
21
    models = {
22
        'cloudcms.application': {
23
            'Meta': {'object_name': 'Application'},
24
            'accounts_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
25
            'app_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
26
            'code': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
27
            'custom_message': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
28
            'extra_styles': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
29
            'facebook_username': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
30
            'favicon': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'blank': 'True', 'related_name': "'as_favicon'", 'null': 'True', 'to': "orm['medialibrary.MediaFile']"}),
31
            'footer_bottom': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
32
            'footer_top': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
33
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
34
            'index_url': ('django.db.models.fields.CharField', [], {'default': "'/'", 'max_length': '255'}),
35
            'linked_in_username': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
36
            'logo': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'to': "orm['medialibrary.MediaFile']", 'null': 'True', 'blank': 'True'}),
37
            'message_type': ('django.db.models.fields.CharField', [], {'default': "'NM'", 'max_length': '20'}),
38
            'show_twitter_feed_on_top': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
39
            'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
40
            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
41
            'twitter_username': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'})
42
        },
43
        'cloudcms.client': {
44
            'Meta': {'object_name': 'Client'},
45
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
46
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
47
            'uid': ('django.db.models.fields.CharField', [], {'max_length': '255'})
48
        },
49
        'cloudcms.clientversionsource': {
50
            'Meta': {'object_name': 'ClientVersionSource'},
51
            'architecture': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
52
            'client': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cloudcms.Client']"}),
53
            'default': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
54
            'file_regex': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
55
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
56
            'link': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
57
            'logo': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'to': "orm['medialibrary.MediaFile']", 'null': 'True', 'blank': 'True'}),
58
            'os': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
59
            'source_type': ('django.db.models.fields.CharField', [], {'max_length': '60'}),
60
            'version_regex': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})
61
        },
62
        'cloudcms.service': {
63
            'Meta': {'ordering': "['-ordering']", 'object_name': 'Service'},
64
            'class_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
65
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
66
            'image_faq': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'blank': 'True', 'related_name': "'image_faq'", 'null': 'True', 'to': "orm['medialibrary.MediaFile']"}),
67
            'image_userguide': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'blank': 'True', 'related_name': "'image_userguide'", 'null': 'True', 'to': "orm['medialibrary.MediaFile']"}),
68
            'ordering': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'})
69
        },
70
        'cloudcms.servicetranslation': {
71
            'Meta': {'ordering': "['title']", 'object_name': 'ServiceTranslation'},
72
            'cms_page': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['page.Page']", 'null': 'True', 'blank': 'True'}),
73
            'description': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}),
74
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
75
            'language_code': ('django.db.models.fields.CharField', [], {'default': "'en'", 'max_length': '10'}),
76
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'translations'", 'to': "orm['cloudcms.Service']"}),
77
            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}),
78
            'title': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
79
            'title_faq': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
80
            'title_userguide': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})
81
        },
82
        'medialibrary.category': {
83
            'Meta': {'ordering': "['parent__title', 'title']", 'object_name': 'Category'},
84
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
85
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['medialibrary.Category']"}),
86
            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '150', 'db_index': 'True'}),
87
            'title': ('django.db.models.fields.CharField', [], {'max_length': '200'})
88
        },
89
        'medialibrary.mediafile': {
90
            'Meta': {'object_name': 'MediaFile'},
91
            'categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['medialibrary.Category']", 'null': 'True', 'blank': 'True'}),
92
            'copyright': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
93
            'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
94
            'file': ('django.db.models.fields.files.FileField', [], {'max_length': '255'}),
95
            'file_size': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
96
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
97
            'type': ('django.db.models.fields.CharField', [], {'max_length': '12'})
98
        },
99
        'page.page': {
100
            'Meta': {'ordering': "['tree_id', 'lft']", 'object_name': 'Page'},
101
            '_cached_url': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '300', 'db_index': 'True', 'blank': 'True'}),
102
            '_content_title': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
103
            '_page_title': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
104
            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
105
            'creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
106
            'featured': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
107
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
108
            'in_navigation': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
109
            'language': ('django.db.models.fields.CharField', [], {'default': "'en'", 'max_length': '10'}),
110
            'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
111
            'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
112
            'meta_description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
113
            'meta_keywords': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
114
            'modification_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
115
            'navigation_extension': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
116
            'override_url': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}),
117
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['page.Page']"}),
118
            'publication_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 6, 17, 12, 45)'}),
119
            'publication_end_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
120
            'redirect_to': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}),
121
            'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
122
            'site': ('django.db.models.fields.related.ForeignKey', [], {'default': '1', 'to': "orm['sites.Site']"}),
123
            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '150', 'db_index': 'True'}),
124
            'symlinked_page': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'page_page_symlinks'", 'null': 'True', 'to': "orm['page.Page']"}),
125
            'template_key': ('django.db.models.fields.CharField', [], {'default': "'twocolwide'", 'max_length': '255'}),
126
            'title': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
127
            'translation_of': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'translations'", 'null': 'True', 'to': "orm['page.Page']"}),
128
            'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})
129
        },
130
        'sites.site': {
131
            'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
132
            'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
133
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
134
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
135
        }
136
    }
137

  
138
    complete_apps = ['cloudcms']
b/cloudcms/migrations/0017_auto__chg_field_application_accounts_url.py
1
# encoding: utf-8
2
import datetime
3
from south.db import db
4
from south.v2 import SchemaMigration
5
from django.db import models
6

  
7
class Migration(SchemaMigration):
8

  
9
    def forwards(self, orm):
10
        
11
        # Changing field 'Application.accounts_url'
12
        db.alter_column('cloudcms_application', 'accounts_url', self.gf('django.db.models.fields.CharField')(max_length=255, null=True))
13

  
14

  
15
    def backwards(self, orm):
16
        
17
        # Changing field 'Application.accounts_url'
18
        db.alter_column('cloudcms_application', 'accounts_url', self.gf('django.db.models.fields.URLField')(max_length=200, null=True))
19

  
20

  
21
    models = {
22
        'cloudcms.application': {
23
            'Meta': {'object_name': 'Application'},
24
            'accounts_url': ('django.db.models.fields.CharField', [], {'default': "'/'", 'max_length': '255', 'null': 'True', 'blank': 'True'}),
25
            'app_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
26
            'code': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
27
            'custom_message': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
28
            'extra_styles': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
29
            'facebook_username': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
30
            'favicon': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'blank': 'True', 'related_name': "'as_favicon'", 'null': 'True', 'to': "orm['medialibrary.MediaFile']"}),
31
            'footer_bottom': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
32
            'footer_top': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
33
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
34
            'index_url': ('django.db.models.fields.CharField', [], {'default': "'/'", 'max_length': '255'}),
35
            'linked_in_username': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
36
            'logo': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'to': "orm['medialibrary.MediaFile']", 'null': 'True', 'blank': 'True'}),
37
            'message_type': ('django.db.models.fields.CharField', [], {'default': "'NM'", 'max_length': '20'}),
38
            'show_twitter_feed_on_top': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
39
            'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
40
            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
41
            'twitter_username': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'})
42
        },
43
        'cloudcms.client': {
44
            'Meta': {'object_name': 'Client'},
45
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
46
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
47
            'uid': ('django.db.models.fields.CharField', [], {'max_length': '255'})
48
        },
49
        'cloudcms.clientversionsource': {
50
            'Meta': {'object_name': 'ClientVersionSource'},
51
            'architecture': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
52
            'client': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cloudcms.Client']"}),
53
            'default': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
54
            'file_regex': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
55
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
56
            'link': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
57
            'logo': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'to': "orm['medialibrary.MediaFile']", 'null': 'True', 'blank': 'True'}),
58
            'os': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
59
            'source_type': ('django.db.models.fields.CharField', [], {'max_length': '60'}),
60
            'version_regex': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})
61
        },
62
        'cloudcms.service': {
63
            'Meta': {'ordering': "['-ordering']", 'object_name': 'Service'},
64
            'class_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
65
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
66
            'image_faq': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'blank': 'True', 'related_name': "'image_faq'", 'null': 'True', 'to': "orm['medialibrary.MediaFile']"}),
67
            'image_userguide': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'blank': 'True', 'related_name': "'image_userguide'", 'null': 'True', 'to': "orm['medialibrary.MediaFile']"}),
68
            'ordering': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'})
69
        },
70
        'cloudcms.servicetranslation': {
71
            'Meta': {'ordering': "['title']", 'object_name': 'ServiceTranslation'},
72
            'cms_page': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['page.Page']", 'null': 'True', 'blank': 'True'}),
73
            'description': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}),
74
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
75
            'language_code': ('django.db.models.fields.CharField', [], {'default': "'en'", 'max_length': '10'}),
76
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'translations'", 'to': "orm['cloudcms.Service']"}),
77
            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}),
78
            'title': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
79
            'title_faq': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
80
            'title_userguide': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})
81
        },
82
        'medialibrary.category': {
83
            'Meta': {'ordering': "['parent__title', 'title']", 'object_name': 'Category'},
84
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
85
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['medialibrary.Category']"}),
86
            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '150', 'db_index': 'True'}),
87
            'title': ('django.db.models.fields.CharField', [], {'max_length': '200'})
88
        },
89
        'medialibrary.mediafile': {
90
            'Meta': {'object_name': 'MediaFile'},
91
            'categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['medialibrary.Category']", 'null': 'True', 'blank': 'True'}),
92
            'copyright': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
93
            'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
94
            'file': ('django.db.models.fields.files.FileField', [], {'max_length': '255'}),
95
            'file_size': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
96
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
97
            'type': ('django.db.models.fields.CharField', [], {'max_length': '12'})
98
        },
99
        'page.page': {
100
            'Meta': {'ordering': "['tree_id', 'lft']", 'object_name': 'Page'},
101
            '_cached_url': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '300', 'db_index': 'True', 'blank': 'True'}),
102
            '_content_title': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
103
            '_page_title': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
104
            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
105
            'creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
106
            'featured': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
107
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
108
            'in_navigation': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
109
            'language': ('django.db.models.fields.CharField', [], {'default': "'en'", 'max_length': '10'}),
110
            'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
111
            'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
112
            'meta_description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
113
            'meta_keywords': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
114
            'modification_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
115
            'navigation_extension': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
116
            'override_url': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}),
117
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['page.Page']"}),
118
            'publication_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 6, 17, 12, 50)'}),
119
            'publication_end_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
120
            'redirect_to': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}),
121
            'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
122
            'site': ('django.db.models.fields.related.ForeignKey', [], {'default': '1', 'to': "orm['sites.Site']"}),
123
            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '150', 'db_index': 'True'}),
124
            'symlinked_page': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'page_page_symlinks'", 'null': 'True', 'to': "orm['page.Page']"}),
125
            'template_key': ('django.db.models.fields.CharField', [], {'default': "'twocolwide'", 'max_length': '255'}),
126
            'title': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
127
            'translation_of': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'translations'", 'null': 'True', 'to': "orm['page.Page']"}),
128
            'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})
129
        },
130
        'sites.site': {
131
            'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
132
            'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
133
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
134
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
135
        }
136
    }
137

  
138
    complete_apps = ['cloudcms']
b/cloudcms/models.py
77 77
            related_name="as_favicon")
78 78
    site = models.ForeignKey(sites_models.Site)
79 79
    app_url = models.URLField(help_text="The url of the application UI (not "\
80
            "the cms", verify_exists=False, blank=True, null=True)
80
            "the cms)", verify_exists=False, blank=True, null=True)
81
    accounts_url = models.CharField(max_length=255, default="/", blank=True,
82
            null=True, help_text="Tha accounts login page")
81 83
    index_url = models.CharField(max_length=255, default="/", blank=False,
82 84
            null=False)
83 85
    linked_in_username = models.CharField(max_length=255, blank=True)
......
94 96
                                    choices= MESSAGE_TYPE_CHOICES,
95 97
                                    default = 'NM' )
96 98
    custom_message = models.TextField(default="", blank=True)
97

  
99
    
98 100
    @classmethod
99 101
    def current(cls):
100 102
        return cls.objects.get(site__pk=settings.SITE_ID)
b/cloudcms/static/cloudcms/css/modules.css
221 221
.container ul.options li a.tirkouaz				{ color:#00A1B0; }
222 222
.container ul.options li a.tirkouaz:hover		{ border-bottom:1px solid #00A1B0; }
223 223
/* homepage clouds animation */
224
#animation                                      { width:94%; height:120px; padding:0 3%; background:url(../images/okeanos_landing.png) no-repeat; max-width:375px; }
224
#animation                                      { width:94%; height:120px;  background:url(../images/okeanos_landing.png) no-repeat; max-width:375px; }
225 225
#animation div                                  { margin:0 2%; float:left; width:29%; height:100%; position:relative; }                    
226 226
#animation div a                                { position:absolute; left:0; top:0; border:0 none; }
227 227
#animation div a img							{ width:100%; }
228 228
#animation p                                  	{ position:absolute; bottom:0; left:0; width:100%; text-align:center; }
229 229
#animation p img                                { display:inline-block; width:65%; }
230
.lt #animation 									{ margin-top: 3em;}
230 231

  
231 232
/* Weird bug in pages that contain captcha. An extra iframe appears in chrome :S*/
232 233
.container +iframe								{ display:none; }
......
642 643
@media screen and (max-height : 370px) 		{ 
643 644
	.fixed 	{ position:static; }
644 645
    
645
}
646
}
647

  
648
.stats-block ul 								{ margin:0 0 1em; padding:0;}
649
.stats-block ul li 								{ list-style: none outside none; display: block; float: left; width:28%; margin:0 2% 1em; }
650
.stats-block ul li em 							{ display: block; font-style: normal;}
651
.stats-block ul li span 						{ display: block; color:#F24E53; font-size:32px; } 
652

  
653
		  
654
a.prompt										{ float: right; color:#fff; background:#F24E53;   padding:5px 20px;position: relative; right: -0; top:-4px;display: none; border: 2px solid transparent;} 
655
a.prompt:hover									{ text-decoration: none; position: relative;   border: 2px solid #F24E53; background: #fff; color:#F24E53;}
656
.user-not-authenticated	a.prompt				{ display: inline-block;}
657

  
658
.video-thumb									{ border:2px dashed #3582AC;  overflow: hidden; height: 282px; position: relative;}
659
.video-thumb .play								{ position: absolute; top:0; left:0; height: 100%;width: 100%; display: block; background:url(../images/play-off.png) no-repeat center center; text-indent: -1000px }
660
.video-thumb .play:hover						{ background-image: url(../images/play-on.png); text-decoration: none;}
b/cloudcms/static/cloudcms/js/common.js
18 18
	var ColWidth = parseFloat( (100 - firstColWidth)/ColsNum ).toFixed(0);
19 19
	var ColWidthPercentage = ColWidth+'%';
20 20
	var firstColWidthPercentage = firstColWidth+'%';
21
	$('table th, table td').attr('width',ColWidthPercentage ); 
22
	$('table tr td:first-child, table tr th:first-child').attr('width',firstColWidthPercentage );
21
	$('.projects table th, .projects  table td').attr('width',ColWidthPercentage ); 
22
	$('.projects table tr td:first-child,.projects  table tr th:first-child').attr('width',firstColWidthPercentage );
23 23
	
24 24
}
25 25

  
......
83 83
	document.addEventListener("gesturestart", gestureStart, false);
84 84
}
85 85
//end of fix
86

  
86 87
  
87 88
$(document).ready(function() {
88 89
   
90

  
91

  
89 92
    setContainerMinHeight('.container .wrapper');
90 93
    tableFixedCols('my-projects', 25);
91 94
	
......
153 156
      function () {
154 157
      	
155 158
        $(this).animate({
156
           top: '+=-10'   
157
           }, 600, function() {
159
           top: '+=-3'   
160
           }, 0, function() {
158 161
           	if ($(this).find('img').attr('src').indexOf("_top") == -1) {
159 162
           		var src = $(this).find('img').attr('src').replace('.png', '_top.png')
160 163
        		$(this).find('img').attr("src", src);
......
330 333
	$('#okeanos_recaptcha').parents('.form-row').find('.extra-img').hide();
331 334

  
332 335
  fixEl = $('.details .lt');
333
  window.fixEloffsetTop = fixEl.offset().top;
334
   
336
  if (fixEl.length){ window.fixEloffsetTop = fixEl.offset().top;} 
337
  
338

  
339
  $(".stats-block li em").equalHeights();
340

  
341
 
335 342
});
336 343
	
337 344
$(window).resize(function() {
b/cloudcms/static/cloudcms/js/service-stats.js
1
var cloudcms = {};
2
cloudcms.utils = {};
3

  
4
cloudcms.utils.addCommas = function(nStr)
5
{
6
	nStr += '';
7
	x = nStr.split('.');
8
	x1 = x[0];
9
	x2 = x.length > 1 ? '.' + x[1] : '';
10
	var rgx = /(\d+)(\d{3})/;
11
	while (rgx.test(x1)) {
12
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
13
	}
14
	return x1 + x2;
15
}
16

  
17
function ServiceStats(opts, wrapper) {
18
	this.options = opts;
19
	this.wrapper = wrapper; 
20
}
21

  
22

  
23
ServiceStats.prototype.updateStats = function(data) {
24
	var self = this;
25
	function filldata(value, key) {
26
		self.wrapper.find("li."+key).find('span').text(cloudcms.utils.addCommas(value));
27
	}
28
	_.each(data,filldata);
29
}
30

  
31

  
32
ServiceStats.prototype.addArray = function(data) {
33
	return _.reduce(data, function(memo, num){ return memo + num; }, 0);
34
}
35

  
36

  
37
ServiceStats.prototype.getActive = function(data) {
38
	var active = _.omit(data,'DELETED');
39
	var active_count =  _.pluck(active, 'count');
40
	return this.addArray(active_count);
41
}
42

  
43
ServiceStats.prototype.getAll = function(data) {
44
	return this.addArray(_.pluck(data, 'count'));
45
} 
46

  
47
ServiceStats.prototype.loadStats = function() {
48
	var self = this;
49
	if (this.options.compute_url) {
50
		$.ajax({
51
			url: this.options.compute_url,
52
			dataType:'jsonp',
53
			success: function(data) {	
54
				self.updateStats({
55
					'running_vms': data.servers.ACTIVE.count, 
56
					'active_vms': self.getActive(data.servers),
57
					'spawned_vms': self.getAll(data.servers),
58
					'running_networks': data.networks.ACTIVE.count, 
59
					'active_networks': self.getActive(data.networks),
60
					'spawned_networks': self.getAll(data.networks),
61

  
62
				})
63
			}
64
		})	
65
	}
66
	if (this.options.storage_url) {
67
		$.ajax({
68
			url: this.options.storage,
69
			success: function(data) {
70
				self.storage.find("span").text(data.storage);
71
			}
72
		})	
73
	}
74
}
75

  
76
ServiceStats.prototype.startUpdate = function(interval) {
77
	var self = this;
78
	self.loadStats();
79
	window.setTimeout(function(){ 
80
		self.startUpdate(interval);
81
	}, interval);
82
}
b/cloudcms/static/cloudcms/js/underscore.js
1
//     Underscore.js 1.3.3
2
//     (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
3
//     Underscore is freely distributable under the MIT license.
4
//     Portions of Underscore are inspired or borrowed from Prototype,
5
//     Oliver Steele's Functional, and John Resig's Micro-Templating.
6
//     For all details and documentation:
7
//     http://documentcloud.github.com/underscore
1
// Underscore.js 1.4.4
2
// ===================
8 3

  
9
(function() {
4
// > http://underscorejs.org
5
// > (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
6
// > Underscore may be freely distributed under the MIT license.
10 7

  
11
  // Baseline setup
12
  // --------------
8
// Baseline setup
9
// --------------
10
(function() {
13 11

  
14 12
  // Establish the root object, `window` in the browser, or `global` on the server.
15 13
  var root = this;
......
24 22
  var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
25 23

  
26 24
  // Create quick reference variables for speed access to core prototypes.
27
  var slice            = ArrayProto.slice,
28
      unshift          = ArrayProto.unshift,
25
  var push             = ArrayProto.push,
26
      slice            = ArrayProto.slice,
27
      concat           = ArrayProto.concat,
29 28
      toString         = ObjProto.toString,
30 29
      hasOwnProperty   = ObjProto.hasOwnProperty;
31 30

  
......
46 45
    nativeBind         = FuncProto.bind;
47 46

  
48 47
  // Create a safe reference to the Underscore object for use below.
49
  var _ = function(obj) { return new wrapper(obj); };
48
  var _ = function(obj) {
49
    if (obj instanceof _) return obj;
50
    if (!(this instanceof _)) return new _(obj);
51
    this._wrapped = obj;
52
  };
50 53

  
51 54
  // Export the Underscore object for **Node.js**, with
52 55
  // backwards-compatibility for the old `require()` API. If we're in
......
58 61
    }
59 62
    exports._ = _;
60 63
  } else {
61
    root['_'] = _;
64
    root._ = _;
62 65
  }
63 66

  
64 67
  // Current version.
65
  _.VERSION = '1.3.3';
68
  _.VERSION = '1.4.4';
66 69

  
67 70
  // Collection Functions
68 71
  // --------------------
......
76 79
      obj.forEach(iterator, context);
77 80
    } else if (obj.length === +obj.length) {
78 81
      for (var i = 0, l = obj.length; i < l; i++) {
79
        if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return;
82
        if (iterator.call(context, obj[i], i, obj) === breaker) return;
80 83
      }
81 84
    } else {
82 85
      for (var key in obj) {
......
96 99
    each(obj, function(value, index, list) {
97 100
      results[results.length] = iterator.call(context, value, index, list);
98 101
    });
99
    if (obj.length === +obj.length) results.length = obj.length;
100 102
    return results;
101 103
  };
102 104

  
105
  var reduceError = 'Reduce of empty array with no initial value';
106

  
103 107
  // **Reduce** builds up a single result from a list of values, aka `inject`,
104 108
  // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
105 109
  _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
......
117 121
        memo = iterator.call(context, memo, value, index, list);
118 122
      }
119 123
    });
120
    if (!initial) throw new TypeError('Reduce of empty array with no initial value');
124
    if (!initial) throw new TypeError(reduceError);
121 125
    return memo;
122 126
  };
123 127

  
......
130 134
      if (context) iterator = _.bind(iterator, context);
131 135
      return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
132 136
    }
133
    var reversed = _.toArray(obj).reverse();
134
    if (context && !initial) iterator = _.bind(iterator, context);
135
    return initial ? _.reduce(reversed, iterator, memo, context) : _.reduce(reversed, iterator);
137
    var length = obj.length;
138
    if (length !== +length) {
139
      var keys = _.keys(obj);
140
      length = keys.length;
141
    }
142
    each(obj, function(value, index, list) {
143
      index = keys ? keys[--length] : --length;
144
      if (!initial) {
145
        memo = obj[index];
146
        initial = true;
147
      } else {
148
        memo = iterator.call(context, memo, obj[index], index, list);
149
      }
150
    });
151
    if (!initial) throw new TypeError(reduceError);
152
    return memo;
136 153
  };
137 154

  
138 155
  // Return the first value which passes a truth test. Aliased as `detect`.
......
162 179

  
163 180
  // Return all the elements for which a truth test fails.
164 181
  _.reject = function(obj, iterator, context) {
165
    var results = [];
166
    if (obj == null) return results;
167
    each(obj, function(value, index, list) {
168
      if (!iterator.call(context, value, index, list)) results[results.length] = value;
169
    });
170
    return results;
182
    return _.filter(obj, function(value, index, list) {
183
      return !iterator.call(context, value, index, list);
184
    }, context);
171 185
  };
172 186

  
173 187
  // Determine whether all of the elements match a truth test.
174 188
  // Delegates to **ECMAScript 5**'s native `every` if available.
175 189
  // Aliased as `all`.
176 190
  _.every = _.all = function(obj, iterator, context) {
191
    iterator || (iterator = _.identity);
177 192
    var result = true;
178 193
    if (obj == null) return result;
179 194
    if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context);
......
197 212
    return !!result;
198 213
  };
199 214

  
200
  // Determine if a given value is included in the array or object using `===`.
201
  // Aliased as `contains`.
202
  _.include = _.contains = function(obj, target) {
203
    var found = false;
204
    if (obj == null) return found;
215
  // Determine if the array or object contains a given value (using `===`).
216
  // Aliased as `include`.
217
  _.contains = _.include = function(obj, target) {
218
    if (obj == null) return false;
205 219
    if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
206
    found = any(obj, function(value) {
220
    return any(obj, function(value) {
207 221
      return value === target;
208 222
    });
209
    return found;
210 223
  };
211 224

  
212 225
  // Invoke a method (with arguments) on every item in a collection.
213 226
  _.invoke = function(obj, method) {
214 227
    var args = slice.call(arguments, 2);
228
    var isFunc = _.isFunction(method);
215 229
    return _.map(obj, function(value) {
216
      return (_.isFunction(method) ? method || value : value[method]).apply(value, args);
230
      return (isFunc ? method : value[method]).apply(value, args);
217 231
    });
218 232
  };
219 233

  
......
222 236
    return _.map(obj, function(value){ return value[key]; });
223 237
  };
224 238

  
239
  // Convenience version of a common use case of `filter`: selecting only objects
240
  // containing specific `key:value` pairs.
241
  _.where = function(obj, attrs, first) {
242
    if (_.isEmpty(attrs)) return first ? null : [];
243
    return _[first ? 'find' : 'filter'](obj, function(value) {
244
      for (var key in attrs) {
245
        if (attrs[key] !== value[key]) return false;
246
      }
247
      return true;
248
    });
249
  };
250

  
251
  // Convenience version of a common use case of `find`: getting the first object
252
  // containing specific `key:value` pairs.
253
  _.findWhere = function(obj, attrs) {
254
    return _.where(obj, attrs, true);
255
  };
256

  
225 257
  // Return the maximum element or (element-based computation).
258
  // Can't optimize arrays of integers longer than 65,535 elements.
259
  // See: https://bugs.webkit.org/show_bug.cgi?id=80797
226 260
  _.max = function(obj, iterator, context) {
227
    if (!iterator && _.isArray(obj) && obj[0] === +obj[0]) return Math.max.apply(Math, obj);
261
    if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
262
      return Math.max.apply(Math, obj);
263
    }
228 264
    if (!iterator && _.isEmpty(obj)) return -Infinity;
229
    var result = {computed : -Infinity};
265
    var result = {computed : -Infinity, value: -Infinity};
230 266
    each(obj, function(value, index, list) {
231 267
      var computed = iterator ? iterator.call(context, value, index, list) : value;
232 268
      computed >= result.computed && (result = {value : value, computed : computed});
......
236 272

  
237 273
  // Return the minimum element (or element-based computation).
238 274
  _.min = function(obj, iterator, context) {
239
    if (!iterator && _.isArray(obj) && obj[0] === +obj[0]) return Math.min.apply(Math, obj);
275
    if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
276
      return Math.min.apply(Math, obj);
277
    }
240 278
    if (!iterator && _.isEmpty(obj)) return Infinity;
241
    var result = {computed : Infinity};
279
    var result = {computed : Infinity, value: Infinity};
242 280
    each(obj, function(value, index, list) {
243 281
      var computed = iterator ? iterator.call(context, value, index, list) : value;
244 282
      computed < result.computed && (result = {value : value, computed : computed});
......
248 286

  
249 287
  // Shuffle an array.
250 288
  _.shuffle = function(obj) {
251
    var shuffled = [], rand;
252
    each(obj, function(value, index, list) {
253
      rand = Math.floor(Math.random() * (index + 1));
254
      shuffled[index] = shuffled[rand];
289
    var rand;
290
    var index = 0;
291
    var shuffled = [];
292
    each(obj, function(value) {
293
      rand = _.random(index++);
294
      shuffled[index - 1] = shuffled[rand];
255 295
      shuffled[rand] = value;
256 296
    });
257 297
    return shuffled;
258 298
  };
259 299

  
300
  // An internal function to generate lookup iterators.
301
  var lookupIterator = function(value) {
302
    return _.isFunction(value) ? value : function(obj){ return obj[value]; };
303
  };
304

  
260 305
  // Sort the object's values by a criterion produced by an iterator.
261
  _.sortBy = function(obj, val, context) {
262
    var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; };
306
  _.sortBy = function(obj, value, context) {
307
    var iterator = lookupIterator(value);
263 308
    return _.pluck(_.map(obj, function(value, index, list) {
264 309
      return {
265 310
        value : value,
311
        index : index,
266 312
        criteria : iterator.call(context, value, index, list)
267 313
      };
268 314
    }).sort(function(left, right) {
269
      var a = left.criteria, b = right.criteria;
270
      if (a === void 0) return 1;
271
      if (b === void 0) return -1;
272
      return a < b ? -1 : a > b ? 1 : 0;
315
      var a = left.criteria;
316
      var b = right.criteria;
317
      if (a !== b) {
318
        if (a > b || a === void 0) return 1;
319
        if (a < b || b === void 0) return -1;
320
      }
321
      return left.index < right.index ? -1 : 1;
273 322
    }), 'value');
274 323
  };
275 324

  
276
  // Groups the object's values by a criterion. Pass either a string attribute
277
  // to group by, or a function that returns the criterion.
278
  _.groupBy = function(obj, val) {
325
  // An internal function used for aggregate "group by" operations.
326
  var group = function(obj, value, context, behavior) {
279 327
    var result = {};
280
    var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; };
328
    var iterator = lookupIterator(value || _.identity);
281 329
    each(obj, function(value, index) {
282
      var key = iterator(value, index);
283
      (result[key] || (result[key] = [])).push(value);
330
      var key = iterator.call(context, value, index, obj);
331
      behavior(result, key, value);
284 332
    });
285 333
    return result;
286 334
  };
287 335

  
288
  // Use a comparator function to figure out at what index an object should
289
  // be inserted so as to maintain order. Uses binary search.
290
  _.sortedIndex = function(array, obj, iterator) {
291
    iterator || (iterator = _.identity);
336
  // Groups the object's values by a criterion. Pass either a string attribute
337
  // to group by, or a function that returns the criterion.
338
  _.groupBy = function(obj, value, context) {
339
    return group(obj, value, context, function(result, key, value) {
340
      (_.has(result, key) ? result[key] : (result[key] = [])).push(value);
341
    });
342
  };
343

  
344
  // Counts instances of an object that group by a certain criterion. Pass
345
  // either a string attribute to count by, or a function that returns the
346
  // criterion.
347
  _.countBy = function(obj, value, context) {
348
    return group(obj, value, context, function(result, key) {
349
      if (!_.has(result, key)) result[key] = 0;
350
      result[key]++;
351
    });
352
  };
353

  
354
  // Use a comparator function to figure out the smallest index at which
355
  // an object should be inserted so as to maintain order. Uses binary search.
356
  _.sortedIndex = function(array, obj, iterator, context) {
357
    iterator = iterator == null ? _.identity : lookupIterator(iterator);
358
    var value = iterator.call(context, obj);
292 359
    var low = 0, high = array.length;
293 360
    while (low < high) {
294
      var mid = (low + high) >> 1;
295
      iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid;
361
      var mid = (low + high) >>> 1;
362
      iterator.call(context, array[mid]) < value ? low = mid + 1 : high = mid;
296 363
    }
297 364
    return low;
298 365
  };
299 366

  
300 367
  // Safely convert anything iterable into a real, live array.
301 368
  _.toArray = function(obj) {
302
    if (!obj)                                     return [];
303
    if (_.isArray(obj))                           return slice.call(obj);
304
    if (_.isArguments(obj))                       return slice.call(obj);
305
    if (obj.toArray && _.isFunction(obj.toArray)) return obj.toArray();
369
    if (!obj) return [];
370
    if (_.isArray(obj)) return slice.call(obj);
371
    if (obj.length === +obj.length) return _.map(obj, _.identity);
306 372
    return _.values(obj);
307 373
  };
308 374

  
309 375
  // Return the number of elements in an object.
310 376
  _.size = function(obj) {
311
    return _.isArray(obj) ? obj.length : _.keys(obj).length;
377
    if (obj == null) return 0;
378
    return (obj.length === +obj.length) ? obj.length : _.keys(obj).length;
312 379
  };
313 380

  
314 381
  // Array Functions
......
318 385
  // values in the array. Aliased as `head` and `take`. The **guard** check
319 386
  // allows it to work with `_.map`.
320 387
  _.first = _.head = _.take = function(array, n, guard) {
388
    if (array == null) return void 0;
321 389
    return (n != null) && !guard ? slice.call(array, 0, n) : array[0];
322 390
  };
323 391

  
324
  // Returns everything but the last entry of the array. Especcialy useful on
392
  // Returns everything but the last entry of the array. Especially useful on
325 393
  // the arguments object. Passing **n** will return all the values in
326 394
  // the array, excluding the last N. The **guard** check allows it to work with
327 395
  // `_.map`.
......
332 400
  // Get the last element of an array. Passing **n** will return the last N
333 401
  // values in the array. The **guard** check allows it to work with `_.map`.
334 402
  _.last = function(array, n, guard) {
403
    if (array == null) return void 0;
335 404
    if ((n != null) && !guard) {
336 405
      return slice.call(array, Math.max(array.length - n, 0));
337 406
    } else {
......
339 408
    }
340 409
  };
341 410

  
342
  // Returns everything but the first entry of the array. Aliased as `tail`.
343
  // Especially useful on the arguments object. Passing an **index** will return
344
  // the rest of the values in the array from that index onward. The **guard**
411
  // Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
412
  // Especially useful on the arguments object. Passing an **n** will return
413
  // the rest N values in the array. The **guard**
345 414
  // check allows it to work with `_.map`.
346
  _.rest = _.tail = function(array, index, guard) {
347
    return slice.call(array, (index == null) || guard ? 1 : index);
415
  _.rest = _.tail = _.drop = function(array, n, guard) {
416
    return slice.call(array, (n == null) || guard ? 1 : n);
348 417
  };
349 418

  
350 419
  // Trim out all falsy values from an array.
351 420
  _.compact = function(array) {
352
    return _.filter(array, function(value){ return !!value; });
421
    return _.filter(array, _.identity);
422
  };
423

  
424
  // Internal implementation of a recursive `flatten` function.
425
  var flatten = function(input, shallow, output) {
426
    each(input, function(value) {
427
      if (_.isArray(value)) {
428
        shallow ? push.apply(output, value) : flatten(value, shallow, output);
429
      } else {
430
        output.push(value);
431
      }
432
    });
433
    return output;
353 434
  };
354 435

  
355 436
  // Return a completely flattened version of an array.
356 437
  _.flatten = function(array, shallow) {
357
    return _.reduce(array, function(memo, value) {
358
      if (_.isArray(value)) return memo.concat(shallow ? value : _.flatten(value));
359
      memo[memo.length] = value;
360
      return memo;
361
    }, []);
438
    return flatten(array, shallow, []);
362 439
  };
363 440

  
364 441
  // Return a version of the array that does not contain the specified value(s).
......
369 446
  // Produce a duplicate-free version of the array. If the array has already
370 447
  // been sorted, you have the option of using a faster algorithm.
371 448
  // Aliased as `unique`.
372
  _.uniq = _.unique = function(array, isSorted, iterator) {
373
    var initial = iterator ? _.map(array, iterator) : array;
449
  _.uniq = _.unique = function(array, isSorted, iterator, context) {
450
    if (_.isFunction(isSorted)) {
451
      context = iterator;
452
      iterator = isSorted;
453
      isSorted = false;
454
    }
455
    var initial = iterator ? _.map(array, iterator, context) : array;
374 456
    var results = [];
375
    // The `isSorted` flag is irrelevant if the array only contains two elements.
376
    if (array.length < 3) isSorted = true;
377
    _.reduce(initial, function (memo, value, index) {
378
      if (isSorted ? _.last(memo) !== value || !memo.length : !_.include(memo, value)) {
379
        memo.push(value);
457
    var seen = [];
458
    each(initial, function(value, index) {
459
      if (isSorted ? (!index || seen[seen.length - 1] !== value) : !_.contains(seen, value)) {
460
        seen.push(value);
380 461
        results.push(array[index]);
381 462
      }
382
      return memo;
383
    }, []);
463
    });
384 464
    return results;
385 465
  };
386 466

  
387 467
  // Produce an array that contains the union: each distinct element from all of
388 468
  // the passed-in arrays.
389 469
  _.union = function() {
390
    return _.uniq(_.flatten(arguments, true));
470
    return _.uniq(concat.apply(ArrayProto, arguments));
391 471
  };
392 472

  
393 473
  // Produce an array that contains every item shared between all the
394
  // passed-in arrays. (Aliased as "intersect" for back-compat.)
395
  _.intersection = _.intersect = function(array) {
474
  // passed-in arrays.
475
  _.intersection = function(array) {
396 476
    var rest = slice.call(arguments, 1);
397 477
    return _.filter(_.uniq(array), function(item) {
398 478
      return _.every(rest, function(other) {
......
404 484
  // Take the difference between one array and a number of other arrays.
405 485
  // Only the elements present in just the first array will remain.
406 486
  _.difference = function(array) {
407
    var rest = _.flatten(slice.call(arguments, 1), true);
408
    return _.filter(array, function(value){ return !_.include(rest, value); });
487
    var rest = concat.apply(ArrayProto, slice.call(arguments, 1));
488
    return _.filter(array, function(value){ return !_.contains(rest, value); });
409 489
  };
410 490

  
411 491
  // Zip together multiple lists into a single array -- elements that share
......
414 494
    var args = slice.call(arguments);
415 495
    var length = _.max(_.pluck(args, 'length'));
416 496
    var results = new Array(length);
417
    for (var i = 0; i < length; i++) results[i] = _.pluck(args, "" + i);
497
    for (var i = 0; i < length; i++) {
498
      results[i] = _.pluck(args, "" + i);
499
    }
418 500
    return results;
419 501
  };
420 502

  
503
  // Converts lists into objects. Pass either a single array of `[key, value]`
504
  // pairs, or two parallel arrays of the same length -- one of keys, and one of
505
  // the corresponding values.
506
  _.object = function(list, values) {
507
    if (list == null) return {};
508
    var result = {};
509
    for (var i = 0, l = list.length; i < l; i++) {
510
      if (values) {
511
        result[list[i]] = values[i];
512
      } else {
513
        result[list[i][0]] = list[i][1];
514
      }
515
    }
516
    return result;
517
  };
518

  
421 519
  // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
422 520
  // we need this function. Return the position of the first occurrence of an
423 521
  // item in an array, or -1 if the item is not included in the array.
......
426 524
  // for **isSorted** to use binary search.
427 525
  _.indexOf = function(array, item, isSorted) {
428 526
    if (array == null) return -1;
429
    var i, l;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff