Skip to content

Commit

Permalink
Merge branch 'franckbret-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey Oordt committed Feb 28, 2011
2 parents 9423bcc + 94d2cbb commit fbe2bfb
Show file tree
Hide file tree
Showing 12 changed files with 995 additions and 69 deletions.
6 changes: 3 additions & 3 deletions massmedia/__init__.py
@@ -1,8 +1,8 @@
__version_info__ = {
'major': 0,
'minor': 6,
'micro': 9,
'releaselevel': 'final',
'minor': 7,
'micro': 0,
'releaselevel': 'beta',
'serial': 1
}

Expand Down
60 changes: 33 additions & 27 deletions massmedia/admin.py
Expand Up @@ -30,7 +30,7 @@ def render(self, name, value, attrs=None):
tag = u'<img src="%s" width="%s" height="%s"/>' % (thumbnail, width, height)
except:
crop_tag = u""
tag = u"<strong>No Thumbnail available</strong>"
tag = _("<strong>No Thumbnail available</strong>")
if value:
file_name=str(value)
output.append(u'<a href="%s" target="_blank">%s</a>' % (value.url, tag))
Expand All @@ -40,16 +40,18 @@ def render(self, name, value, attrs=None):
class AdminExternalURLWidget(AdminURLFieldWidget):
def render(self, name, value, attrs=None):
output = []
tag = u"<strong>No Thumbnail available</strong>"
tag = _("<strong>No Thumbnail available</strong>")
if value:
file_name=str(value)
output.append(u'<a href="%s" target="_blank">%s</a>' % (value, tag))
output.append(u'<br /><a href="%s" target="_blank">%s</a>' % (value, value))
return mark_safe(u''.join(output))

class GenericCollectionInlineModelAdmin(admin.options.InlineModelAdmin):
ct_field = "content_type"
ct_fk_field = "object_id"
ct_field = 'content_type'
ct_fk_field = 'object_id'
fields = ('content_type', 'object_id', 'position')
extra = 3
def __init__(self, parent_model, admin_site):
super(GenericCollectionInlineModelAdmin, self).__init__(parent_model, admin_site)
ctypes = ContentType.objects.all().order_by('id').values_list('id', 'app_label', 'model')
Expand All @@ -68,21 +70,21 @@ class GenericCollectionTabularInline(GenericCollectionInlineModelAdmin):
class MediaAdmin(admin.ModelAdmin):
fieldsets = (
(None, {'fields':('title','caption')}),
('Content',{'fields':(('file','external_url'),)}),
('Credit',{'fields':('author','one_off_author','reproduction_allowed')}),
('Metadata',{'fields':('metadata','mime_type')}),
('Connections',{'fields':('public','categories','site')}),
('Widget',{'fields':('width','height')}),
('Advanced options', {
(_("Content"),{'fields':(('file','external_url'),)}),
(_("Credit"),{'fields':('author','one_off_author','reproduction_allowed')}),
(_("Metadata"),{'fields':('metadata','mime_type')}),
(_("Connections"),{'fields':('public','categories','site')}),
(_("Widget"),{'fields':('width','height')}),
(_("Advanced options"), {
'classes': ('collapse',),
'fields': ('slug','widget_template',)
}),
)
add_fieldsets = (
(None, {'fields': ('title',)}),
('Content',{'fields':('external_url','file', 'caption')}),
('Rights', {'fields': ('public','reproduction_allowed')}),
('Additional Info', {
(_("Content"),{'fields':('external_url','file', 'caption')}),
(_("Rights"), {'fields': ('public','reproduction_allowed')}),
(_("Additional Info"), {
'classes': ('collapse',),
'fields': ('slug', 'creation_date', 'site')
})
Expand Down Expand Up @@ -161,9 +163,9 @@ class ImageAdmin(MediaAdmin):
list_display_links = ('render_thumb','title',)
list_editable = tuple()
add_fieldsets = (
('Content',{'fields':('external_url','file','caption')}),
('Rights', {'fields': ('public','reproduction_allowed')}),
('Additional Info', {
(_("Content"),{'fields':('external_url','file','caption')}),
(_("Rights"), {'fields': ('public','reproduction_allowed')}),
(_("Additional Info"), {
'classes': ('collapse',),
'fields': ('title', 'slug', 'creation_date', 'site')
})
Expand Down Expand Up @@ -200,12 +202,12 @@ class VideoAdmin(MediaAdmin):
list_display = ('title','thumb','author_name','mime_type','public','creation_date')
fieldsets = (
(None, {'fields':('title','caption')}),
('Content',{'fields':(('file','external_url'),'thumbnail')}),
('Credit',{'fields':('author','one_off_author','reproduction_allowed')}),
('Metadata',{'fields':('metadata','mime_type')}),
('Connections',{'fields':('public','categories','site')}),
('Widget',{'fields':('width','height')}),
('Advanced options', {
(_("Content"),{'fields':(('file','external_url'),'thumbnail')}),
(_("Credit"),{'fields':('author','one_off_author','reproduction_allowed')}),
(_("Metadata"),{'fields':('metadata','mime_type')}),
(_("Connections"),{'fields':('public','categories','site')}),
(_("Widget"),{'fields':('width','height')}),
(_("Advanced options"), {
'classes': ('collapse',),
'fields': ('slug','widget_template',)
}),
Expand All @@ -214,9 +216,9 @@ class VideoAdmin(MediaAdmin):
raw_id_fields = ('thumbnail',)
add_fieldsets = (
(None, {'fields': ('title', 'slug',)}),
('Content',{'fields':(('external_url','file'), 'thumbnail')}),
('Rights', {'fields': ('public','reproduction_allowed')}),
('Additional Info', {
(_("Content"),{'fields':(('external_url','file'), 'thumbnail')}),
(_("Rights"), {'fields': ('public','reproduction_allowed')}),
(_("Additional Info"), {
'classes': ('collapse',),
'fields': ('creation_date', 'site')
})
Expand All @@ -228,7 +230,7 @@ class GrabVideoAdmin(VideoAdmin):
search_fields = ('title','caption','keywords')
list_filter = VideoAdmin.list_filter + ('one_off_author',)
list_display = ('asset_id','layout_id','title','thumb','one_off_author','public','creation_date','categories')
fieldsets = ( ('Grab',{'fields':('asset_id','layout_id','keywords')}), )
fieldsets = ( (_("Grab"),{'fields':('asset_id','layout_id','keywords')}), )
for fieldset in VideoAdmin.fieldsets:
if fieldset[0] == 'Content':
continue
Expand All @@ -255,7 +257,11 @@ class CollectionAdmin(admin.ModelAdmin):
search_fields = ('caption',)
inlines = (CollectionInline,)
class Media:
js = ('js/genericcollections.js',)
js = (
'http://code.jquery.com/jquery-1.4.2.min.js',
'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js',
'js/genericcollections.js',
)

admin.site.register(Collection , CollectionAdmin)
admin.site.register(Image, ImageAdmin)
Expand Down
6 changes: 6 additions & 0 deletions massmedia/fields.py
Expand Up @@ -145,4 +145,10 @@ def decode(self, json_str):
md = Metadata()
md.from_json(json_str)
return md

try:
from south.modelsinspector import add_introspection_rules
add_introspection_rules([], ["^massmedia\.fields\.SerializedObjectField"])
except ImportError:
pass

166 changes: 166 additions & 0 deletions massmedia/locale/fr/LC_MESSAGES/django.po
@@ -0,0 +1,166 @@
# French translation for django-massmedia.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <franckbret@gmail.com>, 2011.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-02-28 19:23+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n>1;\n"

#: admin.py:33 admin.py:43
msgid "<strong>No Thumbnail available</strong>"
msgstr "<strong>Pas de vignettes disponible</strong>"

#: admin.py:73 admin.py:85 admin.py:166 admin.py:205 admin.py:219
msgid "Content"
msgstr "Contenu"

#: admin.py:74 admin.py:206
msgid "Credit"
msgstr "Crédits"

#: admin.py:75 admin.py:207
msgid "Metadata"
msgstr "Meta-données"

#: admin.py:76 admin.py:208
msgid "Connections"
msgstr "Visibilité"

#: admin.py:77 admin.py:209
msgid "Widget"
msgstr ""

#: admin.py:78 admin.py:210
msgid "Advanced options"
msgstr "Options avancées"

#: admin.py:86 admin.py:167 admin.py:220
msgid "Rights"
msgstr "Droits"

#: admin.py:87 admin.py:168 admin.py:221
msgid "Additional Info"
msgstr "Informations complémentaires"

#: admin.py:233
msgid "Grab"
msgstr ""

#: models.py:108
msgid "we have reproduction rights for this media"
msgstr "nous possédons les droits de reproduction pour ce média"

#: models.py:109
msgid "this media is publicly available"
msgstr "ce média est disponible publiquement"

#: models.py:110
msgid "If this URLField is set, the media will be pulled externally"
msgstr "Si ce champs d'Url est renseigné, le media sera directement rendu via son Url externe"

#: models.py:112
msgid "The width of the widget for the media"
msgstr "La largeur du widget pour ce média"

#: models.py:113
msgid "The height of the widget for the media"
msgstr "La hauteur du widget pour ce média"

#: models.py:116
msgid ""
"The template name used to generate the widget (defaults to mime_type layout)"
msgstr "Le nom du template utilisé pour généré ce widget (Par défaut mime_type layout)"

#: models.py:158
msgid "No Thumbnail Available"
msgstr "Pas de vignette disponible"

#: models.py:160 models.py:362
msgid "Thumbnail"
msgstr "Vignette"

#: models.py:196
#, python-format
msgid "Can't find a template to render the media. Looking in %s"
msgstr "Impossible de trouver un modèle pour afficher ce média. En regardant dans %s"

#: models.py:342
msgid "Embed HTML source code"
msgstr "Incorporer du code source HTML"

#: models.py:374
msgid "Grab video asset ID (the `a` parameter)"
msgstr ""

#: models.py:375
msgid "Grab video asset ID (the `m` parameter)"
msgstr ""

#: models.py:394
msgid "audio clip"
msgstr "extrait audio"

#: models.py:395
msgid "audio clips"
msgstr "extraits audio"

#: models.py:410
msgid "SWF File"
msgstr "fichier Swf"

#: models.py:411
msgid "SWF Files"
msgstr "fichiers Swf"

#: models.py:425
msgid "Document"
msgstr ""

#: models.py:426
msgid "Documents"
msgstr ""

#: models.py:437
msgid "Media files in a .zip"
msgstr "Fichiers media dans un .zip"

#: models.py:438
msgid "Select a .zip file of media to upload into a the Collection."
msgstr "Sélectionnez un fichier .zip pour ajouter son contenu à la collection"

#: models.py:439
msgid "this collection is publicly available"
msgstr "Cette collection est visible publiquement"

#: models.py:466
#, python-format
msgid "\"%s\" in the .zip archive is corrupt."
msgstr "\"%s\" dans l'archive .zip est corrompu."

#: models.py:518
msgid "Position"
msgstr ""

#: templates/admin/edit_inlines/gen_coll_tabular.html:15
msgid "Delete?"
msgstr "Supprimer ?"

#: templates/admin/edit_inlines/gen_coll_tabular.html:27
msgid "View on site"
msgstr "Prévisualiser"

#: templates/admin/massmedia/image/change_list.html:36
#, python-format
msgid "Add %(name)s"
msgstr "Ajouter %(name)s"
41 changes: 41 additions & 0 deletions massmedia/media/massmedia/js/genericcollections.js
Expand Up @@ -18,3 +18,44 @@ function showGenericRelatedObjectLookupPopup(triggeringLink, ctArray) {
win.focus();
return false;
}
/* This script takes inspiration from http://djangosnippets.org/snippets/1053/
Depending on the context it can be broken so it needs to be improved...
Franck Bret, 2010 - franckbret@gmail.com
*/
jQuery(function($) {
/* We first need to be sure that a position field is here */
if($(this).find('td.position input:text')){
if ($('div.inline-group > div.tabular').size() > 0){
/* For tabular inline related, ie admin.TabularInline */
$('div.inline-group').sortable({
items: 'tr.has_original',
handle: 'td',
update: function() {
$(this).find('tr.has_original').each(function(i) {
$(this).find('input[name$=order]').val(i+1);
$(this).removeClass('row1').removeClass('row2');
$(this).addClass('row'+((i%2)+1));
$(this).find('td.position input:text').val(i+1);
});
}
});
$('tr.has_original').css('cursor', 'move');
} else {
/* For inline-related, ie admin.StackedInline */
$('div.inline-group').sortable({
items: 'div.inline-related',
handle: 'h3:first',
update: function() {
alert('Sorry, the script is not done yet for Stackedinline. Check the code and improve');
$(this).find('div.inline-related').each(function(i) {
// NOT DONE YET ;-)
//if ($(this).find('select option:selected').val()) {
// $(this).find('input:text').val(i+1);
// }
});
}
});
$('div.inline-related h3').css('cursor', 'move');
}
}
});

0 comments on commit fbe2bfb

Please sign in to comment.