Skip to content
Browse files

initial commit

  • Loading branch information...
0 parents commit b18d3f17811213fb34d92725a2b6f65870e63a22 Jonas Obrist committed Jul 8, 2010
13 .gitignore
@@ -0,0 +1,13 @@
+*.pyc
+sekizai_css_minifier
+*~
+.*
+dist
+*egg-info*
+tests/bin
+tests/parts
+tests/.installed.cfg
+tests/eggs
+tests/downloads
+tests/develop-eggs
+docs/_build
24 LICENSE
@@ -0,0 +1,24 @@
+Copyright (c) 2010, Jonas Obrist
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Jonas Obrist nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL JONAS OBRIST BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 cms_facebook/__init__.py
@@ -0,0 +1 @@
+__version__ = '0.1.0'
13 cms_facebook/cms_plugins.py
@@ -0,0 +1,13 @@
+from cms.plugin_base import CMSPluginBase
+from cms.plugin_pool import plugin_pool
+from cms_facebook import models
+
+class BasePlugin(CMSPluginBase):
+ def render(self, context, instance, placeholder):
+ context.update({'instance': instance})
+ return context
+
+class LikeBoxPlugin(BasePlugin):
+ model = models.LikeBox
+
+plugin_pool.register_plugin(LikeBoxPlugin)
83 cms_facebook/migrations/0001_initial.py
@@ -0,0 +1,83 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+
+ # Adding model 'FacebookPage'
+ db.create_table('cms_facebook_facebookpage', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
+ ('pageid', self.gf('django.db.models.fields.CharField')(unique=True, max_length=32)),
+ ))
+ db.send_create_signal('cms_facebook', ['FacebookPage'])
+
+ # Adding model 'LikeBox'
+ db.create_table('cmsplugin_likebox', (
+ ('cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)),
+ ('page', self.gf('django.db.models.fields.related.ForeignKey')(related_name='like_boxes', to=orm['cms_facebook.FacebookPage'])),
+ ('width', self.gf('django.db.models.fields.PositiveSmallIntegerField')(default=None, null=True, blank=True)),
+ ('height', self.gf('django.db.models.fields.PositiveSmallIntegerField')(default=587)),
+ ('connections', self.gf('django.db.models.fields.PositiveSmallIntegerField')(default=10)),
+ ('stream', self.gf('django.db.models.fields.BooleanField')(default=True, blank=True)),
+ ('header', self.gf('django.db.models.fields.BooleanField')(default=True, blank=True)),
+ ))
+ db.send_create_signal('cms_facebook', ['LikeBox'])
+
+
+ def backwards(self, orm):
+
+ # Deleting model 'FacebookPage'
+ db.delete_table('cms_facebook_facebookpage')
+
+ # Deleting model 'LikeBox'
+ db.delete_table('cmsplugin_likebox')
+
+
+ models = {
+ 'cms.cmsplugin': {
+ 'Meta': {'object_name': 'CMSPlugin'},
+ 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'language': ('django.db.models.fields.CharField', [], {'max_length': '5', 'db_index': 'True'}),
+ 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.CMSPlugin']", 'null': 'True', 'blank': 'True'}),
+ 'placeholder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}),
+ 'plugin_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}),
+ 'position': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'publisher_is_draft': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True', 'blank': 'True'}),
+ 'publisher_public': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'publisher_draft'", 'unique': 'True', 'null': 'True', 'to': "orm['cms.CMSPlugin']"}),
+ 'publisher_state': ('django.db.models.fields.SmallIntegerField', [], {'default': '0', 'db_index': 'True'}),
+ 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})
+ },
+ 'cms.placeholder': {
+ 'Meta': {'object_name': 'Placeholder'},
+ 'default_width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'slot': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'})
+ },
+ 'cms_facebook.facebookpage': {
+ 'Meta': {'object_name': 'FacebookPage'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'pageid': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32'})
+ },
+ 'cms_facebook.likebox': {
+ 'Meta': {'object_name': 'LikeBox', 'db_table': "'cmsplugin_likebox'", '_ormbases': ['cms.CMSPlugin']},
+ 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
+ 'connections': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '10'}),
+ 'header': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
+ 'height': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '587'}),
+ 'page': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'like_boxes'", 'to': "orm['cms_facebook.FacebookPage']"}),
+ 'stream': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
+ 'width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': 'None', 'null': 'True', 'blank': 'True'})
+ }
+ }
+
+ complete_apps = ['cms_facebook']
0 cms_facebook/migrations/__init__.py
No changes.
22 cms_facebook/models.py
@@ -0,0 +1,22 @@
+from cms.models import CMSPlugin
+from django.db import models
+from django.utils.translation import ugettext_lazy as _
+
+
+class FacebookPage(models.Model):
+ name = models.CharField(max_length=255)
+ pageid = models.CharField(max_length=32, unique=True)
+
+ def __unicode__(self):
+ return self.name
+
+class LikeBox(CMSPlugin):
+ page = models.ForeignKey(FacebookPage, related_name='like_boxes', verbose_name=_("Facebook Page"))
+ width = models.PositiveSmallIntegerField(_("Width"), default=None, null=True, blank=True, help_text=_("Default: Auto Scaling"))
+ height = models.PositiveSmallIntegerField(_("Height"), default=587)
+ connections = models.PositiveSmallIntegerField(_("Amount of Users"), default=10)
+ stream = models.BooleanField(_("Show stream"), default=True)
+ header = models.BooleanField(_("Show header"), default=True)
+
+ def __unicode__(self):
+ return "LikeBox (%s)" % (self.page.name)
1 cms_facebook/templates/cms_facebook/likebox.html
@@ -0,0 +1 @@
+<iframe src="http://www.facebook.com/plugins/likebox.php?id={{ instance.page.id }}&amp;width={% if instance.width %}{{ instance.width }}{% else %}{{ width|default:295 }}{% endif %}&amp;connections={{ instance.connections }}&amp;stream={% if instance.stream %}true{% else %}false{% endif %}&amp;header={% if instance.header %}true{% else %}false{% endif %}&amp;height={{ instance.height }}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:{% if instance.width %}{{ instance.width }}{% else %}{{ width|default:295 }}{% endif %}px; height:{{ instance.height %}}px;" allowTransparency="true"></iframe>
19 setup.py
@@ -0,0 +1,19 @@
+from setuptools import setup, find_packages
+
+version = __import__('cms_facebook').__version__
+
+setup(
+ name = 'django-cms-fakebook',
+ version = version,
+ description = 'Django CMS Facebook Plugins',
+ author = 'Jonas Obrist',
+ author_email = 'jonas.obrist@divio.ch',
+ url = 'http://github.com/ojii/django-cms-facebook',
+ packages = find_packages(),
+ package_data={
+ 'cms_facebook': [
+ 'templates/cms_facebook/*.html',
+ ]
+ },
+ zip_safe=False,
+)

0 comments on commit b18d3f1

Please sign in to comment.
Something went wrong with that request. Please try again.