Skip to content

Commit

Permalink
Merge branch 'develop' of git://github.com/divio/django-cms into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
kezabelle committed Jun 9, 2011
2 parents b3df90a + c264960 commit 6ec00a9
Show file tree
Hide file tree
Showing 34 changed files with 395 additions and 147 deletions.
4 changes: 3 additions & 1 deletion AUTHORS
Expand Up @@ -39,7 +39,7 @@ Contributors (in alphabetical order):
* Chris Hughes
* Chris Wesseling
* Christof Hagedorn
* daniele
* Daniele Procida
* DaNmarner
* Darryl Woods
* David Jean Louis
Expand Down Expand Up @@ -150,6 +150,7 @@ Contributors (in alphabetical order):
* spookylukey
* ssteinerX
* Stavros Korokithakis
* Stephan Jaekel
* Steve R. Jones
* Steve Steiner
* Tanel Külaots
Expand All @@ -158,6 +159,7 @@ Contributors (in alphabetical order):
* Tino de Bruijn
* tiret
* Ulrich Petri
* Vasil Vangelovski
* wangJunjie
* Wayne Moore
* wid
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Expand Up @@ -8,3 +8,4 @@ recursive-include cms/media *
recursive-include cms/plugins *
recursive-include menus/templates *
recursive-include docs *
recursive-exclude * *.pyc
8 changes: 6 additions & 2 deletions cms/admin/change_list.py
Expand Up @@ -50,7 +50,7 @@ def get_query_set(self, request=None):
self.root_query_set = self.root_query_set.filter(pk__in=permissions)
self.real_queryset = True
qs = qs.filter(site=self._current_site)
qs = qs.order_by('tree_id', 'parent', 'lft')
qs = qs.order_by('tree_id', 'lft')
return qs

def is_filtered(self):
Expand All @@ -75,7 +75,8 @@ def set_items(self, request):
site = self._current_site
# Get all the pages, ordered by tree ID (it's convenient to build the
# tree using a stack now)
pages = self.get_query_set(request).drafts().order_by('tree_id', 'parent', 'lft').select_related()
pages = self.get_query_set(request).drafts().order_by('tree_id', 'lft').select_related()


# Get lists of page IDs for which the current user has
# "permission to..." on the current site.
Expand Down Expand Up @@ -121,9 +122,12 @@ def set_items(self, request):
# This is normally a tag filter, but it's really nice in our case too:
# It caches children for every page in the list we pass it, so no
# further queries are needed.

mptt_tags.cache_tree_children(pages)

for page in pages:


children = page.get_children()

# note: We are using change_list permission here, because we must
Expand Down
4 changes: 2 additions & 2 deletions cms/cms_toolbar.py
Expand Up @@ -89,7 +89,7 @@ def get_items(self, context, **kwargs):
)

# publish button
if self.edit_mode:
if self.edit_mode and settings.CMS_MODERATOR:
moderator_state = page_moderator_state(self.request, self.request.current_page)
should_approve = moderator_state['state'] >= I_APPROVE
has_perms = self.request.current_page.has_moderate_permission(self.request)
Expand Down Expand Up @@ -211,4 +211,4 @@ def _request_hook_post(self):
password = login_form.cleaned_data['cms_password']
user = authenticate(username=username, password=password)
if user:
login(self.request, user)
login(self.request, user)
16 changes: 9 additions & 7 deletions cms/media/cms/js/libs/classy.min.js
Expand Up @@ -20,8 +20,8 @@ var CMS = CMS || {};
(function() {
var CLASSY_VERSION = '1.3.1',
ROOT = this,
OLD_CLASS = Class,
DISABLE_CONSTRUCTOR = false;
_Class = window.Class;

/* we check if $super is in use by a class if we can. But first we have to
check if the JavaScript interpreter supports that. This also matches
Expand Down Expand Up @@ -57,13 +57,15 @@ var CMS = CMS || {};
/* restore the global Class name and pass it to a function. This allows
different versions of the classy library to be used side by side and
in combination with other libraries. */
Class.$noConflict = function() {
try {
setOrUnset(ROOT, 'Class', OLD_CLASS);
} catch (e) {
// fix for IE that does not support delete on window
ROOT.Class = OLD_CLASS;
Class.$noConflict = function(deep) {
if(window.Class === Class) {
window.Class = _Class;
}

if(deep && window.Class === Class) {
window.Class = _Class;
}

return Class;
};

Expand Down
8 changes: 6 additions & 2 deletions cms/media/cms/js/plugins/cms.base.js
Expand Up @@ -5,9 +5,11 @@
*
* assign Class and CMS namespace */
var CMS = CMS || {};
CMS.Class = CMS.Class || Class.$noConflict();

(function ($) {
/*##################################################|*/
/* #CUSTOM APP# */
/* #CMS.BASE# */
jQuery(document).ready(function ($) {
/**
* Security
Expand Down Expand Up @@ -116,4 +118,6 @@ jQuery(document).ready(function ($) {

};

});
});

})(jQuery);
9 changes: 6 additions & 3 deletions cms/media/cms/js/plugins/cms.placeholders.js
@@ -1,11 +1,12 @@
(function ($) {
/**
* @author: Angelo Dini
* @copyright: http://www.divio.ch under the BSD Licence
* @requires: Classy, jQuery, jQuery.ui.core, jQuery.ui.draggable, jQuery.ui.droppable
*/

/*##################################################|*/
/* #CUSTOM APP# */
/* #CMS.PLACEHOLDERS# */
jQuery(document).ready(function ($) {
/**
* Placeholders
Expand All @@ -19,7 +20,7 @@ jQuery(document).ready(function ($) {
* - CMS.Placeholder.toggleDim();
* @compatibility: IE >= 6, FF >= 2, Safari >= 4, Chrome > =4, Opera >= 10
*/
CMS.Placeholders = Class.$extend({
CMS.Placeholders = CMS.Class.$extend({

options: {
'debug': false, // not integrated yet
Expand Down Expand Up @@ -571,4 +572,6 @@ jQuery(document).ready(function ($) {
}

});
});
});

})(jQuery);
8 changes: 6 additions & 2 deletions cms/media/cms/js/plugins/cms.toolbar.js
@@ -1,12 +1,14 @@
(function ($) {
/**
* @author: Angelo Dini
* @copyright: http://www.divio.ch under the BSD Licence
* @requires: Classy, jQuery, jQuery.cookie
*/

/*##################################################|*/
/* #CUSTOM APP# */
/* #CMS.TOOLBAR# */
jQuery(document).ready(function ($) {

/**
* Toolbar
* @version: 0.1.2
Expand All @@ -20,7 +22,7 @@ jQuery(document).ready(function ($) {
* @compatibility: IE >= 6, FF >= 2, Safari >= 4, Chrome > =4, Opera >= 10
* TODO: login needs special treatment (errors, login on enter)
*/
CMS.Toolbar = Class.$extend({
CMS.Toolbar = CMS.Class.$extend({

implement: [CMS.Helpers, CMS.Security],

Expand Down Expand Up @@ -367,3 +369,5 @@ jQuery(document).ready(function ($) {

});
});

})(jQuery);
18 changes: 9 additions & 9 deletions cms/plugins/inherit/forms.py
@@ -1,13 +1,17 @@
from django.forms.models import ModelForm
from django.utils.translation import ugettext_lazy as _
from cms.plugins.link.models import Link
from django import forms
from cms.models import Page
from cms.plugins.inherit.models import InheritPagePlaceholder
from django import forms
from django.forms.models import ModelForm
from django.forms.util import ErrorList
from django.utils.translation import ugettext_lazy as _

class InheritForm(ModelForm):
from_page = forms.ModelChoiceField(label=_("page"), queryset=Page.objects.drafts(), required=False)

class Meta:
model = InheritPagePlaceholder
exclude = ('page', 'position', 'placeholder', 'language', 'plugin_type')

def for_site(self, site):
# override the page_link fields queryset to containt just pages for
# current site
Expand All @@ -17,8 +21,4 @@ def clean(self):
cleaned_data = super(InheritForm, self).clean()
if not cleaned_data['from_page'] and not cleaned_data['from_language']:
self._errors['from_page'] = ErrorList([_("Language or Page must be filled out")])
return cleaned_data

class Meta:
model = Link
exclude = ('page', 'position', 'placeholder', 'language', 'plugin_type')
return cleaned_data
2 changes: 1 addition & 1 deletion cms/plugins/picture/templates/cms/plugins/picture.html
@@ -1,5 +1,5 @@
<span class="plugin_picture{% if picture.float %} {{ picture.float }}{% endif %}">
{% if link %}<a href="{{ link }}">{% endif %}
<img src="{{ picture.image.url }}" alt="{{ picture.alt }}" />
<img src="{{ picture.image.url }}" alt="{{ picture.alt }}"{% if picture.longdesc %} title="{{ picture.longdesc }}"{% endif %} />
{% if link %}</a>{% endif %}
</span>
Expand Up @@ -5,7 +5,7 @@
{% for fieldset in adminform %}
{% include "cms/plugins/text_plugin_fieldset.html" %}
{% endfor %}
<script type="text/javascript" src="{{ CMS_MEDIA_URL }}js/libs/classy-1.3.1.js"></script>
<script type="text/javascript" src="{{ CMS_MEDIA_URL }}js/libs/classy.min.js"></script>
<script type="text/javascript" src="{{ CMS_MEDIA_URL }}js/plugins/cms.base.js"></script>
<script type="text/javascript">
jQuery(document).ready(function ($) {
Expand Down
50 changes: 25 additions & 25 deletions cms/templates/admin/cms/page/change_form.html
Expand Up @@ -8,20 +8,20 @@
<script type="text/javascript" src="{% url admin:jsi18n %}"></script>

{% if not add %}
<script type="text/javascript" src="{{ CMS_MEDIA_URL }}js/change_form.js"></script>
<script type="text/javascript" src="{{ CMS_MEDIA_URL }}js/change_form.js"></script>
{% endif %}
<script type="text/javascript" src="{% admin_media_prefix %}js/urlify.js"></script>

{% if add %}
<script type="text/javascript">
//<![CDATA[
(function($) {
$(document).ready(function(){
$("#id_title").keyup(function() {
var e = $("#id_slug")[0];
if (!e._changed) {
e.value = URLify(this.value, 64);
}
$(document).ready(function (){
$("#id_title").keyup(function () {
var e = $("#id_slug")[0];
if(!e._changed) {
e.value = URLify(this.value, 64);
}
});
});
})(jQuery);
Expand All @@ -30,28 +30,29 @@
{% endif %}

<style type="text/css">

<!--
.language_button {
font-weight:bold;
margin-bottom:-1px;
border-color:#DDDDDD #AAAAAA #CCCCCC #DDDDDD !important;
border:1px;
background:white url({{ ADMIN_MEDIA_URL }}img/admin/nav-bg.gif) repeat-x scroll center bottom !important;
}
font-weight:bold;
margin-bottom:-1px;
border-color:#ddd #aaa #ccc #ddd !important;
border:1px;
background:#fff url('{{ ADMIN_MEDIA_URL }}img/admin/nav-bg.gif') repeat-x center bottom !important;
}

#lang_tab_content h2.header {
margin: 0;
padding: 2px 5px 3px 5px;
font-size: 11px;
text-align: left;
font-weight: bold;
background: #7CA0C7 url({{ ADMIN_MEDIA_URL }}img/admin/default-bg.gif) top left repeat-x;
color: white;
margin:0;
padding:2px 5px 3px 5px;
font-size:11px;
text-align:left;
font-weight:bold;
background:#7ca0c7 url('{{ ADMIN_MEDIA_URL }}img/admin/default-bg.gif') repeat-x left top;
color:#fff;
}

.notfilled{
.notfilled {
color: #808080 !important;

}
-->
</style>


Expand Down Expand Up @@ -211,7 +212,7 @@ <h2 class="load_remote">{% trans 'Page states' %}</h2>
// show previously posted message if there were an error
$('#id_df_moderator_message').val($('#id_moderator_message').val());
}
seen = true
seen = true;
event.preventDefault();
submitActor = actor;
$('#dialog').dialog('open');
Expand Down Expand Up @@ -243,7 +244,6 @@ <h2 class="load_remote">{% trans 'Page states' %}</h2>
Save: function() {
dialogSave();
}

},
open: function(){
var val = $('#id_moderator_state').val();
Expand Down
6 changes: 3 additions & 3 deletions cms/templates/admin/cms/page/plugin_change_form.html
Expand Up @@ -109,10 +109,10 @@
{% prepopulated_fields_js %}

</div>
<div>
<input type="submit" value="{% trans "Save" %}" name="_save"/>
<span class="plugin-submit-row"{% if is_popup %} style="overflow: auto;"{% endif %}>
<input type="submit" name="_save" class="default" value="{% trans "Save" %}" {{ onclick_attrib }}/>
<input type="submit" style="margin-left: 8px;" value="{% trans "Cancel" %}" name="_cancel">
</div>
</span>
</form>

</div>
Expand Down
8 changes: 8 additions & 0 deletions cms/templates/admin/page_submit_line.html
Expand Up @@ -12,3 +12,11 @@
{% if show_save_and_add_another %}<input type="submit" value="{% trans 'Save and add another' %}" name="_addanother" {{ onclick_attrib }} />{% endif %}
{% if show_save_and_continue %}<input type="submit" value="{% trans 'Save and continue editing' %}" name="_continue" {{ onclick_attrib }}/>{% endif %}
</div>
<script type="text/javascript">
(function ($) {
var i = 0;
$('form').submit(function () {
i++; if(i > 1) { return false; }
});
})(jQuery);
</script>
3 changes: 3 additions & 0 deletions cms/templatetags/cms_admin.py
Expand Up @@ -23,12 +23,15 @@ class ShowAdminMenu(InclusionTag):

def get_context(self, context, page):
request = context['request']


if context.has_key("cl"):
filtered = context['cl'].is_filtered()
elif context.has_key('filtered'):
filtered = context['filtered']



# following function is newly used for getting the context per item (line)
# if something more will be required, then get_admin_menu_item_context
# function have to be updated.
Expand Down
5 changes: 3 additions & 2 deletions cms/tests/__init__.py
Expand Up @@ -22,12 +22,13 @@
from cms.tests.po import PoTest
from cms.tests.publisher import PublisherTestCase
from cms.tests.rendering import RenderingTestCase
from cms.tests.reversion_tests import ReversionTestCase
from cms.tests.reversion_tests import ReversionTestCase, ReversionFileFieldTests
from cms.tests.security import SecurityTests
from cms.tests.settings import SettingsTests
from cms.tests.site import SiteTestCase
from cms.tests.templatetags import TemplatetagTests, TemplatetagDatabaseTests
from cms.tests.toolbar import ToolbarTests
from cms.tests.toolbar import (ToolbarTests, ToolbarModeratorTests,
ToolbarNoModeratorTests)
from cms.tests.urlutils import UrlutilsTestCase
from cms.tests.views import ViewTests
from cms.tests.management import ManagementTestCase
Expand Down

0 comments on commit 6ec00a9

Please sign in to comment.