diff --git a/lms/djangoapps/course_wiki/course_nav.py b/lms/djangoapps/course_wiki/course_nav.py index 1d124972c7..122f9ebb54 100644 --- a/lms/djangoapps/course_wiki/course_nav.py +++ b/lms/djangoapps/course_wiki/course_nav.py @@ -5,6 +5,7 @@ from django.http import Http404 from django.shortcuts import redirect from wiki.models import reverse as wiki_reverse +from courseware.access import has_access from courseware.courses import get_course_with_access @@ -135,7 +136,9 @@ def context_processor(request): try: course = get_course_with_access(request.user, course_id, 'load') - return {'course' : course} + staff_access = has_access(request.user, course, 'staff') + return {'course' : course, + 'staff_access': staff_access} except Http404: # We couldn't access the course for whatever reason. It is too late to change # the URL here, so we just leave the course context. The middleware shouldn't diff --git a/lms/djangoapps/course_wiki/views.py b/lms/djangoapps/course_wiki/views.py index cfe802bbd7..e754e1cdcd 100644 --- a/lms/djangoapps/course_wiki/views.py +++ b/lms/djangoapps/course_wiki/views.py @@ -81,7 +81,7 @@ def course_wiki_redirect(request, course_id): root, course_slug, title=course.number, - content="{0}\n===\nThis is the wiki for **{1}**'s _{2}_.".format(course.number, course.org, course.title), + content="This is the wiki for **{0}**'s _{1}_.".format(course.org, course.title), user_message="Course page automatically created.", user=None, ip_address=None, @@ -114,7 +114,7 @@ def get_or_create_root(): "===", "Visit a course wiki to add an article.")) - root = URLPath.create_root(title="edX Wiki", + root = URLPath.create_root(title="Wiki", content=starting_content) article = root.article article.group = None diff --git a/lms/envs/common.py b/lms/envs/common.py index a217f0e7b9..c99423c7a1 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -318,6 +318,7 @@ WIKI_ACCOUNT_HANDLING = False WIKI_EDITOR = 'course_wiki.editors.CodeMirror' WIKI_SHOW_MAX_CHILDREN = 0 # We don't use the little menu that shows children of an article in the breadcrumb WIKI_ANONYMOUS = False # Don't allow anonymous access until the styling is figured out +WIKI_CAN_CHANGE_PERMISSIONS = lambda article, user: user.has_perm('wiki.assign') ################################# Jasmine ################################### JASMINE_TEST_DIRECTORY = PROJECT_ROOT + '/static/coffee' diff --git a/lms/static/sass/course/wiki/_wiki.scss b/lms/static/sass/course/wiki/_wiki.scss index 1ddb52da56..9abe349119 100644 --- a/lms/static/sass/course/wiki/_wiki.scss +++ b/lms/static/sass/course/wiki/_wiki.scss @@ -784,6 +784,39 @@ section.wiki { text-decoration: none; } } + + .missing { + max-width: 400px; + margin: lh(2) auto; + display: block; + overflow: hidden; + background: $pink; + padding: lh(); + @include box-shadow(inset 0 0 0 1px lighten($pink, 10%)); + border: 1px solid darken($pink, 15%); + + p { + color: #fff; + + a { + display: block; + background: darken($pink, 8%); + margin: lh() (-(lh())) (-(lh())); + padding: lh(); + border-top: 1px solid darken($pink, 15%); + color: #fff; + font-weight: bold; + font-size: em(18); + @include transition; + text-align: center; + -webkit-font-smoothing: antialiased; + + &:hover { + background: darken($pink, 12%); + } + } + } + } } .modal-backdrop { diff --git a/lms/templates/wiki/article.html b/lms/templates/wiki/article.html index 7c8c8fb66a..96e43d25ec 100644 --- a/lms/templates/wiki/article.html +++ b/lms/templates/wiki/article.html @@ -14,7 +14,14 @@
{% if selected_tab != "edit" %} -

{{ article.current_revision.title }}

+

{{ article.current_revision.title }}

+ + {% comment %} + This has been disabled until we can style it. + {% if urlpath %} + Show all children + {% endif %} + {% endcomment %} {% endif %} {% block wiki_contents_tab %} diff --git a/lms/templates/wiki/delete.html b/lms/templates/wiki/delete.html deleted file mode 100644 index acabb79aad..0000000000 --- a/lms/templates/wiki/delete.html +++ /dev/null @@ -1,62 +0,0 @@ -{% extends "wiki/base.html" %} -{% load wiki_tags i18n sekizai_tags %} -{% load url from future %} - -{% block pagetitle %}{% trans "Delete article" %}{% endblock %} - -{% block wiki_contents %} -

{% trans "Delete" %} "{{ article.current_revision.title }}"

- - {% if cannot_delete_root %} -

{% trans "You cannot delete a root article." %}

-

{% trans "Go back" %}

- {% else %} - - {% if cannot_delete_children %} - -

{% trans "You cannot delete this article because you do not have permission to delete articles with children. Try to remove the children manually one-by-one." %}

- - {% endif %} - - {% if delete_children %} - -

{% trans "You are deleting an article. This means that its children will be deleted as well. If you choose to purge, children will also be purged!" %}

- -

{% trans "Articles that will be deleted" %}

- - - - {% endif %} - - {% if not cannot_delete_children %} -

{% trans "You are deleting an article. Please confirm." %}

- -
- {% wiki_form delete_form %} - -
- - - {% trans "Go back" %} - - -
-
- {% endif %} - - {% endif %} - -{% endblock %} - diff --git a/lms/templates/wiki/includes/article_menu.html b/lms/templates/wiki/includes/article_menu.html index 5131b4c3e9..0d505ccebd 100644 --- a/lms/templates/wiki/includes/article_menu.html +++ b/lms/templates/wiki/includes/article_menu.html @@ -35,6 +35,10 @@ %endif %endfor + +<%doc> +The settings link has been disabled because the notifications app hasn't been integrated yet and those are the only useful settings. + %if not user.is_anonymous():
  • @@ -43,4 +47,6 @@
  • %endif + + diff --git a/lms/templates/wiki/plugins/attachments/index.html b/lms/templates/wiki/plugins/attachments/index.html index d448392933..464a63e5fe 100644 --- a/lms/templates/wiki/plugins/attachments/index.html +++ b/lms/templates/wiki/plugins/attachments/index.html @@ -115,7 +115,13 @@ {% if attachment.current_revision.user %}{{ attachment.current_revision.user }}{% else %}{% if user|is_moderator %}{{ attachment.current_revision.ip_address|default:"anonymous (IP not logged)" }}{% else %}{% trans "anonymous (IP logged)" %}{% endif %}{% endif %} {{ attachment.current_revision.get_size|filesizeformat }} - {{ attachment.attachmentrevision_set.all.count }} {% trans "revisions" %} + + + + + {% trans "File history" %} ({{ attachment.attachmentrevision_set.all.count }} {% trans "revisions" %}) + + diff --git a/lms/templates/wiki/preview_inline.html b/lms/templates/wiki/preview_inline.html index 9248454137..a5c6668d16 100644 --- a/lms/templates/wiki/preview_inline.html +++ b/lms/templates/wiki/preview_inline.html @@ -10,22 +10,31 @@
    {% if revision %}
    - {% trans "Previewing revision" %}: {{ revision.created }} (#{{ revision.revision_number }}) by {% if revision.user %}{{ revision.user }}{% else %}{% if user|is_moderator %}{{ revision.ip_address|default:"anonymous (IP not logged)" }}{% else %}{% trans "anonymous (IP logged)" %}{% endif %}{% endif %} + {% trans "Previewing revision" %}: + {% include "wiki/includes/revision_info.html" %}
    {% endif %} {% if merge %}
    {% trans "Previewing merge between" %}: - {{ merge1.created }} (#{{ merge1.revision_number }}) by {% if merge1.user %}{{ merge1.user }}{% else %}{% if user|is_moderator %}{{ merge1.ip_address|default:"anonymous (IP not logged)" }}{% else %}{% trans "anonymous (IP logged)" %}{% endif %}{% endif %} + {% include "wiki/includes/revision_info.html" with revision=merge1 %} {% trans "and" %} - {{ merge1.created }} (#{{ merge1.revision_number }}) by {% if merge1.user %}{{ merge1.user }}{% else %}{% if user|is_moderator %}{{ merge1.ip_address|default:"anonymous (IP not logged)" }}{% else %}{% trans "anonymous (IP logged)" %}{% endif %}{% endif %} + {% include "wiki/includes/revision_info.html" with revision=merge2 %}
    {% endif %}

    {{ title }}

    - {% wiki_render article content %} + {% if revision and revision.deleted %} +
    + This revision has been deleted. +

    Restoring to this revision will mark the article as deleted.

    +
    + {% else %} + {% wiki_render article content %} + {% endif %} +
    diff --git a/lms/templates/wiki/settings.html b/lms/templates/wiki/settings.html deleted file mode 100644 index 93e92cbc61..0000000000 --- a/lms/templates/wiki/settings.html +++ /dev/null @@ -1,52 +0,0 @@ -{% extends "wiki/base.html" %} -{% load wiki_tags i18n %} -{% load url from future %} - -{% block pagetitle %}{% trans "Settings" %}: {{ article.current_revision.title }}{% endblock %} - -{% block wiki_breadcrumbs %} - {% include "wiki/includes/breadcrumbs.html" %} -{% endblock %} - -{% block wiki_contents %} - -
    -
    - {% if selected_tab != "edit" %} -

    {{ article.current_revision.title }}

    - {% endif %} - - {% for form in forms %} -
    -

    {{ form.settings_form_headline }}

    -
    - {% wiki_form form %} -
    -
    - -
    -
    - {% endfor %} -
    - - - - -
    - -
    - {% trans "Last modified:" %}
    - {{ article.current_revision.modified }} -
    -
    -
    - -{% endblock %} - diff --git a/lms/templates/wiki/wiki-404.html b/lms/templates/wiki/wiki-404.html deleted file mode 100644 index a18ea3786a..0000000000 --- a/lms/templates/wiki/wiki-404.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "wiki/base.html" %} -{% load wiki_tags i18n %} -{% load url from future %} - -{% block pagetitle %}{{ article.current_revision.title }}{% endblock %} - -{% block wiki_breadcrumbs %} -{% include "wiki/includes/breadcrumbs.html" %} -{% endblock %} - -{% block wiki_contents %} - -
    -

    This article was not found, and neither was the parent. Go back to the main wiki article.

    - -
    - -{% endblock %} diff --git a/repo-requirements.txt b/repo-requirements.txt index cb016b5222..fcfb063077 100644 --- a/repo-requirements.txt +++ b/repo-requirements.txt @@ -1,6 +1,6 @@ -e git://github.com/MITx/django-staticfiles.git@6d2504e5c8#egg=django-staticfiles -e git://github.com/MITx/django-pipeline.git#egg=django-pipeline --e git://github.com/benjaoming/django-wiki.git@02275fb4#egg=django-wiki +-e git://github.com/benjaoming/django-wiki.git@63003aa#egg=django-wiki -e git://github.com/dementrock/pystache_custom.git@776973740bdaad83a3b029f96e415a7d1e8bec2f#egg=pystache_custom-dev -e common/lib/capa -e common/lib/xmodule diff --git a/requirements.txt b/requirements.txt index c5cafe64b8..72b13e63ba 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ django>=1.4,<1.5 pip numpy scipy -markdown +Markdown<2.3.0 pygments lxml boto @@ -43,5 +43,7 @@ django-ses django-storages django-threaded-multihost django-sekizai<0.7 +django-mptt>=0.5.3 +sorl-thumbnail networkx -r repo-requirements.txt