changeset 2921:3862a0aede87

merged
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 27 Apr 2015 22:02:22 +0200
parents 70d113e58edc (diff) 95d55587c704 (current diff)
children 4ab27780d078
files MoinMoin/apps/frontend/views.py
diffstat 13 files changed, 48 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/app.py	Mon Mar 23 17:39:21 2015 +0000
+++ b/MoinMoin/app.py	Mon Apr 27 22:02:22 2015 +0200
@@ -208,7 +208,12 @@
     flaskg._login_messages = []
 
     # first try setting up from session
-    userobj = auth.setup_from_session()
+    try:
+        userobj = auth.setup_from_session()
+    except KeyError:
+        # error caused due to invalid cookie, recreating session
+        session.clear()
+        userobj = auth.setup_from_session()
 
     # then handle login/logout forms
     form = request.values.to_dict()
--- a/MoinMoin/apps/frontend/views.py	Mon Mar 23 17:39:21 2015 +0000
+++ b/MoinMoin/apps/frontend/views.py	Mon Apr 27 22:02:22 2015 +0200
@@ -1270,7 +1270,7 @@
     """a simple user registration form"""
     name = 'register'
 
-    username = RequiredText.using(label=L_('Name')).with_properties(placeholder=L_("The login name you want to use"))
+    username = RequiredText.using(label=L_('Username')).with_properties(placeholder=L_("The login username you want to use"))
     password1 = RequiredPassword.with_properties(placeholder=L_("The login password you want to use"))
     password2 = RequiredPassword.with_properties(placeholder=L_("Repeat the same password"))
     email = YourEmail
@@ -1556,7 +1556,7 @@
     """
     name = 'login'
 
-    username = RequiredText.using(label=L_('Name'), optional=False).with_properties(autofocus=True)
+    username = RequiredText.using(label=L_('Username'), optional=False).with_properties(autofocus=True)
     password = RequiredPassword
     openid = YourOpenID.using(optional=True)
     # This field results in a login_submit field in the POST form, which is in
@@ -1573,7 +1573,7 @@
         return redirect(url_for('.show_root'))
 
 
-# TODO use ?next=next_location check if target is in the wiki and not outside domain
+    # TODO use ?next=next_location check if target is in the wiki and not outside domain
     title_name = _(u'Login')
 
     # multistage return
@@ -1616,6 +1616,8 @@
     password_problem_msg = L_('New password is unacceptable, could not get processed.')
 
     def validate(self, element, state):
+        password_not_accepted_msg = L_('New password not acceptable: ')
+
         if not (element['password_current'].valid and element['password1'].valid and element['password2'].valid):
             return False
 
@@ -1626,6 +1628,11 @@
             return self.note_error(element, state, 'passwords_mismatch_msg')
 
         password = element['password1'].value
+        pw_checker = app.cfg.password_checker
+        if pw_checker:
+            pw_error = pw_checker(flaskg.user.name[0], password)
+            if pw_error:
+                return self.note_error(element, state, message=password_not_accepted_msg + pw_error)
         try:
             app.cfg.cache.pwd_context.encrypt(password)
         except (ValueError, TypeError) as err:
@@ -1684,7 +1691,7 @@
     # these forms can't be global because we need app object, which is only available within a request:
     class UserSettingsPersonalForm(Form):
         name = 'usersettings_personal'  # "name" is duplicate
-        name = Names.using(label=L_('Names')).with_properties(placeholder=L_("The login names you want to use"))
+        name = Names.using(label=L_('Usernames')).with_properties(placeholder=L_("The login usernames you want to use"))
         display_name = OptionalText.using(label=L_('Display-Name')).with_properties(
             placeholder=L_("Your display name (informational)"))
         openid = YourOpenID.using(optional=True)
--- a/MoinMoin/static/js/common.js	Mon Mar 23 17:39:21 2015 +0000
+++ b/MoinMoin/static/js/common.js	Mon Apr 27 22:02:22 2015 +0200
@@ -242,22 +242,6 @@
 };
 
 
-
-// OnMouseOver show the fqname of the item else only show the value/id.
-function togglefqname() {
-    "use strict";
-    var fullname, value;
-    $(".moin-fqname").hover(function () {
-        fullname = $(this).attr('data-fqname');
-        value = $(this).html();
-        $(this).html(fullname);
-    }, function () {
-        $(this).html(value);
-    });
-}
-$(document).ready(togglefqname);
-
-
 // Executed when user clicks insert-name button defined in modify.html.
 // When a page with subitems is modified, a subitems sidebar is present. User may
 // position caret in textarea and click button to insert name into textarea.
@@ -394,8 +378,8 @@
             newform.data('initialForm', newform.serialize());
             // replace the old form with the new one
             form.replaceWith(newform);
-            if (ev.currentTarget.name === 'usersettings_ui') {
-                // theme has changed, show user the new theme
+            if (ev.currentTarget.name === 'usersettings_ui' ||  ev.currentTarget.id === 'usersettings_personal') {
+                // theme or language may have changed, show user the new theme/language
                 location.reload(true);
             }
         }, 'json');
--- a/MoinMoin/templates/index.html	Mon Mar 23 17:39:21 2015 +0000
+++ b/MoinMoin/templates/index.html	Mon Apr 27 22:02:22 2015 +0200
@@ -68,10 +68,6 @@
         {{ self.action_bars_inner() }}
 {% endblock %}
 
-{% macro entry_anchor(type, e) -%}
-    index-{{ type }}-{{ e.meta['itemid'] }}
-{%- endmacro %}
-
 {% set maxchars = 16 %}
 
 {% macro render_file_entry(e) %}
@@ -88,7 +84,7 @@
            {{ e.relname|truncate(maxchars, true, '..') }}
         </a>
         {% if e in dirs %}
-            <a href="#{{ entry_anchor('dir', e) }}"
+            <a href="{{ url_for('.index', item_name=e.fullname) }}"
                title="{{ _("This item also has subitems that match your filter.") }}">↓
             </a>
         {% endif %}
--- a/MoinMoin/templates/link_list_item_panel.html	Mon Mar 23 17:39:21 2015 +0000
+++ b/MoinMoin/templates/link_list_item_panel.html	Mon Apr 27 22:02:22 2015 +0200
@@ -1,4 +1,5 @@
 {% extends theme("show.html") %}
+{% from "utils.html" import item_panel %}
 {% block content %}
     {% if headline %}
         <h1>{{ headline }}</h1>
@@ -7,7 +8,7 @@
         Total: {{ fq_names|count }}
         <ul class="moin-link-list">
             {% for fq_name in fq_names|sort(attribute='value') %}
-                <li><a class="moin-fqname" href="{{ url_for('frontend.show_item', item_name=fq_name) }}" data-fqname="{{ fq_name }}">{{ fq_name.value }}</a></li>
+                {{ item_panel(fq_name) }}
             {% endfor %}
         </ul>
     {% endif %}
--- a/MoinMoin/templates/link_list_no_item_panel.html	Mon Mar 23 17:39:21 2015 +0000
+++ b/MoinMoin/templates/link_list_no_item_panel.html	Mon Apr 27 22:02:22 2015 +0200
@@ -1,4 +1,5 @@
 {% extends theme("layout.html") %}
+{% from "utils.html" import item_panel %}
 {% block content %}
     {% if headline %}
         <h1>{{ headline }}</h1>
@@ -7,13 +8,7 @@
         <h2>Total: {{ fq_names|count }}</h2>
         <ul class="moin-link-list">
             {% for fq_name in fq_names|sort(attribute='value') %}
-                <li>
-                    <a class="moin-fqname"
-                       href="{{ url_for('frontend.show_item', item_name=fq_name) }}"
-                       data-fqname="{{ fq_name }}">
-                           {{ fq_name.value }}
-                    </a>
-                </li>
+                {{ item_panel(fq_name) }}
             {% endfor %}
         </ul>
     {% endif %}
--- a/MoinMoin/templates/modify.html	Mon Mar 23 17:39:21 2015 +0000
+++ b/MoinMoin/templates/modify.html	Mon Apr 27 22:02:22 2015 +0200
@@ -31,6 +31,9 @@
 {% block content %}
     <h1>{{ title }}</h1>
     <div id="moin-modify" class="moin-form">
+        <a class="btn btn-success" style="float: right" href="{{ url_for('.download_item', item_name=item_name, mimetype='application/x.moin.download') }}">
+        <span class="fa fa-download"></span> {{ _('Download') }}
+        </a>
         {{ gen.form.open(form, method='post', enctype='multipart/form-data') }}
             {{ forms.render_errors(form) }}
             {#
--- a/MoinMoin/templates/mychanges.html	Mon Mar 23 17:39:21 2015 +0000
+++ b/MoinMoin/templates/mychanges.html	Mon Apr 27 22:02:22 2015 +0200
@@ -55,5 +55,7 @@
                 </tbody>
             </table>
         </div>
+    {% else %}
+        <p class='moin-flash moin-flash-javascript moin-flash-error'>No changes detected</p>
     {% endif %}
 {% endblock %}
--- a/MoinMoin/templates/sitemap.html	Mon Mar 23 17:39:21 2015 +0000
+++ b/MoinMoin/templates/sitemap.html	Mon Apr 27 22:02:22 2015 +0200
@@ -20,7 +20,7 @@
                     <a href="{{ url_for('frontend.sitemap', item_name=entry) }}">
                         <span class="fa fa-sitemap"></span>
                     </a>
-                    <a class="moin-fqname" href="{{ url_for('frontend.show_item', item_name=entry) }}" data-fqname="{{ entry }}">
+                    <a class="moin-fqname" href="{{ url_for('frontend.show_item', item_name=entry) }}">
                         {{ entry.value }}
                     </a>
                 </li>
--- a/MoinMoin/templates/usersettings_forms.html	Mon Mar 23 17:39:21 2015 +0000
+++ b/MoinMoin/templates/usersettings_forms.html	Mon Apr 27 22:02:22 2015 +0200
@@ -1,7 +1,7 @@
 {% import "forms.html" as forms %}
 
 {% macro personal(form) %}
-    {{ gen.form.open(form, method="post", action=url_for('frontend.usersettings')) }}
+    {{ gen.form.open(form, id="usersettings_personal", method="post", action=url_for('frontend.usersettings')) }}
         {{ forms.render_errors(form) }}
         <dl>
             {{ forms.render(form['name']) }}
--- a/MoinMoin/templates/utils.html	Mon Mar 23 17:39:21 2015 +0000
+++ b/MoinMoin/templates/utils.html	Mon Apr 27 22:02:22 2015 +0200
@@ -262,3 +262,15 @@
         {% endif %}
     </ul>
 {% endmacro %}
+
+{% macro item_panel(fq_name) %}
+    <li>
+        <a class="moin-fqname"
+           href="{{ url_for('frontend.show_item', item_name=fq_name) }}"
+           {% if fq_name.value != fq_name|string %}
+               title="{{ fq_name }}"
+           {% endif %}>
+           {{ fq_name.value }}
+       </a>
+    </li>
+{% endmacro %}
--- a/MoinMoin/themes/basic/templates/modify.html	Mon Mar 23 17:39:21 2015 +0000
+++ b/MoinMoin/themes/basic/templates/modify.html	Mon Apr 27 22:02:22 2015 +0200
@@ -26,6 +26,9 @@
 {% block content %}
     <h1>{{ title }}</h1>
     <div id="moin-modify" class="moin-form">
+        <a class="btn btn-success" style="float: right" href="{{ url_for('.download_item', item_name=item_name, mimetype='application/x.moin.download') }}">
+        <span class="fa fa-download"></span> {{ _('Download') }}
+        </a>
         {{ gen.form.open(form, method='post', enctype='multipart/form-data') }}
             {{ forms.render_errors(form) }}
             {{ forms.render_errors(form['meta_form']['acl']) }}
--- a/README.txt	Mon Mar 23 17:39:21 2015 +0000
+++ b/README.txt	Mon Apr 27 22:02:22 2015 +0200
@@ -14,13 +14,13 @@
 NOTE: moin2 is not released yet, so much information you find on the wiki
 (and elsewhere) will be about moin 1.x (and NOT applicable to moin2).
 
-There is one wiki page collecting all moin2 specific links and infos:
+There is one wiki page collecting all moin2 specific links and info:
 
 http://moinmo.in/MoinMoin2.0 < READ THIS!
 
 
 Project homepage is at http://moinmo.in/ - there are also links to support
-resources and informations about MoinMoin development status and plans.
+resources and information about MoinMoin development status and plans.
 
 In general, please make sure that documentation you read on the wiki or
 somewhere else on the web is written for the moin version you are using.