Zhang Huangbin avatar Zhang Huangbin committed 535e437

Sync templates.

Comments (0)

Files changed (11)

controllers/ldap/urls.py

 #   - /profile/{accountType}/{account}
 #
 
+# Regular expressions.
+re_email = '[\w\-][\w\-\.]+@[\w\-][\w\-\.]+[a-zA-Z]{1,4}'
+re_domain = '[\w\-][\w\-\.]+[a-zA-Z]{1,4}'
+
 urls = (
         # Make url ending with or without '/' going to the same class.
         '/(.*)/',                           'controllers.ldap.base.redirect',
         '/preferences',                     'controllers.ldap.preferences.Preferences',
 
         # Domain related.
-        '/domains',                         'controllers.ldap.domain.list',
-        '/profile/domain/(general)/(.*\..*)',         'controllers.ldap.domain.profile',
-        '/profile/domain/(services)/(.*\..*)',         'controllers.ldap.domain.profile',
-        '/profile/domain/(admins)/(.*\..*)',         'controllers.ldap.domain.profile',
-        '/profile/domain/(quotas)/(.*\..*)',         'controllers.ldap.domain.profile',
-        '/profile/domain/(backupmx)/(.*\..*)',         'controllers.ldap.domain.profile',
-        '/profile/domain/(bcc)/(.*\..*)',         'controllers.ldap.domain.profile',
-        '/profile/domain/(advanced)/(.*\..*)',         'controllers.ldap.domain.profile',
-        '/profile/domain/(.*\..*)',         'controllers.ldap.domain.profile',
-        '/create/domain',                   'controllers.ldap.domain.create',
-        '/delete/domain',                   'controllers.ldap.domain.delete',
+        '/domains',                                     'controllers.ldap.domain.list',
+        '/profile/domain/(general)/(%s)' % re_domain,   'controllers.ldap.domain.profile',
+        '/profile/domain/(services)/(%s)' % re_domain,  'controllers.ldap.domain.profile',
+        '/profile/domain/(admins)/(%s)' % re_domain,    'controllers.ldap.domain.profile',
+        '/profile/domain/(quotas)/(%s)' % re_domain,    'controllers.ldap.domain.profile',
+        '/profile/domain/(backupmx)/(%s)' % re_domain,  'controllers.ldap.domain.profile',
+        '/profile/domain/(bcc)/(%s)' % re_domain,       'controllers.ldap.domain.profile',
+        '/profile/domain/(advanced)/(%s)' % re_domain,  'controllers.ldap.domain.profile',
+        '/profile/domain/(%s)' % re_domain,             'controllers.ldap.domain.profile',
+        '/create/domain',                               'controllers.ldap.domain.create',
+        '/delete/domain',                               'controllers.ldap.domain.delete',
 
         # Admin related.
         '/admins',                          'controllers.ldap.admin.list',
-        '/profile/admin/(.*@.*\..*)',       'controllers.ldap.admin.profile',
+        '/profile/admin/(%s)' % re_email,   'controllers.ldap.admin.profile',
         '/create/admin',                    'controllers.ldap.admin.create',
         '/delete/admin',                    'controllers.ldap.admin.delete',
 
         # User related.
         # /domain.ltd/users
-        '/users',                           'controllers.ldap.user.list',
-        '/users/(.*\..*)',                  'controllers.ldap.user.list',
-        '/profile/user/(general)/(.*@.*\..*)',        'controllers.ldap.user.profile',
-        '/profile/user/(shadow)/(.*@.*\..*)',        'controllers.ldap.user.profile',
-        '/profile/user/(groups)/(.*@.*\..*)',        'controllers.ldap.user.profile',
-        '/profile/user/(services)/(.*@.*\..*)',        'controllers.ldap.user.profile',
-        '/profile/user/(forwarding)/(.*@.*\..*)',        'controllers.ldap.user.profile',
-        '/profile/user/(bcc)/(.*@.*\..*)',        'controllers.ldap.user.profile',
-        '/profile/user/(password)/(.*@.*\..*)',        'controllers.ldap.user.profile',
-        '/profile/user/(advanced)/(.*@.*\..*)',        'controllers.ldap.user.profile',
-        '/profile/user/(.*@.*\..*)',        'controllers.ldap.user.profile',
-        '/create/user/(.*\..*)',            'controllers.ldap.user.create',
-        '/create/user',                     'controllers.ldap.user.create',
-        '/delete/user',                     'controllers.ldap.user.delete',
+        '/users',                                       'controllers.ldap.user.list',
+        '/users/(%s)' % re_domain,                      'controllers.ldap.user.list',
+        '/profile/user/(general)/(%s)' % re_email,      'controllers.ldap.user.profile',
+        '/profile/user/(shadow)/(%s)' % re_email,       'controllers.ldap.domain.profile',
+        '/profile/user/(groups)/(%s)' % re_email,       'controllers.ldap.user.profile',
+        '/profile/user/(services)/(%s)' % re_email,     'controllers.ldap.user.profile',
+        '/profile/user/(forwarding)/(%s)' % re_email,   'controllers.ldap.user.profile',
+        '/profile/user/(bcc)/(%s)' % re_email,          'controllers.ldap.user.profile',
+        '/profile/user/(password)/(%s)' % re_email,     'controllers.ldap.user.profile',
+        '/profile/user/(advanced)/(%s)' % re_email,     'controllers.ldap.user.profile',
+        '/profile/user/(%s)' % re_email,                'controllers.ldap.user.profile',
+        '/create/user',                                 'controllers.ldap.user.create',
+        '/delete/user',                                 'controllers.ldap.user.delete',
+
+        # Group related.
+        '/maillists',                           'controllers.ldap.maillist.list',
+        '/maillists/(%s)' % re_domain,          'controllers.ldap.maillist.list',
+        '/profile/maillist/(%s)' % re_email,    'controllers.ldap.maillist.profile',
+        '/create/maillist',                     'controllers.ldap.maillist.create',
+        '/delete/maillist',                     'controllers.ldap.maillist.delete',
+
+        # Alias related.
+        '/aliases',                         'controllers.ldap.alias.list',
+        '/aliases/(%s)' % re_domain,        'controllers.ldap.alias.list',
+        '/profile/alias/(%s)' % re_email,   'controllers.ldap.alias.profile',
+        '/create/alias',                    'controllers.ldap.alias.create',
+        '/delete/alias',                    'controllers.ldap.alias.delete',
         )

controllers/ldap/user.py

     def GET(self, profile_type, email):
         i = web.input()
         email = web.safestr(email)
+        profile_type = web.safestr(profile_type)
 
         if len(email.split('@', 1)) == 2 and \
                 profile_type in ['general', 'shadow', 'groups', 'services', 'forwarding', 'bcc', 'password', 'advanced',]:
-__version__ = 0.1
+__version__ = '0.1'
 __author__ = 'Zhang Huangbin'
 __author_mail__ = 'michaelbibby@gmail.com'
 __url_iredadmin_lastest__ = 'http://www.iredmail.org/iredadmin_ose_lastest'

templates/default/ldap/admins.html

 <span>{{ _('All mail administrators.') }} {{ _('Total: %s.') |format(admins |length) }}</span>
 {% endblock id_welcome %}
 
+{% block id_visit_links %}
+<span><a href="{{ctx.homepath}}/create/admin">{{ _('Create a new mail admin') }}</a></span>
+{% endblock id_visit_links %}
+
 {% block main %}
 {# Show system message #}
 {#

templates/default/ldap/checknew.html

             </div>
             <div class="sf-box text">
                 {% if info[0] is not sameas none %}
-                    {% if info[0] |float > version |float %}
+                    {% if info[0]  > version %}
                     <label><span><strong>{{ _('New version available') }}</strong></span></label><br />
-                    <ul class="data-list">
-                        <li><span>{{ info[0] |float }}</span></li>
-                        <li><span><a href="{{ info[1] }}">{{ _('ChangeLog') }}</a></span></li>
-                        <li><span><a href="{{ info[2] }}">{{ _('Download') }}</a></span></li>
-                    </ul>
+                    <span class="fld-input">{{ info[0] }}&nbsp;&nbsp;<a href="{{ info[1] }}">{{ _('Release note') }}</a>&nbsp;&nbsp;<a href="{{ info[2] }}">{{ _('Download') }}</a></span>
                     {% else %}
                     <label><span>{{ _('Version status:') }}</span></label><br />
                     <span class="fld-input">{{ _('Your iRedAdmin is up to date.') }}</span>

templates/default/ldap/domain_profile.html

 
 {% block id_welcome %}
 <span><a href="{{ctx.homepath}}/profile/domain/general/{{cur_domain}}" {% if profile_type == "general" %}class="active"{%endif%}>General</a>&nbsp;</span>
-{% if session.get('domainGlobalAdmin') == 'yes' %}
-    <span><a href="{{ctx.homepath}}/profile/domain/admins/{{cur_domain}}" {% if profile_type == "admins" %}class="active"{%endif%}>Admins</a>&nbsp;</span>
-    <span><a href="{{ctx.homepath}}/profile/domain/services/{{cur_domain}}" {% if profile_type == "services" %}class="active"{%endif%}>Service control</a>&nbsp;</span>
-    <span><a href="{{ctx.homepath}}/profile/domain/bcc/{{cur_domain}}" {%if profile_type == 'bcc'%}class="active"{%endif%}>BCC control</a>&nbsp;</span>
-    <span><a href="{{ctx.homepath}}/profile/domain/quotas/{{cur_domain}}" {%if profile_type == 'quotas'%}class="active"{%endif%}>Quotas</a>&nbsp;</span>
-    <span><a href="{{ctx.homepath}}/profile/domain/backupmx/{{cur_domain}}" {%if profile_type == 'backupmx'%}class="active"{%endif%}>Backup MX</a>&nbsp;</span>
-    <span><a href="{{ctx.homepath}}/profile/domain/advanced/{{cur_domain}}" {%if profile_type == 'advanced'%}class="active"{%endif%}>Advanced settings</a>&nbsp;</span>
-{% endif %}
 {% endblock id_welcome %}
 
+{% block id_visit_links %}
+<span><a href="{{ctx.homepath}}/users/{{cur_domain}}">{{ _('Users') }}</a></span>
+{% endblock id_visit_links %}
+
 {# Domain profile. #}
 {% block main %}
 {% set p = profile[0] %}
                                 </select>
                             </span></span></li>
                     <li><span><strong>{{ _('Company/Organization:') }}</strong> {{cn}}</span></li>
-                    <li><span><strong>{{ _('Created Date:') }}</strong> {{createTimestamp[:4]}}.{{createTimestamp[4:6]}}.{{createTimestamp[6:8]}} {{createTimestamp[8:10]}}:{{createTimestamp[10:12]}}:{{createTimestamp[12:14]}}</span></li>
+                    <li><span><strong>{{ _('Created Date:') }}</strong> {{createTimestamp[:4]}}-{{createTimestamp[4:6]}}-{{createTimestamp[6:8]}} {{createTimestamp[8:10]}}:{{createTimestamp[10:12]}}:{{createTimestamp[12:14]}}</span></li>
                     </ul>
                 </div>
             </div>

templates/default/ldap/domains.html

 <span>{{ _('All domains under your control.') }} {{ _('Total: %s.') |format(domains|length) }}</span>
 {% endblock id_welcome %}
 
+{% block id_visit_links %}
+{% if session.get('domainGlobalAdmin') == 'yes' %}
+<span><a href="{{ctx.homepath}}/create/domain">{{ _('Create a new mail domain') }}</a></span>
+{% endif %}
+{% endblock id_visit_links %}
+
 {% block main %}
 {# Show system message #}
 {#

templates/default/ldap/layout.html

             {% block submenu %}
             <div id="brd-visit" class="admin-submenu gen-content">
                 <p id="welcome">{% block id_welcome %}{% endblock id_welcome %}</p>
+                <p id="visit-links" class="options">{% block id_visit_links %}{% endblock id_visit_links %}</p>
             </div>
             {% endblock submenu %}
         {% endif %}

templates/default/ldap/macros.html

 {%- endmacro %}
 
 {% macro display_all_admins(admins, domainAdmins=[]) -%}
-    <fieldset class="frm-group mf-set required">
+    <div class="frm-group group1">
+        <fieldset class="mf-set set1">
         <legend><span>{{ _('Domain admin assignment') }}<em>{{ _('If no admin assigned, you can manage it with global admin.') }}</em></span></legend>
         <div class="mf-box">
             <div class="checklist">
                     {% set adminMail = admin[1].get('mail')[0] %}
                     <div class="checklist-item">
                         <span class="fld-input">
-                            <input type="checkbox" id="fld1" name="domainAdmin" value="{{ adminMail }}" {% if adminMail in domainAdmins %}checked{%endif%} />
+                            <input type="checkbox" name="domainAdmin" value="{{ adminMail }}" {% if adminMail in domainAdmins %}checked{%endif%} />
                         </span>
                         <label>
                             {% if admin[1].has_key('cn') %}
                             {% else %}
                             {{ adminMail }}
                             {% endif %}
-                            {% if 'yes' in admin[1].get('domainGlobalAdmin', []) %}<em><strong>{{ _('(Global Admin)') }}</strong></em>{% endif %}</label>
+                            {% if 'yes' in admin[1].get('domainGlobalAdmin', []) %}<em><strong>{{ _('(Global Admin)') }}</strong></em>{% endif %}
+                        </label>
                     </div>
                     {% endfor %}
                 </fieldset>

templates/default/ldap/user_profile.html

                     <li class="username fn nickname"><span>{{ _('Name:') }} <strong>{{cn}}</strong></span></li>
                     <li><span>{{ _('Mail:') }} <strong>{{mail}}</strong></span></li>
                     <li><span>{{ _('Employee ID:') }} <strong>{{employeeNumber}}</strong></span></li>
-                    <li><span>{{ _('Created:') }} <strong>{{createTimestamp[:4]}}.{{createTimestamp[4:6]}}.{{createTimestamp[6:8]}} {{createTimestamp[8:10]}}:{{createTimestamp[10:12]}}:{{createTimestamp[12:14]}}</strong></span></li>
+                    <li><span>{{ _('Created:') }} <strong>{{createTimestamp[:4]}}-{{createTimestamp[4:6]}}-{{createTimestamp[6:8]}} {{createTimestamp[8:10]}}:{{createTimestamp[10:12]}}:{{createTimestamp[12:14]}}</strong></span></li>
                 </ul>
             </div>
         </div>

templates/default/ldap/users.html

 </span>
 {% endblock id_welcome %}
 
+{% block id_visit_links %}
+<span><a href="{{ctx.homepath}}/create/user">{{ _('Create a new mail user') }}</a></span>
+{% endblock id_visit_links %}
+
 {% block main %}
 {# Show system message #}
 {#
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.