Commits

Zhang Huangbin committed 5b92817

Display language switcher in login page.

  • Participants
  • Parent commits 96979b2

Comments (0)

Files changed (5)

 *.py[co]
 *.svn
 settings.ini
+settings.ini.bak
 .project
 .pydevproject
 .settings

File controllers/ldap/basic.py

 
 import web, sys
 from libs import __version__, __url_iredadmin_lastest__, iredutils
-from libs.ldaplib import core, auth, domain, ldaputils
+from libs.ldaplib import core, auth, admin, domain, ldaputils
 from controllers import base
 
 cfg = web.iredconfig
 session = web.config.get('_session')
 render = web.render
 
+adminLib = admin.Admin()
+
 class login:
     def GET(self):
         if session.get('logged') is True:
             i = web.input()
 
             # Show login page.
-            return render.login(msg=i.get('msg'),)
+            return render.login(
+                    languagemaps=adminLib.getLanguageMaps(),
+                    msg=i.get('msg'),
+                    )
 
     def POST(self):
         # Get username, password.

File libs/__init__.py

 # along with iRedAdmin-OSE.  If not, see <http://www.gnu.org/licenses/>.
 #---------------------------------------------------------------------
 
-__version__ = '0.1.1'
+__version__ = '0.2.0'
 __author__ = 'Zhang Huangbin'
 __author_mail__ = 'michaelbibby@gmail.com'
 __url_iredadmin_lastest__ = 'http://www.iredmail.org/iredadmin_ose_lastest'

File templates/default/ldap/dashboard.html

                     <li><span>* {{ _('Per-user mail forwarding control') }}</span></li>
                     <li><span>* {{ _('Per-user service control') }}</span></li>
                     <li><span>* {{ _('Admin type control (Global/Normal Admin)') }}</span></li>
+                    <li><span>{{ _('Follow this <a href="%s">short tutorial</a> to migrate to full-featured edition.') |format('http://www.iredmail.org/forum/topic466-faq-how-to-migrate-from-open-source-edition-to-fullfeatured-edition.html') }}</span></li>
                 </ul>
-                <p class="options"><span>{{ _('Read this <a href="%s">short tutorial</a> for migrating to full-featured edition.') |format('http://www.iredmail.org/forum/topic466-faq-how-to-migrate-from-open-source-edition-to-fullfeatured-edition.html') }}</span></p>
             </div>
         </div>
     </div>

File templates/default/ldap/login.html

 #---------------------------------------------------------------------
 #}
 
+{#
+    @languagemaps   language maps
+#}
+
 {% extends "layout.html" %}
 
 {% from "msgHandlers.html" import loginMsgHandler with context %}
     #brd-wrap {
         margin-left: auto;
         margin-right: auto;
-        width: 40em;
+        width: 45em;
         text-align: left;
     }
 </style>
 {% block main %}
 <div id="brd-main">
     <div class="main-head">
-        <h2 class="hn"><span>{{ _('Login to manage your mail domains & users') |title }}</span></h2>
+        <h2 class="hn">
+            <span>{{ _('Login to manage your mail domains & users') |title }}</span>
+            <span>
+                <select name="lang" onchange="changeUrl(this, baseurl='{{ctx.homepath}}/login?lang=');">
+                    {% for lang in languagemaps %}
+                        <option value="{{lang}}" {% if ctx.lang == lang %}selected{%endif%}>{{languagemaps[lang]}}</option>
+                    {% endfor %}
+                </select>
+            </span>
+        </h2>
     </div>
 
-    {# Show system message #}
+    {# Show system message if available #}
     {{ loginMsgHandler(msg) }}
 
     {# Show login form #}